mgba
mgba copied to clipboard
Scripting: callbacks for `rewind`, `stateSaved`, `stateLoaded`
I'm working on a script that records the state of the keypad on each frame (by listening for keysRead
), and a corresponding script that replays the recording, useful for reproducing game bugs, TASing, etc.
This works well, but falls apart if the user ever does rewind or savestates. The recording retains all keypad states instead of undoing the ones that should've been undone.
Having a way to listen for rewind frames (and also storing/loading of savestates) would be super helpful for this script. Maybe there's some nuance to consider in whether the emulator goes back to a state before or after keysRead
has occurred for that frame, but it should be workable as long as it's consistent.
Good idea.