Deduplicate the host audio/UI code and scrub history from comments

Extract a RAII RenderEndpoint that owns the enumerator/endpoint/client/
render-event/buffer for both AudioMirror::run_hooked and run_loopback,
replacing two hand-rolled setup+teardown blocks and their two identical
fail lambdas with one set_error helper; every COM object now frees on
each exit path automatically.

Route audio_format_verifier's mono decode through the shared
correlate_detail::decode_layout instead of a second copy, and read the
debug env var via GetEnvironmentVariableA (drops the getenv C4996).

Fold the near-identical read_frame/read_pixel staging-copy setup in
SharedTextureSource into one map_staging_copy, and the three separate
case-insensitive filter helpers (log/injection panels) into
ui/text_match.hpp.

Comments: drop game-name anecdotes and "the old code"/version phrasing;
genericize the override-file example; fix a stale heartbeat-interval
note. Behavior unchanged (host tests + mock_game_test pass).
This commit is contained in:
2026-07-12 09:07:53 +02:00
parent 635ef51283
commit 4636f4bb64
13 changed files with 217 additions and 292 deletions

View File

@@ -15,8 +15,8 @@ bool hook_dll_alive(unsigned long pid, int timeout_ms)
// The per-pid section exists only while someone holds it; a connected DLL keeps it alive across
// a host restart. Open it (don't create), then confirm the DLL's worker is actually beating --
// a stale section with a dead worker (heartbeat frozen) must read as not-alive so we inject fresh.
// Poll rather than sample once: the worker only beats ~every 250 ms, so a single short read can
// straddle a gap and miss it; return the instant a beat lands, and give up after the timeout.
// Poll rather than sample once: the worker only beats ~4x/s, so a single short read can straddle
// a gap and miss it; return the instant a beat lands, and give up after the timeout.
SharedMemory shm;
if (!shm.open(shared_memory_name(pid), sizeof(SharedBlock)))
{