Merge branch 'cooker-0.6.3b' of https://github.com/XargonWan/RetroDECK into cooker-0.6.3b

This commit is contained in:
XargonWan 2023-03-19 08:56:04 +00:00
commit 566f11bb77
10 changed files with 371 additions and 128 deletions

View file

@ -0,0 +1,38 @@
[chd]
dreamcast
psx
ps2
[chd-maybe]
3do
amiga
amiga1200
amiga600
amigacd32
cdimono1
cdtv
dreamcast
gamegear
genesis
mame-advmame
mame-mame4all
mastersystem
megacd
megacdjp
megadrive
mess
neogeo
neogeocd
neogeocdjp
pcengine
pcenginecd
pcfx
ps2
psx
saturn
saturnjp
segacd
sg-1000
supergrafx
tg16
tg-cd
[zip]

View file

@ -73,9 +73,9 @@ verify_space() {
# USAGE: verify_space $source_dir $dest_dir
# Function returns "true" if there is enough space, "false" if there is not
source_size=$(du -sk $1 | awk '{print $1}')
source_size=$(du -sk "$1" | awk '{print $1}')
source_size=$((source_size+(source_size/10))) # Add 10% to source size for safety
dest_avail=$(df -k --output=avail $2 | tail -1)
dest_avail=$(df -k --output=avail "$2" | tail -1)
if [[ $source_size -ge $dest_avail ]]; then
echo "false"
@ -88,13 +88,13 @@ move() {
# Function to move a directory from one parent to another
# USAGE: move $source_dir $dest_dir
if [[ ! -d "$2/$(basename $1)" ]]; then
if [[ $(verify_space $1 $2) ]]; then
if [[ ! -d "$2/$(basename "$1")" ]]; then
if [[ $(verify_space "$1" "$2") ]]; then
(
if [[ ! -d $2 ]]; then # Create destination directory if it doesn't already exist
mkdir -pv $2
if [[ ! -d "$2" ]]; then # Create destination directory if it doesn't already exist
mkdir -pv "$2"
fi
mv -v -t $2 $1
mv -v -t "$2" "$1"
) |
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
@ -121,49 +121,97 @@ compress_to_chd () {
# USAGE: compress_to_chd $full_path_to_input_file $full_path_to_output_file
echo "Compressing file $1 to $2.chd"
/app/bin/chdman createcd -i $1 -o $2.chd
/app/bin/chdman createcd -i "$1" -o "$2".chd
}
validate_for_chd () {
# Function for validating chd compression candidates, and compresses if validation passes. Supports .cue, .iso and .gdi formats ONLY
# USAGE: validate_for_chd $input_file
local file=$1
current_run_log_file="chd_compression_"$(date +"%Y_%m_%d_%I_%M_%p").log""
echo "Validating file:" $file > "$logs_folder/$current_run_log_file"
local file="$1"
local file_validated="false"
current_run_log_file="chd_compression_$(basename "$file").log"
echo "Validating file:" "$file" > "$logs_folder/$current_run_log_file"
if [[ "$file" == *".cue" ]] || [[ "$file" == *".gdi" ]] || [[ "$file" == *".iso" ]]; then
echo ".cue/.iso/.gdi file detected" >> $logs_folder/$current_run_log_file
local file_path=$(dirname $(realpath $file))
local file_base_name=$(basename $file)
echo ".cue/.iso/.gdi file detected" >> "$logs_folder/$current_run_log_file"
local file_path=$(dirname "$(realpath "$file")")
local file_base_name=$(basename "$file")
local file_name=${file_base_name%.*}
echo "File base path:" $file_path >> "$logs_folder/$current_run_log_file"
echo "File base name:" $file_name >> "$logs_folder/$current_run_log_file"
if [[ "$file" == *".cue" ]]; then # Validate .cue file
local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" $file)
local cue_validated="false"
for line in $cue_bin_files
echo "Validating .cue associated .bin files" >> "$logs_folder/$current_run_log_file"
local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file")
echo "Associated bin files read:" >> "$logs_folder/$current_run_log_file"
printf '%s\n' "$cue_bin_files" >> "$logs_folder/$current_run_log_file"
while IFS= read -r line
do
echo "looking for $file_path/$line" >> "$logs_folder/$current_run_log_file"
if [[ -f "$file_path/$line" ]]; then
echo ".bin file found at $file_path/$line" >> "$logs_folder/$current_run_log_file"
cue_validated="true"
file_validated="true"
else
echo ".bin file NOT found at $file_path/$line" >> "$logs_folder/$current_run_log_file"
echo ".cue file could not be validated. Please verify your .cue file contains the correct corresponding .bin file information and retry." >> "$logs_folder/$current_run_log_file"
cue_validated="false"
file_validated="false"
break
fi
done
if [[ $cue_validated == "true" ]]; then
echo $cue_validated
done < <(printf '%s\n' "$cue_bin_files")
if [[ $file_validated == "true" ]]; then
echo $file_validated
fi
else
echo $cue_validated
else # If file is a .iso or .gdi
file_validated="true"
echo $file_validated
fi
else
echo "File type not recognized. Supported file types are .cue, .gdi and .iso" >> "$logs_folder/$current_run_log_file"
fi
}
cli_compress_file() {
# This function will compress a single file passed from the CLI arguments
# USAGE: cli_compress_file $full_file_path
local file="$1"
echo "Looking for" "$file"
current_run_log_file="chd_compression_$(basename "$file").log"
if [[ ! -z "$file" ]]; then
if [[ -f "$file" ]]; then
if [[ $(validate_for_chd "$file") == "true" ]]; then
read -p "RetroDECK will now attempt to compress your selected game. Press Enter key to continue..."
read -p "Do you want to have the original file removed after compression is complete? Please answer y/n and press Enter: " post_compression_cleanup
local filename_no_path=$(basename "$file")
local filename_no_extension="${filename_no_path%.*}"
local source_file=$(dirname "$(realpath "$file")")"/"$(basename "$file")
local dest_file=$(dirname "$(realpath "$file")")"/""$filename_no_extension"
echo "Compressing $filename_no_path"
compress_to_chd "$source_file" "$dest_file"
if [[ $post_compression_cleanup == [yY] ]]; then # Remove file(s) if requested
if [[ "$file" == *".cue" ]]; then
local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file")
local file_path=$(dirname "$(realpath "$file")")
while IFS= read -r line
do # Remove associated .bin files
echo "Removing file "$line""
rm -f "$file_path/$line"
done < <(printf '%s\n' "$cue_bin_files") # Remove original .cue file
echo "Removing file "$filename_no_path""
rm -f $(realpath "$file")
else
echo "Removing file "$filename_no_path""
rm -f $(realpath "$file")
fi
fi
else
printf "An error occured during the compression process. Please see the following log entries for details:\n\n"
cat "$logs_folder/$current_run_log_file"
fi
else
echo "File not found, please specify the full path to the file to be compressed."
fi
else
echo "Please use this command format \"--compress <cue/gdi/iso file to compress>\""
fi
}
desktop_mode_warning() {
# This function is a generic warning for issues that happen when running in desktop mode.
# Running in desktop mode can be verified with the following command: if [[ ! $XDG_CURRENT_DESKTOP == "gamescope" ]]; then
@ -581,7 +629,6 @@ update_rd_conf() {
deploy_single_patch $rd_defaults $rd_update_patch $rd_conf
set_setting_value $rd_conf "version" "$hard_version" retrodeck # Set version of currently running RetroDECK to updated retrodeck.cfg
rm -f $rd_update_patch # Cleanup temporary patch file
source $rd_conf # Load new config file variables
}
conf_write() {
@ -733,7 +780,7 @@ dolphin_init() {
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/states/dolphin" "/var/data/dolphin-emu/StateSaves"
mkdir -pv /var/data/dolphin-emu/Wii/
dir_prep "$rdhome/saves/wii/dolphin" "/var/data/dolphin-emu/Wii"
}
@ -751,7 +798,7 @@ primehack_init() {
dir_prep "$rdhome/saves/gc/primehack/USA" "/var/data/primehack/GC/USA"
dir_prep "$rdhome/saves/gc/primehack/JAP" "/var/data/primehack/GC/JAP"
dir_prep "$rdhome/screenshots" "/var/data/primehack/ScreenShots"
dir_prep "$rdhome/states" "/var/data/primehack/StateSaves"
dir_prep "$rdhome/states/primehack" "/var/data/primehack/StateSaves"
mkdir -pv /var/data/primehack/Wii/
dir_prep "$rdhome/saves/wii/primehack" "/var/data/primehack/Wii"
}
@ -802,9 +849,6 @@ citra_init() {
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_init() {
@ -1025,7 +1069,7 @@ emulators_post_move() {
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/states/dolphin" "/var/data/dolphin-emu/StateSaves"
dir_prep "$rdhome/saves/wii/dolphin" "/var/data/dolphin-emu/Wii/"
# Primehack section
@ -1034,7 +1078,7 @@ emulators_post_move() {
dir_prep "$rdhome/saves/gc/primehack/USA" "/var/data/primehack/GC/USA"
dir_prep "$rdhome/saves/gc/primehack/JAP" "/var/data/primehack/GC/JAP"
dir_prep "$rdhome/screenshots" "/var/data/primehack/ScreenShots"
dir_prep "$rdhome/states" "/var/data/primehack/StateSaves"
dir_prep "$rdhome/states/primehack" "/var/data/primehack/StateSaves"
dir_prep "$rdhome/saves/wii/primehack" "/var/data/primehack/Wii/"
# PCSX2 section
@ -1269,7 +1313,7 @@ finit() {
dir_prep "$themes_folder" "/var/config/emulationstation/.emulationstation/themes"
# PICO-8
dir_prep "$bios_folder/pico-8" "~/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed
dir_prep "$bios_folder/pico-8" "$HOME/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed
dir_prep "$roms_folder/pico8" "$bios_folder/pico-8/carts" # Symlink default game location to RD roms for cleanliness (this location is overridden anyway by the --root_path launch argument anyway)
dir_prep "$bios_folder/pico-8/cdata" "$saves_folder/pico-8" # PICO-8 saves folder

View file

@ -5,19 +5,20 @@
source /app/libexec/functions.sh
# Static variables
rd_conf="/var/config/retrodeck/retrodeck.cfg" # RetroDECK config file path
rd_conf_backup="/var/config/retrodeck/retrodeck.bak" # Backup of RetroDECK config file from update
emuconfigs="/app/retrodeck/emu-configs" # folder with all the default emulator configs
rd_defaults="$emuconfigs/defaults/retrodeck.cfg" # A default RetroDECK config file
rd_update_patch="/var/config/retrodeck/rd_update.patch" # A static location for the temporary patch file used during retrodeck.cfg updates
bios_checklist="/var/config/retrodeck/tools/bios_checklist.cfg" # A config file listing BIOS file information that can be verified
easter_egg_checklist="/var/config/retrodeck/tools/easter_egg_checklist.cfg" # A config file listing days and times when special splash screens should show up
splashscreen_dir="/var/config/emulationstation/graphics/extra-splashes" # The default location of extra splash screens
current_splash_file="/var/config/emulationstation/graphics/splash.svg" # The active splash file that will be shown on boot
default_splash_file="/var/config/emulationstation/graphics/splash-orig.svg" # The default RetroDECK splash screen
lockfile="/var/config/retrodeck/.lock" # where the lockfile is located
default_sd="/run/media/mmcblk0p1" # Steam Deck SD default path
hard_version="$(cat '/app/retrodeck/version')" # hardcoded version (in the readonly filesystem)
rd_conf="/var/config/retrodeck/retrodeck.cfg" # RetroDECK config file path
rd_conf_backup="/var/config/retrodeck/retrodeck.bak" # Backup of RetroDECK config file from update
emuconfigs="/app/retrodeck/emu-configs" # folder with all the default emulator configs
rd_defaults="$emuconfigs/defaults/retrodeck/retrodeck.cfg" # A default RetroDECK config file
rd_update_patch="/var/config/retrodeck/rd_update.patch" # A static location for the temporary patch file used during retrodeck.cfg updates
bios_checklist="$emuconfigs/defaults/retrodeck/bios_checklist.cfg" # A config file listing BIOS file information that can be verified
compression_targets="$emuconfigs/defaults/retrodeck/compression_targets.cfg" # A config file containing supported compression types per system
easter_egg_checklist="$emuconfigs/defaults/retrodeck/easter_egg_checklist.cfg" # A config file listing days and times when special splash screens should show up
splashscreen_dir="/var/config/emulationstation/.emulationstation/resources/graphics/extra-splashes" # The default location of extra splash screens
current_splash_file="/var/config/emulationstation/.emulationstation/resources/graphics/splash.svg" # The active splash file that will be shown on boot
default_splash_file="/var/config/emulationstation/.emulationstation/resources/graphics/splash-orig.svg" # The default RetroDECK splash screen
lockfile="/var/config/retrodeck/.lock" # where the lockfile is located
default_sd="/run/media/mmcblk0p1" # Steam Deck SD default path
hard_version="$(cat '/app/retrodeck/version')" # hardcoded version (in the readonly filesystem)
# Config files for emulators with single config files
@ -54,6 +55,14 @@ pcsx2vmconf="/var/config/PCSX2/inis/PCSX2_vm.ini"
pcsx2qtconf="/var/config/PCSX2/inis/PCSX2.ini"
# Primehack config files
primehackconf="/var/config/primehack/Dolphin.ini"
primehackgcpadconf="/var/config/primehack/GCPadNew.ini"
primehackgfxconf="/var/config/primehack/GFX.ini"
primehackhkconf="/var/config/primehack/Hotkeys.ini"
primehackqtconf="/var/config/primehack/Qt.ini"
# We moved the lockfile in /var/config/retrodeck in order to solve issue #53 - Remove in a few versions
if [ -f "$HOME/retrodeck/.lock" ]
then

View file

@ -78,7 +78,7 @@ modules:
- |
git checkout ${GITHUB_REF_NAME}
mkdir -p ${FLATPAK_DEST}/retrodeck/
VERSION="0.6.2b"
VERSION="cooker-0.6.3b"
if [[ $VERSION == *"cooker"* ]];
then
VERSION="$VERSION-[$(git rev-parse --short HEAD)]"
@ -417,7 +417,7 @@ modules:
sources:
- type: archive
url: https://buildbot.libretro.com/stable/1.15.0/linux/x86_64/RetroArch_cores.7z
sha256: 1fdec5c2cbabea4f194ede4a1fb0dd1d17e14e64bf7ef705e3ad763592411073
sha256: 2230bc38eaf87406efd0c2b7bdd1cf9e813ba113505600f14a7ef9eb06f8c7c0
# PPSSPP - START
# https://github.com/flathub/org.ppsspp.PPSSPP
@ -847,8 +847,8 @@ modules:
- install -D primehack-wrapper /app/bin/primehack-wrapper
sources:
- type: git
url: https://github.com/shiiion/dolphin.git
commit: efb99ebfd20b1bc16ea3e51fec409c91e354d8c2
url: https://github.com/TheDrifter363/primehack.git
commit: 6295c695307a67f11ee202b05cbdd7b5c1edae5c
# detects whether dolphin is running in a flatpak sandbox
# and makes it use xdg directories if it is.
# prevents dolphin from attempting to write conf files
@ -1091,4 +1091,4 @@ modules:
sources:
- type: git
url: https://github.com/XargonWan/RetroDECK.git
branch: main
branch: cooker-0.6.3b

View file

@ -187,7 +187,7 @@ post_update() {
# - Primehack preconfiguration completely redone. "Stop emulation" hotkey set to Start+Select, Xbox and Nintendo keymap profiles were created, Xbox set as default.
# - Duckstation save and state locations were dir_prep'd to the rdhome/save and /state folders, which was not previously done. Much safer now!
# - Fix PICO-8 folder structure. ROM and save folders are now sane and binary files will go into ~/retrodeck/bios/pico-8/
rm -rf /var/config/primehack # Purge old Primehack config files. Saves are safe as they are linked into /var/data/primehack.
primehack_init
@ -195,10 +195,21 @@ post_update() {
dir_prep "$rdhome/states/duckstation" "/var/data/duckstation/savestates"
mv "$bios_folder/pico8" "$bios_folder/pico8_olddata" # Move legacy (and incorrect / non-functional ) PICO-8 location for future cleanup / less confusion
dir_prep "$bios_folder/pico-8" "~/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed
dir_prep "$bios_folder/pico-8" "$HOME/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed
dir_prep "$roms_folder/pico8" "$bios_folder/pico-8/carts" # Symlink default game location to RD roms for cleanliness (this location is overridden anyway by the --root_path launch argument anyway)
dir_prep "$bios_folder/pico-8/cdata" "$saves_folder/pico-8" # PICO-8 saves folder
fi
if [[ $prev_version -le "063" ]]; then
# In version 0.6.2b, the following changes were made that required config file updates/reset:
# - Put Dolphin and Primehack save states in different folders inside $rd_home/states
# - Fix symlink to hard-coded PICO-8 config folder (dir_prep doesn't like ~)
dir_prep "$rdhome/states/dolphin" "/var/data/dolphin-emu/StateSaves"
dir_prep "$rdhome/states/primehack" "/var/data/primehack/StateSaves"
rm -rf "$HOME/~/" # Remove old incorrect location from 0.6.2b
dir_prep "$bios_folder/pico-8" "$HOME/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed
fi
# The following commands are run every time.
@ -209,6 +220,6 @@ post_update() {
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Finishing Upgrade" \
--text="RetroDECK is finishing the upgrade process, please wait."
source $rd_conf # Load new config file variables
create_lock
}

View file

@ -41,24 +41,7 @@ https://retrodeck.net
exit
;;
--compress*)
read -p "RetroDECK will now attempt to compress your selected game. The original game will still exist and will need to be removed manually after the process completes. Press any key to continue..."
if [[ ! -z $2 ]]; then
if [[ -f $2 ]]; then
current_run_log_file="chd_compression_"$(date +"%Y_%m_%d_%I_%M_%p").log""
if [[ $(validate_for_chd $2) == "true" ]]; then
filename_no_path=$(basename $2)
filename_no_extension=${filename_no_path%.*}
compress_to_chd $(dirname $(realpath $2))/$(basename $2) $(dirname $(realpath $2))/$filename_no_extension
else
printf "An error occured during the compression process. Please see the following log entries for details:\n\n"
cat $logs_folder/$current_run_log_file
fi
else
echo "File not found, please specify the full path to the file to be compressed."
fi
else
echo "Please use this command format \"--compress <cue/gdi/iso file to compress>\""
fi
cli_compress_file "$2"
exit
;;
--configurator*)
@ -73,10 +56,10 @@ https://retrodeck.net
read -p "You are about to reset $emulator to default settings. Press 'y' to continue, 'n' to stop: " response
if [[ $response == [yY] ]]; then
cli_emulator_reset $emulator
read -p "The process has been completed, press any key to start RetroDECK."
read -p "The process has been completed, press Enter key to start RetroDECK."
shift # Continue launch after previous command is finished
else
read -p "The process has been cancelled, press any key to exit."
read -p "The process has been cancelled, press Enter key to exit."
exit
fi
else
@ -89,22 +72,22 @@ https://retrodeck.net
read -p "Press 'y' to continue, 'n' to stop: " response
if [[ $response == [yY] ]]; then
tools_init
read -p "The process has been completed, press any key to start RetroDECK."
read -p "The process has been completed, press Enter key to start RetroDECK."
shift # Continue launch after previous command is finished
else
read -p "The process has been cancelled, press any key to exit."
read -p "The process has been cancelled, press Enter key to exit."
exit
fi
;;
--reset-retrodeck*)
echo "You are about to reset RetroDECK completely."
echo "You are about to reset RetroDECK completely!"
read -p "Press 'y' to continue, 'n' to stop: " response
if [[ $response == [yY] ]]; then
rm -f "$lockfile"
read -p "The process has been completed, press any key to start the initial RetroDECK setup process."
read -p "The process has been completed, press Enter key to start the initial RetroDECK setup process."
shift # Continue launch after previous command is finished
else
read -p "The process has been cancelled, press any key to exit."
read -p "The process has been cancelled, press Enter key to exit."
exit
fi
;;
@ -135,6 +118,8 @@ else
finit # Executing First/Force init
fi
source $rd_conf # Load latest variable values
# Check if running in Desktop mode and warn if true, unless desktop_mode_warning=false in retrodeck.cfg
desktop_mode_warning

View file

@ -11,11 +11,12 @@ source /app/libexec/functions.sh
# Welcome
# - Move RetroDECK
# - Change RetroArch Options
# - Enable/Disable Rewind Setting
# - RetroArch Presets
# - Change Rewind Setting
# - Enable/Disable Rewind
# - RetroAchivement Login
# - Login prompt
# - Change Standalone Emulator Options (Behind one-time power user warning dialog)
# - Emulator Options (Behind one-time power user warning dialog)
# - Launch RetroArch
# - Launch Citra
# - Launch Dolphin
@ -27,10 +28,13 @@ source /app/libexec/functions.sh
# - Launch RPCS3
# - Launch XEMU
# - Launch Yuzu
# - Compress Games
# - Manual single-game selection
# - Troubleshooting Tools
# - Tools and Troubleshooting
# - Multi-file game check
# - Basic BIOS file check
# - Advanced BIOS file check
# - Compress Games
# - Manual single-game selection
# - Multi-file compression (CHD)
# - Reset
# - Reset Specific Emulator
# - Reset RetroArch
@ -218,9 +222,9 @@ configurator_power_user_warning_dialog() {
configurator_power_user_changes_dialog() {
emulator=$(zenity --list \
--title "RetroDECK Configurator Utility - Power User Options" --cancel-label="Back" \
--title "RetroDECK Configurator Utility - Emulator Options" --cancel-label="Back" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \
--text="Which emulator do you want to configure?" \
--text="Which emulator do you want to launch?" \
--hide-header \
--column=emulator \
"RetroArch" \
@ -306,7 +310,7 @@ configurator_retroarch_rewind_dialog() {
zenity --question \
--no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Configurator - Rewind" \
--text="Rewind is currently disabled, do you want to enable it?\n\nNOTE:\nThis may impact performance expecially on the latest systems."
--text="Rewind is currently disabled, do you want to enable it?\n\nNOTE:\nThis may impact performance on some more demanding systems."
if [ $? == 0 ]
then
@ -323,7 +327,7 @@ configurator_retroarch_options_dialog() {
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \
--column="Choice" --column="Action" \
"Change Rewind Setting" "Enable or disable the Rewind function in RetroArch." \
"Log in to RetroAchivements" "Log into the RetroAchievements service in RetroArch." )
"RetroAchievements Login" "Log into the RetroAchievements service in RetroArch." )
case $choice in
@ -331,7 +335,7 @@ configurator_retroarch_options_dialog() {
configurator_retroarch_rewind_dialog
;;
"Log in to RetroAchivements" )
"RetroAchievements Login" )
configurator_retroachivement_dialog
;;
@ -343,21 +347,42 @@ configurator_retroarch_options_dialog() {
}
configurator_compress_single_game_dialog() {
file_to_compress=$(file_browse "Game to compress")
if [[ ! -z $file_to_compress ]]; then
if [[ $(validate_for_chd $file_to_compress) == "true" ]]; then
local file=$(file_browse "Game to compress")
if [[ ! -z "$file" ]]; then
if [[ $(validate_for_chd "$file") == "true" ]]; then
local post_compression_cleanup=$(configurator_compression_cleanup_dialog)
local filename_no_path=$(basename "$file")
local filename_no_extension="${filename_no_path%.*}"
local source_file=$(dirname "$(realpath "$file")")"/"$(basename "$file")
local dest_file=$(dirname "$(realpath "$file")")"/""$filename_no_extension"
(
filename_no_path=$(basename $file_to_compress)
filename_no_extension=${filename_no_path%.*}
compress_to_chd $(dirname $(realpath $file_to_compress))/$(basename $file_to_compress) $(dirname $(realpath $file_to_compress))/$filename_no_extension
echo "# Compressing $filename_no_path, please wait..."
compress_to_chd "$source_file" "$dest_file"
if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested
if [[ "$file" == *".cue" ]]; then
local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file")
local file_path=$(dirname "$(realpath "$file")")
while IFS= read -r line
do
echo "# Removing file $line"
rm -f "$file_path/$line"
done < <(printf '%s\n' "$cue_bin_files")
echo "# Removing file $filename_no_path"
rm -f "$file"
else
echo "# Removing file $filename_no_path"
rm -f "$file"
fi
fi
) |
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Configurator Utility - Compression in Progress" \
--text="Compressing game $filename_no_path, please wait."
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Configurator Utility - Compression in Progress"
configurator_generic_dialog "The compression process is complete!"
configurator_compress_games_dialog
else
configurator_generic_dialog "File type not recognized. Supported file types are .cue, .gdi and .iso"
configurator_compress_single_game_dialog
configurator_compress_games_dialog
fi
else
configurator_generic_dialog "No file selected, returning to main menu"
@ -365,11 +390,149 @@ configurator_compress_single_game_dialog() {
fi
}
configurator_compress_games_dialog() {
# This is currently a placeholder for a dialog where you can compress a single game or multiple at once. Currently only the single game option is available, so is launched by default.
configurator_compress_multi_game_dialog() {
# This dialog will display any games it finds to be compressable, from the systems listed under each compression type in
local compression_format=$1
local compressable_game=""
local compressable_games_list=()
local all_compressable_games=()
local compressable_systems_list=$(sed -n '/\['"$compression_format"'\]/, /\[/{ /\['"$compression_format"'\]/! { /\[/! p } }' $compression_targets | sed '/^$/d')
configurator_generic_dialog "This utility will compress a single game into .CHD format.\n\nPlease select the game to be compressed in the next dialog: supported file types are .cue, .iso and .gdi\n\nThe original game files will be untouched and will need to be removed manually."
configurator_compress_single_game_dialog
while IFS= read -r system # Find and validate all games that are able to be compressed with this compression type
do
if [[ $compression_format == "chd" ]]; then
compression_candidates=$(find "$roms_folder/$system" -type f \( -name "*.cue" -o -name "*.iso" -o -name "*.gdi" \) ! -path "*.m3u*")
# TODO: Add ZIP file compression search here
fi
while IFS= read -r game
do
if [[ $(validate_for_chd "$game") == "true" ]]; then
all_compressable_games=("${all_compressable_games[@]}" "$game")
compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game")
fi
done < <(printf '%s\n' "$compression_candidates")
done < <(printf '%s\n' "$compressable_systems_list")
choice=$(zenity \
--list --width=1200 --height=720 \
--checklist --hide-column=3 --ok-label="Compress Selected" --extra-button="Compress All" \
--separator="," --print-column=3 \
--text="Choose which games to compress:" \
--column "Compress?" \
--column "Game" \
--column "Game Full Path" \
"${compressable_games_list[@]}")
local rc=$?
if [[ $rc == "0" && ! -z $choice ]]; then # User clicked "Compress Selected" with at least one game selected
local post_compression_cleanup=$(configurator_compression_cleanup_dialog)
IFS="," read -ra games_to_compress <<< "$choice"
(
for file in "${games_to_compress[@]}"; do
local filename_no_path=$(basename "$file")
local filename_no_extension="${filename_no_path%.*}"
local source_file=$(dirname "$(realpath "$file")")"/"$(basename "$file")
local dest_file=$(dirname "$(realpath "$file")")"/""$filename_no_extension"
echo "# Compressing $filename_no_path" # Update Zenity dialog text
compress_to_chd "$source_file" "$dest_file"
if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested
if [[ "$file" == *".cue" ]]; then
local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file")
local file_path=$(dirname "$(realpath "$file")")
while IFS= read -r line
do
echo "# Removing file $line"
rm -f "$file_path/$line"
done < <(printf '%s\n' "$cue_bin_files")
echo "# Removing file $filename_no_path"
rm -f $(realpath "$file")
else
echo "# Removing file $filename_no_path"
rm -f "$(realpath "$file")"
fi
fi
done
) |
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Configurator Utility - Compression in Progress"
else
if [[ ! -z $choice ]]; then # User clicked "Compress All"
local post_compression_cleanup=$(configurator_compression_cleanup_dialog)
(
for file in "${all_compressable_games[@]}"; do
local filename_no_path=$(basename "$file")
local filename_no_extension="${filename_no_path%.*}"
local source_file=$(dirname "$(realpath "$file")")"/"$(basename "$file")
local dest_file=$(dirname "$(realpath "$file")")"/""$filename_no_extension"
echo "# Compressing $filename_no_path" # Update Zenity dialog text
compress_to_chd "$source_file" "$dest_file"
if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested
if [[ "$file" == *".cue" ]]; then
local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file")
local file_path=$(dirname "$(realpath "$file")")
while IFS= read -r line
do
echo "# Removing file $line"
rm -f "$file_path/$line"
done < <(printf '%s\n' "$cue_bin_files")
echo "# Removing file $filename_no_path"
rm -f $(realpath "$file")
else
echo "# Removing file $filename_no_path"
rm -f $(realpath "$file")
fi
fi
done
) |
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Configurator Utility - Compression in Progress"
configurator_generic_dialog "The compression process is complete!"
configurator_compress_games_dialog
else
configurator_compress_games_dialog
fi
fi
}
configurator_compression_cleanup_dialog() {
zenity --icon-name=net.retrodeck.retrodeck --question --no-wrap --cancel-label="No" --ok-label="Yes" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Compression Cleanup" \
--text="Do you want to remove old files after they are compressed?\n\nClicking \"No\" will leave all files behind which will need to be cleaned up manually and may result in game duplicates showing in the RetroDECK library."
local rc=$? # Capture return code, as "Yes" button has no text value
if [[ $rc == "0" ]]; then # If user clicked "Yes"
echo "true"
else # If "No" was clicked
echo "false"
fi
}
configurator_compress_games_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" --width=1200 --height=720 \
--column="Choice" --column="Action" \
"Compress Single Game" "Compress a single game into a compatible format" \
"Compress Multiple Games - CHD" "Compress one or more games compatible with the CHD format" )
case $choice in
"Compress Single Game" )
configurator_compress_single_game_dialog
;;
"Compress Multiple Games - CHD" )
configurator_compress_multi_game_dialog "chd"
;;
# TODO: Add ZIP compression option
"" ) # No selection made or Back button clicked
configurator_welcome_dialog
;;
esac
}
configurator_check_multifile_game_structure() {
@ -450,7 +613,8 @@ configurator_troubleshooting_tools_dialog() {
--column="Choice" --column="Action" \
"Multi-file game structure check" "Verify the proper structure of multi-file or multi-disc games" \
"Basic BIOS file check" "Show a list of systems that BIOS files are found for" \
"Advanced BIOS file check" "Show advanced information about common BIOS files" )
"Advanced BIOS file check" "Show advanced information about common BIOS files" \
"Compress Games" "Compress games to CHD format for systems that support it" )
case $choice in
@ -466,6 +630,10 @@ configurator_troubleshooting_tools_dialog() {
configurator_check_bios_files_advanced
;;
"Compress Games" )
configurator_compress_games_dialog
;;
"" ) # No selection made or Back button clicked
configurator_welcome_dialog
;;
@ -628,43 +796,31 @@ configurator_move_dialog() {
}
configurator_welcome_dialog() {
# Clear the variables
source=
destination=
action=
setting=
setting_value=
choice=$(zenity --list --title="RetroDECK Configurator Utility" --cancel-label="Quit" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \
--column="Choice" --column="Action" \
"Move Files" "Move files between internal/SD card or to custom locations." \
"Change RetroArch Options" "Change RetroArch presets, log into RetroAchievements etc." \
"Change Standalone Emulator Options" "Run emulators standalone to make advanced config changes." \
"Compress Games" "Compress games to CHD format for systems that support it." \
"Troubleshooting Tools" "Run RetroDECK troubleshooting tools for common issues." \
"Reset" "Reset specific parts or all of RetroDECK." )
"Move RetroDECK" "Move RetroDECK files between internal/SD card or to a custom location" \
"RetroArch Presets" "Change RetroArch presets, log into RetroAchievements etc." \
"Emulator Options" "Launch and configure each emulators settings (for advanced users)" \
"Tools and Troubleshooting" "Run RetroDECK troubleshooting tools for common issues" \
"Reset" "Reset specific parts or all of RetroDECK" )
case $choice in
"Move Files" )
"Move RetroDECK" )
configurator_generic_dialog "This option will move the RetroDECK data folder (ROMs, saves, BIOS etc.) to a new location.\n\nPlease choose where to move the RetroDECK data folder."
configurator_move_dialog
;;
"Change RetroArch Options" )
"RetroArch Presets" )
configurator_retroarch_options_dialog
;;
"Change Standalone Emulator Options" )
"Emulator Options" )
configurator_power_user_warning_dialog
;;
"Compress Games" )
configurator_compress_games_dialog
;;
"Troubleshooting Tools" )
"Tools and Troubleshooting" )
configurator_troubleshooting_tools_dialog
;;