From 2d1c7f97e6f92b06c5893594a1017064ad3e72bc Mon Sep 17 00:00:00 2001 From: Silent Date: Sun, 14 Jan 2018 12:04:22 +0100 Subject: [PATCH] Refactor version checking in III/VC to new method --- SilentPatchIII/SilentPatchIII.cpp | 7 ++++--- SilentPatchVC/SilentPatchVC.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/SilentPatchIII/SilentPatchIII.cpp b/SilentPatchIII/SilentPatchIII.cpp index adc61dd..f3c8672 100644 --- a/SilentPatchIII/SilentPatchIII.cpp +++ b/SilentPatchIII/SilentPatchIII.cpp @@ -858,9 +858,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { std::unique_ptr Protect = ScopedUnprotect::UnprotectSectionOrFullModule( GetModuleHandle( nullptr ), ".text" ); - if (*(DWORD*)0x5C1E75 == 0xB85548EC) Patch_III_10(desktop); - else if (*(DWORD*)0x5C2135 == 0xB85548EC) Patch_III_11(desktop); - else if (*(DWORD*)0x5C6FD5 == 0xB85548EC) Patch_III_Steam(desktop); + const int8_t version = Memory::GetVersion().version; + if ( version == 0 ) Patch_III_10(desktop); + else if ( version == 1 ) Patch_III_11(desktop); + else if ( version == 2 ) Patch_III_Steam(desktop); Patch_III_Common(); Common::Patches::III_VC_Common(); diff --git a/SilentPatchVC/SilentPatchVC.cpp b/SilentPatchVC/SilentPatchVC.cpp index 14b1a42..242cd44 100644 --- a/SilentPatchVC/SilentPatchVC.cpp +++ b/SilentPatchVC/SilentPatchVC.cpp @@ -671,9 +671,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { std::unique_ptr Protect = ScopedUnprotect::UnprotectSectionOrFullModule( GetModuleHandle( nullptr ), ".text" ); - if(*(DWORD*)0x667BF5 == 0xB85548EC) Patch_VC_10(desktop); - else if(*(DWORD*)0x667C45 == 0xB85548EC) Patch_VC_11(desktop); - else if (*(DWORD*)0x666BA5 == 0xB85548EC) Patch_VC_Steam(desktop); + const int8_t version = Memory::GetVersion().version; + if ( version == 0 ) Patch_VC_10(desktop); + else if ( version == 1 ) Patch_VC_11(desktop); + else if ( version == 2 ) Patch_VC_Steam(desktop); // Y axis sensitivity only else if (*(DWORD*)0x601048 == 0x5E5F5D60) Patch_VC_JP();