From ae0eaf7297ed600253a457593dff3275c77ff3f5 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Wed, 7 Aug 2024 22:12:32 +0900 Subject: [PATCH] FEATURES: migrated incompatible_presets --- functions/global.sh | 1 - functions/presets.sh | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/functions/global.sh b/functions/global.sh index f1cebd58..4f282f40 100644 --- a/functions/global.sh +++ b/functions/global.sh @@ -50,7 +50,6 @@ rd_appdata="/app/share/appdata/net.retrodeck.retrodeck.appdata.xml" rpcs3_firmware="http://dus01.ps3.update.playstation.net/update/ps3/image/us/2023_0228_05fe32f5dc8c78acbcd84d36ee7fdc5b/PS3UPDAT.PUP" RA_API_URL="https://retroachievements.org/dorequest.php" # API URL for RetroAchievements.org presets_dir="$config/retrodeck/presets" # Repository for all system preset config files -incompatible_presets_reference_list="$config/retrodeck/reference_lists/incompatible_presets.cfg" # A config file listing all incompatible presets for reference (eg. cannot have borders and widescreen enabled simultaniously) pretty_system_names_reference_list="$config/retrodeck/reference_lists/pretty_system_names.cfg" # An internal translation list for turning internal names (eg. gbc) to "pretty" names (Nintendo GameBoy Color) git_organization_name="RetroDECK" # The name of the organization in our git repository such as GitHub cooker_repository_name="Cooker" # The name of the cooker repository under RetroDECK organization diff --git a/functions/presets.sh b/functions/presets.sh index aac3c321..18f25dad 100644 --- a/functions/presets.sh +++ b/functions/presets.sh @@ -70,6 +70,15 @@ build_preset_list_options() { make_preset_changes() { # This function will take an array $choices, which contains the names of systems that have been enabled for this preset and enable them in the backend + # Fetch incompatible presets from JSON and create a lookup list + incompatible_presets=$(jq -r ' + .incompatible_presets | to_entries[] | + [ + "\(.key):\(.value)", + "\(.value):\(.key)" + ] | join("\n") + ' $features) + IFS="," read -ra choices <<< "$choice" for emulator in "${all_systems[@]}"; do if [[ " ${choices[*]} " =~ " ${emulator} " && ! " ${current_enabled_systems[*]} " =~ " ${emulator} " ]]; then @@ -89,7 +98,7 @@ make_preset_changes() { fi fi fi - done < "$incompatible_presets_reference_list" + done < "$incompatible_presets" fi if [[ ! " ${choices[*]} " =~ " ${emulator} " && ! " ${current_disabled_systems[*]} " =~ " ${emulator} " ]]; then changed_systems=("${changed_systems[@]}" "$emulator")