2020-12-02 16:19:16 -05:00
|
|
|
#pragma once
|
2021-01-22 16:47:22 -05:00
|
|
|
#include "pch.h"
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2021-06-18 12:49:11 -04:00
|
|
|
using f_EndScene = HRESULT(CALLBACK*)(IDirect3DDevice9*);
|
|
|
|
using f_Present11 = HRESULT(CALLBACK*)(IDXGISwapChain*, UINT, UINT);
|
|
|
|
using f_Reset = HRESULT(CALLBACK*)(IDirect3DDevice9*, D3DPRESENT_PARAMETERS*);
|
2020-12-02 16:19:16 -05:00
|
|
|
|
|
|
|
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
|
|
|
|
|
|
class Hook
|
|
|
|
{
|
|
|
|
private:
|
2021-06-18 12:49:11 -04:00
|
|
|
inline static WNDPROC oWndProc;
|
|
|
|
inline static f_Present11 oPresent11;
|
|
|
|
inline static f_EndScene oEndScene;
|
|
|
|
inline static f_Reset oReset;
|
|
|
|
inline static bool m_bMouseVisibility;
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2021-04-22 16:51:40 -04:00
|
|
|
static void CALLBACK RenderFrame(void* ptr);
|
|
|
|
static HRESULT CALLBACK Dx9Handler(IDirect3DDevice9* pDevice);
|
|
|
|
static HRESULT CALLBACK Dx11Handler(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags);
|
2021-02-24 16:54:45 -05:00
|
|
|
static HRESULT CALLBACK Reset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters);
|
2021-06-18 12:49:11 -04:00
|
|
|
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
2021-01-11 13:07:10 -05:00
|
|
|
static void ShowMouse(bool state);
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2021-06-20 07:23:24 -04:00
|
|
|
public:
|
2021-06-18 12:49:11 -04:00
|
|
|
inline static bool m_bShowMouse = false;
|
|
|
|
inline static std::function<void()> window_callback = nullptr;
|
2021-06-20 07:23:24 -04:00
|
|
|
static void ApplyMouseFix();
|
|
|
|
|
2020-12-02 16:19:16 -05:00
|
|
|
Hook();
|
|
|
|
~Hook();
|
|
|
|
};
|