diff --git a/Makefile b/Makefile index 3424f85..4b9b400 100644 --- a/Makefile +++ b/Makefile @@ -1,175 +1,84 @@ -# (C)2004-2010 Metamod:Source Development Team -# Makefile written by David "BAILOPAN" Anderson +# Makefile -GIT_VERSION = $(shell sh -c 'git describe --abbrev=8 --dirty --always') +HX_SDK = ../hl2sdk-l4d2 +HX_METAMOD = ../mmsource +# +# l4dtoolz_mm_i486.so +# +HX_INCLUDE = -I. \ + -I$(HX_METAMOD)/core \ + -I$(HX_METAMOD)/core/sourcehook \ + -I$(HX_SDK)/public \ + -I$(HX_SDK)/public/tier0 \ + -I$(HX_SDK)/public/tier1 \ + -I$(HX_SDK)/public/engine \ + -I$(HX_SDK)/public/mathlib -########################################### -### EDIT THESE PATHS FOR YOUR OWN SETUP ### -########################################### +# +HX_FLAGS = -DSOURCE_ENGINE=9 -HL2SDK_L4D = ../../hl2sdk-l4d -HL2SDK_L4D2 = ../../hl2sdk-l4d2 -MMSOURCE19 = .. +# +HX_FLAGS += -DSE_EPISODEONE=1 \ + -DSE_DARKMESSIAH=2 \ + -DSE_ORANGEBOX=3 \ + -DSE_BLOODYGOODTIME=4 \ + -DSE_EYE=5 \ + -DSE_CSS=6 \ + -DSE_ORANGEBOXVALVE=7 \ + -DSE_LEFT4DEAD=8 \ + -DSE_LEFT4DEAD2=9 \ + -DSE_ALIENSWARM=10 \ + -DSE_PORTAL2=11 \ + -DSE_CSGO=12 -##################################### -### EDIT BELOW FOR OTHER PROJECTS ### -##################################### +# +HX_FLAGS += -DPOSIX \ + -Dstricmp=strcasecmp \ + -D_stricmp=strcasecmp \ + -D_strnicmp=strncasecmp \ + -Dstrnicmp=strncasecmp \ + -D_snprintf=snprintf \ + -D_vsnprintf=vsnprintf \ + -D_alloca=alloca \ + -Dstrcmpi=strcasecmp \ + -DCOMPILER_GCC \ + -Wno-overloaded-virtual \ + -Wall \ + -Werror \ + -Wno-switch \ + -Wno-unused \ + -msse \ + -DHAVE_STDINT_H \ + -m32 \ + -DNDEBUG \ + -O3 \ + -funroll-loops \ + -pipe \ + -fno-strict-aliasing \ + -D_LINUX \ + -mfpmath=sse \ + -fvisibility=hidden \ + -Wno-non-virtual-dtor \ + -fno-exceptions \ + -fno-rtti \ + -fvisibility-inlines-hidden \ + -std=c++11 -PROJECT = l4dtoolz_mm_i486 -OBJECTS = l4dtoolz_mm.cpp signature.cpp - -############################################## -### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ### -############################################## - -OPT_FLAGS = -O3 -funroll-loops -pipe -GCC4_FLAGS = -fvisibility=hidden -fvisibility-inlines-hidden -DEBUG_FLAGS = -g -ggdb3 -D_DEBUG -CPP = gcc -CPP_OSX = clang - -########################## -### SDK CONFIGURATIONS ### -########################## - -override ENGSET = false - -# Check for valid list of engines -ifneq (,$(filter left4dead left4dead2,$(ENGINE))) - override ENGSET = true -endif - -ifeq "$(ENGINE)" "left4dead" - HL2SDK = $(HL2SDK_L4D) - CFLAGS += -DSOURCE_ENGINE=8 -DL4D1 -endif -ifeq "$(ENGINE)" "left4dead2" - HL2SDK = $(HL2SDK_L4D2) - CFLAGS += -DSOURCE_ENGINE=9 -DL4D2 -endif - -ifneq "$(GIT_VERSION)" "" - CFLAGS += -D__GIT_VERSION=\"$(GIT_VERSION)\" -endif - -HL2PUB = $(HL2SDK)/public - - -INCLUDE += -I$(HL2SDK)/public/game/server -METAMOD = $(MMSOURCE19)/core - -OS := $(shell uname -s) - -ifeq "$(OS)" "Darwin" - LIB_EXT = dylib - HL2LIB = $(HL2SDK)/lib/mac -else - LIB_EXT = so - HL2LIB = $(HL2SDK)/lib/linux -endif - - -LIB_PREFIX = lib -ifneq (,$(filter left4dead2,$(ENGINE))) - ifneq "$(OS)" "Darwin" - LIB_SUFFIX = _srv.$(LIB_EXT) - else - LIB_SUFFIX = .$(LIB_EXT) - endif -else - LIB_SUFFIX = .$(LIB_EXT) -endif - - -CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 \ - -DSE_CSS=6 -DSE_ORANGEBOXVALVE=7 -DSE_LEFT4DEAD=8 -DSE_LEFT4DEAD2=9 -DSE_ALIENSWARM=10 \ - -DSE_PORTAL2=11 -DSE_CSGO=12 - -LINK += $(HL2LIB)/tier1_i486.a $(LIB_PREFIX)vstdlib$(LIB_SUFFIX) $(LIB_PREFIX)tier0$(LIB_SUFFIX) - -INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \ - -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I. -I$(METAMOD) -I$(METAMOD)/sourcehook - -################################################ -### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ### -################################################ - -BINARY = $(PROJECT).$(LIB_EXT) - -ifeq "$(DEBUG)" "true" - BIN_DIR = Debug.$(ENGINE) - CFLAGS += $(DEBUG_FLAGS) -else - BIN_DIR = Release.$(ENGINE) - CFLAGS += $(OPT_FLAGS) -endif - - -ifeq "$(OS)" "Darwin" - CPP = $(CPP_OSX) - LIB_EXT = dylib - CFLAGS += -DOSX -D_OSX - LINK += -dynamiclib -lstdc++ -mmacosx-version-min=10.5 -else - LIB_EXT = so - CFLAGS += -D_LINUX - LINK += -shared -endif - -IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0") - -ifeq "$(IS_CLANG)" "1" - CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/") - CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/") -else - CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1) - CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3) -endif - -CFLAGS += -DPOSIX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp \ - -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca \ - -Dstrcmpi=strcasecmp -DCOMPILER_GCC -Wall -Wno-non-virtual-dtor -Wno-overloaded-virtual \ - -Werror -fPIC -fno-exceptions -fno-rtti -msse -m32 -fno-strict-aliasing - -# Clang || GCC >= 4 -ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1" - CFLAGS += $(GCC4_FLAGS) -endif - -# Clang >= 3 || GCC >= 4.7 -ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1" - CFLAGS += -Wno-delete-non-virtual-dtor -endif - -# OS is Linux and not using clang -ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1" - LINK += -static-libgcc -endif - -OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o) - -$(BIN_DIR)/%.o: %.cpp - $(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $< - -all: check - mkdir -p $(BIN_DIR) - ln -sf $(HL2LIB)/$(LIB_PREFIX)vstdlib$(LIB_SUFFIX) - ln -sf $(HL2LIB)/$(LIB_PREFIX)tier0$(LIB_SUFFIX) - $(MAKE) -f Makefile l4dtoolz_mm - -check: - if [ "$(ENGSET)" = "false" ]; then \ - echo "You must supply one of the following values for ENGINE:"; \ - echo "left4dead2 or left4dead"; \ - exit 1; \ - fi - -l4dtoolz_mm: check $(OBJ_BIN) - $(CPP) $(INCLUDE) -m32 $(OBJ_BIN) $(LINK) -ldl -lm -o $(BIN_DIR)/$(BINARY) - -default: all - -clean: check - rm -rf $(BIN_DIR)/*.o - rm -rf $(BIN_DIR)/$(BINARY) +# +HX_LIB = Release/l4dtoolz_mm.o \ + Release/signature.o \ + $(HX_SDK)/lib/linux/tier1_i486.a \ + libvstdlib_srv.so \ + libtier0_srv.so +# +all: + mkdir -p Release + ln -sf $(HX_SDK)/lib/linux/libvstdlib_srv.so libvstdlib_srv.so; + ln -sf $(HX_SDK)/lib/linux/libtier0_srv.so libtier0_srv.so; +# + gcc $(HX_INCLUDE) $(HX_FLAGS) -o Release/l4dtoolz_mm.o -c l4dtoolz_mm.cpp + gcc $(HX_INCLUDE) $(HX_FLAGS) -o Release/signature.o -c signature.cpp + gcc $(HX_INCLUDE) $(HX_LIB) -m32 -shared -static-libgcc -ldl -lm -o Release/l4dtoolz_mm_i486.so +# + rm -rf Release/*.o diff --git a/Makefile_l4d b/Makefile_l4d new file mode 100644 index 0000000..08442aa --- /dev/null +++ b/Makefile_l4d @@ -0,0 +1,85 @@ +# Makefile + +HX_SDK = ../hl2sdk-l4d +HX_METAMOD = ../mmsource +# +# l4dtoolz_mm_i486.so +# +HX_INCLUDE = -I. \ + -I$(HX_METAMOD)/core \ + -I$(HX_METAMOD)/core/sourcehook \ + -I$(HX_SDK)/public \ + -I$(HX_SDK)/public/tier0 \ + -I$(HX_SDK)/public/tier1 \ + -I$(HX_SDK)/public/engine \ + -I$(HX_SDK)/public/mathlib + +# +HX_FLAGS = -DSOURCE_ENGINE=8 \ + -DL4D1 + +# +HX_FLAGS += -DSE_EPISODEONE=1 \ + -DSE_DARKMESSIAH=2 \ + -DSE_ORANGEBOX=3 \ + -DSE_BLOODYGOODTIME=4 \ + -DSE_EYE=5 \ + -DSE_CSS=6 \ + -DSE_ORANGEBOXVALVE=7 \ + -DSE_LEFT4DEAD=8 \ + -DSE_LEFT4DEAD2=9 \ + -DSE_ALIENSWARM=10 \ + -DSE_PORTAL2=11 \ + -DSE_CSGO=12 + +# +HX_FLAGS += -DPOSIX \ + -Dstricmp=strcasecmp \ + -D_stricmp=strcasecmp \ + -D_strnicmp=strncasecmp \ + -Dstrnicmp=strncasecmp \ + -D_snprintf=snprintf \ + -D_vsnprintf=vsnprintf \ + -D_alloca=alloca \ + -Dstrcmpi=strcasecmp \ + -DCOMPILER_GCC \ + -Wno-overloaded-virtual \ + -Wall \ + -Werror \ + -Wno-switch \ + -Wno-unused \ + -msse \ + -DHAVE_STDINT_H \ + -m32 \ + -DNDEBUG \ + -O3 \ + -funroll-loops \ + -pipe \ + -fno-strict-aliasing \ + -D_LINUX \ + -mfpmath=sse \ + -fvisibility=hidden \ + -Wno-non-virtual-dtor \ + -fno-exceptions \ + -fno-rtti \ + -fvisibility-inlines-hidden \ + -std=c++11 + +# +HX_LIB = Release/l4dtoolz_mm.o \ + Release/signature.o \ + $(HX_SDK)/lib/linux/tier1_i486.a \ + libvstdlib.so \ + libtier0.so + +# +all: + mkdir -p Release + ln -sf $(HX_SDK)/lib/linux/libvstdlib.so libvstdlib.so; + ln -sf $(HX_SDK)/lib/linux/libtier0.so libtier0.so; +# + gcc $(HX_INCLUDE) $(HX_FLAGS) -o Release/l4dtoolz_mm.o -c l4dtoolz_mm.cpp + gcc $(HX_INCLUDE) $(HX_FLAGS) -o Release/signature.o -c signature.cpp + gcc $(HX_INCLUDE) $(HX_LIB) -m32 -shared -static-libgcc -ldl -lm -o Release/l4dtoolz_mm_i486.so +# + rm -rf Release/*.o diff --git a/l4d1_signature_linux.h b/l4d1_signature_linux.h index 52cb75c..e8f99bb 100644 --- a/l4d1_signature_linux.h +++ b/l4d1_signature_linux.h @@ -20,7 +20,7 @@ void* lobby_sux_org = NULL; //CBaseServer::ConnectClient(netadr_s &, int, int, int, char const*, char const*, char const*, int, CUtlVector> &, bool) //fuction is in engine.so const char* max_players = "\x0F\xFF\x50\xC3\x29\xC7\x01\xEF\x3B\xC3\xC3\xC3\x00\x00\x0F\x8E"; -char max_players_new[]= {0x06, 0x07, 0x83, 0xFF, 0x3C, 0x90, 0x90, 0x90}; +unsigned char max_players_new[]= {0x06, 0x07, 0x83, 0xFF, 0x3C, 0x90, 0x90, 0x90}; void* max_players_org = NULL; //CServerGameClients::GetMaxHumanPlayers(void) diff --git a/l4d2_signature_linux.h b/l4d2_signature_linux.h index 4f40a8a..6256d47 100644 --- a/l4d2_signature_linux.h +++ b/l4d2_signature_linux.h @@ -10,7 +10,7 @@ const char* lobby_sux_new = "\x06\x0B\xBE\x01\x00\x00\x00\x90"; void *lobby_sux_org = NULL; const char* max_players = "\x16\x89\xC6\x8B\x03\x89\x1C\x24\xFF\x50\xC3\x29\xC6\x03\x75\xC3\x3B\xB3\xC3\x01\x00\x00\x0F"; -char max_players_new[]= {0x06, 0x0F, 0x83, 0xFE, 0x3C, 0x90, 0x90, 0x90}; +unsigned char max_players_new[]= {0x06, 0x0F, 0x83, 0xFE, 0x3C, 0x90, 0x90, 0x90}; void *max_players_org = NULL; const char* server_bplayers = "\x16\x55\x89\xE5\x83\xEC\x08\xE8\xC3\xC3\xC3\xC3\xC9\x3C\x01\x19\xC0\x83\xE0\xFC\x83\xC0\x08"; diff --git a/msvc8/l4dtoolz_mm.sln b/msvc12/l4dtoolz_mm.sln similarity index 57% rename from msvc8/l4dtoolz_mm.sln rename to msvc12/l4dtoolz_mm.sln index 3812f8f..595cfd3 100644 --- a/msvc8/l4dtoolz_mm.sln +++ b/msvc12/l4dtoolz_mm.sln @@ -1,20 +1,14 @@  -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "l4dtoolz_mm", "l4dtoolz_mm.vcproj", "{E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}" +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "l4dtoolz_mm", "l4dtoolz_mm.vcxproj", "{E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug - Left 4 Dead 2|Win32 = Debug - Left 4 Dead 2|Win32 - Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32 Release - Left 4 Dead 2|Win32 = Release - Left 4 Dead 2|Win32 Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}.Debug - Left 4 Dead 2|Win32.ActiveCfg = Debug - Left 4 Dead 2|Win32 - {E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}.Debug - Left 4 Dead 2|Win32.Build.0 = Debug - Left 4 Dead 2|Win32 - {E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}.Debug - Left 4 Dead|Win32.ActiveCfg = Debug - Left 4 Dead|Win32 - {E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}.Debug - Left 4 Dead|Win32.Build.0 = Debug - Left 4 Dead|Win32 {E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}.Release - Left 4 Dead 2|Win32.ActiveCfg = Release - Left 4 Dead 2|Win32 {E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}.Release - Left 4 Dead 2|Win32.Build.0 = Release - Left 4 Dead 2|Win32 {E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}.Release - Left 4 Dead|Win32.ActiveCfg = Release - Left 4 Dead|Win32 diff --git a/msvc12/l4dtoolz_mm.vcxproj b/msvc12/l4dtoolz_mm.vcxproj new file mode 100644 index 0000000..70bce34 --- /dev/null +++ b/msvc12/l4dtoolz_mm.vcxproj @@ -0,0 +1,115 @@ + + + + + Release - Left 4 Dead 2 + Win32 + + + Release - Left 4 Dead + Win32 + + + + {E62E5876-E1E2-41A0-85CA-1B41B9DA55F9} + sample_mm + Win32Proj + + + + DynamicLibrary + v110 + MultiByte + true + + + DynamicLibrary + v110 + MultiByte + true + + + + + + + + + + + + + <_ProjectFileVersion>11.0.61030.0 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + false + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + false + false + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 -DL4D1 %(AdditionalOptions) + ..\..\mmsource-1.10\core;..\..\mmsource-1.10\core\sourcehook;..\..\hl2sdk-l4d\public;..\..\hl2sdk-l4d\public\engine;..\..\hl2sdk-l4d\public\game\server;..\..\hl2sdk-l4d\public\tier0;..\..\hl2sdk-l4d\public\tier1;..\..\hl2sdk-l4d\public\vstdlib;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SAMPLE_MM_EXPORTS;SOURCE_ENGINE=8;%(PreprocessorDefinitions) + MultiThreaded + + Level3 + ProgramDatabase + + + ..\..\hl2sdk-l4d\lib\public\tier0.lib;..\..\hl2sdk-l4d\lib\public\tier1.lib;..\..\hl2sdk-l4d\lib\public\vstdlib.lib;%(AdditionalDependencies) + $(OutDir)l4dtoolz_mm.dll + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + MachineX86 + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 -DL4D2 %(AdditionalOptions) + ..\..\mmsource-1.10\core;..\..\mmsource-1.10\core\sourcehook;..\..\hl2sdk-l4d2\public;..\..\hl2sdk-l4d2\public\engine;..\..\hl2sdk-l4d2\public\game\server;..\..\hl2sdk-l4d2\public\tier0;..\..\hl2sdk-l4d2\public\tier1;..\..\hl2sdk-l4d2\public\vstdlib;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SAMPLE_MM_EXPORTS;SOURCE_ENGINE=9;%(PreprocessorDefinitions) + + MultiThreaded + + Level3 + ProgramDatabase + + + ..\..\hl2sdk-l4d2\lib\public\tier0.lib;..\..\hl2sdk-l4d2\lib\public\tier1.lib;..\..\hl2sdk-l4d2\lib\public\vstdlib.lib;%(AdditionalDependencies) + $(OutDir)l4dtoolz_mm.dll + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + MachineX86 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/msvc12/l4dtoolz_mm.vcxproj.filters b/msvc12/l4dtoolz_mm.vcxproj.filters new file mode 100644 index 0000000..99ab41a --- /dev/null +++ b/msvc12/l4dtoolz_mm.vcxproj.filters @@ -0,0 +1,45 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/msvc8/l4dtoolz_mm.vcproj b/msvc8/l4dtoolz_mm.vcproj deleted file mode 100644 index c7848b3..0000000 --- a/msvc8/l4dtoolz_mm.vcproj +++ /dev/null @@ -1,887 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -