Fixed some gamedata lookups requiring symbols on linux/mac (bug 4832, r=fyren).
This commit is contained in:
parent
a5c4739804
commit
ef082d855c
@ -133,40 +133,57 @@ void CHalfLife2::OnSourceModAllInitialized()
|
||||
void CHalfLife2::OnSourceModAllInitialized_Post()
|
||||
{
|
||||
char *addr = NULL;
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
int offset;
|
||||
|
||||
/* gEntList and/or g_pEntityList */
|
||||
if (!g_pGameConf->GetMemSig("LevelShutdown", (void **)&addr))
|
||||
/*
|
||||
* gEntList and/or g_pEntityList
|
||||
*
|
||||
* First try to lookup pointer directly for platforms with symbols.
|
||||
* If symbols aren't present (Windows or stripped Linux/Mac),
|
||||
* attempt find via LevelShutdown + offset
|
||||
*/
|
||||
if (g_pGameConf->GetMemSig("gEntList", (void **)&addr))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (LevelShutdown) - Reverting to networkable entities only");
|
||||
return;
|
||||
if (!addr)
|
||||
{
|
||||
// Key exists so notify if lookup fails, but try other method.
|
||||
g_Logger.LogError("Failed lookup of gEntList directly - Reverting to lookup via LevelShutdown");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_EntList = reinterpret_cast<void *>(addr);
|
||||
}
|
||||
}
|
||||
if (!addr)
|
||||
|
||||
|
||||
if (!g_EntList)
|
||||
{
|
||||
g_Logger.LogError("Failed lookup of LevelShutdown - Reverting to networkable entities only");
|
||||
return;
|
||||
if (!g_pGameConf->GetMemSig("LevelShutdown", (void **)&addr))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (LevelShutdown) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!addr)
|
||||
{
|
||||
g_Logger.LogError("Failed lookup of LevelShutdown - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
|
||||
int offset;
|
||||
if (!g_pGameConf->GetOffset("gEntList", &offset))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
|
||||
g_EntList = *reinterpret_cast<void **>(addr + offset);
|
||||
}
|
||||
if (!g_pGameConf->GetOffset("gEntList", &offset))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
g_EntList = *reinterpret_cast<void **>(addr + offset);
|
||||
#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
/* gEntList and/or g_pEntityList */
|
||||
if (!g_pGameConf->GetMemSig("gEntList", (void **)&addr))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
if (!addr)
|
||||
|
||||
if (!g_EntList)
|
||||
{
|
||||
g_Logger.LogError("Failed lookup of gEntList - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
g_EntList = reinterpret_cast<void *>(addr);
|
||||
#endif
|
||||
|
||||
if (!g_pGameConf->GetOffset("EntInfo", &entInfoOffset))
|
||||
{
|
||||
|
@ -285,26 +285,33 @@ void TempEntityManager::Initialize()
|
||||
int offset;
|
||||
m_Loaded = false;
|
||||
|
||||
/*
|
||||
* First try to lookup s_pTempEntities directly for platforms with symbols.
|
||||
* If symbols aren't present (Windows or stripped Linux/Mac),
|
||||
* attempt find via CBaseTempEntity ctor + offset
|
||||
*/
|
||||
|
||||
/* Read our sigs and offsets from the config file */
|
||||
#if defined PLATFORM_WINDOWS
|
||||
if (!g_pGameConf->GetMemSig("CBaseTempEntity", &addr) || !addr)
|
||||
if (g_pGameConf->GetMemSig("s_pTempEntities", &addr) && addr)
|
||||
{
|
||||
|
||||
/* Store the head of the TE linked list */
|
||||
m_ListHead = *(void **)addr;
|
||||
}
|
||||
else if (g_pGameConf->GetMemSig("CBaseTempEntity", &addr) && addr)
|
||||
{
|
||||
if (!g_pGameConf->GetOffset("s_pTempEntities", &offset))
|
||||
{
|
||||
return;
|
||||
}
|
||||
/* Store the head of the TE linked list */
|
||||
m_ListHead = **(void ***)((unsigned char *)addr + offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!g_pGameConf->GetOffset("s_pTempEntities", &offset))
|
||||
{
|
||||
return;
|
||||
}
|
||||
/* Store the head of the TE linked list */
|
||||
m_ListHead = **(void ***)((unsigned char *)addr + offset);
|
||||
#else
|
||||
if (!g_pGameConf->GetMemSig("s_pTempEntities", &addr) || !addr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
/* Store the head of the TE linked list */
|
||||
m_ListHead = *(void **)addr;
|
||||
#endif
|
||||
|
||||
if (!g_pGameConf->GetOffset("GetTEName", &m_NameOffs))
|
||||
{
|
||||
return;
|
||||
|
@ -39,29 +39,28 @@ void InitializeValveGlobals()
|
||||
{
|
||||
g_EntList = gamehelpers->GetGlobalEntityList();
|
||||
|
||||
/*
|
||||
* g_pGameRules
|
||||
*
|
||||
* First try to lookup pointer directly for platforms with symbols.
|
||||
* If symbols aren't present (Windows or stripped Linux/Mac),
|
||||
* attempt find via CreateGameRulesObject + offset
|
||||
*/
|
||||
|
||||
char *addr;
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
/* g_pGameRules */
|
||||
if (!g_pGameConf->GetMemSig("CreateGameRulesObject", (void **)&addr) || !addr)
|
||||
if (g_pGameConf->GetMemSig("g_pGameRules", (void **)&addr) && addr)
|
||||
{
|
||||
return;
|
||||
g_pGameRules = reinterpret_cast<void **>(addr);
|
||||
}
|
||||
|
||||
int offset;
|
||||
if (!g_pGameConf->GetOffset("g_pGameRules", &offset) || !offset)
|
||||
else if (g_pGameConf->GetMemSig("CreateGameRulesObject", (void **)&addr) && addr)
|
||||
{
|
||||
return;
|
||||
int offset;
|
||||
if (!g_pGameConf->GetOffset("g_pGameRules", &offset) || !offset)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_pGameRules = *reinterpret_cast<void ***>(addr + offset);
|
||||
}
|
||||
g_pGameRules = *reinterpret_cast<void ***>(addr + offset);
|
||||
#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
/* g_pGameRules */
|
||||
if (!g_pGameConf->GetMemSig("g_pGameRules", (void **)&addr) || !addr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
g_pGameRules = reinterpret_cast<void **>(addr);
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t UTIL_StringToSignature(const char *str, char buffer[], size_t maxlength)
|
||||
|
Loading…
Reference in New Issue
Block a user