Correct some calls to xmlstarlet

Add Cemu to get_setting_value and set_setting_value
Update Cemu prepare_emulator content
Prepare and add savestate_auto_load and savestate_auto_save presets
This commit is contained in:
icenine451 2023-05-16 12:29:36 -04:00
parent fbd0deae99
commit 8e5e950841
13 changed files with 72 additions and 24 deletions

View file

@ -18,7 +18,7 @@ EnableWideScreenPatches = false
EnableNoInterlacingPatches = false EnableNoInterlacingPatches = false
EnableRecordingTools = true EnableRecordingTools = true
EnableGameFixes = true EnableGameFixes = true
SaveStateOnShutdown = true SaveStateOnShutdown = false
ConsoleToStdio = false ConsoleToStdio = false
HostFs = false HostFs = false
PatchBios = false PatchBios = false

View file

@ -4,5 +4,6 @@ defaults_file^$emuconfigs/duckstation/settings.ini
change^cheevos^Enabled^true^Cheevos change^cheevos^Enabled^true^Cheevos
change^cheevos^Username^$cheevos_username^Cheevos change^cheevos^Username^$cheevos_username^Cheevos
change^cheevos^Token^$cheevos_token^Cheevos change^cheevos^Token^$cheevos_token^Cheevos
change^cheevos^LoginTimestamp^$cheevos_login_timestamp change^cheevos^LoginTimestamp^$cheevos_login_timestamp^Cheevos
change^cheevos_hardcore^ChallengeMode^true change^cheevos_hardcore^ChallengeMode^true^Cheevos
change^savestate_auto_save^SaveStateOnExit^true^Main

View file

@ -4,5 +4,6 @@ defaults_file^$emuconfigs/PCSX2/PCSX2.ini
change^cheevos^Enabled^true^Achievements change^cheevos^Enabled^true^Achievements
change^cheevos^Username^$cheevos_username^Achievements change^cheevos^Username^$cheevos_username^Achievements
change^cheevos^Token^$cheevos_token^Achievements change^cheevos^Token^$cheevos_token^Achievements
change^cheevos^LoginTimestamp^$cheevos_login_timestamp change^cheevos^LoginTimestamp^$cheevos_login_timestamp^Achievements
change^cheevos_hardcore^ChallengeMode^true change^cheevos_hardcore^ChallengeMode^true^Achievements
change^savestate_auto_save^SaveStateOnShutdown^true^EmuCore

View file

@ -5,3 +5,5 @@ 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
change^cheevos_hardcore^cheevos_hardcore_mode_enable^true change^cheevos_hardcore^cheevos_hardcore_mode_enable^true
change^savestate_auto_load^savestate_auto_load^true
change^savestate_auto_save^savestate_auto_save^true

View file

@ -60,3 +60,11 @@ gba=false
gbc=false gbc=false
n64=false n64=false
snes=false snes=false
[savestate_auto_load]
retroarch=true
[savestate_auto_save]
duckstation=true
pcsx2=true
retroarch=true

View file

@ -10,7 +10,7 @@ StartPaused = false
StartFullscreen = false StartFullscreen = false
PauseOnFocusLoss = true PauseOnFocusLoss = true
PauseOnMenu = true PauseOnMenu = true
SaveStateOnExit = true SaveStateOnExit = false
ConfirmPowerOff = true ConfirmPowerOff = true
LoadDevicesFromSaveStates = true LoadDevicesFromSaveStates = true
ApplyGameSettings = true ApplyGameSettings = true

View file

@ -3090,8 +3090,8 @@ save_file_compression = "false"
savefile_directory = "RETRODECKHOMEDIR/saves" savefile_directory = "RETRODECKHOMEDIR/saves"
savefiles_in_content_dir = "false" savefiles_in_content_dir = "false"
savestate_auto_index = "false" savestate_auto_index = "false"
savestate_auto_load = "true" savestate_auto_load = "false"
savestate_auto_save = "true" savestate_auto_save = "false"
savestate_directory = "RETRODECKHOMEDIR/states" savestate_directory = "RETRODECKHOMEDIR/states"
savestate_file_compression = "true" savestate_file_compression = "true"
savestate_max_keep = "0" savestate_max_keep = "0"

View file

@ -160,7 +160,7 @@ changelog_dialog() {
# USAGE: changelog_dialog "version" # USAGE: changelog_dialog "version"
if [[ "$1" == "all" ]]; then if [[ "$1" == "all" ]]; then
xmlstarlet sel -t -m "//release" -v "concat('RetroDECK version: ', @version)" -n -v "description" -n $rd_appdata | awk '{$1=$1;print}' | sed -e '/./b' -e :n -e 'N;s/\n$//;tn' > "/var/config/retrodeck/changelog.txt" xml sel -t -m "//release" -v "concat('RetroDECK version: ', @version)" -n -v "description" -n $rd_appdata | awk '{$1=$1;print}' | sed -e '/./b' -e :n -e 'N;s/\n$//;tn' > "/var/config/retrodeck/changelog.txt"
zenity --icon-name=net.retrodeck.retrodeck --text-info --width=1200 --height=720 \ zenity --icon-name=net.retrodeck.retrodeck --text-info --width=1200 --height=720 \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \

View file

@ -49,7 +49,6 @@ pretty_system_names_reference_list="$emuconfigs/defaults/retrodeck/reference_lis
# Config files for emulators with single config files # Config files for emulators with single config files
cemuconf="/var/config/Cemu/settings.xml"
citraconf="/var/config/citra-emu/qt-config.ini" citraconf="/var/config/citra-emu/qt-config.ini"
duckstationconf="/var/config/duckstation/settings.ini" duckstationconf="/var/config/duckstation/settings.ini"
melondsconf="/var/config/melonDS/melonDS.ini" melondsconf="/var/config/melonDS/melonDS.ini"
@ -67,6 +66,11 @@ es_settings="/var/config/emulationstation/.emulationstation/es_settings.xml"
raconf="/var/config/retroarch/retroarch.cfg" raconf="/var/config/retroarch/retroarch.cfg"
ra_core_conf="/var/config/retroarch/retroarch-core-options.cfg" ra_core_conf="/var/config/retroarch/retroarch-core-options.cfg"
# CEMU config files
cemuconf="/var/config/Cemu/settings.xml"
cemucontrollerconf="/var/config/Cemu/controllerProfiles/controller0.xml"
# Dolphin config files # Dolphin config files
dolphinconf="/var/config/dolphin-emu/Dolphin.ini" dolphinconf="/var/config/dolphin-emu/Dolphin.ini"

View file

@ -45,6 +45,14 @@ set_setting_value() {
fi fi
;; ;;
"cemu" )
if [[ -z "$current_section_name" ]]; then
xml ed -L -u "//$setting_name_to_change" -v "$setting_value_to_change" "$1"
else
xml ed -L -u "//$current_section_name/$setting_name_to_change" -v "$setting_value_to_change" "$1"
fi
;;
"es_settings" ) "es_settings" )
sed -i 's^'"$setting_name_to_change"'" value=".*"^'"$setting_name_to_change"'" value="'"$setting_value_to_change"'"^' $1 sed -i 's^'"$setting_name_to_change"'" value=".*"^'"$setting_name_to_change"'" value="'"$setting_value_to_change"'"^' $1
;; ;;
@ -116,6 +124,14 @@ get_setting_value() {
fi fi
;; ;;
"cemu" )
if [[ -z "$current_section_name" ]]; then
echo $(xml sel -t -v "//$current_setting_name" $1)
else
echo $(xml sel -t -v "//$current_section_name/$current_setting_name" $1)
fi
;;
"es_settings" ) "es_settings" )
echo $(grep -o -P "(?<=$current_setting_name\" value=\").*(?=\")" $1) echo $(grep -o -P "(?<=$current_setting_name\" value=\").*(?=\")" $1)
;; ;;

View file

@ -82,6 +82,8 @@ post_update() {
# - Move Dolphin and Primehack save folder names # - Move Dolphin and Primehack save folder names
# - Move PPSSPP saves/states to appropriate folders # - Move PPSSPP saves/states to appropriate folders
# - Set ESDE user themes folder directly # - Set ESDE user themes folder directly
# - Disable auto-save/load in RA / PCSX2 / Duckstation for proper preset functionality
# - Init Cemu as it is a new emulator
update_rd_conf # Expand retrodeck.cfg to latest template update_rd_conf # Expand retrodeck.cfg to latest template
set_setting_value $rd_conf "screenshots_folder" "$rdhome/screenshots" set_setting_value $rd_conf "screenshots_folder" "$rdhome/screenshots"
@ -184,6 +186,13 @@ post_update() {
unlink "/var/config/emulationstation/ROMs" unlink "/var/config/emulationstation/ROMs"
unlink "/var/config/emulationstation/.emulationstation/downloaded_media" unlink "/var/config/emulationstation/.emulationstation/downloaded_media"
unlink "/var/config/emulationstation/.emulationstation/themes" unlink "/var/config/emulationstation/.emulationstation/themes"
set_setting_value "$raconf" "savestate_auto_load" "false" "retroarch"
set_setting_value "$raconf" "savestate_auto_save" "false" "retroarch"
set_setting_value "$pcsx2conf" "SaveStateOnShutdown" "false" "pcsx2" "EmuCore"
set_setting_value "$duckstationconf" "SaveStateOnExit" "false" "duckstation" "Main"
prepare_emulator "reset" "cemu"
fi fi
# The following commands are run every time. # The following commands are run every time.

View file

@ -136,21 +136,28 @@ prepare_emulator() {
echo "----------------------" echo "----------------------"
echo "Initializing CEMU" echo "Initializing CEMU"
echo "----------------------" echo "----------------------"
rm -rf /var/config/Cemu if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
mkdir -pv /var/config/Cemu/ rm -rf "$multi_user_data_folder/$SteamAppUser/config/Cemu"
cp -fr "$emuconfigs/cemu/"* /var/config/Cemu/ mkdir -p "$multi_user_data_folder/$SteamAppUser/config/Cemu"
#TODO : set_setting_value for Cemu and multi_user cp -fr "$emuconfigs/cemu/"* "$multi_user_data_folder/$SteamAppUser/config/Cemu/"
sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/Cemu/settings.xml set_setting_value "$multi_user_data_folder/$SteamAppUser/config/Cemu/settings.ini" "mlc_path" "$bios_folder/cemu" "cemu"
dir_prep "$rdhome/saves/wiiu/cemu" "$rdhome/bios/cemu/usr/save" set_setting_value "$multi_user_data_folder/$SteamAppUser/config/Cemu/settings.ini" "Entry" "$roms_folder/wiiu" "cemu" "GamePaths"
dir_prep "$multi_user_data_folder/$SteamAppUser/config/Cemu" "/var/config/Cemu"
else
rm -rf /var/config/Cemu
mkdir -pv /var/config/Cemu/
cp -fr "$emuconfigs/cemu/"* /var/config/Cemu/
set_setting_value "$multi_user_data_folder/$SteamAppUser/config/Cemu/settings.ini" "mlc_path" "$bios_folder/cemu" "cemu"
set_setting_value "$multi_user_data_folder/$SteamAppUser/config/Cemu/settings.ini" "Entry" "$roms_folder/wiiu" "cemu" "GamePaths"
fi
# Shared actions
dir_prep "$saves_folder/wiiu/cemu" "$bios_folder/cemu/usr/save"
fi fi
if [[ "$action" == "reset" ]] || [[ "$action" == "postmove" ]]; then # Run commands that apply to both resets and moves if [[ "$action" == "postmove" ]]; then # Run commands that apply to both resets and moves
#TODO : set_setting_value for Cemu and multi_user set_setting_value "$cemuconf" "mlc_path" "$bios_folder/cemu" "cemu"
sed -i 's#RETRODECKHOMEDIR#'$rdhome'#g' /var/config/Cemu/settings.xml set_setting_value "$cemuconf" "Entry" "$roms_folder/wiiu" "cemu" "GamePaths"
dir_prep "$rdhome/saves/wiiu/cemu" "$rdhome/bios/cemu/usr/save" dir_prep "$saves_folder/wiiu/cemu" "$bios_folder/cemu/usr/save"
fi fi
# if [[ "$action" == "postmove" ]]; then # Run only post-move commands
# fi
fi fi
if [[ "$emulator" =~ ^(citra|citra-emu|Citra|all)$ ]]; then if [[ "$emulator" =~ ^(citra|citra-emu|Citra|all)$ ]]; then

View file

@ -1045,7 +1045,7 @@ configurator_about_retrodeck_dialog() {
} }
configurator_version_history_dialog() { configurator_version_history_dialog() {
local version_array=($(xmlstarlet sel -t -v '//component/releases/release/@version' -n $rd_appdata)) local version_array=($(xml sel -t -v '//component/releases/release/@version' -n $rd_appdata))
local all_versions_list=() local all_versions_list=()
for rd_version in ${version_array[*]}; do for rd_version in ${version_array[*]}; do