summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2019-10-20 17:43:44 +0200
committerGitHub <noreply@github.com>2019-10-20 17:43:44 +0200
commit275edef51c858e9e55934ec3af92ec19db74f3d3 (patch)
tree81c4367dfb4d51fec9c71c2a407f502a514b6a67
parentddd0e461fb8e451912a6aee90869023e2c2d8272 (diff)
parentbe955e59bcd950d6430189a8a23a608927665c02 (diff)
downloadhercules-275edef51c858e9e55934ec3af92ec19db74f3d3.tar.gz
hercules-275edef51c858e9e55934ec3af92ec19db74f3d3.tar.bz2
hercules-275edef51c858e9e55934ec3af92ec19db74f3d3.tar.xz
hercules-275edef51c858e9e55934ec3af92ec19db74f3d3.zip
Merge pull request #2547 from guilherme-gm/201910-dehardcode-db
Dehardcode DB files path
-rw-r--r--conf/common/map-index.conf34
-rw-r--r--src/char/char.c7
-rw-r--r--src/char/char.h2
-rw-r--r--src/char/geoip.c5
-rw-r--r--src/char/int_guild.c2
-rw-r--r--src/common/conf.c30
-rw-r--r--src/common/conf.h4
-rw-r--r--src/common/mapindex.c57
-rw-r--r--src/common/mapindex.h4
-rw-r--r--src/config/const.h7
-rw-r--r--src/map/achievement.c6
-rw-r--r--src/map/clif.c9
-rw-r--r--src/map/guild.c3
-rw-r--r--src/map/itemdb.c24
-rw-r--r--src/map/map.c10
-rw-r--r--src/map/mob.c4
-rw-r--r--src/map/pc.c9
-rw-r--r--src/map/script.c3
-rw-r--r--src/map/skill.c2
-rw-r--r--src/map/status.c6
-rw-r--r--src/map/stylist.c3
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc8
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc16
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc4
-rw-r--r--src/plugins/HPMHooking/HPMHooking_char.Hooks.inc106
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc8
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_login.Hooks.inc52
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc16
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc4
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc106
31 files changed, 504 insertions, 49 deletions
diff --git a/conf/common/map-index.conf b/conf/common/map-index.conf
new file mode 100644
index 000000000..b3a1b4e8f
--- /dev/null
+++ b/conf/common/map-index.conf
@@ -0,0 +1,34 @@
+//================= Hercules Configuration ================================
+//= _ _ _
+//= | | | | | |
+//= | |_| | ___ _ __ ___ _ _| | ___ ___
+//= | _ |/ _ \ '__/ __| | | | |/ _ \/ __|
+//= | | | | __/ | | (__| |_| | | __/\__ \
+//= \_| |_/\___|_| \___|\__,_|_|\___||___/
+//================= License ===============================================
+//= This file is part of Hercules.
+//= http://herc.ws - http://github.com/HerculesWS/Hercules
+//=
+//= Copyright (C) 2014-2019 Hercules Dev Team
+//=
+//= Hercules is free software: you can redistribute it and/or modify
+//= it under the terms of the GNU General Public License as published by
+//= the Free Software Foundation, either version 3 of the License, or
+//= (at your option) any later version.
+//=
+//= This program is distributed in the hope that it will be useful,
+//= but WITHOUT ANY WARRANTY; without even the implied warranty of
+//= MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//= GNU General Public License for more details.
+//=
+//= You should have received a copy of the GNU General Public License
+//= along with this program. If not, see <http://www.gnu.org/licenses/>.
+//=========================================================================
+//= Map Index configuration file.
+//=========================================================================
+
+mapindex_configuration: {
+ // Full path to the map_index.txt file
+ // Default: db/map_index.txt
+ file_path: "db/map_index.txt"
+}
diff --git a/src/char/char.c b/src/char/char.c
index 37db77300..66bfdd4ee 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -120,8 +120,6 @@ char char_achievement_db[256] = "char_achievements";
static struct char_interface char_s;
struct char_interface *chr;
-char db_path[1024] = "db";
-
static char wisp_server_name[NAME_LENGTH] = "Server";
static char login_ip_str[128];
static uint32 login_ip = 0;
@@ -5792,7 +5790,8 @@ static bool char_config_read_database(const char *filename, const struct config_
if (autosave_interval <= 0)
autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
}
- libconfig->setting_lookup_mutable_string(setting, "db_path", db_path, sizeof(db_path));
+ libconfig->setting_lookup_mutable_string(setting, "db_path", chr->db_path, sizeof(chr->db_path));
+ libconfig->set_db_path(chr->db_path);
libconfig->setting_lookup_bool_real(setting, "log_char", &chr->enable_logs);
return true;
}
@@ -6454,6 +6453,8 @@ void char_defaults(void)
chr = &char_s;
memset(chr->server, 0, sizeof(chr->server));
+ sprintf(chr->db_path, "db");
+ libconfig->set_db_path(chr->db_path);
chr->login_fd = 0;
chr->char_fd = -1;
diff --git a/src/char/char.h b/src/char/char.h
index 5de3e2a80..3b8bcff2e 100644
--- a/src/char/char.h
+++ b/src/char/char.h
@@ -124,6 +124,8 @@ struct char_interface {
bool show_save_log; ///< Show loading/saving messages.
bool enable_logs; ///< Whether to log char server operations.
+ char db_path[256]; //< Database directory (db)
+
int (*waiting_disconnect) (int tid, int64 tick, int id, intptr_t data);
int (*delete_char_sql) (int char_id);
struct DBData (*create_online_char_data) (union DBKey key, va_list args);
diff --git a/src/char/geoip.c b/src/char/geoip.c
index 2870e5f0c..67c057aff 100644
--- a/src/char/geoip.c
+++ b/src/char/geoip.c
@@ -23,6 +23,7 @@
#include "geoip.h"
#include "common/cbasetypes.h"
+#include "common/conf.h"
#include "common/memmgr.h"
#include "common/showmsg.h"
@@ -141,7 +142,9 @@ static void geoip_init(void)
geoip->data->active = true;
- db = fopen("./db/GeoIP.dat","rb");
+ char file_path[256];
+ libconfig->format_db_path("GeoIP.dat", file_path, sizeof(file_path));
+ db = fopen(file_path, "rb");
if (db == NULL) {
ShowError("geoip_readdb: Error reading GeoIP.dat!\n");
geoip->final(false);
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index 87cb3bee0..3e9d50f8d 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -747,7 +747,7 @@ static int inter_guild_sql_init(void)
inter_guild->castle_db = idb_alloc(DB_OPT_RELEASE_DATA);
//Read exp file
- sv->readdb("db", DBPATH"exp_guild.txt", ',', 1, 1, MAX_GUILDLEVEL, inter_guild->exp_parse_row);
+ sv->readdb(chr->db_path, DBPATH"exp_guild.txt", ',', 1, 1, MAX_GUILDLEVEL, inter_guild->exp_parse_row);
timer->add_func_list(inter_guild->save_timer, "inter_guild->save_timer");
timer->add(timer->gettick() + 10000, inter_guild->save_timer, 0, 0);
diff --git a/src/common/conf.c b/src/common/conf.c
index 0ad350057..d81a6636b 100644
--- a/src/common/conf.c
+++ b/src/common/conf.c
@@ -22,6 +22,7 @@
#include "conf.h"
+#include "common/nullpo.h" // nullpo_retv
#include "common/showmsg.h" // ShowError
#include "common/strlib.h" // safestrncpy
#include "common/utils.h" // exists
@@ -33,6 +34,31 @@ static struct libconfig_interface libconfig_s;
struct libconfig_interface *libconfig;
/**
+ * Sets the server's db_path to be used by config_format_db_path
+ * @param db_path path to the folder where the db files are at
+ */
+static void config_set_db_path(const char *db_path)
+{
+ nullpo_retv(db_path);
+ safestrncpy(libconfig->db_path, db_path, sizeof(libconfig->db_path));
+}
+
+/**
+ * Writes into path_buf the fullpath to the db file in filename.
+ * Basically this prepends map->db_path to filename.
+ * @param filename File name to format (e.g. re/item_db.conf)
+ * @param path_buf Where to save the path to
+ * @param buffer_len Maximun length of path_buf
+ */
+static void config_format_db_path(const char *filename, char *path_buf, int buffer_len)
+{
+ nullpo_retv(filename);
+ nullpo_retv(path_buf);
+
+ safesnprintf(path_buf, buffer_len, "%s/%s", libconfig->db_path, filename);
+}
+
+/**
* Initializes 'config' and loads a configuration file.
*
* Shows error and destroys 'config' in case of failure.
@@ -450,6 +476,10 @@ static int config_lookup_int64_real(const struct config_t *config, const char *f
void libconfig_defaults(void) {
libconfig = &libconfig_s;
+ snprintf(libconfig->db_path, sizeof(libconfig->db_path), "db");
+ libconfig->set_db_path = config_set_db_path;
+ libconfig->format_db_path = config_format_db_path;
+ /* */
libconfig->read = config_read;
libconfig->write = config_write;
/* */
diff --git a/src/common/conf.h b/src/common/conf.h
index 66960c0ec..ccab6dc17 100644
--- a/src/common/conf.h
+++ b/src/common/conf.h
@@ -29,6 +29,10 @@
* The libconfig interface -- specially for plugins, but we enforce it throughout the core to be consistent
**/
struct libconfig_interface {
+ char db_path[256];
+ void (*set_db_path) (const char *db_path);
+ void (*format_db_path) (const char *filename, char *path_buf, int buffer_len);
+ /* */
int (*read) (struct config_t *config, FILE *stream);
void (*write) (const struct config_t *config, FILE *stream);
/* */
diff --git a/src/common/mapindex.c b/src/common/mapindex.c
index d5cda5c22..f6097bb06 100644
--- a/src/common/mapindex.c
+++ b/src/common/mapindex.c
@@ -23,6 +23,7 @@
#include "mapindex.h"
#include "common/cbasetypes.h"
+#include "common/conf.h"
#include "common/db.h"
#include "common/mmo.h"
#include "common/nullpo.h"
@@ -159,8 +160,61 @@ static const char *mapindex_id2name_sub(uint16 id, const char *file, int line, c
return mapindex->list[id].name;
}
+/**
+ * Reads the db_path config of mapindex configuration file
+ * @param filename File being read (used when displaying errors)
+ * @param config Config structure being read
+ * @returns true if it read the all the configs, false otherwise
+ */
+static bool mapindex_config_read_dbpath(const char *filename, const struct config_t *config)
+{
+ nullpo_retr(false, config);
+
+ const struct config_setting_t *setting = NULL;
+
+ if ((setting = libconfig->lookup(config, "mapindex_configuration")) == NULL) {
+ ShowError("mapindex_config_read: mapindex_configuration was not found in %s!\n", filename);
+ return false;
+ }
+
+ // mapindex_configuration/file_path
+ if (libconfig->setting_lookup_mutable_string(setting, "file_path", mapindex->config_file, sizeof(mapindex->config_file)) == CONFIG_TRUE) {
+ ShowInfo("map_index file %s\n", mapindex->config_file);
+ } else {
+ ShowInfo("Failed to load map_index path, defaulting to db/map_index.txt\n");
+ safestrncpy(mapindex->config_file, "db/map_index.txt", sizeof(mapindex->config_file));
+ }
+
+ return true;
+}
+
+/**
+ * Reads conf/common/map-index.conf config file
+ * @returns true if it successfully read the file and configs, false otherwise
+ */
+static bool mapindex_config_read(void)
+{
+ struct config_t config;
+ const char *filename = "conf/common/map-index.conf";
+
+ if (!libconfig->load_file(&config, filename))
+ return false; // Error message is already shown by libconfig->load_file
+
+ if (!mapindex_config_read_dbpath(filename, &config)) {
+ libconfig->destroy(&config);
+ return false;
+ }
+
+ ShowInfo("Done reading %s.\n", filename);
+ libconfig->destroy(&config);
+ return true;
+}
+
static int mapindex_init(void)
{
+ if (!mapindex_config_read())
+ ShowError("Failed to load map_index configuration. Continuing with default values...\n");
+
FILE *fp;
char line[1024];
int last_index = -1;
@@ -234,6 +288,9 @@ void mapindex_defaults(void)
memset (&mapindex->list, 0, sizeof (mapindex->list));
/* */
+ mapindex->config_read = mapindex_config_read;
+ mapindex->config_read_dbpath = mapindex_config_read_dbpath;
+ /* */
mapindex->init = mapindex_init;
mapindex->final = mapindex_final;
/* */
diff --git a/src/common/mapindex.h b/src/common/mapindex.h
index 27cbc5e37..b7e02447d 100644
--- a/src/common/mapindex.h
+++ b/src/common/mapindex.h
@@ -21,6 +21,7 @@
#ifndef COMMON_MAPINDEX_H
#define COMMON_MAPINDEX_H
+#include "common/conf.h"
#include "common/hercules.h"
#include "common/mmo.h"
@@ -98,6 +99,9 @@ struct mapindex_interface {
char name[MAP_NAME_LENGTH];
} list[MAX_MAPINDEX];
/* */
+ bool (*config_read_dbpath) (const char *filename, const struct config_t *config);
+ bool (*config_read) (void);
+ /* */
int (*init) (void);
void (*final) (void);
/* */
diff --git a/src/config/const.h b/src/config/const.h
index 4767b5721..df8c07b67 100644
--- a/src/config/const.h
+++ b/src/config/const.h
@@ -49,10 +49,13 @@
/**
* Path within the /db folder to (non-)renewal specific db files
**/
+#define DBPATH_RE "re/"
+#define DBPATH_PRE "pre-re/"
+
#ifdef RENEWAL
- #define DBPATH "re/"
+ #define DBPATH DBPATH_RE
#else
- #define DBPATH "pre-re/"
+ #define DBPATH DBPATH_PRE
#endif
/**
diff --git a/src/map/achievement.c b/src/map/achievement.c
index 7ab80e183..c2ebb5fdd 100644
--- a/src/map/achievement.c
+++ b/src/map/achievement.c
@@ -1099,7 +1099,8 @@ static bool achievement_get_rewards(struct map_session_data *sd, const struct ac
*/
static void achievement_readdb_ranks(void)
{
- const char *filename = "db/achievement_rank_db.conf";
+ char filename[256];
+ libconfig->format_db_path("achievement_rank_db.conf", filename, sizeof(filename));
struct config_t ar_conf = { 0 };
struct config_setting_t *ardb = NULL, *conf = NULL;
int entry = 0;
@@ -1777,7 +1778,8 @@ static void achievement_readdb_additional_fields(const struct config_setting_t *
*/
static void achievement_readb(void)
{
- const char *filename = "db/"DBPATH"achievement_db.conf";
+ char filename[256];
+ libconfig->format_db_path(DBPATH"achievement_db.conf", filename, sizeof(filename));
struct config_t ach_conf = { 0 };
struct config_setting_t *achdb = NULL, *conf = NULL;
int entry = 0, count = 0;
diff --git a/src/map/clif.c b/src/map/clif.c
index 3abbc2c36..9f30408e4 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -19794,7 +19794,8 @@ static void clif_cashshop_db(void)
{
struct config_t cashshop_conf;
struct config_setting_t *cashshop = NULL, *cats = NULL;
- const char *config_filename = "db/cashshop_db.conf"; // FIXME hardcoded name
+ char config_filename[256];
+ libconfig->format_db_path("cashshop_db.conf", config_filename, sizeof(config_filename));
int i, item_count_t = 0;
for( i = 0; i < CASHSHOP_TAB_MAX; i++ ) {
CREATE(clif->cs.data[i], struct hCSData *, 1);
@@ -21065,7 +21066,8 @@ static bool clif_parse_roulette_db(void)
{
struct config_t roulette_conf;
struct config_setting_t *roulette = NULL, *levels = NULL;
- const char *config_filename = "db/roulette_db.conf"; // FIXME hardcoded name
+ char config_filename[256];
+ libconfig->format_db_path("roulette_db.conf", config_filename, sizeof(config_filename));
int i, j, item_count_t = 0;
for( i = 0; i < MAX_ROULETTE_LEVEL; i++ ) {
@@ -22549,7 +22551,8 @@ static bool clif_parse_attendance_db(void)
{
struct config_t attendance_conf;
struct config_setting_t *attendance = NULL, *it = NULL;
- const char *config_filename = "db/attendance_db.conf"; // FIXME hardcoded name
+ char config_filename[256];
+ libconfig->format_db_path("attendance_db.conf", config_filename, sizeof(config_filename));
int i = 0;
if (!libconfig->load_file(&attendance_conf, config_filename))
diff --git a/src/map/guild.c b/src/map/guild.c
index 3b611bb05..dbfe03d3e 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -152,7 +152,8 @@ static bool guild_read_castledb_libconfig(void)
{
struct config_t castle_conf;
struct config_setting_t *castle_db = NULL, *it = NULL;
- const char *config_filename = "db/castle_db.conf"; // FIXME hardcoded name
+ char config_filename[256];
+ libconfig->format_db_path("castle_db.conf", config_filename, sizeof(config_filename));
int i = 0;
if (libconfig->load_file(&castle_conf, config_filename) == 0)
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index a97325e57..5dc3d9317 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -846,11 +846,8 @@ static void itemdb_read_groups(void)
{
struct config_t item_group_conf;
struct config_setting_t *itg = NULL, *it = NULL;
-#ifdef RENEWAL
- const char *config_filename = "db/re/item_group.conf"; // FIXME hardcoded name
-#else
- const char *config_filename = "db/pre-re/item_group.conf"; // FIXME hardcoded name
-#endif
+ char config_filename[256];
+ libconfig->format_db_path(DBPATH"item_group.conf", config_filename, sizeof(config_filename));
const char *itname;
int i = 0, count = 0, c;
unsigned int *gsize = NULL;
@@ -1144,11 +1141,8 @@ static void itemdb_read_packages(void)
{
struct config_t item_packages_conf;
struct config_setting_t *itg = NULL, *it = NULL, *t = NULL;
-#ifdef RENEWAL
- const char *config_filename = "db/re/item_packages.conf"; // FIXME hardcoded name
-#else
- const char *config_filename = "db/pre-re/item_packages.conf"; // FIXME hardcoded name
-#endif
+ char config_filename[256];
+ libconfig->format_db_path(DBPATH"item_packages.conf", config_filename, sizeof(config_filename));
const char *itname;
int i = 0, count = 0, c = 0, highest_gcount = 0;
unsigned int *must = NULL, *random = NULL, *rgroup = NULL, **rgroups = NULL;
@@ -1393,7 +1387,8 @@ static void itemdb_read_options(void)
struct config_t item_options_db;
struct config_setting_t *ito = NULL, *conf = NULL;
int index = 0, count = 0;
- const char *filepath = "db/item_options.conf";
+ char filepath[256];
+ libconfig->format_db_path("item_options.conf", filepath, sizeof(filepath));
VECTOR_DECL(int) duplicate_id;
if (!libconfig->load_file(&item_options_db, filepath))
@@ -1494,11 +1489,8 @@ static void itemdb_read_chains(void)
{
struct config_t item_chain_conf;
struct config_setting_t *itc = NULL;
-#ifdef RENEWAL
- const char *config_filename = "db/re/item_chain.conf"; // FIXME hardcoded name
-#else
- const char *config_filename = "db/pre-re/item_chain.conf"; // FIXME hardcoded name
-#endif
+ char config_filename[256];
+ libconfig->format_db_path(DBPATH"item_chain.conf", config_filename, sizeof(config_filename));
int i = 0, count = 0;
if (!libconfig->load_file(&item_chain_conf, config_filename))
diff --git a/src/map/map.c b/src/map/map.c
index 957098dd4..50ad9a5cd 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -4054,6 +4054,7 @@ static bool map_config_read_database(const char *filename, struct config_t *conf
return false;
}
libconfig->setting_lookup_mutable_string(setting, "db_path", map->db_path, sizeof(map->db_path));
+ libconfig->set_db_path(map->db_path);
libconfig->setting_lookup_int(setting, "save_settings", &map->save_settings);
if (libconfig->setting_lookup_int(setting, "autosave_time", &map->autosave_interval) == CONFIG_TRUE) {
@@ -5573,12 +5574,8 @@ static void read_map_zone_db(void)
{
struct config_t map_zone_db;
struct config_setting_t *zones = NULL;
- /* TODO: #ifndef required for re/pre-re */
-#ifdef RENEWAL
- const char *config_filename = "db/re/map_zone_db.conf"; // FIXME hardcoded name
-#else
- const char *config_filename = "db/pre-re/map_zone_db.conf"; // FIXME hardcoded name
-#endif
+ char config_filename[256];
+ libconfig->format_db_path(DBPATH"map_zone_db.conf", config_filename, sizeof(config_filename));
if (!libconfig->load_file(&map_zone_db, config_filename))
return;
@@ -6776,6 +6773,7 @@ void map_defaults(void)
map->extra_scripts_count = 0;
sprintf(map->db_path ,"db");
+ libconfig->set_db_path(map->db_path);
sprintf(map->help_txt ,"conf/help.txt");
sprintf(map->charhelp_txt ,"conf/charhelp.txt");
diff --git a/src/map/mob.c b/src/map/mob.c
index d2d8727e3..56d07da92 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -4105,10 +4105,8 @@ static bool mob_read_optdrops_group(struct config_setting_t *group, int n)
*/
static bool mob_read_optdrops_db(void)
{
- const char *filename = "option_drop_groups.conf"; // FIXME hardcoded name
-
char filepath[256];
- safesnprintf(filepath, sizeof(filepath), "%s/%s", map->db_path, filename);
+ libconfig->format_db_path("option_drop_groups.conf", filepath, sizeof(filepath));
struct config_t option_groups;
if (libconfig->load_file(&option_groups, filepath) == CONFIG_FALSE) {
diff --git a/src/map/pc.c b/src/map/pc.c
index 5eccfbaf6..a8ff661e8 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -11533,12 +11533,9 @@ static bool pc_read_exp_db(void)
struct config_t exp_db_conf;
struct config_setting_t *edb = NULL;
int entry_count = 0;
-
-#ifdef RENEWAL
- const char *config_filename = "db/re/exp_group_db.conf";
-#else
- const char *config_filename = "db/pre-re/exp_group_db.conf";
-#endif
+ char config_filename[256];
+
+ libconfig->format_db_path(DBPATH"exp_group_db.conf", config_filename, sizeof(config_filename));
if (!libconfig->load_file(&exp_db_conf, config_filename))
return false;
diff --git a/src/map/script.c b/src/map/script.c
index ab7513ede..bd0fbb611 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5150,7 +5150,8 @@ static uint8 script_add_language(const char *name)
static void script_load_translations(void)
{
struct config_t translations_conf;
- const char *config_filename = "db/translations.conf"; // FIXME hardcoded name
+ char config_filename[256];
+ libconfig->format_db_path("translations.conf", config_filename, sizeof(config_filename));
struct config_setting_t *translations = NULL;
int i, size;
int total = 0;
diff --git a/src/map/skill.c b/src/map/skill.c
index e44389d3c..7451fbf41 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -21109,7 +21109,7 @@ static bool skill_read_skilldb(const char *filename)
nullpo_retr(false, filename);
- sprintf(filepath,"db/%s",filename);
+ libconfig->format_db_path(filename, filepath, sizeof(filepath));
if (!libconfig->load_file(&skilldb, filepath)) {
return false; // Libconfig error report.
diff --git a/src/map/status.c b/src/map/status.c
index 96a02c023..d2c67b84e 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -13367,10 +13367,12 @@ static void status_read_job_db(void)
int i = 0;
struct config_t job_db_conf;
struct config_setting_t *jdb = NULL;
+ char config_filename[256];
+
#ifdef RENEWAL_ASPD
- const char *config_filename = "db/re/job_db.conf";
+ libconfig->format_db_path(DBPATH_RE"job_db.conf", config_filename, sizeof(config_filename));
#else
- const char *config_filename = "db/pre-re/job_db.conf";
+ libconfig->format_db_path(DBPATH_PRE"job_db.conf", config_filename, sizeof(config_filename));
#endif
if (!libconfig->load_file(&job_db_conf, config_filename))
diff --git a/src/map/stylist.c b/src/map/stylist.c
index 7e7c13bf7..438302214 100644
--- a/src/map/stylist.c
+++ b/src/map/stylist.c
@@ -40,7 +40,8 @@ static bool stylist_read_db_libconfig(void)
{
struct config_t stylist_conf;
struct config_setting_t *stylist_db = NULL, *it = NULL;
- const char *config_filename = "db/stylist_db.conf"; // FIXME hardcoded name
+ char config_filename[256];
+ libconfig->format_db_path("stylist_db.conf", config_filename, sizeof(config_filename));
int i = 0;
if (!libconfig->load_file(&stylist_conf, config_filename))
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 31e0ca536..389d273e3 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -4180,6 +4180,10 @@ typedef enum parsefunc_rcode (*HPMHOOK_pre_PRIV__lclif_parse_CA_CHARSERVERCONNEC
typedef enum parsefunc_rcode (*HPMHOOK_post_PRIV__lclif_parse_CA_CHARSERVERCONNECT) (enum parsefunc_rcode retVal___, int fd, struct login_session_data *sd);
#endif // LOGIN_LCLIF_P_H
#ifdef COMMON_CONF_H /* libconfig */
+typedef void (*HPMHOOK_pre_libconfig_set_db_path) (const char **db_path);
+typedef void (*HPMHOOK_post_libconfig_set_db_path) (const char *db_path);
+typedef void (*HPMHOOK_pre_libconfig_format_db_path) (const char **filename, char **path_buf, int *buffer_len);
+typedef void (*HPMHOOK_post_libconfig_format_db_path) (const char *filename, char *path_buf, int buffer_len);
typedef int (*HPMHOOK_pre_libconfig_read) (struct config_t **config, FILE **stream);
typedef int (*HPMHOOK_post_libconfig_read) (int retVal___, struct config_t *config, FILE *stream);
typedef void (*HPMHOOK_pre_libconfig_write) (const struct config_t **config, FILE **stream);
@@ -5146,6 +5150,10 @@ typedef int (*HPMHOOK_pre_mapif_parse_ClanMemberCount) (int *fd, int *clan_id, i
typedef int (*HPMHOOK_post_mapif_parse_ClanMemberCount) (int retVal___, int fd, int clan_id, int kick_interval);
#endif // CHAR_MAPIF_H
#ifdef COMMON_MAPINDEX_H /* mapindex */
+typedef bool (*HPMHOOK_pre_mapindex_config_read_dbpath) (const char **filename, const struct config_t **config);
+typedef bool (*HPMHOOK_post_mapindex_config_read_dbpath) (bool retVal___, const char *filename, const struct config_t *config);
+typedef bool (*HPMHOOK_pre_mapindex_config_read) (void);
+typedef bool (*HPMHOOK_post_mapindex_config_read) (bool retVal___);
typedef int (*HPMHOOK_pre_mapindex_init) (void);
typedef int (*HPMHOOK_post_mapindex_init) (int retVal___);
typedef void (*HPMHOOK_pre_mapindex_final) (void);
diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
index a5f65654e..cdba77e09 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc
@@ -778,6 +778,10 @@ struct {
struct HPMHookPoint *HP_inter_storage_parse_frommap_post;
struct HPMHookPoint *HP_inter_storage_retrieve_bound_items_pre;
struct HPMHookPoint *HP_inter_storage_retrieve_bound_items_post;
+ struct HPMHookPoint *HP_libconfig_set_db_path_pre;
+ struct HPMHookPoint *HP_libconfig_set_db_path_post;
+ struct HPMHookPoint *HP_libconfig_format_db_path_pre;
+ struct HPMHookPoint *HP_libconfig_format_db_path_post;
struct HPMHookPoint *HP_libconfig_read_pre;
struct HPMHookPoint *HP_libconfig_read_post;
struct HPMHookPoint *HP_libconfig_write_pre;
@@ -1252,6 +1256,10 @@ struct {
struct HPMHookPoint *HP_mapif_parse_ClanMemberKick_post;
struct HPMHookPoint *HP_mapif_parse_ClanMemberCount_pre;
struct HPMHookPoint *HP_mapif_parse_ClanMemberCount_post;
+ struct HPMHookPoint *HP_mapindex_config_read_dbpath_pre;
+ struct HPMHookPoint *HP_mapindex_config_read_dbpath_post;
+ struct HPMHookPoint *HP_mapindex_config_read_pre;
+ struct HPMHookPoint *HP_mapindex_config_read_post;
struct HPMHookPoint *HP_mapindex_init_pre;
struct HPMHookPoint *HP_mapindex_init_post;
struct HPMHookPoint *HP_mapindex_final_pre;
@@ -2391,6 +2399,10 @@ struct {
int HP_inter_storage_parse_frommap_post;
int HP_inter_storage_retrieve_bound_items_pre;
int HP_inter_storage_retrieve_bound_items_post;
+ int HP_libconfig_set_db_path_pre;
+ int HP_libconfig_set_db_path_post;
+ int HP_libconfig_format_db_path_pre;
+ int HP_libconfig_format_db_path_post;
int HP_libconfig_read_pre;
int HP_libconfig_read_post;
int HP_libconfig_write_pre;
@@ -2865,6 +2877,10 @@ struct {
int HP_mapif_parse_ClanMemberKick_post;
int HP_mapif_parse_ClanMemberCount_pre;
int HP_mapif_parse_ClanMemberCount_post;
+ int HP_mapindex_config_read_dbpath_pre;
+ int HP_mapindex_config_read_dbpath_post;
+ int HP_mapindex_config_read_pre;
+ int HP_mapindex_config_read_post;
int HP_mapindex_init_pre;
int HP_mapindex_init_post;
int HP_mapindex_final_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
index efd72b670..a6043756d 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc
@@ -425,6 +425,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(inter_storage->parse_frommap, HP_inter_storage_parse_frommap) },
{ HP_POP(inter_storage->retrieve_bound_items, HP_inter_storage_retrieve_bound_items) },
/* libconfig_interface */
+ { HP_POP(libconfig->set_db_path, HP_libconfig_set_db_path) },
+ { HP_POP(libconfig->format_db_path, HP_libconfig_format_db_path) },
{ HP_POP(libconfig->read, HP_libconfig_read) },
{ HP_POP(libconfig->write, HP_libconfig_write) },
{ HP_POP(libconfig->set_options, HP_libconfig_set_options) },
@@ -665,6 +667,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(mapif->parse_ClanMemberKick, HP_mapif_parse_ClanMemberKick) },
{ HP_POP(mapif->parse_ClanMemberCount, HP_mapif_parse_ClanMemberCount) },
/* mapindex_interface */
+ { HP_POP(mapindex->config_read_dbpath, HP_mapindex_config_read_dbpath) },
+ { HP_POP(mapindex->config_read, HP_mapindex_config_read) },
{ HP_POP(mapindex->init, HP_mapindex_init) },
{ HP_POP(mapindex->final, HP_mapindex_final) },
{ HP_POP(mapindex->addmap, HP_mapindex_addmap) },
diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
index 7ce54d288..b25025b1d 100644
--- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc
@@ -10116,6 +10116,58 @@ bool HP_inter_storage_retrieve_bound_items(int char_id, int account_id, int guil
return retVal___;
}
/* libconfig_interface */
+void HP_libconfig_set_db_path(const char *db_path) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_libconfig_set_db_path_pre > 0) {
+ void (*preHookFunc) (const char **db_path);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_set_db_path_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_libconfig_set_db_path_pre[hIndex].func;
+ preHookFunc(&db_path);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.libconfig.set_db_path(db_path);
+ }
+ if (HPMHooks.count.HP_libconfig_set_db_path_post > 0) {
+ void (*postHookFunc) (const char *db_path);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_set_db_path_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_libconfig_set_db_path_post[hIndex].func;
+ postHookFunc(db_path);
+ }
+ }
+ return;
+}
+void HP_libconfig_format_db_path(const char *filename, char *path_buf, int buffer_len) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_libconfig_format_db_path_pre > 0) {
+ void (*preHookFunc) (const char **filename, char **path_buf, int *buffer_len);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_format_db_path_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_libconfig_format_db_path_pre[hIndex].func;
+ preHookFunc(&filename, &path_buf, &buffer_len);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.libconfig.format_db_path(filename, path_buf, buffer_len);
+ }
+ if (HPMHooks.count.HP_libconfig_format_db_path_post > 0) {
+ void (*postHookFunc) (const char *filename, char *path_buf, int buffer_len);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_format_db_path_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_libconfig_format_db_path_post[hIndex].func;
+ postHookFunc(filename, path_buf, buffer_len);
+ }
+ }
+ return;
+}
int HP_libconfig_read(struct config_t *config, FILE *stream) {
int hIndex = 0;
int retVal___ = 0;
@@ -16415,6 +16467,60 @@ int HP_mapif_parse_ClanMemberCount(int fd, int clan_id, int kick_interval) {
return retVal___;
}
/* mapindex_interface */
+bool HP_mapindex_config_read_dbpath(const char *filename, const struct config_t *config) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_mapindex_config_read_dbpath_pre > 0) {
+ bool (*preHookFunc) (const char **filename, const struct config_t **config);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_dbpath_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_mapindex_config_read_dbpath_pre[hIndex].func;
+ retVal___ = preHookFunc(&filename, &config);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.mapindex.config_read_dbpath(filename, config);
+ }
+ if (HPMHooks.count.HP_mapindex_config_read_dbpath_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const char *filename, const struct config_t *config);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_dbpath_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_mapindex_config_read_dbpath_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, filename, config);
+ }
+ }
+ return retVal___;
+}
+bool HP_mapindex_config_read(void) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_mapindex_config_read_pre > 0) {
+ bool (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_mapindex_config_read_pre[hIndex].func;
+ retVal___ = preHookFunc();
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.mapindex.config_read();
+ }
+ if (HPMHooks.count.HP_mapindex_config_read_post > 0) {
+ bool (*postHookFunc) (bool retVal___);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_mapindex_config_read_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___);
+ }
+ }
+ return retVal___;
+}
int HP_mapindex_init(void) {
int hIndex = 0;
int retVal___ = 0;
diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc
index ba0fe05c2..556757d76 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc
@@ -212,6 +212,10 @@ struct {
struct HPMHookPoint *HP_PRIV__lclif_parse_CA_REQ_HASH_post;
struct HPMHookPoint *HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT_pre;
struct HPMHookPoint *HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT_post;
+ struct HPMHookPoint *HP_libconfig_set_db_path_pre;
+ struct HPMHookPoint *HP_libconfig_set_db_path_post;
+ struct HPMHookPoint *HP_libconfig_format_db_path_pre;
+ struct HPMHookPoint *HP_libconfig_format_db_path_post;
struct HPMHookPoint *HP_libconfig_read_pre;
struct HPMHookPoint *HP_libconfig_read_post;
struct HPMHookPoint *HP_libconfig_write_pre;
@@ -1013,6 +1017,10 @@ struct {
int HP_PRIV__lclif_parse_CA_REQ_HASH_post;
int HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT_pre;
int HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT_post;
+ int HP_libconfig_set_db_path_pre;
+ int HP_libconfig_set_db_path_post;
+ int HP_libconfig_format_db_path_pre;
+ int HP_libconfig_format_db_path_post;
int HP_libconfig_read_pre;
int HP_libconfig_read_post;
int HP_libconfig_write_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc
index 1e3548621..65680e072 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc
@@ -131,6 +131,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(lclif->p->parse_CA_REQ_HASH, HP_PRIV__lclif_parse_CA_REQ_HASH) },
{ HP_POP(lclif->p->parse_CA_CHARSERVERCONNECT, HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT) },
/* libconfig_interface */
+ { HP_POP(libconfig->set_db_path, HP_libconfig_set_db_path) },
+ { HP_POP(libconfig->format_db_path, HP_libconfig_format_db_path) },
{ HP_POP(libconfig->read, HP_libconfig_read) },
{ HP_POP(libconfig->write, HP_libconfig_write) },
{ HP_POP(libconfig->set_options, HP_libconfig_set_options) },
diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc
index 080fb75ff..8f6076e2a 100644
--- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc
@@ -2518,6 +2518,58 @@ enum parsefunc_rcode HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT(int fd, struct lo
return retVal___;
}
/* libconfig_interface */
+void HP_libconfig_set_db_path(const char *db_path) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_libconfig_set_db_path_pre > 0) {
+ void (*preHookFunc) (const char **db_path);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_set_db_path_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_libconfig_set_db_path_pre[hIndex].func;
+ preHookFunc(&db_path);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.libconfig.set_db_path(db_path);
+ }
+ if (HPMHooks.count.HP_libconfig_set_db_path_post > 0) {
+ void (*postHookFunc) (const char *db_path);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_set_db_path_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_libconfig_set_db_path_post[hIndex].func;
+ postHookFunc(db_path);
+ }
+ }
+ return;
+}
+void HP_libconfig_format_db_path(const char *filename, char *path_buf, int buffer_len) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_libconfig_format_db_path_pre > 0) {
+ void (*preHookFunc) (const char **filename, char **path_buf, int *buffer_len);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_format_db_path_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_libconfig_format_db_path_pre[hIndex].func;
+ preHookFunc(&filename, &path_buf, &buffer_len);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.libconfig.format_db_path(filename, path_buf, buffer_len);
+ }
+ if (HPMHooks.count.HP_libconfig_format_db_path_post > 0) {
+ void (*postHookFunc) (const char *filename, char *path_buf, int buffer_len);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_format_db_path_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_libconfig_format_db_path_post[hIndex].func;
+ postHookFunc(filename, path_buf, buffer_len);
+ }
+ }
+ return;
+}
int HP_libconfig_read(struct config_t *config, FILE *stream) {
int hIndex = 0;
int retVal___ = 0;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index 42ab189f1..1196e3a99 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -3288,6 +3288,10 @@ struct {
struct HPMHookPoint *HP_itemdb_read_libconfig_lapineddukddak_sub_post;
struct HPMHookPoint *HP_itemdb_read_libconfig_lapineddukddak_sub_sources_pre;
struct HPMHookPoint *HP_itemdb_read_libconfig_lapineddukddak_sub_sources_post;
+ struct HPMHookPoint *HP_libconfig_set_db_path_pre;
+ struct HPMHookPoint *HP_libconfig_set_db_path_post;
+ struct HPMHookPoint *HP_libconfig_format_db_path_pre;
+ struct HPMHookPoint *HP_libconfig_format_db_path_post;
struct HPMHookPoint *HP_libconfig_read_pre;
struct HPMHookPoint *HP_libconfig_read_post;
struct HPMHookPoint *HP_libconfig_write_pre;
@@ -3758,6 +3762,10 @@ struct {
struct HPMHookPoint *HP_map_merge_zone_post;
struct HPMHookPoint *HP_map_zone_clear_single_pre;
struct HPMHookPoint *HP_map_zone_clear_single_post;
+ struct HPMHookPoint *HP_mapindex_config_read_dbpath_pre;
+ struct HPMHookPoint *HP_mapindex_config_read_dbpath_post;
+ struct HPMHookPoint *HP_mapindex_config_read_pre;
+ struct HPMHookPoint *HP_mapindex_config_read_post;
struct HPMHookPoint *HP_mapindex_init_pre;
struct HPMHookPoint *HP_mapindex_init_post;
struct HPMHookPoint *HP_mapindex_final_pre;
@@ -10109,6 +10117,10 @@ struct {
int HP_itemdb_read_libconfig_lapineddukddak_sub_post;
int HP_itemdb_read_libconfig_lapineddukddak_sub_sources_pre;
int HP_itemdb_read_libconfig_lapineddukddak_sub_sources_post;
+ int HP_libconfig_set_db_path_pre;
+ int HP_libconfig_set_db_path_post;
+ int HP_libconfig_format_db_path_pre;
+ int HP_libconfig_format_db_path_post;
int HP_libconfig_read_pre;
int HP_libconfig_read_post;
int HP_libconfig_write_pre;
@@ -10579,6 +10591,10 @@ struct {
int HP_map_merge_zone_post;
int HP_map_zone_clear_single_pre;
int HP_map_zone_clear_single_post;
+ int HP_mapindex_config_read_dbpath_pre;
+ int HP_mapindex_config_read_dbpath_post;
+ int HP_mapindex_config_read_pre;
+ int HP_mapindex_config_read_post;
int HP_mapindex_init_pre;
int HP_mapindex_init_post;
int HP_mapindex_final_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index e6dcdec42..da72b688a 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -1684,6 +1684,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(itemdb->read_libconfig_lapineddukddak_sub, HP_itemdb_read_libconfig_lapineddukddak_sub) },
{ HP_POP(itemdb->read_libconfig_lapineddukddak_sub_sources, HP_itemdb_read_libconfig_lapineddukddak_sub_sources) },
/* libconfig_interface */
+ { HP_POP(libconfig->set_db_path, HP_libconfig_set_db_path) },
+ { HP_POP(libconfig->format_db_path, HP_libconfig_format_db_path) },
{ HP_POP(libconfig->read, HP_libconfig_read) },
{ HP_POP(libconfig->write, HP_libconfig_write) },
{ HP_POP(libconfig->set_options, HP_libconfig_set_options) },
@@ -1923,6 +1925,8 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(map->merge_zone, HP_map_merge_zone) },
{ HP_POP(map->zone_clear_single, HP_map_zone_clear_single) },
/* mapindex_interface */
+ { HP_POP(mapindex->config_read_dbpath, HP_mapindex_config_read_dbpath) },
+ { HP_POP(mapindex->config_read, HP_mapindex_config_read) },
{ HP_POP(mapindex->init, HP_mapindex_init) },
{ HP_POP(mapindex->final, HP_mapindex_final) },
{ HP_POP(mapindex->addmap, HP_mapindex_addmap) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index 8eefa292a..c331d66a9 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -43260,6 +43260,58 @@ bool HP_itemdb_read_libconfig_lapineddukddak_sub_sources(struct config_setting_t
return retVal___;
}
/* libconfig_interface */
+void HP_libconfig_set_db_path(const char *db_path) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_libconfig_set_db_path_pre > 0) {
+ void (*preHookFunc) (const char **db_path);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_set_db_path_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_libconfig_set_db_path_pre[hIndex].func;
+ preHookFunc(&db_path);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.libconfig.set_db_path(db_path);
+ }
+ if (HPMHooks.count.HP_libconfig_set_db_path_post > 0) {
+ void (*postHookFunc) (const char *db_path);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_set_db_path_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_libconfig_set_db_path_post[hIndex].func;
+ postHookFunc(db_path);
+ }
+ }
+ return;
+}
+void HP_libconfig_format_db_path(const char *filename, char *path_buf, int buffer_len) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_libconfig_format_db_path_pre > 0) {
+ void (*preHookFunc) (const char **filename, char **path_buf, int *buffer_len);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_format_db_path_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_libconfig_format_db_path_pre[hIndex].func;
+ preHookFunc(&filename, &path_buf, &buffer_len);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.libconfig.format_db_path(filename, path_buf, buffer_len);
+ }
+ if (HPMHooks.count.HP_libconfig_format_db_path_post > 0) {
+ void (*postHookFunc) (const char *filename, char *path_buf, int buffer_len);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_libconfig_format_db_path_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_libconfig_format_db_path_post[hIndex].func;
+ postHookFunc(filename, path_buf, buffer_len);
+ }
+ }
+ return;
+}
int HP_libconfig_read(struct config_t *config, FILE *stream) {
int hIndex = 0;
int retVal___ = 0;
@@ -49689,6 +49741,60 @@ void HP_map_zone_clear_single(struct map_zone_data *zone) {
return;
}
/* mapindex_interface */
+bool HP_mapindex_config_read_dbpath(const char *filename, const struct config_t *config) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_mapindex_config_read_dbpath_pre > 0) {
+ bool (*preHookFunc) (const char **filename, const struct config_t **config);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_dbpath_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_mapindex_config_read_dbpath_pre[hIndex].func;
+ retVal___ = preHookFunc(&filename, &config);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.mapindex.config_read_dbpath(filename, config);
+ }
+ if (HPMHooks.count.HP_mapindex_config_read_dbpath_post > 0) {
+ bool (*postHookFunc) (bool retVal___, const char *filename, const struct config_t *config);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_dbpath_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_mapindex_config_read_dbpath_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___, filename, config);
+ }
+ }
+ return retVal___;
+}
+bool HP_mapindex_config_read(void) {
+ int hIndex = 0;
+ bool retVal___ = false;
+ if (HPMHooks.count.HP_mapindex_config_read_pre > 0) {
+ bool (*preHookFunc) (void);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_mapindex_config_read_pre[hIndex].func;
+ retVal___ = preHookFunc();
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return retVal___;
+ }
+ }
+ {
+ retVal___ = HPMHooks.source.mapindex.config_read();
+ }
+ if (HPMHooks.count.HP_mapindex_config_read_post > 0) {
+ bool (*postHookFunc) (bool retVal___);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_mapindex_config_read_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_mapindex_config_read_post[hIndex].func;
+ retVal___ = postHookFunc(retVal___);
+ }
+ }
+ return retVal___;
+}
int HP_mapindex_init(void) {
int hIndex = 0;
int retVal___ = 0;