diff --git a/Lua/README.md b/Lua/README.md index 7670f35..6ebc7e8 100644 --- a/Lua/README.md +++ b/Lua/README.md @@ -12,7 +12,7 @@ Note that some scripts lack full support for Ocarina of Time. ## Scripts -#### actor listor.lua +#### actor lister.lua Lists actor data onscreen, and focuses the camera on them. Actors may be selected using the D-Pad. @@ -70,6 +70,11 @@ These scripts look for changes in RAM regions and print them in detail. These are mostly used for documenation. +#### epona monitor.lua +used to investigate [this glitch with unloading Epona.][eponaglitch] + +[eponaglitch]: https://www.youtube.com/watch?v=kX0ZcIS8P84 + #### event flag monitor.lua Monitors event flags, and announces which bits are being changed, diff --git a/Lua/epona monitor.lua b/Lua/epona monitor.lua new file mode 100644 index 0000000..87190f5 --- /dev/null +++ b/Lua/epona monitor.lua @@ -0,0 +1,47 @@ +require = require "depend" +require "boilerplate" +require "addrs.init" +require "messages" +require "actors" + +local actor_names = require "data.actor names" + +local epona_addr = 0 +while true do + local nearest = {} + local offset = 0x800000 + + for at, ai, addr in iter_actors() do + local actor_number = R2(addr) + local name = actor_names[actor_number] + local size = R4(addr - 0xC) -- read linked list data above the actor + if actor_number == 0x00D then + epona_addr = addr + end + + if epona_addr then + local diff = addr - epona_addr + if diff >= 0 and diff < offset then + offset = diff + nearest.name = name or "[error]" + nearest.addr = addr + nearest.at = at + nearest.ai = ai + nearest.size = size + end + end + end + + if nearest.addr then + local color = offset <= nearest.size and 'white' or 'yellow' + T_BR(0, 4, 'white', 'Epona: %06X', epona_addr) + T_BR(0, 3, 'white', '%s: %06X', nearest.name, nearest.addr) + T_BR(0, 2, color, 'Offset: %06X', offset) + T_BR(0, 1, color, 'Size: %06X', nearest.size) + T_BR(0, 0, 'white', 'Type, Index: %2i, %2i', nearest.at, nearest.ai) + else + T_BR(0, 0, 'yellow', 'Epona not found') + end + + emu.frameadvance() +end