summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-02-04 20:36:59 +0100
committerHaru <haru@dotalux.com>2018-02-17 15:10:13 +0100
commit4402660a1a36039273ad88765fd71160e823baab (patch)
tree75fb62da5836ef5ecf0f689d076b123bc5c2129c
parente2ba5d8b144c1251ce68fc8b1c95ee89250cf169 (diff)
downloadhercules-4402660a1a36039273ad88765fd71160e823baab.tar.gz
hercules-4402660a1a36039273ad88765fd71160e823baab.tar.bz2
hercules-4402660a1a36039273ad88765fd71160e823baab.tar.xz
hercules-4402660a1a36039273ad88765fd71160e823baab.zip
HPM Hooks Update
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/common/HPMDataCheck.h3
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc8
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc8
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc52
5 files changed, 36 insertions, 37 deletions
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h
index fe4745e79..4bcb33e23 100644
--- a/src/common/HPMDataCheck.h
+++ b/src/common/HPMDataCheck.h
@@ -524,8 +524,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
{ "charid_request", sizeof(struct charid_request), SERVER_TYPE_MAP },
{ "flooritem_data", sizeof(struct flooritem_data), SERVER_TYPE_MAP },
{ "iwall_data", sizeof(struct iwall_data), SERVER_TYPE_MAP },
- { "map_cache_main_header", sizeof(struct map_cache_main_header), SERVER_TYPE_MAP },
- { "map_cache_map_info", sizeof(struct map_cache_map_info), SERVER_TYPE_MAP },
+ { "map_cache_header", sizeof(struct map_cache_header), SERVER_TYPE_MAP },
{ "map_data", sizeof(struct map_data), SERVER_TYPE_MAP },
{ "map_data_other_server", sizeof(struct map_data_other_server), SERVER_TYPE_MAP },
{ "map_drop_list", sizeof(struct map_drop_list), SERVER_TYPE_MAP },
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 816e1981d..301fccb92 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -4304,10 +4304,10 @@ typedef struct DBData (*HPMHOOK_pre_map_create_map_data_other_server) (union DBK
typedef struct DBData (*HPMHOOK_post_map_create_map_data_other_server) (struct DBData retVal___, union DBKey key, va_list args);
typedef int (*HPMHOOK_pre_map_eraseallipport_sub) (union DBKey *key, struct DBData **data, va_list va);
typedef int (*HPMHOOK_post_map_eraseallipport_sub) (int retVal___, union DBKey key, struct DBData *data, va_list va);
-typedef char* (*HPMHOOK_pre_map_init_mapcache) (FILE **fp);
-typedef char* (*HPMHOOK_post_map_init_mapcache) (char* retVal___, FILE *fp);
-typedef int (*HPMHOOK_pre_map_readfromcache) (struct map_data **m, char **buffer);
-typedef int (*HPMHOOK_post_map_readfromcache) (int retVal___, struct map_data *m, char *buffer);
+typedef bool (*HPMHOOK_pre_map_readfromcache) (struct map_data **m);
+typedef bool (*HPMHOOK_post_map_readfromcache) (bool retVal___, struct map_data *m);
+typedef bool (*HPMHOOK_pre_map_readfromcache_v1) (FILE **fp, struct map_data **m, unsigned int *file_size);
+typedef bool (*HPMHOOK_post_map_readfromcache_v1) (bool retVal___, FILE *fp, struct map_data *m, unsigned int file_size);
typedef int (*HPMHOOK_pre_map_addmap) (const char **mapname);
typedef int (*HPMHOOK_post_map_addmap) (int retVal___, const char *mapname);
typedef void (*HPMHOOK_pre_map_delmapid) (int *id);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index 7e9d5589b..0e027043e 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -3356,10 +3356,10 @@ struct {
struct HPMHookPoint *HP_map_create_map_data_other_server_post;
struct HPMHookPoint *HP_map_eraseallipport_sub_pre;
struct HPMHookPoint *HP_map_eraseallipport_sub_post;
- struct HPMHookPoint *HP_map_init_mapcache_pre;
- struct HPMHookPoint *HP_map_init_mapcache_post;
struct HPMHookPoint *HP_map_readfromcache_pre;
struct HPMHookPoint *HP_map_readfromcache_post;
+ struct HPMHookPoint *HP_map_readfromcache_v1_pre;
+ struct HPMHookPoint *HP_map_readfromcache_v1_post;
struct HPMHookPoint *HP_map_addmap_pre;
struct HPMHookPoint *HP_map_addmap_post;
struct HPMHookPoint *HP_map_delmapid_pre;
@@ -9635,10 +9635,10 @@ struct {
int HP_map_create_map_data_other_server_post;
int HP_map_eraseallipport_sub_pre;
int HP_map_eraseallipport_sub_post;
- int HP_map_init_mapcache_pre;
- int HP_map_init_mapcache_post;
int HP_map_readfromcache_pre;
int HP_map_readfromcache_post;
+ int HP_map_readfromcache_v1_pre;
+ int HP_map_readfromcache_v1_post;
int HP_map_addmap_pre;
int HP_map_addmap_post;
int HP_map_delmapid_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index f023731aa..f668cfec6 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -1720,8 +1720,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(map->iwall_nextxy, HP_map_iwall_nextxy) },
{ HP_POP(map->create_map_data_other_server, HP_map_create_map_data_other_server) },
{ HP_POP(map->eraseallipport_sub, HP_map_eraseallipport_sub) },
- { HP_POP(map->init_mapcache, HP_map_init_mapcache) },
{ HP_POP(map->readfromcache, HP_map_readfromcache) },
+ { HP_POP(map->readfromcache_v1, HP_map_readfromcache_v1) },
{ HP_POP(map->addmap, HP_map_addmap) },
{ HP_POP(map->delmapid, HP_map_delmapid) },
{ HP_POP(map->zone_db_clear, HP_map_zone_db_clear) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index 467c57dd9..e2ce065fb 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -44370,15 +44370,15 @@ int HP_map_eraseallipport_sub(union DBKey key, struct DBData *data, va_list va)
}
return retVal___;
}
-char* HP_map_init_mapcache(FILE *fp) {
+bool HP_map_readfromcache(struct map_data *m) {
int hIndex = 0;
- char* retVal___ = NULL;
- if (HPMHooks.count.HP_map_init_mapcache_pre > 0) {
- char* (*preHookFunc) (FILE **fp);
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_map_readfromcache_pre > 0) {
+ bool (*preHookFunc) (struct map_data **m);
*HPMforce_return = false;
- for (hIndex = 0; hIndex < HPMHooks.count.HP_map_init_mapcache_pre; hIndex++) {
- preHookFunc = HPMHooks.list.HP_map_init_mapcache_pre[hIndex].func;
- retVal___ = preHookFunc(&fp);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_map_readfromcache_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_map_readfromcache_pre[hIndex].func;
+ retVal___ = preHookFunc(&m);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -44386,26 +44386,26 @@ char* HP_map_init_mapcache(FILE *fp) {
}
}
{
- retVal___ = HPMHooks.source.map.init_mapcache(fp);
+ retVal___ = HPMHooks.source.map.readfromcache(m);
}
- if (HPMHooks.count.HP_map_init_mapcache_post > 0) {
- char* (*postHookFunc) (char* retVal___, FILE *fp);
- for (hIndex = 0; hIndex < HPMHooks.count.HP_map_init_mapcache_post; hIndex++) {
- postHookFunc = HPMHooks.list.HP_map_init_mapcache_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, fp);
+ if (HPMHooks.count.HP_map_readfromcache_post > 0) {
+ bool (*postHookFunc) (bool retVal___, struct map_data *m);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_map_readfromcache_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_map_readfromcache_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, m);
}
}
return retVal___;
}
-int HP_map_readfromcache(struct map_data *m, char *buffer) {
+bool HP_map_readfromcache_v1(FILE *fp, struct map_data *m, unsigned int file_size) {
int hIndex = 0;
- int retVal___ = 0;
- if (HPMHooks.count.HP_map_readfromcache_pre > 0) {
- int (*preHookFunc) (struct map_data **m, char **buffer);
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_map_readfromcache_v1_pre > 0) {
+ bool (*preHookFunc) (FILE **fp, struct map_data **m, unsigned int *file_size);
*HPMforce_return = false;
- for (hIndex = 0; hIndex < HPMHooks.count.HP_map_readfromcache_pre; hIndex++) {
- preHookFunc = HPMHooks.list.HP_map_readfromcache_pre[hIndex].func;
- retVal___ = preHookFunc(&m, &buffer);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_map_readfromcache_v1_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_map_readfromcache_v1_pre[hIndex].func;
+ retVal___ = preHookFunc(&fp, &m, &file_size);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -44413,13 +44413,13 @@ int HP_map_readfromcache(struct map_data *m, char *buffer) {
}
}
{
- retVal___ = HPMHooks.source.map.readfromcache(m, buffer);
+ retVal___ = HPMHooks.source.map.readfromcache_v1(fp, m, file_size);
}
- if (HPMHooks.count.HP_map_readfromcache_post > 0) {
- int (*postHookFunc) (int retVal___, struct map_data *m, char *buffer);
- for (hIndex = 0; hIndex < HPMHooks.count.HP_map_readfromcache_post; hIndex++) {
- postHookFunc = HPMHooks.list.HP_map_readfromcache_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, m, buffer);
+ if (HPMHooks.count.HP_map_readfromcache_v1_post > 0) {
+ bool (*postHookFunc) (bool retVal___, FILE *fp, struct map_data *m, unsigned int file_size);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_map_readfromcache_v1_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_map_readfromcache_v1_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, fp, m, file_size);
}
}
return retVal___;