// Host-side setup for the opt-in Vulkan capture layer (coop_vk_layer). Registering it as a // per-user implicit Vulkan layer makes the Vulkan loader insert it at vkCreateInstance -- so it's // in the chain before a game (that caches its present pointer at init) can resolve // vkQueuePresentKHR, the reliable early-presence path the inject-after-launch hook can't get. // // An implicit layer loads into *every* Vulkan app, so the layer itself only captures the process // whose image basename matches the scoping file this writes -- keeping it inert for everything but // the host's target. Registration is HKCU-only (no admin) and fully reversible. #pragma once #include namespace coop { // Register the implicit layer (HKCU) and scope it to `target_image` (the game's exe basename, // e.g. "game.exe"). Returns true on success. Idempotent. bool register_vk_layer(const std::wstring& target_image); // Remove the registry registration and the scoping file. Safe to call when not registered (e.g. // on host shutdown as a belt-and-suspenders cleanup). void unregister_vk_layer(); // Call once at host startup. The layer is session-scoped (registered only while the tool runs, // unregistered on clean exit), so any registration present at startup is a leftover from a host that // crashed/was killed while registered -- which would otherwise keep loading our DLL into EVERY Vulkan // app until the next clean run. This removes that stale registration. No-op if nothing is registered. void cleanup_stale_vk_layer(); } // namespace coop