mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-28 23:03:01 +05:00
Only hook DOUBLE_RHWEELS exception list if there are any entries listed in INI
This commit is contained in:
parent
7413bab68c
commit
e4a3d81e81
2 changed files with 22 additions and 15 deletions
|
@ -1074,9 +1074,11 @@ void DrawScriptSpritesAndRectangles( uint8_t arg )
|
|||
}
|
||||
|
||||
std::vector< std::pair<int32_t, bool> > doubleRearWheelsList;
|
||||
void ReadDoubleRearWheels(const wchar_t* pPath)
|
||||
bool ReadDoubleRearWheels(const wchar_t* pPath)
|
||||
{
|
||||
const size_t SCRATCH_PAD_SIZE = 32767;
|
||||
bool listedAny = false;
|
||||
|
||||
constexpr size_t SCRATCH_PAD_SIZE = 32767;
|
||||
WideDelimStringReader reader( SCRATCH_PAD_SIZE );
|
||||
|
||||
GetPrivateProfileSectionW( L"DoubleRearWheels", reader.GetBuffer(), reader.GetSize(), pPath );
|
||||
|
@ -1100,8 +1102,10 @@ void ReadDoubleRearWheels(const wchar_t* pPath)
|
|||
if ( begin != end )
|
||||
{
|
||||
doubleRearWheelsList.emplace_back( toList, value );
|
||||
listedAny = true;
|
||||
}
|
||||
}
|
||||
return listedAny;
|
||||
}
|
||||
|
||||
bool __stdcall CheckDoubleRWheelsList( void* modelInfo, uint8_t* handlingData )
|
||||
|
@ -2294,7 +2298,7 @@ BOOL InjectDelayedPatches_10()
|
|||
bool bSARender = GetASIModuleHandleW(L"SARender") != nullptr;
|
||||
|
||||
ReadRotorFixExceptions(wcModulePath);
|
||||
ReadDoubleRearWheels(wcModulePath);
|
||||
bool bHookDoubleRwheels = ReadDoubleRearWheels(wcModulePath);
|
||||
|
||||
if ( GetPrivateProfileIntW(L"SilentPatch", L"SunSizeHack", -1, wcModulePath) == TRUE )
|
||||
{
|
||||
|
@ -2492,6 +2496,20 @@ BOOL InjectDelayedPatches_10()
|
|||
// to work fine with Deji's Custom Plate Format
|
||||
ReadCall( 0x4C9484, CCustomCarPlateMgr::GeneratePlateText );
|
||||
|
||||
|
||||
if ( bHookDoubleRwheels )
|
||||
{
|
||||
// Double rwheels whitelist
|
||||
// push ecx
|
||||
// push edi
|
||||
// call CheckDoubleRWheelsWhitelist
|
||||
// test al, al
|
||||
Patch<uint16_t>( 0x4C9239, 0x5751 );
|
||||
InjectHook( 0x4C9239+2, CheckDoubleRWheelsList, PATCH_CALL );
|
||||
Patch<uint16_t>( 0x4C9239+7, 0xC084 );
|
||||
Nop( 0x4C9239+9, 1 );
|
||||
}
|
||||
|
||||
// Adblocker
|
||||
#if DISABLE_FLA_DONATION_WINDOW
|
||||
if ( GetASIModuleHandleW(L"$fastman92limitAdjuster") != nullptr )
|
||||
|
@ -3431,17 +3449,6 @@ void Patch_SA_10()
|
|||
InjectHook( 0x58C092, DrawScriptSpritesAndRectangles );
|
||||
|
||||
|
||||
// Double rwheels whitelist
|
||||
// push ecx
|
||||
// push edi
|
||||
// call CheckDoubleRWheelsWhitelist
|
||||
// test al, al
|
||||
Patch<uint16_t>( 0x4C9239, 0x5751 );
|
||||
InjectHook( 0x4C9239+2, CheckDoubleRWheelsList, PATCH_CALL );
|
||||
Patch<uint16_t>( 0x4C9239+7, 0xC084 );
|
||||
Nop( 0x4C9239+9, 1 );
|
||||
|
||||
|
||||
// Properly initialize all CVehicleModelInfo fields
|
||||
ReadCall( 0x4C75E4, orgVehicleModelInfoCtor );
|
||||
InjectHook( 0x4C75E4, VehicleModelInfoCtor );
|
||||
|
|
|
@ -84,7 +84,7 @@ static RwFrame* GetFrameFromName( RwFrame* topFrame, const char* name )
|
|||
|
||||
void ReadRotorFixExceptions(const wchar_t* pPath)
|
||||
{
|
||||
const size_t SCRATCH_PAD_SIZE = 32767;
|
||||
constexpr size_t SCRATCH_PAD_SIZE = 32767;
|
||||
WideDelimStringReader reader( SCRATCH_PAD_SIZE );
|
||||
|
||||
GetPrivateProfileSectionW( L"RotorFixExceptions", reader.GetBuffer(), reader.GetSize(), pPath );
|
||||
|
|
Loading…
Reference in a new issue