mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-02-16 10:30:47 +00:00
Added deadzone for left/right sticks
This commit is contained in:
committed by
Iwan Timmer
parent
161175b866
commit
06fb196b6a
@@ -157,13 +157,13 @@ public class EvdevHandler implements Runnable {
|
||||
conn.sendMouseMove((short) 0, (short) value);
|
||||
} else if (type==EvdevConstants.EV_ABS) {
|
||||
if (code==mapping.abs_x)
|
||||
leftStickX = absLX.getShort(value);
|
||||
leftStickX = accountForDeadzone(absLX.getShort(value));
|
||||
else if (code==mapping.abs_y)
|
||||
leftStickY = absLY.getShort(value);
|
||||
leftStickY = accountForDeadzone(absLY.getShort(value));
|
||||
else if (code==mapping.abs_rx)
|
||||
rightStickX = absRX.getShort(value);
|
||||
rightStickX = accountForDeadzone(absRX.getShort(value));
|
||||
else if (code==mapping.abs_ry)
|
||||
rightStickY = absRY.getShort(value);
|
||||
rightStickY = accountForDeadzone(absRY.getShort(value));
|
||||
else if (code==mapping.abs_throttle)
|
||||
leftTrigger = absLT.getByte(value);
|
||||
else if (code==mapping.abs_rudder)
|
||||
@@ -198,6 +198,14 @@ public class EvdevHandler implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
private short accountForDeadzone(short value) {
|
||||
if (Math.abs(value) > mapping.abs_deadzone) {
|
||||
return value;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
@@ -18,6 +18,8 @@ public class GamepadMapping {
|
||||
public short abs_rx = EvdevConstants.ABS_RX;
|
||||
public short abs_ry = EvdevConstants.ABS_RY;
|
||||
|
||||
public short abs_deadzone = 0;
|
||||
|
||||
public short abs_dpad_y = -1;
|
||||
public short abs_dpad_x = -1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user