From 07b8edb32ee1a5cbf8f239efbe0befd471436076 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Wed, 7 Aug 2024 16:20:27 +0900 Subject: [PATCH] FRAMEWORK: migrating update_rd_conf into a reworked function with features.json support --- functions/other_functions.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/functions/other_functions.sh b/functions/other_functions.sh index 5786f8cf..adaa56e5 100644 --- a/functions/other_functions.sh +++ b/functions/other_functions.sh @@ -162,6 +162,15 @@ update_rd_conf() { # STAGE 3: Eliminate any preset incompatibility with existing user settings and new defaults + # Fetch incompatible presets from JSON and create a lookup list + incompatible_presets=$(jq -r ' + .incompatible_presets | to_entries[] | + [ + "\(.key):\(.value)", + "\(.value):\(.key)" + ] | join("\n") + ' config/retrodeck/reference_lists/features.json) + while IFS= read -r 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 @@ -179,7 +188,7 @@ update_rd_conf() { set_setting_value "$rd_conf" "$system_name" "false" "retrodeck" "$current_section" fi fi - done < "$incompatible_presets_reference_list" + done <<< "$incompatible_presets" fi fi fi @@ -187,6 +196,7 @@ update_rd_conf() { done < $rd_conf } + conf_read() { # This function will read the RetroDECK config file into memory # USAGE: conf_read