diff --git a/AMBuildScript b/AMBuildScript index 16f9ce8..cba9504 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -37,6 +37,11 @@ Source2 = { 'windows': ['x86', 'x86_64'], 'linux': ['x86_64'], } +Mock = { + 'windows': ['x86', 'x86_64'], + 'linux': ['x86', 'x86_64'], + 'mac': ['x86_64'] +} PossibleSDKs = { 'episode1': SDK('HL2SDK', '2.ep1', '1', 'EPISODEONE', WinLinux, 'episode1'), @@ -61,6 +66,7 @@ PossibleSDKs = { 'doi': SDK('HL2SDKDOI', '2.doi', '20', 'DOI', WinLinuxMac, 'doi'), 'contagion': SDK('HL2SDKCONTAGION', '2.contagion', '14', 'CONTAGION', WinOnly, 'contagion'), 'bms': SDK('HL2SDKBMS', '2.bms', '10', 'BMS', WinLinux, 'bms'), + 'mock': SDK('HL2SDK-MOCK', '2.mock', '999', 'MOCK', Mock, 'mock'), } def ResolveEnvPath(env, folder): @@ -434,10 +440,13 @@ class MMSConfig(object): lib_folder = os.path.join(sdk.path, 'lib', 'mac') if compiler.target.platform in ['linux', 'mac']: - if sdk.name in ['sdk2013', 'bms'] or compiler.target.arch == 'x86_64': - compiler.postlink += [os.path.join(lib_folder, 'tier1.a')] + if sdk.name in ['sdk2013', 'bms', 'mock'] or compiler.target.arch == 'x86_64': + tier1 = os.path.join(lib_folder, 'tier1.a') else: - compiler.postlink += [os.path.join(lib_folder, 'tier1_i486.a')] + tier1 = os.path.join(lib_folder, 'tier1_i486.a') + if sdk.name == 'mock' and compiler.target.platform == 'linux': + compiler.linkflags += ['-Wl,-z,origin'] + compiler.postlink += [tier1] if sdk.name in ['blade', 'insurgency', 'doi', 'csgo', 'dota']: if compiler.target.arch == 'x86_64': @@ -456,7 +465,7 @@ class MMSConfig(object): compiler.linkflags[0:0] = ['-lm'] if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'bms', 'nucleardawn', 'l4d2', 'insurgency', 'doi']: dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so'] - elif compiler.target.arch == 'x86_64' and sdk.name in ['csgo', 'blade']: + elif compiler.target.arch == 'x86_64' and sdk.name in ['csgo', 'blade', 'mock']: dynamic_libs = ['libtier0_client.so', 'libvstdlib_client.so'] elif sdk.name in ['l4d', 'blade', 'insurgency', 'doi', 'csgo', 'dota']: dynamic_libs = ['libtier0.so', 'libvstdlib.so'] diff --git a/core/ISmmPluginExt.h b/core/ISmmPluginExt.h index 9cb4b8c..bc27e98 100644 --- a/core/ISmmPluginExt.h +++ b/core/ISmmPluginExt.h @@ -60,6 +60,7 @@ #define SOURCE_ENGINE_CONTAGION 22 /**< Contagion */ #define SOURCE_ENGINE_BMS 23 /**< Black Mesa Multiplayer */ #define SOURCE_ENGINE_DOI 24 /**< Day of Infamy */ +#define SOURCE_ENGINE_MOCK 999 /**< Mock source engine */ #define METAMOD_PLAPI_VERSION 16 /**< Version of this header file */ #define METAMOD_PLAPI_NAME "ISmmPlugin" /**< Name of the plugin interface */ diff --git a/core/provider/provider_ep2.cpp b/core/provider/provider_ep2.cpp index ec67f3e..b2a3684 100644 --- a/core/provider/provider_ep2.cpp +++ b/core/provider/provider_ep2.cpp @@ -540,6 +540,8 @@ int BaseProvider::DetermineSourceEngine() return SOURCE_ENGINE_BMS; #elif SOURCE_ENGINE == SE_EPISODEONE return g_bOriginalEngine ? SOURCE_ENGINE_ORIGINAL : SOURCE_ENGINE_EPISODEONE; +#elif SOURCE_ENGINE == SE_MOCK + return SOURCE_ENGINE_MOCK; #else #error "SOURCE_ENGINE not defined to a known value" #endif @@ -671,6 +673,8 @@ const char *BaseProvider::GetEngineDescription() const { return "Episode 1 (2004)"; } +#elif SOURCE_ENGINE == SE_MOCK + return "Mock"; #else #error "SOURCE_ENGINE not defined to a known value" #endif diff --git a/loader/loader.cpp b/loader/loader.cpp index 9f277da..4918709 100644 --- a/loader/loader.cpp +++ b/loader/loader.cpp @@ -91,6 +91,7 @@ static const char *backend_names[] = "2.contagion", "2.bms", "2.doi", + "2.mock", }; #if defined _WIN32 @@ -425,6 +426,10 @@ mm_DetermineBackend(QueryValveInterface engineFactory, QueryValveInterface serve { return MMBackend_HL2DM; } + else if (strcmp(game_name, ".") == 0 && engineFactory("MOCK_ENGINE", NULL)) + { + return MMBackend_Mock; + } else { return MMBackend_SDK2013; diff --git a/loader/loader.h b/loader/loader.h index ca2e01d..5e7b99e 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -104,6 +104,7 @@ enum MetamodBackend MMBackend_BMS, MMBackend_DOI, + MMBackend_Mock, MMBackend_UNKNOWN }; diff --git a/loader/serverplugin.cpp b/loader/serverplugin.cpp index 9daff26..4d5cba2 100644 --- a/loader/serverplugin.cpp +++ b/loader/serverplugin.cpp @@ -91,6 +91,8 @@ public: mm_GetGameName(game_name, sizeof(game_name)); mm_backend = mm_DetermineBackend(engineFactory, gsFactory, game_name); + if (mm_backend == MMBackend_Mock) + strcpy(game_name, "mock"); } if (mm_backend == MMBackend_UNKNOWN)