Merge branch 'cooker-0.8.0b' into feat/ryujinx [skip ci]

This commit is contained in:
XargonWan 2024-02-26 14:54:27 +01:00
commit a9c912a513
12 changed files with 142 additions and 77 deletions

View file

@ -1,2 +1,3 @@
false^RPCS3 Firmware Install^Install firmware needed for PS3 emulation^rpcs3_firmware false^RPCS3 Firmware Install^Install firmware needed for PS3 emulation^rpcs3_firmware
false^Vita3K Firmware Install^Install firmware needed for Vita3K emulation^vita3k_firmware
false^RetroDECK Controller Profile^Install custom RetroDECK controller profile^rd_controller_profile false^RetroDECK Controller Profile^Install custom RetroDECK controller profile^rd_controller_profile

View file

@ -0,0 +1,3 @@
#!/bin/bash
mame -inipath /var/config/mame

View file

@ -463,7 +463,7 @@
<emulator name="MAME"> <emulator name="MAME">
<!-- Arcade emulator MAME --> <!-- Arcade emulator MAME -->
<rule type="systempath"> <rule type="systempath">
<entry>mame</entry> <entry>mame-rdwrapper.sh</entry>
<entry>org.mamedev.MAME</entry> <entry>org.mamedev.MAME</entry>
</rule> </rule>
<rule type="staticpath"> <rule type="staticpath">

View file

@ -2,7 +2,7 @@
compress_game() { compress_game() {
# Function for compressing one or more files to .chd format # Function for compressing one or more files to .chd format
# USAGE: compress_game $format $full_path_to_input_file # USAGE: compress_game $format $full_path_to_input_file $system(optional)
local file="$2" local file="$2"
local filename_no_path=$(basename "$file") local filename_no_path=$(basename "$file")
local filename_no_extension="${filename_no_path%.*}" local filename_no_extension="${filename_no_path%.*}"
@ -10,7 +10,11 @@ compress_game() {
local dest_file=$(dirname "$(realpath "$file")")"/""$filename_no_extension" local dest_file=$(dirname "$(realpath "$file")")"/""$filename_no_extension"
if [[ "$1" == "chd" ]]; then if [[ "$1" == "chd" ]]; then
if [[ "$3" == "psp" ]]; then
echo "Put createdvd or maxcso here" # TODO
else
/app/bin/chdman createcd -i "$source_file" -o "$dest_file".chd /app/bin/chdman createcd -i "$source_file" -o "$dest_file".chd
fi
elif [[ "$1" == "zip" ]]; then elif [[ "$1" == "zip" ]]; then
zip -jq9 "$dest_file".zip "$source_file" zip -jq9 "$dest_file".zip "$source_file"
elif [[ "$1" == "rvz" ]]; then elif [[ "$1" == "rvz" ]]; then
@ -93,11 +97,11 @@ cli_compress_single_game() {
read -p "RetroDECK will now attempt to compress your selected game. Press Enter key to continue..." read -p "RetroDECK will now attempt to compress your selected game. Press Enter key to continue..."
if [[ ! -z "$file" ]]; then if [[ ! -z "$file" ]]; then
if [[ -f "$file" ]]; then if [[ -f "$file" ]]; then
check_system=$(echo "$file" | grep -oE "$roms_folder/[^/]+" | grep -oE "[^/]+$") local system=$(echo "$file" | grep -oE "$roms_folder/[^/]+" | grep -oE "[^/]+$")
local compatible_compression_format=$(find_compatible_compression_format "$file") local compatible_compression_format=$(find_compatible_compression_format "$file")
if [[ ! $compatible_compression_format == "none" ]]; then if [[ ! $compatible_compression_format == "none" ]]; then
echo "$(basename "$file") can be compressed to $compatible_compression_format" echo "$(basename "$file") can be compressed to $compatible_compression_format"
compress_game "$compatible_compression_format" "$file" compress_game "$compatible_compression_format" "$file" "$system"
if [[ $post_compression_cleanup == [yY] ]]; then # Remove file(s) if requested if [[ $post_compression_cleanup == [yY] ]]; then # Remove file(s) if requested
if [[ $(basename "$file") == *".cue" ]]; then if [[ $(basename "$file") == *".cue" ]]; then
local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file")
@ -155,7 +159,7 @@ cli_compress_all_games() {
local compatible_compression_format=$(find_compatible_compression_format "$file") local compatible_compression_format=$(find_compatible_compression_format "$file")
if [[ ! "$compatible_compression_format" == "none" ]]; then if [[ ! "$compatible_compression_format" == "none" ]]; then
echo "$(basename "$file") can be compressed to $compatible_compression_format" echo "$(basename "$file") can be compressed to $compatible_compression_format"
compress_game "$compatible_compression_format" "$file" compress_game "$compatible_compression_format" "$file" "$system"
if [[ $post_compression_cleanup == [yY] ]]; then # Remove file(s) if requested if [[ $post_compression_cleanup == [yY] ]]; then # Remove file(s) if requested
if [[ "$file" == *".cue" ]]; then if [[ "$file" == *".cue" ]]; then
local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file")

View file

@ -107,34 +107,14 @@ download_file() {
# file_dest is the destination the file should be in the filesystem, needs filename included! # file_dest is the destination the file should be in the filesystem, needs filename included!
# file_name is a user-readable file name or description to be put in the Zenity dialog # file_name is a user-readable file name or description to be put in the Zenity dialog
# Run wget in the background and redirect the progress to a temporary file
( (
wget "$1" -O "$2" -q --show-progress --progress=dot 2>&1 | sed -n -e 's/^.* \([0-9]*\)%.*$/\1/p' > "/var/cache/tmp/download_progress" & wget "$1" -O "$2" -q
wget_pid=$!
progress="0"
echo "$progress" # Initial progress value. sent to Zenity
while true; do
progress=$(tail -n 2 "/var/cache/tmp/download_progress" | head -1) # Read the second-to-last value written to the pipe, to avoid reading data that is half written
echo "$progress" # Send value to Zenity
if [[ "$(tail -n 1 "/var/cache/tmp/download_progress")" == "100" ]]; then # Read last line every time to check for download completion
echo "100"
break
fi
sleep 0.5
done
# Wait for wget process to finish
wait "$wget_pid"
) | ) |
zenity --progress \ zenity --progress \
--title="Downloading File" \ --title="Downloading File" \
--text="Downloading $3..." \ --text="Downloading $3..." \
--percentage=0 \ --pulsate \
--auto-close --auto-close
# Cleanup temp file
rm -f "/var/cache/tmp/download_progress"
} }
update_rd_conf() { update_rd_conf() {
@ -314,6 +294,13 @@ update_rpcs3_firmware() {
rm -rf "$roms_folder/ps3/tmp" rm -rf "$roms_folder/ps3/tmp"
} }
update_vita3k_firmware() {
download_file "http://dus01.psv.update.playstation.net/update/psv/image/2022_0209/rel_f2c7b12fe85496ec88a0391b514d6e3b/PSVUPDAT.PUP" "/tmp/PSVUPDAT.PUP" "Vita3K Firmware file: PSVUPDAT.PUP"
download_file "http://dus01.psp2.update.playstation.net/update/psp2/image/2019_0924/sd_8b5f60b56c3da8365b973dba570c53a5/PSP2UPDAT.PUP?dest=us" "/tmp/PSP2UPDAT.PUP" "Vita3K Firmware file: PSP2UPDAT.PUP"
Vita3K --firmware /tmp/PSVUPDAT.PUP
Vita3K --firmware /tmp/PSP2UPDAT.PUP
}
backup_retrodeck_userdata() { backup_retrodeck_userdata() {
mkdir -p "$backups_folder" mkdir -p "$backups_folder"
zip -rq9 "$backups_folder/$(date +"%0m%0d")_retrodeck_userdata.zip" "$saves_folder" "$states_folder" "$bios_folder" "$media_folder" "$themes_folder" "$logs_folder" "$screenshots_folder" "$mods_folder" "$texture_packs_folder" "$borders_folder" > $logs_folder/$(date +"%0m%0d")_backup_log.log zip -rq9 "$backups_folder/$(date +"%0m%0d")_retrodeck_userdata.zip" "$saves_folder" "$states_folder" "$bios_folder" "$media_folder" "$themes_folder" "$logs_folder" "$screenshots_folder" "$mods_folder" "$texture_packs_folder" "$borders_folder" > $logs_folder/$(date +"%0m%0d")_backup_log.log
@ -469,6 +456,10 @@ finit() {
configurator_generic_dialog "RPCS3 Firmware Install" "You have chosen to install the RPCS3 firmware during the RetroDECK first setup.\n\nThis process will take several minutes and requires network access.\n\nRPCS3 will be launched automatically at the end of the RetroDECK setup process.\nOnce the firmware is installed, please close the emulator to finish the process." configurator_generic_dialog "RPCS3 Firmware Install" "You have chosen to install the RPCS3 firmware during the RetroDECK first setup.\n\nThis process will take several minutes and requires network access.\n\nRPCS3 will be launched automatically at the end of the RetroDECK setup process.\nOnce the firmware is installed, please close the emulator to finish the process."
fi fi
if [[ "$finit_options_choices" =~ (vita3k_firmware|Enable All) ]]; then # Additional information on the firmware install process, as the emulator needs to be manually closed
configurator_generic_dialog "Vita3K Firmware Install" "You have chosen to install the Vita3K firmware during the RetroDECK first setup.\n\nThis process will take several minutes and requires network access.\n\nVita3K will be launched automatically at the end of the RetroDECK setup process.\nOnce the firmware is installed, please close the emulator to finish the process."
fi
zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" \
--text="RetroDECK will now install the needed files, which can take up to one minute.\nRetroDECK will start once the process is completed.\n\nPress OK to continue." --text="RetroDECK will now install the needed files, which can take up to one minute.\nRetroDECK will start once the process is completed.\n\nPress OK to continue."
@ -484,6 +475,11 @@ finit() {
update_rpcs3_firmware update_rpcs3_firmware
fi fi
fi fi
if [[ "$finit_options_choices" =~ (vita3k_firmware|Enable All) ]]; then
if [[ $(check_network_connectivity) == "true" ]]; then
update_vita3k_firmware
fi
fi
if [[ "$finit_options_choices" =~ (rd_controller_profile|Enable All) ]]; then if [[ "$finit_options_choices" =~ (rd_controller_profile|Enable All) ]]; then
install_retrodeck_controller_profile install_retrodeck_controller_profile
fi fi

View file

@ -137,8 +137,8 @@ if [[ ! -f "$rd_conf" ]]; then
# Check if SD card path has changed from SteamOS update # Check if SD card path has changed from SteamOS update
if [[ ! -d "$default_sd" && "$(ls -A /run/media/deck/)" ]]; then if [[ ! -d "$default_sd" && "$(ls -A /run/media/deck/)" ]]; then
if [[ $(find media/deck/* -maxdepth 0 -type d -print | wc -l) -eq 1 ]]; then # If there is only one SD card found in the new SteamOS 3.5 location, assign it as the default if [[ $(find /run/media/deck/* -maxdepth 0 -type d -print | wc -l) -eq 1 ]]; then # If there is only one SD card found in the new SteamOS 3.5 location, assign it as the default
default_sd="$(find media/deck/* -maxdepth 0 -type d -print)" default_sd="$(find /run/media/deck/* -maxdepth 0 -type d -print)"
else # If the default legacy path cannot be found, and there are multiple entries in the new Steam OS 3.5 SD card path, let the user pick which one to use else # If the default legacy path cannot be found, and there are multiple entries in the new Steam OS 3.5 SD card path, let the user pick which one to use
configurator_generic_dialog "RetroDECK Setup" "The SD card was not found in the default location, and multiple drives were detected.\nPlease browse to the location of the desired SD card.\n\nIf you are not using an SD card, please click \"Cancel\"." configurator_generic_dialog "RetroDECK Setup" "The SD card was not found in the default location, and multiple drives were detected.\nPlease browse to the location of the desired SD card.\n\nIf you are not using an SD card, please click \"Cancel\"."
default_sd="$(directory_browse "SD Card Location")" default_sd="$(directory_browse "SD Card Location")"

View file

@ -244,9 +244,10 @@ post_update() {
mv -f /var/config/emulationstation/.emulationstation /var/config/emulationstation/ES-DE # in 3.0 .emulationstation was moved into ES-DE mv -f /var/config/emulationstation/.emulationstation /var/config/emulationstation/ES-DE # in 3.0 .emulationstation was moved into ES-DE
ln -s /var/config/emulationstation/ES-DE /var/config/emulationstation/.emulationstation # symlinking it to mantain the compatibility # TODO: remove this symlink n 0.9.0b ln -s /var/config/emulationstation/ES-DE /var/config/emulationstation/.emulationstation # symlinking it to mantain the compatibility # TODO: remove this symlink n 0.9.0b
# TODO: init Vita3K prepare_component "reset" "mame"
# TODO: init Ryujinx prepare_component "reset" "vita3k"
# TODO: init GZDoom prepare_component "reset" "gzdoom"
fi fi
# if [[ $prev_version -le "090" ]]; then # if [[ $prev_version -le "090" ]]; then

View file

@ -697,13 +697,6 @@ prepare_component() {
fi fi
# Shared actions # Shared actions
dir_prep "$saves_folder/psvita/vita3k" "$bios_folder/Vita3K/Vita3K/ux0/user/00/savedata" # Multi-user safe? dir_prep "$saves_folder/psvita/vita3k" "$bios_folder/Vita3K/Vita3K/ux0/user/00/savedata" # Multi-user safe?
# Installing firmware
# TODO: at the moment this is here instead of a tool because it seems like it cannot run without Firmware
curl "http://dus01.psv.update.playstation.net/update/psv/image/2022_0209/rel_f2c7b12fe85496ec88a0391b514d6e3b/PSVUPDAT.PUP" -po /tmp/PSVUPDAT.PUP
curl "http://dus01.psp2.update.playstation.net/update/psp2/image/2019_0924/sd_8b5f60b56c3da8365b973dba570c53a5/PSP2UPDAT.PUP?dest=us" -po /tmp/PSP2UPDAT.PUP
Vita3K --firmware /tmp/PSVUPDAT.PUP
Vita3K --firmware /tmp/PSP2UPDAT.PUP
fi fi
if [[ "$action" == "postmove" ]]; then # Run only post-move commands if [[ "$action" == "postmove" ]]; then # Run only post-move commands
dir_prep "$saves_folder/psvita/vita3k" "$bios_folder/Vita3K/Vita3K/ux0/user/00/savedata" # Multi-user safe? dir_prep "$saves_folder/psvita/vita3k" "$bios_folder/Vita3K/Vita3K/ux0/user/00/savedata" # Multi-user safe?
@ -718,14 +711,65 @@ prepare_component() {
echo "Initializing MAME" echo "Initializing MAME"
echo "----------------------" echo "----------------------"
# TODO: probably some of these needs to be put elsewhere
mkdir -p $saves_folder/mame-sa mkdir -p $saves_folder/mame-sa
mkdir -p "/var/config/mame" mkdir -p "$saves_folder/mame-sa/nvram"
mkdir -p "$states_folder/mame-sa"
mkdir -p "$rdhome/screenshots/mame-sa"
mkdir -p "$saves_folder/mame-sa/diff"
mkdir -p "/var/config/ctrlr"
mkdir -p "/var/config/mame/ini"
mkdir -p "/var/config/mame/cfg"
mkdir -p "/var/config/mame/inp"
mkdir -p "/var/data/mame/plugin-data"
mkdir -p "/var/data/mame/hash"
mkdir -p "/var/data/mame/assets/samples"
mkdir -p "/var/data/mame/assets/artwork"
mkdir -p "/var/data/mame/assets/fonts"
mkdir -p "/var/data/mame/cheat"
mkdir -p "/var/data/mame/assets/crosshair"
mkdir -p "/var/data/mame/plugins"
mkdir -p "/var/data/mame/assets/language"
mkdir -p "/var/data/mame/assets/software"
mkdir -p "/var/data/mame/assets/comments"
mkdir -p "/var/data/mame/assets/share"
mkdir -p "/var/data/mame/dats"
mkdir -p "/var/data/mame/folders"
mkdir -p "/var/data/mame/assets/cabinets"
mkdir -p "/var/data/mame/assets/cpanel"
mkdir -p "/var/data/mame/assets/pcb"
mkdir -p "/var/data/mame/assets/flyers"
mkdir -p "/var/data/mame/assets/titles"
mkdir -p "/var/data/mame/assets/ends"
mkdir -p "/var/data/mame/assets/marquees"
mkdir -p "/var/data/mame/assets/artwork-preview"
mkdir -p "/var/data/mame/assets/bosses"
mkdir -p "/var/data/mame/assets/logo"
mkdir -p "/var/data/mame/assets/scores"
mkdir -p "/var/data/mame/assets/versus"
mkdir -p "/var/data/mame/assets/gameover"
mkdir -p "/var/data/mame/assets/howto"
mkdir -p "/var/data/mame/assets/select"
mkdir -p "/var/data/mame/assets/icons"
mkdir -p "/var/data/mame/assets/covers"
mkdir -p "/var/data/mame/assets/ui"
dir_prep "$saves_folder/mame-sa/hiscore" "/var/config/mame/hiscore" dir_prep "$saves_folder/mame-sa/hiscore" "/var/config/mame/hiscore"
cp -fvr "$emuconfigs/mame/"** "/var/config/mame" cp -fvr "$emuconfigs/mame/mame.ini" "/var/config/mame"
sed -i 's#RETRODECKROMSDIR#'$roms_folder'#g' "/var/config/mame/*.ini" cp -fvr "$emuconfigs/mame/ui.ini" "/var/config/mame"
sed -i 's#RETRODECKHOMESDIR#'$rdhome'#g' "/var/config/mame/*.ini" cp -fvr "$emuconfigs/mame/default.cfg" "/var/config/mame"
sed -i 's#RETRODECKSAVESDIR#'$rdhome'#g' "/var/config/mame/*.ini"
sed -i 's#RETRODECKSTATESDIR#'$rdhome'#g' "/var/config/mame/*.ini" sed -i 's#RETRODECKROMSDIR#'$roms_folder'#g' "/var/config/mame/mame.ini"
sed -i 's#RETRODECKHOMESDIR#'$rdhome'#g' "/var/config/mame/mame.ini"
sed -i 's#RETRODECKSAVESDIR#'$rdhome'#g' "/var/config/mame/mame.ini"
sed -i 's#RETRODECKSTATESDIR#'$rdhome'#g' "/var/config/mame/mame.ini"
sed -i 's#RETRODECKROMSDIR#'$roms_folder'#g' "/var/config/mame/ui.ini"
sed -i 's#RETRODECKHOMESDIR#'$rdhome'#g' "/var/config/mame/ui.ini"
sed -i 's#RETRODECKSAVESDIR#'$rdhome'#g' "/var/config/mame/ui.ini"
sed -i 's#RETRODECKSTATESDIR#'$rdhome'#g' "/var/config/mame/ui.ini"
fi fi
if [[ "$component" =~ ^(gzdoom|GZDOOM|all)$ ]]; then if [[ "$component" =~ ^(gzdoom|GZDOOM|all)$ ]]; then

View file

@ -1342,7 +1342,7 @@ modules:
# Tools # Tools
- mkdir -p /app/tools - mkdir -p /app/tools
- cp -r tools/** /app/tools - cp -r tools/** /app/tools
- find /app/tools -name '*.py|*.sh' -exec chmod +x {} \; - find /app/tools -type f \( -name "*.sh" -o -name "*.py" \) -exec chmod +x {} \;
# Function libraries # Function libraries
- mkdir -p /app/libexec - mkdir -p /app/libexec
@ -1375,6 +1375,10 @@ modules:
- cp emu-configs/gzdoom/gzdoom.sh ${FLATPAK_DEST}/bin/gzdoom.sh - cp emu-configs/gzdoom/gzdoom.sh ${FLATPAK_DEST}/bin/gzdoom.sh
- chmod +x ${FLATPAK_DEST}/bin/gzdoom.sh - chmod +x ${FLATPAK_DEST}/bin/gzdoom.sh
# MAME wrapper
- cp emu-configs/mame/mame-rdwrapper.sh ${FLATPAK_DEST}/bin/mame-rdwrapper.sh
- chmod +x ${FLATPAK_DEST}/bin/mame-rdwrapper.sh
sources: sources:
- type: git - type: git
url: https://github.com/XargonWan/RetroDECK.git url: https://github.com/XargonWan/RetroDECK.git

View file

@ -79,8 +79,8 @@ https://retrodeck.net
if [[ $response == [yY] ]]; then if [[ $response == [yY] ]]; then
rm -f "$lockfile" rm -f "$lockfile"
rm -f "$rd_conf" rm -f "$rd_conf"
read -p "The process has been completed, press Enter key to start the initial RetroDECK setup process." read -p "The process has been completed, press Enter key to exit. Please run RetroDECK again to start the initial setup process."
shift # Continue launch after previous command is finished exit 1
else else
read -p "The process has been cancelled, press Enter key to exit." read -p "The process has been cancelled, press Enter key to exit."
exit exit

View file

@ -60,6 +60,7 @@ source /app/libexec/global.sh
# - Compress All Games # - Compress All Games
# - Install: RetroDECK SD Controller Profile # - Install: RetroDECK SD Controller Profile
# - Install: PS3 firmware # - Install: PS3 firmware
# - Install: PS Vita firmware
# - RetroDECK: Change Update Setting # - RetroDECK: Change Update Setting
# - Troubleshooting # - Troubleshooting
# - Backup: RetroDECK Userdata # - Backup: RetroDECK Userdata
@ -475,7 +476,7 @@ configurator_open_emulator_dialog() {
;; ;;
"MAME" ) "MAME" )
mame mame-rdwrapper.sh
;; ;;
"MelonDS" ) "MelonDS" )
@ -499,7 +500,7 @@ configurator_open_emulator_dialog() {
;; ;;
"Ryujinx" ) "Ryujinx" )
ryujinx-wrapper Ryujinx.sh
;; ;;
"Vita3K" ) "Vita3K" )
@ -531,6 +532,7 @@ configurator_retrodeck_tools_dialog() {
"Tool: Compress Games" "Compress games for systems that support it" \ "Tool: Compress Games" "Compress games for systems that support it" \
"Install: RetroDECK SD Controller Profile" "Install the custom RetroDECK controller layout for the Steam Deck" \ "Install: RetroDECK SD Controller Profile" "Install the custom RetroDECK controller layout for the Steam Deck" \
"Install: PS3 Firmware" "Download and install PS3 firmware for use with the RPCS3 emulator" \ "Install: PS3 Firmware" "Download and install PS3 firmware for use with the RPCS3 emulator" \
"Install: PS Vita Firmware" "Download and install PS Vita firmware for use with the Vita3K emulator" \
"RetroDECK: Change Update Setting" "Enable or disable online checks for new versions of RetroDECK" ) "RetroDECK: Change Update Setting" "Enable or disable online checks for new versions of RetroDECK" )
case $choice in case $choice in
@ -571,6 +573,24 @@ configurator_retrodeck_tools_dialog() {
fi fi
;; ;;
"Install: PS Vita Firmware" )
if [[ $(check_network_connectivity) == "true" ]]; then
configurator_generic_dialog "RetroDECK Configurator - Install: PS Vita firmware" "This tool will download firmware required by Vita3K to emulate PS Vita games.\n\nThe process will take several minutes, and the emulator will launch to finish the installation.\nPlease close Vita3K manually once the installation is complete."
(
update_vita3k_firmware
) |
zenity --progress --pulsate \
--icon-name=net.retrodeck.retrodeck \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title="Downloading PS Vita Firmware" \
--no-cancel \
--auto-close
else
configurator_generic_dialog "RetroDECK Configurator - Install: PS Vita Firmware" "You do not appear to currently have Internet access, which is required by this tool. Please try again when network access has been restored."
configurator_retrodeck_tools_dialog
fi
;;
"RetroDECK: Change Update Setting" ) "RetroDECK: Change Update Setting" )
configurator_online_update_setting_dialog configurator_online_update_setting_dialog
;; ;;
@ -691,14 +711,13 @@ configurator_compression_tool_dialog() {
configurator_compress_single_game_dialog() { configurator_compress_single_game_dialog() {
local file=$(file_browse "Game to compress") local file=$(file_browse "Game to compress")
if [[ ! -z "$file" ]]; then if [[ ! -z "$file" ]]; then
local system=$(echo "$file" | grep -oE "$roms_folder/[^/]+" | grep -oE "[^/]+$")
local compatible_compression_format=$(find_compatible_compression_format "$file") local compatible_compression_format=$(find_compatible_compression_format "$file")
if [[ ! $compatible_compression_format == "none" ]]; then if [[ ! $compatible_compression_format == "none" ]]; then
local post_compression_cleanup=$(configurator_compression_cleanup_dialog) local post_compression_cleanup=$(configurator_compression_cleanup_dialog)
( (
if [[ $compatible_compression_format == "chd" ]]; then
if [[ $(validate_for_chd "$file") == "true" ]]; then
echo "# Compressing $(basename "$file") to $compatible_compression_format format" echo "# Compressing $(basename "$file") to $compatible_compression_format format"
compress_game "chd" "$file" compress_game "$compatible_compression_format" "$file" "$system"
if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested
if [[ "$file" == *".cue" ]]; then if [[ "$file" == *".cue" ]]; then
local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file")
@ -707,17 +726,9 @@ configurator_compress_single_game_dialog() {
do do
rm -f "$file_path/$line" rm -f "$file_path/$line"
done < <(printf '%s\n' "$cue_bin_files") done < <(printf '%s\n' "$cue_bin_files")
rm -f "$file" rm -f $(realpath "$file")
else else
rm -f "$file" rm -f "$(realpath "$file")"
fi
fi
fi
else
echo "# Compressing $(basename "$file") to $compatible_compression_format format"
compress_game "$compatible_compression_format" "$file"
if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested
rm -f "$file"
fi fi
fi fi
) | ) |
@ -817,12 +828,13 @@ configurator_compress_multiple_games_dialog() {
local post_compression_cleanup=$(configurator_compression_cleanup_dialog) local post_compression_cleanup=$(configurator_compression_cleanup_dialog)
( (
for file in "${games_to_compress[@]}"; do for file in "${games_to_compress[@]}"; do
local system=$(echo "$file" | grep -oE "$roms_folder/[^/]+" | grep -oE "[^/]+$")
local compression_format=$(find_compatible_compression_format "$file") local compression_format=$(find_compatible_compression_format "$file")
echo "# Compressing $(basename "$file") into $compression_format format" # Update Zenity dialog text echo "# Compressing $(basename "$file") into $compression_format format" # Update Zenity dialog text
progress=$(( 100 - (( 100 / "$total_games_to_compress" ) * "$games_left_to_compress" ))) progress=$(( 100 - (( 100 / "$total_games_to_compress" ) * "$games_left_to_compress" )))
echo $progress echo $progress
games_left_to_compress=$((games_left_to_compress-1)) games_left_to_compress=$((games_left_to_compress-1))
compress_game "$compression_format" "$file" compress_game "$compression_format" "$file" "$system"
if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested if [[ $post_compression_cleanup == "true" ]]; then # Remove file(s) if requested
if [[ "$file" == *".cue" ]]; then if [[ "$file" == *".cue" ]]; then
local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file") local cue_bin_files=$(grep -o -P "(?<=FILE \").*(?=\".*$)" "$file")