Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save Data is Lost when suspending device without manually closing content before exiting RetroArch #16237

Closed
nighto opened this issue Feb 15, 2024 · 6 comments

Comments

@nighto
Copy link

nighto commented Feb 15, 2024

Description

When you use in-game Saves (i.e. not Save State), don't close the game inside RetroArch after saving and suspend an iOS (tested on iPhone 11) or PSVita device, if the device for whatever reason decides to close RetroArch due to memory management on iOS, the save data is lost to the last time you have saved and closed the game manually.

This indicates that on those devices save game data is only flushed to storage when the game content is closed, rather to when the save game action is performed (or after some small time after).

(I believe the issue on both devices have the same root cause, therefore I created a single ticket; if you prefer to have one ticket for each platform, please let me know and I can duplicate them.)

Expected behavior

One would expect that the game is properly saved and not lose progression on the game.

Actual behavior

(As described on the description)

Steps to reproduce the bug

  1. Open a given game (tested on Pokémon Fire Red GBA on the iPhone and Donkey Kong GBA on the PSVita), do some progression so you can test after, save the game.
  2. Close content and exit RetroArch
  3. Open RetroArch again, open the saved game, see you are on the state you have left it
  4. Do some more progression, save the game again, then press PS button (on PS Vita), or home or power button (on the iPhone)
  5. Close RetroArch from the PSVita / iOS menu (notice that iOS devices does that automatically to free memory on suspended apps)
  6. Open RetroArch and load the game. You'll see that the progress has been reset to the place you were on step 1, and not the place you were on step 4

Bisect Results

Not really sure, I guess it has always been like that?

Version/Commit

You can find this information under Information/System Information

  • RetroArch on iOS: 1.16.0
  • RetroArch on PS Vita: 1.13.0

Environment information

  • OS: iOS 17.3.1 / PS Vita on 3.67
  • Compiler: Not running local builds, just downloaded ipa / vpk from RetroArch website.
@odditude42
Copy link

for platforms with enforced memory cleanup / forced background application closing, it may be a good idea to set the default for SaveRAM Autosave Interval to be a lower value.

side question - does the autosave interval decrement only while content is active, or does it also decrement while in the menu? if the former, that behavior should probably be changed (or made into an option, with the default being set to "menu included" on impacted platforms).

on Android, it looks like you can use onPause() to flush volatile data to file; is writing a savestate and flushing current content/core and any volatile config data to a temp file feasible? if so, onStart() could check for the presence of that temp file and reload the relevant data.

@nighto
Copy link
Author

nighto commented Feb 18, 2024

Yeah, on the iPhone I had that set as 10 seconds already, but it doesn’t persist if I don’t close the content and reopen the game if I want to continue.

IMG_8613

@jn64
Copy link

jn64 commented Feb 28, 2024

Duplicate / related:

#4837
#4901
#5046
#6803
#14518
(and probably more)

Past response from RA contributors (e.g. 1, 2, and the whole of #4901) indicate that this behaviour (SaveRAM not written to disk when saving) is intended, and "SaveRAM Autosave Interval" (autosave_interval) is the intended solution/workaround.

However, if SaveRAM Autosave Interval is not working on iOS (as mentioned in your follow-up comment), then that is a different issue worth reporting separately.

@nighto
Copy link
Author

nighto commented Feb 29, 2024

Thanks for your detailed comment @jn64. I will then close this one and open a new one, making some tests recording the screen to try to document it better.

@nighto nighto closed this as completed Feb 29, 2024
@nighto
Copy link
Author

nighto commented Mar 4, 2024

@jn64 just tested again and indeed it does not respect SaveRAM Autosave Interval on iOS. Created a new bug #16323 and attached a video to it.

@nighto
Copy link
Author

nighto commented Mar 4, 2024

Created one for PSVita too: #16324

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants