Files
CoopAllTheThings/tools/mock_game/CMakeLists.txt
BlackMark 0e58902438 Mock game: drive input/focus/MKB hooks + window title; add DetourGate test
- poll_input() each frame (XInputGetState / GetAsyncKeyState / GetKeyboardState /
  GetForegroundWindow), like a real game, so mock_game_test's hook/unhook storm
  actually exercises removing the input/focus/MKB hooks while their detours are in
  flight -- the coverage gap that let those removal races go untested.
- Window title shows the backend + a once-per-second-smoothed fps.
- A vectored-exception crash logger prints the faulting module+offset (named the
  storm's intermittent crashes during this work; inert otherwise).
- detour_gate_test: fast, deterministic guard for DetourGate -- drain() must block
  while a Guard is in flight and return promptly otherwise, plus a concurrency
  stress that asserts no body runs against freed state. (A synthetic install-race
  unit test was tried but flaked on SafetyHook's own enable/disable atomicity under
  ~30M calls/s, unrelated to our code, so the storm is the install/remove guard.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 11:17:34 +02:00

22 lines
929 B
CMake

# CoopMockGame -- a tiny test "game" with an animated, frame-numbered render (DX10/DX11/DX12)
# and a configurable WASAPI tone, used by the capture/audio/hook stress tests. Not shipped.
add_executable(coop_mock_game
main.cpp
render_backend.cpp
render_dx11.cpp
render_dx12.cpp
render_dx10.cpp
render_dx09.cpp
render_gl.cpp
render_vk.cpp)
# Reuses the shared ToneSource (also used by coop_tone + the audio hook self-test).
target_include_directories(coop_mock_game PRIVATE ${CMAKE_SOURCE_DIR}/tools/audio_tone)
target_link_libraries(coop_mock_game PRIVATE d3d11 d3d12 d3d10 d3d9 dxgi ole32 opengl32 gdi32 volk
xinput user32) # xinput/user32: poll the input + focus APIs the hook intercepts (storm coverage)
set_target_properties(coop_mock_game PROPERTIES OUTPUT_NAME "coop_mock_game")
# Test fixture -> stage next to the tests (alongside coop_tone), not in the deployable root.
coop_output_subdir(tests coop_mock_game)