Add mock-game capture/audio/hook stress test

mock_game_test launches coop_mock_game (DX11/DX12, frame-numbered A/V), injects
coop_hook.dll, opens the hook's shared video texture, and decodes the frame
number from the captured pixels to assert a monotonic, advancing mirror for
both backends (catches dropped/stale/out-of-order frames). Then it runs an
A/V + hook/unhook stress pass and confirms no crash + capture resumes. Adds a
read_pixel() readback to the shipping SharedTextureSource for the decode.
Robust to repeated/CI runs (kills stray games, retries inject). Trim the
roadmap (the mock-game item is done) and document the test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 05:22:20 +02:00
parent e2562ac63c
commit e608c6fb38
5 changed files with 518 additions and 11 deletions

View File

@@ -95,16 +95,6 @@ and covers anything the hooked path doesn't (Vulkan, D3D9 — see Roadmap).
## Roadmap
### Planned (next up)
- **Mock game + stress-test suite.** A bare-bones test game that renders an animated
(non-static) pattern — so dropped/duplicated/torn frames are obvious — with a
selectable graphics backend (DX11/DX12 now; structured to add OpenGL/Vulkan) and a
configurable audio output (rate/channels/bit-depth/format, like `coop_tone`). Then a
comprehensive suite that drives it through the real capture + audio + hook paths:
verify both capture backends, every audio variant, hook/unhook cycles, and that
nothing races or crashes under stress.
### Future work
- **Vulkan video hook.** Vulkan games present via `vkQueuePresentKHR`; hooking
@@ -217,6 +207,17 @@ ctest --test-dir build -C Debug --output-on-failure
process-loopback capture (the fallback backend) receives non-silent audio by PID for
each — confirming loopback is format-agnostic (it captures post-mix at the device
endpoint format). Skips cleanly if the machine has no audio endpoint.
- **`mock_game_test`** — comprehensive capture/audio/hook stress test against
**`coop_mock_game`** (an animated, frame-numbered A/V test game under
[`tools/mock_game`](tools/mock_game) with selectable **DX11 / DX12** backends and a
configurable WASAPI tone). It launches the game, injects `coop_hook.dll`, opens the
hook's shared video texture, and **decodes the frame number out of the captured pixels**
to assert the mirror sees a *monotonic, advancing* sequence for both backends (the bar
for no dropped / stale / out-of-order frames — what the DX12 rotating-backbuffer bug
broke). It then injects with audio + video, checks both stream, cycles the audio
subsystem off/on (hook/unhook stress), and confirms the game never crashes and capture
resumes. This suite drove out five real audio races (see Lessons learned). Skips cleanly
without a D3D11 device.
### Debugging the hooks against a real game