FEATURES: migrated incompatible_presets

This commit is contained in:
XargonWan 2024-08-07 22:12:32 +09:00
parent 9229353943
commit ae0eaf7297
2 changed files with 10 additions and 2 deletions

View file

@ -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" 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 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 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) 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 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 cooker_repository_name="Cooker" # The name of the cooker repository under RetroDECK organization

View file

@ -70,6 +70,15 @@ build_preset_list_options() {
make_preset_changes() { 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 # 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" IFS="," read -ra choices <<< "$choice"
for emulator in "${all_systems[@]}"; do for emulator in "${all_systems[@]}"; do
if [[ " ${choices[*]} " =~ " ${emulator} " && ! " ${current_enabled_systems[*]} " =~ " ${emulator} " ]]; then if [[ " ${choices[*]} " =~ " ${emulator} " && ! " ${current_enabled_systems[*]} " =~ " ${emulator} " ]]; then
@ -89,7 +98,7 @@ make_preset_changes() {
fi fi
fi fi
fi fi
done < "$incompatible_presets_reference_list" done < "$incompatible_presets"
fi fi
if [[ ! " ${choices[*]} " =~ " ${emulator} " && ! " ${current_disabled_systems[*]} " =~ " ${emulator} " ]]; then if [[ ! " ${choices[*]} " =~ " ${emulator} " && ! " ${current_disabled_systems[*]} " =~ " ${emulator} " ]]; then
changed_systems=("${changed_systems[@]}" "$emulator") changed_systems=("${changed_systems[@]}" "$emulator")