From 5717d08a8fe78fd675fd7f3108693315e3a4f0f1 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Tue, 23 May 2023 16:16:54 -0400 Subject: [PATCH] Fixes for retroarch-all presets Fixes for Cheevos logout process --- functions/presets.sh | 17 ++++++++--------- tools/configurator.sh | 3 ++- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/functions/presets.sh b/functions/presets.sh index c2fd0d86..07d57faf 100644 --- a/functions/presets.sh +++ b/functions/presets.sh @@ -95,7 +95,12 @@ build_preset_config() { case "$action" in "config_file_format" ) - local read_config_format="$read_preset" + if [[ "$read_preset" == "retroarch-all" ]]; then + local retroarch_all="true" + local read_config_format="retroarch" + else + local read_config_format="$read_preset" + fi ;; "target_file" ) @@ -118,7 +123,7 @@ build_preset_config() { if [[ "$new_setting_value" = \$* ]]; then eval new_setting_value=$new_setting_value fi - if [[ "$read_config_format" == "retroarch" ]]; then # If this is a RetroArch core, generate the override file + 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 mkdir -p "$(realpath "$(dirname "$read_target_file")")" echo "$read_setting_name = \""$new_setting_value"\"" > "$read_target_file" @@ -130,13 +135,10 @@ build_preset_config() { fi fi else - if [[ "$read_config_format" == "retroarch-all" ]]; then - read_config_format="retroarch" - fi set_setting_value "$read_target_file" "$read_setting_name" "$new_setting_value" "$read_config_format" "$section" fi else - if [[ "$read_config_format" == "retroarch" ]]; then + 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 @@ -147,9 +149,6 @@ build_preset_config() { fi fi else - if [[ "$read_config_format" == "retroarch-all" ]]; then - read_config_format="retroarch" - fi 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 diff --git a/tools/configurator.sh b/tools/configurator.sh index 69febd56..76bf4c1a 100644 --- a/tools/configurator.sh +++ b/tools/configurator.sh @@ -214,7 +214,8 @@ configurator_global_presets_and_settings_dialog() { "RetroAchievements: Logout" ) # This is a workaround to allow disabling cheevos without having to enter login credentials local cheevos_emulators=$(sed -n '/\[cheevos\]/, /\[/{ /\[cheevos\]/! { /\[/! p } }' $rd_conf | sed '/^$/d') - for emulator in $cheevos_emulators; do + for setting_line in $cheevos_emulators; do + emulator=$(get_setting_name "$setting_line" "retrodeck") set_setting_value "$rdconf" "$emulator" "false" "retrodeck" "cheevos" build_preset_config "$emulator" "cheevos" done