Content

Not quite a Yegge long.

Call of Duty 4 on GeForce 5×00 Hardware

Sunday 26 October 2008 - Filed under Code

The short version: Yes, it’s possible. We just did it. You can get the patch here:

Source code (1337 bytes)
Compiled patch (52K)

To apply the patch, just run it in the same folder that contains iw3mp.exe. On Vista, you’ll need run it as administrator to do this.

Note that if you want to play online, PunkBuster may kill you for this – it does modify the code, after all.

Edit 7:31PM: fixed bug in patcher – still had a forced path in there.

For an explanation of what’s going on, read on!

Over the past few months, we’ve been playing a lot of Call of Duty 4, and I have very few complaints with it, except perhaps for gratuitously wasting fillrate and batches, and a smattering of startup glitches (on Vista x64, you get an AV when launching COD4MP if you don’t have a microphone plugged in, etc).

One of our developers has a rather old workstation with a GeForce 5700 graphics card, which apparently lacks a single caps bit which COD4 insists on: (MiscPrimitiveCaps.SeparateAlphaBlend). This is apparently used for the “glow” postprocessing, and the game does provide an error message to that effect, saying that glow will be disabled.

Except then it decides that’s a fatal error, and commits suicide.

Having worked with Direct3D quite a bit, Bob and I knew where this gets detected – you call IDirect3D9::GetDeviceCaps() to check for the needed features before calling IDirect3D9::CreateDevice(). It should be simple enough to either redirect that call (possibly by patching the vtable), hack the caps bits after the call returns, or hack out the check. After looking through the code, we opted for the second possibility.

After GetDeviceCaps() returns, there’s a bunch of code that checks whether the call succeeded, and in the failure case, calls into kernel32!Sleep() and wanders off someplace uninteresting. Since on a sensible system, GetDeviceCaps() doesnt fail, this is safe to patch over. So, a simple 12-byte hack at iw3mp+0x1f36f5, assuming the D3DCAPS9* is in ebx:

or DWORD [ebx+0x20], 0×20000        ; 81 4b 20 00 00 02 00
pop edi                                                ; 5f
pop esi                                                ; 5e
pop ebp                                              ; 5d
pop ebx                                               ; 5b
ret                                                       ; c3

The 0×20000 is MiscPrimitiveCaps.SeparateAlphaBlend. Sometime after this function returns, the check is made, it sees the caps bit set, and COD4 runs without issue on a GeForce 5700. Some maps run a bit slow (10-15fps on lowest settings), but it’s playable.

You can get the patch here:

Source code (1337 bytes)
Compiled patch (52K)

To apply the patch, just run it in the same folder that contains iw3mp.exe. On Vista, you’ll need run it as administrator to do this.

2008-10-26  »  admin

Talkback x 13

  1. Chris Kubilus
    18 October 2009 @ 4:58 pm

    Wow this is Great i will try it as soon as I can and give some feed back. Is there a Benchmark for your 5700?

  2. admin
    22 October 2009 @ 4:32 pm

    Don’t expect good performance. You should be able to achieve 10-20fps though, with all the settings down.

  3. kurtfury
    28 November 2009 @ 4:04 pm

    works great, but only works for multiplayer,how do i get it to work on single player?

  4. Chris Kubilus
    3 December 2009 @ 12:55 pm

    Cool man Sadley I haven’t had the timeor a chance to try this.. As I don’t own the game I got it off a friend. but I know my other friend has a 5200 OC what would you think that would run like haha :)
    p4-1.6
    1024 gb ram
    5200 128mb

  5. admin
    10 December 2009 @ 5:51 pm

    I only hacked multiplayer. If you want single player to work too, then you’ll have to learn how to do it yourself :)

  6. admin
    10 December 2009 @ 5:52 pm

    On an OC’d 5200, forget it. Nowhere near enough memory bandwidth, or shader throughput.

  7. review of game
    4 April 2010 @ 4:28 am

    Great information and excellent design you got here! I would like to thank you for sharing your thoughts and time into the stuff you post!! Thumbs up

  8. Call of Duty Black Ops News
    6 May 2010 @ 11:00 pm

    Totally useful information, I really liked reading it. It had quite a few fantastic content. I will be bookmarking this web page.

  9. Halo Reach News
    7 May 2010 @ 7:37 am

    man i can’t wait for this gameman i just cannot wait for this game

  10. Trance CD
    8 May 2010 @ 8:46 am

    Great post. There’s a lot good information correct here, although I did want to let you know something — I am running Fedora the actual latest experiment with of Firefox, and the layout of blog is kind associated with quirky for me. I understand the actual posts, nevertheless the navigation doesn’t work therefore good.

  11. Kristofer Hartinger
    19 May 2010 @ 5:58 pm

    Did you really write this post by yourself? It seems…TOO GOOD! Haha, great job man, I love hearing about video games, especially Call of Duty ones! :D Have an amazing day and thanks for your post! :D

  12. Call of Duty
    21 May 2010 @ 1:47 am

    Hey Buddy, that is actually some positive material! I have got a complete question for you – just how long did it take you to construct this valuable article? Regardless, I’m just a genuinely big enthusiast of Modern Warfare 2 and I enjoyed your current post a considerable amount! Have you actually observed of this specific place known as MW2CC? I believe that you really should make a post regarding it merely because you would have a few cool things to assert :) Many thanks yet again regarding the post and why not consider what precisely I claimed with regards to Modern Warfare 2 Central Command!

  13. Kristin Gadd
    20 December 2010 @ 3:18 am

    Super share it is without doubt. Friend on mine has been searching for this tips.

Share your thoughts

Re: Call of Duty 4 on GeForce 5×00 Hardware







Tags you can use (optional):
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>