mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-05 11:44:53 +01:00
Added DirectX hooks
Warning: DX9 doesn't support resizing (TODO), DX12 has not beed tested and is not finished. No OpenGL support for now.
This commit is contained in:
parent
bb9c516775
commit
2ba8cae64e
13 changed files with 1656 additions and 0 deletions
43
overlay_experimental/Base_Hook.h
Normal file
43
overlay_experimental/Base_Hook.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#ifndef __INCLUDED_BASE_HOOK_H__
|
||||
#define __INCLUDED_BASE_HOOK_H__
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define VC_EXTRALEAN
|
||||
#include <Windows.h>
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
class Base_Hook
|
||||
{
|
||||
protected:
|
||||
std::vector<std::pair<void**, void*>> _hooked_funcs;
|
||||
|
||||
HMODULE _dll;
|
||||
bool _hooked;
|
||||
|
||||
Base_Hook(const Base_Hook&) = delete;
|
||||
Base_Hook(Base_Hook&&) = delete;
|
||||
Base_Hook& operator =(const Base_Hook&) = delete;
|
||||
Base_Hook& operator =(Base_Hook&&) = delete;
|
||||
|
||||
public:
|
||||
Base_Hook() {}
|
||||
virtual ~Base_Hook();
|
||||
|
||||
void BeginHook();
|
||||
void EndHook();
|
||||
void UnhookAll();
|
||||
|
||||
void HookFuncs(std::pair<void**, void*> hook);
|
||||
|
||||
template<typename T, typename ...Args>
|
||||
void HookFuncs(std::pair<T*, T> funcs, Args... args)
|
||||
{
|
||||
_hooked_funcs.emplace_back(std::move(funcs));
|
||||
HookFuncs(funcs);
|
||||
HookFuncs(args...);
|
||||
}
|
||||
};
|
||||
|
||||
#endif//__INCLUDED_BASE_HOOK_H__
|
||||
Loading…
Add table
Add a link
Reference in a new issue