From 548aa1263b69c2c5551d2c5f3d501ebc82d1e067 Mon Sep 17 00:00:00 2001 From: Asheraf Date: Sat, 31 Aug 2019 13:31:49 +0100 Subject: HPM Hooks Update --- src/plugins/HPMHooking/HPMHooking.Defs.inc | 8 ++-- .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 16 +++---- .../HPMHooking/HPMHooking_map.HookingPoints.inc | 4 +- src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 55 +++++++++++----------- 4 files changed, 42 insertions(+), 41 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index b218988b6..af057dbc5 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -4042,10 +4042,10 @@ typedef int (*HPMHOOK_pre_itemdb_isidentified) (int *nameid); typedef int (*HPMHOOK_post_itemdb_isidentified) (int retVal___, int nameid); typedef int (*HPMHOOK_pre_itemdb_isidentified2) (struct item_data **data); typedef int (*HPMHOOK_post_itemdb_isidentified2) (int retVal___, struct item_data *data); -typedef int (*HPMHOOK_pre_itemdb_combo_split_atoi) (char **str, int **val); -typedef int (*HPMHOOK_post_itemdb_combo_split_atoi) (int retVal___, char *str, int *val); -typedef void (*HPMHOOK_pre_itemdb_read_combos) (void); -typedef void (*HPMHOOK_post_itemdb_read_combos) (void); +typedef bool (*HPMHOOK_pre_itemdb_read_combodb_libconfig) (void); +typedef bool (*HPMHOOK_post_itemdb_read_combodb_libconfig) (bool retVal___); +typedef bool (*HPMHOOK_pre_itemdb_read_combodb_libconfig_sub) (struct config_setting_t **it, int *idx, const char **source); +typedef bool (*HPMHOOK_post_itemdb_read_combodb_libconfig_sub) (bool retVal___, struct config_setting_t *it, int idx, const char *source); typedef int (*HPMHOOK_pre_itemdb_gendercheck) (struct item_data **id); typedef int (*HPMHOOK_post_itemdb_gendercheck) (int retVal___, struct item_data *id); typedef int (*HPMHOOK_pre_itemdb_validate_entry) (struct item_data **entry, int *n, const char **source); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 2faafacc5..29d802640 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -3218,10 +3218,10 @@ struct { struct HPMHookPoint *HP_itemdb_isidentified_post; struct HPMHookPoint *HP_itemdb_isidentified2_pre; struct HPMHookPoint *HP_itemdb_isidentified2_post; - struct HPMHookPoint *HP_itemdb_combo_split_atoi_pre; - struct HPMHookPoint *HP_itemdb_combo_split_atoi_post; - struct HPMHookPoint *HP_itemdb_read_combos_pre; - struct HPMHookPoint *HP_itemdb_read_combos_post; + struct HPMHookPoint *HP_itemdb_read_combodb_libconfig_pre; + struct HPMHookPoint *HP_itemdb_read_combodb_libconfig_post; + struct HPMHookPoint *HP_itemdb_read_combodb_libconfig_sub_pre; + struct HPMHookPoint *HP_itemdb_read_combodb_libconfig_sub_post; struct HPMHookPoint *HP_itemdb_gendercheck_pre; struct HPMHookPoint *HP_itemdb_gendercheck_post; struct HPMHookPoint *HP_itemdb_validate_entry_pre; @@ -9989,10 +9989,10 @@ struct { int HP_itemdb_isidentified_post; int HP_itemdb_isidentified2_pre; int HP_itemdb_isidentified2_post; - int HP_itemdb_combo_split_atoi_pre; - int HP_itemdb_combo_split_atoi_post; - int HP_itemdb_read_combos_pre; - int HP_itemdb_read_combos_post; + int HP_itemdb_read_combodb_libconfig_pre; + int HP_itemdb_read_combodb_libconfig_post; + int HP_itemdb_read_combodb_libconfig_sub_pre; + int HP_itemdb_read_combodb_libconfig_sub_post; int HP_itemdb_gendercheck_pre; int HP_itemdb_gendercheck_post; int HP_itemdb_validate_entry_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index cfc6984dc..4a991672a 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1648,8 +1648,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(itemdb->isrestricted, HP_itemdb_isrestricted) }, { HP_POP(itemdb->isidentified, HP_itemdb_isidentified) }, { HP_POP(itemdb->isidentified2, HP_itemdb_isidentified2) }, - { HP_POP(itemdb->combo_split_atoi, HP_itemdb_combo_split_atoi) }, - { HP_POP(itemdb->read_combos, HP_itemdb_read_combos) }, + { HP_POP(itemdb->read_combodb_libconfig, HP_itemdb_read_combodb_libconfig) }, + { HP_POP(itemdb->read_combodb_libconfig_sub, HP_itemdb_read_combodb_libconfig_sub) }, { HP_POP(itemdb->gendercheck, HP_itemdb_gendercheck) }, { HP_POP(itemdb->validate_entry, HP_itemdb_validate_entry) }, { HP_POP(itemdb->readdb_options_additional_fields, HP_itemdb_readdb_options_additional_fields) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index f74e08187..d71aff20b 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -42310,15 +42310,15 @@ int HP_itemdb_isidentified2(struct item_data *data) { } return retVal___; } -int HP_itemdb_combo_split_atoi(char *str, int *val) { +bool HP_itemdb_read_combodb_libconfig(void) { int hIndex = 0; - int retVal___ = 0; - if (HPMHooks.count.HP_itemdb_combo_split_atoi_pre > 0) { - int (*preHookFunc) (char **str, int **val); + bool retVal___ = false; + if (HPMHooks.count.HP_itemdb_read_combodb_libconfig_pre > 0) { + bool (*preHookFunc) (void); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_combo_split_atoi_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_itemdb_combo_split_atoi_pre[hIndex].func; - retVal___ = preHookFunc(&str, &val); + for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combodb_libconfig_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_itemdb_read_combodb_libconfig_pre[hIndex].func; + retVal___ = preHookFunc(); } if (*HPMforce_return) { *HPMforce_return = false; @@ -42326,42 +42326,43 @@ int HP_itemdb_combo_split_atoi(char *str, int *val) { } } { - retVal___ = HPMHooks.source.itemdb.combo_split_atoi(str, val); + retVal___ = HPMHooks.source.itemdb.read_combodb_libconfig(); } - if (HPMHooks.count.HP_itemdb_combo_split_atoi_post > 0) { - int (*postHookFunc) (int retVal___, char *str, int *val); - for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_combo_split_atoi_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_itemdb_combo_split_atoi_post[hIndex].func; - retVal___ = postHookFunc(retVal___, str, val); + if (HPMHooks.count.HP_itemdb_read_combodb_libconfig_post > 0) { + bool (*postHookFunc) (bool retVal___); + for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combodb_libconfig_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_itemdb_read_combodb_libconfig_post[hIndex].func; + retVal___ = postHookFunc(retVal___); } } return retVal___; } -void HP_itemdb_read_combos(void) { +bool HP_itemdb_read_combodb_libconfig_sub(struct config_setting_t *it, int idx, const char *source) { int hIndex = 0; - if (HPMHooks.count.HP_itemdb_read_combos_pre > 0) { - void (*preHookFunc) (void); + bool retVal___ = false; + if (HPMHooks.count.HP_itemdb_read_combodb_libconfig_sub_pre > 0) { + bool (*preHookFunc) (struct config_setting_t **it, int *idx, const char **source); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combos_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_itemdb_read_combos_pre[hIndex].func; - preHookFunc(); + for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combodb_libconfig_sub_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_itemdb_read_combodb_libconfig_sub_pre[hIndex].func; + retVal___ = preHookFunc(&it, &idx, &source); } if (*HPMforce_return) { *HPMforce_return = false; - return; + return retVal___; } } { - HPMHooks.source.itemdb.read_combos(); + retVal___ = HPMHooks.source.itemdb.read_combodb_libconfig_sub(it, idx, source); } - if (HPMHooks.count.HP_itemdb_read_combos_post > 0) { - void (*postHookFunc) (void); - for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combos_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_itemdb_read_combos_post[hIndex].func; - postHookFunc(); + if (HPMHooks.count.HP_itemdb_read_combodb_libconfig_sub_post > 0) { + bool (*postHookFunc) (bool retVal___, struct config_setting_t *it, int idx, const char *source); + for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combodb_libconfig_sub_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_itemdb_read_combodb_libconfig_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, it, idx, source); } } - return; + return retVal___; } int HP_itemdb_gendercheck(struct item_data *id) { int hIndex = 0; -- cgit v1.2.3-70-g09d2