mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-06 12:14:54 +01:00
Update Nemirtingas overlay to latest.
This commit is contained in:
parent
df94c38b0f
commit
c17fb0c931
82 changed files with 48737 additions and 59872 deletions
|
|
@ -1,52 +1,80 @@
|
|||
#ifndef __INCLUDED_WINDOWS_HOOK_H__
|
||||
#define __INCLUDED_WINDOWS_HOOK_H__
|
||||
/*
|
||||
* Copyright (C) Nemirtingas
|
||||
* This file is part of the ingame overlay project
|
||||
*
|
||||
* The ingame overlay project is free software; you can redistribute it
|
||||
* and/or modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* The ingame overlay project is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with the ingame overlay project; if not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../Base_Hook.h"
|
||||
#pragma once
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef EMU_OVERLAY
|
||||
#include "../internal_includes.h"
|
||||
|
||||
class Windows_Hook : public Base_Hook
|
||||
class Windows_Hook :
|
||||
public Base_Hook
|
||||
{
|
||||
public:
|
||||
#define WINDOWS_DLL "user32.dll"
|
||||
static constexpr const char* DLL_NAME = "user32.dll";
|
||||
|
||||
private:
|
||||
static Windows_Hook* _inst;
|
||||
|
||||
// Variables
|
||||
bool hooked;
|
||||
bool initialized;
|
||||
HWND _game_hwnd;
|
||||
WNDPROC _game_wndproc;
|
||||
bool _Hooked;
|
||||
bool _Initialized;
|
||||
int _RecurseCallCount;
|
||||
HWND _GameHwnd;
|
||||
WNDPROC _GameWndProc;
|
||||
POINT _SavedCursorPos;
|
||||
|
||||
// Functions
|
||||
Windows_Hook();
|
||||
|
||||
// Hook to Windows window messages
|
||||
decltype(GetRawInputBuffer)* GetRawInputBuffer;
|
||||
decltype(GetRawInputData)* GetRawInputData;
|
||||
decltype(SetCursorPos)* SetCursorPos;
|
||||
decltype(::GetRawInputBuffer) *GetRawInputBuffer;
|
||||
decltype(::GetRawInputData) *GetRawInputData;
|
||||
decltype(::GetKeyState) *GetKeyState;
|
||||
decltype(::GetAsyncKeyState) *GetAsyncKeyState;
|
||||
decltype(::GetKeyboardState) *GetKeyboardState;
|
||||
decltype(::GetCursorPos) *GetCursorPos;
|
||||
decltype(::SetCursorPos) *SetCursorPos;
|
||||
|
||||
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);
|
||||
static UINT WINAPI MyGetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader);
|
||||
static UINT WINAPI MyGetRawInputData(HRAWINPUT hRawInput, UINT uiCommand, LPVOID pData, PUINT pcbSize, UINT cbSizeHeader);
|
||||
static SHORT WINAPI MyGetKeyState(int nVirtKey);
|
||||
static SHORT WINAPI MyGetAsyncKeyState(int vKey);
|
||||
static BOOL WINAPI MyGetKeyboardState(PBYTE lpKeyState);
|
||||
static BOOL WINAPI MyGetCursorPos(LPPOINT lpPoint);
|
||||
static BOOL WINAPI MySetCursorPos(int X, int Y);
|
||||
|
||||
// In (bool): Is toggle wanted
|
||||
// Out(bool): Is the overlay visible, if true, inputs will be disabled
|
||||
std::function<bool(bool)> _KeyCombinationCallback;
|
||||
|
||||
static BOOL WINAPI MySetCursorPos(int x, int y);
|
||||
public:
|
||||
std::string LibraryName;
|
||||
|
||||
virtual ~Windows_Hook();
|
||||
|
||||
void resetRenderState();
|
||||
void prepareForOverlay(HWND);
|
||||
void _ResetRenderState();
|
||||
bool _PrepareForOverlay(HWND hWnd);
|
||||
|
||||
HWND GetGameHwnd() const;
|
||||
WNDPROC GetGameWndProc() const;
|
||||
|
||||
bool start_hook();
|
||||
bool StartHook(std::function<bool(bool)>& key_combination_callback);
|
||||
static Windows_Hook* Inst();
|
||||
virtual const char* get_lib_name() const;
|
||||
virtual std::string GetLibraryName() const;
|
||||
};
|
||||
|
||||
#endif//EMU_OVERLAY
|
||||
#endif//__WINDOWS__
|
||||
#endif//__INCLUDED_WINDOWS_HOOK_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue