VOGONS

Common searches


First post, by mike_canada

User metadata
Rank Member
Rank
Member

For those not aware, I'm getting closer to making Duke Nukem 3D (Dos) over today's internet a reality. and one emulated OS I want to test on is DOSBOX.

Right now I'm trying to make a script where a 3rd party program launches my script with a special file as a parameter which in turn runs DOSBOX. However I want my script to set the ultimate folder for the game but that's where I have difficulty.

This is my setup so far:

My script to launch DOSBOX:

#!/bin/bash
folder="/path/to/every/thing"
if [ -z "$1" ]
then
echo "file as parameter required"
else
if [ -r "$1" ]
then
echo "Preparing duke nukem...."
echo 1 > /proc/sys/net/ipv4/ip_forward
kill -9 $(pidof socat) > /dev/null
kill -9 $(pidof slattach) > /dev/null
kill -9 $(pidof dosbox) > /dev/null
killall socat > /dev/null
killall slattach > /dev/null
killall dosbox > /dev/null
socat -4 PTY,link="/tmp/dbnet",raw,echo=0 TCP4-LISTEN:8001 &
sleep 1
slattach -L -s 115200 -p slip "/tmp/dbnet" &
sleep 1
ifconfig sl0 192.168.7.1 dstaddr 192.168.7.2 netmask 255.255.255.252 mtu 1500 txqueuelen 1500 up
#iptables -t nat -F
iptables -t nat -A POSTROUTING -s 192.168.7.0/30 -j MASQUERADE
dosbox -conf "$folder/dosbox.conf" -c "set DNU=$(cat $1)" -c "mount C: $folder"
sleep 1
kill -9 $(pidof slattach) > /dev/null
kill -9 $(pidof socat) > /dev/null
else
echo "Parameter needs to be a valid file"
fi
fi

and this is the dosbox config file thats in the correct folder for its autoexec.bat

@echo off
@echo Running Duke Nukem in DOSBOX networking style....
C:
ethersl -p 0x60 -h 3 0x2F8 1152000
commit.com

In DOSBOX, when I run the SET command, the DNU variable value is correct, but dosbox wants to execute its autoexec.bat (shown above) before it mounts the C drive, but because the mount operation requires the working program folder and I want the working program folder only defined in the script itself (not in dosbox config file), I feel my only solution is to run all my commands as -c parameters when running DOSBOX, and that would be one heck of a long line to be passing to a command when I could do it in autoexec.bat?

The only kind of solution I could think of is throw all my other startup stuff in a separate batch file and try running that instead?

But is there a better solution? I want my setup to eventually work with as many OS's (including windows 10) as possible.

I added an attachment that shows my DOSBOX output:

dosbox.png
Filename
dosbox.png
File size
44.24 KiB
Views
277 views
File comment
dosbox output
File license
Public domain

Reply 1 of 1, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Yes, -c commands are essentially added to the end of the autoexec commands. Putting the autoexec commands in a batch file and executing that batch with -c after the mount command should work; but remember to CALL a batch file if you intend to do any more -c commands after it.