Permalink
Browse files

Crash 'fix' for offset 003F18CF

  • Loading branch information...
ccw808 committed May 17, 2017
1 parent 4a3a359 commit eddacab44f71a62653e6033362791586e6bb34f6
Showing with 35 additions and 0 deletions.
  1. +35 −0 Client/multiplayer_sa/CMultiplayerSA_CrashFixHacks.cpp
@@ -1574,6 +1574,40 @@ void _declspec(naked) HOOK_printf ()
}
////////////////////////////////////////////////////////////////////////
//
// RwMatrixMultiply
//
// Check for invalid matix pointer
//
////////////////////////////////////////////////////////////////////////
#define HOOKPOS_RwMatrixMultiply_US 0x7F18B0
#define HOOKSIZE_RwMatrixMultiply_US 6
#define HOOKCHECK_RwMatrixMultiply_US 0x8B
#define HOOKPOS_RwMatrixMultiply_EU 0x7F18F0
#define HOOKSIZE_RwMatrixMultiply_EU 6
#define HOOKCHECK_RwMatrixMultiply_EU 0x8B
DWORD RETURN_RwMatrixMultiply_US = 0x7F18B6;
DWORD RETURN_RwMatrixMultiply_EU = 0x7F18F6;
DWORD RETURN_RwMatrixMultiply_BOTH = 0;
void _declspec(naked) HOOK_RwMatrixMultiply()
{
_asm
{
mov eax, [esp+0Ch]
cmp eax, 0x480
jb cont // Skip code if eax is low
mov ecx, dword ptr ds:[0C979BCh]
jmp RETURN_RwMatrixMultiply_BOTH
cont:
CRASH_AVERTED(31)
retn
}
}
//////////////////////////////////////////////////////////////////////////////////////////
//
// Setup hooks for CrashFixHacks
@@ -1620,6 +1654,7 @@ void CMultiplayerSA::InitHooks_CrashFixHacks ( void )
EZHookInstallChecked ( CAnimManager_CreateAnimAssocGroups );
EZHookInstall ( CTaskComplexCarSlowBeDraggedOut_CreateFirstSubTask );
EZHookInstallChecked ( printf );
EZHookInstallChecked ( RwMatrixMultiply );
// Install train crossing crashfix (the temporary variable is required for the template logic)
void (*temp)() = HOOK_TrainCrossingBarrierCrashFix<RETURN_CObject_Destructor_TrainCrossing_Check, RETURN_CObject_Destructor_TrainCrossing_Invalid>;

1 comment on commit eddacab

@Dutchman101

This comment has been minimized.

Collaborator

Dutchman101 commented on eddacab May 17, 2017

Great news, this crash (0x003F18CF) was within Top 5 crashes, occuring more than 100,000 times just on 1.5.x (although just a result of bad mods (dff modelling).. widely spread around MTA ofcourse hence why)

A good win for MTA's general stability, the 'bad model' fear can be lowered now

Please sign in to comment.