aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett Brown <themagnificentmrb@gmail.com>2024-06-26 22:38:45 -0700
committerGarrett Brown <themagnificentmrb@gmail.com>2024-07-05 15:29:41 -0700
commit04b710232ea16ec1ccf4f9a40b66bedf535ccef1 (patch)
tree88c7236447ab338e1cffce269c58ebcfc0b6f920
parent87004879cc1d242314de07b5c83a9fd574901c0e (diff)
Android: Prevent duplicate mapping of surjective keys
-rw-r--r--xbmc/platform/android/peripherals/AndroidJoystickState.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/xbmc/platform/android/peripherals/AndroidJoystickState.cpp b/xbmc/platform/android/peripherals/AndroidJoystickState.cpp
index 9e622d4d73..3b1099dd3b 100644
--- a/xbmc/platform/android/peripherals/AndroidJoystickState.cpp
+++ b/xbmc/platform/android/peripherals/AndroidJoystickState.cpp
@@ -469,6 +469,10 @@ bool CAndroidJoystickState::MapButton(JOYSTICK::IButtonMap& buttonMap, int butto
if (controllerButton.empty())
return false;
+ // Check if feature is already mapped
+ if (buttonMap.GetFeatureType(controllerButton) != JOYSTICK::FEATURE_TYPE::UNKNOWN)
+ return false;
+
// Map the button
CLog::Log(LOGDEBUG, "Automatically mapping {} to {}", controllerButton,
buttonPrimitive.ToString());