From 02d60ded5d109b6ed61d0f0808b7034f6f4d78b9 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 7 Sep 2004 06:17:50 +0000 Subject: [PATCH] Made memory management optional --- dlls/csstats2/csstats/amxxmodule.cpp | 7 ++ dlls/csstats2/csstats/amxxmodule.h | 3 + dlls/cstrike/amxxmodule.cpp | 7 ++ dlls/cstrike/amxxmodule.h | 3 + dlls/dod2/dodfun/amxxmodule.cpp | 7 ++ dlls/dod2/dodfun/amxxmodule.h | 3 + dlls/dod2/dodx/amxxmodule.cpp | 7 ++ dlls/dod2/dodx/amxxmodule.h | 3 + dlls/engine/amxxmodule.cpp | 4 + dlls/engine/amxxmodule.h | 3 + dlls/fun/amxxmodule.cpp | 7 ++ dlls/fun/amxxmodule.h | 7 ++ dlls/geoip/amxxmodule.cpp | 7 ++ dlls/geoip/amxxmodule.h | 3 + dlls/mssql/amxxmodule.cpp | 7 ++ dlls/mssql/amxxmodule.h | 3 + dlls/ns/ns/amxxmodule.cpp | 172 ++++++++++----------------- dlls/ns/ns/amxxmodule.h | 3 + dlls/pgsql/amxxmodule.cpp | 7 ++ dlls/pgsql/amxxmodule.h | 3 + dlls/sockets/amxxmodule.cpp | 7 ++ dlls/sockets/amxxmodule.h | 3 + dlls/tfc/tfcx/amxxmodule.cpp | 7 ++ dlls/tfc/tfcx/amxxmodule.h | 3 + dlls/ts/tsx/amxxmodule.cpp | 7 ++ dlls/ts/tsx/amxxmodule.h | 3 + 26 files changed, 190 insertions(+), 106 deletions(-) diff --git a/dlls/csstats2/csstats/amxxmodule.cpp b/dlls/csstats2/csstats/amxxmodule.cpp index a11e5052..4b4d9ae3 100755 --- a/dlls/csstats2/csstats/amxxmodule.cpp +++ b/dlls/csstats2/csstats/amxxmodule.cpp @@ -2479,6 +2479,7 @@ 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; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2530,6 +2531,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); @@ -2576,6 +2578,7 @@ 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); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2678,6 +2681,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2849,6 +2854,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/csstats2/csstats/amxxmodule.h b/dlls/csstats2/csstats/amxxmodule.h index 2c20eaa3..c6e95585 100755 --- a/dlls/csstats2/csstats/amxxmodule.h +++ b/dlls/csstats2/csstats/amxxmodule.h @@ -2122,6 +2122,8 @@ void MF_Log(const char *fmt, ...); #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags +#ifdef MEMORY_TEST + /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2165,5 +2167,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/cstrike/amxxmodule.cpp b/dlls/cstrike/amxxmodule.cpp index a11e5052..4b4d9ae3 100755 --- a/dlls/cstrike/amxxmodule.cpp +++ b/dlls/cstrike/amxxmodule.cpp @@ -2479,6 +2479,7 @@ 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; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2530,6 +2531,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); @@ -2576,6 +2578,7 @@ 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); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2678,6 +2681,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2849,6 +2854,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/cstrike/amxxmodule.h b/dlls/cstrike/amxxmodule.h index 2c20eaa3..c6e95585 100755 --- a/dlls/cstrike/amxxmodule.h +++ b/dlls/cstrike/amxxmodule.h @@ -2122,6 +2122,8 @@ void MF_Log(const char *fmt, ...); #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags +#ifdef MEMORY_TEST + /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2165,5 +2167,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/dodfun/amxxmodule.cpp b/dlls/dod2/dodfun/amxxmodule.cpp index a11e5052..4b4d9ae3 100755 --- a/dlls/dod2/dodfun/amxxmodule.cpp +++ b/dlls/dod2/dodfun/amxxmodule.cpp @@ -2479,6 +2479,7 @@ 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; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2530,6 +2531,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); @@ -2576,6 +2578,7 @@ 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); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2678,6 +2681,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2849,6 +2854,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 2c20eaa3..c6e95585 100755 --- a/dlls/dod2/dodfun/amxxmodule.h +++ b/dlls/dod2/dodfun/amxxmodule.h @@ -2122,6 +2122,8 @@ void MF_Log(const char *fmt, ...); #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags +#ifdef MEMORY_TEST + /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2165,5 +2167,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 a11e5052..4b4d9ae3 100755 --- a/dlls/dod2/dodx/amxxmodule.cpp +++ b/dlls/dod2/dodx/amxxmodule.cpp @@ -2479,6 +2479,7 @@ 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; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2530,6 +2531,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); @@ -2576,6 +2578,7 @@ 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); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2678,6 +2681,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2849,6 +2854,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 2c20eaa3..c6e95585 100755 --- a/dlls/dod2/dodx/amxxmodule.h +++ b/dlls/dod2/dodx/amxxmodule.h @@ -2122,6 +2122,8 @@ void MF_Log(const char *fmt, ...); #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags +#ifdef MEMORY_TEST + /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2165,5 +2167,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/engine/amxxmodule.cpp b/dlls/engine/amxxmodule.cpp index b389d31c..1a01d5cd 100755 --- a/dlls/engine/amxxmodule.cpp +++ b/dlls/engine/amxxmodule.cpp @@ -2687,6 +2687,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2858,6 +2860,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/engine/amxxmodule.h b/dlls/engine/amxxmodule.h index 2c20eaa3..c6e95585 100755 --- a/dlls/engine/amxxmodule.h +++ b/dlls/engine/amxxmodule.h @@ -2122,6 +2122,8 @@ void MF_Log(const char *fmt, ...); #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags +#ifdef MEMORY_TEST + /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2165,5 +2167,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/fun/amxxmodule.cpp b/dlls/fun/amxxmodule.cpp index a11e5052..4b4d9ae3 100755 --- a/dlls/fun/amxxmodule.cpp +++ b/dlls/fun/amxxmodule.cpp @@ -2479,6 +2479,7 @@ 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; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2530,6 +2531,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); @@ -2576,6 +2578,7 @@ 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); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2678,6 +2681,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2849,6 +2854,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/fun/amxxmodule.h b/dlls/fun/amxxmodule.h index d195056b..c6e95585 100755 --- a/dlls/fun/amxxmodule.h +++ b/dlls/fun/amxxmodule.h @@ -1932,6 +1932,7 @@ 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_GET_PLAYER_CURWEAPON) (int /*id*/); typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/); typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/); @@ -2015,6 +2016,7 @@ extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; 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; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2063,6 +2065,7 @@ cell amx_ftoc (float x) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2117,6 +2120,9 @@ void MF_Log(const char *fmt, ...); #define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName #define MF_RegisterSPForward g_fn_RegisterSPForward #define MF_UnregisterSPForward g_fn_UnregisterSPForward +#define MF_GetPlayerFlags g_fn_GetPlayerFlags + +#ifdef MEMORY_TEST /*** Memory ***/ void *operator new(size_t reportedSize); @@ -2161,5 +2167,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 a11e5052..4b4d9ae3 100755 --- a/dlls/geoip/amxxmodule.cpp +++ b/dlls/geoip/amxxmodule.cpp @@ -2479,6 +2479,7 @@ 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; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2530,6 +2531,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); @@ -2576,6 +2578,7 @@ 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); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2678,6 +2681,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2849,6 +2854,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 2c20eaa3..c6e95585 100755 --- a/dlls/geoip/amxxmodule.h +++ b/dlls/geoip/amxxmodule.h @@ -2122,6 +2122,8 @@ void MF_Log(const char *fmt, ...); #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags +#ifdef MEMORY_TEST + /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2165,5 +2167,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/mssql/amxxmodule.cpp b/dlls/mssql/amxxmodule.cpp index a11e5052..4b4d9ae3 100755 --- a/dlls/mssql/amxxmodule.cpp +++ b/dlls/mssql/amxxmodule.cpp @@ -2479,6 +2479,7 @@ 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; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2530,6 +2531,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); @@ -2576,6 +2578,7 @@ 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); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2678,6 +2681,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2849,6 +2854,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/mssql/amxxmodule.h b/dlls/mssql/amxxmodule.h index 2c20eaa3..c6e95585 100755 --- a/dlls/mssql/amxxmodule.h +++ b/dlls/mssql/amxxmodule.h @@ -2122,6 +2122,8 @@ void MF_Log(const char *fmt, ...); #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags +#ifdef MEMORY_TEST + /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2165,5 +2167,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 efeac02f..4b4d9ae3 100755 --- a/dlls/ns/ns/amxxmodule.cpp +++ b/dlls/ns/ns/amxxmodule.cpp @@ -37,7 +37,6 @@ #include #include #include -#include "ns.h" #include "amxxmodule.h" /************* METAMOD SUPPORT *************/ @@ -2478,6 +2477,9 @@ 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; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2521,6 +2523,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("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2528,6 +2531,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); @@ -2541,6 +2545,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); @@ -2573,6 +2578,7 @@ 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); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2675,6 +2681,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2846,6 +2854,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 @@ -2879,6 +2889,8 @@ void operator delete[](void *reportedAddress) #include #include "sdk_util.h" +#include + #include // for strncpy(), etc #include "osdep.h" // win32 vsnprintf, etc @@ -2906,56 +2918,64 @@ void UTIL_LogPrintf( char *fmt, ... ) static char string[1024]; va_start ( argptr, fmt ); - vsprintf ( string, fmt, argptr ); + vsnprintf ( string, sizeof(string), fmt, argptr ); va_end ( argptr ); // Print to server console ALERT( at_logged, "%s", string ); } -edict_t *UTIL_PlayerByIndexE( int playerIndex ) -{ - if ( playerIndex > 0 && playerIndex <= gpGlobals->maxClients ) - { - edict_t *pPlayerEdict = INDEXENT2( playerIndex ); - if ( pPlayerEdict && !pPlayerEdict->free ) + +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 ) { - return pPlayerEdict; + WRITE_STRING( pMessage ); } - } - - return NULL; -} -edict_t *UTIL_FindEntityByString(edict_t *pentStart, const char *szKeyword, const char *szValue) -{ - edict_t *pentEntity; - pentEntity=FIND_ENTITY_BY_STRING(pentStart, szKeyword, szValue); - if(!FNullEnt(pentEntity)) - return pentEntity; - return NULL; -} - - - - -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; + 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); + output = (int) (value * scale); if ( output > 32767 ) output = 32767; @@ -2965,77 +2985,17 @@ short FixedSigned16( float value, float scale ) return (short)output; } -int LogToIndex(char logline[128]) + +unsigned short FixedUnsigned16( float value, float scale ) { - char *cname; - // Format of log line: - // name - // We need to find their ID from their name... - int x,y=0; - char cindex[64]; - // first we find the location of the start of the index - // Name can contain <>'s, so we go from the end up. - for (x=strlen(logline);x>=0;x--) - { - if (logline[x]=='<') - { - y++; - if (y==3) - { - y=x; - break; - } - } - } - // We found the end of the name, now copy the rest down. - y--; - x=0; - for (x;x<=y;x++) - { - cindex[x]=logline[x]; - } - cindex[x]='\0'; - // Now we have their name, now cycle through all players to find which index it is - x=1; - for (x;x<=gpGlobals->maxClients;x++) - { - cname=strdup(cindex); - if (!FNullEnt(INDEXENT2(x))) - { - if (FStrEq(cname,STRING(INDEXENT2(x)->v.netname))) - { - return x; - } - } - } - return 0; -} -int Find_Building_Hive(void) -{ - edict_t *pEntity=NULL; - while (pEntity = UTIL_FindEntityByString(pEntity,"classname","team_hive")) - { - if (pEntity->v.health > 0 && pEntity->v.solid > 0 && pEntity->v.fuser1 < 1000) - { - return ENTINDEX(pEntity); - } - } - return 0; -} + int output; + output = (int) (value * scale); + if ( output < 0 ) + output = 0; + if ( output > 0xFFFF ) + output = 0xFFFF; - - -int AMX_MAKE_STRING(AMX *oPlugin, cell tParam, int &iLength) -{ - char *szNewValue = MF_GetAmxString(oPlugin, tParam, 0, &iLength); - return ALLOC_STRING(szNewValue); -} - -// Makes a char pointer out of an AMX cell. -char *AMX_GET_STRING(AMX *oPlugin, cell tParam, int &iLength) -{ - char *szNewValue = MF_GetAmxString(oPlugin, tParam, 0, &iLength); - return (char*)STRING(ALLOC_STRING(szNewValue)); + return (unsigned short)output; } #endif // USE_METAMOD diff --git a/dlls/ns/ns/amxxmodule.h b/dlls/ns/ns/amxxmodule.h index 2c20eaa3..c6e95585 100755 --- a/dlls/ns/ns/amxxmodule.h +++ b/dlls/ns/ns/amxxmodule.h @@ -2122,6 +2122,8 @@ void MF_Log(const char *fmt, ...); #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags +#ifdef MEMORY_TEST + /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2165,5 +2167,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/pgsql/amxxmodule.cpp b/dlls/pgsql/amxxmodule.cpp index a11e5052..4b4d9ae3 100755 --- a/dlls/pgsql/amxxmodule.cpp +++ b/dlls/pgsql/amxxmodule.cpp @@ -2479,6 +2479,7 @@ 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; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2530,6 +2531,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); @@ -2576,6 +2578,7 @@ 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); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2678,6 +2681,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2849,6 +2854,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/pgsql/amxxmodule.h b/dlls/pgsql/amxxmodule.h index 2c20eaa3..c6e95585 100755 --- a/dlls/pgsql/amxxmodule.h +++ b/dlls/pgsql/amxxmodule.h @@ -2122,6 +2122,8 @@ void MF_Log(const char *fmt, ...); #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags +#ifdef MEMORY_TEST + /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2165,5 +2167,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 a11e5052..4b4d9ae3 100755 --- a/dlls/sockets/amxxmodule.cpp +++ b/dlls/sockets/amxxmodule.cpp @@ -2479,6 +2479,7 @@ 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; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2530,6 +2531,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); @@ -2576,6 +2578,7 @@ 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); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2678,6 +2681,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2849,6 +2854,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 2c20eaa3..c6e95585 100755 --- a/dlls/sockets/amxxmodule.h +++ b/dlls/sockets/amxxmodule.h @@ -2122,6 +2122,8 @@ void MF_Log(const char *fmt, ...); #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags +#ifdef MEMORY_TEST + /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2165,5 +2167,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 a11e5052..4b4d9ae3 100755 --- a/dlls/tfc/tfcx/amxxmodule.cpp +++ b/dlls/tfc/tfcx/amxxmodule.cpp @@ -2479,6 +2479,7 @@ 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; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2530,6 +2531,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); @@ -2576,6 +2578,7 @@ 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); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2678,6 +2681,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2849,6 +2854,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 2c20eaa3..c6e95585 100755 --- a/dlls/tfc/tfcx/amxxmodule.h +++ b/dlls/tfc/tfcx/amxxmodule.h @@ -2122,6 +2122,8 @@ void MF_Log(const char *fmt, ...); #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags +#ifdef MEMORY_TEST + /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2165,5 +2167,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 a11e5052..4b4d9ae3 100755 --- a/dlls/ts/tsx/amxxmodule.cpp +++ b/dlls/ts/tsx/amxxmodule.cpp @@ -2479,6 +2479,7 @@ 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; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2530,6 +2531,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); @@ -2576,6 +2578,7 @@ 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); // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2678,6 +2681,8 @@ void ValidateMacros_DontCallThis_Smiley() } #endif +#ifdef MEMORY_TEST + /************* MEMORY *************/ // undef all defined macros #undef new @@ -2849,6 +2854,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 2c20eaa3..c6e95585 100755 --- a/dlls/ts/tsx/amxxmodule.h +++ b/dlls/ts/tsx/amxxmodule.h @@ -2122,6 +2122,8 @@ void MF_Log(const char *fmt, ...); #define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_GetPlayerFlags g_fn_GetPlayerFlags +#ifdef MEMORY_TEST + /*** Memory ***/ void *operator new(size_t reportedSize); void *operator new[](size_t reportedSize); @@ -2165,5 +2167,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__