From 460ceadcc30907d6aadc890dec4913fc94490b7c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 9 Oct 2021 16:12:54 -0700 Subject: [PATCH] Android: Prioritize PAD devices. --- android/src/org/ppsspp/ppsspp/InputDeviceState.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/android/src/org/ppsspp/ppsspp/InputDeviceState.java b/android/src/org/ppsspp/ppsspp/InputDeviceState.java index 972920712f..c7dd18d7f0 100644 --- a/android/src/org/ppsspp/ppsspp/InputDeviceState.java +++ b/android/src/org/ppsspp/ppsspp/InputDeviceState.java @@ -28,13 +28,15 @@ public class InputDeviceState { public InputDeviceState(InputDevice device) { int sources = device.getSources(); - if ((sources & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD && device.getKeyboardType() == InputDevice.KEYBOARD_TYPE_ALPHABETIC) { + // First, anything that's a gamepad is a gamepad, even if it has a keyboard or pointer. + if ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) { + this.deviceId = NativeApp.DEVICE_ID_PAD_0; + } else if ((sources & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD && device.getKeyboardType() == InputDevice.KEYBOARD_TYPE_ALPHABETIC) { this.deviceId = NativeApp.DEVICE_ID_KEYBOARD; } else if ((sources & InputDevice.SOURCE_CLASS_POINTER) == InputDevice.SOURCE_CLASS_POINTER) { this.deviceId = NativeApp.DEVICE_ID_MOUSE; - } else if (((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD || - (sources & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK || - (sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD)) { + } else if ((sources & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK || + (sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) { this.deviceId = NativeApp.DEVICE_ID_PAD_0; } else { // Built-in buttons like Back etc.