r5sdk/r5dev/squirrel/sqstdaux.h
Kawe Mazidjatari 793fcd62f2 End of logger refactor
Changed all loggers to use the internal 'CoreMsg/CoreMsgV' functions. Significantly reduced duplicate code and CPU time. Code is also much more robust.

* Code now only acquires mutex lock when the actual logging part takes place.
* Code now only checks and strip ANSI rows if its enabled to begin with.
* Code now supports setting log levels, which ultimately could be tweaked with a cvar.
* Changed logger and file names to be more readable.

TODO:
* The RCON protocol has to be modified to accommodate these changes.
2023-03-26 16:09:05 +02:00

41 lines
1.9 KiB
C++

#pragma once
#include "sqtype.h"
#include "sqvm.h"
extern bool g_bSQAuxError;
extern bool g_bSQAuxBadLogic;
extern HSQUIRRELVM g_pErrorVM;
inline CMemory p_sqstd_aux_printerror;
inline auto v_sqstd_aux_printerror = p_sqstd_aux_printerror.RCast<SQInteger(*)(HSQUIRRELVM v)>();
inline CMemory p_sqstd_aux_badlogic;
inline auto v_sqstd_aux_badlogic = p_sqstd_aux_badlogic.RCast<SQInteger(*)(HSQUIRRELVM v, __m128i* a2, __m128i* a3)>();
///////////////////////////////////////////////////////////////////////////////
class VSqStdAux : public IDetour
{
virtual void GetAdr(void) const
{
LogFunAdr("sqstd_aux_printerror", p_sqstd_aux_printerror.GetPtr());
LogFunAdr("sqstd_aux_badlogic", p_sqstd_aux_badlogic.GetPtr());
}
virtual void GetFun(void) const
{
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
p_sqstd_aux_printerror = g_GameDll.FindPatternSIMD("40 53 55 56 57 41 54 41 55 41 57 48 81 EC ?? ?? ?? ??");
v_sqstd_aux_printerror = p_sqstd_aux_printerror.RCast<SQInteger(*)(HSQUIRRELVM)>(); /*40 53 55 56 57 41 54 41 55 41 57 48 81 EC ?? ?? ?? ??*/
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
p_sqstd_aux_printerror = g_GameDll.FindPatternSIMD("40 53 56 57 41 54 41 55 41 56 41 57 48 81 EC ?? ?? ?? ?? FF 05 ?? ?? ?? ??");
v_sqstd_aux_printerror = p_sqstd_aux_printerror.RCast<SQInteger(*)(HSQUIRRELVM)>(); /*40 53 56 57 41 54 41 55 41 56 41 57 48 81 EC ?? ?? ?? ?? FF 05 ?? ?? ?? ??*/
#endif
p_sqstd_aux_badlogic = g_GameDll.FindPatternSIMD("48 8B C4 55 48 8B EC 48 83 EC 70 41 0F 10 ??");
v_sqstd_aux_badlogic = p_sqstd_aux_badlogic.RCast<SQInteger(*)(HSQUIRRELVM, __m128i*, __m128i*)>(); /*48 8B C4 55 48 8B EC 48 83 EC 70 41 0F 10 00*/
}
virtual void GetVar(void) const { }
virtual void GetCon(void) const { }
virtual void Attach(void) const;
virtual void Detach(void) const;
};
///////////////////////////////////////////////////////////////////////////////