Files
CoopAllTheThings/CMakeLists.txt
BlackMark 663d86e6ec Phase 2: audio mirror via WASAPI process loopback
Mirror the real game's audio so Steam Remote Play Together (which streams the
host's own audio session) carries it to the guest. The host captures the game
by PID via WASAPI process loopback and re-renders it on the default endpoint;
the game still plays locally too (accepted "double audio" for now).

- ProcessLoopbackCapture: process-loopback capture client, frame-sink + stats.
  The completion handler must be agile (IAgileObject) or
  ActivateAudioInterfaceAsync rejects every call with E_ILLEGAL_METHOD_CALL.
- AudioMirror: wraps capture with an event-driven render client and a primed
  ring buffer; AudioPanel drives it from the injected game's window/PID.
- coop_tone: standalone WASAPI sine-wave process used as a known audio source.
- audio_loopback_test (CTest): captures coop_tone by PID and asserts non-silent
  audio arrives, so the path is verifiable without a second Steam account.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 10:21:27 +02:00

50 lines
1.7 KiB
CMake

cmake_minimum_required(VERSION 3.21)
project(CoopAllTheThings
VERSION 0.0.1
DESCRIPTION "Steam Remote Play Together for any XInput game"
LANGUAGES CXX)
if(NOT WIN32)
message(FATAL_ERROR "CoopAllTheThings targets Windows only.")
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Emit compile_commands.json so clangd resolves includes/flags. Ignored by the
# Visual Studio generator, so configure the Ninja build (build-clangd/) for this;
# .clangd points clangd at that compilation database.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Single output dir keeps the donor-launch / inject workflow simple: host exe and
# hook dll land next to each other under /bin (already in .gitignore).
set(COOP_OUTPUT_DIR "${CMAKE_SOURCE_DIR}/bin/$<CONFIG>")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${COOP_OUTPUT_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${COOP_OUTPUT_DIR}")
if(MSVC)
add_compile_options(/W4 /permissive- /Zc:__cplusplus /utf-8 /MP)
add_compile_definitions(UNICODE _UNICODE WIN32_LEAN_AND_MEAN NOMINMAX)
endif()
add_subdirectory(third_party)
add_subdirectory(common)
add_subdirectory(host)
# The injected hook DLL pulls in SafetyHook, which fetches Zydis via FetchContent
# at configure time (allowed for transitive deps).
option(COOP_BUILD_HOOK "Build the injected game-side hook DLL" ON)
if(COOP_BUILD_HOOK)
# SafetyHook's own tests/examples/docs are noise for us.
set(SAFETYHOOK_BUILD_TEST OFF CACHE BOOL "" FORCE)
set(SAFETYHOOK_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(SAFETYHOOK_BUILD_DOCS OFF CACHE BOOL "" FORCE)
add_subdirectory(third_party/safetyhook)
add_subdirectory(hook)
enable_testing()
add_subdirectory(tools/audio_tone) # coop_tone: audio source for the loopback test
add_subdirectory(tests)
endif()