hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.03k stars 2.15k forks source link

Include my documentation of the Rewind feature somewhere #8907

Open roryokane opened 8 years ago

roryokane commented 8 years ago

I wrote up an explanation of the Rewind feature, since it took some time to figure out how to enable it, and to assure myself that PPSSPP’s memory won’t grow unboundedly when it is enabled. I posted the explanation to the PPSSPP subreddit for searchability: How to use the Rewind feature of PPSSPP. But I feel that this explanation should be included in official PPSSPP documentation somewhere, so it’s easier to find.

The explanation I wrote

This is what I posted to Reddit. I give you permission to use any part of it in PPSSPP or its documentation:

How to use the Rewind feature of PPSSPP

It took me some experimentation and research to figure out how the Rewind feature works, so I figured I would save time for other people by documenting what I learned.

Enabling the Rewind feature

You may have noticed that in the Settings > Controls > “Control mapping” screen, one of the actions to map a key or button to is called “Rewind”. It’s between Pause and Save State on the list, and it is set to kbd.Backspace by default. And if you press the key bound to this action while playing a game, the emulator will just give an error: “No rewind saves states available.” How can you get this feature to work?

The answer is to go to Settings > System and look in the Emulation section. There is an option “Rewind snapshot frequency (mem hog)”. By default it is set to Off (0), which is why the Rewind key does nothing. Changing the option to something other than 0 will enable the rewind feature, which periodically makes save states that you can rewind to.

Setting the “Rewind snapshot frequency”

What does the value of this option mean? As its editing interface shows, you can set any number from 0 to 1800 frames, and 0 means the feature is off. PSP games usually run at either 30 or 60 frames per second (you can tell by going to Settings > Graphics > “Overlay information” section > “Show FPS counter” and setting it to FPS). So if you set the option to 150 frames and then play a 30-FPS game, a save state will automatically be saved every 5 seconds.

Using the Rewind key

If you make a mistake while playing, you can press the Rewind key, and the emulator will load the last automatic save state it made. In the example above, this save state could have been made anywhere from 0 to 5 seconds ago. After pressing the key, you can try that section of the game again. If your mistake was further back than one rewind frequency, you can press Rewind repeatedly – each quick press takes you back to the previous automatic save state.

Memory usage

The “(mem hog)” part of the option name is telling you that enabling this feature causes PPSSPP to use up a lot more memory than normal. For example, on my computer, PPSSPP goes from 100MB to 800MB of memory used. So set the rewind snapshot frequency back to 0 when you’re not using the rewind feature. And note that you will have to quit and relaunch the emulator to free the memory that was used when you enabled the feature.

It’s not written anywhere in the interface or the documentation, but according to PPSSPP’s code, the number of rewindable states the emulator saves is 20:

// TODO: Should this be configurable?
static const int REWIND_NUM_STATES = 20;

So at least the memory taken up while the feature is on won’t grow forever.

That number means you can press Rewind up to 20 times in a row to go back. If you press Rewind a 21st time, it seems the emulator will just cycle back to the most recent save state.

The raw Markdown source:

# How to use the Rewind feature of PPSSPP

It took me some experimentation and research to figure out how the Rewind feature works, so I figured I would save time for other people by documenting what I learned.

## Enabling the Rewind feature

You may have noticed that in the *Settings > Controls > “Control mapping”* screen, one of the actions to map a key or button to is called “*Rewind*”. It’s between *Pause* and *Save State* on the list, and it is set to `kbd.Backspace` by default. And if you press the key bound to this action while playing a game, the emulator will just give an error: “No rewind saves states available.” How can you get this feature to work?

The answer is to go to *Settings > System* and look in the *Emulation* section. There is an option “*Rewind snapshot frequency (mem hog)*”. By default it is set to *Off* (0), which is why the Rewind key does nothing. Changing the option to something other than 0 will enable the rewind feature, which periodically makes save states that you can rewind to.

## Setting the “Rewind snapshot frequency”

What does the value of this option mean? As its editing interface shows, you can set any number from 0 to 1800 frames, and 0 means the feature is off. PSP games usually run at either 30 or 60 frames per second (you can tell by going to *Settings > Graphics > “Overlay information” section > “Show FPS counter”* and setting it to *FPS*). So if you set the option to 150 frames and then play a 30-FPS game, a save state will automatically be saved every 5 seconds.

## Using the Rewind key

If you make a mistake while playing, you can press the Rewind key, and the emulator will load the last automatic save state it made. In the example above, this save state could have been made anywhere from 0 to 5 seconds ago. After pressing the key, you can try that section of the game again. If your mistake was further back than one rewind frequency, you can press Rewind repeatedly – each quick press takes you back to the previous automatic save state.

## Memory usage

The “(mem hog)” part of the option name is telling you that enabling this feature causes PPSSPP to use up a lot more memory than normal. For example, on my computer, PPSSPP goes from 100MB to 800MB of memory used. So set the rewind snapshot frequency back to 0 when you’re not using the rewind feature. And note that you will have to quit and relaunch the emulator to free the memory that was used when you enabled the feature.

It’s not written anywhere in the interface or the documentation, but [according to PPSSPP’s code](https://github.com/hrydgard/ppsspp/blob/master/Core/SaveState.cpp#L212-L213), the number of rewindable states the emulator saves is 20:

    // TODO: Should this be configurable?
    static const int REWIND_NUM_STATES = 20;

So at least the memory taken up while the feature is on won’t grow forever.

That number means you can press Rewind up to 20 times in a row to go back. If you press Rewind a 21st time, it seems the emulator will just cycle back to the most recent save state.

Where to put this documentation

As far as I can tell, the only official place for user-facing documentation of PPSSPP is the Guides & Help page on ppsspp.org. So I think these are the options of where to put the documentation for the Rewind feature:

Go ahead and put my explanation wherever seems best, if you think this type of documentation is worth making official.

hrydgard commented 1 year ago

Completely forgot about this, though it makes sense to have. I'm gonna put it on the new PPSSPP website that I plan to launch early next year.