Merge pull request #2335 from brooksytech/dev

Switch over PortMaster to new UI
This commit is contained in:
Brooksytech 2023-11-09 16:10:23 -08:00 committed by GitHub
commit c482db7119
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 246 additions and 371 deletions

View file

@ -30,9 +30,9 @@ This document describes all available systems emulators and cores available for
|Bandai|Wonderswan (wonderswan)|1999|`wonderswan`|.ws .zip .7z|**retroarch:** beetle_wswan (default)<br>**mednafen:** wswan<br>|
|Bandai|Wonderswan Color (wonderswancolor)|2000|`wonderswancolor`|.wsc .zip .7z|**retroarch:** beetle_wswan (default)<br>**mednafen:** wswan<br>|
|belogic|Uzebox (uzebox)|2008|`uzebox`|.uze|**retroarch:** uzem (default)<br>|
|Capcom|CPS I (cps1)|1988|`cps1`|.zip .7z|**retroarch:** fbneo (default)<br>**retroarch:** mame2003_plus<br>**retroarch:** mame2010<br>**retroarch:** fbalpha2012<br>**retroarch:** mba_mini<br>**AdvanceMame:** AdvanceMame<br>|
|Capcom|CPS II (cps2)|1993|`cps2`|.zip .7z|**retroarch:** fbneo (default)<br>**retroarch:** mame2003_plus<br>**retroarch:** mame2010<br>**retroarch:** fbalpha2012<br>**retroarch:** mba_mini<br>**AdvanceMame:** AdvanceMame<br>|
|Capcom|CPS III (cps3)|1996|`cps3`|.zip .7z|**retroarch:** fbneo (default)<br>**retroarch:** mame2003_plus<br>**retroarch:** mame2010<br>**retroarch:** fbalpha2012<br>**retroarch:** mba_mini<br>**AdvanceMame:** AdvanceMame<br>|
|Capcom|CPS-I (cps1)|1988|`cps1`|.zip .7z|**retroarch:** fbneo (default)<br>**retroarch:** mame2003_plus<br>**retroarch:** mame2010<br>**retroarch:** fbalpha2012<br>**retroarch:** mba_mini<br>**AdvanceMame:** AdvanceMame<br>|
|Capcom|CPS-II (cps2)|1993|`cps2`|.zip .7z|**retroarch:** fbneo (default)<br>**retroarch:** mame2003_plus<br>**retroarch:** mame2010<br>**retroarch:** fbalpha2012<br>**retroarch:** mba_mini<br>**AdvanceMame:** AdvanceMame<br>|
|Capcom|CPS-III (cps3)|1996|`cps3`|.zip .7z|**retroarch:** fbneo (default)<br>**retroarch:** mame2003_plus<br>**retroarch:** mame2010<br>**retroarch:** fbalpha2012<br>**retroarch:** mba_mini<br>**AdvanceMame:** AdvanceMame<br>|
|Coleco|ColecoVision (colecovision)|1982|`coleco`|.bin .col .rom .zip .7z|**retroarch:** bluemsx (default)<br>**retroarch:** gearcoleco<br>**retroarch:** smsplus<br>|
|Commodore|Amiga (amiga)|1985|`amiga`|.zip .adf .uae .ipf .dms .adz .lha .m3u .hdf .hdz|**retroarch:** puae2021 (default)<br>**retroarch:** puae<br>**amiberry:** amiberry<br>**retroarch:** uae4arm<br>|
|Commodore|Amiga CD32 (amigacd32)|1994|`amigacd32`|.iso .cue .lha .chd|**retroarch:** puae2021 (default)<br>**retroarch:** puae<br>**retroarch:** uae4arm<br>|
@ -41,7 +41,7 @@ This document describes all available systems emulators and cores available for
|Commodore|Commodore 64 (c64)|1982|`c64`|.d64 .d71 .d80 .d81 .d82 .g64 .g41 .x64 .t64 .tap .prg .p00 .crt .bin .d6z .d7z .d8z .g6z .g4z .x6z .cmd .m3u .vsf .nib .nbz .zip|**retroarch:** vice_x64 (default)<br>**vicesa:** x64sc<br>|
|Commodore|Commodore PET (pet)|1977|`pet`|.20 .a0 .b0 .d64 .d71 .d80 .d81 .d82 .g64 .g41 .x64 .t64 .tap .prg .p00 .crt .bin .gz .d6z .d7z .d8z .g6z .g4z .x6z .cmd .m3u .vsf .nib .nbz .zip|**retroarch:** vice_xpet (default)<br>|
|Commodore|VIC-20 (vic20)|1980|`vic20`|.20 .a0 .b0 .d64 .d71 .d80 .d81 .d82 .g64 .g41 .x64 .t64 .tap .prg .p00 .crt .bin .gz .d6z .d7z .d8z .g6z .g4z .x6z .cmd .m3u .vsf .nib .nbz .zip|**retroarch:** vice_xvic (default)<br>**vicesa:** xvic<br>|
|Fairchild|Channel F (channelf)|1976|`channelf`|.bin .chf .zip .7z|**retroarch:** freechaf (default)<br>|
|Fairchild|Fairchild Channel F (channelf)|1976|`channelf`|.bin .chf .zip .7z|**retroarch:** freechaf (default)<br>|
|id Software|Doom (doom)|1993|`doom`|.doom|**gzdoom:** gzdoom-sa (default)<br>|
|id Software|iDtech (idtech)|1991|`idtech`|.sh|**retroarch:** idtech<br>|
|Infocom|Z-machine (zmachine)|1979|`zmachine`|.dat .z1 .z2 .z3 .z4 .z5 .z6 .zip|**retroarch:** mojozork (default)<br>|
@ -70,7 +70,6 @@ This document describes all available systems emulators and cores available for
|Nintendo|Game Boy Color (gbc)|1998|`gbc`|.gb .gbc .zip .7z|**retroarch:** gambatte (default)<br>**retroarch:** sameboy<br>**retroarch:** gearboy<br>**retroarch:** tgbdual<br>**retroarch:** mgba<br>**retroarch:** vbam<br>**mednafen:** gb<br>|
|Nintendo|Game Boy Color (Hacks) (gbch)|1998|`gbch`|.gb .gbc .zip .7z|**retroarch:** gambatte (default)<br>**retroarch:** sameboy<br>**retroarch:** gearboy<br>**retroarch:** tgbdual<br>**retroarch:** mgba<br>**retroarch:** vbam<br>**mednafen:** gb<br>|
|Nintendo|GameCube (gamecube)|2001|`gamecube`|.gcm .iso .gcz .ciso .wbfs .rvz .dol|**dolphin:** dolphin-sa-gc (default)<br>**retroarch:** dolphin<br>|
|Nintendo|MSU-1 (snesmsu1)|2012|`snesmsu1`|.smc .fig .sfc .swc .zip .7z|**retroarch:** snes9x (default)<br>**retroarch:** beetle_supafaust<br>**mednafen:** snes_faust<br>|
|Nintendo|NES (Hacks) (nesh)|1985|`nesh`|.nes .unif .unf .zip .7z|**retroarch:** nestopia (default)<br>**retroarch:** fceumm<br>**retroarch:** quicknes<br>**retroarch:** mesen<br>**mednafen:** nesh<br>|
|Nintendo|Nintendo 64 (n64)|1996|`n64`|.z64 .n64 .v64 .zip .7z|**retroarch:** mupen64plus_next (default)<br>**retroarch:** mupen64plus<br>**retroarch:** parallel_n64<br>**mupen64plus:** mupen64plus-sa<br>|
|Nintendo|Nintendo DS (nds)|2005|`nds`|.nds .zip .7z|**drastic:** drastic-sa (default)<br>**retroarch:** melonds<br>**melonds:** melonds-sa<br>**retroarch:** desmume<br>|
@ -78,6 +77,7 @@ This document describes all available systems emulators and cores available for
|Nintendo|Pokémon Mini (pokemini)|2001|`pokemini`|.min .zip .7z|**retroarch:** pokemini (default)<br>|
|Nintendo|Satellaview (satellaview)|1995|`satellaview`|.smc .fig .bs .sfc .bsx .swc .zip .7z|**retroarch:** snes9x (default)<br>**retroarch:** snes9x2010<br>**retroarch:** snes9x2002<br>**retroarch:** snes9x2005_plus<br>|
|Nintendo|Super Famicom (sfc)|1990|`sfc`|.smc .fig .sfc .swc .zip .7z|**retroarch:** snes9x (default)<br>**retroarch:** snes9x2010<br>**retroarch:** snes9x2002<br>**retroarch:** snes9x2005_plus<br>**retroarch:** beetle_supafaust<br>**retroarch:** bsnes<br>**retroarch:** bsnes_mercury_performance<br>**retroarch:** bsnes_hd_beta<br>**mednafen:** snes<br>**mednafen:** snes_faust<br>|
|Nintendo|Super NES MSU-1 (snesmsu1)|2012|`snesmsu1`|.smc .fig .sfc .swc .zip .7z|**retroarch:** snes9x (default)<br>**retroarch:** beetle_supafaust<br>**mednafen:** snes_faust<br>|
|Nintendo|Super Nintendo (Hacks) (snesh)|1991|`snesh`|.smc .fig .sfc .swc .zip .7z|**retroarch:** snes9x (default)<br>**retroarch:** snes9x2010<br>**retroarch:** snes9x2002<br>**retroarch:** snes9x2005_plus<br>**retroarch:** beetle_supafaust<br>**retroarch:** bsnes<br>**retroarch:** bsnes_mercury_performance<br>**retroarch:** bsnes_hd_beta<br>**mednafen:** snes<br>**mednafen:** snes_faust<br>|
|Nintendo|Super Nintendo (snes)|1991|`snes`|.smc .fig .sfc .swc .zip .7z|**retroarch:** snes9x (default)<br>**retroarch:** snes9x2010<br>**retroarch:** snes9x2002<br>**retroarch:** snes9x2005_plus<br>**retroarch:** beetle_supafaust<br>**retroarch:** bsnes<br>**retroarch:** bsnes_mercury_performance<br>**retroarch:** bsnes_hd_beta<br>**mednafen:** snes_faust<br>**mednafen:** snes<br>|
|Nintendo|Virtual Boy (virtualboy)|1995|`virtualboy`|.vb .zip .7z|**retroarch:** beetle_vb (default)<br>**mednafen:** vb<br>|

View file

@ -2,8 +2,9 @@
# Copyright (C) 2022-present - The JELOS Project (https://github.com/JustEnoughLinuxOS)
PKG_NAME="portmaster"
PKG_VERSION="f8adbe08805d9fe9171cb2e3078f383631d1331d"
PKG_SITE="https://github.com/christianhaitian/PortMaster"
PKG_VERSION="8.5.2_0811"
PKG_SITE="https://github.com/PortsMaster/PortMaster-GUI"
PKG_URL="${PKG_SITE}/releases/download/${PKG_VERSION}/PortMaster.zip"
PKG_LICENSE="MIT"
PKG_ARCH="arm aarch64"
PKG_DEPENDS_TARGET="toolchain gptokeyb gamecontrollerdb wget oga_controls libegl"
@ -13,12 +14,25 @@ PKG_LONGDESC="Portmaster - a simple tool that allows you to download various gam
makeinstall_target() {
export STRIP=true
mkdir -p ${INSTALL}/usr/config/PortMaster
tar -xvf ${PKG_DIR}/sources/${PKG_NAME}.tar.gz -C ${INSTALL}/usr/config/PortMaster
cp -rf ${PKG_DIR}/sources/PortMaster.sh ${INSTALL}/usr/config/PortMaster
chmod +x ${INSTALL}/usr/config/PortMaster/PortMaster.sh
cp ${PKG_DIR}/sources/* ${INSTALL}/usr/config/PortMaster/
mkdir -p ${INSTALL}/usr/bin
cp -rf ${PKG_DIR}/scripts/* ${INSTALL}/usr/bin
chmod +x ${INSTALL}/usr/bin/start_portmaster.sh
mkdir -p ${INSTALL}/usr/config/PortMaster/release
curl -Lo ${INSTALL}/usr/config/PortMaster/release/PortMaster.zip ${PKG_URL}
}
post_install() {
case ${DEVICE} in
S922X)
LIBEGL="export SDL_VIDEO_GL_DRIVER=\/usr\/lib\/egl\/libGL.so.1 SDL_VIDEO_EGL_DRIVER=\/usr\/lib\/egl\/libEGL.so.1"
;;
*)
LIBEGL=""
;;
esac
sed -e "s/@LIBEGL@/${LIBEGL}/g" \
-i ${INSTALL}/usr/bin/start_portmaster.sh
}

View file

@ -13,44 +13,35 @@ fi
cd /storage/.config/PortMaster
#Grab the latest PortMaster.sh script
cp /usr/config/PortMaster/PortMaster.sh PortMaster.sh
#Grab the latest control.txt
cp /usr/config/PortMaster/control.txt control.txt
#Use our gamecontrollerdb.txt
rm gamecontrollerdb.txt
rm -r gamecontrollerdb.txt
ln -sf /usr/config/SDL-GameControllerDB/gamecontrollerdb.txt gamecontrollerdb.txt
#Use our gptokeyb
rm gptokeyb
ln -sf /usr/bin/gptokeyb gptokeyb
cp /usr/config/PortMaster/portmaster.gptk portmaster.gptk
#Use our wget
ln -sf /usr/bin/wget wget
#Delete old PortMaster fold first (we can probably remove this later)
if [ ! -f "/storage/roms/ports/PortMaster/pugwash" ]; then
rm -r /storage/roms/ports/PortMaster
fi
#Make sure roms/ports/PortMaster folder exists
if [ ! -d "/storage/roms/ports/PortMaster" ]; then
mkdir -p "/storage/roms/ports/PortMaster"
unzip /usr/config/PortMaster/release/PortMaster.zip -d /storage/roms/ports/
chmod +x /storage/roms/ports/PortMaster/PortMaster.sh
fi
#Make sure libs the folder exists
if [ ! -d "/storage/roms/ports/PortMaster/libs" ]; then
mkdir -p "/storage/roms/ports/PortMaster/libs"
fi
#Use PortMasters gptokeyb
rm gptokeyb
cp /storage/roms/ports/PortMaster/gptokeyb gptokeyb
#Copy over required files for ports
cp /storage/.config/PortMaster/control.txt /storage/roms/ports/PortMaster/control.txt
cp /storage/.config/PortMaster/gptokeyb /storage/roms/ports/PortMaster/gptokeyb
cp /storage/.config/PortMaster/gamecontrollerdb.txt /storage/roms/ports/PortMaster/gamecontrollerdb.txt
cp /usr/bin/oga_controls* /storage/roms/ports/PortMaster/
#Delete and refrence to PortMaster.sh, we only want to use ours.
find /storage/roms/ports -type f -name "PortMaster.sh" -delete
#Start PortMaster
run ./PortMaster.sh 2>/dev/null
@LIBEGL@
#Kill gptokeyb at exit
pkill -9 gptokeyb
cd /storage/roms/ports/PortMaster
run ./PortMaster.sh 2>/dev/null

View file

@ -1,337 +0,0 @@
#!/bin/bash
#
# PortMaster
# https://github.com/christianhaitian/arkos/wiki/ArkOS-Emulators-and-Ports-information#ports
# Description : A simple tool that allows you to download
# various game ports for Jelos.
#
if [ -f "/etc/profile" ]; then
source /etc/profile
fi
toolsfolderloc="/storage/.config"
isitext=$(df -PTh $toolsfolderloc | awk '{print $2}' | grep ext)
if [[ "${UI_SERVICE}" =~ weston.service ]]; then
CUR_TTY="/dev/tty"
else
CUR_TTY="/dev/tty0"
fi
ESUDO=""
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/storage/.config/PortMaster/libs"
GREP="/storage/.config/PortMaster/grep"
WGET="/usr/bin/wget"
LANG=""
export DIALOGRC=/storage/.config/PortMaster/colorscheme/jelos.dialogrc
app_colorscheme="Default"
mono_version="mono-6.12.0.122-aarch64.squashfs"
chmod 666 ${CUR_TTY}
export TERM=linux
export XDG_RUNTIME_DIR=/run/user/$UID/
printf "\033c" > ${CUR_TTY}
# hide cursor
printf "\e[?25h" > ${CUR_TTY}
dialog --clear
hotkey="Select"
power='(?<=Title_P=\").*?(?=\")'
opengl="None"
jport="None"
device=$(cat /sys/firmware/devicetree/base/model 2>/dev/null)
# Set device for oga controls profile
case ${device} in
"Anbernic RG552")
param_device="rg552"
height="20"
width="60"
opengl='(?<=Title_F=\").*?(?=\")'
;;
"Hardkernel ODROID-GO-Ultra"|"Powkiddy RGB10 MAX 3"|"Hardkernel ODROID-N2*")
param_device="s922x"
height="20"
width="60"
opengl="None"
;;
"Powkiddy x55")
param_device="x55"
height="20"
width="60"
opengl="None"
;;
"Anbernic RG351*")
param_device="anbernic"
opengl='(?<=Title_F=\").*?(?=\")'
height="15"
width="55"
;;
"ODROID-GO Advance*")
param_device="oga"
opengl='(?<=Title_F=\").*?(?=\")'
height="15"
width="55"
;;
"ODROID-GO Super")
param_device="ogs"
opengl='(?<=Title_F=\").*?(?=\")'
height="20"
width="60"
;;
*)
param_device="rg552"
height="20"
width="60"
opengl="None"
;;
esac
cd $toolsfolderloc/PortMaster
cp "$toolsfolderloc/PortMaster/gamecontrollerdb.txt" /tmp/gamecontrollerdb.txt
$toolsfolderloc/PortMaster/mapper.txt "/tmp/gamecontrollerdb.txt" > /dev/null 2>&1
export SDL_GAMECONTROLLERCONFIG_FILE="/tmp/gamecontrollerdb.txt"
/usr/bin/gptokeyb PortMaster.sh -c "$toolsfolderloc/PortMaster/portmaster.gptk" &
GW=`ip route | awk '/default/ { print $3 }'`
if [ -z "$GW" ]; then
dialog --clear --backtitle "PortMaster" --title "$1" --clear \
--msgbox "\n\nYour network connection doesn't seem to be working. \
\nDid you make sure to configure your wifi connection?" $height $width 2>&1 > ${CUR_TTY}
$ESUDO kill -9 $(pidof gptokeyb)
exit 0
fi
website="https://github.com/PortsMaster/PortMaster-Releases/releases/latest/download/"
jwebsite="https://github.com/brooksytech/JelosAddOns/releases/latest/download/"
isgithubrelease="true" #Github releases convert space " " ("%20") to "."
if [ ! -d "/dev/shm/portmaster" ]; then
mkdir /dev/shm/portmaster
fi
$WGET -t 3 -T 60 --no-check-certificate "$website"ports.md -O /dev/shm/portmaster/pports.md
$WGET -t 3 -T 60 --no-check-certificate "$jwebsite"jports.md -O /dev/shm/portmaster/jports.md
#JELOS has moonlight built in, dont use PortMaster's version.
sed -i '/Title="Moonlight ."/d' /dev/shm/portmaster/pports.md
#Combine PortMaster with JelosAddOns
cat /dev/shm/portmaster/pports.md /dev/shm/portmaster/jports.md > /dev/shm/portmaster/ports.md
PortInfoInstall() {
local setwebsiteback="N"
local unzipstatus
whichsd="storage/roms"
msgtxt=$(cat /dev/shm/portmaster/ports.md | $GREP "$1" | $GREP -oP '(?<=Desc=").*?(?=")')
installloc=$(cat /dev/shm/portmaster/ports.md | $GREP "$1" | $GREP -oP '(?<=locat=").*?(?=")')
porter=$(cat /dev/shm/portmaster/ports.md | $GREP "$1" | $GREP -oP '(?<=porter=").*?(?=")')
needmono=$(cat /dev/shm/portmaster/ports.md | $GREP "$1" | $GREP -oP '(?<=mono=").*?(?=")')
if [[ -f "/storage/roms/ports/PortMaster/libs/$mono_version" ]]; then
ismonothere="y"
else
ismonothere="n"
fi
if [[ "$isgithubrelease" == "true" ]]; then
#Github releases convert space " " ("%20") to "."
# Examples:
# - "Bermuda%20Syndrome" -> "Bermuda.Syndrome"
# - "Bermuda Syndrome" -> "Bermuda.Syndrome"
# - "Mr. Boom" -> "Mr.Boom" (note how space is removed)
installloc="$( echo "$installloc" | sed 's/%20/./g' | sed 's/ /./g' | sed 's/\.\././g' )"
fi
if [[ "${needmono,,}" == "y" ]] && [[ "$ismonothere" == "n" ]]; then
dialog --clear --backtitle "PortMaster" --title "$1" --clear \
--yesno "\n$msgtxt \n\nPorted By: $porter\n\nThis port also requires the download and install
of the mono library which is over 200MBs in size. This download may take a while.
\n\nWould you like to continue to install this port?" $height $width 2>&1 > ${CUR_TTY}
else
dialog --clear --backtitle "PortMaster" --title "$1" --clear \
--yesno "\n$msgtxt \n\nPorted By: $porter\n\nWould you like to continue to install this port?" $height $width 2>&1 > ${CUR_TTY}
fi
case $? in
0)
if [ ${needmono,,} == "y" ] && [ $ismonothere == "n" ]; then
$WGET -t 3 -T 60 -q --show-progress "$website$mono_version" -O \
/storage/roms/ports/PortMaster/libs/$mono_version 2>&1 | stdbuf -oL sed -E 's/\.\.+/---/g'| dialog --progressbox \
"Downloading ${mono_version} package..." $height $width > ${CUR_TTY}
fi
if [ ${needmono,,} == "y" ] && [ $ismonothere == "n" ] && [ $? -ne 0 ]; then
dialog --clear --backtitle "PortMaster" --title "$mono_version" --clear --msgbox "\n\n$mono_version did NOT download. \
\n\nIt did not download correctly. Please verify that you have at least 500MBs of space left in your roms parition
and your internet connection is stable and try again." $height $width 2>&1 > ${CUR_TTY}
$ESUDO rm -f /storage/roms/ports/PortMaster/libs/$mono_version
else
$WGET -t 3 -T 60 -q --show-progress "$dwebsite$installloc" -O \
/dev/shm/portmaster/$installloc 2>&1 | stdbuf -oL sed -E 's/\.\.+/---/g'| dialog --progressbox \
"Downloading ${1} package..." $height $width > ${CUR_TTY}
unzip -o /dev/shm/portmaster/$installloc -d /$whichsd/ports/ > ${CUR_TTY}
unzipstatus=$?
if [ $unzipstatus -eq 0 ] || [ $unzipstatus -eq 1 ]; then
if [ ! -z $isitext ]; then
$ESUDO chmod -R 777 /$whichsd/ports
fi
if [[ -e "/storage/.config/.OS_ARCH" ]] || [ "${OS_NAME}" == "JELOS" ]; then
cd /$whichsd/ports/
for s in *.sh
do
if [[ -z $(cat "$s" | $GREP "ESUDO") ]] || [[ -z $(cat "$s" | $GREP "controlfolder") ]]; then
sed -i 's/sudo //g' /storage/roms/ports/"$s"
fi
done
fi
cd $toolsfolderloc/PortMaster
dialog --clear --backtitle "PortMaster" --title "$1" --clear --msgbox "\n\n$1 installed successfully. \
\n\nMake sure to restart EmulationStation in order to see it in the ports menu." $height $width 2>&1 > ${CUR_TTY}
elif [ $unzipstatus -eq 2 ] || [ $unzipstatus -eq 3 ] || [ $unzipstatus -eq 9 ] || [ $unzipstatus -eq 51 ]; then
dialog --clear --backtitle "PortMaster" --title "$1" --clear --msgbox "\n\n$1 did NOT install. \
\n\nIt did not download correctly. Please check your internet connection and try again." $height $width 2>&1 > ${CUR_TTY}
elif [ $unzipstatus -eq 50 ]; then
dialog --clear --backtitle "PortMaster" --title "$1" --clear --msgbox "\n\n$1 did NOT install. \
\n\nYour roms partition seems to be full." $height $width 2>&1 > ${CUR_TTY}
else
dialog --clear --backtitle "PortMaster" --title "$1" --clear --msgbox "\n\n$1 did NOT install. \
\n\nUnzip error code:$unzipstatus " $height $width 2>&1 > ${CUR_TTY}
fi
$ESUDO rm -f /dev/shm/portmaster/$installloc
fi
;;
*)
;;
esac
}
userExit() {
rm -f /dev/shm/portmaster/*ports.md
dialog --clear
printf "\033c" > ${CUR_TTY}
case ${device} in
"Hardkernel ODROID-GO-Ultra"|"Powkiddy RGB10 MAX 3")
#Fixing ports on S922X, exclude FNA games
for port in /storage/roms/ports/*.sh; do
if ! grep -q FNA "$port"; then
sed -i '/get_controls/c\get_controls && export SDL_VIDEO_GL_DRIVER=/usr/lib/egl/libGL.so.1 SDL_VIDEO_EGL_DRIVER=/usr/lib/egl/libEGL.so.1' "$port"
echo Fixing: "$port";
fi
done;
;;
esac
exit 0
}
JelosPorts() {
dwebsite=$jwebsite
jport='(?<=Title_J=\").*?(?=\")'
local options=(
$(cat /dev/shm/portmaster/ports.md | $GREP 'runtype="jp"' | $GREP -oP "(?<=Title=\").*?(?=\")|$power|$opengl|$jport")
)
while true; do
selection=(dialog \
--backtitle "PortMaster" \
--title "[ JelosAddOns Ports]" \
--no-collapse \
--clear \
--cancel-label "Back" \
--menu "Available JelosAddOns ports for install" $height $width 15)
choices=$("${selection[@]}" "${options[@]}" 2>&1 > ${CUR_TTY}) || TopLevel
for choice in $choices; do
case $choice in
*) PortInfoInstall $choice ;;
esac
done
done
}
MainMenu() {
dwebsite=$website
jport="None"
local options=(
$(cat /dev/shm/portmaster/ports.md | $GREP -oP "(?<=Title=\").*?(?=\")|$power|$opengl|$jport")
)
while true; do
selection=(dialog \
--backtitle "PortMaster" \
--title "[ Main Menu of all ports]" \
--no-collapse \
--clear \
--cancel-label "Back" \
--menu "Available ports for install" $height $width 15)
choices=$("${selection[@]}" "${options[@]}" 2>&1 > ${CUR_TTY}) || TopLevel
for choice in $choices; do
case $choice in
*) PortInfoInstall $choice ;;
esac
done
done
}
MainMenuRTR() {
dwebsite=$website
jport="None"
local options=(
$(cat /dev/shm/portmaster/ports.md | $GREP 'runtype="rtr"' | $GREP -oP "(?<=Title=\").*?(?=\")|$power|$opengl|$jport")
)
while true; do
selection=(dialog \
--backtitle "PortMaster" \
--title "[ Main Menu for Ready to Run ports ]" \
--no-collapse \
--clear \
--cancel-label "Back" \
--menu "Available Ready to Run ports for install" $height $width 15)
choices=$("${selection[@]}" "${options[@]}" 2>&1 > ${CUR_TTY}) || TopLevel
for choice in $choices; do
case $choice in
*) PortInfoInstall $choice ;;
esac
done
done
}
TopLevel() {
local topoptions=( 1 "All Available Ports" 2 "Ready to Run Ports" 3 "JelosAddOns Ports" )
while true; do
topselection=(dialog \
--backtitle "PortMaster" \
--title "[ Top Level Menu ]" \
--no-collapse \
--clear \
--cancel-label "Exit" \
--menu "Please make your selection" $height $width 15)
topchoices=$("${topselection[@]}" "${topoptions[@]}" 2>&1 > ${CUR_TTY}) || userExit
for choice in $topchoices; do
case $choice in
1) MainMenu ;;
2) MainMenuRTR ;;
3) JelosPorts ;;
esac
done
done
}
TopLevel

View file

@ -0,0 +1,72 @@
# 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=""
ESUDOKILL="-1"
raloc="/usr/bin"
raconf="--config /storage/.config/retroarch/retroarch.cfg"
pdevice=$(cat /sys/firmware/devicetree/base/model 2>/dev/null)
case ${pdevice} in
"Anbernic RG552")
profile="rg552"
;;
"Hardkernel ODROID-GO-Ultra"|"Powkiddy RGB10 MAX 3")
profile="s922x"
;;
"Powkiddy x55")
profile="x55"
;;
"Anbernic RG351*")
profile="anbernic"
;;
"ODROID-GO Advance*")
profile="oga"
;;
"ODROID-GO Super")
profile="ogs"
;;
*)
profile="rg552"
;;
esac
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib32
export SDL_GAMECONTROLLERCONFIG_FILE="$controlfolder/gamecontrollerdb.txt"
get_controls() {
ANALOGSTICKS="2"
LOWRES="N"
DEVICE="${1}"
param_device="${profile}"
# Set file
export SDL_GAMECONTROLLERCONFIG_FILE="/tmp/gamecontrollerdb.txt"
# Spit the controller of the device our heuristics found (if it did).
if [[ ! -z ${DEVICE} ]]; then
grep "${SDLDBUSERFILE}" -e "${DEVICE}" > /tmp/gamecontrollerdb.txt
else
echo "" > /tmp/gamecontrollerdb.txt
fi
# Now find any controller mapped on emulationstation...
/storage/.config/PortMaster/mapper.txt /tmp/gamecontrollerdb.txt > /dev/null 2>&1
SDLDBUSERFILE="/storage/.config/SDL-GameControllerDB/gamecontrollerdb.txt"
# Some ports want SDL_GAMECONTROLLERCONFIG, so let's fill it in
sdl_controllerconfig="$(< "${SDL_GAMECONTROLLERCONFIG_FILE}")"
}
GPTOKEYB="$ESUDO $controlfolder/gptokeyb $ESUDOKILL"

View file

@ -0,0 +1,135 @@
#!/bin/bash
# -- Config & Setup --
# Destination file
if [[ -z "$1" ]]; then
echo "Usage: mapper.txt [gamecontrollerdb.txt]"
exit -1
fi
CONTROLLER_DB="$1"
if [[ ! -f "${CONTROLLER_DB}" ]]; then
echo "File ${CONTROLLER_DB} does not exist."
exit -1
fi
# Where the emulationstation configuration file is
ES_CONFIG="${HOME}/.config/emulationstation/es_input.cfg"
# -- Helper function --
# Map the actual button/hat/axis
function map {
INPUT_NAME=$1
TYPE=$2
ID=$3
VALUE=$4
map_x_result=""
case "${INPUT_NAME}" in
"a") TR_NAME="a";;
"b") TR_NAME="b";;
"x") TR_NAME="x";;
"y") TR_NAME="y";;
"hotkeyenable") TR_NAME="guide";;
"up") TR_NAME="dpup";;
"down") TR_NAME="dpdown";;
"left") TR_NAME="dpleft";;
"right") TR_NAME="dpright";;
"leftshoulder") TR_NAME="leftshoulder";;
"leftthumb") TR_NAME="leftstick";;
"lefttrigger") TR_NAME="lefttrigger";;
"rightshoulder") TR_NAME="rightshoulder";;
"rightthumb") TR_NAME="rightstick";;
"righttrigger") TR_NAME="righttrigger";;
"select") TR_NAME="back";;
"start") TR_NAME="start";;
"leftanalogup") TR_NAME="-lefty";;
"leftanalogleft") TR_NAME="-leftx";;
"leftanalogdown") TR_NAME="+lefty";;
"leftanalogright") TR_NAME="+leftx";;
"rightanalogup") TR_NAME="-righty";;
"rightanalogleft") TR_NAME="-rightx";;
"rightanalogdown") TR_NAME="+righty";;
"rightanalogright") TR_NAME="+rightx";;
*)
echo "Invalid mapping ${INPUT_NAME}."
return
;;
esac
case "${TYPE}" in
"axis")
if (( $VALUE < 0 )); then
map_x_result="${TR_NAME}:${map_x_result}-a${ID},"
else
# Most (save for a few misbehaved children...) triggers are [0, 1] instead of [-1, 1]
# Shitty workaround for an emulationstation issue
if [[ $INPUT_NAME =~ .*"trigger" ]]; then
map_x_result="${TR_NAME}:${map_x_result}a${ID},"
else
map_x_result="${TR_NAME}:${map_x_result}+a${ID},"
fi
fi
;;
"button")
map_x_result="${TR_NAME}:${map_x_result}b${ID},"
;;
"hat")
map_x_result="${TR_NAME}:${map_x_result}h${ID}.${VALUE},"
;;
*)
echo "Invalid entry ${TYPE}"
;;
esac
}
function get_map_suffix {
map_suffix="platform:Linux,"
}
function get_map_prefix {
map_prefix="${GUID},${NAME},"
}
# query controllers mapped in emulationstation, ignore devices without a GUID
ES_QUERY="$(xmlstarlet sel -T -t -m "inputList/inputConfig[@deviceGUID!='']" -n -v "concat(@deviceName,';',@deviceGUID)" $ES_CONFIG)"
printf "\n# Custom Entries\n" >> "${CONTROLLER_DB}"
echo "## ES Dev Mapper ##"
while IFS=";" read -r NAME GUID; do
echo "$NAME :: $GUID"
# Ignore keyboards
if [[ "${GUID}" == -1 ]]; then
continue
fi
# Check if GUID exists in gamecontrollerdb.txt
if [ -z "$(fgrep -- ${GUID} "${CONTROLLER_DB}")" ]; then
# Query this specific GUID on the mappings
MAPPING_CFG=$(xmlstarlet sel -T -t -m "//inputConfig[@deviceGUID = '${GUID}']/input" -n -v "concat(@name,';',@type,';',@id,';',@value)" $ES_CONFIG)
MAPPING=""
while IFS=";" read -r -e INPUT_NAME TYPE ID VALUE; do
# Map the controller
map "${INPUT_NAME}" "${TYPE}" "${ID}" "${VALUE}"
# Only concatenate valid mappings
if [[ ! -z ${map_x_result} ]]; then
MAPPING="${MAPPING}${map_x_result}"
fi
done <<< ${MAPPING_CFG:1}
get_map_prefix
get_map_suffix
if [[ ! -z "${MAPPING}" ]]; then
echo "${map_prefix}${MAPPING}${map_suffix}" >> "${CONTROLLER_DB}"
echo "${map_prefix}${MAPPING}${map_suffix}"
echo ""
else
echo "Failed to map anything."
echo ""
fi
else
echo "Already mapped..."
fi
done <<< ${ES_QUERY:1}