mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-13 18:28:35 +12: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:
parent
9497270da5
commit
ff11d9a3bd
1 changed files with 15 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include "Loader/PSF.h"
|
#include "Loader/PSF.h"
|
||||||
#include "Utilities/StrUtil.h"
|
#include "Utilities/StrUtil.h"
|
||||||
|
|
||||||
|
#include <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <algorithm>
|
#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;
|
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 = {};
|
*g_savedata_context = {};
|
||||||
|
|
||||||
vm::ptr<CellSaveDataCBResult> result = g_savedata_context.ptr(&savedata_context::result);
|
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)
|
if (funcFixed)
|
||||||
{
|
{
|
||||||
|
lv2_sleep(ppu, 250);
|
||||||
|
|
||||||
// Fixed Callback
|
// Fixed Callback
|
||||||
funcFixed(ppu, result, listGet, fixedSet);
|
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"));
|
psf::registry psf = psf::load_object(fs::file(dir_path + "PARAM.SFO"));
|
||||||
bool has_modified = false;
|
bool has_modified = false;
|
||||||
|
|
||||||
|
lv2_sleep(ppu, 250);
|
||||||
|
|
||||||
// Get save stats
|
// Get save stats
|
||||||
{
|
{
|
||||||
fs::stat_t dir_info{};
|
fs::stat_t dir_info{};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue