From fda564e180322d804edccf325375c7c7a20763eb Mon Sep 17 00:00:00 2001 From: Tovarichtch Date: Sat, 9 Nov 2024 18:13:13 -0500 Subject: [PATCH] add fusion light gun (pigs firmware) Firmware 1.05 "P.I.G.S." from Fusion Lightgun. --- .../99-fusion-lightguns.rules | 21 ++- .../fusion-lightguns/fusion-lightguns-add | 137 +++++++++++++++++- 2 files changed, 146 insertions(+), 12 deletions(-) diff --git a/package/batocera/controllers/guns/fusion-lightguns/99-fusion-lightguns.rules b/package/batocera/controllers/guns/fusion-lightguns/99-fusion-lightguns.rules index 840962008a4..7da4aec7615 100755 --- a/package/batocera/controllers/guns/fusion-lightguns/99-fusion-lightguns.rules +++ b/package/batocera/controllers/guns/fusion-lightguns/99-fusion-lightguns.rules @@ -9,16 +9,23 @@ SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Mini P SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Mini P2 Mouse", ENV{ID_INPUT_JOYSTICK}="0", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 2" # Piggie p1 firmware -SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 1 Keyboard", ENV{ID_INPUT_JOYSTICK}="0", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 1" -SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 1 Mouse", ENV{ID_INPUT_JOYSTICK}="0", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 1" +SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 1 Keyboard", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 3" +SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 1 Mouse", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 3" # Piggie p2 firmware -SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 2 Keyboard", ENV{ID_INPUT_JOYSTICK}="0", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 2" -SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 2 Mouse", ENV{ID_INPUT_JOYSTICK}="0", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 2" +SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 2 Keyboard", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 4" +SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 2 Mouse", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 4" -# Gamepad event must be disabled on Piggie firmware just like OpenFIRE firmware, this mode is unsupported for now -SUBSYSTEM=="input", ACTION=="add", ATTRS{name}=="Fusion Piggie 1", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_JOYSTICK}="0" -SUBSYSTEM=="input", ACTION=="add", ATTRS{name}=="Fusion Piggie 2", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_JOYSTICK}="0" +# Piggie p3 firmware +SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 3 Keyboard", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 5" +SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 3 Mouse", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 5" + +# Piggie p4 firmware +SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 4 Keyboard", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 6" +SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Piggie 4 Mouse", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_KEY}="0", RUN+="/usr/bin/fusion-lightguns-add 6" + +# Gamepad event must be disabled on Piggie firmware, this mode is unsupported for now +SUBSYSTEM=="input", ACTION=="add", ATTRS{name}=="Fusion Piggie [0-9]", ENV{ID_INPUT_MOUSE}="0", ENV{ID_INPUT_JOYSTICK}="0" # virtual lightgun SUBSYSTEM=="input", KERNEL=="event*", ACTION=="add", ATTRS{name}=="Fusion Lightgun", MODE="0666", ENV{ID_INPUT_JOYSTICK}="0", ENV{ID_INPUT_GUN}="1", ENV{ID_INPUT_KEYBOARD}="0", ENV{ID_INPUT_KEY}="0", ENV{ID_INPUT_MOUSE}="1" diff --git a/package/batocera/controllers/guns/fusion-lightguns/fusion-lightguns-add b/package/batocera/controllers/guns/fusion-lightguns/fusion-lightguns-add index 163042f5072..524dc3fba2d 100755 --- a/package/batocera/controllers/guns/fusion-lightguns/fusion-lightguns-add +++ b/package/batocera/controllers/guns/fusion-lightguns/fusion-lightguns-add @@ -37,11 +37,11 @@ trylock() { trylock checkRunningPIDAndExit1 -CHILDREN=$(evsieve-helper children "${PARENTHASH}" input usb) | grep -vE "Fusion Piggie( 1| 2)") # remove the joystick from the event cause it duplicates events +CHILDREN=$(evsieve-helper children "${PARENTHASH}" input usb) | grep -vE "Fusion Piggie [1-4]") # remove the joystick from the event cause it duplicates events NDEVS=$(echo "${CHILDREN}" | wc -l) ############ -# Player 1 +# Player 1 (1.00 firmware) ############ # Trigger : BTN_LEFT # L button 1 (Bomb) : BTN_MIDDLE @@ -53,7 +53,7 @@ NDEVS=$(echo "${CHILDREN}" | wc -l) # Calibration button : BTN_EXTRA (mouse 5) # D-pad : KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT ############ -# Player 2 +# Player 2 (1.00 firmware) ############ # Trigger : BTN_LEFT # L button 1 (Bomb) : BTN_MIDDLE @@ -65,6 +65,59 @@ NDEVS=$(echo "${CHILDREN}" | wc -l) # Calibration button : BTN_EXTRA (mouse 5) # D-pad : KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT +############ +############ +# P.I.G.S. 1.05 firmware +# (based on OpenFIRE) +# +# Player 1 +############ +# Trigger : BTN_LEFT +# Pump : BTN_RIGHT +# Pedal : BTN_MIDDLE +# A : KEY_ENTER +# B : KEY_ESC +# C (calibration) : BTN_EXTRA +# Start : KEY_1 +# Select : KEY_5 +# D-pad : KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT +############ +# Player 2 +############ +# Trigger : BTN_LEFT +# Pump : BTN_RIGHT +# Pedal : BTN_MIDDLE +# A : KEY_W +# B : KEY_BACKSPACE +# C : BTN_EXTRA +# Start : KEY_2 +# Select : KEY_6 +# D-pad : KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT +############ +# Player 3 +############ +# Trigger : BTN_LEFT +# Pump : BTN_RIGHT +# Pedal : BTN_MIDDLE +# A : KEY_A +# B : KEY_PAGEUP +# C : BTN_EXTRA +# Start : KEY_3 +# Select : KEY_7 +# D-pad : KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT +############ +# Player 4 +############ +# Trigger : BTN_LEFT +# Pump : BTN_RIGHT +# Pedal : BTN_MIDDLE +# A : KEY_S +# B : KEY_PAGEDOWN +# C : BTN_EXTRA +# Start : KEY_4 +# Select : KEY_8 +# D-pad : KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT + if test "${NDEVS}" = 2 then DEV1=$(echo "${CHILDREN}" | head -1 | cut -f 1) @@ -72,12 +125,86 @@ then if test "${PLAYER}" = "1" then - nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right --map yield key:1 btn:middle --map yield key:5 btn:1 --map yield key:enter btn:2 --map yield key:esc btn:3 --map yield key:up btn:5 --map yield key:down btn:6 --map yield key:left btn:7 --map yield key:right btn:8 --output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" & + nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right + --map yield key:1 btn:middle + --map yield key:5 btn:1 + --map yield key:enter btn:2 + --map yield key:esc btn:3 + --map yield key:up btn:5 + --map yield key:down btn:6 + --map yield key:left btn:7 + --map yield key:right btn:8 + --output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" & fi if test "${PLAYER}" = "2" then - nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right --map yield key:2 btn:middle --map yield key:6 btn:1 --map yield key:leftshift btn:2 --map yield key:leftctrl btn:3 --map yield key:up btn:5 --map yield key:down btn:6 --map yield key:left btn:7 --map yield key:right btn:8 --output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" & + nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right + --map yield key:2 btn:middle + --map yield key:6 btn:1 + --map yield key:leftshift btn:2 + --map yield key:leftctrl btn:3 + --map yield key:up btn:5 + --map yield key:down btn:6 + --map yield key:left btn:7 + --map yield key:right btn:8 + --output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" & + fi + + if test "${PLAYER}" = "3" + then + nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right + --map yield key:1 btn:middle + --map yield key:5 btn:1 + --map yield key:enter btn:2 + --map yield key:esc btn:3 + --map yield key:up btn:5 + --map yield key:down btn:6 + --map yield key:left btn:7 + --map yield key:right btn:8 + --output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" & + fi + + if test "${PLAYER}" = "4" + then + nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right + --map yield key:2 btn:middle + --map yield key:6 btn:1 + --map yield key:w btn:2 + --map yield key:backspace btn:3 + --map yield key:up btn:5 + --map yield key:down btn:6 + --map yield key:left btn:7 + --map yield key:right btn:8 + --output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" & + fi + + if test "${PLAYER}" = "5" + then + nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right + --map yield key:3 btn:middle + --map yield key:7 btn:1 + --map yield key:a btn:2 + --map yield key:pageup btn:3 + --map yield key:up btn:5 + --map yield key:down btn:6 + --map yield key:left btn:7 + --map yield key:right btn:8 + --output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" & + fi + + if test "${PLAYER}" = "6" + then + nohup evsieve --input "${DEV1}" "${DEV2}" persist=exit --map yield btn:middle btn:right + --map yield key:4 btn:middle + --map yield key:8 btn:1 + --map yield key:s btn:2 + --map yield key:pagedown btn:3 + --map yield key:up btn:5 + --map yield key:down btn:6 + --map yield key:left btn:7 + --map yield key:right btn:8 + --output name="Fusion Lightgun" >/dev/null 2>"${LOGFILE}" & fi echo $! > "${PIDFILE}"