1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2025-01-31 12:31:45 +01:00

Improve scheduler control for cellSaveData

TODO: There are probably more spots where we should yield.
A little more at the start because PacketRead is called twice.
Dont use sys_timer_usleep because it will just call this_thread::yield() repeatedly.
This commit is contained in:
eladash 2019-04-02 23:57:20 +03:00 committed by Ivan
parent 9497270da5
commit ff11d9a3bd

View File

@ -10,6 +10,7 @@
#include "Loader/PSF.h"
#include "Utilities/StrUtil.h"
#include <thread>
#include <mutex>
#include <algorithm>
@ -255,6 +256,16 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
return CELL_SAVEDATA_ERROR_BUSY;
}
// Simulate idle time while data is being sent to VSH
const auto lv2_sleep = [](ppu_thread& ppu, size_t sleep_time)
{
lv2_obj::sleep(ppu);
std::this_thread::sleep_for(std::chrono::microseconds(sleep_time));
ppu.check_state();
};
lv2_sleep(ppu, 500);
*g_savedata_context = {};
vm::ptr<CellSaveDataCBResult> result = g_savedata_context.ptr(&savedata_context::result);
@ -576,6 +587,8 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
if (funcFixed)
{
lv2_sleep(ppu, 250);
// Fixed Callback
funcFixed(ppu, result, listGet, fixedSet);
@ -660,6 +673,8 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
psf::registry psf = psf::load_object(fs::file(dir_path + "PARAM.SFO"));
bool has_modified = false;
lv2_sleep(ppu, 250);
// Get save stats
{
fs::stat_t dir_info{};