TROPUSR: Loader Improvements

* Replace invalid TROPUSR.DAT with empty new ones. (+report an error)
* Fix return code of Load whenever TROPUSR.DAT hadn't existed before.
* Add header magic test.
* sceNpTrophyRegisterContext will abort if TROPUSR.DAT generation failed.
This commit is contained in:
Eladash 2021-03-13 15:36:59 +02:00 committed by Ivan
parent 1f93fc902b
commit 48870f3e8b
4 changed files with 49 additions and 17 deletions

View file

@ -578,11 +578,11 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle,
return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
}
TROPUSRLoader* tropusr = new TROPUSRLoader();
const auto& tropusr = ctxt->tropusr = std::make_unique<TROPUSRLoader>();
const std::string trophyUsrPath = trophyPath + "/TROPUSR.DAT";
const std::string trophyConfPath = trophyPath + "/TROPCONF.SFM";
tropusr->Load(trophyUsrPath, trophyConfPath);
ctxt->tropusr.reset(tropusr);
ensure(tropusr->Load(trophyUsrPath, trophyConfPath).success);
// This emulates vsh sending the events and ensures that not 2 events are processed at once
const std::pair<u32, s32> statuses[] =