diff -r 1f2595deaf77 -r 4e43bcc83a54 extensions/sdktools/vhelpers.cpp --- a/extensions/sdktools/vhelpers.cpp Tue Mar 19 11:24:01 2013 -0400 +++ b/extensions/sdktools/vhelpers.cpp Tue Mar 19 11:25:04 2013 -0400 @@ -708,41 +708,56 @@ return; } - ICallWrapper *pWrapper = NULL; + static CEntityFactoryDictionary *dict = NULL; + if (dict == NULL) + { + void *addr; + if (g_pGameConf->GetMemSig("EntityFactoryFinder", (void **)&addr) && addr) + { + int offset; + if (!g_pGameConf->GetOffset("EntityFactoryOffset", &offset) || !offset) + { + return; + } + dict = *reinterpret_cast((intptr_t)addr + offset); + } + } - if (!pWrapper) + if (dict == NULL) { + ICallWrapper *pWrapper = NULL; + PassInfo retData; retData.flags = PASSFLAG_BYVAL; retData.size = sizeof(void *); retData.type = PassType_Basic; void *addr; - if (!g_pGameConf->GetMemSig("EntityFactory", &addr) || addr == NULL) + if (g_pGameConf->GetMemSig("EntityFactory", &addr) && addr != NULL) { - META_CONPRINT("Failed to locate function\n"); - return; + pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retData, NULL, 0); } - pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retData, NULL, 0); + if (pWrapper) + { + void *returnData = NULL; + + pWrapper->Execute(NULL, &returnData); + + pWrapper->Destroy(); + + if (returnData == NULL) + { + return; + } + + dict = ( CEntityFactoryDictionary * )returnData; + } } - - void *returnData = NULL; - - pWrapper->Execute(NULL, &returnData); - - pWrapper->Destroy(); - - if (returnData == NULL) + if ( dict == NULL ) { - return; - } - - CEntityFactoryDictionary *dict = ( CEntityFactoryDictionary * )returnData; - - if ( !dict ) - { + META_CONPRINT("Failed to locate function\n"); return; }