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

Fixed dual hook on last function call

This commit is contained in:
Nemirtingas 2019-08-01 17:04:49 +02:00
parent 890f19c20a
commit dda1e3210c
2 changed files with 9 additions and 4 deletions

View file

@ -34,7 +34,7 @@ void Base_Hook::UnhookAll()
}
}
void Base_Hook::HookFuncs(std::pair<void**, void*> hook)
void Base_Hook::HookFunc(std::pair<void**, void*> hook)
{
if( DetourAttach(hook.first, hook.second) == 0 )
_hooked_funcs.emplace_back(hook);

View file

@ -29,13 +29,18 @@ public:
void EndHook();
void UnhookAll();
void HookFuncs(std::pair<void**, void*> hook);
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)
{
_hooked_funcs.emplace_back(std::move(funcs));
HookFuncs(funcs);
HookFunc(funcs);
HookFuncs(args...);
}
};