Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- debug_finder_j.lua
- --
- -- For use with Majora's Mask (J) 1.1
- -- Open up the Song of Soaring menu before activating the script
- -- Check if any of the substrings for the destination will cause the debug menu
- -- to appear as well as the OoT Save menu. These results would only be theoretically
- -- possible on VC due to crashing.
- --
- -- Author: @Faschz (modified by Exodus)
- -- Created: May 5th, 2019
- MESSAGE_ADDRESS = 0x1CB010
- LENGTH_ADDRESS = 0x1CB0D8
- --If this byte is written with a value < 7... the string gets written twice
- INSTRUCTION_OFFSET = 191
- PAUSE_OFFSET = 1742
- DEBUG_OFFSET = 1744
- REQUIRED_LENGTH = DEBUG_OFFSET/2
- for index=-32768, 32767 do
- -- The string is given
- length = mainmemory.read_s16_be(LENGTH_ADDRESS + index*2)
- -- Check if this string would be written twice according to this short
- instruction_short = mainmemory.read_s16_be(MESSAGE_ADDRESS + index*18 + INSTRUCTION_OFFSET)
- if length >= REQUIRED_LENGTH then
- debug_short = mainmemory.read_u16_be(MESSAGE_ADDRESS + index*18 + DEBUG_OFFSET)
- pause_short = mainmemory.read_u16_be(MESSAGE_ADDRESS + index*18 + PAUSE_OFFSET)
- if (debug_short == 1 or debug_short == 2) and (pause_short == 7 or (pause_short >= 9 and pause_short <= 14)) then
- print("WORKING INDEX: "..index..", length = "..length..", menu = "..pause_short)
- end
- elseif length >= INSTRUCTION_OFFSET and instruction_short < 7 and length*2 >= REQUIRED_LENGTH then
- -- Here the string gets written twice, so the offset from the substring is different
- -- from normal. For instance: If normally the offset was the 7th byte, but the length was 4
- -- when the string is written twice it would be the 3rd byte on the 2nd write (7%4)
- --TODO: This isn't actually true 100%, because once it prints the string the first time it also
- -- prints the data for the yes/no options and reprints the start of the string. So the offset would
- -- have to take into account how large this data is.
- debug_short = mainmemory.read_u16_be(MESSAGE_ADDRESS + index*18 + (DEBUG_OFFSET%length))
- pause_short = mainmemory.read_u16_be(MESSAGE_ADDRESS + index*18 + (PAUSE_OFFSET%length))
- --if (debug_short == 1 or debug_short == 2) and (pause_short >= 9 and pause_short <= 14) then
- -- print("WORKING INDEX: "..index)
- --end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement