Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- debug_finder.lua
- --
- -- This script is designed to run on Majora's Mask (U), however can easily be
- -- changed to run on (J) by making changes to addresses/sizes.
- --
- -- This script checks the strings written from index warp to see if they will
- -- cause overflow into the debug menu (inventory editor). These indices that are
- -- pulled from this script most likely will crash on N64 due to printed
- -- characters crashing, however on VC or Wii U they will not crash until you
- -- reach a loading zone.
- --
- -- Author: @Faschz
- -- Created: May 5th, 2019
- -- Updated: August 7th, 2019
- -- All specific to the current language/version of the game.
- STRING_BASE = 0x1D0714 -- Address to the start of the table for the strings.
- LENGTH_BASE = 0x1D07C4 -- Address to the start of the table for the lengths.
- ENTRANT_SIZE = 16 -- Size of each entrant of the string table.
- -- The amount of bytes offset from the start of the written string in order to
- -- reach the specific addresses.
- PAUSE_OFFSET = 1767
- DEBUG_OFFSET = 1769
- -- The calculated required length to overwrite the addresses from the text
- -- overflow glitch without the use of the instruction counter.
- REQUIRED_LENGTH = DEBUG_OFFSET + 1 -- Added 1 because the address is a short.
- -- The address for the index is a signed short, so the value range is as follows
- for index=-32768, 32767 do
- -- On Japanese the length is not in bytes, but instead shorts due to
- -- fact that characters on J are 2 bytes instead of 1.
- length = mainmemory.read_s16_be(LENGTH_BASE + 2*index)
- if (length >= REQUIRED_LENGTH) then
- -- Read what the values would be for the overwritten addresses
- pause = mainmemory.read_u16_be(STRING_BASE + ENTRANT_SIZE*index +
- PAUSE_OFFSET)
- editor = mainmemory.read_u16_be(STRING_BASE + ENTRANT_SIZE*index +
- DEBUG_OFFSET)
- -- These values make for a workable inventory editor that can be saved
- -- through the use of the left over OoT save menu.
- if ((editor == 1 or editor == 2) and (pause >= 9 and pause <= 14)) then
- print(index)
- end
- end
- end
- print("Finished debug_finder.lua!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement