Gaming Windows Compatibility
From Tran Minh Anh's website
From Gordon's Tech blog:
256-color issues with DirectDraw and Windows 7 Fixing the color problem in Windows 7
If you are reading this post, you have probably experienced the "psychadelic" color problem with an older game. The root cause of the problem is that the game is using DirectX 7 (or earlier) DirectDraw calls in a 256-color (8-bit) mode. This is not translated correctly to the current 32-bit displays.
I know it's a bit old-fashioned, but I'd still like to play some older games, such as Age of Empires and Starcraft, but the broken color pallette makes them almost unplayable. For a long time, I expected that checking the "Run in 256 color mode" on the compatibility tab should fix the issue. However, it does not.
Then I came across the "kill explorer" patch. Windows explorer in Vista/7 uses DirectDraw, and explorer changes some mode settings, even for full screen applications. This causes the color incompatibility issue with the older DirectDraw API. Killing explorer while the game runs will work around this issue. To use this hack, create a batch file (.bat) in the game directory, like this:
taskkill /f /im explorer.exe
start /w gamename.exe
This script shuts off explorer while the game is running, then restarts it when the game is over. Note the "/w" option when starting the game. This makes the script wait for that program to exit.
The problem with this script is that it kills explorer, and thus makes it difficult to use any other applications while the game is running. Also, my volume controls are soft-keys on the keyboard, and those keys handled by explorer. So killing explorer means I cannot adjust the volume while the game is running. This left me looking for another way.
I tried a few esoteric options, such as running Wine on Windows to emulate the older DirectX libraries. I then came across is a program called DxWnd, which runs a DirectX application in a window. This has the net effect of mapping the older DirectX 7 calls to the current DirectX 10. That almost worked, but would not run full screen, so I was still looking.
Then I came across a registry hack. If you browse in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectDraw\Compatibility\, you will see several entries for a few popular games. Starcraft, Age of Empires and a few others are already in there, so why is the hack not working? It turns out that the id is very specific to the application version. It is easy to find the Id of an application by looking in DirectDraw\MostRecentApplication. (Note: since explorer is also a DirectDraw application, it will sometimes update the Id. I used a program called procmon with a capture filter of DirectDraw\MostRecentApplication to help me find the application Id.)
Some sites will tell you to reverse the bytes of the id and store it as a hex field, but it also works if you leave it as a dword field, like it shows up under MostRecentApplication. You can key in your registry changes manually, or create a .reg file to import. For example, a registry file for Age of Empires 2 looks like this:
Windows Registry Editor Version 5.00
UPDATE: If you are using 64-bit Windows, you also need to write the same keys to the path [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DirectDraw\Compatibility\appname], because the old application will be run in 32-bit emulation mode.
Save that file as "AgeOfEmpires.reg" and double click on it to import the data. If you would like to share other application ids, please post them in the comments.
This wors pretty well, but a few questions are unanswered. First, why is this not covered by one of the check boxes from the application compatibility settings, and second, what do the flags mean? I was unable to find an answer to either of these questions. If you have any ideas, please drop me a note.