Proper metric-imperial conversion constants

This commit is contained in:
Silent 2017-09-12 22:35:45 +02:00
parent 4a2d93c44e
commit 4b934419bf
3 changed files with 30 additions and 0 deletions

View file

@ -813,6 +813,19 @@ void Patch_III_Common()
Patch<uint8_t>( addr.get<void>( 0x23 + 1 ), 6 ); Patch<uint8_t>( addr.get<void>( 0x23 + 1 ), 6 );
Nop( addr.get<void>( 0x3F ), 7 ); Nop( addr.get<void>( 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<const void*>( addr.get(0).get<void>( 2 ), &METERS_TO_MILES );
Patch<const void*>( addr.get(1).get<void>( 2 ), &METERS_TO_MILES );
Patch<const void*>( addr.get(2).get<void>( 2 ), &METERS_TO_FEET );
Patch<const void*>( addr.get(3).get<void>( 2 ), &METERS_TO_FEET );
}
} }
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)

View file

@ -3490,6 +3490,12 @@ void Patch_SA_10()
// Remove FILE_FLAG_NO_BUFFERING from CdStreams // Remove FILE_FLAG_NO_BUFFERING from CdStreams
Patch<uint8_t>( 0x406BC6, 0xEB ); Patch<uint8_t>( 0x406BC6, 0xEB );
// Proper metric-imperial conversion constants
static const float METERS_TO_FEET = 3.280839895f;
Patch<const void*>( 0x55942F + 2, &METERS_TO_FEET );
Patch<const void*>( 0x55AA96 + 2, &METERS_TO_FEET );
} }
void Patch_SA_11() void Patch_SA_11()

View file

@ -635,7 +635,18 @@ void Patch_VC_Common()
Nop( addr.get<void>( 0x18 + 7 ), 13 ); Nop( addr.get<void>( 0x18 + 7 ), 13 );
Nop( addr.get<void>( 0x33 ), 7 ); Nop( addr.get<void>( 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<const void*>( match.get<void>( 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<const void*>( sum, &METERS_TO_MILES );
} }
} }