From 72bb5184144dad528168c3dcf783284ea2d32870 Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Sun, 10 Jul 2016 17:07:54 +0200 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- src/plugins/HPMHooking/HPMHooking.Defs.inc | 2 ++ .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 4 ++++ .../HPMHooking/HPMHooking_map.HookingPoints.inc | 1 + src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 27 ++++++++++++++++++++++ 4 files changed, 34 insertions(+) (limited to 'src/plugins/HPMHooking') diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 589642b42..b6a0a28c0 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -5992,6 +5992,8 @@ typedef int (*HPMHOOK_pre_script_string_dup) (char **str); typedef int (*HPMHOOK_post_script_string_dup) (int retVal___, char *str); 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_translation_db_destroyer) (union DBKey *key, struct DBData **data, va_list ap); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 74cbbabd4..591c6b147 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -4828,6 +4828,8 @@ struct { struct HPMHookPoint *HP_script_string_dup_post; struct HPMHookPoint *HP_script_load_translations_pre; 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_pre; struct HPMHookPoint *HP_script_load_translation_post; struct HPMHookPoint *HP_script_translation_db_destroyer_pre; @@ -10783,6 +10785,8 @@ struct { int HP_script_string_dup_post; int HP_script_load_translations_pre; 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_pre; int HP_script_load_translation_post; int HP_script_translation_db_destroyer_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index eef694ea8..014497ae2 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2470,6 +2470,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(script->mapindexname2id, HP_script_mapindexname2id) }, { 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, HP_script_load_translation) }, { HP_POP(script->translation_db_destroyer, HP_script_translation_db_destroyer) }, { HP_POP(script->clear_translations, HP_script_clear_translations) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 8a294e3f2..850c54f80 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -64489,6 +64489,33 @@ void HP_script_load_translations(void) { } return; } +bool HP_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) { + int hIndex = 0; + bool retVal___ = false; + if( HPMHooks.count.HP_script_load_translation_addstring_pre ) { + bool (*preHookFunc) (const char **file, uint8 *lang_id, const char **msgctxt, const struct script_string_buf **msgid, const struct script_string_buf **msgstr); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_addstring_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_script_load_translation_addstring_pre[hIndex].func; + retVal___ = preHookFunc(&file, &lang_id, &msgctxt, &msgid, &msgstr); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.script.load_translation_addstring(file, lang_id, msgctxt, msgid, msgstr); + } + if( HPMHooks.count.HP_script_load_translation_addstring_post ) { + bool (*postHookFunc) (bool retVal___, const char *file, uint8 lang_id, const char *msgctxt, const struct script_string_buf *msgid, const struct script_string_buf *msgstr); + for(hIndex = 0; hIndex < HPMHooks.count.HP_script_load_translation_addstring_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_script_load_translation_addstring_post[hIndex].func; + retVal___ = postHookFunc(retVal___, file, lang_id, msgctxt, msgid, msgstr); + } + } + return retVal___; +} int HP_script_load_translation(const char *file, uint8 lang_id) { int hIndex = 0; int retVal___ = 0; -- cgit v1.2.3-70-g09d2