Compare commits

...

2 Commits

View File

@ -2319,8 +2319,14 @@ static bool patch_quick_retire(bool pfree)
/* instant exit with numpad 9 on result screen */ /* instant exit with numpad 9 on result screen */
{ {
int64_t pattern_offset = search(data, dllSize, "\xF8\x53\x55\x56\x57\x8B\xE9\x8B\x75\x00\x8B\x85", 12, 0); int64_t first_loc = search(data, dllSize, "\xBF\x03\x00\x00\x00\x81\xC6", 7, 0);
if (first_loc == -1) {
LOG("popnhax: cannot retrieve result screen loop first loc\n");
return false;
}
int64_t pattern_offset = search(data, 0x50, "\x55\x8B\xEC\x83\xE4", 5, first_loc-0x50);
if (pattern_offset == -1) { if (pattern_offset == -1) {
LOG("popnhax: cannot retrieve result screen loop\n"); LOG("popnhax: cannot retrieve result screen loop\n");
return false; return false;
@ -2332,7 +2338,7 @@ static bool patch_quick_retire(bool pfree)
return false; return false;
} }
uint64_t patch_addr = (int64_t)data + pattern_offset - 0x05; uint64_t patch_addr = (int64_t)data + pattern_offset;
MH_CreateHook((LPVOID)patch_addr, (LPVOID)quickexit_result_loop, MH_CreateHook((LPVOID)patch_addr, (LPVOID)quickexit_result_loop,
(void **)&real_result_loop); (void **)&real_result_loop);
} }
@ -2342,8 +2348,12 @@ static bool patch_quick_retire(bool pfree)
int64_t pattern_offset = search(data, dllSize, "\x84\xC0\x75\x0F\x8B\x8D\x1C\x0A\x00\x00\xE8", 11, 0); int64_t pattern_offset = search(data, dllSize, "\x84\xC0\x75\x0F\x8B\x8D\x1C\x0A\x00\x00\xE8", 11, 0);
if (pattern_offset == -1) { if (pattern_offset == -1) {
LOG("popnhax: cannot retrieve result screen button check\n"); /* fallback */
return false; pattern_offset = search(data, dllSize, "\x84\xC0\x75\x0F\x8B\x8D\x98\x1C\x00\x00\xE8", 11, 0);
if (pattern_offset == -1) {
LOG("popnhax: cannot retrieve result screen button check\n");
return false;
}
} }
uint64_t patch_addr = (int64_t)data + pattern_offset + 0x1A; uint64_t patch_addr = (int64_t)data + pattern_offset + 0x1A;
@ -2356,7 +2366,7 @@ static bool patch_quick_retire(bool pfree)
/* retrieve songstart function pointer for quick retry */ /* retrieve songstart function pointer for quick retry */
{ {
int64_t pattern_offset = search(data, dllSize, "\xE9\x0C\x01\x00\x00\x8B\x85\x10\x0A\x00\x00", 11, 0); int64_t pattern_offset = search(data, dllSize, "\xE9\x0C\x01\x00\x00\x8B\x85", 7, 0);
if (pattern_offset == -1) { if (pattern_offset == -1) {
LOG("popnhax: quick retry: cannot retrieve song start function\n"); LOG("popnhax: quick retry: cannot retrieve song start function\n");
@ -2396,7 +2406,7 @@ static bool patch_quick_retire(bool pfree)
/* instant launch song with numpad 8 on option select (hold 8 during song for quick retry) */ /* instant launch song with numpad 8 on option select (hold 8 during song for quick retry) */
{ {
int64_t pattern_offset = search(data, dllSize, "\x51\x50\x8B\x83\x0C\x0A\x00\x00\xEB\x09\x33\xD2", 12, 0); int64_t pattern_offset = search(data, dllSize, "\x8B\xF0\x83\x7E\x0C\x00\x0F\x84", 8, 0);
if (pattern_offset == -1) { if (pattern_offset == -1) {
LOG("popnhax: quick retry: cannot retrieve option screen loop\n"); LOG("popnhax: quick retry: cannot retrieve option screen loop\n");
@ -2409,7 +2419,7 @@ static bool patch_quick_retire(bool pfree)
return false; return false;
} }
uint64_t patch_addr = (int64_t)data + pattern_offset + 12 + 5 + 2; uint64_t patch_addr = (int64_t)data + pattern_offset - 0x0F;
MH_CreateHook((LPVOID)patch_addr, (LPVOID)quickexit_option_screen, MH_CreateHook((LPVOID)patch_addr, (LPVOID)quickexit_option_screen,
(void **)&real_option_screen); (void **)&real_option_screen);
} }
@ -2418,41 +2428,53 @@ static bool patch_quick_retire(bool pfree)
{ {
/* go back to song select with numpad 9 on song option screen (before pressing yellow) */ /* go back to song select with numpad 9 on song option screen (before pressing yellow) */
{ {
int64_t pattern_offset = search(data, dllSize, "\x8B\x85\x0C\x0A\x00\x00\x83\x78\x34\x00\x75", 11, 0); int64_t pattern_offset = search(data, dllSize, "\x0A\x00\x00\x83\x78\x34\x00\x75\x3D\xB8", 10, 0); //unilab
uint8_t adjust = 3;
if (pattern_offset == -1) {
/* fallback */
pattern_offset = search(data, dllSize, "\x8B\x85\x0C\x0A\x00\x00\x83\x78\x34\x00\x75", 11, 0);
adjust = 0;
}
if (pattern_offset == -1) { if (pattern_offset == -1) {
LOG("popnhax: back to song select: cannot retrieve option screen loop function\n"); LOG("popnhax: back to song select: cannot retrieve option screen loop function\n");
return false; return false;
} }
uint64_t patch_addr = (int64_t)data + pattern_offset; uint64_t patch_addr = (int64_t)data + pattern_offset - adjust;
MH_CreateHook((LPVOID)patch_addr, (LPVOID)backtosongselect_option_screen, MH_CreateHook((LPVOID)patch_addr, (LPVOID)backtosongselect_option_screen,
(void **)&real_option_screen_later); (void **)&real_option_screen_later);
} }
/* automatically leave option screen after numpad 9 press */ /* automatically leave option screen after numpad 9 press */
{ {
int64_t pattern_offset = search(data, dllSize, "\x84\xC0\x75\x63\x8B\x85\x10\x0A\x00\x00\x83\xC0\x04\xBF\x0C\x00\x00\x00", 18, 0); int64_t pattern_offset = search(data, dllSize, "\x0A\x00\x00\x83\xC0\x04\xBF\x0C\x00\x00\x00\xE8", 12, 0);
if (pattern_offset == -1) { if (pattern_offset == -1) {
LOG("popnhax: back to song select: cannot retrieve option screen loop function\n"); LOG("popnhax: back to song select: cannot retrieve option screen loop function\n");
return false; return false;
} }
uint64_t patch_addr = (int64_t)data + pattern_offset; uint64_t patch_addr = (int64_t)data + pattern_offset - 0x07;
MH_CreateHook((LPVOID)patch_addr, (LPVOID)backtosongselect_option_screen_auto_leave, MH_CreateHook((LPVOID)patch_addr, (LPVOID)backtosongselect_option_screen_auto_leave,
(void **)&real_backtosongselect_option_screen_auto_leave); (void **)&real_backtosongselect_option_screen_auto_leave);
} }
/* go back to song select with numpad 9 on song option screen (after pressing yellow) */ /* go back to song select with numpad 9 on song option screen (after pressing yellow) */
{ {
int64_t pattern_offset = search(data, dllSize, "\x8B\x85\x0C\x0A\x00\x00\x83\x78\x38\x00\x75", 11, 0); int64_t pattern_offset = search(data, dllSize, "\x0A\x00\x00\x83\x78\x38\x00\x75\x3D\x68", 10, 0); //unilab
uint8_t adjust = 3;
if (pattern_offset == -1) {
/* fallback */
pattern_offset = search(data, dllSize, "\x8B\x85\x0C\x0A\x00\x00\x83\x78\x38\x00\x75", 11, 0);
adjust = 0;
}
if (pattern_offset == -1) { if (pattern_offset == -1) {
LOG("popnhax: quick retry: cannot retrieve option screen loop function\n"); LOG("popnhax: quick retry: cannot retrieve yellow option screen loop function\n");
return false; return false;
} }
uint64_t patch_addr = (int64_t)data + pattern_offset; uint64_t patch_addr = (int64_t)data + pattern_offset - adjust;
MH_CreateHook((LPVOID)patch_addr, (LPVOID)backtosongselect_option_yellow, MH_CreateHook((LPVOID)patch_addr, (LPVOID)backtosongselect_option_yellow,
(void **)&real_option_screen_yellow); (void **)&real_option_screen_yellow);
} }
@ -4066,7 +4088,7 @@ if (use_sp_flg){
__asm("add esp, 0x0C\n"); __asm("add esp, 0x0C\n");
} }
if (config.enhanced_polling_stats) if (config.enhanced_polling && config.enhanced_polling_stats)
enhanced_polling_stats_disp_sub(); enhanced_polling_stats_disp_sub();
real_aging_loop(); real_aging_loop();
@ -4079,7 +4101,7 @@ static bool patch_practice_mode()
/* AGING MODE to Practice Mode */ /* AGING MODE to Practice Mode */
{ {
int64_t pattern_offset = search(data, dllSize, "\x83\xEC\x40\x53\x56\x57", 6, 0); int64_t pattern_offset = search(data, dllSize-0x100000, "\x83\xEC\x40\x53\x56\x57", 6, 0x100000);
if (pattern_offset == -1) { if (pattern_offset == -1) {
LOG("popnhax: cannot retrieve aging loop\n"); LOG("popnhax: cannot retrieve aging loop\n");
@ -4249,7 +4271,7 @@ static bool patch_enhanced_polling_stats()
char *data = getDllData(g_game_dll_fn, &dllSize); char *data = getDllData(g_game_dll_fn, &dllSize);
{ {
int64_t pattern_offset = search(data, dllSize, "\x83\xEC\x40\x53\x56\x57", 6, 0); int64_t pattern_offset = search(data, dllSize-0x100000, "\x83\xEC\x40\x53\x56\x57", 6, 0x100000);
if (pattern_offset == -1) { if (pattern_offset == -1) {
LOG("popnhax: enhanced_polling_stats: cannot retrieve aging loop\n"); LOG("popnhax: enhanced_polling_stats: cannot retrieve aging loop\n");
@ -4564,7 +4586,7 @@ bool patch_hispeed_auto(uint8_t mode, uint16_t default_bpm)
} }
/* write new hispeed according to target bpm */ /* write new hispeed according to target bpm */
{ {
int64_t pattern_offset = search(data, dllSize, "\x98\x50\x66\x8B\x85\x1A\x0A\x00\x00\x8B\xCF", 11, 0); int64_t pattern_offset = search(data, dllSize, "\x98\x50\x66\x8B\x85", 5, 0);
if (pattern_offset == -1) { if (pattern_offset == -1) {
LOG("popnhax: auto hi-speed: cannot find hi-speed apply address\n"); LOG("popnhax: auto hi-speed: cannot find hi-speed apply address\n");
return false; return false;