mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-21 07:50:11 +00:00
Fix DS4 clickpad button on Nvidia Shield (again)
This commit is contained in:
@@ -717,6 +717,13 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
context.hasJoystickAxes = true;
|
context.hasJoystickAxes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is hack to deal with the Nvidia Shield's modifications that causes the DS4 clickpad
|
||||||
|
// to work as a duplicate Select button instead of a unique button we can handle separately.
|
||||||
|
context.isDualShockStandaloneTouchpad =
|
||||||
|
context.vendorId == 0x054c && // Sony
|
||||||
|
devName.endsWith(" Touchpad") &&
|
||||||
|
dev.getSources() == (InputDevice.SOURCE_KEYBOARD | InputDevice.SOURCE_MOUSE);
|
||||||
|
|
||||||
InputDevice.MotionRange leftTriggerRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_LTRIGGER);
|
InputDevice.MotionRange leftTriggerRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_LTRIGGER);
|
||||||
InputDevice.MotionRange rightTriggerRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RTRIGGER);
|
InputDevice.MotionRange rightTriggerRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_RTRIGGER);
|
||||||
InputDevice.MotionRange brakeRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_BRAKE);
|
InputDevice.MotionRange brakeRange = getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_BRAKE);
|
||||||
@@ -1245,11 +1252,12 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
// The Shield's key layout files map the DualShock 4 clickpad button to
|
// The Shield's key layout files map the DualShock 4 clickpad button to
|
||||||
// BUTTON_SELECT instead of something sane like BUTTON_1 as the standard AOSP
|
// BUTTON_SELECT instead of something sane like BUTTON_1 as the standard AOSP
|
||||||
// mapping does. If we get a button from a Sony device reported as BUTTON_SELECT
|
// mapping does. If we get a button from a Sony device reported as BUTTON_SELECT
|
||||||
// that matches the keycode used by hid-sony for the clickpad, remap it to
|
// that matches the keycode used by hid-sony for the clickpad or it's from the
|
||||||
// BUTTON_1 to match the current AOSP layout and trigger our touchpad button logic.
|
// separate touchpad input device, remap it to BUTTON_1 to match the current AOSP
|
||||||
|
// layout and trigger our touchpad button logic.
|
||||||
if (context.vendorId == 0x054c &&
|
if (context.vendorId == 0x054c &&
|
||||||
event.getKeyCode() == KeyEvent.KEYCODE_BUTTON_SELECT &&
|
event.getKeyCode() == KeyEvent.KEYCODE_BUTTON_SELECT &&
|
||||||
event.getScanCode() == 317) {
|
(event.getScanCode() == 317 || context.isDualShockStandaloneTouchpad)) {
|
||||||
return KeyEvent.KEYCODE_BUTTON_1;
|
return KeyEvent.KEYCODE_BUTTON_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2809,6 +2817,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
public boolean ignoreBack;
|
public boolean ignoreBack;
|
||||||
public boolean hasJoystickAxes;
|
public boolean hasJoystickAxes;
|
||||||
public boolean pendingExit;
|
public boolean pendingExit;
|
||||||
|
public boolean isDualShockStandaloneTouchpad;
|
||||||
|
|
||||||
public int emulatingButtonFlags = 0;
|
public int emulatingButtonFlags = 0;
|
||||||
public boolean hasSelect;
|
public boolean hasSelect;
|
||||||
|
|||||||
Reference in New Issue
Block a user