mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-12-28 09:23:34 +00:00
Fix saving and some more logging
Fixes Shin Hayarigami (BLJS10279).
This commit is contained in:
parent
3896c39ceb
commit
66cf864ee0
@ -57,6 +57,7 @@ never_inline s32 savedata_op(
|
||||
|
||||
if (!lock)
|
||||
{
|
||||
cellSysutil.Error("savedata_op(): failed to lock the mutex.");
|
||||
return CELL_SAVEDATA_ERROR_BUSY;
|
||||
}
|
||||
|
||||
@ -191,6 +192,7 @@ never_inline s32 savedata_op(
|
||||
|
||||
if (result->result < 0)
|
||||
{
|
||||
cellSysutil.Error("savedata_op(): funcList returned result < 0.");
|
||||
return CELL_SAVEDATA_ERROR_CBRESULT;
|
||||
}
|
||||
|
||||
@ -302,6 +304,7 @@ never_inline s32 savedata_op(
|
||||
|
||||
if (result->result < 0)
|
||||
{
|
||||
cellSysutil.Error("savedata_op(): funcFixed returned result < 0.");
|
||||
return CELL_SAVEDATA_ERROR_CBRESULT;
|
||||
}
|
||||
|
||||
@ -343,10 +346,39 @@ never_inline s32 savedata_op(
|
||||
|
||||
PSFLoader psf;
|
||||
|
||||
// Create save directory if necessary
|
||||
if (save_entry.isNew)
|
||||
{
|
||||
if (!Emu.GetVFS().ExistsDir(dir_path) && !Emu.GetVFS().CreateDir(dir_path))
|
||||
{
|
||||
// Let's ignore this error for now
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string rSfo_path = "/dev_hdd0/game/" + save_entry.dirName.substr(0, 9) + "/PS3_GAME/PARAM.SFO"; // The real SFO path
|
||||
if (!Emu.GetVFS().ExistsFile(rSfo_path))
|
||||
{
|
||||
rSfo_path = "/dev_hdd0/game/" + save_entry.dirName.substr(0, 9) + "/PARAM.SFO";
|
||||
}
|
||||
|
||||
vfsFile rSfo(rSfo_path);
|
||||
PSFLoader rPsf(rSfo);
|
||||
psf.Clear();
|
||||
psf.SetInteger("ATTRIBUTE", rPsf.GetInteger("ATTRIBUTE"));
|
||||
psf.SetString("TITLE", rPsf.GetString("TITLE"));
|
||||
psf.SetString("SUB_TITLE", rPsf.GetString("SUB_TITLE"));
|
||||
psf.SetString("DETAIL", rPsf.GetString("DETAIL"));
|
||||
psf.SetString("SAVEDATA_LIST_PARAM", rPsf.GetString("SAVEDATA_LIST_PARAM"));
|
||||
}
|
||||
}
|
||||
|
||||
// Load PARAM.SFO
|
||||
{
|
||||
vfsFile f(sfo_path);
|
||||
psf.Load(f);
|
||||
if (!save_entry.isNew)
|
||||
{
|
||||
vfsFile f(sfo_path);
|
||||
psf.Load(f);
|
||||
}
|
||||
}
|
||||
|
||||
// Get save stats
|
||||
@ -436,6 +468,7 @@ never_inline s32 savedata_op(
|
||||
|
||||
if (result->result < 0)
|
||||
{
|
||||
cellSysutil.Error("savedata_op(): funcStat returned result < 0.");
|
||||
return CELL_SAVEDATA_ERROR_CBRESULT;
|
||||
}
|
||||
|
||||
@ -485,12 +518,6 @@ never_inline s32 savedata_op(
|
||||
}
|
||||
}
|
||||
|
||||
// Create save directory if necessary
|
||||
if (save_entry.isNew && !Emu.GetVFS().CreateDir(dir_path))
|
||||
{
|
||||
// Let's ignore this error for now
|
||||
}
|
||||
|
||||
// Enter the loop where the save files are read/created/deleted
|
||||
vm::stackvar<CellSaveDataFileGet> fileGet(CPU);
|
||||
vm::stackvar<CellSaveDataFileSet> fileSet(CPU);
|
||||
@ -504,6 +531,7 @@ never_inline s32 savedata_op(
|
||||
|
||||
if (result->result < 0)
|
||||
{
|
||||
cellSysutil.Error("savedata_op(): funcFile returned result < 0.");
|
||||
return CELL_SAVEDATA_ERROR_CBRESULT;
|
||||
}
|
||||
|
||||
@ -605,6 +633,7 @@ never_inline s32 savedata_op(
|
||||
// Write PARAM.SFO
|
||||
if (psf)
|
||||
{
|
||||
cellSysutil.Error("psf: true");
|
||||
vfsFile f(sfo_path, vfsWriteNew);
|
||||
psf.Save(f);
|
||||
}
|
||||
|
@ -191,14 +191,7 @@ s32 sceNpDrmGetTimelimit(vm::ptr<const char> path, vm::ptr<u64> time_remain)
|
||||
|
||||
s32 sceNpDrmProcessExitSpawn(vm::cptr<char> path, u32 argv_addr, u32 envp_addr, u32 data_addr, u32 data_size, u32 prio, u64 flags)
|
||||
{
|
||||
sceNp.Warning("sceNpDrmProcessExitSpawn()");
|
||||
sceNp.Warning("path: %s", path.get_ptr());
|
||||
sceNp.Warning("argv: 0x%x", argv_addr);
|
||||
sceNp.Warning("envp: 0x%x", envp_addr);
|
||||
sceNp.Warning("data: 0x%x", data_addr);
|
||||
sceNp.Warning("data_size: 0x%x", data_size);
|
||||
sceNp.Warning("prio: %d", prio);
|
||||
sceNp.Warning("flags: %d", flags);
|
||||
sceNp.Warning("sceNpDrmProcessExitSpawn() -> sys_game_process_exitspawn");
|
||||
|
||||
sys_game_process_exitspawn(path, argv_addr, envp_addr, data_addr, data_size, prio, flags);
|
||||
|
||||
@ -207,14 +200,7 @@ s32 sceNpDrmProcessExitSpawn(vm::cptr<char> path, u32 argv_addr, u32 envp_addr,
|
||||
|
||||
s32 sceNpDrmProcessExitSpawn2(vm::cptr<char> path, u32 argv_addr, u32 envp_addr, u32 data_addr, u32 data_size, u32 prio, u64 flags)
|
||||
{
|
||||
sceNp.Warning("sceNpDrmProcessExitSpawn2()");
|
||||
sceNp.Warning("path: %s", path.get_ptr());
|
||||
sceNp.Warning("argv: 0x%x", argv_addr);
|
||||
sceNp.Warning("envp: 0x%x", envp_addr);
|
||||
sceNp.Warning("data: 0x%x", data_addr);
|
||||
sceNp.Warning("data_size: 0x%x", data_size);
|
||||
sceNp.Warning("prio: %d", prio);
|
||||
sceNp.Warning("flags: %d", flags);
|
||||
sceNp.Warning("sceNpDrmProcessExitSpawn2() -> sys_game_process_exitspawn2");
|
||||
|
||||
sys_game_process_exitspawn2(path, argv_addr, envp_addr, data_addr, data_size, prio, flags);
|
||||
|
||||
|
@ -157,6 +157,7 @@ s32 sceNpTrophyRegisterContext(PPUThread& CPU, u32 context, u32 handle, vm::ptr<
|
||||
|
||||
if (!ctxt)
|
||||
{
|
||||
sceNpTrophy.Error("sceNpTrophyRegisterContext(): SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT");
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
|
||||
@ -164,43 +165,56 @@ s32 sceNpTrophyRegisterContext(PPUThread& CPU, u32 context, u32 handle, vm::ptr<
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
sceNpTrophy.Error("sceNpTrophyRegisterContext(): SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE");
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
TRPLoader trp(*ctxt->trp_stream);
|
||||
if (!trp.LoadHeader())
|
||||
{
|
||||
sceNpTrophy.Error("sceNpTrophyRegisterContext(): SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE");
|
||||
return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
|
||||
}
|
||||
|
||||
// Rename or discard certain entries based on the files found
|
||||
const size_t kTargetBufferLength = 31;
|
||||
char target[kTargetBufferLength+1];
|
||||
char target[kTargetBufferLength + 1];
|
||||
target[kTargetBufferLength] = 0;
|
||||
strcpy_trunc(target, fmt::Format("TROP_%02d.SFM", Ini.SysLanguage.GetValue()));
|
||||
|
||||
if (trp.ContainsEntry(target)) {
|
||||
if (trp.ContainsEntry(target))
|
||||
{
|
||||
trp.RemoveEntry("TROPCONF.SFM");
|
||||
trp.RemoveEntry("TROP.SFM");
|
||||
trp.RenameEntry(target, "TROPCONF.SFM");
|
||||
}
|
||||
else if (trp.ContainsEntry("TROP.SFM")) {
|
||||
else if (trp.ContainsEntry("TROP.SFM"))
|
||||
{
|
||||
trp.RemoveEntry("TROPCONF.SFM");
|
||||
trp.RenameEntry("TROP.SFM", "TROPCONF.SFM");
|
||||
}
|
||||
else if (!trp.ContainsEntry("TROPCONF.SFM")) {
|
||||
else if (!trp.ContainsEntry("TROPCONF.SFM"))
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
|
||||
}
|
||||
|
||||
// Discard unnecessary TROP_XX.SFM files
|
||||
for (s32 i=0; i<=18; i++) {
|
||||
for (s32 i = 0; i <= 18; i++)
|
||||
{
|
||||
strcpy_trunc(target, fmt::Format("TROP_%02d.SFM", i));
|
||||
if (i != Ini.SysLanguage.GetValue())
|
||||
{
|
||||
trp.RemoveEntry(target);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Get the path of the current user
|
||||
std::string trophyPath = "/dev_hdd0/home/00000001/trophy/" + ctxt->trp_name;
|
||||
if (!trp.Install(trophyPath))
|
||||
{
|
||||
sceNpTrophy.Error("sceNpTrophyRegisterContext(): SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE");
|
||||
return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
|
||||
}
|
||||
|
||||
TROPUSRLoader* tropusr = new TROPUSRLoader();
|
||||
std::string trophyUsrPath = trophyPath + "/TROPUSR.DAT";
|
||||
|
@ -16,7 +16,7 @@ TRPLoader::~TRPLoader()
|
||||
|
||||
bool TRPLoader::Install(std::string dest, bool show)
|
||||
{
|
||||
if(!trp_f.IsOpened())
|
||||
if (!trp_f.IsOpened())
|
||||
return false;
|
||||
|
||||
if (!dest.empty() && dest.back() != '/')
|
||||
|
Loading…
Reference in New Issue
Block a user