Added support for Mac OS X and building with clang (bug 5601, r=dvander).
This commit is contained in:
parent
b0fe6c83e2
commit
40c1fee55a
@ -153,7 +153,7 @@ void CmdMngr::setCmdLink(CmdLink** a, Command* c, bool sorted)
|
||||
{
|
||||
int i = strcmp(c->getCommand(), (*a)->cmd->getCommand());
|
||||
|
||||
if ((i < 0) || (i == 0) && (strcmp(c->getArgument(), (*a)->cmd->getArgument()) < 0))
|
||||
if ((i < 0) || ((i == 0) && (strcmp(c->getArgument(), (*a)->cmd->getArgument()) < 0)))
|
||||
break;
|
||||
|
||||
a = &(*a)->next;
|
||||
|
@ -144,7 +144,6 @@ public:
|
||||
class CSPForward
|
||||
{
|
||||
friend class CForwardMngr;
|
||||
const char *m_FuncName;
|
||||
int m_NumParams;
|
||||
|
||||
ForwardParam m_ParamTypes[FORWARD_MAX_PARAMS];
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "format.h"
|
||||
#include "amxmod_compat.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#define _snprintf snprintf
|
||||
#endif
|
||||
|
||||
@ -108,7 +108,7 @@ size_t CLangMngr::strip(char *str, char *newstr, bool makelower)
|
||||
int flag = 0;
|
||||
size_t strln = strlen(str);
|
||||
|
||||
for (i = strln - 1; i >= 0; i--)
|
||||
for (i = strln - 1; i < strln; i--)
|
||||
{
|
||||
if (str[i] == '\n' || str[i] == ' ' || str[i] == '\t')
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ void LogEventsMngr::CLogEvent::registerFilter(char* filter)
|
||||
filters = new LogCond(cmp->pos, aa, filters);
|
||||
}
|
||||
|
||||
void LogEventsMngr::setLogString(char* frmt, va_list& vaptr)
|
||||
void LogEventsMngr::setLogString(const char* frmt, va_list& vaptr)
|
||||
{
|
||||
++logCounter;
|
||||
int len = vsnprintf(logString, 255, frmt, vaptr);
|
||||
@ -128,7 +128,7 @@ void LogEventsMngr::setLogString(char* frmt, va_list& vaptr)
|
||||
logArgc = 0;
|
||||
}
|
||||
|
||||
void LogEventsMngr::setLogString(char* frmt, ...)
|
||||
void LogEventsMngr::setLogString(const char* frmt, ...)
|
||||
{
|
||||
++logCounter;
|
||||
va_list logArgPtr;
|
||||
|
@ -141,8 +141,8 @@ public:
|
||||
CLogEvent* registerLogEvent(CPluginMngr::CPlugin* plugin, int func, int pos);
|
||||
inline bool logEventsExist() { return arelogevents; }
|
||||
|
||||
void setLogString(char* frmt, va_list& vaptr);
|
||||
void setLogString(char* frmt, ...);
|
||||
void setLogString(const char* frmt, va_list& vaptr);
|
||||
void setLogString(const char* frmt, ...);
|
||||
void parseLogString();
|
||||
void executeLogEvents();
|
||||
|
||||
|
@ -342,7 +342,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
m_AuthData[sizeof(m_AuthData)-1]=0;
|
||||
m_AuthData[arraysize(m_AuthData)-1]=0;
|
||||
|
||||
};
|
||||
const cell *GetAuthID(void) const
|
||||
@ -361,7 +361,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
m_Password[sizeof(m_Password)-1]=0;
|
||||
m_Password[arraysize(m_Password)-1]=0;
|
||||
|
||||
};
|
||||
const cell *GetPass(void) const
|
||||
|
@ -220,7 +220,7 @@ bool CModule::queryModule()
|
||||
m_Handle = DLLOAD(m_Filename.c_str()); // load file
|
||||
if (!m_Handle)
|
||||
{
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
AMXXLOG_Log("[AMXX] Module \"%s\" failed to load (%s)", m_Filename.c_str(), dlerror());
|
||||
#endif
|
||||
m_Status = MODULE_BADLOAD;
|
||||
|
@ -244,7 +244,7 @@ public:
|
||||
|
||||
if (is_space(v[len-1]))
|
||||
{
|
||||
for (i=len-1; i>=0; i--)
|
||||
for (i=len-1; i<len; i--)
|
||||
{
|
||||
if (!is_space(v[i])
|
||||
|| (is_space(v[i]) && i==0))
|
||||
|
179
amxmodx/Makefile
179
amxmodx/Makefile
@ -1,120 +1,147 @@
|
||||
#(C)2004-2005 AMX Mod X Development Team
|
||||
# (C)2004-2013 AMX Mod X Development Team
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
HLSDK = ../../hlsdk
|
||||
###########################################
|
||||
### EDIT THESE PATHS FOR YOUR OWN SETUP ###
|
||||
###########################################
|
||||
|
||||
HLSDK = ../../hlsdk/multiplayer
|
||||
MM_ROOT = ../../metamod/metamod
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
#####################################
|
||||
|
||||
OPT_FLAGS = -O2 -fno-strict-aliasing -funroll-loops -s -fomit-frame-pointer -pipe -DNDEBUG
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc-4.1
|
||||
NAME = amxmodx
|
||||
|
||||
BIN_SUFFIX_32 = mm_i386.so
|
||||
BIN_SUFFIX_64 = mm_amd64.so
|
||||
PROJECT = amxmodx
|
||||
|
||||
OBJECTS = meta_api.cpp CFile.cpp CVault.cpp vault.cpp float.cpp file.cpp modules.cpp \
|
||||
CMisc.cpp CTask.cpp string.cpp amxmodx.cpp CEvent.cpp CCmd.cpp CLogEvent.cpp \
|
||||
srvcmd.cpp strptime.cpp amxcore.cpp amxtime.cpp power.cpp amxxlog.cpp fakemeta.cpp \
|
||||
amxxfile.cpp CLang.cpp md5.cpp emsg.cpp CForward.cpp CPlugin.cpp CModule.cpp \
|
||||
CMenu.cpp util.cpp amx.cpp amxdbg.cpp natives.cpp newmenus.cpp debugger.cpp \
|
||||
optimizer.cpp format.cpp messages.cpp libraries.cpp vector.cpp sorting.cpp \
|
||||
amxmod_compat.cpp nongpl_matches.cpp CFlagManager.cpp datastructs.cpp \
|
||||
trie_natives.cpp
|
||||
CMisc.cpp CTask.cpp string.cpp amxmodx.cpp CEvent.cpp CCmd.cpp CLogEvent.cpp \
|
||||
srvcmd.cpp strptime.cpp amxcore.cpp amxtime.cpp power.cpp amxxlog.cpp fakemeta.cpp \
|
||||
amxxfile.cpp CLang.cpp md5.cpp emsg.cpp CForward.cpp CPlugin.cpp CModule.cpp \
|
||||
CMenu.cpp util.cpp amx.cpp amxdbg.cpp natives.cpp newmenus.cpp debugger.cpp \
|
||||
optimizer.cpp format.cpp messages.cpp libraries.cpp vector.cpp sorting.cpp \
|
||||
amxmod_compat.cpp nongpl_matches.cpp CFlagManager.cpp datastructs.cpp \
|
||||
trie_natives.cpp
|
||||
|
||||
LINK = -lgcc -static-libgcc
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
##############################################
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT) -Lzlib -I$(HLSDK)/common
|
||||
C_OPT_FLAGS = -DNDEBUG -O2 -funroll-loops -fomit-frame-pointer -pipe
|
||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||
C_GCC4_FLAGS = -fvisibility=hidden
|
||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||
CPP = gcc
|
||||
CPP_OSX = clang
|
||||
|
||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
LINK = -Lzlib
|
||||
|
||||
ifeq "$(GCC_VERSION)" "4"
|
||||
OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT)
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
################################################
|
||||
|
||||
OS := $(shell uname -s)
|
||||
|
||||
ifeq "$(OS)" "Darwin"
|
||||
OBJECTS += JIT/amxexecn-darwin.o JIT/amxjitsn-darwin.o JIT/natives-darwin-x86.o \
|
||||
JIT/helpers-darwin-x86.o
|
||||
|
||||
CPP = $(CPP_OSX)
|
||||
LIB_EXT = dylib
|
||||
LIB_SUFFIX = _mm
|
||||
CFLAGS += -DOSX
|
||||
LINK += -dynamiclib -lstdc++ -mmacosx-version-min=10.5 -Wl,-read_only_relocs,suppress -lz-darwin
|
||||
else
|
||||
OBJECTS += JIT/amxexecn.o JIT/amxjitsn.o JIT/natives-x86.o JIT/helpers-x86.o
|
||||
|
||||
LIB_EXT = so
|
||||
LIB_SUFFIX = _mm_i386
|
||||
CFLAGS += -DLINUX
|
||||
LINK += -shared -lz
|
||||
endif
|
||||
|
||||
LINK += -m32 -lm -ldl
|
||||
|
||||
CFLAGS += -DAMX_NOPROPLIST -DPAWN_CELL_SIZE=32 -DJIT -DASM32 -DHAVE_STDINT_H -fno-strict-aliasing \
|
||||
-m32 -Wall -Werror
|
||||
CPPFLAGS += -fno-exceptions -fno-rtti
|
||||
|
||||
BINARY = $(PROJECT)$(LIB_SUFFIX).$(LIB_EXT)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
BIN_DIR = Debug
|
||||
CFLAGS = $(DEBUG_FLAGS)
|
||||
CFLAGS += $(C_DEBUG_FLAGS)
|
||||
else
|
||||
BIN_DIR = Release
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
CFLAGS += $(C_OPT_FLAGS)
|
||||
LINK += -s
|
||||
endif
|
||||
|
||||
ifeq "$(BINLOG)" "true"
|
||||
NAME := $(NAME)_bl
|
||||
LIB_SUFFIX := _bl$(LIB_SUFFIX)
|
||||
BIN_DIR := $(BIN_DIR)BinLog
|
||||
OBJECTS += binlog.cpp
|
||||
CFLAGS += -DBINLOG_ENABLED
|
||||
endif
|
||||
|
||||
CFLAGS += -DLINUX -DAMX_NOPROPLIST -Wall -Werror -DHAVE_STDINT_H -static-libgcc -fno-rtti -fno-exceptions
|
||||
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -DAMD64 -m64
|
||||
LINK += -lz64
|
||||
OBJECTS += JIT/natives-amd64.o
|
||||
ifeq "$(IS_CLANG)" "1"
|
||||
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
|
||||
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
|
||||
else
|
||||
BINARY = $(NAME)_$(BIN_SUFFIX_32)
|
||||
OBJECTS += JIT/amxexecn.o JIT/amxjitsn.o JIT/natives-x86.o
|
||||
OBJECTS += JIT/helpers-x86.o
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
LINK += -lz
|
||||
OPT_FLAGS += -march=i586
|
||||
CFLAGS += -m32
|
||||
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
|
||||
endif
|
||||
|
||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
# Clang || GCC >= 4
|
||||
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
|
||||
CFLAGS += $(C_GCC4_FLAGS)
|
||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||
endif
|
||||
|
||||
# Clang >= 3 || GCC >= 4.7
|
||||
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
|
||||
CFLAGS += -Wno-delete-non-virtual-dtor
|
||||
endif
|
||||
|
||||
# OS is Linux and not using clang
|
||||
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
|
||||
LINK += -static-libgcc
|
||||
endif
|
||||
|
||||
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
|
||||
# This will break if we include other Makefiles, but is fine for now. It allows
|
||||
# us to make a copy of this file that uses altered paths (ie. Makefile.mine)
|
||||
# or other changes without mucking up the original.
|
||||
MAKEFILE_NAME := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
|
||||
$(BIN_DIR)/%.o: %.cpp
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
$(MAKE) amxmodx
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
amd64:
|
||||
rm -f zlib/libz.a
|
||||
$(MAKE) all AMD64=true
|
||||
|
||||
amd64_debug:
|
||||
rm -f zlib/libz.a
|
||||
$(MAKE) all AMD64=true DEBUG=true
|
||||
|
||||
amd64_binlog:
|
||||
rm -f zlib/libz.a
|
||||
$(MAKE) all AMD64=true BINLOG=true
|
||||
|
||||
amd64_binlog_debug:
|
||||
rm -f zlib/libz.a
|
||||
$(MAKE) all AMD64=true BINLOG=true DEBUG=true
|
||||
|
||||
binlog:
|
||||
$(MAKE) all BINLOG=true
|
||||
|
||||
$(MAKE) -f $(MAKEFILE_NAME) all BINLOG=true
|
||||
|
||||
binlog_debug:
|
||||
$(MAKE) all BINLOG=true DEBUG=true
|
||||
$(MAKE) -f $(MAKEFILE_NAME) all BINLOG=true DEBUG=true
|
||||
|
||||
amxmodx: $(OBJ_LINUX)
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||
|
||||
debug:
|
||||
$(MAKE) all DEBUG=true
|
||||
debug:
|
||||
$(MAKE) -f $(MAKEFILE_NAME) all DEBUG=true
|
||||
|
||||
default: all
|
||||
|
||||
clean:
|
||||
rm -rf Release/*.o
|
||||
rm -rf Release/$(NAME)_$(BIN_SUFFIX_32)
|
||||
rm -rf Release/$(NAME)_$(BIN_SUFFIX_64)
|
||||
rm -rf ReleaseBinLog/*.o
|
||||
rm -rf ReleaseBinLog/$(NAME)_bl_$(BIN_SUFFIX_32)
|
||||
rm -rf ReleaseBinLog/$(NAME)_bl_$(BIN_SUFFIX_64)
|
||||
rm -rf Debug/*.o
|
||||
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_32)
|
||||
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_64)
|
||||
rm -rf DebugBinLog/*.o
|
||||
rm -rf DebugBinLog/$(NAME)_bl_$(BIN_SUFFIX_32)
|
||||
rm -rf DebugBinLog/$(NAME)_bl_$(BIN_SUFFIX_64)
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "osdefs.h"
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
#include <sclinux.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
@ -436,7 +436,7 @@ int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params)
|
||||
hdr=(AMX_HEADER *)amx->base;
|
||||
assert(hdr->natives<=hdr->libraries);
|
||||
#if defined AMX_NATIVETABLE
|
||||
if (index<NULL) {
|
||||
if (index<0) {
|
||||
assert(-(index+1)<(sizeof(AMX_NATIVETABLE)/sizeof(AMX_NATIVETABLE)[0]));
|
||||
f=(AMX_NATIVETABLE)[-(index+1)];
|
||||
} else {
|
||||
@ -932,7 +932,7 @@ int AMXAPI amx_Init(AMX *amx, void *program)
|
||||
|
||||
#define ALIGN(addr) (addr)
|
||||
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
|
||||
/* Linux already has mprotect() */
|
||||
/* But wants the address aligned! */
|
||||
@ -1014,10 +1014,10 @@ int AMXAPI amx_InitJIT(AMX *amx,void *compiled_program,void *reloc_table)
|
||||
#if defined AMX_CLEANUP
|
||||
int AMXAPI amx_Cleanup(AMX *amx)
|
||||
{
|
||||
#if (defined _Windows || defined LINUX || defined __FreeBSD__ || defined __OpenBSD__) && !defined AMX_NODYNALOAD
|
||||
#if (defined _Windows || defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__) && !defined AMX_NODYNALOAD
|
||||
#if defined _Windows
|
||||
typedef int (FAR WINAPI *AMX_ENTRY)(AMX FAR *amx);
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
typedef int (*AMX_ENTRY)(AMX *amx);
|
||||
#endif
|
||||
AMX_HEADER *hdr;
|
||||
@ -1027,7 +1027,7 @@ int AMXAPI amx_Cleanup(AMX *amx)
|
||||
#endif
|
||||
|
||||
/* unload all extension modules */
|
||||
#if (defined _Windows || defined LINUX || defined __FreeBSD__ || defined __OpenBSD__) && !defined AMX_NODYNALOAD
|
||||
#if (defined _Windows || defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__) && !defined AMX_NODYNALOAD
|
||||
hdr=(AMX_HEADER *)amx->base;
|
||||
assert(hdr->magic==AMX_MAGIC);
|
||||
numlibraries=NUMENTRIES(hdr,libraries,pubvars);
|
||||
@ -1040,14 +1040,14 @@ int AMXAPI amx_Cleanup(AMX *amx)
|
||||
strcat(funcname,"Cleanup");
|
||||
#if defined _Windows
|
||||
libcleanup=(AMX_ENTRY)GetProcAddress((HINSTANCE)lib->address,funcname);
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
libcleanup=(AMX_ENTRY)dlsym((void*)lib->address,funcname);
|
||||
#endif
|
||||
if (libcleanup!=NULL)
|
||||
libcleanup(amx);
|
||||
#if defined _Windows
|
||||
FreeLibrary((HINSTANCE)lib->address);
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
dlclose((void*)lib->address);
|
||||
#endif
|
||||
} /* if */
|
||||
@ -3695,7 +3695,7 @@ int AMXAPI amx_GetAddr(AMX *amx,cell amx_addr,cell **phys_addr)
|
||||
data=(amx->data!=NULL) ? amx->data : amx->base+(int)hdr->dat;
|
||||
|
||||
assert(phys_addr!=NULL);
|
||||
if (amx_addr>=amx->hea && amx_addr<amx->stk || amx_addr<0 || amx_addr>=amx->stp) {
|
||||
if ((amx_addr>=amx->hea && amx_addr<amx->stk) || amx_addr<0 || amx_addr>=amx->stp) {
|
||||
*phys_addr=NULL;
|
||||
return AMX_ERR_MEMACCESS;
|
||||
} /* if */
|
||||
@ -4094,7 +4094,7 @@ int AMXAPI amx_GetLibraries(AMX *amx)
|
||||
return numLibraries;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#define _snprintf snprintf
|
||||
#endif
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
#if defined FREEBSD && !defined __FreeBSD__
|
||||
#define __FreeBSD__
|
||||
#endif
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
#include <sclinux.h>
|
||||
#endif
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
#if defined HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX || defined __APPLE__
|
||||
#if defined HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
@ -190,7 +190,7 @@ typedef int (AMXAPI *AMX_NATIVE_FILTER)(struct tagAMX *amx, int index);
|
||||
#endif
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=mac68k
|
||||
@ -442,7 +442,7 @@ int AMXAPI amx_GetStringOld(char *dest,const cell *source,int use_wchar);
|
||||
amx_Register((amx), amx_NativeInfo((name),(func)), 1);
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack() /* reset default packing */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=reset
|
||||
|
@ -180,7 +180,7 @@ static cell AMX_NATIVE_CALL setarg(AMX *amx, cell *params)
|
||||
/* adjust the address in "value" in case of an array access */
|
||||
value+=params[2]*sizeof(cell);
|
||||
/* verify the address */
|
||||
if (value<0 || value>=amx->hea && value<amx->stk)
|
||||
if (value<0 || (value>=amx->hea && value<amx->stk))
|
||||
return 0;
|
||||
/* set the value indirectly */
|
||||
* (cell *)(data+(int)value) = params[3];
|
||||
|
@ -462,8 +462,8 @@ int AMXAPI dbg_GetVariable(AMX_DBG *amxdbg, const char *symname, ucell scopeaddr
|
||||
break;
|
||||
/* check the range, keep a pointer to the symbol with the smallest range */
|
||||
if (strcmp(amxdbg->symboltbl[index]->name, symname) == 0
|
||||
&& (codestart == 0 && codeend == 0
|
||||
|| amxdbg->symboltbl[index]->codestart >= codestart && amxdbg->symboltbl[index]->codeend <= codeend))
|
||||
&& ((codestart == 0 && codeend == 0)
|
||||
|| (amxdbg->symboltbl[index]->codestart >= codestart && amxdbg->symboltbl[index]->codeend <= codeend)))
|
||||
{
|
||||
*sym = amxdbg->symboltbl[index];
|
||||
codestart = amxdbg->symboltbl[index]->codestart;
|
||||
|
@ -49,7 +49,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=mac68k
|
||||
@ -156,7 +156,7 @@ int AMXAPI dbg_GetArrayDim(AMX_DBG *amxdbg, const AMX_DBG_SYMBOL *sym, const AMX
|
||||
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack() /* reset default packing */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=reset
|
||||
|
@ -303,14 +303,6 @@
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
|
||||
%ifdef WIN32
|
||||
section .data exec
|
||||
%else
|
||||
section .text
|
||||
%endif
|
||||
|
||||
|
||||
global asm_runJIT, _asm_runJIT
|
||||
global amx_exec_jit, _amx_exec_jit
|
||||
global getMaxCodeSize, _getMaxCodeSize
|
||||
@ -436,15 +428,6 @@ reloc_done:
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
; GWMV:
|
||||
; The code below modifies itself to store the arguments to the Pawn opcodes
|
||||
; in the compiled code. This is fine, but the .text section in an ELF executable
|
||||
; is usually marked read-only, that's why this code is in the .data section.
|
||||
|
||||
%ifndef WIN32
|
||||
section .data exec
|
||||
%endif
|
||||
|
||||
OP_LOAD_PRI:
|
||||
;nop;
|
||||
putval j_load_pri+2
|
||||
@ -1052,7 +1035,7 @@ OP_CALL:
|
||||
j_call:
|
||||
;call 12345678h ; tasm chokes on this out of a sudden
|
||||
_PUSH 0
|
||||
j_call_e8
|
||||
j_call_e8:
|
||||
db 0e8h, 0, 0, 0, 0
|
||||
CHECKCODESIZE j_call
|
||||
|
||||
@ -2591,4 +2574,4 @@ _amx_opcodelist_jit:
|
||||
DD OP_FLOAT_ROUND ; DA
|
||||
DD OP_FLOAT_CMP ; DA
|
||||
|
||||
END
|
||||
END:
|
||||
|
@ -146,7 +146,7 @@ static cell AMX_NATIVE_CALL server_print(AMX *amx, cell *params) /* 1 param */
|
||||
|
||||
static cell AMX_NATIVE_CALL engclient_print(AMX *amx, cell *params) /* 3 param */
|
||||
{
|
||||
int len;
|
||||
int len = 0;
|
||||
char *msg;
|
||||
|
||||
if (params[1] == 0)
|
||||
@ -481,7 +481,7 @@ static cell AMX_NATIVE_CALL is_dedicated_server(AMX *amx, cell *params)
|
||||
|
||||
static cell AMX_NATIVE_CALL is_linux_server(AMX *amx, cell *params)
|
||||
{
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
@ -1005,7 +1005,7 @@ static cell AMX_NATIVE_CALL get_user_team(AMX *amx, cell *params) /* 3 param */
|
||||
|
||||
if (params[3])
|
||||
{
|
||||
char *szTeam = "";
|
||||
const char *szTeam = "";
|
||||
|
||||
switch (iTeam)
|
||||
{
|
||||
@ -3843,7 +3843,7 @@ static cell AMX_NATIVE_CALL amx_mkdir(AMX *amx, cell *params)
|
||||
char *path = get_amxstring(amx, params[1], 0, len);
|
||||
char *realpath = build_pathname("%s", path);
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
return mkdir(realpath, 0700);
|
||||
#else
|
||||
return mkdir(realpath);
|
||||
|
@ -32,7 +32,7 @@
|
||||
#ifndef AMXMODX_H
|
||||
#define AMXMODX_H
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include "sclinux.h"
|
||||
@ -86,7 +86,7 @@ extern AMX_NATIVE_INFO vector_Natives[];
|
||||
extern AMX_NATIVE_INFO g_SortNatives[];
|
||||
extern AMX_NATIVE_INFO g_DataStructNatives[];
|
||||
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
#define DLLOAD(path) (DLHANDLE)LoadLibrary(path)
|
||||
#define DLPROC(m, func) GetProcAddress(m, func)
|
||||
#define DLFREE(m) FreeLibrary(m)
|
||||
@ -107,14 +107,14 @@ extern AMX_NATIVE_INFO g_DataStructNatives[];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
typedef HINSTANCE DLHANDLE;
|
||||
#else
|
||||
typedef void* DLHANDLE;
|
||||
#define INFINITE 0xFFFFFFFF
|
||||
#endif
|
||||
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
#define PATH_SEP_CHAR '\\'
|
||||
#define ALT_SEP_CHAR '/'
|
||||
#else
|
||||
@ -139,7 +139,7 @@ int UTIL_ReadFlags(const char* c);
|
||||
void UTIL_ClientPrint(edict_t *pEntity, int msg_dest, char *msg);
|
||||
void UTIL_FakeClientCommand(edict_t *pEdict, const char *cmd, const char *arg1 = NULL, const char *arg2 = NULL);
|
||||
void UTIL_GetFlags(char* flags, int flag);
|
||||
void UTIL_HudMessage(edict_t *pEntity, const hudtextparms_t &textparms, char *pMessage);
|
||||
void UTIL_HudMessage(edict_t *pEntity, const hudtextparms_t &textparms, const char *pMessage);
|
||||
void UTIL_IntToString(int value, char *output);
|
||||
void UTIL_ShowMOTD(edict_t *client, char *motd, int mlen, const char *name);
|
||||
void UTIL_ShowMenu(edict_t* pEntity, int slots, int time, char *menu, int mlen);
|
||||
@ -276,8 +276,8 @@ void modules_callPluginsUnloaded();
|
||||
void modules_callPluginsUnloading();
|
||||
|
||||
cell* get_amxaddr(AMX *amx, cell amx_addr);
|
||||
char* build_pathname(char *fmt, ...);
|
||||
char* build_pathname_r(char *buffer, size_t maxlen, char *fmt, ...);
|
||||
char* build_pathname(const char *fmt, ...);
|
||||
char* build_pathname_r(char *buffer, size_t maxlen, const char *fmt, ...);
|
||||
char* format_amxstring(AMX *amx, cell *params, int parm, int& len);
|
||||
AMX* get_amxscript(int, void**, const char**);
|
||||
const char* get_amxscriptname(AMX* amx);
|
||||
@ -292,8 +292,8 @@ int unload_amxscript(AMX* amx, void** program);
|
||||
|
||||
void copy_amxmemory(cell* dest, cell* src, int len);
|
||||
void get_modname(char*);
|
||||
void print_srvconsole(char *fmt, ...);
|
||||
void report_error(int code, char* fmt, ...);
|
||||
void print_srvconsole(const char *fmt, ...);
|
||||
void report_error(int code, const char* fmt, ...);
|
||||
void* alloc_amxmemory(void**, int size);
|
||||
void free_amxmemory(void **ptr);
|
||||
// get_localinfo
|
||||
|
@ -42,7 +42,7 @@
|
||||
#define PACKED
|
||||
#endif
|
||||
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||
#else
|
||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||
@ -127,7 +127,7 @@ CAmxxReader::CAmxxReader(const char *filename, int cellsize)
|
||||
|
||||
for (mint8_t i = 0; i < m_Bh.numPlugins; i++)
|
||||
{
|
||||
pe = &(m_Bh.plugins[i]);
|
||||
pe = &(m_Bh.plugins[(unsigned)i]);
|
||||
DATAREAD(&pe->cellsize, sizeof(mint8_t), 1);
|
||||
DATAREAD(&pe->disksize, sizeof(int32_t), 1);
|
||||
DATAREAD(&pe->imagesize, sizeof(int32_t), 1);
|
||||
@ -137,7 +137,7 @@ CAmxxReader::CAmxxReader(const char *filename, int cellsize)
|
||||
|
||||
for (mint8_t i = 0; i < m_Bh.numPlugins; i++)
|
||||
{
|
||||
pe = &(m_Bh.plugins[i]);
|
||||
pe = &(m_Bh.plugins[(unsigned)i]);
|
||||
|
||||
if (pe->cellsize == m_CellSize)
|
||||
{
|
||||
|
@ -35,12 +35,12 @@
|
||||
// 3 = HL Logs
|
||||
|
||||
#include <time.h>
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include "amxmodx.h"
|
||||
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32WIN32)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
|
||||
@ -137,7 +137,7 @@ void CLog::MapChange()
|
||||
{
|
||||
// create dir if not existing
|
||||
char file[256];
|
||||
#ifdef __linux
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
mkdir(build_pathname_r(file, sizeof(file)-1, "%s", g_log_dir.c_str()), 0700);
|
||||
#else
|
||||
mkdir(build_pathname_r(file, sizeof(file)-1, "%s", g_log_dir.c_str()));
|
||||
|
@ -46,7 +46,7 @@ bool BinLog::Open()
|
||||
if (!DirExists(path))
|
||||
{
|
||||
mkdir(path
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
, 0755
|
||||
#endif
|
||||
);
|
||||
|
@ -215,8 +215,7 @@ public:
|
||||
int ShiftUpFrom(size_t which)
|
||||
{
|
||||
// No point shifting this.
|
||||
if (this->count < 0 ||
|
||||
which > this->count)
|
||||
if (which > this->count)
|
||||
{
|
||||
|
||||
return 0;
|
||||
@ -254,8 +253,7 @@ public:
|
||||
int Delete(size_t which)
|
||||
{
|
||||
// No point shifting this.
|
||||
if (this->count < 0 ||
|
||||
which >= this->count)
|
||||
if (which >= this->count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -614,9 +614,9 @@ void Debugger::FmtGenericMsg(AMX *amx, int error, char buffer[], size_t maxLengt
|
||||
if (a)
|
||||
filename = (*a).getName();
|
||||
size_t len = strlen(filename);
|
||||
for (size_t i=len-1; i>=0; i--)
|
||||
for (size_t i=len-1; i<len; i--)
|
||||
{
|
||||
if (filename[i] == '/' || filename[i] == '\\' && i != len - 1)
|
||||
if ((filename[i] == '/' || filename[i] == '\\') && i != len - 1)
|
||||
{
|
||||
filename = &(filename[i+1]);
|
||||
break;
|
||||
|
@ -43,7 +43,7 @@
|
||||
#endif
|
||||
|
||||
// header file for unlink()
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#define WINDOWS_LEAN_AND_MEAN
|
||||
@ -784,7 +784,7 @@ static cell AMX_NATIVE_CALL amx_ungetc(AMX *amx, cell *params)
|
||||
return ungetc(static_cast<int>(params[2]), fp);
|
||||
}
|
||||
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#define _rmdir rmdir
|
||||
#endif
|
||||
|
||||
@ -817,7 +817,7 @@ static cell AMX_NATIVE_CALL amx_rename(AMX *amx, cell *params)
|
||||
snprintf(f_new_r, sizeof(f_new_r)-1, "%s", fnew);
|
||||
}
|
||||
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
return (rename(f_old_r, f_new_r) == 0);
|
||||
#elif defined WIN32
|
||||
return MoveFileA(f_old_r, f_new_r);
|
||||
|
@ -29,6 +29,11 @@
|
||||
return 0; \
|
||||
}
|
||||
|
||||
template size_t atcprintf<cell, cell>(cell *, size_t, const cell *, AMX *, cell *, int *);
|
||||
template size_t atcprintf<char, cell>(char *, size_t, const cell *, AMX *, cell *, int *);
|
||||
template size_t atcprintf<cell, char>(cell *, size_t, const char *, AMX *, cell *, int *);
|
||||
template size_t atcprintf<char, char>(char *, size_t, const char *, AMX *, cell *, int *);
|
||||
|
||||
THash<String, lang_err> BadLang_Table;
|
||||
|
||||
static cvar_t *amx_mldebug = NULL;
|
||||
|
@ -43,7 +43,7 @@ _amxx_CpuSupport:
|
||||
.fail:
|
||||
xor eax, eax
|
||||
|
||||
.end
|
||||
.end:
|
||||
|
||||
pop ebx
|
||||
|
||||
|
@ -185,7 +185,7 @@ unsigned char *MD5::raw_digest(){
|
||||
|
||||
|
||||
|
||||
char *MD5::hex_digest(){
|
||||
const char *MD5::hex_digest(){
|
||||
|
||||
int i;
|
||||
char *s= new char[33];
|
||||
@ -205,7 +205,7 @@ char *MD5::hex_digest(){
|
||||
}
|
||||
|
||||
|
||||
char *MD5::hex_digest(char buffer[33]){
|
||||
const char *MD5::hex_digest(char buffer[33]){
|
||||
|
||||
int i;
|
||||
|
||||
|
@ -59,8 +59,8 @@ public:
|
||||
|
||||
// methods to acquire finalized result
|
||||
unsigned char *raw_digest (); // digest as a 16-byte binary array
|
||||
char * hex_digest (); // digest as a 33-byte ascii-hex string
|
||||
char * hex_digest (char buffer[33]); //same as above, passing buffer
|
||||
const char *hex_digest (); // digest as a 33-byte ascii-hex string
|
||||
const char *hex_digest (char buffer[33]); //same as above, passing buffer
|
||||
|
||||
|
||||
|
||||
|
@ -198,7 +198,7 @@ void BuildPluginFileList(const char *initialdir, CStack<String *> & files)
|
||||
}
|
||||
|
||||
_findclose(handle);
|
||||
#elif defined __linux__
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
build_pathname_r(path, sizeof(path)-1, "%s/", initialdir);
|
||||
struct dirent *ep;
|
||||
DIR *dp;
|
||||
@ -254,7 +254,7 @@ void LoadExtraPluginsFromDir(const char *initialdir)
|
||||
|
||||
// Precache stuff from force consistency calls
|
||||
// or check for pointed files won't be done
|
||||
int C_PrecacheModel(char *s)
|
||||
int C_PrecacheModel(const char *s)
|
||||
{
|
||||
if (!g_forcedmodules)
|
||||
{
|
||||
@ -269,7 +269,7 @@ int C_PrecacheModel(char *s)
|
||||
RETURN_META_VALUE(MRES_IGNORED, 0);
|
||||
}
|
||||
|
||||
int C_PrecacheSound(char *s)
|
||||
int C_PrecacheSound(const char *s)
|
||||
{
|
||||
if (!g_forcedsounds)
|
||||
{
|
||||
@ -731,7 +731,7 @@ void C_ServerDeactivate_Post()
|
||||
time(&td);
|
||||
tm *curTime = localtime(&td);
|
||||
int i = 0;
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxmodx")), 0700);
|
||||
#else
|
||||
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxmodx")));
|
||||
@ -740,7 +740,7 @@ void C_ServerDeactivate_Post()
|
||||
{
|
||||
char buffer[256];
|
||||
sprintf(buffer, "%s/memreports/D%02d%02d%03d", get_localinfo("amxx_basedir", "addons/amxmodx"), curTime->tm_mon + 1, curTime->tm_mday, i);
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
mkdir(build_pathname("%s", g_log_dir.c_str()), 0700);
|
||||
if (mkdir(build_pathname(buffer), 0700) < 0)
|
||||
#else
|
||||
@ -1083,7 +1083,7 @@ void C_StartFrame_Post(void)
|
||||
tm *curTime = localtime(&td);
|
||||
|
||||
int i = 0;
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxmodx")), 0700);
|
||||
#else
|
||||
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxmodx")));
|
||||
@ -1092,7 +1092,7 @@ void C_StartFrame_Post(void)
|
||||
{
|
||||
char buffer[256];
|
||||
sprintf(buffer, "%s/memreports/D%02d%02d%03d", get_localinfo("amxx_basedir", "addons/amxmodx"), curTime->tm_mon + 1, curTime->tm_mday, i);
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
mkdir(build_pathname("%s", g_log_dir.c_str()), 0700);
|
||||
if (mkdir(build_pathname(buffer), 0700) < 0)
|
||||
#else
|
||||
@ -1285,7 +1285,7 @@ void C_TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void C_AlertMessage(ALERT_TYPE atype, char *szFmt, ...)
|
||||
void C_AlertMessage(ALERT_TYPE atype, const char *szFmt, ...)
|
||||
{
|
||||
if (atype != at_logged)
|
||||
{
|
||||
@ -1329,7 +1329,7 @@ void C_AlertMessage(ALERT_TYPE atype, char *szFmt, ...)
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void C_ChangeLevel(char *map, char *what)
|
||||
void C_ChangeLevel(const char *map, const char *what)
|
||||
{
|
||||
int ret = executeForwards(FF_ChangeLevel, map);
|
||||
if (ret)
|
||||
@ -1371,7 +1371,7 @@ void C_CvarValue2(const edict_t *pEdict, int requestId, const char *cvar, const
|
||||
RETURN_META(MRES_HANDLED);
|
||||
}
|
||||
|
||||
C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
C_DLLEXPORT int Meta_Query(const char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
{
|
||||
gpMetaUtilFuncs = pMetaUtilFuncs;
|
||||
*pPlugInfo = &Plugin_info;
|
||||
@ -1535,7 +1535,7 @@ C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
// linux prototype
|
||||
C_DLLEXPORT void GiveFnptrsToDll(enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals)
|
||||
{
|
||||
|
@ -29,8 +29,11 @@
|
||||
* version.
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/mman.h>
|
||||
#include "sclinux.h"
|
||||
@ -86,7 +89,7 @@ bool DirExists(const char *dir)
|
||||
return false;
|
||||
}
|
||||
|
||||
void report_error(int code, char* fmt, ...)
|
||||
void report_error(int code, const char* fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char string[256];
|
||||
@ -106,7 +109,7 @@ void report_error(int code, char* fmt, ...)
|
||||
}
|
||||
}
|
||||
|
||||
void print_srvconsole(char *fmt, ...)
|
||||
void print_srvconsole(const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char string[384];
|
||||
@ -340,11 +343,14 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
|
||||
if ((err = amx_InitJIT(amx, (void *)rt, (void *)np)) == AMX_ERR_NONE)
|
||||
{
|
||||
//amx->base = (unsigned char FAR *)realloc(np, amx->code_size);
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
amx->base = (unsigned char *)VirtualAlloc(NULL, amx->code_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
#else
|
||||
//posix_memalign((void **)&(amx->base), sysconf(_SC_PAGESIZE), amx->code_size);
|
||||
#elif defined(__GNUC__)
|
||||
# if defined(__APPLE__)
|
||||
amx->base = (unsigned char *)valloc(amx->code_size);
|
||||
# else
|
||||
amx->base = (unsigned char *)memalign(sysconf(_SC_PAGESIZE), amx->code_size);
|
||||
# endif
|
||||
mprotect((void *)amx->base, amx->code_size, PROT_READ|PROT_WRITE|PROT_EXEC);
|
||||
#endif
|
||||
if (amx->base)
|
||||
@ -641,7 +647,7 @@ int unload_amxscript(AMX* amx, void** program)
|
||||
return AMX_ERR_NONE;
|
||||
|
||||
#if defined JIT
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
if ((flags & AMX_FLAG_JITC) != AMX_FLAG_JITC)
|
||||
{
|
||||
delete [] prg;
|
||||
@ -720,7 +726,7 @@ void get_modname(char* buffer)
|
||||
strcpy(buffer, g_mod_name.c_str());
|
||||
}
|
||||
|
||||
char* build_pathname(char *fmt, ...)
|
||||
char* build_pathname(const char *fmt, ...)
|
||||
{
|
||||
static char string[256];
|
||||
int b;
|
||||
@ -746,7 +752,7 @@ char* build_pathname(char *fmt, ...)
|
||||
return string;
|
||||
}
|
||||
|
||||
char *build_pathname_r(char *buffer, size_t maxlen, char *fmt, ...)
|
||||
char *build_pathname_r(char *buffer, size_t maxlen, const char *fmt, ...)
|
||||
{
|
||||
snprintf(buffer, maxlen, "%s%c", g_mod_name.c_str(), PATH_SEP_CHAR);
|
||||
|
||||
@ -771,7 +777,7 @@ char *build_pathname_r(char *buffer, size_t maxlen, char *fmt, ...)
|
||||
}
|
||||
|
||||
// build pathname based on addons dir
|
||||
char* build_pathname_addons(char *fmt, ...)
|
||||
char* build_pathname_addons(const char *fmt, ...)
|
||||
{
|
||||
static char string[256];
|
||||
|
||||
@ -875,7 +881,7 @@ bool ConvertModuleName(const char *pathString, String &path)
|
||||
path.append(PATH_SEP_CHAR);
|
||||
path.append(tmpname);
|
||||
path.append("_amxx");
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined AMD64 || PAWN_CELL_SIZE==64
|
||||
path.append("_amd64");
|
||||
#else
|
||||
@ -888,6 +894,8 @@ bool ConvertModuleName(const char *pathString, String &path)
|
||||
path.append(".dll");
|
||||
#elif defined __linux__
|
||||
path.append(".so");
|
||||
#elif defined __APPLE__
|
||||
path.append(".dylib");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
@ -1179,8 +1187,6 @@ void modules_callPluginsUnloading()
|
||||
// new functions
|
||||
int MNF_AddNatives(AMX_NATIVE_INFO* natives)
|
||||
{
|
||||
CList<CModule, const char *>::iterator a = g_modules.begin();
|
||||
|
||||
if (!g_CurrentlyCalledModule || g_ModuleCallReason != ModuleCall_Attach)
|
||||
return FALSE; // may only be called from attach
|
||||
|
||||
@ -1191,8 +1197,6 @@ int MNF_AddNatives(AMX_NATIVE_INFO* natives)
|
||||
|
||||
int MNF_AddNewNatives(AMX_NATIVE_INFO *natives)
|
||||
{
|
||||
CList<CModule, const char *>::iterator a = g_modules.begin();
|
||||
|
||||
if (!g_CurrentlyCalledModule || g_ModuleCallReason != ModuleCall_Attach)
|
||||
return FALSE; // may only be called from attach
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "amx.h"
|
||||
|
||||
#undef DLLEXPORT
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXPORT __attribute__((visibility("default")))
|
||||
|
@ -35,8 +35,11 @@
|
||||
#include "libraries.h"
|
||||
#include "format.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__linux__)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/mman.h>
|
||||
#include "sclinux.h"
|
||||
@ -479,12 +482,16 @@ static cell AMX_NATIVE_CALL register_native(AMX *amx, cell *params)
|
||||
//we'll apply a safety buffer too
|
||||
//make our function
|
||||
int size = amxx_DynaCodesize();
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
DWORD temp;
|
||||
pNative->pfn = new char[size + 10];
|
||||
VirtualProtect(pNative->pfn, size+10, PAGE_EXECUTE_READWRITE, &temp);
|
||||
#else
|
||||
#elif defined(__GNUC__)
|
||||
# if defined(__APPLE__)
|
||||
pNative->pfn = (char *)valloc(size+10);
|
||||
# else
|
||||
pNative->pfn = (char *)memalign(sysconf(_SC_PAGESIZE), size+10);
|
||||
# endif
|
||||
mprotect((void *)pNative->pfn, size+10, PROT_READ|PROT_WRITE|PROT_EXEC);
|
||||
#endif
|
||||
|
||||
|
@ -39,6 +39,10 @@
|
||||
#include <endian.h>
|
||||
#endif
|
||||
|
||||
#if defined __APPLE__
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Linux NOW has these */
|
||||
#if !defined BIG_ENDIAN
|
||||
#define BIG_ENDIAN 4321
|
||||
|
@ -20,10 +20,10 @@
|
||||
#define stricmp(a,b) strcasecmp(a,b)
|
||||
#define strnicmp(a,b,c) strncasecmp(a,b,c)
|
||||
|
||||
#if defined __linux__ && !defined _snprintf
|
||||
#if ( defined(__linux__) || defined(__APPLE__) ) && !defined _snprintf
|
||||
#define _snprintf snprintf
|
||||
#endif
|
||||
#if defined __linux__ && !defined _vsnprintf
|
||||
#if ( defined(__linux__) || defined(__APPLE__) ) && !defined _vsnprintf
|
||||
//#define _vsnprintf vsnprintf
|
||||
#endif
|
||||
|
||||
@ -40,6 +40,10 @@
|
||||
*/
|
||||
#if !defined __BYTE_ORDER
|
||||
# include <stdlib.h>
|
||||
# if defined __APPLE__
|
||||
# include <sys/types.h>
|
||||
# define __BYTE_ORDER BYTE_ORDER
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined __OpenBSD__
|
||||
|
@ -2240,7 +2240,7 @@ static META_FUNCTIONS g_MetaFunctions_Table =
|
||||
GetEngineFunctions_Post
|
||||
};
|
||||
|
||||
C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
C_DLLEXPORT int Meta_Query(const char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
{
|
||||
if ((int) CVAR_GET_FLOAT("developer") != 0)
|
||||
UTIL_LogPrintf("[%s] dev: called: Meta_Query; version=%s, ours=%s\n",
|
||||
@ -2334,7 +2334,7 @@ C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
|
||||
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
// linux prototype
|
||||
C_DLLEXPORT void GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) {
|
||||
|
||||
@ -3050,7 +3050,7 @@ char* UTIL_VarArgs( char *format, ... )
|
||||
// UTIL_LogPrintf - Prints a logged message to console.
|
||||
// Preceded by LOG: ( timestamp ) < message >
|
||||
//=========================================================
|
||||
void UTIL_LogPrintf( char *fmt, ... )
|
||||
void UTIL_LogPrintf( const char *fmt, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
static char string[1024];
|
||||
|
@ -20,11 +20,16 @@
|
||||
|
||||
// DLL Export
|
||||
#undef DLLEXPORT
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) && !defined(LINUX)
|
||||
#define LINUX
|
||||
#elif defined(__APPLE__) && !defined(OSX)
|
||||
#define OSX
|
||||
#endif
|
||||
|
||||
#undef C_DLLEXPORT
|
||||
@ -66,7 +71,7 @@ struct amxx_module_info_s
|
||||
#if defined HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX || defined __APPLE__
|
||||
#if defined HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
@ -308,7 +313,7 @@ typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
|
||||
#endif
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=mac68k
|
||||
@ -395,7 +400,7 @@ enum {
|
||||
};
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#pragma pack() /* reset default packing */
|
||||
#else
|
||||
#pragma pack(pop) /* reset previous packing */
|
||||
@ -406,7 +411,7 @@ enum {
|
||||
// ***** declare functions *****
|
||||
|
||||
#ifdef USE_METAMOD
|
||||
void UTIL_LogPrintf( char *fmt, ... );
|
||||
void UTIL_LogPrintf( const char *fmt, ... );
|
||||
void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, const char *pMessage);
|
||||
short FixedSigned16( float value, float scale );
|
||||
unsigned short FixedUnsigned16( float value, float scale );
|
||||
@ -833,11 +838,11 @@ int FN_AllowLagCompensation_Post(void);
|
||||
|
||||
|
||||
#ifdef FN_PrecacheModel
|
||||
int FN_PrecacheModel(char *s);
|
||||
int FN_PrecacheModel(const char *s);
|
||||
#endif // FN_PrecacheModel
|
||||
|
||||
#ifdef FN_PrecacheSound
|
||||
int FN_PrecacheSound(char *s);
|
||||
int FN_PrecacheSound(const char *s);
|
||||
#endif // FN_PrecacheSound
|
||||
|
||||
#ifdef FN_SetModel
|
||||
@ -857,7 +862,7 @@ void FN_SetSize(edict_t *e, const float *rgflMin, const float *rgflMax);
|
||||
#endif // FN_SetSize
|
||||
|
||||
#ifdef FN_ChangeLevel
|
||||
void FN_ChangeLevel(char *s1, char *s2);
|
||||
void FN_ChangeLevel(const char *s1, const char *s2);
|
||||
#endif // FN_ChangeLevel
|
||||
|
||||
#ifdef FN_GetSpawnParms
|
||||
@ -1261,19 +1266,19 @@ char *FN_GetInfoKeyBuffer(edict_t *e);
|
||||
#endif // FN_GetInfoKeyBuffer
|
||||
|
||||
#ifdef FN_InfoKeyValue
|
||||
char *FN_InfoKeyValue(char *infobuffer, char *key);
|
||||
char *FN_InfoKeyValue(char *infobuffer, const char *key);
|
||||
#endif // FN_InfoKeyValue
|
||||
|
||||
#ifdef FN_SetKeyValue
|
||||
void FN_SetKeyValue(char *infobuffer, char *key, char *value);
|
||||
void FN_SetKeyValue(char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetKeyValue
|
||||
|
||||
#ifdef FN_SetClientKeyValue
|
||||
void FN_SetClientKeyValue(int clientIndex, char *infobuffer, char *key, char *value);
|
||||
void FN_SetClientKeyValue(int clientIndex, char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetClientKeyValue
|
||||
|
||||
#ifdef FN_IsMapValid
|
||||
int FN_IsMapValid(char *filename);
|
||||
int FN_IsMapValid(const char *filename);
|
||||
#endif // FN_IsMapValid
|
||||
|
||||
#ifdef FN_StaticDecal
|
||||
@ -1281,7 +1286,7 @@ void FN_StaticDecal(const float *origin, int decalIndex, int entityIndex, int mo
|
||||
#endif // FN_StaticDecal
|
||||
|
||||
#ifdef FN_PrecacheGeneric
|
||||
int FN_PrecacheGeneric(char *s);
|
||||
int FN_PrecacheGeneric(const char *s);
|
||||
#endif // FN_PrecacheGeneric
|
||||
|
||||
#ifdef FN_GetPlayerUserId
|
||||
@ -1414,11 +1419,11 @@ const char *FN_GetPlayerAuthId(edict_t *e);
|
||||
|
||||
|
||||
#ifdef FN_PrecacheModel_Post
|
||||
int FN_PrecacheModel_Post(char *s);
|
||||
int FN_PrecacheModel_Post(const char *s);
|
||||
#endif // FN_PrecacheModel_Post
|
||||
|
||||
#ifdef FN_PrecacheSound_Post
|
||||
int FN_PrecacheSound_Post(char *s);
|
||||
int FN_PrecacheSound_Post(const char *s);
|
||||
#endif // FN_PrecacheSound_Post
|
||||
|
||||
#ifdef FN_SetModel_Post
|
||||
@ -1438,7 +1443,7 @@ void FN_SetSize_Post(edict_t *e, const float *rgflMin, const float *rgflMax);
|
||||
#endif // FN_SetSize_Post
|
||||
|
||||
#ifdef FN_ChangeLevel_Post
|
||||
void FN_ChangeLevel_Post(char *s1, char *s2);
|
||||
void FN_ChangeLevel_Post(const char *s1, const char *s2);
|
||||
#endif // FN_ChangeLevel_Post
|
||||
|
||||
#ifdef FN_GetSpawnParms_Post
|
||||
@ -1842,19 +1847,19 @@ char *FN_GetInfoKeyBuffer_Post(edict_t *e);
|
||||
#endif // FN_GetInfoKeyBuffer_Post
|
||||
|
||||
#ifdef FN_InfoKeyValue_Post
|
||||
char *FN_InfoKeyValue_Post(char *infobuffer, char *key);
|
||||
char *FN_InfoKeyValue_Post(char *infobuffer, const char *key);
|
||||
#endif // FN_InfoKeyValue_Post
|
||||
|
||||
#ifdef FN_SetKeyValue_Post
|
||||
void FN_SetKeyValue_Post(char *infobuffer, char *key, char *value);
|
||||
void FN_SetKeyValue_Post(char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetKeyValue_Post
|
||||
|
||||
#ifdef FN_SetClientKeyValue_Post
|
||||
void FN_SetClientKeyValue_Post(int clientIndex, char *infobuffer, char *key, char *value);
|
||||
void FN_SetClientKeyValue_Post(int clientIndex, char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetClientKeyValue_Post
|
||||
|
||||
#ifdef FN_IsMapValid_Post
|
||||
int FN_IsMapValid_Post(char *filename);
|
||||
int FN_IsMapValid_Post(const char *filename);
|
||||
#endif // FN_IsMapValid_Post
|
||||
|
||||
#ifdef FN_StaticDecal_Post
|
||||
@ -1862,7 +1867,7 @@ void FN_StaticDecal_Post(const float *origin, int decalIndex, int entityIndex, i
|
||||
#endif // FN_StaticDecal_Post
|
||||
|
||||
#ifdef FN_PrecacheGeneric_Post
|
||||
int FN_PrecacheGeneric_Post(char *s);
|
||||
int FN_PrecacheGeneric_Post(const char *s);
|
||||
#endif // FN_PrecacheGeneric_Post
|
||||
|
||||
#ifdef FN_GetPlayerUserId_Post
|
||||
@ -2116,7 +2121,7 @@ typedef int (*PFN_ADD_NEW_NATIVES) (const AMX_NATIVE_INFO * /*list*/);
|
||||
typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...);
|
||||
typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...);
|
||||
typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/);
|
||||
typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...);
|
||||
typedef void (*PFN_PRINT_SRVCONSOLE) (const char * /*format*/, ...);
|
||||
typedef const char * (*PFN_GET_MODNAME) (void);
|
||||
typedef const char * (*PFN_GET_AMXSCRIPTNAME) (int /*id*/);
|
||||
typedef AMX * (*PFN_GET_AMXSCRIPT) (int /*id*/);
|
||||
@ -2175,8 +2180,8 @@ typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned i
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, const char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, const char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */);
|
||||
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
||||
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
||||
|
@ -19,7 +19,7 @@
|
||||
#endif
|
||||
|
||||
#include <new>
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
//namespace SourceHook
|
||||
//{
|
||||
|
@ -54,12 +54,12 @@
|
||||
typedef List<THashNode *> * NodePtr;
|
||||
public:
|
||||
class const_iterator;
|
||||
THash() : m_Buckets(NULL), m_numBuckets(0), m_percentUsed(0.0f), m_items(0)
|
||||
THash() : m_Buckets(NULL), m_numBuckets(0), m_percentUsed(0.0f)
|
||||
{
|
||||
_Refactor();
|
||||
}
|
||||
THash(const THash &other) : m_Buckets(new NodePtr[other.m_numBuckets]),
|
||||
m_numBuckets(other.m_numBuckets), m_percentUsed(other.m_percentUsed), m_items(0)
|
||||
m_numBuckets(other.m_numBuckets), m_percentUsed(other.m_percentUsed)
|
||||
{
|
||||
for (size_t i=0; i<m_numBuckets; i++)
|
||||
m_Buckets[i] = NULL;
|
||||
@ -82,10 +82,6 @@
|
||||
_Clear();
|
||||
_Refactor();
|
||||
}
|
||||
size_t size()
|
||||
{
|
||||
return m_items;
|
||||
}
|
||||
size_t GetBuckets()
|
||||
{
|
||||
return m_numBuckets;
|
||||
@ -122,7 +118,6 @@
|
||||
delete [] m_Buckets;
|
||||
m_Buckets = NULL;
|
||||
m_numBuckets = 0;
|
||||
m_items = 0;
|
||||
}
|
||||
public:
|
||||
template <typename U>
|
||||
@ -229,8 +224,6 @@
|
||||
}
|
||||
}
|
||||
public:
|
||||
friend class iterator;
|
||||
friend class const_iterator;
|
||||
class iterator
|
||||
{
|
||||
friend class THash;
|
||||
@ -304,8 +297,6 @@
|
||||
*this = tmp;
|
||||
|
||||
// :TODO: Maybe refactor to a lower size if required
|
||||
|
||||
m_items--;
|
||||
}
|
||||
private:
|
||||
void _Inc()
|
||||
@ -454,6 +445,8 @@
|
||||
const THash *hash;
|
||||
bool end;
|
||||
};
|
||||
friend class iterator;
|
||||
friend class const_iterator;
|
||||
public:
|
||||
iterator begin()
|
||||
{
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include <new>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
enum NodeType
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#define strnicmp strncasecmp
|
||||
#endif
|
||||
|
||||
@ -336,8 +336,10 @@ char *strptime(const char *buf, const char *fmt, struct tm *tm, short addthem)
|
||||
if (0 <= ti.qS) (*defoper) ( &tm->tm_sec , ti.qS );
|
||||
if (0 <= ti.qM) (*defoper) ( &tm->tm_min , ti.qM ); //tm->tm_min = ti.qM;
|
||||
if (0 <= ti.qI)
|
||||
{
|
||||
if (0 <= ti.qp) ti.qH = ti.qI % 12 + ti.qp * 12;
|
||||
else (*defoper) ( &tm->tm_hour , ti.qI ); //tm->tm_hour = ti.qI;
|
||||
else (*defoper) ( &tm->tm_hour , ti.qI ); //tm->tm_hour = ti.qI;
|
||||
}
|
||||
if (0 <= ti.qH) (*defoper) ( &tm->tm_hour , ti.qH ); //tm->tm_hour = ti.qH;
|
||||
if (0 <= ti.qZ) (*defoper) ( &tm->tm_isdst , ti.qZ - 1 ); //tm->tm_isdst = ti.qZ - 1;
|
||||
if (0 <= ti.qy) ti.qY = ti.qy;
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <time.h>
|
||||
#include "amxmodx.h"
|
||||
|
||||
#if defined __linux__ && !defined _vsnprintf
|
||||
#if ( defined(__linux__) || defined(__APPLE__) ) && !defined _vsnprintf
|
||||
#define _vsnprintf vsnprintf
|
||||
#endif
|
||||
|
||||
@ -157,8 +157,8 @@ void UTIL_IntToString(int value, char *output)
|
||||
|
||||
if (tho)
|
||||
{
|
||||
aaa += sprintf(&output[aaa], words[tho]);
|
||||
aaa += sprintf(&output[aaa], words[29]);
|
||||
aaa += sprintf(&output[aaa], "%s", words[tho]);
|
||||
aaa += sprintf(&output[aaa], "%s", words[29]);
|
||||
value = value % 1000;
|
||||
}
|
||||
|
||||
@ -166,8 +166,8 @@ void UTIL_IntToString(int value, char *output)
|
||||
|
||||
if (hun)
|
||||
{
|
||||
aaa += sprintf(&output[aaa], words[hun]);
|
||||
aaa += sprintf(&output[aaa], words[28]);
|
||||
aaa += sprintf(&output[aaa], "%s", words[hun]);
|
||||
aaa += sprintf(&output[aaa], "%s", words[28]);
|
||||
value = value % 100;
|
||||
}
|
||||
|
||||
@ -175,10 +175,10 @@ void UTIL_IntToString(int value, char *output)
|
||||
int unit = value % 10;
|
||||
|
||||
if (ten)
|
||||
aaa += sprintf(&output[aaa], words[(ten > 1) ? (ten + 18) : (unit + 10)]);
|
||||
aaa += sprintf(&output[aaa], "%s", words[(ten > 1) ? (ten + 18) : (unit + 10)]);
|
||||
|
||||
if (ten != 1 && (unit || (!value && !hun && !tho)))
|
||||
sprintf(&output[aaa], words[unit]);
|
||||
sprintf(&output[aaa], "%s", words[unit]);
|
||||
}
|
||||
|
||||
char* UTIL_SplitHudMessage(const char *src)
|
||||
@ -242,7 +242,7 @@ short FixedSigned16(float value, float scale)
|
||||
return (short)output;
|
||||
}
|
||||
|
||||
void UTIL_HudMessage(edict_t *pEntity, const hudtextparms_t &textparms, char *pMessage)
|
||||
void UTIL_HudMessage(edict_t *pEntity, const hudtextparms_t &textparms, const char *pMessage)
|
||||
{
|
||||
if (pEntity)
|
||||
MESSAGE_BEGIN(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, NULL, pEntity);
|
||||
|
@ -1,46 +1,107 @@
|
||||
#(C)2004-2005 AMX Mod X Development Team
|
||||
# (C)2004-2013 AMX Mod X Development Team
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
#####################################
|
||||
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fno-strict-aliasing
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc-4.1
|
||||
BINARY = amxxpc
|
||||
|
||||
PROJECT = amxxpc
|
||||
OBJECTS = amx.cpp amxxpc.cpp Binary.cpp
|
||||
|
||||
LINK = -lz /lib32/libstdc++.a
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
##############################################
|
||||
|
||||
INCLUDE = -I. -L.
|
||||
C_OPT_FLAGS = -DNDEBUG -O2 -funroll-loops -fomit-frame-pointer -pipe
|
||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||
C_GCC4_FLAGS = -fvisibility=hidden
|
||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||
CPP = gcc
|
||||
CPP_OSX = clang
|
||||
|
||||
LINK =
|
||||
|
||||
INCLUDE = -I.
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
################################################
|
||||
|
||||
OS := $(shell uname -s)
|
||||
|
||||
ifeq "$(OS)" "Darwin"
|
||||
CPP = $(CPP_OSX)
|
||||
LIB_SUFFIX = _osx
|
||||
CFLAGS += -DOSX
|
||||
LINK += -lstdc++ -mmacosx-version-min=10.5 -lz-darwin
|
||||
else
|
||||
LIB_SUFFIX =
|
||||
CFLAGS += -DLINUX
|
||||
LINK += -lz /lib32/libstdc++.a
|
||||
endif
|
||||
|
||||
LINK += -m32 -lm -ldl -L.
|
||||
|
||||
CFLAGS += -DAMX_ANSIONLY -DHAVE_STDINT_H -fno-strict-aliasing \
|
||||
-m32 -Wall -Werror
|
||||
CPPFLAGS += -fexceptions -fno-rtti
|
||||
|
||||
BINARY = $(PROJECT)$(LIB_SUFFIX)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
BIN_DIR = Debug
|
||||
CFLAGS = $(DEBUG_FLAGS)
|
||||
CFLAGS += $(C_DEBUG_FLAGS)
|
||||
else
|
||||
BIN_DIR = Release
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
CFLAGS += $(C_OPT_FLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -DLINUX -DNDEBUG -Wno-deprecated -fexceptions -DHAVE_STDINT_H -DAMX_ANSIONLY -fno-rtti -static-libgcc
|
||||
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
|
||||
|
||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
ifeq "$(IS_CLANG)" "1"
|
||||
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
|
||||
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
|
||||
else
|
||||
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
|
||||
endif
|
||||
|
||||
# Clang || GCC >= 4
|
||||
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
|
||||
CFLAGS += $(C_GCC4_FLAGS)
|
||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||
endif
|
||||
|
||||
# Clang >= 3 || GCC >= 4.7
|
||||
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
|
||||
CFLAGS += -Wno-delete-non-virtual-dtor
|
||||
endif
|
||||
|
||||
# OS is Linux and not using clang
|
||||
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
|
||||
LINK += -static-libgcc
|
||||
endif
|
||||
|
||||
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
|
||||
# This will break if we include other Makefiles, but is fine for now. It allows
|
||||
# us to make a copy of this file that uses altered paths (ie. Makefile.mine)
|
||||
# or other changes without mucking up the original.
|
||||
MAKEFILE_NAME := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
|
||||
$(BIN_DIR)/%.o: %.cpp
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -m32 -o $@ -c $<
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
$(MAKE) amxxpc
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
amxxpc: $(OBJ_LINUX)
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -m32 $(OBJ_LINUX) $(LINK) -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||
|
||||
default: all
|
||||
|
||||
clean:
|
||||
rm -rf Release/*.o
|
||||
rm -rf Release/$(BINARY)
|
||||
rm -rf Debug/*.o
|
||||
rm -rf Debug/$(BINARY)
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include <stddef.h> /* for wchar_t */
|
||||
#include <string.h>
|
||||
#include "osdefs.h"
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
#include <sclinux.h>
|
||||
#if !defined AMX_NODYNALOAD
|
||||
#include <dlfcn.h>
|
||||
@ -815,12 +815,12 @@ static void expand(unsigned char *code, long codesize, long memsize)
|
||||
int AMXAPI amx_Init(AMX *amx,void *program)
|
||||
{
|
||||
AMX_HEADER *hdr;
|
||||
#if (defined _Windows || defined LINUX || defined __FreeBSD__ || defined __OpenBSD__) && !defined AMX_NODYNALOAD
|
||||
#if (defined _Windows || defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__) && !defined AMX_NODYNALOAD
|
||||
char libname[sNAMEMAX+8]; /* +1 for '\0', +3 for 'amx' prefix, +4 for extension */
|
||||
#if defined _Windows
|
||||
typedef int (FAR WINAPI *AMX_ENTRY)(AMX _FAR *amx);
|
||||
HINSTANCE hlib;
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
typedef int (*AMX_ENTRY)(AMX *amx);
|
||||
void *hlib;
|
||||
#endif
|
||||
@ -965,7 +965,7 @@ int AMXAPI amx_Init(AMX *amx,void *program)
|
||||
amx_BrowseRelocate(amx);
|
||||
|
||||
/* load any extension modules that the AMX refers to */
|
||||
#if (defined _Windows || defined LINUX || defined __FreeBSD__ || defined __OpenBSD__) && !defined AMX_NODYNALOAD
|
||||
#if (defined _Windows || defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__) && !defined AMX_NODYNALOAD
|
||||
hdr=(AMX_HEADER *)amx->base;
|
||||
numlibraries=NUMENTRIES(hdr,libraries,pubvars);
|
||||
for (i=0; i<numlibraries; i++) {
|
||||
@ -981,7 +981,7 @@ int AMXAPI amx_Init(AMX *amx,void *program)
|
||||
if (hlib<=HINSTANCE_ERROR)
|
||||
hlib=NULL;
|
||||
#endif
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
strcat(libname,".so");
|
||||
hlib=dlopen(libname,RTLD_NOW);
|
||||
#endif
|
||||
@ -995,7 +995,7 @@ int AMXAPI amx_Init(AMX *amx,void *program)
|
||||
strcat(funcname,"Init");
|
||||
#if defined _Windows
|
||||
libinit=(AMX_ENTRY)GetProcAddress(hlib,funcname);
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
libinit=(AMX_ENTRY)dlsym(hlib,funcname);
|
||||
#endif
|
||||
if (libinit!=NULL)
|
||||
@ -1029,7 +1029,7 @@ int AMXAPI amx_Init(AMX *amx,void *program)
|
||||
return !VirtualProtect(addr, len, p, &prev);
|
||||
}
|
||||
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
|
||||
/* Linux already has mprotect() */
|
||||
|
||||
@ -1104,10 +1104,10 @@ int AMXAPI amx_InitJIT(AMX *amx,void *compiled_program,void *reloc_table)
|
||||
#if defined AMX_CLEANUP
|
||||
int AMXAPI amx_Cleanup(AMX *amx)
|
||||
{
|
||||
#if (defined _Windows || defined LINUX || defined __FreeBSD__ || defined __OpenBSD__) && !defined AMX_NODYNALOAD
|
||||
#if (defined _Windows || defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__) && !defined AMX_NODYNALOAD
|
||||
#if defined _Windows
|
||||
typedef int (FAR WINAPI *AMX_ENTRY)(AMX FAR *amx);
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
typedef int (*AMX_ENTRY)(AMX *amx);
|
||||
#endif
|
||||
AMX_HEADER *hdr;
|
||||
@ -1117,7 +1117,7 @@ int AMXAPI amx_Cleanup(AMX *amx)
|
||||
#endif
|
||||
|
||||
/* unload all extension modules */
|
||||
#if (defined _Windows || defined LINUX || defined __FreeBSD__ || defined __OpenBSD__) && !defined AMX_NODYNALOAD
|
||||
#if (defined _Windows || defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__) && !defined AMX_NODYNALOAD
|
||||
hdr=(AMX_HEADER *)amx->base;
|
||||
assert(hdr->magic==AMX_MAGIC);
|
||||
numlibraries=NUMENTRIES(hdr,libraries,pubvars);
|
||||
@ -1130,14 +1130,14 @@ int AMXAPI amx_Cleanup(AMX *amx)
|
||||
strcat(funcname,"Cleanup");
|
||||
#if defined _Windows
|
||||
libcleanup=(AMX_ENTRY)GetProcAddress((HINSTANCE)lib->address,funcname);
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
libcleanup=(AMX_ENTRY)dlsym((void*)lib->address,funcname);
|
||||
#endif
|
||||
if (libcleanup!=NULL)
|
||||
libcleanup(amx);
|
||||
#if defined _Windows
|
||||
FreeLibrary((HINSTANCE)lib->address);
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
dlclose((void*)lib->address);
|
||||
#endif
|
||||
} /* if */
|
||||
@ -1666,7 +1666,7 @@ int AMXAPI amx_PushString(AMX *amx, cell *amx_addr, cell **phys_addr, const char
|
||||
* fast "indirect threaded" interpreter.
|
||||
*/
|
||||
|
||||
#define NEXT(cip) goto **cip++
|
||||
#define NEXT(cip) goto *(const void *)*cip++
|
||||
|
||||
int AMXAPI amx_Exec(AMX *amx, cell *retval, int index)
|
||||
{
|
||||
@ -1846,14 +1846,14 @@ static const void * const amx_opcodelist[] = {
|
||||
NEXT(cip);
|
||||
op_load_i:
|
||||
/* verify address */
|
||||
if (pri>=hea && pri<stk || (ucell)pri>=(ucell)amx->stp)
|
||||
if ((pri>=hea && pri<stk) || (ucell)pri>=(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
pri= * (cell *)(data+(int)pri);
|
||||
NEXT(cip);
|
||||
op_lodb_i:
|
||||
GETPARAM(offs);
|
||||
/* verify address */
|
||||
if (pri>=hea && pri<stk || (ucell)pri>=(ucell)amx->stp)
|
||||
if ((pri>=hea && pri<stk) || (ucell)pri>=(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
switch (offs) {
|
||||
case 1:
|
||||
@ -1919,14 +1919,14 @@ static const void * const amx_opcodelist[] = {
|
||||
NEXT(cip);
|
||||
op_stor_i:
|
||||
/* verify address */
|
||||
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp)
|
||||
if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
*(cell *)(data+(int)alt)=pri;
|
||||
NEXT(cip);
|
||||
op_strb_i:
|
||||
GETPARAM(offs);
|
||||
/* verify address */
|
||||
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp)
|
||||
if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
switch (offs) {
|
||||
case 1:
|
||||
@ -1943,7 +1943,7 @@ static const void * const amx_opcodelist[] = {
|
||||
op_lidx:
|
||||
offs=pri*sizeof(cell)+alt;
|
||||
/* verify address */
|
||||
if (offs>=hea && offs<stk || (ucell)offs>=(ucell)amx->stp)
|
||||
if ((offs>=hea && offs<stk) || (ucell)offs>=(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
pri= * (cell *)(data+(int)offs);
|
||||
NEXT(cip);
|
||||
@ -1951,7 +1951,7 @@ static const void * const amx_opcodelist[] = {
|
||||
GETPARAM(offs);
|
||||
offs=(pri << (int)offs)+alt;
|
||||
/* verify address */
|
||||
if (offs>=hea && offs<stk || (ucell)offs>=(ucell)amx->stp)
|
||||
if ((offs>=hea && offs<stk) || (ucell)offs>=(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
pri= * (cell *)(data+(int)offs);
|
||||
NEXT(cip);
|
||||
@ -2388,13 +2388,13 @@ static const void * const amx_opcodelist[] = {
|
||||
/* verify top & bottom memory addresses, for both source and destination
|
||||
* addresses
|
||||
*/
|
||||
if (pri>=hea && pri<stk || (ucell)pri>=(ucell)amx->stp)
|
||||
if ((pri>=hea && pri<stk) || (ucell)pri>=(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
if ((pri+offs)>hea && (pri+offs)<stk || (ucell)(pri+offs)>(ucell)amx->stp)
|
||||
if (((pri+offs)>hea && (pri+offs)<stk) || (ucell)(pri+offs)>(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp)
|
||||
if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
if ((alt+offs)>hea && (alt+offs)<stk || (ucell)(alt+offs)>(ucell)amx->stp)
|
||||
if (((alt+offs)>hea && (alt+offs)<stk) || (ucell)(alt+offs)>(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
memcpy(data+(int)alt, data+(int)pri, (int)offs);
|
||||
NEXT(cip);
|
||||
@ -2403,22 +2403,22 @@ static const void * const amx_opcodelist[] = {
|
||||
/* verify top & bottom memory addresses, for both source and destination
|
||||
* addresses
|
||||
*/
|
||||
if (pri>=hea && pri<stk || (ucell)pri>=(ucell)amx->stp)
|
||||
if ((pri>=hea && pri<stk) || (ucell)pri>=(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
if ((pri+offs)>hea && (pri+offs)<stk || (ucell)(pri+offs)>(ucell)amx->stp)
|
||||
if (((pri+offs)>hea && (pri+offs)<stk) || (ucell)(pri+offs)>(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp)
|
||||
if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
if ((alt+offs)>hea && (alt+offs)<stk || (ucell)(alt+offs)>(ucell)amx->stp)
|
||||
if (((alt+offs)>hea && (alt+offs)<stk) || (ucell)(alt+offs)>(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
pri=memcmp(data+(int)alt, data+(int)pri, (int)offs);
|
||||
NEXT(cip);
|
||||
op_fill:
|
||||
GETPARAM(offs);
|
||||
/* verify top & bottom memory addresses */
|
||||
if (alt>=hea && alt<stk || (ucell)alt>=(ucell)amx->stp)
|
||||
if ((alt>=hea && alt<stk) || (ucell)alt>=(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
if ((alt+offs)>hea && (alt+offs)<stk || (ucell)(alt+offs)>(ucell)amx->stp)
|
||||
if (((alt+offs)>hea && (alt+offs)<stk) || (ucell)(alt+offs)>(ucell)amx->stp)
|
||||
ABORT(amx,AMX_ERR_MEMACCESS);
|
||||
for (i=(int)alt; offs>=(int)sizeof(cell); i+=sizeof(cell), offs-=sizeof(cell))
|
||||
*(cell *)(data+i) = pri;
|
||||
@ -3592,7 +3592,7 @@ int AMXAPI amx_GetAddr(AMX *amx,cell amx_addr,cell **phys_addr)
|
||||
data=(amx->data!=NULL) ? amx->data : amx->base+(int)hdr->dat;
|
||||
|
||||
assert(phys_addr!=NULL);
|
||||
if (amx_addr>=amx->hea && amx_addr<amx->stk || amx_addr<0 || amx_addr>=amx->stp) {
|
||||
if ((amx_addr>=amx->hea && amx_addr<amx->stk) || amx_addr<0 || amx_addr>=amx->stp) {
|
||||
*phys_addr=NULL;
|
||||
return AMX_ERR_MEMACCESS;
|
||||
} /* if */
|
||||
|
@ -24,7 +24,7 @@
|
||||
#if defined FREEBSD && !defined __FreeBSD__
|
||||
#define __FreeBSD__
|
||||
#endif
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
#include <sclinux.h>
|
||||
#endif
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
#if defined HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX || defined __APPLE__
|
||||
#if defined HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
@ -188,7 +188,7 @@ typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
|
||||
#endif
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=mac68k
|
||||
@ -416,7 +416,7 @@ int AMXAPI amx_UTF8Put(char *string, char **endptr, int maxchars, cell value);
|
||||
amx_Register((amx), amx_NativeInfo((name),(func)), 1);
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack() /* reset default packing */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=reset
|
||||
|
@ -49,7 +49,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=mac68k
|
||||
@ -156,7 +156,7 @@ int AMXAPI dbg_GetArrayDim(AMX_DBG *amxdbg, const AMX_DBG_SYMBOL *sym, const AMX
|
||||
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack() /* reset default packing */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=reset
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <stdio.h>
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) | defined (__APPLE__)
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
@ -29,25 +29,26 @@ void WriteBh(BinaryWriter *bw, BinPlugin *bh);
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct abl pl32;
|
||||
struct abl pl64;
|
||||
|
||||
#ifdef _DEBUG
|
||||
printf("debug clamp\n");
|
||||
getchar();
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
HINSTANCE lib = NULL;
|
||||
if (FileExists("./amxxpc32.so"))
|
||||
lib = dlmount("./amxxpc32.so");
|
||||
else
|
||||
lib = dlmount("amxxpc32.so");
|
||||
#elif defined(__APPLE__)
|
||||
HINSTANCE lib = dlmount("amxxpc32.dylib");
|
||||
#else
|
||||
HINSTANCE lib = dlmount("amxxpc32.dll");
|
||||
#endif
|
||||
if (!lib)
|
||||
{
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
printf("compiler failed to instantiate: %s\n", dlerror());
|
||||
#else
|
||||
printf("compiler failed to instantiate: %d\n", GetLastError());
|
||||
@ -60,7 +61,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (!sc32 || !pc_printf)
|
||||
{
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
printf("compiler failed to link: %p.\n",sc32);
|
||||
#else
|
||||
printf("compiler failed to link: %d.\n", GetLastError());
|
||||
@ -69,7 +70,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
pc_printf("Welcome to the AMX Mod X %s Compiler.\n", VERSION_STRING);
|
||||
pc_printf("Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team\n\n");
|
||||
pc_printf("Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team\n\n");
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
@ -243,7 +244,7 @@ char *swiext(const char *file, const char *ext, int isO)
|
||||
int i = 0, pos = -1, j = 0;
|
||||
int fileLen = strlen(file);
|
||||
int extLen = strlen(ext);
|
||||
int max = 0, odirFlag = -1;
|
||||
int odirFlag = -1;
|
||||
|
||||
for (i=fileLen-1; i>=0; i--)
|
||||
{
|
||||
@ -339,7 +340,7 @@ void show_help()
|
||||
printf("\t-r[name] write cross reference report to console or to specified file\n");
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
bool FileExists(const char *file)
|
||||
{
|
||||
FILE *fp = fopen(file, "rb");
|
||||
|
@ -5,7 +5,7 @@
|
||||
#define MAGIC_HEADER2 0x414D5858
|
||||
#define MAGIC_VERSION 0x0300
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
# include <dlfcn.h>
|
||||
#else
|
||||
# include <windows.h>
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
# define dlmount(x) dlopen(x, RTLD_NOW|RTLD_GLOBAL)
|
||||
typedef void* HINSTANCE;
|
||||
#else
|
||||
@ -65,7 +65,7 @@ struct BinPlugin
|
||||
int32_t offs; //file offset
|
||||
};
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
bool FileExists(const char *file);
|
||||
#endif
|
||||
|
||||
|
@ -39,6 +39,10 @@
|
||||
#include <endian.h>
|
||||
#endif
|
||||
|
||||
#if defined __APPLE__
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Linux NOW has these */
|
||||
#if !defined BIG_ENDIAN
|
||||
#define BIG_ENDIAN 4321
|
||||
|
@ -32,6 +32,10 @@
|
||||
*/
|
||||
#if !defined __BYTE_ORDER
|
||||
# include <stdlib.h>
|
||||
# if defined __APPLE__
|
||||
# include <sys/types.h>
|
||||
# define __BYTE_ORDER BYTE_ORDER
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined __OpenBSD__ || defined __FreeBSD__
|
||||
|
@ -1,46 +1,108 @@
|
||||
#(C)2004-2005 AMX Mod X Development Team
|
||||
# (C)2004-2013 AMX Mod X Development Team
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
#####################################
|
||||
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fno-strict-aliasing -fvisibility=hidden
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc-4.1
|
||||
NAME = amxxpc32
|
||||
PROJECT = amxxpc32
|
||||
OBJECTS = sc1.c sc2.c sc3.c sc4.c sc5.c sc6.c sc7.c scvars.c scmemfil.c scstate.c sclist.c sci18n.c \
|
||||
scexpand.c pawncc.c libpawnc.c prefix.c memfile.c
|
||||
|
||||
OBJECTS = sc1.c sc2.c sc3.c sc4.c sc5.c sc6.c sc7.c scvars.c scmemfil.c \
|
||||
scstate.c sclist.c sci18n.c scexpand.c pawncc.c libpawnc.c prefix.c \
|
||||
memfile.c
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
##############################################
|
||||
|
||||
C_OPT_FLAGS = -DNDEBUG -O2 -funroll-loops -fomit-frame-pointer -pipe
|
||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||
C_GCC4_FLAGS = -fvisibility=hidden
|
||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||
CPP = gcc
|
||||
CPP_OSX = clang
|
||||
|
||||
LINK = -lpthread
|
||||
|
||||
INCLUDE = -I.
|
||||
INCLUDE = -I.
|
||||
|
||||
BINARY = $(NAME).so
|
||||
BIN_DIR = Release
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
################################################
|
||||
|
||||
CFLAGS += -DLINUX -DNDEBUG -DHAVE_STDINT_H -DENABLE_BINRELOC -DNO_MAIN -DPAWNC_DLL -static-libgcc
|
||||
OS := $(shell uname -s)
|
||||
|
||||
CFLAGS += $(OPT_FLAGS)
|
||||
OBJ_LINUX := $(OBJECTS:%.c=$(BIN_DIR)/%.o)
|
||||
ifeq "$(OS)" "Darwin"
|
||||
CPP = $(CPP_OSX)
|
||||
LIB_EXT = dylib
|
||||
CFLAGS += -DOSX
|
||||
LINK += -dynamiclib -mmacosx-version-min=10.5
|
||||
else
|
||||
LIB_EXT = so
|
||||
CFLAGS += -DLINUX
|
||||
LINK += -shared
|
||||
endif
|
||||
|
||||
LINK += -m32 -lm -ldl
|
||||
|
||||
CFLAGS += -DENABLE_BINRELOC -DNO_MAIN -DPAWNC_DLL -DHAVE_STDINT_H -fno-strict-aliasing -m32 -Wall \
|
||||
-Werror
|
||||
CPPFLAGS += -fexceptions -fno-rtti
|
||||
|
||||
BINARY = $(PROJECT).$(LIB_EXT)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
BIN_DIR = Debug
|
||||
CFLAGS += $(C_DEBUG_FLAGS)
|
||||
else
|
||||
BIN_DIR = Release
|
||||
CFLAGS += $(C_OPT_FLAGS)
|
||||
endif
|
||||
|
||||
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
|
||||
|
||||
ifeq "$(IS_CLANG)" "1"
|
||||
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
|
||||
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
|
||||
else
|
||||
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
|
||||
endif
|
||||
|
||||
# Clang || GCC >= 4
|
||||
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
|
||||
CFLAGS += $(C_GCC4_FLAGS)
|
||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||
endif
|
||||
|
||||
# Clang >= 3 || GCC >= 4.7
|
||||
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
|
||||
CFLAGS += -Wno-delete-non-virtual-dtor
|
||||
endif
|
||||
|
||||
# OS is Linux and not using clang
|
||||
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
|
||||
LINK += -static-libgcc
|
||||
endif
|
||||
|
||||
OBJ_BIN := $(OBJECTS:%.c=$(BIN_DIR)/%.o)
|
||||
|
||||
# This will break if we include other Makefiles, but is fine for now. It allows
|
||||
# us to make a copy of this file that uses altered paths (ie. Makefile.mine)
|
||||
# or other changes without mucking up the original.
|
||||
MAKEFILE_NAME := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
|
||||
$(BIN_DIR)/%.o: %.c
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -m32 -o $@ -c $<
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
all:
|
||||
mkdir -p Release
|
||||
$(MAKE) pawn_make
|
||||
mkdir -p $(BIN_DIR)
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
pawn_make: $(OBJ_LINUX)
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -m32 $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
||||
|
||||
debug:
|
||||
$(MAKE) all DEBUG=true
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||
|
||||
default: all
|
||||
|
||||
clean:
|
||||
rm -rf Release/*.o
|
||||
rm -rf Release/$(BINARY)
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
#if defined FREEBSD && !defined __FreeBSD__
|
||||
#define __FreeBSD__
|
||||
#endif
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
#include <sclinux.h>
|
||||
#endif
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
#if defined HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX || defined __APPLE__
|
||||
#if defined HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
@ -197,7 +197,7 @@ typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
|
||||
#endif
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=mac68k
|
||||
@ -425,7 +425,7 @@ int AMXAPI amx_UTF8Put(char *string, char **endptr, int maxchars, cell value);
|
||||
amx_Register((amx), amx_NativeInfo((name),(func)), 1);
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack() /* reset default packing */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=reset
|
||||
|
@ -49,7 +49,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=mac68k
|
||||
@ -156,7 +156,7 @@ int AMXAPI dbg_GetArrayDim(AMX_DBG *amxdbg, const AMX_DBG_SYMBOL *sym, const AMX
|
||||
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack() /* reset default packing */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=reset
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#if defined PAWNC_DLL
|
||||
|
||||
#ifndef __linux__
|
||||
#if !defined(__linux__) && !defined(__APPLE__)
|
||||
#include "dllmain.c"
|
||||
#endif
|
||||
|
||||
@ -39,9 +39,6 @@
|
||||
# define UNUSED_PARAM(p) ((void)(p))
|
||||
# endif
|
||||
|
||||
static char *argv[MAX_ARGS];
|
||||
static int argc;
|
||||
|
||||
#if PAWN_CELL_SIZE==32
|
||||
#define EXCOMPILER Compile32
|
||||
#else
|
||||
|
@ -10,6 +10,7 @@ memfile_t *memfile_creat(const char *name, size_t init)
|
||||
mf.size = init;
|
||||
mf.base = (char *)malloc(init);
|
||||
mf.usedoffs = 0;
|
||||
mf.name = NULL;
|
||||
if (!mf.base)
|
||||
{
|
||||
return NULL;
|
||||
|
@ -9,7 +9,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct memfile_s
|
||||
{
|
||||
|
@ -41,6 +41,10 @@
|
||||
#include <endian.h>
|
||||
#endif
|
||||
|
||||
#if defined __APPLE__
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Linux NOW has these */
|
||||
#if !defined BIG_ENDIAN
|
||||
#define BIG_ENDIAN 4321
|
||||
|
@ -63,7 +63,7 @@
|
||||
#define PREPROC_TERM '\x7f'/* termination character for preprocessor expressions (the "DEL" code) */
|
||||
#define sDEF_PREFIX "default.inc" /* default prefix filename */
|
||||
|
||||
#if defined WIN32
|
||||
#if defined WIN32 || defined __clang__
|
||||
#define INVISIBLE
|
||||
#else
|
||||
#define INVISIBLE __attribute__((visibility("protected")))
|
||||
|
@ -35,9 +35,10 @@
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
#include <sclinux.h>
|
||||
#include <prefix.h> /* from BinReloc, see www.autopackage.org */
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined FORTIFY
|
||||
@ -421,7 +422,7 @@ int pc_compile(int argc, char *argv[])
|
||||
void *inpfmark;
|
||||
int lcl_packstr,lcl_needsemicolon,lcl_tabsize;
|
||||
#if !defined SC_LIGHT
|
||||
int hdrsize;
|
||||
int hdrsize=0;
|
||||
#endif
|
||||
|
||||
/* set global variables to their initial value */
|
||||
@ -1248,9 +1249,9 @@ static void setconfig(char *root)
|
||||
/* add the default "include" directory */
|
||||
#if defined __WIN32__ || defined _WIN32
|
||||
GetModuleFileName(NULL,path,_MAX_PATH);
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
/* see www.autopackage.org for the BinReloc module */
|
||||
ptr = SELFPATH;
|
||||
ptr = (char *)SELFPATH;
|
||||
if (!ptr)
|
||||
ptr = root;
|
||||
strncpy(path,ptr,sizeof path);
|
||||
@ -1922,7 +1923,7 @@ static int declloc(int fstatic)
|
||||
int dim[sDIMEN_MAX];
|
||||
int numdim;
|
||||
int fconst;
|
||||
int staging_start;
|
||||
int staging_start=0;
|
||||
|
||||
fconst=matchtoken(tCONST);
|
||||
do {
|
||||
@ -1948,7 +1949,7 @@ static int declloc(int fstatic)
|
||||
* level might indicate a bug.
|
||||
* NOTE - don't bother with the error if there's no valid function!
|
||||
*/
|
||||
if ((sym=findloc(name))!=NULL && sym->compound!=nestlevel || findglb(name)!=NULL)
|
||||
if (((sym=findloc(name))!=NULL && sym->compound!=nestlevel) || findglb(name)!=NULL)
|
||||
if (curfunc!=NULL && (curfunc->usage & uNATIVE))
|
||||
error(219,name); /* variable shadows another symbol */
|
||||
while (matchtoken('[')){
|
||||
@ -2863,7 +2864,7 @@ static int operatoradjust(int opertok,symbol *sym,char *opername,int resulttag)
|
||||
error(62); /* number or placement of the operands does not fit the operator */
|
||||
} /* switch */
|
||||
|
||||
if (tags[0]==0 && (opertok!='=' && tags[1]==0 || opertok=='=' && resulttag==0))
|
||||
if (tags[0]==0 && ((opertok!='=' && tags[1]==0) || (opertok=='=' && resulttag==0)))
|
||||
error(64); /* cannot change predefined operators */
|
||||
|
||||
/* change the operator name */
|
||||
@ -3045,7 +3046,7 @@ static void funcstub(int native)
|
||||
|
||||
tok=lex(&val,&str);
|
||||
if (native) {
|
||||
if (tok==tPUBLIC || tok==tSTOCK || tok==tSTATIC || tok==tSYMBOL && *str==PUBLIC_CHAR)
|
||||
if (tok==tPUBLIC || tok==tSTOCK || tok==tSTATIC || (tok==tSYMBOL && *str==PUBLIC_CHAR))
|
||||
error(42); /* invalid combination of class specifiers */
|
||||
} else {
|
||||
if (tok==tPUBLIC || tok==tSTOCK || tok==tSTATIC)
|
||||
@ -3166,7 +3167,7 @@ static int newfunc(char *firstname,int firsttag,int fpublic,int fstatic,int stoc
|
||||
tag= (firsttag>=0) ? firsttag : pc_addtag(NULL);
|
||||
tok=lex(&val,&str);
|
||||
assert(!fpublic);
|
||||
if (tok==tNATIVE || tok==tPUBLIC && stock)
|
||||
if (tok==tNATIVE || (tok==tPUBLIC && stock))
|
||||
error(42); /* invalid combination of class specifiers */
|
||||
if (tok==tOPERATOR) {
|
||||
opertok=operatorname(symbolname);
|
||||
@ -3512,7 +3513,7 @@ static int declargs(symbol *sym)
|
||||
error(10); /* illegal function or declaration */
|
||||
} /* switch */
|
||||
} while (tok=='&' || tok==tLABEL || tok==tCONST
|
||||
|| tok!=tELLIPS && matchtoken(',')); /* more? */
|
||||
|| (tok!=tELLIPS && matchtoken(','))); /* more? */
|
||||
/* if the next token is not ",", it should be ")" */
|
||||
needtoken(')');
|
||||
} /* if */
|
||||
@ -3873,7 +3874,7 @@ static void make_report(symbol *root,FILE *log,char *sourcefile)
|
||||
continue;
|
||||
if ((sym->usage & uREAD)==0)
|
||||
continue;
|
||||
fprintf(log,"\t\t<member name=\"T:%s\" value=\"%ld\">\n",funcdisplayname(symname,sym->name),sym->addr);
|
||||
fprintf(log,"\t\t<member name=\"T:%s\" value=\"%ld\">\n",funcdisplayname(symname,sym->name),(long)sym->addr);
|
||||
if (sym->tag!=0) {
|
||||
tagsym=find_tag_byval(sym->tag);
|
||||
assert(tagsym!=NULL);
|
||||
@ -3883,7 +3884,7 @@ static void make_report(symbol *root,FILE *log,char *sourcefile)
|
||||
if ((enumroot=sym->dim.enumlist)!=NULL) {
|
||||
enumroot=enumroot->next; /* skip root */
|
||||
while (enumroot!=NULL) {
|
||||
fprintf(log,"\t\t\t<member name=\"C:%s\" value=\"%ld\">\n",funcdisplayname(symname,enumroot->name),enumroot->value);
|
||||
fprintf(log,"\t\t\t<member name=\"C:%s\" value=\"%ld\">\n",funcdisplayname(symname,enumroot->name),(long)enumroot->value);
|
||||
/* find the constant with this name and get the tag */
|
||||
ref=findglb(enumroot->name);
|
||||
if (ref!=NULL) {
|
||||
@ -3919,7 +3920,7 @@ static void make_report(symbol *root,FILE *log,char *sourcefile)
|
||||
continue;
|
||||
if ((sym->usage & uREAD)==0 || (sym->usage & (uENUMFIELD | uENUMROOT))!=0)
|
||||
continue;
|
||||
fprintf(log,"\t\t<member name=\"C:%s\" value=\"%ld\">\n",funcdisplayname(symname,sym->name),sym->addr);
|
||||
fprintf(log,"\t\t<member name=\"C:%s\" value=\"%ld\">\n",funcdisplayname(symname,sym->name),(long)sym->addr);
|
||||
if (sym->tag!=0) {
|
||||
tagsym=find_tag_byval(sym->tag);
|
||||
assert(tagsym!=NULL);
|
||||
@ -4039,7 +4040,7 @@ static void make_report(symbol *root,FILE *log,char *sourcefile)
|
||||
for (arg=0; sym->dim.arglist[arg].ident!=0; arg++) {
|
||||
int dim,paraminfo;
|
||||
char *outer_start,*inner_start;
|
||||
int outer_length,inner_length;
|
||||
int outer_length=0,inner_length=0;
|
||||
if (sym->dim.arglist[arg].ident==iVARARGS)
|
||||
fprintf(log,"\t\t\t<param name=\"...\">\n");
|
||||
else
|
||||
@ -5248,7 +5249,7 @@ static void doreturn(void)
|
||||
if ((rettype & uRETVALUE)!=0) {
|
||||
int retarray=(ident==iARRAY || ident==iREFARRAY);
|
||||
/* there was an earlier "return" statement in this function */
|
||||
if (sub==NULL && retarray || sub!=NULL && !retarray)
|
||||
if ((sub==NULL && retarray) || (sub!=NULL && !retarray))
|
||||
error(79); /* mixing "return array;" and "return value;" */
|
||||
} /* if */
|
||||
rettype|=uRETVALUE; /* function returns a value */
|
||||
@ -5257,7 +5258,7 @@ static void doreturn(void)
|
||||
if (!matchtag(curfunc->tag,tag,TRUE))
|
||||
error(213); /* tagname mismatch */
|
||||
if (ident==iARRAY || ident==iREFARRAY) {
|
||||
int dim[sDIMEN_MAX],numdim;
|
||||
int dim[sDIMEN_MAX],numdim=0;
|
||||
cell arraysize;
|
||||
assert(sym!=NULL);
|
||||
if (sub!=NULL) {
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include "sc.h"
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
#include <sclinux.h>
|
||||
#endif
|
||||
|
||||
@ -198,7 +198,7 @@ SC_FUNC int plungefile(char *name,int try_currentpath,int try_includepaths)
|
||||
char path[_MAX_PATH];
|
||||
strncpy(path,ptr,sizeof path);
|
||||
path[sizeof path - 1]='\0'; /* force '\0' termination */
|
||||
strncat(path,name,sizeof(path)-strlen(path));
|
||||
strncat(path,name,sizeof(path) - strlen(path) - 1);
|
||||
path[sizeof path - 1]='\0';
|
||||
result=plungequalifiedfile(path);
|
||||
} /* while */
|
||||
@ -408,7 +408,7 @@ static void stripcom(unsigned char *line)
|
||||
#if !defined SC_LIGHT
|
||||
/* collect the comment characters in a string */
|
||||
if (icomment==2) {
|
||||
if (skipstar && (*line!='\0' && *line<=' ' || *line=='*')) {
|
||||
if (skipstar && ((*line!='\0' && *line<=' ') || *line=='*')) {
|
||||
/* ignore leading whitespace and '*' characters */
|
||||
} else if (commentidx<COMMENT_LIMIT+COMMENT_MARGIN-1) {
|
||||
comment[commentidx++]=(char)((*line!='\n') ? *line : ' ');
|
||||
@ -585,22 +585,9 @@ static int htoi(cell *val,const unsigned char *curptr)
|
||||
}
|
||||
|
||||
#if defined __GNUC__
|
||||
static double pow10(int value)
|
||||
static double pow10(double d)
|
||||
{
|
||||
double res=1.0;
|
||||
while (value>=4) {
|
||||
res*=10000.0;
|
||||
value-=5;
|
||||
} /* while */
|
||||
while (value>=2) {
|
||||
res*=100.0;
|
||||
value-=2;
|
||||
} /* while */
|
||||
while (value>=1) {
|
||||
res*=10.0;
|
||||
value-=1;
|
||||
} /* while */
|
||||
return res;
|
||||
return pow(10, d);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1210,7 +1197,7 @@ static int command(void)
|
||||
sym=findloc(str);
|
||||
if (sym==NULL)
|
||||
sym=findglb(str);
|
||||
if (sym==NULL || sym->ident!=iFUNCTN && sym->ident!=iREFFUNC && (sym->usage & uDEFINE)==0) {
|
||||
if (sym==NULL || (sym->ident!=iFUNCTN && sym->ident!=iREFFUNC && (sym->usage & uDEFINE)==0)) {
|
||||
error(17,str); /* undefined symbol */
|
||||
} else {
|
||||
outval(sym->addr,FALSE);
|
||||
@ -1644,7 +1631,7 @@ static void substallpatterns(unsigned char *line,int buffersize)
|
||||
if (strncmp((char*)start,"defined",7)==0 && !isalpha((char)*(start+7))) {
|
||||
start+=7; /* skip "defined" */
|
||||
/* skip white space & parantheses */
|
||||
while (*start<=' ' && *start!='\0' || *start=='(')
|
||||
while ((*start<=' ' && *start!='\0') || *start=='(')
|
||||
start++;
|
||||
/* skip the symbol behind it */
|
||||
while (isalpha(*start) || isdigit(*start) || *start=='_')
|
||||
@ -1946,7 +1933,7 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
|
||||
error(220);
|
||||
} /* if */
|
||||
} /* if */
|
||||
} else if (*lptr=='\"' || *lptr==sc_ctrlchar && *(lptr+1)=='\"')
|
||||
} else if (*lptr=='\"' || (*lptr==sc_ctrlchar && *(lptr+1)=='\"'))
|
||||
{ /* unpacked string literal */
|
||||
_lextok=tSTRING;
|
||||
stringflags= (*lptr==sc_ctrlchar) ? RAWMODE : 0;
|
||||
@ -1959,9 +1946,9 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym)
|
||||
lptr+=1; /* skip final quote */
|
||||
else
|
||||
error(37); /* invalid (non-terminated) string */
|
||||
} else if (*lptr=='!' && *(lptr+1)=='\"'
|
||||
|| *lptr=='!' && *(lptr+1)==sc_ctrlchar && *(lptr+2)=='\"'
|
||||
|| *lptr==sc_ctrlchar && *(lptr+1)=='!' && *(lptr+2)=='\"')
|
||||
} else if ((*lptr=='!' && *(lptr+1)=='\"')
|
||||
|| (*lptr=='!' && *(lptr+1)==sc_ctrlchar && *(lptr+2)=='\"')
|
||||
|| (*lptr==sc_ctrlchar && *(lptr+1)=='!' && *(lptr+2)=='\"'))
|
||||
{ /* packed string literal */
|
||||
_lextok=tSTRING;
|
||||
stringflags= (*lptr==sc_ctrlchar || *(lptr+1)==sc_ctrlchar) ? RAWMODE : 0;
|
||||
@ -2053,7 +2040,7 @@ SC_FUNC int matchtoken(int token)
|
||||
int tok;
|
||||
|
||||
tok=lex(&val,&str);
|
||||
if (tok==token || token==tTERM && (tok==';' || tok==tENDEXPR)) {
|
||||
if (tok==token || (token==tTERM && (tok==';' || tok==tENDEXPR))) {
|
||||
return 1;
|
||||
} else if (!sc_needsemicolon && token==tTERM && (_lexnewline || !freading)) {
|
||||
/* Push "tok" back, because it is the token following the implicit statement
|
||||
@ -2418,7 +2405,7 @@ SC_FUNC void delete_symbols(symbol *root,int level,int delete_labels,int delete_
|
||||
{
|
||||
symbol *sym,*parent_sym;
|
||||
constvalue *stateptr;
|
||||
int mustdelete;
|
||||
int mustdelete=0;
|
||||
|
||||
/* erase only the symbols with a deeper nesting level than the
|
||||
* specified nesting level */
|
||||
|
@ -929,7 +929,7 @@ static int hier14(value *lval1)
|
||||
} /* if */
|
||||
if (lval3.sym->dim.array.level!=level)
|
||||
return error(48); /* array dimensions must match */
|
||||
else if (ltlength<val || exactmatch && ltlength>val || val==0)
|
||||
else if (ltlength<val || (exactmatch && ltlength>val) || val==0)
|
||||
return error(47); /* array sizes must match */
|
||||
else if (lval3.ident!=iARRAYCELL && !matchtag(lval3.sym->x.idxtag,idxtag,TRUE))
|
||||
error(229,(lval2.sym!=NULL) ? lval2.sym->name : lval3.sym->name); /* index tag mismatch */
|
||||
@ -1124,7 +1124,7 @@ static int hier2(value *lval)
|
||||
int tag,paranthese;
|
||||
cell val;
|
||||
char *st;
|
||||
symbol *sym;
|
||||
symbol *sym=NULL;
|
||||
int saveresult;
|
||||
|
||||
tok=lex(&val,&st);
|
||||
@ -1247,7 +1247,7 @@ static int hier2(value *lval)
|
||||
lval->constval=1; /* preset */
|
||||
if (sym->ident==iARRAY || sym->ident==iREFARRAY) {
|
||||
int level;
|
||||
symbol *idxsym;
|
||||
symbol *idxsym=NULL;
|
||||
for (level=0; matchtoken('['); level++) {
|
||||
idxsym=NULL;
|
||||
if (level==sym->dim.array.level && matchtoken(tSYMBOL)) {
|
||||
@ -1293,7 +1293,7 @@ static int hier2(value *lval)
|
||||
} /* if */
|
||||
if (sym->ident==iARRAY || sym->ident==iREFARRAY) {
|
||||
int level;
|
||||
symbol *idxsym;
|
||||
symbol *idxsym=NULL;
|
||||
for (level=0; matchtoken('['); level++) {
|
||||
idxsym=NULL;
|
||||
if (level==sym->dim.array.level && matchtoken(tSYMBOL)) {
|
||||
@ -1462,7 +1462,7 @@ restart:
|
||||
} /* if */
|
||||
if (close==']') {
|
||||
/* normal array index */
|
||||
if (lval2.constval<0 || sym->dim.array.length!=0 && sym->dim.array.length<=lval2.constval)
|
||||
if (lval2.constval<0 || (sym->dim.array.length!=0 && sym->dim.array.length<=lval2.constval))
|
||||
error(32,sym->name); /* array index out of bounds */
|
||||
if (lval2.constval!=0) {
|
||||
/* don't add offsets for zero subscripts */
|
||||
@ -1479,8 +1479,8 @@ restart:
|
||||
} /* if */
|
||||
} else {
|
||||
/* character index */
|
||||
if (lval2.constval<0 || sym->dim.array.length!=0
|
||||
&& sym->dim.array.length*((8*sizeof(cell))/sCHARBITS)<=(ucell)lval2.constval)
|
||||
if (lval2.constval<0 || (sym->dim.array.length!=0
|
||||
&& sym->dim.array.length*((8*sizeof(cell))/sCHARBITS)<=(ucell)lval2.constval))
|
||||
error(32,sym->name); /* array index out of bounds */
|
||||
if (lval2.constval!=0) {
|
||||
/* don't add offsets for zero subscripts */
|
||||
@ -2035,8 +2035,8 @@ static int nesting=0;
|
||||
* function argument; a literal string may be smaller than
|
||||
* the function argument.
|
||||
*/
|
||||
if (lval.constval>0 && arg[argidx].dim[0]!=lval.constval
|
||||
|| lval.constval<0 && arg[argidx].dim[0] < -lval.constval)
|
||||
if ((lval.constval>0 && arg[argidx].dim[0]!=lval.constval)
|
||||
|| (lval.constval<0 && arg[argidx].dim[0] < -lval.constval))
|
||||
error(47); /* array sizes must match */
|
||||
} /* if */
|
||||
} /* if */
|
||||
|
@ -235,7 +235,7 @@ SC_FUNC void begdseg(void)
|
||||
|
||||
SC_FUNC void setline(int chkbounds)
|
||||
{
|
||||
if ((sc_debug & sSYMBOLIC)!=0 || chkbounds && (sc_debug & sCHKBOUNDS)!=0) {
|
||||
if ((sc_debug & sSYMBOLIC)!=0 || (chkbounds && (sc_debug & sCHKBOUNDS)!=0)) {
|
||||
/* generate a "break" (start statement) opcode rather than a "line" opcode
|
||||
* because earlier versions of Small/Pawn have an incompatible version of the
|
||||
* line opcode
|
||||
@ -719,7 +719,7 @@ SC_FUNC void ffcall(symbol *sym,const char *label,int numargs)
|
||||
stgwrite(sym->name);
|
||||
} /* if */
|
||||
if (sc_asmfile
|
||||
&& (label!=NULL || !isalpha(sym->name[0]) && sym->name[0]!='_' && sym->name[0]!=sc_ctrlchar))
|
||||
&& (label!=NULL || (!isalpha(sym->name[0]) && sym->name[0]!='_' && sym->name[0]!=sc_ctrlchar)))
|
||||
{
|
||||
stgwrite("\t; ");
|
||||
stgwrite(symname);
|
||||
|
@ -25,7 +25,7 @@
|
||||
#if defined __WIN32__ || defined _WIN32 || defined __MSDOS__
|
||||
#include <io.h>
|
||||
#endif
|
||||
#if defined LINUX || defined __GNUC__
|
||||
#if defined LINUX || defined __APPLE__ || defined __GNUC__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
@ -132,7 +132,7 @@ static short lastfile;
|
||||
} /* if */
|
||||
va_end(argptr);
|
||||
|
||||
if (number>=100 && number<200 || errnum>25){
|
||||
if ((number>=100 && number<200) || errnum>25){
|
||||
if (strlen(errfname)==0) {
|
||||
va_start(argptr,number);
|
||||
pc_error(0,"\nCompilation aborted.",NULL,0,0,argptr);
|
||||
|
@ -30,7 +30,7 @@
|
||||
#endif
|
||||
#include "sc.h"
|
||||
#include "amxdbg.h"
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
#include <sclinux.h>
|
||||
#endif
|
||||
|
||||
@ -895,7 +895,7 @@ SC_FUNC int assemble(FILE *fout,FILE *fin)
|
||||
instr=skipwhitespace(line);
|
||||
/* ignore empty lines and labels (labels have a special syntax, so these
|
||||
* must be parsed separately) */
|
||||
if (*instr=='\0' || tolower(*instr)=='l' && *(instr+1)=='.')
|
||||
if (*instr=='\0' || (tolower(*instr)=='l' && *(instr+1)=='.'))
|
||||
continue;
|
||||
/* get to the end of the instruction (make use of the '\n' that fgets()
|
||||
* added at the end of the line; this way we will *always* drop on a
|
||||
|
@ -457,18 +457,18 @@ static int matchsequence(char *start,char *end,char *pattern,
|
||||
case ' ':
|
||||
if (*start!='\t' && *start!=' ')
|
||||
return FALSE;
|
||||
while (start<end && *start=='\t' || *start==' ')
|
||||
while ((start<end && *start=='\t') || *start==' ')
|
||||
start++;
|
||||
break;
|
||||
case '!':
|
||||
while (start<end && *start=='\t' || *start==' ')
|
||||
while ((start<end && *start=='\t') || *start==' ')
|
||||
start++; /* skip trailing white space */
|
||||
if (*start!='\n')
|
||||
return FALSE;
|
||||
assert(*(start+1)=='\0');
|
||||
start+=2; /* skip '\n' and '\0' */
|
||||
if (*(pattern+1)!='\0')
|
||||
while (start<end && *start=='\t' || *start==' ')
|
||||
while ((start<end && *start=='\t') || *start==' ')
|
||||
start++; /* skip leading white space of next instruction */
|
||||
break;
|
||||
default:
|
||||
|
@ -47,7 +47,7 @@
|
||||
#define _MAX_PATH 250
|
||||
#endif
|
||||
#if !defined DIRSEP_CHAR
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE___
|
||||
#define DIRSEP_CHAR '/'
|
||||
#elif defined macintosh
|
||||
#define DIRSEP_CHAR ':'
|
||||
@ -339,7 +339,7 @@ SC_FUNC cell get_utf8_char(const unsigned char *string,const unsigned char **end
|
||||
/* the code positions 0xd800--0xdfff and 0xfffe & 0xffff do not
|
||||
* exist in UCS-4 (and hence, they do not exist in Unicode)
|
||||
*/
|
||||
if (result>=0xd800 && result<=0xdfff || result==0xfffe || result==0xffff)
|
||||
if ((result>=0xd800 && result<=0xdfff) || result==0xfffe || result==0xffff)
|
||||
return -1;
|
||||
} /* if */
|
||||
break;
|
||||
|
@ -32,6 +32,10 @@
|
||||
*/
|
||||
#if !defined __BYTE_ORDER
|
||||
# include <stdlib.h>
|
||||
# if defined __APPLE__
|
||||
# include <sys/types.h>
|
||||
# define __BYTE_ORDER BYTE_ORDER
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined __OpenBSD__ || defined __FreeBSD__
|
||||
|
@ -238,7 +238,7 @@ SC_FUNC stringlist *insert_path(char *path)
|
||||
{
|
||||
char *extra_path = malloc(strlen(path) + 16);
|
||||
strcpy(extra_path, path);
|
||||
#if defined __linux__
|
||||
#if defined __linux__ || defined __APPLE__
|
||||
strcat(extra_path, "/amxmod_compat/");
|
||||
#elif defined WIN32 || defined _WIN32
|
||||
strcat(extra_path, "\\amxmod_compat\\");
|
||||
@ -444,10 +444,10 @@ SC_FUNC stringlist *insert_dbgsymbol(symbol *sym)
|
||||
/* address tag:name codestart codeend ident vclass [tag:dim ...] */
|
||||
#if PAWN_CELL_SIZE==32
|
||||
if (sym->ident==iFUNCTN)
|
||||
sprintf(string,"S:%08lx %x:%s %08lx %08lx %x %x",sym->addr,sym->tag,
|
||||
sprintf(string,"S:%08x %x:%s %08x %08x %x %x",sym->addr,sym->tag,
|
||||
symname,sym->addr,sym->codeaddr,sym->ident,sym->vclass);
|
||||
else
|
||||
sprintf(string,"S:%08lx %x:%s %08lx %08lx %x %x",sym->addr,sym->tag,
|
||||
sprintf(string,"S:%08x %x:%s %08x %08x %x %x",sym->addr,sym->tag,
|
||||
symname,sym->codeaddr,code_idx,sym->ident,sym->vclass);
|
||||
#elif PAWN_CELL_SIZE==64
|
||||
if (sym->ident==iFUNCTN)
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "sc.h"
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
|
||||
#include <sclinux.h>
|
||||
#endif
|
||||
|
||||
|
@ -261,6 +261,116 @@
|
||||
cstrike_item_candrop 63
|
||||
cstrike_item_getmaxspeed 78
|
||||
@end
|
||||
|
||||
@section cstrike mac
|
||||
pev 4
|
||||
base 0x0
|
||||
|
||||
spawn 0
|
||||
precache 1
|
||||
keyvalue 3
|
||||
objectcaps 6
|
||||
activate 7
|
||||
setobjectcollisionbox 8
|
||||
classify 9
|
||||
deathnotice 10
|
||||
traceattack 11
|
||||
takedamage 12
|
||||
takehealth 13
|
||||
killed 14
|
||||
bloodcolor 15
|
||||
tracebleed 16
|
||||
istriggered 17
|
||||
mymonsterpointer 18
|
||||
mysquadmonsterpointer 19
|
||||
gettogglestate 20
|
||||
addpoints 21
|
||||
addpointstoteam 22
|
||||
addplayeritem 23
|
||||
removeplayeritem 24
|
||||
giveammo 25
|
||||
getdelay 26
|
||||
ismoving 27
|
||||
overridereset 28
|
||||
damagedecal 29
|
||||
settogglestate 30
|
||||
startsneaking 31
|
||||
stopsneaking 32
|
||||
oncontrols 33
|
||||
issneaking 34
|
||||
isalive 35
|
||||
isbspmodel 36
|
||||
reflectgauss 37
|
||||
hastarget 38
|
||||
isinworld 39
|
||||
isplayer 40
|
||||
isnetclient 41
|
||||
teamid 42
|
||||
getnexttarget 43
|
||||
think 44
|
||||
touch 45
|
||||
use 46
|
||||
blocked 47
|
||||
respawn 48
|
||||
updateowner 49
|
||||
fbecomeprone 50
|
||||
center 51
|
||||
eyeposition 52
|
||||
earposition 53
|
||||
bodytarget 54
|
||||
illumination 55
|
||||
fvisible 56
|
||||
fvecvisible 57
|
||||
|
||||
player_jump 76
|
||||
player_duck 77
|
||||
player_prethink 78
|
||||
player_postthink 79
|
||||
player_getgunposition 80
|
||||
player_shouldfadeondeath 66
|
||||
player_impulsecommands 83
|
||||
player_updateclientdata 82
|
||||
|
||||
item_addtoplayer 59
|
||||
item_addduplicate 60
|
||||
item_getiteminfo 61
|
||||
item_candeploy 62
|
||||
item_deploy 64
|
||||
item_canholster 66
|
||||
item_holster 67
|
||||
item_updateiteminfo 68
|
||||
item_preframe 69
|
||||
item_postframe 70
|
||||
item_drop 71
|
||||
item_kill 72
|
||||
item_attachtoplayer 73
|
||||
item_primaryammoindex 74
|
||||
item_secondaryammoindex 75
|
||||
item_updateclientdata 76
|
||||
item_getweaponptr 77
|
||||
item_itemslot 79
|
||||
|
||||
weapon_extractammo 80
|
||||
weapon_extractclipammo 81
|
||||
weapon_addweapon 82
|
||||
weapon_playemptysound 83
|
||||
weapon_resetemptysound 84
|
||||
weapon_sendweaponanim 85
|
||||
weapon_isusable 86
|
||||
weapon_primaryattack 87
|
||||
weapon_secondaryattack 88
|
||||
weapon_reload 89
|
||||
weapon_weaponidle 90
|
||||
weapon_retireweapon 91
|
||||
weapon_shouldweaponidle 92
|
||||
weapon_usedecrement 93
|
||||
|
||||
cstrike_restart 2
|
||||
cstrike_roundrespawn 84
|
||||
cstrike_item_candrop 63
|
||||
cstrike_item_getmaxspeed 78
|
||||
@end
|
||||
|
||||
@section dod linux
|
||||
pev 0
|
||||
base 0x154
|
||||
@ -1747,8 +1857,112 @@
|
||||
weapon_retireweapon 87
|
||||
weapon_shouldweaponidle 88
|
||||
weapon_usedecrement 89
|
||||
|
||||
@end
|
||||
|
||||
@section valve mac
|
||||
pev 4
|
||||
base 0x0
|
||||
|
||||
spawn 0
|
||||
precache 1
|
||||
keyvalue 2
|
||||
objectcaps 5
|
||||
activate 6
|
||||
setobjectcollisionbox 7
|
||||
classify 8
|
||||
deathnotice 9
|
||||
traceattack 10
|
||||
takedamage 11
|
||||
takehealth 12
|
||||
killed 13
|
||||
bloodcolor 14
|
||||
tracebleed 15
|
||||
istriggered 16
|
||||
mymonsterpointer 17
|
||||
mysquadmonsterpointer 18
|
||||
gettogglestate 19
|
||||
addpoints 20
|
||||
addpointstoteam 21
|
||||
addplayeritem 22
|
||||
removeplayeritem 23
|
||||
giveammo 24
|
||||
getdelay 25
|
||||
ismoving 26
|
||||
overridereset 27
|
||||
damagedecal 28
|
||||
settogglestate 29
|
||||
startsneaking 30
|
||||
stopsneaking 31
|
||||
oncontrols 32
|
||||
issneaking 33
|
||||
isalive 34
|
||||
isbspmodel 35
|
||||
reflectgauss 36
|
||||
hastarget 37
|
||||
isinworld 38
|
||||
isplayer 39
|
||||
isnetclient 40
|
||||
teamid 41
|
||||
getnexttarget 42
|
||||
think 43
|
||||
touch 44
|
||||
use 45
|
||||
blocked 46
|
||||
respawn 47
|
||||
updateowner 48
|
||||
fbecomeprone 49
|
||||
center 50
|
||||
eyeposition 51
|
||||
earposition 52
|
||||
bodytarget 53
|
||||
illumination 54
|
||||
fvisible 55
|
||||
fvecvisible 56
|
||||
|
||||
player_jump 125
|
||||
player_duck 126
|
||||
player_prethink 127
|
||||
player_postthink 128
|
||||
player_getgunposition 119
|
||||
player_shouldfadeondeath 60
|
||||
player_impulsecommands 130
|
||||
player_updateclientdata 129
|
||||
|
||||
item_addtoplayer 58
|
||||
item_addduplicate 59
|
||||
item_getiteminfo 60
|
||||
item_candeploy 61
|
||||
item_deploy 62
|
||||
item_canholster 63
|
||||
item_holster 64
|
||||
item_updateiteminfo 65
|
||||
item_preframe 66
|
||||
item_postframe 67
|
||||
item_drop 68
|
||||
item_kill 69
|
||||
item_attachtoplayer 70
|
||||
item_primaryammoindex 71
|
||||
item_secondaryammoindex 72
|
||||
item_updateclientdata 73
|
||||
item_getweaponptr 74
|
||||
item_itemslot 75
|
||||
|
||||
weapon_extractammo 76
|
||||
weapon_extractclipammo 77
|
||||
weapon_addweapon 78
|
||||
weapon_playemptysound 79
|
||||
weapon_resetemptysound 80
|
||||
weapon_sendweaponanim 81
|
||||
weapon_isusable 82
|
||||
weapon_primaryattack 83
|
||||
weapon_secondaryattack 84
|
||||
weapon_reload 85
|
||||
weapon_weaponidle 86
|
||||
weapon_retireweapon 87
|
||||
weapon_shouldweaponidle 88
|
||||
weapon_usedecrement 89
|
||||
@end
|
||||
|
||||
; Sven-Coop has no linux binaries. This makes disassembly much harder.
|
||||
; These offsets were contributed by ts2do
|
||||
@section SvenCoop windows
|
||||
|
@ -1,10 +1,14 @@
|
||||
#include <assert.h>
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include "cstrike.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#include <sys/mman.h>
|
||||
#define PAGE_EXECUTE_READWRITE PROT_READ|PROT_WRITE|PROT_EXEC
|
||||
|
||||
#if defined(__linux)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Utils */
|
||||
@ -65,7 +69,7 @@ void CtrlDetour_ClientCommand(bool set)
|
||||
|
||||
if (!g_UseBotArgs)
|
||||
{
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
/* Find the DLL */
|
||||
char dll[256];
|
||||
if (!UTIL_GetLibraryOfAddress(target, dll, sizeof(dll)))
|
||||
@ -102,7 +106,7 @@ void CtrlDetour_ClientCommand(bool set)
|
||||
*(unsigned long *)paddr = (unsigned long)Detour_ClientCommand - (unsigned long)(paddr + 4);
|
||||
|
||||
/* Copy original bytes onto the end of the function */
|
||||
memcpy(&FullDetour[DetourBytes], target, CS_DETOURCOPYBYTES_CLIENTCOMMAND);
|
||||
memcpy(&FullDetour[DetourBytes], target, CS_DETOURCOPYBYTES_CLIENTCOMMAND);
|
||||
|
||||
/* Patch and copy the final jmp */
|
||||
paddr = &FullDetour[DetourJmpPos];
|
||||
@ -142,8 +146,12 @@ unsigned char *UTIL_CodeAlloc(size_t size)
|
||||
{
|
||||
#if defined WIN32
|
||||
return (unsigned char *)VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
#elif defined __GNUC__
|
||||
#if defined __APPLE__
|
||||
unsigned char *addr = (unsigned char *)valloc(size);
|
||||
#else
|
||||
unsigned char *addr = (unsigned char *)memalign(sysconf(_SC_PAGESIZE), size);
|
||||
#endif
|
||||
mprotect(addr, size, PROT_READ|PROT_WRITE|PROT_EXEC);
|
||||
return addr;
|
||||
#endif
|
||||
@ -160,7 +168,7 @@ void UTIL_CodeFree(unsigned char *addr)
|
||||
|
||||
void UTIL_MemProtect(void *addr, int length, int prot)
|
||||
{
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#define ALIGN(ar) ((long)ar & ~(sysconf(_SC_PAGESIZE)-1))
|
||||
void *addr2 = (void *)ALIGN(addr);
|
||||
mprotect(addr2, sysconf(_SC_PAGESIZE), prot);
|
||||
@ -172,7 +180,7 @@ void UTIL_MemProtect(void *addr, int length, int prot)
|
||||
|
||||
bool UTIL_GetLibraryOfAddress(void *memInBase, char *buffer, size_t maxlength)
|
||||
{
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
Dl_info info;
|
||||
if (!dladdr(memInBase, &info))
|
||||
{
|
||||
|
@ -1,78 +1,123 @@
|
||||
#(C)2004-2005 AMX Mod X Development Team
|
||||
# (C)2004-2013 AMX Mod X Development Team
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
HLSDK = ../../../../hlsdk
|
||||
###########################################
|
||||
### EDIT THESE PATHS FOR YOUR OWN SETUP ###
|
||||
###########################################
|
||||
|
||||
HLSDK = ../../../../hlsdk/multiplayer
|
||||
MM_ROOT = ../../../../metamod/metamod
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
#####################################
|
||||
|
||||
OPT_FLAGS = -O2 -funroll-loops -s -pipe -fomit-frame-pointer -fno-strict-aliasing
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc-4.1
|
||||
NAME = cstrike
|
||||
|
||||
BIN_SUFFIX_32 = amxx_i386.so
|
||||
BIN_SUFFIX_64 = amxx_amd64.so
|
||||
PROJECT = cstrike
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp CstrikePlayer.cpp cstrike.cpp CstrikeHacks.cpp
|
||||
|
||||
LINK =
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
##############################################
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT) -I$(HLSDK)/common -Isdk
|
||||
C_OPT_FLAGS = -DNDEBUG -O2 -funroll-loops -fomit-frame-pointer -pipe
|
||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||
C_GCC4_FLAGS = -fvisibility=hidden
|
||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||
CPP = gcc
|
||||
CPP_OSX = clang
|
||||
|
||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
LINK =
|
||||
|
||||
ifeq "$(GCC_VERSION)" "4"
|
||||
OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT) -Isdk
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
################################################
|
||||
|
||||
OS := $(shell uname -s)
|
||||
|
||||
ifeq "$(OS)" "Darwin"
|
||||
CPP = $(CPP_OSX)
|
||||
LIB_EXT = dylib
|
||||
LIB_SUFFIX = _amxx
|
||||
CFLAGS += -DOSX
|
||||
LINK += -dynamiclib -lstdc++ -mmacosx-version-min=10.5
|
||||
else
|
||||
LIB_EXT = so
|
||||
LIB_SUFFIX = _amxx_i386
|
||||
CFLAGS += -DLINUX
|
||||
LINK += -shared
|
||||
endif
|
||||
|
||||
LINK += -m32 -lm -ldl
|
||||
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 -DHAVE_STDINT_H -fno-strict-aliasing -m32 -Wall -Werror
|
||||
CPPFLAGS += -fno-exceptions -fno-rtti
|
||||
|
||||
BINARY = $(PROJECT)$(LIB_SUFFIX).$(LIB_EXT)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
BIN_DIR = Debug
|
||||
CFLAGS = $(DEBUG_FLAGS)
|
||||
CFLAGS += $(C_DEBUG_FLAGS)
|
||||
else
|
||||
BIN_DIR = Release
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
CFLAGS += $(C_OPT_FLAGS)
|
||||
LINK += -s
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc -m32
|
||||
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
ifeq "$(IS_CLANG)" "1"
|
||||
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
|
||||
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
|
||||
else
|
||||
BINARY = $(NAME)_$(BIN_SUFFIX_32)
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
OPT_FLAGS += -march=i586
|
||||
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
|
||||
endif
|
||||
|
||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
# Clang || GCC >= 4
|
||||
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
|
||||
CFLAGS += $(C_GCC4_FLAGS)
|
||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||
endif
|
||||
|
||||
# Clang >= 3 || GCC >= 4.7
|
||||
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
|
||||
CFLAGS += -Wno-delete-non-virtual-dtor
|
||||
endif
|
||||
|
||||
# OS is Linux and not using clang
|
||||
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
|
||||
LINK += -static-libgcc
|
||||
endif
|
||||
|
||||
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
|
||||
# This will break if we include other Makefiles, but is fine for now. It allows
|
||||
# us to make a copy of this file that uses altered paths (ie. Makefile.mine)
|
||||
# or other changes without mucking up the original.
|
||||
MAKEFILE_NAME := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
|
||||
$(BIN_DIR)/%.o: %.cpp
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
$(MAKE) cstrike
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
amd64:
|
||||
$(MAKE) all AMD64=true
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||
|
||||
cstrike: $(OBJ_LINUX)
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
||||
|
||||
debug:
|
||||
$(MAKE) all DEBUG=true
|
||||
debug:
|
||||
$(MAKE) -f $(MAKEFILE_NAME) all DEBUG=true
|
||||
|
||||
default: all
|
||||
|
||||
clean:
|
||||
rm -rf Release/sdk/*.o
|
||||
rm -rf Release/*.o
|
||||
rm -rf Release/$(NAME)_$(BIN_SUFFIX_32)
|
||||
rm -rf Release/$(NAME)_$(BIN_SUFFIX_64)
|
||||
rm -rf Debug/sdk/*.o
|
||||
rm -rf Debug/*.o
|
||||
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_32)
|
||||
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_64)
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
@ -49,7 +49,7 @@ bool UTIL_IsPlayer(AMX* amx, edict_t* pPlayer) {
|
||||
return player;
|
||||
}
|
||||
|
||||
void UTIL_TextMsg_Generic(edict_t* pPlayer, char* message)
|
||||
void UTIL_TextMsg_Generic(edict_t* pPlayer, const char* message)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, GET_USER_MSG_ID(PLID, "TextMsg", NULL), NULL, pPlayer);
|
||||
WRITE_BYTE(HUD_PRINTCENTER); // 1 = console, 2 = console, 3 = chat, 4 = center
|
||||
@ -746,7 +746,7 @@ static cell AMX_NATIVE_CALL cs_set_user_defusekit(AMX *amx, cell *params) // cs_
|
||||
|
||||
pPlayer->v.body = 1;
|
||||
|
||||
char* icon;
|
||||
const char* icon;
|
||||
if (params[6] != -1)
|
||||
{
|
||||
int len;
|
||||
|
@ -44,7 +44,7 @@
|
||||
#define GETCLIENTKEYVALUE (*g_engfuncs.pfnInfoKeyValue)
|
||||
#define CREATENAMEDENTITY (*g_engfuncs.pfnCreateNamedEntity)
|
||||
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined (__APPLE__)
|
||||
#define EXTRAOFFSET 5 // offsets 5 higher in Linux builds
|
||||
#define EXTRAOFFSET_WEAPONS 4 // weapon offsets are obviously only 4 steps higher on Linux!
|
||||
#define ACTUAL_EXTRA_OFFSET 20 // actual, byte-addressable offset
|
||||
@ -52,7 +52,7 @@
|
||||
#define EXTRAOFFSET 0 // no change in Windows builds
|
||||
#define EXTRAOFFSET_WEAPONS 0
|
||||
#define ACTUAL_EXTRA_OFFSET 0
|
||||
#endif // defined __linux__
|
||||
#endif // defined(__linux__) || defined(__APPLE__)
|
||||
/*
|
||||
Offset history:
|
||||
041029:
|
||||
@ -158,6 +158,8 @@
|
||||
|
||||
#if defined __linux__
|
||||
#define CS_DETOURCOPYBYTES_CLIENTCOMMAND 6
|
||||
#elif defined __APPLE__
|
||||
#define CS_DETOURCOPYBYTES_CLIENTCOMMAND 5
|
||||
#else
|
||||
#define CS_DETOURCOPYBYTES_CLIENTCOMMAND 6
|
||||
#define CS_CLICMD_OFFS_USEBOTARGS 2
|
||||
|
@ -2240,7 +2240,7 @@ static META_FUNCTIONS g_MetaFunctions_Table =
|
||||
GetEngineFunctions_Post
|
||||
};
|
||||
|
||||
C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
C_DLLEXPORT int Meta_Query(const char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
{
|
||||
if ((int) CVAR_GET_FLOAT("developer") != 0)
|
||||
UTIL_LogPrintf("[%s] dev: called: Meta_Query; version=%s, ours=%s\n",
|
||||
@ -2334,7 +2334,7 @@ C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
|
||||
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
// linux prototype
|
||||
C_DLLEXPORT void GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) {
|
||||
|
||||
@ -3050,7 +3050,7 @@ char* UTIL_VarArgs( char *format, ... )
|
||||
// UTIL_LogPrintf - Prints a logged message to console.
|
||||
// Preceded by LOG: ( timestamp ) < message >
|
||||
//=========================================================
|
||||
void UTIL_LogPrintf( char *fmt, ... )
|
||||
void UTIL_LogPrintf( const char *fmt, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
static char string[1024];
|
||||
|
@ -20,11 +20,16 @@
|
||||
|
||||
// DLL Export
|
||||
#undef DLLEXPORT
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) && !defined(LINUX)
|
||||
#define LINUX
|
||||
#elif defined(__APPLE__) && !defined(OSX)
|
||||
#define OSX
|
||||
#endif
|
||||
|
||||
#undef C_DLLEXPORT
|
||||
@ -66,7 +71,7 @@ struct amxx_module_info_s
|
||||
#if defined HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX || defined __APPLE__
|
||||
#if defined HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
@ -308,7 +313,7 @@ typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
|
||||
#endif
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=mac68k
|
||||
@ -395,7 +400,7 @@ enum {
|
||||
};
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#pragma pack() /* reset default packing */
|
||||
#else
|
||||
#pragma pack(pop) /* reset previous packing */
|
||||
@ -406,7 +411,7 @@ enum {
|
||||
// ***** declare functions *****
|
||||
|
||||
#ifdef USE_METAMOD
|
||||
void UTIL_LogPrintf( char *fmt, ... );
|
||||
void UTIL_LogPrintf( const char *fmt, ... );
|
||||
void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, const char *pMessage);
|
||||
short FixedSigned16( float value, float scale );
|
||||
unsigned short FixedUnsigned16( float value, float scale );
|
||||
@ -833,11 +838,11 @@ int FN_AllowLagCompensation_Post(void);
|
||||
|
||||
|
||||
#ifdef FN_PrecacheModel
|
||||
int FN_PrecacheModel(char *s);
|
||||
int FN_PrecacheModel(const char *s);
|
||||
#endif // FN_PrecacheModel
|
||||
|
||||
#ifdef FN_PrecacheSound
|
||||
int FN_PrecacheSound(char *s);
|
||||
int FN_PrecacheSound(const char *s);
|
||||
#endif // FN_PrecacheSound
|
||||
|
||||
#ifdef FN_SetModel
|
||||
@ -857,7 +862,7 @@ void FN_SetSize(edict_t *e, const float *rgflMin, const float *rgflMax);
|
||||
#endif // FN_SetSize
|
||||
|
||||
#ifdef FN_ChangeLevel
|
||||
void FN_ChangeLevel(char *s1, char *s2);
|
||||
void FN_ChangeLevel(const char *s1, const char *s2);
|
||||
#endif // FN_ChangeLevel
|
||||
|
||||
#ifdef FN_GetSpawnParms
|
||||
@ -1261,19 +1266,19 @@ char *FN_GetInfoKeyBuffer(edict_t *e);
|
||||
#endif // FN_GetInfoKeyBuffer
|
||||
|
||||
#ifdef FN_InfoKeyValue
|
||||
char *FN_InfoKeyValue(char *infobuffer, char *key);
|
||||
char *FN_InfoKeyValue(char *infobuffer, const char *key);
|
||||
#endif // FN_InfoKeyValue
|
||||
|
||||
#ifdef FN_SetKeyValue
|
||||
void FN_SetKeyValue(char *infobuffer, char *key, char *value);
|
||||
void FN_SetKeyValue(char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetKeyValue
|
||||
|
||||
#ifdef FN_SetClientKeyValue
|
||||
void FN_SetClientKeyValue(int clientIndex, char *infobuffer, char *key, char *value);
|
||||
void FN_SetClientKeyValue(int clientIndex, char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetClientKeyValue
|
||||
|
||||
#ifdef FN_IsMapValid
|
||||
int FN_IsMapValid(char *filename);
|
||||
int FN_IsMapValid(const char *filename);
|
||||
#endif // FN_IsMapValid
|
||||
|
||||
#ifdef FN_StaticDecal
|
||||
@ -1281,7 +1286,7 @@ void FN_StaticDecal(const float *origin, int decalIndex, int entityIndex, int mo
|
||||
#endif // FN_StaticDecal
|
||||
|
||||
#ifdef FN_PrecacheGeneric
|
||||
int FN_PrecacheGeneric(char *s);
|
||||
int FN_PrecacheGeneric(const char *s);
|
||||
#endif // FN_PrecacheGeneric
|
||||
|
||||
#ifdef FN_GetPlayerUserId
|
||||
@ -1414,11 +1419,11 @@ const char *FN_GetPlayerAuthId(edict_t *e);
|
||||
|
||||
|
||||
#ifdef FN_PrecacheModel_Post
|
||||
int FN_PrecacheModel_Post(char *s);
|
||||
int FN_PrecacheModel_Post(const char *s);
|
||||
#endif // FN_PrecacheModel_Post
|
||||
|
||||
#ifdef FN_PrecacheSound_Post
|
||||
int FN_PrecacheSound_Post(char *s);
|
||||
int FN_PrecacheSound_Post(const char *s);
|
||||
#endif // FN_PrecacheSound_Post
|
||||
|
||||
#ifdef FN_SetModel_Post
|
||||
@ -1438,7 +1443,7 @@ void FN_SetSize_Post(edict_t *e, const float *rgflMin, const float *rgflMax);
|
||||
#endif // FN_SetSize_Post
|
||||
|
||||
#ifdef FN_ChangeLevel_Post
|
||||
void FN_ChangeLevel_Post(char *s1, char *s2);
|
||||
void FN_ChangeLevel_Post(const char *s1, const char *s2);
|
||||
#endif // FN_ChangeLevel_Post
|
||||
|
||||
#ifdef FN_GetSpawnParms_Post
|
||||
@ -1842,19 +1847,19 @@ char *FN_GetInfoKeyBuffer_Post(edict_t *e);
|
||||
#endif // FN_GetInfoKeyBuffer_Post
|
||||
|
||||
#ifdef FN_InfoKeyValue_Post
|
||||
char *FN_InfoKeyValue_Post(char *infobuffer, char *key);
|
||||
char *FN_InfoKeyValue_Post(char *infobuffer, const char *key);
|
||||
#endif // FN_InfoKeyValue_Post
|
||||
|
||||
#ifdef FN_SetKeyValue_Post
|
||||
void FN_SetKeyValue_Post(char *infobuffer, char *key, char *value);
|
||||
void FN_SetKeyValue_Post(char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetKeyValue_Post
|
||||
|
||||
#ifdef FN_SetClientKeyValue_Post
|
||||
void FN_SetClientKeyValue_Post(int clientIndex, char *infobuffer, char *key, char *value);
|
||||
void FN_SetClientKeyValue_Post(int clientIndex, char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetClientKeyValue_Post
|
||||
|
||||
#ifdef FN_IsMapValid_Post
|
||||
int FN_IsMapValid_Post(char *filename);
|
||||
int FN_IsMapValid_Post(const char *filename);
|
||||
#endif // FN_IsMapValid_Post
|
||||
|
||||
#ifdef FN_StaticDecal_Post
|
||||
@ -1862,7 +1867,7 @@ void FN_StaticDecal_Post(const float *origin, int decalIndex, int entityIndex, i
|
||||
#endif // FN_StaticDecal_Post
|
||||
|
||||
#ifdef FN_PrecacheGeneric_Post
|
||||
int FN_PrecacheGeneric_Post(char *s);
|
||||
int FN_PrecacheGeneric_Post(const char *s);
|
||||
#endif // FN_PrecacheGeneric_Post
|
||||
|
||||
#ifdef FN_GetPlayerUserId_Post
|
||||
@ -2116,7 +2121,7 @@ typedef int (*PFN_ADD_NEW_NATIVES) (const AMX_NATIVE_INFO * /*list*/);
|
||||
typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...);
|
||||
typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...);
|
||||
typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/);
|
||||
typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...);
|
||||
typedef void (*PFN_PRINT_SRVCONSOLE) (const char * /*format*/, ...);
|
||||
typedef const char * (*PFN_GET_MODNAME) (void);
|
||||
typedef const char * (*PFN_GET_AMXSCRIPTNAME) (int /*id*/);
|
||||
typedef AMX * (*PFN_GET_AMXSCRIPT) (int /*id*/);
|
||||
@ -2175,8 +2180,8 @@ typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned i
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, const char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, const char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */);
|
||||
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
||||
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
||||
|
@ -1,78 +1,123 @@
|
||||
#(C)2004-2005 AMX Mod X Development Team
|
||||
# (C)2004-2013 AMX Mod X Development Team
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
HLSDK = ../../../../hlsdk
|
||||
###########################################
|
||||
### EDIT THESE PATHS FOR YOUR OWN SETUP ###
|
||||
###########################################
|
||||
|
||||
HLSDK = ../../../../hlsdk/multiplayer
|
||||
MM_ROOT = ../../../../metamod/metamod
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
#####################################
|
||||
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fomit-frame-pointer -fno-strict-aliasing
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc-4.1
|
||||
NAME = csx
|
||||
|
||||
BIN_SUFFIX_32 = amxx_i386.so
|
||||
BIN_SUFFIX_64 = amxx_amd64.so
|
||||
PROJECT = csx
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp CRank.cpp CMisc.cpp meta_api.cpp rank.cpp usermsg.cpp
|
||||
|
||||
LINK =
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
##############################################
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT) -I$(HLSDK)/common -Isdk
|
||||
C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -fomit-frame-pointer -pipe
|
||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||
C_GCC4_FLAGS = -fvisibility=hidden
|
||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||
CPP = gcc
|
||||
CPP_OSX = clang
|
||||
|
||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
LINK =
|
||||
|
||||
ifeq "$(GCC_VERSION)" "4"
|
||||
OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT) -Isdk
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
################################################
|
||||
|
||||
OS := $(shell uname -s)
|
||||
|
||||
ifeq "$(OS)" "Darwin"
|
||||
CPP = $(CPP_OSX)
|
||||
LIB_EXT = dylib
|
||||
LIB_SUFFIX = _amxx
|
||||
CFLAGS += -DOSX
|
||||
LINK += -dynamiclib -lstdc++ -mmacosx-version-min=10.5
|
||||
else
|
||||
LIB_EXT = so
|
||||
LIB_SUFFIX = _amxx_i386
|
||||
CFLAGS += -DLINUX
|
||||
LINK += -shared
|
||||
endif
|
||||
|
||||
LINK += -m32 -lm -ldl
|
||||
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 -DHAVE_STDINT_H -fno-strict-aliasing -m32 -Wall -Werror
|
||||
CPPFLAGS += -fno-exceptions -fno-rtti
|
||||
|
||||
BINARY = $(PROJECT)$(LIB_SUFFIX).$(LIB_EXT)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
BIN_DIR = Debug
|
||||
CFLAGS = $(DEBUG_FLAGS)
|
||||
CFLAGS += $(C_DEBUG_FLAGS)
|
||||
else
|
||||
BIN_DIR = Release
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
CFLAGS += $(C_OPT_FLAGS)
|
||||
LINK += -s
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti -m32
|
||||
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
ifeq "$(IS_CLANG)" "1"
|
||||
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
|
||||
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
|
||||
else
|
||||
BINARY = $(NAME)_$(BIN_SUFFIX_32)
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
OPT_FLAGS += -march=i586
|
||||
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
|
||||
endif
|
||||
|
||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
# Clang || GCC >= 4
|
||||
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
|
||||
CFLAGS += $(C_GCC4_FLAGS)
|
||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||
endif
|
||||
|
||||
# Clang >= 3 || GCC >= 4.7
|
||||
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
|
||||
CFLAGS += -Wno-delete-non-virtual-dtor
|
||||
endif
|
||||
|
||||
# OS is Linux and not using clang
|
||||
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
|
||||
LINK += -static-libgcc
|
||||
endif
|
||||
|
||||
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
|
||||
# This will break if we include other Makefiles, but is fine for now. It allows
|
||||
# us to make a copy of this file that uses altered paths (ie. Makefile.mine)
|
||||
# or other changes without mucking up the original.
|
||||
MAKEFILE_NAME := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
|
||||
$(BIN_DIR)/%.o: %.cpp
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
$(MAKE) csx
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
amd64:
|
||||
$(MAKE) all AMD64=true
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||
|
||||
csx: $(OBJ_LINUX)
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
||||
|
||||
debug:
|
||||
$(MAKE) all DEBUG=true
|
||||
debug:
|
||||
$(MAKE) -f $(MAKEFILE_NAME) all DEBUG=true
|
||||
|
||||
default: all
|
||||
|
||||
clean:
|
||||
rm -rf Release/sdk/*.o
|
||||
rm -rf Release/*.o
|
||||
rm -rf Release/$(NAME)_$(BIN_SUFFIX_32)
|
||||
rm -rf Release/$(NAME)_$(BIN_SUFFIX_64)
|
||||
rm -rf Debug/sdk/*.o
|
||||
rm -rf Debug/*.o
|
||||
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_32)
|
||||
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_64)
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
@ -2240,7 +2240,7 @@ static META_FUNCTIONS g_MetaFunctions_Table =
|
||||
GetEngineFunctions_Post
|
||||
};
|
||||
|
||||
C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
C_DLLEXPORT int Meta_Query(const char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
{
|
||||
if ((int) CVAR_GET_FLOAT("developer") != 0)
|
||||
UTIL_LogPrintf("[%s] dev: called: Meta_Query; version=%s, ours=%s\n",
|
||||
@ -2334,7 +2334,7 @@ C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
|
||||
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
// linux prototype
|
||||
C_DLLEXPORT void GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) {
|
||||
|
||||
@ -3050,7 +3050,7 @@ char* UTIL_VarArgs( char *format, ... )
|
||||
// UTIL_LogPrintf - Prints a logged message to console.
|
||||
// Preceded by LOG: ( timestamp ) < message >
|
||||
//=========================================================
|
||||
void UTIL_LogPrintf( char *fmt, ... )
|
||||
void UTIL_LogPrintf( const char *fmt, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
static char string[1024];
|
||||
|
@ -20,11 +20,16 @@
|
||||
|
||||
// DLL Export
|
||||
#undef DLLEXPORT
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) && !defined(LINUX)
|
||||
#define LINUX
|
||||
#elif defined(__APPLE__) && !defined(OSX)
|
||||
#define OSX
|
||||
#endif
|
||||
|
||||
#undef C_DLLEXPORT
|
||||
@ -66,7 +71,7 @@ struct amxx_module_info_s
|
||||
#if defined HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX || defined __APPLE__
|
||||
#if defined HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
@ -308,7 +313,7 @@ typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
|
||||
#endif
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=mac68k
|
||||
@ -395,7 +400,7 @@ enum {
|
||||
};
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#pragma pack() /* reset default packing */
|
||||
#else
|
||||
#pragma pack(pop) /* reset previous packing */
|
||||
@ -406,7 +411,7 @@ enum {
|
||||
// ***** declare functions *****
|
||||
|
||||
#ifdef USE_METAMOD
|
||||
void UTIL_LogPrintf( char *fmt, ... );
|
||||
void UTIL_LogPrintf( const char *fmt, ... );
|
||||
void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, const char *pMessage);
|
||||
short FixedSigned16( float value, float scale );
|
||||
unsigned short FixedUnsigned16( float value, float scale );
|
||||
@ -833,11 +838,11 @@ int FN_AllowLagCompensation_Post(void);
|
||||
|
||||
|
||||
#ifdef FN_PrecacheModel
|
||||
int FN_PrecacheModel(char *s);
|
||||
int FN_PrecacheModel(const char *s);
|
||||
#endif // FN_PrecacheModel
|
||||
|
||||
#ifdef FN_PrecacheSound
|
||||
int FN_PrecacheSound(char *s);
|
||||
int FN_PrecacheSound(const char *s);
|
||||
#endif // FN_PrecacheSound
|
||||
|
||||
#ifdef FN_SetModel
|
||||
@ -857,7 +862,7 @@ void FN_SetSize(edict_t *e, const float *rgflMin, const float *rgflMax);
|
||||
#endif // FN_SetSize
|
||||
|
||||
#ifdef FN_ChangeLevel
|
||||
void FN_ChangeLevel(char *s1, char *s2);
|
||||
void FN_ChangeLevel(const char *s1, const char *s2);
|
||||
#endif // FN_ChangeLevel
|
||||
|
||||
#ifdef FN_GetSpawnParms
|
||||
@ -1261,19 +1266,19 @@ char *FN_GetInfoKeyBuffer(edict_t *e);
|
||||
#endif // FN_GetInfoKeyBuffer
|
||||
|
||||
#ifdef FN_InfoKeyValue
|
||||
char *FN_InfoKeyValue(char *infobuffer, char *key);
|
||||
char *FN_InfoKeyValue(char *infobuffer, const char *key);
|
||||
#endif // FN_InfoKeyValue
|
||||
|
||||
#ifdef FN_SetKeyValue
|
||||
void FN_SetKeyValue(char *infobuffer, char *key, char *value);
|
||||
void FN_SetKeyValue(char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetKeyValue
|
||||
|
||||
#ifdef FN_SetClientKeyValue
|
||||
void FN_SetClientKeyValue(int clientIndex, char *infobuffer, char *key, char *value);
|
||||
void FN_SetClientKeyValue(int clientIndex, char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetClientKeyValue
|
||||
|
||||
#ifdef FN_IsMapValid
|
||||
int FN_IsMapValid(char *filename);
|
||||
int FN_IsMapValid(const char *filename);
|
||||
#endif // FN_IsMapValid
|
||||
|
||||
#ifdef FN_StaticDecal
|
||||
@ -1281,7 +1286,7 @@ void FN_StaticDecal(const float *origin, int decalIndex, int entityIndex, int mo
|
||||
#endif // FN_StaticDecal
|
||||
|
||||
#ifdef FN_PrecacheGeneric
|
||||
int FN_PrecacheGeneric(char *s);
|
||||
int FN_PrecacheGeneric(const char *s);
|
||||
#endif // FN_PrecacheGeneric
|
||||
|
||||
#ifdef FN_GetPlayerUserId
|
||||
@ -1414,11 +1419,11 @@ const char *FN_GetPlayerAuthId(edict_t *e);
|
||||
|
||||
|
||||
#ifdef FN_PrecacheModel_Post
|
||||
int FN_PrecacheModel_Post(char *s);
|
||||
int FN_PrecacheModel_Post(const char *s);
|
||||
#endif // FN_PrecacheModel_Post
|
||||
|
||||
#ifdef FN_PrecacheSound_Post
|
||||
int FN_PrecacheSound_Post(char *s);
|
||||
int FN_PrecacheSound_Post(const char *s);
|
||||
#endif // FN_PrecacheSound_Post
|
||||
|
||||
#ifdef FN_SetModel_Post
|
||||
@ -1438,7 +1443,7 @@ void FN_SetSize_Post(edict_t *e, const float *rgflMin, const float *rgflMax);
|
||||
#endif // FN_SetSize_Post
|
||||
|
||||
#ifdef FN_ChangeLevel_Post
|
||||
void FN_ChangeLevel_Post(char *s1, char *s2);
|
||||
void FN_ChangeLevel_Post(const char *s1, const char *s2);
|
||||
#endif // FN_ChangeLevel_Post
|
||||
|
||||
#ifdef FN_GetSpawnParms_Post
|
||||
@ -1842,19 +1847,19 @@ char *FN_GetInfoKeyBuffer_Post(edict_t *e);
|
||||
#endif // FN_GetInfoKeyBuffer_Post
|
||||
|
||||
#ifdef FN_InfoKeyValue_Post
|
||||
char *FN_InfoKeyValue_Post(char *infobuffer, char *key);
|
||||
char *FN_InfoKeyValue_Post(char *infobuffer, const char *key);
|
||||
#endif // FN_InfoKeyValue_Post
|
||||
|
||||
#ifdef FN_SetKeyValue_Post
|
||||
void FN_SetKeyValue_Post(char *infobuffer, char *key, char *value);
|
||||
void FN_SetKeyValue_Post(char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetKeyValue_Post
|
||||
|
||||
#ifdef FN_SetClientKeyValue_Post
|
||||
void FN_SetClientKeyValue_Post(int clientIndex, char *infobuffer, char *key, char *value);
|
||||
void FN_SetClientKeyValue_Post(int clientIndex, char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetClientKeyValue_Post
|
||||
|
||||
#ifdef FN_IsMapValid_Post
|
||||
int FN_IsMapValid_Post(char *filename);
|
||||
int FN_IsMapValid_Post(const char *filename);
|
||||
#endif // FN_IsMapValid_Post
|
||||
|
||||
#ifdef FN_StaticDecal_Post
|
||||
@ -1862,7 +1867,7 @@ void FN_StaticDecal_Post(const float *origin, int decalIndex, int entityIndex, i
|
||||
#endif // FN_StaticDecal_Post
|
||||
|
||||
#ifdef FN_PrecacheGeneric_Post
|
||||
int FN_PrecacheGeneric_Post(char *s);
|
||||
int FN_PrecacheGeneric_Post(const char *s);
|
||||
#endif // FN_PrecacheGeneric_Post
|
||||
|
||||
#ifdef FN_GetPlayerUserId_Post
|
||||
@ -2116,7 +2121,7 @@ typedef int (*PFN_ADD_NEW_NATIVES) (const AMX_NATIVE_INFO * /*list*/);
|
||||
typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...);
|
||||
typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...);
|
||||
typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/);
|
||||
typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...);
|
||||
typedef void (*PFN_PRINT_SRVCONSOLE) (const char * /*format*/, ...);
|
||||
typedef const char * (*PFN_GET_MODNAME) (void);
|
||||
typedef const char * (*PFN_GET_AMXSCRIPTNAME) (int /*id*/);
|
||||
typedef AMX * (*PFN_GET_AMXSCRIPT) (int /*id*/);
|
||||
@ -2175,8 +2180,8 @@ typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned i
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, const char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, const char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */);
|
||||
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
||||
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
||||
|
@ -67,7 +67,7 @@ void CPlayer::killPlayer(){
|
||||
pEdict->v.weapons = 0;
|
||||
}
|
||||
|
||||
void CPlayer::setTeamName( char *szName ){
|
||||
void CPlayer::setTeamName( const char *szName ){
|
||||
|
||||
for (int i=0;i<16;i++){
|
||||
*( (char*)pEdict->pvPrivateData + STEAM_PDOFFSET_TEAMNAME + i ) = szName[i];
|
||||
|
@ -32,7 +32,7 @@
|
||||
#ifndef CMISC_H
|
||||
#define CMISC_H
|
||||
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
#define LINUXOFFSET 0
|
||||
#else
|
||||
#define LINUXOFFSET 5
|
||||
@ -53,7 +53,7 @@
|
||||
// DoD Control Point
|
||||
struct pd_dcp {
|
||||
int iunk_0;
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
int iunk_1; // windows only
|
||||
#endif
|
||||
int iunk_2; // pointer edict_t*
|
||||
@ -82,7 +82,7 @@ struct pd_dcp {
|
||||
int iunk_36; // pointer entvars_t*
|
||||
int unknown_block2[52];
|
||||
int iunk_89; // pointer entvars_t*
|
||||
#ifdef __linux__
|
||||
#if defined (__linux__) || defined (__APPLE__)
|
||||
int iunk_extra1;
|
||||
int iunk_extra2;
|
||||
int iunk_extra3;
|
||||
@ -129,7 +129,7 @@ struct pd_dca {
|
||||
int iunk_0;
|
||||
int iunk_1;
|
||||
int iunk_2;
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
int iunk_3; // if def windows
|
||||
#endif
|
||||
|
||||
@ -150,7 +150,7 @@ struct pd_dca {
|
||||
float angles_z; // 15
|
||||
|
||||
// 16-135
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
int unknown_block_16[111];
|
||||
#else
|
||||
int unknown_block_16[116]; // linux +5 more
|
||||
@ -263,7 +263,7 @@ public:
|
||||
void PutInServer();
|
||||
void Disconnect();
|
||||
void killPlayer();
|
||||
void setTeamName( char *szName );
|
||||
void setTeamName( const char *szName );
|
||||
void getTeamName( char *szName );
|
||||
|
||||
inline bool IsBot(){
|
||||
|
@ -1,67 +1,123 @@
|
||||
#(C)2004-2005 AMX Mod X Development Team
|
||||
# (C)2004-2013 AMX Mod X Development Team
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
HLSDK = ../../../../hlsdk
|
||||
###########################################
|
||||
### EDIT THESE PATHS FOR YOUR OWN SETUP ###
|
||||
###########################################
|
||||
|
||||
HLSDK = ../../../../hlsdk/multiplayer
|
||||
MM_ROOT = ../../../../metamod/metamod
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
#####################################
|
||||
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fno-strict-aliasing
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc-4.1
|
||||
NAME = dodfun
|
||||
|
||||
BIN_SUFFIX = amxx_i386.so
|
||||
PROJECT = dodfun
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp NBase.cpp CMisc.cpp NPD.cpp Utils.cpp usermsg.cpp moduleconfig.cpp
|
||||
|
||||
LINK =
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
##############################################
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT) -I$(HLSDK)/common -Isdk
|
||||
C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -fomit-frame-pointer -pipe
|
||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||
C_GCC4_FLAGS = -fvisibility=hidden
|
||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||
CPP = gcc
|
||||
CPP_OSX = clang
|
||||
|
||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
LINK =
|
||||
|
||||
ifeq "$(GCC_VERSION)" "4"
|
||||
OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT) -Isdk
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
################################################
|
||||
|
||||
OS := $(shell uname -s)
|
||||
|
||||
ifeq "$(OS)" "Darwin"
|
||||
CPP = $(CPP_OSX)
|
||||
LIB_EXT = dylib
|
||||
LIB_SUFFIX = _amxx
|
||||
CFLAGS += -DOSX
|
||||
LINK += -dynamiclib -lstdc++ -mmacosx-version-min=10.5
|
||||
else
|
||||
LIB_EXT = so
|
||||
LIB_SUFFIX = _amxx_i386
|
||||
CFLAGS += -DLINUX
|
||||
LINK += -shared
|
||||
endif
|
||||
|
||||
LINK += -m32 -lm -ldl
|
||||
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 -DHAVE_STDINT_H -fno-strict-aliasing -m32 -Wall -Werror
|
||||
CPPFLAGS += -fno-exceptions -fno-rtti
|
||||
|
||||
BINARY = $(PROJECT)$(LIB_SUFFIX).$(LIB_EXT)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
BIN_DIR = Debug
|
||||
CFLAGS = $(DEBUG_FLAGS)
|
||||
CFLAGS += $(C_DEBUG_FLAGS)
|
||||
else
|
||||
BIN_DIR = Release
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
CFLAGS += $(C_OPT_FLAGS)
|
||||
LINK += -s
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti -m32
|
||||
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
|
||||
|
||||
BINARY = $(NAME)_$(BIN_SUFFIX)
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
OPT_FLAGS += -march=i586
|
||||
ifeq "$(IS_CLANG)" "1"
|
||||
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
|
||||
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
|
||||
else
|
||||
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
|
||||
endif
|
||||
|
||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
# Clang || GCC >= 4
|
||||
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
|
||||
CFLAGS += $(C_GCC4_FLAGS)
|
||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||
endif
|
||||
|
||||
# Clang >= 3 || GCC >= 4.7
|
||||
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
|
||||
CFLAGS += -Wno-delete-non-virtual-dtor
|
||||
endif
|
||||
|
||||
# OS is Linux and not using clang
|
||||
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
|
||||
LINK += -static-libgcc
|
||||
endif
|
||||
|
||||
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
|
||||
# This will break if we include other Makefiles, but is fine for now. It allows
|
||||
# us to make a copy of this file that uses altered paths (ie. Makefile.mine)
|
||||
# or other changes without mucking up the original.
|
||||
MAKEFILE_NAME := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
|
||||
$(BIN_DIR)/%.o: %.cpp
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
$(MAKE) dodfun
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
dodfun: $(OBJ_LINUX)
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||
|
||||
debug:
|
||||
$(MAKE) all DEBUG=true
|
||||
debug:
|
||||
$(MAKE) -f $(MAKEFILE_NAME) all DEBUG=true
|
||||
|
||||
default: all
|
||||
|
||||
clean:
|
||||
rm -rf Release/sdk/*.o
|
||||
rm -rf Release/*.o
|
||||
rm -rf Release/$(NAME)_$(BIN_SUFFIX)
|
||||
rm -rf Debug/sdk/*.o
|
||||
rm -rf Debug/*.o
|
||||
rm -rf Debug/$(NAME)_$(BIN_SUFFIX)
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
@ -2240,7 +2240,7 @@ static META_FUNCTIONS g_MetaFunctions_Table =
|
||||
GetEngineFunctions_Post
|
||||
};
|
||||
|
||||
C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
C_DLLEXPORT int Meta_Query(const char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
{
|
||||
if ((int) CVAR_GET_FLOAT("developer") != 0)
|
||||
UTIL_LogPrintf("[%s] dev: called: Meta_Query; version=%s, ours=%s\n",
|
||||
@ -2334,7 +2334,7 @@ C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
|
||||
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
// linux prototype
|
||||
C_DLLEXPORT void GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) {
|
||||
|
||||
@ -3050,7 +3050,7 @@ char* UTIL_VarArgs( char *format, ... )
|
||||
// UTIL_LogPrintf - Prints a logged message to console.
|
||||
// Preceded by LOG: ( timestamp ) < message >
|
||||
//=========================================================
|
||||
void UTIL_LogPrintf( char *fmt, ... )
|
||||
void UTIL_LogPrintf( const char *fmt, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
static char string[1024];
|
||||
|
@ -20,11 +20,16 @@
|
||||
|
||||
// DLL Export
|
||||
#undef DLLEXPORT
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) && !defined(LINUX)
|
||||
#define LINUX
|
||||
#elif defined(__APPLE__) && !defined(OSX)
|
||||
#define OSX
|
||||
#endif
|
||||
|
||||
#undef C_DLLEXPORT
|
||||
@ -66,7 +71,7 @@ struct amxx_module_info_s
|
||||
#if defined HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX || defined __APPLE__
|
||||
#if defined HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
@ -308,7 +313,7 @@ typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
|
||||
#endif
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=mac68k
|
||||
@ -395,7 +400,7 @@ enum {
|
||||
};
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#pragma pack() /* reset default packing */
|
||||
#else
|
||||
#pragma pack(pop) /* reset previous packing */
|
||||
@ -406,7 +411,7 @@ enum {
|
||||
// ***** declare functions *****
|
||||
|
||||
#ifdef USE_METAMOD
|
||||
void UTIL_LogPrintf( char *fmt, ... );
|
||||
void UTIL_LogPrintf( const char *fmt, ... );
|
||||
void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, const char *pMessage);
|
||||
short FixedSigned16( float value, float scale );
|
||||
unsigned short FixedUnsigned16( float value, float scale );
|
||||
@ -833,11 +838,11 @@ int FN_AllowLagCompensation_Post(void);
|
||||
|
||||
|
||||
#ifdef FN_PrecacheModel
|
||||
int FN_PrecacheModel(char *s);
|
||||
int FN_PrecacheModel(const char *s);
|
||||
#endif // FN_PrecacheModel
|
||||
|
||||
#ifdef FN_PrecacheSound
|
||||
int FN_PrecacheSound(char *s);
|
||||
int FN_PrecacheSound(const char *s);
|
||||
#endif // FN_PrecacheSound
|
||||
|
||||
#ifdef FN_SetModel
|
||||
@ -857,7 +862,7 @@ void FN_SetSize(edict_t *e, const float *rgflMin, const float *rgflMax);
|
||||
#endif // FN_SetSize
|
||||
|
||||
#ifdef FN_ChangeLevel
|
||||
void FN_ChangeLevel(char *s1, char *s2);
|
||||
void FN_ChangeLevel(const char *s1, const char *s2);
|
||||
#endif // FN_ChangeLevel
|
||||
|
||||
#ifdef FN_GetSpawnParms
|
||||
@ -1261,19 +1266,19 @@ char *FN_GetInfoKeyBuffer(edict_t *e);
|
||||
#endif // FN_GetInfoKeyBuffer
|
||||
|
||||
#ifdef FN_InfoKeyValue
|
||||
char *FN_InfoKeyValue(char *infobuffer, char *key);
|
||||
char *FN_InfoKeyValue(char *infobuffer, const char *key);
|
||||
#endif // FN_InfoKeyValue
|
||||
|
||||
#ifdef FN_SetKeyValue
|
||||
void FN_SetKeyValue(char *infobuffer, char *key, char *value);
|
||||
void FN_SetKeyValue(char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetKeyValue
|
||||
|
||||
#ifdef FN_SetClientKeyValue
|
||||
void FN_SetClientKeyValue(int clientIndex, char *infobuffer, char *key, char *value);
|
||||
void FN_SetClientKeyValue(int clientIndex, char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetClientKeyValue
|
||||
|
||||
#ifdef FN_IsMapValid
|
||||
int FN_IsMapValid(char *filename);
|
||||
int FN_IsMapValid(const char *filename);
|
||||
#endif // FN_IsMapValid
|
||||
|
||||
#ifdef FN_StaticDecal
|
||||
@ -1281,7 +1286,7 @@ void FN_StaticDecal(const float *origin, int decalIndex, int entityIndex, int mo
|
||||
#endif // FN_StaticDecal
|
||||
|
||||
#ifdef FN_PrecacheGeneric
|
||||
int FN_PrecacheGeneric(char *s);
|
||||
int FN_PrecacheGeneric(const char *s);
|
||||
#endif // FN_PrecacheGeneric
|
||||
|
||||
#ifdef FN_GetPlayerUserId
|
||||
@ -1414,11 +1419,11 @@ const char *FN_GetPlayerAuthId(edict_t *e);
|
||||
|
||||
|
||||
#ifdef FN_PrecacheModel_Post
|
||||
int FN_PrecacheModel_Post(char *s);
|
||||
int FN_PrecacheModel_Post(const char *s);
|
||||
#endif // FN_PrecacheModel_Post
|
||||
|
||||
#ifdef FN_PrecacheSound_Post
|
||||
int FN_PrecacheSound_Post(char *s);
|
||||
int FN_PrecacheSound_Post(const char *s);
|
||||
#endif // FN_PrecacheSound_Post
|
||||
|
||||
#ifdef FN_SetModel_Post
|
||||
@ -1438,7 +1443,7 @@ void FN_SetSize_Post(edict_t *e, const float *rgflMin, const float *rgflMax);
|
||||
#endif // FN_SetSize_Post
|
||||
|
||||
#ifdef FN_ChangeLevel_Post
|
||||
void FN_ChangeLevel_Post(char *s1, char *s2);
|
||||
void FN_ChangeLevel_Post(const char *s1, const char *s2);
|
||||
#endif // FN_ChangeLevel_Post
|
||||
|
||||
#ifdef FN_GetSpawnParms_Post
|
||||
@ -1842,19 +1847,19 @@ char *FN_GetInfoKeyBuffer_Post(edict_t *e);
|
||||
#endif // FN_GetInfoKeyBuffer_Post
|
||||
|
||||
#ifdef FN_InfoKeyValue_Post
|
||||
char *FN_InfoKeyValue_Post(char *infobuffer, char *key);
|
||||
char *FN_InfoKeyValue_Post(char *infobuffer, const char *key);
|
||||
#endif // FN_InfoKeyValue_Post
|
||||
|
||||
#ifdef FN_SetKeyValue_Post
|
||||
void FN_SetKeyValue_Post(char *infobuffer, char *key, char *value);
|
||||
void FN_SetKeyValue_Post(char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetKeyValue_Post
|
||||
|
||||
#ifdef FN_SetClientKeyValue_Post
|
||||
void FN_SetClientKeyValue_Post(int clientIndex, char *infobuffer, char *key, char *value);
|
||||
void FN_SetClientKeyValue_Post(int clientIndex, char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetClientKeyValue_Post
|
||||
|
||||
#ifdef FN_IsMapValid_Post
|
||||
int FN_IsMapValid_Post(char *filename);
|
||||
int FN_IsMapValid_Post(const char *filename);
|
||||
#endif // FN_IsMapValid_Post
|
||||
|
||||
#ifdef FN_StaticDecal_Post
|
||||
@ -1862,7 +1867,7 @@ void FN_StaticDecal_Post(const float *origin, int decalIndex, int entityIndex, i
|
||||
#endif // FN_StaticDecal_Post
|
||||
|
||||
#ifdef FN_PrecacheGeneric_Post
|
||||
int FN_PrecacheGeneric_Post(char *s);
|
||||
int FN_PrecacheGeneric_Post(const char *s);
|
||||
#endif // FN_PrecacheGeneric_Post
|
||||
|
||||
#ifdef FN_GetPlayerUserId_Post
|
||||
@ -2116,7 +2121,7 @@ typedef int (*PFN_ADD_NEW_NATIVES) (const AMX_NATIVE_INFO * /*list*/);
|
||||
typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...);
|
||||
typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...);
|
||||
typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/);
|
||||
typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...);
|
||||
typedef void (*PFN_PRINT_SRVCONSOLE) (const char * /*format*/, ...);
|
||||
typedef const char * (*PFN_GET_MODNAME) (void);
|
||||
typedef const char * (*PFN_GET_AMXSCRIPTNAME) (int /*id*/);
|
||||
typedef AMX * (*PFN_GET_AMXSCRIPT) (int /*id*/);
|
||||
@ -2175,8 +2180,8 @@ typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned i
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, const char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, const char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */);
|
||||
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
||||
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
||||
|
@ -37,7 +37,7 @@
|
||||
#define DODMAX_CUSTOMWPNS 5 // custom weapons
|
||||
#define DODMAX_WEAPONS 42 + DODMAX_CUSTOMWPNS
|
||||
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
#define LINUXOFFSET 0
|
||||
#else
|
||||
#define LINUXOFFSET 5
|
||||
|
@ -1,67 +1,123 @@
|
||||
#(C)2004-2005 AMX Mod X Development Team
|
||||
# (C)2004-2013 AMX Mod X Development Team
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
HLSDK = ../../../../hlsdk
|
||||
###########################################
|
||||
### EDIT THESE PATHS FOR YOUR OWN SETUP ###
|
||||
###########################################
|
||||
|
||||
HLSDK = ../../../../hlsdk/multiplayer
|
||||
MM_ROOT = ../../../../metamod/metamod
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
#####################################
|
||||
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fno-strict-aliasing
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc-4.1
|
||||
NAME = dodx
|
||||
|
||||
BIN_SUFFIX = amxx_i386.so
|
||||
PROJECT = dodx
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp CRank.cpp CMisc.cpp NBase.cpp NRank.cpp usermsg.cpp Utils.cpp moduleconfig.cpp
|
||||
|
||||
LINK =
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
##############################################
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT) -I$(HLSDK)/common -Isdk
|
||||
C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -fomit-frame-pointer -pipe
|
||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||
C_GCC4_FLAGS = -fvisibility=hidden
|
||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||
CPP = gcc
|
||||
CPP_OSX = clang
|
||||
|
||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
LINK =
|
||||
|
||||
ifeq "$(GCC_VERSION)" "4"
|
||||
OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT) -Isdk
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
################################################
|
||||
|
||||
OS := $(shell uname -s)
|
||||
|
||||
ifeq "$(OS)" "Darwin"
|
||||
CPP = $(CPP_OSX)
|
||||
LIB_EXT = dylib
|
||||
LIB_SUFFIX = _amxx
|
||||
CFLAGS += -DOSX
|
||||
LINK += -dynamiclib -lstdc++ -mmacosx-version-min=10.5
|
||||
else
|
||||
LIB_EXT = so
|
||||
LIB_SUFFIX = _amxx_i386
|
||||
CFLAGS += -DLINUX
|
||||
LINK += -shared
|
||||
endif
|
||||
|
||||
LINK += -m32 -lm -ldl
|
||||
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 -DHAVE_STDINT_H -fno-strict-aliasing -m32 -Wall -Werror
|
||||
CPPFLAGS += -fno-exceptions -fno-rtti
|
||||
|
||||
BINARY = $(PROJECT)$(LIB_SUFFIX).$(LIB_EXT)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
BIN_DIR = Debug
|
||||
CFLAGS = $(DEBUG_FLAGS)
|
||||
CFLAGS += $(C_DEBUG_FLAGS)
|
||||
else
|
||||
BIN_DIR = Release
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
CFLAGS += $(C_OPT_FLAGS)
|
||||
LINK += -s
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti -m32
|
||||
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
|
||||
|
||||
BINARY = $(NAME)_$(BIN_SUFFIX)
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
OPT_FLAGS += -march=i586
|
||||
ifeq "$(IS_CLANG)" "1"
|
||||
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
|
||||
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
|
||||
else
|
||||
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
|
||||
endif
|
||||
|
||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
# Clang || GCC >= 4
|
||||
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
|
||||
CFLAGS += $(C_GCC4_FLAGS)
|
||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||
endif
|
||||
|
||||
# Clang >= 3 || GCC >= 4.7
|
||||
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
|
||||
CFLAGS += -Wno-delete-non-virtual-dtor
|
||||
endif
|
||||
|
||||
# OS is Linux and not using clang
|
||||
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
|
||||
LINK += -static-libgcc
|
||||
endif
|
||||
|
||||
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
|
||||
# This will break if we include other Makefiles, but is fine for now. It allows
|
||||
# us to make a copy of this file that uses altered paths (ie. Makefile.mine)
|
||||
# or other changes without mucking up the original.
|
||||
MAKEFILE_NAME := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
|
||||
$(BIN_DIR)/%.o: %.cpp
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
$(MAKE) dodx
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
dodx: $(OBJ_LINUX)
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||
|
||||
debug:
|
||||
$(MAKE) all DEBUG=true
|
||||
debug:
|
||||
$(MAKE) -f $(MAKEFILE_NAME) all DEBUG=true
|
||||
|
||||
default: all
|
||||
|
||||
clean:
|
||||
rm -rf Release/sdk/*.o
|
||||
rm -rf Release/*.o
|
||||
rm -rf Release/$(NAME)_$(BIN_SUFFIX)
|
||||
rm -rf Debug/sdk/*.o
|
||||
rm -rf Debug/*.o
|
||||
rm -rf Debug/$(NAME)_$(BIN_SUFFIX)
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
@ -490,7 +490,7 @@ static cell AMX_NATIVE_CALL get_user_team(AMX *amx, cell *params)
|
||||
|
||||
if ( params[3] )
|
||||
{
|
||||
char *szTeam = "";
|
||||
const char *szTeam = "";
|
||||
switch(iTeam)
|
||||
{
|
||||
case 1:
|
||||
|
@ -430,7 +430,7 @@ void DispatchKeyValue_Post( edict_t *pentKeyvalue, KeyValueData *pkvd )
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void SetClientKeyValue(int id, char *protocol, char *type, char *var)
|
||||
void SetClientKeyValue(int id, char *protocol, const char *type, const char *var)
|
||||
{
|
||||
// ID: Number
|
||||
// protocol: \name\Sgt.MEOW\topcolor\1\bottomcolor\1\cl_lw\1\team\axis\model\axis-inf
|
||||
|
@ -2240,7 +2240,7 @@ static META_FUNCTIONS g_MetaFunctions_Table =
|
||||
GetEngineFunctions_Post
|
||||
};
|
||||
|
||||
C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
C_DLLEXPORT int Meta_Query(const char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
{
|
||||
if ((int) CVAR_GET_FLOAT("developer") != 0)
|
||||
UTIL_LogPrintf("[%s] dev: called: Meta_Query; version=%s, ours=%s\n",
|
||||
@ -2334,7 +2334,7 @@ C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
|
||||
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
// linux prototype
|
||||
C_DLLEXPORT void GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) {
|
||||
|
||||
@ -3050,7 +3050,7 @@ char* UTIL_VarArgs( char *format, ... )
|
||||
// UTIL_LogPrintf - Prints a logged message to console.
|
||||
// Preceded by LOG: ( timestamp ) < message >
|
||||
//=========================================================
|
||||
void UTIL_LogPrintf( char *fmt, ... )
|
||||
void UTIL_LogPrintf( const char *fmt, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
static char string[1024];
|
||||
|
@ -20,11 +20,16 @@
|
||||
|
||||
// DLL Export
|
||||
#undef DLLEXPORT
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) && !defined(LINUX)
|
||||
#define LINUX
|
||||
#elif defined(__APPLE__) && !defined(OSX)
|
||||
#define OSX
|
||||
#endif
|
||||
|
||||
#undef C_DLLEXPORT
|
||||
@ -66,7 +71,7 @@ struct amxx_module_info_s
|
||||
#if defined HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX || defined __APPLE__
|
||||
#if defined HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
@ -308,7 +313,7 @@ typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
|
||||
#endif
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=mac68k
|
||||
@ -395,7 +400,7 @@ enum {
|
||||
};
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#pragma pack() /* reset default packing */
|
||||
#else
|
||||
#pragma pack(pop) /* reset previous packing */
|
||||
@ -406,7 +411,7 @@ enum {
|
||||
// ***** declare functions *****
|
||||
|
||||
#ifdef USE_METAMOD
|
||||
void UTIL_LogPrintf( char *fmt, ... );
|
||||
void UTIL_LogPrintf( const char *fmt, ... );
|
||||
void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, const char *pMessage);
|
||||
short FixedSigned16( float value, float scale );
|
||||
unsigned short FixedUnsigned16( float value, float scale );
|
||||
@ -833,11 +838,11 @@ int FN_AllowLagCompensation_Post(void);
|
||||
|
||||
|
||||
#ifdef FN_PrecacheModel
|
||||
int FN_PrecacheModel(char *s);
|
||||
int FN_PrecacheModel(const char *s);
|
||||
#endif // FN_PrecacheModel
|
||||
|
||||
#ifdef FN_PrecacheSound
|
||||
int FN_PrecacheSound(char *s);
|
||||
int FN_PrecacheSound(const char *s);
|
||||
#endif // FN_PrecacheSound
|
||||
|
||||
#ifdef FN_SetModel
|
||||
@ -857,7 +862,7 @@ void FN_SetSize(edict_t *e, const float *rgflMin, const float *rgflMax);
|
||||
#endif // FN_SetSize
|
||||
|
||||
#ifdef FN_ChangeLevel
|
||||
void FN_ChangeLevel(char *s1, char *s2);
|
||||
void FN_ChangeLevel(const char *s1, const char *s2);
|
||||
#endif // FN_ChangeLevel
|
||||
|
||||
#ifdef FN_GetSpawnParms
|
||||
@ -1261,19 +1266,19 @@ char *FN_GetInfoKeyBuffer(edict_t *e);
|
||||
#endif // FN_GetInfoKeyBuffer
|
||||
|
||||
#ifdef FN_InfoKeyValue
|
||||
char *FN_InfoKeyValue(char *infobuffer, char *key);
|
||||
char *FN_InfoKeyValue(char *infobuffer, const char *key);
|
||||
#endif // FN_InfoKeyValue
|
||||
|
||||
#ifdef FN_SetKeyValue
|
||||
void FN_SetKeyValue(char *infobuffer, char *key, char *value);
|
||||
void FN_SetKeyValue(char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetKeyValue
|
||||
|
||||
#ifdef FN_SetClientKeyValue
|
||||
void FN_SetClientKeyValue(int clientIndex, char *infobuffer, char *key, char *value);
|
||||
void FN_SetClientKeyValue(int clientIndex, char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetClientKeyValue
|
||||
|
||||
#ifdef FN_IsMapValid
|
||||
int FN_IsMapValid(char *filename);
|
||||
int FN_IsMapValid(const char *filename);
|
||||
#endif // FN_IsMapValid
|
||||
|
||||
#ifdef FN_StaticDecal
|
||||
@ -1281,7 +1286,7 @@ void FN_StaticDecal(const float *origin, int decalIndex, int entityIndex, int mo
|
||||
#endif // FN_StaticDecal
|
||||
|
||||
#ifdef FN_PrecacheGeneric
|
||||
int FN_PrecacheGeneric(char *s);
|
||||
int FN_PrecacheGeneric(const char *s);
|
||||
#endif // FN_PrecacheGeneric
|
||||
|
||||
#ifdef FN_GetPlayerUserId
|
||||
@ -1414,11 +1419,11 @@ const char *FN_GetPlayerAuthId(edict_t *e);
|
||||
|
||||
|
||||
#ifdef FN_PrecacheModel_Post
|
||||
int FN_PrecacheModel_Post(char *s);
|
||||
int FN_PrecacheModel_Post(const char *s);
|
||||
#endif // FN_PrecacheModel_Post
|
||||
|
||||
#ifdef FN_PrecacheSound_Post
|
||||
int FN_PrecacheSound_Post(char *s);
|
||||
int FN_PrecacheSound_Post(const char *s);
|
||||
#endif // FN_PrecacheSound_Post
|
||||
|
||||
#ifdef FN_SetModel_Post
|
||||
@ -1438,7 +1443,7 @@ void FN_SetSize_Post(edict_t *e, const float *rgflMin, const float *rgflMax);
|
||||
#endif // FN_SetSize_Post
|
||||
|
||||
#ifdef FN_ChangeLevel_Post
|
||||
void FN_ChangeLevel_Post(char *s1, char *s2);
|
||||
void FN_ChangeLevel_Post(const char *s1, const char *s2);
|
||||
#endif // FN_ChangeLevel_Post
|
||||
|
||||
#ifdef FN_GetSpawnParms_Post
|
||||
@ -1842,19 +1847,19 @@ char *FN_GetInfoKeyBuffer_Post(edict_t *e);
|
||||
#endif // FN_GetInfoKeyBuffer_Post
|
||||
|
||||
#ifdef FN_InfoKeyValue_Post
|
||||
char *FN_InfoKeyValue_Post(char *infobuffer, char *key);
|
||||
char *FN_InfoKeyValue_Post(char *infobuffer, const char *key);
|
||||
#endif // FN_InfoKeyValue_Post
|
||||
|
||||
#ifdef FN_SetKeyValue_Post
|
||||
void FN_SetKeyValue_Post(char *infobuffer, char *key, char *value);
|
||||
void FN_SetKeyValue_Post(char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetKeyValue_Post
|
||||
|
||||
#ifdef FN_SetClientKeyValue_Post
|
||||
void FN_SetClientKeyValue_Post(int clientIndex, char *infobuffer, char *key, char *value);
|
||||
void FN_SetClientKeyValue_Post(int clientIndex, char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetClientKeyValue_Post
|
||||
|
||||
#ifdef FN_IsMapValid_Post
|
||||
int FN_IsMapValid_Post(char *filename);
|
||||
int FN_IsMapValid_Post(const char *filename);
|
||||
#endif // FN_IsMapValid_Post
|
||||
|
||||
#ifdef FN_StaticDecal_Post
|
||||
@ -1862,7 +1867,7 @@ void FN_StaticDecal_Post(const float *origin, int decalIndex, int entityIndex, i
|
||||
#endif // FN_StaticDecal_Post
|
||||
|
||||
#ifdef FN_PrecacheGeneric_Post
|
||||
int FN_PrecacheGeneric_Post(char *s);
|
||||
int FN_PrecacheGeneric_Post(const char *s);
|
||||
#endif // FN_PrecacheGeneric_Post
|
||||
|
||||
#ifdef FN_GetPlayerUserId_Post
|
||||
@ -2116,7 +2121,7 @@ typedef int (*PFN_ADD_NEW_NATIVES) (const AMX_NATIVE_INFO * /*list*/);
|
||||
typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...);
|
||||
typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...);
|
||||
typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/);
|
||||
typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...);
|
||||
typedef void (*PFN_PRINT_SRVCONSOLE) (const char * /*format*/, ...);
|
||||
typedef const char * (*PFN_GET_MODNAME) (void);
|
||||
typedef const char * (*PFN_GET_AMXSCRIPTNAME) (int /*id*/);
|
||||
typedef AMX * (*PFN_GET_AMXSCRIPT) (int /*id*/);
|
||||
@ -2175,8 +2180,8 @@ typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned i
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, const char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, const char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */);
|
||||
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
||||
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
||||
|
@ -1,79 +1,124 @@
|
||||
#(C)2004-2005 AMX Mod X Development Team
|
||||
# (C)2004-2013 AMX Mod X Development Team
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
HLSDK = ../../../hlsdk
|
||||
###########################################
|
||||
### EDIT THESE PATHS FOR YOUR OWN SETUP ###
|
||||
###########################################
|
||||
|
||||
HLSDK = ../../../hlsdk/multiplayer
|
||||
MM_ROOT = ../../../metamod/metamod
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
#####################################
|
||||
|
||||
OPT_FLAGS = -O2 -funroll-loops -s -pipe -fomit-frame-pointer -fno-strict-aliasing
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc-4.1
|
||||
NAME = engine
|
||||
|
||||
BIN_SUFFIX_32 = amxx_i386.so
|
||||
BIN_SUFFIX_64 = amxx_amd64.so
|
||||
PROJECT = engine
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp amxxapi.cpp engine.cpp entity.cpp globals.cpp forwards.cpp \
|
||||
amxmod_compat.cpp
|
||||
amxmod_compat.cpp
|
||||
|
||||
LINK =
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
##############################################
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT) -I$(HLSDK)/common -Isdk
|
||||
C_OPT_FLAGS = -DNDEBUG -O2 -funroll-loops -fomit-frame-pointer -pipe
|
||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||
C_GCC4_FLAGS = -fvisibility=hidden
|
||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||
CPP = gcc
|
||||
CPP_OSX = clang
|
||||
|
||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
LINK =
|
||||
|
||||
ifeq "$(GCC_VERSION)" "4"
|
||||
OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT) -Isdk
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
################################################
|
||||
|
||||
OS := $(shell uname -s)
|
||||
|
||||
ifeq "$(OS)" "Darwin"
|
||||
CPP = $(CPP_OSX)
|
||||
LIB_EXT = dylib
|
||||
LIB_SUFFIX = _amxx
|
||||
CFLAGS += -DOSX
|
||||
LINK += -dynamiclib -lstdc++ -mmacosx-version-min=10.5
|
||||
else
|
||||
LIB_EXT = so
|
||||
LIB_SUFFIX = _amxx_i386
|
||||
CFLAGS += -DLINUX
|
||||
LINK += -shared
|
||||
endif
|
||||
|
||||
LINK += -m32 -lm -ldl
|
||||
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 -DHAVE_STDINT_H -fno-strict-aliasing -m32 -Wall -Werror
|
||||
CPPFLAGS += -fno-exceptions -fno-rtti
|
||||
|
||||
BINARY = $(PROJECT)$(LIB_SUFFIX).$(LIB_EXT)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
BIN_DIR = Debug
|
||||
CFLAGS = $(DEBUG_FLAGS)
|
||||
CFLAGS += $(C_DEBUG_FLAGS)
|
||||
else
|
||||
BIN_DIR = Release
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
CFLAGS += $(C_OPT_FLAGS)
|
||||
LINK += -s
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc -m32
|
||||
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
ifeq "$(IS_CLANG)" "1"
|
||||
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
|
||||
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
|
||||
else
|
||||
BINARY = $(NAME)_$(BIN_SUFFIX_32)
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
OPT_FLAGS += -march=i586
|
||||
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
|
||||
endif
|
||||
|
||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
# Clang || GCC >= 4
|
||||
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
|
||||
CFLAGS += $(C_GCC4_FLAGS)
|
||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||
endif
|
||||
|
||||
# Clang >= 3 || GCC >= 4.7
|
||||
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
|
||||
CFLAGS += -Wno-delete-non-virtual-dtor
|
||||
endif
|
||||
|
||||
# OS is Linux and not using clang
|
||||
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
|
||||
LINK += -static-libgcc
|
||||
endif
|
||||
|
||||
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
|
||||
# This will break if we include other Makefiles, but is fine for now. It allows
|
||||
# us to make a copy of this file that uses altered paths (ie. Makefile.mine)
|
||||
# or other changes without mucking up the original.
|
||||
MAKEFILE_NAME := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
|
||||
$(BIN_DIR)/%.o: %.cpp
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
$(MAKE) engine
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
amd64:
|
||||
$(MAKE) all AMD64=true
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||
|
||||
engine: $(OBJ_LINUX)
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
||||
|
||||
debug:
|
||||
$(MAKE) all DEBUG=true
|
||||
debug:
|
||||
$(MAKE) -f $(MAKEFILE_NAME) all DEBUG=true
|
||||
|
||||
default: all
|
||||
|
||||
clean:
|
||||
rm -rf Release/sdk/*.o
|
||||
rm -rf Release/*.o
|
||||
rm -rf Release/$(NAME)_$(BIN_SUFFIX_32)
|
||||
rm -rf Release/$(NAME)_$(BIN_SUFFIX_64)
|
||||
rm -rf Debug/sdk/*.o
|
||||
rm -rf Debug/*.o
|
||||
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_32)
|
||||
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_64)
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
@ -16,8 +16,8 @@ static int gmsgScoreInfo = 0;
|
||||
BOOL is_breakable(edict_t* pBreak)
|
||||
{
|
||||
if (FStrEq("func_breakable", STRING(pBreak->v.classname))
|
||||
|| FStrEq("func_pushable", STRING(pBreak->v.classname))
|
||||
&& pBreak->v.spawnflags & SF_PUSH_BREAKABLE)
|
||||
|| (FStrEq("func_pushable", STRING(pBreak->v.classname))
|
||||
&& pBreak->v.spawnflags & SF_PUSH_BREAKABLE))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -1470,7 +1470,7 @@ static cell AMX_NATIVE_CALL find_ent_by_owner(AMX *amx, cell *params) // native
|
||||
edict_t *entOwner = INDEXENT2(oEnt);
|
||||
|
||||
//optional fourth parameter is for jghg2 compatibility
|
||||
char* sCategory = NULL;
|
||||
const char* sCategory = NULL;
|
||||
switch(params[4]){
|
||||
case 1: sCategory = "target"; break;
|
||||
case 2: sCategory = "targetname"; break;
|
||||
|
@ -220,7 +220,7 @@ public:
|
||||
|
||||
if (is_space(v[len-1]))
|
||||
{
|
||||
for (i=len-1; i>=0; i--)
|
||||
for (i=len-1; i<len; i--)
|
||||
{
|
||||
if (!is_space(v[i])
|
||||
|| (is_space(v[i]) && i==0))
|
||||
|
@ -2240,7 +2240,7 @@ static META_FUNCTIONS g_MetaFunctions_Table =
|
||||
GetEngineFunctions_Post
|
||||
};
|
||||
|
||||
C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
C_DLLEXPORT int Meta_Query(const char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
{
|
||||
if ((int) CVAR_GET_FLOAT("developer") != 0)
|
||||
UTIL_LogPrintf("[%s] dev: called: Meta_Query; version=%s, ours=%s\n",
|
||||
@ -2334,7 +2334,7 @@ C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
|
||||
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
// linux prototype
|
||||
C_DLLEXPORT void GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) {
|
||||
|
||||
@ -3050,7 +3050,7 @@ char* UTIL_VarArgs( char *format, ... )
|
||||
// UTIL_LogPrintf - Prints a logged message to console.
|
||||
// Preceded by LOG: ( timestamp ) < message >
|
||||
//=========================================================
|
||||
void UTIL_LogPrintf( char *fmt, ... )
|
||||
void UTIL_LogPrintf( const char *fmt, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
static char string[1024];
|
||||
|
@ -20,11 +20,16 @@
|
||||
|
||||
// DLL Export
|
||||
#undef DLLEXPORT
|
||||
#ifndef __linux__
|
||||
#if defined(_WIN32)
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DLLEXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) && !defined(LINUX)
|
||||
#define LINUX
|
||||
#elif defined(__APPLE__) && !defined(OSX)
|
||||
#define OSX
|
||||
#endif
|
||||
|
||||
#undef C_DLLEXPORT
|
||||
@ -66,7 +71,7 @@ struct amxx_module_info_s
|
||||
#if defined HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX
|
||||
#if defined __LCC__ || defined __DMC__ || defined LINUX || defined __APPLE__
|
||||
#if defined HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
@ -308,7 +313,7 @@ typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
|
||||
#endif
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined LINUX || defined __FreeBSD__
|
||||
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
|
||||
#pragma pack(1) /* structures must be packed (byte-aligned) */
|
||||
#elif defined MACOS && defined __MWERKS__
|
||||
#pragma options align=mac68k
|
||||
@ -395,7 +400,7 @@ enum {
|
||||
};
|
||||
|
||||
#if !defined AMX_NO_ALIGN
|
||||
#if defined __linux__
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#pragma pack() /* reset default packing */
|
||||
#else
|
||||
#pragma pack(pop) /* reset previous packing */
|
||||
@ -406,7 +411,7 @@ enum {
|
||||
// ***** declare functions *****
|
||||
|
||||
#ifdef USE_METAMOD
|
||||
void UTIL_LogPrintf( char *fmt, ... );
|
||||
void UTIL_LogPrintf( const char *fmt, ... );
|
||||
void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms, const char *pMessage);
|
||||
short FixedSigned16( float value, float scale );
|
||||
unsigned short FixedUnsigned16( float value, float scale );
|
||||
@ -833,11 +838,11 @@ int FN_AllowLagCompensation_Post(void);
|
||||
|
||||
|
||||
#ifdef FN_PrecacheModel
|
||||
int FN_PrecacheModel(char *s);
|
||||
int FN_PrecacheModel(const char *s);
|
||||
#endif // FN_PrecacheModel
|
||||
|
||||
#ifdef FN_PrecacheSound
|
||||
int FN_PrecacheSound(char *s);
|
||||
int FN_PrecacheSound(const char *s);
|
||||
#endif // FN_PrecacheSound
|
||||
|
||||
#ifdef FN_SetModel
|
||||
@ -857,7 +862,7 @@ void FN_SetSize(edict_t *e, const float *rgflMin, const float *rgflMax);
|
||||
#endif // FN_SetSize
|
||||
|
||||
#ifdef FN_ChangeLevel
|
||||
void FN_ChangeLevel(char *s1, char *s2);
|
||||
void FN_ChangeLevel(const char *s1, const char *s2);
|
||||
#endif // FN_ChangeLevel
|
||||
|
||||
#ifdef FN_GetSpawnParms
|
||||
@ -1261,19 +1266,19 @@ char *FN_GetInfoKeyBuffer(edict_t *e);
|
||||
#endif // FN_GetInfoKeyBuffer
|
||||
|
||||
#ifdef FN_InfoKeyValue
|
||||
char *FN_InfoKeyValue(char *infobuffer, char *key);
|
||||
char *FN_InfoKeyValue(char *infobuffer, const char *key);
|
||||
#endif // FN_InfoKeyValue
|
||||
|
||||
#ifdef FN_SetKeyValue
|
||||
void FN_SetKeyValue(char *infobuffer, char *key, char *value);
|
||||
void FN_SetKeyValue(char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetKeyValue
|
||||
|
||||
#ifdef FN_SetClientKeyValue
|
||||
void FN_SetClientKeyValue(int clientIndex, char *infobuffer, char *key, char *value);
|
||||
void FN_SetClientKeyValue(int clientIndex, char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetClientKeyValue
|
||||
|
||||
#ifdef FN_IsMapValid
|
||||
int FN_IsMapValid(char *filename);
|
||||
int FN_IsMapValid(const char *filename);
|
||||
#endif // FN_IsMapValid
|
||||
|
||||
#ifdef FN_StaticDecal
|
||||
@ -1281,7 +1286,7 @@ void FN_StaticDecal(const float *origin, int decalIndex, int entityIndex, int mo
|
||||
#endif // FN_StaticDecal
|
||||
|
||||
#ifdef FN_PrecacheGeneric
|
||||
int FN_PrecacheGeneric(char *s);
|
||||
int FN_PrecacheGeneric(const char *s);
|
||||
#endif // FN_PrecacheGeneric
|
||||
|
||||
#ifdef FN_GetPlayerUserId
|
||||
@ -1414,11 +1419,11 @@ const char *FN_GetPlayerAuthId(edict_t *e);
|
||||
|
||||
|
||||
#ifdef FN_PrecacheModel_Post
|
||||
int FN_PrecacheModel_Post(char *s);
|
||||
int FN_PrecacheModel_Post(const char *s);
|
||||
#endif // FN_PrecacheModel_Post
|
||||
|
||||
#ifdef FN_PrecacheSound_Post
|
||||
int FN_PrecacheSound_Post(char *s);
|
||||
int FN_PrecacheSound_Post(const char *s);
|
||||
#endif // FN_PrecacheSound_Post
|
||||
|
||||
#ifdef FN_SetModel_Post
|
||||
@ -1438,7 +1443,7 @@ void FN_SetSize_Post(edict_t *e, const float *rgflMin, const float *rgflMax);
|
||||
#endif // FN_SetSize_Post
|
||||
|
||||
#ifdef FN_ChangeLevel_Post
|
||||
void FN_ChangeLevel_Post(char *s1, char *s2);
|
||||
void FN_ChangeLevel_Post(const char *s1, const char *s2);
|
||||
#endif // FN_ChangeLevel_Post
|
||||
|
||||
#ifdef FN_GetSpawnParms_Post
|
||||
@ -1842,19 +1847,19 @@ char *FN_GetInfoKeyBuffer_Post(edict_t *e);
|
||||
#endif // FN_GetInfoKeyBuffer_Post
|
||||
|
||||
#ifdef FN_InfoKeyValue_Post
|
||||
char *FN_InfoKeyValue_Post(char *infobuffer, char *key);
|
||||
char *FN_InfoKeyValue_Post(char *infobuffer, const char *key);
|
||||
#endif // FN_InfoKeyValue_Post
|
||||
|
||||
#ifdef FN_SetKeyValue_Post
|
||||
void FN_SetKeyValue_Post(char *infobuffer, char *key, char *value);
|
||||
void FN_SetKeyValue_Post(char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetKeyValue_Post
|
||||
|
||||
#ifdef FN_SetClientKeyValue_Post
|
||||
void FN_SetClientKeyValue_Post(int clientIndex, char *infobuffer, char *key, char *value);
|
||||
void FN_SetClientKeyValue_Post(int clientIndex, char *infobuffer, const char *key, const char *value);
|
||||
#endif // FN_SetClientKeyValue_Post
|
||||
|
||||
#ifdef FN_IsMapValid_Post
|
||||
int FN_IsMapValid_Post(char *filename);
|
||||
int FN_IsMapValid_Post(const char *filename);
|
||||
#endif // FN_IsMapValid_Post
|
||||
|
||||
#ifdef FN_StaticDecal_Post
|
||||
@ -1862,7 +1867,7 @@ void FN_StaticDecal_Post(const float *origin, int decalIndex, int entityIndex, i
|
||||
#endif // FN_StaticDecal_Post
|
||||
|
||||
#ifdef FN_PrecacheGeneric_Post
|
||||
int FN_PrecacheGeneric_Post(char *s);
|
||||
int FN_PrecacheGeneric_Post(const char *s);
|
||||
#endif // FN_PrecacheGeneric_Post
|
||||
|
||||
#ifdef FN_GetPlayerUserId_Post
|
||||
@ -2116,7 +2121,7 @@ typedef int (*PFN_ADD_NEW_NATIVES) (const AMX_NATIVE_INFO * /*list*/);
|
||||
typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...);
|
||||
typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...);
|
||||
typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/);
|
||||
typedef void (*PFN_PRINT_SRVCONSOLE) (char * /*format*/, ...);
|
||||
typedef void (*PFN_PRINT_SRVCONSOLE) (const char * /*format*/, ...);
|
||||
typedef const char * (*PFN_GET_MODNAME) (void);
|
||||
typedef const char * (*PFN_GET_AMXSCRIPTNAME) (int /*id*/);
|
||||
typedef AMX * (*PFN_GET_AMXSCRIPT) (int /*id*/);
|
||||
@ -2175,8 +2180,8 @@ typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned i
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, const char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, const char* /*func name*/, int* /*index*/);
|
||||
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */);
|
||||
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
||||
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
||||
|
@ -1,81 +1,125 @@
|
||||
#(C)2004-2005 AMX Mod X Development Team
|
||||
# (C)2004-2013 AMX Mod X Development Team
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
HLSDK = ../../../hlsdk
|
||||
###########################################
|
||||
### EDIT THESE PATHS FOR YOUR OWN SETUP ###
|
||||
###########################################
|
||||
|
||||
HLSDK = ../../../hlsdk/multiplayer
|
||||
MM_ROOT = ../../../metamod/metamod
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
#####################################
|
||||
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fno-strict-aliasing -fomit-frame-pointer
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc-4.1
|
||||
NAME = fakemeta
|
||||
|
||||
BIN_SUFFIX_32 = amxx_i386.so
|
||||
BIN_SUFFIX_64 = amxx_amd64.so
|
||||
PROJECT = fakemeta
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp dllfunc.cpp engfunc.cpp fakemeta_amxx.cpp pdata.cpp forward.cpp \
|
||||
fm_tr.cpp pev.cpp glb.cpp fm_tr2.cpp misc.cpp
|
||||
fm_tr.cpp pev.cpp glb.cpp fm_tr2.cpp misc.cpp
|
||||
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
##############################################
|
||||
|
||||
C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -fomit-frame-pointer -pipe
|
||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||
C_GCC4_FLAGS = -fvisibility=hidden
|
||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||
CPP = gcc
|
||||
CPP_OSX = clang
|
||||
|
||||
LINK =
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT) -I$(HLSDK)/common -I$(HLSDK)/pm_shared -Isdk
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(HLSDK)/pm_shared -I$(MM_ROOT) -Isdk
|
||||
|
||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
################################################
|
||||
|
||||
ifeq "$(GCC_VERSION)" "4"
|
||||
OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
|
||||
OS := $(shell uname -s)
|
||||
|
||||
ifeq "$(OS)" "Darwin"
|
||||
CPP = $(CPP_OSX)
|
||||
LIB_EXT = dylib
|
||||
LIB_SUFFIX = _amxx
|
||||
CFLAGS += -DOSX
|
||||
LINK += -dynamiclib -lstdc++ -mmacosx-version-min=10.5
|
||||
else
|
||||
LIB_EXT = so
|
||||
LIB_SUFFIX = _amxx_i386
|
||||
CFLAGS += -DLINUX
|
||||
LINK += -shared
|
||||
endif
|
||||
|
||||
LINK += -m32 -lm -ldl
|
||||
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 -DHAVE_STDINT_H -fno-strict-aliasing -m32 -Wall -Werror \
|
||||
-Wno-invalid-offsetof
|
||||
CPPFLAGS += -fno-exceptions -fno-rtti
|
||||
|
||||
BINARY = $(PROJECT)$(LIB_SUFFIX).$(LIB_EXT)
|
||||
|
||||
ifeq "$(DEBUG)" "true"
|
||||
BIN_DIR = Debug
|
||||
CFLAGS = $(DEBUG_FLAGS)
|
||||
CFLAGS += $(C_DEBUG_FLAGS)
|
||||
else
|
||||
BIN_DIR = Release
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
CFLAGS += $(C_OPT_FLAGS)
|
||||
LINK += -s
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti -Wno-invalid-offsetof -m32
|
||||
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_$(BIN_SUFFIX_64)
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
ifeq "$(IS_CLANG)" "1"
|
||||
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
|
||||
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
|
||||
else
|
||||
BINARY = $(NAME)_$(BIN_SUFFIX_32)
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
OPT_FLAGS += -march=i586
|
||||
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
|
||||
endif
|
||||
|
||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
# Clang || GCC >= 4
|
||||
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
|
||||
CFLAGS += $(C_GCC4_FLAGS)
|
||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||
endif
|
||||
|
||||
# Clang >= 3 || GCC >= 4.7
|
||||
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
|
||||
CFLAGS += -Wno-delete-non-virtual-dtor
|
||||
endif
|
||||
|
||||
# OS is Linux and not using clang
|
||||
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
|
||||
LINK += -static-libgcc
|
||||
endif
|
||||
|
||||
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
|
||||
# This will break if we include other Makefiles, but is fine for now. It allows
|
||||
# us to make a copy of this file that uses altered paths (ie. Makefile.mine)
|
||||
# or other changes without mucking up the original.
|
||||
MAKEFILE_NAME := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
|
||||
$(BIN_DIR)/%.o: %.cpp
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
$(MAKE) fakemeta
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
amd64:
|
||||
$(MAKE) all AMD64=true
|
||||
|
||||
fakemeta: $(OBJ_LINUX)
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
|
||||
|
||||
debug:
|
||||
$(MAKE) all DEBUG=true
|
||||
$(MAKE) -f $(MAKEFILE_NAME) all DEBUG=true
|
||||
|
||||
default: all
|
||||
|
||||
clean:
|
||||
rm -rf Release/sdk/*.o
|
||||
rm -rf Release/*.o
|
||||
rm -rf Release/$(NAME)_$(BIN_SUFFIX_32)
|
||||
rm -rf Release/$(NAME)_$(BIN_SUFFIX_64)
|
||||
rm -rf Debug/sdk/*.o
|
||||
rm -rf Debug/*.o
|
||||
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_32)
|
||||
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_64)
|
||||
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
@ -7,9 +7,9 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
int index;
|
||||
int indexb;
|
||||
unsigned char *pset;
|
||||
char *temp = "";
|
||||
char *temp2 = "";
|
||||
char *temp3 = "";
|
||||
const char *temp = "";
|
||||
const char *temp2 = "";
|
||||
const char *temp3 = "";
|
||||
vec3_t Vec1;
|
||||
vec3_t Vec2;
|
||||
int iparam1;
|
||||
@ -105,7 +105,7 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
temp = MF_GetAmxString(amx,params[3],0,&len);
|
||||
temp2 = MF_GetAmxString(amx,params[4],1,&len);
|
||||
//temp3 = GET_AMXSTRING(amx,params[5],2,len);
|
||||
iparam1 = MDLL_ClientConnect(INDEXENT2(index),STRING(ALLOC_STRING(temp)),STRING(ALLOC_STRING(temp2)),temp3);
|
||||
iparam1 = MDLL_ClientConnect(INDEXENT2(index),STRING(ALLOC_STRING(temp)),STRING(ALLOC_STRING(temp2)),(char *)temp3);
|
||||
cRet = MF_GetAmxAddr(amx,params[6]);
|
||||
MF_SetAmxString(amx,params[5],temp3,cRet[0]);
|
||||
return iparam1;
|
||||
|
@ -34,15 +34,15 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
switch (type)
|
||||
{
|
||||
// pfnPrecacheModel
|
||||
case EngFunc_PrecacheModel: // int ) (char* s);
|
||||
case EngFunc_PrecacheModel: // int ) (const char* s);
|
||||
temp = MF_GetAmxString(amx,params[2],0,&len);
|
||||
if (temp[0]==0)
|
||||
return 0;
|
||||
return (*g_engfuncs.pfnPrecacheModel)((char*)STRING(ALLOC_STRING(temp)));
|
||||
return (*g_engfuncs.pfnPrecacheModel)((char *)STRING(ALLOC_STRING(temp)));
|
||||
|
||||
|
||||
// pfnPrecacheSound
|
||||
case EngFunc_PrecacheSound: // int ) (char* s);
|
||||
case EngFunc_PrecacheSound: // int ) (const char* s);
|
||||
temp = MF_GetAmxString(amx,params[2],0,&len);
|
||||
if (temp[0]==0)
|
||||
return 0;
|
||||
|
@ -83,10 +83,10 @@ static cell AMX_NATIVE_CALL fm_return(AMX *amx, cell *params)
|
||||
*/
|
||||
|
||||
// pfnPrecacheModel
|
||||
SIMPLE_INT_HOOK_STRING(PrecacheModel);
|
||||
SIMPLE_INT_HOOK_CONSTSTRING(PrecacheModel);
|
||||
|
||||
// pfnPrecacheSound
|
||||
SIMPLE_INT_HOOK_STRING(PrecacheSound);
|
||||
SIMPLE_INT_HOOK_CONSTSTRING(PrecacheSound);
|
||||
|
||||
void ClientUserInfoChanged(edict_t *e, char *infobuffer)
|
||||
{
|
||||
@ -261,7 +261,7 @@ void KeyValue_post(edict_t* entity, KeyValueData* data)
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void AlertMessage(ALERT_TYPE atype, char *szFmt, ...)
|
||||
void AlertMessage(ALERT_TYPE atype, const char *szFmt, ...)
|
||||
{
|
||||
static char buf[2048];
|
||||
va_list ap;
|
||||
@ -272,7 +272,7 @@ void AlertMessage(ALERT_TYPE atype, char *szFmt, ...)
|
||||
RETURN_META(mswi(lastFmRes));
|
||||
}
|
||||
|
||||
void AlertMessage_post(ALERT_TYPE atype, char *szFmt, ...)
|
||||
void AlertMessage_post(ALERT_TYPE atype, const char *szFmt, ...)
|
||||
{
|
||||
static char buf[2048];
|
||||
va_list ap;
|
||||
@ -293,7 +293,7 @@ SIMPLE_INT_HOOK_INT(ModelFrames);
|
||||
SIMPLE_VOID_HOOK_EDICT_CONSTVECT_CONSTVECT(SetSize);
|
||||
|
||||
// pfnChangeLevel
|
||||
SIMPLE_VOID_HOOK_STRING_STRING(ChangeLevel);
|
||||
SIMPLE_VOID_HOOK_CONSTSTRING_CONSTSTRING(ChangeLevel);
|
||||
|
||||
// pfnVecToYaw
|
||||
SIMPLE_FLOAT_HOOK_CONSTVECT(VecToYaw);
|
||||
@ -507,7 +507,7 @@ SIMPLE_VOID_HOOK_CONSTEDICT_INT_INT_INT_INT(FadeClientVolume);
|
||||
SIMPLE_VOID_HOOK_CONSTEDICT_FLOAT(SetClientMaxspeed);
|
||||
|
||||
// pfnPrecacheGeneric
|
||||
SIMPLE_INT_HOOK_STRING(PrecacheGeneric);
|
||||
SIMPLE_INT_HOOK_CONSTSTRING(PrecacheGeneric);
|
||||
|
||||
// pfnPrecacheEvent
|
||||
SIMPLE_USHORT_HOOK_INT_CONSTSTRING(PrecacheEvent);
|
||||
@ -600,17 +600,17 @@ SIMPLE_BOOL_HOOK_INT_INT(Voice_GetClientListening);
|
||||
// pfnVoice_SetClientListening
|
||||
SIMPLE_BOOL_HOOK_INT_INT_BOOL(Voice_SetClientListening);
|
||||
|
||||
SIMPLE_STRING_HOOK_STRING_STRING(InfoKeyValue);
|
||||
SIMPLE_STRING_HOOK_STRING_CONSTSTRING(InfoKeyValue);
|
||||
|
||||
SIMPLE_VOID_HOOK_STRING_STRING_STRING(SetKeyValue);
|
||||
SIMPLE_VOID_HOOK_STRING_CONSTSTRING_CONSTSTRING(SetKeyValue);
|
||||
|
||||
SIMPLE_VOID_HOOK_INT_STRING_STRING_STRING(SetClientKeyValue);
|
||||
SIMPLE_VOID_HOOK_INT_STRING_CONSTSTRING_CONSTSTRING(SetClientKeyValue);
|
||||
|
||||
SIMPLE_CONSTSTRING_HOOK_EDICT(GetPlayerAuthId);
|
||||
|
||||
SIMPLE_UINT_HOOK_EDICT(GetPlayerWONId);
|
||||
|
||||
SIMPLE_INT_HOOK_STRING(IsMapValid);
|
||||
SIMPLE_INT_HOOK_CONSTSTRING(IsMapValid);
|
||||
|
||||
int CreateInstancedBaseline(int classname, struct entity_state_s *baseline)
|
||||
{
|
||||
@ -725,7 +725,7 @@ SIMPLE_VOID_HOOK_EDICT(SpectatorThink);
|
||||
SIMPLE_VOID_HOOK_CONSTSTRING(Sys_Error);
|
||||
|
||||
// pfnPM_FindTextureType
|
||||
SIMPLE_CHAR_HOOK_STRING(PM_FindTextureType);
|
||||
SIMPLE_CHAR_HOOK_CONSTSTRING(PM_FindTextureType);
|
||||
|
||||
// pfnRegisterEncoders
|
||||
SIMPLE_VOID_HOOK_VOID(RegisterEncoders);
|
||||
|
@ -75,6 +75,19 @@
|
||||
RETURN_META(MRES_IGNORED); \
|
||||
}
|
||||
|
||||
#define SIMPLE_VOID_HOOK_INT_STRING_CONSTSTRING_CONSTSTRING(call) \
|
||||
void call (int v,char *c, const char *cb, const char *cc) \
|
||||
{ \
|
||||
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),(cell)v,c,cb,cc)); \
|
||||
RETURN_META(mswi(lastFmRes)); \
|
||||
} \
|
||||
void call##_post (int v, char *c, const char *cb, const char *cc) \
|
||||
{ \
|
||||
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),(cell)v,c,cb,cc)); \
|
||||
RETURN_META(MRES_IGNORED); \
|
||||
}
|
||||
|
||||
|
||||
#define SIMPLE_VOID_HOOK_STRING_STRING_STRING(call) \
|
||||
void call (char *c, char *cb, char *cc) \
|
||||
{ \
|
||||
@ -87,6 +100,18 @@
|
||||
RETURN_META(MRES_IGNORED); \
|
||||
}
|
||||
|
||||
#define SIMPLE_VOID_HOOK_STRING_CONSTSTRING_CONSTSTRING(call) \
|
||||
void call (char *c, const char *cb, const char *cc) \
|
||||
{ \
|
||||
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),c,cb,cc)); \
|
||||
RETURN_META(mswi(lastFmRes)); \
|
||||
} \
|
||||
void call##_post (char *c, const char *cb, const char *cc) \
|
||||
{ \
|
||||
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),c,cb,cc)); \
|
||||
RETURN_META(MRES_IGNORED); \
|
||||
}
|
||||
|
||||
#define SIMPLE_STRING_HOOK_STRING_STRING(call) \
|
||||
char* call (char *c, char *cb) \
|
||||
{ \
|
||||
@ -99,6 +124,18 @@
|
||||
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),c,cb)); \
|
||||
RETURN_META_VALUE(MRES_IGNORED, (char*)mlStringResult); \
|
||||
}
|
||||
#define SIMPLE_STRING_HOOK_STRING_CONSTSTRING(call) \
|
||||
char* call (char *c, const char *cb) \
|
||||
{ \
|
||||
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i),c,cb)); \
|
||||
RETURN_META_VALUE(mswi(lastFmRes), (char*)mlStringResult); \
|
||||
} \
|
||||
char* call##_post (char *c, const char *cb) \
|
||||
{ \
|
||||
origStringRet = META_RESULT_ORIG_RET(char *); \
|
||||
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i),c,cb)); \
|
||||
RETURN_META_VALUE(MRES_IGNORED, (char*)mlStringResult); \
|
||||
}
|
||||
#define SIMPLE_CONSTSTRING_HOOK_EDICT(call) \
|
||||
const char* call (edict_t *e) \
|
||||
{ \
|
||||
@ -175,6 +212,19 @@
|
||||
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
|
||||
RETURN_META_VALUE(MRES_IGNORED, (char)mlCellResult); \
|
||||
}
|
||||
#define SIMPLE_CHAR_HOOK_CONSTSTRING(call) \
|
||||
char call (const char *s) \
|
||||
{ \
|
||||
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), s)); \
|
||||
RETURN_META_VALUE(mswi(lastFmRes), (char)mlCellResult); \
|
||||
} \
|
||||
char call##_post (const char *s) \
|
||||
{ \
|
||||
origCellRet = META_RESULT_ORIG_RET(char); \
|
||||
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), s)); \
|
||||
RETURN_META_VALUE(MRES_IGNORED, (char)mlCellResult); \
|
||||
}
|
||||
|
||||
#define SIMPLE_VOID_HOOK_CONSTSTRING(call) \
|
||||
void call (const char *s) \
|
||||
{ \
|
||||
|
@ -1,5 +1,17 @@
|
||||
#include "fakemeta_amxx.h"
|
||||
|
||||
#if defined PAWN_CELL_SIZE
|
||||
# if PAWN_CELL_SIZE == 16
|
||||
# define CELL_MIN SHRT_MIN
|
||||
# elif PAWN_CELL_SIZE == 32
|
||||
# define CELL_MIN INT_MIN
|
||||
# elif PAWN_CELL_SIZE == 64
|
||||
# define CELL_MIN _I64_MIN
|
||||
# endif
|
||||
#else
|
||||
# define CELL_MIN _I32_MIN
|
||||
#endif
|
||||
|
||||
#if defined WIN32
|
||||
#define WINDOWS_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
@ -24,6 +36,12 @@ static cell AMX_NATIVE_CALL set_pdata_int(AMX *amx, cell *params)
|
||||
return 1;
|
||||
#ifdef __linux__
|
||||
iOffset += params[4];
|
||||
#elif defined __APPLE__
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 4)
|
||||
iOffset += params[4];
|
||||
else
|
||||
iOffset += params[5];
|
||||
#endif
|
||||
int iValue=params[3];
|
||||
*((int *)INDEXENT2(index)->pvPrivateData + iOffset) = iValue;
|
||||
@ -38,7 +56,14 @@ static cell AMX_NATIVE_CALL get_pdata_int(AMX *amx, cell *params)
|
||||
return 0;
|
||||
#ifdef __linux__
|
||||
iOffset += params[3];
|
||||
#elif defined __APPLE__
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 3)
|
||||
iOffset += params[3];
|
||||
else
|
||||
iOffset += params[4];
|
||||
#endif
|
||||
|
||||
return *((int *)INDEXENT2(index)->pvPrivateData + iOffset);
|
||||
}
|
||||
// Float
|
||||
@ -51,7 +76,14 @@ static cell AMX_NATIVE_CALL set_pdata_float(AMX *amx, cell *params)
|
||||
return 1;
|
||||
#ifdef __linux__
|
||||
iOffset += params[4];
|
||||
#elif defined __APPLE__
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 4)
|
||||
iOffset += params[4];
|
||||
else
|
||||
iOffset += params[5];
|
||||
#endif
|
||||
|
||||
float fValue=amx_ctof(params[3]);
|
||||
*((float *)INDEXENT2(index)->pvPrivateData + iOffset) = fValue;
|
||||
return 1;
|
||||
@ -65,7 +97,14 @@ static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params)
|
||||
return 1;
|
||||
#ifdef __linux__
|
||||
iOffset += params[3];
|
||||
#elif defined __APPLE__
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 3)
|
||||
iOffset += params[3];
|
||||
else
|
||||
iOffset += params[4];
|
||||
#endif
|
||||
|
||||
return amx_ftoc(*((float *)INDEXENT2(index)->pvPrivateData + iOffset));
|
||||
}
|
||||
|
||||
@ -79,6 +118,12 @@ static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params)
|
||||
return 1;
|
||||
#ifdef __linux__
|
||||
iOffset += params[6];
|
||||
#elif defined __APPLE__
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 6 || params[7] == CELL_MIN)
|
||||
iOffset += params[6];
|
||||
else
|
||||
iOffset += params[7];
|
||||
#endif
|
||||
|
||||
edict_t *pEdict = INDEXENT2(index);
|
||||
@ -111,6 +156,12 @@ static cell AMX_NATIVE_CALL set_pdata_string(AMX *amx, cell *params)
|
||||
return 1;
|
||||
#ifdef __linux__
|
||||
iOffset += params[5];
|
||||
#elif defined __APPLE__
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 5 || params[6] == CELL_MIN)
|
||||
iOffset += params[5];
|
||||
else
|
||||
iOffset += params[6];
|
||||
#endif
|
||||
|
||||
edict_t *pEdict = INDEXENT2(index);
|
||||
@ -152,6 +203,12 @@ static cell AMX_NATIVE_CALL get_pdata_ent(AMX *amx, cell *params)
|
||||
|
||||
#ifdef __linux__
|
||||
iOffset += params[3];
|
||||
#elif defined __APPLE__
|
||||
// Use Linux offset in older plugins
|
||||
if (params[0] / sizeof(cell) == 3)
|
||||
iOffset += params[3];
|
||||
else
|
||||
iOffset += params[4];
|
||||
#endif
|
||||
|
||||
edict_t *pEdict = *(edict_t **)((char *)(INDEXENT2(index)->pvPrivateData) + iOffset);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user