diff --git a/core/ISmmPluginExt.h b/core/ISmmPluginExt.h index 1ae01b1..9e33610 100644 --- a/core/ISmmPluginExt.h +++ b/core/ISmmPluginExt.h @@ -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$ */ #ifndef _INCLUDE_METAMOD_SOURCE_PLUGIN_EXT_H_ @@ -43,6 +41,7 @@ #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_LEFT4DEAD2 7 /**< Left 4 Dead 2 */ #define METAMOD_PLAPI_VERSION 14 /**< Version of this header file */ #define METAMOD_PLAPI_NAME "ISmmPlugin" /**< Name of the plugin interface */ diff --git a/core/Makefile b/core/Makefile index c6fbe61..0278ef3 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1,9 +1,10 @@ -# (C)2004-2008 SourceMod Development Team +# (C)2004-2009 SourceMod Development Team # Makefile written by David "BAILOPAN" Anderson SRCDS_BASE = ~/srcds HL2SDK_OB = ../../hl2sdk-ob HL2SDK_L4D = ../../hl2sdk-l4d +HL2SDK_L4D2 = ../../hl2sdk-l4d2 ##################################### ### EDIT BELOW FOR OTHER PROJECTS ### @@ -35,28 +36,42 @@ CPP = gcc-4.1 override ENGSET = false ifeq "$(ENGINE)" "orangebox" HL2SDK = $(HL2SDK_OB) - HL2PUB = $(HL2SDK_OB)/public - HL2LIB = $(HL2SDK_OB)/lib/linux + HL2PUB = $(HL2SDK)/public + HL2LIB = $(HL2SDK)/lib/linux CFLAGS += -DSOURCE_ENGINE=3 - INCLUDE += -I$(HL2SDK_OB)/public/game/server + INCLUDE += -I$(HL2SDK)/public/game/server SRCDS = $(SRCDS_BASE)/orangebox BINARY = metamod.2.ep2.so override ENGSET = true endif ifeq "$(ENGINE)" "left4dead" HL2SDK = $(HL2SDK_L4D) - HL2PUB = $(HL2SDK_L4D)/public - HL2LIB = $(HL2SDK_L4D)/lib/linux - CFLAGS += -DSOURCE_ENGINE=4 - INCLUDE += -I$(HL2SDK_L4D)/public/game/server + HL2PUB = $(HL2SDK)/public + HL2LIB = $(HL2SDK)/lib/linux + CFLAGS += -DSOURCE_ENGINE=5 + INCLUDE += -I$(HL2SDK)/public/game/server SRCDS = $(SRCDS_BASE)/l4d BINARY = metamod.2.l4d.so override ENGSET = true endif +ifeq "$(ENGINE)" "left4dead2" + HL2SDK = $(HL2SDK_L4D2) + HL2PUB = $(HL2SDK)/public + HL2LIB = $(HL2SDK)/lib/linux + CFLAGS += -DSOURCE_ENGINE=6 + INCLUDE += -I$(HL2SDK)/public/game/server + SRCDS = $(SRCDS_BASE)/left4dead2_demo + BINARY = metamod.2.l4d2.so + override ENGSET = true +endif -CFLAGS += -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4 +CFLAGS += -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=5 -DSE_LEFT4DEAD2=6 -LINK += $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so -static-libgcc +ifeq "$(ENGINE)" "left4dead2" + LINK += $(HL2LIB)/tier1_i486.a vstdlib_linux.so tier0_linux.so -static-libgcc +else + LINK += $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so -static-libgcc +endif INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \ -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I. -Isourcehook -I../loader @@ -97,13 +112,18 @@ all: check mkdir -p $(BIN_DIR) mkdir -p $(BIN_DIR)/provider mkdir -p $(BIN_DIR)/sourcehook - ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so - ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so + if [ "$(ENGINE)" = "left4dead2" ]; then \ + ln -sf $(SRCDS)/bin/vstdlib_linux.so vstdlib_linux.so; \ + ln -sf $(SRCDS)/bin/tier0_linux.so tier0_linux.so; \ + else \ + ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so; \ + ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so; \ + fi $(MAKE) -f Makefile metamod check: if [ "$(ENGSET)" = "false" ]; then \ - echo "You must supply ENGINE=left4dead or ENGINE=orangebox"; \ + echo "You must supply one of the following values for ENGINE: left4dead2, left4dead or orangebox"; \ exit 1; \ fi diff --git a/core/metamod_console.cpp b/core/metamod_console.cpp index dc13144..c0e2467 100644 --- a/core/metamod_console.cpp +++ b/core/metamod_console.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 @@ -113,12 +111,16 @@ bool Command_Meta(IMetamodSourceCommandInfo *info) } #endif -#if SOURCE_ENGINE == SE_LEFT4DEAD +#if SOURCE_ENGINE == SE_LEFT4DEAD2 + CONMSG(" Engine: Left 4 Dead 2 (2009)\n"); +#elif SOURCE_ENGINE == SE_LEFT4DEAD CONMSG(" Engine: Left 4 Dead (2008)\n"); #elif SOURCE_ENGINE == SE_ORANGEBOX CONMSG(" Engine: Episode 2 (Orange Box, 2007)\n"); -#else +#elif SOURCE_ENGINE == SE_DARKMESSIAH CONMSG(" Engine: Dark Messiah (2006)\n"); +#else +#error "SOURCE_ENGINE not defined to a known value" #endif // Display user messages diff --git a/core/msvc9/mm_core.sln b/core/msvc9/mm_core.sln index aeab1d3..dad693d 100644 --- a/core/msvc9/mm_core.sln +++ b/core/msvc9/mm_core.sln @@ -6,21 +6,27 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug - Dark Messiah|Win32 = Debug - Dark Messiah|Win32 + 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 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 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Debug - Dark Messiah|Win32.ActiveCfg = Debug - Dark Messiah|Win32 {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Debug - Dark Messiah|Win32.Build.0 = Debug - Dark Messiah|Win32 + {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Debug - Left 4 Dead 2|Win32.ActiveCfg = Debug - Left 4 Dead 2|Win32 + {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Debug - Left 4 Dead 2|Win32.Build.0 = Debug - Left 4 Dead 2|Win32 {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Debug - Left 4 Dead|Win32.ActiveCfg = Debug - Left 4 Dead|Win32 {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}.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 + {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Release - Left 4 Dead 2|Win32.Build.0 = Release - Left 4 Dead 2|Win32 {F7D47743-73B3-49B5-9D76-2333C5DFD565}.Release - Left 4 Dead|Win32.ActiveCfg = Release - Left 4 Dead|Win32 {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 diff --git a/core/msvc9/mm_core.vcproj b/core/msvc9/mm_core.vcproj index a21611a..66f842d 100644 --- a/core/msvc9/mm_core.vcproj +++ b/core/msvc9/mm_core.vcproj @@ -40,7 +40,7 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -385,12 +383,16 @@ const char *BaseProvider::GetGameDescription() int BaseProvider::DetermineSourceEngine(const char *game) { -#if SOURCE_ENGINE == SE_LEFT4DEAD +#if SOURCE_ENGINE == SE_LEFT4DEAD2 + return SOURCE_ENGINE_LEFT4DEAD2; +#elif SOURCE_ENGINE == SE_LEFT4DEAD return SOURCE_ENGINE_LEFT4DEAD; #elif SOURCE_ENGINE == SE_ORANGEBOX return SOURCE_ENGINE_ORANGEBOX; -#else +#elif SOURCE_ENGINE == SE_DARKMESSIAH return SOURCE_ENGINE_DARKMESSIAH; +#else +#error "SOURCE_ENGINE not defined to a known value" #endif } diff --git a/loader/Makefile b/loader/Makefile index f3ee494..ac2297a 100644 --- a/loader/Makefile +++ b/loader/Makefile @@ -1,12 +1,10 @@ -# (C)2004-2008 SourceMod Development Team +# (C)2004-2009 SourceMod Development Team # Makefile written by David "BAILOPAN" Anderson ##################################### ### EDIT BELOW FOR OTHER PROJECTS ### ##################################### -BINARY = server_i486.so - OBJECTS = loader.cpp \ utility.cpp \ serverplugin.cpp \ @@ -22,6 +20,14 @@ C_GCC4_FLAGS = -fvisibility=hidden CPP_GCC4_FLAGS = -fvisibility-inlines-hidden CPP = gcc-4.1 +ifeq "$(ENGINE)" "left4dead2" + BINARY = server_linux.so + CFLAGS += -DBINARY_SUFFIX=\"_linux.so\" +else + BINARY = server_i486.so + CFLAGS += -DBINARY_SUFFIX=\"_i486.so\" +endif + LINK += -static-libgcc INCLUDE += -I. -I../core/sourcehook @@ -36,10 +42,18 @@ CPPFLAGS += -Wno-non-virtual-dtor -fno-exceptions -fno-rtti ################################################ ifeq "$(DEBUG)" "true" - BIN_DIR = Debug + ifeq "$(ENGINE)" "" + BIN_DIR = Debug + else + BIN_DIR = Debug.$(ENGINE) + endif CFLAGS += $(C_DEBUG_FLAGS) else - BIN_DIR = Release + ifeq "$(ENGINE)" "" + BIN_DIR = Release + else + BIN_DIR = Release.$(ENGINE) + endif CFLAGS += $(C_OPT_FLAGS) endif diff --git a/loader/loader.cpp b/loader/loader.cpp index 4442a5e..32827e8 100644 --- a/loader/loader.cpp +++ b/loader/loader.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 @@ -72,16 +70,17 @@ mm_LogFatal(const char *message, ...) static const char *backend_names[] = { "1.ep1", + "2.darkm", "2.ep2", "2.l4d", - "2.darkm" + "2.l4d2" }; #if defined _WIN32 #define LIBRARY_EXT ".dll" #define LIBRARY_MINEXT ".dll" #elif defined __linux__ -#define LIBRARY_EXT "_i486.so" +#define LIBRARY_EXT BINARY_SUFFIX #define LIBRARY_MINEXT ".so" #endif @@ -173,8 +172,8 @@ mm_GetProcAddress(const char *name) #define TIER0_NAME "bin\\tier0.dll" #define VSTDLIB_NAME "bin\\vstdlib.dll" #elif defined __linux__ -#define TIER0_NAME "bin/tier0_i486.so" -#define VSTDLIB_NAME "bin/vstdlib_i486.so" +#define TIER0_NAME "bin/tier0" BINARY_SUFFIX +#define VSTDLIB_NAME "bin/vstdlib" BINARY_SUFFIX #endif const char * @@ -244,6 +243,10 @@ mm_DetermineBackend(QueryValveInterface engineFactory, const char *game_name) if (engineFactory("VEngineServer022", NULL) != NULL && engineFactory("VEngineCvar007", NULL) != NULL) { + if (engineFactory("VPrecacheSystem001", NULL) != NULL) + { + return MMBackend_Left4Dead2; + } return MMBackend_Left4Dead; } else if (engineFactory("VEngineServer021", NULL) != NULL) diff --git a/loader/loader.h b/loader/loader.h index e8c47e1..556137a 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -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$ */ #ifndef _INCLUDE_METAMOD_SOURCE_LOADER_H_ @@ -62,9 +60,10 @@ typedef void * HMODULE; enum MetamodBackend { MMBackend_Episode1 = 0, + MMBackend_DarkMessiah, MMBackend_Episode2, MMBackend_Left4Dead, - MMBackend_DarkMessiah, + MMBackend_Left4Dead2, MMBackend_UNKNOWN }; diff --git a/loader/serverplugin.cpp b/loader/serverplugin.cpp index 6bcef2b..f889c08 100644 --- a/loader/serverplugin.cpp +++ b/loader/serverplugin.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 @@ -104,7 +102,7 @@ public: mm_LogFatal("Could not detect engine version"); return false; } - else if (backend == MMBackend_Episode2 || backend == MMBackend_Left4Dead) + else if (backend >= MMBackend_Episode2) { /* We need to insert the right type of call into this vtable */ void **vtable_src; diff --git a/support/buildbot/startbuild.pl b/support/buildbot/startbuild.pl index 8f7e507..b6b1e4e 100755 --- a/support/buildbot/startbuild.pl +++ b/support/buildbot/startbuild.pl @@ -14,6 +14,7 @@ chdir('..'); # Folder .vcproj Engine Binary Suffix type Platform Build('loader', 'mm_loader', '', 'server', 'full', 'both'); +Build('loader', 'mm_loader', 'Left4Dead2', 'server_linux', '', 'linux'); Build('core-legacy', 'mm_core-legacy', '', 'metamod.1.ep1', '', 'both'); Build('core', 'mm_core', 'OrangeBox', 'metamod.2.ep2', '', 'both'); Build('core', 'mm_core', 'Left4Dead', 'metamod.2.l4d', '', 'both'); @@ -94,6 +95,10 @@ sub BuildWindows { $param = "Release - Left 4 Dead"; } + elsif ($build eq "Left4Dead2") + { + $param = "Release - Left 4 Dead 2"; + } elsif ($build eq "DarkMessiah") { $param = "Release - Dark Messiah"; @@ -135,6 +140,11 @@ sub BuildLinux $param = "ENGINE=left4dead"; $file .= '.left4dead'; } + elsif ($build eq "Left4Dead2") + { + $param = "ENGINE=left4dead2"; + $file .= '.left4dead2'; + } $file .= '/' . $binary; print "Cleaning $srcdir...\n"; diff --git a/support/buildbot/symstore.pl b/support/buildbot/symstore.pl index 92cc528..7230ccd 100755 --- a/support/buildbot/symstore.pl +++ b/support/buildbot/symstore.pl @@ -22,9 +22,10 @@ $version .= '-hg' . Build::HgRevNum('.'); symstore("loader\\msvc9\\server.*", $version); symstore("core-legacy\\msvc9\\Release\\metamod.1.ep1.*", $version); +symstore("core\\msvc9\\Release - Dark Messiah\\metamod.2.darkm.*", $version); symstore("core\\msvc9\\Release - Orange Box\\metamod.2.ep2.*", $version); symstore("core\\msvc9\\Release - Left 4 Dead\\metamod.2.l4d.*", $version); -symstore("core\\msvc9\\Release - Dark Messiah\\metamod.2.darkm.*", $version); +symstore("core\\msvc9\\Release - Left 4 Dead 2\\metamod.2.l4d2.*", $version); #Lowercase DLLs. Sigh. my (@files);