From 02af8b23f20bf1dc5c4634b8aa4a20fb3d7026a3 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Tue, 26 May 2015 00:40:12 -0700 Subject: [PATCH] misc monitor for everything else --- Lua/addrs/M/common.lua | 2 ++ Lua/classes/ByteMonitor.lua | 27 ++++++++++++++++------- Lua/misc monitor.lua | 44 ++++++++++++++++++++++++++++++++++--- 3 files changed, 62 insertions(+), 11 deletions(-) diff --git a/Lua/addrs/M/common.lua b/Lua/addrs/M/common.lua index 769a006..ec82ae8 100755 --- a/Lua/addrs/M/common.lua +++ b/Lua/addrs/M/common.lua @@ -101,6 +101,7 @@ end return { link = A(link, 0x4000), exit_value = AL(0x02, 2), + mask_worn = AL(0x04, 1), intro_completed = AL(0x05, 1), cutscene_status = AL(0x0A, 2), time = AL(0x0C, 2), @@ -119,6 +120,7 @@ return { has_magic = AL(0x38, 1), -- ? magic = AL(0x39, 1), rupees = AL(0x3A, 2), + navi_timer = AL(0x3C, 4), -- ? has_normal_magic = AL(0x40, 1), has_double_magic = AL(0x41, 1), owls_hit = AL(0x46, 2), diff --git a/Lua/classes/ByteMonitor.lua b/Lua/classes/ByteMonitor.lua index 70dd4bc..f5ad465 100644 --- a/Lua/classes/ByteMonitor.lua +++ b/Lua/classes/ByteMonitor.lua @@ -1,16 +1,27 @@ local Monitor = require "classes.Monitor" local ByteMonitor = Class(Monitor) +local printf = dprintf or printf + function ByteMonitor:mark(i, x, x1) + if self.ignore and self:ignore(i) then return end local now = emu.framecount() - local str = ('%02i=%02X (%s)'):format(i, x, self.name) - if not self.modified[i] then - self.modified[i] = {} - end - if not self.modified[i][x] then - self.modified[i][x] = true - self.dirty = true - str = str..' (NEW!)' + local str = ('%04X=%02X (%s)'):format(i, x, self.name) + if self.byvalue then + if not self.modified[i] then + self.modified[i] = {} + end + if not self.modified[i][x] then + self.modified[i][x] = true + self.dirty = true + str = str..' (NEW!)' + end + else + if not self.modified[i] then + self.modified[i] = true + self.dirty = true + str = str..' (NEW!)' + end end printf('%s @%i', str, now) message(str, 180) diff --git a/Lua/misc monitor.lua b/Lua/misc monitor.lua index da6a30c..0749fac 100644 --- a/Lua/misc monitor.lua +++ b/Lua/misc monitor.lua @@ -1,13 +1,51 @@ require "boilerplate" require "addrs.init" -require "classes" require "messages" +require "classes" + +local unk_only = false local unk = ByteMonitor('unk', AL(0xF6, 0x37A)) +unk.byvalue = true unk:load('data/_unk.lua') + +local link = ByteMonitor('link', AL(0,0x100C)) +local ignore_fields = { + "exit_value", + "mask_worn", + "cutscene_status", + "time", + "transformation", + "hearts", + "magic", + "rupees", + "navi_timer", + "scene_flags_save", + "week_event_reg", + "event_inf", + "inventory_items", + "inventory_masks", + "inventory_quantities", +} + +function link:ignore(i) + for _, k in ipairs(ignore_fields) do + local size = addrs[k].type + if size == 'f' then size = 4 end + local a = addrs[k].addr - self.begin + local b = a + size + if i >= a and i < b then return true end + end +end + while mm do - unk:diff() - unk:save() + if unk_only then + unk:diff() + unk:save() + else + link:diff() + end draw_messages() + print_deferred() emu.frameadvance() end