forked from Popn_Tools/popnhax
remove max_song_id, add partial_entries and exclude_omni
This commit is contained in:
parent
71fce91c91
commit
5af9073318
14
dist/popnhax/popnhax.xml
vendored
14
dist/popnhax/popnhax.xml
vendored
@ -131,7 +131,7 @@
|
||||
THREAD_PRIORITY_TIME_CRITICAL 15 -->
|
||||
<enhanced_polling_priority __type="s8">1</enhanced_polling_priority>
|
||||
|
||||
<!-- Song db patches -->
|
||||
<!-- Song db patches (requires patch_db) -->
|
||||
<!-- Auto select patch file from data_mods folder based on music limit, or datecode otherwise (will detect datecode from ea3-config or force_datecode option) -->
|
||||
<patch_xml_auto __type="bool">1</patch_xml_auto>
|
||||
<!-- Manually set XML file containing patches (requires patch_xml_auto to be disabled) -->
|
||||
@ -143,11 +143,13 @@
|
||||
<!-- Do not perform music limit checks for patch_xml_auto (not recommended) -->
|
||||
<ignore_music_limit __type="bool">0</ignore_music_limit>
|
||||
|
||||
<!-- Custom category options -->
|
||||
<!-- minimum songid for a song to be seen as "custom" -->
|
||||
<custom_categ_min_songid __type="u16">4000</custom_categ_min_songid>
|
||||
<!-- maximum songid for a song to be seen as "custom" (0 = no limit, not recommended since "random" category will use fake song ids in the 65400+ range) -->
|
||||
<custom_categ_max_songid __type="u16">65400</custom_categ_max_songid>
|
||||
<!-- Custom category options (requires patch_db) -->
|
||||
<!-- Also exclude omnimix (song id < 3000) tracks from version/level (requires custom_exclude_from_level or custom_exclude_from_version) -->
|
||||
<exclude_omni __type="bool">0</exclude_omni>
|
||||
<!-- New chart added to existing song moves the song to custom folder -->
|
||||
<partial_entries __type="bool">0</partial_entries>
|
||||
<!-- Minimum songid for a song to be seen as "custom" (e.g. use 4000 for real customs only) -->
|
||||
<custom_categ_min_songid __type="u16">0</custom_categ_min_songid>
|
||||
<!-- Category title for customs -->
|
||||
<custom_category_title __type="str">Customs</custom_category_title>
|
||||
<!-- Format used for category title (in BM2DXFontScript format, refer to BM2DXFontScript.md in popnhax_tools repo) -->
|
||||
|
@ -17,7 +17,6 @@ struct popnhax_config {
|
||||
bool score_challenge;
|
||||
uint8_t custom_categ;
|
||||
uint16_t custom_categ_min_songid;
|
||||
uint16_t custom_categ_max_songid;
|
||||
bool custom_exclude_from_version;
|
||||
bool custom_exclude_from_level;
|
||||
bool force_hd_timing;
|
||||
@ -64,6 +63,8 @@ struct popnhax_config {
|
||||
char custom_category_format[64];
|
||||
char custom_track_title_format[64];
|
||||
char custom_track_title_format2[64];
|
||||
bool exclude_omni;
|
||||
bool partial_entries;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -36,12 +36,11 @@ char *g_current_friendid;
|
||||
uint32_t g_current_songid;
|
||||
|
||||
bst_t *g_customs_bst = NULL;
|
||||
bool g_exclude_omni = false;
|
||||
|
||||
void (*add_song_in_list)();
|
||||
|
||||
bool g_subcategmode = false;
|
||||
uint32_t g_min_id = 4000;
|
||||
uint32_t g_max_id = 0;
|
||||
|
||||
const char *g_categicon;
|
||||
const char *g_categformat;
|
||||
@ -62,8 +61,12 @@ uint32_t favorites_struct_addr = (uint32_t)&favorites_struct;
|
||||
|
||||
bool is_a_custom(uint32_t songid)
|
||||
{
|
||||
return (bst_search(g_customs_bst, songid) != NULL);
|
||||
// return (songid >= g_min_id && (g_max_id==0 || g_max_id >= songid));
|
||||
return (bst_search(g_customs_bst, songid) != NULL);
|
||||
}
|
||||
|
||||
bool is_excluded_from_level(uint32_t songid)
|
||||
{
|
||||
return ( is_a_custom(songid) && ( g_exclude_omni || songid >= 3000 ) );
|
||||
}
|
||||
|
||||
void add_song_to_favorites()
|
||||
@ -769,7 +772,7 @@ static bool patch_favorite_categ(const char *game_dll_fn) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool patch_custom_categ(const char *game_dll_fn) {
|
||||
static bool patch_custom_categ(const char *game_dll_fn, uint16_t min_id) {
|
||||
|
||||
DWORD dllSize = 0;
|
||||
char *data = getDllData(game_dll_fn, &dllSize);
|
||||
@ -914,22 +917,21 @@ static bool patch_custom_categ(const char *game_dll_fn) {
|
||||
|
||||
char formatted_title[128];
|
||||
sprintf(formatted_title, g_categformat, g_categname);
|
||||
LOG("popnhax: custom %s \"%s\" injected (for songids ", g_subcategmode? "subcategories":"category", formatted_title);
|
||||
if (g_max_id)
|
||||
LOG("between %d and %d (incl.))\n", g_min_id, g_max_id);
|
||||
else
|
||||
LOG("%d and up)\n", g_min_id);
|
||||
LOG("popnhax: custom %s \"%s\" injected", g_subcategmode? "subcategories":"category", formatted_title);
|
||||
if (min_id)
|
||||
LOG(" (for songids >= %d)", min_id);
|
||||
LOG("\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void init_subcategories() {
|
||||
g_subcategmode = true;
|
||||
g_subcateg_count = 0;
|
||||
subcategories = (subcategory_s*)realloc(subcategories, sizeof(subcategory_s)*(1));
|
||||
subcategories[0].name = strdup("ALL SONGS");
|
||||
subcategories[0].songlist = NULL;
|
||||
subcategories[0].size = 0;
|
||||
g_subcategmode = true;
|
||||
g_subcateg_count = 0;
|
||||
subcategories = (subcategory_s*)realloc(subcategories, sizeof(subcategory_s)*(1));
|
||||
subcategories[0].name = strdup("ALL SONGS");
|
||||
subcategories[0].songlist = NULL;
|
||||
subcategories[0].size = 0;
|
||||
}
|
||||
|
||||
static void print_databases() {
|
||||
@ -951,7 +953,7 @@ void hook_after_getlevel()
|
||||
__asm("push ecx\n");
|
||||
__asm("push edx\n");
|
||||
__asm("push ebx\n");
|
||||
__asm("call %P0" : : "i"(is_a_custom));
|
||||
__asm("call %P0" : : "i"(is_excluded_from_level));
|
||||
__asm("test eax, eax\n");
|
||||
__asm("pop ebx\n");
|
||||
__asm("pop edx\n");
|
||||
@ -992,8 +994,6 @@ bool patch_exclude(const char *game_dll_fn)
|
||||
|
||||
bool patch_custom_categs(const char *dllFilename, struct popnhax_config *config)
|
||||
{
|
||||
g_min_id = config->custom_categ_min_songid;
|
||||
//g_max_id = config->custom_categ_max_songid; //handled during injection already
|
||||
uint8_t mode = config->custom_categ;
|
||||
|
||||
char icon_path[64];
|
||||
@ -1022,7 +1022,7 @@ bool patch_custom_categs(const char *dllFilename, struct popnhax_config *config)
|
||||
else
|
||||
g_categformat = "%s";
|
||||
|
||||
if (!patch_custom_categ(dllFilename))
|
||||
if (!patch_custom_categ(dllFilename, config->custom_categ_min_songid))
|
||||
return false;
|
||||
|
||||
if (mode == 2)
|
||||
@ -1040,8 +1040,12 @@ bool patch_custom_categs(const char *dllFilename, struct popnhax_config *config)
|
||||
|
||||
if (config->custom_exclude_from_version)
|
||||
LOG("popnhax: Customs excluded from version folders\n"); //musichax_core_init took care of it
|
||||
|
||||
if (config->custom_exclude_from_level)
|
||||
{
|
||||
g_exclude_omni = config->exclude_omni;
|
||||
patch_exclude(dllFilename);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -187,10 +187,12 @@ PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_S8, struct popnhax_config, base_offset,
|
||||
"/popnhax/base_offset")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_U8, struct popnhax_config, custom_categ,
|
||||
"/popnhax/custom_categ")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, exclude_omni,
|
||||
"/popnhax/exclude_omni")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, partial_entries,
|
||||
"/popnhax/partial_entries")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_U16, struct popnhax_config, custom_categ_min_songid,
|
||||
"/popnhax/custom_categ_min_songid")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_U16, struct popnhax_config, custom_categ_max_songid,
|
||||
"/popnhax/custom_categ_max_songid")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, custom_exclude_from_version,
|
||||
"/popnhax/custom_exclude_from_version")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, custom_exclude_from_level,
|
||||
|
@ -888,19 +888,12 @@ void parse_musicdb(const char *input_filename, const char *target, struct popnha
|
||||
bool is_gone = ( m != NULL && strcmp((const char*) m->title_ptr, "\x81\x5D") == 0); // removed entries all have this title (SJIS "-")
|
||||
|
||||
// Update customs/omni songid list
|
||||
if ( is_fresh || is_gone )
|
||||
if ( is_fresh || is_gone || config->partial_entries )
|
||||
{
|
||||
//TODO: remove g_max_id entirely
|
||||
if (idx > g_max_id)
|
||||
{
|
||||
g_max_id = idx;
|
||||
}
|
||||
|
||||
if ( bst_search(g_customs_bst, idx) == NULL )
|
||||
if ( idx >= config->custom_categ_min_songid && bst_search(g_customs_bst, idx) == NULL )
|
||||
{
|
||||
g_customs_bst = bst_insert(g_customs_bst, idx);
|
||||
//LOG("%d inserted into customs bst\n", idx);
|
||||
//TODO: (beware: maybe we should still consider !is_gone charts as custom?)
|
||||
if (config->custom_categ == 2)
|
||||
{
|
||||
add_song_to_subcateg(idx, subcateg);
|
||||
@ -967,8 +960,8 @@ 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) )
|
||||
&& idx >= config->custom_categ_min_songid
|
||||
&& ( is_fresh || config->exclude_omni ) )
|
||||
{
|
||||
m->cs_version = 0;
|
||||
m->folder = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user