Added support for CS: Global Offensive (bug 5299, r=asherkin).

This commit is contained in:
Nicholas Hastings 2012-05-27 16:08:03 -04:00
parent fdec003973
commit 917b6d4521
25 changed files with 708 additions and 53 deletions

View File

@ -27,6 +27,10 @@ class SM:
'name': 'BLOODYGOODTIME', 'platform': ['windows']} 'name': 'BLOODYGOODTIME', 'platform': ['windows']}
self.possibleSdks['eye'] = {'sdk': 'HL2SDK-EYE', 'ext': '2.eye', 'def': '5', self.possibleSdks['eye'] = {'sdk': 'HL2SDK-EYE', 'ext': '2.eye', 'def': '5',
'name': 'EYE', 'platform': ['windows']} 'name': 'EYE', 'platform': ['windows']}
self.possibleSdks['csgo'] = {'sdk': 'HL2SDKCSGO', 'ext': '2.csgo', 'def': '11',
'name': 'CSGO', 'platform': ['windows', 'linux']}
# self.possibleSdks['portal2'] = {'sdk': 'HL2SDK-PORTAL2', 'ext': '2.portal2', 'def': '10',
# 'name': 'PORTAL2', 'platform': ['windows']}
self.sdkInfo = { } self.sdkInfo = { }
@ -35,7 +39,7 @@ class SM:
self.compiler.DetectAll(AMBuild) self.compiler.DetectAll(AMBuild)
#Detect variables #Detect variables
envvars = { 'MMSOURCE18': 'mmsource-1.8', envvars = { 'MMSOURCE19': 'mmsource-1.9',
'HL2SDKOBVALVE': 'hl2sdk-ob-valve', 'HL2SDKOBVALVE': 'hl2sdk-ob-valve',
'HL2SDKL4D': 'hl2sdk-l4d', 'HL2SDKL4D': 'hl2sdk-l4d',
'HL2SDKL4D2': 'hl2sdk-l4d2', 'HL2SDKL4D2': 'hl2sdk-l4d2',
@ -45,6 +49,7 @@ class SM:
if AMBuild.target['platform'] != 'darwin': if AMBuild.target['platform'] != 'darwin':
envvars['HL2SDK'] = 'hl2sdk' envvars['HL2SDK'] = 'hl2sdk'
envvars['HL2SDKOB'] = 'hl2sdk-ob' envvars['HL2SDKOB'] = 'hl2sdk-ob'
envvars['HL2SDKCSGO'] = 'hl2sdk-csgo'
#Dark Messiah is Windows-only #Dark Messiah is Windows-only
if AMBuild.target['platform'] == 'windows': if AMBuild.target['platform'] == 'windows':
@ -225,7 +230,7 @@ class SM:
self.compiler.AddToListVar('RCINCLUDES', os.path.join(AMBuild.sourceFolder, 'public')) self.compiler.AddToListVar('RCINCLUDES', os.path.join(AMBuild.sourceFolder, 'public'))
self.compiler.AddToListVar('RCINCLUDES', self.compiler.AddToListVar('RCINCLUDES',
os.path.join(AMBuild.outputFolder, 'includes')) os.path.join(AMBuild.outputFolder, 'includes'))
self.mmsPath = AMBuild.cache['MMSOURCE18'] self.mmsPath = AMBuild.cache['MMSOURCE19']
def DefaultCompiler(self): def DefaultCompiler(self):
return self.compiler.Clone() return self.compiler.Clone()
@ -268,18 +273,22 @@ class SM:
else: else:
staticLibs = os.path.join(sdkPath, 'lib', 'linux') staticLibs = os.path.join(sdkPath, 'lib', 'linux')
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder) workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
if sdk in ['ep2v', 'l4d', 'l4d2']: if sdk in ['ep2v', 'l4d', 'l4d2', 'csgo']:
for i in ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.so', 'libtier0.so']: libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.so', 'libtier0.so']
link = os.path.join(workFolder, i) if sdk == 'csgo':
target = os.path.join(staticLibs, i) libs.append('interfaces_i486.a')
for lib in libs:
link = os.path.join(workFolder, lib)
target = os.path.join(staticLibs, lib)
try: try:
os.lstat(link) os.lstat(link)
except: except:
job.AddCommand(SymlinkCommand(link, target)) job.AddCommand(SymlinkCommand(link, target))
else: else:
for i in ['tier1_i486.a', 'mathlib_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']: libs = ['tier1_i486.a', 'mathlib_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']
link = os.path.join(workFolder, i) for lib in libs:
target = os.path.join(staticLibs, i) link = os.path.join(workFolder, lib)
target = os.path.join(staticLibs, lib)
try: try:
os.lstat(link) os.lstat(link)
except: except:
@ -287,9 +296,12 @@ class SM:
elif AMBuild.target['platform'] == 'darwin': elif AMBuild.target['platform'] == 'darwin':
staticLibs = os.path.join(sdkPath, 'lib', 'mac') staticLibs = os.path.join(sdkPath, 'lib', 'mac')
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder) workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
for i in ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.dylib', 'libtier0.dylib']: libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.dylib', 'libtier0.dylib']
link = os.path.join(workFolder, i) if sdk == 'csgo':
target = os.path.join(staticLibs, i) libs.append('interfaces_i486.a')
for lib in libs:
link = os.path.join(workFolder, lib)
target = os.path.join(staticLibs, lib)
try: try:
os.lstat(link) os.lstat(link)
except: except:
@ -306,6 +318,8 @@ class SM:
def PostSetupHL2Job(self, job, builder, sdk): def PostSetupHL2Job(self, job, builder, sdk):
if AMBuild.target['platform'] in ['linux', 'darwin']: if AMBuild.target['platform'] in ['linux', 'darwin']:
builder.AddObjectFiles(['tier1_i486.a', 'mathlib_i486.a']) builder.AddObjectFiles(['tier1_i486.a', 'mathlib_i486.a'])
if sdk == 'csgo':
builder.AddObjectFiles(['interfaces_i486.a'])
def DefaultHL2Compiler(self, path, sdk, noLink = False, oldMms = '-legacy'): def DefaultHL2Compiler(self, path, sdk, noLink = False, oldMms = '-legacy'):
compiler = self.DefaultExtCompiler(path) compiler = self.DefaultExtCompiler(path)
@ -319,6 +333,10 @@ class SM:
info = self.possibleSdks info = self.possibleSdks
compiler['CDEFINES'].extend(['SE_' + info[i]['name'] + '=' + info[i]['def'] for i in info]) compiler['CDEFINES'].extend(['SE_' + info[i]['name'] + '=' + info[i]['def'] for i in info])
# We don't build for Portal 2 (yet?, ever?), but using this define in code as
# it saves trouble if we ever need to
compiler['CDEFINES'].append('SE_PORTAL2=10')
paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'], paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'],
['public', 'tier0'], ['public', 'tier1']] ['public', 'tier0'], ['public', 'tier1']]
@ -336,8 +354,11 @@ class SM:
compiler['CDEFINES'].append('SOURCE_ENGINE=' + info['def']) compiler['CDEFINES'].append('SOURCE_ENGINE=' + info['def'])
if sdk == 'swarm' and AMBuild.target['platform'] == 'windows': if sdk in ['swarm','csgo']:
compiler['CDEFINES'].extend(['COMPILER_MSVC', 'COMPILER_MSVC32']) if AMBuild.target['platform'] == 'windows':
compiler['CDEFINES'].extend(['COMPILER_MSVC', 'COMPILER_MSVC32'])
else:
compiler['CDEFINES'].extend(['COMPILER_GCC', 'POSIX'])
if sdk == 'ep1': if sdk == 'ep1':
if AMBuild.target['platform'] == 'linux': if AMBuild.target['platform'] == 'linux':
@ -354,7 +375,7 @@ class SM:
if not noLink: if not noLink:
if AMBuild.target['platform'] == 'linux': if AMBuild.target['platform'] == 'linux':
compiler['POSTLINKFLAGS'][0:0] = ['-lm'] compiler['POSTLINKFLAGS'][0:0] = ['-lm']
if sdk in ['ep2v', 'l4d', 'l4d2']: if sdk in ['ep2v', 'l4d', 'l4d2', 'csgo']:
compiler['POSTLINKFLAGS'][0:0] = ['libtier0.so'] compiler['POSTLINKFLAGS'][0:0] = ['libtier0.so']
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.so'] compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.so']
else: else:

View File

@ -78,6 +78,10 @@ CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filena
#define GAMEFIX "2.ep2v" #define GAMEFIX "2.ep2v"
#elif SOURCE_ENGINE == SE_DARKMESSIAH #elif SOURCE_ENGINE == SE_DARKMESSIAH
#define GAMEFIX "2.darkm" #define GAMEFIX "2.darkm"
#elif SOURCE_ENGINE == SE_PORTAL2
#define GAMEFIX "2.portal2"
#elif SOURCE_ENGINE == SE_CSGO
#define GAMEFIX "2.csgo"
#else #else
#define GAMEFIX "2.ep1" #define GAMEFIX "2.ep1"
#endif //(SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2) #endif //(SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)

View File

@ -45,6 +45,9 @@
#include <datamap.h> #include <datamap.h>
#include <ihandleentity.h> #include <ihandleentity.h>
#include <tier0/icommandline.h> #include <tier0/icommandline.h>
#if SOURCE_ENGINE >= SE_PORTAL2
#include <string_t.h>
#endif
class CCommand; class CCommand;
@ -88,6 +91,7 @@ struct DelayedKickInfo
char buffer[384]; char buffer[384];
}; };
// copy from game/shared/entitylist_base.h
class CEntInfo class CEntInfo
{ {
public: public:
@ -95,6 +99,10 @@ public:
int m_SerialNumber; int m_SerialNumber;
CEntInfo *m_pPrev; CEntInfo *m_pPrev;
CEntInfo *m_pNext; CEntInfo *m_pNext;
#if SOURCE_ENGINE >= SE_PORTAL2
string_t m_iName;
string_t m_iClassName;
#endif
}; };
class CHalfLife2 : class CHalfLife2 :

View File

@ -7,6 +7,7 @@ HL2SDK_OB = ../../hl2sdk-ob
HL2SDK_OB_VALVE = ../../hl2sdk-ob-valve HL2SDK_OB_VALVE = ../../hl2sdk-ob-valve
HL2SDK_L4D = ../../hl2sdk-l4d HL2SDK_L4D = ../../hl2sdk-l4d
HL2SDK_L4D2 = ../../hl2sdk-l4d2 HL2SDK_L4D2 = ../../hl2sdk-l4d2
HL2SDK_CSGO = ../../hl2sdk-csgo
MMSOURCE = ../../mmsource-central MMSOURCE = ../../mmsource-central
##################################### #####################################
@ -48,7 +49,7 @@ CPP = gcc
override ENGSET = false override ENGSET = false
ifneq (,$(filter original orangebox orangeboxvalve left4dead left4dead2,$(ENGINE))) ifneq (,$(filter original orangebox orangeboxvalve left4dead left4dead2 csgo,$(ENGINE)))
override ENGSET = true override ENGSET = true
endif endif
@ -93,6 +94,14 @@ ifeq "$(ENGINE)" "left4dead2"
INCLUDE += -I$(HL2SDK)/public/game/server INCLUDE += -I$(HL2SDK)/public/game/server
BINARY = sourcemod.2.l4d2.so BINARY = sourcemod.2.l4d2.so
endif endif
ifeq "$(ENGINE)" "csgo"
HL2SDK = $(HL2SDK_CSGO)
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=11
METAMOD = $(MMSOURCE)/core
INCLUDE += -I$(HL2SDK)/public/game/server
BINARY = sourcemod.2.csgo.so
endif
HL2PUB = $(HL2SDK)/public HL2PUB = $(HL2SDK)/public
@ -118,19 +127,24 @@ else
endif endif
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 \ CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 \
-DSE_ORANGEBOXVALVE=6 -DSE_LEFT4DEAD=7 -DSE_LEFT4DEAD2=8 -DSE_ALIENSWARM=9 -DSE_ORANGEBOXVALVE=6 -DSE_LEFT4DEAD=7 -DSE_LEFT4DEAD2=8 -DSE_ALIENSWARM=9 -DSE_PORTAL2=10 \
-DSE_CSGO=11
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a $(LIB_PREFIX)vstdlib$(LIB_SUFFIX) \ LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a $(LIB_PREFIX)vstdlib$(LIB_SUFFIX) \
$(LIB_PREFIX)tier0$(LIB_SUFFIX) -static-libgcc $(LIB_PREFIX)tier0$(LIB_SUFFIX) -static-libgcc
ifeq "$(ENGINE)" "csgo"
LINK += $(HL2LIB)/interfaces_i486.a
endif
INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \ INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \
-I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook \ -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook \
-I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \ CFLAGS += -D_LINUX -DPOSIX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror \ -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror \
-Wno-uninitialized -Wno-unused -Wno-switch -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H \ -Wno-uninitialized -Wno-unused -Wno-switch -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H \
-DSM_DEFAULT_THREADER -m32 -DSM_DEFAULT_THREADER -m32 -DCOMPILER_GCC
CPPFLAGS += -Wno-non-virtual-dtor -Wno-overloaded-virtual -fno-threadsafe-statics -fno-exceptions -fno-rtti CPPFLAGS += -Wno-non-virtual-dtor -Wno-overloaded-virtual -fno-threadsafe-statics -fno-exceptions -fno-rtti
################################################ ################################################
@ -169,7 +183,7 @@ all: check
check: check:
if [ "$(ENGSET)" = "false" ]; then \ if [ "$(ENGSET)" = "false" ]; then \
echo "You must supply one of the following values for ENGINE:"; \ echo "You must supply one of the following values for ENGINE:"; \
echo "left4dead2, left4dead, orangeboxvalve, orangebox, or original"; \ echo "csgo, left4dead2, left4dead, orangeboxvalve, orangebox, or original"; \
exit 1; \ exit 1; \
fi fi

View File

@ -322,13 +322,19 @@ void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
if (pCollideable) if (pCollideable)
{ {
const Vector & pos = pCollideable->GetCollisionOrigin(); const Vector & pos = pCollideable->GetCollisionOrigin();
enginesound->EmitSound(filter, enginesound->EmitSound(filter,
client, client,
CHAN_AUTO, CHAN_AUTO,
#if SOURCE_ENGINE >= SE_PORTAL2
sound,
-1,
#endif
sound, sound,
VOL_NORM, VOL_NORM,
ATTN_NORM, ATTN_NORM,
#if SOURCE_ENGINE >= SE_PORTAL2
0,
#endif
0, 0,
PITCH_NORM, PITCH_NORM,
&pos); &pos);

View File

@ -47,7 +47,7 @@
#include "sm_trie.h" #include "sm_trie.h"
#include "sourcemod.h" #include "sourcemod.h"
#include <IRootConsoleMenu.h> #include <IRootConsoleMenu.h>
#if SOURCE_ENGINE == SE_ALIENSWARM #if SOURCE_ENGINE >= SE_ALIENSWARM
#include "convar_sm_swarm.h" #include "convar_sm_swarm.h"
#elif (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2) #elif (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
#include "convar_sm_l4d.h" #include "convar_sm_l4d.h"

View File

@ -381,8 +381,14 @@ public:
FnChangeCallback_t GetChangeCallback( int slot ) const { return m_pParent->m_fnChangeCallbacks[ slot ]; } FnChangeCallback_t GetChangeCallback( int slot ) const { return m_pParent->m_fnChangeCallbacks[ slot ]; }
// Retrieve value // Retrieve value
#if SOURCE_ENGINE == SE_CSGO
virtual float GetFloat( void ) const;
virtual int GetInt( void ) const;
#else
FORCEINLINE_CVAR float GetFloat( void ) const; FORCEINLINE_CVAR float GetFloat( void ) const;
FORCEINLINE_CVAR int GetInt( void ) const; FORCEINLINE_CVAR int GetInt( void ) const;
#endif
FORCEINLINE_CVAR Color GetColor( void ) const; FORCEINLINE_CVAR Color GetColor( void ) const;
FORCEINLINE_CVAR bool GetBool() const { return !!GetInt(); } FORCEINLINE_CVAR bool GetBool() const { return !!GetInt(); }
FORCEINLINE_CVAR char const *GetString( void ) const; FORCEINLINE_CVAR char const *GetString( void ) const;
@ -895,7 +901,9 @@ void ConVar_PrintDescription( const ConCommandBase *pVar );
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: Utility class to quickly allow ConCommands to call member methods // Purpose: Utility class to quickly allow ConCommands to call member methods
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifdef _WIN32
#pragma warning (disable : 4355 ) #pragma warning (disable : 4355 )
#endif
template< class T > template< class T >
class CConCommandMemberAccessor : public ConCommand, public ICommandCallback, public ICommandCompletionCallback class CConCommandMemberAccessor : public ConCommand, public ICommandCallback, public ICommandCompletionCallback
@ -942,7 +950,9 @@ private:
FnMemberCommandCompletionCallback_t m_CompletionFunc; FnMemberCommandCompletionCallback_t m_CompletionFunc;
}; };
#ifdef _WIN32
#pragma warning ( default : 4355 ) #pragma warning ( default : 4355 )
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -167,12 +167,16 @@ static const char *get_source_engine_name()
return "left4dead2"; return "left4dead2";
#elif SOURCE_ENGINE == SE_ALIENSWARM #elif SOURCE_ENGINE == SE_ALIENSWARM
return "alienswarm"; return "alienswarm";
#elif SOURCE_ENGINE == SE_PORTAL2
return "portal2";
#elif SOURCE_ENGINE == SE_CSGO
return "csgo";
#endif #endif
} }
static bool symbols_are_hidden() static bool symbols_are_hidden()
{ {
#if (SOURCE_ENGINE == SE_ORANGEBOXVALVE) || (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2) #if (SOURCE_ENGINE == SE_ORANGEBOXVALVE) || (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2) || (SOURCE_ENGINE == SE_CSGO)
return true; return true;
#else #else
return false; return false;

View File

@ -1644,7 +1644,7 @@
<ClCompile> <ClCompile>
<AdditionalOptions>/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_ORANGEBOXVALVE=6 /D SE_LEFT4DEAD=7 /D SE_LEFT4DEAD2=8 /D SE_ALIENSWARM=9 /D SE_PORTAL2=10 /D SE_CSGO=11 /D COMPILER_MSVC /D COMPILER_MSVC32 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_ORANGEBOXVALVE=6 /D SE_LEFT4DEAD=7 /D SE_LEFT4DEAD2=8 /D SE_ALIENSWARM=9 /D SE_PORTAL2=10 /D SE_CSGO=11 /D COMPILER_MSVC /D COMPILER_MSVC32 %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-CSGO)\public;$(HL2SDK-CSGO)\public\engine;$(HL2SDK-CSGO)\public\game\server;$(HL2SDK-CSGO)\public\mathlib;$(HL2SDK-CSGO)\public\tier0;$(HL2SDK-CSGO)\public\tier1;$(HL2SDK-CSGO)\public\vstdlib;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKCSGO)\public;$(HL2SDKCSGO)\public\engine;$(HL2SDKCSGO)\public\game\server;$(HL2SDKCSGO)\public\mathlib;$(HL2SDKCSGO)\public\tier0;$(HL2SDKCSGO)\public\tier1;$(HL2SDKCSGO)\public\vstdlib;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=11;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild> <MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -1661,7 +1661,7 @@
<AdditionalIncludeDirectories>..\..\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>$(HL2SDK-CSGO)\lib\public\tier0.lib;$(HL2SDK-CSGO)\lib\public\tier1.lib;$(HL2SDKL4D2)\lib\public\vstdlib.lib;$(HL2SDK-CSGO)\lib\public\mathlib.lib;$(HL2SDK-CSGO)\lib\public\interfaces.lib;dbghelp.lib;Wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>$(HL2SDKCSGO)\lib\public\tier0.lib;$(HL2SDKCSGO)\lib\public\tier1.lib;$(HL2SDKL4D2)\lib\public\vstdlib.lib;$(HL2SDKCSGO)\lib\public\mathlib.lib;$(HL2SDKCSGO)\lib\public\interfaces.lib;dbghelp.lib;Wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)sourcemod.2.csgo.dll</OutputFile> <OutputFile>$(OutDir)sourcemod.2.csgo.dll</OutputFile>
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
@ -1676,7 +1676,7 @@
<ClCompile> <ClCompile>
<AdditionalOptions>/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_ORANGEBOXVALVE=6 /D SE_LEFT4DEAD=7 /D SE_LEFT4DEAD2=8 /D SE_ALIENSWARM=9 /D SE_PORTAL2=10 /D SE_CSGO=11 /D COMPILER_MSVC /D COMPILER_MSVC32 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_ORANGEBOXVALVE=6 /D SE_LEFT4DEAD=7 /D SE_LEFT4DEAD2=8 /D SE_ALIENSWARM=9 /D SE_PORTAL2=10 /D SE_CSGO=11 /D COMPILER_MSVC /D COMPILER_MSVC32 %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-CSGO)\public;$(HL2SDK-CSGO)\public\engine;$(HL2SDK-CSGO)\public\game\server;$(HL2SDK-CSGO)\public\mathlib;$(HL2SDK-CSGO)\public\tier0;$(HL2SDK-CSGO)\public\tier1;$(HL2SDK-CSGO)\public\vstdlib;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKCSGO)\public;$(HL2SDKCSGO)\public\engine;$(HL2SDKCSGO)\public\game\server;$(HL2SDKCSGO)\public\mathlib;$(HL2SDKCSGO)\public\tier0;$(HL2SDKCSGO)\public\tier1;$(HL2SDKCSGO)\public\vstdlib;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=11;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild> <MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -1693,7 +1693,7 @@
<AdditionalIncludeDirectories>..\..\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>$(HL2SDK-CSGO)\lib\public\tier0.lib;$(HL2SDK-CSGO)\lib\public\tier1.lib;$(HL2SDK-CSGO)\lib\public\vstdlib.lib;$(HL2SDK-CSGO)\lib\public\mathlib.lib;$(HL2SDK-CSGO)\lib\public\interfaces.lib;Wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>$(HL2SDKCSGO)\lib\public\tier0.lib;$(HL2SDKCSGO)\lib\public\tier1.lib;$(HL2SDKCSGO)\lib\public\vstdlib.lib;$(HL2SDKCSGO)\lib\public\mathlib.lib;$(HL2SDKCSGO)\lib\public\interfaces.lib;Wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)sourcemod.2.csgo.dll</OutputFile> <OutputFile>$(OutDir)sourcemod.2.csgo.dll</OutputFile>
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
@ -1708,7 +1708,7 @@
<ClCompile> <ClCompile>
<AdditionalOptions>/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_ORANGEBOXVALVE=6 /D SE_LEFT4DEAD=7 /D SE_LEFT4DEAD2=8 /D SE_ALIENSWARM=9 /D SE_PORTAL2=10 /D SE_CSGO=11 /D COMPILER_MSVC /D COMPILER_MSVC32 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_ORANGEBOXVALVE=6 /D SE_LEFT4DEAD=7 /D SE_LEFT4DEAD2=8 /D SE_ALIENSWARM=9 /D SE_PORTAL2=10 /D SE_CSGO=11 /D COMPILER_MSVC /D COMPILER_MSVC32 %(AdditionalOptions)</AdditionalOptions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-CSGO)\public;$(HL2SDK-CSGO)\public\engine;$(HL2SDK-CSGO)\public\game\server;$(HL2SDK-CSGO)\public\mathlib;$(HL2SDK-CSGO)\public\tier0;$(HL2SDK-CSGO)\public\tier1;$(HL2SDK-CSGO)\public\vstdlib;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKCSGO)\public;$(HL2SDKCSGO)\public\engine;$(HL2SDKCSGO)\public\game\server;$(HL2SDKCSGO)\public\mathlib;$(HL2SDKCSGO)\public\tier0;$(HL2SDKCSGO)\public\tier1;$(HL2SDKCSGO)\public\vstdlib;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=11;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
@ -1723,7 +1723,7 @@
<AdditionalIncludeDirectories>..\..\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>$(HL2SDK-CSGO)\lib\public\tier0.lib;$(HL2SDK-CSGO)\lib\public\tier1.lib;$(HL2SDK-CSGO)\lib\public\vstdlib.lib;$(HL2SDK-CSGO)\lib\public\mathlib.lib;$(HL2SDK-CSGO)\lib\public\interfaces.lib;Wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>$(HL2SDKCSGO)\lib\public\tier0.lib;$(HL2SDKCSGO)\lib\public\tier1.lib;$(HL2SDKCSGO)\lib\public\vstdlib.lib;$(HL2SDKCSGO)\lib\public\mathlib.lib;$(HL2SDKCSGO)\lib\public\interfaces.lib;Wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)sourcemod.2.csgo.dll</OutputFile> <OutputFile>$(OutDir)sourcemod.2.csgo.dll</OutputFile>
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>

View File

@ -476,6 +476,10 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
return 50; return 50;
case SOURCE_ENGINE_ALIENSWARM: case SOURCE_ENGINE_ALIENSWARM:
return 60; return 60;
case SOURCE_ENGINE_PORTAL2:
return 70;
case SOURCE_ENGINE_CSGO:
return 80;
# endif # endif
} }
#else #else

View File

@ -32,7 +32,7 @@
#ifndef _INCLUDE_SOURCEMOD_MM_API_H_ #ifndef _INCLUDE_SOURCEMOD_MM_API_H_
#define _INCLUDE_SOURCEMOD_MM_API_H_ #define _INCLUDE_SOURCEMOD_MM_API_H_
#if SOURCE_ENGINE == SE_ALIENSWARM #if SOURCE_ENGINE >= SE_ALIENSWARM
#include "convar_sm_swarm.h" #include "convar_sm_swarm.h"
#elif (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2) #elif (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
#include "convar_sm_l4d.h" #include "convar_sm_l4d.h"

View File

@ -2,12 +2,12 @@
# Makefile written by David "BAILOPAN" Anderson # Makefile written by David "BAILOPAN" Anderson
SMSDK = ../.. SMSDK = ../..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../../hl2sdk HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob HL2SDK_OB = ../../../hl2sdk-ob
HL2SDK_OB_VALVE = ../../../hl2sdk-ob-valve HL2SDK_OB_VALVE = ../../../hl2sdk-ob-valve
HL2SDK_L4D = ../../../hl2sdk-l4d HL2SDK_L4D = ../../../hl2sdk-l4d
HL2SDK_L4D2 = ../../../hl2sdk-l4d2 HL2SDK_L4D2 = ../../../hl2sdk-l4d2
HL2SDK_CSGO = ../../../hl2sdk-csgo
MMSOURCE17 = ../../../mmsource-central MMSOURCE17 = ../../../mmsource-central
##################################### #####################################
@ -43,7 +43,6 @@ ifeq "$(ENGINE)" "original"
CFLAGS += -DSOURCE_ENGINE=1 CFLAGS += -DSOURCE_ENGINE=1
METAMOD = $(MMSOURCE17)/core-legacy METAMOD = $(MMSOURCE17)/core-legacy
INCLUDE += -I$(HL2SDK)/public/dlls -I$(HL2SDK)/game_shared INCLUDE += -I$(HL2SDK)/public/dlls -I$(HL2SDK)/game_shared
SRCDS = $(SRCDS_BASE)
GAMEFIX = 1.ep1 GAMEFIX = 1.ep1
override ENGSET = true override ENGSET = true
endif endif
@ -54,7 +53,6 @@ ifeq "$(ENGINE)" "orangebox"
CFLAGS += -DSOURCE_ENGINE=3 CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(MMSOURCE17)/core METAMOD = $(MMSOURCE17)/core
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework
SRCDS = $(SRCDS_BASE)/orangebox
GAMEFIX = 2.ep2 GAMEFIX = 2.ep2
override ENGSET = true override ENGSET = true
endif endif
@ -65,7 +63,6 @@ ifeq "$(ENGINE)" "orangeboxvalve"
CFLAGS += -DSOURCE_ENGINE=6 CFLAGS += -DSOURCE_ENGINE=6
METAMOD = $(MMSOURCE17)/core METAMOD = $(MMSOURCE17)/core
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework
SRCDS = $(SRCDS_BASE)/orangebox
GAMEFIX = 2.ep2v GAMEFIX = 2.ep2v
override ENGSET = true override ENGSET = true
endif endif
@ -76,7 +73,6 @@ ifeq "$(ENGINE)" "left4dead"
CFLAGS += -DSOURCE_ENGINE=7 CFLAGS += -DSOURCE_ENGINE=7
METAMOD = $(MMSOURCE17)/core METAMOD = $(MMSOURCE17)/core
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework
SRCDS = $(SRCDS_BASE)/l4d
GAMEFIX = 2.l4d GAMEFIX = 2.l4d
override ENGSET = true override ENGSET = true
endif endif
@ -87,30 +83,45 @@ ifeq "$(ENGINE)" "left4dead2"
CFLAGS += -DSOURCE_ENGINE=8 CFLAGS += -DSOURCE_ENGINE=8
METAMOD = $(MMSOURCE17)/core METAMOD = $(MMSOURCE17)/core
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework
SRCDS = $(SRCDS_BASE)/left4dead2
GAMEFIX = 2.l4d2 GAMEFIX = 2.l4d2
override ENGSET = true override ENGSET = true
endif endif
ifeq "$(ENGINE)" "csgo"
HL2SDK = $(HL2SDK_CSGO)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=11
METAMOD = $(MMSOURCE17)/core
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework
GAMEFIX = 2.csgo
override ENGSET = true
endif
ifeq ($(ENGINE),$(filter $(ENGINE), left4dead2 orangeboxvalve)) ifeq ($(ENGINE),$(filter $(ENGINE), csgo left4dead2 orangeboxvalve))
LINK_HL2 = $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a libvstdlib.so libtier0.so LINK_HL2 = $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a libvstdlib.so libtier0.so
else else
LINK_HL2 = $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a vstdlib_i486.so tier0_i486.so LINK_HL2 = $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a vstdlib_i486.so tier0_i486.so
endif endif
ifeq "$(ENGINE)" "csgo"
LINK_HL2 += $(HL2LIB)/interfaces_i486.a
endif
LINK += $(LINK_HL2) LINK += $(LINK_HL2)
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/tier0 \ INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/tier0 \
-I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/extensions \ -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/extensions \
-I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/sourcepawn
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 \ CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 \
-DSE_ORANGEBOXVALVE=6 -DSE_LEFT4DEAD=7 -DSE_LEFT4DEAD2=8 -DSE_ALIENSWARM=9 -DSE_ORANGEBOXVALVE=6 -DSE_LEFT4DEAD=7 -DSE_LEFT4DEAD2=8 -DSE_ALIENSWARM=9 -DSE_PORTAL2=10 \
-DSE_CSGO=11
LINK += -m32 -ldl -lm LINK += -m32 -ldl -lm
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \ CFLAGS += -D_LINUX -DPOSIX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \ -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -DCOMPILER_GCC \
-Wno-unused -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H -m32 -Wno-switch -Wall -Werror -Wno-uninitialized -Wno-invalid-offsetof -Wno-unused -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H -m32
CPPFLAGS += -Wno-non-virtual-dtor -fno-exceptions -fno-rtti -fno-threadsafe-statics CPPFLAGS += -Wno-non-virtual-dtor -fno-exceptions -fno-rtti -fno-threadsafe-statics
################################################ ################################################
@ -153,12 +164,12 @@ all: check
mkdir -p $(BIN_DIR)/sdk mkdir -p $(BIN_DIR)/sdk
mkdir -p $(BIN_DIR)/CDetour mkdir -p $(BIN_DIR)/CDetour
mkdir -p $(BIN_DIR)/asm mkdir -p $(BIN_DIR)/asm
ifeq ($(ENGINE),$(filter $(ENGINE), left4dead2 orangeboxvalve)) ifeq ($(ENGINE),$(filter $(ENGINE), csgo left4dead2 orangeboxvalve))
ln -sf $(SRCDS)/bin/libvstdlib.so libvstdlib.so; ln -sf $(HL2LIB)/libvstdlib.so libvstdlib.so;
ln -sf $(SRCDS)/bin/libtier0.so libtier0.so; ln -sf $(HL2LIB)/libtier0.so libtier0.so;
else else
ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so; ln -sf $(HL2LIB)/vstdlib_i486.so vstdlib_i486.so;
ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so; ln -sf $(HL2LIB)/tier0_i486.so tier0_i486.so;
endif endif
$(MAKE) -f Makefile extension $(MAKE) -f Makefile extension

View File

@ -964,7 +964,7 @@
<ClCompile> <ClCompile>
<AdditionalOptions>/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_ORANGEBOXVALVE=6 /D SE_LEFT4DEAD=7 /D SE_LEFT4DEAD2=8 /D SE_ALIENSWARM=9 /D SE_PORTAL2=10 /D SE_CSGO=11 /D COMPILER_MSVC /D COMPILER_MSVC32 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_ORANGEBOXVALVE=6 /D SE_LEFT4DEAD=7 /D SE_LEFT4DEAD2=8 /D SE_ALIENSWARM=9 /D SE_PORTAL2=10 /D SE_CSGO=11 /D COMPILER_MSVC /D COMPILER_MSVC32 %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;$(HL2SDK-CSGO)\common;$(HL2SDK-CSGO)\public;$(HL2SDK-CSGO)\public\engine;$(HL2SDK-CSGO)\public\game\server;$(HL2SDK-CSGO)\public\toolframework;$(HL2SDK-CSGO)\public\mathlib;$(HL2SDK-CSGO)\public\tier0;$(HL2SDK-CSGO)\game\shared;$(HL2SDK-CSGO)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;$(HL2SDKCSGO)\common;$(HL2SDKCSGO)\public;$(HL2SDKCSGO)\public\engine;$(HL2SDKCSGO)\public\game\server;$(HL2SDKCSGO)\public\toolframework;$(HL2SDKCSGO)\public\mathlib;$(HL2SDKCSGO)\public\tier0;$(HL2SDKCSGO)\game\shared;$(HL2SDKCSGO)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=11;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild> <MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -981,7 +981,7 @@
<AdditionalIncludeDirectories>..\..\..\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>$(HL2SDK-CSGO)\lib\public\tier0.lib;$(HL2SDK-CSGO)\lib\public\tier1.lib;$(HL2SDK-CSGO)\lib\public\vstdlib.lib;$(HL2SDK-CSGO)\lib\public\mathlib.lib;$(HL2SDK-CSGO)\lib\public\interfaces.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>$(HL2SDKCSGO)\lib\public\tier0.lib;$(HL2SDKCSGO)\lib\public\tier1.lib;$(HL2SDKCSGO)\lib\public\vstdlib.lib;$(HL2SDKCSGO)\lib\public\mathlib.lib;$(HL2SDKCSGO)\lib\public\interfaces.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)sdktools.ext.2.csgo.dll</OutputFile> <OutputFile>$(OutDir)sdktools.ext.2.csgo.dll</OutputFile>
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
@ -996,7 +996,7 @@
<ClCompile> <ClCompile>
<AdditionalOptions>/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_ORANGEBOXVALVE=6 /D SE_LEFT4DEAD=7 /D SE_LEFT4DEAD2=8 /D SE_ALIENSWARM=9 /D SE_PORTAL2=10 /D SE_CSGO=11 /D COMPILER_MSVC /D COMPILER_MSVC32 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_ORANGEBOXVALVE=6 /D SE_LEFT4DEAD=7 /D SE_LEFT4DEAD2=8 /D SE_ALIENSWARM=9 /D SE_PORTAL2=10 /D SE_CSGO=11 /D COMPILER_MSVC /D COMPILER_MSVC32 %(AdditionalOptions)</AdditionalOptions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;$(HL2SDK-CSGO)\common;$(HL2SDK-CSGO)\public;$(HL2SDK-CSGO)\public\engine;$(HL2SDK-CSGO)\public\game\server;$(HL2SDK-CSGO)\public\toolframework;$(HL2SDK-CSGO)\public\mathlib;$(HL2SDK-CSGO)\public\tier0;$(HL2SDK-CSGO)\public\tier1;$(HL2SDK-CSGO)\game\shared;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;$(HL2SDKCSGO)\common;$(HL2SDKCSGO)\public;$(HL2SDKCSGO)\public\engine;$(HL2SDKCSGO)\public\game\server;$(HL2SDKCSGO)\public\toolframework;$(HL2SDKCSGO)\public\mathlib;$(HL2SDKCSGO)\public\tier0;$(HL2SDKCSGO)\public\tier1;$(HL2SDKCSGO)\game\shared;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=11;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
@ -1010,7 +1010,7 @@
<PreprocessorDefinitions>BINARY_NAME="$(TargetFileName)";%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>BINARY_NAME="$(TargetFileName)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>$(HL2SDK-CSGO)\lib\public\tier0.lib;$(HL2SDK-CSGO)\lib\public\tier1.lib;$(HL2SDK-CSGO)\lib\public\vstdlib.lib;$(HL2SDK-CSGO)\lib\public\mathlib.lib;$(HL2SDK-CSGO)\lib\public\interfaces.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>$(HL2SDKCSGO)\lib\public\tier0.lib;$(HL2SDKCSGO)\lib\public\tier1.lib;$(HL2SDKCSGO)\lib\public\vstdlib.lib;$(HL2SDKCSGO)\lib\public\mathlib.lib;$(HL2SDKCSGO)\lib\public\interfaces.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)sdktools.ext.2.csgo.dll</OutputFile> <OutputFile>$(OutDir)sdktools.ext.2.csgo.dll</OutputFile>
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>

View File

@ -105,7 +105,7 @@ void EntityOutputManager::FireEventDetour(void *pOutput, CBaseEntity *pActivator
} }
char sOutput[20]; char sOutput[20];
Q_snprintf(sOutput, sizeof(sOutput), "%x", pOutput); Q_snprintf(sOutput, sizeof(sOutput), "%p", pOutput);
// attempt to directly lookup a hook using the pOutput pointer // attempt to directly lookup a hook using the pOutput pointer
OutputNameStruct *pOutputName = NULL; OutputNameStruct *pOutputName = NULL;

View File

@ -528,7 +528,11 @@ static cell_t SlapPlayer(IPluginContext *pContext, const cell_t *params)
CellRecipientFilter rf; CellRecipientFilter rf;
rf.SetToReliable(true); rf.SetToReliable(true);
rf.Initialize(player_list, total_players); rf.Initialize(player_list, total_players);
#if SOURCE_ENGINE < SE_PORTAL2
engsound->EmitSound(rf, params[1], CHAN_AUTO, sound_name, VOL_NORM, ATTN_NORM, 0, PITCH_NORM, &pos); engsound->EmitSound(rf, params[1], CHAN_AUTO, sound_name, VOL_NORM, ATTN_NORM, 0, PITCH_NORM, &pos);
#else
engsound->EmitSound(rf, params[1], CHAN_AUTO, sound_name, -1, sound_name, VOL_NORM, ATTN_NORM, 0, 0, PITCH_NORM, &pos);
#endif
} }
} }

View File

@ -33,8 +33,13 @@
#include <IForwardSys.h> #include <IForwardSys.h>
SH_DECL_HOOK8_void(IVEngineServer, EmitAmbientSound, SH_NOATTRIB, 0, int, const Vector &, const char *, float, soundlevel_t, int, int, float); SH_DECL_HOOK8_void(IVEngineServer, EmitAmbientSound, SH_NOATTRIB, 0, int, const Vector &, const char *, float, soundlevel_t, int, int, float);
#if SOURCE_ENGINE >= SE_PORTAL2
SH_DECL_HOOK17(IEngineSound, EmitSound, SH_NOATTRIB, 0, int, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, float, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
SH_DECL_HOOK17(IEngineSound, EmitSound, SH_NOATTRIB, 1, int, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
#else
SH_DECL_HOOK14_void(IEngineSound, EmitSound, SH_NOATTRIB, 0, IRecipientFilter &, int, int, const char *, float, float, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int); SH_DECL_HOOK14_void(IEngineSound, EmitSound, SH_NOATTRIB, 0, IRecipientFilter &, int, int, const char *, float, float, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
SH_DECL_HOOK14_void(IEngineSound, EmitSound, SH_NOATTRIB, 1, IRecipientFilter &, int, int, const char *, float, soundlevel_t, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int); SH_DECL_HOOK14_void(IEngineSound, EmitSound, SH_NOATTRIB, 1, IRecipientFilter &, int, int, const char *, float, soundlevel_t, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
#endif
bool g_InSoundHook = false; bool g_InSoundHook = false;
@ -252,10 +257,17 @@ void SoundHooks::OnEmitAmbientSound(int entindex, const Vector &pos, const char
} }
} }
#if SOURCE_ENGINE >= SE_PORTAL2
int SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample,
float flVolume, soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
float soundtime, int speakerentity)
#else
void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSample, void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSample,
float flVolume, soundlevel_t iSoundlevel, int iFlags, int iPitch, const Vector *pOrigin, float flVolume, soundlevel_t iSoundlevel, int iFlags, int iPitch, const Vector *pOrigin,
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
float soundtime, int speakerentity) float soundtime, int speakerentity)
#endif
{ {
SoundHookIter iter; SoundHookIter iter;
IPluginFunction *pFunc; IPluginFunction *pFunc;
@ -287,12 +299,26 @@ void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChann
case Pl_Handled: case Pl_Handled:
case Pl_Stop: case Pl_Stop:
{ {
#if SOURCE_ENGINE >= SE_PORTAL2
RETURN_META_VALUE(MRES_SUPERCEDE, -1);
#else
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
#endif
} }
case Pl_Changed: case Pl_Changed:
{ {
CellRecipientFilter crf; CellRecipientFilter crf;
crf.Initialize(players, size); crf.Initialize(players, size);
#if SOURCE_ENGINE >= SE_PORTAL2
RETURN_META_VALUE_NEWPARAMS(
MRES_IGNORED,
-1,
static_cast<int (IEngineSound::*)(IRecipientFilter &, int, int, const char*, unsigned int, const char*, float, soundlevel_t,
int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>(&IEngineSound::EmitSound),
(crf, iEntIndex, iChannel, buffer, -1, buffer, flVolume, iSoundlevel, nSeed, iFlags, iPitch, pOrigin,
pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity)
);
#else
RETURN_META_NEWPARAMS( RETURN_META_NEWPARAMS(
MRES_IGNORED, MRES_IGNORED,
static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char*, float, soundlevel_t, static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char*, float, soundlevel_t,
@ -300,15 +326,27 @@ void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChann
(crf, iEntIndex, iChannel, buffer, flVolume, iSoundlevel, iFlags, iPitch, pOrigin, (crf, iEntIndex, iChannel, buffer, flVolume, iSoundlevel, iFlags, iPitch, pOrigin,
pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity) pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity)
); );
#endif
} }
} }
} }
#if SOURCE_ENGINE >= SE_PORTAL2
RETURN_META_VALUE(MRES_IGNORED, -1 );
#endif
} }
#if SOURCE_ENGINE >= SE_PORTAL2
int SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample,
float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
float soundtime, int speakerentity)
#else
void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSample, void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSample,
float flVolume, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin, float flVolume, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin,
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
float soundtime, int speakerentity) float soundtime, int speakerentity)
#endif
{ {
SoundHookIter iter; SoundHookIter iter;
IPluginFunction *pFunc; IPluginFunction *pFunc;
@ -341,22 +379,41 @@ void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChan
case Pl_Handled: case Pl_Handled:
case Pl_Stop: case Pl_Stop:
{ {
#if SOURCE_ENGINE >= SE_PORTAL2
RETURN_META_VALUE(MRES_SUPERCEDE, -1);
#else
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
#endif
} }
case Pl_Changed: case Pl_Changed:
{ {
CellRecipientFilter crf; CellRecipientFilter crf;
crf.Initialize(players, size); crf.Initialize(players, size);
#if SOURCE_ENGINE >= SE_PORTAL2
RETURN_META_VALUE_NEWPARAMS(
MRES_IGNORED,
-1,
static_cast<int (IEngineSound::*)(IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, float,
int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>(&IEngineSound::EmitSound),
(crf, iEntIndex, iChannel, buffer, -1, buffer, flVolume, SNDLVL_TO_ATTN(static_cast<soundlevel_t>(sndlevel)),
nSeed, iFlags, iPitch, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity)
);
#else
RETURN_META_NEWPARAMS( RETURN_META_NEWPARAMS(
MRES_IGNORED, MRES_IGNORED,
static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char*, float, float, static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char *, float, float,
int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>(&IEngineSound::EmitSound), int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>(&IEngineSound::EmitSound),
(crf, iEntIndex, iChannel, buffer, flVolume, SNDLVL_TO_ATTN(static_cast<soundlevel_t>(sndlevel)), (crf, iEntIndex, iChannel, buffer, flVolume, SNDLVL_TO_ATTN(static_cast<soundlevel_t>(sndlevel)),
iFlags, iPitch, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity) iFlags, iPitch, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity)
); );
#endif
} }
} }
} }
#if SOURCE_ENGINE >= SE_PORTAL2
RETURN_META_VALUE(MRES_IGNORED, -1 );
#endif
} }
/************************ /************************
@ -452,7 +509,11 @@ static cell_t StopSound(IPluginContext *pContext, const cell_t *params)
char *name; char *name;
pContext->LocalToString(params[3], &name); pContext->LocalToString(params[3], &name);
#if SOURCE_ENGINE >= SE_PORTAL2
engsound->StopSound(entity, channel, name, -1);
#else
engsound->StopSound(entity, channel, name); engsound->StopSound(entity, channel, name);
#endif
return 1; return 1;
} }
@ -547,6 +608,53 @@ static cell_t EmitSound(IPluginContext *pContext, const cell_t *params)
player[0] = cl_array[i]; player[0] = cl_array[i];
crf.Reset(); crf.Reset();
crf.Initialize(player, 1); crf.Initialize(player, 1);
#if SOURCE_ENGINE >= SE_PORTAL2
if (g_InSoundHook)
{
SH_CALL(enginesoundPatch,
static_cast<int (IEngineSound::*)(IRecipientFilter &, int, int, const char*, unsigned int, const char*, float,
soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>
(&IEngineSound::EmitSound))
(crf,
player[0],
channel,
sample,
-1,
sample,
vol,
(soundlevel_t)level,
0,
flags,
pitch,
pOrigin,
pDir,
pOrigVec,
updatePos,
soundtime,
speakerentity);
}
else
{
engsound->EmitSound(crf,
player[0],
channel,
sample,
-1,
sample,
vol,
(soundlevel_t)level,
0,
flags,
pitch,
pOrigin,
pDir,
pOrigVec,
updatePos,
soundtime,
speakerentity);
}
#else
if (g_InSoundHook) if (g_InSoundHook)
{ {
SH_CALL(enginesoundPatch, SH_CALL(enginesoundPatch,
@ -585,8 +693,55 @@ static cell_t EmitSound(IPluginContext *pContext, const cell_t *params)
soundtime, soundtime,
speakerentity); speakerentity);
} }
#endif
} }
} else { } else {
#if SOURCE_ENGINE >= SE_PORTAL2
if (g_InSoundHook)
{
SH_CALL(enginesoundPatch,
static_cast<int (IEngineSound::*)(IRecipientFilter &, int, int, const char*, unsigned int, const char*, float,
soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int)>
(&IEngineSound::EmitSound))
(crf,
entity,
channel,
sample,
-1,
sample,
vol,
(soundlevel_t)level,
0,
flags,
pitch,
pOrigin,
pDir,
pOrigVec,
updatePos,
soundtime,
speakerentity);
}
else
{
engsound->EmitSound(crf,
entity,
channel,
sample,
-1,
sample,
vol,
(soundlevel_t)level,
0,
flags,
pitch,
pOrigin,
pDir,
pOrigVec,
updatePos,
soundtime,
speakerentity);
}
#else
if (g_InSoundHook) if (g_InSoundHook)
{ {
SH_CALL(enginesoundPatch, SH_CALL(enginesoundPatch,
@ -625,6 +780,7 @@ static cell_t EmitSound(IPluginContext *pContext, const cell_t *params)
soundtime, soundtime,
speakerentity); speakerentity);
} }
#endif
} }
return 1; return 1;
@ -712,6 +868,9 @@ static cell_t EmitSentence(IPluginContext *pContext, const cell_t *params)
sentence, sentence,
vol, vol,
(soundlevel_t)level, (soundlevel_t)level,
#if SOURCE_ENGINE >= SE_PORTAL2
0,
#endif
flags, flags,
pitch, pitch,
pOrigin, pOrigin,

View File

@ -50,6 +50,17 @@ public:
void Shutdown(); void Shutdown();
void AddHook(int type, IPluginFunction *pFunc); void AddHook(int type, IPluginFunction *pFunc);
bool RemoveHook(int type, IPluginFunction *pFunc); bool RemoveHook(int type, IPluginFunction *pFunc);
#if SOURCE_ENGINE >= SE_PORTAL2
void OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float delay);
int OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *, unsigned int, const char *pSample, float flVolume,
soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
float soundtime, int speakerentity);
int OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample,
float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
float soundtime, int speakerentity);
#else
void OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol, void OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol,
soundlevel_t soundlevel, int fFlags, int pitch, float delay); soundlevel_t soundlevel, int fFlags, int pitch, float delay);
void OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample, float flVolume, void OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample, float flVolume,
@ -60,6 +71,7 @@ public:
float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin,
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
float soundtime, int speakerentity); float soundtime, int speakerentity);
#endif
private: private:
size_t _FillInPlayers(int *pl_array, IRecipientFilter *pFilter); size_t _FillInPlayers(int *pl_array, IRecipientFilter *pFilter);
void _IncRefCounter(int type); void _IncRefCounter(int type);

View File

@ -93,6 +93,7 @@
"engine" "left4dead" "engine" "left4dead"
"engine" "left4dead2" "engine" "left4dead2"
"engine" "alienswarm" "engine" "alienswarm"
"engine" "csgo"
} }
"Offsets" "Offsets"
@ -149,6 +150,7 @@
"game" "dinodday" "game" "dinodday"
"game" "esmod" "game" "esmod"
"game" "nucleardawn" "game" "nucleardawn"
"game" "csgo"
} }
"Keys" "Keys"
@ -179,6 +181,7 @@
"game" "fistful_of_frags" "game" "fistful_of_frags"
"game" "dinodday" "game" "dinodday"
"game" "nucleardawn" "game" "nucleardawn"
"game" "csgo"
} }
"Keys" "Keys"

View File

@ -0,0 +1,54 @@
/**
* Do not edit this file. Any changes will be overwritten by the gamedata
* updater or by upgrading your SourceMod install.
*
* To override data in this file, create a subdirectory named "custom" and
* place your own gamedata file(s) inside of it. Such files will be parsed
* after SM's own.
*
* For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod)
*/
"Games"
{
/* CGlobalEntityList */
"#default"
{
"#supported"
{
"game" "csgo"
}
"Offsets"
{
/* Offset into LevelShutdown */
"gEntList"
{
"windows" "11"
}
"EntInfo"
{
"windows" "4"
"linux" "4"
"mac" "4"
}
}
"Signatures"
{
"LevelShutdown"
{
"library" "server"
"windows" "\xE8\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xE8"
}
"gEntList"
{
"library" "server"
"linux" "@gEntList"
"mac" "@gEntList"
}
}
}
}

View File

@ -59,5 +59,10 @@
{ {
"engine" "eye" "engine" "eye"
} }
"engine.csgo.txt"
{
"engine" "csgo"
}
} }

View File

@ -0,0 +1,316 @@
/**
* Do not edit this file. Any changes will be overwritten by the gamedata
* updater or by upgrading your SourceMod install.
*
* To override data in this file, create a subdirectory named "custom" and
* place your own gamedata file(s) inside of it. Such files will be parsed
* after SM's own.
*
* For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod)
*/
"Games"
{
/* Sounds */
"#default"
{
"Keys"
{
"SlapSoundCount" "3"
"SlapSound1" "player/damage1.wav"
"SlapSound2" "player/damage2.wav"
"SlapSound2" "player/damage3.wav"
}
}
/* General Temp Entities */
"#default"
{
"Offsets"
{
/* Offset into CBaseTempEntity constructor */
"s_pTempEntities"
{
"windows" "19"
}
"GetTEName"
{
"windows" "4"
"linux" "4"
"mac" "4"
}
"GetTENext"
{
"windows" "8"
"linux" "8"
"mac" "8"
}
"TE_GetServerClass"
{
"windows" "0"
"linux" "0"
"mac" "0"
}
}
"Signatures"
{
"CBaseTempEntity"
{
"library" "server"
"windows" "\x55\x8B\xEC\x8B\xC1\x8B\x4D\x08\xC7\x00\x2A\x2A\x2A\x2A\x89\x48\x2A\x8B"
}
"s_pTempEntities"
{
"library" "server"
"linux" "@_ZN15CBaseTempEntity15s_pTempEntitiesE"
"mac" "@_ZN15CBaseTempEntity15s_pTempEntitiesE"
}
}
}
/* CGlobalEntityList */
"#default"
{
"Signatures"
{
/* Functions in CGlobalEntityList */
"FindEntityByClassname"
{
"library" "server"
"windows" "\x55\x8B\xEC\x53\x56\x8B\xF1\x8B\x4D\x08\x57\x85\xC9\x74\x2A\x8B\x01\x8B\x50\x08\xFF\xD2\x8B\x00\x83\xF8\xFF\x75\x2A\xB8\xFF\x1F\x00\x00\x8D\x04\x40\x8B\x74\xC6\x2A\xEB"
"linux" "@_ZN17CGlobalEntityList21FindEntityByClassnameEP11CBaseEntityPKc"
"mac" "@_ZN17CGlobalEntityList21FindEntityByClassnameEP11CBaseEntityPKc"
}
}
}
/* General GameRules */
"#default"
{
"Offsets"
{
/* Offset into CreateGameRulesObject */
"g_pGameRules"
{
"windows" "2"
}
}
"Signatures"
{
/* This signature sometimes has multiple matches, but this
* does not matter as g_pGameRules is involved in all of them.
* The same g_pGameRules offset applies to each match.
*
* Sometimes this block of bytes is at the beginning of the static
* CreateGameRulesObject function and sometimes it is in the middle
* of an entirely different function. This depends on the game.
*/
"CreateGameRulesObject"
{
"library" "server"
"windows" "\x8B\x0D\x2A\x2A\x2A\x2A\x85\xC9\x74\x2A\x8B\x01\x8B\x50\x2A\x6A\x01\xFF\xD2"
}
"g_pGameRules"
{
"library" "server"
"linux" "@g_pGameRules"
"mac" "@g_pGameRules"
}
}
}
/* IServer interface pointer */
"#default"
{
"Keys"
{
/* Signature for the beginning of IVEngineServer::CreateFakeClient.
*
* The engine binary is not actually scanned in order to look for
* this. SourceHook is used to used to determine the address of the
* function and this signature is used to verify that it contains
* the expected code. A pointer to sv (IServer interface) is used
* here.
*/
"CreateFakeClient_Windows" "\x55\x8B\xEC\x8B\x2A\x2A\x50\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x75"
}
"Offsets"
{
/* Offset into IVEngineServer::CreateFakeClient */
"sv"
{
"windows" "8"
}
}
"Signatures"
{
/* CBaseServer object for IServer interface */
"sv"
{
"library" "engine"
"linux" "@sv"
"mac" "@sv"
}
}
}
/* EntityFactoryDictionary function */
"#default"
{
"Signatures"
{
"EntityFactory"
{
"library" "server"
"windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3"
"linux" "@_Z23EntityFactoryDictionaryv"
"mac" "@_Z23EntityFactoryDictionaryv"
}
}
}
/* CBaseEntityOutput::FireOutput */
"#default"
{
"Signatures"
{
"FireOutput"
{
"library" "server"
"windows" "\x55\x8B\xEC\x81\x2A\x2A\x2A\x2A\x2A\x53\x56\x8B\x71\x2A\x57"
"linux" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
"mac" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
}
}
}
/* SetUserInfo data */
"#default"
{
"Offsets"
{
/**
* CBaseClient::SetUserCVar(char const*,char const*);
* Linux offset straight from VTable dump.
* Windows offset is crazy. Found the windows SetName function using string "(%d)%-.*s" (aD_S in IDA)
* Cross referenced back to the vtable and counted manually (SetUserCvar is 1 higher, offsets start from 1)
*/
"SetUserCvar"
{
/* Not 100% sure on this, why would windows change and not linux - TEST ME */
"windows" "17"
"linux" "64"
"mac" "64"
}
/**
* Offset into CBaseClient - Used by CBaseServer::UpdateUserSettings to determine when changes have been made.
* Find CBaseClient::UpdateUserSettings (strings "net_maxroutable", "cl_updaterate" etc) and the offset is set to 0 near the end.
* Linux: mov byte ptr [esi+0B0h], 0
* Win: mov byte ptr [esi+0B0h], 0
*
* L4D2: This has been moved into CBaseClient::UpdateUserSettings(), rest of the details are still relevant.
*/
"InfoChanged"
{
"windows" "168"
"linux" "168"
"mac" "168"
}
}
}
"csgo"
{
"Offsets"
{
"GiveNamedItem"
{
"windows" "435"
"linux" "436"
"mac" "436"
}
"RemovePlayerItem"
{
"windows" "285"
"linux" "286"
"mac" "286"
}
"Weapon_GetSlot"
{
"windows" "283"
"linux" "284"
"mac" "284"
}
"Ignite"
{
"windows" "219"
"linux" "220"
"mac" "220"
}
"Extinguish"
{
"windows" "222"
"linux" "223"
"mac" "223"
}
"Teleport"
{
"windows" "111"
"linux" "112"
"mac" "112"
}
"CommitSuicide"
{
"windows" "484"
"linux" "484"
"mac" "484"
}
"GetVelocity"
{
"windows" "136"
"linux" "137"
"mac" "137"
}
"EyeAngles"
{
"windows" "127"
"linux" "128"
"mac" "128"
}
"AcceptInput"
{
"windows" "39"
"linux" "40"
"mac" "40"
}
"SetEntityModel"
{
"windows" "26"
"linux" "27"
"mac" "27"
}
"WeaponEquip"
{
"windows" "276"
"linux" "277"
"mac" "277"
}
"Activate"
{
"windows" "36"
"linux" "37"
"mac" "37"
}
"PlayerRunCmd"
{
"windows" "455"
"linux" "456"
"mac" "456"
}
}
}
}

View File

@ -60,6 +60,11 @@
"engine" "eye" "engine" "eye"
} }
"engine.csgo.txt"
{
"engine" "csgo"
}
"game.tf.txt" "game.tf.txt"
{ {
"game" "tf" "game" "tf"

View File

@ -76,6 +76,8 @@
#define FILENAME_1_6_SWARM "sourcemod.2.swarm" PLATFORM_EXT #define FILENAME_1_6_SWARM "sourcemod.2.swarm" PLATFORM_EXT
#define FILENAME_1_6_BGT "sourcemod.2.bgt" PLATFORM_EXT #define FILENAME_1_6_BGT "sourcemod.2.bgt" PLATFORM_EXT
#define FILENAME_1_6_EYE "sourcemod.2.eye" PLATFORM_EXT #define FILENAME_1_6_EYE "sourcemod.2.eye" PLATFORM_EXT
#define FILENAME_1_6_PORTAL2 "sourcemod.2.portal2" PLATFORM_EXT
#define FILENAME_1_6_CSGO "sourcemod.2.csgo" PLATFORM_EXT
HINSTANCE g_hCore = NULL; HINSTANCE g_hCore = NULL;
bool load_attempted = false; bool load_attempted = false;
@ -257,6 +259,16 @@ DLL_EXPORT METAMOD_PLUGIN *CreateInterface_MMS(const MetamodVersionInfo *mvi, co
filename = FILENAME_1_6_EYE; filename = FILENAME_1_6_EYE;
break; break;
} }
case SOURCE_ENGINE_PORTAL2:
{
filename = FILENAME_1_6_PORTAL2;
break;
}
case SOURCE_ENGINE_CSGO:
{
filename = FILENAME_1_6_CSGO;
break;
}
default: default:
{ {
return NULL; return NULL;

View File

@ -46,6 +46,7 @@
#define SOURCE_SDK_LEFT4DEAD 40 /**< Engine released after Left 4 Dead (no SDK yet) */ #define SOURCE_SDK_LEFT4DEAD 40 /**< Engine released after Left 4 Dead (no SDK yet) */
#define SOURCE_SDK_LEFT4DEAD2 50 /**< Engine released after Left 4 Dead 2 (no SDK yet) */ #define SOURCE_SDK_LEFT4DEAD2 50 /**< Engine released after Left 4 Dead 2 (no SDK yet) */
#define SOURCE_SDK_ALIENSWARM 60 /**< SDK+Engine released after Alien Swarm */ #define SOURCE_SDK_ALIENSWARM 60 /**< SDK+Engine released after Alien Swarm */
#define SOURCE_SDK_CSGO 80 /**< Engine released after CS:GO (no SDK yet) */
#define MOTDPANEL_TYPE_TEXT 0 /**< Treat msg as plain text */ #define MOTDPANEL_TYPE_TEXT 0 /**< Treat msg as plain text */
#define MOTDPANEL_TYPE_INDEX 1 /**< Msg is auto determined by the engine */ #define MOTDPANEL_TYPE_INDEX 1 /**< Msg is auto determined by the engine */

View File

@ -70,7 +70,9 @@
# define PLATFORM_APPLE # define PLATFORM_APPLE
# define PLATFORM_LIB_EXT "dylib" # define PLATFORM_LIB_EXT "dylib"
#endif #endif
#define PLATFORM_POSIX #ifndef PLATFORM_POSIX
# define PLATFORM_POSIX
#endif
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>