How to run GOG DosBox games on Linux.

+
How to run GOG DosBox games on Linux.

May be this would be useful to someone who is new to Linux. I usually do this for DosBox games from GOG, but new Linux users might be unfamiliar with the procedure.

I just got a Strike Commander from GOG (http://gog.com/gamecard/strike_commander), which is an old DOS game, so in order to play it one would use DosBox. GOG packages DosBox with such DOS games, but targets Windows users. So Linux users would need to perform some manual steps to play it using the native distro's DosBox (there surely is no point in running Windows DosBox through Wine).

1. First, get the package (in my case it was setup_strike_commander_2.0.0.5.exe). You can use the handy Linux GOG downloader for that (https://github.com/Sude-/lgogdownloader).

2. Unpack it with innoextract (no need to install it with Wine). innoextract 1.4 worked for me (but I had to compile it from source, since current Debian testing still ships 1.2 which produces errors for current GOG packages):

Let's say you saved the package in $HOME/Games/install/gog/strike_commander

Code:
cd $HOME/Games/install/gog/strike_commander
innoextract setup_strike_commander_2.0.0.5.exe
3. You'll see app and tmp directories created. You don't need the tmp one, but you can read tmp/GOG_EULA.txt first.

Code:
rm -rfv tmp
4. Create the destination directory for the game (let's say $HOME/Games/strike_commander or whatever you choose - change appropriately).

Code:
dest_dir=$HOME/Games/strike_commander
mkdir -p $dest_dir
5. Move needed files to the destination directory, and then remove empty source one:

Code:
mv -v app/* $dest_dir
rm -rfv app
6. Clear unnecessary stuff from the destination (like the Windows build of DosBox and some dll files which have no use on Linux):

Code:
cd $dest_dir
rm -rfv DOSBOX *.dll
7. Now take a look at provided DosBox configuration files. In this case you'll see: dosboxSC.conf and dosboxSC_single.conf. Look inside them - it's worth getting familiar with basic DosBox configuration in general. The first file appears to be general DosBox settings, while the second one is actually for launching the game.

Note that the second file mounts an iso image for the game (SC.dat) as a virtual disk "D", and mounts the game directory as a virtual disk "C". We'll have to modify that to use Linux filesystem syntax (instead of Windows one). So we change mount C ".." to use correct absolute path as well as imgmount d -t iso -fs iso "..\SC.dat". To avoid confusion - it's not about changing C and D, that's internal DosBox (DOS) syntax and it's right. What's changing are native paths that are mounted. Windows uses backslashes: \ while Linux uses slashes: /. Plus adding absolute paths here is helpful for launching the game from some other directory, like with the launcher. You can do this change using some editor, or purely in terminal as follows (useful for some script automation):

Code:
sed_subs=`pwd`
sed_subs=${sed_subs//\//\\\/}
sed_subs='s/"\.\./"'$sed_subs'/g'
sed -i $sed_subs dosboxSC_single.conf
sed -i 's/\\SC\.dat/\/SC\.dat/g' dosboxSC_single.conf
8. Now you are basically ready to run the game. If you are in the game directory:

Code:
dosbox -conf dosboxSC.conf -conf dosboxSC_single.conf
For convenience, you can create a launcher for your desktop using that command, just use the full path for each config file in that case (I'm leaving this excercise to you). The icon for the game is gfw_high.ico located in the $dest_dir (you can assign it to the launcher to make it nicer). Enjoy!
 
I hope this helps people who want to try Linux.

Also shows how simple making Linux packages could be for the GOG.com team. As simple as providing a distribution-independent tarball with the actual game content and DOSBox startup scripts/config files with the right syntax to begin with.

I recently ran GOG's Betrayal at Krondor successfully on a Debian Testing 64-bit without much hassle. I extracted the contents of GOG's installer and manually modified some lines in the DOSBox config file included with the game. In fact, it had a platform-independent error! They were mounting the audio CD image incorrectly and it made it impossible to load, regardless of you host OS. So apart from a syntax correction, it required a line swap to make it actually work as it should. Come on GOG! That was a very stupid error.

In any case, ALL DOS games should run flawlessly on Linux with DOSBox.
 
Yeah, most would. Except may be ScummVM based ones, which need the ScummVM runtime :) But they should naturally run with distro's ScummVM as well.

On a side note - why aren't some threads appear in the forums list? I.e. when you open http://en.thewitcher.com/forum/ you see recent posts in "Recent Topics Added", but some threads (like this one for example) don't show up there. It's really puzzling - is it a bug or some kind of "feature"?
 
Most Community threads do not show up on the main page. Or they only show up when they're new, but soon they are replaced by newer posts/threads and don't show anymore even if they're updated. You'd have to go to the Community section to see them.

EDIT:
And yes, SCUMM games should be run with ScummVM anyway, regardless of your OS. GOG doesn't really have many SCUMM games sadly...
 
This was incredibly useful! Even more awesome was seeing this page as one of the top results for "GOG DosBox Linux" with a google search. Thanks Gilrond! It was great to see there was a solution other than the "play it using Wine" bull I kept finding. I have never heard of innoextract. What a handy tool indeed :D Ultima is running happy and healthy.
 
I'm glad it helped you Glaroug :) I made a correction for one link above. The current active project for Linux GOG downloader is here: https://github.com/Sude-/lgogdownloader
Relevant discussion: http://www.gog.com/forum/general/lgogdownloader_gogdownloader_for_linux
 
Tex Murphy - Under the Killing Moon is DosBox based. Use the same method as above, but modify dosboxTex3.conf and dosboxTex3_single.conf accordingly.

In dosboxTex3.conf instead of
Code:
output=ddraw
set:
Code:
output=opengl
In dosboxTex3_single.conf change mounts to proper paths in Unix notation, and use UAKM.gog rather than UAKM.GOG, otherwise it won't work, since normal Linux filesystems are case sensitive.

GOG did a great job by packaging these old DOS games data into convenient single image files which can be mounted from DosBox.
 
I just got Ultima Underworld on GOG (on "insomnia" sale). Running it with DosBox on Linux requires more tweaks and hacks than regular filesystem syntax fixes like above (those are required too of course).

The main problem I encountered - there was no MIDI music playing. I also noticed, that dosboxULTIMA1.conf shipped with the game uses old DosBox syntax for options, surely not 0.74 one. So go through the options and fix their names to bring them up to date.

To make a dump of currently supported options, open dosbox and run such command there (from inside DosBox):

Code:
config -writeconf dosbox.conf

This will create dosbox.conf in your current directory where you launched dosbox from. Take a look inside that file, and compare it with dosboxULTIMA1.conf to see what names need to be brought up to date in the later (you can use meld to see a colored diff view). Use the values from the GOG's file, but names from the dosbox's one.

Now, back to the midi problem. After you fixed device to mididevice, and config to midiconfig (in the previous step above), you need to set actual midi port to use. By default you have nothing running I guess, so you need to get a midi synthesizer first. We'll do with software one (if you have a hardware one as well - you can plug it in and enable it yourself as a bonus exercise).

I used fluidsynth. It's also good to have some GUI for it, and it also requires some sound fonts to function. You might also need a small midi tool to figure out what ports are available (pmidi). To pull all this in on Debian for example, you can do:

Code:
sudo apt-get install fluidsynth qsynth fluid-soundfont-gs fluid-soundfont-gm pmidi

Now, run qsynth GUI, go to Setup, enable MIDI output, set MIDI driver to alsa_seq. Open Soundfonts tab in the same Setup window, press Open and add sound fonts, in my case they were in /usr/share/sounds/sf2 (I added both FluidR3_GM.sf2 and FluidR3_GS.sf2). Set priority as you want - experiment later to check what sounds better for you). After that is done, qsynth will restart - keep it running for now.

Now, from the terminal, run:

Code:
pmidi -l

I got this in result (qsynth should be running):

Code:
 Port     Client name                       Port name
 14:0     Midi Through                      Midi Through Port-0
128:0     FLUID Synth (18998)               Synth input port (18998:0)

Note the port for fluidsynth - 128:0

Now, go back to your dosboxULTIMA1.conf, and set that port to midiconfig parameter:

Code:
midiconfig=128:0

So, you can run your Ultima Underworld now, and enjoy it with full MIDI soundtrack (not that it's spectacular, but at least it works):

Code:
dosbox -conf dosboxULTIMA1.conf -conf dosboxULTIMA1_single.conf

Basically the same method works for Ultima Underworld II.

Also, you can make fluidsynth running as a constant service, to avoid running qsynth every time explicitly. Leaving it as an exercise for those who are interested.
 
Last edited:
Last edited:
With the on-going Underworld Ascendant campaign, I decided at last to give more serious try to Ultima Underworld games. I never really played them before seriously just poked around here and there in DosBox :).

Qsynth however is annoying - it hangs up PulseAudio for me periodically for whatever reason. So I decided to figure out how to run fluidsynth proper. Running it as a daemon is a bad idea if you run PulseAudio as your own user (which is the most common and advised way).

So you need to run fluidsynth under your own user as well. I simply created a startup desktop file using KDE System Settings > Startup and Shutdown > Autostart > Add Program.

Here is the command I used:

Code:
fluidsynth -a pulseaudio -m alsa_seq -l -i -s -o synth.cpu-cores=2 /usr/share/sounds/sf2/GeneralUser_GS_1.44.sf2

Some explanations of parameters if you are interested in details:

-l means it no to connect to LASH server (I don't use that),
-i means no shell mode (it's supposed to be a server)
-s server mode (server process gets disowned from the parent process).
-o synth.cpu-cores=2 means to use 2 cores. Not sure if strictly needed, but may be useful to avoid hiccups. May be makes more sense if you have multiple midi clients.

This essentially created for me such file (if you don't use KDE or want to do it by hand, just create such file yourself):

$HOME/.config/autostart/fluidsynth.desktop

Code:
[Desktop Entry]
Comment[en_US]=
Comment=
Exec=fluidsynth -a pulseaudio -m alsa_seq -l -i -s -o synth.cpu-cores=2 /usr/share/sounds/sf2/GeneralUser_GS_1.44.sf2
GenericName[en_US]=
GenericName=
Icon=system-run
MimeType=
Name[en_US]=Fluidsynth MIDI server
Name=Fluidsynth MIDI server
Path=
StartupNotify=false
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=none
X-KDE-SubstituteUID=false
X-KDE-Username=

About GeneralUser_GS_1.44.sf2 I already wrote above. It's a good sound font from here: http://www.schristiancollins.com/generaluser.php (provide there path for your sound font of choice if you use anything else or put it elsewhere),

You can disable that startup launcher if you don't want fluidsynth running all the time if you aren't using MIDI for a while. Either do it in KDE GUI marking "disabled" checkbox, or add
Code:
Hidden=true
to the .desktop file when you want to disable it so you won't need to move the file out.

Alternatively, if you don't want to deal with any startup stuff and just want to run it on demand, you can make a couple of such scripts:

start_fluidsynth
Code:
fluidsynth -a pulseaudio -m alsa_seq -l -i -s -o synth.cpu-cores=2 /usr/share/sounds/sf2/GeneralUser_GS_1.44.sf2 &> /dev/null &

stop_fluidsynth
Code:
killall fluidsynth

---------- Updated at 05:22 AM ----------


After that, Ultima Underworld starts with music just fine (see above about configuring MIDI port for DosBox).

---------- Updated at 05:27 AM ----------

Note that on some distros timidity++ can be preinstalled (that's another MIDI server). So all the above is for the case when you want to use fluidsynth and not timidity++ (fluidsynth is generally better).
 
Last edited:
Top Bottom