Skip to content

Commit

Permalink
patch: properly fix exit crash bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramen2X committed Mar 19, 2024
1 parent 95ff837 commit 4b4138c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions lib/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,14 @@ __declspec(dllexport) DWORD WINAPI Patch()

// 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);
const char *buffer_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 *buffer_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";

const char *wndproc_pattern = "\xC6\x44\x24\x00\x00\x53\x56\x57";
const char *wndproc_replace = "\xC6\x44\x24\x00\x10\x53\x56\x57";

SearchReplacePattern(dllBase, buffer_pattern, buffer_replace, 37, TRUE);
SearchReplacePattern(exeBase, wndproc_pattern, wndproc_replace, 8, TRUE);
}

// Disable SMK scaling
Expand Down
4 changes: 2 additions & 2 deletions src/patchgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ PatchGrid::PatchGrid()
AddBoolItem(sectionGeneral, "Disable Auto-Finish Building Section", false));

AddPatch("ExitCrashFix",
"LEGO Island contains a buffer overrun bug that frequently crashes the game when trying "
"LEGO Island contains a 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).",
"patch will fix the crash and the associated animation gltiches and audio buzzes.",
AddBoolItem(sectionGeneral, "Exit Crash Fix", false));

// Controls section
Expand Down

0 comments on commit 4b4138c

Please sign in to comment.