“Exclusive” DirectDraw palette isn't actually exclusive

橙三吉。 提交于 2019-12-03 03:40:54

Someone actually found a registry entry fix for this, here:

http://answers.ea.com/t5/Command-Conquer-The-Ultimate/Common-Problems-Read-This-Before-Posting/m-p/222052

Look for "scrambled colours" on that page and you'll get to the part with the fix you need.


Since online resources are fleeting, though, here's the full explanation:

Make a new key under "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectDraw\Compatibility\" for the program.

If the program you're applying the compatibility for is a 32-bit program, and you're on a 64-bit system (either applying it manually or through a 64-bit program), don't forget to add the "Wow6432Node" between "Software" and "DirectDraw" to compensate for that.

In that key, set these values:

  • "Flags" (REG_BINARY) : [00,08,00,00]
  • "Name" (REG_SW) : File name of your program. No path, just the executable file name.
  • "ID" (REG_BINARY) : DirectDraw ID of the application.

To get the required DirectDraw ID, run the program and then check this registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectDraw\MostRecentApplication

Again, if you're on a 64 bit system and the program you're doing this for is a 32-bit one, add the "Wow6432Node" after "Software".

The ID in that key is four bytes. Reverse their order to get the bytes to put in the ID value. 32dd83d5 becomes d5,83,dd,32.

What you can do is a 'simple' workaround. Since your game is an old game it is probably no match to current hardware, which is why this trick will work:

  • Blit everything to an offscreen buffer (memory)
  • convert the 8bit buffer to 16 bit(or 32 bit) using the current palette (so also done in memory)
  • copy the contents of the 16 bit(or 32bit) buffer to the backbuffer of the screen
  • flip the screenbuffer.

This will require minimal changes to your game, and will get rid of palette issues completely, though your game can still use all it's palette trickery

R

Apparently "an application should not call SetSystemPaletteUse, unless it has a maximized window and the input focus". Perhaps some other program is misbehaving. That description makes it sound very much like Microsoft hope all programs will cooperate and offer no way to compel them to do so. It's like being back on Windows 3.1. :)

Random suggestion: have you tried SetSystemPaletteUse with the SYSPAL_NOSTATIC256 parameter?

You could also see if your palette contains the 20 Windows reserved colours; if so, it means that any other palettised program that just uses Windows colours will not need to change the palette in order to render itself, as I understand it.

I don't know DirectX at all, but I'd suggest trying to do your rendering off-screen then converting to the display depth... I imagine you can get Direct2D to do all that for you...

OcTiC

All you have to do is set your PC to 16 bit colours in Control Panel and the game comes right, works on Original Command and Conquer for me :D

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!