Merge pull request #402 from alliedmodders/shim-noshim

Shim for TF2-branch games to find latest, non-shimmed engine iface. 2
This commit is contained in:
Nicholas Hastings 2015-09-11 09:24:24 -04:00
commit f1a907c298

View File

@ -72,15 +72,18 @@ bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen
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");
engine = (IVEngineServer *)ismm->GetEngineFactory()("VEngineServer023", nullptr);
if (!engine)
{
engine = (IVEngineServer *)ismm->VInterfaceMatch(ismm->GetEngineFactory(), "VEngineServer022");
if (error && maxlen)
engine = (IVEngineServer *)ismm->GetEngineFactory()("VEngineServer022", nullptr);
if (!engine)
{
ismm->Format(error, maxlen, "Could not find interface: VEngineServer023 or VEngineServer022");
if (error && maxlen)
{
ismm->Format(error, maxlen, "Could not find interface: VEngineServer023 or VEngineServer022");
}
return false;
}
return false;
}
#else
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);