mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-02-16 10:30:47 +00:00
Handle "--trigger-as-button" option from xboxdrv
This commit is contained in:
committed by
Iwan Timmer
parent
d61532799a
commit
161175b866
@@ -150,6 +150,8 @@ public class EvdevConstants {
|
||||
|
||||
public static final short ABS_THROTTLE = 0x06;
|
||||
public static final short ABS_RUDDER = 0x07;
|
||||
public static final short BTN_THROTTLE = 311;
|
||||
public static final short BTN_RUDDER = 312;
|
||||
|
||||
public static final short BTN_SOUTH = 0x130;
|
||||
public static final short BTN_EAST = 0x131;
|
||||
|
||||
@@ -135,11 +135,17 @@ public class EvdevHandler implements Runnable {
|
||||
conn.sendMouseButtonDown(mouseButton);
|
||||
else if (value==EvdevConstants.KEY_RELEASED)
|
||||
conn.sendMouseButtonUp(mouseButton);
|
||||
} else if (gamepadButton>0) {
|
||||
if (value==EvdevConstants.KEY_PRESSED) {
|
||||
buttonFlags |= gamepadButton;
|
||||
} else if (value==EvdevConstants.KEY_RELEASED){
|
||||
buttonFlags &= ~gamepadButton;
|
||||
} else {
|
||||
if (gamepadButton != 0) {
|
||||
if (value==EvdevConstants.KEY_PRESSED) {
|
||||
buttonFlags |= gamepadButton;
|
||||
} else if (value==EvdevConstants.KEY_RELEASED){
|
||||
buttonFlags &= ~gamepadButton;
|
||||
}
|
||||
} else if (code==mapping.btn_throttle) {
|
||||
leftTrigger = (byte) (value==EvdevConstants.KEY_PRESSED ? -1 : 0);
|
||||
} else if (code==mapping.btn_rudder) {
|
||||
rightTrigger = (byte) (value==EvdevConstants.KEY_PRESSED ? -1 : 0);
|
||||
}
|
||||
conn.sendControllerInput(buttonFlags, leftTrigger, rightTrigger, leftStickX, leftStickY, rightStickX, rightStickY);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ public class GamepadMapping {
|
||||
|
||||
public short abs_throttle = EvdevConstants.ABS_THROTTLE;
|
||||
public short abs_rudder = EvdevConstants.ABS_RUDDER;
|
||||
public short btn_throttle = EvdevConstants.BTN_THROTTLE;
|
||||
public short btn_rudder = EvdevConstants.BTN_RUDDER;
|
||||
|
||||
public boolean reverse_x, reverse_y;
|
||||
public boolean reverse_rx, reverse_ry;
|
||||
|
||||
Reference in New Issue
Block a user