Compare commits
158
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49e2303a5b | ||
|
|
fe0b9f7320 | ||
|
|
b16c758f88 | ||
|
|
da729c3c08 | ||
|
|
f1bcb2ad3e | ||
|
|
9270399eb1 | ||
|
|
76e6edbad4 | ||
|
|
58ca1508bc | ||
|
|
eed1df28ec | ||
|
|
a602d7d107 | ||
|
|
9a08986fd1 | ||
|
|
5d1820853a | ||
|
|
753aced2a3 | ||
|
|
df47457321 | ||
|
|
d9e818e5d9 | ||
|
|
47c840c9b4 | ||
|
|
2bfc5d3e1e | ||
|
|
4307c57697 | ||
|
|
bff0faff52 | ||
|
|
749966ae66 | ||
|
|
9f11132fb5 | ||
|
|
2dfbd1fc1f | ||
|
|
7c659837bf | ||
|
|
7cf342a1a7 | ||
|
|
e8d6aab989 | ||
|
|
0819278465 | ||
|
|
d89c57ba79 | ||
|
|
23b10fc559 | ||
|
|
36e8e881e8 | ||
|
|
67011834df | ||
|
|
ed9f68814f | ||
|
|
79a8008280 | ||
|
|
643dce8cb1 | ||
|
|
3669b98986 | ||
|
|
e075b7b9b2 | ||
|
|
b95fda8342 | ||
|
|
5abec70579 | ||
|
|
8800d5311c | ||
|
|
3705210879 | ||
|
|
5f4befcb6a | ||
|
|
314011f118 | ||
|
|
a9b7a5dc5c | ||
|
|
9b78c68b1b | ||
|
|
328109be1f | ||
|
|
aba0f29666 | ||
|
|
bdefb58e5f | ||
|
|
7ad3a57c47 | ||
|
|
5a2f3cf433 | ||
|
|
fffc27a348 | ||
|
|
cecb7cb6a2 | ||
|
|
f5cc5eb757 | ||
|
|
689406744b | ||
|
|
603da899b7 | ||
|
|
9b4d1f6972 | ||
|
|
d56b222637 | ||
|
|
dfefda81e1 | ||
|
|
0c463b1f86 | ||
|
|
bf345eea8c | ||
|
|
5328447b74 | ||
|
|
db6881b7e3 | ||
|
|
3e96b1617a | ||
|
|
7ef8b415bb | ||
|
|
9a5d6957b9 | ||
|
|
b5a2ec7a5e | ||
|
|
373136af4e | ||
|
|
8673c11341 | ||
|
|
8c082de148 | ||
|
|
e62d47a85e | ||
|
|
2d32c587ba | ||
|
|
31e29ee94c | ||
|
|
e95e453258 | ||
|
|
48b0f61551 | ||
|
|
ef88fc21a1 | ||
|
|
558c8c9745 | ||
|
|
2f60680cfb | ||
|
|
1ffcf7a664 | ||
|
|
c00b688ab7 | ||
|
|
4169e25451 | ||
|
|
85fc65bae5 | ||
|
|
aed62d5670 | ||
|
|
01d46b8c9c | ||
|
|
f70b48276e | ||
|
|
f0070e45a0 | ||
|
|
11782cee90 | ||
|
|
24b86584a2 | ||
|
|
01b3eee1b8 | ||
|
|
2fb3f8ab0f | ||
|
|
2c7b0e04e9 | ||
|
|
9f3e9a2ff4 | ||
|
|
d9d5b65f2c | ||
|
|
90cc2d6c37 | ||
|
|
1ab5403f9f | ||
|
|
4d03a4ef60 | ||
|
|
46b714108a | ||
|
|
242e1c99e2 | ||
|
|
3d0e661cd6 | ||
|
|
d076aca9ea | ||
|
|
f824a53f21 | ||
|
|
87ca5e6e05 | ||
|
|
23af5357c0 | ||
|
|
d6b82d5dcc | ||
|
|
664da97c42 | ||
|
|
b6507b12d4 | ||
|
|
a5ab381c0a | ||
|
|
8ec5e42c7a | ||
|
|
006423dcf2 | ||
|
|
d0f4d943b6 | ||
|
|
2fd9674e09 | ||
|
|
23fca5e645 | ||
|
|
4beb7fe869 | ||
|
|
2e832f2d01 | ||
|
|
43602da743 | ||
|
|
763b73b9c5 | ||
|
|
ffb6e84b45 | ||
|
|
025f216e09 | ||
|
|
603ac75a08 | ||
|
|
1b07722848 | ||
|
|
4de8d67e27 | ||
|
|
83baabe00a | ||
|
|
3080ca1ccb | ||
|
|
c3b0f8a4d2 | ||
|
|
726ee43736 | ||
|
|
8e1f37a5d2 | ||
|
|
ce342ef6fc | ||
|
|
0a6acda737 | ||
|
|
c907c723c3 | ||
|
|
479815911d | ||
|
|
29954ec122 | ||
|
|
75455b65da | ||
|
|
5688eb55ec | ||
|
|
2e4aae95db | ||
|
|
cc43b63508 | ||
|
|
59593a2d5f | ||
|
|
e3f5d5b6cf | ||
|
|
6085125367 | ||
|
|
27805463e3 | ||
|
|
45f2b9f8ca | ||
|
|
2bd979d62e | ||
|
|
e434c43e28 | ||
|
|
02922df1cd | ||
|
|
035875f5c1 | ||
|
|
e3a3dda1d8 | ||
|
|
7187dde64d | ||
|
|
fd09d7b176 | ||
|
|
4e8fc2749b | ||
|
|
8b362700ff | ||
|
|
e926a3b94b | ||
|
|
83d1fc9abe | ||
|
|
d6a5d99e55 | ||
|
|
6322a711c2 | ||
|
|
e024871b50 | ||
|
|
b4e939e273 | ||
|
|
13743376ee | ||
|
|
69cfd36054 | ||
|
|
7d15ec4d15 | ||
|
|
b52a10f28b | ||
|
|
da7c65f0e3 | ||
|
|
a5d2945fc5 |
@@ -1,15 +1,11 @@
|
||||
# Binaries
|
||||
\.dll$
|
||||
\.dylib$
|
||||
\.exe$
|
||||
\.so$
|
||||
|
||||
# Files generated by Visual Studio
|
||||
\.aps$
|
||||
\.ipch$
|
||||
\.ncb$
|
||||
\.opensdf$
|
||||
\.sdf$
|
||||
\.suo$
|
||||
\.user$
|
||||
|
||||
@@ -24,5 +20,3 @@
|
||||
# Files generated by Windows Explorer
|
||||
(^|/)[dD]esktop\.ini$
|
||||
(^|/)[tT]humbs\.db$
|
||||
syntax: glob
|
||||
build/*
|
||||
|
||||
@@ -3,9 +3,6 @@ e6ef5ecdf8d75740ca2685a709bf321f8873bc3b sourcemod-1.1.0
|
||||
e877885fac80be71822641f7a9122cebc9812521 sourcemod-1.1.1
|
||||
b3ffa8a4511c4eadaf533fc790aa6b14f7f0c6ea sourcemod-1.1.2
|
||||
3a73bbf60f34befa9b66be03fa5974b394bb3411 sourcemod-1.2.0
|
||||
78a1f1b1c6fa86fd7691c70ebf48a9fb3dfb3c11 sourcemod-1.5.0
|
||||
5574bfe07731b7dba171c1300f6022319d2dbc89 sourcemod-1.5.1
|
||||
238c41726d73d9f0d65005ff43c1ab86adb0e163 sourcemod-1.5.2
|
||||
27bf76b007d2360a9cfc7af9e14d1c9a6bddcc64 sourcemod-1.5.3
|
||||
27bf76b007d2360a9cfc7af9e14d1c9a6bddcc64 sourcemod-1.5.3
|
||||
0000000000000000000000000000000000000000 sourcemod-1.5.3
|
||||
a71318396392e3c6d0ff31e069a60fbde59e0cea sourcemod-1.3.0
|
||||
3f33d01fcc28b509bed30f7be07ed215cc000538 sourcemod-1.3.1
|
||||
a3e8f7a7fdf7f012dd02ad491a2e1ccdad151687 sourcemod-1.3.2
|
||||
|
||||
+302
-481
@@ -1,490 +1,311 @@
|
||||
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
|
||||
import os, sys
|
||||
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||
import os
|
||||
import sys
|
||||
from ambuild.command import SymlinkCommand
|
||||
|
||||
class SDK(object):
|
||||
def __init__(self, sdk, ext, aDef, name, platform, dir):
|
||||
if dir == 'ep1':
|
||||
folder = 'hl2sdk'
|
||||
else:
|
||||
folder = 'hl2sdk-' + dir
|
||||
self.envvar = sdk
|
||||
self.ext = ext
|
||||
self.code = aDef
|
||||
self.define = name
|
||||
self.platform = platform
|
||||
self.folder = folder # Default folder name.
|
||||
self.name = dir
|
||||
self.path = None # Actual path
|
||||
class SM:
|
||||
def __init__(self):
|
||||
self.compiler = Cpp.Compiler()
|
||||
|
||||
WinOnly = ['windows']
|
||||
WinLinux = ['windows', 'linux']
|
||||
WinLinuxMac = ['windows', 'linux', 'mac']
|
||||
#Build SDK info
|
||||
self.sdkInfo = { }
|
||||
self.sdkInfo['ep1'] = {'sdk': 'HL2SDK', 'ext': '1.ep1', 'def': '1',
|
||||
'name': 'EPISODEONE'}
|
||||
self.sdkInfo['ep2'] = {'sdk': 'HL2SDKOB', 'ext': '2.ep2', 'def': '3',
|
||||
'name': 'ORANGEBOX'}
|
||||
self.sdkInfo['ep2v'] = {'sdk': 'HL2SDKOBVALVE', 'ext': '2.ep2v', 'def': '4',
|
||||
'name': 'ORANGEBOXVALVE'}
|
||||
self.sdkInfo['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '5',
|
||||
'name': 'LEFT4DEAD'}
|
||||
self.sdkInfo['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '6',
|
||||
'name': 'LEFT4DEAD2'}
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
self.sdkInfo['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
|
||||
'name': 'DARKMESSIAH'}
|
||||
|
||||
PossibleSDKs = {
|
||||
'ep1': SDK('HL2SDK', '1.ep1', '1', 'EPISODEONE', WinLinux, 'ep1'),
|
||||
'ep2': SDK('HL2SDKOB', '2.ep2', '3', 'ORANGEBOX', WinLinux, 'ob'),
|
||||
'css': SDK('HL2SDKCSS', '2.css', '6', 'CSS', WinLinuxMac, 'css'),
|
||||
'hl2dm': SDK('HL2SDKHL2DM', '2.hl2dm', '7', 'HL2DM', WinLinuxMac, 'hl2dm'),
|
||||
'dods': SDK('HL2SDKDODS', '2.dods', '8', 'DODS', WinLinuxMac, 'dods'),
|
||||
'tf2': SDK('HL2SDKTF2', '2.tf2', '10', 'TF2', WinLinuxMac, 'tf2'),
|
||||
'l4d': SDK('HL2SDKL4D', '2.l4d', '11', 'LEFT4DEAD', WinLinuxMac, 'l4d'),
|
||||
'nd': SDK('HL2SDKND', '2.nd', '12', 'NUCLEARDAWN', WinLinuxMac, 'nd'),
|
||||
'l4d2': SDK('HL2SDKL4D2', '2.l4d2', '13', 'LEFT4DEAD2', WinLinuxMac, 'l4d2'),
|
||||
'darkm': SDK('HL2SDK-DARKM', '2.darkm', '2', 'DARKMESSIAH', WinOnly, 'darkm'),
|
||||
'swarm': SDK('HL2SDK-SWARM', '2.swarm', '14', 'ALIENSWARM', WinOnly, 'swarm'),
|
||||
'bgt': SDK('HL2SDK-BGT', '2.bgt', '4', 'BLOODYGOODTIME', WinOnly, 'bgt'),
|
||||
'eye': SDK('HL2SDK-EYE', '2.eye', '5', 'EYE', WinOnly, 'eye'),
|
||||
'csgo': SDK('HL2SDKCSGO', '2.csgo', '18', 'CSGO', WinLinuxMac, 'csgo'),
|
||||
'portal2': SDK('HL2SDKPORTAL2', '2.portal2', '15', 'PORTAL2', [], 'portal2'),
|
||||
if AMBuild.mode == 'config':
|
||||
#Detect compilers
|
||||
self.compiler.DetectAll(AMBuild)
|
||||
|
||||
# These engines are only supported on SourceMod 1.6.
|
||||
# 'blade': SDK('HL2SDKBLADE', '2.blade', '16', 'BLADE', WinLinux, 'blade'),
|
||||
# 'dota': SDK('HL2SDKDOTA', '2.dota', '19', 'DOTA', WinOnly, 'dota'),
|
||||
# 'insurgency': SDK('HL2SDKINSURGENCY', '2.insurgency', '17', 'INSURGENCY', WinLinuxMac, 'insurgency'),
|
||||
# 'sdk2013': SDK('HL2SDK2013', '2.sdk2013', '9', 'SDK2013', WinLinuxMac, '2013'),
|
||||
#Detect variables
|
||||
envvars = { 'MMSOURCE18': 'mmsource-1.8',
|
||||
'HL2SDK': 'hl2sdk',
|
||||
'HL2SDKOB': 'hl2sdk-ob',
|
||||
'HL2SDKL4D': 'hl2sdk-l4d',
|
||||
'HL2SDKOBVALVE': 'hl2sdk-ob-valve',
|
||||
'HL2SDKL4D2': 'hl2sdk-l4d2',
|
||||
'MYSQL5': 'mysql-5.0'
|
||||
}
|
||||
|
||||
#Dark Messiah is Windows-only
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
envvars['HL2SDK-DARKM'] = 'hl2sdk-darkm'
|
||||
|
||||
#Must have a path for each envvar (file a bug if you don't like this)
|
||||
for i in envvars:
|
||||
if i in os.environ:
|
||||
path = os.environ[i]
|
||||
if not os.path.isdir(path):
|
||||
raise Exception('Path for {0} was not found: {1}'.format(i, path))
|
||||
else:
|
||||
head = os.getcwd()
|
||||
oldhead = None
|
||||
while head != None and head != oldhead:
|
||||
path = os.path.join(head, envvars[i])
|
||||
if os.path.isdir(path):
|
||||
break
|
||||
oldhead = head
|
||||
head, tail = os.path.split(head)
|
||||
if head == None or head == oldhead:
|
||||
raise Exception('Could not find a valid path for {0}'.format(i))
|
||||
AMBuild.cache.CacheVariable(i, path)
|
||||
|
||||
#Set up defines
|
||||
cxx = self.compiler.cxx
|
||||
if isinstance(cxx, Cpp.GCC):
|
||||
self.vendor = 'gcc'
|
||||
self.compiler.AddToListVar('CDEFINES', 'stricmp=strcasecmp')
|
||||
self.compiler.AddToListVar('CDEFINES', '_stricmp=strcasecmp')
|
||||
self.compiler.AddToListVar('CDEFINES', '_snprintf=snprintf')
|
||||
self.compiler.AddToListVar('CDEFINES', '_vsnprintf=vsnprintf')
|
||||
self.compiler.AddToListVar('CFLAGS', '-pipe')
|
||||
self.compiler.AddToListVar('CFLAGS', '-fno-strict-aliasing')
|
||||
if cxx.majorVersion >= 4:
|
||||
self.compiler.AddToListVar('CFLAGS', '-fvisibility=hidden')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '-fvisibility-inlines-hidden')
|
||||
self.compiler.AddToListVar('CFLAGS', '-Wall')
|
||||
self.compiler.AddToListVar('CFLAGS', '-Werror')
|
||||
self.compiler.AddToListVar('CFLAGS', '-Wno-uninitialized')
|
||||
self.compiler.AddToListVar('CFLAGS', '-Wno-unused')
|
||||
self.compiler.AddToListVar('CFLAGS', '-Wno-switch')
|
||||
self.compiler.AddToListVar('CFLAGS', '-mfpmath=sse')
|
||||
self.compiler.AddToListVar('CFLAGS', '-msse')
|
||||
self.compiler.AddToListVar('CFLAGS', '-m32')
|
||||
self.compiler.AddToListVar('CFLAGS', '-static-libgcc')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '-fno-exceptions')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '-fno-rtti')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '-fno-threadsafe-statics')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '-Wno-non-virtual-dtor')
|
||||
self.compiler.AddToListVar('CDEFINES', 'HAVE_STDINT_H')
|
||||
elif isinstance(cxx, Cpp.MSVC):
|
||||
self.vendor = 'msvc'
|
||||
if AMBuild.options.debug == '1':
|
||||
self.compiler.AddToListVar('CFLAGS', '/MTd')
|
||||
else:
|
||||
self.compiler.AddToListVar('CFLAGS', '/MT')
|
||||
self.compiler.AddToListVar('CDEFINES', '_CRT_SECURE_NO_DEPRECATE')
|
||||
self.compiler.AddToListVar('CDEFINES', '_CRT_SECURE_NO_WARNINGS')
|
||||
self.compiler.AddToListVar('CDEFINES', '_CRT_NONSTDC_NO_DEPRECATE')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '/EHsc')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '/GR-')
|
||||
self.compiler.AddToListVar('CFLAGS', '/W3')
|
||||
self.compiler.AddToListVar('CFLAGS', '/nologo')
|
||||
self.compiler.AddToListVar('CFLAGS', '/Zi')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '/TP')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '/DEBUG')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '/MACHINE:X86')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '/SUBSYSTEM:WINDOWS')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', 'kernel32.lib')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', 'user32.lib')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', 'gdi32.lib')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', 'winspool.lib')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', 'comdlg32.lib')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', 'advapi32.lib')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', 'shell32.lib')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', 'ole32.lib')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', 'oleaut32.lib')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', 'uuid.lib')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', 'odbc32.lib')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', 'odbccp32.lib')
|
||||
|
||||
#Optimization
|
||||
if AMBuild.options.opt == '1':
|
||||
self.compiler.AddToListVar('CDEFINES', 'NDEBUG')
|
||||
if self.vendor == 'gcc':
|
||||
self.compiler.AddToListVar('CFLAGS', '-O3')
|
||||
elif self.vendor == 'msvc':
|
||||
self.compiler.AddToListVar('CFLAGS', '/Ot')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '/OPT:ICF')
|
||||
|
||||
#Debugging
|
||||
if AMBuild.options.debug == '1':
|
||||
self.compiler.AddToListVar('CDEFINES', 'DEBUG')
|
||||
self.compiler.AddToListVar('CDEFINES', '_DEBUG')
|
||||
if self.vendor == 'gcc':
|
||||
self.compiler.AddToListVar('CFLAGS', '-g3')
|
||||
elif self.vendor == 'msvc':
|
||||
self.compiler.AddToListVar('CFLAGS', '/Od')
|
||||
self.compiler.AddToListVar('CFLAGS', '/RTC1')
|
||||
|
||||
#Platform-specifics
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
self.compiler.AddToListVar('CDEFINES', '_LINUX')
|
||||
elif AMBuild.target['platform'] == 'windows':
|
||||
self.compiler.AddToListVar('CDEFINES', 'WIN32')
|
||||
self.compiler.AddToListVar('CDEFINES', '_WINDOWS')
|
||||
|
||||
#Finish up
|
||||
self.compiler.AddToListVar('CDEFINES', 'SOURCEMOD_BUILD')
|
||||
self.compiler.AddToListVar('CDEFINES', 'SM_GENERATED_BUILD')
|
||||
self.compiler.AddToListVar('CINCLUDES',
|
||||
os.path.join(AMBuild.outputFolder, 'includes'))
|
||||
self.compiler.ToConfig(AMBuild, 'compiler')
|
||||
AMBuild.cache.CacheVariable('vendor', self.vendor)
|
||||
self.targetMap = { }
|
||||
AMBuild.cache.CacheVariable('targetMap', self.targetMap)
|
||||
else:
|
||||
self.compiler.FromConfig(AMBuild, 'compiler')
|
||||
self.targetMap = AMBuild.cache['targetMap']
|
||||
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
self.compiler.AddToListVar('RCINCLUDES', os.path.join(AMBuild.sourceFolder, 'public'))
|
||||
self.compiler.AddToListVar('RCINCLUDES',
|
||||
os.path.join(AMBuild.outputFolder, 'includes'))
|
||||
self.mmsPath = AMBuild.cache['MMSOURCE18']
|
||||
|
||||
def DefaultCompiler(self):
|
||||
return self.compiler.Clone()
|
||||
|
||||
def JobMatters(self, jobname):
|
||||
file = sys._getframe().f_code.co_filename
|
||||
if AMBuild.mode == 'config':
|
||||
self.targetMap[jobname] = file
|
||||
return True
|
||||
if len(AMBuild.args) == 0:
|
||||
return True
|
||||
if not jobname in AMBuild.args:
|
||||
return False
|
||||
|
||||
def DefaultExtCompiler(self, path):
|
||||
compiler = self.DefaultCompiler()
|
||||
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, path))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, path, 'sdk'))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public'))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'extensions'))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'sourcepawn'))
|
||||
return compiler
|
||||
|
||||
def AutoVersion(self, folder, binary):
|
||||
if AMBuild.target['platform'] != 'windows':
|
||||
return
|
||||
env = {'RCDEFINES': ['BINARY_NAME="' + binary.binaryFile + '"', 'SM_GENERATED_BUILD']}
|
||||
binary.AddResourceFile(os.path.join(folder, 'version.rc' ), env)
|
||||
|
||||
def PreSetupHL2Job(self, job, builder, sdk):
|
||||
info = self.sdkInfo[sdk]
|
||||
sdkPath = AMBuild.cache[info['sdk']]
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
if sdk == 'ep1':
|
||||
staticLibs = os.path.join(sdkPath, 'linux_sdk')
|
||||
else:
|
||||
staticLibs = os.path.join(sdkPath, 'lib', 'linux')
|
||||
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
|
||||
if sdk == 'ep2v' or sdk == 'l4d2':
|
||||
for i in ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.so', 'libtier0.so']:
|
||||
link = os.path.join(workFolder, i)
|
||||
target = os.path.join(staticLibs, i)
|
||||
try:
|
||||
os.lstat(link)
|
||||
except:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
else:
|
||||
for i in ['tier1_i486.a', 'mathlib_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']:
|
||||
link = os.path.join(workFolder, i)
|
||||
target = os.path.join(staticLibs, i)
|
||||
try:
|
||||
os.lstat(link)
|
||||
except:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
elif AMBuild.target['platform'] == 'windows':
|
||||
for lib in ['tier0', 'tier1', 'vstdlib', 'mathlib']:
|
||||
libPath = os.path.join(sdkPath, 'lib', 'public', lib) + '.lib'
|
||||
builder.RebuildIfNewer(libPath)
|
||||
builder['POSTLINKFLAGS'].append(libPath)
|
||||
|
||||
def PostSetupHL2Job(self, job, builder, sdk):
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
builder.AddObjectFiles(['tier1_i486.a', 'mathlib_i486.a'])
|
||||
|
||||
def DefaultHL2Compiler(self, path, sdk, noLink = False, oldMms = '-legacy'):
|
||||
compiler = self.DefaultExtCompiler(path)
|
||||
|
||||
mms = 'core'
|
||||
if sdk == 'ep1':
|
||||
mms += oldMms
|
||||
|
||||
compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms, 'sourcehook'))
|
||||
|
||||
info = self.sdkInfo
|
||||
compiler['CDEFINES'].extend(['SE_' + info[i]['name'] + '=' + info[i]['def'] for i in info])
|
||||
compiler['CDEFINES'].append('SE_DARKMESSIAH=2')
|
||||
|
||||
paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'],
|
||||
['public', 'tier0'], ['public', 'tier1']]
|
||||
if sdk == 'ep1' or sdk == 'darkm':
|
||||
paths.append(['public', 'dlls'])
|
||||
paths.append(['game_shared'])
|
||||
else:
|
||||
paths.append(['public', 'game', 'server'])
|
||||
paths.append(['game', 'shared'])
|
||||
paths.append(['common'])
|
||||
|
||||
info = self.sdkInfo[sdk]
|
||||
sdkPath = AMBuild.cache[info['sdk']]
|
||||
|
||||
compiler['CDEFINES'].append('SOURCE_ENGINE=' + info['def'])
|
||||
|
||||
if sdk == 'ep1':
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
staticLibs = os.path.join(sdkPath, 'linux_sdk')
|
||||
else:
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
staticLibs = os.path.join(sdkPath, 'lib', 'linux')
|
||||
|
||||
for i in paths:
|
||||
compiler['CXXINCLUDES'].append(os.path.join(sdkPath, *i))
|
||||
|
||||
if not noLink:
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['-lm']
|
||||
if sdk == 'ep2v' or sdk == 'l4d2':
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libtier0.so']
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.so']
|
||||
else:
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['tier0_i486.so']
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['vstdlib_i486.so']
|
||||
|
||||
return compiler
|
||||
|
||||
sm = SM()
|
||||
globals = {
|
||||
'SM': sm
|
||||
}
|
||||
|
||||
def ResolveEnvPath(env, folder):
|
||||
if env in os.environ:
|
||||
path = os.environ[env]
|
||||
if os.path.isdir(path):
|
||||
return path
|
||||
else:
|
||||
head = os.getcwd()
|
||||
oldhead = None
|
||||
while head != None and head != oldhead:
|
||||
path = os.path.join(head, folder)
|
||||
if os.path.isdir(path):
|
||||
return path
|
||||
oldhead = head
|
||||
head, tail = os.path.split(head)
|
||||
return None
|
||||
AMBuild.Include(os.path.join('tools', 'buildbot', 'Versioning'), globals)
|
||||
|
||||
class SMConfig(object):
|
||||
def __init__(self):
|
||||
self.sdks = {}
|
||||
self.binaries = []
|
||||
self.extensions = []
|
||||
self.generated_headers = None
|
||||
self.mms_root = None
|
||||
self.mysql_root = None
|
||||
self.spcomp = None
|
||||
self.smx_files = {}
|
||||
self.versionlib = None
|
||||
FileList = [
|
||||
['loader', 'AMBuilder'],
|
||||
['core', 'AMBuilder'],
|
||||
['core', 'logic', 'AMBuilder'],
|
||||
['extensions', 'bintools', 'AMBuilder'],
|
||||
['extensions', 'clientprefs', 'AMBuilder'],
|
||||
['extensions', 'cstrike', 'AMBuilder'],
|
||||
['extensions', 'curl', 'AMBuilder'],
|
||||
['extensions', 'geoip', 'AMBuilder'],
|
||||
['extensions', 'mysql', 'AMBuilder'],
|
||||
['extensions', 'sdktools', 'AMBuilder'],
|
||||
['extensions', 'topmenus', 'AMBuilder'],
|
||||
['extensions', 'updater', 'AMBuilder'],
|
||||
['extensions', 'sqlite', 'AMBuilder'],
|
||||
['extensions', 'regex', 'AMBuilder'],
|
||||
['extensions', 'tf2', 'AMBuilder'],
|
||||
['sourcepawn', 'jit', 'AMBuilder'],
|
||||
['sourcepawn', 'compiler', 'AMBuilder'],
|
||||
['plugins', 'AMBuilder'],
|
||||
['tools', 'buildbot', 'PackageScript']
|
||||
]
|
||||
|
||||
def detectProductVersion(self):
|
||||
builder.AddConfigureFile('product.version')
|
||||
for parts in FileList:
|
||||
AMBuild.Include(os.path.join(*parts), globals)
|
||||
|
||||
# For OS X dylib versioning
|
||||
import re
|
||||
with open(os.path.join(builder.sourcePath, 'product.version'), 'r') as fp:
|
||||
productContents = fp.read()
|
||||
m = re.match('(\d+)\.(\d+)\.(\d+).*', productContents)
|
||||
if m == None:
|
||||
self.productVersion = '1.0.0'
|
||||
else:
|
||||
major, minor, release = m.groups()
|
||||
self.productVersion = '{0}.{1}.{2}'.format(major, minor, release)
|
||||
|
||||
def detectSDKs(self):
|
||||
sdk_list = builder.options.sdks.split(',')
|
||||
use_all = sdk_list[0] == 'all'
|
||||
use_present = sdk_list[0] == 'present'
|
||||
|
||||
for sdk_name in PossibleSDKs:
|
||||
sdk = PossibleSDKs[sdk_name]
|
||||
if builder.target_platform in sdk.platform:
|
||||
sdk_path = ResolveEnvPath(sdk.envvar, sdk.folder)
|
||||
if sdk_path is None:
|
||||
if use_all or sdk_name in sdk_list:
|
||||
raise Exception('Could not find a valid path for {0}'.format(sdk.envvar))
|
||||
continue
|
||||
if use_all or use_present or sdk_name in sdk_list:
|
||||
sdk.path = sdk_path
|
||||
self.sdks[sdk_name] = sdk
|
||||
|
||||
if len(self.sdks) < 1:
|
||||
raise Exception('At least one SDK must be available.')
|
||||
|
||||
self.mms_root = ResolveEnvPath('MMSOURCE110', 'mmsource-1.10')
|
||||
if not self.mms_root:
|
||||
self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'mmsource-central')
|
||||
if not self.mms_root:
|
||||
raise Exception('Could not find a source copy of Metamod:Source')
|
||||
|
||||
if builder.options.hasMySql:
|
||||
for i in range(7):
|
||||
self.mysql_root = ResolveEnvPath('MYSQL5', 'mysql-5.' + str(i))
|
||||
if self.mysql_root:
|
||||
break
|
||||
if not self.mysql_root:
|
||||
raise Exception('Could not find a path to MySQL!')
|
||||
|
||||
def configure(self):
|
||||
builder.AddConfigureFile('pushbuild.txt')
|
||||
|
||||
cfg = builder.DetectCompilers()
|
||||
cxx = cfg.cxx
|
||||
|
||||
if cxx.behavior == 'gcc':
|
||||
cfg.defines += [
|
||||
'stricmp=strcasecmp',
|
||||
'_stricmp=strcasecmp',
|
||||
'_snprintf=snprintf',
|
||||
'_vsnprintf=vsnprintf',
|
||||
'HAVE_STDINT_H',
|
||||
'GNUC',
|
||||
]
|
||||
cfg.cflags += [
|
||||
'-pipe',
|
||||
'-fno-strict-aliasing',
|
||||
'-Wall',
|
||||
'-Werror',
|
||||
'-Wno-uninitialized',
|
||||
'-Wno-unused',
|
||||
'-Wno-switch',
|
||||
'-msse',
|
||||
'-m32',
|
||||
]
|
||||
|
||||
have_gcc = cxx.name == 'gcc'
|
||||
have_clang = cxx.name == 'clang'
|
||||
if have_clang or (have_gcc and cxx.majorVersion >= 4):
|
||||
cfg.cflags += ['-fvisibility=hidden']
|
||||
cfg.cxxflags += ['-fvisibility-inlines-hidden']
|
||||
if have_clang or (have_gcc and cxx.minorVersion >= 6):
|
||||
cfg.cflags += ['-Wno-narrowing']
|
||||
if (have_gcc and cxx.minorVersion >= 7) or (have_clang and cxx.majorVersion >= 3):
|
||||
cfg.cxxflags += ['-Wno-delete-non-virtual-dtor']
|
||||
|
||||
if have_gcc:
|
||||
cfg.cflags += ['-Wno-parentheses']
|
||||
elif have_clang:
|
||||
cfg.cflags += ['-Wno-logical-op-parentheses']
|
||||
|
||||
cfg.linkflags += ['-m32']
|
||||
cfg.cxxflags += [
|
||||
'-fno-exceptions',
|
||||
'-fno-threadsafe-statics',
|
||||
'-Wno-non-virtual-dtor',
|
||||
'-Wno-overloaded-virtual',
|
||||
]
|
||||
|
||||
if have_gcc:
|
||||
cfg.cflags += ['-mfpmath=sse']
|
||||
elif cxx.name == 'msvc':
|
||||
if builder.options.debug == '1':
|
||||
cfg.cflags += ['/MTd']
|
||||
cfg.linkflags += ['/NODEFAULTLIB:libcmt']
|
||||
else:
|
||||
cfg.cflags += ['/MT']
|
||||
cfg.defines += [
|
||||
'_CRT_SECURE_NO_DEPRECATE',
|
||||
'_CRT_SECURE_NO_WARNINGS',
|
||||
'_CRT_NONSTDC_NO_DEPRECATE',
|
||||
'_ITERATOR_DEBUG_LEVEL=0',
|
||||
]
|
||||
cfg.cflags += [
|
||||
'/W3',
|
||||
]
|
||||
cfg.cxxflags += [
|
||||
'/EHsc',
|
||||
'/GR-',
|
||||
'/TP',
|
||||
]
|
||||
cfg.linkflags += [
|
||||
'/MACHINE:X86',
|
||||
'/SUBSYSTEM:WINDOWS',
|
||||
'kernel32.lib',
|
||||
'user32.lib',
|
||||
'gdi32.lib',
|
||||
'winspool.lib',
|
||||
'comdlg32.lib',
|
||||
'advapi32.lib',
|
||||
'shell32.lib',
|
||||
'ole32.lib',
|
||||
'oleaut32.lib',
|
||||
'uuid.lib',
|
||||
'odbc32.lib',
|
||||
'odbccp32.lib',
|
||||
]
|
||||
|
||||
# Optimization
|
||||
if builder.options.opt == '1':
|
||||
cfg.defines += ['NDEBUG']
|
||||
if cxx.behavior == 'gcc':
|
||||
cfg.cflags += ['-O3']
|
||||
elif cxx.behavior == 'msvc':
|
||||
cfg.cflags += ['/Ox']
|
||||
cfg.linkflags += ['/OPT:ICF', '/OPT:REF']
|
||||
|
||||
# Debugging
|
||||
if builder.options.debug == '1':
|
||||
cfg.defines += ['DEBUG', '_DEBUG']
|
||||
if cxx.behavior == 'msvc':
|
||||
cfg.cflags += ['/Od', '/RTC1']
|
||||
if int(cxx.version) >= 1600:
|
||||
cfg.cflags += ['/d2Zi+']
|
||||
|
||||
# This needs to be after our optimization flags which could otherwise disable it.
|
||||
if cxx.name == 'msvc':
|
||||
# Don't omit the frame pointer.
|
||||
cfg.cflags += ['/Oy-']
|
||||
|
||||
# Platform-specifics
|
||||
if builder.target_platform == 'linux':
|
||||
cfg.defines += ['_LINUX', 'POSIX']
|
||||
if cxx.name == 'gcc':
|
||||
cfg.linkflags += ['-static-libgcc']
|
||||
elif cxx.name == 'clang':
|
||||
cfg.linkflags += ['-lgcc_eh']
|
||||
elif builder.target_platform == 'mac':
|
||||
cfg.defines += ['OSX', '_OSX', 'POSIX']
|
||||
cfg.cflags += ['-mmacosx-version-min=10.5']
|
||||
cfg.linkflags += [
|
||||
'-mmacosx-version-min=10.5',
|
||||
'-arch', 'i386',
|
||||
'-lstdc++',
|
||||
'-stdlib=libstdc++',
|
||||
]
|
||||
cfg.cxxflags += ['-stdlib=libstdc++']
|
||||
elif builder.target_platform == 'windows':
|
||||
cfg.defines += ['WIN32', '_WINDOWS']
|
||||
|
||||
# Finish up.
|
||||
cfg.defines += [
|
||||
'SOURCEMOD_BUILD',
|
||||
'SM_GENERATED_BUILD',
|
||||
'SM_USE_VERSIONLIB',
|
||||
]
|
||||
cfg.includes += [os.path.join(builder.buildPath, 'includes')]
|
||||
cfg.includes += [os.path.join(builder.sourcePath, 'versionlib')]
|
||||
|
||||
def LibraryBuilder(self, compiler, name):
|
||||
binary = compiler.Library(name)
|
||||
if builder.target_platform == 'windows':
|
||||
binary.sources += ['version.rc']
|
||||
binary.compiler.rcdefines += [
|
||||
'BINARY_NAME="{0}"'.format(binary.outputFile),
|
||||
'SM_GENERATED_BUILD',
|
||||
'RC_COMPILE',
|
||||
]
|
||||
elif builder.target_platform == 'mac':
|
||||
binary.compiler.postlink += [
|
||||
'-compatibility_version', '1.0.0',
|
||||
'-current_version', self.productVersion
|
||||
]
|
||||
binary.compiler.linkflags += [self.versionlib]
|
||||
binary.compiler.sourcedeps += SM.generated_headers
|
||||
return binary
|
||||
|
||||
def ProgramBuilder(self, compiler, name):
|
||||
binary = compiler.Program(name)
|
||||
if builder.target_platform == 'windows':
|
||||
binary.sources += ['version.rc']
|
||||
binary.compiler.rcdefines += [
|
||||
'BINARY_NAME="{0}"'.format(binary.outputFile),
|
||||
'SM_GENERATED_BUILD',
|
||||
'RC_COMPILE',
|
||||
]
|
||||
binary.compiler.linkflags += [self.versionlib]
|
||||
binary.compiler.sourcedeps += SM.generated_headers
|
||||
return binary
|
||||
|
||||
def Library(self, context, name):
|
||||
compiler = context.compiler.clone()
|
||||
return self.LibraryBuilder(compiler, name)
|
||||
|
||||
def Program(self, context, name):
|
||||
compiler = context.compiler.clone()
|
||||
return self.ProgramBuilder(compiler, name)
|
||||
|
||||
def ExtCompiler(self, context):
|
||||
compiler = context.compiler.clone()
|
||||
compiler.cxxincludes += [
|
||||
os.path.join(context.currentSourcePath),
|
||||
os.path.join(context.currentSourcePath, 'sdk'),
|
||||
os.path.join(builder.sourcePath, 'public'),
|
||||
os.path.join(builder.sourcePath, 'public', 'extensions'),
|
||||
os.path.join(builder.sourcePath, 'public', 'sourcepawn'),
|
||||
os.path.join(builder.sourcePath, 'public', 'amtl'),
|
||||
]
|
||||
return compiler
|
||||
|
||||
def HL2Compiler(self, context, sdk):
|
||||
compiler = self.ExtCompiler(context)
|
||||
|
||||
if sdk.name == 'ep1':
|
||||
mms_path = os.path.join(self.mms_root, 'core-legacy')
|
||||
else:
|
||||
mms_path = os.path.join(self.mms_root, 'core')
|
||||
|
||||
compiler.cxxincludes += [
|
||||
os.path.join(mms_path),
|
||||
os.path.join(mms_path, 'sourcehook'),
|
||||
]
|
||||
|
||||
defines = ['SE_' + PossibleSDKs[i].define + '=' + PossibleSDKs[i].code for i in PossibleSDKs]
|
||||
compiler.defines += defines
|
||||
paths = [
|
||||
['public'],
|
||||
['public', 'engine'],
|
||||
['public', 'mathlib'],
|
||||
['public', 'vstdlib'],
|
||||
['public', 'tier0'],
|
||||
['public', 'tier1']
|
||||
]
|
||||
if sdk.name == 'ep1' 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 == '2013' and compiler.cxx.behavior == '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 sdk.name in ['swarm', 'blade', 'insurgency', 'csgo', 'dota']:
|
||||
if compiler.cc.behavior == 'msvc':
|
||||
compiler.defines += ['COMPILER_MSVC', 'COMPILER_MSVC32']
|
||||
else:
|
||||
compiler.defines += ['COMPILER_GCC']
|
||||
|
||||
# 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', 'csgo', 'dota']:
|
||||
compiler.defines += ['NETWORK_VARS_ENABLED']
|
||||
|
||||
if sdk.name in ['css', 'hl2dm', 'dods', '2013', 'tf2', 'l4d2']:
|
||||
if builder.target_platform in ['linux', 'mac']:
|
||||
compiler.defines += ['NO_MALLOC_OVERRIDE']
|
||||
|
||||
for path in paths:
|
||||
compiler.cxxincludes += [os.path.join(sdk.path, *path)]
|
||||
|
||||
return compiler
|
||||
|
||||
def ExtLibrary(self, context, name):
|
||||
compiler = self.ExtCompiler(context)
|
||||
return self.LibraryBuilder(compiler, name)
|
||||
|
||||
def HL2Library(self, context, name, sdk):
|
||||
compiler = self.HL2Compiler(context, sdk)
|
||||
|
||||
if builder.target_platform == 'linux':
|
||||
if sdk.name == 'ep1':
|
||||
lib_folder = os.path.join(sdk.path, 'linux_sdk')
|
||||
elif sdk.name == '2013':
|
||||
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux32')
|
||||
else:
|
||||
lib_folder = os.path.join(sdk.path, 'lib', 'linux')
|
||||
elif builder.target_platform == 'mac':
|
||||
if sdk.name == '2013':
|
||||
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'osx32')
|
||||
else:
|
||||
lib_folder = os.path.join(sdk.path, 'lib', 'mac')
|
||||
|
||||
if builder.target_platform in ['linux', 'mac']:
|
||||
if sdk.name == '2013':
|
||||
compiler.postlink += [
|
||||
compiler.Dep(os.path.join(lib_folder, 'tier1.a')),
|
||||
compiler.Dep(os.path.join(lib_folder, 'mathlib.a'))
|
||||
]
|
||||
else:
|
||||
compiler.postlink += [
|
||||
compiler.Dep(os.path.join(lib_folder, 'tier1_i486.a')),
|
||||
compiler.Dep(os.path.join(lib_folder, 'mathlib_i486.a'))
|
||||
]
|
||||
|
||||
if sdk.name in ['blade', 'insurgency', 'csgo', 'dota']:
|
||||
compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'interfaces_i486.a'))]
|
||||
|
||||
binary = self.LibraryBuilder(compiler, name)
|
||||
|
||||
dynamic_libs = []
|
||||
if builder.target_platform == 'linux':
|
||||
compiler.linkflags[0:0] = ['-lm']
|
||||
if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', '2013', 'l4d2']:
|
||||
dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so']
|
||||
elif sdk.name in ['l4d', 'nd', 'blade', 'insurgency', 'csgo']:
|
||||
dynamic_libs = ['libtier0.so', 'libvstdlib.so']
|
||||
else:
|
||||
dynamic_libs = ['tier0_i486.so', 'vstdlib_i486.so']
|
||||
elif builder.target_platform == 'mac':
|
||||
binary.compiler.linkflags.append('-liconv')
|
||||
dynamic_libs = ['libtier0.dylib', 'libvstdlib.dylib']
|
||||
elif builder.target_platform == 'windows':
|
||||
libs = ['tier0', 'tier1', 'vstdlib', 'mathlib']
|
||||
if sdk.name in ['swarm', 'blade', 'insurgency', 'csgo', 'dota']:
|
||||
libs.append('interfaces')
|
||||
for lib in libs:
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'public', lib) + '.lib'
|
||||
binary.compiler.linkflags.append(binary.Dep(lib_path))
|
||||
|
||||
for library in dynamic_libs:
|
||||
source_path = os.path.join(lib_folder, library)
|
||||
output_path = os.path.join(binary.localFolder, library)
|
||||
|
||||
def make_linker(source_path, output_path):
|
||||
def link(context, binary):
|
||||
cmd_node, (output,) = context.AddSymlink(source_path, output_path)
|
||||
return output
|
||||
return link
|
||||
|
||||
linker = make_linker(source_path, output_path)
|
||||
binary.compiler.linkflags[0:0] = [binary.Dep(library, linker)]
|
||||
|
||||
return binary
|
||||
|
||||
SM = SMConfig()
|
||||
SM.detectProductVersion()
|
||||
SM.detectSDKs()
|
||||
SM.configure()
|
||||
|
||||
SM.generated_headers = builder.RunScript(
|
||||
'tools/buildbot/Versioning',
|
||||
{ 'SM': SM }
|
||||
)
|
||||
SM.versionlib = builder.RunScript(
|
||||
'versionlib/AMBuilder',
|
||||
{ 'SM': SM }
|
||||
)
|
||||
|
||||
builder.RunBuildScripts(
|
||||
[
|
||||
'loader/AMBuilder',
|
||||
'core/AMBuilder',
|
||||
'core/logic/AMBuilder',
|
||||
'extensions/bintools/AMBuilder',
|
||||
'extensions/clientprefs/AMBuilder',
|
||||
'extensions/curl/AMBuilder',
|
||||
'extensions/cstrike/AMBuilder',
|
||||
'extensions/geoip/AMBuilder',
|
||||
'extensions/mysql/AMBuilder',
|
||||
'extensions/regex/AMBuilder',
|
||||
'extensions/sdkhooks/AMBuilder',
|
||||
'extensions/sdktools/AMBuilder',
|
||||
'extensions/sqlite/AMBuilder',
|
||||
'extensions/tf2/AMBuilder',
|
||||
'extensions/topmenus/AMBuilder',
|
||||
'extensions/updater/AMBuilder',
|
||||
'sourcepawn/compiler/AMBuilder',
|
||||
'sourcepawn/jit/AMBuilder',
|
||||
'plugins/AMBuilder',
|
||||
'tools/buildbot/PackageScript',
|
||||
],
|
||||
{
|
||||
'SM': SM
|
||||
}
|
||||
)
|
||||
|
||||
if builder.options.breakpad_dump:
|
||||
builder.RunScript('tools/buildbot/BreakpadSymbols', { 'SM': SM })
|
||||
|
||||
@@ -3,3 +3,4 @@ CONFIGURE YOUR IDENTITY FOR MERCURIAL!
|
||||
IF YOU ARE A DEVELOPER WITH PUSH ACCESS, DO IT NOW KPLZTHX.
|
||||
|
||||
http://wiki.alliedmods.net/Mercurial_Tutorial#Identity
|
||||
|
||||
|
||||
-508
@@ -1,513 +1,5 @@
|
||||
SourceMod Changelog
|
||||
|
||||
SourceMod 1.5.3 [2014-03-22]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.5.3_Release_Notes
|
||||
|
||||
User Changes:
|
||||
- Updated support for CS:GO after multiple breaking game updates.
|
||||
- Updated gamedata support for GoldenEye: Source (Peace-Maker).
|
||||
- Fixed crash on SDKHooks extension load in Alien Swarm (bug 6059).
|
||||
- Fixed memory leak from unmanaged forwards never being freed (bug 6025).
|
||||
- Fixed possible crash when unloading the CStrike extension.
|
||||
- Fixed crash in SDKHooks Reload post-hook (Peace-Maker).
|
||||
- Fixed FakeClientCommandEx always leaking memory (bug 5678).
|
||||
- Fixed extra entity networking occuring with SetEntProp natives on some games.
|
||||
- Fixed being able to nominate same map multiple times (bug 5109).
|
||||
- Fixed spurious FindEntityByClassname error being logged on some games and platforms.
|
||||
- Fixed an Anti-Flood bypass exploit (bug 5394).
|
||||
- Removed part of Addresses gamedata error handling which could cause false errors to be logged (bug 6044).
|
||||
- Fixed mapchooser not resetting nominations count when clearing nominations list (bug 5359).
|
||||
- Improved performances of client convar query handling (bug 6003).
|
||||
|
||||
Developer Changes:
|
||||
- Added GiveAmmo native to SDKTools (bug 6039) (Peace-Maker).
|
||||
- Added SQL_SetCharset native to (re)set charset even after reconnect (bug 5786) (Peace-Maker).
|
||||
- Added support for entity references in SDKHooks natives (bug 6069).
|
||||
- Added support for server passwords to DisplayAskConnectBox stock (bug 5984) (FlaminSarge).
|
||||
- Renamed SortFunc2D parameters to match documentation (bug 6014) (Peace-Maker).
|
||||
- Fixed param order in AddToTopMenu function doc (bug 6035) (Peace-Maker).
|
||||
- Added |any| tag to WritePackCell and ReadPackCell native param/return values (bug 6001).
|
||||
- Updated SDKHook_TakeDamage native for game updates.
|
||||
- Added default infinite value for TF2_AddCondition duration.
|
||||
- Added support for conditions >= 64 in TF2_OnConditionAdded/Removed (bug 5565, bug 5976) (FlaminSarge).
|
||||
- Updated TFCond and TF customkill enum values (bug 6012) (FlaminSarge).
|
||||
- Fixed regression causing incorrect return and inability to block in TF2_OnCalcIsAttackCritical forward.
|
||||
- Fixed TE_* natives operating on incorrect data for some tempents (bug 6072).
|
||||
- Fixed CS_AliasToWeaponID not returning a valid weaponID for cz75a.
|
||||
- Fixed CS_GetWeaponPrice returning incorrect value for M4A1 in CS:GO (bug 6045).
|
||||
- Increased max gamedata byte signature length.
|
||||
- Ported SM build scripts to AMBuild2 (bug 5997).
|
||||
|
||||
----------------------------------------------------------
|
||||
SourceMod 1.5.2 [2013-10-29]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.5.2_Release_Notes
|
||||
|
||||
User Changes:
|
||||
- Updated gamedata support for TF2, CS:S, CS:GO, and HL2:DM.
|
||||
- Fixed crash from regression in SDKTools SetClientListening hook refcounting (bug 5956) (KyleS).
|
||||
- Fixed potential crash when having maps with format characters in name.
|
||||
- Fixed some nextmap issues with long map names.
|
||||
- SDKTools no longer requires gamedata for sm_dump_datamaps on TF2, CS:S, HL2:DM, and DoD:S (bug 5968).
|
||||
|
||||
Developer Changes:
|
||||
- Updated TFCond and TF custom dmg enums.
|
||||
- Updated TF2 critical hit detection logic in TF2_OnCalcIsAttackCritical to handle more cases, including when criticals are disabled (bug 5894).
|
||||
- Fixed GetEngineVersion native returning a bad value when running on MM:S 1.9.x or earlier (bug 5697).
|
||||
|
||||
----------------------------------------------------------
|
||||
SourceMod 1.5.1 [2013-09-10]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.5.1_Release_Notes
|
||||
|
||||
User Changes:
|
||||
- Updated gamedata support for TF2.
|
||||
- Added missing DispatchKeyValue gamedata for HL2 CTF (bug 5114) (peace-maker).
|
||||
- Fixed translations not being loaded if identifier was not two or three characters (fixes Portuguese) (bug 5888).
|
||||
- Fixed runoff voting occurring when receiving the exact number of required votes (bug 5890).
|
||||
- Fixed reserve slot plugin hiding too many slots on Orangebox gamesif SourceTV and/or Replay are present (bug 5499).
|
||||
- Fixed some crashes in TF2 and unexpected behavior in all games with SDKHook_TakeDamage due to uninitialized var.
|
||||
- Fixed attempted triggers from gagged users displaying in chat (bug 5918).
|
||||
- Fixed errors in Italian translation (Oktober).
|
||||
- Added Norwegian translation (checkster).
|
||||
|
||||
Developer Changes:
|
||||
- Added CS_UpdateClientModel native to CStrike extension for CS:S and CS:GO (bug 5905) (Drifter).
|
||||
- Fixed setting weapon param in SDKHook_TakeDamage overwriting attacker instead of setting weapon (bug 5911) (KyleS)
|
||||
|
||||
----------------------------------------------------------
|
||||
SourceMod 1.5.0 [2013-08-25]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.5.0_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Added support for Counter-Strike: Global Offensive (bug 5299, bug 5579).
|
||||
- Split CS:S, TF2, DoD:S, HL2:DM, and ND to separate binaries (bug 5370, bug 5813).
|
||||
- Added support for runoff voting in mapchooser (bug 4218).
|
||||
- Added option to require Steam validation before granting admin access (bug 4837) (VoiDeD).
|
||||
- Added localization support for many more core and base plugin messages (bug 5120, bug 5146).
|
||||
- Added the ability to override RegConsoleCommand-created commands (bug 5199).
|
||||
- Added support for "fuzzy" (partial) map names in map-related natives and cmds for L4D and later (bug 5599).
|
||||
- Updated Reserved Slots to use max humans as max count (bug 5444).
|
||||
- Added support for custom maxitems on radio menus (bug 5371).
|
||||
- Improved console config editing (bug 5470).
|
||||
- Increased map name buffer sizes in mapchooser to better account for nested maps (bug 5609) (Peace-Maker).
|
||||
- Fixed JIT conflicts with SELinux (bug 5581).
|
||||
- Added logged error when PlayerRunCommand offset lookup fails (bug 5535) (GoD-Tony).
|
||||
- Fixed double print when sending psay to self (bug 5649) (Peace-Maker).
|
||||
- Fixed check against uninitialized string in extension loader (bug 5546) (KyleS).
|
||||
- Fixed possible runtime errors in basetriggers for not-ingame clients (bug 5191) (Peace-Maker).
|
||||
- Check all possible mapcycle paths on newer orangebox games (bug 5719).
|
||||
- Fixed ReadMapList not seeing maps in all valve search paths (bug 5715) (VoiDeD).
|
||||
- Fixed typo in too-many-params native error message (Peace-Maker).
|
||||
- Fixed various issues in clientprefs (bug 5538) (KyleS).
|
||||
- Removed debug printout from PerformGravity (bug 5679) (KyleS).
|
||||
- Fixed broken translating in some plugins and natives (bug 5612) (KyleS).
|
||||
- Fixed issues with COMMAND_FILTER_NO_BOTS and @bots multi-target.
|
||||
- Fixed crash in SDKHooks when throwing bad ent type error on logical ent (KyleS).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Added support for CS:GO to the CStrike extension (bug 5299) (Drifter).
|
||||
- Added support for new protobuf usermessages used in newer games (bug 5579, bug 5588, bug 5590, bug 5633).
|
||||
- Added latest SDKHooks version as first-party extension.
|
||||
- Updated SQLite to version 3.7.15.1 (bug 5235).
|
||||
- Added natives for changing team score and mvp stars on CSS/CSGO (bug 5295) (Drifter).
|
||||
- Added global pre and post forwards for client chat (bug 5394) (KyleS).
|
||||
- Added TF2_CanPlayerTeleport forward to the TF2 game extension (bug 5283) (VoiDeD).
|
||||
- Added GetEntityAddress native (bug 5269) (ProdigySim).
|
||||
- Added more parameters to PlayerRunCommand forward (bug 5346) (GoD-Tony).
|
||||
- Added forwards to basecomm plugin (bug 5466) (Drifter).
|
||||
- Added symbol lookup support to gamedata on Windows (bug 5511) (GoD-Tony).
|
||||
- Exposed GetLanguageInfo in ITranslator interface (bug 5249) (VoiDeD).
|
||||
- Increase maximum .sp line length to 4095 characters. (bug 5347) (theY4Kman).
|
||||
- Improved netprop dump output (bug 5471).
|
||||
- Added int64 typename to netprop dumps (bug 5655).
|
||||
- Added GetMaxHumanPlayers native exposing IServerGameClients func (bug 5551).
|
||||
- Added WeaponIDToAlias native to CStrike extension (bug 5460) (KyleS).
|
||||
- Fixed OnLibraryAdded/Removed not being called in all plugins (bug 5431).
|
||||
- Made thread worker processing limits configurable at runtime (bug 5326).
|
||||
- Added support in TF2 ext for detection of player conds >= 64 (bug 5565).
|
||||
- Updated button defines in entity_prop_stocks (bug 5564).
|
||||
- Added GetPlayerResourceEntity to SDKTools to replace old, semi-broken TF2-only version (bug 5491).
|
||||
- Exposed third parameter of TF2's AddCond in TF2_AddCondition (bug 5641) (FlaminSarge).
|
||||
- Added GetSteamAccountID function to IPlayerHelpers and native for sp (bug 5548) (KyleS).
|
||||
- Added ISDKHooks interface with entity listeners (bug 5602) (GoD-Tony).
|
||||
- Added file upload support to webternet extension.
|
||||
- Added more alternative names for TFClass_Heavy (bug 5338) (Afronanny).
|
||||
- Throw error instead of crash when calling SetTeamScore between maps (bug 5718) (KyleS).
|
||||
- Fixed clients not being marked as in kick queue in some cases (bug 5746) (SystematicMania).
|
||||
- Made compile.sh set working dir to own dir (bug 5710) (KyleS).
|
||||
- Added CS_IsValidWeaponID native and validity checks to other natives (bug 5566) (Drifter).
|
||||
- Numerous code documentation fixups (bug 5720) (Tsunami).
|
||||
- Fixed cmd listener callback return behavior to match func doc (bug 5882).
|
||||
|
||||
Internal Changes:
|
||||
|
||||
- Fixed handle misuse in clientprefs plugin (bug 5805) (KyleS).
|
||||
- Removed call to getchar() in debug build of compiler (bug 5626) (KyleS).
|
||||
- Fixed instability issues with cloned handles (bug 5245, bug 5240) (KyleS).
|
||||
- Changed extension unload order to avoid exposing finalization window (bug 5556) (KyleS).
|
||||
- Call OnPluginEnd before finalizer hooks have run (bug 4519).
|
||||
- Fixed potential for reading out of library bounds in MemoryUtils::FindPattern.
|
||||
- Fixed typo in TF2 ext asm.c causing accidental assignment instead of compare.
|
||||
- Overhauled versioning information (bug 5453).
|
||||
- Changed from RemoveEdict to using the Kill input for TF2_RemoveWeapon.
|
||||
- Fixed accidental assignment in each of SDKTools and sp compiler (bug 5745) (KyleS).
|
||||
- Fixed potential deadlock in HandleSystem::TryAndFreeSomeHandles (bug 5665) (KyleS).
|
||||
|
||||
----------------------------------------------------------
|
||||
SourceMod 1.4.7 [2013-02-06]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.4.7_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Updated support for latest Source 2009 engine changes (CS:S, DoD:S, TF2, HL2DM).
|
||||
- Updated gamedata for Left 4 Dead 2, Nuclear Dawn, No More Room in Hell, Zombie Panic Source, CSPromod, GoldenEye Source, Synergy, The Hidden, and PVKII.
|
||||
- Added system to block malware or illegal plugins (bug 5289).
|
||||
- Fixed a potential crash when a bad entity index is passed to certain functions (bug 5539) (KyleS).
|
||||
- Added an error message for when auto plugin configs fail to be created due to write error (bug 5465) (Drifter).
|
||||
- Fixed an issue where a malformed plugin could cause crashes (bug 5478).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Added new values to the TFCond TF2 conditions enum (bug 5537) (FlaminSarge).
|
||||
- Updated TFHoliday TF2 holidays enum (bug 5526) (Powerlord).
|
||||
- Fixed regression in SourceMod 1.3.0 causing GetEntPropEnt, GetEntDataEnt2, and GameRules_GetPropEnt to possibly return stale (incorrect) entity indexes in place of -1.
|
||||
- Added support for < 32-bit unsigned sign extension to GameRules_GetProp lookup (already in GetEntProp since SM 1.4.0).
|
||||
- Fixed < 32-bit unsigned sign extension in GetEntProp not being applied for array prop elements (bug 5591).
|
||||
- Fixed value size auto-detection in GetEntProp and GameRules_GetProp for ep2v's new SPROP_VARINT sendprops.
|
||||
- Fixed Sort_Random sort type not including first value in array sorting functions (bug 4292) (Peace-Maker).
|
||||
- Fixed GameRules_SetPropVector writing data to unexpected addresses instead of to the gamerules proxy entity (bug 5592) (ProdigySim).
|
||||
- Fixed VoteMenuToAll stock adding bots to list (bug 5253 (VoiDeD).
|
||||
|
||||
----------------------------------------------------------
|
||||
SourceMod 1.4.6 [2012-09-04]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.4.6_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Fixed extraneous errors resulting from a bug in 1.4.5.
|
||||
|
||||
----------------------------------------------------------
|
||||
|
||||
SourceMod 1.4.5 [2012-09-03]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.4.5_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Updated support for latest Source 2009 engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
|
||||
- Updated Nuclear Dawn, Dino D-Day, and Zombie Panic gamedata.
|
||||
- Added compatibility for running on Metamod:Source 1.9.0.
|
||||
- Fixed very minor memory leaks in CStrike extension (bug 5456) (KyleS).
|
||||
- Fixed crash from plugins accessing netprops too early (bug 5297) (KyleS).
|
||||
- Fixed crash from plugins trying to access nested datadesc members (bug 5446).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Added new TF2 weapon and custom dmg defines.
|
||||
- Added new TF2 TFHoliday value (bug 5436) (Powerlord).
|
||||
- Fixed IClientListener::InterceptClientConnect not being able to properly block connections (bug 5461) (PimpinJuice).
|
||||
- Fixed PrepSDKCall_SetSignature native not working with symbol names on L4D2 linux (bug 5440).
|
||||
- Fixed resolution of GetProfilerTime native on non-Windows platforms.
|
||||
|
||||
-----------------------------
|
||||
|
||||
SourceMod 1.4.4 [2012-07-03]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.4.4_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Updated support for latest Source 2009 engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
|
||||
- Updated Nuclear Dawn gamedata.
|
||||
- Fixed a crash that could occur when selecting an option on a clientprefs prefab menu (bug 5374).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Added new TF2 weapon and custom dmg defines.
|
||||
- Added new TF2 TFHoliday value (bug 5364) (Powerlord).
|
||||
- Updated sample extension to properly fill ninvoke with INativeInvoker ptr (bug 5340) (Afronanny).
|
||||
|
||||
-----------------------------
|
||||
|
||||
SourceMod 1.4.3 [2012-06-09]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.4.3_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Updated support for latest OrangeBox engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
|
||||
- Made clientprefs attempt to reconnect to the database on map change (bug 4745).
|
||||
- Log functions now respect sv_logecho (bug 5135).
|
||||
- Fixed client console vote output (bug 5290, bug 5205) (FlaminSarge).
|
||||
- Fixed error when reloading dependant plugins using aliased natives (bug 5302).
|
||||
- Fixed intermittent crash when looking for an invalid signature (bug 5301).
|
||||
- Fixed possible crash when reloading a plugin with an invalid binary (bug 5288).
|
||||
- Exposed extensions list to clients (bug 5221) (VoiDeD).
|
||||
- Fixed intermittent crashes in clientprefs (bug 4660).
|
||||
- Fixed crash when passing an invalid entity reference to ReferenceToEntity (bug 5330).
|
||||
- Fixed cstrike extension crash on shutdown (bug 5328).
|
||||
- Lowered threading API think time to 20ms, making threaded MySQL queries complete faster (bug 4733).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Fixed client serials not being unique on Windows (bug 5285).
|
||||
- Fixed broken SourceTV detection on L4D1 (bug 5216).
|
||||
- Fixed Float negation operator (bug 5292).
|
||||
- Updated TF2 condition defines (bug 5259) (FlaminSarge).
|
||||
- Adding missing SetMenuNoVoteButton native declaration (bug 4522) (GoD-Tony).
|
||||
- Fixed erroneous const-qualification of name param of GetAdminUsername (bug 5267).
|
||||
- Added GetGameTickCount native (bug 5209) (GoD-Tony).
|
||||
|
||||
-----------------------------
|
||||
|
||||
SourceMod 1.4.2 [2011-04-13]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.4.2_Release_Notes
|
||||
|
||||
User Changes:
|
||||
- Updated support for latest OrangeBox engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
|
||||
- Fixed regression in SourceMod 1.4.0 causing SM to cause load errors on The Ship (bug 5216).
|
||||
- Fixed toggling and player lag issues with sm_drug command (bugs 5217, 5218) (FlaminSarge).
|
||||
|
||||
Developer Changes:
|
||||
- Updated TF2-specific defines and enums (bug 5194).
|
||||
- Fixed StoreToAddress always writing 32 bits and throwing an error (bug 5248) (ProdigySim).
|
||||
- Fixed crash with StoreToAddress if memory wasn't writable (bug 5252) (Dr!fter).
|
||||
- Fixed return value of VoteMenuToAll (bug 5254) (VoiDeD).
|
||||
- Fixed bug in command lower-casing API guarantee
|
||||
|
||||
-----------------------------
|
||||
|
||||
SourceMod 1.4.1 [2011-12-07]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.4.1_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Updated support for latest OrangeBox engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
|
||||
- Added gamedata for Adrenaline Gamer 2 and No More Room in Hell.
|
||||
- Fixed "not connected" error in reserve slots plugin (bug 5158) (ostrel).
|
||||
- Fixed ff trigger output printing to all in triggerer's language (rather than viewer's language) (bug 5161).
|
||||
- Fixed typo in one of basebans ban reasons (bug 5188).
|
||||
- Fixed formatting error in Swedish "Vote Count" phrase (bug 5174).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Fixed sp MaxClients not being updated on map changes after load (bug 5160).
|
||||
- Removed GLIBC_2.7 dependency from spcomp.
|
||||
- Increased buffer for sm_rcon command to fit larger responses (bug 5169).
|
||||
- BaseComm now properly registers a library allowing it to be required by other plugins (bug 5156).
|
||||
- Fixed TFHoliday enum values (bug 5155).
|
||||
- Updated TF2_OnIsHolidayActive ret behavior to match doc (bug 5155).
|
||||
- Added new TF2 deathflag and dmg custom defines (bug 5157).
|
||||
|
||||
-----------------------------
|
||||
|
||||
SourceMod 1.4.0 [2011-10-28]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.4.0_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Added support for Max OS X (bug 4392).
|
||||
- Added support for Bloody Good Time (bug 4780).
|
||||
- Added support for E.Y.E Divine Cybermancy (bug 5035).
|
||||
- Added gamedata for Nuclear Dawn.
|
||||
- Added gamedata for International Online Soccer: Source (bug 5019).
|
||||
- Added gamedata for Half-Life 2 Capture the Flag (bug 5114).
|
||||
- Updated mapchooser and other base plugins with Nuclear Dawn specific fixes (bug 5117).
|
||||
- Fixed ServerLang value not being read properly on startup (bug 4675).
|
||||
- Added support for aliases in languages.cfg (bug 4858).
|
||||
- Added output display to sm_rcon command (bug 5018).
|
||||
- Flood protection bypass access can now be overridden with command name sm_flood_access (bug 4584).
|
||||
- Added a reset argument to sm cvars command to revset cvar values to default (bug 5043).
|
||||
- Fixed incorrect language identifiers for Chinese (both Trad. and Simplified) and Brazilian Portuguese not matching cl_language values (bug 5067).
|
||||
- Added translation support for Bulgarian (bg).
|
||||
- Fixed incorrect number of slots being hidden for reserve with sm_hideslots on Source 2009 with SourceTV or replay (bug 5094).
|
||||
- sm_hideslots changes now take effect immediately instead of waiting until a client joins or leaves (bug 5094).
|
||||
- Fixed sv_visiblemaxplayers getting stuck at previous max clients in some cases with reserves and SourceTV or replay (bug 5094).
|
||||
- Removed error logging if an optional extension is not found (bug 5112).
|
||||
- Fixed bots with semicolon in name being unkickable (bug 5120).
|
||||
- Changed strings in ice-related funcommands to be translatable (bug 4540).
|
||||
- Changed Bintools extension to use a single build for every engine (bug 4548).
|
||||
|
||||
Developer Changes:
|
||||
- Provided native interface for basecomm (bug 2594).
|
||||
- Client language detection is too late. (bug 3714) (Tony A. "GoD-Tony").
|
||||
- Added ServerCommandEx native to execute server command and retrieve output (bug 3873).
|
||||
- Added ability to update clientprefs cookies values on clients not currently connected (bug 3882) (databomb).
|
||||
- Added library "matchmaking_ds" support to gamedata lookups (bug 4158).
|
||||
- Rooted menu handles to callbacks (bug 4353).
|
||||
- Fixed corner cases with ExplodeString (bug 4629). (Michael "LumiStance").
|
||||
- Fixed return omission with else-after-return (bug 4852).
|
||||
- Added OnConditionAdded and OnConditionRemoved forwards to TF2 extension (bug 4851).
|
||||
- Added new natives and forward to the cstrike extension (bug 4732, bug 4985) (Dr!fter).
|
||||
- Added WaitingForPlayers forwards to the TF2 extension (bug 4704) (CrimsonGT).
|
||||
- Updated and added more TF2 condition, weapon, and damagecustom defines (multiple bug#s).
|
||||
- Fixed TF2_RemoveCondition not always removing conditions (bug 4981).
|
||||
- Fixed MaxClients not being updated correctly in some places with SourceTV or replay active (bug 4986).
|
||||
- Fixed some vars not being marked for init on first compile pass (bug 4643).
|
||||
- Increased symbol name limit to 63 characters (bug 4564) (javalia).
|
||||
- Fixed crash when dynamic arrays run out of memory (bug 4632).
|
||||
- Fixed a crash that could happen from looking up out-of-bounds edict or entity indexes (bug 5080).
|
||||
- Fixed client serials not getting cleared on disconnect (bug 5121).
|
||||
- Added error on declaring arrays that the compiler is too buggy to handle (bug 4977).
|
||||
- Removed reliance on gamedata for multiple SDKTools functions in ep2 and later (bug 4899).
|
||||
- Added InvalidateClient and ReconnectClient natives to SDKTools (bug 4931) (Brian "Afronanny" Simon).
|
||||
- Added ability to lookup and set values on the gamerules class (bug 4983.
|
||||
- BaseComm now uses AddCommandListener for chat hooks (bug 4991).
|
||||
- Fixed shutdown bug in SDKTools (bug 5063).
|
||||
- Fixed MM-enabled extensions continuing to load after failing MM attach (bug 5042).
|
||||
- Added GetDistGainFromSoundLevel native to SDKTools (bug 5066) (javalia).
|
||||
- Added CheckAccess native to check an AdminId's command access (bug 5083).
|
||||
- Fixed GetEntProp not sign-extending unsigned values less than 32 bits (bug 5105).
|
||||
- Fixed crashing when calling CreateEntityByName or CreateFakeClient when no map is running (now errors) (bug 5119).
|
||||
- Fixed erring in kick function (e. bad translation) causing client to become unkickable until disconnect (bug 5120).
|
||||
- Fixed KickClientEx not immediately kicking client if client was in kick queue (bug 5120).
|
||||
- Added IsClientSourceTV and IsClientReplay natives (bug 5124).
|
||||
- Added support for getting and setting individual array elements with Get/Set EntProp functions (bug 4160).
|
||||
- Added support for threaded query handles to SQL_GetInsertId and SQL_GetAffectedRows (bug 4699) (Nephyrin).
|
||||
- Added a GetGameRules function to ISDKTools for extensions to easily get the GameRules class pointer (bug 4707).
|
||||
- Added GetMessageName to IUserMessages (bug 4573) (Zach "theY4Kman" Kanzler)
|
||||
- Added HintTextMsg to IGameHelpers (bug 4950).
|
||||
- Added ProcessTargetString simple filter API (bug 4404).
|
||||
- Moved much functionality from core bins to logic bin (bug 4406, bug 4402).
|
||||
- Fixed bogus asserts in sp compiler (bug 4486, bug 4487).
|
||||
- Greatly improved sp compiler performance (~5x overall speedup) (bug 3820, bug 4493, bug 4495).
|
||||
- Changed entity output detours to use CDetour (bug 4416).
|
||||
- Enhanced nominations API (bug 4677) (CrimsonGT).
|
||||
- Added Linux support for profiling natives (bug 4927).
|
||||
- Added a new ValveCallType that allows for arbitrary |this| parameters, as well as associated features in gamedata and for reading/writing memory (bug 3520) (Downtown1).
|
||||
- Updated TF2 extension to handle Valve's changes to the "holiday" system (bug 5150).
|
||||
|
||||
-----------------------------
|
||||
|
||||
SourceMod 1.3.8 [2011-06-23]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.8_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Updated support for latest OrangeBox engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
|
||||
- Updated support for various games, including Garry's Mod, Zombie Panic, and Dino D-Day.
|
||||
- Added gamedata for Eternal Silence.
|
||||
- Fixed libgcc_s.so.1 load error present on some systems (bug 4876).
|
||||
- Handle leak notices now print to error log (in addition fatal log) (bug 4929).
|
||||
- Translator now properly falls back on bad server language (bug 4861).
|
||||
- Fixed invalid client errors from bad MaxClients value when SourceTV is late-loaded (bug 4881).
|
||||
- Fixed crash on plugin unload when two commands exist with same name, different casing (bug 4698).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Updated TF2 condition defines (bug 4916).
|
||||
- Fixed var names and docs for TF2_MakeBleed native (bug 4928).
|
||||
- Removed compiler double include check (bug 4863).
|
||||
- Fixed plugin compile errors when using GetEntityClassname (bug 4798).
|
||||
|
||||
---------------------------
|
||||
|
||||
SourceMod 1.3.7 [2011-04-15]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.7_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Updated support for latest OrangeBox engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
|
||||
- Updated support for various games, including Zombie Panic, CS ProMod, Empires, and GoldenEye: Source.
|
||||
- Added gamedata for Dino D-Day.
|
||||
- Fix precedence of voice mute flag versus specific client overrides (bug 4826).
|
||||
- Fix mistaken unhooking of voice hooks (bug 4804).
|
||||
- Fixed graphical glitches with funcommands effects in L4D1 (bug 3486).
|
||||
- Fixed bug in nominations that could cause "Unknown command" error (bug 4797).
|
||||
- Removed tv_enable hook to fix rare max client count issue (bug 4791).
|
||||
- Added missing unhooking of ClientConnect in PlayerManager (bug 4749).
|
||||
- Fixed sm_rtv printing "unknown command" (bug 4730).
|
||||
- Fixed voting crash when client console, chat, and SourceTV are enabled (bug 4676).
|
||||
- Fixed CDetour crash in TF2 extension when last plugin using forward is unloaded (bug 4713).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- SetEntProp now marks edict state as changed (bug 4855).
|
||||
- Added GetEntityClassname stock (bug 4798).
|
||||
- Fix compiler hanging when #including a directory (bug 4822).
|
||||
- Added GetEntityFlags and SetEntityFlags natives for better cross-engine compatibility. (bug 4809).
|
||||
- Fixed ClientPrefs natives not being marked optional when REQUIRE_EXTENSIONS not defined (bug 4839).
|
||||
- Changed some instances of LogMessage to LogAction (bug 4649).
|
||||
- Added some new language natives (bug 4613).
|
||||
- Fixed SetTeamScore not updating score on client (bug 2736).
|
||||
- Raised MAXPLAYERS from 64 to 65 (bug 4490).
|
||||
- Added and updated many TF2-specific defines in tf2.inc and tf2_stocks.inc.
|
||||
- Fixed TF2_GetPlayerConditionFlags no longer necessarily returning all set flags (bug 4726).
|
||||
- Fixed profiler flush not clearing, added 'report' and 'clear' (bug 4674).
|
||||
- Fixed GetPlayerDecalFile crash on L4D and L4D2 (bug 4729).
|
||||
- Fixed TF2_OnGetHoliday detour no longer firing under all circumstances (bug 4700).
|
||||
- Added TF2_IsPlayerInDuel native to TF2 extension (bug 4695).
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.3.6 [2010-10-31]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.6_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Updated support for latest Left 4 Dead 1 (bug 4681).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Updated TF2 custom kill defines (bug 4682).
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.3.5 [2010-10-17]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.5_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Updated support for CS:S, Garry's Mod, DoD:S, TF2, HL2DM.
|
||||
- Added support for Firearms: Source (bug 4537).
|
||||
- Added support for Fistful of Frags (bug 3883).
|
||||
- Added support for Alien Swarm (bug 4530).
|
||||
- Fixed living players hearing dead players if alltalk is disabled while deadtalk is on (bug 4533, thanks Zach Callear).
|
||||
- Fixed timeleft not getting reset on Game_Commencing in CS:S (bug 4557).
|
||||
- Fixed PlayerRunCmd being hooked when not used (bug 3990).
|
||||
- Fixed errors and missing effects caused by missing sprites on L4D2 (bug 4512).
|
||||
- Fixed 'sm plugins' public command skipping plugins in recommended listing (bug 4501).
|
||||
- Fixed corruption with large database.cfg files (bug 4286).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Added TF2 object stocks (bug 4536).
|
||||
- Added TF2_MakeBleed native to TF2 ext (bug 4542).
|
||||
- Added support for logical entities in Synergy (bug 4534).
|
||||
- Updated TF2 conditions enum and defines (bug 4526).
|
||||
- Fixed potential crash with IMemUtils::FindPattern on Linux (bug 4554).
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.3.4 [2010-07-18]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.4_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Support for latest TF update (bug 4506).
|
||||
- Support for latest L4D2 update (bug 4509).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Added FindFlagChar native (bug 3776).
|
||||
- Added GetConVarDefault native (bug 4502).
|
||||
- Added forward for TF's GetHoliday function (bug 4462).
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.3.3 [2010-06-23]
|
||||
|
||||
@@ -107,22 +107,4 @@
|
||||
* Currently this will log details about the gamedata updating process.
|
||||
*/
|
||||
"DebugSpew" "no"
|
||||
|
||||
/**
|
||||
* If set to yes, SourceMod will validate steamid auth strings with the Steam backend before giving out admin access.
|
||||
* This can prevent malicious users from impersonating admins with stolen Steam apptickets.
|
||||
* If Steam is down, admins will not be authenticated until Steam comes back up.
|
||||
* This option increases the security of your server, but is still experimental.
|
||||
*/
|
||||
"SteamAuthstringValidation" "no"
|
||||
|
||||
/**
|
||||
* Enables or disables whether SourceMod blocks known or potentially malicious plugins from loading.
|
||||
* It is STRONGLY advised that this is left enabled, there have been cases in the past with plugins that
|
||||
* allow anyone to delete files on the server, gain full rcon control, etc.
|
||||
*
|
||||
* "yes" - Block malware or illegal plugins from loading (default)
|
||||
* "no" - Warn about malware or illegal plugins loading
|
||||
*/
|
||||
"BlockBadPlugins" "yes"
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
{
|
||||
"driver_default" "mysql"
|
||||
|
||||
// When specifying "host", you may use an IP address, a hostname, or a socket file path
|
||||
|
||||
"default"
|
||||
{
|
||||
"driver" "default"
|
||||
|
||||
+3
-21
@@ -1,28 +1,10 @@
|
||||
# vim: set ts=2 sw=2 tw=99 noet:
|
||||
import sys
|
||||
try:
|
||||
from ambuild2 import run
|
||||
except:
|
||||
try:
|
||||
import ambuild
|
||||
sys.stderr.write('It looks like you have AMBuild 1 installed, but this project uses AMBuild 2.\n')
|
||||
sys.stderr.write('Upgrade to the latest version of AMBuild to continue.\n')
|
||||
except:
|
||||
sys.stderr.write('AMBuild must be installed to build this project.\n')
|
||||
sys.stderr.write('http://www.alliedmods.net/ambuild\n')
|
||||
sys.exit(1)
|
||||
import ambuild.runner as runner
|
||||
|
||||
run = run.PrepareBuild(sourcePath=sys.path[0])
|
||||
run.default_build_folder = 'obj-' + run.target_platform
|
||||
run = runner.Runner()
|
||||
run.options.add_option('--enable-debug', action='store_const', const='1', dest='debug',
|
||||
help='Enable debugging symbols')
|
||||
run.options.add_option('--enable-optimize', action='store_const', const='1', dest='opt',
|
||||
help='Enable optimization')
|
||||
run.options.add_option('--no-mysql', action='store_false', default=True, dest='hasMySql',
|
||||
help='Disable building MySQL extension')
|
||||
run.options.add_option('-s', '--sdks', default='all', dest='sdks',
|
||||
help='Build against specified SDKs; valid args are "all", "present", or '
|
||||
'comma-delimited list of engine names (default: %default)')
|
||||
run.options.add_option('--breakpad-dump', action='store_true', dest='breakpad_dump',
|
||||
default=False, help='Dump and upload breakpad symbols')
|
||||
run.Configure()
|
||||
run.Configure(sys.path[0])
|
||||
|
||||
+85
-119
@@ -1,124 +1,90 @@
|
||||
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
|
||||
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||
import os
|
||||
|
||||
for sdk_name in SM.sdks:
|
||||
sdk = SM.sdks[sdk_name]
|
||||
binary_name = 'sourcemod.' + sdk.ext
|
||||
for i in SM.sdkInfo:
|
||||
sdk = SM.sdkInfo[i]
|
||||
name = 'sourcemod.' + sdk['ext']
|
||||
|
||||
binary = SM.HL2Library(builder, binary_name, sdk)
|
||||
compiler = binary.compiler
|
||||
compiler = SM.DefaultHL2Compiler('core', i)
|
||||
|
||||
if sdk.name == 'csgo':
|
||||
# Protobuf 2.3 headers have some signed/unsigned compares. I believe that it's fixed in later versions, but Valve.
|
||||
if compiler.cxx.behavior == 'gcc':
|
||||
compiler.cflags += ['-Wno-sign-compare']
|
||||
compiler.cxxincludes += [
|
||||
os.path.join(sdk.path, 'common', 'protobuf-2.3.0', 'src'),
|
||||
os.path.join(sdk.path, 'public', 'engine', 'protobuf'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf')
|
||||
]
|
||||
elif sdk.name == 'dota':
|
||||
compiler.cxxincludes += [
|
||||
os.path.join(sdk.path, 'common', 'protobuf-2.4.1', 'src'),
|
||||
os.path.join(sdk.path, 'public', 'engine', 'protobuf'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'protobuf'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf')
|
||||
]
|
||||
|
||||
if builder.target_platform == 'linux':
|
||||
compiler.postlink += ['-lpthread', '-lrt']
|
||||
|
||||
if sdk.name == 'csgo' or sdk.name == 'dota':
|
||||
if builder.target_platform == 'linux':
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'linux32', 'release', 'libprotobuf.a')
|
||||
elif builder.target_platform == 'mac':
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'osx32', 'release', 'libprotobuf.a')
|
||||
elif builder.target_platform == 'windows':
|
||||
if 'DEBUG' in compiler.defines:
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'win32', 'debug', 'vs2010', 'libprotobuf.lib')
|
||||
else:
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'win32', 'release', 'vs2010', 'libprotobuf.lib')
|
||||
compiler.linkflags.insert(0, binary.Dep(lib_path))
|
||||
|
||||
binary.sources += [
|
||||
'AdminCache.cpp',
|
||||
'MenuStyle_Valve.cpp',
|
||||
'logic_bridge.cpp',
|
||||
'smn_entities.cpp',
|
||||
'sm_stringutil.cpp',
|
||||
'MenuVoting.cpp',
|
||||
'smn_events.cpp',
|
||||
'smn_menus.cpp',
|
||||
'sm_trie.cpp',
|
||||
'CDataPack.cpp',
|
||||
'frame_hooks.cpp',
|
||||
'smn_nextmap.cpp',
|
||||
'sourcemm_api.cpp',
|
||||
'ChatTriggers.cpp',
|
||||
'smn_player.cpp',
|
||||
'sourcemod.cpp',
|
||||
'concmd_cleaner.cpp',
|
||||
'HalfLife2.cpp',
|
||||
'NextMap.cpp',
|
||||
'ConCmdManager.cpp',
|
||||
'ConVarManager.cpp',
|
||||
'LibrarySys.cpp',
|
||||
'PlayerManager.cpp',
|
||||
'TimerSys.cpp',
|
||||
'CoreConfig.cpp',
|
||||
'Logger.cpp',
|
||||
'smn_halflife.cpp',
|
||||
'smn_console.cpp',
|
||||
'UserMessages.cpp',
|
||||
'MenuManager.cpp',
|
||||
'smn_core.cpp',
|
||||
'smn_hudtext.cpp',
|
||||
'smn_usermsgs.cpp',
|
||||
'MenuStyle_Base.cpp',
|
||||
'smn_keyvalues.cpp',
|
||||
'smn_vector.cpp',
|
||||
'EventManager.cpp',
|
||||
'MenuStyle_Radio.cpp',
|
||||
'sm_autonatives.cpp',
|
||||
'sm_srvcmds.cpp',
|
||||
'ConsoleDetours.cpp',
|
||||
'NativeInvoker.cpp',
|
||||
'smn_database.cpp',
|
||||
'ForwardSys.cpp',
|
||||
'Database.cpp',
|
||||
'DebugReporter.cpp',
|
||||
'ShareSys.cpp',
|
||||
'PluginSys.cpp',
|
||||
'HandleSys.cpp',
|
||||
'NativeOwner.cpp',
|
||||
'ExtensionSys.cpp',
|
||||
'smn_fakenatives.cpp',
|
||||
'smn_filesystem.cpp',
|
||||
'ADTFactory.cpp',
|
||||
'PluginInfoDatabase.cpp',
|
||||
]
|
||||
|
||||
if sdk.name in ['csgo', 'dota']:
|
||||
binary.sources += ['smn_protobuf.cpp']
|
||||
else:
|
||||
binary.sources += ['smn_bitbuffer.cpp']
|
||||
|
||||
if sdk.name == 'csgo':
|
||||
binary.sources += [
|
||||
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessages.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessage_helpers.cpp'),
|
||||
]
|
||||
elif sdk.name == 'dota':
|
||||
binary.sources += [
|
||||
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'networkbasetypes.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'protobuf', 'ai_activity.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'protobuf', 'usermessages.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf', 'dota_commonmessages.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf', 'dota_usermessages.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf', 'dota_usermessage_helpers.cpp'),
|
||||
]
|
||||
|
||||
SM.binaries += [builder.Add(binary)]
|
||||
extension = AMBuild.AddJob(name)
|
||||
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
|
||||
SM.PreSetupHL2Job(extension, binary, i)
|
||||
files = [
|
||||
'AdminCache.cpp',
|
||||
'ExtensionSys.cpp',
|
||||
'MenuStyle_Valve.cpp',
|
||||
'sm_crc32.cpp',
|
||||
'logic_bridge.cpp',
|
||||
'smn_entities.cpp',
|
||||
'sm_stringutil.cpp',
|
||||
'ADTFactory.cpp',
|
||||
'ForwardSys.cpp',
|
||||
'MenuVoting.cpp',
|
||||
'sm_memtable.cpp',
|
||||
'smn_events.cpp',
|
||||
'smn_menus.cpp',
|
||||
'sm_trie.cpp',
|
||||
'CDataPack.cpp',
|
||||
'frame_hooks.cpp',
|
||||
'NativeInvoker.cpp',
|
||||
'smn_admin.cpp',
|
||||
'smn_fakenatives.cpp',
|
||||
'smn_nextmap.cpp',
|
||||
'sourcemm_api.cpp',
|
||||
'ChatTriggers.cpp',
|
||||
'GameConfigs.cpp',
|
||||
'NativeOwner.cpp',
|
||||
'smn_filesystem.cpp',
|
||||
'smn_player.cpp',
|
||||
'sourcemod.cpp',
|
||||
'concmd_cleaner.cpp',
|
||||
'HalfLife2.cpp',
|
||||
'NextMap.cpp',
|
||||
'smn_profiler.cpp',
|
||||
'ConCmdManager.cpp',
|
||||
'HandleSys.cpp',
|
||||
'PhraseCollection.cpp',
|
||||
'ConVarManager.cpp',
|
||||
'LibrarySys.cpp',
|
||||
'PlayerManager.cpp',
|
||||
'smn_banning.cpp',
|
||||
'smn_gameconfigs.cpp',
|
||||
'smn_string.cpp',
|
||||
'TimerSys.cpp',
|
||||
'CoreConfig.cpp',
|
||||
'Logger.cpp',
|
||||
'PluginInfoDatabase.cpp',
|
||||
'smn_bitbuffer.cpp',
|
||||
'smn_halflife.cpp',
|
||||
'Translator.cpp',
|
||||
'MemoryUtils.cpp',
|
||||
'PluginSys.cpp',
|
||||
'smn_console.cpp',
|
||||
'smn_handles.cpp',
|
||||
'smn_timers.cpp',
|
||||
'UserMessages.cpp',
|
||||
'Database.cpp',
|
||||
'MenuManager.cpp',
|
||||
'smn_core.cpp',
|
||||
'smn_hudtext.cpp',
|
||||
'smn_usermsgs.cpp',
|
||||
'DebugReporter.cpp',
|
||||
'MenuStyle_Base.cpp',
|
||||
'ShareSys.cpp',
|
||||
'smn_database.cpp',
|
||||
'smn_keyvalues.cpp',
|
||||
'smn_vector.cpp',
|
||||
'EventManager.cpp',
|
||||
'MenuStyle_Radio.cpp',
|
||||
'sm_autonatives.cpp',
|
||||
'smn_datapacks.cpp',
|
||||
'smn_lang.cpp',
|
||||
'sm_srvcmds.cpp',
|
||||
'ConsoleDetours.cpp'
|
||||
]
|
||||
binary.AddSourceFiles('core', files)
|
||||
SM.PostSetupHL2Job(extension, binary, i)
|
||||
SM.AutoVersion('core', binary)
|
||||
binary.SendToJob()
|
||||
|
||||
|
||||
+2
-2
@@ -1719,7 +1719,7 @@ bool AdminCache::CanAdminUseCommand(int client, const char *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
return g_ConCmds.CheckClientCommandAccess(client, cmd, bits);
|
||||
return g_ConCmds.CheckCommandAccess(client, cmd, bits);
|
||||
}
|
||||
|
||||
unsigned int AdminCache::SetGroupImmunityLevel(GroupId gid, unsigned int level)
|
||||
@@ -1794,7 +1794,7 @@ bool AdminCache::CheckAccess(int client, const char *cmd, FlagBits flags, bool o
|
||||
GetCommandOverride(cmd, Override_Command, &bits);
|
||||
}
|
||||
|
||||
return g_ConCmds.CheckClientCommandAccess(client, cmd, bits) ? 1 : 0;
|
||||
return g_ConCmds.CheckCommandAccess(client, cmd, bits) ? 1 : 0;
|
||||
}
|
||||
|
||||
void iterator_glob_basic_override(Trie *pTrie, const char *key, void **value, void *data)
|
||||
|
||||
+61
-132
@@ -34,8 +34,8 @@
|
||||
#include "sm_stringutil.h"
|
||||
#include "ConCmdManager.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "Translator.h"
|
||||
#include "HalfLife2.h"
|
||||
#include "logic_bridge.h"
|
||||
|
||||
/* :HACKHACK: We can't SH_DECL here because ConCmdManager.cpp does.
|
||||
* While the OB build only runs on MM:S 1.6.0+ (SH 5+), the older one
|
||||
@@ -59,17 +59,13 @@ ChatTriggers g_ChatTriggers;
|
||||
bool g_bSupressSilentFails = false;
|
||||
|
||||
ChatTriggers::ChatTriggers() : m_pSayCmd(NULL), m_bWillProcessInPost(false),
|
||||
m_ReplyTo(SM_REPLY_CONSOLE)
|
||||
m_bTriggerWasSilent(false), m_ReplyTo(SM_REPLY_CONSOLE)
|
||||
{
|
||||
m_PubTrigger = sm_strdup("!");
|
||||
m_PrivTrigger = sm_strdup("/");
|
||||
m_PubTriggerSize = 1;
|
||||
m_PrivTriggerSize = 1;
|
||||
m_bIsChatTrigger = false;
|
||||
m_bPluginIgnored = false;
|
||||
#if SOURCE_ENGINE == SE_EPISODEONE
|
||||
m_bIsINS = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
ChatTriggers::~ChatTriggers()
|
||||
@@ -113,13 +109,11 @@ void ChatTriggers::OnSourceModAllInitialized()
|
||||
{
|
||||
m_pShouldFloodBlock = g_Forwards.CreateForward("OnClientFloodCheck", ET_Event, 1, NULL, Param_Cell);
|
||||
m_pDidFloodBlock = g_Forwards.CreateForward("OnClientFloodResult", ET_Event, 2, NULL, Param_Cell, Param_Cell);
|
||||
m_pOnClientSayCmd = g_Forwards.CreateForward("OnClientSayCommand", ET_Event, 3, NULL, Param_Cell, Param_String, Param_String);
|
||||
m_pOnClientSayCmd_Post = g_Forwards.CreateForward("OnClientSayCommand_Post", ET_Ignore, 3, NULL, Param_Cell, Param_String, Param_String);
|
||||
}
|
||||
|
||||
void ChatTriggers::OnSourceModAllInitialized_Post()
|
||||
{
|
||||
logicore.AddCorePhraseFile("antiflood.phrases");
|
||||
g_pCorePhrases->AddPhraseFile("antiflood.phrases");
|
||||
}
|
||||
|
||||
void ChatTriggers::OnSourceModGameInitialized()
|
||||
@@ -137,62 +131,23 @@ void ChatTriggers::OnSourceModGameInitialized()
|
||||
SH_ADD_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayTeamCmd, this, &ChatTriggers::OnSayCommand_Pre, false);
|
||||
SH_ADD_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayTeamCmd, this, &ChatTriggers::OnSayCommand_Post, true);
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_EPISODEONE
|
||||
m_bIsINS = (strcmp(g_SourceMod.GetGameFolderName(), "insurgency") == 0);
|
||||
|
||||
if (m_bIsINS)
|
||||
{
|
||||
m_pSay2Cmd = FindCommand("say2");
|
||||
if (m_pSay2Cmd)
|
||||
{
|
||||
SH_ADD_HOOK(ConCommand, Dispatch, m_pSay2Cmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
|
||||
SH_ADD_HOOK(ConCommand, Dispatch, m_pSay2Cmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
|
||||
}
|
||||
}
|
||||
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
|
||||
m_pSaySquadCmd = FindCommand("say_squad");
|
||||
|
||||
if (m_pSaySquadCmd)
|
||||
{
|
||||
SH_ADD_HOOK(ConCommand, Dispatch, m_pSaySquadCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
|
||||
SH_ADD_HOOK(ConCommand, Dispatch, m_pSaySquadCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ChatTriggers::OnSourceModShutdown()
|
||||
{
|
||||
if (m_pSayTeamCmd)
|
||||
{
|
||||
SH_REMOVE_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayTeamCmd, this, &ChatTriggers::OnSayCommand_Post, true);
|
||||
SH_REMOVE_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayTeamCmd, this, &ChatTriggers::OnSayCommand_Pre, false);
|
||||
}
|
||||
if (m_pSayCmd)
|
||||
{
|
||||
SH_REMOVE_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayCmd, this, &ChatTriggers::OnSayCommand_Post, true);
|
||||
SH_REMOVE_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayCmd, this, &ChatTriggers::OnSayCommand_Pre, false);
|
||||
}
|
||||
|
||||
if (m_pSayTeamCmd)
|
||||
{
|
||||
SH_REMOVE_HOOK(ConCommand, Dispatch, m_pSayTeamCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
|
||||
SH_REMOVE_HOOK(ConCommand, Dispatch, m_pSayTeamCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_EPISODEONE
|
||||
if (m_bIsINS && m_pSay2Cmd)
|
||||
{
|
||||
SH_REMOVE_HOOK(ConCommand, Dispatch, m_pSay2Cmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
|
||||
SH_REMOVE_HOOK(ConCommand, Dispatch, m_pSay2Cmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
|
||||
}
|
||||
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
|
||||
if (m_pSaySquadCmd)
|
||||
{
|
||||
SH_REMOVE_HOOK(ConCommand, Dispatch, m_pSaySquadCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
|
||||
SH_REMOVE_HOOK(ConCommand, Dispatch, m_pSaySquadCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
|
||||
}
|
||||
#endif
|
||||
|
||||
g_Forwards.ReleaseForward(m_pShouldFloodBlock);
|
||||
g_Forwards.ReleaseForward(m_pDidFloodBlock);
|
||||
g_Forwards.ReleaseForward(m_pOnClientSayCmd);
|
||||
g_Forwards.ReleaseForward(m_pOnClientSayCmd_Post);
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
@@ -203,10 +158,24 @@ void ChatTriggers::OnSayCommand_Pre()
|
||||
{
|
||||
CCommand command;
|
||||
#endif
|
||||
int client = g_ConCmds.GetCommandClient();
|
||||
int client;
|
||||
CPlayer *pPlayer;
|
||||
|
||||
client = g_ConCmds.GetCommandClient();
|
||||
m_bIsChatTrigger = false;
|
||||
m_bWasFloodedMessage = false;
|
||||
m_bPluginIgnored = false;
|
||||
|
||||
/* The server console cannot do this */
|
||||
if (client == 0 || (pPlayer = g_Players.GetPlayerByIndex(client)) == NULL)
|
||||
{
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
/* We guarantee the client is connected */
|
||||
if (!pPlayer->IsConnected())
|
||||
{
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
const char *args = command.ArgS();
|
||||
|
||||
@@ -215,38 +184,22 @@ void ChatTriggers::OnSayCommand_Pre()
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
/* Save these off for post hook as the command data returned from the engine in older engine versions
|
||||
* can be NULL, despite the data still being there and valid. */
|
||||
m_Arg0Backup = command.Arg(0);
|
||||
m_ArgSBackup = command.ArgS();
|
||||
|
||||
/* The server console cannot do this */
|
||||
if (client == 0)
|
||||
{
|
||||
cell_t res = CallOnClientSayCommand(client);
|
||||
if (res >= Pl_Handled)
|
||||
{
|
||||
m_bPluginIgnored = (res >= Pl_Stop);
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||
|
||||
/* We guarantee the client is connected */
|
||||
if (!pPlayer || !pPlayer->IsConnected())
|
||||
{
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
/* Check if we need to block this message from being sent */
|
||||
if (ClientIsFlooding(client))
|
||||
{
|
||||
char buffer[128];
|
||||
|
||||
if (!logicore.CoreTranslate(buffer, sizeof(buffer), "%T", 2, NULL, "Flooding the server", &client))
|
||||
if (!CoreTranslate(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"%T",
|
||||
2,
|
||||
NULL,
|
||||
"Flooding the server",
|
||||
&client))
|
||||
{
|
||||
UTIL_Format(buffer, sizeof(buffer), "You are flooding the server!");
|
||||
}
|
||||
|
||||
/* :TODO: we should probably kick people who spam too much. */
|
||||
|
||||
@@ -267,13 +220,6 @@ void ChatTriggers::OnSayCommand_Pre()
|
||||
is_quoted = true;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_EPISODEONE
|
||||
if (m_bIsINS && strcmp(m_Arg0Backup, "say2") == 0 && strlen(args) >= 4)
|
||||
{
|
||||
args += 4;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool is_trigger = false;
|
||||
bool is_silent = false;
|
||||
|
||||
@@ -290,28 +236,38 @@ void ChatTriggers::OnSayCommand_Pre()
|
||||
args = &args[m_PrivTriggerSize];
|
||||
}
|
||||
|
||||
if (!is_trigger)
|
||||
{
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if this is actually a command!
|
||||
*/
|
||||
if (is_trigger && PreProcessTrigger(PEntityOfEntIndex(client), args, is_quoted))
|
||||
if (!PreProcessTrigger(PEntityOfEntIndex(client), args, is_quoted))
|
||||
{
|
||||
m_bIsChatTrigger = true;
|
||||
|
||||
/**
|
||||
* We'll execute it in post.
|
||||
*/
|
||||
m_bWillProcessInPost = true;
|
||||
CPlayer *pPlayer;
|
||||
if (is_silent
|
||||
&& g_bSupressSilentFails
|
||||
&& client != 0
|
||||
&& (pPlayer = g_Players.GetPlayerByIndex(client)) != NULL
|
||||
&& pPlayer->GetAdminId() != INVALID_ADMIN_ID)
|
||||
{
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
cell_t res = CallOnClientSayCommand(client);
|
||||
m_bIsChatTrigger = true;
|
||||
|
||||
if (res >= Pl_Handled)
|
||||
{
|
||||
m_bPluginIgnored = (res >= Pl_Stop);
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
/**
|
||||
* We'll execute it in post.
|
||||
*/
|
||||
m_bWillProcessInPost = true;
|
||||
m_bTriggerWasSilent = is_silent;
|
||||
|
||||
if (is_silent && (m_bIsChatTrigger || (g_bSupressSilentFails && pPlayer->GetAdminId() != INVALID_ADMIN_ID)))
|
||||
/* If we're silent, block */
|
||||
if (is_silent)
|
||||
{
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
@@ -326,33 +282,19 @@ void ChatTriggers::OnSayCommand_Post(const CCommand &command)
|
||||
void ChatTriggers::OnSayCommand_Post()
|
||||
#endif
|
||||
{
|
||||
int client = g_ConCmds.GetCommandClient();
|
||||
|
||||
m_bIsChatTrigger = false;
|
||||
m_bWasFloodedMessage = false;
|
||||
if (m_bWillProcessInPost)
|
||||
{
|
||||
/* Reset this for re-entrancy */
|
||||
m_bWillProcessInPost = false;
|
||||
|
||||
/* Execute the cached command */
|
||||
int client = g_ConCmds.GetCommandClient();
|
||||
unsigned int old = SetReplyTo(SM_REPLY_CHAT);
|
||||
serverpluginhelpers->ClientCommand(PEntityOfEntIndex(client), m_ToExecute);
|
||||
SetReplyTo(old);
|
||||
}
|
||||
|
||||
if (m_bPluginIgnored)
|
||||
{
|
||||
m_bPluginIgnored = false;
|
||||
}
|
||||
else if (!m_bWasFloodedMessage && !m_bIsChatTrigger && m_pOnClientSayCmd_Post->GetFunctionCount() != 0)
|
||||
{
|
||||
m_pOnClientSayCmd_Post->PushCell(client);
|
||||
m_pOnClientSayCmd_Post->PushString(m_Arg0Backup);
|
||||
m_pOnClientSayCmd_Post->PushString(m_ArgSBackup);
|
||||
m_pOnClientSayCmd_Post->Execute(NULL);
|
||||
}
|
||||
|
||||
m_bIsChatTrigger = false;
|
||||
m_bWasFloodedMessage = false;
|
||||
}
|
||||
|
||||
bool ChatTriggers::PreProcessTrigger(edict_t *pEdict, const char *args, bool is_quoted)
|
||||
@@ -429,19 +371,6 @@ bool ChatTriggers::PreProcessTrigger(edict_t *pEdict, const char *args, bool is_
|
||||
return true;
|
||||
}
|
||||
|
||||
cell_t ChatTriggers::CallOnClientSayCommand(int client)
|
||||
{
|
||||
cell_t res = Pl_Continue;
|
||||
if (!m_bIsChatTrigger && m_pOnClientSayCmd->GetFunctionCount() != 0)
|
||||
{
|
||||
m_pOnClientSayCmd->PushCell(client);
|
||||
m_pOnClientSayCmd->PushString(m_Arg0Backup);
|
||||
m_pOnClientSayCmd->PushString(m_ArgSBackup);
|
||||
m_pOnClientSayCmd->Execute(&res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
unsigned int ChatTriggers::SetReplyTo(unsigned int reply)
|
||||
{
|
||||
unsigned int old = m_ReplyTo;
|
||||
|
||||
+1
-14
@@ -69,34 +69,21 @@ public:
|
||||
private:
|
||||
bool PreProcessTrigger(edict_t *pEdict, const char *args, bool is_quoted);
|
||||
bool ClientIsFlooding(int client);
|
||||
cell_t CallOnClientSayCommand(int client);
|
||||
private:
|
||||
ConCommand *m_pSayCmd;
|
||||
ConCommand *m_pSayTeamCmd;
|
||||
#if SOURCE_ENGINE == SE_EPISODEONE
|
||||
ConCommand *m_pSay2Cmd;
|
||||
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
|
||||
ConCommand *m_pSaySquadCmd;
|
||||
#endif
|
||||
char *m_PubTrigger;
|
||||
size_t m_PubTriggerSize;
|
||||
char *m_PrivTrigger;
|
||||
size_t m_PrivTriggerSize;
|
||||
bool m_bWillProcessInPost;
|
||||
bool m_bTriggerWasSilent;
|
||||
bool m_bIsChatTrigger;
|
||||
bool m_bWasFloodedMessage;
|
||||
bool m_bPluginIgnored;
|
||||
unsigned int m_ReplyTo;
|
||||
char m_ToExecute[300];
|
||||
const char *m_Arg0Backup;
|
||||
const char *m_ArgSBackup;
|
||||
IForward *m_pShouldFloodBlock;
|
||||
IForward *m_pDidFloodBlock;
|
||||
IForward *m_pOnClientSayCmd;
|
||||
IForward *m_pOnClientSayCmd_Post;
|
||||
#if SOURCE_ENGINE == SE_EPISODEONE
|
||||
bool m_bIsINS;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern ChatTriggers g_ChatTriggers;
|
||||
|
||||
+92
-47
@@ -34,9 +34,9 @@
|
||||
#include "AdminCache.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "Translator.h"
|
||||
#include "HalfLife2.h"
|
||||
#include "ChatTriggers.h"
|
||||
#include "logic_bridge.h"
|
||||
|
||||
ConCmdManager g_ConCmds;
|
||||
|
||||
@@ -226,38 +226,30 @@ void ConCmdManager::SetCommandClient(int client)
|
||||
m_CmdClient = client + 1;
|
||||
}
|
||||
|
||||
ConCmdInfo *ConCmdManager::FindInTrie(const char *name)
|
||||
{
|
||||
ConCmdInfo *pInfo;
|
||||
if (!sm_trie_retrieve(m_pCmds, name, (void **)&pInfo))
|
||||
return NULL;
|
||||
return pInfo;
|
||||
}
|
||||
|
||||
ConCmdList::iterator ConCmdManager::FindInList(const char *cmd)
|
||||
{
|
||||
List<ConCmdInfo *>::iterator iter = m_CmdList.begin();
|
||||
|
||||
while (iter != m_CmdList.end())
|
||||
{
|
||||
if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
|
||||
break;
|
||||
iter++;
|
||||
}
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
||||
ResultType ConCmdManager::DispatchClientCommand(int client, const char *cmd, int args, ResultType type)
|
||||
{
|
||||
ConCmdInfo *pInfo;
|
||||
|
||||
if ((pInfo = FindInTrie(cmd)) == NULL)
|
||||
if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
|
||||
{
|
||||
ConCmdList::iterator item = FindInList(cmd);
|
||||
if (item == m_CmdList.end())
|
||||
List<ConCmdInfo *>::iterator iter;
|
||||
|
||||
pInfo = NULL;
|
||||
iter = m_CmdList.begin();
|
||||
while (iter != m_CmdList.end())
|
||||
{
|
||||
if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
|
||||
{
|
||||
pInfo = (*iter);
|
||||
break;
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
return type;
|
||||
pInfo = *item;
|
||||
}
|
||||
}
|
||||
|
||||
cell_t result = type;
|
||||
@@ -322,20 +314,35 @@ void ConCmdManager::InternalDispatch(const CCommand &command)
|
||||
*/
|
||||
const char *cmd = g_HL2.CurrentCommandName();
|
||||
|
||||
ConCmdInfo *pInfo = FindInTrie(cmd);
|
||||
if (pInfo == NULL)
|
||||
ConCmdInfo *pInfo;
|
||||
if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
|
||||
{
|
||||
/* Unfortunately, we now have to do a slow lookup because Valve made client commands
|
||||
* case-insensitive. We can't even use our sortedness.
|
||||
*/
|
||||
if (client == 0 && !engine->IsDedicatedServer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ConCmdList::iterator item = FindInList(cmd);
|
||||
if (item == m_CmdList.end())
|
||||
return;
|
||||
List<ConCmdInfo *>::iterator iter;
|
||||
|
||||
pInfo = *item;
|
||||
pInfo = NULL;
|
||||
iter = m_CmdList.begin();
|
||||
while (iter != m_CmdList.end())
|
||||
{
|
||||
if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
|
||||
{
|
||||
pInfo = (*iter);
|
||||
break;
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* This is a hack to prevent say triggers from firing on messages that were
|
||||
@@ -450,7 +457,7 @@ void ConCmdManager::InternalDispatch(const CCommand &command)
|
||||
}
|
||||
}
|
||||
|
||||
bool ConCmdManager::CheckClientCommandAccess(int client, const char *cmd, FlagBits cmdflags)
|
||||
bool ConCmdManager::CheckCommandAccess(int client, const char *cmd, FlagBits cmdflags)
|
||||
{
|
||||
if (cmdflags == 0 || client == 0)
|
||||
{
|
||||
@@ -471,11 +478,7 @@ bool ConCmdManager::CheckClientCommandAccess(int client, const char *cmd, FlagBi
|
||||
return false;
|
||||
}
|
||||
|
||||
return CheckAdminCommandAccess(player->GetAdminId(), cmd, cmdflags);
|
||||
}
|
||||
|
||||
bool ConCmdManager::CheckAdminCommandAccess(AdminId adm, const char *cmd, FlagBits cmdflags)
|
||||
{
|
||||
AdminId adm = player->GetAdminId();
|
||||
if (adm != INVALID_ADMIN_ID)
|
||||
{
|
||||
FlagBits bits = g_Admins.GetAdminFlags(adm, Access_Effective);
|
||||
@@ -528,7 +531,7 @@ bool ConCmdManager::CheckAdminCommandAccess(AdminId adm, const char *cmd, FlagBi
|
||||
|
||||
bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmin)
|
||||
{
|
||||
if (CheckClientCommandAccess(client, cmd, pAdmin->eflags))
|
||||
if (CheckCommandAccess(client, cmd, pAdmin->eflags))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -537,7 +540,7 @@ bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmi
|
||||
|
||||
/* If we got here, the command failed... */
|
||||
char buffer[128];
|
||||
if (!logicore.CoreTranslate(buffer, sizeof(buffer), "%T", 2, NULL, "No Access", &client))
|
||||
if (!CoreTranslate(buffer, sizeof(buffer), "%T", 2, NULL, "No Access", &client))
|
||||
{
|
||||
UTIL_Format(buffer, sizeof(buffer), "You do not have access to this command");
|
||||
}
|
||||
@@ -559,6 +562,44 @@ bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmi
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConCmdManager::AddConsoleCommand(IPluginFunction *pFunction,
|
||||
const char *name,
|
||||
const char *description,
|
||||
int flags)
|
||||
{
|
||||
ConCmdInfo *pInfo = AddOrFindCommand(name, description, flags);
|
||||
|
||||
if (!pInfo)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CmdHook *pHook = new CmdHook();
|
||||
|
||||
pHook->pf = pFunction;
|
||||
if (description && description[0])
|
||||
{
|
||||
pHook->helptext.assign(description);
|
||||
}
|
||||
pInfo->conhooks.push_back(pHook);
|
||||
|
||||
/* Add to the plugin */
|
||||
CmdList *pList;
|
||||
IPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
|
||||
if (!pPlugin->GetProperty("CommandList", (void **)&pList))
|
||||
{
|
||||
pList = new CmdList();
|
||||
pPlugin->SetProperty("CommandList", pList);
|
||||
}
|
||||
PlCmdInfo info;
|
||||
info.pInfo = pInfo;
|
||||
info.type = Cmd_Console;
|
||||
info.pHook = pHook;
|
||||
AddToPlCmdList(pList, info);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
|
||||
const char *name,
|
||||
const char *group,
|
||||
@@ -620,6 +661,7 @@ bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
|
||||
/* Finally, add the hook */
|
||||
pInfo->conhooks.push_back(pHook);
|
||||
pInfo->admin = *(pHook->pAdmin);
|
||||
pInfo->is_admin_set = true;
|
||||
|
||||
/* Now add to the plugin */
|
||||
CmdList *pList;
|
||||
@@ -764,6 +806,7 @@ void ConCmdManager::UpdateAdminCmdFlags(const char *cmd, OverrideType type, Flag
|
||||
pInfo->admin = *(pHook->pAdmin);
|
||||
}
|
||||
}
|
||||
pInfo->is_admin_set = true;
|
||||
}
|
||||
else if (type == Override_CommandGroup)
|
||||
{
|
||||
@@ -797,6 +840,7 @@ void ConCmdManager::UpdateAdminCmdFlags(const char *cmd, OverrideType type, Flag
|
||||
}
|
||||
}
|
||||
}
|
||||
pInfo->is_admin_set = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -864,7 +908,7 @@ bool ConCmdManager::LookForCommandAdminFlags(const char *cmd, FlagBits *pFlags)
|
||||
|
||||
*pFlags = pInfo->admin.eflags;
|
||||
|
||||
return true;
|
||||
return pInfo->is_admin_set;
|
||||
}
|
||||
|
||||
ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *description, int flags)
|
||||
@@ -872,10 +916,6 @@ ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *descri
|
||||
ConCmdInfo *pInfo;
|
||||
if (!sm_trie_retrieve(m_pCmds, name, (void **)&pInfo))
|
||||
{
|
||||
ConCmdList::iterator item = FindInList(name);
|
||||
if (item != m_CmdList.end())
|
||||
return *item;
|
||||
|
||||
pInfo = new ConCmdInfo();
|
||||
/* Find the commandopan */
|
||||
ConCommand *pCmd = FindCommand(name);
|
||||
@@ -901,6 +941,7 @@ ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *descri
|
||||
}
|
||||
|
||||
pInfo->pCmd = pCmd;
|
||||
pInfo->is_admin_set = false;
|
||||
|
||||
sm_trie_insert(m_pCmds, name, pInfo);
|
||||
AddToCmdList(pInfo);
|
||||
@@ -953,9 +994,13 @@ void ConCmdManager::OnRootConsoleCommand(const char *cmdname, const CCommand &co
|
||||
{
|
||||
type = "server";
|
||||
}
|
||||
else if (cmd.type == Cmd_Console)
|
||||
{
|
||||
type = "console";
|
||||
}
|
||||
else if (cmd.type == Cmd_Admin)
|
||||
{
|
||||
type = (cmd.pInfo->admin.eflags == 0)?"console":"admin";
|
||||
type = "admin";
|
||||
}
|
||||
name = cmd.pInfo->pCmd->GetName();
|
||||
if (cmd.pHook->helptext.size())
|
||||
|
||||
+5
-11
@@ -48,6 +48,7 @@ using namespace SourceHook;
|
||||
enum CmdType
|
||||
{
|
||||
Cmd_Server,
|
||||
Cmd_Console,
|
||||
Cmd_Admin,
|
||||
};
|
||||
|
||||
@@ -88,10 +89,9 @@ struct ConCmdInfo
|
||||
List<CmdHook *> srvhooks; /**< Hooks as a server command */
|
||||
List<CmdHook *> conhooks; /**< Hooks as a console command */
|
||||
AdminCmdInfo admin; /**< Admin info, if any */
|
||||
bool is_admin_set; /**< Whether or not admin info is set */
|
||||
};
|
||||
|
||||
typedef List<ConCmdInfo *> ConCmdList;
|
||||
|
||||
class ConCmdManager :
|
||||
public SMGlobalClass,
|
||||
public IRootConsoleCommand,
|
||||
@@ -117,6 +117,7 @@ public: //IConCommandTracker
|
||||
void OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name, bool is_read_safe);
|
||||
public:
|
||||
bool AddServerCommand(IPluginFunction *pFunction, const char *name, const char *description, int flags);
|
||||
bool AddConsoleCommand(IPluginFunction *pFunction, const char *name, const char *description, int flags);
|
||||
bool AddAdminCommand(IPluginFunction *pFunction,
|
||||
const char *name,
|
||||
const char *group,
|
||||
@@ -127,8 +128,7 @@ public:
|
||||
void UpdateAdminCmdFlags(const char *cmd, OverrideType type, FlagBits bits, bool remove);
|
||||
bool LookForSourceModCommand(const char *cmd);
|
||||
bool LookForCommandAdminFlags(const char *cmd, FlagBits *pFlags);
|
||||
bool CheckClientCommandAccess(int client, const char *cmd, FlagBits flags);
|
||||
bool CheckAdminCommandAccess(AdminId adm, const char *cmd, FlagBits flags);
|
||||
bool CheckCommandAccess(int client, const char *cmd, FlagBits flags);
|
||||
private:
|
||||
void InternalDispatch(const CCommand &command);
|
||||
ResultType RunAdminCommand(ConCmdInfo *pInfo, int client, int args);
|
||||
@@ -139,12 +139,6 @@ private:
|
||||
void RemoveConCmds(List<CmdHook *> &cmdlist);
|
||||
void RemoveConCmds(List<CmdHook *> &cmdlist, IPluginContext *pContext);
|
||||
bool CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmin);
|
||||
|
||||
// Case insensitive
|
||||
ConCmdList::iterator FindInList(const char *name);
|
||||
|
||||
// Case sensitive
|
||||
ConCmdInfo *FindInTrie(const char *name);
|
||||
public:
|
||||
inline int GetCommandClient()
|
||||
{
|
||||
@@ -157,7 +151,7 @@ public:
|
||||
private:
|
||||
Trie *m_pCmds; /* command lookup */
|
||||
Trie *m_pCmdGrps; /* command group lookup */
|
||||
ConCmdList m_CmdList; /* command list */
|
||||
List<ConCmdInfo *> m_CmdList; /* command list */
|
||||
int m_CmdClient; /* current client */
|
||||
BaseStringTable m_Strings; /* string table */
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -31,59 +31,59 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_
|
||||
#define _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_
|
||||
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
class ConCommandBaseIterator
|
||||
{
|
||||
public:
|
||||
inline ConCommandBaseIterator() : iter(icvar)
|
||||
{
|
||||
iter.SetFirst();
|
||||
}
|
||||
|
||||
inline bool IsValid()
|
||||
{
|
||||
return iter.IsValid();
|
||||
}
|
||||
|
||||
inline void Next()
|
||||
{
|
||||
iter.Next();
|
||||
}
|
||||
|
||||
inline ConCommandBase *Get()
|
||||
{
|
||||
return iter.Get();
|
||||
}
|
||||
private:
|
||||
ICvar::Iterator iter;
|
||||
};
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
ICvarIteratorInternal *cvarIter;
|
||||
#else
|
||||
class ConCommandBaseIterator
|
||||
{
|
||||
ConCommandBase *cvarIter;
|
||||
#endif
|
||||
|
||||
public:
|
||||
inline ConCommandBaseIterator()
|
||||
ConCommandBaseIterator()
|
||||
{
|
||||
iter = icvar->GetCommands();
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
cvarIter = icvar->FactoryInternalIterator();
|
||||
cvarIter->SetFirst();
|
||||
#else
|
||||
cvarIter = icvar->GetCommands();
|
||||
#endif
|
||||
}
|
||||
|
||||
~ConCommandBaseIterator()
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
g_pMemAlloc->Free(cvarIter);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool IsValid()
|
||||
{
|
||||
return iter != NULL;
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
return cvarIter->IsValid();
|
||||
#else
|
||||
return cvarIter != NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void Next()
|
||||
{
|
||||
iter = const_cast<ConCommandBase *>(iter->GetNext());
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
cvarIter->Next();
|
||||
#else
|
||||
cvarIter = const_cast<ConCommandBase*>(cvarIter->GetNext());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline ConCommandBase *Get()
|
||||
{
|
||||
return iter;
|
||||
}
|
||||
private:
|
||||
ConCommandBase *iter;
|
||||
};
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
return cvarIter->Get();
|
||||
#else
|
||||
return cvarIter;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_ */
|
||||
|
||||
|
||||
+8
-48
@@ -126,8 +126,6 @@ void ConVarManager::OnSourceModAllInitialized()
|
||||
}
|
||||
#endif
|
||||
|
||||
g_Players.AddClientListener(this);
|
||||
|
||||
SH_ADD_HOOK_STATICFUNC(ICvar, CallGlobalChangeCallbacks, icvar, OnConVarChanged, false);
|
||||
|
||||
g_PluginSys.AddPluginsListener(this);
|
||||
@@ -193,8 +191,6 @@ void ConVarManager::OnSourceModShutdown()
|
||||
}
|
||||
#endif
|
||||
|
||||
g_Players.RemoveClientListener(this);
|
||||
|
||||
SH_REMOVE_HOOK_STATICFUNC(ICvar, CallGlobalChangeCallbacks, icvar, OnConVarChanged, false);
|
||||
|
||||
/* Remove the 'convars' option from the 'sm' console command */
|
||||
@@ -311,22 +307,6 @@ void ConVarManager::OnPluginUnloaded(IPlugin *plugin)
|
||||
}
|
||||
}
|
||||
|
||||
void ConVarManager::OnClientDisconnected(int client)
|
||||
{
|
||||
/* Remove convar queries for this client that haven't returned results yet */
|
||||
for (List<ConVarQuery>::iterator iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end();)
|
||||
{
|
||||
ConVarQuery &query = (*iter);
|
||||
if (query.client == client)
|
||||
{
|
||||
iter = m_ConVarQueries.erase(iter);
|
||||
continue;
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
void ConVarManager::OnHandleDestroy(HandleType_t type, void *object)
|
||||
{
|
||||
}
|
||||
@@ -342,15 +322,8 @@ void ConVarManager::OnRootConsoleCommand(const char *cmdname, const CCommand &co
|
||||
int argcount = command.ArgC();
|
||||
if (argcount >= 3)
|
||||
{
|
||||
bool wantReset = false;
|
||||
|
||||
/* Get plugin index that was passed */
|
||||
const char *arg = command.Arg(2);
|
||||
if (argcount >= 4 && strcmp(arg, "reset") == 0)
|
||||
{
|
||||
wantReset = true;
|
||||
arg = command.Arg(3);
|
||||
}
|
||||
|
||||
/* Get plugin object */
|
||||
CPlugin *plugin = g_PluginSys.FindPluginByConsoleArg(arg);
|
||||
@@ -375,34 +348,21 @@ void ConVarManager::OnRootConsoleCommand(const char *cmdname, const CCommand &co
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wantReset)
|
||||
{
|
||||
g_RootMenu.ConsolePrint("[SM] Listing %d convars for: %s", pConVarList->size(), plname);
|
||||
g_RootMenu.ConsolePrint(" %-32.31s %s", "[Name]", "[Value]");
|
||||
}
|
||||
|
||||
/* Iterate convar list and display/reset each one */
|
||||
g_RootMenu.ConsolePrint("[SM] Listing %d convars for: %s", pConVarList->size(), plname);
|
||||
g_RootMenu.ConsolePrint(" %-32.31s %s", "[Name]", "[Value]");
|
||||
|
||||
/* Iterate convar list and display each one */
|
||||
for (iter = pConVarList->begin(); iter != pConVarList->end(); iter++)
|
||||
{
|
||||
/*const */ConVar *pConVar = const_cast<ConVar *>(*iter);
|
||||
if (!wantReset)
|
||||
{
|
||||
g_RootMenu.ConsolePrint(" %-32.31s %s", pConVar->GetName(), pConVar->GetString());
|
||||
} else {
|
||||
pConVar->Revert();
|
||||
}
|
||||
}
|
||||
|
||||
if (wantReset)
|
||||
{
|
||||
g_RootMenu.ConsolePrint("[SM] Reset %d convars for: %s", pConVarList->size(), plname);
|
||||
const ConVar *pConVar = (*iter);
|
||||
g_RootMenu.ConsolePrint(" %-32.31s %s", pConVar->GetName(), pConVar->GetString());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Display usage of subcommand */
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm cvars [reset] <plugin #>");
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm cvars <plugin #>");
|
||||
}
|
||||
|
||||
Handle_t ConVarManager::CreateConVar(IPluginContext *pContext, const char *name, const char *defaultVal, const char *description, int flags, bool hasMin, float min, bool hasMax, float max)
|
||||
@@ -639,7 +599,7 @@ QueryCvarCookie_t ConVarManager::QueryClientConVar(edict_t *pPlayer, const char
|
||||
return InvalidQueryCvarCookie;
|
||||
}
|
||||
|
||||
ConVarQuery query = {cookie, pCallback, (cell_t)hndl, IndexOfEdict(pPlayer)};
|
||||
ConVarQuery query = {cookie, pCallback, hndl};
|
||||
m_ConVarQueries.push_back(query);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -39,10 +39,8 @@
|
||||
#include <IForwardSys.h>
|
||||
#include <IHandleSys.h>
|
||||
#include <IRootConsoleMenu.h>
|
||||
#include <IPlayerHelpers.h>
|
||||
#include <compat_wrappers.h>
|
||||
#include "concmd_cleaner.h"
|
||||
#include "PlayerManager.h"
|
||||
|
||||
#if SOURCE_ENGINE == SE_DARKMESSIAH
|
||||
class EQueryCvarValueStatus;
|
||||
@@ -77,7 +75,6 @@ struct ConVarQuery
|
||||
QueryCvarCookie_t cookie; /**< Cookie that identifies query */
|
||||
IPluginFunction *pCallback; /**< Function that will be called when query is finished */
|
||||
cell_t value; /**< Optional value passed to query function */
|
||||
cell_t client; /**< Only used for cleaning up on client disconnection */
|
||||
};
|
||||
|
||||
class ConVarManager :
|
||||
@@ -85,8 +82,7 @@ class ConVarManager :
|
||||
public IHandleTypeDispatch,
|
||||
public IPluginsListener,
|
||||
public IRootConsoleCommand,
|
||||
public IConCommandTracker,
|
||||
public IClientListener
|
||||
public IConCommandTracker
|
||||
{
|
||||
public:
|
||||
ConVarManager();
|
||||
@@ -105,8 +101,6 @@ public: //IRootConsoleCommand
|
||||
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
|
||||
public: //IConCommandTracker
|
||||
void OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name, bool is_read_safe);
|
||||
public: //IClientListener
|
||||
void OnClientDisconnected(int client);
|
||||
public:
|
||||
/**
|
||||
* Create a convar and return a handle to it.
|
||||
|
||||
@@ -44,14 +44,14 @@
|
||||
#include "Logger.h"
|
||||
#include "compat_wrappers.h"
|
||||
#include "ConsoleDetours.h"
|
||||
#include <IGameConfigs.h>
|
||||
#include "GameConfigs.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "ConCmdManager.h"
|
||||
#include "HalfLife2.h"
|
||||
#include "ConCommandBaseIterator.h"
|
||||
#include "ShareSys.h"
|
||||
|
||||
#if defined PLATFORM_POSIX
|
||||
#if defined PLATFORM_LINUX
|
||||
# include <dlfcn.h>
|
||||
# include <sys/mman.h>
|
||||
# include <stdint.h>
|
||||
@@ -664,11 +664,6 @@ cell_t ConsoleDetours::InternalDispatch(int client, const CCommand& args)
|
||||
char name[255];
|
||||
const char *realname = args.Arg(0);
|
||||
size_t len = strlen(realname);
|
||||
|
||||
// Disallow command strings that are too long, for now.
|
||||
if (len >= sizeof(name) - 1)
|
||||
return Pl_Continue;
|
||||
|
||||
for (size_t i = 0; i < len; i++)
|
||||
{
|
||||
if (realname[i] >= 'A' && realname[i] <= 'Z')
|
||||
@@ -688,7 +683,7 @@ cell_t ConsoleDetours::InternalDispatch(int client, const CCommand& args)
|
||||
if (strcmp(name, "sm") == 0)
|
||||
result = Pl_Continue;
|
||||
|
||||
if (result >= Pl_Handled)
|
||||
if (result >= Pl_Stop)
|
||||
return result;
|
||||
|
||||
Listener **plistener = m_CmdLookup.retrieve(name);
|
||||
|
||||
+4
-22
@@ -193,30 +193,17 @@ void CoreConfig::OnRootConsoleCommand(const char *cmdname, const CCommand &comma
|
||||
|
||||
if (res == ConfigResult_Reject)
|
||||
{
|
||||
g_RootMenu.ConsolePrint("[SM] Could not set config option \"%s\" to \"%s\". (%s)", option, value, error);
|
||||
g_RootMenu.ConsolePrint("[SM] Could not set config option \"%s\" to \"%s\" (%s)", option, value, error);
|
||||
} else if (res == ConfigResult_Ignore) {
|
||||
g_RootMenu.ConsolePrint("[SM] No such config option \"%s\" exists.", option);
|
||||
} else {
|
||||
g_RootMenu.ConsolePrint("[SM] Config option \"%s\" successfully set to \"%s\".", option, value);
|
||||
g_RootMenu.ConsolePrint("Config option \"%s\" successfully set to \"%s.\"", option, value);
|
||||
}
|
||||
|
||||
return;
|
||||
} else if (argcount >= 3) {
|
||||
const char *option = command.Arg(2);
|
||||
|
||||
const char *value = GetCoreConfigValue(option);
|
||||
|
||||
if (value == NULL)
|
||||
{
|
||||
g_RootMenu.ConsolePrint("[SM] No such config option \"%s\" exists.", option);
|
||||
} else {
|
||||
g_RootMenu.ConsolePrint("[SM] Config option \"%s\" is set to \"%s\".", option, value);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm config <option> [value]");
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm config <option> <value>");
|
||||
}
|
||||
|
||||
void CoreConfig::Initialize()
|
||||
@@ -408,7 +395,7 @@ bool SM_ExecuteConfig(CPlugin *pl, AutoConfig *cfg, bool can_create)
|
||||
FILE *fp = fopen(file, "wt");
|
||||
if (fp)
|
||||
{
|
||||
fprintf(fp, "// This file was auto-generated by SourceMod (v%s)\n", SOURCEMOD_VERSION);
|
||||
fprintf(fp, "// This file was auto-generated by SourceMod (v%s)\n", SM_FULL_VERSION);
|
||||
fprintf(fp, "// ConVars for plugin \"%s\"\n", pl->GetFilename());
|
||||
fprintf(fp, "\n\n");
|
||||
|
||||
@@ -465,11 +452,6 @@ bool SM_ExecuteConfig(CPlugin *pl, AutoConfig *cfg, bool can_create)
|
||||
can_create = false;
|
||||
fclose(fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Logger.LogError("Failed to auto generate config for %s, make sure the directory has write permission.", pl->GetFilename());
|
||||
return can_create;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+31
-40
@@ -47,7 +47,7 @@ DBManager g_DBMan;
|
||||
static bool s_OneTimeThreaderErrorMsg = false;
|
||||
|
||||
DBManager::DBManager()
|
||||
: m_ParseLevel(0), m_ParseState(0), m_pDefault(NULL)
|
||||
: m_StrTab(512), m_ParseLevel(0), m_ParseState(0), m_pDefault(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -104,7 +104,6 @@ void DBManager::OnSourceModShutdown()
|
||||
m_pQueueLock->DestroyThis();
|
||||
g_HandleSys.RemoveType(m_DatabaseType, g_pCoreIdent);
|
||||
g_HandleSys.RemoveType(m_DriverType, g_pCoreIdent);
|
||||
ClearConfigs();
|
||||
}
|
||||
|
||||
unsigned int DBManager::GetInterfaceVersion()
|
||||
@@ -134,20 +133,13 @@ void DBManager::OnHandleDestroy(HandleType_t type, void *object)
|
||||
|
||||
void DBManager::ReadSMC_ParseStart()
|
||||
{
|
||||
ClearConfigs();
|
||||
m_confs.clear();
|
||||
m_ParseLevel = 0;
|
||||
m_ParseState = DBPARSE_LEVEL_NONE;
|
||||
m_StrTab.Reset();
|
||||
m_DefDriver.clear();
|
||||
}
|
||||
|
||||
void DBManager::ClearConfigs()
|
||||
{
|
||||
List<ConfDbInfo *>::iterator iter;
|
||||
for (iter=m_confs.begin(); iter!=m_confs.end(); iter++)
|
||||
delete (*iter);
|
||||
m_confs.clear();
|
||||
}
|
||||
|
||||
ConfDbInfo s_CurInfo;
|
||||
SMCResult DBManager::ReadSMC_NewSection(const SMCStates *states, const char *name)
|
||||
{
|
||||
@@ -167,7 +159,7 @@ SMCResult DBManager::ReadSMC_NewSection(const SMCStates *states, const char *nam
|
||||
}
|
||||
} else if (m_ParseState == DBPARSE_LEVEL_MAIN) {
|
||||
s_CurInfo = ConfDbInfo();
|
||||
s_CurInfo.name = name;
|
||||
s_CurInfo.name = m_StrTab.AddString(name);
|
||||
m_ParseState = DBPARSE_LEVEL_DATABASE;
|
||||
} else if (m_ParseState == DBPARSE_LEVEL_DATABASE) {
|
||||
m_ParseLevel++;
|
||||
@@ -194,16 +186,16 @@ SMCResult DBManager::ReadSMC_KeyValue(const SMCStates *states, const char *key,
|
||||
{
|
||||
if (strcmp(value, "default") != 0)
|
||||
{
|
||||
s_CurInfo.driver = value;
|
||||
s_CurInfo.driver = m_StrTab.AddString(value);
|
||||
}
|
||||
} else if (strcmp(key, "database") == 0) {
|
||||
s_CurInfo.database = value;
|
||||
s_CurInfo.database = m_StrTab.AddString(value);
|
||||
} else if (strcmp(key, "host") == 0) {
|
||||
s_CurInfo.host = value;
|
||||
s_CurInfo.host = m_StrTab.AddString(value);
|
||||
} else if (strcmp(key, "user") == 0) {
|
||||
s_CurInfo.user = value;
|
||||
s_CurInfo.user = m_StrTab.AddString(value);
|
||||
} else if (strcmp(key, "pass") == 0) {
|
||||
s_CurInfo.pass = value;
|
||||
s_CurInfo.pass = m_StrTab.AddString(value);
|
||||
} else if (strcmp(key, "timeout") == 0) {
|
||||
s_CurInfo.info.maxTimeout = atoi(value);
|
||||
} else if (strcmp(key, "port") == 0) {
|
||||
@@ -214,6 +206,13 @@ SMCResult DBManager::ReadSMC_KeyValue(const SMCStates *states, const char *key,
|
||||
return SMCResult_Continue;
|
||||
}
|
||||
|
||||
#define ASSIGN_VAR(var) \
|
||||
if (s_CurInfo.var == -1) { \
|
||||
s_CurInfo.info.var = ""; \
|
||||
} else { \
|
||||
s_CurInfo.info.var = m_StrTab.GetString(s_CurInfo.var); \
|
||||
}
|
||||
|
||||
SMCResult DBManager::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
{
|
||||
if (m_ParseLevel)
|
||||
@@ -224,26 +223,17 @@ SMCResult DBManager::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
|
||||
if (m_ParseState == DBPARSE_LEVEL_DATABASE)
|
||||
{
|
||||
ConfDbInfo *cdb = new ConfDbInfo();
|
||||
|
||||
cdb->name = s_CurInfo.name;
|
||||
cdb->driver = s_CurInfo.driver;
|
||||
cdb->host = s_CurInfo.host;
|
||||
cdb->user = s_CurInfo.user;
|
||||
cdb->pass = s_CurInfo.pass;
|
||||
cdb->database = s_CurInfo.database;
|
||||
cdb->realDriver = s_CurInfo.realDriver;
|
||||
cdb->info.maxTimeout = s_CurInfo.info.maxTimeout;
|
||||
cdb->info.port = s_CurInfo.info.port;
|
||||
|
||||
cdb->info.driver = cdb->driver.c_str();
|
||||
cdb->info.database = cdb->database.c_str();
|
||||
cdb->info.host = cdb->host.c_str();
|
||||
cdb->info.user = cdb->user.c_str();
|
||||
cdb->info.pass = cdb->pass.c_str();
|
||||
/* Set all of the info members to either a blank string
|
||||
* or the string pointer from the string table.
|
||||
*/
|
||||
ASSIGN_VAR(driver);
|
||||
ASSIGN_VAR(database);
|
||||
ASSIGN_VAR(host);
|
||||
ASSIGN_VAR(user);
|
||||
ASSIGN_VAR(pass);
|
||||
|
||||
/* Save it.. */
|
||||
m_confs.push_back(cdb);
|
||||
m_confs.push_back(s_CurInfo);
|
||||
|
||||
/* Go up one level */
|
||||
m_ParseState = DBPARSE_LEVEL_MAIN;
|
||||
@@ -254,6 +244,7 @@ SMCResult DBManager::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
|
||||
return SMCResult_Continue;
|
||||
}
|
||||
#undef ASSIGN_VAR
|
||||
|
||||
void DBManager::ReadSMC_ParseEnd(bool halted, bool failed)
|
||||
{
|
||||
@@ -342,10 +333,10 @@ void DBManager::RemoveDriver(IDBDriver *pDriver)
|
||||
}
|
||||
|
||||
/* Make sure NOTHING references this! */
|
||||
List<ConfDbInfo *>::iterator iter;
|
||||
List<ConfDbInfo>::iterator iter;
|
||||
for (iter=m_confs.begin(); iter!=m_confs.end(); iter++)
|
||||
{
|
||||
ConfDbInfo &db = *(*iter);
|
||||
ConfDbInfo &db = (*iter);
|
||||
if (db.realDriver == pDriver)
|
||||
{
|
||||
db.realDriver = NULL;
|
||||
@@ -457,12 +448,12 @@ const DatabaseInfo *DBManager::FindDatabaseConf(const char *name)
|
||||
|
||||
ConfDbInfo *DBManager::GetDatabaseConf(const char *name)
|
||||
{
|
||||
List<ConfDbInfo *>::iterator iter;
|
||||
List<ConfDbInfo>::iterator iter;
|
||||
|
||||
for (iter=m_confs.begin(); iter!=m_confs.end(); iter++)
|
||||
{
|
||||
ConfDbInfo &conf = *(*iter);
|
||||
if (conf.name == name)
|
||||
ConfDbInfo &conf = (*iter);
|
||||
if (strcmp(m_StrTab.GetString(conf.name), name) == 0)
|
||||
{
|
||||
return &conf;
|
||||
}
|
||||
|
||||
+10
-9
@@ -47,15 +47,16 @@ using namespace SourceHook;
|
||||
|
||||
struct ConfDbInfo
|
||||
{
|
||||
ConfDbInfo() : realDriver(NULL)
|
||||
ConfDbInfo() : name(-1), driver(-1), host(-1), user(-1), pass(-1),
|
||||
database(-1), realDriver(NULL)
|
||||
{
|
||||
}
|
||||
String name;
|
||||
String driver;
|
||||
String host;
|
||||
String user;
|
||||
String pass;
|
||||
String database;
|
||||
int name;
|
||||
int driver;
|
||||
int host;
|
||||
int user;
|
||||
int pass;
|
||||
int database;
|
||||
IDBDriver *realDriver;
|
||||
DatabaseInfo info;
|
||||
};
|
||||
@@ -120,7 +121,6 @@ public:
|
||||
return m_DatabaseType;
|
||||
}
|
||||
private:
|
||||
void ClearConfigs();
|
||||
void KillWorkerThread();
|
||||
private:
|
||||
CVector<IDBDriver *> m_drivers;
|
||||
@@ -134,10 +134,11 @@ private:
|
||||
IMutex *m_pQueueLock; /* Queue safety lock */
|
||||
IMutex *m_pThinkLock; /* Think-queue lock */
|
||||
|
||||
List<ConfDbInfo *> m_confs;
|
||||
List<ConfDbInfo> m_confs;
|
||||
HandleType_t m_DriverType;
|
||||
HandleType_t m_DatabaseType;
|
||||
String m_DefDriver;
|
||||
BaseStringTable m_StrTab;
|
||||
char m_Filename[PLATFORM_MAX_PATH];
|
||||
unsigned int m_ParseLevel;
|
||||
unsigned int m_ParseState;
|
||||
|
||||
@@ -56,16 +56,11 @@ void DebugReport::OnDebugSpew(const char *msg, ...)
|
||||
void DebugReport::GenerateError(IPluginContext *ctx, cell_t func_idx, int err, const char *message, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char buffer[512];
|
||||
|
||||
va_start(ap, message);
|
||||
GenerateErrorVA(ctx, func_idx, err, message, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void DebugReport::GenerateErrorVA(IPluginContext *ctx, cell_t func_idx, int err, const char *message, va_list ap)
|
||||
{
|
||||
char buffer[512];
|
||||
UTIL_FormatArgs(buffer, sizeof(buffer), message, ap);
|
||||
va_end(ap);
|
||||
|
||||
const char *plname = g_PluginSys.FindPluginByContext(ctx->GetContext())->GetFilename();
|
||||
const char *error = g_pSourcePawn2->GetErrorString(err);
|
||||
|
||||
@@ -46,7 +46,6 @@ public: // IDebugListener
|
||||
void OnDebugSpew(const char *msg, ...);
|
||||
public:
|
||||
void GenerateError(IPluginContext *ctx, cell_t func_idx, int err, const char *message, ...);
|
||||
void GenerateErrorVA(IPluginContext *ctx, cell_t func_idx, int err, const char *message, va_list ap);
|
||||
void GenerateCodeError(IPluginContext *ctx, uint32_t code_addr, int err, const char *message, ...);
|
||||
private:
|
||||
int _GetPluginIndex(IPluginContext *ctx);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -161,13 +161,6 @@ void EventManager::FireGameEvent(IGameEvent *pEvent)
|
||||
Just need to add ourselves as a listener to make our hook on IGameEventManager2::FireEvent work */
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
int EventManager::GetEventDebugID()
|
||||
{
|
||||
return EVENT_DEBUG_ID_INIT;
|
||||
}
|
||||
#endif
|
||||
|
||||
EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunction, EventHookMode mode)
|
||||
{
|
||||
EventHook *pHook;
|
||||
|
||||
+1
-4
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -105,9 +105,6 @@ public: // IPluginsListener
|
||||
void OnPluginUnloaded(IPlugin *plugin);
|
||||
public: // IGameEventListener2
|
||||
void FireGameEvent(IGameEvent *pEvent);
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
int GetEventDebugID();
|
||||
#endif
|
||||
public:
|
||||
/**
|
||||
* Get the 'GameEvent' handle type ID.
|
||||
|
||||
+18
-188
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "sourcemm_api.h"
|
||||
#include "sm_srvcmds.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "PlayerManager.h"
|
||||
|
||||
CExtensionManager g_Extensions;
|
||||
IdentityType_t g_ExtType;
|
||||
@@ -66,30 +65,12 @@ CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filena
|
||||
#define GAMEFIX "2.l4d"
|
||||
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
#define GAMEFIX "2.l4d2"
|
||||
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
|
||||
#define GAMEFIX "2.nd"
|
||||
#elif SOURCE_ENGINE == SE_ALIENSWARM
|
||||
#define GAMEFIX "2.swarm"
|
||||
#elif SOURCE_ENGINE == SE_ORANGEBOX
|
||||
#define GAMEFIX "2.ep2"
|
||||
#elif SOURCE_ENGINE == SE_BLOODYGOODTIME
|
||||
#define GAMEFIX "2.bgt"
|
||||
#elif SOURCE_ENGINE == SE_EYE
|
||||
#define GAMEFIX "2.eye"
|
||||
#elif SOURCE_ENGINE == SE_CSS
|
||||
#define GAMEFIX "2.css"
|
||||
#elif SOURCE_ENGINE == SE_HL2DM
|
||||
#define GAMEFIX "2.hl2dm"
|
||||
#elif SOURCE_ENGINE == SE_DODS
|
||||
#define GAMEFIX "2.dods"
|
||||
#elif SOURCE_ENGINE == SE_TF2
|
||||
#define GAMEFIX "2.tf2"
|
||||
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
||||
#define GAMEFIX "2.ep2v"
|
||||
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||
#define GAMEFIX "2.darkm"
|
||||
#elif SOURCE_ENGINE == SE_PORTAL2
|
||||
#define GAMEFIX "2.portal2"
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#define GAMEFIX "2.csgo"
|
||||
#else
|
||||
#define GAMEFIX "2.ep1"
|
||||
#endif //(SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
@@ -104,12 +85,6 @@ CLocalExtension::CLocalExtension(const char *filename)
|
||||
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
|
||||
/* Special case for new bintools binary */
|
||||
if (strcmp(filename, "bintools.ext") == 0)
|
||||
{
|
||||
goto normal;
|
||||
}
|
||||
|
||||
/* Zeroth, see if there is an engine specific build in the new place. */
|
||||
g_SourceMod.BuildPath(Path_SM,
|
||||
path,
|
||||
@@ -122,31 +97,6 @@ CLocalExtension::CLocalExtension(const char *filename)
|
||||
goto found;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_HL2DM
|
||||
/* COMPAT HACK: One-halfth, if ep2v, see if there is an engine specific build in the new place with old naming */
|
||||
g_SourceMod.BuildPath(Path_SM,
|
||||
path,
|
||||
PLATFORM_MAX_PATH,
|
||||
"extensions/%s.2.ep2v." PLATFORM_LIB_EXT,
|
||||
filename);
|
||||
|
||||
if (g_LibSys.IsPathFile(path))
|
||||
{
|
||||
goto found;
|
||||
}
|
||||
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
|
||||
g_SourceMod.BuildPath(Path_SM,
|
||||
path,
|
||||
PLATFORM_MAX_PATH,
|
||||
"extensions/%s.2.l4d2." PLATFORM_LIB_EXT,
|
||||
filename);
|
||||
|
||||
if (g_LibSys.IsPathFile(path))
|
||||
{
|
||||
goto found;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* First see if there is an engine specific build! */
|
||||
g_SourceMod.BuildPath(Path_SM,
|
||||
path,
|
||||
@@ -157,7 +107,6 @@ CLocalExtension::CLocalExtension(const char *filename)
|
||||
/* Try the "normal" version */
|
||||
if (!g_LibSys.IsPathFile(path))
|
||||
{
|
||||
normal:
|
||||
g_SourceMod.BuildPath(Path_SM,
|
||||
path,
|
||||
PLATFORM_MAX_PATH,
|
||||
@@ -222,28 +171,6 @@ bool CLocalExtension::Load(char *error, size_t maxlength)
|
||||
{
|
||||
bool already;
|
||||
m_PlId = g_pMMPlugins->Load(m_Path.c_str(), g_PLID, already, error, maxlength);
|
||||
|
||||
// Check the plugin didn't refuse load
|
||||
Pl_Status status;
|
||||
|
||||
#ifndef METAMOD_PLAPI_VERSION
|
||||
const char *file;
|
||||
PluginId source;
|
||||
#endif
|
||||
|
||||
if (!m_PlId || (
|
||||
#ifndef METAMOD_PLAPI_VERSION
|
||||
g_pMMPlugins->Query(m_PlId, file, status, source)
|
||||
#else
|
||||
g_pMMPlugins->Query(m_PlId, NULL, &status, NULL)
|
||||
#endif
|
||||
&& status < Pl_Paused))
|
||||
{
|
||||
m_pLib->CloseLibrary();
|
||||
m_pLib = NULL;
|
||||
m_pAPI = NULL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!CExtension::Load(error, maxlength))
|
||||
@@ -410,11 +337,6 @@ const char *CExtension::GetFilename()
|
||||
return m_RealFile.c_str();
|
||||
}
|
||||
|
||||
const char *CExtension::GetPath() const
|
||||
{
|
||||
return m_Path.c_str();
|
||||
}
|
||||
|
||||
IdentityToken_t *CExtension::GetIdentity()
|
||||
{
|
||||
return m_pIdentToken;
|
||||
@@ -623,7 +545,7 @@ void CExtensionManager::TryAutoload()
|
||||
}
|
||||
}
|
||||
|
||||
IExtension *CExtensionManager::LoadAutoExtension(const char *path, bool bErrorOnMissing)
|
||||
IExtension *CExtensionManager::LoadAutoExtension(const char *path)
|
||||
{
|
||||
/* Remove platform extension if it's there. Compat hack. */
|
||||
const char *ext = g_LibSys.GetFileExtension(path);
|
||||
@@ -632,7 +554,7 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path, bool bErrorOn
|
||||
char path2[PLATFORM_MAX_PATH];
|
||||
UTIL_Format(path2, sizeof(path2), "%s", path);
|
||||
path2[strlen(path) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
|
||||
return LoadAutoExtension(path2, bErrorOnMissing);
|
||||
return LoadAutoExtension(path2);
|
||||
}
|
||||
|
||||
IExtension *pAlready;
|
||||
@@ -651,11 +573,7 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path, bool bErrorOn
|
||||
|
||||
if (!p->Load(error, sizeof(error)) || !p->IsLoaded())
|
||||
{
|
||||
if (bErrorOnMissing || g_LibSys.IsPathFile(p->GetPath()))
|
||||
{
|
||||
g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
|
||||
}
|
||||
|
||||
g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
|
||||
p->SetError(error);
|
||||
}
|
||||
|
||||
@@ -836,13 +754,6 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Tell it to unload */
|
||||
if (pExt->IsLoaded())
|
||||
{
|
||||
IExtensionInterface *pAPI = pExt->GetAPI();
|
||||
pAPI->OnExtensionUnload();
|
||||
}
|
||||
|
||||
/* First remove us from internal lists */
|
||||
g_ShareSys.RemoveInterfaces(_pExt);
|
||||
m_Libs.remove(pExt);
|
||||
@@ -866,7 +777,7 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
|
||||
s_iter != pExt->m_Libraries.end();
|
||||
s_iter++)
|
||||
{
|
||||
g_PluginSys.OnLibraryAction((*s_iter).c_str(), LibraryAction_Removed);
|
||||
g_PluginSys.OnLibraryAction((*s_iter).c_str(), false, true);
|
||||
}
|
||||
|
||||
/* Notify and/or unload all dependencies */
|
||||
@@ -937,6 +848,13 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
|
||||
}
|
||||
}
|
||||
|
||||
/* Tell it to unload */
|
||||
if (pExt->IsLoaded())
|
||||
{
|
||||
IExtensionInterface *pAPI = pExt->GetAPI();
|
||||
pAPI->OnExtensionUnload();
|
||||
}
|
||||
|
||||
pExt->Unload();
|
||||
delete pExt;
|
||||
|
||||
@@ -1070,7 +988,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
||||
{
|
||||
if (argcount < 4)
|
||||
{
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm exts info <#>");
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm info <#>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1078,7 +996,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
||||
unsigned int id = atoi(sId);
|
||||
if (id <= 0)
|
||||
{
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm exts info <#>");
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm info <#>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1155,7 +1073,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
||||
{
|
||||
if (argcount < 4)
|
||||
{
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm exts unload <#> [code]");
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm unload <#> [code]");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1322,94 +1240,6 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
||||
g_RootMenu.DrawGenericOption("unload", "Unload an extension");
|
||||
}
|
||||
|
||||
void CExtensionManager::ListExtensionsToClient(CPlayer *player, const CCommand &args)
|
||||
{
|
||||
char buffer[256];
|
||||
int numExtensions = m_Libs.size();
|
||||
edict_t *edict = player->GetEdict();
|
||||
unsigned int id = 0;
|
||||
unsigned int start = 0;
|
||||
|
||||
if (!numExtensions)
|
||||
{
|
||||
ClientConsolePrint(edict, "[SM] No extensions found.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.ArgC() > 2)
|
||||
{
|
||||
start = atoi(args.Arg(2));
|
||||
}
|
||||
|
||||
CExtension *ext;
|
||||
SourceHook::List<CExtension *>::iterator iter;
|
||||
|
||||
for (iter = m_Libs.begin();
|
||||
iter != m_Libs.end();
|
||||
iter++)
|
||||
{
|
||||
ext = (*iter);
|
||||
|
||||
char error[255];
|
||||
if (!ext->IsRunning(error, sizeof(error)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
id++;
|
||||
if (id < start)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (id - start > 10)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
IExtensionInterface *api = ext->GetAPI();
|
||||
|
||||
const char *name = api->GetExtensionName();
|
||||
const char *version = api->GetExtensionVerString();
|
||||
const char *author = api->GetExtensionAuthor();
|
||||
const char *description = api->GetExtensionDescription();
|
||||
|
||||
size_t len = UTIL_Format(buffer, sizeof(buffer), " \"%s\"", name);
|
||||
|
||||
if (version != NULL && IS_STR_FILLED(version))
|
||||
{
|
||||
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " (%s)", version);
|
||||
}
|
||||
|
||||
if (author != NULL && IS_STR_FILLED(author))
|
||||
{
|
||||
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " by %s", author);
|
||||
}
|
||||
|
||||
if (description != NULL && IS_STR_FILLED(description))
|
||||
{
|
||||
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, ": %s", description);
|
||||
}
|
||||
|
||||
|
||||
ClientConsolePrint(edict, "%s", buffer);
|
||||
}
|
||||
|
||||
while (iter != m_Libs.end())
|
||||
{
|
||||
char error[255];
|
||||
if ((*iter)->IsRunning(error, sizeof(error)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (iter != m_Libs.end())
|
||||
{
|
||||
ClientConsolePrint(edict, "To see more, type \"sm exts %d\"", id);
|
||||
}
|
||||
}
|
||||
|
||||
CExtension *CExtensionManager::GetExtensionFromIdent(IdentityToken_t *ptr)
|
||||
{
|
||||
if (ptr->type == g_ExtType)
|
||||
@@ -1432,7 +1262,7 @@ void CExtensionManager::AddLibrary(IExtension *pSource, const char *library)
|
||||
{
|
||||
CExtension *pExt = (CExtension *)pSource;
|
||||
pExt->AddLibrary(library);
|
||||
g_PluginSys.OnLibraryAction(library, LibraryAction_Added);
|
||||
g_PluginSys.OnLibraryAction(library, false, false);
|
||||
}
|
||||
|
||||
bool CExtensionManager::LibraryExists(const char *library)
|
||||
|
||||
+1
-6
@@ -45,8 +45,6 @@
|
||||
#include "PluginSys.h"
|
||||
#include "NativeOwner.h"
|
||||
|
||||
class CPlayer;
|
||||
|
||||
using namespace SourceMod;
|
||||
using namespace SourceHook;
|
||||
|
||||
@@ -68,7 +66,6 @@ public:
|
||||
public: //IExtension
|
||||
IExtensionInterface *GetAPI();
|
||||
const char *GetFilename();
|
||||
const char *GetPath() const;
|
||||
IdentityToken_t *GetIdentity();
|
||||
ITERATOR *FindFirstDependency(IExtension **pOwner, SMInterface **pInterface);
|
||||
bool FindNextDependency(ITERATOR *iter, IExtension **pOwner, SMInterface **pInterface);
|
||||
@@ -166,7 +163,7 @@ public: //IPluginsListener
|
||||
public: //IRootConsoleCommand
|
||||
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
|
||||
public:
|
||||
IExtension *LoadAutoExtension(const char *path, bool bErrorOnMissing=true);
|
||||
IExtension *LoadAutoExtension(const char *path);
|
||||
void BindDependency(IExtension *pOwner, IfaceInfo *pInfo);
|
||||
void AddInterface(IExtension *pOwner, SMInterface *pInterface);
|
||||
void BindChildPlugin(IExtension *pParent, CPlugin *pPlugin);
|
||||
@@ -177,8 +174,6 @@ public:
|
||||
bool LibraryExists(const char *library);
|
||||
void CallOnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax);
|
||||
void AddRawDependency(IExtension *ext, IdentityToken_t *other, void *iface);
|
||||
public:
|
||||
void ListExtensionsToClient(CPlayer *player, const CCommand &args);
|
||||
public:
|
||||
CExtension *GetExtensionFromIdent(IdentityToken_t *ptr);
|
||||
void Shutdown();
|
||||
|
||||
@@ -193,7 +193,6 @@ void CForwardManager::ForwardFree(CForward *fwd)
|
||||
|
||||
m_FreeForwards.push(fwd);
|
||||
m_managed.remove(fwd);
|
||||
m_unmanaged.remove(fwd);
|
||||
}
|
||||
|
||||
CForward *CForwardManager::ForwardMake()
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -25,27 +25,31 @@
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "GameConfigs.h"
|
||||
//#include "sm_stringutil.h"
|
||||
//#include "sourcemod.h"
|
||||
//#include "sourcemm_api.h"
|
||||
//#include "HalfLife2.h"
|
||||
//#include "Logger.h"
|
||||
//#include "ShareSys.h"
|
||||
//#include "MemoryUtils.h"
|
||||
//#include "LibrarySys.h"
|
||||
//#include "HandleSys.h"
|
||||
//#include "sm_crc32.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "sourcemod.h"
|
||||
#include "sourcemm_api.h"
|
||||
#include "HalfLife2.h"
|
||||
#include "Logger.h"
|
||||
#include "ShareSys.h"
|
||||
#include "MemoryUtils.h"
|
||||
#include "LibrarySys.h"
|
||||
#include "HandleSys.h"
|
||||
#include "sm_crc32.h"
|
||||
|
||||
//#if defined PLATFORM_LINUX
|
||||
//#include <dlfcn.h>
|
||||
//#endif
|
||||
#if defined PLATFORM_LINUX
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
GameConfigManager g_GameConfigs;
|
||||
IGameConfig *g_pGameConf = NULL;
|
||||
static char g_Game[256];
|
||||
static char g_GameDesc[256] = {'!', '\0'};
|
||||
static char g_GameName[256] = {'$', '\0'};
|
||||
|
||||
#define PSTATE_NONE 0
|
||||
#define PSTATE_GAMES 1
|
||||
@@ -60,42 +64,76 @@
|
||||
#define PSTATE_GAMEDEFS_CRC_BINARY 10
|
||||
#define PSTATE_GAMEDEFS_CUSTOM 11
|
||||
|
||||
#define WIN 0
|
||||
#define LIN 1
|
||||
|
||||
#if defined PLATFORM_WINDOWS
|
||||
#define PLATFORM_NAME "windows"
|
||||
#define PLATFORM_SERVER_BINARY "server.dll"
|
||||
#elif defined PLATFORM_LINUX
|
||||
#define PLATFORM_NAME "linux"
|
||||
#define PLATFORM_SERVER_BINARY "server_i486.so"
|
||||
#elif defined PLATFORM_APPLE
|
||||
#define PLATFORM_NAME "undef"
|
||||
#define PLATFORM_SERVER_BINARY "undef.dylib"
|
||||
#endif
|
||||
|
||||
Offset *tempOffset;
|
||||
Sig *tempSig;
|
||||
|
||||
struct TempSigInfo
|
||||
{
|
||||
void Reset()
|
||||
{
|
||||
library[0] = '\0';
|
||||
sig[0] = '\0';
|
||||
}
|
||||
char sig[512];
|
||||
char library[64];
|
||||
} s_TempSig;
|
||||
unsigned int s_ServerBinCRC;
|
||||
bool s_ServerBinCRC_Ok = false;
|
||||
|
||||
bool /*CGameConfig::*/DoesGameMatch(const char *value)
|
||||
static bool DoesGameMatch(const char *value)
|
||||
{
|
||||
if (strcmp(value, /*m_gdcG*/game) == 0)
|
||||
#if defined PLATFORM_WINDOWS
|
||||
if (strcasecmp(value, g_Game) == 0 ||
|
||||
#else
|
||||
if (strcmp(value, g_Game) == 0 ||
|
||||
#endif
|
||||
strcmp(value, g_GameDesc) == 0 ||
|
||||
strcmp(value, g_GameName) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool /*CGameConfig::*/DoesEngineMatch(const char *value)
|
||||
static bool DoesEngineMatch(const char *value)
|
||||
{
|
||||
if (strcmp(value, /*m_gdcE*/engine) == 0)
|
||||
#if SOURCE_ENGINE == SE_EPISODEONE
|
||||
if (strcmp(value, "original") == 0)
|
||||
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||
if (strcmp(value, "darkmessiah") == 0)
|
||||
#elif SOURCE_ENGINE == SE_ORANGEBOX
|
||||
if (strcmp(value, "orangebox") == 0)
|
||||
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
||||
if (strcmp(value, "orangebox_valve") == 0)
|
||||
#elif SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
if (strcmp(value, "left4dead") == 0)
|
||||
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
if (strcmp(value, "left4dead2") == 0)
|
||||
#else
|
||||
#error "Unknown engine type"
|
||||
#endif
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CGameConfig::CGameConfig()//const char *file)//, const char *game, const char *engine)
|
||||
CGameConfig::CGameConfig(const char *file)
|
||||
{
|
||||
// strncopy(m_File, file, sizeof(m_File));
|
||||
// strncopy(m_gdcGame, game, sizeof(m_gdcGame));
|
||||
// strncopy(m_gdcEngine, engine, sizeof(m_gdcEngine));
|
||||
//m_pStrings = new BaseStringTable(512);
|
||||
strncopy(m_File, file, sizeof(m_File));
|
||||
m_pOffsets = sm_trie_create();
|
||||
m_pProps = sm_trie_create();
|
||||
m_pKeys = sm_trie_create();
|
||||
m_pSigs = sm_trie_create();
|
||||
m_pStrings = new BaseStringTable(512);
|
||||
m_RefCount = 0;
|
||||
|
||||
m_CustomLevel = 0;
|
||||
@@ -104,7 +142,11 @@ CGameConfig::CGameConfig()//const char *file)//, const char *game, const char *e
|
||||
|
||||
CGameConfig::~CGameConfig()
|
||||
{
|
||||
// delete m_pStrings;
|
||||
sm_trie_destroy(m_pOffsets);
|
||||
sm_trie_destroy(m_pProps);
|
||||
sm_trie_destroy(m_pKeys);
|
||||
sm_trie_destroy(m_pSigs);
|
||||
delete m_pStrings;
|
||||
}
|
||||
|
||||
SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *name)
|
||||
@@ -167,14 +209,11 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
||||
}
|
||||
else if (strcmp(name, "CRC") == 0)
|
||||
{
|
||||
#if 0
|
||||
m_ParseState = PSTATE_GAMEDEFS_CRC;
|
||||
bShouldBeReadingDefault = false;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
ITextListener_SMC **pListen = g_GameConfigs.m_customHandlers.retrieve(name);
|
||||
|
||||
if (pListen != NULL)
|
||||
@@ -185,7 +224,8 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
||||
m_CustomHandler->ReadSMC_ParseStart();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_IgnoreLevel++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -193,19 +233,17 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
||||
{
|
||||
m_Prop[0] = '\0';
|
||||
m_Class[0] = '\0';
|
||||
tempOffset = new Offset();
|
||||
tempOffset->setName(name);
|
||||
strncopy(m_offset, name, sizeof(m_offset));
|
||||
m_ParseState = PSTATE_GAMEDEFS_OFFSETS_OFFSET;
|
||||
break;
|
||||
}
|
||||
case PSTATE_GAMEDEFS_SIGNATURES:
|
||||
{
|
||||
tempSig = new Sig();
|
||||
tempSig->setName(name);
|
||||
strncopy(m_offset, name, sizeof(m_offset));
|
||||
s_TempSig.Reset();
|
||||
m_ParseState = PSTATE_GAMEDEFS_SIGNATURES_SIG;
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
case PSTATE_GAMEDEFS_CRC:
|
||||
{
|
||||
char error[255];
|
||||
@@ -255,7 +293,6 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
||||
return m_CustomHandler->ReadSMC_NewSection(states, name);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
/* No sub-sections allowed:
|
||||
case PSTATE_GAMEDEFS_OFFSETS_OFFSET:
|
||||
case PSTATE_GAMEDEFS_KEYS:
|
||||
@@ -288,17 +325,13 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
|
||||
strncopy(m_Class, value, sizeof(m_Class));
|
||||
} else if (strcmp(key, "prop") == 0) {
|
||||
strncopy(m_Prop, value, sizeof(m_Prop));
|
||||
} else /*if (strcmp(key, PLATFORM_NAME) == 0) */ {
|
||||
} else if (strcmp(key, PLATFORM_NAME) == 0) {
|
||||
int val = atoi(value);
|
||||
// sm_trie_replace(m_pOffsets, m_offset, (void *)val);
|
||||
if (strcmp(key, "windows") == 0) tempOffset->setWin(val);
|
||||
else if (strcmp(key, "linux") == 0) tempOffset->setLin(val);
|
||||
sm_trie_replace(m_pOffsets, m_offset, (void *)val);
|
||||
}
|
||||
} else if (m_ParseState == PSTATE_GAMEDEFS_KEYS) {
|
||||
m_Keys[key] = value;
|
||||
// printf("Inserting %s - %s\n", key, value);
|
||||
// int id = m_pStrings->AddString(value);
|
||||
// sm_trie_replace(m_pKeys, key, (void *)id);
|
||||
int id = m_pStrings->AddString(value);
|
||||
sm_trie_replace(m_pKeys, key, (void *)id);
|
||||
} else if (m_ParseState == PSTATE_GAMEDEFS_SUPPORTED) {
|
||||
if (strcmp(key, "game") == 0)
|
||||
{
|
||||
@@ -325,9 +358,12 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
|
||||
}
|
||||
}
|
||||
} else if (m_ParseState == PSTATE_GAMEDEFS_SIGNATURES_SIG) {
|
||||
if (strcmp(key, "windows") == 0) tempSig->setWin(value);
|
||||
else if (strcmp(key, "linux") == 0) tempSig->setLin(value);
|
||||
else if (strcmp(key, "library") == 0) tempSig->setLib(value);
|
||||
if (strcmp(key, PLATFORM_NAME) == 0)
|
||||
{
|
||||
strncopy(s_TempSig.sig, value, sizeof(s_TempSig.sig));
|
||||
} else if (strcmp(key, "library") == 0) {
|
||||
strncopy(s_TempSig.library, value, sizeof(s_TempSig.library));
|
||||
}
|
||||
} else if (m_ParseState == PSTATE_GAMEDEFS_CRC_BINARY) {
|
||||
if (strcmp(key, PLATFORM_NAME) == 0
|
||||
&& s_ServerBinCRC_Ok
|
||||
@@ -388,8 +424,6 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
}
|
||||
case PSTATE_GAMEDEFS_OFFSETS_OFFSET:
|
||||
{
|
||||
m_Offsets.push_back(*tempOffset);
|
||||
#if 0
|
||||
/* Parse the offset... */
|
||||
if (m_Class[0] != '\0'
|
||||
&& m_Prop[0] != '\0')
|
||||
@@ -413,7 +447,6 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
m_ParseState = PSTATE_GAMEDEFS_OFFSETS;
|
||||
break;
|
||||
}
|
||||
@@ -442,8 +475,6 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
}
|
||||
case PSTATE_GAMEDEFS_SIGNATURES_SIG:
|
||||
{
|
||||
m_Sigs.push_back(*tempSig);
|
||||
#if 0
|
||||
if (s_TempSig.library[0] == '\0')
|
||||
{
|
||||
/* assume server */
|
||||
@@ -473,7 +504,11 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
void *handle = dlopen(info.dli_fname, RTLD_NOW);
|
||||
if (handle)
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_ORANGEBOXVALVE) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
final_addr = g_MemUtils.ResolveSymbol(handle, &s_TempSig.sig[1]);
|
||||
#else
|
||||
final_addr = dlsym(handle, &s_TempSig.sig[1]);
|
||||
#endif
|
||||
dlclose(handle);
|
||||
} else {
|
||||
g_Logger.LogError("[SM] Unable to load library \"%s\" (gameconf \"%s\")",
|
||||
@@ -492,45 +527,18 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
}
|
||||
#endif
|
||||
/* First, preprocess the signature */
|
||||
char real_sig[511];
|
||||
unsigned char real_sig[511];
|
||||
size_t real_bytes;
|
||||
size_t length;
|
||||
|
||||
real_bytes = 0;
|
||||
length = strlen(s_TempSig.sig);
|
||||
|
||||
for (size_t i=0; i<length; i++)
|
||||
{
|
||||
if (real_bytes >= sizeof(real_sig))
|
||||
{
|
||||
break;
|
||||
}
|
||||
real_sig[real_bytes++] = s_TempSig.sig[i];
|
||||
if (s_TempSig.sig[i] == '\\'
|
||||
&& s_TempSig.sig[i+1] == 'x')
|
||||
{
|
||||
if (i + 3 >= length)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
/* Get the hex part */
|
||||
char s_byte[3];
|
||||
int r_byte;
|
||||
s_byte[0] = s_TempSig.sig[i+2];
|
||||
s_byte[1] = s_TempSig.sig[i+3];
|
||||
s_byte[2] = '\0';
|
||||
/* Read it as an integer */
|
||||
sscanf(s_byte, "%x", &r_byte);
|
||||
/* Save the value */
|
||||
real_sig[real_bytes-1] = r_byte;
|
||||
/* Adjust index */
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
real_bytes = UTIL_DecodeHexString(real_sig, sizeof(real_sig), s_TempSig.sig);
|
||||
|
||||
if (real_bytes >= 1)
|
||||
{
|
||||
final_addr = g_MemUtils.FindPattern(addrInBase, real_sig, real_bytes);
|
||||
final_addr = g_MemUtils.FindPattern(addrInBase, (char*)real_sig, real_bytes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -538,7 +546,6 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
skip_find:
|
||||
#endif
|
||||
sm_trie_replace(m_pSigs, m_offset, final_addr);
|
||||
#endif
|
||||
m_ParseState = PSTATE_GAMEDEFS_SIGNATURES;
|
||||
|
||||
break;
|
||||
@@ -663,7 +670,7 @@ public:
|
||||
return SMCResult_Continue;
|
||||
}
|
||||
public:
|
||||
list<char*> *fileList;
|
||||
List<String> *fileList;
|
||||
unsigned int state;
|
||||
unsigned int ignoreLevel;
|
||||
char cur_file[PLATFORM_MAX_PATH];
|
||||
@@ -678,21 +685,26 @@ static MasterReader master_reader;
|
||||
bool CGameConfig::Reparse(char *error, size_t maxlength)
|
||||
{
|
||||
/* Reset cached data */
|
||||
// m_pStrings->Reset();
|
||||
m_Offsets.clear();
|
||||
m_Sigs.clear();
|
||||
|
||||
m_pStrings->Reset();
|
||||
sm_trie_clear(m_pOffsets);
|
||||
sm_trie_clear(m_pProps);
|
||||
sm_trie_clear(m_pKeys);
|
||||
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
|
||||
/* See if we can use the extended gamedata format. */
|
||||
//TODO pass in path to gamedata somehow
|
||||
// g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "gamedata/%s/master.games.txt", m_File);
|
||||
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "gamedata/%s/master.games.txt", m_File);
|
||||
if (!g_LibSys.PathExists(path))
|
||||
{
|
||||
/* Nope, use the old mechanism. */
|
||||
UTIL_Format(path, sizeof(path), "%s.txt", m_File);
|
||||
return EnterFile(path, error, maxlength);
|
||||
}
|
||||
|
||||
/* Otherwise, it's time to parse the master. */
|
||||
SMCError err;
|
||||
SMCStates state = {0, 0};
|
||||
list<char*> fileList;
|
||||
List<String> fileList;
|
||||
master_reader.fileList = &fileList;
|
||||
|
||||
err = textparsers->ParseSMCFile(path, &master_reader, &state, error, maxlength);
|
||||
@@ -700,26 +712,64 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
|
||||
{
|
||||
const char *msg = textparsers->GetSMCErrorString(err);
|
||||
|
||||
printf("[SM] Error parsing master gameconf file \"%s\":", path);
|
||||
printf("[SM] Error %d on line %d, col %d: %s",
|
||||
g_Logger.LogError("[SM] Error parsing master gameconf file \"%s\":", path);
|
||||
g_Logger.LogError("[SM] Error %d on line %d, col %d: %s",
|
||||
err,
|
||||
state.line,
|
||||
state.col,
|
||||
msg ? msg : "Unknown error");
|
||||
exit(PARSE_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Go through each file we found and parse it. */
|
||||
list<char*>::iterator iter;
|
||||
List<String>::iterator iter;
|
||||
for (iter = fileList.begin(); iter != fileList.end(); iter++)
|
||||
{
|
||||
UTIL_Format(path, sizeof(path), "%s/%s", m_File, *iter);
|
||||
UTIL_Format(path, sizeof(path), "%s/%s", m_File, (*iter).c_str());
|
||||
if (!EnterFile(path, error, maxlength))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the contents of the 'custom' directory */
|
||||
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "gamedata/%s/custom", m_File);
|
||||
IDirectory *customDir = g_LibSys.OpenDirectory(path);
|
||||
|
||||
if (!customDir)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
while (customDir->MoreFiles())
|
||||
{
|
||||
if (!customDir->IsEntryFile())
|
||||
{
|
||||
customDir->NextEntry();
|
||||
continue;
|
||||
}
|
||||
|
||||
const char *curFile = customDir->GetEntryName();
|
||||
|
||||
/* Only allow .txt files */
|
||||
int len = strlen(curFile);
|
||||
if (len > 4 && strcmp(&curFile[len-4], ".txt") != 0)
|
||||
{
|
||||
customDir->NextEntry();
|
||||
continue;
|
||||
}
|
||||
|
||||
UTIL_Format(path, sizeof(path), "%s/custom/%s", m_File, curFile);
|
||||
if (!EnterFile(path, error, maxlength))
|
||||
{
|
||||
g_LibSys.CloseDirectory(customDir);
|
||||
return false;
|
||||
}
|
||||
|
||||
customDir->NextEntry();
|
||||
}
|
||||
|
||||
g_LibSys.CloseDirectory(customDir);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -728,20 +778,22 @@ bool CGameConfig::EnterFile(const char *file, char *error, size_t maxlength)
|
||||
SMCError err;
|
||||
SMCStates state = {0, 0};
|
||||
|
||||
g_SourceMod.BuildPath(Path_SM, m_CurFile, sizeof(m_CurFile), "gamedata/%s", file);
|
||||
|
||||
/* Initialize parse states */
|
||||
m_IgnoreLevel = 0;
|
||||
bShouldBeReadingDefault = true;
|
||||
m_ParseState = PSTATE_NONE;
|
||||
|
||||
if ((err=textparsers->ParseSMCFile(file, this, &state, error, maxlength))
|
||||
if ((err=textparsers->ParseSMCFile(m_CurFile, this, &state, error, maxlength))
|
||||
!= SMCError_Okay)
|
||||
{
|
||||
const char *msg;
|
||||
|
||||
msg = textparsers->GetSMCErrorString(err);
|
||||
|
||||
printf("[SM] Error parsing gameconfig file \"%s\":\n", file);
|
||||
printf("[SM] Error %d on line %d, col %d: %s\n",
|
||||
g_Logger.LogError("[SM] Error parsing gameconfig file \"%s\":", m_CurFile);
|
||||
g_Logger.LogError("[SM] Error %d on line %d, col %d: %s",
|
||||
err,
|
||||
state.line,
|
||||
state.col,
|
||||
@@ -755,13 +807,12 @@ bool CGameConfig::EnterFile(const char *file, char *error, size_t maxlength)
|
||||
m_CustomLevel = 0;
|
||||
}
|
||||
|
||||
exit(PARSE_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool CGameConfig::GetOffset(const char *key, int *value)
|
||||
{
|
||||
void *obj;
|
||||
@@ -813,16 +864,149 @@ unsigned int CGameConfig::DecRefCount()
|
||||
m_RefCount--;
|
||||
return m_RefCount;
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *CGameConfig::GetKeyValue(const char *key)
|
||||
GameConfigManager::GameConfigManager()
|
||||
{
|
||||
map<const char*,const char*,cmp_str>::iterator it = m_Keys.find(key);
|
||||
if (it == m_Keys.end()) return NULL;
|
||||
|
||||
return it->second;
|
||||
m_pLookup = sm_trie_create();
|
||||
}
|
||||
|
||||
list<Offset> CGameConfig::GetOffsets() { return m_Offsets; }
|
||||
list<Sig> CGameConfig::GetSigs() { return m_Sigs; }
|
||||
GameConfigManager::~GameConfigManager()
|
||||
{
|
||||
sm_trie_destroy(m_pLookup);
|
||||
}
|
||||
|
||||
void GameConfigManager::OnSourceModStartup(bool late)
|
||||
{
|
||||
LoadGameConfigFile("core.games", &g_pGameConf, NULL, 0);
|
||||
|
||||
strncopy(g_Game, g_SourceMod.GetGameFolderName(), sizeof(g_Game));
|
||||
strncopy(g_GameDesc + 1, SERVER_CALL(GetGameDescription)(), sizeof(g_GameDesc) - 1);
|
||||
|
||||
KeyValues *pGameInfo = new KeyValues("GameInfo");
|
||||
if (g_HL2.KVLoadFromFile(pGameInfo, basefilesystem, "gameinfo.txt"))
|
||||
{
|
||||
const char *str;
|
||||
if ((str = pGameInfo->GetString("game", NULL)) != NULL)
|
||||
{
|
||||
strncopy(g_GameName + 1, str, sizeof(g_GameName) - 1);
|
||||
}
|
||||
}
|
||||
pGameInfo->deleteThis();
|
||||
}
|
||||
|
||||
void GameConfigManager::OnSourceModAllInitialized()
|
||||
{
|
||||
/* NOW initialize the game file */
|
||||
CGameConfig *pGameConf = (CGameConfig *)g_pGameConf;
|
||||
|
||||
char error[255];
|
||||
if (!pGameConf->Reparse(error, sizeof(error)))
|
||||
{
|
||||
/* :TODO: log */
|
||||
}
|
||||
|
||||
g_ShareSys.AddInterface(NULL, this);
|
||||
}
|
||||
|
||||
void GameConfigManager::OnSourceModAllShutdown()
|
||||
{
|
||||
CloseGameConfigFile(g_pGameConf);
|
||||
}
|
||||
|
||||
bool GameConfigManager::LoadGameConfigFile(const char *file, IGameConfig **_pConfig, char *error, size_t maxlength)
|
||||
{
|
||||
#if 0
|
||||
/* A crash was detected during last load - We block the gamedata loading so it hopefully won't happen again */
|
||||
if (g_blockGameDataLoad)
|
||||
{
|
||||
UTIL_Format(error, maxlength, "GameData loaded blocked due to detected crash");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
CGameConfig *pConfig;
|
||||
|
||||
if (sm_trie_retrieve(m_pLookup, file, (void **)&pConfig))
|
||||
{
|
||||
pConfig->IncRefCount();
|
||||
*_pConfig = pConfig;
|
||||
return true;
|
||||
}
|
||||
|
||||
pConfig = new CGameConfig(file);
|
||||
|
||||
/* :HACKHACK: Don't parse the main config file */
|
||||
bool retval = true;
|
||||
if (_pConfig != &g_pGameConf)
|
||||
{
|
||||
retval = pConfig->Reparse(error, maxlength);
|
||||
}
|
||||
|
||||
m_cfgs.push_back(pConfig);
|
||||
sm_trie_insert(m_pLookup, file, pConfig);
|
||||
|
||||
pConfig->IncRefCount();
|
||||
|
||||
*_pConfig = pConfig;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
void GameConfigManager::CloseGameConfigFile(IGameConfig *cfg)
|
||||
{
|
||||
CGameConfig *pConfig = (CGameConfig *)cfg;
|
||||
|
||||
if (pConfig->DecRefCount() == 0)
|
||||
{
|
||||
sm_trie_delete(m_pLookup, pConfig->m_File);
|
||||
delete pConfig;
|
||||
}
|
||||
}
|
||||
|
||||
extern HandleType_t g_GameConfigsType;
|
||||
|
||||
IGameConfig *GameConfigManager::ReadHandle(Handle_t hndl, IdentityToken_t *ident, HandleError *err)
|
||||
{
|
||||
HandleSecurity sec(ident, g_pCoreIdent);
|
||||
IGameConfig *conf = NULL;
|
||||
HandleError _err = g_HandleSys.ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&conf);
|
||||
|
||||
if (err)
|
||||
{
|
||||
*err = _err;
|
||||
}
|
||||
|
||||
return conf;
|
||||
}
|
||||
|
||||
void GameConfigManager::AddUserConfigHook(const char *sectionname, ITextListener_SMC *listener)
|
||||
{
|
||||
m_customHandlers.insert(sectionname, listener);
|
||||
}
|
||||
|
||||
void GameConfigManager::RemoveUserConfigHook(const char *sectionname, ITextListener_SMC *listener)
|
||||
{
|
||||
ITextListener_SMC **pListener = m_customHandlers.retrieve(sectionname);
|
||||
|
||||
if (pListener == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (*pListener != listener)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_customHandlers.remove(sectionname);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void GameConfigManager::AcquireLock()
|
||||
{
|
||||
}
|
||||
|
||||
void GameConfigManager::ReleaseLock()
|
||||
{
|
||||
}
|
||||
@@ -32,12 +32,13 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_CGAMECONFIGS_H_
|
||||
#define _INCLUDE_SOURCEMOD_CGAMECONFIGS_H_
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <IGameConfigs.h>
|
||||
#include <ITextParsers.h>
|
||||
#include <sh_list.h>
|
||||
#include "sm_trie.h"
|
||||
#include "sm_globals.h"
|
||||
#include "sm_memtable.h"
|
||||
#include <sm_trie_tpl.h>
|
||||
#include "sm_trie_tpl.h"
|
||||
|
||||
using namespace SourceMod;
|
||||
using namespace SourceHook;
|
||||
@@ -50,13 +51,11 @@ class CGameConfig :
|
||||
{
|
||||
friend class GameConfigManager;
|
||||
public:
|
||||
CGameConfig(const char *file, const char *engine = NULL);
|
||||
CGameConfig(const char *file);
|
||||
~CGameConfig();
|
||||
public:
|
||||
bool Reparse(char *error, size_t maxlength);
|
||||
bool EnterFile(const char *file, char *error, size_t maxlength);
|
||||
void SetBaseEngine(const char *engine);
|
||||
void SetParseEngine(const char *engine);
|
||||
public: //ITextListener_SMC
|
||||
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
|
||||
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
|
||||
@@ -66,7 +65,6 @@ public: //IGameConfig
|
||||
bool GetOffset(const char *key, int *value);
|
||||
SendProp *GetSendProp(const char *key);
|
||||
bool GetMemSig(const char *key, void **addr);
|
||||
bool GetAddress(const char *key, void **addr);
|
||||
public:
|
||||
void IncRefCount();
|
||||
unsigned int DecRefCount();
|
||||
@@ -74,10 +72,10 @@ private:
|
||||
BaseStringTable *m_pStrings;
|
||||
char m_File[PLATFORM_MAX_PATH];
|
||||
char m_CurFile[PLATFORM_MAX_PATH];
|
||||
KTrie<int> m_Offsets;
|
||||
KTrie<SendProp *> m_Props;
|
||||
KTrie<int> m_Keys;
|
||||
KTrie<void *> m_Sigs;
|
||||
Trie *m_pOffsets;
|
||||
Trie *m_pProps;
|
||||
Trie *m_pKeys;
|
||||
Trie *m_pSigs;
|
||||
unsigned int m_RefCount;
|
||||
/* Parse states */
|
||||
int m_ParseState;
|
||||
@@ -95,26 +93,6 @@ private:
|
||||
/* Custom Sections */
|
||||
unsigned int m_CustomLevel;
|
||||
ITextListener_SMC *m_CustomHandler;
|
||||
|
||||
/* Support for reading Addresses */
|
||||
struct AddressConf
|
||||
{
|
||||
char signatureName[64];
|
||||
int readCount;
|
||||
int read[8];
|
||||
|
||||
AddressConf(char *sigName, unsigned sigLength, unsigned readCount, int *read);
|
||||
|
||||
AddressConf() {}
|
||||
};
|
||||
|
||||
char m_Address[64];
|
||||
char m_AddressSignature[64];
|
||||
int m_AddressReadCount;
|
||||
int m_AddressRead[8];
|
||||
KTrie<AddressConf> *m_pAddresses;
|
||||
const char *m_pEngine;
|
||||
const char *m_pBaseEngine;
|
||||
};
|
||||
|
||||
class GameConfigManager :
|
||||
@@ -140,7 +118,7 @@ public: //SMGlobalClass
|
||||
void OnSourceModAllShutdown();
|
||||
private:
|
||||
List<CGameConfig *> m_cfgs;
|
||||
KTrie<CGameConfig *> m_Lookup;
|
||||
Trie *m_pLookup;
|
||||
public:
|
||||
KTrie<ITextListener_SMC *> m_customHandlers;
|
||||
};
|
||||
+45
-377
@@ -35,60 +35,16 @@
|
||||
#include "UserMessages.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include <IGameConfigs.h>
|
||||
#include "GameConfigs.h"
|
||||
#include <compat_wrappers.h>
|
||||
#include <Logger.h>
|
||||
#include "LibrarySys.h"
|
||||
#include "logic_bridge.h"
|
||||
#include <tier0/mem.h>
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
#include <cstrike15_usermessages.pb.h>
|
||||
#endif
|
||||
|
||||
|
||||
typedef ICommandLine *(*FakeGetCommandLine)();
|
||||
|
||||
#if defined _WIN32
|
||||
#define TIER0_NAME "tier0.dll"
|
||||
#define VSTDLIB_NAME "vstdlib.dll"
|
||||
#elif defined __APPLE__
|
||||
#define TIER0_NAME "libtier0.dylib"
|
||||
#define VSTDLIB_NAME "libvstdlib.dylib"
|
||||
#elif defined __linux__
|
||||
#if SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
#define TIER0_NAME "libtier0_srv.so"
|
||||
#define VSTDLIB_NAME "libvstdlib_srv.so"
|
||||
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
#define TIER0_NAME "libtier0.so"
|
||||
#define VSTDLIB_NAME "libvstdlib.so"
|
||||
#else
|
||||
#define TIER0_NAME "tier0_i486.so"
|
||||
#define VSTDLIB_NAME "vstdlib_i486.so"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
CHalfLife2 g_HL2;
|
||||
ConVar *sv_lan = NULL;
|
||||
|
||||
static void *g_EntList = NULL;
|
||||
static void **g_pEntInfoList = NULL;
|
||||
static int entInfoOffset = -1;
|
||||
|
||||
static CEntInfo *EntInfoArray()
|
||||
{
|
||||
if (g_EntList != NULL)
|
||||
{
|
||||
return (CEntInfo *)((intp)g_EntList + entInfoOffset);
|
||||
}
|
||||
else if (g_pEntInfoList)
|
||||
{
|
||||
return *(CEntInfo **)g_pEntInfoList;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
namespace SourceHook
|
||||
{
|
||||
template<>
|
||||
@@ -174,132 +130,48 @@ void CHalfLife2::OnSourceModAllInitialized()
|
||||
}
|
||||
|
||||
void CHalfLife2::OnSourceModAllInitialized_Post()
|
||||
{
|
||||
InitLogicalEntData();
|
||||
InitCommandLine();
|
||||
}
|
||||
|
||||
void CHalfLife2::InitLogicalEntData()
|
||||
{
|
||||
char *addr = NULL;
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
int offset;
|
||||
|
||||
/*
|
||||
* gEntList and/or g_pEntityList
|
||||
*
|
||||
* First try to lookup pointer directly for platforms with symbols.
|
||||
* If symbols aren't present (Windows or stripped Linux/Mac),
|
||||
* attempt find via LevelShutdown + offset
|
||||
*/
|
||||
if (g_pGameConf->GetMemSig("gEntList", (void **)&addr))
|
||||
/* gEntList and/or g_pEntityList */
|
||||
if (!g_pGameConf->GetMemSig("LevelShutdown", (void **)&addr))
|
||||
{
|
||||
#if !defined PLATFORM_WINDOWS
|
||||
if (!addr)
|
||||
{
|
||||
// Key exists so notify if lookup fails, but try other method.
|
||||
g_Logger.LogError("Failed lookup of gEntList directly - Reverting to lookup via LevelShutdown");
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
g_EntList = reinterpret_cast<void *>(addr);
|
||||
#if !defined PLATFORM_WINDOWS
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!g_EntList)
|
||||
{
|
||||
if (g_pGameConf->GetMemSig("LevelShutdown", (void **) &addr) && addr)
|
||||
{
|
||||
int offset;
|
||||
if (!g_pGameConf->GetOffset("gEntList", &offset))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
|
||||
g_EntList = *reinterpret_cast<void **>(addr + offset);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// If we have g_EntList from either of the above methods, make sure we can get the offset from it to EntInfo as well
|
||||
if (g_EntList && !g_pGameConf->GetOffset("EntInfo", &entInfoOffset))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (EntInfo) - Reverting to networkable entities only");
|
||||
g_EntList = NULL;
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (LevelShutdown) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
|
||||
// If we don't have g_EntList or have it but don't know where EntInfo is on it, use fallback.
|
||||
if (!g_EntList || entInfoOffset == -1)
|
||||
if (!addr)
|
||||
{
|
||||
g_pGameConf->GetAddress("EntInfosPtr", (void **)&g_pEntInfoList);
|
||||
g_Logger.LogError("Failed lookup of LevelShutdown - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!g_EntList && !g_pEntInfoList)
|
||||
if (!g_pGameConf->GetOffset("gEntList", &offset))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
g_EntList = *reinterpret_cast<void **>(addr + offset);
|
||||
#elif defined PLATFORM_LINUX
|
||||
/* gEntList and/or g_pEntityList */
|
||||
if (!g_pGameConf->GetMemSig("gEntList", (void **)&addr))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
if (!addr)
|
||||
{
|
||||
g_Logger.LogError("Failed lookup of gEntList - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
}
|
||||
g_EntList = reinterpret_cast<void *>(addr);
|
||||
#endif
|
||||
|
||||
void CHalfLife2::InitCommandLine()
|
||||
{
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
char error[256];
|
||||
|
||||
g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "../bin/" TIER0_NAME);
|
||||
|
||||
if (!g_LibSys.IsPathFile(path))
|
||||
if (!g_pGameConf->GetOffset("EntInfo", &entInfoOffset))
|
||||
{
|
||||
g_Logger.LogError("Could not find path for: " TIER0_NAME);
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (EntInfo) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
|
||||
ILibrary *lib = g_LibSys.OpenLibrary(path, error, sizeof(error));
|
||||
m_pGetCommandLine = lib->GetSymbolAddress("CommandLine_Tier0");
|
||||
|
||||
/* '_Tier0' dropped on Alien Swarm version */
|
||||
if (m_pGetCommandLine == NULL)
|
||||
{
|
||||
m_pGetCommandLine = lib->GetSymbolAddress("CommandLine");
|
||||
}
|
||||
|
||||
if (m_pGetCommandLine == NULL)
|
||||
{
|
||||
/* We probably have a Ship engine. */
|
||||
lib->CloseLibrary();
|
||||
g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "../bin/" VSTDLIB_NAME);
|
||||
if (!g_LibSys.IsPathFile(path))
|
||||
{
|
||||
g_Logger.LogError("Could not find path for: " VSTDLIB_NAME);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((lib = g_LibSys.OpenLibrary(path, error, sizeof(error))) == NULL)
|
||||
{
|
||||
g_Logger.LogError("Could not load %s: %s", path, error);
|
||||
return;
|
||||
}
|
||||
|
||||
m_pGetCommandLine = lib->GetSymbolAddress("CommandLine");
|
||||
|
||||
if (m_pGetCommandLine == NULL)
|
||||
{
|
||||
g_Logger.LogError("Could not locate any command line functionality");
|
||||
}
|
||||
|
||||
lib->CloseLibrary();
|
||||
}
|
||||
}
|
||||
|
||||
ICommandLine *CHalfLife2::GetValveCommandLine()
|
||||
{
|
||||
if (!m_pGetCommandLine)
|
||||
return NULL;
|
||||
|
||||
return ((FakeGetCommandLine)((FakeGetCommandLine *)m_pGetCommandLine))();
|
||||
}
|
||||
|
||||
#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11
|
||||
@@ -351,13 +223,8 @@ bool UTIL_FindInSendTable(SendTable *pTable,
|
||||
return false;
|
||||
}
|
||||
|
||||
typedescription_t *UTIL_FindInDataMap(datamap_t *pMap, const char *name, bool *isNested)
|
||||
typedescription_t *UTIL_FindInDataMap(datamap_t *pMap, const char *name)
|
||||
{
|
||||
if (isNested)
|
||||
{
|
||||
*isNested = false;
|
||||
}
|
||||
|
||||
while (pMap)
|
||||
{
|
||||
for (int i=0; i<pMap->dataNumFields; i++)
|
||||
@@ -372,21 +239,10 @@ typedescription_t *UTIL_FindInDataMap(datamap_t *pMap, const char *name, bool *i
|
||||
}
|
||||
if (pMap->dataDesc[i].td)
|
||||
{
|
||||
if (isNested)
|
||||
typedescription_t *_td;
|
||||
if ((_td=UTIL_FindInDataMap(pMap->dataDesc[i].td, name)) != NULL)
|
||||
{
|
||||
*isNested = (UTIL_FindInDataMap(pMap->dataDesc[i].td, name, NULL) != NULL);
|
||||
if (*isNested)
|
||||
{
|
||||
return NULL;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else { // Use the old behaviour, we dont want to spring this on extensions - even if they're doing bad things.
|
||||
typedescription_t *_td;
|
||||
if ((_td=UTIL_FindInDataMap(pMap->dataDesc[i].td, name, NULL)) != NULL)
|
||||
{
|
||||
return _td;
|
||||
}
|
||||
return _td;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -479,11 +335,6 @@ SendProp *CHalfLife2::FindInSendTable(const char *classname, const char *offset)
|
||||
}
|
||||
|
||||
typedescription_t *CHalfLife2::FindInDataMap(datamap_t *pMap, const char *offset)
|
||||
{
|
||||
return this->FindInDataMap(pMap, offset, NULL);
|
||||
}
|
||||
|
||||
typedescription_t *CHalfLife2::FindInDataMap(datamap_t *pMap, const char *offset, bool *isNested)
|
||||
{
|
||||
typedescription_t *td = NULL;
|
||||
DataMapTrie &val = m_Maps[pMap];
|
||||
@@ -494,7 +345,7 @@ typedescription_t *CHalfLife2::FindInDataMap(datamap_t *pMap, const char *offset
|
||||
}
|
||||
if (!sm_trie_retrieve(val.trie, offset, (void **)&td))
|
||||
{
|
||||
if ((td = UTIL_FindInDataMap(pMap, offset, isNested)) != NULL)
|
||||
if ((td = UTIL_FindInDataMap(pMap, offset)) != NULL)
|
||||
{
|
||||
sm_trie_insert(val.trie, offset, td);
|
||||
}
|
||||
@@ -508,11 +359,13 @@ void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
|
||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||
if (g_pSharedChangeInfo != NULL)
|
||||
{
|
||||
#if SOURCE_ENGINE != SE_LEFT4DEAD2
|
||||
if (offset)
|
||||
{
|
||||
pEdict->StateChanged(offset);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
pEdict->StateChanged();
|
||||
}
|
||||
@@ -526,9 +379,7 @@ void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
|
||||
|
||||
bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
|
||||
{
|
||||
#if SOURCE_ENGINE != SE_CSGO
|
||||
bf_write *pBitBuf = NULL;
|
||||
#endif
|
||||
cell_t players[] = {client};
|
||||
|
||||
if (dest == HUD_PRINTTALK)
|
||||
@@ -541,18 +392,7 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
|
||||
char buffer[192];
|
||||
UTIL_Format(buffer, sizeof(buffer), "%s\1\n", msg);
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
CCSUsrMsg_SayText *pMsg;
|
||||
if ((pMsg = (CCSUsrMsg_SayText *)g_UserMsgs.StartProtobufMessage(m_SayTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pMsg->set_ent_idx(0);
|
||||
pMsg->set_text(buffer);
|
||||
pMsg->set_chat(false);
|
||||
#else
|
||||
if ((pBitBuf = g_UserMsgs.StartBitBufMessage(m_SayTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
if ((pBitBuf = g_UserMsgs.StartMessage(m_SayTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -560,7 +400,6 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
|
||||
pBitBuf->WriteByte(0);
|
||||
pBitBuf->WriteString(buffer);
|
||||
pBitBuf->WriteByte(1);
|
||||
#endif
|
||||
|
||||
g_UserMsgs.EndMessage();
|
||||
|
||||
@@ -568,29 +407,13 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
CCSUsrMsg_TextMsg *pMsg;
|
||||
if ((pMsg = (CCSUsrMsg_TextMsg *)g_UserMsgs.StartProtobufMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Client tries to read all 5 'params' and will crash if less
|
||||
pMsg->set_msg_dst(dest);
|
||||
pMsg->add_params(msg);
|
||||
pMsg->add_params("");
|
||||
pMsg->add_params("");
|
||||
pMsg->add_params("");
|
||||
pMsg->add_params("");
|
||||
#else
|
||||
if ((pBitBuf = g_UserMsgs.StartBitBufMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
if ((pBitBuf = g_UserMsgs.StartMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pBitBuf->WriteByte(dest);
|
||||
pBitBuf->WriteString(msg);
|
||||
#endif
|
||||
|
||||
g_UserMsgs.EndMessage();
|
||||
|
||||
@@ -599,20 +422,10 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
|
||||
|
||||
bool CHalfLife2::HintTextMsg(int client, const char *msg)
|
||||
{
|
||||
bf_write *pBitBuf = NULL;
|
||||
cell_t players[] = {client};
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
CCSUsrMsg_HintText *pMsg;
|
||||
if ((pMsg = (CCSUsrMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pMsg->set_text(msg);
|
||||
#else
|
||||
bf_write *pBitBuf = NULL;
|
||||
|
||||
if ((pBitBuf = g_UserMsgs.StartBitBufMessage(m_HinTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
if ((pBitBuf = g_UserMsgs.StartMessage(m_HinTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -623,7 +436,6 @@ bool CHalfLife2::HintTextMsg(int client, const char *msg)
|
||||
pBitBuf->WriteByte(1);
|
||||
}
|
||||
pBitBuf->WriteString(msg);
|
||||
#endif
|
||||
g_UserMsgs.EndMessage();
|
||||
|
||||
return true;
|
||||
@@ -631,18 +443,9 @@ bool CHalfLife2::HintTextMsg(int client, const char *msg)
|
||||
|
||||
bool CHalfLife2::HintTextMsg(cell_t *players, int count, const char *msg)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
CCSUsrMsg_HintText *pMsg;
|
||||
if ((pMsg = (CCSUsrMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, count, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pMsg->set_text(msg);
|
||||
#else
|
||||
bf_write *pBitBuf = NULL;
|
||||
|
||||
if ((pBitBuf = g_UserMsgs.StartBitBufMessage(m_HinTextMsg, players, count, USERMSG_RELIABLE)) == NULL)
|
||||
if ((pBitBuf = g_UserMsgs.StartMessage(m_HinTextMsg, players, count, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -653,8 +456,6 @@ bool CHalfLife2::HintTextMsg(cell_t *players, int count, const char *msg)
|
||||
pBitBuf->WriteByte(1);
|
||||
}
|
||||
pBitBuf->WriteString(msg);
|
||||
#endif
|
||||
|
||||
g_UserMsgs.EndMessage();
|
||||
|
||||
return true;
|
||||
@@ -662,23 +463,15 @@ bool CHalfLife2::HintTextMsg(cell_t *players, int count, const char *msg)
|
||||
|
||||
bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, bool show)
|
||||
{
|
||||
bf_write *pBitBuf = NULL;
|
||||
KeyValues *SubKey = NULL;
|
||||
int count = 0;
|
||||
cell_t players[] = {client};
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
CCSUsrMsg_VGUIMenu *pMsg;
|
||||
if ((pMsg = (CCSUsrMsg_VGUIMenu *)g_UserMsgs.StartProtobufMessage(m_VGUIMenu, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
if ((pBitBuf = g_UserMsgs.StartMessage(m_VGUIMenu, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
bf_write *pBitBuf = NULL;
|
||||
if ((pBitBuf = g_UserMsgs.StartBitBufMessage(m_VGUIMenu, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (data)
|
||||
{
|
||||
@@ -691,18 +484,6 @@ bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, boo
|
||||
SubKey = data->GetFirstSubKey();
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
pMsg->set_name(name);
|
||||
pMsg->set_show(show);
|
||||
|
||||
while (SubKey)
|
||||
{
|
||||
CCSUsrMsg_VGUIMenu_Subkey *key = pMsg->add_subkeys();
|
||||
key->set_name(SubKey->GetName());
|
||||
key->set_str(SubKey->GetString());
|
||||
SubKey = SubKey->GetNextKey();
|
||||
}
|
||||
#else
|
||||
pBitBuf->WriteString(name);
|
||||
pBitBuf->WriteByte((show) ? 1 : 0);
|
||||
pBitBuf->WriteByte(count);
|
||||
@@ -712,8 +493,6 @@ bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, boo
|
||||
pBitBuf->WriteString(SubKey->GetString());
|
||||
SubKey = SubKey->GetNextKey();
|
||||
}
|
||||
#endif
|
||||
|
||||
g_UserMsgs.EndMessage();
|
||||
|
||||
return true;
|
||||
@@ -751,7 +530,6 @@ void CHalfLife2::ProcessFakeCliCmdQueue()
|
||||
}
|
||||
|
||||
m_CmdQueue.pop();
|
||||
m_FreeCmds.push(pFake);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -846,14 +624,6 @@ const char *CHalfLife2::CurrentCommandName()
|
||||
|
||||
void CHalfLife2::AddDelayedKick(int client, int userid, const char *msg)
|
||||
{
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||
if (!pPlayer || !pPlayer->IsConnected() || pPlayer->IsInKickQueue())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pPlayer->MarkAsBeingKicked();
|
||||
|
||||
DelayedKickInfo kick;
|
||||
|
||||
kick.client = client;
|
||||
@@ -958,11 +728,6 @@ cell_t CHalfLife2::EntityToReference(CBaseEntity *pEntity)
|
||||
|
||||
CBaseEntity *CHalfLife2::ReferenceToEntity(cell_t entRef)
|
||||
{
|
||||
if ((unsigned)entRef == INVALID_EHANDLE_INDEX)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CEntInfo *pInfo = NULL;
|
||||
|
||||
if (entRef & (1<<31))
|
||||
@@ -972,7 +737,7 @@ CBaseEntity *CHalfLife2::ReferenceToEntity(cell_t entRef)
|
||||
CBaseHandle hndl(hndlValue);
|
||||
|
||||
pInfo = LookupEntity(hndl.GetEntryIndex());
|
||||
if (!pInfo || pInfo->m_SerialNumber != hndl.GetSerialNumber())
|
||||
if (pInfo->m_SerialNumber != hndl.GetSerialNumber())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -1002,15 +767,7 @@ CBaseEntity *CHalfLife2::ReferenceToEntity(cell_t entRef)
|
||||
*/
|
||||
CEntInfo *CHalfLife2::LookupEntity(int entIndex)
|
||||
{
|
||||
// Make sure that our index is within the bounds of the global ent array
|
||||
if (entIndex < 0 || entIndex >= NUM_ENT_ENTRIES)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CEntInfo *entInfos = EntInfoArray();
|
||||
|
||||
if (!entInfos)
|
||||
if (!g_EntList || entInfoOffset == -1)
|
||||
{
|
||||
/* Attempt to use engine interface instead */
|
||||
static CEntInfo tempInfo;
|
||||
@@ -1037,7 +794,8 @@ CEntInfo *CHalfLife2::LookupEntity(int entIndex)
|
||||
return &tempInfo;
|
||||
}
|
||||
|
||||
return &entInfos[entIndex];
|
||||
CEntInfo *pArray = (CEntInfo *)(((unsigned char *)g_EntList) + entInfoOffset);
|
||||
return &pArray[entIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1098,11 +856,6 @@ cell_t CHalfLife2::EntityToBCompatRef(CBaseEntity *pEntity)
|
||||
IServerUnknown *pUnknown = (IServerUnknown *)pEntity;
|
||||
CBaseHandle hndl = pUnknown->GetRefEHandle();
|
||||
|
||||
if (hndl == INVALID_EHANDLE_INDEX)
|
||||
{
|
||||
return INVALID_EHANDLE_INDEX;
|
||||
}
|
||||
|
||||
if (hndl.GetEntryIndex() >= MAX_EDICTS)
|
||||
{
|
||||
return (hndl.ToInt() | (1<<31));
|
||||
@@ -1135,88 +888,3 @@ void *CHalfLife2::GetGlobalEntityList()
|
||||
{
|
||||
return g_EntList;
|
||||
}
|
||||
|
||||
int CHalfLife2::GetSendPropOffset(SendProp *prop)
|
||||
{
|
||||
return prop->GetOffset();
|
||||
}
|
||||
|
||||
const char *CHalfLife2::GetEntityClassname(edict_t * pEdict)
|
||||
{
|
||||
if (pEdict == NULL || pEdict->IsFree())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IServerUnknown *pUnk = pEdict->GetUnknown();
|
||||
if (pUnk == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CBaseEntity * pEntity = pUnk->GetBaseEntity();
|
||||
|
||||
if (pEntity == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return GetEntityClassname(pEntity);
|
||||
}
|
||||
|
||||
const char *CHalfLife2::GetEntityClassname(CBaseEntity *pEntity)
|
||||
{
|
||||
static int offset = -1;
|
||||
if (offset == -1)
|
||||
{
|
||||
datamap_t *pMap = GetDataMap(pEntity);
|
||||
typedescription_t *pDesc = FindInDataMap(pMap, "m_iClassname");
|
||||
offset = GetTypeDescOffs(pDesc);
|
||||
}
|
||||
|
||||
return *(const char **)(((unsigned char *)pEntity) + offset);
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
static bool ResolveFuzzyMapName(const char *fuzzyName, char *outFullname, int size)
|
||||
{
|
||||
static ConCommand *pHelperCmd = g_pCVar->FindCommand("changelevel");
|
||||
if (!pHelperCmd || !pHelperCmd->CanAutoComplete())
|
||||
return false;
|
||||
|
||||
static size_t helperCmdLen = strlen(pHelperCmd->GetName());
|
||||
|
||||
CUtlVector<CUtlString> results;
|
||||
pHelperCmd->AutoCompleteSuggest(fuzzyName, results);
|
||||
if (results.Count() == 0)
|
||||
return false;
|
||||
|
||||
// Results come back as you'd see in autocomplete. (ie. "changelevel fullmapnamehere"),
|
||||
// so skip ahead to start of map path/name
|
||||
|
||||
// Like the engine, we're only going to deal with the first match.
|
||||
|
||||
strncopy(outFullname, &results[0][helperCmdLen + 1], size);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool CHalfLife2::IsMapValid(const char *map)
|
||||
{
|
||||
if (!map || !map[0])
|
||||
return false;
|
||||
|
||||
bool ret = engine->IsMapValid(map);
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
if (!ret)
|
||||
{
|
||||
static char szFuzzyName[PLATFORM_MAX_PATH];
|
||||
if (ResolveFuzzyMapName(map, szFuzzyName, sizeof(szFuzzyName)))
|
||||
{
|
||||
ret = engine->IsMapValid(szFuzzyName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -44,10 +44,6 @@
|
||||
#include <server_class.h>
|
||||
#include <datamap.h>
|
||||
#include <ihandleentity.h>
|
||||
#include <tier0/icommandline.h>
|
||||
#if SOURCE_ENGINE >= SE_PORTAL2
|
||||
#include <string_t.h>
|
||||
#endif
|
||||
|
||||
class CCommand;
|
||||
|
||||
@@ -91,7 +87,6 @@ struct DelayedKickInfo
|
||||
char buffer[384];
|
||||
};
|
||||
|
||||
// copy from game/shared/entitylist_base.h
|
||||
class CEntInfo
|
||||
{
|
||||
public:
|
||||
@@ -99,10 +94,6 @@ public:
|
||||
int m_SerialNumber;
|
||||
CEntInfo *m_pPrev;
|
||||
CEntInfo *m_pNext;
|
||||
#if SOURCE_ENGINE >= SE_PORTAL2
|
||||
string_t m_iName;
|
||||
string_t m_iClassName;
|
||||
#endif
|
||||
};
|
||||
|
||||
class CHalfLife2 :
|
||||
@@ -123,7 +114,6 @@ public: //IGameHelpers
|
||||
datamap_t *GetDataMap(CBaseEntity *pEntity);
|
||||
ServerClass *FindServerClass(const char *classname);
|
||||
typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset);
|
||||
typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset, bool *isNested);
|
||||
void SetEdictStateChanged(edict_t *pEdict, unsigned short offset);
|
||||
bool TextMsg(int client, int dest, const char *msg);
|
||||
bool HintTextMsg(int client, const char *msg);
|
||||
@@ -145,11 +135,6 @@ public: //IGameHelpers
|
||||
CEntInfo *LookupEntity(int entIndex);
|
||||
cell_t EntityToBCompatRef(CBaseEntity *pEntity);
|
||||
void *GetGlobalEntityList();
|
||||
int GetSendPropOffset(SendProp *prop);
|
||||
ICommandLine *GetValveCommandLine();
|
||||
const char *GetEntityClassname(edict_t *pEdict);
|
||||
const char *GetEntityClassname(CBaseEntity *pEntity);
|
||||
bool IsMapValid(const char *map);
|
||||
public:
|
||||
void AddToFakeCliCmdQueue(int client, int userid, const char *cmd);
|
||||
void ProcessFakeCliCmdQueue();
|
||||
@@ -165,9 +150,6 @@ public:
|
||||
#endif
|
||||
private:
|
||||
DataTableInfo *_FindServerClass(const char *classname);
|
||||
private:
|
||||
void InitLogicalEntData();
|
||||
void InitCommandLine();
|
||||
private:
|
||||
Trie *m_pClasses;
|
||||
List<DataTableInfo *> m_Tables;
|
||||
@@ -180,7 +162,6 @@ private:
|
||||
CStack<DelayedFakeCliCmd *> m_FreeCmds;
|
||||
CStack<CachedCommandInfo> m_CommandStack;
|
||||
Queue<DelayedKickInfo> m_DelayedKicks;
|
||||
void *m_pGetCommandLine;
|
||||
};
|
||||
|
||||
extern CHalfLife2 g_HL2;
|
||||
|
||||
+41
-91
@@ -579,7 +579,6 @@ HandleError HandleSystem::CloneHandle(QHandle *pHandle, unsigned int index, Hand
|
||||
}
|
||||
|
||||
pNewHandle->clone = index;
|
||||
pNewHandle->object = NULL;
|
||||
pHandle->refcount++;
|
||||
|
||||
*newhandle = new_handle;
|
||||
@@ -621,53 +620,8 @@ HandleError HandleSystem::CloneHandle(Handle_t handle, Handle_t *newhandle, Iden
|
||||
return CloneHandle(pHandle, index, newhandle, newOwner);
|
||||
}
|
||||
|
||||
Handle_t HandleSystem::FastCloneHandle(QHandle *pHandle, unsigned int index)
|
||||
{
|
||||
if (pHandle->clone)
|
||||
return FastCloneHandle(&m_Handles[pHandle->clone], pHandle->clone);
|
||||
|
||||
Handle_t hndl;
|
||||
if (CloneHandle(pHandle, index, &hndl, g_pCoreIdent) != HandleError_None)
|
||||
return BAD_HANDLE;
|
||||
|
||||
return hndl;
|
||||
}
|
||||
|
||||
Handle_t HandleSystem::FastCloneHandle(Handle_t hndl)
|
||||
{
|
||||
QHandle *pHandle;
|
||||
unsigned int index;
|
||||
|
||||
GetHandleUnchecked(hndl, pHandle, index);
|
||||
|
||||
return FastCloneHandle(pHandle, index);
|
||||
}
|
||||
|
||||
void HandleSystem::GetHandleUnchecked(Handle_t hndl, QHandle *& pHandle, unsigned int &index)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
unsigned int serial = (hndl >> 16);
|
||||
#endif
|
||||
index = (hndl & HANDLESYS_HANDLE_MASK);
|
||||
|
||||
assert(index != 0 && index <= m_HandleTail && index < HANDLESYS_MAX_HANDLES);
|
||||
|
||||
pHandle = &m_Handles[index];
|
||||
|
||||
assert(pHandle->set && pHandle->set != HandleSet_Freed);
|
||||
assert(pHandle->serial == serial);
|
||||
}
|
||||
|
||||
HandleError HandleSystem::FreeHandle(QHandle *pHandle, unsigned int index)
|
||||
{
|
||||
if (pHandle->is_destroying)
|
||||
{
|
||||
/* Someone tried to free this recursively.
|
||||
* We'll just ignore this safely.
|
||||
*/
|
||||
return HandleError_None;
|
||||
}
|
||||
|
||||
QHandleType *pType = &m_Types[pHandle->type];
|
||||
|
||||
if (pHandle->clone)
|
||||
@@ -682,7 +636,6 @@ HandleError HandleSystem::FreeHandle(QHandle *pHandle, unsigned int index)
|
||||
pMaster = &m_Handles[master];
|
||||
|
||||
/* Release the clone now */
|
||||
pHandle->is_destroying = true;
|
||||
ReleasePrimHandle(index);
|
||||
|
||||
/* Decrement the master's reference count */
|
||||
@@ -691,27 +644,20 @@ HandleError HandleSystem::FreeHandle(QHandle *pHandle, unsigned int index)
|
||||
/* Type should be the same but do this anyway... */
|
||||
pType = &m_Types[pMaster->type];
|
||||
pMaster->is_destroying = true;
|
||||
if (pMaster->object)
|
||||
{
|
||||
pType->dispatch->OnHandleDestroy(pMaster->type, pMaster->object);
|
||||
}
|
||||
pType->dispatch->OnHandleDestroy(pMaster->type, pMaster->object);
|
||||
ReleasePrimHandle(master);
|
||||
}
|
||||
} else if (pHandle->set == HandleSet_Identity) {
|
||||
/* If we're an identity, skip all this stuff!
|
||||
* NOTE: SHARESYS DOES NOT CARE ABOUT THE DESTRUCTOR
|
||||
*/
|
||||
pHandle->is_destroying = true;
|
||||
ReleasePrimHandle(index);
|
||||
} else {
|
||||
/* Decrement, free if necessary */
|
||||
if (--pHandle->refcount == 0)
|
||||
{
|
||||
pHandle->is_destroying = true;
|
||||
if (pHandle->object)
|
||||
{
|
||||
pType->dispatch->OnHandleDestroy(pHandle->type, pHandle->object);
|
||||
}
|
||||
pType->dispatch->OnHandleDestroy(pHandle->type, pHandle->object);
|
||||
ReleasePrimHandle(index);
|
||||
} else {
|
||||
/* We must be cloned, so mark ourselves as freed */
|
||||
@@ -744,6 +690,14 @@ HandleError HandleSystem::FreeHandle(Handle_t handle, const HandleSecurity *pSec
|
||||
return HandleError_Access;
|
||||
}
|
||||
|
||||
if (pHandle->is_destroying)
|
||||
{
|
||||
/* Someone tried to free this recursively.
|
||||
* We'll just ignore this safely.
|
||||
*/
|
||||
return HandleError_None;
|
||||
}
|
||||
|
||||
return FreeHandle(pHandle, index);
|
||||
}
|
||||
|
||||
@@ -802,9 +756,6 @@ void HandleSystem::UnlinkHandleFromOwner(QHandle *pHandle, unsigned int index)
|
||||
assert(pHandle->owner == 0);
|
||||
return;
|
||||
}
|
||||
|
||||
pHandle->owner = NULL;
|
||||
|
||||
/* Note that since 0 is an invalid handle, if any of these links are 0,
|
||||
* the data can still be set.
|
||||
*/
|
||||
@@ -929,9 +880,29 @@ bool HandleSystem::RemoveType(HandleType_t type, IdentityToken_t *ident)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
FreeHandle(pHandle, i);
|
||||
|
||||
if (pHandle->clone)
|
||||
{
|
||||
/* Get parent */
|
||||
QHandle *pOther = &m_Handles[pHandle->clone];
|
||||
if (--pOther->refcount == 0)
|
||||
{
|
||||
/* Free! */
|
||||
dispatch->OnHandleDestroy(type, pOther->object);
|
||||
ReleasePrimHandle(pHandle->clone);
|
||||
}
|
||||
/* Unlink ourselves since we don't have a reference count */
|
||||
ReleasePrimHandle(i);
|
||||
} else {
|
||||
/* If it's not a clone, we still have to check the reference count.
|
||||
* Either way, we'll be destroyed eventually because the handle types do not change.
|
||||
*/
|
||||
if (--pHandle->refcount == 0)
|
||||
{
|
||||
/* Free! */
|
||||
dispatch->OnHandleDestroy(type, pHandle->object);
|
||||
ReleasePrimHandle(i);
|
||||
}
|
||||
}
|
||||
if (pType->opened == 0)
|
||||
{
|
||||
break;
|
||||
@@ -979,17 +950,14 @@ bool HandleSystem::InitAccessDefaults(TypeAccess *pTypeAccess, HandleAccess *pHa
|
||||
return true;
|
||||
}
|
||||
|
||||
#define HANDLE_LOG_VERY_BAD(message, ...) \
|
||||
g_Logger.LogFatal(message, ##__VA_ARGS__); \
|
||||
g_Logger.LogError(message, ##__VA_ARGS__);
|
||||
|
||||
bool HandleSystem::TryAndFreeSomeHandles()
|
||||
{
|
||||
IPluginIterator *pl_iter = g_PluginSys.GetPluginIterator();
|
||||
IPlugin *highest_owner = NULL;
|
||||
unsigned int highest_handle_count = 0;
|
||||
|
||||
/* Search all plugins */
|
||||
for (IPluginIterator *pl_iter = g_PluginSys.GetPluginIterator(); pl_iter->MorePlugins(); pl_iter->NextPlugin())
|
||||
while (pl_iter->MorePlugins())
|
||||
{
|
||||
IPlugin *plugin = pl_iter->GetPlugin();
|
||||
IdentityToken_t *identity = plugin->GetIdentity();
|
||||
@@ -1018,6 +986,8 @@ bool HandleSystem::TryAndFreeSomeHandles()
|
||||
highest_owner = plugin;
|
||||
highest_handle_count = handle_count;
|
||||
}
|
||||
|
||||
pl_iter->NextPlugin();
|
||||
}
|
||||
|
||||
if (highest_owner == NULL || highest_handle_count == 0)
|
||||
@@ -1025,9 +995,9 @@ bool HandleSystem::TryAndFreeSomeHandles()
|
||||
return false;
|
||||
}
|
||||
|
||||
HANDLE_LOG_VERY_BAD("[SM] MEMORY LEAK DETECTED IN PLUGIN (file \"%s\")", highest_owner->GetFilename());
|
||||
HANDLE_LOG_VERY_BAD("[SM] Unloading plugin to free %d handles.", highest_handle_count);
|
||||
HANDLE_LOG_VERY_BAD("[SM] Contact the author(s) of this plugin to correct this error.", highest_handle_count);
|
||||
g_Logger.LogFatal("[SM] MEMORY LEAK DETECTED IN PLUGIN (file \"%s\")", highest_owner->GetFilename());
|
||||
g_Logger.LogFatal("[SM] Unloading plugin to free %d handles.", highest_handle_count);
|
||||
g_Logger.LogFatal("[SM] Contact the author(s) of this plugin to correct this error.", highest_handle_count);
|
||||
|
||||
highest_owner->GetBaseContext()->ThrowNativeErrorEx(SP_ERROR_MEMACCESS, "Memory leak");
|
||||
|
||||
@@ -1084,32 +1054,12 @@ void HandleSystem::Dump(HANDLE_REPORTER rep)
|
||||
const char *type = "ANON";
|
||||
QHandleType *pType = &m_Types[m_Handles[i].type];
|
||||
unsigned int size = 0;
|
||||
unsigned int parentIdx;
|
||||
bool bresult;
|
||||
if (pType->nameIdx != -1)
|
||||
{
|
||||
type = m_strtab->GetString(pType->nameIdx);
|
||||
}
|
||||
|
||||
if ((parentIdx = m_Handles[i].clone) != 0)
|
||||
{
|
||||
if (m_Handles[parentIdx].refcount > 0)
|
||||
{
|
||||
size = 0;
|
||||
bresult = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bresult = pType->dispatch->GetHandleApproxSize(m_Handles[parentIdx].type, m_Handles[parentIdx].object, &size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bresult = pType->dispatch->GetHandleApproxSize(m_Handles[i].type, m_Handles[i].object, &size);
|
||||
}
|
||||
|
||||
if (pType->dispatch->GetDispatchVersion() < HANDLESYS_MEMUSAGE_MIN_VERSION
|
||||
|| !bresult)
|
||||
|| !pType->dispatch->GetHandleApproxSize(m_Handles[i].type, m_Handles[i].object, &size))
|
||||
{
|
||||
rep("0x%08x\t%-20.20s\t%-20.20s\t%-10.10s", index, owner, type, "-1");
|
||||
}
|
||||
|
||||
@@ -160,9 +160,6 @@ public: //IHandleSystem
|
||||
HandleError *err);
|
||||
|
||||
void Dump(HANDLE_REPORTER rep);
|
||||
|
||||
/* Bypasses security checks. */
|
||||
Handle_t FastCloneHandle(Handle_t hndl);
|
||||
protected:
|
||||
/**
|
||||
* Decodes a handle with sanity and security checking.
|
||||
@@ -173,9 +170,6 @@ protected:
|
||||
unsigned int *index,
|
||||
bool ignoreFree=false);
|
||||
|
||||
Handle_t FastCloneHandle(QHandle *pHandle, unsigned int index);
|
||||
void GetHandleUnchecked(Handle_t hndl, QHandle *& pHandle, unsigned int &index);
|
||||
|
||||
/**
|
||||
* Creates a basic handle and sets its reference count to 1.
|
||||
* Does not do any type or security checking.
|
||||
@@ -228,27 +222,4 @@ private:
|
||||
|
||||
extern HandleSystem g_HandleSys;
|
||||
|
||||
struct AutoHandleRooter
|
||||
{
|
||||
public:
|
||||
AutoHandleRooter(Handle_t hndl)
|
||||
{
|
||||
if (hndl != BAD_HANDLE)
|
||||
this->hndl = g_HandleSys.FastCloneHandle(hndl);
|
||||
else
|
||||
this->hndl = BAD_HANDLE;
|
||||
}
|
||||
|
||||
~AutoHandleRooter()
|
||||
{
|
||||
if (hndl != BAD_HANDLE)
|
||||
{
|
||||
HandleSecurity sec(g_pCoreIdent, g_pCoreIdent);
|
||||
g_HandleSys.FreeHandle(hndl, &sec);
|
||||
}
|
||||
}
|
||||
private:
|
||||
Handle_t hndl;
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_HANDLESYSTEM_H_
|
||||
|
||||
+2
-2
@@ -241,7 +241,7 @@ bool LibrarySystem::IsPathDirectory(const char *path)
|
||||
return true;
|
||||
}
|
||||
|
||||
#elif defined PLATFORM_POSIX
|
||||
#elif defined PLATFORM_LINUX
|
||||
struct stat s;
|
||||
|
||||
if (stat(path, &s) != 0)
|
||||
@@ -410,7 +410,7 @@ size_t LibrarySystem::GetFileFromPath(char *buffer, size_t maxlength, const char
|
||||
size_t length = strlen(path);
|
||||
|
||||
for (size_t i = length - 1;
|
||||
i <= length - 1;
|
||||
i >= 0 && i <= length - 1;
|
||||
i--)
|
||||
{
|
||||
if (path[i] == '/'
|
||||
|
||||
+3
-9
@@ -149,7 +149,7 @@ void Logger::_NewMapFile()
|
||||
} else {
|
||||
char date[32];
|
||||
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
|
||||
fprintf(fp, "L %s: SourceMod log file started (file \"L%02d%02d%03d.log\") (Version \"%s\")\n", date, curtime->tm_mon + 1, curtime->tm_mday, i, SOURCEMOD_VERSION);
|
||||
fprintf(fp, "L %s: SourceMod log file started (file \"L%02d%02d%03d.log\") (Version \"%s\")\n", date, curtime->tm_mon + 1, curtime->tm_mday, i, SM_FULL_VERSION);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
@@ -265,8 +265,6 @@ void Logger::LogToOpenFileEx(FILE *fp, const char *msg, va_list ap)
|
||||
return;
|
||||
}
|
||||
|
||||
static ConVar *sv_logecho = icvar->FindVar("sv_logecho");
|
||||
|
||||
char buffer[3072];
|
||||
UTIL_FormatArgs(buffer, sizeof(buffer), msg, ap);
|
||||
|
||||
@@ -277,11 +275,7 @@ void Logger::LogToOpenFileEx(FILE *fp, const char *msg, va_list ap)
|
||||
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
|
||||
|
||||
fprintf(fp, "L %s: %s\n", date, buffer);
|
||||
|
||||
if (!sv_logecho || sv_logecho->GetBool())
|
||||
{
|
||||
g_SMAPI->ConPrintf("L %s: %s\n", date, buffer);
|
||||
}
|
||||
g_SMAPI->ConPrintf("L %s: %s\n", date, buffer);
|
||||
}
|
||||
|
||||
void Logger::LogToFileOnlyEx(FILE *fp, const char *msg, va_list ap)
|
||||
@@ -362,7 +356,7 @@ void Logger::LogMessage(const char *vafmt, ...)
|
||||
char date[32];
|
||||
m_DailyPrintHdr = false;
|
||||
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
|
||||
fprintf(fp, "L %s: SourceMod log file session started (file \"L%04d%02d%02d.log\") (Version \"%s\")\n", date, curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday, SOURCEMOD_VERSION);
|
||||
fprintf(fp, "L %s: SourceMod log file session started (file \"L%04d%02d%02d.log\") (Version \"%s\")\n", date, curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday, SM_FULL_VERSION);
|
||||
}
|
||||
va_list ap;
|
||||
va_start(ap, vafmt);
|
||||
|
||||
+54
-89
@@ -2,32 +2,32 @@
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
SMSDK = ..
|
||||
SRCDS_BASE = ~/srcds
|
||||
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
|
||||
MMSOURCE = ../../mmsource-central
|
||||
MMSOURCE17 = ../../mmsource-central
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
#####################################
|
||||
|
||||
OBJECTS = AdminCache.cpp CDataPack.cpp ConCmdManager.cpp ConVarManager.cpp CoreConfig.cpp \
|
||||
Database.cpp DebugReporter.cpp EventManager.cpp HalfLife2.cpp Logger.cpp \
|
||||
PlayerManager.cpp TimerSys.cpp UserMessages.cpp \
|
||||
sm_autonatives.cpp sm_srvcmds.cpp sm_stringutil.cpp sm_trie.cpp \
|
||||
Database.cpp DebugReporter.cpp EventManager.cpp GameConfigs.cpp HalfLife2.cpp Logger.cpp \
|
||||
MemoryUtils.cpp PlayerManager.cpp TimerSys.cpp Translator.cpp UserMessages.cpp \
|
||||
sm_autonatives.cpp sm_memtable.cpp sm_srvcmds.cpp sm_stringutil.cpp sm_trie.cpp \
|
||||
sourcemm_api.cpp sourcemod.cpp MenuStyle_Base.cpp MenuStyle_Valve.cpp MenuManager.cpp \
|
||||
MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp \
|
||||
frame_hooks.cpp concmd_cleaner.cpp NextMap.cpp \
|
||||
MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp sm_crc32.cpp \
|
||||
frame_hooks.cpp concmd_cleaner.cpp PhraseCollection.cpp NextMap.cpp \
|
||||
NativeOwner.cpp logic_bridge.cpp ConsoleDetours.cpp
|
||||
OBJECTS += smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
|
||||
smn_database.cpp smn_entities.cpp smn_events.cpp \
|
||||
smn_fakenatives.cpp smn_filesystem.cpp smn_halflife.cpp \
|
||||
smn_keyvalues.cpp smn_player.cpp \
|
||||
smn_usermsgs.cpp smn_menus.cpp smn_vector.cpp \
|
||||
OBJECTS += smn_admin.cpp smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
|
||||
smn_datapacks.cpp smn_entities.cpp smn_events.cpp smn_fakenatives.cpp \
|
||||
smn_filesystem.cpp smn_gameconfigs.cpp smn_halflife.cpp \
|
||||
smn_handles.cpp smn_keyvalues.cpp smn_banning.cpp \
|
||||
smn_lang.cpp smn_player.cpp smn_string.cpp smn_timers.cpp \
|
||||
smn_usermsgs.cpp smn_menus.cpp smn_database.cpp smn_vector.cpp \
|
||||
smn_hudtext.cpp smn_nextmap.cpp
|
||||
OBJECTS += ExtensionSys.cpp \
|
||||
ForwardSys.cpp \
|
||||
@@ -49,119 +49,80 @@ CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||
CPP = gcc
|
||||
|
||||
override ENGSET = false
|
||||
|
||||
ifneq (,$(filter original orangebox css orangeboxvalve left4dead left4dead2 csgo,$(ENGINE)))
|
||||
override ENGSET = true
|
||||
endif
|
||||
|
||||
ifeq "$(ENGINE)" "original"
|
||||
HL2SDK = $(HL2SDK_ORIG)
|
||||
HL2PUB = $(HL2SDK)/public
|
||||
HL2LIB = $(HL2SDK)/linux_sdk
|
||||
CFLAGS += -DSOURCE_ENGINE=1
|
||||
METAMOD = $(MMSOURCE)/core-legacy
|
||||
METAMOD = $(MMSOURCE17)/core-legacy
|
||||
INCLUDE += -I$(HL2SDK)/public/dlls
|
||||
SRCDS = $(SRCDS_BASE)
|
||||
BINARY = sourcemod.1.ep1.so
|
||||
override ENGSET = true
|
||||
endif
|
||||
ifeq "$(ENGINE)" "orangebox"
|
||||
HL2SDK = $(HL2SDK_OB)
|
||||
HL2PUB = $(HL2SDK)/public
|
||||
HL2LIB = $(HL2SDK)/lib/linux
|
||||
CFLAGS += -DSOURCE_ENGINE=3
|
||||
METAMOD = $(MMSOURCE)/core
|
||||
METAMOD = $(MMSOURCE17)/core
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||
SRCDS = $(SRCDS_BASE)/orangebox
|
||||
BINARY = sourcemod.2.ep2.so
|
||||
endif
|
||||
ifeq "$(ENGINE)" "css"
|
||||
HL2SDK = $(HL2SDK_CSS)
|
||||
HL2LIB = $(HL2SDK)/lib/linux
|
||||
CFLAGS += -DSOURCE_ENGINE=6
|
||||
METAMOD = $(MMSOURCE)/core
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||
BINARY = sourcemod.2.css.so
|
||||
override ENGSET = true
|
||||
endif
|
||||
ifeq "$(ENGINE)" "orangeboxvalve"
|
||||
HL2SDK = $(HL2SDK_OB_VALVE)
|
||||
HL2PUB = $(HL2SDK)/public
|
||||
HL2LIB = $(HL2SDK)/lib/linux
|
||||
CFLAGS += -DSOURCE_ENGINE=7
|
||||
METAMOD = $(MMSOURCE)/core
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||
CFLAGS += -DSOURCE_ENGINE=4
|
||||
METAMOD = $(MMSOURCE17)/core
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common
|
||||
SRCDS = $(SRCDS_BASE)/orangebox
|
||||
BINARY = sourcemod.2.ep2v.so
|
||||
override ENGSET = true
|
||||
endif
|
||||
ifeq "$(ENGINE)" "left4dead"
|
||||
HL2SDK = $(HL2SDK_L4D)
|
||||
HL2PUB = $(HL2SDK)/public
|
||||
HL2LIB = $(HL2SDK)/lib/linux
|
||||
CFLAGS += -DSOURCE_ENGINE=8
|
||||
METAMOD = $(MMSOURCE)/core
|
||||
CFLAGS += -DSOURCE_ENGINE=5
|
||||
METAMOD = $(MMSOURCE17)/core
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||
SRCDS = $(SRCDS_BASE)/l4d
|
||||
BINARY = sourcemod.2.l4d.so
|
||||
override ENGSET = true
|
||||
endif
|
||||
ifeq "$(ENGINE)" "left4dead2"
|
||||
HL2SDK = $(HL2SDK_L4D2)
|
||||
HL2PUB = $(HL2SDK)/public
|
||||
HL2LIB = $(HL2SDK)/lib/linux
|
||||
CFLAGS += -DSOURCE_ENGINE=9
|
||||
METAMOD = $(MMSOURCE)/core
|
||||
CFLAGS += -DSOURCE_ENGINE=6
|
||||
METAMOD = $(MMSOURCE17)/core
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||
SRCDS = $(SRCDS_BASE)/left4dead2
|
||||
BINARY = sourcemod.2.l4d2.so
|
||||
endif
|
||||
ifeq "$(ENGINE)" "csgo"
|
||||
HL2SDK = $(HL2SDK_CSGO)
|
||||
HL2LIB = $(HL2SDK)/lib/linux
|
||||
CFLAGS += -DSOURCE_ENGINE=12
|
||||
METAMOD = $(MMSOURCE)/core
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||
BINARY = sourcemod.2.csgo.so
|
||||
override ENGSET = true
|
||||
endif
|
||||
|
||||
HL2PUB = $(HL2SDK)/public
|
||||
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 -DSE_LEFT4DEAD=5 -DSE_LEFT4DEAD2=6
|
||||
|
||||
OS := $(shell uname -s)
|
||||
|
||||
ifeq "$(OS)" "Darwin"
|
||||
LIB_EXT = dylib
|
||||
HL2LIB = $(HL2SDK)/lib/mac
|
||||
ifeq "$(ENGINE)" "left4dead2"
|
||||
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a libvstdlib.so \
|
||||
libtier0.so -static-libgcc
|
||||
else
|
||||
LIB_EXT = so
|
||||
ifeq "$(ENGINE)" "original"
|
||||
HL2LIB = $(HL2SDK)/linux_sdk
|
||||
else
|
||||
HL2LIB = $(HL2SDK)/lib/linux
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter original orangebox left4dead,$(ENGINE)))
|
||||
LIB_SUFFIX = _i486.$(LIB_EXT)
|
||||
else
|
||||
LIB_PREFIX = lib
|
||||
ifneq (,$(filter orangeboxvalve css,$(ENGINE)))
|
||||
ifneq "$(OS)" "Darwin"
|
||||
LIB_SUFFIX = _srv.$(LIB_EXT)
|
||||
else
|
||||
LIB_SUFFIX = .$(LIB_EXT)
|
||||
endif
|
||||
else
|
||||
LIB_SUFFIX = .$(LIB_EXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
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
|
||||
|
||||
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a $(LIB_PREFIX)vstdlib$(LIB_SUFFIX) \
|
||||
$(LIB_PREFIX)tier0$(LIB_SUFFIX) -static-libgcc
|
||||
|
||||
ifeq "$(ENGINE)" "csgo"
|
||||
LINK += $(HL2LIB)/interfaces_i486.a
|
||||
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a vstdlib_i486.so \
|
||||
tier0_i486.so -static-libgcc
|
||||
endif
|
||||
|
||||
INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \
|
||||
-I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook \
|
||||
-I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
||||
|
||||
CFLAGS += -D_LINUX -DPOSIX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror \
|
||||
-Wno-uninitialized -Wno-unused -Wno-switch -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H \
|
||||
-DSM_DEFAULT_THREADER -m32 -DCOMPILER_GCC
|
||||
CPPFLAGS += -Wno-non-virtual-dtor -Wno-overloaded-virtual -fno-threadsafe-statics -fno-exceptions -fno-rtti
|
||||
-Wno-uninitialized -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H -DSM_DEFAULT_THREADER -m32
|
||||
CPPFLAGS += -Wno-non-virtual-dtor -fno-exceptions -fno-rtti
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
@@ -192,14 +153,18 @@ $(BIN_DIR)/%.o: %.c
|
||||
|
||||
all: check
|
||||
mkdir -p $(BIN_DIR)
|
||||
ln -sf $(HL2LIB)/$(LIB_PREFIX)vstdlib$(LIB_SUFFIX)
|
||||
ln -sf $(HL2LIB)/$(LIB_PREFIX)tier0$(LIB_SUFFIX)
|
||||
ifeq "$(ENGINE)" "left4dead2"
|
||||
ln -sf $(SRCDS)/bin/libvstdlib.so libvstdlib.so;
|
||||
ln -sf $(SRCDS)/bin/libtier0.so libtier0.so;
|
||||
else
|
||||
ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so;
|
||||
ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so;
|
||||
endif
|
||||
$(MAKE) -f Makefile sourcemod
|
||||
|
||||
check:
|
||||
if [ "$(ENGSET)" = "false" ]; then \
|
||||
echo "You must supply one of the following values for ENGINE:"; \
|
||||
echo "csgo, left4dead2, left4dead, orangeboxvalve, css, orangebox, or original"; \
|
||||
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -28,39 +28,36 @@
|
||||
*/
|
||||
|
||||
#include "MemoryUtils.h"
|
||||
#include "ShareSys.h"
|
||||
#ifdef PLATFORM_LINUX
|
||||
#include <fcntl.h>
|
||||
#include <link.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
#define PAGE_ALIGN_UP(x) ((x + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
|
||||
#endif
|
||||
#ifdef PLATFORM_APPLE
|
||||
#include <mach-o/dyld_images.h>
|
||||
#include <mach-o/loader.h>
|
||||
#include <mach-o/nlist.h>
|
||||
#endif
|
||||
|
||||
//MemoryUtils g_MemUtils;
|
||||
MemoryUtils g_MemUtils;
|
||||
|
||||
#if 0
|
||||
MemoryUtils::MemoryUtils()
|
||||
{
|
||||
#ifdef PLATFORM_APPLE
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
|
||||
/* Get pointer to struct that describes all loaded mach-o images in process */
|
||||
struct nlist list[2];
|
||||
memset(list, 0, sizeof(list));
|
||||
list[0].n_un.n_name = (char *)"_dyld_all_image_infos";
|
||||
nlist("/usr/lib/dyld", list);
|
||||
m_ImageList = (struct dyld_all_image_infos *)list[0].n_value;
|
||||
SYSTEM_INFO info;
|
||||
GetSystemInfo(&info);
|
||||
|
||||
m_PageSize = info.dwPageSize;
|
||||
|
||||
#elif defined PLATFORM_POSIX
|
||||
|
||||
m_PageSize = sysconf(_SC_PAGE_SIZE);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
MemoryUtils::~MemoryUtils()
|
||||
{
|
||||
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
#ifdef PLATFORM_LINUX
|
||||
for (size_t i = 0; i < m_SymTables.size(); i++)
|
||||
{
|
||||
delete m_SymTables[i];
|
||||
@@ -69,10 +66,10 @@ MemoryUtils::~MemoryUtils()
|
||||
#endif
|
||||
}
|
||||
|
||||
/*void MemoryUtils::OnSourceModAllInitialized()
|
||||
void MemoryUtils::OnSourceModAllInitialized()
|
||||
{
|
||||
sharesys->AddInterface(NULL, this);
|
||||
}*/
|
||||
g_ShareSys.AddInterface(NULL, this);
|
||||
}
|
||||
|
||||
void *MemoryUtils::FindPattern(const void *libPtr, const char *pattern, size_t len)
|
||||
{
|
||||
@@ -116,7 +113,7 @@ void *MemoryUtils::ResolveSymbol(void *handle, const char *symbol)
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
|
||||
return GetProcAddress((HMODULE)handle, symbol);
|
||||
|
||||
|
||||
#elif defined PLATFORM_LINUX
|
||||
|
||||
struct link_map *dlmap;
|
||||
@@ -131,14 +128,12 @@ void *MemoryUtils::ResolveSymbol(void *handle, const char *symbol)
|
||||
uint32_t symbol_count;
|
||||
LibSymbolTable *libtable;
|
||||
SymbolTable *table;
|
||||
AddrTable *table2;
|
||||
Symbol *symbol_entry;
|
||||
|
||||
dlmap = (struct link_map *)handle;
|
||||
symtab_hdr = NULL;
|
||||
strtab_hdr = NULL;
|
||||
table = NULL;
|
||||
table2 = NULL;
|
||||
|
||||
/* See if we already have a symbol table for this library */
|
||||
for (size_t i = 0; i < m_SymTables.size(); i++)
|
||||
@@ -147,7 +142,6 @@ void *MemoryUtils::ResolveSymbol(void *handle, const char *symbol)
|
||||
if (libtable->lib_base == dlmap->l_addr)
|
||||
{
|
||||
table = &libtable->table;
|
||||
table2 = &libtable->table2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -157,11 +151,9 @@ void *MemoryUtils::ResolveSymbol(void *handle, const char *symbol)
|
||||
{
|
||||
libtable = new LibSymbolTable();
|
||||
libtable->table.Initialize();
|
||||
libtable->table2.Initialize();
|
||||
libtable->lib_base = dlmap->l_addr;
|
||||
libtable->last_pos = 0;
|
||||
table = &libtable->table;
|
||||
table2 = &libtable->table2;
|
||||
m_SymTables.push_back(libtable);
|
||||
}
|
||||
|
||||
@@ -245,173 +237,23 @@ void *MemoryUtils::ResolveSymbol(void *handle, const char *symbol)
|
||||
|
||||
/* Caching symbols as we go along */
|
||||
cur_sym = table->InternSymbol(sym_name, strlen(sym_name), (void *)(dlmap->l_addr + sym.st_value));
|
||||
table2->InternSymbol(sym_name, strlen(sym_name), (void *)(dlmap->l_addr + sym.st_value));
|
||||
if (strcmp(symbol, sym_name) == 0)
|
||||
{
|
||||
symbol_entry = cur_sym;
|
||||
libtable->last_pos = ++i;
|
||||
// break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
libtable->last_pos = symbol_count;
|
||||
|
||||
munmap(file_hdr, dlstat.st_size);
|
||||
return symbol_entry ? symbol_entry->address : NULL;
|
||||
|
||||
#elif defined PLATFORM_APPLE
|
||||
|
||||
uintptr_t dlbase, linkedit_addr;
|
||||
uint32_t image_count;
|
||||
struct mach_header *file_hdr;
|
||||
struct load_command *loadcmds;
|
||||
struct segment_command *linkedit_hdr;
|
||||
struct symtab_command *symtab_hdr;
|
||||
struct nlist *symtab;
|
||||
const char *strtab;
|
||||
uint32_t loadcmd_count;
|
||||
uint32_t symbol_count;
|
||||
LibSymbolTable *libtable;
|
||||
SymbolTable *table;
|
||||
Symbol *symbol_entry;
|
||||
|
||||
dlbase = 0;
|
||||
image_count = m_ImageList->infoArrayCount;
|
||||
linkedit_hdr = NULL;
|
||||
symtab_hdr = NULL;
|
||||
table = NULL;
|
||||
|
||||
/* Loop through mach-o images in process.
|
||||
* We can skip index 0 since that is just the executable.
|
||||
*/
|
||||
for (uint32_t i = 1; i < image_count; i++)
|
||||
{
|
||||
const struct dyld_image_info &info = m_ImageList->infoArray[i];
|
||||
|
||||
/* "Load" each one until we get a matching handle */
|
||||
void *h = dlopen(info.imageFilePath, RTLD_NOLOAD);
|
||||
if (h == handle)
|
||||
{
|
||||
dlbase = (uintptr_t)info.imageLoadAddress;
|
||||
dlclose(h);
|
||||
break;
|
||||
}
|
||||
|
||||
dlclose(h);
|
||||
}
|
||||
|
||||
if (!dlbase)
|
||||
{
|
||||
/* Uh oh, we couldn't find a matching handle */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* See if we already have a symbol table for this library */
|
||||
for (size_t i = 0; i < m_SymTables.size(); i++)
|
||||
{
|
||||
libtable = m_SymTables[i];
|
||||
if (libtable->lib_base == dlbase)
|
||||
{
|
||||
table = &libtable->table;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we don't have a symbol table for this library, then create one */
|
||||
if (table == NULL)
|
||||
{
|
||||
libtable = new LibSymbolTable();
|
||||
libtable->table.Initialize();
|
||||
libtable->lib_base = dlbase;
|
||||
libtable->last_pos = 0;
|
||||
table = &libtable->table;
|
||||
m_SymTables.push_back(libtable);
|
||||
}
|
||||
|
||||
/* See if the symbol is already cached in our table */
|
||||
symbol_entry = table->FindSymbol(symbol, strlen(symbol));
|
||||
if (symbol_entry != NULL)
|
||||
{
|
||||
return symbol_entry->address;
|
||||
}
|
||||
|
||||
/* If symbol isn't in our table, then we have to locate it in memory */
|
||||
|
||||
file_hdr = (struct mach_header *)dlbase;
|
||||
loadcmds = (struct load_command *)(dlbase + sizeof(struct mach_header));
|
||||
loadcmd_count = file_hdr->ncmds;
|
||||
|
||||
/* Loop through load commands until we find the ones for the symbol table */
|
||||
for (uint32_t i = 0; i < loadcmd_count; i++)
|
||||
{
|
||||
if (loadcmds->cmd == LC_SEGMENT && !linkedit_hdr)
|
||||
{
|
||||
struct segment_command *seg = (struct segment_command *)loadcmds;
|
||||
if (strcmp(seg->segname, "__LINKEDIT") == 0)
|
||||
{
|
||||
linkedit_hdr = seg;
|
||||
if (symtab_hdr)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (loadcmds->cmd == LC_SYMTAB)
|
||||
{
|
||||
symtab_hdr = (struct symtab_command *)loadcmds;
|
||||
if (linkedit_hdr)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Load commands are not of a fixed size which is why we add the size */
|
||||
loadcmds = (struct load_command *)((uintptr_t)loadcmds + loadcmds->cmdsize);
|
||||
}
|
||||
|
||||
if (!linkedit_hdr || !symtab_hdr || !symtab_hdr->symoff || !symtab_hdr->stroff)
|
||||
{
|
||||
/* Uh oh, no symbol table */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
linkedit_addr = dlbase + linkedit_hdr->vmaddr;
|
||||
symtab = (struct nlist *)(linkedit_addr + symtab_hdr->symoff - linkedit_hdr->fileoff);
|
||||
strtab = (const char *)(linkedit_addr + symtab_hdr->stroff - linkedit_hdr->fileoff);
|
||||
symbol_count = symtab_hdr->nsyms;
|
||||
|
||||
/* Iterate symbol table starting from the position we were at last time */
|
||||
for (uint32_t i = libtable->last_pos; i < symbol_count; i++)
|
||||
{
|
||||
struct nlist &sym = symtab[i];
|
||||
/* Ignore the prepended underscore on all symbols, so +1 here */
|
||||
const char *sym_name = strtab + sym.n_un.n_strx + 1;
|
||||
Symbol *cur_sym;
|
||||
|
||||
/* Skip symbols that are undefined */
|
||||
if (sym.n_sect == NO_SECT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Caching symbols as we go along */
|
||||
cur_sym = table->InternSymbol(sym_name, strlen(sym_name), (void *)(dlbase + sym.n_value));
|
||||
if (strcmp(symbol, sym_name) == 0)
|
||||
{
|
||||
symbol_entry = cur_sym;
|
||||
libtable->last_pos = ++i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return symbol_entry ? symbol_entry->address : NULL;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
bool MemoryUtils::GetLibraryInfo(const void *libPtr, DynLibInfo &lib)
|
||||
{
|
||||
uintptr_t baseAddr;
|
||||
unsigned long baseAddr;
|
||||
|
||||
if (libPtr == NULL)
|
||||
{
|
||||
@@ -431,7 +273,7 @@ bool MemoryUtils::GetLibraryInfo(const void *libPtr, DynLibInfo &lib)
|
||||
return false;
|
||||
}
|
||||
|
||||
baseAddr = reinterpret_cast<uintptr_t>(info.AllocationBase);
|
||||
baseAddr = reinterpret_cast<unsigned long>(info.AllocationBase);
|
||||
|
||||
/* All this is for our insane sanity checks :o */
|
||||
dos = reinterpret_cast<IMAGE_DOS_HEADER *>(baseAddr);
|
||||
@@ -480,7 +322,7 @@ bool MemoryUtils::GetLibraryInfo(const void *libPtr, DynLibInfo &lib)
|
||||
}
|
||||
|
||||
/* This is for our insane sanity checks :o */
|
||||
baseAddr = reinterpret_cast<uintptr_t>(info.dli_fbase);
|
||||
baseAddr = reinterpret_cast<unsigned long>(info.dli_fbase);
|
||||
file = reinterpret_cast<Elf32_Ehdr *>(baseAddr);
|
||||
|
||||
/* Check ELF magic */
|
||||
@@ -511,105 +353,21 @@ bool MemoryUtils::GetLibraryInfo(const void *libPtr, DynLibInfo &lib)
|
||||
|
||||
phdrCount = file->e_phnum;
|
||||
phdr = reinterpret_cast<Elf32_Phdr *>(baseAddr + file->e_phoff);
|
||||
|
||||
|
||||
/* Add up the memory sizes of segments marked as PT_LOAD as those are the only ones that should be in memory */
|
||||
for (uint16_t i = 0; i < phdrCount; i++)
|
||||
{
|
||||
Elf32_Phdr &hdr = phdr[i];
|
||||
|
||||
/* We only really care about the segment with executable code */
|
||||
if (hdr.p_type == PT_LOAD && hdr.p_flags == (PF_X|PF_R))
|
||||
if (hdr.p_type == PT_LOAD)
|
||||
{
|
||||
/* From glibc, elf/dl-load.c:
|
||||
* c->mapend = ((ph->p_vaddr + ph->p_filesz + GLRO(dl_pagesize) - 1)
|
||||
* & ~(GLRO(dl_pagesize) - 1));
|
||||
*
|
||||
* In glibc, the segment file size is aligned up to the nearest page size and
|
||||
* added to the virtual address of the segment. We just want the size here.
|
||||
*/
|
||||
lib.memorySize = PAGE_ALIGN_UP(hdr.p_filesz);
|
||||
break;
|
||||
lib.memorySize += hdr.p_memsz;
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined PLATFORM_APPLE
|
||||
|
||||
Dl_info info;
|
||||
struct mach_header *file;
|
||||
struct segment_command *seg;
|
||||
uint32_t cmd_count;
|
||||
|
||||
if (!dladdr(libPtr, &info))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!info.dli_fbase || !info.dli_fname)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* This is for our insane sanity checks :o */
|
||||
baseAddr = (uintptr_t)info.dli_fbase;
|
||||
file = (struct mach_header *)baseAddr;
|
||||
|
||||
/* Check Mach-O magic */
|
||||
if (file->magic != MH_MAGIC)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check architecture (32-bit/x86) */
|
||||
if (file->cputype != CPU_TYPE_I386 || file->cpusubtype != CPU_SUBTYPE_I386_ALL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* For our purposes, this must be a dynamic library */
|
||||
if (file->filetype != MH_DYLIB)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
cmd_count = file->ncmds;
|
||||
seg = (struct segment_command *)(baseAddr + sizeof(struct mach_header));
|
||||
|
||||
/* Add up memory sizes of mapped segments */
|
||||
for (uint32_t i = 0; i < cmd_count; i++)
|
||||
{
|
||||
if (seg->cmd == LC_SEGMENT)
|
||||
{
|
||||
lib.memorySize += seg->vmsize;
|
||||
}
|
||||
|
||||
seg = (struct segment_command *)((uintptr_t)seg + seg->cmdsize);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
lib.baseAddress = reinterpret_cast<void *>(baseAddr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* MemoryUtils::ResolveAddr(void *handle, void* addr)
|
||||
{
|
||||
struct link_map *dlmap;
|
||||
dlmap = (struct link_map *)handle;
|
||||
|
||||
LibSymbolTable *libtable;
|
||||
AddrTable *table2;
|
||||
|
||||
for (size_t i = 0; i < m_SymTables.size(); i++)
|
||||
{
|
||||
libtable = m_SymTables[i];
|
||||
if (libtable->lib_base == dlmap->l_addr)
|
||||
{
|
||||
table2 = &libtable->table2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (table2 == NULL) return NULL;
|
||||
Symbol *sym = table2->FindAddr(addr);
|
||||
return sym ? sym->buffer() : NULL;
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2011 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2000 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -30,9 +30,9 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
|
||||
#define _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <IMemoryUtils.h>
|
||||
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
#include "sm_globals.h"
|
||||
#ifdef PLATFORM_LINUX
|
||||
#include <sh_vector.h>
|
||||
#include "sm_symtable.h"
|
||||
|
||||
@@ -41,21 +41,19 @@ using namespace SourceHook;
|
||||
|
||||
using namespace SourceMod;
|
||||
|
||||
#ifdef PLATFORM_APPLE
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#endif
|
||||
|
||||
struct DynLibInfo
|
||||
{
|
||||
void *baseAddress;
|
||||
size_t memorySize;
|
||||
};
|
||||
|
||||
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
#ifdef PLATFORM_LINUX
|
||||
typedef uint32_t Elf32_Addr;
|
||||
|
||||
struct LibSymbolTable
|
||||
{
|
||||
SymbolTable table;
|
||||
uintptr_t lib_base;
|
||||
Elf32_Addr lib_base;
|
||||
uint32_t last_pos;
|
||||
};
|
||||
#endif
|
||||
@@ -65,7 +63,6 @@ class MemoryUtils :
|
||||
public SMGlobalClass
|
||||
{
|
||||
public:
|
||||
MemoryUtils();
|
||||
~MemoryUtils();
|
||||
public: // SMGlobalClass
|
||||
void OnSourceModAllInitialized();
|
||||
@@ -74,14 +71,9 @@ public: // IMemoryUtils
|
||||
void *ResolveSymbol(void *handle, const char *symbol);
|
||||
public:
|
||||
bool GetLibraryInfo(const void *libPtr, DynLibInfo &lib);
|
||||
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
#ifdef PLATFORM_LINUX
|
||||
private:
|
||||
CVector<LibSymbolTable *> m_SymTables;
|
||||
#ifdef PLATFORM_APPLE
|
||||
struct dyld_all_image_infos *m_ImageList;
|
||||
SInt32 m_OSXMajor;
|
||||
SInt32 m_OSXMinor;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
+5
-25
@@ -41,7 +41,7 @@
|
||||
#include "ShareSys.h"
|
||||
#include "HandleSys.h"
|
||||
#include "sourcemm_api.h"
|
||||
#include "logic_bridge.h"
|
||||
#include "Translator.h"
|
||||
|
||||
MenuManager g_Menus;
|
||||
VoteMenuHandler s_VoteHandler;
|
||||
@@ -231,7 +231,6 @@ IMenuPanel *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder ord
|
||||
unsigned int pgn = menu->GetPagination();
|
||||
unsigned int maxItems = style->GetMaxPageItems();
|
||||
bool exitButton = (menu->GetMenuOptionFlags() & MENUFLAG_BUTTON_EXIT) == MENUFLAG_BUTTON_EXIT;
|
||||
bool novoteButton = (menu->GetMenuOptionFlags() & MENUFLAG_BUTTON_NOVOTE) == MENUFLAG_BUTTON_NOVOTE;
|
||||
|
||||
if (pgn != MENU_NO_PAGINATION)
|
||||
{
|
||||
@@ -242,11 +241,6 @@ IMenuPanel *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder ord
|
||||
maxItems--;
|
||||
}
|
||||
|
||||
if (novoteButton)
|
||||
{
|
||||
maxItems--;
|
||||
}
|
||||
|
||||
/* This is very not allowed! */
|
||||
if (maxItems < 2)
|
||||
{
|
||||
@@ -442,20 +436,6 @@ skip_search:
|
||||
/* Draw the item according to the order */
|
||||
menu_slots_t *slots = md.slots;
|
||||
unsigned int position = 0; /* Keep track of the last position */
|
||||
|
||||
if (novoteButton)
|
||||
{
|
||||
char text[50];
|
||||
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "No Vote", &client))
|
||||
{
|
||||
UTIL_Format(text, sizeof(text), "No Vote");
|
||||
}
|
||||
ItemDrawInfo dr(text, 0);
|
||||
position = panel->DrawItem(dr);
|
||||
slots[position].type = ItemSel_Exit;
|
||||
position++;
|
||||
}
|
||||
|
||||
if (order == ItemOrder_Ascending)
|
||||
{
|
||||
md.item_on_page = drawItems[0].position;
|
||||
@@ -606,7 +586,7 @@ skip_search:
|
||||
{
|
||||
if (exitBackButton)
|
||||
{
|
||||
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Back", &client))
|
||||
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Back", &client))
|
||||
{
|
||||
UTIL_Format(text, sizeof(text), "Back");
|
||||
}
|
||||
@@ -616,7 +596,7 @@ skip_search:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Previous", &client))
|
||||
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Previous", &client))
|
||||
{
|
||||
UTIL_Format(text, sizeof(text), "Previous");
|
||||
}
|
||||
@@ -637,7 +617,7 @@ skip_search:
|
||||
/* NEXT */
|
||||
if (displayNext || canDrawDisabled)
|
||||
{
|
||||
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Next", &client))
|
||||
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Next", &client))
|
||||
{
|
||||
UTIL_Format(text, sizeof(text), "Next");
|
||||
}
|
||||
@@ -668,7 +648,7 @@ skip_search:
|
||||
/* EXIT */
|
||||
if (exitButton)
|
||||
{
|
||||
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Exit", &client))
|
||||
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Exit", &client))
|
||||
{
|
||||
UTIL_Format(text, sizeof(text), "Exit");
|
||||
}
|
||||
|
||||
+1
-13
@@ -322,24 +322,15 @@ void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
|
||||
if (pCollideable)
|
||||
{
|
||||
const Vector & pos = pCollideable->GetCollisionOrigin();
|
||||
|
||||
enginesound->EmitSound(filter,
|
||||
client,
|
||||
CHAN_AUTO,
|
||||
#if SOURCE_ENGINE >= SE_PORTAL2
|
||||
sound,
|
||||
-1,
|
||||
#endif
|
||||
sound,
|
||||
VOL_NORM,
|
||||
ATTN_NORM,
|
||||
#if SOURCE_ENGINE >= SE_PORTAL2
|
||||
0,
|
||||
#endif
|
||||
0,
|
||||
PITCH_NORM,
|
||||
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
|
||||
0,
|
||||
#endif
|
||||
&pos);
|
||||
}
|
||||
}
|
||||
@@ -386,9 +377,6 @@ void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
|
||||
RemoveClientFromWatch(client);
|
||||
}
|
||||
|
||||
Handle_t hndl = menu ? menu->GetHandle() : BAD_HANDLE;
|
||||
AutoHandleRooter ahr(hndl);
|
||||
|
||||
if (cancel)
|
||||
{
|
||||
mh->OnMenuCancel(menu, client, reason);
|
||||
|
||||
@@ -32,20 +32,11 @@
|
||||
#include "MenuStyle_Radio.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "UserMessages.h"
|
||||
#include <IGameConfigs.h>
|
||||
#include "GameConfigs.h"
|
||||
#include "PlayerManager.h"
|
||||
#if defined MENU_DEBUG
|
||||
#include "Logger.h"
|
||||
#endif
|
||||
#include "logic_bridge.h"
|
||||
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#endif
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
#include <game/shared/csgo/protobuf/cstrike15_usermessages.pb.h>
|
||||
#endif
|
||||
|
||||
extern const char *g_RadioNumTable[];
|
||||
CRadioStyle g_RadioMenuStyle;
|
||||
@@ -53,14 +44,6 @@ int g_ShowMenuId = -1;
|
||||
bool g_bRadioInit = false;
|
||||
unsigned int g_RadioMenuTimeout = 0;
|
||||
|
||||
// back, next, exit
|
||||
#define MAX_PAGINATION_OPTIONS 3
|
||||
|
||||
#define MAX_MENUSLOT_KEYS 10
|
||||
|
||||
static unsigned int s_RadioMaxPageItems = MAX_MENUSLOT_KEYS;
|
||||
|
||||
|
||||
CRadioStyle::CRadioStyle()
|
||||
{
|
||||
m_players = new CRadioMenuPlayer[256+1];
|
||||
@@ -106,18 +89,6 @@ void CRadioStyle::OnSourceModLevelChange(const char *mapName)
|
||||
g_RadioMenuTimeout = 0;
|
||||
}
|
||||
|
||||
const char *items = g_pGameConf->GetKeyValue("RadioMenuMaxPageItems");
|
||||
if (items != NULL)
|
||||
{
|
||||
int value = atoi(items);
|
||||
|
||||
// Only override the mostly-safe default if it's a sane value
|
||||
if (value > MAX_PAGINATION_OPTIONS && value <= MAX_MENUSLOT_KEYS)
|
||||
{
|
||||
s_RadioMaxPageItems = value;
|
||||
}
|
||||
}
|
||||
|
||||
g_Menus.AddStyle(this);
|
||||
g_Menus.SetDefaultStyle(this);
|
||||
|
||||
@@ -163,22 +134,13 @@ static unsigned int g_last_holdtime = 0;
|
||||
static unsigned int g_last_client_count = 0;
|
||||
static int g_last_clients[256];
|
||||
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
void CRadioStyle::OnUserMessage(int msg_id, protobuf::Message &msg, IRecipientFilter *pFilter)
|
||||
#else
|
||||
void CRadioStyle::OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter)
|
||||
#endif
|
||||
{
|
||||
int count = pFilter->GetRecipientCount();
|
||||
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
int c = ((CCSUsrMsg_ShowMenu &)msg).display_time();
|
||||
#else
|
||||
bf_read br(bf->GetBasePointer(), 3);
|
||||
|
||||
br.ReadWord();
|
||||
int c = br.ReadChar();
|
||||
#endif
|
||||
|
||||
g_last_holdtime = (c == -1) ? 0 : (unsigned)c;
|
||||
|
||||
@@ -226,7 +188,7 @@ IBaseMenu *CRadioStyle::CreateMenu(IMenuHandler *pHandler, IdentityToken_t *pOwn
|
||||
|
||||
unsigned int CRadioStyle::GetMaxPageItems()
|
||||
{
|
||||
return s_RadioMaxPageItems;
|
||||
return 10;
|
||||
}
|
||||
|
||||
const char *CRadioStyle::GetStyleName()
|
||||
@@ -344,7 +306,7 @@ unsigned int CRadioDisplay::GetCurrentKey()
|
||||
|
||||
bool CRadioDisplay::SetCurrentKey(unsigned int key)
|
||||
{
|
||||
if (key < m_NextPos || m_NextPos > s_RadioMaxPageItems)
|
||||
if (key < m_NextPos || m_NextPos > 10)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -380,7 +342,7 @@ void CRadioDisplay::DrawTitle(const char *text, bool onlyIfEmpty/* =false */)
|
||||
|
||||
unsigned int CRadioDisplay::DrawItem(const ItemDrawInfo &item)
|
||||
{
|
||||
if (m_NextPos > s_RadioMaxPageItems || !CanDrawItem(item.style))
|
||||
if (m_NextPos > 10 || !CanDrawItem(item.style))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -489,15 +451,6 @@ void CRadioMenuPlayer::Radio_Refresh()
|
||||
time = menuHoldTime - (unsigned int)(gpGlobals->curtime - menuStartTime);
|
||||
}
|
||||
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
// If or when we need to support multiple games per engine with this, we can switch to reflection
|
||||
// TODO: find what happens past 240 on CS:GO
|
||||
CCSUsrMsg_ShowMenu *msg = (CCSUsrMsg_ShowMenu *)g_UserMsgs.StartProtobufMessage(g_ShowMenuId, players, 1, USERMSG_BLOCKHOOKS);
|
||||
msg->set_bits_valid_slots(display_keys);
|
||||
msg->set_display_time(time);
|
||||
msg->set_menu_string(ptr);
|
||||
g_UserMsgs.EndMessage();
|
||||
#else
|
||||
while (true)
|
||||
{
|
||||
if (len > 240)
|
||||
@@ -505,8 +458,7 @@ void CRadioMenuPlayer::Radio_Refresh()
|
||||
save = ptr[240];
|
||||
ptr[240] = '\0';
|
||||
}
|
||||
|
||||
bf_write *buffer = g_UserMsgs.StartBitBufMessage(g_ShowMenuId, players, 1, USERMSG_BLOCKHOOKS);
|
||||
bf_write *buffer = g_UserMsgs.StartMessage(g_ShowMenuId, players, 1, USERMSG_BLOCKHOOKS);
|
||||
buffer->WriteWord(display_keys);
|
||||
buffer->WriteChar(time ? time : -1);
|
||||
buffer->WriteByte( (len > 240) ? 1 : 0 );
|
||||
@@ -523,7 +475,6 @@ void CRadioMenuPlayer::Radio_Refresh()
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
display_last_refresh = gpGlobals->curtime;
|
||||
}
|
||||
@@ -559,7 +510,6 @@ unsigned int CRadioDisplay::GetApproxMemUsage()
|
||||
CRadioMenu::CRadioMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner) :
|
||||
CBaseMenu(pHandler, &g_RadioMenuStyle, pOwner)
|
||||
{
|
||||
m_Pagination = s_RadioMaxPageItems - MAX_PAGINATION_OPTIONS;
|
||||
}
|
||||
|
||||
bool CRadioMenu::SetExtOption(MenuOption option, const void *valuePtr)
|
||||
@@ -600,17 +550,6 @@ bool CRadioMenu::DisplayAtItem(int client,
|
||||
time);
|
||||
}
|
||||
|
||||
bool CRadioMenu::SetPagination(unsigned int itemsPerPage)
|
||||
{
|
||||
const unsigned int maxPerPage = s_RadioMaxPageItems - MAX_PAGINATION_OPTIONS;
|
||||
if (itemsPerPage > maxPerPage)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return CBaseMenu::SetPagination(itemsPerPage);
|
||||
}
|
||||
|
||||
void CRadioMenu::Cancel_Finally()
|
||||
{
|
||||
g_RadioMenuStyle.CancelMenu(this);
|
||||
|
||||
+2
-11
@@ -37,7 +37,7 @@
|
||||
#include "MenuStyle_Base.h"
|
||||
#include "sourcemm_api.h"
|
||||
#include <IPlayerHelpers.h>
|
||||
#include "UserMessages.h"
|
||||
#include <IUserMessages.h>
|
||||
#include "sm_fastlink.h"
|
||||
#include <sh_stack.h>
|
||||
#include <compat_wrappers.h>
|
||||
@@ -65,11 +65,7 @@ private:
|
||||
class CRadioStyle :
|
||||
public BaseMenuStyle,
|
||||
public SMGlobalClass,
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
public IProtobufUserMessageListener
|
||||
#else
|
||||
public IBitBufUserMessageListener
|
||||
#endif
|
||||
public IUserMessageListener
|
||||
{
|
||||
public:
|
||||
CRadioStyle();
|
||||
@@ -88,11 +84,7 @@ public: //IMenuStyle
|
||||
unsigned int GetMaxPageItems();
|
||||
unsigned int GetApproxMemUsage();
|
||||
public: //IUserMessageListener
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
void OnUserMessage(int msg_id, protobuf::Message &msg, IRecipientFilter *pFilter);
|
||||
#else
|
||||
void OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter);
|
||||
#endif
|
||||
void OnUserMessageSent(int msg_id);
|
||||
public:
|
||||
bool IsSupported();
|
||||
@@ -150,7 +142,6 @@ public:
|
||||
unsigned int time,
|
||||
unsigned int start_item,
|
||||
IMenuHandler *alt_handler/* =NULL */);
|
||||
bool SetPagination(unsigned int itemsPerPage);
|
||||
void Cancel_Finally();
|
||||
unsigned int GetApproxMemUsage();
|
||||
};
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "sm_stringutil.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "MenuStyle_Valve.h"
|
||||
#include "Translator.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "ConCmdManager.h"
|
||||
|
||||
|
||||
+8
-13
@@ -39,8 +39,7 @@
|
||||
#include <HalfLife2.h>
|
||||
#include <mathlib.h>
|
||||
#include <const.h>
|
||||
#include <ITranslator.h>
|
||||
#include "logic_bridge.h"
|
||||
#include <Translator.h>
|
||||
|
||||
float g_next_vote = 0.0f;
|
||||
|
||||
@@ -518,7 +517,7 @@ void VoteMenuHandler::OnMenuSelect(IBaseMenu *menu, int client, unsigned int ite
|
||||
m_Votes[item]++;
|
||||
m_NumVotes++;
|
||||
|
||||
if (sm_vote_chat.GetBool() || sm_vote_console.GetBool() || sm_vote_client_console.GetBool())
|
||||
if (sm_vote_chat.GetBool() || sm_vote_console.GetBool())
|
||||
{
|
||||
static char buffer[1024];
|
||||
ItemDrawInfo dr;
|
||||
@@ -527,8 +526,7 @@ void VoteMenuHandler::OnMenuSelect(IBaseMenu *menu, int client, unsigned int ite
|
||||
if (sm_vote_console.GetBool())
|
||||
{
|
||||
int target = SOURCEMOD_SERVER_LANGUAGE;
|
||||
logicore.CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Voted For",
|
||||
&target, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Voted For", &target, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
Engine_LogPrintWrapper(buffer);
|
||||
}
|
||||
|
||||
@@ -540,17 +538,15 @@ void VoteMenuHandler::OnMenuSelect(IBaseMenu *menu, int client, unsigned int ite
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
|
||||
assert(pPlayer);
|
||||
|
||||
if (pPlayer->IsInGame() && !pPlayer->IsFakeClient())
|
||||
if (pPlayer->IsInGame())
|
||||
{
|
||||
if (m_Revoting[client])
|
||||
{
|
||||
logicore.CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Changed Vote",
|
||||
&i, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Changed Vote", &i, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
}
|
||||
else
|
||||
{
|
||||
logicore.CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Voted For",
|
||||
&i, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Voted For", &i, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
}
|
||||
|
||||
if (sm_vote_chat.GetBool())
|
||||
@@ -560,7 +556,7 @@ void VoteMenuHandler::OnMenuSelect(IBaseMenu *menu, int client, unsigned int ite
|
||||
|
||||
if (sm_vote_client_console.GetBool())
|
||||
{
|
||||
ClientConsolePrint(pPlayer->GetEdict(), buffer);
|
||||
engine->ClientPrintf(pPlayer->GetEdict(), buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -638,8 +634,7 @@ void VoteMenuHandler::DrawHintProgress()
|
||||
{
|
||||
if (g_Players.GetPlayerByIndex(i)->IsInGame())
|
||||
{
|
||||
logicore.CoreTranslate(buffer, sizeof(buffer), "%T%s", 6, NULL, "Vote Count",
|
||||
&i, &m_NumVotes, &m_TotalClients, &iTimeRemaining, &m_leaderList);
|
||||
CoreTranslate(buffer, sizeof(buffer), "%T%s", 6, NULL, "Vote Count", &i, &m_NumVotes, &m_TotalClients, &iTimeRemaining, &m_leaderList);
|
||||
g_HL2.HintTextMsg(i, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-6
@@ -31,7 +31,6 @@
|
||||
|
||||
#include "NextMap.h"
|
||||
#include "Logger.h"
|
||||
#include "HalfLife2.h"
|
||||
#include "sourcemm_api.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "sourcehook.h"
|
||||
@@ -110,7 +109,7 @@ const char *NextMapManager::GetNextMap()
|
||||
|
||||
bool NextMapManager::SetNextMap(const char *map)
|
||||
{
|
||||
if (!g_HL2.IsMapValid(map))
|
||||
if (!engine->IsMapValid(map))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -134,7 +133,7 @@ void NextMapManager::HookChangeLevel(const char *map, const char *unknown, const
|
||||
|
||||
const char *newmap = sm_nextmap.GetString();
|
||||
|
||||
if (newmap[0] == 0 || !g_HL2.IsMapValid(newmap))
|
||||
if (newmap[0] == 0 || !engine->IsMapValid(newmap))
|
||||
{
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
@@ -184,14 +183,14 @@ void NextMapManager::OnSourceModLevelChange( const char *mapName )
|
||||
m_tempChangeInfo.m_mapName[0] ='\0';
|
||||
m_tempChangeInfo.m_changeReason[0] = '\0';
|
||||
m_tempChangeInfo.startTime = time(NULL);
|
||||
UTIL_Format(lastMap, sizeof(lastMap), "%s", mapName);
|
||||
UTIL_Format(lastMap, sizeof(lastMap), mapName);
|
||||
}
|
||||
|
||||
void NextMapManager::ForceChangeLevel( const char *mapName, const char* changeReason )
|
||||
{
|
||||
/* Store the mapname and reason */
|
||||
UTIL_Format(m_tempChangeInfo.m_mapName, sizeof(m_tempChangeInfo.m_mapName), "%s", mapName);
|
||||
UTIL_Format(m_tempChangeInfo.m_changeReason, sizeof(m_tempChangeInfo.m_changeReason), "%s", changeReason);
|
||||
UTIL_Format(m_tempChangeInfo.m_mapName, sizeof(m_tempChangeInfo.m_mapName), mapName);
|
||||
UTIL_Format(m_tempChangeInfo.m_changeReason, sizeof(m_tempChangeInfo.m_changeReason), changeReason);
|
||||
|
||||
/* Change level and skip our hook */
|
||||
g_forcedChange = true;
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ struct MapChangeData
|
||||
startTime = 0;
|
||||
}
|
||||
|
||||
char m_mapName[PLATFORM_MAX_PATH];
|
||||
char m_mapName[32];
|
||||
char m_changeReason[100];
|
||||
time_t startTime;
|
||||
};
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "common_logic.h"
|
||||
#include "PhraseCollection.h"
|
||||
#include "Translator.h"
|
||||
#include "sm_stringutil.h"
|
||||
|
||||
CPhraseCollection::CPhraseCollection()
|
||||
{
|
||||
@@ -54,7 +54,7 @@ IPhraseFile *CPhraseCollection::AddPhraseFile(const char *filename)
|
||||
char full_name[PLATFORM_MAX_PATH];
|
||||
|
||||
/* No compat shim here. The user should have read the doc. */
|
||||
smcore.Format(full_name, sizeof(full_name), "%s.txt", filename);
|
||||
UTIL_Format(full_name, sizeof(full_name), "%s.txt", filename);
|
||||
|
||||
fid = g_Translator.FindOrAddPhraseFile(full_name);
|
||||
pFile = g_Translator.GetFileByIndex(fid);
|
||||
@@ -113,7 +113,7 @@ bool CPhraseCollection::FormatString(char *buffer,
|
||||
unsigned int arg;
|
||||
|
||||
arg = 0;
|
||||
if (!smcore.gnprintf(buffer, maxlength, format, this, params, numparams, arg, pOutLength, pFailPhrase))
|
||||
if (!gnprintf(buffer, maxlength, format, this, params, numparams, arg, pOutLength, pFailPhrase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
+66
-267
@@ -39,23 +39,23 @@
|
||||
#include "sm_stringutil.h"
|
||||
#include "CoreConfig.h"
|
||||
#include "TimerSys.h"
|
||||
#include "Translator.h"
|
||||
#include "Logger.h"
|
||||
#include "ChatTriggers.h"
|
||||
#include "HalfLife2.h"
|
||||
#include <inetchannel.h>
|
||||
#include <iclient.h>
|
||||
#include <IGameConfigs.h>
|
||||
#include "GameConfigs.h"
|
||||
#include "ExtensionSys.h"
|
||||
#include <sourcemod_version.h>
|
||||
#include "ConsoleDetours.h"
|
||||
#include "logic_bridge.h"
|
||||
|
||||
PlayerManager g_Players;
|
||||
bool g_OnMapStarted = false;
|
||||
IForward *PreAdminCheck = NULL;
|
||||
IForward *PostAdminCheck = NULL;
|
||||
IForward *PostAdminFilter = NULL;
|
||||
|
||||
IForward *OnClientConnected = NULL;
|
||||
const unsigned int *g_NumPlayersToAuth = NULL;
|
||||
int lifestate_offset = -1;
|
||||
List<ICommandTargetProcessor *> target_processors;
|
||||
@@ -113,11 +113,6 @@ PlayerManager::PlayerManager()
|
||||
m_FirstPass = false;
|
||||
m_maxClients = 0;
|
||||
|
||||
m_SourceTVUserId = -1;
|
||||
m_ReplayUserId = -1;
|
||||
|
||||
m_bAuthstringValidation = false; // don't use steam auth by default... yet
|
||||
|
||||
m_UserIdLookUp = new int[USHRT_MAX+1];
|
||||
memset(m_UserIdLookUp, 0, sizeof(int) * (USHRT_MAX+1));
|
||||
}
|
||||
@@ -147,7 +142,6 @@ void PlayerManager::OnSourceModAllInitialized()
|
||||
ParamType p2[] = {Param_Cell};
|
||||
|
||||
m_clconnect = g_Forwards.CreateForward("OnClientConnect", ET_LowEvent, 3, p1);
|
||||
m_clconnect_post = g_Forwards.CreateForward("OnClientConnected", ET_Ignore, 1, p2);
|
||||
m_clputinserver = g_Forwards.CreateForward("OnClientPutInServer", ET_Ignore, 1, p2);
|
||||
m_cldisconnect = g_Forwards.CreateForward("OnClientDisconnect", ET_Ignore, 1, p2);
|
||||
m_cldisconnect_post = g_Forwards.CreateForward("OnClientDisconnect_Post", ET_Ignore, 1, p2);
|
||||
@@ -156,6 +150,7 @@ void PlayerManager::OnSourceModAllInitialized()
|
||||
m_clauth = g_Forwards.CreateForward("OnClientAuthorized", ET_Ignore, 2, NULL, Param_Cell, Param_String);
|
||||
m_onActivate = g_Forwards.CreateForward("OnServerLoad", ET_Ignore, 0, NULL);
|
||||
m_onActivate2 = g_Forwards.CreateForward("OnMapStart", ET_Ignore, 0, NULL);
|
||||
OnClientConnected = g_Forwards.CreateForward("OnClientConnected", ET_Ignore, 1, p2);
|
||||
|
||||
PreAdminCheck = g_Forwards.CreateForward("OnClientPreAdminCheck", ET_Event, 1, p1);
|
||||
PostAdminCheck = g_Forwards.CreateForward("OnClientPostAdminCheck", ET_Ignore, 1, p1);
|
||||
@@ -164,6 +159,8 @@ void PlayerManager::OnSourceModAllInitialized()
|
||||
m_bIsListenServer = !engine->IsDedicatedServer();
|
||||
m_ListenClient = 0;
|
||||
|
||||
g_ConVarManager.AddConVarChangeListener("tv_enable", this);
|
||||
|
||||
ConCommand *pCmd = FindCommand("maxplayers");
|
||||
if (pCmd != NULL)
|
||||
{
|
||||
@@ -175,7 +172,6 @@ void PlayerManager::OnSourceModAllInitialized()
|
||||
void PlayerManager::OnSourceModShutdown()
|
||||
{
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverClients, this, &PlayerManager::OnClientConnect, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverClients, this, &PlayerManager::OnClientConnect_Post, true);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientPutInServer, serverClients, this, &PlayerManager::OnClientPutInServer, true);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverClients, this, &PlayerManager::OnClientDisconnect, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverClients, this, &PlayerManager::OnClientDisconnect_Post, true);
|
||||
@@ -185,7 +181,6 @@ void PlayerManager::OnSourceModShutdown()
|
||||
|
||||
/* Release forwards */
|
||||
g_Forwards.ReleaseForward(m_clconnect);
|
||||
g_Forwards.ReleaseForward(m_clconnect_post);
|
||||
g_Forwards.ReleaseForward(m_clputinserver);
|
||||
g_Forwards.ReleaseForward(m_cldisconnect);
|
||||
g_Forwards.ReleaseForward(m_cldisconnect_post);
|
||||
@@ -194,6 +189,7 @@ void PlayerManager::OnSourceModShutdown()
|
||||
g_Forwards.ReleaseForward(m_clauth);
|
||||
g_Forwards.ReleaseForward(m_onActivate);
|
||||
g_Forwards.ReleaseForward(m_onActivate2);
|
||||
g_Forwards.ReleaseForward(OnClientConnected);
|
||||
|
||||
g_Forwards.ReleaseForward(PreAdminCheck);
|
||||
g_Forwards.ReleaseForward(PostAdminCheck);
|
||||
@@ -201,6 +197,8 @@ void PlayerManager::OnSourceModShutdown()
|
||||
|
||||
delete [] m_Players;
|
||||
|
||||
g_ConVarManager.RemoveConVarChangeListener("tv_enable", this);
|
||||
|
||||
if (maxplayersCmd != NULL)
|
||||
{
|
||||
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, maxplayersCmd, CmdMaxplayersCallback, true);
|
||||
@@ -231,43 +229,16 @@ ConfigResult PlayerManager::OnSourceModConfigChanged(const char *key,
|
||||
return ConfigResult_Reject;
|
||||
}
|
||||
return ConfigResult_Accept;
|
||||
} else if (strcmp( key, "SteamAuthstringValidation" ) == 0) {
|
||||
if (strcasecmp(value, "yes") == 0)
|
||||
{
|
||||
m_bAuthstringValidation = true;
|
||||
} else if ( strcasecmp(value, "no") == 0) {
|
||||
m_bAuthstringValidation = false;
|
||||
} else {
|
||||
UTIL_Format(error, maxlength, "Invalid value: must be \"yes\" or \"no\"");
|
||||
return ConfigResult_Reject;
|
||||
}
|
||||
return ConfigResult_Accept;
|
||||
}
|
||||
return ConfigResult_Ignore;
|
||||
}
|
||||
|
||||
void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
||||
{
|
||||
static ConVar *tv_enable = icvar->FindVar("tv_enable");
|
||||
#if SOURCE_ENGINE == SE_TF2
|
||||
static ConVar *replay_enable = icvar->FindVar("replay_enable");
|
||||
#endif
|
||||
|
||||
// clientMax will not necessarily be correct here (such as on late SourceTV enable)
|
||||
m_maxClients = gpGlobals->maxClients;
|
||||
|
||||
ICommandLine *commandLine = g_HL2.GetValveCommandLine();
|
||||
m_bIsSourceTVActive = (tv_enable && tv_enable->GetBool() && (!commandLine || commandLine->FindParm("-nohltv") == 0));
|
||||
m_bIsReplayActive = false;
|
||||
#if SOURCE_ENGINE == SE_TF2
|
||||
m_bIsReplayActive = (replay_enable && replay_enable->GetBool());
|
||||
#endif
|
||||
m_PlayersSinceActive = 0;
|
||||
|
||||
if (!m_FirstPass)
|
||||
{
|
||||
/* Initialize all players */
|
||||
|
||||
m_maxClients = clientMax;
|
||||
m_PlayerCount = 0;
|
||||
m_Players = new CPlayer[ABSOLUTE_PLAYER_LIMIT + 1];
|
||||
m_AuthQueue = new unsigned int[ABSOLUTE_PLAYER_LIMIT + 1];
|
||||
@@ -276,13 +247,10 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
|
||||
memset(m_AuthQueue, 0, sizeof(unsigned int) * (ABSOLUTE_PLAYER_LIMIT + 1));
|
||||
|
||||
g_NumPlayersToAuth = &m_AuthQueue[0];
|
||||
|
||||
g_PluginSys.SyncMaxClients(clientMax);
|
||||
}
|
||||
|
||||
g_PluginSys.SyncMaxClients(m_maxClients);
|
||||
|
||||
g_OnMapStarted = true;
|
||||
|
||||
g_Extensions.CallOnCoreMapStart(pEdictList, edictCount, m_maxClients);
|
||||
g_Extensions.CallOnCoreMapStart(pEdictList, edictCount, clientMax);
|
||||
m_onActivate->Execute(NULL);
|
||||
m_onActivate2->Execute(NULL);
|
||||
|
||||
@@ -291,10 +259,12 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
|
||||
{
|
||||
if ((*iter)->GetClientListenerVersion() >= 5)
|
||||
{
|
||||
(*iter)->OnServerActivated(m_maxClients);
|
||||
(*iter)->OnServerActivated(clientMax);
|
||||
}
|
||||
}
|
||||
|
||||
g_OnMapStarted = true;
|
||||
|
||||
SMGlobalClass *cls = SMGlobalClass::head;
|
||||
while (cls)
|
||||
{
|
||||
@@ -367,18 +337,11 @@ void PlayerManager::RunAuthChecks()
|
||||
{
|
||||
pPlayer = &m_Players[m_AuthQueue[i]];
|
||||
authstr = engine->GetPlayerNetworkIDString(pPlayer->m_pEdict);
|
||||
pPlayer->SetAuthString(authstr);
|
||||
|
||||
if (!pPlayer->IsAuthStringValidated())
|
||||
{
|
||||
continue; // we're using steam auth, and steam doesn't know about this player yet so we can't do anything about them for now
|
||||
}
|
||||
|
||||
if (authstr && authstr[0] != '\0'
|
||||
&& (strcmp(authstr, "STEAM_ID_PENDING") != 0))
|
||||
{
|
||||
/* Set authorization */
|
||||
pPlayer->Authorize();
|
||||
pPlayer->Authorize(authstr);
|
||||
|
||||
/* Mark as removed from queue */
|
||||
unsigned int client = m_AuthQueue[i];
|
||||
@@ -447,23 +410,7 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
|
||||
{
|
||||
int client = IndexOfEdict(pEntity);
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
++m_PlayersSinceActive;
|
||||
|
||||
pPlayer->Initialize(pszName, pszAddress, pEntity);
|
||||
|
||||
/* Get the client's language */
|
||||
if (m_QueryLang)
|
||||
{
|
||||
const char *name;
|
||||
if (!pPlayer->IsFakeClient() && (name=engine->GetClientConVarValue(client, "cl_language")))
|
||||
{
|
||||
unsigned int langid;
|
||||
pPlayer->m_LangId = (translator->GetLanguageByName(name, &langid)) ? langid : translator->GetServerLanguage();
|
||||
} else {
|
||||
pPlayer->m_LangId = translator->GetServerLanguage();
|
||||
}
|
||||
}
|
||||
|
||||
List<IClientListener *>::iterator iter;
|
||||
IClientListener *pListener = NULL;
|
||||
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
|
||||
@@ -471,12 +418,13 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
|
||||
pListener = (*iter);
|
||||
if (!pListener->InterceptClientConnect(client, reject, maxrejectlen))
|
||||
{
|
||||
RETURN_META_VALUE(MRES_SUPERCEDE, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
cell_t res = 1;
|
||||
|
||||
pPlayer->Initialize(pszName, pszAddress, pEntity);
|
||||
m_clconnect->PushCell(client);
|
||||
m_clconnect->PushStringEx(reject, maxrejectlen, SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
|
||||
m_clconnect->PushCell(maxrejectlen);
|
||||
@@ -530,8 +478,8 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
|
||||
}
|
||||
|
||||
cell_t res;
|
||||
m_clconnect_post->PushCell(client);
|
||||
m_clconnect_post->Execute(&res, NULL);
|
||||
OnClientConnected->PushCell(client);
|
||||
OnClientConnected->Execute(&res, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -553,70 +501,8 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
|
||||
/* Run manual connection routines */
|
||||
char error[255];
|
||||
const char *authid = engine->GetPlayerNetworkIDString(pEntity);
|
||||
pPlayer->SetAuthString(authid);
|
||||
pPlayer->Authorize();
|
||||
pPlayer->Authorize(authid);
|
||||
pPlayer->m_bFakeClient = true;
|
||||
|
||||
/*
|
||||
* While we're already filtered to just bots, we'll do other checks to
|
||||
* make sure that the requisite services are enabled and that the bots
|
||||
* have joined at the expected time.
|
||||
*
|
||||
* Checking playerinfo's IsHLTV and IsReplay would be better and less
|
||||
* error-prone but will always show false until later in the frame,
|
||||
* after PutInServer and Activate, and we want it now!
|
||||
*
|
||||
* These checks are hairy as hell due to differences between engines and games.
|
||||
*
|
||||
* Most engines use "Replay" and "SourceTV" as bot names for these when they're
|
||||
* created. EP2V, CSS and Nuclear Dawn (but not L4D2) differ from this by now using
|
||||
* replay_/tv_name directly when creating the bot(s). To complicate it slightly
|
||||
* further, the cvar can be empty and the engine's fallback to "unnamed" will be used.
|
||||
* We can maybe just rip out the name checks at some point and rely solely on whether
|
||||
* they're enabled and the join order.
|
||||
*/
|
||||
|
||||
// This doesn't actually get incremented until OnClientConnect. Fake it to check.
|
||||
int newCount = m_PlayersSinceActive + 1;
|
||||
|
||||
int userId = engine->GetPlayerUserId(pEntity);
|
||||
#if (SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_NUCLEARDAWN || SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
static ConVar *tv_name = icvar->FindVar("tv_name");
|
||||
#endif
|
||||
#if SOURCE_ENGINE == SE_TF2
|
||||
static ConVar *replay_name = icvar->FindVar("replay_name");
|
||||
#endif
|
||||
|
||||
#if SOURCE_ENGINE == SE_TF2
|
||||
if (m_bIsReplayActive && newCount == 1
|
||||
&& (m_ReplayUserId == userId
|
||||
|| (replay_name && strcmp(playername, replay_name->GetString()) == 0) || (replay_name && replay_name->GetString()[0] == 0 && strcmp(playername, "unnamed") == 0)
|
||||
)
|
||||
)
|
||||
{
|
||||
pPlayer->m_bIsReplay = true;
|
||||
m_ReplayUserId = userId;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m_bIsSourceTVActive
|
||||
&& ((!m_bIsReplayActive && newCount == 1)
|
||||
|| (m_bIsReplayActive && newCount == 2))
|
||||
&& (m_SourceTVUserId == userId
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
|| strcmp(playername, "GOTV") == 0
|
||||
#elif (SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_NUCLEARDAWN)
|
||||
|| (tv_name && strcmp(playername, tv_name->GetString()) == 0) || (tv_name && tv_name->GetString()[0] == 0 && strcmp(playername, "unnamed") == 0)
|
||||
#else
|
||||
|| strcmp(playername, "SourceTV") == 0
|
||||
#endif
|
||||
)
|
||||
)
|
||||
{
|
||||
pPlayer->m_bIsSourceTV = true;
|
||||
m_SourceTVUserId = userId;
|
||||
}
|
||||
|
||||
if (!OnClientConnect(pEntity, playername, "127.0.0.1", error, sizeof(error)))
|
||||
{
|
||||
/* :TODO: kick the bot if it's rejected */
|
||||
@@ -636,8 +522,8 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
|
||||
}
|
||||
|
||||
cell_t res;
|
||||
m_clconnect_post->PushCell(client);
|
||||
m_clconnect_post->Execute(&res, NULL);
|
||||
OnClientConnected->PushCell(client);
|
||||
OnClientConnected->Execute(&res, NULL);
|
||||
|
||||
/* Now do authorization */
|
||||
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
|
||||
@@ -660,6 +546,19 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
|
||||
pPlayer->m_Info = playerinfo->GetPlayerInfo(pEntity);
|
||||
}
|
||||
|
||||
/* Get the client's language */
|
||||
if (m_QueryLang)
|
||||
{
|
||||
const char *name;
|
||||
if (!pPlayer->IsFakeClient() && (name=engine->GetClientConVarValue(client, "cl_language")))
|
||||
{
|
||||
unsigned int langid;
|
||||
pPlayer->m_LangId = (g_Translator.GetLanguageByName(name, &langid)) ? langid : g_Translator.GetServerLanguage();
|
||||
} else {
|
||||
pPlayer->m_LangId = g_Translator.GetServerLanguage();
|
||||
}
|
||||
}
|
||||
|
||||
pPlayer->Connect();
|
||||
m_PlayerCount++;
|
||||
|
||||
@@ -793,30 +692,23 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
|
||||
g_PluginSys.ListPluginsToClient(pPlayer, args);
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
else if (args.ArgC() > 1 && strcmp(args.Arg(1), "exts") == 0)
|
||||
{
|
||||
g_Extensions.ListExtensionsToClient(pPlayer, args);
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
else if (args.ArgC() > 1 && strcmp(args.Arg(1), "credits") == 0)
|
||||
{
|
||||
ClientConsolePrint(pEntity,
|
||||
"SourceMod would not be possible without:");
|
||||
ClientConsolePrint(pEntity,
|
||||
" David \"BAILOPAN\" Anderson, Matt \"pRED\" Woodrow");
|
||||
ClientConsolePrint(pEntity,
|
||||
" Scott \"DS\" Ehlert, Fyren");
|
||||
ClientConsolePrint(pEntity,
|
||||
" Nicholas \"psychonic\" Hastings, Asher \"asherkin\" Baker");
|
||||
ClientConsolePrint(pEntity,
|
||||
" Borja \"faluco\" Ferrer, Pavol \"PM OnoTo\" Marko");
|
||||
"SourceMod would not be possible without:");
|
||||
ClientConsolePrint(pEntity,
|
||||
" David \"BAILOPAN\" Anderson, Borja \"faluco\" Ferrer");
|
||||
ClientConsolePrint(pEntity,
|
||||
" Scott \"DS\" Ehlert, Matt \"pRED\" Woodrow");
|
||||
ClientConsolePrint(pEntity,
|
||||
" Michael \"ferret\" McKoy, Pavol \"PM OnoTo\" Marko");
|
||||
ClientConsolePrint(pEntity,
|
||||
"SourceMod is open source under the GNU General Public License.");
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
|
||||
ClientConsolePrint(pEntity,
|
||||
"SourceMod %s, by AlliedModders LLC", SOURCEMOD_VERSION);
|
||||
"SourceMod %s, by AlliedModders LLC", SM_FULL_VERSION);
|
||||
ClientConsolePrint(pEntity,
|
||||
"To see running plugins, type \"sm plugins\"");
|
||||
ClientConsolePrint(pEntity,
|
||||
@@ -909,19 +801,6 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
|
||||
const char *new_name = info ? info->GetName() : engine->GetClientConVarValue(client, "name");
|
||||
const char *old_name = pPlayer->m_Name.c_str();
|
||||
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
const char *networkid_force;
|
||||
if ((networkid_force = engine->GetClientConVarValue(client, "networkid_force")) && networkid_force[0] != '\0')
|
||||
{
|
||||
unsigned int accountId = pPlayer->GetSteamAccountID();
|
||||
g_Logger.LogMessage("\"%s<%d><STEAM_1:%d:%d><>\" has bad networkid (id \"%s\") (ip \"%s\")",
|
||||
new_name, pPlayer->GetUserId(), accountId & 1, accountId >> 1, networkid_force, pPlayer->GetIPAddress());
|
||||
|
||||
pPlayer->Kick("NetworkID spoofing detected.");
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strcmp(old_name, new_name) != 0)
|
||||
{
|
||||
AdminId id = g_Admins.FindAdminByIdentity("name", new_name);
|
||||
@@ -929,9 +808,7 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
|
||||
{
|
||||
if (!CheckSetAdminName(client, pPlayer, id))
|
||||
{
|
||||
char kickMsg[128];
|
||||
logicore.CoreTranslate(kickMsg, sizeof(kickMsg), "%T", 2, NULL, "Name Reserved", &client);
|
||||
pPlayer->Kick(kickMsg);
|
||||
pPlayer->Kick("Your name is reserved by SourceMod; set your password to use it.");
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
} else if ((id = g_Admins.FindAdminByIdentity("name", old_name)) != INVALID_ADMIN_ID) {
|
||||
@@ -959,17 +836,6 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Notify Extensions */
|
||||
List<IClientListener *>::iterator iter;
|
||||
IClientListener *pListener = NULL;
|
||||
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
|
||||
{
|
||||
pListener = (*iter);
|
||||
if (pListener->GetClientListenerVersion() >= 13)
|
||||
{
|
||||
pListener->OnClientSettingsChanged(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int PlayerManager::GetMaxClients()
|
||||
@@ -1259,12 +1125,11 @@ void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!pTarget->IsConnected())
|
||||
if (!pTarget->IsConnected() || !pTarget->IsAuthorized())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const char *authstr = pTarget->GetAuthString(false); // We want to make it easy for people to be kicked/banned, so don't require validation for command targets.
|
||||
if (authstr && strcmp(authstr, new_pattern) == 0)
|
||||
if (strcmp(pTarget->GetAuthString(), new_pattern) == 0)
|
||||
{
|
||||
if ((info->reason = FilterCommandTarget(pAdmin, pTarget, info->flags))
|
||||
== COMMAND_TARGET_VALID)
|
||||
@@ -1374,7 +1239,7 @@ void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
|
||||
if ((info->flags & COMMAND_FILTER_NO_BOTS) == COMMAND_FILTER_NO_BOTS)
|
||||
{
|
||||
info->num_targets = 0;
|
||||
info->reason = COMMAND_TARGET_NOT_HUMAN;
|
||||
info->reason = COMMAND_FILTER_NO_BOTS;
|
||||
return;
|
||||
}
|
||||
strncopy(info->target_name, "all bots", info->target_name_maxlength);
|
||||
@@ -1440,7 +1305,7 @@ void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (logicore.stristr(pTarget->GetName(), info->pattern) != NULL)
|
||||
if (stristr(pTarget->GetName(), info->pattern) != NULL)
|
||||
{
|
||||
if (found_client)
|
||||
{
|
||||
@@ -1478,6 +1343,18 @@ void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerManager::OnConVarChanged( ConVar *pConVar, const char *oldValue, float flOldValue )
|
||||
{
|
||||
if (pConVar->GetBool() && !atoi(oldValue))
|
||||
{
|
||||
MaxPlayersChanged(gpGlobals->maxClients + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MaxPlayersChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerManager::OnSourceModMaxPlayersChanged( int newvalue )
|
||||
{
|
||||
m_maxClients = newvalue;
|
||||
@@ -1574,10 +1451,6 @@ CPlayer::CPlayer()
|
||||
m_LastPassword.clear();
|
||||
m_LangId = SOURCEMOD_LANGUAGE_ENGLISH;
|
||||
m_bFakeClient = false;
|
||||
m_bIsSourceTV = false;
|
||||
m_bIsReplay = false;
|
||||
m_Serial.value = -1;
|
||||
m_SteamAccountID = 0;
|
||||
}
|
||||
|
||||
void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
|
||||
@@ -1587,7 +1460,7 @@ void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
|
||||
m_Ip.assign(ip);
|
||||
m_pEdict = pEntity;
|
||||
m_iIndex = IndexOfEdict(pEntity);
|
||||
m_LangId = translator->GetServerLanguage();
|
||||
m_LangId = g_Translator.GetServerLanguage();
|
||||
|
||||
m_Serial.bits.index = m_iIndex;
|
||||
m_Serial.bits.serial = g_PlayerSerialCount++;
|
||||
@@ -1623,20 +1496,15 @@ void CPlayer::Connect()
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayer::SetAuthString(const char *steamid)
|
||||
void CPlayer::Authorize(const char *steamid)
|
||||
{
|
||||
if (m_IsAuthorized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_AuthID.assign(steamid);
|
||||
}
|
||||
|
||||
// Ensure a valid AuthString is set before calling.
|
||||
void CPlayer::Authorize()
|
||||
{
|
||||
m_IsAuthorized = true;
|
||||
m_AuthID.assign(steamid);
|
||||
}
|
||||
|
||||
void CPlayer::Disconnect()
|
||||
@@ -1654,10 +1522,6 @@ void CPlayer::Disconnect()
|
||||
m_UserId = -1;
|
||||
m_bIsInKickQueue = false;
|
||||
m_bFakeClient = false;
|
||||
m_bIsSourceTV = false;
|
||||
m_bIsReplay = false;
|
||||
m_Serial.value = -1;
|
||||
m_SteamAccountID = 0;
|
||||
}
|
||||
|
||||
void CPlayer::SetName(const char *name)
|
||||
@@ -1680,45 +1544,11 @@ const char *CPlayer::GetIPAddress()
|
||||
return m_Ip.c_str();
|
||||
}
|
||||
|
||||
const char *CPlayer::GetAuthString(bool validated)
|
||||
const char *CPlayer::GetAuthString()
|
||||
{
|
||||
if (validated && !IsAuthStringValidated())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return m_AuthID.c_str();
|
||||
}
|
||||
|
||||
unsigned int CPlayer::GetSteamAccountID(bool validated)
|
||||
{
|
||||
if (IsFakeClient() || (validated && !IsAuthStringValidated()))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (m_SteamAccountID != 0)
|
||||
{
|
||||
return m_SteamAccountID;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE < SE_ORANGEBOX
|
||||
const char * pAuth = GetAuthString();
|
||||
/* STEAM_0:1:123123 | STEAM_ID_LAN | STEAM_ID_PENDING */
|
||||
if (pAuth && (strlen(pAuth) > 10) && pAuth[8] != '_')
|
||||
{
|
||||
m_SteamAccountID = (atoi(&pAuth[8]) | (atoi(&pAuth[10]) << 1));
|
||||
}
|
||||
#else
|
||||
unsigned long long *steamId = (unsigned long long *)engine->GetClientSteamID(m_pEdict);
|
||||
if (steamId)
|
||||
{
|
||||
m_SteamAccountID = (*steamId & 0xFFFFFFFF);
|
||||
}
|
||||
#endif
|
||||
return m_SteamAccountID;
|
||||
}
|
||||
|
||||
edict_t *CPlayer::GetEdict()
|
||||
{
|
||||
return m_pEdict;
|
||||
@@ -1744,18 +1574,6 @@ bool CPlayer::IsAuthorized()
|
||||
return m_IsAuthorized;
|
||||
}
|
||||
|
||||
bool CPlayer::IsAuthStringValidated()
|
||||
{
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
if (g_Players.m_bAuthstringValidation && !g_HL2.IsLANServer())
|
||||
{
|
||||
return engine->IsClientFullyAuthenticated(m_pEdict);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
IPlayerInfo *CPlayer::GetPlayerInfo()
|
||||
{
|
||||
if (m_pEdict->GetUnknown())
|
||||
@@ -1771,16 +1589,6 @@ bool CPlayer::IsFakeClient()
|
||||
return m_bFakeClient;
|
||||
}
|
||||
|
||||
bool CPlayer::IsSourceTV() const
|
||||
{
|
||||
return m_bIsSourceTV;
|
||||
}
|
||||
|
||||
bool CPlayer::IsReplay() const
|
||||
{
|
||||
return m_bIsReplay;
|
||||
}
|
||||
|
||||
void CPlayer::SetAdminId(AdminId id, bool temporary)
|
||||
{
|
||||
if (!m_IsConnected)
|
||||
@@ -1830,11 +1638,7 @@ void CPlayer::Kick(const char *str)
|
||||
else
|
||||
{
|
||||
IClient *pClient = static_cast<IClient *>(pNetChan->GetMsgHandler());
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
pClient->Disconnect(str);
|
||||
#else
|
||||
pClient->Disconnect("%s", str);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1977,11 +1781,6 @@ unsigned int CPlayer::GetLanguageId()
|
||||
return m_LangId;
|
||||
}
|
||||
|
||||
void CPlayer::SetLanguageId(unsigned int id)
|
||||
{
|
||||
m_LangId = id;
|
||||
}
|
||||
|
||||
int CPlayer::GetUserId()
|
||||
{
|
||||
if (m_UserId == -1)
|
||||
|
||||
+7
-20
@@ -56,7 +56,7 @@ union serial_t
|
||||
uint32_t value;
|
||||
struct
|
||||
{
|
||||
uint32_t index : 8;
|
||||
uint8_t index;
|
||||
uint32_t serial : 24;
|
||||
} bits;
|
||||
};
|
||||
@@ -69,23 +69,19 @@ public:
|
||||
public:
|
||||
const char *GetName();
|
||||
const char *GetIPAddress();
|
||||
const char *GetAuthString(bool validated = true);
|
||||
unsigned int GetSteamAccountID(bool validated = true);
|
||||
const char *GetAuthString();
|
||||
edict_t *GetEdict();
|
||||
bool IsInGame();
|
||||
bool WasCountedAsInGame();
|
||||
bool IsConnected();
|
||||
bool IsAuthorized();
|
||||
bool IsFakeClient();
|
||||
bool IsSourceTV() const;
|
||||
bool IsReplay() const;
|
||||
void SetAdminId(AdminId id, bool temporary);
|
||||
AdminId GetAdminId();
|
||||
void Kick(const char *str);
|
||||
bool IsInKickQueue();
|
||||
IPlayerInfo *GetPlayerInfo();
|
||||
unsigned int GetLanguageId();
|
||||
void SetLanguageId(unsigned int id);
|
||||
int GetUserId();
|
||||
bool RunAdminCacheChecks();
|
||||
void NotifyPostAdminChecks();
|
||||
@@ -100,11 +96,9 @@ private:
|
||||
void Disconnect();
|
||||
void SetName(const char *name);
|
||||
void DumpAdmin(bool deleting);
|
||||
void SetAuthString(const char *auth);
|
||||
void Authorize();
|
||||
void Authorize(const char *auth);
|
||||
void Authorize_Post();
|
||||
void DoPostConnectAuthorization();
|
||||
bool IsAuthStringValidated();
|
||||
private:
|
||||
bool m_IsConnected;
|
||||
bool m_IsInGame;
|
||||
@@ -124,15 +118,13 @@ private:
|
||||
unsigned int m_LangId;
|
||||
int m_UserId;
|
||||
bool m_bFakeClient;
|
||||
bool m_bIsSourceTV;
|
||||
bool m_bIsReplay;
|
||||
serial_t m_Serial;
|
||||
unsigned int m_SteamAccountID;
|
||||
};
|
||||
|
||||
class PlayerManager :
|
||||
public SMGlobalClass,
|
||||
public IPlayerManager
|
||||
public IPlayerManager,
|
||||
public IConVarChangeListener
|
||||
{
|
||||
friend class CPlayer;
|
||||
public:
|
||||
@@ -177,6 +169,8 @@ public: //IPlayerManager
|
||||
void UnregisterCommandTargetProcessor(ICommandTargetProcessor *pHandler);
|
||||
void ProcessCommandTarget(cmd_target_info_t *info);
|
||||
int GetClientFromSerial(unsigned int serial);
|
||||
public: // IConVarChangeListener
|
||||
void OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue);
|
||||
public:
|
||||
inline int MaxClients()
|
||||
{
|
||||
@@ -203,7 +197,6 @@ private:
|
||||
private:
|
||||
List<IClientListener *> m_hooks;
|
||||
IForward *m_clconnect;
|
||||
IForward *m_clconnect_post;
|
||||
IForward *m_cldisconnect;
|
||||
IForward *m_cldisconnect_post;
|
||||
IForward *m_clputinserver;
|
||||
@@ -216,18 +209,12 @@ private:
|
||||
int *m_UserIdLookUp;
|
||||
int m_maxClients;
|
||||
int m_PlayerCount;
|
||||
int m_PlayersSinceActive;
|
||||
bool m_FirstPass;
|
||||
unsigned int *m_AuthQueue;
|
||||
String m_PassInfoVar;
|
||||
bool m_QueryLang;
|
||||
bool m_bAuthstringValidation; // are we validating admins with steam before authorizing?
|
||||
bool m_bIsListenServer;
|
||||
int m_ListenClient;
|
||||
bool m_bIsSourceTVActive;
|
||||
bool m_bIsReplayActive;
|
||||
int m_SourceTVUserId;
|
||||
int m_ReplayUserId;
|
||||
};
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
|
||||
+96
-114
@@ -44,7 +44,7 @@
|
||||
#include "ConCmdManager.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "CoreConfig.h"
|
||||
#include "logic_bridge.h"
|
||||
#include "Translator.h"
|
||||
|
||||
CPluginManager g_PluginSys;
|
||||
HandleType_t g_PluginType = 0;
|
||||
@@ -67,7 +67,7 @@ CPlugin::CPlugin(const char *file)
|
||||
m_FakeNativesMissing = false;
|
||||
m_LibraryMissing = false;
|
||||
m_bGotAllLoaded = false;
|
||||
m_pPhrases = translator->CreatePhraseCollection();
|
||||
m_pPhrases = g_Translator.CreatePhraseCollection();
|
||||
m_MaxClientsVar = NULL;
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ void CPlugin::Call_OnAllPluginsLoaded()
|
||||
pFunction->Execute(&result);
|
||||
}
|
||||
|
||||
if (g_SourceMod.IsMapRunning())
|
||||
if (g_OnMapStarted)
|
||||
{
|
||||
if ((pFunction = m_pRuntime->GetFunctionByName("OnMapStart")) != NULL)
|
||||
{
|
||||
@@ -501,14 +501,14 @@ void CPlugin::SetSilentlyFailed(bool sf)
|
||||
m_bSilentlyFailed = sf;
|
||||
}
|
||||
|
||||
void CPlugin::LibraryActions(LibraryAction action)
|
||||
void CPlugin::LibraryActions(bool dropping)
|
||||
{
|
||||
List<String>::iterator iter;
|
||||
for (iter = m_Libraries.begin();
|
||||
iter != m_Libraries.end();
|
||||
iter++)
|
||||
{
|
||||
g_PluginSys.OnLibraryAction((*iter).c_str(), action);
|
||||
g_PluginSys.OnLibraryAction((*iter).c_str(), true, dropping);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,7 +523,7 @@ bool CPlugin::SetPauseState(bool paused)
|
||||
|
||||
if (paused)
|
||||
{
|
||||
LibraryActions(LibraryAction_Removed);
|
||||
LibraryActions(true);
|
||||
}
|
||||
|
||||
IPluginFunction *pFunction = m_pRuntime->GetFunctionByName("OnPluginPauseChange");
|
||||
@@ -547,7 +547,7 @@ bool CPlugin::SetPauseState(bool paused)
|
||||
|
||||
if (!paused)
|
||||
{
|
||||
LibraryActions(LibraryAction_Added);
|
||||
LibraryActions(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -789,8 +789,6 @@ CPluginManager::CPluginManager()
|
||||
m_AllPluginsLoaded = false;
|
||||
m_MyIdent = NULL;
|
||||
m_LoadingLocked = false;
|
||||
|
||||
m_bBlockBadPlugins = true;
|
||||
}
|
||||
|
||||
CPluginManager::~CPluginManager()
|
||||
@@ -1007,14 +1005,11 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
|
||||
pPlugin->m_pRuntime = g_pSourcePawn2->LoadPlugin(co, fullpath, &err);
|
||||
if (pPlugin->m_pRuntime == NULL)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
UTIL_Format(error,
|
||||
maxlength,
|
||||
"Unable to load plugin (error %d: %s)",
|
||||
err,
|
||||
g_pSourcePawn2->GetErrorString(err));
|
||||
}
|
||||
UTIL_Format(error,
|
||||
maxlength,
|
||||
"Unable to load plugin (error %d: %s)",
|
||||
err,
|
||||
g_pSourcePawn2->GetErrorString(err));
|
||||
pPlugin->m_status = Plugin_BadLoad;
|
||||
}
|
||||
else
|
||||
@@ -1025,45 +1020,7 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
|
||||
}
|
||||
else
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
UTIL_Format(error, maxlength, "%s", pPlugin->m_errormsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pPlugin->GetStatus() == Plugin_Created)
|
||||
{
|
||||
unsigned char *pCodeHash = pPlugin->m_pRuntime->GetCodeHash();
|
||||
|
||||
char codeHashBuf[40];
|
||||
UTIL_Format(codeHashBuf, 40, "plugin_");
|
||||
for (int i = 0; i < 16; i++)
|
||||
UTIL_Format(codeHashBuf + 7 + (i * 2), 3, "%02x", pCodeHash[i]);
|
||||
|
||||
const char *bulletinUrl = g_pGameConf->GetKeyValue(codeHashBuf);
|
||||
if (bulletinUrl != NULL)
|
||||
{
|
||||
if (m_bBlockBadPlugins)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
if (bulletinUrl[0] != '\0')
|
||||
{
|
||||
UTIL_Format(error, maxlength, "Known malware detected and blocked. See %s for more info", bulletinUrl);
|
||||
} else {
|
||||
UTIL_Format(error, maxlength, "Possible malware or illegal plugin detected and blocked");
|
||||
}
|
||||
}
|
||||
pPlugin->m_status = Plugin_BadLoad;
|
||||
} else {
|
||||
if (bulletinUrl[0] != '\0')
|
||||
{
|
||||
g_Logger.LogMessage("%s: Known malware detected. See %s for more info, blocking disabled in core.cfg", pPlugin->GetFilename(), bulletinUrl);
|
||||
} else {
|
||||
g_Logger.LogMessage("%s: Possible malware or illegal plugin detected, blocking disabled in core.cfg", pPlugin->GetFilename());
|
||||
}
|
||||
UTIL_Format(error, maxlength, "%s", pPlugin->m_errormsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1166,7 +1123,7 @@ void CPluginManager::LoadAutoPlugin(const char *plugin)
|
||||
|
||||
if ((res=_LoadPlugin(&pl, plugin, false, PluginType_MapUpdated, error, sizeof(error))) == LoadRes_Failure)
|
||||
{
|
||||
g_Logger.LogError("[SM] Failed to load plugin \"%s\": %s.", plugin, error);
|
||||
g_Logger.LogError("[SM] Failed to load plugin \"%s\": %s", plugin, error);
|
||||
pl->SetErrorState(
|
||||
pl->GetStatus() <= Plugin_Created ? Plugin_BadLoad : pl->GetStatus(),
|
||||
"%s",
|
||||
@@ -1351,8 +1308,7 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass
|
||||
if (ext->autoload)
|
||||
{
|
||||
g_LibSys.PathFormat(path, PLATFORM_MAX_PATH, "%s", file);
|
||||
bool bErrorOnMissing = ext->required ? true : false;
|
||||
g_Extensions.LoadAutoExtension(path, bErrorOnMissing);
|
||||
g_Extensions.LoadAutoExtension(path);
|
||||
}
|
||||
}
|
||||
else if (pass == 2)
|
||||
@@ -1495,7 +1451,7 @@ bool CPluginManager::RunSecondPass(CPlugin *pPlugin, char *error, size_t maxleng
|
||||
s_iter != pPlugin->m_Libraries.end();
|
||||
s_iter++)
|
||||
{
|
||||
OnLibraryAction((*s_iter).c_str(), LibraryAction_Added);
|
||||
OnLibraryAction((*s_iter).c_str(), true, false);
|
||||
}
|
||||
|
||||
/* :TODO: optimize? does this even matter? */
|
||||
@@ -1547,9 +1503,7 @@ void CPluginManager::TryRefreshDependencies(CPlugin *pPlugin)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (native->status == SP_NATIVE_UNBOUND
|
||||
&& native->name[0] != '@'
|
||||
&& !(native->flags & SP_NTVFLAG_OPTIONAL))
|
||||
if (native->status == SP_NATIVE_UNBOUND && !(native->flags & SP_NTVFLAG_OPTIONAL))
|
||||
{
|
||||
pPlugin->SetErrorState(Plugin_Error, "Native not found: %s", native->name);
|
||||
return;
|
||||
@@ -1597,7 +1551,7 @@ bool CPluginManager::UnloadPlugin(IPlugin *plugin)
|
||||
s_iter != pPlugin->m_Libraries.end();
|
||||
s_iter++)
|
||||
{
|
||||
OnLibraryAction((*s_iter).c_str(), LibraryAction_Removed);
|
||||
OnLibraryAction((*s_iter).c_str(), true, true);
|
||||
}
|
||||
|
||||
List<IPluginsListener *>::iterator iter;
|
||||
@@ -1605,15 +1559,14 @@ bool CPluginManager::UnloadPlugin(IPlugin *plugin)
|
||||
|
||||
if (pPlugin->GetStatus() <= Plugin_Error)
|
||||
{
|
||||
/* Notify plugin */
|
||||
pPlugin->Call_OnPluginEnd();
|
||||
|
||||
/* Notify listeners of unloading */
|
||||
for (iter=m_listeners.begin(); iter!=m_listeners.end(); iter++)
|
||||
{
|
||||
pListener = (*iter);
|
||||
pListener->OnPluginUnloaded(pPlugin);
|
||||
}
|
||||
/* Notify plugin */
|
||||
pPlugin->Call_OnPluginEnd();
|
||||
}
|
||||
|
||||
pPlugin->DropEverything();
|
||||
@@ -1914,9 +1867,6 @@ void CPluginManager::OnSourceModAllInitialized()
|
||||
g_RootMenu.AddRootConsoleCommand("plugins", "Manage Plugins", this);
|
||||
|
||||
g_ShareSys.AddInterface(NULL, this);
|
||||
|
||||
m_pOnLibraryAdded = g_Forwards.CreateForward("OnLibraryAdded", ET_Ignore, 1, NULL, Param_String);
|
||||
m_pOnLibraryRemoved = g_Forwards.CreateForward("OnLibraryRemoved", ET_Ignore, 1, NULL, Param_String);
|
||||
}
|
||||
|
||||
void CPluginManager::OnSourceModShutdown()
|
||||
@@ -1928,30 +1878,6 @@ void CPluginManager::OnSourceModShutdown()
|
||||
g_HandleSys.RemoveType(g_PluginType, m_MyIdent);
|
||||
g_ShareSys.DestroyIdentType(g_PluginIdent);
|
||||
g_ShareSys.DestroyIdentity(m_MyIdent);
|
||||
|
||||
g_Forwards.ReleaseForward(m_pOnLibraryAdded);
|
||||
g_Forwards.ReleaseForward(m_pOnLibraryRemoved);
|
||||
}
|
||||
|
||||
ConfigResult CPluginManager::OnSourceModConfigChanged(const char *key,
|
||||
const char *value,
|
||||
ConfigSource source,
|
||||
char *error,
|
||||
size_t maxlength)
|
||||
{
|
||||
if (strcmp(key, "BlockBadPlugins") == 0) {
|
||||
if (strcasecmp(value, "yes") == 0)
|
||||
{
|
||||
m_bBlockBadPlugins = true;
|
||||
} else if (strcasecmp(value, "no") == 0) {
|
||||
m_bBlockBadPlugins = false;
|
||||
} else {
|
||||
UTIL_Format(error, maxlength, "Invalid value: must be \"yes\" or \"no\"");
|
||||
return ConfigResult_Reject;
|
||||
}
|
||||
return ConfigResult_Accept;
|
||||
}
|
||||
return ConfigResult_Ignore;
|
||||
}
|
||||
|
||||
void CPluginManager::OnHandleDestroy(HandleType_t type, void *object)
|
||||
@@ -2334,15 +2260,6 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
{
|
||||
g_RootMenu.ConsolePrint(" Timestamp: %s", pl->m_DateTime);
|
||||
}
|
||||
|
||||
unsigned char *pCodeHash = pl->m_pRuntime->GetCodeHash();
|
||||
unsigned char *pDataHash = pl->m_pRuntime->GetDataHash();
|
||||
|
||||
char combinedHash[33];
|
||||
for (int i = 0; i < 16; i++)
|
||||
UTIL_Format(combinedHash + (i * 2), 3, "%02x", pCodeHash[i] ^ pDataHash[i]);
|
||||
|
||||
g_RootMenu.ConsolePrint(" Hash: %s", combinedHash);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2557,18 +2474,83 @@ CPlugin *CPluginManager::GetPluginFromIdentity(IdentityToken_t *pToken)
|
||||
return (CPlugin *)(pToken->ptr);
|
||||
}
|
||||
|
||||
void CPluginManager::OnLibraryAction(const char *lib, LibraryAction action)
|
||||
void CPluginManager::OnLibraryAction(const char *lib, bool is_a_plugin, bool drop)
|
||||
{
|
||||
switch (action)
|
||||
List<CPlugin *>::iterator iter;
|
||||
|
||||
struct _pl
|
||||
{
|
||||
case LibraryAction_Removed:
|
||||
m_pOnLibraryRemoved->PushString(lib);
|
||||
m_pOnLibraryRemoved->Execute(NULL);
|
||||
break;
|
||||
case LibraryAction_Added:
|
||||
m_pOnLibraryAdded->PushString(lib);
|
||||
m_pOnLibraryAdded->Execute(NULL);
|
||||
break;
|
||||
cell_t name;
|
||||
cell_t file;
|
||||
cell_t required;
|
||||
} *plc;
|
||||
|
||||
struct _ext
|
||||
{
|
||||
cell_t name;
|
||||
cell_t file;
|
||||
cell_t autoload;
|
||||
cell_t required;
|
||||
} *ext;
|
||||
|
||||
const char *name = drop ? "OnLibraryRemoved" : "OnLibraryAdded";
|
||||
|
||||
for (iter=m_plugins.begin();
|
||||
iter!=m_plugins.end();
|
||||
iter++)
|
||||
{
|
||||
CPlugin *pl = (*iter);
|
||||
if (pl->GetStatus() != Plugin_Running)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
IPluginContext *pContext = pl->GetBaseContext();
|
||||
IPluginFunction *pf = pContext->GetFunctionByName(name);
|
||||
if (!pf)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
uint32_t num_vars = pContext->GetPubVarsNum();
|
||||
for (uint32_t i=0; i<num_vars; i++)
|
||||
{
|
||||
sp_pubvar_t *pubvar;
|
||||
if (pContext->GetPubvarByIndex(i, &pubvar) != SP_ERROR_NONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (is_a_plugin && strncmp(pubvar->name, "__pl_", 5) == 0)
|
||||
{
|
||||
plc = (_pl *)pubvar->offs;
|
||||
if (plc->required)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
char *str;
|
||||
pContext->LocalToString(plc->name, &str);
|
||||
if (strcmp(str, lib) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
pf->PushString(lib);
|
||||
pf->Execute(NULL);
|
||||
}
|
||||
else if (!is_a_plugin && strncmp(pubvar->name, "__ext_", 6) == 0)
|
||||
{
|
||||
ext = (_ext *)pubvar->offs;
|
||||
if (ext->required)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
char *str;
|
||||
pContext->LocalToString(ext->name, &str);
|
||||
if (strcmp(str, lib) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
pf->PushString(lib);
|
||||
pf->Execute(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2759,6 +2741,6 @@ void CPluginManager::ListPluginsToClient(CPlayer *player, const CCommand &args)
|
||||
/* Do we actually have more plugins? */
|
||||
if (iter != m_plugins.end())
|
||||
{
|
||||
ClientConsolePrint(e, "To see more, type \"sm plugins %d\"", id);
|
||||
ClientConsolePrint(e, "To see more, type \"sm plugins %d\"", id + 1);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-23
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -47,17 +47,14 @@
|
||||
#include "sm_trie.h"
|
||||
#include "sourcemod.h"
|
||||
#include <IRootConsoleMenu.h>
|
||||
#if SOURCE_ENGINE >= SE_ALIENSWARM
|
||||
#include "convar_sm_swarm.h"
|
||||
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#include "convar_sm_l4d.h"
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#elif (SOURCE_ENGINE == SE_ORANGEBOX) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE)
|
||||
#include "convar_sm_ob.h"
|
||||
#else
|
||||
#include "convar_sm.h"
|
||||
#endif
|
||||
#include "ITranslator.h"
|
||||
#include "IGameConfigs.h"
|
||||
#include "NativeOwner.h"
|
||||
#include "ShareSys.h"
|
||||
|
||||
@@ -131,12 +128,6 @@ enum APLRes
|
||||
APLRes_SilentFailure
|
||||
};
|
||||
|
||||
enum LibraryAction
|
||||
{
|
||||
LibraryAction_Removed,
|
||||
LibraryAction_Added
|
||||
};
|
||||
|
||||
struct AutoConfig
|
||||
{
|
||||
String autocfg;
|
||||
@@ -256,7 +247,7 @@ public:
|
||||
{
|
||||
m_Libraries.push_back(name);
|
||||
}
|
||||
void LibraryActions(LibraryAction action);
|
||||
void LibraryActions(bool dropping);
|
||||
void SyncMaxClients(int max_clients);
|
||||
protected:
|
||||
bool UpdateInfo();
|
||||
@@ -333,7 +324,6 @@ public: //IPluginManager
|
||||
public: //SMGlobalClass
|
||||
void OnSourceModAllInitialized();
|
||||
void OnSourceModShutdown();
|
||||
ConfigResult OnSourceModConfigChanged(const char *key, const char *value, ConfigSource source, char *error, size_t maxlength);
|
||||
void OnSourceModMaxPlayersChanged(int newvalue);
|
||||
public: //IHandleTypeDispatch
|
||||
void OnHandleDestroy(HandleType_t type, void *object);
|
||||
@@ -409,7 +399,7 @@ public:
|
||||
|
||||
void Shutdown();
|
||||
|
||||
void OnLibraryAction(const char *lib, LibraryAction action);
|
||||
void OnLibraryAction(const char *lib, bool is_a_plugin, bool drop);
|
||||
|
||||
bool LibraryExists(const char *lib);
|
||||
|
||||
@@ -478,16 +468,8 @@ private:
|
||||
List<FakeNative *> m_Natives;
|
||||
|
||||
bool m_LoadingLocked;
|
||||
|
||||
// Config
|
||||
bool m_bBlockBadPlugins;
|
||||
|
||||
// Forwards
|
||||
IForward *m_pOnLibraryAdded;
|
||||
IForward *m_pOnLibraryRemoved;
|
||||
};
|
||||
|
||||
extern CPluginManager g_PluginSys;
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_PLUGINSYSTEM_H_
|
||||
|
||||
|
||||
+1
-1
@@ -78,11 +78,11 @@ public: //ITimerSystem
|
||||
float GetTickedTime();
|
||||
void NotifyOfGameStart(float offset /* = 0.0f */);
|
||||
bool GetMapTimeLeft(float *pTime);
|
||||
IMapTimer *GetMapTimer();
|
||||
public:
|
||||
void RunFrame();
|
||||
void RemoveMapChangeTimers();
|
||||
void GameFrame(bool simulating);
|
||||
IMapTimer *GetMapTimer();
|
||||
private:
|
||||
List<ITimer *> m_SingleTimers;
|
||||
List<ITimer *> m_LoopTimers;
|
||||
|
||||
@@ -29,24 +29,22 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <sm_platform.h>
|
||||
#include "Translator.h"
|
||||
#include <IPlayerHelpers.h>
|
||||
#include <ISourceMod.h>
|
||||
#include <ILibrarySys.h>
|
||||
#include "Logger.h"
|
||||
#include "LibrarySys.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "sourcemod.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "PhraseCollection.h"
|
||||
#include "stringutil.h"
|
||||
#include "ShareSys.h"
|
||||
|
||||
Translator g_Translator;
|
||||
IPhraseCollection *g_pCorePhrases = NULL;
|
||||
unsigned int g_pCorePhraseID = 0;
|
||||
|
||||
using namespace SourceMod;
|
||||
|
||||
struct trans_t
|
||||
{
|
||||
int stridx;
|
||||
@@ -69,10 +67,15 @@ CPhraseFile::CPhraseFile(Translator *pTranslator, const char *file)
|
||||
m_LangCount = pTranslator->GetLanguageCount();
|
||||
m_File.assign(file);
|
||||
m_pTranslator = pTranslator;
|
||||
m_pPhraseLookup = NULL;
|
||||
}
|
||||
|
||||
CPhraseFile::~CPhraseFile()
|
||||
{
|
||||
if (m_pPhraseLookup)
|
||||
{
|
||||
sm_trie_destroy(m_pPhraseLookup);
|
||||
}
|
||||
}
|
||||
|
||||
void CPhraseFile::ParseError(const char *message, ...)
|
||||
@@ -96,16 +99,20 @@ void CPhraseFile::ParseWarning(const char *message, ...)
|
||||
|
||||
if (!m_FileLogged)
|
||||
{
|
||||
smcore.LogError("[SM] Warning(s) encountered in translation file \"%s\"", m_File.c_str());
|
||||
g_Logger.LogError("[SM] Warning(s) encountered in translation file \"%s\"", m_File.c_str());
|
||||
m_FileLogged = true;
|
||||
}
|
||||
|
||||
smcore.LogError("[SM] %s", buffer);
|
||||
g_Logger.LogError("[SM] %s", buffer);
|
||||
}
|
||||
|
||||
void CPhraseFile::ReparseFile()
|
||||
{
|
||||
m_PhraseLookup.clear();
|
||||
if (m_pPhraseLookup)
|
||||
{
|
||||
sm_trie_destroy(m_pPhraseLookup);
|
||||
}
|
||||
m_pPhraseLookup = sm_trie_create();
|
||||
|
||||
m_LangCount = m_pTranslator->GetLanguageCount();
|
||||
|
||||
@@ -116,19 +123,19 @@ void CPhraseFile::ReparseFile()
|
||||
|
||||
SMCError err;
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
g_pSM->BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "translations/%s", m_File.c_str());
|
||||
g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "translations/%s", m_File.c_str());
|
||||
|
||||
//backwards compatibility shim
|
||||
/* :HACKHACK: Change .cfg/.txt and vice versa for compatibility */
|
||||
if (!libsys->PathExists(path))
|
||||
if (!g_LibSys.PathExists(path))
|
||||
{
|
||||
if (m_File.compare("common.cfg") == 0)
|
||||
{
|
||||
UTIL_ReplaceAll(path, sizeof(path), "common.cfg", "common.phrases.txt", true);
|
||||
UTIL_ReplaceAll(path, sizeof(path), "common.cfg", "common.phrases.txt");
|
||||
} else if (strstr(path, ".cfg")) {
|
||||
UTIL_ReplaceAll(path, sizeof(path), ".cfg", ".txt", true);
|
||||
UTIL_ReplaceAll(path, sizeof(path), ".cfg", ".txt");
|
||||
} else if (strstr(path, ".txt")) {
|
||||
UTIL_ReplaceAll(path, sizeof(path), ".txt", ".cfg", true);
|
||||
UTIL_ReplaceAll(path, sizeof(path), ".txt", ".cfg");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,8 +149,8 @@ void CPhraseFile::ReparseFile()
|
||||
msg = m_ParseError.c_str();
|
||||
}
|
||||
|
||||
smcore.LogError("[SM] Fatal error encountered parsing translation file \"%s\"", m_File.c_str());
|
||||
smcore.LogError("[SM] Error (line %d, column %d): %s", states.line, states.col, msg);
|
||||
g_Logger.LogError("[SM] Fatal error encountered parsing translation file \"%s\"", m_File.c_str());
|
||||
g_Logger.LogError("[SM] Error (line %d, column %d): %s", states.line, states.col, msg);
|
||||
}
|
||||
|
||||
const char *code;
|
||||
@@ -154,7 +161,7 @@ void CPhraseFile::ReparseFile()
|
||||
continue;
|
||||
}
|
||||
|
||||
g_pSM->BuildPath(Path_SM,
|
||||
g_SourceMod.BuildPath(Path_SM,
|
||||
path,
|
||||
PLATFORM_MAX_PATH,
|
||||
"translations/%s/%s",
|
||||
@@ -162,7 +169,7 @@ void CPhraseFile::ReparseFile()
|
||||
m_File.c_str());
|
||||
|
||||
/* Speculatively load these. */
|
||||
if (!libsys->PathExists(path))
|
||||
if (!g_LibSys.PathExists(path))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -175,10 +182,10 @@ void CPhraseFile::ReparseFile()
|
||||
msg = m_ParseError.c_str();
|
||||
}
|
||||
|
||||
smcore.LogError("[SM] Fatal error encountered parsing translation file \"%s/%s\"",
|
||||
g_Logger.LogError("[SM] Fatal error encountered parsing translation file \"%s/%s\"",
|
||||
code,
|
||||
m_File.c_str());
|
||||
smcore.LogError("[SM] Error (line %d, column %d): %s",
|
||||
g_Logger.LogError("[SM] Error (line %d, column %d): %s",
|
||||
states.line,
|
||||
states.col,
|
||||
msg);
|
||||
@@ -210,17 +217,17 @@ SMCResult CPhraseFile::ReadSMC_NewSection(const SMCStates *states, const char *n
|
||||
m_ParseState = PPS_InPhrase;
|
||||
recognized = true;
|
||||
|
||||
int *pvalue;
|
||||
if ((pvalue = m_PhraseLookup.retrieve(name)) != NULL)
|
||||
void *value;
|
||||
if (sm_trie_retrieve(m_pPhraseLookup, name, &value))
|
||||
{
|
||||
m_CurPhrase = *pvalue;
|
||||
m_CurPhrase = reinterpret_cast<int>(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
phrase_t *pPhrase;
|
||||
|
||||
m_CurPhrase = m_pMemory->CreateMem(sizeof(phrase_t), (void **)&pPhrase);
|
||||
m_PhraseLookup.insert(name, m_CurPhrase);
|
||||
sm_trie_insert(m_pPhraseLookup, name, reinterpret_cast<void *>(m_CurPhrase));
|
||||
|
||||
/* Initialize new phrase */
|
||||
trans_t *pTrans;
|
||||
@@ -479,6 +486,13 @@ SMCResult CPhraseFile::ReadSMC_KeyValue(const SMCStates *states, const char *key
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t len = strlen(key);
|
||||
if (len < 2 || len > 3)
|
||||
{
|
||||
ParseWarning("Ignoring translation to invalid language \"%s\" on line %d.", key, states->line);
|
||||
return SMCResult_Continue;
|
||||
}
|
||||
|
||||
unsigned int lang;
|
||||
if (!m_pTranslator->GetLanguageByCode(key, &lang))
|
||||
{
|
||||
@@ -491,7 +505,7 @@ SMCResult CPhraseFile::ReadSMC_KeyValue(const SMCStates *states, const char *key
|
||||
/* See how many bytes we need for this string, then allocate.
|
||||
* NOTE: THIS SHOULD GUARANTEE THAT WE DO NOT NEED TO NEED TO SIZE CHECK
|
||||
*/
|
||||
size_t len = strlen(value) + pPhrase->fmt_bytes + 1;
|
||||
len = strlen(value) + pPhrase->fmt_bytes + 1;
|
||||
char *out_buf;
|
||||
int out_idx;
|
||||
|
||||
@@ -625,7 +639,9 @@ SMCResult CPhraseFile::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
if (m_ParseState == PPS_InPhrase)
|
||||
{
|
||||
if (m_CurPhrase == -1 && m_LastPhraseString.size())
|
||||
m_PhraseLookup.remove(m_LastPhraseString.c_str());
|
||||
{
|
||||
sm_trie_delete(m_pPhraseLookup, m_LastPhraseString.c_str());
|
||||
}
|
||||
m_CurPhrase = -1;
|
||||
m_ParseState = PPS_Phrases;
|
||||
m_LastPhraseString.assign("");
|
||||
@@ -642,7 +658,9 @@ void CPhraseFile::ReadSMC_ParseEnd(bool halted, bool failed)
|
||||
{
|
||||
/* Check to see if we have any dangling phrases that weren't completed, and scrap them */
|
||||
if ((halted || failed) && m_LastPhraseString.size())
|
||||
m_PhraseLookup.remove(m_LastPhraseString.c_str());
|
||||
{
|
||||
sm_trie_delete(m_pPhraseLookup, m_LastPhraseString.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
TransError CPhraseFile::GetTranslation(const char *szPhrase, unsigned int lang_id, Translation *pTrans)
|
||||
@@ -652,11 +670,13 @@ TransError CPhraseFile::GetTranslation(const char *szPhrase, unsigned int lang_i
|
||||
return Trans_BadLanguage;
|
||||
}
|
||||
|
||||
int *pvalue;
|
||||
if ((pvalue = m_PhraseLookup.retrieve(szPhrase)) == NULL)
|
||||
void *object;
|
||||
if (!sm_trie_retrieve(m_pPhraseLookup, szPhrase, &object))
|
||||
{
|
||||
return Trans_BadPhrase;
|
||||
}
|
||||
|
||||
phrase_t *pPhrase = (phrase_t *)m_pMemory->GetAddress(*pvalue);
|
||||
phrase_t *pPhrase = (phrase_t *)m_pMemory->GetAddress(reinterpret_cast<int>(object));
|
||||
trans_t *trans = (trans_t *)m_pMemory->GetAddress(pPhrase->trans_tbl);
|
||||
|
||||
trans = &trans[lang_id];
|
||||
@@ -685,6 +705,7 @@ const char *CPhraseFile::GetFilename()
|
||||
Translator::Translator() : m_ServerLang(SOURCEMOD_LANGUAGE_ENGLISH)
|
||||
{
|
||||
m_pStringTab = new BaseStringTable(2048);
|
||||
m_pLCodeLookup = sm_trie_create();
|
||||
strncopy(m_InitialLang, "en", sizeof(m_InitialLang));
|
||||
}
|
||||
|
||||
@@ -700,6 +721,8 @@ Translator::~Translator()
|
||||
delete m_Languages[i];
|
||||
}
|
||||
|
||||
sm_trie_destroy(m_pLCodeLookup);
|
||||
|
||||
delete m_pStringTab;
|
||||
}
|
||||
|
||||
@@ -716,13 +739,13 @@ ConfigResult Translator::OnSourceModConfigChanged(const char *key,
|
||||
unsigned int index;
|
||||
if (!GetLanguageByCode(value, &index))
|
||||
{
|
||||
smcore.Format(error, maxlength, "Language code \"%s\" is not registered", value);
|
||||
UTIL_Format(error, maxlength, "Language code \"%s\" is not registered", value);
|
||||
return ConfigResult_Reject;
|
||||
}
|
||||
|
||||
m_ServerLang = index;
|
||||
} else {
|
||||
smcore.strncopy(m_InitialLang, value, sizeof(m_InitialLang));
|
||||
strncopy(m_InitialLang, value, sizeof(m_InitialLang));
|
||||
}
|
||||
|
||||
return ConfigResult_Accept;
|
||||
@@ -735,7 +758,7 @@ void Translator::OnSourceModLevelChange(const char *mapName)
|
||||
{
|
||||
/* Refresh language stuff */
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
g_pSM->BuildPath(Path_SM, path, sizeof(path), "configs/languages.cfg");
|
||||
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "configs/languages.cfg");
|
||||
RebuildLanguageDatabase(path);
|
||||
}
|
||||
|
||||
@@ -743,16 +766,10 @@ void Translator::OnSourceModAllInitialized()
|
||||
{
|
||||
AddLanguage("en", "English");
|
||||
|
||||
const char* lang = smcore.GetCoreConfigValue("ServerLang");
|
||||
if (lang)
|
||||
{
|
||||
strncpy(m_InitialLang, lang, sizeof(m_InitialLang));
|
||||
}
|
||||
|
||||
g_pCorePhrases = CreatePhraseCollection();
|
||||
g_pCorePhrases->AddPhraseFile("core.phrases");
|
||||
|
||||
sharesys->AddInterface(NULL, this);
|
||||
g_ShareSys.AddInterface(NULL, this);
|
||||
}
|
||||
|
||||
void Translator::OnSourceModShutdown()
|
||||
@@ -762,38 +779,43 @@ void Translator::OnSourceModShutdown()
|
||||
|
||||
bool Translator::GetLanguageByCode(const char *code, unsigned int *index)
|
||||
{
|
||||
unsigned int *pindex;
|
||||
void *_index;
|
||||
|
||||
if ((pindex = m_LCodeLookup.retrieve(code)) == NULL)
|
||||
if (!sm_trie_retrieve(m_pLCodeLookup, code, &_index))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (index)
|
||||
*index = *pindex;
|
||||
{
|
||||
*index = reinterpret_cast<unsigned int>(_index);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Translator::GetLanguageByName(const char *name, unsigned int *index)
|
||||
{
|
||||
char lower[256];
|
||||
size_t len = strlen(name);
|
||||
if (len > 255) len = 255;
|
||||
for (size_t i = 0; i < len; i++)
|
||||
CVector<Language *>::iterator iter;
|
||||
unsigned int id = 0;
|
||||
|
||||
for (iter=m_Languages.begin(); iter!=m_Languages.end(); iter++, id++)
|
||||
{
|
||||
if (name[i] >= 'A' && name[i] <= 'Z')
|
||||
lower[i] = tolower(name[i]);
|
||||
else
|
||||
lower[i] = name[i];
|
||||
if (strcasecmp(m_pStringTab->GetString((*iter)->m_FullName), name) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
lower[len] = '\0';
|
||||
|
||||
unsigned int *pIndex;
|
||||
|
||||
if ((pIndex = m_LAliases.retrieve(lower)) == NULL)
|
||||
if (iter == m_Languages.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (index)
|
||||
*index = *pIndex;
|
||||
{
|
||||
*index = id;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -831,8 +853,8 @@ unsigned int Translator::FindOrAddPhraseFile(const char *phrase_file)
|
||||
void Translator::RebuildLanguageDatabase(const char *lang_header_file)
|
||||
{
|
||||
/* Erase everything we have */
|
||||
m_LCodeLookup.clear();
|
||||
m_LAliases.clear();
|
||||
sm_trie_destroy(m_pLCodeLookup);
|
||||
m_pLCodeLookup = sm_trie_create();
|
||||
m_pStringTab->Reset();
|
||||
|
||||
for (size_t i=0; i<m_Languages.size(); i++)
|
||||
@@ -852,27 +874,25 @@ void Translator::RebuildLanguageDatabase(const char *lang_header_file)
|
||||
str_err = m_CustomError.c_str();
|
||||
}
|
||||
|
||||
smcore.LogError("[SM] Failed to parse language header file: \"%s\"", lang_header_file);
|
||||
smcore.LogError("[SM] Parse error (line %d, column %d): %s", states.line, states.col, str_err);
|
||||
g_Logger.LogError("[SM] Failed to parse language header file: \"%s\"", lang_header_file);
|
||||
g_Logger.LogError("[SM] Parse error (line %d, column %d): %s", states.line, states.col, str_err);
|
||||
}
|
||||
|
||||
unsigned int *pServerLang;
|
||||
void *serverLang;
|
||||
|
||||
if ((pServerLang = m_LCodeLookup.retrieve(m_InitialLang)) == NULL)
|
||||
if (!sm_trie_retrieve(m_pLCodeLookup, m_InitialLang, &serverLang))
|
||||
{
|
||||
smcore.LogError("Server language was set to bad language \"%s\" -- reverting to English", m_InitialLang);
|
||||
g_Logger.LogError("Server language was set to bad language \"%s\" -- reverting to English", m_InitialLang);
|
||||
|
||||
smcore.strncopy(m_InitialLang, "en", sizeof(m_InitialLang));
|
||||
strncopy(m_InitialLang, "en", sizeof(m_InitialLang));
|
||||
m_ServerLang = SOURCEMOD_LANGUAGE_ENGLISH;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ServerLang = *pServerLang;
|
||||
}
|
||||
|
||||
m_ServerLang = reinterpret_cast<unsigned int>(serverLang);
|
||||
|
||||
if (!m_Languages.size())
|
||||
{
|
||||
smcore.LogError("[SM] Fatal error, no languages found! Translation will not work.");
|
||||
g_Logger.LogError("[SM] Fatal error, no languages found! Translation will not work.");
|
||||
}
|
||||
|
||||
for (size_t i=0; i<m_Files.size(); i++)
|
||||
@@ -899,7 +919,7 @@ SMCResult Translator::ReadSMC_NewSection(const SMCStates *states, const char *na
|
||||
|
||||
if (!m_InLanguageSection)
|
||||
{
|
||||
smcore.LogError("[SM] Warning: Unrecognized section \"%s\" in languages.cfg", name);
|
||||
g_Logger.LogError("[SM] Warning: Unrecognized section \"%s\" in languages.cfg", name);
|
||||
}
|
||||
|
||||
return SMCResult_Continue;
|
||||
@@ -914,6 +934,14 @@ SMCResult Translator::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
|
||||
SMCResult Translator::ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value)
|
||||
{
|
||||
size_t len = strlen(key);
|
||||
|
||||
if (len < 2 || len > 3)
|
||||
{
|
||||
g_Logger.LogError("[SM] Warning encountered parsing languages.cfg file.");
|
||||
g_Logger.LogError("[SM] Invalid language code \"%s\" is being ignored.", key);
|
||||
}
|
||||
|
||||
AddLanguage(key, value);
|
||||
|
||||
return SMCResult_Continue;
|
||||
@@ -921,40 +949,20 @@ SMCResult Translator::ReadSMC_KeyValue(const SMCStates *states, const char *key,
|
||||
|
||||
bool Translator::AddLanguage(const char *langcode, const char *description)
|
||||
{
|
||||
char lower[256];
|
||||
size_t len = strlen(description);
|
||||
if (len > 255) len = 255;
|
||||
for (size_t i = 0; i < len; i++)
|
||||
if (sm_trie_retrieve(m_pLCodeLookup, langcode, NULL))
|
||||
{
|
||||
if (description[i] >= 'A' && description[i] <= 'Z')
|
||||
lower[i] = tolower(description[i]);
|
||||
else
|
||||
lower[i] = description[i];
|
||||
}
|
||||
lower[len] = '\0';
|
||||
|
||||
if (m_LAliases.retrieve(lower))
|
||||
return false;
|
||||
|
||||
unsigned int idx;
|
||||
if (unsigned int *pIdx = m_LCodeLookup.retrieve(langcode))
|
||||
{
|
||||
idx = *pIdx;
|
||||
}
|
||||
else
|
||||
{
|
||||
Language *pLanguage = new Language;
|
||||
idx = m_Languages.size();
|
||||
|
||||
smcore.Format(pLanguage->m_code2, sizeof(pLanguage->m_code2), "%s", langcode);
|
||||
pLanguage->m_CanonicalName = m_pStringTab->AddString(lower);
|
||||
Language *pLanguage = new Language;
|
||||
unsigned int idx = m_Languages.size();
|
||||
|
||||
m_LCodeLookup.insert(langcode, idx);
|
||||
UTIL_Format(pLanguage->m_code2, sizeof(pLanguage->m_code2), "%s", langcode);
|
||||
pLanguage->m_FullName = m_pStringTab->AddString(description);
|
||||
|
||||
m_Languages.push_back(pLanguage);
|
||||
}
|
||||
|
||||
m_LAliases.insert(lower, idx);
|
||||
sm_trie_insert(m_pLCodeLookup, langcode, reinterpret_cast<void *>(idx));
|
||||
|
||||
m_Languages.push_back(pLanguage);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -976,7 +984,7 @@ unsigned int Translator::GetServerLanguage()
|
||||
|
||||
unsigned int Translator::GetClientLanguage(int client)
|
||||
{
|
||||
IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(client);
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||
return pPlayer->GetLanguageId();
|
||||
}
|
||||
|
||||
@@ -994,7 +1002,7 @@ bool Translator::GetLanguageInfo(unsigned int number, const char **code, const c
|
||||
}
|
||||
if (name)
|
||||
{
|
||||
*name = m_pStringTab->GetString(l->m_CanonicalName);
|
||||
*name = m_pStringTab->GetString(l->m_FullName);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1017,16 +1025,20 @@ IPhraseCollection *Translator::CreatePhraseCollection()
|
||||
|
||||
int Translator::SetGlobalTarget(int index)
|
||||
{
|
||||
return g_pSM->SetGlobalTarget(index);
|
||||
return g_SourceMod.SetGlobalTarget(index);
|
||||
}
|
||||
|
||||
int Translator::GetGlobalTarget() const
|
||||
{
|
||||
return g_pSM->GetGlobalTarget();
|
||||
return g_SourceMod.GetGlobalTarget();
|
||||
}
|
||||
|
||||
bool CoreTranslate(char *buffer, size_t maxlength, const char *format, unsigned int numparams,
|
||||
size_t *pOutLength, ...)
|
||||
bool CoreTranslate(char *buffer,
|
||||
size_t maxlength,
|
||||
const char *format,
|
||||
unsigned int numparams,
|
||||
size_t *pOutLength,
|
||||
...)
|
||||
{
|
||||
va_list ap;
|
||||
unsigned int i;
|
||||
@@ -1056,11 +1068,11 @@ bool CoreTranslate(char *buffer, size_t maxlength, const char *format, unsigned
|
||||
{
|
||||
if (fail_phrase != NULL)
|
||||
{
|
||||
smcore.LogError("[SM] Could not find core phrase: %s", fail_phrase);
|
||||
g_Logger.LogError("[SM] Could not find core phrase: %s", fail_phrase);
|
||||
}
|
||||
else
|
||||
{
|
||||
smcore.LogError("[SM] Unknown fatal error while translating a core phrase.");
|
||||
g_Logger.LogError("[SM] Unknown fatal error while translating a core phrase.");
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1081,7 +1093,7 @@ bool Translator::FormatString(char *buffer,
|
||||
unsigned int arg;
|
||||
|
||||
arg = 0;
|
||||
if (!smcore.gnprintf(buffer, maxlength, format, pPhrases, params, numparams, arg, pOutLength, pFailPhrase))
|
||||
if (!gnprintf(buffer, maxlength, format, pPhrases, params, numparams, arg, pOutLength, pFailPhrase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -32,14 +32,17 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_TRANSLATOR_H_
|
||||
#define _INCLUDE_SOURCEMOD_TRANSLATOR_H_
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <sm_trie_tpl.h>
|
||||
#include "sm_trie.h"
|
||||
#include <sh_string.h>
|
||||
#include <sh_vector.h>
|
||||
#include "sm_globals.h"
|
||||
#include "sm_memtable.h"
|
||||
#include "ITextParsers.h"
|
||||
#include <ITranslator.h>
|
||||
|
||||
#define MAX_TRANSLATE_PARAMS 32
|
||||
#define CORELANG_ENGLISH 0
|
||||
|
||||
/* :TODO: write a templatized version of tries? */
|
||||
|
||||
using namespace SourceHook;
|
||||
@@ -55,7 +58,7 @@ enum PhraseParseState
|
||||
struct Language
|
||||
{
|
||||
char m_code2[4];
|
||||
int m_CanonicalName;
|
||||
int m_FullName;
|
||||
};
|
||||
|
||||
class CPhraseFile :
|
||||
@@ -79,7 +82,7 @@ private:
|
||||
void ParseError(const char *message, ...);
|
||||
void ParseWarning(const char *message, ...);
|
||||
private:
|
||||
KTrie<int> m_PhraseLookup;
|
||||
Trie *m_pPhraseLookup;
|
||||
String m_File;
|
||||
Translator *m_pTranslator;
|
||||
PhraseParseState m_ParseState;
|
||||
@@ -119,6 +122,7 @@ public:
|
||||
unsigned int FindOrAddPhraseFile(const char *phrase_file);
|
||||
BaseStringTable *GetStringTable();
|
||||
unsigned int GetLanguageCount();
|
||||
bool GetLanguageInfo(unsigned int number, const char **code, const char **name);
|
||||
bool GetLanguageByCode(const char *code, unsigned int *index);
|
||||
bool GetLanguageByName(const char *name, unsigned int *index);
|
||||
CPhraseFile *GetFileByIndex(unsigned int index);
|
||||
@@ -145,15 +149,13 @@ public: //ITranslator
|
||||
unsigned int numparams,
|
||||
size_t *pOutLength,
|
||||
const char **pFailPhrase);
|
||||
bool GetLanguageInfo(unsigned int number, const char **code, const char **name);
|
||||
private:
|
||||
bool AddLanguage(const char *langcode, const char *description);
|
||||
private:
|
||||
CVector<Language *> m_Languages;
|
||||
CVector<CPhraseFile *> m_Files;
|
||||
BaseStringTable *m_pStringTab;
|
||||
KTrie<unsigned int> m_LCodeLookup;
|
||||
KTrie<unsigned int> m_LAliases;
|
||||
Trie *m_pLCodeLookup;
|
||||
bool m_InLanguageSection;
|
||||
String m_CustomError;
|
||||
unsigned int m_ServerLang;
|
||||
@@ -173,4 +175,3 @@ extern unsigned int g_pCorePhraseID;
|
||||
extern Translator g_Translator;
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_TRANSLATOR_H_
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+37
-303
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -32,32 +32,18 @@
|
||||
#include "UserMessages.h"
|
||||
#include "sm_stringutil.h"
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
#include <cstrike15_usermessage_helpers.h>
|
||||
#endif
|
||||
|
||||
UserMessages g_UserMsgs;
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
SH_DECL_HOOK3_void(IVEngineServer, SendUserMessage, SH_NOATTRIB, 0, IRecipientFilter &, int, const protobuf::Message &);
|
||||
#else
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
SH_DECL_HOOK3(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int, const char *);
|
||||
#else
|
||||
SH_DECL_HOOK2(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int);
|
||||
#endif
|
||||
SH_DECL_HOOK0_void(IVEngineServer, MessageEnd, SH_NOATTRIB, 0);
|
||||
#endif // ==SE_CSGO
|
||||
|
||||
UserMessages::UserMessages()
|
||||
#ifndef USE_PROTOBUF_USERMESSAGES
|
||||
: m_InterceptBuffer(m_pBase, 2500)
|
||||
UserMessages::UserMessages() : m_InterceptBuffer(m_pBase, 2500)
|
||||
{
|
||||
m_Names = sm_trie_create();
|
||||
#else
|
||||
: m_InterceptBuffer(NULL)
|
||||
{
|
||||
#endif
|
||||
m_HookCount = 0;
|
||||
m_InExec = false;
|
||||
m_InHook = false;
|
||||
@@ -67,9 +53,7 @@ UserMessages::UserMessages()
|
||||
|
||||
UserMessages::~UserMessages()
|
||||
{
|
||||
#ifndef USE_PROTOBUF_USERMESSAGES
|
||||
sm_trie_destroy(m_Names);
|
||||
#endif
|
||||
|
||||
CStack<ListenerInfo *>::iterator iter;
|
||||
for (iter=m_FreeListeners.begin(); iter!=m_FreeListeners.end(); iter++)
|
||||
@@ -81,10 +65,8 @@ UserMessages::~UserMessages()
|
||||
|
||||
void UserMessages::OnSourceModStartup(bool late)
|
||||
{
|
||||
#ifndef USE_PROTOBUF_USERMESSAGES
|
||||
/* -1 means SourceMM was unable to get the user message list */
|
||||
m_FallbackSearch = (g_SMAPI->GetUserMessageCount() == -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void UserMessages::OnSourceModAllInitialized()
|
||||
@@ -96,25 +78,16 @@ void UserMessages::OnSourceModAllShutdown()
|
||||
{
|
||||
if (m_HookCount)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, SendUserMessage, engine, this, &UserMessages::OnSendUserMessage_Pre, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, SendUserMessage, engine, this, &UserMessages::OnSendUserMessage_Post, true);
|
||||
#else
|
||||
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Pre, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Post, true);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Pre, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Post, true);
|
||||
#endif
|
||||
}
|
||||
m_HookCount = 0;
|
||||
}
|
||||
|
||||
int UserMessages::GetMessageIndex(const char *msg)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
// Can split this per engine and/or game later
|
||||
return g_Cstrike15UsermessageHelpers.GetIndex(msg);
|
||||
#else
|
||||
int msgid;
|
||||
|
||||
if (!sm_trie_retrieve(m_Names, msg, reinterpret_cast<void **>(&msgid)))
|
||||
@@ -145,19 +118,10 @@ int UserMessages::GetMessageIndex(const char *msg)
|
||||
}
|
||||
|
||||
return msgid;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool UserMessages::GetMessageName(int msgid, char *buffer, size_t maxlength) const
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
const char *pszName = g_Cstrike15UsermessageHelpers.GetName(msgid);
|
||||
if (!pszName)
|
||||
return false;
|
||||
|
||||
strncopy(buffer, pszName, maxlength);
|
||||
return true;
|
||||
#else
|
||||
if (m_FallbackSearch)
|
||||
{
|
||||
int size;
|
||||
@@ -173,14 +137,10 @@ bool UserMessages::GetMessageName(int msgid, char *buffer, size_t maxlength) con
|
||||
}
|
||||
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bf_write *UserMessages::StartBitBufMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags)
|
||||
bf_write *UserMessages::StartMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags)
|
||||
{
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
return NULL;
|
||||
#else
|
||||
bf_write *buffer;
|
||||
|
||||
if (m_InExec || m_InHook)
|
||||
@@ -208,13 +168,13 @@ bf_write *UserMessages::StartBitBufMessage(int msg_id, const cell_t players[], u
|
||||
|
||||
if (m_CurFlags & USERMSG_BLOCKHOOKS)
|
||||
{
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, g_SMAPI->GetUserMessage(msg_id));
|
||||
#else
|
||||
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
|
||||
#endif
|
||||
} else {
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
buffer = engine->UserMessageBegin(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, g_SMAPI->GetUserMessage(msg_id));
|
||||
#else
|
||||
buffer = engine->UserMessageBegin(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
|
||||
@@ -222,75 +182,6 @@ bf_write *UserMessages::StartBitBufMessage(int msg_id, const cell_t players[], u
|
||||
}
|
||||
|
||||
return buffer;
|
||||
#endif // USE_PROTOBUF_USERMESSAGES
|
||||
}
|
||||
|
||||
google::protobuf::Message *UserMessages::StartProtobufMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags)
|
||||
{
|
||||
#ifndef USE_PROTOBUF_USERMESSAGES
|
||||
return NULL;
|
||||
#else
|
||||
protobuf::Message *buffer;
|
||||
|
||||
if (m_InExec || m_InHook)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (msg_id < 0 || msg_id >= 255)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
m_CurId = msg_id;
|
||||
m_CellRecFilter.Initialize(players, playersNum);
|
||||
|
||||
m_CurFlags = flags;
|
||||
if (m_CurFlags & USERMSG_INITMSG)
|
||||
{
|
||||
m_CellRecFilter.SetToInit(true);
|
||||
}
|
||||
if (m_CurFlags & USERMSG_RELIABLE)
|
||||
{
|
||||
m_CellRecFilter.SetToReliable(true);
|
||||
}
|
||||
|
||||
m_InExec = true;
|
||||
|
||||
if (m_CurFlags & USERMSG_BLOCKHOOKS)
|
||||
{
|
||||
// direct message creation, return buffer "from engine". keep track
|
||||
m_FakeEngineBuffer = g_Cstrike15UsermessageHelpers.GetPrototype(msg_id)->New();
|
||||
buffer = m_FakeEngineBuffer;
|
||||
} else {
|
||||
char messageName[32];
|
||||
if (!GetMessageName(msg_id, messageName, sizeof(messageName)))
|
||||
{
|
||||
m_InExec = false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
protobuf::Message *msg = OnStartMessage_Pre(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, messageName);
|
||||
switch (m_FakeMetaRes)
|
||||
{
|
||||
case MRES_IGNORED:
|
||||
case MRES_HANDLED:
|
||||
m_FakeEngineBuffer = g_Cstrike15UsermessageHelpers.GetPrototype(msg_id)->New();
|
||||
buffer = m_FakeEngineBuffer;
|
||||
break;
|
||||
|
||||
case MRES_OVERRIDE:
|
||||
m_FakeEngineBuffer = g_Cstrike15UsermessageHelpers.GetPrototype(msg_id)->New();
|
||||
// fallthrough
|
||||
case MRES_SUPERCEDE:
|
||||
buffer = msg;
|
||||
break;
|
||||
}
|
||||
|
||||
OnStartMessage_Post(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, messageName);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
#endif // USE_PROTOBUF_USERMESSAGES
|
||||
}
|
||||
|
||||
bool UserMessages::EndMessage()
|
||||
@@ -300,37 +191,12 @@ bool UserMessages::EndMessage()
|
||||
return false;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
if (m_CurFlags & USERMSG_BLOCKHOOKS)
|
||||
{
|
||||
ENGINE_CALL(SendUserMessage)(static_cast<IRecipientFilter &>(m_CellRecFilter), m_CurId, *m_FakeEngineBuffer);
|
||||
delete m_FakeEngineBuffer;
|
||||
m_FakeEngineBuffer = NULL;
|
||||
} else {
|
||||
OnMessageEnd_Pre();
|
||||
|
||||
switch (m_FakeMetaRes)
|
||||
{
|
||||
case MRES_IGNORED:
|
||||
case MRES_HANDLED:
|
||||
case MRES_OVERRIDE:
|
||||
engine->SendUserMessage(static_cast<IRecipientFilter &>(m_CellRecFilter), m_CurId, *m_FakeEngineBuffer);
|
||||
delete m_FakeEngineBuffer;
|
||||
m_FakeEngineBuffer = NULL;
|
||||
break;
|
||||
//case MRES_SUPERCEDE:
|
||||
}
|
||||
|
||||
OnMessageEnd_Post();
|
||||
}
|
||||
#else
|
||||
if (m_CurFlags & USERMSG_BLOCKHOOKS)
|
||||
{
|
||||
ENGINE_CALL(MessageEnd)();
|
||||
} else {
|
||||
engine->MessageEnd();
|
||||
}
|
||||
#endif // SE_CSGO
|
||||
|
||||
m_InExec = false;
|
||||
m_CurFlags = 0;
|
||||
@@ -339,60 +205,31 @@ bool UserMessages::EndMessage()
|
||||
return true;
|
||||
}
|
||||
|
||||
UserMessageType UserMessages::GetUserMessageType() const
|
||||
{
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
return UM_Protobuf;
|
||||
#else
|
||||
return UM_BitBuf;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool UserMessages::HookUserMessage2(int msg_id,
|
||||
IUserMessageListener *pListener,
|
||||
bool intercept)
|
||||
{
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
return InternalHook(msg_id, (IProtobufUserMessageListener *)pListener, intercept, true);
|
||||
#else
|
||||
return InternalHook(msg_id, (IBitBufUserMessageListener *)pListener, intercept, true);
|
||||
#endif
|
||||
return InternalHook(msg_id, pListener, intercept, true);
|
||||
}
|
||||
|
||||
bool UserMessages::UnhookUserMessage2(int msg_id,
|
||||
IUserMessageListener *pListener,
|
||||
bool intercept)
|
||||
{
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
return InternalUnhook(msg_id, (IProtobufUserMessageListener *)pListener, intercept, true);
|
||||
#else
|
||||
return InternalUnhook(msg_id, (IBitBufUserMessageListener *)pListener, intercept, true);
|
||||
#endif
|
||||
return InternalUnhook(msg_id, pListener, intercept, true);
|
||||
}
|
||||
|
||||
bool UserMessages::HookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
|
||||
{
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
return InternalHook(msg_id, (IProtobufUserMessageListener *)pListener, intercept, false);
|
||||
#else
|
||||
return InternalHook(msg_id, (IBitBufUserMessageListener *)pListener, intercept, false);
|
||||
#endif
|
||||
return InternalHook(msg_id, pListener, intercept, false);
|
||||
}
|
||||
|
||||
bool UserMessages::UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
|
||||
{
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
return InternalUnhook(msg_id, (IProtobufUserMessageListener *)pListener, intercept, false);
|
||||
#else
|
||||
return InternalUnhook(msg_id, (IBitBufUserMessageListener *)pListener, intercept, false);
|
||||
#endif
|
||||
return InternalUnhook(msg_id, pListener, intercept, false);
|
||||
}
|
||||
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
bool UserMessages::InternalHook(int msg_id, IProtobufUserMessageListener *pListener, bool intercept, bool isNew)
|
||||
#else
|
||||
bool UserMessages::InternalHook(int msg_id, IBitBufUserMessageListener *pListener, bool intercept, bool isNew)
|
||||
#endif
|
||||
bool UserMessages::InternalHook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew)
|
||||
{
|
||||
if (msg_id < 0 || msg_id >= 255)
|
||||
{
|
||||
@@ -415,15 +252,10 @@ bool UserMessages::InternalHook(int msg_id, IBitBufUserMessageListener *pListene
|
||||
|
||||
if (!m_HookCount++)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
SH_ADD_HOOK_MEMFUNC(IVEngineServer, SendUserMessage, engine, this, &UserMessages::OnSendUserMessage_Pre, false);
|
||||
SH_ADD_HOOK_MEMFUNC(IVEngineServer, SendUserMessage, engine, this, &UserMessages::OnSendUserMessage_Post, true);
|
||||
#else
|
||||
SH_ADD_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Pre, false);
|
||||
SH_ADD_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Post, true);
|
||||
SH_ADD_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Pre, false);
|
||||
SH_ADD_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Post, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (intercept)
|
||||
@@ -436,11 +268,7 @@ bool UserMessages::InternalHook(int msg_id, IBitBufUserMessageListener *pListene
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
bool UserMessages::InternalUnhook(int msg_id, IProtobufUserMessageListener *pListener, bool intercept, bool isNew)
|
||||
#else
|
||||
bool UserMessages::InternalUnhook(int msg_id, IBitBufUserMessageListener *pListener, bool intercept, bool isNew)
|
||||
#endif
|
||||
bool UserMessages::InternalUnhook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew)
|
||||
{
|
||||
MsgList *pList;
|
||||
MsgIter iter;
|
||||
@@ -481,69 +309,14 @@ void UserMessages::_DecRefCounter()
|
||||
{
|
||||
if (--m_HookCount == 0)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, SendUserMessage, engine, this, &UserMessages::OnSendUserMessage_Pre, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, SendUserMessage, engine, this, &UserMessages::OnSendUserMessage_Post, true);
|
||||
#else
|
||||
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Pre, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Post, true);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Pre, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Post, true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
void UserMessages::OnSendUserMessage_Pre(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg)
|
||||
{
|
||||
OnStartMessage_Pre(&filter, msg_type, g_Cstrike15UsermessageHelpers.GetName(msg_type));
|
||||
if (m_FakeMetaRes == MRES_SUPERCEDE)
|
||||
{
|
||||
int size = msg.ByteSize();
|
||||
uint8 *data = (uint8 *)stackalloc(size);
|
||||
msg.SerializePartialToArray(data, size);
|
||||
m_InterceptBuffer->ParsePartialFromArray(data, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_FakeEngineBuffer = &const_cast<protobuf::Message &>(msg);
|
||||
}
|
||||
|
||||
OnStartMessage_Post(&filter, msg_type, g_Cstrike15UsermessageHelpers.GetName(msg_type));
|
||||
|
||||
OnMessageEnd_Pre();
|
||||
if (m_FakeMetaRes == MRES_SUPERCEDE)
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void UserMessages::OnSendUserMessage_Post(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg)
|
||||
{
|
||||
OnMessageEnd_Post();
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
#define UM_RETURN_META_VALUE(res, val) \
|
||||
m_FakeMetaRes = res; \
|
||||
return val;
|
||||
|
||||
#define UM_RETURN_META(res) \
|
||||
m_FakeMetaRes = res; \
|
||||
return;
|
||||
#else
|
||||
#define UM_RETURN_META_VALUE(res, val) \
|
||||
RETURN_META_VALUE(res, val)
|
||||
|
||||
#define UM_RETURN_META(res) \
|
||||
RETURN_META(res)
|
||||
#endif
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
protobuf::Message *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name)
|
||||
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name)
|
||||
#else
|
||||
bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type)
|
||||
@@ -556,7 +329,7 @@ bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_typ
|
||||
|| (m_InExec && (m_CurFlags & USERMSG_BLOCKHOOKS)))
|
||||
{
|
||||
m_InHook = false;
|
||||
UM_RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||
RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||
}
|
||||
|
||||
m_CurId = msg_type;
|
||||
@@ -566,23 +339,14 @@ bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_typ
|
||||
|
||||
if (!is_intercept_empty)
|
||||
{
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
if (m_InterceptBuffer)
|
||||
delete m_InterceptBuffer;
|
||||
m_InterceptBuffer = g_Cstrike15UsermessageHelpers.GetPrototype(msg_type)->New();
|
||||
UM_RETURN_META_VALUE(MRES_SUPERCEDE, m_InterceptBuffer);
|
||||
#else
|
||||
m_InterceptBuffer.Reset();
|
||||
UM_RETURN_META_VALUE(MRES_SUPERCEDE, &m_InterceptBuffer);
|
||||
#endif
|
||||
RETURN_META_VALUE(MRES_SUPERCEDE, &m_InterceptBuffer);
|
||||
}
|
||||
|
||||
UM_RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||
RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
protobuf::Message *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name)
|
||||
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name)
|
||||
#else
|
||||
bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type)
|
||||
@@ -590,26 +354,19 @@ bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_ty
|
||||
{
|
||||
if (!m_InHook)
|
||||
{
|
||||
UM_RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||
RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||
}
|
||||
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
if (m_FakeMetaRes == MRES_SUPERCEDE)
|
||||
m_OrigBuffer = m_InterceptBuffer;
|
||||
else
|
||||
m_OrigBuffer = m_FakeEngineBuffer;
|
||||
#else
|
||||
m_OrigBuffer = META_RESULT_ORIG_RET(bf_write *);
|
||||
#endif
|
||||
|
||||
UM_RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||
RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||
}
|
||||
|
||||
void UserMessages::OnMessageEnd_Post()
|
||||
{
|
||||
if (!m_InHook)
|
||||
{
|
||||
UM_RETURN_META(MRES_IGNORED);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
MsgList *pList;
|
||||
@@ -677,7 +434,7 @@ void UserMessages::OnMessageEnd_Pre()
|
||||
{
|
||||
if (!m_InHook)
|
||||
{
|
||||
UM_RETURN_META(MRES_IGNORED);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
MsgList *pList;
|
||||
@@ -693,11 +450,7 @@ void UserMessages::OnMessageEnd_Pre()
|
||||
{
|
||||
pInfo = (*iter);
|
||||
pInfo->IsHooked = true;
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
res = pInfo->Callback->InterceptUserMessage(m_CurId, m_InterceptBuffer, m_CurRecFilter);
|
||||
#else
|
||||
res = pInfo->Callback->InterceptUserMessage(m_CurId, &m_InterceptBuffer, m_CurRecFilter);
|
||||
#endif
|
||||
|
||||
intercepted = true;
|
||||
|
||||
@@ -745,11 +498,9 @@ void UserMessages::OnMessageEnd_Pre()
|
||||
|
||||
if (!handled && intercepted)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
ENGINE_CALL(SendUserMessage)(static_cast<IRecipientFilter &>(*m_CurRecFilter), m_CurId, *m_InterceptBuffer);
|
||||
#else
|
||||
bf_write *engine_bfw;
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId, g_SMAPI->GetUserMessage(m_CurId));
|
||||
#else
|
||||
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId);
|
||||
@@ -757,46 +508,29 @@ void UserMessages::OnMessageEnd_Pre()
|
||||
m_ReadBuffer.StartReading(m_InterceptBuffer.GetBasePointer(), m_InterceptBuffer.GetNumBytesWritten());
|
||||
engine_bfw->WriteBitsFromBuffer(&m_ReadBuffer, m_InterceptBuffer.GetNumBitsWritten());
|
||||
ENGINE_CALL(MessageEnd)();
|
||||
#endif // SE_CSGO
|
||||
}
|
||||
|
||||
pList = &m_msgHooks[m_CurId];
|
||||
for (iter=pList->begin(); iter!=pList->end(); )
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
int size = m_OrigBuffer->ByteSize();
|
||||
uint8 *data = (uint8 *)stackalloc(size);
|
||||
m_OrigBuffer->SerializePartialToArray(data, size);
|
||||
protobuf::Message *pTempMsg = g_Cstrike15UsermessageHelpers.GetPrototype(m_CurId)->New();
|
||||
pTempMsg->ParsePartialFromArray(data, size);
|
||||
#else
|
||||
bf_write *pTempMsg = m_OrigBuffer;
|
||||
#endif
|
||||
pInfo = (*iter);
|
||||
pInfo->IsHooked = true;
|
||||
pInfo->Callback->OnUserMessage(m_CurId, m_OrigBuffer, m_CurRecFilter);
|
||||
|
||||
pList = &m_msgHooks[m_CurId];
|
||||
for (iter=pList->begin(); iter!=pList->end(); )
|
||||
if (pInfo->KillMe)
|
||||
{
|
||||
pInfo = (*iter);
|
||||
pInfo->IsHooked = true;
|
||||
pInfo->Callback->OnUserMessage(m_CurId, pTempMsg, m_CurRecFilter);
|
||||
|
||||
if (pInfo->KillMe)
|
||||
{
|
||||
iter = pList->erase(iter);
|
||||
m_FreeListeners.push(pInfo);
|
||||
_DecRefCounter();
|
||||
continue;
|
||||
}
|
||||
|
||||
pInfo->IsHooked = false;
|
||||
iter++;
|
||||
iter = pList->erase(iter);
|
||||
m_FreeListeners.push(pInfo);
|
||||
_DecRefCounter();
|
||||
continue;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
delete pTempMsg;
|
||||
#endif
|
||||
pInfo->IsHooked = false;
|
||||
iter++;
|
||||
}
|
||||
|
||||
UM_RETURN_META((intercepted) ? MRES_SUPERCEDE : MRES_IGNORED);
|
||||
RETURN_META((intercepted) ? MRES_SUPERCEDE : MRES_IGNORED);
|
||||
supercede:
|
||||
m_BlockEndPost = true;
|
||||
UM_RETURN_META(MRES_SUPERCEDE);
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
}
|
||||
|
||||
+7
-52
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -36,35 +36,16 @@
|
||||
#include <IUserMessages.h>
|
||||
#include "sourcemm_api.h"
|
||||
#include "sm_trie.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "CellRecipientFilter.h"
|
||||
|
||||
using namespace SourceHook;
|
||||
using namespace SourceMod;
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
#define USE_PROTOBUF_USERMESSAGES
|
||||
#endif
|
||||
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <netmessages.pb.h>
|
||||
|
||||
using namespace google;
|
||||
#else
|
||||
#include <bitbuf.h>
|
||||
#endif
|
||||
|
||||
#define INVALID_MESSAGE_ID -1
|
||||
|
||||
struct ListenerInfo
|
||||
{
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
IProtobufUserMessageListener *Callback;
|
||||
#else
|
||||
IBitBufUserMessageListener *Callback;
|
||||
#endif
|
||||
IUserMessageListener *Callback;
|
||||
bool IsHooked;
|
||||
bool KillMe;
|
||||
bool IsNew;
|
||||
@@ -89,8 +70,7 @@ public: //IUserMessages
|
||||
bool GetMessageName(int msgid, char *buffer, size_t maxlength) const;
|
||||
bool HookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept=false);
|
||||
bool UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept=false);
|
||||
bf_write *StartBitBufMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags);
|
||||
google::protobuf::Message *StartProtobufMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags);
|
||||
bf_write *StartMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags);
|
||||
bool EndMessage();
|
||||
bool HookUserMessage2(int msg_id,
|
||||
IUserMessageListener *pListener,
|
||||
@@ -98,17 +78,8 @@ public: //IUserMessages
|
||||
bool UnhookUserMessage2(int msg_id,
|
||||
IUserMessageListener *pListener,
|
||||
bool intercept=false);
|
||||
UserMessageType GetUserMessageType() const;
|
||||
public:
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
void OnSendUserMessage_Pre(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg);
|
||||
void OnSendUserMessage_Post(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg);
|
||||
#endif
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
protobuf::Message *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name);
|
||||
protobuf::Message *OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name);
|
||||
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
bf_write *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name);
|
||||
bf_write *OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name);
|
||||
#else
|
||||
@@ -118,40 +89,24 @@ public:
|
||||
void OnMessageEnd_Pre();
|
||||
void OnMessageEnd_Post();
|
||||
private:
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
bool InternalHook(int msg_id, IProtobufUserMessageListener *pListener, bool intercept, bool isNew);
|
||||
bool InternalUnhook(int msg_id, IProtobufUserMessageListener *pListener, bool intercept, bool isNew);
|
||||
#else
|
||||
bool InternalHook(int msg_id, IBitBufUserMessageListener *pListener, bool intercept, bool isNew);
|
||||
bool InternalUnhook(int msg_id, IBitBufUserMessageListener *pListener, bool intercept, bool isNew);
|
||||
#endif
|
||||
bool InternalHook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew);
|
||||
bool InternalUnhook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew);
|
||||
void _DecRefCounter();
|
||||
private:
|
||||
List<ListenerInfo *> m_msgHooks[255];
|
||||
List<ListenerInfo *> m_msgIntercepts[255];
|
||||
CStack<ListenerInfo *> m_FreeListeners;
|
||||
IRecipientFilter *m_CurRecFilter;
|
||||
#ifndef USE_PROTOBUF_USERMESSAGES
|
||||
unsigned char m_pBase[2500];
|
||||
IRecipientFilter *m_CurRecFilter;
|
||||
bf_write m_InterceptBuffer;
|
||||
bf_write *m_OrigBuffer;
|
||||
bf_read m_ReadBuffer;
|
||||
#else
|
||||
// The engine used to provide this. Now we track it.
|
||||
protobuf::Message *m_OrigBuffer;
|
||||
protobuf::Message *m_FakeEngineBuffer;
|
||||
META_RES m_FakeMetaRes;
|
||||
|
||||
protobuf::Message *m_InterceptBuffer;
|
||||
#endif
|
||||
size_t m_HookCount;
|
||||
bool m_InHook;
|
||||
bool m_BlockEndPost;
|
||||
#ifndef USE_PROTOBUF_USERMESSAGES
|
||||
bool m_FallbackSearch;
|
||||
|
||||
Trie *m_Names;
|
||||
#endif
|
||||
CellRecipientFilter m_CellRecFilter;
|
||||
bool m_InExec;
|
||||
int m_CurFlags;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#define FORCEINLINE_CVAR FORCEINLINE
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
#elif _LINUX
|
||||
#define FORCEINLINE_CVAR inline
|
||||
#else
|
||||
#error "implement me"
|
||||
@@ -386,7 +386,7 @@ public:
|
||||
virtual void SetValue( const char *value );
|
||||
virtual void SetValue( float value );
|
||||
virtual void SetValue( int value );
|
||||
#if SOURCE_ENGINE >= SE_NUCLEARDAWN
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
virtual void SetValue( Color value );
|
||||
#endif
|
||||
|
||||
@@ -404,9 +404,6 @@ private:
|
||||
// For CVARs marked FCVAR_NEVER_AS_STRING
|
||||
virtual void InternalSetFloatValue( float fNewValue );
|
||||
virtual void InternalSetIntValue( int nValue );
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD2
|
||||
virtual void InternalSetColorValue( Color value );
|
||||
#endif
|
||||
|
||||
virtual bool ClampValue( float& value );
|
||||
virtual void ChangeStringValue( const char *tempVal, float flOldValue );
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#define FORCEINLINE_CVAR FORCEINLINE
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
#elif _LINUX
|
||||
#define FORCEINLINE_CVAR inline
|
||||
#else
|
||||
#error "implement me"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+38
-56
@@ -1,59 +1,41 @@
|
||||
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
|
||||
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||
import os
|
||||
|
||||
binary = SM.Library(builder, 'sourcemod.logic')
|
||||
binary.compiler.cxxincludes += [
|
||||
os.path.join(builder.sourcePath, 'core', 'logic'),
|
||||
os.path.join(builder.sourcePath, 'public'),
|
||||
os.path.join(builder.sourcePath, 'public', 'sourcepawn'),
|
||||
os.path.join(builder.sourcePath, 'public', 'amtl'),
|
||||
os.path.join(SM.mms_root, 'core', 'sourcehook')
|
||||
]
|
||||
binary.compiler.defines += [
|
||||
'SM_DEFAULT_THREADER',
|
||||
'SM_LOGIC'
|
||||
]
|
||||
|
||||
if builder.target_platform == 'linux':
|
||||
binary.compiler.postlink += ['-lpthread', '-lrt']
|
||||
elif builder.target_platform == 'mac':
|
||||
binary.compiler.cflags += ['-Wno-deprecated-declarations']
|
||||
binary.compiler.postlink += ['-framework', 'CoreServices']
|
||||
binary.sources += [
|
||||
'common_logic.cpp',
|
||||
'smn_adt_array.cpp',
|
||||
'smn_sorting.cpp',
|
||||
'smn_maplists.cpp',
|
||||
'smn_adt_stack.cpp',
|
||||
'thread/ThreadWorker.cpp',
|
||||
'thread/BaseWorker.cpp',
|
||||
'ThreadSupport.cpp',
|
||||
'smn_float.cpp',
|
||||
'TextParsers.cpp',
|
||||
'smn_textparse.cpp',
|
||||
'smn_adt_trie.cpp',
|
||||
'Profiler.cpp',
|
||||
'smn_functions.cpp',
|
||||
'smn_timers.cpp',
|
||||
'smn_players.cpp',
|
||||
'MemoryUtils.cpp',
|
||||
'smn_admin.cpp',
|
||||
'smn_banning.cpp',
|
||||
'stringutil.cpp',
|
||||
'Translator.cpp',
|
||||
'PhraseCollection.cpp',
|
||||
'smn_lang.cpp',
|
||||
'smn_string.cpp',
|
||||
'smn_handles.cpp',
|
||||
'smn_datapacks.cpp',
|
||||
'smn_gameconfigs.cpp',
|
||||
'GameConfigs.cpp',
|
||||
'sm_crc32.cpp',
|
||||
'smn_profiler.cpp',
|
||||
]
|
||||
if builder.target_platform == 'windows':
|
||||
binary.sources += ['thread/WinThreads.cpp']
|
||||
else:
|
||||
binary.sources += ['thread/PosixThreads.cpp']
|
||||
compiler = SM.DefaultCompiler()
|
||||
base = AMBuild.sourceFolder
|
||||
compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(base, 'core', 'logic'))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(base, 'public'))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'sourcepawn'))
|
||||
compiler['CDEFINES'].append('SM_DEFAULT_THREADER')
|
||||
compiler['CDEFINES'].append('SM_LOGIC')
|
||||
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
compiler['POSTLINKFLAGS'].append('-lpthread')
|
||||
|
||||
extension = AMBuild.AddJob('sourcemod.logic')
|
||||
binary = Cpp.LibraryBuilder('sourcemod.logic', AMBuild, extension, compiler)
|
||||
files = [
|
||||
'common_logic.cpp',
|
||||
'smn_adt_array.cpp',
|
||||
'smn_sorting.cpp',
|
||||
'smn_maplists.cpp',
|
||||
'smn_adt_stack.cpp',
|
||||
'thread/ThreadWorker.cpp',
|
||||
'thread/BaseWorker.cpp',
|
||||
'ThreadSupport.cpp',
|
||||
'smn_float.cpp',
|
||||
'TextParsers.cpp',
|
||||
'smn_textparse.cpp',
|
||||
'smn_adt_trie.cpp',
|
||||
'Profiler.cpp',
|
||||
'smn_functions.cpp'
|
||||
]
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
files.append('thread/WinThreads.cpp')
|
||||
else:
|
||||
files.append('thread/PosixThreads.cpp')
|
||||
binary.AddSourceFiles('core/logic', files)
|
||||
SM.AutoVersion('core/logic', binary)
|
||||
binary.SendToJob()
|
||||
|
||||
SM.binaries += [builder.Add(binary)]
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 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
|
||||
* 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/>.
|
||||
*
|
||||
* 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
|
||||
* "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
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_AUTO_HANDLE_ROOTER_H_
|
||||
#define _INCLUDE_SOURCEMOD_AUTO_HANDLE_ROOTER_H_
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <IHandleSys.h>
|
||||
|
||||
class AutoHandleRooter
|
||||
{
|
||||
public:
|
||||
AutoHandleRooter(Handle_t hndl)
|
||||
{
|
||||
if (hndl != BAD_HANDLE)
|
||||
this->hndl = handlesys->FastCloneHandle(hndl);
|
||||
else
|
||||
this->hndl = BAD_HANDLE;
|
||||
}
|
||||
|
||||
~AutoHandleRooter()
|
||||
{
|
||||
if (hndl != BAD_HANDLE)
|
||||
{
|
||||
HandleSecurity sec(g_pCoreIdent, g_pCoreIdent);
|
||||
handlesys->FreeHandle(hndl, &sec);
|
||||
}
|
||||
}
|
||||
|
||||
Handle_t getHandle()
|
||||
{
|
||||
return hndl;
|
||||
}
|
||||
private:
|
||||
Handle_t hndl;
|
||||
};
|
||||
|
||||
class AutoHandleCloner
|
||||
{
|
||||
Handle_t original;
|
||||
HandleSecurity sec;
|
||||
AutoHandleRooter ahr;
|
||||
public:
|
||||
AutoHandleCloner(Handle_t original, HandleSecurity sec)
|
||||
: original(original), sec(sec), ahr(original)
|
||||
{
|
||||
}
|
||||
|
||||
~AutoHandleCloner()
|
||||
{
|
||||
if (original != BAD_HANDLE)
|
||||
{
|
||||
handlesys->FreeHandle(original, &sec);
|
||||
}
|
||||
}
|
||||
|
||||
Handle_t getClone()
|
||||
{
|
||||
return ahr.getHandle();
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_AUTO_HANDLE_ROOTER_H_ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+1
-17
@@ -25,23 +25,7 @@ OBJECTS = \
|
||||
smn_textparse.cpp \
|
||||
smn_adt_trie.cpp \
|
||||
Profiler.cpp \
|
||||
smn_functions.cpp \
|
||||
sm_crc32.cpp \
|
||||
smn_timers.cpp \
|
||||
MemoryUtils.cpp \
|
||||
smn_admin.cpp \
|
||||
smn_banning.cpp \
|
||||
stringutil.cpp \
|
||||
Translator.cpp \
|
||||
PhraseCollection.cpp \
|
||||
smn_lang.cpp \
|
||||
smn_string.cpp \
|
||||
smn_handles.cpp \
|
||||
smn_datapacks.cpp \
|
||||
smn_gameconfigs.cpp \
|
||||
GameConfigs.cpp \
|
||||
smn_players.cpp \
|
||||
smn_profiler.cpp
|
||||
smn_functions.cpp
|
||||
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
|
||||
@@ -1,612 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2011 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
|
||||
* 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/>.
|
||||
*
|
||||
* 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
|
||||
* "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
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*/
|
||||
|
||||
#include "MemoryUtils.h"
|
||||
#ifdef PLATFORM_LINUX
|
||||
#include <fcntl.h>
|
||||
#include <link.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
#define PAGE_ALIGN_UP(x) ((x + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_APPLE
|
||||
#include <AvailabilityMacros.h>
|
||||
#include <mach/task.h>
|
||||
#include <mach-o/dyld_images.h>
|
||||
#include <mach-o/loader.h>
|
||||
#include <mach-o/nlist.h>
|
||||
|
||||
/* Define things from 10.6 SDK for older SDKs */
|
||||
#ifndef MAC_OS_X_VERSION_10_6
|
||||
struct task_dyld_info
|
||||
{
|
||||
mach_vm_address_t all_image_info_addr;
|
||||
mach_vm_size_t all_image_info_size;
|
||||
};
|
||||
typedef struct task_dyld_info task_dyld_info_data_t;
|
||||
#define TASK_DYLD_INFO 17
|
||||
#define TASK_DYLD_INFO_COUNT (sizeof(task_dyld_info_data_t) / sizeof(natural_t))
|
||||
#endif // MAC_OS_X_VERSION_10_6
|
||||
#endif // PLATFORM_APPLE
|
||||
|
||||
MemoryUtils g_MemUtils;
|
||||
|
||||
MemoryUtils::MemoryUtils()
|
||||
{
|
||||
#ifdef PLATFORM_APPLE
|
||||
|
||||
Gestalt(gestaltSystemVersionMajor, &m_OSXMajor);
|
||||
Gestalt(gestaltSystemVersionMinor, &m_OSXMinor);
|
||||
|
||||
/* Get pointer to struct that describes all loaded mach-o images in process */
|
||||
if ((m_OSXMajor == 10 && m_OSXMinor >= 6) || m_OSXMajor > 10)
|
||||
{
|
||||
task_dyld_info_data_t dyld_info;
|
||||
mach_msg_type_number_t count = TASK_DYLD_INFO_COUNT;
|
||||
task_info(mach_task_self(), TASK_DYLD_INFO, (task_info_t)&dyld_info, &count);
|
||||
m_ImageList = (struct dyld_all_image_infos *)dyld_info.all_image_info_addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct nlist list[2];
|
||||
memset(list, 0, sizeof(list));
|
||||
list[0].n_un.n_name = (char *)"_dyld_all_image_infos";
|
||||
nlist("/usr/lib/dyld", list);
|
||||
m_ImageList = (struct dyld_all_image_infos *)list[0].n_value;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
MemoryUtils::~MemoryUtils()
|
||||
{
|
||||
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
for (size_t i = 0; i < m_SymTables.size(); i++)
|
||||
{
|
||||
delete m_SymTables[i];
|
||||
}
|
||||
m_SymTables.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
void MemoryUtils::OnSourceModAllInitialized()
|
||||
{
|
||||
sharesys->AddInterface(NULL, this);
|
||||
}
|
||||
|
||||
void *MemoryUtils::FindPattern(const void *libPtr, const char *pattern, size_t len)
|
||||
{
|
||||
DynLibInfo lib;
|
||||
bool found;
|
||||
char *ptr, *end;
|
||||
|
||||
memset(&lib, 0, sizeof(DynLibInfo));
|
||||
|
||||
if (!GetLibraryInfo(libPtr, lib))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr = reinterpret_cast<char *>(lib.baseAddress);
|
||||
end = ptr + lib.memorySize - len;
|
||||
|
||||
while (ptr < end)
|
||||
{
|
||||
found = true;
|
||||
for (register size_t i = 0; i < len; i++)
|
||||
{
|
||||
if (pattern[i] != '\x2A' && pattern[i] != ptr[i])
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
return ptr;
|
||||
|
||||
ptr++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *MemoryUtils::ResolveSymbol(void *handle, const char *symbol)
|
||||
{
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
|
||||
return GetProcAddress((HMODULE)handle, symbol);
|
||||
|
||||
#elif defined PLATFORM_LINUX
|
||||
|
||||
struct link_map *dlmap;
|
||||
struct stat dlstat;
|
||||
int dlfile;
|
||||
uintptr_t map_base;
|
||||
Elf32_Ehdr *file_hdr;
|
||||
Elf32_Shdr *sections, *shstrtab_hdr, *symtab_hdr, *strtab_hdr;
|
||||
Elf32_Sym *symtab;
|
||||
const char *shstrtab, *strtab;
|
||||
uint16_t section_count;
|
||||
uint32_t symbol_count;
|
||||
LibSymbolTable *libtable;
|
||||
SymbolTable *table;
|
||||
Symbol *symbol_entry;
|
||||
|
||||
dlmap = (struct link_map *)handle;
|
||||
symtab_hdr = NULL;
|
||||
strtab_hdr = NULL;
|
||||
table = NULL;
|
||||
|
||||
/* See if we already have a symbol table for this library */
|
||||
for (size_t i = 0; i < m_SymTables.size(); i++)
|
||||
{
|
||||
libtable = m_SymTables[i];
|
||||
if (libtable->lib_base == dlmap->l_addr)
|
||||
{
|
||||
table = &libtable->table;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we don't have a symbol table for this library, then create one */
|
||||
if (table == NULL)
|
||||
{
|
||||
libtable = new LibSymbolTable();
|
||||
libtable->table.Initialize();
|
||||
libtable->lib_base = dlmap->l_addr;
|
||||
libtable->last_pos = 0;
|
||||
table = &libtable->table;
|
||||
m_SymTables.push_back(libtable);
|
||||
}
|
||||
|
||||
/* See if the symbol is already cached in our table */
|
||||
symbol_entry = table->FindSymbol(symbol, strlen(symbol));
|
||||
if (symbol_entry != NULL)
|
||||
{
|
||||
return symbol_entry->address;
|
||||
}
|
||||
|
||||
/* If symbol isn't in our table, then we have open the actual library */
|
||||
dlfile = open(dlmap->l_name, O_RDONLY);
|
||||
if (dlfile == -1 || fstat(dlfile, &dlstat) == -1)
|
||||
{
|
||||
close(dlfile);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Map library file into memory */
|
||||
file_hdr = (Elf32_Ehdr *)mmap(NULL, dlstat.st_size, PROT_READ, MAP_PRIVATE, dlfile, 0);
|
||||
map_base = (uintptr_t)file_hdr;
|
||||
if (file_hdr == MAP_FAILED)
|
||||
{
|
||||
close(dlfile);
|
||||
return NULL;
|
||||
}
|
||||
close(dlfile);
|
||||
|
||||
if (file_hdr->e_shoff == 0 || file_hdr->e_shstrndx == SHN_UNDEF)
|
||||
{
|
||||
munmap(file_hdr, dlstat.st_size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sections = (Elf32_Shdr *)(map_base + file_hdr->e_shoff);
|
||||
section_count = file_hdr->e_shnum;
|
||||
/* Get ELF section header string table */
|
||||
shstrtab_hdr = §ions[file_hdr->e_shstrndx];
|
||||
shstrtab = (const char *)(map_base + shstrtab_hdr->sh_offset);
|
||||
|
||||
/* Iterate sections while looking for ELF symbol table and string table */
|
||||
for (uint16_t i = 0; i < section_count; i++)
|
||||
{
|
||||
Elf32_Shdr &hdr = sections[i];
|
||||
const char *section_name = shstrtab + hdr.sh_name;
|
||||
|
||||
if (strcmp(section_name, ".symtab") == 0)
|
||||
{
|
||||
symtab_hdr = &hdr;
|
||||
}
|
||||
else if (strcmp(section_name, ".strtab") == 0)
|
||||
{
|
||||
strtab_hdr = &hdr;
|
||||
}
|
||||
}
|
||||
|
||||
/* Uh oh, we don't have a symbol table or a string table */
|
||||
if (symtab_hdr == NULL || strtab_hdr == NULL)
|
||||
{
|
||||
munmap(file_hdr, dlstat.st_size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
symtab = (Elf32_Sym *)(map_base + symtab_hdr->sh_offset);
|
||||
strtab = (const char *)(map_base + strtab_hdr->sh_offset);
|
||||
symbol_count = symtab_hdr->sh_size / symtab_hdr->sh_entsize;
|
||||
|
||||
/* Iterate symbol table starting from the position we were at last time */
|
||||
for (uint32_t i = libtable->last_pos; i < symbol_count; i++)
|
||||
{
|
||||
Elf32_Sym &sym = symtab[i];
|
||||
unsigned char sym_type = ELF32_ST_TYPE(sym.st_info);
|
||||
const char *sym_name = strtab + sym.st_name;
|
||||
Symbol *cur_sym;
|
||||
|
||||
/* Skip symbols that are undefined or do not refer to functions or objects */
|
||||
if (sym.st_shndx == SHN_UNDEF || (sym_type != STT_FUNC && sym_type != STT_OBJECT))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Caching symbols as we go along */
|
||||
cur_sym = table->InternSymbol(sym_name, strlen(sym_name), (void *)(dlmap->l_addr + sym.st_value));
|
||||
if (strcmp(symbol, sym_name) == 0)
|
||||
{
|
||||
symbol_entry = cur_sym;
|
||||
libtable->last_pos = ++i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
munmap(file_hdr, dlstat.st_size);
|
||||
return symbol_entry ? symbol_entry->address : NULL;
|
||||
|
||||
#elif defined PLATFORM_APPLE
|
||||
|
||||
uintptr_t dlbase, linkedit_addr;
|
||||
uint32_t image_count;
|
||||
struct mach_header *file_hdr;
|
||||
struct load_command *loadcmds;
|
||||
struct segment_command *linkedit_hdr;
|
||||
struct symtab_command *symtab_hdr;
|
||||
struct nlist *symtab;
|
||||
const char *strtab;
|
||||
uint32_t loadcmd_count;
|
||||
uint32_t symbol_count;
|
||||
LibSymbolTable *libtable;
|
||||
SymbolTable *table;
|
||||
Symbol *symbol_entry;
|
||||
|
||||
dlbase = 0;
|
||||
image_count = m_ImageList->infoArrayCount;
|
||||
linkedit_hdr = NULL;
|
||||
symtab_hdr = NULL;
|
||||
table = NULL;
|
||||
|
||||
/* Loop through mach-o images in process.
|
||||
* We can skip index 0 since that is just the executable.
|
||||
*/
|
||||
for (uint32_t i = 1; i < image_count; i++)
|
||||
{
|
||||
const struct dyld_image_info &info = m_ImageList->infoArray[i];
|
||||
|
||||
/* "Load" each one until we get a matching handle */
|
||||
void *h = dlopen(info.imageFilePath, RTLD_NOLOAD);
|
||||
if (h == handle)
|
||||
{
|
||||
dlbase = (uintptr_t)info.imageLoadAddress;
|
||||
dlclose(h);
|
||||
break;
|
||||
}
|
||||
|
||||
dlclose(h);
|
||||
}
|
||||
|
||||
if (!dlbase)
|
||||
{
|
||||
/* Uh oh, we couldn't find a matching handle */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* See if we already have a symbol table for this library */
|
||||
for (size_t i = 0; i < m_SymTables.size(); i++)
|
||||
{
|
||||
libtable = m_SymTables[i];
|
||||
if (libtable->lib_base == dlbase)
|
||||
{
|
||||
table = &libtable->table;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we don't have a symbol table for this library, then create one */
|
||||
if (table == NULL)
|
||||
{
|
||||
libtable = new LibSymbolTable();
|
||||
libtable->table.Initialize();
|
||||
libtable->lib_base = dlbase;
|
||||
libtable->last_pos = 0;
|
||||
table = &libtable->table;
|
||||
m_SymTables.push_back(libtable);
|
||||
}
|
||||
|
||||
/* See if the symbol is already cached in our table */
|
||||
symbol_entry = table->FindSymbol(symbol, strlen(symbol));
|
||||
if (symbol_entry != NULL)
|
||||
{
|
||||
return symbol_entry->address;
|
||||
}
|
||||
|
||||
/* If symbol isn't in our table, then we have to locate it in memory */
|
||||
|
||||
file_hdr = (struct mach_header *)dlbase;
|
||||
loadcmds = (struct load_command *)(dlbase + sizeof(struct mach_header));
|
||||
loadcmd_count = file_hdr->ncmds;
|
||||
|
||||
/* Loop through load commands until we find the ones for the symbol table */
|
||||
for (uint32_t i = 0; i < loadcmd_count; i++)
|
||||
{
|
||||
if (loadcmds->cmd == LC_SEGMENT && !linkedit_hdr)
|
||||
{
|
||||
struct segment_command *seg = (struct segment_command *)loadcmds;
|
||||
if (strcmp(seg->segname, "__LINKEDIT") == 0)
|
||||
{
|
||||
linkedit_hdr = seg;
|
||||
if (symtab_hdr)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (loadcmds->cmd == LC_SYMTAB)
|
||||
{
|
||||
symtab_hdr = (struct symtab_command *)loadcmds;
|
||||
if (linkedit_hdr)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Load commands are not of a fixed size which is why we add the size */
|
||||
loadcmds = (struct load_command *)((uintptr_t)loadcmds + loadcmds->cmdsize);
|
||||
}
|
||||
|
||||
if (!linkedit_hdr || !symtab_hdr || !symtab_hdr->symoff || !symtab_hdr->stroff)
|
||||
{
|
||||
/* Uh oh, no symbol table */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
linkedit_addr = dlbase + linkedit_hdr->vmaddr;
|
||||
symtab = (struct nlist *)(linkedit_addr + symtab_hdr->symoff - linkedit_hdr->fileoff);
|
||||
strtab = (const char *)(linkedit_addr + symtab_hdr->stroff - linkedit_hdr->fileoff);
|
||||
symbol_count = symtab_hdr->nsyms;
|
||||
|
||||
/* Iterate symbol table starting from the position we were at last time */
|
||||
for (uint32_t i = libtable->last_pos; i < symbol_count; i++)
|
||||
{
|
||||
struct nlist &sym = symtab[i];
|
||||
/* Ignore the prepended underscore on all symbols, so +1 here */
|
||||
const char *sym_name = strtab + sym.n_un.n_strx + 1;
|
||||
Symbol *cur_sym;
|
||||
|
||||
/* Skip symbols that are undefined */
|
||||
if (sym.n_sect == NO_SECT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Caching symbols as we go along */
|
||||
cur_sym = table->InternSymbol(sym_name, strlen(sym_name), (void *)(dlbase + sym.n_value));
|
||||
if (strcmp(symbol, sym_name) == 0)
|
||||
{
|
||||
symbol_entry = cur_sym;
|
||||
libtable->last_pos = ++i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return symbol_entry ? symbol_entry->address : NULL;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
bool MemoryUtils::GetLibraryInfo(const void *libPtr, DynLibInfo &lib)
|
||||
{
|
||||
uintptr_t baseAddr;
|
||||
|
||||
if (libPtr == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
|
||||
MEMORY_BASIC_INFORMATION info;
|
||||
IMAGE_DOS_HEADER *dos;
|
||||
IMAGE_NT_HEADERS *pe;
|
||||
IMAGE_FILE_HEADER *file;
|
||||
IMAGE_OPTIONAL_HEADER *opt;
|
||||
|
||||
if (!VirtualQuery(libPtr, &info, sizeof(MEMORY_BASIC_INFORMATION)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
baseAddr = reinterpret_cast<uintptr_t>(info.AllocationBase);
|
||||
|
||||
/* All this is for our insane sanity checks :o */
|
||||
dos = reinterpret_cast<IMAGE_DOS_HEADER *>(baseAddr);
|
||||
pe = reinterpret_cast<IMAGE_NT_HEADERS *>(baseAddr + dos->e_lfanew);
|
||||
file = &pe->FileHeader;
|
||||
opt = &pe->OptionalHeader;
|
||||
|
||||
/* Check PE magic and signature */
|
||||
if (dos->e_magic != IMAGE_DOS_SIGNATURE || pe->Signature != IMAGE_NT_SIGNATURE || opt->Magic != IMAGE_NT_OPTIONAL_HDR32_MAGIC)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check architecture, which is 32-bit/x86 right now
|
||||
* Should change this for 64-bit if Valve gets their act together
|
||||
*/
|
||||
if (file->Machine != IMAGE_FILE_MACHINE_I386)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* For our purposes, this must be a dynamic library */
|
||||
if ((file->Characteristics & IMAGE_FILE_DLL) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Finally, we can do this */
|
||||
lib.memorySize = opt->SizeOfImage;
|
||||
|
||||
#elif defined PLATFORM_LINUX
|
||||
|
||||
Dl_info info;
|
||||
Elf32_Ehdr *file;
|
||||
Elf32_Phdr *phdr;
|
||||
uint16_t phdrCount;
|
||||
|
||||
if (!dladdr(libPtr, &info))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!info.dli_fbase || !info.dli_fname)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* This is for our insane sanity checks :o */
|
||||
baseAddr = reinterpret_cast<uintptr_t>(info.dli_fbase);
|
||||
file = reinterpret_cast<Elf32_Ehdr *>(baseAddr);
|
||||
|
||||
/* Check ELF magic */
|
||||
if (memcmp(ELFMAG, file->e_ident, SELFMAG) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check ELF version */
|
||||
if (file->e_ident[EI_VERSION] != EV_CURRENT)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check ELF architecture, which is 32-bit/x86 right now
|
||||
* Should change this for 64-bit if Valve gets their act together
|
||||
*/
|
||||
if (file->e_ident[EI_CLASS] != ELFCLASS32 || file->e_machine != EM_386 || file->e_ident[EI_DATA] != ELFDATA2LSB)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* For our purposes, this must be a dynamic library/shared object */
|
||||
if (file->e_type != ET_DYN)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
phdrCount = file->e_phnum;
|
||||
phdr = reinterpret_cast<Elf32_Phdr *>(baseAddr + file->e_phoff);
|
||||
|
||||
for (uint16_t i = 0; i < phdrCount; i++)
|
||||
{
|
||||
Elf32_Phdr &hdr = phdr[i];
|
||||
|
||||
/* We only really care about the segment with executable code */
|
||||
if (hdr.p_type == PT_LOAD && hdr.p_flags == (PF_X|PF_R))
|
||||
{
|
||||
/* From glibc, elf/dl-load.c:
|
||||
* c->mapend = ((ph->p_vaddr + ph->p_filesz + GLRO(dl_pagesize) - 1)
|
||||
* & ~(GLRO(dl_pagesize) - 1));
|
||||
*
|
||||
* In glibc, the segment file size is aligned up to the nearest page size and
|
||||
* added to the virtual address of the segment. We just want the size here.
|
||||
*/
|
||||
lib.memorySize = PAGE_ALIGN_UP(hdr.p_filesz);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined PLATFORM_APPLE
|
||||
|
||||
Dl_info info;
|
||||
struct mach_header *file;
|
||||
struct segment_command *seg;
|
||||
uint32_t cmd_count;
|
||||
|
||||
if (!dladdr(libPtr, &info))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!info.dli_fbase || !info.dli_fname)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* This is for our insane sanity checks :o */
|
||||
baseAddr = (uintptr_t)info.dli_fbase;
|
||||
file = (struct mach_header *)baseAddr;
|
||||
|
||||
/* Check Mach-O magic */
|
||||
if (file->magic != MH_MAGIC)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check architecture (32-bit/x86) */
|
||||
if (file->cputype != CPU_TYPE_I386 || file->cpusubtype != CPU_SUBTYPE_I386_ALL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* For our purposes, this must be a dynamic library */
|
||||
if (file->filetype != MH_DYLIB)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
cmd_count = file->ncmds;
|
||||
seg = (struct segment_command *)(baseAddr + sizeof(struct mach_header));
|
||||
|
||||
/* Add up memory sizes of mapped segments */
|
||||
for (uint32_t i = 0; i < cmd_count; i++)
|
||||
{
|
||||
if (seg->cmd == LC_SEGMENT)
|
||||
{
|
||||
lib.memorySize += seg->vmsize;
|
||||
}
|
||||
|
||||
seg = (struct segment_command *)((uintptr_t)seg + seg->cmdsize);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
lib.baseAddress = reinterpret_cast<void *>(baseAddr);
|
||||
|
||||
return true;
|
||||
}
|
||||
+3
-35
@@ -36,7 +36,6 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
#include <IPluginSys.h>
|
||||
#include "stringutil.h"
|
||||
|
||||
ProfileEngine g_Profiler;
|
||||
IProfiler *sm_profiler = &g_Profiler;
|
||||
@@ -342,46 +341,15 @@ void ProfileEngine::OnRootConsoleCommand2(const char *cmdname, const ICommandArg
|
||||
GenerateReport(fp);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
Clear();
|
||||
|
||||
rootmenu->ConsolePrint("Profiler report generated as: %s\n", path);
|
||||
|
||||
return;
|
||||
}
|
||||
else if (strcmp(command->Arg(2), "report") == 0)
|
||||
{
|
||||
FILE *fp;
|
||||
char path[256];
|
||||
|
||||
g_pSM->BuildPath(Path_SM, path, sizeof(path), "logs/profile_%d.xml", (int)time(NULL));
|
||||
|
||||
if ((fp = fopen(path, "wt")) == NULL)
|
||||
{
|
||||
rootmenu->ConsolePrint("Failed, could not open file for writing: %s", path);
|
||||
return;
|
||||
}
|
||||
|
||||
GenerateReport(fp);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
rootmenu->ConsolePrint("Profiler report generated as: %s\n", path);
|
||||
return;
|
||||
}
|
||||
else if (strcmp(command->Arg(2), "clear") == 0)
|
||||
{
|
||||
Clear();
|
||||
|
||||
rootmenu->ConsolePrint("Profiler statistics cleared.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rootmenu->ConsolePrint("Profiler commands:");
|
||||
rootmenu->DrawGenericOption("flush", "Flushes statistics to disk and starts over");
|
||||
rootmenu->DrawGenericOption("report", "Flushes statistics to disk");
|
||||
rootmenu->DrawGenericOption("clear", "Clears statistics");
|
||||
}
|
||||
|
||||
bool ProfileEngine::GenerateReport(FILE *fp)
|
||||
@@ -418,9 +386,9 @@ void ProfileEngine::WriteReport(FILE *fp, ProfileReport *report, const char *nam
|
||||
{
|
||||
ar = report->GetReport(i);
|
||||
|
||||
strncopy(new_name, ar->atom_name, sizeof(new_name));
|
||||
UTIL_ReplaceAll(new_name, sizeof(new_name), "<", "<", true);
|
||||
UTIL_ReplaceAll(new_name, sizeof(new_name), ">", ">", true);
|
||||
smcore.strncopy(new_name, ar->atom_name, sizeof(new_name));
|
||||
smcore.ReplaceAll(new_name, sizeof(new_name), "<", "<", true);
|
||||
smcore.ReplaceAll(new_name, sizeof(new_name), ">", ">", true);
|
||||
|
||||
fprintf(fp, " <item name=\"%s\" numcalls=\"%d\" mintime=\"%f\" maxtime=\"%f\" totaltime=\"%f\"/>\n",
|
||||
new_name,
|
||||
|
||||
@@ -872,7 +872,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
||||
ptr = save_ptr;
|
||||
|
||||
/* Lastly, strip ending whitespace off */
|
||||
for (size_t i=len-1; i<len; i--)
|
||||
for (size_t i=len-1; i>=0 && i<len; i--)
|
||||
{
|
||||
if (g_ws_chartable[(unsigned char)ptr[i]])
|
||||
{
|
||||
|
||||
@@ -33,14 +33,9 @@
|
||||
#include <sm_platform.h>
|
||||
#include <string.h>
|
||||
#include "common_logic.h"
|
||||
#include "ThreadSupport.h"
|
||||
#include "TextParsers.h"
|
||||
#include "Profiler.h"
|
||||
#include "sm_crc32.h"
|
||||
#include "MemoryUtils.h"
|
||||
#include "stringutil.h"
|
||||
#include "ThreadSupport.h"
|
||||
#include "Translator.h"
|
||||
#include "GameConfigs.h"
|
||||
|
||||
sm_core_t smcore;
|
||||
IHandleSys *handlesys;
|
||||
@@ -54,35 +49,12 @@ IShareSys *sharesys;
|
||||
IRootConsole *rootmenu;
|
||||
IPluginManager *pluginsys;
|
||||
IForwardManager *forwardsys;
|
||||
ITimerSystem *timersys;
|
||||
ServerGlobals serverGlobals;
|
||||
IPlayerManager *playerhelpers;
|
||||
IAdminSystem *adminsys;
|
||||
IGameHelpers *gamehelpers;
|
||||
|
||||
static void AddCorePhraseFile(const char *filename)
|
||||
{
|
||||
g_pCorePhrases->AddPhraseFile(filename);
|
||||
}
|
||||
|
||||
static IGameConfig *GetCoreGameConfig()
|
||||
{
|
||||
return g_pGameConf;
|
||||
}
|
||||
|
||||
static sm_logic_t logic =
|
||||
{
|
||||
NULL,
|
||||
g_pThreader,
|
||||
sm_profiler,
|
||||
&g_Translator,
|
||||
stristr,
|
||||
CoreTranslate,
|
||||
AddCorePhraseFile,
|
||||
UTIL_ReplaceAll,
|
||||
UTIL_ReplaceEx,
|
||||
UTIL_DecodeHexString,
|
||||
GetCoreGameConfig
|
||||
sm_profiler
|
||||
};
|
||||
|
||||
static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
|
||||
@@ -91,7 +63,6 @@ static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
|
||||
|
||||
memcpy(&smcore, core, sizeof(sm_core_t));
|
||||
memcpy(_logic, &logic, sizeof(sm_logic_t));
|
||||
memcpy(&serverGlobals, core->serverGlobals, sizeof(ServerGlobals));
|
||||
|
||||
handlesys = core->handlesys;
|
||||
libsys = core->libsys;
|
||||
@@ -102,10 +73,6 @@ static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
|
||||
rootmenu = core->rootmenu;
|
||||
pluginsys = core->pluginsys;
|
||||
forwardsys = core->forwardsys;
|
||||
timersys = core->timersys;
|
||||
playerhelpers = core->playerhelpers;
|
||||
adminsys = core->adminsys;
|
||||
gamehelpers = core->gamehelpers;
|
||||
}
|
||||
|
||||
PLATFORM_EXTERN_C ITextParsers *get_textparsers()
|
||||
|
||||
@@ -47,11 +47,6 @@ extern IShareSys *sharesys;
|
||||
extern IRootConsole *rootmenu;
|
||||
extern IPluginManager *pluginsys;
|
||||
extern IForwardManager *forwardsys;
|
||||
extern ITimerSystem *timersys;
|
||||
extern ServerGlobals serverGlobals;
|
||||
extern IPlayerManager *playerhelpers;
|
||||
extern IAdminSystem *adminsys;
|
||||
extern IGameHelpers *gamehelpers;
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_COMMON_LOGIC_H_ */
|
||||
|
||||
|
||||
+2
-58
@@ -42,7 +42,7 @@ using namespace SourceMod;
|
||||
* Add 1 to the RHS of this expression to bump the intercom file
|
||||
* This is to prevent mismatching core/logic binaries
|
||||
*/
|
||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 18)
|
||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 2)
|
||||
|
||||
#if defined SM_LOGIC
|
||||
class IVEngineServer
|
||||
@@ -52,21 +52,6 @@ class IVEngineServer_Logic
|
||||
{
|
||||
public:
|
||||
virtual bool IsMapValid(const char *map) = 0;
|
||||
virtual void ServerCommand(const char *cmd) = 0;
|
||||
};
|
||||
|
||||
typedef int FileFindHandle_t;
|
||||
|
||||
#if defined SM_LOGIC
|
||||
class IFileSystem
|
||||
#else
|
||||
class IFileSystem_Logic
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
virtual const char *FindFirstEx(const char *pWildCard, const char *pPathID, FileFindHandle_t *pHandle) = 0;
|
||||
virtual const char *FindNext(FileFindHandle_t handle) = 0;
|
||||
virtual void FindClose(FileFindHandle_t handle) = 0;
|
||||
};
|
||||
|
||||
namespace SourceMod
|
||||
@@ -78,26 +63,11 @@ namespace SourceMod
|
||||
class IRootConsole;
|
||||
class IPluginManager;
|
||||
class IForwardManager;
|
||||
class ITimerSystem;
|
||||
class IPlayerManager;
|
||||
class IAdminSystem;
|
||||
class IGameHelpers;
|
||||
class IPhraseCollection;
|
||||
class ITranslator;
|
||||
class IGameConfig;
|
||||
}
|
||||
|
||||
class IVEngineServer;
|
||||
class IFileSystem;
|
||||
class ConVar;
|
||||
|
||||
struct ServerGlobals
|
||||
{
|
||||
const double *universalTime;
|
||||
float *interval_per_tick;
|
||||
float *frametime;
|
||||
};
|
||||
|
||||
struct sm_core_t
|
||||
{
|
||||
/* Objects */
|
||||
@@ -106,15 +76,10 @@ struct sm_core_t
|
||||
ISourceMod *sm;
|
||||
ILibrarySys *libsys;
|
||||
IVEngineServer *engine;
|
||||
IFileSystem *filesystem;
|
||||
IShareSys *sharesys;
|
||||
IRootConsole *rootmenu;
|
||||
IPluginManager *pluginsys;
|
||||
IForwardManager *forwardsys;
|
||||
ITimerSystem *timersys;
|
||||
IPlayerManager *playerhelpers;
|
||||
IAdminSystem *adminsys;
|
||||
IGameHelpers *gamehelpers;
|
||||
/* Functions */
|
||||
void (*AddNatives)(sp_nativeinfo_t* nlist);
|
||||
ConVar * (*FindConVar)(const char*);
|
||||
@@ -123,20 +88,7 @@ struct sm_core_t
|
||||
void (*LogError)(const char*, ...);
|
||||
const char * (*GetCvarString)(ConVar*);
|
||||
size_t (*Format)(char*, size_t, const char*, ...);
|
||||
void (*GenerateError)(IPluginContext *, cell_t, int, const char *, ...);
|
||||
bool (*gnprintf)(char *, size_t, const char *, IPhraseCollection *, void **,
|
||||
unsigned int, unsigned int &, size_t *, const char **);
|
||||
size_t (*atcprintf)(char *, size_t, const char *, IPluginContext *, const cell_t *, int *);
|
||||
bool (*GetGameName)(char *buffer, size_t maxlength);
|
||||
const char * (*GetGameDescription)();
|
||||
const char * (*GetSourceEngineName)();
|
||||
bool (*SymbolsAreHidden)();
|
||||
const char * (*GetCoreConfigValue)(const char*);
|
||||
/* Data */
|
||||
ServerGlobals *serverGlobals;
|
||||
void * serverFactory;
|
||||
void * engineFactory;
|
||||
void * matchmakingDSFactory;
|
||||
unsigned int (*ReplaceAll)(char*, size_t, const char *, const char *, bool);
|
||||
};
|
||||
|
||||
struct sm_logic_t
|
||||
@@ -144,14 +96,6 @@ struct sm_logic_t
|
||||
SMGlobalClass *head;
|
||||
IThreader *threader;
|
||||
IProfiler *profiler;
|
||||
ITranslator *translator;
|
||||
const char *(*stristr)(const char *, const char *);
|
||||
bool (*CoreTranslate)(char *, size_t, const char *, unsigned int, size_t *, ...);
|
||||
void (*AddCorePhraseFile)(const char *filename);
|
||||
unsigned int (*ReplaceAll)(char*, size_t, const char *, const char *, bool);
|
||||
char *(*ReplaceEx)(char *, size_t, const char *, size_t, const char *, size_t, bool);
|
||||
size_t (*DecodeHexString)(unsigned char *, size_t, const char *);
|
||||
IGameConfig * (*GetCoreGameConfig)();
|
||||
};
|
||||
|
||||
typedef void (*LogicInitFunction)(const sm_core_t *core, sm_logic_t *logic);
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "logic", "logic.vcxproj", "{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,175 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}</ProjectGuid>
|
||||
<RootNamespace>jitx86</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">sourcemod.logic</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">sourcemod.logic</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..;$(MMSOURCE19)\core\sourcehook;..\..\..\public;..\..\..\public\sourcepawn;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;JITX86_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SM_DEFAULT_THREADER;SM_LOGIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)$(TargetFileName)</OutputFile>
|
||||
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..\public</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>..;$(MMSOURCE19)\core\sourcehook;..\..\..\public;..\..\..\public\sourcepawn;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;JITX86_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SM_LOGIC;SM_DEFAULT_THREADER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)$(TargetFileName)</OutputFile>
|
||||
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..\public</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\common_logic.cpp" />
|
||||
<ClCompile Include="..\GameConfigs.cpp" />
|
||||
<ClCompile Include="..\MemoryUtils.cpp" />
|
||||
<ClCompile Include="..\PhraseCollection.cpp" />
|
||||
<ClCompile Include="..\Profiler.cpp" />
|
||||
<ClCompile Include="..\sm_crc32.cpp" />
|
||||
<ClCompile Include="..\smn_admin.cpp" />
|
||||
<ClCompile Include="..\smn_adt_array.cpp" />
|
||||
<ClCompile Include="..\smn_adt_stack.cpp" />
|
||||
<ClCompile Include="..\smn_adt_trie.cpp" />
|
||||
<ClCompile Include="..\smn_banning.cpp" />
|
||||
<ClCompile Include="..\smn_datapacks.cpp" />
|
||||
<ClCompile Include="..\smn_float.cpp" />
|
||||
<ClCompile Include="..\smn_functions.cpp" />
|
||||
<ClCompile Include="..\smn_gameconfigs.cpp" />
|
||||
<ClCompile Include="..\smn_handles.cpp" />
|
||||
<ClCompile Include="..\smn_lang.cpp" />
|
||||
<ClCompile Include="..\smn_maplists.cpp" />
|
||||
<ClCompile Include="..\smn_players.cpp" />
|
||||
<ClCompile Include="..\smn_sorting.cpp" />
|
||||
<ClCompile Include="..\smn_string.cpp" />
|
||||
<ClCompile Include="..\smn_textparse.cpp" />
|
||||
<ClCompile Include="..\smn_timers.cpp" />
|
||||
<ClCompile Include="..\stringutil.cpp" />
|
||||
<ClCompile Include="..\TextParsers.cpp" />
|
||||
<ClCompile Include="..\ThreadSupport.cpp" />
|
||||
<ClCompile Include="..\Translator.cpp" />
|
||||
<ClCompile Include="..\thread\BaseWorker.cpp" />
|
||||
<ClCompile Include="..\thread\ThreadWorker.cpp" />
|
||||
<ClCompile Include="..\thread\WinThreads.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\public\sm_platform.h" />
|
||||
<ClInclude Include="..\..\..\public\sm_trie_tpl.h" />
|
||||
<ClInclude Include="..\..\..\public\sourcemod_version.h" />
|
||||
<ClInclude Include="..\AutoHandleRooter.h" />
|
||||
<ClInclude Include="..\CellArray.h" />
|
||||
<ClInclude Include="..\common_logic.h" />
|
||||
<ClInclude Include="..\GameConfigs.h" />
|
||||
<ClInclude Include="..\intercom.h" />
|
||||
<ClInclude Include="..\MemoryUtils.h" />
|
||||
<ClInclude Include="..\MersenneTwister.h" />
|
||||
<ClInclude Include="..\PhraseCollection.h" />
|
||||
<ClInclude Include="..\Profiler.h" />
|
||||
<ClInclude Include="..\sm_crc32.h" />
|
||||
<ClInclude Include="..\sm_memtable.h" />
|
||||
<ClInclude Include="..\sm_symtable.h" />
|
||||
<ClInclude Include="..\stringutil.h" />
|
||||
<ClInclude Include="..\TextParsers.h" />
|
||||
<ClInclude Include="..\ThreadSupport.h" />
|
||||
<ClInclude Include="..\thread\BaseWorker.h" />
|
||||
<ClInclude Include="..\thread\ThreadWorker.h" />
|
||||
<ClInclude Include="..\thread\WinThreads.h" />
|
||||
<ClInclude Include="..\Translator.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\version.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,194 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Threads">
|
||||
<UniqueIdentifier>{67c1ebce-c1f8-4d2c-9ef4-33f0ef6343e9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Threads\Header Files">
|
||||
<UniqueIdentifier>{c6e2ebb3-4869-4453-9b83-e49f70cb8a05}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Threads\Source Files">
|
||||
<UniqueIdentifier>{e6d8a9af-1c1b-4f0c-ae06-a9ebd5cd32e4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Natives">
|
||||
<UniqueIdentifier>{126462f2-e517-4854-8a94-759e56787536}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\common_logic.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GameConfigs.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\MemoryUtils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\PhraseCollection.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Profiler.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sm_crc32.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\stringutil.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\TextParsers.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ThreadSupport.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Translator.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\thread\BaseWorker.cpp">
|
||||
<Filter>Threads\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\thread\ThreadWorker.cpp">
|
||||
<Filter>Threads\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\thread\WinThreads.cpp">
|
||||
<Filter>Threads\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_admin.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_timers.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_adt_array.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_adt_stack.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_adt_trie.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_banning.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_datapacks.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_float.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_functions.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_gameconfigs.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_handles.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_lang.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_maplists.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_players.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_sorting.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_string.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_textparse.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\CellArray.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\common_logic.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\intercom.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Profiler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\TextParsers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ThreadSupport.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\thread\BaseWorker.h">
|
||||
<Filter>Threads\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\thread\ThreadWorker.h">
|
||||
<Filter>Threads\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\thread\WinThreads.h">
|
||||
<Filter>Threads\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AutoHandleRooter.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GameConfigs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MemoryUtils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MersenneTwister.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\PhraseCollection.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_crc32.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_memtable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_symtable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\stringutil.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Translator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\public\sm_trie_tpl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\public\sourcemod_version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\public\sm_platform.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\version.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -42,7 +42,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..;"$(MMSOURCE17)\core\sourcehook";..\..\..\public;..\..\..\public\sourcepawn"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;JITX86_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SM_DEFAULT_THREADER;SM_LOGIC"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;JITX86_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SM_DEFAULT_THREADER"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@@ -64,7 +64,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\sourcemod.logic.dll"
|
||||
OutputFile="$(OutDir)\sourcepawn.jit.x86.dll"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||
GenerateDebugInformation="true"
|
||||
@@ -185,19 +185,11 @@
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\common_logic.cpp"
|
||||
RelativePath="..\smn_functions.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\GameConfigs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\MemoryUtils.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PhraseCollection.cpp"
|
||||
RelativePath="..\smn_adt_trie.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -205,11 +197,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_crc32.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_admin.cpp"
|
||||
RelativePath="..\common_logic.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -220,66 +208,22 @@
|
||||
RelativePath="..\smn_adt_stack.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_adt_trie.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_banning.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_datapacks.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_float.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_functions.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_gameconfigs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_handles.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_lang.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_maplists.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_players.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_sorting.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_string.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_textparse.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_timers.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\stringutil.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\TextParsers.cpp"
|
||||
>
|
||||
@@ -288,10 +232,6 @@
|
||||
RelativePath="..\ThreadSupport.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Translator.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
@@ -310,10 +250,6 @@
|
||||
RelativePath="..\intercom.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Profiler.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\svn_version.h"
|
||||
>
|
||||
@@ -326,6 +262,10 @@
|
||||
RelativePath="..\ThreadSupport.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Profiler.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
@@ -336,6 +276,10 @@
|
||||
RelativePath="..\svn_version.tpl"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\version.rc"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Threads"
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* 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
|
||||
* "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
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
|
||||
#define _INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
class BaseMemTable
|
||||
{
|
||||
public:
|
||||
BaseMemTable(unsigned int init_size)
|
||||
{
|
||||
membase = (unsigned char *)malloc(init_size);
|
||||
size = init_size;
|
||||
tail = 0;
|
||||
}
|
||||
~BaseMemTable()
|
||||
{
|
||||
free(membase);
|
||||
membase = NULL;
|
||||
}
|
||||
public:
|
||||
/**
|
||||
* Allocates 'size' bytes of memory.
|
||||
* Optionally outputs the address through 'addr'.
|
||||
* Returns an index >= 0 on success, < 0 on failure.
|
||||
*/
|
||||
int CreateMem(unsigned int addsize, void **addr)
|
||||
{
|
||||
int idx = (int)tail;
|
||||
|
||||
while (tail + addsize >= size) {
|
||||
size *= 2;
|
||||
membase = (unsigned char *)realloc(membase, size);
|
||||
}
|
||||
|
||||
tail += addsize;
|
||||
if (addr)
|
||||
*addr = (void *)&membase[idx];
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an index into the memory table, returns its address.
|
||||
* Returns NULL if invalid.
|
||||
*/
|
||||
void *GetAddress(int index)
|
||||
{
|
||||
if (index < 0 || (unsigned int)index >= tail)
|
||||
return NULL;
|
||||
return &membase[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Scraps the memory table. For caching purposes, the memory
|
||||
* is not freed, however subsequent calls to CreateMem() will
|
||||
* begin at the first index again.
|
||||
*/
|
||||
void Reset()
|
||||
{
|
||||
tail = 0;
|
||||
}
|
||||
|
||||
inline unsigned int GetMemUsage()
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
inline unsigned int GetActualMemUsed()
|
||||
{
|
||||
return tail;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned char *membase;
|
||||
unsigned int size;
|
||||
unsigned int tail;
|
||||
};
|
||||
|
||||
class BaseStringTable
|
||||
{
|
||||
public:
|
||||
BaseStringTable(unsigned int init_size) : m_table(init_size)
|
||||
{
|
||||
}
|
||||
public:
|
||||
/**
|
||||
* Adds a string to the string table and returns its index.
|
||||
*/
|
||||
int AddString(const char *string)
|
||||
{
|
||||
size_t len = strlen(string) + 1;
|
||||
int idx;
|
||||
char *addr;
|
||||
|
||||
idx = m_table.CreateMem(len, (void **)&addr);
|
||||
strcpy(addr, string);
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an index into the string table, returns the associated string.
|
||||
*/
|
||||
inline const char *GetString(int str)
|
||||
{
|
||||
return (const char *)m_table.GetAddress(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scraps the string table. For caching purposes, the memory
|
||||
* is not freed, however subsequent calls to AddString() will
|
||||
* begin at the first index again.
|
||||
*/
|
||||
void Reset()
|
||||
{
|
||||
m_table.Reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parent BaseMemTable that this string table uses.
|
||||
*/
|
||||
inline BaseMemTable *GetMemTable()
|
||||
{
|
||||
return &m_table;
|
||||
}
|
||||
private:
|
||||
BaseMemTable m_table;
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
|
||||
|
||||
+46
-71
@@ -33,11 +33,9 @@
|
||||
#include <sm_trie_tpl.h>
|
||||
#include "common_logic.h"
|
||||
#include "CellArray.h"
|
||||
#include <IGameHelpers.h>
|
||||
#include <ILibrarySys.h>
|
||||
#include <ITextParsers.h>
|
||||
#include <ISourceMod.h>
|
||||
#include "stringutil.h"
|
||||
|
||||
using namespace SourceHook;
|
||||
|
||||
@@ -80,47 +78,6 @@ public:
|
||||
{
|
||||
DumpCache(NULL);
|
||||
}
|
||||
void GetMapCycleFilePath(char *pBuffer, int maxlen)
|
||||
{
|
||||
const char *pEngineName = smcore.GetSourceEngineName();
|
||||
const char *pMapCycleFileName = m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt";
|
||||
|
||||
if (strcmp(pEngineName, "tf2") == 0 || strcmp(pEngineName, "css") == 0
|
||||
|| strcmp(pEngineName, "dods") == 0 || strcmp(pEngineName, "hl2dm") == 0)
|
||||
{
|
||||
// These four games and Source SDK 2013 do a lookup in this order; so shall we.
|
||||
g_pSM->BuildPath(Path_Game,
|
||||
pBuffer,
|
||||
maxlen,
|
||||
"cfg/%s",
|
||||
pMapCycleFileName);
|
||||
|
||||
if (!libsys->PathExists(pBuffer))
|
||||
{
|
||||
g_pSM->BuildPath(Path_Game,
|
||||
pBuffer,
|
||||
maxlen,
|
||||
"%s",
|
||||
pMapCycleFileName);
|
||||
|
||||
if (!libsys->PathExists(pBuffer))
|
||||
{
|
||||
g_pSM->BuildPath(Path_Game,
|
||||
pBuffer,
|
||||
maxlen,
|
||||
"cfg/mapcycle_default.txt");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_pSM->BuildPath(Path_Game,
|
||||
pBuffer,
|
||||
maxlen,
|
||||
"%s",
|
||||
pMapCycleFileName);
|
||||
}
|
||||
}
|
||||
void AddOrUpdateDefault(const char *name, const char *file)
|
||||
{
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
@@ -197,9 +154,11 @@ public:
|
||||
|
||||
pDefList->bIsPath = true;
|
||||
smcore.strncopy(pDefList->name, "mapcyclefile", sizeof(pDefList->name));
|
||||
|
||||
GetMapCycleFilePath(pDefList->path, sizeof(pDefList->path));
|
||||
|
||||
g_pSM->BuildPath(Path_Game,
|
||||
pDefList->path,
|
||||
sizeof(pDefList->path),
|
||||
"%s",
|
||||
m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt");
|
||||
pDefList->last_modified_time = 0;
|
||||
pDefList->pArray = NULL;
|
||||
pDefList->serial = 0;
|
||||
@@ -389,39 +348,51 @@ public:
|
||||
if ((success && pNewArray == NULL)
|
||||
|| (!success && ((flags & MAPLIST_FLAG_MAPSFOLDER) == MAPLIST_FLAG_MAPSFOLDER)))
|
||||
{
|
||||
char path[255];
|
||||
IDirectory *pDir;
|
||||
|
||||
pNewArray = new CellArray(64);
|
||||
free_new_array = true;
|
||||
g_pSM->BuildPath(Path_Game, path, sizeof(path), "maps");
|
||||
|
||||
cell_t *blk;
|
||||
|
||||
FileFindHandle_t findHandle;
|
||||
const char *fileName = smcore.filesystem->FindFirstEx("maps/*.bsp", "GAME", &findHandle);
|
||||
|
||||
while (fileName)
|
||||
if ((pDir = libsys->OpenDirectory(path)) != NULL)
|
||||
{
|
||||
char *ptr;
|
||||
cell_t *blk;
|
||||
char buffer[PLATFORM_MAX_PATH];
|
||||
|
||||
UTIL_StripExtension(fileName, buffer, sizeof(buffer));
|
||||
|
||||
if (!engine->IsMapValid(buffer))
|
||||
while (pDir->MoreFiles())
|
||||
{
|
||||
fileName = smcore.filesystem->FindNext(findHandle);
|
||||
continue;
|
||||
if (!pDir->IsEntryFile()
|
||||
|| strcmp(pDir->GetEntryName(), ".") == 0
|
||||
|| strcmp(pDir->GetEntryName(), "..") == 0)
|
||||
{
|
||||
pDir->NextEntry();
|
||||
continue;
|
||||
}
|
||||
smcore.strncopy(buffer, pDir->GetEntryName(), sizeof(buffer));
|
||||
if ((ptr = strstr(buffer, ".bsp")) == NULL || ptr[4] != '\0')
|
||||
{
|
||||
pDir->NextEntry();
|
||||
continue;
|
||||
}
|
||||
*ptr = '\0';
|
||||
if (!engine->IsMapValid(buffer))
|
||||
{
|
||||
pDir->NextEntry();
|
||||
continue;
|
||||
}
|
||||
if ((blk = pNewArray->push()) == NULL)
|
||||
{
|
||||
pDir->NextEntry();
|
||||
continue;
|
||||
}
|
||||
smcore.strncopy((char *)blk, buffer, 255);
|
||||
pDir->NextEntry();
|
||||
}
|
||||
|
||||
if ((blk = pNewArray->push()) == NULL)
|
||||
{
|
||||
fileName = smcore.filesystem->FindNext(findHandle);
|
||||
continue;
|
||||
}
|
||||
|
||||
smcore.strncopy((char *)blk, buffer, 255);
|
||||
|
||||
fileName = smcore.filesystem->FindNext(findHandle);
|
||||
libsys->CloseDirectory(pDir);
|
||||
}
|
||||
|
||||
smcore.filesystem->FindClose(findHandle);
|
||||
|
||||
/* Remove the array if there were no items. */
|
||||
if (pNewArray->size() == 0)
|
||||
{
|
||||
@@ -514,7 +485,11 @@ private:
|
||||
if (m_pMapCycleFile != NULL && strcmp(name, "mapcyclefile") == 0)
|
||||
{
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
GetMapCycleFilePath(path, sizeof(path));
|
||||
g_pSM->BuildPath(Path_Game,
|
||||
path,
|
||||
sizeof(path),
|
||||
"%s",
|
||||
m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt");
|
||||
|
||||
if (strcmp(path, pMapList->path) != 0)
|
||||
{
|
||||
@@ -549,7 +524,7 @@ private:
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!gamehelpers->IsMapValid(ptr))
|
||||
if (!engine->IsMapValid(ptr))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1,235 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* 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
|
||||
* 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/>.
|
||||
*
|
||||
* 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
|
||||
* "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
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <IPluginSys.h>
|
||||
#include <IPlayerHelpers.h>
|
||||
#include <sh_string.h>
|
||||
#include <sh_list.h>
|
||||
#include "AutoHandleRooter.h"
|
||||
#include "CellArray.h"
|
||||
|
||||
using namespace SourceHook;
|
||||
using namespace SourceMod;
|
||||
|
||||
class PlayerLogicHelpers :
|
||||
public SMGlobalClass,
|
||||
public IPluginsListener,
|
||||
public ICommandTargetProcessor
|
||||
{
|
||||
struct SimpleMultiTargetFilter
|
||||
{
|
||||
IPlugin *plugin;
|
||||
SourceHook::String pattern;
|
||||
IPluginFunction *fun;
|
||||
SourceHook::String phrase;
|
||||
bool phraseIsML;
|
||||
|
||||
SimpleMultiTargetFilter(IPlugin *plugin, const char *pattern, IPluginFunction *fun,
|
||||
const char *phrase, bool phraseIsML)
|
||||
: plugin(plugin), pattern(pattern), fun(fun), phrase(phrase), phraseIsML(phraseIsML)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
List<SimpleMultiTargetFilter *> simpleMultis;
|
||||
bool filterEnabled;
|
||||
|
||||
public:
|
||||
void AddMultiTargetFilter(IPlugin *plugin, const char *pattern, IPluginFunction *fun,
|
||||
const char *phrase, bool phraseIsML)
|
||||
{
|
||||
SimpleMultiTargetFilter *smtf = new SimpleMultiTargetFilter(plugin, pattern, fun, phrase,
|
||||
phraseIsML);
|
||||
|
||||
simpleMultis.push_back(smtf);
|
||||
|
||||
if (!filterEnabled) {
|
||||
playerhelpers->RegisterCommandTargetProcessor(this);
|
||||
filterEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveMultiTargetFilter(const char *pattern, IPluginFunction *fun)
|
||||
{
|
||||
List<SimpleMultiTargetFilter *>::iterator iter = simpleMultis.begin();
|
||||
|
||||
while (iter != simpleMultis.end()) {
|
||||
if ((*iter)->fun == fun && strcmp((*iter)->pattern.c_str(), pattern) == 0) {
|
||||
delete (*iter);
|
||||
iter = simpleMultis.erase(iter);
|
||||
break;
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
PlayerLogicHelpers()
|
||||
: filterEnabled(false)
|
||||
{
|
||||
}
|
||||
|
||||
public: //ICommandTargetProcessor
|
||||
bool ProcessCommandTarget(cmd_target_info_t *info)
|
||||
{
|
||||
List<SimpleMultiTargetFilter *>::iterator iter;
|
||||
|
||||
for (iter = simpleMultis.begin(); iter != simpleMultis.end(); iter++) {
|
||||
SimpleMultiTargetFilter *smtf = (*iter);
|
||||
if (strcmp(smtf->pattern.c_str(), info->pattern) == 0) {
|
||||
CellArray *array = new CellArray(1);
|
||||
HandleSecurity sec(g_pCoreIdent, g_pCoreIdent);
|
||||
Handle_t hndl = handlesys->CreateHandleEx(htCellArray, array, &sec, NULL, NULL);
|
||||
AutoHandleCloner ahc(hndl, sec);
|
||||
if (ahc.getClone() == BAD_HANDLE) {
|
||||
smcore.LogError("[SM] Could not allocate a handle (%s, %d)", __FILE__, __LINE__);
|
||||
delete array;
|
||||
return false;
|
||||
}
|
||||
|
||||
smtf->fun->PushString(info->pattern);
|
||||
smtf->fun->PushCell(ahc.getClone());
|
||||
cell_t result = 0;
|
||||
if (smtf->fun->Execute(&result) != SP_ERROR_NONE || !result)
|
||||
return false;
|
||||
|
||||
IGamePlayer *pAdmin = info->admin
|
||||
? playerhelpers->GetGamePlayer(info->admin)
|
||||
: NULL;
|
||||
|
||||
info->num_targets = 0;
|
||||
for (size_t i = 0; i < array->size(); i++) {
|
||||
cell_t client = *array->at(i);
|
||||
IGamePlayer *pClient = playerhelpers->GetGamePlayer(client);
|
||||
if (pClient == NULL || !pClient->IsConnected())
|
||||
continue;
|
||||
if (playerhelpers->FilterCommandTarget(pAdmin, pClient, info->flags) ==
|
||||
COMMAND_TARGET_VALID)
|
||||
{
|
||||
info->targets[info->num_targets++] = client;
|
||||
if (info->num_targets >= unsigned(info->max_targets))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
info->reason = info->num_targets > 0
|
||||
? COMMAND_TARGET_VALID
|
||||
: COMMAND_TARGET_EMPTY_FILTER;
|
||||
if (info->num_targets) {
|
||||
smcore.strncopy(info->target_name, smtf->phrase.c_str(), info->target_name_maxlength);
|
||||
info->target_name_style = smtf->phraseIsML
|
||||
? COMMAND_TARGETNAME_ML
|
||||
: COMMAND_TARGETNAME_RAW;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public: //SMGlobalClass
|
||||
void OnSourceModAllInitialized()
|
||||
{
|
||||
pluginsys->AddPluginsListener(this);
|
||||
}
|
||||
|
||||
void OnSourceModShutdown()
|
||||
{
|
||||
pluginsys->RemovePluginsListener(this);
|
||||
if (filterEnabled) {
|
||||
playerhelpers->UnregisterCommandTargetProcessor(this);
|
||||
filterEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public: //IPluginsListener
|
||||
|
||||
void OnPluginDestroyed(IPlugin *plugin)
|
||||
{
|
||||
List<SimpleMultiTargetFilter *>::iterator iter = simpleMultis.begin();
|
||||
|
||||
while (iter != simpleMultis.end()) {
|
||||
if ((*iter)->plugin != plugin) {
|
||||
iter++;
|
||||
} else {
|
||||
delete (*iter);
|
||||
iter = simpleMultis.erase(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
} s_PlayerLogicHelpers;
|
||||
|
||||
static cell_t
|
||||
AddMultiTargetFilter(IPluginContext *ctx, const cell_t *params)
|
||||
{
|
||||
IPluginFunction *fun = ctx->GetFunctionById(funcid_t(params[2]));
|
||||
if (fun == NULL)
|
||||
return ctx->ThrowNativeError("Invalid function id (%X)", params[2]);
|
||||
|
||||
char *pattern;
|
||||
char *phrase;
|
||||
|
||||
ctx->LocalToString(params[1], &pattern);
|
||||
ctx->LocalToString(params[3], &phrase);
|
||||
|
||||
bool phraseIsML = !!params[4];
|
||||
IPlugin *plugin = pluginsys->FindPluginByContext(ctx->GetContext());
|
||||
|
||||
s_PlayerLogicHelpers.AddMultiTargetFilter(plugin, pattern, fun, phrase, phraseIsML);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t
|
||||
RemoveMultiTargetFilter(IPluginContext *ctx, const cell_t *params)
|
||||
{
|
||||
IPluginFunction *fun = ctx->GetFunctionById(funcid_t(params[2]));
|
||||
if (fun == NULL)
|
||||
return ctx->ThrowNativeError("Invalid function id (%X)", params[2]);
|
||||
|
||||
char *pattern;
|
||||
|
||||
ctx->LocalToString(params[1], &pattern);
|
||||
|
||||
s_PlayerLogicHelpers.RemoveMultiTargetFilter(pattern, fun);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(playernatives)
|
||||
{
|
||||
{"AddMultiTargetFilter", AddMultiTargetFilter},
|
||||
{"RemoveMultiTargetFilter", RemoveMultiTargetFilter},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -94,7 +94,7 @@ void sort_random(cell_t *array, cell_t size)
|
||||
|
||||
for (int i = size-1; i > 0; i--)
|
||||
{
|
||||
int n = rand() % (i + 1);
|
||||
int n = (rand() % i) + 1;
|
||||
|
||||
if (array[i] != array[n])
|
||||
{
|
||||
@@ -435,7 +435,7 @@ void sort_adt_random(CellArray *cArray)
|
||||
|
||||
for (int i = arraysize-1; i > 0; i--)
|
||||
{
|
||||
int n = rand() % (i + 1);
|
||||
int n = (rand() % i) + 1;
|
||||
|
||||
cArray->swap(i, n);
|
||||
}
|
||||
|
||||
@@ -1,342 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 et :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 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
|
||||
* 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/>.
|
||||
*
|
||||
* 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
|
||||
* "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
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <sm_platform.h>
|
||||
#include "stringutil.h"
|
||||
|
||||
// We're in logic so we don't have this from the SDK.
|
||||
#ifndef MIN
|
||||
#define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
|
||||
#endif
|
||||
|
||||
const char *stristr(const char *str, const char *substr)
|
||||
{
|
||||
if (!*substr)
|
||||
{
|
||||
return ((char *)str);
|
||||
}
|
||||
|
||||
char *needle = (char *)substr;
|
||||
char *prevloc = (char *)str;
|
||||
char *haystack = (char *)str;
|
||||
|
||||
while (*haystack)
|
||||
{
|
||||
if (tolower(*haystack) == tolower(*needle))
|
||||
{
|
||||
haystack++;
|
||||
if (!*++needle)
|
||||
{
|
||||
return prevloc;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
haystack = ++prevloc;
|
||||
needle = (char *)substr;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int strncopy(char *dest, const char *src, size_t count)
|
||||
{
|
||||
if (!count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *start = dest;
|
||||
while ((*src) && (--count))
|
||||
{
|
||||
*dest++ = *src++;
|
||||
}
|
||||
*dest = '\0';
|
||||
|
||||
return (dest - start);
|
||||
}
|
||||
|
||||
unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive)
|
||||
{
|
||||
size_t searchLen = strlen(search);
|
||||
size_t replaceLen = strlen(replace);
|
||||
|
||||
char *ptr = subject;
|
||||
unsigned int total = 0;
|
||||
while ((ptr = UTIL_ReplaceEx(ptr, maxlength, search, searchLen, replace, replaceLen, caseSensitive)) != NULL)
|
||||
{
|
||||
total++;
|
||||
if (*ptr == '\0')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* NOTE: Do not edit this for the love of god unless you have
|
||||
* read the test cases and understand the code behind each one.
|
||||
* While I don't guarantee there aren't mistakes, I do guarantee
|
||||
* that plugins will end up relying on tiny idiosyncrasies of this
|
||||
* function, just like they did with AMX Mod X.
|
||||
*
|
||||
* There are explicitly more cases than the AMX Mod X version because
|
||||
* we're not doing a blind copy. Each case is specifically optimized
|
||||
* for what needs to be done. Even better, we don't have to error on
|
||||
* bad buffer sizes. Instead, this function will smartly cut off the
|
||||
* string in a way that pushes old data out.
|
||||
*/
|
||||
char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive)
|
||||
{
|
||||
char *ptr = subject;
|
||||
size_t browsed = 0;
|
||||
size_t textLen = strlen(subject);
|
||||
|
||||
/* It's not possible to search or replace */
|
||||
if (searchLen > textLen)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Handle the case of one byte replacement.
|
||||
* It's only valid in one case.
|
||||
*/
|
||||
if (maxLen == 1)
|
||||
{
|
||||
/* If the search matches and the replace length is 0,
|
||||
* we can just terminate the string and be done.
|
||||
*/
|
||||
if ((caseSensitive ? strcmp(subject, search) : strcasecmp(subject, search)) == 0 && replaceLen == 0)
|
||||
{
|
||||
*subject = '\0';
|
||||
return subject;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Subtract one off the maxlength so we can include the null terminator */
|
||||
maxLen--;
|
||||
|
||||
while (*ptr != '\0' && (browsed <= textLen - searchLen))
|
||||
{
|
||||
/* See if we get a comparison */
|
||||
if ((caseSensitive ? strncmp(ptr, search, searchLen) : strncasecmp(ptr, search, searchLen)) == 0)
|
||||
{
|
||||
if (replaceLen > searchLen)
|
||||
{
|
||||
/* First, see if we have enough space to do this operation */
|
||||
if (maxLen - textLen < replaceLen - searchLen)
|
||||
{
|
||||
/* First, see if the replacement length goes out of bounds. */
|
||||
if (browsed + replaceLen >= maxLen)
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDDDDDDDDD
|
||||
* OUTPUT : AADDDDDDDDD
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* If it does, we'll just bound the length and do a strcpy. */
|
||||
replaceLen = maxLen - browsed;
|
||||
/* Note, we add one to the final result for the null terminator */
|
||||
strncopy(ptr, replace, replaceLen+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDDDDDD
|
||||
* OUTPUT : AADDDDDDDCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* We're going to have some bytes left over... */
|
||||
size_t origBytesToCopy = (textLen - (browsed + searchLen)) + 1;
|
||||
size_t realBytesToCopy = (maxLen - (browsed + replaceLen)) + 1;
|
||||
char *moveFrom = ptr + searchLen + (origBytesToCopy - realBytesToCopy);
|
||||
char *moveTo = ptr + replaceLen;
|
||||
|
||||
/* First, move our old data out of the way. */
|
||||
memmove(moveTo, moveFrom, realBytesToCopy);
|
||||
|
||||
/* Now, do our replacement. */
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDDD
|
||||
* OUTPUT : AADDDDCCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* Yes, we have enough space. Do a normal move operation. */
|
||||
char *moveFrom = ptr + searchLen;
|
||||
char *moveTo = ptr + replaceLen;
|
||||
|
||||
/* First move our old data out of the way. */
|
||||
size_t bytesToCopy = (textLen - (browsed + searchLen)) + 1;
|
||||
memmove(moveTo, moveFrom, bytesToCopy);
|
||||
|
||||
/* Now do our replacement. */
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
}
|
||||
else if (replaceLen < searchLen)
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: D
|
||||
* OUTPUT : AADCCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* If the replacement does not grow the string length, we do not
|
||||
* need to do any fancy checking at all. Yay!
|
||||
*/
|
||||
char *moveFrom = ptr + searchLen; /* Start after the search pointer */
|
||||
char *moveTo = ptr + replaceLen; /* Copy to where the replacement ends */
|
||||
|
||||
/* Copy our replacement in, if any */
|
||||
if (replaceLen)
|
||||
{
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
|
||||
/* Figure out how many bytes to move down, including null terminator */
|
||||
size_t bytesToCopy = (textLen - (browsed + searchLen)) + 1;
|
||||
|
||||
/* Move the rest of the string down */
|
||||
memmove(moveTo, moveFrom, bytesToCopy);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDD
|
||||
* OUTPUT : AADDDCCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* We don't have to move anything around, just do a straight copy */
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
|
||||
return ptr + replaceLen;
|
||||
}
|
||||
ptr++;
|
||||
browsed++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t UTIL_DecodeHexString(unsigned char *buffer, size_t maxlength, const char *hexstr)
|
||||
{
|
||||
size_t written = 0;
|
||||
size_t length = strlen(hexstr);
|
||||
|
||||
for (size_t i = 0; i < length; i++)
|
||||
{
|
||||
if (written >= maxlength)
|
||||
break;
|
||||
buffer[written++] = hexstr[i];
|
||||
if (hexstr[i] == '\\' && hexstr[i + 1] == 'x')
|
||||
{
|
||||
if (i + 3 >= length)
|
||||
continue;
|
||||
/* Get the hex part. */
|
||||
char s_byte[3];
|
||||
int r_byte;
|
||||
s_byte[0] = hexstr[i + 2];
|
||||
s_byte[1] = hexstr[i + 3];
|
||||
s_byte[2] = '\0';
|
||||
/* Read it as an integer */
|
||||
sscanf(s_byte, "%x", &r_byte);
|
||||
/* Save the value */
|
||||
buffer[written - 1] = r_byte;
|
||||
/* Adjust index */
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
#define PATHSEPARATOR(c) ((c) == '\\' || (c) == '/')
|
||||
|
||||
void UTIL_StripExtension(const char *in, char *out, int outSize)
|
||||
{
|
||||
// Find the last dot. If it's followed by a dot or a slash, then it's part of a
|
||||
// directory specifier like ../../somedir/./blah.
|
||||
|
||||
// scan backward for '.'
|
||||
int end = strlen(in) - 1;
|
||||
while (end > 0 && in[end] != '.' && !PATHSEPARATOR(in[end]))
|
||||
{
|
||||
--end;
|
||||
}
|
||||
|
||||
if (end > 0 && !PATHSEPARATOR(in[end]) && end < outSize)
|
||||
{
|
||||
int nChars = MIN(end, outSize-1);
|
||||
if (out != in)
|
||||
{
|
||||
memcpy(out, in, nChars);
|
||||
}
|
||||
out[nChars] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// nothing found
|
||||
if (out != in)
|
||||
{
|
||||
strncopy(out, in, outSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 et :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 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
|
||||
* 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/>.
|
||||
*
|
||||
* 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
|
||||
* "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
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_COMMON_STRINGUTIL_H_
|
||||
#define _INCLUDE_SOURCEMOD_COMMON_STRINGUTIL_H_
|
||||
|
||||
const char *stristr(const char *str, const char *substr);
|
||||
unsigned int strncopy(char *dest, const char *src, size_t count);
|
||||
unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search,
|
||||
const char *replace, bool caseSensitive = true);
|
||||
char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen,
|
||||
const char *replace, size_t replaceLen, bool caseSensitive = true);
|
||||
size_t UTIL_DecodeHexString(unsigned char *buffer, size_t maxlength, const char *hexstr);
|
||||
|
||||
void UTIL_StripExtension(const char *in, char *out, int outSize);
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_COMMON_STRINGUTIL_H_ */
|
||||
|
||||
@@ -124,6 +124,11 @@ void BaseWorker::AddThreadToQueue(SWThreadHandle *pHandle)
|
||||
m_ThreadQueue.push_back(pHandle);
|
||||
}
|
||||
|
||||
unsigned int BaseWorker::GetMaxThreadsPerFrame()
|
||||
{
|
||||
return m_perFrame;
|
||||
}
|
||||
|
||||
WorkerState BaseWorker::GetStatus(unsigned int *threads)
|
||||
{
|
||||
if (threads)
|
||||
@@ -135,7 +140,7 @@ WorkerState BaseWorker::GetStatus(unsigned int *threads)
|
||||
unsigned int BaseWorker::RunFrame()
|
||||
{
|
||||
unsigned int done = 0;
|
||||
unsigned int max = m_perFrame;
|
||||
unsigned int max = GetMaxThreadsPerFrame();
|
||||
SWThreadHandle *swt = NULL;
|
||||
IThread *pThread = NULL;
|
||||
|
||||
|
||||
@@ -84,8 +84,6 @@ public: //IWorker
|
||||
virtual unsigned int Flush(bool flush_cancel);
|
||||
//returns status and number of threads in queue
|
||||
virtual WorkerState GetStatus(unsigned int *numThreads);
|
||||
virtual void SetMaxThreadsPerFrame(unsigned int threads);
|
||||
virtual void SetThinkTimePerFrame(unsigned int thinktime) {}
|
||||
public: //IThreadCreator
|
||||
virtual void MakeThread(IThread *pThread);
|
||||
virtual IThreadHandle *MakeThread(IThread *pThread, ThreadFlags flags);
|
||||
@@ -94,6 +92,8 @@ public: //IThreadCreator
|
||||
public: //BaseWorker
|
||||
virtual void AddThreadToQueue(SWThreadHandle *pHandle);
|
||||
virtual SWThreadHandle *PopThreadFromQueue();
|
||||
virtual void SetMaxThreadsPerFrame(unsigned int threads);
|
||||
virtual unsigned int GetMaxThreadsPerFrame();
|
||||
protected:
|
||||
SourceHook::List<SWThreadHandle *> m_ThreadQueue;
|
||||
unsigned int m_perFrame;
|
||||
|
||||
@@ -209,11 +209,6 @@ WorkerState ThreadWorker::GetStatus(unsigned int *threads)
|
||||
return state;
|
||||
}
|
||||
|
||||
void ThreadWorker::SetThinkTimePerFrame(unsigned int thinktime)
|
||||
{
|
||||
m_think_time = thinktime;
|
||||
}
|
||||
|
||||
bool ThreadWorker::Start()
|
||||
{
|
||||
if (m_state == Worker_Invalid)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#include "BaseWorker.h"
|
||||
|
||||
#define DEFAULT_THINK_TIME_MS 20
|
||||
#define DEFAULT_THINK_TIME_MS 50
|
||||
|
||||
class ThreadWorker : public BaseWorker, public IThread
|
||||
{
|
||||
@@ -53,8 +53,6 @@ public: //IWorker
|
||||
virtual bool Stop(bool flush_cancel);
|
||||
//returns status and number of threads in queue
|
||||
virtual WorkerState GetStatus(unsigned int *numThreads);
|
||||
//virtual void SetMaxThreadsPerFrame(unsigned int threads);
|
||||
virtual void SetThinkTimePerFrame(unsigned int thinktime);
|
||||
public: //BaseWorker
|
||||
virtual void AddThreadToQueue(SWThreadHandle *pHandle);
|
||||
virtual SWThreadHandle *PopThreadFromQueue();
|
||||
|
||||
@@ -29,8 +29,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION SM_VERSION_FILE
|
||||
PRODUCTVERSION SM_VERSION_FILE
|
||||
FILEVERSION SM_FILE_VERSION
|
||||
PRODUCTVERSION SM_FILE_VERSION
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -47,12 +47,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "Comments", "SourceMod"
|
||||
VALUE "FileDescription", "SourceMod Core Logic"
|
||||
VALUE "FileVersion", SM_VERSION_STRING
|
||||
VALUE "FileVersion", SM_FULL_VERSION
|
||||
VALUE "InternalName", "sourcemod"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2004-2009, AlliedModders LLC"
|
||||
VALUE "OriginalFilename", "sourcemod.logic.dll"
|
||||
VALUE "ProductName", "SourceMod"
|
||||
VALUE "ProductVersion", SM_VERSION_STRING
|
||||
VALUE "ProductVersion", SM_FULL_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
+7
-169
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 sw=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -43,36 +43,12 @@
|
||||
#include "ShareSys.h"
|
||||
#include "sm_srvcmds.h"
|
||||
#include "ForwardSys.h"
|
||||
#include "TimerSys.h"
|
||||
#include "logic_bridge.h"
|
||||
#include "DebugReporter.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "AdminCache.h"
|
||||
#include "HalfLife2.h"
|
||||
#include "CoreConfig.h"
|
||||
|
||||
#if defined _WIN32
|
||||
#define MATCHMAKINGDS_SUFFIX ""
|
||||
#define MATCHMAKINGDS_EXT "dll"
|
||||
#elif defined __APPLE__
|
||||
#define MATCHMAKINGDS_SUFFIX ""
|
||||
#define MATCHMAKINGDS_EXT "dylib"
|
||||
#elif defined __linux__
|
||||
#if SOURCE_ENGINE < SE_LEFT4DEAD2
|
||||
#define MATCHMAKINGDS_SUFFIX "_i486"
|
||||
#else
|
||||
#define MATCHMAKINGDS_SUFFIX ""
|
||||
#endif
|
||||
#define MATCHMAKINGDS_EXT "so"
|
||||
#endif
|
||||
|
||||
static ILibrary *g_pLogic = NULL;
|
||||
static LogicInitFunction logic_init_fn;
|
||||
|
||||
IThreader *g_pThreader;
|
||||
ITextParsers *textparsers;
|
||||
sm_logic_t logicore;
|
||||
ITranslator *translator;
|
||||
|
||||
class VEngineServer_Logic : public IVEngineServer_Logic
|
||||
{
|
||||
@@ -81,34 +57,10 @@ public:
|
||||
{
|
||||
return engine->IsMapValid(map);
|
||||
}
|
||||
|
||||
virtual void ServerCommand(const char *cmd)
|
||||
{
|
||||
engine->ServerCommand(cmd);
|
||||
}
|
||||
};
|
||||
|
||||
static VEngineServer_Logic logic_engine;
|
||||
|
||||
class VFileSystem_Logic : public IFileSystem_Logic
|
||||
{
|
||||
public:
|
||||
const char *FindFirstEx(const char *pWildCard, const char *pPathID, FileFindHandle_t *pHandle)
|
||||
{
|
||||
return filesystem->FindFirstEx(pWildCard, pPathID, pHandle);
|
||||
}
|
||||
const char *FindNext(FileFindHandle_t handle)
|
||||
{
|
||||
return filesystem->FindNext(handle);
|
||||
}
|
||||
void FindClose(FileFindHandle_t handle)
|
||||
{
|
||||
filesystem->FindClose(handle);
|
||||
}
|
||||
};
|
||||
|
||||
static VFileSystem_Logic logic_filesystem;
|
||||
|
||||
static void add_natives(sp_nativeinfo_t *natives)
|
||||
{
|
||||
g_pCoreNatives->AddNatives(natives);
|
||||
@@ -128,95 +80,11 @@ static void log_error(const char *fmt, ...)
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static void generate_error(IPluginContext *ctx, cell_t func_idx, int err, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
g_DbgReporter.GenerateErrorVA(ctx, func_idx, err, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static const char *get_cvar_string(ConVar* cvar)
|
||||
{
|
||||
return cvar->GetString();
|
||||
}
|
||||
|
||||
static bool get_game_name(char *buffer, size_t maxlength)
|
||||
{
|
||||
KeyValues *pGameInfo = new KeyValues("GameInfo");
|
||||
if (g_HL2.KVLoadFromFile(pGameInfo, basefilesystem, "gameinfo.txt"))
|
||||
{
|
||||
const char *str;
|
||||
if ((str = pGameInfo->GetString("game", NULL)) != NULL)
|
||||
{
|
||||
strncopy(buffer, str, maxlength);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
pGameInfo->deleteThis();
|
||||
return false;
|
||||
}
|
||||
|
||||
static const char *get_game_description()
|
||||
{
|
||||
return SERVER_CALL(GetGameDescription)();
|
||||
}
|
||||
|
||||
static const char *get_source_engine_name()
|
||||
{
|
||||
#if !defined SOURCE_ENGINE
|
||||
# error "Unknown engine type"
|
||||
#endif
|
||||
#if SOURCE_ENGINE == SE_EPISODEONE
|
||||
return "original";
|
||||
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||
return "darkmessiah";
|
||||
#elif SOURCE_ENGINE == SE_ORANGEBOX
|
||||
return "orangebox";
|
||||
#elif SOURCE_ENGINE == SE_BLOODYGOODTIME
|
||||
return "bloodygoodtime";
|
||||
#elif SOURCE_ENGINE == SE_EYE
|
||||
return "eye";
|
||||
#elif SOURCE_ENGINE == SE_CSS
|
||||
return "css";
|
||||
#elif SOURCE_ENGINE == SE_HL2DM
|
||||
return "hl2dm";
|
||||
#elif SOURCE_ENGINE == SE_DODS
|
||||
return "dods";
|
||||
#elif SOURCE_ENGINE == SE_TF2
|
||||
return "tf2";
|
||||
#elif SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
return "left4dead";
|
||||
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
|
||||
return "nucleardawn";
|
||||
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
return "left4dead2";
|
||||
#elif SOURCE_ENGINE == SE_ALIENSWARM
|
||||
return "alienswarm";
|
||||
#elif SOURCE_ENGINE == SE_PORTAL2
|
||||
return "portal2";
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
return "csgo";
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool symbols_are_hidden()
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_CSS) || (SOURCE_ENGINE == SE_HL2DM) || (SOURCE_ENGINE == SE_DODS) || (SOURCE_ENGINE == SE_TF2) || (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_NUCLEARDAWN) || (SOURCE_ENGINE == SE_LEFT4DEAD2) || (SOURCE_ENGINE == SE_CSGO)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static const char* get_core_config_value(const char* key)
|
||||
{
|
||||
return g_CoreConfig.GetCoreConfigValue(key);
|
||||
}
|
||||
|
||||
static ServerGlobals serverGlobals;
|
||||
|
||||
static sm_core_t core_bridge =
|
||||
{
|
||||
/* Objects */
|
||||
@@ -225,15 +93,10 @@ static sm_core_t core_bridge =
|
||||
&g_SourceMod,
|
||||
&g_LibSys,
|
||||
reinterpret_cast<IVEngineServer*>(&logic_engine),
|
||||
reinterpret_cast<IFileSystem*>(&logic_filesystem),
|
||||
&g_ShareSys,
|
||||
&g_RootMenu,
|
||||
&g_PluginSys,
|
||||
&g_Forwards,
|
||||
&g_Timers,
|
||||
&g_Players,
|
||||
&g_Admins,
|
||||
&g_HL2,
|
||||
/* Functions */
|
||||
add_natives,
|
||||
find_convar,
|
||||
@@ -242,39 +105,15 @@ static sm_core_t core_bridge =
|
||||
log_error,
|
||||
get_cvar_string,
|
||||
UTIL_Format,
|
||||
generate_error,
|
||||
gnprintf,
|
||||
atcprintf,
|
||||
get_game_name,
|
||||
get_game_description,
|
||||
get_source_engine_name,
|
||||
symbols_are_hidden,
|
||||
get_core_config_value,
|
||||
&serverGlobals
|
||||
UTIL_ReplaceAll
|
||||
};
|
||||
|
||||
void InitLogicBridge()
|
||||
{
|
||||
serverGlobals.universalTime = g_pUniversalTime;
|
||||
serverGlobals.frametime = &gpGlobals->frametime;
|
||||
serverGlobals.interval_per_tick = &gpGlobals->interval_per_tick;
|
||||
sm_logic_t logic;
|
||||
|
||||
core_bridge.core_ident = g_pCoreIdent;
|
||||
core_bridge.engineFactory = (void *)g_SMAPI->GetEngineFactory(false);
|
||||
core_bridge.serverFactory = (void *)g_SMAPI->GetServerFactory(false);
|
||||
|
||||
ILibrary *mmlib;
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
|
||||
g_LibSys.PathFormat(path, sizeof(path), "%s/bin/matchmaking_ds%s.%s", g_SMAPI->GetBaseDir(), MATCHMAKINGDS_SUFFIX, MATCHMAKINGDS_EXT);
|
||||
|
||||
if ((mmlib = g_LibSys.OpenLibrary(path, NULL, 0)))
|
||||
{
|
||||
core_bridge.matchmakingDSFactory = mmlib->GetSymbolAddress("CreateInterface");
|
||||
mmlib->CloseLibrary();
|
||||
}
|
||||
|
||||
logic_init_fn(&core_bridge, &logicore);
|
||||
logic_init_fn(&core_bridge, &logic);
|
||||
|
||||
/* Add SMGlobalClass instances */
|
||||
SMGlobalClass* glob = SMGlobalClass::head;
|
||||
@@ -283,11 +122,10 @@ void InitLogicBridge()
|
||||
glob = glob->m_pGlobalClassNext;
|
||||
}
|
||||
assert(glob->m_pGlobalClassNext == NULL);
|
||||
glob->m_pGlobalClassNext = logicore.head;
|
||||
glob->m_pGlobalClassNext = logic.head;
|
||||
|
||||
g_pThreader = logicore.threader;
|
||||
g_pSourcePawn2->SetProfiler(logicore.profiler);
|
||||
translator = logicore.translator;
|
||||
g_pThreader = logic.threader;
|
||||
g_pSourcePawn2->SetProfiler(logic.profiler);
|
||||
}
|
||||
|
||||
bool StartLogicBridge(char *error, size_t maxlength)
|
||||
|
||||
@@ -31,17 +31,9 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_LOGIC_BRIDGE_H_
|
||||
#define _INCLUDE_SOURCEMOD_LOGIC_BRIDGE_H_
|
||||
|
||||
#include "logic/intercom.h"
|
||||
|
||||
void InitLogicBridge();
|
||||
bool StartLogicBridge(char *error, size_t maxlength);
|
||||
void ShutdownLogicBridge();
|
||||
|
||||
struct sm_logic_t;
|
||||
|
||||
extern sm_logic_t logicore;
|
||||
extern ITranslator *translator;
|
||||
extern IGameConfig *g_pGameConf;
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_LOGIC_BRIDGE_H_ */
|
||||
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sourcemod_mm", "sourcemod_mm.vcxproj", "{E39527CD-7CAB-4420-97CC-DA1B93B260BC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CrazyDebug - Alien Swarm|Win32 = CrazyDebug - Alien Swarm|Win32
|
||||
CrazyDebug - CS GO|Win32 = CrazyDebug - CS GO|Win32
|
||||
CrazyDebug - Dark Messiah|Win32 = CrazyDebug - Dark Messiah|Win32
|
||||
CrazyDebug - Episode 1|Win32 = CrazyDebug - Episode 1|Win32
|
||||
CrazyDebug - Left 4 Dead 2|Win32 = CrazyDebug - Left 4 Dead 2|Win32
|
||||
CrazyDebug - Left 4 Dead|Win32 = CrazyDebug - Left 4 Dead|Win32
|
||||
CrazyDebug - Old Metamod|Win32 = CrazyDebug - Old Metamod|Win32
|
||||
CrazyDebug - Orange Box Valve|Win32 = CrazyDebug - Orange Box Valve|Win32
|
||||
CrazyDebug - Orange Box|Win32 = CrazyDebug - Orange Box|Win32
|
||||
Debug - Alien Swarm|Win32 = Debug - Alien Swarm|Win32
|
||||
Debug - CS GO|Win32 = Debug - CS GO|Win32
|
||||
Debug - Dark Messiah|Win32 = Debug - Dark Messiah|Win32
|
||||
Debug - Episode 1|Win32 = Debug - Episode 1|Win32
|
||||
Debug - Left 4 Dead 2|Win32 = Debug - Left 4 Dead 2|Win32
|
||||
Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32
|
||||
Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
|
||||
Debug - Orange Box Valve|Win32 = Debug - Orange Box Valve|Win32
|
||||
Debug - Orange Box|Win32 = Debug - Orange Box|Win32
|
||||
Release - Alien Swarm|Win32 = Release - Alien Swarm|Win32
|
||||
Release - CS GO|Win32 = Release - CS GO|Win32
|
||||
Release - Dark Messiah|Win32 = Release - Dark Messiah|Win32
|
||||
Release - Episode 1|Win32 = Release - Episode 1|Win32
|
||||
Release - Left 4 Dead 2|Win32 = Release - Left 4 Dead 2|Win32
|
||||
Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32
|
||||
Release - Old Metamod|Win32 = Release - Old Metamod|Win32
|
||||
Release - Orange Box Valve|Win32 = Release - Orange Box Valve|Win32
|
||||
Release - Orange Box|Win32 = Release - Orange Box|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Alien Swarm|Win32.ActiveCfg = CrazyDebug - Alien Swarm|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Alien Swarm|Win32.Build.0 = CrazyDebug - Alien Swarm|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - CS GO|Win32.ActiveCfg = CrazyDebug - CS GO|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - CS GO|Win32.Build.0 = CrazyDebug - CS GO|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Dark Messiah|Win32.ActiveCfg = CrazyDebug - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Dark Messiah|Win32.Build.0 = CrazyDebug - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.ActiveCfg = CrazyDebug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.Build.0 = CrazyDebug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead 2|Win32.ActiveCfg = CrazyDebug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead 2|Win32.Build.0 = CrazyDebug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead|Win32.ActiveCfg = CrazyDebug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead|Win32.Build.0 = CrazyDebug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.ActiveCfg = CrazyDebug - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.Build.0 = CrazyDebug - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box Valve|Win32.ActiveCfg = CrazyDebug - Orange Box Valve|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box Valve|Win32.Build.0 = CrazyDebug - Orange Box Valve|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box|Win32.ActiveCfg = CrazyDebug - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box|Win32.Build.0 = CrazyDebug - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Alien Swarm|Win32.ActiveCfg = Debug - Alien Swarm|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Alien Swarm|Win32.Build.0 = Debug - Alien Swarm|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - CS GO|Win32.ActiveCfg = Debug - CS GO|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - CS GO|Win32.Build.0 = Debug - CS GO|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Dark Messiah|Win32.ActiveCfg = Debug - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Dark Messiah|Win32.Build.0 = Debug - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.ActiveCfg = Debug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.Build.0 = Debug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead 2|Win32.ActiveCfg = Debug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead 2|Win32.Build.0 = Debug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead|Win32.ActiveCfg = Debug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead|Win32.Build.0 = Debug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.Build.0 = Debug - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box Valve|Win32.ActiveCfg = Debug - Orange Box Valve|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box Valve|Win32.Build.0 = Debug - Orange Box Valve|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box|Win32.ActiveCfg = Debug - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box|Win32.Build.0 = Debug - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Alien Swarm|Win32.ActiveCfg = Release - Alien Swarm|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Alien Swarm|Win32.Build.0 = Release - Alien Swarm|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - CS GO|Win32.ActiveCfg = Release - CS GO|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - CS GO|Win32.Build.0 = Release - CS GO|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Dark Messiah|Win32.ActiveCfg = Release - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Dark Messiah|Win32.Build.0 = Release - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.ActiveCfg = Release - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.Build.0 = Release - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead 2|Win32.ActiveCfg = Release - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead 2|Win32.Build.0 = Release - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead|Win32.ActiveCfg = Release - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead|Win32.Build.0 = Release - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Old Metamod|Win32.ActiveCfg = Release - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Old Metamod|Win32.Build.0 = Release - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box Valve|Win32.ActiveCfg = Release - Orange Box Valve|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box Valve|Win32.Build.0 = Release - Orange Box Valve|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box|Win32.ActiveCfg = Release - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box|Win32.Build.0 = Release - Orange Box|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,493 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Interfaces">
|
||||
<UniqueIdentifier>{10C69360-9E8E-4a43-BCEF-E9373B3641BC}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SourcePawn">
|
||||
<UniqueIdentifier>{C3C3DC6E-E392-4916-B893-7ACB92192DE0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HL2SDK">
|
||||
<UniqueIdentifier>{80B56842-7A9F-4d5d-8149-767C285D0EB4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Natives">
|
||||
<UniqueIdentifier>{052D6D9B-7B50-4c3c-9B82-32CA908DEF24}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Resources">
|
||||
<UniqueIdentifier>{2A750240-7C10-455f-A900-B9A9D362356C}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="HL2SDK\Protobuf">
|
||||
<UniqueIdentifier>{28cf0347-3553-4d24-b9ad-476ba5197680}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HL2SDK\Protobuf\CSGO">
|
||||
<UniqueIdentifier>{0e62c72e-57b1-40d2-9a94-059f535ce719}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\AdminCache.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ADTFactory.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\CDataPack.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ChatTriggers.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\concmd_cleaner.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ConCmdManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ConsoleDetours.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ConVarManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\CoreConfig.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\CrazyDebugger.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Database.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\DebugReporter.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\EventManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ExtensionSys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ForwardSys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\frame_hooks.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\HalfLife2.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\HandleSys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\LibrarySys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Logger.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\logic_bridge.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\MenuManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\MenuStyle_Base.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\MenuStyle_Radio.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\MenuStyle_Valve.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\MenuVoting.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\NativeInvoker.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\NativeOwner.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\NextMap.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\PlayerManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\PluginInfoDatabase.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\PluginSys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ShareSys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sm_autonatives.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sm_srvcmds.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sm_stringutil.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sm_trie.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sourcemm_api.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sourcemod.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\TimerSys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UserMessages.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_bitbuffer.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_console.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_core.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_database.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_entities.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_events.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_fakenatives.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_filesystem.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_halflife.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_hudtext.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_keyvalues.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_menus.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_nextmap.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_player.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_usermsgs.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_vector.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\hl2sdks\hl2sdk-csgo\public\game\shared\csgo\protobuf\cstrike15_usermessage_helpers.cpp">
|
||||
<Filter>HL2SDK\Protobuf\CSGO</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\hl2sdks\hl2sdk-csgo\public\game\shared\csgo\protobuf\cstrike15_usermessages.pb.cc">
|
||||
<Filter>HL2SDK\Protobuf\CSGO</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\hl2sdks\hl2sdk-csgo\public\engine\protobuf\netmessages.pb.cc">
|
||||
<Filter>HL2SDK\Protobuf</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_protobuf.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\AdminCache.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ADTFactory.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CDataPack.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CellRecipientFilter.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ChatTriggers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\compat_wrappers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\concmd_cleaner.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ConCmdManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ConCommandBaseIterator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ConsoleDetours.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ConVarManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CoreConfig.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Database.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\DebugReporter.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\EventManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ExtensionSys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ForwardSys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\frame_hooks.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\HalfLife2.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\HandleSys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\LibrarySys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Logger.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\logic_bridge.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MenuManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MenuStyle_Base.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MenuStyle_Radio.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MenuStyle_Valve.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MenuVoting.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\NativeInvoker.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\NativeOwner.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\NextMap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\PlayerManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\PluginInfoDatabase.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\PluginSys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ShareSys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_autonatives.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_fastlink.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_globals.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_memtable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_queue.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_simple_prioqueue.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_srvcmds.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_stringutil.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_trie.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sm_trie_tpl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\smn_usermsgs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sourcemm_api.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sourcemod.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\TimerSys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UserMessages.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IAdminSystem.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IADTFactory.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IDataPack.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IDBDriver.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IExtensionSys.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IForwardSys.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IGameConfigs.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IGameHelpers.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IHandleSys.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\ILibrarySys.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IMemoryUtils.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IMenuManager.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\INativeInvoker.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IPlayerHelpers.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IPluginSys.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IRootConsoleMenu.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IShareSys.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\ISourceMod.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\ITextParsers.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\ITimerSystem.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\ITranslator.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IUserMessages.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sourcepawn\sp_file_headers.h">
|
||||
<Filter>SourcePawn</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sourcepawn\sp_typeutil.h">
|
||||
<Filter>SourcePawn</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sourcepawn\sp_vm_api.h">
|
||||
<Filter>SourcePawn</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sourcepawn\sp_vm_base.h">
|
||||
<Filter>SourcePawn</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sourcepawn\sp_vm_types.h">
|
||||
<Filter>SourcePawn</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\convar_sm.h">
|
||||
<Filter>HL2SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sm_platform.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sourcemod_version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\convar_sm_l4d.h">
|
||||
<Filter>HL2SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\convar_sm_ob.h">
|
||||
<Filter>HL2SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\convar_sm_swarm.h">
|
||||
<Filter>HL2SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\hl2sdks\hl2sdk-csgo\public\game\shared\csgo\protobuf\cstrike15_usermessage_helpers.h">
|
||||
<Filter>HL2SDK\Protobuf\CSGO</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\hl2sdks\hl2sdk-csgo\public\game\shared\csgo\protobuf\cstrike15_usermessages.pb.h">
|
||||
<Filter>HL2SDK\Protobuf\CSGO</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\hl2sdks\hl2sdk-csgo\public\engine\protobuf\netmessages.pb.h">
|
||||
<Filter>HL2SDK\Protobuf</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\version.rc">
|
||||
<Filter>Resources</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Library Include="..\..\..\hl2sdks\hl2sdk-csgo\lib\win32\release\vs2010\libprotobuf.lib">
|
||||
<Filter>HL2SDK\Protobuf</Filter>
|
||||
</Library>
|
||||
<Library Include="..\..\..\hl2sdks\hl2sdk-csgo\lib\win32\debug\vs2010\libprotobuf.lib">
|
||||
<Filter>HL2SDK\Protobuf</Filter>
|
||||
</Library>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
+103
-39
@@ -40,9 +40,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE18)\core-legacy";"$(MMSOURCE18)\core-legacy\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE17)\core-legacy";"$(MMSOURCE17)\core-legacy\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -123,9 +123,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE18)\core-legacy";"$(MMSOURCE18)\core-legacy\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE17)\core-legacy";"$(MMSOURCE17)\core-legacy\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -207,9 +207,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE18)\core-legacy";"$(MMSOURCE18)\core-legacy\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE17)\core-legacy";"$(MMSOURCE17)\core-legacy\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
@@ -290,9 +290,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK-DARKM)\public";"$(HL2SDK-DARKM)\public\dlls";"$(HL2SDK-DARKM)\public\engine";"$(HL2SDK-DARKM)\public\mathlib";"$(HL2SDK-DARKM)\public\tier0";"$(HL2SDK-DARKM)\public\tier1";"$(HL2SDK-DARKM)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK-DARKM)\public";"$(HL2SDK-DARKM)\public\dlls";"$(HL2SDK-DARKM)\public\engine";"$(HL2SDK-DARKM)\public\mathlib";"$(HL2SDK-DARKM)\public\tier0";"$(HL2SDK-DARKM)\public\tier1";"$(HL2SDK-DARKM)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=2"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -373,9 +373,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK-DARKM)\public";"$(HL2SDK-DARKM)\public\dlls";"$(HL2SDK-DARKM)\public\engine";"$(HL2SDK-DARKM)\public\mathlib";"$(HL2SDK-DARKM)\public\tier0";"$(HL2SDK-DARKM)\public\tier1";"$(HL2SDK-DARKM)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK-DARKM)\public";"$(HL2SDK-DARKM)\public\dlls";"$(HL2SDK-DARKM)\public\engine";"$(HL2SDK-DARKM)\public\mathlib";"$(HL2SDK-DARKM)\public\tier0";"$(HL2SDK-DARKM)\public\tier1";"$(HL2SDK-DARKM)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=2"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -457,9 +457,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK-DARKM)\public";"$(HL2SDK-DARKM)\public\dlls";"$(HL2SDK-DARKM)\public\engine";"$(HL2SDK-DARKM)\public\mathlib";"$(HL2SDK-DARKM)\public\tier0";"$(HL2SDK-DARKM)\public\tier1";"$(HL2SDK-DARKM)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK-DARKM)\public";"$(HL2SDK-DARKM)\public\dlls";"$(HL2SDK-DARKM)\public\engine";"$(HL2SDK-DARKM)\public\mathlib";"$(HL2SDK-DARKM)\public\tier0";"$(HL2SDK-DARKM)\public\tier1";"$(HL2SDK-DARKM)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=2"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
@@ -540,9 +540,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=3"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -623,9 +623,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=3"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -707,9 +707,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=3"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
@@ -790,9 +790,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -873,9 +873,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -957,9 +957,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
@@ -1040,9 +1040,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D)\public";"$(HL2SDKL4D)\public\engine";"$(HL2SDKL4D)\public\game\server";"$(HL2SDKL4D)\public\mathlib";"$(HL2SDKL4D)\public\tier0";"$(HL2SDKL4D)\public\tier1";"$(HL2SDKL4D)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D)\public";"$(HL2SDKL4D)\public\engine";"$(HL2SDKL4D)\public\game\server";"$(HL2SDKL4D)\public\mathlib";"$(HL2SDKL4D)\public\tier0";"$(HL2SDKL4D)\public\tier1";"$(HL2SDKL4D)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=5"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -1123,9 +1123,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D)\public";"$(HL2SDKL4D)\public\engine";"$(HL2SDKL4D)\public\game\server";"$(HL2SDKL4D)\public\mathlib";"$(HL2SDKL4D)\public\tier0";"$(HL2SDKL4D)\public\tier1";"$(HL2SDKL4D)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D)\public";"$(HL2SDKL4D)\public\engine";"$(HL2SDKL4D)\public\game\server";"$(HL2SDKL4D)\public\mathlib";"$(HL2SDKL4D)\public\tier0";"$(HL2SDKL4D)\public\tier1";"$(HL2SDKL4D)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=5"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -1207,9 +1207,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D)\public";"$(HL2SDKL4D)\public\engine";"$(HL2SDKL4D)\public\game\server";"$(HL2SDKL4D)\public\mathlib";"$(HL2SDKL4D)\public\tier0";"$(HL2SDKL4D)\public\tier1";"$(HL2SDKL4D)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D)\public";"$(HL2SDKL4D)\public\engine";"$(HL2SDKL4D)\public\game\server";"$(HL2SDKL4D)\public\mathlib";"$(HL2SDKL4D)\public\tier0";"$(HL2SDKL4D)\public\tier1";"$(HL2SDKL4D)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=5"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
@@ -1290,9 +1290,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOBVALVE)\public";"$(HL2SDKOBVALVE)\public\engine";"$(HL2SDKOBVALVE)\public\game\server";"$(HL2SDKOBVALVE)\public\mathlib";"$(HL2SDKOBVALVE)\public\tier0";"$(HL2SDKOBVALVE)\public\tier1";"$(HL2SDKOBVALVE)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOBVALVE)\public";"$(HL2SDKOBVALVE)\public\engine";"$(HL2SDKOBVALVE)\public\game\server";"$(HL2SDKOBVALVE)\public\mathlib";"$(HL2SDKOBVALVE)\public\tier0";"$(HL2SDKOBVALVE)\public\tier1";"$(HL2SDKOBVALVE)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=4"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -1373,9 +1373,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOBVALVE)\public";"$(HL2SDKOBVALVE)\public\engine";"$(HL2SDKOBVALVE)\public\game\server";"$(HL2SDKOBVALVE)\public\mathlib";"$(HL2SDKOBVALVE)\public\tier0";"$(HL2SDKOBVALVE)\public\tier1";"$(HL2SDKOBVALVE)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOBVALVE)\public";"$(HL2SDKOBVALVE)\public\engine";"$(HL2SDKOBVALVE)\public\game\server";"$(HL2SDKOBVALVE)\public\mathlib";"$(HL2SDKOBVALVE)\public\tier0";"$(HL2SDKOBVALVE)\public\tier1";"$(HL2SDKOBVALVE)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=4"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -1457,9 +1457,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOBVALVE)\public";"$(HL2SDKOBVALVE)\public\engine";"$(HL2SDKOBVALVE)\public\game\server";"$(HL2SDKOBVALVE)\public\mathlib";"$(HL2SDKOBVALVE)\public\tier0";"$(HL2SDKOBVALVE)\public\tier1";"$(HL2SDKOBVALVE)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOBVALVE)\public";"$(HL2SDKOBVALVE)\public\engine";"$(HL2SDKOBVALVE)\public\game\server";"$(HL2SDKOBVALVE)\public\mathlib";"$(HL2SDKOBVALVE)\public\tier0";"$(HL2SDKOBVALVE)\public\tier1";"$(HL2SDKOBVALVE)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=4"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
@@ -1541,7 +1541,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 /D SE_LEFT4DEAD2=6"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5 /D SE_LEFT4DEAD2=6"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D2)\public";"$(HL2SDKL4D2)\public\engine";"$(HL2SDKL4D2)\public\game\server";"$(HL2SDKL4D2)\public\mathlib";"$(HL2SDKL4D2)\public\tier0";"$(HL2SDKL4D2)\public\tier1";"$(HL2SDKL4D2)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=6"
|
||||
@@ -1624,7 +1624,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 /D SE_LEFT4DEAD2=6"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5 /D SE_LEFT4DEAD2=6"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D2)\public";"$(HL2SDKL4D2)\public\engine";"$(HL2SDKL4D2)\public\game\server";"$(HL2SDKL4D2)\public\mathlib";"$(HL2SDKL4D2)\public\tier0";"$(HL2SDKL4D2)\public\tier1";"$(HL2SDKL4D2)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=6"
|
||||
@@ -1708,7 +1708,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 /D SE_LEFT4DEAD2=6"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5 /D SE_LEFT4DEAD2=6"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D2)\public";"$(HL2SDKL4D2)\public\engine";"$(HL2SDKL4D2)\public\game\server";"$(HL2SDKL4D2)\public\mathlib";"$(HL2SDKL4D2)\public\tier0";"$(HL2SDKL4D2)\public\tier1";"$(HL2SDKL4D2)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=6"
|
||||
@@ -1952,6 +1952,10 @@
|
||||
RelativePath="..\frame_hooks.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\GameConfigs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\HalfLife2.cpp"
|
||||
>
|
||||
@@ -1972,6 +1976,10 @@
|
||||
RelativePath="..\logic_bridge.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\MemoryUtils.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\MenuManager.cpp"
|
||||
>
|
||||
@@ -2004,6 +2012,10 @@
|
||||
RelativePath="..\NextMap.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PhraseCollection.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PlayerManager.cpp"
|
||||
>
|
||||
@@ -2024,6 +2036,14 @@
|
||||
RelativePath="..\sm_autonatives.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_crc32.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_memtable.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_srvcmds.cpp"
|
||||
>
|
||||
@@ -2048,6 +2068,10 @@
|
||||
RelativePath="..\TimerSys.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Translator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\UserMessages.cpp"
|
||||
>
|
||||
@@ -2218,6 +2242,10 @@
|
||||
RelativePath="..\sm_autonatives.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_crc32.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_fastlink.h"
|
||||
>
|
||||
@@ -2422,6 +2450,14 @@
|
||||
Name="Natives"
|
||||
UniqueIdentifier="{052D6D9B-7B50-4c3c-9B82-32CA908DEF24}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\smn_admin.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_banning.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_bitbuffer.cpp"
|
||||
>
|
||||
@@ -2438,6 +2474,10 @@
|
||||
RelativePath="..\smn_database.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_datapacks.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_entities.cpp"
|
||||
>
|
||||
@@ -2454,10 +2494,18 @@
|
||||
RelativePath="..\smn_filesystem.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_gameconfigs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_halflife.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_handles.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_hudtext.cpp"
|
||||
>
|
||||
@@ -2466,6 +2514,10 @@
|
||||
RelativePath="..\smn_keyvalues.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_lang.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_menus.cpp"
|
||||
>
|
||||
@@ -2478,6 +2530,18 @@
|
||||
RelativePath="..\smn_player.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_profiler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_string.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_timers.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_usermsgs.cpp"
|
||||
>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet:
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -25,6 +25,8 @@
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "sm_crc32.h"
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet:
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
@@ -25,6 +25,8 @@
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_CRC32_H_
|
||||
@@ -37,6 +37,7 @@
|
||||
template <typename T>
|
||||
class FastLink
|
||||
{
|
||||
friend class iterator;
|
||||
public:
|
||||
struct FastLinkNode
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod Team Fortress 2 Extension
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
@@ -29,51 +29,84 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "holiday.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "sm_memtable.h"
|
||||
|
||||
CDetour *isHolidayDetour = NULL;
|
||||
|
||||
IForward *g_isHolidayForward = NULL;
|
||||
|
||||
DETOUR_DECL_STATIC1(IsHolidayActive, bool, int, holiday)
|
||||
BaseMemTable::BaseMemTable(unsigned int init_size)
|
||||
{
|
||||
bool actualres = DETOUR_STATIC_CALL(IsHolidayActive)(holiday);
|
||||
if (!g_isHolidayForward)
|
||||
{
|
||||
g_pSM->LogMessage(myself, "Invalid Forward");
|
||||
return actualres;
|
||||
}
|
||||
|
||||
cell_t result = 0;
|
||||
cell_t newres = actualres ? 1 : 0;
|
||||
|
||||
g_isHolidayForward->PushCell(holiday);
|
||||
g_isHolidayForward->PushCellByRef(&newres);
|
||||
g_isHolidayForward->Execute(&result);
|
||||
|
||||
if (result > Pl_Continue)
|
||||
{
|
||||
return (newres == 0) ? false : true;
|
||||
}
|
||||
|
||||
return actualres;
|
||||
membase = (unsigned char *)malloc(init_size);
|
||||
size = init_size;
|
||||
tail = 0;
|
||||
}
|
||||
|
||||
bool InitialiseIsHolidayDetour()
|
||||
BaseMemTable::~BaseMemTable()
|
||||
{
|
||||
isHolidayDetour = DETOUR_CREATE_STATIC(IsHolidayActive, "IsHolidayActive");
|
||||
free(membase);
|
||||
membase = NULL;
|
||||
}
|
||||
|
||||
if (isHolidayDetour != NULL)
|
||||
int BaseMemTable::CreateMem(unsigned int addsize, void **addr)
|
||||
{
|
||||
int idx = (int)tail;
|
||||
|
||||
while (tail + addsize >= size)
|
||||
{
|
||||
isHolidayDetour->EnableDetour();
|
||||
return true;
|
||||
size *= 2;
|
||||
membase = (unsigned char *)realloc(membase, size);
|
||||
}
|
||||
|
||||
g_pSM->LogError(myself, "IsHolidayActive detour failed");
|
||||
return false;
|
||||
tail += addsize;
|
||||
|
||||
if (addr)
|
||||
{
|
||||
*addr = (void *)&membase[idx];
|
||||
}
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
void RemoveIsHolidayDetour()
|
||||
void *BaseMemTable::GetAddress(int index)
|
||||
{
|
||||
isHolidayDetour->Destroy();
|
||||
if (index < 0 || (unsigned int)index >= tail)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &membase[index];
|
||||
}
|
||||
|
||||
void BaseMemTable::Reset()
|
||||
{
|
||||
tail = 0;
|
||||
}
|
||||
|
||||
BaseStringTable::BaseStringTable(unsigned int init_size) : m_table(init_size)
|
||||
{
|
||||
}
|
||||
|
||||
BaseStringTable::~BaseStringTable()
|
||||
{
|
||||
}
|
||||
|
||||
int BaseStringTable::AddString(const char *string)
|
||||
{
|
||||
size_t len = strlen(string) + 1;
|
||||
int idx;
|
||||
char *addr;
|
||||
|
||||
idx = m_table.CreateMem(len, (void **)&addr);
|
||||
strcpy(addr, string);
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
/*const char *BaseStringTable::GetString(int str)
|
||||
{
|
||||
return (const char *)m_table.GetAddress(str);
|
||||
}*/
|
||||
|
||||
void BaseStringTable::Reset()
|
||||
{
|
||||
m_table.Reset();
|
||||
}
|
||||
+9
-58
@@ -32,65 +32,31 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
|
||||
#define _INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
class BaseMemTable
|
||||
{
|
||||
public:
|
||||
BaseMemTable(unsigned int init_size)
|
||||
{
|
||||
membase = (unsigned char *)malloc(init_size);
|
||||
size = init_size;
|
||||
tail = 0;
|
||||
}
|
||||
~BaseMemTable()
|
||||
{
|
||||
free(membase);
|
||||
membase = NULL;
|
||||
}
|
||||
BaseMemTable(unsigned int init_size);
|
||||
~BaseMemTable();
|
||||
public:
|
||||
/**
|
||||
* Allocates 'size' bytes of memory.
|
||||
* Optionally outputs the address through 'addr'.
|
||||
* Returns an index >= 0 on success, < 0 on failure.
|
||||
*/
|
||||
int CreateMem(unsigned int addsize, void **addr)
|
||||
{
|
||||
int idx = (int)tail;
|
||||
|
||||
while (tail + addsize >= size) {
|
||||
size *= 2;
|
||||
membase = (unsigned char *)realloc(membase, size);
|
||||
}
|
||||
|
||||
tail += addsize;
|
||||
if (addr)
|
||||
*addr = (void *)&membase[idx];
|
||||
|
||||
return idx;
|
||||
}
|
||||
int CreateMem(unsigned int size, void **addr);
|
||||
|
||||
/**
|
||||
* Given an index into the memory table, returns its address.
|
||||
* Returns NULL if invalid.
|
||||
*/
|
||||
void *GetAddress(int index)
|
||||
{
|
||||
if (index < 0 || (unsigned int)index >= tail)
|
||||
return NULL;
|
||||
return &membase[index];
|
||||
}
|
||||
void *GetAddress(int index);
|
||||
|
||||
/**
|
||||
* Scraps the memory table. For caching purposes, the memory
|
||||
* is not freed, however subsequent calls to CreateMem() will
|
||||
* begin at the first index again.
|
||||
*/
|
||||
void Reset()
|
||||
{
|
||||
tail = 0;
|
||||
}
|
||||
void Reset();
|
||||
|
||||
inline unsigned int GetMemUsage()
|
||||
{
|
||||
@@ -111,24 +77,13 @@ private:
|
||||
class BaseStringTable
|
||||
{
|
||||
public:
|
||||
BaseStringTable(unsigned int init_size) : m_table(init_size)
|
||||
{
|
||||
}
|
||||
BaseStringTable(unsigned int init_size);
|
||||
~BaseStringTable();
|
||||
public:
|
||||
/**
|
||||
* Adds a string to the string table and returns its index.
|
||||
*/
|
||||
int AddString(const char *string)
|
||||
{
|
||||
size_t len = strlen(string) + 1;
|
||||
int idx;
|
||||
char *addr;
|
||||
|
||||
idx = m_table.CreateMem(len, (void **)&addr);
|
||||
strcpy(addr, string);
|
||||
|
||||
return idx;
|
||||
}
|
||||
int AddString(const char *string);
|
||||
|
||||
/**
|
||||
* Given an index into the string table, returns the associated string.
|
||||
@@ -143,10 +98,7 @@ public:
|
||||
* is not freed, however subsequent calls to AddString() will
|
||||
* begin at the first index again.
|
||||
*/
|
||||
void Reset()
|
||||
{
|
||||
m_table.Reset();
|
||||
}
|
||||
void Reset();
|
||||
|
||||
/**
|
||||
* Returns the parent BaseMemTable that this string table uses.
|
||||
@@ -160,4 +112,3 @@ private:
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
|
||||
|
||||
|
||||
+4
-6
@@ -39,7 +39,7 @@
|
||||
|
||||
RootConsoleMenu g_RootMenu;
|
||||
|
||||
ConVar sourcemod_version("sourcemod_version", SOURCEMOD_VERSION, FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY, "SourceMod Version");
|
||||
ConVar sourcemod_version("sourcemod_version", SM_FULL_VERSION, FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY, "SourceMod Version");
|
||||
|
||||
RootConsoleMenu::RootConsoleMenu()
|
||||
{
|
||||
@@ -328,22 +328,20 @@ void RootConsoleMenu::OnRootConsoleCommand(const char *cmdname, const CCommand &
|
||||
ConsolePrint(" Matt \"pRED\" Woodrow");
|
||||
ConsolePrint(" Scott \"DS\" Ehlert");
|
||||
ConsolePrint(" Fyren");
|
||||
ConsolePrint(" Nicholas \"psychonic\" Hastings");
|
||||
ConsolePrint(" Asher \"asherkin\" Baker");
|
||||
ConsolePrint(" Borja \"faluco\" Ferrer");
|
||||
ConsolePrint(" Pavol \"PM OnoTo\" Marko");
|
||||
ConsolePrint(" Special thanks to Liam, ferret, and Mani");
|
||||
ConsolePrint(" Special thanks to Liam, psychonic, ferret, and Mani");
|
||||
ConsolePrint(" Special thanks to Viper and SteamFriends");
|
||||
ConsolePrint(" http://www.sourcemod.net/");
|
||||
}
|
||||
else if (strcmp(cmdname, "version") == 0)
|
||||
{
|
||||
ConsolePrint(" SourceMod Version Information:");
|
||||
ConsolePrint(" SourceMod Version: %s", SOURCEMOD_VERSION);
|
||||
ConsolePrint(" SourceMod Version: %s", SM_FULL_VERSION);
|
||||
ConsolePrint(" SourcePawn Engine: %s (build %s)", g_pSourcePawn2->GetEngineName(), g_pSourcePawn2->GetVersionString());
|
||||
ConsolePrint(" SourcePawn API: v1 = %d, v2 = %d", g_pSourcePawn->GetEngineAPIVersion(), g_pSourcePawn2->GetAPIVersion());
|
||||
ConsolePrint(" Compiled on: %s %s", __DATE__, __TIME__);
|
||||
ConsolePrint(" Build ID: %s", SOURCEMOD_BUILD_ID);
|
||||
ConsolePrint(" Build ID: %s", SM_BUILD_UNIQUEID);
|
||||
ConsolePrint(" http://www.sourcemod.net/");
|
||||
}
|
||||
}
|
||||
|
||||
+260
-9
@@ -35,8 +35,8 @@
|
||||
#include "sm_stringutil.h"
|
||||
#include "Logger.h"
|
||||
#include "PluginSys.h"
|
||||
#include "Translator.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "logic_bridge.h"
|
||||
|
||||
#define LADJUST 0x00000004 /* left adjustment */
|
||||
#define ZEROPAD 0x00000080 /* zero (as opposed to blank) pad */
|
||||
@@ -81,11 +81,11 @@ size_t Translate(char *buffer,
|
||||
try_serverlang:
|
||||
if (target == SOURCEMOD_SERVER_LANGUAGE)
|
||||
{
|
||||
langid = translator->GetServerLanguage();
|
||||
langid = g_Translator.GetServerLanguage();
|
||||
}
|
||||
else if ((target >= 1) && (target <= g_Players.GetMaxClients()))
|
||||
{
|
||||
langid = translator->GetClientLanguage(target);
|
||||
langid = g_Translator.GetClientLanguage(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -95,7 +95,7 @@ try_serverlang:
|
||||
|
||||
if (pPhrases->FindTranslation(key, langid, &pTrans) != Trans_Okay)
|
||||
{
|
||||
if (target != SOURCEMOD_SERVER_LANGUAGE && langid != translator->GetServerLanguage())
|
||||
if (target != SOURCEMOD_SERVER_LANGUAGE && langid != g_Translator.GetServerLanguage())
|
||||
{
|
||||
target = SOURCEMOD_SERVER_LANGUAGE;
|
||||
goto try_serverlang;
|
||||
@@ -785,21 +785,21 @@ reswitch:
|
||||
}
|
||||
else
|
||||
{
|
||||
target = translator->GetGlobalTarget();
|
||||
target = g_Translator.GetGlobalTarget();
|
||||
}
|
||||
|
||||
try_again:
|
||||
if (target == SOURCEMOD_SERVER_LANGUAGE)
|
||||
{
|
||||
lang_id = translator->GetServerLanguage();
|
||||
lang_id = g_Translator.GetServerLanguage();
|
||||
}
|
||||
else if (target >= 1 && target <= g_Players.GetMaxClients())
|
||||
{
|
||||
lang_id = translator->GetClientLanguage(target);
|
||||
lang_id = g_Translator.GetClientLanguage(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
lang_id = translator->GetServerLanguage();
|
||||
lang_id = g_Translator.GetServerLanguage();
|
||||
}
|
||||
|
||||
if (pPhrases == NULL)
|
||||
@@ -813,7 +813,7 @@ try_again:
|
||||
|
||||
if (pPhrases->FindTranslation(key, lang_id, &trans) != Trans_Okay)
|
||||
{
|
||||
if (target != SOURCEMOD_SERVER_LANGUAGE && lang_id != translator->GetServerLanguage())
|
||||
if (target != SOURCEMOD_SERVER_LANGUAGE && lang_id != g_Translator.GetServerLanguage())
|
||||
{
|
||||
target = SOURCEMOD_SERVER_LANGUAGE;
|
||||
goto try_again;
|
||||
@@ -1274,6 +1274,37 @@ done:
|
||||
return (maxlen - llen - 1);
|
||||
}
|
||||
|
||||
const char *stristr(const char *str, const char *substr)
|
||||
{
|
||||
if (!*substr)
|
||||
{
|
||||
return ((char *)str);
|
||||
}
|
||||
|
||||
char *needle = (char *)substr;
|
||||
char *prevloc = (char *)str;
|
||||
char *haystack = (char *)str;
|
||||
|
||||
while (*haystack)
|
||||
{
|
||||
if (tolower(*haystack) == tolower(*needle))
|
||||
{
|
||||
haystack++;
|
||||
if (!*++needle)
|
||||
{
|
||||
return prevloc;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
haystack = ++prevloc;
|
||||
needle = (char *)substr;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int strncopy(char *dest, const char *src, size_t count)
|
||||
{
|
||||
if (!count)
|
||||
@@ -1331,6 +1362,194 @@ char *sm_strdup(const char *str)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive)
|
||||
{
|
||||
size_t searchLen = strlen(search);
|
||||
size_t replaceLen = strlen(replace);
|
||||
|
||||
char *ptr = subject;
|
||||
unsigned int total = 0;
|
||||
while ((ptr = UTIL_ReplaceEx(ptr, maxlength, search, searchLen, replace, replaceLen, caseSensitive)) != NULL)
|
||||
{
|
||||
total++;
|
||||
if (*ptr == '\0')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* NOTE: Do not edit this for the love of god unless you have
|
||||
* read the test cases and understand the code behind each one.
|
||||
* While I don't guarantee there aren't mistakes, I do guarantee
|
||||
* that plugins will end up relying on tiny idiosyncrasies of this
|
||||
* function, just like they did with AMX Mod X.
|
||||
*
|
||||
* There are explicitly more cases than the AMX Mod X version because
|
||||
* we're not doing a blind copy. Each case is specifically optimized
|
||||
* for what needs to be done. Even better, we don't have to error on
|
||||
* bad buffer sizes. Instead, this function will smartly cut off the
|
||||
* string in a way that pushes old data out.
|
||||
*/
|
||||
char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive)
|
||||
{
|
||||
char *ptr = subject;
|
||||
size_t browsed = 0;
|
||||
size_t textLen = strlen(subject);
|
||||
|
||||
/* It's not possible to search or replace */
|
||||
if (searchLen > textLen)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Handle the case of one byte replacement.
|
||||
* It's only valid in one case.
|
||||
*/
|
||||
if (maxLen == 1)
|
||||
{
|
||||
/* If the search matches and the replace length is 0,
|
||||
* we can just terminate the string and be done.
|
||||
*/
|
||||
if ((caseSensitive ? strcmp(subject, search) : strcasecmp(subject, search)) == 0 && replaceLen == 0)
|
||||
{
|
||||
*subject = '\0';
|
||||
return subject;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Subtract one off the maxlength so we can include the null terminator */
|
||||
maxLen--;
|
||||
|
||||
while (*ptr != '\0' && (browsed <= textLen - searchLen))
|
||||
{
|
||||
/* See if we get a comparison */
|
||||
if ((caseSensitive ? strncmp(ptr, search, searchLen) : strncasecmp(ptr, search, searchLen)) == 0)
|
||||
{
|
||||
if (replaceLen > searchLen)
|
||||
{
|
||||
/* First, see if we have enough space to do this operation */
|
||||
if (maxLen - textLen < replaceLen - searchLen)
|
||||
{
|
||||
/* First, see if the replacement length goes out of bounds. */
|
||||
if (browsed + replaceLen >= maxLen)
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDDDDDDDDD
|
||||
* OUTPUT : AADDDDDDDDD
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* If it does, we'll just bound the length and do a strcpy. */
|
||||
replaceLen = maxLen - browsed;
|
||||
/* Note, we add one to the final result for the null terminator */
|
||||
strncopy(ptr, replace, replaceLen+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDDDDDD
|
||||
* OUTPUT : AADDDDDDDCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* We're going to have some bytes left over... */
|
||||
size_t origBytesToCopy = (textLen - (browsed + searchLen)) + 1;
|
||||
size_t realBytesToCopy = (maxLen - (browsed + replaceLen)) + 1;
|
||||
char *moveFrom = ptr + searchLen + (origBytesToCopy - realBytesToCopy);
|
||||
char *moveTo = ptr + replaceLen;
|
||||
|
||||
/* First, move our old data out of the way. */
|
||||
memmove(moveTo, moveFrom, realBytesToCopy);
|
||||
|
||||
/* Now, do our replacement. */
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDDD
|
||||
* OUTPUT : AADDDDCCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* Yes, we have enough space. Do a normal move operation. */
|
||||
char *moveFrom = ptr + searchLen;
|
||||
char *moveTo = ptr + replaceLen;
|
||||
|
||||
/* First move our old data out of the way. */
|
||||
size_t bytesToCopy = (textLen - (browsed + searchLen)) + 1;
|
||||
memmove(moveTo, moveFrom, bytesToCopy);
|
||||
|
||||
/* Now do our replacement. */
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
}
|
||||
else if (replaceLen < searchLen)
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: D
|
||||
* OUTPUT : AADCCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* If the replacement does not grow the string length, we do not
|
||||
* need to do any fancy checking at all. Yay!
|
||||
*/
|
||||
char *moveFrom = ptr + searchLen; /* Start after the search pointer */
|
||||
char *moveTo = ptr + replaceLen; /* Copy to where the replacement ends */
|
||||
|
||||
/* Copy our replacement in, if any */
|
||||
if (replaceLen)
|
||||
{
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
|
||||
/* Figure out how many bytes to move down, including null terminator */
|
||||
size_t bytesToCopy = (textLen - (browsed + searchLen)) + 1;
|
||||
|
||||
/* Move the rest of the string down */
|
||||
memmove(moveTo, moveFrom, bytesToCopy);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDD
|
||||
* OUTPUT : AADDDCCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* We don't have to move anything around, just do a straight copy */
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
|
||||
return ptr + replaceLen;
|
||||
}
|
||||
ptr++;
|
||||
browsed++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *UTIL_TrimWhitespace(char *str, size_t &len)
|
||||
{
|
||||
char *end = str + len - 1;
|
||||
@@ -1361,6 +1580,38 @@ char *UTIL_TrimWhitespace(char *str, size_t &len)
|
||||
return str;
|
||||
}
|
||||
|
||||
size_t UTIL_DecodeHexString(unsigned char *buffer, size_t maxlength, const char *hexstr)
|
||||
{
|
||||
size_t written = 0;
|
||||
size_t length = strlen(hexstr);
|
||||
|
||||
for (size_t i = 0; i < length; i++)
|
||||
{
|
||||
if (written >= maxlength)
|
||||
break;
|
||||
buffer[written++] = hexstr[i];
|
||||
if (hexstr[i] == '\\' && hexstr[i + 1] == 'x')
|
||||
{
|
||||
if (i + 3 >= length)
|
||||
continue;
|
||||
/* Get the hex part. */
|
||||
char s_byte[3];
|
||||
int r_byte;
|
||||
s_byte[0] = hexstr[i + 2];
|
||||
s_byte[1] = hexstr[i + 3];
|
||||
s_byte[2] = '\0';
|
||||
/* Read it as an integer */
|
||||
sscanf(s_byte, "%x", &r_byte);
|
||||
/* Save the value */
|
||||
buffer[written - 1] = r_byte;
|
||||
/* Adjust index */
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
char *UTIL_ToLowerCase(const char *str)
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user