From f6cf13fb8a0d1ec093f0a08cd1068528e9558504 Mon Sep 17 00:00:00 2001 From: Silent Date: Sat, 28 May 2016 20:14:29 +0200 Subject: [PATCH] Car explosion fix fixed for hoodlum exe --- SilentPatchSA/SilentPatchSA.cpp | 35 ++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index 2288696..3b0a0d3 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -2907,14 +2907,35 @@ void Patch_SA_10() // Car explosion crash with multimonitor // Unitialized collision data breaking stencil shadows - int pMemMgrMalloc = 0x40F8D3; - orgMemMgrMalloc = (void*(*)(RwUInt32,RwUInt32))(*(int*)(pMemMgrMalloc+1) + pMemMgrMalloc + 5); - InjectHook(0x40F8D3, CollisionData_MallocAndInit); + { + int pHoodlumCompat; + if ( *(BYTE*)0x40F870 == 0xE9 ) + pHoodlumCompat = 0x40F875 + *(int*)0x40F871; + else + pHoodlumCompat = 0x40F870; - int pNewAlloc = 0x40F74C; - orgNewAlloc = (void*(*)(size_t))(*(int*)(pNewAlloc+1) + pNewAlloc + 5); - InjectHook(0x40F74C, CollisionData_NewAndInit); - InjectHook(0x40F81D, CollisionData_NewAndInit); + int pMemMgrMalloc = pHoodlumCompat + 0x63; + orgMemMgrMalloc = (void*(*)(RwUInt32,RwUInt32))(*(int*)(pMemMgrMalloc+1) + pMemMgrMalloc + 5); + InjectHook(pMemMgrMalloc, CollisionData_MallocAndInit); + } + { + int pHoodlumCompat, pHoodlumCompat2; + if ( *(BYTE*)0x40F740 == 0xE9 ) + { + pHoodlumCompat = 0x40F745 + *(int*)0x40F741; + pHoodlumCompat2 = 0x40F815 + *(int*)0x40F811; + } + else + { + pHoodlumCompat = 0x40F740; + pHoodlumCompat2 = 0x40F810; + } + + int pNewAlloc = pHoodlumCompat + 0xC; + orgNewAlloc = (void*(*)(size_t))(*(int*)(pNewAlloc+1) + pNewAlloc + 5); + InjectHook(pHoodlumCompat + 0xC, CollisionData_NewAndInit); + InjectHook(pHoodlumCompat2 + 0xD, CollisionData_NewAndInit); + } // Crash when entering advanced display options on a dual monitor machine after: