sm-ext-sourcetvmanager/AMBuilder
Peace-Maker 10f7fa56a1 Extract player name in ConnectClient hook in CS:GO
CS:GO doesn't send the client name in plain text, but wraps it in some
protobuf construct.
Parse that list of client convars for the player name and use it in the
SourceTV_OnSpectatorPreConnect forward
2016-03-03 01:12:16 +01:00

69 lines
2.5 KiB
Python

# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os, sys
projectName = 'sourcetvmanager'
# smsdk_ext.cpp will be automatically added later
sourceFiles = [
'extension.cpp',
'natives.cpp',
'forwards.cpp',
'hltvdirectorwrapper.cpp'
]
###############
# Make sure to edit PackageScript, which copies your files to their appropriate locations
# Simple extensions do not need to modify past this point.
project = Extension.HL2Project(builder, projectName + '.ext')
if os.path.isfile(os.path.join(builder.currentSourcePath, 'sdk', 'smsdk_ext.cpp')):
# Use the copy included in the project
project.sources += [os.path.join('sdk', 'smsdk_ext.cpp')]
else:
# Use the copy included with SM 1.6 and newer
project.sources += [os.path.join(Extension.sm_root, 'public', 'smsdk_ext.cpp')]
project.sources += sourceFiles
for sdk_name in ['css', 'csgo']:
if sdk_name not in Extension.sdks:
continue
sdk = Extension.sdks[sdk_name]
binary = Extension.HL2Config(project, projectName + '.ext.' + sdk.ext, sdk)
compiler = binary.compiler
if sdk.name == 'csgo':
compiler.cxxincludes += [
os.path.join(sdk.path, 'common', 'protobuf-2.5.0', 'src'),
os.path.join(sdk.path, 'public', 'engine', 'protobuf'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf')
]
if builder.target_platform == 'linux':
lib_path = os.path.join(sdk.path, 'lib', 'linux32', 'release', 'libprotobuf.a')
elif builder.target_platform == 'mac':
lib_path = os.path.join(sdk.path, 'lib', 'osx32', 'release', 'libprotobuf.a')
elif builder.target_platform == 'windows':
msvc_ver = compiler.version
vs_year = ''
if msvc_ver == 1800:
vs_year = '2013'
else:
raise Exception('Cannot find libprotobuf for MSVC version "' + str(compiler.version) + '"')
if 'DEBUG' in compiler.defines:
lib_path = os.path.join(sdk.path, 'lib', 'win32', 'debug', 'vs' + vs_year, 'libprotobuf.lib')
else:
lib_path = os.path.join(sdk.path, 'lib', 'win32', 'release', 'vs' + vs_year, 'libprotobuf.lib')
compiler.linkflags.insert(0, binary.Dep(lib_path))
binary.sources += [
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessages.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessage_helpers.cpp'),
]
Extension.extensions = builder.Add(project)