From a489aeaf518fa1403c490d4e05dba2c397652efc Mon Sep 17 00:00:00 2001 From: Banz99 <42299919+Banz99@users.noreply.github.com> Date: Fri, 17 Jul 2020 17:02:17 +0200 Subject: [PATCH] Update SilentPatchW101.cpp Added initial implementation of the OST change functionality --- source/SilentPatchW101.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source/SilentPatchW101.cpp b/source/SilentPatchW101.cpp index 51648d7..ca8368d 100644 --- a/source/SilentPatchW101.cpp +++ b/source/SilentPatchW101.cpp @@ -195,7 +195,18 @@ void OnInitializeHook() Patch( noFL.get_first( 2 ), 0xEB ); // jbe -> jmp } } - + + + // Change OST + // This works by changing the BGM_304_SwitchtoLive in .rdata to BGM_304_SwitchtoOrig + if (const int INIoption = GetPrivateProfileIntW(L"SilentPatch", L"OriginalOst", 0, wcModulePath); INIoption == 1) + { + auto switchToLive = pattern("42 47 4D 5F 33 30 34 5F 53 77 69 74 63 68 74 6F 4C 69 76 65").count(1); //BGM_304_SwitchtoLive + if (switchToLive.size() == 1) + { + Patch(switchToLive.get_first(0x10), 0x6769724F); //"Orig" ASCII in little endian + } + } // Convert Shift-JIS texts to Unicode ShiftJISTexts::RedirectImports(); @@ -210,4 +221,4 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) hDLLModule = hinstDLL; } return TRUE; -} \ No newline at end of file +}