diff --git a/AMBuildScript b/AMBuildScript index 10f0814..a689c86 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -1,6 +1,7 @@ # vim: set sts=2 ts=8 sw=2 tw=99 et ft=python: import os, sys import traceback +import subprocess class SDK(object): def __init__(self, sdk, ext, aDef, name, platform, dir): @@ -184,6 +185,13 @@ class ExtensionConfig(object): raise Exception('Could not find a source copy of Metamod:Source') self.mms_root = Normalize(self.mms_root) + # Run protobuf compilation and copy files to corresponding folders + if 'csgo' in self.sdks: + os.chdir("../pb/") + os.chmod('./build_protobuf.sh', 0o755) + subprocess.call("./build_protobuf.sh") + + def configure(self): if not set(self.target_archs).issubset(['x86', 'x86_64']): raise Exception('Unknown target architecture: {0}'.format(self.target_archs)) @@ -207,7 +215,7 @@ class ExtensionConfig(object): elif cxx.family == 'msvc': self.configure_msvc(cxx) - # Optimizaiton + # Optimization if builder.options.opt == '1': cxx.defines += ['NDEBUG'] diff --git a/AMBuilder b/AMBuilder index 1d1e7f7..04c364f 100644 --- a/AMBuilder +++ b/AMBuilder @@ -23,24 +23,9 @@ for cxx in builder.targets: binary.compiler.cflags += ['-Wno-deprecated-declarations'] binary.compiler.postlink += ['-framework', 'CoreServices'] - # if cxx.family == 'gcc' or cxx.family == 'clang': - # binary.compiler.cxxflags += ['-fno-rtti'] - # elif cxx.family == 'msvc': - # binary.compiler.cxxflags += ['/GR-'] - - binary.compiler.cxxincludes += [ - os.path.join(builder.sourcePath, 'pb', 'include'), - ] - binary.compiler.postlink += [ - '-L' + os.path.join(builder.sourcePath, 'pb', 'lib'), - '-lprotobuf' - ] - binary.sources += [ 'extension.cpp', 'ringbuffer.cpp', - os.path.join(builder.sourcePath, 'pb', 'csgo', 'netmessages.pb.cc'), - # os.path.join(builder.sourcePath, 'pb', 'google', 'protobuf', 'descriptor.pb.cc'), os.path.join(SM.sm_root, 'extensions', 'sm-ext-common', 'mathstubs.c'), os.path.join(SM.sm_root, 'public', 'smsdk_ext.cpp'), os.path.join(SM.sm_root, 'public', 'CDetour', 'detours.cpp'), @@ -53,6 +38,19 @@ for cxx in builder.targets: os.path.join(SM.sm_root, 'public', 'libudis86', 'udis86.c'), ] + if sdk.name in ['csgo']: + binary.compiler.cxxincludes += [ + os.path.join(builder.sourcePath, 'pb', 'include'), + ] + binary.compiler.postlink += [ + '-L' + os.path.join(builder.sourcePath, 'pb', 'lib'), + '-lprotobuf' + ] + + binary.sources += [ + os.path.join(builder.sourcePath, 'pb', 'csgo', 'netmessages.pb.cc'), + ] + binary.compiler.cxxincludes += [ os.path.join(builder.sourcePath, 'celt') ] diff --git a/configure.py b/configure.py index 6b1fb56..2804d35 100755 --- a/configure.py +++ b/configure.py @@ -1,7 +1,5 @@ # vim: set ts=2 sw=2 tw=99 noet: import sys -import os -import subprocess try: from ambuild2 import run, util except: @@ -39,8 +37,3 @@ parser.options.add_argument('--targets', type=str, dest='targets', default=None, help="Override the target architecture (use commas to separate multiple targets).") parser.Configure() - -# Run protobuf compilation and copy files to corresponding folders -os.chdir("../pb/") -os.chmod('./build_protobuf.sh', 0o755) -subprocess.call("./build_protobuf.sh") diff --git a/extension.cpp b/extension.cpp index 5f205de..ba88db7 100644 --- a/extension.cpp +++ b/extension.cpp @@ -153,6 +153,7 @@ std::string hex_to_string(const std::string& input) return output; } +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_INSURGENCY void PrintCCLCMsg_VoiceData(const char *funcName, int client, const CCLCMsg_VoiceData &msg, bool drop) { g_pSM->LogMessage(myself, "===START=======%s=============", funcName); @@ -193,6 +194,7 @@ DETOUR_DECL_STATIC3(SV_BroadcastVoiceData_CSGO, int, IClient *, pClient, const C // bool CGameClient::CLCMsg_VoiceData( const CCLCMsg_VoiceData& msg ) so wtf ??? return 1; } +#endif DETOUR_DECL_STATIC4(SV_BroadcastVoiceData, void, IClient *, pClient, int, nBytes, char *, data, int64, xuid) { diff --git a/extension.h b/extension.h index 89445e3..cda2734 100644 --- a/extension.h +++ b/extension.h @@ -36,7 +36,10 @@ #include "smsdk_ext.h" #include "celt_header.h" #include "ringbuffer.h" + +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_INSURGENCY #include "pb/csgo/netmessages.pb.h" +#endif /** * @file extension.h