From b8e4510f7ed32372a4c75e5123a88e0b84561daa Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Thu, 30 Oct 2014 19:24:53 -0400 Subject: [PATCH] Eliminate need for s_pTempEnts gamedata on sdk2013 and soon css/dods/hl2dm (already on tf2). --- extensions/sdktools/tempents.cpp | 54 +++++++++++++++++++------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/extensions/sdktools/tempents.cpp b/extensions/sdktools/tempents.cpp index e492fff2..2a41b7b0 100644 --- a/extensions/sdktools/tempents.cpp +++ b/extensions/sdktools/tempents.cpp @@ -285,36 +285,46 @@ void TempEntityManager::Initialize() int offset; m_Loaded = false; -#if SOURCE_ENGINE == SE_TF2 - m_ListHead = servertools->GetTempEntList(); -#else - /* - * 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 - */ +#if SOURCE_ENGINE == SE_TF2 \ + || SOURCE_ENGINE == SE_DODS \ + || SOURCE_ENGINE == SE_HL2DM \ + || SOURCE_ENGINE == SE_CSS \ + || SOURCE_ENGINE == SE_SDK2013 - /* Read our sigs and offsets from the config file */ - if (g_pGameConf->GetMemSig("s_pTempEntities", &addr) && addr) + if (g_SMAPI->GetServerFactory(false)("VSERVERTOOLS003", nullptr)) { - - /* Store the head of the TE linked list */ - m_ListHead = *(void **)addr; + m_ListHead = servertools->GetTempEntList(); } - else if (g_pGameConf->GetMemSig("CBaseTempEntity", &addr) && addr) + else +#endif { - if (!g_pGameConf->GetOffset("s_pTempEntities", &offset)) + /* + * 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 (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; } - /* Store the head of the TE linked list */ - m_ListHead = **(void ***)((unsigned char *)addr + offset); } - else - { - return; - } -#endif // == TF2 if (!g_pGameConf->GetOffset("GetTEName", &m_NameOffs)) {