From bec4b18babf3754926835a17b278e50b9da76333 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Wed, 10 May 2023 14:44:51 -0400 Subject: [PATCH 1/7] Safer eval use / handle preset systems with spaces --- functions.sh | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/functions.sh b/functions.sh index 9af45dcf..f9d56138 100644 --- a/functions.sh +++ b/functions.sh @@ -348,7 +348,7 @@ set_setting_value() { else sed -i '\^\['"$current_section_name"'\]^,\^\^'"$setting_name_to_change"'=^s^\^'"$setting_name_to_change"'=.*^'"$setting_name_to_change"'='"$setting_value_to_change"'^' $1 fi - if [[ "$4" == "retrodeck" ]]; then # If a RetroDECK setting is being changed, also write it to memory for immediate use + if [[ "$4" == "retrodeck" && ("$current_section_name" == "" || "$current_section_name" == "paths" || "$current_section_name" == "options") ]]; then # If a RetroDECK setting is being changed, also write it to memory for immediate use eval "$setting_name_to_change=$setting_value_to_change" fi ;; @@ -663,7 +663,7 @@ build_preset_config(){ ;; esac - done < <(eval cat "$presets_dir/$read_system_name"_presets.cfg) + done < <(cat "$presets_dir/$read_system_name"_presets.cfg) fi done < <(printf '%s\n' "$preset_section") done @@ -793,15 +793,15 @@ do ;; "add_setting_line" ) - eval add_setting_line $3 "$setting_name" $system_name $current_section + add_setting_line $3 "$setting_name" $system_name $current_section ;; "disable_setting" ) - eval disable_setting $3 "$setting_name" $system_name $current_section + disable_setting $3 "$setting_name" $system_name $current_section ;; "enable_setting" ) - eval enable_setting $3 "$setting_name" $system_name $current_section + enable_setting $3 "$setting_name" $system_name $current_section ;; "change" ) @@ -835,23 +835,38 @@ do case $action in "disable_file" ) - eval disable_file "$config_file" + if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name + eval config_file="$config_file" + fi + disable_file "$config_file" ;; "enable_file" ) - eval enable_file "$config_file" + if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name + eval config_file="$config_file" + fi + enable_file "$config_file" ;; "add_setting_line" ) - eval add_setting_line "$config_file" "$setting_name" $system_name $current_section + if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name + eval config_file="$config_file" + fi + add_setting_line "$config_file" "$setting_name" $system_name $current_section ;; "disable_setting" ) - eval disable_setting "$config_file" "$setting_name" $system_name $current_section + if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name + eval config_file="$config_file" + fi + disable_setting "$config_file" "$setting_name" $system_name $current_section ;; "enable_setting" ) - eval enable_setting "$config_file" "$setting_name" $system_name $current_section + if [[ "$config_file" = \$* ]]; then # If patch setting value is a reference to an internal variable name + eval config_file="$config_file" + fi + enable_setting "$config_file" "$setting_name" $system_name $current_section ;; "change" ) From c3a4e752b23c051e8ebc5c636c7a0e1c9b09afa4 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Wed, 10 May 2023 15:14:16 -0400 Subject: [PATCH 2/7] Move PPSSPP saves/states to correct locations --- functions.sh | 5 +++++ post_update.sh | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/functions.sh b/functions.sh index f9d56138..99c2d9f2 100644 --- a/functions.sh +++ b/functions.sh @@ -1762,9 +1762,14 @@ prepare_emulator() { cp -fv "$emuconfigs/ppssppsdl/"* /var/config/ppsspp/PSP/SYSTEM/ set_setting_value "$ppssppconf" "CurrentDirectory" "$roms_folder/psp" "ppsspp" "General" fi + # Shared actions + dir_prep "$saves_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/SAVEDATA" + dir_prep "$states_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/PPSSPP_STATE" fi if [[ "$action" == "postmove" ]]; then # Run only post-move commands set_setting_value "$ppssppconf" "CurrentDirectory" "$roms_folder/psp" "ppsspp" "General" + dir_prep "$saves_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/SAVEDATA" + dir_prep "$states_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/PPSSPP_STATE" fi fi diff --git a/post_update.sh b/post_update.sh index dc038419..2738c929 100644 --- a/post_update.sh +++ b/post_update.sh @@ -78,6 +78,7 @@ post_update() { # - Move Duckstation saves and states to new locations # - Clean up legacy tools files (Configurator is now accessible through the main ES-DE menu) # - Move Dolphin and Primehack save folder names + # - Move PPSSPP saves/states to appropriate folders update_rd_conf # Expand retrodeck.cfg to latest template set_setting_value $rd_conf "screenshots_folder" "$rdhome/screenshots" @@ -163,6 +164,9 @@ post_update() { dir_prep "$saves_folder/gc/primehack/EU" "/var/data/primehack/GC/EUR" dir_prep "$saves_folder/gc/primehack/US" "/var/data/primehack/GC/USA" dir_prep "$saves_folder/gc/primehack/JP" "/var/data/primehack/GC/JAP" + + dir_prep "$saves_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/SAVEDATA" + dir_prep "$states_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/PPSSPP_STATE" fi # The following commands are run every time. From bfbaf662eed396b8224810b93d94b76ce9902ecd Mon Sep 17 00:00:00 2001 From: icenine451 Date: Wed, 10 May 2023 15:38:22 -0400 Subject: [PATCH 3/7] Set ESDE themes folder location directly --- es-configs/es_settings.xml | 3 ++- functions.sh | 4 ++-- post_update.sh | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/es-configs/es_settings.xml b/es-configs/es_settings.xml index 0b8ab539..9364318d 100644 --- a/es-configs/es_settings.xml +++ b/es-configs/es_settings.xml @@ -106,7 +106,7 @@ - + @@ -142,3 +142,4 @@ + diff --git a/functions.sh b/functions.sh index 99c2d9f2..26d1edb6 100644 --- a/functions.sh +++ b/functions.sh @@ -1423,15 +1423,15 @@ prepare_emulator() { update_splashscreens dir_prep "$roms_folder" "/var/config/emulationstation/ROMs" dir_prep "$media_folder" "/var/config/emulationstation/.emulationstation/downloaded_media" - dir_prep "$themes_folder" "/var/config/emulationstation/.emulationstation/themes" dir_prep "$rdhome/gamelists" "/var/config/emulationstation/.emulationstation/gamelists" cp -f /app/retrodeck/es_settings.xml /var/config/emulationstation/.emulationstation/es_settings.xml + set_setting_value "es_settings.xml" "UserThemeDirectory" "$themes_folder" "es_settings" fi if [[ "$action" == "postmove" ]]; then dir_prep "$roms_folder" "/var/config/emulationstation/ROMs" dir_prep "$media_folder" "/var/config/emulationstation/.emulationstation/downloaded_media" - dir_prep "$themes_folder" "/var/config/emulationstation/.emulationstation/themes" dir_prep "$rdhome/gamelists" "/var/config/emulationstation/.emulationstation/gamelists" + set_setting_value "es_settings.xml" "UserThemeDirectory" "$themes_folder" "es_settings" fi fi diff --git a/post_update.sh b/post_update.sh index 2738c929..357f531b 100644 --- a/post_update.sh +++ b/post_update.sh @@ -79,6 +79,7 @@ post_update() { # - Clean up legacy tools files (Configurator is now accessible through the main ES-DE menu) # - Move Dolphin and Primehack save folder names # - Move PPSSPP saves/states to appropriate folders + # - Set ESDE user themes folder directly update_rd_conf # Expand retrodeck.cfg to latest template set_setting_value $rd_conf "screenshots_folder" "$rdhome/screenshots" @@ -167,6 +168,9 @@ post_update() { dir_prep "$saves_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/SAVEDATA" dir_prep "$states_folder/PSP/PPSSPP-SA" "/var/config/ppsspp/PSP/PPSSPP_STATE" + + set_setting_value "es_settings.xml" "UserThemeDirectory" "$themes_folder" "es_settings" + unlink "/var/config/emulationstation/.emulationstation/themes" fi # The following commands are run every time. From 58b62248bbbc869e5b6fedd82c0f33a4a4e4d161 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Wed, 10 May 2023 16:01:44 -0400 Subject: [PATCH 4/7] Add nightly SameDuck core to RA --- automation_tools/automation_task_list.cfg | 1 + net.retrodeck.retrodeck.yml | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/automation_tools/automation_task_list.cfg b/automation_tools/automation_task_list.cfg index 2c28ed28..cd5908d4 100644 --- a/automation_tools/automation_task_list.cfg +++ b/automation_tools/automation_task_list.cfg @@ -3,5 +3,6 @@ hash^DOOMSHAPLACEHOLDER^https://buildbot.libretro.com/assets/cores/DOOM/Doom%20%28Shareware%29.zip hash^VITASHAPLACEHOLDER^https://github.com/Vita3K/Vita3K/releases/download/continuous/ubuntu-latest.zip hash^DUCKSTATIONSHAPLACEHOLDER^https://github.com/stenzek/duckstation/releases/download/preview/DuckStation-x64.AppImage +hash^SAMEDUCKSHAPLACEHOLDER^https://buildbot.libretro.com/nightly/linux/x86_64/latest/sameduck_libretro.so.zip latestcommit^UNIVERSALDYNAMICINPUTCOMMITPLACEHOLDER^https://github.com/Venomalia/UniversalDynamicInput^main outside_info^VERSIONPLACEHOLDER^${GITHUB_WORKSPACE}/buildid diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml index cd350d36..e1f3751c 100644 --- a/net.retrodeck.retrodeck.yml +++ b/net.retrodeck.retrodeck.yml @@ -425,6 +425,15 @@ modules: - type: archive url: https://buildbot.libretro.com/stable/1.15.0/linux/x86_64/RetroArch_cores.7z sha256: 2230bc38eaf87406efd0c2b7bdd1cf9e813ba113505600f14a7ef9eb06f8c7c0 + + - name: retroarch-sameduck-core + buildsystem: simple + build-commands: + - mv sameduck_libretro.so /app/share/libretro/cores/sameduck_libretro.so + sources: + - type: archive + url: https://buildbot.libretro.com/nightly/linux/x86_64/latest/sameduck_libretro.so.zip + sha256: SAMEDUCKSHAPLACEHOLDER - name: doom-shareware buildsystem: simple From c35f45c8ed1c8a90ab5e7ed168048677dd4e33c9 Mon Sep 17 00:00:00 2001 From: icenine451 Date: Wed, 10 May 2023 16:39:21 -0400 Subject: [PATCH 5/7] Another attempt at a Configurator desktop entry --- net.retrodeck.retrodeck.Configurator.desktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net.retrodeck.retrodeck.Configurator.desktop b/net.retrodeck.retrodeck.Configurator.desktop index ce38bb89..89c01fff 100644 --- a/net.retrodeck.retrodeck.Configurator.desktop +++ b/net.retrodeck.retrodeck.Configurator.desktop @@ -4,7 +4,7 @@ GenericName=RetroDECK Configuration Utility Type=Application Comment=A handy tool to change common RetroDECK settings Icon=net.retrodeck.retrodeck -Exec=--configurator +Exec=/app/tools/configurator.sh Terminal=false StartupNotify=false Keywords=multi;engine;emulator;standalone;steam;deck From 827426ad77257c18032182dd0aacc0ab16019fab Mon Sep 17 00:00:00 2001 From: icenine451 Date: Wed, 10 May 2023 16:42:12 -0400 Subject: [PATCH 6/7] Keep Configurator open after opening a SA emu --- tools/configurator.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/configurator.sh b/tools/configurator.sh index 1ea88c00..337167c4 100644 --- a/tools/configurator.sh +++ b/tools/configurator.sh @@ -457,6 +457,8 @@ configurator_open_emulator_dialog() { ;; esac + + configurator_open_emulator_dialog } configurator_retrodeck_tools_dialog() { From 122f70614e920cc8531e52e8769989d7072ae7ea Mon Sep 17 00:00:00 2001 From: icenine451 Date: Wed, 10 May 2023 17:02:19 -0400 Subject: [PATCH 7/7] Abstract desktop mode check Fix unintentional Configurator closure --- functions.sh | 93 ++++++++++++++++++++++++------------------- tools/configurator.sh | 1 + 2 files changed, 52 insertions(+), 42 deletions(-) diff --git a/functions.sh b/functions.sh index 26d1edb6..7edf9da7 100644 --- a/functions.sh +++ b/functions.sh @@ -290,48 +290,6 @@ cli_compress_all_games() { done < <(printf '%s\n' "$compressable_systems_list") } -desktop_mode_warning() { - # This function is a generic warning for issues that happen when running in desktop mode. - # Running in desktop mode can be verified with the following command: if [[ ! $XDG_CURRENT_DESKTOP == "gamescope" ]]; then - # This function will check if desktop mode is currently being used and if the warning has not been disabled, and show it if needed. - # USAGE: desktop_mode_warning - - if [[ ! $XDG_CURRENT_DESKTOP == "gamescope" ]]; then - if [[ $desktop_mode_warning == "true" ]]; then - choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="Never show this again" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Desktop Mode Warning" \ - --text="You appear to be running RetroDECK in the Steam Deck's Desktop mode!\n\nSome functions of RetroDECK may not work properly in Desktop mode, such as the Steam Deck's normal controls.\n\nRetroDECK is best enjoyed in Game mode!\n\nDo you still want to proceed?") - rc=$? # Capture return code, as "Yes" button has no text value - if [[ $rc == "1" ]]; then # If any button other than "Yes" was clicked - if [[ $choice == "No" ]]; then - exit 1 - elif [[ $choice == "Never show this again" ]]; then - set_setting_value $rd_conf "desktop_mode_warning" "false" retrodeck "options" # Store desktop mode warning variable for future checks - fi - fi - fi - fi -} - -low_space_warning() { - # This function will verify that the drive with the $HOME path on it has at least 10% space free, so the user can be warned before it fills up - # USAGE: low_space_warning - - if [[ $low_space_warning == "true" ]]; then - local used_percent=$(df --output=pcent "$HOME" | tail -1 | tr -d " " | tr -d "%") - if [[ "$used_percent" -ge 90 && -d "$HOME/retrodeck" ]]; then # If there is any RetroDECK data on the main drive to move - choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="OK" --extra-button="Never show this again" \ - --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ - --title "RetroDECK Low Space Warning" \ - --text="Your main drive is over 90% full!\n\nIf your drive fills completely this can lead to data loss or system crash.\n\nPlease consider moving some RetroDECK folders to other storage locations using the Configurator.") - if [[ $choice == "Never show this again" ]]; then - set_setting_value $rd_conf "low_space_warning" "false" retrodeck "options" # Store low space warning variable for future checks - fi - fi - fi -} - set_setting_value() { # Function for editing settings # USAGE: set_setting_value $setting_file "$setting_name" "$new_setting_value" $system $section_name(optional) @@ -901,6 +859,17 @@ check_network_connectivity() { fi } +check_desktop_mode() { + # This function will do a basic check of if we are running in Steam Deck game mode or not, and return "true" if we are outside of game mode + # USAGE: if [[ $(check_desktop_mode) == "true" ]]; then + + if [[ ! $XDG_CURRENT_DESKTOP == "gamescope" ]]; then + echo "true" + else + echo "false" + fi +} + check_for_version_update() { # This function will perform a basic online version check and alert the user if there is a new version available. @@ -2678,3 +2647,43 @@ change_preset_dialog() { echo "No choices made" fi } + +desktop_mode_warning() { + # This function is a generic warning for issues that happen when running in desktop mode. + # Running in desktop mode can be verified with the following command: if [[ ! $XDG_CURRENT_DESKTOP == "gamescope" ]]; then + # This function will check if desktop mode is currently being used and if the warning has not been disabled, and show it if needed. + # USAGE: desktop_mode_warning + + if [[ $(check_desktop_mode) == "true" && $desktop_mode_warning == "true" ]]; then + choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="Never show this again" \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Desktop Mode Warning" \ + --text="You appear to be running RetroDECK in the Steam Deck's Desktop mode!\n\nSome functions of RetroDECK may not work properly in Desktop mode, such as the Steam Deck's normal controls.\n\nRetroDECK is best enjoyed in Game mode!\n\nDo you still want to proceed?") + rc=$? # Capture return code, as "Yes" button has no text value + if [[ $rc == "1" ]]; then # If any button other than "Yes" was clicked + if [[ $choice == "No" ]]; then + exit 1 + elif [[ $choice == "Never show this again" ]]; then + set_setting_value $rd_conf "desktop_mode_warning" "false" retrodeck "options" # Store desktop mode warning variable for future checks + fi + fi + fi +} + +low_space_warning() { + # This function will verify that the drive with the $HOME path on it has at least 10% space free, so the user can be warned before it fills up + # USAGE: low_space_warning + + if [[ $low_space_warning == "true" ]]; then + local used_percent=$(df --output=pcent "$HOME" | tail -1 | tr -d " " | tr -d "%") + if [[ "$used_percent" -ge 90 && -d "$HOME/retrodeck" ]]; then # If there is any RetroDECK data on the main drive to move + choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="OK" --extra-button="Never show this again" \ + --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ + --title "RetroDECK Low Space Warning" \ + --text="Your main drive is over 90% full!\n\nIf your drive fills completely this can lead to data loss or system crash.\n\nPlease consider moving some RetroDECK folders to other storage locations using the Configurator.") + if [[ $choice == "Never show this again" ]]; then + set_setting_value $rd_conf "low_space_warning" "false" retrodeck "options" # Store low space warning variable for future checks + fi + fi + fi +} diff --git a/tools/configurator.sh b/tools/configurator.sh index 337167c4..a97238c7 100644 --- a/tools/configurator.sh +++ b/tools/configurator.sh @@ -1012,6 +1012,7 @@ configurator_about_retrodeck_dialog() { --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --title "RetroDECK Credits" \ --filename="$emuconfigs/defaults/retrodeck/reference_lists/retrodeck_credits.txt" + configurator_about_retrodeck_dialog ;; "" ) # No selection made or Back button clicked