Update metamod-attached extensions to use same engine ptr lookup as core.

(On TF2-branch games, always search for engine v23 first, falling back to v22.)
This commit is contained in:
Nicholas Hastings 2015-09-13 17:18:33 -04:00
parent 5b3b17799f
commit 8f8c00c66d

View File

@ -340,8 +340,25 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen,
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
#else
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->GetEngineFactory()("VEngineServer023", nullptr);
if (!engine)
{
engine = (IVEngineServer *) ismm->GetEngineFactory()("VEngineServer022", nullptr);
if (!engine)
{
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);
#endif
#endif // TF2 / CSS / DODS / HL2DM / SDK2013
#endif // !METAMOD_PLAPI_VERSION
#endif //META_NO_HL2SDK
m_SourceMMLoaded = true;