diff --git a/core/logic/GameConfigs.cpp b/core/logic/GameConfigs.cpp index fb6421c4..d9044ef2 100644 --- a/core/logic/GameConfigs.cpp +++ b/core/logic/GameConfigs.cpp @@ -515,6 +515,8 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states) addrInBase = smcore.serverFactory; } else if (strcmp(s_TempSig.library, "engine") == 0) { addrInBase = smcore.engineFactory; + } else if (strcmp(s_TempSig.library, "matchmaking_ds") == 0) { + addrInBase = smcore.matchmakingDSFactory; } void *final_addr = NULL; if (addrInBase == NULL) diff --git a/core/logic/intercom.h b/core/logic/intercom.h index 4af7e6de..4e007881 100644 --- a/core/logic/intercom.h +++ b/core/logic/intercom.h @@ -42,7 +42,7 @@ using namespace SourceMod; * 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 - 15) +#define SM_LOGIC_MAGIC (0x0F47C0DE - 16) #if defined SM_LOGIC class IVEngineServer @@ -119,6 +119,7 @@ struct sm_core_t ServerGlobals *serverGlobals; void * serverFactory; void * engineFactory; + void * matchmakingDSFactory; }; struct sm_logic_t diff --git a/core/logic_bridge.cpp b/core/logic_bridge.cpp index bb3021ba..be3664b9 100644 --- a/core/logic_bridge.cpp +++ b/core/logic_bridge.cpp @@ -50,6 +50,21 @@ #include "AdminCache.h" #include "HalfLife2.h" +#if defined _WIN32 + #define MATCHMAKINGDS_SUFFIX "" + #define MATCHMAKINGDS_EXT "dll" +#elif defined __APPLE__ + #define MATCHMAKINGDS_SUFFIX "" + #define MATCHMAKINGDS_EXT "dylib" +#elif defined __linux__ +#if SOURCE_ENGINE < SE_LEFT4DEAD2 + #define MATCHMAKINGDS_SUFFIX "_i486" +#else + #define MATCHMAKINGDS_SUFFIX "" +#endif + #define MATCHMAKINGDS_EXT "so" +#endif + static ILibrary *g_pLogic = NULL; static LogicInitFunction logic_init_fn; @@ -206,6 +221,18 @@ void InitLogicBridge() core_bridge.core_ident = g_pCoreIdent; core_bridge.engineFactory = (void *)g_SMAPI->GetEngineFactory(false); core_bridge.serverFactory = (void *)g_SMAPI->GetServerFactory(false); + + ILibrary *mmlib; + char path[PLATFORM_MAX_PATH]; + + g_LibSys.PathFormat(path, sizeof(path), "%s/bin/matchmaking_ds%s.%s", g_SMAPI->GetBaseDir(), MATCHMAKINGDS_SUFFIX, MATCHMAKINGDS_EXT); + + if (mmlib = g_LibSys.OpenLibrary(path, NULL, 0)) + { + core_bridge.matchmakingDSFactory = mmlib->GetSymbolAddress("CreateInterface"); + mmlib->CloseLibrary(); + } + logic_init_fn(&core_bridge, &logicore); /* Add SMGlobalClass instances */