diff --git a/core/ISmmPluginExt.h b/core/ISmmPluginExt.h index 9e33610..5a5e282 100644 --- a/core/ISmmPluginExt.h +++ b/core/ISmmPluginExt.h @@ -41,9 +41,10 @@ #define SOURCE_ENGINE_ORANGEBOX 3 /**< Orange Box Source Engine (third major SDK) */ #define SOURCE_ENGINE_LEFT4DEAD 4 /**< Left 4 Dead */ #define SOURCE_ENGINE_DARKMESSIAH 5 /**< Dark Messiah Multiplayer (based on original engine) */ +#define SOURCE_ENGINE_ORANGEBOXVALVE 6 /**< Orange Box Source Engine for Valve games (TF2/DOD:S) */ #define SOURCE_ENGINE_LEFT4DEAD2 7 /**< Left 4 Dead 2 */ -#define METAMOD_PLAPI_VERSION 14 /**< Version of this header file */ +#define METAMOD_PLAPI_VERSION 15 /**< Version of this header file */ #define METAMOD_PLAPI_NAME "ISmmPlugin" /**< Name of the plugin interface */ namespace SourceMM @@ -110,6 +111,7 @@ struct MetamodVersionInfo int pl_min; /**< Plugin API minimum version */ int pl_max; /**< Plugin API maximum version */ int source_engine; /**< Source Engine version (SOURCE_* constants) */ + const char *game_dir; /**< Game directory name */ }; /** diff --git a/core/Makefile b/core/Makefile index cf1c6da..fd24714 100644 --- a/core/Makefile +++ b/core/Makefile @@ -3,6 +3,7 @@ SRCDS_BASE = ~/srcds HL2SDK_OB = ../../hl2sdk-ob +HL2SDK_OB_VALVE = ../../hl2sdk-ob-valve HL2SDK_L4D = ../../hl2sdk-l4d HL2SDK_L4D2 = ../../hl2sdk-l4d2 @@ -44,6 +45,16 @@ ifeq "$(ENGINE)" "orangebox" BINARY = metamod.2.ep2.so override ENGSET = true endif +ifeq "$(ENGINE)" "orangeboxvalve" + HL2SDK = $(HL2SDK_OB_VALVE) + HL2PUB = $(HL2SDK)/public + HL2LIB = $(HL2SDK)/lib/linux + CFLAGS += -DSOURCE_ENGINE=4 + INCLUDE += -I$(HL2SDK)/public/game/server + SRCDS = $(SRCDS_BASE)/orangebox + BINARY = metamod.2.ep2v.so + override ENGSET = true +endif ifeq "$(ENGINE)" "left4dead" HL2SDK = $(HL2SDK_L4D) HL2PUB = $(HL2SDK)/public @@ -65,7 +76,7 @@ ifeq "$(ENGINE)" "left4dead2" override ENGSET = true endif -CFLAGS += -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=5 -DSE_LEFT4DEAD2=6 +CFLAGS += -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 -DSE_LEFT4DEAD=5 -DSE_LEFT4DEAD2=6 ifeq "$(ENGINE)" "left4dead2" LINK += $(HL2LIB)/tier1_i486.a vstdlib_linux.so tier0_linux.so -static-libgcc @@ -123,7 +134,8 @@ all: check check: if [ "$(ENGSET)" = "false" ]; then \ - echo "You must supply one of the following values for ENGINE: left4dead2, left4dead or orangebox"; \ + echo "You must supply one of the following values for ENGINE:"; \ + echo "left4dead2, left4dead, orangeboxvalve or orangebox"; \ exit 1; \ fi diff --git a/core/metamod_console.cpp b/core/metamod_console.cpp index c0e2467..1a98f4d 100644 --- a/core/metamod_console.cpp +++ b/core/metamod_console.cpp @@ -117,6 +117,8 @@ bool Command_Meta(IMetamodSourceCommandInfo *info) CONMSG(" Engine: Left 4 Dead (2008)\n"); #elif SOURCE_ENGINE == SE_ORANGEBOX CONMSG(" Engine: Episode 2 (Orange Box, 2007)\n"); +#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE + CONMSG(" Engine: Episode 2 (Valve Orange Box, 2009)\n"); #elif SOURCE_ENGINE == SE_DARKMESSIAH CONMSG(" Engine: Dark Messiah (2006)\n"); #else diff --git a/core/metamod_plugins.cpp b/core/metamod_plugins.cpp index 8a23b71..1dbd9c7 100644 --- a/core/metamod_plugins.cpp +++ b/core/metamod_plugins.cpp @@ -1,8 +1,8 @@ /** - * vim: set ts=4 : + * vim: set ts=4 sw=4 tw=99 noet : * ====================================================== * Metamod:Source - * Copyright (C) 2004-2008 AlliedModders LLC and authors. + * Copyright (C) 2004-2009 AlliedModders LLC and authors. * All rights reserved. * ====================================================== * @@ -21,8 +21,6 @@ * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. - * - * Version: $Id$ */ #include @@ -62,7 +60,8 @@ MetamodVersionInfo GlobVersionInfo = SH_IMPL_VERSION, PLAPI_MIN_VERSION, METAMOD_PLAPI_VERSION, - SOURCE_ENGINE_UNKNOWN + SOURCE_ENGINE_UNKNOWN, + NULL }; CPluginManager::CPluginManager() @@ -437,6 +436,11 @@ CPluginManager::CPlugin *CPluginManager::_Load(const char *file, PluginId source { GlobVersionInfo.source_engine = g_Metamod.GetSourceEngineBuild(); } + if (GlobVersionInfo.game_dir == NULL) + { + GlobVersionInfo.game_dir = strrchr(g_Metamod.GetBaseDir(), PATH_SEP_CHAR) + 1; + Msg("OH MY GIDDY AUNT: %s\n", GlobVersionInfo.game_dir); + } /* Build path information */ char file_path[256]; @@ -456,6 +460,14 @@ CPluginManager::CPlugin *CPluginManager::_Load(const char *file, PluginId source info.pl_path = file_path; pl->m_API = fnLoad(&GlobVersionInfo, &info); +#if SOURCE_ENGINE == SE_ORANGEBOXVALVE + /* For plugin compat - try loading again using original OB if OB-Valve has failed */ + if (pl->m_API == NULL) + { + GlobVersionInfo.source_engine = SOURCE_ENGINE_ORANGEBOX; + pl->m_API = fnLoad(&GlobVersionInfo, &info); + } +#endif pl->m_UnloadFn = (METAMOD_FN_UNLOAD)dlsym(pl->m_Lib, "UnloadInterface_MMS"); } diff --git a/core/msvc9/mm_core.sln b/core/msvc9/mm_core.sln index dad693d..3e82838 100644 --- a/core/msvc9/mm_core.sln +++ b/core/msvc9/mm_core.sln @@ -9,10 +9,12 @@ Global Debug - Left 4 Dead 2|Win32 = Debug - Left 4 Dead 2|Win32 Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32 Debug - Orange Box|Win32 = Debug - Orange Box|Win32 + Debug - Orange Box Valve|Win32 = Debug - Orange Box Valve|Win32 Release - Dark Messiah|Win32 = Release - Dark Messiah|Win32 Release - Left 4 Dead 2|Win32 = Release - Left 4 Dead 2|Win32 Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32 Release - Orange Box|Win32 = Release - Orange Box|Win32 + Release - Orange Box Valve|Win32 = Release - Orange Box Valve|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Debug - Dark Messiah|Win32.ActiveCfg = Debug - Dark Messiah|Win32 @@ -23,6 +25,8 @@ Global {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Debug - Left 4 Dead|Win32.Build.0 = Debug - Left 4 Dead|Win32 {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Debug - Orange Box|Win32.ActiveCfg = Debug - Orange Box|Win32 {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Debug - Orange Box|Win32.Build.0 = Debug - Orange Box|Win32 + {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Debug - Orange Box Valve|Win32.ActiveCfg = Debug - Orange Box Valve|Win32 + {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Debug - Orange Box Valve|Win32.Build.0 = Debug - Orange Box Valve|Win32 {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Release - Dark Messiah|Win32.ActiveCfg = Release - Dark Messiah|Win32 {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Release - Dark Messiah|Win32.Build.0 = Release - Dark Messiah|Win32 {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Release - Left 4 Dead 2|Win32.ActiveCfg = Release - Left 4 Dead 2|Win32 @@ -31,6 +35,8 @@ Global {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Release - Left 4 Dead|Win32.Build.0 = Release - Left 4 Dead|Win32 {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Release - Orange Box|Win32.ActiveCfg = Release - Orange Box|Win32 {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Release - Orange Box|Win32.Build.0 = Release - Orange Box|Win32 + {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Release - Orange Box Valve|Win32.ActiveCfg = Release - Orange Box Valve|Win32 + {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Release - Orange Box Valve|Win32.Build.0 = Release - Orange Box Valve|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/core/msvc9/mm_core.vcproj b/core/msvc9/mm_core.vcproj index 66f842d..e707999 100644 --- a/core/msvc9/mm_core.vcproj +++ b/core/msvc9/mm_core.vcproj @@ -40,7 +40,7 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +