ppsspp icon indicating copy to clipboard operation
ppsspp copied to clipboard

Automatically save state on exit

Open MisterTea opened this issue 9 years ago • 11 comments

There is an option to load the most recent save upon starting PPSSPP. Can we also have an option to automatically save upon exit? This is especially important on Android where PPSSPP is often killed because of memory pressure. It's possible to handle the kill request on Android and do a save state so progress in the game is not lost.

MisterTea avatar Mar 23 '16 16:03 MisterTea

If ppsspp is not closed manually,don't expect it to do something when you close it. It's like wanting to save a text file but kill the notepad process first.

Such feature will often either do nothing or corrupt save states

vsub avatar Mar 23 '16 17:03 vsub

With Android, one can monitor for the app going into the background and save state when that happens. I believe the Android memory manager also alerts an app prior to killing it so one can do a save state then.

Even if the feature only worked on manual exits, that would still be a big win.

In case the app is killed for another reason (e.g. the phone runs out of battery), I agree that trying to fire off a save state is dangerous. That's not what this issue is about.

On Wed, Mar 23, 2016, 10:36 AM vsub [email protected] wrote:

If ppsspp is not closed manually,don't expect it to do something when you close it. It's like wanting to save a text file but kill the notepad process first.

Such feature will often either do nothing or corrupt save states

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/hrydgard/ppsspp/issues/8661#issuecomment-200458384

MisterTea avatar Mar 23 '16 21:03 MisterTea

The operation of saving state requires allocating memory - often a decent chunk of it.

Therefore, if the app is being closed due to memory pressure, it's probably not going to be possible to save state. I would assume allocating a large chunk of memory would fail during a memory pressure shutdown.

-[Unknown]

unknownbrackets avatar Mar 23 '16 22:03 unknownbrackets

Ios and Android account for this and raise the high watermark for apps that are about to be killed to help them exit gracefully.

Regardless, it may be better to simply save state every time the app goes into the background and nor have to worry about trying to save one just before being killed. On a phone, there are constant interruptions and I have lost hours of progress because PPSSPP has been killed and I forgot to save state.

On Wed, Mar 23, 2016, 3:04 PM Unknown W. Brackets [email protected] wrote:

The operation of saving state requires allocating memory - often a decent chunk of it.

Therefore, if the app is being closed due to memory pressure, it's probably not going to be possible to save state. I would assume allocating a large chunk of memory would fail during a memory pressure shutdown.

-[Unknown]

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/hrydgard/ppsspp/issues/8661#issuecomment-200562517

MisterTea avatar Mar 23 '16 22:03 MisterTea

Greetings from 2 years into the future. I'd love this feature and would be willing to work on it

Benhgift avatar Jun 14 '18 17:06 Benhgift

Pull requests accepted :)

hrydgard avatar Jun 14 '18 20:06 hrydgard

Just a note: if a save state fails to load, it restarts emulation instead - make sure not to endlessly loop in this case.

-[Unknown]

unknownbrackets avatar Jun 15 '18 00:06 unknownbrackets

Aethersx2 and Duckstation have already this but still good for PPSSPP?

ghost avatar Dec 26 '22 10:12 ghost

Yeah could be a good idea. Maybe have a special slot for this, instead of say saving into the last used one, which could be annoying.

hrydgard avatar Dec 26 '22 12:12 hrydgard

this would be a great feature

slrgt avatar May 15 '24 20:05 slrgt

I often find myself instinctively closing the app normally without saving, which has nothing to do with memory. Lemuroid auto-saves the state into its own hidden quicksave state that is auto-loaded when a game is opened. Not having this feature led me to losing my progress in a game :(

It would be cool to see it implemented as a quality of life feature.

alexmozaidze avatar Sep 12 '24 15:09 alexmozaidze