// Injected OpenGL capture path: hooks SwapBuffers / wglSwapBuffers in OpenGL games // (which never call IDXGISwapChain::Present, so the DXGI present hook can't see // them -- e.g. Phantom Brave), reads the GL backbuffer with glReadPixels, and // uploads it into the same shared keyed-mutex texture (coop_video_) the host // samples. Part of the video subsystem, alongside present_hook. // // glReadPixels forces a GPU->CPU readback each frame, so this is heavier than the // D3D shared-texture copy; fine for the 2D / lower-framerate games that tend to be // OpenGL. Vulkan games present via vkQueuePresentKHR and aren't covered here (see // the README) -- use WGC for those. #pragma once #include "ipc_client.hpp" namespace coop::hook { // Installs the OpenGL swap hooks. `ipc` must outlive the hooks. Returns true if at // least SwapBuffers was hooked. Safe to call repeatedly. bool install_opengl_hooks(IpcClient& ipc); // Removes the OpenGL swap hooks and releases the shared texture (best effort). void remove_opengl_hooks(); // --- Diagnostics ----------------------------------------------------------- std::uint64_t opengl_swaps(); // cumulative SwapBuffers/wglSwapBuffers detours std::uint64_t opengl_frames_shared(); // frames uploaded into the shared texture } // namespace coop::hook