From e24c0f6bef5c787dfb84bf2e4a6b71791a331b53 Mon Sep 17 00:00:00 2001 From: Cleverson Date: Mon, 12 Aug 2024 22:39:43 -0300 Subject: [PATCH] Update Metamod SDK Update Metamod SDK --- AccuracyFix/include/metamod/dllapi.h | 31 +++- AccuracyFix/include/metamod/engine_api.h | 7 +- AccuracyFix/include/metamod/enginecallbacks.h | 30 ++-- AccuracyFix/include/metamod/meta_api.h | 150 +++++++++--------- AccuracyFix/include/metamod/mutil.h | 100 +++++------- AccuracyFix/include/metamod/plinfo.h | 48 +++--- 6 files changed, 179 insertions(+), 187 deletions(-) diff --git a/AccuracyFix/include/metamod/dllapi.h b/AccuracyFix/include/metamod/dllapi.h index 2b23a63..b3effdd 100644 --- a/AccuracyFix/include/metamod/dllapi.h +++ b/AccuracyFix/include/metamod/dllapi.h @@ -1,17 +1,36 @@ #pragma once +#include + +#ifndef DLLEXPORT +#ifdef _WIN32 +#define DLLEXPORT __declspec(dllexport) +#else +#define DLLEXPORT __attribute__((visibility("default"))) +#endif // _WIN32 +#endif // DLLEXPORT + +#ifndef C_DLLEXPORT +#define C_DLLEXPORT extern "C" DLLEXPORT +#endif + +#ifndef _WIN32 +#define WINAPI +#endif + typedef void (*FN_GAMEINIT)(); // Typedefs for these are provided in SDK engine/eiface.h, but I didn't // like the names (APIFUNCTION, APIFUNCTION2, NEW_DLL_FUNCTIONS_FN). -typedef int (*GETENTITYAPI_FN)(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion); -typedef int (*GETENTITYAPI2_FN)(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); -typedef int (*GETNEWDLLFUNCTIONS_FN)(NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); +typedef int (*GETENTITYAPI_FN)(DLL_FUNCTIONS* pFunctionTable, int interfaceVersion); +typedef int (*GETENTITYAPI2_FN)(DLL_FUNCTIONS* pFunctionTable, int* interfaceVersion); +typedef int (*GETNEWDLLFUNCTIONS_FN)(NEW_DLL_FUNCTIONS* pFunctionTable, int* interfaceVersion); -C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion); -C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); -C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion); +C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS* pFunctionTable, int interfaceVersion); +C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS* pFunctionTable, int* interfaceVersion); +C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS* pNewFunctionTable, int* interfaceVersion); #ifdef METAMOD_CORE void compile_gamedll_callbacks(); +void disable_clientcommand_fwd(); #endif diff --git a/AccuracyFix/include/metamod/engine_api.h b/AccuracyFix/include/metamod/engine_api.h index 29d5456..234fe57 100644 --- a/AccuracyFix/include/metamod/engine_api.h +++ b/AccuracyFix/include/metamod/engine_api.h @@ -3,7 +3,7 @@ struct enginefuncs_s; // Plugin's GetEngineFunctions, called by metamod. -typedef int (*GET_ENGINE_FUNCTIONS_FN)(enginefuncs_s *pengfuncsFromEngine, int *interfaceVersion); +typedef int (*GET_ENGINE_FUNCTIONS_FN)(enginefuncs_s* pengfuncsFromEngine, int* interfaceVersion); // According to SDK engine/eiface.h: // ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138 @@ -12,10 +12,9 @@ typedef int (*GET_ENGINE_FUNCTIONS_FN)(enginefuncs_s *pengfuncsFromEngine, int * // Protect against other projects which use this include file but use the // normal enginefuncs_t type for their meta_engfuncs. #ifdef METAMOD_CORE - #include "meta_eiface.h" // meta_enginefuncs_t - extern meta_enginefuncs_t g_meta_engfuncs; +extern enginefuncs_t g_meta_engfuncs; - void compile_engine_callbacks(); +void compile_engine_callbacks(); #else extern enginefuncs_t meta_engfuncs; #endif diff --git a/AccuracyFix/include/metamod/enginecallbacks.h b/AccuracyFix/include/metamod/enginecallbacks.h index e45aa71..9e5df0c 100644 --- a/AccuracyFix/include/metamod/enginecallbacks.h +++ b/AccuracyFix/include/metamod/enginecallbacks.h @@ -10,27 +10,15 @@ // "hack" our way around that by using a flag METAMOD_CORE which is set // when compiling Metamod proper. -#ifdef METAMOD_CORE - #include "meta_eiface.h" // HL_enginefuncs_t - - // Use a #define to bend the enginefuncs_t type to our HL_enginefuncs_t - // type instead as we now use that for the global object g_engfuncs. - #define enginefuncs_t HL_enginefuncs_t -#endif - -#include // ALERT, etc - -#ifdef METAMOD_CORE -#undef enginefuncs_t -#endif +#include // ALERT, etc // Also, create some additional macros for engine callback functions, which // weren't in SDK dlls/enginecallbacks.h but probably should have been. -#define GET_INFOKEYBUFFER (*g_engfuncs.pfnGetInfoKeyBuffer) -#define INFOKEY_VALUE (*g_engfuncs.pfnInfoKeyValue) -#define SET_CLIENT_KEYVALUE (*g_engfuncs.pfnSetClientKeyValue) -#define REG_SVR_COMMAND (*g_engfuncs.pfnAddServerCommand) -#define SERVER_PRINT (*g_engfuncs.pfnServerPrint) -#define SET_SERVER_KEYVALUE (*g_engfuncs.pfnSetKeyValue) -#define QUERY_CLIENT_CVAR_VALUE (*g_engfuncs.pfnQueryClientCvarValue) -#define QUERY_CLIENT_CVAR_VALUE2 (*g_engfuncs.pfnQueryClientCvarValue2) +#define GET_INFOKEYBUFFER (*g_engfuncs.pfnGetInfoKeyBuffer) +#define INFOKEY_VALUE (*g_engfuncs.pfnInfoKeyValue) +#define SET_CLIENT_KEYVALUE (*g_engfuncs.pfnSetClientKeyValue) +#define REG_SVR_COMMAND (*g_engfuncs.pfnAddServerCommand) +#define SERVER_PRINT (*g_engfuncs.pfnServerPrint) +#define SET_SERVER_KEYVALUE (*g_engfuncs.pfnSetKeyValue) +#define QUERY_CLIENT_CVAR_VALUE (*g_engfuncs.pfnQueryClientCvarValue) +#define QUERY_CLIENT_CVAR_VALUE2 (*g_engfuncs.pfnQueryClientCvarValue2) diff --git a/AccuracyFix/include/metamod/meta_api.h b/AccuracyFix/include/metamod/meta_api.h index 8fb5e7c..83bd500 100644 --- a/AccuracyFix/include/metamod/meta_api.h +++ b/AccuracyFix/include/metamod/meta_api.h @@ -1,10 +1,10 @@ #pragma once -#include "dllapi.h" // GETENTITYAPI_FN, etc -#include "engine_api.h" // GET_ENGINE_FUNCTIONS_FN, etc -#include "enginecallbacks.h" +#include "dllapi.h" // GETENTITYAPI_FN, etc #include "h_export.h" -#include "plinfo.h" // plugin_info_t, etc +#include "engine_api.h" // GET_ENGINE_FUNCTIONS_FN, etc +#include "enginecallbacks.h" +#include "plinfo.h" // plugin_info_t, etc #include "mutil.h" // Version consists of "major:minor", two separate integer numbers. @@ -33,20 +33,24 @@ enum META_RES { MRES_UNSET = 0, - MRES_IGNORED, // plugin didn't take any action - MRES_HANDLED, // plugin did something, but real function should still be called - MRES_OVERRIDE, // call real function, but use my return value - MRES_SUPERCEDE, // skip real function; use my return value + MRES_IGNORED, // plugin didn't take any action + MRES_HANDLED, // plugin did something, but real function should still be called + MRES_OVERRIDE, // call real function, but use my return value + MRES_SUPERCEDE, // skip real function; use my return value }; // Variables provided to plugins. struct meta_globals_t { - META_RES mres; // writable; plugin's return flag - META_RES prev_mres; // readable; return flag of the previous plugin called - META_RES status; // readable; "highest" return flag so far - void *orig_ret; // readable; return value from "real" function - void *override_ret; // readable; return value from overriding/superceding plugin + META_RES mres; // writable; plugin's return flag + META_RES prev_mres; // readable; return flag of the previous plugin called + META_RES status; // readable; "highest" return flag so far + void *orig_ret; // readable; return value from "real" function + void *override_ret; // readable; return value from overriding/superceding plugin + +#ifdef METAMOD_CORE + uint32* esp_save; +#endif }; extern meta_globals_t *gpMetaGlobals; @@ -98,16 +102,16 @@ typedef void (*META_INIT_FN)(); // Get info about plugin, compare meta_interface versions, provide meta // utility callback functions. C_DLLEXPORT int Meta_Query(char *interfaceVersion, plugin_info_t **plinfo, mutil_funcs_t *pMetaUtilFuncs); -typedef int (*META_QUERY_FN) (char *interfaceVersion, plugin_info_t **plinfo, mutil_funcs_t *pMetaUtilFuncs); +typedef int (*META_QUERY_FN)(char *interfaceVersion, plugin_info_t **plinfo, mutil_funcs_t *pMetaUtilFuncs); // Attach the plugin to the API; get the table of getapi functions; give // meta_globals and gamedll_funcs. C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs); -typedef int (*META_ATTACH_FN) (PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs); +typedef int (*META_ATTACH_FN)(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs); // Detach the plugin; tell why and when. C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason); -typedef int (*META_DETACH_FN) (PLUG_LOADTIME now, PL_UNLOAD_REASON reason); +typedef int (*META_DETACH_FN)(PLUG_LOADTIME now, PL_UNLOAD_REASON reason); // Standard HL SDK interface function prototypes. C_DLLEXPORT int GetEntityAPI_Post(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion ); @@ -123,63 +127,63 @@ C_DLLEXPORT int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int // the other plugins. // DLL API functions: -#define MDLL_FUNC gpGamedllFuncs->dllapi_table - -#define MDLL_GameDLLInit MDLL_FUNC->pfnGameInit -#define MDLL_Spawn MDLL_FUNC->pfnSpawn -#define MDLL_Think MDLL_FUNC->pfnThink -#define MDLL_Use MDLL_FUNC->pfnUse -#define MDLL_Touch MDLL_FUNC->pfnTouch -#define MDLL_Blocked MDLL_FUNC->pfnBlocked -#define MDLL_KeyValue MDLL_FUNC->pfnKeyValue -#define MDLL_Save MDLL_FUNC->pfnSave -#define MDLL_Restore MDLL_FUNC->pfnRestore -#define MDLL_ObjectCollsionBox MDLL_FUNC->pfnAbsBox -#define MDLL_SaveWriteFields MDLL_FUNC->pfnSaveWriteFields -#define MDLL_SaveReadFields MDLL_FUNC->pfnSaveReadFields -#define MDLL_SaveGlobalState MDLL_FUNC->pfnSaveGlobalState -#define MDLL_RestoreGlobalState MDLL_FUNC->pfnRestoreGlobalState -#define MDLL_ResetGlobalState MDLL_FUNC->pfnResetGlobalState -#define MDLL_ClientConnect MDLL_FUNC->pfnClientConnect -#define MDLL_ClientDisconnect MDLL_FUNC->pfnClientDisconnect -#define MDLL_ClientKill MDLL_FUNC->pfnClientKill -#define MDLL_ClientPutInServer MDLL_FUNC->pfnClientPutInServer -#define MDLL_ClientCommand MDLL_FUNC->pfnClientCommand -#define MDLL_ClientUserInfoChanged MDLL_FUNC->pfnClientUserInfoChanged -#define MDLL_ServerActivate MDLL_FUNC->pfnServerActivate -#define MDLL_ServerDeactivate MDLL_FUNC->pfnServerDeactivate -#define MDLL_PlayerPreThink MDLL_FUNC->pfnPlayerPreThink -#define MDLL_PlayerPostThink MDLL_FUNC->pfnPlayerPostThink -#define MDLL_StartFrame MDLL_FUNC->pfnStartFrame -#define MDLL_ParmsNewLevel MDLL_FUNC->pfnParmsNewLevel -#define MDLL_ParmsChangeLevel MDLL_FUNC->pfnParmsChangeLevel -#define MDLL_GetGameDescription MDLL_FUNC->pfnGetGameDescription -#define MDLL_PlayerCustomization MDLL_FUNC->pfnPlayerCustomization -#define MDLL_SpectatorConnect MDLL_FUNC->pfnSpectatorConnect -#define MDLL_SpectatorDisconnect MDLL_FUNC->pfnSpectatorDisconnect -#define MDLL_SpectatorThink MDLL_FUNC->pfnSpectatorThink -#define MDLL_Sys_Error MDLL_FUNC->pfnSys_Error -#define MDLL_PM_Move MDLL_FUNC->pfnPM_Move -#define MDLL_PM_Init MDLL_FUNC->pfnPM_Init -#define MDLL_PM_FindTextureType MDLL_FUNC->pfnPM_FindTextureType -#define MDLL_SetupVisibility MDLL_FUNC->pfnSetupVisibility -#define MDLL_UpdateClientData MDLL_FUNC->pfnUpdateClientData -#define MDLL_AddToFullPack MDLL_FUNC->pfnAddToFullPack -#define MDLL_CreateBaseline MDLL_FUNC->pfnCreateBaseline -#define MDLL_RegisterEncoders MDLL_FUNC->pfnRegisterEncoders -#define MDLL_GetWeaponData MDLL_FUNC->pfnGetWeaponData -#define MDLL_CmdStart MDLL_FUNC->pfnCmdStart -#define MDLL_CmdEnd MDLL_FUNC->pfnCmdEnd -#define MDLL_ConnectionlessPacket MDLL_FUNC->pfnConnectionlessPacket -#define MDLL_GetHullBounds MDLL_FUNC->pfnGetHullBounds -#define MDLL_CreateInstancedBaselines MDLL_FUNC->pfnCreateInstancedBaselines -#define MDLL_InconsistentFile MDLL_FUNC->pfnInconsistentFile -#define MDLL_AllowLagCompensation MDLL_FUNC->pfnAllowLagCompensation +#define MDLL_FUNC gpGamedllFuncs->dllapi_table + +#define MDLL_GameDLLInit MDLL_FUNC->pfnGameInit +#define MDLL_Spawn MDLL_FUNC->pfnSpawn +#define MDLL_Think MDLL_FUNC->pfnThink +#define MDLL_Use MDLL_FUNC->pfnUse +#define MDLL_Touch MDLL_FUNC->pfnTouch +#define MDLL_Blocked MDLL_FUNC->pfnBlocked +#define MDLL_KeyValue MDLL_FUNC->pfnKeyValue +#define MDLL_Save MDLL_FUNC->pfnSave +#define MDLL_Restore MDLL_FUNC->pfnRestore +#define MDLL_ObjectCollsionBox MDLL_FUNC->pfnAbsBox +#define MDLL_SaveWriteFields MDLL_FUNC->pfnSaveWriteFields +#define MDLL_SaveReadFields MDLL_FUNC->pfnSaveReadFields +#define MDLL_SaveGlobalState MDLL_FUNC->pfnSaveGlobalState +#define MDLL_RestoreGlobalState MDLL_FUNC->pfnRestoreGlobalState +#define MDLL_ResetGlobalState MDLL_FUNC->pfnResetGlobalState +#define MDLL_ClientConnect MDLL_FUNC->pfnClientConnect +#define MDLL_ClientDisconnect MDLL_FUNC->pfnClientDisconnect +#define MDLL_ClientKill MDLL_FUNC->pfnClientKill +#define MDLL_ClientPutInServer MDLL_FUNC->pfnClientPutInServer +#define MDLL_ClientCommand MDLL_FUNC->pfnClientCommand +#define MDLL_ClientUserInfoChanged MDLL_FUNC->pfnClientUserInfoChanged +#define MDLL_ServerActivate MDLL_FUNC->pfnServerActivate +#define MDLL_ServerDeactivate MDLL_FUNC->pfnServerDeactivate +#define MDLL_PlayerPreThink MDLL_FUNC->pfnPlayerPreThink +#define MDLL_PlayerPostThink MDLL_FUNC->pfnPlayerPostThink +#define MDLL_StartFrame MDLL_FUNC->pfnStartFrame +#define MDLL_ParmsNewLevel MDLL_FUNC->pfnParmsNewLevel +#define MDLL_ParmsChangeLevel MDLL_FUNC->pfnParmsChangeLevel +#define MDLL_GetGameDescription MDLL_FUNC->pfnGetGameDescription +#define MDLL_PlayerCustomization MDLL_FUNC->pfnPlayerCustomization +#define MDLL_SpectatorConnect MDLL_FUNC->pfnSpectatorConnect +#define MDLL_SpectatorDisconnect MDLL_FUNC->pfnSpectatorDisconnect +#define MDLL_SpectatorThink MDLL_FUNC->pfnSpectatorThink +#define MDLL_Sys_Error MDLL_FUNC->pfnSys_Error +#define MDLL_PM_Move MDLL_FUNC->pfnPM_Move +#define MDLL_PM_Init MDLL_FUNC->pfnPM_Init +#define MDLL_PM_FindTextureType MDLL_FUNC->pfnPM_FindTextureType +#define MDLL_SetupVisibility MDLL_FUNC->pfnSetupVisibility +#define MDLL_UpdateClientData MDLL_FUNC->pfnUpdateClientData +#define MDLL_AddToFullPack MDLL_FUNC->pfnAddToFullPack +#define MDLL_CreateBaseline MDLL_FUNC->pfnCreateBaseline +#define MDLL_RegisterEncoders MDLL_FUNC->pfnRegisterEncoders +#define MDLL_GetWeaponData MDLL_FUNC->pfnGetWeaponData +#define MDLL_CmdStart MDLL_FUNC->pfnCmdStart +#define MDLL_CmdEnd MDLL_FUNC->pfnCmdEnd +#define MDLL_ConnectionlessPacket MDLL_FUNC->pfnConnectionlessPacket +#define MDLL_GetHullBounds MDLL_FUNC->pfnGetHullBounds +#define MDLL_CreateInstancedBaselines MDLL_FUNC->pfnCreateInstancedBaselines +#define MDLL_InconsistentFile MDLL_FUNC->pfnInconsistentFile +#define MDLL_AllowLagCompensation MDLL_FUNC->pfnAllowLagCompensation // NEW API functions: -#define MNEW_FUNC gpGamedllFuncs->newapi_table +#define MNEW_FUNC gpGamedllFuncs->newapi_table -#define MNEW_OnFreeEntPrivateData MNEW_FUNC->pfnOnFreeEntPrivateData -#define MNEW_GameShutdown MNEW_FUNC->pfnGameShutdown -#define MNEW_ShouldCollide MNEW_FUNC->pfnShouldCollide -#define MNEW_CvarValue MNEW_FUNC->pfnCvarValue +#define MNEW_OnFreeEntPrivateData MNEW_FUNC->pfnOnFreeEntPrivateData +#define MNEW_GameShutdown MNEW_FUNC->pfnGameShutdown +#define MNEW_ShouldCollide MNEW_FUNC->pfnShouldCollide +#define MNEW_CvarValue MNEW_FUNC->pfnCvarValue diff --git a/AccuracyFix/include/metamod/mutil.h b/AccuracyFix/include/metamod/mutil.h index b840519..24c8a8b 100644 --- a/AccuracyFix/include/metamod/mutil.h +++ b/AccuracyFix/include/metamod/mutil.h @@ -1,12 +1,12 @@ #pragma once -// max buffer size for printed messages -#define MAX_LOGMSG_LEN 1024 +#include +#include "plinfo.h" // For GetGameInfo: enum ginfo_t { - GINFO_NAME = 0, + GINFO_NAME, GINFO_DESC, GINFO_GAMEDIR, GINFO_DLL_FULLPATH, @@ -17,64 +17,46 @@ enum ginfo_t // Meta Utility Function table type. struct mutil_funcs_t { - void (*pfnLogConsole) (plid_t plid, const char *fmt, ...); - void (*pfnLogMessage) (plid_t plid, const char *fmt, ...); - void (*pfnLogError) (plid_t plid, const char *fmt, ...); - void (*pfnLogDeveloper) (plid_t plid, const char *fmt, ...); - void (*pfnCenterSay) (plid_t plid, const char *fmt, ...); - void (*pfnCenterSayParms) (plid_t plid, hudtextparms_t tparms, const char *fmt, ...); - void (*pfnCenterSayVarargs) (plid_t plid, hudtextparms_t tparms, const char *fmt, va_list ap); - qboolean (*pfnCallGameEntity) (plid_t plid, const char *entStr, entvars_t *pev); - int (*pfnGetUserMsgID) (plid_t plid, const char *msgname, int *size); - const char * (*pfnGetUserMsgName) (plid_t plid, int msgid, int *size); - const char * (*pfnGetPluginPath) (plid_t plid); - const char * (*pfnGetGameInfo) (plid_t plid, ginfo_t tag); - int (*pfnLoadPlugin) (plid_t plid, const char *cmdline, PLUG_LOADTIME now, void **plugin_handle); - int (*pfnUnloadPlugin) (plid_t plid, const char *cmdline, PLUG_LOADTIME now, PL_UNLOAD_REASON reason); - int (*pfnUnloadPluginByHandle) (plid_t plid, void *plugin_handle, PLUG_LOADTIME now, PL_UNLOAD_REASON reason); - const char * (*pfnIsQueryingClientCvar) (plid_t plid, const edict_t *pEdict); - int (*pfnMakeRequestId) (plid_t plid); - void (*pfnGetHookTables) (plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll); + void (*pfnLogConsole) (plid_t plid, const char *fmt, ...); + void (*pfnLogMessage) (plid_t plid, const char *fmt, ...); + void (*pfnLogError) (plid_t plid, const char *fmt, ...); + void (*pfnLogDeveloper) (plid_t plid, const char *fmt, ...); + void (*pfnCenterSay) (plid_t plid, const char *fmt, ...); + void (*pfnCenterSayParms) (plid_t plid, hudtextparms_t tparms, const char *fmt, ...); + void (*pfnCenterSayVarargs) (plid_t plid, hudtextparms_t tparms, const char *fmt, va_list ap); + qboolean (*pfnCallGameEntity) (plid_t plid, const char *entStr, entvars_t *pev); + int (*pfnGetUserMsgID) (plid_t plid, const char *msgname, int *size); + const char * (*pfnGetUserMsgName) (plid_t plid, int msgid, int *size); + const char * (*pfnGetPluginPath) (plid_t plid); + const char * (*pfnGetGameInfo) (plid_t plid, ginfo_t tag); + int (*pfnLoadPlugin) (plid_t plid, const char *cmdline, PLUG_LOADTIME now, void **plugin_handle); + int (*pfnUnloadPlugin) (plid_t plid, const char *cmdline, PLUG_LOADTIME now, PL_UNLOAD_REASON reason); + int (*pfnUnloadPluginByHandle) (plid_t plid, void *plugin_handle, PLUG_LOADTIME now, PL_UNLOAD_REASON reason); + const char * (*pfnIsQueryingClientCvar) (plid_t plid, const edict_t *pEdict); + int (*pfnMakeRequestId) (plid_t plid); + void (*pfnGetHookTables) (plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll); }; -extern mutil_funcs_t g_MetaUtilFunctions; - -// Meta Utility Functions -void mutil_LogConsole(plid_t plid, const char *fmt, ...); -void mutil_LogMessage(plid_t plid, const char *fmt, ...); -void mutil_LogError(plid_t plid, const char *fmt, ...); -void mutil_LogDeveloper(plid_t plid, const char *fmt, ...); - -void mutil_CenterSay(plid_t plid, const char *fmt, ...); -void mutil_CenterSayParms(plid_t plid, hudtextparms_t tparms, const char *fmt, ...); -void mutil_CenterSayVarargs(plid_t plid, hudtextparms_t tparms, const char *fmt, va_list ap); - -qboolean mutil_CallGameEntity(plid_t plid, const char *entStr, entvars_t *pev); - -int mutil_GetUserMsgID(plid_t plid, const char *name, int *size); -const char *mutil_GetUserMsgName(plid_t plid, int msgid, int *size); -const char *mutil_GetPluginPath(plid_t plid); -const char *mutil_GetGameInfo(plid_t plid, ginfo_t tag); -const char *mutil_IsQueryingClientCvar(plid_t plid, const edict_t *pEdict); -int mutil_MakeRequestId(plid_t plid); -void mutil_GetHookTables(plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll); - // Convenience macros for MetaUtil functions -#define LOG_CONSOLE (*gpMetaUtilFuncs->pfnLogConsole) -#define LOG_MESSAGE (*gpMetaUtilFuncs->pfnLogMessage) -#define LOG_ERROR (*gpMetaUtilFuncs->pfnLogError) -#define LOG_DEVELOPER (*gpMetaUtilFuncs->pfnLogDeveloper) -#define CENTER_SAY (*gpMetaUtilFuncs->pfnCenterSay) -#define CENTER_SAY_PARMS (*gpMetaUtilFuncs->pfnCenterSayParms) -#define CENTER_SAY_VARARGS (*gpMetaUtilFuncs->pfnCenterSayVarargs) -#define CALL_GAME_ENTITY (*gpMetaUtilFuncs->pfnCallGameEntity) -#define GET_USER_MSG_ID (*gpMetaUtilFuncs->pfnGetUserMsgID) -#define GET_USER_MSG_NAME (*gpMetaUtilFuncs->pfnGetUserMsgName) -#define GET_PLUGIN_PATH (*gpMetaUtilFuncs->pfnGetPluginPath) -#define GET_GAME_INFO (*gpMetaUtilFuncs->pfnGetGameInfo) -#define LOAD_PLUGIN (*gpMetaUtilFuncs->pfnLoadPlugin) -#define UNLOAD_PLUGIN (*gpMetaUtilFuncs->pfnUnloadPlugin) +#define LOG_CONSOLE (*gpMetaUtilFuncs->pfnLogConsole) +#define LOG_MESSAGE (*gpMetaUtilFuncs->pfnLogMessage) +#define LOG_ERROR (*gpMetaUtilFuncs->pfnLogError) +#define LOG_DEVELOPER (*gpMetaUtilFuncs->pfnLogDeveloper) +#define CENTER_SAY (*gpMetaUtilFuncs->pfnCenterSay) +#define CENTER_SAY_PARMS (*gpMetaUtilFuncs->pfnCenterSayParms) +#define CENTER_SAY_VARARGS (*gpMetaUtilFuncs->pfnCenterSayVarargs) +#define CALL_GAME_ENTITY (*gpMetaUtilFuncs->pfnCallGameEntity) +#define GET_USER_MSG_ID (*gpMetaUtilFuncs->pfnGetUserMsgID) +#define GET_USER_MSG_NAME (*gpMetaUtilFuncs->pfnGetUserMsgName) +#define GET_PLUGIN_PATH (*gpMetaUtilFuncs->pfnGetPluginPath) +#define GET_GAME_INFO (*gpMetaUtilFuncs->pfnGetGameInfo) +#define LOAD_PLUGIN (*gpMetaUtilFuncs->pfnLoadPlugin) +#define UNLOAD_PLUGIN (*gpMetaUtilFuncs->pfnUnloadPlugin) #define UNLOAD_PLUGIN_BY_HANDLE (*gpMetaUtilFuncs->pfnUnloadPluginByHandle) #define IS_QUERYING_CLIENT_CVAR (*gpMetaUtilFuncs->pfnIsQueryingClientCvar) -#define MAKE_REQUESTID (*gpMetaUtilFuncs->pfnMakeRequestId) -#define GET_HOOK_TABLES (*gpMetaUtilFuncs->pfnGetHookTables) +#define MAKE_REQUESTID (*gpMetaUtilFuncs->pfnMakeRequestId) +#define GET_HOOK_TABLES (*gpMetaUtilFuncs->pfnGetHookTables) + +#ifdef METAMOD_CORE +extern mutil_funcs_t g_MetaUtilFunctions; +#endif diff --git a/AccuracyFix/include/metamod/plinfo.h b/AccuracyFix/include/metamod/plinfo.h index 9d40002..3a95a7a 100644 --- a/AccuracyFix/include/metamod/plinfo.h +++ b/AccuracyFix/include/metamod/plinfo.h @@ -4,41 +4,41 @@ // NOTE: order is crucial, as greater/less comparisons are made. enum PLUG_LOADTIME { - PT_NEVER = 0, - PT_STARTUP, // should only be loaded/unloaded at initial hlds execution - PT_CHANGELEVEL, // can be loaded/unloaded between maps - PT_ANYTIME, // can be loaded/unloaded at any time - PT_ANYPAUSE, // can be loaded/unloaded at any time, and can be "paused" during a map + PT_NEVER, + PT_STARTUP, // should only be loaded/unloaded at initial hlds execution + PT_CHANGELEVEL, // can be loaded/unloaded between maps + PT_ANYTIME, // can be loaded/unloaded at any time + PT_ANYPAUSE, // can be loaded/unloaded at any time, and can be "paused" during a map }; // Flags to indicate why the plugin is being unloaded. enum PL_UNLOAD_REASON { - PNL_NULL = 0, - PNL_INI_DELETED, // was deleted from plugins.ini - PNL_FILE_NEWER, // file on disk is newer than last load - PNL_COMMAND, // requested by server/console command - PNL_CMD_FORCED, // forced by server/console command - PNL_DELAYED, // delayed from previous request; can't tell origin + PNL_NULL, + PNL_INI_DELETED, // was deleted from plugins.ini + PNL_FILE_NEWER, // file on disk is newer than last load + PNL_COMMAND, // requested by server/console command + PNL_CMD_FORCED, // forced by server/console command + PNL_DELAYED, // delayed from previous request; can't tell origin - // only used for 'real_reason' on MPlugin::unload() - PNL_PLUGIN, // requested by plugin function call - PNL_PLG_FORCED, // forced by plugin function call - PNL_RELOAD, // forced unload by reload() + // only used for 'real_reason' on MPlugin::unload() + PNL_PLUGIN, // requested by plugin function call + PNL_PLG_FORCED, // forced by plugin function call + PNL_RELOAD, // forced unload by reload() }; // Information plugin provides about itself. struct plugin_info_t { - const char *ifvers; // meta_interface version - const char *name; // full name of plugin - const char *version; // version - const char *date; // date - const char *author; // author name/email - const char *url; // URL - const char *logtag; // log message prefix (unused right now) - PLUG_LOADTIME loadable; // when loadable - PLUG_LOADTIME unloadable; // when unloadable + const char* ifvers; // meta_interface version + const char* name; // full name of plugin + const char* version; // version + const char* date; // date + const char* author; // author name/email + const char* url; // URL + const char* logtag; // log message prefix (unused right now) + PLUG_LOADTIME loadable; // when loadable + PLUG_LOADTIME unloadable; // when unloadable }; extern plugin_info_t Plugin_info;