Run clang-format (the repo's .clang-format: LLVM base, 120 cols, tabs, Allman functions) over every source file so the tree is formatter-clean. Whitespace only -- no behavior change; full x64 + x86 suites pass. Also set SortIncludes: false in .clang-format. Windows include order is load-bearing (windows.h must precede tlhelp32.h / mmreg.h / xinput.h / dinput.h; winsock2.h must precede windows.h), and the default alphabetical sort reorders tlhelp32.h ahead of windows.h -- a build break. Leaving order alone keeps the manual, correct grouping.
30 lines
1.5 KiB
C++
30 lines
1.5 KiB
C++
// 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 <string>
|
|
|
|
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
|