From eda1e9b9c648bf26c098b0401fa9a5e0981cd1eb Mon Sep 17 00:00:00 2001 From: Raidennrl <121409056+Raidennrl@users.noreply.github.com> Date: Wed, 14 Oct 2026 10:56:17 -0700 Subject: [PATCH] Fix wired PowerA and PDP right-stick and trigger mapping (#692) Fix wired PowerA and PDP stick and trigger axes Co-authored-by: xXJsonDeruloXx --- .../droiddeck/launcher/input/PadBridge.java | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java b/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java index 99ed0152..fdaf5bee 100644 --- a/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java +++ b/app/src/main/java/com/droiddeck/launcher/input/PadBridge.java @@ -19,6 +19,7 @@ public final class PadBridge { private static final float DEAD_ZONE = 0.12f; private static final int[] JOYSTICK_AXES = { MotionEvent.AXIS_X, MotionEvent.AXIS_Y, MotionEvent.AXIS_Z, MotionEvent.AXIS_RZ, + MotionEvent.AXIS_RX, MotionEvent.AXIS_RY, MotionEvent.AXIS_HAT_X, MotionEvent.AXIS_HAT_Y, MotionEvent.AXIS_LTRIGGER, MotionEvent.AXIS_RTRIGGER, MotionEvent.AXIS_BRAKE, MotionEvent.AXIS_GAS }; @@ -276,12 +277,27 @@ public final class PadBridge { scheduleStats(); pad.leftX = axis(event, MotionEvent.AXIS_X); pad.leftY = axis(event, MotionEvent.AXIS_Y); - pad.rightX = axis(event, MotionEvent.AXIS_Z); - pad.rightY = axis(event, MotionEvent.AXIS_RZ); - float lt = event.getAxisValue(MotionEvent.AXIS_LTRIGGER); - float rt = event.getAxisValue(MotionEvent.AXIS_RTRIGGER); - if (lt == 0f) lt = event.getAxisValue(MotionEvent.AXIS_BRAKE); - if (rt == 0f) rt = event.getAxisValue(MotionEvent.AXIS_GAS); + InputDevice device = event.getDevice(); + boolean wiredXboxLayout = device != null + && ((device.getVendorId() == 0x20d6 && device.getProductId() == 0x2063) + || (device.getVendorId() == 0x0e6f && device.getProductId() == 0x02f0)) + && device.getMotionRange(MotionEvent.AXIS_RX, event.getSource()) != null + && device.getMotionRange(MotionEvent.AXIS_RY, event.getSource()) != null + && device.getMotionRange(MotionEvent.AXIS_Z, event.getSource()) != null + && device.getMotionRange(MotionEvent.AXIS_RZ, event.getSource()) != null; + pad.rightX = axis(event, wiredXboxLayout ? MotionEvent.AXIS_RX : MotionEvent.AXIS_Z); + pad.rightY = axis(event, wiredXboxLayout ? MotionEvent.AXIS_RY : MotionEvent.AXIS_RZ); + float lt; + float rt; + if (wiredXboxLayout) { + lt = Math.max(0f, Math.min(1f, (event.getAxisValue(MotionEvent.AXIS_Z) + 1f) / 2f)); + rt = Math.max(0f, Math.min(1f, (event.getAxisValue(MotionEvent.AXIS_RZ) + 1f) / 2f)); + } else { + lt = event.getAxisValue(MotionEvent.AXIS_LTRIGGER); + rt = event.getAxisValue(MotionEvent.AXIS_RTRIGGER); + if (lt == 0f) lt = event.getAxisValue(MotionEvent.AXIS_BRAKE); + if (rt == 0f) rt = event.getAxisValue(MotionEvent.AXIS_GAS); + } pad.leftTrigger = lt; pad.rightTrigger = rt; float hatX = event.getAxisValue(MotionEvent.AXIS_HAT_X);