2023-01-07 23:34:43 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
# Copyright (C) 2022-present Frank Hartung (supervisedthinking (@) gmail.com)
|
|
|
|
# Copyright (C) 2022-present Fewtarius
|
|
|
|
|
|
|
|
# Source environment variables
|
|
|
|
. /etc/profile
|
|
|
|
|
|
|
|
# Ensure we're using pulseaudio
|
|
|
|
rr_audio.sh pulseaudio
|
|
|
|
export SDL_AUDIODRIVER=pulseaudio
|
|
|
|
|
|
|
|
# Set up mime db
|
|
|
|
mkdir -p /storage/.local/share/mime/packages
|
|
|
|
cp -rf /usr/share/mime/packages/* /storage/.local/share/mime/packages
|
|
|
|
update-mime-database /storage/.local/share/mime
|
|
|
|
|
|
|
|
# Set common paths
|
|
|
|
CEMU_CACHE_LOG=/storage/.config/Cemu/share/log.txt
|
|
|
|
CEMU_VAR_LOG=/var/log/Cemu.log
|
|
|
|
CEMU_HOME_CONFIG=/storage/.config/Cemu/share
|
|
|
|
CEMU_HOME_LOCAL=/storage/.local/share/Cemu
|
|
|
|
|
|
|
|
# create link to config directory
|
|
|
|
if [ ! -d ${CEMU_HOME_CONFIG} ]; then
|
|
|
|
mkdir -p ${CEMU_HOME_CONFIG}
|
|
|
|
echo created ${CEMU_HOME_CONFIG}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d ${CEMU_HOME_LOCAL} ] && [ ! -L ${CEMU_HOME_LOCAL} ]; then
|
|
|
|
cp -rf ${CEMU_HOME_LOCAL}/* ${CEMU_HOME_CONFIG}
|
|
|
|
rm -rf ${CEMU_HOME_LOCAL}
|
|
|
|
echo moved ${CEMU_HOME_LOCAL} to ${CEMU_HOME_CONFIG}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -L ${CEMU_HOME_LOCAL} ]; then
|
|
|
|
ln -sf ${CEMU_HOME_CONFIG} ${CEMU_HOME_LOCAL}
|
|
|
|
echo created symlink from ${CEMU_HOME_CONFIG} to ${CEMU_HOME_LOCAL}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Create symlink to logfile
|
|
|
|
if [ ! -L ${CEMU_VAR_LOG} ]; then
|
|
|
|
ln -sf ${CEMU_CACHE_LOG} ${CEMU_VAR_LOG}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Make sure CEMU settings exist, and set the audio output.
|
|
|
|
if [ ! -f "/storage/.config/Cemu/settings.xml" ]
|
|
|
|
then
|
|
|
|
cp -f /usr/config/Cemu/settings.xml /storage/.config/Cemu/settings.xml
|
|
|
|
fi
|
|
|
|
|
2023-01-08 11:19:57 +00:00
|
|
|
# Make sure the basic controller profiles exist.
|
2023-01-10 00:57:35 +00:00
|
|
|
if [ ! -f /storage/.config/Cemu/controllerProfiles/controller0.xml ]
|
|
|
|
then
|
|
|
|
cp /usr/config/Cemu/controllerProfiles/controller0.xml /storage/.config/Cemu/controllerProfiles
|
|
|
|
fi
|
|
|
|
|
|
|
|
FILE=$(echo $@ | sed "s#^/.*/##g")
|
|
|
|
FPS=$(get_setting show_fps wiiu "${FILE}")
|
|
|
|
CON=$(get_setting wiiu_controller_profile wiiu "${FILE}")
|
|
|
|
|
|
|
|
if [ -z "${FPS}" ]
|
|
|
|
then
|
|
|
|
FPS="0"
|
|
|
|
fi
|
|
|
|
if [ -z "${CON}" ]
|
|
|
|
then
|
|
|
|
CON="Wii U GamePad"
|
|
|
|
fi
|
|
|
|
|
|
|
|
xmlstarlet ed --inplace -u "//Overlay/Position" -v "${FPS}" /storage/.config/Cemu/settings.xml
|
|
|
|
xmlstarlet ed --inplace -u "//emulated_controller/type" -v "${CON}" /storage/.config/Cemu/controllerProfiles/controller0.xml
|
2023-01-08 11:19:57 +00:00
|
|
|
|
2023-01-08 00:33:11 +00:00
|
|
|
sed -i "s#<fullscreen>.*</fullscreen>#<fullscreen>true</fullscreen>#g" .config/Cemu/settings.xml
|
2023-01-07 23:34:43 +00:00
|
|
|
sed -i "s#<TVDevice>.*</TVDevice>#<TVDevice>$(pactl get-default-sink)</TVDevice>#g" .config/Cemu/settings.xml
|
|
|
|
|
|
|
|
# Run the emulator
|
2023-01-08 12:28:42 +00:00
|
|
|
cemu -g "$@"
|
2023-01-07 23:34:43 +00:00
|
|
|
rr_audio.sh alsa
|