How To: Run Call of Duty 4 (COD4): Modern Combat in Linux

Here in the city I affectionately call Salt Lake Shitty, Utah – it’s about as cold as a witch wearing an iron cupped bra doing push ups in the snow.


To offset this chilly weather, my best friend in the entire world* Yahtzee, who does a little piece for Escapist Magazine every Wednesday called Zero Punctuation warmed up to Call of Duty 4: Modern Combat, calling it a “Pretty Excellent Gun Wank” which in my book means it’s a 5-star title, and worth playing – but only if it runs in Wine.

*I am not actually friends with Yahtzee.

The Wine Application DB website says the compatibility rating of the game is Silver, which means it works excellently for ‘normal’ use. In less generalized color coded terms, this means that it works near perfectly after recompiling Wine.

I can hear the groaning and murmurs in the background – stop it!!! All this requires is a little bit of brainless copy and paste from this page into a terminal.

I spent a significant amount of time getting this to work on my own, and apparently I *did not* quote the source of most of what I posted here, for which I apologize. As far as I can recall, I had gone though the process of recompiling Wine with the 3dmark patch, downloading the D3D DLL and found a guide on Ubuntu Forums by ahaslam that had all my work plus more already posted.

Getting COD4 to run in Wine is really no more complicated than say… my tutorial on running all the games in the Orange Box (TF2, Portal, HL2, etc). Getting COD4 up and running takes a little bit more time, since compiling Wine takes the better part of 15 minutes on a relatively fast computer.

On a side note, perhaps the Department of Homeland Security should take a hint from the Wine folks and change their color-coded terrorism threat level matrix, since Wine’s implementation works pretty damn well, if I say so myself.

The story of my life is that I’m ready to kick ass and chew bubble gum, and I’m all out of gum. ARE YOU WITH ME? Let’s go and kill our existing Wine installation, and install a couple tools since we’re going to be rolling our own. Yeehaw!

sudo apt-get remove wine
rm -r ~/.wine
sudo apt-get build-dep wine
sudo apt-get install build-essential checkinstall rar

Next let’s download the source code for Wine, download and apply the “3dmark” diff patch, then recompile Wine. This guide has been updated to use Wine 0.9.56 and several changes have been made after usability testing. 🙂

mkdir wine && cd wine
tar -xvjf wine-0.9.56.tar.bz2
cp attachment.cgi\?id\=8548 wine-0.9.56/3dmark.diff && cd wine-0.9.56
patch -p1 < 3dmark.diff
./configure --prefix=/usr --sysconfdir=/etc --enable-opengl --with-x
make depend && make
sudo checkinstall

Now, we need to download and install a DirectX DLL file so that everything runs smoothly:
unzip -d ~/.wine/drive_c/windows/system32/

Change Wine to use Windows XP emulation mode, and ddd “d3dx9_34.dll” into the winecfg Library section as a Native dll:
On the Application tab, change the Windows Version to Windows XP

Now goto the Library tab, type in d3dx9_34.dll and press the Add button.

Now, I bought the game from Direct2Drive, which means I have an electronic copy – No disc at all, so after extracting the archive of the installation files I opened setup.exe from the directory I extracted it to. If you have the DVD version, just open the setup.exe file from your DVD with Wine.

Installation is a fairly standard process, however I had an issue that cropped up the two times I attempted to test my method, where it failed during the first attempt, but on the second attempt to install the game, it went through flawlessly. I did NOT install PunkBuster because it is not compatible with Wine – yet.






I installed a No-CD patch from Game Copy World just for good measure, and if you’re installing from a CD, you definitely will want this to avoid needing the CD every time you want to play the game or if you get this error like I did:


To install the No-DVD patch, download the iw3sp.exe file from Game Copy World, extract it to your Desktop, then run the following commands which will backup your existing game executable and copy the No-DVD patched one in its’ place:

mv ~/.wine/drive_c/Program\ Files/Activision/Call\ of\ Duty\ 4\ -\ Modern\ Warfare/iw3sp.exe iw3sp.exe.backup
cp ~/Desktop/iw3sp.exe ~/.wine/drive_c/Program\ Files/Activision/Call\ of\ Duty\ 4\ -\ Modern\ Warfare/

Finally, we’re ready to actually run the game.
cd ~/.wine/drive_c/Program\ Files/Activision/Call\ of\ Duty\ 4\ -\ Modern\ Warfare/
wine iw3sp.exe

Unfortunately, a Silver rated game means that some things don’t work, and some configuration changes are needed to make the game run smoothly. Turn off the following options for optimal performance:

Sync Every Frame
Specular Map
Depth of Field
Number of Dynamic Lights
Soften Smoke Edges

Soften Smoke Edges is the most important – Make SURE you turn this off, otherwise the game will not be playable at all.

Here’s a video of the game in action, enjoy!

The video doesn’t really capture the absolutely beautiful graphics COD4 has, it’s a really fantastic game engine. The maps are sweet, and the fact that it’s playable in Wine after a couple tweaks lets me easily recommend
Call of Duty 4: Modern Warfare

to all you Linux gamers out there.