From e29320ebcb4b17e3cf9691a5a65f522946ac2c54 Mon Sep 17 00:00:00 2001 From: CrazyRedMachine Date: Thu, 6 Jun 2024 00:33:57 +0200 Subject: [PATCH] result screen retire/retry sound ok --- popnhax/dllmain.cc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/popnhax/dllmain.cc b/popnhax/dllmain.cc index d3af498..54accf6 100644 --- a/popnhax/dllmain.cc +++ b/popnhax/dllmain.cc @@ -1407,6 +1407,19 @@ void quickexit_result_loop() } g_return_to_options = true; //transition screen hook will catch it + + /* play sound fx (retry song) */ + __asm("push eax\n"); + __asm("push ecx\n"); + __asm("push edx\n"); + __asm("mov eax, 0x1F\n"); //"exit menu" sound fx + __asm("push 0\n"); + __asm("call %0\n"::"D"(playsramsound_func)); + __asm("add esp, 4\n"); + __asm("pop edx\n"); + __asm("pop ecx\n"); + __asm("pop eax\n"); + __asm("jmp call_real_result\n"); __asm("quit_session:\n"); @@ -1418,6 +1431,7 @@ void quickexit_result_loop() __asm("mov ebx, %0\n": :"b"(g_transition_addr)); __asm("mov dword ptr[ebx], 0xFFFFFFFC\n"); //quit session + /* play sound fx (end session) */ __asm("push eax\n"); __asm("push ecx\n"); __asm("push edx\n"); @@ -3295,6 +3309,17 @@ static bool patch_quick_retire(bool pfree) (void **)&real_game_loop); } + { + // PlaySramSound func + int64_t pattern_offset = search(data, dllSize, + "\x51\x56\x8B\xF0\x85\xF6\x74\x6C\x6B\xC0\x2C", 11, 0); + if (pattern_offset == -1) { + LOG("popnhax: PlaySramSound_addr was not found.\n"); + return false; + } + playsramsound_func = (uint32_t)((int64_t)data + pattern_offset); + } + /* instant exit with numpad 9 on result screen */ { int64_t first_loc = search(data, dllSize, "\xBF\x03\x00\x00\x00\x81\xC6", 7, 0);