|
|
|
@ -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)
|
|
|
|
@ -348,7 +306,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 +621,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 +751,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 +793,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" )
|
|
|
|
@ -886,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.
|
|
|
|
|
|
|
|
|
@ -1408,15 +1392,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
|
|
|
|
|
|
|
|
|
@ -1747,9 +1731,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
|
|
|
|
|
|
|
|
|
@ -2658,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
|
|
|
|
|
}
|
|
|
|
|