From 50cacd3089a6d1f349837b1b80e8bd4f20d2c3c2 Mon Sep 17 00:00:00 2001 From: Haru Date: Tue, 11 Aug 2015 01:48:47 +0200 Subject: HPM Hooks Update --- src/common/HPMDataCheck.h | 1 + src/common/HPMSymbols.inc.h | 3 +++ .../HPMHooking/HPMHooking_char.HPMHooksCore.inc | 5 ++++ .../HPMHooking/HPMHooking_char.HookingPoints.inc | 2 ++ src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 27 ++++++++++++++++++++++ src/plugins/HPMHooking/HPMHooking_char.sources.inc | 1 + .../HPMHooking/HPMHooking_login.HPMHooksCore.inc | 5 ++++ .../HPMHooking/HPMHooking_login.HookingPoints.inc | 2 ++ src/plugins/HPMHooking/HPMHooking_login.Hooks.inc | 27 ++++++++++++++++++++++ .../HPMHooking/HPMHooking_login.sources.inc | 1 + .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 5 ++++ .../HPMHooking/HPMHooking_map.HookingPoints.inc | 2 ++ src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 27 ++++++++++++++++++++++ src/plugins/HPMHooking/HPMHooking_map.sources.inc | 1 + 14 files changed, 109 insertions(+) diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 390afa007..ad514c6ab 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -114,6 +114,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #ifdef COMMON_CORE_H { "CmdlineArgData", sizeof(struct CmdlineArgData), SERVER_TYPE_ALL }, { "cmdline_interface", sizeof(struct cmdline_interface), SERVER_TYPE_ALL }, + { "core_interface", sizeof(struct core_interface), SERVER_TYPE_ALL }, #else #define COMMON_CORE_H #endif // COMMON_CORE_H diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h index 28bb7c59e..9e08a8806 100644 --- a/src/common/HPMSymbols.inc.h +++ b/src/common/HPMSymbols.inc.h @@ -40,6 +40,9 @@ if ((server_type&(SERVER_TYPE_ALL)) && !HPM_SYMBOL("cmdline", cmdline)) return " #ifdef COMMON_CONSOLE_H /* console */ if ((server_type&(SERVER_TYPE_ALL)) && !HPM_SYMBOL("console", console)) return "console"; #endif // COMMON_CONSOLE_H +#ifdef COMMON_CORE_H /* core */ +if ((server_type&(SERVER_TYPE_ALL)) && !HPM_SYMBOL("core", core)) return "core"; +#endif // COMMON_CORE_H #ifdef COMMON_DB_H /* DB */ if ((server_type&(SERVER_TYPE_ALL)) && !HPM_SYMBOL("DB", DB)) return "DB"; #endif // COMMON_DB_H diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index a9c9fbd5f..c5f135937 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -347,6 +347,8 @@ struct { struct HPMHookPoint *HP_console_final_post; struct HPMHookPoint *HP_console_display_title_pre; struct HPMHookPoint *HP_console_display_title_post; + struct HPMHookPoint *HP_core_shutdown_callback_pre; + struct HPMHookPoint *HP_core_shutdown_callback_post; struct HPMHookPoint *HP_DB_fix_options_pre; struct HPMHookPoint *HP_DB_fix_options_post; struct HPMHookPoint *HP_DB_default_cmp_pre; @@ -1720,6 +1722,8 @@ struct { int HP_console_final_post; int HP_console_display_title_pre; int HP_console_display_title_post; + int HP_core_shutdown_callback_pre; + int HP_core_shutdown_callback_post; int HP_DB_fix_options_pre; int HP_DB_fix_options_post; int HP_DB_default_cmp_pre; @@ -2755,6 +2759,7 @@ struct { struct char_interface chr; struct cmdline_interface cmdline; struct console_interface console; + struct core_interface core; struct db_interface DB; struct geoip_interface geoip; struct inter_auction_interface inter_auction; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index 9eb6b0fb2..59c82f0e2 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -180,6 +180,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(console->init, HP_console_init) }, { HP_POP(console->final, HP_console_final) }, { HP_POP(console->display_title, HP_console_display_title) }, +/* core */ + { HP_POP(core->shutdown_callback, HP_core_shutdown_callback) }, /* DB */ { HP_POP(DB->fix_options, HP_DB_fix_options) }, { HP_POP(DB->default_cmp, HP_DB_default_cmp) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 89e0661bb..2e35992bc 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -4543,6 +4543,33 @@ void HP_console_display_title(void) { } return; } +/* core */ +void HP_core_shutdown_callback(void) { + int hIndex = 0; + if( HPMHooks.count.HP_core_shutdown_callback_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_core_shutdown_callback_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_core_shutdown_callback_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.core.shutdown_callback(); + } + if( HPMHooks.count.HP_core_shutdown_callback_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_core_shutdown_callback_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_core_shutdown_callback_post[hIndex].func; + postHookFunc(); + } + } + return; +} /* DB */ DBOptions HP_DB_fix_options(DBType type, DBOptions options) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_char.sources.inc b/src/plugins/HPMHooking/HPMHooking_char.sources.inc index 17253aa82..489917771 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.sources.inc @@ -8,6 +8,7 @@ memcpy(&HPMHooks.source.HCache, HCache, sizeof(struct HCache_interface)); memcpy(&HPMHooks.source.chr, chr, sizeof(struct char_interface)); memcpy(&HPMHooks.source.cmdline, cmdline, sizeof(struct cmdline_interface)); memcpy(&HPMHooks.source.console, console, sizeof(struct console_interface)); +memcpy(&HPMHooks.source.core, core, sizeof(struct core_interface)); memcpy(&HPMHooks.source.DB, DB, sizeof(struct db_interface)); memcpy(&HPMHooks.source.geoip, geoip, sizeof(struct geoip_interface)); memcpy(&HPMHooks.source.inter_auction, inter_auction, sizeof(struct inter_auction_interface)); diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc index cdc8f6820..4edefd5b7 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc @@ -29,6 +29,8 @@ struct { struct HPMHookPoint *HP_console_final_post; struct HPMHookPoint *HP_console_display_title_pre; struct HPMHookPoint *HP_console_display_title_post; + struct HPMHookPoint *HP_core_shutdown_callback_pre; + struct HPMHookPoint *HP_core_shutdown_callback_post; struct HPMHookPoint *HP_DB_fix_options_pre; struct HPMHookPoint *HP_DB_fix_options_post; struct HPMHookPoint *HP_DB_default_cmp_pre; @@ -598,6 +600,8 @@ struct { int HP_console_final_post; int HP_console_display_title_pre; int HP_console_display_title_post; + int HP_core_shutdown_callback_pre; + int HP_core_shutdown_callback_post; int HP_DB_fix_options_pre; int HP_DB_fix_options_post; int HP_DB_default_cmp_pre; @@ -1146,6 +1150,7 @@ struct { struct HCache_interface HCache; struct cmdline_interface cmdline; struct console_interface console; + struct core_interface core; struct db_interface DB; struct libconfig_interface libconfig; struct login_interface login; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc index 93e063746..cdcdedcb5 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc @@ -20,6 +20,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(console->init, HP_console_init) }, { HP_POP(console->final, HP_console_final) }, { HP_POP(console->display_title, HP_console_display_title) }, +/* core */ + { HP_POP(core->shutdown_callback, HP_core_shutdown_callback) }, /* DB */ { HP_POP(DB->fix_options, HP_DB_fix_options) }, { HP_POP(DB->default_cmp, HP_DB_default_cmp) }, diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index 588fddcb0..94b298d36 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc @@ -325,6 +325,33 @@ void HP_console_display_title(void) { } return; } +/* core */ +void HP_core_shutdown_callback(void) { + int hIndex = 0; + if( HPMHooks.count.HP_core_shutdown_callback_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_core_shutdown_callback_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_core_shutdown_callback_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.core.shutdown_callback(); + } + if( HPMHooks.count.HP_core_shutdown_callback_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_core_shutdown_callback_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_core_shutdown_callback_post[hIndex].func; + postHookFunc(); + } + } + return; +} /* DB */ DBOptions HP_DB_fix_options(DBType type, DBOptions options) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_login.sources.inc b/src/plugins/HPMHooking/HPMHooking_login.sources.inc index 8bafb6a68..aed0dc77f 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.sources.inc @@ -7,6 +7,7 @@ memcpy(&HPMHooks.source.HCache, HCache, sizeof(struct HCache_interface)); memcpy(&HPMHooks.source.cmdline, cmdline, sizeof(struct cmdline_interface)); memcpy(&HPMHooks.source.console, console, sizeof(struct console_interface)); +memcpy(&HPMHooks.source.core, core, sizeof(struct core_interface)); memcpy(&HPMHooks.source.DB, DB, sizeof(struct db_interface)); memcpy(&HPMHooks.source.libconfig, libconfig, sizeof(struct libconfig_interface)); memcpy(&HPMHooks.source.login, login, sizeof(struct login_interface)); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 471853956..28892e84d 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -1831,6 +1831,8 @@ struct { struct HPMHookPoint *HP_console_final_post; struct HPMHookPoint *HP_console_display_title_pre; struct HPMHookPoint *HP_console_display_title_post; + struct HPMHookPoint *HP_core_shutdown_callback_pre; + struct HPMHookPoint *HP_core_shutdown_callback_post; struct HPMHookPoint *HP_DB_fix_options_pre; struct HPMHookPoint *HP_DB_fix_options_post; struct HPMHookPoint *HP_DB_default_cmp_pre; @@ -7538,6 +7540,8 @@ struct { int HP_console_final_post; int HP_console_display_title_pre; int HP_console_display_title_post; + int HP_core_shutdown_callback_pre; + int HP_core_shutdown_callback_post; int HP_DB_fix_options_pre; int HP_DB_fix_options_post; int HP_DB_default_cmp_pre; @@ -11430,6 +11434,7 @@ struct { struct clif_interface clif; struct cmdline_interface cmdline; struct console_interface console; + struct core_interface core; struct db_interface DB; struct duel_interface duel; struct elemental_interface elemental; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 74d073b0d..cc96d3171 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -929,6 +929,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(console->init, HP_console_init) }, { HP_POP(console->final, HP_console_final) }, { HP_POP(console->display_title, HP_console_display_title) }, +/* core */ + { HP_POP(core->shutdown_callback, HP_core_shutdown_callback) }, /* DB */ { HP_POP(DB->fix_options, HP_DB_fix_options) }, { HP_POP(DB->default_cmp, HP_DB_default_cmp) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index ef6922678..bc2235b02 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -24079,6 +24079,33 @@ void HP_console_display_title(void) { } return; } +/* core */ +void HP_core_shutdown_callback(void) { + int hIndex = 0; + if( HPMHooks.count.HP_core_shutdown_callback_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_core_shutdown_callback_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_core_shutdown_callback_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.core.shutdown_callback(); + } + if( HPMHooks.count.HP_core_shutdown_callback_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_core_shutdown_callback_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_core_shutdown_callback_post[hIndex].func; + postHookFunc(); + } + } + return; +} /* DB */ DBOptions HP_DB_fix_options(DBType type, DBOptions options) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_map.sources.inc b/src/plugins/HPMHooking/HPMHooking_map.sources.inc index 53905a9d9..024febdf8 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.sources.inc @@ -15,6 +15,7 @@ memcpy(&HPMHooks.source.chrif, chrif, sizeof(struct chrif_interface)); memcpy(&HPMHooks.source.clif, clif, sizeof(struct clif_interface)); memcpy(&HPMHooks.source.cmdline, cmdline, sizeof(struct cmdline_interface)); memcpy(&HPMHooks.source.console, console, sizeof(struct console_interface)); +memcpy(&HPMHooks.source.core, core, sizeof(struct core_interface)); memcpy(&HPMHooks.source.DB, DB, sizeof(struct db_interface)); memcpy(&HPMHooks.source.duel, duel, sizeof(struct duel_interface)); memcpy(&HPMHooks.source.elemental, elemental, sizeof(struct elemental_interface)); -- cgit v1.2.3-70-g09d2