From 7011fb236152a26b70601d146b193614f732f2c3 Mon Sep 17 00:00:00 2001 From: XargonWan <6771419+XargonWan@users.noreply.github.com> Date: Sun, 4 Sep 2022 14:31:08 +0200 Subject: [PATCH] DoomWolf: copypasted parsers from AmberELEC --- emu-configs/parsers/ecwolf.sh.todo | 66 +++++++++++++++++++++++++ emu-configs/parsers/gzdoom.sh.todo | 79 ++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 emu-configs/parsers/ecwolf.sh.todo create mode 100644 emu-configs/parsers/gzdoom.sh.todo diff --git a/emu-configs/parsers/ecwolf.sh.todo b/emu-configs/parsers/ecwolf.sh.todo new file mode 100644 index 00000000..5b1629ec --- /dev/null +++ b/emu-configs/parsers/ecwolf.sh.todo @@ -0,0 +1,66 @@ +#!/bin/bash + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2021-present Shanti Gilbert (https://github.com/shantigilbert) +# Copyright (C) 2021-present AmberELEC (https://github.com/AmberELEC) + +. /etc/profile + +EE_DEVICE=$(cat /storage/.config/.OS_ARCH) +CONFIG_DIR="/storage/.config/distribution/ecwolf" +CONFIG_FILE="${CONFIG_DIR}/ecwolf.cfg" +SAVE_DIR="/storage/roms/gamedata/ecwolf" + +if [ ! -L "/storage/.config/ecwolf" ] +then + ln -sf "/storage/.config/distribution/ecwolf" "/storage/.config/ecwolf" +fi + +if [ ! -f "/storage/.config/distribution/ecwolf/ecwolf.cfg" ] +then + cp -rf /usr/config/distribution/ecwolf/ecwolf.cfg /storage/.config/distribution/ecwolf/ +fi + +mkdir -p ${SAVE_DIR} + +params=" --config ${CONFIG_FILE} --savedir ${SAVE_DIR}" + +# data can be SD2 SD3 SOD WL6 or N3D and it's passed as the ROM +DATA=${1#*.} + +# If its a mod (extension .ecwolf) read the file and parse the data +if [ ${DATA} == "ecwolf" ]; then + dos2unix "${1}" + while IFS== read -r key value; do + if [ "$key" == "DATA" ]; then + params+=" --data $value" + fi + if [ "$key" == "PK3" ]; then + params+=" --file $value" + fi + if [ "$key" == "PK3_1" ]; then + params+=" --file $value" + fi + if [ "$key" == "PK3_2" ]; then + params+=" --file $value" + fi + if [ "$key" == "PK3_3" ]; then + params+=" --file $value" + fi + if [ "$key" == "PK3_4" ]; then + params+=" --file $value" + fi + done < "${1}" +else + params+=" --data ${DATA}" +fi + +if [[ "$EE_DEVICE" == RG351P ]]; then + params+=" --res 480 320" +fi +if [[ "$EE_DEVICE" == RG351V ]] || [[ "$EE_DEVICE" == RG351MP ]]; then + params+=" --res 640 480" +fi + +cd "${CONFIG_DIR}" +/usr/bin/ecwolf ${params} > /tmp/logs/ecwolf.log 2>&1 \ No newline at end of file diff --git a/emu-configs/parsers/gzdoom.sh.todo b/emu-configs/parsers/gzdoom.sh.todo new file mode 100644 index 00000000..93b07b57 --- /dev/null +++ b/emu-configs/parsers/gzdoom.sh.todo @@ -0,0 +1,79 @@ +#!/usr/bin/bash + +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2021-present AmberELEC (https://github.com/AmberELEC) + +#. /etc/profile + +ROM="${1##*/}" +PLATFORM="doom" +CONF="/storage/.config/distribution/configs/distribution.conf" + +function get_setting() { + #We look for the setting on the ROM first, if not found we search for platform and lastly we search globally + PAT="s|^${PLATFORM}\[\"${ROM}\"\].*${1}=\(.*\)|\1|p" + EES=$(sed -n "${PAT}" "${CONF}" | head -1) + + if [ -z "${EES}" ]; then + PAT="s|^${PLATFORM}[\.-]${1}=\(.*\)|\1|p" + EES=$(sed -n "${PAT}" "${CONF}" | head -1) + fi + + if [ -z "${EES}" ]; then + PAT="s|^global[\.-].*${1}=\(.*\)|\1|p" + EES=$(sed -n "${PAT}" "${CONF}" | head -1) + fi + + [ -z "${EES}" ] && EES="false" +} + +# Show FPS +get_setting "show_fps" +echo ${EES} +if [ "${EES}" == "auto" ] || [ "${EES}" == "disabled" ] || [ "${EES}" == "false" ] || [ "${EES}" == "none" ] || [ "${EES}" == "0" ]; then + SHOWFPS='0' +else + SHOWFPS='1' +fi + +EE_DEVICE=$(cat /storage/.config/.OS_ARCH) +RUN_DIR="/storage/roms/doom" +CONFIG="/storage/.config/distribution/gzdoom/gzdoom.ini" +SAVE_DIR="/storage/roms/gamedata/gzdoom" + +if [ ! -L "/storage/.config/gzdoom" ] +then + ln -sf "/storage/.config/distribution/gzdoom" "/storage/.config/gzdoom" +fi + +if [ ! -f "/storage/.config/distribution/gzdoom/gzdoom.ini" ] +then + cp -rf /usr/config/distribution/gzdoom/gzdoom.ini /storage/.config/distribution/gzdoom/ +fi + +mkdir -p ${SAVE_DIR} + +params=" -config ${CONFIG} -savedir ${SAVE_DIR}" + +# 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 + +params+=" +gl_es 1 +vid_preferbackend 3 +cl_capfps 0 +vid_fps $SHOWFPS" + +cd "${RUN_DIR}" +/usr/bin/gzdoom ${params} >/tmp/logs/gzdoom.log 2>&1 \ No newline at end of file