diff --git a/dlls/csx/source/amxxmodule.cpp b/dlls/csx/source/amxxmodule.cpp index c38a396b..9dfe57be 100755 --- a/dlls/csx/source/amxxmodule.cpp +++ b/dlls/csx/source/amxxmodule.cpp @@ -45,8 +45,6 @@ enginefuncs_t g_engfuncs; globalvars_t *gpGlobals; - - DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable_Post; enginefuncs_t *g_pengfuncsTable; @@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; - // GetEntityAPI2 functions static DLL_FUNCTIONS g_EntityAPI_Table = { @@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; +#ifdef MEMORY_TEST PFN_ALLOCATOR g_fn_Allocator; PFN_REALLOCATOR g_fn_Reallocator; PFN_DEALLOCATOR g_fn_Deallocator; +#endif PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_ALLOT g_fn_AmxAllot; @@ -2613,10 +2612,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); +#ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); +#endif REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); @@ -2735,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2906,6 +2909,8 @@ 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 diff --git a/dlls/csx/source/amxxmodule.h b/dlls/csx/source/amxxmodule.h index baf6d259..0a000d20 100755 --- a/dlls/csx/source/amxxmodule.h +++ b/dlls/csx/source/amxxmodule.h @@ -46,8 +46,6 @@ struct amxx_module_info_s const char *logtag; // added in version 2 }; - - // return values from functions called by amxx #define AMXX_OK 0 /* no error */ #define AMXX_IFVERS 1 /* interface version */ @@ -1981,12 +1979,14 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); #endif +#ifdef MEMORY_TEST 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*/, const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const void* /*addr*/ ); +#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); @@ -2048,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_AMX_EXEC g_fn_AmxExec; -extern PFN_AMX_EXECV g_fn_AmxExecv; extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; @@ -2193,6 +2192,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_RequestFunction g_fn_RequestFunction; #define MF_AmxPush g_fn_AmxPush +#ifdef MEMORY_TEST /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2236,4 +2236,6 @@ 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__ diff --git a/dlls/csx/source/msvc/csx.vcproj b/dlls/csx/source/msvc/csx.vcproj index 728d60ee..28e27ca5 100755 --- a/dlls/csx/source/msvc/csx.vcproj +++ b/dlls/csx/source/msvc/csx.vcproj @@ -26,9 +26,9 @@ AdditionalIncludeDirectories="..\..\metamod,..\..\sdk\common,..\..\sdk\engine,..\..\sdk\dlls" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;csx_EXPORTS;JIT" StringPooling="TRUE" - RuntimeLibrary="0" - StructMemberAlignment="3" - EnableFunctionLevelLinking="TRUE" + RuntimeLibrary="4" + StructMemberAlignment="0" + EnableFunctionLevelLinking="FALSE" UsePrecompiledHeader="2" PrecompiledHeaderFile=".\release/csx.pch" AssemblerListingLocation=".\release/" @@ -91,7 +91,7 @@ AdditionalIncludeDirectories="..\..\metamod,..\..\sdk\common,..\..\sdk\engine,..\..\sdk\dlls,..\..\hlsdk\sourcecode\pm_shared" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;csx_EXPORTS" BasicRuntimeChecks="3" - RuntimeLibrary="1" + RuntimeLibrary="5" UsePrecompiledHeader="2" PrecompiledHeaderFile=".\debug/csx.pch" AssemblerListingLocation=".\debug/" diff --git a/dlls/dod2/dodfun/amxxmodule.cpp b/dlls/dod2/dodfun/amxxmodule.cpp index aa649e2b..9dfe57be 100755 --- a/dlls/dod2/dodfun/amxxmodule.cpp +++ b/dlls/dod2/dodfun/amxxmodule.cpp @@ -45,8 +45,6 @@ enginefuncs_t g_engfuncs; globalvars_t *gpGlobals; - - DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable_Post; enginefuncs_t *g_pengfuncsTable; @@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; - // GetEntityAPI2 functions static DLL_FUNCTIONS g_EntityAPI_Table = { @@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; +#ifdef MEMORY_TEST PFN_ALLOCATOR g_fn_Allocator; PFN_REALLOCATOR g_fn_Reallocator; PFN_DEALLOCATOR g_fn_Deallocator; +#endif PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_ALLOT g_fn_AmxAllot; @@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REQ_FNPTR g_fn_RequestFunction; +PFN_AMX_PUSH g_fn_AmxPush; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) 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); + REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); +#ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); +#endif REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); @@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_IsPlayerHLTV(0); MF_GetPlayerArmor(0); MF_GetPlayerHealth(0); - MF_AmxExec(0, 0, 0, 0); + MF_AmxExec(0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); @@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2904,6 +2909,8 @@ 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 diff --git a/dlls/dod2/dodfun/amxxmodule.h b/dlls/dod2/dodfun/amxxmodule.h index bbaec2f5..0a000d20 100755 --- a/dlls/dod2/dodfun/amxxmodule.h +++ b/dlls/dod2/dodfun/amxxmodule.h @@ -46,8 +46,6 @@ struct amxx_module_info_s const char *logtag; // added in version 2 }; - - // return values from functions called by amxx #define AMXX_OK 0 /* no error */ #define AMXX_IFVERS 1 /* interface version */ @@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); #endif +#ifdef MEMORY_TEST 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*/, const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const void* /*addr*/ ); -typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/); +#endif +typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); @@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); +typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_AMX_EXEC g_fn_AmxExec; -extern PFN_AMX_EXECV g_fn_AmxExecv; extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; @@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction; +extern PFN_AMX_PUSH g_fn_AmxPush; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { } const char * MF_Format (const char *fmt, ...) { } void MF_RegisterFunction (void *pfn, const char *description) { } void * MF_RequestFunction (const char *description) { } +int MF_AmxPush (AMX *amx, cell *params) { } +int MF_AmxExec (AMX *amx, cell *retval, int idx) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_Format g_fn_Format #define MF_RegisterFunction g_fn_RegisterFunction #define MF_RequestFunction g_fn_RequestFunction; +#define MF_AmxPush g_fn_AmxPush +#ifdef MEMORY_TEST /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2231,4 +2236,6 @@ 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__ diff --git a/dlls/dod2/dodx/amxxmodule.cpp b/dlls/dod2/dodx/amxxmodule.cpp index c38a396b..9dfe57be 100755 --- a/dlls/dod2/dodx/amxxmodule.cpp +++ b/dlls/dod2/dodx/amxxmodule.cpp @@ -45,8 +45,6 @@ enginefuncs_t g_engfuncs; globalvars_t *gpGlobals; - - DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable_Post; enginefuncs_t *g_pengfuncsTable; @@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; - // GetEntityAPI2 functions static DLL_FUNCTIONS g_EntityAPI_Table = { @@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; +#ifdef MEMORY_TEST PFN_ALLOCATOR g_fn_Allocator; PFN_REALLOCATOR g_fn_Reallocator; PFN_DEALLOCATOR g_fn_Deallocator; +#endif PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_ALLOT g_fn_AmxAllot; @@ -2613,10 +2612,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); +#ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); +#endif REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); @@ -2735,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2906,6 +2909,8 @@ 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 diff --git a/dlls/dod2/dodx/amxxmodule.h b/dlls/dod2/dodx/amxxmodule.h index baf6d259..0a000d20 100755 --- a/dlls/dod2/dodx/amxxmodule.h +++ b/dlls/dod2/dodx/amxxmodule.h @@ -46,8 +46,6 @@ struct amxx_module_info_s const char *logtag; // added in version 2 }; - - // return values from functions called by amxx #define AMXX_OK 0 /* no error */ #define AMXX_IFVERS 1 /* interface version */ @@ -1981,12 +1979,14 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); #endif +#ifdef MEMORY_TEST 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*/, const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const void* /*addr*/ ); +#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); @@ -2048,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_AMX_EXEC g_fn_AmxExec; -extern PFN_AMX_EXECV g_fn_AmxExecv; extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; @@ -2193,6 +2192,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_RequestFunction g_fn_RequestFunction; #define MF_AmxPush g_fn_AmxPush +#ifdef MEMORY_TEST /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2236,4 +2236,6 @@ 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__ diff --git a/dlls/fakemeta/sdk/amxxmodule.cpp b/dlls/fakemeta/sdk/amxxmodule.cpp index aa649e2b..9dfe57be 100755 --- a/dlls/fakemeta/sdk/amxxmodule.cpp +++ b/dlls/fakemeta/sdk/amxxmodule.cpp @@ -45,8 +45,6 @@ enginefuncs_t g_engfuncs; globalvars_t *gpGlobals; - - DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable_Post; enginefuncs_t *g_pengfuncsTable; @@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; - // GetEntityAPI2 functions static DLL_FUNCTIONS g_EntityAPI_Table = { @@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; +#ifdef MEMORY_TEST PFN_ALLOCATOR g_fn_Allocator; PFN_REALLOCATOR g_fn_Reallocator; PFN_DEALLOCATOR g_fn_Deallocator; +#endif PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_ALLOT g_fn_AmxAllot; @@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REQ_FNPTR g_fn_RequestFunction; +PFN_AMX_PUSH g_fn_AmxPush; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) 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); + REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); +#ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); +#endif REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); @@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_IsPlayerHLTV(0); MF_GetPlayerArmor(0); MF_GetPlayerHealth(0); - MF_AmxExec(0, 0, 0, 0); + MF_AmxExec(0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); @@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2904,6 +2909,8 @@ 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 diff --git a/dlls/fakemeta/sdk/amxxmodule.h b/dlls/fakemeta/sdk/amxxmodule.h index bbaec2f5..0a000d20 100755 --- a/dlls/fakemeta/sdk/amxxmodule.h +++ b/dlls/fakemeta/sdk/amxxmodule.h @@ -46,8 +46,6 @@ struct amxx_module_info_s const char *logtag; // added in version 2 }; - - // return values from functions called by amxx #define AMXX_OK 0 /* no error */ #define AMXX_IFVERS 1 /* interface version */ @@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); #endif +#ifdef MEMORY_TEST 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*/, const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const void* /*addr*/ ); -typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/); +#endif +typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); @@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); +typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_AMX_EXEC g_fn_AmxExec; -extern PFN_AMX_EXECV g_fn_AmxExecv; extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; @@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction; +extern PFN_AMX_PUSH g_fn_AmxPush; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { } const char * MF_Format (const char *fmt, ...) { } void MF_RegisterFunction (void *pfn, const char *description) { } void * MF_RequestFunction (const char *description) { } +int MF_AmxPush (AMX *amx, cell *params) { } +int MF_AmxExec (AMX *amx, cell *retval, int idx) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_Format g_fn_Format #define MF_RegisterFunction g_fn_RegisterFunction #define MF_RequestFunction g_fn_RequestFunction; +#define MF_AmxPush g_fn_AmxPush +#ifdef MEMORY_TEST /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2231,4 +2236,6 @@ 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__ diff --git a/dlls/geoip/amxxmodule.cpp b/dlls/geoip/amxxmodule.cpp index aa649e2b..9dfe57be 100755 --- a/dlls/geoip/amxxmodule.cpp +++ b/dlls/geoip/amxxmodule.cpp @@ -45,8 +45,6 @@ enginefuncs_t g_engfuncs; globalvars_t *gpGlobals; - - DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable_Post; enginefuncs_t *g_pengfuncsTable; @@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; - // GetEntityAPI2 functions static DLL_FUNCTIONS g_EntityAPI_Table = { @@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; +#ifdef MEMORY_TEST PFN_ALLOCATOR g_fn_Allocator; PFN_REALLOCATOR g_fn_Reallocator; PFN_DEALLOCATOR g_fn_Deallocator; +#endif PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_ALLOT g_fn_AmxAllot; @@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REQ_FNPTR g_fn_RequestFunction; +PFN_AMX_PUSH g_fn_AmxPush; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) 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); + REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); +#ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); +#endif REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); @@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_IsPlayerHLTV(0); MF_GetPlayerArmor(0); MF_GetPlayerHealth(0); - MF_AmxExec(0, 0, 0, 0); + MF_AmxExec(0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); @@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2904,6 +2909,8 @@ 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 diff --git a/dlls/geoip/amxxmodule.h b/dlls/geoip/amxxmodule.h index bbaec2f5..0a000d20 100755 --- a/dlls/geoip/amxxmodule.h +++ b/dlls/geoip/amxxmodule.h @@ -46,8 +46,6 @@ struct amxx_module_info_s const char *logtag; // added in version 2 }; - - // return values from functions called by amxx #define AMXX_OK 0 /* no error */ #define AMXX_IFVERS 1 /* interface version */ @@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); #endif +#ifdef MEMORY_TEST 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*/, const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const void* /*addr*/ ); -typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/); +#endif +typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); @@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); +typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_AMX_EXEC g_fn_AmxExec; -extern PFN_AMX_EXECV g_fn_AmxExecv; extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; @@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction; +extern PFN_AMX_PUSH g_fn_AmxPush; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { } const char * MF_Format (const char *fmt, ...) { } void MF_RegisterFunction (void *pfn, const char *description) { } void * MF_RequestFunction (const char *description) { } +int MF_AmxPush (AMX *amx, cell *params) { } +int MF_AmxExec (AMX *amx, cell *retval, int idx) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_Format g_fn_Format #define MF_RegisterFunction g_fn_RegisterFunction #define MF_RequestFunction g_fn_RequestFunction; +#define MF_AmxPush g_fn_AmxPush +#ifdef MEMORY_TEST /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2231,4 +2236,6 @@ 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__ diff --git a/dlls/ns/ns/amxxmodule.cpp b/dlls/ns/ns/amxxmodule.cpp index aa649e2b..9dfe57be 100755 --- a/dlls/ns/ns/amxxmodule.cpp +++ b/dlls/ns/ns/amxxmodule.cpp @@ -45,8 +45,6 @@ enginefuncs_t g_engfuncs; globalvars_t *gpGlobals; - - DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable_Post; enginefuncs_t *g_pengfuncsTable; @@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; - // GetEntityAPI2 functions static DLL_FUNCTIONS g_EntityAPI_Table = { @@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; +#ifdef MEMORY_TEST PFN_ALLOCATOR g_fn_Allocator; PFN_REALLOCATOR g_fn_Reallocator; PFN_DEALLOCATOR g_fn_Deallocator; +#endif PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_ALLOT g_fn_AmxAllot; @@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REQ_FNPTR g_fn_RequestFunction; +PFN_AMX_PUSH g_fn_AmxPush; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) 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); + REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); +#ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); +#endif REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); @@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_IsPlayerHLTV(0); MF_GetPlayerArmor(0); MF_GetPlayerHealth(0); - MF_AmxExec(0, 0, 0, 0); + MF_AmxExec(0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); @@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2904,6 +2909,8 @@ 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 diff --git a/dlls/ns/ns/amxxmodule.h b/dlls/ns/ns/amxxmodule.h index bbaec2f5..0a000d20 100755 --- a/dlls/ns/ns/amxxmodule.h +++ b/dlls/ns/ns/amxxmodule.h @@ -46,8 +46,6 @@ struct amxx_module_info_s const char *logtag; // added in version 2 }; - - // return values from functions called by amxx #define AMXX_OK 0 /* no error */ #define AMXX_IFVERS 1 /* interface version */ @@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); #endif +#ifdef MEMORY_TEST 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*/, const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const void* /*addr*/ ); -typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/); +#endif +typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); @@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); +typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_AMX_EXEC g_fn_AmxExec; -extern PFN_AMX_EXECV g_fn_AmxExecv; extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; @@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction; +extern PFN_AMX_PUSH g_fn_AmxPush; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { } const char * MF_Format (const char *fmt, ...) { } void MF_RegisterFunction (void *pfn, const char *description) { } void * MF_RequestFunction (const char *description) { } +int MF_AmxPush (AMX *amx, cell *params) { } +int MF_AmxExec (AMX *amx, cell *retval, int idx) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_Format g_fn_Format #define MF_RegisterFunction g_fn_RegisterFunction #define MF_RequestFunction g_fn_RequestFunction; +#define MF_AmxPush g_fn_AmxPush +#ifdef MEMORY_TEST /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2231,4 +2236,6 @@ 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__ diff --git a/dlls/nvault/amxxmodule.cpp b/dlls/nvault/amxxmodule.cpp index c38a396b..9dfe57be 100755 --- a/dlls/nvault/amxxmodule.cpp +++ b/dlls/nvault/amxxmodule.cpp @@ -45,8 +45,6 @@ enginefuncs_t g_engfuncs; globalvars_t *gpGlobals; - - DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable_Post; enginefuncs_t *g_pengfuncsTable; @@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; - // GetEntityAPI2 functions static DLL_FUNCTIONS g_EntityAPI_Table = { @@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; +#ifdef MEMORY_TEST PFN_ALLOCATOR g_fn_Allocator; PFN_REALLOCATOR g_fn_Reallocator; PFN_DEALLOCATOR g_fn_Deallocator; +#endif PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_ALLOT g_fn_AmxAllot; @@ -2613,10 +2612,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); +#ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); +#endif REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); @@ -2735,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2906,6 +2909,8 @@ 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 diff --git a/dlls/nvault/amxxmodule.h b/dlls/nvault/amxxmodule.h index baf6d259..0a000d20 100755 --- a/dlls/nvault/amxxmodule.h +++ b/dlls/nvault/amxxmodule.h @@ -46,8 +46,6 @@ struct amxx_module_info_s const char *logtag; // added in version 2 }; - - // return values from functions called by amxx #define AMXX_OK 0 /* no error */ #define AMXX_IFVERS 1 /* interface version */ @@ -1981,12 +1979,14 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); #endif +#ifdef MEMORY_TEST 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*/, const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const void* /*addr*/ ); +#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); @@ -2048,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_AMX_EXEC g_fn_AmxExec; -extern PFN_AMX_EXECV g_fn_AmxExecv; extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; @@ -2193,6 +2192,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_RequestFunction g_fn_RequestFunction; #define MF_AmxPush g_fn_AmxPush +#ifdef MEMORY_TEST /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2236,4 +2236,6 @@ 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__ diff --git a/dlls/regex/amxxmodule.cpp b/dlls/regex/amxxmodule.cpp index aa649e2b..9dfe57be 100755 --- a/dlls/regex/amxxmodule.cpp +++ b/dlls/regex/amxxmodule.cpp @@ -45,8 +45,6 @@ enginefuncs_t g_engfuncs; globalvars_t *gpGlobals; - - DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable_Post; enginefuncs_t *g_pengfuncsTable; @@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; - // GetEntityAPI2 functions static DLL_FUNCTIONS g_EntityAPI_Table = { @@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; +#ifdef MEMORY_TEST PFN_ALLOCATOR g_fn_Allocator; PFN_REALLOCATOR g_fn_Reallocator; PFN_DEALLOCATOR g_fn_Deallocator; +#endif PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_ALLOT g_fn_AmxAllot; @@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REQ_FNPTR g_fn_RequestFunction; +PFN_AMX_PUSH g_fn_AmxPush; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) 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); + REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); +#ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); +#endif REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); @@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_IsPlayerHLTV(0); MF_GetPlayerArmor(0); MF_GetPlayerHealth(0); - MF_AmxExec(0, 0, 0, 0); + MF_AmxExec(0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); @@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2904,6 +2909,8 @@ 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 diff --git a/dlls/regex/amxxmodule.h b/dlls/regex/amxxmodule.h index bbaec2f5..0a000d20 100755 --- a/dlls/regex/amxxmodule.h +++ b/dlls/regex/amxxmodule.h @@ -46,8 +46,6 @@ struct amxx_module_info_s const char *logtag; // added in version 2 }; - - // return values from functions called by amxx #define AMXX_OK 0 /* no error */ #define AMXX_IFVERS 1 /* interface version */ @@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); #endif +#ifdef MEMORY_TEST 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*/, const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const void* /*addr*/ ); -typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/); +#endif +typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); @@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); +typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_AMX_EXEC g_fn_AmxExec; -extern PFN_AMX_EXECV g_fn_AmxExecv; extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; @@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction; +extern PFN_AMX_PUSH g_fn_AmxPush; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { } const char * MF_Format (const char *fmt, ...) { } void MF_RegisterFunction (void *pfn, const char *description) { } void * MF_RequestFunction (const char *description) { } +int MF_AmxPush (AMX *amx, cell *params) { } +int MF_AmxExec (AMX *amx, cell *retval, int idx) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_Format g_fn_Format #define MF_RegisterFunction g_fn_RegisterFunction #define MF_RequestFunction g_fn_RequestFunction; +#define MF_AmxPush g_fn_AmxPush +#ifdef MEMORY_TEST /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2231,4 +2236,6 @@ 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__ diff --git a/dlls/sockets/amxxmodule.cpp b/dlls/sockets/amxxmodule.cpp index aa649e2b..9dfe57be 100755 --- a/dlls/sockets/amxxmodule.cpp +++ b/dlls/sockets/amxxmodule.cpp @@ -45,8 +45,6 @@ enginefuncs_t g_engfuncs; globalvars_t *gpGlobals; - - DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable_Post; enginefuncs_t *g_pengfuncsTable; @@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; - // GetEntityAPI2 functions static DLL_FUNCTIONS g_EntityAPI_Table = { @@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; +#ifdef MEMORY_TEST PFN_ALLOCATOR g_fn_Allocator; PFN_REALLOCATOR g_fn_Reallocator; PFN_DEALLOCATOR g_fn_Deallocator; +#endif PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_ALLOT g_fn_AmxAllot; @@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REQ_FNPTR g_fn_RequestFunction; +PFN_AMX_PUSH g_fn_AmxPush; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) 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); + REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); +#ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); +#endif REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); @@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_IsPlayerHLTV(0); MF_GetPlayerArmor(0); MF_GetPlayerHealth(0); - MF_AmxExec(0, 0, 0, 0); + MF_AmxExec(0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxFindPublic(0, 0, 0); MF_AmxAllot(0, 0, 0, 0); @@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2904,6 +2909,8 @@ 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 diff --git a/dlls/sockets/amxxmodule.h b/dlls/sockets/amxxmodule.h index bbaec2f5..0a000d20 100755 --- a/dlls/sockets/amxxmodule.h +++ b/dlls/sockets/amxxmodule.h @@ -46,8 +46,6 @@ struct amxx_module_info_s const char *logtag; // added in version 2 }; - - // return values from functions called by amxx #define AMXX_OK 0 /* no error */ #define AMXX_IFVERS 1 /* interface version */ @@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); #endif +#ifdef MEMORY_TEST 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*/, const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const void* /*addr*/ ); -typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/); +#endif +typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); @@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); +typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_AMX_EXEC g_fn_AmxExec; -extern PFN_AMX_EXECV g_fn_AmxExecv; extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; @@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction; +extern PFN_AMX_PUSH g_fn_AmxPush; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { } const char * MF_Format (const char *fmt, ...) { } void MF_RegisterFunction (void *pfn, const char *description) { } void * MF_RequestFunction (const char *description) { } +int MF_AmxPush (AMX *amx, cell *params) { } +int MF_AmxExec (AMX *amx, cell *retval, int idx) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_Format g_fn_Format #define MF_RegisterFunction g_fn_RegisterFunction #define MF_RequestFunction g_fn_RequestFunction; +#define MF_AmxPush g_fn_AmxPush +#ifdef MEMORY_TEST /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2231,4 +2236,6 @@ 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__ diff --git a/dlls/tfc/tfcx/amxxmodule.cpp b/dlls/tfc/tfcx/amxxmodule.cpp index c38a396b..9dfe57be 100755 --- a/dlls/tfc/tfcx/amxxmodule.cpp +++ b/dlls/tfc/tfcx/amxxmodule.cpp @@ -45,8 +45,6 @@ enginefuncs_t g_engfuncs; globalvars_t *gpGlobals; - - DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable_Post; enginefuncs_t *g_pengfuncsTable; @@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; - // GetEntityAPI2 functions static DLL_FUNCTIONS g_EntityAPI_Table = { @@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; +#ifdef MEMORY_TEST PFN_ALLOCATOR g_fn_Allocator; PFN_REALLOCATOR g_fn_Reallocator; PFN_DEALLOCATOR g_fn_Deallocator; +#endif PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_ALLOT g_fn_AmxAllot; @@ -2613,10 +2612,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); +#ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); +#endif REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); @@ -2735,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2906,6 +2909,8 @@ 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 diff --git a/dlls/tfc/tfcx/amxxmodule.h b/dlls/tfc/tfcx/amxxmodule.h index baf6d259..0a000d20 100755 --- a/dlls/tfc/tfcx/amxxmodule.h +++ b/dlls/tfc/tfcx/amxxmodule.h @@ -46,8 +46,6 @@ struct amxx_module_info_s const char *logtag; // added in version 2 }; - - // return values from functions called by amxx #define AMXX_OK 0 /* no error */ #define AMXX_IFVERS 1 /* interface version */ @@ -1981,12 +1979,14 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); #endif +#ifdef MEMORY_TEST 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*/, const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const void* /*addr*/ ); +#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); @@ -2048,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_AMX_EXEC g_fn_AmxExec; -extern PFN_AMX_EXECV g_fn_AmxExecv; extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; @@ -2193,6 +2192,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_RequestFunction g_fn_RequestFunction; #define MF_AmxPush g_fn_AmxPush +#ifdef MEMORY_TEST /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2236,4 +2236,6 @@ 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__ diff --git a/dlls/ts/tsfun/amxxmodule.cpp b/dlls/ts/tsfun/amxxmodule.cpp index c38a396b..9dfe57be 100755 --- a/dlls/ts/tsfun/amxxmodule.cpp +++ b/dlls/ts/tsfun/amxxmodule.cpp @@ -45,8 +45,6 @@ enginefuncs_t g_engfuncs; globalvars_t *gpGlobals; - - DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable_Post; enginefuncs_t *g_pengfuncsTable; @@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; - // GetEntityAPI2 functions static DLL_FUNCTIONS g_EntityAPI_Table = { @@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; +#ifdef MEMORY_TEST PFN_ALLOCATOR g_fn_Allocator; PFN_REALLOCATOR g_fn_Reallocator; PFN_DEALLOCATOR g_fn_Deallocator; +#endif PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_ALLOT g_fn_AmxAllot; @@ -2613,10 +2612,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); +#ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); +#endif REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); @@ -2735,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2906,6 +2909,8 @@ 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 diff --git a/dlls/ts/tsfun/amxxmodule.h b/dlls/ts/tsfun/amxxmodule.h index baf6d259..0a000d20 100755 --- a/dlls/ts/tsfun/amxxmodule.h +++ b/dlls/ts/tsfun/amxxmodule.h @@ -46,8 +46,6 @@ struct amxx_module_info_s const char *logtag; // added in version 2 }; - - // return values from functions called by amxx #define AMXX_OK 0 /* no error */ #define AMXX_IFVERS 1 /* interface version */ @@ -1981,12 +1979,14 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); #endif +#ifdef MEMORY_TEST 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*/, const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const void* /*addr*/ ); +#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); @@ -2048,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_AMX_EXEC g_fn_AmxExec; -extern PFN_AMX_EXECV g_fn_AmxExecv; extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; @@ -2193,6 +2192,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_RequestFunction g_fn_RequestFunction; #define MF_AmxPush g_fn_AmxPush +#ifdef MEMORY_TEST /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2236,4 +2236,6 @@ 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__ diff --git a/dlls/ts/tsx/amxxmodule.cpp b/dlls/ts/tsx/amxxmodule.cpp index c38a396b..9dfe57be 100755 --- a/dlls/ts/tsx/amxxmodule.cpp +++ b/dlls/ts/tsx/amxxmodule.cpp @@ -45,8 +45,6 @@ enginefuncs_t g_engfuncs; globalvars_t *gpGlobals; - - DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable_Post; enginefuncs_t *g_pengfuncsTable; @@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; - // GetEntityAPI2 functions static DLL_FUNCTIONS g_EntityAPI_Table = { @@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; +#ifdef MEMORY_TEST PFN_ALLOCATOR g_fn_Allocator; PFN_REALLOCATOR g_fn_Reallocator; PFN_DEALLOCATOR g_fn_Deallocator; +#endif PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_ALLOT g_fn_AmxAllot; @@ -2613,10 +2612,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); +#ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); +#endif REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); @@ -2735,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2906,6 +2909,8 @@ 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 diff --git a/dlls/ts/tsx/amxxmodule.h b/dlls/ts/tsx/amxxmodule.h index baf6d259..0a000d20 100755 --- a/dlls/ts/tsx/amxxmodule.h +++ b/dlls/ts/tsx/amxxmodule.h @@ -46,8 +46,6 @@ struct amxx_module_info_s const char *logtag; // added in version 2 }; - - // return values from functions called by amxx #define AMXX_OK 0 /* no error */ #define AMXX_IFVERS 1 /* interface version */ @@ -1981,12 +1979,14 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); #endif +#ifdef MEMORY_TEST 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*/, const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, const unsigned int /*type*/, const void* /*addr*/ ); +#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); @@ -2048,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_AMX_EXEC g_fn_AmxExec; -extern PFN_AMX_EXECV g_fn_AmxExecv; extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; @@ -2193,6 +2192,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_RequestFunction g_fn_RequestFunction; #define MF_AmxPush g_fn_AmxPush +#ifdef MEMORY_TEST /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2236,4 +2236,6 @@ 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__