Generalize UI: general status by default, diagnostics behind Debug details

Rework the spike-era debug readouts into general-purpose status, with the
verbose diagnostics gated behind the menu bar's "Debug details" switch:

- Controllers (was "Phase 0 spike"): always shows slot/source + live
  buttons; the raw stick/trigger numbers are debug-only.
- Injection hook status: general view is attached + focus spoof + a single
  "Game reading controller: N polls/s" summary; the per-slot poll table,
  focus-API counts, and input-path detection are debug-only.
- Audio: general view adds a "Buffered: N ms" health/latency proxy
  (AudioMirror now tracks buffered audio in both render paths) and keeps the
  render-stream count; the per-stream table is debug-only.

Default overlay is now clean general status; flip Debug details for the full
diagnostics. Completes the "generalize the UI" roadmap task. All tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 15:07:42 +02:00
parent b48cdd6515
commit d19974b17c
9 changed files with 79 additions and 31 deletions

View File

@@ -154,6 +154,7 @@ void AudioMirror::stop()
audio_ring_shm_.reset();
running_.store(false, std::memory_order_release);
source_.store(Source::None, std::memory_order_relaxed);
buffered_ms_.store(0, std::memory_order_relaxed);
pid_ = 0;
}
@@ -380,6 +381,8 @@ bool AudioMirror::run_hooked(AudioRingHeader* ring)
}
const UINT32 avail = render_frames - padding;
const std::uint32_t ring_bytes = audio_ring_available(*ring);
buffered_ms_.store(static_cast<unsigned>(ring_bytes / frame_bytes * 1000 / rate),
std::memory_order_relaxed);
if (!primed && ring_bytes >= prime_bytes)
{
primed = true;
@@ -571,6 +574,9 @@ void AudioMirror::run_loopback(DWORD pid)
continue;
}
const UINT32 avail = render_frames - padding;
buffered_ms_.store(
static_cast<unsigned>(ring.available() / frame_bytes * 1000 / fmt->nSamplesPerSec),
std::memory_order_relaxed);
if (!primed && ring.available() >= prime_bytes)
{
primed = true;

View File

@@ -61,6 +61,13 @@ public:
return channels_.load(std::memory_order_relaxed);
}
// Audio currently buffered between capture and the output device, in ms — a
// health/latency proxy (rises if the consumer can't keep up). 0 when stopped.
[[nodiscard]] unsigned buffered_ms() const
{
return buffered_ms_.load(std::memory_order_relaxed);
}
// Which capture path is active, for the UI's source indicator.
enum class Source
{
@@ -107,6 +114,7 @@ private:
std::atomic<Source> source_{Source::None};
std::atomic<unsigned> sample_rate_{0};
std::atomic<unsigned> channels_{0};
std::atomic<unsigned> buffered_ms_{0};
mutable std::mutex status_mutex_;
std::string status_;