|
2 | 2 | // SPDX-License-Identifier: GPL-2.0-or-later
|
3 | 3 |
|
4 | 4 | #include <span>
|
| 5 | +#include <thread> |
5 | 6 | #include <vector>
|
6 | 7 |
|
7 | 8 | #include <core/libraries/system/msgdialog_ui.h>
|
@@ -1139,10 +1140,6 @@ Error PS4_SYSV_ABI sceSaveDataGetSaveDataMemory2(OrbisSaveDataMemoryGet2* getPar
|
1139 | 1140 | LOG_INFO(Lib_SaveData, "called without save memory initialized");
|
1140 | 1141 | return Error::MEMORY_NOT_READY;
|
1141 | 1142 | }
|
1142 |
| - if (SaveMemory::IsSaving()) { |
1143 |
| - LOG_TRACE(Lib_SaveData, "called while saving"); |
1144 |
| - return Error::BUSY_FOR_SAVING; |
1145 |
| - } |
1146 | 1143 | LOG_DEBUG(Lib_SaveData, "called");
|
1147 | 1144 | auto data = getParam->data;
|
1148 | 1145 | if (data != nullptr) {
|
@@ -1502,8 +1499,14 @@ Error PS4_SYSV_ABI sceSaveDataSetSaveDataMemory2(const OrbisSaveDataMemorySet2*
|
1502 | 1499 | return Error::MEMORY_NOT_READY;
|
1503 | 1500 | }
|
1504 | 1501 | 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 | + } |
1507 | 1510 | }
|
1508 | 1511 | LOG_DEBUG(Lib_SaveData, "called");
|
1509 | 1512 | auto data = setParam->data;
|
@@ -1584,8 +1587,8 @@ Error PS4_SYSV_ABI sceSaveDataSetupSaveDataMemory2(const OrbisSaveDataMemorySetu
|
1584 | 1587 | } else {
|
1585 | 1588 | SaveMemory::SetIcon(nullptr, 0);
|
1586 | 1589 | }
|
| 1590 | + SaveMemory::TriggerSaveWithoutEvent(); |
1587 | 1591 | }
|
1588 |
| - SaveMemory::TriggerSaveWithoutEvent(); |
1589 | 1592 | if (g_fw_ver >= ElfInfo::FW_45 && result != nullptr) {
|
1590 | 1593 | result->existedMemorySize = existed_size;
|
1591 | 1594 | }
|
|
0 commit comments