Skip to content

doom loader

Jason Tomsic edited this page Jul 12, 2021 · 4 revisions

notes

  • my goal was to allow the configuration of doom games without using .sh files, like with 351elec .doom files
    • .sh files can be esoteric and hard to remember the options
    • they can be broken if the lzdoom binary file moves
  • my secondary goal was to include some unsupported features that are missing in 351elec
    • .deh files, config files, and save folders are not supported in 351 elec
  • I also wanted to preserve the ability to load the .sh and .wad files in the doom folder so I won't break backwards compatibility

setup the scripts

  1. modify the doom entry in /etc/emulationstation/es_systems.cfg:

    • add .doom to the <extensions> element
  2. modify add a .sh file /usr/local/bin/doom.sh:

    • NOTE: this will require sudo permissions
    • add the following code before the else line:
elif [ ".$(echo "$1"| cut -d. -f2)" == ".doom" ] || [ ".$(echo "$1"| cut -d. -f2)" == ".DOOM" ]; then
  IWAD=""; MODS=""; DEH=""; SAVE=""; CONF=""; PARAMS=""; DOOM_BASE_DIR="/roms/doom/"
  dos2unix "${1}"
  while IFS== read -r key value; do
    if [ "$key" == "IWAD" ]; then IWAD+=" ${DOOM_BASE_DIR}${value}"
    elif [ "$key" == "MOD" ]; then MODS+=" ${DOOM_BASE_DIR}${value}"
    elif [ "$key" == "CONF" ]; then CONF+=" ${DOOM_BASE_DIR}${value}"
    elif [ "$key" == "SAVE" ]; then SAVE+=" ${DOOM_BASE_DIR}${value}"
    elif [ "$key" == "DEH" ]; then DEH+=" ${DOOM_BASE_DIR}${value}"
    fi
  done < "${1}"
  if [ "$IWAD" ]; then PARAMS+=" -iwad ${IWAD:1}"; fi
  if [ "$MODS" ]; then PARAMS+=" -file ${MODS:1}"; fi
  if [ "$SAVE" ]; then PARAMS+=" -savedir ${SAVE:1}"; fi
  if [ "$CONF" ]; then PARAMS+=" -config ${CONF:1}"; fi
  if [ "$DEH" ]; then PARAMS+=" -deh ${DEH:1}"; fi
  /opt/lzdoom/lzdoom ${PARAMS:1} 2>&1 | tee -a ~/.emulationstation/last_launch.log

format of .doom files in /roms/doom

The .doom files are easy to update and figure out. Each line has a key and a value:

IWAD=iwads/doom.wad
MOD=mods/batman/batman.wad
MOD=mods/batman/batman.pk3
DEH=mods/batman/batman.deh
DEH=mods/batman/weapons.deh
CONF=mods/batman/batman.ini
SAVE=mods/batman
-- end --

The values (on the right of the =) all point to files or folders relative to the /roms/doom folder. So in this example, it's pulling the doom.wad from /roms/doom/iwads/doom.wad, and all other files it's pulling from /roms/doom/mods/batman/<file>.

The keys (on the left of the =) can be the following:

  • IWAD: the .wad file that is used for the base of the game
  • MOD: (optional) one or many .wad or .pk3 files for the mod. order is preserved
  • DEH: (optional) one or many .deh files for the mod. order is preserved
  • CONF: (optional) a .ini file if the mod needs an alternate config
  • SAVE: (optional) a folder where the saves will be stored for this mod

optional changes

  • you may want to remove the .wad and .WAD from /etc/emulationstation/es_systems.cfg
    • this will hide the iwads and mod files from view, along with the folders that contain them