diff --git a/src/hooks/protections/sound_overload_detour_asm.asm b/src/hooks/protections/sound_overload_detour_asm.asm new file mode 100644 index 00000000..bc066d17 --- /dev/null +++ b/src/hooks/protections/sound_overload_detour_asm.asm @@ -0,0 +1,21 @@ +EXTERN g_sound_overload_ret_addr: DQ + +.CODE + sound_overload_detour PROC + movzx eax, r8w + lea rdx, [rcx + rcx * 2] + cmp rdx, 190 + jle label_1 + mov rdx, 0 + jmp label_2 + label_1: + inc ecx + cmp r8w, [rbx + 28] + label_2: + push 0 + mov r11, g_sound_overload_ret_addr + mov [rsp], r11 + ret + sound_overload_detour ENDP + +END \ No newline at end of file diff --git a/src/pointers.cpp b/src/pointers.cpp index 47d71381..1454dd0c 100644 --- a/src/pointers.cpp +++ b/src/pointers.cpp @@ -5,6 +5,9 @@ #include "security/RageSecurity.hpp" #include "hooking.hpp" +extern "C" void sound_overload_detour(); +std::uint64_t g_sound_overload_ret_addr; + namespace big { pointers::pointers() @@ -762,6 +765,15 @@ namespace big m_chat_gamer_info = ptr.add(1).rip().add(6).rip().as(); }); + // Sound Overload Detour + main_batch.add("SOD", "66 45 3B C1 74 38", [this](memory::handle ptr) + { + g_sound_overload_ret_addr = ptr.add(13 + 15).as(); + std::vector bytes = { 0xFF,0x25,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90 }; // far jump opcode + a nop opcode + *(void**)(bytes.data() + 6) = sound_overload_detour; + memory::byte_patch::make(ptr.add(13).as(), bytes)->apply(); + }); + auto mem_region = memory::module("GTA5.exe"); main_batch.run(mem_region); diff --git a/src/pointers.hpp b/src/pointers.hpp index 63fee357..49c9e3f8 100644 --- a/src/pointers.hpp +++ b/src/pointers.hpp @@ -22,6 +22,8 @@ namespace rage class rlGamerInfo; } +extern "C" std::uint64_t g_sound_overload_ret_addr; + namespace big { class pointers