所以最近我想使用 DirectX 向示例窗口添加一个 imgui 界面,所以我观看了一个视频,我必须使用 DirectX9sdk 挂钩 EndScene 功能才能添加我的自定义 imgui 界面。
但是我有一些问题:
- 我在哪里可以找到 DirectX9 函数和类型的任何文档(如果有的话,因为我不明白为什么我们特别要挂钩 EndScene 函数)或者我在哪里可以找到任何文章更深入地解释 DirectX 的工作原理?
- 到目前为止,我已经看到了 EndScene 挂钩的两个版本,一个带有 patternScanning 函数,它扫描 shaderapi dll 中的签名,另一个创建 DirectXDevice,然后从那里访问 vtable;网上有没有资源,还是我们必须自己做的事情?这是我的版本:
while (!DirectXDevice) // loops until it finds the device
DirectXDevice = **(DWORD**)(FindPattern("shaderapidx9.dll", "A1 ?? ?? ?? ?? 50 8B 08 FF 51 0C") + 0x1);
void** pVTable = *reinterpret_cast<void***>(DirectXDevice); // getting the vtable array
oEndScene = (f_EndScene)DetourFunction((PBYTE)pVTable[42], (PBYTE)Hooked_EndScene)//getting the 42th virtual function and detouring it to our own
- 我真的不明白 __stdcall 在这里做什么,我知道它是用来调用 WINAPI 函数的,但这里有什么用呢?
HRESULT __stdcall Hooked_EndScene(IDirect3DDevice9* pDevice){//some code}
注意:这就是我挂钩到原始端场景的功能。
非常感谢,如果有很多问题,我很抱歉,但我真的无法解决这个问题。