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 (J)
- --
- -- Author: @Faschz (modified by Exodus)
- -- Created: April 10th, 2019
- MAP_INDEX_ADDR = 0x3FDC40
- MENU_ADDR = 0x3FDBEC
- DEBUG_ADDR = 0x3FDBEE
- NOTEBOOK_ADDR = 0x3FDBF0
- BASE_ADDRESS_LENGTH = 0x1CAEC8
- file = io.open('debug_JP_1.0.txt', 'w')
- for index = -32768, 32767 do
- -- Load state ready to select a Song of Soaring location
- savestate.loadslot(2)
- length = mainmemory.read_s16_be(bit.band(BASE_ADDRESS_LENGTH + bit.lshift(index, 1), 0xFFFFFF))
- -- 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
- for f=0,60 do
- emu.frameadvance()
- end
- goodmenu = false
- gooddebug = false
- print(index.." ("..length..")")
- file:write(index.." ("..length..")\n")
- -- Begin checking for the interesting results
- menub = mainmemory.read_u16_be(MENU_ADDR)
- if (menub >= 9 and menub <= 14) or
- (menub >= 16 and menub <= 18) then
- print("Menu: "..menub)
- file:write("Menu: "..menub.."\n")
- goodmenu = true
- end
- debugb = mainmemory.read_u16_be(DEBUG_ADDR)
- if debugb == 1 or debugb == 2 then
- print("Debug: "..debugb)
- file:write("Debug: "..debugb.."\n")
- gooddebug = true
- end
- noteb = mainmemory.readbyte(NOTEBOOK_ADDR)
- if noteb ~= 0 then
- print("Notebook: "..noteb)
- file:write("Notebook: "..noteb.."\n")
- end
- if((goodmenu == true) and (gooddebug == true)) then
- print("SOLUTION")
- file:write("SOLUTION\n")
- end
- end
- file:close()
- print("DONE!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement