mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-02-17 03:45:38 +00:00
Added the option to browse for roms folder
This commit is contained in:
parent
412649c047
commit
44267a7ec1
101
retrodeck.sh
101
retrodeck.sh
|
@ -1,15 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Init default values, this may be overwritten by retrodeck.cfg as it sourced later with global.sh
|
lockfile="/var/config/retrodeck/.lock" # where the lockfile is located
|
||||||
|
version="$(cat /app/retrodeck/version)" # version info taken from the version file
|
||||||
lockfile=lockfile="/var/config/retrodeck/.lock" # where the lockfile is located
|
rdhome="$HOME/retrodeck" # the retrodeck home, aka ~/retrodecck
|
||||||
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
|
|
||||||
version="$(cat /app/retrodeck/version)" # version info taken from the version file
|
|
||||||
rdhome="$HOME/retrodeck" # the retrodeck home, aka ~/retrodeck
|
|
||||||
|
|
||||||
source 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" ]
|
||||||
|
@ -46,7 +41,7 @@ dir_prep() {
|
||||||
# creating the symlink
|
# creating the symlink
|
||||||
echo "linking $real in $symlink" #DEBUG
|
echo "linking $real in $symlink" #DEBUG
|
||||||
mkdir -pv "$(dirname "$symlink")" # creating the full path except the last folder
|
mkdir -pv "$(dirname "$symlink")" # creating the full path except the last folder
|
||||||
ln -sv "$real" "$symlink"
|
ln -svf "$real" "$symlink"
|
||||||
|
|
||||||
# moving everything from the old folder to the new one, delete the old one
|
# moving everything from the old folder to the new one, delete the old one
|
||||||
if [ -d "$symlink.old" ];
|
if [ -d "$symlink.old" ];
|
||||||
|
@ -144,21 +139,6 @@ standalones_init() {
|
||||||
mkdir -pv /var/config/rpcs3/
|
mkdir -pv /var/config/rpcs3/
|
||||||
cp -fvr $emuconfigs/config.yml /var/config/rpcs3/
|
cp -fvr $emuconfigs/config.yml /var/config/rpcs3/
|
||||||
|
|
||||||
# XEMU
|
|
||||||
echo "----------------------"
|
|
||||||
echo "Initializing XEMU"
|
|
||||||
echo "----------------------"
|
|
||||||
mkdir -pv $rdhome/saves/xemu
|
|
||||||
cp -fv $emuconfigs/xemu.toml /var/data/xemu/xemu.toml
|
|
||||||
sed -i 's#/home/deck/retrodeck#'$rdhome'#g' /var/data/xemu/xemu.toml
|
|
||||||
# Preparing HD dummy Image if the image is not found
|
|
||||||
if [ ! -f $rdhome/bios/xbox_hdd.qcow2 ]
|
|
||||||
then
|
|
||||||
wget "https://github.com/mborgerson/xemu-hdd-image/releases/latest/download/xbox_hdd.qcow2.zip" -P $rdhome/bios/
|
|
||||||
unzip $rdhome/bios/xbox_hdd.qcow2.zip $rdhome/bios/
|
|
||||||
rm -rfv $rdhome/bios/xbox_hdd.qcow2.zip
|
|
||||||
fi
|
|
||||||
|
|
||||||
# PICO-8
|
# PICO-8
|
||||||
# Moved PICO-8 stuff in the finit as only it knows here roms folders is
|
# Moved PICO-8 stuff in the finit as only it knows here roms folders is
|
||||||
|
|
||||||
|
@ -222,26 +202,55 @@ finit() {
|
||||||
echo "Executing finit"
|
echo "Executing finit"
|
||||||
|
|
||||||
# Internal or SD Card?
|
# Internal or SD Card?
|
||||||
zenity --icon-name=net.retrodeck.retrodeck --question --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --ok-label "Internal" --cancel-label "SD Card" --text="Welcome to the first configuration of RetroDECK.\nThe setup will be quick but please READ CAREFULLY each message in order to avoid misconfigurations.\n\nWhere do you want your roms folder to be located?"
|
choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
|
||||||
if [ $? == 0 ] #yes - Internal
|
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" \
|
||||||
then
|
--ok-label "Internal" \
|
||||||
|
--extra-button "SD Card" \
|
||||||
|
--extra-button "Browse" \
|
||||||
|
--extra-button "Cancel" \
|
||||||
|
--text="Welcome to the first configuration of RetroDECK.\nThe setup will be quick but please READ CAREFULLY each message in order to avoid misconfigurations.\n\nWhere do you want your roms folder to be located?" )
|
||||||
|
echo "Choice is $choice"
|
||||||
|
|
||||||
|
case $choice in
|
||||||
|
|
||||||
|
"" ) # Internal (yes)
|
||||||
|
echo "Internal selected"
|
||||||
roms_folder="$rdhome/roms"
|
roms_folder="$rdhome/roms"
|
||||||
else #no - SD Card
|
;;
|
||||||
if [ -d "$sdcard" ];
|
|
||||||
|
"Cancel" )
|
||||||
|
echo "Now quitting"
|
||||||
|
kill $$
|
||||||
|
;;
|
||||||
|
|
||||||
|
"SD Card" )
|
||||||
|
echo "SD Card selected"
|
||||||
|
if [ ! -d "$sdcard" ] # SD Card path is not existing
|
||||||
then
|
then
|
||||||
roms_folder="$sdcard/retrodeck/roms"
|
echo "Error: SD card not found"
|
||||||
|
zenity --question --no-wrap \
|
||||||
|
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||||
|
--title "RetroDECK" --cancel-label="Cancel" \
|
||||||
|
--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."
|
||||||
else
|
else
|
||||||
sdselected=false
|
roms_folder="$sdcard/retrodeck/roms"
|
||||||
zenity --question --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --cancel-label="Cancel" --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."
|
echo "ROMs folder = $roms_folder"
|
||||||
if [ $? == 1 ] #cancel
|
|
||||||
then
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
while [ $sdselected == false ]
|
;;
|
||||||
|
|
||||||
|
"Browse" ) # Browse + not found fallback
|
||||||
|
echo "Browse"
|
||||||
|
path_selected=false
|
||||||
|
while [ $path_selected == false ]
|
||||||
do
|
do
|
||||||
sdcard="$(zenity --file-selection --title="Choose SD Card root" --directory)"
|
sdcard="$(zenity --file-selection --title="Choose retrodeck folder location" --directory)"
|
||||||
echo "DEBUG: sdcard=$sdcard, answer=$?"
|
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?"
|
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
|
if [ $? == 0 ] #yes
|
||||||
then
|
then
|
||||||
sdselected == true
|
sdselected == true
|
||||||
|
@ -255,8 +264,9 @@ finit() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
;;
|
||||||
fi
|
|
||||||
|
esac
|
||||||
|
|
||||||
mkdir -pv $roms_folder
|
mkdir -pv $roms_folder
|
||||||
|
|
||||||
|
@ -330,8 +340,7 @@ https://retrodeck.net
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
--version*|-v*)
|
--version*|-v*)
|
||||||
conf_init
|
cat /var/config/retrodeck/version
|
||||||
echo $version
|
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
--reset-ra*)
|
--reset-ra*)
|
||||||
|
@ -364,9 +373,7 @@ done
|
||||||
if [ -f "$lockfile" ] && [ "$(cat "$lockfile")" != "$version" ];
|
if [ -f "$lockfile" ] && [ "$(cat "$lockfile")" != "$version" ];
|
||||||
then
|
then
|
||||||
echo "Lockfile version is "$(cat "$lockfile")" but the actual version is $version"
|
echo "Lockfile version is "$(cat "$lockfile")" but the actual version is $version"
|
||||||
conf_init # Initializing/reading the config file (sourced from global.sh)
|
post_update
|
||||||
post_update # Executing post update script
|
|
||||||
conf_write # Writing variables in the config file (sourced from global.sh)
|
|
||||||
start_retrodeck
|
start_retrodeck
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -376,9 +383,7 @@ fi
|
||||||
if [ ! -f "$lockfile" ];
|
if [ ! -f "$lockfile" ];
|
||||||
then
|
then
|
||||||
echo "Lockfile not found"
|
echo "Lockfile not found"
|
||||||
conf_init # Initializing/reading the config file (sourced from global.sh)
|
finit
|
||||||
finit # Executing First/Force init
|
|
||||||
conf_write # Writing variables in the config file (sourced from global.sh)
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue