火星守望者
精华
|
战斗力 鹅
|
回帖 0
注册时间 2013-7-14
|
本帖最后由 sorayuki 于 2014-2-10 17:39 编辑
所以微软本来就有提供面向DirectDraw游戏的兼容性设置,
在注册表的HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DirectDraw\Compatibility位置(32位系统自己去掉Wow6432Node
里面有一些预设的,自己仿造创建键值就可以了
星际争霸1、帝国时代1、帝国时代2,我用这种方式都能跑起来不花屏。
网上给出的解释是explorer之类的系统进程,会使用全局调色板,这种调色板的设置会覆盖游戏对调色板的设置,使得颜色不正常
我当时参考的文章:
http://blog.macuyiko.com/2009/07 ... d-grass-purple.html
摘抄重要内容
(9 – reliable) Thanks to this comment I found out that Windows 7 actually provides a compatibility hack build in to allow running old DirectDraw games in all their glorious colors. The HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectDraw\Compatibility\ registry entry (or HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DirectDraw\Compatibility\ for 64bit Windows) contains entries for some popular games, such as Age Of Empires and Starcraft.
Take a look at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectDraw\MostRecentApplication to find out the correct application ID and edit the registry entry manually accordingly.
Technical explanation
If you’re interested in a little background on why this problem is happening, read on.
When I first encountered this problem, I already knew a little about DirectX, the GDI and the Windows API. Basically, back in the day, DirectX (which handles a lot of the graphics and multimedia workload in games and other program) included a component called Directdraw, used for rendering 2D graphics.
PCs back then weren’t really powerful. Everything had to be as fast as possible, even color handling. So something which Directdraw did for you was maintaining a palette of 256 colors. Like a painter, programmers could fill this palette with 256 colors they would use: ten greens for grass, 6 blues for water, and so on. Some of these 256 colors are static (but then again, not always) and cannot be changed. If you’re interested in the deep and dirty details: this page does a good job explaining it.
Now this is the thing: if you’re a fullscreen game, you don’t want other programs screwing up the system palette, changing your beautiful chosen colors to ugly greens and reds. And this is what’s happening in Windows 7. If you read System Palette and Static Colors on MSDN, it states that “However, because changing the static colors can have an immediate and dramatic effect on all windows on the display, an application should not call SetSystemPaletteUse, unless it has a maximized window and the input focus.” Alas, this is not enforced by Windows, and thus explorer.exe (which comes from Microsoft mind you) and other programs will happily call SetSystemPaletteUse and mess the poor fullscreen DirectDraw game up.
I googled a bit around to see if I could find any clues. This message at Stackoverflow describes the same problem. This message is actually posted by the maintainers of Worms: Armageddon. No-one provided an answer though. I opened up Visual Studio (which was still installed) to quickly throw something together in VB.NET to intercept the WM_SYSCOLORCHANGE, WM_PALETTECHANGED, WM_PALETTEISCHANGING and WM_QUERYNEWPALETTE messages and look at where they’re coming from. Basically, three processes are fighting:
CHANGING from (0) CHANGED from Age of Empires II Expansion (135458) Device context: 16847861 Process: 4508: age2_x1 Got 256 palette size scr [...] CHANGED from GDI+ Window (917744) Device context: 184626156 Process: 2452: explorer Got 256 palette size scr CHANGED from (65552) Device context: 1744905863 Process: 540: csrss Got 256 palette size scr [...]
The game itself, explorer.exe, and csrss.exe.
但是你们不觉得每次要玩游戏都要结束explorer进程很难受吗,
我感觉很难受啊
加了这样的兼容性键值以后,explorer在这样的进程在前台运行的时候就会暂停设置调色板的行为,使得游戏画面不受影响。
因为手工修改比较麻烦,外加这些键值里除了exe文件名还有一个识别exe文件的识别子(后来证明是文件头里的timestamp)
所以我弄了个有图形界面的添加这样兼容性设置的工具(就是10楼传的那个附件)
另外就是vmware我之前也有尝试过,虚拟机装xp系统,结果是帝国时代2会卡,总之效率堪忧的感觉。 |
|