From 71b144918ca4ed90a88f6b48aa88b46bd7844259 Mon Sep 17 00:00:00 2001 From: bicarus-dev <202771338+bicarus-dev@users.noreply.github.com> Date: Wed, 17 Dec 2025 05:40:27 -0800 Subject: [PATCH] rawinput: stop iterating devices if one was found (#457) ## Link to GitHub Issue, if one exists n/a ## Description of change This would save a handful of instructions at best but it was bothering me ## Testing Tested with two controllers + naive with ddr --- src/spice2x/rawinput/rawinput.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/spice2x/rawinput/rawinput.cpp b/src/spice2x/rawinput/rawinput.cpp index 67aa629..79a595f 100644 --- a/src/spice2x/rawinput/rawinput.cpp +++ b/src/spice2x/rawinput/rawinput.cpp @@ -1498,7 +1498,7 @@ LRESULT CALLBACK rawinput::RawInputManager::input_wnd_proc( } // get input time - double input_time = get_performance_seconds(); + const auto input_time = get_performance_seconds(); // lock device device.mutex->lock(); @@ -1826,6 +1826,9 @@ LRESULT CALLBACK rawinput::RawInputManager::input_wnd_proc( // free device device.mutex->unlock(); + + // don't iterate through the other devices + break; } // update controller state ring buffers (DDR/MDXF) @@ -1924,7 +1927,7 @@ void CALLBACK rawinput::RawInputManager::input_midi_proc(HMIDIIN hMidiIn, UINT w } // get input time - auto input_time = get_performance_seconds(); + const auto input_time = get_performance_seconds(); // lock device std::lock_guard lock(*device.mutex);