remove custom_is_new

This commit is contained in:
CrazyRedMachine 2024-04-27 23:13:03 +02:00
parent 94b7eb014d
commit 2dcc503eca

View File

@ -430,54 +430,6 @@ void hook_artist_printf()
real_artist_printf();
}
const char* g_newicon = "new";
const char* g_nonewicon = "non";
void (*real_song_checkifnew)();
void hook_song_checkifnew()
{
__asm("push eax\n");
__asm("push ebx\n");
__asm("mov ebx, _g_nonewicon\n");
__asm("mov dword ptr ss:[esp+0x50], ebx\n");
__asm("mov eax, [esp+0x48]\n");
__asm("cmp eax, _g_min_id\n");
__asm("jb put_nonewicon\n");
__asm("cmp dword ptr _g_max_id, 0\n");
__asm("je put_newicon\n");
__asm("cmp eax, _g_max_id\n");
__asm("ja put_nonewicon\n");
__asm("put_newicon:\n");
__asm("mov ebx, _g_newicon\n");
__asm("mov dword ptr ss:[esp+0x50], ebx\n");
__asm("put_nonewicon:\n");
__asm("pop ebx\n");
__asm("pop eax\n");
real_song_checkifnew();
}
static bool patch_custom_is_new(const char *game_dll_fn) {
DWORD dllSize = 0;
char *data = getDllData(game_dll_fn, &dllSize);
//hook format string for song/genre name
{
int64_t pattern_offset = search(data, dllSize, "\x8B\x50\x5C\x51\x8B\xCB\xFF\xD2\xC7\x44\x24\x48", 12, 0);
if (pattern_offset == -1) {
LOG("popnhax: custom_is_new: cannot find \"song is new\" check function\n");
return false;
}
uint64_t patch_addr = (int64_t)data + pattern_offset + 0x1C;
MH_CreateHook((LPVOID)patch_addr, (LPVOID)hook_song_checkifnew,
(void **)&real_song_checkifnew);
}
return true;
}
static bool patch_custom_highlight(const char *game_dll_fn) {
DWORD dllSize = 0;
char *data = getDllData(game_dll_fn, &dllSize);
@ -510,7 +462,7 @@ static bool patch_custom_highlight(const char *game_dll_fn) {
(void **)&real_artist_printf);
}
return true;
return true;
}
static bool patch_custom_categ(const char *game_dll_fn) {
@ -743,7 +695,6 @@ bool patch_custom_categs(const char *dllFilename, uint8_t mode, uint16_t min, ui
}
patch_custom_highlight(dllFilename);
patch_custom_is_new(dllFilename);
return patch_custom_categ(dllFilename);
}