|
|
|
@ -23,19 +23,18 @@ void DX11_Hook::hook_dx11(UINT SDKVersion)
|
|
|
|
|
{
|
|
|
|
|
if (!_hooked)
|
|
|
|
|
{
|
|
|
|
|
PRINT_DEBUG("Hooked DirectX 11\n");
|
|
|
|
|
_hooked = true;
|
|
|
|
|
Hook_Manager::Inst().FoundHook(this);
|
|
|
|
|
|
|
|
|
|
IDXGISwapChain* pSwapChain;
|
|
|
|
|
ID3D11Device* pDevice;
|
|
|
|
|
DXGI_SWAP_CHAIN_DESC SwapChainDesc = {};
|
|
|
|
|
SwapChainDesc.BufferCount = 2;
|
|
|
|
|
SwapChainDesc.BufferDesc.Width = 800;
|
|
|
|
|
SwapChainDesc.BufferDesc.Height = 600;
|
|
|
|
|
SwapChainDesc.BufferCount = 1;
|
|
|
|
|
SwapChainDesc.BufferDesc.Width = 1;
|
|
|
|
|
SwapChainDesc.BufferDesc.Height = 1;
|
|
|
|
|
SwapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
|
|
|
|
SwapChainDesc.BufferDesc.RefreshRate.Numerator = 60;
|
|
|
|
|
SwapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
|
|
|
|
|
SwapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
|
|
|
|
|
SwapChainDesc.BufferDesc.RefreshRate.Denominator = 0;
|
|
|
|
|
SwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
|
|
|
|
SwapChainDesc.OutputWindow = GetForegroundWindow();
|
|
|
|
|
SwapChainDesc.SampleDesc.Count = 1;
|
|
|
|
@ -44,6 +43,9 @@ void DX11_Hook::hook_dx11(UINT SDKVersion)
|
|
|
|
|
|
|
|
|
|
D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, NULL, NULL, SDKVersion, &SwapChainDesc, &pSwapChain, &pDevice, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
if (pDevice != nullptr && pSwapChain != nullptr)
|
|
|
|
|
{
|
|
|
|
|
PRINT_DEBUG("Hooked DirectX 11\n");
|
|
|
|
|
loadFunctions(pDevice, pSwapChain);
|
|
|
|
|
|
|
|
|
|
UnhookAll();
|
|
|
|
@ -54,9 +56,15 @@ void DX11_Hook::hook_dx11(UINT SDKVersion)
|
|
|
|
|
std::make_pair<void**, void*>(&(PVOID&)DX11_Hook::ResizeBuffers, &DX11_Hook::MyResizeBuffers)
|
|
|
|
|
);
|
|
|
|
|
EndHook();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PRINT_DEBUG("Failed to hook DirectX 11\n");
|
|
|
|
|
_hooked = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pDevice->Release();
|
|
|
|
|
pSwapChain->Release();
|
|
|
|
|
if(pDevice) pDevice->Release();
|
|
|
|
|
if(pSwapChain) pSwapChain->Release();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|