1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/sourcemm/sample_mm/Makefile Fri Apr 22 14:36:21 2005 +0000
1.3 @@ -0,0 +1,57 @@
1.4 +#(C)2004-2005 SourceMM Development Team
1.5 +# Makefile written by David "BAILOPAN" Anderson
1.6 +
1.7 +OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
1.8 +DEBUG_FLAGS = -g -ggdb3
1.9 +HL2SDK = ../../../hl2sdk
1.10 +CPP = g++
1.11 +SMM_ROOT = ../../
1.12 +SRCDS = ~/srcds
1.13 +
1.14 +### NOTHING TO EDIT BELOW ###
1.15 +
1.16 +OBJECTS = SamplePlugin.cpp
1.17 +
1.18 +LINK = vstdlib_i486.so tier0_i486.so
1.19 +
1.20 +HL2PUB = $(HL2SDK)/public
1.21 +
1.22 +INCLUDE = -I. -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)tier0 -I$(HL2PUB)/tier1 \
1.23 + -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SMM_ROOT) -I$(SMM_ROOT)/sourcehook -I$(SMM_ROOT)/sourcemm
1.24 +
1.25 +BINARY = sourcemm_i486.so
1.26 +
1.27 +ifeq "$(DEBUG)" "true"
1.28 + BIN_DIR = Debug
1.29 + CFLAGS = $(DEBUG_FLAGS)
1.30 +else
1.31 + BIN_DIR = Release
1.32 + CFLAGS = $(OPT_FLAGS)
1.33 +endif
1.34 +
1.35 +CFLAGS += -fpermissive -D_LINUX -DNDEBUG -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -fPIC
1.36 +
1.37 +OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
1.38 +
1.39 +$(BIN_DIR)/%.o: %.cpp
1.40 + $(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
1.41 +
1.42 +all:
1.43 + mkdir -p $(BIN_DIR)
1.44 + ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so
1.45 + ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so
1.46 + $(MAKE) sourcemm
1.47 +
1.48 +sourcemm: $(OBJ_LINUX)
1.49 + $(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
1.50 +
1.51 +debug:
1.52 + $(MAKE) all DEBUG=true
1.53 +
1.54 +default: all
1.55 +
1.56 +clean:
1.57 + rm -rf Release/*.o
1.58 + rm -rf Release/$(BINARY)
1.59 + rm -rf Debug/*.o
1.60 + rm -rf Debug/$(BINARY)
2.1 --- a/sourcemm/sample_mm/SamplePlugin.cpp Fri Apr 22 14:29:25 2005 +0000
2.2 +++ b/sourcemm/sample_mm/SamplePlugin.cpp Fri Apr 22 14:36:21 2005 +0000
2.3 @@ -139,12 +139,6 @@
2.4 //Hook ClientCommand to our function
2.5 SH_ADD_HOOK_MEMFUNC(IServerGameClients, ClientCommand, m_ServerClients, &g_SamplePlugin, ClientCommand, false);
2.6
2.7 - //Now, importantly, SourceHook has modified the layout of the above classes.
2.8 - //If we want to call them in their original state (i.e., without invoking hooks)
2.9 - // we must request a "Call Class" from SourceHook.
2.10 - m_ServerClients_CC = SH_GET_CALLCLASS(IServerGameClients, m_ServerClients);
2.11 - m_ServerDll = SH_GET_CALLCLASS(IServerGameDLL, m_ServerDll);
2.12 -
2.13 return true;
2.14 }
2.15
2.16 @@ -165,10 +159,6 @@
2.17 SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientConnect, m_ServerClients, &g_SamplePlugin, ClientConnect, false);
2.18 SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientCommand, m_ServerClients, &g_SamplePlugin, ClientCommand, false);
2.19
2.20 - //Lastly, release the call classes we requested
2.21 - SH_RELEASE_CALLCLASS(m_ServerDll_CC);
2.22 - SH_RELEASE_CALLCLASS(m_ServerClients_CC);
2.23 -
2.24 return true;
2.25 }
2.26
3.1 --- a/sourcemm/sample_mm/SamplePlugin.h Fri Apr 22 14:29:25 2005 +0000
3.2 +++ b/sourcemm/sample_mm/SamplePlugin.h Fri Apr 22 14:36:21 2005 +0000
3.3 @@ -107,8 +107,6 @@
3.4 IVEngineServer *m_Engine;
3.5 IServerGameDLL *m_ServerDll;
3.6 IServerGameClients *m_ServerClients;
3.7 - IServerGameDLL *m_ServerDll_CC;
3.8 - IServerGameClients *m_ServerClients_CC;
3.9 };
3.10
3.11 extern SamplePlugin g_SamplePlugin;
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/sourcemm/sample_mm/oslink.h Fri Apr 22 14:36:21 2005 +0000
4.3 @@ -0,0 +1,66 @@
4.4 +/* ======== SourceMM ========
4.5 +* Copyright (C) 2004-2005 Metamod:Source Development Team
4.6 +* No warranties of any kind
4.7 +*
4.8 +* License: zlib/libpng
4.9 +*
4.10 +* Author(s): David "BAILOPAN" Anderson
4.11 +* ============================
4.12 +*/
4.13 +
4.14 +#ifndef _INCLUDE_OSLINK_H
4.15 +#define _INCLUDE_OSLINK_H
4.16 +
4.17 +/**
4.18 + * @brief Defines OS-independent information
4.19 + * @file oslink.h
4.20 + */
4.21 +
4.22 +#if defined __WIN32__ || defined _WIN32 || defined WIN32
4.23 + #define WIN32_LEAN_AND_MEAN
4.24 + #define OS_WIN32
4.25 + #include <windows.h>
4.26 + #include <io.h>
4.27 + #include <direct.h>
4.28 + #define mkdir(a) _mkdir(a)
4.29 + #define dlmount(x) LoadLibrary(x)
4.30 + #define dlsym(x, s) GetProcAddress(x, s)
4.31 + #define dlclose(x) FreeLibrary(x)
4.32 + const char* dlerror();
4.33 +#elif defined __linux__
4.34 + #define OS_LINUX
4.35 + #include <dlfcn.h>
4.36 + #include <unistd.h>
4.37 + #include <sys/types.h>
4.38 + #include <dirent.h>
4.39 + #define dlmount(x) dlopen(x,RTLD_NOW)
4.40 + typedef void* HINSTANCE;
4.41 +#endif
4.42 +
4.43 +#if defined __linux__
4.44 + extern int errno;
4.45 + int GetLastError();
4.46 +#endif
4.47 +
4.48 +#if defined __WIN32__ || defined _WIN32 || defined WIN32
4.49 + #define SMM_API extern "C" __declspec(dllexport)
4.50 +#elif defined __GNUC__
4.51 + #define SMM_API extern "C"
4.52 +#endif
4.53 +
4.54 +#if defined __WIN32__ || defined _WIN32 || defined WIN32
4.55 + typedef __int64 int64_t;
4.56 + typedef unsigned __int64 uint64_t;
4.57 +#elif defined __GNUC__
4.58 +# if !__GLIBC_HAVE_LONG_LONG
4.59 + typedef long long int64_t;
4.60 +# endif
4.61 + typedef unsigned long long uint64_t;
4.62 +#endif
4.63 +
4.64 +#ifndef __linux__
4.65 + #define snprintf _snprintf
4.66 + #define vsnprintf _vsnprintf
4.67 +#endif
4.68 +
4.69 +#endif //_INCLUDE_OSLINK_H