diff options
author | Haru <haru@dotalux.com> | 2019-01-03 23:46:22 +0100 |
---|---|---|
committer | Dastgir <dastgirp@gmail.com> | 2019-10-02 12:15:41 +0530 |
commit | cd3d60322385117eca29ce3c4be9af5dfc2a0c6e (patch) | |
tree | 620b1a43b90efddacd2971a8e56a86b7d6c3d875 /src | |
parent | 953efc5da879df5048e42265fa30c4aaae58288c (diff) | |
download | hercules-cd3d60322385117eca29ce3c4be9af5dfc2a0c6e.tar.gz hercules-cd3d60322385117eca29ce3c4be9af5dfc2a0c6e.tar.bz2 hercules-cd3d60322385117eca29ce3c4be9af5dfc2a0c6e.tar.xz hercules-cd3d60322385117eca29ce3c4be9af5dfc2a0c6e.zip |
HPM Hooks Update
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Defs.inc | 10 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 12 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 3 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 63 |
4 files changed, 61 insertions, 27 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index b59d80b9c..95c7869ac 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -7076,8 +7076,10 @@ typedef void (*HPMHOOK_pre_script_load_translations) (void); typedef void (*HPMHOOK_post_script_load_translations) (void); typedef bool (*HPMHOOK_pre_script_load_translation_addstring) (const char **file, uint8 *lang_id, const char **msgctxt, const struct script_string_buf **msgid, const struct script_string_buf **msgstr); typedef bool (*HPMHOOK_post_script_load_translation_addstring) (bool retVal___, const char *file, uint8 lang_id, const char *msgctxt, const struct script_string_buf *msgid, const struct script_string_buf *msgstr); -typedef int (*HPMHOOK_pre_script_load_translation) (const char **file, uint8 *lang_id); -typedef int (*HPMHOOK_post_script_load_translation) (int retVal___, const char *file, uint8 lang_id); +typedef int (*HPMHOOK_pre_script_load_translation_file) (const char **file, uint8 *lang_id); +typedef int (*HPMHOOK_post_script_load_translation_file) (int retVal___, const char *file, uint8 lang_id); +typedef int (*HPMHOOK_pre_script_load_translation) (const char **directory, uint8 *lang_id); +typedef int (*HPMHOOK_post_script_load_translation) (int retVal___, const char *directory, uint8 lang_id); typedef int (*HPMHOOK_pre_script_translation_db_destroyer) (union DBKey *key, struct DBData **data, va_list ap); typedef int (*HPMHOOK_post_script_translation_db_destroyer) (int retVal___, union DBKey key, struct DBData *data, va_list ap); typedef void (*HPMHOOK_pre_script_clear_translations) (bool *reload); @@ -7086,8 +7088,8 @@ typedef int (*HPMHOOK_pre_script_parse_cleanup_timer) (int *tid, int64 *tick, in typedef int (*HPMHOOK_post_script_parse_cleanup_timer) (int retVal___, int tid, int64 tick, int id, intptr_t data); typedef uint8 (*HPMHOOK_pre_script_add_language) (const char **name); typedef uint8 (*HPMHOOK_post_script_add_language) (uint8 retVal___, const char *name); -typedef const char* (*HPMHOOK_pre_script_get_translation_file_name) (const char **file); -typedef const char* (*HPMHOOK_post_script_get_translation_file_name) (const char* retVal___, const char *file); +typedef const char* (*HPMHOOK_pre_script_get_translation_dir_name) (const char **directory); +typedef const char* (*HPMHOOK_post_script_get_translation_dir_name) (const char* retVal___, const char *directory); typedef void (*HPMHOOK_pre_script_parser_clean_leftovers) (void); typedef void (*HPMHOOK_post_script_parser_clean_leftovers) (void); typedef void (*HPMHOOK_pre_script_run_use_script) (struct map_session_data **sd, struct item_data **data, int *oid); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 454a5229c..224ed3ef1 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -5576,6 +5576,8 @@ struct { struct HPMHookPoint *HP_script_load_translations_post; struct HPMHookPoint *HP_script_load_translation_addstring_pre; struct HPMHookPoint *HP_script_load_translation_addstring_post; + struct HPMHookPoint *HP_script_load_translation_file_pre; + struct HPMHookPoint *HP_script_load_translation_file_post; struct HPMHookPoint *HP_script_load_translation_pre; struct HPMHookPoint *HP_script_load_translation_post; struct HPMHookPoint *HP_script_translation_db_destroyer_pre; @@ -5586,8 +5588,8 @@ struct { struct HPMHookPoint *HP_script_parse_cleanup_timer_post; struct HPMHookPoint *HP_script_add_language_pre; struct HPMHookPoint *HP_script_add_language_post; - struct HPMHookPoint *HP_script_get_translation_file_name_pre; - struct HPMHookPoint *HP_script_get_translation_file_name_post; + struct HPMHookPoint *HP_script_get_translation_dir_name_pre; + struct HPMHookPoint *HP_script_get_translation_dir_name_post; struct HPMHookPoint *HP_script_parser_clean_leftovers_pre; struct HPMHookPoint *HP_script_parser_clean_leftovers_post; struct HPMHookPoint *HP_script_run_use_script_pre; @@ -12363,6 +12365,8 @@ struct { int HP_script_load_translations_post; int HP_script_load_translation_addstring_pre; int HP_script_load_translation_addstring_post; + int HP_script_load_translation_file_pre; + int HP_script_load_translation_file_post; int HP_script_load_translation_pre; int HP_script_load_translation_post; int HP_script_translation_db_destroyer_pre; @@ -12373,8 +12377,8 @@ struct { int HP_script_parse_cleanup_timer_post; int HP_script_add_language_pre; int HP_script_add_language_post; - int HP_script_get_translation_file_name_pre; - int HP_script_get_translation_file_name_post; + int HP_script_get_translation_dir_name_pre; + int HP_script_get_translation_dir_name_post; int HP_script_parser_clean_leftovers_pre; int HP_script_parser_clean_leftovers_post; int HP_script_run_use_script_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index da2f81541..7f53ee493 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2854,12 +2854,13 @@ struct HookingPointData HookingPoints[] = { { HP_POP(script->string_dup, HP_script_string_dup) }, { HP_POP(script->load_translations, HP_script_load_translations) }, { HP_POP(script->load_translation_addstring, HP_script_load_translation_addstring) }, + { HP_POP(script->load_translation_file, HP_script_load_translation_file) }, { HP_POP(script->load_translation, HP_script_load_translation) }, { HP_POP(script->translation_db_destroyer, HP_script_translation_db_destroyer) }, { HP_POP(script->clear_translations, HP_script_clear_translations) }, { HP_POP(script->parse_cleanup_timer, HP_script_parse_cleanup_timer) }, { HP_POP(script->add_language, HP_script_add_language) }, - { HP_POP(script->get_translation_file_name, HP_script_get_translation_file_name) }, + { HP_POP(script->get_translation_dir_name, HP_script_get_translation_dir_name) }, { HP_POP(script->parser_clean_leftovers, HP_script_parser_clean_leftovers) }, { HP_POP(script->run_use_script, HP_script_run_use_script) }, { HP_POP(script->run_item_equip_script, HP_script_run_item_equip_script) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index b31959ff4..a3816a0b9 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -74397,15 +74397,42 @@ bool HP_script_load_translation_addstring(const char *file, uint8 lang_id, const } return retVal___; } -int HP_script_load_translation(const char *file, uint8 lang_id) { +int HP_script_load_translation_file(const char *file, uint8 lang_id) { int hIndex = 0; int retVal___ = 0; - if (HPMHooks.count.HP_script_load_translation_pre > 0) { + if (HPMHooks.count.HP_script_load_translation_file_pre > 0) { int (*preHookFunc) (const char **file, uint8 *lang_id); *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_file_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_script_load_translation_file_pre[hIndex].func; + retVal___ = preHookFunc(&file, &lang_id); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.script.load_translation_file(file, lang_id); + } + if (HPMHooks.count.HP_script_load_translation_file_post > 0) { + int (*postHookFunc) (int retVal___, const char *file, uint8 lang_id); + for (hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_file_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_script_load_translation_file_post[hIndex].func; + retVal___ = postHookFunc(retVal___, file, lang_id); + } + } + return retVal___; +} +int HP_script_load_translation(const char *directory, uint8 lang_id) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_script_load_translation_pre > 0) { + int (*preHookFunc) (const char **directory, uint8 *lang_id); + *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_script_load_translation_pre[hIndex].func; - retVal___ = preHookFunc(&file, &lang_id); + retVal___ = preHookFunc(&directory, &lang_id); } if (*HPMforce_return) { *HPMforce_return = false; @@ -74413,13 +74440,13 @@ int HP_script_load_translation(const char *file, uint8 lang_id) { } } { - retVal___ = HPMHooks.source.script.load_translation(file, lang_id); + retVal___ = HPMHooks.source.script.load_translation(directory, lang_id); } if (HPMHooks.count.HP_script_load_translation_post > 0) { - int (*postHookFunc) (int retVal___, const char *file, uint8 lang_id); + int (*postHookFunc) (int retVal___, const char *directory, uint8 lang_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_post; hIndex++) { postHookFunc = HPMHooks.list.HP_script_load_translation_post[hIndex].func; - retVal___ = postHookFunc(retVal___, file, lang_id); + retVal___ = postHookFunc(retVal___, directory, lang_id); } } return retVal___; @@ -74537,15 +74564,15 @@ uint8 HP_script_add_language(const char *name) { } return retVal___; } -const char* HP_script_get_translation_file_name(const char *file) { +const char* HP_script_get_translation_dir_name(const char *directory) { int hIndex = 0; const char* retVal___ = NULL; - if (HPMHooks.count.HP_script_get_translation_file_name_pre > 0) { - const char* (*preHookFunc) (const char **file); + if (HPMHooks.count.HP_script_get_translation_dir_name_pre > 0) { + const char* (*preHookFunc) (const char **directory); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_script_get_translation_file_name_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_script_get_translation_file_name_pre[hIndex].func; - retVal___ = preHookFunc(&file); + for (hIndex = 0; hIndex < HPMHooks.count.HP_script_get_translation_dir_name_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_script_get_translation_dir_name_pre[hIndex].func; + retVal___ = preHookFunc(&directory); } if (*HPMforce_return) { *HPMforce_return = false; @@ -74553,13 +74580,13 @@ const char* HP_script_get_translation_file_name(const char *file) { } } { - retVal___ = HPMHooks.source.script.get_translation_file_name(file); + retVal___ = HPMHooks.source.script.get_translation_dir_name(directory); } - if (HPMHooks.count.HP_script_get_translation_file_name_post > 0) { - const char* (*postHookFunc) (const char* retVal___, const char *file); - for (hIndex = 0; hIndex < HPMHooks.count.HP_script_get_translation_file_name_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_script_get_translation_file_name_post[hIndex].func; - retVal___ = postHookFunc(retVal___, file); + if (HPMHooks.count.HP_script_get_translation_dir_name_post > 0) { + const char* (*postHookFunc) (const char* retVal___, const char *directory); + for (hIndex = 0; hIndex < HPMHooks.count.HP_script_get_translation_dir_name_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_script_get_translation_dir_name_post[hIndex].func; + retVal___ = postHookFunc(retVal___, directory); } } return retVal___; |