2022-02-05 14:23:32 +00:00
|
|
|
#!/usr/bin/bash
|
|
|
|
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
# Copyright (C) 2021-present 351ELEC (https://github.com/351ELEC)
|
|
|
|
|
|
|
|
. /etc/profile
|
|
|
|
. /etc/os-release
|
|
|
|
|
|
|
|
EE_DEVICE=${HW_DEVICE}
|
|
|
|
RUN_DIR="/storage/roms/doom"
|
2022-02-27 02:40:30 +00:00
|
|
|
CONFIG="/storage/.config/game/gzdoom/gzdoom.ini"
|
2022-02-05 14:23:32 +00:00
|
|
|
SAVE_DIR="/storage/roms/gamedata/gzdoom"
|
|
|
|
|
|
|
|
if [ ! -L "/storage/.config/gzdoom" ]
|
|
|
|
then
|
2022-02-27 02:40:30 +00:00
|
|
|
ln -sf "/storage/.config/game/gzdoom" "/storage/.config/gzdoom"
|
2022-02-05 14:23:32 +00:00
|
|
|
fi
|
|
|
|
|
2022-02-27 02:40:30 +00:00
|
|
|
if [ ! -f "/storage/.config/game/gzdoom/gzdoom.ini" ]
|
2022-02-05 14:23:32 +00:00
|
|
|
then
|
2022-02-27 02:40:30 +00:00
|
|
|
cp -rf /usr/config/game/gzdoom/gzdoom.ini /storage/.config/game/gzdoom/
|
2022-02-05 14:23:32 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p ${SAVE_DIR}
|
|
|
|
|
|
|
|
params=" -config ${CONFIG} -savedir ${SAVE_DIR}"
|
2022-02-12 22:49:55 +00:00
|
|
|
params+=" +gl_es 1 +vid_preferbackend 3 +cl_capfps 0 +vid_fps 1"
|
2022-02-05 14:23:32 +00:00
|
|
|
|
|
|
|
# EXT can be wad, WAD, iwad, IWAD, pwad, PWAD or doom
|
|
|
|
EXT=${1#*.}
|
|
|
|
|
|
|
|
# If its not a simple wad (extension .doom) read the file and parse the data
|
|
|
|
if [ ${EXT} == "doom" ]; then
|
|
|
|
dos2unix "${1}"
|
|
|
|
while IFS== read -r key value; do
|
|
|
|
if [ "$key" == "IWAD" ]; then
|
|
|
|
params+=" -iwad $value"
|
|
|
|
fi
|
|
|
|
if [ "$key" == "MOD" ]; then
|
|
|
|
params+=" -file $value"
|
|
|
|
fi
|
|
|
|
done < "${1}"
|
|
|
|
else
|
|
|
|
params+=" -iwad ${1}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "${RUN_DIR}"
|
|
|
|
LD_PRELOAD=/usr/lib/libSDL2-2.0.so.0.14.0 /usr/bin/gzdoom ${params} >/tmp/logs/gzdoom.log 2>&1
|