1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-11-05 05:39:02 -08:00

extend flag monitoring to OoT

This commit is contained in:
Connor Olding 2015-05-07 15:27:50 -07:00
parent 5c76e9466a
commit aab7950976

View file

@ -1,6 +1,7 @@
require "boilerplate" require "boilerplate"
require "addrs.init" require "addrs.init"
require "classes" require "classes"
require "messages"
local ignore = { local ignore = {
-- every time a scene (un)loads -- every time a scene (un)loads
@ -30,30 +31,66 @@ function FlagMonitor:mark(i, x, x1)
for which = 0, 7 do for which = 0, 7 do
if bit.band(diff, 2^which) ~= 0 then if bit.band(diff, 2^which) ~= 0 then
local state = bit.band(x, 2^which) ~= 0 and 1 or 0 local state = bit.band(x, 2^which) ~= 0 and 1 or 0
local str = ('%02i,%i=%i (%s)'):format(i, which, state, self.name) local str
if not ignore[str] then if oot then
printf('%s @%i', str, now) local row = math.floor(i/2)
gui.addmessage(str) local col = which + (1 - (i % 2))*8
str = ('%02i,%X=%i (%s)'):format(row, col, state, self.name)
else
str = ('%02i,%i=%i (%s)'):format(i, which, state, self.name)
end end
local ib = i*8 + which local ib = i*8 + which
if not self.modified[ib] then if not self.modified[ib] then
self.modified[ib] = true self.modified[ib] = true
self.dirty = true self.dirty = true
str = str..' (NEW!)'
end
if not ignore[str] then
printf('%s @%i', str, now)
message(str, 180)
end end
end end
end end
end end
local weg = FlagMonitor('weg', addrs.week_event_reg) if mm then
local inf = FlagMonitor('inf', addrs.event_inf) local weg = FlagMonitor('weg', addrs.week_event_reg)
local mmb = FlagMonitor('mmb', addrs.mask_mask_bit) local inf = FlagMonitor('inf', addrs.event_inf)
weg:load('data/_weg.lua') local mmb = FlagMonitor('mmb', addrs.mask_mask_bit)
inf:load('data/_inf.lua') weg:load('data/_weg.lua')
while mm do inf:load('data/_inf.lua')
weg:diff() while mm do
inf:diff() weg:diff()
mmb:diff() inf:diff()
weg:save() mmb:diff()
inf:save() weg:save()
emu.frameadvance() inf:save()
draw_messages()
emu.frameadvance()
end
elseif oot then
local eci = FlagMonitor('eci', AL(0xED4, 0x1C))
local igi = FlagMonitor('igi', AL(0xEF0, 0x8))
local it_ = FlagMonitor('it ', AL(0xEF8, 0x3C))
local ei_ = FlagMonitor('ei ', AL(0x13FA, 0x8))
eci:load('data/_eci.lua')
igi:load('data/_igi.lua')
it_:load('data/_it.lua')
ei_:load('data/_ei.lua')
eci.oot = true
igi.oot = true
it_.oot = true
ei_.oot = true
while oot do
eci:diff()
igi:diff()
it_:diff()
ei_:diff()
eci:save()
igi:save()
it_:save()
ei_:save()
draw_messages()
emu.frameadvance()
end
end end