GZDOOM: enhanced script

This commit is contained in:
XargonWan 2023-11-25 00:13:07 +01:00
parent 3dbfaf48df
commit fa1030ee17

View file

@ -2,6 +2,12 @@
LOG_FILE="$rdhome/.logs/gzdoom.log" LOG_FILE="$rdhome/.logs/gzdoom.log"
if [ -e "$LOG_FILE" ]; then
rm "$LOG_FILE"
fi
echo "RetroDECK GZDOOM wrapper init." | tee -a "$LOG_FILE"
# List of IWAD files # List of IWAD files
IWAD_FILES=("DOOM1.WAD" "DOOM.WAD" "DOOM2.WAD" "DOOM2F.WAD" "DOOM64.WAD" "TNT.WAD" IWAD_FILES=("DOOM1.WAD" "DOOM.WAD" "DOOM2.WAD" "DOOM2F.WAD" "DOOM64.WAD" "TNT.WAD"
"PLUTONIA.WAD" "HERETIC1.WAD" "HERETIC.WAD" "HEXEN.WAD" "HEXDD.WAD" "PLUTONIA.WAD" "HERETIC1.WAD" "HERETIC.WAD" "HEXEN.WAD" "HEXDD.WAD"
@ -10,11 +16,22 @@ IWAD_FILES=("DOOM1.WAD" "DOOM.WAD" "DOOM2.WAD" "DOOM2F.WAD" "DOOM64.WAD" "TNT.WA
"doom_complete.pk3" # this includes them all "doom_complete.pk3" # this includes them all
) )
# Convert file name to uppercase for case-insensitive comparison echo "Trying to load \"$1\"." | tee -a "$LOG_FILE"
provided_file=$(echo "$1" | tr '[:lower:]' '[:upper:]')
if [[ " ${IWAD_FILES[@]} " =~ " $provided_file " ]]; then if [ ! -e "$1" ]; then
gzdoom +fluid_patchset /app/share/sounds/sf2/gzdoom.sf2 -config /var/config/gzdoom/gzdoom.ini -iwad "$1" >> "$LOG_FILE" 2>&1 echo "$1 not found. Quitting." | tee -a "$LOG_FILE"
exit 0
fi
filename=$(basename "$1") # Extracts only the filename from the full path
shopt -s nocasematch # Enable case-insensitive matching
if [[ "${IWAD_FILES[@]}" =~ "$filename" ]]; then
type="iwad"
else else
gzdoom +fluid_patchset /app/share/sounds/sf2/gzdoom.sf2 -config /var/config/gzdoom/gzdoom.ini -file "$1" >> "$LOG_FILE" 2>&1 type="file"
fi fi
shopt -u nocasematch # Disable case-insensitive matching after use
echo "Found $type: $1, loading it." | tee -a "$LOG_FILE"
gzdoom +fluid_patchset /app/share/sounds/sf2/gzdoom.sf2 -config /var/config/gzdoom/gzdoom.ini -$type "$1" | tee -a "$LOG_FILE"