diff --git a/popnhax/custom_categs.cc b/popnhax/custom_categs.cc index 8ba5dcb..215130b 100644 --- a/popnhax/custom_categs.cc +++ b/popnhax/custom_categs.cc @@ -275,7 +275,7 @@ static void add_song_to_subcateg(uint32_t songid, subcategory_s* subcateg) } } -static subcategory_s* get_subcateg(char *title) +static subcategory_s* get_subcateg(const char *title) { for (uint32_t i = 0; i < g_subcateg_count; i++) { @@ -908,6 +908,12 @@ static char *get_folder_name(const char* path) { return categ_name; } + +bool is_excluded_folder(const char *input_filename) +{ + return (input_filename[strlen("data_mods/")] == '_'); +} + static void parse_musicdb(const char *input_filename) { char *title = get_folder_name(input_filename); @@ -933,6 +939,7 @@ static void parse_musicdb(const char *input_filename) { add_song_to_subcateg(songid, subcateg); } } + free(title); } static void load_databases() { @@ -948,8 +955,10 @@ static void load_databases() { for(uint16_t i=0;icustom_categ_min_songid; - g_max_id = config->custom_categ_max_songid; + //g_max_id = config->custom_categ_max_songid; //handled during injection already uint8_t mode = config->custom_categ; char icon_path[64]; diff --git a/popnhax/custom_categs.h b/popnhax/custom_categs.h index a6ee143..cd10951 100644 --- a/popnhax/custom_categs.h +++ b/popnhax/custom_categs.h @@ -4,6 +4,9 @@ #include #include "popnhax/config.h" +extern uint32_t g_max_id; + +bool is_excluded_folder(const char *input_filename); bool patch_custom_categs(const char *dllFilename, struct popnhax_config *config); bool patch_local_favorites(const char *dllFilename, uint8_t version); diff --git a/popnhax/loader.cc b/popnhax/loader.cc index 66f3f61..0d3ba3f 100644 --- a/popnhax/loader.cc +++ b/popnhax/loader.cc @@ -7,6 +7,7 @@ #include "util/patch.h" #include "util/log.h" #include "xmlhelper.h" +#include "custom_categs.h" #include "tableinfo.h" #include "loader.h" @@ -855,6 +856,10 @@ void parse_musicdb(const char *input_filename, const char *target, struct popnha sizeof(idxStr)); uint32_t idx = atoi(idxStr); +if (idx > g_max_id) +{ + g_max_id = idx; +} // Get an existing music entry in memory // If it exists, return the existing entry // If it doesn't exist, create a new entry in memory @@ -921,6 +926,7 @@ void parse_musicdb(const char *input_filename, const char *target, struct popnha if ( config->custom_categ && config->custom_exclude_from_version + && !is_excluded_folder(input_filename) && idx >= config->custom_categ_min_songid && (config->custom_categ_max_songid == 0 || idx <= config->custom_categ_max_songid) ) {