Rewind feature discussion

Jan 24, 2014 at 1:39 PM
Edited Feb 18, 2014 at 11:30 AM
Here we have TODO, bug list, etc. of this feature.

Rewinding means going back series of save states which were taken chronologically. So when you fail in a game you can repeat quickly and easily again. This is an ideal way of cheating in a platformer or driving game. :P

Needs lots of memory, about 4M per rewind. So for 200*4M = 800M.
Rewind states are taken currently approx every 500ms, so needs quite a powerful machine so there ain't slowdowns. With depth of 200 it is possible to rewind back almost 2 minutes of gameplay.

How to use.
  1. Enter desired depth to pcsxr.cnf
    e.g. RewindCount = 200
  2. Press or hold Backspace key to rewind
Current TODOs

Done -> Implement a GTK GUI where to configure rewind depth (currently only config RewindCount = <value>).
Implement repeating keys for emulator keys.
See below -> Implement by not using SHM (Win32 support, I think OSX has SHM).
Jan 25, 2014 at 2:03 PM
OS X does have shm.
Jan 25, 2014 at 3:59 PM
OK that's nice then. I think it should be really straight forward to use this feature then on OSX. I am considering getting rid of shm calls as a really low-priority, since I think most win32 users prefer epsxe anyway.

I'll see if I think of any platform independent way of creating rewind states, so then only rewinding key call (BackSpace key handling) needs to be done on OSX.
Jan 27, 2014 at 4:08 AM
RetroArch incorporates rewinding on many if not most of the platforms it has been ported to. Maybe you could look at how they do it? I've not seen the specific code, but I am assuming they implement it in a platform-independent manner, given the sheer number of platforms it supports.
Feb 4, 2014 at 9:27 AM
Edited Feb 4, 2014 at 9:28 AM
Now states are created in a much better manner.

Interval is based on number of vblanks. On NTCS there are 60 and PAL 50 vblanks per second.
Count is the same max. number of states that are kept in shm memory.

Also one future consideration would be to implement simple fading filter so that rewinding would be visually much more appealing, i.e. not just jumping frames back.
Feb 4, 2014 at 7:13 PM
Edited Feb 4, 2014 at 7:13 PM
To be noted that this feature is only feasible with interpreter core. This since dynarec has initial compilation delay which makes rewinding really sluggish.
Feb 18, 2014 at 11:27 AM
About win32 integration.

Anyone who is willing to do it, this could be of help.

In best case scenario it is possible to create same kind of file handle on win32, and then just open it with zlib and call SaveStateGz with that file.