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