mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-02-21 14:54:14 +01:00
Added IHookManagerAutoGen interface
--HG-- branch : hookman_autogen extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/branches/hookman_autogen%40555
This commit is contained in:
parent
f3f226444a
commit
92c795e830
@ -35,6 +35,11 @@
|
|||||||
// 1 - standard
|
// 1 - standard
|
||||||
#define SH_HOOKMAN_VERSION 1
|
#define SH_HOOKMAN_VERSION 1
|
||||||
|
|
||||||
|
// Hookmanautogen versions
|
||||||
|
// 1 - initial
|
||||||
|
#define SH_HOOKMANAUTOGEN_IFACE_VERSION 1
|
||||||
|
#define SH_HOOKMANAUTOGEN_IMPL_VERSION 1
|
||||||
|
|
||||||
// The value of SH_GLOB_SHPTR has to be a pointer to SourceHook::ISourceHook
|
// The value of SH_GLOB_SHPTR has to be a pointer to SourceHook::ISourceHook
|
||||||
// It's used in various macros
|
// It's used in various macros
|
||||||
#ifndef SH_GLOB_SHPTR
|
#ifndef SH_GLOB_SHPTR
|
||||||
@ -472,6 +477,17 @@ namespace SourceHook
|
|||||||
virtual void EndContext(IHookContext *pCtx) = 0;
|
virtual void EndContext(IHookContext *pCtx) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class IHookManagerAutoGen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual int GetIfaceVersion() = 0;
|
||||||
|
virtual int GetImplVersion() = 0;
|
||||||
|
|
||||||
|
virtual HookManagerPubFunc MakeHookMan(const ProtoInfo *proto, int vtbl_offs, int vtbl_idx) = 0;
|
||||||
|
virtual void ReleaseHookMan(HookManagerPubFunc pubFunc) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
// For META_RESULT_ORIG_RET and META_RESULT_OVERRIDE_RET:
|
// For META_RESULT_ORIG_RET and META_RESULT_OVERRIDE_RET:
|
||||||
// These have to be able to return references. If T is a reference, the pointers returned
|
// These have to be able to return references. If T is a reference, the pointers returned
|
||||||
// from the SH_GLOB_SHPTR are pointers to instances of ReferenceCarrier<T>::type.
|
// from the SH_GLOB_SHPTR are pointers to instances of ReferenceCarrier<T>::type.
|
||||||
|
@ -35,6 +35,11 @@
|
|||||||
// 1 - standard
|
// 1 - standard
|
||||||
#define SH_HOOKMAN_VERSION 1
|
#define SH_HOOKMAN_VERSION 1
|
||||||
|
|
||||||
|
// Hookmanautogen versions
|
||||||
|
// 1 - initial
|
||||||
|
#define SH_HOOKMANAUTOGEN_IFACE_VERSION 1
|
||||||
|
#define SH_HOOKMANAUTOGEN_IMPL_VERSION 1
|
||||||
|
|
||||||
// The value of SH_GLOB_SHPTR has to be a pointer to SourceHook::ISourceHook
|
// The value of SH_GLOB_SHPTR has to be a pointer to SourceHook::ISourceHook
|
||||||
// It's used in various macros
|
// It's used in various macros
|
||||||
#ifndef SH_GLOB_SHPTR
|
#ifndef SH_GLOB_SHPTR
|
||||||
@ -472,6 +477,17 @@ namespace SourceHook
|
|||||||
virtual void EndContext(IHookContext *pCtx) = 0;
|
virtual void EndContext(IHookContext *pCtx) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class IHookManagerAutoGen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual int GetIfaceVersion() = 0;
|
||||||
|
virtual int GetImplVersion() = 0;
|
||||||
|
|
||||||
|
virtual HookManagerPubFunc MakeHookMan(const ProtoInfo *proto, int vtbl_offs, int vtbl_idx) = 0;
|
||||||
|
virtual void ReleaseHookMan(HookManagerPubFunc pubFunc) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
// For META_RESULT_ORIG_RET and META_RESULT_OVERRIDE_RET:
|
// For META_RESULT_ORIG_RET and META_RESULT_OVERRIDE_RET:
|
||||||
// These have to be able to return references. If T is a reference, the pointers returned
|
// These have to be able to return references. If T is a reference, the pointers returned
|
||||||
// from the SH_GLOB_SHPTR are pointers to instances of ReferenceCarrier<T>::type.
|
// from the SH_GLOB_SHPTR are pointers to instances of ReferenceCarrier<T>::type.
|
||||||
|
@ -151,6 +151,25 @@ namespace SourceHook
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CProto::ExactlyEqual(const CProto &other) const
|
||||||
|
{
|
||||||
|
if (m_Version != other.m_Version ||
|
||||||
|
m_NumOfParams != other.m_NumOfParams ||
|
||||||
|
m_Convention != other.m_Convention ||
|
||||||
|
GetRet() != other.GetRet())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < m_NumOfParams; ++i)
|
||||||
|
{
|
||||||
|
if(GetParam(i) != other.GetParam(i))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// CHookManager
|
// CHookManager
|
||||||
|
@ -35,6 +35,11 @@
|
|||||||
// 1 - standard
|
// 1 - standard
|
||||||
#define SH_HOOKMAN_VERSION 1
|
#define SH_HOOKMAN_VERSION 1
|
||||||
|
|
||||||
|
// Hookmanautogen versions
|
||||||
|
// 1 - initial
|
||||||
|
#define SH_HOOKMANAUTOGEN_IFACE_VERSION 1
|
||||||
|
#define SH_HOOKMANAUTOGEN_IMPL_VERSION 1
|
||||||
|
|
||||||
// The value of SH_GLOB_SHPTR has to be a pointer to SourceHook::ISourceHook
|
// The value of SH_GLOB_SHPTR has to be a pointer to SourceHook::ISourceHook
|
||||||
// It's used in various macros
|
// It's used in various macros
|
||||||
#ifndef SH_GLOB_SHPTR
|
#ifndef SH_GLOB_SHPTR
|
||||||
@ -472,6 +477,17 @@ namespace SourceHook
|
|||||||
virtual void EndContext(IHookContext *pCtx) = 0;
|
virtual void EndContext(IHookContext *pCtx) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class IHookManagerAutoGen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual int GetIfaceVersion() = 0;
|
||||||
|
virtual int GetImplVersion() = 0;
|
||||||
|
|
||||||
|
virtual HookManagerPubFunc MakeHookMan(const ProtoInfo *proto, int vtbl_offs, int vtbl_idx) = 0;
|
||||||
|
virtual void ReleaseHookMan(HookManagerPubFunc pubFunc) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
// For META_RESULT_ORIG_RET and META_RESULT_OVERRIDE_RET:
|
// For META_RESULT_ORIG_RET and META_RESULT_OVERRIDE_RET:
|
||||||
// These have to be able to return references. If T is a reference, the pointers returned
|
// These have to be able to return references. If T is a reference, the pointers returned
|
||||||
// from the SH_GLOB_SHPTR are pointers to instances of ReferenceCarrier<T>::type.
|
// from the SH_GLOB_SHPTR are pointers to instances of ReferenceCarrier<T>::type.
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
// http://www.angelcode.com/dev/callconv/callconv.html
|
// http://www.angelcode.com/dev/callconv/callconv.html
|
||||||
// http://www.arl.wustl.edu/~lockwood/class/cs306/books/artofasm/Chapter_6/CH06-1.html
|
// http://www.arl.wustl.edu/~lockwood/class/cs306/books/artofasm/Chapter_6/CH06-1.html
|
||||||
|
|
||||||
|
#include "sourcehook_impl.h"
|
||||||
#include "sourcehook_hookmangen.h"
|
#include "sourcehook_hookmangen.h"
|
||||||
#include "sourcehook_hookmangen_x86.h"
|
#include "sourcehook_hookmangen_x86.h"
|
||||||
#include "sh_memory.h"
|
#include "sh_memory.h"
|
||||||
@ -47,7 +48,7 @@ namespace SourceHook
|
|||||||
}
|
}
|
||||||
|
|
||||||
GenContext::GenContext(const ProtoInfo *proto, int vtbl_offs, int vtbl_idx, ISourceHook *pSHPtr)
|
GenContext::GenContext(const ProtoInfo *proto, int vtbl_offs, int vtbl_idx, ISourceHook *pSHPtr)
|
||||||
: m_Proto(proto), m_VtblOffs(vtbl_offs), m_VtblIdx(vtbl_idx), m_SHPtr(pSHPtr),
|
: m_GeneratedPubFunc(NULL), m_Proto(proto), m_VtblOffs(vtbl_offs), m_VtblIdx(vtbl_idx), m_SHPtr(pSHPtr),
|
||||||
m_pHI(NULL), m_HookfuncVfnptr(NULL), m_RegCounter(0)
|
m_pHI(NULL), m_HookfuncVfnptr(NULL), m_RegCounter(0)
|
||||||
{
|
{
|
||||||
m_pHI = new void*;
|
m_pHI = new void*;
|
||||||
@ -1652,5 +1653,91 @@ namespace SourceHook
|
|||||||
GenerateHookFunc();
|
GenerateHookFunc();
|
||||||
return fastdelegate::detail::horrible_cast<HookManagerPubFunc>(GeneratePubFunc());
|
return fastdelegate::detail::horrible_cast<HookManagerPubFunc>(GeneratePubFunc());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HookManagerPubFunc GenContext::GetPubFunc()
|
||||||
|
{
|
||||||
|
if (m_GeneratedPubFunc == 0)
|
||||||
|
m_GeneratedPubFunc = Generate();
|
||||||
|
|
||||||
|
return m_GeneratedPubFunc;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GenContext::Equal(const CProto &proto, int vtbl_offs, int vtbl_idx)
|
||||||
|
{
|
||||||
|
return (m_Proto.ExactlyEqual(proto) && m_VtblOffs == vtbl_offs && m_VtblIdx == vtbl_idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GenContext::Equal(HookManagerPubFunc other)
|
||||||
|
{
|
||||||
|
return m_GeneratedPubFunc == other;
|
||||||
|
}
|
||||||
|
|
||||||
|
// *********************************** class GenContextContainer
|
||||||
|
CHookManagerAutoGen::CHookManagerAutoGen(ISourceHook *pSHPtr) : m_pSHPtr(pSHPtr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CHookManagerAutoGen::~CHookManagerAutoGen()
|
||||||
|
{
|
||||||
|
for (List<StoredContext>::iterator iter = m_Contexts.begin(); iter != m_Contexts.end(); ++iter)
|
||||||
|
{
|
||||||
|
delete iter->m_GenContext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int CHookManagerAutoGen::GetIfaceVersion()
|
||||||
|
{
|
||||||
|
return SH_HOOKMANAUTOGEN_IFACE_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CHookManagerAutoGen::GetImplVersion()
|
||||||
|
{
|
||||||
|
return SH_HOOKMANAUTOGEN_IMPL_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
HookManagerPubFunc CHookManagerAutoGen::MakeHookMan(const ProtoInfo *proto, int vtbl_offs, int vtbl_idx)
|
||||||
|
{
|
||||||
|
CProto mproto(proto);
|
||||||
|
for (List<StoredContext>::iterator iter = m_Contexts.begin(); iter != m_Contexts.end(); ++iter)
|
||||||
|
{
|
||||||
|
if (iter->m_GenContext->Equal(mproto, vtbl_offs, vtbl_idx))
|
||||||
|
{
|
||||||
|
iter->m_RefCnt++;
|
||||||
|
return iter->m_GenContext->GetPubFunc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not found yet -> new one
|
||||||
|
StoredContext sctx;
|
||||||
|
sctx.m_RefCnt = 1;
|
||||||
|
sctx.m_GenContext = new GenContext(proto, vtbl_offs, vtbl_idx, m_pSHPtr);
|
||||||
|
|
||||||
|
if (sctx.m_GenContext->GetPubFunc() == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_Contexts.push_back(sctx);
|
||||||
|
return sctx.m_GenContext->GetPubFunc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CHookManagerAutoGen::ReleaseHookMan(HookManagerPubFunc pubFunc)
|
||||||
|
{
|
||||||
|
for (List<StoredContext>::iterator iter = m_Contexts.begin(); iter != m_Contexts.end(); ++iter)
|
||||||
|
{
|
||||||
|
if (iter->m_GenContext->Equal(pubFunc))
|
||||||
|
{
|
||||||
|
iter->m_RefCnt--;
|
||||||
|
if (iter->m_RefCnt == 0)
|
||||||
|
{
|
||||||
|
delete iter->m_GenContext;
|
||||||
|
m_Contexts.erase(iter);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#ifndef __SOURCEHOOK_HOOKMANGEN_H__
|
#ifndef __SOURCEHOOK_HOOKMANGEN_H__
|
||||||
#define __SOURCEHOOK_HOOKMANGEN_H__
|
#define __SOURCEHOOK_HOOKMANGEN_H__
|
||||||
|
|
||||||
#include "sourcehook_impl.h"
|
|
||||||
#include "sh_pagealloc.h"
|
#include "sh_pagealloc.h"
|
||||||
|
|
||||||
namespace SourceHook
|
namespace SourceHook
|
||||||
@ -158,6 +157,8 @@ namespace SourceHook
|
|||||||
const static int SIZE_PTR = sizeof(void*);
|
const static int SIZE_PTR = sizeof(void*);
|
||||||
const static int PassFlag_ForcedByRef = (1<<30); // ByVal in source, but actually passed by reference (GCC) -> private pass, destruct
|
const static int PassFlag_ForcedByRef = (1<<30); // ByVal in source, but actually passed by reference (GCC) -> private pass, destruct
|
||||||
|
|
||||||
|
HookManagerPubFunc m_GeneratedPubFunc;
|
||||||
|
|
||||||
CProto m_Proto;
|
CProto m_Proto;
|
||||||
int m_VtblOffs;
|
int m_VtblOffs;
|
||||||
int m_VtblIdx;
|
int m_VtblIdx;
|
||||||
@ -231,13 +232,40 @@ namespace SourceHook
|
|||||||
void BuildProtoInfo();
|
void BuildProtoInfo();
|
||||||
void *GenerateHookFunc();
|
void *GenerateHookFunc();
|
||||||
void *GeneratePubFunc();
|
void *GeneratePubFunc();
|
||||||
|
|
||||||
|
HookManagerPubFunc Generate();
|
||||||
public:
|
public:
|
||||||
// Level 1 -> Public interface
|
// Level 1 -> Public interface
|
||||||
GenContext(const ProtoInfo *proto, int vtbl_offs, int vtbl_idx, ISourceHook *pSHPtr);
|
GenContext(const ProtoInfo *proto, int vtbl_offs, int vtbl_idx, ISourceHook *pSHPtr);
|
||||||
~GenContext();
|
~GenContext();
|
||||||
|
|
||||||
HookManagerPubFunc Generate();
|
bool Equal(const CProto &proto, int vtbl_offs, int vtbl_idx);
|
||||||
|
bool Equal(HookManagerPubFunc other);
|
||||||
|
|
||||||
|
HookManagerPubFunc GetPubFunc();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CHookManagerAutoGen : public IHookManagerAutoGen
|
||||||
|
{
|
||||||
|
struct StoredContext
|
||||||
|
{
|
||||||
|
int m_RefCnt;
|
||||||
|
GenContext *m_GenContext;
|
||||||
|
};
|
||||||
|
List<StoredContext> m_Contexts;
|
||||||
|
ISourceHook *m_pSHPtr;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CHookManagerAutoGen(ISourceHook *pSHPtr);
|
||||||
|
~CHookManagerAutoGen();
|
||||||
|
|
||||||
|
int GetIfaceVersion();
|
||||||
|
int GetImplVersion();
|
||||||
|
|
||||||
|
HookManagerPubFunc MakeHookMan(const ProtoInfo *proto, int vtbl_offs, int vtbl_idx);
|
||||||
|
void ReleaseHookMan(HookManagerPubFunc pubFunc);
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,21 @@ namespace SourceHook
|
|||||||
void *pCopyCtor;
|
void *pCopyCtor;
|
||||||
void *pDtor;
|
void *pDtor;
|
||||||
void *pAssignOperator;
|
void *pAssignOperator;
|
||||||
|
|
||||||
|
bool operator == (const IntPassInfo &other) const
|
||||||
|
{
|
||||||
|
return size == other.size
|
||||||
|
&& type == other.type
|
||||||
|
&& flags == other.flags
|
||||||
|
&& pNormalCtor == other.pNormalCtor
|
||||||
|
&& pDtor == other.pDtor
|
||||||
|
&& pAssignOperator == other.pAssignOperator;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator != (const IntPassInfo &other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CProto
|
class CProto
|
||||||
@ -72,6 +87,8 @@ namespace SourceHook
|
|||||||
|
|
||||||
bool operator == (const CProto &other) const;
|
bool operator == (const CProto &other) const;
|
||||||
|
|
||||||
|
bool ExactlyEqual(const CProto &other) const;
|
||||||
|
|
||||||
int GetVersion() const
|
int GetVersion() const
|
||||||
{
|
{
|
||||||
return m_Version;
|
return m_Version;
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "sourcehook_impl.h"
|
#include "sourcehook_impl.h"
|
||||||
#include "sourcehook.h"
|
#include "sourcehook.h"
|
||||||
|
#include "sourcehook_hookmangen.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
bool g_Verbose;
|
bool g_Verbose;
|
||||||
@ -111,3 +112,14 @@ void Test_UnpausePlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug)
|
|||||||
{
|
{
|
||||||
static_cast<SourceHook::Impl::CSourceHookImpl *>(shptr)->UnpausePlugin(plug);
|
static_cast<SourceHook::Impl::CSourceHookImpl *>(shptr)->UnpausePlugin(plug);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SourceHook::IHookManagerAutoGen *Test_HMAG_Factory(SourceHook::ISourceHook *shptr)
|
||||||
|
{
|
||||||
|
return new SourceHook::Impl::CHookManagerAutoGen(shptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Test_HMAG_Delete(SourceHook::IHookManagerAutoGen *ptr)
|
||||||
|
{
|
||||||
|
delete static_cast<SourceHook::Impl::CHookManagerAutoGen*>(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -34,3 +34,16 @@ void Test_CompleteShutdown(SourceHook::ISourceHook *shptr);
|
|||||||
void Test_UnloadPlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug);
|
void Test_UnloadPlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug);
|
||||||
void Test_PausePlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug);
|
void Test_PausePlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug);
|
||||||
void Test_UnpausePlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug);
|
void Test_UnpausePlugin(SourceHook::ISourceHook *shptr, SourceHook::Plugin plug);
|
||||||
|
|
||||||
|
SourceHook::IHookManagerAutoGen *Test_HMAG_Factory(SourceHook::ISourceHook *pSHPtr);
|
||||||
|
void Test_HMAG_Delete(SourceHook::IHookManagerAutoGen *ptr);
|
||||||
|
|
||||||
|
struct CHMAGAutoDestruction
|
||||||
|
{
|
||||||
|
SourceHook::IHookManagerAutoGen *m_Ptr;
|
||||||
|
CHMAGAutoDestruction(SourceHook::IHookManagerAutoGen *ptr) : m_Ptr(ptr) {}
|
||||||
|
~CHMAGAutoDestruction() { Test_HMAG_Delete(m_Ptr); }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define GET_HMAG(var, shptr) var = Test_HMAG_Factory(shptr); CHMAGAutoDestruction __hmagautodestruction(var);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#include "sourcehook.h"
|
#include "sourcehook.h"
|
||||||
#include "sourcehook_test.h"
|
#include "sourcehook_test.h"
|
||||||
#include "testevents.h"
|
#include "testevents.h"
|
||||||
#include "sourcehook_hookmangen.h"
|
|
||||||
#include "sh_memory.h"
|
#include "sh_memory.h"
|
||||||
#include "sh_pagealloc.h"
|
#include "sh_pagealloc.h"
|
||||||
|
|
||||||
@ -23,6 +22,8 @@ namespace
|
|||||||
SourceHook::ISourceHook *g_SHPtr;
|
SourceHook::ISourceHook *g_SHPtr;
|
||||||
SourceHook::Plugin g_PLID;
|
SourceHook::Plugin g_PLID;
|
||||||
|
|
||||||
|
SourceHook::IHookManagerAutoGen *g_HMAGPtr;
|
||||||
|
|
||||||
// PtrBuf(ptr) gives ptrs unique numbers
|
// PtrBuf(ptr) gives ptrs unique numbers
|
||||||
// in the order they appear
|
// in the order they appear
|
||||||
SourceHook::List<const void*> g_PtrHash;
|
SourceHook::List<const void*> g_PtrHash;
|
||||||
@ -254,7 +255,6 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// MyDelegate base class for other delegates
|
// MyDelegate base class for other delegates
|
||||||
class MyDelegate : public SourceHook::ISHDelegate
|
class MyDelegate : public SourceHook::ISHDelegate
|
||||||
{
|
{
|
||||||
@ -415,6 +415,7 @@ namespace
|
|||||||
bool TestHookManGen(std::string &error)
|
bool TestHookManGen(std::string &error)
|
||||||
{
|
{
|
||||||
GET_SHPTR(g_SHPtr);
|
GET_SHPTR(g_SHPtr);
|
||||||
|
GET_HMAG(g_HMAGPtr, g_SHPtr);
|
||||||
g_PLID = 1337;
|
g_PLID = 1337;
|
||||||
|
|
||||||
// 5 Global constructors (g_O111_*)
|
// 5 Global constructors (g_O111_*)
|
||||||
@ -463,9 +464,8 @@ bool TestHookManGen(std::string &error)
|
|||||||
NULL), "Test11 Part0");
|
NULL), "Test11 Part0");
|
||||||
|
|
||||||
setuppi_11();
|
setuppi_11();
|
||||||
g_Genc11 = new SourceHook::Impl::GenContext(&protoinfo_11, 0, 0, g_SHPtr);
|
SourceHook::HookManagerPubFunc myhookman11 = g_HMAGPtr->MakeHookMan(&protoinfo_11, 0, 0); \
|
||||||
g_Genc_ad11.set(g_Genc11);
|
CAutoReleaseHookMan arhm_11(myhookman11); \
|
||||||
SourceHook::HookManagerPubFunc myhookman11 = g_Genc11->Generate();
|
|
||||||
int hook1_11, hook2_11, hook3_11, hook4_11;
|
int hook1_11, hook2_11, hook3_11, hook4_11;
|
||||||
|
|
||||||
TestClass11 *pTest11 = new TestClass11;
|
TestClass11 *pTest11 = new TestClass11;
|
||||||
@ -630,9 +630,8 @@ bool TestHookManGen(std::string &error)
|
|||||||
setuppi_110();
|
setuppi_110();
|
||||||
setupri_110();
|
setupri_110();
|
||||||
|
|
||||||
g_Genc110 = new SourceHook::Impl::GenContext(&protoinfo_110, 0, 0, g_SHPtr);
|
SourceHook::HookManagerPubFunc myhookman110 = g_HMAGPtr->MakeHookMan(&protoinfo_110, 0, 0); \
|
||||||
g_Genc_ad110.set(g_Genc110);
|
CAutoReleaseHookMan arhm_110(myhookman110); \
|
||||||
SourceHook::HookManagerPubFunc myhookman110 = g_Genc110->Generate();
|
|
||||||
int hook1_110, hook2_110, hook3_110, hook4_110;
|
int hook1_110, hook2_110, hook3_110, hook4_110;
|
||||||
|
|
||||||
TestClass110 *pTest110 = new TestClass110;
|
TestClass110 *pTest110 = new TestClass110;
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
struct CAutoReleaseHookMan
|
||||||
|
{
|
||||||
|
SourceHook::HookManagerPubFunc m_Ptr;
|
||||||
|
CAutoReleaseHookMan(SourceHook::HookManagerPubFunc ptr) : m_Ptr(ptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
~CAutoReleaseHookMan()
|
||||||
|
{
|
||||||
|
g_HMAGPtr->ReleaseHookMan(m_Ptr);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Strip &
|
// Strip &
|
||||||
template <class T> struct StripRef
|
template <class T> struct StripRef
|
||||||
{
|
{
|
||||||
@ -520,9 +532,6 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
SourceHook::PassInfo::V2Info paraminfos2_##id[0+1]; \
|
SourceHook::PassInfo::V2Info paraminfos2_##id[0+1]; \
|
||||||
SourceHook::ProtoInfo protoinfo_##id = { 0, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { 0, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
|
|
||||||
#define THGM_MAKE_TEST0(id, ret_type) \
|
#define THGM_MAKE_TEST0(id, ret_type) \
|
||||||
@ -621,8 +630,7 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
SourceHook::ProtoInfo protoinfo_##id = { 0, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { 0, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
\
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
CAutoReleaseHookMan g_Genc_ad##id(NULL);
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
#define THGM_SETUP_PI0(id) \
|
#define THGM_SETUP_PI0(id) \
|
||||||
void setuppi_##id() \
|
void setuppi_##id() \
|
||||||
@ -731,9 +739,6 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
SourceHook::PassInfo::V2Info paraminfos2_##id[1+1]; \
|
SourceHook::PassInfo::V2Info paraminfos2_##id[1+1]; \
|
||||||
SourceHook::ProtoInfo protoinfo_##id = { 1, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { 1, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
|
|
||||||
#define THGM_MAKE_TEST1(id, ret_type, param1) \
|
#define THGM_MAKE_TEST1(id, ret_type, param1) \
|
||||||
@ -832,8 +837,7 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
SourceHook::ProtoInfo protoinfo_##id = { 1, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { 1, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
\
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
CAutoReleaseHookMan g_Genc_ad##id(NULL);
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
#define THGM_SETUP_PI1(id, p1_type, p1_passtype, p1_flags) \
|
#define THGM_SETUP_PI1(id, p1_type, p1_passtype, p1_flags) \
|
||||||
void setuppi_##id() \
|
void setuppi_##id() \
|
||||||
@ -942,9 +946,6 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
SourceHook::PassInfo::V2Info paraminfos2_##id[2+1]; \
|
SourceHook::PassInfo::V2Info paraminfos2_##id[2+1]; \
|
||||||
SourceHook::ProtoInfo protoinfo_##id = { 2, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { 2, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
|
|
||||||
#define THGM_MAKE_TEST2(id, ret_type, param1, param2) \
|
#define THGM_MAKE_TEST2(id, ret_type, param1, param2) \
|
||||||
@ -1043,8 +1044,7 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
SourceHook::ProtoInfo protoinfo_##id = { 2, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { 2, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
\
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
CAutoReleaseHookMan g_Genc_ad##id(NULL);
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
#define THGM_SETUP_PI2(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags) \
|
#define THGM_SETUP_PI2(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags) \
|
||||||
void setuppi_##id() \
|
void setuppi_##id() \
|
||||||
@ -1153,9 +1153,6 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
SourceHook::PassInfo::V2Info paraminfos2_##id[3+1]; \
|
SourceHook::PassInfo::V2Info paraminfos2_##id[3+1]; \
|
||||||
SourceHook::ProtoInfo protoinfo_##id = { 3, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { 3, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
|
|
||||||
#define THGM_MAKE_TEST3(id, ret_type, param1, param2, param3) \
|
#define THGM_MAKE_TEST3(id, ret_type, param1, param2, param3) \
|
||||||
@ -1254,8 +1251,7 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
SourceHook::ProtoInfo protoinfo_##id = { 3, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { 3, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
\
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
CAutoReleaseHookMan g_Genc_ad##id(NULL);
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
#define THGM_SETUP_PI3(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags) \
|
#define THGM_SETUP_PI3(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags) \
|
||||||
void setuppi_##id() \
|
void setuppi_##id() \
|
||||||
@ -1364,9 +1360,6 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
SourceHook::PassInfo::V2Info paraminfos2_##id[4+1]; \
|
SourceHook::PassInfo::V2Info paraminfos2_##id[4+1]; \
|
||||||
SourceHook::ProtoInfo protoinfo_##id = { 4, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { 4, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
|
|
||||||
#define THGM_MAKE_TEST4(id, ret_type, param1, param2, param3, param4) \
|
#define THGM_MAKE_TEST4(id, ret_type, param1, param2, param3, param4) \
|
||||||
@ -1465,8 +1458,7 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
SourceHook::ProtoInfo protoinfo_##id = { 4, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { 4, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
\
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
CAutoReleaseHookMan g_Genc_ad##id(NULL);
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
#define THGM_SETUP_PI4(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags, p4_type, p4_passtype, p4_flags) \
|
#define THGM_SETUP_PI4(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags, p4_type, p4_passtype, p4_flags) \
|
||||||
void setuppi_##id() \
|
void setuppi_##id() \
|
||||||
@ -1575,9 +1567,6 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
SourceHook::PassInfo::V2Info paraminfos2_##id[5+1]; \
|
SourceHook::PassInfo::V2Info paraminfos2_##id[5+1]; \
|
||||||
SourceHook::ProtoInfo protoinfo_##id = { 5, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { 5, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
|
|
||||||
#define THGM_MAKE_TEST5(id, ret_type, param1, param2, param3, param4, param5) \
|
#define THGM_MAKE_TEST5(id, ret_type, param1, param2, param3, param4, param5) \
|
||||||
@ -1676,8 +1665,7 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
SourceHook::ProtoInfo protoinfo_##id = { 5, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { 5, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
\
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
CAutoReleaseHookMan g_Genc_ad##id(NULL);
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
#define THGM_SETUP_PI5(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags, p4_type, p4_passtype, p4_flags, p5_type, p5_passtype, p5_flags) \
|
#define THGM_SETUP_PI5(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags, p4_type, p4_passtype, p4_flags, p5_type, p5_passtype, p5_flags) \
|
||||||
void setuppi_##id() \
|
void setuppi_##id() \
|
||||||
@ -1786,9 +1774,6 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
SourceHook::PassInfo::V2Info paraminfos2_##id[6+1]; \
|
SourceHook::PassInfo::V2Info paraminfos2_##id[6+1]; \
|
||||||
SourceHook::ProtoInfo protoinfo_##id = { 6, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { 6, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
|
|
||||||
#define THGM_MAKE_TEST6(id, ret_type, param1, param2, param3, param4, param5, param6) \
|
#define THGM_MAKE_TEST6(id, ret_type, param1, param2, param3, param4, param5, param6) \
|
||||||
@ -1887,8 +1872,7 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
SourceHook::ProtoInfo protoinfo_##id = { 6, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { 6, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
\
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
CAutoReleaseHookMan g_Genc_ad##id(NULL);
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
#define THGM_SETUP_PI6(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags, p4_type, p4_passtype, p4_flags, p5_type, p5_passtype, p5_flags, p6_type, p6_passtype, p6_flags) \
|
#define THGM_SETUP_PI6(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags, p4_type, p4_passtype, p4_flags, p5_type, p5_passtype, p5_flags, p6_type, p6_passtype, p6_flags) \
|
||||||
void setuppi_##id() \
|
void setuppi_##id() \
|
||||||
@ -1931,9 +1915,8 @@ std::ostream& operator <<(std::ostream &os,const ParamState6<0, p1, p2, p3, p4,
|
|||||||
|
|
||||||
#define THGM_DO_TEST_void(id, call_params) \
|
#define THGM_DO_TEST_void(id, call_params) \
|
||||||
setuppi_##id(); \
|
setuppi_##id(); \
|
||||||
g_Genc##id = new SourceHook::Impl::GenContext(&protoinfo_##id, 0, 0, g_SHPtr); \
|
SourceHook::HookManagerPubFunc myhookman##id = g_HMAGPtr->MakeHookMan(&protoinfo_##id, 0, 0); \
|
||||||
g_Genc_ad##id.set(g_Genc##id); \
|
CAutoReleaseHookMan arhm_##id(myhookman##id); \
|
||||||
SourceHook::HookManagerPubFunc myhookman##id = g_Genc##id->Generate(); \
|
|
||||||
int hook1_##id, hook2_##id, hook3_##id, hook4_##id; \
|
int hook1_##id, hook2_##id, hook3_##id, hook4_##id; \
|
||||||
\
|
\
|
||||||
TestClass##id::ms_DoRecall = false; \
|
TestClass##id::ms_DoRecall = false; \
|
||||||
@ -2050,9 +2033,8 @@ T* ComparableRef(T& x)
|
|||||||
#define THGM_DO_TEST(id, call_params) \
|
#define THGM_DO_TEST(id, call_params) \
|
||||||
setuppi_##id(); \
|
setuppi_##id(); \
|
||||||
setupri_##id(); \
|
setupri_##id(); \
|
||||||
g_Genc##id = new SourceHook::Impl::GenContext(&protoinfo_##id, 0, 0, g_SHPtr); \
|
SourceHook::HookManagerPubFunc myhookman##id = g_HMAGPtr->MakeHookMan(&protoinfo_##id, 0, 0); \
|
||||||
g_Genc_ad##id.set(g_Genc##id); \
|
CAutoReleaseHookMan arhm_##id(myhookman##id); \
|
||||||
SourceHook::HookManagerPubFunc myhookman##id = g_Genc##id->Generate(); \
|
|
||||||
int hook1_##id, hook2_##id, hook3_##id, hook4_##id; \
|
int hook1_##id, hook2_##id, hook3_##id, hook4_##id; \
|
||||||
\
|
\
|
||||||
TestClass##id::ms_DoRecall = false; \
|
TestClass##id::ms_DoRecall = false; \
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
struct CAutoReleaseHookMan
|
||||||
|
{
|
||||||
|
SourceHook::HookManagerPubFunc m_Ptr;
|
||||||
|
CAutoReleaseHookMan(SourceHook::HookManagerPubFunc ptr) : m_Ptr(ptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
~CAutoReleaseHookMan()
|
||||||
|
{
|
||||||
|
g_HMAGPtr->ReleaseHookMan(m_Ptr);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Strip &
|
// Strip &
|
||||||
template <class T> struct StripRef
|
template <class T> struct StripRef
|
||||||
{
|
{
|
||||||
@ -262,9 +274,6 @@ std::ostream& operator <<(std::ostream &os,const ParamState$1<0@[$2,1,$1:, p$2@]
|
|||||||
SourceHook::PassInfo::V2Info paraminfos2_##id[$1+1]; \
|
SourceHook::PassInfo::V2Info paraminfos2_##id[$1+1]; \
|
||||||
SourceHook::ProtoInfo protoinfo_##id = { $1, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { $1, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
|
|
||||||
#define THGM_MAKE_TEST$1(id, ret_type@[$2,1,$1:, param$2@]) \
|
#define THGM_MAKE_TEST$1(id, ret_type@[$2,1,$1:, param$2@]) \
|
||||||
@ -363,8 +372,7 @@ std::ostream& operator <<(std::ostream &os,const ParamState$1<0@[$2,1,$1:, p$2@]
|
|||||||
SourceHook::ProtoInfo protoinfo_##id = { $1, {0, 0, 0}, paraminfos_##id, \
|
SourceHook::ProtoInfo protoinfo_##id = { $1, {0, 0, 0}, paraminfos_##id, \
|
||||||
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
SourceHook::ProtoInfo::CallConv_ThisCall, __SH_EPI, paraminfos2_##id }; \
|
||||||
\
|
\
|
||||||
SourceHook::Impl::GenContext *g_Genc##id = NULL; \
|
CAutoReleaseHookMan g_Genc_ad##id(NULL);
|
||||||
CAutoPtrDestruction<SourceHook::Impl::GenContext> g_Genc_ad##id(NULL);
|
|
||||||
|
|
||||||
#define THGM_SETUP_PI$1(id@[$2,1,$1:, p$2_type, p$2_passtype, p$2_flags@]) \
|
#define THGM_SETUP_PI$1(id@[$2,1,$1:, p$2_type, p$2_passtype, p$2_flags@]) \
|
||||||
void setuppi_##id() \
|
void setuppi_##id() \
|
||||||
@ -407,9 +415,8 @@ std::ostream& operator <<(std::ostream &os,const ParamState$1<0@[$2,1,$1:, p$2@]
|
|||||||
|
|
||||||
#define THGM_DO_TEST_void(id, call_params) \
|
#define THGM_DO_TEST_void(id, call_params) \
|
||||||
setuppi_##id(); \
|
setuppi_##id(); \
|
||||||
g_Genc##id = new SourceHook::Impl::GenContext(&protoinfo_##id, 0, 0, g_SHPtr); \
|
SourceHook::HookManagerPubFunc myhookman##id = g_HMAGPtr->MakeHookMan(&protoinfo_##id, 0, 0); \
|
||||||
g_Genc_ad##id.set(g_Genc##id); \
|
CAutoReleaseHookMan arhm_##id(myhookman##id); \
|
||||||
SourceHook::HookManagerPubFunc myhookman##id = g_Genc##id->Generate(); \
|
|
||||||
int hook1_##id, hook2_##id, hook3_##id, hook4_##id; \
|
int hook1_##id, hook2_##id, hook3_##id, hook4_##id; \
|
||||||
\
|
\
|
||||||
TestClass##id::ms_DoRecall = false; \
|
TestClass##id::ms_DoRecall = false; \
|
||||||
@ -526,9 +533,8 @@ T* ComparableRef(T& x)
|
|||||||
#define THGM_DO_TEST(id, call_params) \
|
#define THGM_DO_TEST(id, call_params) \
|
||||||
setuppi_##id(); \
|
setuppi_##id(); \
|
||||||
setupri_##id(); \
|
setupri_##id(); \
|
||||||
g_Genc##id = new SourceHook::Impl::GenContext(&protoinfo_##id, 0, 0, g_SHPtr); \
|
SourceHook::HookManagerPubFunc myhookman##id = g_HMAGPtr->MakeHookMan(&protoinfo_##id, 0, 0); \
|
||||||
g_Genc_ad##id.set(g_Genc##id); \
|
CAutoReleaseHookMan arhm_##id(myhookman##id); \
|
||||||
SourceHook::HookManagerPubFunc myhookman##id = g_Genc##id->Generate(); \
|
|
||||||
int hook1_##id, hook2_##id, hook3_##id, hook4_##id; \
|
int hook1_##id, hook2_##id, hook3_##id, hook4_##id; \
|
||||||
\
|
\
|
||||||
TestClass##id::ms_DoRecall = false; \
|
TestClass##id::ms_DoRecall = false; \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user