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" )
ra_init
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" )
xemu_init
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" )
ra_init
standalones_init
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" \
@ -1525,4 +1527,14 @@ configurator_destination_choice_dialog() {
--text="$2")
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

@ -58,7 +58,7 @@ https://retrodeck.net
fi
else
echo "Please use this command format \"--compress <cue/gdi/iso file to compress>\""
fi
fi
exit
;;
--configurator*)
@ -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"
finit # Executing First/Force init
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" )
ra_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
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" )
xemu_init
configurator_process_complete_dialog "resetting $emulator_to_reset"
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" )
ra_init
standalones_init
configurator_process_complete_dialog "resetting 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" )
@ -367,7 +383,7 @@ configurator_compress_single_game_dialog() {
configurator_compress_games_dialog() {
# This is currently a placeholder for a dialog where you can compress a single game or multiple at once. Currently only the single game option is available, so is launched by default.
configurator_generic_dialog "This utility will compress a single game into .CHD format.\n\nPlease select the game to be compressed in the next dialog: supported file types are .cue, .iso and .gdi\n\nThe original game files will be untouched and will need to be removed manually."
configurator_compress_single_game_dialog
}
@ -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 \