Added support for Mac OS X and building with clang (bug 5601, r=dvander).
This commit is contained in:
@ -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);
|
||||
|
@ -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))
|
||||
|
@ -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*/);
|
||||
|
Reference in New Issue
Block a user