diff --git a/app/src/main/java/com/limelight/binding/input/ControllerHandler.java b/app/src/main/java/com/limelight/binding/input/ControllerHandler.java
index 40d24b2c..d83b0c27 100644
--- a/app/src/main/java/com/limelight/binding/input/ControllerHandler.java
+++ b/app/src/main/java/com/limelight/binding/input/ControllerHandler.java
@@ -991,6 +991,21 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
return keyCode;
}
+ private int handleFlipFaceButtons(int keyCode) {
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_BUTTON_A:
+ return KeyEvent.KEYCODE_BUTTON_B;
+ case KeyEvent.KEYCODE_BUTTON_B:
+ return KeyEvent.KEYCODE_BUTTON_A;
+ case KeyEvent.KEYCODE_BUTTON_X:
+ return KeyEvent.KEYCODE_BUTTON_Y;
+ case KeyEvent.KEYCODE_BUTTON_Y:
+ return KeyEvent.KEYCODE_BUTTON_X;
+ default:
+ return keyCode;
+ }
+ }
+
private Vector2d populateCachedVector(float x, float y) {
// Reinitialize our cached Vector2d object
inputVector.initialize(x, y);
@@ -1256,6 +1271,11 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
}
int keyCode = handleRemapping(context, event);
+
+ if (prefConfig.flipFaceButtons) {
+ keyCode = handleFlipFaceButtons(keyCode);
+ }
+
if (keyCode == 0) {
return true;
}
@@ -1417,6 +1437,11 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
}
int keyCode = handleRemapping(context, event);
+
+ if (prefConfig.flipFaceButtons) {
+ keyCode = handleFlipFaceButtons(keyCode);
+ }
+
if (keyCode == 0) {
return true;
}
diff --git a/app/src/main/java/com/limelight/preferences/PreferenceConfiguration.java b/app/src/main/java/com/limelight/preferences/PreferenceConfiguration.java
index 6b204437..4991c9e1 100644
--- a/app/src/main/java/com/limelight/preferences/PreferenceConfiguration.java
+++ b/app/src/main/java/com/limelight/preferences/PreferenceConfiguration.java
@@ -41,6 +41,7 @@ public class PreferenceConfiguration {
static final String UNLOCK_FPS_STRING = "checkbox_unlock_fps";
private static final String VIBRATE_OSC_PREF_STRING = "checkbox_vibrate_osc";
private static final String VIBRATE_FALLBACK_PREF_STRING = "checkbox_vibrate_fallback";
+ private static final String FLIP_FACE_BUTTONS_PERF_STRING = "checkbox_flip_face_buttons";
static final String DEFAULT_RESOLUTION = "720p";
static final String DEFAULT_FPS = "60";
@@ -67,6 +68,7 @@ public class PreferenceConfiguration {
private static final boolean DEFAULT_UNLOCK_FPS = false;
private static final boolean DEFAULT_VIBRATE_OSC = true;
private static final boolean DEFAULT_VIBRATE_FALLBACK = false;
+ private static final boolean DEFAULT_FLIP_FACE_BUTTONS = false;
private static final String DEFAULT_AUDIO_CONFIG = "2"; // Stereo
public static final int FORCE_H265_ON = -1;
@@ -80,7 +82,7 @@ public class PreferenceConfiguration {
public int oscOpacity;
public boolean stretchVideo, enableSops, playHostAudio, disableWarnings;
public String language;
- public boolean listMode, smallIconMode, multiController, usbDriver;
+ public boolean listMode, smallIconMode, multiController, usbDriver, flipFaceButtons;
public boolean onscreenController;
public boolean onlyL3R3;
public boolean disableFrameDrop;
@@ -368,6 +370,7 @@ public class PreferenceConfiguration {
config.unlockFps = prefs.getBoolean(UNLOCK_FPS_STRING, DEFAULT_UNLOCK_FPS);
config.vibrateOsc = prefs.getBoolean(VIBRATE_OSC_PREF_STRING, DEFAULT_VIBRATE_OSC);
config.vibrateFallbackToDevice = prefs.getBoolean(VIBRATE_FALLBACK_PREF_STRING, DEFAULT_VIBRATE_FALLBACK);
+ config.flipFaceButtons = prefs.getBoolean(FLIP_FACE_BUTTONS_PERF_STRING, DEFAULT_FLIP_FACE_BUTTONS);
return config;
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 3a328cb2..22d6ba9f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -154,6 +154,8 @@
Long pressing the Start button will switch the gamepad into mouse mode
Enable back and forward mouse buttons
Enabling this option may break right clicking on some buggy devices
+ Flip face buttons
+ Checking this inverts the face buttons A/B and X/Y
On-screen Controls Settings
Show on-screen controls
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index bc854332..c9271a11 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -89,6 +89,11 @@
android:title="@string/title_checkbox_vibrate_fallback"
android:summary="@string/summary_checkbox_vibrate_fallback"
android:defaultValue="false" />
+