diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e493cea --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = false + +[AMBuilder,AMBuildScript,*.py] +indent_style = space +indent_size = 2 \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..124feff --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,103 @@ +name: CI + +on: [push] + +jobs: + build: + name: ${{ matrix.os_short }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-22.04 + - windows-2019 + + include: + - os: ubuntu-22.04 + os_short: linux + - os: windows-2019 + os_short: windows + + steps: + - name: Prepare env + shell: bash + run: | + echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV + + - name: Install (Linux) + if: runner.os == 'Linux' + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install -y clang g++-multilib + echo "CC=clang" >> $GITHUB_ENV + echo "CXX=clang++" >> $GITHUB_ENV + + - name: Setting up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + pip install git+https://github.com/alliedmodders/ambuild + + - name: Checking out hl2sdks + shell: bash + run: | + sdks=(hl2dm dods css tf2) + for sdk in "${sdks[@]}" + do + git clone --depth 1 -b $sdk https://github.com/alliedmodders/hl2sdk hl2sdk-$sdk + done + + - name: Checking out MM:Source + uses: actions/checkout@v3 + with: + repository: alliedmodders/metamod-source + ref: 1.12-dev + path: metamod-source + + - name: Checking out own repository + uses: actions/checkout@v3 + with: + path: stripper-source + + - name: Compiling + working-directory: stripper-source + run: | + python3 configure.py --enable-optimize --symbol-files --sdks=hl2dm,dods,css,tf2 --targets=x86,x86_64 + ambuild objdir + + - name: Uploading package + uses: actions/upload-artifact@v4 + with: + name: stripper-source-${{ matrix.os_short }}-${{ env.GITHUB_SHA_SHORT }} + path: stripper-source/objdir/package + + release: + name: Release + if: github.ref_type == 'tag' + needs: build + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + + - name: Arhive Assets + shell: bash + run: find * -maxdepth 0 -type d -exec zip -r {}.zip {} \; + + - name: Create Release + shell: bash + run: gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --latest -R ${{ github.repository }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload assets + shell: bash + run: gh release upload ${{ github.ref_name }} *.zip -R ${{ github.repository }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/AMBuildScript b/AMBuildScript index 25629b0..a4c390d 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -1,522 +1,564 @@ -# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python: +# vim: set sts=2 ts=2 sw=2 tw=99 et ft=python: import os, sys class SDK(object): - def __init__(self, sdk, ext, aDef, name, platform, dir): - self.folder = 'hl2sdk-' + dir - self.envvar = sdk - self.ext = ext - self.code = aDef - self.define = name - self.name = dir - self.path = None # Actual path - self.platformSpec = platform - - # By default, nothing supports x64. - if type(platform) is list: - self.platformSpec = {p: ['x86'] for p in platform} - else: - self.platformSpec = platform - - def shouldBuild(self, targets): - for cxx in targets: - if cxx.target.platform in self.platformSpec: - if cxx.target.arch in self.platformSpec[cxx.target.platform]: - return True - return False + def __init__(self, sdk, ext, aDef, name, platform, dir): + self.folder = 'hl2sdk-' + dir + self.envvar = sdk + self.ext = ext + self.code = aDef + self.define = name + self.name = dir + self.path = None # Actual path + self.platformSpec = platform + + # By default, nothing supports x64. + if type(platform) is list: + self.platformSpec = {p: ['x86'] for p in platform} + else: + self.platformSpec = platform + + def shouldBuild(self, targets): + for cxx in targets: + if cxx.target.platform in self.platformSpec: + if cxx.target.arch in self.platformSpec[cxx.target.platform]: + return True + return False WinOnly = ['windows'] WinLinux = ['windows', 'linux'] WinLinuxMac = ['windows', 'linux', 'mac'] +Blade = { + 'windows': ['x86', 'x86_64'], + 'linux': ['x86_64'], + 'mac': ['x86_64'] +} CSGO = { - 'windows': ['x86'], - 'linux': ['x86', 'x86_64'], - 'mac': ['x86_64'] + 'windows': ['x86'], + 'linux': ['x86', 'x86_64'], + 'mac': ['x86_64'] } Source2 = { - 'windows': ['x86', 'x86_64'], - 'linux': ['x86_64'], + 'windows': ['x86', 'x86_64'], + 'linux': ['x86_64'], } Insurgency = { - 'windows': ['x86', 'x86_64'], - 'linux': ['x86'], - 'mac': ['x86', 'x86_64'], + 'windows': ['x86', 'x86_64'], + 'linux': ['x86'], + 'mac': ['x86', 'x86_64'], +} +Mock = { + 'windows': ['x86', 'x86_64'], + 'linux': ['x86', 'x86_64'], + 'mac': ['x86_64'] +} +SDK2013 = { + 'windows': ['x86', 'x86_64'], + 'linux': ['x86', 'x86_64'], } PossibleSDKs = { - 'episode1': SDK('HL2SDK', '14.ep1', '1', 'EPISODEONE', WinLinux, 'episode1'), - 'ep2': SDK('HL2SDKOB', '16.ep2', '3', 'ORANGEBOX', WinLinux, 'orangebox'), - 'css': SDK('HL2SDKCSS', '16.css', '6', 'CSS', WinLinuxMac, 'css'), - 'hl2dm': SDK('HL2SDKHL2DM', '16.hl2dm', '7', 'HL2DM', WinLinuxMac, 'hl2dm'), - 'dods': SDK('HL2SDKDODS', '16.dods', '8', 'DODS', WinLinuxMac, 'dods'), - 'sdk2013': SDK('HL2SDK2013', '16.sdk2013', '9', 'SDK2013', WinLinuxMac, 'sdk2013'), - 'tf2': SDK('HL2SDKTF2', '16.tf2', '11', 'TF2', WinLinuxMac, 'tf2'), - 'l4d': SDK('HL2SDKL4D', '16.l4d', '12', 'LEFT4DEAD', WinLinuxMac, 'l4d'), - 'nucleardawn': SDK('HL2SDKND', '16.nd', '13', 'NUCLEARDAWN', WinLinuxMac, 'nucleardawn'), - 'l4d2': SDK('HL2SDKL4D2', '16.l4d2', '15', 'LEFT4DEAD2', WinLinuxMac, 'l4d2'), - 'darkm': SDK('HL2SDK-DARKM', '16.darkm', '2', 'DARKMESSIAH', WinOnly, 'darkm'), - 'swarm': SDK('HL2SDK-SWARM', '16.swarm', '16', 'ALIENSWARM', WinOnly, 'swarm'), - 'bgt': SDK('HL2SDK-BGT', '16.bgt', '4', 'BLOODYGOODTIME', WinOnly, 'bgt'), - 'csgo': SDK('HL2SDKCSGO', '16.csgo', '21', 'CSGO', CSGO, 'csgo'), - 'insurgency': SDK('HL2SDKINSURGENCY', '16.ins', '19', 'INSURGENCY', Insurgency, 'insurgency'), - 'bms': SDK('HL2SDKBMS', '16.bms', '10', 'BMS', WinLinux, 'bms'), + 'episode1': SDK('HL2SDK', '2.ep1', '1', 'EPISODEONE', WinLinux, 'episode1'), + 'ep2': SDK('HL2SDKOB', '2.ep2', '3', 'ORANGEBOX', WinLinux, 'orangebox'), + 'css': SDK('HL2SDKCSS', '2.css', '6', 'CSS', SDK2013, 'css'), + 'hl2dm': SDK('HL2SDKHL2DM', '2.hl2dm', '7', 'HL2DM', SDK2013, 'hl2dm'), + 'dods': SDK('HL2SDKDODS', '2.dods', '8', 'DODS', SDK2013, 'dods'), + 'sdk2013': SDK('HL2SDK2013', '2.sdk2013', '9', 'SDK2013', WinLinuxMac, 'sdk2013'), + 'tf2': SDK('HL2SDKTF2', '2.tf2', '12', 'TF2', SDK2013, 'tf2'), + 'l4d': SDK('HL2SDKL4D', '2.l4d', '13', 'LEFT4DEAD', WinLinuxMac, 'l4d'), + 'nucleardawn': SDK('HL2SDKND', '2.nd', '14', 'NUCLEARDAWN', WinLinuxMac, 'nucleardawn'), + 'l4d2': SDK('HL2SDKL4D2', '2.l4d2', '16', 'LEFT4DEAD2', WinLinuxMac, 'l4d2'), + 'darkm': SDK('HL2SDK-DARKM', '2.darkm', '2', 'DARKMESSIAH', WinOnly, 'darkm'), + 'swarm': SDK('HL2SDK-SWARM', '2.swarm', '17', 'ALIENSWARM', WinOnly, 'swarm'), + 'bgt': SDK('HL2SDK-BGT', '2.bgt', '4', 'BLOODYGOODTIME', WinOnly, 'bgt'), + 'eye': SDK('HL2SDK-EYE', '2.eye', '5', 'EYE', WinOnly, 'eye'), + 'csgo': SDK('HL2SDKCSGO', '2.csgo', '22', 'CSGO', CSGO, 'csgo'), + 'portal2': SDK('HL2SDKPORTAL2', '2.portal2', '18', 'PORTAL2', [], 'portal2'), + 'blade': SDK('HL2SDKBLADE', '2.blade', '19', 'BLADE', Blade, 'blade'), + 'insurgency': SDK('HL2SDKINSURGENCY', '2.insurgency', '20', 'INSURGENCY', WinLinuxMac, 'insurgency'), + 'contagion': SDK('HL2SDKCONTAGION', '2.contagion', '15', 'CONTAGION', WinOnly, 'contagion'), + 'bms': SDK('HL2SDKBMS', '2.bms', '11', 'BMS', WinLinux, 'bms'), + 'doi': SDK('HL2SDKDOI', '2.doi', '21', 'DOI', WinLinuxMac, 'doi'), + 'mock': SDK('HL2SDK-MOCK', '2.mock', '999', 'MOCK', Mock, 'mock'), + 'pvkii': SDK('HL2SDKPVKII', '2.pvkii', '10', 'PVKII', WinLinux, 'pvkii'), } + def ResolveEnvPath(env, folder): - if env in os.environ: - path = os.environ[env] - if os.path.isdir(path): - return path - else: - head = os.getcwd() - oldhead = None - while head != None and head != oldhead: - path = os.path.join(head, folder) - if os.path.isdir(path): - return path - oldhead = head - head, tail = os.path.split(head) - return None + if env in os.environ: + path = os.environ[env] + if os.path.isdir(path): + return path + else: + head = os.getcwd() + oldhead = None + while head != None and head != oldhead: + path = os.path.join(head, folder) + if os.path.isdir(path): + return path + oldhead = head + head, tail = os.path.split(head) + return None def Normalize(path): - return os.path.abspath(os.path.normpath(path)) + return os.path.abspath(os.path.normpath(path)) class MMSConfig(object): - def __init__(self): - self.sdks = {} - self.binaries = [] - self.generated_headers = None - self.mms_root = None - self.all_targets = [] - self.target_archs = set() - - if builder.options.targets: - target_archs = builder.options.targets.split(',') - else: - target_archs = ['x86'] - if builder.backend == 'amb2': - target_archs.append('x86_64') - - for arch in target_archs: - try: - cxx = builder.DetectCxx(target_arch = arch) - self.target_archs.add(cxx.target.arch) - except Exception as e: - # Error if archs were manually overridden. - if builder.options.targets: - raise - print('Skipping target {}: {}'.format(arch, e)) - continue - self.all_targets.append(cxx) - - if not self.all_targets: - raise Exception('No suitable C/C++ compiler was found.') - - def detectProductVersion(self): - builder.AddConfigureFile('product.version') - - # For OS X dylib versioning - import re - with open(os.path.join(builder.sourcePath, 'product.version'), 'r') as fp: - productContents = fp.read() - m = re.match('(\d+)\.(\d+)\.(\d+).*', productContents) - if m == None: - self.productVersion = '1.0.0' - else: - major, minor, release = m.groups() - self.productVersion = '{0}.{1}.{2}'.format(major, minor, release) - - def detectSDKs(self): - sdk_list = builder.options.sdks.split(',') - use_all = sdk_list[0] == 'all' - use_present = sdk_list[0] == 'present' - if sdk_list[0] == '': - sdk_list = [] - - not_found = [] - for sdk_name in PossibleSDKs: - sdk = PossibleSDKs[sdk_name] - if sdk.shouldBuild(self.all_targets): - if builder.options.hl2sdk_root: - sdk_path = os.path.join(builder.options.hl2sdk_root, sdk.folder) - if not os.path.exists(sdk_path): - sdk_path = None - else: - sdk_path = ResolveEnvPath(sdk.envvar, sdk.folder) - if sdk_path is None: - if (use_all) or sdk_name in sdk_list: - raise Exception('Could not find a valid path for {0}'.format(sdk.envvar)) - not_found.append(sdk_name) - continue - if use_all or use_present or sdk_name in sdk_list: - sdk.path = sdk_path - self.sdks[sdk_name] = sdk - - if len(self.sdks) < 1 and len(sdk_list): - raise Exception('No SDKs were found, nothing to build.') - - if builder.options.mms_path: - self.mms_root = builder.options.mms_path - else: - self.mms_root = ResolveEnvPath('MMSOURCE111', 'mmsource-1.11') - if not self.mms_root: - self.mms_root = ResolveEnvPath('MMSOURCE110', 'mmsource-1.10') - if not self.mms_root: - self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'metamod-source') - if not self.mms_root: - self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'mmsource-central') - - if not self.mms_root or not os.path.isdir(self.mms_root): - raise Exception('Could not find a source copy of Metamod:Source') - self.mms_root = Normalize(self.mms_root) - - if use_present: - for sdk in not_found: - print('Warning: hl2sdk-{} was not found, and will not be included in build.'.format(sdk)) - - def configure(self): - builder.AddConfigureFile('pushbuild.txt') - - for cxx in self.all_targets: - if cxx.target.arch not in ['x86', 'x86_64']: - raise Exception('Unknown target architecture: {0}'.format(arch)) - - self.configure_cxx(cxx) - - def configure_cxx(self, cxx): - if cxx.behavior == 'gcc': - cxx.defines += [ - 'stricmp=strcasecmp', - '_stricmp=strcasecmp', - '_snprintf=snprintf', - '_vsnprintf=vsnprintf', - 'HAVE_STDINT_H', - 'GNUC', - ] - cxx.cflags += [ - '-pipe', - '-fno-strict-aliasing', - '-Wall', - '-Werror', - '-Wno-uninitialized', - '-Wno-unused', - '-Wno-switch', - '-msse', - '-fPIC', - ] - - if cxx.version == 'apple-clang-6.0' or cxx.version == 'clang-3.4': - cxx.cxxflags += ['-std=c++1y'] - else: - cxx.cxxflags += ['-std=c++14'] - if (cxx.version >= 'gcc-4.0') or cxx.family == 'clang': - cxx.cflags += ['-fvisibility=hidden'] - cxx.cxxflags += ['-fvisibility-inlines-hidden'] - cxx.cxxflags += [ - '-fno-exceptions', - '-fno-rtti', - '-fno-threadsafe-statics', - '-Wno-non-virtual-dtor', - '-Wno-overloaded-virtual', - ] - if (cxx.version >= 'gcc-4.7' or cxx.family == 'clang'): - cxx.cxxflags += ['-Wno-delete-non-virtual-dtor'] - if cxx.family == 'gcc': - cxx.cflags += ['-mfpmath=sse'] - if cxx.family == 'clang': - cxx.cxxflags += ['-Wno-implicit-exception-spec-mismatch'] - if cxx.version >= 'clang-3.9' or cxx.version >= 'apple-clang-10.0': - cxx.cxxflags += ['-Wno-expansion-to-defined'] - if cxx.version >= 'clang-3.6' or cxx.version >= 'apple-clang-7.0': - cxx.cxxflags += ['-Wno-inconsistent-missing-override'] - if cxx.version >= 'apple-clang-5.1' or cxx.version >= 'clang-3.4': - cxx.cxxflags += ['-Wno-deprecated-register'] - else: - cxx.cxxflags += ['-Wno-deprecated'] - - # Work around SDK warnings. - if cxx.version >= 'clang-10.0' or cxx.version >= 'apple-clang-12.0': - cxx.cflags += [ - '-Wno-implicit-int-float-conversion', - '-Wno-tautological-overlap-compare', - ] - - elif cxx.like('msvc'): - if builder.options.debug == '1': - cxx.cflags += ['/MTd'] - cxx.linkflags += ['/NODEFAULTLIB:libcmt'] - else: - cxx.cflags += ['/MT'] - cxx.defines += [ - '_CRT_SECURE_NO_DEPRECATE', - '_CRT_SECURE_NO_WARNINGS', - '_CRT_NONSTDC_NO_DEPRECATE', - ] - cxx.cflags += [ - '/W3', - '/Zi', - ] - cxx.cxxflags += ['/TP'] - - cxx.linkflags += [ - '/SUBSYSTEM:WINDOWS', - 'kernel32.lib', - 'user32.lib', - 'gdi32.lib', - 'winspool.lib', - 'comdlg32.lib', - 'advapi32.lib', - 'shell32.lib', - 'ole32.lib', - 'oleaut32.lib', - 'uuid.lib', - 'odbc32.lib', - 'odbccp32.lib', - ] - - # Optimization - if builder.options.opt == '1': - cxx.defines += ['NDEBUG'] - if cxx.behavior == 'gcc': - cxx.cflags += ['-O3'] - elif cxx.behavior == 'msvc': - cxx.cflags += ['/Ox', '/Zo'] - cxx.linkflags += ['/OPT:ICF', '/OPT:REF'] - - # Debugging - if builder.options.debug == '1': - cxx.defines += ['DEBUG', '_DEBUG'] - if cxx.behavior == 'gcc': - cxx.cflags += ['-g3'] - elif cxx.behavior == 'msvc': - cxx.cflags += ['/Od', '/RTC1'] - - # Don't omit the frame pointer. - # This needs to be after our optimization flags which could otherwise disable it. - if cxx.behavior == 'gcc': - cxx.cflags += ['-fno-omit-frame-pointer'] - elif cxx.behavior == 'msvc': - cxx.cflags += ['/Oy-'] - - # Platform-specifics - if cxx.target.platform == 'linux': - cxx.defines += ['_LINUX', 'POSIX', '_FILE_OFFSET_BITS=64'] - if cxx.family == 'gcc': - cxx.linkflags += ['-static-libgcc'] - elif cxx.family == 'clang': - cxx.linkflags += ['-lgcc_eh'] - elif cxx.target.platform == 'mac': - cxx.defines += ['OSX', '_OSX', 'POSIX'] - - if cxx.version >= 'apple-clang-10.0': - cxx.cflags += ['-mmacosx-version-min=10.9', '-stdlib=libc++'] - cxx.linkflags += [ - '-mmacosx-version-min=10.9', - ] - else: - cxx.cflags += ['-mmacosx-version-min=10.5'] - cxx.linkflags += [ - '-mmacosx-version-min=10.5', - ] - - cxx.linkflags += [ - '-lc++', - ] - elif cxx.target.platform == 'windows': - cxx.defines += ['WIN32', '_WINDOWS'] - - cxx.defines += ['STRIPPER_GENERATED_BUILD'] - cxx.includes += [ - os.path.join(builder.buildPath, 'includes'), - ] - - def HL2Compiler(self, context, cxx, sdk): - compiler = cxx.clone() - mms_core_path = os.path.join(self.mms_root, 'core') - - compiler.cxxincludes += [ - os.path.join(mms_core_path), - os.path.join(mms_core_path, 'sourcehook'), - os.path.join(context.currentSourcePath), - ] - - defines = ['SE_' + PossibleSDKs[i].define + '=' + PossibleSDKs[i].code for i in PossibleSDKs] - compiler.defines += defines - paths = [['public'], - ['public', 'engine'], - ['public', 'mathlib'], - ['public', 'vstdlib'], - ['public', 'tier0'], ['public', 'tier1']] - if sdk.name == 'episode1' or sdk.name == 'darkm': - paths.append(['public', 'dlls']) - paths.append(['game_shared']) - else: - paths.append(['public', 'game', 'server']) - paths.append(['game', 'shared']) - paths.append(['common']) - - compiler.defines += ['SOURCE_ENGINE=' + sdk.code] - - if sdk.name in ['sdk2013', 'bms'] and compiler.like('gcc'): - # The 2013 SDK already has these in public/tier0/basetypes.h - compiler.defines.remove('stricmp=strcasecmp') - compiler.defines.remove('_stricmp=strcasecmp') - compiler.defines.remove('_snprintf=snprintf') - compiler.defines.remove('_vsnprintf=vsnprintf') - - if compiler.family == 'msvc': - compiler.defines += ['COMPILER_MSVC'] - if compiler.target.arch == 'x86': - compiler.defines += ['COMPILER_MSVC32'] - elif compiler.target.arch == 'x86_64': - compiler.defines += ['COMPILER_MSVC64'] - - if compiler.version >= 1900: - compiler.linkflags += ['legacy_stdio_definitions.lib'] - else: - compiler.defines += ['COMPILER_GCC'] - - if compiler.target.arch == 'x86_64': - compiler.defines += ['X64BITS', 'PLATFORM_64BITS'] - - if sdk.name in ['css', 'hl2dm', 'dods', 'sdk2013', 'bms', 'tf2', 'l4d', 'nucleardawn', 'l4d2']: - if compiler.target.platform in ['linux', 'mac']: - compiler.defines += ['NO_HOOK_MALLOC', 'NO_MALLOC_OVERRIDE'] - - if sdk.name in ['csgo'] and compiler.target.platform == 'linux': - compiler.linkflags += ['-lstdc++'] - - for path in paths: - compiler.cxxincludes += [os.path.join(sdk.path, *path)] - - return compiler - - def AddVersioning(self, binary): - if binary.compiler.target.platform == 'windows': - binary.sources += ['version.rc'] - binary.compiler.rcdefines += [ - 'BINARY_NAME="{0}"'.format(binary.outputFile), - 'RC_COMPILE' - ] - elif binary.compiler.target.platform == 'mac' and binary.type == 'library': - binary.compiler.postlink += [ - '-compatibility_version', '1.0.0', - '-current_version', self.productVersion - ] - - binary.compiler.sourcedeps += MMS.generated_headers - return binary - - def Library(self, cxx, name): - binary = cxx.Library(name) - self.AddVersioning(binary) - return binary - - def HL2Library(self, context, compiler, name, sdk): - compiler = self.HL2Compiler(context, compiler, sdk) - - if compiler.target.platform == 'linux': - if sdk.name == 'episode1': - lib_folder = os.path.join(sdk.path, 'linux_sdk') - elif sdk.name in ['sdk2013', 'bms']: - lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux32') - elif compiler.target.arch == 'x86_64': - lib_folder = os.path.join(sdk.path, 'lib', 'linux64') - else: - lib_folder = os.path.join(sdk.path, 'lib', 'linux') - elif compiler.target.platform == 'mac': - if sdk.name in ['sdk2013', 'bms']: - lib_folder = os.path.join(sdk.path, 'lib', 'public', 'osx32') - elif compiler.target.arch == 'x86_64': - lib_folder = os.path.join(sdk.path, 'lib', 'osx64') - else: - lib_folder = os.path.join(sdk.path, 'lib', 'mac') - - if compiler.target.platform in ['linux', 'mac']: - if sdk.name in ['sdk2013', 'bms'] or compiler.target.arch == 'x86_64': - tier1 = os.path.join(lib_folder, 'tier1.a') - else: - tier1 = os.path.join(lib_folder, 'tier1_i486.a') - compiler.postlink += [tier1] - - if sdk.name in ['insurgency', 'csgo']: - if compiler.target.arch == 'x86_64': - compiler.postlink += [os.path.join(lib_folder, 'interfaces.a')] - else: - compiler.postlink += [os.path.join(lib_folder, 'interfaces_i486.a')] - - if sdk.name == 'bms': - compiler.postlink += [os.path.join(lib_folder, 'mathlib.a')] - - binary = self.Library(compiler, name) - compiler = binary.compiler - - dynamic_libs = [] - if compiler.target.platform == 'linux': - compiler.linkflags[0:0] = ['-lm'] - if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'bms', 'nucleardawn', 'l4d2', 'insurgency']: - dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so'] - elif compiler.target.arch == 'x86_64' and sdk.name in ['csgo']: - dynamic_libs = ['libtier0_client.so', 'libvstdlib_client.so'] - elif sdk.name in ['l4d', 'insurgency', 'csgo']: - dynamic_libs = ['libtier0.so', 'libvstdlib.so'] - else: - dynamic_libs = ['tier0_i486.so', 'vstdlib_i486.so'] - if sdk.name in ['csgo']: - compiler.defines += ['_GLIBCXX_USE_CXX11_ABI=0'] - elif compiler.target.platform == 'mac': - binary.compiler.linkflags.append('-liconv') - dynamic_libs = ['libtier0.dylib', 'libvstdlib.dylib'] - elif compiler.target.platform == 'windows': - libs = ['tier0', 'tier1', 'vstdlib'] - if sdk.name in ['swarm', 'insurgency', 'csgo']: - libs.append('interfaces') - if sdk.name == 'bms': - libs.append('mathlib') - for lib in libs: - if compiler.target.arch == 'x86': - lib_path = os.path.join(sdk.path, 'lib', 'public', lib) + '.lib' - elif compiler.target.arch == 'x86_64': - lib_path = os.path.join(sdk.path, 'lib', 'public', 'win64', lib) + '.lib' - binary.compiler.linkflags.append(lib_path) - - for library in dynamic_libs: - source_path = os.path.join(lib_folder, library) - output_path = os.path.join(binary.localFolder, library) - - context.AddFolder(binary.localFolder) - output = context.AddSymlink(source_path, output_path) - - binary.compiler.weaklinkdeps += [output] - binary.compiler.linkflags[0:0] = [library] - - return binary + def __init__(self): + self.sdks = {} + self.binaries = [] + self.generated_headers = None + self.mms_root = None + self.all_targets = [] + self.target_archs = set() + + if builder.options.targets: + target_archs = builder.options.targets.split(',') + else: + target_archs = ['x86'] + if builder.backend == 'amb2': + target_archs.append('x86_64') + + for arch in target_archs: + try: + cxx = builder.DetectCxx(target_arch = arch) + self.target_archs.add(cxx.target.arch) + except Exception as e: + # Error if archs were manually overridden. + if builder.options.targets: + raise + print('Skipping target {}: {}'.format(arch, e)) + continue + self.all_targets.append(cxx) + + if not self.all_targets: + raise Exception('No suitable C/C++ compiler was found.') + + def detectProductVersion(self): + builder.AddConfigureFile('product.version') + + # For OS X dylib versioning + import re + with open(os.path.join(builder.sourcePath, 'product.version'), 'r') as fp: + productContents = fp.read() + m = re.match(r'(\d+)\.(\d+)\.(\d+).*', productContents) + if m == None: + self.productVersion = '1.0.0' + else: + major, minor, release = m.groups() + self.productVersion = '{0}.{1}.{2}'.format(major, minor, release) + + def detectSDKs(self): + sdk_list = builder.options.sdks.split(',') + use_all = sdk_list[0] == 'all' + use_present = sdk_list[0] == 'present' + if sdk_list[0] == '': + sdk_list = [] + + not_found = [] + for sdk_name in PossibleSDKs: + sdk = PossibleSDKs[sdk_name] + if sdk.shouldBuild(self.all_targets): + if builder.options.hl2sdk_root: + sdk_path = os.path.join(builder.options.hl2sdk_root, sdk.folder) + if not os.path.exists(sdk_path): + sdk_path = None + else: + sdk_path = ResolveEnvPath(sdk.envvar, sdk.folder) + if sdk_path is None: + if (use_all) or sdk_name in sdk_list: + raise Exception('Could not find a valid path for {0}'.format(sdk.envvar)) + not_found.append(sdk_name) + continue + if use_all or use_present or sdk_name in sdk_list: + sdk.path = sdk_path + self.sdks[sdk_name] = sdk + + if len(self.sdks) < 1 and len(sdk_list): + raise Exception('No SDKs were found, nothing to build.') + + if builder.options.mms_path: + self.mms_root = builder.options.mms_path + else: + self.mms_root = ResolveEnvPath('MMSOURCE111', 'mmsource-1.11') + if not self.mms_root: + self.mms_root = ResolveEnvPath('MMSOURCE110', 'mmsource-1.10') + if not self.mms_root: + self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'metamod-source') + if not self.mms_root: + self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'mmsource-central') + + if not self.mms_root or not os.path.isdir(self.mms_root): + raise Exception('Could not find a source copy of Metamod:Source') + self.mms_root = Normalize(self.mms_root) + + if use_present: + for sdk in not_found: + print('Warning: hl2sdk-{} was not found, and will not be included in build.'.format(sdk)) + + def configure(self): + builder.AddConfigureFile('pushbuild.txt') + + for cxx in self.all_targets: + if cxx.target.arch not in ['x86', 'x86_64']: + raise Exception('Unknown target architecture: {0}'.format(arch)) + + self.configure_cxx(cxx) + + def configure_cxx(self, cxx): + if cxx.behavior == 'gcc': + cxx.defines += [ + 'stricmp=strcasecmp', + '_stricmp=strcasecmp', + '_snprintf=snprintf', + '_vsnprintf=vsnprintf', + 'HAVE_STDINT_H', + 'GNUC', + ] + cxx.cflags += [ + '-pipe', + '-fno-strict-aliasing', + '-Wall', + '-Werror', + '-Wno-uninitialized', + '-Wno-sign-compare', + '-Wno-unused', + '-Wno-switch', + '-Wno-unknown-pragmas', + '-Wno-dangling-else', + '-msse', + '-fPIC', + ] + + if cxx.version == 'apple-clang-6.0' or cxx.version == 'clang-3.4': + cxx.cxxflags += ['-std=c++1y'] + else: + cxx.cxxflags += ['-std=c++14'] + if (cxx.version >= 'gcc-4.0') or cxx.family == 'clang': + cxx.cflags += ['-fvisibility=hidden'] + cxx.cxxflags += ['-fvisibility-inlines-hidden'] + cxx.cxxflags += [ + '-fno-exceptions', + '-fno-rtti', + '-fno-threadsafe-statics', + '-Wno-non-virtual-dtor', + '-Wno-overloaded-virtual', + ] + if (cxx.version >= 'gcc-4.7' or cxx.family == 'clang'): + cxx.cxxflags += ['-Wno-delete-non-virtual-dtor'] + if cxx.family == 'gcc': + cxx.cflags += ['-mfpmath=sse'] + if cxx.family == 'clang': + cxx.cxxflags += ['-Wno-implicit-exception-spec-mismatch'] + if cxx.version >= 'clang-3.9' or cxx.version >= 'apple-clang-10.0': + cxx.cxxflags += ['-Wno-expansion-to-defined'] + if cxx.version >= 'clang-3.6' or cxx.version >= 'apple-clang-7.0': + cxx.cxxflags += ['-Wno-inconsistent-missing-override'] + if cxx.version >= 'apple-clang-5.1' or cxx.version >= 'clang-3.4': + cxx.cxxflags += ['-Wno-deprecated-register'] + else: + cxx.cxxflags += ['-Wno-deprecated'] + + # Work around SDK warnings. + if cxx.version >= 'clang-10.0' or cxx.version >= 'apple-clang-12.0': + cxx.cflags += [ + '-Wno-implicit-int-float-conversion', + '-Wno-tautological-overlap-compare', + ] + + elif cxx.like('msvc'): + if builder.options.debug == '1': + cxx.cflags += ['/MTd'] + cxx.linkflags += ['/NODEFAULTLIB:libcmt'] + else: + cxx.cflags += ['/MT'] + cxx.defines += [ + '_CRT_SECURE_NO_DEPRECATE', + '_CRT_SECURE_NO_WARNINGS', + '_CRT_NONSTDC_NO_DEPRECATE', + ] + cxx.cflags += [ + '/W3', + '/Zi', + ] + cxx.cxxflags += ['/TP'] + + cxx.linkflags += [ + '/SUBSYSTEM:WINDOWS', + 'kernel32.lib', + 'user32.lib', + 'gdi32.lib', + 'winspool.lib', + 'comdlg32.lib', + 'advapi32.lib', + 'shell32.lib', + 'ole32.lib', + 'oleaut32.lib', + 'uuid.lib', + 'odbc32.lib', + 'odbccp32.lib', + ] + + # Optimization + if builder.options.opt == '1': + cxx.defines += ['NDEBUG'] + if cxx.behavior == 'gcc': + cxx.cflags += ['-O3'] + elif cxx.behavior == 'msvc': + cxx.cflags += ['/Ox', '/Zo'] + cxx.linkflags += ['/OPT:ICF', '/OPT:REF'] + + # Debugging + if builder.options.debug == '1': + cxx.defines += ['DEBUG', '_DEBUG'] + if cxx.behavior == 'gcc': + cxx.cflags += ['-g3'] + elif cxx.behavior == 'msvc': + cxx.cflags += ['/Od', '/RTC1'] + + # Don't omit the frame pointer. + # This needs to be after our optimization flags which could otherwise disable it. + if cxx.behavior == 'gcc': + cxx.cflags += ['-fno-omit-frame-pointer'] + elif cxx.behavior == 'msvc': + cxx.cflags += ['/Oy-'] + + # Platform-specifics + if cxx.target.platform == 'linux': + cxx.defines += ['LINUX', '_LINUX', 'POSIX', '_FILE_OFFSET_BITS=64'] + if cxx.family == 'gcc': + cxx.linkflags += ['-static-libgcc'] + elif cxx.family == 'clang': + cxx.linkflags += ['-lgcc_eh'] + elif cxx.target.platform == 'mac': + cxx.defines += ['OSX', '_OSX', 'POSIX'] + + if cxx.version >= 'apple-clang-10.0': + cxx.cflags += ['-mmacosx-version-min=10.9', '-stdlib=libc++'] + cxx.linkflags += [ + '-mmacosx-version-min=10.9', + ] + else: + cxx.cflags += ['-mmacosx-version-min=10.5'] + cxx.linkflags += [ + '-mmacosx-version-min=10.5', + ] + + cxx.linkflags += [ + '-lc++', + ] + elif cxx.target.platform == 'windows': + cxx.defines += ['WIN32', '_WINDOWS'] + + cxx.defines += ['STRIPPER_GENERATED_BUILD'] + cxx.includes += [ + os.path.join(builder.buildPath, 'includes'), + ] + + def HL2Compiler(self, context, cxx, sdk): + compiler = cxx.clone() + mms_core_path = os.path.join(self.mms_root, 'core') + + compiler.cxxincludes += [ + os.path.join(mms_core_path), + os.path.join(mms_core_path, 'sourcehook'), + os.path.join(context.currentSourcePath), + ] + + defines = ['SE_' + PossibleSDKs[i].define + '=' + PossibleSDKs[i].code for i in PossibleSDKs] + compiler.defines += defines + paths = [['public'], + ['public', 'engine'], + ['public', 'mathlib'], + ['public', 'vstdlib'], + ['public', 'tier0'], ['public', 'tier1']] + if sdk.name == 'episode1' or sdk.name == 'darkm': + paths.append(['public', 'dlls']) + paths.append(['game_shared']) + else: + paths.append(['public', 'game', 'server']) + paths.append(['game', 'shared']) + paths.append(['common']) + + compiler.defines += ['SOURCE_ENGINE=' + sdk.code] + + if sdk.name in ['sdk2013', 'bms', 'tf2', 'css', 'dods', 'hl2dm'] and compiler.like('gcc'): + # The 2013 SDK already has these in public/tier0/basetypes.h + compiler.defines.remove('stricmp=strcasecmp') + compiler.defines.remove('_stricmp=strcasecmp') + compiler.defines.remove('_snprintf=snprintf') + compiler.defines.remove('_vsnprintf=vsnprintf') + + if compiler.family == 'msvc': + compiler.defines += ['COMPILER_MSVC'] + if compiler.target.arch == 'x86': + compiler.defines += ['COMPILER_MSVC32'] + elif compiler.target.arch == 'x86_64': + compiler.defines += ['COMPILER_MSVC64'] + + if compiler.version >= 1900: + compiler.linkflags += ['legacy_stdio_definitions.lib'] + else: + compiler.defines += ['COMPILER_GCC'] + + if compiler.target.arch == 'x86_64': + compiler.defines += ['X64BITS', 'PLATFORM_64BITS'] + + if sdk.name in ['css', 'hl2dm', 'dods', 'sdk2013', 'bms', 'tf2', 'l4d', 'nucleardawn', 'l4d2']: + if compiler.target.platform in ['linux', 'mac']: + compiler.defines += ['NO_HOOK_MALLOC', 'NO_MALLOC_OVERRIDE'] + + if sdk.name in ['csgo'] and compiler.target.platform == 'linux': + compiler.linkflags += ['-lstdc++'] + + for path in paths: + compiler.cxxincludes += [os.path.join(sdk.path, *path)] + + return compiler + + def AddVersioning(self, binary): + if binary.compiler.target.platform == 'windows': + binary.sources += ['version.rc'] + binary.compiler.rcdefines += [ + 'BINARY_NAME="{0}"'.format(binary.outputFile), + 'RC_COMPILE' + ] + elif binary.compiler.target.platform == 'mac' and binary.type == 'library': + binary.compiler.postlink += [ + '-compatibility_version', '1.0.0', + '-current_version', self.productVersion + ] + + binary.compiler.sourcedeps += MMS.generated_headers + return binary + + def Library(self, cxx, name): + binary = cxx.Library(name) + self.AddVersioning(binary) + return binary + + def StaticLibrary(self, context, compiler, name): + compiler = compiler.clone() + return compiler.StaticLibrary(name) + + def HL2Library(self, context, compiler, name, sdk): + compiler = self.HL2Compiler(context, compiler, sdk) + + if compiler.target.platform == 'linux': + if sdk.name == 'episode1': + lib_folder = os.path.join(sdk.path, 'linux_sdk') + elif sdk.name in ['sdk2013', 'bms']: + lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux32') + elif sdk.name in ['css', 'hl2dm', 'dods', 'tf2']: + if compiler.target.arch == 'x86_64': + lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux64') + else: + lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux') + elif compiler.target.arch == 'x86_64': + lib_folder = os.path.join(sdk.path, 'lib', 'linux64') + else: + lib_folder = os.path.join(sdk.path, 'lib', 'linux') + elif compiler.target.platform == 'mac': + if sdk.name in ['sdk2013', 'bms']: + lib_folder = os.path.join(sdk.path, 'lib', 'public', 'osx32') + elif compiler.target.arch == 'x86_64': + lib_folder = os.path.join(sdk.path, 'lib', 'osx64') + else: + lib_folder = os.path.join(sdk.path, 'lib', 'mac') + + if compiler.target.platform in ['linux', 'mac']: + if sdk.name in ['sdk2013', 'bms'] or compiler.target.arch == 'x86_64': + tier1 = os.path.join(lib_folder, 'tier1.a') + else: + tier1 = os.path.join(lib_folder, 'tier1_i486.a') + compiler.postlink += [tier1] + + if sdk.name in ['insurgency', 'csgo']: + if compiler.target.arch == 'x86_64': + compiler.postlink += [os.path.join(lib_folder, 'interfaces.a')] + else: + compiler.postlink += [os.path.join(lib_folder, 'interfaces_i486.a')] + + if sdk.name == 'bms': + compiler.postlink += [os.path.join(lib_folder, 'mathlib.a')] + + binary = self.Library(compiler, name) + compiler = binary.compiler + + dynamic_libs = [] + if compiler.target.platform == 'linux': + compiler.linkflags[0:0] = ['-lm'] + if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'bms', 'nucleardawn', 'l4d2', 'insurgency']: + dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so'] + elif compiler.target.arch == 'x86_64' and sdk.name in ['csgo']: + dynamic_libs = ['libtier0_client.so', 'libvstdlib_client.so'] + elif sdk.name in ['l4d', 'insurgency', 'csgo']: + dynamic_libs = ['libtier0.so', 'libvstdlib.so'] + else: + dynamic_libs = ['tier0_i486.so', 'vstdlib_i486.so'] + if sdk.name in ['csgo']: + compiler.defines += ['_GLIBCXX_USE_CXX11_ABI=0'] + elif compiler.target.platform == 'mac': + binary.compiler.linkflags.append('-liconv') + dynamic_libs = ['libtier0.dylib', 'libvstdlib.dylib'] + elif compiler.target.platform == 'windows': + libs = ['tier0', 'tier1', 'vstdlib'] + if sdk.name in ['swarm', 'insurgency', 'csgo']: + libs.append('interfaces') + if sdk.name == 'bms': + libs.append('mathlib') + for lib in libs: + if compiler.target.arch == 'x86': + if sdk.name in ['css', 'hl2dm', 'dods', 'tf2']: + lib_path = os.path.join(sdk.path, 'lib', 'public', 'x86', lib) + '.lib' + else: + lib_path = os.path.join(sdk.path, 'lib', 'public', lib) + '.lib' + elif compiler.target.arch == 'x86_64': + if sdk.name in ['css', 'hl2dm', 'dods', 'tf2']: + lib_path = os.path.join(sdk.path, 'lib', 'public', 'x64', lib) + '.lib' + else: + lib_path = os.path.join(sdk.path, 'lib', 'public', 'win64', lib) + '.lib' + binary.compiler.linkflags.append(lib_path) + + for library in dynamic_libs: + source_path = os.path.join(lib_folder, library) + output_path = os.path.join(binary.localFolder, library) + + context.AddFolder(binary.localFolder) + output = context.AddSymlink(source_path, output_path) + + binary.compiler.weaklinkdeps += [output] + binary.compiler.linkflags[0:0] = [library] + + return binary if getattr(builder, 'target', None) is not None: - sys.stderr.write("Your output folder was configured for AMBuild 2.1, and stripper-source\n") - sys.stderr.write("is now configured to use AMBuild 2.2. Please remove your output folder\n") - sys.stderr.write("and reconfigure to continue.\n") - os._exit(1) + sys.stderr.write("Your output folder was configured for AMBuild 2.1, and stripper-source\n") + sys.stderr.write("is now configured to use AMBuild 2.2. Please remove your output folder\n") + sys.stderr.write("and reconfigure to continue.\n") + os._exit(1) MMS = MMSConfig() MMS.detectProductVersion() MMS.detectSDKs() MMS.configure() +builder.targets = builder.CloneableList(MMS.all_targets) + MMS.generated_headers = builder.Build( - 'buildbot/Versioning', - { 'MMS': MMS } - ) + 'buildbot/Versioning', + { 'MMS': MMS } + ) BuildScripts = [ - 'AMBuilder', - 'gameshim/AMBuilder', - 'loader/AMBuilder', + 'AMBuilder', + 'gameshim/AMBuilder', + 'loader/AMBuilder', ] if builder.backend == 'amb2': - BuildScripts += [ - 'PackageScript', - ] + BuildScripts += [ + 'PackageScript', + ] builder.Build(BuildScripts, { 'MMS': MMS }) diff --git a/AMBuilder b/AMBuilder index fa58d6b..75e754a 100644 --- a/AMBuilder +++ b/AMBuilder @@ -1,25 +1,20 @@ -# vim: set ts=2 sw=2 tw=99 noet ft=python: +# vim: set sts=2 ts=2 sw=2 tw=99 et ft=python: import os.path name = 'stripper.core' -for cxx in MMS.all_targets: +libpcre = builder.Build('pcre/AMBuilder') - binary = MMS.Library(cxx, name) +for cxx in MMS.all_targets: + binary = MMS.Library(cxx, name) - binary.sources = [ - 'parser.cpp', - 'support.cpp' - ] - binary.compiler.cxxincludes += [os.path.join(MMS.mms_root, 'core', 'sourcehook')] + binary.sources = [ + 'parser.cpp', + 'support.cpp' + ] + binary.compiler.cxxincludes += [os.path.join(MMS.mms_root, 'core', 'sourcehook')] - if binary.compiler.target.arch == 'x86': - if cxx.target.platform == 'linux': - binary.compiler.postlink += [os.path.join(builder.sourcePath, 'pcre', 'libpcre-linux.a')] - elif cxx.target.platform == 'windows': - binary.compiler.postlink += [os.path.join(builder.sourcePath, 'pcre', 'libpcre-windows.lib')] - elif cxx.target.platform == 'mac': - binary.compiler.postlink += [os.path.join(builder.sourcePath, 'pcre', 'libpcre-darwin.a')] + binary.compiler.postlink += [libpcre[binary.compiler.target.arch].binary] - nodes = builder.Add(binary) - MMS.binaries += [nodes] \ No newline at end of file + nodes = builder.Add(binary) + MMS.binaries += [nodes] \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 9e4d4c1..0000000 --- a/Makefile +++ /dev/null @@ -1,142 +0,0 @@ -# (C)2004-2008 SourceMod Development Team -# Makefile written by David "BAILOPAN" Anderson -# - -MMSOURCE = ../mmsource-1.8/core - -##################################### -### EDIT BELOW FOR OTHER PROJECTS ### -##################################### - -PROJECT = stripper.core - -#Uncomment for Metamod: Source enabled extension -#USEMETA = true - -OBJECTS = parser.cpp support.cpp - -############################################## -### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ### -############################################## - -C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing -C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3 -C_GCC4_FLAGS = -fvisibility=hidden -CPP_GCC4_FLAGS = -fvisibility-inlines-hidden -CPP = gcc - -override ENGSET = false -ifeq "$(ENGINE)" "original" - HL2SDK = $(HL2SDK_ORIG) - HL2PUB = $(HL2SDK)/public - HL2LIB = $(HL2SDK)/linux_sdk - CFLAGS += -DSOURCE_ENGINE=1 - METAMOD = $(MMSOURCE17)/core-legacy - INCLUDE += -I$(HL2SDK)/public/dlls - SRCDS = $(SRCDS_BASE) - override ENGSET = true -endif -ifeq "$(ENGINE)" "orangebox" - HL2SDK = $(HL2SDK_OB) - HL2PUB = $(HL2SDK)/public - HL2LIB = $(HL2SDK)/lib/linux - CFLAGS += -DSOURCE_ENGINE=3 - METAMOD = $(MMSOURCE17)/core - INCLUDE += -I$(HL2SDK)/public/game/server - SRCDS = $(SRCDS_BASE)/orangebox - override ENGSET = true -endif -ifeq "$(ENGINE)" "left4dead" - HL2SDK = $(HL2SDK_L4D) - HL2PUB = $(HL2SDK)/public - HL2LIB = $(HL2SDK)/lib/linux - CFLAGS += -DSOURCE_ENGINE=4 - METAMOD = $(MMSOURCE17)/core - INCLUDE += -I$(HL2SDK)/public/game/server - SRCDS = $(SRCDS_BASE)/l4d - override ENGSET = true -endif - -ifeq "$(USEMETA)" "true" - LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so - - LINK += $(LINK_HL2) - - INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \ - -I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn - CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4 -else - INCLUDE += -I. -endif - -INCLUDE += -Ipcre -I$(MMSOURCE)/sourcehook - -LINK += -m32 -lm -ldl pcre/.libs/libpcre.a - -CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \ - -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \ - -Wno-unused -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H -m32 -CPPFLAGS += -Wno-non-virtual-dtor -fno-exceptions -fno-rtti - -################################################ -### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ### -################################################ - -ifeq "$(DEBUG)" "true" - BIN_DIR = Debug - CFLAGS += $(C_DEBUG_FLAGS) -else - BIN_DIR = Release - CFLAGS += $(C_OPT_FLAGS) -endif - -ifeq "$(USEMETA)" "true" - BIN_DIR := $(BIN_DIR).$(ENGINE) -endif - -OS := $(shell uname -s) -ifeq "$(OS)" "Darwin" - LINK += -dynamiclib - BINARY = $(PROJECT).dylib -else - LINK += -static-libgcc -shared - BINARY = $(PROJECT).so -endif - -GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1) -ifeq "$(GCC_VERSION)" "4" - CFLAGS += $(C_GCC4_FLAGS) - CPPFLAGS += $(CPP_GCC4_FLAGS) -endif - -OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o) - -$(BIN_DIR)/%.o: %.cpp - $(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< - -all: check - mkdir -p $(BIN_DIR)/sdk - if [ "$(USEMETA)" = "true" ]; then \ - ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so; \ - ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so; \ - fi - $(MAKE) -f Makefile extension - -check: - if [ "$(USEMETA)" = "true" ] && [ "$(ENGSET)" = "false" ]; then \ - echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \ - exit 1; \ - fi - -extension: check $(OBJ_LINUX) - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY) - -debug: - $(MAKE) -f Makefile all DEBUG=true - -default: all - -clean: check - rm -rf $(BIN_DIR)/*.o - rm -rf $(BIN_DIR)/sdk/*.o - rm -rf $(BIN_DIR)/$(BINARY) diff --git a/PackageScript b/PackageScript index 93a4ba5..f244a5d 100644 --- a/PackageScript +++ b/PackageScript @@ -1,4 +1,4 @@ -# vim: set ts=2 sw=2 tw=99 noet ft=python: +# vim: set sts=2 ts=2 sw=2 tw=99 et ft=python: import os builder.SetBuildFolder('package') @@ -11,13 +11,8 @@ dumps_folder = builder.AddFolder(os.path.join('addons', 'stripper', 'dumps')) maps_folder = builder.AddFolder(os.path.join('addons', 'stripper', 'maps')) for cxx in MMS.all_targets: - if cxx.target.arch == 'x86_64': - if cxx.target.platform == 'windows': - bin64_folder = builder.AddFolder(os.path.join('addons', 'stripper', 'bin', 'win64')) - elif cxx.target.platform == 'linux': - bin64_folder = builder.AddFolder(os.path.join('addons', 'stripper', 'bin', 'linux64')) - elif cxx.target.platform == 'mac': - bin64_folder = builder.AddFolder(os.path.join('addons', 'stripper', 'bin', 'osx64')) + if cxx.target.arch == 'x86_64': + bin64_folder = builder.AddFolder(os.path.join('addons', 'stripper', 'bin', 'x64')) builder.AddCopy(os.path.join(builder.sourcePath, 'stripper.vdf'), metamod_folder) builder.AddCopy(os.path.join(builder.sourcePath, 'global_filters.cfg'), stripper_folder) @@ -25,15 +20,15 @@ builder.AddCopy(os.path.join(builder.sourcePath, 'de_dust.cfg'), maps_folder) pdb_list = [] for task in MMS.binaries: - if task.target.arch == 'x86_64': - builder.AddCopy(task.binary, bin64_folder) - else: - builder.AddCopy(task.binary, bin_folder) + if task.target.arch == 'x86_64' and not 'stripper_mm' in task.binary.path: + builder.AddCopy(task.binary, bin64_folder) + else: + builder.AddCopy(task.binary, bin_folder) - if task.debug: - pdb_list.append(task.debug) + if task.debug: + pdb_list.append(task.debug) # Generate PDB info. with open(os.path.join(builder.buildPath, 'pdblog.txt'), 'wt') as fp: - for line in pdb_list: - fp.write(line.path + '\n') \ No newline at end of file + for line in pdb_list: + fp.write(line.path + '\n') \ No newline at end of file diff --git a/buildbot/Versioning b/buildbot/Versioning index 61d312c..8d0e558 100644 --- a/buildbot/Versioning +++ b/buildbot/Versioning @@ -1,45 +1,45 @@ -# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python: -import os, sys -import re - -builder.SetBuildFolder('/') - -includes = builder.AddFolder('includes') - -argv = [ - sys.executable, - os.path.join(builder.sourcePath, 'buildbot', 'generate_headers.py'), - os.path.join(builder.sourcePath), - os.path.join(builder.buildPath, 'includes') -] -outputs = [ - os.path.join(builder.buildFolder, 'includes', 'stripper_version_auto.h') -] - -with open(os.path.join(builder.sourcePath, '.git', 'HEAD')) as fp: - head_contents = fp.read().strip() - if re.search('^[a-fA-F0-9]{40}$', head_contents): - git_head_path = os.path.join(builder.sourcePath, '.git', 'HEAD') - else: - git_state = head_contents.split(':')[1].strip() - git_head_path = os.path.join(builder.sourcePath, '.git', git_state) - if not os.path.exists(git_head_path): - git_head_path = os.path.join(builder.sourcePath, '.git', 'HEAD') - -sources = [ - os.path.join(builder.sourcePath, 'product.version'), - - # This is a hack, but we need some way to only run this script when Git changes. - git_head_path, - - # The script source is a dependency, of course... - argv[1] -] - -output_nodes = builder.AddCommand( - inputs=sources, - argv=argv, - outputs=outputs -) - +# vim: set sts=2 ts=2 sw=2 tw=99 et ft=python: +import os, sys +import re + +builder.SetBuildFolder('/') + +includes = builder.AddFolder('includes') + +argv = [ + sys.executable, + os.path.join(builder.sourcePath, 'buildbot', 'generate_headers.py'), + os.path.join(builder.sourcePath), + os.path.join(builder.buildPath, 'includes') +] +outputs = [ + os.path.join(builder.buildFolder, 'includes', 'stripper_version_auto.h') +] + +with open(os.path.join(builder.sourcePath, '.git', 'HEAD')) as fp: + head_contents = fp.read().strip() + if re.search('^[a-fA-F0-9]{40}$', head_contents): + git_head_path = os.path.join(builder.sourcePath, '.git', 'HEAD') + else: + git_state = head_contents.split(':')[1].strip() + git_head_path = os.path.join(builder.sourcePath, '.git', git_state) + if not os.path.exists(git_head_path): + git_head_path = os.path.join(builder.sourcePath, '.git', 'HEAD') + +sources = [ + os.path.join(builder.sourcePath, 'product.version'), + + # This is a hack, but we need some way to only run this script when Git changes. + git_head_path, + + # The script source is a dependency, of course... + argv[1] +] + +output_nodes = builder.AddCommand( + inputs=sources, + argv=argv, + outputs=outputs +) + rvalue = output_nodes \ No newline at end of file diff --git a/buildbot/generate_headers.py b/buildbot/generate_headers.py index 9e95049..2982d2f 100644 --- a/buildbot/generate_headers.py +++ b/buildbot/generate_headers.py @@ -1,63 +1,64 @@ +# vim: set ts=2 sw=2 tw=99 et ft=python: import re import os, sys import subprocess argv = sys.argv[1:] if len(argv) < 2: - sys.stderr.write('Usage: generate_headers.py \n') - sys.exit(1) + sys.stderr.write('Usage: generate_headers.py \n') + sys.exit(1) SourceFolder = os.path.abspath(os.path.normpath(argv[0])) OutputFolder = os.path.normpath(argv[1]) class FolderChanger: - def __init__(self, folder): - self.old = os.getcwd() - self.new = folder + def __init__(self, folder): + self.old = os.getcwd() + self.new = folder - def __enter__(self): - if self.new: - os.chdir(self.new) + def __enter__(self): + if self.new: + os.chdir(self.new) - def __exit__(self, type, value, traceback): - os.chdir(self.old) + def __exit__(self, type, value, traceback): + os.chdir(self.old) def run_and_return(argv): - # Python 2.6 doesn't have check_output. - if hasattr(subprocess, 'check_output'): - text = subprocess.check_output(argv) - if str != bytes: - text = str(text, 'utf-8') - else: - p = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - output, ignored = p.communicate() - rval = p.poll() - if rval: - raise subprocess.CalledProcessError(rval, argv) - text = output.decode('utf8') - return text.strip() + # Python 2.6 doesn't have check_output. + if hasattr(subprocess, 'check_output'): + text = subprocess.check_output(argv) + if str != bytes: + text = str(text, 'utf-8') + else: + p = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output, ignored = p.communicate() + rval = p.poll() + if rval: + raise subprocess.CalledProcessError(rval, argv) + text = output.decode('utf8') + return text.strip() def get_git_version(): - revision_count = run_and_return(['git', 'rev-list', '--count', 'HEAD']) - revision_hash = run_and_return(['git', 'log', '--pretty=format:%h:%H', '-n', '1']) - shorthash, longhash = revision_hash.split(':') + revision_count = run_and_return(['git', 'rev-list', '--count', 'HEAD']) + revision_hash = run_and_return(['git', 'log', '--pretty=format:%h:%H', '-n', '1']) + shorthash, longhash = revision_hash.split(':') - return revision_count, shorthash, longhash + return revision_count, shorthash, longhash def output_version_header(): - with FolderChanger(SourceFolder): - count, shorthash, longhash = get_git_version() - - with open(os.path.join(SourceFolder, 'product.version')) as fp: - contents = fp.read() - m = re.match('(\d+)\.(\d+)\.(\d+)(.*)', contents) - if m == None: - raise Exception('Could not detremine product version') - major, minor, release, tag = m.groups() - product = "{0}.{1}.{2}".format(major, minor, release) + with FolderChanger(SourceFolder): + count, shorthash, longhash = get_git_version() - with open(os.path.join(OutputFolder, 'stripper_version_auto.h'), 'w') as fp: - fp.write(""" + with open(os.path.join(SourceFolder, 'product.version')) as fp: + contents = fp.read() + m = re.match(r'(\d+)\.(\d+)\.(\d+)(.*)', contents) + if m == None: + raise Exception('Could not detremine product version') + major, minor, release, tag = m.groups() + product = "{0}.{1}.{2}".format(major, minor, release) + + with open(os.path.join(OutputFolder, 'stripper_version_auto.h'), 'w') as fp: + fp.write(""" #ifndef _STRIPPER_AUTO_VERSION_INFORMATION_H_ #define _STRIPPER_AUTO_VERSION_INFORMATION_H_ @@ -67,6 +68,6 @@ def output_version_header(): #define STRIPPER_FILE_VERSION {3},{4},{5},0 #endif /* _STRIPPER_AUTO_VERSION_INFORMATION_H_ */ - """.format(tag, count, shorthash, major, minor, release)) + """.format(tag, count, shorthash, major, minor, release)) output_version_header() \ No newline at end of file diff --git a/configure.py b/configure.py index c819a99..d8a5710 100644 --- a/configure.py +++ b/configure.py @@ -1,4 +1,4 @@ -# vim: set sts=2 ts=8 sw=2 tw=99 et: +# vim: set sts=2 ts=2 sw=2 tw=99 et ft=python: import sys try: from ambuild2 import run, util diff --git a/gameshim/AMBuilder b/gameshim/AMBuilder index 2f1eac9..6d25de3 100644 --- a/gameshim/AMBuilder +++ b/gameshim/AMBuilder @@ -1,20 +1,20 @@ -# vim: set ts=2 sw=2 tw=99 noet ft=python: +# vim: set sts=2 ts=2 sw=2 tw=99 et ft=python: import os for sdk_name in MMS.sdks: - for cxx in MMS.all_targets: - sdk = MMS.sdks[sdk_name] + for cxx in MMS.all_targets: + sdk = MMS.sdks[sdk_name] - if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]: - continue - - name = 'stripper.' + sdk.ext + if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]: + continue - binary = MMS.HL2Library(builder, cxx, name, sdk) + name = 'stripper.' + sdk.ext - binary.sources = [ - 'stripper_mm.cpp', - ] + binary = MMS.HL2Library(builder, cxx, name, sdk) - nodes = builder.Add(binary) - MMS.binaries += [nodes] \ No newline at end of file + binary.sources = [ + 'stripper_mm.cpp', + ] + + nodes = builder.Add(binary) + MMS.binaries += [nodes] \ No newline at end of file diff --git a/gameshim/Makefile b/gameshim/Makefile deleted file mode 100644 index 2e73b93..0000000 --- a/gameshim/Makefile +++ /dev/null @@ -1,171 +0,0 @@ -# (C)2004-2008 SourceMod Development Team -# Makefile written by David "BAILOPAN" Anderson - -SMSDK = .. -HL2SDK_ORIG = ../../hl2sdk -HL2SDK_OB = ../../hl2sdk-ob -HL2SDK_OB_VALVE = ../../hl2sdk-ob-valve -HL2SDK_L4D = ../../hl2sdk-l4d -HL2SDK_L4D2 = ../../hl2sdk-l4d2 -MMSOURCE17 = ../../mmsource-1.7 -MMSOURCE18 = ../../mmsource-1.8 - -##################################### -### EDIT BELOW FOR OTHER PROJECTS ### -##################################### - -OBJECTS = stripper_mm.cpp - -############################################## -### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ### -############################################## - -C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing -C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3 -C_GCC4_FLAGS = -fvisibility=hidden -CPP_GCC4_FLAGS = -fvisibility-inlines-hidden -CPP = g++ - -override ENGSET = false -ifeq "$(ENGINE)" "original" - HL2SDK = $(HL2SDK_ORIG) - HL2PUB = $(HL2SDK)/public - HL2LIB = $(HL2SDK)/linux_sdk - CFLAGS += -DSOURCE_ENGINE=1 - METAMOD = $(MMSOURCE17)/core-legacy - INCLUDE += -I$(HL2SDK)/public/dlls - BINARY = stripper.14.ep1.so - override ENGSET = true -endif -ifeq "$(ENGINE)" "orangebox" - HL2SDK = $(HL2SDK_OB) - HL2PUB = $(HL2SDK)/public - HL2LIB = $(HL2SDK)/lib/linux - CFLAGS += -DSOURCE_ENGINE=3 -DORANGEBOX_BUILD - METAMOD = $(MMSOURCE17)/core - INCLUDE += -I$(HL2SDK)/public/game/server - BINARY = stripper.16.ep2.so - override ENGSET = true -endif -ifeq "$(ENGINE)" "orangeboxvalve" - HL2SDK = $(HL2SDK_OB_VALVE) - HL2PUB = $(HL2SDK)/public - HL2LIB = $(HL2SDK)/lib/linux - CFLAGS += -DSOURCE_ENGINE=3 -DORANGEBOX_BUILD - METAMOD = $(MMSOURCE17)/core - INCLUDE += -I$(HL2SDK)/public/game/server - BINARY = stripper.16.ep2v.so - override ENGSET = true -endif -ifeq "$(ENGINE)" "left4dead" - HL2SDK = $(HL2SDK_L4D) - HL2PUB = $(HL2SDK)/public - HL2LIB = $(HL2SDK)/lib/linux - CFLAGS += -DSOURCE_ENGINE=4 - METAMOD = $(MMSOURCE17)/core - INCLUDE += -I$(HL2SDK)/public/game/server - BINARY = stripper.16.l4d.so - override ENGSET = true -endif -ifeq "$(ENGINE)" "left4dead2" - HL2SDK = $(HL2SDK_L4D2) - HL2PUB = $(HL2SDK)/public - HL2LIB = $(HL2SDK)/lib/linux - CFLAGS += -DSOURCE_ENGINE=7 - METAMOD = $(MMSOURCE18)/core - INCLUDE += -I$(HL2SDK)/public/game/server - BINARY = stripper.16.l4d2.so - override ENGSET = true -endif - -CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4 -DSE_LEFT4DEAD2=7 - -LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a \ - $(LIB_PREFIX)vstdlib$(LIB_SUFFIX) \ - $(LIB_PREFIX)tier0$(LIB_SUFFIX) \ - -lpthread -static-libgcc - -INCLUDE += -I. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \ - -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook \ - -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn - -CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \ - -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror \ - -Wno-uninitialized -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H -DSM_DEFAULT_THREADER -m32 -CPPFLAGS += -Wno-non-virtual-dtor -fno-exceptions -fno-rtti - -################################################ -### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ### -################################################ - -ifeq "$(DEBUG)" "true" - BIN_DIR = Debug.$(ENGINE) - CFLAGS += $(C_DEBUG_FLAGS) -else - BIN_DIR = Release.$(ENGINE) - CFLAGS += $(C_OPT_FLAGS) -endif - -GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1) -ifeq "$(GCC_VERSION)" "4" - CFLAGS += $(C_GCC4_FLAGS) - CPPFLAGS += $(CPP_GCC4_FLAGS) -endif - -OS := $(shell uname -s) - -ifeq "$(OS)" "Darwin" - LIB_EXT = dylib - HL2LIB = $(HL2SDK)/lib/mac -else - LIB_EXT = so - ifeq "$(ENGINE)" "original" - HL2LIB = $(HL2SDK)/linux_sdk - else - HL2LIB = $(HL2SDK)/lib/linux - endif -endif - -# if ENGINE is orig, OB, or L4D -ifneq (,$(filter original orangebox left4dead,$(ENGINE))) - LIB_SUFFIX = _i486.$(LIB_EXT) -else - LIB_PREFIX = lib - LIB_SUFFIX = .$(LIB_EXT) -endif - -OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o) -OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o) - -$(BIN_DIR)/%.o: %.cpp - $(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< - -$(BIN_DIR)/%.o: %.c - $(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $< - -all: check - mkdir -p $(BIN_DIR)/systems - mkdir -p $(BIN_DIR)/thread - ln -sf $(HL2LIB)/$(LIB_PREFIX)vstdlib$(LIB_SUFFIX) .; - ln -sf $(HL2LIB)/$(LIB_PREFIX)tier0$(LIB_SUFFIX) .; - $(MAKE) -f Makefile sourcemod - -check: - if [ "$(ENGSET)" = "false" ]; then \ - echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \ - exit 1; \ - fi - -sourcemod: check $(OBJ_LINUX) - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o $(BIN_DIR)/$(BINARY) - -debug: - $(MAKE) -f Makefile all DEBUG=true - -default: all - -clean: check - rm -rf $(BIN_DIR)/*.o - rm -rf $(BIN_DIR)/systems/*.o - rm -rf $(BIN_DIR)/thread/*.o - rm -rf $(BIN_DIR)/$(BINARY) diff --git a/gameshim/gameshim.sln b/gameshim/gameshim.sln deleted file mode 100755 index 9165f06..0000000 --- a/gameshim/gameshim.sln +++ /dev/null @@ -1,59 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gameshim", "gameshim.vcproj", "{B3E797CF-4E77-4C9D-B8A8-7589B6902206}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug - Dark Messiah|Win32 = Debug - Dark Messiah|Win32 - Debug - Episode 1|Win32 = Debug - Episode 1|Win32 - Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32 - Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32 - Debug - Orange Box|Win32 = Debug - Orange Box|Win32 - Debug|Win32 = Debug|Win32 - Release - CSGO|Win32 = Release - CSGO|Win32 - Release - CSS|Win32 = Release - CSS|Win32 - Release - Dark Messiah|Win32 = Release - Dark Messiah|Win32 - Release - Episode 1|Win32 = Release - Episode 1|Win32 - Release - Left 4 Dead 2|Win32 = Release - Left 4 Dead 2|Win32 - Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32 - Release - Old Metamod|Win32 = Release - Old Metamod|Win32 - Release - Orange Box|Win32 = Release - Orange Box|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Dark Messiah|Win32.ActiveCfg = Debug - Dark Messiah|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Dark Messiah|Win32.Build.0 = Debug - Dark Messiah|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Episode 1|Win32.ActiveCfg = Debug - Episode 1|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Episode 1|Win32.Build.0 = Debug - Episode 1|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Left 4 Dead|Win32.ActiveCfg = Debug - Left 4 Dead|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Left 4 Dead|Win32.Build.0 = Debug - Left 4 Dead|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Old Metamod|Win32.Build.0 = Debug - Old Metamod|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Orange Box|Win32.ActiveCfg = Debug - Orange Box|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Orange Box|Win32.Build.0 = Debug - Orange Box|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.ActiveCfg = Debug|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.Build.0 = Debug|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - CSGO|Win32.ActiveCfg = Release - CSGO|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - CSGO|Win32.Build.0 = Release - CSGO|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - CSS|Win32.ActiveCfg = Release - CSS|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - CSS|Win32.Build.0 = Release - CSS|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Dark Messiah|Win32.ActiveCfg = Release - Dark Messiah|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Dark Messiah|Win32.Build.0 = Release - Dark Messiah|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Episode 1|Win32.ActiveCfg = Release - Episode 1|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Episode 1|Win32.Build.0 = Release - Episode 1|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Left 4 Dead 2|Win32.ActiveCfg = Release - Left 4 Dead 2|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Left 4 Dead 2|Win32.Build.0 = Release - Left 4 Dead 2|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Left 4 Dead|Win32.ActiveCfg = Release - Left 4 Dead|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Left 4 Dead|Win32.Build.0 = Release - Left 4 Dead|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Old Metamod|Win32.ActiveCfg = Release - Old Metamod|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Old Metamod|Win32.Build.0 = Release - Old Metamod|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Orange Box|Win32.ActiveCfg = Release - Orange Box|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Orange Box|Win32.Build.0 = Release - Orange Box|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.ActiveCfg = Release|Win32 - {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/gameshim/gameshim.vcproj b/gameshim/gameshim.vcproj deleted file mode 100755 index c6cd2d7..0000000 --- a/gameshim/gameshim.vcproj +++ /dev/null @@ -1,1276 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/gameshim/intercom.h b/gameshim/intercom.h index f51529d..5762a25 100644 --- a/gameshim/intercom.h +++ b/gameshim/intercom.h @@ -1,5 +1,5 @@ /** vim: set ts=4 sw=4 et tw=99: - * + * * === Stripper for Metamod:Source === * Copyright (C) 2005-2009 David "BAILOPAN" Anderson * No warranties of any kind. diff --git a/gameshim/stripper_mm.cpp b/gameshim/stripper_mm.cpp index 59694ad..83be6d0 100644 --- a/gameshim/stripper_mm.cpp +++ b/gameshim/stripper_mm.cpp @@ -1,5 +1,5 @@ /** vim: set ts=4 sw=4 et tw=99: - * + * * === Stripper for Metamod:Source === * Copyright (C) 2005-2009 David "BAILOPAN" Anderson * No warranties of any kind. @@ -27,9 +27,10 @@ StripperPlugin g_Plugin; PLUGIN_EXPOSE(StripperPlugin, g_Plugin); -static IVEngineServer *engine = NULL; -static IServerGameDLL *server = NULL; -static IServerGameClients* clients = NULL; +IVEngineServer *engine = NULL; +IServerGameDLL *server = NULL; +IServerGameClients *clients = NULL; +ICvar *icvar = NULL; static SourceHook::String g_mapname; static stripper_core_t stripper_core; static char game_path[256]; @@ -40,32 +41,21 @@ SH_DECL_HOOK0(IVEngineServer, GetMapEntitiesString, SH_NOATTRIB, 0, const char * SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, 0, bool, char const *, char const *, char const *, char const *, bool, bool); SH_DECL_HOOK1_void(IServerGameClients, SetCommandClient, SH_NOATTRIB, 0, int); -#if !defined ORANGEBOX_BUILD -ICvar* g_pCVar = NULL; -#endif - -ICvar* -GetICVar() -{ -#if defined METAMOD_PLAPI_VERSION -#if SOURCE_ENGINE==SE_ORANGEBOX || SOURCE_ENGINE==SE_LEFT4DEAD || SOURCE_ENGINE==SE_LEFT4DEAD2 || SOURCE_ENGINE==SE_TF2 || SOURCE_ENGINE==SE_DODS || SOURCE_ENGINE==SE_HL2DM || SOURCE_ENGINE==SE_NUCLEARDAWN || \ - SOURCE_ENGINE==SE_ALIENSWARM || SOURCE_ENGINE==SE_BLOODYGOODTIME || SOURCE_ENGINE==SE_CSGO || SOURCE_ENGINE==SE_CSS || SOURCE_ENGINE==SE_INSURGENCY || SOURCE_ENGINE==SE_SDK2013 || SOURCE_ENGINE== SE_BMS - return (ICvar *)((g_SMAPI->GetEngineFactory())(CVAR_INTERFACE_VERSION, NULL)); -#else - return (ICvar *)((g_SMAPI->GetEngineFactory())(VENGINE_CVAR_INTERFACE_VERSION, NULL)); -#endif +#if defined WIN32 +#define dlopen(x, y) LoadLibrary(x) +#define dlclose(x) FreeLibrary(x) +#define dlsym(x, y) GetProcAddress(x, y) +typedef HMODULE LibraryHandle; +#define PATH_SEP_STR "\\" #else - return (ICvar *)((g_SMAPI->engineFactory())(VENGINE_CVAR_INTERFACE_VERSION, NULL)); +typedef void *LibraryHandle; +#define PATH_SEP_STR "/" #endif -} -#if defined WIN32 -#define dlopen(x, y) LoadLibrary(x) -#define dlclose(x) FreeLibrary(x) -#define dlsym(x, y) GetProcAddress(x, y) -typedef HMODULE LibraryHandle; +#if defined(_WIN64) || defined(__x86_64__) +#define PLATFORM_ARCH_FOLDER "x64" PATH_SEP_STR #else -typedef void * LibraryHandle; +#define PLATFORM_ARCH_FOLDER "" #endif static LibraryHandle stripper_lib; @@ -73,50 +63,63 @@ static LibraryHandle stripper_lib; static void SetCommandClient(int client); +/** + * Something like this is needed to register cvars/CON_COMMANDs. + */ +class BaseAccessor : public IConCommandBaseAccessor +{ +public: + bool RegisterConCommandBase(ConCommandBase *pCommandBase) + { + /* Always call META_REGCVAR instead of going through the engine. */ + return META_REGCVAR(pCommandBase); + } +} s_BaseAccessor; + static void -log_message(const char* fmt, ...) +log_message(const char *fmt, ...) { - va_list ap; - char buffer[1024]; + va_list ap; + char buffer[1024]; - va_start(ap, fmt); - vsnprintf(buffer, sizeof(buffer), fmt, ap); - va_end(ap); + va_start(ap, fmt); + vsnprintf(buffer, sizeof(buffer), fmt, ap); + va_end(ap); - buffer[sizeof(buffer) - 1] = '\0'; + buffer[sizeof(buffer) - 1] = '\0'; - g_SMAPI->LogMsg(g_PLAPI, "%s", buffer); + g_SMAPI->LogMsg(g_PLAPI, "%s", buffer); } static void -path_format(char* buffer, size_t maxlength, const char* fmt, ...) +path_format(char *buffer, size_t maxlength, const char *fmt, ...) { - va_list ap; - char new_buffer[1024]; + va_list ap; + char new_buffer[1024]; - va_start(ap, fmt); - vsnprintf(new_buffer, sizeof(new_buffer), fmt, ap); - va_end(ap); + va_start(ap, fmt); + vsnprintf(new_buffer, sizeof(new_buffer), fmt, ap); + va_end(ap); - new_buffer[sizeof(new_buffer) - 1] = '\0'; + new_buffer[sizeof(new_buffer) - 1] = '\0'; - g_SMAPI->PathFormat(buffer, maxlength, "%s", new_buffer); + g_SMAPI->PathFormat(buffer, maxlength, "%s", new_buffer); } -static const char* +static const char * get_map_name() { - return STRING(g_SMAPI->GetCGlobals()->mapname); + return STRING(g_SMAPI->GetCGlobals()->mapname); } static stripper_game_t stripper_game = -{ - NULL, - NULL, - NULL, - log_message, - path_format, - get_map_name, + { + NULL, + NULL, + NULL, + log_message, + path_format, + get_map_name, }; ConVar cvar_stripper_cfg_path("stripper_cfg_path", "addons/stripper", FCVAR_NONE, "Stripper Config Path"); @@ -133,18 +136,15 @@ void stripper_cfg_path_changed(IConVar *var, const char *pOldValue, float flOldV void stripper_cfg_path_changed(ConVar *var, const char *pOldValue) #endif { - strncpy(stripper_cfg_path, cvar_stripper_cfg_path.GetString(), sizeof(stripper_cfg_path)); + strncpy(stripper_cfg_path, cvar_stripper_cfg_path.GetString(), sizeof(stripper_cfg_path)); } - -bool -StripperPlugin::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late) +bool StripperPlugin::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late) { - PLUGIN_SAVEVARS(); + PLUGIN_SAVEVARS(); -#if defined METAMOD_PLAPI_VERSION - GET_V_IFACE_ANY(GetServerFactory, server, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL); -#if SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_SDK2013 || SOURCE_ENGINE == SE_BMS + GET_V_IFACE_ANY(GetServerFactory, server, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL); +#if SOURCE_ENGINE == SE_SDK2013 // Shim to avoid hooking shims engine = (IVEngineServer *)ismm->GetEngineFactory()("VEngineServer023", nullptr); if (!engine) @@ -166,141 +166,138 @@ StripperPlugin::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, boo #else GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER); #endif - GET_V_IFACE_ANY(GetServerFactory, clients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS); -#else - GET_V_IFACE_ANY(serverFactory, server, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL); - GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER); - GET_V_IFACE_ANY(serverFactory, clients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS); -#endif + GET_V_IFACE_CURRENT(GetServerFactory, clients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS); + GET_V_IFACE_CURRENT(GetEngineFactory, icvar, ICvar, CVAR_INTERFACE_VERSION); - engine->GetGameDir(game_path, sizeof(game_path)); - stripper_game.game_path = game_path; - stripper_game.stripper_path = "addons/stripper"; - stripper_game.stripper_cfg_path = stripper_cfg_path; - strncpy(stripper_cfg_path, cvar_stripper_cfg_path.GetString(), sizeof(stripper_cfg_path)); + engine->GetGameDir(game_path, sizeof(game_path)); + stripper_game.game_path = game_path; + stripper_game.stripper_path = "addons/stripper"; + stripper_game.stripper_cfg_path = stripper_cfg_path; + strncpy(stripper_cfg_path, cvar_stripper_cfg_path.GetString(), sizeof(stripper_cfg_path)); - cvar_stripper_cfg_path.InstallChangeCallback( stripper_cfg_path_changed ); + cvar_stripper_cfg_path.InstallChangeCallback(stripper_cfg_path_changed); -#if SOURCE_ENGINE==SE_DARKMESSIAH - ICvar* cvar = GetICVar(); - const char* temp = (cvar == NULL) ? NULL : cvar->GetCommandLineValue("+stripper_path"); +#if SOURCE_ENGINE == SE_DARKMESSIAH + const char *temp = (icvar == NULL) ? NULL : icvar->GetCommandLineValue("+stripper_path"); #else - const char* temp = CommandLine()->ParmValue("+stripper_path"); + const char *temp = CommandLine()->ParmValue("+stripper_path"); #endif - if (temp != NULL && temp[0] != '\0') - { - g_SMAPI->PathFormat(stripper_path, sizeof(stripper_path), "%s", temp); - stripper_game.stripper_path = stripper_path; - } + if (temp != NULL && temp[0] != '\0') + { + g_SMAPI->PathFormat(stripper_path, sizeof(stripper_path), "%s", temp); + stripper_game.stripper_path = stripper_path; + } #if defined __linux__ -#define PLATFORM_EXT ".so" +#define PLATFORM_EXT ".so" #elif defined __APPLE__ -#define PLATFORM_EXT ".dylib" +#define PLATFORM_EXT ".dylib" #else -#define PLATFORM_EXT ".dll" +#define PLATFORM_EXT ".dll" #endif - char path[256]; - g_SMAPI->PathFormat(path, - sizeof(path), - "%s/%s/bin/stripper.core" PLATFORM_EXT, - game_path, - stripper_game.stripper_path); + char path[256]; + g_SMAPI->PathFormat(path, + sizeof(path), + "%s/%s/bin/" PLATFORM_ARCH_FOLDER "stripper.core" PLATFORM_EXT, + game_path, + stripper_game.stripper_path); #undef PLATFORM_EXT - stripper_lib = dlopen(path, RTLD_NOW); - if (stripper_lib == NULL) - { + stripper_lib = dlopen(path, RTLD_NOW); + if (stripper_lib == NULL) + { #if defined __linux__ || defined __APPLE__ - snprintf(error, maxlen, "%s", dlerror()); + snprintf(error, maxlen, "%s", dlerror()); #elif defined WIN32 - DWORD dw = GetLastError(); - if (FormatMessageA( - FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - dw, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - error, - maxlen, - NULL) == 0) - { - _snprintf(error, maxlen, "Unknown error: %d", dw); - error[maxlen - 1] = '\0'; - } + DWORD dw = GetLastError(); + if (FormatMessageA( + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + dw, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + error, + maxlen, + NULL) == 0) + { + _snprintf(error, maxlen, "Unknown error: %d", dw); + error[maxlen - 1] = '\0'; + } #endif - return false; - } - - STRIPPER_LOAD stripper_load = (STRIPPER_LOAD)dlsym(stripper_lib, "LoadStripper"); - if (stripper_load == NULL) - { - dlclose(stripper_lib); - stripper_load = NULL; - snprintf(error, maxlen, "Could not find LoadStripper function"); - error[maxlen - 1] = '\0'; - return false; - } - - stripper_load(&stripper_game, &stripper_core); - - SH_ADD_HOOK_STATICFUNC(IVEngineServer, GetMapEntitiesString, engine, GetMapEntitiesString_handler, false); - SH_ADD_HOOK_STATICFUNC(IServerGameDLL, LevelInit, server, LevelInit_handler, false); - SH_ADD_HOOK_STATICFUNC(IServerGameClients, SetCommandClient, clients, SetCommandClient, false); - -#if SOURCE_ENGINE==SE_ORANGEBOX || SOURCE_ENGINE==SE_LEFT4DEAD || SOURCE_ENGINE==SE_LEFT4DEAD2 || SOURCE_ENGINE==SE_TF2 || SOURCE_ENGINE==SE_DODS || SOURCE_ENGINE==SE_HL2DM || SOURCE_ENGINE==SE_NUCLEARDAWN || \ - SOURCE_ENGINE==SE_ALIENSWARM || SOURCE_ENGINE==SE_BLOODYGOODTIME || SOURCE_ENGINE==SE_CSGO || SOURCE_ENGINE==SE_CSS || SOURCE_ENGINE==SE_INSURGENCY || SOURCE_ENGINE==SE_SDK2013 || SOURCE_ENGINE== SE_BMS - g_pCVar = GetICVar(); - ConVar_Register(0, this); + return false; + } + + STRIPPER_LOAD stripper_load = (STRIPPER_LOAD)dlsym(stripper_lib, "LoadStripper"); + if (stripper_load == NULL) + { + dlclose(stripper_lib); + stripper_load = NULL; + snprintf(error, maxlen, "Could not find LoadStripper function"); + error[maxlen - 1] = '\0'; + return false; + } + + stripper_load(&stripper_game, &stripper_core); + + SH_ADD_HOOK_STATICFUNC(IVEngineServer, GetMapEntitiesString, engine, GetMapEntitiesString_handler, false); + SH_ADD_HOOK_STATICFUNC(IServerGameDLL, LevelInit, server, LevelInit_handler, false); + SH_ADD_HOOK_STATICFUNC(IServerGameClients, SetCommandClient, clients, SetCommandClient, false); + +#if SOURCE_ENGINE >= SE_ORANGEBOX + g_pCVar = icvar; + ConVar_Register(0, &s_BaseAccessor); #else - ConCommandBaseMgr::OneTimeInit(this); + ConCommandBaseMgr::OneTimeInit(&s_BaseAccessor); #endif - return true; + return true; } -bool -StripperPlugin::Unload(char *error, size_t maxlen) +bool StripperPlugin::Unload(char *error, size_t maxlen) { - SH_REMOVE_HOOK_STATICFUNC(IVEngineServer, GetMapEntitiesString, engine, GetMapEntitiesString_handler, false); - SH_REMOVE_HOOK_STATICFUNC(IServerGameDLL, LevelInit, server, LevelInit_handler, false); - SH_REMOVE_HOOK_STATICFUNC(IServerGameClients, SetCommandClient, clients, SetCommandClient, false); - stripper_core.unload(); - dlclose(stripper_lib); - stripper_lib = NULL; - - return true; + SH_REMOVE_HOOK_STATICFUNC(IVEngineServer, GetMapEntitiesString, engine, GetMapEntitiesString_handler, false); + SH_REMOVE_HOOK_STATICFUNC(IServerGameDLL, LevelInit, server, LevelInit_handler, false); + SH_REMOVE_HOOK_STATICFUNC(IServerGameClients, SetCommandClient, clients, SetCommandClient, false); + stripper_core.unload(); + dlclose(stripper_lib); + stripper_lib = NULL; + + return true; } -const char* +const char * GetMapEntitiesString_handler() { - RETURN_META_VALUE(MRES_SUPERCEDE, stripper_core.ent_string()); + RETURN_META_VALUE(MRES_SUPERCEDE, stripper_core.ent_string()); } -bool -LevelInit_handler(char const *pMapName, char const *pMapEntities, char const *c, char const *d, bool e, bool f) +bool LevelInit_handler(char const *pMapName, char const *pMapEntities, char const *c, char const *d, bool e, bool f) { - if (strlen(stripper_nextfile.GetString()) > 0) { - g_mapname.assign(stripper_nextfile.GetString()); - log_message("Loading %s for map \"%s\"", g_mapname.c_str(), pMapName); - } else if (stripper_lowercase.GetInt()) { - char* name = UTIL_ToLowerCase(pMapName); - g_mapname.assign(name); - delete[] name; - } else { - g_mapname.assign(pMapName); - } - - stripper_nextfile.SetValue(""); - stripper_curfile.SetValue(g_mapname.c_str()); - - const char *ents = stripper_core.parse_map(g_mapname.c_str(), pMapEntities); - RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, true, &IServerGameDLL::LevelInit, (pMapName, ents, c, d, e, f)); + if (strlen(stripper_nextfile.GetString()) > 0) + { + g_mapname.assign(stripper_nextfile.GetString()); + log_message("Loading %s for map \"%s\"", g_mapname.c_str(), pMapName); + } + else if (stripper_lowercase.GetInt()) + { + char *name = UTIL_ToLowerCase(pMapName); + g_mapname.assign(name); + delete[] name; + } + else + { + g_mapname.assign(pMapName); + } + + stripper_nextfile.SetValue(""); + stripper_curfile.SetValue(g_mapname.c_str()); + + const char *ents = stripper_core.parse_map(g_mapname.c_str(), pMapEntities); + RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, true, &IServerGameDLL::LevelInit, (pMapName, ents, c, d, e, f)); } -char* +char * UTIL_ToLowerCase(const char *str) { size_t len = strlen(str); @@ -316,75 +313,66 @@ UTIL_ToLowerCase(const char *str) return buffer; } -bool -StripperPlugin::Pause(char *error, size_t maxlen) +bool StripperPlugin::Pause(char *error, size_t maxlen) { - return true; + return true; } -bool -StripperPlugin::Unpause(char *error, size_t maxlen) +bool StripperPlugin::Unpause(char *error, size_t maxlen) { - return true; + return true; } -void -StripperPlugin::AllPluginsLoaded() +void StripperPlugin::AllPluginsLoaded() { } -const char* +const char * StripperPlugin::GetAuthor() { - return "BAILOPAN"; + return "BAILOPAN"; } -const char* +const char * StripperPlugin::GetName() { - return "Stripper"; + return "Stripper"; } -const char* +const char * StripperPlugin::GetDescription() { - return "Strips/Adds Map Entities"; + return "Strips/Adds Map Entities"; } -const char* +const char * StripperPlugin::GetURL() { - return "http://www.bailopan.net/"; + return "http://www.bailopan.net/"; } -const char* +const char * StripperPlugin::GetLicense() { - return "GPL v3"; + return "GPL v3"; } -const char* +const char * StripperPlugin::GetVersion() { - return STRIPPER_FULL_VERSION; + return STRIPPER_FULL_VERSION; } -const char* +const char * StripperPlugin::GetDate() { - return __DATE__; + return __DATE__; } -const char* +const char * StripperPlugin::GetLogTag() { - return "STRIPPER"; -} - -bool -StripperPlugin::RegisterConCommandBase(ConCommandBase *pVar) -{ - return META_REGCVAR(pVar); + return "STRIPPER"; } static int last_command_client = 1; @@ -392,16 +380,15 @@ static int last_command_client = 1; static void SetCommandClient(int client) { - last_command_client = client; + last_command_client = client; } ConVar stripper_version("stripper_version", STRIPPER_FULL_VERSION, FCVAR_SPONLY | FCVAR_NOTIFY, "Stripper Version"); CON_COMMAND(stripper_dump, "Dumps the map entity list to a file") { - if (last_command_client != -1) - return; + if (last_command_client != -1) + return; - stripper_core.command_dump(); + stripper_core.command_dump(); } - diff --git a/gameshim/stripper_mm.h b/gameshim/stripper_mm.h index 7905c2c..6a8857c 100644 --- a/gameshim/stripper_mm.h +++ b/gameshim/stripper_mm.h @@ -1,5 +1,5 @@ /** vim: set ts=4 sw=4 et tw=99: - * + * * === Stripper for Metamod:Source === * Copyright (C) 2005-2009 David "BAILOPAN" Anderson * No warranties of any kind. @@ -16,46 +16,45 @@ #include #include -class StripperPlugin : - public ISmmPlugin, - public IConCommandBaseAccessor +class StripperPlugin : public ISmmPlugin { public: - bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late); - bool Unload(char *error, size_t maxlen); - bool Pause(char *error, size_t maxlen); - bool Unpause(char *error, size_t maxlen); - void AllPluginsLoaded(); + bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late); + bool Unload(char *error, size_t maxlen); + bool Pause(char *error, size_t maxlen); + bool Unpause(char *error, size_t maxlen); + void AllPluginsLoaded(); + public: - const char *GetAuthor(); - const char *GetName(); - const char *GetDescription(); - const char *GetURL(); - const char *GetLicense(); - const char *GetVersion(); - const char *GetDate(); - const char *GetLogTag(); -public: //IConCommandBaseAccessor - bool RegisterConCommandBase(ConCommandBase *pVar); + const char *GetAuthor(); + const char *GetName(); + const char *GetDescription(); + const char *GetURL(); + const char *GetLicense(); + const char *GetVersion(); + const char *GetDate(); + const char *GetLogTag(); }; PLUGIN_GLOBALVARS(); -#define FIND_IFACE(func, assn_var, num_var, name, type) \ - do { \ - if ( (assn_var=(type)((ismm->func())(name, NULL))) != NULL ) { \ - num_var = 0; \ - break; \ - } \ - if (num_var >= 999) \ - break; \ - } while ( num_var=ismm->FormatIface(name, sizeof(name)-1) ); \ - if (!assn_var) { \ - if (error) \ - snprintf(error, maxlen, "Could not find interface %s", name); \ - return false; \ - } - +#define FIND_IFACE(func, assn_var, num_var, name, type) \ + do \ + { \ + if ((assn_var = (type)((ismm->func())(name, NULL))) != NULL) \ + { \ + num_var = 0; \ + break; \ + } \ + if (num_var >= 999) \ + break; \ + } while (num_var = ismm->FormatIface(name, sizeof(name) - 1)); \ + if (!assn_var) \ + { \ + if (error) \ + snprintf(error, maxlen, "Could not find interface %s", name); \ + return false; \ + } const char *GetMapEntitiesString_handler(); bool LevelInit_handler(char const *pMapName, char const *pMapEntities, char const *c, char const *d, bool e, bool f); diff --git a/loader/AMBuilder b/loader/AMBuilder index eb47aee..f20fa13 100644 --- a/loader/AMBuilder +++ b/loader/AMBuilder @@ -1,20 +1,32 @@ -# vim: set ts=2 sw=2 tw=99 noet ft=python: +# vim: set sts=2 ts=2 sw=2 tw=99 et ft=python: import os.path for cxx in MMS.all_targets: - if cxx.target.platform != 'linux': - name = 'stripper_mm' - else: - name = 'stripper_mm_i486' - - binary = MMS.Library(cxx, name) + if cxx.target.platform != 'linux': + name = 'stripper_mm' + extra_ldflags = [] + else: + name = 'stripper_mm_i486' + extra_ldflags = ['-ldl'] - binary.sources = [ - 'stripper_loader.cpp', - ] + if cxx.target.arch == 'x86_64': + name = 'stripper_mm.x64' - binary.compiler.cxxincludes += [os.path.join(MMS.mms_root, 'core')] + binary = MMS.Library(cxx, name) - nodes = builder.Add(binary) - MMS.binaries += [nodes] \ No newline at end of file + binary.sources = [ + 'stripper_loader.cpp', + ] + + binary.compiler.cxxincludes += [os.path.join(MMS.mms_root, 'core')] + binary.compiler.defines += ['META_NO_HL2SDK'] + + if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang': + binary.compiler.cxxflags += ['-fno-rtti'] + elif binary.compiler.family == 'msvc': + binary.compiler.cxxflags += ['/GR-'] + binary.compiler.linkflags += extra_ldflags + + nodes = builder.Add(binary) + MMS.binaries += [nodes] \ No newline at end of file diff --git a/loader/Makefile b/loader/Makefile deleted file mode 100644 index 76fc8df..0000000 --- a/loader/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -#(C)2004-2006 SourceMM Development Team -# Makefile written by David "BAILOPAN" Anderson - -MMSOURCE = ../../mmsource-1.8 - -### EDIT BELOW FOR OTHER PROJECTS ### - -OPT_FLAGS = -O3 -funroll-loops -pipe -fvisibility=hidden -fvisibility-inlines-hidden -GCC4_FLAGS = -DEBUG_FLAGS = -g -ggdb3 -CPP = gcc -PROJECT = stripper_mm - -OBJECTS = stripper_loader.cpp - -LINK = -static-libgcc -m32 - -HL2PUB = $(HL2SDK)/public - -INCLUDE = -I. -I.. -I$(MMSOURCE)/core - -ifeq "$(DEBUG)" "true" - BIN_DIR = Debug - CFLAGS = $(DEBUG_FLAGS) -else - BIN_DIR = Release - CFLAGS = $(OPT_FLAGS) -endif - -GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1) - -CFLAGS += -D_LINUX -DNDEBUG -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Wno-non-virtual-dtor -Werror -fPIC -fno-exceptions -fno-rtti -msse -m32 - -ifeq "$(GCC_VERSION)" "4" - CFLAGS += $(GCC4_FLAGS) -endif - -OS := $(shell uname -s) -ifeq "$(OS)" "Darwin" - LINK += -dynamiclib - BINARY = $(PROJECT).dylib -else - LINK += -static-libgcc -shared - BINARY = $(PROJECT)_i486.so -endif - -OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o) - -$(BIN_DIR)/%.o: %.cpp - $(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $< - -all: - mkdir -p $(BIN_DIR) - $(MAKE) sourcemm - rm -rf $(BINARY) - ln -sf $(BIN_DIR)/$(BINARY) $(BINARY) - -sourcemm: $(OBJ_LINUX) - $(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o $(BIN_DIR)/$(BINARY) - -debug: - $(MAKE) all DEBUG=true - -default: all - -clean: - rm -rf Release/*.o - rm -rf Release/$(BINARY) - rm -rf Debug/*.o - rm -rf Debug/$(BINARY) - diff --git a/loader/loader.sln b/loader/loader.sln deleted file mode 100644 index 3496801..0000000 --- a/loader/loader.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "loader", "loader.vcproj", "{D0789DE2-C3C1-450B-B213-96B3EDCD9D60}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D0789DE2-C3C1-450B-B213-96B3EDCD9D60}.Debug|Win32.ActiveCfg = Debug|Win32 - {D0789DE2-C3C1-450B-B213-96B3EDCD9D60}.Debug|Win32.Build.0 = Debug|Win32 - {D0789DE2-C3C1-450B-B213-96B3EDCD9D60}.Release|Win32.ActiveCfg = Release|Win32 - {D0789DE2-C3C1-450B-B213-96B3EDCD9D60}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/loader/loader.vcproj b/loader/loader.vcproj deleted file mode 100644 index 0245744..0000000 --- a/loader/loader.vcproj +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/loader/stripper_loader.cpp b/loader/stripper_loader.cpp index 78a7011..afa73c7 100644 --- a/loader/stripper_loader.cpp +++ b/loader/stripper_loader.cpp @@ -2,68 +2,88 @@ #include #include #include +#include #if defined _MSC_VER -#define EXPORT extern "C" __declspec(dllexport) -#define PLATFORM_EXT ".dll" -#define PATH_SEP_CHAR "\\" -#define vsnprintf _vsnprintf -#define WINDOWS_MEAN_AND_LEAN -#include -inline bool IsPathSepChar(char c) { return (c == '/' || c == '\\'); } + #define DLL_EXPORT extern "C" __declspec(dllexport) + #define openlib(lib) LoadLibrary(lib) + #define closelib(lib) FreeLibrary(lib) + #define findsym(lib, sym) GetProcAddress(lib, sym) + #define PLATFORM_EXT ".dll" + #define vsnprintf _vsnprintf + #define PATH_SEP_STR "\\" + #include #else -#define EXPORT extern "C" __attribute__((visibility("default"))) -#define PLATFORM_EXT ".so" -#define PATH_SEP_CHAR "/" -#define LoadLibrary(x) dlopen(x, RTLD_NOW) -#define GetProcAddress(x,s) dlsym(x,s) -#define FreeLibrary(x) dlclose(x) -typedef void * HINSTANCE; -#include -inline bool IsPathSepChar(char c) { return (c == '/'); } + #define DLL_EXPORT extern "C" __attribute__((visibility("default"))) + #define openlib(lib) dlopen(lib, RTLD_NOW) + #define closelib(lib) dlclose(lib) + #define findsym(lib, sym) dlsym(lib, sym) + #if defined __linux__ + #define PLATFORM_EXT ".so" + #elif defined __APPLE__ + #define PLATFORM_EXT ".dylib" + #endif + typedef void * HINSTANCE; + #define PATH_SEP_STR "/" + #include #endif -#define MMS_1_4_EP1_FILE "stripper.14.ep1" PLATFORM_EXT -#define MMS_1_6_EP1_FILE "stripper.16.ep1" PLATFORM_EXT -#define MMS_1_6_EP2_FILE "stripper.16.ep2" PLATFORM_EXT -#define MMS_1_6_TF2_FILE "stripper.16.tf2" PLATFORM_EXT -#define MMS_1_6_DODS_FILE "stripper.16.dods" PLATFORM_EXT -#define MMS_1_6_HL2DM_FILE "stripper.16.hl2dm" PLATFORM_EXT -#define MMS_1_6_ND_FILE "stripper.16.nd" PLATFORM_EXT -#define MMS_1_6_L4D_FILE "stripper.16.l4d" PLATFORM_EXT -#define MMS_1_6_L4D2_FILE "stripper.16.l4d2" PLATFORM_EXT -#define MMS_1_6_DARKM_FILE "stripper.16.darkm" PLATFORM_EXT -#define MMS_1_6_SWARM_FILE "stripper.16.swarm" PLATFORM_EXT -#define MMS_1_6_BGT_FILE "stripper.16.bgt" PLATFORM_EXT -#define MMS_1_6_CSGO_FILE "stripper.16.csgo" PLATFORM_EXT -#define MMS_1_6_CSS_FILE "stripper.16.css" PLATFORM_EXT -#define MMS_1_6_INS_FILE "stripper.16.ins" PLATFORM_EXT -#define MMS_1_6_SDK2013_FILE "stripper.16.sdk2013" PLATFORM_EXT -#define MMS_1_6_BMS_FILE "stripper.16.bms" PLATFORM_EXT - -HINSTANCE stripper_library = NULL; - -bool GetFileOfAddress(void *pAddr, char *buffer, size_t maxlength) -{ -#if defined _MSC_VER - MEMORY_BASIC_INFORMATION mem; - if (!VirtualQuery(pAddr, &mem, sizeof(mem))) - return false; - if (mem.AllocationBase == NULL) - return false; - HMODULE dll = (HMODULE)mem.AllocationBase; - GetModuleFileName(dll, (LPTSTR)buffer, maxlength); +#if defined(_WIN64) || defined(__x86_64__) +#define PLATFORM_ARCH_FOLDER "x64" PATH_SEP_STR #else - Dl_info info; - if (!dladdr(pAddr, &info)) - return false; - if (!info.dli_fbase || !info.dli_fname) - return false; - const char *dllpath = info.dli_fname; - snprintf(buffer, maxlength, "%s", dllpath); +#define PLATFORM_ARCH_FOLDER "" #endif - return true; -} + +#define METAMOD_API_MAJOR 2 +#define FILENAME_1_6_EP2 PLATFORM_ARCH_FOLDER "stripper.2.ep2" PLATFORM_EXT +#define FILENAME_1_6_EP1 PLATFORM_ARCH_FOLDER "stripper.2.ep1" PLATFORM_EXT +#define FILENAME_1_6_L4D PLATFORM_ARCH_FOLDER "stripper.2.l4d" PLATFORM_EXT +#define FILENAME_1_6_DARKM PLATFORM_ARCH_FOLDER "stripper.2.darkm" PLATFORM_EXT +#define FILENAME_1_6_L4D2 PLATFORM_ARCH_FOLDER "stripper.2.l4d2" PLATFORM_EXT +#define FILENAME_1_6_SWARM PLATFORM_ARCH_FOLDER "stripper.2.swarm" PLATFORM_EXT +#define FILENAME_1_6_BGT PLATFORM_ARCH_FOLDER "stripper.2.bgt" PLATFORM_EXT +#define FILENAME_1_6_EYE PLATFORM_ARCH_FOLDER "stripper.2.eye" PLATFORM_EXT +#define FILENAME_1_6_PORTAL2 PLATFORM_ARCH_FOLDER "stripper.2.portal2" PLATFORM_EXT +#define FILENAME_1_6_CSGO PLATFORM_ARCH_FOLDER "stripper.2.csgo" PLATFORM_EXT +#define FILENAME_1_6_CSS PLATFORM_ARCH_FOLDER "stripper.2.css" PLATFORM_EXT +#define FILENAME_1_6_HL2DM PLATFORM_ARCH_FOLDER "stripper.2.hl2dm" PLATFORM_EXT +#define FILENAME_1_6_DODS PLATFORM_ARCH_FOLDER "stripper.2.dods" PLATFORM_EXT +#define FILENAME_1_6_SDK2013 PLATFORM_ARCH_FOLDER "stripper.2.sdk2013" PLATFORM_EXT +#define FILENAME_1_6_TF2 PLATFORM_ARCH_FOLDER "stripper.2.tf2" PLATFORM_EXT +#define FILENAME_1_6_ND PLATFORM_ARCH_FOLDER "stripper.2.nd" PLATFORM_EXT +#define FILENAME_1_6_BLADE PLATFORM_ARCH_FOLDER "stripper.2.blade" PLATFORM_EXT +#define FILENAME_1_6_INSURGENCY PLATFORM_ARCH_FOLDER "stripper.2.insurgency" PLATFORM_EXT +#define FILENAME_1_6_DOI PLATFORM_ARCH_FOLDER "stripper.2.doi" PLATFORM_EXT +#define FILENAME_1_6_CONTAGION PLATFORM_ARCH_FOLDER "stripper.2.contagion" PLATFORM_EXT +#define FILENAME_1_6_BMS PLATFORM_ARCH_FOLDER "stripper.2.bms" PLATFORM_EXT +#define FILENAME_1_6_MOCK PLATFORM_ARCH_FOLDER "stripper.2.mock" PLATFORM_EXT +#define FILENAME_1_6_PVKII PLATFORM_ARCH_FOLDER "stripper.2.pvkii" PLATFORM_EXT + +HINSTANCE g_hCore = NULL; +bool load_attempted = false; + +size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...); + +class FailPlugin : public SourceMM::ISmmFailPlugin +{ +public: + int GetApiVersion() + { + return fail_version; + } + + bool Load(SourceMM::PluginId id, SourceMM::ISmmAPI *ismm, char *error, size_t maxlength, bool late) + { + if (error != NULL && maxlength != 0) + { + UTIL_Format(error, maxlength, "%s", error_buffer); + } + return false; + } + + int fail_version; + char error_buffer[512]; +} s_FailPlugin; size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...) { @@ -82,141 +102,241 @@ size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...) return len; } -METAMOD_PLUGIN *TryAndLoadLibrary(const char *path) +METAMOD_PLUGIN *_GetPluginPtr(const char *path, int fail_api) { - if ((stripper_library = LoadLibrary(path)) == NULL) + METAMOD_FN_ORIG_LOAD fn; + METAMOD_PLUGIN *pl; + int ret; + + if (!(g_hCore=openlib(path))) { - return NULL; +#if defined __linux__ || defined __APPLE__ + UTIL_Format(s_FailPlugin.error_buffer, + sizeof(s_FailPlugin.error_buffer), + "%s", + dlerror()); +#else + DWORD err = GetLastError(); + + if (FormatMessageA( + FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + err, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + s_FailPlugin.error_buffer, + sizeof(s_FailPlugin.error_buffer), + NULL) + == 0) + { + UTIL_Format(s_FailPlugin.error_buffer, + sizeof(s_FailPlugin.error_buffer), + "unknown error %x", + err); + } +#endif + + s_FailPlugin.fail_version = fail_api; + + return (METAMOD_PLUGIN *)&s_FailPlugin; } - METAMOD_FN_ORIG_LOAD ld = (METAMOD_FN_ORIG_LOAD)GetProcAddress(stripper_library, "CreateInterface"); - if (ld == NULL) + if (!(fn=(METAMOD_FN_ORIG_LOAD)findsym(g_hCore, "CreateInterface"))) { - FreeLibrary(stripper_library); - stripper_library = NULL; - return NULL; + goto error; } - int ret; - METAMOD_PLUGIN *pl = (METAMOD_PLUGIN *)ld(METAMOD_PLAPI_NAME, &ret); - if (pl == NULL) + pl = (METAMOD_PLUGIN *)fn(METAMOD_PLAPI_NAME, &ret); + if (!pl) { - FreeLibrary(stripper_library); - stripper_library = NULL; - return NULL; + goto error; } return pl; +error: + closelib(g_hCore); + g_hCore = NULL; + return NULL; } -EXPORT METAMOD_PLUGIN *CreateInterface_MMS(const MetamodVersionInfo *mvi, const MetamodLoaderInfo *mli) +DLL_EXPORT METAMOD_PLUGIN *CreateInterface_MMS(const MetamodVersionInfo *mvi, const MetamodLoaderInfo *mli) { - /* We can only handle API v2 right now. In case the plugin API gets bumped, - * we ignore other cases. - */ - if (mvi->api_major != 2) + const char *filename; + + load_attempted = true; + + if (mvi->api_major > METAMOD_API_MAJOR) { return NULL; } - const char *file = NULL; - switch (mvi->source_engine) { - case SOURCE_ENGINE_ORANGEBOX: - file = MMS_1_6_EP2_FILE; + case SOURCE_ENGINE_ORIGINAL: + case SOURCE_ENGINE_EPISODEONE: + { + filename = FILENAME_1_6_EP1; break; - case SOURCE_ENGINE_TF2: - file = MMS_1_6_TF2_FILE; + } + case SOURCE_ENGINE_ORANGEBOX: + { + filename = FILENAME_1_6_EP2; break; - case SOURCE_ENGINE_DODS: - file = MMS_1_6_DODS_FILE; + } + case SOURCE_ENGINE_LEFT4DEAD: + { + filename = FILENAME_1_6_L4D; break; - case SOURCE_ENGINE_HL2DM: - file = MMS_1_6_HL2DM_FILE; + } + case SOURCE_ENGINE_DARKMESSIAH: + { + filename = FILENAME_1_6_DARKM; break; - case SOURCE_ENGINE_NUCLEARDAWN: - file = MMS_1_6_ND_FILE; + } + case SOURCE_ENGINE_LEFT4DEAD2: + { + const char *gamedir = mvi->GetGameDir(); + if (strcmp(gamedir, "nucleardawn") == 0) + { + filename = FILENAME_1_6_ND; + } + else + { + filename = FILENAME_1_6_L4D2; + } break; - case SOURCE_ENGINE_ORIGINAL: - case SOURCE_ENGINE_EPISODEONE: - file = MMS_1_6_EP1_FILE; + } + case SOURCE_ENGINE_NUCLEARDAWN: + { + filename = FILENAME_1_6_ND; break; - case SOURCE_ENGINE_LEFT4DEAD: - file = MMS_1_6_L4D_FILE; + } + case SOURCE_ENGINE_CONTAGION: + { + filename = FILENAME_1_6_CONTAGION; break; - case SOURCE_ENGINE_LEFT4DEAD2: - file = MMS_1_6_L4D2_FILE; + } + case SOURCE_ENGINE_ALIENSWARM: + { + filename = FILENAME_1_6_SWARM; break; - case SOURCE_ENGINE_DARKMESSIAH: - file = MMS_1_6_DARKM_FILE; + } + case SOURCE_ENGINE_BLOODYGOODTIME: + { + filename = FILENAME_1_6_BGT; break; - case SOURCE_ENGINE_ALIENSWARM: - file = MMS_1_6_SWARM_FILE; + } + case SOURCE_ENGINE_EYE: + { + filename = FILENAME_1_6_EYE; break; - case SOURCE_ENGINE_BLOODYGOODTIME: - file = MMS_1_6_BGT_FILE; + } + case SOURCE_ENGINE_PORTAL2: + { + filename = FILENAME_1_6_PORTAL2; break; - case SOURCE_ENGINE_CSS: - file = MMS_1_6_CSS_FILE; + } + case SOURCE_ENGINE_CSGO: + { + filename = FILENAME_1_6_CSGO; break; - case SOURCE_ENGINE_CSGO: - file = MMS_1_6_CSGO_FILE; + } + case SOURCE_ENGINE_CSS: + { + filename = FILENAME_1_6_CSS; break; - case SOURCE_ENGINE_INSURGENCY: - file = MMS_1_6_INS_FILE; + } + case SOURCE_ENGINE_HL2DM: + { + filename = FILENAME_1_6_HL2DM; break; - case SOURCE_ENGINE_SDK2013: - file = MMS_1_6_SDK2013_FILE; + } + case SOURCE_ENGINE_DODS: + { + filename = FILENAME_1_6_DODS; break; - case SOURCE_ENGINE_BMS: - file = MMS_1_6_BMS_FILE; + } + case SOURCE_ENGINE_SDK2013: + { + filename = FILENAME_1_6_SDK2013; break; - } - - char our_path[256]; - UTIL_Format(our_path, sizeof(our_path), "%s" PATH_SEP_CHAR "%s", mli->pl_path, file); - - return TryAndLoadLibrary(our_path); -} - -EXPORT void UnloadInterface_MMS() -{ - if (stripper_library != NULL) - { - FreeLibrary(stripper_library); - stripper_library = NULL; - } -} - -EXPORT void *CreateInterface(const char *pName, int *pReturnCode) -{ - if (strcmp(pName, METAMOD_PLAPI_NAME) == 0) - { - char our_file[256]; - if (!GetFileOfAddress((void *)CreateInterface_MMS, our_file, sizeof(our_file))) + } + case SOURCE_ENGINE_BMS: { - return NULL; + filename = FILENAME_1_6_BMS; + break; } - - /* Go backwards and get the first token */ - size_t len = strlen(our_file); - for (size_t i = len; i-- > 0;) + case SOURCE_ENGINE_TF2: { - if (IsPathSepChar(our_file[i])) + filename = FILENAME_1_6_TF2; + break; + } + case SOURCE_ENGINE_ORANGEBOXVALVE_DEPRECATED: + { + const char *gamedir = mvi->GetGameDir(); + if (strcmp(gamedir, "tf") == 0) { - our_file[i] = '\0'; - break; + filename = FILENAME_1_6_TF2; } + else if (strcmp(gamedir, "dod") == 0) + { + filename = FILENAME_1_6_DODS; + } + else if (strcmp(gamedir, "hl2mp") == 0) + { + filename = FILENAME_1_6_HL2DM; + } + else + { + return NULL; + } + break; + } + case SOURCE_ENGINE_BLADE: + { + filename = FILENAME_1_6_BLADE; + break; + } + case SOURCE_ENGINE_INSURGENCY: + { + filename = FILENAME_1_6_INSURGENCY; + break; } + case SOURCE_ENGINE_DOI: + { + filename = FILENAME_1_6_DOI; + break; + } +#ifdef SOURCE_ENGINE_MOCK + case SOURCE_ENGINE_MOCK: + { + filename = FILENAME_1_6_MOCK; + break; + } +#endif + case SOURCE_ENGINE_PVKII: + { + filename = FILENAME_1_6_PVKII; + break; + } + default: + { + return NULL; + } + } - char new_file[256]; - UTIL_Format(new_file, sizeof(new_file), "%s" PATH_SEP_CHAR MMS_1_4_EP1_FILE, our_file); + char abspath[256]; + UTIL_Format(abspath, sizeof(abspath), "%s" PATH_SEP_STR "%s", mli->pl_path, filename); - return TryAndLoadLibrary(new_file); - } + return _GetPluginPtr(abspath, METAMOD_FAIL_API_V2); +} - return NULL; +DLL_EXPORT void UnloadInterface_MMS() +{ + if (g_hCore) + { + closelib(g_hCore); + g_hCore = NULL; + } } #if defined _MSC_VER @@ -229,10 +349,35 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) return TRUE; } #else -__attribute__((destructor)) -static void gcc_fini() +__attribute__((destructor)) static void gcc_fini() { UnloadInterface_MMS(); } #endif +/* Overload a few things to prevent libstdc++ linking */ +#if defined __linux__ || defined __APPLE__ +extern "C" void __cxa_pure_virtual(void) +{ +} + +void *operator new(size_t size) +{ + return malloc(size); +} + +void *operator new[](size_t size) +{ + return malloc(size); +} + +void operator delete(void *ptr) +{ + free(ptr); +} + +void operator delete[](void * ptr) +{ + free(ptr); +} +#endif \ No newline at end of file diff --git a/parser.cpp b/parser.cpp index 212e16e..e365def 100644 --- a/parser.cpp +++ b/parser.cpp @@ -1,5 +1,5 @@ /** vim: set ts=4 sw=4 et tw=99: - * + * * === Stripper for Metamod:Source === * Copyright (C) 2005-2009 David "BAILOPAN" Anderson * No warranties of any kind. @@ -9,7 +9,7 @@ * =================================== */ -#include "pcre.h" +#include "pcre/pcre.h" #include #include #include "parser.h" @@ -102,7 +102,7 @@ Stripper::~Stripper() delete m_PropCache.front(); m_PropCache.pop(); } - + free(m_tostring); } @@ -151,7 +151,7 @@ void Stripper::FreeProp(ent_prop *prop) void Stripper::SetEntityList(const char *ents) { Clear(); - + m_resync = false; AppendToString(ents, strlen(ents)); @@ -205,7 +205,7 @@ void Stripper::SetEntityList(const char *ents) } /* delete temporary string */ delete [] _tmp; - + /* build the real props list */ _BuildPropList(); } @@ -596,7 +596,7 @@ void Stripper::ApplyFileFilter(const char *file) } else if (!strncmp(buffer, "insert:", 7) && (mode == Mode_Replace)) { submode = SubMode_Insert; } else if (strcmp(buffer, "{")==0 && !in_block) { - /* if we reach a new block and we're not in a block, + /* if we reach a new block and we're not in a block, * dump the current props table and reset. */ if (mode != Mode_Replace || (mode == Mode_Replace && submode != SubMode_None)) @@ -605,11 +605,11 @@ void Stripper::ApplyFileFilter(const char *file) props.clear(); } } else if (strncmp(buffer, "}", 1) == 0 && in_block) { - /* if we reach the end of a block and we're in a block, + /* if we reach the end of a block and we're in a block, * mark the end and flush what we've done */ in_block = false; - + if (mode == Mode_Replace) { assert(submode != SubMode_None); @@ -652,8 +652,8 @@ void Stripper::ApplyFileFilter(const char *file) } else if (mode == Mode_Add) { RunAddFilter(props); } - - /* push each of the unused filters + + /* push each of the unused filters * and then clear the property list */ end = props.end(); diff --git a/parser.h b/parser.h index 5be87a7..3830208 100644 --- a/parser.h +++ b/parser.h @@ -1,5 +1,5 @@ /** vim: set ts=4 sw=4 et tw=99: - * + * * === Stripper for Metamod:Source === * Copyright (C) 2005-2009 David "BAILOPAN" Anderson * No warranties of any kind. @@ -14,7 +14,7 @@ #include #include #include -#include "pcre.h" +#include "pcre/pcre.h" struct CACHEABLE { diff --git a/pcre/AMBuilder b/pcre/AMBuilder new file mode 100644 index 0000000..1054afe --- /dev/null +++ b/pcre/AMBuilder @@ -0,0 +1,43 @@ +# vim: set sts=2 ts=2 sw=2 tw=99 et ft=python: +import os, platform + +builder.SetBuildFolder('libpcre') + +rvalue = {} +for cxx in builder.targets: + binary = MMS.StaticLibrary(builder, cxx, 'pcre') + binary.compiler.includes += [ + os.path.join(builder.sourcePath, 'pcre'), + ] + + binary.compiler.defines += [ + 'HAVE_CONFIG_H', + ] + + if binary.compiler.target.platform == 'linux': + binary.compiler.cflags += ['-Wno-int-in-bool-context'] + + binary.sources += [ + 'pcre_chartables.c', + 'pcre_compile.c', + 'pcre_config.c', + 'pcre_dfa_exec.c', + 'pcre_exec.c', + 'pcre_fullinfo.c', + 'pcre_get.c', + 'pcre_globals.c', + 'pcre_info.c', + 'pcre_newline.c', + 'pcre_maketables.c', + 'pcre_ord2utf8.c', + 'pcre_refcount.c', + 'pcre_study.c', + 'pcre_tables.c', + 'pcre_try_flipped.c', + 'pcre_ucd.c', + 'pcre_valid_utf8.c', + 'pcre_version.c', + 'pcre_xclass.c', + ] + + rvalue[binary.compiler.target.arch] = builder.Add(binary) \ No newline at end of file diff --git a/pcre/config-linux.h b/pcre/config-linux.h new file mode 100644 index 0000000..8783c1b --- /dev/null +++ b/pcre/config-linux.h @@ -0,0 +1,44 @@ +/* config.h for CMake builds */ + +#define HAVE_DIRENT_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_UNISTD_H 1 +/* #undef HAVE_WINDOWS_H */ + +/* #undef HAVE_TYPE_TRAITS_H */ +/* #undef HAVE_BITS_TYPE_TRAITS_H */ + +#define HAVE_BCOPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_STRERROR 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOQ 1 +/* #undef HAVE__STRTOI64 */ + +// #define PCRE_STATIC 1 + +/* #undef SUPPORT_UTF8 */ +/* #undef SUPPORT_UCP */ +/* #undef EBCDIC */ +/* #undef BSR_ANYCRLF */ +/* #undef NO_RECURSE */ + +#define HAVE_LONG_LONG 1 +#define HAVE_UNSIGNED_LONG_LONG 1 + +/* #undef SUPPORT_LIBBZ2 */ +#define SUPPORT_LIBZ 1 +/* #undef SUPPORT_LIBREADLINE */ + +#define NEWLINE 10 +#define POSIX_MALLOC_THRESHOLD 10 +#define LINK_SIZE 2 +#define MATCH_LIMIT 10000000 +#define MATCH_LIMIT_RECURSION MATCH_LIMIT + + +#define MAX_NAME_SIZE 32 +#define MAX_NAME_COUNT 10000 + +/* end config.h for CMake builds */ diff --git a/pcre/config-win.h b/pcre/config-win.h new file mode 100644 index 0000000..8783c1b --- /dev/null +++ b/pcre/config-win.h @@ -0,0 +1,44 @@ +/* config.h for CMake builds */ + +#define HAVE_DIRENT_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_UNISTD_H 1 +/* #undef HAVE_WINDOWS_H */ + +/* #undef HAVE_TYPE_TRAITS_H */ +/* #undef HAVE_BITS_TYPE_TRAITS_H */ + +#define HAVE_BCOPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_STRERROR 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOQ 1 +/* #undef HAVE__STRTOI64 */ + +// #define PCRE_STATIC 1 + +/* #undef SUPPORT_UTF8 */ +/* #undef SUPPORT_UCP */ +/* #undef EBCDIC */ +/* #undef BSR_ANYCRLF */ +/* #undef NO_RECURSE */ + +#define HAVE_LONG_LONG 1 +#define HAVE_UNSIGNED_LONG_LONG 1 + +/* #undef SUPPORT_LIBBZ2 */ +#define SUPPORT_LIBZ 1 +/* #undef SUPPORT_LIBREADLINE */ + +#define NEWLINE 10 +#define POSIX_MALLOC_THRESHOLD 10 +#define LINK_SIZE 2 +#define MATCH_LIMIT 10000000 +#define MATCH_LIMIT_RECURSION MATCH_LIMIT + + +#define MAX_NAME_SIZE 32 +#define MAX_NAME_COUNT 10000 + +/* end config.h for CMake builds */ diff --git a/pcre/config.h b/pcre/config.h new file mode 100644 index 0000000..adb1c82 --- /dev/null +++ b/pcre/config.h @@ -0,0 +1,5 @@ +#ifdef __linux__ +# include "config-linux.h" +#elif defined(WIN32) +# include "config-win.h" +#endif \ No newline at end of file diff --git a/pcre/libpcre-darwin.a b/pcre/libpcre-darwin.a deleted file mode 100644 index b63ad4a..0000000 Binary files a/pcre/libpcre-darwin.a and /dev/null differ diff --git a/pcre/libpcre-linux.a b/pcre/libpcre-linux.a deleted file mode 100644 index e1c2ddb..0000000 Binary files a/pcre/libpcre-linux.a and /dev/null differ diff --git a/pcre/libpcre-windows.lib b/pcre/libpcre-windows.lib deleted file mode 100755 index bea9065..0000000 Binary files a/pcre/libpcre-windows.lib and /dev/null differ diff --git a/pcre.h b/pcre/pcre.h similarity index 96% rename from pcre.h rename to pcre/pcre.h index 77720e1..041f364 100644 --- a/pcre.h +++ b/pcre/pcre.h @@ -5,7 +5,7 @@ /* This is the public header file for the PCRE library, to be #included by applications that call the PCRE functions. - Copyright (c) 1997-2007 University of Cambridge + Copyright (c) 1997-2009 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without @@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE. /* The current PCRE version information. */ #define PCRE_MAJOR 7 -#define PCRE_MINOR 4 -#define PCRE_PRERELEASE -#define PCRE_DATE 2007-09-21 +#define PCRE_MINOR 9 +#define PCRE_PRERELEASE +#define PCRE_DATE 2009-04-11 /* When an application links to a PCRE DLL in Windows, the symbols that are imported have to be identified as such. When building PCRE, the appropriate @@ -97,7 +97,8 @@ it is needed here for malloc. */ extern "C" { #endif -/* Options */ +/* Options. Some are compile-time only, some are run-time only, and some are +both, so we keep them all distinct. */ #define PCRE_CASELESS 0x00000001 #define PCRE_MULTILINE 0x00000002 @@ -126,6 +127,9 @@ extern "C" { #define PCRE_NEWLINE_ANYCRLF 0x00500000 #define PCRE_BSR_ANYCRLF 0x00800000 #define PCRE_BSR_UNICODE 0x01000000 +#define PCRE_JAVASCRIPT_COMPAT 0x02000000 +#define PCRE_NO_START_OPTIMIZE 0x04000000 +#define PCRE_NO_START_OPTIMISE 0x04000000 /* Exec-time and get/set-time error codes */ diff --git a/pcre/pcre_chartables.c b/pcre/pcre_chartables.c new file mode 100644 index 0000000..ae45db0 --- /dev/null +++ b/pcre/pcre_chartables.c @@ -0,0 +1,198 @@ +/************************************************* +* Perl-Compatible Regular Expressions * +*************************************************/ + +/* This file contains character tables that are used when no external tables +are passed to PCRE by the application that calls it. The tables are used only +for characters whose code values are less than 256. + +This is a default version of the tables that assumes ASCII encoding. A program +called dftables (which is distributed with PCRE) can be used to build +alternative versions of this file. This is necessary if you are running in an +EBCDIC environment, or if you want to default to a different encoding, for +example ISO-8859-1. When dftables is run, it creates these tables in the +current locale. If PCRE is configured with --enable-rebuild-chartables, this +happens automatically. + +The following #includes are present because without the gcc 4.x may remove the +array definition from the final binary if PCRE is built into a static library +and dead code stripping is activated. This leads to link errors. Pulling in the +header ensures that the array gets flagged as "someone outside this compilation +unit might reference this" and so it will always be supplied to the linker. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "pcre_internal.h" + +const unsigned char _pcre_default_tables[] = { + +/* This table is a lower casing table. */ + + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, + 64, 97, 98, 99,100,101,102,103, + 104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119, + 120,121,122, 91, 92, 93, 94, 95, + 96, 97, 98, 99,100,101,102,103, + 104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119, + 120,121,122,123,124,125,126,127, + 128,129,130,131,132,133,134,135, + 136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151, + 152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167, + 168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183, + 184,185,186,187,188,189,190,191, + 192,193,194,195,196,197,198,199, + 200,201,202,203,204,205,206,207, + 208,209,210,211,212,213,214,215, + 216,217,218,219,220,221,222,223, + 224,225,226,227,228,229,230,231, + 232,233,234,235,236,237,238,239, + 240,241,242,243,244,245,246,247, + 248,249,250,251,252,253,254,255, + +/* This table is a case flipping table. */ + + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, + 64, 97, 98, 99,100,101,102,103, + 104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119, + 120,121,122, 91, 92, 93, 94, 95, + 96, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90,123,124,125,126,127, + 128,129,130,131,132,133,134,135, + 136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151, + 152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167, + 168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183, + 184,185,186,187,188,189,190,191, + 192,193,194,195,196,197,198,199, + 200,201,202,203,204,205,206,207, + 208,209,210,211,212,213,214,215, + 216,217,218,219,220,221,222,223, + 224,225,226,227,228,229,230,231, + 232,233,234,235,236,237,238,239, + 240,241,242,243,244,245,246,247, + 248,249,250,251,252,253,254,255, + +/* This table contains bit maps for various character classes. Each map is 32 +bytes long and the bits run from the least significant end of each byte. The +classes that have their own maps are: space, xdigit, digit, upper, lower, word, +graph, print, punct, and cntrl. Other classes are built from combinations. */ + + 0x00,0x3e,0x00,0x00,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + + 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03, + 0x7e,0x00,0x00,0x00,0x7e,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + + 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xfe,0xff,0xff,0x07,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0x07, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + + 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03, + 0xfe,0xff,0xff,0x87,0xfe,0xff,0xff,0x07, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + + 0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + + 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + + 0x00,0x00,0x00,0x00,0xfe,0xff,0x00,0xfc, + 0x01,0x00,0x00,0xf8,0x01,0x00,0x00,0x78, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + + 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + +/* This table identifies various classes of character by individual bits: + 0x01 white space character + 0x02 letter + 0x04 decimal digit + 0x08 hexadecimal digit + 0x10 alphanumeric or '_' + 0x80 regular expression metacharacter or binary zero +*/ + + 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0- 7 */ + 0x00,0x01,0x01,0x00,0x01,0x01,0x00,0x00, /* 8- 15 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 16- 23 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 24- 31 */ + 0x01,0x00,0x00,0x00,0x80,0x00,0x00,0x00, /* - ' */ + 0x80,0x80,0x80,0x80,0x00,0x00,0x80,0x00, /* ( - / */ + 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, /* 0 - 7 */ + 0x1c,0x1c,0x00,0x00,0x00,0x00,0x00,0x80, /* 8 - ? */ + 0x00,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x12, /* @ - G */ + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* H - O */ + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* P - W */ + 0x12,0x12,0x12,0x80,0x80,0x00,0x80,0x10, /* X - _ */ + 0x00,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x12, /* ` - g */ + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* h - o */ + 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* p - w */ + 0x12,0x12,0x12,0x80,0x80,0x00,0x00,0x00, /* x -127 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 128-135 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 136-143 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 144-151 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 152-159 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 160-167 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 168-175 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 176-183 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 184-191 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 192-199 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 200-207 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 208-215 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 216-223 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 224-231 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 232-239 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 240-247 */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */ + +/* End of pcre_chartables.c */ diff --git a/stripper_core.sln b/stripper_core.sln deleted file mode 100755 index 7ebb727..0000000 --- a/stripper_core.sln +++ /dev/null @@ -1,22 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stripper_core", "stripper_core.vcproj", "{836E726E-AB80-43AB-9A8F-0E6EE680B0F6}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release - Original|Win32 = Release - Original|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {836E726E-AB80-43AB-9A8F-0E6EE680B0F6}.Debug|Win32.ActiveCfg = Debug|Win32 - {836E726E-AB80-43AB-9A8F-0E6EE680B0F6}.Debug|Win32.Build.0 = Debug|Win32 - {836E726E-AB80-43AB-9A8F-0E6EE680B0F6}.Release - Original|Win32.ActiveCfg = Release - Original|Win32 - {836E726E-AB80-43AB-9A8F-0E6EE680B0F6}.Release - Original|Win32.Build.0 = Release - Original|Win32 - {836E726E-AB80-43AB-9A8F-0E6EE680B0F6}.Release|Win32.ActiveCfg = Release|Win32 - {836E726E-AB80-43AB-9A8F-0E6EE680B0F6}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/stripper_core.vcproj b/stripper_core.vcproj deleted file mode 100755 index 3c021d2..0000000 --- a/stripper_core.vcproj +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/support.h b/support.h index a2d3c77..31dd926 100644 --- a/support.h +++ b/support.h @@ -1,5 +1,5 @@ /** vim: set ts=4 sw=4 et tw=99: - * + * * === Stripper for Metamod:Source === * Copyright (C) 2005-2009 David "BAILOPAN" Anderson * No warranties of any kind.