sourcehook/test/testhookmangen.h
branchhookman_autogen
changeset 465 c86a55fbcd88
parent 463 7a413a63426f
child 466 c733f5be0e5d
     1.1 --- a/sourcehook/test/testhookmangen.h	Sun Nov 18 13:12:51 2007 +0000
     1.2 +++ b/sourcehook/test/testhookmangen.h	Sun Nov 18 15:08:03 2007 +0000
     1.3 @@ -507,10 +507,7 @@
     1.4  	struct TestClass##id; \
     1.5  	typedef ParamState0<0 > ParamState_m##id; \
     1.6  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
     1.7 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
     1.8 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
     1.9 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
    1.10 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
    1.11 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
    1.12  	\
    1.13  	struct TestClass##id \
    1.14  	{ \
    1.15 @@ -523,70 +520,25 @@
    1.16  			g_Inside_LeafFunc = false; \
    1.17  		} \
    1.18  		\
    1.19 -		struct Delegate1 : public MyDelegate \
    1.20 +		struct Delegate : public MyDelegate \
    1.21  		{ \
    1.22 +			int m_DelegNumber; \
    1.23 +			Delegate(int num) : m_DelegNumber(num) { } \
    1.24 +			\
    1.25  			virtual void Call() \
    1.26  			{ \
    1.27  				g_Inside_LeafFunc = true; \
    1.28 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id())); \
    1.29 -				g_Inside_LeafFunc = false; \
    1.30 -				if (ms_DoRecall) \
    1.31 -				{ \
    1.32 -					 \
    1.33 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, ()); \
    1.34 -				} \
    1.35 -				else \
    1.36 -					RETURN_META(MRES_IGNORED); \
    1.37 -			} \
    1.38 -		}; \
    1.39 -		struct Delegate2 : public MyDelegate \
    1.40 -		{ \
    1.41 -			virtual void Call() \
    1.42 -			{ \
    1.43 -				g_Inside_LeafFunc = true; \
    1.44 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id())); \
    1.45 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id())); \
    1.46  				g_Inside_LeafFunc = false; \
    1.47  				if (ms_DoRecall) \
    1.48  				{ \
    1.49  					 \
    1.50 -					RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, ()); \
    1.51 -				} \
    1.52 -				else \
    1.53 -					RETURN_META(MRES_SUPERCEDE); \
    1.54 -			} \
    1.55 -		}; \
    1.56 -		struct Delegate3 : public MyDelegate \
    1.57 -		{ \
    1.58 -			virtual void Call() \
    1.59 -			{ \
    1.60 -				g_Inside_LeafFunc = true; \
    1.61 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id())); \
    1.62 -				g_Inside_LeafFunc = false; \
    1.63 -				if (ms_DoRecall) \
    1.64 -				{ \
    1.65 -					 \
    1.66 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, ()); \
    1.67 +					RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, ()); \
    1.68  				} \
    1.69  				else \
    1.70 -					RETURN_META(MRES_IGNORED); \
    1.71 +					RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
    1.72  			} \
    1.73  		}; \
    1.74 -		struct Delegate4 : public MyDelegate \
    1.75 -		{ \
    1.76 -			virtual void Call() \
    1.77 -			{ \
    1.78 -				g_Inside_LeafFunc = true; \
    1.79 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id())); \
    1.80 -				g_Inside_LeafFunc = false; \
    1.81 -				if (ms_DoRecall) \
    1.82 -				{ \
    1.83 -					 \
    1.84 -					RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, ()); \
    1.85 -				} \
    1.86 -				else \
    1.87 -					RETURN_META(MRES_SUPERCEDE); \
    1.88 -			}; \
    1.89 -		}; \
    1.90  	}; \
    1.91  	\
    1.92  	bool TestClass##id::ms_DoRecall = false; \
    1.93 @@ -598,10 +550,7 @@
    1.94  	typedef ret_type RetType##id; \
    1.95  	typedef ParamState0<0 > ParamState_m##id; \
    1.96  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
    1.97 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
    1.98 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
    1.99 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.100 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.101 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.102  	\
   1.103  	struct TestClass##id \
   1.104  	{ \
   1.105 @@ -616,70 +565,25 @@
   1.106  			return MakeRet< ret_type >::Do(0); \
   1.107  		} \
   1.108  		\
   1.109 -		struct Delegate1 : public MyDelegate \
   1.110 +		struct Delegate : public MyDelegate \
   1.111  		{ \
   1.112 +			int m_DelegNumber; \
   1.113 +			Delegate(int num) : m_DelegNumber(num) { } \
   1.114 +			\
   1.115  			virtual ret_type Call() \
   1.116  			{ \
   1.117  				g_Inside_LeafFunc = true; \
   1.118 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id())); \
   1.119 -				g_Inside_LeafFunc = false; \
   1.120 -				if (ms_DoRecall) \
   1.121 -				{ \
   1.122 -					 \
   1.123 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, ()); \
   1.124 -				} \
   1.125 -				else \
   1.126 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
   1.127 -			} \
   1.128 -		}; \
   1.129 -		struct Delegate2 : public MyDelegate \
   1.130 -		{ \
   1.131 -			virtual ret_type Call() \
   1.132 -			{ \
   1.133 -				g_Inside_LeafFunc = true; \
   1.134 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id())); \
   1.135 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id())); \
   1.136  				g_Inside_LeafFunc = false; \
   1.137  				if (ms_DoRecall) \
   1.138  				{ \
   1.139  					 \
   1.140 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, ()); \
   1.141 -				} \
   1.142 -				else \
   1.143 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
   1.144 -			} \
   1.145 -		}; \
   1.146 -		struct Delegate3 : public MyDelegate \
   1.147 -		{ \
   1.148 -			virtual ret_type Call() \
   1.149 -			{ \
   1.150 -				g_Inside_LeafFunc = true; \
   1.151 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id())); \
   1.152 -				g_Inside_LeafFunc = false; \
   1.153 -				if (ms_DoRecall) \
   1.154 -				{ \
   1.155 -					 \
   1.156 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, ()); \
   1.157 +					RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, ()); \
   1.158  				} \
   1.159  				else \
   1.160 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
   1.161 +					RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
   1.162  			} \
   1.163  		}; \
   1.164 -		struct Delegate4 : public MyDelegate \
   1.165 -		{ \
   1.166 -			virtual ret_type Call() \
   1.167 -			{ \
   1.168 -				g_Inside_LeafFunc = true; \
   1.169 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id())); \
   1.170 -				g_Inside_LeafFunc = false; \
   1.171 -				if (ms_DoRecall) \
   1.172 -				{ \
   1.173 -					 \
   1.174 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, ()); \
   1.175 -				} \
   1.176 -				else \
   1.177 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
   1.178 -			}; \
   1.179 -		}; \
   1.180  	}; \
   1.181  	\
   1.182  	bool TestClass##id::ms_DoRecall = false; \
   1.183 @@ -689,10 +593,7 @@
   1.184  	struct TestClass##id; \
   1.185  	typedef ParamState1<0, std::string > ParamState_m##id; \
   1.186  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
   1.187 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.188 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.189 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.190 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.191 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.192  	\
   1.193  	struct TestClass##id \
   1.194  	{ \
   1.195 @@ -713,169 +614,30 @@
   1.196  			g_Inside_LeafFunc = false; \
   1.197  		} \
   1.198  		\
   1.199 -		struct Delegate1 : public MyDelegate \
   1.200 +		struct Delegate : public MyDelegate \
   1.201  		{ \
   1.202 +			int m_DelegNumber; \
   1.203 +			Delegate(int num) : m_DelegNumber(num) { } \
   1.204 +			\
   1.205  			virtual void Call(const char *buf) \
   1.206  			{ \
   1.207  				g_Inside_LeafFunc = true; \
   1.208 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(buf))); \
   1.209 -				g_Inside_LeafFunc = false; \
   1.210 -				if (ms_DoRecall) \
   1.211 -				{ \
   1.212 -					 \
   1.213 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, ("%s!", buf)); \
   1.214 -				} \
   1.215 -				else \
   1.216 -					RETURN_META(MRES_IGNORED); \
   1.217 -			} \
   1.218 -		}; \
   1.219 -		struct Delegate2 : public MyDelegate \
   1.220 -		{ \
   1.221 -			virtual void Call(const char *buf) \
   1.222 -			{ \
   1.223 -				g_Inside_LeafFunc = true; \
   1.224 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(buf))); \
   1.225 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(buf))); \
   1.226  				g_Inside_LeafFunc = false; \
   1.227  				if (ms_DoRecall) \
   1.228  				{ \
   1.229  					 \
   1.230 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, ("%s!", buf)); \
   1.231 -				} \
   1.232 -				else \
   1.233 -					RETURN_META(MRES_SUPERCEDE); \
   1.234 -			} \
   1.235 -		}; \
   1.236 -		struct Delegate3 : public MyDelegate \
   1.237 -		{ \
   1.238 -			virtual void Call(const char *buf) \
   1.239 -			{ \
   1.240 -				g_Inside_LeafFunc = true; \
   1.241 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(buf))); \
   1.242 -				g_Inside_LeafFunc = false; \
   1.243 -				if (ms_DoRecall) \
   1.244 -				{ \
   1.245 -					 \
   1.246 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, ("%s!", buf)); \
   1.247 +					RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, ("%s!", buf)); \
   1.248  				} \
   1.249  				else \
   1.250 -					RETURN_META(MRES_IGNORED); \
   1.251 +					RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
   1.252  			} \
   1.253  		}; \
   1.254 -		struct Delegate4 : public MyDelegate \
   1.255 -		{ \
   1.256 -			virtual void Call(const char *buf) \
   1.257 -			{ \
   1.258 -				g_Inside_LeafFunc = true; \
   1.259 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(buf))); \
   1.260 -				g_Inside_LeafFunc = false; \
   1.261 -				if (ms_DoRecall) \
   1.262 -				{ \
   1.263 -					 \
   1.264 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, ("%s!", buf)); \
   1.265 -				} \
   1.266 -				else \
   1.267 -					RETURN_META(MRES_SUPERCEDE); \
   1.268 -			}; \
   1.269 -		}; \
   1.270  	}; \
   1.271  	\
   1.272  	bool TestClass##id::ms_DoRecall = false; \
   1.273  	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
   1.274  
   1.275 -
   1.276 -#define THGM_MAKE_TEST0_vafmt(id, ret_type) \
   1.277 -	struct TestClass##id; \
   1.278 -	typedef ret_type RetType##id; \
   1.279 -	typedef ParamState0<0 > ParamState_m##id; \
   1.280 -	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
   1.281 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.282 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.283 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.284 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.285 -	\
   1.286 -	struct TestClass##id \
   1.287 -	{ \
   1.288 -		static bool ms_DoRecall; \
   1.289 -		\
   1.290 -		virtual ret_type Func() \
   1.291 -		{ \
   1.292 -			g_Inside_LeafFunc = true; \
   1.293 -			ADD_STATE(State_Func##id(this, ParamState_m##id())); \
   1.294 -			g_Inside_LeafFunc = false; \
   1.295 -			\
   1.296 -			return MakeRet< ret_type >::Do(0); \
   1.297 -		} \
   1.298 -		\
   1.299 -		struct Delegate1 : public MyDelegate \
   1.300 -		{ \
   1.301 -			virtual ret_type Call() \
   1.302 -			{ \
   1.303 -				g_Inside_LeafFunc = true; \
   1.304 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id())); \
   1.305 -				g_Inside_LeafFunc = false; \
   1.306 -				if (ms_DoRecall) \
   1.307 -				{ \
   1.308 -					 \
   1.309 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, ()); \
   1.310 -				} \
   1.311 -				else \
   1.312 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
   1.313 -			} \
   1.314 -		}; \
   1.315 -		struct Delegate2 : public MyDelegate \
   1.316 -		{ \
   1.317 -			virtual ret_type Call() \
   1.318 -			{ \
   1.319 -				g_Inside_LeafFunc = true; \
   1.320 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id())); \
   1.321 -				g_Inside_LeafFunc = false; \
   1.322 -				if (ms_DoRecall) \
   1.323 -				{ \
   1.324 -					 \
   1.325 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, ()); \
   1.326 -				} \
   1.327 -				else \
   1.328 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
   1.329 -			} \
   1.330 -		}; \
   1.331 -		struct Delegate3 : public MyDelegate \
   1.332 -		{ \
   1.333 -			virtual ret_type Call() \
   1.334 -			{ \
   1.335 -				g_Inside_LeafFunc = true; \
   1.336 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id())); \
   1.337 -				g_Inside_LeafFunc = false; \
   1.338 -				if (ms_DoRecall) \
   1.339 -				{ \
   1.340 -					 \
   1.341 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, ()); \
   1.342 -				} \
   1.343 -				else \
   1.344 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
   1.345 -			} \
   1.346 -		}; \
   1.347 -		struct Delegate4 : public MyDelegate \
   1.348 -		{ \
   1.349 -			virtual ret_type Call() \
   1.350 -			{ \
   1.351 -				g_Inside_LeafFunc = true; \
   1.352 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id())); \
   1.353 -				g_Inside_LeafFunc = false; \
   1.354 -				if (ms_DoRecall) \
   1.355 -				{ \
   1.356 -					 \
   1.357 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, ()); \
   1.358 -				} \
   1.359 -				else \
   1.360 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
   1.361 -			}; \
   1.362 -		}; \
   1.363 -	}; \
   1.364 -	\
   1.365 -	bool TestClass##id::ms_DoRecall = false; \
   1.366 -	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall)
   1.367 -
   1.368 -
   1.369  #define THGM_SETUP_PI0(id) \
   1.370  	void setuppi_##id() \
   1.371  	{ \
   1.372 @@ -888,10 +650,7 @@
   1.373  	struct TestClass##id; \
   1.374  	typedef ParamState1<0, param1 > ParamState_m##id; \
   1.375  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
   1.376 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.377 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.378 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.379 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.380 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.381  	\
   1.382  	struct TestClass##id \
   1.383  	{ \
   1.384 @@ -904,70 +663,25 @@
   1.385  			g_Inside_LeafFunc = false; \
   1.386  		} \
   1.387  		\
   1.388 -		struct Delegate1 : public MyDelegate \
   1.389 +		struct Delegate : public MyDelegate \
   1.390  		{ \
   1.391 +			int m_DelegNumber; \
   1.392 +			Delegate(int num) : m_DelegNumber(num) { } \
   1.393 +			\
   1.394  			virtual void Call(param1 p1) \
   1.395  			{ \
   1.396  				g_Inside_LeafFunc = true; \
   1.397 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1))); \
   1.398 -				g_Inside_LeafFunc = false; \
   1.399 -				if (ms_DoRecall) \
   1.400 -				{ \
   1.401 -					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.402 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1)); \
   1.403 -				} \
   1.404 -				else \
   1.405 -					RETURN_META(MRES_IGNORED); \
   1.406 -			} \
   1.407 -		}; \
   1.408 -		struct Delegate2 : public MyDelegate \
   1.409 -		{ \
   1.410 -			virtual void Call(param1 p1) \
   1.411 -			{ \
   1.412 -				g_Inside_LeafFunc = true; \
   1.413 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1))); \
   1.414 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1))); \
   1.415  				g_Inside_LeafFunc = false; \
   1.416  				if (ms_DoRecall) \
   1.417  				{ \
   1.418  					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.419 -					RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (p1)); \
   1.420 -				} \
   1.421 -				else \
   1.422 -					RETURN_META(MRES_SUPERCEDE); \
   1.423 -			} \
   1.424 -		}; \
   1.425 -		struct Delegate3 : public MyDelegate \
   1.426 -		{ \
   1.427 -			virtual void Call(param1 p1) \
   1.428 -			{ \
   1.429 -				g_Inside_LeafFunc = true; \
   1.430 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1))); \
   1.431 -				g_Inside_LeafFunc = false; \
   1.432 -				if (ms_DoRecall) \
   1.433 -				{ \
   1.434 -					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.435 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1)); \
   1.436 +					RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, (p1)); \
   1.437  				} \
   1.438  				else \
   1.439 -					RETURN_META(MRES_IGNORED); \
   1.440 +					RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
   1.441  			} \
   1.442  		}; \
   1.443 -		struct Delegate4 : public MyDelegate \
   1.444 -		{ \
   1.445 -			virtual void Call(param1 p1) \
   1.446 -			{ \
   1.447 -				g_Inside_LeafFunc = true; \
   1.448 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1))); \
   1.449 -				g_Inside_LeafFunc = false; \
   1.450 -				if (ms_DoRecall) \
   1.451 -				{ \
   1.452 -					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.453 -					RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (p1)); \
   1.454 -				} \
   1.455 -				else \
   1.456 -					RETURN_META(MRES_SUPERCEDE); \
   1.457 -			}; \
   1.458 -		}; \
   1.459  	}; \
   1.460  	\
   1.461  	bool TestClass##id::ms_DoRecall = false; \
   1.462 @@ -979,10 +693,7 @@
   1.463  	typedef ret_type RetType##id; \
   1.464  	typedef ParamState1<0, param1 > ParamState_m##id; \
   1.465  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
   1.466 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.467 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.468 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.469 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.470 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.471  	\
   1.472  	struct TestClass##id \
   1.473  	{ \
   1.474 @@ -997,70 +708,25 @@
   1.475  			return MakeRet< ret_type >::Do(0); \
   1.476  		} \
   1.477  		\
   1.478 -		struct Delegate1 : public MyDelegate \
   1.479 +		struct Delegate : public MyDelegate \
   1.480  		{ \
   1.481 +			int m_DelegNumber; \
   1.482 +			Delegate(int num) : m_DelegNumber(num) { } \
   1.483 +			\
   1.484  			virtual ret_type Call(param1 p1) \
   1.485  			{ \
   1.486  				g_Inside_LeafFunc = true; \
   1.487 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1))); \
   1.488 -				g_Inside_LeafFunc = false; \
   1.489 -				if (ms_DoRecall) \
   1.490 -				{ \
   1.491 -					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.492 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (p1)); \
   1.493 -				} \
   1.494 -				else \
   1.495 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
   1.496 -			} \
   1.497 -		}; \
   1.498 -		struct Delegate2 : public MyDelegate \
   1.499 -		{ \
   1.500 -			virtual ret_type Call(param1 p1) \
   1.501 -			{ \
   1.502 -				g_Inside_LeafFunc = true; \
   1.503 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1))); \
   1.504 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1))); \
   1.505  				g_Inside_LeafFunc = false; \
   1.506  				if (ms_DoRecall) \
   1.507  				{ \
   1.508  					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.509 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (p1)); \
   1.510 -				} \
   1.511 -				else \
   1.512 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
   1.513 -			} \
   1.514 -		}; \
   1.515 -		struct Delegate3 : public MyDelegate \
   1.516 -		{ \
   1.517 -			virtual ret_type Call(param1 p1) \
   1.518 -			{ \
   1.519 -				g_Inside_LeafFunc = true; \
   1.520 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1))); \
   1.521 -				g_Inside_LeafFunc = false; \
   1.522 -				if (ms_DoRecall) \
   1.523 -				{ \
   1.524 -					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.525 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (p1)); \
   1.526 +					RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, (p1)); \
   1.527  				} \
   1.528  				else \
   1.529 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
   1.530 +					RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
   1.531  			} \
   1.532  		}; \
   1.533 -		struct Delegate4 : public MyDelegate \
   1.534 -		{ \
   1.535 -			virtual ret_type Call(param1 p1) \
   1.536 -			{ \
   1.537 -				g_Inside_LeafFunc = true; \
   1.538 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1))); \
   1.539 -				g_Inside_LeafFunc = false; \
   1.540 -				if (ms_DoRecall) \
   1.541 -				{ \
   1.542 -					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.543 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (p1)); \
   1.544 -				} \
   1.545 -				else \
   1.546 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
   1.547 -			}; \
   1.548 -		}; \
   1.549  	}; \
   1.550  	\
   1.551  	bool TestClass##id::ms_DoRecall = false; \
   1.552 @@ -1070,10 +736,7 @@
   1.553  	struct TestClass##id; \
   1.554  	typedef ParamState2<0, param1, std::string > ParamState_m##id; \
   1.555  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
   1.556 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.557 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.558 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.559 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.560 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.561  	\
   1.562  	struct TestClass##id \
   1.563  	{ \
   1.564 @@ -1094,169 +757,30 @@
   1.565  			g_Inside_LeafFunc = false; \
   1.566  		} \
   1.567  		\
   1.568 -		struct Delegate1 : public MyDelegate \
   1.569 +		struct Delegate : public MyDelegate \
   1.570  		{ \
   1.571 +			int m_DelegNumber; \
   1.572 +			Delegate(int num) : m_DelegNumber(num) { } \
   1.573 +			\
   1.574  			virtual void Call(param1 p1, const char *buf) \
   1.575  			{ \
   1.576  				g_Inside_LeafFunc = true; \
   1.577 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, buf))); \
   1.578 -				g_Inside_LeafFunc = false; \
   1.579 -				if (ms_DoRecall) \
   1.580 -				{ \
   1.581 -					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.582 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, "%s!", buf)); \
   1.583 -				} \
   1.584 -				else \
   1.585 -					RETURN_META(MRES_IGNORED); \
   1.586 -			} \
   1.587 -		}; \
   1.588 -		struct Delegate2 : public MyDelegate \
   1.589 -		{ \
   1.590 -			virtual void Call(param1 p1, const char *buf) \
   1.591 -			{ \
   1.592 -				g_Inside_LeafFunc = true; \
   1.593 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, buf))); \
   1.594 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, buf))); \
   1.595  				g_Inside_LeafFunc = false; \
   1.596  				if (ms_DoRecall) \
   1.597  				{ \
   1.598  					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.599 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, "%s!", buf)); \
   1.600 -				} \
   1.601 -				else \
   1.602 -					RETURN_META(MRES_SUPERCEDE); \
   1.603 -			} \
   1.604 -		}; \
   1.605 -		struct Delegate3 : public MyDelegate \
   1.606 -		{ \
   1.607 -			virtual void Call(param1 p1, const char *buf) \
   1.608 -			{ \
   1.609 -				g_Inside_LeafFunc = true; \
   1.610 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, buf))); \
   1.611 -				g_Inside_LeafFunc = false; \
   1.612 -				if (ms_DoRecall) \
   1.613 -				{ \
   1.614 -					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.615 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, "%s!", buf)); \
   1.616 +					RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, (p1, "%s!", buf)); \
   1.617  				} \
   1.618  				else \
   1.619 -					RETURN_META(MRES_IGNORED); \
   1.620 +					RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
   1.621  			} \
   1.622  		}; \
   1.623 -		struct Delegate4 : public MyDelegate \
   1.624 -		{ \
   1.625 -			virtual void Call(param1 p1, const char *buf) \
   1.626 -			{ \
   1.627 -				g_Inside_LeafFunc = true; \
   1.628 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, buf))); \
   1.629 -				g_Inside_LeafFunc = false; \
   1.630 -				if (ms_DoRecall) \
   1.631 -				{ \
   1.632 -					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.633 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, "%s!", buf)); \
   1.634 -				} \
   1.635 -				else \
   1.636 -					RETURN_META(MRES_SUPERCEDE); \
   1.637 -			}; \
   1.638 -		}; \
   1.639  	}; \
   1.640  	\
   1.641  	bool TestClass##id::ms_DoRecall = false; \
   1.642  	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
   1.643  
   1.644 -
   1.645 -#define THGM_MAKE_TEST1_vafmt(id, ret_type, param1) \
   1.646 -	struct TestClass##id; \
   1.647 -	typedef ret_type RetType##id; \
   1.648 -	typedef ParamState1<0, param1 > ParamState_m##id; \
   1.649 -	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
   1.650 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.651 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.652 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.653 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.654 -	\
   1.655 -	struct TestClass##id \
   1.656 -	{ \
   1.657 -		static bool ms_DoRecall; \
   1.658 -		\
   1.659 -		virtual ret_type Func(param1 p1) \
   1.660 -		{ \
   1.661 -			g_Inside_LeafFunc = true; \
   1.662 -			ADD_STATE(State_Func##id(this, ParamState_m##id(p1))); \
   1.663 -			g_Inside_LeafFunc = false; \
   1.664 -			\
   1.665 -			return MakeRet< ret_type >::Do(0); \
   1.666 -		} \
   1.667 -		\
   1.668 -		struct Delegate1 : public MyDelegate \
   1.669 -		{ \
   1.670 -			virtual ret_type Call(param1 p1) \
   1.671 -			{ \
   1.672 -				g_Inside_LeafFunc = true; \
   1.673 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1))); \
   1.674 -				g_Inside_LeafFunc = false; \
   1.675 -				if (ms_DoRecall) \
   1.676 -				{ \
   1.677 -					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.678 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (p1)); \
   1.679 -				} \
   1.680 -				else \
   1.681 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
   1.682 -			} \
   1.683 -		}; \
   1.684 -		struct Delegate2 : public MyDelegate \
   1.685 -		{ \
   1.686 -			virtual ret_type Call(param1 p1) \
   1.687 -			{ \
   1.688 -				g_Inside_LeafFunc = true; \
   1.689 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1))); \
   1.690 -				g_Inside_LeafFunc = false; \
   1.691 -				if (ms_DoRecall) \
   1.692 -				{ \
   1.693 -					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.694 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (p1)); \
   1.695 -				} \
   1.696 -				else \
   1.697 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
   1.698 -			} \
   1.699 -		}; \
   1.700 -		struct Delegate3 : public MyDelegate \
   1.701 -		{ \
   1.702 -			virtual ret_type Call(param1 p1) \
   1.703 -			{ \
   1.704 -				g_Inside_LeafFunc = true; \
   1.705 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1))); \
   1.706 -				g_Inside_LeafFunc = false; \
   1.707 -				if (ms_DoRecall) \
   1.708 -				{ \
   1.709 -					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.710 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (p1)); \
   1.711 -				} \
   1.712 -				else \
   1.713 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
   1.714 -			} \
   1.715 -		}; \
   1.716 -		struct Delegate4 : public MyDelegate \
   1.717 -		{ \
   1.718 -			virtual ret_type Call(param1 p1) \
   1.719 -			{ \
   1.720 -				g_Inside_LeafFunc = true; \
   1.721 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1))); \
   1.722 -				g_Inside_LeafFunc = false; \
   1.723 -				if (ms_DoRecall) \
   1.724 -				{ \
   1.725 -					Increment<StripRef< param1 >::type>::Incr(p1); \
   1.726 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (p1)); \
   1.727 -				} \
   1.728 -				else \
   1.729 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
   1.730 -			}; \
   1.731 -		}; \
   1.732 -	}; \
   1.733 -	\
   1.734 -	bool TestClass##id::ms_DoRecall = false; \
   1.735 -	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall)
   1.736 -
   1.737 -
   1.738  #define THGM_SETUP_PI1(id, p1_type, p1_passtype, p1_flags) \
   1.739  	void setuppi_##id() \
   1.740  	{ \
   1.741 @@ -1276,10 +800,7 @@
   1.742  	struct TestClass##id; \
   1.743  	typedef ParamState2<0, param1, param2 > ParamState_m##id; \
   1.744  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
   1.745 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.746 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.747 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.748 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.749 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.750  	\
   1.751  	struct TestClass##id \
   1.752  	{ \
   1.753 @@ -1292,70 +813,25 @@
   1.754  			g_Inside_LeafFunc = false; \
   1.755  		} \
   1.756  		\
   1.757 -		struct Delegate1 : public MyDelegate \
   1.758 +		struct Delegate : public MyDelegate \
   1.759  		{ \
   1.760 +			int m_DelegNumber; \
   1.761 +			Delegate(int num) : m_DelegNumber(num) { } \
   1.762 +			\
   1.763  			virtual void Call(param1 p1, param2 p2) \
   1.764  			{ \
   1.765  				g_Inside_LeafFunc = true; \
   1.766 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2))); \
   1.767 -				g_Inside_LeafFunc = false; \
   1.768 -				if (ms_DoRecall) \
   1.769 -				{ \
   1.770 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
   1.771 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2)); \
   1.772 -				} \
   1.773 -				else \
   1.774 -					RETURN_META(MRES_IGNORED); \
   1.775 -			} \
   1.776 -		}; \
   1.777 -		struct Delegate2 : public MyDelegate \
   1.778 -		{ \
   1.779 -			virtual void Call(param1 p1, param2 p2) \
   1.780 -			{ \
   1.781 -				g_Inside_LeafFunc = true; \
   1.782 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2))); \
   1.783 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2))); \
   1.784  				g_Inside_LeafFunc = false; \
   1.785  				if (ms_DoRecall) \
   1.786  				{ \
   1.787  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
   1.788 -					RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2)); \
   1.789 -				} \
   1.790 -				else \
   1.791 -					RETURN_META(MRES_SUPERCEDE); \
   1.792 -			} \
   1.793 -		}; \
   1.794 -		struct Delegate3 : public MyDelegate \
   1.795 -		{ \
   1.796 -			virtual void Call(param1 p1, param2 p2) \
   1.797 -			{ \
   1.798 -				g_Inside_LeafFunc = true; \
   1.799 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2))); \
   1.800 -				g_Inside_LeafFunc = false; \
   1.801 -				if (ms_DoRecall) \
   1.802 -				{ \
   1.803 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
   1.804 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2)); \
   1.805 +					RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2)); \
   1.806  				} \
   1.807  				else \
   1.808 -					RETURN_META(MRES_IGNORED); \
   1.809 +					RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
   1.810  			} \
   1.811  		}; \
   1.812 -		struct Delegate4 : public MyDelegate \
   1.813 -		{ \
   1.814 -			virtual void Call(param1 p1, param2 p2) \
   1.815 -			{ \
   1.816 -				g_Inside_LeafFunc = true; \
   1.817 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2))); \
   1.818 -				g_Inside_LeafFunc = false; \
   1.819 -				if (ms_DoRecall) \
   1.820 -				{ \
   1.821 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
   1.822 -					RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2)); \
   1.823 -				} \
   1.824 -				else \
   1.825 -					RETURN_META(MRES_SUPERCEDE); \
   1.826 -			}; \
   1.827 -		}; \
   1.828  	}; \
   1.829  	\
   1.830  	bool TestClass##id::ms_DoRecall = false; \
   1.831 @@ -1367,10 +843,7 @@
   1.832  	typedef ret_type RetType##id; \
   1.833  	typedef ParamState2<0, param1, param2 > ParamState_m##id; \
   1.834  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
   1.835 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.836 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.837 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.838 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.839 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.840  	\
   1.841  	struct TestClass##id \
   1.842  	{ \
   1.843 @@ -1385,70 +858,25 @@
   1.844  			return MakeRet< ret_type >::Do(0); \
   1.845  		} \
   1.846  		\
   1.847 -		struct Delegate1 : public MyDelegate \
   1.848 +		struct Delegate : public MyDelegate \
   1.849  		{ \
   1.850 +			int m_DelegNumber; \
   1.851 +			Delegate(int num) : m_DelegNumber(num) { } \
   1.852 +			\
   1.853  			virtual ret_type Call(param1 p1, param2 p2) \
   1.854  			{ \
   1.855  				g_Inside_LeafFunc = true; \
   1.856 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2))); \
   1.857 -				g_Inside_LeafFunc = false; \
   1.858 -				if (ms_DoRecall) \
   1.859 -				{ \
   1.860 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
   1.861 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (p1, p2)); \
   1.862 -				} \
   1.863 -				else \
   1.864 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
   1.865 -			} \
   1.866 -		}; \
   1.867 -		struct Delegate2 : public MyDelegate \
   1.868 -		{ \
   1.869 -			virtual ret_type Call(param1 p1, param2 p2) \
   1.870 -			{ \
   1.871 -				g_Inside_LeafFunc = true; \
   1.872 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2))); \
   1.873 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2))); \
   1.874  				g_Inside_LeafFunc = false; \
   1.875  				if (ms_DoRecall) \
   1.876  				{ \
   1.877  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
   1.878 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (p1, p2)); \
   1.879 -				} \
   1.880 -				else \
   1.881 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
   1.882 -			} \
   1.883 -		}; \
   1.884 -		struct Delegate3 : public MyDelegate \
   1.885 -		{ \
   1.886 -			virtual ret_type Call(param1 p1, param2 p2) \
   1.887 -			{ \
   1.888 -				g_Inside_LeafFunc = true; \
   1.889 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2))); \
   1.890 -				g_Inside_LeafFunc = false; \
   1.891 -				if (ms_DoRecall) \
   1.892 -				{ \
   1.893 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
   1.894 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (p1, p2)); \
   1.895 +					RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, (p1, p2)); \
   1.896  				} \
   1.897  				else \
   1.898 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
   1.899 +					RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
   1.900  			} \
   1.901  		}; \
   1.902 -		struct Delegate4 : public MyDelegate \
   1.903 -		{ \
   1.904 -			virtual ret_type Call(param1 p1, param2 p2) \
   1.905 -			{ \
   1.906 -				g_Inside_LeafFunc = true; \
   1.907 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2))); \
   1.908 -				g_Inside_LeafFunc = false; \
   1.909 -				if (ms_DoRecall) \
   1.910 -				{ \
   1.911 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
   1.912 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (p1, p2)); \
   1.913 -				} \
   1.914 -				else \
   1.915 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
   1.916 -			}; \
   1.917 -		}; \
   1.918  	}; \
   1.919  	\
   1.920  	bool TestClass##id::ms_DoRecall = false; \
   1.921 @@ -1458,10 +886,7 @@
   1.922  	struct TestClass##id; \
   1.923  	typedef ParamState3<0, param1, param2, std::string > ParamState_m##id; \
   1.924  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
   1.925 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.926 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.927 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.928 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.929 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
   1.930  	\
   1.931  	struct TestClass##id \
   1.932  	{ \
   1.933 @@ -1482,169 +907,30 @@
   1.934  			g_Inside_LeafFunc = false; \
   1.935  		} \
   1.936  		\
   1.937 -		struct Delegate1 : public MyDelegate \
   1.938 +		struct Delegate : public MyDelegate \
   1.939  		{ \
   1.940 +			int m_DelegNumber; \
   1.941 +			Delegate(int num) : m_DelegNumber(num) { } \
   1.942 +			\
   1.943  			virtual void Call(param1 p1, param2 p2, const char *buf) \
   1.944  			{ \
   1.945  				g_Inside_LeafFunc = true; \
   1.946 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, buf))); \
   1.947 -				g_Inside_LeafFunc = false; \
   1.948 -				if (ms_DoRecall) \
   1.949 -				{ \
   1.950 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
   1.951 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, "%s!", buf)); \
   1.952 -				} \
   1.953 -				else \
   1.954 -					RETURN_META(MRES_IGNORED); \
   1.955 -			} \
   1.956 -		}; \
   1.957 -		struct Delegate2 : public MyDelegate \
   1.958 -		{ \
   1.959 -			virtual void Call(param1 p1, param2 p2, const char *buf) \
   1.960 -			{ \
   1.961 -				g_Inside_LeafFunc = true; \
   1.962 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, buf))); \
   1.963 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, buf))); \
   1.964  				g_Inside_LeafFunc = false; \
   1.965  				if (ms_DoRecall) \
   1.966  				{ \
   1.967  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
   1.968 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, "%s!", buf)); \
   1.969 -				} \
   1.970 -				else \
   1.971 -					RETURN_META(MRES_SUPERCEDE); \
   1.972 -			} \
   1.973 -		}; \
   1.974 -		struct Delegate3 : public MyDelegate \
   1.975 -		{ \
   1.976 -			virtual void Call(param1 p1, param2 p2, const char *buf) \
   1.977 -			{ \
   1.978 -				g_Inside_LeafFunc = true; \
   1.979 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, buf))); \
   1.980 -				g_Inside_LeafFunc = false; \
   1.981 -				if (ms_DoRecall) \
   1.982 -				{ \
   1.983 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
   1.984 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, "%s!", buf)); \
   1.985 +					RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, "%s!", buf)); \
   1.986  				} \
   1.987  				else \
   1.988 -					RETURN_META(MRES_IGNORED); \
   1.989 +					RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
   1.990  			} \
   1.991  		}; \
   1.992 -		struct Delegate4 : public MyDelegate \
   1.993 -		{ \
   1.994 -			virtual void Call(param1 p1, param2 p2, const char *buf) \
   1.995 -			{ \
   1.996 -				g_Inside_LeafFunc = true; \
   1.997 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, buf))); \
   1.998 -				g_Inside_LeafFunc = false; \
   1.999 -				if (ms_DoRecall) \
  1.1000 -				{ \
  1.1001 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
  1.1002 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, "%s!", buf)); \
  1.1003 -				} \
  1.1004 -				else \
  1.1005 -					RETURN_META(MRES_SUPERCEDE); \
  1.1006 -			}; \
  1.1007 -		}; \
  1.1008  	}; \
  1.1009  	\
  1.1010  	bool TestClass##id::ms_DoRecall = false; \
  1.1011  	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
  1.1012  
  1.1013 -
  1.1014 -#define THGM_MAKE_TEST2_vafmt(id, ret_type, param1, param2) \
  1.1015 -	struct TestClass##id; \
  1.1016 -	typedef ret_type RetType##id; \
  1.1017 -	typedef ParamState2<0, param1, param2 > ParamState_m##id; \
  1.1018 -	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.1019 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1020 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1021 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1022 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1023 -	\
  1.1024 -	struct TestClass##id \
  1.1025 -	{ \
  1.1026 -		static bool ms_DoRecall; \
  1.1027 -		\
  1.1028 -		virtual ret_type Func(param1 p1, param2 p2) \
  1.1029 -		{ \
  1.1030 -			g_Inside_LeafFunc = true; \
  1.1031 -			ADD_STATE(State_Func##id(this, ParamState_m##id(p1, p2))); \
  1.1032 -			g_Inside_LeafFunc = false; \
  1.1033 -			\
  1.1034 -			return MakeRet< ret_type >::Do(0); \
  1.1035 -		} \
  1.1036 -		\
  1.1037 -		struct Delegate1 : public MyDelegate \
  1.1038 -		{ \
  1.1039 -			virtual ret_type Call(param1 p1, param2 p2) \
  1.1040 -			{ \
  1.1041 -				g_Inside_LeafFunc = true; \
  1.1042 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2))); \
  1.1043 -				g_Inside_LeafFunc = false; \
  1.1044 -				if (ms_DoRecall) \
  1.1045 -				{ \
  1.1046 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
  1.1047 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (p1, p2)); \
  1.1048 -				} \
  1.1049 -				else \
  1.1050 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
  1.1051 -			} \
  1.1052 -		}; \
  1.1053 -		struct Delegate2 : public MyDelegate \
  1.1054 -		{ \
  1.1055 -			virtual ret_type Call(param1 p1, param2 p2) \
  1.1056 -			{ \
  1.1057 -				g_Inside_LeafFunc = true; \
  1.1058 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2))); \
  1.1059 -				g_Inside_LeafFunc = false; \
  1.1060 -				if (ms_DoRecall) \
  1.1061 -				{ \
  1.1062 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
  1.1063 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (p1, p2)); \
  1.1064 -				} \
  1.1065 -				else \
  1.1066 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
  1.1067 -			} \
  1.1068 -		}; \
  1.1069 -		struct Delegate3 : public MyDelegate \
  1.1070 -		{ \
  1.1071 -			virtual ret_type Call(param1 p1, param2 p2) \
  1.1072 -			{ \
  1.1073 -				g_Inside_LeafFunc = true; \
  1.1074 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2))); \
  1.1075 -				g_Inside_LeafFunc = false; \
  1.1076 -				if (ms_DoRecall) \
  1.1077 -				{ \
  1.1078 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
  1.1079 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (p1, p2)); \
  1.1080 -				} \
  1.1081 -				else \
  1.1082 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
  1.1083 -			} \
  1.1084 -		}; \
  1.1085 -		struct Delegate4 : public MyDelegate \
  1.1086 -		{ \
  1.1087 -			virtual ret_type Call(param1 p1, param2 p2) \
  1.1088 -			{ \
  1.1089 -				g_Inside_LeafFunc = true; \
  1.1090 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2))); \
  1.1091 -				g_Inside_LeafFunc = false; \
  1.1092 -				if (ms_DoRecall) \
  1.1093 -				{ \
  1.1094 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2); \
  1.1095 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (p1, p2)); \
  1.1096 -				} \
  1.1097 -				else \
  1.1098 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
  1.1099 -			}; \
  1.1100 -		}; \
  1.1101 -	}; \
  1.1102 -	\
  1.1103 -	bool TestClass##id::ms_DoRecall = false; \
  1.1104 -	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall)
  1.1105 -
  1.1106 -
  1.1107  #define THGM_SETUP_PI2(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags) \
  1.1108  	void setuppi_##id() \
  1.1109  	{ \
  1.1110 @@ -1671,10 +957,7 @@
  1.1111  	struct TestClass##id; \
  1.1112  	typedef ParamState3<0, param1, param2, param3 > ParamState_m##id; \
  1.1113  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.1114 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1115 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1116 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1117 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1118 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1119  	\
  1.1120  	struct TestClass##id \
  1.1121  	{ \
  1.1122 @@ -1687,70 +970,25 @@
  1.1123  			g_Inside_LeafFunc = false; \
  1.1124  		} \
  1.1125  		\
  1.1126 -		struct Delegate1 : public MyDelegate \
  1.1127 +		struct Delegate : public MyDelegate \
  1.1128  		{ \
  1.1129 +			int m_DelegNumber; \
  1.1130 +			Delegate(int num) : m_DelegNumber(num) { } \
  1.1131 +			\
  1.1132  			virtual void Call(param1 p1, param2 p2, param3 p3) \
  1.1133  			{ \
  1.1134  				g_Inside_LeafFunc = true; \
  1.1135 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3))); \
  1.1136 -				g_Inside_LeafFunc = false; \
  1.1137 -				if (ms_DoRecall) \
  1.1138 -				{ \
  1.1139 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1140 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3)); \
  1.1141 -				} \
  1.1142 -				else \
  1.1143 -					RETURN_META(MRES_IGNORED); \
  1.1144 -			} \
  1.1145 -		}; \
  1.1146 -		struct Delegate2 : public MyDelegate \
  1.1147 -		{ \
  1.1148 -			virtual void Call(param1 p1, param2 p2, param3 p3) \
  1.1149 -			{ \
  1.1150 -				g_Inside_LeafFunc = true; \
  1.1151 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3))); \
  1.1152 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3))); \
  1.1153  				g_Inside_LeafFunc = false; \
  1.1154  				if (ms_DoRecall) \
  1.1155  				{ \
  1.1156  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1157 -					RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3)); \
  1.1158 -				} \
  1.1159 -				else \
  1.1160 -					RETURN_META(MRES_SUPERCEDE); \
  1.1161 -			} \
  1.1162 -		}; \
  1.1163 -		struct Delegate3 : public MyDelegate \
  1.1164 -		{ \
  1.1165 -			virtual void Call(param1 p1, param2 p2, param3 p3) \
  1.1166 -			{ \
  1.1167 -				g_Inside_LeafFunc = true; \
  1.1168 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3))); \
  1.1169 -				g_Inside_LeafFunc = false; \
  1.1170 -				if (ms_DoRecall) \
  1.1171 -				{ \
  1.1172 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1173 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3)); \
  1.1174 +					RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3)); \
  1.1175  				} \
  1.1176  				else \
  1.1177 -					RETURN_META(MRES_IGNORED); \
  1.1178 +					RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
  1.1179  			} \
  1.1180  		}; \
  1.1181 -		struct Delegate4 : public MyDelegate \
  1.1182 -		{ \
  1.1183 -			virtual void Call(param1 p1, param2 p2, param3 p3) \
  1.1184 -			{ \
  1.1185 -				g_Inside_LeafFunc = true; \
  1.1186 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3))); \
  1.1187 -				g_Inside_LeafFunc = false; \
  1.1188 -				if (ms_DoRecall) \
  1.1189 -				{ \
  1.1190 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1191 -					RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3)); \
  1.1192 -				} \
  1.1193 -				else \
  1.1194 -					RETURN_META(MRES_SUPERCEDE); \
  1.1195 -			}; \
  1.1196 -		}; \
  1.1197  	}; \
  1.1198  	\
  1.1199  	bool TestClass##id::ms_DoRecall = false; \
  1.1200 @@ -1762,10 +1000,7 @@
  1.1201  	typedef ret_type RetType##id; \
  1.1202  	typedef ParamState3<0, param1, param2, param3 > ParamState_m##id; \
  1.1203  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.1204 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1205 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1206 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1207 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1208 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1209  	\
  1.1210  	struct TestClass##id \
  1.1211  	{ \
  1.1212 @@ -1780,70 +1015,25 @@
  1.1213  			return MakeRet< ret_type >::Do(0); \
  1.1214  		} \
  1.1215  		\
  1.1216 -		struct Delegate1 : public MyDelegate \
  1.1217 +		struct Delegate : public MyDelegate \
  1.1218  		{ \
  1.1219 +			int m_DelegNumber; \
  1.1220 +			Delegate(int num) : m_DelegNumber(num) { } \
  1.1221 +			\
  1.1222  			virtual ret_type Call(param1 p1, param2 p2, param3 p3) \
  1.1223  			{ \
  1.1224  				g_Inside_LeafFunc = true; \
  1.1225 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3))); \
  1.1226 -				g_Inside_LeafFunc = false; \
  1.1227 -				if (ms_DoRecall) \
  1.1228 -				{ \
  1.1229 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1230 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (p1, p2, p3)); \
  1.1231 -				} \
  1.1232 -				else \
  1.1233 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
  1.1234 -			} \
  1.1235 -		}; \
  1.1236 -		struct Delegate2 : public MyDelegate \
  1.1237 -		{ \
  1.1238 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3) \
  1.1239 -			{ \
  1.1240 -				g_Inside_LeafFunc = true; \
  1.1241 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3))); \
  1.1242 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3))); \
  1.1243  				g_Inside_LeafFunc = false; \
  1.1244  				if (ms_DoRecall) \
  1.1245  				{ \
  1.1246  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1247 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (p1, p2, p3)); \
  1.1248 -				} \
  1.1249 -				else \
  1.1250 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
  1.1251 -			} \
  1.1252 -		}; \
  1.1253 -		struct Delegate3 : public MyDelegate \
  1.1254 -		{ \
  1.1255 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3) \
  1.1256 -			{ \
  1.1257 -				g_Inside_LeafFunc = true; \
  1.1258 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3))); \
  1.1259 -				g_Inside_LeafFunc = false; \
  1.1260 -				if (ms_DoRecall) \
  1.1261 -				{ \
  1.1262 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1263 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (p1, p2, p3)); \
  1.1264 +					RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, (p1, p2, p3)); \
  1.1265  				} \
  1.1266  				else \
  1.1267 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
  1.1268 +					RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
  1.1269  			} \
  1.1270  		}; \
  1.1271 -		struct Delegate4 : public MyDelegate \
  1.1272 -		{ \
  1.1273 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3) \
  1.1274 -			{ \
  1.1275 -				g_Inside_LeafFunc = true; \
  1.1276 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3))); \
  1.1277 -				g_Inside_LeafFunc = false; \
  1.1278 -				if (ms_DoRecall) \
  1.1279 -				{ \
  1.1280 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1281 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (p1, p2, p3)); \
  1.1282 -				} \
  1.1283 -				else \
  1.1284 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
  1.1285 -			}; \
  1.1286 -		}; \
  1.1287  	}; \
  1.1288  	\
  1.1289  	bool TestClass##id::ms_DoRecall = false; \
  1.1290 @@ -1853,10 +1043,7 @@
  1.1291  	struct TestClass##id; \
  1.1292  	typedef ParamState4<0, param1, param2, param3, std::string > ParamState_m##id; \
  1.1293  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.1294 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1295 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1296 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1297 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1298 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1299  	\
  1.1300  	struct TestClass##id \
  1.1301  	{ \
  1.1302 @@ -1877,169 +1064,30 @@
  1.1303  			g_Inside_LeafFunc = false; \
  1.1304  		} \
  1.1305  		\
  1.1306 -		struct Delegate1 : public MyDelegate \
  1.1307 +		struct Delegate : public MyDelegate \
  1.1308  		{ \
  1.1309 +			int m_DelegNumber; \
  1.1310 +			Delegate(int num) : m_DelegNumber(num) { } \
  1.1311 +			\
  1.1312  			virtual void Call(param1 p1, param2 p2, param3 p3, const char *buf) \
  1.1313  			{ \
  1.1314  				g_Inside_LeafFunc = true; \
  1.1315 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, buf))); \
  1.1316 -				g_Inside_LeafFunc = false; \
  1.1317 -				if (ms_DoRecall) \
  1.1318 -				{ \
  1.1319 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1320 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, "%s!", buf)); \
  1.1321 -				} \
  1.1322 -				else \
  1.1323 -					RETURN_META(MRES_IGNORED); \
  1.1324 -			} \
  1.1325 -		}; \
  1.1326 -		struct Delegate2 : public MyDelegate \
  1.1327 -		{ \
  1.1328 -			virtual void Call(param1 p1, param2 p2, param3 p3, const char *buf) \
  1.1329 -			{ \
  1.1330 -				g_Inside_LeafFunc = true; \
  1.1331 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, buf))); \
  1.1332 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, buf))); \
  1.1333  				g_Inside_LeafFunc = false; \
  1.1334  				if (ms_DoRecall) \
  1.1335  				{ \
  1.1336  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1337 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, "%s!", buf)); \
  1.1338 -				} \
  1.1339 -				else \
  1.1340 -					RETURN_META(MRES_SUPERCEDE); \
  1.1341 -			} \
  1.1342 -		}; \
  1.1343 -		struct Delegate3 : public MyDelegate \
  1.1344 -		{ \
  1.1345 -			virtual void Call(param1 p1, param2 p2, param3 p3, const char *buf) \
  1.1346 -			{ \
  1.1347 -				g_Inside_LeafFunc = true; \
  1.1348 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, buf))); \
  1.1349 -				g_Inside_LeafFunc = false; \
  1.1350 -				if (ms_DoRecall) \
  1.1351 -				{ \
  1.1352 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1353 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, "%s!", buf)); \
  1.1354 +					RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3, "%s!", buf)); \
  1.1355  				} \
  1.1356  				else \
  1.1357 -					RETURN_META(MRES_IGNORED); \
  1.1358 +					RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
  1.1359  			} \
  1.1360  		}; \
  1.1361 -		struct Delegate4 : public MyDelegate \
  1.1362 -		{ \
  1.1363 -			virtual void Call(param1 p1, param2 p2, param3 p3, const char *buf) \
  1.1364 -			{ \
  1.1365 -				g_Inside_LeafFunc = true; \
  1.1366 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, buf))); \
  1.1367 -				g_Inside_LeafFunc = false; \
  1.1368 -				if (ms_DoRecall) \
  1.1369 -				{ \
  1.1370 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1371 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, "%s!", buf)); \
  1.1372 -				} \
  1.1373 -				else \
  1.1374 -					RETURN_META(MRES_SUPERCEDE); \
  1.1375 -			}; \
  1.1376 -		}; \
  1.1377  	}; \
  1.1378  	\
  1.1379  	bool TestClass##id::ms_DoRecall = false; \
  1.1380  	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
  1.1381  
  1.1382 -
  1.1383 -#define THGM_MAKE_TEST3_vafmt(id, ret_type, param1, param2, param3) \
  1.1384 -	struct TestClass##id; \
  1.1385 -	typedef ret_type RetType##id; \
  1.1386 -	typedef ParamState3<0, param1, param2, param3 > ParamState_m##id; \
  1.1387 -	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.1388 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1389 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1390 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1391 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1392 -	\
  1.1393 -	struct TestClass##id \
  1.1394 -	{ \
  1.1395 -		static bool ms_DoRecall; \
  1.1396 -		\
  1.1397 -		virtual ret_type Func(param1 p1, param2 p2, param3 p3) \
  1.1398 -		{ \
  1.1399 -			g_Inside_LeafFunc = true; \
  1.1400 -			ADD_STATE(State_Func##id(this, ParamState_m##id(p1, p2, p3))); \
  1.1401 -			g_Inside_LeafFunc = false; \
  1.1402 -			\
  1.1403 -			return MakeRet< ret_type >::Do(0); \
  1.1404 -		} \
  1.1405 -		\
  1.1406 -		struct Delegate1 : public MyDelegate \
  1.1407 -		{ \
  1.1408 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3) \
  1.1409 -			{ \
  1.1410 -				g_Inside_LeafFunc = true; \
  1.1411 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3))); \
  1.1412 -				g_Inside_LeafFunc = false; \
  1.1413 -				if (ms_DoRecall) \
  1.1414 -				{ \
  1.1415 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1416 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (p1, p2, p3)); \
  1.1417 -				} \
  1.1418 -				else \
  1.1419 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
  1.1420 -			} \
  1.1421 -		}; \
  1.1422 -		struct Delegate2 : public MyDelegate \
  1.1423 -		{ \
  1.1424 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3) \
  1.1425 -			{ \
  1.1426 -				g_Inside_LeafFunc = true; \
  1.1427 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3))); \
  1.1428 -				g_Inside_LeafFunc = false; \
  1.1429 -				if (ms_DoRecall) \
  1.1430 -				{ \
  1.1431 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1432 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (p1, p2, p3)); \
  1.1433 -				} \
  1.1434 -				else \
  1.1435 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
  1.1436 -			} \
  1.1437 -		}; \
  1.1438 -		struct Delegate3 : public MyDelegate \
  1.1439 -		{ \
  1.1440 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3) \
  1.1441 -			{ \
  1.1442 -				g_Inside_LeafFunc = true; \
  1.1443 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3))); \
  1.1444 -				g_Inside_LeafFunc = false; \
  1.1445 -				if (ms_DoRecall) \
  1.1446 -				{ \
  1.1447 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1448 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (p1, p2, p3)); \
  1.1449 -				} \
  1.1450 -				else \
  1.1451 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
  1.1452 -			} \
  1.1453 -		}; \
  1.1454 -		struct Delegate4 : public MyDelegate \
  1.1455 -		{ \
  1.1456 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3) \
  1.1457 -			{ \
  1.1458 -				g_Inside_LeafFunc = true; \
  1.1459 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3))); \
  1.1460 -				g_Inside_LeafFunc = false; \
  1.1461 -				if (ms_DoRecall) \
  1.1462 -				{ \
  1.1463 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3); \
  1.1464 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (p1, p2, p3)); \
  1.1465 -				} \
  1.1466 -				else \
  1.1467 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
  1.1468 -			}; \
  1.1469 -		}; \
  1.1470 -	}; \
  1.1471 -	\
  1.1472 -	bool TestClass##id::ms_DoRecall = false; \
  1.1473 -	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall)
  1.1474 -
  1.1475 -
  1.1476  #define THGM_SETUP_PI3(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags) \
  1.1477  	void setuppi_##id() \
  1.1478  	{ \
  1.1479 @@ -2073,10 +1121,7 @@
  1.1480  	struct TestClass##id; \
  1.1481  	typedef ParamState4<0, param1, param2, param3, param4 > ParamState_m##id; \
  1.1482  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.1483 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1484 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1485 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1486 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1487 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1488  	\
  1.1489  	struct TestClass##id \
  1.1490  	{ \
  1.1491 @@ -2089,70 +1134,25 @@
  1.1492  			g_Inside_LeafFunc = false; \
  1.1493  		} \
  1.1494  		\
  1.1495 -		struct Delegate1 : public MyDelegate \
  1.1496 +		struct Delegate : public MyDelegate \
  1.1497  		{ \
  1.1498 +			int m_DelegNumber; \
  1.1499 +			Delegate(int num) : m_DelegNumber(num) { } \
  1.1500 +			\
  1.1501  			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4) \
  1.1502  			{ \
  1.1503  				g_Inside_LeafFunc = true; \
  1.1504 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4))); \
  1.1505 -				g_Inside_LeafFunc = false; \
  1.1506 -				if (ms_DoRecall) \
  1.1507 -				{ \
  1.1508 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1509 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4)); \
  1.1510 -				} \
  1.1511 -				else \
  1.1512 -					RETURN_META(MRES_IGNORED); \
  1.1513 -			} \
  1.1514 -		}; \
  1.1515 -		struct Delegate2 : public MyDelegate \
  1.1516 -		{ \
  1.1517 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4) \
  1.1518 -			{ \
  1.1519 -				g_Inside_LeafFunc = true; \
  1.1520 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4))); \
  1.1521 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4))); \
  1.1522  				g_Inside_LeafFunc = false; \
  1.1523  				if (ms_DoRecall) \
  1.1524  				{ \
  1.1525  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1526 -					RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3, p4)); \
  1.1527 -				} \
  1.1528 -				else \
  1.1529 -					RETURN_META(MRES_SUPERCEDE); \
  1.1530 -			} \
  1.1531 -		}; \
  1.1532 -		struct Delegate3 : public MyDelegate \
  1.1533 -		{ \
  1.1534 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4) \
  1.1535 -			{ \
  1.1536 -				g_Inside_LeafFunc = true; \
  1.1537 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4))); \
  1.1538 -				g_Inside_LeafFunc = false; \
  1.1539 -				if (ms_DoRecall) \
  1.1540 -				{ \
  1.1541 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1542 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4)); \
  1.1543 +					RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3, p4)); \
  1.1544  				} \
  1.1545  				else \
  1.1546 -					RETURN_META(MRES_IGNORED); \
  1.1547 +					RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
  1.1548  			} \
  1.1549  		}; \
  1.1550 -		struct Delegate4 : public MyDelegate \
  1.1551 -		{ \
  1.1552 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4) \
  1.1553 -			{ \
  1.1554 -				g_Inside_LeafFunc = true; \
  1.1555 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4))); \
  1.1556 -				g_Inside_LeafFunc = false; \
  1.1557 -				if (ms_DoRecall) \
  1.1558 -				{ \
  1.1559 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1560 -					RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3, p4)); \
  1.1561 -				} \
  1.1562 -				else \
  1.1563 -					RETURN_META(MRES_SUPERCEDE); \
  1.1564 -			}; \
  1.1565 -		}; \
  1.1566  	}; \
  1.1567  	\
  1.1568  	bool TestClass##id::ms_DoRecall = false; \
  1.1569 @@ -2164,10 +1164,7 @@
  1.1570  	typedef ret_type RetType##id; \
  1.1571  	typedef ParamState4<0, param1, param2, param3, param4 > ParamState_m##id; \
  1.1572  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.1573 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1574 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1575 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1576 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1577 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1578  	\
  1.1579  	struct TestClass##id \
  1.1580  	{ \
  1.1581 @@ -2182,70 +1179,25 @@
  1.1582  			return MakeRet< ret_type >::Do(0); \
  1.1583  		} \
  1.1584  		\
  1.1585 -		struct Delegate1 : public MyDelegate \
  1.1586 +		struct Delegate : public MyDelegate \
  1.1587  		{ \
  1.1588 +			int m_DelegNumber; \
  1.1589 +			Delegate(int num) : m_DelegNumber(num) { } \
  1.1590 +			\
  1.1591  			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4) \
  1.1592  			{ \
  1.1593  				g_Inside_LeafFunc = true; \
  1.1594 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4))); \
  1.1595 -				g_Inside_LeafFunc = false; \
  1.1596 -				if (ms_DoRecall) \
  1.1597 -				{ \
  1.1598 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1599 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (p1, p2, p3, p4)); \
  1.1600 -				} \
  1.1601 -				else \
  1.1602 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
  1.1603 -			} \
  1.1604 -		}; \
  1.1605 -		struct Delegate2 : public MyDelegate \
  1.1606 -		{ \
  1.1607 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4) \
  1.1608 -			{ \
  1.1609 -				g_Inside_LeafFunc = true; \
  1.1610 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4))); \
  1.1611 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4))); \
  1.1612  				g_Inside_LeafFunc = false; \
  1.1613  				if (ms_DoRecall) \
  1.1614  				{ \
  1.1615  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1616 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (p1, p2, p3, p4)); \
  1.1617 -				} \
  1.1618 -				else \
  1.1619 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
  1.1620 -			} \
  1.1621 -		}; \
  1.1622 -		struct Delegate3 : public MyDelegate \
  1.1623 -		{ \
  1.1624 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4) \
  1.1625 -			{ \
  1.1626 -				g_Inside_LeafFunc = true; \
  1.1627 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4))); \
  1.1628 -				g_Inside_LeafFunc = false; \
  1.1629 -				if (ms_DoRecall) \
  1.1630 -				{ \
  1.1631 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1632 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (p1, p2, p3, p4)); \
  1.1633 +					RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, (p1, p2, p3, p4)); \
  1.1634  				} \
  1.1635  				else \
  1.1636 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
  1.1637 +					RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
  1.1638  			} \
  1.1639  		}; \
  1.1640 -		struct Delegate4 : public MyDelegate \
  1.1641 -		{ \
  1.1642 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4) \
  1.1643 -			{ \
  1.1644 -				g_Inside_LeafFunc = true; \
  1.1645 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4))); \
  1.1646 -				g_Inside_LeafFunc = false; \
  1.1647 -				if (ms_DoRecall) \
  1.1648 -				{ \
  1.1649 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1650 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (p1, p2, p3, p4)); \
  1.1651 -				} \
  1.1652 -				else \
  1.1653 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
  1.1654 -			}; \
  1.1655 -		}; \
  1.1656  	}; \
  1.1657  	\
  1.1658  	bool TestClass##id::ms_DoRecall = false; \
  1.1659 @@ -2255,10 +1207,7 @@
  1.1660  	struct TestClass##id; \
  1.1661  	typedef ParamState5<0, param1, param2, param3, param4, std::string > ParamState_m##id; \
  1.1662  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.1663 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1664 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1665 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1666 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1667 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1668  	\
  1.1669  	struct TestClass##id \
  1.1670  	{ \
  1.1671 @@ -2279,169 +1228,30 @@
  1.1672  			g_Inside_LeafFunc = false; \
  1.1673  		} \
  1.1674  		\
  1.1675 -		struct Delegate1 : public MyDelegate \
  1.1676 +		struct Delegate : public MyDelegate \
  1.1677  		{ \
  1.1678 +			int m_DelegNumber; \
  1.1679 +			Delegate(int num) : m_DelegNumber(num) { } \
  1.1680 +			\
  1.1681  			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, const char *buf) \
  1.1682  			{ \
  1.1683  				g_Inside_LeafFunc = true; \
  1.1684 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, buf))); \
  1.1685 -				g_Inside_LeafFunc = false; \
  1.1686 -				if (ms_DoRecall) \
  1.1687 -				{ \
  1.1688 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1689 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, "%s!", buf)); \
  1.1690 -				} \
  1.1691 -				else \
  1.1692 -					RETURN_META(MRES_IGNORED); \
  1.1693 -			} \
  1.1694 -		}; \
  1.1695 -		struct Delegate2 : public MyDelegate \
  1.1696 -		{ \
  1.1697 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, const char *buf) \
  1.1698 -			{ \
  1.1699 -				g_Inside_LeafFunc = true; \
  1.1700 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, buf))); \
  1.1701 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, buf))); \
  1.1702  				g_Inside_LeafFunc = false; \
  1.1703  				if (ms_DoRecall) \
  1.1704  				{ \
  1.1705  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1706 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, "%s!", buf)); \
  1.1707 -				} \
  1.1708 -				else \
  1.1709 -					RETURN_META(MRES_SUPERCEDE); \
  1.1710 -			} \
  1.1711 -		}; \
  1.1712 -		struct Delegate3 : public MyDelegate \
  1.1713 -		{ \
  1.1714 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, const char *buf) \
  1.1715 -			{ \
  1.1716 -				g_Inside_LeafFunc = true; \
  1.1717 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, buf))); \
  1.1718 -				g_Inside_LeafFunc = false; \
  1.1719 -				if (ms_DoRecall) \
  1.1720 -				{ \
  1.1721 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1722 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, "%s!", buf)); \
  1.1723 +					RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3, p4, "%s!", buf)); \
  1.1724  				} \
  1.1725  				else \
  1.1726 -					RETURN_META(MRES_IGNORED); \
  1.1727 +					RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
  1.1728  			} \
  1.1729  		}; \
  1.1730 -		struct Delegate4 : public MyDelegate \
  1.1731 -		{ \
  1.1732 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, const char *buf) \
  1.1733 -			{ \
  1.1734 -				g_Inside_LeafFunc = true; \
  1.1735 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, buf))); \
  1.1736 -				g_Inside_LeafFunc = false; \
  1.1737 -				if (ms_DoRecall) \
  1.1738 -				{ \
  1.1739 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1740 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, "%s!", buf)); \
  1.1741 -				} \
  1.1742 -				else \
  1.1743 -					RETURN_META(MRES_SUPERCEDE); \
  1.1744 -			}; \
  1.1745 -		}; \
  1.1746  	}; \
  1.1747  	\
  1.1748  	bool TestClass##id::ms_DoRecall = false; \
  1.1749  	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
  1.1750  
  1.1751 -
  1.1752 -#define THGM_MAKE_TEST4_vafmt(id, ret_type, param1, param2, param3, param4) \
  1.1753 -	struct TestClass##id; \
  1.1754 -	typedef ret_type RetType##id; \
  1.1755 -	typedef ParamState4<0, param1, param2, param3, param4 > ParamState_m##id; \
  1.1756 -	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.1757 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1758 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1759 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1760 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1761 -	\
  1.1762 -	struct TestClass##id \
  1.1763 -	{ \
  1.1764 -		static bool ms_DoRecall; \
  1.1765 -		\
  1.1766 -		virtual ret_type Func(param1 p1, param2 p2, param3 p3, param4 p4) \
  1.1767 -		{ \
  1.1768 -			g_Inside_LeafFunc = true; \
  1.1769 -			ADD_STATE(State_Func##id(this, ParamState_m##id(p1, p2, p3, p4))); \
  1.1770 -			g_Inside_LeafFunc = false; \
  1.1771 -			\
  1.1772 -			return MakeRet< ret_type >::Do(0); \
  1.1773 -		} \
  1.1774 -		\
  1.1775 -		struct Delegate1 : public MyDelegate \
  1.1776 -		{ \
  1.1777 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4) \
  1.1778 -			{ \
  1.1779 -				g_Inside_LeafFunc = true; \
  1.1780 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4))); \
  1.1781 -				g_Inside_LeafFunc = false; \
  1.1782 -				if (ms_DoRecall) \
  1.1783 -				{ \
  1.1784 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1785 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (p1, p2, p3, p4)); \
  1.1786 -				} \
  1.1787 -				else \
  1.1788 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
  1.1789 -			} \
  1.1790 -		}; \
  1.1791 -		struct Delegate2 : public MyDelegate \
  1.1792 -		{ \
  1.1793 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4) \
  1.1794 -			{ \
  1.1795 -				g_Inside_LeafFunc = true; \
  1.1796 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4))); \
  1.1797 -				g_Inside_LeafFunc = false; \
  1.1798 -				if (ms_DoRecall) \
  1.1799 -				{ \
  1.1800 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1801 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (p1, p2, p3, p4)); \
  1.1802 -				} \
  1.1803 -				else \
  1.1804 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
  1.1805 -			} \
  1.1806 -		}; \
  1.1807 -		struct Delegate3 : public MyDelegate \
  1.1808 -		{ \
  1.1809 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4) \
  1.1810 -			{ \
  1.1811 -				g_Inside_LeafFunc = true; \
  1.1812 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4))); \
  1.1813 -				g_Inside_LeafFunc = false; \
  1.1814 -				if (ms_DoRecall) \
  1.1815 -				{ \
  1.1816 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1817 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (p1, p2, p3, p4)); \
  1.1818 -				} \
  1.1819 -				else \
  1.1820 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
  1.1821 -			} \
  1.1822 -		}; \
  1.1823 -		struct Delegate4 : public MyDelegate \
  1.1824 -		{ \
  1.1825 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4) \
  1.1826 -			{ \
  1.1827 -				g_Inside_LeafFunc = true; \
  1.1828 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4))); \
  1.1829 -				g_Inside_LeafFunc = false; \
  1.1830 -				if (ms_DoRecall) \
  1.1831 -				{ \
  1.1832 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4); \
  1.1833 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (p1, p2, p3, p4)); \
  1.1834 -				} \
  1.1835 -				else \
  1.1836 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
  1.1837 -			}; \
  1.1838 -		}; \
  1.1839 -	}; \
  1.1840 -	\
  1.1841 -	bool TestClass##id::ms_DoRecall = false; \
  1.1842 -	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall)
  1.1843 -
  1.1844 -
  1.1845  #define THGM_SETUP_PI4(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags, p4_type, p4_passtype, p4_flags) \
  1.1846  	void setuppi_##id() \
  1.1847  	{ \
  1.1848 @@ -2482,10 +1292,7 @@
  1.1849  	struct TestClass##id; \
  1.1850  	typedef ParamState5<0, param1, param2, param3, param4, param5 > ParamState_m##id; \
  1.1851  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.1852 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1853 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1854 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1855 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1856 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1857  	\
  1.1858  	struct TestClass##id \
  1.1859  	{ \
  1.1860 @@ -2498,70 +1305,25 @@
  1.1861  			g_Inside_LeafFunc = false; \
  1.1862  		} \
  1.1863  		\
  1.1864 -		struct Delegate1 : public MyDelegate \
  1.1865 +		struct Delegate : public MyDelegate \
  1.1866  		{ \
  1.1867 +			int m_DelegNumber; \
  1.1868 +			Delegate(int num) : m_DelegNumber(num) { } \
  1.1869 +			\
  1.1870  			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \
  1.1871  			{ \
  1.1872  				g_Inside_LeafFunc = true; \
  1.1873 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.1874 -				g_Inside_LeafFunc = false; \
  1.1875 -				if (ms_DoRecall) \
  1.1876 -				{ \
  1.1877 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.1878 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, p5)); \
  1.1879 -				} \
  1.1880 -				else \
  1.1881 -					RETURN_META(MRES_IGNORED); \
  1.1882 -			} \
  1.1883 -		}; \
  1.1884 -		struct Delegate2 : public MyDelegate \
  1.1885 -		{ \
  1.1886 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \
  1.1887 -			{ \
  1.1888 -				g_Inside_LeafFunc = true; \
  1.1889 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.1890 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.1891  				g_Inside_LeafFunc = false; \
  1.1892  				if (ms_DoRecall) \
  1.1893  				{ \
  1.1894  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.1895 -					RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3, p4, p5)); \
  1.1896 -				} \
  1.1897 -				else \
  1.1898 -					RETURN_META(MRES_SUPERCEDE); \
  1.1899 -			} \
  1.1900 -		}; \
  1.1901 -		struct Delegate3 : public MyDelegate \
  1.1902 -		{ \
  1.1903 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \
  1.1904 -			{ \
  1.1905 -				g_Inside_LeafFunc = true; \
  1.1906 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.1907 -				g_Inside_LeafFunc = false; \
  1.1908 -				if (ms_DoRecall) \
  1.1909 -				{ \
  1.1910 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.1911 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, p5)); \
  1.1912 +					RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3, p4, p5)); \
  1.1913  				} \
  1.1914  				else \
  1.1915 -					RETURN_META(MRES_IGNORED); \
  1.1916 +					RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
  1.1917  			} \
  1.1918  		}; \
  1.1919 -		struct Delegate4 : public MyDelegate \
  1.1920 -		{ \
  1.1921 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \
  1.1922 -			{ \
  1.1923 -				g_Inside_LeafFunc = true; \
  1.1924 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.1925 -				g_Inside_LeafFunc = false; \
  1.1926 -				if (ms_DoRecall) \
  1.1927 -				{ \
  1.1928 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.1929 -					RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3, p4, p5)); \
  1.1930 -				} \
  1.1931 -				else \
  1.1932 -					RETURN_META(MRES_SUPERCEDE); \
  1.1933 -			}; \
  1.1934 -		}; \
  1.1935  	}; \
  1.1936  	\
  1.1937  	bool TestClass##id::ms_DoRecall = false; \
  1.1938 @@ -2573,10 +1335,7 @@
  1.1939  	typedef ret_type RetType##id; \
  1.1940  	typedef ParamState5<0, param1, param2, param3, param4, param5 > ParamState_m##id; \
  1.1941  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.1942 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1943 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1944 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1945 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1946 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.1947  	\
  1.1948  	struct TestClass##id \
  1.1949  	{ \
  1.1950 @@ -2591,70 +1350,25 @@
  1.1951  			return MakeRet< ret_type >::Do(0); \
  1.1952  		} \
  1.1953  		\
  1.1954 -		struct Delegate1 : public MyDelegate \
  1.1955 +		struct Delegate : public MyDelegate \
  1.1956  		{ \
  1.1957 +			int m_DelegNumber; \
  1.1958 +			Delegate(int num) : m_DelegNumber(num) { } \
  1.1959 +			\
  1.1960  			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \
  1.1961  			{ \
  1.1962  				g_Inside_LeafFunc = true; \
  1.1963 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.1964 -				g_Inside_LeafFunc = false; \
  1.1965 -				if (ms_DoRecall) \
  1.1966 -				{ \
  1.1967 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.1968 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (p1, p2, p3, p4, p5)); \
  1.1969 -				} \
  1.1970 -				else \
  1.1971 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
  1.1972 -			} \
  1.1973 -		}; \
  1.1974 -		struct Delegate2 : public MyDelegate \
  1.1975 -		{ \
  1.1976 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \
  1.1977 -			{ \
  1.1978 -				g_Inside_LeafFunc = true; \
  1.1979 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.1980 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.1981  				g_Inside_LeafFunc = false; \
  1.1982  				if (ms_DoRecall) \
  1.1983  				{ \
  1.1984  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.1985 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (p1, p2, p3, p4, p5)); \
  1.1986 -				} \
  1.1987 -				else \
  1.1988 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
  1.1989 -			} \
  1.1990 -		}; \
  1.1991 -		struct Delegate3 : public MyDelegate \
  1.1992 -		{ \
  1.1993 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \
  1.1994 -			{ \
  1.1995 -				g_Inside_LeafFunc = true; \
  1.1996 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.1997 -				g_Inside_LeafFunc = false; \
  1.1998 -				if (ms_DoRecall) \
  1.1999 -				{ \
  1.2000 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.2001 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (p1, p2, p3, p4, p5)); \
  1.2002 +					RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, (p1, p2, p3, p4, p5)); \
  1.2003  				} \
  1.2004  				else \
  1.2005 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
  1.2006 +					RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
  1.2007  			} \
  1.2008  		}; \
  1.2009 -		struct Delegate4 : public MyDelegate \
  1.2010 -		{ \
  1.2011 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \
  1.2012 -			{ \
  1.2013 -				g_Inside_LeafFunc = true; \
  1.2014 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.2015 -				g_Inside_LeafFunc = false; \
  1.2016 -				if (ms_DoRecall) \
  1.2017 -				{ \
  1.2018 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.2019 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (p1, p2, p3, p4, p5)); \
  1.2020 -				} \
  1.2021 -				else \
  1.2022 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
  1.2023 -			}; \
  1.2024 -		}; \
  1.2025  	}; \
  1.2026  	\
  1.2027  	bool TestClass##id::ms_DoRecall = false; \
  1.2028 @@ -2664,10 +1378,7 @@
  1.2029  	struct TestClass##id; \
  1.2030  	typedef ParamState6<0, param1, param2, param3, param4, param5, std::string > ParamState_m##id; \
  1.2031  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.2032 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2033 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2034 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2035 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2036 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2037  	\
  1.2038  	struct TestClass##id \
  1.2039  	{ \
  1.2040 @@ -2688,169 +1399,30 @@
  1.2041  			g_Inside_LeafFunc = false; \
  1.2042  		} \
  1.2043  		\
  1.2044 -		struct Delegate1 : public MyDelegate \
  1.2045 +		struct Delegate : public MyDelegate \
  1.2046  		{ \
  1.2047 +			int m_DelegNumber; \
  1.2048 +			Delegate(int num) : m_DelegNumber(num) { } \
  1.2049 +			\
  1.2050  			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, const char *buf) \
  1.2051  			{ \
  1.2052  				g_Inside_LeafFunc = true; \
  1.2053 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, buf))); \
  1.2054 -				g_Inside_LeafFunc = false; \
  1.2055 -				if (ms_DoRecall) \
  1.2056 -				{ \
  1.2057 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.2058 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, p5, "%s!", buf)); \
  1.2059 -				} \
  1.2060 -				else \
  1.2061 -					RETURN_META(MRES_IGNORED); \
  1.2062 -			} \
  1.2063 -		}; \
  1.2064 -		struct Delegate2 : public MyDelegate \
  1.2065 -		{ \
  1.2066 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, const char *buf) \
  1.2067 -			{ \
  1.2068 -				g_Inside_LeafFunc = true; \
  1.2069 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, buf))); \
  1.2070 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, buf))); \
  1.2071  				g_Inside_LeafFunc = false; \
  1.2072  				if (ms_DoRecall) \
  1.2073  				{ \
  1.2074  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.2075 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, p5, "%s!", buf)); \
  1.2076 -				} \
  1.2077 -				else \
  1.2078 -					RETURN_META(MRES_SUPERCEDE); \
  1.2079 -			} \
  1.2080 -		}; \
  1.2081 -		struct Delegate3 : public MyDelegate \
  1.2082 -		{ \
  1.2083 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, const char *buf) \
  1.2084 -			{ \
  1.2085 -				g_Inside_LeafFunc = true; \
  1.2086 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, buf))); \
  1.2087 -				g_Inside_LeafFunc = false; \
  1.2088 -				if (ms_DoRecall) \
  1.2089 -				{ \
  1.2090 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.2091 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, p5, "%s!", buf)); \
  1.2092 +					RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3, p4, p5, "%s!", buf)); \
  1.2093  				} \
  1.2094  				else \
  1.2095 -					RETURN_META(MRES_IGNORED); \
  1.2096 +					RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
  1.2097  			} \
  1.2098  		}; \
  1.2099 -		struct Delegate4 : public MyDelegate \
  1.2100 -		{ \
  1.2101 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, const char *buf) \
  1.2102 -			{ \
  1.2103 -				g_Inside_LeafFunc = true; \
  1.2104 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, buf))); \
  1.2105 -				g_Inside_LeafFunc = false; \
  1.2106 -				if (ms_DoRecall) \
  1.2107 -				{ \
  1.2108 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.2109 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, p5, "%s!", buf)); \
  1.2110 -				} \
  1.2111 -				else \
  1.2112 -					RETURN_META(MRES_SUPERCEDE); \
  1.2113 -			}; \
  1.2114 -		}; \
  1.2115  	}; \
  1.2116  	\
  1.2117  	bool TestClass##id::ms_DoRecall = false; \
  1.2118  	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
  1.2119  
  1.2120 -
  1.2121 -#define THGM_MAKE_TEST5_vafmt(id, ret_type, param1, param2, param3, param4, param5) \
  1.2122 -	struct TestClass##id; \
  1.2123 -	typedef ret_type RetType##id; \
  1.2124 -	typedef ParamState5<0, param1, param2, param3, param4, param5 > ParamState_m##id; \
  1.2125 -	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.2126 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2127 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2128 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2129 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2130 -	\
  1.2131 -	struct TestClass##id \
  1.2132 -	{ \
  1.2133 -		static bool ms_DoRecall; \
  1.2134 -		\
  1.2135 -		virtual ret_type Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \
  1.2136 -		{ \
  1.2137 -			g_Inside_LeafFunc = true; \
  1.2138 -			ADD_STATE(State_Func##id(this, ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.2139 -			g_Inside_LeafFunc = false; \
  1.2140 -			\
  1.2141 -			return MakeRet< ret_type >::Do(0); \
  1.2142 -		} \
  1.2143 -		\
  1.2144 -		struct Delegate1 : public MyDelegate \
  1.2145 -		{ \
  1.2146 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \
  1.2147 -			{ \
  1.2148 -				g_Inside_LeafFunc = true; \
  1.2149 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.2150 -				g_Inside_LeafFunc = false; \
  1.2151 -				if (ms_DoRecall) \
  1.2152 -				{ \
  1.2153 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.2154 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (p1, p2, p3, p4, p5)); \
  1.2155 -				} \
  1.2156 -				else \
  1.2157 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
  1.2158 -			} \
  1.2159 -		}; \
  1.2160 -		struct Delegate2 : public MyDelegate \
  1.2161 -		{ \
  1.2162 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \
  1.2163 -			{ \
  1.2164 -				g_Inside_LeafFunc = true; \
  1.2165 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.2166 -				g_Inside_LeafFunc = false; \
  1.2167 -				if (ms_DoRecall) \
  1.2168 -				{ \
  1.2169 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.2170 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (p1, p2, p3, p4, p5)); \
  1.2171 -				} \
  1.2172 -				else \
  1.2173 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
  1.2174 -			} \
  1.2175 -		}; \
  1.2176 -		struct Delegate3 : public MyDelegate \
  1.2177 -		{ \
  1.2178 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \
  1.2179 -			{ \
  1.2180 -				g_Inside_LeafFunc = true; \
  1.2181 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.2182 -				g_Inside_LeafFunc = false; \
  1.2183 -				if (ms_DoRecall) \
  1.2184 -				{ \
  1.2185 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.2186 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (p1, p2, p3, p4, p5)); \
  1.2187 -				} \
  1.2188 -				else \
  1.2189 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
  1.2190 -			} \
  1.2191 -		}; \
  1.2192 -		struct Delegate4 : public MyDelegate \
  1.2193 -		{ \
  1.2194 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5) \
  1.2195 -			{ \
  1.2196 -				g_Inside_LeafFunc = true; \
  1.2197 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5))); \
  1.2198 -				g_Inside_LeafFunc = false; \
  1.2199 -				if (ms_DoRecall) \
  1.2200 -				{ \
  1.2201 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5); \
  1.2202 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (p1, p2, p3, p4, p5)); \
  1.2203 -				} \
  1.2204 -				else \
  1.2205 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
  1.2206 -			}; \
  1.2207 -		}; \
  1.2208 -	}; \
  1.2209 -	\
  1.2210 -	bool TestClass##id::ms_DoRecall = false; \
  1.2211 -	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall)
  1.2212 -
  1.2213 -
  1.2214  #define THGM_SETUP_PI5(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags, p4_type, p4_passtype, p4_flags, p5_type, p5_passtype, p5_flags) \
  1.2215  	void setuppi_##id() \
  1.2216  	{ \
  1.2217 @@ -2898,10 +1470,7 @@
  1.2218  	struct TestClass##id; \
  1.2219  	typedef ParamState6<0, param1, param2, param3, param4, param5, param6 > ParamState_m##id; \
  1.2220  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.2221 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2222 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2223 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2224 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2225 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2226  	\
  1.2227  	struct TestClass##id \
  1.2228  	{ \
  1.2229 @@ -2914,70 +1483,25 @@
  1.2230  			g_Inside_LeafFunc = false; \
  1.2231  		} \
  1.2232  		\
  1.2233 -		struct Delegate1 : public MyDelegate \
  1.2234 +		struct Delegate : public MyDelegate \
  1.2235  		{ \
  1.2236 +			int m_DelegNumber; \
  1.2237 +			Delegate(int num) : m_DelegNumber(num) { } \
  1.2238 +			\
  1.2239  			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \
  1.2240  			{ \
  1.2241  				g_Inside_LeafFunc = true; \
  1.2242 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2243 -				g_Inside_LeafFunc = false; \
  1.2244 -				if (ms_DoRecall) \
  1.2245 -				{ \
  1.2246 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2247 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, p5, p6)); \
  1.2248 -				} \
  1.2249 -				else \
  1.2250 -					RETURN_META(MRES_IGNORED); \
  1.2251 -			} \
  1.2252 -		}; \
  1.2253 -		struct Delegate2 : public MyDelegate \
  1.2254 -		{ \
  1.2255 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \
  1.2256 -			{ \
  1.2257 -				g_Inside_LeafFunc = true; \
  1.2258 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2259 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2260  				g_Inside_LeafFunc = false; \
  1.2261  				if (ms_DoRecall) \
  1.2262  				{ \
  1.2263  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2264 -					RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3, p4, p5, p6)); \
  1.2265 -				} \
  1.2266 -				else \
  1.2267 -					RETURN_META(MRES_SUPERCEDE); \
  1.2268 -			} \
  1.2269 -		}; \
  1.2270 -		struct Delegate3 : public MyDelegate \
  1.2271 -		{ \
  1.2272 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \
  1.2273 -			{ \
  1.2274 -				g_Inside_LeafFunc = true; \
  1.2275 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2276 -				g_Inside_LeafFunc = false; \
  1.2277 -				if (ms_DoRecall) \
  1.2278 -				{ \
  1.2279 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2280 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, p5, p6)); \
  1.2281 +					RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3, p4, p5, p6)); \
  1.2282  				} \
  1.2283  				else \
  1.2284 -					RETURN_META(MRES_IGNORED); \
  1.2285 +					RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
  1.2286  			} \
  1.2287  		}; \
  1.2288 -		struct Delegate4 : public MyDelegate \
  1.2289 -		{ \
  1.2290 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \
  1.2291 -			{ \
  1.2292 -				g_Inside_LeafFunc = true; \
  1.2293 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2294 -				g_Inside_LeafFunc = false; \
  1.2295 -				if (ms_DoRecall) \
  1.2296 -				{ \
  1.2297 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2298 -					RETURN_META_NEWPARAMS(MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3, p4, p5, p6)); \
  1.2299 -				} \
  1.2300 -				else \
  1.2301 -					RETURN_META(MRES_SUPERCEDE); \
  1.2302 -			}; \
  1.2303 -		}; \
  1.2304  	}; \
  1.2305  	\
  1.2306  	bool TestClass##id::ms_DoRecall = false; \
  1.2307 @@ -2989,10 +1513,7 @@
  1.2308  	typedef ret_type RetType##id; \
  1.2309  	typedef ParamState6<0, param1, param2, param3, param4, param5, param6 > ParamState_m##id; \
  1.2310  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.2311 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2312 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2313 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2314 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2315 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2316  	\
  1.2317  	struct TestClass##id \
  1.2318  	{ \
  1.2319 @@ -3007,70 +1528,25 @@
  1.2320  			return MakeRet< ret_type >::Do(0); \
  1.2321  		} \
  1.2322  		\
  1.2323 -		struct Delegate1 : public MyDelegate \
  1.2324 +		struct Delegate : public MyDelegate \
  1.2325  		{ \
  1.2326 +			int m_DelegNumber; \
  1.2327 +			Delegate(int num) : m_DelegNumber(num) { } \
  1.2328 +			\
  1.2329  			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \
  1.2330  			{ \
  1.2331  				g_Inside_LeafFunc = true; \
  1.2332 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2333 -				g_Inside_LeafFunc = false; \
  1.2334 -				if (ms_DoRecall) \
  1.2335 -				{ \
  1.2336 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2337 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (p1, p2, p3, p4, p5, p6)); \
  1.2338 -				} \
  1.2339 -				else \
  1.2340 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
  1.2341 -			} \
  1.2342 -		}; \
  1.2343 -		struct Delegate2 : public MyDelegate \
  1.2344 -		{ \
  1.2345 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \
  1.2346 -			{ \
  1.2347 -				g_Inside_LeafFunc = true; \
  1.2348 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2349 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2350  				g_Inside_LeafFunc = false; \
  1.2351  				if (ms_DoRecall) \
  1.2352  				{ \
  1.2353  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2354 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (p1, p2, p3, p4, p5, p6)); \
  1.2355 -				} \
  1.2356 -				else \
  1.2357 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
  1.2358 -			} \
  1.2359 -		}; \
  1.2360 -		struct Delegate3 : public MyDelegate \
  1.2361 -		{ \
  1.2362 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \
  1.2363 -			{ \
  1.2364 -				g_Inside_LeafFunc = true; \
  1.2365 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2366 -				g_Inside_LeafFunc = false; \
  1.2367 -				if (ms_DoRecall) \
  1.2368 -				{ \
  1.2369 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2370 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (p1, p2, p3, p4, p5, p6)); \
  1.2371 +					RETURN_META_VALUE_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber), &TestClass##id::Func, (p1, p2, p3, p4, p5, p6)); \
  1.2372  				} \
  1.2373  				else \
  1.2374 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
  1.2375 +					RETURN_META_VALUE((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, MakeRet< ret_type >::Do(m_DelegNumber)); \
  1.2376  			} \
  1.2377  		}; \
  1.2378 -		struct Delegate4 : public MyDelegate \
  1.2379 -		{ \
  1.2380 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \
  1.2381 -			{ \
  1.2382 -				g_Inside_LeafFunc = true; \
  1.2383 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2384 -				g_Inside_LeafFunc = false; \
  1.2385 -				if (ms_DoRecall) \
  1.2386 -				{ \
  1.2387 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2388 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (p1, p2, p3, p4, p5, p6)); \
  1.2389 -				} \
  1.2390 -				else \
  1.2391 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
  1.2392 -			}; \
  1.2393 -		}; \
  1.2394  	}; \
  1.2395  	\
  1.2396  	bool TestClass##id::ms_DoRecall = false; \
  1.2397 @@ -3080,10 +1556,7 @@
  1.2398  	struct TestClass##id; \
  1.2399  	typedef ParamState7<0, param1, param2, param3, param4, param5, param6, std::string > ParamState_m##id; \
  1.2400  	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.2401 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2402 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2403 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2404 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2405 +	MAKE_STATE_4(State_Deleg_##id, int /*delegnumber*/, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2406  	\
  1.2407  	struct TestClass##id \
  1.2408  	{ \
  1.2409 @@ -3104,169 +1577,30 @@
  1.2410  			g_Inside_LeafFunc = false; \
  1.2411  		} \
  1.2412  		\
  1.2413 -		struct Delegate1 : public MyDelegate \
  1.2414 +		struct Delegate : public MyDelegate \
  1.2415  		{ \
  1.2416 +			int m_DelegNumber; \
  1.2417 +			Delegate(int num) : m_DelegNumber(num) { } \
  1.2418 +			\
  1.2419  			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, const char *buf) \
  1.2420  			{ \
  1.2421  				g_Inside_LeafFunc = true; \
  1.2422 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6, buf))); \
  1.2423 -				g_Inside_LeafFunc = false; \
  1.2424 -				if (ms_DoRecall) \
  1.2425 -				{ \
  1.2426 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2427 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, p5, p6, "%s!", buf)); \
  1.2428 -				} \
  1.2429 -				else \
  1.2430 -					RETURN_META(MRES_IGNORED); \
  1.2431 -			} \
  1.2432 -		}; \
  1.2433 -		struct Delegate2 : public MyDelegate \
  1.2434 -		{ \
  1.2435 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, const char *buf) \
  1.2436 -			{ \
  1.2437 -				g_Inside_LeafFunc = true; \
  1.2438 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6, buf))); \
  1.2439 +				ADD_STATE(State_Deleg_##id(m_DelegNumber, META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6, buf))); \
  1.2440  				g_Inside_LeafFunc = false; \
  1.2441  				if (ms_DoRecall) \
  1.2442  				{ \
  1.2443  					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2444 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, p5, p6, "%s!", buf)); \
  1.2445 -				} \
  1.2446 -				else \
  1.2447 -					RETURN_META(MRES_SUPERCEDE); \
  1.2448 -			} \
  1.2449 -		}; \
  1.2450 -		struct Delegate3 : public MyDelegate \
  1.2451 -		{ \
  1.2452 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, const char *buf) \
  1.2453 -			{ \
  1.2454 -				g_Inside_LeafFunc = true; \
  1.2455 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6, buf))); \
  1.2456 -				g_Inside_LeafFunc = false; \
  1.2457 -				if (ms_DoRecall) \
  1.2458 -				{ \
  1.2459 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2460 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, p5, p6, "%s!", buf)); \
  1.2461 +					RETURN_META_NEWPARAMS((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE, &TestClass##id::Func, (p1, p2, p3, p4, p5, p6, "%s!", buf)); \
  1.2462  				} \
  1.2463  				else \
  1.2464 -					RETURN_META(MRES_IGNORED); \
  1.2465 +					RETURN_META((m_DelegNumber & 1) ? MRES_IGNORED : MRES_SUPERCEDE); \
  1.2466  			} \
  1.2467  		}; \
  1.2468 -		struct Delegate4 : public MyDelegate \
  1.2469 -		{ \
  1.2470 -			virtual void Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6, const char *buf) \
  1.2471 -			{ \
  1.2472 -				g_Inside_LeafFunc = true; \
  1.2473 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6, buf))); \
  1.2474 -				g_Inside_LeafFunc = false; \
  1.2475 -				if (ms_DoRecall) \
  1.2476 -				{ \
  1.2477 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2478 -					RETURN_META_NEWPARAMS(MRES_IGNORED, &TestClass##id::Func, (p1, p2, p3, p4, p5, p6, "%s!", buf)); \
  1.2479 -				} \
  1.2480 -				else \
  1.2481 -					RETURN_META(MRES_SUPERCEDE); \
  1.2482 -			}; \
  1.2483 -		}; \
  1.2484  	}; \
  1.2485  	\
  1.2486  	bool TestClass##id::ms_DoRecall = false; \
  1.2487  	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall | SourceHook::ProtoInfo::CallConv_HasVafmt);
  1.2488  
  1.2489 -
  1.2490 -#define THGM_MAKE_TEST6_vafmt(id, ret_type, param1, param2, param3, param4, param5, param6) \
  1.2491 -	struct TestClass##id; \
  1.2492 -	typedef ret_type RetType##id; \
  1.2493 -	typedef ParamState6<0, param1, param2, param3, param4, param5, param6 > ParamState_m##id; \
  1.2494 -	MAKE_STATE_2(State_Func##id, TestClass##id* /*thisptr*/, ParamState_m##id ); \
  1.2495 -	MAKE_STATE_3(State_Deleg1_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2496 -	MAKE_STATE_3(State_Deleg2_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2497 -	MAKE_STATE_3(State_Deleg3_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2498 -	MAKE_STATE_3(State_Deleg4_##id, TestClass##id* /*ifptr*/, int /*deleg thisptr*/, ParamState_m##id ); \
  1.2499 -	\
  1.2500 -	struct TestClass##id \
  1.2501 -	{ \
  1.2502 -		static bool ms_DoRecall; \
  1.2503 -		\
  1.2504 -		virtual ret_type Func(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \
  1.2505 -		{ \
  1.2506 -			g_Inside_LeafFunc = true; \
  1.2507 -			ADD_STATE(State_Func##id(this, ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2508 -			g_Inside_LeafFunc = false; \
  1.2509 -			\
  1.2510 -			return MakeRet< ret_type >::Do(0); \
  1.2511 -		} \
  1.2512 -		\
  1.2513 -		struct Delegate1 : public MyDelegate \
  1.2514 -		{ \
  1.2515 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \
  1.2516 -			{ \
  1.2517 -				g_Inside_LeafFunc = true; \
  1.2518 -				ADD_STATE(State_Deleg1_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2519 -				g_Inside_LeafFunc = false; \
  1.2520 -				if (ms_DoRecall) \
  1.2521 -				{ \
  1.2522 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2523 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(1), &TestClass##id::Func, (p1, p2, p3, p4, p5, p6)); \
  1.2524 -				} \
  1.2525 -				else \
  1.2526 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(1)); \
  1.2527 -			} \
  1.2528 -		}; \
  1.2529 -		struct Delegate2 : public MyDelegate \
  1.2530 -		{ \
  1.2531 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \
  1.2532 -			{ \
  1.2533 -				g_Inside_LeafFunc = true; \
  1.2534 -				ADD_STATE(State_Deleg2_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2535 -				g_Inside_LeafFunc = false; \
  1.2536 -				if (ms_DoRecall) \
  1.2537 -				{ \
  1.2538 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2539 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2), &TestClass##id::Func, (p1, p2, p3, p4, p5, p6)); \
  1.2540 -				} \
  1.2541 -				else \
  1.2542 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(2)); \
  1.2543 -			} \
  1.2544 -		}; \
  1.2545 -		struct Delegate3 : public MyDelegate \
  1.2546 -		{ \
  1.2547 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \
  1.2548 -			{ \
  1.2549 -				g_Inside_LeafFunc = true; \
  1.2550 -				ADD_STATE(State_Deleg3_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2551 -				g_Inside_LeafFunc = false; \
  1.2552 -				if (ms_DoRecall) \
  1.2553 -				{ \
  1.2554 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2555 -					RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, MakeRet< ret_type >::Do(3), &TestClass##id::Func, (p1, p2, p3, p4, p5, p6)); \
  1.2556 -				} \
  1.2557 -				else \
  1.2558 -					RETURN_META_VALUE(MRES_IGNORED, MakeRet< ret_type >::Do(3)); \
  1.2559 -			} \
  1.2560 -		}; \
  1.2561 -		struct Delegate4 : public MyDelegate \
  1.2562 -		{ \
  1.2563 -			virtual ret_type Call(param1 p1, param2 p2, param3 p3, param4 p4, param5 p5, param6 p6) \
  1.2564 -			{ \
  1.2565 -				g_Inside_LeafFunc = true; \
  1.2566 -				ADD_STATE(State_Deleg4_##id(META_IFACEPTR(TestClass##id), PtrBuf(this), ParamState_m##id(p1, p2, p3, p4, p5, p6))); \
  1.2567 -				g_Inside_LeafFunc = false; \
  1.2568 -				if (ms_DoRecall) \
  1.2569 -				{ \
  1.2570 -					Increment<StripRef< param1 >::type>::Incr(p1);Increment<StripRef< param2 >::type>::Incr(p2);Increment<StripRef< param3 >::type>::Incr(p3);Increment<StripRef< param4 >::type>::Incr(p4);Increment<StripRef< param5 >::type>::Incr(p5);Increment<StripRef< param6 >::type>::Incr(p6); \
  1.2571 -					RETURN_META_VALUE_NEWPARAMS(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4), &TestClass##id::Func, (p1, p2, p3, p4, p5, p6)); \
  1.2572 -				} \
  1.2573 -				else \
  1.2574 -					RETURN_META_VALUE(MRES_SUPERCEDE, MakeRet< ret_type >::Do(4)); \
  1.2575 -			}; \
  1.2576 -		}; \
  1.2577 -	}; \
  1.2578 -	\
  1.2579 -	bool TestClass##id::ms_DoRecall = false; \
  1.2580 -	SourceHook::CProtoInfoBuilder protoinfo_##id(SourceHook::ProtoInfo::CallConv_ThisCall)
  1.2581 -
  1.2582 -
  1.2583  #define THGM_SETUP_PI6(id, p1_type, p1_passtype, p1_flags, p2_type, p2_passtype, p2_flags, p3_type, p3_passtype, p3_flags, p4_type, p4_passtype, p4_flags, p5_type, p5_passtype, p5_flags, p6_type, p6_passtype, p6_flags) \
  1.2584  	void setuppi_##id() \
  1.2585  	{ \
  1.2586 @@ -3330,7 +1664,7 @@
  1.2587  	
  1.2588  #define THGM_ADD_HOOK(id, num) \
  1.2589  	CAT4(hook, num, _, id) = g_SHPtr->AddHook(g_PLID, SourceHook::ISourceHook::Hook_Normal, reinterpret_cast<void*>(pTest##id), \
  1.2590 -		0, myhookman##id, PtrBufPtr(new TestClass##id::Delegate##num), num >= 3);
  1.2591 +		0, myhookman##id, PtrBufPtr(new TestClass##id::Delegate(num)), num >= 3);
  1.2592  
  1.2593  #define THGM_REMOVE_HOOK(id, num) \
  1.2594  	g_SHPtr->RemoveHookByID(CAT4(hook, num, _, id));
  1.2595 @@ -3357,37 +1691,15 @@
  1.2596  		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2597  		NULL), "Test" #id " Part1"); \
  1.2598  	\
  1.2599 -			/* hook1 - no hooks */ \
  1.2600 -	PtrBuf_Clear(); \
  1.2601 -	THGM_ADD_HOOK(id, 1); \
  1.2602 -	THGM_CALLS_void(id, call_params); \
  1.2603 -	CHECK_STATES((&g_States, \
  1.2604 -		new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
  1.2605 -		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2606 -		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2607 -		NULL), "Test" #id " Part2"); \
  1.2608 -	THGM_REMOVE_HOOK(id, 1); \
  1.2609 -	\
  1.2610 -			/* no hooks - hook3 */ \
  1.2611 -	PtrBuf_Clear(); \
  1.2612 -	THGM_ADD_HOOK(id, 3); \
  1.2613 -	THGM_CALLS_void(id, call_params); \
  1.2614 -	CHECK_STATES((&g_States, \
  1.2615 -		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2616 -		new State_Deleg3_##id(pTest##id, 0, ParamState_m##id call_params), \
  1.2617 -		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2618 -		NULL), "Test" #id " Part3"); \
  1.2619 -	THGM_REMOVE_HOOK(id, 3); \
  1.2620 -	\
  1.2621  			/* hook1 - hook3 */ \
  1.2622  	PtrBuf_Clear(); \
  1.2623  	THGM_ADD_HOOK(id, 1); \
  1.2624  	THGM_ADD_HOOK(id, 3); \
  1.2625  	THGM_CALLS_void(id, call_params); \
  1.2626  	CHECK_STATES((&g_States, \
  1.2627 -		new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
  1.2628 +		new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params), \
  1.2629  		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2630 -		new State_Deleg3_##id(pTest##id, 1, ParamState_m##id call_params), \
  1.2631 +		new State_Deleg_##id(3, pTest##id, 1, ParamState_m##id call_params), \
  1.2632  		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2633  		NULL), "Test" #id " Part4"); \
  1.2634  	THGM_REMOVE_HOOK(id, 1); \
  1.2635 @@ -3400,26 +1712,19 @@
  1.2636  	THGM_ADD_HOOK(id, 3); \
  1.2637  	THGM_CALLS_void(id, call_params); \
  1.2638  	CHECK_STATES((&g_States, \
  1.2639 -		new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
  1.2640 -		new State_Deleg2_##id(pTest##id, 1, ParamState_m##id call_params), \
  1.2641 -		new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params), \
  1.2642 +		new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params), \
  1.2643 +		new State_Deleg_##id(2, pTest##id, 1, ParamState_m##id call_params), \
  1.2644 +		new State_Deleg_##id(3, pTest##id, 2, ParamState_m##id call_params), \
  1.2645  		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2646  		NULL), "Test" #id " Part5"); \
  1.2647 -	THGM_REMOVE_HOOK(id, 1); \
  1.2648 -	THGM_REMOVE_HOOK(id, 2); \
  1.2649 -	THGM_REMOVE_HOOK(id, 3); \
  1.2650  			/* hook1, hook2 - hook3, hook4 */ \
  1.2651 -	PtrBuf_Clear(); \
  1.2652 -	THGM_ADD_HOOK(id, 1); \
  1.2653 -	THGM_ADD_HOOK(id, 2); \
  1.2654 -	THGM_ADD_HOOK(id, 3); \
  1.2655  	THGM_ADD_HOOK(id, 4); \
  1.2656  	THGM_CALLS_void(id, call_params); \
  1.2657  	CHECK_STATES((&g_States, \
  1.2658 -		new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
  1.2659 -		new State_Deleg2_##id(pTest##id, 1, ParamState_m##id call_params), \
  1.2660 -		new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params), \
  1.2661 -		new State_Deleg4_##id(pTest##id, 3, ParamState_m##id call_params), \
  1.2662 +		new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params), \
  1.2663 +		new State_Deleg_##id(2, pTest##id, 1, ParamState_m##id call_params), \
  1.2664 +		new State_Deleg_##id(3, pTest##id, 2, ParamState_m##id call_params), \
  1.2665 +		new State_Deleg_##id(4, pTest##id, 3, ParamState_m##id call_params), \
  1.2666  		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2667  		NULL), "Test" #id " Part6"); \
  1.2668  		\
  1.2669 @@ -3429,10 +1734,10 @@
  1.2670  	THGM_REMOVE_HOOK(id, 2); \
  1.2671  	THGM_CALLS_void(id, call_params); \
  1.2672  	CHECK_STATES((&g_States, \
  1.2673 -		new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params(0)), \
  1.2674 +		new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params(0)), \
  1.2675  		new State_Func##id(pTest##id, ParamState_m##id call_params(1)), \
  1.2676 -		new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params(1)), \
  1.2677 -		new State_Deleg4_##id(pTest##id, 3, ParamState_m##id call_params(2)), \
  1.2678 +		new State_Deleg_##id(3, pTest##id, 2, ParamState_m##id call_params(1)), \
  1.2679 +		new State_Deleg_##id(4, pTest##id, 3, ParamState_m##id call_params(2)), \
  1.2680  		/* sh_call one */ \
  1.2681  		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2682  		NULL), "Test" #id " Part7"); \
  1.2683 @@ -3475,37 +1780,15 @@
  1.2684  		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2685  		NULL), "Test" #id " Part1"); \
  1.2686  	\
  1.2687 -			/* hook1 - no hooks */ \
  1.2688 -	PtrBuf_Clear(); \
  1.2689 -	THGM_ADD_HOOK(id, 1); \
  1.2690 -	THGM_CALLS(id, call_params, 0, 0, "Part2"); \
  1.2691 -	CHECK_STATES((&g_States, \
  1.2692 -		new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
  1.2693 -		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2694 -		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2695 -		NULL), "Test" #id " Part2"); \
  1.2696 -	THGM_REMOVE_HOOK(id, 1); \
  1.2697 -	\
  1.2698 -			/* no hooks - hook3 */ \
  1.2699 -	PtrBuf_Clear(); \
  1.2700 -	THGM_ADD_HOOK(id, 3); \
  1.2701 -	THGM_CALLS(id, call_params, 0, 0, "Part3"); \
  1.2702 -	CHECK_STATES((&g_States, \
  1.2703 -		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2704 -		new State_Deleg3_##id(pTest##id, 0, ParamState_m##id call_params), \
  1.2705 -		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2706 -		NULL), "Test" #id " Part3"); \
  1.2707 -	THGM_REMOVE_HOOK(id, 3); \
  1.2708 -	\
  1.2709  			/* hook1 - hook3 */ \
  1.2710  	PtrBuf_Clear(); \
  1.2711  	THGM_ADD_HOOK(id, 1); \
  1.2712  	THGM_ADD_HOOK(id, 3); \
  1.2713  	THGM_CALLS(id, call_params, 0, 0, "Part4"); \
  1.2714  	CHECK_STATES((&g_States, \
  1.2715 -		new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
  1.2716 +		new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params), \
  1.2717  		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2718 -		new State_Deleg3_##id(pTest##id, 1, ParamState_m##id call_params), \
  1.2719 +		new State_Deleg_##id(3, pTest##id, 1, ParamState_m##id call_params), \
  1.2720  		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2721  		NULL), "Test" #id " Part4"); \
  1.2722  	THGM_REMOVE_HOOK(id, 1); \
  1.2723 @@ -3518,26 +1801,19 @@
  1.2724  	THGM_ADD_HOOK(id, 3); \
  1.2725  	THGM_CALLS(id, call_params, 2, 0, "Part5"); \
  1.2726  	CHECK_STATES((&g_States, \
  1.2727 -		new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
  1.2728 -		new State_Deleg2_##id(pTest##id, 1, ParamState_m##id call_params), \
  1.2729 -		new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params), \
  1.2730 +		new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params), \
  1.2731 +		new State_Deleg_##id(2, pTest##id, 1, ParamState_m##id call_params), \
  1.2732 +		new State_Deleg_##id(3, pTest##id, 2, ParamState_m##id call_params), \
  1.2733  		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2734  		NULL), "Test" #id " Part5"); \
  1.2735 -	THGM_REMOVE_HOOK(id, 1); \
  1.2736 -	THGM_REMOVE_HOOK(id, 2); \
  1.2737 -	THGM_REMOVE_HOOK(id, 3); \
  1.2738  			/* hook1, hook2 - hook3, hook4 */ \
  1.2739 -	PtrBuf_Clear(); \
  1.2740 -	THGM_ADD_HOOK(id, 1); \
  1.2741 -	THGM_ADD_HOOK(id, 2); \
  1.2742 -	THGM_ADD_HOOK(id, 3); \
  1.2743  	THGM_ADD_HOOK(id, 4); \
  1.2744  	THGM_CALLS(id, call_params, 4, 0, "Part6"); \
  1.2745  	CHECK_STATES((&g_States, \
  1.2746 -		new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params), \
  1.2747 -		new State_Deleg2_##id(pTest##id, 1, ParamState_m##id call_params), \
  1.2748 -		new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params), \
  1.2749 -		new State_Deleg4_##id(pTest##id, 3, ParamState_m##id call_params), \
  1.2750 +		new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params), \
  1.2751 +		new State_Deleg_##id(2, pTest##id, 1, ParamState_m##id call_params), \
  1.2752 +		new State_Deleg_##id(3, pTest##id, 2, ParamState_m##id call_params), \
  1.2753 +		new State_Deleg_##id(4, pTest##id, 3, ParamState_m##id call_params), \
  1.2754  		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2755  		NULL), "Test" #id " Part6"); \
  1.2756  		\
  1.2757 @@ -3547,10 +1823,10 @@
  1.2758  	THGM_REMOVE_HOOK(id, 2); \
  1.2759  	THGM_CALLS(id, call_params, 4, 0, "Part7"); \
  1.2760  	CHECK_STATES((&g_States, \
  1.2761 -		new State_Deleg1_##id(pTest##id, 0, ParamState_m##id call_params(0)), \
  1.2762 +		new State_Deleg_##id(1, pTest##id, 0, ParamState_m##id call_params(0)), \
  1.2763  		new State_Func##id(pTest##id, ParamState_m##id call_params(1)), \
  1.2764 -		new State_Deleg3_##id(pTest##id, 2, ParamState_m##id call_params(1)), \
  1.2765 -		new State_Deleg4_##id(pTest##id, 3, ParamState_m##id call_params(2)), \
  1.2766 +		new State_Deleg_##id(3, pTest##id, 2, ParamState_m##id call_params(1)), \
  1.2767 +		new State_Deleg_##id(4, pTest##id, 3, ParamState_m##id call_params(2)), \
  1.2768  		/* sh_call one */ \
  1.2769  		new State_Func##id(pTest##id, ParamState_m##id call_params), \
  1.2770  		NULL), "Test" #id " Part7"); \