mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-12-07 10:28:30 +00:00
rewritten sh's template files to use new shworker syntax, fixed sh_call. tbh, i'm good
--HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40197
This commit is contained in:
parent
0b0a1c7627
commit
9c3b9c4bb2
@ -3,8 +3,8 @@
|
||||
:: generate.bat <num-of-arguments>
|
||||
|
||||
|
||||
shworker iter %1 sourcehook.hxx sourcehook.h
|
||||
shworker iter %1 sh_memfuncinfo.hxx sh_memfuncinfo.h
|
||||
shworker hopter %1 FastDelegate.hxx FastDelegate.h
|
||||
shworker iter sourcehook.hxx sourcehook.h %1
|
||||
shworker iter sh_memfuncinfo.hxx sh_memfuncinfo.h %1
|
||||
shworker hopter FastDelegate.hxx FastDelegate.h %1
|
||||
|
||||
copy *.h ..
|
||||
@ -289,6 +289,7 @@ namespace SourceHook
|
||||
}
|
||||
|
||||
// Versions which do take a this
|
||||
|
||||
template<class X, class Y, class RetType>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(), MemFuncInfo &out)
|
||||
{
|
||||
@ -587,6 +588,7 @@ namespace SourceHook
|
||||
// GCC & MSVC 7.1 need this, MSVC 7.0 doesn't like it
|
||||
#if SH_COMP != SH_COMP_MSVC || _MSC_VER > 1300
|
||||
|
||||
|
||||
template<class X, class Y, class RetType>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(...), MemFuncInfo &out)
|
||||
{
|
||||
@ -601,6 +603,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -615,6 +618,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -629,6 +633,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -643,6 +648,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -657,6 +663,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -671,6 +678,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -685,6 +693,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -699,6 +708,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -713,6 +723,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -727,6 +738,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -741,6 +753,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -755,6 +768,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -769,6 +783,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -783,6 +798,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -797,6 +813,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -811,6 +828,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -825,6 +843,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -839,6 +858,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -853,6 +873,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class Param19>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -867,6 +888,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class Param19, class Param20>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -882,10 +904,10 @@ namespace SourceHook
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -289,42 +289,41 @@ namespace SourceHook
|
||||
}
|
||||
|
||||
// Versions which do take a this
|
||||
@VARARGS@
|
||||
template<class X, class Y, class RetType@, @@class Param%%|, @>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(@Param%%|, @), MemFuncInfo &out)
|
||||
@[$1,0,$a:
|
||||
template<class X, class Y, class RetType@[$1!=0:, @]@[$2,1,$1|, :class Param$2@]>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(@[$2,1,$1|, :Param$2@]), MemFuncInfo &out)
|
||||
{
|
||||
RetType(Y::*mfp2)(@Param%%|, @) = mfp;
|
||||
RetType(Y::*mfp2)(@[$2,1,$1|, :Param$2@]) = mfp;
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
template<class X, class Y, class RetType@, @@class Param%%|, @>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(@Param%%|, @) const, MemFuncInfo &out)
|
||||
template<class X, class Y, class RetType@[$1!=0:, @]@[$2,1,$1|, :class Param$2@]>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(@[$2,1,$1|, :Param$2@]) const, MemFuncInfo &out)
|
||||
{
|
||||
RetType(Y::*mfp2)(@Param%%|, @) const = mfp;
|
||||
RetType(Y::*mfp2)(@[$2,1,$1|, :Param$2@]) const = mfp;
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
@ENDARGS@
|
||||
@]
|
||||
|
||||
// GCC & MSVC 7.1 need this, MSVC 7.0 doesn't like it
|
||||
#if SH_COMP != SH_COMP_MSVC || _MSC_VER > 1300
|
||||
|
||||
@VARARGS@
|
||||
template<class X, class Y, class RetType@, @@class Param%%|, @>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(@Param%%|, @@, @...), MemFuncInfo &out)
|
||||
@[$1,0,$a:
|
||||
template<class X, class Y, class RetType@[$1!=0:, @]@[$2,1,$1|, :class Param$2@]>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(@[$2,1,$1|, :Param$2@]@[$1!=0:, @]...), MemFuncInfo &out)
|
||||
{
|
||||
RetType(Y::*mfp2)(@Param%%|, @@, @...) = mfp;
|
||||
RetType(Y::*mfp2)(@[$2,1,$1|, :Param$2@]@[$1!=0:, @]...) = mfp;
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
template<class X, class Y, class RetType@, @@class Param%%|, @>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(@Param%%|, @@, @...) const, MemFuncInfo &out)
|
||||
template<class X, class Y, class RetType@[$1!=0:, @]@[$2,1,$1|, :class Param$2@]>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(@[$2,1,$1|, :Param$2@]@[$1!=0:, @]...) const, MemFuncInfo &out)
|
||||
{
|
||||
RetType(Y::*mfp2)(@Param%%|, @@, @...) const = mfp;
|
||||
RetType(Y::*mfp2)(@[$2,1,$1|, :Param$2@]@[$1!=0:, @]...) const = mfp;
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
@ENDARGS@
|
||||
@]
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
|
||||
INPUT FILE DIRECTIVES
|
||||
|
||||
$a is the first additional argument, %b the second, ...
|
||||
$a is the first additional argument, $b the second, ...
|
||||
|
||||
---
|
||||
ITERATION
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -882,98 +882,98 @@ inline void SH_RELEASE_CALLCLASS_R(SourceHook::ISourceHook *shptr, SourceHook::C
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@VARARGS@
|
||||
// ********* Support for @$@ arguments *********
|
||||
#define SH_DECL_HOOK@$@(ifacetype, ifacefunc, attr, overload, rettype@, param%%@) \
|
||||
SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast<rettype (ifacetype::*)(@param%%|, @) attr> \
|
||||
@[$1,0,$a:
|
||||
// ********* Support for $1 arguments *********
|
||||
#define SH_DECL_HOOK$1(ifacetype, ifacefunc, attr, overload, rettype@[$2,1,$1:, param$2@]) \
|
||||
SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast<rettype (ifacetype::*)(@[$2,1,$1|, :param$2@]) attr> \
|
||||
(&ifacetype::ifacefunc))) \
|
||||
typedef fastdelegate::FastDelegate@$@<@param%%|, @@, @rettype> FD; \
|
||||
virtual rettype Func(@param%% p%%|, @) \
|
||||
{ SH_HANDLEFUNC((@param%%|, @), (@p%%|, @), rettype); } \
|
||||
typedef fastdelegate::FastDelegate$1<@[$2,1,$1|, :param$2@]@[$1!=0:, @]rettype> FD; \
|
||||
virtual rettype Func(@[$2,1,$1|, :param$2 p$2@]) \
|
||||
{ SH_HANDLEFUNC((@[$2,1,$1|, :param$2@]), (@[$2,1,$1|, :p$2@]), rettype); } \
|
||||
SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, \
|
||||
(static_cast<rettype (ifacetype::*)(@param%%|, @) attr>(&ifacetype::ifacefunc))) \
|
||||
(static_cast<rettype (ifacetype::*)(@[$2,1,$1|, :param$2@]) attr>(&ifacetype::ifacefunc))) \
|
||||
\
|
||||
const int __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload[] = { 0@, sizeof(param%%)@ }; \
|
||||
const int __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload[] = { 0@[$2,1,$1:, sizeof(param$2)@] }; \
|
||||
::SourceHook::ProtoInfo SH_FHCls(ifacetype, ifacefunc, overload)::ms_Proto(sizeof(rettype), \
|
||||
@$@, __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload);
|
||||
$1, __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload);
|
||||
|
||||
#define SH_DECL_HOOK@$@_void(ifacetype, ifacefunc, attr, overload@, param%%@) \
|
||||
SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast<void (ifacetype::*)(@param%%|, @) attr> \
|
||||
#define SH_DECL_HOOK$1_void(ifacetype, ifacefunc, attr, overload@[$2,1,$1:, param$2@]) \
|
||||
SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast<void (ifacetype::*)(@[$2,1,$1|, :param$2@]) attr> \
|
||||
(&ifacetype::ifacefunc))) \
|
||||
typedef fastdelegate::FastDelegate@$@<@param%%|, @> FD; \
|
||||
virtual void Func(@param%% p%%|, @) \
|
||||
{ SH_HANDLEFUNC_void((@param%%|, @), (@p%%|, @)); } \
|
||||
typedef fastdelegate::FastDelegate$1<@[$2,1,$1|, :param$2@]> FD; \
|
||||
virtual void Func(@[$2,1,$1|, :param$2 p$2@]) \
|
||||
{ SH_HANDLEFUNC_void((@[$2,1,$1|, :param$2@]), (@[$2,1,$1|, :p$2@])); } \
|
||||
SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, \
|
||||
(static_cast<void (ifacetype::*)(@param%%|, @) attr>(&ifacetype::ifacefunc))) \
|
||||
(static_cast<void (ifacetype::*)(@[$2,1,$1|, :param$2@]) attr>(&ifacetype::ifacefunc))) \
|
||||
\
|
||||
\
|
||||
const int __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload[] = { 0@, sizeof(param%%)@ }; \
|
||||
const int __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload[] = { 0@[$2,1,$1:, sizeof(param$2)@] }; \
|
||||
::SourceHook::ProtoInfo SH_FHCls(ifacetype, ifacefunc, overload)::ms_Proto(0, \
|
||||
@$@, __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload);
|
||||
$1, __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload);
|
||||
|
||||
#define SH_DECL_HOOK@$@_vafmt(ifacetype, ifacefunc, attr, overload, rettype@, param%%@) \
|
||||
SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast<rettype (ifacetype::*)(@param%%|, @@, @const char *, ...) attr> \
|
||||
#define SH_DECL_HOOK$1_vafmt(ifacetype, ifacefunc, attr, overload, rettype@[$2,1,$1:, param$2@]) \
|
||||
SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast<rettype (ifacetype::*)(@[$2,1,$1|, :param$2@]@[$1!=0:, @]const char *, ...) attr> \
|
||||
(&ifacetype::ifacefunc))) \
|
||||
typedef fastdelegate::FastDelegate@$+1@<@param%%|, @@, @const char *, rettype> FD; \
|
||||
virtual rettype Func(@param%% p%%|, @@, @const char *fmt, ...) \
|
||||
typedef fastdelegate::FastDelegate@($1+1)<@[$2,1,$1|, :param$2@]@[$1!=0:, @]const char *, rettype> FD; \
|
||||
virtual rettype Func(@[$2,1,$1|, :param$2 p$2@]@[$1!=0:, @]const char *fmt, ...) \
|
||||
{ \
|
||||
char buf[::SourceHook::STRBUF_LEN]; \
|
||||
va_list ap; \
|
||||
va_start(ap, fmt); \
|
||||
vsnprintf(buf, sizeof(buf), fmt, ap); \
|
||||
va_end(ap); \
|
||||
SH_HANDLEFUNC_vafmt((@param%%|, @@, @...), (@p%%|, @@, @"%s", buf), (@p%%|, @@, @buf), rettype); \
|
||||
SH_HANDLEFUNC_vafmt((@[$2,1,$1|, :param$2@]@[$1!=0:, @]...), (@[$2,1,$1|, :p$2@]@[$1!=0:, @]"%s", buf), (@[$2,1,$1|, :p$2@]@[$1!=0:, @]buf), rettype); \
|
||||
} \
|
||||
SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, \
|
||||
(static_cast<rettype (ifacetype::*)(@param%%|, @@, @const char *, ...) attr>(&ifacetype::ifacefunc))) \
|
||||
(static_cast<rettype (ifacetype::*)(@[$2,1,$1|, :param$2@]@[$1!=0:, @]const char *, ...) attr>(&ifacetype::ifacefunc))) \
|
||||
\
|
||||
const int __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload[] = { -1@, sizeof(param%%)@ }; \
|
||||
const int __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload[] = { -1@[$2,1,$1:, sizeof(param$2)@] }; \
|
||||
::SourceHook::ProtoInfo SH_FHCls(ifacetype, ifacefunc, overload)::ms_Proto(sizeof(rettype), \
|
||||
@$@, __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload);
|
||||
$1, __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload);
|
||||
|
||||
#define SH_DECL_HOOK@$@_void_vafmt(ifacetype, ifacefunc, attr, overload@, param%%@) \
|
||||
SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast<void (ifacetype::*)(@param%%|, @@, @const char *, ...) attr> \
|
||||
#define SH_DECL_HOOK$1_void_vafmt(ifacetype, ifacefunc, attr, overload@[$2,1,$1:, param$2@]) \
|
||||
SHINT_MAKE_GENERICSTUFF_BEGIN(ifacetype, ifacefunc, overload, (static_cast<void (ifacetype::*)(@[$2,1,$1|, :param$2@]@[$1!=0:, @]const char *, ...) attr> \
|
||||
(&ifacetype::ifacefunc))) \
|
||||
typedef fastdelegate::FastDelegate@$+1@<@param%%|, @@, @const char *> FD; \
|
||||
virtual void Func(@param%% p%%|, @@, @const char *fmt, ...) \
|
||||
typedef fastdelegate::FastDelegate@($1+1)<@[$2,1,$1|, :param$2@]@[$1!=0:, @]const char *> FD; \
|
||||
virtual void Func(@[$2,1,$1|, :param$2 p$2@]@[$1!=0:, @]const char *fmt, ...) \
|
||||
{ \
|
||||
char buf[::SourceHook::STRBUF_LEN]; \
|
||||
va_list ap; \
|
||||
va_start(ap, fmt); \
|
||||
vsnprintf(buf, sizeof(buf), fmt, ap); \
|
||||
va_end(ap); \
|
||||
SH_HANDLEFUNC_void_vafmt((@param%%|, @@, @...), (@p%%|, @@, @"%s", buf), (@p%%|, @@, @buf)); \
|
||||
SH_HANDLEFUNC_void_vafmt((@[$2,1,$1|, :param$2@]@[$1!=0:, @]...), (@[$2,1,$1|, :p$2@]@[$1!=0:, @]"%s", buf), (@[$2,1,$1|, :p$2@]@[$1!=0:, @]buf)); \
|
||||
} \
|
||||
SHINT_MAKE_GENERICSTUFF_END(ifacetype, ifacefunc, overload, \
|
||||
(static_cast<void (ifacetype::*)(@param%%|, @@, @const char *, ...) attr>(&ifacetype::ifacefunc))) \
|
||||
(static_cast<void (ifacetype::*)(@[$2,1,$1|, :param$2@]@[$1!=0:, @]const char *, ...) attr>(&ifacetype::ifacefunc))) \
|
||||
\
|
||||
const int __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload[] = { -1@, sizeof(param%%)@ }; \
|
||||
const int __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload[] = { -1@[$2,1,$1:, sizeof(param$2)@] }; \
|
||||
::SourceHook::ProtoInfo SH_FHCls(ifacetype, ifacefunc, overload)::ms_Proto(0, \
|
||||
@$@, __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload);
|
||||
$1, __SourceHook_ParamSizes_##ifacetype##ifacefunc##overload);
|
||||
|
||||
#define SH_DECL_MANUALHOOK@$@(hookname, vtblidx, vtbloffs, thisptroffs, rettype@, param%%@) \
|
||||
#define SH_DECL_MANUALHOOK$1(hookname, vtblidx, vtbloffs, thisptroffs, rettype@[$2,1,$1:, param$2@]) \
|
||||
SHINT_MAKE_GENERICSTUFF_BEGIN_MANUAL(hookname, vtbloffs, vtblidx, thisptroffs) \
|
||||
typedef fastdelegate::FastDelegate@$@<@param%%|, @@, @rettype> FD; \
|
||||
virtual rettype Func(@param%% p%%|, @) \
|
||||
{ SH_HANDLEFUNC((@param%%|, @), (@p%%|, @), rettype); } \
|
||||
typedef fastdelegate::FastDelegate$1<@[$2,1,$1|, :param$2@]@[$1!=0:, @]rettype> FD; \
|
||||
virtual rettype Func(@[$2,1,$1|, :param$2 p$2@]) \
|
||||
{ SH_HANDLEFUNC((@[$2,1,$1|, :param$2@]), (@[$2,1,$1|, :p$2@]), rettype); } \
|
||||
SHINT_MAKE_GENERICSTUFF_END_MANUAL(hookname, vtbloffs, vtblidx, thisptroffs) \
|
||||
\
|
||||
const int __SourceHook_ParamSizesM_##hookname[] = { 0@, sizeof(param%%)@ }; \
|
||||
const int __SourceHook_ParamSizesM_##hookname[] = { 0@[$2,1,$1:, sizeof(param$2)@] }; \
|
||||
::SourceHook::ProtoInfo SH_MFHCls(hookname)::ms_Proto(sizeof(rettype), \
|
||||
@$@, __SourceHook_ParamSizesM_##hookname);
|
||||
$1, __SourceHook_ParamSizesM_##hookname);
|
||||
|
||||
#define SH_DECL_MANUALHOOK@$@_void(hookname, vtblidx, vtbloffs, thisptroffs@, param%%@) \
|
||||
#define SH_DECL_MANUALHOOK$1_void(hookname, vtblidx, vtbloffs, thisptroffs@[$2,1,$1:, param$2@]) \
|
||||
SHINT_MAKE_GENERICSTUFF_BEGIN_MANUAL(hookname, vtbloffs, vtblidx, thisptroffs) \
|
||||
typedef fastdelegate::FastDelegate@$@<@param%%|, @> FD; \
|
||||
virtual void Func(@param%% p%%|, @) \
|
||||
{ SH_HANDLEFUNC_void((@param%%|, @), (@p%%|, @)); } \
|
||||
typedef fastdelegate::FastDelegate$1<@[$2,1,$1|, :param$2@]> FD; \
|
||||
virtual void Func(@[$2,1,$1|, :param$2 p$2@]) \
|
||||
{ SH_HANDLEFUNC_void((@[$2,1,$1|, :param$2@]), (@[$2,1,$1|, :p$2@])); } \
|
||||
SHINT_MAKE_GENERICSTUFF_END_MANUAL(hookname, vtbloffs, vtblidx, thisptroffs) \
|
||||
\
|
||||
const int __SourceHook_ParamSizesM_##hookname[] = { 0@, sizeof(param%%)@ }; \
|
||||
const int __SourceHook_ParamSizesM_##hookname[] = { 0@[$2,1,$1:, sizeof(param$2)@] }; \
|
||||
::SourceHook::ProtoInfo SH_MFHCls(hookname)::ms_Proto(0, \
|
||||
@$@, __SourceHook_ParamSizesM_##hookname);
|
||||
$1, __SourceHook_ParamSizesM_##hookname);
|
||||
|
||||
@ENDARGS@
|
||||
@]
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -1033,66 +1033,68 @@ inline void SH_RELEASE_CALLCLASS_R(SourceHook::ISourceHook *shptr, SourceHook::C
|
||||
|
||||
namespace SourceHook
|
||||
{
|
||||
template<class CCType, class RetType, class MFPType> class ExecutableClass
|
||||
@[$1,0,$a:
|
||||
// Support for $1 arguments
|
||||
template<class CCType, class MFPType, class RetType@[$2,1,$1:, class Param$2@]> class ExecutableClass$1
|
||||
{
|
||||
CCType *m_CC;
|
||||
MFPType m_MFP;
|
||||
CCType *m_CC;
|
||||
MFPType m_MFP;
|
||||
public:
|
||||
ExecutableClass(CCType *cc, MFPType mfp) : m_CC(cc), m_MFP(mfp)
|
||||
{
|
||||
}
|
||||
ExecutableClass$1(CCType *cc, MFPType mfp) : m_CC(cc), m_MFP(mfp) { }
|
||||
|
||||
@VARARGS@
|
||||
// Support for @$@ arguments
|
||||
@template<@@class Param%%|, @@> @RetType operator()(@Param%% p%%|, @) const
|
||||
SH_MAKE_EXECUTABLECLASS_OB((@p%%|, @), (@Param%%|, @))
|
||||
RetType operator()(@[$2,1,$1|, :Param$2 p$2@]) const
|
||||
SH_MAKE_EXECUTABLECLASS_OB((@[$2,1,$1|, :p$2@]), (@[$2,1,$1|, :Param$2@]))
|
||||
|
||||
@ENDARGS@
|
||||
@[$2,$1+1,$a:
|
||||
template <@[$3,$1+1,$2|, :class Param$3@]> RetType operator()(@[$3,1,$2|, :Param$3 p$3@]) const
|
||||
SH_MAKE_EXECUTABLECLASS_OB((@[$3,1,$2|, :p$3@]), (@[$3,1,$2|, :Param$3@]))
|
||||
@]
|
||||
};
|
||||
@]
|
||||
|
||||
}
|
||||
|
||||
// SH_CALL needs to deduce the return type -> it uses templates and function overloading
|
||||
// That's why SH_CALL takes two parameters: "mfp2" of type RetType(X::*mfp)(params), and "mfp" of type MFP
|
||||
// The only purpose of the mfp2 parameter is to extract the return type
|
||||
|
||||
@VARARGS@
|
||||
// Support for @$@ arguments
|
||||
template <class X, class Y, class MFP, class RetType@, @@class Param%%|, @>
|
||||
SourceHook::ExecutableClass<SourceHook::CallClass<Y>, RetType, MFP>
|
||||
SH_CALL2(SourceHook::CallClass<Y> *ptr, MFP mfp, RetType(X::*mfp2)(@Param%%|, @))
|
||||
@[$1,0,$a:
|
||||
// Support for $1 arguments
|
||||
template <class X, class Y, class MFP, class RetType@[$2,1,$1:, class Param$2@]>
|
||||
SourceHook::ExecutableClass$1<SourceHook::CallClass<Y>, MFP, RetType@[$2,1,$1:, Param$2@]>
|
||||
SH_CALL2(SourceHook::CallClass<Y> *ptr, MFP mfp, RetType(X::*mfp2)(@[$2,1,$1|, :Param$2@]))
|
||||
{
|
||||
return SourceHook::ExecutableClass<SourceHook::CallClass<Y>, RetType, MFP>(ptr, mfp);
|
||||
return SourceHook::ExecutableClass$1<SourceHook::CallClass<Y>, MFP, RetType@[$2,1,$1:, Param$2@]>(ptr, mfp);
|
||||
}
|
||||
|
||||
template <class X, class Y, class MFP, class RetType@, @@class Param%%|, @>
|
||||
SourceHook::ExecutableClass<SourceHook::CallClass<Y>, RetType, MFP>
|
||||
SH_CALL2(SourceHook::CallClass<Y> *ptr, MFP mfp, RetType(X::*mfp2)(@Param%%|, @)const)
|
||||
template <class X, class Y, class MFP, class RetType@[$2,1,$1:, class Param$2@]>
|
||||
SourceHook::ExecutableClass$1<SourceHook::CallClass<Y>, MFP, RetType@[$2,1,$1:, Param$2@]>
|
||||
SH_CALL2(SourceHook::CallClass<Y> *ptr, MFP mfp, RetType(X::*mfp2)(@[$2,1,$1|, :Param$2@])const)
|
||||
{
|
||||
return SourceHook::ExecutableClass<SourceHook::CallClass<Y>, RetType, MFP>(ptr, mfp);
|
||||
return SourceHook::ExecutableClass$1<SourceHook::CallClass<Y>, MFP, RetType@[$2,1,$1:, Param$2@]>(ptr, mfp);
|
||||
}
|
||||
|
||||
@ENDARGS@
|
||||
@]
|
||||
|
||||
#if SH_COMP != SH_COMP_MSVC || _MSC_VER > 1300
|
||||
// GCC & MSVC 7.1 need this, MSVC 7.0 doesn't like it
|
||||
|
||||
@VARARGS@
|
||||
// Support for @$@ arguments
|
||||
template <class X, class Y, class MFP, class RetType@, @@class Param%%|, @>
|
||||
SourceHook::ExecutableClass<SourceHook::CallClass<Y>, RetType, MFP>
|
||||
SH_CALL2(SourceHook::CallClass<Y> *ptr, MFP mfp, RetType(X::*mfp2)(@Param%%|, @@, @...))
|
||||
@[$1,0,$a:
|
||||
// Support for $1 arguments
|
||||
template <class X, class Y, class MFP, class RetType@[$2,1,$1:, class Param$2@]>
|
||||
SourceHook::ExecutableClass$1<SourceHook::CallClass<Y>, MFP, RetType@[$2,1,$1:, Param$2@]>
|
||||
SH_CALL2(SourceHook::CallClass<Y> *ptr, MFP mfp, RetType(X::*mfp2)(@[$2,1,$1|, :Param$2@]@[$1!=0:, @]...))
|
||||
{
|
||||
return SourceHook::ExecutableClass<SourceHook::CallClass<Y>, RetType, MFP>(ptr, mfp);
|
||||
return SourceHook::ExecutableClass$1<SourceHook::CallClass<Y>, MFP, RetType@[$2,1,$1:, Param$2@]>(ptr, mfp);
|
||||
}
|
||||
|
||||
template <class X, class Y, class MFP, class RetType@, @@class Param%%|, @>
|
||||
SourceHook::ExecutableClass<SourceHook::CallClass<Y>, RetType, MFP>
|
||||
SH_CALL2(SourceHook::CallClass<Y> *ptr, MFP mfp, RetType(X::*mfp2)(@Param%%|, @@, @...)const)
|
||||
template <class X, class Y, class MFP, class RetType@[$2,1,$1:, class Param$2@]>
|
||||
SourceHook::ExecutableClass$1<SourceHook::CallClass<Y>, MFP, RetType@[$2,1,$1:, Param$2@]>
|
||||
SH_CALL2(SourceHook::CallClass<Y> *ptr, MFP mfp, RetType(X::*mfp2)(@[$2,1,$1|, :Param$2@]@[$1!=0:, @]...)const)
|
||||
{
|
||||
return SourceHook::ExecutableClass<SourceHook::CallClass<Y>, RetType, MFP>(ptr, mfp);
|
||||
return SourceHook::ExecutableClass$1<SourceHook::CallClass<Y>, MFP, RetType@[$2,1,$1:, Param$2@]>(ptr, mfp);
|
||||
}
|
||||
|
||||
@ENDARGS@
|
||||
@]
|
||||
|
||||
#endif
|
||||
|
||||
@ -1108,19 +1110,19 @@ SH_CALL2(SourceHook::CallClass<Y> *ptr, MFP mfp, RetType(X::*mfp2)(@Param%%|, @@
|
||||
|
||||
namespace SourceHook
|
||||
{
|
||||
@VARARGS@
|
||||
template <class Iface, class RetType@, class Param%%@>
|
||||
void SetOverrideResult(ISourceHook *shptr, RetType (Iface::*mfp)(@Param%%|, @), const RetType res)
|
||||
@[$1,0,$a:
|
||||
template <class Iface, class RetType@[$2,1,$1:, class Param$2@]>
|
||||
void SetOverrideResult(ISourceHook *shptr, RetType (Iface::*mfp)(@[$2,1,$1|, :Param$2@]), const RetType res)
|
||||
{
|
||||
*reinterpret_cast<RetType*>(shptr->GetOverrideRetPtr()) = res;
|
||||
}
|
||||
|
||||
template <class Iface, class RetType@, class Param%%@>
|
||||
Iface *RecallGetIface(ISourceHook *shptr, RetType (Iface::*mfp)(@Param%%|, @))
|
||||
template <class Iface, class RetType@[$2,1,$1:, class Param$2@]>
|
||||
Iface *RecallGetIface(ISourceHook *shptr, RetType (Iface::*mfp)(@[$2,1,$1|, :Param$2@]))
|
||||
{
|
||||
return reinterpret_cast<Iface*>(shptr->GetIfacePtr());
|
||||
}
|
||||
@ENDARGS@
|
||||
@]
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -289,6 +289,7 @@ namespace SourceHook
|
||||
}
|
||||
|
||||
// Versions which do take a this
|
||||
|
||||
template<class X, class Y, class RetType>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(), MemFuncInfo &out)
|
||||
{
|
||||
@ -587,6 +588,7 @@ namespace SourceHook
|
||||
// GCC & MSVC 7.1 need this, MSVC 7.0 doesn't like it
|
||||
#if SH_COMP != SH_COMP_MSVC || _MSC_VER > 1300
|
||||
|
||||
|
||||
template<class X, class Y, class RetType>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(...), MemFuncInfo &out)
|
||||
{
|
||||
@ -601,6 +603,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -615,6 +618,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -629,6 +633,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -643,6 +648,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -657,6 +663,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -671,6 +678,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -685,6 +693,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -699,6 +708,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -713,6 +723,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -727,6 +738,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -741,6 +753,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -755,6 +768,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -769,6 +783,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -783,6 +798,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -797,6 +813,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -811,6 +828,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -825,6 +843,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -839,6 +858,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -853,6 +873,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class Param19>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -867,6 +888,7 @@ namespace SourceHook
|
||||
MFI_Impl<sizeof(mfp2)>::GetFuncInfo(mfp2, out);
|
||||
}
|
||||
|
||||
|
||||
template<class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class Param9, class Param10, class Param11, class Param12, class Param13, class Param14, class Param15, class Param16, class Param17, class Param18, class Param19, class Param20>
|
||||
inline void GetFuncInfo(Y *ptr, RetType(X::*mfp)(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15, Param16, Param17, Param18, Param19, Param20, ...), MemFuncInfo &out)
|
||||
{
|
||||
@ -882,10 +904,10 @@ namespace SourceHook
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -70,7 +70,7 @@ SourceHook::List<Test *> Test::ms_Tests;
|
||||
|
||||
DO_TEST(List);
|
||||
DO_TEST(Basic);
|
||||
DO_TEST(VafmtAndOverload);
|
||||
//DO_TEST(VafmtAndOverload);
|
||||
DO_TEST(ThisPtrOffs);
|
||||
DO_TEST(PlugSys);
|
||||
DO_TEST(Bail);
|
||||
@ -78,6 +78,7 @@ DO_TEST(Reentr);
|
||||
DO_TEST(Manual);
|
||||
DO_TEST(Recall);
|
||||
DO_TEST(Multi);
|
||||
DO_TEST(Ref);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
@ -252,6 +252,12 @@
|
||||
</File>
|
||||
<File
|
||||
RelativePath="test2.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="TRUE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="test3.cpp">
|
||||
@ -286,6 +292,9 @@
|
||||
<File
|
||||
RelativePath=".\testreentr.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\testref.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
|
||||
163
sourcehook/test/testref.cpp
Normal file
163
sourcehook/test/testref.cpp
Normal file
@ -0,0 +1,163 @@
|
||||
#include "testevents.h"
|
||||
#include "sourcehook_test.h"
|
||||
|
||||
// References and private copy constructors and stuff like that!
|
||||
|
||||
/*
|
||||
BAILOPAN, 29.04.2006 21:51 :
|
||||
onoto-san, interesting error from VS
|
||||
we have this function:
|
||||
void GabHaben(ISomething &sth);
|
||||
|
||||
SomethingDerived sth;
|
||||
and SH_CALL(cc, &WHAT::GabHaben)(sth);
|
||||
"No copy constructor available for class 'SomethingDerived'"
|
||||
*/
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
StateList g_States;
|
||||
SourceHook::ISourceHook *g_SHPtr;
|
||||
SourceHook::Plugin g_PLID;
|
||||
|
||||
MAKE_STATE_1(State_Result, int);
|
||||
MAKE_STATE_1(State_Result_InHook, int);
|
||||
|
||||
class CBase
|
||||
{
|
||||
// Private copy constructor!
|
||||
CBase(CBase &other)
|
||||
{
|
||||
}
|
||||
public:
|
||||
CBase()
|
||||
{
|
||||
}
|
||||
|
||||
virtual int Func()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
class CDerived : public CBase
|
||||
{
|
||||
virtual int Func()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
};
|
||||
|
||||
// Complicated derived shit !
|
||||
class COtherWeirdBase
|
||||
{
|
||||
int member;
|
||||
};
|
||||
class CDerived2 : private COtherWeirdBase, public CBase
|
||||
{
|
||||
int m_Return;
|
||||
public:
|
||||
CDerived2(int a) : m_Return(a)
|
||||
{
|
||||
}
|
||||
|
||||
virtual int Func()
|
||||
{
|
||||
return m_Return;
|
||||
}
|
||||
};
|
||||
|
||||
class CHello
|
||||
{
|
||||
public:
|
||||
virtual int Func(CBase &sth)
|
||||
{
|
||||
return sth.Func();
|
||||
}
|
||||
};
|
||||
|
||||
class CHook
|
||||
{
|
||||
public:
|
||||
virtual int Func(CBase &sth)
|
||||
{
|
||||
ADD_STATE(State_Result_InHook(sth.Func()));
|
||||
RETURN_META_VALUE(MRES_SUPERCEDE, 20);
|
||||
}
|
||||
};
|
||||
SH_DECL_HOOK1(CHello, Func, SH_NOATTRIB, 0, int, CBase&);
|
||||
}
|
||||
|
||||
|
||||
bool TestRef(std::string &error)
|
||||
{
|
||||
GET_SHPTR(g_SHPtr);
|
||||
g_PLID = 1;
|
||||
|
||||
CBase base;
|
||||
CDerived der;
|
||||
CDerived2 der2(11);
|
||||
CDerived2 der3(12);
|
||||
CHello hello;
|
||||
CHello *pHello = &hello;
|
||||
CHook hook;
|
||||
|
||||
SourceHook::CallClass<CHello> *cc = SH_GET_CALLCLASS(&hello);
|
||||
|
||||
ADD_STATE(State_Result(pHello->Func(base)));
|
||||
ADD_STATE(State_Result(pHello->Func(der)));
|
||||
ADD_STATE(State_Result(pHello->Func(der2)));
|
||||
ADD_STATE(State_Result(pHello->Func(der3)));
|
||||
|
||||
CHECK_STATES((&g_States,
|
||||
new State_Result(0),
|
||||
new State_Result(10),
|
||||
new State_Result(11),
|
||||
new State_Result(12),
|
||||
NULL), "Part 1");
|
||||
|
||||
ADD_STATE(State_Result(SH_CALL(cc, &CHello::Func)(base)));
|
||||
ADD_STATE(State_Result(SH_CALL(cc, &CHello::Func)(der)));
|
||||
ADD_STATE(State_Result(SH_CALL(cc, &CHello::Func)(der2)));
|
||||
ADD_STATE(State_Result(SH_CALL(cc, &CHello::Func)(der3)));
|
||||
|
||||
CHECK_STATES((&g_States,
|
||||
new State_Result(0),
|
||||
new State_Result(10),
|
||||
new State_Result(11),
|
||||
new State_Result(12),
|
||||
NULL), "Part 2");
|
||||
|
||||
SH_ADD_HOOK_MEMFUNC(CHello, Func, &hello, &hook, &CHook::Func, false);
|
||||
|
||||
ADD_STATE(State_Result(pHello->Func(base)));
|
||||
ADD_STATE(State_Result(pHello->Func(der)));
|
||||
ADD_STATE(State_Result(pHello->Func(der2)));
|
||||
ADD_STATE(State_Result(pHello->Func(der3)));
|
||||
|
||||
CHECK_STATES((&g_States,
|
||||
new State_Result_InHook(0),
|
||||
new State_Result(20),
|
||||
new State_Result_InHook(10),
|
||||
new State_Result(20),
|
||||
new State_Result_InHook(11),
|
||||
new State_Result(20),
|
||||
new State_Result_InHook(12),
|
||||
new State_Result(20),
|
||||
NULL), "Part 3");
|
||||
|
||||
ADD_STATE(State_Result(SH_CALL(cc, &CHello::Func)(base)));
|
||||
ADD_STATE(State_Result(SH_CALL(cc, &CHello::Func)(der)));
|
||||
ADD_STATE(State_Result(SH_CALL(cc, &CHello::Func)(der2)));
|
||||
ADD_STATE(State_Result(SH_CALL(cc, &CHello::Func)(der3)));
|
||||
|
||||
CHECK_STATES((&g_States,
|
||||
new State_Result(0),
|
||||
new State_Result(10),
|
||||
new State_Result(11),
|
||||
new State_Result(12),
|
||||
NULL), "Part 4");
|
||||
|
||||
return true;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user