Merge pull request #1412 from brooksytech/dev

Add PortMaster to all arm builds
This commit is contained in:
Brooksytech 2023-05-09 09:37:50 -07:00 committed by GitHub
commit 8bb1472f8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 473 additions and 4 deletions

View file

@ -0,0 +1,21 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2023-present BrooksyTech (https://github.com/brooksytech)
PKG_NAME="portmaster"
PKG_VERSION="1.0"
PKG_LICENSE="MIT"
PKG_ARCH="arm aarch64"
PKG_DEPENDS_TARGET="toolchain gptokeyb gamecontrollerdb wget"
PKG_TOOLCHAIN="manual"
PKG_LONGDESC="Portmaster - a simple tool that allows you to download various game ports"
makeinstall_target() {
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
mkdir -p ${INSTALL}/usr/bin
cp -rf ${PKG_DIR}/scripts/* ${INSTALL}/usr/bin
chmod +x ${INSTALL}/usr/bin/start_portmaster.sh
}

View file

@ -0,0 +1,55 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2023-present BrooksyTech (https://github.com/brooksytech)
. /etc/profile
#Make sure PortMaster exists in .config/PortMaster
if [ ! -d "/storage/.config/PortMaster" ]; then
mkdir -p "/storage/.config/ports/PortMaster"
cp -r "/usr/config/PortMaster" "/storage/.config/"
fi
cd /storage/.config/PortMaster
#Grab the latest PortMaster.sh script
cp /usr/config/PortMaster/PortMaster.sh PortMaster.sh
#Use our gamecontrollerdb.txt
rm gamecontrollerdb.txt
ln -sfv /usr/config/SDL-GameControllerDB/gamecontrollerdb.txt gamecontrollerdb.txt
#Use our gptokeyb
rm gptokeyb
ln -sfv /usr/bin/gptokeyb gptokeyb
#Use our wget
rm wget
ln -sfv /usr/bin/wget wget
#Make sure roms/ports/PortMaster folder exists
if [ ! -d "/storage/roms/ports/PortMaster" ]; then
mkdir -p "/storage/roms/ports/PortMaster"
fi
#Make sure libs the folder exists
if [ ! -d "/storage/roms/ports/PortMaster/libs" ]; then
mkdir -p "/storage/roms/ports/PortMaster/libs"
fi
#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 /storage/.config/PortMaster/mapper.txt /storage/roms/ports/PortMaster/mapper.txt
cp /storage/.config/PortMaster/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
#Kill gptokeyb at exit
pkill -9 gptokeyb

View file

@ -0,0 +1,372 @@
#!/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"
height="15"
width="55"
power="None"
opengl="None"
if [[ "${UI_SERVICE}" =~ weston.service ]]; then
opengl='(?<=Title_F=\").*?(?=\")'
fi
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/oga_controls_settings.txt" &
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)
if [ ! -z "$ESUDO" ]; then
$ESUDO systemctl restart oga_events &
fi
exit 0
fi
website="https://github.com/PortsMaster/PortMaster-Releases/releases/latest/download/"
isgithubrelease="true" #Github releases convert space " " ("%20") to "."
ISITCHINA=$(curl -s --connect-timeout 30 -m 60 http://demo.ip-api.com/json | $GREP -Po '"country":.*?[^\\]"')
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/ports.md
PortInfoInstall() {
local setwebsiteback="N"
local unzipstatus
if [ -f "/opt/system/Advanced/Switch to main SD for Roms.sh" ]; then
whichsd="roms2"
elif [ -f "/storage/.config/.OS_ARCH" ] || [ "${OS_NAME}" == "JELOS" ]; then
whichsd="storage/roms"
else
whichsd="roms"
fi
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 "$website$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
$ESUDO kill -9 $(pidof oga_controls)
$ESUDO systemctl restart oga_events &
dialog --clear
printf "\033c" > ${CUR_TTY}
exit 0
}
SetColorScheme() {
if [ "$app_colorscheme" == "Default" ]; then
export DIALOGRC=$toolsfolderloc/PortMaster/colorscheme/$app_colorscheme.dialogrc
if [[ -e "$toolsfolderloc/PortMaster/PortMaster.sh" ]]; then
sed -i "/export DIALOGRC\=\//c\export DIALOGRC\=\/" $toolsfolderloc/PortMaster/PortMaster.sh
fi
if [[ -e "$toolsfolderloc/PortMaster.sh" ]]; then
sed -i "/export DIALOGRC\=\//c\export DIALOGRC\=\/" $toolsfolderloc/PortMaster.sh
fi
else
export DIALOGRC=$toolsfolderloc/PortMaster/colorscheme/$app_colorscheme.dialogrc
if [[ -e "$toolsfolderloc/PortMaster/PortMaster.sh" ]]; then
sed -i "/export DIALOGRC\=\//c\export DIALOGRC\=$toolsfolderloc\/PortMaster\/colorscheme\/$app_colorscheme.dialogrc" $toolsfolderloc/PortMaster/PortMaster.sh
fi
if [[ -e "$toolsfolderloc/PortMaster.sh" ]]; then
sed -i "/export DIALOGRC\=\//c\export DIALOGRC\=$toolsfolderloc\/PortMaster\/colorscheme\/$app_colorscheme.dialogrc" $toolsfolderloc/PortMaster.sh
fi
fi
}
ColorSchemeMenu() {
local cmd
local options
local choice
local retval
local dialog_config
local temp
dialog_config=(${toolsfolderloc}/PortMaster/colorscheme/*.dialogrc) # This creates an array of the full paths to all .dialogrc files
dialog_config=("${dialog_config[@]##*/}") #Remove path prefix
dialog_config=("${dialog_config[@]%.*}") #Get filename without extension
cmd=(dialog \
--clear \
--backtitle "PortMaster" \
--title " [ Color Scheme Selection ] " \
--no-collapse \
--cancel-label "Back" \
--menu "Select the PortMaster UI color scheme :" $height $width "15")
options+=(Default ".")
for temp in "${dialog_config[@]}"; do
if [ "$temp" == "Default" ]; then
echo "Skip default"
else
options+=($temp ".")
fi
done
choice=$("${cmd[@]}" "${options[@]}" 2>&1 >${CUR_TTY})
retval=$?
case $retval in
0)
if [ "$choice" != "$app_colorscheme" ]; then
app_colorscheme=$choice
SetColorScheme
fi
ColorSchemeMenu
;;
1)
Settings
;;
*)
Settings
;;
esac
}
Settings() {
if [[ ! -z $(cat $toolsfolderloc/PortMaster/gamecontrollerdb.txt | $GREP 'Default Layout') ]]; then
local curctrlcfg="Switch to Xbox 360 Control Layout"
else
local curctrlcfg="Switch to Default Control Layout"
fi
local settingsoptions=( 1 "Restore Backup gamecontrollerdb.txt" 2 "$curctrlcfg" 3 "UI Color Scheme" 4 "Go Back" )
while true; do
settingsselection=(dialog \
--backtitle "PortMaster" \
--title "[ Settings Menu ]" \
--no-collapse \
--clear \
--cancel-label "$hotkey + Start to Exit" \
--menu "What do you want to do?" $height $width 15)
settingschoices=$("${settingsselection[@]}" "${settingsoptions[@]}" 2>&1 > ${CUR_TTY}) || TopLevel
for choice in $settingschoices; do
case $choice in
1) cp -f $toolsfolderloc/PortMaster/.Backup/donottouch.txt $toolsfolderloc/PortMaster/gamecontrollerdb.txt
if [ $? == 0 ]; then
dialog --clear --backtitle "PortMaster" --title "$1" --clear --msgbox "\n\nThe default gamecontrollerdb.txt has been successfully restored." $height $width 2>&1 > ${CUR_TTY}
else
dialog --clear --backtitle "PortMaster" --title "$1" --clear --msgbox "\n\nThe default gamecontrollerdb.txt has failed to be restored. Is the backup portmaster subfolder or it's contents missing?" $height $width 2>&1 > ${CUR_TTY}
fi
Settings
;;
2) if [[ $curctrlcfg == "Switch to Xbox 360 Control Layout" ]]; then
cp -f $toolsfolderloc/PortMaster/.Backup/donottouch_x.txt $toolsfolderloc/PortMaster/gamecontrollerdb.txt
else
cp -f $toolsfolderloc/PortMaster/.Backup/donottouch.txt $toolsfolderloc/PortMaster/gamecontrollerdb.txt
fi
Settings
;;
3) ColorSchemeMenu
;;
4) TopLevel
;;
esac
done
done
}
MainMenu() {
local options=(
$(cat /dev/shm/portmaster/ports.md | $GREP -oP "(?<=Title=\").*?(?=\")|$power|$opengl")
)
while true; do
selection=(dialog \
--backtitle "PortMaster" \
--title "[ Main Menu of all ports]" \
--no-collapse \
--clear \
--cancel-label "$hotkey + Start to Exit" \
--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() {
local options=(
$(cat /dev/shm/portmaster/ports.md | $GREP 'runtype="rtr"' | $GREP -oP "(?<=Title=\").*?(?=\")|$power|$opengl")
)
while true; do
selection=(dialog \
--backtitle "PortMaster" \
--title "[ Main Menu for Ready to Run ports ]" \
--no-collapse \
--clear \
--cancel-label "$hotkey + Start to Exit" \
--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 "Settings" )
while true; do
topselection=(dialog \
--backtitle "PortMaster" \
--title "[ Top Level Menu ]" \
--no-collapse \
--clear \
--cancel-label "$hotkey + Start to 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) Settings ;;
esac
done
done
}
TopLevel

Binary file not shown.

View file

@ -0,0 +1,8 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2023-present BrooksyTech (https://github.com/brooksytech
source /etc/profile
/usr/bin/start_portmaster.sh >/dev/null 2>&1

View file

@ -52,6 +52,19 @@
<thumbnail>./downloaded_images/jelos-thumb.png</thumbnail>
<image>./downloaded_images/jelos-image.png</image>
</game>
<game>
<path>./Start PortMaster.sh</path>
<name>Start PortMaster</name>
<desc>Portmaster</desc>
<developer>JELOS</developer>
<publisher>JELOS</publisher>
<rating>1.0</rating>
<releasedate>2023</releasedate>
<genre>Script</genre>
<image>./downloaded_images/ports-image.png</image>
<thumbnail>./downloaded_images/ports-thumb.png</thumbnail>
</game>
<game>
<path>./Start PPSSPP.sh</path>

View file

@ -39,19 +39,19 @@ case "${DEVICE}" in
;;
RK358*)
[ "${ENABLE_32BIT}" == "true" ] && EMUS_32BIT="box86 flycast-lr pcsx_rearmed-lr"
PKG_EMUS+=" aethersx2-sa pcsx_rearmed-lr box64 scummvmsa yabasanshiro-sa"
LIBRETRO_CORES+=" beetle-psx-lr bsnes-hd-lr citra-lr dolphin-lr mame-lr box64"
PKG_EMUS+=" aethersx2-sa pcsx_rearmed-lr box64 scummvmsa yabasanshiro-sa box64 portmaster"
LIBRETRO_CORES+=" beetle-psx-lr bsnes-hd-lr citra-lr dolphin-lr mame-lr"
PKG_RETROARCH+=" retropie-shaders"
;;
RK356*)
[ "${ENABLE_32BIT}" == "true" ] && EMUS_32BIT="box86 flycast-lr pcsx_rearmed-lr"
PKG_DEPENDS_TARGET+=" common-shaders glsl-shaders mupen64plus-sa scummvmsa box64"
PKG_DEPENDS_TARGET+=" common-shaders glsl-shaders mupen64plus-sa scummvmsa box64 portmaster"
PKG_EMUS+=" dolphin-sa drastic-sa yabasanshiro-sa"
PKG_RETROARCH+=" retropie-shaders"
;;
S922X*)
[ "${ENABLE_32BIT}" == "true" ] && EMUS_32BIT="box86 flycast-lr pcsx_rearmed-lr"
PKG_EMUS+=" aethersx2-sa dolphin-sa drastic-sa mupen64plus-sa yabasanshiro-sa box64"
PKG_EMUS+=" aethersx2-sa dolphin-sa drastic-sa mupen64plus-sa yabasanshiro-sa box64 portmaster"
LIBRETRO_CORES+=" beetle-psx-lr bsnes-hd-lr dolphin-lr flycast-lr"
PKG_RETROARCH+=" retropie-shaders"
;;