diff --git a/Common/VR/PPSSPPVR.cpp b/Common/VR/PPSSPPVR.cpp index 21fd41ea1e..7daf981e26 100644 --- a/Common/VR/PPSSPPVR.cpp +++ b/Common/VR/PPSSPPVR.cpp @@ -254,6 +254,7 @@ void UpdateVRInput(bool haptics, float dp_xscale, float dp_yscale) { keyInput.deviceId = controllerIds[j]; //process the key action + if (m.pressed != pressed) { if (pressed && haptics) { INVR_Vibrate(100, j, 1000); @@ -446,7 +447,8 @@ void UpdateVRInput(bool haptics, float dp_xscale, float dp_yscale) { mousePressed = pressed; } - //mouse wheel emulation + // mouse wheel emulation + // TODO: Spams key-up events if nothing changed! for (int j = 0; j < 2; j++) { keyInput.deviceId = controllerIds[j]; float scroll = -IN_VRGetJoystickState(j).y; diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index cbc4628b43..bcacf3f4d6 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -360,6 +360,13 @@ bool KeyMappingNewKeyDialog::key(const KeyInput &key) { } } if (key.flags & KEY_UP) { + // If the key released wasn't part of the mapping, ignore it here. Some device can cause + // stray key-up events. + InputMapping upMapping(key.deviceId, key.keyCode); + if (!mapping_.mappings.contains(upMapping)) { + return true; + } + if (callback_) callback_(mapping_); TriggerFinish(DR_YES); @@ -391,7 +398,9 @@ bool KeyMappingNewMouseKeyDialog::key(const KeyInput &key) { } mapped_ = true; + MultiInputMapping kdf(InputMapping(key.deviceId, key.keyCode)); + TriggerFinish(DR_YES); g_Config.bMapMouse = false; if (callback_)