Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- By: luckytyphlosion
- -- Use to determine what is picked up by each coordinate trigger struct
- -- Hold A when interacting with a map object (0x2013920) to see its return value (doesn't read new collision until A is released)
- -- I don't like Lua.
- local x = 2; -- puts text one pixel from edge
- local y = 1; -- puts text one pixel from edge
- -- font is 4 pixels by 7 pixels
- local function addY()
- y = y + 8; -- 1 char == 7 pixels
- end
- local function addX(text)
- x = x + 4 * (string.len(text) + 1); -- 1 char == 4 pixels
- end
- local function toScreen(text, sameLine)
- gui.text(x, y, text);
- if sameLine then
- addX(text);
- else
- addY();
- end
- end
- function on2011A20Breakpoint()
- _2011A20Str = _2011A20Str .. string.format("0x%02x, ", memory.getregister("r6"));
- end
- function on2011D10BreakpointEventFlag()
- local flagSet = memory.getregister("r0");
- _2011D10Str = _2011D10Str .. string.format("0x%04x:%d", 0x1640 + memory.getregister("r6"), flagSet);
- if flagSet == 0 then
- _2011D10Str = _2011D10Str .. ", "
- else
- _2011D10Str = _2011D10Str .. "|"
- end
- end
- function on2011D10Breakpoint()
- _2011D10Str = _2011D10Str .. string.format("0x%02x, ", memory.getregister("r6"));
- end
- function on2013940Breakpoint()
- _2013940Str = _2013940Str .. string.format("0x%02x, ", memory.getregister("r6"));
- end
- function on2013920Breakpoint()
- if not aInputAfterPress then
- _2013920Str = _2013920Str .. string.format("0x%02x->", memory.getregister("r6"));
- end
- end
- function on2013920JumptableReturnBreakpoint()
- if not aInputAfterPress then
- local eventFlag = memory.getregister("r0");
- _2013920Str = _2013920Str .. string.format("0x%02x", eventFlag);
- if eventFlag > 0xe then
- _2013920Str = _2013920Str .. ",";
- else
- _2013920Str = _2013920Str .. ":";
- end
- end
- end
- function on2013920AfterEventFlagBreakpoint()
- if not aInputAfterPress then
- _2013920Str = _2013920Str .. string.format("0x%02x,", memory.getregister("r0"));
- end
- end
- _2011A20Breakpoint = 0x803166a;
- _2011A20Str = "";
- _2011D10BreakpointEventFlag = 0x8030bec;
- _2011D10Breakpoint = 0x8030bf0;
- _2011D10Str = "";
- _2013940Breakpoint = 0x80318f6;
- _2013940Str = "";
- _2013920Breakpoint = 0x8031ac0;
- _2013920JumptableReturnBreakpoint = 0x8031ad2;
- _2013920AfterEventFlagBreakpoint = 0x8031aee;
- _2013920Str = "";
- memory.registerexec(_2011A20Breakpoint, on2011A20Breakpoint);
- memory.registerexec(_2011D10BreakpointEventFlag, on2011D10BreakpointEventFlag);
- memory.registerexec(_2011D10Breakpoint, on2011D10Breakpoint);
- memory.registerexec(_2013920Breakpoint, on2013920Breakpoint);
- memory.registerexec(_2013920JumptableReturnBreakpoint, on2013920JumptableReturnBreakpoint);
- memory.registerexec(_2013920AfterEventFlagBreakpoint, on2013920AfterEventFlagBreakpoint);
- while true do
- x = 2;
- y = 1;
- --_2011A20Str = nil;
- _2011A20Str = "2011A20: ";
- _2011D10Str = "2011D10: ";
- _2013940Str = "2013940: ";
- aInputTemp = joypad.getdown(1)["A"];
- aInputPressed = (not aInputTemp ~= not aInputDown) and aInputTemp;
- aInputDown = aInputTemp;
- aInputAfterPress = not aInputPressed and aInputDown;
- if not aInputDown then
- _2013920Str = "";
- --[[ framesSinceAfterAPress = 0;
- else
- if (_2013920Str == "") then
- framesSinceAfterAPress = framesSinceAfterAPress + 1;
- else
- print(framesSinceAfterAPress);
- end]]--
- end
- vba.frameadvance();
- toScreen(_2011A20Str);
- toScreen(_2011D10Str);
- toScreen(_2013940Str);
- toScreen("2013920: ");
- toScreen(_2013920Str);
- --toScreen(string.format("framesSinceAfterAPress: %d", framesSinceAfterAPress));
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement