The BSV recording feature doesn't seem to handle savestate loads properly
Hello. After playing a bit with the "-R" command line function, I noticed that the recorded movie "doesn't care" about loading a savestate. Instead of removing all keystrokes recorded after the last savestate was made and continuing from there, it seems to keep recording the keystrokes as if nothing happened.
This renders the whole recording feature almost useless, because the movie is completely broken after loading a state for at least one time. It then gets out of sync, because at the time of recording, after the player has loaded a savestate, he is seeing completely different thing than when the movie is being played back from the BSV file, because it doesn't register savestate loads.
A possible solution for this would be handling savestate saves and loads the way FCEUX and Snes9x do it. This means, temporarily removing all the savestates when RetroArch is run in recording mode, and then keeping track of all savestate saves and loads. That'd enable it to discard all the keystrokes recorded between the last save and load, so the movie can then be watched from the place where the player last saved it and finished it without loading a state again from there.
To better describe what I'm thinking about, I'll demonstrate the idea on a simple example:
- A player records his gameplay
- He creates a savestate on frame 500, so he can continue playing if he fails
- The player gets killed by an enemy on frame 2000, so he loads his previous savestate and continues playing
- The keystrokes registered between frames 500 and 2000 get removed from the BSV file, since they're not needed anymore
- Recording continues from frame 500, so the whole state loading procedure isn't noticeable by the viewer
I realize I'm not the best when it comes to describing my ideas, but I hope you understand me :)
This works while rewinding. When rewinding, the recording steps back and the input file recording is unwritten appropriately.
I agree that the same should happen with a saved state within the same session (and in a loaded session). This would require the state-saving function to note its current position in the timeline so when loaded, the recording could step back to that position in the timeline.
You can start/stop recording mid-game at least (there's a hotkey for it, check config).
I think he wants 1 continuous input file that doesn't desync on playback if a state was loaded during recording.
The thing is, you never know whether you'll succeed in the game this time, so you can't really stop and start recording manually.
Well, the BSV format doesn't support loading of save states mid-flight. It only stores a 4-word header, a save state, and a long stream of input data following that save state.
Only not-super-convoluted solution I can see is restarting the entire BSV on a save state load. RetroArch is not a TAS emulator at all, and even having the BSV feature is kinda tacky to begin with in hindsight.
I can look at patches for this, but it isn't something I feel like spending time on, sorry.
Well, if that's the case, I'm probably going to get used to using the rewind feature, because as @AlexFolland said, this one handles BSV movies properly. Thanks :)
maybe when recording the save/load keys could be save/load checkpoints within the BSV Then loading a save could rewind till that checkpoint.
BSV feature is useful for debugging cores so it has valid non-tacky uses.