mgba icon indicating copy to clipboard operation
mgba copied to clipboard

Scripting: callbacks for `rewind`, `stateSaved`, `stateLoaded`

Open exelotl opened this issue 8 months ago • 1 comments

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.

exelotl avatar Nov 12 '23 00:11 exelotl

Good idea.

endrift avatar Nov 12 '23 01:11 endrift