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

[Feature request] Automatic backup of savedata #1909

Open
rafael-57 opened this issue Dec 26, 2024 · 8 comments
Open

[Feature request] Automatic backup of savedata #1909

rafael-57 opened this issue Dec 26, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@rafael-57
Copy link
Contributor

rafael-57 commented Dec 26, 2024

This would be very useful to prevent from savedata corruption (for example due to emulator crashes), game glitches, and just as a nice feature to have.

I first thought of copying the savedata into the backup folder once every few minutes, but this could still have you lose saves if you crash while this happens.

I don't know how to code it but I would do it this way:

  1. First, when the game asks to, write savedata to the usual destination
  2. Every two times the game writes savedata, also write it in the automatic backup destination

What do you guys think?

P.S. I am aware that there are some backup save files if you go into the save directories, but one time my savedata got corrupt and restoring the backup files manually still loaded into a corrupted save.

@mailwl
Copy link
Contributor

mailwl commented Dec 26, 2024

don't understand how it will work? if game crashed while save, it can't make backup anyway

@rafael-57
Copy link
Contributor Author

don't understand how it will work? if game crashed while save, it can't make backup anyway

Sorry, bad wording on my end. I meant something like this:

  1. Write to savedata
  2. Write savedata + backup
  3. Write to savedata
  4. Write savedata + backup etc.

This way at least we have an older copy

@GHU7924
Copy link

GHU7924 commented Dec 26, 2024

Doubtful, but OK.
I don't understand how it will work either. Is it possible to make a backup immediately after your save has occurred?
Is there a chance that your backup will happen during the save and you will receive an old broken copy of the save?
I can't tell you when the best time for backup will be.

In general, the idea of a backup save is pretty good, but the implementation of what it should look like is not yet clear.
This can help avoid a situation where you deleted the emulator, and then remembered that there were saves in the users section and you forgot to move them.

The first thing I can say is that it should be an unambiguously controlled decision.
I mean, the checkbox that the user decides to put or not, whether backup will be performed or not.

Secondly, this is the place where the backup will be stored (there are many options). Considering that we have the paths that we specify for the emulator, a copy of the saves can be stored there, that is, in the folder with the installed games (for example, the folder will be called SAVEDATA-BACKUP). Or maybe in the Documents folder. Or somewhere else.

@rafael-57
Copy link
Contributor Author

Doubtful, but OK. I don't understand how it will work either. Is it possible to make a backup immediately after your save has occurred? Is there a chance that your backup will happen during the save and you will receive an old broken copy of the save? I can't tell you when the best time for backup will be.

In general, the idea of a backup save is pretty good, but the implementation of what it should look like is not yet clear. This can help avoid a situation where you deleted the emulator, and then remembered that there were saves in the users section and you forgot to move them.

The first thing I can say is that it should be an unambiguously controlled decision. I mean, the checkbox that the user decides to put or not, whether backup will be performed or not.

Secondly, this is the place where the backup will be stored (there are many options). Considering that we have the paths that we specify for the emulator, a copy of the saves can be stored there, that is, in the folder with the installed games (for example, the folder will be called SAVEDATA-BACKUP). Or maybe in the Documents folder. Or somewhere else.

Yes, regardless of implementation I would keep one extra, older copy of the savedata.

I agree it's ok to have with a checkbox. I leave it to the devs to figure out the imlementation and the savedata location :P

@mailwl
Copy link
Contributor

mailwl commented Dec 26, 2024

which game needs backup saves? maybe on exact game devs can fix savegame implementation

@rafael-57
Copy link
Contributor Author

which game needs backup saves? maybe on exact game devs can fix savegame implementation

No single game, this is a feature request for the entire emu.

@rainmakerv3
Copy link
Contributor

I tried an implementation where it copies saves to a new folder after 5 minutes (can be adjusted and/or made configurable ofc). Seems to work, at least on my end, but there may or may not be a performance penalty caused by the new sleeping thread.

Maybe some folks can test it:
https://github.com/rainmakerv3/shadPS4/actions/runs/12525256861

Or maybe someone can improve the code:
rainmakerv3@5a67a10

@GHU7924
Copy link

GHU7924 commented Dec 28, 2024

Actually, that's how I see the implementation.
bs

And it will be a controlled decision.

And in the "Paths" tab, you can add an analog Game folders, but only for saving. You can choose 1-2-3 paths where to store the saves. But I don't know if it's necessary to have more than one backup.

@rafael-57 I have proposed my own version of the vision, but since the proposal came from you, you need to think over the implementation.

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

No branches or pull requests

5 participants