mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-02-16 19:35:39 +00:00
Updated scripts, bufgix needed
This commit is contained in:
parent
c803fbdee2
commit
353ad896c5
37
global.sh
37
global.sh
|
@ -2,20 +2,36 @@
|
||||||
|
|
||||||
# This file is containing some global function needed for the script such as the config file tools
|
# This file is containing some global function needed for the script such as the config file tools
|
||||||
|
|
||||||
rd_conf="/app/retrodeck/retrodeck.cfg"
|
rd_conf="/var/config/retrodeck/retrodeck.cfg"
|
||||||
|
|
||||||
conf_init() {
|
conf_init() {
|
||||||
# initializing and reading the retrodeck config file
|
# initializing and reading the retrodeck config file
|
||||||
if [ ! -f $rd_conf ]
|
if [ ! -f $rd_conf ]
|
||||||
then # I have to initialize the variables as they cannot be red from an empty config file
|
then # I have to initialize the variables as they cannot be red from an empty config file
|
||||||
|
echo "RetroDECK config file not found in $rd_conf"
|
||||||
|
echo "Initializing"
|
||||||
touch $rd_conf
|
touch $rd_conf
|
||||||
|
read -p "Press enter to continue" #DEBUG
|
||||||
|
|
||||||
# Variables to manage: adding a variable here means adding it to conf_write()
|
# Variables to manage: adding a variable here means adding it to conf_write()
|
||||||
version="$(cat /app/retrodeck/version)" # version info taken from the version file
|
echo "#!/bin/bash" >> $rd_conf
|
||||||
rdhome="$HOME/retrodeck" # the retrodeck home, aka ~/retrodeck
|
|
||||||
roms_folder="$rdhome/roms" # default roms folder location (intenral)
|
# version info taken from the version file
|
||||||
|
version="$(cat /app/retrodeck/version)"
|
||||||
|
echo "version=$version" >> $rd_conf
|
||||||
|
|
||||||
|
# the retrodeck home, aka ~/retrodeck
|
||||||
|
rdhome="$HOME/retrodeck"
|
||||||
|
echo "rdhome=$rdhome" >> $rd_conf
|
||||||
|
|
||||||
|
# default roms folder location (internal)
|
||||||
|
roms_folder="$rdhome/roms"
|
||||||
|
echo "roms_folder=$roms_folder" >> $rd_conf
|
||||||
|
|
||||||
|
|
||||||
else # i just read the variables
|
else # i just read the variables
|
||||||
|
echo "Found RetroDECK config file in $rd_conf"
|
||||||
|
echo "Loading it"
|
||||||
source $rd_conf
|
source $rd_conf
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -23,17 +39,22 @@ conf_init() {
|
||||||
conf_write() {
|
conf_write() {
|
||||||
# writes the variables in the retrodeck config file
|
# writes the variables in the retrodeck config file
|
||||||
|
|
||||||
|
echo "Writing the config file"
|
||||||
|
|
||||||
# TODO: this can be optimized with a while and a list of variables to check
|
# TODO: this can be optimized with a while and a list of variables to check
|
||||||
if [ ! -z "$version" ] then #if the variable is not null then I update it
|
if [ ! -z "$version" ] #if the variable is not null then I update it
|
||||||
|
then
|
||||||
sed -i "s%version=.*%version=$version%" $rd_conf
|
sed -i "s%version=.*%version=$version%" $rd_conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$rdhome" ] then
|
if [ ! -z "$rdhome" ]
|
||||||
|
then
|
||||||
sed -i "s%rdhome=.*%rdhome=$rdhome%" $rd_conf
|
sed -i "s%rdhome=.*%rdhome=$rdhome%" $rd_conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$roms_folder" ] then
|
if [ ! -z "$roms_folder" ]
|
||||||
sed -i "s%rdhome=.*%rdhome=$roms_folder" $rd_conf
|
then
|
||||||
|
sed -i "s%rdhome=.*%rdhome=$roms_folder%" $rd_conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
67
retrodeck.sh
67
retrodeck.sh
|
@ -5,11 +5,11 @@
|
||||||
lockfile="/var/config/retrodeck/.lock" # where the lockfile is located
|
lockfile="/var/config/retrodeck/.lock" # where the lockfile is located
|
||||||
emuconfigs="/app/retrodeck/emu-configs" # folder with all the default emulator configs
|
emuconfigs="/app/retrodeck/emu-configs" # folder with all the default emulator configs
|
||||||
sdcard="/run/media/mmcblk0p1" # Steam Deck SD default path
|
sdcard="/run/media/mmcblk0p1" # Steam Deck SD default path
|
||||||
rd_conf="/app/retrodeck/retrodeck.cfg" # RetroDECK config file path
|
rd_conf="/var/config/retrodeck/retrodeck.cfg" # RetroDECK config file path
|
||||||
version="$(cat /app/retrodeck/version)" # version info taken from the version file
|
version="$(cat /app/retrodeck/version)" # version info taken from the version file
|
||||||
rdhome="$HOME/retrodeck" # the retrodeck home, aka ~/retrodeck
|
rdhome="$HOME/retrodeck" # the retrodeck home, aka ~/retrodeck
|
||||||
|
|
||||||
source global.sh
|
source /app/bin/global.sh
|
||||||
|
|
||||||
# We moved the lockfile in /var/config/retrodeck in order to solve issue #53 - Remove in a few versions
|
# We moved the lockfile in /var/config/retrodeck in order to solve issue #53 - Remove in a few versions
|
||||||
if [ -f "$HOME/retrodeck/.lock" ]
|
if [ -f "$HOME/retrodeck/.lock" ]
|
||||||
|
@ -191,11 +191,14 @@ ra_init() {
|
||||||
mv -fv $rdhome/bios/PPSSPP/flash0/font $rdhome/bios/PPSSPP/flash0/font.bak
|
mv -fv $rdhome/bios/PPSSPP/flash0/font $rdhome/bios/PPSSPP/flash0/font.bak
|
||||||
fi
|
fi
|
||||||
mkdir -p $rdhome/bios/PPSSPP
|
mkdir -p $rdhome/bios/PPSSPP
|
||||||
wget "https://github.com/hrydgard/ppsspp/archive/refs/heads/master.zip" -P $rdhome/bios/PPSSPP
|
if [ ! -f "$rdhome/bios/PPSSPP/ppge_atlas.zim" ]
|
||||||
unzip "$rdhome/bios/PPSSPP/master.zip" -d $rdhome/bios/PPSSPP/
|
then
|
||||||
mv "$rdhome/bios/PPSSPP/ppsspp-master/"* "$rdhome/bios/PPSSPP/"
|
wget "https://github.com/hrydgard/ppsspp/archive/refs/heads/master.zip" -P $rdhome/bios/PPSSPP
|
||||||
rm -rfv "$rdhome/bios/PPSSPP/master.zip"
|
unzip "$rdhome/bios/PPSSPP/master.zip" -d $rdhome/bios/PPSSPP/
|
||||||
rm -rfv "$rdhome/bios/PPSSPP/ppsspp-master"
|
mv "$rdhome/bios/PPSSPP/ppsspp-master/assets"* "$rdhome/bios/PPSSPP/"
|
||||||
|
rm -rfv "$rdhome/bios/PPSSPP/master.zip"
|
||||||
|
rm -rfv "$rdhome/bios/PPSSPP/ppsspp-master"
|
||||||
|
fi
|
||||||
if [ -d $rdhome/bios/PPSSPP/flash0/font.bak ]
|
if [ -d $rdhome/bios/PPSSPP/flash0/font.bak ]
|
||||||
then
|
then
|
||||||
mv -fv $rdhome/bios/PPSSPP/flash0/font.bak $rdhome/bios/PPSSPP/flash0/font
|
mv -fv $rdhome/bios/PPSSPP/flash0/font.bak $rdhome/bios/PPSSPP/flash0/font
|
||||||
|
@ -256,6 +259,32 @@ start_retrodeck() {
|
||||||
emulationstation --home /var/config/emulationstation
|
emulationstation --home /var/config/emulationstation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
browse(){
|
||||||
|
# Function fro browsing the sd card or [ath]
|
||||||
|
path_selected=false
|
||||||
|
while [ $path_selected == false ]
|
||||||
|
do
|
||||||
|
sdcard="$(zenity --file-selection --title="Choose retrodeck folder location" --directory)"
|
||||||
|
echo "Path choosed: $sdcard, answer=$?"
|
||||||
|
zenity --question --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" \
|
||||||
|
--cancel-label="No" \
|
||||||
|
--ok-label "Yes" \
|
||||||
|
--text="Your rom folder will be:\n\n$sdcard/retrodeck/roms\n\nis that ok?"
|
||||||
|
if [ $? == 0 ] #yes
|
||||||
|
then
|
||||||
|
sdselected == true
|
||||||
|
roms_folder="$sdcard/retrodeck/roms"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
zenity --question --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --cancel-label="No" --ok-label "Yes" --text="Do you want to quit?"
|
||||||
|
if [ $? == 0 ] # yes, quit
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
finit() {
|
finit() {
|
||||||
# Force/First init, depending on the situation
|
# Force/First init, depending on the situation
|
||||||
|
|
||||||
|
@ -293,6 +322,7 @@ finit() {
|
||||||
--title "RetroDECK" --cancel-label="Cancel" \
|
--title "RetroDECK" --cancel-label="Cancel" \
|
||||||
--ok-label "Browse" \
|
--ok-label "Browse" \
|
||||||
--text="SD Card was not find in the default location.\nPlease choose the SD Card root.\nA retrodeck/roms folder will be created starting from the directory that you selected."
|
--text="SD Card was not find in the default location.\nPlease choose the SD Card root.\nA retrodeck/roms folder will be created starting from the directory that you selected."
|
||||||
|
browse
|
||||||
else
|
else
|
||||||
roms_folder="$sdcard/retrodeck/roms"
|
roms_folder="$sdcard/retrodeck/roms"
|
||||||
echo "ROMs folder = $roms_folder"
|
echo "ROMs folder = $roms_folder"
|
||||||
|
@ -302,28 +332,7 @@ finit() {
|
||||||
|
|
||||||
"Browse" ) # Browse + not found fallback
|
"Browse" ) # Browse + not found fallback
|
||||||
echo "Browse"
|
echo "Browse"
|
||||||
path_selected=false
|
browse
|
||||||
while [ $path_selected == false ]
|
|
||||||
do
|
|
||||||
sdcard="$(zenity --file-selection --title="Choose retrodeck folder location" --directory)"
|
|
||||||
echo "Path choosed: $sdcard, answer=$?"
|
|
||||||
zenity --question --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" \
|
|
||||||
--cancel-label="No" \
|
|
||||||
--ok-label "Yes" \
|
|
||||||
--text="Your rom folder will be:\n\n$sdcard/retrodeck/roms\n\nis that ok?"
|
|
||||||
if [ $? == 0 ] #yes
|
|
||||||
then
|
|
||||||
sdselected == true
|
|
||||||
roms_folder="$sdcard/retrodeck/roms"
|
|
||||||
break
|
|
||||||
else
|
|
||||||
zenity --question --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --cancel-label="No" --ok-label "Yes" --text="Do you want to quit?"
|
|
||||||
if [ $? == 0 ] # yes, quit
|
|
||||||
then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue