distribution/packages/emulators/standalone/aethersx2-sa/scripts/start_aethersx2.sh

152 lines
4.6 KiB
Bash
Raw Normal View History

2023-04-03 04:48:56 +00:00
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2023-present BrooksyTech (https://github.com/brooksytech)
. /etc/profile
#Check if aethersx2 exists in .config
if [ ! -d "/storage/.config/aethersx2" ]; then
mkdir -p "/storage/.config/aethersx2"
cp -r "/usr/config/aethersx2" "/storage/.config/"
fi
#Make Aethersx2 bios folder
if [ ! -d "/storage/roms/bios/aethersx2" ]; then
mkdir -p "/storage/roms/bios/aethersx2"
fi
#Create PS2 savestates folder
if [ ! -d "/storage/roms/savestates/ps2" ]; then
mkdir -p "/storage/roms/savestastes/ps2"
fi
2023-04-16 13:51:39 +00:00
#Prep PCSX2.ini for audio
sed -i '/^BackendName =/c\BackendName =' /storage/.config/aethersx2/inis/PCSX2.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
2023-04-03 04:48:56 +00:00
#Emulation Station Features
GAME=$(echo "${1}"| sed "s#^/.*/##")
ASPECT=$(get_setting aspect_ratio ps2 "${GAME}")
FPS=$(get_setting show_fps ps2 "${GAME}")
2023-04-25 18:22:59 +00:00
RATE=$(get_setting ee_cycle_rate ps2 "${GAME}")
SKIP=$(get_setting ee_cycle_skip ps2 "${GAME}")
2023-04-03 04:48:56 +00:00
GRENDERER=$(get_setting graphics_backend ps2 "${GAME}")
VSYNC=$(get_setting vsync ps2 "${GAME}")
#Aspect Ratio
if [ "$ASPECT" = "0" ]
then
sed -i '/^AspectRatio =/c\AspectRatio = 4:3' /storage/.config/aethersx2/inis/PCSX2.ini
fi
if [ "$ASPECT" = "1" ]
then
sed -i '/^AspectRatio =/c\AspectRatio = 16:9' /storage/.config/aethersx2/inis/PCSX2.ini
fi
if [ "$ASPECT" = "2" ]
then
sed -i '/^AspectRatio =/c\AspectRatio = Stretch' /storage/.config/aethersx2/inis/PCSX2.ini
fi
#Graphics Backend
if [ "$GRENDERER" = "0" ]
then
2023-04-25 18:22:59 +00:00
sed -i '/^Renderer =/c\Renderer = -1' /storage/.config/aethersx2/inis/PCSX2.ini
2023-04-03 04:48:56 +00:00
fi
if [ "$GRENDERER" = "1" ]
then
2023-04-25 18:22:59 +00:00
sed -i '/^Renderer =/c\Renderer = 12' /storage/.config/aethersx2/inis/PCSX2.ini
2023-04-03 04:48:56 +00:00
fi
if [ "$GRENDERER" = "2" ]
then
2023-04-25 18:22:59 +00:00
sed -i '/^Renderer =/c\Renderer = 14' /storage/.config/aethersx2/inis/PCSX2.ini
2023-04-03 04:48:56 +00:00
fi
2023-04-25 18:22:59 +00:00
if [ "$GRENDERER" = "3" ]
then
sed -i '/^Renderer =/c\Renderer = 13' /storage/.config/aethersx2/inis/PCSX2.ini
fi
2023-04-03 04:48:56 +00:00
#Show FPS
if [ "$FPS" = "false" ]
then
sed -i '/^OsdShowFPS =/c\OsdShowFPS = false' /storage/.config/aethersx2/inis/PCSX2.ini
fi
if [ "$FPS" = "true" ]
then
sed -i '/^OsdShowFPS =/c\OsdShowFPS = true' /storage/.config/aethersx2/inis/PCSX2.ini
fi
2023-04-25 18:22:59 +00:00
#EE Cycle Rate
sed -i '/^EECycleRate =/c\EECycleRate = 0' /storage/.config/aethersx2/inis/PCSX2.ini
if [ "$RATE" = "0" ]
then
sed -i '/^EECycleRate =/c\EECycleRate = -3' /storage/.config/aethersx2/inis/PCSX2.ini
fi
if [ "$RATE" = "1" ]
then
sed -i '/^EECycleRate =/c\EECycleRate = -2' /storage/.config/aethersx2/inis/PCSX2.ini
fi
if [ "$RATE" = "2" ]
then
sed -i '/^EECycleRate =/c\EECycleRate = -1' /storage/.config/aethersx2/inis/PCSX2.ini
fi
if [ "$RATE" = "3" ]
then
sed -i '/^EECycleRate =/c\EECycleRate = 0' /storage/.config/aethersx2/inis/PCSX2.ini
fi
if [ "$RATE" = "4" ]
then
sed -i '/^EECycleRate =/c\EECycleRate = 1' /storage/.config/aethersx2/inis/PCSX2.ini
fi
if [ "$RATE" = "5" ]
then
sed -i '/^EECycleRate =/c\EECycleRate = 2' /storage/.config/aethersx2/inis/PCSX2.ini
fi
if [ "$RATE" = "6" ]
then
sed -i '/^EECycleRate =/c\EECycleRate = 3' /storage/.config/aethersx2/inis/PCSX2.ini
fi
#EE Cycle Skip
sed -i '/^EECycleSkip =/c\EECycleSkip = 0' /storage/.config/aethersx2/inis/PCSX2.ini
if [ "$SKIP" = "0" ]
then
sed -i '/^EECycleSkip =/c\EECycleSkip = 0' /storage/.config/aethersx2/inis/PCSX2.ini
fi
if [ "$SKIP" = "1" ]
then
sed -i '/^EECycleSkip =/c\EECycleSkip = 1' /storage/.config/aethersx2/inis/PCSX2.ini
fi
if [ "$SKIP" = "2" ]
then
sed -i '/^EECycleSkip =/c\EECycleSkip = 2' /storage/.config/aethersx2/inis/PCSX2.ini
fi
if [ "$SKIP" = "3" ]
then
sed -i '/^EECycleSkip =/c\EECycleSkip = 3' /storage/.config/aethersx2/inis/PCSX2.ini
fi
2023-04-03 04:48:56 +00:00
2023-04-20 21:40:42 +00:00
#Set OpenGL 3.3 on panfrost
export PAN_MESA_DEBUG=gl3,gofaster
2023-04-03 04:48:56 +00:00
#Set QT enviornment to wayland
export QT_QPA_PLATFORM=wayland
#Run Aethersx2 emulator
2023-04-12 17:20:29 +00:00
set_audio pulseaudio
2023-04-25 18:22:59 +00:00
${EMUPERF} /usr/bin/@APPIMAGE@ -fullscreen "${1}"
2023-04-12 17:20:29 +00:00
set_audio alsa