SourceMod can now be somewhat compiled on OS X for patch sanity testing (bug 3516, r=ds).
This adds the ability for us to change the GCC version we use more flexibly.
This commit is contained in:
parent
58ec9a4f38
commit
1fe38c7473
@ -29,7 +29,7 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "CDataPack.h"
|
#include "CDataPack.h"
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
extern HandleType_t htCellArray;
|
extern HandleType_t htCellArray;
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
ConVar sm_corecfgfile("sm_corecfgfile", "addons\\sourcemod\\configs\\core.cfg", 0, "SourceMod core configuration file");
|
ConVar sm_corecfgfile("sm_corecfgfile", "addons\\sourcemod\\configs\\core.cfg", 0, "SourceMod core configuration file");
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||||
ConVar sm_corecfgfile("sm_corecfgfile", "addons/sourcemod/configs/core.cfg", 0, "SourceMod core configuration file");
|
ConVar sm_corecfgfile("sm_corecfgfile", "addons/sourcemod/configs/core.cfg", 0, "SourceMod core configuration file");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ inline bool IsPathSepChar(char c)
|
|||||||
{
|
{
|
||||||
#if defined PLATFORM_WINDOWS
|
#if defined PLATFORM_WINDOWS
|
||||||
return (c == '\\' || c == '/');
|
return (c == '\\' || c == '/');
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_LINUX || defined PLATFORM_POSIX
|
||||||
return (c == '/');
|
return (c == '/');
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,9 @@ char g_GameName[256] = {'$', '\0'};
|
|||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_LINUX
|
||||||
#define PLATFORM_NAME "linux"
|
#define PLATFORM_NAME "linux"
|
||||||
#define PLATFORM_SERVER_BINARY "server_i486.so"
|
#define PLATFORM_SERVER_BINARY "server_i486.so"
|
||||||
|
#elif defined PLATFORM_APPLE
|
||||||
|
#define PLATFORM_NAME "undef"
|
||||||
|
#define PLATFORM_SERVER_BINARY "undef.dylib"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct TempSigInfo
|
struct TempSigInfo
|
||||||
|
@ -138,7 +138,7 @@ bool CDirectory::IsEntryDirectory()
|
|||||||
{
|
{
|
||||||
#if defined PLATFORM_WINDOWS
|
#if defined PLATFORM_WINDOWS
|
||||||
return ((m_fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY);
|
return ((m_fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY);
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_POSIX
|
||||||
char temppath[PLATFORM_MAX_PATH];
|
char temppath[PLATFORM_MAX_PATH];
|
||||||
snprintf(temppath, sizeof(temppath), "%s/%s", m_origpath, GetEntryName());
|
snprintf(temppath, sizeof(temppath), "%s/%s", m_origpath, GetEntryName());
|
||||||
return g_LibSys.IsPathDirectory(temppath);
|
return g_LibSys.IsPathDirectory(temppath);
|
||||||
@ -160,7 +160,7 @@ const char *CDirectory::GetEntryName()
|
|||||||
{
|
{
|
||||||
#if defined PLATFORM_WINDOWS
|
#if defined PLATFORM_WINDOWS
|
||||||
return m_fd.cFileName;
|
return m_fd.cFileName;
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_POSIX
|
||||||
return ep ? ep->d_name : "";
|
return ep ? ep->d_name : "";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ bool CDirectory::IsValid()
|
|||||||
{
|
{
|
||||||
#if defined PLATFORM_WINDOWS
|
#if defined PLATFORM_WINDOWS
|
||||||
return (m_dir != INVALID_HANDLE_VALUE);
|
return (m_dir != INVALID_HANDLE_VALUE);
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_POSIX
|
||||||
return (m_dir != NULL);
|
return (m_dir != NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ bool LibrarySystem::IsPathFile(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_POSIX
|
||||||
struct stat s;
|
struct stat s;
|
||||||
|
|
||||||
if (stat(path, &s) != 0)
|
if (stat(path, &s) != 0)
|
||||||
|
@ -43,7 +43,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
|
13
core/md5.cpp
13
core/md5.cpp
@ -201,11 +201,7 @@ char *MD5::hex_digest(){
|
|||||||
int i;
|
int i;
|
||||||
char *s= new char[33];
|
char *s= new char[33];
|
||||||
|
|
||||||
if (!finalized){
|
assert(finalized);
|
||||||
/* cerr << "MD5::hex_digest: Can't get digest if you haven't "<<
|
|
||||||
"finalized the digest!" <<endl;*/
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0; i<16; i++)
|
for (i=0; i<16; i++)
|
||||||
sprintf(s+i*2, "%02x", digest[i]);
|
sprintf(s+i*2, "%02x", digest[i]);
|
||||||
@ -220,12 +216,7 @@ char *MD5::hex_digest(char buffer[33]){
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!finalized)
|
assert(finalized);
|
||||||
{
|
|
||||||
/* cerr << "MD5::hex_digest: Can't get digest if you haven't "<<
|
|
||||||
"finalized the digest!" <<endl;*/
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0; i<16; i++)
|
for (i=0; i<16; i++)
|
||||||
sprintf(buffer+i*2, "%02x", digest[i]);
|
sprintf(buffer+i*2, "%02x", digest[i]);
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "sm_memtable.h"
|
#include "sm_memtable.h"
|
||||||
|
|
||||||
BaseMemTable::BaseMemTable(unsigned int init_size)
|
BaseMemTable::BaseMemTable(unsigned int init_size)
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#define _INCLUDE_SM_QUEUE_H
|
#define _INCLUDE_SM_QUEUE_H
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include <sh_stack.h>
|
#include <sh_stack.h>
|
||||||
|
|
||||||
using namespace SourceHook;
|
using namespace SourceHook;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "sm_stringutil.h"
|
#include "sm_stringutil.h"
|
||||||
#include "CellArray.h"
|
#include "CellArray.h"
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "sm_stringutil.h"
|
#include "sm_stringutil.h"
|
||||||
#include "CellArray.h"
|
#include "CellArray.h"
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "sm_stringutil.h"
|
#include "sm_stringutil.h"
|
||||||
#include "HandleSys.h"
|
#include "HandleSys.h"
|
||||||
|
@ -418,6 +418,9 @@ static cell_t GetSysTickCount(IPluginContext *pContext, const cell_t *params)
|
|||||||
fticks -= r;
|
fticks -= r;
|
||||||
}
|
}
|
||||||
return (cell_t)fticks;
|
return (cell_t)fticks;
|
||||||
|
#elif defined PLATFORM_APPLE
|
||||||
|
assert(false);
|
||||||
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ inline const char *_strstr(const char *str, const char *substr)
|
|||||||
{
|
{
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
return strstr(str, substr);
|
return strstr(str, substr);
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||||
return (const char *)strstr(str, substr);
|
return (const char *)strstr(str, substr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
@ -61,7 +61,7 @@ else
|
|||||||
-I$(SMSDK)/public/jit/x86 -I$(SMSDK)/public/sourcepawn
|
-I$(SMSDK)/public/jit/x86 -I$(SMSDK)/public/sourcepawn
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LINK += -static-libgcc
|
LINK += -m32 -ldl -lm
|
||||||
|
|
||||||
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||||
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -mfpmath=sse \
|
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -mfpmath=sse \
|
||||||
@ -84,14 +84,21 @@ ifeq "$(USEMETA)" "true"
|
|||||||
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OS := $(shell uname -s)
|
||||||
|
ifeq "$(OS)" "Darwin"
|
||||||
|
LINK += -dynamiclib
|
||||||
|
BINARY = $(PROJECT).ext.dylib
|
||||||
|
else
|
||||||
|
LINK += -static-libgcc -shared
|
||||||
|
BINARY = $(PROJECT).ext.so
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
ifeq "$(GCC_VERSION)" "4"
|
ifeq "$(GCC_VERSION)" "4"
|
||||||
CFLAGS += $(C_GCC4_FLAGS)
|
CFLAGS += $(C_GCC4_FLAGS)
|
||||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINARY = $(PROJECT).ext.so
|
|
||||||
|
|
||||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||||
|
|
||||||
$(BIN_DIR)/%.o: %.cpp
|
$(BIN_DIR)/%.o: %.cpp
|
||||||
@ -112,7 +119,7 @@ check:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
extension: check $(OBJ_LINUX)
|
extension: check $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
@ -123,3 +130,4 @@ clean: check
|
|||||||
rm -rf $(BIN_DIR)/*.o
|
rm -rf $(BIN_DIR)/*.o
|
||||||
rm -rf $(BIN_DIR)/sdk/*.o
|
rm -rf $(BIN_DIR)/sdk/*.o
|
||||||
rm -rf $(BIN_DIR)/$(BINARY)
|
rm -rf $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "smsdk_ext.h"
|
#include "smsdk_ext.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,6 +79,24 @@ IThreader *threader = NULL;
|
|||||||
#if defined SMEXT_ENABLE_LIBSYS
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
ILibrarySys *libsys = NULL;
|
ILibrarySys *libsys = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
SourceMod::IPluginManager *plsys;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
IMenuManager *menus = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
IAdminSystem *adminsys = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
ITextParsers *textparsers = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
IUserMessages *usermsgs = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
ITranslator *translator = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Exports the main interface */
|
/** Exports the main interface */
|
||||||
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
||||||
@ -149,6 +167,24 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
|
|||||||
#if defined SMEXT_ENABLE_LIBSYS
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
SM_GET_IFACE(LIBRARYSYS, libsys);
|
SM_GET_IFACE(LIBRARYSYS, libsys);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
SM_GET_IFACE(PLUGINSYSTEM, plsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
SM_GET_IFACE(MENUMANAGER, menus);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
SM_GET_IFACE(ADMINSYS, adminsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
SM_GET_IFACE(TEXTPARSERS, textparsers);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
SM_GET_IFACE(USERMSGS, usermsgs);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
SM_GET_IFACE(TRANSLATOR, translator);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDK_OnLoad(error, maxlength, late))
|
if (SDK_OnLoad(error, maxlength, late))
|
||||||
{
|
{
|
||||||
@ -256,7 +292,11 @@ IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */
|
|||||||
/** Exposes the extension to Metamod */
|
/** Exposes the extension to Metamod */
|
||||||
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
||||||
{
|
{
|
||||||
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
|
if (name && !strcmp(name, METAMOD_PLAPI_NAME))
|
||||||
|
#else
|
||||||
if (name && !strcmp(name, PLAPI_NAME))
|
if (name && !strcmp(name, PLAPI_NAME))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (code)
|
if (code)
|
||||||
{
|
{
|
||||||
@ -277,8 +317,13 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen,
|
|||||||
{
|
{
|
||||||
PLUGIN_SAVEVARS();
|
PLUGIN_SAVEVARS();
|
||||||
|
|
||||||
|
#if !defined METAMOD_PLAPI_VERSION
|
||||||
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#else
|
||||||
|
GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
|
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#endif
|
||||||
|
|
||||||
m_SourceMMLoaded = true;
|
m_SourceMMLoaded = true;
|
||||||
|
|
||||||
@ -389,7 +434,7 @@ bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t max
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Overload a few things to prevent libstdc++ linking */
|
/* Overload a few things to prevent libstdc++ linking */
|
||||||
#if defined __linux__
|
#if defined __linux__ || defined __APPLE__
|
||||||
extern "C" void __cxa_pure_virtual(void)
|
extern "C" void __cxa_pure_virtual(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -414,3 +459,4 @@ void operator delete[](void * ptr)
|
|||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
@ -61,7 +61,7 @@ else
|
|||||||
-I$(MMSOURCE17)/core/sourcehook
|
-I$(MMSOURCE17)/core/sourcehook
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LINK += -static-libgcc
|
LINK += -m32 -ldl -lm
|
||||||
|
|
||||||
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||||
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
|
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
|
||||||
@ -84,14 +84,21 @@ ifeq "$(USEMETA)" "true"
|
|||||||
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OS := $(shell uname -s)
|
||||||
|
ifeq "$(OS)" "Darwin"
|
||||||
|
LINK += -dynamiclib
|
||||||
|
BINARY = $(PROJECT).ext.dylib
|
||||||
|
else
|
||||||
|
LINK += -static-libgcc -shared
|
||||||
|
BINARY = $(PROJECT).ext.so
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
ifeq "$(GCC_VERSION)" "4"
|
ifeq "$(GCC_VERSION)" "4"
|
||||||
CFLAGS += $(C_GCC4_FLAGS)
|
CFLAGS += $(C_GCC4_FLAGS)
|
||||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINARY = $(PROJECT).ext.so
|
|
||||||
|
|
||||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||||
|
|
||||||
$(BIN_DIR)/%.o: %.cpp
|
$(BIN_DIR)/%.o: %.cpp
|
||||||
@ -112,7 +119,7 @@ check:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
extension: check $(OBJ_LINUX)
|
extension: check $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "smsdk_ext.h"
|
#include "smsdk_ext.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -434,7 +434,7 @@ bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t max
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Overload a few things to prevent libstdc++ linking */
|
/* Overload a few things to prevent libstdc++ linking */
|
||||||
#if defined __linux__
|
#if defined __linux__ || defined __APPLE__
|
||||||
extern "C" void __cxa_pure_virtual(void)
|
extern "C" void __cxa_pure_virtual(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -459,3 +459,4 @@ void operator delete[](void * ptr)
|
|||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
@ -61,7 +61,7 @@ else
|
|||||||
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LINK += -static-libgcc
|
LINK += -m32 -ldl -lm
|
||||||
|
|
||||||
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||||
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -mfpmath=sse \
|
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -mfpmath=sse \
|
||||||
@ -84,6 +84,15 @@ ifeq "$(USEMETA)" "true"
|
|||||||
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OS := $(shell uname -s)
|
||||||
|
ifeq "$(OS)" "Darwin"
|
||||||
|
LINK += -dynamiclib
|
||||||
|
BINARY = $(PROJECT).ext.dylib
|
||||||
|
else
|
||||||
|
LINK += -static-libgcc -shared
|
||||||
|
BINARY = $(PROJECT).ext.so
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
ifeq "$(GCC_VERSION)" "4"
|
ifeq "$(GCC_VERSION)" "4"
|
||||||
CFLAGS += $(C_GCC4_FLAGS)
|
CFLAGS += $(C_GCC4_FLAGS)
|
||||||
@ -111,7 +120,7 @@ check:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
extension: check $(OBJ_LINUX)
|
extension: check $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "smsdk_ext.h"
|
#include "smsdk_ext.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,9 +79,24 @@ IThreader *threader = NULL;
|
|||||||
#if defined SMEXT_ENABLE_LIBSYS
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
ILibrarySys *libsys = NULL;
|
ILibrarySys *libsys = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
SourceMod::IPluginManager *plsys;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
IMenuManager *menus = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
IAdminSystem *adminsys = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
ITextParsers *textparsers = NULL;
|
||||||
|
#endif
|
||||||
#if defined SMEXT_ENABLE_USERMSGS
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
IUserMessages *usermsgs = NULL;
|
IUserMessages *usermsgs = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
ITranslator *translator = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Exports the main interface */
|
/** Exports the main interface */
|
||||||
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
||||||
@ -152,9 +167,24 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
|
|||||||
#if defined SMEXT_ENABLE_LIBSYS
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
SM_GET_IFACE(LIBRARYSYS, libsys);
|
SM_GET_IFACE(LIBRARYSYS, libsys);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
SM_GET_IFACE(PLUGINSYSTEM, plsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
SM_GET_IFACE(MENUMANAGER, menus);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
SM_GET_IFACE(ADMINSYS, adminsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
SM_GET_IFACE(TEXTPARSERS, textparsers);
|
||||||
|
#endif
|
||||||
#if defined SMEXT_ENABLE_USERMSGS
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
SM_GET_IFACE(USERMSGS, usermsgs);
|
SM_GET_IFACE(USERMSGS, usermsgs);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
SM_GET_IFACE(TRANSLATOR, translator);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDK_OnLoad(error, maxlength, late))
|
if (SDK_OnLoad(error, maxlength, late))
|
||||||
{
|
{
|
||||||
@ -262,7 +292,11 @@ IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */
|
|||||||
/** Exposes the extension to Metamod */
|
/** Exposes the extension to Metamod */
|
||||||
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
||||||
{
|
{
|
||||||
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
if (name && !strcmp(name, METAMOD_PLAPI_NAME))
|
if (name && !strcmp(name, METAMOD_PLAPI_NAME))
|
||||||
|
#else
|
||||||
|
if (name && !strcmp(name, PLAPI_NAME))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (code)
|
if (code)
|
||||||
{
|
{
|
||||||
@ -283,8 +317,13 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen,
|
|||||||
{
|
{
|
||||||
PLUGIN_SAVEVARS();
|
PLUGIN_SAVEVARS();
|
||||||
|
|
||||||
|
#if !defined METAMOD_PLAPI_VERSION
|
||||||
|
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
|
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#else
|
||||||
GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#endif
|
||||||
|
|
||||||
m_SourceMMLoaded = true;
|
m_SourceMMLoaded = true;
|
||||||
|
|
||||||
@ -395,7 +434,7 @@ bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t max
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Overload a few things to prevent libstdc++ linking */
|
/* Overload a few things to prevent libstdc++ linking */
|
||||||
#if defined __linux__
|
#if defined __linux__ || defined __APPLE__
|
||||||
extern "C" void __cxa_pure_virtual(void)
|
extern "C" void __cxa_pure_virtual(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -420,3 +459,4 @@ void operator delete[](void * ptr)
|
|||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
@ -60,7 +60,7 @@ else
|
|||||||
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LINK += -static-libgcc
|
LINK += -m32 -ldl -lm
|
||||||
|
|
||||||
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||||
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -mfpmath=sse \
|
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -mfpmath=sse \
|
||||||
@ -83,14 +83,21 @@ ifeq "$(USEMETA)" "true"
|
|||||||
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OS := $(shell uname -s)
|
||||||
|
ifeq "$(OS)" "Darwin"
|
||||||
|
LINK += -dynamiclib
|
||||||
|
BINARY = $(PROJECT).ext.dylib
|
||||||
|
else
|
||||||
|
LINK += -static-libgcc -shared
|
||||||
|
BINARY = $(PROJECT).ext.so
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
ifeq "$(GCC_VERSION)" "4"
|
ifeq "$(GCC_VERSION)" "4"
|
||||||
CFLAGS += $(C_GCC4_FLAGS)
|
CFLAGS += $(C_GCC4_FLAGS)
|
||||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINARY = $(PROJECT).ext.so
|
|
||||||
|
|
||||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||||
|
|
||||||
$(BIN_DIR)/%.o: %.cpp
|
$(BIN_DIR)/%.o: %.cpp
|
||||||
@ -111,7 +118,7 @@ check:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
extension: check $(OBJ_LINUX)
|
extension: check $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "smsdk_ext.h"
|
#include "smsdk_ext.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,6 +79,24 @@ IThreader *threader = NULL;
|
|||||||
#if defined SMEXT_ENABLE_LIBSYS
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
ILibrarySys *libsys = NULL;
|
ILibrarySys *libsys = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
SourceMod::IPluginManager *plsys;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
IMenuManager *menus = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
IAdminSystem *adminsys = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
ITextParsers *textparsers = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
IUserMessages *usermsgs = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
ITranslator *translator = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Exports the main interface */
|
/** Exports the main interface */
|
||||||
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
||||||
@ -149,6 +167,24 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
|
|||||||
#if defined SMEXT_ENABLE_LIBSYS
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
SM_GET_IFACE(LIBRARYSYS, libsys);
|
SM_GET_IFACE(LIBRARYSYS, libsys);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
SM_GET_IFACE(PLUGINSYSTEM, plsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
SM_GET_IFACE(MENUMANAGER, menus);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
SM_GET_IFACE(ADMINSYS, adminsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
SM_GET_IFACE(TEXTPARSERS, textparsers);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
SM_GET_IFACE(USERMSGS, usermsgs);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
SM_GET_IFACE(TRANSLATOR, translator);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDK_OnLoad(error, maxlength, late))
|
if (SDK_OnLoad(error, maxlength, late))
|
||||||
{
|
{
|
||||||
@ -256,7 +292,11 @@ IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */
|
|||||||
/** Exposes the extension to Metamod */
|
/** Exposes the extension to Metamod */
|
||||||
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
||||||
{
|
{
|
||||||
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
|
if (name && !strcmp(name, METAMOD_PLAPI_NAME))
|
||||||
|
#else
|
||||||
if (name && !strcmp(name, PLAPI_NAME))
|
if (name && !strcmp(name, PLAPI_NAME))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (code)
|
if (code)
|
||||||
{
|
{
|
||||||
@ -277,8 +317,13 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen,
|
|||||||
{
|
{
|
||||||
PLUGIN_SAVEVARS();
|
PLUGIN_SAVEVARS();
|
||||||
|
|
||||||
|
#if !defined METAMOD_PLAPI_VERSION
|
||||||
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#else
|
||||||
|
GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
|
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#endif
|
||||||
|
|
||||||
m_SourceMMLoaded = true;
|
m_SourceMMLoaded = true;
|
||||||
|
|
||||||
@ -389,7 +434,7 @@ bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t max
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Overload a few things to prevent libstdc++ linking */
|
/* Overload a few things to prevent libstdc++ linking */
|
||||||
#if defined __linux__
|
#if defined __linux__ || defined __APPLE__
|
||||||
extern "C" void __cxa_pure_virtual(void)
|
extern "C" void __cxa_pure_virtual(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -414,3 +459,4 @@ void operator delete[](void * ptr)
|
|||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
@ -65,7 +65,7 @@ else
|
|||||||
-I$(MYSQL)/include
|
-I$(MYSQL)/include
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LINK += $(MYSQL)/lib/libmysqlclient_r.a -lz -static-libgcc -lpthread
|
LINK += $(MYSQL)/lib/libmysqlclient_r.a -lz -lpthread
|
||||||
|
|
||||||
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||||
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
|
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
|
||||||
@ -94,7 +94,14 @@ ifeq "$(GCC_VERSION)" "4"
|
|||||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINARY = $(PROJECT).ext.so
|
OS := $(shell uname -s)
|
||||||
|
ifeq "$(OS)" "Darwin"
|
||||||
|
LINK += -dynamiclib
|
||||||
|
BINARY = $(PROJECT).ext.dylib
|
||||||
|
else
|
||||||
|
LINK += -static-libgcc -shared
|
||||||
|
BINARY = $(PROJECT).ext.so
|
||||||
|
endif
|
||||||
|
|
||||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||||
|
|
||||||
@ -117,7 +124,7 @@ check:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
extension: check $(OBJ_LINUX)
|
extension: check $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "smsdk_ext.h"
|
#include "smsdk_ext.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,6 +79,24 @@ IThreader *threader = NULL;
|
|||||||
#if defined SMEXT_ENABLE_LIBSYS
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
ILibrarySys *libsys = NULL;
|
ILibrarySys *libsys = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
SourceMod::IPluginManager *plsys;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
IMenuManager *menus = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
IAdminSystem *adminsys = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
ITextParsers *textparsers = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
IUserMessages *usermsgs = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
ITranslator *translator = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Exports the main interface */
|
/** Exports the main interface */
|
||||||
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
||||||
@ -149,6 +167,24 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
|
|||||||
#if defined SMEXT_ENABLE_LIBSYS
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
SM_GET_IFACE(LIBRARYSYS, libsys);
|
SM_GET_IFACE(LIBRARYSYS, libsys);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
SM_GET_IFACE(PLUGINSYSTEM, plsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
SM_GET_IFACE(MENUMANAGER, menus);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
SM_GET_IFACE(ADMINSYS, adminsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
SM_GET_IFACE(TEXTPARSERS, textparsers);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
SM_GET_IFACE(USERMSGS, usermsgs);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
SM_GET_IFACE(TRANSLATOR, translator);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDK_OnLoad(error, maxlength, late))
|
if (SDK_OnLoad(error, maxlength, late))
|
||||||
{
|
{
|
||||||
@ -256,7 +292,11 @@ IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */
|
|||||||
/** Exposes the extension to Metamod */
|
/** Exposes the extension to Metamod */
|
||||||
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
||||||
{
|
{
|
||||||
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
|
if (name && !strcmp(name, METAMOD_PLAPI_NAME))
|
||||||
|
#else
|
||||||
if (name && !strcmp(name, PLAPI_NAME))
|
if (name && !strcmp(name, PLAPI_NAME))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (code)
|
if (code)
|
||||||
{
|
{
|
||||||
@ -277,8 +317,13 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen,
|
|||||||
{
|
{
|
||||||
PLUGIN_SAVEVARS();
|
PLUGIN_SAVEVARS();
|
||||||
|
|
||||||
|
#if !defined METAMOD_PLAPI_VERSION
|
||||||
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#else
|
||||||
|
GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
|
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#endif
|
||||||
|
|
||||||
m_SourceMMLoaded = true;
|
m_SourceMMLoaded = true;
|
||||||
|
|
||||||
@ -389,7 +434,7 @@ bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t max
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Overload a few things to prevent libstdc++ linking */
|
/* Overload a few things to prevent libstdc++ linking */
|
||||||
#if defined __linux__
|
#if defined __linux__ || defined __APPLE__
|
||||||
extern "C" void __cxa_pure_virtual(void)
|
extern "C" void __cxa_pure_virtual(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -414,3 +459,4 @@ void operator delete[](void * ptr)
|
|||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
@ -60,7 +60,7 @@ else
|
|||||||
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(MMSOURCE17)/core/sourcehook
|
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(MMSOURCE17)/core/sourcehook
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LINK += lib_linux/libpcre.a -static-libgcc
|
LINK += -m32 -ldl -lm
|
||||||
|
|
||||||
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||||
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -mfpmath=sse \
|
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -mfpmath=sse \
|
||||||
@ -83,14 +83,21 @@ ifeq "$(USEMETA)" "true"
|
|||||||
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OS := $(shell uname -s)
|
||||||
|
ifeq "$(OS)" "Darwin"
|
||||||
|
LINK += lib_darwin_x86/libpcre.a -dynamiclib
|
||||||
|
BINARY = $(PROJECT).ext.dylib
|
||||||
|
else
|
||||||
|
LINK += lib_linux/libpcre.a -static-libgcc -shared
|
||||||
|
BINARY = $(PROJECT).ext.so
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
ifeq "$(GCC_VERSION)" "4"
|
ifeq "$(GCC_VERSION)" "4"
|
||||||
CFLAGS += $(C_GCC4_FLAGS)
|
CFLAGS += $(C_GCC4_FLAGS)
|
||||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINARY = $(PROJECT).ext.so
|
|
||||||
|
|
||||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||||
|
|
||||||
$(BIN_DIR)/%.o: %.cpp
|
$(BIN_DIR)/%.o: %.cpp
|
||||||
@ -111,7 +118,7 @@ check:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
extension: check $(OBJ_LINUX)
|
extension: check $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "smsdk_ext.h"
|
#include "smsdk_ext.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,6 +94,9 @@ ITextParsers *textparsers = NULL;
|
|||||||
#if defined SMEXT_ENABLE_USERMSGS
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
IUserMessages *usermsgs = NULL;
|
IUserMessages *usermsgs = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
ITranslator *translator = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Exports the main interface */
|
/** Exports the main interface */
|
||||||
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
||||||
@ -179,6 +182,9 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
|
|||||||
#if defined SMEXT_ENABLE_USERMSGS
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
SM_GET_IFACE(USERMSGS, usermsgs);
|
SM_GET_IFACE(USERMSGS, usermsgs);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
SM_GET_IFACE(TRANSLATOR, translator);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDK_OnLoad(error, maxlength, late))
|
if (SDK_OnLoad(error, maxlength, late))
|
||||||
{
|
{
|
||||||
@ -311,7 +317,7 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen,
|
|||||||
{
|
{
|
||||||
PLUGIN_SAVEVARS();
|
PLUGIN_SAVEVARS();
|
||||||
|
|
||||||
#if defined METAMOD_PLAPI_VERSION
|
#if !defined METAMOD_PLAPI_VERSION
|
||||||
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
#else
|
#else
|
||||||
@ -428,7 +434,7 @@ bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t max
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Overload a few things to prevent libstdc++ linking */
|
/* Overload a few things to prevent libstdc++ linking */
|
||||||
#if defined __linux__
|
#if defined __linux__ || defined __APPLE__
|
||||||
extern "C" void __cxa_pure_virtual(void)
|
extern "C" void __cxa_pure_virtual(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -453,3 +459,4 @@ void operator delete[](void * ptr)
|
|||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
@ -64,7 +64,7 @@ else
|
|||||||
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LINK += -static-libgcc
|
LINK += -m32 -ldl -lm
|
||||||
|
|
||||||
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||||
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
|
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
|
||||||
@ -87,6 +87,15 @@ ifeq "$(USEMETA)" "true"
|
|||||||
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OS := $(shell uname -s)
|
||||||
|
ifeq "$(OS)" "Darwin"
|
||||||
|
LINK += -dynamiclib
|
||||||
|
BINARY = $(PROJECT).ext.dylib
|
||||||
|
else
|
||||||
|
LINK += -static-libgcc -shared
|
||||||
|
BINARY = $(PROJECT).ext.so
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
ifeq "$(GCC_VERSION)" "4"
|
ifeq "$(GCC_VERSION)" "4"
|
||||||
CFLAGS += $(C_GCC4_FLAGS)
|
CFLAGS += $(C_GCC4_FLAGS)
|
||||||
@ -115,7 +124,7 @@ check:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
extension: check $(OBJ_LINUX)
|
extension: check $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#ifndef _INCLUDE_SOURCEMOD_DETOURS_H_
|
#ifndef _INCLUDE_SOURCEMOD_DETOURS_H_
|
||||||
#define _INCLUDE_SOURCEMOD_DETOURS_H_
|
#define _INCLUDE_SOURCEMOD_DETOURS_H_
|
||||||
|
|
||||||
#if defined PLATFORM_LINUX
|
#if defined PLATFORM_POSIX
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#define PAGE_SIZE 4096
|
#define PAGE_SIZE 4096
|
||||||
#define ALIGN(ar) ((long)ar & ~(PAGE_SIZE-1))
|
#define ALIGN(ar) ((long)ar & ~(PAGE_SIZE-1))
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "smsdk_ext.h"
|
#include "smsdk_ext.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,6 +82,21 @@ ILibrarySys *libsys = NULL;
|
|||||||
#if defined SMEXT_ENABLE_PLUGINSYS
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
SourceMod::IPluginManager *plsys;
|
SourceMod::IPluginManager *plsys;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
IMenuManager *menus = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
IAdminSystem *adminsys = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
ITextParsers *textparsers = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
IUserMessages *usermsgs = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
ITranslator *translator = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Exports the main interface */
|
/** Exports the main interface */
|
||||||
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
||||||
@ -155,6 +170,21 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
|
|||||||
#if defined SMEXT_ENABLE_PLUGINSYS
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
SM_GET_IFACE(PLUGINSYSTEM, plsys);
|
SM_GET_IFACE(PLUGINSYSTEM, plsys);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
SM_GET_IFACE(MENUMANAGER, menus);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
SM_GET_IFACE(ADMINSYS, adminsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
SM_GET_IFACE(TEXTPARSERS, textparsers);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
SM_GET_IFACE(USERMSGS, usermsgs);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
SM_GET_IFACE(TRANSLATOR, translator);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDK_OnLoad(error, maxlength, late))
|
if (SDK_OnLoad(error, maxlength, late))
|
||||||
{
|
{
|
||||||
@ -262,7 +292,11 @@ IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */
|
|||||||
/** Exposes the extension to Metamod */
|
/** Exposes the extension to Metamod */
|
||||||
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
||||||
{
|
{
|
||||||
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
if (name && !strcmp(name, METAMOD_PLAPI_NAME))
|
if (name && !strcmp(name, METAMOD_PLAPI_NAME))
|
||||||
|
#else
|
||||||
|
if (name && !strcmp(name, PLAPI_NAME))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (code)
|
if (code)
|
||||||
{
|
{
|
||||||
@ -283,8 +317,13 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen,
|
|||||||
{
|
{
|
||||||
PLUGIN_SAVEVARS();
|
PLUGIN_SAVEVARS();
|
||||||
|
|
||||||
|
#if !defined METAMOD_PLAPI_VERSION
|
||||||
|
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
|
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#else
|
||||||
GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#endif
|
||||||
|
|
||||||
m_SourceMMLoaded = true;
|
m_SourceMMLoaded = true;
|
||||||
|
|
||||||
@ -395,7 +434,7 @@ bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t max
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Overload a few things to prevent libstdc++ linking */
|
/* Overload a few things to prevent libstdc++ linking */
|
||||||
#if defined __linux__
|
#if defined __linux__ || defined __APPLE__
|
||||||
extern "C" void __cxa_pure_virtual(void)
|
extern "C" void __cxa_pure_virtual(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -420,3 +459,4 @@ void operator delete[](void * ptr)
|
|||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
@ -80,7 +80,7 @@ else
|
|||||||
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(MMSOURCE17)/core/sourcehook
|
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(MMSOURCE17)/core/sourcehook
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LINK += -static-libgcc -lpthread
|
LINK += -lpthread -m32 -ldl -lm
|
||||||
|
|
||||||
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||||
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror \
|
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror \
|
||||||
@ -104,14 +104,21 @@ ifeq "$(USEMETA)" "true"
|
|||||||
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OS := $(shell uname -s)
|
||||||
|
ifeq "$(OS)" "Darwin"
|
||||||
|
LINK += -dynamiclib
|
||||||
|
BINARY = $(PROJECT).ext.dylib
|
||||||
|
else
|
||||||
|
LINK += -static-libgcc -shared
|
||||||
|
BINARY = $(PROJECT).ext.so
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
ifeq "$(GCC_VERSION)" "4"
|
ifeq "$(GCC_VERSION)" "4"
|
||||||
CFLAGS += $(C_GCC4_FLAGS)
|
CFLAGS += $(C_GCC4_FLAGS)
|
||||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINARY = $(PROJECT).ext.so
|
|
||||||
|
|
||||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||||
OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o)
|
||||||
|
|
||||||
@ -138,7 +145,7 @@ check:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
extension: check $(OBJ_LINUX)
|
extension: check $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -151,7 +151,7 @@ inline bool IsPathSepChar(char c)
|
|||||||
{
|
{
|
||||||
#if defined PLATFORM_WINDOWS
|
#if defined PLATFORM_WINDOWS
|
||||||
return (c == '\\' || c == '/');
|
return (c == '\\' || c == '/');
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||||
return (c == '/');
|
return (c == '/');
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ bool SqResults::IsNull(unsigned int columnId)
|
|||||||
return (field->type == SQLITE_NULL);
|
return (field->type == SQLITE_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int SqResults::GetDataSize(unsigned int columnId)
|
size_t SqResults::GetDataSize(unsigned int columnId)
|
||||||
{
|
{
|
||||||
SqField *field = GetField(columnId);
|
SqField *field = GetField(columnId);
|
||||||
if (!field)
|
if (!field)
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "sm_memtable.h"
|
#include "sm_memtable.h"
|
||||||
|
|
||||||
BaseMemTable::BaseMemTable(unsigned int init_size)
|
BaseMemTable::BaseMemTable(unsigned int init_size)
|
||||||
|
@ -28,8 +28,9 @@
|
|||||||
*
|
*
|
||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "smsdk_ext.h"
|
#include "smsdk_ext.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,6 +79,24 @@ IThreader *threader = NULL;
|
|||||||
#if defined SMEXT_ENABLE_LIBSYS
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
ILibrarySys *libsys = NULL;
|
ILibrarySys *libsys = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
SourceMod::IPluginManager *plsys;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
IMenuManager *menus = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
IAdminSystem *adminsys = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
ITextParsers *textparsers = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
IUserMessages *usermsgs = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
ITranslator *translator = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Exports the main interface */
|
/** Exports the main interface */
|
||||||
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
||||||
@ -148,6 +167,24 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
|
|||||||
#if defined SMEXT_ENABLE_LIBSYS
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
SM_GET_IFACE(LIBRARYSYS, libsys);
|
SM_GET_IFACE(LIBRARYSYS, libsys);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
SM_GET_IFACE(PLUGINSYSTEM, plsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
SM_GET_IFACE(MENUMANAGER, menus);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
SM_GET_IFACE(ADMINSYS, adminsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
SM_GET_IFACE(TEXTPARSERS, textparsers);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
SM_GET_IFACE(USERMSGS, usermsgs);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
SM_GET_IFACE(TRANSLATOR, translator);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDK_OnLoad(error, maxlength, late))
|
if (SDK_OnLoad(error, maxlength, late))
|
||||||
{
|
{
|
||||||
@ -255,7 +292,11 @@ IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */
|
|||||||
/** Exposes the extension to Metamod */
|
/** Exposes the extension to Metamod */
|
||||||
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
||||||
{
|
{
|
||||||
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
|
if (name && !strcmp(name, METAMOD_PLAPI_NAME))
|
||||||
|
#else
|
||||||
if (name && !strcmp(name, PLAPI_NAME))
|
if (name && !strcmp(name, PLAPI_NAME))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (code)
|
if (code)
|
||||||
{
|
{
|
||||||
@ -276,8 +317,13 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen,
|
|||||||
{
|
{
|
||||||
PLUGIN_SAVEVARS();
|
PLUGIN_SAVEVARS();
|
||||||
|
|
||||||
|
#if !defined METAMOD_PLAPI_VERSION
|
||||||
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#else
|
||||||
|
GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
|
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#endif
|
||||||
|
|
||||||
m_SourceMMLoaded = true;
|
m_SourceMMLoaded = true;
|
||||||
|
|
||||||
@ -388,7 +434,7 @@ bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t max
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Overload a few things to prevent libstdc++ linking */
|
/* Overload a few things to prevent libstdc++ linking */
|
||||||
#if defined __linux__
|
#if defined __linux__ || defined __APPLE__
|
||||||
extern "C" void __cxa_pure_virtual(void)
|
extern "C" void __cxa_pure_virtual(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -413,3 +459,4 @@ void operator delete[](void * ptr)
|
|||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#ifndef _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
#ifndef _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
||||||
#define _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
#define _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
||||||
|
|
||||||
#if defined PLATFORM_LINUX
|
#if defined PLATFORM_POSIX
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#define PAGE_SIZE 4096
|
#define PAGE_SIZE 4096
|
||||||
#define ALIGN(ar) ((long)ar & ~(PAGE_SIZE-1))
|
#define ALIGN(ar) ((long)ar & ~(PAGE_SIZE-1))
|
||||||
@ -52,7 +52,7 @@ struct patch_t
|
|||||||
|
|
||||||
inline void ProtectMemory(void *addr, int length, int prot)
|
inline void ProtectMemory(void *addr, int length, int prot)
|
||||||
{
|
{
|
||||||
#if defined PLATFORM_LINUX
|
#if defined PLATFORM_POSIX
|
||||||
void *addr2 = (void *)ALIGN(addr);
|
void *addr2 = (void *)ALIGN(addr);
|
||||||
mprotect(addr2, sysconf(_SC_PAGESIZE), prot);
|
mprotect(addr2, sysconf(_SC_PAGESIZE), prot);
|
||||||
#elif defined PLATFORM_WINDOWS
|
#elif defined PLATFORM_WINDOWS
|
||||||
|
@ -27,7 +27,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
@ -62,7 +62,7 @@ else
|
|||||||
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LINK += -static-libgcc
|
LINK += -m32 -ldl -lm
|
||||||
|
|
||||||
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||||
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
|
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
|
||||||
@ -85,14 +85,21 @@ ifeq "$(USEMETA)" "true"
|
|||||||
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OS := $(shell uname -s)
|
||||||
|
ifeq "$(OS)" "Darwin"
|
||||||
|
LINK += -dynamiclib
|
||||||
|
BINARY = $(PROJECT).ext.dylib
|
||||||
|
else
|
||||||
|
LINK += -static-libgcc -shared
|
||||||
|
BINARY = $(PROJECT).ext.so
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
ifeq "$(GCC_VERSION)" "4"
|
ifeq "$(GCC_VERSION)" "4"
|
||||||
CFLAGS += $(C_GCC4_FLAGS)
|
CFLAGS += $(C_GCC4_FLAGS)
|
||||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINARY = $(PROJECT).ext.so
|
|
||||||
|
|
||||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||||
|
|
||||||
$(BIN_DIR)/%.o: %.cpp
|
$(BIN_DIR)/%.o: %.cpp
|
||||||
@ -114,7 +121,7 @@ check:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
extension: check $(OBJ_LINUX)
|
extension: check $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "smsdk_ext.h"
|
#include "smsdk_ext.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,9 +79,24 @@ IThreader *threader = NULL;
|
|||||||
#if defined SMEXT_ENABLE_LIBSYS
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
ILibrarySys *libsys = NULL;
|
ILibrarySys *libsys = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
SourceMod::IPluginManager *plsys;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
IMenuManager *menus = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
IAdminSystem *adminsys = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
ITextParsers *textparsers = NULL;
|
||||||
|
#endif
|
||||||
#if defined SMEXT_ENABLE_USERMSGS
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
IUserMessages *usermsgs = NULL;
|
IUserMessages *usermsgs = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
ITranslator *translator = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Exports the main interface */
|
/** Exports the main interface */
|
||||||
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
||||||
@ -152,9 +167,24 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
|
|||||||
#if defined SMEXT_ENABLE_LIBSYS
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
SM_GET_IFACE(LIBRARYSYS, libsys);
|
SM_GET_IFACE(LIBRARYSYS, libsys);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
SM_GET_IFACE(PLUGINSYSTEM, plsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
SM_GET_IFACE(MENUMANAGER, menus);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
SM_GET_IFACE(ADMINSYS, adminsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
SM_GET_IFACE(TEXTPARSERS, textparsers);
|
||||||
|
#endif
|
||||||
#if defined SMEXT_ENABLE_USERMSGS
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
SM_GET_IFACE(USERMSGS, usermsgs);
|
SM_GET_IFACE(USERMSGS, usermsgs);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
SM_GET_IFACE(TRANSLATOR, translator);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDK_OnLoad(error, maxlength, late))
|
if (SDK_OnLoad(error, maxlength, late))
|
||||||
{
|
{
|
||||||
@ -262,7 +292,11 @@ IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */
|
|||||||
/** Exposes the extension to Metamod */
|
/** Exposes the extension to Metamod */
|
||||||
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
||||||
{
|
{
|
||||||
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
if (name && !strcmp(name, METAMOD_PLAPI_NAME))
|
if (name && !strcmp(name, METAMOD_PLAPI_NAME))
|
||||||
|
#else
|
||||||
|
if (name && !strcmp(name, PLAPI_NAME))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (code)
|
if (code)
|
||||||
{
|
{
|
||||||
@ -283,8 +317,13 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen,
|
|||||||
{
|
{
|
||||||
PLUGIN_SAVEVARS();
|
PLUGIN_SAVEVARS();
|
||||||
|
|
||||||
|
#if !defined METAMOD_PLAPI_VERSION
|
||||||
|
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
|
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#else
|
||||||
GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#endif
|
||||||
|
|
||||||
m_SourceMMLoaded = true;
|
m_SourceMMLoaded = true;
|
||||||
|
|
||||||
@ -395,7 +434,7 @@ bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t max
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Overload a few things to prevent libstdc++ linking */
|
/* Overload a few things to prevent libstdc++ linking */
|
||||||
#if defined __linux__
|
#if defined __linux__ || defined __APPLE__
|
||||||
extern "C" void __cxa_pure_virtual(void)
|
extern "C" void __cxa_pure_virtual(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -420,3 +459,4 @@ void operator delete[](void * ptr)
|
|||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
@ -62,7 +62,7 @@ else
|
|||||||
-I$(MMSOURCE17)/core/sourcehook
|
-I$(MMSOURCE17)/core/sourcehook
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LINK += -static-libgcc
|
LINK += -m32 -ldl -lm
|
||||||
|
|
||||||
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||||
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
|
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
|
||||||
@ -85,14 +85,21 @@ ifeq "$(USEMETA)" "true"
|
|||||||
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OS := $(shell uname -s)
|
||||||
|
ifeq "$(OS)" "Darwin"
|
||||||
|
LINK += -dynamiclib
|
||||||
|
BINARY = $(PROJECT).ext.dylib
|
||||||
|
else
|
||||||
|
LINK += -static-libgcc -shared
|
||||||
|
BINARY = $(PROJECT).ext.so
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
ifeq "$(GCC_VERSION)" "4"
|
ifeq "$(GCC_VERSION)" "4"
|
||||||
CFLAGS += $(C_GCC4_FLAGS)
|
CFLAGS += $(C_GCC4_FLAGS)
|
||||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINARY = $(PROJECT).ext.so
|
|
||||||
|
|
||||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||||
|
|
||||||
$(BIN_DIR)/%.o: %.cpp
|
$(BIN_DIR)/%.o: %.cpp
|
||||||
@ -113,7 +120,7 @@ check:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
extension: check $(OBJ_LINUX)
|
extension: check $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "sm_memtable.h"
|
#include "sm_memtable.h"
|
||||||
|
|
||||||
BaseMemTable::BaseMemTable(unsigned int init_size)
|
BaseMemTable::BaseMemTable(unsigned int init_size)
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "smsdk_ext.h"
|
#include "smsdk_ext.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,6 +91,12 @@ IAdminSystem *adminsys = NULL;
|
|||||||
#if defined SMEXT_ENABLE_TEXTPARSERS
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
ITextParsers *textparsers = NULL;
|
ITextParsers *textparsers = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
IUserMessages *usermsgs = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
ITranslator *translator = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Exports the main interface */
|
/** Exports the main interface */
|
||||||
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
||||||
@ -173,6 +179,12 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
|
|||||||
#if defined SMEXT_ENABLE_TEXTPARSERS
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
SM_GET_IFACE(TEXTPARSERS, textparsers);
|
SM_GET_IFACE(TEXTPARSERS, textparsers);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
SM_GET_IFACE(USERMSGS, usermsgs);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
SM_GET_IFACE(TRANSLATOR, translator);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDK_OnLoad(error, maxlength, late))
|
if (SDK_OnLoad(error, maxlength, late))
|
||||||
{
|
{
|
||||||
@ -280,7 +292,11 @@ IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */
|
|||||||
/** Exposes the extension to Metamod */
|
/** Exposes the extension to Metamod */
|
||||||
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
||||||
{
|
{
|
||||||
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
|
if (name && !strcmp(name, METAMOD_PLAPI_NAME))
|
||||||
|
#else
|
||||||
if (name && !strcmp(name, PLAPI_NAME))
|
if (name && !strcmp(name, PLAPI_NAME))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (code)
|
if (code)
|
||||||
{
|
{
|
||||||
@ -301,8 +317,13 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen,
|
|||||||
{
|
{
|
||||||
PLUGIN_SAVEVARS();
|
PLUGIN_SAVEVARS();
|
||||||
|
|
||||||
|
#if !defined METAMOD_PLAPI_VERSION
|
||||||
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#else
|
||||||
|
GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
|
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
#endif
|
||||||
|
|
||||||
m_SourceMMLoaded = true;
|
m_SourceMMLoaded = true;
|
||||||
|
|
||||||
@ -413,7 +434,7 @@ bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t max
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Overload a few things to prevent libstdc++ linking */
|
/* Overload a few things to prevent libstdc++ linking */
|
||||||
#if defined __linux__
|
#if defined __linux__ || defined __APPLE__
|
||||||
extern "C" void __cxa_pure_virtual(void)
|
extern "C" void __cxa_pure_virtual(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -438,3 +459,4 @@ void operator delete[](void * ptr)
|
|||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#if defined linux
|
#if defined linux
|
||||||
#define KE_PLATFORM_LINUX
|
#define KE_PLATFORM_LINUX
|
||||||
|
#elif defined __APPLE__
|
||||||
|
#define KE_PLATFORM_APPLE
|
||||||
#else
|
#else
|
||||||
#error "TODO"
|
#error "TODO"
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,9 +19,9 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
LINK = -static-libgcc
|
LINK = -m32 -ldl -lm
|
||||||
|
|
||||||
INCLUDE = -I$(MMSOURCE17)/core -I$(MMSOURCE17)/core/sourcehook
|
INCLUDE = -I$(MMSOURCE17)/core -I$(MMSOURCE17)/core/sourcehook
|
||||||
|
|
||||||
@ -42,14 +42,21 @@ else
|
|||||||
CFLAGS += $(C_OPT_FLAGS)
|
CFLAGS += $(C_OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OS := $(shell uname -s)
|
||||||
|
ifeq "$(OS)" "Darwin"
|
||||||
|
LINK += -dynamiclib
|
||||||
|
BINARY = $(PROJECT).dylib
|
||||||
|
else
|
||||||
|
LINK += -static-libgcc -shared
|
||||||
|
BINARY = $(PROJECT)_i486.so
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
ifeq "$(GCC_VERSION)" "4"
|
ifeq "$(GCC_VERSION)" "4"
|
||||||
CFLAGS += $(C_GCC4_FLAGS)
|
CFLAGS += $(C_GCC4_FLAGS)
|
||||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINARY = $(PROJECT)_i486.so
|
|
||||||
|
|
||||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||||
|
|
||||||
$(BIN_DIR)/%.o: %.cpp
|
$(BIN_DIR)/%.o: %.cpp
|
||||||
@ -60,7 +67,7 @@ all:
|
|||||||
$(MAKE) -f Makefile loader
|
$(MAKE) -f Makefile loader
|
||||||
|
|
||||||
loader: $(OBJ_LINUX)
|
loader: $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#if defined _MSC_VER
|
#if defined _MSC_VER
|
||||||
#define DLL_EXPORT extern "C" __declspec(dllexport)
|
#define DLL_EXPORT extern "C" __declspec(dllexport)
|
||||||
@ -119,7 +119,7 @@ METAMOD_PLUGIN *_GetPluginPtr(const char *path, int fail_api)
|
|||||||
|
|
||||||
if (!(g_hCore=openlib(path)))
|
if (!(g_hCore=openlib(path)))
|
||||||
{
|
{
|
||||||
#if defined __linux__
|
#if defined __linux__ || defined __APPLE__
|
||||||
UTIL_Format(s_FailPlugin.error_buffer,
|
UTIL_Format(s_FailPlugin.error_buffer,
|
||||||
sizeof(s_FailPlugin.error_buffer),
|
sizeof(s_FailPlugin.error_buffer),
|
||||||
"%s",
|
"%s",
|
||||||
@ -289,7 +289,7 @@ __attribute__((destructor)) static void gcc_fini()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Overload a few things to prevent libstdc++ linking */
|
/* Overload a few things to prevent libstdc++ linking */
|
||||||
#if defined __linux__
|
#if defined __linux__ || defined __APPLE__
|
||||||
extern "C" void __cxa_pure_virtual(void)
|
extern "C" void __cxa_pure_virtual(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
@ -46,7 +46,7 @@ ifeq "$(ENGINE)" "orangebox"
|
|||||||
override ENGSET = true
|
override ENGSET = true
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LINK = vstdlib_i486.so tier0_i486.so -static-libgcc
|
LINK = vstdlib_i486.so tier0_i486.so -m32 -ldl -lm
|
||||||
|
|
||||||
INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
|
INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
|
||||||
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK) -I$(SMSDK)/jit -I$(SMSDK)/jit/x86 \
|
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK) -I$(SMSDK)/jit -I$(SMSDK)/jit/x86 \
|
||||||
@ -69,14 +69,21 @@ else
|
|||||||
CFLAGS += $(C_OPT_FLAGS)
|
CFLAGS += $(C_OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OS := $(shell uname -s)
|
||||||
|
ifeq "$(OS)" "Darwin"
|
||||||
|
LINK += -dynamiclib
|
||||||
|
BINARY = $(PROJECT).dylib
|
||||||
|
else
|
||||||
|
LINK += -static-libgcc -shared
|
||||||
|
BINARY = $(PROJECT)_i486.so
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
ifeq "$(GCC_VERSION)" "4"
|
ifeq "$(GCC_VERSION)" "4"
|
||||||
CFLAGS += $(C_GCC4_FLAGS)
|
CFLAGS += $(C_GCC4_FLAGS)
|
||||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINARY = $(PROJECT)_i486.so
|
|
||||||
|
|
||||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||||
|
|
||||||
$(BIN_DIR)/%.o: %.cpp
|
$(BIN_DIR)/%.o: %.cpp
|
||||||
@ -95,7 +102,7 @@ check:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
mms_ext: check $(OBJ_LINUX)
|
mms_ext: check $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -26,7 +26,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
@ -60,7 +60,7 @@ else
|
|||||||
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LINK += -static-libgcc
|
LINK += -m32 -lm -ldl
|
||||||
|
|
||||||
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||||
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
|
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
|
||||||
@ -83,14 +83,21 @@ ifeq "$(USEMETA)" "true"
|
|||||||
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OS := $(shell uname -s)
|
||||||
|
ifeq "$(OS)" "Darwin"
|
||||||
|
LINK += -dynamiclib
|
||||||
|
BINARY = $(PROJECT).ext.dylib
|
||||||
|
else
|
||||||
|
LINK += -static-libgcc -shared
|
||||||
|
BINARY = $(PROJECT).ext.so
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
ifeq "$(GCC_VERSION)" "4"
|
ifeq "$(GCC_VERSION)" "4"
|
||||||
CFLAGS += $(C_GCC4_FLAGS)
|
CFLAGS += $(C_GCC4_FLAGS)
|
||||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINARY = $(PROJECT).ext.so
|
|
||||||
|
|
||||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||||
|
|
||||||
$(BIN_DIR)/%.o: %.cpp
|
$(BIN_DIR)/%.o: %.cpp
|
||||||
@ -111,7 +118,7 @@ check:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
extension: check $(OBJ_LINUX)
|
extension: check $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "smsdk_ext.h"
|
#include "smsdk_ext.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -434,7 +434,7 @@ bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t max
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Overload a few things to prevent libstdc++ linking */
|
/* Overload a few things to prevent libstdc++ linking */
|
||||||
#if defined __linux__
|
#if defined __linux__ || defined __APPLE__
|
||||||
extern "C" void __cxa_pure_virtual(void)
|
extern "C" void __cxa_pure_virtual(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -459,3 +459,4 @@ void operator delete[](void * ptr)
|
|||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -60,14 +60,21 @@
|
|||||||
#if defined _MSC_VER && _MSC_VER >= 1400
|
#if defined _MSC_VER && _MSC_VER >= 1400
|
||||||
#define SUBPLATFORM_SECURECRT
|
#define SUBPLATFORM_SECURECRT
|
||||||
#endif
|
#endif
|
||||||
#elif defined __linux__
|
#elif defined __linux__ || defined __APPLE__
|
||||||
#define PLATFORM_LINUX
|
#if defined __linux__
|
||||||
|
# define PLATFORM_LINUX
|
||||||
|
#elif defined __APPLE__
|
||||||
|
# define PLATFORM_APPLE
|
||||||
|
#endif
|
||||||
#define PLATFORM_POSIX
|
#define PLATFORM_POSIX
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#if defined PLATFORM_APPLE
|
||||||
|
#include <sys/syslimits.h>
|
||||||
|
#endif
|
||||||
#define PLATFORM_MAX_PATH PATH_MAX
|
#define PLATFORM_MAX_PATH PATH_MAX
|
||||||
#define PLATFORM_LIB_EXT "so"
|
#define PLATFORM_LIB_EXT "so"
|
||||||
#define PLATFORM_SEP_CHAR '/'
|
#define PLATFORM_SEP_CHAR '/'
|
||||||
@ -80,3 +87,4 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_PLATFORM_H_
|
#endif //_INCLUDE_SOURCEMOD_PLATFORM_H_
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
enum NodeType
|
enum NodeType
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
#define SPFILE_VERSION 0x0102 /**< File format version */
|
#define SPFILE_VERSION 0x0102 /**< File format version */
|
||||||
|
|
||||||
//:TODO: better compiler/nix support
|
//:TODO: better compiler/nix support
|
||||||
#if defined __linux__
|
#if defined __GNUC__
|
||||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||||
#else
|
#else
|
||||||
#pragma pack(push)
|
#pragma pack(push)
|
||||||
|
@ -24,7 +24,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing -fomit-fram
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
LINK = -lgcc -static-libgcc
|
LINK = -lgcc -static-libgcc
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ all:
|
|||||||
$(MAKE) -f Makefile compiler
|
$(MAKE) -f Makefile compiler
|
||||||
|
|
||||||
compiler: $(OBJ_LINUX)
|
compiler: $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -ldl -lm -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <malloc.h>
|
|
||||||
#include "sc.h"
|
#include "sc.h"
|
||||||
#include "memfile.h"
|
#include "memfile.h"
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef _INCLUDE_MEMFILE_H
|
#ifndef _INCLUDE_MEMFILE_H
|
||||||
#define _INCLUDE_MEMFILE_H
|
#define _INCLUDE_MEMFILE_H
|
||||||
|
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
typedef struct memfile_s
|
typedef struct memfile_s
|
||||||
{
|
{
|
||||||
|
@ -48,6 +48,8 @@
|
|||||||
|
|
||||||
#if defined __FreeBSD__
|
#if defined __FreeBSD__
|
||||||
#include <sys/endian.h>
|
#include <sys/endian.h>
|
||||||
|
#elif defined __APPLE__
|
||||||
|
#include <machine/endian.h>
|
||||||
#elif defined LINUX
|
#elif defined LINUX
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined __OpenBSD__ || defined __FreeBSD__
|
#if defined __OpenBSD__ || defined __FreeBSD__ || defined __APPLE__
|
||||||
# define __BYTE_ORDER BYTE_ORDER
|
# define __BYTE_ORDER BYTE_ORDER
|
||||||
# define __LITTLE_ENDIAN LITTLE_ENDIAN
|
# define __LITTLE_ENDIAN LITTLE_ENDIAN
|
||||||
# define __BIG_ENDIAN BIG_ENDIAN
|
# define __BIG_ENDIAN BIG_ENDIAN
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "sc.h"
|
#include "sc.h"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "sp_file.h"
|
#include "sp_file.h"
|
||||||
#include "memfile.h"
|
#include "memfile.h"
|
||||||
|
|
||||||
|
@ -42,9 +42,9 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
LINK = -static-libgcc
|
LINK = -m32 -ldl -lm
|
||||||
|
|
||||||
INCLUDE = -I. -I.. -I$(SMSDK)/public -I$(SMSDK)/public/jit -I$(SMSDK)/public/jit/x86 \
|
INCLUDE = -I. -I.. -I$(SMSDK)/public -I$(SMSDK)/public/jit -I$(SMSDK)/public/jit/x86 \
|
||||||
-I$(SMSDK)/public/sourcepawn -I$(MMSOURCE17)/core/sourcehook -I$(SMSDK)/knight/shared -Ix86
|
-I$(SMSDK)/public/sourcepawn -I$(MMSOURCE17)/core/sourcehook -I$(SMSDK)/knight/shared -Ix86
|
||||||
@ -66,14 +66,21 @@ else
|
|||||||
CFLAGS += $(C_OPT_FLAGS)
|
CFLAGS += $(C_OPT_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
OS := $(shell uname -s)
|
||||||
|
ifeq "$(OS)" "Darwin"
|
||||||
|
LINK += -dynamiclib
|
||||||
|
BINARY = $(PROJECT).dylib
|
||||||
|
else
|
||||||
|
LINK += -static-libgcc-shared
|
||||||
|
BINARY = $(PROJECT).so
|
||||||
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
ifeq "$(GCC_VERSION)" "4"
|
ifeq "$(GCC_VERSION)" "4"
|
||||||
CFLAGS += $(C_GCC4_FLAGS)
|
CFLAGS += $(C_GCC4_FLAGS)
|
||||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINARY = $(PROJECT).so
|
|
||||||
|
|
||||||
OBJ_LINUX := $(OBJECTS:../../knight/shared/%.cpp=$(BIN_DIR)/knight/%.o)
|
OBJ_LINUX := $(OBJECTS:../../knight/shared/%.cpp=$(BIN_DIR)/knight/%.o)
|
||||||
OBJ_LINUX := $(OBJ_LINUX:%.cpp=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJ_LINUX:%.cpp=$(BIN_DIR)/%.o)
|
||||||
OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o)
|
||||||
@ -96,7 +103,7 @@ all:
|
|||||||
$(MAKE) -f Makefile jit
|
$(MAKE) -f Makefile jit
|
||||||
|
|
||||||
jit: $(OBJ_LINUX)
|
jit: $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sp_vm_api.h>
|
#include <sp_vm_api.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "x86/jit_x86.h"
|
#include "x86/jit_x86.h"
|
||||||
#include "dll_exports.h"
|
#include "dll_exports.h"
|
||||||
#include "sp_vm_engine.h"
|
#include "sp_vm_engine.h"
|
||||||
@ -48,7 +48,7 @@ EXPORTFUNC ISourcePawnEngine2 *GetSourcePawnEngine2()
|
|||||||
return &g_engine2;
|
return &g_engine2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined __linux__
|
#if defined __linux__ || defined __APPLE__
|
||||||
extern "C" void __cxa_pure_virtual(void)
|
extern "C" void __cxa_pure_virtual(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "sp_vm_types.h"
|
#include "sp_vm_types.h"
|
||||||
@ -111,7 +111,11 @@ void *SourcePawnEngine::ExecAlloc(size_t size)
|
|||||||
#if defined WIN32
|
#if defined WIN32
|
||||||
return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||||
#elif defined __GNUC__
|
#elif defined __GNUC__
|
||||||
|
# if defined __APPLE__
|
||||||
|
void *base = valloc(size);
|
||||||
|
# else
|
||||||
void *base = memalign(sysconf(_SC_PAGESIZE), size);
|
void *base = memalign(sysconf(_SC_PAGESIZE), size);
|
||||||
|
# endif
|
||||||
if (mprotect(base, size, PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
|
if (mprotect(base, size, PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
|
||||||
{
|
{
|
||||||
free(base);
|
free(base);
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "jit_x86.h"
|
#include "jit_x86.h"
|
||||||
#include "opcode_helpers.h"
|
#include "opcode_helpers.h"
|
||||||
#include "x86_macros.h"
|
#include "x86_macros.h"
|
||||||
|
@ -60,19 +60,18 @@ namespace builder
|
|||||||
File.Delete(binpath);
|
File.Delete(binpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
string makefile_args = "";
|
string makefile_args = "CPP=gcc-4.1 ";
|
||||||
|
|
||||||
if (lib.build_mode == BuildMode.BuildMode_Episode1)
|
if (lib.build_mode == BuildMode.BuildMode_Episode1)
|
||||||
{
|
{
|
||||||
makefile_args = null;
|
|
||||||
}
|
}
|
||||||
else if (lib.build_mode == BuildMode.BuildMode_Episode2)
|
else if (lib.build_mode == BuildMode.BuildMode_Episode2)
|
||||||
{
|
{
|
||||||
makefile_args = "ENGINE=\"orangebox\"";
|
makefile_args += "ENGINE=\"orangebox\" ";
|
||||||
}
|
}
|
||||||
else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
|
else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
|
||||||
{
|
{
|
||||||
makefile_args = "ENGINE=\"original\"";
|
makefile_args += "ENGINE=\"original\" ";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clean the project first */
|
/* Clean the project first */
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
g++ -I../../core ../../core/sm_crc32.cpp main.cpp -ocrc32
|
g++ -I../../core ../../core/sm_crc32.cpp main.cpp -o crc32
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
BINARY = smupdated
|
BINARY = smupdated
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ all:
|
|||||||
$(MAKE) -f Makefile sourcemod
|
$(MAKE) -f Makefile sourcemod
|
||||||
|
|
||||||
sourcemod: $(OBJ_LINUX)
|
sourcemod: $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -lstdc++ -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -lstdc++ -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -16,7 +16,7 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
BINARY = gamedatamd5
|
BINARY = gamedatamd5
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ all:
|
|||||||
$(MAKE) -f Makefile sourcemod
|
$(MAKE) -f Makefile sourcemod
|
||||||
|
|
||||||
sourcemod: $(OBJ_LINUX)
|
sourcemod: $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -lstdc++ -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -lstdc++ -o $(BIN_DIR)/$(BINARY)
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$(MAKE) -f Makefile all DEBUG=true
|
$(MAKE) -f Makefile all DEBUG=true
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include "sm_memtable.h"
|
#include "sm_memtable.h"
|
||||||
|
|
||||||
BaseMemTable::BaseMemTable(unsigned int init_size)
|
BaseMemTable::BaseMemTable(unsigned int init_size)
|
||||||
|
Loading…
Reference in New Issue
Block a user