From 8e3a5e6d58960865317e58d9500949fefa2fd42b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 10 May 2006 12:00:22 +0000 Subject: [PATCH] sdk v4 --- dlls/cstrike/amxxmodule.cpp | 33 ++++++++++++++++- dlls/cstrike/amxxmodule.h | 39 ++++++++++++++++++- dlls/cstrike/moduleconfig.h | 37 ++++++++++++++----- dlls/engine/amxxmodule.cpp | 33 ++++++++++++++++- dlls/engine/amxxmodule.h | 39 ++++++++++++++++++- dlls/engine/moduleconfig.h | 74 +++++++++++++++++++++++-------------- dlls/fun/amxxmodule.cpp | 5 +++ dlls/fun/amxxmodule.h | 14 +++++-- dlls/fun/moduleconfig.h | 20 +++++----- 9 files changed, 239 insertions(+), 55 deletions(-) diff --git a/dlls/cstrike/amxxmodule.cpp b/dlls/cstrike/amxxmodule.cpp index 9d92f6f5..30ef9c79 100755 --- a/dlls/cstrike/amxxmodule.cpp +++ b/dlls/cstrike/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/cstrike/amxxmodule.h b/dlls/cstrike/amxxmodule.h index 71077bdd..986e0eb4 100755 --- a/dlls/cstrike/amxxmodule.h +++ b/dlls/cstrike/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/cstrike/moduleconfig.h b/dlls/cstrike/moduleconfig.h index 33dd1c9d..8bbc0aaf 100755 --- a/dlls/cstrike/moduleconfig.h +++ b/dlls/cstrike/moduleconfig.h @@ -5,10 +5,12 @@ // Module info #define MODULE_NAME "CStrike" -#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 "CSTRIKE" +#define MODULE_LIBRARY "cstrike" +#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/engine/amxxmodule.cpp b/dlls/engine/amxxmodule.cpp index 9d92f6f5..30ef9c79 100755 --- a/dlls/engine/amxxmodule.cpp +++ b/dlls/engine/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/engine/amxxmodule.h b/dlls/engine/amxxmodule.h index 71077bdd..986e0eb4 100755 --- a/dlls/engine/amxxmodule.h +++ b/dlls/engine/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/engine/moduleconfig.h b/dlls/engine/moduleconfig.h index d6fe7efc..1c865be8 100755 --- a/dlls/engine/moduleconfig.h +++ b/dlls/engine/moduleconfig.h @@ -5,10 +5,12 @@ // Module info #define MODULE_NAME "Engine" -#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 "ENGINE" +#define MODULE_LIBRARY "engine" +#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 @@ -61,18 +78,18 @@ //#define FN_META_QUERY OnMetaQuery // Meta attach //#define FN_META_ATTACH OnMetaAttach -// Meta detach -//#define FN_META_DETACH OnMetaDetach +// Meta dettach +//#define FN_META_DETTACH OnMetaDettach // (wd) are Will Day's notes // - GetEntityAPI2 functions // #define FN_GameDLLInit GameDLLInit /* pfnGameInit() */ -// #define FN_DispatchSpawn DispatchSpawn /* pfnSpawn() */ -// #define FN_DispatchThink DispatchThink /* pfnThink() */ -// #define FN_DispatchUse DispatchUse /* pfnUse() */ -// #define FN_DispatchTouch DispatchTouch /* pfnTouch() */ +// #define FN_DispatchSpawn Spawn /* pfnSpawn() */ +// #define FN_DispatchThink Think /* pfnThink() */ +// #define FN_DispatchUse Use /* pfnUse() */ +// #define FN_DispatchTouch pfnTouch /* pfnTouch() */ // #define FN_DispatchBlocked DispatchBlocked /* pfnBlocked() */ -// #define FN_DispatchKeyValue DispatchKeyValue /* pfnKeyValue() */ +// #define FN_DispatchKeyValue KeyValue /* pfnKeyValue() */ // #define FN_DispatchSave DispatchSave /* pfnSave() */ // #define FN_DispatchRestore DispatchRestore /* pfnRestore() */ // #define FN_DispatchObjectCollsionBox DispatchObjectCollsionBox /* pfnSetAbsBox() */ @@ -82,13 +99,13 @@ // #define FN_RestoreGlobalState RestoreGlobalState /* pfnRestoreGlobalState() */ // #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */ #define FN_ClientConnect ClientConnect /* pfnClientConnect() (wd) Client has connected */ -#define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */ +#define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */ // #define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */ // #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */ // #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */ // #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */ -#define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */ -#define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */ +#define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */ +#define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */ // #define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */ // #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */ // #define FN_StartFrame StartFrame /* pfnStartFrame() */ @@ -213,19 +230,19 @@ // #define FN_ServerExecute ServerExecute // #define FN_engClientCommand engClientCommand // #define FN_ParticleEffect ParticleEffect -#define FN_LightStyle LightStyle +#define FN_LightStyle LightStyle // #define FN_DecalIndex DecalIndex // #define FN_PointContents PointContents -#define FN_MessageBegin MessageBegin -#define FN_MessageEnd MessageEnd +#define FN_MessageBegin MessageBegin +#define FN_MessageEnd MessageEnd #define FN_WriteByte WriteByte #define FN_WriteChar WriteChar -#define FN_WriteShort WriteShort +#define FN_WriteShort WriteShort #define FN_WriteLong WriteLong -#define FN_WriteAngle WriteAngle -#define FN_WriteCoord WriteCoord -#define FN_WriteString WriteString -#define FN_WriteEntity WriteEntity +#define FN_WriteAngle WriteAngle +#define FN_WriteCoord WriteCoord +#define FN_WriteString WriteString +#define FN_WriteEntity WriteEntity // #define FN_CVarRegister CVarRegister // #define FN_CVarGetFloat CVarGetFloat // #define FN_CVarGetString CVarGetString @@ -312,7 +329,7 @@ // #define FN_GetPlayerStats GetPlayerStats // #define FN_AddServerCommand AddServerCommand // #define FN_Voice_GetClientListening Voice_GetClientListening -#define FN_Voice_SetClientListening Voice_SetClientListening +#define FN_Voice_SetClientListening Voice_SetClientListening // #define FN_GetPlayerAuthId GetPlayerAuthId // - GetEngineAPI_Post functions @@ -473,3 +490,4 @@ #endif // USE_METAMOD #endif // __MODULECONFIG_H__ + diff --git a/dlls/fun/amxxmodule.cpp b/dlls/fun/amxxmodule.cpp index 194da0b1..30ef9c79 100755 --- a/dlls/fun/amxxmodule.cpp +++ b/dlls/fun/amxxmodule.cpp @@ -2511,6 +2511,8 @@ 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) @@ -2628,6 +2630,8 @@ 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); + REQFUNC("GetLocalInfo", g_fn_GetLocalInfo, PFN_GETLOCALINFO); #ifdef MEMORY_TEST // Memory @@ -2769,6 +2773,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/fun/amxxmodule.h b/dlls/fun/amxxmodule.h index 975c3c7c..986e0eb4 100755 --- a/dlls/fun/amxxmodule.h +++ b/dlls/fun/amxxmodule.h @@ -2179,6 +2179,8 @@ 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; @@ -2249,6 +2251,8 @@ 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 @@ -2316,6 +2320,8 @@ 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 @@ -2385,9 +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_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/fun/moduleconfig.h b/dlls/fun/moduleconfig.h index cf451c9d..bf330f42 100755 --- a/dlls/fun/moduleconfig.h +++ b/dlls/fun/moduleconfig.h @@ -23,7 +23,6 @@ // metamod plugin? #define USE_METAMOD - // use memory manager/tester? // note that if you use this, you cannot construct/allocate // anything before the module attached (OnAmxxAttach). @@ -38,24 +37,24 @@ // #define NO_MSVC8_AUTO_COMPAT /** -* AMXX Init functions -* Also consider using FN_META_* -*/ + * AMXX Init functions + * Also consider using FN_META_* + */ /** AMXX query */ //#define FN_AMXX_QUERY OnAmxxQuery /** AMXX attach -* Do native functions init here (MF_AddNatives) -*/ + * Do native functions init here (MF_AddNatives) + */ #define FN_AMXX_ATTACH OnAmxxAttach /** AMXX Detach (unload) */ //#define FN_AMXX_DETACH OnAmxxDetach /** All plugins loaded -* Do forward functions init here (MF_RegisterForward) -*/ + * Do forward functions init here (MF_RegisterForward) + */ #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded /** All plugins are about to be unloaded */ @@ -64,6 +63,7 @@ /** 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 @@ -78,8 +78,8 @@ //#define FN_META_QUERY OnMetaQuery // Meta attach //#define FN_META_ATTACH OnMetaAttach -// Meta detach -//#define FN_META_DETACH OnMetaDetach +// Meta dettach +//#define FN_META_DETTACH OnMetaDettach // (wd) are Will Day's notes // - GetEntityAPI2 functions