From 6354450e2f9e391145b3598c196e595ba0d4ff98 Mon Sep 17 00:00:00 2001 From: Dregu Date: Fri, 28 Jun 2024 01:58:06 +0300 Subject: [PATCH] Fix steam overlay hook patterns --- src/game_api/window_api.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/game_api/window_api.cpp b/src/game_api/window_api.cpp index d2c174e96..e0a827d6e 100644 --- a/src/game_api/window_api.cpp +++ b/src/game_api/window_api.cpp @@ -402,8 +402,8 @@ void hook_steam_overlay() // Lets detour the steam overlay instead! DEBUG("Steam detected, hooking Steam Overlay..."); - size_t present_offset = find_inst(steam_overlay, "\x48\x89\x74\x24\x20\x41\x56\x48\x83\xEC\x20\x41\x8B\xE8\x8B\xF2"sv, 0, 0x99999, "steam_overlay_present"sv); - size_t resize_offset = find_inst(steam_overlay, "\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x57\x41\x56\x41\x57\x48\x83\xEC\x30\x44\x8B\xFA\x48\x8B\xF1\x48\x8B\xD1\x41\x8B\xE9"sv, 0, 0x99999, "steam_overlay_resize"sv); + size_t present_offset = find_inst(steam_overlay, "\x48\x8b\x4f\x40\x48\x8d\x15"sv, 0, 0x99999, "steam_overlay_present"sv, false); + size_t resize_offset = find_inst(steam_overlay, "\x48\x8b\x4f\x68\x48\x8d\x15"sv, 0, 0x99999, "steam_overlay_resize"sv, false); if (present_offset == 0 || resize_offset == 0) { @@ -416,8 +416,13 @@ void hook_steam_overlay() return; } - g_OrigSwapChainPresent = (PresentPtr)(steam_overlay + present_offset - 5); - g_OrigSwapChainResizeBuffers = (ResizeBuffersPtr)(steam_overlay + resize_offset - 5); + auto present_offset2 = *(int*)(steam_overlay + present_offset + 7); + auto resize_offset2 = *(int*)(steam_overlay + resize_offset + 7); + present_offset = present_offset + 7 + 4 + present_offset2; + resize_offset = resize_offset + 7 + 4 + resize_offset2; + + g_OrigSwapChainPresent = (PresentPtr)(steam_overlay + present_offset); + g_OrigSwapChainResizeBuffers = (ResizeBuffersPtr)(steam_overlay + resize_offset); DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread());