1
0
Fork 0
mirror of https://gitlab.com/Mr_Goldberg/goldberg_emulator.git synced 2024-11-14 10:50:13 +01:00
goldberg_emulator/overlay_experimental/Base_Hook.h

50 lines
984 B
C
Raw Normal View History

#ifndef __INCLUDED_BASE_HOOK_H__
#define __INCLUDED_BASE_HOOK_H__
#ifdef EMU_OVERLAY
2019-08-14 14:55:31 +02:00
#include <vector>
#include <utility>
2019-08-27 16:29:20 +02:00
#include "../dll/base.h"
class Base_Hook
{
protected:
std::vector<std::pair<void**, void*>> _hooked_funcs;
void* _library;
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:
2019-08-16 10:28:23 +02:00
Base_Hook();
virtual ~Base_Hook();
void BeginHook();
void EndHook();
void UnhookAll();
virtual const char* get_lib_name() const;
2019-08-01 17:04:49 +02:00
void HookFunc(std::pair<void**, void*> hook);
template<typename T>
void HookFuncs(std::pair<T*, T> funcs)
{
HookFunc(funcs);
}
template<typename T, typename ...Args>
void HookFuncs(std::pair<T*, T> funcs, Args... args)
{
2019-08-01 17:04:49 +02:00
HookFunc(funcs);
HookFuncs(args...);
}
};
#endif//EMU_OVERLAY
2019-08-14 14:55:31 +02:00
#endif//__INCLUDED_BASE_HOOK_H__