diff --git a/src/byte_patch_manager.cpp b/src/byte_patch_manager.cpp index 7de78013..2f8eed6b 100644 --- a/src/byte_patch_manager.cpp +++ b/src/byte_patch_manager.cpp @@ -77,6 +77,9 @@ namespace big // Prevent the attribute task from failing memory::byte_patch::make(g_pointers->m_sc.m_read_attribute_patch, std::vector{0x90, 0x90})->apply(); memory::byte_patch::make(g_pointers->m_sc.m_read_attribute_patch_2, std::vector{0xB0, 0x01})->apply(); + + // window hook: pt1 + memory::byte_patch::make(g_pointers->m_gta.m_window_hook.as(), std::to_array({0xC3, 0x90, 0x90, 0x90}))->apply(); } byte_patch_manager::byte_patch_manager() diff --git a/src/gta_pointers.hpp b/src/gta_pointers.hpp index 8b5086e2..5e6fc196 100644 --- a/src/gta_pointers.hpp +++ b/src/gta_pointers.hpp @@ -45,6 +45,8 @@ namespace big memory::handle m_crash_trigger; + memory::handle m_window_hook; + memory::handle m_script_vm_patch_1; memory::handle m_script_vm_patch_2; memory::handle m_script_vm_patch_3; diff --git a/src/hooking.cpp b/src/hooking.cpp index 7c2eed1f..1bd663f8 100644 --- a/src/hooking.cpp +++ b/src/hooking.cpp @@ -131,6 +131,8 @@ namespace big { m_swapchain_hook.enable(); m_og_wndproc = WNDPROC(SetWindowLongPtrW(g_pointers->m_hwnd, GWLP_WNDPROC, LONG_PTR(&hooks::wndproc))); + // window hook: pt2 + UnhookWindowsHookEx(*g_pointers->m_gta.m_window_hook.add(45).rip().as()); for (const auto& detour_hook_helper : m_detour_hook_helpers) { @@ -151,6 +153,8 @@ namespace big detour_hook_helper->m_detour_hook->disable(); } + // window hook: pt2 + SetWindowsHookExA(13, g_pointers->m_gta.m_window_hook.add(18).rip().as(), GetModuleHandleA("GTA5.exe"), 0); SetWindowLongPtrW(g_pointers->m_hwnd, GWLP_WNDPROC, reinterpret_cast(m_og_wndproc)); m_swapchain_hook.disable(); diff --git a/src/pointers.cpp b/src/pointers.cpp index a438734f..758ff1bd 100644 --- a/src/pointers.cpp +++ b/src/pointers.cpp @@ -1372,6 +1372,15 @@ namespace big g_pointers->m_gta.m_get_title_caption_error_message_box = ptr.add(1).rip().as(); } }, + // Disable Window Hook + { + "DT", + "48 83 EC 28 33 C9 FF 15 ? ? ? ? 45 33 C9", + [](memory::handle ptr) + { + g_pointers->m_gta.m_window_hook = ptr; + } + }, // Vehicle Metadata Manager. { "VEHMMGR",