Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local inputlabels = {"A", "B", "Select", "Start", "Right", "Left", "Up", "Down"}
- function getinputbyte()
- if not movie.isloaded() then
- return 0
- end
- local t = movie.getinput(emu.framecount())
- local b = 0
- for i = 0, 7 do
- if t[inputlabels[i + 1]] then
- b = b + bit.lshift(1, i)
- end
- end
- return b
- end
- function tryinput()
- local input = getinputbyte()
- if input ~= lastinput then
- io.write(string.format("%08X %02X", emu.totalexecutedcycles(), input))
- lastinput = input
- end
- end
- local timestamps = io.open("timestamps.txt", "w")
- local lastinput = -1
- io.output(timestamps)
- tryinput()
- while emu.framecount() <= movie.length() do
- if emu.getregister("PC") == 0x40 then
- tryinput()
- end
- emu.frameadvance()
- end
- tryinput()
- io.close()
- client.pause()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement