Setup more backend, move functions should be ready

This commit is contained in:
icenine451 2022-10-26 12:51:46 -04:00
parent ececa7cbec
commit 0c1bfe962d
7 changed files with 751 additions and 502 deletions

View file

@ -43,13 +43,13 @@ Enabled = False
[DSP]
EnableJIT = False
[GBA]
BIOS = /home/deck/.var/app/org.DolphinEmu.dolphin-emu/data/dolphin-emu/GBA/gba_bios.bin
BIOS =
Rom1 =
Rom2 =
Rom3 =
Rom4 =
SavesInRomPath = False
SavesPath = /home/deck/.var/app/org.DolphinEmu.dolphin-emu/data/dolphin-emu/GBA/Saves/
SavesPath =
Threads = True
[Input]
BackgroundInput = False

View file

@ -0,0 +1,18 @@
[GBA1]
Device = XInput2/0/Virtual core pointer
Buttons/B = `Z`
Buttons/A = `X`
Buttons/L = `Q`
Buttons/R = `W`
Buttons/SELECT = `Backspace`
Buttons/START = `Return`
D-Pad/Up = `T`
D-Pad/Down = `G`
D-Pad/Left = `F`
D-Pad/Right = `H`
[GBA2]
Device = XInput2/0/Virtual core pointer
[GBA3]
Device = XInput2/0/Virtual core pointer
[GBA4]
Device = XInput2/0/Virtual core pointer

View file

@ -207,6 +207,10 @@ Shaders = shaders
Textures = textures
[UI]
MainWindowGeometry = AdnQywADAAAAAAGWAAAAeQAABLUAAAM0AAABlgAAAHkAAAS1AAADNAAAAAAAAAAABk0AAAGWAAAAeQAABLUAAAM0
[InputSources]
SDL = true
SDLControllerEnhancedMode = false

View file

@ -43,7 +43,7 @@ verify_space() {
# USAGE: verify_space $source_dir $dest_dir
# Function returns "true" if there is enough space, "false" if there is not
source_size=$(du -sk /home/deck/retrodeck | awk '{print $1}')
source_size=$(du -sk $1 | awk '{print $1}')
source_size=$((source_size+(source_size/10))) # Add 10% to source size for safety
dest_avail=$(df -k --output=avail $2 | tail -1)
@ -143,6 +143,59 @@ get_setting_name() {
# Function for getting the setting name from a full setting line from a config file
# USAGE: get_setting_name $setting_line $system (needed as different systems use different config file syntax)
case $2 in
"retrodeck" )
echo "$1" | grep -o -P ".*(?=\=)"
;;
"retroarch" )
echo "$1" | grep -o -P ".*(?= \= )"
;;
"dolphin" ) # Use quotes when passing setting_name, as this config file contains special characters
echo "$1" | grep -o -P ".*(?= \= )"
;;
"duckstation" )
echo "$1" | grep -o -P ".*(?= \= )"
;;
"pcsx2" )
echo "$1" | grep -o -P ".*(?= \= )"
;;
"ppsspp" ) # Use quotes when passing setting_name, as this config file contains spaces
echo "$1" | grep -o -P ".*(?= \= )"
;;
"rpcs3" ) # Use quotes when passing setting_name, as this config file contains special characters and spaces
echo "$1" | grep -o -P ".*(?=:)"
;;
"yuzu" ) # Use quotes when passing setting_name, as this config file contains special characters
yuzu_setting=$(sed -e 's%\\%\\\\%g' <<< "$2") # Accomodate for backslashes in setting names
echo '$yuzu_setting' | grep -o -P ".*(?=\=)" | sed -e 's%\\\\%\\%g'
;;
"citra" ) # Use quotes when passing setting_name, as this config file contains special characters
citra_setting=$(sed -e 's%\\%\\\\%g' <<< "$1") # Accomodate for backslashes in setting names
echo '$citra_setting' | grep -o -P ".*(?=\=)" | sed -e 's%\\\\%\\%g'
;;
"melonds" )
echo "$1" | grep -o -P ".*(?=\=)"
;;
"xemu" )
echo "$1" | grep -o -P ".*(?= \= )"
;;
"emulationstation" )
echo '$1' | grep -o -P "(?<=name\=\").*(?=\" value)"
;;
esac
}
get_setting_value() {
@ -205,11 +258,129 @@ esac
}
disable_setting() {
# This function will add a '#' to the beginning of a defined setting line, disabling it.
# USAGE: disable_setting $setting_file $setting_name $system
case $3 in
"retrodeck" )
sed -i "s%^$2=%#$2=%" $1
;;
"retroarch" )
sed -i "s%^$2 = %#$2 = %" $1
;;
"dolphin" )
sed -i "s%^$2 = %#$2 = %" $1
;;
"duckstation" )
sed -i "s%^$2 = %#$2 = %" $1
;;
"pcsx2" )
sed -i "s%^$2 = %#$2 = %" $1
;;
"ppsspp" )
sed -i "s%^$2 = %#$2 = %" $1
;;
"rpcs3" ) # This does not currently work for settings with a $ in them
sed -i "s%^$2: %#$2: %" $1
;;
"yuzu" )
yuzu_setting=$(sed -e 's%\\%\\\\%g' <<< "$2") # Acommodate backslashes in setting name
sed -i "s%^$yuzu_setting=%#$yuzu_setting=%" $1
;;
"citra" )
citra_setting=$(sed -e 's%\\%\\\\%g' <<< "$2") # Acommodate backslashes in setting name
sed -i "s%^$citra_setting=%#$citra_setting=%" $1
;;
"melonds" )
sed -i "s%^$2=%#$2=%" $1
;;
"xemu" )
sed -i "s%^$2 = %#$2 = %" $1
;;
esac
}
enable_setting() {
# This function will remove a '#' to the beginning of a defined setting line, enabling it.
# USAGE: enable_setting $setting_file $setting_name $system
case $3 in
"retrodeck" )
sed -i "s%^#$2=%$2=%" $1
;;
"retroarch" )
sed -i "s%^#$2 = %$2 = %" $1
;;
"dolphin" )
sed -i "s%^#$2 = %$2 = %" $1
;;
"duckstation" )
sed -i "s%^#$2 = %$2 = %" $1
;;
"pcsx2" )
sed -i "s%^#$2 = %$2 = %" $1
;;
"ppsspp" )
sed -i "s%^#$2 = %$2 = %" $1
;;
"rpcs3" ) # This does not currently work for settings with a $ in them
sed -i "s%^#$2: %$2: %" $1
;;
"yuzu" )
yuzu_setting=$(sed -e 's%\\%\\\\%g' <<< "$2") # Acommodate backslashes in setting name
sed -i "s%^#$yuzu_setting=%$yuzu_setting=%" $1
;;
"citra" )
citra_setting=$(sed -e 's%\\%\\\\%g' <<< "$2") # Acommodate backslashes in setting name
sed -i "s%^#$citra_setting=%$citra_setting=%" $1
;;
"melonds" )
sed -i "s%^#$2=%$2=%" $1
;;
"xemu" )
sed -i "s%^#$2 = %$2 = %" $1
;;
esac
}
disable_file() {
# This function adds the suffix ".disabled" to the end of a file to prevent it from being used entirely.
# USAGE: disable_file $file_name
# NOTE: $filename can be a defined variable from global.sh or must have the full path to the file
mv $(realpath $1) $(realpath $1).disabled
}
enable_file() {
# This function removes the suffix ".disabled" to the end of a file to allow it to be used.
# USAGE: enable_file $file_name
# NOTE: $filename can be a defined variable from global.sh or must have the full path to the file and should not have ".disabled" as a suffix
mv $(realpath $1.disabled) $(realpath $(echo $1 | sed -e 's/\.disabled//'))
}
conf_write() {

View file

@ -11,6 +11,36 @@ lockfile="/var/config/retrodeck/.lock" # where the lockfile
default_sd="/run/media/mmcblk0p1" # Steam Deck SD default path
hard_version="$(cat '/app/retrodeck/version')" # hardcoded version (in the readonly filesystem)
# Config files for emulators with single config files
citraconf="/var/config/citra-emu/qt-config.ini"
melondsconf="/var/config/melonDS/melonDS.ini"
rpcs3conf="/var/config/rpcs3/config.yml"
yuzuconf="/var/config/yuzu/qt-config.ini"
# ES-DE config files
es_settings="/var/config/emulationstation/.emulationstation/es_settings.xml"
# RetroArch config files
raconf="/var/config/retroarch/retroarch.cfg"
ra_core_conf="/var/config/retroarch/retroarch-core-options.cfg"
# Dolphin config files
dolphinconf="/var/config/dolphin-emu/Dolphin.ini"
dolphingcpadconf="/var/config/dolphin-emu/GCPadNew.ini"
dolphingfxconf="/var/config/dolphin-emu/GFX.ini"
dolphinhkconf="/var/config/dolphin-emu/Hotkeys.ini"
dolphinqtconf="/var/config/dolphin-emu/Qt.ini"
# PCSX2 config files
pcsx2conf="/var/config/PCSX2/inis/GS.ini"
pcsx2uiconf="/var/config/PCSX2/inis/PCSX2_ui.ini"
pcsx2vmconf="/var/config/PCSX2/inis/PCSX2_vm.ini"
# If there is no config file I initalize the file with the the default values
if [ ! -f "$rd_conf" ]
then

View file

@ -8,36 +8,6 @@
source /app/libexec/global.sh # uncomment for flatpak testing
source /app/libexec/functions.sh # uncomment for flatpak testing
# Config files for emulators with single config files
citraconf="/var/config/citra-emu/qt-config.ini"
melondsconf="/var/config/melonDS/melonDS.ini"
rpcs3conf="/var/config/rpcs3/config.yml"
yuzuconf="/var/config/yuzu/qt-config.ini"
# ES-DE config files
es_settings="/var/config/emulationstation/.emulationstation/es_settings.xml"
# RetroArch config files
raconf="/var/config/retroarch/retroarch.cfg"
ra_core_conf="/var/config/retroarch/retroarch-core-options.cfg"
# Dolphin config files
dolphinconf="/var/config/dolphin-emu/Dolphin.ini"
dolphingcpadconf="/var/config/dolphin-emu/GCPadNew.ini"
dolphingfxconf="/var/config/dolphin-emu/GFX.ini"
dolphinhkconf="/var/config/dolphin-emu/Hotkeys.ini"
dolphinqtconf="/var/config/dolphin-emu/Qt.ini"
# PCSX2 config files
pcsx2conf="/var/config/PCSX2/inis/GS.ini"
pcsx2uiconf="/var/config/PCSX2/inis/PCSX2_ui.ini"
pcsx2vmconf="/var/config/PCSX2/inis/PCSX2_vm.ini"
# DIALOG SECTION
# Configurator Option Tree
@ -47,6 +17,7 @@ pcsx2vmconf="/var/config/PCSX2/inis/PCSX2_vm.ini"
# - Migrate ROM directory
# - Migrate BIOS directory
# - Migrate downloaded_media
# - Migrate everything
# - Change Emulator Options
# - RetroArch
# - Change Rewind Setting
@ -172,28 +143,28 @@ configurator_reset_dialog() {
esac
;;
"Reset All Standalones" )
"Reset All Standalones" )
debug_dialog "standalones_init"
configurator_process_complete_dialog "resetting standalone emulators"
;;
;;
"Reset Tools" )
"Reset Tools" )
debug_dialog "tools_init"
configurator_process_complete_dialog "resetting the tools menu"
;;
;;
"Reset All" )
"Reset All" )
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 - Reset RetroDECK" \
--text="You are resetting RetroDECK to its default state.\n\nAfter the process is complete you will need to exit RetroDECK and run it again."
debug_dialog "rm -f "$lockfile""
configurator_process_complete_dialog "resetting RetroDECK"
;;
;;
"" ) # No selection made or Back button clicked
"" ) # No selection made or Back button clicked
configurator_welcome_dialog
;;
;;
esac
}
@ -408,7 +379,7 @@ configurator_move_dialog() {
configurator_move_dialog
else
configurator_generic_dialog "Moving ROMs folder to $destination"
move $roms_folder "$rdhome/roms"
debug_dialog "move $roms_folder "$rdhome/roms""
roms_folder="$rdhome/roms"
debug_dialog "dir_prep $roms_folder "/var/config/emulationstation/ROMs""
debug_dialog "conf_write"
@ -421,7 +392,8 @@ configurator_move_dialog() {
configurator_move_dialog
else
configurator_generic_dialog "Moving ROMs folder to $destination"
move $roms_folder "$sdcard/retrodeck/roms"
debug_dialog "move $roms_folder "$sdcard/retrodeck/roms""
debug_dialog "ln -svf $roms_folder $rdhome/roms" # Link back to "default" location for standalone compatibilty
roms_folder="$sdcard/retrodeck/roms"
debug_dialog "dir_prep $roms_folder "/var/config/emulationstation/ROMs""
debug_dialog "conf_write"
@ -436,7 +408,8 @@ configurator_move_dialog() {
configurator_move_dialog
else
configurator_generic_dialog "Moving ROMs folder from $roms_folder\n\nto $destination.\n\nClick OK to continue."
move $roms_folder $destination
debug_dialog "move $roms_folder $destination"
debug_dialog "ln -svf $roms_folder $rdhome/roms" # Link back to "default" location for standalone compatibilty
roms_folder=$destination
debug_dialog "dir_prep $roms_folder "/var/config/emulationstation/ROMs""
debug_dialog "conf_write"
@ -526,9 +499,9 @@ configurator_move_dialog() {
configurator_move_dialog
else
configurator_generic_dialog "Moving media folder to $destination"
move $media_folder "$rdhome/downloaded_media"
debug_dialog "move $media_folder "$rdhome/downloaded_media""
media_folder="$rdhome/downloaded_media"
debug_dialog "dir_prep $media_folder "$rdhome/downloaded_media""
debug_dialog "dir_prep $media_folder "/var/config/emulationstation/.emulationstation/downloaded_media""
debug_dialog "conf_write"
configurator_process_complete_dialog "moving the media directory to internal storage"
fi
@ -539,9 +512,9 @@ configurator_move_dialog() {
configurator_move_dialog
else
configurator_generic_dialog "Moving media folder to $destination"
move $media_folder "$sdcard/retrodeck/downloaded_media"
debug_dialog "move $media_folder "$sdcard/retrodeck/downloaded_media""
media_folder="$sdcard/retrodeck/downloaded_media"
debug_dialog "dir_prep $media_folder "$rdhome/downloaded_media""
debug_dialog "dir_prep $media_folder "/var/config/emulationstation/.emulationstation/downloaded_media""
debug_dialog "conf_write"
configurator_process_complete_dialog "moving the media directory to SD card"
fi
@ -554,9 +527,9 @@ configurator_move_dialog() {
configurator_move_dialog
else
configurator_generic_dialog "Moving media folder from $media_folder\n\nto $destination.\n\nClick OK to continue."
move $media_folder $destination
debug_dialog "move $media_folder $destination"
media_folder=$destination
debug_dialog "dir_prep $media_folder "$rdhome/downloaded_media""
debug_dialog "dir_prep $media_folder "/var/config/emulationstation/.emulationstation/downloaded_media""
debug_dialog "conf_write"
configurator_process_complete_dialog "moving the media directory to $destination"
fi
@ -571,6 +544,59 @@ configurator_move_dialog() {
fi
;;
"Move Everything" )
if [[ -d $rdhome ]]; then
configurator_generic_dialog "This option will move the RetroDECK data folder (ROMs, saves, BIOS etc.) to a new location.\n\nPlease choose where to move the RetroDECK data folder."
destination=$(configurator_destination_choice_dialog "RetroDECK Data" "Please choose a destination for the RetroDECK data folder.")
case $destination in
"Back" )
configurator_move_dialog
;;
"Internal Storage" )
if [[ ! -L /home/deck/retrodeck && -d /home/deck/retrodeck ]]; then
configurator_generic_dialog "The RetroDECK data folder is already at that location, please pick a new one."
configurator_move_dialog
else
configurator_generic_dialog "Moving RetroDECK data folder to $destination"
debug_dialog "unlink /home/deck/retrodeck" # Remove symlink for $rdhome
debug_dialog "move $sdcard/retrodeck "/home/deck/""
debug_dialog "roms_folder="$rdhome/roms""
debug_dialog "dir_prep $roms_folder "/var/config/emulationstation/ROMs""
debug_dialog "conf_write"
configurator_process_complete_dialog "moving the RetroDECK data directory to internal storage"
fi
;;
"SD Card" )
if [[ -L $rdhome && -d $sdcard/retrodeck ]]; then
configurator_generic_dialog "The RetroDECK data folder is already at that location, please pick a new one."
configurator_move_dialog
else
if [[ ! -w $sdcard ]]; then
configurator_generic_dialog "The SD card was found but is not writable\nThis can happen with cards formatted on PC or for other reasons.\nPlease format the SD card through the Steam Deck's Game Mode and try the moving process again."
configurator_welcome_dialog
else
configurator_generic_dialog "Moving RetroDECK data folder to $destination"
if [[ -L $rdhome/roms ]]; then # Check for ROMs symlink user may have created
debug dialog "unlink $rdhome/roms"
fi
debug_dialog "dir_prep "$sdcard/retrodeck" $rdhome"
debug_dialog "roms_folder="$sdcard/retrodeck/roms""
debug_dialog "dir_prep $roms_folder "/var/config/emulationstation/ROMs""
debug_dialog "conf_write"
configurator_process_complete_dialog "moving the RetroDECK data directory to SD card"
fi
fi
;;
esac
else
configurator_generic_dialog "The RetroDECK data 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 RetroDECK data folder."
debug_dialog "rdhome=$(browse "RetroDECK directory location")"
debug_dialog "conf_write"
configurator_generic_dialog "RetroDECK data folder now configured at $rdhome. Please start the moving process again."
configurator_move_dialog
fi
;;
"" ) # No selection made or Back button clicked
configurator_welcome_dialog
;;