Advertisement
Faschz

Majora's Mask - char_checker

Apr 6th, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. -- char_checker.lua
  2. --
  3. -- Automate the process of checking whether or not a printed
  4. -- character will crash Majora's Mask (U) on Bizhawk. Can be
  5. -- swapped over to test japanese characters on (J) by changing
  6. -- the writes to be 16 bit as well as finding the new addresses
  7. --
  8. -- Author: @Faschz
  9. -- Created: April 6th, 2019
  10.  
  11. CHARACTER_ADDR = 0x1D0714
  12. TEXTBOX_ADDR = 0x3FD355
  13. TIMER_ADDR = 0x1F9F83
  14.  
  15. for c=0, 255 do
  16.     -- Recover from any crashes by loading a state about to select
  17.     -- the soaring location for Great Bay Coast
  18.     savestate.loadslot(2)
  19.    
  20.     -- Set the character in the message table
  21.     mainmemory.writebyte(CHARACTER_ADDR, c)
  22.    
  23.     -- Select the soaring location
  24.     joypad.set({["A"] = true}, 1)
  25.     emu.frameadvance()
  26.     joypad.set({["A"] = false}, 1)
  27.    
  28.     -- Wait until the textbox appears and changes the address
  29.     while c ~= mainmemory.readbyte(TEXTBOX_ADDR) do
  30.         emu.frameadvance()
  31.     end
  32.    
  33.     -- Check if the game is crashed by reading the frame count
  34.     start = mainmemory.readbyte(TIMER_ADDR)
  35.     is_crashed = true
  36.    
  37.     --3 frames work, but lets be on the safe side
  38.     for frame=0, 5 do
  39.         if start ~= mainmemory.readbyte(TIMER_ADDR) then
  40.             is_crashed = false
  41.             break
  42.         end
  43.         emu.frameadvance()
  44.     end
  45.    
  46.     if is_crashed then
  47.         print(c)
  48.     end
  49. end
  50.  
  51. print("DONE!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement