2019-08-18 14:22:07 +00:00
|
|
|
#ifndef __INCLUDED_WINDOWS_HOOK_H__
|
|
|
|
#define __INCLUDED_WINDOWS_HOOK_H__
|
|
|
|
|
2019-09-01 18:48:27 +00:00
|
|
|
#include "../Base_Hook.h"
|
2019-08-18 14:22:07 +00:00
|
|
|
|
2019-09-01 18:46:55 +00:00
|
|
|
#ifdef __WINDOWS__
|
2020-01-19 17:55:14 +00:00
|
|
|
#ifdef EMU_OVERLAY
|
2019-08-18 14:22:07 +00:00
|
|
|
|
|
|
|
class Windows_Hook : public Base_Hook
|
|
|
|
{
|
|
|
|
public:
|
2020-07-16 09:56:24 +00:00
|
|
|
#define WINDOWS_DLL "user32.dll"
|
2019-08-18 14:22:07 +00:00
|
|
|
|
|
|
|
private:
|
2019-08-27 13:38:07 +00:00
|
|
|
static Windows_Hook* _inst;
|
|
|
|
|
2019-08-18 14:22:07 +00:00
|
|
|
// Variables
|
2019-08-27 13:38:07 +00:00
|
|
|
bool hooked;
|
2019-08-18 14:22:07 +00:00
|
|
|
bool initialized;
|
|
|
|
HWND _game_hwnd;
|
|
|
|
WNDPROC _game_wndproc;
|
|
|
|
|
|
|
|
// Functions
|
|
|
|
Windows_Hook();
|
|
|
|
|
|
|
|
// Hook to Windows window messages
|
|
|
|
decltype(GetRawInputBuffer)* GetRawInputBuffer;
|
|
|
|
decltype(GetRawInputData)* GetRawInputData;
|
2021-02-07 03:38:51 +00:00
|
|
|
decltype(SetCursorPos)* SetCursorPos;
|
2019-08-18 14:22:07 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2021-02-07 03:38:51 +00:00
|
|
|
static BOOL WINAPI MySetCursorPos(int x, int y);
|
2019-08-18 14:22:07 +00:00
|
|
|
public:
|
2019-08-27 13:38:07 +00:00
|
|
|
virtual ~Windows_Hook();
|
|
|
|
|
2019-08-18 14:22:07 +00:00
|
|
|
void resetRenderState();
|
|
|
|
void prepareForOverlay(HWND);
|
|
|
|
|
|
|
|
HWND GetGameHwnd() const;
|
|
|
|
WNDPROC GetGameWndProc() const;
|
|
|
|
|
2019-08-27 13:38:07 +00:00
|
|
|
bool start_hook();
|
|
|
|
static Windows_Hook* Inst();
|
2019-08-26 14:38:01 +00:00
|
|
|
virtual const char* get_lib_name() const;
|
2019-08-18 14:22:07 +00:00
|
|
|
};
|
|
|
|
|
2020-01-19 17:55:14 +00:00
|
|
|
#endif//EMU_OVERLAY
|
2019-09-01 18:46:55 +00:00
|
|
|
#endif//__WINDOWS__
|
|
|
|
#endif//__INCLUDED_WINDOWS_HOOK_H__
|