Use the mode (power) button on the Asus Nexus Player Gamepad as a select button

This commit is contained in:
Cameron Gutman 2015-02-05 16:06:55 -05:00
parent 47265d0d10
commit b1ea487e22

View File

@ -262,6 +262,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener {
boolean[] hasStartKey = dev.hasKeys(KeyEvent.KEYCODE_BUTTON_START, KeyEvent.KEYCODE_MENU, 0); boolean[] hasStartKey = dev.hasKeys(KeyEvent.KEYCODE_BUTTON_START, KeyEvent.KEYCODE_MENU, 0);
if (!hasStartKey[0] && !hasStartKey[1]) { if (!hasStartKey[0] && !hasStartKey[1]) {
context.backIsStart = true; context.backIsStart = true;
context.modeIsSelect = true;
} }
} }
@ -426,10 +427,18 @@ public class ControllerHandler implements InputManager.InputDeviceListener {
// Ensure that we never use back as start if we have a real start // Ensure that we never use back as start if we have a real start
context.backIsStart = false; context.backIsStart = false;
} }
else if (keyCode == KeyEvent.KEYCODE_BUTTON_SELECT) {
// Don't use mode as select if we have a select
context.modeIsSelect = false;
}
else if (context.backIsStart && keyCode == KeyEvent.KEYCODE_BACK) { else if (context.backIsStart && keyCode == KeyEvent.KEYCODE_BACK) {
// Emulate the start button with back // Emulate the start button with back
return KeyEvent.KEYCODE_BUTTON_START; return KeyEvent.KEYCODE_BUTTON_START;
} }
else if (context.modeIsSelect && keyCode == KeyEvent.KEYCODE_BUTTON_MODE) {
// Emulate the select button with mode
return KeyEvent.KEYCODE_BUTTON_SELECT;
}
return keyCode; return keyCode;
} }
@ -789,6 +798,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener {
public boolean isDualShock4; public boolean isDualShock4;
public boolean isXboxController; public boolean isXboxController;
public boolean backIsStart; public boolean backIsStart;
public boolean modeIsSelect;
public boolean isRemote; public boolean isRemote;
public boolean hasJoystickAxes; public boolean hasJoystickAxes;