sceNpTrophyRegisterContext verbose logging in TROPHY_ERROR_ILLEGAL_UPDATE error

Also use safer checking when creating trophy ctxt dir
This commit is contained in:
Eladash 2019-10-15 14:19:34 +03:00 committed by Ivan
parent 80b4ac23e5
commit ab02c56725
2 changed files with 4 additions and 1 deletions

View File

@ -340,6 +340,7 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle,
TRPLoader trp(ctxt->trp_stream); TRPLoader trp(ctxt->trp_stream);
if (!trp.LoadHeader()) if (!trp.LoadHeader())
{ {
sceNpTrophy.error("sceNpTrophyRegisterContext(): Failed to load trophy config header");
return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE; return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
} }
@ -362,6 +363,7 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle,
} }
else if (!trp.ContainsEntry("TROPCONF.SFM")) else if (!trp.ContainsEntry("TROPCONF.SFM"))
{ {
sceNpTrophy.error("sceNpTrophyRegisterContext(): Invalid/Incomplete trophy config");
return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE; return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
} }
@ -378,6 +380,7 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle,
std::string trophyPath = "/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/" + ctxt->trp_name; std::string trophyPath = "/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/" + ctxt->trp_name;
if (!trp.Install(trophyPath)) if (!trp.Install(trophyPath))
{ {
sceNpTrophy.error("sceNpTrophyRegisterContext(): Failed to install trophy context '%s' (%s)", trophyPath, fs::g_tls_error);
return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE; return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
} }

View File

@ -18,7 +18,7 @@ bool TRPLoader::Install(const std::string& dest, bool show)
const std::string& local_path = vfs::get(dest); const std::string& local_path = vfs::get(dest);
if (!fs::create_dir(local_path) && fs::g_tls_error != fs::error::exist) if (!fs::is_dir(local_path) && !fs::create_dir(local_path))
{ {
return false; return false;
} }