From 6cb67a19e7a7747b268beb98974a17eda57bec08 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 31 Mar 2013 22:03:57 -0700 Subject: [PATCH] Checkin missing chunks from bug 5680 (ref bug 5691). --- core/logic/ExtensionSys.cpp | 44 +++++++------------------------------ core/logic/ExtensionSys.h | 3 ++- core/logic/intercom.h | 3 ++- core/logic_bridge.cpp | 33 ++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 38 deletions(-) diff --git a/core/logic/ExtensionSys.cpp b/core/logic/ExtensionSys.cpp index 32505fdf..9342b82e 100644 --- a/core/logic/ExtensionSys.cpp +++ b/core/logic/ExtensionSys.cpp @@ -58,38 +58,6 @@ CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filena m_pAPI = pAPI; } -#if defined METAMOD_PLAPI_VERSION -#if SOURCE_ENGINE == SE_LEFT4DEAD -#define GAMEFIX "2.l4d" -#elif SOURCE_ENGINE == SE_LEFT4DEAD2 -#define GAMEFIX "2.l4d2" -#elif SOURCE_ENGINE == SE_ALIENSWARM -#define GAMEFIX "2.swarm" -#elif SOURCE_ENGINE == SE_ORANGEBOX -#define GAMEFIX "2.ep2" -#elif SOURCE_ENGINE == SE_BLOODYGOODTIME -#define GAMEFIX "2.bgt" -#elif SOURCE_ENGINE == SE_EYE -#define GAMEFIX "2.eye" -#elif SOURCE_ENGINE == SE_CSS -#define GAMEFIX "2.css" -#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE -#define GAMEFIX "2.ep2v" -#elif SOURCE_ENGINE == SE_DARKMESSIAH -#define GAMEFIX "2.darkm" -#elif SOURCE_ENGINE == SE_PORTAL2 -#define GAMEFIX "2.portal2" -#elif SOURCE_ENGINE == SE_CSGO -#define GAMEFIX "2.csgo" -#elif SOURCE_ENGINE == SE_DOTA -#define GAMEFIX "2.dota" -#else -#define GAMEFIX "2.ep1" -#endif //(SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2) -#else //METAMOD_PLAPI_VERSION -#define GAMEFIX "1.ep1" -#endif //METAMOD_PLAPI_VERSION - CLocalExtension::CLocalExtension(const char *filename) { m_PlId = 0; @@ -107,8 +75,9 @@ CLocalExtension::CLocalExtension(const char *filename) g_pSM->BuildPath(Path_SM, path, PLATFORM_MAX_PATH, - "extensions/%s." GAMEFIX "." PLATFORM_LIB_EXT, - filename); + "extensions/%s.%s." PLATFORM_LIB_EXT, + filename, + smcore.gamesuffix); if (libsys->IsPathFile(path)) { @@ -119,8 +88,9 @@ CLocalExtension::CLocalExtension(const char *filename) g_pSM->BuildPath(Path_SM, path, PLATFORM_MAX_PATH, - "extensions/auto." GAMEFIX "/%s." PLATFORM_LIB_EXT, - filename); + "extensions/auto.%s/%s." PLATFORM_LIB_EXT, + filename, + smcore.gamesuffix); /* Try the "normal" version */ if (!libsys->IsPathFile(path)) @@ -509,11 +479,13 @@ void CExtensionManager::OnSourceModAllInitialized() { g_ExtType = g_ShareSys.CreateIdentType("EXTENSION"); pluginsys->AddPluginsListener(this); + rootmenu->AddRootConsoleCommand("exts", "Manage extensions", this); g_ShareSys.AddInterface(NULL, this); } void CExtensionManager::OnSourceModShutdown() { + rootmenu->RemoveRootConsoleCommand("exts", this); pluginsys->RemovePluginsListener(this); g_ShareSys.DestroyIdentType(g_ExtType); } diff --git a/core/logic/ExtensionSys.h b/core/logic/ExtensionSys.h index 832bf3a9..25a195ad 100644 --- a/core/logic/ExtensionSys.h +++ b/core/logic/ExtensionSys.h @@ -138,7 +138,8 @@ public: class CExtensionManager : public IExtensionSys, public SMGlobalClass, - public IPluginsListener + public IPluginsListener, + public IRootConsoleCommand { public: CExtensionManager(); diff --git a/core/logic/intercom.h b/core/logic/intercom.h index 84bfa5d5..b8fcd59c 100644 --- a/core/logic/intercom.h +++ b/core/logic/intercom.h @@ -49,7 +49,7 @@ using namespace SourceHook; * Add 1 to the RHS of this expression to bump the intercom file * This is to prevent mismatching core/logic binaries */ -#define SM_LOGIC_MAGIC (0x0F47C0DE - 20) +#define SM_LOGIC_MAGIC (0x0F47C0DE - 21) #if defined SM_LOGIC class IVEngineServer @@ -248,6 +248,7 @@ struct sm_core_t void (*DoGlobalPluginLoads)(); bool (*AreConfigsExecuted)(); void (*ExecuteConfigs)(IPluginContext *ctx); + const char *gamesuffix; /* Data */ ServerGlobals *serverGlobals; void * serverFactory; diff --git a/core/logic_bridge.cpp b/core/logic_bridge.cpp index 41401add..0a0eeca5 100644 --- a/core/logic_bridge.cpp +++ b/core/logic_bridge.cpp @@ -283,6 +283,38 @@ void do_global_plugin_loads() g_SourceMod.DoGlobalPluginLoads(); } +#if defined METAMOD_PLAPI_VERSION +#if SOURCE_ENGINE == SE_LEFT4DEAD +#define GAMEFIX "2.l4d" +#elif SOURCE_ENGINE == SE_LEFT4DEAD2 +#define GAMEFIX "2.l4d2" +#elif SOURCE_ENGINE == SE_ALIENSWARM +#define GAMEFIX "2.swarm" +#elif SOURCE_ENGINE == SE_ORANGEBOX +#define GAMEFIX "2.ep2" +#elif SOURCE_ENGINE == SE_BLOODYGOODTIME +#define GAMEFIX "2.bgt" +#elif SOURCE_ENGINE == SE_EYE +#define GAMEFIX "2.eye" +#elif SOURCE_ENGINE == SE_CSS +#define GAMEFIX "2.css" +#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE +#define GAMEFIX "2.ep2v" +#elif SOURCE_ENGINE == SE_DARKMESSIAH +#define GAMEFIX "2.darkm" +#elif SOURCE_ENGINE == SE_PORTAL2 +#define GAMEFIX "2.portal2" +#elif SOURCE_ENGINE == SE_CSGO +#define GAMEFIX "2.csgo" +#elif SOURCE_ENGINE == SE_DOTA +#define GAMEFIX "2.dota" +#else +#define GAMEFIX "2.ep1" +#endif //(SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2) +#else //METAMOD_PLAPI_VERSION +#define GAMEFIX "1.ep1" +#endif //METAMOD_PLAPI_VERSION + static ServerGlobals serverGlobals; static sm_core_t core_bridge = @@ -328,6 +360,7 @@ static sm_core_t core_bridge = do_global_plugin_loads, SM_AreConfigsExecuted, SM_ExecuteForPlugin, + GAMEFIX, &serverGlobals };