diff options
author | Haru <haru@dotalux.com> | 2016-03-13 20:51:23 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-07-12 20:58:38 +0200 |
commit | 2af9259a48ef9d7ec864fa80d1cb0392f2f2ee7a (patch) | |
tree | 27911973127264619a7832dfcc286980a73dcc4c | |
parent | 14d410fc8695049691bfb5e70e881020625f7a85 (diff) | |
download | hercules-2af9259a48ef9d7ec864fa80d1cb0392f2f2ee7a.tar.gz hercules-2af9259a48ef9d7ec864fa80d1cb0392f2f2ee7a.tar.bz2 hercules-2af9259a48ef9d7ec864fa80d1cb0392f2f2ee7a.tar.xz hercules-2af9259a48ef9d7ec864fa80d1cb0392f2f2ee7a.zip |
HPM Hooks Update
Signed-off-by: Haru <haru@dotalux.com>
-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 | 22 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc | 41 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc | 11 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 264 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.sources.inc | 1 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc | 41 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc | 11 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.Hooks.inc | 264 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.sources.inc | 1 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 41 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 11 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 264 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.sources.inc | 1 |
15 files changed, 984 insertions, 0 deletions
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 4d99115f2..426c94ba2 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -216,6 +216,11 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #else #define COMMON_MMO_H #endif // COMMON_MMO_H + #ifdef COMMON_MUTEX_H + { "mutex_interface", sizeof(struct mutex_interface), SERVER_TYPE_ALL }, + #else + #define COMMON_MUTEX_H + #endif // COMMON_MUTEX_H #ifdef COMMON_NULLPO_H { "nullpo_interface", sizeof(struct nullpo_interface), SERVER_TYPE_ALL }, #else diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h index 2bd20aa8e..24aefe06a 100644 --- a/src/common/HPMSymbols.inc.h +++ b/src/common/HPMSymbols.inc.h @@ -179,6 +179,9 @@ struct mercenary_interface *mercenary; #ifdef MAP_MOB_H /* mob */ struct mob_interface *mob; #endif // MAP_MOB_H +#ifdef COMMON_MUTEX_H /* mutex */ +struct mutex_interface *mutex; +#endif // COMMON_MUTEX_H #ifdef MAP_NPC_H /* npc_chat */ struct npc_chat_interface *npc_chat; #endif // MAP_NPC_H @@ -417,6 +420,9 @@ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("mercenary", mercenary)) retu #ifdef MAP_MOB_H /* mob */ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("mob", mob)) return "mob"; #endif // MAP_MOB_H +#ifdef COMMON_MUTEX_H /* mutex */ +if ((server_type&(SERVER_TYPE_ALL)) && !HPM_SYMBOL("mutex", mutex)) return "mutex"; +#endif // COMMON_MUTEX_H #ifdef MAP_NPC_H /* npc_chat */ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("npc_chat", npc_chat)) return "npc_chat"; #endif // MAP_NPC_H diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 6e8c74174..852a2c122 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -4701,6 +4701,28 @@ typedef void (*HPMHOOK_post_mob_clear_spawninfo) (void); typedef void (*HPMHOOK_pre_mob_destroy_mob_db) (int *index); typedef void (*HPMHOOK_post_mob_destroy_mob_db) (int index); #endif // MAP_MOB_H +#ifdef COMMON_MUTEX_H /* mutex */ +typedef struct mutex_data* (*HPMHOOK_pre_mutex_create) (void); +typedef struct mutex_data* (*HPMHOOK_post_mutex_create) (struct mutex_data* retVal___); +typedef void (*HPMHOOK_pre_mutex_destroy) (struct mutex_data **m); +typedef void (*HPMHOOK_post_mutex_destroy) (struct mutex_data *m); +typedef void (*HPMHOOK_pre_mutex_lock) (struct mutex_data **m); +typedef void (*HPMHOOK_post_mutex_lock) (struct mutex_data *m); +typedef bool (*HPMHOOK_pre_mutex_trylock) (struct mutex_data **m); +typedef bool (*HPMHOOK_post_mutex_trylock) (bool retVal___, struct mutex_data *m); +typedef void (*HPMHOOK_pre_mutex_unlock) (struct mutex_data **m); +typedef void (*HPMHOOK_post_mutex_unlock) (struct mutex_data *m); +typedef struct cond_data* (*HPMHOOK_pre_mutex_cond_create) (void); +typedef struct cond_data* (*HPMHOOK_post_mutex_cond_create) (struct cond_data* retVal___); +typedef void (*HPMHOOK_pre_mutex_cond_destroy) (struct cond_data **c); +typedef void (*HPMHOOK_post_mutex_cond_destroy) (struct cond_data *c); +typedef void (*HPMHOOK_pre_mutex_cond_wait) (struct cond_data **c, struct mutex_data **m, sysint *timeout_ticks); +typedef void (*HPMHOOK_post_mutex_cond_wait) (struct cond_data *c, struct mutex_data *m, sysint timeout_ticks); +typedef void (*HPMHOOK_pre_mutex_cond_signal) (struct cond_data **c); +typedef void (*HPMHOOK_post_mutex_cond_signal) (struct cond_data *c); +typedef void (*HPMHOOK_pre_mutex_cond_broadcast) (struct cond_data **c); +typedef void (*HPMHOOK_post_mutex_cond_broadcast) (struct cond_data *c); +#endif // COMMON_MUTEX_H #ifdef MAP_NPC_H /* npc_chat */ typedef int (*HPMHOOK_pre_npc_chat_sub) (struct block_list **bl, va_list ap); typedef int (*HPMHOOK_post_npc_chat_sub) (int retVal___, struct block_list *bl, va_list ap); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index da3990cf3..78066d26e 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -1162,6 +1162,26 @@ struct { struct HPMHookPoint *HP_md5_binary_post; struct HPMHookPoint *HP_md5_salt_pre; struct HPMHookPoint *HP_md5_salt_post; + struct HPMHookPoint *HP_mutex_create_pre; + struct HPMHookPoint *HP_mutex_create_post; + struct HPMHookPoint *HP_mutex_destroy_pre; + struct HPMHookPoint *HP_mutex_destroy_post; + struct HPMHookPoint *HP_mutex_lock_pre; + struct HPMHookPoint *HP_mutex_lock_post; + struct HPMHookPoint *HP_mutex_trylock_pre; + struct HPMHookPoint *HP_mutex_trylock_post; + struct HPMHookPoint *HP_mutex_unlock_pre; + struct HPMHookPoint *HP_mutex_unlock_post; + struct HPMHookPoint *HP_mutex_cond_create_pre; + struct HPMHookPoint *HP_mutex_cond_create_post; + struct HPMHookPoint *HP_mutex_cond_destroy_pre; + struct HPMHookPoint *HP_mutex_cond_destroy_post; + struct HPMHookPoint *HP_mutex_cond_wait_pre; + struct HPMHookPoint *HP_mutex_cond_wait_post; + struct HPMHookPoint *HP_mutex_cond_signal_pre; + struct HPMHookPoint *HP_mutex_cond_signal_post; + struct HPMHookPoint *HP_mutex_cond_broadcast_pre; + struct HPMHookPoint *HP_mutex_cond_broadcast_post; struct HPMHookPoint *HP_nullpo_assert_report_pre; struct HPMHookPoint *HP_nullpo_assert_report_post; struct HPMHookPoint *HP_pincode_handle_pre; @@ -2577,6 +2597,26 @@ struct { int HP_md5_binary_post; int HP_md5_salt_pre; int HP_md5_salt_post; + int HP_mutex_create_pre; + int HP_mutex_create_post; + int HP_mutex_destroy_pre; + int HP_mutex_destroy_post; + int HP_mutex_lock_pre; + int HP_mutex_lock_post; + int HP_mutex_trylock_pre; + int HP_mutex_trylock_post; + int HP_mutex_unlock_pre; + int HP_mutex_unlock_post; + int HP_mutex_cond_create_pre; + int HP_mutex_cond_create_post; + int HP_mutex_cond_destroy_pre; + int HP_mutex_cond_destroy_post; + int HP_mutex_cond_wait_pre; + int HP_mutex_cond_wait_post; + int HP_mutex_cond_signal_pre; + int HP_mutex_cond_signal_post; + int HP_mutex_cond_broadcast_pre; + int HP_mutex_cond_broadcast_post; int HP_nullpo_assert_report_pre; int HP_nullpo_assert_report_post; int HP_pincode_handle_pre; @@ -2881,6 +2921,7 @@ struct { struct mapif_interface mapif; struct mapindex_interface mapindex; struct md5_interface md5; + struct mutex_interface mutex; struct nullpo_interface nullpo; struct pincode_interface pincode; struct showmsg_interface showmsg; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index 15db8625a..405dd4a91 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -619,6 +619,17 @@ struct HookingPointData HookingPoints[] = { { HP_POP(md5->string, HP_md5_string) }, { HP_POP(md5->binary, HP_md5_binary) }, { HP_POP(md5->salt, HP_md5_salt) }, +/* mutex_interface */ + { HP_POP(mutex->create, HP_mutex_create) }, + { HP_POP(mutex->destroy, HP_mutex_destroy) }, + { HP_POP(mutex->lock, HP_mutex_lock) }, + { HP_POP(mutex->trylock, HP_mutex_trylock) }, + { HP_POP(mutex->unlock, HP_mutex_unlock) }, + { HP_POP(mutex->cond_create, HP_mutex_cond_create) }, + { HP_POP(mutex->cond_destroy, HP_mutex_cond_destroy) }, + { HP_POP(mutex->cond_wait, HP_mutex_cond_wait) }, + { HP_POP(mutex->cond_signal, HP_mutex_cond_signal) }, + { HP_POP(mutex->cond_broadcast, HP_mutex_cond_broadcast) }, /* nullpo_interface */ { HP_POP(nullpo->assert_report, HP_nullpo_assert_report) }, /* pincode_interface */ diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index fd69a2bd9..4ec1abcd1 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -15199,6 +15199,270 @@ void HP_md5_salt(int len, char *output) { } return; } +/* mutex_interface */ +struct mutex_data* HP_mutex_create(void) { + int hIndex = 0; + struct mutex_data* retVal___ = NULL; + if( HPMHooks.count.HP_mutex_create_pre ) { + struct mutex_data* (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_create_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_create_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mutex.create(); + } + if( HPMHooks.count.HP_mutex_create_post ) { + struct mutex_data* (*postHookFunc) (struct mutex_data* retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_create_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_create_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +void HP_mutex_destroy(struct mutex_data *m) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_destroy_pre ) { + void (*preHookFunc) (struct mutex_data **m); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_destroy_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_destroy_pre[hIndex].func; + preHookFunc(&m); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.destroy(m); + } + if( HPMHooks.count.HP_mutex_destroy_post ) { + void (*postHookFunc) (struct mutex_data *m); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_destroy_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_destroy_post[hIndex].func; + postHookFunc(m); + } + } + return; +} +void HP_mutex_lock(struct mutex_data *m) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_lock_pre ) { + void (*preHookFunc) (struct mutex_data **m); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_lock_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_lock_pre[hIndex].func; + preHookFunc(&m); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.lock(m); + } + if( HPMHooks.count.HP_mutex_lock_post ) { + void (*postHookFunc) (struct mutex_data *m); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_lock_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_lock_post[hIndex].func; + postHookFunc(m); + } + } + return; +} +bool HP_mutex_trylock(struct mutex_data *m) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mutex_trylock_pre ) { + bool (*preHookFunc) (struct mutex_data **m); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_trylock_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_trylock_pre[hIndex].func; + retVal___ = preHookFunc(&m); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mutex.trylock(m); + } + if( HPMHooks.count.HP_mutex_trylock_post ) { + bool (*postHookFunc) (bool retVal___, struct mutex_data *m); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_trylock_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_trylock_post[hIndex].func; + retVal___ = postHookFunc(retVal___, m); + } + } + return retVal___; +} +void HP_mutex_unlock(struct mutex_data *m) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_unlock_pre ) { + void (*preHookFunc) (struct mutex_data **m); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_unlock_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_unlock_pre[hIndex].func; + preHookFunc(&m); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.unlock(m); + } + if( HPMHooks.count.HP_mutex_unlock_post ) { + void (*postHookFunc) (struct mutex_data *m); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_unlock_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_unlock_post[hIndex].func; + postHookFunc(m); + } + } + return; +} +struct cond_data* HP_mutex_cond_create(void) { + int hIndex = 0; + struct cond_data* retVal___ = NULL; + if( HPMHooks.count.HP_mutex_cond_create_pre ) { + struct cond_data* (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_create_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_create_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mutex.cond_create(); + } + if( HPMHooks.count.HP_mutex_cond_create_post ) { + struct cond_data* (*postHookFunc) (struct cond_data* retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_create_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_create_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +void HP_mutex_cond_destroy(struct cond_data *c) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_cond_destroy_pre ) { + void (*preHookFunc) (struct cond_data **c); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_destroy_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_destroy_pre[hIndex].func; + preHookFunc(&c); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.cond_destroy(c); + } + if( HPMHooks.count.HP_mutex_cond_destroy_post ) { + void (*postHookFunc) (struct cond_data *c); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_destroy_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_destroy_post[hIndex].func; + postHookFunc(c); + } + } + return; +} +void HP_mutex_cond_wait(struct cond_data *c, struct mutex_data *m, sysint timeout_ticks) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_cond_wait_pre ) { + void (*preHookFunc) (struct cond_data **c, struct mutex_data **m, sysint *timeout_ticks); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_wait_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_wait_pre[hIndex].func; + preHookFunc(&c, &m, &timeout_ticks); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.cond_wait(c, m, timeout_ticks); + } + if( HPMHooks.count.HP_mutex_cond_wait_post ) { + void (*postHookFunc) (struct cond_data *c, struct mutex_data *m, sysint timeout_ticks); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_wait_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_wait_post[hIndex].func; + postHookFunc(c, m, timeout_ticks); + } + } + return; +} +void HP_mutex_cond_signal(struct cond_data *c) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_cond_signal_pre ) { + void (*preHookFunc) (struct cond_data **c); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_signal_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_signal_pre[hIndex].func; + preHookFunc(&c); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.cond_signal(c); + } + if( HPMHooks.count.HP_mutex_cond_signal_post ) { + void (*postHookFunc) (struct cond_data *c); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_signal_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_signal_post[hIndex].func; + postHookFunc(c); + } + } + return; +} +void HP_mutex_cond_broadcast(struct cond_data *c) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_cond_broadcast_pre ) { + void (*preHookFunc) (struct cond_data **c); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_broadcast_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_broadcast_pre[hIndex].func; + preHookFunc(&c); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.cond_broadcast(c); + } + if( HPMHooks.count.HP_mutex_cond_broadcast_post ) { + void (*postHookFunc) (struct cond_data *c); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_broadcast_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_broadcast_post[hIndex].func; + postHookFunc(c); + } + } + return; +} /* nullpo_interface */ void HP_nullpo_assert_report(const char *file, int line, const char *func, const char *targetname, const char *title) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_char.sources.inc b/src/plugins/HPMHooking/HPMHooking_char.sources.inc index 925fefd93..c17c0313d 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.sources.inc @@ -50,6 +50,7 @@ memcpy(&HPMHooks.source.iMalloc, iMalloc, sizeof(struct malloc_interface)); memcpy(&HPMHooks.source.mapif, mapif, sizeof(struct mapif_interface)); memcpy(&HPMHooks.source.mapindex, mapindex, sizeof(struct mapindex_interface)); memcpy(&HPMHooks.source.md5, md5, sizeof(struct md5_interface)); +memcpy(&HPMHooks.source.mutex, mutex, sizeof(struct mutex_interface)); memcpy(&HPMHooks.source.nullpo, nullpo, sizeof(struct nullpo_interface)); memcpy(&HPMHooks.source.pincode, pincode, sizeof(struct pincode_interface)); memcpy(&HPMHooks.source.showmsg, showmsg, sizeof(struct showmsg_interface)); diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc index daf7d35b0..e6d43c833 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc @@ -410,6 +410,26 @@ struct { struct HPMHookPoint *HP_md5_binary_post; struct HPMHookPoint *HP_md5_salt_pre; struct HPMHookPoint *HP_md5_salt_post; + struct HPMHookPoint *HP_mutex_create_pre; + struct HPMHookPoint *HP_mutex_create_post; + struct HPMHookPoint *HP_mutex_destroy_pre; + struct HPMHookPoint *HP_mutex_destroy_post; + struct HPMHookPoint *HP_mutex_lock_pre; + struct HPMHookPoint *HP_mutex_lock_post; + struct HPMHookPoint *HP_mutex_trylock_pre; + struct HPMHookPoint *HP_mutex_trylock_post; + struct HPMHookPoint *HP_mutex_unlock_pre; + struct HPMHookPoint *HP_mutex_unlock_post; + struct HPMHookPoint *HP_mutex_cond_create_pre; + struct HPMHookPoint *HP_mutex_cond_create_post; + struct HPMHookPoint *HP_mutex_cond_destroy_pre; + struct HPMHookPoint *HP_mutex_cond_destroy_post; + struct HPMHookPoint *HP_mutex_cond_wait_pre; + struct HPMHookPoint *HP_mutex_cond_wait_post; + struct HPMHookPoint *HP_mutex_cond_signal_pre; + struct HPMHookPoint *HP_mutex_cond_signal_post; + struct HPMHookPoint *HP_mutex_cond_broadcast_pre; + struct HPMHookPoint *HP_mutex_cond_broadcast_post; struct HPMHookPoint *HP_nullpo_assert_report_pre; struct HPMHookPoint *HP_nullpo_assert_report_post; struct HPMHookPoint *HP_showmsg_init_pre; @@ -1053,6 +1073,26 @@ struct { int HP_md5_binary_post; int HP_md5_salt_pre; int HP_md5_salt_post; + int HP_mutex_create_pre; + int HP_mutex_create_post; + int HP_mutex_destroy_pre; + int HP_mutex_destroy_post; + int HP_mutex_lock_pre; + int HP_mutex_lock_post; + int HP_mutex_trylock_pre; + int HP_mutex_trylock_post; + int HP_mutex_unlock_pre; + int HP_mutex_unlock_post; + int HP_mutex_cond_create_pre; + int HP_mutex_cond_create_post; + int HP_mutex_cond_destroy_pre; + int HP_mutex_cond_destroy_post; + int HP_mutex_cond_wait_pre; + int HP_mutex_cond_wait_post; + int HP_mutex_cond_signal_pre; + int HP_mutex_cond_signal_post; + int HP_mutex_cond_broadcast_pre; + int HP_mutex_cond_broadcast_post; int HP_nullpo_assert_report_pre; int HP_nullpo_assert_report_post; int HP_showmsg_init_pre; @@ -1324,6 +1364,7 @@ struct { struct login_interface login; struct malloc_interface iMalloc; struct md5_interface md5; + struct mutex_interface mutex; struct nullpo_interface nullpo; 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 6de163d9f..ce9a112f7 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc @@ -230,6 +230,17 @@ struct HookingPointData HookingPoints[] = { { HP_POP(md5->string, HP_md5_string) }, { HP_POP(md5->binary, HP_md5_binary) }, { HP_POP(md5->salt, HP_md5_salt) }, +/* mutex_interface */ + { HP_POP(mutex->create, HP_mutex_create) }, + { HP_POP(mutex->destroy, HP_mutex_destroy) }, + { HP_POP(mutex->lock, HP_mutex_lock) }, + { HP_POP(mutex->trylock, HP_mutex_trylock) }, + { HP_POP(mutex->unlock, HP_mutex_unlock) }, + { HP_POP(mutex->cond_create, HP_mutex_cond_create) }, + { HP_POP(mutex->cond_destroy, HP_mutex_cond_destroy) }, + { HP_POP(mutex->cond_wait, HP_mutex_cond_wait) }, + { HP_POP(mutex->cond_signal, HP_mutex_cond_signal) }, + { HP_POP(mutex->cond_broadcast, HP_mutex_cond_broadcast) }, /* nullpo_interface */ { HP_POP(nullpo->assert_report, HP_nullpo_assert_report) }, /* showmsg_interface */ diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index a90ed233b..dc0ed4a17 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc @@ -5168,6 +5168,270 @@ void HP_md5_salt(int len, char *output) { } return; } +/* mutex_interface */ +struct mutex_data* HP_mutex_create(void) { + int hIndex = 0; + struct mutex_data* retVal___ = NULL; + if( HPMHooks.count.HP_mutex_create_pre ) { + struct mutex_data* (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_create_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_create_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mutex.create(); + } + if( HPMHooks.count.HP_mutex_create_post ) { + struct mutex_data* (*postHookFunc) (struct mutex_data* retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_create_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_create_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +void HP_mutex_destroy(struct mutex_data *m) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_destroy_pre ) { + void (*preHookFunc) (struct mutex_data **m); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_destroy_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_destroy_pre[hIndex].func; + preHookFunc(&m); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.destroy(m); + } + if( HPMHooks.count.HP_mutex_destroy_post ) { + void (*postHookFunc) (struct mutex_data *m); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_destroy_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_destroy_post[hIndex].func; + postHookFunc(m); + } + } + return; +} +void HP_mutex_lock(struct mutex_data *m) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_lock_pre ) { + void (*preHookFunc) (struct mutex_data **m); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_lock_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_lock_pre[hIndex].func; + preHookFunc(&m); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.lock(m); + } + if( HPMHooks.count.HP_mutex_lock_post ) { + void (*postHookFunc) (struct mutex_data *m); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_lock_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_lock_post[hIndex].func; + postHookFunc(m); + } + } + return; +} +bool HP_mutex_trylock(struct mutex_data *m) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mutex_trylock_pre ) { + bool (*preHookFunc) (struct mutex_data **m); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_trylock_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_trylock_pre[hIndex].func; + retVal___ = preHookFunc(&m); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mutex.trylock(m); + } + if( HPMHooks.count.HP_mutex_trylock_post ) { + bool (*postHookFunc) (bool retVal___, struct mutex_data *m); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_trylock_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_trylock_post[hIndex].func; + retVal___ = postHookFunc(retVal___, m); + } + } + return retVal___; +} +void HP_mutex_unlock(struct mutex_data *m) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_unlock_pre ) { + void (*preHookFunc) (struct mutex_data **m); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_unlock_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_unlock_pre[hIndex].func; + preHookFunc(&m); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.unlock(m); + } + if( HPMHooks.count.HP_mutex_unlock_post ) { + void (*postHookFunc) (struct mutex_data *m); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_unlock_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_unlock_post[hIndex].func; + postHookFunc(m); + } + } + return; +} +struct cond_data* HP_mutex_cond_create(void) { + int hIndex = 0; + struct cond_data* retVal___ = NULL; + if( HPMHooks.count.HP_mutex_cond_create_pre ) { + struct cond_data* (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_create_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_create_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mutex.cond_create(); + } + if( HPMHooks.count.HP_mutex_cond_create_post ) { + struct cond_data* (*postHookFunc) (struct cond_data* retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_create_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_create_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +void HP_mutex_cond_destroy(struct cond_data *c) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_cond_destroy_pre ) { + void (*preHookFunc) (struct cond_data **c); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_destroy_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_destroy_pre[hIndex].func; + preHookFunc(&c); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.cond_destroy(c); + } + if( HPMHooks.count.HP_mutex_cond_destroy_post ) { + void (*postHookFunc) (struct cond_data *c); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_destroy_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_destroy_post[hIndex].func; + postHookFunc(c); + } + } + return; +} +void HP_mutex_cond_wait(struct cond_data *c, struct mutex_data *m, sysint timeout_ticks) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_cond_wait_pre ) { + void (*preHookFunc) (struct cond_data **c, struct mutex_data **m, sysint *timeout_ticks); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_wait_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_wait_pre[hIndex].func; + preHookFunc(&c, &m, &timeout_ticks); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.cond_wait(c, m, timeout_ticks); + } + if( HPMHooks.count.HP_mutex_cond_wait_post ) { + void (*postHookFunc) (struct cond_data *c, struct mutex_data *m, sysint timeout_ticks); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_wait_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_wait_post[hIndex].func; + postHookFunc(c, m, timeout_ticks); + } + } + return; +} +void HP_mutex_cond_signal(struct cond_data *c) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_cond_signal_pre ) { + void (*preHookFunc) (struct cond_data **c); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_signal_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_signal_pre[hIndex].func; + preHookFunc(&c); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.cond_signal(c); + } + if( HPMHooks.count.HP_mutex_cond_signal_post ) { + void (*postHookFunc) (struct cond_data *c); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_signal_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_signal_post[hIndex].func; + postHookFunc(c); + } + } + return; +} +void HP_mutex_cond_broadcast(struct cond_data *c) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_cond_broadcast_pre ) { + void (*preHookFunc) (struct cond_data **c); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_broadcast_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_broadcast_pre[hIndex].func; + preHookFunc(&c); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.cond_broadcast(c); + } + if( HPMHooks.count.HP_mutex_cond_broadcast_post ) { + void (*postHookFunc) (struct cond_data *c); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_broadcast_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_broadcast_post[hIndex].func; + postHookFunc(c); + } + } + return; +} /* nullpo_interface */ void HP_nullpo_assert_report(const char *file, int line, const char *func, const char *targetname, const char *title) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_login.sources.inc b/src/plugins/HPMHooking/HPMHooking_login.sources.inc index cbaf06854..fc530bcbf 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.sources.inc @@ -37,6 +37,7 @@ memcpy(&HPMHooks.source.libconfig, libconfig, sizeof(struct libconfig_interface) memcpy(&HPMHooks.source.login, login, sizeof(struct login_interface)); memcpy(&HPMHooks.source.iMalloc, iMalloc, sizeof(struct malloc_interface)); memcpy(&HPMHooks.source.md5, md5, sizeof(struct md5_interface)); +memcpy(&HPMHooks.source.mutex, mutex, sizeof(struct mutex_interface)); memcpy(&HPMHooks.source.nullpo, nullpo, sizeof(struct nullpo_interface)); memcpy(&HPMHooks.source.showmsg, showmsg, sizeof(struct showmsg_interface)); memcpy(&HPMHooks.source.sockt, sockt, sizeof(struct socket_interface)); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 574496f00..d85e64eb2 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -3576,6 +3576,26 @@ struct { struct HPMHookPoint *HP_mob_clear_spawninfo_post; struct HPMHookPoint *HP_mob_destroy_mob_db_pre; struct HPMHookPoint *HP_mob_destroy_mob_db_post; + struct HPMHookPoint *HP_mutex_create_pre; + struct HPMHookPoint *HP_mutex_create_post; + struct HPMHookPoint *HP_mutex_destroy_pre; + struct HPMHookPoint *HP_mutex_destroy_post; + struct HPMHookPoint *HP_mutex_lock_pre; + struct HPMHookPoint *HP_mutex_lock_post; + struct HPMHookPoint *HP_mutex_trylock_pre; + struct HPMHookPoint *HP_mutex_trylock_post; + struct HPMHookPoint *HP_mutex_unlock_pre; + struct HPMHookPoint *HP_mutex_unlock_post; + struct HPMHookPoint *HP_mutex_cond_create_pre; + struct HPMHookPoint *HP_mutex_cond_create_post; + struct HPMHookPoint *HP_mutex_cond_destroy_pre; + struct HPMHookPoint *HP_mutex_cond_destroy_post; + struct HPMHookPoint *HP_mutex_cond_wait_pre; + struct HPMHookPoint *HP_mutex_cond_wait_post; + struct HPMHookPoint *HP_mutex_cond_signal_pre; + struct HPMHookPoint *HP_mutex_cond_signal_post; + struct HPMHookPoint *HP_mutex_cond_broadcast_pre; + struct HPMHookPoint *HP_mutex_cond_broadcast_post; struct HPMHookPoint *HP_npc_chat_sub_pre; struct HPMHookPoint *HP_npc_chat_sub_post; struct HPMHookPoint *HP_npc_chat_finalize_pre; @@ -9543,6 +9563,26 @@ struct { int HP_mob_clear_spawninfo_post; int HP_mob_destroy_mob_db_pre; int HP_mob_destroy_mob_db_post; + int HP_mutex_create_pre; + int HP_mutex_create_post; + int HP_mutex_destroy_pre; + int HP_mutex_destroy_post; + int HP_mutex_lock_pre; + int HP_mutex_lock_post; + int HP_mutex_trylock_pre; + int HP_mutex_trylock_post; + int HP_mutex_unlock_pre; + int HP_mutex_unlock_post; + int HP_mutex_cond_create_pre; + int HP_mutex_cond_create_post; + int HP_mutex_cond_destroy_pre; + int HP_mutex_cond_destroy_post; + int HP_mutex_cond_wait_pre; + int HP_mutex_cond_wait_post; + int HP_mutex_cond_signal_pre; + int HP_mutex_cond_signal_post; + int HP_mutex_cond_broadcast_pre; + int HP_mutex_cond_broadcast_post; int HP_npc_chat_sub_pre; int HP_npc_chat_sub_post; int HP_npc_chat_finalize_pre; @@ -11994,6 +12034,7 @@ struct { struct md5_interface md5; struct mercenary_interface mercenary; struct mob_interface mob; + struct mutex_interface mutex; struct npc_chat_interface npc_chat; struct npc_interface npc; struct nullpo_interface nullpo; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 3b6582b18..59949c536 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1835,6 +1835,17 @@ struct HookingPointData HookingPoints[] = { { HP_POP(mob->load, HP_mob_load) }, { HP_POP(mob->clear_spawninfo, HP_mob_clear_spawninfo) }, { HP_POP(mob->destroy_mob_db, HP_mob_destroy_mob_db) }, +/* mutex_interface */ + { HP_POP(mutex->create, HP_mutex_create) }, + { HP_POP(mutex->destroy, HP_mutex_destroy) }, + { HP_POP(mutex->lock, HP_mutex_lock) }, + { HP_POP(mutex->trylock, HP_mutex_trylock) }, + { HP_POP(mutex->unlock, HP_mutex_unlock) }, + { HP_POP(mutex->cond_create, HP_mutex_cond_create) }, + { HP_POP(mutex->cond_destroy, HP_mutex_cond_destroy) }, + { HP_POP(mutex->cond_wait, HP_mutex_cond_wait) }, + { HP_POP(mutex->cond_signal, HP_mutex_cond_signal) }, + { HP_POP(mutex->cond_broadcast, HP_mutex_cond_broadcast) }, /* npc_chat_interface */ { HP_POP(npc_chat->sub, HP_npc_chat_sub) }, { HP_POP(npc_chat->finalize, HP_npc_chat_finalize) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 849008661..f46a5e7d0 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -47466,6 +47466,270 @@ void HP_mob_destroy_mob_db(int index) { } return; } +/* mutex_interface */ +struct mutex_data* HP_mutex_create(void) { + int hIndex = 0; + struct mutex_data* retVal___ = NULL; + if( HPMHooks.count.HP_mutex_create_pre ) { + struct mutex_data* (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_create_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_create_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mutex.create(); + } + if( HPMHooks.count.HP_mutex_create_post ) { + struct mutex_data* (*postHookFunc) (struct mutex_data* retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_create_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_create_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +void HP_mutex_destroy(struct mutex_data *m) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_destroy_pre ) { + void (*preHookFunc) (struct mutex_data **m); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_destroy_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_destroy_pre[hIndex].func; + preHookFunc(&m); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.destroy(m); + } + if( HPMHooks.count.HP_mutex_destroy_post ) { + void (*postHookFunc) (struct mutex_data *m); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_destroy_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_destroy_post[hIndex].func; + postHookFunc(m); + } + } + return; +} +void HP_mutex_lock(struct mutex_data *m) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_lock_pre ) { + void (*preHookFunc) (struct mutex_data **m); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_lock_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_lock_pre[hIndex].func; + preHookFunc(&m); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.lock(m); + } + if( HPMHooks.count.HP_mutex_lock_post ) { + void (*postHookFunc) (struct mutex_data *m); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_lock_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_lock_post[hIndex].func; + postHookFunc(m); + } + } + return; +} +bool HP_mutex_trylock(struct mutex_data *m) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_mutex_trylock_pre ) { + bool (*preHookFunc) (struct mutex_data **m); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_trylock_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_trylock_pre[hIndex].func; + retVal___ = preHookFunc(&m); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mutex.trylock(m); + } + if( HPMHooks.count.HP_mutex_trylock_post ) { + bool (*postHookFunc) (bool retVal___, struct mutex_data *m); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_trylock_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_trylock_post[hIndex].func; + retVal___ = postHookFunc(retVal___, m); + } + } + return retVal___; +} +void HP_mutex_unlock(struct mutex_data *m) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_unlock_pre ) { + void (*preHookFunc) (struct mutex_data **m); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_unlock_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_unlock_pre[hIndex].func; + preHookFunc(&m); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.unlock(m); + } + if( HPMHooks.count.HP_mutex_unlock_post ) { + void (*postHookFunc) (struct mutex_data *m); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_unlock_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_unlock_post[hIndex].func; + postHookFunc(m); + } + } + return; +} +struct cond_data* HP_mutex_cond_create(void) { + int hIndex = 0; + struct cond_data* retVal___ = NULL; + if( HPMHooks.count.HP_mutex_cond_create_pre ) { + struct cond_data* (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_create_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_create_pre[hIndex].func; + retVal___ = preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mutex.cond_create(); + } + if( HPMHooks.count.HP_mutex_cond_create_post ) { + struct cond_data* (*postHookFunc) (struct cond_data* retVal___); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_create_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_create_post[hIndex].func; + retVal___ = postHookFunc(retVal___); + } + } + return retVal___; +} +void HP_mutex_cond_destroy(struct cond_data *c) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_cond_destroy_pre ) { + void (*preHookFunc) (struct cond_data **c); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_destroy_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_destroy_pre[hIndex].func; + preHookFunc(&c); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.cond_destroy(c); + } + if( HPMHooks.count.HP_mutex_cond_destroy_post ) { + void (*postHookFunc) (struct cond_data *c); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_destroy_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_destroy_post[hIndex].func; + postHookFunc(c); + } + } + return; +} +void HP_mutex_cond_wait(struct cond_data *c, struct mutex_data *m, sysint timeout_ticks) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_cond_wait_pre ) { + void (*preHookFunc) (struct cond_data **c, struct mutex_data **m, sysint *timeout_ticks); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_wait_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_wait_pre[hIndex].func; + preHookFunc(&c, &m, &timeout_ticks); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.cond_wait(c, m, timeout_ticks); + } + if( HPMHooks.count.HP_mutex_cond_wait_post ) { + void (*postHookFunc) (struct cond_data *c, struct mutex_data *m, sysint timeout_ticks); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_wait_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_wait_post[hIndex].func; + postHookFunc(c, m, timeout_ticks); + } + } + return; +} +void HP_mutex_cond_signal(struct cond_data *c) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_cond_signal_pre ) { + void (*preHookFunc) (struct cond_data **c); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_signal_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_signal_pre[hIndex].func; + preHookFunc(&c); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.cond_signal(c); + } + if( HPMHooks.count.HP_mutex_cond_signal_post ) { + void (*postHookFunc) (struct cond_data *c); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_signal_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_signal_post[hIndex].func; + postHookFunc(c); + } + } + return; +} +void HP_mutex_cond_broadcast(struct cond_data *c) { + int hIndex = 0; + if( HPMHooks.count.HP_mutex_cond_broadcast_pre ) { + void (*preHookFunc) (struct cond_data **c); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_broadcast_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_mutex_cond_broadcast_pre[hIndex].func; + preHookFunc(&c); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mutex.cond_broadcast(c); + } + if( HPMHooks.count.HP_mutex_cond_broadcast_post ) { + void (*postHookFunc) (struct cond_data *c); + for(hIndex = 0; hIndex < HPMHooks.count.HP_mutex_cond_broadcast_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_mutex_cond_broadcast_post[hIndex].func; + postHookFunc(c); + } + } + return; +} /* npc_chat_interface */ int HP_npc_chat_sub(struct block_list *bl, va_list ap) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_map.sources.inc b/src/plugins/HPMHooking/HPMHooking_map.sources.inc index 5d556c065..a835e0a03 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.sources.inc @@ -59,6 +59,7 @@ memcpy(&HPMHooks.source.mapreg, mapreg, sizeof(struct mapreg_interface)); memcpy(&HPMHooks.source.md5, md5, sizeof(struct md5_interface)); memcpy(&HPMHooks.source.mercenary, mercenary, sizeof(struct mercenary_interface)); memcpy(&HPMHooks.source.mob, mob, sizeof(struct mob_interface)); +memcpy(&HPMHooks.source.mutex, mutex, sizeof(struct mutex_interface)); memcpy(&HPMHooks.source.npc_chat, npc_chat, sizeof(struct npc_chat_interface)); memcpy(&HPMHooks.source.npc, npc, sizeof(struct npc_interface)); memcpy(&HPMHooks.source.nullpo, nullpo, sizeof(struct nullpo_interface)); |