FRAMEWORK: prepare_emulator is now prepare_component

This commit is contained in:
XargonWan 2024-01-16 09:14:27 +01:00
parent 33e7760ea9
commit da9c237f2e
8 changed files with 69 additions and 69 deletions

View file

@ -118,9 +118,9 @@ configurator_move_folder_dialog() {
if [[ -d "$dest_root/$rd_dir_path" ]]; then # If the move succeeded if [[ -d "$dest_root/$rd_dir_path" ]]; then # If the move succeeded
declare -g "$rd_dir_name=$dest_root/$rd_dir_path" # Set the new path for that folder variable in retrodeck.cfg declare -g "$rd_dir_name=$dest_root/$rd_dir_path" # Set the new path for that folder variable in retrodeck.cfg
if [[ "$rd_dir_name" == "rdhome" ]]; then # If the whole retrodeck folder was moved... if [[ "$rd_dir_name" == "rdhome" ]]; then # If the whole retrodeck folder was moved...
prepare_emulator "postmove" "retrodeck" prepare_component "postmove" "retrodeck"
fi fi
prepare_emulator "postmove" "all" # Update all the appropriate emulator path settings prepare_component "postmove" "all" # Update all the appropriate emulator path settings
conf_write # Write the settings to retrodeck.cfg conf_write # Write the settings to retrodeck.cfg
if [[ -z $(ls -1 "$source_root/retrodeck") ]]; then # Cleanup empty old_path/retrodeck folder if it was left behind if [[ -z $(ls -1 "$source_root/retrodeck") ]]; then # Cleanup empty old_path/retrodeck folder if it was left behind
rmdir "$source_root/retrodeck" rmdir "$source_root/retrodeck"
@ -150,7 +150,7 @@ configurator_move_folder_dialog() {
configurator_generic_dialog "RetroDECK Configurator - Move Folder" "The $(basename $dir_to_move) folder was not found at the expected location.\n\nThis may have happened if the folder was moved manually.\n\nPlease select the current location of the folder." configurator_generic_dialog "RetroDECK Configurator - Move Folder" "The $(basename $dir_to_move) folder was not found at the expected location.\n\nThis may have happened if the folder was moved manually.\n\nPlease select the current location of the folder."
dir_to_move=$(directory_browse "RetroDECK $(basename $dir_to_move) directory location") dir_to_move=$(directory_browse "RetroDECK $(basename $dir_to_move) directory location")
declare -g "$rd_dir_name=$dir_to_move" declare -g "$rd_dir_name=$dir_to_move"
prepare_emulator "postmove" "all" prepare_component "postmove" "all"
conf_write conf_write
configurator_generic_dialog "RetroDECK Configurator - Move Folder" "RetroDECK $(basename $dir_to_move) folder now configured at\n$dir_to_move." configurator_generic_dialog "RetroDECK Configurator - Move Folder" "RetroDECK $(basename $dir_to_move) folder now configured at\n$dir_to_move."
configurator_move_folder_dialog "$rd_dir_name" configurator_move_folder_dialog "$rd_dir_name"

View file

@ -404,7 +404,7 @@ finit() {
esac esac
prepare_emulator "reset" "retrodeck" # Parse the [paths] section of retrodeck.cfg and set the value of / create all needed folders prepare_component "reset" "retrodeck" # Parse the [paths] section of retrodeck.cfg and set the value of / create all needed folders
conf_write # Write the new values to retrodeck.cfg conf_write # Write the new values to retrodeck.cfg
@ -420,7 +420,7 @@ finit() {
--text="RetroDECK will now install the needed files, which can take up to one minute.\nRetroDECK will start once the process is completed.\n\nPress OK to continue." --text="RetroDECK will now install the needed files, which can take up to one minute.\nRetroDECK will start once the process is completed.\n\nPress OK to continue."
( (
prepare_emulator "reset" "all" prepare_component "reset" "all"
build_retrodeck_current_presets build_retrodeck_current_presets
deploy_helper_files deploy_helper_files

View file

@ -10,7 +10,7 @@ source /app/libexec/functions.sh
source /app/libexec/multi_user.sh source /app/libexec/multi_user.sh
source /app/libexec/patching.sh source /app/libexec/patching.sh
source /app/libexec/post_update.sh source /app/libexec/post_update.sh
source /app/libexec/prepare_emulator.sh source /app/libexec/prepare_component.sh
source /app/libexec/presets.sh source /app/libexec/presets.sh
# Static variables # Static variables
@ -177,8 +177,8 @@ else
new_home_path=$(directory_browse "RetroDECK folder location") new_home_path=$(directory_browse "RetroDECK folder location")
set_setting_value $rd_conf "rdhome" "$new_home_path" retrodeck "paths" set_setting_value $rd_conf "rdhome" "$new_home_path" retrodeck "paths"
conf_read conf_read
prepare_emulator "retrodeck" "postmove" prepare_component "retrodeck" "postmove"
prepare_emulator "all" "postmove" prepare_component "all" "postmove"
conf_write conf_write
fi fi

View file

@ -208,7 +208,7 @@ multi_user_setup_new_user() {
do do
if [[ ! -z $(grep "^$emu_conf$" "$multi_user_emulator_config_dirs") ]]; then if [[ ! -z $(grep "^$emu_conf$" "$multi_user_emulator_config_dirs") ]]; then
unlink "/var/config/$emu_conf" unlink "/var/config/$emu_conf"
prepare_emulator "reset" "$emu_conf" prepare_component "reset" "$emu_conf"
fi fi
done done
for emu_conf in $(find "/var/config" -mindepth 1 -maxdepth 1 -type d -printf '%f\n') # For all the currently non-linked config folders, like from a newly-added emulator for emu_conf in $(find "/var/config" -mindepth 1 -maxdepth 1 -type d -printf '%f\n') # For all the currently non-linked config folders, like from a newly-added emulator
@ -238,7 +238,7 @@ multi_user_link_current_user_files() {
if [[ -d "$multi_user_data_folder/$SteamAppUser/config/$emu_conf" ]]; then # If the current user already has a config folder for this emulator if [[ -d "$multi_user_data_folder/$SteamAppUser/config/$emu_conf" ]]; then # If the current user already has a config folder for this emulator
ln -sfT "$multi_user_data_folder/$SteamAppUser/config/$emu_conf" "retrodeck/config/$emu_conf" ln -sfT "$multi_user_data_folder/$SteamAppUser/config/$emu_conf" "retrodeck/config/$emu_conf"
else # If the current user doesn't have a config folder for this emulator, init it and then link it else # If the current user doesn't have a config folder for this emulator, init it and then link it
prepare_emulator "reset" "$emu_conf" prepare_component "reset" "$emu_conf"
dir_prep "$multi_user_data_folder/$SteamAppUser/config/$emu_conf" "/var/config/$emu_conf" dir_prep "$multi_user_data_folder/$SteamAppUser/config/$emu_conf" "/var/config/$emu_conf"
fi fi
fi fi

View file

@ -21,7 +21,7 @@ post_update() {
# - Fix PICO-8 folder structure. ROM and save folders are now sane and binary files will go into ~/retrodeck/bios/pico-8/ # - Fix PICO-8 folder structure. ROM and save folders are now sane and binary files will go into ~/retrodeck/bios/pico-8/
rm -rf /var/config/primehack # Purge old Primehack config files. Saves are safe as they are linked into /var/data/primehack. rm -rf /var/config/primehack # Purge old Primehack config files. Saves are safe as they are linked into /var/data/primehack.
prepare_emulator "reset" "primehack" prepare_component "reset" "primehack"
dir_prep "$rdhome/saves/duckstation" "/var/data/duckstation/memcards" dir_prep "$rdhome/saves/duckstation" "/var/data/duckstation/memcards"
dir_prep "$rdhome/states/duckstation" "/var/data/duckstation/savestates" dir_prep "$rdhome/states/duckstation" "/var/data/duckstation/savestates"
@ -212,14 +212,14 @@ post_update() {
set_setting_value "$ppssppconf" "AutoLoadSaveState" "0" "ppsspp" "General" set_setting_value "$ppssppconf" "AutoLoadSaveState" "0" "ppsspp" "General"
prepare_emulator "reset" "cemu" prepare_component "reset" "cemu"
prepare_emulator "reset" "pico8" prepare_component "reset" "pico8"
configurator_generic_dialog "RetroDECK 0.7.0b Upgrade" "Would you like to install the official controller profile?\n(this will reset your custom emulator settings)\n\nAfter installation you can enable it from from Controller Settings -> Templates." configurator_generic_dialog "RetroDECK 0.7.0b Upgrade" "Would you like to install the official controller profile?\n(this will reset your custom emulator settings)\n\nAfter installation you can enable it from from Controller Settings -> Templates."
if [[ $(configurator_generic_question_dialog "RetroDECK Official Controller Profile" "Would you like to install the official RetroDECK controller profile?") == "true" ]]; then if [[ $(configurator_generic_question_dialog "RetroDECK Official Controller Profile" "Would you like to install the official RetroDECK controller profile?") == "true" ]]; then
install_retrodeck_controller_profile install_retrodeck_controller_profile
prepare_emulator "reset" "all" prepare_component "reset" "all"
fi fi
fi fi
if [[ $prev_version -le "071" ]]; then if [[ $prev_version -le "071" ]]; then
@ -267,9 +267,9 @@ post_update() {
if [[ $prev_version -le "075" ]]; then if [[ $prev_version -le "075" ]]; then
# In version 0.7.5b, the following changes were made: # In version 0.7.5b, the following changes were made:
prepare_emulator "reset" "vita3k" prepare_component "reset" "vita3k"
prepare_emulator "reset" "mame" prepare_component "reset" "mame"
prepare_emulator "reset" "boilr" prepare_component "reset" "boilr"
if [ -d "$rdhome/.logs" ]; then if [ -d "$rdhome/.logs" ]; then
mv "$rdhome/.logs" "$logs_folder" mv "$rdhome/.logs" "$logs_folder"
log i "Logs folder renamed successfully" log i "Logs folder renamed successfully"

View file

@ -1,19 +1,19 @@
#!/bin/bash #!/bin/bash
prepare_emulator() { prepare_component() {
# This function will perform one of several actions on one or more emulators # This function will perform one of several actions on one or more components
# The actions currently include "reset" and "postmove" # The actions currently include "reset" and "postmove"
# The "reset" action will initialize the emulator # The "reset" action will initialize the component
# The "postmove" action will update the emulator settings after one or more RetroDECK folders were moved # The "postmove" action will update the component settings after one or more RetroDECK folders were moved
# An emulator can be called by name, by parent folder name in the /var/config root or use the option "all" to perform the action on all emulators equally # An component can be called by name, by parent folder name in the /var/config root or use the option "all" to perform the action on all components equally
# The function will also behave differently depending on if the initial request was from the Configurator, the CLI interface or a normal function call if needed # The function will also behave differently depending on if the initial request was from the Configurator, the CLI interface or a normal function call if needed
# USAGE: prepare_emulator "$action" "$emulator" "$call_source(optional)" # USAGE: prepare_component "$action" "$component" "$call_source(optional)"
action="$1" action="$1"
emulator="$2" component="$2"
call_source="$3" call_source="$3"
if [[ "$emulator" == "retrodeck" ]]; then if [[ "$component" == "retrodeck" ]]; then
if [[ "$action" == "reset" ]]; then # Update the paths of all folders in retrodeck.cfg and create them if [[ "$action" == "reset" ]]; then # Update the paths of all folders in retrodeck.cfg and create them
while read -r config_line; do while read -r config_line; do
local current_setting_name=$(get_setting_name "$config_line" "retrodeck") local current_setting_name=$(get_setting_name "$config_line" "retrodeck")
@ -37,7 +37,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(emulationstation|all)$ ]]; then # For use after ESDE-related folders are moved or a reset if [[ "$component" =~ ^(emulationstation|all)$ ]]; then # For use after ESDE-related folders are moved or a reset
if [[ "$action" == "reset" ]]; then if [[ "$action" == "reset" ]]; then
rm -rf /var/config/emulationstation/ rm -rf /var/config/emulationstation/
mkdir -p /var/config/emulationstation/.emulationstation/ mkdir -p /var/config/emulationstation/.emulationstation/
@ -57,7 +57,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(retroarch|RetroArch|all)$ ]]; then if [[ "$component" =~ ^(retroarch|RetroArch|all)$ ]]; then
if [[ "$action" == "reset" ]]; then # Run reset-only commands if [[ "$action" == "reset" ]]; then # Run reset-only commands
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
rm -rf "$multi_user_data_folder/$SteamAppUser/config/retroarch" rm -rf "$multi_user_data_folder/$SteamAppUser/config/retroarch"
@ -154,7 +154,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(cemu|Cemu|all)$ ]]; then if [[ "$component" =~ ^(cemu|Cemu|all)$ ]]; then
if [[ "$action" == "reset" ]]; then # Run reset-only commands if [[ "$action" == "reset" ]]; then # Run reset-only commands
echo "----------------------" echo "----------------------"
echo "Initializing CEMU" echo "Initializing CEMU"
@ -183,7 +183,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(citra|citra-emu|Citra|all)$ ]]; then if [[ "$component" =~ ^(citra|citra-emu|Citra|all)$ ]]; then
if [[ "$action" == "reset" ]]; then # Run reset-only commands if [[ "$action" == "reset" ]]; then # Run reset-only commands
echo "------------------------" echo "------------------------"
echo "Initializing CITRA" echo "Initializing CITRA"
@ -230,7 +230,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(dolphin|dolphin-emu|Dolphin|all)$ ]]; then if [[ "$component" =~ ^(dolphin|dolphin-emu|Dolphin|all)$ ]]; then
if [[ "$action" == "reset" ]]; then # Run reset-only commands if [[ "$action" == "reset" ]]; then # Run reset-only commands
echo "----------------------" echo "----------------------"
echo "Initializing DOLPHIN" echo "Initializing DOLPHIN"
@ -285,7 +285,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(duckstation|Duckstation|all)$ ]]; then if [[ "$component" =~ ^(duckstation|Duckstation|all)$ ]]; then
if [[ "$action" == "reset" ]]; then # Run reset-only commands if [[ "$action" == "reset" ]]; then # Run reset-only commands
echo "------------------------" echo "------------------------"
echo "Initializing DUCKSTATION" echo "Initializing DUCKSTATION"
@ -332,7 +332,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(melonds|melonDS|MelonDS|all)$ ]]; then if [[ "$component" =~ ^(melonds|melonDS|MelonDS|all)$ ]]; then
if [[ "$action" == "reset" ]]; then # Run reset-only commands if [[ "$action" == "reset" ]]; then # Run reset-only commands
echo "----------------------" echo "----------------------"
echo "Initializing MELONDS" echo "Initializing MELONDS"
@ -372,7 +372,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(pcsx2|PCSX2|all)$ ]]; then if [[ "$component" =~ ^(pcsx2|PCSX2|all)$ ]]; then
if [[ "$action" == "reset" ]]; then # Run reset-only commands if [[ "$action" == "reset" ]]; then # Run reset-only commands
echo "----------------------" echo "----------------------"
echo "Initializing PCSX2" echo "Initializing PCSX2"
@ -418,7 +418,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(pico8|pico-8|all)$ ]]; then if [[ "$component" =~ ^(pico8|pico-8|all)$ ]]; then
if [[ ("$action" == "reset") || ("$action" == "postmove") ]]; then if [[ ("$action" == "reset") || ("$action" == "postmove") ]]; then
dir_prep "$bios_folder/pico-8" "$HOME/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed dir_prep "$bios_folder/pico-8" "$HOME/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed
dir_prep "$roms_folder/pico8" "$bios_folder/pico-8/carts" # Symlink default game location to RD roms for cleanliness (this location is overridden anyway by the --root_path launch argument anyway) dir_prep "$roms_folder/pico8" "$bios_folder/pico-8/carts" # Symlink default game location to RD roms for cleanliness (this location is overridden anyway by the --root_path launch argument anyway)
@ -428,7 +428,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(ppsspp|PPSSPP|all)$ ]]; then if [[ "$component" =~ ^(ppsspp|PPSSPP|all)$ ]]; then
if [[ "$action" == "reset" ]]; then # Run reset-only commands if [[ "$action" == "reset" ]]; then # Run reset-only commands
echo "------------------------" echo "------------------------"
echo "Initializing PPSSPPSDL" echo "Initializing PPSSPPSDL"
@ -458,7 +458,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(primehack|Primehack|all)$ ]]; then if [[ "$component" =~ ^(primehack|Primehack|all)$ ]]; then
if [[ "$action" == "reset" ]]; then # Run reset-only commands if [[ "$action" == "reset" ]]; then # Run reset-only commands
echo "----------------------" echo "----------------------"
echo "Initializing Primehack" echo "Initializing Primehack"
@ -502,7 +502,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(rpcs3|RPCS3|all)$ ]]; then if [[ "$component" =~ ^(rpcs3|RPCS3|all)$ ]]; then
if [[ "$action" == "reset" ]]; then # Run reset-only commands if [[ "$action" == "reset" ]]; then # Run reset-only commands
echo "------------------------" echo "------------------------"
echo "Initializing RPCS3" echo "Initializing RPCS3"
@ -512,7 +512,7 @@ prepare_emulator() {
mkdir -pv "$multi_user_data_folder/$SteamAppUser/config/rpcs3/" mkdir -pv "$multi_user_data_folder/$SteamAppUser/config/rpcs3/"
cp -fr "$emuconfigs/rpcs3/"* "$multi_user_data_folder/$SteamAppUser/config/rpcs3/" cp -fr "$emuconfigs/rpcs3/"* "$multi_user_data_folder/$SteamAppUser/config/rpcs3/"
# This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name. # This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name.
sed -i 's^\^$(EmulatorDir): .*^$(EmulatorDir): '"$bios_folder/rpcs3/"'^' "$multi_user_data_folder/$SteamAppUser/config/rpcs3/vfs.yml" sed -i 's^\^$(componentDir): .*^$(componentDir): '"$bios_folder/rpcs3/"'^' "$multi_user_data_folder/$SteamAppUser/config/rpcs3/vfs.yml"
set_setting_value "$multi_user_data_folder/$SteamAppUser/config/rpcs3/vfs.yml" "/games/" "$roms_folder/ps3/" "rpcs3" set_setting_value "$multi_user_data_folder/$SteamAppUser/config/rpcs3/vfs.yml" "/games/" "$roms_folder/ps3/" "rpcs3"
dir_prep "$multi_user_data_folder/$SteamAppUser/config/rpcs3" "/var/config/rpcs3" dir_prep "$multi_user_data_folder/$SteamAppUser/config/rpcs3" "/var/config/rpcs3"
else # Single-user actions else # Single-user actions
@ -520,7 +520,7 @@ prepare_emulator() {
mkdir -pv /var/config/rpcs3/ mkdir -pv /var/config/rpcs3/
cp -fr "$emuconfigs/rpcs3/"* /var/config/rpcs3/ cp -fr "$emuconfigs/rpcs3/"* /var/config/rpcs3/
# This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name. # This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name.
sed -i 's^\^$(EmulatorDir): .*^$(EmulatorDir): '"$bios_folder/rpcs3/"'^' "$rpcs3vfsconf" sed -i 's^\^$(componentDir): .*^$(componentDir): '"$bios_folder/rpcs3/"'^' "$rpcs3vfsconf"
set_setting_value "$rpcs3vfsconf" "/games/" "$roms_folder/ps3/" "rpcs3" set_setting_value "$rpcs3vfsconf" "/games/" "$roms_folder/ps3/" "rpcs3"
dir_prep "$saves_folder/ps3/rpcs3" "$bios_folder/rpcs3/dev_hdd0/home/00000001/savedata" dir_prep "$saves_folder/ps3/rpcs3" "$bios_folder/rpcs3/dev_hdd0/home/00000001/savedata"
fi fi
@ -535,12 +535,12 @@ prepare_emulator() {
fi fi
if [[ "$action" == "postmove" ]]; then # Run only post-move commands if [[ "$action" == "postmove" ]]; then # Run only post-move commands
# This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name. # This is an unfortunate one-off because set_setting_value does not currently support settings with $ in the name.
sed -i 's^\^$(EmulatorDir): .*^$(EmulatorDir): '"$bios_folder/rpcs3"'^' "$rpcs3vfsconf" sed -i 's^\^$(componentDir): .*^$(componentDir): '"$bios_folder/rpcs3"'^' "$rpcs3vfsconf"
set_setting_value "$rpcs3vfsconf" "/games/" "$roms_folder/ps3" "rpcs3" set_setting_value "$rpcs3vfsconf" "/games/" "$roms_folder/ps3" "rpcs3"
fi fi
fi fi
if [[ "$emulator" =~ ^(ryujunx|Ryujinx|all)$ ]]; then if [[ "$component" =~ ^(ryujunx|Ryujinx|all)$ ]]; then
if [[ "$action" == "reset" ]]; then # Run reset-only commands if [[ "$action" == "reset" ]]; then # Run reset-only commands
echo "------------------------" echo "------------------------"
echo "Initializing RYUJINX" echo "Initializing RYUJINX"
@ -567,7 +567,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(xemu|XEMU|all)$ ]]; then if [[ "$component" =~ ^(xemu|XEMU|all)$ ]]; then
if [[ "$action" == "reset" ]]; then # Run reset-only commands if [[ "$action" == "reset" ]]; then # Run reset-only commands
echo "------------------------" echo "------------------------"
echo "Initializing XEMU" echo "Initializing XEMU"
@ -583,12 +583,12 @@ prepare_emulator() {
set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "flashrom_path" "'$bios_folder/Complex.bin'" "xemu" "sys.files" set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "flashrom_path" "'$bios_folder/Complex.bin'" "xemu" "sys.files"
set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "eeprom_path" "'$saves_folder/xbox/xemu/xbox-eeprom.bin'" "xemu" "sys.files" set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "eeprom_path" "'$saves_folder/xbox/xemu/xbox-eeprom.bin'" "xemu" "sys.files"
set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "hdd_path" "'$bios_folder/xbox_hdd.qcow2'" "xemu" "sys.files" set_setting_value "$multi_user_data_folder/$SteamAppUser/config/xemu/xemu.toml" "hdd_path" "'$bios_folder/xbox_hdd.qcow2'" "xemu" "sys.files"
dir_prep "$multi_user_data_folder/$SteamAppUser/config/xemu" "/var/config/xemu" # Creating config folder in /var/config for consistentcy and linking back to original location where emulator will look dir_prep "$multi_user_data_folder/$SteamAppUser/config/xemu" "/var/config/xemu" # Creating config folder in /var/config for consistentcy and linking back to original location where component will look
dir_prep "$multi_user_data_folder/$SteamAppUser/config/xemu" "/var/data/xemu/xemu" dir_prep "$multi_user_data_folder/$SteamAppUser/config/xemu" "/var/data/xemu/xemu"
else # Single-user actions else # Single-user actions
rm -rf /var/config/xemu rm -rf /var/config/xemu
rm -rf /var/data/xemu rm -rf /var/data/xemu
dir_prep "/var/config/xemu" "/var/data/xemu/xemu" # Creating config folder in /var/config for consistentcy and linking back to original location where emulator will look dir_prep "/var/config/xemu" "/var/data/xemu/xemu" # Creating config folder in /var/config for consistentcy and linking back to original location where component will look
cp -fv $emuconfigs/xemu/xemu.toml "$xemuconf" cp -fv $emuconfigs/xemu/xemu.toml "$xemuconf"
set_setting_value "$xemuconf" "screenshot_dir" "'$screenshots_folder'" "xemu" "General" set_setting_value "$xemuconf" "screenshot_dir" "'$screenshots_folder'" "xemu" "General"
set_setting_value "$xemuconf" "bootrom_path" "'$bios_folder/mcpx_1.0.bin'" "xemu" "sys.files" set_setting_value "$xemuconf" "bootrom_path" "'$bios_folder/mcpx_1.0.bin'" "xemu" "sys.files"
@ -612,7 +612,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(yuzu|Yuzu|all)$ ]]; then if [[ "$component" =~ ^(yuzu|Yuzu|all)$ ]]; then
if [[ "$action" == "reset" ]]; then # Run reset-only commands if [[ "$action" == "reset" ]]; then # Run reset-only commands
echo "----------------------" echo "----------------------"
echo "Initializing YUZU" echo "Initializing YUZU"
@ -668,7 +668,7 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(vita3k|Vita3K|all)$ ]]; then if [[ "$component" =~ ^(vita3k|Vita3K|all)$ ]]; then
if [[ "$action" == "reset" ]]; then # Run reset-only commands if [[ "$action" == "reset" ]]; then # Run reset-only commands
echo "----------------------" echo "----------------------"
echo "Initializing Vita3K" echo "Initializing Vita3K"
@ -676,13 +676,13 @@ prepare_emulator() {
if [[ $multi_user_mode == "true" ]]; then # Multi-user actions if [[ $multi_user_mode == "true" ]]; then # Multi-user actions
echo "Figure out what Vita3k needs for multi-user" echo "Figure out what Vita3k needs for multi-user"
else # Single-user actions else # Single-user actions
# NOTE: the emulator is writing in "." so it must be placed in the rw filesystem. A symlink of the binary is already placed in /app/bin/Vita3K # NOTE: the component is writing in "." so it must be placed in the rw filesystem. A symlink of the binary is already placed in /app/bin/Vita3K
rm -rf "/var/data/Vita3K" rm -rf "/var/data/Vita3K"
mkdir -p "/var/data/Vita3K" mkdir -p "/var/data/Vita3K"
unzip "/app/retrodeck/vita3k.zip" -d "/var/data/Vita3K" unzip "/app/retrodeck/vita3k.zip" -d "/var/data/Vita3K"
chmod +x "/var/data/Vita3K/Vita3K" chmod +x "/var/data/Vita3K/Vita3K"
rm -f "/var/data/Vita3K/update-vita3k.sh" rm -f "/var/data/Vita3K/update-vita3k.sh"
cp -fvr "$emuconfigs/vita3k/config.yml" "/var/data/Vita3K" # Emulator config cp -fvr "$emuconfigs/vita3k/config.yml" "/var/data/Vita3K" # component config
cp -fvr "$emuconfigs/vita3k/ux0" "$bios_folder/Vita3K/Vita3K" # User config cp -fvr "$emuconfigs/vita3k/ux0" "$bios_folder/Vita3K/Vita3K" # User config
set_setting_value "$vita3kconf" "pref-path" "$rdhome/bios/Vita3K/Vita3K/" "vita3k" set_setting_value "$vita3kconf" "pref-path" "$rdhome/bios/Vita3K/Vita3K/" "vita3k"
fi fi
@ -702,9 +702,9 @@ prepare_emulator() {
fi fi
fi fi
if [[ "$emulator" =~ ^(mame|MAME|all)$ ]]; then if [[ "$component" =~ ^(mame|MAME|all)$ ]]; then
# TODO: do a proper script # TODO: do a proper script
# This is just a placeholder script to test the emulator's flow # This is just a placeholder script to test the component's flow
echo "----------------------" echo "----------------------"
echo "Initializing MAME" echo "Initializing MAME"
echo "----------------------" echo "----------------------"
@ -719,9 +719,9 @@ prepare_emulator() {
fi fi
if [[ "$emulator" =~ ^(gzdoom|GZDOOM|all)$ ]]; then if [[ "$component" =~ ^(gzdoom|GZDOOM|all)$ ]]; then
# TODO: do a proper script # TODO: do a proper script
# This is just a placeholder script to test the emulator's flow # This is just a placeholder script to test the component's flow
echo "----------------------" echo "----------------------"
echo "Initializing GZDOOM" echo "Initializing GZDOOM"
echo "----------------------" echo "----------------------"
@ -735,7 +735,7 @@ prepare_emulator() {
sed -i 's#RETRODECKSAVESDIR#'$saves_folder'#g' "/var/config/gzdoom/gzdoom.ini" # This is an unfortunate one-off because set_setting_value does not currently support JSON sed -i 's#RETRODECKSAVESDIR#'$saves_folder'#g' "/var/config/gzdoom/gzdoom.ini" # This is an unfortunate one-off because set_setting_value does not currently support JSON
fi fi
if [[ "$emulator" =~ ^(boilr|BOILR|all)$ ]]; then if [[ "$component" =~ ^(boilr|BOILR|all)$ ]]; then
echo "----------------------" echo "----------------------"
echo "Initializing BOILR" echo "Initializing BOILR"
echo "----------------------" echo "----------------------"
@ -745,8 +745,8 @@ prepare_emulator() {
fi fi
# Update presets for all emulators after any reset or move # Update presets for all components after any reset or move
if [[ ! "$emulator" == "retrodeck" ]]; then if [[ ! "$component" == "retrodeck" ]]; then
build_retrodeck_current_presets build_retrodeck_current_presets
fi fi
} }

View file

@ -19,7 +19,7 @@ Arguments:
--configurator Starts the RetroDECK Configurator --configurator Starts the RetroDECK Configurator
--compress-one <file> Compresses target file to a compatible format --compress-one <file> Compresses target file to a compatible format
--compress-all <format> Compresses all supported games into compatible format. Available formats are \"chd\", \"zip\", \"rvz\" and \"all\". --compress-all <format> Compresses all supported games into compatible format. Available formats are \"chd\", \"zip\", \"rvz\" and \"all\".
--reset-emulator <emulator> Reset one or more emulator configs to the default values --reset-component <component> Reset one or more component configs to the default values
--reset-emulationstation Reset EmulationStation DE to default settings --reset-emulationstation Reset EmulationStation DE to default settings
--reset-retrodeck Starts the initial RetroDECK installer (backup your data first!) --reset-retrodeck Starts the initial RetroDECK installer (backup your data first!)
@ -55,14 +55,14 @@ https://retrodeck.net
shift shift
fi fi
;; ;;
--reset-emulator*) --reset-component*)
echo "You are about to reset one or more RetroDECK emulators." echo "You are about to reset one or more RetroDECK components."
echo "Available options are: retroarch cemu citra dolphin duckstation melonds pcsx2 ppsspp primehack rpcs3 xemu yuzu all-emulators" echo "Available options are: retroarch cemu citra dolphin duckstation melonds pcsx2 ppsspp primehack rpcs3 xemu yuzu all-components"
read -p "Please enter the emulator you would like to reset: " emulator read -p "Please enter the component you would like to reset: " component
if [[ "$emulator" =~ ^(retroarch|cemu|citra|dolphin|duckstation|melonds|pcsx2|ppsspp|primehack|rpcs3|xemu|yuzu|all-emulators)$ ]]; then if [[ "$component" =~ ^(retroarch|cemu|citra|dolphin|duckstation|melonds|pcsx2|ppsspp|primehack|rpcs3|xemu|yuzu|all-components)$ ]]; then
read -p "You are about to reset $emulator to default settings. Enter 'y' to continue, 'n' to stop: " response read -p "You are about to reset $component to default settings. Enter 'y' to continue, 'n' to stop: " response
if [[ $response == [yY] ]]; then if [[ $response == [yY] ]]; then
prepare_emulator "reset" "$emulator" "cli" prepare_component "reset" "$component" "cli"
read -p "The process has been completed, press Enter key to start RetroDECK." read -p "The process has been completed, press Enter key to start RetroDECK."
shift # Continue launch after previous command is finished shift # Continue launch after previous command is finished
else else
@ -70,7 +70,7 @@ https://retrodeck.net
exit exit
fi fi
else else
echo "$emulator is not a valid selection, exiting..." echo "$component is not a valid selection, exiting..."
exit exit
fi fi
;; ;;
@ -78,7 +78,7 @@ https://retrodeck.net
echo "You are about to reset EmulationStation DE to default settings. Your scraped media, downloaded themes and gamelists will remain untouched." echo "You are about to reset EmulationStation DE to default settings. Your scraped media, downloaded themes and gamelists will remain untouched."
read -p "Enter 'y' to continue, 'n' to stop: " response read -p "Enter 'y' to continue, 'n' to stop: " response
if [[ $response == [yY] ]]; then if [[ $response == [yY] ]]; then
prepare_emulator "reset" "emulationstation" "cli" prepare_component "reset" "emulationstation" "cli"
read -p "The process has been completed, press Enter key to start RetroDECK." read -p "The process has been completed, press Enter key to start RetroDECK."
shift # Continue launch after previous command is finished shift # Continue launch after previous command is finished
else else

View file

@ -1019,7 +1019,7 @@ configurator_reset_dialog() {
"RetroArch" | "Vita3k" | "XEMU" ) # Emulators that require network access "RetroArch" | "Vita3k" | "XEMU" ) # Emulators that require network access
if [[ $(check_network_connectivity) == "true" ]]; then if [[ $(check_network_connectivity) == "true" ]]; then
if [[ $(configurator_reset_confirmation_dialog "$emulator_to_reset" "Are you sure you want to reset the $emulator_to_reset emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then if [[ $(configurator_reset_confirmation_dialog "$emulator_to_reset" "Are you sure you want to reset the $emulator_to_reset emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
prepare_emulator "reset" "$emulator_to_reset" "configurator" prepare_component "reset" "$emulator_to_reset" "configurator"
configurator_process_complete_dialog "resetting $emulator_to_reset" configurator_process_complete_dialog "resetting $emulator_to_reset"
else else
configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled." configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled."
@ -1033,7 +1033,7 @@ configurator_reset_dialog() {
"Cemu" | "Citra" | "Dolphin" | "Duckstation" | "MelonDS" | "PCSX2" | "PPSSPP" | "Primehack" | "RPCS3" | "Ryujinx" | "Yuzu" ) "Cemu" | "Citra" | "Dolphin" | "Duckstation" | "MelonDS" | "PCSX2" | "PPSSPP" | "Primehack" | "RPCS3" | "Ryujinx" | "Yuzu" )
if [[ $(configurator_reset_confirmation_dialog "$emulator_to_reset" "Are you sure you want to reset the $emulator_to_reset emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then if [[ $(configurator_reset_confirmation_dialog "$emulator_to_reset" "Are you sure you want to reset the $emulator_to_reset emulator to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
prepare_emulator "reset" "$emulator_to_reset" "configurator" prepare_component "reset" "$emulator_to_reset" "configurator"
configurator_process_complete_dialog "resetting $emulator_to_reset" configurator_process_complete_dialog "resetting $emulator_to_reset"
else else
configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled." configurator_generic_dialog "RetroDeck Configurator - RetroDECK: Reset" "Reset process cancelled."
@ -1052,7 +1052,7 @@ configurator_reset_dialog() {
if [[ $(check_network_connectivity) == "true" ]]; then if [[ $(check_network_connectivity) == "true" ]]; then
if [[ $(configurator_reset_confirmation_dialog "all emulators" "Are you sure you want to reset all emulators to default settings?\n\nThis process cannot be undone.") == "true" ]]; then if [[ $(configurator_reset_confirmation_dialog "all emulators" "Are you sure you want to reset all emulators to default settings?\n\nThis process cannot be undone.") == "true" ]]; then
( (
prepare_emulator "reset" "all" prepare_component "reset" "all"
) | ) |
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \ zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
@ -1075,7 +1075,7 @@ configurator_reset_dialog() {
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \ --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Configurator Utility - Reset EmulationStation DE" \ --title "RetroDECK Configurator Utility - Reset EmulationStation DE" \
--text="You are resetting EmulationStation DE to its default settings.\n\nAfter the process is complete you will need to exit RetroDECK and run it again." --text="You are resetting EmulationStation DE to its default settings.\n\nAfter the process is complete you will need to exit RetroDECK and run it again."
prepare_emulator "reset" "emulationstation" "configurator" prepare_component "reset" "emulationstation" "configurator"
configurator_process_complete_dialog "resetting EmulationStation DE" configurator_process_complete_dialog "resetting EmulationStation DE"
else else
configurator_generic_dialog "RetroDeck Configurator - EmulationStation DE: Reset" "Reset process cancelled." configurator_generic_dialog "RetroDeck Configurator - EmulationStation DE: Reset" "Reset process cancelled."