From 3234d2b79cebb8ff97fb02ec4ad7a6764aed50c9 Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Sat, 30 Apr 2005 19:09:51 +0000 Subject: [PATCH] Fixes --HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%4046 --- sourcehook/FastDelegate.h | 85 +++ sourcehook/generate/FastDelegate.hxx | 5 + sourcehook/generate/sourcehook.hxx | 133 ++-- sourcehook/sourcehook.h | 629 +++++++++++-------- sourcehook/test/main.cpp | 6 +- sourcehook/test/test1.cpp | 896 ++++++++++++++------------- sourcehook/test/testevents.h | 97 +-- 7 files changed, 1060 insertions(+), 791 deletions(-) diff --git a/sourcehook/FastDelegate.h b/sourcehook/FastDelegate.h index 0c4d373..eed5442 100644 --- a/sourcehook/FastDelegate.h +++ b/sourcehook/FastDelegate.h @@ -2627,6 +2627,11 @@ FastDelegate0 MakeDelegate(Y* x, RetType (X::*func)() const) { return FastDelegate0(x, func); } +template +FastDelegate0 MakeDelegate(RetType (*func)()) { + return FastDelegate0(func); +} + //N=1 template FastDelegate1 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1)) { @@ -2638,6 +2643,11 @@ FastDelegate1 MakeDelegate(Y* x, RetType (X::*func)(Pa return FastDelegate1(x, func); } +template +FastDelegate1 MakeDelegate(RetType (*func)(Param1 p1)) { + return FastDelegate1(func); +} + //N=2 template FastDelegate2 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2)) { @@ -2649,6 +2659,11 @@ FastDelegate2 MakeDelegate(Y* x, RetType (X::* return FastDelegate2(x, func); } +template +FastDelegate2 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2)) { + return FastDelegate2(func); +} + //N=3 template FastDelegate3 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3)) { @@ -2660,6 +2675,11 @@ FastDelegate3 MakeDelegate(Y* x, RetTy return FastDelegate3(x, func); } +template +FastDelegate3 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3)) { + return FastDelegate3(func); +} + //N=4 template FastDelegate4 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) { @@ -2671,6 +2691,11 @@ FastDelegate4 MakeDelegate(Y* return FastDelegate4(x, func); } +template +FastDelegate4 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) { + return FastDelegate4(func); +} + //N=5 template FastDelegate5 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) { @@ -2682,6 +2707,11 @@ FastDelegate5 MakeDele return FastDelegate5(x, func); } +template +FastDelegate5 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) { + return FastDelegate5(func); +} + //N=6 template FastDelegate6 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) { @@ -2693,6 +2723,11 @@ FastDelegate6 return FastDelegate6(x, func); } +template +FastDelegate6 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) { + return FastDelegate6(func); +} + //N=7 template FastDelegate7 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) { @@ -2704,6 +2739,11 @@ FastDelegate7(x, func); } +template +FastDelegate7 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) { + return FastDelegate7(func); +} + //N=8 template FastDelegate8 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) { @@ -2715,6 +2755,11 @@ FastDelegate8(x, func); } +template +FastDelegate8 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) { + return FastDelegate8(func); +} + //N=9 template FastDelegate9 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9)) { @@ -2726,6 +2771,11 @@ FastDelegate9(x, func); } +template +FastDelegate9 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9)) { + return FastDelegate9(func); +} + //N=10 template FastDelegate10 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10)) { @@ -2737,6 +2787,11 @@ FastDelegate10(x, func); } +template +FastDelegate10 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10)) { + return FastDelegate10(func); +} + //N=11 template FastDelegate11 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11)) { @@ -2748,6 +2803,11 @@ FastDelegate11(x, func); } +template +FastDelegate11 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11)) { + return FastDelegate11(func); +} + //N=12 template FastDelegate12 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12)) { @@ -2759,6 +2819,11 @@ FastDelegate12(x, func); } +template +FastDelegate12 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12)) { + return FastDelegate12(func); +} + //N=13 template FastDelegate13 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13)) { @@ -2770,6 +2835,11 @@ FastDelegate13(x, func); } +template +FastDelegate13 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13)) { + return FastDelegate13(func); +} + //N=14 template FastDelegate14 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14)) { @@ -2781,6 +2851,11 @@ FastDelegate14(x, func); } +template +FastDelegate14 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14)) { + return FastDelegate14(func); +} + //N=15 template FastDelegate15 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15)) { @@ -2792,6 +2867,11 @@ FastDelegate15(x, func); } +template +FastDelegate15 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15)) { + return FastDelegate15(func); +} + //N=16 template FastDelegate16 MakeDelegate(Y* x, RetType (X::*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16)) { @@ -2803,6 +2883,11 @@ FastDelegate16(x, func); } +template +FastDelegate16 MakeDelegate(RetType (*func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8, Param9 p9, Param10 p10, Param11 p11, Param12 p12, Param13 p13, Param14 p14, Param15 p15, Param16 p16)) { + return FastDelegate16(func); +} + // clean up after ourselves... #undef FASTDLGT_RETTYPE diff --git a/sourcehook/generate/FastDelegate.hxx b/sourcehook/generate/FastDelegate.hxx index bcbc149..e0c7882 100644 --- a/sourcehook/generate/FastDelegate.hxx +++ b/sourcehook/generate/FastDelegate.hxx @@ -981,6 +981,11 @@ FastDelegate@NUM<@SELARGS, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType (X::*fun return FastDelegate@NUM<@SELARGS, FASTDLGT_RETTYPE>(x, func); } +template <@CLASSARGS, class RetType> +FastDelegate@NUM<@SELARGS, FASTDLGT_RETTYPE> MakeDelegate(RetType (*func)(@FUNCARGS)) { + return FastDelegate@NUM<@SELARGS, FASTDLGT_RETTYPE>(func); +} + @ENDVAR // clean up after ourselves... diff --git a/sourcehook/generate/sourcehook.hxx b/sourcehook/generate/sourcehook.hxx index eacfbff..a3fdb23 100755 --- a/sourcehook/generate/sourcehook.hxx +++ b/sourcehook/generate/sourcehook.hxx @@ -300,16 +300,16 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) #define SH_RELEASE_CALLCLASS(ptr) SH_GLOB_SHPTR->ReleaseCallClass(reinterpret_cast(ptr)) #define SH_ADD_HOOK(ifacetype, ifacefunc, ifaceptr, handler, post) \ - SourceHook::SH_FHAdd##ifacetype##ifacefunc((void*)ifaceptr, post, handler) + __SourceHook_FHAdd##ifacetype##ifacefunc((void*)ifaceptr, post, handler) #define SH_ADD_HOOK_STATICFUNC(ifacetype, ifacefunc, ifaceptr, handler, post) \ - SH_ADD_HOOK(ifacetype, ifacefunc, ifaceptr, handler, post) + SH_ADD_HOOK(ifacetype, ifacefunc, ifaceptr, fastdelegate::MakeDelegate(handler), post) #define SH_ADD_HOOK_MEMFUNC(ifacetype, ifacefunc, ifaceptr, handler_inst, handler_func, post) \ SH_ADD_HOOK(ifacetype, ifacefunc, ifaceptr, fastdelegate::MakeDelegate(handler_inst, handler_func), post) #define SH_REMOVE_HOOK(ifacetype, ifacefunc, ifaceptr, handler, post) \ - SourceHook::SH_FHRemove##ifacetype##ifacefunc((void*)ifaceptr, post, handler) + __SourceHook_FHRemove##ifacetype##ifacefunc((void*)ifaceptr, post, handler) #define SH_REMOVE_HOOK_STATICFUNC(ifacetype, ifacefunc, ifaceptr, handler, post) \ - SH_REMOVE_HOOK(ifacetype, ifacefunc, ifaceptr, handler, post) + SH_REMOVE_HOOK(ifacetype, ifacefunc, ifaceptr, fastdelegate::MakeDelegate(handler), post) #define SH_REMOVE_HOOK_MEMFUNC(ifacetype, ifacefunc, ifaceptr, handler_inst, handler_func, post) \ SH_REMOVE_HOOK(ifacetype, ifacefunc, ifaceptr, fastdelegate::MakeDelegate(handler_inst, handler_func), post) @@ -329,12 +329,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) #endif ////////////////////////////////////////////////////////////////////////// -#define SH_FHCls(ift, iff, ov) FHCls_##ift##iff##ov +#define SH_FHCls(ift, iff, ov) __SourceHook_FHCls_##ift##iff##ov #define SHINT_MAKE_HOOKMANPUBFUNC(ifacetype, ifacefunc, overload, funcptr) \ - static int HookManPubFunc(HookManagerAction action, HookManagerInfo *param) \ + static int HookManPubFunc(::SourceHook::HookManagerAction action, ::SourceHook::HookManagerInfo *param) \ { \ - if (action == HA_GetInfo) \ + using namespace ::SourceHook; \ + if (action == ::SourceHook::HA_GetInfo) \ { \ param->proto = ms_Proto; \ MemFuncInfo mfi; \ @@ -347,12 +348,12 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) reinterpret_cast(reinterpret_cast(&ms_Inst) + mfi.vtbloffs)[mfi.vtblindex]; \ return 0; \ } \ - else if (action == HA_Register) \ + else if (action == ::SourceHook::HA_Register) \ { \ ms_HI = param; \ return 0; \ } \ - else if (action == HA_Unregister) \ + else if (action == ::SourceHook::HA_Unregister) \ { \ ms_HI = NULL; \ return 0; \ @@ -361,49 +362,52 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) return 1; \ } +// It has to be possible to use the macros in namespaces +// -> So we need to access and extend the global SourceHook namespace +// We use a namespace alias for this #define SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, funcptr) \ - namespace SourceHook \ + struct SH_FHCls(ifacetype,ifacefunc,overload) \ { \ - struct SH_FHCls(ifacetype,ifacefunc,overload) \ - { \ - static SH_FHCls(ifacetype,ifacefunc,overload) ms_Inst; \ - static HookManagerInfo *ms_HI; \ - static const char *ms_Proto; \ - SHINT_MAKE_HOOKMANPUBFUNC(ifacetype, ifacefunc, overload, funcptr) + static SH_FHCls(ifacetype,ifacefunc,overload) ms_Inst; \ + static ::SourceHook::HookManagerInfo *ms_HI; \ + static const char *ms_Proto; \ + SHINT_MAKE_HOOKMANPUBFUNC(ifacetype, ifacefunc, overload, funcptr) #define SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, proto, funcptr) \ - }; \ - const char *SH_FHCls(ifacetype,ifacefunc,overload)::ms_Proto = proto; \ - SH_FHCls(ifacetype,ifacefunc,overload) SH_FHCls(ifacetype,ifacefunc,overload)::ms_Inst; \ - HookManagerInfo *SH_FHCls(ifacetype,ifacefunc,overload)::ms_HI; \ - bool SH_FHAdd##ifacetype##ifacefunc(void *iface, bool post, \ - SH_FHCls(ifacetype,ifacefunc,overload)::FD handler) \ - { \ - MemFuncInfo mfi; \ - GetFuncInfo(funcptr, mfi); \ - if (mfi.thisptroffs < 0) \ - return false; /* No virtual inheritance supported */ \ - \ - return SH_GLOB_SHPTR->AddHook(SH_GLOB_PLUGPTR, iface, mfi.thisptroffs, \ - SH_FHCls(ifacetype,ifacefunc,overload)::HookManPubFunc, \ - new CSHDelegate(handler), post); \ - } \ - bool SH_FHRemove##ifacetype##ifacefunc(void *iface, bool post, \ - SH_FHCls(ifacetype,ifacefunc,overload)::FD handler) \ - { \ - MemFuncInfo mfi; \ - GetFuncInfo(funcptr, mfi); \ - if (mfi.thisptroffs < 0) \ - return false; /* No virtual inheritance supported */ \ - \ - CSHDelegate tmp(handler); \ - return SH_GLOB_SHPTR->RemoveHook(SH_GLOB_PLUGPTR, iface, mfi.thisptroffs, \ - SH_FHCls(ifacetype,ifacefunc,overload)::HookManPubFunc, &tmp, post); \ - } \ - } + }; \ + const char *SH_FHCls(ifacetype,ifacefunc,overload)::ms_Proto = proto; \ + SH_FHCls(ifacetype,ifacefunc,overload) SH_FHCls(ifacetype,ifacefunc,overload)::ms_Inst; \ + ::SourceHook::HookManagerInfo *SH_FHCls(ifacetype,ifacefunc,overload)::ms_HI; \ + bool __SourceHook_FHAdd##ifacetype##ifacefunc(void *iface, bool post, \ + SH_FHCls(ifacetype,ifacefunc,overload)::FD handler) \ + { \ + using namespace ::SourceHook; \ + MemFuncInfo mfi; \ + GetFuncInfo(funcptr, mfi); \ + if (mfi.thisptroffs < 0) \ + return false; /* No virtual inheritance supported */ \ + \ + return SH_GLOB_SHPTR->AddHook(SH_GLOB_PLUGPTR, iface, mfi.thisptroffs, \ + SH_FHCls(ifacetype,ifacefunc,overload)::HookManPubFunc, \ + new CSHDelegate(handler), post); \ + } \ + bool __SourceHook_FHRemove##ifacetype##ifacefunc(void *iface, bool post, \ + SH_FHCls(ifacetype,ifacefunc,overload)::FD handler) \ + { \ + using namespace ::SourceHook; \ + MemFuncInfo mfi; \ + GetFuncInfo(funcptr, mfi); \ + if (mfi.thisptroffs < 0) \ + return false; /* No virtual inheritance supported */ \ + \ + CSHDelegate tmp(handler); \ + return SH_GLOB_SHPTR->RemoveHook(SH_GLOB_PLUGPTR, iface, mfi.thisptroffs, \ + SH_FHCls(ifacetype,ifacefunc,overload)::HookManPubFunc, &tmp, post); \ + } \ #define SH_SETUPCALLS(rettype, paramtypes, params) \ /* 1) Find the vfnptr */ \ + using namespace ::SourceHook; \ void *ourvfnptr = reinterpret_cast( \ *reinterpret_cast(reinterpret_cast(this) + ms_HI->vtbl_offs) + ms_HI->vtbl_idx); \ \ @@ -428,7 +432,9 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) /* 2) Declare some vars and set it up */ \ std::list &prelist = ci.hooks_pre; \ std::list &postlist = ci.hooks_post; \ - rettype orig_ret, override_ret, plugin_ret; \ + rettype orig_ret; \ + rettype override_ret; \ + rettype plugin_ret; \ META_RES &cur_res = SH_GLOB_SHPTR->GetCurResRef(); \ META_RES &prev_res = SH_GLOB_SHPTR->GetPrevResRef(); \ META_RES &status = SH_GLOB_SHPTR->GetStatusRef(); \ @@ -476,6 +482,7 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) ////////////////////////////////////////////////////////////////////////// #define SH_SETUPCALLS_void(paramtypes, params) \ + using namespace ::SourceHook; \ /* 1) Find the vfnptr */ \ void *ourvfnptr = reinterpret_cast( \ *reinterpret_cast(reinterpret_cast(this) + ms_HI->vtbl_offs) + ms_HI->vtbl_idx); \ @@ -559,28 +566,28 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) @VARARGS@ // ********* Support for @$@ arguments ********* #define SH_DECL_HOOK@$@(ifacetype, ifacefunc, attr, overload, rettype@, param%%@) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate@$@<@param%%|, @@, @rettype> FD; \ - virtual rettype Func(@param%% p%%|, @) attr \ + virtual rettype Func(@param%% p%%|, @) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (@param%%|, @), (@p%%|, @), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype @"|" #param%%| @, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK@$@_void(ifacetype, ifacefunc, attr, overload@, param%%@) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate@$@<@param%%|, @> FD; \ - virtual void Func(@param%% p%%|, @) attr \ + virtual void Func(@param%% p%%|, @) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (@param%%|, @), (@p%%|, @)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr @"|" #param%%| @, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK@$@_vafmt(ifacetype, ifacefunc, attr, overload, rettype@, param%%@) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate@$+1@<@param%%|, @@, @const char *, rettype> FD; \ - virtual rettype Func(@param%% p%%|, @@, @const char *fmt, ...) attr \ + virtual rettype Func(@param%% p%%|, @@, @const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -590,13 +597,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (@param%%|, @@, @...), (@p%%|, @@, @"%s", buf), (@p%%|, @@, @buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype @"|" #param%%| @ "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK@$@_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype@, param%%@) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate@$+1@<@param%%|, @@, @const char *> FD; \ - virtual void Func(@param%% p%%|, @@, @const char *, ...) attr \ + virtual void Func(@param%% p%%|, @@, @const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -606,7 +613,7 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (@param%%|, @@, @...), (@p%%|, @@, @"%s", buf), (@p%%|, @@, @buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr @"|" #param%%| @ "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) @ENDARGS@ @@ -617,6 +624,7 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) #define SH_MAKE_EXECUTABLECLASS_OB(call, prms) \ { \ + using namespace ::SourceHook; \ MemFuncInfo mfi; \ MFI_Impl::GetFuncInfo(m_MFP, mfi); \ OrigVTables::const_iterator iter = m_CC->vt.find(mfi.vtbloffs); \ @@ -648,7 +656,7 @@ namespace SourceHook @VARARGS@ // Support for @$@ arguments - template<@class Param%%|, @> RetType operator()(@Param%% p%%|, @) const + @template<@@class Param%%|, @@> @RetType operator()(@Param%% p%%|, @) const SH_MAKE_EXECUTABLECLASS_OB((@p%%@), (@Param%%@)) @ENDARGS@ @@ -664,6 +672,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(@Param%%|, @)) return SourceHook::ExecutableClass, RetType, RetType (X::*)(@Param%%|, @)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(@Param%%|, @) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(@Param%%|, @)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(@Param%%|, @) const>(ptr, mfp); +} + @ENDARGS@ #undef SH_MAKE_EXECUTABLECLASS_BODY diff --git a/sourcehook/sourcehook.h b/sourcehook/sourcehook.h index ecfedd6..5a1e683 100644 --- a/sourcehook/sourcehook.h +++ b/sourcehook/sourcehook.h @@ -300,16 +300,16 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) #define SH_RELEASE_CALLCLASS(ptr) SH_GLOB_SHPTR->ReleaseCallClass(reinterpret_cast(ptr)) #define SH_ADD_HOOK(ifacetype, ifacefunc, ifaceptr, handler, post) \ - SourceHook::SH_FHAdd##ifacetype##ifacefunc((void*)ifaceptr, post, handler) + __SourceHook_FHAdd##ifacetype##ifacefunc((void*)ifaceptr, post, handler) #define SH_ADD_HOOK_STATICFUNC(ifacetype, ifacefunc, ifaceptr, handler, post) \ - SH_ADD_HOOK(ifacetype, ifacefunc, ifaceptr, handler, post) + SH_ADD_HOOK(ifacetype, ifacefunc, ifaceptr, fastdelegate::MakeDelegate(handler), post) #define SH_ADD_HOOK_MEMFUNC(ifacetype, ifacefunc, ifaceptr, handler_inst, handler_func, post) \ SH_ADD_HOOK(ifacetype, ifacefunc, ifaceptr, fastdelegate::MakeDelegate(handler_inst, handler_func), post) #define SH_REMOVE_HOOK(ifacetype, ifacefunc, ifaceptr, handler, post) \ - SourceHook::SH_FHRemove##ifacetype##ifacefunc((void*)ifaceptr, post, handler) + __SourceHook_FHRemove##ifacetype##ifacefunc((void*)ifaceptr, post, handler) #define SH_REMOVE_HOOK_STATICFUNC(ifacetype, ifacefunc, ifaceptr, handler, post) \ - SH_REMOVE_HOOK(ifacetype, ifacefunc, ifaceptr, handler, post) + SH_REMOVE_HOOK(ifacetype, ifacefunc, ifaceptr, fastdelegate::MakeDelegate(handler), post) #define SH_REMOVE_HOOK_MEMFUNC(ifacetype, ifacefunc, ifaceptr, handler_inst, handler_func, post) \ SH_REMOVE_HOOK(ifacetype, ifacefunc, ifaceptr, fastdelegate::MakeDelegate(handler_inst, handler_func), post) @@ -329,12 +329,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) #endif ////////////////////////////////////////////////////////////////////////// -#define SH_FHCls(ift, iff, ov) FHCls_##ift##iff##ov +#define SH_FHCls(ift, iff, ov) __SourceHook_FHCls_##ift##iff##ov #define SHINT_MAKE_HOOKMANPUBFUNC(ifacetype, ifacefunc, overload, funcptr) \ - static int HookManPubFunc(HookManagerAction action, HookManagerInfo *param) \ + static int HookManPubFunc(::SourceHook::HookManagerAction action, ::SourceHook::HookManagerInfo *param) \ { \ - if (action == HA_GetInfo) \ + using namespace ::SourceHook; \ + if (action == ::SourceHook::HA_GetInfo) \ { \ param->proto = ms_Proto; \ MemFuncInfo mfi; \ @@ -347,12 +348,12 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) reinterpret_cast(reinterpret_cast(&ms_Inst) + mfi.vtbloffs)[mfi.vtblindex]; \ return 0; \ } \ - else if (action == HA_Register) \ + else if (action == ::SourceHook::HA_Register) \ { \ ms_HI = param; \ return 0; \ } \ - else if (action == HA_Unregister) \ + else if (action == ::SourceHook::HA_Unregister) \ { \ ms_HI = NULL; \ return 0; \ @@ -361,49 +362,52 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) return 1; \ } +// It has to be possible to use the macros in namespaces +// -> So we need to access and extend the global SourceHook namespace +// We use a namespace alias for this #define SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, funcptr) \ - namespace SourceHook \ + struct SH_FHCls(ifacetype,ifacefunc,overload) \ { \ - struct SH_FHCls(ifacetype,ifacefunc,overload) \ - { \ - static SH_FHCls(ifacetype,ifacefunc,overload) ms_Inst; \ - static HookManagerInfo *ms_HI; \ - static const char *ms_Proto; \ - SHINT_MAKE_HOOKMANPUBFUNC(ifacetype, ifacefunc, overload, funcptr) + static SH_FHCls(ifacetype,ifacefunc,overload) ms_Inst; \ + static ::SourceHook::HookManagerInfo *ms_HI; \ + static const char *ms_Proto; \ + SHINT_MAKE_HOOKMANPUBFUNC(ifacetype, ifacefunc, overload, funcptr) #define SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, proto, funcptr) \ - }; \ - const char *SH_FHCls(ifacetype,ifacefunc,overload)::ms_Proto = proto; \ - SH_FHCls(ifacetype,ifacefunc,overload) SH_FHCls(ifacetype,ifacefunc,overload)::ms_Inst; \ - HookManagerInfo *SH_FHCls(ifacetype,ifacefunc,overload)::ms_HI; \ - bool SH_FHAdd##ifacetype##ifacefunc(void *iface, bool post, \ - SH_FHCls(ifacetype,ifacefunc,overload)::FD handler) \ - { \ - MemFuncInfo mfi; \ - GetFuncInfo(funcptr, mfi); \ - if (mfi.thisptroffs < 0) \ - return false; /* No virtual inheritance supported */ \ - \ - return SH_GLOB_SHPTR->AddHook(SH_GLOB_PLUGPTR, iface, mfi.thisptroffs, \ - SH_FHCls(ifacetype,ifacefunc,overload)::HookManPubFunc, \ - new CSHDelegate(handler), post); \ - } \ - bool SH_FHRemove##ifacetype##ifacefunc(void *iface, bool post, \ - SH_FHCls(ifacetype,ifacefunc,overload)::FD handler) \ - { \ - MemFuncInfo mfi; \ - GetFuncInfo(funcptr, mfi); \ - if (mfi.thisptroffs < 0) \ - return false; /* No virtual inheritance supported */ \ - \ - CSHDelegate tmp(handler); \ - return SH_GLOB_SHPTR->RemoveHook(SH_GLOB_PLUGPTR, iface, mfi.thisptroffs, \ - SH_FHCls(ifacetype,ifacefunc,overload)::HookManPubFunc, &tmp, post); \ - } \ - } + }; \ + const char *SH_FHCls(ifacetype,ifacefunc,overload)::ms_Proto = proto; \ + SH_FHCls(ifacetype,ifacefunc,overload) SH_FHCls(ifacetype,ifacefunc,overload)::ms_Inst; \ + ::SourceHook::HookManagerInfo *SH_FHCls(ifacetype,ifacefunc,overload)::ms_HI; \ + bool __SourceHook_FHAdd##ifacetype##ifacefunc(void *iface, bool post, \ + SH_FHCls(ifacetype,ifacefunc,overload)::FD handler) \ + { \ + using namespace ::SourceHook; \ + MemFuncInfo mfi; \ + GetFuncInfo(funcptr, mfi); \ + if (mfi.thisptroffs < 0) \ + return false; /* No virtual inheritance supported */ \ + \ + return SH_GLOB_SHPTR->AddHook(SH_GLOB_PLUGPTR, iface, mfi.thisptroffs, \ + SH_FHCls(ifacetype,ifacefunc,overload)::HookManPubFunc, \ + new CSHDelegate(handler), post); \ + } \ + bool __SourceHook_FHRemove##ifacetype##ifacefunc(void *iface, bool post, \ + SH_FHCls(ifacetype,ifacefunc,overload)::FD handler) \ + { \ + using namespace ::SourceHook; \ + MemFuncInfo mfi; \ + GetFuncInfo(funcptr, mfi); \ + if (mfi.thisptroffs < 0) \ + return false; /* No virtual inheritance supported */ \ + \ + CSHDelegate tmp(handler); \ + return SH_GLOB_SHPTR->RemoveHook(SH_GLOB_PLUGPTR, iface, mfi.thisptroffs, \ + SH_FHCls(ifacetype,ifacefunc,overload)::HookManPubFunc, &tmp, post); \ + } \ #define SH_SETUPCALLS(rettype, paramtypes, params) \ /* 1) Find the vfnptr */ \ + using namespace ::SourceHook; \ void *ourvfnptr = reinterpret_cast( \ *reinterpret_cast(reinterpret_cast(this) + ms_HI->vtbl_offs) + ms_HI->vtbl_idx); \ \ @@ -428,7 +432,9 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) /* 2) Declare some vars and set it up */ \ std::list &prelist = ci.hooks_pre; \ std::list &postlist = ci.hooks_post; \ - rettype orig_ret, override_ret, plugin_ret; \ + rettype orig_ret; \ + rettype override_ret; \ + rettype plugin_ret; \ META_RES &cur_res = SH_GLOB_SHPTR->GetCurResRef(); \ META_RES &prev_res = SH_GLOB_SHPTR->GetPrevResRef(); \ META_RES &status = SH_GLOB_SHPTR->GetStatusRef(); \ @@ -476,6 +482,7 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) ////////////////////////////////////////////////////////////////////////// #define SH_SETUPCALLS_void(paramtypes, params) \ + using namespace ::SourceHook; \ /* 1) Find the vfnptr */ \ void *ourvfnptr = reinterpret_cast( \ *reinterpret_cast(reinterpret_cast(this) + ms_HI->vtbl_offs) + ms_HI->vtbl_idx); \ @@ -558,28 +565,28 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) // ********* Support for 0 arguments ********* #define SH_DECL_HOOK0(ifacetype, ifacefunc, attr, overload, rettype) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate0 FD; \ - virtual rettype Func() attr \ + virtual rettype Func() \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (), (), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype , \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK0_void(ifacetype, ifacefunc, attr, overload) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate0<> FD; \ - virtual void Func() attr \ + virtual void Func() \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (), ()); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr , \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK0_vafmt(ifacetype, ifacefunc, attr, overload, rettype) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate1 FD; \ - virtual rettype Func(const char *fmt, ...) attr \ + virtual rettype Func(const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -589,13 +596,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (...), ("%s", buf), (buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK0_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate1 FD; \ - virtual void Func(const char *, ...) attr \ + virtual void Func(const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -605,32 +612,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (...), ("%s", buf), (buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 1 arguments ********* #define SH_DECL_HOOK1(ifacetype, ifacefunc, attr, overload, rettype, param1) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate1 FD; \ - virtual rettype Func(param1 p1) attr \ + virtual rettype Func(param1 p1) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1), (p1), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK1_void(ifacetype, ifacefunc, attr, overload, param1) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate1 FD; \ - virtual void Func(param1 p1) attr \ + virtual void Func(param1 p1) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1), (p1)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK1_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate2 FD; \ - virtual rettype Func(param1 p1, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -640,13 +647,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, ...), (p1, "%s", buf), (p1, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK1_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate2 FD; \ - virtual void Func(param1 p1, const char *, ...) attr \ + virtual void Func(param1 p1, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -656,32 +663,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, ...), (p1, "%s", buf), (p1, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 2 arguments ********* #define SH_DECL_HOOK2(ifacetype, ifacefunc, attr, overload, rettype, param1, param2) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate2 FD; \ - virtual rettype Func(param1 p1, param2 p2) attr \ + virtual rettype Func(param1 p1, param2 p2) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2), (p1, p2), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK2_void(ifacetype, ifacefunc, attr, overload, param1, param2) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate2 FD; \ - virtual void Func(param1 p1, param2 p2) attr \ + virtual void Func(param1 p1, param2 p2) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2), (p1, p2)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK2_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate3 FD; \ - virtual rettype Func(param1 p1, param2 p2, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -691,13 +698,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, ...), (p1, p2, "%s", buf), (p1, p2, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK2_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate3 FD; \ - virtual void Func(param1 p1, param2 p2, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -707,32 +714,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, ...), (p1, p2, "%s", buf), (p1, p2, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 3 arguments ********* #define SH_DECL_HOOK3(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate3 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2, param3), (p1, p2, p3), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK3_void(ifacetype, ifacefunc, attr, overload, param1, param2, param3) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate3 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2, param3), (p1, p2, p3)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK3_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate4 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -742,13 +749,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, param3, ...), (p1, p2, p3, "%s", buf), (p1, p2, p3, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK3_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate4 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -758,32 +765,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, param3, ...), (p1, p2, p3, "%s", buf), (p1, p2, p3, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 4 arguments ********* #define SH_DECL_HOOK4(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate4 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2, param3, param4), (p1, p2, p3, p4), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK4_void(ifacetype, ifacefunc, attr, overload, param1, param2, param3, param4) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate4 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2, param3, param4), (p1, p2, p3, p4)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK4_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate5 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -793,13 +800,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, ...), (p1, p2, p3, p4, "%s", buf), (p1, p2, p3, p4, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK4_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate5 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -809,32 +816,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, ...), (p1, p2, p3, p4, "%s", buf), (p1, p2, p3, p4, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 5 arguments ********* #define SH_DECL_HOOK5(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate5 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2, param3, param4, param5), (p1, p2, p3, p4, p5), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK5_void(ifacetype, ifacefunc, attr, overload, param1, param2, param3, param4, param5) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate5 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2, param3, param4, param5), (p1, p2, p3, p4, p5)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK5_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate6 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -844,13 +851,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, ...), (p1, p2, p3, p4, p5, "%s", buf), (p1, p2, p3, p4, p5, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK5_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate6 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -860,32 +867,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, ...), (p1, p2, p3, p4, p5, "%s", buf), (p1, p2, p3, p4, p5, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 6 arguments ********* #define SH_DECL_HOOK6(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate6 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6), (p1, p2, p3, p4, p5, p6), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK6_void(ifacetype, ifacefunc, attr, overload, param1, param2, param3, param4, param5, param6) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate6 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6), (p1, p2, p3, p4, p5, p6)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK6_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate7 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -895,13 +902,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, ...), (p1, p2, p3, p4, p5, p6, "%s", buf), (p1, p2, p3, p4, p5, p6, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK6_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate7 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -911,32 +918,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, ...), (p1, p2, p3, p4, p5, p6, "%s", buf), (p1, p2, p3, p4, p5, p6, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 7 arguments ********* #define SH_DECL_HOOK7(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate7 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7), (p1, p2, p3, p4, p5, p6, p7), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK7_void(ifacetype, ifacefunc, attr, overload, param1, param2, param3, param4, param5, param6, param7) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate7 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7), (p1, p2, p3, p4, p5, p6, p7)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK7_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate8 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -946,13 +953,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, ...), (p1, p2, p3, p4, p5, p6, p7, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK7_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate8 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -962,32 +969,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, ...), (p1, p2, p3, p4, p5, p6, p7, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 8 arguments ********* #define SH_DECL_HOOK8(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate8 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8), (p1, p2, p3, p4, p5, p6, p7, p8), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK8_void(ifacetype, ifacefunc, attr, overload, param1, param2, param3, param4, param5, param6, param7, param8) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate8 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8), (p1, p2, p3, p4, p5, p6, p7, p8)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK8_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate9 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -997,13 +1004,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, ...), (p1, p2, p3, p4, p5, p6, p7, p8, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK8_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate9 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1013,32 +1020,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, ...), (p1, p2, p3, p4, p5, p6, p7, p8, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 9 arguments ********* #define SH_DECL_HOOK9(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate9 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9), (p1, p2, p3, p4, p5, p6, p7, p8, p9), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK9_void(ifacetype, ifacefunc, attr, overload, param1, param2, param3, param4, param5, param6, param7, param8, param9) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate9 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9), (p1, p2, p3, p4, p5, p6, p7, p8, p9)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK9_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate10 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1048,13 +1055,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK9_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate10 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1064,32 +1071,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 10 arguments ********* #define SH_DECL_HOOK10(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate10 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK10_void(ifacetype, ifacefunc, attr, overload, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate10 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK10_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate11 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1099,13 +1106,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK10_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate11 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1115,32 +1122,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 11 arguments ********* #define SH_DECL_HOOK11(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate11 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK11_void(ifacetype, ifacefunc, attr, overload, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate11 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK11_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate12 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1150,13 +1157,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK11_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate12 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1166,32 +1173,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 12 arguments ********* #define SH_DECL_HOOK12(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate12 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK12_void(ifacetype, ifacefunc, attr, overload, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate12 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK12_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate13 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1201,13 +1208,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK12_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate13 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1217,32 +1224,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 13 arguments ********* #define SH_DECL_HOOK13(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate13 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK13_void(ifacetype, ifacefunc, attr, overload, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate13 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK13_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate14 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1252,13 +1259,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK13_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate14 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1268,32 +1275,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 14 arguments ********* #define SH_DECL_HOOK14(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate14 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13 "|" #param14, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK14_void(ifacetype, ifacefunc, attr, overload, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate14 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13 "|" #param14, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK14_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate15 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1303,13 +1310,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13 "|" #param14 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK14_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate15 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1319,32 +1326,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13 "|" #param14 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 15 arguments ********* #define SH_DECL_HOOK15(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate15 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13 "|" #param14 "|" #param15, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK15_void(ifacetype, ifacefunc, attr, overload, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate15 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13 "|" #param14 "|" #param15, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK15_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate16 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1354,13 +1361,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13 "|" #param14 "|" #param15 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK15_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate16 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1370,32 +1377,32 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13 "|" #param14 "|" #param15 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) // ********* Support for 16 arguments ********* #define SH_DECL_HOOK16(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate16 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15, param16 p16) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15, param16 p16) \ { SH_HANDLEFUNC(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16), rettype); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13 "|" #param14 "|" #param15 "|" #param16, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK16_void(ifacetype, ifacefunc, attr, overload, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate16 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15, param16 p16) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15, param16 p16) \ { SH_HANDLEFUNC_void(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16)); } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13 "|" #param14 "|" #param15 "|" #param16, \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK16_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate17 FD; \ - virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15, param16 p16, const char *fmt, ...) attr \ + virtual rettype Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15, param16 p16, const char *fmt, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1405,13 +1412,13 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, buf), rettype); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #rettype "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13 "|" #param14 "|" #param15 "|" #param16 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) #define SH_DECL_HOOK16_void_vafmt(ifacetype, ifacefunc, attr, overload, rettype, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16) \ - SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ + SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast \ (&ifacetype::ifacefunc))) \ typedef fastdelegate::FastDelegate17 FD; \ - virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15, param16 p16, const char *, ...) attr \ + virtual void Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, param7 p7, param8 p8, param9 p9, param10 p10, param11 p11, param12 p12, param13 p13, param14 p14, param15 p15, param16 p16, const char *, ...) \ { \ char buf[STRBUF_LEN]; \ va_list ap; \ @@ -1421,7 +1428,7 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) SH_HANDLEFUNC_void_vafmt(ifacetype, ifacefunc, (param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, ...), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, "%s", buf), (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, buf)); \ } \ SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, #attr "|" #param1 "|" #param2 "|" #param3 "|" #param4 "|" #param5 "|" #param6 "|" #param7 "|" #param8 "|" #param9 "|" #param10 "|" #param11 "|" #param12 "|" #param13 "|" #param14 "|" #param15 "|" #param16 "|const char*|...", \ - (static_cast(&ifacetype::ifacefunc))) + (static_cast(&ifacetype::ifacefunc))) @@ -1431,6 +1438,7 @@ inline SourceHook::CallClass *SH_GET_CALLCLASS(ifacetype *ptr) #define SH_MAKE_EXECUTABLECLASS_OB(call, prms) \ { \ + using namespace ::SourceHook; \ MemFuncInfo mfi; \ MFI_Impl::GetFuncInfo(m_MFP, mfi); \ OrigVTables::const_iterator iter = m_CC->vt.find(mfi.vtbloffs); \ @@ -1461,7 +1469,7 @@ namespace SourceHook } // Support for 0 arguments - template<> RetType operator()() const + RetType operator()() const SH_MAKE_EXECUTABLECLASS_OB((), ()) // Support for 1 arguments @@ -1539,6 +1547,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)()) return SourceHook::ExecutableClass, RetType, RetType (X::*)()>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)() const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)()const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)() const>(ptr, mfp); +} + // Support for 1 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1)> @@ -1547,6 +1562,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1)) return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1) const>(ptr, mfp); +} + // Support for 2 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2)> @@ -1555,6 +1577,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2)) return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2) const>(ptr, mfp); +} + // Support for 3 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3)> @@ -1563,6 +1592,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3)) return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3) const>(ptr, mfp); +} + // Support for 4 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4)> @@ -1571,6 +1607,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4) const>(ptr, mfp); +} + // Support for 5 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5)> @@ -1579,6 +1622,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5) const>(ptr, mfp); +} + // Support for 6 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6)> @@ -1587,6 +1637,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6) const>(ptr, mfp); +} + // Support for 7 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7)> @@ -1595,6 +1652,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7) const>(ptr, mfp); +} + // Support for 8 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8)> @@ -1603,6 +1667,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8) const>(ptr, mfp); +} + // Support for 9 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9)> @@ -1611,6 +1682,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9) const>(ptr, mfp); +} + // Support for 10 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10)> @@ -1619,6 +1697,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10) const>(ptr, mfp); +} + // Support for 11 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11)> @@ -1627,6 +1712,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11) const>(ptr, mfp); +} + // Support for 12 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12)> @@ -1635,6 +1727,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12) const>(ptr, mfp); +} + // Support for 13 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13)> @@ -1643,6 +1742,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13) const>(ptr, mfp); +} + // Support for 14 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14)> @@ -1651,6 +1757,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14) const>(ptr, mfp); +} + // Support for 15 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15)> @@ -1659,6 +1772,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15) const>(ptr, mfp); +} + // Support for 16 arguments template SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16)> @@ -1667,6 +1787,13 @@ SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16)>(ptr, mfp); } +template +SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16) const> +SH_CALL(SourceHook::CallClass *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16)const) +{ + return SourceHook::ExecutableClass, RetType, RetType (X::*)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16) const>(ptr, mfp); +} + #undef SH_MAKE_EXECUTABLECLASS_BODY diff --git a/sourcehook/test/main.cpp b/sourcehook/test/main.cpp index ea33e61..858774b 100644 --- a/sourcehook/test/main.cpp +++ b/sourcehook/test/main.cpp @@ -45,10 +45,9 @@ public: ++passed; else ++failed; - - cout << endl << "----" << endl << "Passed: " << passed << endl << "Failed: " << failed << endl; - cout << "Total: " << passed + failed << endl; } + cout << endl << "----" << endl << "Passed: " << passed << endl << "Failed: " << failed << endl; + cout << "Total: " << passed + failed << endl; } }; @@ -59,6 +58,7 @@ std::list Test::ms_Tests; Test g_Test##x(Test##x, #x); DO_TEST(Basic); +DO_TEST(VafmtAndOverload); int main(int argc, char *argv[]) { diff --git a/sourcehook/test/test1.cpp b/sourcehook/test/test1.cpp index f23b59e..9553963 100644 --- a/sourcehook/test/test1.cpp +++ b/sourcehook/test/test1.cpp @@ -2,446 +2,458 @@ #include "sourcehook_impl.h" #include "testevents.h" -// Global to all tests -SourceHook::ISourceHook *g_SHPtr; -SourceHook::Plugin g_PLID; - -// TEST1 -// Basic tests -// Hooking and callclass - - -struct State_F1_Called : State +namespace { -}; + StateList g_States; + SourceHook::ISourceHook *g_SHPtr; + SourceHook::Plugin g_PLID; -struct State_F1_PreHandler_Called : State -{ -}; + // TEST1 + // Basic tests + // Hooking and callclass -struct State_F1_PostHandler_Called : State -{ -}; - -struct State_F1_HookAdded : State -{ - bool m_Successfully; - State_F1_HookAdded(bool successfully) : m_Successfully(successfully) + struct State_F1_Called : State { + }; + + struct State_F1_PreHandler_Called : State + { + }; + + struct State_F1_PostHandler_Called : State + { + }; + + struct State_F1_HookAdded : State + { + bool m_Successfully; + State_F1_HookAdded(bool successfully) : m_Successfully(successfully) + { + } + + bool IsEqual(State *other) + { + State_F1_HookAdded *other2 = dynamic_cast(other); + if (!other2) + return false; + return other2->m_Successfully == m_Successfully; + } + }; + + struct State_F1_HookRemoved : State + { + }; + + struct State_F1_CallClassGenerated : State + { + }; + + struct State_F1_CallClassReleased : State + { + }; + + struct State_F299_Called : State + { + std::string param; + State_F299_Called(const char *p) : param(p) + { + } + bool IsEqual(State *other) + { + State_F299_Called *other2 = dynamic_cast(other); + if (!other2) + return false; + return other2->param == param; + } + }; + + struct State_F299_PreHandlerCalled : State_F299_Called + { + State_F299_PreHandlerCalled(const char *p) : State_F299_Called(p) + { + } + }; + + struct State_F299_PostHandlerCalled : State_F299_Called + { + State_F299_PostHandlerCalled(const char *p) : State_F299_Called(p) + { + } + }; + + struct State_F299Ret : State + { + bool m_Ret; + State_F299Ret(bool ret) : m_Ret(ret) + { + } + + bool IsEqual(State *other) + { + State_F299Ret *other2 = dynamic_cast(other); + if (!other2) + return false; + return other2->m_Ret == m_Ret; + } + }; + + class Test + { + public: + virtual void F1() + { + ADD_STATE(State_F1_Called); + } + virtual void F2(){} + virtual void F3(){} + virtual void F4(){} + virtual void F5(){} + virtual void F6(){} + virtual void F7(){} + virtual void F8(){} + virtual void F9(){} + virtual void F10(){} + virtual void F11(){} + virtual void F12(){} + virtual void F13(){} + virtual void F14(){} + virtual void F15(){} + virtual void F16(){} + virtual void F17(){} + virtual void F18(){} + virtual void F19(){} + virtual void F20(){} + virtual void F21(){} + virtual void F22(){} + virtual void F23(){} + virtual void F24(){} + virtual void F25(){} + virtual void F26(){} + virtual void F27(){} + virtual void F28(){} + virtual void F29(){} + virtual void F30(){} + virtual void F31(){} + virtual void F32(){} + virtual void F33(){} + virtual void F34(){} + virtual void F35(){} + virtual void F36(){} + virtual void F37(){} + virtual void F38(){} + virtual void F39(){} + virtual void F40(){} + virtual void F41(){} + virtual void F42(){} + virtual void F43(){} + virtual void F44(){} + virtual void F45(){} + virtual void F46(){} + virtual void F47(){} + virtual void F48(){} + virtual void F49(){} + virtual void F50(){} + virtual void F51(){} + virtual void F52(){} + virtual void F53(){} + virtual void F54(){} + virtual void F55(){} + virtual void F56(){} + virtual void F57(){} + virtual void F58(){} + virtual void F59(){} + virtual void F60(){} + virtual void F61(){} + virtual void F62(){} + virtual void F63(){} + virtual void F64(){} + virtual void F65(){} + virtual void F66(){} + virtual void F67(){} + virtual void F68(){} + virtual void F69(){} + virtual void F70(){} + virtual void F71(){} + virtual void F72(){} + virtual void F73(){} + virtual void F74(){} + virtual void F75(){} + virtual void F76(){} + virtual void F77(){} + virtual void F78(){} + virtual void F79(){} + virtual void F80(){} + virtual void F81(){} + virtual void F82(){} + virtual void F83(){} + virtual void F84(){} + virtual void F85(){} + virtual void F86(){} + virtual void F87(){} + virtual void F88(){} + virtual void F89(){} + virtual void F90(){} + virtual void F91(){} + virtual void F92(){} + virtual void F93(){} + virtual void F94(){} + virtual void F95(){} + virtual void F96(){} + virtual void F97(){} + virtual void F98(){} + virtual void F99(){} + virtual void F100(){} + virtual void F101(){} + virtual void F102(){} + virtual void F103(){} + virtual void F104(){} + virtual void F105(){} + virtual void F106(){} + virtual void F107(){} + virtual void F108(){} + virtual void F109(){} + virtual void F110(){} + virtual void F111(){} + virtual void F112(){} + virtual void F113(){} + virtual void F114(){} + virtual void F115(){} + virtual void F116(){} + virtual void F117(){} + virtual void F118(){} + virtual void F119(){} + virtual void F120(){} + virtual void F121(){} + virtual void F122(){} + virtual void F123(){} + virtual void F124(){} + virtual void F125(){} + virtual void F126(){} + virtual void F127(){} + virtual void F128(){} + virtual void F129(){} + virtual void F130(){} + virtual void F131(){} + virtual void F132(){} + virtual void F133(){} + virtual void F134(){} + virtual void F135(){} + virtual void F136(){} + virtual void F137(){} + virtual void F138(){} + virtual void F139(){} + virtual void F140(){} + virtual void F141(){} + virtual void F142(){} + virtual void F143(){} + virtual void F144(){} + virtual void F145(){} + virtual void F146(){} + virtual void F147(){} + virtual void F148(){} + virtual void F149(){} + virtual void F150(){} + virtual void F151(){} + virtual void F152(){} + virtual void F153(){} + virtual void F154(){} + virtual void F155(){} + virtual void F156(){} + virtual void F157(){} + virtual void F158(){} + virtual void F159(){} + virtual void F160(){} + virtual void F161(){} + virtual void F162(){} + virtual void F163(){} + virtual void F164(){} + virtual void F165(){} + virtual void F166(){} + virtual void F167(){} + virtual void F168(){} + virtual void F169(){} + virtual void F170(){} + virtual void F171(){} + virtual void F172(){} + virtual void F173(){} + virtual void F174(){} + virtual void F175(){} + virtual void F176(){} + virtual void F177(){} + virtual void F178(){} + virtual void F179(){} + virtual void F180(){} + virtual void F181(){} + virtual void F182(){} + virtual void F183(){} + virtual void F184(){} + virtual void F185(){} + virtual void F186(){} + virtual void F187(){} + virtual void F188(){} + virtual void F189(){} + virtual void F190(){} + virtual void F191(){} + virtual void F192(){} + virtual void F193(){} + virtual void F194(){} + virtual void F195(){} + virtual void F196(){} + virtual void F197(){} + virtual void F198(){} + virtual void F199(){} + virtual void F200(){} + virtual void F201(){} + virtual void F202(){} + virtual void F203(){} + virtual void F204(){} + virtual void F205(){} + virtual void F206(){} + virtual void F207(){} + virtual void F208(){} + virtual void F209(){} + virtual void F210(){} + virtual void F211(){} + virtual void F212(){} + virtual void F213(){} + virtual void F214(){} + virtual void F215(){} + virtual void F216(){} + virtual void F217(){} + virtual void F218(){} + virtual void F219(){} + virtual void F220(){} + virtual void F221(){} + virtual void F222(){} + virtual void F223(){} + virtual void F224(){} + virtual void F225(){} + virtual void F226(){} + virtual void F227(){} + virtual void F228(){} + virtual void F229(){} + virtual void F230(){} + virtual void F231(){} + virtual void F232(){} + virtual void F233(){} + virtual void F234(){} + virtual void F235(){} + virtual void F236(){} + virtual void F237(){} + virtual void F238(){} + virtual void F239(){} + virtual void F240(){} + virtual void F241(){} + virtual void F242(){} + virtual void F243(){} + virtual void F244(){} + virtual void F245(){} + virtual void F246(){} + virtual void F247(){} + virtual void F248(){} + virtual void F249(){} + virtual void F250(){} + virtual void F251(){} + virtual void F252(){} + virtual void F253(){} + virtual void F254(){} + virtual void F255(){} + virtual void F256(){} + virtual void F257(){} + virtual void F258(){} + virtual void F259(){} + virtual void F260(){} + virtual void F261(){} + virtual void F262(){} + virtual void F263(){} + virtual void F264(){} + virtual void F265(){} + virtual void F266(){} + virtual void F267(){} + virtual void F268(){} + virtual void F269(){} + virtual void F270(){} + virtual void F271(){} + virtual void F272(){} + virtual void F273(){} + virtual void F274(){} + virtual void F275(){} + virtual void F276(){} + virtual void F277(){} + virtual void F278(){} + virtual void F279(){} + virtual void F280(){} + virtual void F281(){} + virtual void F282(){} + virtual void F283(){} + virtual void F284(){} + virtual void F285(){} + virtual void F286(){} + virtual void F287(){} + virtual void F288(){} + virtual void F289(){} + virtual void F290(){} + virtual void F291(){} + virtual void F292(){} + virtual void F293(){} + virtual void F294(){} + virtual void F295(){} + virtual void F296(){} + virtual void F297(){} + virtual void F298(){} + virtual bool F299(const char *mwah) + { + ADD_STATE(State_F299_Called(mwah)); + return true; + } + }; + + SH_DECL_HOOK1(Test, F299, SH_NOATTRIB, 0, bool, const char *); + SH_DECL_HOOK0_void(Test, F1, SH_NOATTRIB, 0); + SH_DECL_HOOK0_void(Test, F2, SH_NOATTRIB, 0); + SH_DECL_HOOK0_void(Test, F3, SH_NOATTRIB, 0); + SH_DECL_HOOK0_void(Test, F4, SH_NOATTRIB, 0); + SH_DECL_HOOK0_void(Test, F5, SH_NOATTRIB, 0); + SH_DECL_HOOK0_void(Test, F6, SH_NOATTRIB, 0); + SH_DECL_HOOK0_void(Test, F7, SH_NOATTRIB, 0); + SH_DECL_HOOK0_void(Test, F8, SH_NOATTRIB, 0); + SH_DECL_HOOK0_void(Test, F9, SH_NOATTRIB, 0); + SH_DECL_HOOK0_void(Test, F10, SH_NOATTRIB, 0); + + META_RES g_F1Pre_WhatToDo; + META_RES g_F1Post_WhatToDo; + + struct HandlersF1 + { + void Pre() + { + ADD_STATE(State_F1_PreHandler_Called); + RETURN_META(g_F1Pre_WhatToDo); + } + + void Post() + { + ADD_STATE(State_F1_PostHandler_Called); + RETURN_META(g_F1Post_WhatToDo); + } + }; + + META_RES g_F299Pre_WhatToDo; + bool g_F299Pre_WhatToRet; + + bool F299_Pre(const char *mwah) + { + ADD_STATE(State_F299_PreHandlerCalled(mwah)); + RETURN_META_VALUE(g_F299Pre_WhatToDo, g_F299Pre_WhatToRet); } - bool IsEqual(State *other) - { - State_F1_HookAdded *other2 = dynamic_cast(other); - if (!other2) - return false; - return other2->m_Successfully == m_Successfully; - } -}; - -struct State_F1_HookRemoved : State -{ -}; - -struct State_F1_CallClassGenerated : State -{ -}; - -struct State_F1_CallClassReleased : State -{ -}; - -struct State_F299_Called : State -{ - std::string param; - State_F299_Called(const char *p) : param(p) - { - } - bool IsEqual(State *other) - { - State_F299_Called *other2 = dynamic_cast(other); - if (!other2) - return false; - return other2->param == param; - } -}; - -struct State_F299_PreHandlerCalled : State_F299_Called -{ - State_F299_PreHandlerCalled(const char *p) : State_F299_Called(p) - { - } -}; - -struct State_F299_PostHandlerCalled : State_F299_Called -{ - State_F299_PostHandlerCalled(const char *p) : State_F299_Called(p) - { - } -}; - -struct State_F299Ret : State -{ - bool m_Ret; - State_F299Ret(bool ret) : m_Ret(ret) + bool F299_Post(const char *mwah) { + ADD_STATE(State_F299_PostHandlerCalled(mwah)); + RETURN_META_VALUE(MRES_OVERRIDE, META_RESULT_STATUS >= MRES_OVERRIDE ? !META_RESULT_OVERRIDE_RET(bool) : + !META_RESULT_ORIG_RET(bool)); } - bool IsEqual(State *other) - { - State_F299Ret *other2 = dynamic_cast(other); - if (!other2) - return false; - return other2->m_Ret == m_Ret; - } -}; - -class Test -{ -public: - virtual void F1() - { - ADD_STATE(State_F1_Called); - } - virtual void F2(){} - virtual void F3(){} - virtual void F4(){} - virtual void F5(){} - virtual void F6(){} - virtual void F7(){} - virtual void F8(){} - virtual void F9(){} - virtual void F10(){} - virtual void F11(){} - virtual void F12(){} - virtual void F13(){} - virtual void F14(){} - virtual void F15(){} - virtual void F16(){} - virtual void F17(){} - virtual void F18(){} - virtual void F19(){} - virtual void F20(){} - virtual void F21(){} - virtual void F22(){} - virtual void F23(){} - virtual void F24(){} - virtual void F25(){} - virtual void F26(){} - virtual void F27(){} - virtual void F28(){} - virtual void F29(){} - virtual void F30(){} - virtual void F31(){} - virtual void F32(){} - virtual void F33(){} - virtual void F34(){} - virtual void F35(){} - virtual void F36(){} - virtual void F37(){} - virtual void F38(){} - virtual void F39(){} - virtual void F40(){} - virtual void F41(){} - virtual void F42(){} - virtual void F43(){} - virtual void F44(){} - virtual void F45(){} - virtual void F46(){} - virtual void F47(){} - virtual void F48(){} - virtual void F49(){} - virtual void F50(){} - virtual void F51(){} - virtual void F52(){} - virtual void F53(){} - virtual void F54(){} - virtual void F55(){} - virtual void F56(){} - virtual void F57(){} - virtual void F58(){} - virtual void F59(){} - virtual void F60(){} - virtual void F61(){} - virtual void F62(){} - virtual void F63(){} - virtual void F64(){} - virtual void F65(){} - virtual void F66(){} - virtual void F67(){} - virtual void F68(){} - virtual void F69(){} - virtual void F70(){} - virtual void F71(){} - virtual void F72(){} - virtual void F73(){} - virtual void F74(){} - virtual void F75(){} - virtual void F76(){} - virtual void F77(){} - virtual void F78(){} - virtual void F79(){} - virtual void F80(){} - virtual void F81(){} - virtual void F82(){} - virtual void F83(){} - virtual void F84(){} - virtual void F85(){} - virtual void F86(){} - virtual void F87(){} - virtual void F88(){} - virtual void F89(){} - virtual void F90(){} - virtual void F91(){} - virtual void F92(){} - virtual void F93(){} - virtual void F94(){} - virtual void F95(){} - virtual void F96(){} - virtual void F97(){} - virtual void F98(){} - virtual void F99(){} - virtual void F100(){} - virtual void F101(){} - virtual void F102(){} - virtual void F103(){} - virtual void F104(){} - virtual void F105(){} - virtual void F106(){} - virtual void F107(){} - virtual void F108(){} - virtual void F109(){} - virtual void F110(){} - virtual void F111(){} - virtual void F112(){} - virtual void F113(){} - virtual void F114(){} - virtual void F115(){} - virtual void F116(){} - virtual void F117(){} - virtual void F118(){} - virtual void F119(){} - virtual void F120(){} - virtual void F121(){} - virtual void F122(){} - virtual void F123(){} - virtual void F124(){} - virtual void F125(){} - virtual void F126(){} - virtual void F127(){} - virtual void F128(){} - virtual void F129(){} - virtual void F130(){} - virtual void F131(){} - virtual void F132(){} - virtual void F133(){} - virtual void F134(){} - virtual void F135(){} - virtual void F136(){} - virtual void F137(){} - virtual void F138(){} - virtual void F139(){} - virtual void F140(){} - virtual void F141(){} - virtual void F142(){} - virtual void F143(){} - virtual void F144(){} - virtual void F145(){} - virtual void F146(){} - virtual void F147(){} - virtual void F148(){} - virtual void F149(){} - virtual void F150(){} - virtual void F151(){} - virtual void F152(){} - virtual void F153(){} - virtual void F154(){} - virtual void F155(){} - virtual void F156(){} - virtual void F157(){} - virtual void F158(){} - virtual void F159(){} - virtual void F160(){} - virtual void F161(){} - virtual void F162(){} - virtual void F163(){} - virtual void F164(){} - virtual void F165(){} - virtual void F166(){} - virtual void F167(){} - virtual void F168(){} - virtual void F169(){} - virtual void F170(){} - virtual void F171(){} - virtual void F172(){} - virtual void F173(){} - virtual void F174(){} - virtual void F175(){} - virtual void F176(){} - virtual void F177(){} - virtual void F178(){} - virtual void F179(){} - virtual void F180(){} - virtual void F181(){} - virtual void F182(){} - virtual void F183(){} - virtual void F184(){} - virtual void F185(){} - virtual void F186(){} - virtual void F187(){} - virtual void F188(){} - virtual void F189(){} - virtual void F190(){} - virtual void F191(){} - virtual void F192(){} - virtual void F193(){} - virtual void F194(){} - virtual void F195(){} - virtual void F196(){} - virtual void F197(){} - virtual void F198(){} - virtual void F199(){} - virtual void F200(){} - virtual void F201(){} - virtual void F202(){} - virtual void F203(){} - virtual void F204(){} - virtual void F205(){} - virtual void F206(){} - virtual void F207(){} - virtual void F208(){} - virtual void F209(){} - virtual void F210(){} - virtual void F211(){} - virtual void F212(){} - virtual void F213(){} - virtual void F214(){} - virtual void F215(){} - virtual void F216(){} - virtual void F217(){} - virtual void F218(){} - virtual void F219(){} - virtual void F220(){} - virtual void F221(){} - virtual void F222(){} - virtual void F223(){} - virtual void F224(){} - virtual void F225(){} - virtual void F226(){} - virtual void F227(){} - virtual void F228(){} - virtual void F229(){} - virtual void F230(){} - virtual void F231(){} - virtual void F232(){} - virtual void F233(){} - virtual void F234(){} - virtual void F235(){} - virtual void F236(){} - virtual void F237(){} - virtual void F238(){} - virtual void F239(){} - virtual void F240(){} - virtual void F241(){} - virtual void F242(){} - virtual void F243(){} - virtual void F244(){} - virtual void F245(){} - virtual void F246(){} - virtual void F247(){} - virtual void F248(){} - virtual void F249(){} - virtual void F250(){} - virtual void F251(){} - virtual void F252(){} - virtual void F253(){} - virtual void F254(){} - virtual void F255(){} - virtual void F256(){} - virtual void F257(){} - virtual void F258(){} - virtual void F259(){} - virtual void F260(){} - virtual void F261(){} - virtual void F262(){} - virtual void F263(){} - virtual void F264(){} - virtual void F265(){} - virtual void F266(){} - virtual void F267(){} - virtual void F268(){} - virtual void F269(){} - virtual void F270(){} - virtual void F271(){} - virtual void F272(){} - virtual void F273(){} - virtual void F274(){} - virtual void F275(){} - virtual void F276(){} - virtual void F277(){} - virtual void F278(){} - virtual void F279(){} - virtual void F280(){} - virtual void F281(){} - virtual void F282(){} - virtual void F283(){} - virtual void F284(){} - virtual void F285(){} - virtual void F286(){} - virtual void F287(){} - virtual void F288(){} - virtual void F289(){} - virtual void F290(){} - virtual void F291(){} - virtual void F292(){} - virtual void F293(){} - virtual void F294(){} - virtual void F295(){} - virtual void F296(){} - virtual void F297(){} - virtual void F298(){} - virtual bool F299(const char *mwah) - { - ADD_STATE(State_F299_Called(mwah)); - return true; - } -}; - -SH_DECL_HOOK0_void(Test, F1, SH_NOATTRIB, 0); -SH_DECL_HOOK1(Test, F299, SH_NOATTRIB, 0, bool, const char *); - -META_RES g_F1Pre_WhatToDo; -META_RES g_F1Post_WhatToDo; - -struct HandlersF1 -{ - void Pre() - { - ADD_STATE(State_F1_PreHandler_Called); - RETURN_META(g_F1Pre_WhatToDo); - } - - void Post() - { - ADD_STATE(State_F1_PostHandler_Called); - RETURN_META(g_F1Post_WhatToDo); - } -}; - -META_RES g_F299Pre_WhatToDo; -bool g_F299Pre_WhatToRet; - -bool F299_Pre(const char *mwah) -{ - ADD_STATE(State_F299_PreHandlerCalled(mwah)); - RETURN_META_VALUE(g_F299Pre_WhatToDo, g_F299Pre_WhatToRet); -} - -bool F299_Post(const char *mwah) -{ - ADD_STATE(State_F299_PostHandlerCalled(mwah)); - RETURN_META_VALUE(MRES_OVERRIDE, META_RESULT_STATUS >= MRES_OVERRIDE ? !META_RESULT_OVERRIDE_RET(bool) : - !META_RESULT_ORIG_RET(bool)); } bool TestBasic(std::string &error) @@ -698,5 +710,27 @@ bool TestBasic(std::string &error) new State_F1_CallClassReleased, NULL), "Part 11"); + // 12) Test? Test. + SH_ADD_HOOK_MEMFUNC(Test, F1, pTest, &f1_handlers, &HandlersF1::Pre, true); + SH_ADD_HOOK_MEMFUNC(Test, F2, pTest, &f1_handlers, &HandlersF1::Pre, true); + SH_ADD_HOOK_MEMFUNC(Test, F3, pTest, &f1_handlers, &HandlersF1::Pre, false); + SH_ADD_HOOK_MEMFUNC(Test, F4, pTest, &f1_handlers, &HandlersF1::Pre, true); + SH_ADD_HOOK_MEMFUNC(Test, F5, pTest, &f1_handlers, &HandlersF1::Pre, false); + SH_ADD_HOOK_MEMFUNC(Test, F6, pTest, &f1_handlers, &HandlersF1::Pre, true); + SH_ADD_HOOK_MEMFUNC(Test, F7, pTest, &f1_handlers, &HandlersF1::Pre, false); + SH_ADD_HOOK_MEMFUNC(Test, F8, pTest, &f1_handlers, &HandlersF1::Pre, false); + SH_ADD_HOOK_MEMFUNC(Test, F9, pTest, &f1_handlers, &HandlersF1::Pre, false); + SH_ADD_HOOK_MEMFUNC(Test, F10, pTest, &f1_handlers, &HandlersF1::Pre, false); + + SH_REMOVE_HOOK_MEMFUNC(Test, F1, pTest, &f1_handlers, &HandlersF1::Pre, true); + SH_REMOVE_HOOK_MEMFUNC(Test, F2, pTest, &f1_handlers, &HandlersF1::Pre, true); + SH_REMOVE_HOOK_MEMFUNC(Test, F3, pTest, &f1_handlers, &HandlersF1::Pre, false); + SH_REMOVE_HOOK_MEMFUNC(Test, F4, pTest, &f1_handlers, &HandlersF1::Pre, true); + SH_REMOVE_HOOK_MEMFUNC(Test, F5, pTest, &f1_handlers, &HandlersF1::Pre, false); + SH_REMOVE_HOOK_MEMFUNC(Test, F6, pTest, &f1_handlers, &HandlersF1::Pre, true); + SH_REMOVE_HOOK_MEMFUNC(Test, F7, pTest, &f1_handlers, &HandlersF1::Pre, false); + SH_REMOVE_HOOK_MEMFUNC(Test, F8, pTest, &f1_handlers, &HandlersF1::Pre, false); + SH_REMOVE_HOOK_MEMFUNC(Test, F9, pTest, &f1_handlers, &HandlersF1::Pre, false); + SH_REMOVE_HOOK_MEMFUNC(Test, F10, pTest, &f1_handlers, &HandlersF1::Pre, false); return true; } \ No newline at end of file diff --git a/sourcehook/test/testevents.h b/sourcehook/test/testevents.h index 1c086c4..00cbef3 100644 --- a/sourcehook/test/testevents.h +++ b/sourcehook/test/testevents.h @@ -1,67 +1,70 @@ #ifndef __TESTEVENTS_H__ #define __TESTEVENTS_H__ -struct State +namespace { - virtual ~State() + + struct State { + virtual ~State() + { - } + } - virtual bool IsEqual(State *other) + virtual bool IsEqual(State *other) + { + return (typeid(other) == typeid(this)) ? true : false; + } + }; + + typedef std::list StateList; + + #define ADD_STATE(name) g_States.push_back(new name) + + + bool StatesOk(StateList *sl, ...) { - return (typeid(other) == typeid(this)) ? true : false; - } -}; + StateList requiredstates; + va_list argptr; + va_start(argptr, sl); + while (true) + { + State *cs = va_arg(argptr, State*); + if (!cs) + break; + requiredstates.push_back(cs); + } + va_end(argptr); -typedef std::list StateList; -StateList g_States; + if (requiredstates.size() != sl->size()) + { + for (StateList::iterator iter = requiredstates.begin(); iter != requiredstates.end(); ++iter) + delete *iter; + for (StateList::iterator iter = sl->begin(); iter != sl->end(); ++iter) + delete *iter; + sl->clear(); + return false; + } -#define ADD_STATE(name) g_States.push_back(new name) + bool ok = true; + StateList::iterator req_iter = requiredstates.begin(); + for (StateList::iterator o_iter = sl->begin(); o_iter != sl->end(); ++o_iter, ++req_iter) + { + if (!(*o_iter)->IsEqual(*req_iter)) + { + ok = false; + break; + } + } - -bool StatesOk(StateList *sl, ...) -{ - StateList requiredstates; - va_list argptr; - va_start(argptr, sl); - while (true) - { - State *cs = va_arg(argptr, State*); - if (!cs) - break; - requiredstates.push_back(cs); - } - va_end(argptr); - - if (requiredstates.size() != sl->size()) - { for (StateList::iterator iter = requiredstates.begin(); iter != requiredstates.end(); ++iter) delete *iter; for (StateList::iterator iter = sl->begin(); iter != sl->end(); ++iter) delete *iter; sl->clear(); - return false; + + return ok; } - - bool ok = true; - StateList::iterator req_iter = requiredstates.begin(); - for (StateList::iterator o_iter = sl->begin(); o_iter != sl->end(); ++o_iter, ++req_iter) - { - if (!(*o_iter)->IsEqual(*req_iter)) - { - ok = false; - break; - } - } - - for (StateList::iterator iter = requiredstates.begin(); iter != requiredstates.end(); ++iter) - delete *iter; - for (StateList::iterator iter = sl->begin(); iter != sl->end(); ++iter) - delete *iter; - sl->clear(); - - return ok; } #define CHECK_STATES(mwah, myerr) if (!StatesOk mwah) { error=myerr; return false; }