Compare commits

...

2 Commits

4 changed files with 54 additions and 8 deletions

View File

@ -152,8 +152,10 @@
<custom_category_title __type="str">Customs</custom_category_title>
<!-- Format used for category title (in BM2DXFontScript format, refer to popnhax_tools documentation) -->
<custom_category_format __type="str">[ol:4][olc:d92f0d]%s</custom_category_format>
<!-- Format used for custom song titles on song select (Note: colors not working for kaimei and unilab, but rotation does, e.g.: * [rz:3]%s[/rz] ) -->
<!-- Format used for custom song titles on song select (Note: colors not working for kaimei and above, but rotation does, e.g. "* [rz:3]%s[/rz]" ) -->
<custom_track_title_format __type="str"></custom_track_title_format>
<!-- Optional secondary format used for older games only (Full colors supported, e.g. "[ol:4][olc:d92f0d]%s") -->
<custom_track_title_format2 __type="str"></custom_track_title_format2>
<!-- Translation -->
<!-- Disable .dict string replacements and .ips patches -->

View File

@ -63,6 +63,7 @@ struct popnhax_config {
char custom_category_title[16];
char custom_category_format[64];
char custom_track_title_format[64];
char custom_track_title_format2[64];
};
#endif

View File

@ -695,7 +695,7 @@ static bool patch_favorite_categ(const char *game_dll_fn) {
//hook result screen to replace 3 functions
{
int64_t first_loc = search(data, dllSize, "\xBF\x07\x00\x00\x00\xC6\x85\x61\xD3", 9, 0);
int64_t first_loc = search(data, dllSize, "\x10\xBF\x07\x00\x00\x00\xC6\x85", 8, 0);
if (first_loc == -1) {
LOG("popnhax: local_favorites: cannot find result screen function\n");
return false;
@ -1046,11 +1046,13 @@ bool patch_custom_categs(const char *dllFilename, struct popnhax_config *config)
print_databases();
}
if ( config->custom_track_title_format[0] != '\0' )
{
if ( config->game_version < 26 && config->custom_track_title_format2[0] != '\0' )
g_customformat = config->custom_track_title_format2;
else if ( config->custom_track_title_format[0] != '\0' )
g_customformat = config->custom_track_title_format;
if ( g_customformat != NULL )
patch_custom_track_format(dllFilename);
}
if (config->custom_exclude_from_version)
LOG("popnhax: Customs excluded from version folders\n"); //musichax_core_init took care of it

View File

@ -32,7 +32,7 @@
#include "SearchFile.h"
#define PROGRAM_VERSION "1.11.beta2"
#define PROGRAM_VERSION "1.11"
const char *g_game_dll_fn = NULL;
const char *g_config_fn = NULL;
@ -201,6 +201,8 @@ PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_STR, struct popnhax_config, custom_category
"/popnhax/custom_category_format")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_STR, struct popnhax_config, custom_track_title_format,
"/popnhax/custom_track_title_format")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_STR, struct popnhax_config, custom_track_title_format2,
"/popnhax/custom_track_title_format2")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, local_favorites,
"/popnhax/local_favorites")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, ignore_music_limit,
@ -1411,6 +1413,43 @@ static bool patch_purelong()
return true;
}
void (*real_normal0)();
void hook_normal0()
{
// getChartDifficulty returns 0xFFFFFFFF when there's no chart,
// but the game assumes there's always a normal chart so there's no check in this case
// and it returns 0... let's fix this
__asm("cmp ebx, 1\n"); //chart id
__asm("jne process_normal0\n");
__asm("cmp eax, 0\n"); //difficulty
__asm("jne process_normal0\n");
__asm("or eax, 0xFFFFFFFF\n");
__asm("process_normal0:\n");
real_normal0();
}
static bool patch_normal0()
{
DWORD dllSize = 0;
char *data = getDllData(g_game_dll_fn, &dllSize);
{
int64_t pattern_offset = search(data, dllSize, "\x83\xC4\x08\x8B\xF8\x89\x7C\x24\x3C", 9, 0);
if (pattern_offset == -1) {
LOG("popnhax: Couldn't find song list display function\n");
return false;
}
uint64_t patch_addr = (int64_t)data + pattern_offset;
MH_CreateHook((LPVOID)patch_addr, (LPVOID)hook_normal0,
(void **)&real_normal0);
}
return true;
}
static bool get_music_limit(uint32_t* limit) {
// avoid doing the search multiple times
static uint32_t music_limit = 0;
@ -1676,6 +1715,8 @@ static bool patch_database() {
patch_purelong();
patch_normal0();
{
int64_t pattern_offset = search(data, dllSize, "\x8D\x44\x24\x10\x88\x4C\x24\x10\x88\x5C\x24\x11\x8D\x50\x01", 15, 0);
if (pattern_offset != -1) {
@ -5500,7 +5541,7 @@ static bool get_music_limit_from_file(const char *filepath, uint32_t *limit){
}
char *data = (char *)lpBasePtr;
uint32_t delta = 0;
int32_t delta = 0;
//first retrieve .rdata virtual and raw addresses to compute delta
{