extensions/sdktools/tempents.cpp
changeset 3221 ca0e525dcf86
parent 2583 d3b2571c378b
child 4279 07c27b13d08b
     1.1 --- a/extensions/sdktools/tempents.cpp	Mon Apr 04 13:37:29 2011 -0400
     1.2 +++ b/extensions/sdktools/tempents.cpp	Mon Apr 04 13:44:19 2011 -0400
     1.3 @@ -285,26 +285,33 @@
     1.4  	int offset;
     1.5  	m_Loaded = false;
     1.6  
     1.7 +	/*
     1.8 +	 * First try to lookup s_pTempEntities directly for platforms with symbols.
     1.9 +	 * If symbols aren't present (Windows or stripped Linux/Mac), 
    1.10 +	 * attempt find via CBaseTempEntity ctor + offset
    1.11 +	 */
    1.12 +
    1.13  	/* Read our sigs and offsets from the config file */
    1.14 -#if defined PLATFORM_WINDOWS
    1.15 -	if (!g_pGameConf->GetMemSig("CBaseTempEntity", &addr) || !addr)
    1.16 +	if (g_pGameConf->GetMemSig("s_pTempEntities", &addr) && addr)
    1.17  	{
    1.18 -		return;
    1.19 +		
    1.20 +		/* Store the head of the TE linked list */
    1.21 +		m_ListHead = *(void **)addr;
    1.22  	}
    1.23 -	if (!g_pGameConf->GetOffset("s_pTempEntities", &offset))
    1.24 +	else if (g_pGameConf->GetMemSig("CBaseTempEntity", &addr) && addr)
    1.25 +	{
    1.26 +		if (!g_pGameConf->GetOffset("s_pTempEntities", &offset))
    1.27 +		{
    1.28 +			return;
    1.29 +		}
    1.30 +		/* Store the head of the TE linked list */
    1.31 +		m_ListHead = **(void ***)((unsigned char *)addr + offset);
    1.32 +	}
    1.33 +	else
    1.34  	{
    1.35  		return;
    1.36  	}
    1.37 -	/* Store the head of the TE linked list */
    1.38 -	m_ListHead = **(void ***)((unsigned char *)addr + offset);
    1.39 -#else
    1.40 -	if (!g_pGameConf->GetMemSig("s_pTempEntities", &addr) || !addr)
    1.41 -	{
    1.42 -		return;
    1.43 -	}
    1.44 -	/* Store the head of the TE linked list */
    1.45 -	m_ListHead = *(void **)addr;
    1.46 -#endif
    1.47 +
    1.48  	if (!g_pGameConf->GetOffset("GetTEName", &m_NameOffs))
    1.49  	{
    1.50  		return;