Apply clang-format across the whole tree

Run clang-format (the repo's .clang-format: LLVM base, 120 cols, tabs,
Allman functions) over every source file so the tree is formatter-clean.
Whitespace only -- no behavior change; full x64 + x86 suites pass.

Also set SortIncludes: false in .clang-format. Windows include order is
load-bearing (windows.h must precede tlhelp32.h / mmreg.h / xinput.h /
dinput.h; winsock2.h must precede windows.h), and the default
alphabetical sort reorders tlhelp32.h ahead of windows.h -- a build
break. Leaving order alone keeps the manual, correct grouping.
This commit is contained in:
2026-07-12 11:52:53 +02:00
parent c684a15fb9
commit 30eccf749d
155 changed files with 3333 additions and 6171 deletions

View File

@@ -13,30 +13,19 @@
#include "audio/audio_overrides.hpp"
#include "ipc/ipc_server.hpp"
namespace coop
{
namespace coop {
class AudioPanel
{
public:
AudioPanel()
{
overrides_.load();
}
class AudioPanel {
public:
AudioPanel() { overrides_.load(); }
// The window whose process audio to mirror (0 if none); typically the
// injected game's HWND.
void set_target(HWND target)
{
target_ = target;
}
void set_target(HWND target) { target_ = target; }
// Wire a sink for host-side log lines (override-overwrite warnings etc.). main
// connects this to the injection panel's Log-window channel.
void set_logger(std::function<void(std::uint32_t, const char*)> logger)
{
logger_ = std::move(logger);
}
void set_logger(std::function<void(std::uint32_t, const char*)> logger) { logger_ = std::move(logger); }
// `status` is the hook's back-channel, for the render-stream view. With
// `debug_details` on, the per-stream table is shown.
@@ -46,50 +35,26 @@ public:
// loopback mirror were running with long status/reason strings -- without a live
// AudioMirror, so the fit test can measure the panel's worst-case size. Never set in
// the shipping host (the render path is identical, just fed synthetic values).
void dev_set_demo(bool on)
{
demo_ = on;
}
void dev_set_demo(bool on) { demo_ = on; }
#ifdef COOP_TEST_HARNESS
// Test-harness hooks (debug builds only): drive the real audio code paths and read
// state back, incl. targeting a windowless process by pid (coop_tone has no window).
void dev_set_enabled(bool on)
{
enabled_ = on;
}
void dev_set_pid(DWORD pid)
{
dev_pid_ = pid;
}
void dev_request_op(unsigned slot, std::uint32_t kind, std::uint32_t rate, std::uint32_t ch,
std::uint32_t bits, std::uint32_t tag)
void dev_set_enabled(bool on) { enabled_ = on; }
void dev_set_pid(DWORD pid) { dev_pid_ = pid; }
void dev_request_op(unsigned slot, std::uint32_t kind, std::uint32_t rate, std::uint32_t ch, std::uint32_t bits,
std::uint32_t tag)
{
mirror_.request_op(slot, kind, rate, ch, bits, tag);
}
[[nodiscard]] bool dev_running() const
{
return mirror_.running();
}
[[nodiscard]] unsigned dev_rate() const
{
return mirror_.sample_rate();
}
[[nodiscard]] unsigned dev_channels() const
{
return mirror_.channels();
}
[[nodiscard]] std::string dev_source() const
{
return mirror_.source_name();
}
[[nodiscard]] std::string dev_reason() const
{
return mirror_.fallback_reason();
}
[[nodiscard]] bool dev_running() const { return mirror_.running(); }
[[nodiscard]] unsigned dev_rate() const { return mirror_.sample_rate(); }
[[nodiscard]] unsigned dev_channels() const { return mirror_.channels(); }
[[nodiscard]] std::string dev_source() const { return mirror_.source_name(); }
[[nodiscard]] std::string dev_reason() const { return mirror_.fallback_reason(); }
#endif
private:
private:
// Auto-apply a stored override over a guessed stream, and auto-save a format the hook
// caught exactly at Initialize (warning if it overwrites a differing stored value).
void manage_overrides(const HookStatusView& status, DWORD pid);
@@ -114,7 +79,7 @@ private:
// flickers. Instead we remember when each stream last advanced and debounce the
// live/idle indicator over a short window, plus a ~2 Hz frames/s estimate.
std::uint64_t prev_frames_[kMaxAudioStreams] = {};
double last_active_[kMaxAudioStreams] = {}; // ImGui time a stream last advanced
double last_active_[kMaxAudioStreams] = {}; // ImGui time a stream last advanced
std::uint64_t rate_base_frames_[kMaxAudioStreams] = {};
double frames_per_s_[kMaxAudioStreams] = {};
double rate_base_time_ = 0.0;