distribution/packages/games/emulators/lzdoom/sources/start_lzdoom.sh

55 lines
1.2 KiB
Bash
Raw Normal View History

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/351ELEC)
. /etc/profile
. /etc/os-release
EE_DEVICE=${HW_DEVICE}
RUN_DIR="/storage/roms/doom"
CONFIG="/storage/.config/game/lzdoom/lzdoom.ini"
2022-02-05 14:23:32 +00:00
SAVE_DIR="/storage/roms/gamedata/lzdoom"
if [ ! -L "/storage/.config/lzdoom" ]; then
ln -sf "/storage/.config/game/lzdoom" "/storage/.config/lzdoom"
2022-02-05 14:23:32 +00:00
fi
if [ ! -f "/storage/.config/game/lzdoom/lzdoom.ini" ]; then
cp -rf /usr/config/game/lzdoom/lzdoom.ini /storage/.config/game/lzdoom/
2022-02-05 14:23:32 +00:00
fi
mkdir -p ${SAVE_DIR}
2022-08-23 16:53:40 +00:00
params=(
"-config" "${CONFIG}"
"-savedir" "${SAVE_DIR}"
"-width" "1152"
"-height" "1920"
"+vid_fps" "1"
"+cl_capfps" "0"
"+vid_renderer" "0"
"+vid_glswfb" "0"
)
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
2022-08-23 16:53:40 +00:00
if [ "${EXT}" == "doom" ]; then
2022-02-05 14:23:32 +00:00
dos2unix "${1}"
while IFS== read -r key value; do
2022-08-23 16:53:40 +00:00
if [ "${key}" == "IWAD" ]; then
params+=("-iwad" "${value}")
2022-02-05 14:23:32 +00:00
fi
2022-08-23 16:53:40 +00:00
if [ "${key}" == "MOD" ]; then
params+=("-file" "${value}")
2022-02-05 14:23:32 +00:00
fi
done <"${1}"
2022-02-05 14:23:32 +00:00
else
2022-08-23 16:53:40 +00:00
params+=("-iwad" "${1}")
2022-02-05 14:23:32 +00:00
fi
cd "${RUN_DIR}"
2022-08-23 16:53:40 +00:00
/usr/bin/lzdoom "${params[@]}" >/var/log/lzdoom.log 2>&1