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
}
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() {
rm -rfv /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]
Arguments:
-h, --help Print this help
-v, --version Print RetroDECK version
--info-msg Print paths and config informations
--configure Starts the RetroDECK Configurator
--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-ra Resets RetroArch's config to the default values
--reset-sa Reset all standalone emulator configs to the default values
--reset-tools Recreate the tools section
-h, --help Print this help
-v, --version Print RetroDECK version
--info-msg Print paths and config informations
--configure Starts the RetroDECK Configurator
--compress <file> Compresses target file to .chd format. Supports .cue, .iso and .gdi formats
--reset-emulator <emulator> Reset one or more emulator configs to the default values
--reset-tools Reset the RetroDECK Tools section
--reset-retrodeck Starts the initial RetroDECK installer (backup your data first!)
For flatpak run specific options please run: flatpak run -h
@ -57,21 +56,48 @@ https://retrodeck.net
sh /var/config/retrodeck/tools/configurator.sh
exit
;;
--reset-ra*)
ra_init
shift # Continue launch after previous command is finished
;;
--reset-sa*)
standalones_init
shift # Continue launch after previous command is finished
--reset-emulator*)
echo "You are about to reset one or more RetroDECK emulators."
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
if [[ "$emulator" =~ ^(retroarch|citra|dolphin|duckstation|melonds|pcsx2|ppsspp|primehack|rpcs3|xemu|yuzu|all-emulators)$ ]]; then
read -p "You are about to reset $emulator to default settings. Press 'y' to continue, 'n' to stop: " response
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*)
tools_init
shift # Continue launch after previous command is finished
echo "You are about to reset the RetroDECK tools."
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*)
rm -f "$lockfile"
shift # Continue launch after previous command is finished
--reset-retrodeck*)
echo "You are about to reset RetroDECK completely."
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"