GZDOOM: wrapper new logic

This commit is contained in:
XargonWan 2023-11-24 14:01:40 +01:00
parent 7187ef3f55
commit 6a9d6d4495
2 changed files with 13 additions and 40 deletions

View file

@ -1,46 +1,18 @@
#!/bin/bash #!/bin/bash
input_file="$1"
params=""
LOG_FILE="$rdhome/.logs/gzdoom.log" LOG_FILE="$rdhome/.logs/gzdoom.log"
command="gzdoom +fluid_patchset /app/share/sounds/sf2/gzdoom.sf2 -config /var/config/gzdoom/gzdoom.ini $params >> "$LOG_FILE" 2>&1"
# Function to log messages # List of IWAD files
log() { IWAD_FILES=("DOOM1.WAD" "DOOM.WAD" "DOOM2.WAD" "DOOM2F.WAD" "DOOM64.WAD" "TNT.WAD"
local message="$1" "PLUTONIA.WAD" "HERETIC1.WAD" "HERETIC.WAD" "HEXEN.WAD" "HEXDD.WAD"
local timestamp="$(date '+%Y-%m-%d %H:%M:%S')" "STRIFE0.WAD" "STRIFE1.WAD" "VOICES.WAD" "CHEX.WAD"
echo "$timestamp - $message" >> "$LOG_FILE" "CHEX3.WAD" "HACX.WAD" "freedoom1.wad" "freedoom2.wad" "freedm.wad") # unlicenced iwads
echo "$timestamp - $message"
}
# Check if the file is .wad or .WAD # Convert file name to uppercase for case-insensitive comparison
if [[ $input_file =~ \.wad$ || $input_file =~ \.WAD$ ]]; then provided_file=$(echo "$1" | tr '[:lower:]' '[:upper:]')
log "Processing file: $input_file"
# Execute the command and check for success
if exec "$command"; then
log "Command executed successfully"
else
log "Error executing command"
fi
# Check if the file is .doom if [[ " ${IWAD_FILES[@]} " =~ " $provided_file " ]]; then
elif [[ $input_file =~ \.doom$ ]]; then gzdoom +fluid_patchset /app/share/sounds/sf2/gzdoom.sf2 -config /var/config/gzdoom/gzdoom.ini -iwad "$1" >> "$LOG_FILE" 2>&1
log "Processing file: $input_file"
while IFS= read -r line; do
params+="-file $line "
log "Added -file $line to parameters"
done < "$input_file"
# Execute the command and check for success
if exec "$command"; then
log "Command executed successfully"
log "Expanded command:"
log "$command"
else
log "Error executing command"
log "Expanded command:"
log "$command"
fi
else else
echo "Unsupported file format. Please provide a .wad, .WAD, or .doom file." gzdoom +fluid_patchset /app/share/sounds/sf2/gzdoom.sf2 -config /var/config/gzdoom/gzdoom.ini -file "$1" >> "$LOG_FILE" 2>&1
log "Unsupported file format: $input_file"
fi fi

View file

@ -1356,8 +1356,9 @@ modules:
- ln -s /app/bin/retrodeck.sh /app/bin/retrodeck - ln -s /app/bin/retrodeck.sh /app/bin/retrodeck
- ln -s /app/tools/configurator.sh /app/bin/configurator - ln -s /app/tools/configurator.sh /app/bin/configurator
# DOOM/WOLF parsers # GZDOOM wrapper
- cp emu-configs/gzdoom/*.sh ${FLATPAK_DEST}/bin - cp emu-configs/gzdoom/gzdoom.sh ${FLATPAK_DEST}/bin/gzdoom.sh
- chmod +x ${FLATPAK_DEST}/bin/gzdoom.sh
sources: sources:
- type: git - type: git