Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- BizHawk Hexing thingy?
- dofile("tablehandling.lua")
- oldrecord = {}
- newrecord = {}
- function nothingpressed()
- local k = joypad.get(1)
- return not(k.left or k.right or k.up or k.down or k.A or k.B or k.X or k.Y or k.L or k.R or k.start or k.select)
- end
- mode = "recording"
- --ENTER BIG OFFSETS MANUALLY HERE--
- offset = 0
- --ENTER BIG OFFSETS MANUALLY HERE--
- while(true) do
- emu.frameadvance()
- keys = input.get()
- if keys["R"] == true then
- mode = "replay"
- end
- if keys["F11"] then
- table.save(oldrecord,"recorded.txt")
- gui.text(0,100,"current record saved to recorded.txt")
- end
- if keys["F12"] then
- oldrecord = table.load("recorded.txt")
- gui.text(0,105,"loaded record from recorded.txt")
- end
- --note: you will see the offset change one
- --frame later than you expect.
- if keys["numpad+"] then
- offset = offset + 1
- end
- if keys["numpad-"] then
- offset = offset - 1
- end
- if keys["numpad0"] then
- offset = 0
- end
- -- "recording" mode records controller data (for first controller)
- if mode == "recording" then
- gui.text(180,20,"offset: " .. tostring(offset))
- gui.text(180,0,"recording, press R to switch")
- cf = emu.framecount()
- if oldrecord[cf] == nil then
- oldrecord[cf] = {}
- end
- oldrecord[cf] = joypad.get(1)
- end
- -- "replay" mode does the following:
- -- _if the emulator is in "rerecording" mode, it will input
- -- the previously recorded keys
- -- _you can specify an offset for that by pressing
- -- numpad+, numpad-, or numpad0_
- -- or you can override it by entering some new input.
- -- _if you want no input in the next frame,
- -- use numpad*
- if mode == "replay" then
- gui.text(180,0,"replay mode (old minus new)")
- cf = emu.framecount()
- newrecord[cf] = {}
- gui.text(180,20,"offset: " .. tostring(offset))
- keys = input.get()
- if oldrecord[cf+offset] ~= nil and oldrecord[cf+offset] ~= nil then
- if nothingpressed() and not keys["numpad*"] then
- joypad.set(oldrecord[cf+offset], 1)
- gui.text(0, 0, "RECORDED input used from frame " .. tostring(cf+offset))
- else
- gui.text(0, 0, "MANUAL input used")
- end
- else
- gui.text(0,0,"no controller data available")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement