Kawe Mazidjatari 75ccebb4b6 Squirrel system restructure
Properly decouple squirrel and game code. This makes it easier to reverse engineer more of this squirrel system, and to compile them as individual libraries later on when moving to CMake to significantly decrease compile times.
2023-05-06 16:23:56 +02:00

42 lines
1.1 KiB
C++

//=============================================================================//
//
// Purpose:
//
//=============================================================================//
#include "core/stdafx.h"
#include "tier0/tslist.h"
#include "vscript/languages/squirrel_re/include/sqvm.h"
#include "vscript/languages/squirrel_re/include/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 VSquirrelAUX::Attach() const
{
DetourAttach(&v_sqstd_aux_printerror, &sqstd_aux_printerror);
DetourAttach(&v_sqstd_aux_badlogic, &sqstd_aux_badlogic);
}
void VSquirrelAUX::Detach() const
{
DetourDetach(&v_sqstd_aux_printerror, &sqstd_aux_printerror);
DetourDetach(&v_sqstd_aux_badlogic, &sqstd_aux_badlogic);
}