Advertisement
CasualPokePlayer

???

May 5th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. local inputlabels = {"A", "B", "Select", "Start", "Right", "Left", "Up", "Down"}
  2.  
  3. function get_lcd_status()
  4. memory.usememorydomain("System Bus")
  5. return memory.readbyte(0xFF40)
  6. end
  7.  
  8. function determine_lcd_status()
  9. val = get_lcd_status
  10. amt = 0x80
  11. return bit.band(val, amt)
  12. end
  13.  
  14. function getinputbyte()
  15. if not movie.isloaded() then
  16. return 0
  17. end
  18.  
  19. local t = movie.getinput(emu.framecount())
  20. local b = 0
  21.  
  22. for i = 0, 7 do
  23. if t[inputlabels[i + 1]] then
  24. b = b + bit.lshift(1, i)
  25. end
  26. end
  27.  
  28. return b
  29. end
  30.  
  31. function tryinput(file)
  32. local input = getinputbyte()
  33. while determine_lcd_status ~= 0
  34. do file:write(string.format(input))
  35. lastinput = input
  36. end
  37. end
  38.  
  39. local demo = io.open("bgb.dem", "w")
  40. local lastinput = -1
  41.  
  42. tryinput(demo)
  43.  
  44. while emu.framecount() <= movie.length() do
  45.  
  46. tryinput(demo)
  47.  
  48. emu.frameadvance()
  49. end
  50.  
  51. tryinput(demo)
  52. demo:close()
  53.  
  54. client.pause()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement