Advertisement
exodus122

Majora's Mask - char_checker_JP

Apr 7th, 2019
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. -- char_checker_JP.lua
  2. --
  3. -- Automate the process of checking whether or not a printed
  4. -- character will crash Majora's Mask (J 1.0) on Bizhawk.
  5. -- US verison: https://pastebin.com/WivTk2gN
  6. --
  7. -- Author: @Faschz
  8. -- Created: April 7th, 2019
  9.  
  10. CHARACTER_ADDR = 0x1CAE00
  11. TEXTBOX_ADDR = 0x3FD51E
  12. TIMER_ADDR = 0x1FA0F3
  13.  
  14. file = io.open('Character Crashes JP 1.0.txt', 'w')
  15.  
  16. for c=0, 65535 do
  17.     -- Recover from any crashes by loading a state about to select
  18.     -- the soaring location for Great Bay Coast
  19.     savestate.loadslot(2)
  20.    
  21.     -- Set the character in the message table
  22.     mainmemory.write_u16_be(CHARACTER_ADDR, c)
  23.    
  24.     -- Select the soaring location
  25.     joypad.set({["A"] = true}, 1)
  26.     emu.frameadvance()
  27.     joypad.set({["A"] = false}, 1)
  28.    
  29.     -- Wait until the textbox appears and changes the address
  30.     while c ~= mainmemory.read_u16_be(TEXTBOX_ADDR) do
  31.         emu.frameadvance()
  32.     end
  33.    
  34.     -- Check if the game is crashed by reading the frame count
  35.     start = mainmemory.readbyte(TIMER_ADDR)
  36.     is_crashed = true
  37.    
  38.     --3 frames work, but lets be on the safe side
  39.     for frame=0, 5 do
  40.         if start ~= mainmemory.readbyte(TIMER_ADDR) then
  41.             is_crashed = false
  42.             break
  43.         end
  44.         emu.frameadvance()
  45.     end
  46.    
  47.     if is_crashed then
  48.         print(c)
  49.         file:write(c..'\n')
  50.     end
  51. end
  52.  
  53. file:write("DONE!")
  54. file:close()
  55.  
  56.  
  57. print("DONE!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement