From 598645db08aaae77fb4e564eb9c9b8552430455e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 21 Oct 2026 14:22:38 +0200 Subject: [PATCH] Input: Let mapped volume keys reach the menus, and consume them in game A recent input refactor made NativeKey return false for volume keys before queueing them, so mapping them to L/R (handy on a phone without a controller) stopped working in the menus, and in game the OS changed the volume as well. In the menus they still change the volume too. Unmapped volume keys go to the OS only, as before. Co-Authored-By: Claude Opus 5.5 (1M context) --- UI/NativeApp.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index ae16f3c8c3..c087499e55 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -1637,12 +1637,18 @@ bool NativeKey(const KeyInput &key) { g_controlMapper.Key(key); } - // Ignore volume keys and stuff here - though we do send them through to the control mapper, so they can be mapped to PSP buttons. + // Leave volume keys to the OS, unless they're mapped (to L/R for example). Then they also reach the menus, + // and in game we consume them, repeats included, so the OS doesn't change the volume as well. + bool mappedVolumeKey = false; switch (key.keyCode) { case NKCODE_VOLUME_DOWN: case NKCODE_VOLUME_UP: case NKCODE_VOLUME_MUTE: - return false; + if (!KeyMap::InputMappingToPspButton(InputMapping(key.deviceId, key.keyCode), nullptr)) { + return false; + } + mappedVolumeKey = true; + break; default: break; } @@ -1713,7 +1719,7 @@ bool NativeKey(const KeyInput &key) { retval = false; break; case UI::KeyEventResult::IGNORE_KEY: - return false; + return mappedVolumeKey && (inputMode & InputMode::Other); } // Queue up the key event for synchronous processing in the UI. @@ -1730,6 +1736,9 @@ bool NativeKey(const KeyInput &key) { // Tell the caller that we handled the key. retval = true; } + if (mappedVolumeKey) { + retval = inputMode & InputMode::Other; + } return retval; }