1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-11-05 04:39:03 -08:00
mm/Lua/misc monitor.lua

73 lines
1.5 KiB
Lua
Raw Normal View History

2015-05-26 01:26:42 -07:00
require = require "depend"
require "boilerplate"
require "addrs.init"
require "messages"
2015-05-26 00:40:12 -07:00
require "classes"
2015-05-26 01:26:42 -07:00
-- no effect on OoT
2015-05-26 00:40:12 -07:00
local unk_only = false
local unk = ByteMonitor('unk', AL(0xF6, 0x37A))
2015-05-26 00:40:12 -07:00
unk.byvalue = true
unk:load('data/_unk.lua')
2015-05-26 00:40:12 -07:00
2015-05-26 01:26:42 -07:00
local size = addrs.checksum.addr - addrs.exit_value.addr + 4
local link = ByteMonitor('link', AL(0, size))
local ignore_fields = mm and {
2015-05-26 00:40:12 -07:00
"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",
2015-05-26 01:26:42 -07:00
} or {
"exit_value",
"cutscene_status",
"time",
"hearts",
"magic",
"rupees",
"navi_timer",
"scene_flags_save",
"inventory_items",
"inventory_quantities",
"event_chk_inf",
"item_get_inf",
"inf_table",
"event_inf",
2015-05-26 00:40:12 -07:00
}
function link:ignore(i)
for _, k in ipairs(ignore_fields) do
2015-05-26 01:26:42 -07:00
local v = addrs[k]
if not v then
error('unknown addr: '..tostring(k), 1)
end
local size = v.type
2015-05-26 00:40:12 -07:00
if size == 'f' then size = 4 end
2015-05-26 01:26:42 -07:00
local a = v.addr - self.begin
if i >= a and i < a + size then return true end
2015-05-26 00:40:12 -07:00
end
end
2015-05-26 01:26:42 -07:00
while mm or oot do
if mm and unk_only then
2015-05-26 00:40:12 -07:00
unk:diff()
unk:save()
else
link:diff()
end
draw_messages()
2015-05-26 00:40:12 -07:00
print_deferred()
emu.frameadvance()
end