mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 21:01:37 +00:00
CTitleStateIntro_patches: fix save data validation hook
This commit is contained in:
parent
40a8bf557b
commit
7c72146705
1 changed files with 5 additions and 22 deletions
|
|
@ -62,29 +62,12 @@ static bool ProcessCorruptSaveMessage()
|
||||||
void StorageDevicePromptMidAsmHook() {}
|
void StorageDevicePromptMidAsmHook() {}
|
||||||
|
|
||||||
// Save data validation hook.
|
// Save data validation hook.
|
||||||
PPC_FUNC_IMPL(__imp__sub_822C4330);
|
PPC_FUNC_IMPL(__imp__sub_822C55B0);
|
||||||
PPC_FUNC(sub_822C4330)
|
PPC_FUNC(sub_822C55B0)
|
||||||
{
|
{
|
||||||
std::error_code ec;
|
g_corruptSaveMessageOpen = true;
|
||||||
auto saveFileSize = std::filesystem::file_size(GetSaveFilePath(true), ec);
|
g_corruptSaveMessageOpen.wait(true);
|
||||||
|
ctx.r3.u32 = 0;
|
||||||
auto expectedSize = ctx.r5.u32;
|
|
||||||
auto expectedSizeAdd = *(be<uint32_t>*)g_memory.Translate(0x83262110);
|
|
||||||
|
|
||||||
// TODO: check for backups here and restore them?
|
|
||||||
if (saveFileSize != expectedSize + expectedSizeAdd)
|
|
||||||
{
|
|
||||||
App::s_isSaveDataCorrupt = true;
|
|
||||||
|
|
||||||
g_corruptSaveMessageOpen = true;
|
|
||||||
g_corruptSaveMessageOpen.wait(true);
|
|
||||||
|
|
||||||
ctx.r3.u32 = 0;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.r3.u32 = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SWA::CTitleStateIntro::Update
|
// SWA::CTitleStateIntro::Update
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue