diff --git a/dlls/csx/source/amxxmodule.cpp b/dlls/csx/source/amxxmodule.cpp index 9d92f6f5..30ef9c79 100755 --- a/dlls/csx/source/amxxmodule.cpp +++ b/dlls/csx/source/amxxmodule.cpp @@ -2430,7 +2430,9 @@ static amxx_module_info_s g_ModuleInfo = #else // MODULE_RELOAD_ON_MAPCHANGE 0, #endif // MODULE_RELOAD_ON_MAPCHANGE - MODULE_LOGTAG + MODULE_LOGTAG, + MODULE_LIBRARY, + MODULE_LIBCLASS }; // Storage for the requested functions @@ -2506,6 +2508,11 @@ PFN_SET_TEAM_INFO g_fn_SetTeamInfo; PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +PFN_FINDLIBRARY g_fn_FindLibrary; +PFN_ADDLIBRARIES g_fn_AddLibraries; +PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +PFN_OVERRIDENATIVES g_fn_OverrideNatives; +PFN_GETLOCALINFO g_fn_GetLocalInfo; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2620,6 +2627,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("RegAuthFunc", g_fn_RegAuthFunc, PFN_REG_AUTH_FUNC); REQFUNC("UnregAuthFunc", g_fn_UnregAuthFunc, PFN_UNREG_AUTH_FUNC); + REQFUNC("FindLibrary", g_fn_FindLibrary, PFN_FINDLIBRARY); + REQFUNC("AddLibraries", g_fn_AddLibraries, PFN_ADDLIBRARIES); + REQFUNC("RemoveLibraries", g_fn_RemoveLibraries, PFN_REMOVELIBRARIES); + REQFUNC("OverrideNatives", g_fn_OverrideNatives, PFN_OVERRIDENATIVES); + REQFUNC("GetLocalInfo", g_fn_GetLocalInfo, PFN_GETLOCALINFO); + #ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2654,6 +2667,20 @@ C_DLLEXPORT int AMXX_PluginsLoaded() return AMXX_OK; } +C_DLLEXPORT void AMXX_PluginsUnloaded() +{ +#ifdef FN_AMXX_PLUGINSUNLOADED + FN_AMXX_PLUGINSUNLOADED(); +#endif // FN_AMXX_PLUGINSUNLOADED +} + +C_DLLEXPORT void AMXX_PluginsUnloading() +{ +#ifdef FN_AMXX_PLUGINSUNLOADING + FN_AMXX_PLUGINSUNLOADING(); +#endif // FN_AMXX_PLUGINSUNLOADING +} + // Advanced MF functions void MF_Log(const char *fmt, ...) { @@ -2743,6 +2770,10 @@ void ValidateMacros_DontCallThis_Smiley() MF_PlayerPropAddr(0, 0); MF_RegAuthFunc(NULL); MF_UnregAuthFunc(NULL); + MF_FindLibrary(NULL, LibType_Class); + MF_AddLibraries(NULL, LibType_Class, NULL); + MF_RemoveLibraries(NULL); + MF_OverrideNatives(NULL); } #endif diff --git a/dlls/csx/source/amxxmodule.h b/dlls/csx/source/amxxmodule.h index 71077bdd..986e0eb4 100755 --- a/dlls/csx/source/amxxmodule.h +++ b/dlls/csx/source/amxxmodule.h @@ -34,7 +34,8 @@ // module interface version was 1 // 2 - added logtag to struct (amxx1.1-rc1) // 3 - added new tagAMX structure (amxx1.5) -#define AMXX_INTERFACE_VERSION 3 +// 4 - added new 'library' setting for direct loading +#define AMXX_INTERFACE_VERSION 4 // amxx module info struct amxx_module_info_s @@ -44,6 +45,8 @@ struct amxx_module_info_s const char *version; int reload; // reload on mapchange when nonzero const char *logtag; // added in version 2 + const char *library; // added in version 4 + const char *libclass; // added in version 4 }; // return values from functions called by amxx @@ -2032,6 +2035,14 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +#ifdef FN_AMXX_PLUGINSUNLOADING +void FN_AMXX_PLUGINSUNLOADING(void); +#endif // FN_AMXX_PLUGINSUNLOADING + +#ifdef FN_AMXX_PLUGINSUNLOADED +void FN_AMXX_PLUGINSUNLOADED(void); +#endif // FN_AMXX_PLUGINSUNLOADED + // *** Types *** typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); @@ -2078,6 +2089,12 @@ enum PlayerProp Player_NewmenuPage, //int }; +enum LibType +{ + LibType_Library, + LibType_Class +}; + typedef void (*AUTHORIZEFUNC)(int player, const char *authstring); typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); @@ -2159,6 +2176,11 @@ typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); typedef int (*PFN_SET_TEAM_INFO) (int /*player */, int /*teamid */, const char * /*name */); typedef void (*PFN_REG_AUTH_FUNC) (AUTHORIZEFUNC); typedef void (*PFN_UNREG_AUTH_FUNC) (AUTHORIZEFUNC); +typedef int (*PFN_FINDLIBRARY) (const char * /*name*/, LibType /*type*/); +typedef size_t (*PFN_ADDLIBRARIES) (const char * /*name*/, LibType /*type*/, void * /*parent*/); +typedef size_t (*PFN_REMOVELIBRARIES) (void * /*parent*/); +typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/); +typedef const char * (*PFN_GETLOCALINFO) (const char * /*name*/, const char * /*def*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2226,6 +2248,11 @@ extern PFN_SET_TEAM_INFO g_fn_SetTeamInfo; extern PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; extern PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; extern PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +extern PFN_FINDLIBRARY g_fn_FindLibrary; +extern PFN_ADDLIBRARIES g_fn_AddLibraries; +extern PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +extern PFN_OVERRIDENATIVES g_fn_OverrideNatives; +extern PFN_GETLOCALINFO g_fn_GetLocalInfo; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2290,6 +2317,11 @@ int MF_SetPlayerTeamInfo (int id, int teamid, const char *teamname) { } void * MF_PlayerPropAddr (int id, int prop) { } void MF_RegAuthFunc (AUTHORIZEFUNC fn) { } void MF_UnregAuthFunc (AUTHORIZEFUNC fn) { } +int MF_FindLibrary (const char *name, LibType type) { } +size_t MF_AddLibraries (const char *name, LibType type, void *parent) { } +size_t MF_RemoveLibraries (void *parent) { } +void MF_OverrideNatives (AMX_NATIVE_INFO *natives) { } +const char * MF_GetLocalInfo (const char *name, const char *def) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2359,6 +2391,11 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_PlayerPropAddr g_fn_PlayerPropAddr #define MF_RegAuthFunc g_fn_RegAuthFunc #define MF_UnregAuthFunc g_fn_UnregAuthFunc +#define MF_FindLibrary g_fn_FindLibrary +#define MF_AddLibraries g_fn_AddLibraries +#define MF_RemoveLibraries g_fn_RemoveLibraries +#define MF_OverrideNatives g_fn_OverrideNatives +#define MF_GetLocalInfo g_fn_GetLocalInfo #ifdef MEMORY_TEST /*** Memory ***/ diff --git a/dlls/csx/source/moduleconfig.h b/dlls/csx/source/moduleconfig.h index 7ad366fe..9bd8ff10 100755 --- a/dlls/csx/source/moduleconfig.h +++ b/dlls/csx/source/moduleconfig.h @@ -5,10 +5,12 @@ // Module info #define MODULE_NAME "CSX" -#define MODULE_VERSION "1.72" +#define MODULE_VERSION "1.75" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org/" #define MODULE_LOGTAG "CSX" +#define MODULE_LIBRARY "csx" +#define MODULE_LIBCLASS "xstats" // If you want the module not to be reloaded on mapchange, remove / comment out the next line #define MODULE_RELOAD_ON_MAPCHANGE @@ -34,19 +36,34 @@ // Uncomment this if you are using MSVC8 or greater and want to fix some of the compatibility issues yourself // #define NO_MSVC8_AUTO_COMPAT -// - AMXX Init functions -// Also consider using FN_META_* -// AMXX query +/** + * AMXX Init functions + * Also consider using FN_META_* + */ + +/** AMXX query */ //#define FN_AMXX_QUERY OnAmxxQuery -// AMXX attach -// Do native functions init here (MF_AddNatives) + +/** AMXX attach + * Do native functions init here (MF_AddNatives) + */ #define FN_AMXX_ATTACH OnAmxxAttach -// AMXX detach + +/** AMXX Detach (unload) */ #define FN_AMXX_DETACH OnAmxxDetach -// All plugins loaded -// Do forward functions init here (MF_RegisterForward) + +/** All plugins loaded + * Do forward functions init here (MF_RegisterForward) + */ #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded +/** All plugins are about to be unloaded */ +//#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading + +/** All plguins are now unloaded */ +//#define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded + + /**** METAMOD ****/ // If your module doesn't use metamod, you may close the file now :) #ifdef USE_METAMOD diff --git a/dlls/dod2/dodfun/amxxmodule.cpp b/dlls/dod2/dodfun/amxxmodule.cpp index 9d92f6f5..30ef9c79 100755 --- a/dlls/dod2/dodfun/amxxmodule.cpp +++ b/dlls/dod2/dodfun/amxxmodule.cpp @@ -2430,7 +2430,9 @@ static amxx_module_info_s g_ModuleInfo = #else // MODULE_RELOAD_ON_MAPCHANGE 0, #endif // MODULE_RELOAD_ON_MAPCHANGE - MODULE_LOGTAG + MODULE_LOGTAG, + MODULE_LIBRARY, + MODULE_LIBCLASS }; // Storage for the requested functions @@ -2506,6 +2508,11 @@ PFN_SET_TEAM_INFO g_fn_SetTeamInfo; PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +PFN_FINDLIBRARY g_fn_FindLibrary; +PFN_ADDLIBRARIES g_fn_AddLibraries; +PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +PFN_OVERRIDENATIVES g_fn_OverrideNatives; +PFN_GETLOCALINFO g_fn_GetLocalInfo; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2620,6 +2627,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("RegAuthFunc", g_fn_RegAuthFunc, PFN_REG_AUTH_FUNC); REQFUNC("UnregAuthFunc", g_fn_UnregAuthFunc, PFN_UNREG_AUTH_FUNC); + REQFUNC("FindLibrary", g_fn_FindLibrary, PFN_FINDLIBRARY); + REQFUNC("AddLibraries", g_fn_AddLibraries, PFN_ADDLIBRARIES); + REQFUNC("RemoveLibraries", g_fn_RemoveLibraries, PFN_REMOVELIBRARIES); + REQFUNC("OverrideNatives", g_fn_OverrideNatives, PFN_OVERRIDENATIVES); + REQFUNC("GetLocalInfo", g_fn_GetLocalInfo, PFN_GETLOCALINFO); + #ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2654,6 +2667,20 @@ C_DLLEXPORT int AMXX_PluginsLoaded() return AMXX_OK; } +C_DLLEXPORT void AMXX_PluginsUnloaded() +{ +#ifdef FN_AMXX_PLUGINSUNLOADED + FN_AMXX_PLUGINSUNLOADED(); +#endif // FN_AMXX_PLUGINSUNLOADED +} + +C_DLLEXPORT void AMXX_PluginsUnloading() +{ +#ifdef FN_AMXX_PLUGINSUNLOADING + FN_AMXX_PLUGINSUNLOADING(); +#endif // FN_AMXX_PLUGINSUNLOADING +} + // Advanced MF functions void MF_Log(const char *fmt, ...) { @@ -2743,6 +2770,10 @@ void ValidateMacros_DontCallThis_Smiley() MF_PlayerPropAddr(0, 0); MF_RegAuthFunc(NULL); MF_UnregAuthFunc(NULL); + MF_FindLibrary(NULL, LibType_Class); + MF_AddLibraries(NULL, LibType_Class, NULL); + MF_RemoveLibraries(NULL); + MF_OverrideNatives(NULL); } #endif diff --git a/dlls/dod2/dodfun/amxxmodule.h b/dlls/dod2/dodfun/amxxmodule.h index 71077bdd..986e0eb4 100755 --- a/dlls/dod2/dodfun/amxxmodule.h +++ b/dlls/dod2/dodfun/amxxmodule.h @@ -34,7 +34,8 @@ // module interface version was 1 // 2 - added logtag to struct (amxx1.1-rc1) // 3 - added new tagAMX structure (amxx1.5) -#define AMXX_INTERFACE_VERSION 3 +// 4 - added new 'library' setting for direct loading +#define AMXX_INTERFACE_VERSION 4 // amxx module info struct amxx_module_info_s @@ -44,6 +45,8 @@ struct amxx_module_info_s const char *version; int reload; // reload on mapchange when nonzero const char *logtag; // added in version 2 + const char *library; // added in version 4 + const char *libclass; // added in version 4 }; // return values from functions called by amxx @@ -2032,6 +2035,14 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +#ifdef FN_AMXX_PLUGINSUNLOADING +void FN_AMXX_PLUGINSUNLOADING(void); +#endif // FN_AMXX_PLUGINSUNLOADING + +#ifdef FN_AMXX_PLUGINSUNLOADED +void FN_AMXX_PLUGINSUNLOADED(void); +#endif // FN_AMXX_PLUGINSUNLOADED + // *** Types *** typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); @@ -2078,6 +2089,12 @@ enum PlayerProp Player_NewmenuPage, //int }; +enum LibType +{ + LibType_Library, + LibType_Class +}; + typedef void (*AUTHORIZEFUNC)(int player, const char *authstring); typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); @@ -2159,6 +2176,11 @@ typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); typedef int (*PFN_SET_TEAM_INFO) (int /*player */, int /*teamid */, const char * /*name */); typedef void (*PFN_REG_AUTH_FUNC) (AUTHORIZEFUNC); typedef void (*PFN_UNREG_AUTH_FUNC) (AUTHORIZEFUNC); +typedef int (*PFN_FINDLIBRARY) (const char * /*name*/, LibType /*type*/); +typedef size_t (*PFN_ADDLIBRARIES) (const char * /*name*/, LibType /*type*/, void * /*parent*/); +typedef size_t (*PFN_REMOVELIBRARIES) (void * /*parent*/); +typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/); +typedef const char * (*PFN_GETLOCALINFO) (const char * /*name*/, const char * /*def*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2226,6 +2248,11 @@ extern PFN_SET_TEAM_INFO g_fn_SetTeamInfo; extern PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; extern PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; extern PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +extern PFN_FINDLIBRARY g_fn_FindLibrary; +extern PFN_ADDLIBRARIES g_fn_AddLibraries; +extern PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +extern PFN_OVERRIDENATIVES g_fn_OverrideNatives; +extern PFN_GETLOCALINFO g_fn_GetLocalInfo; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2290,6 +2317,11 @@ int MF_SetPlayerTeamInfo (int id, int teamid, const char *teamname) { } void * MF_PlayerPropAddr (int id, int prop) { } void MF_RegAuthFunc (AUTHORIZEFUNC fn) { } void MF_UnregAuthFunc (AUTHORIZEFUNC fn) { } +int MF_FindLibrary (const char *name, LibType type) { } +size_t MF_AddLibraries (const char *name, LibType type, void *parent) { } +size_t MF_RemoveLibraries (void *parent) { } +void MF_OverrideNatives (AMX_NATIVE_INFO *natives) { } +const char * MF_GetLocalInfo (const char *name, const char *def) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2359,6 +2391,11 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_PlayerPropAddr g_fn_PlayerPropAddr #define MF_RegAuthFunc g_fn_RegAuthFunc #define MF_UnregAuthFunc g_fn_UnregAuthFunc +#define MF_FindLibrary g_fn_FindLibrary +#define MF_AddLibraries g_fn_AddLibraries +#define MF_RemoveLibraries g_fn_RemoveLibraries +#define MF_OverrideNatives g_fn_OverrideNatives +#define MF_GetLocalInfo g_fn_GetLocalInfo #ifdef MEMORY_TEST /*** Memory ***/ diff --git a/dlls/dod2/dodfun/moduleconfig.h b/dlls/dod2/dodfun/moduleconfig.h index 53946909..e728b60b 100755 --- a/dlls/dod2/dodfun/moduleconfig.h +++ b/dlls/dod2/dodfun/moduleconfig.h @@ -5,10 +5,12 @@ // Module info #define MODULE_NAME "DoD Fun" -#define MODULE_VERSION "1.72" +#define MODULE_VERSION "1.75" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org" #define MODULE_LOGTAG "DODFUN" +#define MODULE_LIBRARY "dodfun" +#define MODULE_LIBCLASS "" // If you want the module not to be reloaded on mapchange, remove / comment out the next line #define MODULE_RELOAD_ON_MAPCHANGE @@ -34,19 +36,34 @@ // Uncomment this if you are using MSVC8 or greater and want to fix some of the compatibility issues yourself // #define NO_MSVC8_AUTO_COMPAT -// - AMXX Init functions -// Also consider using FN_META_* -// AMXX query +/** + * AMXX Init functions + * Also consider using FN_META_* + */ + +/** AMXX query */ //#define FN_AMXX_QUERY OnAmxxQuery -// AMXX attach -// Do native functions init here (MF_AddNatives) + +/** AMXX attach + * Do native functions init here (MF_AddNatives) + */ #define FN_AMXX_ATTACH OnAmxxAttach -// AMXX detach + +/** AMXX Detach (unload) */ //#define FN_AMXX_DETACH OnAmxxDetach -// All plugins loaded -// Do forward functions init here (MF_RegisterForward) + +/** All plugins loaded + * Do forward functions init here (MF_RegisterForward) + */ #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded +/** All plugins are about to be unloaded */ +//#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading + +/** All plguins are now unloaded */ +//#define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded + + /**** METAMOD ****/ // If your module doesn't use metamod, you may close the file now :) #ifdef USE_METAMOD diff --git a/dlls/dod2/dodfun/msvc/dodfun.sln b/dlls/dod2/dodfun/msvc/dodfun.sln new file mode 100644 index 00000000..f53bf4e5 --- /dev/null +++ b/dlls/dod2/dodfun/msvc/dodfun.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dodfun", "dodfun.vcproj", "{2742C607-9FAB-47B3-8A13-E999BC6FDB54}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {2742C607-9FAB-47B3-8A13-E999BC6FDB54}.Debug.ActiveCfg = Debug|Win32 + {2742C607-9FAB-47B3-8A13-E999BC6FDB54}.Debug.Build.0 = Debug|Win32 + {2742C607-9FAB-47B3-8A13-E999BC6FDB54}.Release.ActiveCfg = Release|Win32 + {2742C607-9FAB-47B3-8A13-E999BC6FDB54}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/dlls/dod2/dodx/amxxmodule.cpp b/dlls/dod2/dodx/amxxmodule.cpp index 9d92f6f5..30ef9c79 100755 --- a/dlls/dod2/dodx/amxxmodule.cpp +++ b/dlls/dod2/dodx/amxxmodule.cpp @@ -2430,7 +2430,9 @@ static amxx_module_info_s g_ModuleInfo = #else // MODULE_RELOAD_ON_MAPCHANGE 0, #endif // MODULE_RELOAD_ON_MAPCHANGE - MODULE_LOGTAG + MODULE_LOGTAG, + MODULE_LIBRARY, + MODULE_LIBCLASS }; // Storage for the requested functions @@ -2506,6 +2508,11 @@ PFN_SET_TEAM_INFO g_fn_SetTeamInfo; PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +PFN_FINDLIBRARY g_fn_FindLibrary; +PFN_ADDLIBRARIES g_fn_AddLibraries; +PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +PFN_OVERRIDENATIVES g_fn_OverrideNatives; +PFN_GETLOCALINFO g_fn_GetLocalInfo; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2620,6 +2627,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("RegAuthFunc", g_fn_RegAuthFunc, PFN_REG_AUTH_FUNC); REQFUNC("UnregAuthFunc", g_fn_UnregAuthFunc, PFN_UNREG_AUTH_FUNC); + REQFUNC("FindLibrary", g_fn_FindLibrary, PFN_FINDLIBRARY); + REQFUNC("AddLibraries", g_fn_AddLibraries, PFN_ADDLIBRARIES); + REQFUNC("RemoveLibraries", g_fn_RemoveLibraries, PFN_REMOVELIBRARIES); + REQFUNC("OverrideNatives", g_fn_OverrideNatives, PFN_OVERRIDENATIVES); + REQFUNC("GetLocalInfo", g_fn_GetLocalInfo, PFN_GETLOCALINFO); + #ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2654,6 +2667,20 @@ C_DLLEXPORT int AMXX_PluginsLoaded() return AMXX_OK; } +C_DLLEXPORT void AMXX_PluginsUnloaded() +{ +#ifdef FN_AMXX_PLUGINSUNLOADED + FN_AMXX_PLUGINSUNLOADED(); +#endif // FN_AMXX_PLUGINSUNLOADED +} + +C_DLLEXPORT void AMXX_PluginsUnloading() +{ +#ifdef FN_AMXX_PLUGINSUNLOADING + FN_AMXX_PLUGINSUNLOADING(); +#endif // FN_AMXX_PLUGINSUNLOADING +} + // Advanced MF functions void MF_Log(const char *fmt, ...) { @@ -2743,6 +2770,10 @@ void ValidateMacros_DontCallThis_Smiley() MF_PlayerPropAddr(0, 0); MF_RegAuthFunc(NULL); MF_UnregAuthFunc(NULL); + MF_FindLibrary(NULL, LibType_Class); + MF_AddLibraries(NULL, LibType_Class, NULL); + MF_RemoveLibraries(NULL); + MF_OverrideNatives(NULL); } #endif diff --git a/dlls/dod2/dodx/amxxmodule.h b/dlls/dod2/dodx/amxxmodule.h index 71077bdd..986e0eb4 100755 --- a/dlls/dod2/dodx/amxxmodule.h +++ b/dlls/dod2/dodx/amxxmodule.h @@ -34,7 +34,8 @@ // module interface version was 1 // 2 - added logtag to struct (amxx1.1-rc1) // 3 - added new tagAMX structure (amxx1.5) -#define AMXX_INTERFACE_VERSION 3 +// 4 - added new 'library' setting for direct loading +#define AMXX_INTERFACE_VERSION 4 // amxx module info struct amxx_module_info_s @@ -44,6 +45,8 @@ struct amxx_module_info_s const char *version; int reload; // reload on mapchange when nonzero const char *logtag; // added in version 2 + const char *library; // added in version 4 + const char *libclass; // added in version 4 }; // return values from functions called by amxx @@ -2032,6 +2035,14 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +#ifdef FN_AMXX_PLUGINSUNLOADING +void FN_AMXX_PLUGINSUNLOADING(void); +#endif // FN_AMXX_PLUGINSUNLOADING + +#ifdef FN_AMXX_PLUGINSUNLOADED +void FN_AMXX_PLUGINSUNLOADED(void); +#endif // FN_AMXX_PLUGINSUNLOADED + // *** Types *** typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); @@ -2078,6 +2089,12 @@ enum PlayerProp Player_NewmenuPage, //int }; +enum LibType +{ + LibType_Library, + LibType_Class +}; + typedef void (*AUTHORIZEFUNC)(int player, const char *authstring); typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); @@ -2159,6 +2176,11 @@ typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); typedef int (*PFN_SET_TEAM_INFO) (int /*player */, int /*teamid */, const char * /*name */); typedef void (*PFN_REG_AUTH_FUNC) (AUTHORIZEFUNC); typedef void (*PFN_UNREG_AUTH_FUNC) (AUTHORIZEFUNC); +typedef int (*PFN_FINDLIBRARY) (const char * /*name*/, LibType /*type*/); +typedef size_t (*PFN_ADDLIBRARIES) (const char * /*name*/, LibType /*type*/, void * /*parent*/); +typedef size_t (*PFN_REMOVELIBRARIES) (void * /*parent*/); +typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/); +typedef const char * (*PFN_GETLOCALINFO) (const char * /*name*/, const char * /*def*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2226,6 +2248,11 @@ extern PFN_SET_TEAM_INFO g_fn_SetTeamInfo; extern PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; extern PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; extern PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +extern PFN_FINDLIBRARY g_fn_FindLibrary; +extern PFN_ADDLIBRARIES g_fn_AddLibraries; +extern PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +extern PFN_OVERRIDENATIVES g_fn_OverrideNatives; +extern PFN_GETLOCALINFO g_fn_GetLocalInfo; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2290,6 +2317,11 @@ int MF_SetPlayerTeamInfo (int id, int teamid, const char *teamname) { } void * MF_PlayerPropAddr (int id, int prop) { } void MF_RegAuthFunc (AUTHORIZEFUNC fn) { } void MF_UnregAuthFunc (AUTHORIZEFUNC fn) { } +int MF_FindLibrary (const char *name, LibType type) { } +size_t MF_AddLibraries (const char *name, LibType type, void *parent) { } +size_t MF_RemoveLibraries (void *parent) { } +void MF_OverrideNatives (AMX_NATIVE_INFO *natives) { } +const char * MF_GetLocalInfo (const char *name, const char *def) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2359,6 +2391,11 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_PlayerPropAddr g_fn_PlayerPropAddr #define MF_RegAuthFunc g_fn_RegAuthFunc #define MF_UnregAuthFunc g_fn_UnregAuthFunc +#define MF_FindLibrary g_fn_FindLibrary +#define MF_AddLibraries g_fn_AddLibraries +#define MF_RemoveLibraries g_fn_RemoveLibraries +#define MF_OverrideNatives g_fn_OverrideNatives +#define MF_GetLocalInfo g_fn_GetLocalInfo #ifdef MEMORY_TEST /*** Memory ***/ diff --git a/dlls/dod2/dodx/moduleconfig.h b/dlls/dod2/dodx/moduleconfig.h index a49390ad..fa41a71d 100755 --- a/dlls/dod2/dodx/moduleconfig.h +++ b/dlls/dod2/dodx/moduleconfig.h @@ -5,10 +5,12 @@ // Module info #define MODULE_NAME "DoDX" -#define MODULE_VERSION "1.72" +#define MODULE_VERSION "1.75" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org" #define MODULE_LOGTAG "DODX" +#define MODULE_LIBRARY "dodx" +#define MODULE_LIBCLASS "xstats" // If you want the module not to be reloaded on mapchange, remove / comment out the next line #define MODULE_RELOAD_ON_MAPCHANGE @@ -34,19 +36,34 @@ // Uncomment this if you are using MSVC8 or greater and want to fix some of the compatibility issues yourself // #define NO_MSVC8_AUTO_COMPAT -// - AMXX Init functions -// Also consider using FN_META_* -// AMXX query +/** + * AMXX Init functions + * Also consider using FN_META_* + */ + +/** AMXX query */ //#define FN_AMXX_QUERY OnAmxxQuery -// AMXX attach -// Do native functions init here (MF_AddNatives) + +/** AMXX attach + * Do native functions init here (MF_AddNatives) + */ #define FN_AMXX_ATTACH OnAmxxAttach -// AMXX detach + +/** AMXX Detach (unload) */ #define FN_AMXX_DETACH OnAmxxDetach -// All plugins loaded -// Do forward functions init here (MF_RegisterForward) + +/** All plugins loaded + * Do forward functions init here (MF_RegisterForward) + */ #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded +/** All plugins are about to be unloaded */ +//#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading + +/** All plguins are now unloaded */ +//#define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded + + /**** METAMOD ****/ // If your module doesn't use metamod, you may close the file now :) #ifdef USE_METAMOD diff --git a/dlls/dod2/dodx/msvc/dodx.sln b/dlls/dod2/dodx/msvc/dodx.sln new file mode 100644 index 00000000..01d1e182 --- /dev/null +++ b/dlls/dod2/dodx/msvc/dodx.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dodx", "dodx.vcproj", "{9008A886-2DD0-443C-B468-AD84868D89B0}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {9008A886-2DD0-443C-B468-AD84868D89B0}.Debug.ActiveCfg = Debug|Win32 + {9008A886-2DD0-443C-B468-AD84868D89B0}.Debug.Build.0 = Debug|Win32 + {9008A886-2DD0-443C-B468-AD84868D89B0}.Release.ActiveCfg = Release|Win32 + {9008A886-2DD0-443C-B468-AD84868D89B0}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/dlls/fakemeta/sdk/amxxmodule.cpp b/dlls/fakemeta/sdk/amxxmodule.cpp index 9d92f6f5..30ef9c79 100755 --- a/dlls/fakemeta/sdk/amxxmodule.cpp +++ b/dlls/fakemeta/sdk/amxxmodule.cpp @@ -2430,7 +2430,9 @@ static amxx_module_info_s g_ModuleInfo = #else // MODULE_RELOAD_ON_MAPCHANGE 0, #endif // MODULE_RELOAD_ON_MAPCHANGE - MODULE_LOGTAG + MODULE_LOGTAG, + MODULE_LIBRARY, + MODULE_LIBCLASS }; // Storage for the requested functions @@ -2506,6 +2508,11 @@ PFN_SET_TEAM_INFO g_fn_SetTeamInfo; PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +PFN_FINDLIBRARY g_fn_FindLibrary; +PFN_ADDLIBRARIES g_fn_AddLibraries; +PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +PFN_OVERRIDENATIVES g_fn_OverrideNatives; +PFN_GETLOCALINFO g_fn_GetLocalInfo; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2620,6 +2627,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("RegAuthFunc", g_fn_RegAuthFunc, PFN_REG_AUTH_FUNC); REQFUNC("UnregAuthFunc", g_fn_UnregAuthFunc, PFN_UNREG_AUTH_FUNC); + REQFUNC("FindLibrary", g_fn_FindLibrary, PFN_FINDLIBRARY); + REQFUNC("AddLibraries", g_fn_AddLibraries, PFN_ADDLIBRARIES); + REQFUNC("RemoveLibraries", g_fn_RemoveLibraries, PFN_REMOVELIBRARIES); + REQFUNC("OverrideNatives", g_fn_OverrideNatives, PFN_OVERRIDENATIVES); + REQFUNC("GetLocalInfo", g_fn_GetLocalInfo, PFN_GETLOCALINFO); + #ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2654,6 +2667,20 @@ C_DLLEXPORT int AMXX_PluginsLoaded() return AMXX_OK; } +C_DLLEXPORT void AMXX_PluginsUnloaded() +{ +#ifdef FN_AMXX_PLUGINSUNLOADED + FN_AMXX_PLUGINSUNLOADED(); +#endif // FN_AMXX_PLUGINSUNLOADED +} + +C_DLLEXPORT void AMXX_PluginsUnloading() +{ +#ifdef FN_AMXX_PLUGINSUNLOADING + FN_AMXX_PLUGINSUNLOADING(); +#endif // FN_AMXX_PLUGINSUNLOADING +} + // Advanced MF functions void MF_Log(const char *fmt, ...) { @@ -2743,6 +2770,10 @@ void ValidateMacros_DontCallThis_Smiley() MF_PlayerPropAddr(0, 0); MF_RegAuthFunc(NULL); MF_UnregAuthFunc(NULL); + MF_FindLibrary(NULL, LibType_Class); + MF_AddLibraries(NULL, LibType_Class, NULL); + MF_RemoveLibraries(NULL); + MF_OverrideNatives(NULL); } #endif diff --git a/dlls/fakemeta/sdk/amxxmodule.h b/dlls/fakemeta/sdk/amxxmodule.h index 71077bdd..986e0eb4 100755 --- a/dlls/fakemeta/sdk/amxxmodule.h +++ b/dlls/fakemeta/sdk/amxxmodule.h @@ -34,7 +34,8 @@ // module interface version was 1 // 2 - added logtag to struct (amxx1.1-rc1) // 3 - added new tagAMX structure (amxx1.5) -#define AMXX_INTERFACE_VERSION 3 +// 4 - added new 'library' setting for direct loading +#define AMXX_INTERFACE_VERSION 4 // amxx module info struct amxx_module_info_s @@ -44,6 +45,8 @@ struct amxx_module_info_s const char *version; int reload; // reload on mapchange when nonzero const char *logtag; // added in version 2 + const char *library; // added in version 4 + const char *libclass; // added in version 4 }; // return values from functions called by amxx @@ -2032,6 +2035,14 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +#ifdef FN_AMXX_PLUGINSUNLOADING +void FN_AMXX_PLUGINSUNLOADING(void); +#endif // FN_AMXX_PLUGINSUNLOADING + +#ifdef FN_AMXX_PLUGINSUNLOADED +void FN_AMXX_PLUGINSUNLOADED(void); +#endif // FN_AMXX_PLUGINSUNLOADED + // *** Types *** typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); @@ -2078,6 +2089,12 @@ enum PlayerProp Player_NewmenuPage, //int }; +enum LibType +{ + LibType_Library, + LibType_Class +}; + typedef void (*AUTHORIZEFUNC)(int player, const char *authstring); typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); @@ -2159,6 +2176,11 @@ typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); typedef int (*PFN_SET_TEAM_INFO) (int /*player */, int /*teamid */, const char * /*name */); typedef void (*PFN_REG_AUTH_FUNC) (AUTHORIZEFUNC); typedef void (*PFN_UNREG_AUTH_FUNC) (AUTHORIZEFUNC); +typedef int (*PFN_FINDLIBRARY) (const char * /*name*/, LibType /*type*/); +typedef size_t (*PFN_ADDLIBRARIES) (const char * /*name*/, LibType /*type*/, void * /*parent*/); +typedef size_t (*PFN_REMOVELIBRARIES) (void * /*parent*/); +typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/); +typedef const char * (*PFN_GETLOCALINFO) (const char * /*name*/, const char * /*def*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2226,6 +2248,11 @@ extern PFN_SET_TEAM_INFO g_fn_SetTeamInfo; extern PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; extern PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; extern PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +extern PFN_FINDLIBRARY g_fn_FindLibrary; +extern PFN_ADDLIBRARIES g_fn_AddLibraries; +extern PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +extern PFN_OVERRIDENATIVES g_fn_OverrideNatives; +extern PFN_GETLOCALINFO g_fn_GetLocalInfo; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2290,6 +2317,11 @@ int MF_SetPlayerTeamInfo (int id, int teamid, const char *teamname) { } void * MF_PlayerPropAddr (int id, int prop) { } void MF_RegAuthFunc (AUTHORIZEFUNC fn) { } void MF_UnregAuthFunc (AUTHORIZEFUNC fn) { } +int MF_FindLibrary (const char *name, LibType type) { } +size_t MF_AddLibraries (const char *name, LibType type, void *parent) { } +size_t MF_RemoveLibraries (void *parent) { } +void MF_OverrideNatives (AMX_NATIVE_INFO *natives) { } +const char * MF_GetLocalInfo (const char *name, const char *def) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2359,6 +2391,11 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_PlayerPropAddr g_fn_PlayerPropAddr #define MF_RegAuthFunc g_fn_RegAuthFunc #define MF_UnregAuthFunc g_fn_UnregAuthFunc +#define MF_FindLibrary g_fn_FindLibrary +#define MF_AddLibraries g_fn_AddLibraries +#define MF_RemoveLibraries g_fn_RemoveLibraries +#define MF_OverrideNatives g_fn_OverrideNatives +#define MF_GetLocalInfo g_fn_GetLocalInfo #ifdef MEMORY_TEST /*** Memory ***/ diff --git a/dlls/fakemeta/sdk/moduleconfig.h b/dlls/fakemeta/sdk/moduleconfig.h index 0a788316..63f0c49a 100755 --- a/dlls/fakemeta/sdk/moduleconfig.h +++ b/dlls/fakemeta/sdk/moduleconfig.h @@ -5,10 +5,12 @@ // Module info #define MODULE_NAME "FakeMeta" -#define MODULE_VERSION "1.72" +#define MODULE_VERSION "1.75" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org" #define MODULE_LOGTAG "FAKEMETA" +#define MODULE_LIBRARY "fakemeta" +#define MODULE_LIBCLASS "" // If you want the module not to be reloaded on mapchange, remove / comment out the next line #define MODULE_RELOAD_ON_MAPCHANGE @@ -34,18 +36,33 @@ // Uncomment this if you are using MSVC8 or greater and want to fix some of the compatibility issues yourself // #define NO_MSVC8_AUTO_COMPAT -// - AMXX Init functions -// Also consider using FN_META_* -// AMXX query +/** + * AMXX Init functions + * Also consider using FN_META_* + */ + +/** AMXX query */ //#define FN_AMXX_QUERY OnAmxxQuery -// AMXX attach -// Do native functions init here (MF_AddNatives) + +/** AMXX attach + * Do native functions init here (MF_AddNatives) + */ #define FN_AMXX_ATTACH OnAmxxAttach -// AMXX detach + +/** AMXX Detach (unload) */ //#define FN_AMXX_DETACH OnAmxxDetach -// All plugins loaded -// Do forward functions init here (MF_RegisterForward) -// #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded + +/** All plugins loaded + * Do forward functions init here (MF_RegisterForward) + */ +//#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded + +/** All plugins are about to be unloaded */ +//#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading + +/** All plguins are now unloaded */ +//#define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded + /**** METAMOD ****/ // If your module doesn't use metamod, you may close the file now :) diff --git a/dlls/geoip/amxxmodule.cpp b/dlls/geoip/amxxmodule.cpp index 9d92f6f5..30ef9c79 100755 --- a/dlls/geoip/amxxmodule.cpp +++ b/dlls/geoip/amxxmodule.cpp @@ -2430,7 +2430,9 @@ static amxx_module_info_s g_ModuleInfo = #else // MODULE_RELOAD_ON_MAPCHANGE 0, #endif // MODULE_RELOAD_ON_MAPCHANGE - MODULE_LOGTAG + MODULE_LOGTAG, + MODULE_LIBRARY, + MODULE_LIBCLASS }; // Storage for the requested functions @@ -2506,6 +2508,11 @@ PFN_SET_TEAM_INFO g_fn_SetTeamInfo; PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +PFN_FINDLIBRARY g_fn_FindLibrary; +PFN_ADDLIBRARIES g_fn_AddLibraries; +PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +PFN_OVERRIDENATIVES g_fn_OverrideNatives; +PFN_GETLOCALINFO g_fn_GetLocalInfo; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2620,6 +2627,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("RegAuthFunc", g_fn_RegAuthFunc, PFN_REG_AUTH_FUNC); REQFUNC("UnregAuthFunc", g_fn_UnregAuthFunc, PFN_UNREG_AUTH_FUNC); + REQFUNC("FindLibrary", g_fn_FindLibrary, PFN_FINDLIBRARY); + REQFUNC("AddLibraries", g_fn_AddLibraries, PFN_ADDLIBRARIES); + REQFUNC("RemoveLibraries", g_fn_RemoveLibraries, PFN_REMOVELIBRARIES); + REQFUNC("OverrideNatives", g_fn_OverrideNatives, PFN_OVERRIDENATIVES); + REQFUNC("GetLocalInfo", g_fn_GetLocalInfo, PFN_GETLOCALINFO); + #ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2654,6 +2667,20 @@ C_DLLEXPORT int AMXX_PluginsLoaded() return AMXX_OK; } +C_DLLEXPORT void AMXX_PluginsUnloaded() +{ +#ifdef FN_AMXX_PLUGINSUNLOADED + FN_AMXX_PLUGINSUNLOADED(); +#endif // FN_AMXX_PLUGINSUNLOADED +} + +C_DLLEXPORT void AMXX_PluginsUnloading() +{ +#ifdef FN_AMXX_PLUGINSUNLOADING + FN_AMXX_PLUGINSUNLOADING(); +#endif // FN_AMXX_PLUGINSUNLOADING +} + // Advanced MF functions void MF_Log(const char *fmt, ...) { @@ -2743,6 +2770,10 @@ void ValidateMacros_DontCallThis_Smiley() MF_PlayerPropAddr(0, 0); MF_RegAuthFunc(NULL); MF_UnregAuthFunc(NULL); + MF_FindLibrary(NULL, LibType_Class); + MF_AddLibraries(NULL, LibType_Class, NULL); + MF_RemoveLibraries(NULL); + MF_OverrideNatives(NULL); } #endif diff --git a/dlls/geoip/amxxmodule.h b/dlls/geoip/amxxmodule.h index 71077bdd..986e0eb4 100755 --- a/dlls/geoip/amxxmodule.h +++ b/dlls/geoip/amxxmodule.h @@ -34,7 +34,8 @@ // module interface version was 1 // 2 - added logtag to struct (amxx1.1-rc1) // 3 - added new tagAMX structure (amxx1.5) -#define AMXX_INTERFACE_VERSION 3 +// 4 - added new 'library' setting for direct loading +#define AMXX_INTERFACE_VERSION 4 // amxx module info struct amxx_module_info_s @@ -44,6 +45,8 @@ struct amxx_module_info_s const char *version; int reload; // reload on mapchange when nonzero const char *logtag; // added in version 2 + const char *library; // added in version 4 + const char *libclass; // added in version 4 }; // return values from functions called by amxx @@ -2032,6 +2035,14 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +#ifdef FN_AMXX_PLUGINSUNLOADING +void FN_AMXX_PLUGINSUNLOADING(void); +#endif // FN_AMXX_PLUGINSUNLOADING + +#ifdef FN_AMXX_PLUGINSUNLOADED +void FN_AMXX_PLUGINSUNLOADED(void); +#endif // FN_AMXX_PLUGINSUNLOADED + // *** Types *** typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); @@ -2078,6 +2089,12 @@ enum PlayerProp Player_NewmenuPage, //int }; +enum LibType +{ + LibType_Library, + LibType_Class +}; + typedef void (*AUTHORIZEFUNC)(int player, const char *authstring); typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); @@ -2159,6 +2176,11 @@ typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); typedef int (*PFN_SET_TEAM_INFO) (int /*player */, int /*teamid */, const char * /*name */); typedef void (*PFN_REG_AUTH_FUNC) (AUTHORIZEFUNC); typedef void (*PFN_UNREG_AUTH_FUNC) (AUTHORIZEFUNC); +typedef int (*PFN_FINDLIBRARY) (const char * /*name*/, LibType /*type*/); +typedef size_t (*PFN_ADDLIBRARIES) (const char * /*name*/, LibType /*type*/, void * /*parent*/); +typedef size_t (*PFN_REMOVELIBRARIES) (void * /*parent*/); +typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/); +typedef const char * (*PFN_GETLOCALINFO) (const char * /*name*/, const char * /*def*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2226,6 +2248,11 @@ extern PFN_SET_TEAM_INFO g_fn_SetTeamInfo; extern PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; extern PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; extern PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +extern PFN_FINDLIBRARY g_fn_FindLibrary; +extern PFN_ADDLIBRARIES g_fn_AddLibraries; +extern PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +extern PFN_OVERRIDENATIVES g_fn_OverrideNatives; +extern PFN_GETLOCALINFO g_fn_GetLocalInfo; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2290,6 +2317,11 @@ int MF_SetPlayerTeamInfo (int id, int teamid, const char *teamname) { } void * MF_PlayerPropAddr (int id, int prop) { } void MF_RegAuthFunc (AUTHORIZEFUNC fn) { } void MF_UnregAuthFunc (AUTHORIZEFUNC fn) { } +int MF_FindLibrary (const char *name, LibType type) { } +size_t MF_AddLibraries (const char *name, LibType type, void *parent) { } +size_t MF_RemoveLibraries (void *parent) { } +void MF_OverrideNatives (AMX_NATIVE_INFO *natives) { } +const char * MF_GetLocalInfo (const char *name, const char *def) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2359,6 +2391,11 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_PlayerPropAddr g_fn_PlayerPropAddr #define MF_RegAuthFunc g_fn_RegAuthFunc #define MF_UnregAuthFunc g_fn_UnregAuthFunc +#define MF_FindLibrary g_fn_FindLibrary +#define MF_AddLibraries g_fn_AddLibraries +#define MF_RemoveLibraries g_fn_RemoveLibraries +#define MF_OverrideNatives g_fn_OverrideNatives +#define MF_GetLocalInfo g_fn_GetLocalInfo #ifdef MEMORY_TEST /*** Memory ***/ diff --git a/dlls/geoip/geoip_amxx.cpp b/dlls/geoip/geoip_amxx.cpp index 99534cf5..d65ad5e3 100755 --- a/dlls/geoip/geoip_amxx.cpp +++ b/dlls/geoip/geoip_amxx.cpp @@ -28,7 +28,7 @@ static cell AMX_NATIVE_CALL amx_geoip_country(AMX *amx, cell *params) void OnAmxxAttach() { - char *path = MF_BuildPathname("%s/GeoIP.dat",LOCALINFO("amxx_datadir")); + char *path = MF_BuildPathname("%s/GeoIP.dat",MF_GetLocalInfo("amxx_datadir", "addons/amxmodx/data")); gi = GeoIP_open(path, GEOIP_STANDARD); if (gi == NULL) { MF_Log("Failed to instantiate GeoIP!"); diff --git a/dlls/geoip/moduleconfig.h b/dlls/geoip/moduleconfig.h index 01e51dc9..50fdf546 100755 --- a/dlls/geoip/moduleconfig.h +++ b/dlls/geoip/moduleconfig.h @@ -5,10 +5,12 @@ // Module info #define MODULE_NAME "GeoIP" -#define MODULE_VERSION "1.72" +#define MODULE_VERSION "1.75" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org/" #define MODULE_LOGTAG "GEOIP" +#define MODULE_LIBRARY "geoip" +#define MODULE_LIBCLASS "" // If you want the module not to be reloaded on mapchange, remove / comment out the next line //#define MODULE_RELOAD_ON_MAPCHANGE @@ -19,7 +21,7 @@ #endif // __DATE__ // metamod plugin? -#define USE_METAMOD +//#define USE_METAMOD // use memory manager/tester? // note that if you use this, you cannot construct/allocate @@ -34,18 +36,33 @@ // Uncomment this if you are using MSVC8 or greater and want to fix some of the compatibility issues yourself // #define NO_MSVC8_AUTO_COMPAT -// - AMXX Init functions -// Also consider using FN_META_* -// AMXX query +/** + * AMXX Init functions + * Also consider using FN_META_* + */ + +/** AMXX query */ //#define FN_AMXX_QUERY OnAmxxQuery -// AMXX attach -// Do native functions init here (MF_AddNatives) + +/** AMXX attach + * Do native functions init here (MF_AddNatives) + */ #define FN_AMXX_ATTACH OnAmxxAttach -// AMXX detach + +/** AMXX Detach (unload) */ #define FN_AMXX_DETACH OnAmxxDetach -// All plugins loaded -// Do forward functions init here (MF_RegisterForward) -// #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded + +/** All plugins loaded + * Do forward functions init here (MF_RegisterForward) + */ +//#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded + +/** All plugins are about to be unloaded */ +//#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading + +/** All plguins are now unloaded */ +//#define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded + /**** METAMOD ****/ // If your module doesn't use metamod, you may close the file now :) diff --git a/dlls/ns/ns/amxxmodule.cpp b/dlls/ns/ns/amxxmodule.cpp index 9d92f6f5..30ef9c79 100755 --- a/dlls/ns/ns/amxxmodule.cpp +++ b/dlls/ns/ns/amxxmodule.cpp @@ -2430,7 +2430,9 @@ static amxx_module_info_s g_ModuleInfo = #else // MODULE_RELOAD_ON_MAPCHANGE 0, #endif // MODULE_RELOAD_ON_MAPCHANGE - MODULE_LOGTAG + MODULE_LOGTAG, + MODULE_LIBRARY, + MODULE_LIBCLASS }; // Storage for the requested functions @@ -2506,6 +2508,11 @@ PFN_SET_TEAM_INFO g_fn_SetTeamInfo; PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +PFN_FINDLIBRARY g_fn_FindLibrary; +PFN_ADDLIBRARIES g_fn_AddLibraries; +PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +PFN_OVERRIDENATIVES g_fn_OverrideNatives; +PFN_GETLOCALINFO g_fn_GetLocalInfo; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2620,6 +2627,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("RegAuthFunc", g_fn_RegAuthFunc, PFN_REG_AUTH_FUNC); REQFUNC("UnregAuthFunc", g_fn_UnregAuthFunc, PFN_UNREG_AUTH_FUNC); + REQFUNC("FindLibrary", g_fn_FindLibrary, PFN_FINDLIBRARY); + REQFUNC("AddLibraries", g_fn_AddLibraries, PFN_ADDLIBRARIES); + REQFUNC("RemoveLibraries", g_fn_RemoveLibraries, PFN_REMOVELIBRARIES); + REQFUNC("OverrideNatives", g_fn_OverrideNatives, PFN_OVERRIDENATIVES); + REQFUNC("GetLocalInfo", g_fn_GetLocalInfo, PFN_GETLOCALINFO); + #ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2654,6 +2667,20 @@ C_DLLEXPORT int AMXX_PluginsLoaded() return AMXX_OK; } +C_DLLEXPORT void AMXX_PluginsUnloaded() +{ +#ifdef FN_AMXX_PLUGINSUNLOADED + FN_AMXX_PLUGINSUNLOADED(); +#endif // FN_AMXX_PLUGINSUNLOADED +} + +C_DLLEXPORT void AMXX_PluginsUnloading() +{ +#ifdef FN_AMXX_PLUGINSUNLOADING + FN_AMXX_PLUGINSUNLOADING(); +#endif // FN_AMXX_PLUGINSUNLOADING +} + // Advanced MF functions void MF_Log(const char *fmt, ...) { @@ -2743,6 +2770,10 @@ void ValidateMacros_DontCallThis_Smiley() MF_PlayerPropAddr(0, 0); MF_RegAuthFunc(NULL); MF_UnregAuthFunc(NULL); + MF_FindLibrary(NULL, LibType_Class); + MF_AddLibraries(NULL, LibType_Class, NULL); + MF_RemoveLibraries(NULL); + MF_OverrideNatives(NULL); } #endif diff --git a/dlls/ns/ns/amxxmodule.h b/dlls/ns/ns/amxxmodule.h index 71077bdd..986e0eb4 100755 --- a/dlls/ns/ns/amxxmodule.h +++ b/dlls/ns/ns/amxxmodule.h @@ -34,7 +34,8 @@ // module interface version was 1 // 2 - added logtag to struct (amxx1.1-rc1) // 3 - added new tagAMX structure (amxx1.5) -#define AMXX_INTERFACE_VERSION 3 +// 4 - added new 'library' setting for direct loading +#define AMXX_INTERFACE_VERSION 4 // amxx module info struct amxx_module_info_s @@ -44,6 +45,8 @@ struct amxx_module_info_s const char *version; int reload; // reload on mapchange when nonzero const char *logtag; // added in version 2 + const char *library; // added in version 4 + const char *libclass; // added in version 4 }; // return values from functions called by amxx @@ -2032,6 +2035,14 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +#ifdef FN_AMXX_PLUGINSUNLOADING +void FN_AMXX_PLUGINSUNLOADING(void); +#endif // FN_AMXX_PLUGINSUNLOADING + +#ifdef FN_AMXX_PLUGINSUNLOADED +void FN_AMXX_PLUGINSUNLOADED(void); +#endif // FN_AMXX_PLUGINSUNLOADED + // *** Types *** typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); @@ -2078,6 +2089,12 @@ enum PlayerProp Player_NewmenuPage, //int }; +enum LibType +{ + LibType_Library, + LibType_Class +}; + typedef void (*AUTHORIZEFUNC)(int player, const char *authstring); typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); @@ -2159,6 +2176,11 @@ typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); typedef int (*PFN_SET_TEAM_INFO) (int /*player */, int /*teamid */, const char * /*name */); typedef void (*PFN_REG_AUTH_FUNC) (AUTHORIZEFUNC); typedef void (*PFN_UNREG_AUTH_FUNC) (AUTHORIZEFUNC); +typedef int (*PFN_FINDLIBRARY) (const char * /*name*/, LibType /*type*/); +typedef size_t (*PFN_ADDLIBRARIES) (const char * /*name*/, LibType /*type*/, void * /*parent*/); +typedef size_t (*PFN_REMOVELIBRARIES) (void * /*parent*/); +typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/); +typedef const char * (*PFN_GETLOCALINFO) (const char * /*name*/, const char * /*def*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2226,6 +2248,11 @@ extern PFN_SET_TEAM_INFO g_fn_SetTeamInfo; extern PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; extern PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; extern PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +extern PFN_FINDLIBRARY g_fn_FindLibrary; +extern PFN_ADDLIBRARIES g_fn_AddLibraries; +extern PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +extern PFN_OVERRIDENATIVES g_fn_OverrideNatives; +extern PFN_GETLOCALINFO g_fn_GetLocalInfo; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2290,6 +2317,11 @@ int MF_SetPlayerTeamInfo (int id, int teamid, const char *teamname) { } void * MF_PlayerPropAddr (int id, int prop) { } void MF_RegAuthFunc (AUTHORIZEFUNC fn) { } void MF_UnregAuthFunc (AUTHORIZEFUNC fn) { } +int MF_FindLibrary (const char *name, LibType type) { } +size_t MF_AddLibraries (const char *name, LibType type, void *parent) { } +size_t MF_RemoveLibraries (void *parent) { } +void MF_OverrideNatives (AMX_NATIVE_INFO *natives) { } +const char * MF_GetLocalInfo (const char *name, const char *def) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2359,6 +2391,11 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_PlayerPropAddr g_fn_PlayerPropAddr #define MF_RegAuthFunc g_fn_RegAuthFunc #define MF_UnregAuthFunc g_fn_UnregAuthFunc +#define MF_FindLibrary g_fn_FindLibrary +#define MF_AddLibraries g_fn_AddLibraries +#define MF_RemoveLibraries g_fn_RemoveLibraries +#define MF_OverrideNatives g_fn_OverrideNatives +#define MF_GetLocalInfo g_fn_GetLocalInfo #ifdef MEMORY_TEST /*** Memory ***/ diff --git a/dlls/ns/ns/moduleconfig.h b/dlls/ns/ns/moduleconfig.h index 5aad2194..f0c5a76c 100755 --- a/dlls/ns/ns/moduleconfig.h +++ b/dlls/ns/ns/moduleconfig.h @@ -5,10 +5,12 @@ // Module info #define MODULE_NAME "NS" -#define MODULE_VERSION "1.72" +#define MODULE_VERSION "1.75" #define MODULE_AUTHOR "Steve Dudenhoeffer" #define MODULE_URL "http://www.amxmodx.org/" #define MODULE_LOGTAG "NS" +#define MODULE_LIBRARY "ns" +#define MODULE_LIBCLASS "" // If you want the module not to be reloaded on mapchange, remove / comment out the next line #define MODULE_RELOAD_ON_MAPCHANGE @@ -34,19 +36,33 @@ // Uncomment this if you are using MSVC8 or greater and want to fix some of the compatibility issues yourself // #define NO_MSVC8_AUTO_COMPAT -// - AMXX Init functions -// Also consider using FN_META_* -// AMXX query +/** + * AMXX Init functions + * Also consider using FN_META_* + */ + +/** AMXX query */ //#define FN_AMXX_QUERY OnAmxxQuery -// AMXX attach -// Do native functions init here (MF_AddNatives) + +/** AMXX attach + * Do native functions init here (MF_AddNatives) + */ #define FN_AMXX_ATTACH OnAmxxAttach -// AMXX detach + +/** AMXX Detach (unload) */ //#define FN_AMXX_DETACH OnAmxxDetach -// All plugins loaded -// Do forward functions init here (MF_RegisterForward) + +/** All plugins loaded + * Do forward functions init here (MF_RegisterForward) + */ #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded +/** All plugins are about to be unloaded */ +//#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading + +/** All plguins are now unloaded */ +//#define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded + /**** METAMOD ****/ // If your module doesn't use metamod, you may close the file now :) #ifdef USE_METAMOD diff --git a/dlls/nvault/amxxapi.cpp b/dlls/nvault/amxxapi.cpp index f15a84e5..0db10fa8 100755 --- a/dlls/nvault/amxxapi.cpp +++ b/dlls/nvault/amxxapi.cpp @@ -25,7 +25,7 @@ static cell nvault_open(AMX *amx, cell *params) int len, id=-1; char *name = MF_GetAmxString(amx, params[1], 0, &len); char path[255], file[255]; - MF_BuildPathnameR(path, sizeof(path)-1, "%s/vault", LOCALINFO("amxx_datadir")); + MF_BuildPathnameR(path, sizeof(path)-1, "%s/vault", MF_GetLocalInfo("amxx_datadir", "addons/amxmodx/data")); sprintf(file, "%s/%s.vault", path, name); for (size_t i=0; i - - diff --git a/dlls/regex/amxxmodule.cpp b/dlls/regex/amxxmodule.cpp index 9d92f6f5..73d69197 100755 --- a/dlls/regex/amxxmodule.cpp +++ b/dlls/regex/amxxmodule.cpp @@ -2430,7 +2430,9 @@ static amxx_module_info_s g_ModuleInfo = #else // MODULE_RELOAD_ON_MAPCHANGE 0, #endif // MODULE_RELOAD_ON_MAPCHANGE - MODULE_LOGTAG + MODULE_LOGTAG, + MODULE_LIBRARY, + MODULE_LIBCLASS }; // Storage for the requested functions @@ -2506,6 +2508,10 @@ PFN_SET_TEAM_INFO g_fn_SetTeamInfo; PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +PFN_FINDLIBRARY g_fn_FindLibrary; +PFN_ADDLIBRARIES g_fn_AddLibraries; +PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +PFN_OVERRIDENATIVES g_fn_OverrideNatives; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2620,6 +2626,11 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("RegAuthFunc", g_fn_RegAuthFunc, PFN_REG_AUTH_FUNC); REQFUNC("UnregAuthFunc", g_fn_UnregAuthFunc, PFN_UNREG_AUTH_FUNC); + REQFUNC("FindLibrary", g_fn_FindLibrary, PFN_FINDLIBRARY); + REQFUNC("AddLibraries", g_fn_AddLibraries, PFN_ADDLIBRARIES); + REQFUNC("RemoveLibraries", g_fn_RemoveLibraries, PFN_REMOVELIBRARIES); + REQFUNC("OverrideNatives", g_fn_OverrideNatives, PFN_OVERRIDENATIVES); + #ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2654,6 +2665,20 @@ C_DLLEXPORT int AMXX_PluginsLoaded() return AMXX_OK; } +C_DLLEXPORT void AMXX_PluginsUnloaded() +{ +#ifdef FN_AMXX_PLUGINSUNLOADED + FN_AMXX_PLUGINSUNLOADED(); +#endif // FN_AMXX_PLUGINSUNLOADED +} + +C_DLLEXPORT void AMXX_PluginsUnloading() +{ +#ifdef FN_AMXX_PLUGINSUNLOADING + FN_AMXX_PLUGINSUNLOADING(); +#endif // FN_AMXX_PLUGINSUNLOADING +} + // Advanced MF functions void MF_Log(const char *fmt, ...) { @@ -2743,6 +2768,10 @@ void ValidateMacros_DontCallThis_Smiley() MF_PlayerPropAddr(0, 0); MF_RegAuthFunc(NULL); MF_UnregAuthFunc(NULL); + MF_FindLibrary(NULL, LibType_Class); + MF_AddLibraries(NULL, LibType_Class, NULL); + MF_RemoveLibraries(NULL); + MF_OverrideNatives(NULL); } #endif diff --git a/dlls/regex/amxxmodule.h b/dlls/regex/amxxmodule.h index 71077bdd..a84443b5 100755 --- a/dlls/regex/amxxmodule.h +++ b/dlls/regex/amxxmodule.h @@ -34,7 +34,8 @@ // module interface version was 1 // 2 - added logtag to struct (amxx1.1-rc1) // 3 - added new tagAMX structure (amxx1.5) -#define AMXX_INTERFACE_VERSION 3 +// 4 - added new 'library' setting for direct loading +#define AMXX_INTERFACE_VERSION 4 // amxx module info struct amxx_module_info_s @@ -44,6 +45,8 @@ struct amxx_module_info_s const char *version; int reload; // reload on mapchange when nonzero const char *logtag; // added in version 2 + const char *library; // added in version 4 + const char *libclass; // added in version 4 }; // return values from functions called by amxx @@ -2032,6 +2035,14 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +#ifdef FN_AMXX_PLUGINSUNLOADING +void FN_AMXX_PLUGINSUNLOADING(void); +#endif // FN_AMXX_PLUGINSUNLOADING + +#ifdef FN_AMXX_PLUGINSUNLOADED +void FN_AMXX_PLUGINSUNLOADED(void); +#endif // FN_AMXX_PLUGINSUNLOADED + // *** Types *** typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); @@ -2078,6 +2089,12 @@ enum PlayerProp Player_NewmenuPage, //int }; +enum LibType +{ + LibType_Library, + LibType_Class +}; + typedef void (*AUTHORIZEFUNC)(int player, const char *authstring); typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); @@ -2159,6 +2176,10 @@ typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); typedef int (*PFN_SET_TEAM_INFO) (int /*player */, int /*teamid */, const char * /*name */); typedef void (*PFN_REG_AUTH_FUNC) (AUTHORIZEFUNC); typedef void (*PFN_UNREG_AUTH_FUNC) (AUTHORIZEFUNC); +typedef int (*PFN_FINDLIBRARY) (const char * /*name*/, LibType /*type*/); +typedef size_t (*PFN_ADDLIBRARIES) (const char * /*name*/, LibType /*type*/, void * /*parent*/); +typedef size_t (*PFN_REMOVELIBRARIES) (void * /*parent*/); +typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2226,6 +2247,10 @@ extern PFN_SET_TEAM_INFO g_fn_SetTeamInfo; extern PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; extern PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; extern PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +extern PFN_FINDLIBRARY g_fn_FindLibrary; +extern PFN_ADDLIBRARIES g_fn_AddLibraries; +extern PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +extern PFN_OVERRIDENATIVES g_fn_OverrideNatives; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2290,6 +2315,10 @@ int MF_SetPlayerTeamInfo (int id, int teamid, const char *teamname) { } void * MF_PlayerPropAddr (int id, int prop) { } void MF_RegAuthFunc (AUTHORIZEFUNC fn) { } void MF_UnregAuthFunc (AUTHORIZEFUNC fn) { } +int MF_FindLibrary (const char *name, LibType type) { } +size_t MF_AddLibraries (const char *name, LibType type, void *parent) { } +size_t MF_RemoveLibraries (void *parent) { } +void MF_OverrideNatives (AMX_NATIVE_INFO *natives) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2359,6 +2388,10 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_PlayerPropAddr g_fn_PlayerPropAddr #define MF_RegAuthFunc g_fn_RegAuthFunc #define MF_UnregAuthFunc g_fn_UnregAuthFunc +#define MF_FindLibrary g_fn_FindLibrary; +#define MF_AddLibraries g_fn_AddLibraries; +#define MF_RemoveLibraries g_fn_RemoveLibraries; +#define MF_OverrideNatives g_fn_OverrideNatives; #ifdef MEMORY_TEST /*** Memory ***/ diff --git a/dlls/regex/moduleconfig.h b/dlls/regex/moduleconfig.h index 48a23178..d674f0bd 100755 --- a/dlls/regex/moduleconfig.h +++ b/dlls/regex/moduleconfig.h @@ -5,10 +5,12 @@ // Module info #define MODULE_NAME "RegEx" -#define MODULE_VERSION "1.72" +#define MODULE_VERSION "1.75" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org/" #define MODULE_LOGTAG "REGEX" +#define MODULE_LIBRARY "regex" +#define MODULE_LIBCLASS "" // If you want the module not to be reloaded on mapchange, remove / comment out the next line #define MODULE_RELOAD_ON_MAPCHANGE @@ -34,18 +36,32 @@ // Uncomment this if you are using MSVC8 or greater and want to fix some of the compatibility issues yourself // #define NO_MSVC8_AUTO_COMPAT -// - AMXX Init functions -// Also consider using FN_META_* -// AMXX query +/** + * AMXX Init functions + * Also consider using FN_META_* + */ + +/** AMXX query */ //#define FN_AMXX_QUERY OnAmxxQuery -// AMXX attach -// Do native functions init here (MF_AddNatives) + +/** AMXX attach + * Do native functions init here (MF_AddNatives) + */ #define FN_AMXX_ATTACH OnAmxxAttach -// AMXX detach + +/** AMXX Detach (unload) */ #define FN_AMXX_DETACH OnAmxxDetach -// All plugins loaded -// Do forward functions init here (MF_RegisterForward) -// #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded + +/** All plugins loaded + * Do forward functions init here (MF_RegisterForward) + */ +//#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded + +/** All plugins are about to be unloaded */ +//#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading + +/** All plguins are now unloaded */ +//#define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded /**** METAMOD ****/ // If your module doesn't use metamod, you may close the file now :) diff --git a/dlls/sockets/amxxmodule.cpp b/dlls/sockets/amxxmodule.cpp index 9d92f6f5..73d69197 100755 --- a/dlls/sockets/amxxmodule.cpp +++ b/dlls/sockets/amxxmodule.cpp @@ -2430,7 +2430,9 @@ static amxx_module_info_s g_ModuleInfo = #else // MODULE_RELOAD_ON_MAPCHANGE 0, #endif // MODULE_RELOAD_ON_MAPCHANGE - MODULE_LOGTAG + MODULE_LOGTAG, + MODULE_LIBRARY, + MODULE_LIBCLASS }; // Storage for the requested functions @@ -2506,6 +2508,10 @@ PFN_SET_TEAM_INFO g_fn_SetTeamInfo; PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +PFN_FINDLIBRARY g_fn_FindLibrary; +PFN_ADDLIBRARIES g_fn_AddLibraries; +PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +PFN_OVERRIDENATIVES g_fn_OverrideNatives; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2620,6 +2626,11 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("RegAuthFunc", g_fn_RegAuthFunc, PFN_REG_AUTH_FUNC); REQFUNC("UnregAuthFunc", g_fn_UnregAuthFunc, PFN_UNREG_AUTH_FUNC); + REQFUNC("FindLibrary", g_fn_FindLibrary, PFN_FINDLIBRARY); + REQFUNC("AddLibraries", g_fn_AddLibraries, PFN_ADDLIBRARIES); + REQFUNC("RemoveLibraries", g_fn_RemoveLibraries, PFN_REMOVELIBRARIES); + REQFUNC("OverrideNatives", g_fn_OverrideNatives, PFN_OVERRIDENATIVES); + #ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2654,6 +2665,20 @@ C_DLLEXPORT int AMXX_PluginsLoaded() return AMXX_OK; } +C_DLLEXPORT void AMXX_PluginsUnloaded() +{ +#ifdef FN_AMXX_PLUGINSUNLOADED + FN_AMXX_PLUGINSUNLOADED(); +#endif // FN_AMXX_PLUGINSUNLOADED +} + +C_DLLEXPORT void AMXX_PluginsUnloading() +{ +#ifdef FN_AMXX_PLUGINSUNLOADING + FN_AMXX_PLUGINSUNLOADING(); +#endif // FN_AMXX_PLUGINSUNLOADING +} + // Advanced MF functions void MF_Log(const char *fmt, ...) { @@ -2743,6 +2768,10 @@ void ValidateMacros_DontCallThis_Smiley() MF_PlayerPropAddr(0, 0); MF_RegAuthFunc(NULL); MF_UnregAuthFunc(NULL); + MF_FindLibrary(NULL, LibType_Class); + MF_AddLibraries(NULL, LibType_Class, NULL); + MF_RemoveLibraries(NULL); + MF_OverrideNatives(NULL); } #endif diff --git a/dlls/sockets/amxxmodule.h b/dlls/sockets/amxxmodule.h index 71077bdd..a84443b5 100755 --- a/dlls/sockets/amxxmodule.h +++ b/dlls/sockets/amxxmodule.h @@ -34,7 +34,8 @@ // module interface version was 1 // 2 - added logtag to struct (amxx1.1-rc1) // 3 - added new tagAMX structure (amxx1.5) -#define AMXX_INTERFACE_VERSION 3 +// 4 - added new 'library' setting for direct loading +#define AMXX_INTERFACE_VERSION 4 // amxx module info struct amxx_module_info_s @@ -44,6 +45,8 @@ struct amxx_module_info_s const char *version; int reload; // reload on mapchange when nonzero const char *logtag; // added in version 2 + const char *library; // added in version 4 + const char *libclass; // added in version 4 }; // return values from functions called by amxx @@ -2032,6 +2035,14 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +#ifdef FN_AMXX_PLUGINSUNLOADING +void FN_AMXX_PLUGINSUNLOADING(void); +#endif // FN_AMXX_PLUGINSUNLOADING + +#ifdef FN_AMXX_PLUGINSUNLOADED +void FN_AMXX_PLUGINSUNLOADED(void); +#endif // FN_AMXX_PLUGINSUNLOADED + // *** Types *** typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); @@ -2078,6 +2089,12 @@ enum PlayerProp Player_NewmenuPage, //int }; +enum LibType +{ + LibType_Library, + LibType_Class +}; + typedef void (*AUTHORIZEFUNC)(int player, const char *authstring); typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); @@ -2159,6 +2176,10 @@ typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); typedef int (*PFN_SET_TEAM_INFO) (int /*player */, int /*teamid */, const char * /*name */); typedef void (*PFN_REG_AUTH_FUNC) (AUTHORIZEFUNC); typedef void (*PFN_UNREG_AUTH_FUNC) (AUTHORIZEFUNC); +typedef int (*PFN_FINDLIBRARY) (const char * /*name*/, LibType /*type*/); +typedef size_t (*PFN_ADDLIBRARIES) (const char * /*name*/, LibType /*type*/, void * /*parent*/); +typedef size_t (*PFN_REMOVELIBRARIES) (void * /*parent*/); +typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2226,6 +2247,10 @@ extern PFN_SET_TEAM_INFO g_fn_SetTeamInfo; extern PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; extern PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; extern PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +extern PFN_FINDLIBRARY g_fn_FindLibrary; +extern PFN_ADDLIBRARIES g_fn_AddLibraries; +extern PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +extern PFN_OVERRIDENATIVES g_fn_OverrideNatives; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2290,6 +2315,10 @@ int MF_SetPlayerTeamInfo (int id, int teamid, const char *teamname) { } void * MF_PlayerPropAddr (int id, int prop) { } void MF_RegAuthFunc (AUTHORIZEFUNC fn) { } void MF_UnregAuthFunc (AUTHORIZEFUNC fn) { } +int MF_FindLibrary (const char *name, LibType type) { } +size_t MF_AddLibraries (const char *name, LibType type, void *parent) { } +size_t MF_RemoveLibraries (void *parent) { } +void MF_OverrideNatives (AMX_NATIVE_INFO *natives) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2359,6 +2388,10 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_PlayerPropAddr g_fn_PlayerPropAddr #define MF_RegAuthFunc g_fn_RegAuthFunc #define MF_UnregAuthFunc g_fn_UnregAuthFunc +#define MF_FindLibrary g_fn_FindLibrary; +#define MF_AddLibraries g_fn_AddLibraries; +#define MF_RemoveLibraries g_fn_RemoveLibraries; +#define MF_OverrideNatives g_fn_OverrideNatives; #ifdef MEMORY_TEST /*** Memory ***/ diff --git a/dlls/sockets/moduleconfig.h b/dlls/sockets/moduleconfig.h index c71ff767..6e604891 100755 --- a/dlls/sockets/moduleconfig.h +++ b/dlls/sockets/moduleconfig.h @@ -5,10 +5,12 @@ // Module info #define MODULE_NAME "Sockets" -#define MODULE_VERSION "1.72" +#define MODULE_VERSION "1.75" #define MODULE_AUTHOR "HLSW Dev Team" #define MODULE_URL "http://www.hlsw.net/" #define MODULE_LOGTAG "SOCKET" +#define MODULE_LIBRARY "sockets" +#define MODULE_LIBCLASS "" // If you want the module not to be reloaded on mapchange, remove / comment out the next line #define MODULE_RELOAD_ON_MAPCHANGE @@ -34,18 +36,32 @@ // Uncomment this if you are using MSVC8 or greater and want to fix some of the compatibility issues yourself // #define NO_MSVC8_AUTO_COMPAT -// - AMXX Init functions -// Also consider using FN_META_* -// AMXX query +/** + * AMXX Init functions + * Also consider using FN_META_* + */ + +/** AMXX query */ //#define FN_AMXX_QUERY OnAmxxQuery -// AMXX attach -// Do native functions init here (MF_AddNatives) + +/** AMXX attach + * Do native functions init here (MF_AddNatives) + */ #define FN_AMXX_ATTACH OnAmxxAttach -// AMXX detach + +/** AMXX Detach (unload) */ #define FN_AMXX_DETACH OnAmxxDetach -// All plugins loaded -// Do forward functions init here (MF_RegisterForward) -// #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded + +/** All plugins loaded + * Do forward functions init here (MF_RegisterForward) + */ +//#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded + +/** All plugins are about to be unloaded */ +//#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading + +/** All plguins are now unloaded */ +//#define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded /**** METAMOD ****/ // If your module doesn't use metamod, you may close the file now :) diff --git a/dlls/sockets/sockets.sln b/dlls/sockets/sockets.sln new file mode 100644 index 00000000..b3a39997 --- /dev/null +++ b/dlls/sockets/sockets.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockets", "sockets.vcproj", "{F15BBA96-2F66-44BB-9DDF-D91AE6D33AE7}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {F15BBA96-2F66-44BB-9DDF-D91AE6D33AE7}.Debug.ActiveCfg = Debug|Win32 + {F15BBA96-2F66-44BB-9DDF-D91AE6D33AE7}.Debug.Build.0 = Debug|Win32 + {F15BBA96-2F66-44BB-9DDF-D91AE6D33AE7}.Release.ActiveCfg = Release|Win32 + {F15BBA96-2F66-44BB-9DDF-D91AE6D33AE7}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/dlls/sqlite/amxxmodule.cpp b/dlls/sqlite/amxxmodule.cpp index 9d92f6f5..73d69197 100755 --- a/dlls/sqlite/amxxmodule.cpp +++ b/dlls/sqlite/amxxmodule.cpp @@ -2430,7 +2430,9 @@ static amxx_module_info_s g_ModuleInfo = #else // MODULE_RELOAD_ON_MAPCHANGE 0, #endif // MODULE_RELOAD_ON_MAPCHANGE - MODULE_LOGTAG + MODULE_LOGTAG, + MODULE_LIBRARY, + MODULE_LIBCLASS }; // Storage for the requested functions @@ -2506,6 +2508,10 @@ PFN_SET_TEAM_INFO g_fn_SetTeamInfo; PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +PFN_FINDLIBRARY g_fn_FindLibrary; +PFN_ADDLIBRARIES g_fn_AddLibraries; +PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +PFN_OVERRIDENATIVES g_fn_OverrideNatives; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2620,6 +2626,11 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("RegAuthFunc", g_fn_RegAuthFunc, PFN_REG_AUTH_FUNC); REQFUNC("UnregAuthFunc", g_fn_UnregAuthFunc, PFN_UNREG_AUTH_FUNC); + REQFUNC("FindLibrary", g_fn_FindLibrary, PFN_FINDLIBRARY); + REQFUNC("AddLibraries", g_fn_AddLibraries, PFN_ADDLIBRARIES); + REQFUNC("RemoveLibraries", g_fn_RemoveLibraries, PFN_REMOVELIBRARIES); + REQFUNC("OverrideNatives", g_fn_OverrideNatives, PFN_OVERRIDENATIVES); + #ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2654,6 +2665,20 @@ C_DLLEXPORT int AMXX_PluginsLoaded() return AMXX_OK; } +C_DLLEXPORT void AMXX_PluginsUnloaded() +{ +#ifdef FN_AMXX_PLUGINSUNLOADED + FN_AMXX_PLUGINSUNLOADED(); +#endif // FN_AMXX_PLUGINSUNLOADED +} + +C_DLLEXPORT void AMXX_PluginsUnloading() +{ +#ifdef FN_AMXX_PLUGINSUNLOADING + FN_AMXX_PLUGINSUNLOADING(); +#endif // FN_AMXX_PLUGINSUNLOADING +} + // Advanced MF functions void MF_Log(const char *fmt, ...) { @@ -2743,6 +2768,10 @@ void ValidateMacros_DontCallThis_Smiley() MF_PlayerPropAddr(0, 0); MF_RegAuthFunc(NULL); MF_UnregAuthFunc(NULL); + MF_FindLibrary(NULL, LibType_Class); + MF_AddLibraries(NULL, LibType_Class, NULL); + MF_RemoveLibraries(NULL); + MF_OverrideNatives(NULL); } #endif diff --git a/dlls/sqlite/amxxmodule.h b/dlls/sqlite/amxxmodule.h index 71077bdd..8be9c642 100755 --- a/dlls/sqlite/amxxmodule.h +++ b/dlls/sqlite/amxxmodule.h @@ -34,7 +34,8 @@ // module interface version was 1 // 2 - added logtag to struct (amxx1.1-rc1) // 3 - added new tagAMX structure (amxx1.5) -#define AMXX_INTERFACE_VERSION 3 +// 4 - added new 'library' setting for direct loading +#define AMXX_INTERFACE_VERSION 4 // amxx module info struct amxx_module_info_s @@ -44,6 +45,8 @@ struct amxx_module_info_s const char *version; int reload; // reload on mapchange when nonzero const char *logtag; // added in version 2 + const char *library; // added in version 4 + const char *libclass; // added in version 4 }; // return values from functions called by amxx @@ -2032,6 +2035,14 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +#ifdef FN_AMXX_PLUGINSUNLOADING +void FN_AMXX_PLUGINSUNLOADING(void); +#endif // FN_AMXX_PLUGINSUNLOADING + +#ifdef FN_AMXX_PLUGINSUNLOADED +void FN_AMXX_PLUGINSUNLOADED(void); +#endif // FN_AMXX_PLUGINSUNLOADED + // *** Types *** typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); @@ -2078,6 +2089,12 @@ enum PlayerProp Player_NewmenuPage, //int }; +enum LibType +{ + LibType_Library, + LibType_Class +}; + typedef void (*AUTHORIZEFUNC)(int player, const char *authstring); typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); @@ -2159,6 +2176,10 @@ typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); typedef int (*PFN_SET_TEAM_INFO) (int /*player */, int /*teamid */, const char * /*name */); typedef void (*PFN_REG_AUTH_FUNC) (AUTHORIZEFUNC); typedef void (*PFN_UNREG_AUTH_FUNC) (AUTHORIZEFUNC); +typedef int (*PFN_FINDLIBRARY) (const char * /*name*/, LibType /*type*/); +typedef size_t (*PFN_ADDLIBRARIES) (const char * /*name*/, LibType /*type*/, void * /*parent*/); +typedef size_t (*PFN_REMOVELIBRARIES) (void * /*parent*/); +typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2226,6 +2247,10 @@ extern PFN_SET_TEAM_INFO g_fn_SetTeamInfo; extern PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; extern PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; extern PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +extern PFN_FINDLIBRARY g_fn_FindLibrary; +extern PFN_ADDLIBRARIES g_fn_AddLibraries; +extern PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +extern PFN_OVERRIDENATIVES g_fn_OverrideNatives; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2290,6 +2315,10 @@ int MF_SetPlayerTeamInfo (int id, int teamid, const char *teamname) { } void * MF_PlayerPropAddr (int id, int prop) { } void MF_RegAuthFunc (AUTHORIZEFUNC fn) { } void MF_UnregAuthFunc (AUTHORIZEFUNC fn) { } +int MF_FindLibrary (const char *name, LibType type) { } +size_t MF_AddLibraries (const char *name, LibType type, void *parent) { } +size_t MF_RemoveLibraries (void *parent) { } +void MF_OverrideNatives (AMX_NATIVE_INFO *natives) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2359,6 +2388,10 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_PlayerPropAddr g_fn_PlayerPropAddr #define MF_RegAuthFunc g_fn_RegAuthFunc #define MF_UnregAuthFunc g_fn_UnregAuthFunc +#define MF_FindLibrary g_fn_FindLibrary +#define MF_AddLibraries g_fn_AddLibraries +#define MF_RemoveLibraries g_fn_RemoveLibraries +#define MF_OverrideNatives g_fn_OverrideNatives #ifdef MEMORY_TEST /*** Memory ***/ diff --git a/dlls/sqlite/moduleconfig.h b/dlls/sqlite/moduleconfig.h index 2383d2ff..7cbd1130 100755 --- a/dlls/sqlite/moduleconfig.h +++ b/dlls/sqlite/moduleconfig.h @@ -5,10 +5,12 @@ // Module info #define MODULE_NAME "Sqlite" -#define MODULE_VERSION "1.72" +#define MODULE_VERSION "1.75" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org/" #define MODULE_LOGTAG "SQLITE" +#define MODULE_LIBRARY "sqlite" +#define MODULE_LIBCLASS "dbi" // If you want the module not to be reloaded on mapchange, remove / comment out the next line #define MODULE_RELOAD_ON_MAPCHANGE @@ -34,18 +36,32 @@ // Uncomment this if you are using MSVC8 or greater and want to fix some of the compatibility issues yourself // #define NO_MSVC8_AUTO_COMPAT -// - AMXX Init functions -// Also consider using FN_META_* -// AMXX query +/** + * AMXX Init functions + * Also consider using FN_META_* + */ + +/** AMXX query */ //#define FN_AMXX_QUERY OnAmxxQuery -// AMXX attach -// Do native functions init here (MF_AddNatives) + +/** AMXX attach + * Do native functions init here (MF_AddNatives) + */ #define FN_AMXX_ATTACH OnAmxxAttach -// AMXX detach + +/** AMXX Detach (unload) */ #define FN_AMXX_DETACH OnAmxxDetach -// All plugins loaded -// Do forward functions init here (MF_RegisterForward) -// #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded + +/** All plugins loaded + * Do forward functions init here (MF_RegisterForward) + */ +//#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded + +/** All plugins are about to be unloaded */ +//#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading + +/** All plguins are now unloaded */ +//#define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded /**** METAMOD ****/ // If your module doesn't use metamod, you may close the file now :) diff --git a/dlls/sqlite/sqlite.cpp b/dlls/sqlite/sqlite.cpp index 222ac344..8cade29a 100755 --- a/dlls/sqlite/sqlite.cpp +++ b/dlls/sqlite/sqlite.cpp @@ -433,6 +433,7 @@ void OnAmxxAttach() SQLResult *Dump = new SQLResult; Dump->isFree = false; Results.push_back(Dump); + MF_OverrideNatives(mysql_Natives); MF_AddNatives(mysql_Natives); } diff --git a/dlls/tfc/tfcx/amxxmodule.cpp b/dlls/tfc/tfcx/amxxmodule.cpp index 9d92f6f5..73d69197 100755 --- a/dlls/tfc/tfcx/amxxmodule.cpp +++ b/dlls/tfc/tfcx/amxxmodule.cpp @@ -2430,7 +2430,9 @@ static amxx_module_info_s g_ModuleInfo = #else // MODULE_RELOAD_ON_MAPCHANGE 0, #endif // MODULE_RELOAD_ON_MAPCHANGE - MODULE_LOGTAG + MODULE_LOGTAG, + MODULE_LIBRARY, + MODULE_LIBCLASS }; // Storage for the requested functions @@ -2506,6 +2508,10 @@ PFN_SET_TEAM_INFO g_fn_SetTeamInfo; PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +PFN_FINDLIBRARY g_fn_FindLibrary; +PFN_ADDLIBRARIES g_fn_AddLibraries; +PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +PFN_OVERRIDENATIVES g_fn_OverrideNatives; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2620,6 +2626,11 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("RegAuthFunc", g_fn_RegAuthFunc, PFN_REG_AUTH_FUNC); REQFUNC("UnregAuthFunc", g_fn_UnregAuthFunc, PFN_UNREG_AUTH_FUNC); + REQFUNC("FindLibrary", g_fn_FindLibrary, PFN_FINDLIBRARY); + REQFUNC("AddLibraries", g_fn_AddLibraries, PFN_ADDLIBRARIES); + REQFUNC("RemoveLibraries", g_fn_RemoveLibraries, PFN_REMOVELIBRARIES); + REQFUNC("OverrideNatives", g_fn_OverrideNatives, PFN_OVERRIDENATIVES); + #ifdef MEMORY_TEST // Memory REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); @@ -2654,6 +2665,20 @@ C_DLLEXPORT int AMXX_PluginsLoaded() return AMXX_OK; } +C_DLLEXPORT void AMXX_PluginsUnloaded() +{ +#ifdef FN_AMXX_PLUGINSUNLOADED + FN_AMXX_PLUGINSUNLOADED(); +#endif // FN_AMXX_PLUGINSUNLOADED +} + +C_DLLEXPORT void AMXX_PluginsUnloading() +{ +#ifdef FN_AMXX_PLUGINSUNLOADING + FN_AMXX_PLUGINSUNLOADING(); +#endif // FN_AMXX_PLUGINSUNLOADING +} + // Advanced MF functions void MF_Log(const char *fmt, ...) { @@ -2743,6 +2768,10 @@ void ValidateMacros_DontCallThis_Smiley() MF_PlayerPropAddr(0, 0); MF_RegAuthFunc(NULL); MF_UnregAuthFunc(NULL); + MF_FindLibrary(NULL, LibType_Class); + MF_AddLibraries(NULL, LibType_Class, NULL); + MF_RemoveLibraries(NULL); + MF_OverrideNatives(NULL); } #endif diff --git a/dlls/tfc/tfcx/amxxmodule.h b/dlls/tfc/tfcx/amxxmodule.h index 71077bdd..a84443b5 100755 --- a/dlls/tfc/tfcx/amxxmodule.h +++ b/dlls/tfc/tfcx/amxxmodule.h @@ -34,7 +34,8 @@ // module interface version was 1 // 2 - added logtag to struct (amxx1.1-rc1) // 3 - added new tagAMX structure (amxx1.5) -#define AMXX_INTERFACE_VERSION 3 +// 4 - added new 'library' setting for direct loading +#define AMXX_INTERFACE_VERSION 4 // amxx module info struct amxx_module_info_s @@ -44,6 +45,8 @@ struct amxx_module_info_s const char *version; int reload; // reload on mapchange when nonzero const char *logtag; // added in version 2 + const char *library; // added in version 4 + const char *libclass; // added in version 4 }; // return values from functions called by amxx @@ -2032,6 +2035,14 @@ void FN_AMXX_DETACH(void); void FN_AMXX_PLUGINSLOADED(void); #endif // FN_AMXX_PLUGINSLOADED +#ifdef FN_AMXX_PLUGINSUNLOADING +void FN_AMXX_PLUGINSUNLOADING(void); +#endif // FN_AMXX_PLUGINSUNLOADING + +#ifdef FN_AMXX_PLUGINSUNLOADED +void FN_AMXX_PLUGINSUNLOADED(void); +#endif // FN_AMXX_PLUGINSUNLOADED + // *** Types *** typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/); @@ -2078,6 +2089,12 @@ enum PlayerProp Player_NewmenuPage, //int }; +enum LibType +{ + LibType_Library, + LibType_Class +}; + typedef void (*AUTHORIZEFUNC)(int player, const char *authstring); typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/); @@ -2159,6 +2176,10 @@ typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); typedef int (*PFN_SET_TEAM_INFO) (int /*player */, int /*teamid */, const char * /*name */); typedef void (*PFN_REG_AUTH_FUNC) (AUTHORIZEFUNC); typedef void (*PFN_UNREG_AUTH_FUNC) (AUTHORIZEFUNC); +typedef int (*PFN_FINDLIBRARY) (const char * /*name*/, LibType /*type*/); +typedef size_t (*PFN_ADDLIBRARIES) (const char * /*name*/, LibType /*type*/, void * /*parent*/); +typedef size_t (*PFN_REMOVELIBRARIES) (void * /*parent*/); +typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2226,6 +2247,10 @@ extern PFN_SET_TEAM_INFO g_fn_SetTeamInfo; extern PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr; extern PFN_REG_AUTH_FUNC g_fn_RegAuthFunc; extern PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; +extern PFN_FINDLIBRARY g_fn_FindLibrary; +extern PFN_ADDLIBRARIES g_fn_AddLibraries; +extern PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +extern PFN_OVERRIDENATIVES g_fn_OverrideNatives; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2290,6 +2315,10 @@ int MF_SetPlayerTeamInfo (int id, int teamid, const char *teamname) { } void * MF_PlayerPropAddr (int id, int prop) { } void MF_RegAuthFunc (AUTHORIZEFUNC fn) { } void MF_UnregAuthFunc (AUTHORIZEFUNC fn) { } +int MF_FindLibrary (const char *name, LibType type) { } +size_t MF_AddLibraries (const char *name, LibType type, void *parent) { } +size_t MF_RemoveLibraries (void *parent) { } +void MF_OverrideNatives (AMX_NATIVE_INFO *natives) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2359,6 +2388,10 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_PlayerPropAddr g_fn_PlayerPropAddr #define MF_RegAuthFunc g_fn_RegAuthFunc #define MF_UnregAuthFunc g_fn_UnregAuthFunc +#define MF_FindLibrary g_fn_FindLibrary; +#define MF_AddLibraries g_fn_AddLibraries; +#define MF_RemoveLibraries g_fn_RemoveLibraries; +#define MF_OverrideNatives g_fn_OverrideNatives; #ifdef MEMORY_TEST /*** Memory ***/ diff --git a/dlls/tfc/tfcx/moduleconfig.h b/dlls/tfc/tfcx/moduleconfig.h index 820c0a43..72017dcc 100755 --- a/dlls/tfc/tfcx/moduleconfig.h +++ b/dlls/tfc/tfcx/moduleconfig.h @@ -5,10 +5,12 @@ // Module info #define MODULE_NAME "TfcX" -#define MODULE_VERSION "1.72" +#define MODULE_VERSION "1.75" #define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_URL "http://www.amxmodx.org" #define MODULE_LOGTAG "TFCX" +#define MODULE_LIBRARY "tfcx" +#define MODULE_LIBCLASS "xstats" // If you want the module not to be reloaded on mapchange, remove / comment out the next line #define MODULE_RELOAD_ON_MAPCHANGE @@ -34,19 +36,33 @@ // Uncomment this if you are using MSVC8 or greater and want to fix some of the compatibility issues yourself // #define NO_MSVC8_AUTO_COMPAT -// - AMXX Init functions -// Also consider using FN_META_* -// AMXX query +/** +* AMXX Init functions +* Also consider using FN_META_* +*/ + +/** AMXX query */ //#define FN_AMXX_QUERY OnAmxxQuery -// AMXX attach -// Do native functions init here (MF_AddNatives) + +/** AMXX attach +* Do native functions init here (MF_AddNatives) +*/ #define FN_AMXX_ATTACH OnAmxxAttach -// AMXX detach + +/** AMXX Detach (unload) */ //#define FN_AMXX_DETACH OnAmxxDetach -// All plugins loaded -// Do forward functions init here (MF_RegisterForward) + +/** All plugins loaded +* Do forward functions init here (MF_RegisterForward) +*/ #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded +/** All plugins are about to be unloaded */ +//#define FN_AMXX_PLUGINSUNLOADING OnPluginsUnloading + +/** All plguins are now unloaded */ +//#define FN_AMXX_PLUGINSUNLOADED OnPluginsUnloaded + /**** METAMOD ****/ // If your module doesn't use metamod, you may close the file now :) #ifdef USE_METAMOD diff --git a/dlls/ts/tsfun/amxxmodule.cpp b/dlls/ts/tsfun/amxxmodule.cpp index 194da0b1..73d69197 100755 --- a/dlls/ts/tsfun/amxxmodule.cpp +++ b/dlls/ts/tsfun/amxxmodule.cpp @@ -2511,6 +2511,7 @@ PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; PFN_FINDLIBRARY g_fn_FindLibrary; PFN_ADDLIBRARIES g_fn_AddLibraries; PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +PFN_OVERRIDENATIVES g_fn_OverrideNatives; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2628,6 +2629,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("FindLibrary", g_fn_FindLibrary, PFN_FINDLIBRARY); REQFUNC("AddLibraries", g_fn_AddLibraries, PFN_ADDLIBRARIES); REQFUNC("RemoveLibraries", g_fn_RemoveLibraries, PFN_REMOVELIBRARIES); + REQFUNC("OverrideNatives", g_fn_OverrideNatives, PFN_OVERRIDENATIVES); #ifdef MEMORY_TEST // Memory @@ -2769,6 +2771,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_FindLibrary(NULL, LibType_Class); MF_AddLibraries(NULL, LibType_Class, NULL); MF_RemoveLibraries(NULL); + MF_OverrideNatives(NULL); } #endif diff --git a/dlls/ts/tsfun/amxxmodule.h b/dlls/ts/tsfun/amxxmodule.h index 975c3c7c..a84443b5 100755 --- a/dlls/ts/tsfun/amxxmodule.h +++ b/dlls/ts/tsfun/amxxmodule.h @@ -2179,6 +2179,7 @@ typedef void (*PFN_UNREG_AUTH_FUNC) (AUTHORIZEFUNC); typedef int (*PFN_FINDLIBRARY) (const char * /*name*/, LibType /*type*/); typedef size_t (*PFN_ADDLIBRARIES) (const char * /*name*/, LibType /*type*/, void * /*parent*/); typedef size_t (*PFN_REMOVELIBRARIES) (void * /*parent*/); +typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2249,6 +2250,7 @@ extern PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; extern PFN_FINDLIBRARY g_fn_FindLibrary; extern PFN_ADDLIBRARIES g_fn_AddLibraries; extern PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +extern PFN_OVERRIDENATIVES g_fn_OverrideNatives; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2316,6 +2318,7 @@ void MF_UnregAuthFunc (AUTHORIZEFUNC fn) { } int MF_FindLibrary (const char *name, LibType type) { } size_t MF_AddLibraries (const char *name, LibType type, void *parent) { } size_t MF_RemoveLibraries (void *parent) { } +void MF_OverrideNatives (AMX_NATIVE_INFO *natives) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2388,6 +2391,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_FindLibrary g_fn_FindLibrary; #define MF_AddLibraries g_fn_AddLibraries; #define MF_RemoveLibraries g_fn_RemoveLibraries; +#define MF_OverrideNatives g_fn_OverrideNatives; #ifdef MEMORY_TEST /*** Memory ***/ diff --git a/dlls/ts/tsx/amxxmodule.cpp b/dlls/ts/tsx/amxxmodule.cpp index 194da0b1..73d69197 100755 --- a/dlls/ts/tsx/amxxmodule.cpp +++ b/dlls/ts/tsx/amxxmodule.cpp @@ -2511,6 +2511,7 @@ PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; PFN_FINDLIBRARY g_fn_FindLibrary; PFN_ADDLIBRARIES g_fn_AddLibraries; PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +PFN_OVERRIDENATIVES g_fn_OverrideNatives; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2628,6 +2629,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("FindLibrary", g_fn_FindLibrary, PFN_FINDLIBRARY); REQFUNC("AddLibraries", g_fn_AddLibraries, PFN_ADDLIBRARIES); REQFUNC("RemoveLibraries", g_fn_RemoveLibraries, PFN_REMOVELIBRARIES); + REQFUNC("OverrideNatives", g_fn_OverrideNatives, PFN_OVERRIDENATIVES); #ifdef MEMORY_TEST // Memory @@ -2769,6 +2771,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_FindLibrary(NULL, LibType_Class); MF_AddLibraries(NULL, LibType_Class, NULL); MF_RemoveLibraries(NULL); + MF_OverrideNatives(NULL); } #endif diff --git a/dlls/ts/tsx/amxxmodule.h b/dlls/ts/tsx/amxxmodule.h index 975c3c7c..a84443b5 100755 --- a/dlls/ts/tsx/amxxmodule.h +++ b/dlls/ts/tsx/amxxmodule.h @@ -2179,6 +2179,7 @@ typedef void (*PFN_UNREG_AUTH_FUNC) (AUTHORIZEFUNC); typedef int (*PFN_FINDLIBRARY) (const char * /*name*/, LibType /*type*/); typedef size_t (*PFN_ADDLIBRARIES) (const char * /*name*/, LibType /*type*/, void * /*parent*/); typedef size_t (*PFN_REMOVELIBRARIES) (void * /*parent*/); +typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2249,6 +2250,7 @@ extern PFN_UNREG_AUTH_FUNC g_fn_UnregAuthFunc; extern PFN_FINDLIBRARY g_fn_FindLibrary; extern PFN_ADDLIBRARIES g_fn_AddLibraries; extern PFN_REMOVELIBRARIES g_fn_RemoveLibraries; +extern PFN_OVERRIDENATIVES g_fn_OverrideNatives; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2316,6 +2318,7 @@ void MF_UnregAuthFunc (AUTHORIZEFUNC fn) { } int MF_FindLibrary (const char *name, LibType type) { } size_t MF_AddLibraries (const char *name, LibType type, void *parent) { } size_t MF_RemoveLibraries (void *parent) { } +void MF_OverrideNatives (AMX_NATIVE_INFO *natives) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2388,6 +2391,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_FindLibrary g_fn_FindLibrary; #define MF_AddLibraries g_fn_AddLibraries; #define MF_RemoveLibraries g_fn_RemoveLibraries; +#define MF_OverrideNatives g_fn_OverrideNatives; #ifdef MEMORY_TEST /*** Memory ***/