From 872d2e65b788e7da8160aa9c5b56a189f9c1d8ab Mon Sep 17 00:00:00 2001
From: icenine451 <benjamin.r.shelton@protonmail.com>
Date: Tue, 21 Mar 2023 11:11:20 -0400
Subject: [PATCH] Add overwriting Citra/Yuzu config on update.

---
 post_update.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/post_update.sh b/post_update.sh
index 8fac6ffe..86030eb2 100644
--- a/post_update.sh
+++ b/post_update.sh
@@ -203,12 +203,18 @@ post_update() {
     # 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 ~)
+    # - Overwrite Citra and Yuzu configs, as controller mapping was broken due to emulator updates.
     
     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
+
+    cp -fv $emuconfigs/citra/qt-config.ini /var/config/citra-emu/qt-config.ini
+    sed -i 's#~/retrodeck#'$rdhome'#g' /var/config/citra-emu/qt-config.ini
+    cp -fvr $emuconfigs/yuzu/* /var/config/yuzu/
+    sed -i 's#~/retrodeck#'$rdhome'#g' /var/config/yuzu/qt-config.ini
   fi
 
   # The following commands are run every time.