Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- brute_force.lua
- --
- -- Brute force search for some interesting results of Index Warp.
- -- Used for Majora's Mask (U), can be changed to (J) by changing
- -- memory addresses to their equivalent value
- --
- -- Author: @Faschz
- -- Created: April 10th, 2019
- MAP_INDEX_ADDR = 0x3FDA90
- MENU_ADDR = 0x3FDA3C
- DEBUG_ADDR = 0x3FDA3E
- NOTEBOOK_ADDR = 0x3FDA40
- -- 'S' in "Soar to" part of the textbox, used for checking when the textbox is written
- MESSAGE_ADDR = 0x3FD34C
- for index=-32768, 32767 do
- -- Load state ready to select a Song of Soaring location
- savestate.loadslot(2)
- -- Write the index
- mainmemory.write_s16_be(MAP_INDEX_ADDR, index)
- -- Select the index
- joypad.set({["A"] = true}, 1)
- emu.frameadvance()
- joypad.set({["A"] = false}, 1)
- -- Wait for the textbox to appear
- repeat
- emu.frameadvance()
- until mainmemory.readbyte(MESSAGE_ADDR) == 0x53
- emu.frameadvance()
- -- Additional waiting, only so many characters can be written per VI
- for frame=0, 30 do
- emu.frameadvance()
- end
- -- Begin checking for the interesting results
- if (mainmemory.read_u16_be(MENU_ADDR) >= 4 and mainmemory.read_u16_be(MENU_ADDR) <= 14) or
- (mainmemory.read_u16_be(MENU_ADDR) >= 16 and mainmemory.read_u16_be(MENU_ADDR) <= 18) then
- print("Menu: "..index)
- end
- if mainmemory.read_u16_be(DEBUG_ADDR) == 1 or mainmemory.read_u16_be(DEBUG_ADDR) == 2 then
- print("Debug: "..index)
- end
- if mainmemory.readbyte(NOTEBOOK_ADDR) ~= 0 then
- print("Notebook: "..index)
- end
- end
- print("DONE!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement