patch: implement exit crash fix

This commit is contained in:
itsmattkc 2022-07-18 12:36:17 -07:00
parent df9f843b63
commit 13701075d8
2 changed files with 13 additions and 0 deletions

View file

@ -76,6 +76,13 @@ __declspec(dllexport) DWORD WINAPI Patch()
SearchReplacePattern(dllBase, dbg_map_pattern, dbg_map_replace, 48, TRUE);
}
// Exit crash fix
if (config.GetInt(_T("ExitCrashFix"))) {
const char *exit_pattern = "\x50\x52\x51\x8B\x01\xFF\x50\x2C\x85\xC0\x75\x67\x8B\x7C\x24\x14\x8B\x74\x24\x30\x8B\xCB\xC1\xE9\x02\xF3\xA5\x8B\xCB\x83\xE1\x03\xF3\xA4\x8B\x55\x60";
const char *exit_replace = "\x53\x52\x51\x8B\x01\xFF\x50\x2C\x85\xC0\x75\x67\x8B\x7C\x24\x14\x8B\x74\x24\x30\x8B\x55\x60\x3B\xD3\x7C\x04\x8B\xCB\xEB\x02\x8B\xCA\x90\x90\xF3\xA4";
SearchReplacePattern(dllBase, exit_pattern, exit_replace, 37, TRUE);
}
// Disable auto-finish in build sections
if (config.GetInt(_T("DisableAutoFinishBuilding"))) {
// Pattern used in August build (jump is much shorter so it uses a different opcode)

View file

@ -79,6 +79,12 @@ PatchGrid::PatchGrid()
"will not automatically finish the build section.",
AddBoolItem(sectionGeneral, "Disable Auto-Finish Building Section", false));
AddPatch("ExitCrashFix",
"LEGO Island contains a buffer overrun bug that frequently crashes the game when trying "
"to exit. This is particularly prevalent on newer versions of Windows and Wine. This "
"patch will fix the crash (though the audio glitches will remain).",
AddBoolItem(sectionGeneral, "Exit Crash Fix", false));
// Controls section
HSECTION sectionControls = AddSection("Controls");