<metaname="description"content="Local Doors ENiGMA½ has many ways to add doors to your system. In addition to the many built in door server modules, local doors are of course also supported using the ! The abracadabra module!"/>
<metaproperty="og:description"content="Local Doors ENiGMA½ has many ways to add doors to your system. In addition to the many built in door server modules, local doors are of course also supported using the ! The abracadabra module!"/>
{"mainEntityOfPage":{"@type":"WebPage","@id":"/enigma-bbs/modding/local-doors.html"},"description":"Local Doors ENiGMA½ has many ways to add doors to your system. In addition to the many built in door server modules, local doors are of course also supported using the ! The abracadabra module!","url":"/enigma-bbs/modding/local-doors.html","@type":"BlogPosting","publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"/enigma-bbs/assets/images/enigma-logo.png"}},"headline":"Local Doors","dateModified":"2022-08-09T21:38:25+00:00","datePublished":"2022-08-09T21:38:25+00:00","@context":"https://schema.org"}</script>
<p>ENiGMA½ has many ways to add doors to your system. In addition to the <ahref="/enigma-bbs/modding/door-servers.html">many built in door server modules</a>, local doors are of course also supported using the ! The <codeclass="language-plaintext highlighter-rouge">abracadabra</code> module!</p>
<p><imgclass="emoji"title=":information_source:"alt=":information_source:"src="https://github.githubassets.com/images/icons/emoji/unicode/2139.png"height="20"width="20"> See also <ahref="https://medium.com/retro-future/lets-add-a-dos-game-to-enigma-1-2-41f257deaa3c">Let’s add a DOS door to Enigma½ BBS</a> by Robbie Whiting for a great writeup on adding doors!</p>
<p>The <codeclass="language-plaintext highlighter-rouge">abracadabra</code> module provides a generic and flexible solution for many door types. Through this module you can execute native processes & scripts directly, and perform I/O through standard I/O (stdio) or a temporary TCP server.</p>
<h3id="configuration">Configuration</h3>
<p>The <codeclass="language-plaintext highlighter-rouge">abracadabra</code><codeclass="language-plaintext highlighter-rouge">config</code> block can contain the following members:</p>
<td>Specifies the type of dropfile to generate (See <strong>Dropfile Types</strong> below). Can be omitted or set to <codeclass="language-plaintext highlighter-rouge">none</code>.</td>
<td>Array of argument(s) to pass to <codeclass="language-plaintext highlighter-rouge">cmd</code>. See <strong>Argument Variables</strong> below for information on variables that can be used here.</td>
<td>Sets the Current Working Directory (CWD) for <codeclass="language-plaintext highlighter-rouge">cmd</code>. Defaults to the directory of <codeclass="language-plaintext highlighter-rouge">cmd</code>.</td>
<td>How to process input/output (I/O). Can be <codeclass="language-plaintext highlighter-rouge">stdio</code> or <codeclass="language-plaintext highlighter-rouge">socket</code>. When using <codeclass="language-plaintext highlighter-rouge">stdio</code>, I/O is handled via standard stdin/stdout. When using <codeclass="language-plaintext highlighter-rouge">socket</code> a temporary socket server is spawned that can be connected back to. The server listens on localhost on <codeclass="language-plaintext highlighter-rouge">{srvPort}</code> (See <strong>Argument Variables</strong> below for more information). Default value is <codeclass="language-plaintext highlighter-rouge">stdio</code>.</td>
<td>Sets the <strong>door’s</strong> encoding. Defaults to <codeclass="language-plaintext highlighter-rouge">cp437</code>. Linux binaries often produce <codeclass="language-plaintext highlighter-rouge">utf8</code>.</td>
</tr>
</tbody>
</table>
<h4id="dropfile-types">Dropfile Types</h4>
<p>Dropfile types specified by <codeclass="language-plaintext highlighter-rouge">dropFileType</code>:</p>
<td>Full path to generated dropfile. The system places dropfiles in the path set by <codeclass="language-plaintext highlighter-rouge">paths.dropFiles</code> in <codeclass="language-plaintext highlighter-rouge">config.hjson</code>.</td>
<ahref="https://www.npmjs.com/package/sanitize-filename">Sanitized</a> username. Safe for filenames, etc. If the full username is sanitized away, this will resolve to something like “user_1234”.</td>
<td>Temporary server port when <codeclass="language-plaintext highlighter-rouge">io</code> is set to <codeclass="language-plaintext highlighter-rouge">socket</code>.</td>
<p>Example <codeclass="language-plaintext highlighter-rouge">args</code> member using some variables described above:</p>
<pre><codeclass="language-hjson">args: [
"-D", "{dropFilePath}",
"-N", "{node}"
"-U", "{userId}"
]
</code></pre>
<h3id="dosemu-with-abracadabra">DOSEMU with abracadabra</h3>
<p><ahref="http://www.dosemu.org/">DOSEMU</a> can provide a good solution for running legacy DOS doors when running on Linux systems. For this, we will create a virtual serial port (COM1) that communicates via stdio.</p>
<p>As an example, here are the steps for setting up Pimp Wars:</p>
<p>First, create a <codeclass="language-plaintext highlighter-rouge">dosemu.conf</code> file with the following contents:</p>
<p>The line <codeclass="language-plaintext highlighter-rouge">$_com1 = "virtual"</code> tells DOSEMU to use <codeclass="language-plaintext highlighter-rouge">stdio</code> as a virtual serial port on COM1.</p>
<p>Next, we create a virtual <strong>X</strong> drive for Pimp Wars to live such as <codeclass="language-plaintext highlighter-rouge">/enigma-bbs/DOS/X/PW</code> and map it with a custom <codeclass="language-plaintext highlighter-rouge">AUTOEXEC.BAT</code> file within DOSEMU:</p>
<divclass="language-plaintext highlighter-rouge"><divclass="highlight"><preclass="highlight"><code>@echo off
path d:\bin;d:\gnu;d:\dosemu
set TEMP=c:\tmp
prompt $P$G
REM http://www.pcmicro.com/bnu/
C:\BNU\BNU.COM /L0:57600,8N1 /F
lredir.com x: linux\fs\enigma-bbs\DOS\X
unix -e
</code></pre></div></div>
<p>Note that we also have the <ahref="http://www.pcmicro.com/bnu/">BNU</a> FOSSIL driver installed at <codeclass="language-plaintext highlighter-rouge">C:\BNU\\</code>. Another option would be to install this to X: somewhere as well.</p>
<p>Finally, let’s create a <codeclass="language-plaintext highlighter-rouge">menu.hjson</code> entry to launch the game:</p>
<p>Due to Node.js limitations, ENiGMA½ does not <em>directly</em> support <codeclass="language-plaintext highlighter-rouge">DOOR32.SYS</code> style socket descriptor sharing (other <codeclass="language-plaintext highlighter-rouge">DOOR32.SYS</code> features are fully supported). However, a separate binary called <ahref="https://github.com/NuSkooler/bivrost">bivrost!</a> can be used. bivrost! is available for Windows and Linux x86/i686 and x86_64/AMD64. Other platforms where <ahref="https://www.rust-lang.org/">Rust</a> builds are likely to work as well.</p>
<p>Pre-built binaries of bivrost! have been released under <ahref="https://www.phenomprod.com/">Phenom Productions</a> and can be found on various boards.</p>
<p>Alternative workarounds include <ahref="/enigma-bbs/modding/telnet-bridge.html">Telnet Bridge module</a> to hook up Telnet-accessible (including local) door servers – It may also be possible bridge via <ahref="http://pcmicro.com/netfoss/guide/net2bbs.html">NET2BBS</a>.</p>
<h3id="qemu-with-abracadabra">QEMU with abracadabra</h3>
<p><ahref="http://wiki.qemu.org/Main_Page">QEMU</a> provides a robust, cross platform solution for launching doors under many platforms (likely anywhere Node.js is supported and ENiGMA½ can run). Note however that there is an important and major caveat: <strong>Multiple instances of a particular door/OS image should not be run at once!</strong> Being more flexible means being a bit more complex. Let’s look at an example for running L.O.R.D. under a UNIX like system such as Linux or FreeBSD.</p>
<p>Basically we’ll be creating a bootstrap shell script that generates a temporary node specific <codeclass="language-plaintext highlighter-rouge">GO.BAT</code> to launch our door. This will be called from <codeclass="language-plaintext highlighter-rouge">AUTOEXEC.BAT</code> within our QEMU FreeDOS partition.</p>
<h4id="step-1-create-a-freedos-image">Step 1: Create a FreeDOS image</h4>
<p><ahref="http://www.freedos.org/">FreeDOS</a> is a free mostly MS-DOS compatible DOS package that works well for running 16bit doors. Follow the <ahref="https://en.wikibooks.org/wiki/QEMU/FreeDOS">QEMU/FreeDOS</a> guide for creating an <codeclass="language-plaintext highlighter-rouge">freedos_c.img</code>. This will contain FreeDOS itself and installed BBS doors.</p>
<p>After this is complete, copy LORD to C:\DOORS\LORD within FreeDOS. An easy way to tranfer files from host to DOS is to use QEMU’s vfat as a drive. For example:</p>
<p>With the above you can now copy files from D: to C: within FreeDOS and add the following to it’s <codeclass="language-plaintext highlighter-rouge">autoexec.bat</code>:</p>
<p>Note the <codeclass="language-plaintext highlighter-rouge">qemu-system-i386</code> line. We’re telling QEMU to launch and use localtime for the clock, create a character device that connects to our temporary server port on localhost and map that to a serial device. The <codeclass="language-plaintext highlighter-rouge">-hdb</code> entry will represent the D: drive where our dropfile is generated, while <codeclass="language-plaintext highlighter-rouge">-hdc</code> is the path that <codeclass="language-plaintext highlighter-rouge">GO.BAT</code> is generated in (<codeclass="language-plaintext highlighter-rouge">E:\GO.BAT</code>). Finally we specify <codeclass="language-plaintext highlighter-rouge">-nographic</code> to run headless.</p>
<p>For doors that do not <em>require</em> a FOSSIL driver, it is recommended to not load or use one unless you are having issues.</p>
<h5id="step-3-create-a-menu-entry">Step 3: Create a menu entry</h5>
<p>Finally we can create a <codeclass="language-plaintext highlighter-rouge">menu.hjson</code> entry using the <codeclass="language-plaintext highlighter-rouge">abracadabra</code> module:</p>