mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-10 18:06:10 +00:00
Add hack to work around https://issuetracker.google.com/issues/163120692
This commit is contained in:
@@ -107,6 +107,8 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
defaultContext.rightStickDeadzoneRadius = (float) stickDeadzone;
|
defaultContext.rightStickDeadzoneRadius = (float) stickDeadzone;
|
||||||
defaultContext.leftTriggerAxis = MotionEvent.AXIS_BRAKE;
|
defaultContext.leftTriggerAxis = MotionEvent.AXIS_BRAKE;
|
||||||
defaultContext.rightTriggerAxis = MotionEvent.AXIS_GAS;
|
defaultContext.rightTriggerAxis = MotionEvent.AXIS_GAS;
|
||||||
|
defaultContext.hatXAxis = MotionEvent.AXIS_HAT_X;
|
||||||
|
defaultContext.hatYAxis = MotionEvent.AXIS_HAT_Y;
|
||||||
defaultContext.controllerNumber = (short) 0;
|
defaultContext.controllerNumber = (short) 0;
|
||||||
defaultContext.assignedControllerNumber = true;
|
defaultContext.assignedControllerNumber = true;
|
||||||
defaultContext.external = false;
|
defaultContext.external = false;
|
||||||
@@ -194,6 +196,13 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HACK for https://issuetracker.google.com/issues/163120692
|
||||||
|
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
|
||||||
|
if (device.getId() == -1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Otherwise, we'll try anything that claims to be a non-alphabetic keyboard
|
// Otherwise, we'll try anything that claims to be a non-alphabetic keyboard
|
||||||
return device.getKeyboardType() != InputDevice.KEYBOARD_TYPE_ALPHABETIC;
|
return device.getKeyboardType() != InputDevice.KEYBOARD_TYPE_ALPHABETIC;
|
||||||
}
|
}
|
||||||
@@ -703,6 +712,13 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HACK for https://issuetracker.google.com/issues/163120692
|
||||||
|
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
|
||||||
|
if (event.getDeviceId() == -1) {
|
||||||
|
return defaultContext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Return the existing context if it exists
|
// Return the existing context if it exists
|
||||||
InputDeviceContext context = inputDeviceContexts.get(event.getDeviceId());
|
InputDeviceContext context = inputDeviceContexts.get(event.getDeviceId());
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user