distribution/packages/emulators/standalone/dolphin-sa/scripts/start_dolphin_gc.sh

241 lines
8.5 KiB
Bash
Raw Normal View History

2022-11-02 14:18:15 +00:00
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022-present BrooksyTech (https://github.com/brooksytech)
. /etc/profile
#Check if dolphin-emu exists in .config
if [ ! -d "/storage/.config/dolphin-emu" ]; then
mkdir -p "/storage/.config/dolphin-emu"
cp -r "/usr/config/dolphin-emu" "/storage/.config/"
fi
2022-11-06 23:39:38 +00:00
#Check if GC custom controller profile exists in .config/dolphin-emu
if [ ! -f "/storage/.config/dolphin-emu/Custom_GCPadNew.ini" ]; then
2023-06-06 22:34:15 +00:00
cp -r "/usr/config/dolphin-emu/GCPadNew.ini.south" "/storage/.config/dolphin-emu/Custom_GCPadNew.ini"
2022-11-06 23:39:38 +00:00
fi
2022-11-02 14:18:15 +00:00
#Link Save States to /roms/savestates
if [ ! -d "/storage/roms/savestates/gamecube/" ]; then
mkdir -p "/storage/roms/savestates/gamecube/"
fi
rm -rf /storage/.config/dolphin-emu/StateSaves
ln -sf /storage/roms/savestates/gamecube /storage/.config/dolphin-emu/StateSaves
2023-06-06 22:34:15 +00:00
#Grab a clean settings file during boot
cp -r /usr/config/dolphin-emu/GFX.ini /storage/.config/dolphin-emu.GFX.ini
cp -r /usr/config/dolphin-emu/Dolphin.ini /storage/.config/dolphin-emu.Dolphin.ini
2023-04-25 18:22:59 +00:00
#Set the cores to use
CORES=$(get_setting "cores" "${PLATFORM}" "${ROMNAME##*/}")
if [ "${CORES}" = "little" ]
then
EMUPERF="${SLOW_CORES}"
elif [ "${CORES}" = "big" ]
then
EMUPERF="${FAST_CORES}"
else
### All..
unset EMUPERF
fi
2022-11-02 14:18:15 +00:00
#Emulation Station Features
GAME=$(echo "${1}"| sed "s#^/.*/##")
AA=$(get_setting anti_aliasing gamecube "${GAME}")
ASPECT=$(get_setting aspect_ratio gamecube "${GAME}")
CLOCK=$(get_setting clock_speed gamecube "${GAME}")
2022-11-02 14:18:15 +00:00
RENDERER=$(get_setting graphics_backend gamecube "${GAME}")
IRES=$(get_setting internal_resolution gamecube "${GAME}")
FPS=$(get_setting show_fps gamecube "${GAME}")
2022-11-06 23:39:38 +00:00
CON=$(get_setting gamecube_controller_profile gamecube "${GAME}")
2023-06-06 22:34:15 +00:00
SHADERM=$(get_setting shader_mode gamecube "${GAME}")
SHADERP=$(get_setting shader_precompile gamecube "${GAME}")
2023-04-25 18:22:59 +00:00
VSYNC=$(get_setting vsync gamecube "${GAME}")
2022-11-02 14:18:15 +00:00
#Anti-Aliasing
if [ "$AA" = "0" ]
then
sed -i '/MSAA/c\MSAA = 0' /storage/.config/dolphin-emu/GFX.ini
sed -i '/SSAA/c\SSAA = False' /storage/.config/dolphin-emu/GFX.ini
fi
if [ "$AA" = "2m" ]
then
sed -i '/MSAA/c\MSAA = 2' /storage/.config/dolphin-emu/GFX.ini
sed -i '/SSAA/c\SSAA = False' /storage/.config/dolphin-emu/GFX.ini
fi
if [ "$AA" = "2s" ]
then
sed -i '/MSAA/c\MSAA = 2' /storage/.config/dolphin-emu/GFX.ini
sed -i '/SSAA/c\SSAA = True' /storage/.config/dolphin-emu/GFX.ini
fi
if [ "$AA" = "4m" ]
then
sed -i '/MSAA/c\MSAA = 4' /storage/.config/dolphin-emu/GFX.ini
sed -i '/SSAA/c\SSAA = False' /storage/.config/dolphin-emu/GFX.ini
fi
if [ "$AA" = "4s" ]
then
sed -i '/MSAA/c\MSAA = 4' /storage/.config/dolphin-emu/GFX.ini
sed -i '/SSAA/c\SSAA = True' /storage/.config/dolphin-emu/GFX.ini
fi
if [ "$AA" = "8m" ]
then
sed -i '/MSAA/c\MSAA = 8' /storage/.config/dolphin-emu/GFX.ini
sed -i '/SSAA/c\SSAA = False' /storage/.config/dolphin-emu/GFX.ini
fi
if [ "$AA" = "8s" ]
then
sed -i '/MSAA/c\MSAA = 8' /storage/.config/dolphin-emu/GFX.ini
sed -i '/SSAA/c\SSAA = True' /storage/.config/dolphin-emu/GFX.ini
fi
#Aspect Ratio
if [ "$ASPECT" = "0" ]
then
sed -i '/AspectRatio/c\AspectRatio = 0' /storage/.config/dolphin-emu/GFX.ini
fi
if [ "$ASPECT" = "1" ]
then
sed -i '/AspectRatio/c\AspectRatio = 1' /storage/.config/dolphin-emu/GFX.ini
fi
if [ "$ASPECT" = "2" ]
then
sed -i '/AspectRatio/c\AspectRatio = 2' /storage/.config/dolphin-emu/GFX.ini
fi
if [ "$ASPECT" = "3" ]
then
sed -i '/AspectRatio/c\AspectRatio = 3' /storage/.config/dolphin-emu/GFX.ini
fi
#Clock Speed
sed -i '/^OverclockEnable =/c\OverclockEnable = False' /storage/.config/dolphin-emu/Dolphin.ini
if [ "$CLOCK" = "0" ]
then
sed -i '/^Overclock =/c\Overclock = 0.5' /storage/.config/dolphin-emu/Dolphin.ini
sed -i '/^OverclockEnable =/c\OverclockEnable = True' /storage/.config/dolphin-emu/Dolphin.ini
fi
if [ "$CLOCK" = "1" ]
then
sed -i '/^Overclock =/c\Overclock = 0.75' /storage/.config/dolphin-emu/Dolphin.ini
sed -i '/^OverclockEnable =/c\OverclockEnable = True' /storage/.config/dolphin-emu/Dolphin.ini
fi
if [ "$CLOCK" = "2" ]
then
sed -i '/^Overclock =/c\Overclock = 1.0' /storage/.config/dolphin-emu/Dolphin.ini
sed -i '/^OverclockEnable =/c\OverclockEnable = False' /storage/.config/dolphin-emu/Dolphin.ini
fi
if [ "$CLOCK" = "3" ]
then
sed -i '/^Overclock =/c\Overclock = 1.25' /storage/.config/dolphin-emu/Dolphin.ini
sed -i '/^OverclockEnable =/c\OverclockEnable = True' /storage/.config/dolphin-emu/Dolphin.ini
fi
if [ "$CLOCK" = "4" ]
then
sed -i '/^Overclock =/c\Overclock = 1.5' /storage/.config/dolphin-emu/Dolphin.ini
sed -i '/^OverclockEnable =/c\OverclockEnable = True' /storage/.config/dolphin-emu/Dolphin.ini
fi
2022-11-02 14:18:15 +00:00
#Video Backend
if [ "$RENDERER" = "opengl" ]
then
sed -i '/GFXBackend/c\GFXBackend = OGL' /storage/.config/dolphin-emu/Dolphin.ini
fi
if [ "$RENDERER" = "vulkan" ]
then
sed -i '/GFXBackend/c\GFXBackend = Vulkan' /storage/.config/dolphin-emu/Dolphin.ini
fi
if [ "$RENDERER" = "software" ]
then
sed -i '/GFXBackend/c\GFXBackend = Software Renderer' /storage/.config/dolphin-emu/Dolphin.ini
fi
#Internal Resolution
2023-06-06 22:34:15 +00:00
if [ "$IRES" = "0" ]
2022-11-02 14:18:15 +00:00
then
sed -i '/InternalResolution/c\InternalResolution = 1' /storage/.config/dolphin-emu/GFX.ini
fi
2023-06-06 22:34:15 +00:00
if [ "$IRES" = "1" ]
2022-11-02 14:18:15 +00:00
then
sed -i '/InternalResolution/c\InternalResolution = 2' /storage/.config/dolphin-emu/GFX.ini
fi
2023-06-06 22:34:15 +00:00
if [ "$IRES" = "2" ]
then
sed -i '/InternalResolution/c\InternalResolution = 4' /storage/.config/dolphin-emu/GFX.ini
fi
2022-11-02 14:18:15 +00:00
if [ "$IRES" = "3" ]
then
2023-06-06 22:34:15 +00:00
sed -i '/InternalResolution/c\InternalResolution = 6' /storage/.config/dolphin-emu/GFX.ini
fi
#Shader Mode
if [ "$SHADERM" = "0" ]
then
sed -i '/ShaderCompilationMode =/c\ShaderCompilationMode = 0' /storage/.config/dolphin-emu/GFX.ini
2022-11-02 14:18:15 +00:00
fi
2023-06-06 22:34:15 +00:00
if [ "$SHADERM" = "1" ]
then
sed -i '/ShaderCompilationMode =/c\ShaderCompilationMode = 1' /storage/.config/dolphin-emu/GFX.ini
fi
if [ "$SHADERM" = "2" ]
then
sed -i '/ShaderCompilationMode =/c\ShaderCompilationMode = 2' /storage/.config/dolphin-emu/GFX.ini
fi
if [ "$SHADERM" = "3" ]
then
sed -i '/ShaderCompilationMode =/c\ShaderCompilationMode = 3' /storage/.config/dolphin-emu/GFX.ini
fi
#Shader Precompile
if [ "$SHADERP" = "false" ]
then
sed -i '/WaitForShadersBeforeStarting =/c\WaitForShadersBeforeStarting = False' /storage/.config/dolphin-emu/GFX.ini
fi
if [ "$SHADERP" = "true" ]
then
sed -i '/WaitForShadersBeforeStarting =/c\WaitForShadersBeforeStarting = True' /storage/.config/dolphin-emu/GFX.ini
fi
2022-11-02 14:18:15 +00:00
#Show FPS
if [ "$FPS" = "false" ]
then
sed -i '/ShowFPS/c\ShowFPS = False' /storage/.config/dolphin-emu/GFX.ini
fi
if [ "$FPS" = "true" ]
then
sed -i '/ShowFPS/c\ShowFPS = true' /storage/.config/dolphin-emu/GFX.ini
fi
2022-11-06 23:39:38 +00:00
#GC Controller Profile
2023-05-30 14:18:24 +00:00
if [ "$CON" = "south" ]
2022-11-06 23:39:38 +00:00
then
2023-05-30 14:18:24 +00:00
cp -r /usr/config/dolphin-emu/GCPadNew.ini.south /storage/.config/dolphin-emu/GCPadNew.ini
fi
if [ "$CON" = "west" ]
then
cp -r /usr/config/dolphin-emu/GCPadNew.ini.west /storage/.config/dolphin-emu/GCPadNew.ini
2022-11-06 23:39:38 +00:00
fi
if [ "$CON" = "custom" ]
then
cp -r /storage/.config/dolphin-emu/Custom_GCPadNew.ini /storage/.config/dolphin-emu/GCPadNew.ini
fi
2023-04-25 18:22:59 +00:00
#VSYNC
if [ "$VSYNC" = "0" ]
then
sed -i '/VSync =/c\VSync = False' /storage/.config/dolphin-emu/GFX.ini
fi
if [ "$VSYNC" = "1" ]
then
sed -i '/VSync =/c\VSync = True' /storage/.config/dolphin-emu/GFX.ini
fi
2022-11-02 14:18:15 +00:00
#Link .config/dolphin-emu to .local
rm -rf /storage/.local/share/dolphin-emu
ln -sf /storage/.config/dolphin-emu /storage/.local/share/dolphin-emu
#Run Dolphin emulator
2023-04-25 18:22:59 +00:00
${EMUPERF} /usr/bin/dolphin-emu-nogui -p @DOLPHIN_PLATFORM@ -a HLE -e "${1}"