Refactor dx device creation

Find the game's window instead of using the foreground window.
This commit is contained in:
Nemirtingas 2019-08-20 23:27:17 +02:00
parent dc7480c633
commit 5a0653d080
7 changed files with 71 additions and 12 deletions

View file

@ -17,6 +17,10 @@ bool DX10_Hook::start_hook()
if (!Windows_Hook::Inst().start_hook())
return false;
HWND hWnd = GetGameWindow();
if (!hWnd)
return false;
IDXGISwapChain* pSwapChain;
ID3D10Device* pDevice;
DXGI_SWAP_CHAIN_DESC SwapChainDesc = {};
@ -29,7 +33,7 @@ bool DX10_Hook::start_hook()
SwapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
SwapChainDesc.BufferDesc.RefreshRate.Denominator = 0;
SwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
SwapChainDesc.OutputWindow = GetForegroundWindow();
SwapChainDesc.OutputWindow = hWnd;
SwapChainDesc.SampleDesc.Count = 1;
SwapChainDesc.SampleDesc.Quality = 0;
SwapChainDesc.Windowed = TRUE;