quick_retire: no need to press red button on result screen after numpad

This commit is contained in:
CrazyRedMachine 2023-08-16 22:26:40 +02:00
parent a3c05cb55f
commit f0bca1515d

View File

@ -270,6 +270,7 @@ uint32_t g_transition_addr = 0;
uint32_t g_stage_addr = 0; uint32_t g_stage_addr = 0;
uint32_t g_score_addr = 0; uint32_t g_score_addr = 0;
bool g_pfree_mode = false; bool g_pfree_mode = false;
bool g_end_session = false;
bool g_return_to_options = false; bool g_return_to_options = false;
bool g_return_to_song_select = false; bool g_return_to_song_select = false;
void (*real_screen_transition)(); void (*real_screen_transition)();
@ -287,6 +288,7 @@ void quickexit_screen_transition()
g_return_to_song_select = false; g_return_to_song_select = false;
//flag is set back to false in hook_stage_increment otherwise //flag is set back to false in hook_stage_increment otherwise
} }
g_end_session = false;
real_screen_transition(); real_screen_transition();
} }
@ -519,6 +521,7 @@ void quickexit_result_loop()
__asm("jmp call_real_result\n"); __asm("jmp call_real_result\n");
__asm("quit_session:\n"); __asm("quit_session:\n");
g_end_session = true;
g_return_to_options = false; g_return_to_options = false;
/* set value 5 in g_stage_addr and -4 in g_transition_addr (to get fade to black transition) */ /* set value 5 in g_stage_addr and -4 in g_transition_addr (to get fade to black transition) */
__asm("mov ebx, %0\n": :"b"(g_stage_addr)); __asm("mov ebx, %0\n": :"b"(g_stage_addr));
@ -534,6 +537,17 @@ void quickexit_result_loop()
real_result_loop(); real_result_loop();
} }
void (*real_result_button_loop)();
void quickexit_result_button_loop()
{
if ( g_end_session || g_return_to_options )
{
//g_return_to_options is reset in quickexit_option_screen_cleanup(), g_end_session is reset in quickexit_screen_transition()
__asm("mov al, 1\n");
}
real_result_button_loop();
}
uint32_t g_timing_addr = 0; uint32_t g_timing_addr = 0;
bool g_timing_require_update = false; bool g_timing_require_update = false;
@ -1901,6 +1915,21 @@ static bool patch_quick_retire(bool pfree)
(void **)&real_result_loop); (void **)&real_result_loop);
} }
/* no need to press red button when numpad 8 or 9 is pressed on result screen */
{
int64_t pattern_offset = search(data, dllSize, "\x84\xC0\x75\x0F\x8B\x8D\x1C\x0A\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 + 0x1D;
MH_CreateHook((LPVOID)patch_addr, (LPVOID)quickexit_result_button_loop,
(void **)&real_result_button_loop);
}
LOG("popnhax: quick retire enabled\n"); LOG("popnhax: quick retire enabled\n");
/* retrieve songstart function pointer for quick retry */ /* retrieve songstart function pointer for quick retry */