--text="There were some conflicting files that were not moved.\n\nAll files that could be moved are in the new location,\nany files that already existed at the new location have not been moved and will need to be handled manually."
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
# This function will import a default retrodeck.cfg file and update it with any current settings. This will allow us to expand the file over time while retaining current user settings.
# USAGE: update_rd_conf
# STAGE 1: For current files that haven't been broken into sections yet, where every setting name is unique
conf_read # Read current settings into memory
mv -f $rd_conf$rd_conf_backup# Backup config file before update
cp $rd_defaults$rd_conf# Copy defaults file into place
conf_write # Write old values into new default file
# STAGE 2: To handle presets sections that use duplicate setting names
mv -f $rd_conf$rd_conf_backup# Backup config file agiain before update but after Stage 1 expansion
generate_single_patch $rd_defaults$rd_conf_backup$rd_update_patch retrodeck # Create a patch file for differences between defaults and current user settings
sed -i '/change^^version/d'$rd_update_patch# Remove version line from temporary patch file
deploy_single_patch $rd_defaults$rd_update_patch$rd_conf# Re-apply user settings to defaults file
set_setting_value $rd_conf"version""$hard_version" retrodeck # Set version of currently running RetroDECK to updated retrodeck.cfg
localsystem_name=$(get_setting_name "$current_setting_line""retrodeck")# Read the variable name from the current line
localsystem_enabled=$(get_setting_value "$rd_conf""$system_name""retrodeck""$current_section")# Read the variables value from active retrodeck.cfg
localdefault_setting=$(get_setting_value "$rd_defaults""$system_name""retrodeck""$current_section")# Read the variable value from the retrodeck defaults
localcurrent_setting_name=$(get_setting_name "$current_setting_line""retrodeck")# Read the variable name from the current line
localcurrent_setting_value=$(get_setting_value "$rd_conf""$current_setting_name""retrodeck""$current_section")# Read the variables value from retrodeck.cfg
localcurrent_setting_name=$(get_setting_name "$current_setting_line""retrodeck")# Read the variable name from the current line
localcurrent_setting_value=$(get_setting_value "$rd_conf""$current_setting_name""retrodeck""$current_section")# Read the variables value from retrodeck.cfg
localmemory_setting_value=$(eval"echo \$${current_setting_name}")# Read the variable names' value from memory
if[[ ! "$current_setting_value"=="$memory_setting_value"&& ! -z "$memory_setting_value"]];then# If the values are different...
set_setting_value "$rd_conf""$current_setting_name""$memory_setting_value""retrodeck""$current_section"# Update the value in retrodeck.cfg
# 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
rm -f "$godot_bios_files_checked"# Godot data transfer temp files
localfinit_dest_choice=$(configurator_destination_choice_dialog "RetroDECK data""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 RetroDECK data folder to be located?\n\nThis folder will contain all ROMs, BIOSs and scraped data.")
--text="SD Card was not found in the default location.\nPlease choose the SD Card root.\nA retrodeck folder will be created starting from the directory that you selected."
rdhome="$(finit_browse)"# Calling the browse function
if[[ -z "$rdhome"]];then# If user hit the cancel button
--text="SD card was found but is not writable\nThis can happen with cards formatted on PC.\nPlease format the SD card through the Steam Deck's Game Mode and run RetroDECK again."
rm -f "$rd_conf"# Cleanup unfinished retrodeck.cfg if first install is interrupted
conf_write # Write the new values to retrodeck.cfg
configurator_generic_dialog "RetroDECK Initial Setup""The next dialog will be a list of optional actions to take during the initial setup.\n\nIf you choose to not do any of these now, they can be done later through the Configurator."
if[["$finit_options_choices"=~ (rpcs3_firmware|Enable All)]];then# Additional information on the firmware install process, as the emulator needs to be manually closed
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."
--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 is finishing the initial setup process, please wait."
create_lock
}
install_retrodeck_starterpack(){
# This function will install the roms, gamelists and metadata for the RetroDECK Starter Pack, a curated selection of games the creators of RetroDECK enjoy.
# This function will install the needed files for the custom RetroDECK controller profile
# NOTE: These files need to be stored in shared locations for Steam, outside of the normal RetroDECK folders and should always be an optional user choice
configurator_generic_dialog "RetroDECK Controller Profile Install""The target directories for the controller profile do not exist.\n\nThis may happen if you do not have Steam installed or the location is does not have permission to be read."
fi
}
create_lock(){
# creating RetroDECK's lock file and writing the version in the config file
version=$hard_version
touch "$lockfile"
conf_write
}
update_splashscreens(){
# This script will purge any existing ES graphics and reload them from RO space into somewhere ES will look for it
# This function will replace the RetroDECK startup splash screen with a different image if the day and time match a listing in easter_egg_checklist.cfg
# The easter_egg_checklist.cfg file has the current format: $start_date^$end_date^$start_time^$end_time^$splash_file
# Ex. The line "1001^1031^0000^2359^spooky.svg" would show the file "spooky.svg" during any time of day in the month of October
# The easter_egg_checklist.cfg is read in order, so lines higher in the file will have higher priority in the event of an overlap
# USAGE: easter_eggs
current_day=$(date +"%0m%0d")# Read the current date in a format that can be calculated in ranges
current_time=$(date +"%0H%0M")# Read the current time in a format that can be calculated in ranges
if[[ ! -z $(cat $easter_egg_checklist)]];then
whileIFS="^"read -r start_date end_date start_time end_time splash_file # Read Easter Egg checklist file and separate values
if[["$((10#$current_day))" -ge "$((10#$start_date))"&&"$((10#$current_day))" -le "$((10#$end_date))"&&"$((10#$current_time))" -ge "$((10#$start_time))"&&"$((10#$current_time))" -le "$((10#$end_time))"]];then# If current line specified date/time matches current date/time, set $splash_file to be deployed
configurator_generic_dialog "RetroDECK Online Update""The update process may take several minutes.\n\nAfter the update is complete, RetroDECK will close. When you run it again you will be using the latest version."
(
localdesired_flatpak_file=$(curl --silent $flatpak_file_url| grep '"browser_download_url":'| sed -E 's/.*"([^"]+)".*/\1/')
flatpak-spawn --host flatpak remove --noninteractive -y net.retrodeck.retrodeck # Remove current version before installing new one, to avoid duplicates