From f0f573273dc98208e818247d36099e0e8960f71b Mon Sep 17 00:00:00 2001 From: Justin Travis Date: Wed, 17 Aug 2022 03:27:56 +0000 Subject: [PATCH] Resolve KASM-1991 "Feature/ gamepad support" --- .../gamepad_utils/install_gamepad_utils.sh | 16 +- src/ubuntu/install/zsnes/install_zsnes.sh | 5 + src/ubuntu/install/zsnes/zinput.cfg | 184 ++++++++++++++++++ 3 files changed, 202 insertions(+), 3 deletions(-) create mode 100644 src/ubuntu/install/zsnes/zinput.cfg diff --git a/src/ubuntu/install/gamepad_utils/install_gamepad_utils.sh b/src/ubuntu/install/gamepad_utils/install_gamepad_utils.sh index c0068c8..ce79466 100644 --- a/src/ubuntu/install/gamepad_utils/install_gamepad_utils.sh +++ b/src/ubuntu/install/gamepad_utils/install_gamepad_utils.sh @@ -2,6 +2,16 @@ set -ex apt-get update -apt-get install -y gimp -cp /usr/share/applications/gimp.desktop $HOME/Desktop/ -chmod +x $HOME/Desktop/gimp.desktop \ No newline at end of file +apt-get install -y joystick jstest-gtk + +ARCH=$(arch | sed 's/aarch64/arm64/g' | sed 's/x86_64/amd64/g') + +if [ "${ARCH}" == "amd64" ] ; then + wget -q -O /tmp/gamepadtool.deb https://generalarcade.com/gamepadtool/linux/gamepadtool_1.2_amd64.deb + apt-get install -y /tmp/gamepadtool.deb + rm /tmp/gamepadtool.deb +fi + + +apt-get autoclean +rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/src/ubuntu/install/zsnes/install_zsnes.sh b/src/ubuntu/install/zsnes/install_zsnes.sh index 98a56c4..885aeae 100644 --- a/src/ubuntu/install/zsnes/install_zsnes.sh +++ b/src/ubuntu/install/zsnes/install_zsnes.sh @@ -4,5 +4,10 @@ dpkg --add-architecture i386 apt-get update apt-get install -y zsnes +mkdir $HOME/.zsnes +SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )" +SCRIPT_PATH="$(realpath $SCRIPT_PATH)" +cp ${SCRIPT_PATH}/zinput.cfg $HOME/.zsnes/zinput.cfg +chown -R 1000:1000 $HOME/.zsnes \ No newline at end of file diff --git a/src/ubuntu/install/zsnes/zinput.cfg b/src/ubuntu/install/zsnes/zinput.cfg new file mode 100644 index 0000000..ae539db --- /dev/null +++ b/src/ubuntu/install/zsnes/zinput.cfg @@ -0,0 +1,184 @@ +; PSR-produced config file (stock default in CAPS) + +; Note, if you're worried you messed up a setting, removing the line will have +; ZSNES use the default settings for that option. +; The next time ZSNES is run, the line will reappear with the default settings. + +; ---- +; -- Input -- +; ---- + +; Player 1 Input +; Input Device: 0 = Unplugged, 1 = KEYBOARD/GAMEPAD +pl1contrl=1 +; Keys for Select, Start, Up, Down, Left, Right, X, A, L, Y, B, R +pl1selk=272 +pl1startk=273 +pl1upk=259 +pl1downk=258 +pl1leftk=257 +pl1rightk=256 +pl1Xk=267 +pl1Ak=265 +pl1Lk=268 +pl1Yk=266 +pl1Bk=264 +pl1Rk=269 +; Turbo Keys for A, B, X, Y, L, R +pl1Atk=0 +pl1Btk=0 +pl1Xtk=0 +pl1Ytk=0 +pl1Ltk=0 +pl1Rtk=0 +; Diagonal Keys for Up-Left, Up-Right, Down-Left, Down-Right +pl1ULk=0 +pl1URk=0 +pl1DLk=0 +pl1DRk=0 + +; Player 2 +; Input Device: 0 = UNPLUGGED, 1 = Keyboard/Gamepad +pl2contrl=1 +; Keys for Select, Start, Up, Down, Left, Right, X, A, L, Y, B, R +pl2selk=297 +pl2startk=298 +pl2upk=284 +pl2downk=283 +pl2leftk=282 +pl2rightk=281 +pl2Xk=292 +pl2Ak=290 +pl2Lk=293 +pl2Yk=291 +pl2Bk=289 +pl2Rk=294 +; Turbo Keys for A, B, X, Y, L, R +pl2Atk=0 +pl2Btk=0 +pl2Xtk=0 +pl2Ytk=0 +pl2Ltk=0 +pl2Rtk=0 +; Diagonal Keys for Up-Left, Up-Right, Down-Left, Down-Right +pl2ULk=0 +pl2URk=0 +pl2DLk=0 +pl2DRk=0 + +; Player 3 +; Input Device: 0 = UNPLUGGED, 1 = Keyboard/Gamepad +pl3contrl=1 +; Keys for Select, Start, Up, Down, Left, Right, X, A, L, Y, B, R +pl3selk=322 +pl3startk=323 +pl3upk=309 +pl3downk=308 +pl3leftk=307 +pl3rightk=306 +pl3Xk=317 +pl3Ak=315 +pl3Lk=318 +pl3Yk=316 +pl3Bk=314 +pl3Rk=319 +; Turbo Keys for A, B, X, Y, L, R +pl3Atk=0 +pl3Btk=0 +pl3Xtk=0 +pl3Ytk=0 +pl3Ltk=0 +pl3Rtk=0 +; Diagonal Keys for Up-Left, Up-Right, Down-Left, Down-Right +pl3ULk=0 +pl3URk=0 +pl3DLk=0 +pl3DRk=0 + +; Player 4 +; Input Device: 0 = UNPLUGGED, 1 = Keyboard/Gamepad +pl4contrl=1 +; Keys for Select, Start, Up, Down, Left, Right, X, A, L, Y, B, R +pl4selk=347 +pl4startk=348 +pl4upk=334 +pl4downk=333 +pl4leftk=332 +pl4rightk=331 +pl4Xk=342 +pl4Ak=340 +pl4Lk=343 +pl4Yk=341 +pl4Bk=339 +pl4Rk=344 +; Turbo Keys for A, B, X, Y, L, R +pl4Atk=0 +pl4Btk=0 +pl4Xtk=0 +pl4Ytk=0 +pl4Ltk=0 +pl4Rtk=0 +; Diagonal Keys for Up-Left, Up-Right, Down-Left, Down-Right +pl4ULk=0 +pl4URk=0 +pl4DLk=0 +pl4DRk=0 + +; Player 5 +; Input Device: 0 = UNPLUGGED, 1 = Keyboard/Gamepad +pl5contrl=0 +; Keys for Select, Start, Up, Down, Left, Right, X, A, L, Y, B, R +pl5selk=0 +pl5startk=0 +pl5upk=0 +pl5downk=0 +pl5leftk=0 +pl5rightk=0 +pl5Xk=0 +pl5Ak=0 +pl5Lk=0 +pl5Yk=0 +pl5Bk=0 +pl5Rk=0 +; Turbo Keys for A, B, X, Y, L, R +pl5Atk=0 +pl5Btk=0 +pl5Xtk=0 +pl5Ytk=0 +pl5Ltk=0 +pl5Rtk=0 +; Diagonal Keys for Up-Left, Up-Right, Down-Left, Down-Right +pl5ULk=0 +pl5URk=0 +pl5DLk=0 +pl5DRk=0 + +; Joystick Sensitivity [0..32767] +; Change this value if you have input issues. Higher value = less sensitive. +; If your joystick is not being read at all, try 128 or other low values. +joy_sensitivity=16384 + +; Share Player 3 & 4 Control Inputs w/Player 1 & 2 (0 = DISABLE, 1 = Enable) +; Allow 2 devices to be used for one player +; (enabling this disables Multiplayer 5 support). +pl12s34=0 + +; Allow Up+Down and Left+Right Pad Input (0 = NO, 1 = Yes) +AllowUDLR=0 + +; Turbo Keys Equal 30 Presses/sec Instead of 60 (0 = No, 1 = YES) +Turbo30hz=1 + +; Left Handed Mouse Behavior for SNES Devices (0 = NO SWAP, 1 = Swap) +; (swap left and right mouse buttons) +mouse1lh=0 ;First device +mouse2lh=0 ;Second device + +; Super Scope Buttons +SSAutoFire=13 +SSPause=14 + +; Port 1 and Port 2 device settings (0 = GAMEPAD, 1 = Mouse) +device1=0 +; (0 = GAMEPAD, 1 = Mouse, 2 = Super Scope, 3 = 1 Justifier, 4 = 2 Justifiers) +device2=0