mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-05 11:44:53 +01:00
Refactor dx device creation
Find the game's window instead of using the foreground window.
This commit is contained in:
parent
dc7480c633
commit
5a0653d080
7 changed files with 71 additions and 12 deletions
|
|
@ -19,6 +19,10 @@ bool DX9_Hook::start_hook()
|
|||
if (!Windows_Hook::Inst().start_hook())
|
||||
return false;
|
||||
|
||||
HWND hWnd = GetGameWindow();
|
||||
if (!hWnd)
|
||||
return false;
|
||||
|
||||
IDirect3D9Ex* pD3D;
|
||||
IDirect3DDevice9Ex* pDeviceEx;
|
||||
decltype(Direct3DCreate9Ex)* Direct3DCreate9Ex = (decltype(Direct3DCreate9Ex))GetProcAddress(reinterpret_cast<HMODULE>(_library), "Direct3DCreate9Ex");
|
||||
|
|
@ -28,7 +32,7 @@ bool DX9_Hook::start_hook()
|
|||
D3DPRESENT_PARAMETERS params = {};
|
||||
params.BackBufferWidth = 1;
|
||||
params.BackBufferHeight = 1;
|
||||
params.hDeviceWindow = GetForegroundWindow();
|
||||
params.hDeviceWindow = hWnd;
|
||||
|
||||
pD3D->CreateDeviceEx(D3DADAPTER_DEFAULT, D3DDEVTYPE_NULLREF, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING, ¶ms, NULL, &pDeviceEx);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue