Small code clarity fixes

This commit is contained in:
Silent 2017-09-20 20:41:58 +02:00
parent 4a3a867b0c
commit ab6f2609d8

View file

@ -3271,19 +3271,23 @@ void Patch_SA_10()
#endif #endif
// IsAlreadyRunning needs to be read relatively late - the later, the better // IsAlreadyRunning needs to be read relatively late - the later, the better
int pIsAlreadyRunning = AddressByRegion_10<int>(0x74872D); {
ReadCall( pIsAlreadyRunning, IsAlreadyRunning ); const uintptr_t pIsAlreadyRunning = AddressByRegion_10<uintptr_t>(0x74872D);
InjectHook(pIsAlreadyRunning, InjectDelayedPatches_10); ReadCall( pIsAlreadyRunning, IsAlreadyRunning );
InjectHook(pIsAlreadyRunning, InjectDelayedPatches_10);
}
// Newsteam crash fix // Newsteam crash fix
pDirect = *(RpLight***)0x5BA573; pDirect = *(RpLight***)0x5BA573;
DarkVehiclesFix1_JumpBack = AddressByRegion_10<void*>(0x756D90); DarkVehiclesFix1_JumpBack = AddressByRegion_10<void*>(0x756D90);
// (Hopefully) more precise frame limiter // (Hopefully) more precise frame limiter
int pAddress = AddressByRegion_10<int>(0x748D9B); {
ReadCall( pAddress, RsEventHandler ); uintptr_t pAddress = AddressByRegion_10<uintptr_t>(0x748D9B);
InjectHook(pAddress, NewFrameRender); ReadCall( pAddress, RsEventHandler );
InjectHook(AddressByRegion_10<int>(0x748D1F), GetTimeSinceLastFrame); InjectHook(pAddress, NewFrameRender);
InjectHook(AddressByRegion_10<uintptr_t>(0x748D1F), GetTimeSinceLastFrame);
}
// Set CAEDataStream to use an old structure // Set CAEDataStream to use an old structure
CAEDataStream::SetStructType(false); CAEDataStream::SetStructType(false);
@ -3596,22 +3600,22 @@ void Patch_SA_10()
// Car explosion crash with multimonitor // Car explosion crash with multimonitor
// Unitialized collision data breaking stencil shadows // Unitialized collision data breaking stencil shadows
{ {
int pHoodlumCompat; uintptr_t pHoodlumCompat;
if ( *(BYTE*)0x40F870 == 0xE9 ) if ( *(uint8_t*)0x40F870 == 0xE9 )
pHoodlumCompat = 0x40F875 + *(int*)0x40F871; ReadCall( 0x40F870, pHoodlumCompat );
else else
pHoodlumCompat = 0x40F870; pHoodlumCompat = 0x40F870;
int pMemMgrMalloc = pHoodlumCompat + 0x63; const uintptr_t pMemMgrMalloc = pHoodlumCompat + 0x63;
ReadCall( pMemMgrMalloc, orgMemMgrMalloc ); ReadCall( pMemMgrMalloc, orgMemMgrMalloc );
VP::InjectHook(pMemMgrMalloc, CollisionData_MallocAndInit); VP::InjectHook(pMemMgrMalloc, CollisionData_MallocAndInit);
} }
{ {
int pHoodlumCompat, pHoodlumCompat2; uintptr_t pHoodlumCompat, pHoodlumCompat2;
if ( *(BYTE*)0x40F740 == 0xE9 ) if ( *(uint8_t*)0x40F740 == 0xE9 )
{ {
pHoodlumCompat = 0x40F745 + *(int*)0x40F741; ReadCall( 0x40F740, pHoodlumCompat );
pHoodlumCompat2 = 0x40F815 + *(int*)0x40F811; ReadCall( 0x40F810, pHoodlumCompat2 );
} }
else else
{ {
@ -3619,7 +3623,7 @@ void Patch_SA_10()
pHoodlumCompat2 = 0x40F810; pHoodlumCompat2 = 0x40F810;
} }
int pNewAlloc = pHoodlumCompat + 0xC; const uintptr_t pNewAlloc = pHoodlumCompat + 0xC;
ReadCall( pNewAlloc, orgNewAlloc ); ReadCall( pNewAlloc, orgNewAlloc );
VP::InjectHook(pHoodlumCompat + 0xC, CollisionData_NewAndInit); VP::InjectHook(pHoodlumCompat + 0xC, CollisionData_NewAndInit);
VP::InjectHook(pHoodlumCompat2 + 0xD, CollisionData_NewAndInit); VP::InjectHook(pHoodlumCompat2 + 0xD, CollisionData_NewAndInit);