--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."
fi
}
update_rd_conf(){
# 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
eval"$current_setting_name=$current_setting_value"# Write the current setting name and value to memory
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
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.")
echo"Choice is $finit_dest_choice"
case$finit_dest_choice in
"Back"|"")# Back or X button quits
rm -f "$rd_conf"# Cleanup unfinished retrodeck.cfg if first install is interrupted
echo"Now quitting"
exit2
;;
"Internal Storage")# Internal
echo"Internal selected"
rdhome="$HOME/retrodeck"
if[[ -L $rdhome]];then#Remove old symlink from existing install, if it exists
--text="SD Card was not find 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
rm -f "$rd_conf"# Cleanup unfinished retrodeck.cfg if first install is interrupted
exit2
fi
elif[ ! -w "$sdcard"]#SD card found but not writable
--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
--text="Please choose the root folder for the RetroDECK data.\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
rm -f "$rd_conf"# Cleanup unfinished retrodeck.cfg if first install is interrupted
exit2
fi
;;
esac
prepare_emulator "reset""retrodeck"# Parse the [paths] section of retrodeck.cfg and set the value of / create all needed folders
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.
# USAGE: install_retrodeck_starterpack
## DOOM section ##
cp /app/retrodeck/extras/doom1.wad "$roms_folder/doom/doom1.wad"# No -f in case the user already has it
# 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
do
if[[$current_day -ge "$start_date"&&$current_day -le "$end_date"&&$current_time -ge "$start_time"&&$current_time -le "$end_time"]];then# If current line specified date/time matches current date/time, set $splash_file to be deployed
new_splash_file="$splashscreen_dir/$splash_file"
break
else# When there are no matches, the default splash screen is set to deploy