EmuDeck/functions/EmuScripts/emuDeckModel2.sh
rawdatafeel bde0de35f0
[Model2] (#1003)
* Switched ULWGL download to fetch from GitHub releases
* Froze ULWGL at 0.1-RC3 while waiting for ULWGL dev to stabilize
* Switched all wget downloads to curl downloads
* Switched to generic ULWGL Proton instead of a specific version
* Updated ULWGL paths to match latest ULWGL changes
* Updated uninstall and model2 files to match latest ULWGL changes
2024-02-15 16:30:24 +01:00

185 lines
5.0 KiB
Bash

#!/bin/bash
#variables
Model2_emuName="Model 2 (Proton)"
Model2_emuType="$emuDeckEmuTypeWindows"
Model2_emuPath="${romsPath}/model2/EMULATOR.EXE"
Model2_configFile="${romsPath}/model2/EMULATOR.INI"
Model2_ProtonGEVersion="8.0-5-3"
Model2_ProtonGEURL="https://github.com/Open-Wine-Components/ULWGL-Proton/releases/download/ULWGL-Proton-$Model2_ProtonGEVersion/ULWGL-Proton-$Model2_ProtonGEVersion.tar.gz"
ULWGL_toolPath="$HOME/.local/share/ULWGL"
ULWGL_githubRepo="https://github.com/Open-Wine-Components/ULWGL-launcher.git"
ULWGL_githubBranch="main"
#cleanupOlderThings
Model2_cleanup(){
echo "NYI"
}
#Install
Model2_install(){
setMSG "Installing $Model2_emuName"
# Create the ROMs and pfx directory if they do not exist
mkdir -p "$romsPath/model2/roms"
mkdir -p "$romsPath/model2/pfx"
if safeDownload "Model2" "https://github.com/PhoenixInteractiveNL/edc-repo0004/raw/master/m2emulator/1.1a.7z" "$romsPath/model2/Model2.7z" "$showProgress"; then
7za e -y "$romsPath/model2/Model2.7z" -o"$romsPath/model2"
rm -f "$romsPath/model2/Model2.7z"
else
return 1
fi
cp "$EMUDECKGIT/tools/launchers/model2.sh" "$toolsPath/launchers/model2.sh"
}
#ApplyInitialSettings
Model2_init(){
setMSG "Initializing $Model2_emuName settings."
if [ -e "$Model2_configFile" ]; then
mv -f "$Model2_configFile.bak" "$Model2_configFile" #retain Model 2 settings
fi
rsync -avhp "$EMUDECKGIT/configs/model2/" "${romsPath}/model2" --backup --suffix=.bak
Model2_addESConfig
Model2_downloadProtonGE
Model2_createDesktopShortcut
Model2ULWGL_install
}
Model2_createDesktopShortcut(){
createDesktopShortcut "$HOME/.local/share/applications/Model 2 (Proton).desktop" \
"Model 2 Emulator (Proton)" \
"${toolsPath}/launchers/model2.sh" \
"False"
}
Model2_addESConfig(){
if [[ $(grep -rnw "$es_systemsFile" -e 'model2') == "" ]]; then
xmlstarlet ed -S --inplace --subnode '/systemList' --type elem --name 'system' \
--var newSystem '$prev' \
--subnode '$newSystem' --type elem --name 'name' -v 'model2' \
--subnode '$newSystem' --type elem --name 'fullname' -v 'Sega Model 2' \
--subnode '$newSystem' --type elem --name 'path' -v '%ROMPATH%/model2/roms' \
--subnode '$newSystem' --type elem --name 'extension' -v '.zip .ZIP' \
--subnode '$newSystem' --type elem --name 'commandP' -v "/usr/bin/bash ${toolsPath}/launchers/model2.sh %BASENAME%" \
--insert '$newSystem/commandP' --type attr --name 'label' --value "Model 2 Emulator (Proton)" \
--subnode '$newSystem' --type elem --name 'platform' -v 'arcade' \
--subnode '$newSystem' --type elem --name 'theme' -v 'model2' \
-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"
echo "Model 2 added to EmulationStation-DE custom_systems"
fi
}
#update
Model2_update(){
setMSG "Updating $Model2_emuName settings."
rsync -avhp "$EMUDECKGIT/configs/model2/" "${romsPath}/model2" --ignore-existing
Model2ULWGL_install
}
#ConfigurePaths
Model2_setEmulationFolder(){
setMSG "Setting $Model2_emuName Emulation Folder"
echo "NYI"
}
#WipeSettings
Model2_wipeSettings(){
rm -rf $Model2_Settings
}
#Uninstall
Model2_uninstall(){
setMSG "Uninstalling $Model2_emuName."
rm -rf "${Model2_emuPath}"
rm -rf "$HOME/.local/share/applications/Model 2 (Proton).desktop"
Model2_wipeSettings
}
#setABXYstyle
Model2_setABXYstyle(){
echo "NYI"
}
#finalExec - Extra stuff
Model2_finalize(){
Model2_cleanup
}
Model2_IsInstalled(){
if [ -e "$Model2_emuPath" ]; then
echo "true"
else
echo "false"
fi
}
Model2_resetConfig(){
mv "$Model2_configFile" "$Model2_configFile.bak" &>/dev/null
Model2_init &>/dev/null && echo "true" || echo "false"
}
Model2_downloadProtonGE(){
if [ -d "${HOME}/.local/share/Steam" ]; then
STEAMPATH="${HOME}/.local/share/Steam"
elif [ -d "${HOME}/.steam/steam" ]; then
STEAMPATH="${HOME}/.steam/steam"
else
echo "Steam install not found"
fi
mkdir -p $STEAMPATH/compatibilitytools.d
if [ ! -d "$STEAMPATH/compatibilitytools.d/ULWGL-Proton-$Model2_ProtonGEVersion" ]; then
if safeDownload "Model2_ProtonGE" "$Model2_ProtonGEURL" "$STEAMPATH/compatibilitytools.d/$Model2_ProtonGEVersion.tar.gz" "$showProgress"; then
tar -xvzf "$STEAMPATH/compatibilitytools.d/$Model2_ProtonGEVersion.tar.gz" -C "$STEAMPATH/compatibilitytools.d"
rm -f "$STEAMPATH/compatibilitytools.d/$Model2_ProtonGEVersion.tar.gz"
else
return 1
fi
else
echo "$Model2_ProtonGEVersion already installed"
return 1
fi
}
Model2ULWGL_install() {
mkdir -p "$ULWGL_toolPath"
#ulwglURL="$(getReleaseURLGH "Open-Wine-Components/ULWGL-launcher" "ULWGL-launcher.tar.gz")"
# Freezing ULWGL for now.
echo $ulwglURL
if safeDownload "ULWGL" "https://github.com/Open-Wine-Components/ULWGL-launcher/releases/download/0.1-RC3/ULWGL-launcher.tar.gz" "$ULWGL_toolPath/ULWGL-launcher.tar.gz" "$showProgress"; then
tar -xvzf "$ULWGL_toolPath/ULWGL-launcher.tar.gz" -C "$ULWGL_toolPath"
else
return 1
fi
}