Futher configurator building

This commit is contained in:
icenine451 2022-10-10 17:01:19 -04:00
parent d372bf172c
commit 9747618b9f

View file

@ -78,52 +78,52 @@ set_setting() {
case $4 in case $4 in
"retrodeck" ) "retrodeck" )
sed -i "s%$2=.*%$2=$3%" $1
;; ;;
"retroarch" ) "retroarch" )
sed -i "s/$2 = \".*\"/$2 = \"$3\"/" $1 sed -i "s%$2 = \".*\"%$2 = \"$3\"%" $1
;; ;;
"dolphin" ) "dolphin" )
sed -i "s%$2 = .*%$2 = $3%" $1
;; ;;
"duckstation" ) "duckstation" )
sed -i "s%$2 = .*%$2 = $3%" $1
;; ;;
"pcsx2" ) "pcsx2" )
sed -i "s%$2 = .*%$2 = $3%" $1
;; ;;
"ppsspp" ) "ppsspp" )
sed -i "s%$2 = .*%$2 = $3%" $1
;;
;; "rpcs3" ) # This does not currently work for settings with a $ in them
sed -i "s%$2: .*%$2: $3%" $1
"rpcs3" ) ;;
;;
"yuzu" ) "yuzu" )
#sed -i "s%$2=.*%$2=$3%" $1
;;
;;
"citra" ) "citra" )
#sed -i "s%$2=.*%$2=$3%" $1
;; ;;
"melonds" ) "melonds" )
sed -i "s%$2=.*%$2=$3%" $1
;; ;;
"xemu" ) "xemu" )
sed -i "s%$2 = .*%$2 = $3%" $1
;;
;;
"emulationstation" ) "emulationstation" )
sed -i "s%$2\" \" value=\".*\"%$2\" \" value=\"$3\"" $1
;; ;;
esac esac
@ -136,54 +136,54 @@ get_setting() {
case $3 in case $3 in
"retrodeck" ) "retrodeck" )
echo $(grep "$2" $1 | grep -o -P "(?<=$2=).*") echo $(grep "$2" $1 | grep -o -P "(?<=$2=).*")
;; ;;
"retroarch" ) "retroarch" )
echo $(grep "$2" $1 | grep -o -P "(?<=$2 = \").*(?=\")") echo $(grep "$2" $1 | grep -o -P "(?<=$2 = \").*(?=\")")
;; ;;
"dolphin" ) # Use quotes when passing setting_name, as this config file contains special characters "dolphin" ) # Use quotes when passing setting_name, as this config file contains special characters
echo $(grep "$2" $1 | grep -o -P "(?<=$2 = ).*") echo $(grep "$2" $1 | grep -o -P "(?<=$2 = ).*")
;; ;;
"duckstation" ) "duckstation" )
echo $(grep "$2" $1 | grep -o -P "(?<=$2 = ).*") echo $(grep "$2" $1 | grep -o -P "(?<=$2 = ).*")
;; ;;
"pcsx2" ) "pcsx2" )
echo $(grep "$2" $1 | grep -o -P "(?<=$2 = ).*") echo $(grep "$2" $1 | grep -o -P "(?<=$2 = ).*")
;; ;;
"ppsspp" ) "ppsspp" ) # Use quotes when passing setting_name, as this config file contains spaces
echo $(grep "$2" $1 | grep -o -P "(?<=$2 = ).*") echo $(grep "$2" $1 | grep -o -P "(?<=$2 = ).*")
;; ;;
"rpcs3" ) # Use quotes when passing setting_name, as this config file contains special characters and spaces "rpcs3" ) # Use quotes when passing setting_name, as this config file contains special characters and spaces
echo $(grep "$2" $1 | grep -o -P "(?<=$2: ).*") echo $(grep "$2" $1 | grep -o -P "(?<=$2: ).*")
;; ;;
"yuzu" ) # Use quotes when passing setting_name, as this config file contains special characters "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 yuzu_setting=$(sed -e 's%\\%\\\\%g' <<< "$2") # Accomodate for backslashes in setting names
echo $(grep "$yuzu_setting" $1 | grep -o -P "(?<=$yuzu_setting=).*") echo $(grep "$yuzu_setting" $1 | grep -o -P "(?<=$yuzu_setting=).*")
;; ;;
"citra" ) # Use quotes when passing setting_name, as this config file contains special characters "citra" ) # Use quotes when passing setting_name, as this config file contains special characters
citra_setting=$(sed -e 's/\\/\\\\/g' <<< "$2") # Accomodate for backslashes in setting names citra_setting=$(sed -e 's%\\%\\\\%g' <<< "$2") # Accomodate for backslashes in setting names
echo $(grep "$citra_setting" $1 | grep -o -P "(?<=$citra_setting=).*") echo $(grep "$citra_setting" $1 | grep -o -P "(?<=$citra_setting=).*")
;; ;;
"melonds" ) "melonds" )
echo $(grep "$2" $1 | grep -o -P "(?<=$2=).*") echo $(grep "$2" $1 | grep -o -P "(?<=$2=).*")
;; ;;
"xemu" ) "xemu" )
echo $(grep "$2" $1 | grep -o -P "(?<=$2 = ).*") echo $(grep "$2" $1 | grep -o -P "(?<=$2 = ).*")
;; ;;
"emulationstation" ) "emulationstation" )
echo $(grep "$2" $1 | grep -o -P "(?<=$2\" value=\").*(?=\")") echo $(grep "$2" $1 | grep -o -P "(?<=$2\" value=\").*(?=\")")
;; ;;
esac esac
@ -219,9 +219,12 @@ configurator_process_complete_dialog() {
zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \ zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
--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 - Process Complete" \ --title "RetroDECK Configurator Utility - Process Complete" \
--text="The process of $1 is now complete.\n\nClick OK to return to the Main Menu" --text="The process of $1 is now complete.\n\nYou may need to quit and restart RetroDECK for your changes to take effect\n\nClick OK to return to the Main Menu or Quit to return to RetroDECK."
configurator_welcome_dialog if [ $? == 0 ] # OK button clicked
then
configurator_welcome_dialog
fi
} }
configurator_progress_bar_dialog() { configurator_progress_bar_dialog() {
@ -290,6 +293,8 @@ configurator_retroachivement_dialog() {
sed -i "s%cheevos_enable =.*%cheevos_enable = \"true\"%" $raconf sed -i "s%cheevos_enable =.*%cheevos_enable = \"true\"%" $raconf
sed -i "s%cheevos_username =.*%cheevos_username = \"$user\"%" $raconf sed -i "s%cheevos_username =.*%cheevos_username = \"$user\"%" $raconf
sed -i "s%cheevos_password =.*%cheevos_password = \"$pass\"%" $raconf sed -i "s%cheevos_password =.*%cheevos_password = \"$pass\"%" $raconf
configurator_process_complete_dialog "logging in to RetroAchievements"
} }
configurator_update_dialog() { configurator_update_dialog() {
@ -387,10 +392,7 @@ configurator_retroarch_rewind_dialog() {
if [ $? == 0 ] if [ $? == 0 ]
then then
set_setting $raconf rewind_enable true retroarch set_setting $raconf rewind_enable true retroarch
zenity --info \ configurator_process_complete_dialog "enabling Rewind"
--no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Configurator - Rewind" \
--text="Rewind enabled\!\nYou can check on Libretro docs to see which cores supports this function."
else else
configurator_options_dialog configurator_options_dialog
fi fi
@ -403,10 +405,7 @@ configurator_retroarch_rewind_dialog() {
if [ $? == 0 ] if [ $? == 0 ]
then then
set_setting $raconf rewind_enable false retroarch set_setting $raconf rewind_enable false retroarch
zenity --info \ configurator_process_complete_dialog "disabling Rewind"
--no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK Configurator - Rewind" \
--text="Rewind disabled."
else else
configurator_options_dialog configurator_options_dialog
fi fi
@ -456,15 +455,44 @@ configurator_options_dialog() {
esac esac
} }
configurator_migration_dialog() { configurator_move_dialog() {
choice=$(zenity --list --title="RetroDECK Configurator Utility - Move Directories" --cancel-label="Back" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--column="Choice" --column="Action" \
"Move ROMs" "Move your ROMs directory to a new location" \
"Move BIOS" "Move your BIOS directory to a new location" \
"Move Downloaded Media" "Move your downloaded media directory to a new location" \
"Move Saves and States" "Move your save and state directories to a new location" )
case $choice in
"Move ROMs" )
;;
"Move BIOS" )
;;
"Move Downloaded Media" )
;;
"Move Saves and States" )
;;
"" ) # No selection made or Back button clicked
configurator_welcome_dialog
;;
esac
} }
configurator_welcome_dialog() { configurator_welcome_dialog() {
# Clear the variables # Clear the variables
target= source=
setting= destination=
action= action=
setting=
setting_value= setting_value=
choice=$(zenity --list --title="RetroDECK Configurator Utility" --cancel-label="Quit" \ choice=$(zenity --list --title="RetroDECK Configurator Utility" --cancel-label="Quit" \
@ -479,7 +507,7 @@ configurator_welcome_dialog() {
case $choice in case $choice in
"Move Files" ) "Move Files" )
configurator_migration_dialog configurator_move_dialog
;; ;;
"Change Options" ) "Change Options" )
@ -498,6 +526,10 @@ configurator_welcome_dialog() {
configurator_reset_dialog configurator_reset_dialog
;; ;;
"" )
;;
esac esac
} }