Friday, 6 February 2015

DOSBox Configuration for Individual Games

In this tutorial, I will show how to configure DOSBox to make sure that it uses the correct mapper file for your game.



The default DOSBox config file (dosbox-SVN.conf) and the mapper file (mapper-SVN.map) are located on the pi in the ~/.dosbox folder.

First copy the DOSBox config file, dosbox-SVN.conf, from the ~/.dosbox folder to the pc roms folder and rename it wolf3d.conf. The simplest way to do this is to use the following command:

mv ~/.dosbox/dosbox-SVN.conf ~/RetroPie/roms/pc/wolf3d.conf

Edit the config file, wolf3d.conf, and replace the default path to the mapper file in the [sdl] section (line 33) from

mapperfile=mapper-SVN.map

to

mapperfile=/home/pi/RetroPie/roms/pc/wolf3d.map

Now move the mapper file you created for Wolf 3D in a previous tutorial to the pc roms folder in RetroPie (~/Retropie/roms/pc) and rename it wolf3d.map. You can use the command below. (You can also download the mapper file here.)

mv ~/.dosbox/mapper-SVN.conf ~/RetroPie/roms/pc/wolf3d.map

Finally, edit the shell script, wolf3d.sh, created in the first tutorial by adding a -conf switch after the dosbox command so that DOSBox will use the wolf3d config file rather than the default one. The script should now look as below.

#!/bin/bash
/opt/retropie/emulators/dosbox/bin/dosbox -conf "/home/pi/RetroPie/roms/pc/wolf3d.conf" -c "mount c /home/pi/RetroPie/roms/pc" -c "c:" -c "cd WOLF3D" -c "WOLF3D.EXE" -c "exit" 

Once you have saved the script, you can test your game.

An Elegant Alternative


The shell script created above with the added parameter may seem busy, particularly with a lot of paths being defined. It is possible to place the commands to mount the C: drive and launch a game in the [autoexec] section of a DOSBox config file rather than the shell script.

For the Wolfenstein 3D example, remove the DOS commands from the shell script, wolf3d.sh, so it now reads

#!/bin/bash
/opt/retropie/emulators/dosbox/bin/dosbox -conf "/home/pi/RetroPie/roms/pc/wolf3d.conf"

In the config file, wolf3d.conf, in the [autoexec] section at the bottom (line 243 onwards), add the following:

mount c /home/pi/RetroPie/roms/pc
C:
CD WOLF3D
WOLF3D.EXE
EXIT

Once you have saved the file, you can test your game.

You can download my DOSBox config and mapper files here.

In Summary


For each game that does not use the arcade mapper file outlined in the last tutorial, then you will need the following files in the ~/RetroPie/roms/pc folder.
  • game.conf    DOSBox config file that outlines path to mapper file and DOS commands to launch game.
  • game.map    Mapper file that configures game controller.
  • game.sh      Shell script to launch game from Emulationstation.