Reworked booleans
parent
8abd24ca54
commit
2fe5e90294
|
@ -7,6 +7,10 @@
|
||||||
|
|
||||||
#include "../detours/detours.h"
|
#include "../detours/detours.h"
|
||||||
|
|
||||||
|
Base_Hook::Base_Hook():
|
||||||
|
_hooked(false)
|
||||||
|
{}
|
||||||
|
|
||||||
Base_Hook::~Base_Hook()
|
Base_Hook::~Base_Hook()
|
||||||
{
|
{
|
||||||
UnhookAll();
|
UnhookAll();
|
||||||
|
|
|
@ -26,7 +26,7 @@ protected:
|
||||||
Base_Hook& operator =(Base_Hook&&) = delete;
|
Base_Hook& operator =(Base_Hook&&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Base_Hook() {}
|
Base_Hook();
|
||||||
virtual ~Base_Hook();
|
virtual ~Base_Hook();
|
||||||
|
|
||||||
void BeginHook();
|
void BeginHook();
|
||||||
|
|
|
@ -16,7 +16,7 @@ void DX10_Hook::hook_dx10(UINT SDKVersion)
|
||||||
{
|
{
|
||||||
if (!_hooked)
|
if (!_hooked)
|
||||||
{
|
{
|
||||||
_hooked = true;
|
Hook_Manager::Inst().FoundRenderer(this);
|
||||||
Hook_Manager::Inst().FoundHook(this);
|
Hook_Manager::Inst().FoundHook(this);
|
||||||
|
|
||||||
IDXGISwapChain* pSwapChain;
|
IDXGISwapChain* pSwapChain;
|
||||||
|
@ -38,6 +38,7 @@ void DX10_Hook::hook_dx10(UINT SDKVersion)
|
||||||
|
|
||||||
if (pDevice != nullptr && pSwapChain != nullptr)
|
if (pDevice != nullptr && pSwapChain != nullptr)
|
||||||
{
|
{
|
||||||
|
_hooked = true;
|
||||||
PRINT_DEBUG("Hooked DirectX 10\n");
|
PRINT_DEBUG("Hooked DirectX 10\n");
|
||||||
loadFunctions(pDevice, pSwapChain);
|
loadFunctions(pDevice, pSwapChain);
|
||||||
|
|
||||||
|
@ -53,7 +54,6 @@ void DX10_Hook::hook_dx10(UINT SDKVersion)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Failed to hook DirectX 10\n");
|
PRINT_DEBUG("Failed to hook DirectX 10\n");
|
||||||
_hooked = false;
|
|
||||||
}
|
}
|
||||||
if(pDevice)pDevice->Release();
|
if(pDevice)pDevice->Release();
|
||||||
if(pSwapChain)pSwapChain->Release();
|
if(pSwapChain)pSwapChain->Release();
|
||||||
|
@ -164,7 +164,7 @@ DX10_Hook::DX10_Hook():
|
||||||
mainRenderTargetView(nullptr)
|
mainRenderTargetView(nullptr)
|
||||||
{
|
{
|
||||||
_dll = GetModuleHandle(DLL_NAME);
|
_dll = GetModuleHandle(DLL_NAME);
|
||||||
_hooked = false;
|
|
||||||
// Hook to D3D10CreateDevice and D3D10CreateDeviceAndSwapChain so we know when it gets called.
|
// Hook to D3D10CreateDevice and D3D10CreateDeviceAndSwapChain so we know when it gets called.
|
||||||
// If its called, then DX10 will be used to render the overlay.
|
// If its called, then DX10 will be used to render the overlay.
|
||||||
//_D3D10CreateDevice = (decltype(_D3D10CreateDevice))GetProcAddress(_dll, "D3D10CreateDevice");
|
//_D3D10CreateDevice = (decltype(_D3D10CreateDevice))GetProcAddress(_dll, "D3D10CreateDevice");
|
||||||
|
|
|
@ -26,7 +26,7 @@ void DX11_Hook::hook_dx11(UINT SDKVersion)
|
||||||
{
|
{
|
||||||
if (!_hooked)
|
if (!_hooked)
|
||||||
{
|
{
|
||||||
_hooked = true;
|
Hook_Manager::Inst().FoundRenderer(this);
|
||||||
Hook_Manager::Inst().FoundHook(this);
|
Hook_Manager::Inst().FoundHook(this);
|
||||||
|
|
||||||
IDXGISwapChain* pSwapChain;
|
IDXGISwapChain* pSwapChain;
|
||||||
|
@ -48,6 +48,7 @@ void DX11_Hook::hook_dx11(UINT SDKVersion)
|
||||||
|
|
||||||
if (pDevice != nullptr && pSwapChain != nullptr)
|
if (pDevice != nullptr && pSwapChain != nullptr)
|
||||||
{
|
{
|
||||||
|
_hooked = true;
|
||||||
PRINT_DEBUG("Hooked DirectX 11\n");
|
PRINT_DEBUG("Hooked DirectX 11\n");
|
||||||
loadFunctions(pDevice, pSwapChain);
|
loadFunctions(pDevice, pSwapChain);
|
||||||
|
|
||||||
|
@ -63,7 +64,6 @@ void DX11_Hook::hook_dx11(UINT SDKVersion)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Failed to hook DirectX 11\n");
|
PRINT_DEBUG("Failed to hook DirectX 11\n");
|
||||||
_hooked = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pDevice) pDevice->Release();
|
if(pDevice) pDevice->Release();
|
||||||
|
@ -182,7 +182,7 @@ DX11_Hook::DX11_Hook():
|
||||||
mainRenderTargetView(nullptr)
|
mainRenderTargetView(nullptr)
|
||||||
{
|
{
|
||||||
_dll = GetModuleHandle(DLL_NAME);
|
_dll = GetModuleHandle(DLL_NAME);
|
||||||
_hooked = false;
|
|
||||||
// Hook to D3D11CreateDevice and D3D11CreateDeviceAndSwapChain so we know when it gets called.
|
// Hook to D3D11CreateDevice and D3D11CreateDeviceAndSwapChain so we know when it gets called.
|
||||||
// If its called, then DX11 will be used to render the overlay.
|
// If its called, then DX11 will be used to render the overlay.
|
||||||
//D3D11CreateDevice = (decltype(D3D11CreateDevice))GetProcAddress(_dll, "D3D11CreateDevice");
|
//D3D11CreateDevice = (decltype(D3D11CreateDevice))GetProcAddress(_dll, "D3D11CreateDevice");
|
||||||
|
|
|
@ -137,7 +137,6 @@ DX12_Hook::DX12_Hook():
|
||||||
pDescriptorHeap(nullptr)
|
pDescriptorHeap(nullptr)
|
||||||
{
|
{
|
||||||
_dll = GetModuleHandle(DLL_NAME);
|
_dll = GetModuleHandle(DLL_NAME);
|
||||||
_hooked = false;
|
|
||||||
|
|
||||||
PRINT_DEBUG("Trying to hook DX12 but DX12_Hook is not implemented yet, please report to DEV with the game name.");
|
PRINT_DEBUG("Trying to hook DX12 but DX12_Hook is not implemented yet, please report to DEV with the game name.");
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ void DX9_Hook::hook_dx9(UINT SDKVersion)
|
||||||
{
|
{
|
||||||
if (!_hooked)
|
if (!_hooked)
|
||||||
{
|
{
|
||||||
_hooked = true;
|
Hook_Manager::Inst().FoundRenderer(this);
|
||||||
Hook_Manager::Inst().FoundHook(this);
|
Hook_Manager::Inst().FoundHook(this);
|
||||||
|
|
||||||
IDirect3D9Ex* pD3D;
|
IDirect3D9Ex* pD3D;
|
||||||
|
@ -39,6 +39,7 @@ void DX9_Hook::hook_dx9(UINT SDKVersion)
|
||||||
|
|
||||||
if (pDeviceEx != nullptr)
|
if (pDeviceEx != nullptr)
|
||||||
{
|
{
|
||||||
|
_hooked = true;
|
||||||
PRINT_DEBUG("Hooked DirectX 9\n");
|
PRINT_DEBUG("Hooked DirectX 9\n");
|
||||||
loadFunctions(pDeviceEx);
|
loadFunctions(pDeviceEx);
|
||||||
|
|
||||||
|
@ -55,7 +56,6 @@ void DX9_Hook::hook_dx9(UINT SDKVersion)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Failed to DirectX 9\n");
|
PRINT_DEBUG("Failed to DirectX 9\n");
|
||||||
_hooked = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pDeviceEx)pDeviceEx->Release();
|
if(pDeviceEx)pDeviceEx->Release();
|
||||||
|
@ -175,7 +175,6 @@ DX9_Hook::DX9_Hook():
|
||||||
Reset(nullptr)
|
Reset(nullptr)
|
||||||
{
|
{
|
||||||
_dll = GetModuleHandle(DLL_NAME);
|
_dll = GetModuleHandle(DLL_NAME);
|
||||||
_hooked = false;
|
|
||||||
// Hook to Direct3DCreate9 and Direct3DCreate9Ex so we know when it gets called.
|
// Hook to Direct3DCreate9 and Direct3DCreate9Ex so we know when it gets called.
|
||||||
// If its called, then DX9 will be used to render the overlay.
|
// If its called, then DX9 will be used to render the overlay.
|
||||||
Direct3DCreate9 = (decltype(Direct3DCreate9))GetProcAddress(_dll, "Direct3DCreate9");
|
Direct3DCreate9 = (decltype(Direct3DCreate9))GetProcAddress(_dll, "Direct3DCreate9");
|
||||||
|
|
|
@ -11,9 +11,7 @@
|
||||||
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
|
||||||
#pragma comment(lib, "opengl32")
|
#include "steam_overlay.h"
|
||||||
#pragma comment(lib, "glew32s")
|
|
||||||
|
|
||||||
|
|
||||||
// This is created by OpenGL_Hook::Create, and deleted by the Hook_Manager if not used
|
// This is created by OpenGL_Hook::Create, and deleted by the Hook_Manager if not used
|
||||||
static OpenGL_Hook* hook;
|
static OpenGL_Hook* hook;
|
||||||
|
@ -22,13 +20,14 @@ void OpenGL_Hook::hook_ogl()
|
||||||
{
|
{
|
||||||
if (!_hooked)
|
if (!_hooked)
|
||||||
{
|
{
|
||||||
_hooked = true;
|
Hook_Manager::Inst().FoundRenderer(this);
|
||||||
Hook_Manager::Inst().FoundHook(this);
|
Hook_Manager::Inst().FoundHook(this);
|
||||||
|
|
||||||
GLenum err = glewInit();
|
GLenum err = glewInit();
|
||||||
|
|
||||||
if (err == GLEW_OK)
|
if (err == GLEW_OK)
|
||||||
{
|
{
|
||||||
|
_hooked = true;
|
||||||
PRINT_DEBUG("Hooked OpenGL\n");
|
PRINT_DEBUG("Hooked OpenGL\n");
|
||||||
UnhookAll();
|
UnhookAll();
|
||||||
BeginHook();
|
BeginHook();
|
||||||
|
@ -42,7 +41,6 @@ void OpenGL_Hook::hook_ogl()
|
||||||
PRINT_DEBUG("Failed to hook OpenGL\n");
|
PRINT_DEBUG("Failed to hook OpenGL\n");
|
||||||
/* Problem: glewInit failed, something is seriously wrong. */
|
/* Problem: glewInit failed, something is seriously wrong. */
|
||||||
PRINT_DEBUG("Error: %s\n", glewGetErrorString(err));
|
PRINT_DEBUG("Error: %s\n", glewGetErrorString(err));
|
||||||
_hooked = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,7 +113,6 @@ OpenGL_Hook::OpenGL_Hook():
|
||||||
wglSwapBuffers(nullptr)
|
wglSwapBuffers(nullptr)
|
||||||
{
|
{
|
||||||
_dll = GetModuleHandle(DLL_NAME);
|
_dll = GetModuleHandle(DLL_NAME);
|
||||||
_hooked = false;
|
|
||||||
// Hook to wglMakeCurrent so we know when it gets called.
|
// Hook to wglMakeCurrent so we know when it gets called.
|
||||||
// If its called, then OpenGL will be used to render the overlay.
|
// If its called, then OpenGL will be used to render the overlay.
|
||||||
wglMakeCurrent = (decltype(wglMakeCurrent))GetProcAddress(_dll, "wglMakeCurrent");
|
wglMakeCurrent = (decltype(wglMakeCurrent))GetProcAddress(_dll, "wglMakeCurrent");
|
||||||
|
|
Loading…
Reference in New Issue