mirror of
https://github.com/notwa/mm
synced 2024-11-05 01:29:03 -08:00
add epona glitch monitoring script
This commit is contained in:
parent
2e42819b99
commit
5432a79b3c
2 changed files with 53 additions and 1 deletions
|
@ -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,
|
||||
|
|
47
Lua/epona monitor.lua
Normal file
47
Lua/epona monitor.lua
Normal file
|
@ -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
|
Loading…
Reference in a new issue