Merge pull request #398 from alliedmodders/shim-noshim

Shim for TF2-branch games to find latest, non-shimmed engine iface.
This commit is contained in:
Nicholas Hastings 2015-09-10 22:47:13 -04:00
commit 3c264d78bb

View File

@ -70,7 +70,21 @@ bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen
PLUGIN_SAVEVARS(); PLUGIN_SAVEVARS();
GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL); GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
#if SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_SDK2013
// Shim to avoid hooking shims
engine = (IVEngineServer *)ismm->VInterfaceMatch(ismm->GetEngineFactory(), "VEngineServer023");
if (!engine)
{
engine = (IVEngineServer *)ismm->VInterfaceMatch(ismm->GetEngineFactory(), "VEngineServer022");
if (error && maxlen)
{
ismm->Format(error, maxlen, "Could not find interface: VEngineServer023 or VEngineServer022");
}
return false;
}
#else
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER); GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
#endif
GET_V_IFACE_CURRENT(GetServerFactory, serverClients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS); GET_V_IFACE_CURRENT(GetServerFactory, serverClients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS);
GET_V_IFACE_CURRENT(GetEngineFactory, icvar, ICvar, CVAR_INTERFACE_VERSION); GET_V_IFACE_CURRENT(GetEngineFactory, icvar, ICvar, CVAR_INTERFACE_VERSION);
GET_V_IFACE_CURRENT(GetEngineFactory, gameevents, IGameEventManager2, INTERFACEVERSION_GAMEEVENTSMANAGER2); GET_V_IFACE_CURRENT(GetEngineFactory, gameevents, IGameEventManager2, INTERFACEVERSION_GAMEEVENTSMANAGER2);