mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-05 03:34:52 +01:00
Moved every platform specific code to their own folder
This commit is contained in:
parent
dd13377be7
commit
1785ae6eaf
37 changed files with 9 additions and 1460 deletions
170
overlay_experimental/windows/DX10_Hook.cpp
Normal file
170
overlay_experimental/windows/DX10_Hook.cpp
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
#include "DX10_Hook.h"
|
||||
#include "Windows_Hook.h"
|
||||
#include "Renderer_Detector.h"
|
||||
#include "../dll/dll.h"
|
||||
|
||||
#ifndef NO_OVERLAY
|
||||
|
||||
#include <imgui.h>
|
||||
#include <impls/imgui_impl_dx10.h>
|
||||
|
||||
DX10_Hook* DX10_Hook::_inst = nullptr;
|
||||
|
||||
bool DX10_Hook::start_hook()
|
||||
{
|
||||
bool res = true;
|
||||
if (!hooked)
|
||||
{
|
||||
if (!Windows_Hook::Inst()->start_hook())
|
||||
return false;
|
||||
|
||||
PRINT_DEBUG("Hooked DirectX 10\n");
|
||||
hooked = true;
|
||||
|
||||
Renderer_Detector::Inst().renderer_found(this);
|
||||
|
||||
BeginHook();
|
||||
HookFuncs(
|
||||
std::make_pair<void**, void*>(&(PVOID&)DX10_Hook::Present, &DX10_Hook::MyPresent),
|
||||
std::make_pair<void**, void*>(&(PVOID&)DX10_Hook::ResizeTarget, &DX10_Hook::MyResizeTarget),
|
||||
std::make_pair<void**, void*>(&(PVOID&)DX10_Hook::ResizeBuffers, &DX10_Hook::MyResizeBuffers)
|
||||
);
|
||||
EndHook();
|
||||
|
||||
get_steam_client()->steam_overlay->HookReady();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void DX10_Hook::resetRenderState()
|
||||
{
|
||||
if (initialized)
|
||||
{
|
||||
mainRenderTargetView->Release();
|
||||
|
||||
ImGui_ImplDX10_Shutdown();
|
||||
Windows_Hook::Inst()->resetRenderState();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
initialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to make this function and overlay's proc as short as possible or it might affect game's fps.
|
||||
void DX10_Hook::prepareForOverlay(IDXGISwapChain* pSwapChain)
|
||||
{
|
||||
DXGI_SWAP_CHAIN_DESC desc;
|
||||
pSwapChain->GetDesc(&desc);
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
if (FAILED(pSwapChain->GetDevice(IID_PPV_ARGS(&pDevice))))
|
||||
return;
|
||||
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.IniFilename = NULL;
|
||||
|
||||
ID3D10Texture2D* pBackBuffer;
|
||||
|
||||
pSwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer));
|
||||
pDevice->CreateRenderTargetView(pBackBuffer, NULL, &mainRenderTargetView);
|
||||
pBackBuffer->Release();
|
||||
|
||||
ImGui_ImplDX10_Init(pDevice);
|
||||
|
||||
pDevice->Release();
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
ImGui_ImplDX10_NewFrame();
|
||||
Windows_Hook::Inst()->prepareForOverlay(desc.OutputWindow);
|
||||
|
||||
ImGui::NewFrame();
|
||||
|
||||
get_steam_client()->steam_overlay->OverlayProc(desc.BufferDesc.Width, desc.BufferDesc.Height);
|
||||
|
||||
ImGui::EndFrame();
|
||||
|
||||
ImGui::Render();
|
||||
|
||||
pDevice->OMSetRenderTargets(1, &mainRenderTargetView, NULL);
|
||||
ImGui_ImplDX10_RenderDrawData(ImGui::GetDrawData());
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX10_Hook::MyPresent(IDXGISwapChain *_this, UINT SyncInterval, UINT Flags)
|
||||
{
|
||||
DX10_Hook::Inst()->prepareForOverlay(_this);
|
||||
return (_this->*DX10_Hook::Inst()->Present)(SyncInterval, Flags);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX10_Hook::MyResizeTarget(IDXGISwapChain* _this, const DXGI_MODE_DESC* pNewTargetParameters)
|
||||
{
|
||||
DX10_Hook::Inst()->resetRenderState();
|
||||
return (_this->*DX10_Hook::Inst()->ResizeTarget)(pNewTargetParameters);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX10_Hook::MyResizeBuffers(IDXGISwapChain* _this, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
|
||||
{
|
||||
DX10_Hook::Inst()->resetRenderState();
|
||||
return (_this->*DX10_Hook::Inst()->ResizeBuffers)(BufferCount, Width, Height, NewFormat, SwapChainFlags);
|
||||
}
|
||||
|
||||
DX10_Hook::DX10_Hook():
|
||||
initialized(false),
|
||||
hooked(false),
|
||||
pDevice(nullptr),
|
||||
mainRenderTargetView(nullptr),
|
||||
Present(nullptr),
|
||||
ResizeBuffers(nullptr),
|
||||
ResizeTarget(nullptr)
|
||||
{
|
||||
_library = LoadLibrary(DLL_NAME);
|
||||
}
|
||||
|
||||
DX10_Hook::~DX10_Hook()
|
||||
{
|
||||
PRINT_DEBUG("DX10 Hook removed\n");
|
||||
|
||||
if (initialized)
|
||||
{
|
||||
mainRenderTargetView->Release();
|
||||
|
||||
ImGui_ImplDX10_InvalidateDeviceObjects();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
FreeLibrary(reinterpret_cast<HMODULE>(_library));
|
||||
|
||||
_inst = nullptr;
|
||||
}
|
||||
|
||||
DX10_Hook* DX10_Hook::Inst()
|
||||
{
|
||||
if (_inst == nullptr)
|
||||
_inst = new DX10_Hook;
|
||||
|
||||
return _inst;
|
||||
}
|
||||
|
||||
const char* DX10_Hook::get_lib_name() const
|
||||
{
|
||||
return DLL_NAME;
|
||||
}
|
||||
|
||||
void DX10_Hook::loadFunctions(IDXGISwapChain *pSwapChain)
|
||||
{
|
||||
void** vTable;
|
||||
|
||||
vTable = *reinterpret_cast<void***>(pSwapChain);
|
||||
#define LOAD_FUNC(X) (void*&)X = vTable[(int)IDXGISwapChainVTable::X]
|
||||
LOAD_FUNC(Present);
|
||||
LOAD_FUNC(ResizeBuffers);
|
||||
LOAD_FUNC(ResizeTarget);
|
||||
#undef LOAD_FUNC
|
||||
}
|
||||
|
||||
#endif//NO_OVERLAY
|
||||
51
overlay_experimental/windows/DX10_Hook.h
Normal file
51
overlay_experimental/windows/DX10_Hook.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#ifndef __INCLUDED_DX10_HOOK_H__
|
||||
#define __INCLUDED_DX10_HOOK_H__
|
||||
|
||||
#include "Base_Hook.h"
|
||||
#ifndef NO_OVERLAY
|
||||
|
||||
#include <d3d10.h>
|
||||
#include "DirectX_VTables.h"
|
||||
|
||||
class DX10_Hook : public Base_Hook
|
||||
{
|
||||
public:
|
||||
static constexpr const char *DLL_NAME = "d3d10.dll";
|
||||
|
||||
private:
|
||||
static DX10_Hook* _inst;
|
||||
|
||||
// Variables
|
||||
bool hooked;
|
||||
bool initialized;
|
||||
ID3D10Device* pDevice;
|
||||
ID3D10RenderTargetView* mainRenderTargetView;
|
||||
|
||||
// Functions
|
||||
DX10_Hook();
|
||||
|
||||
void resetRenderState();
|
||||
void prepareForOverlay(IDXGISwapChain *pSwapChain);
|
||||
|
||||
// Hook to render functions
|
||||
static HRESULT STDMETHODCALLTYPE MyPresent(IDXGISwapChain* _this, UINT SyncInterval, UINT Flags);
|
||||
static HRESULT STDMETHODCALLTYPE MyResizeTarget(IDXGISwapChain* _this, const DXGI_MODE_DESC* pNewTargetParameters);
|
||||
static HRESULT STDMETHODCALLTYPE MyResizeBuffers(IDXGISwapChain* _this, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags);
|
||||
|
||||
decltype(&IDXGISwapChain::Present) Present;
|
||||
decltype(&IDXGISwapChain::ResizeBuffers) ResizeBuffers;
|
||||
decltype(&IDXGISwapChain::ResizeTarget) ResizeTarget;
|
||||
|
||||
public:
|
||||
virtual ~DX10_Hook();
|
||||
|
||||
bool start_hook();
|
||||
static DX10_Hook* Inst();
|
||||
virtual const char* get_lib_name() const;
|
||||
|
||||
void loadFunctions(IDXGISwapChain *pSwapChain);
|
||||
};
|
||||
|
||||
#endif//NO_OVERLAY
|
||||
|
||||
#endif//__INCLUDED_DX10_HOOK_H__
|
||||
184
overlay_experimental/windows/DX11_Hook.cpp
Normal file
184
overlay_experimental/windows/DX11_Hook.cpp
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
#include "DX11_Hook.h"
|
||||
#include "Windows_Hook.h"
|
||||
#include "Renderer_Detector.h"
|
||||
#include "../dll/dll.h"
|
||||
|
||||
#ifndef NO_OVERLAY
|
||||
|
||||
#include <imgui.h>
|
||||
#include <impls/imgui_impl_dx11.h>
|
||||
|
||||
DX11_Hook* DX11_Hook::_inst = nullptr;
|
||||
|
||||
HRESULT GetDeviceAndCtxFromSwapchain(IDXGISwapChain* pSwapChain, ID3D11Device** ppDevice, ID3D11DeviceContext** ppContext)
|
||||
{
|
||||
HRESULT ret = pSwapChain->GetDevice(IID_PPV_ARGS(ppDevice));
|
||||
|
||||
if (SUCCEEDED(ret))
|
||||
(*ppDevice)->GetImmediateContext(ppContext);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool DX11_Hook::start_hook()
|
||||
{
|
||||
bool res = true;
|
||||
if (!hooked)
|
||||
{
|
||||
if (!Windows_Hook::Inst()->start_hook())
|
||||
return false;
|
||||
|
||||
PRINT_DEBUG("Hooked DirectX 11\n");
|
||||
hooked = true;
|
||||
|
||||
Renderer_Detector::Inst().renderer_found(this);
|
||||
|
||||
BeginHook();
|
||||
HookFuncs(
|
||||
std::make_pair<void**, void*>(&(PVOID&)DX11_Hook::Present, &DX11_Hook::MyPresent),
|
||||
std::make_pair<void**, void*>(&(PVOID&)DX11_Hook::ResizeTarget, &DX11_Hook::MyResizeTarget),
|
||||
std::make_pair<void**, void*>(&(PVOID&)DX11_Hook::ResizeBuffers, &DX11_Hook::MyResizeBuffers)
|
||||
);
|
||||
EndHook();
|
||||
|
||||
get_steam_client()->steam_overlay->HookReady();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void DX11_Hook::resetRenderState()
|
||||
{
|
||||
if (initialized)
|
||||
{
|
||||
mainRenderTargetView->Release();
|
||||
pContext->Release();
|
||||
|
||||
ImGui_ImplDX11_Shutdown();
|
||||
Windows_Hook::Inst()->resetRenderState();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
initialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to make this function and overlay's proc as short as possible or it might affect game's fps.
|
||||
void DX11_Hook::prepareForOverlay(IDXGISwapChain* pSwapChain)
|
||||
{
|
||||
DXGI_SWAP_CHAIN_DESC desc;
|
||||
pSwapChain->GetDesc(&desc);
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
ID3D11Device* pDevice = nullptr;
|
||||
if (FAILED(GetDeviceAndCtxFromSwapchain(pSwapChain, &pDevice, &pContext)))
|
||||
return;
|
||||
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.IniFilename = NULL;
|
||||
|
||||
ID3D11Texture2D* pBackBuffer;
|
||||
|
||||
pSwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer));
|
||||
pDevice->CreateRenderTargetView(pBackBuffer, NULL, &mainRenderTargetView);
|
||||
pBackBuffer->Release();
|
||||
|
||||
ImGui_ImplDX11_Init(pDevice, pContext);
|
||||
|
||||
pDevice->Release();
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
ImGui_ImplDX11_NewFrame();
|
||||
Windows_Hook::Inst()->prepareForOverlay(desc.OutputWindow);
|
||||
|
||||
ImGui::NewFrame();
|
||||
|
||||
get_steam_client()->steam_overlay->OverlayProc(desc.BufferDesc.Width, desc.BufferDesc.Height);
|
||||
|
||||
ImGui::EndFrame();
|
||||
|
||||
ImGui::Render();
|
||||
|
||||
pContext->OMSetRenderTargets(1, &mainRenderTargetView, NULL);
|
||||
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX11_Hook::MyPresent(IDXGISwapChain *_this, UINT SyncInterval, UINT Flags)
|
||||
{
|
||||
DX11_Hook::Inst()->prepareForOverlay(_this);
|
||||
|
||||
return (_this->*DX11_Hook::Inst()->Present)(SyncInterval, Flags);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX11_Hook::MyResizeTarget(IDXGISwapChain* _this, const DXGI_MODE_DESC* pNewTargetParameters)
|
||||
{
|
||||
DX11_Hook::Inst()->resetRenderState();
|
||||
return (_this->*DX11_Hook::Inst()->ResizeTarget)(pNewTargetParameters);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX11_Hook::MyResizeBuffers(IDXGISwapChain* _this, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
|
||||
{
|
||||
DX11_Hook::Inst()->resetRenderState();
|
||||
return (_this->*DX11_Hook::Inst()->ResizeBuffers)(BufferCount, Width, Height, NewFormat, SwapChainFlags);
|
||||
}
|
||||
|
||||
DX11_Hook::DX11_Hook():
|
||||
initialized(false),
|
||||
hooked(false),
|
||||
pContext(nullptr),
|
||||
mainRenderTargetView(nullptr),
|
||||
Present(nullptr),
|
||||
ResizeBuffers(nullptr),
|
||||
ResizeTarget(nullptr)
|
||||
{
|
||||
_library = LoadLibrary(DLL_NAME);
|
||||
}
|
||||
|
||||
DX11_Hook::~DX11_Hook()
|
||||
{
|
||||
PRINT_DEBUG("DX11 Hook removed\n");
|
||||
|
||||
if (initialized)
|
||||
{
|
||||
mainRenderTargetView->Release();
|
||||
pContext->Release();
|
||||
|
||||
ImGui_ImplDX11_InvalidateDeviceObjects();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
FreeLibrary(reinterpret_cast<HMODULE>(_library));
|
||||
|
||||
_inst = nullptr;
|
||||
}
|
||||
|
||||
DX11_Hook* DX11_Hook::Inst()
|
||||
{
|
||||
if (_inst == nullptr)
|
||||
_inst = new DX11_Hook;
|
||||
|
||||
return _inst;
|
||||
}
|
||||
|
||||
const char* DX11_Hook::get_lib_name() const
|
||||
{
|
||||
return DLL_NAME;
|
||||
}
|
||||
|
||||
void DX11_Hook::loadFunctions(IDXGISwapChain *pSwapChain)
|
||||
{
|
||||
void** vTable;
|
||||
|
||||
vTable = *reinterpret_cast<void***>(pSwapChain);
|
||||
#define LOAD_FUNC(X) (void*&)X = vTable[(int)IDXGISwapChainVTable::X]
|
||||
LOAD_FUNC(Present);
|
||||
LOAD_FUNC(ResizeBuffers);
|
||||
LOAD_FUNC(ResizeTarget);
|
||||
#undef LOAD_FUNC
|
||||
}
|
||||
|
||||
#endif//NO_OVERLAY
|
||||
51
overlay_experimental/windows/DX11_Hook.h
Normal file
51
overlay_experimental/windows/DX11_Hook.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#ifndef __INCLUDED_DX11_HOOK_H__
|
||||
#define __INCLUDED_DX11_HOOK_H__
|
||||
|
||||
#include "Base_Hook.h"
|
||||
#ifndef NO_OVERLAY
|
||||
|
||||
#include <d3d11.h>
|
||||
#include "DirectX_VTables.h"
|
||||
|
||||
class DX11_Hook : public Base_Hook
|
||||
{
|
||||
public:
|
||||
static constexpr const char *DLL_NAME = "d3d11.dll";
|
||||
|
||||
private:
|
||||
static DX11_Hook* _inst;
|
||||
|
||||
// Variables
|
||||
bool hooked;
|
||||
bool initialized;
|
||||
ID3D11DeviceContext* pContext;
|
||||
ID3D11RenderTargetView* mainRenderTargetView;
|
||||
|
||||
// Functions
|
||||
DX11_Hook();
|
||||
|
||||
void resetRenderState();
|
||||
void prepareForOverlay(IDXGISwapChain* pSwapChain);
|
||||
|
||||
// Hook to render functions
|
||||
static HRESULT STDMETHODCALLTYPE MyPresent(IDXGISwapChain* _this, UINT SyncInterval, UINT Flags);
|
||||
static HRESULT STDMETHODCALLTYPE MyResizeTarget(IDXGISwapChain* _this, const DXGI_MODE_DESC* pNewTargetParameters);
|
||||
static HRESULT STDMETHODCALLTYPE MyResizeBuffers(IDXGISwapChain* _this, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags);
|
||||
|
||||
decltype(&IDXGISwapChain::Present) Present;
|
||||
decltype(&IDXGISwapChain::ResizeBuffers) ResizeBuffers;
|
||||
decltype(&IDXGISwapChain::ResizeTarget) ResizeTarget;
|
||||
|
||||
public:
|
||||
virtual ~DX11_Hook();
|
||||
|
||||
bool start_hook();
|
||||
static DX11_Hook* Inst();
|
||||
virtual const char* get_lib_name() const;
|
||||
|
||||
void loadFunctions(IDXGISwapChain *pSwapChain);
|
||||
};
|
||||
|
||||
#endif//NO_OVERLAY
|
||||
|
||||
#endif//__INCLUDED_DX11_HOOK_H__
|
||||
222
overlay_experimental/windows/DX12_Hook.cpp
Normal file
222
overlay_experimental/windows/DX12_Hook.cpp
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
#include "DX12_Hook.h"
|
||||
#include "Windows_Hook.h"
|
||||
#include "Renderer_Detector.h"
|
||||
#include "../dll/dll.h"
|
||||
|
||||
#ifndef NO_OVERLAY
|
||||
|
||||
#include <imgui.h>
|
||||
#include <impls/imgui_impl_dx12.h>
|
||||
|
||||
#include <dxgi1_4.h>
|
||||
|
||||
DX12_Hook* DX12_Hook::_inst = nullptr;
|
||||
|
||||
bool DX12_Hook::start_hook()
|
||||
{
|
||||
bool res = true;
|
||||
if (!hooked)
|
||||
{
|
||||
if (!Windows_Hook::Inst()->start_hook())
|
||||
return false;
|
||||
|
||||
PRINT_DEBUG("Hooked DirectX 12\n");
|
||||
hooked = true;
|
||||
|
||||
Renderer_Detector::Inst().renderer_found(this);
|
||||
|
||||
BeginHook();
|
||||
HookFuncs(
|
||||
std::make_pair<void**, void*>(&(PVOID&)DX12_Hook::Present, &DX12_Hook::MyPresent),
|
||||
std::make_pair<void**, void*>(&(PVOID&)DX12_Hook::ResizeTarget, &DX12_Hook::MyResizeTarget),
|
||||
std::make_pair<void**, void*>(&(PVOID&)DX12_Hook::ResizeBuffers, &DX12_Hook::MyResizeBuffers),
|
||||
std::make_pair<void**, void*>(&(PVOID&)DX12_Hook::ExecuteCommandLists, &DX12_Hook::MyExecuteCommandLists),
|
||||
std::make_pair<void**, void*>(&(PVOID&)DX12_Hook::Close, &DX12_Hook::MyClose)
|
||||
);
|
||||
EndHook();
|
||||
|
||||
get_steam_client()->steam_overlay->HookReady();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void DX12_Hook::resetRenderState()
|
||||
{
|
||||
if (initialized)
|
||||
{
|
||||
pSrvDescHeap->Release();
|
||||
|
||||
ImGui_ImplDX12_Shutdown();
|
||||
Windows_Hook::Inst()->resetRenderState();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
initialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to make this function and overlay's proc as short as possible or it might affect game's fps.
|
||||
void DX12_Hook::prepareForOverlay(IDXGISwapChain* pSwapChain)
|
||||
{
|
||||
pSwapChain->GetDesc(&sc_desc);
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
ID3D12Device* pDevice;
|
||||
if (pSwapChain->GetDevice(IID_PPV_ARGS(&pDevice)) != S_OK)
|
||||
return;
|
||||
|
||||
{
|
||||
D3D12_DESCRIPTOR_HEAP_DESC desc = {};
|
||||
desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
|
||||
desc.NumDescriptors = 1;
|
||||
desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
|
||||
if (pDevice->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&pSrvDescHeap)) != S_OK)
|
||||
{
|
||||
pDevice->Release();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.IniFilename = NULL;
|
||||
|
||||
ImGui_ImplDX12_Init(pDevice, 1, DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
pSrvDescHeap->GetCPUDescriptorHandleForHeapStart(),
|
||||
pSrvDescHeap->GetGPUDescriptorHandleForHeapStart());
|
||||
|
||||
pDevice->Release();
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX12_Hook::MyPresent(IDXGISwapChain *_this, UINT SyncInterval, UINT Flags)
|
||||
{
|
||||
DX12_Hook::Inst()->prepareForOverlay(_this);
|
||||
|
||||
return (_this->*DX12_Hook::Inst()->Present)(SyncInterval, Flags);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX12_Hook::MyResizeTarget(IDXGISwapChain* _this, const DXGI_MODE_DESC* pNewTargetParameters)
|
||||
{
|
||||
DX12_Hook::Inst()->resetRenderState();
|
||||
return (_this->*DX12_Hook::Inst()->ResizeTarget)(pNewTargetParameters);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX12_Hook::MyResizeBuffers(IDXGISwapChain* _this, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
|
||||
{
|
||||
DX12_Hook::Inst()->resetRenderState();
|
||||
return (_this->*DX12_Hook::Inst()->ResizeBuffers)(BufferCount, Width, Height, NewFormat, SwapChainFlags);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE DX12_Hook::MyExecuteCommandLists(ID3D12CommandQueue *_this, UINT NumCommandLists, ID3D12CommandList* const* ppCommandLists)
|
||||
{
|
||||
DX12_Hook* me = DX12_Hook::Inst();
|
||||
// ----------------------------------------------------- //
|
||||
// \/\/\/ TODO: Find a cleaner way to do all this \/\/\/ //
|
||||
// I'd like to put it in IDXGISwapChain::Present //
|
||||
// ----------------------------------------------------- //
|
||||
if (me->initialized)
|
||||
{
|
||||
static std::recursive_mutex render_mutex; // Sniper Elite 4 where I test this uses multiple thread on this. ImGui is not reentrant
|
||||
std::lock_guard<std::recursive_mutex> lock(render_mutex);
|
||||
for (int i = 0; i < NumCommandLists; ++i)
|
||||
{
|
||||
if (((ID3D12GraphicsCommandList*)ppCommandLists[i])->GetType() == D3D12_COMMAND_LIST_TYPE_DIRECT)
|
||||
{
|
||||
ImGui_ImplDX12_NewFrame();
|
||||
Windows_Hook::Inst()->prepareForOverlay(me->sc_desc.OutputWindow);
|
||||
|
||||
ImGui::NewFrame();
|
||||
|
||||
get_steam_client()->steam_overlay->OverlayProc(me->sc_desc.BufferDesc.Width, me->sc_desc.BufferDesc.Height);
|
||||
|
||||
ImGui::EndFrame();
|
||||
|
||||
((ID3D12GraphicsCommandList*)ppCommandLists[i])->SetDescriptorHeaps(1, &me->pSrvDescHeap);
|
||||
ImGui::Render();
|
||||
ImGui_ImplDX12_RenderDrawData(ImGui::GetDrawData(), (ID3D12GraphicsCommandList*)ppCommandLists[i]);
|
||||
(((ID3D12GraphicsCommandList*)ppCommandLists[i])->*me->Close)();
|
||||
}
|
||||
}
|
||||
}
|
||||
(_this->*DX12_Hook::Inst()->ExecuteCommandLists)(NumCommandLists, ppCommandLists);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX12_Hook::MyClose(ID3D12GraphicsCommandList* _this)
|
||||
{
|
||||
if (DX12_Hook::Inst()->initialized && _this->GetType() == D3D12_COMMAND_LIST_TYPE_DIRECT)
|
||||
return S_OK;
|
||||
else
|
||||
return (_this->*DX12_Hook::Inst()->Close)();
|
||||
}
|
||||
|
||||
DX12_Hook::DX12_Hook():
|
||||
initialized(false),
|
||||
hooked(false),
|
||||
pSrvDescHeap(nullptr),
|
||||
Present(nullptr),
|
||||
ResizeBuffers(nullptr),
|
||||
ResizeTarget(nullptr),
|
||||
ExecuteCommandLists(nullptr),
|
||||
Close(nullptr)
|
||||
{
|
||||
_library = LoadLibrary(DLL_NAME);
|
||||
|
||||
PRINT_DEBUG("DX12 support is experimental, don't complain if it doesn't work as expected.\n");
|
||||
}
|
||||
|
||||
DX12_Hook::~DX12_Hook()
|
||||
{
|
||||
PRINT_DEBUG("DX12 Hook removed\n");
|
||||
|
||||
if (initialized)
|
||||
{
|
||||
ImGui_ImplDX12_InvalidateDeviceObjects();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
FreeLibrary(reinterpret_cast<HMODULE>(_library));
|
||||
|
||||
_inst = nullptr;
|
||||
}
|
||||
|
||||
DX12_Hook* DX12_Hook::Inst()
|
||||
{
|
||||
if (_inst == nullptr)
|
||||
_inst = new DX12_Hook();
|
||||
|
||||
return _inst;
|
||||
}
|
||||
|
||||
const char* DX12_Hook::get_lib_name() const
|
||||
{
|
||||
return DLL_NAME;
|
||||
}
|
||||
|
||||
void DX12_Hook::loadFunctions(ID3D12CommandQueue* pCommandQueue, ID3D12GraphicsCommandList* pCommandList, IDXGISwapChain *pSwapChain)
|
||||
{
|
||||
void** vTable;
|
||||
|
||||
vTable = *reinterpret_cast<void***>(pCommandQueue);
|
||||
#define LOAD_FUNC(X) (void*&)X = vTable[(int)ID3D12CommandQueueVTable::X]
|
||||
LOAD_FUNC(ExecuteCommandLists);
|
||||
#undef LOAD_FUNC
|
||||
|
||||
vTable = *reinterpret_cast<void***>(pCommandList);
|
||||
#define LOAD_FUNC(X) (void*&)X = vTable[(int)ID3D12GraphicsCommandListVTable::X]
|
||||
LOAD_FUNC(Close);
|
||||
#undef LOAD_FUNC
|
||||
|
||||
vTable = *reinterpret_cast<void***>(pSwapChain);
|
||||
#define LOAD_FUNC(X) (void*&)X = vTable[(int)IDXGISwapChainVTable::X]
|
||||
LOAD_FUNC(Present);
|
||||
LOAD_FUNC(ResizeBuffers);
|
||||
LOAD_FUNC(ResizeTarget);
|
||||
#undef LOAD_FUNC
|
||||
}
|
||||
|
||||
#endif//NO_OVERLAY
|
||||
56
overlay_experimental/windows/DX12_Hook.h
Normal file
56
overlay_experimental/windows/DX12_Hook.h
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#ifndef __INCLUDED_DX12_HOOK_H__
|
||||
#define __INCLUDED_DX12_HOOK_H__
|
||||
|
||||
#include "Base_Hook.h"
|
||||
#ifndef NO_OVERLAY
|
||||
|
||||
#include <d3d12.h>
|
||||
#include <dxgi1_4.h>
|
||||
#include "DirectX_VTables.h"
|
||||
|
||||
class DX12_Hook : public Base_Hook
|
||||
{
|
||||
public:
|
||||
static constexpr const char *DLL_NAME = "d3d12.dll";
|
||||
|
||||
private:
|
||||
static DX12_Hook* _inst;
|
||||
|
||||
// Variables
|
||||
bool hooked;
|
||||
bool initialized;
|
||||
|
||||
DXGI_SWAP_CHAIN_DESC sc_desc;
|
||||
ID3D12DescriptorHeap* pSrvDescHeap;
|
||||
|
||||
// Functions
|
||||
DX12_Hook();
|
||||
|
||||
void resetRenderState();
|
||||
void prepareForOverlay(IDXGISwapChain* pSwapChain);
|
||||
|
||||
// Hook to render functions
|
||||
static HRESULT STDMETHODCALLTYPE MyPresent(IDXGISwapChain* _this, UINT SyncInterval, UINT Flags);
|
||||
static HRESULT STDMETHODCALLTYPE MyResizeTarget(IDXGISwapChain* _this, const DXGI_MODE_DESC* pNewTargetParameters);
|
||||
static HRESULT STDMETHODCALLTYPE MyResizeBuffers(IDXGISwapChain* _this, UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags);
|
||||
static void STDMETHODCALLTYPE MyExecuteCommandLists(ID3D12CommandQueue *_this, UINT NumCommandLists, ID3D12CommandList* const* ppCommandLists);
|
||||
static HRESULT STDMETHODCALLTYPE MyClose(ID3D12GraphicsCommandList* _this);
|
||||
|
||||
decltype(&IDXGISwapChain::Present) Present;
|
||||
decltype(&IDXGISwapChain::ResizeBuffers) ResizeBuffers;
|
||||
decltype(&IDXGISwapChain::ResizeTarget) ResizeTarget;
|
||||
decltype(&ID3D12CommandQueue::ExecuteCommandLists) ExecuteCommandLists;
|
||||
decltype(&ID3D12GraphicsCommandList::Close) Close;
|
||||
|
||||
public:
|
||||
virtual ~DX12_Hook();
|
||||
|
||||
bool start_hook();
|
||||
static DX12_Hook* Inst();
|
||||
virtual const char* get_lib_name() const;
|
||||
|
||||
void loadFunctions(ID3D12CommandQueue* pCommandQueue, ID3D12GraphicsCommandList* pCommandList, IDXGISwapChain* pSwapChain);
|
||||
};
|
||||
|
||||
#endif//NO_OVERLAY
|
||||
#endif//__INCLUDED_DX12_HOOK_H__
|
||||
177
overlay_experimental/windows/DX9_Hook.cpp
Normal file
177
overlay_experimental/windows/DX9_Hook.cpp
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
#include "DX9_Hook.h"
|
||||
#include "Windows_Hook.h"
|
||||
#include "Renderer_Detector.h"
|
||||
#include "../dll/dll.h"
|
||||
|
||||
#ifndef NO_OVERLAY
|
||||
|
||||
#include <imgui.h>
|
||||
#include <impls/imgui_impl_dx9.h>
|
||||
|
||||
#include "steam_overlay.h"
|
||||
|
||||
DX9_Hook* DX9_Hook::_inst = nullptr;
|
||||
|
||||
bool DX9_Hook::start_hook()
|
||||
{
|
||||
if (!hooked)
|
||||
{
|
||||
if (!Windows_Hook::Inst()->start_hook())
|
||||
return false;
|
||||
|
||||
PRINT_DEBUG("Hooked DirectX 9\n");
|
||||
hooked = true;
|
||||
|
||||
Renderer_Detector::Inst().renderer_found(this);
|
||||
|
||||
BeginHook();
|
||||
HookFuncs(
|
||||
std::make_pair<void**, void*>(&(PVOID&)Reset, &DX9_Hook::MyReset),
|
||||
std::make_pair<void**, void*>(&(PVOID&)Present, &DX9_Hook::MyPresent)
|
||||
);
|
||||
if (PresentEx != nullptr)
|
||||
{
|
||||
HookFuncs(
|
||||
std::make_pair<void**, void*>(&(PVOID&)PresentEx, &DX9_Hook::MyPresentEx)
|
||||
//std::make_pair<void**, void*>(&(PVOID&)EndScene, &DX9_Hook::MyEndScene)
|
||||
);
|
||||
}
|
||||
EndHook();
|
||||
|
||||
get_steam_client()->steam_overlay->HookReady();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void DX9_Hook::resetRenderState()
|
||||
{
|
||||
if (initialized)
|
||||
{
|
||||
initialized = false;
|
||||
ImGui_ImplDX9_Shutdown();
|
||||
Windows_Hook::Inst()->resetRenderState();
|
||||
ImGui::DestroyContext();
|
||||
}
|
||||
}
|
||||
|
||||
// Try to make this function and overlay's proc as short as possible or it might affect game's fps.
|
||||
void DX9_Hook::prepareForOverlay(IDirect3DDevice9 *pDevice)
|
||||
{
|
||||
IDirect3DSwapChain9* pSwapChain;
|
||||
pDevice->GetSwapChain(0, &pSwapChain);
|
||||
D3DPRESENT_PARAMETERS PresentParameters;
|
||||
pSwapChain->GetPresentParameters(&PresentParameters);
|
||||
pSwapChain->Release();
|
||||
|
||||
D3DDEVICE_CREATION_PARAMETERS param;
|
||||
pDevice->GetCreationParameters(¶m);
|
||||
|
||||
// Workaround to detect if we changed window.
|
||||
if (param.hFocusWindow != Windows_Hook::Inst()->GetGameHwnd())
|
||||
resetRenderState();
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.IniFilename = NULL;
|
||||
|
||||
ImGui_ImplDX9_Init(pDevice);
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
ImGui_ImplDX9_NewFrame();
|
||||
Windows_Hook::Inst()->prepareForOverlay(param.hFocusWindow);
|
||||
|
||||
ImGui::NewFrame();
|
||||
|
||||
get_steam_client()->steam_overlay->OverlayProc(PresentParameters.BackBufferWidth, PresentParameters.BackBufferHeight);
|
||||
|
||||
ImGui::EndFrame();
|
||||
|
||||
ImGui::Render();
|
||||
|
||||
ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX9_Hook::MyReset(IDirect3DDevice9* _this, D3DPRESENT_PARAMETERS* pPresentationParameters)
|
||||
{
|
||||
DX9_Hook::Inst()->resetRenderState();
|
||||
return (_this->*DX9_Hook::Inst()->Reset)(pPresentationParameters);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX9_Hook::MyEndScene(IDirect3DDevice9* _this)
|
||||
{
|
||||
if( !DX9_Hook::Inst()->uses_present )
|
||||
DX9_Hook::Inst()->prepareForOverlay(_this);
|
||||
return (_this->*DX9_Hook::Inst()->EndScene)();
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX9_Hook::MyPresent(IDirect3DDevice9* _this, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion)
|
||||
{
|
||||
DX9_Hook::Inst()->uses_present = true;
|
||||
DX9_Hook::Inst()->prepareForOverlay(_this);
|
||||
return (_this->*DX9_Hook::Inst()->Present)(pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DX9_Hook::MyPresentEx(IDirect3DDevice9Ex* _this, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion, DWORD dwFlags)
|
||||
{
|
||||
DX9_Hook::Inst()->uses_present = true;
|
||||
DX9_Hook::Inst()->prepareForOverlay(_this);
|
||||
return (_this->*DX9_Hook::Inst()->PresentEx)(pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags);
|
||||
}
|
||||
|
||||
DX9_Hook::DX9_Hook():
|
||||
initialized(false),
|
||||
hooked(false),
|
||||
uses_present(false),
|
||||
EndScene(nullptr),
|
||||
Present(nullptr),
|
||||
PresentEx(nullptr),
|
||||
Reset(nullptr)
|
||||
{
|
||||
_library = LoadLibrary(DLL_NAME);
|
||||
}
|
||||
|
||||
DX9_Hook::~DX9_Hook()
|
||||
{
|
||||
PRINT_DEBUG("DX9 Hook removed\n");
|
||||
|
||||
if (initialized)
|
||||
{
|
||||
ImGui_ImplDX9_InvalidateDeviceObjects();
|
||||
ImGui::DestroyContext();
|
||||
}
|
||||
|
||||
FreeLibrary(reinterpret_cast<HMODULE>(_library));
|
||||
|
||||
_inst = nullptr;
|
||||
}
|
||||
|
||||
DX9_Hook* DX9_Hook::Inst()
|
||||
{
|
||||
if( _inst == nullptr )
|
||||
_inst = new DX9_Hook;
|
||||
|
||||
return _inst;
|
||||
}
|
||||
|
||||
const char* DX9_Hook::get_lib_name() const
|
||||
{
|
||||
return DLL_NAME;
|
||||
}
|
||||
|
||||
void DX9_Hook::loadFunctions(IDirect3DDevice9* pDevice, bool ex)
|
||||
{
|
||||
void** vTable = *reinterpret_cast<void***>(pDevice);
|
||||
|
||||
#define LOAD_FUNC(X) (void*&)X = vTable[(int)IDirect3DDevice9VTable::X]
|
||||
LOAD_FUNC(Reset);
|
||||
LOAD_FUNC(EndScene);
|
||||
LOAD_FUNC(Present);
|
||||
if (ex)
|
||||
LOAD_FUNC(PresentEx);
|
||||
#undef LOAD_FUNC
|
||||
}
|
||||
|
||||
#endif//NO_OVERLAY
|
||||
52
overlay_experimental/windows/DX9_Hook.h
Normal file
52
overlay_experimental/windows/DX9_Hook.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#ifndef __INCLUDED_DX9_HOOK_H__
|
||||
#define __INCLUDED_DX9_HOOK_H__
|
||||
|
||||
#include "Base_Hook.h"
|
||||
#ifndef NO_OVERLAY
|
||||
|
||||
#include <d3d9.h>
|
||||
#include "DirectX_VTables.h"
|
||||
|
||||
class DX9_Hook : public Base_Hook
|
||||
{
|
||||
public:
|
||||
static constexpr const char *DLL_NAME = "d3d9.dll";
|
||||
|
||||
private:
|
||||
static DX9_Hook* _inst;
|
||||
|
||||
// Variables
|
||||
bool hooked;
|
||||
bool initialized;
|
||||
bool uses_present;
|
||||
|
||||
// Functions
|
||||
DX9_Hook();
|
||||
|
||||
void resetRenderState();
|
||||
void prepareForOverlay(IDirect3DDevice9* pDevice);
|
||||
|
||||
// Hook to render functions
|
||||
decltype(&IDirect3DDevice9::Reset) Reset;
|
||||
decltype(&IDirect3DDevice9::EndScene) EndScene;
|
||||
decltype(&IDirect3DDevice9::Present) Present;
|
||||
decltype(&IDirect3DDevice9Ex::PresentEx) PresentEx;
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE MyReset(IDirect3DDevice9* _this, D3DPRESENT_PARAMETERS* pPresentationParameters);
|
||||
static HRESULT STDMETHODCALLTYPE MyEndScene(IDirect3DDevice9 *_this);
|
||||
static HRESULT STDMETHODCALLTYPE MyPresent(IDirect3DDevice9* _this, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion);
|
||||
static HRESULT STDMETHODCALLTYPE MyPresentEx(IDirect3DDevice9Ex* _this, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion, DWORD dwFlags);
|
||||
|
||||
public:
|
||||
virtual ~DX9_Hook();
|
||||
|
||||
bool start_hook();
|
||||
static DX9_Hook* Inst();
|
||||
virtual const char* get_lib_name() const;
|
||||
|
||||
void loadFunctions(IDirect3DDevice9 *pDevice, bool ex);
|
||||
};
|
||||
|
||||
#endif//NO_OVERLAY
|
||||
|
||||
#endif//__INCLUDED_DX9_HOOK_H__
|
||||
448
overlay_experimental/windows/DirectX_VTables.h
Normal file
448
overlay_experimental/windows/DirectX_VTables.h
Normal file
|
|
@ -0,0 +1,448 @@
|
|||
#pragma once
|
||||
|
||||
#include <DXGI.h>
|
||||
|
||||
enum class IDXGISwapChainVTable
|
||||
{
|
||||
// IUnknown
|
||||
QueryInterface,
|
||||
AddRef,
|
||||
Release,
|
||||
|
||||
// IDXGIObject
|
||||
SetPrivateData,
|
||||
SetPrivateDataInterface,
|
||||
GetPrivateData,
|
||||
GetParent,
|
||||
|
||||
// IDXGIDeviceSubObject
|
||||
GetDevice,
|
||||
|
||||
// IDXGISwapChain
|
||||
Present,
|
||||
GetBuffer,
|
||||
SetFullscreenState,
|
||||
GetFullscreenState,
|
||||
GetDesc,
|
||||
ResizeBuffers,
|
||||
ResizeTarget,
|
||||
GetContainingOutput,
|
||||
GetFrameStatistics,
|
||||
GetLastPresentCount,
|
||||
|
||||
// IDXGISwapChain1
|
||||
GetDesc1,
|
||||
GetFullscreenDesc,
|
||||
GetHwnd,
|
||||
GetCoreWindow,
|
||||
Present1,
|
||||
IsTemporaryMonoSupported,
|
||||
GetRestrictToOutput,
|
||||
SetBackgroundColor,
|
||||
GetBackgroundColor,
|
||||
SetRotation,
|
||||
GetRotation,
|
||||
};
|
||||
|
||||
enum class ID3D12CommandQueueVTable
|
||||
{
|
||||
// IUnknown
|
||||
QueryInterface,
|
||||
AddRef,
|
||||
Release,
|
||||
|
||||
// ID3D12Object
|
||||
GetPrivateData,
|
||||
SetPrivateData,
|
||||
SetPrivateDataInterface,
|
||||
SetName,
|
||||
|
||||
// ID3D12DeviceChild
|
||||
GetDevice,
|
||||
|
||||
// ID3D12Pageable
|
||||
|
||||
// ID3D12CommandQueue
|
||||
UpdateTileMappings,
|
||||
CopyTileMappings,
|
||||
ExecuteCommandLists,
|
||||
SetMarker,
|
||||
BeginEvent,
|
||||
EndEvent,
|
||||
Signal,
|
||||
Wait,
|
||||
GetTimestampFrequency,
|
||||
GetClockCalibration,
|
||||
GetDesc,
|
||||
};
|
||||
|
||||
enum class ID3D12GraphicsCommandListVTable
|
||||
{
|
||||
// IUnknown
|
||||
QueryInterface,
|
||||
AddRef,
|
||||
Release,
|
||||
|
||||
// ID3D12Object
|
||||
GetPrivateData,
|
||||
SetPrivateData,
|
||||
SetPrivateDataInterface,
|
||||
SetName,
|
||||
|
||||
// ID3D12DeviceChild
|
||||
GetDevice,
|
||||
|
||||
// ID3D12CommandList
|
||||
GetType,
|
||||
|
||||
// ID3D12GraphicsCommandList
|
||||
Close,
|
||||
Reset,
|
||||
ClearState,
|
||||
DrawInstanced,
|
||||
DrawIndexedInstanced,
|
||||
Dispatch,
|
||||
CopyBufferRegion,
|
||||
CopyTextureRegion,
|
||||
CopyResource,
|
||||
CopyTiles,
|
||||
ResolveSubresource,
|
||||
IASetPrimitiveTopology,
|
||||
RSSetViewports,
|
||||
RSSetScissorRects,
|
||||
OMSetBlendFactor,
|
||||
OMSetStencilRef,
|
||||
SetPipelineState,
|
||||
ResourceBarrier,
|
||||
ExecuteBundle,
|
||||
SetDescriptorHeaps,
|
||||
SetComputeRootSignature,
|
||||
SetGraphicsRootSignature,
|
||||
SetComputeRootDescriptorTable,
|
||||
SetGraphicsRootDescriptorTable,
|
||||
SetComputeRoot32BitConstant,
|
||||
SetGraphicsRoot32BitConstant,
|
||||
SetComputeRoot32BitConstants,
|
||||
SetGraphicsRoot32BitConstants,
|
||||
SetComputeRootConstantBufferView,
|
||||
SetGraphicsRootConstantBufferView,
|
||||
SetComputeRootShaderResourceView,
|
||||
SetGraphicsRootShaderResourceView,
|
||||
SetComputeRootUnorderedAccessView,
|
||||
SetGraphicsRootUnorderedAccessView,
|
||||
IASetIndexBuffer,
|
||||
IASetVertexBuffers,
|
||||
SOSetTargets,
|
||||
OMSetRenderTargets,
|
||||
ClearDepthStencilView,
|
||||
ClearRenderTargetView,
|
||||
ClearUnorderedAccessViewUint,
|
||||
ClearUnorderedAccessViewFloat,
|
||||
DiscardResource,
|
||||
BeginQuery,
|
||||
EndQuery,
|
||||
ResolveQueryData,
|
||||
SetPredication,
|
||||
SetMarker,
|
||||
BeginEvent,
|
||||
EndEvent,
|
||||
ExecuteIndirect,
|
||||
};
|
||||
|
||||
enum class ID3D11DeviceVTable
|
||||
{
|
||||
// IUnknown
|
||||
QueryInterface,
|
||||
AddRef,
|
||||
Release,
|
||||
|
||||
// ID3D11Device
|
||||
CreateBuffer,
|
||||
CreateTexture1D,
|
||||
CreateTexture2D,
|
||||
CreateTexture3D,
|
||||
CreateShaderResourceView,
|
||||
CreateUnorderedAccessView,
|
||||
CreateRenderTargetView,
|
||||
CreateDepthStencilView,
|
||||
CreateInputLayout,
|
||||
CreateVertexShader,
|
||||
CreateGeometryShader,
|
||||
CreateGeometryShaderWithStreamOutput,
|
||||
CreatePixelShader,
|
||||
CreateHullShader,
|
||||
CreateDomainShader,
|
||||
CreateComputeShader,
|
||||
CreateClassLinkage,
|
||||
CreateBlendState,
|
||||
CreateDepthStencilState,
|
||||
CreateRasterizerState,
|
||||
CreateSamplerState,
|
||||
CreateQuery,
|
||||
CreatePredicate,
|
||||
CreateCounter,
|
||||
CreateDeferredContext,
|
||||
OpenSharedResource,
|
||||
CheckFormatSupport,
|
||||
CheckMultisampleQualityLevels,
|
||||
CheckCounterInfo,
|
||||
CheckCounter,
|
||||
CheckFeatureSupport,
|
||||
GetPrivateData,
|
||||
SetPrivateData,
|
||||
SetPrivateDataInterface,
|
||||
GetFeatureLevel,
|
||||
GetCreationFlags,
|
||||
GetDeviceRemovedReason,
|
||||
GetImmediateContext,
|
||||
SetExceptionMode,
|
||||
GetExceptionMode,
|
||||
};
|
||||
|
||||
enum class ID3D10DeviceVTable
|
||||
{
|
||||
// IUnknown
|
||||
QueryInterface,
|
||||
AddRef,
|
||||
Release,
|
||||
|
||||
// ID3D10Device
|
||||
VSSetConstantBuffers,
|
||||
PSSetShaderResources,
|
||||
PSSetShader,
|
||||
PSSetSamplers,
|
||||
VSSetShader,
|
||||
DrawIndexed,
|
||||
Draw,
|
||||
PSSetConstantBuffers,
|
||||
IASetInputLayout,
|
||||
IASetVertexBuffers,
|
||||
IASetIndexBuffer,
|
||||
DrawIndexedInstanced,
|
||||
DrawInstanced,
|
||||
GSSetConstantBuffers,
|
||||
GSSetShader,
|
||||
IASetPrimitiveTopology,
|
||||
VSSetShaderResources,
|
||||
VSSetSamplers,
|
||||
SetPredication,
|
||||
GSSetShaderResources,
|
||||
GSSetSamplers,
|
||||
OMSetRenderTargets,
|
||||
OMSetBlendState,
|
||||
OMSetDepthStencilState,
|
||||
SOSetTargets,
|
||||
DrawAuto,
|
||||
RSSetState,
|
||||
RSSetViewports,
|
||||
RSSetScissorRects,
|
||||
CopySubresourceRegion,
|
||||
CopyResource,
|
||||
UpdateSubresource,
|
||||
ClearRenderTargetView,
|
||||
ClearDepthStencilView,
|
||||
GenerateMips,
|
||||
ResolveSubresource,
|
||||
VSGetConstantBuffers,
|
||||
PSGetShaderResources,
|
||||
PSGetShader,
|
||||
PSGetSamplers,
|
||||
VSGetShader,
|
||||
PSGetConstantBuffers,
|
||||
IAGetInputLayout,
|
||||
IAGetVertexBuffers,
|
||||
IAGetIndexBuffer,
|
||||
GSGetConstantBuffers,
|
||||
GSGetShader,
|
||||
IAGetPrimitiveTopology,
|
||||
VSGetShaderResources,
|
||||
VSGetSamplers,
|
||||
GetPredication,
|
||||
GSGetShaderResources,
|
||||
GSGetSamplers,
|
||||
OMGetRenderTargets,
|
||||
OMGetBlendState,
|
||||
OMGetDepthStencilState,
|
||||
SOGetTargets,
|
||||
RSGetState,
|
||||
RSGetViewports,
|
||||
RSGetScissorRects,
|
||||
GetDeviceRemovedReason,
|
||||
SetExceptionMode,
|
||||
GetExceptionMode,
|
||||
GetPrivateData,
|
||||
SetPrivateData,
|
||||
SetPrivateDataInterface,
|
||||
ClearState,
|
||||
Flush,
|
||||
CreateBuffer,
|
||||
CreateTexture1D,
|
||||
CreateTexture2D,
|
||||
CreateTexture3D,
|
||||
CreateShaderResourceView,
|
||||
CreateRenderTargetView,
|
||||
CreateDepthStencilView,
|
||||
CreateInputLayout,
|
||||
CreateVertexShader,
|
||||
CreateGeometryShader,
|
||||
CreateGeometryShaderWithStreamOutput,
|
||||
CreatePixelShader,
|
||||
CreateBlendState,
|
||||
CreateDepthStencilState,
|
||||
CreateRasterizerState,
|
||||
CreateSamplerState,
|
||||
CreateQuery,
|
||||
CreatePredicate,
|
||||
CreateCounter,
|
||||
CheckFormatSupport,
|
||||
CheckMultisampleQualityLevels,
|
||||
CheckCounterInfo,
|
||||
CheckCounter,
|
||||
GetCreationFlags,
|
||||
OpenSharedResource,
|
||||
SetTextFilterSize,
|
||||
GetTextFilterSize,
|
||||
};
|
||||
|
||||
enum class IDirect3DDevice9VTable
|
||||
{
|
||||
// IUnknown
|
||||
QueryInterface,
|
||||
AddRef,
|
||||
Release,
|
||||
|
||||
// IDirect3DDevice9
|
||||
TestCooperativeLevel,
|
||||
GetAvailableTextureMem,
|
||||
EvictManagedResources,
|
||||
GetDirect3D,
|
||||
GetDeviceCaps,
|
||||
GetDisplayMode,
|
||||
GetCreationParameters,
|
||||
SetCursorProperties,
|
||||
SetCursorPosition,
|
||||
ShowCursor,
|
||||
CreateAdditionalSwapChain,
|
||||
GetSwapChain,
|
||||
GetNumberOfSwapChains,
|
||||
Reset,
|
||||
Present,
|
||||
GetBackBuffer,
|
||||
GetRasterStatus,
|
||||
SetDialogBoxMode,
|
||||
SetGammaRamp,
|
||||
GetGammaRamp,
|
||||
CreateTexture,
|
||||
CreateVolumeTexture,
|
||||
CreateCubeTexture,
|
||||
CreateVertexBuffer,
|
||||
CreateIndexBuffer,
|
||||
CreateRenderTarget,
|
||||
CreateDepthStencilSurface,
|
||||
UpdateSurface,
|
||||
UpdateTexture,
|
||||
GetRenderTargetData,
|
||||
GetFrontBufferData,
|
||||
StretchRect,
|
||||
ColorFill,
|
||||
CreateOffscreenPlainSurface,
|
||||
SetRenderTarget,
|
||||
GetRenderTarget,
|
||||
SetDepthStencilSurface,
|
||||
GetDepthStencilSurface,
|
||||
BeginScene,
|
||||
EndScene,
|
||||
Clear,
|
||||
SetTransform,
|
||||
GetTransform,
|
||||
MultiplyTransform,
|
||||
SetViewport,
|
||||
GetViewport,
|
||||
SetMaterial,
|
||||
GetMaterial,
|
||||
SetLight,
|
||||
GetLight,
|
||||
LightEnable,
|
||||
GetLightEnable,
|
||||
SetClipPlane,
|
||||
GetClipPlane,
|
||||
SetRenderState,
|
||||
GetRenderState,
|
||||
CreateStateBlock,
|
||||
BeginStateBlock,
|
||||
EndStateBlock,
|
||||
SetClipStatus,
|
||||
GetClipStatus,
|
||||
GetTexture,
|
||||
SetTexture,
|
||||
GetTextureStageState,
|
||||
SetTextureStageState,
|
||||
GetSamplerState,
|
||||
SetSamplerState,
|
||||
ValidateDevice,
|
||||
SetPaletteEntries,
|
||||
GetPaletteEntries,
|
||||
SetCurrentTexturePalette,
|
||||
GetCurrentTexturePalette,
|
||||
SetScissorRect,
|
||||
GetScissorRect,
|
||||
SetSoftwareVertexProcessing,
|
||||
GetSoftwareVertexProcessing,
|
||||
SetNPatchMode,
|
||||
GetNPatchMode,
|
||||
DrawPrimitive,
|
||||
DrawIndexedPrimitive,
|
||||
DrawPrimitiveUP,
|
||||
DrawIndexedPrimitiveUP,
|
||||
ProcessVertices,
|
||||
CreateVertexDeclaration,
|
||||
SetVertexDeclaration,
|
||||
GetVertexDeclaration,
|
||||
SetFVF,
|
||||
GetFVF,
|
||||
CreateVertexShader,
|
||||
SetVertexShader,
|
||||
GetVertexShader,
|
||||
SetVertexShaderConstantF,
|
||||
GetVertexShaderConstantF,
|
||||
SetVertexShaderConstantI,
|
||||
GetVertexShaderConstantI,
|
||||
SetVertexShaderConstantB,
|
||||
GetVertexShaderConstantB,
|
||||
SetStreamSource,
|
||||
GetStreamSource,
|
||||
SetStreamSourceFreq,
|
||||
GetStreamSourceFreq,
|
||||
SetIndices,
|
||||
GetIndices,
|
||||
CreatePixelShader,
|
||||
SetPixelShader,
|
||||
GetPixelShader,
|
||||
SetPixelShaderConstantF,
|
||||
GetPixelShaderConstantF,
|
||||
SetPixelShaderConstantI,
|
||||
GetPixelShaderConstantI,
|
||||
SetPixelShaderConstantB,
|
||||
GetPixelShaderConstantB,
|
||||
DrawRectPatch,
|
||||
DrawTriPatch,
|
||||
DeletePatch,
|
||||
CreateQuery,
|
||||
|
||||
// IDirect3DDevice9Ex
|
||||
SetConvolutionMonoKernel,
|
||||
ComposeRects,
|
||||
PresentEx,
|
||||
GetGPUThreadPriority,
|
||||
SetGPUThreadPriority,
|
||||
WaitForVBlank,
|
||||
CheckResourceResidency,
|
||||
SetMaximumFrameLatency,
|
||||
GetMaximumFrameLatency,
|
||||
CheckDeviceState,
|
||||
CreateRenderTargetEx,
|
||||
CreateOffscreenPlainSurfaceEx,
|
||||
CreateDepthStencilSurfaceEx,
|
||||
ResetEx,
|
||||
GetDisplayModeEx,
|
||||
};
|
||||
319
overlay_experimental/windows/ImGui_ShaderBlobs.cpp
Normal file
319
overlay_experimental/windows/ImGui_ShaderBlobs.cpp
Normal file
|
|
@ -0,0 +1,319 @@
|
|||
#include "ImGui_ShaderBlobs.h"
|
||||
|
||||
#ifdef USE_D3DCOMPILE
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static HMODULE d3dcompile_dll = nullptr;
|
||||
|
||||
decltype(D3DCompile)* load_d3dcompile()
|
||||
{
|
||||
decltype(D3DCompile)* func = nullptr;
|
||||
for (int i = 47; i > 30; i--)
|
||||
{
|
||||
char dll_name[20];
|
||||
sprintf_s(dll_name, "d3dcompiler_%02d.dll", i);
|
||||
if (d3dcompile_dll = LoadLibraryA(dll_name))
|
||||
{
|
||||
func = (decltype(D3DCompile)*)GetProcAddress(d3dcompile_dll, "D3DCompile");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return func;
|
||||
}
|
||||
|
||||
void unload_d3dcompile()
|
||||
{
|
||||
if (d3dcompile_dll)
|
||||
FreeLibrary(d3dcompile_dll);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
extern unsigned char ImGui_vertexShaderDX10[] = {
|
||||
0x44, 0x58, 0x42, 0x43, 0x7a, 0x54, 0x84, 0x96, 0xdf, 0xd1, 0x9e, 0x21,
|
||||
0xfd, 0x85, 0x86, 0x3d, 0x28, 0xd1, 0x03, 0xae, 0x01, 0x00, 0x00, 0x00,
|
||||
0x6c, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
|
||||
0x04, 0x01, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00, 0xe8, 0x01, 0x00, 0x00,
|
||||
0xf0, 0x02, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xc8, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0xfe, 0xff, 0x00, 0x01, 0x00, 0x00,
|
||||
0xa0, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72,
|
||||
0x00, 0xab, 0xab, 0xab, 0x3c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x64, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x72, 0x69, 0x78, 0x00, 0xab, 0xab, 0xab,
|
||||
0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66,
|
||||
0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53,
|
||||
0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c,
|
||||
0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0x49, 0x53, 0x47, 0x4e,
|
||||
0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00,
|
||||
0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00,
|
||||
0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00,
|
||||
0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c,
|
||||
0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00,
|
||||
0x4f, 0x53, 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x0f, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||
0x03, 0x0c, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54,
|
||||
0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45,
|
||||
0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x53, 0x48, 0x44, 0x52,
|
||||
0x00, 0x01, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x04, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03,
|
||||
0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03,
|
||||
0x32, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02,
|
||||
0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x06, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05,
|
||||
0x32, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54,
|
||||
0x74, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
extern unsigned char ImGui_pixelShaderDX10[] = {
|
||||
0x44, 0x58, 0x42, 0x43, 0x9e, 0xce, 0x85, 0x72, 0xa7, 0x97, 0x52, 0xb4,
|
||||
0x6d, 0xc4, 0x28, 0xfa, 0x10, 0xc0, 0xd2, 0xc1, 0x01, 0x00, 0x00, 0x00,
|
||||
0x94, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
|
||||
0xd4, 0x00, 0x00, 0x00, 0x48, 0x01, 0x00, 0x00, 0x7c, 0x01, 0x00, 0x00,
|
||||
0x18, 0x02, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x98, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||
0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00,
|
||||
0x6e, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x65, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
|
||||
0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x73, 0x61, 0x6d, 0x70,
|
||||
0x6c, 0x65, 0x72, 0x30, 0x00, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65,
|
||||
0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20,
|
||||
0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61,
|
||||
0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72,
|
||||
0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e,
|
||||
0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
|
||||
0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00,
|
||||
0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00,
|
||||
0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00,
|
||||
0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f,
|
||||
0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54,
|
||||
0x61, 0x72, 0x67, 0x65, 0x74, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52,
|
||||
0x94, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00,
|
||||
0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00,
|
||||
0x45, 0x00, 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x38, 0x00, 0x00, 0x07, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54,
|
||||
0x74, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
extern unsigned char ImGui_vertexShaderDX12[] = {
|
||||
0x44, 0x58, 0x42, 0x43, 0xb6, 0xcc, 0x5b, 0x29, 0xde, 0xfb, 0x4d, 0x91,
|
||||
0x1f, 0x52, 0xbe, 0xc7, 0x8b, 0x0f, 0xbf, 0x5c, 0x01, 0x00, 0x00, 0x00,
|
||||
0xdc, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
|
||||
0x50, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x34, 0x02, 0x00, 0x00,
|
||||
0x40, 0x03, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x14, 0x01, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x3c, 0x00, 0x00, 0x00, 0x00, 0x05, 0xfe, 0xff, 0x00, 0x01, 0x00, 0x00,
|
||||
0xec, 0x00, 0x00, 0x00, 0x52, 0x44, 0x31, 0x31, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
|
||||
0x24, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x65, 0x72, 0x74,
|
||||
0x65, 0x78, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x00, 0xab, 0xab, 0xab,
|
||||
0x5c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00,
|
||||
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x72, 0x69, 0x78, 0x00, 0x66, 0x6c, 0x6f,
|
||||
0x61, 0x74, 0x34, 0x78, 0x34, 0x00, 0xab, 0xab, 0x03, 0x00, 0x03, 0x00,
|
||||
0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x4d, 0x69, 0x63, 0x72,
|
||||
0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c,
|
||||
0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f,
|
||||
0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00,
|
||||
0x49, 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x03, 0x03, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x0f, 0x0f, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||
0x03, 0x03, 0x00, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e,
|
||||
0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f,
|
||||
0x4f, 0x52, 0x44, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50,
|
||||
0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f,
|
||||
0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab,
|
||||
0x53, 0x48, 0x45, 0x58, 0x04, 0x01, 0x00, 0x00, 0x50, 0x00, 0x01, 0x00,
|
||||
0x41, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x04,
|
||||
0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
|
||||
0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||
0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x32, 0x20, 0x10, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00,
|
||||
0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x56, 0x15, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a,
|
||||
0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05,
|
||||
0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x32, 0x20, 0x10, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||
0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00,
|
||||
0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
extern unsigned char ImGui_pixelShaderDX12[] = {
|
||||
0x44, 0x58, 0x42, 0x43, 0x6f, 0xb8, 0xdd, 0xf9, 0xd9, 0x9a, 0x0d, 0xc8,
|
||||
0x46, 0x7a, 0x22, 0x5b, 0xd2, 0x49, 0x57, 0x3f, 0x01, 0x00, 0x00, 0x00,
|
||||
0xe0, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
|
||||
0xf4, 0x00, 0x00, 0x00, 0x68, 0x01, 0x00, 0x00, 0x9c, 0x01, 0x00, 0x00,
|
||||
0x44, 0x02, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xb8, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||
0x3c, 0x00, 0x00, 0x00, 0x00, 0x05, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00,
|
||||
0x8e, 0x00, 0x00, 0x00, 0x52, 0x44, 0x31, 0x31, 0x3c, 0x00, 0x00, 0x00,
|
||||
0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
|
||||
0x24, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x7c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x0d, 0x00, 0x00, 0x00, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x30,
|
||||
0x00, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x30, 0x00, 0x4d, 0x69,
|
||||
0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20,
|
||||
0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20,
|
||||
0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e,
|
||||
0x31, 0x00, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50,
|
||||
0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f,
|
||||
0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab,
|
||||
0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65,
|
||||
0x74, 0x00, 0xab, 0xab, 0x53, 0x48, 0x45, 0x58, 0xa0, 0x00, 0x00, 0x00,
|
||||
0x50, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01,
|
||||
0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00,
|
||||
0x45, 0x00, 0x00, 0x8b, 0xc2, 0x00, 0x00, 0x80, 0x43, 0x55, 0x15, 0x00,
|
||||
0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00,
|
||||
0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07,
|
||||
0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
#endif
|
||||
37
overlay_experimental/windows/ImGui_ShaderBlobs.h
Normal file
37
overlay_experimental/windows/ImGui_ShaderBlobs.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef __IMGUI_SHADER_BLOBS_INCLUDED__
|
||||
#define __IMGUI_SHADER_BLOBS_INCLUDED__
|
||||
|
||||
// Defining this will use d3dcompiler and it will be a dependence of the dll.
|
||||
//#define USE_D3DCOMPILE
|
||||
|
||||
#ifdef USE_D3DCOMPILE
|
||||
#include <d3dcompiler.h>
|
||||
//#ifdef _MSC_VER
|
||||
// #pragma comment(lib, "d3dcompiler") // Automatically link with d3dcompiler.lib as we are using D3DCompile() below.
|
||||
//#endif
|
||||
|
||||
decltype(D3DCompile)* load_d3dcompile();
|
||||
void unload_d3dcompile();
|
||||
#else
|
||||
|
||||
#define ImGui_vertexShaderDX10_len 876
|
||||
extern unsigned char ImGui_vertexShaderDX10[ImGui_vertexShaderDX10_len];
|
||||
|
||||
#define ImGui_pixelShaderDX10_len 660
|
||||
extern unsigned char ImGui_pixelShaderDX10[ImGui_pixelShaderDX10_len];
|
||||
|
||||
#define ImGui_vertexShaderDX11_len ImGui_vertexShaderDX10_len
|
||||
#define ImGui_vertexShaderDX11 ImGui_vertexShaderDX10
|
||||
|
||||
#define ImGui_pixelShaderDX11_len ImGui_pixelShaderDX10_len
|
||||
#define ImGui_pixelShaderDX11 ImGui_pixelShaderDX10
|
||||
|
||||
#define ImGui_vertexShaderDX12_len 988
|
||||
extern unsigned char ImGui_vertexShaderDX12[ImGui_vertexShaderDX12_len];
|
||||
|
||||
#define ImGui_pixelShaderDX12_len 736
|
||||
extern unsigned char ImGui_pixelShaderDX12[ImGui_pixelShaderDX12_len];
|
||||
|
||||
#endif
|
||||
|
||||
#endif//__IMGUI_SHADER_BLOBS_INCLUDED__
|
||||
148
overlay_experimental/windows/OpenGL_Hook.cpp
Normal file
148
overlay_experimental/windows/OpenGL_Hook.cpp
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
#include "OpenGL_Hook.h"
|
||||
#include "Windows_Hook.h"
|
||||
#include "Renderer_Detector.h"
|
||||
#include "../dll/dll.h"
|
||||
|
||||
#ifndef NO_OVERLAY
|
||||
|
||||
#include <imgui.h>
|
||||
#include <impls/imgui_impl_opengl3.h>
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#include "steam_overlay.h"
|
||||
|
||||
OpenGL_Hook* OpenGL_Hook::_inst = nullptr;
|
||||
|
||||
bool OpenGL_Hook::start_hook()
|
||||
{
|
||||
bool res = true;
|
||||
if (!hooked)
|
||||
{
|
||||
if (!Windows_Hook::Inst()->start_hook())
|
||||
return false;
|
||||
|
||||
GLenum err = glewInit();
|
||||
|
||||
if (err == GLEW_OK)
|
||||
{
|
||||
PRINT_DEBUG("Hooked OpenGL\n");
|
||||
|
||||
hooked = true;
|
||||
Renderer_Detector::Inst().renderer_found(this);
|
||||
|
||||
UnhookAll();
|
||||
BeginHook();
|
||||
HookFuncs(
|
||||
std::make_pair<void**, void*>(&(PVOID&)wglSwapBuffers, &OpenGL_Hook::MywglSwapBuffers)
|
||||
);
|
||||
EndHook();
|
||||
|
||||
get_steam_client()->steam_overlay->HookReady();
|
||||
}
|
||||
else
|
||||
{
|
||||
PRINT_DEBUG("Failed to hook OpenGL\n");
|
||||
/* Problem: glewInit failed, something is seriously wrong. */
|
||||
PRINT_DEBUG("Error: %s\n", glewGetErrorString(err));
|
||||
res = false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void OpenGL_Hook::resetRenderState()
|
||||
{
|
||||
if (initialized)
|
||||
{
|
||||
ImGui_ImplOpenGL3_Shutdown();
|
||||
Windows_Hook::Inst()->resetRenderState();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
initialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to make this function and overlay's proc as short as possible or it might affect game's fps.
|
||||
void OpenGL_Hook::prepareForOverlay(HDC hDC)
|
||||
{
|
||||
HWND hWnd = WindowFromDC(hDC);
|
||||
RECT rect;
|
||||
|
||||
GetClientRect(hWnd, &rect);
|
||||
|
||||
if (hWnd != Windows_Hook::Inst()->GetGameHwnd())
|
||||
resetRenderState();
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.IniFilename = NULL;
|
||||
|
||||
ImGui_ImplOpenGL3_Init();
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
ImGui_ImplOpenGL3_NewFrame();
|
||||
Windows_Hook::Inst()->prepareForOverlay(hWnd);
|
||||
|
||||
ImGui::NewFrame();
|
||||
|
||||
get_steam_client()->steam_overlay->OverlayProc(rect.right, rect.bottom);
|
||||
|
||||
ImGui::EndFrame();
|
||||
|
||||
ImGui::Render();
|
||||
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
}
|
||||
|
||||
BOOL WINAPI OpenGL_Hook::MywglSwapBuffers(HDC hDC)
|
||||
{
|
||||
OpenGL_Hook::Inst()->prepareForOverlay(hDC);
|
||||
return OpenGL_Hook::Inst()->wglSwapBuffers(hDC);
|
||||
}
|
||||
|
||||
OpenGL_Hook::OpenGL_Hook():
|
||||
initialized(false),
|
||||
hooked(false),
|
||||
wglSwapBuffers(nullptr)
|
||||
{
|
||||
_library = LoadLibrary(DLL_NAME);
|
||||
}
|
||||
|
||||
OpenGL_Hook::~OpenGL_Hook()
|
||||
{
|
||||
PRINT_DEBUG("OpenGL Hook removed\n");
|
||||
|
||||
if (initialized)
|
||||
{
|
||||
ImGui_ImplOpenGL3_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
}
|
||||
|
||||
FreeLibrary(reinterpret_cast<HMODULE>(_library));
|
||||
|
||||
_inst = nullptr;
|
||||
}
|
||||
|
||||
OpenGL_Hook* OpenGL_Hook::Inst()
|
||||
{
|
||||
if (_inst == nullptr)
|
||||
_inst = new OpenGL_Hook;
|
||||
|
||||
return _inst;
|
||||
}
|
||||
|
||||
const char* OpenGL_Hook::get_lib_name() const
|
||||
{
|
||||
return DLL_NAME;
|
||||
}
|
||||
|
||||
void OpenGL_Hook::loadFunctions(wglSwapBuffers_t pfnwglSwapBuffers)
|
||||
{
|
||||
wglSwapBuffers = pfnwglSwapBuffers;
|
||||
}
|
||||
|
||||
#endif//NO_OVERLAY
|
||||
42
overlay_experimental/windows/OpenGL_Hook.h
Normal file
42
overlay_experimental/windows/OpenGL_Hook.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef __INCLUDED_OPENGL_HOOK_H__
|
||||
#define __INCLUDED_OPENGL_HOOK_H__
|
||||
|
||||
#include "Base_Hook.h"
|
||||
#ifndef NO_OVERLAY
|
||||
|
||||
class OpenGL_Hook : public Base_Hook
|
||||
{
|
||||
public:
|
||||
static constexpr const char *DLL_NAME = "opengl32.dll";
|
||||
|
||||
using wglSwapBuffers_t = BOOL(WINAPI*)(HDC);
|
||||
|
||||
private:
|
||||
static OpenGL_Hook* _inst;
|
||||
|
||||
// Variables
|
||||
bool hooked;
|
||||
bool initialized;
|
||||
|
||||
// Functions
|
||||
OpenGL_Hook();
|
||||
|
||||
void resetRenderState();
|
||||
void prepareForOverlay(HDC hDC);
|
||||
|
||||
// Hook to render functions
|
||||
static BOOL WINAPI MywglSwapBuffers(HDC hDC);
|
||||
|
||||
wglSwapBuffers_t wglSwapBuffers;
|
||||
|
||||
public:
|
||||
virtual ~OpenGL_Hook();
|
||||
|
||||
bool start_hook();
|
||||
static OpenGL_Hook* Inst();
|
||||
virtual const char* get_lib_name() const;
|
||||
void loadFunctions(wglSwapBuffers_t pfnwglSwapBuffers);
|
||||
};
|
||||
|
||||
#endif//NO_OVERLAY
|
||||
#endif//__INCLUDED_OPENGL_HOOK_H__
|
||||
181
overlay_experimental/windows/Windows_Hook.cpp
Normal file
181
overlay_experimental/windows/Windows_Hook.cpp
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
#include "Windows_Hook.h"
|
||||
#include "Renderer_Detector.h"
|
||||
#include "../dll/dll.h"
|
||||
|
||||
#ifndef NO_OVERLAY
|
||||
|
||||
#include <imgui.h>
|
||||
#include <impls/imgui_impl_win32.h>
|
||||
|
||||
extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
Windows_Hook* Windows_Hook::_inst = nullptr;
|
||||
|
||||
bool Windows_Hook::start_hook()
|
||||
{
|
||||
bool res = true;
|
||||
if (!hooked)
|
||||
{
|
||||
GetRawInputBuffer = ::GetRawInputBuffer;
|
||||
GetRawInputData = ::GetRawInputData;
|
||||
|
||||
PRINT_DEBUG("Hooked Windows\n");
|
||||
|
||||
BeginHook();
|
||||
HookFuncs(
|
||||
std::make_pair<void**, void*>(&(PVOID&)GetRawInputBuffer, &Windows_Hook::MyGetRawInputBuffer),
|
||||
std::make_pair<void**, void*>(&(PVOID&)GetRawInputData , &Windows_Hook::MyGetRawInputData)
|
||||
);
|
||||
EndHook();
|
||||
|
||||
hooked = true;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void Windows_Hook::resetRenderState()
|
||||
{
|
||||
if (initialized)
|
||||
{
|
||||
initialized = false;
|
||||
SetWindowLongPtr(_game_hwnd, GWLP_WNDPROC, (LONG_PTR)_game_wndproc);
|
||||
_game_hwnd = nullptr;
|
||||
_game_wndproc = nullptr;
|
||||
ImGui_ImplWin32_Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
void Windows_Hook::prepareForOverlay(HWND hWnd)
|
||||
{
|
||||
if (!initialized)
|
||||
{
|
||||
ImGui_ImplWin32_Init(hWnd);
|
||||
|
||||
_game_hwnd = hWnd;
|
||||
_game_wndproc = (WNDPROC)SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)&Windows_Hook::HookWndProc);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
ImGui_ImplWin32_NewFrame();
|
||||
}
|
||||
|
||||
HWND Windows_Hook::GetGameHwnd() const
|
||||
{
|
||||
return _game_hwnd;
|
||||
}
|
||||
|
||||
WNDPROC Windows_Hook::GetGameWndProc() const
|
||||
{
|
||||
return _game_wndproc;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// Windows window hooks
|
||||
bool IgnoreMsg(UINT uMsg)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
// Mouse Events
|
||||
case WM_MOUSEMOVE:
|
||||
case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL:
|
||||
case WM_LBUTTONUP: case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK:
|
||||
case WM_RBUTTONUP: case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK:
|
||||
case WM_MBUTTONUP: case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK:
|
||||
case WM_XBUTTONUP: case WM_XBUTTONDOWN: case WM_XBUTTONDBLCLK:
|
||||
case WM_MOUSEACTIVATE: case WM_MOUSEHOVER: case WM_MOUSELEAVE:
|
||||
// Keyboard Events
|
||||
case WM_KEYDOWN: case WM_KEYUP:
|
||||
case WM_SYSKEYDOWN: case WM_SYSKEYUP: case WM_SYSDEADCHAR:
|
||||
case WM_CHAR: case WM_UNICHAR: case WM_DEADCHAR:
|
||||
// Raw Input Events
|
||||
case WM_INPUT:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK Windows_Hook::HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
Steam_Overlay* overlay = get_steam_client()->steam_overlay;
|
||||
bool show = overlay->ShowOverlay();
|
||||
// Is the event is a key press
|
||||
if (uMsg == WM_KEYDOWN)
|
||||
{
|
||||
// Tab is pressed and was not pressed before
|
||||
if (wParam == VK_TAB && !(lParam & (1 << 30)))
|
||||
{
|
||||
// If Left Shift is pressed
|
||||
if (GetAsyncKeyState(VK_LSHIFT) & (1 << 15))
|
||||
{
|
||||
overlay->ShowOverlay(!overlay->ShowOverlay());
|
||||
if (overlay->ShowOverlay())
|
||||
show = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (show)
|
||||
{
|
||||
ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam);
|
||||
if (IgnoreMsg(uMsg))
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Call the overlay window procedure
|
||||
return CallWindowProc(Windows_Hook::Inst()->_game_wndproc, hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
UINT WINAPI Windows_Hook::MyGetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader)
|
||||
{
|
||||
if (!get_steam_client()->steam_overlay->ShowOverlay())
|
||||
return Windows_Hook::Inst()->GetRawInputBuffer(pData, pcbSize, cbSizeHeader);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
UINT WINAPI Windows_Hook::MyGetRawInputData(HRAWINPUT hRawInput, UINT uiCommand, LPVOID pData, PUINT pcbSize, UINT cbSizeHeader)
|
||||
{
|
||||
if (!get_steam_client()->steam_overlay->ShowOverlay())
|
||||
return Windows_Hook::Inst()->GetRawInputData(hRawInput, uiCommand, pData, pcbSize, cbSizeHeader);
|
||||
|
||||
return -1;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Windows_Hook::Windows_Hook() :
|
||||
initialized(false),
|
||||
hooked(false),
|
||||
_game_hwnd(nullptr),
|
||||
_game_wndproc(nullptr),
|
||||
GetRawInputBuffer(nullptr),
|
||||
GetRawInputData(nullptr)
|
||||
{
|
||||
//_library = LoadLibrary(DLL_NAME);
|
||||
}
|
||||
|
||||
Windows_Hook::~Windows_Hook()
|
||||
{
|
||||
PRINT_DEBUG("Windows Hook removed\n");
|
||||
|
||||
resetRenderState();
|
||||
|
||||
//FreeLibrary(reinterpret_cast<HMODULE>(_library));
|
||||
|
||||
_inst = nullptr;
|
||||
}
|
||||
|
||||
Windows_Hook* Windows_Hook::Inst()
|
||||
{
|
||||
if (_inst == nullptr)
|
||||
_inst = new Windows_Hook;
|
||||
|
||||
return _inst;
|
||||
}
|
||||
|
||||
const char* Windows_Hook::get_lib_name() const
|
||||
{
|
||||
return DLL_NAME;
|
||||
}
|
||||
|
||||
#endif//NO_OVERLAY
|
||||
50
overlay_experimental/windows/Windows_Hook.h
Normal file
50
overlay_experimental/windows/Windows_Hook.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#ifndef __INCLUDED_WINDOWS_HOOK_H__
|
||||
#define __INCLUDED_WINDOWS_HOOK_H__
|
||||
|
||||
#include "../Base_Hook.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifndef NO_OVERLAY
|
||||
|
||||
class Windows_Hook : public Base_Hook
|
||||
{
|
||||
public:
|
||||
static constexpr const char* DLL_NAME = "user32.dll";
|
||||
|
||||
private:
|
||||
static Windows_Hook* _inst;
|
||||
|
||||
// Variables
|
||||
bool hooked;
|
||||
bool initialized;
|
||||
HWND _game_hwnd;
|
||||
WNDPROC _game_wndproc;
|
||||
|
||||
// Functions
|
||||
Windows_Hook();
|
||||
|
||||
// Hook to Windows window messages
|
||||
decltype(GetRawInputBuffer)* GetRawInputBuffer;
|
||||
decltype(GetRawInputData)* GetRawInputData;
|
||||
|
||||
static LRESULT CALLBACK HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static UINT WINAPI MyGetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader);
|
||||
static UINT WINAPI MyGetRawInputData(HRAWINPUT hRawInput, UINT uiCommand, LPVOID pData, PUINT pcbSize, UINT cbSizeHeader);
|
||||
|
||||
public:
|
||||
virtual ~Windows_Hook();
|
||||
|
||||
void resetRenderState();
|
||||
void prepareForOverlay(HWND);
|
||||
|
||||
HWND GetGameHwnd() const;
|
||||
WNDPROC GetGameWndProc() const;
|
||||
|
||||
bool start_hook();
|
||||
static Windows_Hook* Inst();
|
||||
virtual const char* get_lib_name() const;
|
||||
};
|
||||
|
||||
#endif//NO_OVERLAY
|
||||
#endif//__WINDOWS__
|
||||
#endif//__INCLUDED_WINDOWS_HOOK_H__
|
||||
Loading…
Add table
Add a link
Reference in a new issue