Subscribe via RSS
27May/11244

Commandos – Behind Enemy Lines Resolution Fix

Note: Both Commandos - Behind Enemy Lines (BEL) and Commandos - Beyond The Call Of Duty (BTCOD) (Plus a crapload of other versions, see below!) are supported!

Unofficial STEAM support:
Scroll to the bottom and find the comment by Tonelotto with instructions on how to get it going.

You can also use this patch to carry out the Locale hack described here.

Skip straight to the bottom of this post if you just want the application!

An Introduction to the game

A friend and I recently stumbled across the Commandos Ammo Pack ('Behind Enemy Lines' and it's expansion pack 'Beyond The Call Of Duty') at Good Old Games.com and we just couldn't resist downloading it. It did cost US$5.99, but that's absolutely chicken feed when compared to the awesomness of this game.

It's an old game, created in 1999, and could handle resolutions up to 1024x768 for single player; but for multiplayer the resolution was fixed at 640x480. I google'd around a little and saw that one person on a forum had created the Mysoft - Commandos Loader v0.8 which seemed to hoist the application in to memory and then hacked around with variables. I wasn't sure this was the best method and had the main Commandos EXE in IDA Free before too long.

I'd read that it used DirectDraw/3D and started searching for the appropriate functions. Before long I had the AdjustWindowRectEx, DirectDrawCreate and other functions under the microscope. I then opened the EXE up in OllyDbg and started slapping breakpoints everywhere. Before long I'd noticed the pattern:

push    10h
push    1E0h
push    280h

This seemed to be popping up everywhere and co-incidently 280h x 1E0h = 640x480 pixels... the default for the game. I then found code that set the resolution based on those shown in the video settings menu and then the game was doing what I told it.

commandos-512-384 commandos-1024-768 commandos-1680-quit

After a little more google'ing I found that someone else had already gotten to this point. Ferdinand had the hacks there to change the resolutions, but did not have the final piece to ensure that re-loading the game brought the resolution back.

After a little more disassembling I found that the resolution was being loaded at startup from a file on disk... this turned out to be "COMANDOS.CFG" in My Documents. The exact line from the config was:

.SIZE [ .INITSIZE 2 ]

From the config it was obvious that the game was using 'index 2' from the resolution list. Of course, it also meant that it knew how to decipher that '2' to a real resolution from the list in the code. After a little forward and reverse searching from the file loading to the resolution setting I came to the switch statement in the code which had the values hard-coded. I now had 3 points per resolution setting in the code that needed to be changed if I was to write my own utility.

Commandos Resolution Hack Alpha 1

I hadn't liked anything that was already available to do this and so I chose to wrote my own. The application loaded the EXE into memory, read out the resolutions stored, audited that they were all in sync and then allowed the user to select a new resolution per slot. If the resolutions weren't the same then you would get a warning, but this would have been corrected on the next resolution hack.

commandos-file-selection commandos-resolution-hack

This worked fine, but I found it pointless to specify four separate resolutions when you only really needed to specify one. I was more in for the challenge of allowing all four to change, rather than the practicality.

Testing and more bugs

So, it all worked... I then closed the game, re-opened it and found that it loaded up at 1024x768 instead of the 1680x1050 resolution I had set. I closed it again and looked at the configuration file; the setting had indeed changed back to '2' instead of '4'... but I hadn't touched it! I then loaded the game again and it was back to 1680x1050... closing and opening brought it back to 1024x768... the flip-flop continued.

So... what did this seem to mean? I had overlooked the storage of the resolution configuration. If the indexed resolution was read from the file, then it would have to be written back as an index. I went back in to the disassembler and searched for anything relating to writing 'SIZE' into the configuration file. The logic in the game was then obvious: it carried out an "if less than X but greater than Y" across the 'stock' resolutions and then stored the relevant index. This complicated my approach and confirmed that I really should only bother adjusting the 'fourth' resolution in the list. There was no point allowing the user to re-order the resolutions as this code then wouldn't work. The fourth resolution would need to be the only one customisable and the value must be greater than the third resolution at 800x600.

Commandos Resolution Hack Alpha 2

So, with this in mind, I wound the application down to just editing one resolution that had to be higher than 800x600. This meant that the internal configuration saving would work and the user would just have to select the final resolution in the list. Note that this only affected single player... the multi player resolution would still be a separate setting.

commandos-final-version

Everything was now working great... except the drawing issues above 1024 resolutions...

Drawing bugs

So, the game obviously wasn't meant to be played with a horizontal resolution greater than 1024 pixels; rendering artifacts started appearing when higher resolutions were used. Fortunately, the game is quite dynamic when it comes to rendering the screen and menus. Trawling through the code I could see that it was trying to find a BMP that matched the resolution, even using the resolution as the file name. Ferdinand had also worked this out and even has a list of assets downloadable for higher resolutions.

Commandos stores all of its graphical assets in a file named 'WARGAME.DIR' and references this when the game loads. I started looking into modifying this file via my program but realised it would be wuite a task to decipher and re-pack. Fortunately, some clever fellows across the world have created the necessary tools to extract these files. DirExtractor allows us to expand the DIR files and, once in the Commandos directory, the game itself will actually use the extracted versions if you remove the WARGAME.DIR file. This then meant that I could use my app to call DirExtractor, extract the files and then modify them where required to ease the majority of graphical glitches.

commandos-1680-resolutions commandos-1680-menu commandos-1680-loading

Required Graphical Modifications

  • A single change to the fourth resolution string in DATOS\MISIONES\GLOBAL.STR to whatever the custom resolution has been set to. This can be found by searching for the token OVI4 and then replacing the string following.
  • The creation of the menu background. This has to be a Bitmap file named MENU####.BMP where the #### is the horizontal resolution of the screen.
  • Build a WAD file for the game-play interface. This WAD is named via the resolution (i.e. 1024X768.WAD) and contains values that tell the game how to render the interface. I created a one-size-fits-all file that ensures that the graphics are wide/long enough for the screen resolutions (max 1920x1920) and the application simply renames the file and ensures that it is available to the game.

A final glitch

There was only one drawing issue remaining after this... any resolution over 1400 meant that maps thinner than the overall monitor width would not re-draw the areas that they could not cover. You can see this in the following screen shots.

commandos-bad-map

Fortunately you can press '+' and '-' in-game to zoom in and out. What this meant was that the user could stop the map from clipping by adjusting the zoom. I took this as a suitable workaround at the time.

commandos-1

commandos-1

Smeared resolution?

It seems that some laptop resolutions are a little out-of-whack. I previously had a Samsung Ultranote with resolution of 1366x768, but windows reported that it could also run at a resolution of 1360x768.

It turns out that if you choose the wrong one (although it may seem the right one if that's your current windows resolution) that you'll get the following display:

commandos-smeared-menu

commandos-smeared-res

Simple fix: Try another resolution... it'll work eventually!

And you thought it was going to be this easy?

So, I had the app working great for the modification of the GOG version of the EXE. It turns out that there are many more versions in the wild. It also gets worse as there is another patch here that fixes up a whole lot of other issues in the game. Fortunately it seems that the EXE from the above link is the exact same as the EXE from GOG? Either way, I've tested it and my hack works on it perfectly.

Due to the above, I started a list of EXEs for the game and then began deciphering them (as I knew the basic items to change) to allow my application to work with them.

Items in bold are those that come from GOG.com.

Game Version File Size Supported
Commandos - BEL Demo 2,452,992 bytes Works..
Commandos - BEL German v1.0 2,469,376 bytes Works, Asks for CD (Language issues, I'd imagine)
Commandos - BEL Spanish v1.0 2,469,376 bytes Works?
Commandos - BEL Spanish v1.05 2,469,888 bytes Works?
Commandos - BTCOD Spanish ? 2,696,600 bytes Works?
'Sold Out' v1.1 2,479,104 bytes Works fine. Speed issues with game (known issue)
GOG.com Ammo Pack v1.1 3,715,072 bytes Works perfectly!
Commandos Ultimate Fix v1.1 3,715,072 bytes Works perfectly!
Commandos - Beyond the call of duty ? 3,133,440 bytes Works perfectly!
Commandos - BEL Russian ? 2,470,400 bytes Works fine. Speed issues with game (known issue)
Commandos - BTCOD Russian ? 2,968,576 bytes Works fine. Speed issues with game (known issue)
Commandos - SINP v2.3 2,482,688 bytes Works perfectly.
Commandos - SINP Chinese v2.3 2,313,216 bytes Does not write out chosen resolution to configuration file. You should only change the resolution via this hack!

My application was then built to determine the EXE via file size (of course, this isn't fool-proof) and then hack appropriately.

Commandos - Beyond The Call Of Duty

So, this was just an update to the main game... turns out the code was slightly different, but still workable with my current program structure. After about 6 hours debugging all was working! Enjoy!

commandos-btcod-1

commandos-btcod-1

Commandos Hack v1.2

The final release contains the following features:

  • Support for all versions known above. (Note that the Demo and German versions don't actually save their configs to disk; we therefore hack the initial startup resolution.)
  • Resolution list options based on monitor capabilities.
  • Both EXE and WARGAME.DIR are backed up.
  • A one-size-fits-all menu background has been included.
  • German file encoding is preserved when the text is changed.
  • Resolution menu text shows the selected resolution.
  • Compatibility mode now checked to allow proper resolution and disable scaling.
  • The Locale hack from here has also been added.

commandos-hack-final

Note: You need .NET Framework 4.0 to run this, download it here.

Download the application here.
And you can also download the .NET source code here.

Meanwhile, if you got a lot out of this app, then feel free to donate!








And that's a wrap... go use every pixel your monitor can produce and play the game!

Comments (244) Trackbacks (1)
  1. Hello Steven, you did an excellent job with the patch! Congrats!!

    I’m currently playing the Spanish version and this is not supported.
    Can you do something about it?

    https://mega.nz/#!71kFiIJL!eLE_kRcAE7HTpR_15YojCa2o0EetjNnHLBUtLigvzUU

    I wait your answer, thanks! =)

  2. The Steam version available in eg. Poland (supposedly patched) is not recognized by the fix. I really want Commandos in glorious 1080p :(

    Here’s the exe:

    https://www.dropbox.com/s/bumjt5d1bhd7e1x/Comandos.7z?dl=0

  3. Hi, I have the ammo pack GOG version but the patch does not work. I’m running on win XP SP3. Not sure if it has anything to do with it

    • Will need more information? What is reported in the information window? Can you provide any information from system logs?

      • Sure here is the log:

        “Let’s get this started… please note that you can expect a black main menu background…
        ———————————————————————————————-
        Waiting for user to select a game exe… please find ‘comandos.exe’ in your game folder.
        Possible monitor resolutions (above 800×600):
        1024 X 768, 1280 X 960, 1280 X 1024, 1600 X 900, 1600 X 1200
        ———————————————————————————————-
        Found ‘GOG.com Ammo Pack version’/’Commandos Ultimate Fix’ version of Commandos
        Found GLOBAL.STR. WARGAME.DIR has already been extracted.
        ———————————————————————————————-
        Locale patch [1] has already been applied.
        Locale patch [2] has already been applied.
        ———————————————————————————————-
        Searching for Multiplayer settings: 1600 X 1200
        Searching for 1024 X 768 settings: 1600 X 1200, 1600 X 1200, 1600 X 1200, 1600 X 1200
        ———————————————————————————————-

        WARNING: Compatibility mode is not XPSP3!
        WARNING: High DPI scaling will distort image!
        You may not be able to set the requested resolution in-game!
        To fix this:
        1. Browse to C:\GOG Games\Commandos\
        2. Right click on comandos.exe and choose properties
        3. Switch to the compatibility tab and make sure that WIN XP SP3 is selected.
        4. ALSO MAKE SURE that ‘Disable display scaling on high DPI settings’ is CHECKED.”

  4. Thanks for widescreen fix, but anyone has a solution for mouse lag?

    • YES PLEASE DID ANYONE FIX THIS! I THOUGHT I WAS THE ONLY ONE HAVING THAT PROBLEM!

    • I literally spent the whole day on it. Tried Steam version, GoG, Steam’s Legacy. And much more tools/hacks/fixes whatever. Feeling extremely dissapointed. I just wish this amazing game gets not just a remaster but a remake soon :/

  5. Hello StevenH i have the Commandos- BTCOD in spanish and sadly the patch isnt working, do you think you can help me?, im running it on Win8, alredy fixed, so the speed and save works fine, the only thing i need to play it its the widescreen fix, if you can help me i can give you any information you request, thank your bro!

    • AndreC,

      The only thing I can think of is that you’ve already patched the EXE and therefore my patch doesn’t recognise the bytes. Can you please make available the main executable file? Also paste the log of my application here when you pass it the exe?

      Steven.

  6. Hello,
    I tried CommandosResolutionHack.exe and got the following message:
    Error: cannot continue
    Found an unknown version of Commandos!
    Size: 2465280 bytes

    • Indeed, as your version is not listed in the versions that this patch supports.
      Any chance you want to give me more information: What language you have installed? Where you got it from?
      When posting comments like this anywhere on the internet, please give as much information as possible!

  7. Italian Version in HD? Can you help me?

  8. Hi.

    First of all… Thank you for the good work !!!
    I updated and modified your source code a little bit.
    As a real commandos fan I am very glad to found Ferdinand’s and your
    fixes/patches to play this old candy again… in HD :-)
    So I put the fixes together and changed the background image mechanism,
    added the mission glitches fix stuff from Ferdinand and his GUI WADs
    to your patch process.

    If you are interested in the code changes, please let me know.

    kind regards,
    Gerry

    • Andres, this is great news!
      I’d be more than happy to commit this and make it available here, or just provide a link to your version if you’re hosting it elsewhere.
      I’ll send you an email.

  9. Hi Steven,

    I successfully patched BtCoD (the standalone addon) with your patch. However, the In-Game GUI is still a little broken, as the three icons “quotation mark”/”camera”/”eye” are way to far to the left.

    I needed to download Ferdinand’s 1920X1080.WAD to fix this.

    It would be cool if you could integrate them, so this would be the one-size-fits-all-solution for Commandos players everywhere.

    Thanks for your hard work!

    Markus

  10. You can try this directdraw dll if you have lags or slowdowns. It solved my problem.

    https://github.com/narzoul/DDrawCompat

    Also for widescreen laptops, 1280×720 option can be used insted of 1366×768 which doesn’t work for me.

  11. Hey Steven, thanks for that. I got the DRM-Free version being sold by Humble Bundle, but couldn’t apply the patch. Is there another way to get this to work? My BEL is Commandos.exe with 2488832 bytes and my BCD is coman_mp.exe with 4512768 bytes.

    Many thanks!

    • Daniel,

      Another version! It feels like it’s time to make this code a find-replacer instead of using hard-coded locations.
      Can you please zip and provide the EXEs to me somehow? Then I can try and plug them in.

      Steven

  12. Hello,
    tried this patch, didnot work for me, got the message to contact you. My commandos games come from a dvd with all commandos games on it. [Legally bought]. When I run youre hack and it asks me to find the to replace commandos exe I still get the same message:
    Found an unkown version of commandos Size 695578 bytes please report this ect. ect.
    Hope you can help me, cause I still love to play this game.
    Greetings
    Aedriaen The Netherlands

    • Aedriaen,
      You’ll notice that the size of your executable is way too small! 600kb? The usual size is 2mb plus. It’s either encrypted/compressed or you’ve chosen the wrong file?
      Can you send me a link to the product you’ve purchased or tell me what file you’ve selected when applying the patch?
      Steven

  13. hi Stevenh

    thanx for this alot..i just installed GOG version and applied ur hack
    i choosed 1920×1080
    it says everyting fine but there’s WARNING to change compatibility to XP SP3 ..etc
    i did that..its gray out and unclickble but i tried it with ”change settings for all users”
    its still same but anyway i Applied and run the game

    i donno if its fine or no but in video settings there’s already 1920 and screen already 1920
    u think its ok now?

    • If you’re displaying the correct resolution, then go for it :)
      It sounds like you need to run the app as an administrator… but I can’t even think if that’s available in XP.

  14. Hiya, thanks so much for your work on the patch. I tried and it came up with the “Found an unknown version of commandos Size 2568192 bytes please report this”. I bought it on Steam and it’s located:

    C:\Program Files (x86)\Steam\SteamApps\common\Commandos Behind Enemy Lines

    Any help would be so appreciated, thanks.

  15. Many thanks for this Fix!! What a great game to play again.

    For other players dealing with major instability (constant crashes and freezing every 5 minutes): after trying everything I installed a directdraw.dll in the commandos directory that fixed it, and makes the game run a lot more smoothly. Find it here: https://github.com/narzoul/DDrawCompat/releases

    Hope someone may find this helpful!

    Greetings from sunny Holland

  16. Any chance this could be updated for the latest GOG version?

    Thanks so much!

  17. Hi I am using the GOG version through the porting kit on MacOS. The game runs at the right speeds and the resolution hack works well too at 1920×1080. However there are some quirks
    When I use the higher resolution the game runs great until I move my mouse. Whenever the mouse is moving when using 1920×1080 resolution the game lags pretty bad. This lag is exaggerated if you zoom out to show more of the map. Zooming in does not make it worse or better, it stays the same
    With that said the lags happen when zooming out under ANY resolution, even without moving the mouse.
    Is there any suggestions to get the game to run well at not lag when moving the mouse at higher resolutions?
    I did try the directdraw.dll that was mentioned in earlier comments, but I do not notice a difference in performance unfortunately
    Thanks in advance for any advice and replies!

    • Hi, I am also using GOG version through the porting kit on MacOS Mojave everything installed but when i launch the game i see blank screen with audio only not able to come out of that screen though i did tried all keys. I have to restart again my macbook. Do you have solution for this?

  18. Dobrý deň . Stiahol som si hru na Steame – Commanods (Pack 1,2,3) ale mam problem pretože hra nejde uloži. ( Save Game, Load Game v hre nefungujú ) vedeli by ste mi pomocť ?

  19. hi, excellent packaged exe thank you! I bought from GOG and it worked perfectly for the ammo pack as per your notes :)

    Will this work for commandos 2 and 3, also from GOG?

  20. Here how to aplly it to steam,

    1- Go to

    C:\Program Files (x86)\Steam\steamapps\common\Commandos Behind Enemy Lines\Legacy

    2- Rename Comandos.exe to Commandos.exe

    3- Apply the patch to this folder:

    C:\Program Files (x86)\Steam\steamapps\common\Commandos Behind Enemy Lines\Legacy

    4- Open cmd and type:

    cd C:\Program Files (x86)\Steam\steamapps\common\Commandos Behind Enemy Lines\Legacy

    5- Once you’re in the folder by cmd, just type:

    mklink comandos.exe commandos.exe

    6- Launch the Legacy version of the game on steam with 1080p resolution.

    • So this is embarrassing… I’ll admit to never actually having Steam installed and trying it out. Thank you for the information!

    • Hi guys,
      First I want to say thanks to @stevenh for bringing out this patch, and for Tonelotto for coming up with a solution to use it on Steam.
      BUT I followed your instructions to the T Tonelotto with one slight difference as my Steam games are not on my c: drive but my d: drive so adjusted instruction 3 & 4 to my games location.
      Yet it does not work.
      What info do you need to troubleshoot this?
      Thank you in advance for your assistance.

  21. Just for clarification on the spanish versions, the EXE with 2,469,376 bytes is the v1.0 and the one with 2,469,888 bytes is the v1.05, a patch they released only for the spanish version. Tested your app on both version working perfectly. Thank your so much!

  22. Hi, I tried the patch on the gog version, and after that every time I move the mouse it gets stuck. I am on wondows10 and I kept my task manager open, it seems it’s using my Integrated graphics instead of my main GPU, any solution?

  23. THe download link is dead, it leads to nothing and the file cant be downloaded. Guess Ill have to delete the game :(

  24. Can you please add SINP Ultimate Fix to the list? It fixes the same speed issue as the BEL Ultimate Fix.

  25. Solution if you have freezes when moving the mouse: Lower your mouse polling rate. 125hz works for me, no slowdown when moving mouse.

  26. Hi, i just wanna say thanks for your hard work.
    I tested with 2 different version of Commandos (Spanish), 1.00 and one with the 1.05 patch. 1.00 works fine and the resolution is save but 1.05 is not saving the resolution, meaning that you have to change manually every time. it’s possible to fix this? Thanks!!

  27. Hi,

    Could you add 1280×800 for SteamDeck? (I guess there also other 16:10 devices)

    Currently I’m using 1920×1200 external display, and with native resolution, you know what happens. so 1280×800 is IMHO best for 1920×1200 resolutions too)
    It would be nice to have possibility to hack all 4 resolutions. I’m sure I would like to have at least 1280×720 and 1280×800, because I’m using both 16:10 and 16:9 aspects on different devices. I have also some nice 4:3 devices.

    It works (I cannot say perfectly) with GOG binaries (both regular comandos.exe and comandos_w10.exe)
    It says unsupported binary with SINP comandos.exe (this sinp is generaly problematic for me under linux/wine)

  28. Hi, just to inform that steam version patched. The exe file from folder – C:\Program Files (x86)\Steam\steamapps\common\Commandos Behind Enemy Lines\Legacy need to be patched.
    To bypass direct 5 error just rename the comandos.exe to something else.
    Thanks a lot for your fix!

  29. I have tried the patch with GOG Spanish installer (patching the comandos_win10.exe and comandos.exe files) and it works but it has a problem, the right side of the screen is glitched, is there a fix for this?
    here is an image: https://i.imgur.com/gfOlFEc.png

    • Howdy. That just means that the map you’re playing is more narrow than the current screen width. As mentioned above in the actual article, the only thing to do is zoom in with +/-.

  30. Hello, amazing patch, could you add more lower widescreen resolutions like 896×504 etc. Find it better with larger ui and you get that only on lower res widescreen resolutions.

    lower widescreen resolutions:
    https://pacoup.com/2011/06/12/list-of-true-169-resolutions/

    Thanks for the patch!

  31. I’ve been trying to make it work for a week, and there’s no way, I’d like to ask for help, I just want to make it work at least in a resolution of 800 x 600 or in 1024 x 768, the problem is that I have the Spanish version, I have the original cd I’ve I bought the one from steam and also the one from gog, but of course I’m Spanish and I don’t understand English very well. I would like to apologize for my spelling mistakes, (I am using a translator) Thanks in advance.

  32. Tested with commandos spanish version today on March 3, 2023 in Windows 11. First, “comandos.exe” executable renamed to “commandos.exe” to solve Windows 11 compability problems. Second, downloaded https://github.com/narzoul/DDrawCompat/releases and copied dll file to Commandos installation folder. Third, setted Commandos Resolution Hack at 1920×1080. And works !!! Thanks !!!

  33. For those who want to install Call Of Duty today and run the game in resolutions like 1080p or even 2160p (16:9), buy the game on GOG.com the name of the game is Commandos Ammo Pack (it includes the first version of the game and its expansion), after purchasing the game install normally.
    When you finish installing the game, follow the exact steps in this video (all of them) and download the files using the links in the Video comments, including the FIX 64 and the DLL that is explained in the video. Your game will no longer have speed issues, lags, stuttering and will work in 1080p or 4k,
    I want to thank you immensely for the PATCH that allows you to change the resolution of the game, now I will be able to play Commandos in 4K, but I already leave a tip if you have a 4K monitor, use the 1080p resolution the menus and buttons and objects are better for viewing and also for playing .

    VIDEO: https://www.youtube.com/watch?v=gcs9_zwBPbE

  34. The tool do not seems to manage correctly the European version of games when you patch the game with “Commandos 1.1 Patch update for European Game Versions” for BEL
    or the Patch from Eidos Technical Support Team for BCAD

    After patching the game Behind ennemy mine to 1.1 :
    The exe is detected as a russian version and try to find WAR_MP.DIR file instead of WARGAME.DIR.

    “Found the Russian version of Commandos – BEL
    Neither WAR_MP.DIR or it’s contents could be found! Interface wont be updated.”

    For Beyond call of duty when Patch with the Eidos patch.
    The exe is not know at all and tell us to send a message here.

    You can contact me by mail if you want to recover those EXE.

  35. Hello, tried to use your patch on Windows 10 with GOG version, it works, but i have one big issue – after using patch game screen starts flickering every 5-10 seconds. It looks like game trying to alt-tab itself O_O I tried to test it on another PC and there is no problem, maybe it’s my monitor issue, not sure.
    Any idea how to fix it ? Without patch there is no such issue.

    • This is a new one. Is another app trying to take focus? Are you sure you’ve chosen the correct fullscreen resolution?

      • I managed to fix it after many attempts with settings. For me issue was compability mode with Windows XP. After i unchecked this box this flickering with white stripes gone.
        Only issue with GOG version is game SUPER slow. It feels like they wanted us to feel how to play in 1998 with Pentium II. Little programm Dxwnd helped with this issue as you can fix timings (speed) of game.


Leave a comment


*