Commit Graph
60 Commits
Author SHA1 Message Date
Henrik Rydgård 9315c0953a GamepadEmu: bounds-check touch pointer IDs before use
TouchInput::id was used directly to index the global primaryButton[]
array (MultiTouchButton::Touch) and to shift pointer bitmasks
(PSPDpad/PSPStick/PSPCustomStick/GestureGamepad::Touch), guarded only
by a debug-only assert in one of the five call sites - a no-op in
release builds. input.id isn't always a small sequential slot in
[0, TOUCH_MAX_POINTERS): SDL assigns SDL_FingerID values directly,
Android pointer IDs can go up to 31, and UWP's TouchMapper allocates
one more slot (11) than TOUCH_MAX_POINTERS (10) and can also return -1
when it runs out of slots - all reachable through ordinary multi-touch
use, no malicious input required.

Also apply bounds check to the PER_GAME gesture config ints
(iDoubleTapGesture/iSwipeUp/Down/Left/Right) before indexing
GestureKey::keyList[] with them.

Additionally, minor cleanup on Android and moves the TouchMapper helper
out from UWP to InputState.h.
2026-08-12 09:47:13 +02:00
Henrik RydgårdandClaude Sonnet 5 7ff9fbdb47 InputMapping: fix OOB access, reject DEVICE_ID_ANY mappings
FromConfigString() indexed parts[0]/parts[1] from SplitString() with
no check that at least 2 parts were produced - a malformed/truncated
line in a hand-edited controls.ini (no '-') was an OOB vector access.

Separately, DEVICE_ID_ANY (-1) didn't round-trip correctly:
ToConfigString() formats it as e.g. "-1-5", but splitting that on '-'
produces "", "1", "5" instead of "-1", "5" - deviceId decoded to 0 and
keyCode to 1 instead of 5. Rather than special-casing the negative
sign to make it round-trip, just reject DEVICE_ID_ANY mappings
outright - it's not something we want to support, and the whole ANY
concept is likely going away. Preserves the existing (tested) behavior
of tolerating a MultiInputMapping string and parsing just its first
mapping, via atoi()'s stop-at-first-non-digit behavior.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L4QAoxV2KY7ek4PcZw3WvY
2026-08-09 21:41:54 +02:00
Henrik Rydgård 8cd7e1b2c0 Delete all support for Qt
Our Qt backend has long been left behind and doesn't even support Vulkan
currently. There would be a lot of work to make it viable, and I don't
think anyone is really interested.

ImGui on SDL will soon fulfill the need for a more classic user interface
with a menu bar on Linux, and on Mac we already have a native UI.
2026-08-08 18:18:28 +02:00
Henrik Rydgård 78f80a0010 Some tweaks to avoid name collisions in upcoming commits 2026-07-10 12:11:17 +02:00
Henrik Rydgård 2c0f562ff5 ScrollView: Don't have drags of the "opposite" orientation cancel clicks. 2026-05-10 23:41:39 +02:00
Henrik Rydgård f38c851383 Add support for "Meta" modifier (command key on Mac, Win key on windows, etc) 2026-04-27 20:46:48 +02:00
Henrik Rydgård 9f1e0eadd0 Support Ctrl+Tab / Ctrl+Shift+Tab to switch tabs in the UI 2026-04-16 13:28:35 -06:00
Henrik Rydgård 7c4fb8b084 Add basic modifier key tracking to UIScreen 2026-04-16 13:28:35 -06:00
Henrik Rydgård c953814fe0 ScrollView: Make it easier to press-and-hold buttons without cancelling 2026-02-26 10:37:12 +01:00
Henrik Rydgård 7fa52a0916 Fix problem with confirm button set to O.
Fixes #21042
2026-02-13 22:08:28 +01:00
Henrik Rydgård 5d4ac87b2b In PopupMultiChoice lists, indicate the selected item with a checkmark
See #21223
2026-02-09 14:35:34 +01:00
Henrik Rydgård 77ec5c7c50 Buildfixes 2025-12-19 16:20:30 +01:00
Henrik Rydgård 18a67b82d2 Do the same with KeyInputFlags. Fix minor UI misalignments 2025-12-19 13:41:58 +01:00
Henrik Rydgård 481d0fd18c Switch TouchInputFlags to enum class, fix some minor UI issues
Scroll views now only wheel-scroll if the mouse is hovering over them.
2025-12-19 11:38:56 +01:00
Henrik Rydgård 263d0b3983 SDL: Fix bug where the mouse got stuck in relative mode when mapping mouse inputs 2025-07-10 20:29:24 +02:00
Henrik Rydgård eadd32e00a Keycodes: Restore the old PrintScreen keymapping, fixing mistake from #19656
Fixes #20588
2025-07-08 14:03:04 +02:00
Henrik Rydgård 7ee999e424 Qt: Don't forget the mouse flags 2025-03-05 23:26:30 +01:00
Henrik Rydgård a431560831 Remove pretense of supporting the Ouya (we don't anymore) 2025-02-24 15:57:38 -06:00
Henrik Rydgård 928854ffd3 Hold only the first button, allow other buttons to toggle with dragging as normal. 2025-02-14 12:40:44 -06:00
Henrik Rydgård 8372105d66 Fix printscreen keyboard mapping (although kinda useless) 2024-11-25 23:40:51 +01:00
Henrik Rydgård dff7f5704a Implement mousewheel vertical scroll and hover in ImGui integration 2024-11-06 22:00:11 +01:00
Henrik Rydgård 19f4b22a56 Cleanup, add right-click support to UI framework 2024-11-05 01:03:21 +01:00
Herman Semenov 4ef014cb73 [Common] Fixes from Unknown W. Brackets: <checkins@unknownbrackets.org> 2024-09-18 11:11:25 +02:00
Herman Semenov 45429bcd85 [Common/Data/File/Input/Net/Serialize/System/UI] Using for based loop C++17 and replaced on structured binding map C++17 2024-09-17 17:42:08 +02:00
Henrik Rydgård eccd7f3767 More const/static-ification 2024-09-17 15:22:37 +02:00
Lubos f56f696386 OpenXR - Cleanup 2024-08-08 12:35:45 +02:00
Henrik Rydgård 126d88ecfc Back out clearly inconsequential/useless .reserve() calls 2023-12-29 08:27:56 +01:00
Herman Semenov b8748ae9e5 [Common/File/GPU/Render/Input] Using reserve if possible 2023-12-15 14:00:51 +03:00
Herman Semenov 5a0d54be83 [Common/Data/GPU/Input/System/UI] Added const reference for function params 2023-12-14 14:21:11 +03:00
Henrik Rydgård 19eeaef2ea More uses of string_view 2023-11-13 23:36:34 +01:00
Henrik Rydgård 2910303d20 Clean up the checks for triangle-button-for-info on the main screen 2023-11-13 12:49:08 +01:00
Henrik Rydgård c28dc9e4f2 Pass in accelerometer readings using NativeAccelerometer instead of NativeAxis 2023-09-27 11:34:31 +02:00
Unknown W. Brackets cec9dbbdf7 Build: Add some missing include guards. 2023-09-07 17:14:58 -07:00
Henrik Rydgård be2f81c3eb Controls: Make the analog/digital mapping clash resolution more gentle.
Now takes the time into account, so clashing digital input will only shrink
analog inputs once it's a few seconds old.

Also fixes a bug where if there are both inputs, it was hard to reach
the limits because the digital input itself ended up getting shrunk.

This might help #17860
2023-08-23 18:51:27 +02:00
Henrik Rydgård b9327073bb Add checkbox controlling if new mappings can be combo mappings.
These can be problematic with certain controllers that send double
signals. Like PS4 controllers on Android, the analog triggers send dual
axis events, and additionally digital events.
2023-07-07 10:42:08 +02:00
Henrik Rydgård 2675d6ea43 Input event and device enums (#17514)
* Switch deviceID from int to enum InputDeviceID, globally

* Switch axisId to enum InputAxis

* Change int keycodes to InputKeyCode where it makes sense.

* SDL input buildfix

* SDL keycode buildfix

* Switch on enum warning fixes

* Qt keycode buildfix

* iOS keycode buildfix

* UWP keycode buildfix

* More iOS buildfix

* More iOS buildfix

* Update DinputDevice.cpp
2023-05-26 18:40:13 +02:00
Henrik Rydgård c037f6731d Better (but not great) workaround for key bindings that pop up dialogs. 2023-05-02 21:36:17 +02:00
Henrik Rydgård 5a82e58564 Buildfix 2023-04-01 17:59:37 +02:00
Henrik Rydgård 49a2c93b66 Make multi-mapping save-able, add test to verify backwards and forwards compat 2023-04-01 13:51:00 +02:00
Henrik Rydgård 0e1c42ce70 Plumb multimappings all the way through. 2023-04-01 13:50:57 +02:00
Henrik Rydgård 2428051f17 buildfix 2023-03-31 20:35:22 +02:00
Henrik Rydgård 48993f4f4b Control: Add debug display, do assorted fixes. 2023-03-31 20:12:48 +02:00
Henrik Rydgård 778d9ac5ca Handle mapping signed axis to our only unsigned input, VIRTKEY_SPEED_ANALOG. 2023-03-31 11:05:33 +02:00
Henrik Rydgård 38f4cc4cc9 Make reverse mapping lookup work for the simple PSP buttons. 2023-03-31 11:05:29 +02:00
Henrik Rydgård 416c09034b Minor header cleanup 2023-03-29 12:03:03 +02:00
Henrik Rydgård d00809ae53 Rename KeyDef to InputMapping and give it responsibility for Axis encoding 2023-03-29 11:59:31 +02:00
Henrik Rydgård 88fe4799a5 UI: Fix weird misbehavior dragging outside a popup dialog
Fixes #17107
2023-03-24 00:11:49 +01:00
Henrik Rydgård 102607a6e8 Code style fixes, translation key fix, cleanup 2023-02-01 14:24:55 +01:00
Sergey P bf2cabb82c merge from upstream 2023-02-01 13:33:07 +03:00
Sergey P 64f1e5ed61 range checks 2023-02-01 13:26:17 +03:00