diff --git a/dlls/engine/amxxmodule.cpp b/dlls/engine/amxxmodule.cpp index 5bd6e75a..aa649e2b 100755 --- a/dlls/engine/amxxmodule.cpp +++ b/dlls/engine/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/engine/amxxmodule.h b/dlls/engine/amxxmodule.h index e0b0e8fa..74cc5f72 100755 --- a/dlls/engine/amxxmodule.h +++ b/dlls/engine/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/plugins/include/cstrike.inc b/plugins/include/cstrike.inc index 20d1f4b2..aed0ae7e 100755 --- a/plugins/include/cstrike.inc +++ b/plugins/include/cstrike.inc @@ -10,6 +10,8 @@ #endif #define _cstrike_included +#pragma library cstrike + /* Returns player deaths. */ native cs_get_user_deaths(index); diff --git a/plugins/include/csx.inc b/plugins/include/csx.inc index 508d81a7..101836b7 100755 --- a/plugins/include/csx.inc +++ b/plugins/include/csx.inc @@ -11,6 +11,8 @@ #include +#pragma library csx + /* * Forwards */ diff --git a/plugins/include/dbi.inc b/plugins/include/dbi.inc index 21fd0079..436a38fd 100755 --- a/plugins/include/dbi.inc +++ b/plugins/include/dbi.inc @@ -17,6 +17,8 @@ #endif #define _dbi_included +#pragma library dbi + enum Sql { SQL_FAILED=0, diff --git a/plugins/include/dodfun.inc b/plugins/include/dodfun.inc index b0c6993d..be77ec48 100755 --- a/plugins/include/dodfun.inc +++ b/plugins/include/dodfun.inc @@ -11,6 +11,8 @@ #include +#pragma library dodfun + /* Function is called after grenade throw */ forward grenade_throw(index,greindex,wId); diff --git a/plugins/include/dodx.inc b/plugins/include/dodx.inc index f84fd611..cd6e427e 100755 --- a/plugins/include/dodx.inc +++ b/plugins/include/dodx.inc @@ -12,6 +12,8 @@ #include #include +#pragma library dodx + /************* Shared Natives Start ********************************/ /* Forward types */ diff --git a/plugins/include/engine.inc b/plugins/include/engine.inc index f50094e9..666cd27a 100755 --- a/plugins/include/engine.inc +++ b/plugins/include/engine.inc @@ -13,6 +13,8 @@ #include +#pragma library engine + native traceresult(type,{Float,Sql,Result,_}:...); /* Registers a client impulse to a function. Function is passed the ID of the user. */ diff --git a/plugins/include/esf.inc b/plugins/include/esf.inc index 32aafa60..f9a910be 100755 --- a/plugins/include/esf.inc +++ b/plugins/include/esf.inc @@ -20,6 +20,8 @@ #include +#pragma library esfmod + /************************** * Main functions ********* **************************/ diff --git a/plugins/include/fakemeta.inc b/plugins/include/fakemeta.inc index f1883b56..29509962 100755 --- a/plugins/include/fakemeta.inc +++ b/plugins/include/fakemeta.inc @@ -9,6 +9,8 @@ #include +#pragma library fakemeta + /* Returns entvar data from an entity Use the pev_* enum to specify which form of data you want returned. */ native pev(_index,_value,{Float,Sql,Result,_}:...) diff --git a/plugins/include/fun.inc b/plugins/include/fun.inc index 2416bc01..6021dc9c 100755 --- a/plugins/include/fun.inc +++ b/plugins/include/fun.inc @@ -10,6 +10,8 @@ #endif #define _fun_included +#pragma library fun + /* Returns 1 if receiver hears sender via voice communication. */ native get_client_listen(receiver, sender); diff --git a/plugins/include/geoip.inc b/plugins/include/geoip.inc index 4a42f49a..48a7a2b4 100755 --- a/plugins/include/geoip.inc +++ b/plugins/include/geoip.inc @@ -8,6 +8,7 @@ #endif #define _geoip_included +#pragma library geoip //IP address can contain ports, the ports will be stripped out diff --git a/plugins/include/ns.inc b/plugins/include/ns.inc index 9f074fad..e4782f20 100755 --- a/plugins/include/ns.inc +++ b/plugins/include/ns.inc @@ -9,6 +9,8 @@ #endif #define NS_INC +#pragma library ns + #include diff --git a/plugins/include/regex.inc b/plugins/include/regex.inc index 1cb2bc6a..b5f4635e 100755 --- a/plugins/include/regex.inc +++ b/plugins/include/regex.inc @@ -9,6 +9,8 @@ #endif #define _regex_included +#pragma library regex + enum Regex { REGEX_MATCH_FAIL = -2, diff --git a/plugins/include/sockets.inc b/plugins/include/sockets.inc index df3af6a2..edf5da7c 100755 --- a/plugins/include/sockets.inc +++ b/plugins/include/sockets.inc @@ -13,6 +13,8 @@ #endif #define _socket_included +#pragma library socket + // Use SOCKET_TCP for TCP Socket connections #define SOCKET_TCP 1 diff --git a/plugins/include/tfcx.inc b/plugins/include/tfcx.inc index 3436d1db..9f784eb5 100755 --- a/plugins/include/tfcx.inc +++ b/plugins/include/tfcx.inc @@ -12,6 +12,7 @@ #include #include +#pragma library tfcx /************* Shared Natives Start ********************************/ diff --git a/plugins/include/tsx.inc b/plugins/include/tsx.inc index 894b501e..77cb2912 100755 --- a/plugins/include/tsx.inc +++ b/plugins/include/tsx.inc @@ -12,6 +12,8 @@ #include #include +#pragma library tsx + /************* Shared Natives Start ********************************/ /* Forward types */