diff options
author | Haru <haru@dotalux.com> | 2016-03-14 01:30:43 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-07-12 20:58:45 +0200 |
commit | 14c9f5228fec75fc4e9bc8552e3fbae16f356103 (patch) | |
tree | ba5165b102784eb793da8e9cd8dc35108fbeeed0 /src | |
parent | 5196ad065674b65b030d30793b611823e18f0560 (diff) | |
download | hercules-14c9f5228fec75fc4e9bc8552e3fbae16f356103.tar.gz hercules-14c9f5228fec75fc4e9bc8552e3fbae16f356103.tar.bz2 hercules-14c9f5228fec75fc4e9bc8552e3fbae16f356103.tar.xz hercules-14c9f5228fec75fc4e9bc8552e3fbae16f356103.zip |
HPM Hooks Update
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/common/HPMDataCheck.h | 5 | ||||
-rw-r--r-- | src/common/HPMSymbols.inc.h | 6 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Defs.inc | 16 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 29 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 8 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 188 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.sources.inc | 1 |
7 files changed, 253 insertions, 0 deletions
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 55ea1e1b9..d0e23811c 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -160,6 +160,11 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #else #define COMMON_ERS_H #endif // COMMON_ERS_H + #ifdef COMMON_GRFIO_H + { "grfio_interface", sizeof(struct grfio_interface), SERVER_TYPE_MAP }, + #else + #define COMMON_GRFIO_H + #endif // COMMON_GRFIO_H #ifdef COMMON_HPMI_H { "HPMi_interface", sizeof(struct HPMi_interface), SERVER_TYPE_ALL }, { "hplugin_info", sizeof(struct hplugin_info), SERVER_TYPE_ALL }, diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h index 0a2e64cb4..7ccb960de 100644 --- a/src/common/HPMSymbols.inc.h +++ b/src/common/HPMSymbols.inc.h @@ -80,6 +80,9 @@ struct elemental_interface *elemental; #ifdef CHAR_GEOIP_H /* geoip */ struct geoip_interface *geoip; #endif // CHAR_GEOIP_H +#ifdef COMMON_GRFIO_H /* grfio */ +struct grfio_interface *grfio; +#endif // COMMON_GRFIO_H #ifdef MAP_GUILD_H /* guild */ struct guild_interface *guild; #endif // MAP_GUILD_H @@ -327,6 +330,9 @@ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("elemental", elemental)) retu #ifdef CHAR_GEOIP_H /* geoip */ if ((server_type&(SERVER_TYPE_CHAR)) && !HPM_SYMBOL("geoip", geoip)) return "geoip"; #endif // CHAR_GEOIP_H +#ifdef COMMON_GRFIO_H /* grfio */ +if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("grfio", grfio)) return "grfio"; +#endif // COMMON_GRFIO_H #ifdef MAP_GUILD_H /* guild */ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("guild", guild)) return "guild"; #endif // MAP_GUILD_H diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 2ac33f6f7..4f033ccaf 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -2371,6 +2371,22 @@ typedef void (*HPMHOOK_post_geoip_final) (bool shutdown); typedef void (*HPMHOOK_pre_geoip_init) (void); typedef void (*HPMHOOK_post_geoip_init) (void); #endif // CHAR_GEOIP_H +#ifdef COMMON_GRFIO_H /* grfio */ +typedef void (*HPMHOOK_pre_grfio_init) (const char **fname); +typedef void (*HPMHOOK_post_grfio_init) (const char *fname); +typedef void (*HPMHOOK_pre_grfio_final) (void); +typedef void (*HPMHOOK_post_grfio_final) (void); +typedef void* (*HPMHOOK_pre_grfio_reads) (const char **fname, int **size); +typedef void* (*HPMHOOK_post_grfio_reads) (void* retVal___, const char *fname, int *size); +typedef const char* (*HPMHOOK_pre_grfio_find_file) (const char **fname); +typedef const char* (*HPMHOOK_post_grfio_find_file) (const char* retVal___, const char *fname); +typedef unsigned long (*HPMHOOK_pre_grfio_crc32) (const unsigned char **buf, unsigned int *len); +typedef unsigned long (*HPMHOOK_post_grfio_crc32) (unsigned long retVal___, const unsigned char *buf, unsigned int len); +typedef int (*HPMHOOK_pre_grfio_decode_zip) (void **dest, unsigned long **dest_len, const void **source, unsigned long *source_len); +typedef int (*HPMHOOK_post_grfio_decode_zip) (int retVal___, void *dest, unsigned long *dest_len, const void *source, unsigned long source_len); +typedef int (*HPMHOOK_pre_grfio_encode_zip) (void **dest, unsigned long **dest_len, const void **source, unsigned long *source_len); +typedef int (*HPMHOOK_post_grfio_encode_zip) (int retVal___, void *dest, unsigned long *dest_len, const void *source, unsigned long source_len); +#endif // COMMON_GRFIO_H #ifdef MAP_GUILD_H /* guild */ typedef void (*HPMHOOK_pre_guild_init) (bool *minimal); typedef void (*HPMHOOK_post_guild_init) (bool minimal); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 1f46a1c0f..7131f486c 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -2014,6 +2014,20 @@ struct { struct HPMHookPoint *HP_elemental_ai_timer_post; struct HPMHookPoint *HP_elemental_read_db_pre; struct HPMHookPoint *HP_elemental_read_db_post; + struct HPMHookPoint *HP_grfio_init_pre; + struct HPMHookPoint *HP_grfio_init_post; + struct HPMHookPoint *HP_grfio_final_pre; + struct HPMHookPoint *HP_grfio_final_post; + struct HPMHookPoint *HP_grfio_reads_pre; + struct HPMHookPoint *HP_grfio_reads_post; + struct HPMHookPoint *HP_grfio_find_file_pre; + struct HPMHookPoint *HP_grfio_find_file_post; + struct HPMHookPoint *HP_grfio_crc32_pre; + struct HPMHookPoint *HP_grfio_crc32_post; + struct HPMHookPoint *HP_grfio_decode_zip_pre; + struct HPMHookPoint *HP_grfio_decode_zip_post; + struct HPMHookPoint *HP_grfio_encode_zip_pre; + struct HPMHookPoint *HP_grfio_encode_zip_post; struct HPMHookPoint *HP_guild_init_pre; struct HPMHookPoint *HP_guild_init_post; struct HPMHookPoint *HP_guild_final_pre; @@ -8039,6 +8053,20 @@ struct { int HP_elemental_ai_timer_post; int HP_elemental_read_db_pre; int HP_elemental_read_db_post; + int HP_grfio_init_pre; + int HP_grfio_init_post; + int HP_grfio_final_pre; + int HP_grfio_final_post; + int HP_grfio_reads_pre; + int HP_grfio_reads_post; + int HP_grfio_find_file_pre; + int HP_grfio_find_file_post; + int HP_grfio_crc32_pre; + int HP_grfio_crc32_post; + int HP_grfio_decode_zip_pre; + int HP_grfio_decode_zip_post; + int HP_grfio_encode_zip_pre; + int HP_grfio_encode_zip_post; int HP_guild_init_pre; int HP_guild_init_post; int HP_guild_final_pre; @@ -12092,6 +12120,7 @@ struct { struct des_interface des; struct duel_interface duel; struct elemental_interface elemental; + struct grfio_interface grfio; struct guild_interface guild; struct guild_storage_interface gstorage; struct homunculus_interface homun; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 6d7b62cff..cbf7ba79f 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1036,6 +1036,14 @@ struct HookingPointData HookingPoints[] = { { HP_POP(elemental->ai_sub_foreachclient, HP_elemental_ai_sub_foreachclient) }, { HP_POP(elemental->ai_timer, HP_elemental_ai_timer) }, { HP_POP(elemental->read_db, HP_elemental_read_db) }, +/* grfio_interface */ + { HP_POP(grfio->init, HP_grfio_init) }, + { HP_POP(grfio->final, HP_grfio_final) }, + { HP_POP(grfio->reads, HP_grfio_reads) }, + { HP_POP(grfio->find_file, HP_grfio_find_file) }, + { HP_POP(grfio->crc32, HP_grfio_crc32) }, + { HP_POP(grfio->decode_zip, HP_grfio_decode_zip) }, + { HP_POP(grfio->encode_zip, HP_grfio_encode_zip) }, /* guild_interface */ { HP_POP(guild->init, HP_guild_init) }, { HP_POP(guild->final, HP_guild_final) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index ae813a9cb..2317f9392 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -26270,6 +26270,194 @@ int HP_elemental_read_db(void) { } return retVal___; } +/* grfio_interface */ +void HP_grfio_init(const char *fname) { + int hIndex = 0; + if( HPMHooks.count.HP_grfio_init_pre ) { + void (*preHookFunc) (const char **fname); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_grfio_init_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_grfio_init_pre[hIndex].func; + preHookFunc(&fname); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.grfio.init(fname); + } + if( HPMHooks.count.HP_grfio_init_post ) { + void (*postHookFunc) (const char *fname); + for(hIndex = 0; hIndex < HPMHooks.count.HP_grfio_init_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_grfio_init_post[hIndex].func; + postHookFunc(fname); + } + } + return; +} +void HP_grfio_final(void) { + int hIndex = 0; + if( HPMHooks.count.HP_grfio_final_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_grfio_final_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_grfio_final_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.grfio.final(); + } + if( HPMHooks.count.HP_grfio_final_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_grfio_final_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_grfio_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void* HP_grfio_reads(const char *fname, int *size) { + int hIndex = 0; + void* retVal___ = NULL; + if( HPMHooks.count.HP_grfio_reads_pre ) { + void* (*preHookFunc) (const char **fname, int **size); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_grfio_reads_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_grfio_reads_pre[hIndex].func; + retVal___ = preHookFunc(&fname, &size); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.grfio.reads(fname, size); + } + if( HPMHooks.count.HP_grfio_reads_post ) { + void* (*postHookFunc) (void* retVal___, const char *fname, int *size); + for(hIndex = 0; hIndex < HPMHooks.count.HP_grfio_reads_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_grfio_reads_post[hIndex].func; + retVal___ = postHookFunc(retVal___, fname, size); + } + } + return retVal___; +} +const char* HP_grfio_find_file(const char *fname) { + int hIndex = 0; + const char* retVal___ = NULL; + if( HPMHooks.count.HP_grfio_find_file_pre ) { + const char* (*preHookFunc) (const char **fname); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_grfio_find_file_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_grfio_find_file_pre[hIndex].func; + retVal___ = preHookFunc(&fname); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.grfio.find_file(fname); + } + if( HPMHooks.count.HP_grfio_find_file_post ) { + const char* (*postHookFunc) (const char* retVal___, const char *fname); + for(hIndex = 0; hIndex < HPMHooks.count.HP_grfio_find_file_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_grfio_find_file_post[hIndex].func; + retVal___ = postHookFunc(retVal___, fname); + } + } + return retVal___; +} +unsigned long HP_grfio_crc32(const unsigned char *buf, unsigned int len) { + int hIndex = 0; + unsigned long retVal___ = 0; + if( HPMHooks.count.HP_grfio_crc32_pre ) { + unsigned long (*preHookFunc) (const unsigned char **buf, unsigned int *len); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_grfio_crc32_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_grfio_crc32_pre[hIndex].func; + retVal___ = preHookFunc(&buf, &len); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.grfio.crc32(buf, len); + } + if( HPMHooks.count.HP_grfio_crc32_post ) { + unsigned long (*postHookFunc) (unsigned long retVal___, const unsigned char *buf, unsigned int len); + for(hIndex = 0; hIndex < HPMHooks.count.HP_grfio_crc32_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_grfio_crc32_post[hIndex].func; + retVal___ = postHookFunc(retVal___, buf, len); + } + } + return retVal___; +} +int HP_grfio_decode_zip(void *dest, unsigned long *dest_len, const void *source, unsigned long source_len) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_grfio_decode_zip_pre ) { + int (*preHookFunc) (void **dest, unsigned long **dest_len, const void **source, unsigned long *source_len); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_grfio_decode_zip_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_grfio_decode_zip_pre[hIndex].func; + retVal___ = preHookFunc(&dest, &dest_len, &source, &source_len); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.grfio.decode_zip(dest, dest_len, source, source_len); + } + if( HPMHooks.count.HP_grfio_decode_zip_post ) { + int (*postHookFunc) (int retVal___, void *dest, unsigned long *dest_len, const void *source, unsigned long source_len); + for(hIndex = 0; hIndex < HPMHooks.count.HP_grfio_decode_zip_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_grfio_decode_zip_post[hIndex].func; + retVal___ = postHookFunc(retVal___, dest, dest_len, source, source_len); + } + } + return retVal___; +} +int HP_grfio_encode_zip(void *dest, unsigned long *dest_len, const void *source, unsigned long source_len) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_grfio_encode_zip_pre ) { + int (*preHookFunc) (void **dest, unsigned long **dest_len, const void **source, unsigned long *source_len); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_grfio_encode_zip_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_grfio_encode_zip_pre[hIndex].func; + retVal___ = preHookFunc(&dest, &dest_len, &source, &source_len); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.grfio.encode_zip(dest, dest_len, source, source_len); + } + if( HPMHooks.count.HP_grfio_encode_zip_post ) { + int (*postHookFunc) (int retVal___, void *dest, unsigned long *dest_len, const void *source, unsigned long source_len); + for(hIndex = 0; hIndex < HPMHooks.count.HP_grfio_encode_zip_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_grfio_encode_zip_post[hIndex].func; + retVal___ = postHookFunc(retVal___, dest, dest_len, source, source_len); + } + } + return retVal___; +} /* guild_interface */ void HP_guild_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 0df5aee53..54861ed6f 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.sources.inc @@ -41,6 +41,7 @@ memcpy(&HPMHooks.source.DB, DB, sizeof(struct db_interface)); memcpy(&HPMHooks.source.des, des, sizeof(struct des_interface)); memcpy(&HPMHooks.source.duel, duel, sizeof(struct duel_interface)); memcpy(&HPMHooks.source.elemental, elemental, sizeof(struct elemental_interface)); +memcpy(&HPMHooks.source.grfio, grfio, sizeof(struct grfio_interface)); memcpy(&HPMHooks.source.guild, guild, sizeof(struct guild_interface)); memcpy(&HPMHooks.source.gstorage, gstorage, sizeof(struct guild_storage_interface)); memcpy(&HPMHooks.source.homun, homun, sizeof(struct homunculus_interface)); |