2023-11-10 00:08:15 +00:00
|
|
|
# This file can and should be sourced by ports for various parameters to
|
|
|
|
# minimize script customizations and allow for easier future updates
|
|
|
|
# like adding additional supported devices.
|
|
|
|
# Thanks to JohnnyonFlame, dhwz, romadu, and shantigilbert for the
|
|
|
|
# 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
|
|
|
|
|
|
|
|
directory="roms"
|
|
|
|
controlfolder="/$directory/ports/PortMaster"
|
|
|
|
ESUDO=""
|
2023-11-13 22:15:01 +00:00
|
|
|
ESUDOKILL="-1"
|
2023-11-14 16:36:59 +00:00
|
|
|
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-11-13 17:15:48 +00:00
|
|
|
pdevice=$(tr -d '\0' </sys/firmware/devicetree/base/model 2>/dev/null)
|
2023-11-10 00:08:15 +00:00
|
|
|
|
|
|
|
case ${pdevice} in
|
|
|
|
"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}"
|
|
|
|
|
2023-11-14 16:36:59 +00:00
|
|
|
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"
|
|
|
|
|
2023-11-14 16:36:59 +00:00
|
|
|
# Spit the controller of the device our heuristics found (if it did).
|
|
|
|
if [[ ! -z ${GUID} ]]; then
|
|
|
|
grep "${SDLDBUSERFILE}" -e "${GUID}" > /tmp/gamecontrollerdb.txt
|
|
|
|
else
|
|
|
|
echo "" > /tmp/gamecontrollerdb.txt
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set compatability libs
|
|
|
|
#export LD_LIBRARY_PATH=${clibs}
|
|
|
|
|
2023-11-10 00:08:15 +00:00
|
|
|
# Now find any controller mapped on emulationstation...
|
2023-11-13 22:15:01 +00:00
|
|
|
/storage/.config/PortMaster/mapper.txt SDL_GAMECONTROLLERCONFIG_FILE > /dev/null 2>&1
|
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"
|