SA: Clean CVehicleModelInfo fields from ::Init so they are cleaned up after modloader loads the ASI

Fixes #44
This commit is contained in:
Silent 2024-10-28 20:47:34 +01:00
parent 4cb6edad7c
commit f1d85b825b
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1

View File

@ -1167,10 +1167,10 @@ void DrawScriptSpritesAndRectangles( uint8_t arg )
bool ReadDoubleRearWheels(const wchar_t* pPath); bool ReadDoubleRearWheels(const wchar_t* pPath);
bool __stdcall CheckDoubleRWheelsList( void* modelInfo, uint8_t* handlingData ); bool __stdcall CheckDoubleRWheelsList( void* modelInfo, uint8_t* handlingData );
CVehicleModelInfo* (__thiscall *orgVehicleModelInfoCtor)(CVehicleModelInfo*); CVehicleModelInfo* (__thiscall *orgVehicleModelInfoInit)(CVehicleModelInfo*);
CVehicleModelInfo* __fastcall VehicleModelInfoCtor(CVehicleModelInfo* me) CVehicleModelInfo* __fastcall VehicleModelInfoInit(CVehicleModelInfo* me)
{ {
orgVehicleModelInfoCtor(me); orgVehicleModelInfoInit(me);
// Hack to satisfy some null checks // Hack to satisfy some null checks
static uintptr_t DUMMY; static uintptr_t DUMMY;
@ -5604,9 +5604,7 @@ void Patch_SA_10(HINSTANCE hInstance)
// Properly initialize all CVehicleModelInfo fields // Properly initialize all CVehicleModelInfo fields
ReadCall( 0x4C75E4, orgVehicleModelInfoCtor ); InterceptCall(0x4C7633, orgVehicleModelInfoInit, VehicleModelInfoInit);
InjectHook( 0x4C75E4, VehicleModelInfoCtor );
// Animated Phoenix hood scoop // Animated Phoenix hood scoop
{ {