GZDOOM: added .doom parser

This commit is contained in:
XargonWan 2023-11-30 09:37:26 +01:00
parent 150db046e3
commit ae4f518457
2 changed files with 21 additions and 10 deletions

View file

@ -12,7 +12,7 @@ echo "RetroDECK GZDOOM wrapper init." | tee -a "$LOG_FILE"
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"
"STRIFE0.WAD" "STRIFE1.WAD" "VOICES.WAD" "CHEX.WAD" "STRIFE0.WAD" "STRIFE1.WAD" "VOICES.WAD" "CHEX.WAD"
"CHEX3.WAD" "HACX.WAD" "freedoom1.wad" "freedoom2.wad" "freedm.wad" # unlicenced iwads "CHEX3.WAD" "HACX.WAD" "freedoom1.wad" "freedoom2.wad" "freedm.wad" # unlicensed iwads
"doom_complete.pk3" # this includes them all "doom_complete.pk3" # this includes them all
) )
@ -24,14 +24,25 @@ if [ ! -e "$1" ]; then
fi fi
filename=$(basename "$1") # Extracts only the filename from the full path filename=$(basename "$1") # Extracts only the filename from the full path
extension="${filename##*.}" # Extracts the file extension
shopt -s nocasematch # Enable case-insensitive matching if [ "$extension" == "doom" ]; then
if [[ "${IWAD_FILES[@]}" =~ "$filename" ]]; then map_file="$1"
type="iwad" iwad="-iwad $(head -n 1 "$map_file")"
file="-file $(tail -n +2 "$map_file" | sed 's/.*/-file &/')"
echo "Found a .doom file: $1, parsing it." | tee -a "$LOG_FILE"
echo "Calling GZDoom with: \"$iwad $file\"." | tee -a "$LOG_FILE"
gzdoom -config /var/config/gzdoom/gzdoom.ini $iwad $file | tee -a "$LOG_FILE"
else else
type="file" shopt -s nocasematch # Enable case-insensitive matching
fi if [[ "${IWAD_FILES[@]}" =~ "$filename" ]]; then
shopt -u nocasematch # Disable case-insensitive matching after use type="iwad"
else
type="file"
fi
shopt -u nocasematch # Disable case-insensitive matching after use
echo "Found $type: $1, loading it." | tee -a "$LOG_FILE" echo "Found $type: $1, loading it." | tee -a "$LOG_FILE"
gzdoom -config /var/config/gzdoom/gzdoom.ini -$type "$1" | tee -a "$LOG_FILE" gzdoom -config /var/config/gzdoom/gzdoom.ini -$type "$1" | tee -a "$LOG_FILE"
fi

View file

@ -511,7 +511,7 @@
<name>doom</name> <name>doom</name>
<fullname>Doom</fullname> <fullname>Doom</fullname>
<path>%ROMPATH%/doom</path> <path>%ROMPATH%/doom</path>
<extension>.desktop .iwad .IWAD .pk4 .PK4 .pk3 .PK3 .pwad .PWAD .sh .wad .WAD</extension> <extension>.doom .desktop .iwad .IWAD .pk4 .PK4 .pk3 .PK3 .pwad .PWAD .sh .wad .WAD</extension>
<command label="GZDoom (Standalone)">gzdoom.sh %ROM%</command> <command label="GZDoom (Standalone)">gzdoom.sh %ROM%</command>
<command label="PrBoom">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/prboom_libretro.so %ROM%</command> <command label="PrBoom">%EMULATOR_RETROARCH% -L %CORE_RETROARCH%/prboom_libretro.so %ROM%</command>
<!-- <command label="PrBoom+ (Standalone)">%EMULATOR_PRBOOM-PLUS% -iwad %ROM%</command> --> <!-- <command label="PrBoom+ (Standalone)">%EMULATOR_PRBOOM-PLUS% -iwad %ROM%</command> -->