Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. local pauses = 100
  2.  
  3. local iterator = 0
  4. local iterations_save = 0
  5. local total_iterations = 0
  6. local iterations_before_resave = 50
  7.  
  8. -- File to write to
  9. local outfile = assert(io.open("pauserng.txt", "w"));
  10.  
  11. -- Savestate to be loaded
  12. local state = savestate.create();
  13. savestate.save(state);
  14.  
  15. local i = 0
  16.  
  17. while total_iterations < pauses do
  18. total_iterations = iterator + iterations_save;
  19. gui.text(0, 50, "On iteration: " .. total_iterations);
  20. savestate.load(state);
  21. l = 0;
  22. -- Do the number of pauses required
  23. while l < iterator do
  24. pcsx.frameadvance()
  25. pcsx.frameadvance()
  26. joypad.set(1, { ["start"] = true })
  27. pcsx.frameadvance()
  28. pcsx.frameadvance()
  29. joypad.set(1, { ["start"] = false })
  30. l = l + 1;
  31. end
  32. if iterator == iterations_before_resave then
  33. iterations_save = iterations_save + iterator;
  34. savestate.save(state);
  35. iterator = 0;
  36. end
  37. -- Advance 1 frame, then hit circle
  38. pcsx.frameadvance();
  39. joypad.set(1, { ["circle"] = true });
  40. pcsx.frameadvance();
  41. joypad.set(1, { ["circle"] = false });
  42. w = 0;
  43. -- Frame advance 20 times
  44. if memory.readbyte(0x000F5CCD) < 2 then
  45. done = 1;
  46. end
  47.  
  48. outfile:write(total_iterations .. " pause: " .. memory.readword(0x000F99EC) .. memory.readbyte(0x000F99E8) "\n");
  49. iterator = iterator + 1;
  50. end
  51.  
  52. assert(outfile:close());
  53. pcsx.pause();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement