Fixes for retroarch-all presets

Fixes for Cheevos logout process
This commit is contained in:
icenine451 2023-05-23 16:16:54 -04:00
parent f5f84f2f7b
commit 5717d08a8f
2 changed files with 10 additions and 10 deletions

View file

@ -95,7 +95,12 @@ build_preset_config() {
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
;;
"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

View file

@ -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