Updated a bunch of SDKs and moved the rest to the new debugging system.

This commit is contained in:
David Anderson 2004-10-04 06:14:30 +00:00
parent 4e1c5a3e02
commit 18b75cb07c
14 changed files with 402 additions and 85 deletions

View File

@ -219,8 +219,7 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
default:
MF_Log("Unknown dllfunc entry.");
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown dllfunc entry %d", type);
return 0;
}
}

View File

@ -963,7 +963,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
(*g_engfuncs.pfnSetClientKeyValue)(index,(*g_engfuncs.pfnGetInfoKeyBuffer)(INDEXENT2(index)),temp,temp2);
return 1;
default:
LOG_CONSOLE(PLID,"[NS2AMX] Unknown engfunc type provided.");
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown engfunc type %d", type);
return 0;
}
}

View File

@ -19,7 +19,23 @@ inline edict_t* INDEXENT2( int iEdictNum )
else
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
}
#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(INDEXENT2(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; }
#define CHECK_ENTITY(x) \
if (x < 0 || x > gpGlobals->maxEntities) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
return 0; \
} else { \
if (x <= gpGlobals->maxClients) { \
if (!MF_IsPlayerIngame(x)) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
return 0; \
} \
} else { \
if (x != 0 && FNullEnt(INDEXENT(x))) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
return 0; \
} \
} \
}
extern AMX_NATIVE_INFO engfunc_natives[];
extern AMX_NATIVE_INFO dllfunc_natives[];

View File

@ -8,13 +8,13 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
{
if (!MF_IsPlayerIngame(index))
{
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Player %d is not in game", index);
return 0;
}
} else {
if (index > gpGlobals->maxEntities || index < 1)
{
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", index);
return 0;
}
}
@ -501,8 +501,7 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
{
return (int)fReturn;
}
MF_Log("Invalid return valuetype for pev().");
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return valuetype for pev().");
return 0;
}
else if (returntype == RETURNTYPE_FLOAT)
@ -552,8 +551,7 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
return 1;
}
}
MF_Log("Invalid return valuetype for pev().");
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return valuetype for pev().");
}
else if (returntype == RETURNTYPE_STRING)
{
@ -610,8 +608,7 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
return 1;
}
}
MF_Log("Invalid return valuetype for pev().");
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return valuetype for pev().");
}
return 0;
}

View File

@ -39,20 +39,22 @@
#include <stdio.h>
#include "amxxmodule.h"
DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable;
enginefuncs_t *g_pengfuncsTable_Post;
/************* METAMOD SUPPORT *************/
#ifdef USE_METAMOD
enginefuncs_t g_engfuncs;
DLL_FUNCTIONS *gameDLLFunc;
globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable;
enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table =
{
@ -2122,7 +2124,6 @@ C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersi
return(FALSE);
}
memcpy(pFunctionTable, &g_EntityAPI_Table, sizeof(DLL_FUNCTIONS));
// Mark down the pointer to this mod's function tables...
g_pFunctionTable=pFunctionTable;
return(TRUE);
}
@ -2141,7 +2142,6 @@ C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interface
return(FALSE);
}
memcpy( pFunctionTable, &g_EntityAPI_Post_Table, sizeof( DLL_FUNCTIONS ) );
// Mark down the pointer to this mod's function tables...
g_pFunctionTable_Post=pFunctionTable;
return(TRUE);
}
@ -2165,7 +2165,6 @@ C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *inte
return(FALSE);
}
memcpy(pengfuncsFromEngine, &g_EngineFuncs_Table, sizeof(enginefuncs_t));
// Mark down the pointer to this mod's function tables...
g_pengfuncsTable=pengfuncsFromEngine;
return TRUE;
}
@ -2184,7 +2183,6 @@ C_DLLEXPORT int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int
return(FALSE);
}
memcpy(pengfuncsFromEngine, &g_EngineFuncs_Post_Table, sizeof(enginefuncs_t));
// Mark down the pointer to this mod's function tables...
g_pengfuncsTable_Post=pengfuncsFromEngine;
return TRUE;
@ -2210,6 +2208,7 @@ C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable,
return(FALSE);
}
memcpy(pNewFunctionTable, &g_NewFuncs_Table, sizeof(NEW_DLL_FUNCTIONS));
g_pNewFunctionsTable=pNewFunctionTable;
return TRUE;
}
@ -2227,6 +2226,7 @@ C_DLLEXPORT int GetNewDLLFunctions_Post( NEW_DLL_FUNCTIONS *pNewFunctionTable, i
return(FALSE);
}
memcpy(pNewFunctionTable, &g_NewFuncs_Post_Table, sizeof(NEW_DLL_FUNCTIONS));
g_pNewFunctionsTable_Post=pNewFunctionTable;
return TRUE;
}
@ -2454,11 +2454,14 @@ PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
PFN_LOG g_fn_Log;
PFN_LOG_ERROR g_fn_LogErrorFunc;
PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
PFN_REGISTER_FORWARD g_fn_RegisterForward;
PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray;
PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray;
PFN_PREPARE_CELLARRAY_A g_fn_PrepareCellArrayA;
PFN_PREPARE_CHARARRAY_A g_fn_PrepareCharArrayA;
PFN_IS_PLAYER_VALID g_fn_IsPlayerValid;
PFN_GET_PLAYER_NAME g_fn_GetPlayerName;
PFN_GET_PLAYER_IP g_fn_GetPlayerIP;
@ -2468,6 +2471,7 @@ PFN_IS_PLAYER_AUTHORIZED g_fn_IsPlayerAuthorized;
PFN_GET_PLAYER_TIME g_fn_GetPlayerTime;
PFN_GET_PLAYER_PLAYTIME g_fn_GetPlayerPlayTime;
PFN_GET_PLAYER_CURWEAPON g_fn_GetPlayerCurweapon;
PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
PFN_GET_PLAYER_TEAMID g_fn_GetPlayerTeamID;
PFN_GET_PLAYER_DEATHS g_fn_GetPlayerDeaths;
PFN_GET_PLAYER_MENU g_fn_GetPlayerMenu;
@ -2492,6 +2496,11 @@ PFN_CELL_TO_REAL g_fn_CellToReal;
PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
PFN_FORMAT g_fn_Format;
// *** Exports ***
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
@ -2535,6 +2544,9 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
REQFUNC("Log", g_fn_Log, PFN_LOG);
REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR);
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
// Amx scripts
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
@ -2542,6 +2554,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
REQFUNC("GetAmxScriptName", g_fn_GetAmxScriptName, PFN_GET_AMXSCRIPTNAME);
// String / mem in amx scripts support
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
@ -2555,6 +2568,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
REQFUNC("amx_FindNative", g_fn_AmxFindNative, PFN_AMX_FINDNATIVE);
// Natives / Forwards
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
@ -2566,7 +2580,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("ExecuteForward", g_fn_ExecuteForward, PFN_EXECUTE_FORWARD);
REQFUNC("PrepareCellArray", g_fn_PrepareCellArray, PFN_PREPARE_CELLARRAY);
REQFUNC("PrepareCharArray", g_fn_PrepareCharArray, PFN_PREPARE_CHARARRAY);
REQFUNC("PrepareCellArrayA", g_fn_PrepareCellArrayA, PFN_PREPARE_CELLARRAY_A);
REQFUNC("PrepareCharArrayA", g_fn_PrepareCharArrayA, PFN_PREPARE_CHARARRAY_A);
// Player
REQFUNC("IsPlayerValid", g_fn_IsPlayerValid, PFN_IS_PLAYER_VALID);
REQFUNC("GetPlayerName", g_fn_GetPlayerName, PFN_GET_PLAYER_NAME);
@ -2578,6 +2593,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerPlayTime", g_fn_GetPlayerPlayTime, PFN_GET_PLAYER_PLAYTIME);
REQFUNC("GetPlayerCurweapon", g_fn_GetPlayerCurweapon, PFN_GET_PLAYER_CURWEAPON);
REQFUNC("GetPlayerTeamID", g_fn_GetPlayerTeamID, PFN_GET_PLAYER_TEAMID);
REQFUNC("GetPlayerTeam",g_fn_GetPlayerTeam, PFN_GET_PLAYER_TEAM);
REQFUNC("GetPlayerDeaths", g_fn_GetPlayerDeaths, PFN_GET_PLAYER_DEATHS);
REQFUNC("GetPlayerMenu", g_fn_GetPlayerMenu, PFN_GET_PLAYER_MENU);
REQFUNC("GetPlayerKeys", g_fn_GetPlayerKeys, PFN_GET_PLAYER_KEYS);
@ -2587,6 +2603,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
// Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
@ -2633,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
g_fn_Log("[%s] %s", MODULE_NAME, msg);
}
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
{
// :TODO: Overflow possible here
char msg[3072];
va_list arglst;
va_start(arglst, fmt);
vsprintf(msg, fmt, arglst);
va_end(arglst);
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
}
#ifdef _DEBUG
// validate macros
@ -2653,11 +2683,14 @@ void ValidateMacros_DontCallThis_Smiley()
MF_GetAmxStringLen(NULL);
MF_CopyAmxMemory(NULL, NULL, 0);
MF_Log("str", "str", 0);
MF_LogError(NULL, 0, NULL);
MF_RaiseAmxError(NULL, 0);
MF_RegisterForward("str", (ForwardExecType)0, 0, 0, 0);
MF_ExecuteForward(0, 0, 0);
MF_PrepareCellArray(NULL, 0);
MF_PrepareCharArray(NULL, 0);
MF_PrepareCellArrayA(NULL, 0, true);
MF_PrepareCharArrayA(NULL, 0, true);
MF_IsPlayerValid(0);
MF_GetPlayerName(0);
MF_GetPlayerIP(0);
@ -2668,6 +2701,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_GetPlayerPlayTime(0);
MF_GetPlayerCurweapon(0);
MF_GetPlayerTeamID(0);
MF_GetPlayerTeam(0);
MF_GetPlayerDeaths(0);
MF_GetPlayerMenu(0);
MF_GetPlayerKeys(0);
@ -2686,6 +2720,9 @@ void ValidateMacros_DontCallThis_Smiley()
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
MF_UnregisterSPForward(0);
MF_GetPlayerFrags(0);
MF_GetPlayerEdict(0);
MF_Format("", 4, "str");
}
#endif
@ -2802,7 +2839,7 @@ void *operator new(size_t reportedSize)
return ptr;
// allocation failed
return NULL;
}
void *operator new[](size_t reportedSize)
@ -2815,7 +2852,7 @@ void *operator new[](size_t reportedSize)
return ptr;
// allocation failed
return NULL;
}
// Microsoft memory tracking operators
@ -2829,7 +2866,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine)
return ptr;
// allocation failed
return NULL;
}
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
{
@ -2841,7 +2878,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine
return ptr;
// allocation failed
return NULL;
}
void operator delete(void *reportedAddress)
@ -2893,6 +2930,7 @@ void operator delete[](void *reportedAddress)
#include <extdll.h>
#include "sdk_util.h"
#include <cbase.h>
#include <string.h> // for strncpy(), etc
@ -2929,4 +2967,76 @@ void UTIL_LogPrintf( char *fmt, ... )
}
void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms,
const char *pMessage)
{
if ( !pEntity )
return;
MESSAGE_BEGIN( MSG_ONE, SVC_TEMPENTITY, NULL, ENT(pEntity->pev) );
WRITE_BYTE( TE_TEXTMESSAGE );
WRITE_BYTE( textparms.channel & 0xFF );
WRITE_SHORT( FixedSigned16( textparms.x, 1<<13 ) );
WRITE_SHORT( FixedSigned16( textparms.y, 1<<13 ) );
WRITE_BYTE( textparms.effect );
WRITE_BYTE( textparms.r1 );
WRITE_BYTE( textparms.g1 );
WRITE_BYTE( textparms.b1 );
WRITE_BYTE( textparms.a1 );
WRITE_BYTE( textparms.r2 );
WRITE_BYTE( textparms.g2 );
WRITE_BYTE( textparms.b2 );
WRITE_BYTE( textparms.a2 );
WRITE_SHORT( FixedUnsigned16( textparms.fadeinTime, 1<<8 ) );
WRITE_SHORT( FixedUnsigned16( textparms.fadeoutTime, 1<<8 ) );
WRITE_SHORT( FixedUnsigned16( textparms.holdTime, 1<<8 ) );
if ( textparms.effect == 2 )
WRITE_SHORT( FixedUnsigned16( textparms.fxTime, 1<<8 ) );
if ( strlen( pMessage ) < 512 )
{
WRITE_STRING( pMessage );
}
else
{
char tmp[512];
strncpy( tmp, pMessage, 511 );
tmp[511] = 0;
WRITE_STRING( tmp );
}
MESSAGE_END();
}
short FixedSigned16( float value, float scale )
{
int output;
output = (int) (value * scale);
if ( output > 32767 )
output = 32767;
if ( output < -32768 )
output = -32768;
return (short)output;
}
unsigned short FixedUnsigned16( float value, float scale )
{
int output;
output = (int) (value * scale);
if ( output < 0 )
output = 0;
if ( output > 0xFFFF )
output = 0xFFFF;
return (unsigned short)output;
}
#endif // USE_METAMOD

View File

@ -55,7 +55,7 @@ struct amxx_module_info_s
// The next section is copied from the amx.h file
// Copyright (c) ITB CompuPhase, 1997-2004
#if defined __LCC__ || defined __DMC__ || defined __linux__
#if defined __LCC__ || defined __DMC__ || defined __linux__ || defined __GNUC__
#include <stdint.h>
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
/* The ISO C99 defines the int16_t and int_32t types. If the compiler got
@ -929,7 +929,7 @@ void FN_EngineFprintf(FILE *pfile, char *szFmt, ...);
#endif // FN_EngineFprintf
#ifdef FN_PvAllocEntPrivateData
void *FN_PvAllocEntPrivateData(edict_t *pEdict, long cb);
void *FN_PvAllocEntPrivateData(edict_t *pEdict, int32 cb);
#endif // FN_PvAllocEntPrivateData
#ifdef FN_PvEntPrivateData
@ -1919,11 +1919,14 @@ typedef int (*PFN_GET_AMXSTRINGLEN) (const cell *ptr);
typedef char * (*PFN_FORMAT_AMXSTRING) (AMX * /*amx*/, cell * /*params*/, int /*startParam*/, int * /*pLen*/);
typedef void (*PFN_COPY_AMXMEMORY) (cell * /*dest*/, const cell * /*src*/, int /*len*/);
typedef void (*PFN_LOG) (const char * /*fmt*/, ...);
typedef void (*PFN_LOG_ERROR) (AMX * /*amx*/, int /*err*/, const char * /*fmt*/, ...);
typedef int (*PFN_RAISE_AMXERROR) (AMX * /*amx*/, int /*error*/);
typedef int (*PFN_REGISTER_FORWARD) (const char * /*funcname*/, ForwardExecType /*exectype*/, ... /*paramtypes terminated by PF_DONE*/);
typedef int (*PFN_EXECUTE_FORWARD) (int /*id*/, ... /*params*/);
typedef cell (*PFN_PREPARE_CELLARRAY) (cell * /*ptr*/, unsigned int /*size*/);
typedef cell (*PFN_PREPARE_CHARARRAY) (char * /*ptr*/, unsigned int /*size*/);
typedef cell (*PFN_PREPARE_CELLARRAY_A) (cell * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/);
typedef cell (*PFN_PREPARE_CHARARRAY_A) (char * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/);
typedef int (*PFN_IS_PLAYER_VALID) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_NAME) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_IP) (int /*id*/);
@ -1932,8 +1935,9 @@ typedef int (*PFN_IS_PLAYER_BOT) (int /*id*/);
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_TEAM) (int /*id*/);
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
typedef int (*PFN_GET_PLAYER_MENU) (int /*id*/);
@ -1944,6 +1948,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/);
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
#ifdef USE_METAMOD
typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#else
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
@ -1963,6 +1973,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
extern PFN_ADD_NATIVES g_fn_AddNatives;
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
@ -1979,11 +1990,14 @@ extern PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
extern PFN_LOG g_fn_Log;
extern PFN_LOG_ERROR g_fn_LogErrorFunc;
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
extern PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray;
extern PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray;
extern PFN_PREPARE_CELLARRAY_A g_fn_PrepareCellArrayA;
extern PFN_PREPARE_CHARARRAY_A g_fn_PrepareCharArrayA;
extern PFN_IS_PLAYER_VALID g_fn_IsPlayerValid;
extern PFN_GET_PLAYER_NAME g_fn_GetPlayerName;
extern PFN_GET_PLAYER_IP g_fn_GetPlayerIP;
@ -2017,6 +2031,9 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
extern PFN_FORMAT g_fn_Format;
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
#ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems
@ -2036,11 +2053,14 @@ int MF_GetAmxStringLen (const cell *ptr) { }
char * MF_FormatAmxString (AMX * amx, cell * params, int startParam, int * pLen) { }
void MF_CopyAmxMemory (cell * dest, const cell * src, int len) { }
void MF_Log (const char * fmt, ...) { }
void MF_LogError (AMX * amx, int err, const char *fmt, ...) { }
int MF_RaiseAmxError (AMX * amx, int error) { }
int MF_RegisterForward (const char * funcname, ForwardExecType exectype, ...) { }
int MF_ExecuteForward (int id, ...) { }
cell MF_PrepareCellArray (cell * ptr, unsigned int size) { }
cell MF_PrepareCharArray (char * ptr, unsigned int size) { }
cell MF_PrepareCellArrayA (cell * ptr, unsigned int size, bool copyBack) { }
cell MF_PrepareCharArrayA (char * ptr, unsigned int size, bool copyBack) { }
int MF_IsPlayerValid (int id) { }
const char * MF_GetPlayerName (int id) { }
const char * MF_GetPlayerIP (int id) { }
@ -2050,6 +2070,7 @@ int MF_IsPlayerAuthorized (int id) { }
float MF_GetPlayerTime (int id) { }
float MF_GetPlayerPlayTime (int id) { }
int MF_GetPlayerCurweapon (int id) { }
const char * MF_GetPlayerTeam (int id) { }
int MF_GetPlayerTeamID (int id) { }
int MF_GetPlayerDeaths (int id) { }
int MF_GetPlayerMenu (int id) { }
@ -2066,6 +2087,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
void MF_UnregisterSPForward (int id) { }
int MF_GetPlayerFlags (int id) { }
edict_t* MF_GetPlayerEdict (int id) { }
const char * MF_Format (const char *fmt, ...) { }
#endif // MAY_NEVER_BE_DEFINED
#define MF_AddNatives g_fn_AddNatives
@ -2083,11 +2106,14 @@ int MF_GetPlayerFlags (int id) { }
#define MF_GetAmxStringLen g_fn_GetAmxStringLen
#define MF_CopyAmxMemory g_fn_CopyAmxMemory
void MF_Log(const char *fmt, ...);
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_RaiseAmxError g_fn_RaiseAmxError
#define MF_RegisterForward g_fn_RegisterForward
#define MF_ExecuteForward g_fn_ExecuteForward
#define MF_PrepareCellArray g_fn_PrepareCellArray
#define MF_PrepareCharArray g_fn_PrepareCharArray
#define MF_PrepareCellArrayA g_fn_PrepareCellArrayA
#define MF_PrepareCharArrayA g_fn_PrepareCharArrayA
#define MF_IsPlayerValid g_fn_IsPlayerValid
#define MF_GetPlayerName g_fn_GetPlayerName
#define MF_GetPlayerIP g_fn_GetPlayerIP
@ -2097,6 +2123,7 @@ void MF_Log(const char *fmt, ...);
#define MF_GetPlayerTime g_fn_GetPlayerTime
#define MF_GetPlayerPlayTime g_fn_GetPlayerPlayTime
#define MF_GetPlayerCurweapon g_fn_GetPlayerCurweapon
#define MF_GetPlayerTeam g_fn_GetPlayerTeam
#define MF_GetPlayerTeamID g_fn_GetPlayerTeamID
#define MF_GetPlayerDeaths g_fn_GetPlayerDeaths
#define MF_GetPlayerMenu g_fn_GetPlayerMenu
@ -2121,6 +2148,8 @@ void MF_Log(const char *fmt, ...);
#define MF_RegisterSPForward g_fn_RegisterSPForward
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
#define MF_GetPlayerEdict g_fn_GetPlayerEdict
#define MF_Format g_fn_Format
/*** Memory ***/
void *operator new(size_t reportedSize);

View File

@ -45,6 +45,16 @@
enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable;
enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table =
{
@ -2114,6 +2124,7 @@ C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersi
return(FALSE);
}
memcpy(pFunctionTable, &g_EntityAPI_Table, sizeof(DLL_FUNCTIONS));
g_pFunctionTable=pFunctionTable;
return(TRUE);
}
@ -2131,7 +2142,7 @@ C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interface
return(FALSE);
}
memcpy( pFunctionTable, &g_EntityAPI_Post_Table, sizeof( DLL_FUNCTIONS ) );
g_pFunctionTable_Post=pFunctionTable;
return(TRUE);
}
@ -2154,6 +2165,7 @@ C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *inte
return(FALSE);
}
memcpy(pengfuncsFromEngine, &g_EngineFuncs_Table, sizeof(enginefuncs_t));
g_pengfuncsTable=pengfuncsFromEngine;
return TRUE;
}
@ -2171,6 +2183,7 @@ C_DLLEXPORT int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int
return(FALSE);
}
memcpy(pengfuncsFromEngine, &g_EngineFuncs_Post_Table, sizeof(enginefuncs_t));
g_pengfuncsTable_Post=pengfuncsFromEngine;
return TRUE;
}
@ -2195,6 +2208,7 @@ C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable,
return(FALSE);
}
memcpy(pNewFunctionTable, &g_NewFuncs_Table, sizeof(NEW_DLL_FUNCTIONS));
g_pNewFunctionsTable=pNewFunctionTable;
return TRUE;
}
@ -2212,6 +2226,7 @@ C_DLLEXPORT int GetNewDLLFunctions_Post( NEW_DLL_FUNCTIONS *pNewFunctionTable, i
return(FALSE);
}
memcpy(pNewFunctionTable, &g_NewFuncs_Post_Table, sizeof(NEW_DLL_FUNCTIONS));
g_pNewFunctionsTable_Post=pNewFunctionTable;
return TRUE;
}
@ -2439,11 +2454,14 @@ PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
PFN_LOG g_fn_Log;
PFN_LOG_ERROR g_fn_LogErrorFunc;
PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
PFN_REGISTER_FORWARD g_fn_RegisterForward;
PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray;
PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray;
PFN_PREPARE_CELLARRAY_A g_fn_PrepareCellArrayA;
PFN_PREPARE_CHARARRAY_A g_fn_PrepareCharArrayA;
PFN_IS_PLAYER_VALID g_fn_IsPlayerValid;
PFN_GET_PLAYER_NAME g_fn_GetPlayerName;
PFN_GET_PLAYER_IP g_fn_GetPlayerIP;
@ -2453,6 +2471,7 @@ PFN_IS_PLAYER_AUTHORIZED g_fn_IsPlayerAuthorized;
PFN_GET_PLAYER_TIME g_fn_GetPlayerTime;
PFN_GET_PLAYER_PLAYTIME g_fn_GetPlayerPlayTime;
PFN_GET_PLAYER_CURWEAPON g_fn_GetPlayerCurweapon;
PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
PFN_GET_PLAYER_TEAMID g_fn_GetPlayerTeamID;
PFN_GET_PLAYER_DEATHS g_fn_GetPlayerDeaths;
PFN_GET_PLAYER_MENU g_fn_GetPlayerMenu;
@ -2479,7 +2498,9 @@ PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
PFN_FORMAT g_fn_Format;
// *** Exports ***
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
@ -2523,7 +2544,9 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
REQFUNC("Log", g_fn_Log, PFN_LOG);
REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR);
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
// Amx scripts
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
@ -2557,7 +2580,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("ExecuteForward", g_fn_ExecuteForward, PFN_EXECUTE_FORWARD);
REQFUNC("PrepareCellArray", g_fn_PrepareCellArray, PFN_PREPARE_CELLARRAY);
REQFUNC("PrepareCharArray", g_fn_PrepareCharArray, PFN_PREPARE_CHARARRAY);
REQFUNC("PrepareCellArrayA", g_fn_PrepareCellArrayA, PFN_PREPARE_CELLARRAY_A);
REQFUNC("PrepareCharArrayA", g_fn_PrepareCharArrayA, PFN_PREPARE_CHARARRAY_A);
// Player
REQFUNC("IsPlayerValid", g_fn_IsPlayerValid, PFN_IS_PLAYER_VALID);
REQFUNC("GetPlayerName", g_fn_GetPlayerName, PFN_GET_PLAYER_NAME);
@ -2569,6 +2593,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerPlayTime", g_fn_GetPlayerPlayTime, PFN_GET_PLAYER_PLAYTIME);
REQFUNC("GetPlayerCurweapon", g_fn_GetPlayerCurweapon, PFN_GET_PLAYER_CURWEAPON);
REQFUNC("GetPlayerTeamID", g_fn_GetPlayerTeamID, PFN_GET_PLAYER_TEAMID);
REQFUNC("GetPlayerTeam",g_fn_GetPlayerTeam, PFN_GET_PLAYER_TEAM);
REQFUNC("GetPlayerDeaths", g_fn_GetPlayerDeaths, PFN_GET_PLAYER_DEATHS);
REQFUNC("GetPlayerMenu", g_fn_GetPlayerMenu, PFN_GET_PLAYER_MENU);
REQFUNC("GetPlayerKeys", g_fn_GetPlayerKeys, PFN_GET_PLAYER_KEYS);
@ -2579,6 +2604,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
// Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
@ -2625,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
g_fn_Log("[%s] %s", MODULE_NAME, msg);
}
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
{
// :TODO: Overflow possible here
char msg[3072];
va_list arglst;
va_start(arglst, fmt);
vsprintf(msg, fmt, arglst);
va_end(arglst);
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
}
#ifdef _DEBUG
// validate macros
@ -2645,11 +2683,14 @@ void ValidateMacros_DontCallThis_Smiley()
MF_GetAmxStringLen(NULL);
MF_CopyAmxMemory(NULL, NULL, 0);
MF_Log("str", "str", 0);
MF_LogError(NULL, 0, NULL);
MF_RaiseAmxError(NULL, 0);
MF_RegisterForward("str", (ForwardExecType)0, 0, 0, 0);
MF_ExecuteForward(0, 0, 0);
MF_PrepareCellArray(NULL, 0);
MF_PrepareCharArray(NULL, 0);
MF_PrepareCellArrayA(NULL, 0, true);
MF_PrepareCharArrayA(NULL, 0, true);
MF_IsPlayerValid(0);
MF_GetPlayerName(0);
MF_GetPlayerIP(0);
@ -2660,6 +2701,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_GetPlayerPlayTime(0);
MF_GetPlayerCurweapon(0);
MF_GetPlayerTeamID(0);
MF_GetPlayerTeam(0);
MF_GetPlayerDeaths(0);
MF_GetPlayerMenu(0);
MF_GetPlayerKeys(0);
@ -2673,16 +2715,17 @@ void ValidateMacros_DontCallThis_Smiley()
MF_AmxExecv(0, 0, 0, 0, 0);
MF_AmxFindPublic(0, 0, 0);
MF_AmxAllot(0, 0, 0, 0);
MF_LoadAmxScript(0, 0, 0, 0);
MF_LoadAmxScript(0, 0, 0, 0, 0);
MF_UnloadAmxScript(0, 0);
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
MF_UnregisterSPForward(0);
MF_GetPlayerFrags(0);
MF_GetPlayerEdict(0);
MF_Format("", 4, "str");
}
#endif
#ifdef MEMORY_TEST
/************* MEMORY *************/
// undef all defined macros
#undef new
@ -2796,7 +2839,7 @@ void *operator new(size_t reportedSize)
return ptr;
// allocation failed
throw std::bad_alloc();
return NULL;
}
void *operator new[](size_t reportedSize)
@ -2809,7 +2852,7 @@ void *operator new[](size_t reportedSize)
return ptr;
// allocation failed
throw std::bad_alloc();
return NULL;
}
// Microsoft memory tracking operators
@ -2823,7 +2866,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine)
return ptr;
// allocation failed
throw std::bad_alloc();
return NULL;
}
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
{
@ -2835,7 +2878,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine
return ptr;
// allocation failed
throw std::bad_alloc();
return NULL;
}
void operator delete(void *reportedAddress)
@ -2854,8 +2897,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
}
#endif //MEMORY_TEST
/************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new

View File

@ -55,7 +55,7 @@ struct amxx_module_info_s
// The next section is copied from the amx.h file
// Copyright (c) ITB CompuPhase, 1997-2004
#if defined __LCC__ || defined __DMC__ || defined __linux__
#if defined __LCC__ || defined __DMC__ || defined __linux__ || defined __GNUC__
#include <stdint.h>
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
/* The ISO C99 defines the int16_t and int_32t types. If the compiler got
@ -929,7 +929,7 @@ void FN_EngineFprintf(FILE *pfile, char *szFmt, ...);
#endif // FN_EngineFprintf
#ifdef FN_PvAllocEntPrivateData
void *FN_PvAllocEntPrivateData(edict_t *pEdict, long cb);
void *FN_PvAllocEntPrivateData(edict_t *pEdict, int32 cb);
#endif // FN_PvAllocEntPrivateData
#ifdef FN_PvEntPrivateData
@ -1919,11 +1919,14 @@ typedef int (*PFN_GET_AMXSTRINGLEN) (const cell *ptr);
typedef char * (*PFN_FORMAT_AMXSTRING) (AMX * /*amx*/, cell * /*params*/, int /*startParam*/, int * /*pLen*/);
typedef void (*PFN_COPY_AMXMEMORY) (cell * /*dest*/, const cell * /*src*/, int /*len*/);
typedef void (*PFN_LOG) (const char * /*fmt*/, ...);
typedef void (*PFN_LOG_ERROR) (AMX * /*amx*/, int /*err*/, const char * /*fmt*/, ...);
typedef int (*PFN_RAISE_AMXERROR) (AMX * /*amx*/, int /*error*/);
typedef int (*PFN_REGISTER_FORWARD) (const char * /*funcname*/, ForwardExecType /*exectype*/, ... /*paramtypes terminated by PF_DONE*/);
typedef int (*PFN_EXECUTE_FORWARD) (int /*id*/, ... /*params*/);
typedef cell (*PFN_PREPARE_CELLARRAY) (cell * /*ptr*/, unsigned int /*size*/);
typedef cell (*PFN_PREPARE_CHARARRAY) (char * /*ptr*/, unsigned int /*size*/);
typedef cell (*PFN_PREPARE_CELLARRAY_A) (cell * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/);
typedef cell (*PFN_PREPARE_CHARARRAY_A) (char * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/);
typedef int (*PFN_IS_PLAYER_VALID) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_NAME) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_IP) (int /*id*/);
@ -1932,8 +1935,9 @@ typedef int (*PFN_IS_PLAYER_BOT) (int /*id*/);
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_TEAM) (int /*id*/);
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
typedef int (*PFN_GET_PLAYER_MENU) (int /*id*/);
@ -1944,6 +1948,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/);
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
#ifdef USE_METAMOD
typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#else
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
@ -1963,6 +1973,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
extern PFN_ADD_NATIVES g_fn_AddNatives;
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
@ -1979,11 +1990,14 @@ extern PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
extern PFN_LOG g_fn_Log;
extern PFN_LOG_ERROR g_fn_LogErrorFunc;
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
extern PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray;
extern PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray;
extern PFN_PREPARE_CELLARRAY_A g_fn_PrepareCellArrayA;
extern PFN_PREPARE_CHARARRAY_A g_fn_PrepareCharArrayA;
extern PFN_IS_PLAYER_VALID g_fn_IsPlayerValid;
extern PFN_GET_PLAYER_NAME g_fn_GetPlayerName;
extern PFN_GET_PLAYER_IP g_fn_GetPlayerIP;
@ -2017,6 +2031,9 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
extern PFN_FORMAT g_fn_Format;
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
#ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems
@ -2036,11 +2053,14 @@ int MF_GetAmxStringLen (const cell *ptr) { }
char * MF_FormatAmxString (AMX * amx, cell * params, int startParam, int * pLen) { }
void MF_CopyAmxMemory (cell * dest, const cell * src, int len) { }
void MF_Log (const char * fmt, ...) { }
void MF_LogError (AMX * amx, int err, const char *fmt, ...) { }
int MF_RaiseAmxError (AMX * amx, int error) { }
int MF_RegisterForward (const char * funcname, ForwardExecType exectype, ...) { }
int MF_ExecuteForward (int id, ...) { }
cell MF_PrepareCellArray (cell * ptr, unsigned int size) { }
cell MF_PrepareCharArray (char * ptr, unsigned int size) { }
cell MF_PrepareCellArrayA (cell * ptr, unsigned int size, bool copyBack) { }
cell MF_PrepareCharArrayA (char * ptr, unsigned int size, bool copyBack) { }
int MF_IsPlayerValid (int id) { }
const char * MF_GetPlayerName (int id) { }
const char * MF_GetPlayerIP (int id) { }
@ -2050,6 +2070,7 @@ int MF_IsPlayerAuthorized (int id) { }
float MF_GetPlayerTime (int id) { }
float MF_GetPlayerPlayTime (int id) { }
int MF_GetPlayerCurweapon (int id) { }
const char * MF_GetPlayerTeam (int id) { }
int MF_GetPlayerTeamID (int id) { }
int MF_GetPlayerDeaths (int id) { }
int MF_GetPlayerMenu (int id) { }
@ -2066,6 +2087,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
void MF_UnregisterSPForward (int id) { }
int MF_GetPlayerFlags (int id) { }
edict_t* MF_GetPlayerEdict (int id) { }
const char * MF_Format (const char *fmt, ...) { }
#endif // MAY_NEVER_BE_DEFINED
#define MF_AddNatives g_fn_AddNatives
@ -2083,11 +2106,14 @@ int MF_GetPlayerFlags (int id) { }
#define MF_GetAmxStringLen g_fn_GetAmxStringLen
#define MF_CopyAmxMemory g_fn_CopyAmxMemory
void MF_Log(const char *fmt, ...);
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_RaiseAmxError g_fn_RaiseAmxError
#define MF_RegisterForward g_fn_RegisterForward
#define MF_ExecuteForward g_fn_ExecuteForward
#define MF_PrepareCellArray g_fn_PrepareCellArray
#define MF_PrepareCharArray g_fn_PrepareCharArray
#define MF_PrepareCellArrayA g_fn_PrepareCellArrayA
#define MF_PrepareCharArrayA g_fn_PrepareCharArrayA
#define MF_IsPlayerValid g_fn_IsPlayerValid
#define MF_GetPlayerName g_fn_GetPlayerName
#define MF_GetPlayerIP g_fn_GetPlayerIP
@ -2097,6 +2123,7 @@ void MF_Log(const char *fmt, ...);
#define MF_GetPlayerTime g_fn_GetPlayerTime
#define MF_GetPlayerPlayTime g_fn_GetPlayerPlayTime
#define MF_GetPlayerCurweapon g_fn_GetPlayerCurweapon
#define MF_GetPlayerTeam g_fn_GetPlayerTeam
#define MF_GetPlayerTeamID g_fn_GetPlayerTeamID
#define MF_GetPlayerDeaths g_fn_GetPlayerDeaths
#define MF_GetPlayerMenu g_fn_GetPlayerMenu
@ -2121,8 +2148,8 @@ void MF_Log(const char *fmt, ...);
#define MF_RegisterSPForward g_fn_RegisterSPForward
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
#ifdef MEMORY_TEST
#define MF_GetPlayerEdict g_fn_GetPlayerEdict
#define MF_Format g_fn_Format
/*** Memory ***/
void *operator new(size_t reportedSize);
@ -2167,6 +2194,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__

View File

@ -72,7 +72,7 @@ static cell AMX_NATIVE_CALL sql_connect(AMX *amx, cell *params) // 6 param
i = 0;
if (!strlen(host) || !strlen(user) || !strlen(dbname)) {
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter supplied");
return -1;
}
@ -116,7 +116,7 @@ static cell AMX_NATIVE_CALL sql_error(AMX *amx, cell *params) // 3 params
unsigned int id = params[1]-1;
if (id >= DBList.size() || DBList[id]->isFree)
{
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid connection %d", id);
return 0;
}
@ -146,8 +146,7 @@ static cell AMX_NATIVE_CALL sql_query(AMX *amx, cell *params) // 2 params
unsigned int id = params[1]-1;
if (id >= DBList.size() || DBList[id]->isFree) {
MF_Log("Invalid Database Handle %d", id);
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid Database Handle %d", id);
return -1;
}
@ -170,8 +169,7 @@ static cell AMX_NATIVE_CALL sql_nextrow(AMX *amx, cell *params) // 1 param
if (id >= Results.size() || Results[id]->isFree)
{
MF_Log("Invalid result handle %d", id);
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid result handle %d", id);
return 0;
}
@ -188,8 +186,7 @@ static cell AMX_NATIVE_CALL sql_close(AMX *amx, cell *params) // 1 param
{
unsigned int id = params[1]-1;
if (id >= DBList.size() || DBList[id]->isFree) {
MF_Log("Invalid Database Handle %d", id);
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid Database Handle %d", id);
return 0;
}
@ -210,8 +207,7 @@ static cell AMX_NATIVE_CALL sql_getfield(AMX *amx, cell *params) // 2-4 params
if (id >= Results.size() || Results[id]->isFree)
{
MF_Log("Invalid result handle %d", id);
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid result handle %d", id);
return 0;
}
@ -221,7 +217,7 @@ static cell AMX_NATIVE_CALL sql_getfield(AMX *amx, cell *params) // 2-4 params
const char *field = Result->GetField(id);
if (field == NULL)
{
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid column %d", id);
return 0;
}
@ -255,8 +251,7 @@ static cell AMX_NATIVE_CALL sql_getresult(AMX *amx, cell *params) // 4 params
if (id >= Results.size() || Results[id]->isFree)
{
MF_Log("Invalid result handle %d", id);
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid result handle %d", id);
return 0;
}
@ -268,7 +263,7 @@ static cell AMX_NATIVE_CALL sql_getresult(AMX *amx, cell *params) // 4 params
const char *field = Result->GetField(id);
if (field == NULL)
{
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid column \"%s\"", column);
return 0;
}
@ -298,8 +293,7 @@ static cell AMX_NATIVE_CALL sql_free_result(AMX *amx, cell *params)
if (id >= Results.size() || Results[id]->isFree)
{
MF_Log("Invalid result handle %d", id);
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid result handle %d", id);
return 0;
}
@ -316,8 +310,7 @@ static cell AMX_NATIVE_CALL sql_num_rows(AMX *amx, cell *params)
if (id >= Results.size() || Results[id]->isFree)
{
MF_Log("Invalid result handle %d", id);
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid result handle %d", id);
return 0;
}

View File

@ -45,6 +45,16 @@
enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable;
enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table =
{
@ -2114,6 +2124,7 @@ C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersi
return(FALSE);
}
memcpy(pFunctionTable, &g_EntityAPI_Table, sizeof(DLL_FUNCTIONS));
g_pFunctionTable=pFunctionTable;
return(TRUE);
}
@ -2131,7 +2142,7 @@ C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interface
return(FALSE);
}
memcpy( pFunctionTable, &g_EntityAPI_Post_Table, sizeof( DLL_FUNCTIONS ) );
g_pFunctionTable_Post=pFunctionTable;
return(TRUE);
}
@ -2154,6 +2165,7 @@ C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *inte
return(FALSE);
}
memcpy(pengfuncsFromEngine, &g_EngineFuncs_Table, sizeof(enginefuncs_t));
g_pengfuncsTable=pengfuncsFromEngine;
return TRUE;
}
@ -2171,6 +2183,7 @@ C_DLLEXPORT int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int
return(FALSE);
}
memcpy(pengfuncsFromEngine, &g_EngineFuncs_Post_Table, sizeof(enginefuncs_t));
g_pengfuncsTable_Post=pengfuncsFromEngine;
return TRUE;
}
@ -2195,6 +2208,7 @@ C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable,
return(FALSE);
}
memcpy(pNewFunctionTable, &g_NewFuncs_Table, sizeof(NEW_DLL_FUNCTIONS));
g_pNewFunctionsTable=pNewFunctionTable;
return TRUE;
}
@ -2212,6 +2226,7 @@ C_DLLEXPORT int GetNewDLLFunctions_Post( NEW_DLL_FUNCTIONS *pNewFunctionTable, i
return(FALSE);
}
memcpy(pNewFunctionTable, &g_NewFuncs_Post_Table, sizeof(NEW_DLL_FUNCTIONS));
g_pNewFunctionsTable_Post=pNewFunctionTable;
return TRUE;
}
@ -2439,11 +2454,14 @@ PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
PFN_LOG g_fn_Log;
PFN_LOG_ERROR g_fn_LogErrorFunc;
PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
PFN_REGISTER_FORWARD g_fn_RegisterForward;
PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray;
PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray;
PFN_PREPARE_CELLARRAY_A g_fn_PrepareCellArrayA;
PFN_PREPARE_CHARARRAY_A g_fn_PrepareCharArrayA;
PFN_IS_PLAYER_VALID g_fn_IsPlayerValid;
PFN_GET_PLAYER_NAME g_fn_GetPlayerName;
PFN_GET_PLAYER_IP g_fn_GetPlayerIP;
@ -2453,6 +2471,7 @@ PFN_IS_PLAYER_AUTHORIZED g_fn_IsPlayerAuthorized;
PFN_GET_PLAYER_TIME g_fn_GetPlayerTime;
PFN_GET_PLAYER_PLAYTIME g_fn_GetPlayerPlayTime;
PFN_GET_PLAYER_CURWEAPON g_fn_GetPlayerCurweapon;
PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
PFN_GET_PLAYER_TEAMID g_fn_GetPlayerTeamID;
PFN_GET_PLAYER_DEATHS g_fn_GetPlayerDeaths;
PFN_GET_PLAYER_MENU g_fn_GetPlayerMenu;
@ -2525,6 +2544,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
REQFUNC("Log", g_fn_Log, PFN_LOG);
REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR);
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
@ -2560,7 +2580,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("ExecuteForward", g_fn_ExecuteForward, PFN_EXECUTE_FORWARD);
REQFUNC("PrepareCellArray", g_fn_PrepareCellArray, PFN_PREPARE_CELLARRAY);
REQFUNC("PrepareCharArray", g_fn_PrepareCharArray, PFN_PREPARE_CHARARRAY);
REQFUNC("PrepareCellArrayA", g_fn_PrepareCellArrayA, PFN_PREPARE_CELLARRAY_A);
REQFUNC("PrepareCharArrayA", g_fn_PrepareCharArrayA, PFN_PREPARE_CHARARRAY_A);
// Player
REQFUNC("IsPlayerValid", g_fn_IsPlayerValid, PFN_IS_PLAYER_VALID);
REQFUNC("GetPlayerName", g_fn_GetPlayerName, PFN_GET_PLAYER_NAME);
@ -2572,6 +2593,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerPlayTime", g_fn_GetPlayerPlayTime, PFN_GET_PLAYER_PLAYTIME);
REQFUNC("GetPlayerCurweapon", g_fn_GetPlayerCurweapon, PFN_GET_PLAYER_CURWEAPON);
REQFUNC("GetPlayerTeamID", g_fn_GetPlayerTeamID, PFN_GET_PLAYER_TEAMID);
REQFUNC("GetPlayerTeam",g_fn_GetPlayerTeam, PFN_GET_PLAYER_TEAM);
REQFUNC("GetPlayerDeaths", g_fn_GetPlayerDeaths, PFN_GET_PLAYER_DEATHS);
REQFUNC("GetPlayerMenu", g_fn_GetPlayerMenu, PFN_GET_PLAYER_MENU);
REQFUNC("GetPlayerKeys", g_fn_GetPlayerKeys, PFN_GET_PLAYER_KEYS);
@ -2629,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
g_fn_Log("[%s] %s", MODULE_NAME, msg);
}
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
{
// :TODO: Overflow possible here
char msg[3072];
va_list arglst;
va_start(arglst, fmt);
vsprintf(msg, fmt, arglst);
va_end(arglst);
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
}
#ifdef _DEBUG
// validate macros
@ -2649,11 +2683,14 @@ void ValidateMacros_DontCallThis_Smiley()
MF_GetAmxStringLen(NULL);
MF_CopyAmxMemory(NULL, NULL, 0);
MF_Log("str", "str", 0);
MF_LogError(NULL, 0, NULL);
MF_RaiseAmxError(NULL, 0);
MF_RegisterForward("str", (ForwardExecType)0, 0, 0, 0);
MF_ExecuteForward(0, 0, 0);
MF_PrepareCellArray(NULL, 0);
MF_PrepareCharArray(NULL, 0);
MF_PrepareCellArrayA(NULL, 0, true);
MF_PrepareCharArrayA(NULL, 0, true);
MF_IsPlayerValid(0);
MF_GetPlayerName(0);
MF_GetPlayerIP(0);
@ -2664,6 +2701,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_GetPlayerPlayTime(0);
MF_GetPlayerCurweapon(0);
MF_GetPlayerTeamID(0);
MF_GetPlayerTeam(0);
MF_GetPlayerDeaths(0);
MF_GetPlayerMenu(0);
MF_GetPlayerKeys(0);

View File

@ -55,7 +55,7 @@ struct amxx_module_info_s
// The next section is copied from the amx.h file
// Copyright (c) ITB CompuPhase, 1997-2004
#if defined __LCC__ || defined __DMC__ || defined __linux__
#if defined __LCC__ || defined __DMC__ || defined __linux__ || defined __GNUC__
#include <stdint.h>
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
/* The ISO C99 defines the int16_t and int_32t types. If the compiler got
@ -929,7 +929,7 @@ void FN_EngineFprintf(FILE *pfile, char *szFmt, ...);
#endif // FN_EngineFprintf
#ifdef FN_PvAllocEntPrivateData
void *FN_PvAllocEntPrivateData(edict_t *pEdict, long cb);
void *FN_PvAllocEntPrivateData(edict_t *pEdict, int32 cb);
#endif // FN_PvAllocEntPrivateData
#ifdef FN_PvEntPrivateData
@ -1919,11 +1919,14 @@ typedef int (*PFN_GET_AMXSTRINGLEN) (const cell *ptr);
typedef char * (*PFN_FORMAT_AMXSTRING) (AMX * /*amx*/, cell * /*params*/, int /*startParam*/, int * /*pLen*/);
typedef void (*PFN_COPY_AMXMEMORY) (cell * /*dest*/, const cell * /*src*/, int /*len*/);
typedef void (*PFN_LOG) (const char * /*fmt*/, ...);
typedef void (*PFN_LOG_ERROR) (AMX * /*amx*/, int /*err*/, const char * /*fmt*/, ...);
typedef int (*PFN_RAISE_AMXERROR) (AMX * /*amx*/, int /*error*/);
typedef int (*PFN_REGISTER_FORWARD) (const char * /*funcname*/, ForwardExecType /*exectype*/, ... /*paramtypes terminated by PF_DONE*/);
typedef int (*PFN_EXECUTE_FORWARD) (int /*id*/, ... /*params*/);
typedef cell (*PFN_PREPARE_CELLARRAY) (cell * /*ptr*/, unsigned int /*size*/);
typedef cell (*PFN_PREPARE_CHARARRAY) (char * /*ptr*/, unsigned int /*size*/);
typedef cell (*PFN_PREPARE_CELLARRAY_A) (cell * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/);
typedef cell (*PFN_PREPARE_CHARARRAY_A) (char * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/);
typedef int (*PFN_IS_PLAYER_VALID) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_NAME) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_IP) (int /*id*/);
@ -1932,8 +1935,9 @@ typedef int (*PFN_IS_PLAYER_BOT) (int /*id*/);
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_TEAM) (int /*id*/);
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
typedef int (*PFN_GET_PLAYER_MENU) (int /*id*/);
@ -1986,11 +1990,14 @@ extern PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
extern PFN_LOG g_fn_Log;
extern PFN_LOG_ERROR g_fn_LogErrorFunc;
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
extern PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray;
extern PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray;
extern PFN_PREPARE_CELLARRAY_A g_fn_PrepareCellArrayA;
extern PFN_PREPARE_CHARARRAY_A g_fn_PrepareCharArrayA;
extern PFN_IS_PLAYER_VALID g_fn_IsPlayerValid;
extern PFN_GET_PLAYER_NAME g_fn_GetPlayerName;
extern PFN_GET_PLAYER_IP g_fn_GetPlayerIP;
@ -2026,6 +2033,7 @@ extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
extern PFN_FORMAT g_fn_Format;
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
#ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems
@ -2045,11 +2053,14 @@ int MF_GetAmxStringLen (const cell *ptr) { }
char * MF_FormatAmxString (AMX * amx, cell * params, int startParam, int * pLen) { }
void MF_CopyAmxMemory (cell * dest, const cell * src, int len) { }
void MF_Log (const char * fmt, ...) { }
void MF_LogError (AMX * amx, int err, const char *fmt, ...) { }
int MF_RaiseAmxError (AMX * amx, int error) { }
int MF_RegisterForward (const char * funcname, ForwardExecType exectype, ...) { }
int MF_ExecuteForward (int id, ...) { }
cell MF_PrepareCellArray (cell * ptr, unsigned int size) { }
cell MF_PrepareCharArray (char * ptr, unsigned int size) { }
cell MF_PrepareCellArrayA (cell * ptr, unsigned int size, bool copyBack) { }
cell MF_PrepareCharArrayA (char * ptr, unsigned int size, bool copyBack) { }
int MF_IsPlayerValid (int id) { }
const char * MF_GetPlayerName (int id) { }
const char * MF_GetPlayerIP (int id) { }
@ -2059,6 +2070,7 @@ int MF_IsPlayerAuthorized (int id) { }
float MF_GetPlayerTime (int id) { }
float MF_GetPlayerPlayTime (int id) { }
int MF_GetPlayerCurweapon (int id) { }
const char * MF_GetPlayerTeam (int id) { }
int MF_GetPlayerTeamID (int id) { }
int MF_GetPlayerDeaths (int id) { }
int MF_GetPlayerMenu (int id) { }
@ -2094,11 +2106,14 @@ const char * MF_Format (const char *fmt, ...) { }
#define MF_GetAmxStringLen g_fn_GetAmxStringLen
#define MF_CopyAmxMemory g_fn_CopyAmxMemory
void MF_Log(const char *fmt, ...);
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_RaiseAmxError g_fn_RaiseAmxError
#define MF_RegisterForward g_fn_RegisterForward
#define MF_ExecuteForward g_fn_ExecuteForward
#define MF_PrepareCellArray g_fn_PrepareCellArray
#define MF_PrepareCharArray g_fn_PrepareCharArray
#define MF_PrepareCellArrayA g_fn_PrepareCellArrayA
#define MF_PrepareCharArrayA g_fn_PrepareCharArrayA
#define MF_IsPlayerValid g_fn_IsPlayerValid
#define MF_GetPlayerName g_fn_GetPlayerName
#define MF_GetPlayerIP g_fn_GetPlayerIP
@ -2108,6 +2123,7 @@ void MF_Log(const char *fmt, ...);
#define MF_GetPlayerTime g_fn_GetPlayerTime
#define MF_GetPlayerPlayTime g_fn_GetPlayerPlayTime
#define MF_GetPlayerCurweapon g_fn_GetPlayerCurweapon
#define MF_GetPlayerTeam g_fn_GetPlayerTeam
#define MF_GetPlayerTeamID g_fn_GetPlayerTeamID
#define MF_GetPlayerDeaths g_fn_GetPlayerDeaths
#define MF_GetPlayerMenu g_fn_GetPlayerMenu
@ -2133,7 +2149,7 @@ void MF_Log(const char *fmt, ...);
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
#define MF_GetPlayerEdict g_fn_GetPlayerEdict
#define MF_Format g_fn_Format;
#define MF_Format g_fn_Format
/*** Memory ***/
void *operator new(size_t reportedSize);

View File

@ -215,7 +215,7 @@ static cell AMX_NATIVE_CALL sql_getfield(AMX *amx, cell *params) // 2-4 params
const char *field = Result->GetField(params[2]-1);
if (field == NULL)
{
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid column %d", params[2]);
return 0;
}
@ -261,7 +261,7 @@ static cell AMX_NATIVE_CALL sql_getresult(AMX *amx, cell *params) // 4 params
const char *field = Result->GetField(column);
if (field == NULL)
{
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid column \"%s\"", field);
return 0;
}
@ -317,8 +317,7 @@ static cell AMX_NATIVE_CALL sql_num_rows(AMX *amx, cell *params)
if (id >= Results.size() || Results[id]->isFree)
{
MF_Log("Invalid result handle %d", id);
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid result handle %d", id);
return 0;
}

View File

@ -45,6 +45,16 @@
enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable;
enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table =
{
@ -2114,6 +2124,7 @@ C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersi
return(FALSE);
}
memcpy(pFunctionTable, &g_EntityAPI_Table, sizeof(DLL_FUNCTIONS));
g_pFunctionTable=pFunctionTable;
return(TRUE);
}
@ -2131,7 +2142,7 @@ C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interface
return(FALSE);
}
memcpy( pFunctionTable, &g_EntityAPI_Post_Table, sizeof( DLL_FUNCTIONS ) );
g_pFunctionTable_Post=pFunctionTable;
return(TRUE);
}
@ -2154,6 +2165,7 @@ C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *inte
return(FALSE);
}
memcpy(pengfuncsFromEngine, &g_EngineFuncs_Table, sizeof(enginefuncs_t));
g_pengfuncsTable=pengfuncsFromEngine;
return TRUE;
}
@ -2171,6 +2183,7 @@ C_DLLEXPORT int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int
return(FALSE);
}
memcpy(pengfuncsFromEngine, &g_EngineFuncs_Post_Table, sizeof(enginefuncs_t));
g_pengfuncsTable_Post=pengfuncsFromEngine;
return TRUE;
}
@ -2195,6 +2208,7 @@ C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable,
return(FALSE);
}
memcpy(pNewFunctionTable, &g_NewFuncs_Table, sizeof(NEW_DLL_FUNCTIONS));
g_pNewFunctionsTable=pNewFunctionTable;
return TRUE;
}
@ -2212,6 +2226,7 @@ C_DLLEXPORT int GetNewDLLFunctions_Post( NEW_DLL_FUNCTIONS *pNewFunctionTable, i
return(FALSE);
}
memcpy(pNewFunctionTable, &g_NewFuncs_Post_Table, sizeof(NEW_DLL_FUNCTIONS));
g_pNewFunctionsTable_Post=pNewFunctionTable;
return TRUE;
}
@ -2439,11 +2454,14 @@ PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
PFN_LOG g_fn_Log;
PFN_LOG_ERROR g_fn_LogErrorFunc;
PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
PFN_REGISTER_FORWARD g_fn_RegisterForward;
PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray;
PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray;
PFN_PREPARE_CELLARRAY_A g_fn_PrepareCellArrayA;
PFN_PREPARE_CHARARRAY_A g_fn_PrepareCharArrayA;
PFN_IS_PLAYER_VALID g_fn_IsPlayerValid;
PFN_GET_PLAYER_NAME g_fn_GetPlayerName;
PFN_GET_PLAYER_IP g_fn_GetPlayerIP;
@ -2453,6 +2471,7 @@ PFN_IS_PLAYER_AUTHORIZED g_fn_IsPlayerAuthorized;
PFN_GET_PLAYER_TIME g_fn_GetPlayerTime;
PFN_GET_PLAYER_PLAYTIME g_fn_GetPlayerPlayTime;
PFN_GET_PLAYER_CURWEAPON g_fn_GetPlayerCurweapon;
PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
PFN_GET_PLAYER_TEAMID g_fn_GetPlayerTeamID;
PFN_GET_PLAYER_DEATHS g_fn_GetPlayerDeaths;
PFN_GET_PLAYER_MENU g_fn_GetPlayerMenu;
@ -2525,6 +2544,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
REQFUNC("Log", g_fn_Log, PFN_LOG);
REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR);
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
@ -2560,7 +2580,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("ExecuteForward", g_fn_ExecuteForward, PFN_EXECUTE_FORWARD);
REQFUNC("PrepareCellArray", g_fn_PrepareCellArray, PFN_PREPARE_CELLARRAY);
REQFUNC("PrepareCharArray", g_fn_PrepareCharArray, PFN_PREPARE_CHARARRAY);
REQFUNC("PrepareCellArrayA", g_fn_PrepareCellArrayA, PFN_PREPARE_CELLARRAY_A);
REQFUNC("PrepareCharArrayA", g_fn_PrepareCharArrayA, PFN_PREPARE_CHARARRAY_A);
// Player
REQFUNC("IsPlayerValid", g_fn_IsPlayerValid, PFN_IS_PLAYER_VALID);
REQFUNC("GetPlayerName", g_fn_GetPlayerName, PFN_GET_PLAYER_NAME);
@ -2572,6 +2593,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerPlayTime", g_fn_GetPlayerPlayTime, PFN_GET_PLAYER_PLAYTIME);
REQFUNC("GetPlayerCurweapon", g_fn_GetPlayerCurweapon, PFN_GET_PLAYER_CURWEAPON);
REQFUNC("GetPlayerTeamID", g_fn_GetPlayerTeamID, PFN_GET_PLAYER_TEAMID);
REQFUNC("GetPlayerTeam",g_fn_GetPlayerTeam, PFN_GET_PLAYER_TEAM);
REQFUNC("GetPlayerDeaths", g_fn_GetPlayerDeaths, PFN_GET_PLAYER_DEATHS);
REQFUNC("GetPlayerMenu", g_fn_GetPlayerMenu, PFN_GET_PLAYER_MENU);
REQFUNC("GetPlayerKeys", g_fn_GetPlayerKeys, PFN_GET_PLAYER_KEYS);
@ -2629,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
g_fn_Log("[%s] %s", MODULE_NAME, msg);
}
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
{
// :TODO: Overflow possible here
char msg[3072];
va_list arglst;
va_start(arglst, fmt);
vsprintf(msg, fmt, arglst);
va_end(arglst);
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
}
#ifdef _DEBUG
// validate macros
@ -2649,11 +2683,14 @@ void ValidateMacros_DontCallThis_Smiley()
MF_GetAmxStringLen(NULL);
MF_CopyAmxMemory(NULL, NULL, 0);
MF_Log("str", "str", 0);
MF_LogError(NULL, 0, NULL);
MF_RaiseAmxError(NULL, 0);
MF_RegisterForward("str", (ForwardExecType)0, 0, 0, 0);
MF_ExecuteForward(0, 0, 0);
MF_PrepareCellArray(NULL, 0);
MF_PrepareCharArray(NULL, 0);
MF_PrepareCellArrayA(NULL, 0, true);
MF_PrepareCharArrayA(NULL, 0, true);
MF_IsPlayerValid(0);
MF_GetPlayerName(0);
MF_GetPlayerIP(0);
@ -2664,6 +2701,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_GetPlayerPlayTime(0);
MF_GetPlayerCurweapon(0);
MF_GetPlayerTeamID(0);
MF_GetPlayerTeam(0);
MF_GetPlayerDeaths(0);
MF_GetPlayerMenu(0);
MF_GetPlayerKeys(0);

View File

@ -55,7 +55,7 @@ struct amxx_module_info_s
// The next section is copied from the amx.h file
// Copyright (c) ITB CompuPhase, 1997-2004
#if defined __LCC__ || defined __DMC__ || defined __linux__
#if defined __LCC__ || defined __DMC__ || defined __linux__ || defined __GNUC__
#include <stdint.h>
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
/* The ISO C99 defines the int16_t and int_32t types. If the compiler got
@ -929,7 +929,7 @@ void FN_EngineFprintf(FILE *pfile, char *szFmt, ...);
#endif // FN_EngineFprintf
#ifdef FN_PvAllocEntPrivateData
void *FN_PvAllocEntPrivateData(edict_t *pEdict, long cb);
void *FN_PvAllocEntPrivateData(edict_t *pEdict, int32 cb);
#endif // FN_PvAllocEntPrivateData
#ifdef FN_PvEntPrivateData
@ -1919,11 +1919,14 @@ typedef int (*PFN_GET_AMXSTRINGLEN) (const cell *ptr);
typedef char * (*PFN_FORMAT_AMXSTRING) (AMX * /*amx*/, cell * /*params*/, int /*startParam*/, int * /*pLen*/);
typedef void (*PFN_COPY_AMXMEMORY) (cell * /*dest*/, const cell * /*src*/, int /*len*/);
typedef void (*PFN_LOG) (const char * /*fmt*/, ...);
typedef void (*PFN_LOG_ERROR) (AMX * /*amx*/, int /*err*/, const char * /*fmt*/, ...);
typedef int (*PFN_RAISE_AMXERROR) (AMX * /*amx*/, int /*error*/);
typedef int (*PFN_REGISTER_FORWARD) (const char * /*funcname*/, ForwardExecType /*exectype*/, ... /*paramtypes terminated by PF_DONE*/);
typedef int (*PFN_EXECUTE_FORWARD) (int /*id*/, ... /*params*/);
typedef cell (*PFN_PREPARE_CELLARRAY) (cell * /*ptr*/, unsigned int /*size*/);
typedef cell (*PFN_PREPARE_CHARARRAY) (char * /*ptr*/, unsigned int /*size*/);
typedef cell (*PFN_PREPARE_CELLARRAY_A) (cell * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/);
typedef cell (*PFN_PREPARE_CHARARRAY_A) (char * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/);
typedef int (*PFN_IS_PLAYER_VALID) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_NAME) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_IP) (int /*id*/);
@ -1932,8 +1935,9 @@ typedef int (*PFN_IS_PLAYER_BOT) (int /*id*/);
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_TEAM) (int /*id*/);
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
typedef int (*PFN_GET_PLAYER_MENU) (int /*id*/);
@ -1986,11 +1990,14 @@ extern PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
extern PFN_LOG g_fn_Log;
extern PFN_LOG_ERROR g_fn_LogErrorFunc;
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
extern PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray;
extern PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray;
extern PFN_PREPARE_CELLARRAY_A g_fn_PrepareCellArrayA;
extern PFN_PREPARE_CHARARRAY_A g_fn_PrepareCharArrayA;
extern PFN_IS_PLAYER_VALID g_fn_IsPlayerValid;
extern PFN_GET_PLAYER_NAME g_fn_GetPlayerName;
extern PFN_GET_PLAYER_IP g_fn_GetPlayerIP;
@ -2026,6 +2033,7 @@ extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
extern PFN_FORMAT g_fn_Format;
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
#ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems
@ -2045,11 +2053,14 @@ int MF_GetAmxStringLen (const cell *ptr) { }
char * MF_FormatAmxString (AMX * amx, cell * params, int startParam, int * pLen) { }
void MF_CopyAmxMemory (cell * dest, const cell * src, int len) { }
void MF_Log (const char * fmt, ...) { }
void MF_LogError (AMX * amx, int err, const char *fmt, ...) { }
int MF_RaiseAmxError (AMX * amx, int error) { }
int MF_RegisterForward (const char * funcname, ForwardExecType exectype, ...) { }
int MF_ExecuteForward (int id, ...) { }
cell MF_PrepareCellArray (cell * ptr, unsigned int size) { }
cell MF_PrepareCharArray (char * ptr, unsigned int size) { }
cell MF_PrepareCellArrayA (cell * ptr, unsigned int size, bool copyBack) { }
cell MF_PrepareCharArrayA (char * ptr, unsigned int size, bool copyBack) { }
int MF_IsPlayerValid (int id) { }
const char * MF_GetPlayerName (int id) { }
const char * MF_GetPlayerIP (int id) { }
@ -2059,6 +2070,7 @@ int MF_IsPlayerAuthorized (int id) { }
float MF_GetPlayerTime (int id) { }
float MF_GetPlayerPlayTime (int id) { }
int MF_GetPlayerCurweapon (int id) { }
const char * MF_GetPlayerTeam (int id) { }
int MF_GetPlayerTeamID (int id) { }
int MF_GetPlayerDeaths (int id) { }
int MF_GetPlayerMenu (int id) { }
@ -2094,11 +2106,14 @@ const char * MF_Format (const char *fmt, ...) { }
#define MF_GetAmxStringLen g_fn_GetAmxStringLen
#define MF_CopyAmxMemory g_fn_CopyAmxMemory
void MF_Log(const char *fmt, ...);
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_RaiseAmxError g_fn_RaiseAmxError
#define MF_RegisterForward g_fn_RegisterForward
#define MF_ExecuteForward g_fn_ExecuteForward
#define MF_PrepareCellArray g_fn_PrepareCellArray
#define MF_PrepareCharArray g_fn_PrepareCharArray
#define MF_PrepareCellArrayA g_fn_PrepareCellArrayA
#define MF_PrepareCharArrayA g_fn_PrepareCharArrayA
#define MF_IsPlayerValid g_fn_IsPlayerValid
#define MF_GetPlayerName g_fn_GetPlayerName
#define MF_GetPlayerIP g_fn_GetPlayerIP
@ -2108,6 +2123,7 @@ void MF_Log(const char *fmt, ...);
#define MF_GetPlayerTime g_fn_GetPlayerTime
#define MF_GetPlayerPlayTime g_fn_GetPlayerPlayTime
#define MF_GetPlayerCurweapon g_fn_GetPlayerCurweapon
#define MF_GetPlayerTeam g_fn_GetPlayerTeam
#define MF_GetPlayerTeamID g_fn_GetPlayerTeamID
#define MF_GetPlayerDeaths g_fn_GetPlayerDeaths
#define MF_GetPlayerMenu g_fn_GetPlayerMenu
@ -2133,7 +2149,7 @@ void MF_Log(const char *fmt, ...);
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
#define MF_GetPlayerEdict g_fn_GetPlayerEdict
#define MF_Format g_fn_Format;
#define MF_Format g_fn_Format
/*** Memory ***/
void *operator new(size_t reportedSize);