mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-25 15:35:38 +00:00
Merge pull request #797 from icenine451/cooker-0.8.2b-icenine451
Cooker 0.8.2b icenine451
This commit is contained in:
commit
5939c167d1
|
@ -26,6 +26,29 @@ compress_game() {
|
||||||
elif [[ "$1" == "rvz" ]]; then
|
elif [[ "$1" == "rvz" ]]; then
|
||||||
dolphin-tool convert -f rvz -b 131072 -c zstd -l 5 -i "$source_file" -o "$dest_file.rvz"
|
dolphin-tool convert -f rvz -b 131072 -c zstd -l 5 -i "$source_file" -o "$dest_file.rvz"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested
|
||||||
|
if [[ -f "${file%.*}.$compatible_compression_format" ]]; then
|
||||||
|
log i "Performing post-compression file cleanup"
|
||||||
|
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
|
||||||
|
log i "Removing file $file_path/$line"
|
||||||
|
rm -f "$file_path/$line"
|
||||||
|
done < <(printf '%s\n' "$cue_bin_files")
|
||||||
|
log i "Removing file $(realpath $file)"
|
||||||
|
rm -f $(realpath "$file")
|
||||||
|
else
|
||||||
|
log i "Removing file $(realpath $file)"
|
||||||
|
rm -f "$(realpath "$file")"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log i "Compressed file ${file%.*}.$compatible_compression_format not found, skipping original file deletion"
|
||||||
|
configurator_generic_dialog "RetroDECK Configurator - RetroDECK: Compression Tool" "A compressed version of the file was not found, skipping deletion."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
find_compatible_compression_format() {
|
find_compatible_compression_format() {
|
||||||
|
@ -96,6 +119,71 @@ validate_for_chd() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
find_compatible_games() {
|
||||||
|
# The function takes the following arguments, which alter what files are compressed:
|
||||||
|
# "everything" - Compresses all games found into their compatible formats
|
||||||
|
# "all" - Compresses a list of user-chosen files into their compatible formats
|
||||||
|
# "chd" or "zip" or "rvz" - Compresses a list of user-chosen files into the given format
|
||||||
|
|
||||||
|
if [[ -f "$godot_compression_compatible_games" ]]; then
|
||||||
|
rm -f "$godot_compression_compatible_games" # Godot data transfer temp files
|
||||||
|
fi
|
||||||
|
touch "$godot_compression_compatible_games"
|
||||||
|
|
||||||
|
local compressable_games_list=()
|
||||||
|
local all_compressable_games=()
|
||||||
|
local games_to_compress=()
|
||||||
|
local target_selection="$1"
|
||||||
|
|
||||||
|
if [[ "$1" == "everything" ]]; then
|
||||||
|
local compression_format="all"
|
||||||
|
else
|
||||||
|
local compression_format="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $compression_format == "all" ]]; then
|
||||||
|
local compressable_systems_list=$(cat $compression_targets | sed '/^$/d' | sed '/^\[/d')
|
||||||
|
else
|
||||||
|
local compressable_systems_list=$(sed -n '/\['"$compression_format"'\]/, /\[/{ /\['"$compression_format"'\]/! { /\[/! p } }' $compression_targets | sed '/^$/d')
|
||||||
|
fi
|
||||||
|
|
||||||
|
while IFS= read -r system # Find and validate all games that are able to be compressed with this compression type
|
||||||
|
do
|
||||||
|
compression_candidates=$(find "$roms_folder/$system" -type f -not -iname "*.txt")
|
||||||
|
if [[ ! -z $compression_candidates ]]; then
|
||||||
|
while IFS= read -r game
|
||||||
|
do
|
||||||
|
local compatible_compression_format=$(find_compatible_compression_format "$game")
|
||||||
|
if [[ $compression_format == "chd" ]]; then
|
||||||
|
if [[ $compatible_compression_format == "chd" ]]; then
|
||||||
|
all_compressable_games=("${all_compressable_games[@]}" "$game")
|
||||||
|
compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game")
|
||||||
|
echo "${game}"^"$compatible_compression_format" >> "$godot_compression_compatible_games"
|
||||||
|
fi
|
||||||
|
elif [[ $compression_format == "zip" ]]; then
|
||||||
|
if [[ $compatible_compression_format == "zip" ]]; then
|
||||||
|
all_compressable_games=("${all_compressable_games[@]}" "$game")
|
||||||
|
compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game")
|
||||||
|
echo "${game}"^"$compatible_compression_format" >> "$godot_compression_compatible_games"
|
||||||
|
fi
|
||||||
|
elif [[ $compression_format == "rvz" ]]; then
|
||||||
|
if [[ $compatible_compression_format == "rvz" ]]; then
|
||||||
|
all_compressable_games=("${all_compressable_games[@]}" "$game")
|
||||||
|
compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game")
|
||||||
|
echo "${game}"^"$compatible_compression_format" >> "$godot_compression_compatible_games"
|
||||||
|
fi
|
||||||
|
elif [[ $compression_format == "all" ]]; then
|
||||||
|
if [[ ! $compatible_compression_format == "none" ]]; then
|
||||||
|
all_compressable_games=("${all_compressable_games[@]}" "$game")
|
||||||
|
compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game")
|
||||||
|
echo "${game}"^"$compatible_compression_format" >> "$godot_compression_compatible_games"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < <(printf '%s\n' "$compression_candidates")
|
||||||
|
fi
|
||||||
|
done < <(printf '%s\n' "$compressable_systems_list")
|
||||||
|
}
|
||||||
|
|
||||||
cli_compress_single_game() {
|
cli_compress_single_game() {
|
||||||
# This function will compress a single file passed from the CLI arguments
|
# This function will compress a single file passed from the CLI arguments
|
||||||
# USAGE: cli_compress_single_game $full_file_path
|
# USAGE: cli_compress_single_game $full_file_path
|
||||||
|
@ -109,26 +197,6 @@ cli_compress_single_game() {
|
||||||
if [[ ! $compatible_compression_format == "none" ]]; then
|
if [[ ! $compatible_compression_format == "none" ]]; then
|
||||||
log i "$(basename "$file") can be compressed to $compatible_compression_format"
|
log i "$(basename "$file") can be compressed to $compatible_compression_format"
|
||||||
compress_game "$compatible_compression_format" "$file" "$system"
|
compress_game "$compatible_compression_format" "$file" "$system"
|
||||||
if [[ $post_compression_cleanup == [yY] ]]; then # Remove file(s) if requested
|
|
||||||
if [[ -f "${file%.*}.$compatible_compression_format" ]]; then
|
|
||||||
if [[ $(basename "$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
|
|
||||||
log i "Removing original file "$file_path/$line""
|
|
||||||
rm -f "$file_path/$line"
|
|
||||||
done < <(printf '%s\n' "$cue_bin_files") # Remove original .cue file
|
|
||||||
log i "Removing original file $(basename "$file")"
|
|
||||||
rm -f "$file"
|
|
||||||
else
|
|
||||||
log i "Removing original file $(basename "$file")"
|
|
||||||
rm -f "$file"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
log w "Compressed version of $(basename "$file") not found, skipping deletion."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
log w "$(basename "$file") does not have any compatible compression formats."
|
log w "$(basename "$file") does not have any compatible compression formats."
|
||||||
fi
|
fi
|
||||||
|
@ -171,26 +239,6 @@ cli_compress_all_games() {
|
||||||
if [[ ! "$compatible_compression_format" == "none" ]]; then
|
if [[ ! "$compatible_compression_format" == "none" ]]; then
|
||||||
log i "$(basename "$file") can be compressed to $compatible_compression_format"
|
log i "$(basename "$file") can be compressed to $compatible_compression_format"
|
||||||
compress_game "$compatible_compression_format" "$file" "$system"
|
compress_game "$compatible_compression_format" "$file" "$system"
|
||||||
if [[ $post_compression_cleanup == [yY] ]]; then # Remove file(s) if requested
|
|
||||||
if [[ -f "${file%.*}.$compatible_compression_format" ]]; then
|
|
||||||
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
|
|
||||||
log i "Removing original file "$file_path/$line""
|
|
||||||
rm -f "$file_path/$line"
|
|
||||||
done < <(printf '%s\n' "$cue_bin_files") # Remove original .cue file
|
|
||||||
log i "Removing original file "$file""
|
|
||||||
rm -f $(realpath "$file")
|
|
||||||
else
|
|
||||||
log i "Removing original file "$file""
|
|
||||||
rm -f $(realpath "$file")
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
log w "Compressed version of $(basename "$file") not found, skipping deletion."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
log w "No compatible compression format found for $(basename "$file")"
|
log w "No compatible compression format found for $(basename "$file")"
|
||||||
fi
|
fi
|
||||||
|
|
33
functions/configurator_functions.sh
Normal file
33
functions/configurator_functions.sh
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
check_bios_files() {
|
||||||
|
# This function validates all the BIOS files listed in the $bios_checklist and adds the results to an array called $bios_checked_list which can be used elsewhere
|
||||||
|
# There is a "basic" and "expert" mode which outputs different levels of data
|
||||||
|
# USAGE: check_bios_files "mode"
|
||||||
|
|
||||||
|
if [[ -f "$godot_bios_files_checked" ]]; then
|
||||||
|
rm -f "$godot_bios_files_checked" # Godot data transfer temp files
|
||||||
|
fi
|
||||||
|
touch "$godot_bios_files_checked"
|
||||||
|
|
||||||
|
while IFS="^" read -r bios_file bios_subdir bios_hash bios_system bios_desc
|
||||||
|
do
|
||||||
|
bios_file_found="No"
|
||||||
|
bios_hash_matched="No"
|
||||||
|
if [[ -f "$bios_folder/$bios_subdir$bios_file" ]]; then
|
||||||
|
bios_file_found="Yes"
|
||||||
|
if [[ $bios_hash == "Unknown" ]]; then
|
||||||
|
bios_hash_matched="Unknown"
|
||||||
|
elif [[ $(md5sum "$bios_folder/$bios_subdir$bios_file" | awk '{ print $1 }') == "$bios_hash" ]]; then
|
||||||
|
bios_hash_matched="Yes"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ "$1" == "basic" ]]; then
|
||||||
|
bios_checked_list=("${bios_checked_list[@]}" "$bios_file" "$bios_system" "$bios_file_found" "$bios_hash_matched" "$bios_desc")
|
||||||
|
echo "$bios_file"^"$bios_system"^"$bios_file_found"^"$bios_hash_matched"^"$bios_desc" >> "$godot_bios_files_checked" # Godot data transfer temp file
|
||||||
|
else
|
||||||
|
bios_checked_list=("${bios_checked_list[@]}" "$bios_file" "$bios_system" "$bios_file_found" "$bios_hash_matched" "$bios_desc" "$bios_subdir" "$bios_hash")
|
||||||
|
echo "$bios_file"^"$bios_system"^"$bios_file_found"^"$bios_hash_matched"^"$bios_desc"^"$bios_subdir"^"$bios_hash" >> "$godot_bios_files_checked" # Godot data transfer temp file
|
||||||
|
fi
|
||||||
|
done < $bios_checklist
|
||||||
|
}
|
|
@ -7,12 +7,13 @@ source /app/libexec/checks.sh
|
||||||
source /app/libexec/compression.sh
|
source /app/libexec/compression.sh
|
||||||
source /app/libexec/dialogs.sh
|
source /app/libexec/dialogs.sh
|
||||||
source /app/libexec/logger.sh
|
source /app/libexec/logger.sh
|
||||||
source /app/libexec/functions.sh
|
source /app/libexec/other_functions.sh
|
||||||
source /app/libexec/multi_user.sh
|
source /app/libexec/multi_user.sh
|
||||||
source /app/libexec/framework.sh
|
source /app/libexec/framework.sh
|
||||||
source /app/libexec/post_update.sh
|
source /app/libexec/post_update.sh
|
||||||
source /app/libexec/prepare_component.sh
|
source /app/libexec/prepare_component.sh
|
||||||
source /app/libexec/presets.sh
|
source /app/libexec/presets.sh
|
||||||
|
source /app/libexec/configurator_fuctions.sh
|
||||||
|
|
||||||
# Static variables
|
# Static variables
|
||||||
rd_conf="/var/config/retrodeck/retrodeck.cfg" # RetroDECK config file path
|
rd_conf="/var/config/retrodeck/retrodeck.cfg" # RetroDECK config file path
|
||||||
|
@ -52,6 +53,8 @@ pretty_system_names_reference_list="$emuconfigs/defaults/retrodeck/reference_lis
|
||||||
# Godot data transfer temp files
|
# Godot data transfer temp files
|
||||||
|
|
||||||
godot_bios_files_checked="/var/config/retrodeck/godot/godot_bios_files_checked.tmp"
|
godot_bios_files_checked="/var/config/retrodeck/godot/godot_bios_files_checked.tmp"
|
||||||
|
godot_current_preset_settings="/var/config/retrodeck/godot/godot_current_preset_settings.tmp"
|
||||||
|
godot_compression_compatible_games="/var/config/retrodeck/godot/godot_compression_compatible_games.tmp"
|
||||||
|
|
||||||
# Config files for emulators with single config files
|
# Config files for emulators with single config files
|
||||||
|
|
||||||
|
@ -131,6 +134,11 @@ if [[ ! -d "$rd_logs_folder/ES-DE" ]]; then
|
||||||
dir_prep "$rd_logs_folder/ES-DE" "$es_source_logs"
|
dir_prep "$rd_logs_folder/ES-DE" "$es_source_logs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Initialize location of Godot temp data files, if it doesn't exist
|
||||||
|
if [[ ! -d "/var/config/retrodeck/godot" ]]; then
|
||||||
|
create_dir "/var/config/retrodeck/godot"
|
||||||
|
fi
|
||||||
|
|
||||||
# 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" ]]; then
|
if [[ -f "$HOME/retrodeck/.lock" ]]; then
|
||||||
mv "$HOME/retrodeck/.lock" $lockfile
|
mv "$HOME/retrodeck/.lock" $lockfile
|
||||||
|
|
|
@ -286,36 +286,6 @@ dir_prep() {
|
||||||
log i "$symlink is now $real"
|
log i "$symlink is now $real"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_bios_files() {
|
|
||||||
# This function validates all the BIOS files listed in the $bios_checklist and adds the results to an array called bios_checked_list which can be used elsewhere
|
|
||||||
# There is a "basic" and "expert" mode which outputs different levels of data
|
|
||||||
# USAGE: check_bios_files "mode"
|
|
||||||
|
|
||||||
rm -f "$godot_bios_files_checked" # Godot data transfer temp files
|
|
||||||
touch "$godot_bios_files_checked"
|
|
||||||
|
|
||||||
while IFS="^" read -r bios_file bios_subdir bios_hash bios_system bios_desc
|
|
||||||
do
|
|
||||||
bios_file_found="No"
|
|
||||||
bios_hash_matched="No"
|
|
||||||
if [[ -f "$bios_folder/$bios_subdir$bios_file" ]]; then
|
|
||||||
bios_file_found="Yes"
|
|
||||||
if [[ $bios_hash == "Unknown" ]]; then
|
|
||||||
bios_hash_matched="Unknown"
|
|
||||||
elif [[ $(md5sum "$bios_folder/$bios_subdir$bios_file" | awk '{ print $1 }') == "$bios_hash" ]]; then
|
|
||||||
bios_hash_matched="Yes"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [[ "$1" == "basic" ]]; then
|
|
||||||
bios_checked_list=("${bios_checked_list[@]}" "$bios_file" "$bios_system" "$bios_file_found" "$bios_hash_matched" "$bios_desc")
|
|
||||||
echo "$bios_file"^"$bios_system"^"$bios_file_found"^"$bios_hash_matched"^"$bios_desc" >> "$godot_bios_files_checked" # Godot data transfer temp file
|
|
||||||
else
|
|
||||||
bios_checked_list=("${bios_checked_list[@]}" "$bios_file" "$bios_system" "$bios_file_found" "$bios_hash_matched" "$bios_desc" "$bios_subdir" "$bios_hash")
|
|
||||||
echo "$bios_file"^"$bios_system"^"$bios_file_found"^"$bios_hash_matched"^"$bios_desc"^"$bios_subdir"^"$bios_hash" >> "$godot_bios_files_checked" # Godot data transfer temp file
|
|
||||||
fi
|
|
||||||
done < $bios_checklist
|
|
||||||
}
|
|
||||||
|
|
||||||
update_rpcs3_firmware() {
|
update_rpcs3_firmware() {
|
||||||
create_dir "$roms_folder/ps3/tmp"
|
create_dir "$roms_folder/ps3/tmp"
|
||||||
chmod 777 "$roms_folder/ps3/tmp"
|
chmod 777 "$roms_folder/ps3/tmp"
|
||||||
|
@ -699,7 +669,7 @@ ponzu() {
|
||||||
rm -rf "$rdhome/ponzu"
|
rm -rf "$rdhome/ponzu"
|
||||||
}
|
}
|
||||||
|
|
||||||
ponzu_remove(){
|
ponzu_remove() {
|
||||||
|
|
||||||
# Call me with yuzu or citra and I will remove them
|
# Call me with yuzu or citra and I will remove them
|
||||||
|
|
|
@ -4,6 +4,43 @@ change_preset_dialog() {
|
||||||
# This function will build a list of all systems compatible with a given preset, their current enable/disabled state and allow the user to change one or more
|
# This function will build a list of all systems compatible with a given preset, their current enable/disabled state and allow the user to change one or more
|
||||||
# USAGE: change_preset_dialog "$preset"
|
# USAGE: change_preset_dialog "$preset"
|
||||||
|
|
||||||
|
build_preset_list_options "$1"
|
||||||
|
|
||||||
|
choice=$(zenity \
|
||||||
|
--list --width=1200 --height=720 \
|
||||||
|
--checklist \
|
||||||
|
--separator="," \
|
||||||
|
--hide-column=3 --print-column=3 \
|
||||||
|
--text="Enable $pretty_preset_name:" \
|
||||||
|
--column "Enabled" \
|
||||||
|
--column "Emulator" \
|
||||||
|
--column "internal_system_name" \
|
||||||
|
"${current_preset_settings[@]}")
|
||||||
|
|
||||||
|
local rc=$?
|
||||||
|
|
||||||
|
if [[ ! -z $choice || "$rc" == 0 ]]; then
|
||||||
|
(
|
||||||
|
make_preset_changes
|
||||||
|
) |
|
||||||
|
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 - Presets Configuration" \
|
||||||
|
--text="Setting up your presets, please wait..."
|
||||||
|
else
|
||||||
|
echo "No choices made"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
build_preset_list_options() {
|
||||||
|
# This function will build a list of all the systems available for a given preset
|
||||||
|
# The list will be generated into a Godot temp file and the variable $current_preset_settings
|
||||||
|
|
||||||
|
if [[ -f "$godot_current_preset_settings" ]]; then
|
||||||
|
rm -f "$godot_current_preset_settings" # Godot data transfer temp files
|
||||||
|
fi
|
||||||
|
touch "$godot_current_preset_settings"
|
||||||
|
|
||||||
local preset="$1"
|
local preset="$1"
|
||||||
pretty_preset_name=${preset//_/ } # Preset name prettification
|
pretty_preset_name=${preset//_/ } # Preset name prettification
|
||||||
pretty_preset_name=$(echo $pretty_preset_name | awk '{for(i=1;i<=NF;i++){$i=toupper(substr($i,1,1))substr($i,2)}}1') # Preset name prettification
|
pretty_preset_name=$(echo $pretty_preset_name | awk '{for(i=1;i<=NF;i++){$i=toupper(substr($i,1,1))substr($i,2)}}1') # Preset name prettification
|
||||||
|
@ -25,23 +62,14 @@ change_preset_dialog() {
|
||||||
current_disabled_systems=("${current_disabled_systems[@]}" "$system_name")
|
current_disabled_systems=("${current_disabled_systems[@]}" "$system_name")
|
||||||
fi
|
fi
|
||||||
current_preset_settings=("${current_preset_settings[@]}" "$system_value" "$(make_name_pretty $system_name)" "$system_name")
|
current_preset_settings=("${current_preset_settings[@]}" "$system_value" "$(make_name_pretty $system_name)" "$system_name")
|
||||||
|
echo "$system_value"^"$(make_name_pretty $system_name)"^"$system_name" >> "$godot_current_preset_settings"
|
||||||
done < <(printf '%s\n' "$section_results")
|
done < <(printf '%s\n' "$section_results")
|
||||||
|
}
|
||||||
|
|
||||||
choice=$(zenity \
|
|
||||||
--list --width=1200 --height=720 \
|
|
||||||
--checklist \
|
|
||||||
--separator="," \
|
|
||||||
--hide-column=3 --print-column=3 \
|
|
||||||
--text="Enable $pretty_preset_name:" \
|
|
||||||
--column "Enabled" \
|
|
||||||
--column "Emulator" \
|
|
||||||
--column "internal_system_name" \
|
|
||||||
"${current_preset_settings[@]}")
|
|
||||||
|
|
||||||
local rc=$?
|
make_preset_changes() {
|
||||||
|
# This function will take an array $choices, which contains the names of systems that have been enabled for this preset and enable them in the backend
|
||||||
|
|
||||||
if [[ ! -z $choice || "$rc" == 0 ]]; then
|
|
||||||
(
|
|
||||||
IFS="," read -ra choices <<< "$choice"
|
IFS="," read -ra choices <<< "$choice"
|
||||||
for emulator in "${all_systems[@]}"; do
|
for emulator in "${all_systems[@]}"; do
|
||||||
if [[ " ${choices[*]} " =~ " ${emulator} " && ! " ${current_enabled_systems[*]} " =~ " ${emulator} " ]]; then
|
if [[ " ${choices[*]} " =~ " ${emulator} " && ! " ${current_enabled_systems[*]} " =~ " ${emulator} " ]]; then
|
||||||
|
@ -71,14 +99,6 @@ change_preset_dialog() {
|
||||||
for emulator in "${changed_systems[@]}"; do
|
for emulator in "${changed_systems[@]}"; do
|
||||||
build_preset_config $emulator ${changed_presets[*]}
|
build_preset_config $emulator ${changed_presets[*]}
|
||||||
done
|
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 - Presets Configuration" \
|
|
||||||
--text="Setting up your presets, please wait..."
|
|
||||||
else
|
|
||||||
echo "No choices made"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build_preset_config() {
|
build_preset_config() {
|
||||||
|
|
|
@ -794,28 +794,6 @@ configurator_compress_single_game_dialog() {
|
||||||
echo "# Compressing $(basename "$file") to $compatible_compression_format format" # This updates the Zenity dialog
|
echo "# Compressing $(basename "$file") to $compatible_compression_format format" # This updates the Zenity dialog
|
||||||
log i "Compressing $(basename "$file") to $compatible_compression_format format"
|
log i "Compressing $(basename "$file") to $compatible_compression_format format"
|
||||||
compress_game "$compatible_compression_format" "$file" "$system"
|
compress_game "$compatible_compression_format" "$file" "$system"
|
||||||
if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested
|
|
||||||
if [[ -f "${file%.*}.$compatible_compression_format" ]]; then
|
|
||||||
log i "Performing post-compression file cleanup"
|
|
||||||
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
|
|
||||||
log i "Removing file $file_path/$line"
|
|
||||||
rm -f "$file_path/$line"
|
|
||||||
done < <(printf '%s\n' "$cue_bin_files")
|
|
||||||
log i "Removing file $(realpath $file)"
|
|
||||||
rm -f $(realpath "$file")
|
|
||||||
else
|
|
||||||
log i "Removing file $(realpath $file)"
|
|
||||||
rm -f "$(realpath "$file")"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
log i "Compressed file ${file%.*}.$compatible_compression_format not found, skipping original file deletion"
|
|
||||||
configurator_generic_dialog "RetroDECK Configurator - RetroDECK: Compression Tool" "A compressed version of the file was not found, skipping deletion."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
) |
|
) |
|
||||||
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
|
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
|
||||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||||
|
@ -835,54 +813,7 @@ configurator_compress_single_game_dialog() {
|
||||||
configurator_compress_multiple_games_dialog() {
|
configurator_compress_multiple_games_dialog() {
|
||||||
# This dialog will display any games it finds to be compressable, from the systems listed under each compression type in compression_targets.cfg
|
# This dialog will display any games it finds to be compressable, from the systems listed under each compression type in compression_targets.cfg
|
||||||
|
|
||||||
local compressable_games_list=()
|
find_compatible_games "$1"
|
||||||
local all_compressable_games=()
|
|
||||||
local games_to_compress=()
|
|
||||||
local target_selection="$1"
|
|
||||||
|
|
||||||
if [[ "$1" == "everything" ]]; then
|
|
||||||
local compression_format="all"
|
|
||||||
else
|
|
||||||
local compression_format="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $compression_format == "all" ]]; then
|
|
||||||
local compressable_systems_list=$(cat $compression_targets | sed '/^$/d' | sed '/^\[/d')
|
|
||||||
else
|
|
||||||
local compressable_systems_list=$(sed -n '/\['"$compression_format"'\]/, /\[/{ /\['"$compression_format"'\]/! { /\[/! p } }' $compression_targets | sed '/^$/d')
|
|
||||||
fi
|
|
||||||
|
|
||||||
while IFS= read -r system # Find and validate all games that are able to be compressed with this compression type
|
|
||||||
do
|
|
||||||
compression_candidates=$(find "$roms_folder/$system" -type f -not -iname "*.txt")
|
|
||||||
if [[ ! -z $compression_candidates ]]; then
|
|
||||||
while IFS= read -r game
|
|
||||||
do
|
|
||||||
local compatible_compression_format=$(find_compatible_compression_format "$game")
|
|
||||||
if [[ $compression_format == "chd" ]]; then
|
|
||||||
if [[ $compatible_compression_format == "chd" ]]; then
|
|
||||||
all_compressable_games=("${all_compressable_games[@]}" "$game")
|
|
||||||
compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game")
|
|
||||||
fi
|
|
||||||
elif [[ $compression_format == "zip" ]]; then
|
|
||||||
if [[ $compatible_compression_format == "zip" ]]; then
|
|
||||||
all_compressable_games=("${all_compressable_games[@]}" "$game")
|
|
||||||
compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game")
|
|
||||||
fi
|
|
||||||
elif [[ $compression_format == "rvz" ]]; then
|
|
||||||
if [[ $compatible_compression_format == "rvz" ]]; then
|
|
||||||
all_compressable_games=("${all_compressable_games[@]}" "$game")
|
|
||||||
compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game")
|
|
||||||
fi
|
|
||||||
elif [[ $compression_format == "all" ]]; then
|
|
||||||
if [[ ! $compatible_compression_format == "none" ]]; then
|
|
||||||
all_compressable_games=("${all_compressable_games[@]}" "$game")
|
|
||||||
compressable_games_list=("${compressable_games_list[@]}" "false" "${game#$roms_folder}" "$game")
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done < <(printf '%s\n' "$compression_candidates")
|
|
||||||
fi
|
|
||||||
done < <(printf '%s\n' "$compressable_systems_list")
|
|
||||||
|
|
||||||
if [[ ! "$target_selection" == "everything" ]]; then # If the user chose to not auto-compress everything
|
if [[ ! "$target_selection" == "everything" ]]; then # If the user chose to not auto-compress everything
|
||||||
choice=$(zenity \
|
choice=$(zenity \
|
||||||
|
@ -922,27 +853,6 @@ configurator_compress_multiple_games_dialog() {
|
||||||
games_left_to_compress=$((games_left_to_compress-1))
|
games_left_to_compress=$((games_left_to_compress-1))
|
||||||
log i "Games left to compress: $games_left_to_compress"
|
log i "Games left to compress: $games_left_to_compress"
|
||||||
compress_game "$compression_format" "$file" "$system"
|
compress_game "$compression_format" "$file" "$system"
|
||||||
if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested
|
|
||||||
if [[ -f "${file%.*}.$compatible_compression_format" ]]; then
|
|
||||||
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
|
|
||||||
log i "Removing file $file_path/$line"
|
|
||||||
rm -f "$file_path/$line"
|
|
||||||
done < <(printf '%s\n' "$cue_bin_files")
|
|
||||||
log i "Removing file $(realpath $file)"
|
|
||||||
rm -f $(realpath "$file")
|
|
||||||
else
|
|
||||||
log i "Removing file $(realpath $file)"
|
|
||||||
rm -f "$(realpath "$file")"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
log i "Compressed file ${file%.*}.$compatible_compression_format not found, skipping original file deletion"
|
|
||||||
configurator_generic_dialog "RetroDECK Configurator - RetroDECK: Compression Tool" "Compression of $(basename $file) failed, skipping deletion."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
) |
|
) |
|
||||||
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --auto-close \
|
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --auto-close \
|
||||||
|
|
Loading…
Reference in a new issue