Add network connectivity checks

where applicable
This commit is contained in:
icenine451 2023-03-12 14:21:30 -04:00
parent f2adc9515d
commit 317e9f4e80
3 changed files with 59 additions and 30 deletions

View file

@ -164,16 +164,6 @@ validate_for_chd () {
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 == "KDE" ]]; then
zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
--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!"
}
set_setting_value() {
# Function for editing settings
# USAGE: set_setting_value $setting_file "$setting_name" "$new_setting_value" $system $section_name(optional)
@ -954,7 +944,11 @@ cli_emulator_reset() {
case $1 in
"retroarch" )
if [[ check_network_connectivity == "true" ]]; then
ra_init
else
printf "You do not appear to be connected to a network with internet access.\n\nThe RetroArch reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available.\n"
fi
;;
"citra" )
citra_init
@ -981,14 +975,22 @@ cli_emulator_reset() {
rpcs3_init
;;
"xemu" )
if [[ check_network_connectivity == "true" ]]; then
xemu_init
else
printf "You do not appear to be connected to a network with internet access.\n\nThe Xemu reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available.\n"
fi
;;
"yuzu" )
yuzu_init
;;
"all-emulators" )
if [[ check_network_connectivity == "true" ]]; then
ra_init
standalones_init
else
printf "You do not appear to be connected to a network with internet access.\n\nThe all-emulator reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available.\n"
fi
;;
esac
}
@ -1509,7 +1511,7 @@ configurator_process_complete_dialog() {
configurator_generic_dialog() {
# This dialog is for showing temporary messages before another process happens.
# USAGE: configurator_generid_dialog "info text"
# USAGE: configurator_generic_dialog "info text"
zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Configurator Utility" \
@ -1526,3 +1528,13 @@ configurator_destination_choice_dialog() {
echo $choice
}
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 == "KDE" ]]; then
zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
--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!"
}

View file

@ -132,7 +132,12 @@ then
# if the lock file doesn't exist at all means that it's a fresh install or a triggered reset
else
echo "Lockfile not found"
if [[ check_network_connectivity == "true" ]]; then
finit # Executing First/Force init
else
configurator_generic_dialog "You do not appear to be connected to a network with internet access.\n\nThe initial RetroDECK setup requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available."
exit 1
fi
fi
# Check if running in Desktop mode and warn if true

View file

@ -85,8 +85,13 @@ configurator_reset_dialog() {
case $emulator_to_reset in
"RetroArch" )
if [[ check_network_connectivity == "true" ]]; then
ra_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
else
configurator_generic_dialog "You do not appear to be connected to a network with internet access.\n\nThe RetroArch reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available."
configurator_reset_dialog
fi
;;
"Citra" )
@ -130,8 +135,13 @@ configurator_reset_dialog() {
;;
"XEMU" )
if [[ check_network_connectivity == "true" ]]; then
xemu_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
else
configurator_generic_dialog "You do not appear to be connected to a network with internet access.\n\nThe Xemu reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available."
configurator_reset_dialog
fi
;;
"Yuzu" )
@ -147,9 +157,15 @@ configurator_reset_dialog() {
;;
"Reset All Emulators" )
if [[ check_network_connectivity == "true" ]]; then
ra_init
standalones_init
configurator_process_complete_dialog "resetting all emulators"
else
configurator_generic_dialog "You do not appear to be connected to a network with internet access.\n\nThe all-emulator reset process requires some files from the internet to function properly.\n\nPlease retry this process once a network connection is available."
configurator_reset_dialog
fi
;;
"Reset Tools" )
@ -594,11 +610,7 @@ configurator_move_dialog() {
configurator_welcome_dialog() {
# Clear the variables
source=
destination=
action=
setting=
setting_value=
choice=$(zenity --list --title="RetroDECK Configurator Utility" --cancel-label="Quit" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \