PatchEngine/GeckoCode: Heuristic stack checks

Try to make sure the stack is sane before calling into the
codehandler. This is intended to reduce the possibility of random
memory corruption.
This commit is contained in:
EmptyChaos
2016-09-30 15:29:35 +00:00
parent 31cf8432bf
commit b3547870ee
5 changed files with 78 additions and 49 deletions

View File

@ -483,9 +483,8 @@ bool CBoot::BootUp()
// Not part of the binary itself, but either we or Gecko OS might insert
// this, and it doesn't clear the icache properly.
HLE::Patch(Gecko::ENTRY_POINT, "GeckoCodehandler");
if (SConfig::GetInstance().bEnableCheats)
{
HLE::Patch(Gecko::HLE_TRAMPOLINE_ADDRESS, "GeckoHandlerReturnTrampoline");
}
// This has to always be installed even if cheats are not enabled because of the possiblity of
// loading a savestate where PC is inside the code handler while cheats are disabled.
HLE::Patch(Gecko::HLE_TRAMPOLINE_ADDRESS, "GeckoHandlerReturnTrampoline");
return true;
}