Compare commits

27 Commits
Author SHA1 Message Date
jenz 2d022bf65b we were missing the MHook_BeginAuthSession. for some unknown reason the hook dies, so its constantly reapplied when changing map. 2025-11-06 18:36:02 +00:00
xen 22cbf25c05 End our auth session immediately 2025-02-22 18:44:48 +02:00
xen c89f843e65 Update build scripts 2025-02-22 16:43:48 +02:00
xen 978df62e83 Fix compile for default sourcemod and new SDK 2025-02-22 16:43:38 +02:00
christian 9fa56918d6 added simple readme reminder 2021-07-03 14:45:06 +02:00
christian ed48779c05 updated extension.cpp and updated AMBuildScript to actually work 2021-07-03 11:28:12 +02:00
UNLOZE 5055096c86 adding game description and map name override 2020-01-20 18:46:33 +01:00
pan32 f0731ceee2 Logging Convar 2019-11-17 14:52:07 +01:00
BotoX fcf1d95fba fix uninitialized struct members? 2019-11-07 15:07:12 +01:00
BotoX 42b85aa02c remove sanity checks, add player_changename event 2019-11-05 16:52:28 +01:00
BotoX 91dac016f1 Fix Source Engine bug where fakeclients don't disconnect properly on mapchange. 2019-09-29 22:12:35 +02:00
BotoX 77604e3fcd 1.10 2019-09-25 21:16:24 +02:00
BotoX 0352522795 fake dogans 2019-09-23 16:20:43 +02:00
BotoX 40f6b8679d bugfix 2019-08-01 17:50:09 +02:00
BotoX e4bc7ce0bb SANITY CHECK AND LOG ALLL THE THINGS !!!!! 2019-07-30 23:19:45 +02:00
BotoX 7b8d71d1fa curtime resets on mapchange, use net_time 2019-07-28 15:49:35 +02:00
BotoX 84e07e975e Add A2S_INFO and A2S_PLAYER querycache which also counts nosteam players and sourcetv
fix player_disconnect when player disconnects during mapchange
2019-07-27 20:56:27 +02:00
BotoX 21a9b80bbd fix last commit? STEAM_ID_PENDING bug ... 2018-09-08 22:07:59 +02:00
BotoX cc68fe8e3c fix player disconnect hook firing on mapchange
bump version
2018-09-06 19:03:52 +02:00
BotoX 3cf54e32eb improve logging, fix OnClientDisconnecting and add some steamid-already-exists logic 2018-09-06 12:57:57 +02:00
BotoX 7adf2e1fe0 possibly fix bug where steam players are marked as nosteam 2018-08-17 23:29:43 +02:00
BotoX 55c7660c5c 1.9-dev 2018-08-08 19:49:42 +02:00
BotoX b8de0a49f9 fix build on latest sourcemod 2018-08-08 01:47:05 +02:00
BotoX 5d04944952 nosteam detection WIP 2018-08-08 01:47:04 +02:00
BotoX 90a8a1e3a4 Proper nosteam 2017-02-12 20:11:59 +01:00
BotoX d196f352c2 Cleaned up, added nosteam functionality and force validation when steam servers are down. 2017-02-03 15:36:13 +01:00
BotoX c0f5bee161 initial commit 2016-05-08 22:12:08 +02:00
31 changed files with 2330 additions and 1683 deletions
-6
View File
@@ -1,6 +0,0 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
-178
View File
@@ -1,178 +0,0 @@
name: Extension builder
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
strategy:
matrix:
os: [ubuntu-22.04, windows-2022]
include:
- os: ubuntu-22.04
cc: clang-11
cxx: clang++-11
- os: windows-2022
cc: msvc
fail-fast: false
name: ${{ matrix.os }} - ${{ matrix.cc }}
runs-on: ${{ matrix.os }}
env:
PROJECT: 'connect'
SDKS: 'css hl2dm dods tf2'
MMSOURCE_VERSION: '1.12'
SOURCEMOD_VERSION: '1.12'
CACHE_PATH: ${{ github.workspace }}/cache
steps:
- name: Concatenate SDK Names
shell: bash
run: |
# Paranoia
SDKS_VAR="${{env.SDKS}}"
# This will be used in our cache key
echo "SDKS_KEY=${SDKS_VAR//[[:blank:]]/}" >> $GITHUB_ENV
- name: Linux dependencies
if: startsWith(runner.os, 'Linux')
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
gcc-multilib g++-multilib libstdc++6 lib32stdc++6 \
libc6-dev libc6-dev-i386 linux-libc-dev \
linux-libc-dev:i386 lib32z1-dev ${{ matrix.cc }}
- uses: actions/setup-python@v5
name: Setup Python 3.9
with:
python-version: 3.9
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
- uses: actions/checkout@v4
name: Repository checkout
with:
fetch-depth: 0
path: extension
- uses: actions/cache@v4
name: Cache dependencies
env:
cache-name: connect-cache
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-sm${{ env.SOURCEMOD_VERSION }}-mmsource${{ env.MMSOURCE_VERSION }}-${{ env.SDKS_KEY }}
- shell: bash
name: Install dependencies
run: |
mkdir -p "${{ env.CACHE_PATH }}"
cd "${{ env.CACHE_PATH }}"
shallow_checkout () {
# Param 1 is origin
# Param 2 is branch
# Param 3 is name
if [ ! -d "$3" ]; then
git clone "$1" --depth 1 --branch "$2" "$3"
fi
cd "$3"
git submodule deinit --all --force
git remote set-url origin "$1"
git fetch --depth 1 origin "$2"
git checkout --force --recurse-submodules FETCH_HEAD
git submodule init
git submodule update --depth 1
cd ..
}
# We are aware of what we are doing!
git config --global advice.detachedHead false
# Verify github cache, and see if we don't have the sdks already cloned and update them
for sdk in ${{ env.SDKS }}
do
shallow_checkout "https://github.com/alliedmodders/hl2sdk" "${sdk}" "hl2sdk-${sdk}"
done
shallow_checkout "https://github.com/alliedmodders/ambuild" "master" "ambuild"
shallow_checkout "https://github.com/alliedmodders/sourcemod" "${{env.SOURCEMOD_VERSION}}-dev" "sourcemod"
shallow_checkout "https://github.com/alliedmodders/metamod-source/" "${{env.MMSOURCE_VERSION}}-dev" "metamod-source"
# But maybe others aren't (also probably unnecessary because git actions but paranoia)
git config --global advice.detachedHead true
- name: Setup AMBuild
shell: bash
run: |
cd "${{ env.CACHE_PATH }}"
python -m pip install ./ambuild
- name: Select clang compiler
if: startsWith(runner.os, 'Linux')
run: |
echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
${{ matrix.cc }} --version
${{ matrix.cxx }} --version
- name: Build
shell: bash
working-directory: extension
run: |
mkdir build
cd build
python ../configure.py --enable-auto-versioning --enable-optimize --sdks="${{ env.SDKS }}" --mms-path="${{ env.CACHE_PATH }}/metamod-source" --hl2sdk-root="${{ env.CACHE_PATH }}" --sm-path="${{ env.CACHE_PATH }}/sourcemod"
ambuild
PLATFORM="${{ runner.os }}"
FILENAME="$(cat ./includes/filename_versioning.txt)"
ZIP_FILENAME="${{ env.PROJECT }}-${FILENAME}-${PLATFORM,}.zip"
echo "ZIP_FILENAME=${ZIP_FILENAME}" >> $GITHUB_ENV
# if: github.event_name == 'push' && github.ref == 'refs/heads/action' &&
- name: Package release - Windows
if: startsWith(matrix.os, 'windows-')
working-directory: extension/build/package
run: |
Compress-Archive -Path * -Destination ${{ env.ZIP_FILENAME }}
Copy-Item -Path ${{ env.ZIP_FILENAME }} -Destination ${{ matrix.os }}_${{ matrix.cc }}_${{ env.ZIP_FILENAME }}
- name: Package release - Linux
if: startsWith(matrix.os, 'ubuntu-')
working-directory: extension/build/package
run: |
zip -r "${{ env.ZIP_FILENAME }}" .
cp "${{ env.ZIP_FILENAME }}" "${{ matrix.os }}_${{ matrix.cc }}_${{ env.ZIP_FILENAME }}"
- name: Upload release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
shell: bash
working-directory: extension/build/package
run: |
echo "Begin upload..."
AUTHORIZATION="$(echo -n '${{ secrets.USERNAME }}:${{ secrets.PASSWORD }}' | base64)"
echo "::add-mask::${AUTHORIZATION}"
HTTP_CODE=$(curl -XPOST -H "Authorization: Basic ${AUTHORIZATION}" -H "Content-Type: application/zip" --output /dev/null --silent --write-out "%{http_code}" --data-binary "@${{ env.ZIP_FILENAME }}" "https://builds.limetech.io/upload.php?project=${{ env.PROJECT }}&filename=${{ env.ZIP_FILENAME }}")
if test ${HTTP_CODE} -ne 200; then
exit ${HTTP_CODE}
fi
echo "Upload successful!"
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
# Artifact name
name: ${{ matrix.os }}_${{ matrix.cc }}_${{ env.ZIP_FILENAME }}
# optional, default is artifact
# A file, directory or wildcard pattern that describes what to upload
path: ${{ github.workspace }}/extension/build/package/${{ matrix.os }}_${{ matrix.cc }}_${{ env.ZIP_FILENAME }}
# The desired behavior if no files are found using the provided path.
if-no-files-found: error
# Duration after which artifact will expire in days. 0 means using default retention.
retention-days: 14
+2 -4
View File
@@ -1,4 +1,2 @@
build *build/
Containerfile *vs
.venv
safetyhook
+3
View File
@@ -0,0 +1,3 @@
[submodule "hl2sdk-manifests"]
path = hl2sdk-manifests
url = https://github.com/alliedmodders/hl2sdk-manifests
+143 -382
View File
@@ -1,75 +1,5 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python: # vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os, sys, shutil import os
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.platform = platform
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
WinLinux = ['windows', 'linux']
CSS = {
'windows': ['x86', 'x86_64'],
'linux': ['x86', 'x86_64']
}
HL2DM = {
'windows': ['x86', 'x86_64'],
'linux': ['x86', 'x86_64']
}
DODS = {
'windows': ['x86', 'x86_64'],
'linux': ['x86', 'x86_64']
}
TF2 = {
'windows': ['x86', 'x86_64'],
'linux': ['x86', 'x86_64']
}
CSGO = {
'windows': ['x86'],
'linux': ['x86', 'x86_64']
}
PossibleSDKs = {
# 'episode1': SDK('HL2SDK', '1.ep1', '1', 'EPISODEONE', WinLinux, 'episode1'),
# 'darkm': SDK('HL2SDK-DARKM', '2.darkm', '2', 'DARKMESSIAH', WinOnly, 'darkm'),
# 'orangebox': SDK('HL2SDKOB', '2.ep2', '3', 'ORANGEBOX', WinLinux, 'orangebox'),
# 'bgt': SDK('HL2SDK-BGT', '2.bgt', '4', 'BLOODYGOODTIME', WinOnly, 'bgt'),
# 'eye': SDK('HL2SDK-EYE', '2.eye', '5', 'EYE', WinOnly, 'eye'),
'css': SDK('HL2SDKCSS', '2.css', '6', 'CSS', CSS, 'css'),
'hl2dm': SDK('HL2SDKHL2DM', '2.hl2dm', '7', 'HL2DM', HL2DM, 'hl2dm'),
'dods': SDK('HL2SDKDODS', '2.dods', '8', 'DODS', DODS, 'dods'),
'sdk2013': SDK('HL2SDK2013', '2.sdk2013', '9', 'SDK2013', WinLinux, 'sdk2013'),
# 'bms': SDK('HL2SDKBMS', '2.bms', '11', 'BMS', WinLinux, 'bms'),
'tf2': SDK('HL2SDKTF2', '2.tf2', '12', 'TF2', TF2, 'tf2'),
'l4d': SDK('HL2SDKL4D', '2.l4d', '13', 'LEFT4DEAD', WinLinux, 'l4d'),
# 'nucleardawn': SDK('HL2SDKND', '2.nd', '14', 'NUCLEARDAWN', WinLinuxMac, 'nucleardawn'),
# 'contagion': SDK('HL2SDKCONTAGION', '2.contagion', '15', 'CONTAGION', WinOnly, 'contagion'),
'l4d2': SDK('HL2SDKL4D2', '2.l4d2', '16', 'LEFT4DEAD2', WinLinux, 'l4d2'),
# 'swarm': SDK('HL2SDK-SWARM', '2.swarm', '17', 'ALIENSWARM', WinOnly, 'swarm'),
# 'portal2': SDK('HL2SDKPORTAL2', '2.portal2', '18', 'PORTAL2', [], 'portal2'),
# 'insurgency': SDK('HL2SDKINSURGENCY', '2.insurgency', '19', 'INSURGENCY', WinLinuxMac, 'insurgency'),
# 'blade': SDK('HL2SDKBLADE', '2.blade', '21', 'BLADE', WinLinux, 'blade'),
'csgo': SDK('HL2SDKCSGO', '2.csgo', '23', 'CSGO', CSGO, 'csgo'),
}
def ResolveEnvPath(env, folder): def ResolveEnvPath(env, folder):
if env in os.environ: if env in os.environ:
@@ -91,7 +21,7 @@ def ResolveEnvPath(env, folder):
def Normalize(path): def Normalize(path):
return os.path.abspath(os.path.normpath(path)) return os.path.abspath(os.path.normpath(path))
def SetArchFlags(compiler): def SetArchFlags(compiler):
if compiler.behavior == 'gcc': if compiler.behavior == 'gcc':
if compiler.target.arch == 'x86_64': if compiler.target.arch == 'x86_64':
@@ -100,10 +30,31 @@ def SetArchFlags(compiler):
if compiler.target.arch == 'x86_64': if compiler.target.arch == 'x86_64':
compiler.defines += ['WIN64'] compiler.defines += ['WIN64']
hl2sdk_manifests_path = None
# First we check if the manifest exists in the current path
hl2sdk_manifests_path = os.path.join(builder.sourcePath, 'hl2sdk-manifests/SdkHelpers.ambuild')
if not os.path.exists(hl2sdk_manifests_path):
# manifests does not exists in the project file, use the path from --hl2sdk-manifest-path
if not builder.options.hl2sdk_manifest:
raise Exception('HL2SDK Manifest root path not set! (--hl2sdk-manifest-path)')
else:
hl2sdk_manifests_path = os.path.join(builder.options.hl2sdk_manifest, 'SdkHelpers.ambuild')
if not os.path.exists(hl2sdk_manifests_path):
raise Exception('Could not find SdkHelpers.ambuild in the given HL2SDK Manifest path!')
SdkHelpers = builder.Eval(hl2sdk_manifests_path, {
'Project': 'sm-extension'
})
class ExtensionConfig(object): class ExtensionConfig(object):
def __init__(self): def __init__(self):
self.sdk_manifests = []
self.sdks = {} self.sdks = {}
self.binaries = [] self.sdk_targets = []
self.extensions = [] self.extensions = []
self.generated_headers = None self.generated_headers = None
self.mms_root = None self.mms_root = None
@@ -133,81 +84,36 @@ class ExtensionConfig(object):
raise Exception('No suitable C/C++ compiler was found.') raise Exception('No suitable C/C++ compiler was found.')
def use_auto_versioning(self): def use_auto_versioning(self):
if builder.backend != 'amb2':
return False
return not getattr(builder.options, 'disable_auto_versioning', False) return not getattr(builder.options, 'disable_auto_versioning', False)
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':
if binary.type == 'library':
binary.compiler.postlink += [
'-compatibility_version', '1.0.0',
'-current_version', self.productVersion
]
if self.use_auto_versioning():
binary.compiler.sourcedeps += self.generated_headers
return binary
@property @property
def tag(self): def tag(self):
if builder.options.debug == '1': if builder.options.debug == '1':
return 'Debug' return 'Debug'
return 'Release' return 'Release'
def detectProductVersion(self): def findSdkPath(self, sdk_name):
builder.AddConfigureFile('product.version') dir_name = 'hl2sdk-{}'.format(sdk_name)
if builder.options.hl2sdk_root:
sdk_path = os.path.join(builder.options.hl2sdk_root, dir_name)
if os.path.exists(sdk_path):
return sdk_path
return ResolveEnvPath('HL2SDK{}'.format(sdk_name.upper()), dir_name)
# For OS X dylib versioning def shouldIncludeSdk(self, sdk):
import re return not sdk.get('source2', False)
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): def detectSDKs(self):
sdk_list = builder.options.sdks.split(' ') sdk_list = [s for s in builder.options.sdks.split(',') if s]
use_none = sdk_list[0] == 'none' SdkHelpers.sdk_filter = self.shouldIncludeSdk
use_all = sdk_list[0] == 'all' SdkHelpers.find_sdk_path = self.findSdkPath
use_present = sdk_list[0] == 'present' SdkHelpers.findSdks(builder, self.all_targets, sdk_list)
for sdk_name in PossibleSDKs: self.sdks = SdkHelpers.sdks
sdk = PossibleSDKs[sdk_name] self.sdk_manifests = SdkHelpers.sdk_manifests
if sdk.shouldBuild(self.all_targets): self.sdk_targets = SdkHelpers.sdk_targets
if builder.options.hl2sdk_root:
sdk_path = os.path.join(builder.options.hl2sdk_root, sdk.folder)
else:
sdk_path = ResolveEnvPath(sdk.envvar, sdk.folder)
if sdk_path is None or not os.path.isdir(sdk_path):
if use_all or sdk_name in sdk_list:
raise Exception('Could not find a valid path for {0}'.format(sdk.envvar))
continue
if use_all or use_present or sdk_name in sdk_list:
sdk.path = Normalize(sdk_path)
self.sdks[sdk_name] = sdk
if len(self.sdks) < 1 and len(sdk_list) and not use_none:
raise Exception('No applicable SDKs were found, nothing to do')
if builder.options.sm_path:
self.sm_root = os.path.realpath(builder.options.sm_path)
else:
self.sm_root = ResolveEnvPath('SOURCEMOD112', 'sourcemod-1.12')
if not self.sm_root:
self.sm_root = ResolveEnvPath('SOURCEMOD', 'sourcemod')
if not self.sm_root:
self.sm_root = ResolveEnvPath('SOURCEMOD_DEV', 'sourcemod-central')
if not self.sm_root or not os.path.isdir(self.sm_root):
raise Exception('Could not find a source copy of SourceMod')
self.sm_root = Normalize(self.sm_root)
if builder.options.mms_path: if builder.options.mms_path:
self.mms_root = builder.options.mms_path self.mms_root = builder.options.mms_path
@@ -215,6 +121,8 @@ class ExtensionConfig(object):
self.mms_root = ResolveEnvPath('MMSOURCE112', 'mmsource-1.12') self.mms_root = ResolveEnvPath('MMSOURCE112', 'mmsource-1.12')
if not self.mms_root: if not self.mms_root:
self.mms_root = ResolveEnvPath('MMSOURCE', 'metamod-source') self.mms_root = ResolveEnvPath('MMSOURCE', 'metamod-source')
if not self.mms_root:
self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'metamod-source')
if not self.mms_root: if not self.mms_root:
self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'mmsource-central') self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'mmsource-central')
@@ -222,8 +130,26 @@ class ExtensionConfig(object):
raise Exception('Could not find a source copy of Metamod:Source') raise Exception('Could not find a source copy of Metamod:Source')
self.mms_root = Normalize(self.mms_root) self.mms_root = Normalize(self.mms_root)
if builder.options.sm_path:
self.sm_root = builder.options.sm_path
else:
self.sm_root = ResolveEnvPath('SOURCEMOD112', 'sourcemod-1.12')
if not self.sm_root:
self.sm_root = ResolveEnvPath('SOURCEMOD', 'sourcemod')
if not self.sm_root:
self.sm_root = ResolveEnvPath('SOURCEMOD_DEV', 'sourcemod')
if not self.sm_root:
self.sm_root = ResolveEnvPath('SOURCEMOD_DEV', 'sourcemod-central')
if not self.sm_root or not os.path.isdir(self.sm_root):
raise Exception('Could not find a source copy of SourceMod')
self.sm_root = Normalize(self.sm_root)
def configure(self): def configure(self):
if not set(self.target_archs).issubset(['x86', 'x86_64']):
allowed_archs = ['x86','x86_64']
if not set(self.target_archs).issubset(allowed_archs):
raise Exception('Unknown target architecture: {0}'.format(self.target_archs)) raise Exception('Unknown target architecture: {0}'.format(self.target_archs))
for cxx in self.all_targets: for cxx in self.all_targets:
@@ -234,8 +160,8 @@ class ExtensionConfig(object):
if cxx.version < 1914 and builder.options.generator != 'vs': if cxx.version < 1914 and builder.options.generator != 'vs':
raise Exception(f'Only MSVC 2017 15.7 and later are supported, full C++17 support is required. ({str(cxx.version)} < 1914)') raise Exception(f'Only MSVC 2017 15.7 and later are supported, full C++17 support is required. ({str(cxx.version)} < 1914)')
elif cxx.family == 'gcc': elif cxx.family == 'gcc':
if cxx.version < 'gcc-9': if cxx.version < 'gcc-8':
raise Exception('Only GCC versions 9 or later are supported, full C++17 support is required.') raise Exception('Only GCC versions 8 or later are supported, full C++17 support is required.')
elif cxx.family == 'clang': elif cxx.family == 'clang':
if cxx.version < 'clang-5': if cxx.version < 'clang-5':
raise Exception('Only clang versions 5 or later are supported, full C++17 support is required.') raise Exception('Only clang versions 5 or later are supported, full C++17 support is required.')
@@ -245,7 +171,7 @@ class ExtensionConfig(object):
elif cxx.family == 'msvc': elif cxx.family == 'msvc':
self.configure_msvc(cxx) self.configure_msvc(cxx)
# Optimizaiton # Optimization
if builder.options.opt == '1': if builder.options.opt == '1':
cxx.defines += ['NDEBUG'] cxx.defines += ['NDEBUG']
@@ -261,16 +187,6 @@ class ExtensionConfig(object):
elif cxx.target.platform == 'windows': elif cxx.target.platform == 'windows':
self.configure_windows(cxx) self.configure_windows(cxx)
cxx.includes += [
os.path.join(self.sm_root, 'public'),
]
if self.use_auto_versioning():
cxx.defines += ['SM_GENERATED_BUILD']
cxx.includes += [
os.path.join(builder.buildPath, 'includes')
]
def configure_gcc(self, cxx): def configure_gcc(self, cxx):
cxx.defines += [ cxx.defines += [
'stricmp=strcasecmp', 'stricmp=strcasecmp',
@@ -288,62 +204,48 @@ class ExtensionConfig(object):
'-Wno-unused', '-Wno-unused',
'-Wno-switch', '-Wno-switch',
'-Wno-array-bounds', '-Wno-array-bounds',
'-msse',
'-Wno-unknown-pragmas',
'-Wno-dangling-else',
'-fvisibility=hidden', '-fvisibility=hidden',
] ]
if cxx.target.arch in ['x86', 'x86_64']:
cxx.cflags += ['-msse']
cxx.cxxflags += [ cxx.cxxflags += [
'-std=c++17',
'-fno-threadsafe-statics', '-fno-threadsafe-statics',
'-Wno-non-virtual-dtor', '-Wno-non-virtual-dtor',
'-Wno-overloaded-virtual', '-Wno-overloaded-virtual',
'-Wno-register', '-Wno-register',
'-fvisibility-inlines-hidden', '-fvisibility-inlines-hidden',
'-std=c++17',
] ]
have_gcc = cxx.family == 'gcc' have_gcc = cxx.family == 'gcc'
have_clang = cxx.family == 'clang' have_clang = cxx.family == 'clang'
if cxx.version >= 'clang-3.9' or cxx.version == 'clang-3.4' or cxx.version > 'apple-clang-6.0':
cxx.cxxflags += ['-Wno-expansion-to-defined'] # Work around errors from smsdk_ext.cpp
if cxx.version == 'clang-3.9' or cxx.version == 'apple-clang-8.0':
cxx.cflags += ['-Wno-varargs']
if cxx.version >= 'clang-3.4' or cxx.version >= 'apple-clang-7.0':
cxx.cxxflags += ['-Wno-inconsistent-missing-override']
if cxx.version >= 'clang-2.9' or cxx.version >= 'apple-clang-3.0':
cxx.cxxflags += ['-Wno-null-dereference']
if have_clang or (cxx.version >= 'gcc-4.6'):
cxx.cflags += ['-Wno-narrowing']
if have_clang or (cxx.version >= 'gcc-4.7'):
cxx.cxxflags += ['-Wno-delete-non-virtual-dtor']
if cxx.version >= 'gcc-4.8':
cxx.cflags += ['-Wno-unused-result']
if cxx.version >= 'gcc-9.0':
cxx.cxxflags += ['-Wno-class-memaccess', '-Wno-packed-not-aligned']
if have_clang: if have_clang:
cxx.cxxflags += ['-Wno-implicit-exception-spec-mismatch'] cxx.cxxflags += ['-Wno-implicit-exception-spec-mismatch']
if cxx.version >= 'apple-clang-5.1' or cxx.version >= 'clang-3.4':
cxx.cxxflags += ['-Wno-deprecated-register']
else:
cxx.cxxflags += ['-Wno-deprecated']
cxx.cflags += ['-Wno-sometimes-uninitialized']
# Work around SDK warnings. # Work around SDK warnings.
if cxx.version >= 'clang-10.0' or cxx.version >= 'apple-clang-12.0': if cxx.version >= 'clang-10.0' or cxx.version >= 'apple-clang-12.0':
cxx.cflags += [ cxx.cflags += [
'-Wno-implicit-int-float-conversion', '-Wno-implicit-int-float-conversion',
'-Wno-tautological-overlap-compare', '-Wno-tautological-overlap-compare',
] ]
if have_gcc: if have_gcc:
cxx.cflags += ['-mfpmath=sse'] cxx.cflags += ['-mfpmath=sse']
cxx.cflags += ['-Wno-maybe-uninitialized'] cxx.cflags += ['-Wno-maybe-uninitialized']
if builder.options.opt == '1': if builder.options.opt == '1':
cxx.cflags += ['-O3'] cxx.cflags += ['-O3']
# Don't omit the frame pointer.
cxx.cflags += ['-fno-omit-frame-pointer']
def configure_msvc(self, cxx): def configure_msvc(self, cxx):
if builder.options.debug == '1': if builder.options.debug == '1':
cxx.cflags += ['/MTd'] cxx.cflags += ['/MTd']
cxx.linkflags += ['/NODEFAULTLIB:libcmt'] cxx.linkflags += ['/NODEFAULTLIB:libcmt']
@@ -397,12 +299,13 @@ class ExtensionConfig(object):
cxx.linkflags += ['-static-libgcc'] cxx.linkflags += ['-static-libgcc']
elif cxx.family == 'clang': elif cxx.family == 'clang':
cxx.linkflags += ['-lgcc_eh'] cxx.linkflags += ['-lgcc_eh']
cxx.linkflags += ['-static-libstdc++']
def configure_mac(self, cxx): def configure_mac(self, cxx):
cxx.defines += ['OSX', '_OSX', 'POSIX', 'KE_ABSOLUTELY_NO_STL'] cxx.defines += ['OSX', '_OSX', 'POSIX', 'KE_ABSOLUTELY_NO_STL']
cxx.cflags += ['-mmacosx-version-min=10.7'] cxx.cflags += ['-mmacosx-version-min=10.15']
cxx.linkflags += [ cxx.linkflags += [
'-mmacosx-version-min=10.7', '-mmacosx-version-min=10.15',
'-stdlib=libc++', '-stdlib=libc++',
'-lc++', '-lc++',
] ]
@@ -410,6 +313,19 @@ class ExtensionConfig(object):
def configure_windows(self, cxx): def configure_windows(self, cxx):
cxx.defines += ['WIN32', '_WINDOWS'] cxx.defines += ['WIN32', '_WINDOWS']
def LibraryBuilder(self, compiler, name):
binary = compiler.Library(name)
self.AddVersioning(binary)
if binary.compiler.like('msvc'):
binary.compiler.linkflags += ['/SUBSYSTEM:WINDOWS']
self.AddCxxCompat(binary)
return binary
def Library(self, context, compiler, name):
compiler = compiler.clone()
SetArchFlags(compiler)
return self.LibraryBuilder(compiler, name)
def ConfigureForExtension(self, context, compiler): def ConfigureForExtension(self, context, compiler):
compiler.cxxincludes += [ compiler.cxxincludes += [
@@ -422,6 +338,37 @@ class ExtensionConfig(object):
os.path.join(self.sm_root, 'public', 'amtl'), os.path.join(self.sm_root, 'public', 'amtl'),
] ]
return compiler return compiler
def AddCDetour(self, binary):
public_path = os.path.join(self.sm_root, 'public')
binary.sources += [
os.path.join(public_path, 'CDetour', 'detours.cpp'),
os.path.join(public_path, 'safetyhook', 'src', 'allocator.cpp'),
os.path.join(public_path, 'safetyhook', 'src', 'easy.cpp'),
os.path.join(public_path, 'safetyhook', 'src', 'inline_hook.cpp'),
os.path.join(public_path, 'safetyhook', 'src', 'mid_hook.cpp'),
os.path.join(public_path, 'safetyhook', 'src', 'os.linux.cpp'),
os.path.join(public_path, 'safetyhook', 'src', 'utility.cpp'),
os.path.join(public_path, 'safetyhook', 'src', 'vmt_hook.cpp'),
os.path.join(public_path, 'safetyhook', 'zydis', 'Zydis.c')
]
binary.compiler.includes += [
os.path.join(public_path, 'safetyhook', 'include'),
os.path.join(public_path, 'safetyhook', 'zydis'),
]
def ExtLibrary(self, context, compiler, name):
binary = self.Library(context, compiler, name)
SetArchFlags(compiler)
self.ConfigureForExtension(context, binary.compiler)
return binary
def AddCxxCompat(self, binary):
if binary.compiler.target.platform == 'linux':
binary.sources += [
os.path.join(self.sm_root, 'public', 'amtl', 'compat', 'stdcxx.cpp'),
]
def ConfigureForHL2(self, context, binary, sdk): def ConfigureForHL2(self, context, binary, sdk):
compiler = binary.compiler compiler = binary.compiler
@@ -432,230 +379,44 @@ class ExtensionConfig(object):
os.path.join(self.mms_root, 'core', 'sourcehook'), os.path.join(self.mms_root, 'core', 'sourcehook'),
] ]
defines = ['RAD_TELEMETRY_DISABLED'] for other_sdk in self.sdk_manifests:
defines += ['SE_' + PossibleSDKs[i].define + '=' + PossibleSDKs[i].code for i in PossibleSDKs] compiler.defines += ['SE_{}={}'.format(other_sdk['define'], other_sdk['code'])]
compiler.defines += defines
paths = [ SdkHelpers.configureCxx(context, binary, sdk)
['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(['public', 'toolframework'])
paths.append(['game', 'shared'])
paths.append(['common'])
compiler.defines += ['SOURCE_ENGINE=' + sdk.code]
if sdk.name in ['sdk2013', 'bms', 'css', 'tf2', '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.like('msvc'):
compiler.defines += ['COMPILER_MSVC']
if compiler.target.arch == 'x86':
compiler.defines += ['COMPILER_MSVC32']
elif compiler.target.arch == 'x86_64':
compiler.defines += ['COMPILER_MSVC64']
compiler.linkflags += ['legacy_stdio_definitions.lib']
else:
compiler.defines += ['COMPILER_GCC']
if compiler.target.arch == 'x86_64':
compiler.defines += ['X64BITS', 'PLATFORM_64BITS']
# For everything after Swarm, this needs to be defined for entity networking
# to work properly with sendprop value changes.
if sdk.name in ['blade', 'insurgency', 'doi', 'csgo']:
compiler.defines += ['NETWORK_VARS_ENABLED']
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 compiler.target.platform == 'linux':
if sdk.name in ['csgo', 'blade']:
compiler.defines += ['_GLIBCXX_USE_CXX11_ABI=0']
for path in paths:
compiler.cxxincludes += [os.path.join(sdk.path, *path)]
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':
if sdk.name in ['css', 'hl2dm', 'dods', 'tf2']:
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux64')
else:
lib_folder = os.path.join(sdk.path, 'lib', 'linux64')
else:
if sdk.name in ['css', 'hl2dm', 'dods', 'tf2']:
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux')
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':
compiler.postlink += [
os.path.join(lib_folder, 'tier1.a'),
os.path.join(lib_folder, 'mathlib.a')
]
else:
compiler.postlink += [
os.path.join(lib_folder, 'tier1_i486.a'),
os.path.join(lib_folder, 'mathlib_i486.a')
]
if sdk.name in ['blade', 'insurgency', 'doi', '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')]
dynamic_libs = []
if compiler.target.platform == 'linux':
if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'bms', 'nucleardawn', 'l4d2', 'insurgency', 'doi']:
dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so']
elif compiler.target.arch == 'x86_64' and sdk.name in ['csgo', 'blade']:
dynamic_libs = ['libtier0_client.so', 'libvstdlib_client.so']
elif sdk.name in ['l4d', 'blade', 'insurgency', 'doi', 'csgo']:
dynamic_libs = ['libtier0.so', 'libvstdlib.so']
else:
dynamic_libs = ['tier0_i486.so', 'vstdlib_i486.so']
elif compiler.target.platform == 'mac':
compiler.linkflags.append('-liconv')
dynamic_libs = ['libtier0.dylib', 'libvstdlib.dylib']
elif compiler.target.platform == 'windows':
libs = ['tier0', 'tier1', 'vstdlib', 'mathlib']
if sdk.name in ['swarm', 'blade', 'insurgency', 'doi', 'csgo']:
libs.append('interfaces')
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'
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)
# Ensure the output path exists.
context.AddFolder(binary.localFolder)
output = context.AddSymlink(source_path, output_path)
compiler.weaklinkdeps += [output]
compiler.linkflags[0:0] = [library]
return binary return binary
def AddCDetour(self, binary): def HL2Library(self, context, compiler, name, sdk):
sm_public_path = os.path.join(self.sm_root, 'public') binary = self.Library(context, compiler, name)
self.ConfigureForExtension(context, binary.compiler)
if os.path.exists(os.path.join(sm_public_path, 'safetyhook')): return self.ConfigureForHL2(context, binary, sdk)
binary.sources += [ os.path.join(sm_public_path, 'CDetour', 'detours.cpp') ]
binary.compiler.cxxincludes += [ os.path.join(builder.sourcePath, 'safetyhook', 'include') ]
for task in self.libsafetyhook:
if task.target.arch == binary.compiler.target.arch:
binary.compiler.linkflags += [task.binary]
return
raise Exception('No suitable build of safetyhook was found.')
else:
binary.sources += [
os.path.join(sm_public_path, 'CDetour', 'detours.cpp'),
os.path.join(sm_public_path, 'asm', 'asm.c'),
]
# sm1.10+
libudis_folder = os.path.join(sm_public_path, 'libudis86')
if os.path.isdir(libudis_folder):
binary.compiler.defines += ['HAVE_STRING_H']
binary.sources += [
os.path.join(libudis_folder, 'decode.c'),
os.path.join(libudis_folder, 'itab.c'),
os.path.join(libudis_folder, 'syn-att.c'),
os.path.join(libudis_folder, 'syn-intel.c'),
os.path.join(libudis_folder, 'syn.c'),
os.path.join(libudis_folder, 'udis86.c'),
]
def HL2Config(self, project, context, compiler, name, sdk): def HL2Config(self, project, context, compiler, name, sdk):
binary = project.Configure(compiler, name, binary = project.Configure(compiler, name,
'{0} - {1} {2}'.format(self.tag, sdk.name, compiler.target.arch)) '{0} - {1} {2}'.format(self.tag, sdk['name'], compiler.target.arch))
self.AddVersioning(binary) self.AddCxxCompat(binary)
return self.ConfigureForHL2(context, binary, sdk) return self.ConfigureForHL2(context, binary, sdk)
def HL2ExtConfig(self, project, context, compiler, name, sdk): def HL2ExtConfig(self, project, context, compiler, name, sdk):
binary = project.Configure(compiler, name, binary = project.Configure(compiler, name,
'{0} - {1} {2}'.format(self.tag, sdk.name, compiler.target.arch)) '{0} - {1} {2}'.format(self.tag, sdk['name'], compiler.target.arch))
self.AddVersioning(binary) self.AddCxxCompat(binary)
self.ConfigureForHL2(context, binary, sdk) self.ConfigureForHL2(context, binary, sdk)
self.ConfigureForExtension(context, binary.compiler) self.ConfigureForExtension(context, binary.compiler)
return binary return binary
class SafetyHookShim(object):
def __init__(self):
self.all_targets = {}
self.libsafetyhook = {}
if getattr(builder, 'target', None) is not None:
sys.stderr.write("Your output folder was configured for AMBuild 2.1.\n")
sys.stderr.write("Please remove your output folder and reconfigure to continue.\n")
os._exit(1)
Extension = ExtensionConfig() Extension = ExtensionConfig()
Extension.detectProductVersion()
Extension.detectSDKs() Extension.detectSDKs()
Extension.configure() Extension.configure()
if Extension.use_auto_versioning():
Extension.generated_headers = builder.Build('buildbot/Versioning')
if os.path.exists(os.path.join(Extension.sm_root, 'public', 'safetyhook')):
# we need to pull safetyhook in locally because ambuild does not take kindly to outside relpaths
safetyhook_dest = Normalize(builder.sourcePath + '/safetyhook/')
shutil.copytree(os.path.join(Extension.sm_root, 'public', 'safetyhook'), safetyhook_dest, dirs_exist_ok=True)
SafetyHook = SafetyHookShim()
SafetyHook.all_targets = Extension.all_targets
builder.Build('safetyhook/AMBuilder', {'SafetyHook': SafetyHook })
Extension.libsafetyhook = SafetyHook.libsafetyhook
# This will clone the list and each cxx object as we recurse, preventing child # This will clone the list and each cxx object as we recurse, preventing child
# scripts from messing up global state. # scripts from messing up global state.
builder.targets = builder.CloneableList(Extension.all_targets) builder.targets = builder.CloneableList(Extension.all_targets)
# Add additional buildscripts here
BuildScripts = [ BuildScripts = [
'extension/AMBuilder', 'AMBuilder',
'buildbot/PackageScript', 'PackageScript',
'buildbot/BreakpadSymbols'
] ]
builder.Build(BuildScripts, { 'Extension': Extension }) builder.Build(BuildScripts, { 'Extension': Extension })
+36
View File
@@ -0,0 +1,36 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
if not "SM" in globals():
SM = Extension
projectName = 'connect'
project = builder.LibraryProject(projectName)
project.sources += [
'extension.cpp',
os.path.join(SM.sm_root, 'public', 'smsdk_ext.cpp')
]
for sdk_name in SM.sdks:
sdk = SM.sdks[sdk_name]
if sdk['name'] in ['mock']:
continue
for cxx in builder.targets:
cxx.defines += ['HAVE_STRING_H'];
if not cxx.target.arch in sdk['platforms'][cxx.target.platform]:
continue
binary = Extension.HL2ExtConfig(project, builder, cxx, projectName + '.ext.' + sdk['extension'], sdk)
SM.AddCDetour(binary)
binary.compiler.cxxflags += [
'-Wno-dangling-else',
'-Wno-unknown-pragmas',
'-Wno-unused-result',
'-Wno-sign-compare',
]
SM.extensions += builder.Add(project)
+233
View File
@@ -0,0 +1,233 @@
# (C)2004-2010 SourceMod Development Team
# Makefile written by David "BAILOPAN" Anderson
###########################################
### EDIT THESE PATHS FOR YOUR OWN SETUP ###
###########################################
SMSDK = ../..
HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob
HL2SDK_CSS = ../../../hl2sdk-css
HL2SDK_OB_VALVE = ../../../hl2sdk-ob-valve
HL2SDK_L4D = ../../../hl2sdk-l4d
HL2SDK_L4D2 = ../../../hl2sdk-l4d2
HL2SDK_CSGO = ../../../hl2sdk-csgo
MMSOURCE19 = ../../../mmsource-1.9
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
#####################################
PROJECT = sample
#Uncomment for Metamod: Source enabled extension
#USEMETA = true
OBJECTS = smsdk_ext.cpp extension.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
CPP_OSX = clang
##########################
### SDK CONFIGURATIONS ###
##########################
override ENGSET = false
# Check for valid list of engines
ifneq (,$(filter original orangebox orangeboxvalve css left4dead left4dead2 csgo,$(ENGINE)))
override ENGSET = true
endif
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
CFLAGS += -DSOURCE_ENGINE=1
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
CFLAGS += -DSOURCE_ENGINE=3
endif
ifeq "$(ENGINE)" "css"
HL2SDK = $(HL2SDK_CSS)
CFLAGS += -DSOURCE_ENGINE=6
endif
ifeq "$(ENGINE)" "orangeboxvalve"
HL2SDK = $(HL2SDK_OB_VALVE)
CFLAGS += -DSOURCE_ENGINE=7
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
CFLAGS += -DSOURCE_ENGINE=8
endif
ifeq "$(ENGINE)" "left4dead2"
HL2SDK = $(HL2SDK_L4D2)
CFLAGS += -DSOURCE_ENGINE=9
endif
ifeq "$(ENGINE)" "csgo"
HL2SDK = $(HL2SDK_CSGO)
CFLAGS += -DSOURCE_ENGINE=12
endif
HL2PUB = $(HL2SDK)/public
ifeq "$(ENGINE)" "original"
INCLUDE += -I$(HL2SDK)/public/dlls
METAMOD = $(MMSOURCE19)/core-legacy
else
INCLUDE += -I$(HL2SDK)/public/game/server
METAMOD = $(MMSOURCE19)/core
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 original or OB
ifneq (,$(filter original orangebox,$(ENGINE)))
LIB_SUFFIX = _i486.$(LIB_EXT)
else
LIB_PREFIX = lib
LIB_SUFFIX = .$(LIB_EXT)
endif
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
ifeq "$(USEMETA)" "true"
LINK_HL2 = $(HL2LIB)/tier1_i486.a $(LIB_PREFIX)vstdlib$(LIB_SUFFIX) $(LIB_PREFIX)tier0$(LIB_SUFFIX)
ifeq "$(ENGINE)" "csgo"
LINK_HL2 += $(HL2LIB)/interfaces_i486.a
endif
LINK += $(LINK_HL2)
INCLUDE += -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) \
-I$(METAMOD)/sourcehook
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 \
-DSE_CSS=6 -DSE_ORANGEBOXVALVE=7 -DSE_LEFT4DEAD=8 -DSE_LEFT4DEAD2=9 -DSE_ALIENSWARM=10 \
-DSE_PORTAL2=11 -DSE_CSGO=12
endif
LINK += -m32 -lm -ldl
CFLAGS += -DPOSIX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -DCOMPILER_GCC -Wall -Werror \
-Wno-overloaded-virtual -Wno-switch -Wno-unused -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H -m32
CPPFLAGS += -Wno-non-virtual-dtor -fno-exceptions -fno-rtti
################################################
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
################################################
BINARY = $(PROJECT).ext.$(LIB_EXT)
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
ifeq "$(OS)" "Darwin"
CPP = $(CPP_OSX)
LIB_EXT = dylib
CFLAGS += -DOSX -D_OSX
LINK += -dynamiclib -lstdc++ -mmacosx-version-min=10.5
else
LIB_EXT = so
CFLAGS += -D_LINUX
LINK += -shared
endif
IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
ifeq "$(IS_CLANG)" "1"
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
else
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
endif
# If not clang
ifeq "$(IS_CLANG)" "0"
CFLAGS += -mfpmath=sse
endif
# Clang || GCC >= 4
ifeq "$(shell expr $(IS_CLANG) \| $(CPP_MAJOR) \>= 4)" "1"
CFLAGS += $(C_GCC4_FLAGS)
CPPFLAGS += $(CPP_GCC4_FLAGS)
endif
# Clang >= 3 || GCC >= 4.7
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
CFLAGS += -Wno-delete-non-virtual-dtor
endif
# OS is Linux and not using clang
ifeq "$(shell expr $(OS) \= Linux \& $(IS_CLANG) \= 0)" "1"
LINK += -static-libgcc
endif
OBJ_BIN := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
# This will break if we include other Makefiles, but is fine for now. It allows
# us to make a copy of this file that uses altered paths (ie. Makefile.mine)
# or other changes without mucking up the original.
MAKEFILE_NAME := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
$(BIN_DIR)/%.o: %.cpp
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
all: check
mkdir -p $(BIN_DIR)
ln -sf ../smsdk_ext.cpp
if [ "$(USEMETA)" = "true" ]; then \
ln -sf $(HL2LIB)/$(LIB_PREFIX)vstdlib$(LIB_SUFFIX); \
ln -sf $(HL2LIB)/$(LIB_PREFIX)tier0$(LIB_SUFFIX); \
fi
$(MAKE) -f $(MAKEFILE_NAME) extension
check:
if [ "$(USEMETA)" = "true" ] && [ "$(ENGSET)" = "false" ]; then \
echo "You must supply one of the following values for ENGINE:"; \
echo "csgo, left4dead2, left4dead, css, orangeboxvalve, orangebox, or original"; \
exit 1; \
fi
extension: check $(OBJ_BIN)
$(CPP) $(INCLUDE) $(OBJ_BIN) $(LINK) -o $(BIN_DIR)/$(BINARY)
debug:
$(MAKE) -f $(MAKEFILE_NAME) all DEBUG=true
default: all
clean: check
rm -rf $(BIN_DIR)/*.o
rm -rf $(BIN_DIR)/$(BINARY)
+50
View File
@@ -0,0 +1,50 @@
# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
import os
# This is where the files will be output to
# package is the default
builder.SetBuildFolder('package')
# Add any folders you need to this list
folder_list = [
'addons/sourcemod/extensions',
'addons/sourcemod/scripting/include',
'addons/sourcemod/gamedata'
]
if 'x86_64' in Extension.target_archs:
folder_list.extend([
'addons/sourcemod/extensions/x64',
])
# Create the distribution folder hierarchy.
folder_map = {}
for folder in folder_list:
norm_folder = os.path.normpath(folder)
folder_map[folder] = builder.AddFolder(norm_folder)
# Do all straight-up file copies from the source tree.
def CopyFiles(src, dest, files):
if not dest:
dest = src
dest_entry = folder_map[dest]
for source_file in files:
source_path = os.path.join(builder.sourcePath, src, source_file)
builder.AddCopy(source_path, dest_entry)
# Include files
CopyFiles('include', 'addons/sourcemod/scripting/include',
[ 'connect.inc', ]
)
# Gamedata (custom so updater doesn't replace it)
CopyFiles('gamedata', 'addons/sourcemod/gamedata',
[ 'connect2.games.txt' ]
)
# Copy binaries.
for cxx_task in Extension.extensions:
if cxx_task.target.arch == 'x86_64':
builder.AddCopy(cxx_task.binary, folder_map['addons/sourcemod/extensions/x64'])
else:
builder.AddCopy(cxx_task.binary, folder_map['addons/sourcemod/extensions'])
+11
View File
@@ -0,0 +1,11 @@
AMBuildScript needs '-std=c++14', instead of '-std=c++11',
def configure_linux(self, cxx):
cxx.defines += ['_LINUX', 'POSIX']
cxx.linkflags += ['-Wl,--exclude-libs,ALL', '-lm']
if cxx.vendor == 'gcc':
cxx.linkflags += ['-static-libgcc']
elif cxx.vendor == 'clang':
cxx.linkflags += ['--static-libgcc']
remember to use that instead of cxx.linkflags += ['-static-libgcc'] and cxx.linkflags += ['-lgcc_eh']
-7
View File
@@ -1,7 +0,0 @@
mkdir build
cd build
call "%VS100COMNTOOLS%\vsvars32.bat"
..\configure.py
build.py
pause
cd ..
-39
View File
@@ -1,39 +0,0 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os, sys
UPLOAD_SCRIPT = os.path.join(Extension.sm_root, 'tools', 'buildbot', 'upload_symbols.py')
if 'BREAKPAD_SYMBOL_SERVER' in os.environ:
symbolServer = os.environ['BREAKPAD_SYMBOL_SERVER']
builder.SetBuildFolder('breakpad-symbols')
for cxx_task in Extension.extensions:
if cxx_task.target.platform in ['windows']:
debug_entry = cxx_task.debug
else:
debug_entry = cxx_task.binary
debug_file = os.path.join(builder.buildPath, debug_entry.path)
if cxx_task.target.platform == 'linux':
argv = ['dump_syms', debug_file, os.path.dirname(debug_file)]
elif cxx_task.target.platform == 'mac':
# Required once dump_syms is updated on the slaves.
#argv = ['dump_syms', '-g', debug_file + '.dSYM', debug_file]
argv = ['dump_syms', debug_file + '.dSYM']
elif cxx_task.target.platform == 'windows':
argv = ['dump_syms.exe', debug_file]
plat_dir = os.path.dirname(debug_file)
bin_dir = os.path.split(plat_dir)[0]
symbol_file = '{}-{}-{}.breakpad'.format(
os.path.split(bin_dir)[1],
cxx_task.target.platform,
cxx_task.target.arch)
argv = [sys.executable, UPLOAD_SCRIPT, symbol_file] + argv
builder.AddCommand(
inputs = [UPLOAD_SCRIPT, debug_entry],
argv = argv,
outputs = [symbol_file]
)
-47
View File
@@ -1,47 +0,0 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os
import shutil
import ambuild.osutil as osutil
from ambuild.command import Command
builder.SetBuildFolder('package')
def CreateFolders(folders):
dict = {}
for folder in folders:
path = os.path.normpath(folder)
dict[folder] = builder.AddFolder(path)
return dict
def CopyFiles(src, dest, filter_ext=None):
source_path = os.path.join(builder.sourcePath, src)
if os.path.isfile(source_path):
builder.AddCopy(source_path, dest)
return
for entry in os.listdir(source_path):
entry_path = os.path.join(source_path, entry)
if not os.path.isfile(entry_path):
continue
if filter_ext:
_, ext = os.path.splitext(entry)
if filter_ext != ext:
continue
builder.AddCopy(entry_path, dest)
folders = CreateFolders(['addons/sourcemod/extensions', 'addons/sourcemod/extensions/x64', 'addons/sourcemod/gamedata', 'addons/sourcemod/scripting', 'addons/sourcemod/scripting/include'])
pdblog = open(os.path.join(builder.buildPath, 'pdblog.txt'), 'wt')
for cxx_task in Extension.extensions:
if cxx_task.target.arch == 'x86_64':
builder.AddCopy(cxx_task.binary, folders['addons/sourcemod/extensions/x64'])
else:
builder.AddCopy(cxx_task.binary, folders['addons/sourcemod/extensions'])
pdblog.write(cxx_task.debug.path + '\n')
pdblog.close()
CopyFiles('connect.games.txt', folders['addons/sourcemod/gamedata'])
CopyFiles('connect.inc', folders['addons/sourcemod/scripting/include'])
CopyFiles('connect.sp', folders['addons/sourcemod/scripting'])
debug_info = []
-50
View File
@@ -1,50 +0,0 @@
# 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_header.py'),
os.path.join(builder.sourcePath),
os.path.join(builder.buildPath, 'includes'),
]
outputs = [
os.path.join(builder.buildFolder, 'includes', 'version_auto.h')
]
repo_head_path = os.path.join(builder.sourcePath, 'product.version')
if os.path.exists(os.path.join(builder.sourcePath, '.git')):
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):
repo_head_path = os.path.join(builder.sourcePath, '.git', 'HEAD')
else:
git_state = head_contents.split(':')[1].strip()
repo_head_path = os.path.join(builder.sourcePath, '.git', git_state)
if not os.path.exists(repo_head_path):
repo_head_path = os.path.join(builder.sourcePath, '.git', 'HEAD')
sources = [
os.path.join(builder.sourcePath, 'product.version'),
repo_head_path,
argv[1]
]
for source in sources:
if not os.path.exists(source):
print(source)
for source in sources:
if not os.path.exists(source):
print(source)
output_nodes = builder.AddCommand(
inputs=sources,
argv=argv,
outputs=outputs
)
rvalue = output_nodes
-61
View File
@@ -1,61 +0,0 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os, sys
import re
import subprocess
argv = sys.argv[1:]
if len(argv) < 2:
sys.stderr.write('Usage: generate_header.py <source_path> <output_folder>\n')
sys.exit(1)
SourceFolder = os.path.abspath(os.path.normpath(argv[0]))
OutputFolder = os.path.normpath(argv[1])
def run_and_return(argv):
text = subprocess.check_output(argv)
if str != bytes:
text = str(text, 'utf-8')
return text.strip()
def GetGHVersion():
p = run_and_return(['hg', 'parent', '-R', SourceFolder])
m = re.match('changeset:\s+(\d+):(.+)', p.stdoutText)
if m == None:
raise Exception('Could not determine repository version')
return m.groups()
def GetGitVersion():
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
rev = None
cset = None
rev, cset = GetGitVersion()
productFile = open(os.path.join(SourceFolder, 'product.version'), 'r')
productContents = productFile.read()
productFile.close()
m = re.match('(\d+)\.(\d+)\.(\d+)(.*)', productContents)
if m == None:
raise Exception('Could not detremine product version')
major, minor, release, tag = m.groups()
incFile = open(os.path.join(OutputFolder, 'version_auto.h'), 'w')
incFile.write("""
#ifndef _AUTO_VERSION_INFORMATION_H_
#define _AUTO_VERSION_INFORMATION_H_
#define SM_BUILD_TAG \"{0}\"
#define SM_BUILD_UNIQUEID \"{1}:{2}\" SM_BUILD_TAG
#define SM_VERSION \"{3}.{4}.{5}\"
#define SM_FULL_VERSION SM_VERSION SM_BUILD_TAG
#define SM_FILE_VERSION {6},{7},{8},0
#endif /* _AUTO_VERSION_INFORMATION_H_ */
""".format(tag, rev, cset, major, minor, release, major, minor, release))
incFile.close()
filename_versioning = open(os.path.join(OutputFolder, 'filename_versioning.txt'), 'w')
filename_versioning.write("{0}.{1}.{2}-git{3}-{4}".format(major, minor, release, rev, cset))
filename_versioning.close()
-1
View File
@@ -1 +0,0 @@
Lemons.
Regular → Executable
+13 -12
View File
@@ -4,23 +4,24 @@ from ambuild2 import run
# Simple extensions do not need to modify this file. # Simple extensions do not need to modify this file.
parser = run.BuildParser(sourcePath = sys.path[0], api='2.2') parser = run.BuildParser(sourcePath=sys.path[0], api='2.2')
parser.options.add_argument('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None, parser.options.add_argument('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None,
help='Root search folder for HL2SDKs') help='Root search folder for HL2SDKs')
parser.options.add_argument('--mms-path', type=str, dest='mms_path', default=None, parser.options.add_argument('--hl2sdk-manifest-path', type=str, dest='hl2sdk_manifest', default=None,
help='Path to Metamod:Source') help='Path to HL2SDK Manifests')
parser.options.add_argument('--sm-path', type=str, dest='sm_path', default=None, parser.options.add_argument('--sm-path', type=str, dest='sm_path', default=None,
help='Path to SourceMod') help='Path to SourceMod')
parser.options.add_argument('--mms-path', type=str, dest='mms_path', default=None,
help='Path to Metamod:Source')
parser.options.add_argument('--enable-debug', action='store_const', const='1', dest='debug', parser.options.add_argument('--enable-debug', action='store_const', const='1', dest='debug',
help='Enable debugging symbols') help='Enable debugging symbols')
parser.options.add_argument('--enable-optimize', action='store_const', const='1', dest='opt', parser.options.add_argument('--enable-optimize', action='store_const', const='1', dest='opt',
help='Enable optimization') help='Enable optimization')
parser.options.add_argument('--enable-auto-versioning', action='store_false', dest='disable_auto_versioning', parser.options.add_argument('-s', '--sdks', default='present', dest='sdks',
default=True, help='Enables the auto versioning script') help='Build against specified SDKs; valid args are "none", "all", "present",'
parser.options.add_argument('-s', '--sdks', default='all', dest='sdks', ' or comma-delimited list of engine names')
help='Build against specified SDKs; valid args are "all", "present", or '
'space-delimited list of engine names (default: %default)')
parser.options.add_argument('--targets', type=str, dest='targets', default=None, parser.options.add_argument('--targets', type=str, dest='targets', default=None,
help="Override the target architecture (use commas to separate multiple targets).") help="Override the target architecture (use commas to separate multiple targets).")
parser.Configure() parser.Configure()
-73
View File
@@ -1,73 +0,0 @@
"Games"
{
"#default"
{
"#supported"
{
"engine" "dods"
"engine" "css"
"engine" "hl2dm"
"engine" "tf2"
}
"Offsets"
{
"ISteamGameServer__BeginAuthSession"
{
"linux" "26"
"linux64" "26"
"windows" "26"
"windows64" "26"
}
"ISteamGameServer__EndAuthSession"
{
"linux" "27"
"linux64" "27"
"windows" "27"
"windows64" "27"
}
"CheckMasterServerRequestRestart_Steam3ServerFuncOffset"
{
"windows" "240"
"windows64" "299"
}
}
"Signatures"
{
"Steam3Server"
{
"library" "engine"
"linux" "@_Z12Steam3Serverv"
"linux64" "@_Z12Steam3Serverv"
}
"CBaseServer__ConnectClient"
{
"library" "engine"
"linux" "@_ZN11CBaseServer13ConnectClientER8netadr_siiiiPKcS3_S3_i"
"linux64" "@_ZN11CBaseServer13ConnectClientER8netadr_siiiiPKcS3_S3_i"
"windows" "\x55\x8B\xEC\x81\xEC\x24\x05\x00\x00\x53\x56\x57\x68\x2A\x2A\x2A\x2A"
"windows64" "\x48\x89\x5C\x24\x2A\x44\x89\x4C\x24\x2A\x55\x56\x57\x41\x54\x41\x55\x41\x56\x41\x57\x48\x81\xEC\x80\x05\x00\x00"
}
"CBaseServer__RejectConnection"
{
"library" "engine"
"linux" "@_ZN11CBaseServer16RejectConnectionERK8netadr_siPKc"
"linux64" "@_ZN11CBaseServer16RejectConnectionERK8netadr_siPKc"
"windows" "\x55\x8B\xEC\x81\xEC\x04\x05\x00\x00\x57"
"windows64" "\x48\x89\x5C\x24\x2A\x48\x89\x6C\x24\x2A\x48\x89\x74\x24\x2A\x57\x48\x81\xEC\x50\x05\x00\x00"
}
"CBaseServer__CheckMasterServerRequestRestart"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x1C\x53\x57\x33\xD2"
"windows64" "\x4C\x8B\xDC\x49\x89\x5B\x2A\x49\x89\x6B\x2A\x56\x57\x41\x54\x41\x56\x41\x57\x48\x83\xEC\x60\x48\x8B\x05\x2A\x2A\x2A\x2A\x48\x8D\x1D"
}
}
}
}
-23
View File
@@ -1,23 +0,0 @@
#if defined _connect_included
#endinput
#endif
#define _connect_included
forward bool OnClientPreConnectEx(const char[] name, char password[255], const char[] ip, const char[] steamID, char rejectReason[255]);
public Extension __ext_Connect =
{
name = "Connect",
file = "connect.ext",
#if defined AUTOLOAD_EXTENSIONS
autoload = 1,
#else
autoload = 0,
#endif
#if defined REQUIRE_EXTENSIONS
required = 1,
#else
required = 0,
#endif
}
-25
View File
@@ -1,25 +0,0 @@
#pragma semicolon 1 // Force strict semicolon mode.
#pragma newdecls required // Force new syntax
#include <sourcemod>
#define REQUIRE_EXTENSIONS
#include <connect>
public bool OnClientPreConnectEx(const char[] name, char password[255], const char[] ip, const char[] steamID, char rejectReason[255])
{
PrintToServer("----------------\nName: %s\nPassword: %s\nIP: %s\nSteamID: %s\n----------------", name, password, ip, steamID);
AdminId admin = FindAdminByIdentity(AUTHMETHOD_STEAM, steamID);
if (admin == INVALID_ADMIN_ID)
{
return true;
}
if (GetAdminFlag(admin, Admin_Root))
{
GetConVarString(FindConVar("sv_password"), password, 255);
}
return true;
}
+1377
View File
File diff suppressed because it is too large Load Diff
+160 -123
View File
@@ -1,123 +1,160 @@
/** /**
* ============================================================================= * vim: set ts=4 :
* TF2 Items Extension * =============================================================================
* Copyright (C) 2009-2010 AzuiSleet, Asher Baker (asherkin). All rights reserved. * SourceMod Sample Extension
* ============================================================================= * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* * =============================================================================
* This program is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License, version 3.0, as published by the * This program is free software; you can redistribute it and/or modify it under
* Free Software Foundation. * the terms of the GNU General Public License, version 3.0, as published by the
* * Free Software Foundation.
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * This program is distributed in the hope that it will be useful, but WITHOUT
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* details. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* * details.
* You should have received a copy of the GNU General Public License along with *
* this program. If not, see <http://www.gnu.org/licenses/>. * You should have received a copy of the GNU General Public License along with
* * this program. If not, see <http://www.gnu.org/licenses/>.
*/ *
* As a special exception, AlliedModders LLC gives you permission to link the
#ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ * code of this program (as well as its derivative works) to "Half-Life 2," the
#define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
/** * all respects for all other code used. Additionally, AlliedModders LLC grants
* @file extension.hpp * this exception to all derivative works. AlliedModders LLC defines further
* @brief Connect extension code header. * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
*/ * or <http://www.sourcemod.net/license.php>.
*
#include "smsdk_ext.h" * Version: $Id$
*/
/**
* @brief Sample implementation of the SDK Extension. #ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
* Note: Uncomment one of the pre-defined virtual functions in order to use it. #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
*/
class Connect : public SDKExtension, public IConCommandBaseAccessor /**
{ * @file extension.h
public: * @brief Sample extension code header.
/** */
* @brief This is called after the initial loading sequence has been processed.
* #include "smsdk_ext.h"
* @param error Error message buffer. #include <igameevents.h>
* @param maxlength Size of error message buffer.
* @param late Whether or not the module was loaded after map load. /**
* @return True to succeed loading, false to fail. * @brief Sample implementation of the SDK Extension.
*/ * Note: Uncomment one of the pre-defined virtual functions in order to use it.
virtual bool SDK_OnLoad(char *error, size_t maxlen, bool late); */
class Connect :
/** public SDKExtension,
* @brief This is called right before the extension is unloaded. public IConCommandBaseAccessor,
*/ public IClientListener
virtual void SDK_OnUnload(); {
public:
/** /**
* @brief Called when the pause state is changed. * @brief This is called after the initial loading sequence has been processed.
*/ *
//virtual void SDK_OnPauseChange(bool paused); * @param error Error message buffer.
* @param maxlength Size of error message buffer.
/** * @param late Whether or not the module was loaded after map load.
* @brief this is called when Core wants to know if your extension is working. * @return True to succeed loading, false to fail.
* */
* @param error Error message buffer. virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late);
* @param maxlength Size of error message buffer.
* @return True if working, false otherwise. /**
*/ * @brief This is called right before the extension is unloaded.
//virtual bool QueryRunning(char *error, size_t maxlen); */
public: virtual void SDK_OnUnload();
#if defined SMEXT_CONF_METAMOD
/** /**
* @brief Called when Metamod is attached, before the extension version is called. * @brief This is called once all known extensions have been loaded.
* * Note: It is is a good idea to add natives here, if any are provided.
* @param error Error buffer. */
* @param maxlength Maximum size of error buffer. virtual void SDK_OnAllLoaded();
* @param late Whether or not Metamod considers this a late load.
* @return True to succeed, false to fail. /**
*/ * @brief Called when the pause state is changed.
virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late); */
//virtual void SDK_OnPauseChange(bool paused);
/**
* @brief Called when Metamod is detaching, after the extension version is called. /**
* NOTE: By default this is blocked unless sent from SourceMod. * @brief this is called when Core wants to know if your extension is working.
* *
* @param error Error buffer. * @param error Error message buffer.
* @param maxlength Maximum size of error buffer. * @param maxlength Size of error message buffer.
* @return True to succeed, false to fail. * @return True if working, false otherwise.
*/ */
virtual bool SDK_OnMetamodUnload(char *error, size_t maxlen); //virtual bool QueryRunning(char *error, size_t maxlength);
public:
/** #if defined SMEXT_CONF_METAMOD
* @brief Called when Metamod's pause state is changing. /**
* NOTE: By default this is blocked unless sent from SourceMod. * @brief Called when Metamod is attached, before the extension version is called.
* *
* @param paused Pause state being set. * @param error Error buffer.
* @param error Error buffer. * @param maxlength Maximum size of error buffer.
* @param maxlength Maximum size of error buffer. * @param late Whether or not Metamod considers this a late load.
* @return True to succeed, false to fail. * @return True to succeed, false to fail.
*/ */
//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlen); virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
#endif
public: //IConCommandBaseAccessor /**
bool RegisterConCommandBase(ConCommandBase *pCommand); * @brief Called when Metamod is detaching, after the extension version is called.
}; * NOTE: By default this is blocked unless sent from SourceMod.
*
#define DETOUR_DECL_MEMBER9(name, ret, p1type, p1name, p2type, p2name, p3type, p3name, p4type, p4name, p5type, p5name, p6type, p6name, p7type, p7name, p8type, p8name, p9type, p9name) \ * @param error Error buffer.
class name##Class \ * @param maxlength Maximum size of error buffer.
{ \ * @return True to succeed, false to fail.
public: \ */
ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name); \ //virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
static ret (name##Class::* name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type); \
}; \ /**
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type) = NULL; \ * @brief Called when Metamod's pause state is changing.
ret name##Class::name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name) * NOTE: By default this is blocked unless sent from SourceMod.
*
struct mfpDetails { * @param paused Pause state being set.
void *addr; * @param error Error buffer.
intptr_t adjustor; * @param maxlength Maximum size of error buffer.
* @return True to succeed, false to fail.
void Init(void* addr, intptr_t adj = 0) { */
this->addr = addr; //virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
this->adjustor = adj; #endif
}
}; public: // IConCommandBaseAccessor
virtual bool RegisterConCommandBase(ConCommandBase *pVar);
#endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
public: // IClientListener
virtual void OnClientSettingsChanged(int client);
virtual void OnClientPutInServer(int client);
public:
void OnTimer();
};
class ConnectEvents : public IGameEventListener2
{
public:
virtual void FireGameEvent( IGameEvent *event );
};
class ConnectTimer : public ITimedEvent
{
public:
virtual ResultType OnTimer(ITimer *pTimer, void *pData);
virtual void OnTimerEnd(ITimer *pTimer, void *pData);
};
#endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
// custom detour macros
#define DETOUR_DECL_MEMBER9(name, ret, p1type, p1name, p2type, p2name, p3type, p3name, p4type, p4name, p5type, p5name, p6type, p6name, p7type, p7name, p8type, p8name, p9type, p9name) \
class name##Class \
{ \
public: \
ret name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name); \
static ret (name##Class::* name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type); \
}; \
ret (name##Class::* name##Class::name##_Actual)(p1type, p2type, p3type, p4type, p5type, p6type, p7type, p8type, p9type) = NULL; \
ret name##Class::name(p1type p1name, p2type p2name, p3type p3name, p4type p4name, p5type p5name, p6type p6name, p7type p7name, p8type p8name, p9type p9name)
#define DETOUR_MEMBER_MCALL_CALLBACK(name, classptr) \
((name##Class *)classptr->*(&name##Class::name))
#define DETOUR_MEMBER_MCALL_ORIGINAL(name, classptr) \
((name##Class *)classptr->*(name##Class::name##_Actual))
-22
View File
@@ -1,22 +0,0 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os, sys
projectname = 'connect'
project = builder.LibraryProject(projectname + '.ext')
project.sources = [
'extension.cpp',
os.path.join(Extension.sm_root, 'public', 'smsdk_ext.cpp'),
]
for sdk_name in Extension.sdks:
sdk = Extension.sdks[sdk_name]
for cxx in builder.targets:
if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]:
continue
binary = Extension.HL2ExtConfig(project, builder, cxx, projectname + '.ext.' + sdk.ext, sdk)
Extension.AddCDetour(binary)
Extension.extensions = builder.Add(project)
-406
View File
@@ -1,406 +0,0 @@
/*
* =============================================================================
* Connect Extension
* Copyright (C) 2011 Asher Baker (asherkin). All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "extension.h"
#include "CDetour/detours.h"
#include "steam/steamclientpublic.h"
#include <string>
Connect g_connect;
SMEXT_LINK(&g_connect);
ConVar connectVersion("connect_version", SMEXT_CONF_VERSION, FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY, SMEXT_CONF_DESCRIPTION " Version");
IGameConfig *g_pGameConf = NULL;
IForward *g_pConnectForward = NULL;
class IClient;
class CBaseServer;
typedef enum EAuthProtocol
{
k_EAuthProtocolWONCertificate = 1,
k_EAuthProtocolHashedCDKey = 2,
k_EAuthProtocolSteam = 3,
} EAuthProtocol;
#if SOURCE_ENGINE == SE_LEFT4DEAD || SOURCE_ENGINE == SE_LEFT4DEAD2
typedef enum EBeginAuthSessionResult
{
k_EBeginAuthSessionResultOK = 0, // Ticket is valid for this game and this steamID.
k_EBeginAuthSessionResultInvalidTicket = 1, // Ticket is not valid.
k_EBeginAuthSessionResultDuplicateRequest = 2, // A ticket has already been submitted for this steamID
k_EBeginAuthSessionResultInvalidVersion = 3, // Ticket is from an incompatible interface version
k_EBeginAuthSessionResultGameMismatch = 4, // Ticket is not for this game
k_EBeginAuthSessionResultExpiredTicket = 5, // Ticket has expired
} EBeginAuthSessionResult;
#endif
typedef struct netadr_s
{
private:
typedef enum
{
NA_NULL = 0,
NA_LOOPBACK,
NA_BROADCAST,
NA_IP,
} netadrtype_t;
public:
netadrtype_t type;
unsigned char ip[4];
unsigned short port;
} netadr_t;
const char *CSteamID::Render() const
{
static char szSteamID[64];
V_snprintf(szSteamID, sizeof(szSteamID), "STEAM_0:%u:%u", this->GetAccountID() & 1, this->GetAccountID() >> 1);
return szSteamID;
}
class ISteamGameServer;
class CSteam3Server
{
public:
void *m_pSteamClient;
ISteamGameServer* m_pSteamGameServer;
void *m_pSteamGameServerUtils;
void *m_pSteamGameServerNetworking;
void *m_pSteamGameServerStats;
void *m_pSteamHTTP;
void *m_pSteamInventory;
void *m_pSteamUGC;
void *m_pSteamApps;
} *g_pSteam3Server;
typedef CSteam3Server *(*Steam3ServerFunc)();
class FEmptyClass {};
template<typename classcall, typename RetType, typename... Args>
union MFPHack {
private:
void* addr;
public:
MFPHack(void* addr)
{
this->addr = addr;
}
template<typename randomclass>
MFPHack(RetType (randomclass::*mfp)(Args...))
{
union
{
RetType (randomclass::*ptr)(Args...);
struct
{
void* addr;
#ifdef __linux__
intptr_t adjustor;
#endif
} details;
} u;
u.ptr = mfp;
this->addr = u.details.addr;
}
void SetAddress(void* addr)
{
this->addr = addr;
}
void* GetAddress()
{
return this->addr;
}
RetType operator()(classcall* ptrThis, Args... args)
{
union
{
RetType (FEmptyClass::*ptr)(Args...);
struct
{
void* addr;
#ifdef __linux__
intptr_t adjustor;
#endif
} details;
} u;
u.details.addr = addr;
#ifdef __linux__
u.details.adjustor = 0;
#endif
return (((FEmptyClass*)ptrThis)->*u.ptr)(args...);
}
};
CDetour* detourCBaseServer__ConnectClient = nullptr;
bool g_bSuppressBeginAuthSession = false;
CSteamID g_lastClientSteamID;
const void* g_lastAuthTicket;
int g_lastcbAuthTicket;
char passwordBuffer[255];
Steam3ServerFunc g_pSteam3ServerFunc = nullptr;
MFPHack<CBaseServer, void, const netadr_t &, int, const char *> g_pRejectConnectionFunc(nullptr);
MFPHack<ISteamGameServer, EBeginAuthSessionResult, const void*, int, CSteamID> g_pBeginAuthSession(nullptr);
MFPHack<ISteamGameServer, void, CSteamID> g_pEndAuthSession(nullptr);
CSteam3Server *Steam3Server()
{
if (!g_pSteam3ServerFunc)
return NULL;
return g_pSteam3ServerFunc();
}
SH_DECL_MANUALHOOK3(MHook_BeginAuthSession, 0, 0, 0, EBeginAuthSessionResult, const void *, int, CSteamID);
EBeginAuthSessionResult Hook_BeginAuthSession(const void *pAuthTicket, int cbAuthTicket, CSteamID steamID)
{
if (!g_bSuppressBeginAuthSession)
{
RETURN_META_VALUE(MRES_IGNORED, k_EBeginAuthSessionResultOK);
}
g_bSuppressBeginAuthSession = false;
if (strcmp(steamID.Render(), g_lastClientSteamID.Render()) == 0
&& g_lastAuthTicket == pAuthTicket
&& g_lastcbAuthTicket == cbAuthTicket)
{
// Let the server know everything is fine
// g_pSM->LogMessage(myself, "You alright ;)");
RETURN_META_VALUE(MRES_SUPERCEDE, k_EBeginAuthSessionResultOK);
}
RETURN_META_VALUE(MRES_IGNORED, k_EBeginAuthSessionResultDuplicateRequest);
}
DETOUR_DECL_MEMBER9(CBaseServer__ConnectClient, IClient*, netadr_t&, address, int, nProtocol, int, iChallenge, int, iClientChallenge, int, nAuthProtocol, const char *, pchName, const char *, pchPassword, const char *, pCookie, int, cbCookie)
{
if (nAuthProtocol != k_EAuthProtocolSteam)
{
// This is likely a SourceTV client, we don't want to interfere here.
return DETOUR_MEMBER_CALL(CBaseServer__ConnectClient)(address, nProtocol, iChallenge, iClientChallenge, nAuthProtocol, pchName, pchPassword, pCookie, cbCookie);
}
if (pCookie == NULL || (size_t)cbCookie < sizeof(uint64))
{
g_pRejectConnectionFunc((CBaseServer*)this, address, iClientChallenge, "#GameUI_ServerRejectInvalidSteamCertLen");
return NULL;
}
auto steamGameServer = Steam3Server()->m_pSteamGameServer;
char ipString[30];
V_snprintf(ipString, sizeof(ipString), "%u.%u.%u.%u", address.ip[0], address.ip[1], address.ip[2], address.ip[3]);
V_strncpy(passwordBuffer, pchPassword, 255);
uint64 ullSteamID = *(uint64 *)pCookie;
void *pvTicket = (void *)((intptr_t)pCookie + sizeof(uint64));
int cbTicket = cbCookie - sizeof(uint64);
g_lastClientSteamID = CSteamID(ullSteamID);
g_lastcbAuthTicket = cbTicket;
g_lastAuthTicket = pvTicket;
// Validate steam ticket
EBeginAuthSessionResult result = g_pBeginAuthSession(steamGameServer, pvTicket, cbTicket, g_lastClientSteamID);
if (result != k_EBeginAuthSessionResultOK)
{
g_pRejectConnectionFunc((CBaseServer*)this, address, iClientChallenge, "#GameUI_ServerRejectSteam");
return NULL;
}
char rejectReason[255];
g_pConnectForward->PushString(pchName);
g_pConnectForward->PushStringEx(passwordBuffer, 255, SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
g_pConnectForward->PushString(ipString);
g_pConnectForward->PushString(g_lastClientSteamID.Render());
g_pConnectForward->PushStringEx(rejectReason, 255, SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
cell_t retVal = 1;
g_pConnectForward->Execute(&retVal);
if (retVal == 0)
{
g_pEndAuthSession(steamGameServer, g_lastClientSteamID);
g_pRejectConnectionFunc((CBaseServer*)this, address, iClientChallenge, rejectReason);
return NULL;
}
pchPassword = passwordBuffer;
g_bSuppressBeginAuthSession = true;
auto client = DETOUR_MEMBER_CALL(CBaseServer__ConnectClient)(address, nProtocol, iChallenge, iClientChallenge, nAuthProtocol, pchName, pchPassword, pCookie, cbCookie);
g_bSuppressBeginAuthSession = false;
if (client == nullptr)
{
g_pEndAuthSession(steamGameServer, g_lastClientSteamID);
}
return client;
}
bool Connect::SDK_OnLoad(char *error, size_t maxlen, bool late)
{
char conf_error[255] = "";
if (!gameconfs->LoadGameConfigFile("connect.games", &g_pGameConf, conf_error, sizeof(conf_error)))
{
if (conf_error[0])
{
snprintf(error, maxlen, "Could not read connect.games.txt: %s\n", conf_error);
}
return false;
}
void* addr;
if (!g_pGameConf->GetMemSig("CBaseServer__RejectConnection", &addr) || addr == nullptr)
{
snprintf(error, maxlen, "Failed to find CBaseServer__RejectConnection function.\n");
return false;
}
g_pRejectConnectionFunc.SetAddress(addr);
#ifndef WIN32
if (!g_pGameConf->GetMemSig("Steam3Server", (void **)(&g_pSteam3ServerFunc)) || !g_pSteam3ServerFunc)
{
snprintf(error, maxlen, "Failed to find Steam3Server function.\n");
return false;
}
#else
void *address;
if (!g_pGameConf->GetMemSig("CBaseServer__CheckMasterServerRequestRestart", &address) || !address)
{
snprintf(error, maxlen, "Failed to find CBaseServer__CheckMasterServerRequestRestart function.\n");
return false;
}
int steam3ServerFuncOffset = 0;
if (!g_pGameConf->GetOffset("CheckMasterServerRequestRestart_Steam3ServerFuncOffset", &steam3ServerFuncOffset) || steam3ServerFuncOffset == 0)
{
snprintf(error, maxlen, "Failed to find CheckMasterServerRequestRestart_Steam3ServerFuncOffset offset.\n");
return false;
}
//META_CONPRINTF("CheckMasterServerRequestRestart: %p\n", address);
address = (void *)((intptr_t)address + steam3ServerFuncOffset);
g_pSteam3ServerFunc = (Steam3ServerFunc)((intptr_t)address + *((int32_t *)address) + sizeof(int32_t));
//META_CONPRINTF("Steam3Server: %p\n", g_pSteam3ServerFunc);
#endif
g_pSteam3Server = Steam3Server();
if (!g_pSteam3Server)
{
snprintf(error, maxlen, "Unable to get Steam3Server singleton.\n");
return false;
}
if (!g_pSteam3Server->m_pSteamGameServer)
{
snprintf(error, maxlen, "Unable to get Steam Game Server.\n");
return false;
}
/*
META_CONPRINTF("ISteamGameServer: %p\n", g_pSteam3Server->m_pSteamGameServer);
META_CONPRINTF("ISteamUtils: %p\n", g_pSteam3Server->m_pSteamGameServerUtils);
META_CONPRINTF("ISteamMasterServerUpdater: %p\n", g_pSteam3Server->m_pSteamMasterServerUpdater);
META_CONPRINTF("ISteamNetworking: %p\n", g_pSteam3Server->m_pSteamGameServerNetworking);
META_CONPRINTF("ISteamGameServerStats: %p\n", g_pSteam3Server->m_pSteamGameServerStats);
*/
void** vtable = *((void***)g_pSteam3Server->m_pSteamGameServer);
int offset = 0;
if (!g_pGameConf->GetOffset("ISteamGameServer__BeginAuthSession", &offset) || offset == 0)
{
snprintf(error, maxlen, "Failed to find ISteamGameServer__BeginAuthSession offset.\n");
return false;
}
g_pBeginAuthSession.SetAddress(vtable[offset]);
offset = 0;
if (!g_pGameConf->GetOffset("ISteamGameServer__EndAuthSession", &offset) || offset == 0)
{
snprintf(error, maxlen, "Failed to find ISteamGameServer__EndAuthSession offset.\n");
return false;
}
g_pEndAuthSession.SetAddress(vtable[offset]);
SH_MANUALHOOK_RECONFIGURE(MHook_BeginAuthSession, offset, 0, 0);
if (SH_ADD_MANUALHOOK(MHook_BeginAuthSession, g_pSteam3Server->m_pSteamGameServer, SH_STATIC(Hook_BeginAuthSession), true) == 0)
{
snprintf(error, maxlen, "Failed to setup ISteamGameServer__BeginAuthSession hook.\n");
return false;
}
CDetourManager::Init(g_pSM->GetScriptingEngine(), g_pGameConf);
detourCBaseServer__ConnectClient = DETOUR_CREATE_MEMBER(CBaseServer__ConnectClient, "CBaseServer__ConnectClient");
if (detourCBaseServer__ConnectClient == nullptr)
{
snprintf(error, maxlen, "Failed to create CBaseServer__ConnectClient detour.\n");
return false;
}
detourCBaseServer__ConnectClient->EnableDetour();
g_pConnectForward = g_pForwards->CreateForward("OnClientPreConnectEx", ET_LowEvent, 5, NULL, Param_String, Param_String, Param_String, Param_String, Param_String);
return true;
}
bool Connect::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late)
{
GET_V_IFACE_CURRENT(GetEngineFactory, g_pCVar, ICvar, CVAR_INTERFACE_VERSION);
ConVar_Register(0, this);
return true;
}
void Connect::SDK_OnUnload()
{
g_pForwards->ReleaseForward(g_pConnectForward);
gameconfs->CloseGameConfigFile(g_pGameConf);
}
bool Connect::SDK_OnMetamodUnload(char *error, size_t maxlen)
{
if (detourCBaseServer__ConnectClient)
{
detourCBaseServer__ConnectClient->DisableDetour();
delete detourCBaseServer__ConnectClient;
}
return true;
}
bool Connect::RegisterConCommandBase(ConCommandBase *pCommand)
{
META_REGCVAR(pCommand);
return true;
}
-27
View File
@@ -1,27 +0,0 @@
#ifndef _INCLUDE_VERSION_INFORMATION_H_
#define _INCLUDE_VERSION_INFORMATION_H_
/**
* @file Contains version information.
* @brief This file will redirect to an autogenerated version if being compiled via
* the build scripts.
*/
#if defined SM_GENERATED_BUILD
#include "version_auto.h"
#else
#ifndef SM_GENERATED_BUILD
#undef BINARY_NAME
#define BINARY_NAME "connect.ext.dll\0"
#endif
#define SM_BUILD_TAG "-manual"
#define SM_BUILD_UNIQUEID "[MANUAL BUILD]"
#define SM_VERSION "1.2.0"
#define SM_FULL_VERSION SM_VERSION SM_BUILD_TAG
#define SM_FILE_VERSION 1,2,0,0
#endif
#endif /* _INCLUDE_VERSION_INFORMATION_H_ */
-45
View File
@@ -1,45 +0,0 @@
#include "winres.h"
#include <version.h>
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif
#ifndef SM_GENERATED_BUILD
#define BINARY_NAME "connect.ext.dll\0"
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION SM_FILE_VERSION
PRODUCTVERSION SM_FILE_VERSION
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "Connect Extension"
VALUE "FileDescription", "SourceMod Connect Extension"
VALUE "FileVersion", SM_BUILD_UNIQUEID
VALUE "InternalName", "Connect"
VALUE "LegalCopyright", "Copyright (c) 2012, Asher Baker"
VALUE "OriginalFilename", BINARY_NAME
VALUE "ProductName", "Connect Extension"
VALUE "ProductVersion", SM_FULL_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 0x04B0
END
END
+178
View File
@@ -0,0 +1,178 @@
"Games"
{
"#default"
{
"#supported"
{
"engine" "dods"
"engine" "css"
"engine" "hl2dm"
"engine" "tf2"
}
"Offsets"
{
"ISteamGameServer__BeginAuthSession"
{
"linux" "29"
"linux64" "29"
"windows" "29"
}
"ISteamGameServer__EndAuthSession"
{
"linux" "30"
"linux64" "30"
"windows" "30"
}
}
"Signatures"
{
"Steam3Server"
{
"library" "engine"
"linux" "@_Z12Steam3Serverv"
"linux64" "@_Z12Steam3Serverv"
}
}
}
"#default"
{
"#supported"
{
"engine" "dods"
"engine" "css"
"engine" "hl2dm"
"engine" "tf2"
}
"Offsets"
{
"ISteamGameServer__BeginAuthSession"
{
"linux" "26"
"linux64" "26"
"windows" "26"
"windows64" "26"
}
"ISteamGameServer__EndAuthSession"
{
"linux" "27"
"linux64" "27"
"windows" "27"
"windows64" "27"
}
"CheckMasterServerRequestRestart_Steam3ServerFuncOffset"
{
"windows" "240"
"windows64" "299"
}
}
"Signatures"
{
"CBaseServer__ConnectClient"
{
"library" "engine"
"linux" "@_ZN11CBaseServer13ConnectClientER8netadr_siiiiPKcS3_S3_i"
"linux64" "@_ZN11CBaseServer13ConnectClientER8netadr_siiiiPKcS3_S3_i"
"windows" "\x55\x8B\xEC\x81\xEC\x24\x05\x00\x00\x53\x56\x57\x68\x2A\x2A\x2A\x2A"
"windows64" "\x48\x89\x5C\x24\x2A\x44\x89\x4C\x24\x2A\x55\x56\x57\x41\x54\x41\x55\x41\x56\x41\x57\x48\x81\xEC\x80\x05\x00\x00"
}
"CBaseServer__CheckChallengeType"
{
"library" "engine"
"linux" "@_ZN11CBaseServer18CheckChallengeTypeEP11CBaseClientiR8netadr_siPKcii"
"mac" "@_ZN11CBaseServer18CheckChallengeTypeEP11CBaseClientiR8netadr_siPKcii"
"windows" "\x55\x8B\xEC\x83\xEC\x14\x56\x57\x8B\x7D\x14\x8B\xF1"
}
"CBaseServer__RejectConnection"
{
"library" "engine"
"linux" "@_ZN11CBaseServer16RejectConnectionERK8netadr_siPKc"
"linux64" "@_ZN11CBaseServer16RejectConnectionERK8netadr_siPKc"
"windows" "\x55\x8B\xEC\x81\xEC\x04\x05\x00\x00\x57"
"windows64" "\x48\x89\x5C\x24\x2A\x48\x89\x6C\x24\x2A\x48\x89\x74\x24\x2A\x57\x48\x81\xEC\x50\x05\x00\x00"
}
"CBaseClient__SetSteamID"
{
"library" "engine"
"linux" "@_ZN11CBaseClient10SetSteamIDERK8CSteamID"
"linux64" "@_ZN11CBaseClient10SetSteamIDERK8CSteamID"
"windows" "\x55\x8B\xEC\x56\x8B\xF1\x57\x8B\x7D\x08\x8D\x4E\x04"
"windows64" "\x48\x89\x5C\x24\x2A\x57\x48\x83\xEC\x20\x48\x8B\x02\x48\x8B\xD9\x48\x89\x41"
}
"CBaseServer__CheckMasterServerRequestRestart"
{
"library" "engine"
"windows" "\x55\x8B\xEC\x83\xEC\x1C\x53\x57\x33\xD2"
"windows64" "\x4C\x8B\xDC\x49\x89\x5B\x2A\x49\x89\x6B\x2A\x56\x57\x41\x54\x41\x56\x41\x57\x48\x83\xEC\x60\x48\x8B\x05\x2A\x2A\x2A\x2A\x48\x8D\x1D"
}
"NET_SendPacket"
{
"library" "engine"
"linux" "@_Z14NET_SendPacketP11INetChanneliRK8netadr_sPKhiP8bf_writeb"
}
"NET_CheckCleanupFakeIPConnection"
{
"library" "engine"
"linux" "@_Z32NET_CheckCleanupFakeIPConnectioniRK8netadr_s"
}
"CSteam3Server__OnValidateAuthTicketResponse"
{
"library" "engine"
"linux" "@_ZN13CSteam3Server28OnValidateAuthTicketResponseEP28ValidateAuthTicketResponse_t"
}
"s_queryRateChecker"
{
"library" "engine"
"linux" "@_ZL18s_queryRateChecker"
}
"CIPRateLimit__CheckIP"
{
"library" "engine"
"linux" "@_ZN12CIPRateLimit7CheckIPE8netadr_s"
}
"CBaseServer__ValidChallenge"
{
"library" "engine"
"linux" "@_ZN11CBaseServer14ValidChallengeER8netadr_si"
}
"CBaseServer__InactivateClients"
{
"library" "engine"
"linux" "@_ZN11CBaseServer17InactivateClientsEv"
}
"net_sockets"
{
"library" "engine"
"linux" "@_ZL11net_sockets"
}
"hltv"
{
"library" "engine"
"linux" "@hltv"
}
"net_time"
{
"library" "engine"
"linux" "@net_time"
}
}
}
}
+1
Submodule hl2sdk-manifests added at f559b1cc8f
+42
View File
@@ -0,0 +1,42 @@
#if defined _Connect_Included
#endinput
#endif
#define _Connect_Included
enum EConnect
{
k_OnClientPreConnectEx_Reject = 0,
k_OnClientPreConnectEx_Accept = 1,
k_OnClientPreConnectEx_Async = -1
};
forward EConnect OnClientPreConnectEx(const char[] sName, char sPassword[255], const char[] sIP, const char[] sSteam32ID, char sRejectReason[255]);
native bool ClientPreConnectEx(const char[] sSteam32ID, EConnect RetVal, char sRejectReason[255]);
native bool SteamClientAuthenticated(const char[] sSteam32ID);
/**
* Do not edit below this line!
*/
public Extension __ext_connect =
{
name = "Connect",
file = "connect.ext",
#if defined AUTOLOAD_EXTENSIONS
autoload = 1,
#else
autoload = 0,
#endif
#if defined REQUIRE_EXTENSIONS
required = 1,
#else
required = 0,
#endif
};
#if !defined REQUIRE_EXTENSIONS
public __ext_connect_SetNTVOptional()
{
MarkNativeAsOptional("ClientPreConnectEx");
}
#endif
-1
View File
@@ -1 +0,0 @@
1.4.0
+81 -80
View File
@@ -1,80 +1,81 @@
/** /**
* ============================================================================= * vim: set ts=4 :
* connect Extension * =============================================================================
* Copyright (C) 2011 Asher Baker (asherkin). All rights reserved. * SourceMod Sample Extension
* ============================================================================= * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* * =============================================================================
* This program is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License, version 3.0, as published by the * This program is free software; you can redistribute it and/or modify it under
* Free Software Foundation. * the terms of the GNU General Public License, version 3.0, as published by the
* * Free Software Foundation.
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * This program is distributed in the hope that it will be useful, but WITHOUT
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* details. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* * details.
* You should have received a copy of the GNU General Public License along with *
* this program. If not, see <http://www.gnu.org/licenses/>. * You should have received a copy of the GNU General Public License along with
* * this program. If not, see <http://www.gnu.org/licenses/>.
* As a special exception, AlliedModders LLC gives you permission to link the *
* code of this program (as well as its derivative works) to "Half-Life 2," the * As a special exception, AlliedModders LLC gives you permission to link the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software * code of this program (as well as its derivative works) to "Half-Life 2," the
* by the Valve Corporation. You must obey the GNU General Public License in * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* all respects for all other code used. Additionally, AlliedModders LLC grants * by the Valve Corporation. You must obey the GNU General Public License in
* this exception to all derivative works. AlliedModders LLC defines further * all respects for all other code used. Additionally, AlliedModders LLC grants
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), * this exception to all derivative works. AlliedModders LLC defines further
* or <http://www.sourcemod.net/license.php>. * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
*/ * or <http://www.sourcemod.net/license.php>.
*
#ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ * Version: $Id$
#define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ */
/** #ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
* @file smsdk_config.hpp #define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
* @brief Contains macros for configuring basic extension information.
*/ /**
* @file smsdk_config.h
#include "version.h" // SM_FULL_VERSION * @brief Contains macros for configuring basic extension information.
*/
/* Basic information exposed publicly */
#define SMEXT_CONF_NAME "Connect" /* Basic information exposed publicly */
#define SMEXT_CONF_DESCRIPTION "Forward for early connection" #define SMEXT_CONF_NAME "Connect"
#define SMEXT_CONF_VERSION SM_FULL_VERSION #define SMEXT_CONF_DESCRIPTION "Forward for early connection"
#define SMEXT_CONF_AUTHOR "Asher \"asherkin\" Baker" #define SMEXT_CONF_VERSION "2.6-SANITY-CHECK"
#define SMEXT_CONF_URL "http://limetech.org/" #define SMEXT_CONF_AUTHOR "Asher \"asherkin\" Baker + BotoX + Neon"
#define SMEXT_CONF_LOGTAG "CONNECT" #define SMEXT_CONF_URL "https://github.com/CSSZombieEscape/sm-ext-connect"
#define SMEXT_CONF_LICENSE "GPL" #define SMEXT_CONF_LOGTAG "CONNECT"
#define SMEXT_CONF_DATESTRING __DATE__ #define SMEXT_CONF_LICENSE "GPL"
#define SMEXT_CONF_DATESTRING __DATE__
/**
* @brief Exposes plugin's main interface. /**
*/ * @brief Exposes plugin's main interface.
#define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name; */
#define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name;
/**
* @brief Sets whether or not this plugin required Metamod. /**
* NOTE: Uncomment to enable, comment to disable. * @brief Sets whether or not this plugin required Metamod.
*/ * NOTE: Uncomment to enable, comment to disable.
#define SMEXT_CONF_METAMOD */
#define SMEXT_CONF_METAMOD
/** Enable interfaces you want to use here by uncommenting lines */
#define SMEXT_ENABLE_FORWARDSYS /** Enable interfaces you want to use here by uncommenting lines */
//#define SMEXT_ENABLE_HANDLESYS #define SMEXT_ENABLE_FORWARDSYS
//#define SMEXT_ENABLE_PLAYERHELPERS //#define SMEXT_ENABLE_HANDLESYS
//#define SMEXT_ENABLE_DBMANAGER #define SMEXT_ENABLE_PLAYERHELPERS
#define SMEXT_ENABLE_GAMECONF //#define SMEXT_ENABLE_DBMANAGER
//#define SMEXT_ENABLE_MEMUTILS #define SMEXT_ENABLE_GAMECONF
//#define SMEXT_ENABLE_GAMEHELPERS //#define SMEXT_ENABLE_MEMUTILS
//#define SMEXT_ENABLE_TIMERSYS //#define SMEXT_ENABLE_GAMEHELPERS
//#define SMEXT_ENABLE_THREADER #define SMEXT_ENABLE_TIMERSYS
//#define SMEXT_ENABLE_LIBSYS //#define SMEXT_ENABLE_THREADER
//#define SMEXT_ENABLE_MENUS //#define SMEXT_ENABLE_LIBSYS
//#define SMEXT_ENABLE_ADTFACTORY //#define SMEXT_ENABLE_MENUS
//#define SMEXT_ENABLE_PLUGINSYS //#define SMEXT_ENABLE_ADTFACTORY
//#define SMEXT_ENABLE_ADMINSYS //#define SMEXT_ENABLE_PLUGINSYS
//#define SMEXT_ENABLE_TEXTPARSERS //#define SMEXT_ENABLE_ADMINSYS
//#define SMEXT_ENABLE_USERMSGS //#define SMEXT_ENABLE_TEXTPARSERS
//#define SMEXT_ENABLE_TRANSLATOR //#define SMEXT_ENABLE_USERMSGS
//#define SMEXT_ENABLE_NINVOKE //#define SMEXT_ENABLE_TRANSLATOR
//#define SMEXT_ENABLE_ROOTCONSOLEMENU
#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
-71
View File
@@ -1,71 +0,0 @@
import re, os, sys
import subprocess
import zipfile
import ftplib
platform = 'unknown'
if sys.platform.startswith('linux'):
platform = 'linux'
elif sys.platform.startswith('win32'):
platform = 'windows'
elif sys.platform.startswith('darwin'):
platform = 'mac'
def HGVersion():
p = subprocess.Popen(['hg', 'identify', '-n'], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
(stdout, stderr) = p.communicate()
stdout = stdout.decode('UTF-8')
return stdout.rstrip('+\r\n')
def ReleaseVersion():
productFile = open('product.version', 'r')
productContents = productFile.read()
productFile.close()
m = re.match('(\d+)\.(\d+)\.(\d+)(.*)', productContents)
if m == None:
raise Exception('Could not detremine product version')
major, minor, release, tag = m.groups()
return '.'.join([major, minor, release])
filename = '-'.join(['connect', ReleaseVersion(), 'hg' + HGVersion(), platform])
debug_build = os.environ.get('is_debug_build', False) == "1"
if debug_build:
filename += '-debug'
filename += '.zip'
zip = zipfile.ZipFile(filename, 'w', zipfile.ZIP_DEFLATED)
for base, dirs, files in os.walk('package'):
for file in files:
fn = os.path.join(base, file)
fns = fn[(len('package') + 1):]
zip.write(fn, fns)
print("%-33s %-10s %21s %12s" % ("File Name", "CRC32", "Modified ", "Size"))
for zinfo in zip.infolist():
date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6]
print("%-33s %-10d %21s %12d" % (zinfo.filename, zinfo.CRC, date, zinfo.file_size))
zip.close()
if 'ftp_hostname' in os.environ:
print('')
ftp = ftplib.FTP(os.environ['ftp_hostname'], os.environ['ftp_username'], os.environ['ftp_password'])
print('Connected to server, uploading build...')
ftp.cwd(os.environ['ftp_directory'])
print(ftp.storbinary('STOR ' + filename, open(filename, 'rb')))
ftp.quit()
print('Uploaded as \'' + filename + '\'')
os.unlink(filename)