From 88893a3c1b185944692dc4cd79447b49fa5e0848 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Sat, 29 Jun 2024 15:17:08 -0400 Subject: [PATCH 1/3] Add compensation for reading reference files where there is not an empty newline at the end of the file --- automation_tools/pre_build_automation.sh | 2 +- functions/checks.sh | 2 +- functions/configurator_functions.sh | 4 ++-- functions/framework.sh | 4 ++-- functions/other_functions.sh | 6 +++--- functions/presets.sh | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/automation_tools/pre_build_automation.sh b/automation_tools/pre_build_automation.sh index 476ae315..5d9a7c91 100755 --- a/automation_tools/pre_build_automation.sh +++ b/automation_tools/pre_build_automation.sh @@ -50,7 +50,7 @@ cat "$automation_task_list" echo # Update all collected information -while IFS="^" read -r action placeholder url branch +while IFS="^" read -r action placeholder url branch || [[ -n "$action" ]]; do if [[ ! $action == "#"* ]] && [[ ! -z "$action" ]]; then case "$action" in diff --git a/functions/checks.sh b/functions/checks.sh index 713556aa..a1589f22 100644 --- a/functions/checks.sh +++ b/functions/checks.sh @@ -156,7 +156,7 @@ check_for_version_update() { } validate_input() { - while IFS="^" read -r input action + while IFS="^" read -r input action || [[ -n "$input" ]]; do if [[ "$input" == "$1" ]]; then eval "$action" diff --git a/functions/configurator_functions.sh b/functions/configurator_functions.sh index 7e3a0870..11ce5eb0 100644 --- a/functions/configurator_functions.sh +++ b/functions/configurator_functions.sh @@ -10,7 +10,7 @@ check_bios_files() { fi touch "$godot_bios_files_checked" - while IFS="^" read -r bios_file bios_subdir bios_hash bios_system bios_desc + while IFS="^" read -r bios_file bios_subdir bios_hash bios_system bios_desc || [[ -n "$bios_file" ]]; do bios_file_found="No" bios_hash_matched="No" @@ -44,7 +44,7 @@ find_empty_rom_folders() { all_empty_folders=() all_helper_files=() - while IFS='^' read -r file dest + while IFS='^' read -r file dest || [[ -n "$file" ]]; do if [[ ! "$file" == "#"* ]] && [[ ! -z "$file" ]]; then all_helper_files=("${all_helper_files[@]}" "$file") diff --git a/functions/framework.sh b/functions/framework.sh index 92f3b32e..d64fd16e 100644 --- a/functions/framework.sh +++ b/functions/framework.sh @@ -410,7 +410,7 @@ deploy_single_patch() { cp -fv "$1" "$3" # Create a copy of the original file to be patched -while IFS="^" read -r action current_section setting_name setting_value system_name +while IFS="^" read -r action current_section setting_name setting_value system_name || [[ -n "$action" ]]; do case $action in @@ -461,7 +461,7 @@ deploy_multi_patch() { # Patch file format should be as follows, with optional entries in (). Optional settings can be left empty, but must still have ^ dividers: # $action^($current_section)^$setting_name^$setting_value^$system_name^($config file) -while IFS="^" read -r action current_section setting_name setting_value system_name config_file +while IFS="^" read -r action current_section setting_name setting_value system_name config_file || [[ -n "$action" ]]; do case $action in diff --git a/functions/other_functions.sh b/functions/other_functions.sh index 90faa7fc..7e5d3c40 100644 --- a/functions/other_functions.sh +++ b/functions/other_functions.sh @@ -361,7 +361,7 @@ done finit_user_options_dialog() { finit_available_options=() - while IFS="^" read -r enabled option_name option_desc option_tag + while IFS="^" read -r enabled option_name option_desc option_tag || [[ -n "$enabled" ]]; do finit_available_options=("${finit_available_options[@]}" "$enabled" "$option_name" "$option_desc" "$option_tag") done < $finit_options_list @@ -561,7 +561,7 @@ deploy_helper_files() { # This script will distribute helper documentation files throughout the filesystem according to the $helper_files_list # USAGE: deploy_helper_files - while IFS='^' read -r file dest + while IFS='^' read -r file dest || [[ -n "$file" ]]; do if [[ ! "$file" == "#"* ]] && [[ ! -z "$file" ]]; then eval current_dest="$dest" @@ -579,7 +579,7 @@ 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 - while IFS="^" read -r start_date end_date start_time end_time splash_file # Read Easter Egg checklist file and separate values + while IFS="^" read -r start_date end_date start_time end_time splash_file || [[ -n "$start_date" ]]; # Read Easter Egg checklist file and separate values do 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 new_splash_file="$splashscreen_dir/$splash_file" diff --git a/functions/presets.sh b/functions/presets.sh index c7d4ff66..b3abaf4e 100644 --- a/functions/presets.sh +++ b/functions/presets.sh @@ -116,7 +116,7 @@ build_preset_config() { local read_system_name=$(get_setting_name "$system_line") if [[ "$read_system_name" == "$system_being_changed" ]]; then local read_system_enabled=$(get_setting_value "$rd_conf" "$read_system_name" "retrodeck" "$current_preset") - while IFS='^' read -r action read_preset read_setting_name new_setting_value section target_file defaults_file + while IFS='^' read -r action read_preset read_setting_name new_setting_value section target_file defaults_file || [[ -n "$action" ]]; do case "$action" in @@ -202,7 +202,7 @@ build_retrodeck_current_presets() { # This can also be used to build the "current" state post-update after adding new systems # USAGE: build_retrodeck_current_presets - while IFS= read -r current_setting_line # Read the existing retrodeck.cfg + while IFS= read -r current_setting_line || [[ -n "$current_setting_line" ]]; # Read the existing retrodeck.cfg do if [[ (! -z "$current_setting_line") && (! "$current_setting_line" == "#"*) && (! "$current_setting_line" == "[]") ]]; then # If the line has a valid entry in it if [[ ! -z $(grep -o -P "^\[.+?\]$" <<< "$current_setting_line") ]]; then # If the line is a section header From 2e448424584bc11db501f02d069d8339c64a5cc8 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Sat, 29 Jun 2024 15:31:05 -0400 Subject: [PATCH 2/3] Add comment and blank line handling to reference-file-reading functions --- functions/checks.sh | 8 +- functions/configurator_functions.sh | 32 +++--- functions/framework.sh | 147 ++++++++++++++-------------- functions/other_functions.sh | 16 +-- functions/presets.sh | 133 +++++++++++++------------ 5 files changed, 172 insertions(+), 164 deletions(-) diff --git a/functions/checks.sh b/functions/checks.sh index a1589f22..d0a60f73 100644 --- a/functions/checks.sh +++ b/functions/checks.sh @@ -158,9 +158,11 @@ check_for_version_update() { validate_input() { while IFS="^" read -r input action || [[ -n "$input" ]]; do - if [[ "$input" == "$1" ]]; then - eval "$action" - input_validated="true" + if [[ ! $input == "#"* ]] && [[ ! -z "$input" ]]; then + if [[ "$input" == "$1" ]]; then + eval "$action" + input_validated="true" + fi fi done < $input_validation } diff --git a/functions/configurator_functions.sh b/functions/configurator_functions.sh index 11ce5eb0..768215b8 100644 --- a/functions/configurator_functions.sh +++ b/functions/configurator_functions.sh @@ -12,22 +12,24 @@ check_bios_files() { while IFS="^" read -r bios_file bios_subdir bios_hash bios_system bios_desc || [[ -n "$bios_file" ]]; 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" + if [[ ! $bios_file == "#"* ]] && [[ ! -z "$bios_file" ]]; then + 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 - 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 } diff --git a/functions/framework.sh b/functions/framework.sh index d64fd16e..08e736f3 100644 --- a/functions/framework.sh +++ b/functions/framework.sh @@ -412,45 +412,42 @@ cp -fv "$1" "$3" # Create a copy of the original file to be patched while IFS="^" read -r action current_section setting_name setting_value system_name || [[ -n "$action" ]]; do + if [[ ! $action == "#"* ]] && [[ ! -z "$action" ]]; then + case $action in - case $action in + "disable_file" ) + eval disable_file "$setting_name" + ;; - "disable_file" ) - eval disable_file "$setting_name" - ;; + "enable_file" ) + eval enable_file "$setting_name" + ;; - "enable_file" ) - eval enable_file "$setting_name" - ;; + "add_setting_line" ) + add_setting_line "$3" "$setting_name" "$system_name" "$current_section" + ;; - "add_setting_line" ) - add_setting_line "$3" "$setting_name" "$system_name" "$current_section" - ;; + "disable_setting" ) + disable_setting "$3" "$setting_name" "$system_name" "$current_section" + ;; - "disable_setting" ) - disable_setting "$3" "$setting_name" "$system_name" "$current_section" - ;; + "enable_setting" ) + enable_setting "$3" "$setting_name" "$system_name" "$current_section" + ;; - "enable_setting" ) - enable_setting "$3" "$setting_name" "$system_name" "$current_section" - ;; + "change" ) + if [[ "$setting_value" = \$* ]]; then # If patch setting value is a reference to an internal variable name + eval setting_value="$setting_value" + fi + set_setting_value "$3" "$setting_name" "$setting_value" "$system_name" "$current_section" + ;; - "change" ) - if [[ "$setting_value" = \$* ]]; then # If patch setting value is a reference to an internal variable name - eval setting_value="$setting_value" - fi - set_setting_value "$3" "$setting_name" "$setting_value" "$system_name" "$current_section" - ;; + * ) + log e "Config line malformed: $action" + ;; - *"#"* ) - # Comment line in patch file - ;; - - * ) - echo "Config line malformed: $action" - ;; - - esac + esac + fi done < "$2" } @@ -463,58 +460,56 @@ deploy_multi_patch() { while IFS="^" read -r action current_section setting_name setting_value system_name config_file || [[ -n "$action" ]]; do - case $action in + if [[ ! $action == "#"* ]] && [[ ! -z "$action" ]]; then + case $action in - "disable_file" ) - if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name - eval config_file="$config_file" - fi - disable_file "$config_file" - ;; + "disable_file" ) + if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name + eval config_file="$config_file" + fi + disable_file "$config_file" + ;; - "enable_file" ) - if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name - eval config_file="$config_file" - fi - enable_file "$config_file" - ;; + "enable_file" ) + if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name + eval config_file="$config_file" + fi + enable_file "$config_file" + ;; - "add_setting_line" ) - if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name - eval config_file="$config_file" - fi - add_setting_line "$config_file" "$setting_name" "$system_name" "$current_section" - ;; + "add_setting_line" ) + if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name + eval config_file="$config_file" + fi + add_setting_line "$config_file" "$setting_name" "$system_name" "$current_section" + ;; - "disable_setting" ) - if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name - eval config_file="$config_file" - fi - disable_setting "$config_file" "$setting_name" "$system_name" "$current_section" - ;; + "disable_setting" ) + if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name + eval config_file="$config_file" + fi + disable_setting "$config_file" "$setting_name" "$system_name" "$current_section" + ;; - "enable_setting" ) - if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name - eval config_file="$config_file" - fi - enable_setting "$config_file" "$setting_name" "$system_name" "$current_section" - ;; + "enable_setting" ) + if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name + eval config_file="$config_file" + fi + enable_setting "$config_file" "$setting_name" "$system_name" "$current_section" + ;; - "change" ) - if [[ "$setting_value" = \$* ]]; then # If patch setting value is a reference to an internal variable name - eval setting_value="$setting_value" - fi - set_setting_value "$config_file" "$setting_name" "$setting_value" "$system_name" "$current_section" - ;; + "change" ) + if [[ "$setting_value" = \$* ]]; then # If patch setting value is a reference to an internal variable name + eval setting_value="$setting_value" + fi + set_setting_value "$config_file" "$setting_name" "$setting_value" "$system_name" "$current_section" + ;; - *"#"* ) - # Comment line in patch file - ;; + * ) + log e "Config line malformed: $action" + ;; - * ) - echo "Config line malformed: $action" - ;; - - esac + esac + fi done < "$1" } diff --git a/functions/other_functions.sh b/functions/other_functions.sh index 7e5d3c40..703727a7 100644 --- a/functions/other_functions.sh +++ b/functions/other_functions.sh @@ -363,7 +363,9 @@ finit_user_options_dialog() { while IFS="^" read -r enabled option_name option_desc option_tag || [[ -n "$enabled" ]]; do - finit_available_options=("${finit_available_options[@]}" "$enabled" "$option_name" "$option_desc" "$option_tag") + if [[ ! $enabled == "#"* ]] && [[ ! -z "$enabled" ]]; then + finit_available_options=("${finit_available_options[@]}" "$enabled" "$option_name" "$option_desc" "$option_tag") + fi done < $finit_options_list @@ -581,11 +583,13 @@ easter_eggs() { if [[ ! -z $(cat $easter_egg_checklist) ]]; then while IFS="^" read -r start_date end_date start_time end_time splash_file || [[ -n "$start_date" ]]; # Read Easter Egg checklist file and separate values do - 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 - new_splash_file="$splashscreen_dir/$splash_file" - break - else # When there are no matches, the default splash screen is set to deploy - new_splash_file="$default_splash_file" + if [[ ! $start_date == "#"* ]] && [[ ! -z "$start_date" ]]; then + 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 + new_splash_file="$splashscreen_dir/$splash_file" + break + else # When there are no matches, the default splash screen is set to deploy + new_splash_file="$default_splash_file" + fi fi done < $easter_egg_checklist else diff --git a/functions/presets.sh b/functions/presets.sh index b3abaf4e..92dd868d 100644 --- a/functions/presets.sh +++ b/functions/presets.sh @@ -79,11 +79,14 @@ make_preset_changes() { fi set_setting_value "$rd_conf" "$emulator" "true" "retrodeck" "$preset" # Check for conflicting presets for this system - while IFS=: read -r preset_being_checked known_incompatible_preset; do - if [[ "$preset" == "$preset_being_checked" ]]; then - if [[ $(get_setting_value "$rd_conf" "$emulator" "retrodeck" "$known_incompatible_preset") == "true" ]]; then - changed_presets=("${changed_presets[@]}" "$known_incompatible_preset") - set_setting_value "$rd_conf" "$emulator" "false" "retrodeck" "$known_incompatible_preset" + while IFS=: read -r preset_being_checked known_incompatible_preset || [[ -n "$preset_being_checked" ]]; + do + if [[ ! $preset_being_checked == "#"* ]] && [[ ! -z "$preset_being_checked" ]]; then + if [[ "$preset" == "$preset_being_checked" ]]; then + if [[ $(get_setting_value "$rd_conf" "$emulator" "retrodeck" "$known_incompatible_preset") == "true" ]]; then + changed_presets=("${changed_presets[@]}" "$known_incompatible_preset") + set_setting_value "$rd_conf" "$emulator" "false" "retrodeck" "$known_incompatible_preset" + fi fi fi done < "$incompatible_presets_reference_list" @@ -118,79 +121,81 @@ build_preset_config() { local read_system_enabled=$(get_setting_value "$rd_conf" "$read_system_name" "retrodeck" "$current_preset") while IFS='^' read -r action read_preset read_setting_name new_setting_value section target_file defaults_file || [[ -n "$action" ]]; do - case "$action" in + if [[ ! $action == "#"* ]] && [[ ! -z "$action" ]]; then + case "$action" in - "config_file_format" ) - if [[ "$read_preset" == "retroarch-all" ]]; then - local retroarch_all="true" - local read_config_format="retroarch" - else - local read_config_format="$read_preset" - fi - ;; + "config_file_format" ) + if [[ "$read_preset" == "retroarch-all" ]]; then + local retroarch_all="true" + local read_config_format="retroarch" + else + local read_config_format="$read_preset" + fi + ;; - "change" ) - if [[ "$read_preset" == "$current_preset" ]]; then - if [[ "$target_file" = \$* ]]; then # Read current target file and resolve if it is a variable - eval target_file=$target_file - fi - local read_target_file="$target_file" - if [[ "$defaults_file" = \$* ]]; then #Read current defaults file and resolve if it is a variable - eval defaults_file=$defaults_file - fi - local read_defaults_file="$defaults_file" - if [[ "$read_system_enabled" == "true" ]]; then - if [[ "$new_setting_value" = \$* ]]; then - eval new_setting_value=$new_setting_value + "change" ) + if [[ "$read_preset" == "$current_preset" ]]; then + if [[ "$target_file" = \$* ]]; then # Read current target file and resolve if it is a variable + eval target_file=$target_file fi - if [[ "$read_config_format" == "retroarch" && ! "$retroarch_all" == "true" ]]; then # If this is a RetroArch core, generate the override file - if [[ ! -f "$read_target_file" ]]; then - create_dir "$(realpath "$(dirname "$read_target_file")")" - echo "$read_setting_name = \""$new_setting_value"\"" > "$read_target_file" - else - if [[ -z $(grep -o -P "^$read_setting_name\b" "$read_target_file") ]]; then - add_setting "$read_target_file" "$read_setting_name" "$new_setting_value" "$read_config_format" "$section" + local read_target_file="$target_file" + if [[ "$defaults_file" = \$* ]]; then #Read current defaults file and resolve if it is a variable + eval defaults_file=$defaults_file + fi + local read_defaults_file="$defaults_file" + if [[ "$read_system_enabled" == "true" ]]; then + if [[ "$new_setting_value" = \$* ]]; then + eval new_setting_value=$new_setting_value + fi + if [[ "$read_config_format" == "retroarch" && ! "$retroarch_all" == "true" ]]; then # If this is a RetroArch core, generate the override file + if [[ ! -f "$read_target_file" ]]; then + create_dir "$(realpath "$(dirname "$read_target_file")")" + echo "$read_setting_name = \""$new_setting_value"\"" > "$read_target_file" else - set_setting_value "$read_target_file" "$read_setting_name" "$new_setting_value" "$read_config_format" "$section" - fi + if [[ -z $(grep -o -P "^$read_setting_name\b" "$read_target_file") ]]; then + add_setting "$read_target_file" "$read_setting_name" "$new_setting_value" "$read_config_format" "$section" + else + set_setting_value "$read_target_file" "$read_setting_name" "$new_setting_value" "$read_config_format" "$section" + fi + fi + else + set_setting_value "$read_target_file" "$read_setting_name" "$new_setting_value" "$read_config_format" "$section" fi else - set_setting_value "$read_target_file" "$read_setting_name" "$new_setting_value" "$read_config_format" "$section" - fi - else - if [[ "$read_config_format" == "retroarch" && ! "$retroarch_all" == "true" ]]; then - if [[ -f "$read_target_file" ]]; then - delete_setting "$read_target_file" "$read_setting_name" "$read_config_format" "$section" - if [[ -z $(cat "$read_target_file") ]]; then # If the override file is empty - rm -f "$read_target_file" - fi - if [[ -z $(ls -1 "$(dirname "$read_target_file")") ]]; then # If the override folder is empty - rmdir "$(realpath "$(dirname "$read_target_file")")" + if [[ "$read_config_format" == "retroarch" && ! "$retroarch_all" == "true" ]]; then + if [[ -f "$read_target_file" ]]; then + delete_setting "$read_target_file" "$read_setting_name" "$read_config_format" "$section" + if [[ -z $(cat "$read_target_file") ]]; then # If the override file is empty + rm -f "$read_target_file" + fi + if [[ -z $(ls -1 "$(dirname "$read_target_file")") ]]; then # If the override folder is empty + rmdir "$(realpath "$(dirname "$read_target_file")")" + fi fi + else + local default_setting_value=$(get_setting_value "$read_defaults_file" "$read_setting_name" "$read_config_format" "$section") + set_setting_value "$read_target_file" "$read_setting_name" "$default_setting_value" "$read_config_format" "$section" fi - else - local default_setting_value=$(get_setting_value "$read_defaults_file" "$read_setting_name" "$read_config_format" "$section") - set_setting_value "$read_target_file" "$read_setting_name" "$default_setting_value" "$read_config_format" "$section" fi fi - fi - ;; + ;; - "enable" ) - if [[ "$read_preset" == "$current_preset" ]]; then - if [[ "$read_system_enabled" == "true" ]]; then - enable_file "$read_setting_name" - else - disable_file "$read_setting_name" + "enable" ) + if [[ "$read_preset" == "$current_preset" ]]; then + if [[ "$read_system_enabled" == "true" ]]; then + enable_file "$read_setting_name" + else + disable_file "$read_setting_name" + fi fi - fi - ;; + ;; - * ) - echo "Other data: $action $read_preset $read_setting_name $new_setting_value $section" # DEBUG - ;; + * ) + echo "Other data: $action $read_preset $read_setting_name $new_setting_value $section" # DEBUG + ;; - esac + esac + fi done < <(cat "$presets_dir/$read_system_name"_presets.cfg) fi done < <(printf '%s\n' "$preset_section") From 58615bb9d5eaa95e117f9d3597bef40ea669806f Mon Sep 17 00:00:00 2001 From: icenine451 Date: Sat, 29 Jun 2024 15:38:16 -0400 Subject: [PATCH 3/3] Change some echoes to logs --- functions/multi_user.sh | 6 +++--- functions/presets.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/functions/multi_user.sh b/functions/multi_user.sh index 10e31e06..2e015cc4 100644 --- a/functions/multi_user.sh +++ b/functions/multi_user.sh @@ -149,7 +149,7 @@ multi_user_determine_current_user() { multi_user_return_to_single_user() { single_user="$1" - echo "Returning to single-user mode for $single_user" + log i "Returning to single-user mode for $single_user" unlink "$saves_folder" unlink "$states_folder" unlink "$rd_conf" @@ -182,7 +182,7 @@ multi_user_return_to_single_user() { multi_user_setup_new_user() { # TODO: RPCS3 one-offs - echo "Setting up new user" + log i "Setting up new user" unlink "$saves_folder" unlink "$states_folder" dir_prep "$multi_user_data_folder/$SteamAppUser/saves" "$saves_folder" @@ -220,7 +220,7 @@ multi_user_setup_new_user() { } multi_user_link_current_user_files() { - echo "Linking existing user" + log i "Linking existing user" ln -sfT "$multi_user_data_folder/$SteamAppUser/saves" "$saves_folder" ln -sfT "$multi_user_data_folder/$SteamAppUser/states" "$states_folder" ln -sfT "$multi_user_data_folder/$SteamAppUser/config/retrodeck/retrodeck.cfg" "$rd_conf" diff --git a/functions/presets.sh b/functions/presets.sh index 92dd868d..aac3c321 100644 --- a/functions/presets.sh +++ b/functions/presets.sh @@ -28,7 +28,7 @@ change_preset_dialog() { --title "RetroDECK Configurator Utility - Presets Configuration" \ --text="Setting up your presets, please wait..." else - echo "No choices made" + log i "No preset choices made" fi } @@ -191,7 +191,7 @@ build_preset_config() { ;; * ) - echo "Other data: $action $read_preset $read_setting_name $new_setting_value $section" # DEBUG + log d "Other data: $action $read_preset $read_setting_name $new_setting_value $section" # DEBUG ;; esac