From 6e4c980f4ab3c93975208839b524bf7481c57d12 Mon Sep 17 00:00:00 2001
From: rawdatafeel <108900299+rawdatafeel@users.noreply.github.com>
Date: Tue, 23 Apr 2024 11:17:28 -0400
Subject: [PATCH] Proton Cleanup (#1205)
* Added rsyncing proton-launch.sh and appID.py to xenia and bigpemu so if users delete them accidentally, they have an easy way of getting fresh files.
* Moved resetting ES-DE's settings into its own function so if users reset any of the custom system emulators, they don't also have their settings reset.
* This was also causing failure in very niche cases where if users didn't have a full suite of ES-DE configs, resetting the config would also fail.
* Cleaned up functions a little for easier maintenance.
* Added detection for old ES-DE installs so resetting config on custom system emulators actually grabs the latest custom systems file.
* Split BigPEmu custom system insertion into atarijaguar and atarijaguarcd
* Adjusted custom systems insertion to be less aggressive (if resetting emulators and not ES-DE, custom systems will be inserted instead of replacing the custom systems file)
---
functions/EmuScripts/emuDeckBigPEmu.sh | 52 ++++++++++++++---------
functions/EmuScripts/emuDeckCemuProton.sh | 21 ++++-----
functions/EmuScripts/emuDeckModel2.sh | 10 +++--
functions/EmuScripts/emuDeckRyujinx.sh | 10 +----
functions/EmuScripts/emuDeckXenia.sh | 17 ++++----
functions/EmuScripts/emuDeckYuzu.sh | 10 +++--
functions/ToolScripts/emuDeckESDE.sh | 15 ++++++-
functions/helperFunctions.sh | 8 +++-
8 files changed, 83 insertions(+), 60 deletions(-)
diff --git a/functions/EmuScripts/emuDeckBigPEmu.sh b/functions/EmuScripts/emuDeckBigPEmu.sh
index d0e97c4c..a543be22 100644
--- a/functions/EmuScripts/emuDeckBigPEmu.sh
+++ b/functions/EmuScripts/emuDeckBigPEmu.sh
@@ -48,19 +48,38 @@ BigPEmu_init(){
BigPEmu_setEmulationFolder
BigPEmu_setupSaves
BigPEmu_flushEmulatorLauncher
+ addProtonLaunch
#SRM_createParsers
- if [ -e "$ESDE_toolPath" ]; then
- ESDE_junksettingsFile
- ESDE_addCustomSystemsFile
+ if [ -e "$ESDE_toolPath" ] || [ -f "${toolsPath}/$ESDE_downloadedToolName" ] || [ -f "${toolsPath}/$ESDE_oldtoolName.AppImage" ]; then
BigPEmu_addESConfig
- ESDE_setEmulationFolder
else
echo "ES-DE not found. Skipped adding custom system."
fi
}
+#update
+BigPEmu_update(){
+ setMSG "Updating $BigPEmu_emuName settings."
+ rsync -avhp "$EMUDECKGIT/configs/bigpemu/" "$BigPEmu_appData" --ignore-existing
+ BigPEmu_setEmulationFolder
+ BigPEmu_setupSaves
+ BigPEmu_flushEmulatorLauncher
+ addProtonLaunch
+ if [ -e "$ESDE_toolPath" ] || [ -f "${toolsPath}/$ESDE_downloadedToolName" ] || [ -f "${toolsPath}/$ESDE_oldtoolName.AppImage" ]; then
+ BigPEmu_addESConfig
+ else
+ echo "ES-DE not found. Skipped adding custom system."
+ fi
+}
+
BigPEmu_addESConfig(){
+
+ ESDE_junksettingsFile
+ ESDE_addCustomSystemsFile
+ ESDE_setEmulationFolder
+
+ # Atari Jaguar
if [[ $(grep -rnw "$es_systemsFile" -e 'atarijaguar') == "" ]]; then
xmlstarlet ed -S --inplace --subnode '/systemList' --type elem --name 'system' \
--var newSystem '$prev' \
@@ -81,6 +100,12 @@ BigPEmu_addESConfig(){
-r 'systemList/system/commandM' -v 'command' \
"$es_systemsFile"
+ #format doc to make it look nice
+ xmlstarlet fo "$es_systemsFile" > "$es_systemsFile".tmp && mv "$es_systemsFile".tmp "$es_systemsFile"
+ fi
+
+ # Atari Jaguar CD
+ if [[ $(grep -rnw "$es_systemsFile" -e 'atarijaguarcd') == "" ]]; then
xmlstarlet ed -S --inplace --subnode '/systemList' --type elem --name 'system' \
--var newSystem '$prev' \
--subnode '$newSystem' --type elem --name 'name' -v 'atarijaguarcd' \
@@ -97,24 +122,9 @@ BigPEmu_addESConfig(){
#format doc to make it look nice
xmlstarlet fo "$es_systemsFile" > "$es_systemsFile".tmp && mv "$es_systemsFile".tmp "$es_systemsFile"
fi
- #Custom Systems config end
-}
-#update
-BigPEmu_update(){
- setMSG "Updating $BigPEmu_emuName settings."
- rsync -avhp "$EMUDECKGIT/configs/bigpemu/" "$BigPEmu_appData" --ignore-existing
- BigPEmu_setEmulationFolder
- BigPEmu_setupSaves
- BigPEmu_flushEmulatorLauncher
- if [ -e "$ESDE_toolPath" ]; then
- ESDE_junksettingsFile
- ESDE_addCustomSystemsFile
- BigPEmu_addESConfig
- ESDE_setEmulationFolder
- else
- echo "ES-DE not found. Skipped adding custom system."
- fi
+
+ #Custom Systems config end
}
diff --git a/functions/EmuScripts/emuDeckCemuProton.sh b/functions/EmuScripts/emuDeckCemuProton.sh
index 2894ee26..e15bd4c0 100644
--- a/functions/EmuScripts/emuDeckCemuProton.sh
+++ b/functions/EmuScripts/emuDeckCemuProton.sh
@@ -80,7 +80,8 @@ CemuProton_init(){
#CemuProton_addSteamInputProfile
CemuProton_addESConfig
CemuProton_flushEmulatorLauncher
-
+ addProtonLaunch
+
if [ -e "${romsPath}/wiiu/controllerProfiles/controller1.xml" ];then
mv "${romsPath}/wiiu/controllerProfiles/controller1.xml" "${romsPath}/wiiu/controllerProfiles/controller1.xml.bak"
fi
@@ -91,11 +92,8 @@ CemuProton_init(){
mv "${romsPath}/wiiu/controllerProfiles/controller3.xml" "${romsPath}/wiiu/controllerProfiles/controller3.xml.bak"
fi
- if [ -e "$ESDE_toolPath" ]; then
- ESDE_junksettingsFile
- ESDE_addCustomSystemsFile
+ if [ -e "$ESDE_toolPath" ] || [ -f "${toolsPath}/$ESDE_downloadedToolName" ] || [ -f "${toolsPath}/$ESDE_oldtoolName.AppImage" ]; then
CemuProton_addESConfig
- ESDE_setEmulationFolder
else
echo "ES-DE not found. Skipped adding custom system."
fi
@@ -110,11 +108,8 @@ CemuProton_update(){
#CemuProton_addSteamInputProfile
CemuProton_addESConfig
CemuProton_flushEmulatorLauncher
- if [ -e "$ESDE_toolPath" ]; then
- ESDE_junksettingsFile
- ESDE_addCustomSystemsFile
+ if [ -e "$ESDE_toolPath" ] || [ -f "${toolsPath}/$ESDE_downloadedToolName" ] || [ -f "${toolsPath}/$ESDE_oldtoolName.AppImage" ]; then
CemuProton_addESConfig
- ESDE_setEmulationFolder
else
echo "ES-DE not found. Skipped adding custom system."
fi
@@ -150,6 +145,10 @@ CemuProton_setLanguage(){
CemuProton_addESConfig(){
+ ESDE_junksettingsFile
+ ESDE_addCustomSystemsFile
+ ESDE_setEmulationFolder
+
#insert cemu custom system if it doesn't exist, but the file does
if [[ $(grep -rnw "$es_systemsFile" -e 'wiiu') == "" ]]; then
xmlstarlet ed -S --inplace --subnode '/systemList' --type elem --name 'system' \
@@ -261,8 +260,6 @@ CemuProton_setResolution(){
}
CemuProton_flushEmulatorLauncher(){
-
-
flushEmulatorLaunchers "cemu"
+}
-}
\ No newline at end of file
diff --git a/functions/EmuScripts/emuDeckModel2.sh b/functions/EmuScripts/emuDeckModel2.sh
index ded29859..5ddc23ac 100644
--- a/functions/EmuScripts/emuDeckModel2.sh
+++ b/functions/EmuScripts/emuDeckModel2.sh
@@ -51,11 +51,8 @@ Model2_init(){
#SRM_createParsers
Model2_flushEmulatorLauncher
Model2_addSteamInputProfile
- if [ -e "$ESDE_toolPath" ]; then
- ESDE_junksettingsFile
- ESDE_addCustomSystemsFile
+ if [ -e "$ESDE_toolPath" ] || [ -f "${toolsPath}/$ESDE_downloadedToolName" ] || [ -f "${toolsPath}/$ESDE_oldtoolName.AppImage" ]; then
Model2_addESConfig
- ESDE_setEmulationFolder
else
echo "ES-DE not found. Skipped adding custom system."
fi
@@ -65,6 +62,11 @@ Model2_init(){
Model2_addESConfig(){
+
+ ESDE_junksettingsFile
+ ESDE_addCustomSystemsFile
+ ESDE_setEmulationFolder
+
if [[ $(grep -rnw "$es_systemsFile" -e 'model2') == "" ]]; then
xmlstarlet ed -S --inplace --subnode '/systemList' --type elem --name 'system' \
--var newSystem '$prev' \
diff --git a/functions/EmuScripts/emuDeckRyujinx.sh b/functions/EmuScripts/emuDeckRyujinx.sh
index 76ca7e76..f594ce65 100644
--- a/functions/EmuScripts/emuDeckRyujinx.sh
+++ b/functions/EmuScripts/emuDeckRyujinx.sh
@@ -70,11 +70,8 @@ Ryujinx_init(){
#SRM_createParsers
Ryujinx_flushEmulatorLauncher
- if [ -e "$ESDE_toolPath" ]; then
- ESDE_junksettingsFile
- ESDE_addCustomSystemsFile
+ if [ -e "$ESDE_toolPath" ] || [ -f "${toolsPath}/$ESDE_downloadedToolName" ] || [ -f "${toolsPath}/$ESDE_oldtoolName.AppImage" ]; then
Yuzu_addESConfig
- ESDE_setEmulationFolder
else
echo "ES-DE not found. Skipped adding custom system."
fi
@@ -93,11 +90,8 @@ Ryujinx_update(){
Ryujinx_finalize
Ryujinx_flushEmulatorLauncher
- if [ -e "$ESDE_toolPath" ]; then
- ESDE_junksettingsFile
- ESDE_addCustomSystemsFile
+ if [ -e "$ESDE_toolPath" ] || [ -f "${toolsPath}/$ESDE_downloadedToolName" ] || [ -f "${toolsPath}/$ESDE_oldtoolName.AppImage" ]; then
Yuzu_addESConfig
- ESDE_setEmulationFolder
else
echo "ES-DE not found. Skipped adding custom system."
fi
diff --git a/functions/EmuScripts/emuDeckXenia.sh b/functions/EmuScripts/emuDeckXenia.sh
index 73a6c8f6..b6dc6735 100644
--- a/functions/EmuScripts/emuDeckXenia.sh
+++ b/functions/EmuScripts/emuDeckXenia.sh
@@ -69,12 +69,10 @@ Xenia_init(){
#SRM_createParsers
Xenia_cleanESDE
Xenia_flushEmulatorLauncher
-
- if [ -e "$ESDE_toolPath" ]; then
- ESDE_junksettingsFile
- ESDE_addCustomSystemsFile
+ addProtonLaunch
+
+ if [ -e "$ESDE_toolPath" ] || [ -f "${toolsPath}/$ESDE_downloadedToolName" ] || [ -f "${toolsPath}/$ESDE_oldtoolName.AppImage" ]; then
Xenia_addESConfig
- ESDE_setEmulationFolder
else
echo "ES-DE not found. Skipped adding custom system."
fi
@@ -82,6 +80,11 @@ Xenia_init(){
}
Xenia_addESConfig(){
+
+ ESDE_junksettingsFile
+ ESDE_addCustomSystemsFile
+ ESDE_setEmulationFolder
+
if [[ $(grep -rnw "$es_systemsFile" -e 'xbox360') == "" ]]; then
xmlstarlet ed -S --inplace --subnode '/systemList' --type elem --name 'system' \
--var newSystem '$prev' \
@@ -225,8 +228,6 @@ Xenia_cleanESDE(){
}
Xenia_flushEmulatorLauncher(){
-
-
flushEmulatorLaunchers "xenia"
+}
-}
\ No newline at end of file
diff --git a/functions/EmuScripts/emuDeckYuzu.sh b/functions/EmuScripts/emuDeckYuzu.sh
index 81d28421..194fbcfd 100644
--- a/functions/EmuScripts/emuDeckYuzu.sh
+++ b/functions/EmuScripts/emuDeckYuzu.sh
@@ -97,11 +97,8 @@ Yuzu_init() {
"${toolsPath}/launchers/yuzu.sh" \
"False"
- if [ -e "$ESDE_toolPath" ]; then
- ESDE_junksettingsFile
- ESDE_addCustomSystemsFile
+ if [ -e "$ESDE_toolPath" ] || [ -f "${toolsPath}/$ESDE_downloadedToolName" ] || [ -f "${toolsPath}/$ESDE_oldtoolName.AppImage" ]; then
Yuzu_addESConfig
- ESDE_setEmulationFolder
else
echo "ES-DE not found. Skipped adding custom system."
fi
@@ -380,6 +377,11 @@ Yuzu_flushEmulatorLauncher(){
}
Yuzu_addESConfig(){
+
+ ESDE_junksettingsFile
+ ESDE_addCustomSystemsFile
+ ESDE_setEmulationFolder
+
if [[ $(grep -rnw "$es_systemsFile" -e 'switch') == "" ]]; then
xmlstarlet ed -S --inplace --subnode '/systemList' --type elem --name 'system' \
--var newSystem '$prev' \
diff --git a/functions/ToolScripts/emuDeckESDE.sh b/functions/ToolScripts/emuDeckESDE.sh
index 99895fe3..2683afa9 100644
--- a/functions/ToolScripts/emuDeckESDE.sh
+++ b/functions/ToolScripts/emuDeckESDE.sh
@@ -111,13 +111,17 @@ ESDE_init(){
ESDE_addCustomSystemsFile
mkdir -p "$ESDE_newConfigDirectory/settings"
+ mkdir -p "$ESDE_newConfigDirectory/custom_systems/"
rsync -avhp --mkpath "$EMUDECKGIT/configs/emulationstation/es_settings.xml" "$(dirname "$es_settingsFile")" --backup --suffix=.bak
rsync -avhp --mkpath "$EMUDECKGIT/chimeraOS/configs/emulationstation/custom_systems/es_find_rules.xml" "$(dirname "$es_rulesFile")" --backup --suffix=.bak
+ # This duplicates ESDE_addCustomSystemsFile but this line only applies only if you are resetting ES-DE and not the emulators themselves.
+ rsync -avhp --mkpath "$EMUDECKGIT/configs/emulationstation/custom_systems/es_systems.xml" "$(dirname "$es_systemsFile")" --backup --suffix=.bak
cp -r "$EMUDECKGIT/tools/launchers/es-de/." "$toolsPath/launchers/es-de/" && chmod +x "$toolsPath/launchers/es-de/es-de.sh"
ESDE_addCustomSystems
ESDE_setEmulationFolder
+ ESDE_setDefaultSettings
ESDE_setDefaultEmulators
ESDE_applyTheme "$esdeThemeUrl" "$esdeThemeName"
ESDE_migrateDownloadedMedia
@@ -153,9 +157,11 @@ ESDE_update(){
#update es_settings.xml
rsync -avhp --mkpath "$EMUDECKGIT/configs/emulationstation/es_settings.xml" "$(dirname "$es_settingsFile")" --ignore-existing
rsync -avhp --mkpath "$EMUDECKGIT/chimeraOS/configs/emulationstation/custom_systems/es_find_rules.xml" "$(dirname "$es_rulesFile")" --ignore-existing
+ rsync -avhp --mkpath "$EMUDECKGIT/configs/emulationstation/custom_systems/es_systems.xml" "$(dirname "$es_systemsFile")" --ignore-existing
ESDE_addCustomSystems
ESDE_setEmulationFolder
+ ESDE_setDefaultSettings
ESDE_setDefaultEmulators
ESDE_applyTheme "$esdeThemeUrl" "$esdeThemeName"
ESDE_migrateDownloadedMedia
@@ -192,7 +198,7 @@ ESDE_addCustomSystemsFile(){
# Separate function so it can be copied and used in the emulator scripts.
mkdir -p "$ESDE_newConfigDirectory/custom_systems/"
- rsync -avhp --mkpath "$EMUDECKGIT/configs/emulationstation/custom_systems/es_systems.xml" "$(dirname "$es_systemsFile")" --backup --suffix=.bak
+ rsync -avhp --mkpath "$EMUDECKGIT/configs/emulationstation/custom_systems/es_systems.xml" "$(dirname "$es_systemsFile")" --ignore-existing
}
@@ -360,8 +366,12 @@ ESDE_setEmulationFolder(){
fi
fi
-
echo "updating $es_settingsFile"
+
+}
+
+ESDE_setDefaultSettings(){
+
#configure roms Directory
esDE_romDir="" #roms
@@ -380,6 +390,7 @@ ESDE_setEmulationFolder(){
echo "setting ES-DE MediaDirectory to ${esDE_MediaDir}"
changeLine '