From e55bb2f9b9f111ebfe6a5277be62056f277633f9 Mon Sep 17 00:00:00 2001
From: icenine451 <59938822+icenine451@users.noreply.github.com>
Date: Wed, 15 Mar 2023 19:58:02 -0400
Subject: [PATCH 1/4] New rd_cpnf variables not loaded correctly after update

---
 functions.sh   | 1 -
 post_update.sh | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/functions.sh b/functions.sh
index b17d2716..552044ef 100644
--- a/functions.sh
+++ b/functions.sh
@@ -629,7 +629,6 @@ update_rd_conf() {
   deploy_single_patch $rd_defaults $rd_update_patch $rd_conf
   set_setting_value $rd_conf "version" "$hard_version" retrodeck # Set version of currently running RetroDECK to updated retrodeck.cfg
   rm -f $rd_update_patch # Cleanup temporary patch file
-  source $rd_conf # Load new config file variables
 }
 
 conf_write() {
diff --git a/post_update.sh b/post_update.sh
index cc469cec..6626019a 100644
--- a/post_update.sh
+++ b/post_update.sh
@@ -187,7 +187,7 @@ post_update() {
     # - Primehack preconfiguration completely redone. "Stop emulation" hotkey set to Start+Select, Xbox and Nintendo keymap profiles were created, Xbox set as default.
     # - Duckstation save and state locations were dir_prep'd to the rdhome/save and /state folders, which was not previously done. Much safer now!
     # - 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.
     primehack_init
 
@@ -209,6 +209,6 @@ post_update() {
   --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
   --title "RetroDECK Finishing Upgrade" \
   --text="RetroDECK is finishing the upgrade process, please wait."
-
+  source $rd_conf # Load new config file variables
   create_lock
 }
\ No newline at end of file

From 47a754662aaa8cfe6936d5fa9bc733febf2248cb Mon Sep 17 00:00:00 2001
From: icenine451 <59938822+icenine451@users.noreply.github.com>
Date: Wed, 15 Mar 2023 20:01:53 -0400
Subject: [PATCH 2/4] dir_prep doesn't translate ~ correctly apparently

---
 functions.sh   | 2 +-
 post_update.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/functions.sh b/functions.sh
index 552044ef..b098379e 100644
--- a/functions.sh
+++ b/functions.sh
@@ -1313,7 +1313,7 @@ finit() {
   dir_prep "$themes_folder" "/var/config/emulationstation/.emulationstation/themes"
 
   # PICO-8
-  dir_prep "$bios_folder/pico-8" "~/.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 "$bios_folder/pico-8/cdata" "$saves_folder/pico-8" # PICO-8 saves folder
 
diff --git a/post_update.sh b/post_update.sh
index 6626019a..78d675c0 100644
--- a/post_update.sh
+++ b/post_update.sh
@@ -195,7 +195,7 @@ post_update() {
     dir_prep "$rdhome/states/duckstation" "/var/data/duckstation/savestates"
 
     mv "$bios_folder/pico8" "$bios_folder/pico8_olddata" # Move legacy (and incorrect / non-functional ) PICO-8 location for future cleanup / less confusion
-    dir_prep "$bios_folder/pico-8" "~/.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 "$bios_folder/pico-8/cdata" "$saves_folder/pico-8" # PICO-8 saves folder
   fi

From 78bfa1e5aa54dca925b4e4f42a9a3ca69bb6c5bd Mon Sep 17 00:00:00 2001
From: icenine451 <benjamin.r.shelton@protonmail.com>
Date: Thu, 16 Mar 2023 11:14:25 -0400
Subject: [PATCH 3/4] - Fix PICO-8 symlink location - Seperate
 Dolphin/Primehack save states - Fix post-update variable checks for new
 values

---
 functions.sh   |  8 ++++----
 global.sh      |  8 ++++++++
 post_update.sh | 11 +++++++++++
 retrodeck.sh   |  2 ++
 4 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/functions.sh b/functions.sh
index b17d2716..196d4fae 100644
--- a/functions.sh
+++ b/functions.sh
@@ -781,7 +781,7 @@ dolphin_init() {
   dir_prep "$rdhome/saves/gc/dolphin/USA" "/var/data/dolphin-emu/GC/USA"
   dir_prep "$rdhome/saves/gc/dolphin/JAP" "/var/data/dolphin-emu/GC/JAP"
   dir_prep "$rdhome/screenshots" "/var/data/dolphin-emu/ScreenShots"
-  dir_prep "$rdhome/states" "/var/data/dolphin-emu/StateSaves"
+  dir_prep "$rdhome/states/dolphin" "/var/data/dolphin-emu/StateSaves"
   mkdir -pv /var/data/dolphin-emu/Wii/
   dir_prep "$rdhome/saves/wii/dolphin" "/var/data/dolphin-emu/Wii"
 }
@@ -799,7 +799,7 @@ primehack_init() {
   dir_prep "$rdhome/saves/gc/primehack/USA" "/var/data/primehack/GC/USA"
   dir_prep "$rdhome/saves/gc/primehack/JAP" "/var/data/primehack/GC/JAP"
   dir_prep "$rdhome/screenshots" "/var/data/primehack/ScreenShots"
-  dir_prep "$rdhome/states" "/var/data/primehack/StateSaves"
+  dir_prep "$rdhome/states/primehack" "/var/data/primehack/StateSaves"
   mkdir -pv /var/data/primehack/Wii/
   dir_prep "$rdhome/saves/wii/primehack" "/var/data/primehack/Wii"
 }
@@ -1070,7 +1070,7 @@ emulators_post_move() {
   dir_prep "$rdhome/saves/gc/dolphin/USA" "/var/data/dolphin-emu/GC/USA"
   dir_prep "$rdhome/saves/gc/dolphin/JAP" "/var/data/dolphin-emu/GC/JAP"
   dir_prep "$rdhome/screenshots" "/var/data/dolphin-emu/ScreenShots"
-  dir_prep "$rdhome/states" "/var/data/dolphin-emu/StateSaves"
+  dir_prep "$rdhome/states/dolphin" "/var/data/dolphin-emu/StateSaves"
   dir_prep "$rdhome/saves/wii/dolphin" "/var/data/dolphin-emu/Wii/"
 
   # Primehack section
@@ -1079,7 +1079,7 @@ emulators_post_move() {
   dir_prep "$rdhome/saves/gc/primehack/USA" "/var/data/primehack/GC/USA"
   dir_prep "$rdhome/saves/gc/primehack/JAP" "/var/data/primehack/GC/JAP"
   dir_prep "$rdhome/screenshots" "/var/data/primehack/ScreenShots"
-  dir_prep "$rdhome/states" "/var/data/primehack/StateSaves"
+  dir_prep "$rdhome/states/primehack" "/var/data/primehack/StateSaves"
   dir_prep "$rdhome/saves/wii/primehack" "/var/data/primehack/Wii/"
 
   # PCSX2 section
diff --git a/global.sh b/global.sh
index 7bfd48fa..f2566fa6 100755
--- a/global.sh
+++ b/global.sh
@@ -54,6 +54,14 @@ pcsx2vmconf="/var/config/PCSX2/inis/PCSX2_vm.ini"
 
 pcsx2qtconf="/var/config/PCSX2/inis/PCSX2.ini"
 
+# Primehack config files
+
+primehackconf="/var/config/primehack/Dolphin.ini"
+primehackgcpadconf="/var/config/primehack/GCPadNew.ini"
+primehackgfxconf="/var/config/primehack/GFX.ini"
+primehackhkconf="/var/config/primehack/Hotkeys.ini"
+primehackqtconf="/var/config/primehack/Qt.ini"
+
 # We moved the lockfile in /var/config/retrodeck in order to solve issue #53 - Remove in a few versions
 if [ -f "$HOME/retrodeck/.lock" ]
 then
diff --git a/post_update.sh b/post_update.sh
index cc469cec..4a87fbfa 100644
--- a/post_update.sh
+++ b/post_update.sh
@@ -199,6 +199,17 @@ post_update() {
     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 "$bios_folder/pico-8/cdata" "$saves_folder/pico-8" # PICO-8 saves folder
   fi
+  if [[ $prev_version -le "063" ]]; then
+    # In version 0.6.2b, the following changes were made that required config file updates/reset:
+    # - Put Dolphin and Primehack save states in different folders inside $rd_home/states
+    # - Fix symlink to hard-coded PICO-8 config folder (dir_prep doesn't like ~)
+    
+    dir_prep "$rdhome/states/dolphin" "/var/data/dolphin-emu/StateSaves"
+    dir_prep "$rdhome/states/primehack" "/var/data/primehack/StateSaves"
+
+    rm -rf "$HOME/~/" # Remove old incorrect location from 0.6.2b
+    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
+  fi
 
   # The following commands are run every time.
 
diff --git a/retrodeck.sh b/retrodeck.sh
index 431ede18..862bc05c 100644
--- a/retrodeck.sh
+++ b/retrodeck.sh
@@ -118,6 +118,8 @@ else
   finit             # Executing First/Force init
 fi
 
+source $rd_conf # Load latest variable values
+
 # Check if running in Desktop mode and warn if true, unless desktop_mode_warning=false in retrodeck.cfg
 
 desktop_mode_warning

From 183639a8cd9434341398174a2d621d683b5701a2 Mon Sep 17 00:00:00 2001
From: icenine451 <benjamin.r.shelton@protonmail.com>
Date: Thu, 16 Mar 2023 11:25:34 -0400
Subject: [PATCH 4/4] Some Configurator wording updates

---
 tools/configurator.sh | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/tools/configurator.sh b/tools/configurator.sh
index a7b222df..eed1a93a 100644
--- a/tools/configurator.sh
+++ b/tools/configurator.sh
@@ -306,7 +306,7 @@ configurator_retroarch_rewind_dialog() {
     zenity --question \
     --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
     --title "RetroDECK Configurator - Rewind" \
-    --text="Rewind is currently disabled, do you want to enable it?\n\nNOTE:\nThis may impact performance expecially on the latest systems."
+    --text="Rewind is currently disabled, do you want to enable it?\n\nNOTE:\nThis may impact performance on some more demanding systems."
 
     if [ $? == 0 ]
     then
@@ -323,7 +323,7 @@ configurator_retroarch_options_dialog() {
   --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \
   --column="Choice" --column="Action" \
   "Change Rewind Setting" "Enable or disable the Rewind function in RetroArch." \
-  "Log in to RetroAchivements" "Log into the RetroAchievements service in RetroArch." )
+  "RetroAchievements Login" "Log into the RetroAchievements service in RetroArch." )
 
   case $choice in
 
@@ -331,7 +331,7 @@ configurator_retroarch_options_dialog() {
     configurator_retroarch_rewind_dialog
   ;;
 
-  "Log in to RetroAchivements" )
+  "RetroAchievements Login" )
     configurator_retroachivement_dialog
   ;;
 
@@ -787,22 +787,15 @@ configurator_move_dialog() {
 }
 
 configurator_welcome_dialog() {
-  # Clear the variables
-  source=
-  destination=
-  action=
-  setting=
-  setting_value=
-
   choice=$(zenity --list --title="RetroDECK Configurator Utility" --cancel-label="Quit" \
   --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --width=1200 --height=720 \
   --column="Choice" --column="Action" \
-  "Move Files" "Move files between internal/SD card or to custom locations." \
-  "Change RetroArch Options" "Change RetroArch presets, log into RetroAchievements etc." \
-  "Change Standalone Emulator Options" "Run emulators standalone to make advanced config changes." \
-  "Compress Games" "Compress games to CHD format for systems that support it." \
-  "Troubleshooting Tools" "Run RetroDECK troubleshooting tools for common issues." \
-  "Reset" "Reset specific parts or all of RetroDECK." )
+  "Move Files" "Move files between internal/SD card or to custom locations" \
+  "RetroArch Presets" "Change RetroArch presets, log into RetroAchievements etc" \
+  "Emulator Options" "Launch and configure each emulators settings (for advanced users)" \
+  "Compress Games" "Compress games to CHD format for systems that support it" \
+  "Troubleshooting Tools" "Run RetroDECK troubleshooting tools for common issues" \
+  "Reset" "Reset specific parts or all of RetroDECK" )
 
   case $choice in
 
@@ -811,11 +804,11 @@ configurator_welcome_dialog() {
     configurator_move_dialog
   ;;
 
-  "Change RetroArch Options" )
+  "RetroArch Presets" )
     configurator_retroarch_options_dialog
   ;;
 
-  "Change Standalone Emulator Options" )
+  "Emulator Options" )
     configurator_power_user_warning_dialog
   ;;