Difference between revisions of "Glossary:DirectX/DirectDraw troubleshooting"
m (→Registry hack: updated template usage) |
|||
(22 intermediate revisions by 10 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | ==Manifestation== |
− | + | {{Image|DirectDraw glitch example in Patrician 3.png|Example of a DirectDraw issue in [[Patrician 3]] - the game fails to refresh the map properly if the player enters and exits the main menu.}} | |
− | {{ii}} Windows XP, Vista and 7 have compatibility issues with DirectDraw games using 256 color depth resulting in incorrect colors. | + | {{ii}} Windows XP, Vista and 7 have compatibility issues with DirectDraw games using 256-color depth resulting in incorrect colors. |
− | {{ii}} | + | {{ii}} On Windows 7, these applications can also fully lock up the display, requiring a hard reset of the system.<ref>[https://answers.microsoft.com/en-us/windows/forum/all/directdraw-applications-freeze-on-windows-7/4e83dac8-8d4d-4dad-9f1d-e08fa2fe1e48 DirectDraw applications Freeze on Windows 7 anywhere between 1 minute and 3 hours into running them - Microsoft Answers]</ref> |
+ | {{ii}} On Windows 8 and later, the rainbow color issue is generally not present, but DirectDraw compatibility is still low in general. Attempting to run games which use DirectDraw can lead to one of the following outcomes, depending on the game: | ||
+ | :* launching correctly (e.g. ''[[RollerCoaster Tycoon 2]]'') | ||
+ | :* running with visual artifacts when scrolling (e.g. ''[[Patrician 3]]'') | ||
+ | :* running initially, but crashing in scene changes (e.g. ''[[Heroes of Might and Magic IV]]'') | ||
+ | :* running with significant slowdowns (e.g. ''[[Age of Wonders: Shadow Magic]]'') | ||
+ | :* launching in a black screen without responding, requiring the use of [[Task Manager]] to exit (e.g. ''[[Command & Conquer: Red Alert 2]]'') | ||
+ | :* failing to launch at all (e.g. ''[[Worms 2]]'') | ||
+ | |||
+ | ==Affected titles== | ||
+ | {{mm}} [[List of DirectDraw games]] | ||
==Cause== | ==Cause== | ||
− | This issue appears to be caused by | + | This issue appears to be caused by {{File|explorer.exe}} resetting the system palette, essentially overwriting the palette defined by the game (hence the rainbow colors). This is evidenced by how taking a screenshot of an affected game will show just the discoloration with black where the other game assets would be rendered and by the fix itself. |
− | + | These games rely on DirectDraw, an API in [[DirectX]] (versions 7 and earlier) which was used to render graphics and is now deprecated. They used an exclusive color palette; they would set the system palette (the colors the system can use, back when there were only 256 colors) to the palette the game wants to use. However, some applications try to set their own exclusive palette, causing conflicting colors since the game's exclusive palette is no longer actually exclusive and is set to the wrong colors. In newer versions of Windows, CSRSS and the desktop window ({{File|explorer.exe}}) set their own palette, which causes the odd colors.<ref>[http://stackoverflow.com/questions/1054365/exclusive-directdraw-palette-isnt-actually-exclusive gdi - "Exclusive" DirectDraw palette isn't actually exclusive - Stack Overflow]</ref> | |
==Fixes== | ==Fixes== | ||
− | === | + | ===[[Glossary:Display wrapper|Custom DirectDraw wrappers]]=== |
− | {{ii}} | + | {{ii}} These are small {{File|.dll}} files which are to be placed in the same directory as the target game's executable. They differ in implementation. |
+ | {{ii}} The choice of the wrapper is handled case-by-case. Try several of them out and compare their performance until the ideal solution is reached. | ||
− | + | {{mm}} [https://github.com/FunkyFr3sh/cnc-ddraw cnc-ddraw] - converts API calls to Direct3D 9, OpenGL or GDI; additionally supports framerate limiting, [[Glossary:Vertical sync (Vsync)|vertical sync]], mouse sensitivity scaling, [[Glossary:Borderless fullscreen windowed|borderless windowed mode]], and [[Glossary:Upscaling|upscaling]] via GLSL | |
− | [ | + | {{mm}} [https://github.com/narzoul/DDrawCompat DDrawCompat] - no API conversion, tries to fix broken calls rather |
+ | {{mm}} [https://dxgl.org/ DXGL] - converts API calls to [[Glossary:OpenGL|OpenGL]] | ||
+ | {{mm}} [https://github.com/elishacloud/dxwrapper DxWrapper] - uses a combination of multiple methods, including implementations of other open-source renderers as switches; requires manual {{file|.ini}} editing | ||
+ | {{mm}} [https://fdossena.com/?p=wined3d/index.frag WineD3D] - based on [[Wine]]'s Direct3D emulation, converts API calls to [[Glossary:OpenGL|OpenGL]] | ||
− | === | + | ===General DirectX emulators=== |
− | [https://sourceforge.net/projects/dxwnd/ DxWnd] was originally created to enable old DirectX games to run in a window. | + | {{mm}} [https://sourceforge.net/projects/dxwnd/ DxWnd] was originally created to enable old DirectX games to run in a window. Currently, it provides even more features: It can fix the odd rainbow color issue, enable time stretching, and you can decide between running the game in a window or in full screen. |
+ | {{mm}} [[dgVoodoo 2]] converts old DirectX and Glide calls to Direct3D 11/12 ones. | ||
+ | |||
+ | ===Tool-based=== | ||
+ | {{mm}} [https://www.nma-fallout.com/resources/directdraw-compatibility-tool.95/ DirectDraw Compatibility Tool] is designed to fix color palette corruption in old games. | ||
+ | {{mm}} [https://community.pcgamingwiki.com/files/file/721-win-7-directdraw-compatibility-tool/ w7ddpatcher] is another simple method. | ||
+ | {{mm}} [http://bedagainstthewall.blogspot.com/p/palettestealersuspender.html PalettestealerSuspender] prevents palette issues using a different method.<ref name=bed>[http://bedagainstthewall.blogspot.com/2009/07/solving-color-problem-red-grass-purple.html Bed Against The Wall: Solving Color Problem (Red Grass, Purple Water) In Age Of Empires 2: Age Of Kings (The Conquerors And Others Too) On Vista And Windows 7]</ref> | ||
+ | {{mm}} [https://12noon.com/?page_id=641 Display Changer II] changes the Windows desktop width, height, color depth, refresh rate, and rotation temporarily or permanently (via a configuration file). Can also run an application in a specific display setting and return to the previous resolution when the application closes. | ||
===Registry hack=== | ===Registry hack=== | ||
− | Windows 7 actually has a | + | {{ii}} Windows 7 actually has a built-in, hidden fix for this issue, but requires editing the registry. |
− | {{Fixbox|description= | + | {{Fixbox|description=Registry hack|ref=<ref name=bed/><ref>[https://www.vogons.org/viewtopic.php?f=8&t=25534&start=20#p259471 mudlord's Windows 7 DDraw Compatability Fix (Fixes Garbled Colors) \ VOGONS]</ref>|fix= |
− | #Run | + | #Run the game at least once and exit out of it. |
− | # | + | #Open the Registry Editor and navigate to {{Registry|{{p|hklm}}\SOFTWARE\{{p|wow64}}\Microsoft\DirectDraw\MostRecentApplication}}. |
− | #Take a note of the name, | + | #Take a note of the name, executable name, and the hexadecimal ID which looks similar to this: <code>0x02e41c67</code> |
− | #Remove the | + | #Remove the <code>0x</code> prefix of the ID and separate the values into pairs, like so: <code>02 e4 1c 67</code> |
− | #Take the pairs and reverse their order, like | + | #Take the pairs and reverse their order, like so: <code>67 1c e4 02</code> |
− | #Open | + | #Open a text editor and add the registry text below. Change <code>NameOfGame</code> and <code>Name</code> appropriately for the target game, leave <code>Flags</code> untouched, and enter the new ID while keeping commas intact. If running a 32-bit system, remove <code>Wow6432Node</code> from the path.<br> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<pre> | <pre> | ||
Windows Registry Editor Version 5.00 | Windows Registry Editor Version 5.00 | ||
Line 47: | Line 58: | ||
"Name"="game.exe" | "Name"="game.exe" | ||
</pre> | </pre> | ||
− | 7. Save | + | 7. Save the file as {{file|fix.reg}} to an easily accessible location and run it as administrator to import it to the registry. |
− | |||
}} | }} | ||
− | ===Kill Explorer with batch script=== | + | ===Kill Explorer process with batch script=== |
− | Paste the following into a text editor and save as a batch script. | + | {{Fixbox|description=Use a batch script|ref=|fix= |
+ | * Paste the following into a text editor and save as a batch script (.bat file) in the game's directory, then run it: | ||
<pre> | <pre> | ||
TASKKILL /F /IM "explorer.exe" | TASKKILL /F /IM "explorer.exe" | ||
Line 58: | Line 69: | ||
start explorer.exe | start explorer.exe | ||
</pre> | </pre> | ||
− | {{--}} If script fails | + | {{--}} If the script fails or crashes before it restores the Explorer process, it will result in a blank desktop screen. In this case, manually restart the process by calling the Run window (pressing {{key|Win|R}}) and typing <code>explorer</code> |
− | {{ | + | }} |
==See also== | ==See also== | ||
* [[Windows Compatibility Mode]] | * [[Windows Compatibility Mode]] | ||
+ | [[Category:Guide]] | ||
{{References}} | {{References}} |
Revision as of 16:10, 31 May 2023
Manifestation
- Windows XP, Vista and 7 have compatibility issues with DirectDraw games using 256-color depth resulting in incorrect colors.
- On Windows 7, these applications can also fully lock up the display, requiring a hard reset of the system.[1]
- On Windows 8 and later, the rainbow color issue is generally not present, but DirectDraw compatibility is still low in general. Attempting to run games which use DirectDraw can lead to one of the following outcomes, depending on the game:
- launching correctly (e.g. RollerCoaster Tycoon 2)
- running with visual artifacts when scrolling (e.g. Patrician 3)
- running initially, but crashing in scene changes (e.g. Heroes of Might and Magic IV)
- running with significant slowdowns (e.g. Age of Wonders: Shadow Magic)
- launching in a black screen without responding, requiring the use of Task Manager to exit (e.g. Command & Conquer: Red Alert 2)
- failing to launch at all (e.g. Worms 2)
Affected titles
Cause
This issue appears to be caused by explorer.exe
resetting the system palette, essentially overwriting the palette defined by the game (hence the rainbow colors). This is evidenced by how taking a screenshot of an affected game will show just the discoloration with black where the other game assets would be rendered and by the fix itself.
These games rely on DirectDraw, an API in DirectX (versions 7 and earlier) which was used to render graphics and is now deprecated. They used an exclusive color palette; they would set the system palette (the colors the system can use, back when there were only 256 colors) to the palette the game wants to use. However, some applications try to set their own exclusive palette, causing conflicting colors since the game's exclusive palette is no longer actually exclusive and is set to the wrong colors. In newer versions of Windows, CSRSS and the desktop window (explorer.exe
) set their own palette, which causes the odd colors.[2]
Fixes
Custom DirectDraw wrappers
- These are small
.dll
files which are to be placed in the same directory as the target game's executable. They differ in implementation. - The choice of the wrapper is handled case-by-case. Try several of them out and compare their performance until the ideal solution is reached.
- cnc-ddraw - converts API calls to Direct3D 9, OpenGL or GDI; additionally supports framerate limiting, vertical sync, mouse sensitivity scaling, borderless windowed mode, and upscaling via GLSL
- DDrawCompat - no API conversion, tries to fix broken calls rather
- DXGL - converts API calls to OpenGL
- DxWrapper - uses a combination of multiple methods, including implementations of other open-source renderers as switches; requires manual
.ini
editing - WineD3D - based on Wine's Direct3D emulation, converts API calls to OpenGL
General DirectX emulators
- DxWnd was originally created to enable old DirectX games to run in a window. Currently, it provides even more features: It can fix the odd rainbow color issue, enable time stretching, and you can decide between running the game in a window or in full screen.
- dgVoodoo 2 converts old DirectX and Glide calls to Direct3D 11/12 ones.
Tool-based
- DirectDraw Compatibility Tool is designed to fix color palette corruption in old games.
- w7ddpatcher is another simple method.
- PalettestealerSuspender prevents palette issues using a different method.[3]
- Display Changer II changes the Windows desktop width, height, color depth, refresh rate, and rotation temporarily or permanently (via a configuration file). Can also run an application in a specific display setting and return to the previous resolution when the application closes.
Registry hack
- Windows 7 actually has a built-in, hidden fix for this issue, but requires editing the registry.
Registry hack[3][4] |
---|
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DirectDraw\Compatibility\<NameOfGame>] "Flags"=hex:00,08,00,00 "ID"=hex:00,00,00,00 "Name"="game.exe" 7. Save the file as |
Kill Explorer process with batch script
Use a batch script |
---|
TASKKILL /F /IM "explorer.exe" start /w [insert executable name here].exe start explorer.exe
|
See also
References
- ↑ DirectDraw applications Freeze on Windows 7 anywhere between 1 minute and 3 hours into running them - Microsoft Answers
- ↑ gdi - "Exclusive" DirectDraw palette isn't actually exclusive - Stack Overflow
- ↑ 3.0 3.1 Bed Against The Wall: Solving Color Problem (Red Grass, Purple Water) In Age Of Empires 2: Age Of Kings (The Conquerors And Others Too) On Vista And Windows 7
- ↑ mudlord's Windows 7 DDraw Compatability Fix (Fixes Garbled Colors) \ VOGONS