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.

pretty-excellent-gun-wank.png

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
wget http://easynews.dl.sourceforge.net/sourceforge/wine/wine-0.9.56.tar.bz2
tar -xvjf wine-0.9.56.tar.bz2
wget http://bugs.winehq.org/attachment.cgi?id=8548
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
wineprefixcreate

Now, we need to download and install a DirectX DLL file so that everything runs smoothly:
wget http://www.m3fe.com/files/d3dx9_34.zip
unzip d3dx9_34.zip -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:
winecfg
On the Application tab, change the Windows Version to Windows XP
screenshot-wine-configuration-1.png

Now goto the Library tab, type in d3dx9_34.dll and press the Add button.
screenshot-wine-configuration.png

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.

setup1.pngsetup2.pngsetup3.png

setup4.pngsetup5.pngsetup6.png

setup7.pngsetup8.pngsetup9.png
setup10.pngsetup11.pngsetup12.png

setup13.pngsetup14.pngsetup15.png

setup16.pngsetup17.png

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:

setup19.png

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:

Anti-aliasing
Sync Every Frame
Shadows
Specular Map
Depth of Field
Glow
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.

  • David

    I have the same problem as ralph, in english:

    signal_i386.c:545: error: ‘VIF_MASK’ undeclared (first use in this function)
    signal_i386.c:545: error: (Each undeclared identifier is reported only once
    signal_i386.c:545: error: for each function it appears in.)
    signal_i386.c:556: error: ‘VIP_MASK’ undeclared (first use in this function)
    signal_i386.c: In function ‘raise_vm86_sti_exception’:
    signal_i386.c:1215: error: ‘VIP_MASK’ undeclared (first use in this function)
    signal_i386.c: In function ‘__wine_enter_vm86’:
    signal_i386.c:1615: error: ‘VIF_MASK’ undeclared (first use in this function)
    signal_i386.c:1616: error: ‘VIP_MASK’ undeclared (first use in this function)
    make[2]: *** [signal_i386.o] Error 1
    make[2]: Leaving directory `/home/corran/wine-0.9.56/dlls/ntdll’
    make[1]: *** [ntdll/__install-lib__] Error 2
    make[1]: Leaving directory `/home/corran/wine-0.9.56/dlls’
    make: *** [dlls/__install-lib__] Error 2

    **** Installation failed. Aborting package creation.

  • vmstr

    just a side note..
    if you already have a windows installation on the same computer and you have cod4 installed on that,
    you could simple click on the exe file for that from linux and wine will ru it w/o installation

    this is for those people who have a windows but dont want to continually reboot just to play a game

  • http://www.skiblerspot.net Sean

    Great tutorial! The game is running fine for me and is 100% playable. Only minor issue is at loading a mission/map the sound cuts in and out. After that its fine though. Love to play good games with Linux and Open Source software. Too bad the game isn’t!

    Badreligion

  • agh damn

    signal_i386.c: In function ‘merge_vm86_pending_flags’:
    signal_i386.c:545: error: ‘VIF_MASK’ undeclared (first use in this function)
    signal_i386.c:545: error: (Each undeclared identifier is reported only once
    signal_i386.c:545: error: for each function it appears in.)
    signal_i386.c:556: error: ‘VIP_MASK’ undeclared (first use in this function)
    signal_i386.c: In function ‘raise_vm86_sti_exception’:
    signal_i386.c:1215: error: ‘VIP_MASK’ undeclared (first use in this function)
    signal_i386.c: In function ‘__wine_enter_vm86’:
    signal_i386.c:1615: error: ‘VIF_MASK’ undeclared (first use in this function)
    signal_i386.c:1616: error: ‘VIP_MASK’ undeclared (first use in this function)
    make[2]: *** [signal_i386.o] Error 1
    make[2]: Leaving directory `/home/blmrocker/wine/wine-0.9.56/dlls/ntdll’
    make[1]: *** [ntdll] Error 2
    make[1]: Leaving directory `/home/blmrocker/wine/wine-0.9.56/dlls’
    make: *** [dlls] Error 2

    what should i do?
    im runing ubuntu intepid
    on a gateway ml 6732
    please and thank you

  • bos

    can you help me plzzz.
    when i try to play the game call of duty 4 the write
    (VIDEO CARD OR DRVER DOESEN’T SUPPORT ALPHA BLEND

  • Marco

    Thank you for your helpful guide..Cod4 works very great in single player for me,do you know if to play in multiplayer is possible?

  • vick

    if i remove wine will i lose my previously installed games???

  • http://ubuntuforums.com mike

    Vick,
    I am wondering the same thing, This seems like an excellent patch. Would this patch make all games run better? (ie: WoW or BF2?)

    Also, this has been a long time since this was published.. Can I do all of this with the newest wine version?

  • http://raon.tym.cz Fronty

    Hi guys!
    I’m afrid I have a same problem: When I try to run “sudo checkinstall”, quite a lot of lines goes and then ends with this:

    signal_i386.c: In function ‘merge_vm86_pending_flags’:
    signal_i386.c:545: error: ‘VIF_MASK’ undeclared (first use in this function)
    signal_i386.c:545: error: (Each undeclared identifier is reported only once
    signal_i386.c:545: error: for each function it appears in.)
    signal_i386.c:556: error: ‘VIP_MASK’ undeclared (first use in this function)
    signal_i386.c: In function ‘raise_vm86_sti_exception’:
    signal_i386.c:1215: error: ‘VIP_MASK’ undeclared (first use in this function)
    signal_i386.c: In function ‘__wine_enter_vm86’:
    signal_i386.c:1615: error: ‘VIF_MASK’ undeclared (first use in this function)
    signal_i386.c:1616: error: ‘VIP_MASK’ undeclared (first use in this function)
    make[2]: *** [signal_i386.o] Error 1
    make[2]: Leaving directory `/home/fronty/wine/wine-0.9.56/dlls/ntdll’
    make[1]: *** [ntdll/__install-lib__] Error 2
    make[1]: Leaving directory `/home/fronty/wine/wine-0.9.56/dlls’
    make: *** [dlls/__install-lib__] Error 2

    **** Installation failed. Aborting package creation.

    Cleaning up…OK

    Bye.

    …pleas help us! I am such a long time on linux without playing any of these microsoft games and I am starting to be a bit crazy.
    I am running Ubuntu 8.10 64bit
    Thanks a lot for any advice!!

  • mitsuki

    Hi
    When i try to run “sudo make depend && make”.
    There are some errors

    freetype.c:166: error: ‘FT_MulFix’ undeclared here (not in a function)
    freetype.c:166: warning: type defaults to ‘int’ in declaration of ‘pFT_MulFix’
    freetype.c: In function ‘WineEngGetOutlineTextMetrics’:
    freetype.c:4425: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4426: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4428: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4436: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4436: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4440: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4444: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4520: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4521: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4522: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4523: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4524: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4525: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4526: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4527: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4528: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4533: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4534: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4535: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4536: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4537: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4538: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4539: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4540: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4541: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4542: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4547: error: called object ‘pFT_MulFix’ is not a function
    freetype.c:4548: error: called object ‘pFT_MulFix’ is not a function
    make[2]: *** [freetype.o] Error 1
    make[2]: Leaving directory `/home/kjs/wine/wine-0.9.56/dlls/gdi32′
    make[1]: *** [gdi32] Error 2
    make[1]: Leaving directory `/home/kjs/wine/wine-0.9.56/dlls’
    make: *** [dlls] Error 2
    kjs@ubuntu:~/wine/wine-0.9.56$

    What should i do?
    Thanks

  • fr0gg

    Hey, I’m having difficulties getting this going..after running “./configure –prefix=/usr –sysconfdir=/etc –enable-opengl –with-x”

    I get:
    configure: error: X development files not found. Wine will be built
    without X support, which probably isn’t what you want. You will need to install
    development packages of Xlib/Xfree86 at the very least.
    This is an error since –with-x was requested.

    I’ve tried to find the Xfree86 package but it’s being a pain and I can’t find any coherent instructions on what to do..any advice?

    Thanks a ton, would reallly like to get COD4 running in ubuntu, it’s my favorite game!

  • Andreas

    I triyed all of the thing above but i get a massage that say my video card does not support enough textures? What do i do?

  • Sam

    Mitsuki, I have your problem… I don’t know what pFT_mulfix is, and why it should be a function… can anyone answer that?

  • Sam

    And also, this takes forever to install. It starts fast, but gets slower and slower until it starts to freeze my system. I have 2 GB of RAM… is this normal?

  • RoryG

    You should add a video tutorial.

  • Andreas

    Well SAM… install windows just like i did and you will solve the problem :-p i spended like 6 hours trying to make it work and i restored linux like 4 time when i gave up… i guess ubuntu needs more practise with me…. :p

  • zahra

    though I am a girl so I like the player so much hehehe all the boys think it odd that a girl playing cod

  • fr0gg

    mm yea I’m not too sure that anyone’s got it working perfectly, and if they have, they’re not willing to help.
    and zahra, girls that game are awesome o..O!

  • TaNXC

    Ummm, the msi.chm error comes up and the setup just shuts off

    Help!!

  • http://www.lanpartynow.com Alvaro

    i have the same problem that Mitsuki h, pls, somebody help us.

  • Jehoyl

    Also having the same problem as Mitsuki. I’ve been working on this every spare moment I get for two weeks and I’m getting really tired of having the same errors.

    Also, I tried just installing it with the Wine configuration I had (I’ve already installed iTunes to it without much difficulty) and get error -1627 as it finalizes installation. Any ideas?

  • Andreas

    i suggest that we all just buy the game and prober os and stop getting our self bussy trying to solve the mistery… :-)

  • http://www.kandallofa.eu SSH

    Hi All!

    Thank you, yeah this is a beautiful work.
    Helped me in how I installed Ubuntu system on the 4th Call of Duty

    Punkbuster on Linux:
    http://evenbalance.com/index.php?page=pbsetup.php
    and download Linux file. (Gui version or Command-line only version)

  • sorcerer

    Beautiful guide, but the same problem like mitsuki.
    Please help us =)))

    greetings from german

  • tony

    Afaik current releases of Wine do not require patching.

  • Pingback: Call of duty4: Modern warfare « Блогът на [Deathmaster]

  • aprilio

    hi all.i have same problem as mitsuki and sam with pFT_MulFix.pls help.thx.

  • http://mohd2110 3boooode

    call of duty 4

  • http://www.google.com 3boooode

    call of duty 4 pc

  • http://www.convertmtsfiles.net convert mts

    waht?

  • http://www.convertmodfiles.biz mod converter

    good a tutorial.

  • Hlias

    Very nice tutorial!Today i installed linux ubuntu and i really need to get in touch with wine,as a previously windows user :-)

    Congratulations!Keep on!

  • Sotiris Smixiotis
  • Engesa

    I have the same problem as Sotiris Smixiotis

  • Pingback: Call of Duty 4 on Ubuntu « Miaz3

  • http://www.baidu.com/ wenwens

    Finden Sie gnstige Ferienh?user

  • Problem in Startup :(

    hi it made me this…
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    fixme:win:EnumDisplayDevicesW ((null),0,0x33f63c,0×00000000), stub!
    fixme:mixer:ALSA_MixerInit No master control found on HDA ATI HDMI, disabling mixer
    fixme:dsalsa:IDsDriverBufferImpl_SetVolumePan (0x168ff8,0x168f68): stub
    fixme:dsalsa:IDsDriverBufferImpl_SetVolumePan (0x168ff8,0x168f68): stub
    fixme:dsalsa:IDsDriverBufferImpl_SetVolumePan (0x1822f0,0×182210): stub
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    fixme:win:EnumDisplayDevicesW ((null),0,0x33f1bc,0×00000000), stub!
    fixme:d3d:debug_d3dformat Unrecognized 1094800211 (as fourcc: SSAA) WINED3DFORMAT!
    fixme:d3d:getFormatDescEntry Can’t find format unrecognized(1094800211) in the format lookup table
    fixme:d3d:swapchain_init Add OpenGL context recreation support to context_validate_onscreen_formats
    fixme:d3d_surface:IWineD3DVolumeImpl_LockBox (0x21a788) : pBox=(nil) stub
    fixme:d3d:query_init Event query: Unimplemented, but pretending to be supported.
    fixme:d3d:query_init Event query: Unimplemented, but pretending to be supported.
    fixme:d3d:query_init Event query: Unimplemented, but pretending to be supported.
    fixme:d3d:query_init Event query: Unimplemented, but pretending to be supported.
    fixme:d3d:query_init Event query: Unimplemented, but pretending to be supported.
    fixme:d3d:query_init Event query: Unimplemented, but pretending to be supported.
    fixme:d3d:query_init Event query: Unimplemented, but pretending to be supported.
    fixme:d3d:query_init Event query: Unimplemented, but pretending to be supported.
    fixme:d3d:query_init Event query: Unimplemented, but pretending to be supported.
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    Allocating 16 x 16 radeon RBO (pitch 16)
    fixme:win:EnumDisplayDevicesW ((null),0,0x33f090,0×00000000), stub!
    err:d3d:resource_init Out of adapter memory
    err:d3d:resource_init Out of adapter memory
    err:d3d9:device_parent_CreateSurface (0x1b19f4) CreateSurface failed, returning 0x8876017c
    fixme:d3d_texture:texture_init Failed to create surface 0x12f12b30, hr 0x8876017c
    Chyba segmentácie

    Sorry I am from Slovakia… -_-

  • http://fsckin Andre

    Adorava jogar este jogo

  • http://fsckin Andre

    Eu acho que este jogo é fixe

  • http://fsckin Andre

    This game is really cool

  • Brown Dirt
  • Hossam Aladdin

    Wine compile error: “C compiler cannot create executables”