From 9fd9ea52c4ec0f6220c54bed2abe6acea7430282 Mon Sep 17 00:00:00 2001 From: gumi Date: Wed, 29 Apr 2020 18:28:38 -0400 Subject: update HPM hooks --- src/plugins/HPMHooking/HPMHooking.Defs.inc | 6 ++-- .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 4 +++ .../HPMHooking/HPMHooking_map.HookingPoints.inc | 1 + src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 39 ++++++++++++++++++---- 4 files changed, 42 insertions(+), 8 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index b8aa5ae61..d7cc45904 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -6842,8 +6842,8 @@ typedef void (*HPMHOOK_pre_script_set_constant2) (const char **name, int *value, typedef void (*HPMHOOK_post_script_set_constant2) (const char *name, int value, bool is_parameter, bool is_deprecated); typedef bool (*HPMHOOK_pre_script_get_constant) (const char **name, int **value); typedef bool (*HPMHOOK_post_script_get_constant) (bool retVal___, const char *name, int *value); -typedef void (*HPMHOOK_pre_script_label_add) (int *key, int *pos); -typedef void (*HPMHOOK_post_script_label_add) (int key, int pos); +typedef void (*HPMHOOK_pre_script_label_add) (int *key, int *pos, enum script_label_flags *flags); +typedef void (*HPMHOOK_post_script_label_add) (int key, int pos, enum script_label_flags flags); typedef void (*HPMHOOK_pre_script_run) (struct script_code **rootscript, int *pos, int *rid, int *oid); typedef void (*HPMHOOK_post_script_run) (struct script_code *rootscript, int pos, int rid, int oid); typedef void (*HPMHOOK_pre_script_run_npc) (struct script_code **rootscript, int *pos, int *rid, int *oid); @@ -6908,6 +6908,8 @@ typedef const char* (*HPMHOOK_pre_script_parse_syntax_close_sub) (const char **p typedef const char* (*HPMHOOK_post_script_parse_syntax_close_sub) (const char* retVal___, const char *p, int *flag); typedef const char* (*HPMHOOK_pre_script_parse_syntax) (const char **p); typedef const char* (*HPMHOOK_post_script_parse_syntax) (const char* retVal___, const char *p); +typedef const char* (*HPMHOOK_pre_script_parse_syntax_function) (const char **p, bool *is_public); +typedef const char* (*HPMHOOK_post_script_parse_syntax_function) (const char* retVal___, const char *p, bool is_public); typedef c_op (*HPMHOOK_pre_script_get_com) (const struct script_buf **scriptbuf, int **pos); typedef c_op (*HPMHOOK_post_script_get_com) (c_op retVal___, const struct script_buf *scriptbuf, int *pos); typedef int (*HPMHOOK_pre_script_get_num) (const struct script_buf **scriptbuf, int **pos); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 109c30885..3bde525cf 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -5438,6 +5438,8 @@ struct { struct HPMHookPoint *HP_script_parse_syntax_close_sub_post; struct HPMHookPoint *HP_script_parse_syntax_pre; struct HPMHookPoint *HP_script_parse_syntax_post; + struct HPMHookPoint *HP_script_parse_syntax_function_pre; + struct HPMHookPoint *HP_script_parse_syntax_function_post; struct HPMHookPoint *HP_script_get_com_pre; struct HPMHookPoint *HP_script_get_com_post; struct HPMHookPoint *HP_script_get_num_pre; @@ -12319,6 +12321,8 @@ struct { int HP_script_parse_syntax_close_sub_post; int HP_script_parse_syntax_pre; int HP_script_parse_syntax_post; + int HP_script_parse_syntax_function_pre; + int HP_script_parse_syntax_function_post; int HP_script_get_com_pre; int HP_script_get_com_post; int HP_script_get_num_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index ac30b97d4..e7515b19f 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2785,6 +2785,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(script->parse_syntax_close, HP_script_parse_syntax_close) }, { HP_POP(script->parse_syntax_close_sub, HP_script_parse_syntax_close_sub) }, { HP_POP(script->parse_syntax, HP_script_parse_syntax) }, + { HP_POP(script->parse_syntax_function, HP_script_parse_syntax_function) }, { HP_POP(script->get_com, HP_script_get_com) }, { HP_POP(script->get_num, HP_script_get_num) }, { HP_POP(script->op2name, HP_script_op2name) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 940f96ca2..6c5071020 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -71539,14 +71539,14 @@ bool HP_script_get_constant(const char *name, int *value) { } return retVal___; } -void HP_script_label_add(int key, int pos) { +void HP_script_label_add(int key, int pos, enum script_label_flags flags) { int hIndex = 0; if (HPMHooks.count.HP_script_label_add_pre > 0) { - void (*preHookFunc) (int *key, int *pos); + void (*preHookFunc) (int *key, int *pos, enum script_label_flags *flags); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_script_label_add_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_script_label_add_pre[hIndex].func; - preHookFunc(&key, &pos); + preHookFunc(&key, &pos, &flags); } if (*HPMforce_return) { *HPMforce_return = false; @@ -71554,13 +71554,13 @@ void HP_script_label_add(int key, int pos) { } } { - HPMHooks.source.script.label_add(key, pos); + HPMHooks.source.script.label_add(key, pos, flags); } if (HPMHooks.count.HP_script_label_add_post > 0) { - void (*postHookFunc) (int key, int pos); + void (*postHookFunc) (int key, int pos, enum script_label_flags flags); for (hIndex = 0; hIndex < HPMHooks.count.HP_script_label_add_post; hIndex++) { postHookFunc = HPMHooks.list.HP_script_label_add_post[hIndex].func; - postHookFunc(key, pos); + postHookFunc(key, pos, flags); } } return; @@ -72415,6 +72415,33 @@ const char* HP_script_parse_syntax(const char *p) { } return retVal___; } +const char* HP_script_parse_syntax_function(const char *p, bool is_public) { + int hIndex = 0; + const char* retVal___ = NULL; + if (HPMHooks.count.HP_script_parse_syntax_function_pre > 0) { + const char* (*preHookFunc) (const char **p, bool *is_public); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_script_parse_syntax_function_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_script_parse_syntax_function_pre[hIndex].func; + retVal___ = preHookFunc(&p, &is_public); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.script.parse_syntax_function(p, is_public); + } + if (HPMHooks.count.HP_script_parse_syntax_function_post > 0) { + const char* (*postHookFunc) (const char* retVal___, const char *p, bool is_public); + for (hIndex = 0; hIndex < HPMHooks.count.HP_script_parse_syntax_function_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_script_parse_syntax_function_post[hIndex].func; + retVal___ = postHookFunc(retVal___, p, is_public); + } + } + return retVal___; +} c_op HP_script_get_com(const struct script_buf *scriptbuf, int *pos) { int hIndex = 0; c_op retVal___ = C_NOP; -- cgit v1.2.3-60-g2f50