Added confirmations to the CLI reset commands.

This commit is contained in:
icenine451 2023-03-07 11:28:57 -05:00
parent ed07a74b6e
commit f95c3d7b56
2 changed files with 93 additions and 21 deletions

View file

@ -858,6 +858,52 @@ ra_init() {
rm -rfv $rdhome/bios/MSX rm -rfv $rdhome/bios/MSX
} }
cli_emulator_reset() {
# This function will reset one or more emulators from the command line arguments.
# USAGE: cli_emulator_reset $emulator
case $1 in
"retroarch" )
ra_init
;;
"citra" )
citra_init
;;
"dolphin" )
dolphin_init
;;
"duckstation" )
duckstation_init
;;
"melonds" )
melonds_init
;;
"pcsx2" )
pcsx2_init
;;
"ppsspp" )
ppssppsdl_init
;;
"primehack" )
primehack_init
;;
"rpcs3" )
rpcs3_init
;;
"xemu" )
xemu_init
;;
"yuzu" )
yuzu_init
;;
"all-emulators" )
ra_init
standalones_init
;;
esac
}
tools_init() { tools_init() {
rm -rfv /var/config/retrodeck/tools/ rm -rfv /var/config/retrodeck/tools/
mkdir -pv /var/config/retrodeck/tools/ mkdir -pv /var/config/retrodeck/tools/

View file

@ -14,15 +14,14 @@ for i in "$@"; do
flatpak run [FLATPAK-RUN-OPTION] net.retrodeck-retrodeck [ARGUMENTS] flatpak run [FLATPAK-RUN-OPTION] net.retrodeck-retrodeck [ARGUMENTS]
Arguments: Arguments:
-h, --help Print this help -h, --help Print this help
-v, --version Print RetroDECK version -v, --version Print RetroDECK version
--info-msg Print paths and config informations --info-msg Print paths and config informations
--configure Starts the RetroDECK Configurator --configure Starts the RetroDECK Configurator
--compress <file> Compresses target file to .chd format. Supports .cue, .iso and .gdi formats. --compress <file> Compresses target file to .chd format. Supports .cue, .iso and .gdi formats
--reset-all Starts the initial RetroDECK installer (backup your data first!) --reset-emulator <emulator> Reset one or more emulator configs to the default values
--reset-ra Resets RetroArch's config to the default values --reset-tools Reset the RetroDECK Tools section
--reset-sa Reset all standalone emulator configs to the default values --reset-retrodeck Starts the initial RetroDECK installer (backup your data first!)
--reset-tools Recreate the tools section
For flatpak run specific options please run: flatpak run -h For flatpak run specific options please run: flatpak run -h
@ -57,21 +56,48 @@ https://retrodeck.net
sh /var/config/retrodeck/tools/configurator.sh sh /var/config/retrodeck/tools/configurator.sh
exit exit
;; ;;
--reset-ra*) --reset-emulator*)
ra_init echo "You are about to reset one or more RetroDECK emulators."
shift # Continue launch after previous command is finished echo "Available options are: retroarch citra dolphin duckstation melonds pcsx2 ppsspp primehack rpcs3 xemu yuzu all-emulators"
;; read -p "Please enter the emulator you would like to reset: " emulator
--reset-sa*) if [[ "$emulator" =~ ^(retroarch|citra|dolphin|duckstation|melonds|pcsx2|ppsspp|primehack|rpcs3|xemu|yuzu|all-emulators)$ ]]; then
standalones_init read -p "You are about to reset $emulator to default settings. Press 'y' to continue, 'n' to stop: " response
shift # Continue launch after previous command is finished if [[ $response == [yY] ]]; then
cli_emulator_reset $emulator
read -p "The process has been completed, press any key to start RetroDECK."
shift # Continue launch after previous command is finished
else
read -p "The process has been cancelled, press any key to exit."
exit
fi
else
echo "$emulator is not a valid selection, exiting..."
exit
fi
;; ;;
--reset-tools*) --reset-tools*)
tools_init echo "You are about to reset the RetroDECK tools."
shift # Continue launch after previous command is finished read -p "Press 'y' to continue, 'n' to stop: " response
if [[ $response == [yY] ]]; then
tools_init
read -p "The process has been completed, press any key to start RetroDECK."
shift # Continue launch after previous command is finished
else
read -p "The process has been cancelled, press any key to exit."
exit
fi
;; ;;
--reset-all*) --reset-retrodeck*)
rm -f "$lockfile" echo "You are about to reset RetroDECK completely."
shift # Continue launch after previous command is finished read -p "Press 'y' to continue, 'n' to stop: " response
if [[ $response == [yY] ]]; then
rm -f "$lockfile"
read -p "The process has been completed, press any key to start RetroDECK."
shift # Continue launch after previous command is finished
else
read -p "The process has been cancelled, press any key to exit."
exit
fi
;; ;;
-*|--*) -*|--*)
echo "Unknown option $i" echo "Unknown option $i"