Move input polling to its own thread; fixed-width fast-changing UI numbers

Input thread: controller polling, pad publishing, and rumble forwarding were
driven by the render loop, so a low/synced frame rate throttled how often guest
input reached the game. New InputWorker owns the InputSource and runs poll +
IPC publish + rumble on a dedicated ~1 kHz thread, independent of rendering. The
UI thread reads a copy-safe InputSnapshot for the Controllers panel and relays the
Steam-Input request/active/failed state to/from the worker (Steam init/shutdown now
happen on the worker thread). IpcServer gained a mutex so the worker's publish() /
hook_status() can't race the UI thread starting/stopping the shared-memory channel
(use-after-unmap); InjectionPanel::test_input_ is now atomic. ControllersPanel::draw
takes an InputSnapshot instead of the live InputSource.

Fixed-width numbers: fast-changing readouts (menu-bar FPS/ms, Video pipeline rates +
latency + graph legend, controller poll rates + round-trip sticks, audio buffered ms
+ frames/s) printed with %.0f etc., so they shifted/blurred as values crossed digit
thresholds (99 -> 100) each frame. Padded them to fixed field widths so they stay put.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 12:51:00 +02:00
parent feb8fc5dae
commit 4121ad4373
14 changed files with 299 additions and 78 deletions

View File

@@ -77,7 +77,7 @@ void AudioPanel::draw_ui(const HookStatusView& status, bool debug_details)
ImGui::SameLine();
ImGui::TextColored(hooked ? ImVec4(0.4f, 1.0f, 0.4f, 1.0f) : ImVec4(1.0f, 0.8f, 0.3f, 1.0f), "%s",
mirror_.source_name());
ImGui::Text("Buffered: %u ms", mirror_.buffered_ms());
ImGui::Text("Buffered: %4u ms", mirror_.buffered_ms());
}
const std::string mirror_status = mirror_.status();
if (!mirror_status.empty())
@@ -176,7 +176,7 @@ void AudioPanel::draw_ui(const HookStatusView& status, bool debug_details)
{
ImGui::TextColored(ImVec4(0.4f, 1.0f, 0.4f, 1.0f), "live");
ImGui::SameLine();
ImGui::TextDisabled("%.0f/s", frames_per_s_[i]);
ImGui::TextDisabled("%6.0f/s", frames_per_s_[i]);
}
else
{