Saturday, August 2, 2008

Starcraft on Wine

No I am not talking about Zerging while on the Cabernet.

At home whenver I want to play this venerable old game, I use Linux, fire up wine and it is all coolness.

Every so often I have to set it all up again and I forget the little tricks and twiddles that I needed.

There are plenty of great HowTo's around for getting starcraft running on wine. Here are the steps I use.

So here we go.

Step one

Get wine working. This should be pretty easy with any of todays new distro's. Use the package manager - Yast for example and install wine.

Step two

Create a mount point for the starcraft CD:

sudo mkdir /mnt/starcraft

Step three

Run winecfg.

If you have wine installed OK, then from a console window just type "winecfg". Note - use winecfg, not winesetup or any other program.


Click on the "Drives" tab and you should see a C: drive already setup. Create a new drive by using the "Add" button, or if there's a drive there with an empty mapping use that. Set the "Path" value to the mountpoint just created, eg "/mnt/starcraft".

This is telling the wine engine that emulates windows that you have a D drive, and when you mount your starcraft CD there, the Starcraft program will be able to find it. If you later get errors about your CD not being inserted, even tho it is mounted, go and check this step again.



Step 4

Set up your audio.



If you run winecfg from the console and see a message about "libjack.so" - ignore it. We are not going to use jack.

One of alsa or oss should work. Try alsa first. Set it to alsa and come back and change it later if the steps below don't work.




Step 5

Mount the starcraft CD. For this you must have your own genuine starcraft CD.

sudo mount /dev/cdrom /mnt/starcraft


Step 6

Install Starcraft.

wine /mnt/starcraft/setup.exe

This should run the starcraft installer, which will copy the program files into the .wine directory in your home path, eg /home/jo/.wine/drive_c/Program Files/Starcraft

When the installer finishes it should start up starcraft and begin playing the movie.

If you cannot hear sound, exiting out and fix sound.

First check if you have the mixer level turned down - there maybe a level control in the system tray. Try that. If not try running "kmix" or the equivalent.

Try running starcraft again and see if that fixed it.

Still no sound? See if you have a program called artsd running - if so, kill this program by sudo killall artsd. You may also be able to turn off artsd by using the settings console for your Linux distro.

The artsd or equivalent is a sound mixer daemon that grabs hold of the sound device /dev/dsp and won't allow wine to use it. I have found the easiest way to deal with the contention issue is just to turn this process off. If your version of wine has artsd support (or support for whatever other mixer you distro uses) you can try using winecfg to turn that on.

If after trying all of the above doesn't work, try some of the other drivers via winecfg - turn off alsa and give oss a go.

Starcraft should start up in full-screen mode. If it doesn't make sure you have "managed" turned off under the graphics tab of winecfig.

If the mouse is jerky - stop all other unecessary processes running on your machine. For example, web browsers, apache or whatever other servers you might have set up.

If its still jerky, try running starcraft with nice -10 wine .wine/drive_c/Program\ Files/Starcraft/starcraft.exe.

Step 7

Edit the file .wine/user.reg so that you have a key called InstallPath set to the location of Starcraft (ignore the other entries I have below, they're just for context, starcraft install should have created something like this for you):

[Software\\Blizzard Entertainment\\Starcraft] 1217626321
"bldgnoise"=dword:00000004
"ColorCycle"=dword:00000001
"Game Speed"="Normal"
"Game Subtype"="4 vs 4"
"Game Type"="Top vs Bottom"
"Gamma"=dword:00000064
"InstallPath"="C:\\Program Files\\Starcraft"
"intro"=dword:00000200
"introX"=dword:00000000
"kscroll"=dword:00000003
"m_kscroll"=dword:00000003


Step 8

Upgrade to Broodwar.

First take out the Starcraft CD and put in the Broodwar CD. Then run the broodwar installer.

sudo mount /mnt/starcraft
eject
sudo mount /dev/cdrom /mnt/starcraft
wine /mnt/starcraft/setup.exe


Step 9

Upgrade to the latest patch level. Go to blizzards website and click the link that says "Starcraft Patch". The patchfile you want will be called something like bw-1152.exe.

For faster downloads, try searching for the name of the patchfile on Google, and find a mirror site near you that hosts the same file. Make sure you check the MD5 sum, or otherwise you might get a virus infected copy.

Once you have the patchfile on your desktop run: wine ~/Desktop/BW-1152.exe to install it.

If you get an error about the patch failing make sure you have the registry key correct as shown above in Step 7.

After successfully installing the patch you now should be up and running with Starcraft under wine.

Step 10

Optimisations.

Some HowTo pages show a technique where you run under a seperate xconfig file, and use a different xserver. I don't recommend this - on modern fast machines there is no performance benefit and you are likely to lock up your machine on exit from Starcraft.

If you are keen to do this, try the script below. You will need to create a special xorg.conf file by copying your existing file and editing the default screen section so that it only contains a modeline with "640x480". This is for the brave only.

Playing without the CD. The most recent patchlevel from Blizzard enables play without the CD. This is an official Blizzard thing - not a hack.

They way I do this is to actually copy the entire ISO of the CD to my machine and mount that instead of the cd:

dd if=/dev/cdrom of=~/starcraft.iso bs=8192
sudo mount ~/starcraft.iso /mnt/starcraft

This works quite well. Or you might be able to use the technique described in the article.

Here is a script that a friend wrote that runs starcraft - its not really needed - the commands above are enough, but if it works for you feel free to use it:

#!/bin/bash
SC_ISO=/home/jo/starcraft.iso

UNMOUNT=0
if ! test -f /mnt/sc/bw.ico ; then
echo 'Starcraft ISO image is not mounted; trying to mount; may need root password; ...'
sudo mount $SC_ISO /mnt/starcraft -o loop
UNMOUNT=1
fi
if test -f /etc/X11/xorg.conf-starcraft ; then
XCONF='-xf86config xorg.conf-starcraft'
else
XCONF=""
fi
xinit /usr/bin/wine "$HOME/.wine/drive_c/Program Files/Starcraft/starcraft.exe" -- :2 $XCONF
if test x$UNMOUNT = x1 ; then
sudo umount /mnt/starcraft
fi

3 comments:

  1. On Kubuntu, I found installing and running Starcraft as easy as windows and followed exactly the same steps: insert disk, click on installer, etc.

    Regarding the no CD setup, you don't need the entire CD, only the Brood War "INSTALL.EXE" copied to your StarCraft folder and renamed "BroodWar.mpq" (similar is available for those without Brood War - but why wouldn't you have Brood War?). Detailed instructions for this are at the link you provided:

    http://us.blizzard.com/support/article.xml?articleId=21150

    Incidentally, WarCraft III was just as easy to install and the latest patch removes the need for the CD without having to do anything at all.

    The only problem I had, and I don't recall whether it was Starcraft or WarCraft III, was that the graphics went to hell as I downloaded the patch from BattleNet but it all worked fine anyway.

    ReplyDelete
  2. Great tutorial .... but Bnet crashes... no idea how to fix that :[

    ReplyDelete
  3. You have to install the msttcorefonts.

    ReplyDelete

Hi, thanks for leaving your thoughtful on-topic comment!