From 4b934419bf6bab0403550a60c0215924f36d57db Mon Sep 17 00:00:00 2001 From: Silent Date: Tue, 12 Sep 2017 22:35:45 +0200 Subject: [PATCH] Proper metric-imperial conversion constants --- SilentPatchIII/SilentPatchIII.cpp | 13 +++++++++++++ SilentPatchSA/SilentPatchSA.cpp | 6 ++++++ SilentPatchVC/SilentPatchVC.cpp | 11 +++++++++++ 3 files changed, 30 insertions(+) diff --git a/SilentPatchIII/SilentPatchIII.cpp b/SilentPatchIII/SilentPatchIII.cpp index 3a1d537..717b051 100644 --- a/SilentPatchIII/SilentPatchIII.cpp +++ b/SilentPatchIII/SilentPatchIII.cpp @@ -813,6 +813,19 @@ void Patch_III_Common() Patch( addr.get( 0x23 + 1 ), 6 ); Nop( addr.get( 0x3F ), 7 ); } + + // Proper metric-imperial conversion constants + { + static const float METERS_TO_MILES = 0.0006213711922f; + static const float METERS_TO_FEET = 3.280839895f; + auto addr = pattern( "D8 0D ? ? ? ? 6A 00 6A 01 D9 9C 24" ).count(4); + + Patch( addr.get(0).get( 2 ), &METERS_TO_MILES ); + Patch( addr.get(1).get( 2 ), &METERS_TO_MILES ); + + Patch( addr.get(2).get( 2 ), &METERS_TO_FEET ); + Patch( addr.get(3).get( 2 ), &METERS_TO_FEET ); + } } BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index fabacb2..d725484 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -3490,6 +3490,12 @@ void Patch_SA_10() // Remove FILE_FLAG_NO_BUFFERING from CdStreams Patch( 0x406BC6, 0xEB ); + + + // Proper metric-imperial conversion constants + static const float METERS_TO_FEET = 3.280839895f; + Patch( 0x55942F + 2, &METERS_TO_FEET ); + Patch( 0x55AA96 + 2, &METERS_TO_FEET ); } void Patch_SA_11() diff --git a/SilentPatchVC/SilentPatchVC.cpp b/SilentPatchVC/SilentPatchVC.cpp index 27c1eca..3b1e8f4 100644 --- a/SilentPatchVC/SilentPatchVC.cpp +++ b/SilentPatchVC/SilentPatchVC.cpp @@ -635,7 +635,18 @@ void Patch_VC_Common() Nop( addr.get( 0x18 + 7 ), 13 ); Nop( addr.get( 0x33 ), 7 ); + } + // Proper metric-imperial conversion constants + { + static const float METERS_TO_MILES = 0.0006213711922f; + auto addr = pattern( "75 ? D9 05 ? ? ? ? D8 0D ? ? ? ? 6A 00 6A 00 D9 9C 24" ).count(6); + addr.for_each_result( [&]( pattern_match match ) { + Patch( match.get( 0x8 + 2 ), &METERS_TO_MILES ); + }); + + auto sum = get_pattern( "D9 9C 24 A8 00 00 00 8D 84 24 A8 00 00 00 50", -6 + 2 ); + Patch( sum, &METERS_TO_MILES ); } }