diff --git a/dlls/cstrike/amxxmodule.cpp b/dlls/cstrike/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/cstrike/amxxmodule.cpp +++ b/dlls/cstrike/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/cstrike/amxxmodule.h b/dlls/cstrike/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/cstrike/amxxmodule.h +++ b/dlls/cstrike/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/csx/source/amxxmodule.cpp b/dlls/csx/source/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/csx/source/amxxmodule.cpp +++ b/dlls/csx/source/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/csx/source/amxxmodule.h b/dlls/csx/source/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/csx/source/amxxmodule.h +++ b/dlls/csx/source/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/csx_sql/amxxmodule.cpp b/dlls/csx_sql/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/csx_sql/amxxmodule.cpp +++ b/dlls/csx_sql/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/csx_sql/amxxmodule.h b/dlls/csx_sql/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/csx_sql/amxxmodule.h +++ b/dlls/csx_sql/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/dod2/dodfun/amxxmodule.cpp b/dlls/dod2/dodfun/amxxmodule.cpp index c70c9107..aa649e2b 100755 --- a/dlls/dod2/dodfun/amxxmodule.cpp +++ b/dlls/dod2/dodfun/amxxmodule.cpp @@ -2296,11 +2296,6 @@ C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs) { - if ( gpGamedllFuncs ){ - LOG_ERROR(PLID,"gpGamedllFuncs already set"); - return(FALSE); - } - if(now > Plugin_info.loadable) { LOG_ERROR(PLID, "Can't load module right now"); return(FALSE); @@ -2426,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2437,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2506,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2543,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2675,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2728,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/dod2/dodfun/amxxmodule.h b/dlls/dod2/dodfun/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/dod2/dodfun/amxxmodule.h +++ b/dlls/dod2/dodfun/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/dod2/dodx/amxxmodule.cpp b/dlls/dod2/dodx/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/dod2/dodx/amxxmodule.cpp +++ b/dlls/dod2/dodx/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/dod2/dodx/amxxmodule.h b/dlls/dod2/dodx/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/dod2/dodx/amxxmodule.h +++ b/dlls/dod2/dodx/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/esforces/esfmod/amxxmodule.cpp b/dlls/esforces/esfmod/amxxmodule.cpp index f27f65e6..aa649e2b 100755 --- a/dlls/esforces/esfmod/amxxmodule.cpp +++ b/dlls/esforces/esfmod/amxxmodule.cpp @@ -2429,10 +2429,11 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions diff --git a/dlls/esforces/esfmod/amxxmodule.h b/dlls/esforces/esfmod/amxxmodule.h index 772aaa89..74cc5f72 100755 --- a/dlls/esforces/esfmod/amxxmodule.h +++ b/dlls/esforces/esfmod/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; diff --git a/dlls/fakemeta/sdk/amxxmodule.cpp b/dlls/fakemeta/sdk/amxxmodule.cpp index ad38cfe2..aa649e2b 100755 --- a/dlls/fakemeta/sdk/amxxmodule.cpp +++ b/dlls/fakemeta/sdk/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif @@ -2757,8 +2764,8 @@ const char *Mem_MakeSourceFile(const char *sourceFile) { // init buffer[0] = '['; - strcpy(buffer + 1, MODULE_LOGTAG); - pos = strlen(MODULE_LOGTAG) + 1; + strcpy(buffer + 1, MODULE_NAME); + pos = strlen(MODULE_NAME) + 1; buffer[pos++] = ']'; } diff --git a/dlls/fakemeta/sdk/amxxmodule.h b/dlls/fakemeta/sdk/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/fakemeta/sdk/amxxmodule.h +++ b/dlls/fakemeta/sdk/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/fun/amxxmodule.cpp b/dlls/fun/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/fun/amxxmodule.cpp +++ b/dlls/fun/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/fun/amxxmodule.h b/dlls/fun/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/fun/amxxmodule.h +++ b/dlls/fun/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/geoip/amxxmodule.cpp b/dlls/geoip/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/geoip/amxxmodule.cpp +++ b/dlls/geoip/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/geoip/amxxmodule.h b/dlls/geoip/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/geoip/amxxmodule.h +++ b/dlls/geoip/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/mssql/amxxmodule.cpp b/dlls/mssql/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/mssql/amxxmodule.cpp +++ b/dlls/mssql/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/mssql/amxxmodule.h b/dlls/mssql/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/mssql/amxxmodule.h +++ b/dlls/mssql/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/ns/ns/amxxmodule.cpp b/dlls/ns/ns/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/ns/ns/amxxmodule.cpp +++ b/dlls/ns/ns/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/ns/ns/amxxmodule.h b/dlls/ns/ns/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/ns/ns/amxxmodule.h +++ b/dlls/ns/ns/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/pgsql/amxxmodule.cpp b/dlls/pgsql/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/pgsql/amxxmodule.cpp +++ b/dlls/pgsql/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/pgsql/amxxmodule.h b/dlls/pgsql/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/pgsql/amxxmodule.h +++ b/dlls/pgsql/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/regex/amxxmodule.cpp b/dlls/regex/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/regex/amxxmodule.cpp +++ b/dlls/regex/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/regex/amxxmodule.h b/dlls/regex/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/regex/amxxmodule.h +++ b/dlls/regex/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/sockets/amxxmodule.cpp b/dlls/sockets/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/sockets/amxxmodule.cpp +++ b/dlls/sockets/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/sockets/amxxmodule.h b/dlls/sockets/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/sockets/amxxmodule.h +++ b/dlls/sockets/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/sqlite/amxxmodule.cpp b/dlls/sqlite/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/sqlite/amxxmodule.cpp +++ b/dlls/sqlite/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/sqlite/amxxmodule.h b/dlls/sqlite/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/sqlite/amxxmodule.h +++ b/dlls/sqlite/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/tfc/tfcx/amxxmodule.cpp b/dlls/tfc/tfcx/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/tfc/tfcx/amxxmodule.cpp +++ b/dlls/tfc/tfcx/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/tfc/tfcx/amxxmodule.h b/dlls/tfc/tfcx/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/tfc/tfcx/amxxmodule.h +++ b/dlls/tfc/tfcx/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize); diff --git a/dlls/ts/tsx/amxxmodule.cpp b/dlls/ts/tsx/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/ts/tsx/amxxmodule.cpp +++ b/dlls/ts/tsx/amxxmodule.cpp @@ -2421,9 +2421,6 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, /************* AMXX Stuff *************/ -// *** Types *** -typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); - // *** Globals *** // Module info static amxx_module_info_s g_ModuleInfo = @@ -2432,15 +2429,17 @@ static amxx_module_info_s g_ModuleInfo = MODULE_AUTHOR, MODULE_VERSION, #ifdef MODULE_RELOAD_ON_MAPCHANGE - 1 + 1, #else // MODULE_RELOAD_ON_MAPCHANGE - 0 + 0, #endif // MODULE_RELOAD_ON_MAPCHANGE + MODULE_LOGTAG }; // Storage for the requested functions PFN_ADD_NATIVES g_fn_AddNatives; PFN_BUILD_PATHNAME g_fn_BuildPathname; +PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; PFN_GET_AMXADDR g_fn_GetAmxAddr; PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; PFN_GET_MODNAME g_fn_GetModname; @@ -2501,6 +2500,8 @@ PFN_AMX_FINDNATIVE g_fn_AmxFindNative; PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; PFN_FORMAT g_fn_Format; +PFN_REGISTERFUNCTION g_fn_RegisterFunction; +PFN_REQ_FNPTR g_fn_RequestFunction; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2538,15 +2539,19 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) if (!reqFnptrFunc) return AMXX_PARAM; + g_fn_RequestFunction = reqFnptrFunc; + // Req all known functions // Misc REQFUNC("BuildPathname", g_fn_BuildPathname, PFN_BUILD_PATHNAME); + REQFUNC("BuildPathnameR", g_fn_BuildPathnameR, PFN_BUILD_PATHNAME_R); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("Format", g_fn_Format, PFN_FORMAT); + REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION); // Amx scripts REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); @@ -2670,6 +2675,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...) void ValidateMacros_DontCallThis_Smiley() { MF_BuildPathname("str", "str", 0); + MF_BuildPathnameR(NULL, 0, "%d", 0); MF_FormatAmxString(NULL, 0, 0, NULL); MF_GetAmxAddr(NULL, 0); MF_PrintSrvConsole("str", "str", 0); @@ -2723,6 +2729,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerFrags(0); MF_GetPlayerEdict(0); MF_Format("", 4, "str"); + MF_RegisterFunction(NULL, ""); } #endif diff --git a/dlls/ts/tsx/amxxmodule.h b/dlls/ts/tsx/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/ts/tsx/amxxmodule.h +++ b/dlls/ts/tsx/amxxmodule.h @@ -32,7 +32,7 @@ // ***** AMXX stuff ***** // module interface version is 1 -#define AMXX_INTERFACE_VERSION 1 +#define AMXX_INTERFACE_VERSION 2 // amxx module info struct amxx_module_info_s @@ -41,6 +41,7 @@ struct amxx_module_info_s const char *author; const char *version; int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 }; @@ -1883,6 +1884,9 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +// *** Types *** +typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); + // ***** Module funcs stuff ***** enum ForwardExecType { @@ -1906,6 +1910,7 @@ enum ForwardParam typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...); +typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...); typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/); typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...); typedef const char * (*PFN_GET_MODNAME) (void); @@ -1974,9 +1979,11 @@ typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*f 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*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; +extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR; extern PFN_GET_AMXADDR g_fn_GetAmxAddr; extern PFN_PRINT_SRVCONSOLE g_fn_PrintSrvConsole; extern PFN_GET_MODNAME g_fn_GetModname; @@ -2034,12 +2041,15 @@ extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_FORMAT g_fn_Format; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; +extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; +extern PFN_REQ_FNPTR g_fn_RequestFunction; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems // They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED int MF_AddNatives (const AMX_NATIVE_INFO *list) { } char * MF_BuildPathname (const char * format, ...) { } +char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { } cell * MF_GetAmxAddr (AMX * amx, cell offset) { } void MF_PrintSrvConsole (char * format, ...) { } const char * MF_GetModname (void) { } @@ -2089,10 +2099,13 @@ void MF_UnregisterSPForward (int id) { } int MF_GetPlayerFlags (int id) { } 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) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives #define MF_BuildPathname g_fn_BuildPathname +#define MF_BuildPathnameR g_fn_BuildPathnameR #define MF_FormatAmxString g_fn_FormatAmxString #define MF_GetAmxAddr g_fn_GetAmxAddr #define MF_PrintSrvConsole g_fn_PrintSrvConsole @@ -2150,6 +2163,8 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_Format g_fn_Format +#define MF_RegisterFunction g_fn_RegisterFunction +#define MF_RequestFunction g_fn_RequestFunction; /*** Memory ***/ void *operator new(size_t reportedSize);