RetroDECK/config/gzdoom/gzdoom.sh
XargonWan 7ef3628995
feat/lighter manifest (#844)
* ES-DE: outsourced

* RetroArch: migrated to AppImage

* XEMU: migrated to AppImage

* MELONDS: migrated to AppImage

* RPCS3: migrated to AppImage

* MANIFEST: avoid overwriting native libraries

* MANIFEST: fixing ES-DE

* MANIFEST: fixed and normalized /app with FLATPAK_DEST

* MANIFEST: cleanup

* MANIFEST: fixed RetroArch

* PPSSPP: added wanted sdl module

* ES-DE: moved repo

* PPSSPP: outsourced

* PPSSPP: fixed link

* MANIFEST: fixing copy actions

* PCSX2: removing troublesome file

* DOLPHIN: outsourced

* SOLARUS: outsourced

* MANIFEST: lowercased rpcs3 sha

* MANIFEST: trying to figure out automation_task_list

* MANIFEST: fixed primehack placeholders

* REVERT ME: RUNNER CHANGED

* XEMU: moved on the bottom just to see if something changes

* DUCKSTATION: wrong cp target

* MANFEST: moved thir party libraries in /app/usr/local/lib

* MANFEST: removing dolphin debug libraries

* MANFEST: removing primehack debug libraries

* MANFEST: removing primehack pkgconfig libraries

* MANFEST: removing cemu lib

* SOLARUS: removing errored libs

* MAME: reverted to its original state as it's not coming with libraries

* RYUJINX: fixing chmod command

* GZDOOM: outsourced

* MANIFEST: added debug for checking out where tf is our icon

* Submodules cleanup

* GZDOOM: cleanup

* FRAMEWORK: moved third party libs into /app/retrodeck/lib

* MANIFEST: added retrodeck-pre-build commands

* MANIFEST: module renamed

* ES-DE: re-removed 'files/lib/girepository-1.0'

* GLOBAL: pathing the retrodeck components provided libraries

* RPCS3: moved bufgix in the proper module

* MANIFEST: moved component libraries into /app/retrodeck/lib

* MANIFEST: removing some debug cleanups

* MANIFEST: desktop file don't need to be executable

* ES-DE: re-adding libpoppler

* ES--DE: moved to the end to overwrite older libraries

* RYUJINX: fixed manifest

* MANIFEST: injecting needed libraries and discarding the troublesome ones

* MANIFEST: injecting needed libraries and discarding the troublesome ones - adding more

* MelonDS: outsourced but self built in QT6

* MANIFEST: automated the third party libs manager

* MANIFEST: fixed melonds build

* Ryujinx: downgraded to the older but working version

* MANIFEST: removed debug code

* WORKFLOW: running on self-hosted again

* MANIFEST: including debug and pkgconfig's librareis

* MANIFEST: removing pkgconfig's librareis

* MANIFEST: cannot move so copy and remove

* MANIFEST: cannot move so copy and remove - fix

* Toying with automation file to make it work again

* PRE_BUILD_AUTOMATION: testing a different script

* PRE_BUILD_AUTOMATION: adding new sha function

* MAME: fixing link

* MANIFEST: tweaks

* ATL: fixing ES-DE entry

* PPSSPP: fixed hash

* SOLARUS: fixing debug libs copy command

* APDATA: updated

* SOLARUS: that's not the library you're looking for

* GZDOOM: removing debug even here

* Revamped codename wordlist

* MANIFEST: following symlinks during library copy

* WORKFLOW: moving down the artifact preparation for fltahub as we don't even need it in cooker

* Manually adding missing libraries

* More codenames

* CEMU: added wrapper +  RPCS3 fixes

* THE GREAT FOLDER MOVE (aka let's see how much things I can break in a single commit)

* emu: fixed dest filename for the wrapper

* Cemu: fixing wrapper installation

* MANIFEST: trying to add LLVM to solve PCSX2, Duckstation issues

* MANIFEST: adding llvm doesn't change the situation, removed

* MANIFEST: trying to add vulkan

* MANIFEST: trying to add vulkan - removed as it should be already in (and that's broken)

* VULKAN: testing some libraries

* VULKAN: trying to add shaderc

* Manifest: renaming es-de module to stick with the repo name for updating purposes

* Migrated to the new latest links

* MAME: frixed url

* PCSX2: updated to 2.1.55

* Reverting workfolw edits

* WORKFLOW: targetting the old repo for the release

* WORKFLOW: updated some actions to a newever version to avoid deprecation at the end of the year

* MISSING_LIBS: trying to fetch libshaderc

* MAIN_WORKLFOW: updating actions versions [skip ci]
2024-08-05 03:45:21 +02:00

111 lines
3.3 KiB
Bash

#!/bin/bash
source /app/libexec/logger.sh
# Define the IWAD files list
IWAD_FILES=("DOOM1.WAD" "DOOM.WAD" "DOOM2.WAD" "DOOM2F.WAD" "DOOM64.WAD" "TNT.WAD"
"PLUTONIA.WAD" "HERETIC1.WAD" "HERETIC.WAD" "HEXEN.WAD" "HEXDD.WAD"
"STRIFE0.WAD" "STRIFE1.WAD" "VOICES.WAD" "CHEX.WAD"
"CHEX3.WAD" "HACX.WAD" "freedoom1.wad" "freedoom2.wad" "freedm.wad"
"doom_complete.pk3"
)
# Function to check if a file is an IWAD
is_iwad() {
local file="$1"
local lowercase_file="$(basename "${file,,}")"
for iwad in "${IWAD_FILES[@]}"; do
if [[ "${iwad,,}" == "$lowercase_file" ]]; then
echo "true"
return
fi
done
echo "false"
}
# Function to search for files recursively
search_file_recursive() {
local file="$1"
local directory="$2"
local found_file=""
# Check if the file exists in the current directory
if [[ -e "$directory/$file" ]]; then
found_file="$directory/$file"
else
# Search recursively
local lowercase_file="$(echo "$file" | tr '[:upper:]' '[:lower:]')"
found_file=$(find "$directory" -type f -iname "$lowercase_file" | head -n 1)
fi
echo "$found_file"
}
# Main script
log "[INFO] RetroDECK GZDOOM wrapper init"
# Check if $1 is not a .doom file
if [[ "${1##*.}" != "doom" ]]; then
# Check if the file is in the IWAD list
if [[ $(is_iwad "$1") == "true" ]]; then
command="gzdoom -config /var/config/gzdoom/gzdoom.ini -iwad $1"
else
command="gzdoom -config /var/config/gzdoom/gzdoom.ini -file $1"
fi
# Log the command
log i "Loading: \"$1\""
log i "Executing command \"$command\""
# Execute the command
eval "$command"
# Check if $1 is a .doom file
else
doom_file="$1"
log i "Found a doom file: \"$1\""
# Check if the .doom file exists
if [[ ! -e "$doom_file" ]]; then
log e "doom file not found in \"$doom_file\""
rd_zenity --error --no-wrap \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK" \
--text="File \"$doom_file\" not found. Quitting."
exit 1
fi
# Read the .doom file and compose the command
command="gzdoom -config /var/config/gzdoom/gzdoom.ini"
while IFS= read -r line; do
# Search for the file recursively
found_file=$(search_file_recursive "$line" "$(dirname "$doom_file")")
# If the file is not found, exit with an error
if [[ -z "$found_file" ]]; then
log "[ERROR] File not found in \"$line\""
rd_zenity --error --no-wrap \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
--title "RetroDECK" \
--text="File \"$doom_file\" not found. Quitting."
exit 1
fi
# Check if the file is an IWAD
if [[ $(is_iwad "$found_file") == "true" ]]; then
command+=" -iwad $found_file"
log i "Appending the param \"-iwad $found_file\""
else
command+=" -file $found_file"
log i "Appending the param \"-file $found_file\""
fi
done < "$doom_file"
# Log the command
log i "Executing command \"$command\""
# Execute the command
eval "$command"
fi