sourcemm/CSmmAPI.cpp
changeset 334 f45f8e4c4bd0
parent 326 1cefbedb2d6d
child 338 3f8caf9ea756
     1.1 --- a/sourcemm/CSmmAPI.cpp	Sat May 12 19:48:31 2007 +0000
     1.2 +++ b/sourcemm/CSmmAPI.cpp	Sun May 13 02:51:11 2007 +0000
     1.3 @@ -537,21 +537,8 @@
     1.4  /* :TODO: Make this prettier */
     1.5  bool CSmmAPI::CacheUserMessages()
     1.6  {
     1.7 -	SourceHook::MemFuncInfo info = {true, -1, 0, 0};
     1.8 -	SourceHook::GetFuncInfo(&IServerGameDLL::GetUserMessageInfo, info);
     1.9 -
    1.10  	/* Get address of original GetUserMessageInfo() */
    1.11 -	char *vfunc = reinterpret_cast<char *>(g_GameDllPatch->GetOrigFunc(info.vtbloffs, info.vtblindex));
    1.12 -
    1.13 -	/* If we can't get original function, that means there's no hook */
    1.14 -	if (vfunc == NULL)
    1.15 -	{
    1.16 -		/* Get virtual function address 'manually' then */
    1.17 -		char *adjustedptr = reinterpret_cast<char *>(g_GameDll.pGameDLL) + info.thisptroffs + info.vtbloffs;
    1.18 -		char **vtable = *reinterpret_cast<char ***>(adjustedptr);
    1.19 -
    1.20 -		vfunc = vtable[info.vtblindex];
    1.21 -	}
    1.22 +	char *vfunc = (char *)SH_GET_ORIG_VFNPTR_ENTRY(g_GameDll.pGameDLL, &IServerGameDLL::GetUserMessageInfo);
    1.23  
    1.24  	/* Oh dear, we have a relative jump on our hands
    1.25  	 * PVK II on Windows made me do this, but I suppose it doesn't hurt to check this on Linux too...
    1.26 @@ -563,7 +550,7 @@
    1.27  		 * Add 5 because it's relative to next instruction:
    1.28  		 * Opcode <1 byte> + 32-bit displacement <4 bytes> 
    1.29  		 */
    1.30 -		vfunc = vfunc + *reinterpret_cast<int *>(vfunc + 1) + 5;
    1.31 +		vfunc += *reinterpret_cast<int *>(vfunc + 1) + 5;
    1.32  	}
    1.33  
    1.34  	UserMsgDict *dict = NULL;