将 directx 7 应用程序移植到 Windows 7 上运行有多难?
我们有一个在Win98上运行的街机/救赎游戏,但是可以运行它的硬件最终已经过时了。游戏使用了许多缩放效果,其中一些是通过 3D 路径,并发挥了一些将物体移入和移出视频内存的技巧。如果我将其移植到 Windows 7 上运行,会带来多少麻烦?主要是重新编译,还是 API 经历了这样的转变,以至于我可能需要重新编写设备接口?
We had an arcade/redemption game running on Win98, but hardware which can run it has finally gone obsolete. The game used a number of scaling effects, some through the 3D path, and played some tricks moving things in and out of video memory. If I was to undertake porting it to run on Windows 7, how much trouble would it likely be? Would it mostly be recompilation, or have the APIs undergone such transformation that I might as well re-write the device interfaces?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不要以为是移植到Win7。只需简单地移植到 DX9,然后让 DX 来处理 Win7 部件即可。事实上,你可能可以让它保持原样,它应该运行——但你提到你用视频内存做了一些疯狂的事情,我认为这与 DX 无关。 (即通过 GDI 或其他一些 hack?)。无论如何,DX7、8 和 9 API 都有相当大的差异。但好处是它们都是向后兼容的。如果您的代码是纯dx7,请尝试针对最新的SDK进行编译,看看它是否可以直接在win7上运行。
Don't think of it as porting to Win7. Just simply port to DX9 and let DX do the work with the Win7 parts. Infact, you could probably just leave it as is and it shuold run -- but you mention you do crazy things with video memory that I assume has nothing to do with DX. (ie either through GDI or some other hack?). Anyway, the DX7, 8 and 9 APIs all have quite drastic differences. But the nice thing is they're all backwards compatible. If the code you have is pure dx7, try compiling against the latest SDK and see if it works on win7 straight off.
我已经有一段时间没有编写任何 DirectX7 代码(或根本是 Direct X 代码),但如果我记得在 7 和 8 之间有一些重大的 API 更改事件 - 更不用说 9 或 10 - 这将使这样的更改有点更困难。具体来说我认为主要的变化是他们在7之后重构了系统,将DirectDraw合并到Direct3D中,这样两个系统在7和8之间就不再完全分离了。从那时起我就没有再看过它,但我怀疑考虑到许多新的编码方法以及 API 已经发生了很大的变化,因此进行这些更改可能需要一个项目,而不是像您希望的那样主要是重新编译。
It's been a while since I've written any DirectX7 code (or Direct X code at all) but if I recall there were some significant API changes event between 7 and 8 - let along 9 or 10 - that would make such a change a bit more difficult. Specifically I think the major change was that they refactored the system after 7 to merge DirectDraw into Direct3D so that the two systems were no longer completely separate between 7 and 8. I haven't look at it since then, but I suspect that given the number of new coding methods and like that the API has change quite a bit so it is probably going to be a bit of a project to make these changes rather than mostly recompilation like you might have hoped.
您曾经将内容移入或移出视频内存吗? 颤抖
不过……现在比 DX7 出现时更快。你到底在做什么?从你的描述来看,不可能说它有多容易。 DX7 应用程序应该仍然可以在 Windows 7 上运行,我无法想象您可能使用了哪些奇怪的功能会导致它崩溃。
此外,将应用程序从 7 转换为 DX9 实际上并不是那么困难(转换为 DX10+ 将是一场噩梦)。它们仍然相对相似......自那时以来发生的主要变化是将 D3DTRANSFORMSTAGESTATE_* 或 D3DRENDERSTATE_* 等内容缩短为 D3DTSS_* 或 D3DRS_*。
编辑:自 DX7 以来,我能想到的最大变化是显卡制造商放弃了对调色板纹理的支持,这“可能”会破坏现代机器上的一些旧应用程序。这确实是一个非常简单的修复...
Edit2:将磁盘中的内容解压到纹理中可能会有点痛苦。您的主要问题是,当您创建纹理时,您最终会遭受性能损失。但是,如果您已经创建并打开了大量纹理,那么您可以根据需要加载相关纹理。您只会遭受锁定/解锁攻击。可以通过提前几帧加载资源来缓解这种情况。但是,如果这样做,毫无疑问需要多线程并从多个线程调用 D3D。如果执行此操作,请在设备上设置多线程标志。
You EVER moved things in and out of video memory? shudder
Still ... its quicker to do that now than when DX7 was around. What exactly were you doing? From your description its impossible to say how easy it would be. A DX7 app should still run on Windows 7, I can't think of what odd features you may have used that would cause it to break.
Also converting an application to DX9 from 7 is not actually all that hard (Converting to DX10+ would be a nightmare). They are still relatively similar ... the main thing that has changed since those days is the shortening of things like D3DTRANSFORMSTAGESTATE_* or D3DRENDERSTATE_* to D3DTSS_* or D3DRS_*.
Edit: The biggest change I can think of that has happened since DX7 is that graphics card manufacturers have dropped support for palettised textures which "could" break some old apps on modern machines. That really is a very simple fix though ...
Edit2: Decompressing things from disk into a texture can be a bit of a pain. Your main issue is the fact that you end up suffering A performance hit when you create the texture. However if you have a load of textures already created and open then you can load to the relevant texture as and when you please. You only suffer a lock/unlock hit. That can be mitigated by loading a resource a few frames in advance. If you do this, though, it will no doubt require multi-threading and calling D3D from multiple threads. If you do this set the multi-thread flag on the device.