ES-DE: Add find rules and custom systems for Yuzu (#1121)

This commit is contained in:
rawdatafeel 2024-03-13 10:38:01 -04:00 committed by GitHub
parent cae445fc05
commit fdbbe78832
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 189 additions and 26 deletions

View file

@ -1,10 +1,60 @@
<?xml version="1.0"?>
<!-- This is the ES-DE find rules configuration file for Unix -->
<ruleList>
<emulator name="RETROARCH">
<rule type="systempath">
<entry>org.libretro.RetroArch</entry>
<entry>retroarch</entry>
</rule>
</emulator>
</ruleList>
<emulator name="OS-SHELL">
<!-- Operating system shell -->
<rule type="systempath">
<entry>bash</entry>
<entry>sh</entry>
</rule>
</emulator>
<emulator name="RETROARCH">
<rule type="systempath">
<entry>org.libretro.RetroArch</entry>
<entry>retroarch</entry>
</rule>
<rule type="staticpath">
<entry>~/.local/share/flatpak/exports/bin/org.libretro.RetroArch</entry>
<entry>/var/lib/flatpak/exports/bin/org.libretro.RetroArch</entry>
<entry>~/Applications/RetroArch-Linux*.AppImage</entry>
<entry>~/.local/share/applications/RetroArch-Linux*.AppImage</entry>
<entry>~/.local/bin/RetroArch-Linux*.AppImage</entry>
<entry>~/bin/RetroArch-Linux*.AppImage</entry>
</rule>
</emulator>
<core name="RETROARCH">
<rule type="corepath">
<!-- Flatpak package -->
<entry>~/.var/app/org.libretro.RetroArch/config/retroarch/cores</entry>
<!-- Snap package -->
<entry>~/snap/retroarch/current/.config/retroarch/cores</entry>
<!-- AppImage and compiled from source -->
<entry>~/.config/retroarch/cores</entry>
<!-- Ubuntu and Linux Mint repository -->
<entry>/usr/lib/x86_64-linux-gnu/libretro</entry>
<!-- Fedora repository -->
<entry>/usr/lib64/libretro</entry>
<!-- Manjaro repository -->
<entry>/usr/lib/libretro</entry>
<!-- FreeBSD and OpenBSD repository -->
<entry>/usr/local/lib/libretro</entry>
<!-- NetBSD repository -->
<entry>/usr/pkg/lib/libretro</entry>
</rule>
</core>
<emulator name="YUZU">
<!-- Nintendo Switch emulator Yuzu -->
<rule type="systempath">
<entry>yuzu</entry>
<entry>org.yuzu_emu.yuzu</entry>
</rule>
<rule type="staticpath">
<entry>~/Applications/yuzu*.AppImage</entry>
<entry>~/.local/share/applications/yuzu*.AppImage</entry>
<entry>~/.local/bin/yuzu*.AppImage</entry>
<entry>~/bin/yuzu*.AppImage</entry>
<entry>/var/lib/flatpak/exports/bin/org.yuzu_emu.yuzu</entry>
<entry>~/.local/share/flatpak/exports/bin/org.yuzu_emu.yuzu</entry>
</rule>
</emulator>
</ruleList>

View file

@ -10,8 +10,8 @@
</emulator>
<emulator name="RETROARCH">
<rule type="systempath">
<entry>retroarch</entry>
<entry>org.libretro.RetroArch</entry>
<entry>retroarch</entry>
</rule>
<rule type="staticpath">
<entry>~/.local/share/flatpak/exports/bin/org.libretro.RetroArch</entry>
@ -42,4 +42,19 @@
<entry>/usr/pkg/lib/libretro</entry>
</rule>
</core>
<emulator name="YUZU">
<!-- Nintendo Switch emulator Yuzu -->
<rule type="systempath">
<entry>yuzu</entry>
<entry>org.yuzu_emu.yuzu</entry>
</rule>
<rule type="staticpath">
<entry>~/Applications/yuzu*.AppImage</entry>
<entry>~/.local/share/applications/yuzu*.AppImage</entry>
<entry>~/.local/bin/yuzu*.AppImage</entry>
<entry>~/bin/yuzu*.AppImage</entry>
<entry>/var/lib/flatpak/exports/bin/org.yuzu_emu.yuzu</entry>
<entry>~/.local/share/flatpak/exports/bin/org.yuzu_emu.yuzu</entry>
</rule>
</emulator>
</ruleList>

View file

@ -30,13 +30,14 @@
<theme>model2</theme>
</system>
<system>
<name>xbox360</name>
<fullname>Microsoft Xbox 360</fullname>
<path>%ROMPATH%/xbox360/roms</path>
<extension>.iso .ISO . .xex .XEX .zar .ZAR</extension>
<command label="Xenia (Proton)">/bin/bash /run/media/mmcblk0p1/Emulation/tools/launchers/xenia.sh z:%ROM%</command>
<platform>xbox360</platform>
<theme>xbox360</theme>
<name>switch</name>
<fullname>Nintendo Switch</fullname>
<path>%ROMPATH%/switch</path>
<extension>.nca .NCA .nro .NRO .nso .NSO .nsp .NSP .xci .XCI</extension>
<command label="Ryujinx (Standalone)">%EMULATOR_RYUJINX% %ROM%</command>
<command label="Yuzu (Standalone)">%INJECT%=%BASENAME%.esprefix %EMULATOR_YUZU% -f -g %ROM%</command>
<platform>switch</platform>
<theme>switch</theme>
</system>
<system>
<name>wiiu</name>
@ -48,4 +49,13 @@
<platform>wiiu</platform>
<theme>wiiu</theme>
</system>
<system>
<name>xbox360</name>
<fullname>Microsoft Xbox 360</fullname>
<path>%ROMPATH%/xbox360/roms</path>
<extension>.iso .ISO . .xex .XEX .zar .ZAR</extension>
<command label="Xenia (Proton)">/bin/bash /run/media/mmcblk0p1/Emulation/tools/launchers/xenia.sh z:%ROM%</command>
<platform>xbox360</platform>
<theme>xbox360</theme>
</system>
</systemList>

View file

@ -69,6 +69,13 @@ Ryujinx_init(){
Ryujinx_finalize
#SRM_createParsers
Ryujinx_flushEmulatorLauncher
if [ -e "$ESDE_toolPath" ]; then
Yuzu_addESConfig
else
echo "ES-DE not found. Skipped adding custom system."
fi
}
#update
@ -82,6 +89,12 @@ Ryujinx_update(){
Ryujinx_setupSaves
Ryujinx_finalize
Ryujinx_flushEmulatorLauncher
if [ -e "$ESDE_toolPath" ]; then
Yuzu_addESConfig
else
echo "ES-DE not found. Skipped adding custom system."
fi
}
#ConfigurePaths

View file

@ -97,6 +97,13 @@ Yuzu_init() {
"${toolsPath}/launchers/yuzu.sh" \
"False"
if [ -e "$ESDE_toolPath" ]; then
Yuzu_addESConfig
else
echo "ES-DE not found. Skipped adding custom system."
fi
}
#update
@ -367,4 +374,29 @@ Yuzu_flushEmulatorLauncher(){
flushEmulatorLaunchers "yuzu"
}
Yuzu_addESConfig(){
if [[ $(grep -rnw "$es_systemsFile" -e 'switch') == "" ]]; then
xmlstarlet ed -S --inplace --subnode '/systemList' --type elem --name 'system' \
--var newSystem '$prev' \
--subnode '$newSystem' --type elem --name 'name' -v 'switch' \
--subnode '$newSystem' --type elem --name 'fullname' -v 'Nintendo Switch' \
--subnode '$newSystem' --type elem --name 'path' -v '%ROMPATH%/switch' \
--subnode '$newSystem' --type elem --name 'extension' -v '.nca .NCA .nro .NRO .nso .NSO .nsp .NSP .xci .XCI' \
--subnode '$newSystem' --type elem --name 'commandB' -v "%EMULATOR_RYUJINX% %ROM%" \
--insert '$newSystem/commandB' --type attr --name 'label' --value "Ryujinx (Standalone)" \
--subnode '$newSystem' --type elem --name 'commandV' -v "%INJECT%=%BASENAME%.esprefix %EMULATOR_YUZU% -f -g %ROM%" \
--insert '$newSystem/commandV' --type attr --name 'label' --value "Yuzu (Standalone)" \
--subnode '$newSystem' --type elem --name 'platform' -v 'switch' \
--subnode '$newSystem' --type elem --name 'theme' -v 'switch' \
-r 'systemList/system/commandB' -v 'command' \
-r 'systemList/system/commandV' -v 'command' \
"$es_systemsFile"
xmlstarlet fo "$es_systemsFile" > "$es_systemsFile".tmp && mv "$es_systemsFile".tmp "$es_systemsFile"
fi
#Custom Systems config end
}

View file

@ -114,6 +114,7 @@ ESDE_init(){
rsync -avhp --mkpath "$EMUDECKGIT/configs/emulationstation/es_settings.xml" "$(dirname "$es_settingsFile")" --backup --suffix=.bak
rsync -avhp --mkpath "$EMUDECKGIT/configs/emulationstation/custom_systems/es_systems.xml" "$(dirname "$es_systemsFile")" --backup --suffix=.bak
rsync -avhp --mkpath "$EMUDECKGIT/chimeraOS/configs/emulationstation/custom_systems/es_find_rules.xml" "$(dirname "$es_rulesFile")" --backup --suffix=.bak
cp -r "$EMUDECKGIT/tools/launchers/es-de/." "$toolsPath/launchers/es-de/" && chmod +x "$toolsPath/launchers/es-de/es-de.sh"
@ -127,19 +128,11 @@ ESDE_init(){
ESDE_migrateEpicNoir
SRM_createParsers
addSteamInputCustomIcons
ESDE_findRules
if [ "$system" == "chimeraos" ] || [ "$system" == "ChimeraOS" ]; then
ESDE_chimeraOS
fi
}
ESDE_chimeraOS(){
if [ ! -f "$es_rulesFile" ]; then
rsync -avhp --mkpath "$EMUDECKGIT/chimeraOS/configs/emulationstation/custom_systems/es_find_rules.xml" "$(dirname "$es_rulesFile")" --backup --suffix=.bak
else
xmlstarlet ed -d '//entry[contains(., "~/Applications/RetroArch-Linux*.AppImage") or contains(., "~/.local/share/applications/RetroArch-Linux*.AppImage") or contains(., "~/.local/bin/RetroArch-Linux*.AppImage") or contains(., "~/bin/RetroArch-Linux*.AppImage")]' $es_rulesFile > rules_temp.xml && mv rules_temp.xml $es_rulesFile
fi
}
ESDE_resetConfig(){
ESDE_init &>/dev/null && echo "true" || echo "false"
@ -161,6 +154,7 @@ ESDE_update(){
#update es_settings.xml
rsync -avhp --mkpath "$EMUDECKGIT/configs/emulationstation/es_settings.xml" "$(dirname "$es_settingsFile")" --ignore-existing
rsync -avhp --mkpath "$EMUDECKGIT/configs/emulationstation/custom_systems/es_systems.xml" "$(dirname "$es_systemsFile")" --ignore-existing
rsync -avhp --mkpath "$EMUDECKGIT/chimeraOS/configs/emulationstation/custom_systems/es_find_rules.xml" "$(dirname "$es_rulesFile")" --ignore-existing
ESDE_addCustomSystems
ESDE_setEmulationFolder
@ -196,7 +190,7 @@ ESDE_addCustomSystems(){
CemuProton_addESConfig
Model2_addESConfig
Xenia_addESConfig
Yuzu_addESConfig
}
#update
@ -319,6 +313,37 @@ ESDE_setEmulationFolder(){
xmlstarlet ed -L -u '/systemList/system/command[@label="BigPEmu (Proton)"]' -v "$bigpemujaguarcdProtonCommandString" "$es_systemsFile"
fi
fi
if [[ ! $(grep -rnw "$es_systemsFile" -e 'switch') == "" ]]; then
if [[ $(grep -rnw "$es_systemsFile" -e 'Ryujinx (Standalone)') == "" ]]; then
#insert
xmlstarlet ed -S --inplace --subnode 'systemList/system[name="switch"]' --type elem --name 'commandP' -v "%EMULATOR_RYUJINX% %ROM%" \
--insert 'systemList/system/commandP' --type attr --name 'label' --value "Ryujinx (Standalone)" \
-r 'systemList/system/commandP' -v 'command' \
"$es_systemsFile"
#format doc to make it look nice
xmlstarlet fo "$es_systemsFile" > "$es_systemsFile".tmp && mv "$es_systemsFile".tmp "$es_systemsFile"
else
#update
ryujinxSwitchCommandString="%EMULATOR_RYUJINX% %ROM%"
xmlstarlet ed -L -u '/systemList/system/command[@label="Ryujinx (Standalone)"]' -v "$ryujinxSwitchCommandString" "$es_systemsFile"
fi
if [[ $(grep -rnw "$es_systemsFile" -e 'Yuzu (Standalone)') == "" ]]; then
#insert
xmlstarlet ed -S --inplace --subnode 'systemList/system[name="switch"]' --type elem --name 'commandP' -v "%INJECT%=%BASENAME%.esprefix %EMULATOR_YUZU% -f -g %ROM%" \
--insert 'systemList/system/commandP' --type attr --name 'label' --value "Yuzu (Standalone)" \
-r 'systemList/system/commandP' -v 'command' \
"$es_systemsFile"
#format doc to make it look nice
xmlstarlet fo "$es_systemsFile" > "$es_systemsFile".tmp && mv "$es_systemsFile".tmp "$es_systemsFile"
else
#update
yuzuSwitchCommandString="%INJECT%=%BASENAME%.esprefix %EMULATOR_YUZU% -f -g %ROM%"
xmlstarlet ed -L -u '/systemList/system/command[@label="Yuzu (Standalone)"]' -v "$yuzuSwitchCommandString" "$es_systemsFile"
fi
fi
echo "updating $es_settingsFile"
#configure roms Directory

View file

@ -191,6 +191,24 @@ appImageInit() {
fi
touch "$HOME/.config/EmuDeck/.launcherupdate"
fi
if [ ! -f "$HOME/.config/EmuDeck/.esdeupdate" ]; then
zenity --question \
--text="An upcoming ES-DE update will be removing Yuzu support. This means that you will no longer be able to launch Nintendo Switch games using Yuzu in ES-DE. \nHowever, EmuDeck has pushed a hotfix to add back Yuzu support for ES-DE. \nIf you say no to this prompt, you may also apply this fix at any time by resetting ES-DE or Yuzu on the Manage Emulators page. \nWould you like to apply this hotfix?" \
--title="ES-DE Update" \
--width=400 \
--height=300
if [ $? = 0 ]; then
Yuzu_addESConfig
else
echo "Do not apply hotfix."
fi
touch "$HOME/.config/EmuDeck/.esdeupdate"
fi
#pcsx2 fix
if [ ! -f "$HOME/.config/EmuDeck/.pcsx2211" ]; then