diff options
Diffstat (limited to 'src/plugins/HPMHooking')
13 files changed, 720 insertions, 35 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 81e25f033..ea1aa85a4 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -4458,6 +4458,8 @@ typedef void (*HPMHOOK_pre_map_zone_init) (void); typedef void (*HPMHOOK_post_map_zone_init) (void); typedef void (*HPMHOOK_pre_map_zone_remove) (int *m); typedef void (*HPMHOOK_post_map_zone_remove) (int m); +typedef void (*HPMHOOK_pre_map_zone_remove_all) (int *m); +typedef void (*HPMHOOK_post_map_zone_remove_all) (int m); typedef void (*HPMHOOK_pre_map_zone_apply) (int *m, struct map_zone_data **zone, const char **start, const char **buffer, const char **filepath); typedef void (*HPMHOOK_post_map_zone_apply) (int m, struct map_zone_data *zone, const char *start, const char *buffer, const char *filepath); typedef void (*HPMHOOK_pre_map_zone_change) (int *m, struct map_zone_data **zone, const char **start, const char **buffer, const char **filepath); @@ -5673,6 +5675,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); @@ -7452,12 +7464,16 @@ typedef int (*HPMHOOK_pre_sockt_realloc_fifo) (int *fd, unsigned int *rfifo_size typedef int (*HPMHOOK_post_sockt_realloc_fifo) (int retVal___, int fd, unsigned int rfifo_size, unsigned int wfifo_size); typedef int (*HPMHOOK_pre_sockt_realloc_writefifo) (int *fd, size_t *addition); typedef int (*HPMHOOK_post_sockt_realloc_writefifo) (int retVal___, int fd, size_t addition); -typedef int (*HPMHOOK_pre_sockt_wfifoset) (int *fd, size_t *len); -typedef int (*HPMHOOK_post_sockt_wfifoset) (int retVal___, int fd, size_t len); +typedef int (*HPMHOOK_pre_sockt_wfifoset) (int *fd, size_t *len, bool *validate); +typedef int (*HPMHOOK_post_sockt_wfifoset) (int retVal___, int fd, size_t len, bool validate); +typedef void (*HPMHOOK_pre_sockt_wfifohead) (int *fd, size_t *len); +typedef void (*HPMHOOK_post_sockt_wfifohead) (int fd, size_t len); typedef int (*HPMHOOK_pre_sockt_rfifoskip) (int *fd, size_t *len); typedef int (*HPMHOOK_post_sockt_rfifoskip) (int retVal___, int fd, size_t len); typedef void (*HPMHOOK_pre_sockt_close) (int *fd); typedef void (*HPMHOOK_post_sockt_close) (int fd); +typedef void (*HPMHOOK_pre_sockt_validateWfifo) (int *fd, size_t *len); +typedef void (*HPMHOOK_post_sockt_validateWfifo) (int fd, size_t len); typedef bool (*HPMHOOK_pre_sockt_session_is_valid) (int *fd); typedef bool (*HPMHOOK_post_sockt_session_is_valid) (bool retVal___, int fd); typedef bool (*HPMHOOK_pre_sockt_session_is_active) (int *fd); @@ -7582,12 +7598,12 @@ typedef int (*HPMHOOK_pre_status_charge) (struct block_list **bl, int64 *hp, int typedef int (*HPMHOOK_post_status_charge) (int retVal___, struct block_list *bl, int64 hp, int64 sp); typedef int (*HPMHOOK_pre_status_percent_change) (struct block_list **src, struct block_list **target, signed char *hp_rate, signed char *sp_rate, int *flag); typedef int (*HPMHOOK_post_status_percent_change) (int retVal___, struct block_list *src, struct block_list *target, signed char hp_rate, signed char sp_rate, int flag); -typedef int (*HPMHOOK_pre_status_set_hp) (struct block_list **bl, unsigned int *hp, int *flag); -typedef int (*HPMHOOK_post_status_set_hp) (int retVal___, struct block_list *bl, unsigned int hp, int flag); -typedef int (*HPMHOOK_pre_status_set_sp) (struct block_list **bl, unsigned int *sp, int *flag); -typedef int (*HPMHOOK_post_status_set_sp) (int retVal___, struct block_list *bl, unsigned int sp, int flag); -typedef int (*HPMHOOK_pre_status_heal) (struct block_list **bl, int64 *hp, int64 *sp, int *flag); -typedef int (*HPMHOOK_post_status_heal) (int retVal___, struct block_list *bl, int64 hp, int64 sp, int flag); +typedef int (*HPMHOOK_pre_status_set_hp) (struct block_list **bl, unsigned int *hp, enum status_heal_flag *flag); +typedef int (*HPMHOOK_post_status_set_hp) (int retVal___, struct block_list *bl, unsigned int hp, enum status_heal_flag flag); +typedef int (*HPMHOOK_pre_status_set_sp) (struct block_list **bl, unsigned int *sp, enum status_heal_flag *flag); +typedef int (*HPMHOOK_post_status_set_sp) (int retVal___, struct block_list *bl, unsigned int sp, enum status_heal_flag flag); +typedef int (*HPMHOOK_pre_status_heal) (struct block_list **bl, int64 *hp, int64 *sp, enum status_heal_flag *flag); +typedef int (*HPMHOOK_post_status_heal) (int retVal___, struct block_list *bl, int64 hp, int64 sp, enum status_heal_flag flag); typedef int (*HPMHOOK_pre_status_revive) (struct block_list **bl, unsigned char *per_hp, unsigned char *per_sp); typedef int (*HPMHOOK_post_status_revive) (int retVal___, struct block_list *bl, unsigned char per_hp, unsigned char per_sp); typedef int (*HPMHOOK_pre_status_fixed_revive) (struct block_list **bl, unsigned int *per_hp, unsigned int *per_sp); @@ -7730,6 +7746,10 @@ typedef unsigned int (*HPMHOOK_pre_status_get_base_maxhp) (const struct map_sess typedef unsigned int (*HPMHOOK_post_status_get_base_maxhp) (unsigned int retVal___, const struct map_session_data *sd, const struct status_data *st); typedef unsigned int (*HPMHOOK_pre_status_get_base_maxsp) (const struct map_session_data **sd, const struct status_data **st); typedef unsigned int (*HPMHOOK_post_status_get_base_maxsp) (unsigned int retVal___, const struct map_session_data *sd, const struct status_data *st); +typedef unsigned int (*HPMHOOK_pre_status_get_restart_hp) (const struct map_session_data **sd, const struct status_data **st); +typedef unsigned int (*HPMHOOK_post_status_get_restart_hp) (unsigned int retVal___, const struct map_session_data *sd, const struct status_data *st); +typedef unsigned int (*HPMHOOK_pre_status_get_restart_sp) (const struct map_session_data **sd, const struct status_data **st); +typedef unsigned int (*HPMHOOK_post_status_get_restart_sp) (unsigned int retVal___, const struct map_session_data *sd, const struct status_data *st); typedef int (*HPMHOOK_pre_status_calc_npc_) (struct npc_data **nd, enum e_status_calc_opt *opt); typedef int (*HPMHOOK_post_status_calc_npc_) (int retVal___, struct npc_data *nd, enum e_status_calc_opt opt); typedef unsigned short (*HPMHOOK_pre_status_calc_str) (struct block_list **bl, struct status_change **sc, int *str); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index 2b0291453..d5babae97 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; @@ -1396,10 +1404,14 @@ struct { struct HPMHookPoint *HP_sockt_realloc_writefifo_post; struct HPMHookPoint *HP_sockt_wfifoset_pre; struct HPMHookPoint *HP_sockt_wfifoset_post; + struct HPMHookPoint *HP_sockt_wfifohead_pre; + struct HPMHookPoint *HP_sockt_wfifohead_post; struct HPMHookPoint *HP_sockt_rfifoskip_pre; struct HPMHookPoint *HP_sockt_rfifoskip_post; struct HPMHookPoint *HP_sockt_close_pre; struct HPMHookPoint *HP_sockt_close_post; + struct HPMHookPoint *HP_sockt_validateWfifo_pre; + struct HPMHookPoint *HP_sockt_validateWfifo_post; struct HPMHookPoint *HP_sockt_session_is_valid_pre; struct HPMHookPoint *HP_sockt_session_is_valid_post; struct HPMHookPoint *HP_sockt_session_is_active_pre; @@ -2945,6 +2957,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; @@ -3019,10 +3039,14 @@ struct { int HP_sockt_realloc_writefifo_post; int HP_sockt_wfifoset_pre; int HP_sockt_wfifoset_post; + int HP_sockt_wfifohead_pre; + int HP_sockt_wfifohead_post; int HP_sockt_rfifoskip_pre; int HP_sockt_rfifoskip_post; int HP_sockt_close_pre; int HP_sockt_close_post; + int HP_sockt_validateWfifo_pre; + int HP_sockt_validateWfifo_post; int HP_sockt_session_is_valid_pre; int HP_sockt_session_is_valid_post; int HP_sockt_session_is_active_pre; @@ -3301,6 +3325,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..55f2df4ce 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) }, @@ -744,8 +749,10 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->realloc_fifo, HP_sockt_realloc_fifo) }, { HP_POP(sockt->realloc_writefifo, HP_sockt_realloc_writefifo) }, { HP_POP(sockt->wfifoset, HP_sockt_wfifoset) }, + { HP_POP(sockt->wfifohead, HP_sockt_wfifohead) }, { HP_POP(sockt->rfifoskip, HP_sockt_rfifoskip) }, { HP_POP(sockt->close, HP_sockt_close) }, + { HP_POP(sockt->validateWfifo, HP_sockt_validateWfifo) }, { HP_POP(sockt->session_is_valid, HP_sockt_session_is_valid) }, { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 767c7d24e..5f20fd224 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; @@ -18317,15 +18422,15 @@ int HP_sockt_realloc_writefifo(int fd, size_t addition) { } return retVal___; } -int HP_sockt_wfifoset(int fd, size_t len) { +int HP_sockt_wfifoset(int fd, size_t len, bool validate) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_sockt_wfifoset_pre > 0) { - int (*preHookFunc) (int *fd, size_t *len); + int (*preHookFunc) (int *fd, size_t *len, bool *validate); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifoset_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_sockt_wfifoset_pre[hIndex].func; - retVal___ = preHookFunc(&fd, &len); + retVal___ = preHookFunc(&fd, &len, &validate); } if (*HPMforce_return) { *HPMforce_return = false; @@ -18333,17 +18438,43 @@ int HP_sockt_wfifoset(int fd, size_t len) { } } { - retVal___ = HPMHooks.source.sockt.wfifoset(fd, len); + retVal___ = HPMHooks.source.sockt.wfifoset(fd, len, validate); } if (HPMHooks.count.HP_sockt_wfifoset_post > 0) { - int (*postHookFunc) (int retVal___, int fd, size_t len); + int (*postHookFunc) (int retVal___, int fd, size_t len, bool validate); for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifoset_post; hIndex++) { postHookFunc = HPMHooks.list.HP_sockt_wfifoset_post[hIndex].func; - retVal___ = postHookFunc(retVal___, fd, len); + retVal___ = postHookFunc(retVal___, fd, len, validate); } } return retVal___; } +void HP_sockt_wfifohead(int fd, size_t len) { + int hIndex = 0; + if (HPMHooks.count.HP_sockt_wfifohead_pre > 0) { + void (*preHookFunc) (int *fd, size_t *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifohead_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_wfifohead_pre[hIndex].func; + preHookFunc(&fd, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.sockt.wfifohead(fd, len); + } + if (HPMHooks.count.HP_sockt_wfifohead_post > 0) { + void (*postHookFunc) (int fd, size_t len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifohead_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_wfifohead_post[hIndex].func; + postHookFunc(fd, len); + } + } + return; +} int HP_sockt_rfifoskip(int fd, size_t len) { int hIndex = 0; int retVal___ = 0; @@ -18397,6 +18528,32 @@ void HP_sockt_close(int fd) { } return; } +void HP_sockt_validateWfifo(int fd, size_t len) { + int hIndex = 0; + if (HPMHooks.count.HP_sockt_validateWfifo_pre > 0) { + void (*preHookFunc) (int *fd, size_t *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_validateWfifo_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_validateWfifo_pre[hIndex].func; + preHookFunc(&fd, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.sockt.validateWfifo(fd, len); + } + if (HPMHooks.count.HP_sockt_validateWfifo_post > 0) { + void (*postHookFunc) (int fd, size_t len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_validateWfifo_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_validateWfifo_post[hIndex].func; + postHookFunc(fd, len); + } + } + return; +} bool HP_sockt_session_is_valid(int fd) { int hIndex = 0; bool retVal___ = false; 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..35dea3ce7 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; @@ -554,10 +562,14 @@ struct { struct HPMHookPoint *HP_sockt_realloc_writefifo_post; struct HPMHookPoint *HP_sockt_wfifoset_pre; struct HPMHookPoint *HP_sockt_wfifoset_post; + struct HPMHookPoint *HP_sockt_wfifohead_pre; + struct HPMHookPoint *HP_sockt_wfifohead_post; struct HPMHookPoint *HP_sockt_rfifoskip_pre; struct HPMHookPoint *HP_sockt_rfifoskip_post; struct HPMHookPoint *HP_sockt_close_pre; struct HPMHookPoint *HP_sockt_close_post; + struct HPMHookPoint *HP_sockt_validateWfifo_pre; + struct HPMHookPoint *HP_sockt_validateWfifo_post; struct HPMHookPoint *HP_sockt_session_is_valid_pre; struct HPMHookPoint *HP_sockt_session_is_valid_post; struct HPMHookPoint *HP_sockt_session_is_active_pre; @@ -1293,6 +1305,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; @@ -1335,10 +1355,14 @@ struct { int HP_sockt_realloc_writefifo_post; int HP_sockt_wfifoset_pre; int HP_sockt_wfifoset_post; + int HP_sockt_wfifohead_pre; + int HP_sockt_wfifohead_post; int HP_sockt_rfifoskip_pre; int HP_sockt_rfifoskip_post; int HP_sockt_close_pre; int HP_sockt_close_post; + int HP_sockt_validateWfifo_pre; + int HP_sockt_validateWfifo_post; int HP_sockt_session_is_valid_pre; int HP_sockt_session_is_valid_post; int HP_sockt_session_is_active_pre; @@ -1605,6 +1629,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..b03162550 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) }, @@ -310,8 +315,10 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->realloc_fifo, HP_sockt_realloc_fifo) }, { HP_POP(sockt->realloc_writefifo, HP_sockt_realloc_writefifo) }, { HP_POP(sockt->wfifoset, HP_sockt_wfifoset) }, + { HP_POP(sockt->wfifohead, HP_sockt_wfifohead) }, { HP_POP(sockt->rfifoskip, HP_sockt_rfifoskip) }, { HP_POP(sockt->close, HP_sockt_close) }, + { HP_POP(sockt->validateWfifo, HP_sockt_validateWfifo) }, { HP_POP(sockt->session_is_valid, HP_sockt_session_is_valid) }, { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index e432da70d..c4359a2ad 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; @@ -7072,15 +7177,15 @@ int HP_sockt_realloc_writefifo(int fd, size_t addition) { } return retVal___; } -int HP_sockt_wfifoset(int fd, size_t len) { +int HP_sockt_wfifoset(int fd, size_t len, bool validate) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_sockt_wfifoset_pre > 0) { - int (*preHookFunc) (int *fd, size_t *len); + int (*preHookFunc) (int *fd, size_t *len, bool *validate); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifoset_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_sockt_wfifoset_pre[hIndex].func; - retVal___ = preHookFunc(&fd, &len); + retVal___ = preHookFunc(&fd, &len, &validate); } if (*HPMforce_return) { *HPMforce_return = false; @@ -7088,17 +7193,43 @@ int HP_sockt_wfifoset(int fd, size_t len) { } } { - retVal___ = HPMHooks.source.sockt.wfifoset(fd, len); + retVal___ = HPMHooks.source.sockt.wfifoset(fd, len, validate); } if (HPMHooks.count.HP_sockt_wfifoset_post > 0) { - int (*postHookFunc) (int retVal___, int fd, size_t len); + int (*postHookFunc) (int retVal___, int fd, size_t len, bool validate); for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifoset_post; hIndex++) { postHookFunc = HPMHooks.list.HP_sockt_wfifoset_post[hIndex].func; - retVal___ = postHookFunc(retVal___, fd, len); + retVal___ = postHookFunc(retVal___, fd, len, validate); } } return retVal___; } +void HP_sockt_wfifohead(int fd, size_t len) { + int hIndex = 0; + if (HPMHooks.count.HP_sockt_wfifohead_pre > 0) { + void (*preHookFunc) (int *fd, size_t *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifohead_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_wfifohead_pre[hIndex].func; + preHookFunc(&fd, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.sockt.wfifohead(fd, len); + } + if (HPMHooks.count.HP_sockt_wfifohead_post > 0) { + void (*postHookFunc) (int fd, size_t len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifohead_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_wfifohead_post[hIndex].func; + postHookFunc(fd, len); + } + } + return; +} int HP_sockt_rfifoskip(int fd, size_t len) { int hIndex = 0; int retVal___ = 0; @@ -7152,6 +7283,32 @@ void HP_sockt_close(int fd) { } return; } +void HP_sockt_validateWfifo(int fd, size_t len) { + int hIndex = 0; + if (HPMHooks.count.HP_sockt_validateWfifo_pre > 0) { + void (*preHookFunc) (int *fd, size_t *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_validateWfifo_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_validateWfifo_pre[hIndex].func; + preHookFunc(&fd, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.sockt.validateWfifo(fd, len); + } + if (HPMHooks.count.HP_sockt_validateWfifo_post > 0) { + void (*postHookFunc) (int fd, size_t len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_validateWfifo_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_validateWfifo_post[hIndex].func; + postHookFunc(fd, len); + } + } + return; +} bool HP_sockt_session_is_valid(int fd) { int hIndex = 0; bool retVal___ = false; 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..4b0054b28 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -3388,6 +3388,8 @@ struct { struct HPMHookPoint *HP_map_zone_init_post; struct HPMHookPoint *HP_map_zone_remove_pre; struct HPMHookPoint *HP_map_zone_remove_post; + struct HPMHookPoint *HP_map_zone_remove_all_pre; + struct HPMHookPoint *HP_map_zone_remove_all_post; struct HPMHookPoint *HP_map_zone_apply_pre; struct HPMHookPoint *HP_map_zone_apply_post; struct HPMHookPoint *HP_map_zone_change_pre; @@ -4248,6 +4250,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; @@ -5968,10 +5978,14 @@ struct { struct HPMHookPoint *HP_sockt_realloc_writefifo_post; struct HPMHookPoint *HP_sockt_wfifoset_pre; struct HPMHookPoint *HP_sockt_wfifoset_post; + struct HPMHookPoint *HP_sockt_wfifohead_pre; + struct HPMHookPoint *HP_sockt_wfifohead_post; struct HPMHookPoint *HP_sockt_rfifoskip_pre; struct HPMHookPoint *HP_sockt_rfifoskip_post; struct HPMHookPoint *HP_sockt_close_pre; struct HPMHookPoint *HP_sockt_close_post; + struct HPMHookPoint *HP_sockt_validateWfifo_pre; + struct HPMHookPoint *HP_sockt_validateWfifo_post; struct HPMHookPoint *HP_sockt_session_is_valid_pre; struct HPMHookPoint *HP_sockt_session_is_valid_post; struct HPMHookPoint *HP_sockt_session_is_active_pre; @@ -6240,6 +6254,10 @@ struct { struct HPMHookPoint *HP_status_get_base_maxhp_post; struct HPMHookPoint *HP_status_get_base_maxsp_pre; struct HPMHookPoint *HP_status_get_base_maxsp_post; + struct HPMHookPoint *HP_status_get_restart_hp_pre; + struct HPMHookPoint *HP_status_get_restart_hp_post; + struct HPMHookPoint *HP_status_get_restart_sp_pre; + struct HPMHookPoint *HP_status_get_restart_sp_post; struct HPMHookPoint *HP_status_calc_npc__pre; struct HPMHookPoint *HP_status_calc_npc__post; struct HPMHookPoint *HP_status_calc_str_pre; @@ -9991,6 +10009,8 @@ struct { int HP_map_zone_init_post; int HP_map_zone_remove_pre; int HP_map_zone_remove_post; + int HP_map_zone_remove_all_pre; + int HP_map_zone_remove_all_post; int HP_map_zone_apply_pre; int HP_map_zone_apply_post; int HP_map_zone_change_pre; @@ -10851,6 +10871,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; @@ -12571,10 +12599,14 @@ struct { int HP_sockt_realloc_writefifo_post; int HP_sockt_wfifoset_pre; int HP_sockt_wfifoset_post; + int HP_sockt_wfifohead_pre; + int HP_sockt_wfifohead_post; int HP_sockt_rfifoskip_pre; int HP_sockt_rfifoskip_post; int HP_sockt_close_pre; int HP_sockt_close_post; + int HP_sockt_validateWfifo_pre; + int HP_sockt_validateWfifo_post; int HP_sockt_session_is_valid_pre; int HP_sockt_session_is_valid_post; int HP_sockt_session_is_active_pre; @@ -12843,6 +12875,10 @@ struct { int HP_status_get_base_maxhp_post; int HP_status_get_base_maxsp_pre; int HP_status_get_base_maxsp_post; + int HP_status_get_restart_hp_pre; + int HP_status_get_restart_hp_post; + int HP_status_get_restart_sp_pre; + int HP_status_get_restart_sp_post; int HP_status_calc_npc__pre; int HP_status_calc_npc__post; int HP_status_calc_str_pre; @@ -13272,6 +13308,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..a900af716 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1737,6 +1737,7 @@ struct HookingPointData HookingPoints[] = { /* map_interface */ { HP_POP(map->zone_init, HP_map_zone_init) }, { HP_POP(map->zone_remove, HP_map_zone_remove) }, + { HP_POP(map->zone_remove_all, HP_map_zone_remove_all) }, { HP_POP(map->zone_apply, HP_map_zone_apply) }, { HP_POP(map->zone_change, HP_map_zone_change) }, { HP_POP(map->zone_change2, HP_map_zone_change2) }, @@ -2177,6 +2178,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) }, @@ -3051,8 +3057,10 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->realloc_fifo, HP_sockt_realloc_fifo) }, { HP_POP(sockt->realloc_writefifo, HP_sockt_realloc_writefifo) }, { HP_POP(sockt->wfifoset, HP_sockt_wfifoset) }, + { HP_POP(sockt->wfifohead, HP_sockt_wfifohead) }, { HP_POP(sockt->rfifoskip, HP_sockt_rfifoskip) }, { HP_POP(sockt->close, HP_sockt_close) }, + { HP_POP(sockt->validateWfifo, HP_sockt_validateWfifo) }, { HP_POP(sockt->session_is_valid, HP_sockt_session_is_valid) }, { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, @@ -3189,6 +3197,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(status->base_atk, HP_status_base_atk) }, { HP_POP(status->get_base_maxhp, HP_status_get_base_maxhp) }, { HP_POP(status->get_base_maxsp, HP_status_get_base_maxsp) }, + { HP_POP(status->get_restart_hp, HP_status_get_restart_hp) }, + { HP_POP(status->get_restart_sp, HP_status_get_restart_sp) }, { HP_POP(status->calc_npc_, HP_status_calc_npc_) }, { HP_POP(status->calc_str, HP_status_calc_str) }, { HP_POP(status->calc_agi, HP_status_calc_agi) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index fa80a68fd..af1f11fe2 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -44624,6 +44624,32 @@ void HP_map_zone_remove(int m) { } return; } +void HP_map_zone_remove_all(int m) { + int hIndex = 0; + if (HPMHooks.count.HP_map_zone_remove_all_pre > 0) { + void (*preHookFunc) (int *m); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_map_zone_remove_all_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_map_zone_remove_all_pre[hIndex].func; + preHookFunc(&m); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.map.zone_remove_all(m); + } + if (HPMHooks.count.HP_map_zone_remove_all_post > 0) { + void (*postHookFunc) (int m); + for (hIndex = 0; hIndex < HPMHooks.count.HP_map_zone_remove_all_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_map_zone_remove_all_post[hIndex].func; + postHookFunc(m); + } + } + return; +} void HP_map_zone_apply(int m, struct map_zone_data *zone, const char *start, const char *buffer, const char *filepath) { int hIndex = 0; if (HPMHooks.count.HP_map_zone_apply_pre > 0) { @@ -56451,6 +56477,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; @@ -79813,15 +79944,15 @@ int HP_sockt_realloc_writefifo(int fd, size_t addition) { } return retVal___; } -int HP_sockt_wfifoset(int fd, size_t len) { +int HP_sockt_wfifoset(int fd, size_t len, bool validate) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_sockt_wfifoset_pre > 0) { - int (*preHookFunc) (int *fd, size_t *len); + int (*preHookFunc) (int *fd, size_t *len, bool *validate); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifoset_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_sockt_wfifoset_pre[hIndex].func; - retVal___ = preHookFunc(&fd, &len); + retVal___ = preHookFunc(&fd, &len, &validate); } if (*HPMforce_return) { *HPMforce_return = false; @@ -79829,17 +79960,43 @@ int HP_sockt_wfifoset(int fd, size_t len) { } } { - retVal___ = HPMHooks.source.sockt.wfifoset(fd, len); + retVal___ = HPMHooks.source.sockt.wfifoset(fd, len, validate); } if (HPMHooks.count.HP_sockt_wfifoset_post > 0) { - int (*postHookFunc) (int retVal___, int fd, size_t len); + int (*postHookFunc) (int retVal___, int fd, size_t len, bool validate); for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifoset_post; hIndex++) { postHookFunc = HPMHooks.list.HP_sockt_wfifoset_post[hIndex].func; - retVal___ = postHookFunc(retVal___, fd, len); + retVal___ = postHookFunc(retVal___, fd, len, validate); } } return retVal___; } +void HP_sockt_wfifohead(int fd, size_t len) { + int hIndex = 0; + if (HPMHooks.count.HP_sockt_wfifohead_pre > 0) { + void (*preHookFunc) (int *fd, size_t *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifohead_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_wfifohead_pre[hIndex].func; + preHookFunc(&fd, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.sockt.wfifohead(fd, len); + } + if (HPMHooks.count.HP_sockt_wfifohead_post > 0) { + void (*postHookFunc) (int fd, size_t len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifohead_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_wfifohead_post[hIndex].func; + postHookFunc(fd, len); + } + } + return; +} int HP_sockt_rfifoskip(int fd, size_t len) { int hIndex = 0; int retVal___ = 0; @@ -79893,6 +80050,32 @@ void HP_sockt_close(int fd) { } return; } +void HP_sockt_validateWfifo(int fd, size_t len) { + int hIndex = 0; + if (HPMHooks.count.HP_sockt_validateWfifo_pre > 0) { + void (*preHookFunc) (int *fd, size_t *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_validateWfifo_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_validateWfifo_pre[hIndex].func; + preHookFunc(&fd, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.sockt.validateWfifo(fd, len); + } + if (HPMHooks.count.HP_sockt_validateWfifo_post > 0) { + void (*postHookFunc) (int fd, size_t len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_validateWfifo_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_validateWfifo_post[hIndex].func; + postHookFunc(fd, len); + } + } + return; +} bool HP_sockt_session_is_valid(int fd) { int hIndex = 0; bool retVal___ = false; @@ -81514,11 +81697,11 @@ int HP_status_percent_change(struct block_list *src, struct block_list *target, } return retVal___; } -int HP_status_set_hp(struct block_list *bl, unsigned int hp, int flag) { +int HP_status_set_hp(struct block_list *bl, unsigned int hp, enum status_heal_flag flag) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_status_set_hp_pre > 0) { - int (*preHookFunc) (struct block_list **bl, unsigned int *hp, int *flag); + int (*preHookFunc) (struct block_list **bl, unsigned int *hp, enum status_heal_flag *flag); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_status_set_hp_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_status_set_hp_pre[hIndex].func; @@ -81533,7 +81716,7 @@ int HP_status_set_hp(struct block_list *bl, unsigned int hp, int flag) { retVal___ = HPMHooks.source.status.set_hp(bl, hp, flag); } if (HPMHooks.count.HP_status_set_hp_post > 0) { - int (*postHookFunc) (int retVal___, struct block_list *bl, unsigned int hp, int flag); + int (*postHookFunc) (int retVal___, struct block_list *bl, unsigned int hp, enum status_heal_flag flag); for (hIndex = 0; hIndex < HPMHooks.count.HP_status_set_hp_post; hIndex++) { postHookFunc = HPMHooks.list.HP_status_set_hp_post[hIndex].func; retVal___ = postHookFunc(retVal___, bl, hp, flag); @@ -81541,11 +81724,11 @@ int HP_status_set_hp(struct block_list *bl, unsigned int hp, int flag) { } return retVal___; } -int HP_status_set_sp(struct block_list *bl, unsigned int sp, int flag) { +int HP_status_set_sp(struct block_list *bl, unsigned int sp, enum status_heal_flag flag) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_status_set_sp_pre > 0) { - int (*preHookFunc) (struct block_list **bl, unsigned int *sp, int *flag); + int (*preHookFunc) (struct block_list **bl, unsigned int *sp, enum status_heal_flag *flag); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_status_set_sp_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_status_set_sp_pre[hIndex].func; @@ -81560,7 +81743,7 @@ int HP_status_set_sp(struct block_list *bl, unsigned int sp, int flag) { retVal___ = HPMHooks.source.status.set_sp(bl, sp, flag); } if (HPMHooks.count.HP_status_set_sp_post > 0) { - int (*postHookFunc) (int retVal___, struct block_list *bl, unsigned int sp, int flag); + int (*postHookFunc) (int retVal___, struct block_list *bl, unsigned int sp, enum status_heal_flag flag); for (hIndex = 0; hIndex < HPMHooks.count.HP_status_set_sp_post; hIndex++) { postHookFunc = HPMHooks.list.HP_status_set_sp_post[hIndex].func; retVal___ = postHookFunc(retVal___, bl, sp, flag); @@ -81568,11 +81751,11 @@ int HP_status_set_sp(struct block_list *bl, unsigned int sp, int flag) { } return retVal___; } -int HP_status_heal(struct block_list *bl, int64 hp, int64 sp, int flag) { +int HP_status_heal(struct block_list *bl, int64 hp, int64 sp, enum status_heal_flag flag) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_status_heal_pre > 0) { - int (*preHookFunc) (struct block_list **bl, int64 *hp, int64 *sp, int *flag); + int (*preHookFunc) (struct block_list **bl, int64 *hp, int64 *sp, enum status_heal_flag *flag); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_status_heal_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_status_heal_pre[hIndex].func; @@ -81587,7 +81770,7 @@ int HP_status_heal(struct block_list *bl, int64 hp, int64 sp, int flag) { retVal___ = HPMHooks.source.status.heal(bl, hp, sp, flag); } if (HPMHooks.count.HP_status_heal_post > 0) { - int (*postHookFunc) (int retVal___, struct block_list *bl, int64 hp, int64 sp, int flag); + int (*postHookFunc) (int retVal___, struct block_list *bl, int64 hp, int64 sp, enum status_heal_flag flag); for (hIndex = 0; hIndex < HPMHooks.count.HP_status_heal_post; hIndex++) { postHookFunc = HPMHooks.list.HP_status_heal_post[hIndex].func; retVal___ = postHookFunc(retVal___, bl, hp, sp, flag); @@ -83505,6 +83688,60 @@ unsigned int HP_status_get_base_maxsp(const struct map_session_data *sd, const s } return retVal___; } +unsigned int HP_status_get_restart_hp(const struct map_session_data *sd, const struct status_data *st) { + int hIndex = 0; + unsigned int retVal___ = 0; + if (HPMHooks.count.HP_status_get_restart_hp_pre > 0) { + unsigned int (*preHookFunc) (const struct map_session_data **sd, const struct status_data **st); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_status_get_restart_hp_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_status_get_restart_hp_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &st); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.status.get_restart_hp(sd, st); + } + if (HPMHooks.count.HP_status_get_restart_hp_post > 0) { + unsigned int (*postHookFunc) (unsigned int retVal___, const struct map_session_data *sd, const struct status_data *st); + for (hIndex = 0; hIndex < HPMHooks.count.HP_status_get_restart_hp_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_status_get_restart_hp_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, st); + } + } + return retVal___; +} +unsigned int HP_status_get_restart_sp(const struct map_session_data *sd, const struct status_data *st) { + int hIndex = 0; + unsigned int retVal___ = 0; + if (HPMHooks.count.HP_status_get_restart_sp_pre > 0) { + unsigned int (*preHookFunc) (const struct map_session_data **sd, const struct status_data **st); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_status_get_restart_sp_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_status_get_restart_sp_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &st); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.status.get_restart_sp(sd, st); + } + if (HPMHooks.count.HP_status_get_restart_sp_post > 0) { + unsigned int (*postHookFunc) (unsigned int retVal___, const struct map_session_data *sd, const struct status_data *st); + for (hIndex = 0; hIndex < HPMHooks.count.HP_status_get_restart_sp_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_status_get_restart_sp_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, st); + } + } + return retVal___; +} int HP_status_calc_npc_(struct npc_data *nd, enum e_status_calc_opt opt) { int hIndex = 0; int retVal___ = 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; |