From 212407d9f6d5e9e08a0e736a46d8a622805de416 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 16 Jun 2007 18:33:21 +0000 Subject: [PATCH] added linux support and fixed a few bugs in sdktools --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40962 --- extensions/sdktools/Makefile | 7 ++++--- extensions/sdktools/vcaller.cpp | 4 ++-- extensions/sdktools/vdecoder.cpp | 20 ++++++++------------ 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/extensions/sdktools/Makefile b/extensions/sdktools/Makefile index 8c735d7d..f5625d99 100644 --- a/extensions/sdktools/Makefile +++ b/extensions/sdktools/Makefile @@ -9,12 +9,13 @@ SOURCEMM = ../../../../sourcemm ### EDIT BELOW FOR OTHER PROJECTS ### ##################################### -PROJECT = sample +PROJECT = sdktools.ext #Uncomment for SourceMM-enabled extensions #LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so -OBJECTS = sdk/smsdk_ext.cpp extension.cpp +OBJECTS = sdk/smsdk_ext.cpp extension.cpp vdecoder.cpp vcallbuilder.cpp \ + vcaller.cpp vnatives.cpp ############################################## ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ### @@ -36,7 +37,7 @@ INCLUDE = -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2 -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SMM_TRUNK) -I$(SMM_TRUNK)/sourcehook -I$(SMM_TRUNK)/sourcemm \ -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \ -CFLAGS = -D_LINUX -DNDEBUG -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -fPIC -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H +CFLAGS = -D_LINUX -DNDEBUG -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch -Wno-unused -fPIC -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H CPPFLAGS = -Wno-non-virtual-dtor -fno-exceptions -fno-rtti ################################################ diff --git a/extensions/sdktools/vcaller.cpp b/extensions/sdktools/vcaller.cpp index 462d383c..ed8dfcf0 100644 --- a/extensions/sdktools/vcaller.cpp +++ b/extensions/sdktools/vcaller.cpp @@ -83,9 +83,9 @@ static cell_t PrepSDKCall_SetSignature(IPluginContext *pContext, const cell_t *p void *addrInBase = NULL; if (params[1] == SDKLibrary_Server) { - addrInBase = g_SMAPI->serverFactory(false); + addrInBase = (void *)g_SMAPI->serverFactory(false); } else if (params[1] == SDKLibrary_Engine) { - addrInBase = g_SMAPI->engineFactory(false); + addrInBase = (void *)g_SMAPI->engineFactory(false); } if (addrInBase == NULL) { diff --git a/extensions/sdktools/vdecoder.cpp b/extensions/sdktools/vdecoder.cpp index 92783f20..58a720d9 100644 --- a/extensions/sdktools/vdecoder.cpp +++ b/extensions/sdktools/vdecoder.cpp @@ -145,9 +145,9 @@ DataStatus EncodeValveParam(IPluginContext *pContext, cell_t *addr; pContext->LocalToPhysAddr(param, &addr); - addr[0] = v->x; - addr[1] = v->y; - addr[2] = v->z; + addr[0] = sp_ftoc(v->x); + addr[1] = sp_ftoc(v->y); + addr[2] = sp_ftoc(v->z); return Data_Okay; } @@ -165,9 +165,9 @@ DataStatus EncodeValveParam(IPluginContext *pContext, cell_t *addr; pContext->LocalToPhysAddr(param, &addr); - addr[0] = q->x; - addr[1] = q->y; - addr[2] = q->z; + addr[0] = sp_ftoc(q->x); + addr[1] = sp_ftoc(q->y); + addr[2] = sp_ftoc(q->z); return Data_Okay; } @@ -380,7 +380,7 @@ DataStatus DecodeValveParam(IPluginContext *pContext, pContext->ThrowNativeError("Entity index %d is not a valid client", param); return Data_Fail; } - CBaseEntity *pEntity; + CBaseEntity *pEntity = NULL; if (pEdict) { IServerUnknown *pUnknown = pEdict->GetUnknown(); @@ -395,8 +395,6 @@ DataStatus DecodeValveParam(IPluginContext *pContext, pContext->ThrowNativeError("Entity %d is not a CBaseEntity"); return Data_Fail; } - } else { - pEdict = NULL; } CBaseEntity **ebuf = (CBaseEntity **)buffer; @@ -450,7 +448,7 @@ DataStatus DecodeValveParam(IPluginContext *pContext, return Data_Fail; } } - CBaseEntity *pEntity; + CBaseEntity *pEntity = NULL; if (pEdict) { IServerUnknown *pUnknown = pEdict->GetUnknown(); @@ -465,8 +463,6 @@ DataStatus DecodeValveParam(IPluginContext *pContext, pContext->ThrowNativeError("Entity %d is not a CBaseEntity"); return Data_Fail; } - } else { - pEdict = NULL; } CBaseEntity **ebuf = (CBaseEntity **)buffer;