mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-06-16 22:01:14 +00:00
Add support for Xbox One S controller connected via Bluetooth
This commit is contained in:
@@ -395,6 +395,10 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
context.isServal = true;
|
context.isServal = true;
|
||||||
context.ignoreBack = true;
|
context.ignoreBack = true;
|
||||||
}
|
}
|
||||||
|
// The Xbox One S Bluetooth controller has some mappings that need fixing up
|
||||||
|
else if (devName.equals("Xbox Wireless Controller")) {
|
||||||
|
context.isXboxBtController = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LimeLog.info("Analog stick deadzone: "+context.leftStickDeadzoneRadius+" "+context.rightStickDeadzoneRadius);
|
LimeLog.info("Analog stick deadzone: "+context.leftStickDeadzoneRadius+" "+context.rightStickDeadzoneRadius);
|
||||||
@@ -558,6 +562,30 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
return KeyEvent.KEYCODE_BUTTON_START;
|
return KeyEvent.KEYCODE_BUTTON_START;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (context.isXboxBtController) {
|
||||||
|
switch (event.getScanCode()) {
|
||||||
|
case 306:
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_X;
|
||||||
|
case 307:
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_Y;
|
||||||
|
case 308:
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_L1;
|
||||||
|
case 309:
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_R1;
|
||||||
|
case 310:
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_SELECT;
|
||||||
|
case 311:
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_START;
|
||||||
|
case 312:
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_THUMBL;
|
||||||
|
case 313:
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_THUMBR;
|
||||||
|
case 139:
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_MODE;
|
||||||
|
default:
|
||||||
|
// Other buttons are mapped correctly
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (context.hatXAxis != -1 && context.hatYAxis != -1) {
|
if (context.hatXAxis != -1 && context.hatYAxis != -1) {
|
||||||
switch (event.getKeyCode()) {
|
switch (event.getKeyCode()) {
|
||||||
@@ -1047,6 +1075,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
|
|
||||||
public boolean isDualShock4;
|
public boolean isDualShock4;
|
||||||
public boolean isXboxController;
|
public boolean isXboxController;
|
||||||
|
public boolean isXboxBtController;
|
||||||
public boolean isServal;
|
public boolean isServal;
|
||||||
public boolean backIsStart;
|
public boolean backIsStart;
|
||||||
public boolean modeIsSelect;
|
public boolean modeIsSelect;
|
||||||
|
|||||||
Reference in New Issue
Block a user