diff --git a/overlay_experimental/Base_Hook.cpp b/overlay_experimental/Base_Hook.cpp index a7d3b88..452309e 100644 --- a/overlay_experimental/Base_Hook.cpp +++ b/overlay_experimental/Base_Hook.cpp @@ -12,6 +12,7 @@ #include Base_Hook::Base_Hook(): + _library(nullptr), _hooked(false) {} diff --git a/overlay_experimental/DX10_Hook.cpp b/overlay_experimental/DX10_Hook.cpp index ceba0e6..54e43b7 100644 --- a/overlay_experimental/DX10_Hook.cpp +++ b/overlay_experimental/DX10_Hook.cpp @@ -12,6 +12,7 @@ DX10_Hook* DX10_Hook::_inst = nullptr; bool DX10_Hook::start_hook() { + bool res = true; if (!_hooked) { if (!Windows_Hook::Inst().start_hook()) @@ -63,12 +64,12 @@ bool DX10_Hook::start_hook() else { PRINT_DEBUG("Failed to hook DirectX 10\n"); - return false; + res = false; } if(pDevice)pDevice->Release(); if(pSwapChain)pSwapChain->Release(); } - return true; + return res; } void DX10_Hook::resetRenderState() diff --git a/overlay_experimental/DX11_Hook.cpp b/overlay_experimental/DX11_Hook.cpp index 5e5c197..c27ede6 100644 --- a/overlay_experimental/DX11_Hook.cpp +++ b/overlay_experimental/DX11_Hook.cpp @@ -22,6 +22,7 @@ HRESULT GetDeviceAndCtxFromSwapchain(IDXGISwapChain* pSwapChain, ID3D11Device** bool DX11_Hook::start_hook() { + bool res = true; if (!_hooked) { if (!Windows_Hook::Inst().start_hook()) @@ -73,13 +74,13 @@ bool DX11_Hook::start_hook() else { PRINT_DEBUG("Failed to hook DirectX 11\n"); - return false; + res = false; } if(pDevice) pDevice->Release(); if(pSwapChain) pSwapChain->Release(); } - return true; + return res; } void DX11_Hook::resetRenderState() diff --git a/overlay_experimental/DX12_Hook.cpp b/overlay_experimental/DX12_Hook.cpp index edb85f8..4b835ba 100644 --- a/overlay_experimental/DX12_Hook.cpp +++ b/overlay_experimental/DX12_Hook.cpp @@ -14,6 +14,7 @@ DX12_Hook* DX12_Hook::_inst = nullptr; bool DX12_Hook::start_hook() { + bool res = true; if (!_hooked) { if (!Windows_Hook::Inst().start_hook()) @@ -79,7 +80,7 @@ bool DX12_Hook::start_hook() else { PRINT_DEBUG("Failed to hook DirectX 12\n"); - return false; + res = false; } } } @@ -89,7 +90,7 @@ bool DX12_Hook::start_hook() if (pCommandQueue) pCommandQueue->Release(); if (pDevice) pDevice->Release(); } - return true; + return res; } void DX12_Hook::resetRenderState() diff --git a/overlay_experimental/DX9_Hook.cpp b/overlay_experimental/DX9_Hook.cpp index bbd5611..1842493 100644 --- a/overlay_experimental/DX9_Hook.cpp +++ b/overlay_experimental/DX9_Hook.cpp @@ -14,6 +14,7 @@ DX9_Hook* DX9_Hook::_inst = nullptr; bool DX9_Hook::start_hook() { + bool res = true; if (!_hooked) { if (!Windows_Hook::Inst().start_hook()) @@ -60,13 +61,13 @@ bool DX9_Hook::start_hook() else { PRINT_DEBUG("Failed to DirectX 9\n"); - return false; + res = false; } if(pDeviceEx)pDeviceEx->Release(); if(pD3D)pD3D->Release(); } - return true; + return res; } void DX9_Hook::resetRenderState() diff --git a/overlay_experimental/OpenGL_Hook.cpp b/overlay_experimental/OpenGL_Hook.cpp index ef707c0..de3071b 100644 --- a/overlay_experimental/OpenGL_Hook.cpp +++ b/overlay_experimental/OpenGL_Hook.cpp @@ -16,6 +16,7 @@ OpenGL_Hook* OpenGL_Hook::_inst = nullptr; bool OpenGL_Hook::start_hook() { + bool res = true; if (!_hooked) { if (!Windows_Hook::Inst().start_hook()) @@ -46,7 +47,7 @@ bool OpenGL_Hook::start_hook() PRINT_DEBUG("Failed to hook OpenGL\n"); /* Problem: glewInit failed, something is seriously wrong. */ PRINT_DEBUG("Error: %s\n", glewGetErrorString(err)); - return false; + res = false; } } return true; diff --git a/overlay_experimental/Windows_Hook.cpp b/overlay_experimental/Windows_Hook.cpp index f755f34..4483a14 100644 --- a/overlay_experimental/Windows_Hook.cpp +++ b/overlay_experimental/Windows_Hook.cpp @@ -37,6 +37,7 @@ HWND GetGameWindow() bool Windows_Hook::start_hook() { + bool res = true; if (!_hooked) { GetRawInputBuffer = ::GetRawInputBuffer; @@ -51,7 +52,7 @@ bool Windows_Hook::start_hook() _hooked = true; } - return true; + return res; } void Windows_Hook::resetRenderState() @@ -171,7 +172,7 @@ Windows_Hook::Windows_Hook() : GetRawInputBuffer(nullptr), GetRawInputData(nullptr) { - + //_library = LoadLibrary(DLL_NAME); } Windows_Hook::~Windows_Hook() @@ -179,6 +180,8 @@ Windows_Hook::~Windows_Hook() PRINT_DEBUG("Windows Hook removed\n"); resetRenderState(); + + //FreeLibrary(reinterpret_cast(_library)); } Windows_Hook& Windows_Hook::Inst()