From 1ec93281b66061f7f7cff509450299bdcbf813b4 Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 28 Feb 2016 02:12:48 +0100 Subject: Moved HPMHooking-related definitions to plugins/HPMHooking.h - Plugins that want to make use of the HPMHooking must now include "plugins/HPMHooking.h". Signed-off-by: Haru --- src/common/HPMi.h | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'src/common/HPMi.h') diff --git a/src/common/HPMi.h b/src/common/HPMi.h index 72640b382..e16eb1d75 100644 --- a/src/common/HPMi.h +++ b/src/common/HPMi.h @@ -25,6 +25,7 @@ #include "common/core.h" #include "common/showmsg.h" +struct HPMHooking_interface; struct Sql; // common/sql.h struct script_state; struct AtCommandInfo; @@ -32,7 +33,7 @@ struct socket_data; struct map_session_data; struct hplugin_data_store; -#define HPM_VERSION "1.1" +#define HPM_VERSION "1.2" #define HPM_ADDCONF_LENGTH 40 struct hplugin_info { @@ -71,11 +72,6 @@ enum HPluginPacketHookingPoints { hpPHP_MAX, }; -enum HPluginHookType { - HOOK_TYPE_PRE, - HOOK_TYPE_POST, -}; - /** * Data types for plugin custom data. */ @@ -107,13 +103,6 @@ enum HPluginConfType { HPCT_MAX, }; -#define addHookPre(tname,hook) (HPMi->AddHook(HOOK_TYPE_PRE,(tname),(hook),HPMi->pid)) -#define addHookPost(tname,hook) (HPMi->AddHook(HOOK_TYPE_POST,(tname),(hook),HPMi->pid)) -/* need better names ;/ */ -/* will not run the original function after pre-hook processing is complete (other hooks will run) */ -#define hookStop() (HPMi->HookStop(__func__,HPMi->pid)) -#define hookStopped() (HPMi->HookStopped()) - #define addArg(name, param,func,help) (HPMi->addArg(HPMi->pid,(name),(param),(cmdline_arg_ ## func),(help))) /* HPData handy redirects */ /* session[] */ @@ -231,10 +220,6 @@ struct HPMi_interface { void (*removeFromHPData) (enum HPluginDataTypes type, uint32 pluginID, struct hplugin_data_store *store, uint32 classid); /* packet */ bool (*addPacket) (unsigned short cmd, unsigned short length, void (*receive)(int fd), unsigned int point, unsigned int pluginID); - /* Hooking */ - bool (*AddHook) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); - void (*HookStop) (const char *func, unsigned int pID); - bool (*HookStopped) (void); /* program --arg/-a */ bool (*addArg) (unsigned int pluginID, char *name, bool has_param, CmdlineExecFunc func, const char *help); /* battle-config recv param */ @@ -243,6 +228,9 @@ struct HPMi_interface { void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); struct Sql *sql_handle; + + /* Hooking */ + struct HPMHooking_interface *hooking; }; #ifdef HERCULES_CORE #define HPM_SYMBOL(n, s) (HPM->share((s), (n)), true) -- cgit v1.2.3-60-g2f50