core-legacy/util.h
changeset 659 b35a5fdbc654
parent 580 783e91c5f445
child 661 952a16ae1d2b
     1.1 --- a/core-legacy/util.h	Fri Feb 27 00:19:50 2009 -0600
     1.2 +++ b/core-legacy/util.h	Wed Oct 28 23:14:32 2009 -0700
     1.3 @@ -81,27 +81,16 @@
     1.4   *
     1.5   * @param mfp			Member function pointer to virtual function.
     1.6   * @param ptr			Pointer to interface in which the virtual function belongs.
     1.7 - * @param cls			A CallClass for the interface in which the virtual function belongs.
     1.8   * @return				Address of function originally pointed to by the virtual function.
     1.9   */
    1.10  template <class MFP, class Iface>
    1.11 -char *UTIL_GetOrigFunction(MFP vfunc, Iface *ptr, SourceHook::CallClass<Iface> *cls)
    1.12 +char *UTIL_GetOrigFunction(MFP vfunc, Iface *ptr)
    1.13  {
    1.14  	SourceHook::MemFuncInfo info = {true, -1, 0, 0};
    1.15  	SourceHook::GetFuncInfo(vfunc, info);
    1.16  
    1.17  	/* Get address of original GetUserMessageInfo() */
    1.18 -	char *func = reinterpret_cast<char *>(cls->GetOrigFunc(info.vtbloffs, info.vtblindex));
    1.19 -
    1.20 -	/* If we can't get original function, that means there's no hook */
    1.21 -	if (func == NULL)
    1.22 -	{
    1.23 -		/* Get virtual function address 'manually' then */
    1.24 -		char *adjustedptr = reinterpret_cast<char *>(ptr) + info.vtbloffs + info.vtbloffs;
    1.25 -		char **vtable = *reinterpret_cast<char ***>(adjustedptr);
    1.26 -
    1.27 -		func = vtable[info.vtblindex];
    1.28 -	}
    1.29 +	char *func = reinterpret_cast<char *>(SH_GET_ORIG_VFNPTR_ENTRY(ptr, vfunc));
    1.30  
    1.31  	/* Check for relative jumps */
    1.32  	if (func[0] == IA32_JMP_IMM32)