show details on result screen

This commit is contained in:
CrazyRedMachine 2023-08-17 00:22:36 +02:00
parent f0bca1515d
commit f75be601d0
3 changed files with 71 additions and 4 deletions

View File

@ -33,18 +33,22 @@
<!-- Bring back score challenge in the game for servers supporting it (only for kaimei onwards) --> <!-- Bring back score challenge in the game for servers supporting it (only for kaimei onwards) -->
<score_challenge __type="bool">0</score_challenge> <score_challenge __type="bool">0</score_challenge>
<!-- Audio offset -->
<!-- Offset the audio by x ms (negative plays audio earlier). This will disable keysounds -->
<audio_offset __type="s8">0</audio_offset>
<!-- Visual offset --> <!-- Visual offset -->
<!-- Hidden+ setting (press 0 for advanced options) is now a visual offset adjust (negative means you have to hit earlier) --> <!-- Hidden+ setting (press 0 for advanced options) is now a visual offset adjust (negative means you have to hit earlier) -->
<hidden_is_offset __type="bool">0</hidden_is_offset> <hidden_is_offset __type="bool">0</hidden_is_offset>
<!-- Display offset adjust value on score result screen (requires hidden_is_offset, won't be sent over network) --> <!-- Display offset adjust value on score result screen (requires hidden_is_offset, won't be sent over network) -->
<show_offset __type="bool">0</show_offset> <show_offset __type="bool">0</show_offset>
<!-- Result screen display patches -->
<!-- Display details on result screen by default (no need to press yellow button) -->
<show_details __type="bool">0</show_details>
<!-- Display fast/slow counter on result screen even on judge+ off/lost/panic --> <!-- Display fast/slow counter on result screen even on judge+ off/lost/panic -->
<show_fast_slow __type="bool">0</show_fast_slow> <show_fast_slow __type="bool">0</show_fast_slow>
<!-- Audio offset -->
<!-- Offset the audio by x ms (negative plays audio earlier). This will disable keysounds -->
<audio_offset __type="s8">0</audio_offset>
<!-- Input polling --> <!-- Input polling -->
<!-- 1000Hz polling rate (no more shifting timing windows/magic bpm, consistent scoring independently of framerate) --> <!-- 1000Hz polling rate (no more shifting timing windows/magic bpm, consistent scoring independently of framerate) -->
<enhanced_polling __type="bool">0</enhanced_polling> <enhanced_polling __type="bool">0</enhanced_polling>

View File

@ -8,6 +8,7 @@ struct popnhax_config {
bool hidden_is_offset; bool hidden_is_offset;
bool show_offset; bool show_offset;
bool show_fast_slow; bool show_fast_slow;
bool show_details;
bool pfree; bool pfree;
bool quick_retire; bool quick_retire;
bool back_to_song_select; bool back_to_song_select;

View File

@ -92,6 +92,8 @@ PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, hidden_is_offs
"/popnhax/hidden_is_offset") "/popnhax/hidden_is_offset")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, show_fast_slow, PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, show_fast_slow,
"/popnhax/show_fast_slow") "/popnhax/show_fast_slow")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, show_details,
"/popnhax/show_details")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, show_offset, PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, show_offset,
"/popnhax/show_offset") "/popnhax/show_offset")
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, pfree, PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, pfree,
@ -1725,6 +1727,62 @@ static bool force_show_fast_slow() {
return true; return true;
} }
void (*real_show_detail_result)();
void hook_show_detail_result()
{
static uint32_t last_call = 0;
__asm("push eax\n");
__asm("push edx\n");
uint32_t curr_time = timeGetTime(); //will clobber eax
if ( curr_time - last_call > 10000 ) //will clobber edx
{
last_call = curr_time;
__asm("pop edx\n");
__asm("pop eax\n");
//force press yellow button
__asm("mov al, 1\n");
}
else
{
last_call = curr_time;
__asm("pop edx\n");
__asm("pop eax\n");
}
real_show_detail_result();
}
static bool force_show_details_result() {
DWORD dllSize = 0;
char *data = getDllData(g_game_dll_fn, &dllSize);
int64_t first_loc = search(data, dllSize, "\x8B\x45\x48\x8B\x58\x0C\x6A\x09\x68\x80\x00\x00\x00", 13, 0);
if (first_loc == -1) {
LOG("popnhax: show details: cannot find result screen button check (1)\n");
return false;
}
//+0x26
{
int64_t pattern_offset = search(data, 0x50, "\x84\xC0", 2, first_loc);
if (pattern_offset == -1) {
LOG("popnhax: show details: cannot find result screen button check (2)\n");
return false;
}
uint64_t patch_addr = (int64_t)data + pattern_offset;
MH_CreateHook((LPVOID)patch_addr, (LPVOID)hook_show_detail_result,
(void **)&real_show_detail_result);
}
LOG("popnhax: force show details on result screen\n");
return true;
}
static bool patch_pfree() { static bool patch_pfree() {
DWORD dllSize = 0; DWORD dllSize = 0;
char *data = getDllData(g_game_dll_fn, &dllSize); char *data = getDllData(g_game_dll_fn, &dllSize);
@ -4058,6 +4116,10 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
force_show_fast_slow(); force_show_fast_slow();
} }
if (config.show_details){
force_show_details_result();
}
if (config.audio_offset){ if (config.audio_offset){
if (config.keysound_offset) if (config.keysound_offset)
{ {