mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
New method for IDetour
This will deprecate IDetour::Attach and IDetour::Detatch. This should reduce the chances of potential errors caused by using the wrong function in the wrong method (e.g. using DetourAttach in IDetour::Detatch).
This commit is contained in:
parent
fa2a005d34
commit
e0a60a14e5
12
src/thirdparty/detours/include/idetour.h
vendored
12
src/thirdparty/detours/include/idetour.h
vendored
@ -15,6 +15,18 @@ public:
|
||||
|
||||
virtual void Attach(void) const = 0;
|
||||
virtual void Detach(void) const = 0;
|
||||
|
||||
//virtual void Detour(const bool bAttach) const = 0;
|
||||
template<
|
||||
typename T,
|
||||
typename std::enable_if<DetoursIsFunctionPointer<T>::value, int>::type = 0>
|
||||
LONG Setup(_Inout_ T* ppPointer, _In_ T pDetour, const bool bAttach) const
|
||||
{
|
||||
if (bAttach)
|
||||
return DetourAttach(ppPointer, pDetour);
|
||||
else
|
||||
return DetourDetach(ppPointer, pDetour);
|
||||
}
|
||||
};
|
||||
|
||||
extern std::vector<IDetour*> g_DetourVec;
|
||||
|
2
src/thirdparty/detours/src/idetour.cpp
vendored
2
src/thirdparty/detours/src/idetour.cpp
vendored
@ -6,6 +6,8 @@
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
#include <unordered_set>
|
||||
#include <Windows.h>
|
||||
#include "../include/detours.h"
|
||||
#include "../include/idetour.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user