As I wrote elsewhere
, the current replay file format used by POPSnesDev records only arrow keys, and it has no timing information.
I can propose you a format based on how SDLPoP replays work.
Firstly, replay files should contain a savestate of the moment when recording was started.
I see POPSnesDev already supports savestates, but they are quite incomplete.
You should fix that first.
(Another (not so good) solution would be to record from reset. Then you don't need the savestate, but the reset is quite limiting.)
Then, you should append the current joypad state (IO.Joy1) to the replay file, once per frame
You should do that in SNES.Run(), not in the KeyDown event.
Timing information is not needed that way.
(BTW, the SNES joypad has 12 buttons, so a single byte is not enough.)
You should also add a header so that replay files can be identified, and to distinguish between different versions of the format.
On playback, the contained savestate should be loaded first.
Then update the current joypad state (IO.Joy1) from the replay file, again once per frame
(Don't forget to disable joypad input from the user while playing back.)