Merge pull request #174 from alliedmodders/eliminate-more-gamedata

Eliminate the need for more gamedata on some games (r=asherkin).
This commit is contained in:
Nicholas Hastings 2014-11-08 12:52:53 -05:00
commit 0d24804839
6 changed files with 100 additions and 53 deletions

View File

@ -153,6 +153,18 @@ void CHalfLife2::OnSourceModAllInitialized_Post()
void CHalfLife2::InitLogicalEntData() void CHalfLife2::InitLogicalEntData()
{ {
#if SOURCE_ENGINE == SE_TF2 \
|| SOURCE_ENGINE == SE_DODS \
|| SOURCE_ENGINE == SE_HL2DM \
|| SOURCE_ENGINE == SE_CSS \
|| SOURCE_ENGINE == SE_SDK2013
if (g_SMAPI->GetServerFactory(false)("VSERVERTOOLS003", nullptr))
{
g_EntList = servertools->GetEntityList();
}
#endif
char *addr = NULL; char *addr = NULL;
/* /*
@ -162,6 +174,8 @@ void CHalfLife2::InitLogicalEntData()
* If symbols aren't present (Windows or stripped Linux/Mac), * If symbols aren't present (Windows or stripped Linux/Mac),
* attempt find via LevelShutdown + offset * attempt find via LevelShutdown + offset
*/ */
if (!g_EntList)
{
if (g_pGameConf->GetMemSig("gEntList", (void **) &addr)) if (g_pGameConf->GetMemSig("gEntList", (void **) &addr))
{ {
#if !defined PLATFORM_WINDOWS #if !defined PLATFORM_WINDOWS
@ -178,6 +192,7 @@ void CHalfLife2::InitLogicalEntData()
} }
#endif #endif
} }
}
if (!g_EntList) if (!g_EntList)
{ {

View File

@ -52,6 +52,7 @@ IPlayerInfoManager *playerinfo = NULL;
IBaseFileSystem *basefilesystem = NULL; IBaseFileSystem *basefilesystem = NULL;
IFileSystem *filesystem = NULL; IFileSystem *filesystem = NULL;
IEngineSound *enginesound = NULL; IEngineSound *enginesound = NULL;
IServerTools *servertools = NULL;
IServerPluginHelpers *serverpluginhelpers = NULL; IServerPluginHelpers *serverpluginhelpers = NULL;
IServerPluginCallbacks *vsp_interface = NULL; IServerPluginCallbacks *vsp_interface = NULL;
int vsp_version = 0; int vsp_version = 0;
@ -71,6 +72,7 @@ bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen
GET_V_IFACE_CURRENT(GetFileSystemFactory, basefilesystem, IBaseFileSystem, BASEFILESYSTEM_INTERFACE_VERSION); GET_V_IFACE_CURRENT(GetFileSystemFactory, basefilesystem, IBaseFileSystem, BASEFILESYSTEM_INTERFACE_VERSION);
GET_V_IFACE_CURRENT(GetFileSystemFactory, filesystem, IFileSystem, FILESYSTEM_INTERFACE_VERSION); GET_V_IFACE_CURRENT(GetFileSystemFactory, filesystem, IFileSystem, FILESYSTEM_INTERFACE_VERSION);
GET_V_IFACE_CURRENT(GetEngineFactory, enginesound, IEngineSound, IENGINESOUND_SERVER_INTERFACE_VERSION); GET_V_IFACE_CURRENT(GetEngineFactory, enginesound, IEngineSound, IENGINESOUND_SERVER_INTERFACE_VERSION);
GET_V_IFACE_CURRENT(GetServerFactory, servertools, IServerTools, VSERVERTOOLS_INTERFACE_VERSION);
#if SOURCE_ENGINE != SE_DOTA #if SOURCE_ENGINE != SE_DOTA
GET_V_IFACE_CURRENT(GetEngineFactory, serverpluginhelpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS); GET_V_IFACE_CURRENT(GetEngineFactory, serverpluginhelpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS);
#endif #endif

View File

@ -50,6 +50,7 @@
#include <random.h> #include <random.h>
#include <filesystem.h> #include <filesystem.h>
#include <IEngineSound.h> #include <IEngineSound.h>
#include <toolframework/itoolentity.h>
#ifndef METAMOD_PLAPI_VERSION #ifndef METAMOD_PLAPI_VERSION
#include <metamod_wrappers.h> #include <metamod_wrappers.h>
@ -103,6 +104,7 @@ extern IPlayerInfoManager *playerinfo;
extern IBaseFileSystem *basefilesystem; extern IBaseFileSystem *basefilesystem;
extern IFileSystem *filesystem; extern IFileSystem *filesystem;
extern IEngineSound *enginesound; extern IEngineSound *enginesound;
extern IServerTools *servertools;
extern IServerPluginHelpers *serverpluginhelpers; extern IServerPluginHelpers *serverpluginhelpers;
extern IServerPluginCallbacks *vsp_interface; extern IServerPluginCallbacks *vsp_interface;
extern int vsp_version; extern int vsp_version;

View File

@ -285,9 +285,19 @@ void TempEntityManager::Initialize()
int offset; int offset;
m_Loaded = false; m_Loaded = false;
#if SOURCE_ENGINE == SE_TF2 #if SOURCE_ENGINE == SE_TF2 \
|| SOURCE_ENGINE == SE_DODS \
|| SOURCE_ENGINE == SE_HL2DM \
|| SOURCE_ENGINE == SE_CSS \
|| SOURCE_ENGINE == SE_SDK2013
if (g_SMAPI->GetServerFactory(false)("VSERVERTOOLS003", nullptr))
{
m_ListHead = servertools->GetTempEntList(); m_ListHead = servertools->GetTempEntList();
#else }
else
#endif
{
/* /*
* First try to lookup s_pTempEntities directly for platforms with symbols. * First try to lookup s_pTempEntities directly for platforms with symbols.
* If symbols aren't present (Windows or stripped Linux/Mac), * If symbols aren't present (Windows or stripped Linux/Mac),
@ -314,7 +324,7 @@ void TempEntityManager::Initialize()
{ {
return; return;
} }
#endif // == TF2 }
if (!g_pGameConf->GetOffset("GetTEName", &m_NameOffs)) if (!g_pGameConf->GetOffset("GetTEName", &m_NameOffs))
{ {

View File

@ -130,9 +130,19 @@ bool UTIL_VerifySignature(const void *addr, const char *sig, size_t len)
void GetIServer() void GetIServer()
{ {
#if SOURCE_ENGINE == SE_TF2 #if SOURCE_ENGINE == SE_TF2 \
|| SOURCE_ENGINE == SE_DODS \
|| SOURCE_ENGINE == SE_HL2DM \
|| SOURCE_ENGINE == SE_CSS \
|| SOURCE_ENGINE == SE_SDK2013
if (g_SMAPI->GetEngineFactory(false)("VEngineServer022", nullptr))
{
iserver = engine->GetIServer(); iserver = engine->GetIServer();
#else return;
}
#endif
void *addr; void *addr;
const char *sigstr; const char *sigstr;
char sig[32]; char sig[32];
@ -191,7 +201,6 @@ void GetIServer()
/* Finally we have the interface we were looking for */ /* Finally we have the interface we were looking for */
iserver = *reinterpret_cast<IServer **>(reinterpret_cast<unsigned char *>(vfunc) + offset); iserver = *reinterpret_cast<IServer **>(reinterpret_cast<unsigned char *>(vfunc) + offset);
#endif // !TF2
} }
void GetResourceEntity() void GetResourceEntity()

View File

@ -714,7 +714,7 @@ static cell_t GetClientEyeAngles(IPluginContext *pContext, const cell_t *params)
return got_angles ? 1 : 0; return got_angles ? 1 : 0;
} }
#if SOURCE_ENGINE >= SE_ORANGEBOX && SOURCE_ENGINE != SE_TF2 #if SOURCE_ENGINE >= SE_ORANGEBOX
static cell_t NativeFindEntityByClassname(IPluginContext *pContext, const cell_t *params) static cell_t NativeFindEntityByClassname(IPluginContext *pContext, const cell_t *params)
{ {
char *searchname; char *searchname;
@ -793,7 +793,15 @@ static cell_t NativeFindEntityByClassname(IPluginContext *pContext, const cell_t
static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *params) static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *params)
{ {
#if SOURCE_ENGINE == SE_TF2 #if SOURCE_ENGINE == SE_TF2 \
|| SOURCE_ENGINE == SE_DODS \
|| SOURCE_ENGINE == SE_HL2DM \
|| SOURCE_ENGINE == SE_CSS \
|| SOURCE_ENGINE == SE_SDK2013
static bool bHasServerTools3 = !!g_SMAPI->GetServerFactory(false)("VSERVERTOOLS003", nullptr);
if (bHasServerTools3)
{
CBaseEntity *pStartEnt = NULL; CBaseEntity *pStartEnt = NULL;
if (params[1] != -1) if (params[1] != -1)
{ {
@ -811,7 +819,9 @@ static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *para
CBaseEntity *pEntity = servertools->FindEntityByClassname(pStartEnt, searchname); CBaseEntity *pEntity = servertools->FindEntityByClassname(pStartEnt, searchname);
return gamehelpers->EntityToBCompatRef(pEntity); return gamehelpers->EntityToBCompatRef(pEntity);
#else }
#endif
static ValveCall *pCall = NULL; static ValveCall *pCall = NULL;
static bool bProbablyNoFEBC = false; static bool bProbablyNoFEBC = false;
@ -869,7 +879,6 @@ static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *para
FINISH_CALL_SIMPLE(&pEntity); FINISH_CALL_SIMPLE(&pEntity);
return gamehelpers->EntityToBCompatRef(pEntity); return gamehelpers->EntityToBCompatRef(pEntity);
#endif // == TF2
} }
#if SOURCE_ENGINE >= SE_ORANGEBOX #if SOURCE_ENGINE >= SE_ORANGEBOX