mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-06-17 06:10:58 +00:00
Add support for 8bitdo sn30 pro xCloud (#1102)
* add support for 8bitdo sn30 pro xCloud Co-authored-by: peerobo <phuongrobotics@me.com>
This commit is contained in:
@@ -520,6 +520,9 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
context.vendorId = dev.getVendorId();
|
context.vendorId = dev.getVendorId();
|
||||||
context.productId = dev.getProductId();
|
context.productId = dev.getProductId();
|
||||||
|
if (context.vendorId == 0x2dc8 && context.productId == 0x2100) {
|
||||||
|
context.is8BitdoSn30Xcloud = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && hasDualAmplitudeControlledRumbleVibrators(dev.getVibratorManager())) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && hasDualAmplitudeControlledRumbleVibrators(dev.getVibratorManager())) {
|
||||||
@@ -569,6 +572,16 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
context.leftTriggerAxis = MotionEvent.AXIS_BRAKE;
|
context.leftTriggerAxis = MotionEvent.AXIS_BRAKE;
|
||||||
context.rightTriggerAxis = MotionEvent.AXIS_THROTTLE;
|
context.rightTriggerAxis = MotionEvent.AXIS_THROTTLE;
|
||||||
}
|
}
|
||||||
|
else if (context.is8BitdoSn30Xcloud)
|
||||||
|
{
|
||||||
|
// Specific configs for 8BitDo SN30 Pro for Xbox
|
||||||
|
context.leftTriggerAxis = MotionEvent.AXIS_RX;
|
||||||
|
context.rightTriggerAxis = MotionEvent.AXIS_RY;
|
||||||
|
context.triggersIdleNegative = false;
|
||||||
|
context.triggerDeadzone = 0.30f;
|
||||||
|
context.hasSelect = true;
|
||||||
|
context.hasMode = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InputDevice.MotionRange rxRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RX);
|
InputDevice.MotionRange rxRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RX);
|
||||||
@@ -929,6 +942,14 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
if (context.vendorId == 0x2dc8 && event.getScanCode() == 306) {
|
if (context.vendorId == 0x2dc8 && event.getScanCode() == 306) {
|
||||||
return KeyEvent.KEYCODE_BUTTON_MODE;
|
return KeyEvent.KEYCODE_BUTTON_MODE;
|
||||||
}
|
}
|
||||||
|
// Override select button for 8BitDo SN30 Pro for Xbox
|
||||||
|
if (context.is8BitdoSn30Xcloud) {
|
||||||
|
switch(event.getScanCode()) {
|
||||||
|
case 312:
|
||||||
|
return KeyEvent.KEYCODE_BUTTON_SELECT;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This mapping was adding in Android 10, then changed based on
|
// This mapping was adding in Android 10, then changed based on
|
||||||
// kernel changes (adding hid-nintendo) in Android 11. If we're
|
// kernel changes (adding hid-nintendo) in Android 11. If we're
|
||||||
@@ -1960,6 +1981,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
public boolean hatXAxisUsed, hatYAxisUsed;
|
public boolean hatXAxisUsed, hatYAxisUsed;
|
||||||
|
|
||||||
public boolean isNonStandardDualShock4;
|
public boolean isNonStandardDualShock4;
|
||||||
|
public boolean is8BitdoSn30Xcloud;
|
||||||
public boolean usesLinuxGamepadStandardFaceButtons;
|
public boolean usesLinuxGamepadStandardFaceButtons;
|
||||||
public boolean isNonStandardXboxBtController;
|
public boolean isNonStandardXboxBtController;
|
||||||
public boolean isServal;
|
public boolean isServal;
|
||||||
|
|||||||
Reference in New Issue
Block a user