distribution/packages/multimedia/gmu/scripts/start_gmu.sh

60 lines
1.6 KiB
Bash
Raw Normal View History

2023-07-15 23:22:41 +00:00
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
2023-07-15 23:22:41 +00:00
. /etc/profile
2023-07-17 15:35:09 +00:00
jslisten set "-HUP gmu.bin"
2023-07-15 23:22:41 +00:00
2023-07-15 23:43:20 +00:00
GMUPATH="/storage/.config/gmu"
GMUCONFIG="${GMUPATH}/gmu.conf"
GMUINPUT="${GMUPATH}/gmuinput.conf"
2023-07-15 23:22:41 +00:00
if [ -d "/storage/.local/share/gmu" ]
then
rm -rf /storage/.local/share/gmu
fi
FBHEIGHT="$(fbheight)"
FBWIDTH="$(fbwidth)"
2023-07-15 23:43:20 +00:00
if [ ! -d "${GMUPATH}" ]
then
2023-07-17 15:35:09 +00:00
mkdir -p ${GMUPATH}
2023-07-15 23:43:20 +00:00
fi
2023-07-17 15:35:09 +00:00
cp -rf /usr/config/gmu/* ${GMUPATH}
ln -sf ${GMUPATH}/playlists /storage/.local/share/gmu
2023-07-15 23:22:41 +00:00
sed -i "s~SDL.Height=.*\$~SDL.Height=${FBHEIGHT}~g" ${GMUCONFIG}
2023-07-15 23:43:20 +00:00
sed -i "s~SDL.Width=.*\$~SDL.Width=${FBWIDTH}~g" ${GMUCONFIG}
2023-07-17 15:35:09 +00:00
if (( ${FBWIDTH} <= 1024 ))
2023-07-15 23:43:20 +00:00
then
sed -i "s~default-modern-large~default-modern~g" ${GMUCONFIG}
sed -i "s~SDL.Fullscreen=.*\$~SDL.Fullscreen=no~g" ${GMUCONFIG}
2023-07-17 15:35:09 +00:00
else
sed -i "s~default-modern.*\$~default-modern-large~g" ${GMUCONFIG}
sed -i "s~SDL.Fullscreen=.*\$~SDL.Fullscreen=yes~g" ${GMUCONFIG}
2023-07-15 23:43:20 +00:00
fi
2023-07-15 23:22:41 +00:00
if [ "${1}" ]
then
PLAYLIST="-l \"${1}\""
fi
### Set up controls
for CONTROL in DEVICE_BTN_SOUTH DEVICE_BTN_EAST DEVICE_BTN_NORTH \
DEVICE_BTN_WEST DEVICE_BTN_TL DEVICE_BTN_TR \
DEVICE_BTN_TL2 DEVICE_BTN_TR2 DEVICE_BTN_SELECT \
DEVICE_BTN_START DEVICE_BTN_MODE DEVICE_BTN_THUMBL \
DEVICE_BTN_THUMBR DEVICE_BTN_DPAD_UP DEVICE_BTN_DPAD_DOWN \
DEVICE_BTN_DPAD_LEFT DEVICE_BTN_DPAD_RIGHT
do
sed -i "s~@${CONTROL}@~${!CONTROL}~g" ${GMUINPUT}
done
2023-07-15 23:22:41 +00:00
cd /usr/local/share/gmu
/usr/local/bin/gmu.bin -d /usr/local/etc/gmu -c /storage/.config/gmu/gmu.conf ${PLAYLIST}