Commandos – Behind Enemy Lines Resolution Fix
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.
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.
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.
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.
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.
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.
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) |
| '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) |
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 Hack Final v1.0
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.
- The Locale hack from here has also been added.
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.
And that's a wrap... go use every pixel your monitor can produce and play the game!

Yass Junction Diary
May 29th, 2011 - 14:28
I just want to say; thank you so much for taking the time to create this utility. I truly love the Commandos series and this will breath new life into the game. As for you speed problem, have a look here: http://forums.steampowered.com/forums/showthread.php?t=1236369 that should clear it up
Cheers
May 29th, 2011 - 15:59
Legacy, thanks for the comments. As for the speed issue, thanks for the link also. I’ve only seen it in the other versions of the EXE that I was given and don’t use those when playing. The GOG version works perfectly.
May 30th, 2011 - 11:15
I also heard that the GOG version works fine, I am using the Steam version; Sorry I forgot to mension that
June 7th, 2011 - 01:39
Steven, would there be any way that you can provide me with the non-steam No-CD v1.1 .exe? Steam’s original v1.1 .exe does not work with your application, I am asuming it has to do with an encryption of some sort. If I use another .exe it works just fine (v1.0), the only problem is; I have searched everywhere, but I am unable to find a no-cd for v1.1 (There is one site, but it requires a 32-bit operating system in order to replace that default .exe and as I am running 64-bit I am screwed)
As you know, the .exe file that is provided with the speedfix from the Steam Forum does work, the only problem is, the speed is way to slow for me.
If you are able to help out, please let me know.
Thank you
June 8th, 2011 - 05:17
hey !!! so thanks for this !!! but i have some trouble… when i launch (in any resolution) i have a black screen (without sound) i use the ultimate fix on the game installed from the original CD (1st edition) and im on win 7 64bit OS. a friend has exactly same but it work for he ! have you got any idea ?
i have uninstall FFDSHOW but i have the same problem
June 8th, 2011 - 20:26
edouardsie,
Can you press any keys once the game has started?
Does it crash out if you leave it for a minute?
Are you setting a resolution that your monitor can handle? Try a lower resolution?
What version of the game do you have? I have access to a Windows 7 64-Bit machine and may try this tonight.
June 9th, 2011 - 20:51
Edouardsie,
I have re-uploaded the hack. Please download it again and give it a go.
The issue was pointed out by Ferdinand @ http://sites.google.com/site/commandosmod/ and I have applied his fixes.
Please tell me how you go.
June 9th, 2011 - 18:26
Ey Steven, i posted my original comment here: http://www.gog.com/en/forum/commandos/better_resolutions_for_single_multiplayer_commandos_behind_enemy_lines
But it seems you have posted all over the place so it might be hard to keep track of it all, so that is why i am posting directly here.
Seems to work perfect for me. Thanks a lot! Little weird to see black bars on top and on the side after playing so long in the original resolution. Any change/plans to get that textured as well with the original texture?
Anyway, i was wondering, since you seem pretty experienced in coding, if you could take a look at the annoying crashes in BEL after video’s / briefings a lot of people (including me) are having, BtCOD doesn’t seem to suffer from this problem. I tried every solution on this and other forums, the loader, compatibility modes, etc… you name it, nothing works. No fix yet that i know of. The executable is probably calling some functions that do not exist anymore or have changed locations in the recent Windows versions???
June 11th, 2011 - 19:04
Some more info, the following error always comes, always at the same address, maybe it of some use to you to find the cause and even create a fix:
Faulting application comandos.exe, version 0.0.0.0, faulting module comandos.exe, version 0.0.0.0, fault address 0x0024bae0.
Bytes:
0000: 41 70 70 6c 69 63 61 74 Applicat
0008: 69 6f 6e 20 46 61 69 6c ion Fail
0010: 75 72 65 20 20 63 6f 6d ure com
0018: 61 6e 64 6f 73 2e 65 78 andos.ex
0020: 65 20 30 2e 30 2e 30 2e e 0.0.0.
0028: 30 20 69 6e 20 63 6f 6d 0 in com
0030: 61 6e 64 6f 73 2e 65 78 andos.ex
0038: 65 20 30 2e 30 2e 30 2e e 0.0.0.
0040: 30 20 61 74 20 6f 66 66 0 at off
0048: 73 65 74 20 30 30 32 34 set 0024
0050: 62 61 65 30 0d 0a bae0..
Words:
0000: 6c707041 74616369 206e6f69 6c696146
0010: 20657275 6d6f6320 6f646e61 78652e73
0020: 2e302065 2e302e30 6e692030 6d6f6320
0030: 6f646e61 78652e73 2e302065 2e302e30
0040: 74612030 66666f20 20746573 34323030
0050: 30656162 0a0d
Btw, i am running Commandos Ammo Pack from GoG, on Win XP SP3, fully up to date. I have tried the BEL Loader, same issue. All kinds of compatibility settings, same issue. Uninstalled FFDshow, same issue. Even tried the ultimate fixes from Steamforum, but as you say, they are the same files as GoG version.
June 21st, 2011 - 10:58
Spinvis,
I will try and look at this issue in around 2 weeks… I imagine I’ll have a fair amount of difficulty reproducing the problem though. Can you point me to any other links where people are having the same issue?
Steven.
June 28th, 2011 - 18:59
It seems my reply to you Steven are not coming through, i send you a PM on GoG.
June 21st, 2011 - 02:04
Hi, stevenh.
1) I try use your utility for: Commandos BEL 1.1 Russian + Commandos BCD Russian
But it dislike files size.
Can you add support of this versions?
Here zip with this files – http://www.sendspace.com/file/18b62k
2) What about Tutorial.exe from BCD? Is it also supported? it would be nice to make a complete package for modern computers.
Best regards, rty.
June 21st, 2011 - 10:59
rty,
Russian?! I didn’t even know that there was such a version… your request is in the queue.
I’ll try and look in to this (as it should be a pretty quick bit of disassembly to get it working) when I can (probably over the next week.)
Steven.
June 22nd, 2011 - 01:32
Yep. In 1999 year few pirates studios make their localization of game and after 11 years company “New Disk”re-release game, but finally as the official distributor
It possible to patch Comandos.exe with 1.1 patch for ‘Sold Out’ version and fix resolution like Ferdinand wrote here – http://sites.google.com/site/commandosmod/tutorials/bel_widescreen
So I hope it would be simple and doesn’t take much your time.
June 28th, 2011 - 00:10
I have updated the code to support Commandos – BEL (Russian).
I will also make it work for BTCOD Russian soon. Please give the download a try on your BEL Russian and tell me how it goes.
Steven.
June 29th, 2011 - 01:25
I test it with 1366×768 but something wrong with it. Here scrinshots – that http://postimage.org/gallery/45mzlkdc8/
rty.
June 29th, 2011 - 10:51
rty,
I can’t select this resolution, but every other resolution (with your executable) works on my Hardware. Can you try another resolution (higher than 1024×768, but not 1366×768) and see if it works!?
Steven.
June 29th, 2011 - 23:19
I cant test resolution higher than 1366 cause it maximum on my netbook, but I test it now with 1360×768 and smaller and it work great. Strange why only with 1366 I have this problem…
But I think it’s not a big deal and we can assume that the utility works well
September 22nd, 2011 - 07:29
Great hack!
If you get the “i can not find directx 5″ message for some resolutions, for example 1920×1080, it’s because of the HideDisplayModes fix in the Win95 compatibility that you need to get sound in the game. If you know what the application compatibility toolkit is you know how to disable that fix so that you can get sound and all resolutions.
October 14th, 2011 - 10:41
JPeterson,
Thanks for this note! It’ll help out a lot of people using compatibility mode. I don’t know about hacking in a work-around to hack-out the compatibility mode… It’d require code-injection rather than byte replacement and this probably isn’t recommended. Then again, the compatibility toolkit might just store data against an executable in the registry… I’ll give it a go if/when I find a few spare moments
Steven.
October 14th, 2011 - 10:22
I just bought the complete pack from getgamesgo and my commandos.exe (for BEL) is 7,368,705 byes =\
October 14th, 2011 - 10:39
someguy,
That’s a slightly obese executable!? The game runs perfectly from this?
Feel free it to email me at stevenhoefel AT hotmail DOT com.
I’ll break it open… but I’m concerned it’s encrypted. There’s not much I can do if it is.
Steven.
October 14th, 2011 - 11:10
Hey I appreciate the quick response. Yes I’ll go out on a limb here and say its probably wrapped code ala copy protection. I found a alternate solution by using your utility on a file available in a thread titled “All You Need to Fix and Modernize all Commandos Games in One Thread (Save/Resolution)”
Thanks for taking the time to code it
Worked fine on Win7 64 and I didn’t check if I had Net 4 or not.
October 15th, 2011 - 05:28
I would like to say “Thank you sir for the job well done”!
I ran GOG Ammo Pack version, Win 7 64 Bit and ATI Crossfire 4870×2 in 1920×1200 resolution with your hack. All is well!
I was wondering if I can use this with Commandos 2 and 3?
October 16th, 2011 - 08:40
MNguyen,
I imagine Commandos 2 and 3 would use the same process… I’ll have to have a look in to this when I get the chance. I have seen forums on how to do this, so it cannot be too much harder.
Steven.
October 21st, 2011 - 10:00
Hey Steven
Awesome fix.
But I have a question?
When I use resolution higher than 1024×768 the top bar (in game) is moved way to the left (out of the screen), and I cannot see the avatars for my soldiers.
Anyone else have this problem?
Also, the speed issue? Is there anyway to fix this permanently?
As of now I run the game through another program, supressing the power of my CPU, wich slows the game to normal.
October 21st, 2011 - 10:01
This is regarding BEL
October 21st, 2011 - 10:29
LOL – I really miss the edit-function
BTW this is the German version.
It may be useful to know, that before I downloaded your hack I wasn’t able to set a fixed resolution (i.e. when I restarted the game it was back to 512×384 – every time).
- I’ve unchecked “read-only” for the entire folder, but it doesn’t work.
- Also I’ve set the .SIZE parameter of the commando.cfg file to [ .INITSIZE 3 ]
(the resolution doesn’t reset to 512×384 any longer – after your hack)
I’ve just found a workaround for the top-bar issue:
- I’ve set the hack for 1440×900 (or any other)
- I load the game (top bar i gone/moved out of screen)
- I choose another resolution in-game (e.g. 800×600)
- I choose back to 1440×900 (also ingame)
Now top bar is there!
But the whole reason I googled in the first place was so that I didn’t have to change resolution upon game-launching. And now I have to do it twice
haha..
Just to be sure I’ve tested in BtCoD, and there’s no problem.
Any suggestions?
And also speed issue, any suggestions?
October 23rd, 2011 - 18:59
Kevin,
Good work on working out a work-around… I cannot think why the issue is happening, but I know it doesn’t happen with the other versions. I will try to source your version (have you patched it at all?) and see if I can reproduce it.
Meanwhile, with the speed issues… it sounds like you do not have the latest version of Commandos. I don’t know what version you have now, or how to patch it… I can only recommend you try to find an update?
Steven.
November 26th, 2011 - 10:33
This looks brilliant, but is not working with my Steam copy of the game.
Any help?
November 26th, 2011 - 21:51
Devin,
If you can tell me the size of the EXE then I might be able to help. Unfortunately Steam encrypts the executable (as far as I am aware) and therefore I cannot open it normally. If the size is around 3mb instead of 7mb then I should be able to look in to it.
Steven.
December 31st, 2011 - 22:06
Thank You a lot for this. Just bought the game from GoG.com even though I had the steam version already, but it doesn’t matter since the GoG version is a lot better. And with this fix it is just perfect.
Happy New Year!
December 31st, 2011 - 22:09
Oh and if only it was possible to make this run windowed
February 17th, 2012 - 18:13
Hi. If you still interested in this programm, can you update it and add wad file for 1920×1080 ( from here https://sites.google.com/site/commandosmod/tutorials/bel_widescreen ) and make “Just apply” button, which will apply fixes without running the game? And maybe you’ll even add better bmp background for each resolution (from the same site).