Skip to content

Commit

Permalink
Make erroring more verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
GAMMACASE committed Oct 22, 2022
1 parent fd58fb6 commit 6514d09
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/momsurffix/baseplayer.sp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ stock bool InitBasePlayer(GameData gd)
{
//g_pEntityList
g_pEntityList = view_as<CBaseEntityList>(gd.GetAddress("g_pEntityList"));
ASSERT_MSG(g_pEntityList.Address != Address_Null, "Can't get \"g_pEntityList\" address from gamedata.");
ASSERT_MSG(g_pEntityList.Address != Address_Null, "Can't get \"g_pEntityList\" address from gamedata. Gamedata needs an update.");

//CBaseEntityList
ASSERT_FMT(gd.GetKeyValue("CBaseEntityList::m_EntPtrArray", buff, sizeof(buff)), "Can't get \"CBaseEntityList::m_EntPtrArray\" offset from gamedata.");
Expand Down
6 changes: 3 additions & 3 deletions addons/sourcemod/scripting/momsurffix/gamemovement.sp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ stock void InitGameMovement(GameData gd)
{
//sm_pSingleton
sm_pSingleton = view_as<IMoveHelper>(gd.GetAddress("sm_pSingleton"));
ASSERT_MSG(sm_pSingleton.Address != Address_Null, "Can't get \"sm_pSingleton\" address from gamedata.");
ASSERT_MSG(sm_pSingleton.Address != Address_Null, "Can't get \"sm_pSingleton\" address from gamedata. Gamedata needs an update.");
}
else
{
Expand All @@ -155,7 +155,7 @@ stock void InitGameMovement(GameData gd)

//CMoveHelperServer::CMoveHelperServer
Handle dhook = DHookCreateDetour(Address_Null, CallConv_CDECL, ReturnType_Int, ThisPointer_Ignore);
ASSERT_MSG(DHookSetFromConf(dhook, gd, SDKConf_Signature, "CMoveHelperServer::CMoveHelperServer"), "Failed to get \"CMoveHelperServer::CMoveHelperServer\" signature.");
ASSERT_MSG(DHookSetFromConf(dhook, gd, SDKConf_Signature, "CMoveHelperServer::CMoveHelperServer"), "Failed to get \"CMoveHelperServer::CMoveHelperServer\" signature. Gamedata needs an update.");
DHookAddParam(dhook, HookParamType_Int);
DHookEnableDetour(dhook, true, CMoveHelperServer_Dhook);
}
Expand Down Expand Up @@ -301,7 +301,7 @@ public MRESReturn CMoveHelperServer_Dhook(Handle hReturn, Handle hParams)
GameData gd = new GameData(GAME_DATA_FILE);

sm_pSingleton = view_as<IMoveHelper>(gd.GetAddress("sm_pSingleton"));
ASSERT_MSG(sm_pSingleton.Address != Address_Null, "Can't get \"sm_pSingleton\" address from gamedata.");
ASSERT_MSG(sm_pSingleton.Address != Address_Null, "Can't get \"sm_pSingleton\" address from gamedata. Gamedata needs an update.");

delete gd;
}
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/momsurffix/gametrace.sp
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ stock void InitGameTrace(GameData gd)
if(gEngineVersion == Engine_CSS)
{
offsets.ctfsoffsets.vtable = gd.GetAddress("CTraceFilterSimple::vtable");
ASSERT_MSG(offsets.ctfsoffsets.vtable != Address_Null, "Can't get \"CTraceFilterSimple::vtable\" address from gamedata.");
ASSERT_MSG(offsets.ctfsoffsets.vtable != Address_Null, "Can't get \"CTraceFilterSimple::vtable\" address from gamedata. Gamedata needs an update.");
}

//enginetrace
Expand Down
8 changes: 4 additions & 4 deletions addons/sourcemod/scripting/momsurffix/utils.sp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ stock void InitUtils(GameData gd)
//CreateInterface
StartPrepSDKCall(SDKCall_Static);

ASSERT_MSG(PrepSDKCall_SetFromConf(gd, SDKConf_Signature, "CreateInterface"), "Failed to get \"CreateInterface\" signature.");
ASSERT_MSG(PrepSDKCall_SetFromConf(gd, SDKConf_Signature, "CreateInterface"), "Failed to get \"CreateInterface\" signature. Gamedata needs an update.");

PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer);
PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
Expand All @@ -141,7 +141,7 @@ stock void InitUtils(GameData gd)
{
//g_pMemAlloc
g_pMemAlloc = gd.GetAddress("g_pMemAlloc");
ASSERT_MSG(g_pMemAlloc != Address_Null, "Can't get \"g_pMemAlloc\" address from gamedata.");
ASSERT_MSG(g_pMemAlloc != Address_Null, "Can't get \"g_pMemAlloc\" address from gamedata. Gamedata needs an update.");

//Malloc
StartPrepSDKCall(SDKCall_Raw);
Expand All @@ -168,7 +168,7 @@ stock void InitUtils(GameData gd)
{
//Malloc
StartPrepSDKCall(SDKCall_Static);
ASSERT_MSG(PrepSDKCall_SetFromConf(gd, SDKConf_Signature, "malloc"), "Failed to get \"malloc\" signature.");
ASSERT_MSG(PrepSDKCall_SetFromConf(gd, SDKConf_Signature, "malloc"), "Failed to get \"malloc\" signature. Gamedata needs an update.");

PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
Expand All @@ -180,7 +180,7 @@ stock void InitUtils(GameData gd)

//Free
StartPrepSDKCall(SDKCall_Static);
ASSERT_MSG(PrepSDKCall_SetFromConf(gd, SDKConf_Signature, "free"), "Failed to get \"free\" signature.");
ASSERT_MSG(PrepSDKCall_SetFromConf(gd, SDKConf_Signature, "free"), "Failed to get \"free\" signature. Gamedata needs an update.");

PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
Expand Down
13 changes: 10 additions & 3 deletions addons/sourcemod/scripting/momsurffix2.sp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ enum OSType
OSType gOSType;
EngineVersion gEngineVersion;

#define CUSTOM_ASSERTION_FAILSTATE
#define FAILSTATE_FUNC SetFailStateCustom
#define ASSERTUTILS_FAILSTATE_FUNC SetFailStateCustom
#define MEMUTILS_PLUGINENDCALL
#include "glib/memutils"
#undef MEMUTILS_PLUGINENDCALL
Expand Down Expand Up @@ -629,7 +628,15 @@ public void SetFailStateCustom(const char[] fmt, any ...)

CleanUpUtils();

SetFailState(buff);
char ostype[32];
switch(gOSType)
{
case OSLinux: ostype = "LIN";
case OSWindows: ostype = "WIN";
default: ostype = "UNK";
}

SetFailState("[%s | %i] %s", ostype, gEngineVersion, buff);
}

stock bool IsValidMovementTrace(CGameMovement pThis, CGameTrace tr)
Expand Down

0 comments on commit 6514d09

Please # to comment.