Merge branch 'master' into csgo-hashmap
This commit is contained in:
commit
b6a2f72e95
129
.travis.yml
129
.travis.yml
@ -1,33 +1,116 @@
|
|||||||
|
git:
|
||||||
|
depth: 3
|
||||||
|
|
||||||
|
sudo: false
|
||||||
|
language: cpp
|
||||||
|
os: linux
|
||||||
|
dist: trusty
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
|
||||||
- lib32stdc++6
|
|
||||||
- lib32z1-dev
|
|
||||||
- libc6-dev-i386
|
|
||||||
- linux-libc-dev
|
|
||||||
- g++-multilib
|
|
||||||
- g++-4.8
|
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
cache:
|
- llvm-toolchain-trusty-4.0
|
||||||
directories:
|
- llvm-toolchain-trusty-5.0
|
||||||
- ../mysql-5.0
|
packages:
|
||||||
language: cpp
|
- lib32stdc++6
|
||||||
sudo: false
|
- lib32z1-dev
|
||||||
compiler:
|
- libc6-dev-i386
|
||||||
- clang
|
- linux-libc-dev
|
||||||
|
- g++-multilib
|
||||||
|
# - clang-3.6
|
||||||
|
# - clang-3.8
|
||||||
|
# - clang-4.0
|
||||||
|
# - clang-5.0
|
||||||
|
# - g++-6
|
||||||
|
# - g++-6-multilib
|
||||||
|
- g++-4.8-multilib
|
||||||
|
- g++-4.8
|
||||||
|
- g++-4.9-multilib
|
||||||
|
- g++-4.9
|
||||||
|
- g++-5-multilib
|
||||||
|
- g++-5
|
||||||
|
- g++-7-multilib
|
||||||
|
- g++-7
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- ../mysql-5.0
|
||||||
env:
|
env:
|
||||||
global:
|
- MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9"
|
||||||
- LLVM_ARCHIVE_URI=http://sourcemod.net/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz
|
- MATRIX_EVAL="CC=gcc-4.8 && CXX=g++-4.8"
|
||||||
before_install:
|
- MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
|
||||||
- wget -nc $LLVM_ARCHIVE_URI -O $HOME/clang+llvm.tar.xz
|
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
|
||||||
- mkdir -p $HOME/clang+llvm
|
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
|
||||||
- tar -xf $HOME/clang+llvm.tar.xz -C $HOME/clang+llvm --strip-components 1
|
|
||||||
- export PATH=$HOME/clang+llvm/bin:$PATH
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
|
include:
|
||||||
|
- os: linux
|
||||||
|
sudo: false
|
||||||
|
language: cpp
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages: ['clang-3.6', 'lib32stdc++6', 'lib32z1-dev', 'libc6-dev-i386', 'linux-libc-dev', 'g++-multilib']
|
||||||
|
cache:
|
||||||
|
directories: ['../mysql-5.0']
|
||||||
|
env: ['MATRIX_EVAL="CC=clang-3.6 && CXX=clang++-3.6"']
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
sudo: false
|
||||||
|
language: cpp
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages: ['clang-3.8', 'lib32stdc++6', 'lib32z1-dev', 'libc6-dev-i386', 'linux-libc-dev', 'g++-multilib']
|
||||||
|
cache:
|
||||||
|
directories: ['../mysql-5.0']
|
||||||
|
env: ['MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8"']
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
sudo: false
|
||||||
|
language: cpp
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources: ['llvm-toolchain-trusty-4.0']
|
||||||
|
packages: ['clang-4.0', 'lib32stdc++6', 'lib32z1-dev', 'libc6-dev-i386', 'linux-libc-dev', 'g++-multilib']
|
||||||
|
cache:
|
||||||
|
directories: ['../mysql-5.0']
|
||||||
|
env: ['MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"']
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
sudo: false
|
||||||
|
language: cpp
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources: ['llvm-toolchain-trusty-5.0']
|
||||||
|
packages: ['clang-5.0', 'lib32stdc++6', 'lib32z1-dev', 'libc6-dev-i386', 'linux-libc-dev', 'g++-multilib']
|
||||||
|
cache:
|
||||||
|
directories: ['../mysql-5.0']
|
||||||
|
env: ['MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0"']
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
sudo: false
|
||||||
|
language: cpp
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources: ['ubuntu-toolchain-r-test']
|
||||||
|
packages: ['g++-6', 'g++-6-multilib', 'lib32stdc++6', 'lib32z1-dev', 'libc6-dev-i386', 'linux-libc-dev', 'g++-multilib']
|
||||||
|
cache:
|
||||||
|
directories: ['../mysql-5.0']
|
||||||
|
env: ['MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"']
|
||||||
|
|
||||||
|
allow_failures:
|
||||||
|
- env: MATRIX_EVAL="CC=clang-3.7 && CXX=clang++-3.7"
|
||||||
|
- env: MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9"
|
||||||
|
- env: MATRIX_EVAL="CC=gcc-4.8 && CXX=g++-4.8"
|
||||||
|
- env: MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
|
||||||
|
- env: MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
|
||||||
|
- env: MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
|
||||||
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- CHECKOUT_DIR=$PWD && cd .. && $CHECKOUT_DIR/tools/checkout-deps.sh && cd $CHECKOUT_DIR
|
- CHECKOUT_DIR=$PWD && cd .. && $CHECKOUT_DIR/tools/checkout-deps.sh && cd $CHECKOUT_DIR
|
||||||
script:
|
script:
|
||||||
- mkdir build && cd build
|
- mkdir build && cd build
|
||||||
- PATH="~/.local/bin:$PATH"
|
- PATH="~/.local/bin:$PATH"
|
||||||
- CC=clang-3.8 CXX=clang-3.8 python ../configure.py --enable-optimize --sdks=episode1,tf2,l4d2,csgo,dota
|
- eval "${MATRIX_EVAL}"
|
||||||
|
- python ../configure.py --enable-optimize --sdks=episode1,tf2,l4d2,csgo,dota
|
||||||
- ambuild
|
- ambuild
|
||||||
|
120
AMBuildScript
120
AMBuildScript
@ -104,7 +104,7 @@ class SMConfig(object):
|
|||||||
|
|
||||||
for sdk_name in PossibleSDKs:
|
for sdk_name in PossibleSDKs:
|
||||||
sdk = PossibleSDKs[sdk_name]
|
sdk = PossibleSDKs[sdk_name]
|
||||||
if builder.target_platform in sdk.platform:
|
if builder.target.platform in sdk.platform:
|
||||||
if builder.options.hl2sdk_root:
|
if builder.options.hl2sdk_root:
|
||||||
sdk_path = os.path.join(builder.options.hl2sdk_root, sdk.folder)
|
sdk_path = os.path.join(builder.options.hl2sdk_root, sdk.folder)
|
||||||
else:
|
else:
|
||||||
@ -148,11 +148,11 @@ class SMConfig(object):
|
|||||||
def configure(self):
|
def configure(self):
|
||||||
builder.AddConfigureFile('pushbuild.txt')
|
builder.AddConfigureFile('pushbuild.txt')
|
||||||
|
|
||||||
cxx = builder.DetectCompilers()
|
cxx = builder.DetectCxx()
|
||||||
|
|
||||||
if cxx.like('gcc'):
|
if cxx.like('gcc'):
|
||||||
self.configure_gcc(cxx)
|
self.configure_gcc(cxx)
|
||||||
elif cxx.vendor == 'msvc':
|
elif cxx.family == 'msvc':
|
||||||
self.configure_msvc(cxx)
|
self.configure_msvc(cxx)
|
||||||
|
|
||||||
# Optimizaiton
|
# Optimizaiton
|
||||||
@ -164,11 +164,11 @@ class SMConfig(object):
|
|||||||
cxx.defines += ['DEBUG', '_DEBUG']
|
cxx.defines += ['DEBUG', '_DEBUG']
|
||||||
|
|
||||||
# Platform-specifics
|
# Platform-specifics
|
||||||
if builder.target_platform == 'linux':
|
if builder.target.platform == 'linux':
|
||||||
self.configure_linux(cxx)
|
self.configure_linux(cxx)
|
||||||
elif builder.target_platform == 'mac':
|
elif builder.target.platform == 'mac':
|
||||||
self.configure_mac(cxx)
|
self.configure_mac(cxx)
|
||||||
elif builder.target_platform == 'windows':
|
elif builder.target.platform == 'windows':
|
||||||
self.configure_windows(cxx)
|
self.configure_windows(cxx)
|
||||||
|
|
||||||
# Finish up.
|
# Finish up.
|
||||||
@ -217,10 +217,16 @@ class SMConfig(object):
|
|||||||
]
|
]
|
||||||
cxx.linkflags += ['-m32']
|
cxx.linkflags += ['-m32']
|
||||||
|
|
||||||
have_gcc = cxx.vendor == 'gcc'
|
have_gcc = cxx.family == 'gcc'
|
||||||
have_clang = cxx.vendor == 'clang'
|
have_clang = cxx.family == 'clang'
|
||||||
if cxx.version >= 'clang-3.6':
|
if cxx.version >= 'clang-3.9':
|
||||||
|
cxx.cxxflags += ['-Wno-expansion-to-defined']
|
||||||
|
if cxx.version == 'clang-3.9' or cxx.version == 'apple-clang-8.0':
|
||||||
|
cxx.cflags += ['-Wno-varargs']
|
||||||
|
if cxx.version >= 'clang-3.6' or cxx.version >= 'apple-clang-7.0':
|
||||||
cxx.cxxflags += ['-Wno-inconsistent-missing-override']
|
cxx.cxxflags += ['-Wno-inconsistent-missing-override']
|
||||||
|
if cxx.version >= 'clang-2.9' or cxx.version >= 'apple-clang-3.0':
|
||||||
|
cxx.cxxflags += ['-Wno-null-dereference']
|
||||||
if have_clang or (cxx.version >= 'gcc-4.6'):
|
if have_clang or (cxx.version >= 'gcc-4.6'):
|
||||||
cxx.cflags += ['-Wno-narrowing']
|
cxx.cflags += ['-Wno-narrowing']
|
||||||
if have_clang or (cxx.version >= 'gcc-4.7'):
|
if have_clang or (cxx.version >= 'gcc-4.7'):
|
||||||
@ -238,6 +244,7 @@ class SMConfig(object):
|
|||||||
|
|
||||||
if have_gcc:
|
if have_gcc:
|
||||||
cxx.cflags += ['-mfpmath=sse']
|
cxx.cflags += ['-mfpmath=sse']
|
||||||
|
cxx.cflags += ['-Wno-maybe-uninitialized']
|
||||||
|
|
||||||
if builder.options.opt == '1':
|
if builder.options.opt == '1':
|
||||||
cxx.cflags += ['-O3']
|
cxx.cflags += ['-O3']
|
||||||
@ -292,13 +299,13 @@ class SMConfig(object):
|
|||||||
def configure_linux(self, cxx):
|
def configure_linux(self, cxx):
|
||||||
cxx.defines += ['_LINUX', 'POSIX', '_FILE_OFFSET_BITS=64']
|
cxx.defines += ['_LINUX', 'POSIX', '_FILE_OFFSET_BITS=64']
|
||||||
cxx.linkflags += ['-Wl,--exclude-libs,ALL', '-lm']
|
cxx.linkflags += ['-Wl,--exclude-libs,ALL', '-lm']
|
||||||
if cxx.vendor == 'gcc':
|
if cxx.family == 'gcc':
|
||||||
cxx.linkflags += ['-static-libgcc']
|
cxx.linkflags += ['-static-libgcc']
|
||||||
elif cxx.vendor == 'clang':
|
elif cxx.family == 'clang':
|
||||||
cxx.linkflags += ['-lgcc_eh']
|
cxx.linkflags += ['-lgcc_eh']
|
||||||
|
|
||||||
def configure_mac(self, cxx):
|
def configure_mac(self, cxx):
|
||||||
cxx.defines += ['OSX', '_OSX', 'POSIX']
|
cxx.defines += ['OSX', '_OSX', 'POSIX', 'KE_ABSOLUTELY_NO_STL']
|
||||||
cxx.cflags += ['-mmacosx-version-min=10.5']
|
cxx.cflags += ['-mmacosx-version-min=10.5']
|
||||||
cxx.linkflags += [
|
cxx.linkflags += [
|
||||||
'-mmacosx-version-min=10.5',
|
'-mmacosx-version-min=10.5',
|
||||||
@ -312,7 +319,7 @@ class SMConfig(object):
|
|||||||
cxx.defines += ['WIN32', '_WINDOWS']
|
cxx.defines += ['WIN32', '_WINDOWS']
|
||||||
|
|
||||||
def AddVersioning(self, binary):
|
def AddVersioning(self, binary):
|
||||||
if builder.target_platform == 'windows':
|
if builder.target.platform == 'windows':
|
||||||
binary.sources += ['version.rc']
|
binary.sources += ['version.rc']
|
||||||
binary.compiler.rcdefines += [
|
binary.compiler.rcdefines += [
|
||||||
'BINARY_NAME="{0}"'.format(binary.outputFile),
|
'BINARY_NAME="{0}"'.format(binary.outputFile),
|
||||||
@ -320,7 +327,7 @@ class SMConfig(object):
|
|||||||
]
|
]
|
||||||
if self.use_auto_versioning():
|
if self.use_auto_versioning():
|
||||||
binary.compiler.rcdefines += ['SM_GENERATED_BUILD']
|
binary.compiler.rcdefines += ['SM_GENERATED_BUILD']
|
||||||
elif builder.target_platform == 'mac':
|
elif builder.target.platform == 'mac':
|
||||||
if binary.type == 'library':
|
if binary.type == 'library':
|
||||||
binary.compiler.postlink += [
|
binary.compiler.postlink += [
|
||||||
'-compatibility_version', '1.0.0',
|
'-compatibility_version', '1.0.0',
|
||||||
@ -330,18 +337,42 @@ class SMConfig(object):
|
|||||||
binary.compiler.linkflags += [self.versionlib]
|
binary.compiler.linkflags += [self.versionlib]
|
||||||
binary.compiler.sourcedeps += SM.generated_headers
|
binary.compiler.sourcedeps += SM.generated_headers
|
||||||
return binary
|
return binary
|
||||||
|
|
||||||
def Library(self, context, name):
|
def LibraryBuilder(self, compiler, name):
|
||||||
binary = context.compiler.Library(name)
|
binary = compiler.Library(name)
|
||||||
|
self.AddVersioning(binary)
|
||||||
if binary.compiler.like('msvc'):
|
if binary.compiler.like('msvc'):
|
||||||
binary.compiler.linkflags += ['/SUBSYSTEM:WINDOWS']
|
binary.compiler.linkflags += ['/SUBSYSTEM:WINDOWS']
|
||||||
return self.AddVersioning(binary)
|
return binary
|
||||||
|
|
||||||
def Program(self, context, name):
|
def ProgramBuilder(self, compiler, name):
|
||||||
binary = context.compiler.Program(name)
|
binary = compiler.Program(name)
|
||||||
|
self.AddVersioning(binary)
|
||||||
|
if '-static-libgcc' in binary.compiler.linkflags:
|
||||||
|
binary.compiler.linkflags.remove('-static-libgcc')
|
||||||
|
if '-lgcc_eh' in binary.compiler.linkflags:
|
||||||
|
binary.compiler.linkflags.remove('-lgcc_eh')
|
||||||
|
if binary.compiler.like('gcc'):
|
||||||
|
binary.compiler.linkflags += ['-lstdc++']
|
||||||
if binary.compiler.like('msvc'):
|
if binary.compiler.like('msvc'):
|
||||||
binary.compiler.linkflags += ['/SUBSYSTEM:CONSOLE']
|
binary.compiler.linkflags += ['/SUBSYSTEM:CONSOLE']
|
||||||
return self.AddVersioning(binary)
|
return binary
|
||||||
|
|
||||||
|
def StaticLibraryBuilder(self, compiler, name):
|
||||||
|
binary = compiler.StaticLibrary(name)
|
||||||
|
return binary;
|
||||||
|
|
||||||
|
def Library(self, context, name):
|
||||||
|
compiler = context.cxx.clone()
|
||||||
|
return self.LibraryBuilder(compiler, name)
|
||||||
|
|
||||||
|
def Program(self, context, name):
|
||||||
|
compiler = context.cxx.clone()
|
||||||
|
return self.ProgramBuilder(compiler, name)
|
||||||
|
|
||||||
|
def StaticLibrary(self, context, name):
|
||||||
|
compiler = context.cxx.clone()
|
||||||
|
return self.StaticLibraryBuilder(compiler, name)
|
||||||
|
|
||||||
def ConfigureForExtension(self, context, compiler):
|
def ConfigureForExtension(self, context, compiler):
|
||||||
compiler.cxxincludes += [
|
compiler.cxxincludes += [
|
||||||
@ -355,9 +386,9 @@ class SMConfig(object):
|
|||||||
return compiler
|
return compiler
|
||||||
|
|
||||||
def ExtLibrary(self, context, name):
|
def ExtLibrary(self, context, name):
|
||||||
binary = context.compiler.Library(name)
|
binary = self.Library(context, name)
|
||||||
self.ConfigureForExtension(context, binary.compiler)
|
self.ConfigureForExtension(context, binary.compiler)
|
||||||
return self.AddVersioning(binary)
|
return binary
|
||||||
|
|
||||||
def ConfigureForHL2(self, binary, sdk):
|
def ConfigureForHL2(self, binary, sdk):
|
||||||
compiler = binary.compiler
|
compiler = binary.compiler
|
||||||
@ -409,29 +440,29 @@ class SMConfig(object):
|
|||||||
compiler.defines += ['NETWORK_VARS_ENABLED']
|
compiler.defines += ['NETWORK_VARS_ENABLED']
|
||||||
|
|
||||||
if sdk.name in ['css', 'hl2dm', 'dods', 'sdk2013', 'bms', 'tf2', 'l4d', 'nucleardawn', 'l4d2']:
|
if sdk.name in ['css', 'hl2dm', 'dods', 'sdk2013', 'bms', 'tf2', 'l4d', 'nucleardawn', 'l4d2']:
|
||||||
if builder.target_platform in ['linux', 'mac']:
|
if builder.target.platform in ['linux', 'mac']:
|
||||||
compiler.defines += ['NO_HOOK_MALLOC', 'NO_MALLOC_OVERRIDE']
|
compiler.defines += ['NO_HOOK_MALLOC', 'NO_MALLOC_OVERRIDE']
|
||||||
|
|
||||||
if sdk.name == 'csgo' and builder.target_platform == 'linux':
|
if sdk.name == 'csgo' and builder.target.platform == 'linux':
|
||||||
compiler.linkflags += ['-lstdc++']
|
compiler.linkflags += ['-lstdc++']
|
||||||
|
|
||||||
for path in paths:
|
for path in paths:
|
||||||
compiler.cxxincludes += [os.path.join(sdk.path, *path)]
|
compiler.cxxincludes += [os.path.join(sdk.path, *path)]
|
||||||
|
|
||||||
if builder.target_platform == 'linux':
|
if builder.target.platform == 'linux':
|
||||||
if sdk.name == 'episode1':
|
if sdk.name == 'episode1':
|
||||||
lib_folder = os.path.join(sdk.path, 'linux_sdk')
|
lib_folder = os.path.join(sdk.path, 'linux_sdk')
|
||||||
elif sdk.name in ['sdk2013', 'bms']:
|
elif sdk.name in ['sdk2013', 'bms']:
|
||||||
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux32')
|
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux32')
|
||||||
else:
|
else:
|
||||||
lib_folder = os.path.join(sdk.path, 'lib', 'linux')
|
lib_folder = os.path.join(sdk.path, 'lib', 'linux')
|
||||||
elif builder.target_platform == 'mac':
|
elif builder.target.platform == 'mac':
|
||||||
if sdk.name in ['sdk2013', 'bms']:
|
if sdk.name in ['sdk2013', 'bms']:
|
||||||
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'osx32')
|
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'osx32')
|
||||||
else:
|
else:
|
||||||
lib_folder = os.path.join(sdk.path, 'lib', 'mac')
|
lib_folder = os.path.join(sdk.path, 'lib', 'mac')
|
||||||
|
|
||||||
if builder.target_platform in ['linux', 'mac']:
|
if builder.target.platform in ['linux', 'mac']:
|
||||||
if sdk.name in ['sdk2013', 'bms']:
|
if sdk.name in ['sdk2013', 'bms']:
|
||||||
compiler.postlink += [
|
compiler.postlink += [
|
||||||
compiler.Dep(os.path.join(lib_folder, 'tier1.a')),
|
compiler.Dep(os.path.join(lib_folder, 'tier1.a')),
|
||||||
@ -446,20 +477,18 @@ class SMConfig(object):
|
|||||||
if sdk.name in ['blade', 'insurgency', 'csgo']:
|
if sdk.name in ['blade', 'insurgency', 'csgo']:
|
||||||
compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'interfaces_i486.a'))]
|
compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'interfaces_i486.a'))]
|
||||||
|
|
||||||
self.AddVersioning(binary)
|
|
||||||
|
|
||||||
dynamic_libs = []
|
dynamic_libs = []
|
||||||
if builder.target_platform == 'linux':
|
if builder.target.platform == 'linux':
|
||||||
if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'bms', 'nucleardawn', 'l4d2', 'insurgency']:
|
if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'bms', 'nucleardawn', 'l4d2', 'insurgency']:
|
||||||
dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so']
|
dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so']
|
||||||
elif sdk.name in ['l4d', 'blade', 'insurgency', 'csgo']:
|
elif sdk.name in ['l4d', 'blade', 'insurgency', 'csgo']:
|
||||||
dynamic_libs = ['libtier0.so', 'libvstdlib.so']
|
dynamic_libs = ['libtier0.so', 'libvstdlib.so']
|
||||||
else:
|
else:
|
||||||
dynamic_libs = ['tier0_i486.so', 'vstdlib_i486.so']
|
dynamic_libs = ['tier0_i486.so', 'vstdlib_i486.so']
|
||||||
elif builder.target_platform == 'mac':
|
elif builder.target.platform == 'mac':
|
||||||
compiler.linkflags.append('-liconv')
|
compiler.linkflags.append('-liconv')
|
||||||
dynamic_libs = ['libtier0.dylib', 'libvstdlib.dylib']
|
dynamic_libs = ['libtier0.dylib', 'libvstdlib.dylib']
|
||||||
elif builder.target_platform == 'windows':
|
elif builder.target.platform == 'windows':
|
||||||
libs = ['tier0', 'tier1', 'vstdlib', 'mathlib']
|
libs = ['tier0', 'tier1', 'vstdlib', 'mathlib']
|
||||||
if sdk.name in ['swarm', 'blade', 'insurgency', 'csgo']:
|
if sdk.name in ['swarm', 'blade', 'insurgency', 'csgo']:
|
||||||
libs.append('interfaces')
|
libs.append('interfaces')
|
||||||
@ -483,17 +512,18 @@ class SMConfig(object):
|
|||||||
return binary
|
return binary
|
||||||
|
|
||||||
def HL2Library(self, context, name, sdk):
|
def HL2Library(self, context, name, sdk):
|
||||||
binary = context.compiler.Library(name)
|
binary = self.Library(context, name)
|
||||||
self.ConfigureForExtension(context, binary.compiler)
|
self.ConfigureForExtension(context, binary.compiler)
|
||||||
return self.ConfigureForHL2(binary, sdk)
|
return self.ConfigureForHL2(binary, sdk)
|
||||||
|
|
||||||
def HL2Project(self, context, name):
|
def HL2Project(self, context, name):
|
||||||
project = context.compiler.LibraryProject(name)
|
project = context.cxx.LibraryProject(name)
|
||||||
self.ConfigureForExtension(context, project.compiler)
|
self.ConfigureForExtension(context, project.compiler)
|
||||||
return project
|
return project
|
||||||
|
|
||||||
def HL2Config(self, project, name, sdk):
|
def HL2Config(self, project, name, sdk):
|
||||||
binary = project.Configure(name, '{0} - {1}'.format(self.tag, sdk.name))
|
binary = project.Configure(name, '{0} - {1}'.format(self.tag, sdk.name))
|
||||||
|
self.AddVersioning(binary)
|
||||||
return self.ConfigureForHL2(binary, sdk)
|
return self.ConfigureForHL2(binary, sdk)
|
||||||
|
|
||||||
SM = SMConfig()
|
SM = SMConfig()
|
||||||
@ -502,23 +532,21 @@ SM.detectSDKs()
|
|||||||
SM.configure()
|
SM.configure()
|
||||||
|
|
||||||
if SM.use_auto_versioning():
|
if SM.use_auto_versioning():
|
||||||
SM.generated_headers = builder.RunScript(
|
SM.generated_headers = builder.Build(
|
||||||
'tools/buildbot/Versioning',
|
'tools/buildbot/Versioning',
|
||||||
{ 'SM': SM }
|
{ 'SM': SM }
|
||||||
)
|
)
|
||||||
SM.versionlib = builder.RunScript(
|
SM.versionlib = builder.Build(
|
||||||
'versionlib/AMBuilder',
|
'versionlib/AMBuilder',
|
||||||
{ 'SM': SM }
|
{ 'SM': SM }
|
||||||
)
|
)
|
||||||
|
|
||||||
# Build SourcePawn externally.
|
# Build SourcePawn externally.
|
||||||
SourcePawn = builder.RunScript('sourcepawn/AMBuildScript', {})
|
SP = builder.Build('sourcepawn/AMBuildScript', {
|
||||||
SP = SourcePawn(
|
'external_root': SM,
|
||||||
root = SM,
|
'external_amtl': os.path.join(builder.sourcePath, 'public', 'amtl'),
|
||||||
amtl = os.path.join(builder.sourcePath, 'public', 'amtl'),
|
'external_build': ['core'],
|
||||||
)
|
})
|
||||||
SP.BuildSpcomp()
|
|
||||||
SP.BuildVM()
|
|
||||||
SM.spcomp = SP.spcomp
|
SM.spcomp = SP.spcomp
|
||||||
SM.binaries += [
|
SM.binaries += [
|
||||||
SP.libsourcepawn
|
SP.libsourcepawn
|
||||||
@ -549,7 +577,7 @@ if builder.backend == 'amb2':
|
|||||||
'tools/buildbot/PackageScript',
|
'tools/buildbot/PackageScript',
|
||||||
]
|
]
|
||||||
|
|
||||||
builder.RunBuildScripts(BuildScripts, { 'SM': SM })
|
builder.Build(BuildScripts, { 'SM': SM })
|
||||||
|
|
||||||
if builder.options.breakpad_dump:
|
if builder.options.breakpad_dump:
|
||||||
builder.RunScript('tools/buildbot/BreakpadSymbols', { 'SM': SM })
|
builder.Build('tools/buildbot/BreakpadSymbols', { 'SM': SM })
|
||||||
|
30
configure.py
30
configure.py
@ -1,7 +1,7 @@
|
|||||||
# vim: set ts=2 sw=2 tw=99 noet:
|
# vim: set ts=2 sw=2 tw=99 noet:
|
||||||
import sys
|
import sys
|
||||||
try:
|
try:
|
||||||
from ambuild2 import run
|
from ambuild2 import run, util
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
import ambuild
|
import ambuild
|
||||||
@ -12,25 +12,29 @@ except:
|
|||||||
sys.stderr.write('http://www.alliedmods.net/ambuild\n')
|
sys.stderr.write('http://www.alliedmods.net/ambuild\n')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
run = run.PrepareBuild(sourcePath=sys.path[0])
|
def make_objdir_name(p):
|
||||||
run.default_build_folder = 'obj-' + run.target_platform
|
return 'obj-' + util.Platform() + '-' + p.target_arch
|
||||||
run.options.add_option('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None,
|
|
||||||
|
parser = run.BuildParser(sourcePath=sys.path[0], api='2.1')
|
||||||
|
parser.default_arch = 'x86'
|
||||||
|
parser.default_build_folder = make_objdir_name
|
||||||
|
parser.options.add_option('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None,
|
||||||
help='Root search folder for HL2SDKs')
|
help='Root search folder for HL2SDKs')
|
||||||
run.options.add_option('--mysql-path', type=str, dest='mysql_path', default=None,
|
parser.options.add_option('--mysql-path', type=str, dest='mysql_path', default=None,
|
||||||
help='Path to MySQL 5')
|
help='Path to MySQL 5')
|
||||||
run.options.add_option('--mms-path', type=str, dest='mms_path', default=None,
|
parser.options.add_option('--mms-path', type=str, dest='mms_path', default=None,
|
||||||
help='Path to Metamod:Source')
|
help='Path to Metamod:Source')
|
||||||
run.options.add_option('--enable-debug', action='store_const', const='1', dest='debug',
|
parser.options.add_option('--enable-debug', action='store_const', const='1', dest='debug',
|
||||||
help='Enable debugging symbols')
|
help='Enable debugging symbols')
|
||||||
run.options.add_option('--enable-optimize', action='store_const', const='1', dest='opt',
|
parser.options.add_option('--enable-optimize', action='store_const', const='1', dest='opt',
|
||||||
help='Enable optimization')
|
help='Enable optimization')
|
||||||
run.options.add_option('--no-mysql', action='store_false', default=True, dest='hasMySql',
|
parser.options.add_option('--no-mysql', action='store_false', default=True, dest='hasMySql',
|
||||||
help='Disable building MySQL extension')
|
help='Disable building MySQL extension')
|
||||||
run.options.add_option('-s', '--sdks', default='all', dest='sdks',
|
parser.options.add_option('-s', '--sdks', default='all', dest='sdks',
|
||||||
help='Build against specified SDKs; valid args are "all", "present", or '
|
help='Build against specified SDKs; valid args are "all", "present", or '
|
||||||
'comma-delimited list of engine names (default: %default)')
|
'comma-delimited list of engine names (default: %default)')
|
||||||
run.options.add_option('--breakpad-dump', action='store_true', dest='breakpad_dump',
|
parser.options.add_option('--breakpad-dump', action='store_true', dest='breakpad_dump',
|
||||||
default=False, help='Dump and upload breakpad symbols')
|
default=False, help='Dump and upload breakpad symbols')
|
||||||
run.options.add_option('--disable-auto-versioning', action='store_true', dest='disable_auto_versioning',
|
parser.options.add_option('--disable-auto-versioning', action='store_true', dest='disable_auto_versioning',
|
||||||
default=False, help='Disable the auto versioning script')
|
default=False, help='Disable the auto versioning script')
|
||||||
run.Configure()
|
parser.Configure()
|
||||||
|
@ -60,15 +60,15 @@ for sdk_name in SM.sdks:
|
|||||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf')
|
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf')
|
||||||
]
|
]
|
||||||
|
|
||||||
if builder.target_platform == 'linux':
|
if builder.target.platform == 'linux':
|
||||||
compiler.postlink += ['-lpthread', '-lrt']
|
compiler.postlink += ['-lpthread', '-lrt']
|
||||||
|
|
||||||
if sdk.name == 'csgo':
|
if sdk.name == 'csgo':
|
||||||
if builder.target_platform == 'linux':
|
if builder.target.platform == 'linux':
|
||||||
lib_path = os.path.join(sdk.path, 'lib', 'linux32', 'release', 'libprotobuf.a')
|
lib_path = os.path.join(sdk.path, 'lib', 'linux32', 'release', 'libprotobuf.a')
|
||||||
elif builder.target_platform == 'mac':
|
elif builder.target.platform == 'mac':
|
||||||
lib_path = os.path.join(sdk.path, 'lib', 'osx32', 'release', 'libprotobuf.a')
|
lib_path = os.path.join(sdk.path, 'lib', 'osx32', 'release', 'libprotobuf.a')
|
||||||
elif builder.target_platform == 'windows':
|
elif builder.target.platform == 'windows':
|
||||||
msvc_ver = compiler.version
|
msvc_ver = compiler.version
|
||||||
vs_year = ''
|
vs_year = ''
|
||||||
if msvc_ver == 1800:
|
if msvc_ver == 1800:
|
||||||
|
@ -277,7 +277,7 @@ SMCResult CoreConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key,
|
|||||||
|
|
||||||
ConfigResult CoreConfig::SetConfigOption(const char *option, const char *value, ConfigSource source, char *error, size_t maxlength)
|
ConfigResult CoreConfig::SetConfigOption(const char *option, const char *value, ConfigSource source, char *error, size_t maxlength)
|
||||||
{
|
{
|
||||||
ConfigResult result;
|
ConfigResult result = ConfigResult_Ignore;
|
||||||
|
|
||||||
/* Notify! */
|
/* Notify! */
|
||||||
SMGlobalClass *pBase = SMGlobalClass::head;
|
SMGlobalClass *pBase = SMGlobalClass::head;
|
||||||
@ -285,7 +285,7 @@ ConfigResult CoreConfig::SetConfigOption(const char *option, const char *value,
|
|||||||
{
|
{
|
||||||
if ((result = pBase->OnSourceModConfigChanged(option, value, source, error, maxlength)) != ConfigResult_Ignore)
|
if ((result = pBase->OnSourceModConfigChanged(option, value, source, error, maxlength)) != ConfigResult_Ignore)
|
||||||
{
|
{
|
||||||
return result;
|
break;
|
||||||
}
|
}
|
||||||
pBase = pBase->m_pGlobalClassNext;
|
pBase = pBase->m_pGlobalClassNext;
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ ConfigResult CoreConfig::SetConfigOption(const char *option, const char *value,
|
|||||||
ke::AString vstr(value);
|
ke::AString vstr(value);
|
||||||
m_KeyValues.replace(option, ke::Move(vstr));
|
m_KeyValues.replace(option, ke::Move(vstr));
|
||||||
|
|
||||||
return ConfigResult_Ignore;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *CoreConfig::GetCoreConfigValue(const char *key)
|
const char *CoreConfig::GetCoreConfigValue(const char *key)
|
||||||
|
@ -171,13 +171,16 @@ ConfigResult CHalfLife2::OnSourceModConfigChanged(const char *key, const char *v
|
|||||||
if (strcasecmp(value, "no") == 0)
|
if (strcasecmp(value, "no") == 0)
|
||||||
{
|
{
|
||||||
m_bFollowCSGOServerGuidelines = false;
|
m_bFollowCSGOServerGuidelines = false;
|
||||||
|
return ConfigResult_Accept;
|
||||||
}
|
}
|
||||||
else if (strcasecmp(value, "yes") == 0)
|
else if (strcasecmp(value, "yes") == 0)
|
||||||
{
|
{
|
||||||
m_bFollowCSGOServerGuidelines = true;
|
m_bFollowCSGOServerGuidelines = true;
|
||||||
|
return ConfigResult_Accept;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ke::SafeSprintf(error, maxlength, "Invalid value: must be \"yes\" or \"no\"");
|
||||||
return ConfigResult_Reject;
|
return ConfigResult_Reject;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,15 +16,15 @@ binary.compiler.defines += [
|
|||||||
'SM_LOGIC'
|
'SM_LOGIC'
|
||||||
]
|
]
|
||||||
|
|
||||||
if builder.target_platform == 'linux':
|
if builder.target.platform == 'linux':
|
||||||
binary.compiler.postlink += ['-lpthread', '-lrt']
|
binary.compiler.postlink += ['-lpthread', '-lrt']
|
||||||
elif builder.target_platform == 'mac':
|
elif builder.target.platform == 'mac':
|
||||||
binary.compiler.cflags += ['-Wno-deprecated-declarations']
|
binary.compiler.cflags += ['-Wno-deprecated-declarations']
|
||||||
binary.compiler.postlink += ['-framework', 'CoreServices']
|
binary.compiler.postlink += ['-framework', 'CoreServices']
|
||||||
|
|
||||||
if binary.compiler.vendor == 'gcc' or binary.compiler.vendor == 'clang':
|
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
|
||||||
binary.compiler.cxxflags += ['-fno-rtti']
|
binary.compiler.cxxflags += ['-fno-rtti']
|
||||||
elif binary.compiler.vendor == 'msvc':
|
elif binary.compiler.family == 'msvc':
|
||||||
binary.compiler.cxxflags += ['/GR-']
|
binary.compiler.cxxflags += ['/GR-']
|
||||||
|
|
||||||
binary.sources += [
|
binary.sources += [
|
||||||
@ -83,7 +83,7 @@ binary.sources += [
|
|||||||
'frame_tasks.cpp',
|
'frame_tasks.cpp',
|
||||||
'smn_halflife.cpp',
|
'smn_halflife.cpp',
|
||||||
]
|
]
|
||||||
if builder.target_platform == 'windows':
|
if builder.target.platform == 'windows':
|
||||||
binary.sources += ['thread/WinThreads.cpp']
|
binary.sources += ['thread/WinThreads.cpp']
|
||||||
else:
|
else:
|
||||||
binary.sources += ['thread/PosixThreads.cpp']
|
binary.sources += ['thread/PosixThreads.cpp']
|
||||||
|
@ -185,7 +185,7 @@ size_t CDataPack::GetPosition() const
|
|||||||
|
|
||||||
bool CDataPack::SetPosition(size_t pos) const
|
bool CDataPack::SetPosition(size_t pos) const
|
||||||
{
|
{
|
||||||
if (pos > m_size-1)
|
if (pos > m_size)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -269,21 +269,9 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
|||||||
if ((i >= m_numparams) || (type & SP_PARAMFLAG_BYREF))
|
if ((i >= m_numparams) || (type & SP_PARAMFLAG_BYREF))
|
||||||
{
|
{
|
||||||
/* If we're byref or we're vararg, we always push everything by ref.
|
/* If we're byref or we're vararg, we always push everything by ref.
|
||||||
* Even if they're byval, we must push them byref.
|
* Even if they're byval, we must push them byref.
|
||||||
*/
|
*/
|
||||||
if (type == Param_String)
|
err = _ExecutePushRef(func, type, param);
|
||||||
{
|
|
||||||
err = func->PushStringEx((char *)param->byref.orig_addr, param->byref.cells, param->byref.sz_flags, param->byref.flags);
|
|
||||||
}
|
|
||||||
else if (type == Param_Float || type == Param_Cell)
|
|
||||||
{
|
|
||||||
err = func->PushCellByRef(¶m->val);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
err = func->PushArray(param->byref.orig_addr, param->byref.cells, param->byref.flags);
|
|
||||||
assert(type == Param_Array || type == Param_FloatByRef || type == Param_CellByRef);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -382,6 +370,58 @@ done:
|
|||||||
return SP_ERROR_NONE;
|
return SP_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CForward::_ExecutePushRef(IPluginFunction *func, ParamType type, FwdParamInfo *param)
|
||||||
|
{
|
||||||
|
/* If we're byref or we're vararg, we always push everything by ref.
|
||||||
|
* Even if they're byval, we must push them byref.
|
||||||
|
*/
|
||||||
|
int err;
|
||||||
|
IPluginRuntime *runtime = func->GetParentRuntime();
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case Param_String:
|
||||||
|
// Normal string was pushed.
|
||||||
|
if (!param->isnull)
|
||||||
|
return func->PushStringEx((char *)param->byref.orig_addr, param->byref.cells, param->byref.sz_flags, param->byref.flags);
|
||||||
|
|
||||||
|
// If NULL_STRING was pushed, push the reference to the pubvar of the callee instead.
|
||||||
|
uint32_t null_string_idx;
|
||||||
|
err = runtime->FindPubvarByName("NULL_STRING", &null_string_idx);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
cell_t null_string;
|
||||||
|
err = runtime->GetPubvarAddrs(null_string_idx, &null_string, nullptr);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
return func->PushCell(null_string);
|
||||||
|
|
||||||
|
case Param_Float:
|
||||||
|
case Param_Cell:
|
||||||
|
return func->PushCellByRef(¶m->val);
|
||||||
|
|
||||||
|
default:
|
||||||
|
assert(type == Param_Array || type == Param_FloatByRef || type == Param_CellByRef);
|
||||||
|
// No NULL_VECTOR was pushed.
|
||||||
|
if (type != Param_Array || !param->isnull)
|
||||||
|
return func->PushArray(param->byref.orig_addr, param->byref.cells, param->byref.flags);
|
||||||
|
|
||||||
|
// If NULL_VECTOR was pushed, push the reference to the pubvar of the callee instead.
|
||||||
|
uint32_t null_vector_idx;
|
||||||
|
err = runtime->FindPubvarByName("NULL_VECTOR", &null_vector_idx);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
cell_t null_vector;
|
||||||
|
err = runtime->GetPubvarAddrs(null_vector_idx, &null_vector, nullptr);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
return func->PushCell(null_vector);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int CForward::PushCell(cell_t cell)
|
int CForward::PushCell(cell_t cell)
|
||||||
{
|
{
|
||||||
if (m_curparam < m_numparams)
|
if (m_curparam < m_numparams)
|
||||||
@ -400,6 +440,7 @@ int CForward::PushCell(cell_t cell)
|
|||||||
m_params[m_curparam].pushedas = Param_Cell;
|
m_params[m_curparam].pushedas = Param_Cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_params[m_curparam].isnull = false;
|
||||||
m_params[m_curparam++].val = cell;
|
m_params[m_curparam++].val = cell;
|
||||||
|
|
||||||
return SP_ERROR_NONE;
|
return SP_ERROR_NONE;
|
||||||
@ -423,6 +464,7 @@ int CForward::PushFloat(float number)
|
|||||||
m_params[m_curparam].pushedas = Param_Float;
|
m_params[m_curparam].pushedas = Param_Float;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_params[m_curparam].isnull = false;
|
||||||
m_params[m_curparam++].val = *(cell_t *)&number;
|
m_params[m_curparam++].val = *(cell_t *)&number;
|
||||||
|
|
||||||
return SP_ERROR_NONE;
|
return SP_ERROR_NONE;
|
||||||
@ -481,14 +523,22 @@ void CForward::_Int_PushArray(cell_t *inarray, unsigned int cells, int flags)
|
|||||||
m_params[m_curparam].byref.cells = cells;
|
m_params[m_curparam].byref.cells = cells;
|
||||||
m_params[m_curparam].byref.flags = flags;
|
m_params[m_curparam].byref.flags = flags;
|
||||||
m_params[m_curparam].byref.orig_addr = inarray;
|
m_params[m_curparam].byref.orig_addr = inarray;
|
||||||
|
m_params[m_curparam].isnull = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CForward::PushArray(cell_t *inarray, unsigned int cells, int flags)
|
int CForward::PushArray(cell_t *inarray, unsigned int cells, int flags)
|
||||||
{
|
{
|
||||||
/* We don't allow this here */
|
/* Push a reference to the NULL_VECTOR pubvar if NULL was passed. */
|
||||||
if (!inarray)
|
if (!inarray)
|
||||||
{
|
{
|
||||||
return SetError(SP_ERROR_PARAM);
|
/* Make sure this was intentional. */
|
||||||
|
if (cells == 3)
|
||||||
|
{
|
||||||
|
return PushNullVector();
|
||||||
|
} else {
|
||||||
|
/* We don't allow this here */
|
||||||
|
return SetError(SP_ERROR_PARAM);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_curparam < m_numparams)
|
if (m_curparam < m_numparams)
|
||||||
@ -520,10 +570,17 @@ void CForward::_Int_PushString(cell_t *inarray, unsigned int cells, int sz_flags
|
|||||||
m_params[m_curparam].byref.flags = cp_flags;
|
m_params[m_curparam].byref.flags = cp_flags;
|
||||||
m_params[m_curparam].byref.orig_addr = inarray;
|
m_params[m_curparam].byref.orig_addr = inarray;
|
||||||
m_params[m_curparam].byref.sz_flags = sz_flags;
|
m_params[m_curparam].byref.sz_flags = sz_flags;
|
||||||
|
m_params[m_curparam].isnull = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CForward::PushString(const char *string)
|
int CForward::PushString(const char *string)
|
||||||
{
|
{
|
||||||
|
/* Push a reference to the NULL_STRING pubvar if NULL was passed. */
|
||||||
|
if (!string)
|
||||||
|
{
|
||||||
|
return PushNullString();
|
||||||
|
}
|
||||||
|
|
||||||
if (m_curparam < m_numparams)
|
if (m_curparam < m_numparams)
|
||||||
{
|
{
|
||||||
if (m_types[m_curparam] == Param_Any)
|
if (m_types[m_curparam] == Param_Any)
|
||||||
@ -570,6 +627,52 @@ int CForward::PushStringEx(char *buffer, size_t length, int sz_flags, int cp_fla
|
|||||||
return SP_ERROR_NONE;
|
return SP_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CForward::PushNullString()
|
||||||
|
{
|
||||||
|
if (m_curparam < m_numparams)
|
||||||
|
{
|
||||||
|
if (m_types[m_curparam] == Param_Any)
|
||||||
|
{
|
||||||
|
m_params[m_curparam].pushedas = Param_String;
|
||||||
|
} else if (m_types[m_curparam] != Param_String) {
|
||||||
|
return SetError(SP_ERROR_PARAM);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!m_varargs || m_numparams > SP_MAX_EXEC_PARAMS)
|
||||||
|
{
|
||||||
|
return SetError(SP_ERROR_PARAMS_MAX);
|
||||||
|
}
|
||||||
|
m_params[m_curparam].pushedas = Param_String;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_params[m_curparam++].isnull = true;
|
||||||
|
|
||||||
|
return SP_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CForward::PushNullVector()
|
||||||
|
{
|
||||||
|
if (m_curparam < m_numparams)
|
||||||
|
{
|
||||||
|
if (m_types[m_curparam] == Param_Any)
|
||||||
|
{
|
||||||
|
m_params[m_curparam].pushedas = Param_Array;
|
||||||
|
} else if (m_types[m_curparam] != Param_Array) {
|
||||||
|
return SetError(SP_ERROR_PARAM);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!m_varargs || m_numparams > SP_MAX_EXEC_PARAMS)
|
||||||
|
{
|
||||||
|
return SetError(SP_ERROR_PARAMS_MAX);
|
||||||
|
}
|
||||||
|
m_params[m_curparam].pushedas = Param_Array;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_params[m_curparam++].isnull = true;
|
||||||
|
|
||||||
|
return SP_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
void CForward::Cancel()
|
void CForward::Cancel()
|
||||||
{
|
{
|
||||||
if (!m_curparam)
|
if (!m_curparam)
|
||||||
|
@ -72,6 +72,9 @@ private:
|
|||||||
CForward(ExecType et, const char *name,
|
CForward(ExecType et, const char *name,
|
||||||
const ParamType *types, unsigned num_params);
|
const ParamType *types, unsigned num_params);
|
||||||
|
|
||||||
|
int PushNullString();
|
||||||
|
int PushNullVector();
|
||||||
|
int _ExecutePushRef(IPluginFunction *func, ParamType type, FwdParamInfo *param);
|
||||||
void _Int_PushArray(cell_t *inarray, unsigned int cells, int flags);
|
void _Int_PushArray(cell_t *inarray, unsigned int cells, int flags);
|
||||||
void _Int_PushString(cell_t *inarray, unsigned int cells, int sz_flags, int cp_flags);
|
void _Int_PushString(cell_t *inarray, unsigned int cells, int sz_flags, int cp_flags);
|
||||||
inline int SetError(int err)
|
inline int SetError(int err)
|
||||||
|
@ -759,6 +759,27 @@ static cell_t StoreToAddress(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t IsNullVector(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
cell_t *pNullVec = pContext->GetNullRef(SP_NULL_VECTOR);
|
||||||
|
if (!pNullVec)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
cell_t *addr;
|
||||||
|
pContext->LocalToPhysAddr(params[1], &addr);
|
||||||
|
|
||||||
|
return addr == pNullVec;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell_t IsNullString(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
char *str;
|
||||||
|
if (pContext->LocalToStringNULL(params[1], &str) != SP_ERROR_NONE)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return str == nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
REGISTER_NATIVES(coreNatives)
|
REGISTER_NATIVES(coreNatives)
|
||||||
{
|
{
|
||||||
{"ThrowError", ThrowError},
|
{"ThrowError", ThrowError},
|
||||||
@ -787,5 +808,7 @@ REGISTER_NATIVES(coreNatives)
|
|||||||
{"RequireFeature", RequireFeature},
|
{"RequireFeature", RequireFeature},
|
||||||
{"LoadFromAddress", LoadFromAddress},
|
{"LoadFromAddress", LoadFromAddress},
|
||||||
{"StoreToAddress", StoreToAddress},
|
{"StoreToAddress", StoreToAddress},
|
||||||
|
{"IsNullVector", IsNullVector},
|
||||||
|
{"IsNullString", IsNullString},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
@ -424,6 +424,58 @@ static cell_t FormatNativeString(IPluginContext *pContext, const cell_t *params)
|
|||||||
return SP_ERROR_NONE;
|
return SP_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t IsNativeParamNullVector(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
if (!s_curnative || (s_curnative->ctx != pContext))
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Not called from inside a native function");
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_t param = params[1];
|
||||||
|
if (param < 1 || param > s_curparams[0])
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeErrorEx(SP_ERROR_PARAM, "Invalid parameter number: %d", param);
|
||||||
|
}
|
||||||
|
|
||||||
|
int err;
|
||||||
|
cell_t *addr;
|
||||||
|
if ((err = s_curcaller->LocalToPhysAddr(s_curparams[param], &addr)) != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_t *pNullVec = s_curcaller->GetNullRef(SP_NULL_VECTOR);
|
||||||
|
if (!pNullVec)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return addr == pNullVec ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell_t IsNativeParamNullString(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
if (!s_curnative || (s_curnative->ctx != pContext))
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Not called from inside a native function");
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_t param = params[1];
|
||||||
|
if (param < 1 || param > s_curparams[0])
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeErrorEx(SP_ERROR_PARAM, "Invalid parameter number: %d", param);
|
||||||
|
}
|
||||||
|
|
||||||
|
int err;
|
||||||
|
char *str;
|
||||||
|
if ((err = s_curcaller->LocalToStringNULL(s_curparams[param], &str)) != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str == nullptr ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
//tee hee
|
//tee hee
|
||||||
REGISTER_NATIVES(nativeNatives)
|
REGISTER_NATIVES(nativeNatives)
|
||||||
{
|
{
|
||||||
@ -439,5 +491,7 @@ REGISTER_NATIVES(nativeNatives)
|
|||||||
{"SetNativeArray", SetNativeArray},
|
{"SetNativeArray", SetNativeArray},
|
||||||
{"SetNativeCellRef", SetNativeCellRef},
|
{"SetNativeCellRef", SetNativeCellRef},
|
||||||
{"SetNativeString", SetNativeString},
|
{"SetNativeString", SetNativeString},
|
||||||
|
{"IsNativeParamNullVector", IsNativeParamNullVector},
|
||||||
|
{"IsNativeParamNullString", IsNativeParamNullString},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <math.h>
|
#include <cmath>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "common_logic.h"
|
#include "common_logic.h"
|
||||||
@ -288,44 +288,6 @@ static cell_t sm_ArcTangent2(IPluginContext *pCtx, const cell_t *params)
|
|||||||
return sp_ftoc(val1);
|
return sp_ftoc(val1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static cell_t sm_FloatRound(IPluginContext *pCtx, const cell_t *params)
|
|
||||||
{
|
|
||||||
float val = sp_ctof(params[1]);
|
|
||||||
|
|
||||||
switch (params[2])
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
val = floor(val);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
val = ceil(val);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 3:
|
|
||||||
{
|
|
||||||
if (val >= 0.0f)
|
|
||||||
{
|
|
||||||
val = floor(val);
|
|
||||||
} else {
|
|
||||||
val = ceil(val);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
val = (float)floor(val + 0.5f);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return static_cast<int>(val);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class RandomHelpers :
|
class RandomHelpers :
|
||||||
public SMGlobalClass,
|
public SMGlobalClass,
|
||||||
public IPluginsListener
|
public IPluginsListener
|
||||||
|
@ -552,6 +552,88 @@ static cell_t sm_CallPushStringEx(IPluginContext *pContext, const cell_t *params
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t sm_CallPushNullVector(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
int err = SP_ERROR_NOT_FOUND;
|
||||||
|
|
||||||
|
if (!s_CallStarted)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Cannot push parameters when there is no call in progress");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s_pFunction)
|
||||||
|
{
|
||||||
|
// Find the NULL_VECTOR pubvar in the target plugin and push the local address.
|
||||||
|
IPluginRuntime *runtime = s_pFunction->GetParentRuntime();
|
||||||
|
uint32_t null_vector_idx;
|
||||||
|
err = runtime->FindPubvarByName("NULL_VECTOR", &null_vector_idx);
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeErrorEx(err, "Target plugin has no NULL_VECTOR.");
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_t null_vector;
|
||||||
|
err = runtime->GetPubvarAddrs(null_vector_idx, &null_vector, nullptr);
|
||||||
|
|
||||||
|
if (!err)
|
||||||
|
err = s_pCallable->PushCell(null_vector);
|
||||||
|
}
|
||||||
|
else if (s_pForward)
|
||||||
|
{
|
||||||
|
err = s_pForward->PushArray(NULL, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
s_pCallable->Cancel();
|
||||||
|
ResetCall();
|
||||||
|
return pContext->ThrowNativeErrorEx(err, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell_t sm_CallPushNullString(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
int err = SP_ERROR_NOT_FOUND;
|
||||||
|
|
||||||
|
if (!s_CallStarted)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Cannot push parameters when there is no call in progress");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s_pFunction)
|
||||||
|
{
|
||||||
|
// Find the NULL_STRING pubvar in the target plugin and push the local address.
|
||||||
|
IPluginRuntime *runtime = s_pFunction->GetParentRuntime();
|
||||||
|
uint32_t null_string_idx;
|
||||||
|
err = runtime->FindPubvarByName("NULL_STRING", &null_string_idx);
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeErrorEx(err, "Target plugin has no NULL_STRING.");
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_t null_string;
|
||||||
|
err = runtime->GetPubvarAddrs(null_string_idx, &null_string, nullptr);
|
||||||
|
|
||||||
|
if (!err)
|
||||||
|
err = s_pCallable->PushCell(null_string);
|
||||||
|
}
|
||||||
|
else if (s_pForward)
|
||||||
|
{
|
||||||
|
err = s_pForward->PushString(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
s_pCallable->Cancel();
|
||||||
|
ResetCall();
|
||||||
|
return pContext->ThrowNativeErrorEx(err, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static cell_t sm_CallFinish(IPluginContext *pContext, const cell_t *params)
|
static cell_t sm_CallFinish(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
int err = SP_ERROR_NOT_RUNNABLE;
|
int err = SP_ERROR_NOT_RUNNABLE;
|
||||||
@ -668,6 +750,8 @@ REGISTER_NATIVES(functionNatives)
|
|||||||
{"Call_PushArrayEx", sm_CallPushArrayEx},
|
{"Call_PushArrayEx", sm_CallPushArrayEx},
|
||||||
{"Call_PushString", sm_CallPushString},
|
{"Call_PushString", sm_CallPushString},
|
||||||
{"Call_PushStringEx", sm_CallPushStringEx},
|
{"Call_PushStringEx", sm_CallPushStringEx},
|
||||||
|
{"Call_PushNullVector", sm_CallPushNullVector},
|
||||||
|
{"Call_PushNullString", sm_CallPushNullString},
|
||||||
{"Call_Finish", sm_CallFinish},
|
{"Call_Finish", sm_CallFinish},
|
||||||
{"Call_Cancel", sm_CallCancel},
|
{"Call_Cancel", sm_CallCancel},
|
||||||
{"RequestFrame", sm_AddFrameAction},
|
{"RequestFrame", sm_AddFrameAction},
|
||||||
|
@ -8,9 +8,9 @@ binary.compiler.cxxincludes += [
|
|||||||
os.path.join(builder.sourcePath, 'public', 'jit'),
|
os.path.join(builder.sourcePath, 'public', 'jit'),
|
||||||
os.path.join(builder.sourcePath, 'public', 'jit', 'x86'),
|
os.path.join(builder.sourcePath, 'public', 'jit', 'x86'),
|
||||||
]
|
]
|
||||||
if binary.compiler.vendor == 'gcc' or binary.compiler.vendor == 'clang':
|
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
|
||||||
binary.compiler.cxxflags += ['-fno-rtti']
|
binary.compiler.cxxflags += ['-fno-rtti']
|
||||||
elif binary.compiler.vendor == 'msvc':
|
elif binary.compiler.family == 'msvc':
|
||||||
binary.compiler.cxxflags += ['/GR-']
|
binary.compiler.cxxflags += ['/GR-']
|
||||||
|
|
||||||
binary.sources += [
|
binary.sources += [
|
||||||
|
@ -5,9 +5,9 @@ binary = SM.ExtLibrary(builder, 'clientprefs.ext')
|
|||||||
binary.compiler.cxxincludes += [
|
binary.compiler.cxxincludes += [
|
||||||
os.path.join(SM.mms_root, 'core', 'sourcehook'),
|
os.path.join(SM.mms_root, 'core', 'sourcehook'),
|
||||||
]
|
]
|
||||||
if binary.compiler.vendor == 'gcc' or binary.compiler.vendor == 'clang':
|
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
|
||||||
binary.compiler.cxxflags += ['-fno-rtti']
|
binary.compiler.cxxflags += ['-fno-rtti']
|
||||||
elif binary.compiler.vendor == 'msvc':
|
elif binary.compiler.family == 'msvc':
|
||||||
binary.compiler.cxxflags += ['/GR-']
|
binary.compiler.cxxflags += ['/GR-']
|
||||||
|
|
||||||
binary.sources += [
|
binary.sources += [
|
||||||
|
@ -31,35 +31,35 @@
|
|||||||
|
|
||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
#include "util_cstrike.h"
|
#include "util_cstrike.h"
|
||||||
#include "RegNatives.h"
|
#include "RegNatives.h"
|
||||||
#include <iplayerinfo.h>
|
#include <iplayerinfo.h>
|
||||||
#if SOURCE_ENGINE == SE_CSGO
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
#include "itemdef-hash.h"
|
#include "itemdef-hash.h"
|
||||||
|
|
||||||
ClassnameMap g_mapClassToDefIdx;
|
ClassnameMap g_mapClassToDefIdx;
|
||||||
ItemIndexMap g_mapDefIdxToClass;
|
ItemIndexMap g_mapDefIdxToClass;
|
||||||
WeaponIDMap g_mapWeaponIDToDefIdx;
|
WeaponIDMap g_mapWeaponIDToDefIdx;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define REGISTER_ADDR(name, defaultret, code) \
|
#define REGISTER_ADDR(name, defaultret, code) \
|
||||||
void *addr; \
|
void *addr; \
|
||||||
if (!g_pGameConf->GetMemSig(name, &addr) || !addr) \
|
if (!g_pGameConf->GetMemSig(name, &addr) || !addr) \
|
||||||
{ \
|
{ \
|
||||||
g_pSM->LogError(myself, "Failed to lookup %s signature.", name); \
|
g_pSM->LogError(myself, "Failed to lookup %s signature.", name); \
|
||||||
return defaultret; \
|
return defaultret; \
|
||||||
} \
|
} \
|
||||||
code; \
|
code; \
|
||||||
g_RegNatives.Register(pWrapper);
|
g_RegNatives.Register(pWrapper);
|
||||||
|
|
||||||
#define GET_MEMSIG(name, defaultret) \
|
#define GET_MEMSIG(name, defaultret) \
|
||||||
if (!g_pGameConf->GetMemSig(name, &addr) || !addr) \
|
if (!g_pGameConf->GetMemSig(name, &addr) || !addr) \
|
||||||
{ \
|
{ \
|
||||||
g_pSM->LogError(myself, "Failed to lookup %s signature.", name); \
|
g_pSM->LogError(myself, "Failed to lookup %s signature.", name); \
|
||||||
return defaultret;\
|
return defaultret;\
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SOURCE_ENGINE == SE_CSGO
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
|
||||||
// Get a CEconItemView for the m4
|
// Get a CEconItemView for the m4
|
||||||
// Found in CCSPlayer::HandleCommand_Buy_Internal
|
// Found in CCSPlayer::HandleCommand_Buy_Internal
|
||||||
// Linux a1 - CCSPlayer *pEntity, v5 - Player Team, a3 - ItemLoadoutSlot -1 use default loadoutslot:
|
// Linux a1 - CCSPlayer *pEntity, v5 - Player Team, a3 - ItemLoadoutSlot -1 use default loadoutslot:
|
||||||
@ -70,16 +70,16 @@ WeaponIDMap g_mapWeaponIDToDefIdx;
|
|||||||
// The function is CCSPlayerInventory::GetItemInLoadout(int, int)
|
// The function is CCSPlayerInventory::GetItemInLoadout(int, int)
|
||||||
// We can pass NULL view to the GetAttribute to use default loadoutslot.
|
// We can pass NULL view to the GetAttribute to use default loadoutslot.
|
||||||
// We only really care about m4a1/m4a4 as price differs between them
|
// We only really care about m4a1/m4a4 as price differs between them
|
||||||
// thisPtrOffset = 9472/9492
|
// thisPtrOffset = 9472/9492
|
||||||
|
|
||||||
CEconItemView *GetEconItemView(CBaseEntity *pEntity, int iSlot)
|
CEconItemView *GetEconItemView(CBaseEntity *pEntity, int iSlot)
|
||||||
{
|
{
|
||||||
if (!pEntity)
|
if (!pEntity)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
static ICallWrapper *pWrapper = NULL;
|
static ICallWrapper *pWrapper = NULL;
|
||||||
static int thisPtrOffset = -1;
|
static int thisPtrOffset = -1;
|
||||||
|
|
||||||
if (!pWrapper)
|
if (!pWrapper)
|
||||||
{
|
{
|
||||||
int offset = -1;
|
int offset = -1;
|
||||||
@ -119,22 +119,22 @@ CEconItemView *GetEconItemView(CBaseEntity *pEntity, int iSlot)
|
|||||||
|
|
||||||
pWrapper = g_pBinTools->CreateVCall(offset, 0, 0, &ret, pass, 2);
|
pWrapper = g_pBinTools->CreateVCall(offset, 0, 0, &ret, pass, 2);
|
||||||
g_RegNatives.Register(pWrapper);
|
g_RegNatives.Register(pWrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int client = gamehelpers->EntityToBCompatRef(pEntity);
|
int client = gamehelpers->EntityToBCompatRef(pEntity);
|
||||||
|
|
||||||
IPlayerInfo *playerinfo = playerhelpers->GetGamePlayer(client)->GetPlayerInfo();
|
IPlayerInfo *playerinfo = playerhelpers->GetGamePlayer(client)->GetPlayerInfo();
|
||||||
|
|
||||||
if (!playerinfo)
|
if (!playerinfo)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
int team = playerinfo->GetTeamIndex();
|
int team = playerinfo->GetTeamIndex();
|
||||||
|
|
||||||
if (team != 2 && team != 3)
|
if (team != 2 && team != 3)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
CEconItemView *ret;
|
CEconItemView *ret;
|
||||||
unsigned char vstk[sizeof(void *) + sizeof(int) * 2];
|
unsigned char vstk[sizeof(void *) + sizeof(int) * 2];
|
||||||
unsigned char *vptr = vstk;
|
unsigned char *vptr = vstk;
|
||||||
|
|
||||||
@ -144,51 +144,51 @@ CEconItemView *GetEconItemView(CBaseEntity *pEntity, int iSlot)
|
|||||||
vptr += sizeof(int);
|
vptr += sizeof(int);
|
||||||
*(int *)vptr = iSlot;
|
*(int *)vptr = iSlot;
|
||||||
|
|
||||||
pWrapper->Execute(vstk, &ret);
|
pWrapper->Execute(vstk, &ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCSWeaponData *GetCCSWeaponData(CEconItemView *view)
|
CCSWeaponData *GetCCSWeaponData(CEconItemView *view)
|
||||||
{
|
{
|
||||||
static ICallWrapper *pWrapper = NULL;
|
static ICallWrapper *pWrapper = NULL;
|
||||||
|
|
||||||
if (!pWrapper)
|
if (!pWrapper)
|
||||||
{
|
{
|
||||||
REGISTER_ADDR("GetCCSWeaponData", NULL,
|
REGISTER_ADDR("GetCCSWeaponData", NULL,
|
||||||
PassInfo retpass; \
|
PassInfo retpass; \
|
||||||
retpass.flags = PASSFLAG_BYVAL; \
|
retpass.flags = PASSFLAG_BYVAL; \
|
||||||
retpass.type = PassType_Basic; \
|
retpass.type = PassType_Basic; \
|
||||||
retpass.size = sizeof(CCSWeaponData *); \
|
retpass.size = sizeof(CCSWeaponData *); \
|
||||||
pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, &retpass, NULL, 0))
|
pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, &retpass, NULL, 0))
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char vstk[sizeof(CEconItemView *)];
|
unsigned char vstk[sizeof(CEconItemView *)];
|
||||||
unsigned char *vptr = vstk;
|
unsigned char *vptr = vstk;
|
||||||
|
|
||||||
*(CEconItemView **)vptr = view;
|
*(CEconItemView **)vptr = view;
|
||||||
|
|
||||||
CCSWeaponData *pWpnData = NULL;
|
CCSWeaponData *pWpnData = NULL;
|
||||||
|
|
||||||
pWrapper->Execute(vstk, &pWpnData);
|
pWrapper->Execute(vstk, &pWpnData);
|
||||||
|
|
||||||
return pWpnData;
|
return pWpnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
CEconItemSchema *GetItemSchema()
|
CEconItemSchema *GetItemSchema()
|
||||||
{
|
{
|
||||||
static ICallWrapper *pWrapper = NULL;
|
static ICallWrapper *pWrapper = NULL;
|
||||||
|
|
||||||
if (!pWrapper)
|
if (!pWrapper)
|
||||||
{
|
{
|
||||||
REGISTER_ADDR("GetItemSchema", NULL,
|
REGISTER_ADDR("GetItemSchema", NULL,
|
||||||
PassInfo retpass; \
|
PassInfo retpass; \
|
||||||
retpass.flags = PASSFLAG_BYVAL; \
|
retpass.flags = PASSFLAG_BYVAL; \
|
||||||
retpass.type = PassType_Basic; \
|
retpass.type = PassType_Basic; \
|
||||||
retpass.size = sizeof(void *); \
|
retpass.size = sizeof(void *); \
|
||||||
pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass, NULL, 0))
|
pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass, NULL, 0))
|
||||||
}
|
}
|
||||||
|
|
||||||
void *pSchema = NULL;
|
void *pSchema = NULL;
|
||||||
pWrapper->Execute(NULL, &pSchema);
|
pWrapper->Execute(NULL, &pSchema);
|
||||||
|
|
||||||
@ -197,28 +197,28 @@ CEconItemSchema *GetItemSchema()
|
|||||||
return (CEconItemSchema *)((intptr_t)pSchema + 4);
|
return (CEconItemSchema *)((intptr_t)pSchema + 4);
|
||||||
#else
|
#else
|
||||||
return (CEconItemSchema *)pSchema;
|
return (CEconItemSchema *)pSchema;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CEconItemDefinition *GetItemDefintionByName(const char *classname)
|
CEconItemDefinition *GetItemDefintionByName(const char *classname)
|
||||||
{
|
{
|
||||||
CEconItemSchema *pSchema = GetItemSchema();
|
CEconItemSchema *pSchema = GetItemSchema();
|
||||||
|
|
||||||
if (!pSchema)
|
if (!pSchema)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
static ICallWrapper *pWrapper = NULL;
|
static ICallWrapper *pWrapper = NULL;
|
||||||
|
|
||||||
if (!pWrapper)
|
if (!pWrapper)
|
||||||
{
|
{
|
||||||
int offset = -1;
|
int offset = -1;
|
||||||
|
|
||||||
if (!g_pGameConf->GetOffset("GetItemDefintionByName", &offset) || offset == -1)
|
if (!g_pGameConf->GetOffset("GetItemDefintionByName", &offset) || offset == -1)
|
||||||
{
|
{
|
||||||
smutils->LogError(myself, "Failed to get GetItemDefintionByName offset.");
|
smutils->LogError(myself, "Failed to get GetItemDefintionByName offset.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
PassInfo pass[1];
|
PassInfo pass[1];
|
||||||
PassInfo ret;
|
PassInfo ret;
|
||||||
pass[0].flags = PASSFLAG_BYVAL;
|
pass[0].flags = PASSFLAG_BYVAL;
|
||||||
@ -229,11 +229,11 @@ CEconItemDefinition *GetItemDefintionByName(const char *classname)
|
|||||||
ret.type = PassType_Basic;
|
ret.type = PassType_Basic;
|
||||||
ret.size = sizeof(CEconItemDefinition *);
|
ret.size = sizeof(CEconItemDefinition *);
|
||||||
|
|
||||||
pWrapper = g_pBinTools->CreateVCall(offset, 0, 0, &ret, pass, 1);
|
pWrapper = g_pBinTools->CreateVCall(offset, 0, 0, &ret, pass, 1);
|
||||||
|
|
||||||
g_RegNatives.Register(pWrapper);
|
g_RegNatives.Register(pWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char vstk[sizeof(void *) + sizeof(const char *)];
|
unsigned char vstk[sizeof(void *) + sizeof(const char *)];
|
||||||
unsigned char *vptr = vstk;
|
unsigned char *vptr = vstk;
|
||||||
|
|
||||||
@ -244,16 +244,16 @@ CEconItemDefinition *GetItemDefintionByName(const char *classname)
|
|||||||
CEconItemDefinition *pItemDef = NULL;
|
CEconItemDefinition *pItemDef = NULL;
|
||||||
pWrapper->Execute(vstk, &pItemDef);
|
pWrapper->Execute(vstk, &pItemDef);
|
||||||
|
|
||||||
return pItemDef;
|
return pItemDef;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateHashMaps()
|
void CreateHashMaps()
|
||||||
{
|
{
|
||||||
CEconItemSchema *pSchema = GetItemSchema();
|
CEconItemSchema *pSchema = GetItemSchema();
|
||||||
|
|
||||||
if (!pSchema)
|
if (!pSchema)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
static const char *pPriceKey = NULL;
|
static const char *pPriceKey = NULL;
|
||||||
|
|
||||||
if (!pPriceKey)
|
if (!pPriceKey)
|
||||||
@ -263,18 +263,18 @@ void CreateHashMaps()
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int iHashMapOffset = -1;
|
static int iHashMapOffset = -1;
|
||||||
|
|
||||||
if (iHashMapOffset == -1)
|
if (iHashMapOffset == -1)
|
||||||
{
|
{
|
||||||
if (!g_pGameConf->GetOffset("ItemDefHashOffset", &iHashMapOffset) || iHashMapOffset == -1)
|
if (!g_pGameConf->GetOffset("ItemDefHashOffset", &iHashMapOffset) || iHashMapOffset == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_mapClassToDefIdx.init();
|
g_mapClassToDefIdx.init();
|
||||||
g_mapDefIdxToClass.init();
|
g_mapDefIdxToClass.init();
|
||||||
g_mapWeaponIDToDefIdx.init();
|
g_mapWeaponIDToDefIdx.init();
|
||||||
@ -314,112 +314,112 @@ void CreateHashMaps()
|
|||||||
g_mapWeaponIDToDefIdx.add(t, iWeaponID, ItemDefHashValue(iLoadoutslot, price, iWeaponID, iItemDefIdx, classname));
|
g_mapWeaponIDToDefIdx.add(t, iWeaponID, ItemDefHashValue(iLoadoutslot, price, iWeaponID, iItemDefIdx, classname));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearHashMaps()
|
void ClearHashMaps()
|
||||||
{
|
{
|
||||||
g_mapClassToDefIdx.clear();
|
g_mapClassToDefIdx.clear();
|
||||||
g_mapDefIdxToClass.clear();
|
g_mapDefIdxToClass.clear();
|
||||||
g_mapWeaponIDToDefIdx.clear();
|
g_mapWeaponIDToDefIdx.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
SMCSWeapon GetWeaponIdFromDefIdx(uint16_t iDefIdx)
|
SMCSWeapon GetWeaponIdFromDefIdx(uint16_t iDefIdx)
|
||||||
{
|
{
|
||||||
//DEAR GOD THIS IS HIDEOUS
|
//DEAR GOD THIS IS HIDEOUS
|
||||||
//None in the middle are weapons that dont exist.
|
//None in the middle are weapons that dont exist.
|
||||||
//If they are added and use the same idx they should be changed to their respective ones
|
//If they are added and use the same idx they should be changed to their respective ones
|
||||||
static SMCSWeapon weaponIDMap[SMCSWeapon_MAXWEAPONIDS] =
|
static SMCSWeapon weaponIDMap[SMCSWeapon_MAXWEAPONIDS] =
|
||||||
{
|
{
|
||||||
SMCSWeapon_NONE, SMCSWeapon_DEAGLE, SMCSWeapon_ELITE, SMCSWeapon_FIVESEVEN,
|
SMCSWeapon_NONE, SMCSWeapon_DEAGLE, SMCSWeapon_ELITE, SMCSWeapon_FIVESEVEN,
|
||||||
SMCSWeapon_GLOCK, SMCSWeapon_NONE, SMCSWeapon_NONE, SMCSWeapon_AK47,
|
SMCSWeapon_GLOCK, SMCSWeapon_NONE, SMCSWeapon_NONE, SMCSWeapon_AK47,
|
||||||
SMCSWeapon_AUG, SMCSWeapon_AWP, SMCSWeapon_FAMAS, SMCSWeapon_G3SG1,
|
SMCSWeapon_AUG, SMCSWeapon_AWP, SMCSWeapon_FAMAS, SMCSWeapon_G3SG1,
|
||||||
SMCSWeapon_NONE, SMCSWeapon_GALILAR, SMCSWeapon_M249, SMCSWeapon_NONE,
|
SMCSWeapon_NONE, SMCSWeapon_GALILAR, SMCSWeapon_M249, SMCSWeapon_NONE,
|
||||||
SMCSWeapon_M4A1, SMCSWeapon_MAC10, SMCSWeapon_NONE, SMCSWeapon_P90,
|
SMCSWeapon_M4A1, SMCSWeapon_MAC10, SMCSWeapon_NONE, SMCSWeapon_P90,
|
||||||
SMCSWeapon_NONE, SMCSWeapon_NONE, SMCSWeapon_NONE, SMCSWeapon_NONE,
|
SMCSWeapon_NONE, SMCSWeapon_NONE, SMCSWeapon_NONE, SMCSWeapon_NONE,
|
||||||
SMCSWeapon_UMP45, SMCSWeapon_XM1014, SMCSWeapon_BIZON, SMCSWeapon_MAG7,
|
SMCSWeapon_UMP45, SMCSWeapon_XM1014, SMCSWeapon_BIZON, SMCSWeapon_MAG7,
|
||||||
SMCSWeapon_NEGEV, SMCSWeapon_SAWEDOFF, SMCSWeapon_TEC9, SMCSWeapon_TASER,
|
SMCSWeapon_NEGEV, SMCSWeapon_SAWEDOFF, SMCSWeapon_TEC9, SMCSWeapon_TASER,
|
||||||
SMCSWeapon_HKP2000, SMCSWeapon_MP7, SMCSWeapon_MP9, SMCSWeapon_NOVA,
|
SMCSWeapon_HKP2000, SMCSWeapon_MP7, SMCSWeapon_MP9, SMCSWeapon_NOVA,
|
||||||
SMCSWeapon_P250, SMCSWeapon_NONE, SMCSWeapon_SCAR20, SMCSWeapon_SG556,
|
SMCSWeapon_P250, SMCSWeapon_NONE, SMCSWeapon_SCAR20, SMCSWeapon_SG556,
|
||||||
SMCSWeapon_SSG08, SMCSWeapon_KNIFE_GG, SMCSWeapon_KNIFE, SMCSWeapon_FLASHBANG,
|
SMCSWeapon_SSG08, SMCSWeapon_KNIFE_GG, SMCSWeapon_KNIFE, SMCSWeapon_FLASHBANG,
|
||||||
SMCSWeapon_HEGRENADE, SMCSWeapon_SMOKEGRENADE, SMCSWeapon_MOLOTOV, SMCSWeapon_DECOY,
|
SMCSWeapon_HEGRENADE, SMCSWeapon_SMOKEGRENADE, SMCSWeapon_MOLOTOV, SMCSWeapon_DECOY,
|
||||||
SMCSWeapon_INCGRENADE, SMCSWeapon_C4, SMCSWeapon_KEVLAR, SMCSWeapon_ASSAULTSUIT,
|
SMCSWeapon_INCGRENADE, SMCSWeapon_C4, SMCSWeapon_KEVLAR, SMCSWeapon_ASSAULTSUIT,
|
||||||
SMCSWeapon_HEAVYASSAULTSUIT, SMCSWeapon_NONE, SMCSWeapon_NIGHTVISION, SMCSWeapon_DEFUSER
|
SMCSWeapon_HEAVYASSAULTSUIT, SMCSWeapon_NONE, SMCSWeapon_NIGHTVISION, SMCSWeapon_DEFUSER
|
||||||
};
|
};
|
||||||
|
|
||||||
if (iDefIdx >= SMCSWeapon_MAXWEAPONIDS)
|
if (iDefIdx >= SMCSWeapon_MAXWEAPONIDS)
|
||||||
return (SMCSWeapon)iDefIdx;
|
return (SMCSWeapon)iDefIdx;
|
||||||
else
|
else
|
||||||
return weaponIDMap[iDefIdx];
|
return weaponIDMap[iDefIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemDefHashValue *GetHashValueFromWeapon(const char *szWeapon)
|
ItemDefHashValue *GetHashValueFromWeapon(const char *szWeapon)
|
||||||
{
|
{
|
||||||
char tempWeapon[MAX_WEAPON_NAME_LENGTH];
|
char tempWeapon[MAX_WEAPON_NAME_LENGTH];
|
||||||
|
|
||||||
Q_strncpy(tempWeapon, szWeapon, sizeof(tempWeapon));
|
Q_strncpy(tempWeapon, szWeapon, sizeof(tempWeapon));
|
||||||
Q_strlower(tempWeapon);
|
Q_strlower(tempWeapon);
|
||||||
|
|
||||||
if (strstr(tempWeapon, "weapon_") == NULL && strstr(tempWeapon, "item_") == NULL)
|
if (strstr(tempWeapon, "weapon_") == NULL && strstr(tempWeapon, "item_") == NULL)
|
||||||
{
|
{
|
||||||
static const char *szClassPrefixs[] = { "weapon_", "item_" };
|
static const char *szClassPrefixs[] = { "weapon_", "item_" };
|
||||||
|
|
||||||
for (unsigned int i = 0; i < SM_ARRAYSIZE(szClassPrefixs); i++)
|
for (unsigned int i = 0; i < SM_ARRAYSIZE(szClassPrefixs); i++)
|
||||||
{
|
{
|
||||||
char classname[MAX_WEAPON_NAME_LENGTH];
|
char classname[MAX_WEAPON_NAME_LENGTH];
|
||||||
Q_snprintf(classname, sizeof(classname), "%s%s", szClassPrefixs[i], tempWeapon);
|
Q_snprintf(classname, sizeof(classname), "%s%s", szClassPrefixs[i], tempWeapon);
|
||||||
|
|
||||||
ClassnameMap::Result res = g_mapClassToDefIdx.find(classname);
|
ClassnameMap::Result res = g_mapClassToDefIdx.find(classname);
|
||||||
|
|
||||||
if (res.found())
|
if (res.found())
|
||||||
return &res->value;
|
return &res->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassnameMap::Result res = g_mapClassToDefIdx.find(tempWeapon);
|
ClassnameMap::Result res = g_mapClassToDefIdx.find(tempWeapon);
|
||||||
|
|
||||||
if (res.found())
|
if (res.found())
|
||||||
return &res->value;
|
return &res->value;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SOURCE_ENGINE != SE_CSGO
|
#if SOURCE_ENGINE != SE_CSGO
|
||||||
void *GetWeaponInfo(int weaponID)
|
void *GetWeaponInfo(int weaponID)
|
||||||
{
|
{
|
||||||
void *info;
|
void *info;
|
||||||
|
|
||||||
static ICallWrapper *pWrapper = NULL;
|
static ICallWrapper *pWrapper = NULL;
|
||||||
if (!pWrapper)
|
if (!pWrapper)
|
||||||
{
|
{
|
||||||
REGISTER_ADDR("GetWeaponInfo", NULL,
|
REGISTER_ADDR("GetWeaponInfo", NULL,
|
||||||
PassInfo pass[1]; \
|
PassInfo pass[1]; \
|
||||||
PassInfo retpass; \
|
PassInfo retpass; \
|
||||||
pass[0].flags = PASSFLAG_BYVAL; \
|
pass[0].flags = PASSFLAG_BYVAL; \
|
||||||
pass[0].type = PassType_Basic; \
|
pass[0].type = PassType_Basic; \
|
||||||
pass[0].size = sizeof(int); \
|
pass[0].size = sizeof(int); \
|
||||||
retpass.flags = PASSFLAG_BYVAL; \
|
retpass.flags = PASSFLAG_BYVAL; \
|
||||||
retpass.type = PassType_Basic; \
|
retpass.type = PassType_Basic; \
|
||||||
retpass.size = sizeof(void *); \
|
retpass.size = sizeof(void *); \
|
||||||
pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass, pass, 1))
|
pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass, pass, 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char vstk[sizeof(int)];
|
unsigned char vstk[sizeof(int)];
|
||||||
unsigned char *vptr = vstk;
|
unsigned char *vptr = vstk;
|
||||||
|
|
||||||
*(int *)vptr = weaponID;
|
*(int *)vptr = weaponID;
|
||||||
|
|
||||||
pWrapper->Execute(vstk, &info);
|
pWrapper->Execute(vstk, &info);
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *GetWeaponNameFromClassname(const char *weapon)
|
const char *GetWeaponNameFromClassname(const char *weapon)
|
||||||
{
|
{
|
||||||
char *szTemp = strstr((char *)weapon, "_");
|
char *szTemp = strstr((char *)weapon, "_");
|
||||||
|
|
||||||
if (!szTemp)
|
if (!szTemp)
|
||||||
@ -429,103 +429,103 @@ const char *GetWeaponNameFromClassname(const char *weapon)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (const char *)((intptr_t)szTemp + 1);
|
return (const char *)((intptr_t)szTemp + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *GetTranslatedWeaponAlias(const char *weapon)
|
const char *GetTranslatedWeaponAlias(const char *weapon)
|
||||||
{
|
{
|
||||||
#if SOURCE_ENGINE != SE_CSGO
|
#if SOURCE_ENGINE != SE_CSGO
|
||||||
const char *alias = NULL;
|
const char *alias = NULL;
|
||||||
|
|
||||||
static ICallWrapper *pWrapper = NULL;
|
static ICallWrapper *pWrapper = NULL;
|
||||||
|
|
||||||
if (!pWrapper)
|
if (!pWrapper)
|
||||||
{
|
{
|
||||||
REGISTER_ADDR("GetTranslatedWeaponAlias", weapon,
|
REGISTER_ADDR("GetTranslatedWeaponAlias", weapon,
|
||||||
PassInfo pass[1]; \
|
PassInfo pass[1]; \
|
||||||
PassInfo retpass; \
|
PassInfo retpass; \
|
||||||
pass[0].flags = PASSFLAG_BYVAL; \
|
pass[0].flags = PASSFLAG_BYVAL; \
|
||||||
pass[0].type = PassType_Basic; \
|
pass[0].type = PassType_Basic; \
|
||||||
pass[0].size = sizeof(const char *); \
|
pass[0].size = sizeof(const char *); \
|
||||||
retpass.flags = PASSFLAG_BYVAL; \
|
retpass.flags = PASSFLAG_BYVAL; \
|
||||||
retpass.type = PassType_Basic; \
|
retpass.type = PassType_Basic; \
|
||||||
retpass.size = sizeof(const char *); \
|
retpass.size = sizeof(const char *); \
|
||||||
pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass, pass, 1))
|
pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass, pass, 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char vstk[sizeof(const char *)];
|
unsigned char vstk[sizeof(const char *)];
|
||||||
unsigned char *vptr = vstk;
|
unsigned char *vptr = vstk;
|
||||||
|
|
||||||
*(const char **)vptr = GetWeaponNameFromClassname(weapon);
|
*(const char **)vptr = GetWeaponNameFromClassname(weapon);
|
||||||
|
|
||||||
pWrapper->Execute(vstk, &alias);
|
pWrapper->Execute(vstk, &alias);
|
||||||
return alias;
|
return alias;
|
||||||
#else //this should work for both games maybe replace both?
|
#else //this should work for both games maybe replace both?
|
||||||
static const char *szAliases[] =
|
static const char *szAliases[] =
|
||||||
{
|
{
|
||||||
"cv47", "ak47",
|
"cv47", "ak47",
|
||||||
"magnum", "awp",
|
"magnum", "awp",
|
||||||
"d3au1", "g3sg1",
|
"d3au1", "g3sg1",
|
||||||
"clarion", "famas",
|
"clarion", "famas",
|
||||||
"bullpup", "aug",
|
"bullpup", "aug",
|
||||||
"9x19mm", "glock",
|
"9x19mm", "glock",
|
||||||
"nighthawk", "deagle",
|
"nighthawk", "deagle",
|
||||||
"elites", "elite",
|
"elites", "elite",
|
||||||
"fn57", "fiveseven",
|
"fn57", "fiveseven",
|
||||||
"autoshotgun", "xm1014",
|
"autoshotgun", "xm1014",
|
||||||
"c90", "p90",
|
"c90", "p90",
|
||||||
"vest", "kevlar",
|
"vest", "kevlar",
|
||||||
"vesthelm", "assaultsuit",
|
"vesthelm", "assaultsuit",
|
||||||
"nvgs", "nightvision"
|
"nvgs", "nightvision"
|
||||||
};
|
};
|
||||||
|
|
||||||
for (size_t i = 0; i < SM_ARRAYSIZE(szAliases) / 2; i++)
|
for (size_t i = 0; i < SM_ARRAYSIZE(szAliases) / 2; i++)
|
||||||
{
|
{
|
||||||
if (Q_stristr(GetWeaponNameFromClassname(weapon), szAliases[i * 2]) != 0)
|
if (Q_stristr(GetWeaponNameFromClassname(weapon), szAliases[i * 2]) != 0)
|
||||||
return szAliases[i * 2 + 1];
|
return szAliases[i * 2 + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetWeaponNameFromClassname(weapon);
|
return GetWeaponNameFromClassname(weapon);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int AliasToWeaponID(const char *weapon)
|
int AliasToWeaponID(const char *weapon)
|
||||||
{
|
{
|
||||||
#if SOURCE_ENGINE != SE_CSGO
|
#if SOURCE_ENGINE != SE_CSGO
|
||||||
int weaponID = 0;
|
int weaponID = 0;
|
||||||
|
|
||||||
static ICallWrapper *pWrapper = NULL;
|
static ICallWrapper *pWrapper = NULL;
|
||||||
|
|
||||||
if (!pWrapper)
|
if (!pWrapper)
|
||||||
{
|
{
|
||||||
REGISTER_ADDR("AliasToWeaponID", 0,
|
REGISTER_ADDR("AliasToWeaponID", 0,
|
||||||
PassInfo pass[1]; \
|
PassInfo pass[1]; \
|
||||||
PassInfo retpass; \
|
PassInfo retpass; \
|
||||||
pass[0].flags = PASSFLAG_BYVAL; \
|
pass[0].flags = PASSFLAG_BYVAL; \
|
||||||
pass[0].type = PassType_Basic; \
|
pass[0].type = PassType_Basic; \
|
||||||
pass[0].size = sizeof(const char *); \
|
pass[0].size = sizeof(const char *); \
|
||||||
retpass.flags = PASSFLAG_BYVAL; \
|
retpass.flags = PASSFLAG_BYVAL; \
|
||||||
retpass.type = PassType_Basic; \
|
retpass.type = PassType_Basic; \
|
||||||
retpass.size = sizeof(int); \
|
retpass.size = sizeof(int); \
|
||||||
pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass, pass, 1))
|
pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass, pass, 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char vstk[sizeof(const char *)];
|
unsigned char vstk[sizeof(const char *)];
|
||||||
unsigned char *vptr = vstk;
|
unsigned char *vptr = vstk;
|
||||||
|
|
||||||
*(const char **)vptr = GetWeaponNameFromClassname(weapon);
|
*(const char **)vptr = GetWeaponNameFromClassname(weapon);
|
||||||
|
|
||||||
pWrapper->Execute(vstk, &weaponID);
|
pWrapper->Execute(vstk, &weaponID);
|
||||||
|
|
||||||
return weaponID;
|
return weaponID;
|
||||||
#else
|
#else
|
||||||
ItemDefHashValue *pHashValue = GetHashValueFromWeapon(weapon);
|
ItemDefHashValue *pHashValue = GetHashValueFromWeapon(weapon);
|
||||||
|
|
||||||
if (pHashValue)
|
if (pHashValue)
|
||||||
return pHashValue->m_iWeaponID;
|
return pHashValue->m_iWeaponID;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *WeaponIDToAlias(int weaponID)
|
const char *WeaponIDToAlias(int weaponID)
|
||||||
@ -565,19 +565,19 @@ const char *WeaponIDToAlias(int weaponID)
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsValidWeaponID(int id)
|
bool IsValidWeaponID(int id)
|
||||||
{
|
{
|
||||||
if (id <= (int)SMCSWeapon_NONE)
|
if (id <= (int)SMCSWeapon_NONE)
|
||||||
return false;
|
return false;
|
||||||
#if SOURCE_ENGINE == SE_CSGO
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
WeaponIDMap::Result res = g_mapWeaponIDToDefIdx.find((SMCSWeapon)id);
|
WeaponIDMap::Result res = g_mapWeaponIDToDefIdx.find((SMCSWeapon)id);
|
||||||
if (!res.found())
|
if (!res.found())
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
else if (id > SMCSWeapon_NIGHTVISION || !GetWeaponInfo(id))
|
else if (id > SMCSWeapon_NIGHTVISION || !GetWeaponInfo(id))
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python :
|
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python :
|
||||||
import os
|
import os
|
||||||
|
|
||||||
libcurl = builder.RunScript('curl-src/lib/AMBuilder')
|
libcurl = builder.Build('curl-src/lib/AMBuilder')
|
||||||
|
|
||||||
binary = SM.ExtLibrary(builder, 'webternet.ext')
|
binary = SM.ExtLibrary(builder, 'webternet.ext')
|
||||||
binary.compiler.includes += [
|
binary.compiler.includes += [
|
||||||
os.path.join(builder.sourcePath, 'extensions', 'curl', 'curl-src', 'include')
|
os.path.join(builder.sourcePath, 'extensions', 'curl', 'curl-src', 'include')
|
||||||
]
|
]
|
||||||
binary.compiler.defines += ['CURL_STATICLIB']
|
binary.compiler.defines += ['CURL_STATICLIB']
|
||||||
if binary.compiler.vendor == 'gcc' or binary.compiler.vendor == 'clang':
|
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
|
||||||
binary.compiler.cxxflags += ['-fno-rtti']
|
binary.compiler.cxxflags += ['-fno-rtti']
|
||||||
elif binary.compiler.vendor == 'msvc':
|
elif binary.compiler.family == 'msvc':
|
||||||
binary.compiler.cxxflags += ['/GR-']
|
binary.compiler.cxxflags += ['/GR-']
|
||||||
binary.compiler.postlink += [libcurl.binary]
|
binary.compiler.postlink += [libcurl.binary]
|
||||||
if builder.target_platform == 'linux':
|
if builder.target.platform == 'linux':
|
||||||
binary.compiler.postlink += ['-lrt']
|
binary.compiler.postlink += ['-lrt']
|
||||||
elif builder.target_platform == 'windows':
|
elif builder.target.platform == 'windows':
|
||||||
binary.compiler.postlink += ['ws2_32.lib']
|
binary.compiler.postlink += ['ws2_32.lib']
|
||||||
|
|
||||||
binary.sources += [
|
binary.sources += [
|
||||||
|
@ -3,27 +3,27 @@ import os, platform
|
|||||||
|
|
||||||
builder.SetBuildFolder('libcurl')
|
builder.SetBuildFolder('libcurl')
|
||||||
|
|
||||||
binary = builder.compiler.StaticLibrary('curl')
|
binary = SM.StaticLibrary(builder, 'curl')
|
||||||
binary.compiler.includes += [
|
binary.compiler.includes += [
|
||||||
os.path.join(builder.sourcePath, 'extensions', 'curl', 'curl-src', 'lib'),
|
os.path.join(builder.sourcePath, 'extensions', 'curl', 'curl-src', 'lib'),
|
||||||
os.path.join(builder.sourcePath, 'extensions', 'curl', 'curl-src', 'include')
|
os.path.join(builder.sourcePath, 'extensions', 'curl', 'curl-src', 'include')
|
||||||
]
|
]
|
||||||
|
|
||||||
if builder.target_platform == 'mac':
|
if builder.target.platform == 'mac':
|
||||||
mac_version, ignore, ignore = platform.mac_ver()
|
mac_version, ignore, ignore = platform.mac_ver()
|
||||||
mac_tuple = mac_version.split('.')
|
mac_tuple = mac_version.split('.')
|
||||||
if int(mac_tuple[0]) >= 10 and int(mac_tuple[1]) >= 9:
|
if int(mac_tuple[0]) >= 10 and int(mac_tuple[1]) >= 9:
|
||||||
binary.compiler.defines += ['BUILTIN_STRLCAT']
|
binary.compiler.defines += ['BUILTIN_STRLCAT']
|
||||||
elif builder.target_platform == 'windows':
|
elif builder.target.platform == 'windows':
|
||||||
binary.compiler.defines += [
|
binary.compiler.defines += [
|
||||||
'BUILDING_LIBCURL',
|
'BUILDING_LIBCURL',
|
||||||
'CURL_STATICLIB',
|
'CURL_STATICLIB',
|
||||||
'CURL_DISABLE_LDAP',
|
'CURL_DISABLE_LDAP',
|
||||||
]
|
]
|
||||||
elif builder.target_platform == 'linux':
|
elif builder.target.platform == 'linux':
|
||||||
binary.compiler.defines += ['_GNU_SOURCE']
|
binary.compiler.defines += ['_GNU_SOURCE']
|
||||||
|
|
||||||
if binary.compiler.vendor == 'clang':
|
if binary.compiler.family == 'clang':
|
||||||
# https://llvm.org/bugs/show_bug.cgi?id=16428
|
# https://llvm.org/bugs/show_bug.cgi?id=16428
|
||||||
binary.compiler.cflags += ['-Wno-attributes']
|
binary.compiler.cflags += ['-Wno-attributes']
|
||||||
|
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
binary = SM.ExtLibrary(builder, 'geoip.ext')
|
binary = SM.ExtLibrary(builder, 'geoip.ext')
|
||||||
if binary.compiler.vendor == 'gcc' or binary.compiler.vendor == 'clang':
|
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
|
||||||
binary.compiler.cxxflags += ['-fno-rtti']
|
binary.compiler.cxxflags += ['-fno-rtti']
|
||||||
elif binary.compiler.vendor == 'msvc':
|
elif binary.compiler.family == 'msvc':
|
||||||
binary.compiler.cxxflags += ['/GR-']
|
binary.compiler.cxxflags += ['/GR-']
|
||||||
if builder.target_platform == 'windows':
|
if builder.target.platform == 'windows':
|
||||||
binary.compiler.postlink += ['wsock32.lib']
|
binary.compiler.postlink += ['wsock32.lib']
|
||||||
|
|
||||||
binary.sources += [
|
binary.sources += [
|
||||||
|
@ -7,21 +7,21 @@ if SM.mysql_root:
|
|||||||
os.path.join(SM.mysql_root, 'include'),
|
os.path.join(SM.mysql_root, 'include'),
|
||||||
os.path.join(SM.mms_root, 'core', 'sourcehook')
|
os.path.join(SM.mms_root, 'core', 'sourcehook')
|
||||||
]
|
]
|
||||||
if binary.compiler.vendor == 'gcc' or binary.compiler.vendor == 'clang':
|
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
|
||||||
binary.compiler.cxxflags += ['-fno-rtti']
|
binary.compiler.cxxflags += ['-fno-rtti']
|
||||||
elif binary.compiler.vendor == 'msvc':
|
elif binary.compiler.family == 'msvc':
|
||||||
binary.compiler.cxxflags += ['/GR-']
|
binary.compiler.cxxflags += ['/GR-']
|
||||||
|
|
||||||
if builder.target_platform == 'linux' or builder.target_platform == 'mac':
|
if builder.target.platform == 'linux' or builder.target.platform == 'mac':
|
||||||
binary.compiler.postlink += [
|
binary.compiler.postlink += [
|
||||||
os.path.join(SM.mysql_root, 'lib', 'libmysqlclient_r.a'),
|
os.path.join(SM.mysql_root, 'lib', 'libmysqlclient_r.a'),
|
||||||
'-lz',
|
'-lz',
|
||||||
'-lpthread',
|
'-lpthread',
|
||||||
'-lm',
|
'-lm',
|
||||||
]
|
]
|
||||||
if builder.target_platform == 'linux':
|
if builder.target.platform == 'linux':
|
||||||
binary.compiler.postlink += ['-lrt']
|
binary.compiler.postlink += ['-lrt']
|
||||||
elif builder.target_platform == 'windows':
|
elif builder.target.platform == 'windows':
|
||||||
binary.compiler.postlink += [
|
binary.compiler.postlink += [
|
||||||
os.path.join(SM.mysql_root, 'lib', 'opt', 'mysqlclient.lib'),
|
os.path.join(SM.mysql_root, 'lib', 'opt', 'mysqlclient.lib'),
|
||||||
os.path.join(SM.mysql_root, 'lib', 'opt', 'zlib.lib'),
|
os.path.join(SM.mysql_root, 'lib', 'opt', 'zlib.lib'),
|
||||||
@ -38,7 +38,7 @@ if SM.mysql_root:
|
|||||||
'extension.cpp'
|
'extension.cpp'
|
||||||
]
|
]
|
||||||
|
|
||||||
if binary.compiler.vendor == 'msvc' and binary.compiler.version >= 1900:
|
if binary.compiler.family == 'msvc' and binary.compiler.version >= 1900:
|
||||||
binary.sources += [ 'msvc15hack.c' ]
|
binary.sources += [ 'msvc15hack.c' ]
|
||||||
binary.compiler.linkflags += ['legacy_stdio_definitions.lib', 'legacy_stdio_wide_specifiers.lib']
|
binary.compiler.linkflags += ['legacy_stdio_definitions.lib', 'legacy_stdio_wide_specifiers.lib']
|
||||||
|
|
||||||
|
@ -5,16 +5,16 @@ binary = SM.ExtLibrary(builder, 'regex.ext')
|
|||||||
binary.compiler.cxxincludes += [
|
binary.compiler.cxxincludes += [
|
||||||
os.path.join(SM.mms_root, 'core', 'sourcehook'),
|
os.path.join(SM.mms_root, 'core', 'sourcehook'),
|
||||||
]
|
]
|
||||||
if binary.compiler.vendor == 'gcc' or binary.compiler.vendor == 'clang':
|
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
|
||||||
binary.compiler.cxxflags += ['-fno-rtti']
|
binary.compiler.cxxflags += ['-fno-rtti']
|
||||||
elif binary.compiler.vendor == 'msvc':
|
elif binary.compiler.family == 'msvc':
|
||||||
binary.compiler.cxxflags += ['/GR-']
|
binary.compiler.cxxflags += ['/GR-']
|
||||||
|
|
||||||
if builder.target_platform == 'linux':
|
if builder.target.platform == 'linux':
|
||||||
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_linux', 'libpcre.a')
|
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_linux', 'libpcre.a')
|
||||||
elif builder.target_platform == 'windows':
|
elif builder.target.platform == 'windows':
|
||||||
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_win', 'pcre.lib')
|
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_win', 'pcre.lib')
|
||||||
elif builder.target_platform == 'mac':
|
elif builder.target.platform == 'mac':
|
||||||
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_darwin', 'libpcre.a')
|
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_darwin', 'libpcre.a')
|
||||||
binary.compiler.postlink += [binary.Dep(path)]
|
binary.compiler.postlink += [binary.Dep(path)]
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ for sdk_name in SM.sdks:
|
|||||||
binary.compiler.cxxincludes += [
|
binary.compiler.cxxincludes += [
|
||||||
os.path.join(sdk.path, 'game', 'shared')
|
os.path.join(sdk.path, 'game', 'shared')
|
||||||
]
|
]
|
||||||
if binary.compiler.cxx.behavior == 'gcc':
|
if binary.compiler.behavior == 'gcc':
|
||||||
binary.compiler.cxxflags += ['-Wno-invalid-offsetof']
|
binary.compiler.cxxflags += ['-Wno-invalid-offsetof']
|
||||||
|
|
||||||
SM.extensions += builder.Add(project)
|
SM.extensions += builder.Add(project)
|
||||||
|
@ -957,7 +957,7 @@ bool SDKHooks::Hook_CanBeAutobalanced()
|
|||||||
// Only update our new ret if different from original
|
// Only update our new ret if different from original
|
||||||
// (so if multiple plugins returning different answers,
|
// (so if multiple plugins returning different answers,
|
||||||
// the one(s) that changed it win)
|
// the one(s) that changed it win)
|
||||||
if (res != origRet)
|
if ((bool)res != origRet)
|
||||||
newRet = !origRet;
|
newRet = !origRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ for sdk_name in SM.sdks:
|
|||||||
if sdk.name != 'episode1':
|
if sdk.name != 'episode1':
|
||||||
binary.compiler.defines += ['HOOKING_ENABLED']
|
binary.compiler.defines += ['HOOKING_ENABLED']
|
||||||
|
|
||||||
if binary.compiler.cxx.behavior == 'gcc':
|
if binary.compiler.behavior == 'gcc':
|
||||||
binary.compiler.cxxflags += ['-Wno-invalid-offsetof']
|
binary.compiler.cxxflags += ['-Wno-invalid-offsetof']
|
||||||
|
|
||||||
SM.extensions += builder.Add(project)
|
SM.extensions += builder.Add(project)
|
||||||
|
@ -191,6 +191,11 @@ void CHookManager::PlayerRunCmdHook(int client, bool post)
|
|||||||
|
|
||||||
void CHookManager::PlayerRunCmd(CUserCmd *ucmd, IMoveHelper *moveHelper)
|
void CHookManager::PlayerRunCmd(CUserCmd *ucmd, IMoveHelper *moveHelper)
|
||||||
{
|
{
|
||||||
|
if (!ucmd)
|
||||||
|
{
|
||||||
|
RETURN_META(MRES_IGNORED);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_usercmdsFwd->GetFunctionCount() == 0)
|
if (m_usercmdsFwd->GetFunctionCount() == 0)
|
||||||
{
|
{
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
@ -254,6 +259,11 @@ void CHookManager::PlayerRunCmd(CUserCmd *ucmd, IMoveHelper *moveHelper)
|
|||||||
|
|
||||||
void CHookManager::PlayerRunCmdPost(CUserCmd *ucmd, IMoveHelper *moveHelper)
|
void CHookManager::PlayerRunCmdPost(CUserCmd *ucmd, IMoveHelper *moveHelper)
|
||||||
{
|
{
|
||||||
|
if (!ucmd)
|
||||||
|
{
|
||||||
|
RETURN_META(MRES_IGNORED);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_usercmdsPostFwd->GetFunctionCount() == 0)
|
if (m_usercmdsPostFwd->GetFunctionCount() == 0)
|
||||||
{
|
{
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
|
@ -929,7 +929,16 @@ static cell_t CreateEntityByName(IPluginContext *pContext, const cell_t *params)
|
|||||||
|
|
||||||
char *classname;
|
char *classname;
|
||||||
pContext->LocalToString(params[1], &classname);
|
pContext->LocalToString(params[1], &classname);
|
||||||
|
#if SOURCE_ENGINE != SE_CSGO
|
||||||
CBaseEntity *pEntity = (CBaseEntity *)servertools->CreateEntityByName(classname);
|
CBaseEntity *pEntity = (CBaseEntity *)servertools->CreateEntityByName(classname);
|
||||||
|
#else
|
||||||
|
CBaseEntity *pEntity = (CBaseEntity *)servertools->CreateItemEntityByName(classname);
|
||||||
|
|
||||||
|
if(!pEntity)
|
||||||
|
{
|
||||||
|
pEntity = (CBaseEntity *)servertools->CreateEntityByName(classname);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return gamehelpers->EntityToBCompatRef(pEntity);
|
return gamehelpers->EntityToBCompatRef(pEntity);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -5,9 +5,9 @@ binary = SM.ExtLibrary(builder, 'dbi.sqlite.ext')
|
|||||||
binary.compiler.cxxincludes += [
|
binary.compiler.cxxincludes += [
|
||||||
os.path.join(SM.mms_root, 'core', 'sourcehook'),
|
os.path.join(SM.mms_root, 'core', 'sourcehook'),
|
||||||
]
|
]
|
||||||
if binary.compiler.vendor == 'gcc' or binary.compiler.vendor == 'clang':
|
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
|
||||||
binary.compiler.cxxflags += ['-fno-rtti']
|
binary.compiler.cxxflags += ['-fno-rtti']
|
||||||
elif binary.compiler.vendor == 'msvc':
|
elif binary.compiler.family == 'msvc':
|
||||||
binary.compiler.cxxflags += ['/GR-']
|
binary.compiler.cxxflags += ['/GR-']
|
||||||
|
|
||||||
binary.compiler.defines += [
|
binary.compiler.defines += [
|
||||||
@ -16,7 +16,7 @@ binary.compiler.defines += [
|
|||||||
'SQLITE_USE_URI',
|
'SQLITE_USE_URI',
|
||||||
'SQLITE_ALLOW_URI_AUTHORITY',
|
'SQLITE_ALLOW_URI_AUTHORITY',
|
||||||
]
|
]
|
||||||
if builder.target_platform == 'linux':
|
if builder.target.platform == 'linux':
|
||||||
binary.compiler.postlink += ['-ldl', '-lpthread']
|
binary.compiler.postlink += ['-ldl', '-lpthread']
|
||||||
|
|
||||||
binary.sources += [
|
binary.sources += [
|
||||||
|
@ -143,6 +143,7 @@ PlayerConditionsMgr::PlayerConditionsMgr()
|
|||||||
m_CondOffset[m_nPlayerCondEx] = 32;
|
m_CondOffset[m_nPlayerCondEx] = 32;
|
||||||
m_CondOffset[m_nPlayerCondEx2] = 64;
|
m_CondOffset[m_nPlayerCondEx2] = 64;
|
||||||
m_CondOffset[m_nPlayerCondEx3] = 96;
|
m_CondOffset[m_nPlayerCondEx3] = 96;
|
||||||
|
m_CondOffset[m_nPlayerCondEx4] = 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlayerConditionsMgr::Init()
|
bool PlayerConditionsMgr::Init()
|
||||||
@ -153,7 +154,8 @@ bool PlayerConditionsMgr::Init()
|
|||||||
&& SetupProp<_condition_bits>("_condition_bits")
|
&& SetupProp<_condition_bits>("_condition_bits")
|
||||||
&& SetupProp<m_nPlayerCondEx>("m_nPlayerCondEx")
|
&& SetupProp<m_nPlayerCondEx>("m_nPlayerCondEx")
|
||||||
&& SetupProp<m_nPlayerCondEx2>("m_nPlayerCondEx2")
|
&& SetupProp<m_nPlayerCondEx2>("m_nPlayerCondEx2")
|
||||||
&& SetupProp<m_nPlayerCondEx3>("m_nPlayerCondEx3");
|
&& SetupProp<m_nPlayerCondEx3>("m_nPlayerCondEx3")
|
||||||
|
&& SetupProp<m_nPlayerCondEx4>("m_nPlayerCondEx4");
|
||||||
|
|
||||||
if (!bFoundProps)
|
if (!bFoundProps)
|
||||||
return false;
|
return false;
|
||||||
|
@ -52,6 +52,7 @@ public:
|
|||||||
m_nPlayerCondEx,
|
m_nPlayerCondEx,
|
||||||
m_nPlayerCondEx2,
|
m_nPlayerCondEx2,
|
||||||
m_nPlayerCondEx3,
|
m_nPlayerCondEx3,
|
||||||
|
m_nPlayerCondEx4,
|
||||||
|
|
||||||
CondVar_Count
|
CondVar_Count
|
||||||
};
|
};
|
||||||
|
@ -45,7 +45,7 @@ cell_t TF2_MakeBleed(IPluginContext *pContext, const cell_t *params)
|
|||||||
if(!pWrapper)
|
if(!pWrapper)
|
||||||
{
|
{
|
||||||
REGISTER_NATIVE_ADDR("MakeBleed",
|
REGISTER_NATIVE_ADDR("MakeBleed",
|
||||||
PassInfo pass[5]; \
|
PassInfo pass[6]; \
|
||||||
pass[0].flags = PASSFLAG_BYVAL; \
|
pass[0].flags = PASSFLAG_BYVAL; \
|
||||||
pass[0].size = sizeof(CBaseEntity *); \
|
pass[0].size = sizeof(CBaseEntity *); \
|
||||||
pass[0].type = PassType_Basic; \
|
pass[0].type = PassType_Basic; \
|
||||||
@ -61,7 +61,10 @@ cell_t TF2_MakeBleed(IPluginContext *pContext, const cell_t *params)
|
|||||||
pass[4].flags = PASSFLAG_BYVAL; \
|
pass[4].flags = PASSFLAG_BYVAL; \
|
||||||
pass[4].size = sizeof(bool); \
|
pass[4].size = sizeof(bool); \
|
||||||
pass[4].type = PassType_Basic; \
|
pass[4].type = PassType_Basic; \
|
||||||
pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 5))
|
pass[5].flags = PASSFLAG_BYVAL; \
|
||||||
|
pass[5].size = sizeof(int); \
|
||||||
|
pass[5].type = PassType_Basic; \
|
||||||
|
pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 6))
|
||||||
}
|
}
|
||||||
|
|
||||||
CBaseEntity *pEntity;
|
CBaseEntity *pEntity;
|
||||||
@ -78,7 +81,7 @@ cell_t TF2_MakeBleed(IPluginContext *pContext, const cell_t *params)
|
|||||||
|
|
||||||
void *obj = (void *)((uint8_t *)pEntity + playerSharedOffset->actual_offset);
|
void *obj = (void *)((uint8_t *)pEntity + playerSharedOffset->actual_offset);
|
||||||
|
|
||||||
unsigned char vstk[sizeof(void *) + 2*sizeof(CBaseEntity *) + sizeof(float) + sizeof(int) + sizeof(bool)];
|
unsigned char vstk[sizeof(void *) + 2*sizeof(CBaseEntity *) + sizeof(float) + sizeof(int) + sizeof(bool) + sizeof(int)];
|
||||||
unsigned char *vptr = vstk;
|
unsigned char *vptr = vstk;
|
||||||
|
|
||||||
*(void **)vptr = obj;
|
*(void **)vptr = obj;
|
||||||
@ -89,9 +92,11 @@ cell_t TF2_MakeBleed(IPluginContext *pContext, const cell_t *params)
|
|||||||
vptr += sizeof(CBaseEntity *);
|
vptr += sizeof(CBaseEntity *);
|
||||||
*(float *)vptr = sp_ctof(params[3]);
|
*(float *)vptr = sp_ctof(params[3]);
|
||||||
vptr += sizeof(float);
|
vptr += sizeof(float);
|
||||||
*(int *)vptr = 4;
|
*(int *)vptr = 4; // Damage amount
|
||||||
vptr += sizeof(int);
|
vptr += sizeof(int);
|
||||||
*(bool *)vptr = false;
|
*(bool *)vptr = false; // Permanent
|
||||||
|
vptr += sizeof(bool);
|
||||||
|
*(int *)vptr = 34; // Custom Damage type (bleeding)
|
||||||
|
|
||||||
pWrapper->Execute(vstk, NULL);
|
pWrapper->Execute(vstk, NULL);
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@ binary = SM.ExtLibrary(builder, 'topmenus.ext')
|
|||||||
binary.compiler.cxxincludes += [
|
binary.compiler.cxxincludes += [
|
||||||
os.path.join(SM.mms_root, 'core', 'sourcehook'),
|
os.path.join(SM.mms_root, 'core', 'sourcehook'),
|
||||||
]
|
]
|
||||||
if binary.compiler.vendor == 'gcc' or binary.compiler.vendor == 'clang':
|
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
|
||||||
binary.compiler.cxxflags += ['-fno-rtti']
|
binary.compiler.cxxflags += ['-fno-rtti']
|
||||||
elif binary.compiler.vendor == 'msvc':
|
elif binary.compiler.family == 'msvc':
|
||||||
binary.compiler.cxxflags += ['/GR-']
|
binary.compiler.cxxflags += ['/GR-']
|
||||||
|
|
||||||
binary.sources += [
|
binary.sources += [
|
||||||
|
@ -5,9 +5,9 @@ binary = SM.ExtLibrary(builder, 'updater.ext')
|
|||||||
binary.compiler.cxxincludes += [
|
binary.compiler.cxxincludes += [
|
||||||
os.path.join(SM.mms_root, 'core', 'sourcehook'),
|
os.path.join(SM.mms_root, 'core', 'sourcehook'),
|
||||||
]
|
]
|
||||||
if binary.compiler.vendor == 'gcc' or binary.compiler.vendor == 'clang':
|
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
|
||||||
binary.compiler.cxxflags += ['-fno-rtti']
|
binary.compiler.cxxflags += ['-fno-rtti']
|
||||||
elif binary.compiler.vendor == 'msvc':
|
elif binary.compiler.family == 'msvc':
|
||||||
binary.compiler.cxxflags += ['/GR-']
|
binary.compiler.cxxflags += ['/GR-']
|
||||||
|
|
||||||
binary.sources += [
|
binary.sources += [
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
{
|
{
|
||||||
"CanBeAutobalanced"
|
"CanBeAutobalanced"
|
||||||
{
|
{
|
||||||
"windows" "461"
|
"windows" "462"
|
||||||
"linux" "462"
|
"linux" "463"
|
||||||
"mac" "462"
|
"mac" "463"
|
||||||
}
|
}
|
||||||
"EndTouch"
|
"EndTouch"
|
||||||
{
|
{
|
||||||
@ -43,27 +43,27 @@
|
|||||||
}
|
}
|
||||||
"OnTakeDamage_Alive"
|
"OnTakeDamage_Alive"
|
||||||
{
|
{
|
||||||
"windows" "274"
|
"windows" "275"
|
||||||
"linux" "275"
|
"linux" "276"
|
||||||
"mac" "275"
|
"mac" "276"
|
||||||
}
|
}
|
||||||
"PreThink"
|
"PreThink"
|
||||||
{
|
|
||||||
"windows" "335"
|
|
||||||
"linux" "336"
|
|
||||||
"mac" "336"
|
|
||||||
}
|
|
||||||
"PostThink"
|
|
||||||
{
|
{
|
||||||
"windows" "336"
|
"windows" "336"
|
||||||
"linux" "337"
|
"linux" "337"
|
||||||
"mac" "337"
|
"mac" "337"
|
||||||
}
|
}
|
||||||
|
"PostThink"
|
||||||
|
{
|
||||||
|
"windows" "337"
|
||||||
|
"linux" "338"
|
||||||
|
"mac" "338"
|
||||||
|
}
|
||||||
"Reload"
|
"Reload"
|
||||||
{
|
{
|
||||||
"windows" "275"
|
"windows" "276"
|
||||||
"linux" "281"
|
"linux" "282"
|
||||||
"mac" "281"
|
"mac" "282"
|
||||||
}
|
}
|
||||||
"SetTransmit"
|
"SetTransmit"
|
||||||
{
|
{
|
||||||
@ -127,34 +127,34 @@
|
|||||||
}
|
}
|
||||||
"Weapon_CanSwitchTo"
|
"Weapon_CanSwitchTo"
|
||||||
{
|
{
|
||||||
"windows" "268"
|
"windows" "269"
|
||||||
"linux" "269"
|
"linux" "270"
|
||||||
"mac" "269"
|
"mac" "270"
|
||||||
}
|
}
|
||||||
"Weapon_CanUse"
|
"Weapon_CanUse"
|
||||||
{
|
|
||||||
"windows" "262"
|
|
||||||
"linux" "263"
|
|
||||||
"mac" "263"
|
|
||||||
}
|
|
||||||
"Weapon_Drop"
|
|
||||||
{
|
|
||||||
"windows" "265"
|
|
||||||
"linux" "266"
|
|
||||||
"mac" "266"
|
|
||||||
}
|
|
||||||
"Weapon_Equip"
|
|
||||||
{
|
{
|
||||||
"windows" "263"
|
"windows" "263"
|
||||||
"linux" "264"
|
"linux" "264"
|
||||||
"mac" "264"
|
"mac" "264"
|
||||||
}
|
}
|
||||||
"Weapon_Switch"
|
"Weapon_Drop"
|
||||||
{
|
{
|
||||||
"windows" "266"
|
"windows" "266"
|
||||||
"linux" "267"
|
"linux" "267"
|
||||||
"mac" "267"
|
"mac" "267"
|
||||||
}
|
}
|
||||||
|
"Weapon_Equip"
|
||||||
|
{
|
||||||
|
"windows" "264"
|
||||||
|
"linux" "265"
|
||||||
|
"mac" "265"
|
||||||
|
}
|
||||||
|
"Weapon_Switch"
|
||||||
|
{
|
||||||
|
"windows" "267"
|
||||||
|
"linux" "268"
|
||||||
|
"mac" "268"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,33 +18,33 @@
|
|||||||
{
|
{
|
||||||
"GiveNamedItem"
|
"GiveNamedItem"
|
||||||
{
|
{
|
||||||
"windows" "400"
|
"windows" "401"
|
||||||
"linux" "404"
|
"linux" "405"
|
||||||
"mac" "404"
|
"mac" "405"
|
||||||
}
|
}
|
||||||
"RemovePlayerItem"
|
"RemovePlayerItem"
|
||||||
{
|
{
|
||||||
"windows" "272"
|
"windows" "273"
|
||||||
"linux" "273"
|
"linux" "274"
|
||||||
"mac" "273"
|
"mac" "274"
|
||||||
}
|
}
|
||||||
"Weapon_GetSlot"
|
"Weapon_GetSlot"
|
||||||
{
|
{
|
||||||
"windows" "270"
|
"windows" "271"
|
||||||
"linux" "271"
|
"linux" "272"
|
||||||
"mac" "271"
|
"mac" "272"
|
||||||
}
|
}
|
||||||
"Ignite"
|
"Ignite"
|
||||||
{
|
{
|
||||||
"windows" "211"
|
"windows" "212"
|
||||||
"linux" "212"
|
"linux" "213"
|
||||||
"mac" "212"
|
"mac" "213"
|
||||||
}
|
}
|
||||||
"Extinguish"
|
"Extinguish"
|
||||||
{
|
{
|
||||||
"windows" "215"
|
"windows" "216"
|
||||||
"linux" "216"
|
"linux" "217"
|
||||||
"mac" "216"
|
"mac" "217"
|
||||||
}
|
}
|
||||||
"Teleport"
|
"Teleport"
|
||||||
{
|
{
|
||||||
@ -54,9 +54,9 @@
|
|||||||
}
|
}
|
||||||
"CommitSuicide"
|
"CommitSuicide"
|
||||||
{
|
{
|
||||||
"windows" "444"
|
"windows" "445"
|
||||||
"linux" "444"
|
"linux" "445"
|
||||||
"mac" "444"
|
"mac" "445"
|
||||||
}
|
}
|
||||||
"GetVelocity"
|
"GetVelocity"
|
||||||
{
|
{
|
||||||
@ -84,9 +84,9 @@
|
|||||||
}
|
}
|
||||||
"WeaponEquip"
|
"WeaponEquip"
|
||||||
{
|
{
|
||||||
"windows" "263"
|
"windows" "264"
|
||||||
"linux" "264"
|
"linux" "265"
|
||||||
"mac" "264"
|
"mac" "265"
|
||||||
}
|
}
|
||||||
"Activate"
|
"Activate"
|
||||||
{
|
{
|
||||||
@ -96,15 +96,15 @@
|
|||||||
}
|
}
|
||||||
"PlayerRunCmd"
|
"PlayerRunCmd"
|
||||||
{
|
{
|
||||||
"windows" "421"
|
"windows" "422"
|
||||||
"linux" "422"
|
"linux" "423"
|
||||||
"mac" "422"
|
"mac" "423"
|
||||||
}
|
}
|
||||||
"GiveAmmo"
|
"GiveAmmo"
|
||||||
{
|
{
|
||||||
"windows" "254"
|
"windows" "255"
|
||||||
"linux" "255"
|
"linux" "256"
|
||||||
"mac" "255"
|
"mac" "256"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@
|
|||||||
"FireOutput"
|
"FireOutput"
|
||||||
{
|
{
|
||||||
"library" "server"
|
"library" "server"
|
||||||
"windows" "\x55\x8B\xEC\x81\xEC\x24\x01\x00\x00\x53"
|
"windows" "\x55\x8B\xEC\x81\xEC\x24\x01\x00\x00\x53\x8B\xC1"
|
||||||
"linux" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
|
"linux" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
|
||||||
"mac" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
|
"mac" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
|
||||||
}
|
}
|
||||||
|
@ -18,21 +18,21 @@
|
|||||||
"Burn"
|
"Burn"
|
||||||
{
|
{
|
||||||
"library" "server"
|
"library" "server"
|
||||||
"windows" "\x55\x8B\xEC\x83\xEC\x08\x56\x8B\xF1\x8B\x8E\x8C\x01\x00\x00\x8B\x01"
|
"windows" "\x55\x8B\xEC\x83\xEC\x08\x56\x8B\xF1\x8B\x8E\x90\x01\x00\x00\x8B\x01"
|
||||||
"linux" "@_ZN15CTFPlayerShared4BurnEP9CTFPlayerP13CTFWeaponBasef"
|
"linux" "@_ZN15CTFPlayerShared4BurnEP9CTFPlayerP13CTFWeaponBasef"
|
||||||
"mac" "@_ZN15CTFPlayerShared4BurnEP9CTFPlayerP13CTFWeaponBasef"
|
"mac" "@_ZN15CTFPlayerShared4BurnEP9CTFPlayerP13CTFWeaponBasef"
|
||||||
}
|
}
|
||||||
"RemoveDisguise"
|
"RemoveDisguise"
|
||||||
{
|
{
|
||||||
"library" "server"
|
"library" "server"
|
||||||
"windows" "\x55\x8B\xEC\x51\x56\x8B\xF1\x57\xF7\x86"
|
"windows" "\x55\x8B\xEC\x51\x56\x8B\xF1\x57\xF7\x86\xD0\x00\x00\x00\x00\x00\x02\x00"
|
||||||
"linux" "@_ZN15CTFPlayerShared14RemoveDisguiseEv"
|
"linux" "@_ZN15CTFPlayerShared14RemoveDisguiseEv"
|
||||||
"mac" "@_ZN15CTFPlayerShared14RemoveDisguiseEv"
|
"mac" "@_ZN15CTFPlayerShared14RemoveDisguiseEv"
|
||||||
}
|
}
|
||||||
"Disguise"
|
"Disguise"
|
||||||
{
|
{
|
||||||
"library" "server"
|
"library" "server"
|
||||||
"windows" "\x55\x8B\xEC\x51\x56\x57\x8B\xF9\x8B\x8F\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x8B\x97\x2A\x2A\x2A\x2A\x8B\xF0"
|
"windows" "\x55\x8B\xEC\x83\xEC\x24\x56\x57\x8B\xF9\x8B\x8F\x90\x01\x00\x00"
|
||||||
"linux" "@_ZN15CTFPlayerShared8DisguiseEiiP9CTFPlayerb"
|
"linux" "@_ZN15CTFPlayerShared8DisguiseEiiP9CTFPlayerb"
|
||||||
"mac" "@_ZN15CTFPlayerShared8DisguiseEiiP9CTFPlayerb"
|
"mac" "@_ZN15CTFPlayerShared8DisguiseEiiP9CTFPlayerb"
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@
|
|||||||
"RemoveCondition"
|
"RemoveCondition"
|
||||||
{
|
{
|
||||||
"library" "server"
|
"library" "server"
|
||||||
"windows" "\x55\x8B\xEC\x56\x57\x8B\x7D\x08\x8B\xF1\x57\xE8\x2A\x2A\x2A\x2A\x84\xC0\x0F\x84"
|
"windows" "\x55\x8B\xEC\x83\xEC\x08\x53\x8B\x5D\x08\x56\x53"
|
||||||
"linux" "@_ZN15CTFPlayerShared10RemoveCondE7ETFCondb"
|
"linux" "@_ZN15CTFPlayerShared10RemoveCondE7ETFCondb"
|
||||||
"mac" "@_ZN15CTFPlayerShared10RemoveCondE7ETFCondb"
|
"mac" "@_ZN15CTFPlayerShared10RemoveCondE7ETFCondb"
|
||||||
}
|
}
|
||||||
@ -74,16 +74,16 @@
|
|||||||
"StunPlayer"
|
"StunPlayer"
|
||||||
{
|
{
|
||||||
"library" "server"
|
"library" "server"
|
||||||
"windows" "\x55\x8B\xEC\x83\xEC\x24\x57\x8B\xF9\x8B\x87\xF8\x03\x00\x00"
|
"windows" "\x55\x8B\xEC\x83\xEC\x20\x57\x8B\xF9\x8B\x87\x58\x04\x00\x00"
|
||||||
"linux" "@_ZN15CTFPlayerShared10StunPlayerEffiP9CTFPlayer"
|
"linux" "@_ZN15CTFPlayerShared10StunPlayerEffiP9CTFPlayer"
|
||||||
"mac" "@_ZN15CTFPlayerShared10StunPlayerEffiP9CTFPlayer"
|
"mac" "@_ZN15CTFPlayerShared10StunPlayerEffiP9CTFPlayer"
|
||||||
}
|
}
|
||||||
"MakeBleed"
|
"MakeBleed"
|
||||||
{
|
{
|
||||||
"library" "server"
|
"library" "server"
|
||||||
"windows" "\x55\x8B\xEC\x83\xEC\x2C\x53\x8B\xD9\x89\x5D\xEC"
|
"windows" "\x55\x8B\xEC\x83\xEC\x30\x53\x8B\xD9\x89\x5D\xEC"
|
||||||
"linux" "@_ZN15CTFPlayerShared9MakeBleedEP9CTFPlayerP13CTFWeaponBasefib"
|
"linux" "@_ZN15CTFPlayerShared9MakeBleedEP9CTFPlayerP13CTFWeaponBasefibi"
|
||||||
"mac" "@_ZN15CTFPlayerShared9MakeBleedEP9CTFPlayerP13CTFWeaponBasefib"
|
"mac" "@_ZN15CTFPlayerShared9MakeBleedEP9CTFPlayerP13CTFWeaponBasefibi"
|
||||||
}
|
}
|
||||||
"IsPlayerInDuel"
|
"IsPlayerInDuel"
|
||||||
{
|
{
|
||||||
@ -113,21 +113,21 @@
|
|||||||
{
|
{
|
||||||
"ForceRespawn"
|
"ForceRespawn"
|
||||||
{
|
{
|
||||||
"windows" "328"
|
"windows" "329"
|
||||||
"linux" "329"
|
"linux" "330"
|
||||||
"mac" "329"
|
"mac" "330"
|
||||||
}
|
}
|
||||||
"CalcIsAttackCriticalHelper"
|
"CalcIsAttackCriticalHelper"
|
||||||
{
|
{
|
||||||
"windows" "387"
|
"windows" "389"
|
||||||
"linux" "394"
|
"linux" "396"
|
||||||
"mac" "394"
|
"mac" "396"
|
||||||
}
|
}
|
||||||
"CalcIsAttackCriticalHelperNoCrits"
|
"CalcIsAttackCriticalHelperNoCrits"
|
||||||
{
|
{
|
||||||
"windows" "388"
|
"windows" "390"
|
||||||
"linux" "395"
|
"linux" "397"
|
||||||
"mac" "395"
|
"mac" "397"
|
||||||
}
|
}
|
||||||
|
|
||||||
// CTFGameRules::IsHolidayActive
|
// CTFGameRules::IsHolidayActive
|
||||||
@ -140,9 +140,9 @@
|
|||||||
|
|
||||||
"RemoveWearable"
|
"RemoveWearable"
|
||||||
{
|
{
|
||||||
"windows" "430"
|
"windows" "431"
|
||||||
"linux" "431"
|
"linux" "432"
|
||||||
"mac" "431"
|
"mac" "432"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
|
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
if builder.target_platform in ['windows', 'mac']:
|
if builder.target.platform in ['windows', 'mac']:
|
||||||
name = 'sourcemod_mm'
|
name = 'sourcemod_mm'
|
||||||
extra_ldflags = []
|
extra_ldflags = []
|
||||||
elif builder.target_platform == 'linux':
|
elif builder.target.platform == 'linux':
|
||||||
name = 'sourcemod_mm_i486'
|
name = 'sourcemod_mm_i486'
|
||||||
extra_ldflags = ['-ldl']
|
extra_ldflags = ['-ldl']
|
||||||
|
|
||||||
@ -13,9 +13,9 @@ binary.compiler.cxxincludes += [
|
|||||||
os.path.join(SM.mms_root, 'core'),
|
os.path.join(SM.mms_root, 'core'),
|
||||||
os.path.join(SM.mms_root, 'sourcehook')
|
os.path.join(SM.mms_root, 'sourcehook')
|
||||||
]
|
]
|
||||||
if binary.compiler.vendor == 'gcc' or binary.compiler.vendor == 'clang':
|
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
|
||||||
binary.compiler.cxxflags += ['-fno-rtti']
|
binary.compiler.cxxflags += ['-fno-rtti']
|
||||||
elif binary.compiler.vendor == 'msvc':
|
elif binary.compiler.family == 'msvc':
|
||||||
binary.compiler.cxxflags += ['/GR-']
|
binary.compiler.cxxflags += ['/GR-']
|
||||||
binary.compiler.linkflags += extra_ldflags
|
binary.compiler.linkflags += extra_ldflags
|
||||||
binary.sources = [
|
binary.sources = [
|
||||||
|
@ -392,7 +392,7 @@ void SendPrivateChat(int client, int target, const char[] message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PrintToChat(target, "\x04(Private to %N) %N: \x01%s", target, client, message);
|
PrintToChat(target, "\x04(Private to %N) %N: \x01%s", target, client, message);
|
||||||
LogAction(client, -1, "\"%L\" triggered sm_psay to \"%L\" (text %s)", client, target, message);
|
LogAction(client, target, "\"%L\" triggered sm_psay to \"%L\" (text %s)", client, target, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendPanelToAll(int from, char[] message)
|
void SendPanelToAll(int from, char[] message)
|
||||||
|
@ -76,7 +76,7 @@ void PerformBlind(int client, int target, int amount)
|
|||||||
|
|
||||||
EndMessage();
|
EndMessage();
|
||||||
|
|
||||||
LogAction(client, target, "\"%L\" set blind on \"%L\", amount %d.", client, target, amount);
|
LogAction(client, target, "\"%L\" set blind on \"%L\" (amount \"%d\")", client, target, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AdminMenu_Blind(TopMenu topmenu,
|
public void AdminMenu_Blind(TopMenu topmenu,
|
||||||
|
@ -36,7 +36,7 @@ int g_GravityTarget[MAXPLAYERS+1];
|
|||||||
void PerformGravity(int client, int target, float amount)
|
void PerformGravity(int client, int target, float amount)
|
||||||
{
|
{
|
||||||
SetEntityGravity(target, amount);
|
SetEntityGravity(target, amount);
|
||||||
LogAction(client, target, "\"%L\" set gravity on \"%L\" to %f.", client, target, amount);
|
LogAction(client, target, "\"%L\" set gravity on \"%L\" (amount \"%f\")", client, target, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AdminMenu_Gravity(TopMenu topmenu,
|
public void AdminMenu_Gravity(TopMenu topmenu,
|
||||||
|
@ -143,6 +143,22 @@ struct SharedPlugin
|
|||||||
public float NULL_VECTOR[3]; /**< Pass this into certain functions to act as a C++ NULL */
|
public float NULL_VECTOR[3]; /**< Pass this into certain functions to act as a C++ NULL */
|
||||||
public const char NULL_STRING[1]; /**< pass this into certain functions to act as a C++ NULL */
|
public const char NULL_STRING[1]; /**< pass this into certain functions to act as a C++ NULL */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given vector is the NULL_VECTOR.
|
||||||
|
*
|
||||||
|
* @param vec The vector to test.
|
||||||
|
* @return True if NULL_VECTOR, false otherwise.
|
||||||
|
*/
|
||||||
|
native bool IsNullVector(const float vec[3]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given string is the NULL_STRING.
|
||||||
|
*
|
||||||
|
* @param str The string to test.
|
||||||
|
* @return True if NULL_STRING, false otherwise.
|
||||||
|
*/
|
||||||
|
native bool IsNullString(const char[] str);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Horrible compatibility shim.
|
* Horrible compatibility shim.
|
||||||
*/
|
*/
|
||||||
|
@ -290,6 +290,16 @@ native void Call_PushArray(const any[] value, int size);
|
|||||||
*/
|
*/
|
||||||
native void Call_PushArrayEx(any[] value, int size, int cpflags);
|
native void Call_PushArrayEx(any[] value, int size, int cpflags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pushes the NULL_VECTOR onto the current call.
|
||||||
|
* @see IsNullVector
|
||||||
|
*
|
||||||
|
* @note Cannot be used before a call has been started.
|
||||||
|
*
|
||||||
|
* @error Called before a call has been started.
|
||||||
|
*/
|
||||||
|
native void Call_PushNullVector();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pushes a string onto the current call.
|
* Pushes a string onto the current call.
|
||||||
*
|
*
|
||||||
@ -317,6 +327,16 @@ native void Call_PushString(const char[] value);
|
|||||||
*/
|
*/
|
||||||
native void Call_PushStringEx(char[] value, int length, int szflags, int cpflags);
|
native void Call_PushStringEx(char[] value, int length, int szflags, int cpflags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pushes the NULL_STRING onto the current call.
|
||||||
|
* @see IsNullString
|
||||||
|
*
|
||||||
|
* @note Cannot be used before a call has been started.
|
||||||
|
*
|
||||||
|
* @error Called before a call has been started.
|
||||||
|
*/
|
||||||
|
native void Call_PushNullString();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Completes a call to a function or forward's call list.
|
* Completes a call to a function or forward's call list.
|
||||||
*
|
*
|
||||||
@ -465,6 +485,22 @@ native int GetNativeArray(int param, any[] local, int size);
|
|||||||
*/
|
*/
|
||||||
native int SetNativeArray(int param, const any[] local, int size);
|
native int SetNativeArray(int param, const any[] local, int size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the native parameter is the NULL_VECTOR.
|
||||||
|
*
|
||||||
|
* @param param Parameter number, starting from 1.
|
||||||
|
* @return True if NULL_VECTOR, false otherwise.
|
||||||
|
*/
|
||||||
|
native bool IsNativeParamNullVector(int param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the native parameter is the NULL_STRING.
|
||||||
|
*
|
||||||
|
* @param param Parameter number, starting from 1.
|
||||||
|
* @return True if NULL_STRING, false otherwise.
|
||||||
|
*/
|
||||||
|
native bool IsNativeParamNullString(int param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats a string using parameters from a native.
|
* Formats a string using parameters from a native.
|
||||||
*
|
*
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#define TF_STUNFLAG_NOSOUNDOREFFECT (1 << 5) /**< no sound or particle */
|
#define TF_STUNFLAG_NOSOUNDOREFFECT (1 << 5) /**< no sound or particle */
|
||||||
#define TF_STUNFLAG_THIRDPERSON (1 << 6) /**< panic animation */
|
#define TF_STUNFLAG_THIRDPERSON (1 << 6) /**< panic animation */
|
||||||
#define TF_STUNFLAG_GHOSTEFFECT (1 << 7) /**< ghost particles */
|
#define TF_STUNFLAG_GHOSTEFFECT (1 << 7) /**< ghost particles */
|
||||||
|
#define TF_STUNFLAG_SOUND (1 << 8) /**< sound */
|
||||||
|
|
||||||
#define TF_STUNFLAGS_LOSERSTATE TF_STUNFLAG_SLOWDOWN|TF_STUNFLAG_NOSOUNDOREFFECT|TF_STUNFLAG_THIRDPERSON
|
#define TF_STUNFLAGS_LOSERSTATE TF_STUNFLAG_SLOWDOWN|TF_STUNFLAG_NOSOUNDOREFFECT|TF_STUNFLAG_THIRDPERSON
|
||||||
#define TF_STUNFLAGS_GHOSTSCARE TF_STUNFLAG_GHOSTEFFECT|TF_STUNFLAG_THIRDPERSON
|
#define TF_STUNFLAGS_GHOSTSCARE TF_STUNFLAG_GHOSTEFFECT|TF_STUNFLAG_THIRDPERSON
|
||||||
@ -195,7 +196,17 @@ enum TFCond
|
|||||||
TFCond_KnockedIntoAir,
|
TFCond_KnockedIntoAir,
|
||||||
TFCond_CompetitiveWinner,
|
TFCond_CompetitiveWinner,
|
||||||
TFCond_CompetitiveLoser,
|
TFCond_CompetitiveLoser,
|
||||||
TFCond_NoTaunting,
|
TFCond_NoTaunting_DEPRECATED,
|
||||||
|
TFCond_HealingDebuff = 118,
|
||||||
|
TFCond_PasstimePenaltyDebuff,
|
||||||
|
TFCond_GrappledToPlayer,
|
||||||
|
TFCond_GrappledByPlayer,
|
||||||
|
TFCond_ParachuteDeployed,
|
||||||
|
TFCond_Gas,
|
||||||
|
TFCond_BurningPyro,
|
||||||
|
TFCond_RocketPack,
|
||||||
|
TFCond_LostFooting,
|
||||||
|
TFCond_AirCurrent,
|
||||||
};
|
};
|
||||||
|
|
||||||
const float TFCondDuration_Infinite = -1.0;
|
const float TFCondDuration_Infinite = -1.0;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -35,7 +35,7 @@ char g_NewName[MAXPLAYERS+1][MAX_NAME_LENGTH];
|
|||||||
|
|
||||||
void PerformRename(int client, int target)
|
void PerformRename(int client, int target)
|
||||||
{
|
{
|
||||||
LogAction(client, target, "\"%L\" renamed \"%L\" to \"%s\")", client, target, g_NewName[target]);
|
LogAction(client, target, "\"%L\" renamed \"%L\" (to \"%s\")", client, target, g_NewName[target]);
|
||||||
|
|
||||||
SetClientName(target, g_NewName[target]);
|
SetClientName(target, g_NewName[target]);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
using namespace SourcePawn;
|
using namespace SourcePawn;
|
||||||
|
|
||||||
#define SMINTERFACE_FORWARDMANAGER_NAME "IForwardManager"
|
#define SMINTERFACE_FORWARDMANAGER_NAME "IForwardManager"
|
||||||
#define SMINTERFACE_FORWARDMANAGER_VERSION 3
|
#define SMINTERFACE_FORWARDMANAGER_VERSION 4
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* There is some very important documentation at the bottom of this file.
|
* There is some very important documentation at the bottom of this file.
|
||||||
@ -118,6 +118,7 @@ namespace SourceMod
|
|||||||
cell_t val;
|
cell_t val;
|
||||||
ByrefInfo byref;
|
ByrefInfo byref;
|
||||||
ParamType pushedas;
|
ParamType pushedas;
|
||||||
|
bool isnull;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IForwardFilter
|
class IForwardFilter
|
||||||
@ -177,12 +178,21 @@ namespace SourceMod
|
|||||||
* @brief Pushes an array of cells onto the current call. Different rules than ICallable.
|
* @brief Pushes an array of cells onto the current call. Different rules than ICallable.
|
||||||
* NOTE: On Execute, the pointer passed will be modified according to the copyback rule.
|
* NOTE: On Execute, the pointer passed will be modified according to the copyback rule.
|
||||||
*
|
*
|
||||||
* @param inarray Array to copy. Cannot be NULL, unlike ICallable's version.
|
* @param inarray Array to copy. If NULL and cells is 3 pushes a reference to the NULL_VECTOR pubvar to each callee.
|
||||||
|
* Pushing other number of cells is not allowed, unlike ICallable's version.
|
||||||
* @param cells Number of cells to allocate and optionally read from the input array.
|
* @param cells Number of cells to allocate and optionally read from the input array.
|
||||||
* @param flags Whether or not changes should be copied back to the input array.
|
* @param flags Whether or not changes should be copied back to the input array.
|
||||||
* @return Error code, if any.
|
* @return Error code, if any.
|
||||||
*/
|
*/
|
||||||
virtual int PushArray(cell_t *inarray, unsigned int cells, int flags=0) =0;
|
virtual int PushArray(cell_t *inarray, unsigned int cells, int flags=0) =0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Pushes a string onto the current call.
|
||||||
|
*
|
||||||
|
* @param string String to push. If NULL pushes a reference to the NULL_STRING pubvar to each callee.
|
||||||
|
* @return Error code, if any.
|
||||||
|
*/
|
||||||
|
virtual int PushString(const char *string) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit e3a888eab7ee73e7fbff9f3e2f0529a87b284d39
|
Subproject commit 50dbd2f8f6f13e799037919470064878bd4a3960
|
@ -71,3 +71,5 @@ R.I.P. Wade Boggs
|
|||||||
Your tier1 tower is under attack..
|
Your tier1 tower is under attack..
|
||||||
Christmas!!!
|
Christmas!!!
|
||||||
the mousse angles are smooth
|
the mousse angles are smooth
|
||||||
|
spoilers
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 12365b39ccc20ab6c5fa28ec56f1c593d177b91c
|
Subproject commit c78349382d97d5a9f20b49975c47d9bb805c125d
|
@ -7,19 +7,19 @@ UPLOAD_SCRIPT = os.path.join(builder.sourcePath, 'tools', 'buildbot', 'upload_sy
|
|||||||
|
|
||||||
cxx_tasks = SM.binaries + SM.extensions + [SM.spcomp]
|
cxx_tasks = SM.binaries + SM.extensions + [SM.spcomp]
|
||||||
for cxx_task in cxx_tasks:
|
for cxx_task in cxx_tasks:
|
||||||
if builder.target_platform in ['windows']:
|
if builder.target.platform in ['windows']:
|
||||||
debug_entry = cxx_task.debug
|
debug_entry = cxx_task.debug
|
||||||
else:
|
else:
|
||||||
debug_entry = cxx_task.binary
|
debug_entry = cxx_task.binary
|
||||||
|
|
||||||
debug_file = os.path.join(builder.buildPath, debug_entry.path)
|
debug_file = os.path.join(builder.buildPath, debug_entry.path)
|
||||||
if builder.target_platform == 'linux':
|
if builder.target.platform == 'linux':
|
||||||
argv = ['dump_syms', debug_file, os.path.dirname(debug_file)]
|
argv = ['dump_syms', debug_file, os.path.dirname(debug_file)]
|
||||||
elif builder.target_platform == 'mac':
|
elif builder.target.platform == 'mac':
|
||||||
# Required once dump_syms is updated on the slaves.
|
# Required once dump_syms is updated on the slaves.
|
||||||
#argv = ['dump_syms', '-g', debug_file + '.dSYM', debug_file]
|
#argv = ['dump_syms', '-g', debug_file + '.dSYM', debug_file]
|
||||||
argv = ['dump_syms', debug_file + '.dSYM']
|
argv = ['dump_syms', debug_file + '.dSYM']
|
||||||
elif builder.target_platform == 'windows':
|
elif builder.target.platform == 'windows':
|
||||||
argv = ['dump_syms.exe', debug_file]
|
argv = ['dump_syms.exe', debug_file]
|
||||||
|
|
||||||
base_file = os.path.splitext(os.path.basename(debug_file))[0]
|
base_file = os.path.splitext(os.path.basename(debug_file))[0]
|
||||||
|
@ -474,7 +474,7 @@ CopyFiles('plugins/playercommands', 'addons/sourcemod/scripting/playercommands',
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
if builder.target_platform == 'windows':
|
if builder.target.platform == 'windows':
|
||||||
CopyFiles('tools/batchtool', 'addons/sourcemod/scripting', ['compile.exe'])
|
CopyFiles('tools/batchtool', 'addons/sourcemod/scripting', ['compile.exe'])
|
||||||
else:
|
else:
|
||||||
CopyFiles('plugins', 'addons/sourcemod/scripting', ['compile.sh'])
|
CopyFiles('plugins', 'addons/sourcemod/scripting', ['compile.sh'])
|
||||||
|
@ -50,7 +50,7 @@ def output_version_headers():
|
|||||||
count, shorthash, longhash = get_git_version()
|
count, shorthash, longhash = get_git_version()
|
||||||
|
|
||||||
with open(os.path.join(SourceFolder, 'product.version')) as fp:
|
with open(os.path.join(SourceFolder, 'product.version')) as fp:
|
||||||
contents = fp.read()
|
contents = fp.read().strip()
|
||||||
m = re.match('(\d+)\.(\d+)\.(\d+)-?(.*)', contents)
|
m = re.match('(\d+)\.(\d+)\.(\d+)-?(.*)', contents)
|
||||||
if m == None:
|
if m == None:
|
||||||
raise Exception('Could not detremine product version')
|
raise Exception('Could not detremine product version')
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# vim: sts=2 ts=8 sw=2 tw=99 et ft=python:
|
# vim: sts=2 ts=8 sw=2 tw=99 et ft=python:
|
||||||
import os
|
import os
|
||||||
|
|
||||||
lib = builder.compiler.StaticLibrary('version')
|
lib = SM.StaticLibrary(builder, 'version')
|
||||||
lib.compiler.includes += [
|
lib.compiler.includes += [
|
||||||
os.path.join(builder.sourcePath, 'public')
|
os.path.join(builder.sourcePath, 'public')
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user