r5sdk/r5dev/squirrel/sqstdaux.cpp
Kawe Mazidjatari 8fde529e2b Print script errors to the console at all times
This change prints script errors and their callstack to the console even when sq_showvmoutput < 2 (this avoids confusion when running a dedicated server and the server 'appears' to shutdown the game on its own. You could also check the script log files which are written to at all times, but having some indication is nice).
2022-08-08 17:49:46 +02:00

42 lines
1.1 KiB
C++

//=============================================================================//
//
// Purpose:
//
//=============================================================================//
#include "core/stdafx.h"
#include "tier0/tslist.h"
#include "squirrel/sqvm.h"
#include "squirrel/sqstdaux.h"
bool g_bSQAuxError = false;
bool g_bSQAuxBadLogic = false;
HSQUIRRELVM g_pErrorVM = nullptr;
SQInteger sqstd_aux_printerror(HSQUIRRELVM v)
{
g_bSQAuxError = true;
SQInteger results = v_sqstd_aux_printerror(v);
g_bSQAuxError = false;
return results;
}
SQInteger sqstd_aux_badlogic(HSQUIRRELVM v, __m128i* a2, __m128i* a3)
{
g_pErrorVM = v;
SQInteger results = v_sqstd_aux_badlogic(v, a2, a3);
return results;
}
void SQAUX_Attach()
{
DetourAttach((LPVOID*)&v_sqstd_aux_printerror, &sqstd_aux_printerror);
DetourAttach((LPVOID*)&v_sqstd_aux_badlogic, &sqstd_aux_badlogic);
}
void SQAUX_Detach()
{
DetourDetach((LPVOID*)&v_sqstd_aux_printerror, &sqstd_aux_printerror);
DetourDetach((LPVOID*)&v_sqstd_aux_badlogic, &sqstd_aux_badlogic);
}