Sorry if late, but there's some info.
1. Hook release in GameOverlayRenderer64.dll \x48\x89\x05\xCC\xCC\xCC\xCC\x48\x8D\x15\xCC\xCC\x CC\xCC\x48\x8B\x4B\x68 xxx????xxx????xxxx (x64 pattern for variable reference)
2. Do things here: init WndProc, hook EndScene, etc.
For me that code is... (comments aren't mine)
Code:
ULONG __stdcall hkRelease(IDirect3DDevice9* thisptr) {
// Perform general setup tasks when this function is called for the first time.
static bool is_initialized = false;
static bool init_running = false;
if (!is_initialized) {
while (init_running) Sleep(40);
if (is_initialized) goto skip;
init_running = true;
static HWND console_hwnd = GetConsoleHwnd();
EnumWindows([](HWND hwnd, LPARAM game_pid) -> BOOL {
// Skip windows not belonging to the game process.
DWORD hwnd_pid = NULL;
GetWindowThreadProcessId(hwnd, &hwnd_pid);
if (hwnd_pid != game_pid || hwnd == console_hwnd)
return TRUE;
// Set the target window handle and stop the callback.
game_hwnd = hwnd;
return FALSE;
}, GetCurrentProcessId());
if (game_hwnd != NULL) {
// Swap out the window message handler for our own, allowing us to intercept input events.
game_wndproc = reinterpret_cast<WNDPROC>(SetWindowLongPtr(game_hwnd, GWLP_WNDPROC, LONG_PTR(hkWndProc)));
g_pRenderer = new Renderer(thisptr);
pOriginalRender = (HRESULT(__stdcall*)(IDirect3DDevice9*)) DetourPointer(pOriginalRender_Restore = *(void***)thisptr + 42, hkRender); // endscene
// Perform final ImGui setup tasks and..
ImGui_ImplDX9_Init(game_hwnd, thisptr);
// ..we're all done!
is_initialized = true;
}
init_running = false;
skip:;
}
return pOriginalRelease(thisptr);
}
3. ???
4. PROFIT