mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-22 02:39:05 +02:00
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) <noreply@anthropic.com>
This commit is contained in:
1 parent
03457d559b
commit
598645db08
1 file changed
+12
-3
+12
-3
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user