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:
@@ -256,7 +256,7 @@ void InjectionPanel::reattach()
|
||||
|
||||
void InjectionPanel::publish(const std::array<PadInfo, kMaxPads>& pads)
|
||||
{
|
||||
if (!test_input_)
|
||||
if (!test_input_.load(std::memory_order_relaxed))
|
||||
{
|
||||
server_.publish(pads);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user