From 3d47010cbde09b450589ab285299cb2041e0fc74 Mon Sep 17 00:00:00 2001 From: Asher Baker Date: Mon, 15 Aug 2011 20:19:07 +0100 Subject: [PATCH] Fail to load a metamod-enabled extension if it refuses to attach to MM:S (bug 5042, r=dvander). --- core/ExtensionSys.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/core/ExtensionSys.cpp b/core/ExtensionSys.cpp index 9cecd5d8..12ba24d1 100644 --- a/core/ExtensionSys.cpp +++ b/core/ExtensionSys.cpp @@ -182,6 +182,28 @@ bool CLocalExtension::Load(char *error, size_t maxlength) { bool already; m_PlId = g_pMMPlugins->Load(m_Path.c_str(), g_PLID, already, error, maxlength); + + // Check the plugin didn't refuse load + Pl_Status status; + +#ifndef METAMOD_PLAPI_VERSION + const char *file; + PluginId source; +#endif + + if (!m_PlId || ( +#ifndef METAMOD_PLAPI_VERSION + g_pMMPlugins->Query(m_PlId, file, status, source) +#else + g_pMMPlugins->Query(m_PlId, NULL, &status, NULL) +#endif + && status < Pl_Paused)) + { + m_pLib->CloseLibrary(); + m_pLib = NULL; + m_pAPI = NULL; + return false; + } } if (!CExtension::Load(error, maxlength))