Skip to content

Commit c977011

Browse files
Merge pull request #2014 from viniciuslrangel/save-fixes-vi
Save Fixes VI
2 parents b87bca2 + 3109bd2 commit c977011

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/core/libraries/save_data/savedata.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-License-Identifier: GPL-2.0-or-later
33

44
#include <span>
5+
#include <thread>
56
#include <vector>
67

78
#include <core/libraries/system/msgdialog_ui.h>
@@ -1139,10 +1140,6 @@ Error PS4_SYSV_ABI sceSaveDataGetSaveDataMemory2(OrbisSaveDataMemoryGet2* getPar
11391140
LOG_INFO(Lib_SaveData, "called without save memory initialized");
11401141
return Error::MEMORY_NOT_READY;
11411142
}
1142-
if (SaveMemory::IsSaving()) {
1143-
LOG_TRACE(Lib_SaveData, "called while saving");
1144-
return Error::BUSY_FOR_SAVING;
1145-
}
11461143
LOG_DEBUG(Lib_SaveData, "called");
11471144
auto data = getParam->data;
11481145
if (data != nullptr) {
@@ -1502,8 +1499,14 @@ Error PS4_SYSV_ABI sceSaveDataSetSaveDataMemory2(const OrbisSaveDataMemorySet2*
15021499
return Error::MEMORY_NOT_READY;
15031500
}
15041501
if (SaveMemory::IsSaving()) {
1505-
LOG_TRACE(Lib_SaveData, "called while saving");
1506-
return Error::BUSY_FOR_SAVING;
1502+
int count = 0;
1503+
while (++count < 100 && SaveMemory::IsSaving()) { // try for more 10 seconds
1504+
std::this_thread::sleep_for(chrono::milliseconds(100));
1505+
}
1506+
if (SaveMemory::IsSaving()) {
1507+
LOG_TRACE(Lib_SaveData, "called while saving");
1508+
return Error::BUSY_FOR_SAVING;
1509+
}
15071510
}
15081511
LOG_DEBUG(Lib_SaveData, "called");
15091512
auto data = setParam->data;
@@ -1584,8 +1587,8 @@ Error PS4_SYSV_ABI sceSaveDataSetupSaveDataMemory2(const OrbisSaveDataMemorySetu
15841587
} else {
15851588
SaveMemory::SetIcon(nullptr, 0);
15861589
}
1590+
SaveMemory::TriggerSaveWithoutEvent();
15871591
}
1588-
SaveMemory::TriggerSaveWithoutEvent();
15891592
if (g_fw_ver >= ElfInfo::FW_45 && result != nullptr) {
15901593
result->existedMemorySize = existed_size;
15911594
}

0 commit comments

Comments
 (0)