Saturday, October 17, 2009

On Ubuntu and DOSBox

Okay, I've had enough. After a third virus/malware scare in less than two years, I'm switching to Ubuntu Linux for my web browsing and general work. I still have an XP partition around for video /sound editing, but that is only connected to the internet for updates. I can now run my email, web browsing, and Skype needs out of Linux, without having to worry about Windows viruses/malware/keyloggers/etc. Ubuntu 9.04 is also by far the most polished and accessible Linux I've ever used, which helps quite a bit. It's still not "grandma" material, as you do have to put up with a lot of configuration wackiness, especially if you have hardware that's a little unusual, like me having two sound cards and a webcam.

On the plus side, almost everything in the whole world of Linux can be done on Ubuntu, and usually a simple Google search will not only tell you how to do it, but give you the command-line commands to do it, which you simple copy, then paste in an open terminal window. For someone like me who's grow up around computers, this is an acceptable compromise.

I don't have a lot of hard drive space allocated to Ubuntu, but thankfully, I like to play classic games. To this end, I use the fabulous open-source DOS emulator, DOSBox.

For those of you who would like to try this as well, I looked at the following forum posts:

Tutorial: dosbox with Glide under Linux and DOSBox 0.72 and MIDI Support

And here is my condensed summary (Note: I'll mark the general-midi portions of the setup in green, so that if you don't want to mess with your system sound settings, you don't have to):

Note: This is for Ubuntu 9.04 and DOSBox 0.73. If you try this with a different version of either, your mileage may vary.

Update: On Ubuntu 9.10, DOSBox 0.73 can be installed from the Ubuntu Software Center, so you can skip the compilation steps below. You may want to change (in your dosbox.conf or dosbox-0.73.conf) the mixer settings to "rate=44100" and the "prebuffer=50" to avoid stuttering sound. I haven't tried setting up General MIDI to work with it yet, but I'll post here if I do.

  1. Get DOSBox (the "source" version, as this is frequently the most current).
  2. Extract the package into your /home/yournamehere directory.
  3. Open a terminal window and copy/paste the following command in and run it:
    sudo apt-get install libsdl1.2-dev libsdl-sound1.2-dev libsdl-net1.2-dev libpcap-dev build-essential cvs
  4. When that's done, "cd" into the folder you extracted earlier , for example "cd /home/yournamehere/dosbox-0.73".
  5. copy/paste, run the following commands (one at a time, in order):


    sudo make install
  6. Then, get the following packages (you can just paste this in the command-line, like before):
    sudo apt-get install dosbox timidity fluid-soundfont-gm fluid-soundfont-gs
  7. Type "dosbox".
  8. This should automatically make a dosbox.conf (or dosbox-version.conf) file. You can check by opening your /home/yournamehere directory, turning on "Show Hidden Files" in the "View" menu, then scrolling down and opening the ".dosboxrc" folder. If you don't see the file there, go back to dosbox and type:
    config -writeconf dosbox.conf
  9. When you see the file in the directory, close DOSBox, and open up the dosbox.conf file by double-clicking it.
  10. Scroll down until you see a line that starts with "mp401=", then make sure it looks like this:
  11. Save the file and exit it.
  12. In the terminal window, type (or paste) the following command:
    sudo gedit /etc/timidity/timidity.cfg
  13. Scroll down, put a "#" in front of the line that reads "source /etc/timidity/freepats.cfg", then paste this on the next line:
    soundfont /usr/share/sounds/sf2/FluidR3_GM.sf2
  14. Save and close. In the terminal, type (or paste) the following command:
    sudo /etc/init.d/timidity restart
  15. DOSBox should now be configured for General MIDI sound.
  16. Now, you'll need to create a folder for DOSBox to use to store and run programs. I call mine "dosdisk", but you can name it anything you want, and I'd recommend creating it in your "home/yournamehere" folder.
  17. Open up the dosbox.conf, scroll down to the very bottom of the file. Under "[autoexec]
    # Lines in this section will be run at startup", type the following (change folder names as appropriate):
    #Hard drives:
    mount c /home/yournamehere/dosdisk
    mount d /media/cdrom0 -t cdrom
  18. Save and quit. Open a terminal window and run dosbox. It should mount your folder and DVD-ROM drive as c: and d: respectively. If it gives you an error, quit out, go back to dosbox.conf, and check your autoexec section at the bottom is pointing at the right folders/drives.
  19. Now, you can either take zip files of classic games and extract them to the "dosdisk" folder directly, or put a game cd in your drive, start DOSBox, and install it just as you would on a real DOS machine. DOSBox works exactly like real DOS, except you don't usually have to mess with all that memory management crap.
  20. If you have any further questions, message me, or check out either the DOSBox or Ubuntu forums (search for dosbox in the latter).
  21. Have fun!