From 2bd91dd93b7c81ad3951f4749dc673017cf62c64 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Fri, 11 Sep 2015 05:38:53 -0700 Subject: [PATCH 1/2] Fix always failing when falling back to engine v22. --- core/sourcemm_api.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/sourcemm_api.cpp b/core/sourcemm_api.cpp index ce1f4b43..1d9ac779 100644 --- a/core/sourcemm_api.cpp +++ b/core/sourcemm_api.cpp @@ -76,11 +76,14 @@ bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen if (!engine) { engine = (IVEngineServer *)ismm->VInterfaceMatch(ismm->GetEngineFactory(), "VEngineServer022"); - if (error && maxlen) + 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); From f6d7fd4949d5bf762b9322255146d2b38192da99 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Fri, 11 Sep 2015 05:40:03 -0700 Subject: [PATCH 2/2] Don't use VInterfaceMatch when wanting explicit iface version. --- core/sourcemm_api.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/sourcemm_api.cpp b/core/sourcemm_api.cpp index 1d9ac779..285b44b3 100644 --- a/core/sourcemm_api.cpp +++ b/core/sourcemm_api.cpp @@ -72,10 +72,10 @@ 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"); + engine = (IVEngineServer *)ismm->GetEngineFactory()("VEngineServer022", nullptr); if (!engine) { if (error && maxlen)