Skip to content

Commit 05c639c

Browse files
committed
Fix crash in FxPrim_c::Enable
This fixes the crash at offset 000a9f54. It's a side-effect crash of the patch 5a598d7.
1 parent da4ea45 commit 05c639c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Client/multiplayer_sa/CMultiplayerSA_CrashFixHacks.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,6 +2001,34 @@ static void _declspec(naked) HOOK_FxSystemBP_c__Load()
20012001
}
20022002
}
20032003

2004+
//////////////////////////////////////////////////////////////////////////////////////////
2005+
//
2006+
// FxPrim_c::Enable
2007+
//
2008+
// Add a null-pointer check for the ecx object. This hook is a side-effect of the hook for
2009+
// FxSystemBP_c::Load above.
2010+
//
2011+
//////////////////////////////////////////////////////////////////////////////////////////
2012+
// >>> 0x4A9F50 | 8A 44 24 04 | mov al, [esp+4]
2013+
// >>> 0x4A9F54 | 88 41 0C | mov [ecx+0xC], al
2014+
// >>> 0x4A9F57 | C2 04 00 | retn 4
2015+
#define HOOKPOS_FxPrim_c__Enable 0x4A9F50
2016+
#define HOOKSIZE_FxPrim_c__Enable 10
2017+
2018+
static void _declspec(naked) HOOK_FxPrim_c__Enable()
2019+
{
2020+
_asm
2021+
{
2022+
test ecx, ecx
2023+
jz returnFromFunction
2024+
mov al, [esp+4]
2025+
mov [ecx+0xC], al
2026+
2027+
returnFromFunction:
2028+
retn 4
2029+
}
2030+
}
2031+
20042032
//////////////////////////////////////////////////////////////////////////////////////////
20052033
//
20062034
// Setup hooks for CrashFixHacks
@@ -2060,6 +2088,7 @@ void CMultiplayerSA::InitHooks_CrashFixHacks()
20602088
EZHookInstall(RpAnimBlendClumpGetFirstAssociation);
20612089
EZHookInstall(CAnimManager__BlendAnimation);
20622090
EZHookInstall(FxSystemBP_c__Load);
2091+
EZHookInstall(FxPrim_c__Enable);
20632092

20642093
// Install train crossing crashfix (the temporary variable is required for the template logic)
20652094
void (*temp)() = HOOK_TrainCrossingBarrierCrashFix<RETURN_CObject_Destructor_TrainCrossing_Check, RETURN_CObject_Destructor_TrainCrossing_Invalid>;

0 commit comments

Comments
 (0)