• articles
  • retro
  • A guide for using Dosemu2 to play Door Games on Mystic BBS
  • A guide for using Dosemu2 to play Door Games on Mystic BBS

    Author:
    Published:

    Adding Mystic BBS DOS Doors

    And now we are to the point we have all been waiting for, adding the door games.

    Based on my research the process of launching Doors in the Mystic BBS has been the same since, forever and why reinvent the wheel when you can take a wheel, fix its problems and use that instead. 

    It worked for Ferruccio Lamborghini so, why not us.

    We will be cribbing off a guide that was created by deadbeatz along with a package from demonic productions talking about running doors using Dosemu and Qemu.  These guides all reference deadbeatz github repository.

    https://github.com/deadbeatz/mystic_a45

    For the most part we will be following these guides, they work well for Mystic but, I found some fundamental flaws that were rather easy to fix.

    Let’s begin

    In the github the only thing we care about is what is in the “setup/” directory.  Grab DRK200.zip and rundoor.sh

    • Create a directory in your Mystic folder called “doors”
    • Extract the contents of drk200.zip into a folder called “darkness”
    • Save rundoor.sh file to the doors/ directory
    • Set the execute flag “sudo chmod +x rundoor.sh”

    Next we will focus on rundoor.sh.  Personally, I like this approach however the author is taking some rather unnecessary steps.  For reference my script is below complete with my notes

    If you are comparing notes against the original, I am ditching the random filename generation and calling the launch file “external.bat”.  I am also not cleaning up after myself in proper ADHD fashion.  This is not because I’m a slob but rather so we can debug things later if needed.

    I have also changed the command line for how Dosemu2 is loaded. 

    The new command line is enabling a virtual com port and disabling video output.  By doing this here we no longer need to load a custom config if we need to load up Dosemu2.  I also moved the boot.log to the node/temp directory so we can debug node issues if they come up.

    The final bits of the command line suppress the normal Dosemu2 boot text. 

    rundoor.sh

    #!/bin/bash
    trap '' 2
    # $1 Node number
    # $2 Door Call Name
    # $3 Doorfile type :1 DOOR.SYS :2 CHAIN.TXT
    # Note: adjust paths to match "your" installation, I have a dedicated mystic user and will be using their $HOME directory 
    stty cols 80 rows 25
    MYNAME=$(sed -n '36p' /home/mystic/temp$1/DOOR.SYS)
    BBSROOT=/home/mystic
    NODE=$BBSROOT/temp$1

    # Convert DOOR.SYS to DOS line endings
    unix2dos $NODE/DOOR.SYS 2>/dev/null

    # Define root directory for DOSEMU hdd
    DROOT=$BBSROOT/.dosemu/drive_c/nodes/temp$1

    # Define node directory inside DOSEMU filesystem
    cp $NODE/DOOR.SYS $DROOT/DOOR.SYS

    # Generate a starting bat file for DOSEMU2
    FILE=EXTERNAL.BAT

    # Convert to lowercase for linux
    DOOR=$(echo "$2" | tr '[:upper:]' '[:lower:]')

    # --------------------------------------------------------
    # This will start DOSEMU2 - Using some inspiration from how Synchronet has things configured for DOSEMU1
    # To keep things clean the virtual com port is sent on the command line making dosemu.conf simple
    # Moved logging to the .dosemu temp$1 folder
    # 2>/dev/null will suppress the normal DOSEMU2 bootup text.
    # No need to remove the generated files, they can be used for debugging later, if needed.
    # Many door games have a hard coded drop file location, mounting the $NODE folder as drive D: to make this easy
    # --------------------------------------------------------
    run_batch(){
        # Arg 1 = NODE
        # Arg 2 = FILE (batch filename)
        # Arg 3 = DROOT (dosemu node folder)
     # When running Comcom64 you can map and remove drives at runtime
        #/usr/bin/dosemu -d"$NODE/" -I"video { none }" -I"serial { virtual com 1 }" -E"C:\\NODES\\TEMP$1\\$2" -o"$DROOT/dosemu_boot.log" 1>/dev/null  2>&1
     # When running Freedos you need to lredir drives using a script at boot
         /usr/bin/dosemu -I"video { none }" -I"serial { virtual com 1 }" -E"C:\\NODES\\TEMP$1\\$2" -o"$DROOT/dosemu_boot.log" 1>/dev/null  2>&1
    #  rm $3/$2
    #    rm $3/DOOR.SYS
    }

    # --------------------------------------------------------
    # Case statements for loading each door
    # Define the command line required to launch the door here, it will be written to $FILE when selected.
    # This could be cleaner however, it is only referenced once so why bother
    #
    # I prefer to keep doors with the main BBS code, to enable this I defined a symbolic link to the doors folder
    # e.g. ln -s /home/mystic/doors/ /home/mystic/.dosemu/drive_c/doors
    # Once DOSEMU2 launches it will see c:\doors\ like before but outside the .dosemu folder
    #
    # If your install cannot find the correct .dosemu folder, or tries to create a folder "/root/" You may need to have 
    # MIS running as your Mystic BBS user.  To enable privileged port access run the following command.
    # sudo setcap 'cap_net_bind_service=+ep' /home/mystic/mis 
    # Then change the user= in your systemctl mis.system file, reload-daemon, restart mis
    #
    # ex doors/rundoor.sh %3 $DOOR 1
    # --------------------------------------------------------
    case "$DOOR" in
        dark)
            echo -e '\r@echo off \r' > $DROOT/$FILE
            echo -e '@lredir -f D: '$NODE' >NUL \r' >> $DROOT/$FILE
      echo -e 'c: \r' >> $DROOT/$FILE
            echo -e 'cd c:\\doors\\darkness\\ \r' >> $DROOT/$FILE
            echo -e 'dark16 /n'$1' \r' >> $DROOT/$FILE
            echo -e 'exitemu' >> $DROOT/$FILE
            unix2dos $DROOT/$FILE 2>/dev/null
            run_batch $1 $FILE $DROOT
            ;;
        overkill)
            echo -e '\r@echo off \r' > $DROOT/$FILE
            echo -e '@lredir -f D: '$NODE' >NUL \r' >> $DROOT/$FILE
            echo -e 'c: \r' >> $DROOT/$FILE
            echo -e 'cd c:\\doors\\ooii_120\\ \r' >> $DROOT/$FILE
            echo -e 'ooinfo 2 d: \r' >> $DROOT/$FILE
            echo -e 'maintoo \r' >> $DROOT/$FILE
            echo -e 'ooii \r' >> $DROOT/$FILE
            echo -e 'exitemu' >> $DROOT/$FILE
            unix2dos $DROOT/$FILE 2>/dev/null
            run_batch $1 $FILE $DROOT
            ;;
     netrunner)
            echo -e '\r@echo off \r' > $DROOT/$FILE
            echo -e '@lredir -f D: '$NODE' >NUL \r' >> $DROOT/$FILE
            echo -e 'c: \r' >> $DROOT/$FILE
            echo -e 'cd c:\\doors\\netrun\\ \r' >> $DROOT/$FILE
      echo -e 'netrun.exe d:\\door.sys PORT:F:1 \r' >> $DROOT/$FILE
            echo -e 'exitemu' >> $DROOT/$FILE
            unix2dos $DROOT/$FILE 2>/dev/null
            run_batch $1 $FILE $DROOT
            ;;
     tw2002)
            echo -e '\r@echo off \r' > $DROOT/$FILE
            echo -e '@lredir -f D: '$NODE' >NUL \r' >> $DROOT/$FILE
            echo -e 'c: \r' >> $DROOT/$FILE
            echo -e 'cd c:\\doors\\tw2002\\ \r' >> $DROOT/$FILE
      echo -e 'tw2002!.exe twnode='$1' \r' >> $DROOT/$FILE
            echo -e 'exitemu' >> $DROOT/$FILE
            unix2dos $DROOT/$FILE 2>/dev/null
            run_batch $1 $FILE $DROOT
            ;;
     linksgolf)
            echo -e '\r@echo off \r' > $DROOT/$FILE
            echo -e '@lredir -f D: '$NODE' >NUL \r' >> $DROOT/$FILE
            echo -e 'c: \r' >> $DROOT/$FILE
            echo -e 'cd c:\\doors\\links60\\ \r' >> $DROOT/$FILE
      echo -e 'golf.exe golf.cfg \r' >> $DROOT/$FILE
            echo -e 'exitemu' >> $DROOT/$FILE
            unix2dos $DROOT/$FILE 2>/dev/null
            run_batch $1 $FILE $DROOT
            ;;
     murder)
            echo -e '\r@echo off \r' > $DROOT/$FILE
            echo -e '@lredir -f D: '$NODE' >NUL \r' >> $DROOT/$FILE
            echo -e 'c: \r' >> $DROOT/$FILE
            echo -e 'cd c:\\doors\\mm42\\ \r' >> $DROOT/$FILE
      echo -e 'inactive.exe \r' >> $DROOT/$FILE
      echo -e 'mm42.exe murder.cfg \r' >> $DROOT/$FILE
            echo -e 'exitemu' >> $DROOT/$FILE
            unix2dos $DROOT/$FILE 2>/dev/null
            run_batch $1 $FILE $DROOT
            ;;
     freshwater)
            echo -e '\r@echo off \r' > $DROOT/$FILE
            echo -e '@lredir -f D: '$NODE' >NUL \r' >> $DROOT/$FILE
            echo -e 'c: \r' >> $DROOT/$FILE
      echo -e 'c:\\patches\\TP7P5FIX.COM \r' >> $DROOT/$FILE
            echo -e 'cd c:\\doors\\freshwat\\ \r' >> $DROOT/$FILE
      echo -e 'fishing.exe 2 d:\\ '$1' \r' >> $DROOT/$FILE
            echo -e 'exitemu' >> $DROOT/$FILE
            unix2dos $DROOT/$FILE 2>/dev/null
            run_batch $1 $FILE $DROOT
            ;;
        *)
            echo "Invalid option"
            ;;
    esac
    trap 2

    If you want to load Dosemu2 for app configuration and testing I created an alternative version of the rundoor.sh called runcmd.sh.  This new file will emulate what rundoor.sh does, setting column width, row length without the virtual com port.

     The script is below and you launch it with the following command for node 1.

    ./runcmd.sh 1

    runcmd.sh

    #!/bin/bash
    trap '' 2

    stty cols 80 rows 25
    BBSROOT=/home/mystic
    NODE=$BBSROOT/temp$1

    # Convert DOOR.SYS to DOS line endings
    #unix2dos $NODE/DOOR.SYS 2>/dev/null

    # Define root directory for DOSEMU hdd
    DROOT=$BBSROOT/.dosemu/drive_c/nodes/temp$1

    # Define node directory inside DOSEMU filesystem
    #cp $NODE/DOOR.SYS $DROOT/DOOR.SYS

    # --------------------------------------------------------
    # This will start DOSEMU2 - Command.com
    # --------------------------------------------------------
    /usr/bin/dosemu -o"$DROOT/dosemu_boot.log"

    trap 2

    Selecting the Correct Door

    The case statement at the bottom of the script is where our batch file is generated and each section is specific to the door we want to run.

    Darkness is at the top however the order in the Case statement doesn’t matter.  Remember, this section is creating a custom batch file that will launch the door.  For instance, Darkness just wants us to load the executable while Operation Overkill wants you to identify the location of the drop file and run a maintenance script all before loading the game.

    Freshwater Fishing, my favorite bastard child, throws a Runtime Error 200 Error unless I preload the P5 patch.  The Runtime Error 200 is a speed related divide by 0 error common with early Pascal games.

    Setting up the Doors Directory

    You may have noticed I had you build the doors/ directory within the Mystic folder structure.  I did this to keep things clean and make backing everything up a little easier.  Thing is, our rundoor.sh script is looking for the doors in the C:\doors\ directory.  Like before we will create a symlink to the files we need

    ln -s /home/mystic/doors/ /home/mystic/.dosemu/drive_c/doors

    Setting up Node Access

    You may have also noticed this line in the batch file  

    echo -e '@lredir -f D: '$NODE' >NUL \r' >> $DROOT/$FILE

    This is a drive/directory redirection command that will create a new D: drive for us.  This is done dynamically so that every time the door is opened, we are looking at the correct drop file location for that specific node. 

    The original script had you copying the DOOR.SYS file, which we still do however, some doors require a different drop file format, DOOR32, CHAIN etc..  So, instead of building logic to copy “all” of these files we will just link to them. 

    When building your DOS Door configuration you will want to set the drop file location to D:\ and after that you are done.  You can see this in my Operation Overkill config in the rundoor.sh file above.

    You will also want to make sure that you create enough “temp(x)” folders in .dosemu/drive_c to accommodate how many nodes you have active in Mystic BBS.    These will be contained in “nodes/” directory, again to keep things clean and in following the original guide