diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-11-05 23:53:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-11-14 06:00:50 +0300 |
commit | a9caa4ea37115869eb3926ca6e4c53709e7d9337 (patch) | |
tree | 0940de7d3992bfe0adacf3a36a6831ac516c99e7 /src | |
parent | 94366099f9019643c9e431a35af064283fab5a0c (diff) | |
download | hercules-a9caa4ea37115869eb3926ca6e4c53709e7d9337.tar.gz hercules-a9caa4ea37115869eb3926ca6e4c53709e7d9337.tar.bz2 hercules-a9caa4ea37115869eb3926ca6e4c53709e7d9337.tar.xz hercules-a9caa4ea37115869eb3926ca6e4c53709e7d9337.zip |
Update HPM hooks.
Diffstat (limited to 'src')
-rw-r--r-- | src/common/HPMDataCheck.h | 5 | ||||
-rw-r--r-- | src/common/HPMSymbols.inc.h | 7 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Defs.inc | 10 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc | 17 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc | 5 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 105 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.sources.inc | 1 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc | 17 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc | 5 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.Hooks.inc | 105 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.sources.inc | 1 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 17 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 5 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 105 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.sources.inc | 1 |
15 files changed, 406 insertions, 0 deletions
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index ecdc83740..674e8ccc8 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -256,6 +256,11 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #else #define COMMON_NULLPO_H #endif // COMMON_NULLPO_H + #ifdef COMMON_PACKETS_H + { "packets_interface", sizeof(struct packets_interface), SERVER_TYPE_ALL }, + #else + #define COMMON_PACKETS_H + #endif // COMMON_PACKETS_H #ifdef COMMON_RANDOM_H { "rnd_interface", sizeof(struct rnd_interface), SERVER_TYPE_ALL }, #else diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h index 15acb1b06..146379508 100644 --- a/src/common/HPMSymbols.inc.h +++ b/src/common/HPMSymbols.inc.h @@ -218,6 +218,9 @@ struct npc_interface *npc; #ifdef COMMON_NULLPO_H /* nullpo */ struct nullpo_interface *nullpo; #endif // COMMON_NULLPO_H +#ifdef COMMON_PACKETS_H /* packets */ +struct packets_interface *packets; +#endif // COMMON_PACKETS_H #ifdef MAP_PARTY_H /* party */ struct party_interface *party; #endif // MAP_PARTY_H @@ -559,6 +562,10 @@ HPExport const char *HPM_shared_symbols(int server_type) if ((server_type&(SERVER_TYPE_ALL)) != 0 && !HPM_SYMBOL("nullpo", nullpo)) return "nullpo"; #endif // COMMON_NULLPO_H +#ifdef COMMON_PACKETS_H /* packets */ + if ((server_type&(SERVER_TYPE_ALL)) != 0 && !HPM_SYMBOL("packets", packets)) + return "packets"; +#endif // COMMON_PACKETS_H #ifdef MAP_PARTY_H /* party */ if ((server_type&(SERVER_TYPE_MAP)) != 0 && !HPM_SYMBOL("party", party)) return "party"; diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 81e25f033..d366c1e08 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -5673,6 +5673,16 @@ typedef int (*HPMHOOK_post_npc_secure_timeout_timer) (int retVal___, int tid, in typedef void (*HPMHOOK_pre_nullpo_assert_report) (const char **file, int *line, const char **func, const char **targetname, const char **title); typedef void (*HPMHOOK_post_nullpo_assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title); #endif // COMMON_NULLPO_H +#ifdef COMMON_PACKETS_H /* packets */ +typedef void (*HPMHOOK_pre_packets_init) (void); +typedef void (*HPMHOOK_post_packets_init) (void); +typedef void (*HPMHOOK_pre_packets_final) (void); +typedef void (*HPMHOOK_post_packets_final) (void); +typedef void (*HPMHOOK_pre_packets_addLens) (void); +typedef void (*HPMHOOK_post_packets_addLens) (void); +typedef void (*HPMHOOK_pre_packets_addLen) (int *id, int *len); +typedef void (*HPMHOOK_post_packets_addLen) (int id, int len); +#endif // COMMON_PACKETS_H #ifdef MAP_PARTY_H /* party */ typedef void (*HPMHOOK_pre_party_init) (bool *minimal); typedef void (*HPMHOOK_post_party_init) (bool minimal); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index 2b0291453..81abf7d69 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -1322,6 +1322,14 @@ struct { struct HPMHookPoint *HP_mutex_cond_broadcast_post; struct HPMHookPoint *HP_nullpo_assert_report_pre; struct HPMHookPoint *HP_nullpo_assert_report_post; + struct HPMHookPoint *HP_packets_init_pre; + struct HPMHookPoint *HP_packets_init_post; + struct HPMHookPoint *HP_packets_final_pre; + struct HPMHookPoint *HP_packets_final_post; + struct HPMHookPoint *HP_packets_addLens_pre; + struct HPMHookPoint *HP_packets_addLens_post; + struct HPMHookPoint *HP_packets_addLen_pre; + struct HPMHookPoint *HP_packets_addLen_post; struct HPMHookPoint *HP_pincode_handle_pre; struct HPMHookPoint *HP_pincode_handle_post; struct HPMHookPoint *HP_pincode_decrypt_pre; @@ -2945,6 +2953,14 @@ struct { int HP_mutex_cond_broadcast_post; int HP_nullpo_assert_report_pre; int HP_nullpo_assert_report_post; + int HP_packets_init_pre; + int HP_packets_init_post; + int HP_packets_final_pre; + int HP_packets_final_post; + int HP_packets_addLens_pre; + int HP_packets_addLens_post; + int HP_packets_addLen_pre; + int HP_packets_addLen_post; int HP_pincode_handle_pre; int HP_pincode_handle_post; int HP_pincode_decrypt_pre; @@ -3301,6 +3317,7 @@ struct { struct md5_interface md5; struct mutex_interface mutex; struct nullpo_interface nullpo; + struct packets_interface packets; struct pincode_interface pincode; struct rnd_interface rnd; struct showmsg_interface showmsg; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index cb6ae1bb8..b61526562 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -703,6 +703,11 @@ struct HookingPointData HookingPoints[] = { { HP_POP(mutex->cond_broadcast, HP_mutex_cond_broadcast) }, /* nullpo_interface */ { HP_POP(nullpo->assert_report, HP_nullpo_assert_report) }, +/* packets_interface */ + { HP_POP(packets->init, HP_packets_init) }, + { HP_POP(packets->final, HP_packets_final) }, + { HP_POP(packets->addLens, HP_packets_addLens) }, + { HP_POP(packets->addLen, HP_packets_addLen) }, /* pincode_interface */ { HP_POP(pincode->handle, HP_pincode_handle) }, { HP_POP(pincode->decrypt, HP_pincode_decrypt) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 767c7d24e..e87f6fe9c 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -17357,6 +17357,111 @@ void HP_nullpo_assert_report(const char *file, int line, const char *func, const } return; } +/* packets_interface */ +void HP_packets_init(void) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_init_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_init_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_init_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.init(); + } + if (HPMHooks.count.HP_packets_init_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_init_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_init_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_packets_final(void) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_final_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_final_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_final_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.final(); + } + if (HPMHooks.count.HP_packets_final_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_final_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_packets_addLens(void) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_addLens_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLens_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_addLens_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.addLens(); + } + if (HPMHooks.count.HP_packets_addLens_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLens_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_addLens_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_packets_addLen(int id, int len) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_addLen_pre > 0) { + void (*preHookFunc) (int *id, int *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLen_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_addLen_pre[hIndex].func; + preHookFunc(&id, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.addLen(id, len); + } + if (HPMHooks.count.HP_packets_addLen_post > 0) { + void (*postHookFunc) (int id, int len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLen_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_addLen_post[hIndex].func; + postHookFunc(id, len); + } + } + return; +} /* pincode_interface */ void HP_pincode_handle(int fd, struct char_session_data *sd) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_char.sources.inc b/src/plugins/HPMHooking/HPMHooking_char.sources.inc index 0d69cd755..7fb575afe 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.sources.inc @@ -54,6 +54,7 @@ HPMHooks.source.mapindex = *mapindex; HPMHooks.source.md5 = *md5; HPMHooks.source.mutex = *mutex; HPMHooks.source.nullpo = *nullpo; +HPMHooks.source.packets = *packets; HPMHooks.source.pincode = *pincode; HPMHooks.source.rnd = *rnd; HPMHooks.source.showmsg = *showmsg; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc index 5300ca3a6..f1450e2e1 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc @@ -512,6 +512,14 @@ struct { struct HPMHookPoint *HP_mutex_cond_broadcast_post; struct HPMHookPoint *HP_nullpo_assert_report_pre; struct HPMHookPoint *HP_nullpo_assert_report_post; + struct HPMHookPoint *HP_packets_init_pre; + struct HPMHookPoint *HP_packets_init_post; + struct HPMHookPoint *HP_packets_final_pre; + struct HPMHookPoint *HP_packets_final_post; + struct HPMHookPoint *HP_packets_addLens_pre; + struct HPMHookPoint *HP_packets_addLens_post; + struct HPMHookPoint *HP_packets_addLen_pre; + struct HPMHookPoint *HP_packets_addLen_post; struct HPMHookPoint *HP_rnd_init_pre; struct HPMHookPoint *HP_rnd_init_post; struct HPMHookPoint *HP_rnd_final_pre; @@ -1293,6 +1301,14 @@ struct { int HP_mutex_cond_broadcast_post; int HP_nullpo_assert_report_pre; int HP_nullpo_assert_report_post; + int HP_packets_init_pre; + int HP_packets_init_post; + int HP_packets_final_pre; + int HP_packets_final_post; + int HP_packets_addLens_pre; + int HP_packets_addLens_post; + int HP_packets_addLen_pre; + int HP_packets_addLen_post; int HP_rnd_init_pre; int HP_rnd_init_post; int HP_rnd_final_pre; @@ -1605,6 +1621,7 @@ struct { struct md5_interface md5; struct mutex_interface mutex; struct nullpo_interface nullpo; + struct packets_interface packets; struct rnd_interface rnd; struct showmsg_interface showmsg; struct socket_interface sockt; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc index 6eb2e8121..a566659ff 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc @@ -286,6 +286,11 @@ struct HookingPointData HookingPoints[] = { { HP_POP(mutex->cond_broadcast, HP_mutex_cond_broadcast) }, /* nullpo_interface */ { HP_POP(nullpo->assert_report, HP_nullpo_assert_report) }, +/* packets_interface */ + { HP_POP(packets->init, HP_packets_init) }, + { HP_POP(packets->final, HP_packets_final) }, + { HP_POP(packets->addLens, HP_packets_addLens) }, + { HP_POP(packets->addLen, HP_packets_addLen) }, /* rnd_interface */ { HP_POP(rnd->init, HP_rnd_init) }, { HP_POP(rnd->final, HP_rnd_final) }, diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index e432da70d..5e3d7b28d 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc @@ -6532,6 +6532,111 @@ void HP_nullpo_assert_report(const char *file, int line, const char *func, const } return; } +/* packets_interface */ +void HP_packets_init(void) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_init_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_init_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_init_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.init(); + } + if (HPMHooks.count.HP_packets_init_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_init_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_init_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_packets_final(void) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_final_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_final_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_final_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.final(); + } + if (HPMHooks.count.HP_packets_final_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_final_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_packets_addLens(void) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_addLens_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLens_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_addLens_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.addLens(); + } + if (HPMHooks.count.HP_packets_addLens_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLens_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_addLens_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_packets_addLen(int id, int len) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_addLen_pre > 0) { + void (*preHookFunc) (int *id, int *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLen_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_addLen_pre[hIndex].func; + preHookFunc(&id, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.addLen(id, len); + } + if (HPMHooks.count.HP_packets_addLen_post > 0) { + void (*postHookFunc) (int id, int len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLen_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_addLen_post[hIndex].func; + postHookFunc(id, len); + } + } + return; +} /* rnd_interface */ void HP_rnd_init(void) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_login.sources.inc b/src/plugins/HPMHooking/HPMHooking_login.sources.inc index 78c506043..552aad578 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.sources.inc @@ -42,6 +42,7 @@ HPMHooks.source.loginlog = *loginlog; HPMHooks.source.md5 = *md5; HPMHooks.source.mutex = *mutex; HPMHooks.source.nullpo = *nullpo; +HPMHooks.source.packets = *packets; HPMHooks.source.rnd = *rnd; HPMHooks.source.showmsg = *showmsg; HPMHooks.source.sockt = *sockt; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index b0b2e7a32..dcbf800fe 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -4248,6 +4248,14 @@ struct { struct HPMHookPoint *HP_npc_secure_timeout_timer_post; struct HPMHookPoint *HP_nullpo_assert_report_pre; struct HPMHookPoint *HP_nullpo_assert_report_post; + struct HPMHookPoint *HP_packets_init_pre; + struct HPMHookPoint *HP_packets_init_post; + struct HPMHookPoint *HP_packets_final_pre; + struct HPMHookPoint *HP_packets_final_post; + struct HPMHookPoint *HP_packets_addLens_pre; + struct HPMHookPoint *HP_packets_addLens_post; + struct HPMHookPoint *HP_packets_addLen_pre; + struct HPMHookPoint *HP_packets_addLen_post; struct HPMHookPoint *HP_party_init_pre; struct HPMHookPoint *HP_party_init_post; struct HPMHookPoint *HP_party_final_pre; @@ -10851,6 +10859,14 @@ struct { int HP_npc_secure_timeout_timer_post; int HP_nullpo_assert_report_pre; int HP_nullpo_assert_report_post; + int HP_packets_init_pre; + int HP_packets_init_post; + int HP_packets_final_pre; + int HP_packets_final_post; + int HP_packets_addLens_pre; + int HP_packets_addLens_post; + int HP_packets_addLen_pre; + int HP_packets_addLen_post; int HP_party_init_pre; int HP_party_init_post; int HP_party_final_pre; @@ -13272,6 +13288,7 @@ struct { struct npc_chat_interface npc_chat; struct npc_interface npc; struct nullpo_interface nullpo; + struct packets_interface packets; struct party_interface party; struct path_interface path; struct pc_groups_interface pcg; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 508465411..7d20a88e2 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2177,6 +2177,11 @@ struct HookingPointData HookingPoints[] = { { HP_POP(npc->secure_timeout_timer, HP_npc_secure_timeout_timer) }, /* nullpo_interface */ { HP_POP(nullpo->assert_report, HP_nullpo_assert_report) }, +/* packets_interface */ + { HP_POP(packets->init, HP_packets_init) }, + { HP_POP(packets->final, HP_packets_final) }, + { HP_POP(packets->addLens, HP_packets_addLens) }, + { HP_POP(packets->addLen, HP_packets_addLen) }, /* party_interface */ { HP_POP(party->init, HP_party_init) }, { HP_POP(party->final, HP_party_final) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index fa80a68fd..791acde83 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -56451,6 +56451,111 @@ void HP_nullpo_assert_report(const char *file, int line, const char *func, const } return; } +/* packets_interface */ +void HP_packets_init(void) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_init_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_init_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_init_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.init(); + } + if (HPMHooks.count.HP_packets_init_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_init_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_init_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_packets_final(void) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_final_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_final_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_final_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.final(); + } + if (HPMHooks.count.HP_packets_final_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_final_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_packets_addLens(void) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_addLens_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLens_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_addLens_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.addLens(); + } + if (HPMHooks.count.HP_packets_addLens_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLens_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_addLens_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_packets_addLen(int id, int len) { + int hIndex = 0; + if (HPMHooks.count.HP_packets_addLen_pre > 0) { + void (*preHookFunc) (int *id, int *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLen_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_packets_addLen_pre[hIndex].func; + preHookFunc(&id, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.packets.addLen(id, len); + } + if (HPMHooks.count.HP_packets_addLen_post > 0) { + void (*postHookFunc) (int id, int len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_packets_addLen_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_packets_addLen_post[hIndex].func; + postHookFunc(id, len); + } + } + return; +} /* party_interface */ void HP_party_init(bool minimal) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_map.sources.inc b/src/plugins/HPMHooking/HPMHooking_map.sources.inc index 151a5d8a1..9d5390bb4 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.sources.inc @@ -65,6 +65,7 @@ HPMHooks.source.mutex = *mutex; HPMHooks.source.npc_chat = *npc_chat; HPMHooks.source.npc = *npc; HPMHooks.source.nullpo = *nullpo; +HPMHooks.source.packets = *packets; HPMHooks.source.party = *party; HPMHooks.source.path = *path; HPMHooks.source.pcg = *pcg; |