mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-26 07:43:36 +01:00
Save state to a temp file and rename.
This way, if you run out of disk or hit a bug, at least you have your old state. Better than having neither.
This commit is contained in:
1 parent
3f0b759746
commit
b1c9e7382f
1 file changed
+12
-1
+12
-1
@@ -327,7 +327,18 @@ namespace SaveState
|
||||
{
|
||||
std::string fn = GenerateSaveSlotFilename(slot, STATE_EXTENSION);
|
||||
if (!fn.empty()) {
|
||||
Save(fn + ".tmp", callback, cbUserData);
|
||||
auto renameCallback = [=](bool status, void *data) {
|
||||
if (status) {
|
||||
if (File::Exists(fn)) {
|
||||
File::Delete(fn);
|
||||
}
|
||||
File::Rename(fn + ".tmp", fn);
|
||||
}
|
||||
if (callback) {
|
||||
callback(status, data);
|
||||
}
|
||||
};
|
||||
Save(fn + ".tmp", renameCallback, cbUserData);
|
||||
} else {
|
||||
I18NCategory *s = GetI18NCategory("Screen");
|
||||
osm.Show("Failed to save state. Error in the file system.", 2.0);
|
||||
|
||||
Reference in new issue
Block a user