mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-05 11:44:53 +01:00
Add a common include file.
This commit is contained in:
parent
25ee1dfa52
commit
fe9bbd1104
36 changed files with 236 additions and 250 deletions
|
|
@ -3,9 +3,6 @@
|
|||
|
||||
#ifdef EMU_OVERLAY
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
#include "../dll/base.h"
|
||||
|
||||
class Base_Hook
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ void Renderer_Detector::hook_dx9()
|
|||
|
||||
IDirect3D9Ex* pD3D = nullptr;
|
||||
IUnknown* pDevice = nullptr;
|
||||
HMODULE library = GetModuleHandle(DX9_Hook::DLL_NAME);
|
||||
HMODULE library = GetModuleHandle(DX9_DLL);
|
||||
decltype(Direct3DCreate9Ex)* Direct3DCreate9Ex = nullptr;
|
||||
if (library != nullptr)
|
||||
{
|
||||
|
|
@ -279,7 +279,7 @@ void Renderer_Detector::hook_dx10()
|
|||
|
||||
IDXGISwapChain* pSwapChain = nullptr;
|
||||
ID3D10Device* pDevice = nullptr;
|
||||
HMODULE library = GetModuleHandle(DX10_Hook::DLL_NAME);
|
||||
HMODULE library = GetModuleHandle(DX10_DLL);
|
||||
if (library != nullptr)
|
||||
{
|
||||
decltype(D3D10CreateDeviceAndSwapChain)* D3D10CreateDeviceAndSwapChain =
|
||||
|
|
@ -332,7 +332,7 @@ void Renderer_Detector::hook_dx11()
|
|||
|
||||
IDXGISwapChain* pSwapChain = nullptr;
|
||||
ID3D11Device* pDevice = nullptr;
|
||||
HMODULE library = GetModuleHandle(DX11_Hook::DLL_NAME);
|
||||
HMODULE library = GetModuleHandle(DX11_DLL);
|
||||
if (library != nullptr)
|
||||
{
|
||||
decltype(D3D11CreateDeviceAndSwapChain)* D3D11CreateDeviceAndSwapChain =
|
||||
|
|
@ -391,7 +391,7 @@ void Renderer_Detector::hook_dx12()
|
|||
ID3D12CommandAllocator* pCommandAllocator = nullptr;
|
||||
ID3D12GraphicsCommandList* pCommandList = nullptr;
|
||||
|
||||
HMODULE library = GetModuleHandle(DX12_Hook::DLL_NAME);
|
||||
HMODULE library = GetModuleHandle(DX12_DLL);
|
||||
if (library != nullptr)
|
||||
{
|
||||
decltype(D3D12CreateDevice)* D3D12CreateDevice =
|
||||
|
|
@ -473,7 +473,7 @@ void Renderer_Detector::hook_opengl()
|
|||
{
|
||||
if (!_ogl_hooked && !_renderer_found)
|
||||
{
|
||||
HMODULE library = GetModuleHandle(OpenGL_Hook::DLL_NAME);
|
||||
HMODULE library = GetModuleHandle(OPENGL_DLL);
|
||||
decltype(wglMakeCurrent)* wglMakeCurrent = nullptr;
|
||||
OpenGL_Hook::wglSwapBuffers_t wglSwapBuffers = nullptr;
|
||||
if (library != nullptr)
|
||||
|
|
@ -500,15 +500,15 @@ void Renderer_Detector::hook_opengl()
|
|||
|
||||
void Renderer_Detector::create_hook(const char* libname)
|
||||
{
|
||||
if (!_stricmp(libname, DX9_Hook::DLL_NAME))
|
||||
if (!_stricmp(libname, DX9_DLL))
|
||||
hook_dx9();
|
||||
else if (!_stricmp(libname, DX10_Hook::DLL_NAME))
|
||||
else if (!_stricmp(libname, DX10_DLL))
|
||||
hook_dx10();
|
||||
else if (!_stricmp(libname, DX11_Hook::DLL_NAME))
|
||||
else if (!_stricmp(libname, DX11_DLL))
|
||||
hook_dx11();
|
||||
else if (!_stricmp(libname, DX12_Hook::DLL_NAME))
|
||||
else if (!_stricmp(libname, DX12_DLL))
|
||||
hook_dx12();
|
||||
else if (!_stricmp(libname, OpenGL_Hook::DLL_NAME))
|
||||
else if (!_stricmp(libname, OPENGL_DLL))
|
||||
hook_opengl();
|
||||
}
|
||||
|
||||
|
|
@ -519,11 +519,11 @@ void Renderer_Detector::find_renderer_proc(Renderer_Detector* _this)
|
|||
hm.AddHook(_this->rendererdetect_hook);
|
||||
|
||||
std::vector<std::string> const libraries = {
|
||||
OpenGL_Hook::DLL_NAME,
|
||||
DX12_Hook::DLL_NAME,
|
||||
DX11_Hook::DLL_NAME,
|
||||
DX10_Hook::DLL_NAME,
|
||||
DX9_Hook::DLL_NAME
|
||||
OPENGL_DLL,
|
||||
DX12_DLL,
|
||||
DX11_DLL,
|
||||
DX10_DLL,
|
||||
DX9_DLL
|
||||
};
|
||||
|
||||
while (!_this->_renderer_found && !_this->stop_retry())
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ DX10_Hook::DX10_Hook():
|
|||
ResizeBuffers(nullptr),
|
||||
ResizeTarget(nullptr)
|
||||
{
|
||||
_library = LoadLibrary(DLL_NAME);
|
||||
_library = LoadLibrary(DX10_DLL);
|
||||
}
|
||||
|
||||
DX10_Hook::~DX10_Hook()
|
||||
|
|
@ -154,7 +154,7 @@ DX10_Hook* DX10_Hook::Inst()
|
|||
|
||||
const char* DX10_Hook::get_lib_name() const
|
||||
{
|
||||
return DLL_NAME;
|
||||
return DX10_DLL;
|
||||
}
|
||||
|
||||
void DX10_Hook::loadFunctions(IDXGISwapChain *pSwapChain)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
class DX10_Hook : public Base_Hook
|
||||
{
|
||||
public:
|
||||
static constexpr const char *DLL_NAME = "d3d10.dll";
|
||||
#define DX10_DLL "d3d10.dll"
|
||||
|
||||
private:
|
||||
static DX10_Hook* _inst;
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ DX11_Hook::DX11_Hook():
|
|||
ResizeBuffers(nullptr),
|
||||
ResizeTarget(nullptr)
|
||||
{
|
||||
_library = LoadLibrary(DLL_NAME);
|
||||
_library = LoadLibrary(DX11_DLL);
|
||||
}
|
||||
|
||||
DX11_Hook::~DX11_Hook()
|
||||
|
|
@ -204,7 +204,7 @@ DX11_Hook* DX11_Hook::Inst()
|
|||
|
||||
const char* DX11_Hook::get_lib_name() const
|
||||
{
|
||||
return DLL_NAME;
|
||||
return DX11_DLL;
|
||||
}
|
||||
|
||||
void DX11_Hook::loadFunctions(IDXGISwapChain *pSwapChain)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
class DX11_Hook : public Base_Hook
|
||||
{
|
||||
public:
|
||||
static constexpr const char *DLL_NAME = "d3d11.dll";
|
||||
#define DX11_DLL "d3d11.dll"
|
||||
|
||||
private:
|
||||
static DX11_Hook* _inst;
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ DX12_Hook::DX12_Hook():
|
|||
ResizeTarget(nullptr),
|
||||
ExecuteCommandLists(nullptr)
|
||||
{
|
||||
_library = LoadLibrary(DLL_NAME);
|
||||
_library = LoadLibrary(DX12_DLL);
|
||||
|
||||
PRINT_DEBUG("DX12 support is experimental, don't complain if it doesn't work as expected.\n");
|
||||
}
|
||||
|
|
@ -296,7 +296,7 @@ DX12_Hook* DX12_Hook::Inst()
|
|||
|
||||
const char* DX12_Hook::get_lib_name() const
|
||||
{
|
||||
return DLL_NAME;
|
||||
return DX12_DLL;
|
||||
}
|
||||
|
||||
void DX12_Hook::loadFunctions(ID3D12CommandQueue* pCommandQueue, IDXGISwapChain *pSwapChain)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
class DX12_Hook : public Base_Hook
|
||||
{
|
||||
public:
|
||||
static constexpr const char *DLL_NAME = "d3d12.dll";
|
||||
#define DX12_DLL "d3d12.dll"
|
||||
|
||||
private:
|
||||
static DX12_Hook* _inst;
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ DX9_Hook::DX9_Hook():
|
|||
PresentEx(nullptr),
|
||||
Reset(nullptr)
|
||||
{
|
||||
_library = LoadLibrary(DLL_NAME);
|
||||
_library = LoadLibrary(DX9_DLL);
|
||||
}
|
||||
|
||||
DX9_Hook::~DX9_Hook()
|
||||
|
|
@ -153,7 +153,7 @@ DX9_Hook* DX9_Hook::Inst()
|
|||
|
||||
const char* DX9_Hook::get_lib_name() const
|
||||
{
|
||||
return DLL_NAME;
|
||||
return DX9_DLL;
|
||||
}
|
||||
|
||||
void DX9_Hook::loadFunctions(IDirect3DDevice9* pDevice, bool ex)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
class DX9_Hook : public Base_Hook
|
||||
{
|
||||
public:
|
||||
static constexpr const char *DLL_NAME = "d3d9.dll";
|
||||
#define DX9_DLL "d3d9.dll"
|
||||
|
||||
private:
|
||||
static DX9_Hook* _inst;
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ OpenGL_Hook::OpenGL_Hook():
|
|||
hooked(false),
|
||||
wglSwapBuffers(nullptr)
|
||||
{
|
||||
_library = LoadLibrary(DLL_NAME);
|
||||
_library = LoadLibrary(OPENGL_DLL);
|
||||
}
|
||||
|
||||
OpenGL_Hook::~OpenGL_Hook()
|
||||
|
|
@ -136,7 +136,7 @@ OpenGL_Hook* OpenGL_Hook::Inst()
|
|||
|
||||
const char* OpenGL_Hook::get_lib_name() const
|
||||
{
|
||||
return DLL_NAME;
|
||||
return OPENGL_DLL;
|
||||
}
|
||||
|
||||
void OpenGL_Hook::loadFunctions(wglSwapBuffers_t pfnwglSwapBuffers)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
class OpenGL_Hook : public Base_Hook
|
||||
{
|
||||
public:
|
||||
static constexpr const char *DLL_NAME = "opengl32.dll";
|
||||
#define OPENGL_DLL "opengl32.dll"
|
||||
|
||||
using wglSwapBuffers_t = BOOL(WINAPI*)(HDC);
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ Windows_Hook* Windows_Hook::Inst()
|
|||
|
||||
const char* Windows_Hook::get_lib_name() const
|
||||
{
|
||||
return DLL_NAME;
|
||||
return WINDOWS_DLL;
|
||||
}
|
||||
|
||||
#endif//EMU_OVERLAY
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
class Windows_Hook : public Base_Hook
|
||||
{
|
||||
public:
|
||||
static constexpr const char* DLL_NAME = "user32.dll";
|
||||
#define WINDOWS_DLL "user32.dll"
|
||||
|
||||
private:
|
||||
static Windows_Hook* _inst;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue