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