cellSaveData workaround

This commit is contained in:
Nekotekina 2017-04-03 16:01:50 +03:00
parent 2d99f3556e
commit 65488078a4

View File

@ -39,6 +39,23 @@ enum : u32
SAVEDATA_OP_FIXED_DELETE = 14, SAVEDATA_OP_FIXED_DELETE = 14,
}; };
namespace
{
struct savedata_context
{
CellSaveDataCBResult result;
CellSaveDataListGet listGet;
CellSaveDataListSet listSet;
CellSaveDataFixedSet fixedSet;
CellSaveDataStatGet statGet;
CellSaveDataStatSet statSet;
CellSaveDataFileGet fileGet;
CellSaveDataFileSet fileSet;
};
}
vm::gvar<savedata_context> g_savedata_context;
std::mutex g_savedata_mutex; std::mutex g_savedata_mutex;
static NEVER_INLINE s32 savedata_op(ppu_thread& ppu, u32 operation, u32 version, vm::cptr<char> dirName, static NEVER_INLINE s32 savedata_op(ppu_thread& ppu, u32 operation, u32 version, vm::cptr<char> dirName,
@ -54,14 +71,16 @@ static NEVER_INLINE s32 savedata_op(ppu_thread& ppu, u32 operation, u32 version,
return CELL_SAVEDATA_ERROR_BUSY; return CELL_SAVEDATA_ERROR_BUSY;
} }
vm::var<CellSaveDataCBResult> result; *g_savedata_context = {};
vm::var<CellSaveDataListGet> listGet;
vm::var<CellSaveDataListSet> listSet; vm::ptr<CellSaveDataCBResult> result = g_savedata_context.ptr(&savedata_context::result);
vm::var<CellSaveDataFixedSet> fixedSet; vm::ptr<CellSaveDataListGet> listGet = g_savedata_context.ptr(&savedata_context::listGet);
vm::var<CellSaveDataStatGet> statGet; vm::ptr<CellSaveDataListSet> listSet = g_savedata_context.ptr(&savedata_context::listSet);
vm::var<CellSaveDataStatSet> statSet; vm::ptr<CellSaveDataFixedSet> fixedSet = g_savedata_context.ptr(&savedata_context::fixedSet);
vm::var<CellSaveDataFileGet> fileGet; vm::ptr<CellSaveDataStatGet> statGet = g_savedata_context.ptr(&savedata_context::statGet);
vm::var<CellSaveDataFileSet> fileSet; vm::ptr<CellSaveDataStatSet> statSet = g_savedata_context.ptr(&savedata_context::statSet);
vm::ptr<CellSaveDataFileGet> fileGet = g_savedata_context.ptr(&savedata_context::fileGet);
vm::ptr<CellSaveDataFileSet> fileSet = g_savedata_context.ptr(&savedata_context::fileSet);
// path of the specified user (00000001 by default) // path of the specified user (00000001 by default)
const std::string& base_dir = vfs::get(fmt::format("/dev_hdd0/home/%08u/savedata/", userId ? userId : 1u)); const std::string& base_dir = vfs::get(fmt::format("/dev_hdd0/home/%08u/savedata/", userId ? userId : 1u));
@ -943,6 +962,8 @@ s32 cellSaveDataUserGetListItem(u32 userId, vm::cptr<char> dirName, vm::ptr<Cell
void cellSysutil_SaveData_init() void cellSysutil_SaveData_init()
{ {
REG_VNID(cellSysutil, 0x00000000, g_savedata_context);
// libsysutil functions: // libsysutil functions:
REG_FUNC(cellSysutil, cellSaveDataEnableOverlay); REG_FUNC(cellSysutil, cellSaveDataEnableOverlay);