以编程方式获取 DirectX 6.1 (DDraw4) 的设备上限

发布于 2024-08-15 19:04:53 字数 402 浏览 12 评论 0原文

我正在围绕 DirectX 6.1 库编写 w​​indows32 挂钩到 DirectX 9.0c;想法是用对 Direct 9.0c 的调用替换对 DX 6.1 3D 设备的所有调用并注入一些自定义代码,因此我正在修补的旧游戏(99 年)将能够使用着色器、后期效果等

。 DX 6.1 3D设备是通过创建DDraw模块创建的。然后游戏正在枚举设备上限。在我的模块中,跳过整个 DDraw 模块并初始化 3D 视图。所以我有问题,因为我根本没有 DDraw 设备,所以我无法给游戏所需的 Ddraw4 设备上限!

所以我的问题是如何在不初始化 DDraw4 设备的情况下获取 DDraw4 设备上限。也许创建固定列表并将其提供给游戏就足够了,但我不知道该列表上应该有什么(我给出了我认为应该是什么,然后游戏退出了 - 记录器显示它正好在设备上限之后已检查)

I am writing windows32 hooks around DirectX 6.1 library to DirectX 9.0c; Idea is to replace all calls to DX 6.1 3D device with calls to Direct 9.0c and inject some custom code, so old game which I am patching (99' year) will be able to use shaders, post-effects, etc.

The old DX 6.1 3D device was created by creating DDraw module. Game is then enumerating device caps. In my module the entire DDraw module is skiped and 3D view is initialized. So I have problem as I can't give the game Ddraw4 device caps which it requires as I do not have DDraw device at all!

So my question is how to obtain DDraw4 device caps without initializing DDraw4 device. Perhaps it will be sufficient to create fixed list and feed it to the game, but I have no idea what should be on that list (I gave what I thought it should be, and the game exited - logger showed it was just after device caps checked)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

◇流星雨 2024-08-22 19:04:53

我从来没有尝试过这个,但你可以尝试以下方法。假设您没有 6.1 SDK,您可以制作 DDCAPS 自己构建(DirectDraw 结构)(它基本上只是 DWORD),然后获取功能 (D3DCAPS9) 使用 DX9 GetDeviceCaps 函数。接下来,从获取的上限中获取所需的值(使用 DX9),并在 DDCAPS 结构中为 DirectDraw 设置等效值。然后,您可以将这个填充的大写结构提供给游戏。一些警告 - 正如您所提到的,您不知道它具体需要什么,所以这有点碰运气(除非您有源代码)。此外,caps 结构值可能不存在 1:1 映射(DX9 和 DDraw 之间)。最后——这与没有 6.1 SDK 相关——如果您不知道标志值,则在根据获取的上限设置值时可能会错误地设置标志。正如我所提到的,这可能还很遥远(或者需要大量的侦探工作),但我认为这可能是你可以尝试的事情。

I've never tried this, but you might try the following. Assuming you don't have the 6.1 SDK, you could make the DDCAPS structure (the DirectDraw one) yourself (it's basically just DWORDs), then get the capabilities (D3DCAPS9) using the DX9 GetDeviceCaps function. Next, take the values you need from the acquired caps (using DX9) and set the equivalent values for DirectDraw in your DDCAPS structure. You could then feed this populated caps structure to the game. A few caveats--as you mentioned, you don't know what it needs specifically, so it's kind of hit and miss (unless you have the source code). Also, there may not be a 1:1 mapping for the caps structure values (between DX9 and DDraw). Finally--this ties in with not having the 6.1 SDK--if you don't know the flag values, you might set a flag incorrectly when setting the values according to the acquired caps. As I mentioned, this may be way off (or require a lot of detective work), but I figured it might be something you could try.

牵强ㄟ 2024-08-22 19:04:53

该解决方案有点粗糙,但最重要的是 - 工作完美。

我编写了一个小型独立实用程序,它初始化 DDraw 6.1,然后获取设备上限,然后将它们转储到磁盘上的文件(设备上限是普通旧 C 格式结构,因此保存它非常简单)并退出。然后我可以从磁盘读取设备 caps 文件并在应用程序要求我提供它们时返回它。

The solution was a bit crude, but most importantly - is working flawlessly.

I've written small self-contained utility, which initialize DDraw 6.1, than gets device caps, then dump them to the file on disk (device caps is Plain Old C format structure, so saving it is really simple) and quits. Then I can read the device caps file from disk and return it when application ask me for them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文