Move presets folder

Make presets engine able to handle changing core RA config
(to apply preset to all cores)
This commit is contained in:
icenine451 2023-05-08 15:20:06 -04:00
parent 592b938c81
commit 3392b1c2be
7 changed files with 16 additions and 4 deletions

View file

@ -0,0 +1,3 @@
config_file_format^retroarch-all
target_file^$raconf
defaults_file^$emuconfigs/retroarch/retroarch.cfg

View file

@ -1,6 +1,6 @@
config_file_format^retroarch config_file_format^retroarch
target_file^/var/config/retroarch/config/Snes9x/snes.cfg target_file^/var/config/retroarch/config/Snes9x/snes.cfg
defaults_file^$raconf defaults_file^$emuconfigs/retroarch/retroarch.cfg
change^cheevos^cheevos_enable^true change^cheevos^cheevos_enable^true
change^cheevos^cheevos_token^$cheevos_token change^cheevos^cheevos_token^$cheevos_token
change^cheevos^cheevos_username^$cheevos_username change^cheevos^cheevos_username^$cheevos_username

View file

@ -553,6 +553,9 @@ enable_file() {
} }
build_preset_config(){ build_preset_config(){
# This function will apply one or more presets for a given system, as listed in retrodeck.cfg
# USAGE: build_preset_config "system name" "preset class 1" "preset class 2" "preset class 3"
local system_being_changed="$1" local system_being_changed="$1"
shift shift
local presets_being_changed="$*" local presets_being_changed="$*"
@ -593,7 +596,7 @@ build_preset_config(){
if [[ "$new_setting_value" = \$* ]]; then if [[ "$new_setting_value" = \$* ]]; then
eval new_setting_value=$new_setting_value eval new_setting_value=$new_setting_value
fi fi
if [[ "$read_config_format" == "retroarch" ]]; then # Generate the override file if [[ "$read_config_format" == "retroarch" ]]; then # If this is a RetroArch core, generate the override file
if [[ -z $(grep "$read_setting_name" "$read_target_file") ]]; then if [[ -z $(grep "$read_setting_name" "$read_target_file") ]]; then
if [[ ! -f "$read_target_file" ]]; then if [[ ! -f "$read_target_file" ]]; then
mkdir -p "$(realpath $(dirname "$read_target_file"))" mkdir -p "$(realpath $(dirname "$read_target_file"))"
@ -605,6 +608,9 @@ build_preset_config(){
set_setting_value "$read_target_file" "$read_setting_name" "$new_setting_value" "$read_config_format" "$section" set_setting_value "$read_target_file" "$read_setting_name" "$new_setting_value" "$read_config_format" "$section"
fi fi
else 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" set_setting_value "$read_target_file" "$read_setting_name" "$new_setting_value" "$read_config_format" "$section"
fi fi
else else
@ -619,6 +625,9 @@ build_preset_config(){
fi fi
fi fi
else 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") 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" set_setting_value "$read_target_file" "$read_setting_name" "$default_setting_value" "$read_config_format" "$section"
fi fi
@ -631,7 +640,7 @@ build_preset_config(){
;; ;;
esac esac
done < <(eval cat "$presets_reference_lists_dir/$read_system_name"_presets.cfg) done < <(eval cat "$presets_dir/$read_system_name"_presets.cfg)
fi fi
done < <(printf '%s\n' "$preset_section") done < <(printf '%s\n' "$preset_section")
done done

View file

@ -34,7 +34,7 @@ helper_files_list="$emuconfigs/defaults/retrodeck/reference_lists/helper_files_l
rd_appdata="/app/share/appdata/net.retrodeck.retrodeck.appdata.xml" # The shipped appdata XML file for this version rd_appdata="/app/share/appdata/net.retrodeck.retrodeck.appdata.xml" # The shipped appdata XML file for this version
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_reference_lists_dir="$emuconfigs/defaults/retrodeck/reference_lists/presets" presets_dir="$emuconfigs/defaults/retrodeck/presets"
incompatible_presets_reference_list="$emuconfigs/defaults/retrodeck/reference_lists/incompatible_presets.cfg" incompatible_presets_reference_list="$emuconfigs/defaults/retrodeck/reference_lists/incompatible_presets.cfg"
# Config files for emulators with single config files # Config files for emulators with single config files