Add alternative lookup method for EntityFactoryDictionary (bug 5658, r=asherkin).
This commit is contained in:
parent
ec716f0c58
commit
35cd7eb2be
@ -708,26 +708,38 @@ CON_COMMAND(sm_dump_datamaps, "Dumps the data map list as a text file")
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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<CEntityFactoryDictionary **>((intptr_t)addr + offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dict == NULL)
|
||||||
|
{
|
||||||
ICallWrapper *pWrapper = NULL;
|
ICallWrapper *pWrapper = NULL;
|
||||||
|
|
||||||
if (!pWrapper)
|
|
||||||
{
|
|
||||||
PassInfo retData;
|
PassInfo retData;
|
||||||
retData.flags = PASSFLAG_BYVAL;
|
retData.flags = PASSFLAG_BYVAL;
|
||||||
retData.size = sizeof(void *);
|
retData.size = sizeof(void *);
|
||||||
retData.type = PassType_Basic;
|
retData.type = PassType_Basic;
|
||||||
|
|
||||||
void *addr;
|
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;
|
void *returnData = NULL;
|
||||||
|
|
||||||
pWrapper->Execute(NULL, &returnData);
|
pWrapper->Execute(NULL, &returnData);
|
||||||
@ -739,10 +751,13 @@ CON_COMMAND(sm_dump_datamaps, "Dumps the data map list as a text file")
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntityFactoryDictionary *dict = ( CEntityFactoryDictionary * )returnData;
|
dict = ( CEntityFactoryDictionary * )returnData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( !dict )
|
if ( dict == NULL )
|
||||||
{
|
{
|
||||||
|
META_CONPRINT("Failed to locate function\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user