// Injected Present-hook video path: hooks IDXGISwapChain::Present in the target // game, copies the swapchain backbuffer into a shared keyed-mutex texture // (coop_video_), and publishes its dimensions/format to the host over IPC. // The host opens that texture by name and samples it -- a lower-latency, more // stable alternative to Windows Graphics Capture (which composites off the // desktop and can stutter / show a capture border). // // Only DXGI swapchains (D3D10/11/12-backed games) are caught; the backbuffer // must be an ID3D11Texture2D (the common D3D11 case). Games on D3D9 or a pure // D3D12 resource path won't engage this hook -- WGC stays as the fallback. #pragma once #include "ipc_client.hpp" namespace coop::hook { // Installs the Present hook. Grabs IDXGISwapChain::Present from a throwaway // swapchain and inline-hooks it, so every swapchain in the process is caught. // `ipc` must outlive the hook (used to publish the shared-texture descriptor). // Returns true once the hook is in place; safe to call repeatedly. bool install_present_hooks(IpcClient& ipc); // Removes the Present hook and releases the shared texture (best effort). void remove_present_hooks(); // --- Diagnostics (used by the self-test) ----------------------------------- // Cumulative Present() detours observed. std::uint64_t present_calls(); // Frames actually copied into the shared texture (a backbuffer we could share). std::uint64_t present_frames_shared(); } // namespace coop::hook