// Process-wide registry of the individual hooks the DLL installs, with a call // counter per hook. Each hook module (XInput, focus, audio) registers its hooks // once and bumps the counter from its detour; the worker thread publishes the // table to the host over IPC for the Injection panel's hook list. #pragma once #include #include "coop/protocol.hpp" #include "ipc_client.hpp" namespace coop::hook { // Find-or-create a registry slot for `name` in `subsystem`; returns a stable id // (>= 0) used with the calls below, or -1 if the table is full. Idempotent: the // same name returns the same id, so install/remove cycles keep one slot. int hook_register(const char* name, std::uint32_t subsystem); // Mark a hook installed / removed (drives the "installed" column). void hook_set_installed(int id, bool installed); // Bump a hook's call counter. Cheap (relaxed atomic); safe on any thread. void hook_note_call(int id); // Snapshot the registry into the host's HookStatus back-channel. void hook_publish(IpcClient& ipc); // Forget everything (DLL detach). void hook_registry_reset(); } // namespace coop::hook