III/VC: Added EnableVehicleCoronaFixes INI option

This commit is contained in:
Silent 2019-12-27 11:06:26 +01:00
parent 1d007aed68
commit c1ccfba2ec
No known key found for this signature in database
GPG key ID: AE53149BB0C45AF1
3 changed files with 20 additions and 19 deletions

View file

@ -226,21 +226,6 @@ namespace Common {
} }
} }
// Corrected taxi light placement for Taxi
// TODO: INI entry
{
using namespace TaxiCoronaFix;
auto getTaxiLightPos = pattern( "E8 ? ? ? ? D9 84 24 ? ? ? ? D8 84 24 ? ? ? ? 83 C4 0C FF 35" );
if ( getTaxiLightPos.count_hint(1).size() == 1 )
{
auto match = getTaxiLightPos.get_one();
Patch<uint8_t>( match.get<void>( -15 ), 0x55 ); // push eax -> push ebp
InjectHook( match.get<void>(), GetTransformedCoronaPos );
}
}
// Reset requested extras if created vehicle has no extras // Reset requested extras if created vehicle has no extras
{ {
@ -257,9 +242,25 @@ namespace Common {
DelayedPatches::Func = std::move(func); DelayedPatches::Func = std::move(func);
} }
void III_VC_DelayedCommon( bool /*hasDebugMenu*/, const wchar_t* /*iniPath*/ ) void III_VC_DelayedCommon( bool /*hasDebugMenu*/, const wchar_t* wcModulePath )
{ {
using namespace Memory;
using namespace hook;
// Corrected taxi light placement for Taxi
if ( GetPrivateProfileIntW(L"SilentPatch", L"EnableVehicleCoronaFixes", -1, wcModulePath) == 1 )
{
using namespace TaxiCoronaFix;
auto getTaxiLightPos = pattern( "E8 ? ? ? ? D9 84 24 ? ? ? ? D8 84 24 ? ? ? ? 83 C4 0C FF 35" );
if ( getTaxiLightPos.count_hint(1).size() == 1 )
{
auto match = getTaxiLightPos.get_one();
Patch<uint8_t>( match.get<void>( -15 ), 0x55 ); // push eax -> push ebp
InjectHook( match.get<void>(), GetTransformedCoronaPos );
}
}
} }
} }
} }

View file

@ -524,7 +524,7 @@ void InjectDelayedPatches_III_Common( bool bHasDebugMenu, const wchar_t* wcModul
// Corrected siren corona placement for emergency vehicles // Corrected siren corona placement for emergency vehicles
// TODO: INI entry if ( GetPrivateProfileIntW(L"SilentPatch", L"EnableVehicleCoronaFixes", -1, wcModulePath) == 1 )
{ {
// Other mods might be touching it, so only patch specific vehicles if their code has not been touched at all // Other mods might be touching it, so only patch specific vehicles if their code has not been touched at all
{ {

View file

@ -455,7 +455,7 @@ void InjectDelayedPatches_VC_Common( bool bHasDebugMenu, const wchar_t* wcModule
// Corrected siren corona placement for emergency vehicles // Corrected siren corona placement for emergency vehicles
// TODO: INI entry if ( GetPrivateProfileIntW(L"SilentPatch", L"EnableVehicleCoronaFixes", -1, wcModulePath) == 1 )
{ {
// Other mods might be touching it, so only patch specific vehicles if their code has not been touched at all // Other mods might be touching it, so only patch specific vehicles if their code has not been touched at all
{ {