mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-25 07:25:38 +00:00
Expanding Configurator framework
This commit is contained in:
parent
377da5f30f
commit
cdea3287a0
607
functions.sh
Normal file
607
functions.sh
Normal file
|
@ -0,0 +1,607 @@
|
|||
#!/bin/bash
|
||||
|
||||
# THIS IS A CENTRALIZED LOCATION FOR FUNCTIONS, WHICH CAN BE SOURCED WITHOUT RUNNING EXTRA CODE. EXISTING USE OF THESE FUNCTIONS CAN BE REFACTORED TO HERE.
|
||||
|
||||
dir_prep() {
|
||||
# This script is creating a symlink preserving old folder contents and moving them in the new one
|
||||
|
||||
# Call me with:
|
||||
# dir prep "real dir" "symlink location"
|
||||
real="$1"
|
||||
symlink="$2"
|
||||
|
||||
echo -e "\n[DIR PREP]\nMoving $symlink in $real" #DEBUG
|
||||
|
||||
# if the dest dir exists we want to backup it
|
||||
if [ -d "$symlink" ];
|
||||
then
|
||||
echo "$symlink found" #DEBUG
|
||||
mv -fv "$symlink" "$symlink.old"
|
||||
fi
|
||||
|
||||
# if the real dir doesn't exist we create it
|
||||
if [ ! -d "$real" ];
|
||||
then
|
||||
echo "$real not found, creating it" #DEBUG
|
||||
mkdir -pv "$real"
|
||||
fi
|
||||
|
||||
# creating the symlink
|
||||
echo "linking $real in $symlink" #DEBUG
|
||||
mkdir -pv "$(dirname "$symlink")" # creating the full path except the last folder
|
||||
ln -sv "$real" "$symlink"
|
||||
|
||||
# moving everything from the old folder to the new one, delete the old one
|
||||
if [ -d "$symlink.old" ];
|
||||
then
|
||||
echo "Moving the data from $symlink.old to $real" #DEBUG
|
||||
mv -fv "$symlink".old/* $real
|
||||
echo "Removing $symlink.old" #DEBUG
|
||||
rm -rf "$symlink.old"
|
||||
fi
|
||||
|
||||
echo -e "$symlink is now $real\n"
|
||||
}
|
||||
|
||||
tools_init() {
|
||||
rm -rfv /var/config/retrodeck/tools/
|
||||
mkdir -pv /var/config/retrodeck/tools/
|
||||
cp -rfv /app/retrodeck/tools/* /var/config/retrodeck/tools/
|
||||
mkdir -pv /var/config/emulationstation/.emulationstation/custom_systems/tools/
|
||||
rm -rfv /var/config/retrodeck/tools/gamelist.xml
|
||||
cp -fv /app/retrodeck/tools-gamelist.xml /var/config/retrodeck/tools/gamelist.xml
|
||||
}
|
||||
|
||||
standalones_init() {
|
||||
# This script is configuring the standalone emulators with the default files present in emuconfigs folder
|
||||
|
||||
echo "----------------------"
|
||||
echo "Initializing standalone emulators"
|
||||
echo "----------------------"
|
||||
|
||||
# Yuzu
|
||||
echo "----------------------"
|
||||
echo "Initializing YUZU"
|
||||
echo "----------------------"
|
||||
# removing dead symlinks as they were present in a past version
|
||||
if [ -d $rdhome/bios/switch ]; then
|
||||
find $rdhome/bios/switch -xtype l -exec rm {} \;
|
||||
fi
|
||||
# initializing the keys folder
|
||||
dir_prep "$rdhome/bios/switch/keys" "/var/data/yuzu/keys"
|
||||
# initializing the firmware folder
|
||||
dir_prep "$rdhome/bios/switch/registered" "/var/data/yuzu/nand/system/Contents/registered"
|
||||
# configuring Yuzu
|
||||
dir_prep "$rdhome/.logs/yuzu" "/var/data/yuzu/log"
|
||||
mkdir -pv /var/config/yuzu/
|
||||
cp -fvr $emuconfigs/yuzu/* /var/config/yuzu/
|
||||
sed -i 's#~/retrodeck#'$rdhome'#g' /var/config/yuzu/qt-config.ini
|
||||
dir_prep "$rdhome/screenshots" "/var/data/yuzu/screenshots"
|
||||
|
||||
# Dolphin
|
||||
echo "----------------------"
|
||||
echo "Initializing DOLPHIN"
|
||||
echo "----------------------"
|
||||
mkdir -pv /var/config/dolphin-emu/
|
||||
cp -fvr "$emuconfigs/dolphin/"* /var/config/dolphin-emu/
|
||||
sed -i 's#~/retrodeck#'$rdhome'#g' /var/config/dolphin-emu/Dolphin.ini
|
||||
dir_prep "$rdhome/saves/gc/dolphin/EUR" "/var/data/dolphin-emu/GC/EUR"
|
||||
dir_prep "$rdhome/saves/gc/dolphin/USA" "/var/data/dolphin-emu/GC/USA"
|
||||
dir_prep "$rdhome/saves/gc/dolphin/JAP" "/var/data/dolphin-emu/GC/JAP"
|
||||
dir_prep "$rdhome/screenshots" "/var/data/dolphin-emu/ScreenShots"
|
||||
dir_prep "$rdhome/states" "/var/data/dolphin-emu/StateSaves"
|
||||
dir_prep "$rdhome/saves/wii/dolphin" "/var/data/dolphin-emu/Wii/"
|
||||
|
||||
# pcsx2
|
||||
echo "----------------------"
|
||||
echo "Initializing PCSX2"
|
||||
echo "----------------------"
|
||||
mkdir -pv /var/config/PCSX2/inis/
|
||||
mkdir -pv "$rdhome/saves/ps2/pcsx2/memcards"
|
||||
cp -fvr $emuconfigs/PCSX2/* /var/config/PCSX2/inis/
|
||||
sed -i 's#~/retrodeck#'$rdhome'#g' /var/config/PCSX2/inis/PCSX2_ui.ini
|
||||
sed -i 's#~/retrodeck#'$rdhome'#g' /var/config/PCSX2/inis/PCSX2.ini
|
||||
dir_prep "$rdhome/states/ps2/pcsx2" "/var/config/PCSX2/sstates"
|
||||
dir_prep "$rdhome/screenshots" "/var/config/PCSX2/snaps"
|
||||
dir_prep "$rdhome/.logs" "/var/config/PCSX2/logs"
|
||||
dir_prep "$rdhome/bios" "$rdhome/bios/pcsx2"
|
||||
|
||||
# MelonDS
|
||||
echo "----------------------"
|
||||
echo "Initializing MELONDS"
|
||||
echo "----------------------"
|
||||
mkdir -pv /var/config/melonDS/
|
||||
mkdir -pv "$rdhome/saves/nds/melonds"
|
||||
mkdir -pv "$rdhome/states/nds/melonds"
|
||||
dir_prep "$rdhome/bios" "/var/config/melonDS/bios"
|
||||
cp -fvr $emuconfigs/melonDS.ini /var/config/melonDS/
|
||||
# Replace ~/retrodeck with $rdhome as ~ cannot be understood by MelonDS
|
||||
sed -i 's#~/retrodeck#'$rdhome'#g' /var/config/melonDS/melonDS.ini
|
||||
|
||||
# CITRA
|
||||
echo "------------------------"
|
||||
echo "Initializing CITRA"
|
||||
echo "------------------------"
|
||||
mkdir -pv /var/config/citra-emu/
|
||||
mkdir -pv "$rdhome/saves/n3ds/citra/nand/"
|
||||
mkdir -pv "$rdhome/saves/n3ds/citra/sdmc/"
|
||||
dir_prep "$rdhome/.logs/citra" "/var/data/citra-emu/log"
|
||||
cp -fv $emuconfigs/citra-qt-config.ini /var/config/citra-emu/qt-config.ini
|
||||
sed -i 's#~/retrodeck#'$rdhome'#g' /var/config/citra-emu/qt-config.ini
|
||||
#TODO: do the same with roms folders after new variables is pushed (check even the others qt-emu)
|
||||
#But actually everything is always symlinked to retrodeck/roms so it might be not needed
|
||||
#sed -i 's#~/retrodeck#'$rdhome'#g' /var/config/citra-emu/qt-config.ini
|
||||
|
||||
# RPCS3
|
||||
echo "------------------------"
|
||||
echo "Initializing RPCS3"
|
||||
echo "------------------------"
|
||||
mkdir -pv /var/config/rpcs3/
|
||||
cp -fvr $emuconfigs/rpcs3/* /var/config/rpcs3/
|
||||
sed -i 's#/home/deck/retrodeck#'$rdhome'#g' /var/config/rpcs3/vfs.yml
|
||||
|
||||
# XEMU
|
||||
echo "------------------------"
|
||||
echo "Initializing XEMU"
|
||||
echo "------------------------"
|
||||
mkdir -pv $rdhome/saves/xbox/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
|
||||
|
||||
# PPSSPPSDL
|
||||
echo "------------------------"
|
||||
echo "Initializing PPSSPPSDL"
|
||||
echo "------------------------"
|
||||
mkdir -p /var/config/ppsspp/PSP/SYSTEM/
|
||||
cp -fv $emuconfigs/ppssppsdl/* /var/config/ppsspp/PSP/SYSTEM/
|
||||
sed -i 's#/home/deck/retrodeck#'$rdhome'#g' /var/config/ppsspp/PSP/SYSTEM/ppsspp.ini
|
||||
|
||||
# DUCKSTATION
|
||||
echo "------------------------"
|
||||
echo "Initializing DUCKSTATION"
|
||||
echo "------------------------"
|
||||
mkdir -p /var/config/duckstation/
|
||||
cp -fv $emuconfigs/duckstation/* /var/config/duckstation
|
||||
sed -i 's#/home/deck/retrodeck/bios#'$rdhome/bios'#g' /var/config/ppsspp/PSP/SYSTEM/settings.ini
|
||||
|
||||
|
||||
# PICO-8
|
||||
# Moved PICO-8 stuff in the finit as only it knows here roms folders is
|
||||
|
||||
}
|
||||
|
||||
ra_init() {
|
||||
dir_prep "$rdhome/bios" "/var/config/retroarch/system"
|
||||
dir_prep "$rdhome/.logs/retroarch" "/var/config/retroarch/logs"
|
||||
mkdir -pv /var/config/retroarch/cores/
|
||||
cp /app/share/libretro/cores/* /var/config/retroarch/cores/
|
||||
cp -fv $emuconfigs/retroarch.cfg /var/config/retroarch/
|
||||
cp -fv $emuconfigs/retroarch-core-options.cfg /var/config/retroarch/
|
||||
#rm -rf $rdhome/bios/bios # in some situations a double bios symlink is created
|
||||
sed -i 's#~/retrodeck#'$rdhome'#g' /var/config/retroarch/retroarch.cfg
|
||||
|
||||
# PPSSPP
|
||||
echo "--------------------------------"
|
||||
echo "Initializing PPSSPP_LIBRETRO"
|
||||
echo "--------------------------------"
|
||||
if [ -d $rdhome/bios/PPSSPP/flash0/font ]
|
||||
then
|
||||
mv -fv $rdhome/bios/PPSSPP/flash0/font $rdhome/bios/PPSSPP/flash0/font.bak
|
||||
fi
|
||||
mkdir -p $rdhome/bios/PPSSPP
|
||||
#if [ ! -f "$rdhome/bios/PPSSPP/ppge_atlas.zim" ]
|
||||
#then
|
||||
wget "https://github.com/hrydgard/ppsspp/archive/refs/heads/master.zip" -P $rdhome/bios/PPSSPP
|
||||
unzip "$rdhome/bios/PPSSPP/master.zip" -d $rdhome/bios/PPSSPP/
|
||||
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 ]
|
||||
then
|
||||
mv -fv $rdhome/bios/PPSSPP/flash0/font.bak $rdhome/bios/PPSSPP/flash0/font
|
||||
fi
|
||||
|
||||
|
||||
# MSX / SVI / ColecoVision / SG-1000
|
||||
echo "-----------------------------------------------------------"
|
||||
echo "Initializing MSX / SVI / ColecoVision / SG-1000 LIBRETRO"
|
||||
echo "-----------------------------------------------------------"
|
||||
wget "http://bluemsx.msxblue.com/rel_download/blueMSXv282full.zip" -P $rdhome/bios/MSX
|
||||
unzip "$rdhome/bios/MSX/blueMSXv282full.zip" $rdhome/bios/MSX
|
||||
mv -rfv $rdhome/bios/MSX/Databases $rdhome/bios/Databases
|
||||
mv -rfv $rdhome/bios/MSX/Machines $rdhome/bios/Machines
|
||||
rm -rfv $rdhome/bios/MSX
|
||||
|
||||
}
|
||||
|
||||
create_lock() {
|
||||
# creating RetroDECK's lock file and writing the version in the config file
|
||||
version=$hard_version
|
||||
touch "$lockfile"
|
||||
conf_write
|
||||
}
|
||||
|
||||
post_update() {
|
||||
# post update script
|
||||
echo "Executing post-update script"
|
||||
|
||||
# Unhiding downloaded media from the previous versions
|
||||
if [ -d "$rdhome/.downloaded_media" ]
|
||||
then
|
||||
mv -fv "$rdhome/.downloaded_media" "$media_folder"
|
||||
fi
|
||||
|
||||
# Unhiding themes folder from the previous versions
|
||||
if [ -d "$rdhome/.themes" ]
|
||||
then
|
||||
mv -fv "$rdhome/.themes" "$themes_folder"
|
||||
fi
|
||||
|
||||
# Doing the dir prep as we don't know from which version we came
|
||||
dir_prep "$media_folder" "/var/config/emulationstation/.emulationstation/downloaded_media"
|
||||
dir_prep "$themes_folder" "/var/config/emulationstation/.emulationstation/themes"
|
||||
mkdir -pv $rdhome/.logs #this was added later, maybe safe to remove in a few versions
|
||||
|
||||
|
||||
# Resetting es_settings, now we need it but in the future I should think a better solution, maybe with sed
|
||||
cp -fv /app/retrodeck/es_settings.xml /var/config/emulationstation/.emulationstation/es_settings.xml
|
||||
|
||||
|
||||
# 0.4 -> 0.5
|
||||
# Perform save and state migration if needed
|
||||
|
||||
versionwheresaveschanged="0.4.5b" # Hardcoded break point between unsorted and sorted saves
|
||||
|
||||
if [[ $(sed -e "s/\.//g" <<< $hard_version) > $(sed -e "s/\.//g" <<< $versionwheresaveschanged) ]] && [[ ! $(sed -e "s/\.//g" <<< $hard_version) == $(sed -e "s/\.//g" <<< $version) ]]; then # Check if user is upgrading from the version where save organization was changed. Try not to reuse this, it things 0.4.5b is newer than 0.4.5
|
||||
migration_logfile=$rdhome/.logs/savemove_"$(date +"%Y_%m_%d_%I_%M_%p").log"
|
||||
save_backup_file=$rdhome/savebackup_"$(date +"%Y_%m_%d_%I_%M_%p").zip"
|
||||
state_backup_file=$rdhome/statesbackup_"$(date +"%Y_%m_%d_%I_%M_%p").zip"
|
||||
|
||||
# NOTE: This Zenity command may need to be one line, it broke when I pasted it into a sandbox file
|
||||
|
||||
zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--title "RetroDECK" \
|
||||
--text="You are updating to a version of RetroDECK where save and state file sorting has changed!\n\nYour existing saves will be backed up to $save_backup_file\n\nYour existing states will be backed up to $state_backup_file\n\nIf a save or state cannot be sorted automatically it will remain in its original directory so you can sort it manually.\n\nIf you encounter any issues, a log of the sorting process is stored at $migration_logfile\n\nPLEASE BE PATIENT! This process can take several minutes if you have a large ROM library."
|
||||
|
||||
allgames=($(find "$roms_folder" -maxdepth 2 -mindepth 2 ! -name "systeminfo.txt" ! -name "systems.txt" ! -name "*^*" | sed -e "s/ /\^/g")) # Build an array of all games and multi-disc-game-containing folders, adding whitespace placeholder
|
||||
|
||||
allsaves=($(find "$saves_folder" -mindepth 1 -maxdepth 1 -name "*.*" | sed -e "s/ /\^/g")) # Build an array of all save files, ignoring standalone emulator sub-folders, adding whitespace placeholder
|
||||
|
||||
allstates=($(find "$states_folder" -mindepth 1 -maxdepth 1 -name "*.*" | sed -e "s/ /\^/g")) # Build an array of all state files, ignoring standalone emulator sub-folders, adding whitespace placeholder
|
||||
|
||||
totalsaves=${#allsaves[@]}
|
||||
totalstates=${#allstates[@]}
|
||||
filesleft=
|
||||
current_dest_folder=
|
||||
gamestoskip=
|
||||
|
||||
tar -C $rdhome -czf $save_backup_file saves # Backup save directory for safety
|
||||
echo "Saves backed up to" $save_backup_file >> $migration_logfile
|
||||
tar -C $rdhome -czf $state_backup_file states # Backup state directory for safety
|
||||
echo "States backed up to" $state_backup_file >> $migration_logfile
|
||||
|
||||
(
|
||||
movefile() { # Take matching save and rom files and sort save into appropriate system folder
|
||||
echo "# $filesleft $currentlybeingmoved remaining..." # These lines update the Zenity progress bar
|
||||
progress=$(( 100 - (( 100 / "$totalfiles" ) * "$filesleft" )))
|
||||
echo $progress
|
||||
filesleft=$((filesleft-1))
|
||||
if [[ ! " ${gamestoskip[*]} " =~ " ${1} " ]]; then # If the current game name exists multiple times in array ie. /roms/snes/Mortal Kombat 3.zip and /roms/genesis/Mortal Kombat 3.zip, skip and alert user to sort manually
|
||||
game=$(sed -e "s/\^/ /g" <<< "$1") # Remove whitespace placeholder
|
||||
gamebasename=$(basename "$game" | sed -e 's/\..*//') # Extract pure file name ie. /roms/snes/game1.zip becomes game1
|
||||
systemdir="$(basename "$(dirname "$1")")" # Extract parent directory identifying system ROM belongs to
|
||||
matches=($(find "$roms_folder" -maxdepth 2 -mindepth 2 -name "$gamebasename"".*" | sed -e 's/ /^/g' | sed -e 's/\..*//')) # Search for multiple instances of pure game name, adding to skip list if found
|
||||
if [[ ${#matches[@]} -gt 1 ]]; then
|
||||
echo "ERROR: Multiple ROMS found with name:" $gamebasename "Please sort saves and states for these ROMS manually" >> $migration_logfile
|
||||
gamestoskip+=("$1")
|
||||
return
|
||||
fi
|
||||
echo "INFO: Examining ROM file:" "$game" >> $migration_logfile
|
||||
echo "INFO: System detected as" $systemdir >> $migration_logfile
|
||||
sosfile=$(sed -e "s/\^/ /g" <<< "$2") # Remove whitespace placeholder from s-ave o-r s-tate file
|
||||
sospurebasename="$(basename "$sosfile")" # Extract pure file name ie. /saves/game1.sav becomes game1
|
||||
echo "INFO: Current save or state being examined for match:" $sosfile >> $migration_logfile
|
||||
echo "INFO: Matching save or state" $sosfile "and game" $game "found." >> $migration_logfile
|
||||
echo "INFO: Moving save or state to" $current_dest_folder"/"$systemdir"/"$sosbasename >> $migration_logfile
|
||||
if [[ ! -d $current_dest_folder"/"$systemdir ]]; then # If system directory doesn't exist for save yet, create it
|
||||
echo "WARNING: Creating missing system directory" $current_dest_folder"/"$systemdir
|
||||
mkdir $current_dest_folder/$systemdir
|
||||
fi
|
||||
mv "$sosfile" -t $current_dest_folder/$systemdir # Move save to appropriate system directory
|
||||
return
|
||||
else
|
||||
echo "WARNING: Game with name" "$(basename "$1" | sed -e "s/\^/ /g")" "already found. Skipping to next game..." >> $migration_logfile # Inform user of game being skipped due to duplicate ROM names
|
||||
fi
|
||||
}
|
||||
|
||||
find "$roms_folder" -mindepth 2 -maxdepth 2 -name "*\^*" -exec echo "ERROR: Game named" {} "found, please move save manually" \; >> $migration_logfile # Warn user if any of their files have the whitespace replacement character used by the script
|
||||
|
||||
totalfiles=$totalsaves #set variables for save file migration
|
||||
filesleft=$totalsaves
|
||||
currentlybeingmoved="saves"
|
||||
current_dest_folder=$saves_folder
|
||||
|
||||
for i in "${allsaves[@]}"; do # For each save file, compare to every ROM file name looking for a match
|
||||
found=
|
||||
currentsave=($(basename "$i" | sed -e 's/\..*//')) # Extract pure file name ie. /saves/game1.sav becomes game1
|
||||
for j in "${allgames[@]}"; do
|
||||
currentgame=($(basename "$j" | sed -e 's/\..*//')) # Extract pure file name ie. /roms/snes/game1.zip becomes game1
|
||||
[[ $currentgame == $currentsave ]] && { found=1; break; } # If names match move to next stage, otherwise skip
|
||||
done
|
||||
[[ -n $found ]] && movefile $j $i || echo "ERROR: No ROM match found for save file" $i | sed -e 's/\^/ /g' >> $migration_logfile # If a match is found, run movefile() otherwise warn user of stranded save file
|
||||
done
|
||||
|
||||
totalfiles=$totalstates #set variables for state file migration
|
||||
filesleft=$totalstates
|
||||
currentlybeingmoved="states"
|
||||
current_dest_folder=$states_folder
|
||||
|
||||
for i in "${allstates[@]}"; do # For each state file, compare to every ROM file name looking for a match
|
||||
found=
|
||||
currentstate=($(basename "$i" | sed -e 's/\..*//')) # Extract pure file name ie. /states/game1.sav becomes game1
|
||||
for j in "${allgames[@]}"; do
|
||||
currentgame=($(basename "$j" | sed -e 's/\..*//')) # Extract pure file name ie. /roms/snes/game1.zip becomes game1
|
||||
[[ $currentgame == $currentstate ]] && { found=1; break; } # If names match move to next stage, otherwise skip
|
||||
done
|
||||
[[ -n $found ]] && movefile $j $i || echo "ERROR: No ROM match found for state file" $i | sed -e 's/\^/ /g' >> $migration_logfile # If a match is found, run movefile() otherwise warn user of stranded state file
|
||||
done
|
||||
|
||||
) |
|
||||
zenity --progress \
|
||||
--icon-name=net.retrodeck.retrodeck \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--title="Processing Files" \
|
||||
--text="# files remaining..." \
|
||||
--percentage=0 \
|
||||
--no-cancel \
|
||||
--auto-close
|
||||
|
||||
# NOTE: This Zenity command may need to be one line, it broke when I pasted it into a sandbox file
|
||||
|
||||
else
|
||||
echo "Version" $version "is after the save and state organization was changed, no need to sort again"
|
||||
fi
|
||||
|
||||
ra_init
|
||||
standalones_init
|
||||
tools_init
|
||||
|
||||
create_lock
|
||||
}
|
||||
|
||||
start_retrodeck() {
|
||||
# normal startup
|
||||
echo "Starting RetroDECK v$version"
|
||||
emulationstation --home /var/config/emulationstation
|
||||
}
|
||||
|
||||
browse(){
|
||||
# Function for browsing the sd card
|
||||
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
|
||||
path_selected == 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
|
||||
}
|
||||
|
||||
#advanced(){
|
||||
# # function to give advanced install options
|
||||
# echo "Advaced choosed"
|
||||
#
|
||||
# choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
|
||||
# --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" \
|
||||
# --ok-label "ROMs" \
|
||||
# --extra-button "Media" \
|
||||
# --extra-button "Themes" \
|
||||
# --extra-button "Back" \
|
||||
# --text="What do you want to change?\n\nROMS folder = $roms_folder\nMedia folder (scraped data) = $media_folder\nThemes folder=$themes_folder" )
|
||||
# echo "Choice is $choice"
|
||||
#
|
||||
# case $choice in
|
||||
#
|
||||
# "" ) # Internal (yes)
|
||||
# echo "ROMs"
|
||||
# ;;
|
||||
#
|
||||
# "Media" )
|
||||
# echo "Media"
|
||||
# ;;
|
||||
#
|
||||
# "Themes" )
|
||||
# echo "Themes"
|
||||
# ;;
|
||||
#
|
||||
# "Back" ) # Browse + not found fallback
|
||||
# echo "Back"
|
||||
# finit
|
||||
# ;;
|
||||
#
|
||||
# esac
|
||||
#}
|
||||
|
||||
finit() {
|
||||
# Force/First init, depending on the situation
|
||||
|
||||
echo "Executing finit"
|
||||
|
||||
# Internal or SD Card?
|
||||
choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" \
|
||||
--ok-label "Cancel" \
|
||||
--extra-button "Internal" \
|
||||
--extra-button "SD Card" \
|
||||
#--extra-button "Advanced" \
|
||||
--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
|
||||
|
||||
"" ) # Cancel or X button quits
|
||||
echo "Now quitting"
|
||||
kill $$
|
||||
;;
|
||||
|
||||
"Internal" ) # Internal
|
||||
echo "Internal selected"
|
||||
roms_folder="$rdhome/roms"
|
||||
;;
|
||||
|
||||
"SD Card" )
|
||||
echo "SD Card selected"
|
||||
if [ ! -d "$sdcard" ] # SD Card path is not existing
|
||||
then
|
||||
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."
|
||||
browse # Calling the browse function
|
||||
else
|
||||
roms_folder="$sdcard/retrodeck/roms" # sdcard variable is correct as its given by browse function
|
||||
echo "ROMs folder = $roms_folder"
|
||||
fi
|
||||
;;
|
||||
|
||||
#"Advanced" ) # Browse + not found fallback
|
||||
# echo "Advanced"
|
||||
# advanced
|
||||
#;;
|
||||
|
||||
esac
|
||||
|
||||
mkdir -pv $roms_folder
|
||||
|
||||
# TODO: after the next update of ES-DE this will not be needed
|
||||
#zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text="EmulationStation will now initialize the system.\nPlease DON'T EDIT THE ROMS LOCATION, just select:\n\nCREATE DIRECTORIES\nYES\nOK\nQUIT\n\nRetroDECK will manage the rest."
|
||||
zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text="RetroDECK will now install the needed files.\nPlease wait up to one minute,\nanother message will notify when the process will be finished.\n\nPress OK to continue."
|
||||
|
||||
# Recreating the folder
|
||||
rm -rfv /var/config/emulationstation/
|
||||
rm -rfv /var/config/retrodeck/tools/
|
||||
mkdir -pv /var/config/emulationstation/
|
||||
|
||||
# Initializing ES-DE
|
||||
# TODO: after the next update of ES-DE this will not be needed - let's test it
|
||||
emulationstation --home /var/config/emulationstation --create-system-dirs
|
||||
|
||||
mkdir -pv /var/config/retrodeck/tools/
|
||||
|
||||
#zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text="RetroDECK will now install the needed files.\nPlease wait up to one minute,\nanother message will notify when the process will be finished.\n\nPress OK to continue."
|
||||
|
||||
# Initializing ROMs folder - Original in retrodeck home (or SD Card)
|
||||
dir_prep $roms_folder "/var/config/emulationstation/ROMs"
|
||||
|
||||
mkdir -pv $rdhome/saves
|
||||
mkdir -pv $rdhome/states
|
||||
mkdir -pv $rdhome/screenshots
|
||||
mkdir -pv $rdhome/bios/pico8
|
||||
mkdir -pv $rdhome/.logs
|
||||
|
||||
# XMLSTARLET HERE
|
||||
cp -fv /app/retrodeck/es_settings.xml /var/config/emulationstation/.emulationstation/es_settings.xml
|
||||
|
||||
# ES-DE preparing themes and scraped folders
|
||||
dir_prep "$rdhome/downloaded_media" "/var/config/emulationstation/.emulationstation/downloaded_media"
|
||||
dir_prep "$rdhome/themes" "/var/config/emulationstation/.emulationstation/themes"
|
||||
|
||||
# PICO-8
|
||||
dir_prep "$roms_folder/pico8" "$rdhome/bios/pico8/bbs/carts" #this is the folder where pico-8 is saving the carts
|
||||
|
||||
ra_init
|
||||
standalones_init
|
||||
tools_init
|
||||
create_lock
|
||||
|
||||
zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--title "RetroDECK" \
|
||||
--text="Installation completed.\nPlease put your roms in:\n\n$roms_folder\n\nand your bioses in\n\n$rdhome/bios\n\nThen start the program again.\nIf you wish to change the roms location, you may use the tool located the tools section of RetroDECK.\n\nIMPORTANT NOTES:\n- RetroDECK must be manually added and launched from your Steam Library in order to work correctly.\n- It's recommended to use the 'RetroDECK Offical Controller Config' from Steam (under community layouts).\n- It's suggested to use BoilR to automatically add the SteamGridDB images to Steam (this will be automated soon).\nhttps://github.com/PhilipK/BoilR"
|
||||
# TODO: Replace the stuff above with BoilR code when ready
|
||||
}
|
||||
|
||||
conf_write() {
|
||||
# writes the variables in the retrodeck config file
|
||||
|
||||
echo "DEBUG: printing the config file content before writing it:"
|
||||
cat "$rd_conf"
|
||||
echo ""
|
||||
|
||||
echo "Writing the config file: $rd_conf"
|
||||
|
||||
# TODO: this can be optimized with a while and a list of variables to check
|
||||
if [ ! -z "$version" ] #if the variable is not null then I update it
|
||||
then
|
||||
sed -i "s%version=.*%version=$version%" "$rd_conf"
|
||||
fi
|
||||
|
||||
if [ ! -z "$rdhome" ]
|
||||
then
|
||||
sed -i "s%rdhome=.*%rdhome=$rdhome%" "$rd_conf"
|
||||
fi
|
||||
|
||||
if [ ! -z "$roms_folder" ]
|
||||
then
|
||||
sed -i "s%roms_folder=.*%roms_folder=$roms_folder%" "$rd_conf"
|
||||
fi
|
||||
|
||||
if [ ! -z "$saves_folder" ]
|
||||
then
|
||||
sed -i "s%saves_folder=.*%saves_folder=$saves_folder%" "$rd_conf"
|
||||
fi
|
||||
|
||||
if [ ! -z "$states_folder" ]
|
||||
then
|
||||
sed -i "s%states_folder=.*%states_folder=$states_folder%" "$rd_conf"
|
||||
fi
|
||||
|
||||
if [ ! -z "$bios_folder" ]
|
||||
then
|
||||
sed -i "s%bios_folder=.*%bios_folder=$bios_folder%" "$rd_conf"
|
||||
fi
|
||||
|
||||
if [ ! -z "$media_folder" ]
|
||||
then
|
||||
sed -i "s%media_folder=.*%media_folder=$media_folder%" "$rd_conf"
|
||||
fi
|
||||
|
||||
if [ ! -z "$themes_folder" ]
|
||||
then
|
||||
sed -i "s%themes_folder=.*%themes_folder=$themes_folder%" "$rd_conf"
|
||||
fi
|
||||
|
||||
if [ ! -z "$sdcard" ]
|
||||
then
|
||||
sed -i "s%sdcard=.*%sdcard=$sdcard%" "$rd_conf"
|
||||
fi
|
||||
echo "DEBUG: New contents:"
|
||||
cat "$rd_conf"
|
||||
echo ""
|
||||
|
||||
}
|
|
@ -43,7 +43,12 @@ conf_write() {
|
|||
then
|
||||
sed -i "s%states_folder=.*%states_folder=$states_folder%" "$rd_conf"
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -z "$bios_folder" ]
|
||||
then
|
||||
sed -i "s%bios_folder=.*%bios_folder=$bios_folder%" "$rd_conf"
|
||||
fi
|
||||
|
||||
if [ ! -z "$media_folder" ]
|
||||
then
|
||||
sed -i "s%media_folder=.*%media_folder=$media_folder%" "$rd_conf"
|
||||
|
@ -80,6 +85,7 @@ then
|
|||
roms_folder="$rdhome/roms" # the default roms folder path
|
||||
saves_folder="$rdhome/saves" # the default saves folder path
|
||||
states_folder="$rdhome/states" # the default states folder path
|
||||
bios_folder="$rdhome/bios" # the default bios folder
|
||||
media_folder="$rdhome/downloaded_media" # the media folder, where all the scraped data is downloaded into
|
||||
themes_folder="$rdhome/themes" # the themes folder
|
||||
sdcard="$default_sd" # Steam Deck SD default path
|
||||
|
@ -91,6 +97,7 @@ then
|
|||
echo "roms_folder=$roms_folder" >> $rd_conf
|
||||
echo "saves_folder=$saves_folder" >> $rd_conf
|
||||
echo "states_folder=$states_folder" >> $rd_conf
|
||||
echo "bios_folder=$bios_folder" >> $rd_conf
|
||||
echo "media_folder=$media_folder" >> $rd_conf
|
||||
echo "themes_folder=$themes_folder" >> $rd_conf
|
||||
echo "sdcard=$sdcard" >> $rd_conf
|
||||
|
|
|
@ -1413,7 +1413,10 @@ modules:
|
|||
|
||||
- cp global.sh /app/bin/global.sh
|
||||
- chmod +x /app/bin/global.sh
|
||||
|
||||
|
||||
- cp functions.sh /app/libexec/functions.sh
|
||||
- chmod +x /app/libexec/functions.sh
|
||||
|
||||
# Desktop entry
|
||||
- cp net.retrodeck.retrodeck.desktop /app/share/applications/net.retrodeck.retrodeck.desktop
|
||||
|
||||
|
|
|
@ -436,7 +436,7 @@ browse(){
|
|||
--text="Your rom folder will be:\n\n$sdcard/retrodeck/roms\n\nis that ok?"
|
||||
if [ $? == 0 ] #yes
|
||||
then
|
||||
sdselected == true
|
||||
path_selected == true
|
||||
roms_folder="$sdcard/retrodeck/roms"
|
||||
break
|
||||
else
|
||||
|
|
|
@ -1,47 +1,403 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /app/bin/global.sh # Store actual work code in globals (for use elsewhere if needed) and keep Configurator strictly dialogs
|
||||
# VARIABLES SECTION
|
||||
|
||||
source /app/bin/global.sh # Grab global variables
|
||||
source /app/libexec/functions.sh # Source global functions
|
||||
|
||||
# Config files for emulators with single config files
|
||||
|
||||
raconf="/var/config/retroarch/retroarch.cfg"
|
||||
ra_core_conf="/var/config/retroarch/retroarch-core-options.cfg"
|
||||
citraconf="/var/config/citra-emu/qt-config.ini"
|
||||
melondsconf="/var/config/melonDS/melonDS.ini"
|
||||
rpcs3conf="/var/config/rpcs3/config.yml"
|
||||
yuzuconf="/var/config/yuzu/qt-config.ini"
|
||||
|
||||
# Dolphin config files
|
||||
|
||||
dolphinconf="/var/config/dolphin-emu/Dolphin.ini"
|
||||
dolphingcpadconf="/var/config/dolphin-emu/GCPadNew.ini"
|
||||
dolphingfxconf="/var/config/dolphin-emu/GFX.ini"
|
||||
dolphinhkconf="/var/config/dolphin-emu/Hotkeys.ini"
|
||||
dolphinqtconf="/var/config/dolphin-emu/Qt.ini"
|
||||
|
||||
# PCSX2 config files
|
||||
|
||||
pcsx2conf="/var/config/PCSX2/inis/GS.ini"
|
||||
pcsx2uiconf="/var/config/PCSX2/inis/PCSX2_ui.ini"
|
||||
pcsx2vmconf="/var/config/PCSX2/inis/PCSX2_vm.ini"
|
||||
|
||||
|
||||
# FUNCTION SECTION
|
||||
|
||||
browse() {
|
||||
# Function for browsing directories, sets directory selected to variable $target for use in other functions
|
||||
|
||||
path_selected=false
|
||||
|
||||
while [ $path_selected == false ]
|
||||
do
|
||||
target="$(zenity --file-selection --title="Choose target location to $action" --directory)"
|
||||
echo "Path chosen: $target, 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 new directory will be:\n\n$target\n\nis that ok?"
|
||||
if [ $? == 0 ] #yes
|
||||
then
|
||||
path_selected == true
|
||||
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
|
||||
target=
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
move() {
|
||||
|
||||
}
|
||||
|
||||
edit_setting() {
|
||||
# Function for editing settings
|
||||
# USAGE: $(edit_setting $setting_name $new_setting_value $system) (needed as different systems use different config file syntaxes)
|
||||
|
||||
|
||||
}
|
||||
|
||||
get_setting_value() {
|
||||
# Function for getting the current value of a setting from a config file
|
||||
# USAGE: $(get_setting_value $setting_name $system) (needed as different systems use different config file syntaxes)
|
||||
|
||||
|
||||
|
||||
case $2 in
|
||||
|
||||
"retrodeck" )
|
||||
;;
|
||||
|
||||
"retroarch" )
|
||||
echo $(grep $2 $raconf | grep -o -P "(?<=$2 = \").*(?=\")")
|
||||
;;
|
||||
|
||||
"retroarch-core-configs" )
|
||||
;;
|
||||
|
||||
"dolphin" )
|
||||
;;
|
||||
|
||||
"duckstation" )
|
||||
;;
|
||||
|
||||
"pcsx2" )
|
||||
;;
|
||||
|
||||
"ppsspp" )
|
||||
;;
|
||||
|
||||
"rpcs3" )
|
||||
;;
|
||||
|
||||
"yuzu" )
|
||||
;;
|
||||
|
||||
"citra" )
|
||||
;;
|
||||
|
||||
"melonds" )
|
||||
;;
|
||||
|
||||
"xemu" )
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
# DIALOG SECTION
|
||||
|
||||
# Configurator Option Tree
|
||||
|
||||
# Welcome
|
||||
# - Move Directories
|
||||
# - Migrate ROM directory
|
||||
# - Migrate downloaded_media
|
||||
# - Migrate BIOS directory
|
||||
# - Change Options
|
||||
# - Change Rewind Setting
|
||||
# - Upgrade Files
|
||||
# - Grab all missing cores
|
||||
# - Update all cores to nightly
|
||||
# - Migrate ROM directory
|
||||
# - Migrate downloaded_media
|
||||
# - Migrate BIOS directory
|
||||
# - Change Emulator Options
|
||||
# - RetroArch
|
||||
# - Change Rewind Setting
|
||||
# - Add or Update Files
|
||||
# - Add specific cores
|
||||
# - Grab all missing cores
|
||||
# - Update all cores to nightly
|
||||
# - RetroAchivement login
|
||||
# - Login prompt
|
||||
# - Login prompt
|
||||
# - Reset RetroDECK
|
||||
# - Reset RetroArch
|
||||
# - Reset Standalone Emulators
|
||||
# - Reset Tools
|
||||
# - Reset All
|
||||
# - Reset RetroArch
|
||||
# - Reset Standalone Emulators
|
||||
# - Reset Tools
|
||||
# - Reset All
|
||||
|
||||
configurator_welcome_dialog() {
|
||||
# Code for the menus should be put in reverse order, so functions for sub-menus exists before it is called by the parent menu
|
||||
|
||||
configurator_process_complete_dialog() {
|
||||
zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--title "RetroDECK Configurator Utility - Process Complete" \
|
||||
--text="The process of $1 is now complete.\n\nClick OK to return to the Main Menu"
|
||||
|
||||
configurator_welcome_dialog
|
||||
}
|
||||
|
||||
configurator_progress_bar_dialog() {
|
||||
|
||||
}
|
||||
|
||||
configurator_migration_dialog() {
|
||||
configurator_reset_dialog() {
|
||||
choice=$(zenity --list --title="RetroDECK Configurator Utility - Reset Options" --cancel-label="Back" \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--column="Choice" --column="Action" \
|
||||
"Reset RetroArch" "Reset RetroArch to default settings" \
|
||||
"Reset Standalones" "Reset standalone emulators to default settings" \
|
||||
"Reset Tools" "Reset Tools menu entries" \
|
||||
"Reset All" "Reset RetroDECK to default settings" )
|
||||
|
||||
case $choice in
|
||||
|
||||
"Reset RetroArch" )
|
||||
ra_init
|
||||
configurator_process_complete_dialog "resetting RetroArch"
|
||||
;;
|
||||
|
||||
"Reset Standalones" )
|
||||
standalones_init
|
||||
configurator_process_complete_dialog "resetting standalone emulators"
|
||||
;;
|
||||
|
||||
"Reset Tools" )
|
||||
tools_init
|
||||
configurator_process_complete_dialog "resetting the tools menu"
|
||||
;;
|
||||
|
||||
"Reset All" )
|
||||
zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--title "RetroDECK Configurator Utility - Reset RetroDECK" \
|
||||
--text="You are resetting RetroDECK to its default state.\n\nAfter the process is complete you will need to exit RetroDECK and run it again."
|
||||
rm -f "$lockfile"
|
||||
configurator_process_complete_dialog "resetting RetroDECK"
|
||||
;;
|
||||
|
||||
"" ) # No selection made or Back button clicked
|
||||
configurator_welcome_dialog
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
|
||||
configurator_options_dialog() {
|
||||
configurator_retroachivement_dialog() {
|
||||
login=$(zenity --forms --title="RetroDECK Configurator Utility - RetroAchievements Login" --cancel-label="Back" \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--text="Enter your RetroAchievements Account details.\n\nBe aware that this tool cannot verify your login details.\nFor registration and more info visit\nhttps://retroachievements.org/\n" \
|
||||
--separator="=SEP=" \
|
||||
--add-entry="Username" \
|
||||
--add-password="Password")
|
||||
|
||||
if [ $? == 1 ] # Cancel button clicked
|
||||
then
|
||||
configurator_welcome_dialog
|
||||
fi
|
||||
|
||||
arrIN=(${login//=SEP=/ })
|
||||
user=${arrIN[0]}
|
||||
pass=${arrIN[1]}
|
||||
|
||||
sed -i "s%cheevos_enable =.*%cheevos_enable = \"true\"%" $raconf
|
||||
sed -i "s%cheevos_username =.*%cheevos_username = \"$user\"%" $raconf
|
||||
sed -i "s%cheevos_password =.*%cheevos_password = \"$pass\"%" $raconf
|
||||
}
|
||||
|
||||
configurator_update_dialog() {
|
||||
|
||||
}
|
||||
|
||||
configurator_retroachivement_dialog() {
|
||||
configurator_power_user_changes_dialog() {
|
||||
zenity --title "RetroDECK Configurator Utility - Power User Options" --question --no-wrap --cancel-label="Back" \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--text="Making manual changes to an emulators configuration may create serious issues,\nand some settings may be overwitten during RetroDECK updates.\n\nplease continue only if you know what you're doing.\n\nDo you want to continue?"
|
||||
|
||||
if [ $? == 1 ] # Cancel button clicked
|
||||
then
|
||||
configurator_options_dialog
|
||||
fi
|
||||
|
||||
emulator="$(zenity --list \
|
||||
--title "RetroDECK Configurator Utility - Power User Options" --cancel-label="Back" \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--text="Which emulator do you want to configure?" \
|
||||
--hide-header \
|
||||
--column=emulator \
|
||||
"RetroArch" \
|
||||
"Citra" \
|
||||
"Dolphin" \
|
||||
"Duckstation" \
|
||||
"MelonDS" \
|
||||
"PCSX2-QT" \
|
||||
"PCSX2-Legacy" \
|
||||
"PPSSPP" \
|
||||
"RPCS3" \
|
||||
"XEMU" \
|
||||
"Yuzu")"
|
||||
|
||||
case $emulator in
|
||||
|
||||
"RetroArch" )
|
||||
retroarch
|
||||
;;
|
||||
|
||||
"Citra" )
|
||||
citra-qt
|
||||
;;
|
||||
|
||||
"Dolphin" )
|
||||
dolphin-emu
|
||||
;;
|
||||
|
||||
"Duckstation" )
|
||||
duckstation-qt
|
||||
;;
|
||||
|
||||
"MelonDS" )
|
||||
melonDS
|
||||
;;
|
||||
|
||||
"PCSX2-QT" )
|
||||
pcsx2-qt
|
||||
;;
|
||||
|
||||
"PCSX2-Legacy" )
|
||||
pcsx2
|
||||
;;
|
||||
|
||||
"PPSSPP" )
|
||||
PPSSPPSDL
|
||||
;;
|
||||
|
||||
"RPCS3" )
|
||||
rpcs3
|
||||
;;
|
||||
|
||||
"XEMU" )
|
||||
xemu
|
||||
;;
|
||||
|
||||
"Yuzu" )
|
||||
yuzu
|
||||
;;
|
||||
|
||||
"" ) # No selection made or Back button clicked
|
||||
configurator_options_dialog
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
|
||||
configurator_rewind_dialog() {
|
||||
zenity --question \
|
||||
--no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--title "RetroDECK" \
|
||||
--text="Do you want to enable the rewind function in RetroArch cores?\n\nNOTE:\nThis may impact on performances expecially on the latest systems."
|
||||
|
||||
if [ $? == 0 ] #yes, enable
|
||||
then
|
||||
sed -i 's%rewind_enable = .*%rewind_enable = "true"' $raconf
|
||||
zenity --info \
|
||||
--no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--title "RetroDECK" \
|
||||
--text="Rewind enabled\!\nYou can check on Libretro docs to see which cores supports this function."
|
||||
else # no, disable
|
||||
sed -i 's%rewind_enable = .*%rewind_enable = "false"' $raconf
|
||||
zenity --info \
|
||||
--no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--title "RetroDECK" \
|
||||
--text="Rewind disabled."
|
||||
fi
|
||||
}
|
||||
|
||||
configurator_options_dialog() {
|
||||
choice=$(zenity --list --title="RetroDECK Configurator Utility - Change Options" --cancel-label="Back" \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--column="Choice" --column="Action" \
|
||||
"Enable-Disable Rewind" "Enable or disable Rewind function in RetroArch" \
|
||||
"Power User Changes" "Make changes directly in an emulator" )
|
||||
|
||||
case $choice in
|
||||
|
||||
"Enable-Disable Rewind" )
|
||||
configurator_rewind_dialog
|
||||
;;
|
||||
|
||||
"Power User Changes" )
|
||||
configurator_power_user_changes_dialog
|
||||
;;
|
||||
|
||||
"" ) # No selection made or Back button clicked
|
||||
configurator_welcome_dialog
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
|
||||
configurator_migration_dialog() {
|
||||
|
||||
}
|
||||
|
||||
configurator_reset_dialog() {
|
||||
configurator_welcome_dialog() {
|
||||
# Clear the variables
|
||||
target=
|
||||
setting=
|
||||
action=
|
||||
setting_value=
|
||||
|
||||
}
|
||||
choice=$(zenity --list --title="RetroDECK Configurator Utility" --cancel-label="Quit" \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--column="Choice" --column="Action" \
|
||||
"Move Files" "Move files between internal/SD card or to custom locations" \
|
||||
"Change Options" "Adjust how RetroDECK behaves" \
|
||||
"Upgrade" "Upgrade parts of RetroDECK" \
|
||||
"RetroAchivements" "Log in to RetroAchievements" \
|
||||
"Reset" "Reset parts of RetroDECK" )
|
||||
|
||||
case $choice in
|
||||
|
||||
"Move Files" )
|
||||
configurator_migration_dialog
|
||||
;;
|
||||
|
||||
"Change Options" )
|
||||
configurator_options_dialog
|
||||
;;
|
||||
|
||||
"Upgrade" )
|
||||
configurator_update_dialog
|
||||
;;
|
||||
|
||||
"RetroAchivements" )
|
||||
configurator_retroachivement_dialog
|
||||
;;
|
||||
|
||||
"Reset" )
|
||||
configurator_reset_dialog
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
|
||||
# START THE CONFIGURATOR
|
||||
|
||||
configurator_welcome_dialog
|
0
tools/configure-emulators.sh → tools/configure-emulators.sh.disabled
Executable file → Normal file
0
tools/configure-emulators.sh → tools/configure-emulators.sh.disabled
Executable file → Normal file
Loading…
Reference in a new issue