mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-06-16 13:51:51 +00:00
Don't lie to our own clickpad heuristics when overriding the controller type
This commit is contained in:
@@ -2984,7 +2984,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte type = MoonBridge.LI_CTYPE_UNKNOWN;
|
byte type;
|
||||||
switch (inputDevice.getVendorId()) {
|
switch (inputDevice.getVendorId()) {
|
||||||
case 0x045e: // Microsoft
|
case 0x045e: // Microsoft
|
||||||
type = MoonBridge.LI_CTYPE_XBOX;
|
type = MoonBridge.LI_CTYPE_XBOX;
|
||||||
@@ -3067,10 +3067,15 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
capabilities |= MoonBridge.LI_CCAP_GYRO;
|
capabilities |= MoonBridge.LI_CCAP_GYRO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override the detected controller type if we're emulating motion sensors on an Xbox controller
|
byte reportedType;
|
||||||
if (type != MoonBridge.LI_CTYPE_PS && sensorManager != null) {
|
if (type != MoonBridge.LI_CTYPE_PS && sensorManager != null) {
|
||||||
|
// Override the detected controller type if we're emulating motion sensors on an Xbox controller
|
||||||
Toast.makeText(activityContext, activityContext.getResources().getText(R.string.toast_controller_type_changed), Toast.LENGTH_LONG).show();
|
Toast.makeText(activityContext, activityContext.getResources().getText(R.string.toast_controller_type_changed), Toast.LENGTH_LONG).show();
|
||||||
type = MoonBridge.LI_CTYPE_UNKNOWN;
|
reportedType = MoonBridge.LI_CTYPE_UNKNOWN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Report the true type to the host PC if we're not emulating motion sensors
|
||||||
|
reportedType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We can perform basic rumble with any vibrator
|
// We can perform basic rumble with any vibrator
|
||||||
@@ -3093,7 +3098,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
}
|
}
|
||||||
|
|
||||||
conn.sendControllerArrivalEvent((byte)controllerNumber, getActiveControllerMask(),
|
conn.sendControllerArrivalEvent((byte)controllerNumber, getActiveControllerMask(),
|
||||||
type, supportedButtonFlags, capabilities);
|
reportedType, supportedButtonFlags, capabilities);
|
||||||
|
|
||||||
// After reporting arrival to the host, send initial battery state and begin monitoring
|
// After reporting arrival to the host, send initial battery state and begin monitoring
|
||||||
backgroundThreadHandler.post(batteryStateUpdateRunnable);
|
backgroundThreadHandler.post(batteryStateUpdateRunnable);
|
||||||
|
|||||||
Reference in New Issue
Block a user