mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-02-16 10:31:07 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db5b7ab867 | ||
|
|
3bcc1c84bb | ||
|
|
d46053f8d6 | ||
|
|
00a5fed9e9 | ||
|
|
b6315a715a | ||
|
|
0da8303468 | ||
|
|
c821c4684f | ||
|
|
6bae33f822 | ||
|
|
08d4ab67a6 | ||
|
|
62203d2f21 |
@@ -7,8 +7,8 @@ android {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 29
|
||||
|
||||
versionName "8.3"
|
||||
versionCode = 200
|
||||
versionName "8.4.1"
|
||||
versionCode = 203
|
||||
}
|
||||
|
||||
flavorDimensions "root"
|
||||
|
||||
@@ -425,6 +425,10 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
||||
String devName = dev.getName();
|
||||
|
||||
LimeLog.info("Creating controller context for device: "+devName);
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
|
||||
LimeLog.info("Vendor ID: "+dev.getVendorId());
|
||||
LimeLog.info("Product ID: "+dev.getProductId());
|
||||
}
|
||||
LimeLog.info(dev.toString());
|
||||
|
||||
context.name = devName;
|
||||
@@ -471,25 +475,45 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
||||
InputDevice.MotionRange rxRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RX);
|
||||
InputDevice.MotionRange ryRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RY);
|
||||
if (rxRange != null && ryRange != null && devName != null) {
|
||||
if (devName.contains("Xbox") || devName.contains("XBox") || devName.contains("X-Box")) {
|
||||
// Xbox controllers use RX and RY for right stick
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
|
||||
if (dev.getVendorId() == 0x054c) { // Sony
|
||||
if (dev.hasKeys(KeyEvent.KEYCODE_BUTTON_C)[0]) {
|
||||
LimeLog.info("Detected non-standard DualShock 4 mapping");
|
||||
context.isNonStandardDualShock4 = true;
|
||||
}
|
||||
else {
|
||||
LimeLog.info("Detected DualShock 4 (Linux standard mapping)");
|
||||
context.usesLinuxGamepadStandardFaceButtons = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!devName.contains("Xbox") && !devName.contains("XBox") && !devName.contains("X-Box")) {
|
||||
LimeLog.info("Assuming non-standard DualShock 4 mapping on < 4.4");
|
||||
context.isNonStandardDualShock4 = true;
|
||||
}
|
||||
|
||||
if (context.isNonStandardDualShock4) {
|
||||
// The old DS4 driver uses RX and RY for triggers
|
||||
context.leftTriggerAxis = MotionEvent.AXIS_RX;
|
||||
context.rightTriggerAxis = MotionEvent.AXIS_RY;
|
||||
}
|
||||
else {
|
||||
// If it's not a non-standard DS4 controller, it's probably an Xbox controller or
|
||||
// other sane controller that uses RX and RY for right stick and Z and RZ for triggers.
|
||||
context.rightStickXAxis = MotionEvent.AXIS_RX;
|
||||
context.rightStickYAxis = MotionEvent.AXIS_RY;
|
||||
|
||||
// Xbox controllers use Z and RZ for triggers
|
||||
context.leftTriggerAxis = MotionEvent.AXIS_Z;
|
||||
context.rightTriggerAxis = MotionEvent.AXIS_RZ;
|
||||
context.triggersIdleNegative = true;
|
||||
context.isXboxController = true;
|
||||
// While it's likely that Z and RZ are triggers, we may have digital trigger buttons
|
||||
// instead. We must check that we actually have Z and RZ axes before assigning them.
|
||||
if (getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_Z) != null &&
|
||||
getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RZ) != null) {
|
||||
context.leftTriggerAxis = MotionEvent.AXIS_Z;
|
||||
context.rightTriggerAxis = MotionEvent.AXIS_RZ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// DS4 controller uses RX and RY for triggers
|
||||
context.leftTriggerAxis = MotionEvent.AXIS_RX;
|
||||
context.rightTriggerAxis = MotionEvent.AXIS_RY;
|
||||
context.triggersIdleNegative = true;
|
||||
|
||||
context.isDualShock4 = true;
|
||||
}
|
||||
// Triggers always idle negative on axes that are centered at zero
|
||||
context.triggersIdleNegative = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,7 +619,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
||||
// required fixup is ignoring the select button.
|
||||
else if (devName.equals("Xbox Wireless Controller")) {
|
||||
if (gasRange == null) {
|
||||
context.isXboxBtController = true;
|
||||
context.isNonStandardXboxBtController = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -774,7 +798,21 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
||||
}
|
||||
}
|
||||
|
||||
if (context.isDualShock4) {
|
||||
if (context.usesLinuxGamepadStandardFaceButtons) {
|
||||
// Android's Generic.kl swaps BTN_NORTH and BTN_WEST
|
||||
switch (event.getScanCode()) {
|
||||
case 304:
|
||||
return KeyEvent.KEYCODE_BUTTON_A;
|
||||
case 305:
|
||||
return KeyEvent.KEYCODE_BUTTON_B;
|
||||
case 307:
|
||||
return KeyEvent.KEYCODE_BUTTON_Y;
|
||||
case 308:
|
||||
return KeyEvent.KEYCODE_BUTTON_X;
|
||||
}
|
||||
}
|
||||
|
||||
if (context.isNonStandardDualShock4) {
|
||||
switch (event.getScanCode()) {
|
||||
case 304:
|
||||
return KeyEvent.KEYCODE_BUTTON_X;
|
||||
@@ -819,7 +857,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
||||
return KeyEvent.KEYCODE_BUTTON_START;
|
||||
}
|
||||
}
|
||||
else if (context.isXboxBtController) {
|
||||
else if (context.isNonStandardXboxBtController) {
|
||||
switch (event.getScanCode()) {
|
||||
case 306:
|
||||
return KeyEvent.KEYCODE_BUTTON_X;
|
||||
@@ -1538,9 +1576,9 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
||||
public int hatXAxis = -1;
|
||||
public int hatYAxis = -1;
|
||||
|
||||
public boolean isDualShock4;
|
||||
public boolean isXboxController;
|
||||
public boolean isXboxBtController;
|
||||
public boolean isNonStandardDualShock4;
|
||||
public boolean usesLinuxGamepadStandardFaceButtons;
|
||||
public boolean isNonStandardXboxBtController;
|
||||
public boolean isServal;
|
||||
public boolean backIsStart;
|
||||
public boolean modeIsSelect;
|
||||
|
||||
@@ -191,10 +191,32 @@ public class UsbDriverService extends Service implements UsbDriverListener {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean kernelSupportsXboxOne() {
|
||||
String kernelVersion = System.getProperty("os.version");
|
||||
LimeLog.info("Kernel Version: "+kernelVersion);
|
||||
|
||||
if (kernelVersion == null) {
|
||||
// We'll assume this is some newer version of Android
|
||||
// that doesn't let you read the kernel version this way.
|
||||
return true;
|
||||
}
|
||||
else if (kernelVersion.startsWith("2.") || kernelVersion.startsWith("3.")) {
|
||||
// These are old kernels that definitely don't support Xbox One controllers properly
|
||||
return false;
|
||||
}
|
||||
else if (kernelVersion.startsWith("4.4.") || kernelVersion.startsWith("4.9.")) {
|
||||
// These aren't guaranteed to have backported kernel patches for proper Xbox One
|
||||
// support (though some devices will).
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// The next AOSP common kernel is 4.14 which has working Xbox One controller support
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean shouldClaimDevice(UsbDevice device, boolean claimAllAvailable) {
|
||||
// We always bind to XB1 controllers but only bind to XB360 controllers
|
||||
// if we know the kernel isn't already driving this device.
|
||||
return XboxOneController.canClaimDevice(device) ||
|
||||
return ((!kernelSupportsXboxOne() || !isRecognizedInputDevice(device) || claimAllAvailable) && XboxOneController.canClaimDevice(device)) ||
|
||||
((!isRecognizedInputDevice(device) || claimAllAvailable) && Xbox360Controller.canClaimDevice(device));
|
||||
}
|
||||
|
||||
|
||||
@@ -77,8 +77,12 @@ public class MediaCodecHelper {
|
||||
blacklistedDecoderPrefixes.add("AVCDecoder");
|
||||
}
|
||||
|
||||
// Never use ffmpeg decoders since they're software decoders
|
||||
blacklistedDecoderPrefixes.add("OMX.ffmpeg");
|
||||
// We want to avoid ffmpeg decoders since they're software decoders,
|
||||
// but on Android-x86 they might be all we have (and also relatively
|
||||
// performant on a modern x86 processor).
|
||||
if (!Build.BRAND.equals("Android-x86")) {
|
||||
blacklistedDecoderPrefixes.add("OMX.ffmpeg");
|
||||
}
|
||||
|
||||
// Force these decoders disabled because:
|
||||
// 1) They are software decoders, so the performance is terrible
|
||||
|
||||
Submodule app/src/main/jni/moonlight-core/moonlight-common-c updated: 7de68207f0...f988a154a3
@@ -5,7 +5,7 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.5.0'
|
||||
classpath 'com.android.tools.build:gradle:3.5.1'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
Spiele vom deinem PC auf Android spielen (nur NVIDIA)
|
||||
Spiele von deinem PC auf Android spielen (nur NVIDIA)
|
||||
|
||||
4
fastlane/metadata/android/en-US/changelogs/203.txt
Normal file
4
fastlane/metadata/android/en-US/changelogs/203.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
- Fixed DualShock 4 mapping on devices running 4.14+ kernels
|
||||
- Improved support for wired Xbox 360/One controllers
|
||||
- Fixed crash using certain controllers without analog triggers
|
||||
- Enabled streaming on Android-x86
|
||||
Reference in New Issue
Block a user