Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- instruction_counter.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 is used to find what the values of the "instruction counter" gets
- -- overwritten to given specific indices. The instruction counter getting
- -- written allows for easily manipulatable text overflow options.
- --
- -- Author: @Faschz
- -- Created: May 5th, 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.
- INSTRUCTION_OFFSET = 191
- PAUSE_OFFSET = 1767
- -- The calculated required length to overwrite the addresses from the text
- -- overflow glitch without the use of the instruction counter.
- REQUIRED_LENGTH = INSTRUCTION_OFFSET + 1 -- Address is a short, so add 1
- file = io.open("instruction_counter.txt", "w")
- -- The address for the index is a signed short, so the value range is as follows
- -- for RTA viable indices.
- for index=-300, 300 do
- length = mainmemory.read_s16_be(LENGTH_BASE + 2*index)
- -- Check if the length is high enough to overwrite the "instruction counter"
- -- while also being low enough as to not overwrite the menu type and debug
- -- menu short
- if (length >= REQUIRED_LENGTH and length < PAUSE_OFFSET) then
- instruction = mainmemory.read_u16_be(STRING_BASE + ENTRANT_SIZE*index +
- INSTRUCTION_OFFSET)
- file:write(index.." --- "..length.." --- "..instruction.."\n")
- end
- end
- file:close()
- print("Finished instruction_counter.lua!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement