distribution/packages/apps/portmaster/sources/control.txt

95 lines
2.2 KiB
Text
Raw Normal View History

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2023-present JELOS (https://github.com/JustEnoughLinuxOS)
2023-12-08 15:41:03 +00:00
# This file can and should be sourced by ports for various parameters to
2023-11-10 00:08:15 +00:00
# minimize script customizations and allow for easier future updates
# like adding additional supported devices.
2023-12-08 15:41:03 +00:00
# Thanks to JohnnyonFlame, dhwz, romadu, and shantigilbert for the
2023-11-10 00:08:15 +00:00
# suggestion and assistance with this.
# Source used for gptokeyb available at
# https://github.com/christianhaitian/gptokeyb
# Source used for oga_controls available at
# https://github.com/christianhaitian/oga_controls
. /etc/profile
2023-11-10 00:08:15 +00:00
directory="roms"
controlfolder="/$directory/ports/PortMaster"
ESUDO=""
2023-11-13 22:15:01 +00:00
ESUDOKILL="-1"
SDLDBUSERFILE="/storage/.config/SDL-GameControllerDB/gamecontrollerdb.txt"
clibs="/usr/lib/compat/"
2023-11-10 00:08:15 +00:00
raloc="/usr/bin"
raconf="--config /storage/.config/retroarch/retroarch.cfg"
2023-12-05 15:25:48 +00:00
case "${QUIRK_DEVICE}" in
2023-11-10 00:08:15 +00:00
"Anbernic RG552")
profile="rg552"
2023-11-13 22:15:01 +00:00
lres="N"
sticks="2"
2023-11-10 00:08:15 +00:00
;;
"Hardkernel ODROID-GO-Ultra"|"Powkiddy RGB10 MAX 3")
profile="s922x"
2023-11-13 22:15:01 +00:00
lres="N"
sticks="2"
2023-11-10 00:08:15 +00:00
;;
"Powkiddy x55")
profile="x55"
2023-11-13 22:15:01 +00:00
lres="N"
sticks="2"
2023-11-10 00:08:15 +00:00
;;
2023-11-13 22:15:01 +00:00
"Anbernic RG351M")
2023-11-10 00:08:15 +00:00
profile="anbernic"
2023-11-13 22:15:01 +00:00
lres="Y"
sticks="2"
;;
"Anbernic RG351V")
profile="anbernic"
lres="N"
sticks="1"
2023-11-10 00:08:15 +00:00
;;
2023-11-13 17:15:48 +00:00
"ODROID-GO Advance*"|"Powkiddy RGB10")
2023-11-10 00:08:15 +00:00
profile="oga"
2023-11-13 22:15:01 +00:00
lres="Y"
sticks="1"
2023-11-10 00:08:15 +00:00
;;
"ODROID-GO Super")
profile="ogs"
2023-11-13 22:15:01 +00:00
lres="N"
sticks="2"
2023-11-10 00:08:15 +00:00
;;
*)
profile="rg552"
2023-11-13 22:15:01 +00:00
lres="N"
sticks="2"
2023-11-10 00:08:15 +00:00
;;
esac
get_controls() {
2023-11-13 22:15:01 +00:00
ANALOGSTICKS="${sticks}"
LOWRES="${lres}"
2023-11-10 00:08:15 +00:00
param_device="${profile}"
2024-01-13 02:18:35 +00:00
# Extract GUID of current input
GUID=$(control-gen | awk 'BEGIN {FS="\""} /^DEVICE/ {print $2;exit}')
2023-11-10 00:08:15 +00:00
# Set file
export SDL_GAMECONTROLLERCONFIG_FILE="/tmp/gamecontrollerdb.txt"
2024-01-13 02:18:35 +00:00
# Now find any controller mapped on emulationstation...
/storage/.config/PortMaster/mapper.txt ${SDL_GAMECONTROLLERCONFIG_FILE}
# Set compatability libs and run compatability script
export LD_LIBRARY_PATH=${clibs}
2023-11-10 00:08:15 +00:00
# Some ports want SDL_GAMECONTROLLERCONFIG, so let's fill it in
sdl_controllerconfig="$(< "${SDL_GAMECONTROLLERCONFIG_FILE}")"
}
GPTOKEYB="$ESUDO $controlfolder/gptokeyb $ESUDOKILL"