From fc20e24d913c06188f9ce0d916700f58f1a1dbaa Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Fri, 12 Jul 2024 18:01:15 +0800 Subject: [PATCH] [saco] Implement/match `exc_filter(...)` --- saco/exceptions.cpp | 35 ++++++++++++++++++++++++++++++++++- saco/main.cpp | 2 ++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/saco/exceptions.cpp b/saco/exceptions.cpp index b603435..c00a610 100644 --- a/saco/exceptions.cpp +++ b/saco/exceptions.cpp @@ -11,12 +11,15 @@ PCONTEXT pContextRecord; extern HANDLE hInstance; extern CGame *pGame; extern CNetGame *pNetGame; +extern CChatWindow *pChatWindow; extern DWORD dwScmOpcodeDebug; extern BOOL bScmLocalDebug; extern int iGtaVersion; extern WORD wLastRendObj; +extern WORD wVehicleComponentDebug; CHAR szErrorString[16384]; +int dword_10125A58=0; //---------------------------------------------------- @@ -226,4 +229,34 @@ LONG WINAPI exc_handler(_EXCEPTION_POINTERS* exc_inf) return EXCEPTION_EXECUTE_HANDLER; } -//---------------------------------------------------- \ No newline at end of file +//---------------------------------------------------- + +int exc_filter(unsigned int code, struct _EXCEPTION_POINTERS *ep, char *what) +{ + if(pChatWindow) + { + if(!strcmp(what, "opcode")) + { + if(dwScmOpcodeDebug == 1767) + { + pChatWindow->AddDebugMessage("Warning(add_car_component %u): Exception 0x%X at 0x%X", + wVehicleComponentDebug, code, ep->ContextRecord->Eip); + return 1; + } else { + pChatWindow->AddDebugMessage("Warning(opcode 0x%X): Exception 0x%X at 0x%X", + dwScmOpcodeDebug, code, ep->ContextRecord->Eip); + } + } else { + pChatWindow->AddDebugMessage("Warning(%s): Exception 0x%X at 0x%X", + what, code, ep->ContextRecord->Eip); + } + } + + if(dword_10125A58 < 10) { + dword_10125A58++; + return 1; + } + return 0; +} + +//---------------------------------------------------- diff --git a/saco/main.cpp b/saco/main.cpp index 33ae6b6..73a1629 100644 --- a/saco/main.cpp +++ b/saco/main.cpp @@ -28,6 +28,8 @@ CUnkClass15 *pUnkClass15=0; BOOL bGameInited=FALSE; +WORD wVehicleComponentDebug=0; + IDirect3D9 *pD3D; IDirect3DDevice9 *pD3DDevice = NULL;