Compare commits
321
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb356f2ffe | ||
|
|
d1b4821ab3 | ||
|
|
ce117a8295 | ||
|
|
ad4309b512 | ||
|
|
81a83fa7ce | ||
|
|
37bfc28011 | ||
|
|
4e308c40ba | ||
|
|
47b597c3ef | ||
|
|
b038670c50 | ||
|
|
79744d0de6 | ||
|
|
dac57ecbec | ||
|
|
6d40705a76 | ||
|
|
b0513dce63 | ||
|
|
3a2f04d2bc | ||
|
|
5539f2e8bf | ||
|
|
477d56b0fe | ||
|
|
f967ffaf76 | ||
|
|
3a1c518ed8 | ||
|
|
0b407a19f1 | ||
|
|
bb681c9c69 | ||
|
|
7a6382d636 | ||
|
|
ee5fa32851 | ||
|
|
5d4d0cf106 | ||
|
|
40149ba650 | ||
|
|
6608766829 | ||
|
|
7d6ef266fb | ||
|
|
54ff5fed60 | ||
|
|
3fdf350f7b | ||
|
|
cb08a96836 | ||
|
|
e3e2b8291a | ||
|
|
f7ed81d3ab | ||
|
|
1c1e9cda7c | ||
|
|
3f17137086 | ||
|
|
3d353d8ae9 | ||
|
|
482ee315b7 | ||
|
|
9e24d6e53f | ||
|
|
f248f474e7 | ||
|
|
a4512141a9 | ||
|
|
e94234ae73 | ||
|
|
54a7aa1116 | ||
|
|
6e264b6eea | ||
|
|
debfaebda8 | ||
|
|
8a633363a2 | ||
|
|
fa6f2f7e64 | ||
|
|
20eae5e394 | ||
|
|
4bce2a8a44 | ||
|
|
7eced94651 | ||
|
|
0869fde119 | ||
|
|
8e6166fa37 | ||
|
|
669b4cc69f | ||
|
|
22622ccafe | ||
|
|
d25c68f0a6 | ||
|
|
ff38e3ded2 | ||
|
|
4f43f43297 | ||
|
|
60fccfface | ||
|
|
98690df815 | ||
|
|
52c537b2ab | ||
|
|
bbec55d5f6 | ||
|
|
0abdcb58cf | ||
|
|
902672aa58 | ||
|
|
aed47ac13d | ||
|
|
6928d046f4 | ||
|
|
6c396dfbef | ||
|
|
4b66ca079d | ||
|
|
ea2e448dd6 | ||
|
|
d7fe14221b | ||
|
|
e89d3e5616 | ||
|
|
253ed583e6 | ||
|
|
58cb84d0bf | ||
|
|
65d34bdb55 | ||
|
|
19fd09c102 | ||
|
|
434d458a54 | ||
|
|
aaae36dbd3 | ||
|
|
4427ec3a65 | ||
|
|
5f6c5cb4fb | ||
|
|
6425484608 | ||
|
|
8e897f62a3 | ||
|
|
d40423569a | ||
|
|
7f28a15a5c | ||
|
|
669f1aefa6 | ||
|
|
a65dfc4888 | ||
|
|
60292fa424 | ||
|
|
0303377f92 | ||
|
|
bfd9b061f4 | ||
|
|
b1bf2dece1 | ||
|
|
b9e2d2b690 | ||
|
|
15fe086e7a | ||
|
|
26eae4e396 | ||
|
|
72eeebb59f | ||
|
|
1c5a684f1c | ||
|
|
3f5cd0e0e7 | ||
|
|
536ef2c019 | ||
|
|
9320d4b378 | ||
|
|
5b6970561e | ||
|
|
83f374561c | ||
|
|
d914a6b982 | ||
|
|
9b14101586 | ||
|
|
46c87f509b | ||
|
|
4df1d19cf2 | ||
|
|
c1af9081c6 | ||
|
|
ae538916b6 | ||
|
|
1efea1fd82 | ||
|
|
ef255c9a3e | ||
|
|
0909a1ffae | ||
|
|
d725178405 | ||
|
|
148271c5ea | ||
|
|
6252676e57 | ||
|
|
d4709704ea | ||
|
|
e6d418c04e | ||
|
|
752f7bdefc | ||
|
|
ced6add9ea | ||
|
|
e9834a33b1 | ||
|
|
e2a6ae9ecc | ||
|
|
eb64e66e9f | ||
|
|
6a24b049cb | ||
|
|
1112dfffb3 | ||
|
|
3304bc2f3a | ||
|
|
4d2bee192f | ||
|
|
2d4fb8a463 | ||
|
|
56c5012bef | ||
|
|
bd97bdd378 | ||
|
|
211c5dcfcd | ||
|
|
2cdf1897b9 | ||
|
|
bf8c57c669 | ||
|
|
7fd6b308f8 | ||
|
|
6908c0f1d0 | ||
|
|
f74380b3e9 | ||
|
|
5096aef6e7 | ||
|
|
d9f5801a68 | ||
|
|
462e03d150 | ||
|
|
6aded88e14 | ||
|
|
74a25097b2 | ||
|
|
2c190f502f | ||
|
|
0122686541 | ||
|
|
187c0a9bf7 | ||
|
|
9def5e57de | ||
|
|
3d573c08a1 | ||
|
|
e1bb10d859 | ||
|
|
569f4646a0 | ||
|
|
16756e550f | ||
|
|
3ac9ecb4b7 | ||
|
|
3ee6bae4ba | ||
|
|
2e176b8b8d | ||
|
|
5b21fc89fc | ||
|
|
bc7b90a1b4 | ||
|
|
c0ee2ce345 | ||
|
|
2c7555366f | ||
|
|
72da49415e | ||
|
|
8e744ec5f7 | ||
|
|
7372b66680 | ||
|
|
8dfbcf5a9f | ||
|
|
01ff2cca0c | ||
|
|
e981c2b43f | ||
|
|
68bc33ef4d | ||
|
|
a7e447a3f5 | ||
|
|
096a04b3e4 | ||
|
|
86e600000d | ||
|
|
a0128d9b7c | ||
|
|
65996254c6 | ||
|
|
a85031be53 | ||
|
|
8509f0857a | ||
|
|
b24c75b400 | ||
|
|
d372e789a4 | ||
|
|
d9f7e4c9e0 | ||
|
|
e6ea726b69 | ||
|
|
98c1a18e57 | ||
|
|
e04d2a4a10 | ||
|
|
96a3671bb6 | ||
|
|
0c028ca9d0 | ||
|
|
64124447d5 | ||
|
|
037ea592ab | ||
|
|
6ebbb48f9f | ||
|
|
2e8a53ff34 | ||
|
|
f104438802 | ||
|
|
eb25650e26 | ||
|
|
c4cba5254c | ||
|
|
c90dda908a | ||
|
|
6aca0a8bfc | ||
|
|
864376e7ba | ||
|
|
71794fe511 | ||
|
|
c69989c56f | ||
|
|
2c3bf7dd23 | ||
|
|
5e6417eac0 | ||
|
|
09b24e45f9 | ||
|
|
fc7f9ac6e9 | ||
|
|
7dcc7ea99c | ||
|
|
4590015ed6 | ||
|
|
79f9dc61a4 | ||
|
|
3fac7d027a | ||
|
|
10ba5809d2 | ||
|
|
792204bd06 | ||
|
|
f19cb010a0 | ||
|
|
ca3df3bd50 | ||
|
|
db43487b5a | ||
|
|
44a04e6167 | ||
|
|
9d6a9eb615 | ||
|
|
27070af1b9 | ||
|
|
32d2d4107d | ||
|
|
75ebac822d | ||
|
|
bd9fab6cf5 | ||
|
|
d75f8f11e1 | ||
|
|
47900db414 | ||
|
|
b61542242c | ||
|
|
13c1fd09c4 | ||
|
|
fddb69e49e | ||
|
|
ed51d5cf84 | ||
|
|
3d7b0db114 | ||
|
|
9e445a5adf | ||
|
|
97e25c37de | ||
|
|
16033c1307 | ||
|
|
15d64b8486 | ||
|
|
5d06aa3c8c | ||
|
|
e276223b61 | ||
|
|
6530f47b2d | ||
|
|
ffd8ff099a | ||
|
|
e194f89b25 | ||
|
|
3bfc70aa3b | ||
|
|
93a6a0f211 | ||
|
|
cef6a2e389 | ||
|
|
4f5764e4a5 | ||
|
|
21770ff10f | ||
|
|
2b97461f54 | ||
|
|
0cf5f4ae2a | ||
|
|
7b6dcfce87 | ||
|
|
f9d472847c | ||
|
|
d69d97402b | ||
|
|
643c39690f | ||
|
|
6048144310 | ||
|
|
a017e4820a | ||
|
|
c5ec369388 | ||
|
|
52826342fc | ||
|
|
29b357a2f6 | ||
|
|
747ed1e59a | ||
|
|
992c05b6aa | ||
|
|
f4a5457941 | ||
|
|
22675ba2e7 | ||
|
|
80602b011d | ||
|
|
abea8e2195 | ||
|
|
9075aecb18 | ||
|
|
6e9ac875d7 | ||
|
|
100ecb12e9 | ||
|
|
57b4701e57 | ||
|
|
fffc211989 | ||
|
|
5a0528de26 | ||
|
|
fb8f46ea45 | ||
|
|
3653f56331 | ||
|
|
e31cbbfe21 | ||
|
|
bc3491c5bd | ||
|
|
9a7c25047d | ||
|
|
7cef8b7363 | ||
|
|
e449b8384c | ||
|
|
9514c12982 | ||
|
|
489d6c5a65 | ||
|
|
ccc59ecdaf | ||
|
|
d2ce50f989 | ||
|
|
14e409adb4 | ||
|
|
4a0f639e89 | ||
|
|
32c5925652 | ||
|
|
4c91dd8621 | ||
|
|
f641aa92f5 | ||
|
|
3bdc8583e5 | ||
|
|
4e37900d93 | ||
|
|
db760dc29b | ||
|
|
f96ca17f17 | ||
|
|
50580498c4 | ||
|
|
a21e688c96 | ||
|
|
4b1deee7e1 | ||
|
|
bf5fefe84f | ||
|
|
004d450844 | ||
|
|
7705e88b57 | ||
|
|
1577fab93a | ||
|
|
181fe74b09 | ||
|
|
cdd78b2ec3 | ||
|
|
ddc42bedf5 | ||
|
|
a7a08a7d4e | ||
|
|
0a33a25a7d | ||
|
|
2c9622ea52 | ||
|
|
5564c38a2f | ||
|
|
2a853a23d7 | ||
|
|
37da98c9bb | ||
|
|
5a5172be57 | ||
|
|
88afac51f0 | ||
|
|
dd338d40f3 | ||
|
|
1cc8440900 | ||
|
|
47cf8f4233 | ||
|
|
4e88626d65 | ||
|
|
a1b91ac136 | ||
|
|
0a0fd0c64a | ||
|
|
a7c6fc12d8 | ||
|
|
48f0a49f9b | ||
|
|
b63d714a06 | ||
|
|
7bdcea5814 | ||
|
|
f418f38589 | ||
|
|
52377b509b | ||
|
|
14152bb7ba | ||
|
|
d51aaec97d | ||
|
|
ea3fe754f4 | ||
|
|
f20603ad06 | ||
|
|
bac975331d | ||
|
|
4baf847062 | ||
|
|
90a44ea6c8 | ||
|
|
fef83838f9 | ||
|
|
1422a9abe3 | ||
|
|
984a2d26f4 | ||
|
|
f85bb7e490 | ||
|
|
843ff25de4 | ||
|
|
7a38e5584c | ||
|
|
9c1e45d97c | ||
|
|
c2756c731f | ||
|
|
d6fc82f8fa | ||
|
|
2acf1b08d5 | ||
|
|
6ffd39ac77 | ||
|
|
9ae456b9d1 | ||
|
|
5bbeddc134 | ||
|
|
373fbb6ca3 | ||
|
|
43f5d71724 | ||
|
|
41b61ed36f | ||
|
|
31e30faace | ||
|
|
ff7a2c6b73 | ||
|
|
7e3f9ada31 | ||
|
|
0a956115eb |
@@ -1,3 +1,8 @@
|
|||||||
54539fa4e51f98d7841c853c1370dff6ccd3cdf2 sourcemod-1.0.0
|
54539fa4e51f98d7841c853c1370dff6ccd3cdf2 sourcemod-1.0.0
|
||||||
e6ef5ecdf8d75740ca2685a709bf321f8873bc3b sourcemod-1.1.0
|
e6ef5ecdf8d75740ca2685a709bf321f8873bc3b sourcemod-1.1.0
|
||||||
e877885fac80be71822641f7a9122cebc9812521 sourcemod-1.1.1
|
e877885fac80be71822641f7a9122cebc9812521 sourcemod-1.1.1
|
||||||
|
b3ffa8a4511c4eadaf533fc790aa6b14f7f0c6ea sourcemod-1.1.2
|
||||||
|
3a73bbf60f34befa9b66be03fa5974b394bb3411 sourcemod-1.2.0
|
||||||
|
3c30a59c2296a13284a9f4eb42863b47db645adf sourcemod-1.2.1
|
||||||
|
f55c735efeefe68863b96713fcd55a7774d8ceab sourcemod-1.2.2
|
||||||
|
236a032c2a4da8f0af24b56b0539b1c574379be8 sourcemod-1.2.3
|
||||||
|
|||||||
+288
@@ -0,0 +1,288 @@
|
|||||||
|
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from ambuild.command import SymlinkCommand
|
||||||
|
|
||||||
|
class SM:
|
||||||
|
def __init__(self):
|
||||||
|
self.compiler = Cpp.Compiler()
|
||||||
|
|
||||||
|
#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'}
|
||||||
|
if AMBuild.target['platform'] == 'windows':
|
||||||
|
self.sdkInfo['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
|
||||||
|
'name': 'DARKMESSIAH'}
|
||||||
|
|
||||||
|
if AMBuild.mode == 'config':
|
||||||
|
#Detect compilers
|
||||||
|
self.compiler.DetectAll(AMBuild)
|
||||||
|
|
||||||
|
#Detect variables
|
||||||
|
envvars = { 'MMSOURCE17': 'mmsource-1.7',
|
||||||
|
'HL2SDK': 'hl2sdk',
|
||||||
|
'HL2SDKOB': 'hl2sdk-ob',
|
||||||
|
'HL2SDKL4D': 'hl2sdk-l4d',
|
||||||
|
'HL2SDKOBVALVE': 'hl2sdk-ob-valve',
|
||||||
|
'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()
|
||||||
|
while head != None and head != '/':
|
||||||
|
path = os.path.join(head, envvars[i])
|
||||||
|
if os.path.isdir(path):
|
||||||
|
break
|
||||||
|
head, tail = os.path.split(head)
|
||||||
|
if head == None or head == '/':
|
||||||
|
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.mmsPath = AMBuild.cache['MMSOURCE17']
|
||||||
|
|
||||||
|
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 + '"']}
|
||||||
|
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)
|
||||||
|
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'])
|
||||||
|
else:
|
||||||
|
paths.append(['public', 'game', 'server'])
|
||||||
|
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']
|
||||||
|
compiler['POSTLINKFLAGS'][0:0] = ['tier0_i486.so']
|
||||||
|
compiler['POSTLINKFLAGS'][0:0] = ['vstdlib_i486.so']
|
||||||
|
|
||||||
|
return compiler
|
||||||
|
|
||||||
|
sm = SM()
|
||||||
|
globals = {
|
||||||
|
'SM': sm
|
||||||
|
}
|
||||||
|
|
||||||
|
AMBuild.Include(os.path.join('tools', 'buildbot', 'Versioning'), globals)
|
||||||
|
|
||||||
|
FileList = [
|
||||||
|
['loader', 'AMBuilder'],
|
||||||
|
['core', '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']
|
||||||
|
]
|
||||||
|
|
||||||
|
for parts in FileList:
|
||||||
|
AMBuild.Include(os.path.join(*parts), globals)
|
||||||
|
|
||||||
+119
@@ -2,6 +2,125 @@ SourceMod Changelog
|
|||||||
|
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
|
SourceMod 1.2.4 [2009-10-03]
|
||||||
|
|
||||||
|
URL: http://wiki.alliedmods.net/SourceMod_1.2.4_Release_Notes
|
||||||
|
|
||||||
|
- Updated for L4D changes (bugs 4032, 4033, 4035).
|
||||||
|
- Updated GeoLite Country database for GeoIP extension.
|
||||||
|
- Fixed crash when block-loading more than eight plugins (bug 4034).
|
||||||
|
- Fixed rare crash in hudtext code on TF (bug 4016).
|
||||||
|
- Fixed crash when reloading a blocked plugin failed (bug 4038).
|
||||||
|
- Fixed Huntsman not firing critical callback on TF (bug 3927).
|
||||||
|
- Registering the "sm" command no longer has any effect (bug 4013).
|
||||||
|
- Fixed translation bug in extension API (bug 4010).
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
SourceMod 1.2.3 [2009-08-28]
|
||||||
|
|
||||||
|
URL: http://wiki.alliedmods.net/SourceMod_1.2.3_Release_Notes
|
||||||
|
|
||||||
|
- Fix extension filename lookup. (bug 3975).
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
SourceMod 1.2.2 [2009-08-28]
|
||||||
|
|
||||||
|
URL: http://wiki.alliedmods.net/SourceMod_1.2.2_Release_Notes
|
||||||
|
|
||||||
|
- Removed auto folders. (bug 3949).
|
||||||
|
- Added PointOutsideWorld native to sdktools. (bug 3906).
|
||||||
|
- Added "motd" chat trigger to basetriggers. (bug 2694).
|
||||||
|
- Added manual extension reloading command to root console menu. (bug 3934)
|
||||||
|
- Fixed 'list' type custom menu entries overwriting admin restrictions. (bug 3783).
|
||||||
|
- Added sm_resetcvar command to basecommands. (bug 3636).
|
||||||
|
- Updated gamedata for DOD:S. (bug 3948).
|
||||||
|
- Updated gamedata for TF2. (bug 3948).
|
||||||
|
- Added new .ep2v build config for valve OB based games. (bug 3948).
|
||||||
|
- Fixed incorrect escaping in clientprefs SQLite queries. (bug 3904)
|
||||||
|
- Updated gamedata for Synergy. (bug 3315).
|
||||||
|
- Upgraded to pcre-7.9 (bug 3923).
|
||||||
|
- Switched Insurgency chat printing to SayText. (bug 3738).
|
||||||
|
- Updated gamedata for Insurgency. (bug 3511).
|
||||||
|
- Updated gamedata for ZM. (bug 3746).
|
||||||
|
- Updated gamedata for Empires. (bug 3500).
|
||||||
|
- Updated gamedata for ZPS. (bug 3877).
|
||||||
|
- Updated gamedata for AoC. (bug 3891).
|
||||||
|
- Fixed RemovePlayerDisguise signature for TF2. (bug 3892).
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
SourceMod 1.2.1 [2009-05-31]
|
||||||
|
|
||||||
|
URL: http://wiki.alliedmods.net/SourceMod_1.2.1_Release_Notes
|
||||||
|
|
||||||
|
- Updated SDKTools for latest Team Fortress update.
|
||||||
|
- Added L4D handling to GuessSDKVersion() (bug 3842).
|
||||||
|
- Updated Zombie Panic Source offsets (bug 3632).
|
||||||
|
- Fixed crash when clientprefs saw disconnect from 64th client (bug 3821).
|
||||||
|
- Fixed Plugin_Handled acting like a Stop in usermsg hooks (bug 3685).
|
||||||
|
- Fixed early tv_enable causing crashes (bug 3766).
|
||||||
|
- Fixed unhook event crash (bug 3814).
|
||||||
|
- Fixed compiler reading uninitialized strings while processing varargs (bug 3811).
|
||||||
|
- Fixed compiler choosing whether to emit stradjust.pri on dynamic arrays based on uninitialized memory (bug 3810).
|
||||||
|
- Fixed Windows L4D CreateFakeClient signature (bug 3792).
|
||||||
|
- Fixed sm_slap for EP1 games (bug 3768).
|
||||||
|
- Fixed casting problems in TextParsers breaking TrimString for non-ASCII characters (bug 3800).
|
||||||
|
- Fixed OnClientConnect rejectmsg handling, improved doc (bug 3690).
|
||||||
|
- Fixed clientprefs not loading cookies for clients on late load (bug 3735).
|
||||||
|
- Fixed GetCommandFlags on original engine games (bug 3759).
|
||||||
|
- Fixed compiler asserting when returning a string literal (bug 3836).
|
||||||
|
- Fixed compiler erroring when tagging functions for string return (bug 3837).
|
||||||
|
- Fixed compiler not handling constant chained relational operators correctly (bug 3838).
|
||||||
|
- Fixed revote bug and inflexibilities in RedrawClientVoteMenu (bug 3834).
|
||||||
|
- Fixed auto update URL being set too late (bug 3699).
|
||||||
|
- Disabled nextmap in Synergy and Dystopia (bug 3687, bug 3741).
|
||||||
|
- Removed unnecessary SSE optimizations from msvc9 project files (bug 3756).
|
||||||
|
- Removed short-lived tag system (bug 3751).
|
||||||
|
- Removed the alive check from sm_rename. (bug 3698).
|
||||||
|
- Switched FortressForever to Valve menus (bug 3819).
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
SourceMod 1.2.0 [2009-03-05]
|
||||||
|
|
||||||
|
URL: http://wiki.alliedmods.net/SourceMod_1.2.0_Release_Notes
|
||||||
|
|
||||||
|
Major Features:
|
||||||
|
* Left 4 Dead Support
|
||||||
|
* Dark Messiah Support
|
||||||
|
* New and Improved Updater
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Added Left 4 Dead support (bug 3414).
|
||||||
|
- Added Dark Messiah game support (requires Metamod:Source 1.7.1 or higher).
|
||||||
|
- Added sm_name command (bug 2150).
|
||||||
|
- Added extension-level dynamic hooking to bintools (bug 2616).
|
||||||
|
- Added client validation API to replace passing userids asynchronously.
|
||||||
|
- Added cURL extension, available to other extensions (bug 3560).
|
||||||
|
- Added parsing of custom gamedata files (bug 3644).
|
||||||
|
- Added case insensitivity search to ReplaceString (bug 3639, Fyren).
|
||||||
|
- Added more detail to certain player-oriented menu titles (bug 2740, Fyren).
|
||||||
|
- Added sv_tags API (bug 3677).
|
||||||
|
- Greatly improved admin-sql-prefetch performance for large tables (bug 3354, FLOOR_MASTER).
|
||||||
|
- Exposed IServer address to extensions (bug 3545).
|
||||||
|
- New gamedata organization; files are now smaller and per-game (bug 3546).
|
||||||
|
- Split sound functions into a new plugin, sounds.smx.
|
||||||
|
- Fixed slap and slay on Insurgency (bug 2560).
|
||||||
|
- Fixed blank admins being created from invalid admin file lines (bug 3431).
|
||||||
|
- Fixed basetriggers not working on Insurgency (bug 3497).
|
||||||
|
- Fixed client preferences missing some clients (bug 3616).
|
||||||
|
- Improved database fallback mechanism in clientprefs (bug 3564).
|
||||||
|
- Improved timer handling in funcommands (bug 3498).
|
||||||
|
- Improved compile.sh to take filenames (bug 3550, jonasfietz).
|
||||||
|
- sm_kick now shows the kick reason when available.
|
||||||
|
- Fixed MsgPostHook (ex MsgSentNotify) callbacks not firing on intercept hook (bug 3631).
|
||||||
|
- Note: SourceMod now adds "sourcemod" to the sv_tags cvar.
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
|
||||||
SourceMod 1.1.2 [2009-02-26]
|
SourceMod 1.1.2 [2009-02-26]
|
||||||
|
|
||||||
URL: http://wiki.alliedmods.net/SourceMod_1.1.2_Release_Notes
|
URL: http://wiki.alliedmods.net/SourceMod_1.1.2_Release_Notes
|
||||||
|
|||||||
+3
-15
@@ -4,14 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
"Core"
|
"Core"
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Relative path to SourceMod's base directory. This is relative to the game/mod directory.
|
|
||||||
* Only change this if you have installed SourceMod in a non-default location.
|
|
||||||
*
|
|
||||||
* The default value is "addons/sourcemod"
|
|
||||||
*/
|
|
||||||
"BasePath" "addons/sourcemod"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This option determines if SourceMod logging is enabled.
|
* This option determines if SourceMod logging is enabled.
|
||||||
*
|
*
|
||||||
@@ -105,15 +97,11 @@
|
|||||||
"ForceRestartAfterUpdate" "no"
|
"ForceRestartAfterUpdate" "no"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the server to connect to for auotmatic gamedata updates.
|
* URL to use for retrieving update information.
|
||||||
|
* SSL is not yet supported.
|
||||||
*/
|
*/
|
||||||
"AutoUpdateServer" "smupdate.alliedmods.net"
|
"AutoUpdateURL" "http://update.sourcemod.net/update/"
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the port to connect to on the AutoUpdateServer server
|
|
||||||
*/
|
|
||||||
"AutoUpdatePort" "6500"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to show debug spew.
|
* Whether to show debug spew.
|
||||||
* Currently this will log details about the gamedata updating process.
|
* Currently this will log details about the gamedata updating process.
|
||||||
|
|||||||
Binary file not shown.
@@ -2,4 +2,3 @@
|
|||||||
{
|
{
|
||||||
"en" "English"
|
"en" "English"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# vim: set ts=2 sw=2 tw=99 noet:
|
||||||
|
import sys
|
||||||
|
import ambuild.runner as runner
|
||||||
|
|
||||||
|
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.Configure(sys.path[0])
|
||||||
+108
@@ -0,0 +1,108 @@
|
|||||||
|
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||||
|
import os
|
||||||
|
|
||||||
|
for i in SM.sdkInfo:
|
||||||
|
sdk = SM.sdkInfo[i]
|
||||||
|
name = 'sourcemod.' + sdk['ext']
|
||||||
|
|
||||||
|
compiler = SM.DefaultHL2Compiler('core', i)
|
||||||
|
compiler['CDEFINES'].append('SM_DEFAULT_THREADER')
|
||||||
|
if AMBuild.target['platform'] == 'linux':
|
||||||
|
compiler['POSTLINKFLAGS'].append('-lpthread')
|
||||||
|
|
||||||
|
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',
|
||||||
|
'smn_entities.cpp',
|
||||||
|
'smn_maplists.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_adt_array.cpp',
|
||||||
|
'smn_filesystem.cpp',
|
||||||
|
'smn_player.cpp',
|
||||||
|
'sourcemod.cpp',
|
||||||
|
'concmd_cleaner.cpp',
|
||||||
|
'HalfLife2.cpp',
|
||||||
|
'NextMap.cpp',
|
||||||
|
'smn_adt_stack.cpp',
|
||||||
|
'smn_float.cpp',
|
||||||
|
'smn_profiler.cpp',
|
||||||
|
'TextParsers.cpp',
|
||||||
|
'ConCmdManager.cpp',
|
||||||
|
'HandleSys.cpp',
|
||||||
|
'PhraseCollection.cpp',
|
||||||
|
'smn_adt_trie.cpp',
|
||||||
|
'smn_functions.cpp',
|
||||||
|
'smn_sorting.cpp',
|
||||||
|
'ThreadSupport.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',
|
||||||
|
'smn_textparse.cpp',
|
||||||
|
'Translator.cpp',
|
||||||
|
'MemoryUtils.cpp',
|
||||||
|
'PluginSys.cpp',
|
||||||
|
'smn_console.cpp',
|
||||||
|
'smn_handles.cpp',
|
||||||
|
'smn_timers.cpp',
|
||||||
|
'UserMessages.cpp',
|
||||||
|
'Database.cpp',
|
||||||
|
'MenuManager.cpp',
|
||||||
|
'Profiler.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',
|
||||||
|
'thread/ThreadWorker.cpp',
|
||||||
|
'thread/BaseWorker.cpp'
|
||||||
|
]
|
||||||
|
if AMBuild.target['platform'] == 'windows':
|
||||||
|
files.append('thread/WinThreads.cpp')
|
||||||
|
else:
|
||||||
|
files.append('thread/PosixThreads.cpp')
|
||||||
|
binary.AddSourceFiles('core', files)
|
||||||
|
SM.PostSetupHL2Job(extension, binary, i)
|
||||||
|
SM.AutoVersion('core', binary)
|
||||||
|
binary.SendToJob()
|
||||||
|
|
||||||
@@ -1170,6 +1170,11 @@ bool AdminCache::GetMethodIndex(const char *name, unsigned int *_index)
|
|||||||
|
|
||||||
bool AdminCache::BindAdminIdentity(AdminId id, const char *auth, const char *ident)
|
bool AdminCache::BindAdminIdentity(AdminId id, const char *auth, const char *ident)
|
||||||
{
|
{
|
||||||
|
if (ident[0] == '\0')
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
AdminUser *pUser = (AdminUser *)m_pMemory->GetAddress(id);
|
AdminUser *pUser = (AdminUser *)m_pMemory->GetAddress(id);
|
||||||
if (!pUser || pUser->magic != USR_MAGIC_SET)
|
if (!pUser || pUser->magic != USR_MAGIC_SET)
|
||||||
{
|
{
|
||||||
|
|||||||
+8
-31
@@ -41,7 +41,7 @@
|
|||||||
* While the OB build only runs on MM:S 1.6.0+ (SH 5+), the older one
|
* While the OB build only runs on MM:S 1.6.0+ (SH 5+), the older one
|
||||||
* can technically be compiled against any MM:S version after 1.4.2.
|
* can technically be compiled against any MM:S version after 1.4.2.
|
||||||
*/
|
*/
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
extern bool __SourceHook_FHRemoveConCommandDispatch(void *, bool, class fastdelegate::FastDelegate1<const CCommand &, void>);
|
extern bool __SourceHook_FHRemoveConCommandDispatch(void *, bool, class fastdelegate::FastDelegate1<const CCommand &, void>);
|
||||||
extern int __SourceHook_FHAddConCommandDispatch(void *, ISourceHook::AddHookMode, bool, class fastdelegate::FastDelegate1<const CCommand &, void>);
|
extern int __SourceHook_FHAddConCommandDispatch(void *, ISourceHook::AddHookMode, bool, class fastdelegate::FastDelegate1<const CCommand &, void>);
|
||||||
#else
|
#else
|
||||||
@@ -53,7 +53,7 @@ extern int __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate
|
|||||||
#elif SH_IMPL_VERSION == 3
|
#elif SH_IMPL_VERSION == 3
|
||||||
extern bool __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
|
extern bool __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
|
||||||
#endif //SH_IMPL_VERSION
|
#endif //SH_IMPL_VERSION
|
||||||
#endif //ORANGEBOX_BUILD
|
#endif //SE_ORANGEBOX
|
||||||
|
|
||||||
ChatTriggers g_ChatTriggers;
|
ChatTriggers g_ChatTriggers;
|
||||||
bool g_bSupressSilentFails = false;
|
bool g_bSupressSilentFails = false;
|
||||||
@@ -118,31 +118,8 @@ void ChatTriggers::OnSourceModAllInitialized_Post()
|
|||||||
|
|
||||||
void ChatTriggers::OnSourceModGameInitialized()
|
void ChatTriggers::OnSourceModGameInitialized()
|
||||||
{
|
{
|
||||||
unsigned int total = 2;
|
m_pSayCmd = FindCommand("say");
|
||||||
ConCommandBase *pCmd = icvar->GetCommands();
|
m_pSayTeamCmd = FindCommand("say_team");
|
||||||
const char *name;
|
|
||||||
while (pCmd)
|
|
||||||
{
|
|
||||||
if (pCmd->IsCommand())
|
|
||||||
{
|
|
||||||
name = pCmd->GetName();
|
|
||||||
if (!m_pSayCmd && strcmp(name, "say") == 0)
|
|
||||||
{
|
|
||||||
m_pSayCmd = (ConCommand *)pCmd;
|
|
||||||
if (--total == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (!m_pSayTeamCmd && strcmp(name, "say_team") == 0) {
|
|
||||||
m_pSayTeamCmd = (ConCommand *)pCmd;
|
|
||||||
if (--total == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pCmd = const_cast<ConCommandBase *>(pCmd->GetNext());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_pSayCmd)
|
if (m_pSayCmd)
|
||||||
{
|
{
|
||||||
@@ -173,7 +150,7 @@ void ChatTriggers::OnSourceModShutdown()
|
|||||||
g_Forwards.ReleaseForward(m_pDidFloodBlock);
|
g_Forwards.ReleaseForward(m_pDidFloodBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void ChatTriggers::OnSayCommand_Pre(const CCommand &command)
|
void ChatTriggers::OnSayCommand_Pre(const CCommand &command)
|
||||||
{
|
{
|
||||||
#else
|
#else
|
||||||
@@ -267,7 +244,7 @@ void ChatTriggers::OnSayCommand_Pre()
|
|||||||
/**
|
/**
|
||||||
* Test if this is actually a command!
|
* Test if this is actually a command!
|
||||||
*/
|
*/
|
||||||
if (!PreProcessTrigger(engine->PEntityOfEntIndex(client), args, is_quoted))
|
if (!PreProcessTrigger(PEntityOfEntIndex(client), args, is_quoted))
|
||||||
{
|
{
|
||||||
CPlayer *pPlayer;
|
CPlayer *pPlayer;
|
||||||
if (is_silent
|
if (is_silent
|
||||||
@@ -299,7 +276,7 @@ void ChatTriggers::OnSayCommand_Pre()
|
|||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void ChatTriggers::OnSayCommand_Post(const CCommand &command)
|
void ChatTriggers::OnSayCommand_Post(const CCommand &command)
|
||||||
#else
|
#else
|
||||||
void ChatTriggers::OnSayCommand_Post()
|
void ChatTriggers::OnSayCommand_Post()
|
||||||
@@ -315,7 +292,7 @@ void ChatTriggers::OnSayCommand_Post()
|
|||||||
/* Execute the cached command */
|
/* Execute the cached command */
|
||||||
int client = g_ConCmds.GetCommandClient();
|
int client = g_ConCmds.GetCommandClient();
|
||||||
unsigned int old = SetReplyTo(SM_REPLY_CHAT);
|
unsigned int old = SetReplyTo(SM_REPLY_CHAT);
|
||||||
serverpluginhelpers->ClientCommand(engine->PEntityOfEntIndex(client), m_ToExecute);
|
serverpluginhelpers->ClientCommand(PEntityOfEntIndex(client), m_ToExecute);
|
||||||
SetReplyTo(old);
|
SetReplyTo(old);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ public: //SMGlobalClass
|
|||||||
char *error,
|
char *error,
|
||||||
size_t maxlength);
|
size_t maxlength);
|
||||||
private: //ConCommand
|
private: //ConCommand
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void OnSayCommand_Pre(const CCommand &command);
|
void OnSayCommand_Pre(const CCommand &command);
|
||||||
void OnSayCommand_Post(const CCommand &command);
|
void OnSayCommand_Post(const CCommand &command);
|
||||||
#else
|
#else
|
||||||
|
|||||||
+54
-49
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
ConCmdManager g_ConCmds;
|
ConCmdManager g_ConCmds;
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
SH_DECL_HOOK1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
SH_DECL_HOOK1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
||||||
#else
|
#else
|
||||||
SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||||
@@ -205,7 +205,7 @@ void ConCmdManager::OnPluginDestroyed(IPlugin *plugin)
|
|||||||
delete pList;
|
delete pList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void CommandCallback(const CCommand &command)
|
void CommandCallback(const CCommand &command)
|
||||||
{
|
{
|
||||||
#else
|
#else
|
||||||
@@ -229,46 +229,67 @@ void ConCmdManager::SetCommandClient(int client)
|
|||||||
ResultType ConCmdManager::DispatchClientCommand(int client, const char *cmd, int args, ResultType type)
|
ResultType ConCmdManager::DispatchClientCommand(int client, const char *cmd, int args, ResultType type)
|
||||||
{
|
{
|
||||||
ConCmdInfo *pInfo;
|
ConCmdInfo *pInfo;
|
||||||
if (sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
|
|
||||||
|
if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
|
||||||
{
|
{
|
||||||
cell_t result = type;
|
List<ConCmdInfo *>::iterator iter;
|
||||||
cell_t tempres = result;
|
|
||||||
List<CmdHook *>::iterator iter;
|
pInfo = NULL;
|
||||||
CmdHook *pHook;
|
iter = m_CmdList.begin();
|
||||||
for (iter=pInfo->conhooks.begin();
|
while (iter != m_CmdList.end())
|
||||||
iter!=pInfo->conhooks.end();
|
|
||||||
iter++)
|
|
||||||
{
|
{
|
||||||
pHook = (*iter);
|
if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
|
||||||
if (!pHook->pf->IsRunnable())
|
|
||||||
{
|
{
|
||||||
continue;
|
pInfo = (*iter);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (pHook->pAdmin && !CheckAccess(client, cmd, pHook->pAdmin))
|
iter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pInfo == NULL)
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_t result = type;
|
||||||
|
cell_t tempres = result;
|
||||||
|
List<CmdHook *>::iterator iter;
|
||||||
|
CmdHook *pHook;
|
||||||
|
for (iter=pInfo->conhooks.begin();
|
||||||
|
iter!=pInfo->conhooks.end();
|
||||||
|
iter++)
|
||||||
|
{
|
||||||
|
pHook = (*iter);
|
||||||
|
if (!pHook->pf->IsRunnable())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (pHook->pAdmin && !CheckAccess(client, cmd, pHook->pAdmin))
|
||||||
|
{
|
||||||
|
if (result < Pl_Handled)
|
||||||
{
|
{
|
||||||
if (result < Pl_Handled)
|
result = Pl_Handled;
|
||||||
{
|
|
||||||
result = Pl_Handled;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
pHook->pf->PushCell(client);
|
continue;
|
||||||
pHook->pf->PushCell(args);
|
}
|
||||||
if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
|
pHook->pf->PushCell(client);
|
||||||
|
pHook->pf->PushCell(args);
|
||||||
|
if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
if (tempres > result)
|
||||||
{
|
{
|
||||||
if (tempres > result)
|
result = tempres;
|
||||||
{
|
}
|
||||||
result = tempres;
|
if (result == Pl_Stop)
|
||||||
}
|
{
|
||||||
if (result == Pl_Stop)
|
break;
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
type = (ResultType)result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type = (ResultType)result;
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,7 +536,7 @@ bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmi
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
edict_t *pEdict = engine->PEntityOfEntIndex(client);
|
edict_t *pEdict = PEntityOfEntIndex(client);
|
||||||
|
|
||||||
/* If we got here, the command failed... */
|
/* If we got here, the command failed... */
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
@@ -897,23 +918,7 @@ ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *descri
|
|||||||
{
|
{
|
||||||
pInfo = new ConCmdInfo();
|
pInfo = new ConCmdInfo();
|
||||||
/* Find the commandopan */
|
/* Find the commandopan */
|
||||||
ConCommandBase *pBase = icvar->GetCommands();
|
ConCommand *pCmd = FindCommand(name);
|
||||||
ConCommand *pCmd = NULL;
|
|
||||||
while (pBase)
|
|
||||||
{
|
|
||||||
if (strcmp(pBase->GetName(), name) == 0)
|
|
||||||
{
|
|
||||||
/* Don't want to return convar with same name */
|
|
||||||
if (!pBase->IsCommand())
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pCmd = (ConCommand *)pBase;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pCmd)
|
if (!pCmd)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class ConCmdManager :
|
|||||||
public IPluginsListener,
|
public IPluginsListener,
|
||||||
public IConCommandTracker
|
public IConCommandTracker
|
||||||
{
|
{
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
friend void CommandCallback(const CCommand &command);
|
friend void CommandCallback(const CCommand &command);
|
||||||
#else
|
#else
|
||||||
friend void CommandCallback();
|
friend void CommandCallback();
|
||||||
|
|||||||
+20
-17
@@ -41,18 +41,20 @@
|
|||||||
|
|
||||||
ConVarManager g_ConVarManager;
|
ConVarManager g_ConVarManager;
|
||||||
|
|
||||||
#if !defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE <= SE_DARKMESSIAH
|
||||||
#define CallGlobalChangeCallbacks CallGlobalChangeCallback
|
#define CallGlobalChangeCallbacks CallGlobalChangeCallback
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
SH_DECL_HOOK3_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar *, const char *, float);
|
SH_DECL_HOOK3_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar *, const char *, float);
|
||||||
#else
|
#else
|
||||||
SH_DECL_HOOK2_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar *, const char *);
|
SH_DECL_HOOK2_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar *, const char *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
SH_DECL_HOOK5_void(IServerGameDLL, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *);
|
SH_DECL_HOOK5_void(IServerGameDLL, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *);
|
||||||
SH_DECL_HOOK5_void(IServerPluginCallbacks, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *);
|
SH_DECL_HOOK5_void(IServerPluginCallbacks, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *);
|
||||||
|
#endif
|
||||||
|
|
||||||
const ParamType CONVARCHANGE_PARAMS[] = {Param_Cell, Param_String, Param_String};
|
const ParamType CONVARCHANGE_PARAMS[] = {Param_Cell, Param_String, Param_String};
|
||||||
typedef List<const ConVar *> ConVarList;
|
typedef List<const ConVar *> ConVarList;
|
||||||
@@ -84,7 +86,7 @@ void ConVarManager::OnSourceModAllInitialized()
|
|||||||
/**
|
/**
|
||||||
* Episode 2 has this function by default, but the older versions do not.
|
* Episode 2 has this function by default, but the older versions do not.
|
||||||
*/
|
*/
|
||||||
#if !defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE == SE_EPISODEONE
|
||||||
if (g_SMAPI->GetGameDLLVersion() >= 6)
|
if (g_SMAPI->GetGameDLLVersion() >= 6)
|
||||||
{
|
{
|
||||||
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, OnQueryCvarValueFinished, gamedll, this, &ConVarManager::OnQueryCvarValueFinished, false);
|
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, OnQueryCvarValueFinished, gamedll, this, &ConVarManager::OnQueryCvarValueFinished, false);
|
||||||
@@ -141,6 +143,7 @@ void ConVarManager::OnSourceModShutdown()
|
|||||||
}
|
}
|
||||||
convar_cache.clear();
|
convar_cache.clear();
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
/* Unhook things */
|
/* Unhook things */
|
||||||
if (m_bIsDLLQueryHooked)
|
if (m_bIsDLLQueryHooked)
|
||||||
{
|
{
|
||||||
@@ -152,6 +155,7 @@ void ConVarManager::OnSourceModShutdown()
|
|||||||
SH_REMOVE_HOOK_MEMFUNC(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, this, &ConVarManager::OnQueryCvarValueFinished, false);
|
SH_REMOVE_HOOK_MEMFUNC(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, this, &ConVarManager::OnQueryCvarValueFinished, false);
|
||||||
m_bIsVSPQueryHooked = false;
|
m_bIsVSPQueryHooked = false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
SH_REMOVE_HOOK_STATICFUNC(ICvar, CallGlobalChangeCallbacks, icvar, OnConVarChanged, false);
|
SH_REMOVE_HOOK_STATICFUNC(ICvar, CallGlobalChangeCallbacks, icvar, OnConVarChanged, false);
|
||||||
|
|
||||||
@@ -189,8 +193,10 @@ void ConVarManager::OnSourceModVSPReceived()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
SH_ADD_HOOK_MEMFUNC(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, this, &ConVarManager::OnQueryCvarValueFinished, false);
|
SH_ADD_HOOK_MEMFUNC(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, this, &ConVarManager::OnQueryCvarValueFinished, false);
|
||||||
m_bIsVSPQueryHooked = true;
|
m_bIsVSPQueryHooked = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool convar_cache_lookup(const char *name, ConVarInfo **pVar)
|
bool convar_cache_lookup(const char *name, ConVarInfo **pVar)
|
||||||
@@ -359,17 +365,10 @@ Handle_t ConVarManager::CreateConVar(IPluginContext *pContext, const char *name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* To prevent creating a convar that has the same name as a console command... ugh */
|
/* Prevent creating a convar that has the same name as a console command */
|
||||||
ConCommandBase *pBase = icvar->GetCommands();
|
if (FindCommand(name))
|
||||||
|
|
||||||
while (pBase)
|
|
||||||
{
|
{
|
||||||
if (pBase->IsCommand() && strcmp(pBase->GetName(), name) == 0)
|
return BAD_HANDLE;
|
||||||
{
|
|
||||||
return BAD_HANDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create and initialize ConVarInfo structure */
|
/* Create and initialize ConVarInfo structure */
|
||||||
@@ -535,8 +534,9 @@ void ConVarManager::UnhookConVarChange(ConVar *pConVar, IPluginFunction *pFuncti
|
|||||||
|
|
||||||
QueryCvarCookie_t ConVarManager::QueryClientConVar(edict_t *pPlayer, const char *name, IPluginFunction *pCallback, Handle_t hndl)
|
QueryCvarCookie_t ConVarManager::QueryClientConVar(edict_t *pPlayer, const char *name, IPluginFunction *pCallback, Handle_t hndl)
|
||||||
{
|
{
|
||||||
QueryCvarCookie_t cookie;
|
QueryCvarCookie_t cookie = 0;
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
/* Call StartQueryCvarValue() in either the IVEngineServer or IServerPluginHelpers depending on situation */
|
/* Call StartQueryCvarValue() in either the IVEngineServer or IServerPluginHelpers depending on situation */
|
||||||
if (m_bIsDLLQueryHooked)
|
if (m_bIsDLLQueryHooked)
|
||||||
{
|
{
|
||||||
@@ -553,6 +553,7 @@ QueryCvarCookie_t ConVarManager::QueryClientConVar(edict_t *pPlayer, const char
|
|||||||
|
|
||||||
ConVarQuery query = {cookie, pCallback, hndl};
|
ConVarQuery query = {cookie, pCallback, hndl};
|
||||||
m_ConVarQueries.push_back(query);
|
m_ConVarQueries.push_back(query);
|
||||||
|
#endif
|
||||||
|
|
||||||
return cookie;
|
return cookie;
|
||||||
}
|
}
|
||||||
@@ -595,7 +596,7 @@ void ConVarManager::AddConVarToPluginList(IPluginContext *pContext, const ConVar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue)
|
void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue)
|
||||||
#else
|
#else
|
||||||
void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue)
|
void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue)
|
||||||
@@ -623,7 +624,7 @@ void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue)
|
|||||||
i != pInfo->changeListeners.end();
|
i != pInfo->changeListeners.end();
|
||||||
i++)
|
i++)
|
||||||
{
|
{
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
(*i)->OnConVarChanged(pConVar, oldValue, flOldValue);
|
(*i)->OnConVarChanged(pConVar, oldValue, flOldValue);
|
||||||
#else
|
#else
|
||||||
(*i)->OnConVarChanged(pConVar, oldValue, atof(oldValue));
|
(*i)->OnConVarChanged(pConVar, oldValue, atof(oldValue));
|
||||||
@@ -646,6 +647,7 @@ bool ConVarManager::IsQueryingSupported()
|
|||||||
return (m_bIsDLLQueryHooked || m_bIsVSPQueryHooked);
|
return (m_bIsDLLQueryHooked || m_bIsVSPQueryHooked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue)
|
void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue)
|
||||||
{
|
{
|
||||||
IPluginFunction *pCallback = NULL;
|
IPluginFunction *pCallback = NULL;
|
||||||
@@ -668,7 +670,7 @@ void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *
|
|||||||
cell_t ret;
|
cell_t ret;
|
||||||
|
|
||||||
pCallback->PushCell(cookie);
|
pCallback->PushCell(cookie);
|
||||||
pCallback->PushCell(engine->IndexOfEdict(pPlayer));
|
pCallback->PushCell(IndexOfEdict(pPlayer));
|
||||||
pCallback->PushCell(result);
|
pCallback->PushCell(result);
|
||||||
pCallback->PushString(cvarName);
|
pCallback->PushString(cvarName);
|
||||||
|
|
||||||
@@ -687,6 +689,7 @@ void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *
|
|||||||
m_ConVarQueries.erase(iter);
|
m_ConVarQueries.erase(iter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
HandleError ConVarManager::ReadConVarHandle(Handle_t hndl, ConVar **pVar)
|
HandleError ConVarManager::ReadConVarHandle(Handle_t hndl, ConVar **pVar)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,6 +42,11 @@
|
|||||||
#include <compat_wrappers.h>
|
#include <compat_wrappers.h>
|
||||||
#include "concmd_cleaner.h"
|
#include "concmd_cleaner.h"
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_DARKMESSIAH
|
||||||
|
class EQueryCvarValueStatus;
|
||||||
|
typedef int QueryCvarCookie_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace SourceHook;
|
using namespace SourceHook;
|
||||||
|
|
||||||
class IConVarChangeListener
|
class IConVarChangeListener
|
||||||
@@ -140,7 +145,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* Static callback that Valve's ConVar object executes when the convar's value changes.
|
* Static callback that Valve's ConVar object executes when the convar's value changes.
|
||||||
*/
|
*/
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
static void OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue);
|
static void OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue);
|
||||||
#else
|
#else
|
||||||
static void OnConVarChanged(ConVar *pConVar, const char *oldValue);
|
static void OnConVarChanged(ConVar *pConVar, const char *oldValue);
|
||||||
@@ -149,8 +154,10 @@ private:
|
|||||||
/**
|
/**
|
||||||
* Callback for when StartQueryCvarValue() has finished.
|
* Callback for when StartQueryCvarValue() has finished.
|
||||||
*/
|
*/
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
void OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result,
|
void OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result,
|
||||||
const char *cvarName, const char *cvarValue);
|
const char *cvarName, const char *cvarValue);
|
||||||
|
#endif
|
||||||
private:
|
private:
|
||||||
HandleType_t m_ConVarType;
|
HandleType_t m_ConVarType;
|
||||||
List<ConVarInfo *> m_ConVars;
|
List<ConVarInfo *> m_ConVars;
|
||||||
|
|||||||
+36
-22
@@ -34,7 +34,7 @@
|
|||||||
#include "sourcemod.h"
|
#include "sourcemod.h"
|
||||||
#include "sourcemm_api.h"
|
#include "sourcemm_api.h"
|
||||||
#include "sm_srvcmds.h"
|
#include "sm_srvcmds.h"
|
||||||
#include "sm_version.h"
|
#include <sourcemod_version.h>
|
||||||
#include "sm_stringutil.h"
|
#include "sm_stringutil.h"
|
||||||
#include "LibrarySys.h"
|
#include "LibrarySys.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
@@ -61,30 +61,31 @@ ConVar *g_ServerCfgFile = NULL;
|
|||||||
|
|
||||||
void CheckAndFinalizeConfigs();
|
void CheckAndFinalizeConfigs();
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
||||||
void Hook_ExecDispatchPre(const CCommand &cmd)
|
void Hook_ExecDispatchPre(const CCommand &cmd)
|
||||||
|
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||||
|
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||||
|
void Hook_ExecDispatchPre()
|
||||||
#else
|
#else
|
||||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||||
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||||
void Hook_ExecDispatchPre()
|
void Hook_ExecDispatchPre()
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if !defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE <= SE_DARKMESSIAH
|
||||||
CCommand cmd;
|
CCommand cmd;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *arg = cmd.Arg(1);
|
const char *arg = cmd.Arg(1);
|
||||||
|
|
||||||
if (!g_bServerExecd
|
if (!g_bServerExecd && arg != NULL && strcmp(arg, g_ServerCfgFile->GetString()) == 0)
|
||||||
&& arg != NULL
|
|
||||||
&& strcmp(arg, g_ServerCfgFile->GetString()) == 0)
|
|
||||||
{
|
{
|
||||||
g_bGotTrigger = true;
|
g_bGotTrigger = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void Hook_ExecDispatchPost(const CCommand &cmd)
|
void Hook_ExecDispatchPost(const CCommand &cmd)
|
||||||
#else
|
#else
|
||||||
void Hook_ExecDispatchPost()
|
void Hook_ExecDispatchPost()
|
||||||
@@ -100,10 +101,9 @@ void Hook_ExecDispatchPost()
|
|||||||
|
|
||||||
void CheckAndFinalizeConfigs()
|
void CheckAndFinalizeConfigs()
|
||||||
{
|
{
|
||||||
if ((g_bServerExecd || g_ServerCfgFile == NULL)
|
if ((g_bServerExecd || g_ServerCfgFile == NULL) && g_bGotServerStart)
|
||||||
&& g_bGotServerStart)
|
|
||||||
{
|
{
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
g_PendingInternalPush = true;
|
g_PendingInternalPush = true;
|
||||||
#else
|
#else
|
||||||
SM_InternalCmdTrigger();
|
SM_InternalCmdTrigger();
|
||||||
@@ -119,6 +119,14 @@ void CoreConfig::OnSourceModAllInitialized()
|
|||||||
g_pOnAutoConfigsBuffered = g_Forwards.CreateForward("OnAutoConfigsBuffered", ET_Ignore, 0, NULL);
|
g_pOnAutoConfigsBuffered = g_Forwards.CreateForward("OnAutoConfigsBuffered", ET_Ignore, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CoreConfig::CoreConfig() : m_Strings(512)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CoreConfig::~CoreConfig()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void CoreConfig::OnSourceModShutdown()
|
void CoreConfig::OnSourceModShutdown()
|
||||||
{
|
{
|
||||||
g_RootMenu.RemoveRootConsoleCommand("config", this);
|
g_RootMenu.RemoveRootConsoleCommand("config", this);
|
||||||
@@ -151,17 +159,7 @@ void CoreConfig::OnSourceModLevelChange(const char *mapName)
|
|||||||
|
|
||||||
if (g_ServerCfgFile != NULL)
|
if (g_ServerCfgFile != NULL)
|
||||||
{
|
{
|
||||||
ConCommandBase *pBase = icvar->GetCommands();
|
g_pExecPtr = FindCommand("exec");
|
||||||
while (pBase != NULL)
|
|
||||||
{
|
|
||||||
if (pBase->IsCommand() && strcmp(pBase->GetName(), "exec") == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
|
|
||||||
}
|
|
||||||
|
|
||||||
g_pExecPtr = (ConCommand *)pBase;
|
|
||||||
if (g_pExecPtr != NULL)
|
if (g_pExecPtr != NULL)
|
||||||
{
|
{
|
||||||
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, g_pExecPtr, Hook_ExecDispatchPre, false);
|
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, g_pExecPtr, Hook_ExecDispatchPre, false);
|
||||||
@@ -225,6 +223,10 @@ void CoreConfig::Initialize()
|
|||||||
/* Format path to config file */
|
/* Format path to config file */
|
||||||
g_LibSys.PathFormat(filePath, sizeof(filePath), "%s/%s", g_SourceMod.GetGamePath(), corecfg);
|
g_LibSys.PathFormat(filePath, sizeof(filePath), "%s/%s", g_SourceMod.GetGamePath(), corecfg);
|
||||||
|
|
||||||
|
/* Reset cached key values */
|
||||||
|
m_KeyValues.clear();
|
||||||
|
m_Strings.Reset();
|
||||||
|
|
||||||
/* Parse config file */
|
/* Parse config file */
|
||||||
if ((err=textparsers->ParseFile_SMC(filePath, this, NULL)) != SMCError_Okay)
|
if ((err=textparsers->ParseFile_SMC(filePath, this, NULL)) != SMCError_Okay)
|
||||||
{
|
{
|
||||||
@@ -263,9 +265,21 @@ ConfigResult CoreConfig::SetConfigOption(const char *option, const char *value,
|
|||||||
pBase = pBase->m_pGlobalClassNext;
|
pBase = pBase->m_pGlobalClassNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_KeyValues.replace(option, m_Strings.AddString(value));
|
||||||
|
|
||||||
return ConfigResult_Ignore;
|
return ConfigResult_Ignore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *CoreConfig::GetCoreConfigValue(const char *key)
|
||||||
|
{
|
||||||
|
int *pKey = m_KeyValues.retrieve(key);
|
||||||
|
if (pKey == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return m_Strings.GetString(*pKey);
|
||||||
|
}
|
||||||
|
|
||||||
bool SM_AreConfigsExecuted()
|
bool SM_AreConfigsExecuted()
|
||||||
{
|
{
|
||||||
return g_bConfigsExecd;
|
return g_bConfigsExecd;
|
||||||
@@ -367,7 +381,7 @@ bool SM_ExecuteConfig(CPlugin *pl, AutoConfig *cfg, bool can_create)
|
|||||||
FILE *fp = fopen(file, "wt");
|
FILE *fp = fopen(file, "wt");
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
fprintf(fp, "// This file was auto-generated by SourceMod (v%s)\n", SVN_FULL_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, "// ConVars for plugin \"%s\"\n", pl->GetFilename());
|
||||||
fprintf(fp, "\n\n");
|
fprintf(fp, "\n\n");
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@
|
|||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include <ITextParsers.h>
|
#include <ITextParsers.h>
|
||||||
#include <IRootConsoleMenu.h>
|
#include <IRootConsoleMenu.h>
|
||||||
|
#include <sm_trie_tpl.h>
|
||||||
|
#include "sm_memtable.h"
|
||||||
|
|
||||||
using namespace SourceMod;
|
using namespace SourceMod;
|
||||||
|
|
||||||
@@ -43,6 +45,9 @@ class CoreConfig :
|
|||||||
public ITextListener_SMC,
|
public ITextListener_SMC,
|
||||||
public IRootConsoleCommand
|
public IRootConsoleCommand
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
CoreConfig();
|
||||||
|
~CoreConfig();
|
||||||
public: // SMGlobalClass
|
public: // SMGlobalClass
|
||||||
void OnSourceModAllInitialized();
|
void OnSourceModAllInitialized();
|
||||||
void OnSourceModShutdown();
|
void OnSourceModShutdown();
|
||||||
@@ -56,11 +61,15 @@ public:
|
|||||||
* Initializes CoreConfig by reading from core.cfg file
|
* Initializes CoreConfig by reading from core.cfg file
|
||||||
*/
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
const char *GetCoreConfigValue(const char *key);
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Sets configuration option by notifying SourceMod components that rely on core.cfg
|
* Sets configuration option by notifying SourceMod components that rely on core.cfg
|
||||||
*/
|
*/
|
||||||
ConfigResult SetConfigOption(const char *option, const char *value, ConfigSource, char *Error, size_t maxlength);
|
ConfigResult SetConfigOption(const char *option, const char *value, ConfigSource, char *Error, size_t maxlength);
|
||||||
|
private:
|
||||||
|
BaseStringTable m_Strings;
|
||||||
|
KTrie<int> m_KeyValues;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern bool SM_AreConfigsExecuted();
|
extern bool SM_AreConfigsExecuted();
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunct
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Cache the name for post hooks */
|
/* Cache the name for post hooks */
|
||||||
pHook->name = strdup(name);
|
pHook->name = sm_strdup(name);
|
||||||
|
|
||||||
/* Increase reference count */
|
/* Increase reference count */
|
||||||
pHook->refCount++;
|
pHook->refCount++;
|
||||||
@@ -300,7 +300,7 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun
|
|||||||
sm_trie_delete(m_EventHooks, name);
|
sm_trie_delete(m_EventHooks, name);
|
||||||
|
|
||||||
/* Free the cached name */
|
/* Free the cached name */
|
||||||
free(pHook->name);
|
delete pHook->name;
|
||||||
|
|
||||||
/* And finally free structure memory */
|
/* And finally free structure memory */
|
||||||
delete pHook;
|
delete pHook;
|
||||||
@@ -472,7 +472,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
|||||||
assert(pHook->pPostHook == NULL);
|
assert(pHook->pPostHook == NULL);
|
||||||
assert(pHook->pPreHook == NULL);
|
assert(pHook->pPreHook == NULL);
|
||||||
sm_trie_delete(m_EventHooks, pHook->name);
|
sm_trie_delete(m_EventHooks, pHook->name);
|
||||||
free(pHook->name);
|
delete pHook->name;
|
||||||
delete pHook;
|
delete pHook;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+167
-31
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* vim: set ts=4 :
|
* vim: set ts=4 sw=4 tw=99 noet :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
@@ -49,6 +49,9 @@ void CExtension::Initialize(const char *filename, const char *path)
|
|||||||
m_bFullyLoaded = false;
|
m_bFullyLoaded = false;
|
||||||
m_File.assign(filename);
|
m_File.assign(filename);
|
||||||
m_Path.assign(path);
|
m_Path.assign(path);
|
||||||
|
char real_name[PLATFORM_MAX_PATH];
|
||||||
|
g_LibSys.GetFileFromPath(real_name, sizeof(real_name), m_Path.c_str());
|
||||||
|
m_RealFile.assign(real_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filename, const char *path)
|
CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filename, const char *path)
|
||||||
@@ -57,6 +60,22 @@ CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filena
|
|||||||
m_pAPI = pAPI;
|
m_pAPI = pAPI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
#define GAMEFIX "2.l4d"
|
||||||
|
#elif SOURCE_ENGINE == SE_ORANGEBOX
|
||||||
|
#define GAMEFIX "2.ep2"
|
||||||
|
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
||||||
|
#define GAMEFIX "2.ep2v"
|
||||||
|
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||||
|
#define GAMEFIX "2.darkm"
|
||||||
|
#else
|
||||||
|
#define GAMEFIX "2.ep1"
|
||||||
|
#endif //SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
#else //METAMOD_PLAPI_VERSION
|
||||||
|
#define GAMEFIX "1.ep1"
|
||||||
|
#endif //METAMOD_PLAPI_VERSION
|
||||||
|
|
||||||
CLocalExtension::CLocalExtension(const char *filename)
|
CLocalExtension::CLocalExtension(const char *filename)
|
||||||
{
|
{
|
||||||
m_PlId = 0;
|
m_PlId = 0;
|
||||||
@@ -64,27 +83,36 @@ CLocalExtension::CLocalExtension(const char *filename)
|
|||||||
|
|
||||||
char path[PLATFORM_MAX_PATH];
|
char path[PLATFORM_MAX_PATH];
|
||||||
|
|
||||||
|
/* Zeroth, see if there is an engine specific build in the new place. */
|
||||||
|
g_SourceMod.BuildPath(Path_SM,
|
||||||
|
path,
|
||||||
|
PLATFORM_MAX_PATH,
|
||||||
|
"extensions/%s." GAMEFIX "." PLATFORM_LIB_EXT,
|
||||||
|
filename);
|
||||||
|
|
||||||
|
if (g_LibSys.IsPathFile(path))
|
||||||
|
{
|
||||||
|
goto found;
|
||||||
|
}
|
||||||
|
|
||||||
/* First see if there is an engine specific build! */
|
/* First see if there is an engine specific build! */
|
||||||
g_SourceMod.BuildPath(Path_SM,
|
g_SourceMod.BuildPath(Path_SM,
|
||||||
path,
|
path,
|
||||||
PLATFORM_MAX_PATH,
|
PLATFORM_MAX_PATH,
|
||||||
#if defined METAMOD_PLAPI_VERSION
|
"extensions/auto." GAMEFIX "/%s." PLATFORM_LIB_EXT,
|
||||||
#if defined ORANGEBOX_BUILD
|
|
||||||
"extensions/auto.2.ep2/%s",
|
|
||||||
#else
|
|
||||||
"extensions/auto.2.ep1/%s",
|
|
||||||
#endif //ORANGEBOX_BUILD
|
|
||||||
#else //METAMOD_PLAPI_VERSION
|
|
||||||
"extensions/auto.1.ep1/%s",
|
|
||||||
#endif //METAMOD_PLAPI_VERSION
|
|
||||||
filename);
|
filename);
|
||||||
|
|
||||||
/* Try the "normal" version */
|
/* Try the "normal" version */
|
||||||
if (!g_LibSys.IsPathFile(path))
|
if (!g_LibSys.IsPathFile(path))
|
||||||
{
|
{
|
||||||
g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "extensions/%s", filename);
|
g_SourceMod.BuildPath(Path_SM,
|
||||||
|
path,
|
||||||
|
PLATFORM_MAX_PATH,
|
||||||
|
"extensions/%s." PLATFORM_LIB_EXT,
|
||||||
|
filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
found:
|
||||||
Initialize(filename, path);
|
Initialize(filename, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,6 +211,23 @@ void CLocalExtension::Unload()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CRemoteExtension::Reload(char *error, size_t maxlength)
|
||||||
|
{
|
||||||
|
snprintf(error, maxlength, "Remote extensions do not support reloading");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CLocalExtension::Reload(char *error, size_t maxlength)
|
||||||
|
{
|
||||||
|
if (m_pLib == NULL) // FIXME: just load it instead?
|
||||||
|
return false;
|
||||||
|
|
||||||
|
m_pAPI->OnExtensionUnload();
|
||||||
|
Unload();
|
||||||
|
|
||||||
|
return Load(error, maxlength);
|
||||||
|
}
|
||||||
|
|
||||||
bool CRemoteExtension::IsExternal()
|
bool CRemoteExtension::IsExternal()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -287,7 +332,7 @@ IExtensionInterface *CExtension::GetAPI()
|
|||||||
|
|
||||||
const char *CExtension::GetFilename()
|
const char *CExtension::GetFilename()
|
||||||
{
|
{
|
||||||
return m_File.c_str();
|
return m_RealFile.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
IdentityToken_t *CExtension::GetIdentity()
|
IdentityToken_t *CExtension::GetIdentity()
|
||||||
@@ -490,7 +535,7 @@ void CExtensionManager::TryAutoload()
|
|||||||
|
|
||||||
char file[PLATFORM_MAX_PATH];
|
char file[PLATFORM_MAX_PATH];
|
||||||
len = UTIL_Format(file, sizeof(file), "%s", lfile);
|
len = UTIL_Format(file, sizeof(file), "%s", lfile);
|
||||||
strcpy(&file[len - 9], ".ext." PLATFORM_LIB_EXT);
|
strcpy(&file[len - 9], ".ext");
|
||||||
|
|
||||||
LoadAutoExtension(file);
|
LoadAutoExtension(file);
|
||||||
|
|
||||||
@@ -500,11 +545,14 @@ void CExtensionManager::TryAutoload()
|
|||||||
|
|
||||||
IExtension *CExtensionManager::LoadAutoExtension(const char *path)
|
IExtension *CExtensionManager::LoadAutoExtension(const char *path)
|
||||||
{
|
{
|
||||||
if (!strstr(path, "." PLATFORM_LIB_EXT))
|
/* Remove platform extension if it's there. Compat hack. */
|
||||||
|
const char *ext = g_LibSys.GetFileExtension(path);
|
||||||
|
if (strcmp(ext, PLATFORM_LIB_EXT) == 0)
|
||||||
{
|
{
|
||||||
char newpath[PLATFORM_MAX_PATH];
|
char path2[PLATFORM_MAX_PATH];
|
||||||
g_LibSys.PathFormat(newpath, sizeof(newpath), "%s.%s", path, PLATFORM_LIB_EXT);
|
UTIL_Format(path2, sizeof(path2), "%s", path);
|
||||||
return LoadAutoExtension(newpath);
|
path2[strlen(path) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
|
||||||
|
return LoadAutoExtension(path2);
|
||||||
}
|
}
|
||||||
|
|
||||||
IExtension *pAlready;
|
IExtension *pAlready;
|
||||||
@@ -542,24 +590,12 @@ IExtension *CExtensionManager::FindExtensionByFile(const char *file)
|
|||||||
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
|
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
|
||||||
{
|
{
|
||||||
pExt = (*iter);
|
pExt = (*iter);
|
||||||
char short_file[PLATFORM_MAX_PATH];
|
if (pExt->IsSameFile(lookup))
|
||||||
g_LibSys.GetFileFromPath(short_file, sizeof(short_file), pExt->GetFilename());
|
|
||||||
if (strcmp(lookup, short_file) == 0)
|
|
||||||
{
|
{
|
||||||
return pExt;
|
return pExt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we got no results, test if there was a platform extension.
|
|
||||||
* If not, add one.
|
|
||||||
*/
|
|
||||||
if (!strstr(file, "." PLATFORM_LIB_EXT))
|
|
||||||
{
|
|
||||||
char path[PLATFORM_MAX_PATH];
|
|
||||||
UTIL_Format(path, sizeof(path), "%s.%s", file, PLATFORM_LIB_EXT);
|
|
||||||
return FindExtensionByFile(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -597,6 +633,16 @@ IExtension *CExtensionManager::FindExtensionByName(const char *ext)
|
|||||||
|
|
||||||
IExtension *CExtensionManager::LoadExtension(const char *file, char *error, size_t maxlength)
|
IExtension *CExtensionManager::LoadExtension(const char *file, char *error, size_t maxlength)
|
||||||
{
|
{
|
||||||
|
/* Remove platform extension if it's there. Compat hack. */
|
||||||
|
const char *ext = g_LibSys.GetFileExtension(file);
|
||||||
|
if (strcmp(ext, PLATFORM_LIB_EXT) == 0)
|
||||||
|
{
|
||||||
|
char path2[PLATFORM_MAX_PATH];
|
||||||
|
UTIL_Format(path2, sizeof(path2), "%s", file);
|
||||||
|
path2[strlen(file) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
|
||||||
|
return LoadExtension(path2, error, maxlength);
|
||||||
|
}
|
||||||
|
|
||||||
IExtension *pAlready;
|
IExtension *pAlready;
|
||||||
if ((pAlready=FindExtensionByFile(file)) != NULL)
|
if ((pAlready=FindExtensionByFile(file)) != NULL)
|
||||||
{
|
{
|
||||||
@@ -905,6 +951,37 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(cmd, "load") == 0)
|
||||||
|
{
|
||||||
|
if (argcount < 4)
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Usage: sm exts load <file>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *filename = command.Arg(3);
|
||||||
|
char path[PLATFORM_MAX_PATH];
|
||||||
|
char error[256];
|
||||||
|
|
||||||
|
UTIL_Format(path, sizeof(path), "%s%s%s", filename, !strstr(filename, ".ext") ? ".ext" : "",
|
||||||
|
!strstr(filename, "." PLATFORM_LIB_EXT) ? "." PLATFORM_LIB_EXT : "");
|
||||||
|
|
||||||
|
if (FindExtensionByFile(path) != NULL)
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Extension %s is already loaded.", path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LoadExtension(path, error, sizeof(error)))
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Loaded extension %s successfully.", path);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Extension %s failed to load: %s", path, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if (strcmp(cmd, "info") == 0)
|
else if (strcmp(cmd, "info") == 0)
|
||||||
{
|
{
|
||||||
if (argcount < 4)
|
if (argcount < 4)
|
||||||
@@ -1107,11 +1184,57 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (strcmp(cmd, "reload") == 0)
|
||||||
|
{
|
||||||
|
if (argcount < 4)
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Usage: sm exts reload <#>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *arg = command.Arg(3);
|
||||||
|
unsigned int num = atoi(arg);
|
||||||
|
CExtension *pExt = FindByOrder(num);
|
||||||
|
|
||||||
|
if (!pExt)
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Extension number %d was not found.", num);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pExt->IsLoaded())
|
||||||
|
{
|
||||||
|
char filename[PLATFORM_MAX_PATH];
|
||||||
|
char error[255];
|
||||||
|
|
||||||
|
snprintf(filename, PLATFORM_MAX_PATH, "%s", pExt->GetFilename());
|
||||||
|
|
||||||
|
if (pExt->Reload(error, sizeof(error)))
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Extension %s is now reloaded.", filename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Extension %s failed to reload: %s", filename, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Extension %s is not loaded.", pExt->GetFilename());
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_RootMenu.ConsolePrint("SourceMod Extensions Menu:");
|
g_RootMenu.ConsolePrint("SourceMod Extensions Menu:");
|
||||||
g_RootMenu.DrawGenericOption("info", "Extra extension information");
|
g_RootMenu.DrawGenericOption("info", "Extra extension information");
|
||||||
g_RootMenu.DrawGenericOption("list", "List extensions");
|
g_RootMenu.DrawGenericOption("list", "List extensions");
|
||||||
|
g_RootMenu.DrawGenericOption("load", "Load an extension");
|
||||||
|
g_RootMenu.DrawGenericOption("reload", "Reload an extension");
|
||||||
g_RootMenu.DrawGenericOption("unload", "Unload an extension");
|
g_RootMenu.DrawGenericOption("unload", "Unload an extension");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1206,3 +1329,16 @@ void CExtensionManager::CallOnCoreMapStart(edict_t *pEdictList, int edictCount,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CLocalExtension::IsSameFile(const char *file)
|
||||||
|
{
|
||||||
|
/* Only care about the shortened name. */
|
||||||
|
return strcmp(file, m_File.c_str()) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRemoteExtension::IsSameFile(const char *file)
|
||||||
|
{
|
||||||
|
/* :TODO: this could be better, but no one uses this API anyway. */
|
||||||
|
return strcmp(file, m_Path.c_str()) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ public:
|
|||||||
virtual bool Load(char *error, size_t maxlength);
|
virtual bool Load(char *error, size_t maxlength);
|
||||||
virtual bool IsLoaded() =0;
|
virtual bool IsLoaded() =0;
|
||||||
virtual void Unload() =0;
|
virtual void Unload() =0;
|
||||||
|
virtual bool Reload(char *error, size_t maxlength) =0;
|
||||||
|
virtual bool IsSameFile(const char* file) =0;
|
||||||
protected:
|
protected:
|
||||||
void Initialize(const char *filename, const char *path);
|
void Initialize(const char *filename, const char *path);
|
||||||
bool PerformAPICheck(char *error, size_t maxlength);
|
bool PerformAPICheck(char *error, size_t maxlength);
|
||||||
@@ -92,6 +94,7 @@ protected:
|
|||||||
IdentityToken_t *m_pIdentToken;
|
IdentityToken_t *m_pIdentToken;
|
||||||
IExtensionInterface *m_pAPI;
|
IExtensionInterface *m_pAPI;
|
||||||
String m_File;
|
String m_File;
|
||||||
|
String m_RealFile;
|
||||||
String m_Path;
|
String m_Path;
|
||||||
String m_Error;
|
String m_Error;
|
||||||
List<IfaceInfo> m_Deps; /** Dependencies */
|
List<IfaceInfo> m_Deps; /** Dependencies */
|
||||||
@@ -110,7 +113,9 @@ public:
|
|||||||
bool Load(char *error, size_t maxlength);
|
bool Load(char *error, size_t maxlength);
|
||||||
bool IsLoaded();
|
bool IsLoaded();
|
||||||
void Unload();
|
void Unload();
|
||||||
|
bool Reload(char *error, size_t maxlength);
|
||||||
bool IsExternal();
|
bool IsExternal();
|
||||||
|
bool IsSameFile(const char *file);
|
||||||
private:
|
private:
|
||||||
PluginId m_PlId;
|
PluginId m_PlId;
|
||||||
ILibrary *m_pLib;
|
ILibrary *m_pLib;
|
||||||
@@ -124,7 +129,9 @@ public:
|
|||||||
bool Load(char *error, size_t maxlength);
|
bool Load(char *error, size_t maxlength);
|
||||||
bool IsLoaded();
|
bool IsLoaded();
|
||||||
void Unload();
|
void Unload();
|
||||||
|
bool Reload(char *error, size_t maxlength);
|
||||||
bool IsExternal();
|
bool IsExternal();
|
||||||
|
bool IsSameFile(const char *file);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CExtensionManager :
|
class CExtensionManager :
|
||||||
|
|||||||
+306
-42
@@ -42,7 +42,6 @@
|
|||||||
#include "LibrarySys.h"
|
#include "LibrarySys.h"
|
||||||
#include "HandleSys.h"
|
#include "HandleSys.h"
|
||||||
#include "sm_crc32.h"
|
#include "sm_crc32.h"
|
||||||
#include "GameDataFetcher.h"
|
|
||||||
|
|
||||||
#if defined PLATFORM_LINUX
|
#if defined PLATFORM_LINUX
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
@@ -50,9 +49,9 @@
|
|||||||
|
|
||||||
GameConfigManager g_GameConfigs;
|
GameConfigManager g_GameConfigs;
|
||||||
IGameConfig *g_pGameConf = NULL;
|
IGameConfig *g_pGameConf = NULL;
|
||||||
char g_Game[256];
|
static char g_Game[256];
|
||||||
char g_GameDesc[256] = {'!', '\0'};
|
static char g_GameDesc[256] = {'!', '\0'};
|
||||||
char g_GameName[256] = {'$', '\0'};
|
static char g_GameName[256] = {'$', '\0'};
|
||||||
|
|
||||||
#define PSTATE_NONE 0
|
#define PSTATE_NONE 0
|
||||||
#define PSTATE_GAMES 1
|
#define PSTATE_GAMES 1
|
||||||
@@ -91,9 +90,41 @@ struct TempSigInfo
|
|||||||
unsigned int s_ServerBinCRC;
|
unsigned int s_ServerBinCRC;
|
||||||
bool s_ServerBinCRC_Ok = false;
|
bool s_ServerBinCRC_Ok = false;
|
||||||
|
|
||||||
|
static bool DoesGameMatch(const char *value)
|
||||||
|
{
|
||||||
|
if (strcmp(value, g_Game) == 0 ||
|
||||||
|
strcmp(value, g_GameDesc) == 0 ||
|
||||||
|
strcmp(value, g_GameName) == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool DoesEngineMatch(const char *value)
|
||||||
|
{
|
||||||
|
#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)
|
||||||
|
#else
|
||||||
|
#error "Unknown engine type"
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
CGameConfig::CGameConfig(const char *file)
|
CGameConfig::CGameConfig(const char *file)
|
||||||
{
|
{
|
||||||
m_pFile = sm_strdup(file);
|
strncopy(m_File, file, sizeof(m_File));
|
||||||
m_pOffsets = sm_trie_create();
|
m_pOffsets = sm_trie_create();
|
||||||
m_pProps = sm_trie_create();
|
m_pProps = sm_trie_create();
|
||||||
m_pKeys = sm_trie_create();
|
m_pKeys = sm_trie_create();
|
||||||
@@ -111,7 +142,6 @@ CGameConfig::~CGameConfig()
|
|||||||
sm_trie_destroy(m_pProps);
|
sm_trie_destroy(m_pProps);
|
||||||
sm_trie_destroy(m_pKeys);
|
sm_trie_destroy(m_pKeys);
|
||||||
sm_trie_destroy(m_pSigs);
|
sm_trie_destroy(m_pSigs);
|
||||||
delete [] m_pFile;
|
|
||||||
delete m_pStrings;
|
delete m_pStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,11 +167,9 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
|||||||
}
|
}
|
||||||
case PSTATE_GAMES:
|
case PSTATE_GAMES:
|
||||||
{
|
{
|
||||||
if ((strcmp(name, "*") == 0)
|
if (strcmp(name, "*") == 0 ||
|
||||||
|| (strcmp(name, "#default") == 0)
|
strcmp(name, "#default") == 0 ||
|
||||||
|| (strcasecmp(name, g_Game) == 0)
|
DoesGameMatch(name))
|
||||||
|| (strcasecmp(name, g_GameDesc) == 0)
|
|
||||||
|| (strcasecmp(name, g_GameName) == 0))
|
|
||||||
{
|
{
|
||||||
bShouldBeReadingDefault = true;
|
bShouldBeReadingDefault = true;
|
||||||
m_ParseState = PSTATE_GAMEDEFS;
|
m_ParseState = PSTATE_GAMEDEFS;
|
||||||
@@ -161,12 +189,15 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
|||||||
{
|
{
|
||||||
m_ParseState = PSTATE_GAMEDEFS_KEYS;
|
m_ParseState = PSTATE_GAMEDEFS_KEYS;
|
||||||
}
|
}
|
||||||
else if ((strcmp(name, "#supported") == 0)
|
else if ((strcmp(name, "#supported") == 0) && (strcmp(m_Game, "#default") == 0))
|
||||||
&& (strcmp(m_Game, "#default") == 0))
|
|
||||||
{
|
{
|
||||||
m_ParseState = PSTATE_GAMEDEFS_SUPPORTED;
|
m_ParseState = PSTATE_GAMEDEFS_SUPPORTED;
|
||||||
/* Ignore this section unless we get a game. */
|
/* Ignore this section unless we get a game. */
|
||||||
bShouldBeReadingDefault = false;
|
bShouldBeReadingDefault = false;
|
||||||
|
had_game = false;
|
||||||
|
matched_game = false;
|
||||||
|
had_engine = false;
|
||||||
|
matched_engine = false;
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "Signatures") == 0)
|
else if (strcmp(name, "Signatures") == 0)
|
||||||
{
|
{
|
||||||
@@ -245,7 +276,7 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
|||||||
if (error[0] != '\0')
|
if (error[0] != '\0')
|
||||||
{
|
{
|
||||||
m_IgnoreLevel = 1;
|
m_IgnoreLevel = 1;
|
||||||
g_Logger.LogError("[SM] Error while parsing CRC section for \"%s\" (%s):", m_Game, m_pFile);
|
g_Logger.LogError("[SM] Error while parsing CRC section for \"%s\" (%s):", m_Game, m_CurFile);
|
||||||
g_Logger.LogError("[SM] %s", error);
|
g_Logger.LogError("[SM] %s", error);
|
||||||
} else {
|
} else {
|
||||||
m_ParseState = PSTATE_GAMEDEFS_CRC_BINARY;
|
m_ParseState = PSTATE_GAMEDEFS_CRC_BINARY;
|
||||||
@@ -298,13 +329,29 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
|
|||||||
int id = m_pStrings->AddString(value);
|
int id = m_pStrings->AddString(value);
|
||||||
sm_trie_replace(m_pKeys, key, (void *)id);
|
sm_trie_replace(m_pKeys, key, (void *)id);
|
||||||
} else if (m_ParseState == PSTATE_GAMEDEFS_SUPPORTED) {
|
} else if (m_ParseState == PSTATE_GAMEDEFS_SUPPORTED) {
|
||||||
if (strcmp(key, "game") == 0
|
if (strcmp(key, "game") == 0)
|
||||||
&& (strcasecmp(value, g_Game) == 0
|
|
||||||
|| strcasecmp(value, g_GameDesc) == 0
|
|
||||||
|| strcasecmp(value, g_GameName) == 0)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
bShouldBeReadingDefault = true;
|
had_game = true;
|
||||||
|
if (DoesGameMatch(value))
|
||||||
|
{
|
||||||
|
matched_game = true;
|
||||||
|
}
|
||||||
|
if ((!had_engine && matched_game) || (matched_engine && matched_game))
|
||||||
|
{
|
||||||
|
bShouldBeReadingDefault = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "engine") == 0)
|
||||||
|
{
|
||||||
|
had_engine = true;
|
||||||
|
if (DoesEngineMatch(value))
|
||||||
|
{
|
||||||
|
matched_engine = true;
|
||||||
|
}
|
||||||
|
if ((!had_game && matched_engine) || (matched_game && matched_engine))
|
||||||
|
{
|
||||||
|
bShouldBeReadingDefault = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (m_ParseState == PSTATE_GAMEDEFS_SIGNATURES_SIG) {
|
} else if (m_ParseState == PSTATE_GAMEDEFS_SIGNATURES_SIG) {
|
||||||
if (strcmp(key, PLATFORM_NAME) == 0)
|
if (strcmp(key, PLATFORM_NAME) == 0)
|
||||||
@@ -391,7 +438,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
g_Logger.LogError("[SM] Unable to find property %s.%s (file \"%s\") (mod \"%s\")",
|
g_Logger.LogError("[SM] Unable to find property %s.%s (file \"%s\") (mod \"%s\")",
|
||||||
m_Class,
|
m_Class,
|
||||||
m_Prop,
|
m_Prop,
|
||||||
m_pFile,
|
m_CurFile,
|
||||||
m_Game);
|
m_Game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -441,7 +488,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
{
|
{
|
||||||
g_Logger.LogError("[SM] Unrecognized library \"%s\" (gameconf \"%s\")",
|
g_Logger.LogError("[SM] Unrecognized library \"%s\" (gameconf \"%s\")",
|
||||||
s_TempSig.library,
|
s_TempSig.library,
|
||||||
m_pFile);
|
m_CurFile);
|
||||||
} else {
|
} else {
|
||||||
#if defined PLATFORM_LINUX
|
#if defined PLATFORM_LINUX
|
||||||
if (s_TempSig.sig[0] == '@')
|
if (s_TempSig.sig[0] == '@')
|
||||||
@@ -458,12 +505,12 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
} else {
|
} else {
|
||||||
g_Logger.LogError("[SM] Unable to load library \"%s\" (gameconf \"%s\")",
|
g_Logger.LogError("[SM] Unable to load library \"%s\" (gameconf \"%s\")",
|
||||||
s_TempSig.library,
|
s_TempSig.library,
|
||||||
m_pFile);
|
m_File);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
g_Logger.LogError("[SM] Unable to find library \"%s\" in memory (gameconf \"%s\")",
|
g_Logger.LogError("[SM] Unable to find library \"%s\" in memory (gameconf \"%s\")",
|
||||||
s_TempSig.library,
|
s_TempSig.library,
|
||||||
m_pFile);
|
m_File);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (final_addr)
|
if (final_addr)
|
||||||
@@ -527,37 +574,244 @@ skip_find:
|
|||||||
return SMCResult_Continue;
|
return SMCResult_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameConfig::Reparse(char *error, size_t maxlength)
|
#define MSTATE_NONE 0
|
||||||
{
|
#define MSTATE_MAIN 1
|
||||||
SMCError err;
|
#define MSTATE_FILE 2
|
||||||
SMCStates state = {0, 0};
|
|
||||||
|
|
||||||
char path[PLATFORM_MAX_PATH];
|
class MasterReader : public ITextListener_SMC
|
||||||
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "gamedata/%s.txt", m_pFile);
|
{
|
||||||
/* Backwards compatibility */
|
public:
|
||||||
if (!g_LibSys.PathExists(path))
|
virtual void ReadSMC_ParseStart()
|
||||||
{
|
{
|
||||||
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "configs/gamedata/%s.txt", m_pFile);
|
state = MSTATE_NONE;
|
||||||
|
ignoreLevel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize parse states */
|
virtual SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name)
|
||||||
m_IgnoreLevel = 0;
|
{
|
||||||
bShouldBeReadingDefault = true;
|
if (ignoreLevel)
|
||||||
m_ParseState = PSTATE_NONE;
|
{
|
||||||
|
return SMCResult_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == MSTATE_NONE)
|
||||||
|
{
|
||||||
|
if (strcmp(name, "Game Master") == 0)
|
||||||
|
{
|
||||||
|
state = MSTATE_MAIN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ignoreLevel++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (state == MSTATE_MAIN)
|
||||||
|
{
|
||||||
|
strncopy(cur_file, name, sizeof(cur_file));
|
||||||
|
had_engine = false;
|
||||||
|
matched_engine = false;
|
||||||
|
had_game = false;
|
||||||
|
matched_game = false;
|
||||||
|
state = MSTATE_FILE;
|
||||||
|
}
|
||||||
|
else if (state == MSTATE_FILE)
|
||||||
|
{
|
||||||
|
ignoreLevel++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SMCResult_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value)
|
||||||
|
{
|
||||||
|
if (ignoreLevel || state != MSTATE_FILE)
|
||||||
|
{
|
||||||
|
return SMCResult_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(key, "engine") == 0)
|
||||||
|
{
|
||||||
|
had_engine = true;
|
||||||
|
if (DoesEngineMatch(value))
|
||||||
|
{
|
||||||
|
matched_engine = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "game") == 0)
|
||||||
|
{
|
||||||
|
had_game = true;
|
||||||
|
if (DoesGameMatch(value))
|
||||||
|
{
|
||||||
|
matched_game = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return SMCResult_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual SMCResult ReadSMC_LeavingSection(const SMCStates *states)
|
||||||
|
{
|
||||||
|
if (ignoreLevel)
|
||||||
|
{
|
||||||
|
ignoreLevel--;
|
||||||
|
return SMCResult_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == MSTATE_FILE)
|
||||||
|
{
|
||||||
|
/* The four success conditions:
|
||||||
|
* 1. Needed nothing.
|
||||||
|
* 2. Needed game only.
|
||||||
|
* 3. Needed engine only.
|
||||||
|
* 4. Needed both engine and game.
|
||||||
|
* Final result is minimized via k-map.
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
if ((!had_engine && !had_game) ||
|
||||||
|
(!had_engine && (had_game && matched_game)) ||
|
||||||
|
(!had_game && (had_engine && matched_engine)) ||
|
||||||
|
((had_game && had_engine) && (matched_game && matched_engine)))
|
||||||
|
#endif
|
||||||
|
if ((!had_engine && !had_game) ||
|
||||||
|
(!had_engine && matched_game) ||
|
||||||
|
(!had_game && matched_engine) ||
|
||||||
|
(matched_engine && matched_game))
|
||||||
|
{
|
||||||
|
fileList->push_back(cur_file);
|
||||||
|
}
|
||||||
|
state = MSTATE_MAIN;
|
||||||
|
}
|
||||||
|
else if (state == MSTATE_MAIN)
|
||||||
|
{
|
||||||
|
state = MSTATE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SMCResult_Continue;
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
List<String> *fileList;
|
||||||
|
unsigned int state;
|
||||||
|
unsigned int ignoreLevel;
|
||||||
|
char cur_file[PLATFORM_MAX_PATH];
|
||||||
|
bool had_engine;
|
||||||
|
bool matched_engine;
|
||||||
|
bool had_game;
|
||||||
|
bool matched_game;
|
||||||
|
};
|
||||||
|
|
||||||
|
static MasterReader master_reader;
|
||||||
|
|
||||||
|
bool CGameConfig::Reparse(char *error, size_t maxlength)
|
||||||
|
{
|
||||||
/* Reset cached data */
|
/* Reset cached data */
|
||||||
m_pStrings->Reset();
|
m_pStrings->Reset();
|
||||||
sm_trie_clear(m_pOffsets);
|
sm_trie_clear(m_pOffsets);
|
||||||
sm_trie_clear(m_pProps);
|
sm_trie_clear(m_pProps);
|
||||||
sm_trie_clear(m_pKeys);
|
sm_trie_clear(m_pKeys);
|
||||||
|
|
||||||
if ((err=textparsers->ParseSMCFile(path, this, &state, error, maxlength))
|
char path[PLATFORM_MAX_PATH];
|
||||||
|
|
||||||
|
/* See if we can use the extended gamedata format. */
|
||||||
|
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<String> fileList;
|
||||||
|
master_reader.fileList = &fileList;
|
||||||
|
|
||||||
|
err = textparsers->ParseSMCFile(path, &master_reader, &state, error, maxlength);
|
||||||
|
if (err != SMCError_Okay)
|
||||||
|
{
|
||||||
|
const char *msg = textparsers->GetSMCErrorString(err);
|
||||||
|
|
||||||
|
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");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Go through each file we found and parse it. */
|
||||||
|
List<String>::iterator iter;
|
||||||
|
for (iter = fileList.begin(); iter != fileList.end(); 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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(m_CurFile, this, &state, error, maxlength))
|
||||||
!= SMCError_Okay)
|
!= SMCError_Okay)
|
||||||
{
|
{
|
||||||
const char *msg;
|
const char *msg;
|
||||||
|
|
||||||
msg = textparsers->GetSMCErrorString(err);
|
msg = textparsers->GetSMCErrorString(err);
|
||||||
|
|
||||||
g_Logger.LogError("[SM] Error parsing gameconfig file \"%s\":", path);
|
g_Logger.LogError("[SM] Error parsing gameconfig file \"%s\":", m_CurFile);
|
||||||
g_Logger.LogError("[SM] Error %d on line %d, col %d: %s",
|
g_Logger.LogError("[SM] Error %d on line %d, col %d: %s",
|
||||||
err,
|
err,
|
||||||
state.line,
|
state.line,
|
||||||
@@ -680,12 +934,14 @@ void GameConfigManager::OnSourceModAllShutdown()
|
|||||||
|
|
||||||
bool GameConfigManager::LoadGameConfigFile(const char *file, IGameConfig **_pConfig, char *error, size_t maxlength)
|
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 */
|
/* A crash was detected during last load - We block the gamedata loading so it hopefully won't happen again */
|
||||||
if (g_blockGameDataLoad)
|
if (g_blockGameDataLoad)
|
||||||
{
|
{
|
||||||
UTIL_Format(error, maxlength, "GameData loaded blocked due to detected crash");
|
UTIL_Format(error, maxlength, "GameData loaded blocked due to detected crash");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CGameConfig *pConfig;
|
CGameConfig *pConfig;
|
||||||
|
|
||||||
@@ -721,7 +977,7 @@ void GameConfigManager::CloseGameConfigFile(IGameConfig *cfg)
|
|||||||
|
|
||||||
if (pConfig->DecRefCount() == 0)
|
if (pConfig->DecRefCount() == 0)
|
||||||
{
|
{
|
||||||
sm_trie_delete(m_pLookup, pConfig->m_pFile);
|
sm_trie_delete(m_pLookup, pConfig->m_File);
|
||||||
delete pConfig;
|
delete pConfig;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -742,12 +998,12 @@ IGameConfig *GameConfigManager::ReadHandle(Handle_t hndl, IdentityToken_t *ident
|
|||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameConfigManager::AddUserConfigHook( const char *sectionname, ITextListener_SMC *listener )
|
void GameConfigManager::AddUserConfigHook(const char *sectionname, ITextListener_SMC *listener)
|
||||||
{
|
{
|
||||||
m_customHandlers.insert(sectionname, listener);
|
m_customHandlers.insert(sectionname, listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameConfigManager::RemoveUserConfigHook( const char *sectionname, ITextListener_SMC *listener )
|
void GameConfigManager::RemoveUserConfigHook(const char *sectionname, ITextListener_SMC *listener)
|
||||||
{
|
{
|
||||||
ITextListener_SMC **pListener = m_customHandlers.retrieve(sectionname);
|
ITextListener_SMC **pListener = m_customHandlers.retrieve(sectionname);
|
||||||
|
|
||||||
@@ -765,3 +1021,11 @@ void GameConfigManager::RemoveUserConfigHook( const char *sectionname, ITextList
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameConfigManager::AcquireLock()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameConfigManager::ReleaseLock()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|||||||
+10
-1
@@ -39,6 +39,7 @@
|
|||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "sm_memtable.h"
|
#include "sm_memtable.h"
|
||||||
#include "sm_trie_tpl.h"
|
#include "sm_trie_tpl.h"
|
||||||
|
#include "ThreadSupport.h"
|
||||||
|
|
||||||
using namespace SourceMod;
|
using namespace SourceMod;
|
||||||
using namespace SourceHook;
|
using namespace SourceHook;
|
||||||
@@ -55,6 +56,7 @@ public:
|
|||||||
~CGameConfig();
|
~CGameConfig();
|
||||||
public:
|
public:
|
||||||
bool Reparse(char *error, size_t maxlength);
|
bool Reparse(char *error, size_t maxlength);
|
||||||
|
bool EnterFile(const char *file, char *error, size_t maxlength);
|
||||||
public: //ITextListener_SMC
|
public: //ITextListener_SMC
|
||||||
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
|
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
|
||||||
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
|
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
|
||||||
@@ -69,7 +71,8 @@ public:
|
|||||||
unsigned int DecRefCount();
|
unsigned int DecRefCount();
|
||||||
private:
|
private:
|
||||||
BaseStringTable *m_pStrings;
|
BaseStringTable *m_pStrings;
|
||||||
char *m_pFile;
|
char m_File[PLATFORM_MAX_PATH];
|
||||||
|
char m_CurFile[PLATFORM_MAX_PATH];
|
||||||
Trie *m_pOffsets;
|
Trie *m_pOffsets;
|
||||||
Trie *m_pProps;
|
Trie *m_pProps;
|
||||||
Trie *m_pKeys;
|
Trie *m_pKeys;
|
||||||
@@ -83,6 +86,10 @@ private:
|
|||||||
char m_offset[64];
|
char m_offset[64];
|
||||||
char m_Game[256];
|
char m_Game[256];
|
||||||
bool bShouldBeReadingDefault;
|
bool bShouldBeReadingDefault;
|
||||||
|
bool had_game;
|
||||||
|
bool matched_game;
|
||||||
|
bool had_engine;
|
||||||
|
bool matched_engine;
|
||||||
|
|
||||||
/* Custom Sections */
|
/* Custom Sections */
|
||||||
unsigned int m_CustomLevel;
|
unsigned int m_CustomLevel;
|
||||||
@@ -104,6 +111,8 @@ public: //IGameConfigManager
|
|||||||
HandleError *err);
|
HandleError *err);
|
||||||
void AddUserConfigHook(const char *sectionname, ITextListener_SMC *listener);
|
void AddUserConfigHook(const char *sectionname, ITextListener_SMC *listener);
|
||||||
void RemoveUserConfigHook(const char *sectionname, ITextListener_SMC *listener);
|
void RemoveUserConfigHook(const char *sectionname, ITextListener_SMC *listener);
|
||||||
|
void AcquireLock();
|
||||||
|
void ReleaseLock();
|
||||||
public: //SMGlobalClass
|
public: //SMGlobalClass
|
||||||
void OnSourceModStartup(bool late);
|
void OnSourceModStartup(bool late);
|
||||||
void OnSourceModAllInitialized();
|
void OnSourceModAllInitialized();
|
||||||
|
|||||||
@@ -1,909 +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$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "GameDataFetcher.h"
|
|
||||||
#include "bitbuf.h"
|
|
||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS
|
|
||||||
#include <winsock2.h>
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
|
|
||||||
#define INVALID_SOCKET -1
|
|
||||||
#define closesocket close
|
|
||||||
#define WSAGetLastError() errno
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "sh_vector.h"
|
|
||||||
#include "sh_string.h"
|
|
||||||
#include "sm_version.h"
|
|
||||||
|
|
||||||
#ifdef ORANGEBOX_BUILD
|
|
||||||
#include "convar_sm_ob.h"
|
|
||||||
#else
|
|
||||||
#include "convar_sm.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "sourcemm_api.h"
|
|
||||||
#include "time.h"
|
|
||||||
#include "TimerSys.h"
|
|
||||||
#include "compat_wrappers.h"
|
|
||||||
#include "sm_stringutil.h"
|
|
||||||
#include "md5.h"
|
|
||||||
#include "frame_hooks.h"
|
|
||||||
|
|
||||||
#define QUERY_MAX_LENGTH 1024
|
|
||||||
|
|
||||||
static BuildMD5ableBuffer g_MD5Builder;
|
|
||||||
static FetcherThread g_FetchThread;
|
|
||||||
|
|
||||||
static FILE *logfile = NULL;
|
|
||||||
|
|
||||||
bool g_disableGameDataUpdate = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Note on this. If we issue a reload and changelevel, my srcds.exe will emit
|
|
||||||
* Assertion Failed: !m_bServiceStarted
|
|
||||||
* on quit. This seems like a non-issue, because before we just terminated the
|
|
||||||
* server anyway. If anyone notices and files a bug, we can look into it further.
|
|
||||||
*/
|
|
||||||
bool g_restartAfterUpdate = false;
|
|
||||||
|
|
||||||
static bool was_level_started = false;
|
|
||||||
static int g_serverPort = 6500;
|
|
||||||
static char g_serverAddress[100] = "smupdate.alliedmods.net";
|
|
||||||
|
|
||||||
static void _ForceRestart(void *data)
|
|
||||||
{
|
|
||||||
char cmd[300];
|
|
||||||
g_Logger.LogMessage("Automatically restarting SourceMod after a successful gamedata update.");
|
|
||||||
UTIL_Format(cmd, sizeof(cmd), "meta unload %d\n", g_PLID);
|
|
||||||
engine->ServerCommand(cmd);
|
|
||||||
UTIL_Format(cmd, sizeof(cmd), "changelevel \"%s\"\n", STRING(gpGlobals->mapname));
|
|
||||||
engine->ServerCommand(cmd);
|
|
||||||
UTIL_Format(cmd, sizeof(cmd), "echo SourceMod restarted after gamedata update.\n");
|
|
||||||
engine->ServerCommand(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ForceRestart()
|
|
||||||
{
|
|
||||||
FrameAction action;
|
|
||||||
|
|
||||||
action.action = _ForceRestart;
|
|
||||||
action.data = NULL;
|
|
||||||
AddFrameAction(action);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FetcherThread::RunThread(IThreadHandle *pHandle)
|
|
||||||
{
|
|
||||||
char lock_path[PLATFORM_MAX_PATH];
|
|
||||||
g_SourceMod.BuildPath(Path_SM, lock_path, sizeof(lock_path), "data/temp");
|
|
||||||
g_LibSys.CreateFolder(lock_path);
|
|
||||||
|
|
||||||
g_SourceMod.BuildPath(Path_SM, lock_path, sizeof(lock_path), "data/temp/gamedata.lock");
|
|
||||||
|
|
||||||
char log_path[PLATFORM_MAX_PATH];
|
|
||||||
g_SourceMod.BuildPath(Path_SM, log_path, sizeof(log_path), "logs/gamedata");
|
|
||||||
|
|
||||||
g_LibSys.CreateFolder(log_path);
|
|
||||||
|
|
||||||
time_t t;
|
|
||||||
GetAdjustedTime(&t);
|
|
||||||
tm *curtime = localtime(&t);
|
|
||||||
|
|
||||||
g_SourceMod.BuildPath(Path_SM,
|
|
||||||
log_path,
|
|
||||||
sizeof(log_path),
|
|
||||||
"logs/gamedata/L%04d%02d%02d.log",
|
|
||||||
curtime->tm_year + 1900,
|
|
||||||
curtime->tm_mon + 1,
|
|
||||||
curtime->tm_mday);
|
|
||||||
|
|
||||||
logfile = fopen(log_path, "at");
|
|
||||||
|
|
||||||
if (!logfile)
|
|
||||||
{
|
|
||||||
/* :( */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Create a blank lock file
|
|
||||||
FILE *fp = fopen(lock_path, "w");
|
|
||||||
if (fp)
|
|
||||||
{
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
char query[QUERY_MAX_LENGTH];
|
|
||||||
|
|
||||||
/* Check for updated gamedata files */
|
|
||||||
int len = BuildGameDataQuery(query, QUERY_MAX_LENGTH);
|
|
||||||
|
|
||||||
if (len == 0)
|
|
||||||
{
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Could not build gamedata query!");
|
|
||||||
fclose(logfile);
|
|
||||||
unlink(lock_path);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We check this late so we have the MD5 sums available. This may change in the future. */
|
|
||||||
if (g_disableGameDataUpdate)
|
|
||||||
{
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Skipping gamedata fetcher (DisableAutoUpdate set)");
|
|
||||||
fclose(logfile);
|
|
||||||
unlink(lock_path);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a new socket for this connection */
|
|
||||||
int socketDescriptor = ConnectSocket();
|
|
||||||
|
|
||||||
if (socketDescriptor == INVALID_SOCKET)
|
|
||||||
{
|
|
||||||
fclose(logfile);
|
|
||||||
unlink(lock_path);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int sent = SendData(socketDescriptor, query, len);
|
|
||||||
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Sent gamedata query");
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
|
|
||||||
if (sent == 0)
|
|
||||||
{
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Failed to send gamedata query data to remote host");
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
|
|
||||||
closesocket(socketDescriptor);
|
|
||||||
fclose(logfile);
|
|
||||||
unlink(lock_path);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProcessGameDataQuery(socketDescriptor);
|
|
||||||
|
|
||||||
/* And we're done! */
|
|
||||||
closesocket(socketDescriptor);
|
|
||||||
fclose(logfile);
|
|
||||||
unlink(lock_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FetcherThread::OnTerminate(IThreadHandle *pHandle, bool cancel)
|
|
||||||
{
|
|
||||||
g_blockGameDataLoad = false;
|
|
||||||
|
|
||||||
if (cancel)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wasSuccess)
|
|
||||||
{
|
|
||||||
HandleUpdateStatus(updateStatus, build);
|
|
||||||
|
|
||||||
if (needsRestart)
|
|
||||||
{
|
|
||||||
if (g_restartAfterUpdate)
|
|
||||||
{
|
|
||||||
if (was_level_started)
|
|
||||||
{
|
|
||||||
ForceRestart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_Logger.LogMessage("Your gamedata files have been updated, please restart your server.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!g_disableGameDataUpdate)
|
|
||||||
{
|
|
||||||
g_Logger.LogError("An error occurred in the gamedata fetcher, see your gamedata log files for more information.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int FetcherThread::BuildGameDataQuery(char *buffer, int maxlen)
|
|
||||||
{
|
|
||||||
char gamedata_path[PLATFORM_MAX_PATH];
|
|
||||||
g_SourceMod.BuildPath(Path_SM, gamedata_path, sizeof(gamedata_path), "gamedata");
|
|
||||||
|
|
||||||
IDirectory *dir = g_LibSys.OpenDirectory(gamedata_path);
|
|
||||||
|
|
||||||
if (dir == NULL)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bf_write Writer = bf_write("GameDataQuery", buffer, maxlen);
|
|
||||||
|
|
||||||
Writer.WriteByte('A'); //Generic Header char
|
|
||||||
Writer.WriteByte('G'); //G for gamedata query, or green, like my hat.
|
|
||||||
|
|
||||||
short build[4] = { SVN_FILE_VERSION };
|
|
||||||
|
|
||||||
Writer.WriteBytes(&build[0], 8);
|
|
||||||
|
|
||||||
Writer.WriteByte(0); // Initialize the file counter - Index 10
|
|
||||||
|
|
||||||
while (dir->MoreFiles())
|
|
||||||
{
|
|
||||||
if (dir->IsEntryFile())
|
|
||||||
{
|
|
||||||
const char *name = dir->GetEntryName();
|
|
||||||
size_t len = strlen(name);
|
|
||||||
if (len >= 4 && strcmp(&name[len-4], ".txt") == 0)
|
|
||||||
{
|
|
||||||
MD5 md5;
|
|
||||||
SMCError err;
|
|
||||||
SMCStates states;
|
|
||||||
unsigned char raw[16];
|
|
||||||
char file[PLATFORM_MAX_PATH];
|
|
||||||
|
|
||||||
g_LibSys.PathFormat(file, sizeof(file), "%s/%s", gamedata_path, name);
|
|
||||||
|
|
||||||
g_MD5Builder.checksum = &md5;
|
|
||||||
if ((err = g_TextParser.ParseFile_SMC(file, &g_MD5Builder, &states)) == SMCError_Okay)
|
|
||||||
{
|
|
||||||
md5.raw_digest(raw);
|
|
||||||
(uint8_t)buffer[10]++; //Increment the file counter
|
|
||||||
Writer.WriteBytes(raw, 16);
|
|
||||||
|
|
||||||
FileData *data = new FileData();
|
|
||||||
data->filename = new SourceHook::String(file);
|
|
||||||
md5.hex_digest(data->checksum);
|
|
||||||
filenames.push_back(data);
|
|
||||||
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Parsed file: %s as %s", file, data->checksum);
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
const char *error = g_TextParser.GetSMCErrorString(err);
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Parsing of file %s failed: %s", file, error);
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dir->NextEntry();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Writer.GetNumBytesWritten();
|
|
||||||
}
|
|
||||||
|
|
||||||
int FetcherThread::ConnectSocket()
|
|
||||||
{
|
|
||||||
#if defined PLATFORM_WINDOWS
|
|
||||||
WSADATA wsaData;
|
|
||||||
WSAStartup(0x0101, &wsaData);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct protoent *ptrp;
|
|
||||||
|
|
||||||
if ((ptrp = getprotobyname("tcp")) == NULL)
|
|
||||||
{
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Error: Failed to find TCP protocol");
|
|
||||||
return INVALID_SOCKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
int socketDescriptor = socket(AF_INET, SOCK_STREAM, ptrp->p_proto);
|
|
||||||
|
|
||||||
if (socketDescriptor == INVALID_SOCKET)
|
|
||||||
{
|
|
||||||
char error[255];
|
|
||||||
g_LibSys.GetPlatformErrorEx(WSAGetLastError(), error, sizeof(error));
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Error: Failed to create socket: %s", error);
|
|
||||||
closesocket(socketDescriptor);
|
|
||||||
return INVALID_SOCKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct hostent *he;
|
|
||||||
struct sockaddr_in local_addr;
|
|
||||||
|
|
||||||
local_addr.sin_family = AF_INET;
|
|
||||||
local_addr.sin_port = htons((u_short)g_serverPort);
|
|
||||||
|
|
||||||
he = gethostbyname(g_serverAddress);
|
|
||||||
|
|
||||||
if (!he)
|
|
||||||
{
|
|
||||||
if ((local_addr.sin_addr.s_addr = inet_addr(g_serverAddress)) == INADDR_NONE)
|
|
||||||
{
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Couldn't locate address: %s", g_serverAddress);
|
|
||||||
closesocket(socketDescriptor);
|
|
||||||
return INVALID_SOCKET;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
memcpy(&local_addr.sin_addr, (struct in_addr *)he->h_addr, he->h_length);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (connect(socketDescriptor, (struct sockaddr *) &local_addr, sizeof(local_addr)) < 0)
|
|
||||||
{
|
|
||||||
char error[255];
|
|
||||||
g_LibSys.GetPlatformErrorEx(WSAGetLastError(), error, sizeof(error));
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Couldn't connect to %s: %s", g_serverAddress, error);
|
|
||||||
closesocket(socketDescriptor);
|
|
||||||
return INVALID_SOCKET;
|
|
||||||
}
|
|
||||||
|
|
||||||
return socketDescriptor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FetcherThread::ProcessGameDataQuery(int socketDescriptor)
|
|
||||||
{
|
|
||||||
char buffer[50];
|
|
||||||
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Waiting for reply!");
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
|
|
||||||
//Read in the header bytes
|
|
||||||
int returnLen = RecvData(socketDescriptor, buffer, 12);
|
|
||||||
|
|
||||||
|
|
||||||
if (returnLen == 0)
|
|
||||||
{
|
|
||||||
char error[255];
|
|
||||||
g_LibSys.GetPlatformErrorEx(WSAGetLastError(), error, sizeof(error));
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Did not receive reply: %s", error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Received Header!");
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
|
|
||||||
bf_read Reader = bf_read("GameDataQuery", buffer, 12);
|
|
||||||
|
|
||||||
if (Reader.ReadByte() != 'A' || Reader.ReadByte() != 'G')
|
|
||||||
{
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Unknown Query Response");
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateStatus = (UpdateStatus)Reader.ReadByte();
|
|
||||||
|
|
||||||
build[0] = Reader.ReadShort();
|
|
||||||
build[1] = Reader.ReadShort();
|
|
||||||
build[2] = Reader.ReadShort();
|
|
||||||
build[3] = Reader.ReadShort();
|
|
||||||
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
g_Logger.LogToFileOnly(logfile,
|
|
||||||
"Update Status: %i - Latest %i.%i.%i.%i",
|
|
||||||
updateStatus,
|
|
||||||
build[0],
|
|
||||||
build[1],
|
|
||||||
build[2],
|
|
||||||
build[3]);
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
|
|
||||||
int changedFiles = Reader.ReadByte();
|
|
||||||
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Files to download: %i", changedFiles);
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
|
|
||||||
for (int i=0; i<changedFiles; i++)
|
|
||||||
{
|
|
||||||
//Read in the file index and byte count
|
|
||||||
returnLen = RecvData(socketDescriptor, buffer, 5);
|
|
||||||
|
|
||||||
if (returnLen == 0)
|
|
||||||
{
|
|
||||||
/* Timeout or fail? */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Reader.StartReading(buffer, 5);
|
|
||||||
|
|
||||||
int index = Reader.ReadByte();
|
|
||||||
int tempLen = Reader.ReadUBitLong(32);
|
|
||||||
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
g_Logger.LogToFileOnly(logfile, "File index %i and length %i", index, tempLen);
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
|
|
||||||
void *memPtr;
|
|
||||||
memtable->CreateMem(tempLen+1, &memPtr);
|
|
||||||
|
|
||||||
//Read the contents of our file into the memtable
|
|
||||||
returnLen = RecvData(socketDescriptor, (char *)memPtr, tempLen);
|
|
||||||
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Received %i bytes", returnLen);
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
|
|
||||||
if (returnLen == 0)
|
|
||||||
{
|
|
||||||
/* Timeout or fail? */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
((unsigned char *)memPtr)[tempLen] = '\0';
|
|
||||||
|
|
||||||
FileData *data = filenames.at(index);
|
|
||||||
const char *filename;
|
|
||||||
if (data != NULL)
|
|
||||||
{
|
|
||||||
filename = data->filename->c_str();
|
|
||||||
|
|
||||||
FILE *fp = fopen(filename, "w");
|
|
||||||
|
|
||||||
if (fp)
|
|
||||||
{
|
|
||||||
fprintf(fp, "%s", (const char *)memPtr);
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Failed to open file \"%s\" for writing", filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
filename = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
memtable->Reset();
|
|
||||||
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Updated file: %s", filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
g_Logger.LogToFileOnly(logfile, "File Downloads Completed!");
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
|
|
||||||
needsRestart = false;
|
|
||||||
|
|
||||||
if (changedFiles > 0)
|
|
||||||
{
|
|
||||||
needsRestart = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Read changed file count
|
|
||||||
returnLen = RecvData(socketDescriptor, buffer, 1);
|
|
||||||
|
|
||||||
if (returnLen == 0)
|
|
||||||
{
|
|
||||||
char error[255];
|
|
||||||
g_LibSys.GetPlatformErrorEx(WSAGetLastError(), error, sizeof(error));
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Did not receive count reply: %s", error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Reader.StartReading(buffer, 1);
|
|
||||||
|
|
||||||
changedFiles = Reader.ReadByte();
|
|
||||||
|
|
||||||
if (changedFiles < 1)
|
|
||||||
{
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
g_Logger.LogToFileOnly(logfile, "No unknown files. We're all done");
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *changedFileIndexes = new char[changedFiles];
|
|
||||||
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
g_Logger.LogToFileOnly(logfile, "%i files were unknown", changedFiles);
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
|
|
||||||
returnLen = RecvData(socketDescriptor, changedFileIndexes, changedFiles);
|
|
||||||
|
|
||||||
if (returnLen == 0)
|
|
||||||
{
|
|
||||||
char error[255];
|
|
||||||
g_LibSys.GetPlatformErrorEx(WSAGetLastError(), error, sizeof(error));
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Did not receive list reply: %s", error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Reader.StartReading(changedFileIndexes, changedFiles);
|
|
||||||
|
|
||||||
for (int i=0; i<changedFiles; i++)
|
|
||||||
{
|
|
||||||
int index = Reader.ReadByte();
|
|
||||||
char fileName[30];
|
|
||||||
|
|
||||||
FileData *data = filenames.at(index);
|
|
||||||
const char* pathname;
|
|
||||||
if (data != NULL)
|
|
||||||
{
|
|
||||||
pathname = data->filename->c_str();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pathname = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
g_LibSys.GetFileFromPath(fileName, sizeof(fileName), pathname);
|
|
||||||
IF_DEBUG_SPEW
|
|
||||||
g_Logger.LogToFileOnly(logfile, "Unknown File %i : %s", index, fileName);
|
|
||||||
ENDIF_DEBUG_SPEW
|
|
||||||
}
|
|
||||||
|
|
||||||
delete [] changedFileIndexes;
|
|
||||||
|
|
||||||
wasSuccess = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int FetcherThread::RecvData(int socketDescriptor, char *buffer, int len)
|
|
||||||
{
|
|
||||||
fd_set fds;
|
|
||||||
struct timeval tv;
|
|
||||||
|
|
||||||
/* Create a 10 Second Timeout */
|
|
||||||
tv.tv_sec = 10;
|
|
||||||
tv.tv_usec = 0;
|
|
||||||
|
|
||||||
int bytesReceivedTotal = 0;
|
|
||||||
|
|
||||||
while (bytesReceivedTotal < len)
|
|
||||||
{
|
|
||||||
/* Add our socket to a socket set */
|
|
||||||
FD_ZERO(&fds);
|
|
||||||
FD_SET(socketDescriptor, &fds);
|
|
||||||
|
|
||||||
/* Wait max of 10 seconds for recv to become available */
|
|
||||||
select(socketDescriptor+1, &fds, NULL, NULL, &tv);
|
|
||||||
|
|
||||||
int bytesReceived = 0;
|
|
||||||
|
|
||||||
/* Is there a limit on how much we can receive? Some site said 1024 bytes, which will be well short of a file */
|
|
||||||
if (FD_ISSET(socketDescriptor, &fds))
|
|
||||||
{
|
|
||||||
bytesReceived = recv(socketDescriptor, buffer+bytesReceivedTotal, len-bytesReceivedTotal, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bytesReceived == 0 || bytesReceived == -1)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bytesReceivedTotal += bytesReceived;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bytesReceivedTotal;
|
|
||||||
}
|
|
||||||
|
|
||||||
int FetcherThread::SendData(int socketDescriptor, char *buffer, int len)
|
|
||||||
{
|
|
||||||
fd_set fds;
|
|
||||||
struct timeval tv;
|
|
||||||
|
|
||||||
tv.tv_sec = 10;
|
|
||||||
tv.tv_usec = 0;
|
|
||||||
|
|
||||||
int sentBytesTotal = 0;
|
|
||||||
|
|
||||||
while (sentBytesTotal < len)
|
|
||||||
{
|
|
||||||
FD_ZERO(&fds);
|
|
||||||
FD_SET(socketDescriptor, &fds);
|
|
||||||
|
|
||||||
select(socketDescriptor+1, NULL, &fds, NULL, &tv);
|
|
||||||
|
|
||||||
int sentBytes = 0;
|
|
||||||
|
|
||||||
if (FD_ISSET(socketDescriptor, &fds))
|
|
||||||
{
|
|
||||||
sentBytes = send(socketDescriptor, buffer+sentBytesTotal, len-sentBytesTotal, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sentBytes == 0 || sentBytes == -1)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sentBytesTotal += sentBytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sentBytesTotal;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FetcherThread::HandleUpdateStatus(UpdateStatus status, short version[4])
|
|
||||||
{
|
|
||||||
switch (status)
|
|
||||||
{
|
|
||||||
case Update_Unknown:
|
|
||||||
case Update_Current:
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case Update_NewBuild:
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case Update_MinorAvailable:
|
|
||||||
{
|
|
||||||
g_Logger.LogMessage("SourceMod Update: A new release of SourceMod is now available from sourcemod.net");
|
|
||||||
g_Logger.LogMessage("Current Version: %i.%i.%i Available: %i.%i.%i", version[0], version[1], version[2], version[0], version[1], version[2]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case Update_MajorAvailable:
|
|
||||||
{
|
|
||||||
g_Logger.LogMessage("SourceMod Update: An major release of SourceMod is now available from sourcemod.net");
|
|
||||||
g_Logger.LogMessage("Current Version: %i.%i.%i Available: %i.%i.%i", version[0], version[1], version[2], version[0], version[1], version[2]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case Update_CriticalAvailable:
|
|
||||||
{
|
|
||||||
g_Logger.LogError("SourceMod Update: A critical SourceMod release is available from sourcemod.net. It is strongly recommended that you update!");
|
|
||||||
g_Logger.LogMessage("Current Version: %i.%i.%i Available: %i.%i.%i", version[0], version[1], version[2], version[0], version[1], version[2]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool g_blockGameDataLoad = false;
|
|
||||||
static IThreadHandle *fetch_thread_hndl;
|
|
||||||
|
|
||||||
class InitFetch : public SMGlobalClass
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void OnSourceModAllInitialized_Post()
|
|
||||||
{
|
|
||||||
char lock_path[PLATFORM_MAX_PATH];
|
|
||||||
g_SourceMod.BuildPath(Path_SM, lock_path, sizeof(lock_path), "data/temp/gamedata.lock");
|
|
||||||
|
|
||||||
if (g_LibSys.IsPathFile(lock_path) && g_LibSys.PathExists(lock_path))
|
|
||||||
{
|
|
||||||
g_Logger.LogError("sourcemod/data/temp/gamedata.lock file detected. This is most likely due to a crash during GameData updating - Blocking GameData loading");
|
|
||||||
g_Logger.LogError("If this error persists delete the file manually");
|
|
||||||
g_blockGameDataLoad = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreadParams fetchThreadParams = ThreadParams();
|
|
||||||
fetchThreadParams.prio = ThreadPrio_Low;
|
|
||||||
fetch_thread_hndl = g_pThreader->MakeThread(&g_FetchThread, &fetchThreadParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnSourceModShutdown()
|
|
||||||
{
|
|
||||||
fetch_thread_hndl->WaitForThread();
|
|
||||||
fetch_thread_hndl->DestroyThis();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnSourceModLevelActivated()
|
|
||||||
{
|
|
||||||
was_level_started = true;
|
|
||||||
|
|
||||||
if (g_restartAfterUpdate &&
|
|
||||||
g_FetchThread.wasSuccess &&
|
|
||||||
g_FetchThread.needsRestart)
|
|
||||||
{
|
|
||||||
ForceRestart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnSourceModLevelEnd()
|
|
||||||
{
|
|
||||||
was_level_started = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigResult OnSourceModConfigChanged(const char *key,
|
|
||||||
const char *value,
|
|
||||||
ConfigSource source,
|
|
||||||
char *error,
|
|
||||||
size_t maxlength)
|
|
||||||
{
|
|
||||||
if (strcasecmp(key, "DisableAutoUpdate") == 0)
|
|
||||||
{
|
|
||||||
if (strcasecmp(value, "yes") == 0)
|
|
||||||
{
|
|
||||||
g_disableGameDataUpdate = true;
|
|
||||||
return ConfigResult_Accept;
|
|
||||||
}
|
|
||||||
else if (strcasecmp(value, "no") == 0)
|
|
||||||
{
|
|
||||||
g_disableGameDataUpdate = false;
|
|
||||||
return ConfigResult_Accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ConfigResult_Reject;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcasecmp(key, "ForceRestartAfterUpdate") == 0)
|
|
||||||
{
|
|
||||||
if (strcasecmp(value, "yes") == 0)
|
|
||||||
{
|
|
||||||
g_restartAfterUpdate = true;
|
|
||||||
return ConfigResult_Accept;
|
|
||||||
}
|
|
||||||
else if (strcasecmp(value, "no") == 0)
|
|
||||||
{
|
|
||||||
g_restartAfterUpdate = false;
|
|
||||||
return ConfigResult_Accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ConfigResult_Reject;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcasecmp(key, "AutoUpdateServer") == 0)
|
|
||||||
{
|
|
||||||
UTIL_Format(g_serverAddress, sizeof(g_serverAddress), "%s", value);
|
|
||||||
|
|
||||||
return ConfigResult_Accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcasecmp(key, "AutoUpdatePort") == 0)
|
|
||||||
{
|
|
||||||
int port = atoi(value);
|
|
||||||
|
|
||||||
if (!port)
|
|
||||||
{
|
|
||||||
return ConfigResult_Reject;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_serverPort = port;
|
|
||||||
|
|
||||||
return ConfigResult_Accept;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ConfigResult_Ignore;
|
|
||||||
}
|
|
||||||
} g_InitFetch;
|
|
||||||
|
|
||||||
BuildMD5ableBuffer::BuildMD5ableBuffer()
|
|
||||||
{
|
|
||||||
stringTable = new BaseStringTable(2048);
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildMD5ableBuffer::~BuildMD5ableBuffer()
|
|
||||||
{
|
|
||||||
delete stringTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildMD5ableBuffer::ReadSMC_ParseStart()
|
|
||||||
{
|
|
||||||
stringTable->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
SMCResult BuildMD5ableBuffer::ReadSMC_KeyValue(const SMCStates *states,
|
|
||||||
const char *key,
|
|
||||||
const char *value)
|
|
||||||
{
|
|
||||||
stringTable->AddString(key);
|
|
||||||
stringTable->AddString(value);
|
|
||||||
|
|
||||||
return SMCResult_Continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
SMCResult BuildMD5ableBuffer::ReadSMC_NewSection(const SMCStates *states, const char *name)
|
|
||||||
{
|
|
||||||
stringTable->AddString(name);
|
|
||||||
|
|
||||||
return SMCResult_Continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildMD5ableBuffer::ReadSMC_ParseEnd(bool halted, bool failed)
|
|
||||||
{
|
|
||||||
if (halted || failed)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *data = stringTable->GetMemTable()->GetAddress(0);
|
|
||||||
|
|
||||||
if (data != NULL)
|
|
||||||
{
|
|
||||||
checksum->update((unsigned char *)data, stringTable->GetMemTable()->GetActualMemUsed());
|
|
||||||
}
|
|
||||||
|
|
||||||
checksum->finalize();
|
|
||||||
}
|
|
||||||
|
|
||||||
CON_COMMAND(sm_gamedata_md5, "Checks the MD5 sum for a given gamedata file")
|
|
||||||
{
|
|
||||||
#if !defined ORANGEBOX_BUILD
|
|
||||||
CCommand args;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (args.ArgC() < 2)
|
|
||||||
{
|
|
||||||
g_SMAPI->ConPrint("Usage: sm_gamedata_md5 <file>\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *file = args.Arg(1);
|
|
||||||
if (!file || file[0] == '\0')
|
|
||||||
{
|
|
||||||
g_SMAPI->ConPrint("Usage: sm_gamedata_md5 <file>\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceHook::CVector<FileData *>::iterator iter = g_FetchThread.filenames.begin();
|
|
||||||
|
|
||||||
FileData *curData;
|
|
||||||
|
|
||||||
while (iter != g_FetchThread.filenames.end())
|
|
||||||
{
|
|
||||||
curData = (*iter);
|
|
||||||
|
|
||||||
char fileName[30];
|
|
||||||
|
|
||||||
g_LibSys.GetFileFromPath(fileName, sizeof(fileName), curData->filename->c_str());
|
|
||||||
|
|
||||||
if (strcmpi(fileName, file) == 0)
|
|
||||||
{
|
|
||||||
g_SMAPI->ConPrintf("MD5 Sum: %s\n", curData->checksum);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
iter++;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_SMAPI->ConPrint("File not found!\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
FetcherThread::~FetcherThread()
|
|
||||||
{
|
|
||||||
SourceHook::CVector<FileData *>::iterator iter = filenames.begin();
|
|
||||||
|
|
||||||
FileData *curData;
|
|
||||||
|
|
||||||
while (iter != filenames.end())
|
|
||||||
{
|
|
||||||
curData = (*iter);
|
|
||||||
delete curData->filename;
|
|
||||||
delete curData;
|
|
||||||
iter = filenames.erase(iter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FetcherThread::FetcherThread()
|
|
||||||
{
|
|
||||||
memtable = new BaseMemTable(4096);
|
|
||||||
wasSuccess = false;
|
|
||||||
needsRestart = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,106 +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_GAMEDATAFETCHER_H_
|
|
||||||
#define _INCLUDE_SOURCEMOD_GAMEDATAFETCHER_H_
|
|
||||||
|
|
||||||
#include "sourcemod.h"
|
|
||||||
#include "TextParsers.h"
|
|
||||||
#include "IThreader.h"
|
|
||||||
#include "Logger.h"
|
|
||||||
#include "LibrarySys.h"
|
|
||||||
#include "ThreadSupport.h"
|
|
||||||
#include "sm_memtable.h"
|
|
||||||
#include <sh_string.h>
|
|
||||||
#include <sh_list.h>
|
|
||||||
|
|
||||||
enum UpdateStatus
|
|
||||||
{
|
|
||||||
Update_Unknown = 0, /* Version wasn't recognised or version querying is unsupported */
|
|
||||||
Update_Current = 1, /* Server is running latest version */
|
|
||||||
Update_NewBuild = 2, /* Server is on a svn release and a newer version is available */
|
|
||||||
Update_MinorAvailable = 3, /* Server is on a release and a minor release has superceeded it */
|
|
||||||
Update_MajorAvailable = 4, /* Server is on a release and a major release has superceeded it */
|
|
||||||
Update_CriticalAvailable = 5, /* A critical update has been released (security fixes etc) */
|
|
||||||
};
|
|
||||||
|
|
||||||
class MD5;
|
|
||||||
|
|
||||||
class BuildMD5ableBuffer : public ITextListener_SMC
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BuildMD5ableBuffer();
|
|
||||||
~BuildMD5ableBuffer();
|
|
||||||
void ReadSMC_ParseStart();
|
|
||||||
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
|
|
||||||
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
|
|
||||||
void ReadSMC_ParseEnd(bool halted, bool failed);
|
|
||||||
public:
|
|
||||||
MD5 *checksum;
|
|
||||||
private:
|
|
||||||
BaseStringTable *stringTable;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FileData
|
|
||||||
{
|
|
||||||
SourceHook::String *filename;
|
|
||||||
char checksum[33];
|
|
||||||
};
|
|
||||||
|
|
||||||
class FetcherThread : public IThread
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FetcherThread();
|
|
||||||
~FetcherThread();
|
|
||||||
public:
|
|
||||||
void RunThread(IThreadHandle *pHandle);
|
|
||||||
void OnTerminate(IThreadHandle *pHandle, bool cancel);
|
|
||||||
private:
|
|
||||||
int BuildGameDataQuery(char *buffer, int maxlen);
|
|
||||||
void ProcessGameDataQuery(int SocketDescriptor);
|
|
||||||
int RecvData(int socketDescriptor, char *buffer, int len);
|
|
||||||
int SendData(int socketDescriptor, char *buffer, int len);
|
|
||||||
int ConnectSocket();
|
|
||||||
void HandleUpdateStatus(UpdateStatus status, short version[4]);
|
|
||||||
public:
|
|
||||||
SourceHook::CVector<FileData *> filenames;
|
|
||||||
bool needsRestart;
|
|
||||||
bool wasSuccess;
|
|
||||||
private:
|
|
||||||
UpdateStatus updateStatus;
|
|
||||||
BaseMemTable *memtable;
|
|
||||||
short build[4];
|
|
||||||
};
|
|
||||||
|
|
||||||
extern bool g_blockGameDataLoad;
|
|
||||||
|
|
||||||
#endif // _INCLUDE_SOURCEMOD_GAMEDATAFETCHER_H_
|
|
||||||
|
|
||||||
+105
-2
@@ -88,11 +88,16 @@ CHalfLife2::~CHalfLife2()
|
|||||||
m_Maps.clear();
|
m_Maps.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
CSharedEdictChangeInfo *g_pSharedChangeInfo = NULL;
|
CSharedEdictChangeInfo *g_pSharedChangeInfo = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool is_original_engine = false;
|
bool is_original_engine = false;
|
||||||
|
|
||||||
void CHalfLife2::OnSourceModStartup(bool late)
|
void CHalfLife2::OnSourceModStartup(bool late)
|
||||||
{
|
{
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
|
|
||||||
/* The Ship currently is the only known game to use an older version of the engine */
|
/* The Ship currently is the only known game to use an older version of the engine */
|
||||||
#if defined METAMOD_PLAPI_VERSION
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL)
|
if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL)
|
||||||
@@ -106,12 +111,14 @@ void CHalfLife2::OnSourceModStartup(bool late)
|
|||||||
{
|
{
|
||||||
g_pSharedChangeInfo = engine->GetSharedEdictChangeInfo();
|
g_pSharedChangeInfo = engine->GetSharedEdictChangeInfo();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHalfLife2::OnSourceModAllInitialized()
|
void CHalfLife2::OnSourceModAllInitialized()
|
||||||
{
|
{
|
||||||
m_MsgTextMsg = g_UserMsgs.GetMessageIndex("TextMsg");
|
m_MsgTextMsg = g_UserMsgs.GetMessageIndex("TextMsg");
|
||||||
m_HinTextMsg = g_UserMsgs.GetMessageIndex("HintText");
|
m_HinTextMsg = g_UserMsgs.GetMessageIndex("HintText");
|
||||||
|
m_SayTextMsg = g_UserMsgs.GetMessageIndex("SayText");
|
||||||
m_VGUIMenu = g_UserMsgs.GetMessageIndex("VGUIMenu");
|
m_VGUIMenu = g_UserMsgs.GetMessageIndex("VGUIMenu");
|
||||||
g_ShareSys.AddInterface(NULL, this);
|
g_ShareSys.AddInterface(NULL, this);
|
||||||
}
|
}
|
||||||
@@ -123,10 +130,12 @@ bool CHalfLife2::IsOriginalEngine()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
|
IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
|
||||||
{
|
{
|
||||||
return engine->GetChangeAccessor( (const edict_t *)this );
|
return engine->GetChangeAccessor( (const edict_t *)this );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool UTIL_FindInSendTable(SendTable *pTable,
|
bool UTIL_FindInSendTable(SendTable *pTable,
|
||||||
const char *name,
|
const char *name,
|
||||||
@@ -296,6 +305,7 @@ typedescription_t *CHalfLife2::FindInDataMap(datamap_t *pMap, const char *offset
|
|||||||
|
|
||||||
void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
|
void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
|
||||||
{
|
{
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
if (g_pSharedChangeInfo != NULL)
|
if (g_pSharedChangeInfo != NULL)
|
||||||
{
|
{
|
||||||
if (offset)
|
if (offset)
|
||||||
@@ -308,6 +318,7 @@ void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
pEdict->m_fStateFlags |= FL_EDICT_CHANGED;
|
pEdict->m_fStateFlags |= FL_EDICT_CHANGED;
|
||||||
}
|
}
|
||||||
@@ -318,6 +329,31 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
|
|||||||
bf_write *pBitBuf = NULL;
|
bf_write *pBitBuf = NULL;
|
||||||
cell_t players[] = {client};
|
cell_t players[] = {client};
|
||||||
|
|
||||||
|
if (dest == HUD_PRINTTALK)
|
||||||
|
{
|
||||||
|
const char *chat_saytext = g_pGameConf->GetKeyValue("ChatSayText");
|
||||||
|
|
||||||
|
/* Use SayText user message instead */
|
||||||
|
if (chat_saytext != NULL && strcmp(chat_saytext, "yes") == 0)
|
||||||
|
{
|
||||||
|
char buffer[192];
|
||||||
|
UTIL_Format(buffer, sizeof(buffer), "%s\1\n", msg);
|
||||||
|
|
||||||
|
if ((pBitBuf = g_UserMsgs.StartMessage(m_SayTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pBitBuf->WriteByte(0);
|
||||||
|
pBitBuf->WriteString(buffer);
|
||||||
|
pBitBuf->WriteByte(1);
|
||||||
|
|
||||||
|
g_UserMsgs.EndMessage();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((pBitBuf = g_UserMsgs.StartMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
if ((pBitBuf = g_UserMsgs.StartMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -325,6 +361,7 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
|
|||||||
|
|
||||||
pBitBuf->WriteByte(dest);
|
pBitBuf->WriteByte(dest);
|
||||||
pBitBuf->WriteString(msg);
|
pBitBuf->WriteString(msg);
|
||||||
|
|
||||||
g_UserMsgs.EndMessage();
|
g_UserMsgs.EndMessage();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -481,7 +518,7 @@ void CHalfLife2::PushCommandStack(const CCommand *cmd)
|
|||||||
CachedCommandInfo info;
|
CachedCommandInfo info;
|
||||||
|
|
||||||
info.args = cmd;
|
info.args = cmd;
|
||||||
#if !defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE <= SE_DARKMESSIAH
|
||||||
strncopy(info.cmd, cmd->Arg(0), sizeof(info.cmd));
|
strncopy(info.cmd, cmd->Arg(0), sizeof(info.cmd));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -505,7 +542,7 @@ void CHalfLife2::PopCommandStack()
|
|||||||
|
|
||||||
const char *CHalfLife2::CurrentCommandName()
|
const char *CHalfLife2::CurrentCommandName()
|
||||||
{
|
{
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
return m_CommandStack.front().args->Arg(0);
|
return m_CommandStack.front().args->Arg(0);
|
||||||
#else
|
#else
|
||||||
return m_CommandStack.front().cmd;
|
return m_CommandStack.front().cmd;
|
||||||
@@ -539,3 +576,69 @@ void CHalfLife2::ProcessDelayedKicks()
|
|||||||
player->Kick(info.buffer);
|
player->Kick(info.buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
edict_t *CHalfLife2::EdictOfIndex(int index)
|
||||||
|
{
|
||||||
|
return ::PEntityOfEntIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CHalfLife2::IndexOfEdict(edict_t *pEnt)
|
||||||
|
{
|
||||||
|
return ::IndexOfEdict(pEnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
edict_t *CHalfLife2::GetHandleEntity(CBaseHandle &hndl)
|
||||||
|
{
|
||||||
|
if (!hndl.IsValid())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = hndl.GetEntryIndex();
|
||||||
|
|
||||||
|
edict_t *pStoredEdict;
|
||||||
|
CBaseEntity *pStoredEntity;
|
||||||
|
|
||||||
|
pStoredEdict = GetEntity(index, &pStoredEntity);
|
||||||
|
|
||||||
|
if (pStoredEdict == NULL || pStoredEntity == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
IServerEntity *pSE = pStoredEdict->GetIServerEntity();
|
||||||
|
|
||||||
|
if (pSE == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pSE->GetRefEHandle() != hndl)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pStoredEdict;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CHalfLife2::SetHandleEntity(CBaseHandle &hndl, edict_t *pEnt)
|
||||||
|
{
|
||||||
|
IServerEntity *pEntOther = pEnt->GetIServerEntity();
|
||||||
|
|
||||||
|
if (pEntOther == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hndl.Set(pEntOther);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *CHalfLife2::GetCurrentMap()
|
||||||
|
{
|
||||||
|
return STRING(gpGlobals->mapname);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CHalfLife2::ServerCommand(const char *buffer)
|
||||||
|
{
|
||||||
|
engine->ServerCommand(buffer);
|
||||||
|
}
|
||||||
|
|||||||
+10
-1
@@ -74,7 +74,7 @@ struct DelayedFakeCliCmd
|
|||||||
struct CachedCommandInfo
|
struct CachedCommandInfo
|
||||||
{
|
{
|
||||||
const CCommand *args;
|
const CCommand *args;
|
||||||
#if !defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE <= SE_DARKMESSIAH
|
||||||
char cmd[300];
|
char cmd[300];
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@@ -109,6 +109,12 @@ public: //IGameHelpers
|
|||||||
bool ShowVGUIMenu(int client, const char *name, KeyValues *data, bool show);
|
bool ShowVGUIMenu(int client, const char *name, KeyValues *data, bool show);
|
||||||
bool IsLANServer();
|
bool IsLANServer();
|
||||||
bool KVLoadFromFile(KeyValues *kv, IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL);
|
bool KVLoadFromFile(KeyValues *kv, IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL);
|
||||||
|
edict_t *EdictOfIndex(int index);
|
||||||
|
int IndexOfEdict(edict_t *pEnt);
|
||||||
|
edict_t *GetHandleEntity(CBaseHandle &hndl);
|
||||||
|
void SetHandleEntity(CBaseHandle &hndl, edict_t *pEnt);
|
||||||
|
const char *GetCurrentMap();
|
||||||
|
void ServerCommand(const char *buffer);
|
||||||
public:
|
public:
|
||||||
void AddToFakeCliCmdQueue(int client, int userid, const char *cmd);
|
void AddToFakeCliCmdQueue(int client, int userid, const char *cmd);
|
||||||
void ProcessFakeCliCmdQueue();
|
void ProcessFakeCliCmdQueue();
|
||||||
@@ -130,6 +136,7 @@ private:
|
|||||||
THash<datamap_t *, DataMapTrie> m_Maps;
|
THash<datamap_t *, DataMapTrie> m_Maps;
|
||||||
int m_MsgTextMsg;
|
int m_MsgTextMsg;
|
||||||
int m_HinTextMsg;
|
int m_HinTextMsg;
|
||||||
|
int m_SayTextMsg;
|
||||||
int m_VGUIMenu;
|
int m_VGUIMenu;
|
||||||
Queue<DelayedFakeCliCmd *> m_CmdQueue;
|
Queue<DelayedFakeCliCmd *> m_CmdQueue;
|
||||||
CStack<DelayedFakeCliCmd *> m_FreeCmds;
|
CStack<DelayedFakeCliCmd *> m_FreeCmds;
|
||||||
@@ -139,4 +146,6 @@ private:
|
|||||||
|
|
||||||
extern CHalfLife2 g_HL2;
|
extern CHalfLife2 g_HL2;
|
||||||
|
|
||||||
|
edict_t *GetEntity(cell_t num, CBaseEntity **pData);
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_CHALFLIFE2_H_
|
#endif //_INCLUDE_SOURCEMOD_CHALFLIFE2_H_
|
||||||
|
|||||||
+1
-1
@@ -996,7 +996,7 @@ bool HandleSystem::TryAndFreeSomeHandles()
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_Logger.LogFatal("[SM] MEMORY LEAK DETECTED IN PLUGIN (file \"%s\")", highest_owner->GetFilename());
|
g_Logger.LogFatal("[SM] MEMORY LEAK DETECTED IN PLUGIN (file \"%s\")", highest_owner->GetFilename());
|
||||||
g_Logger.LogFatal("[SM] Reloading plugin to free %d handles.", highest_handle_count);
|
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);
|
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");
|
highest_owner->GetBaseContext()->ThrowNativeErrorEx(SP_ERROR_MEMACCESS, "Memory leak");
|
||||||
|
|||||||
+10
-8
@@ -285,14 +285,16 @@ void LibrarySystem::GetPlatformErrorEx(int code, char *error, size_t maxlength)
|
|||||||
if (error && maxlength)
|
if (error && maxlength)
|
||||||
{
|
{
|
||||||
#if defined PLATFORM_WINDOWS
|
#if defined PLATFORM_WINDOWS
|
||||||
FormatMessageA(
|
if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
NULL,
|
||||||
NULL,
|
(DWORD)code,
|
||||||
(DWORD)code,
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
(LPSTR)error,
|
||||||
(LPSTR)error,
|
maxlength,
|
||||||
maxlength,
|
NULL) == 0)
|
||||||
NULL);
|
{
|
||||||
|
UTIL_Format(error, maxlength, "error code %08x", code);
|
||||||
|
}
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_LINUX
|
||||||
const char *ae = strerror_r(code, error, maxlength);
|
const char *ae = strerror_r(code, error, maxlength);
|
||||||
if (ae != error)
|
if (ae != error)
|
||||||
|
|||||||
+3
-3
@@ -36,7 +36,7 @@
|
|||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "LibrarySys.h"
|
#include "LibrarySys.h"
|
||||||
#include "TimerSys.h"
|
#include "TimerSys.h"
|
||||||
#include "sm_version.h"
|
#include <sourcemod_version.h>
|
||||||
|
|
||||||
Logger g_Logger;
|
Logger g_Logger;
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ void Logger::_NewMapFile()
|
|||||||
} else {
|
} else {
|
||||||
char date[32];
|
char date[32];
|
||||||
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
|
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, SVN_FULL_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);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -356,7 +356,7 @@ void Logger::LogMessage(const char *vafmt, ...)
|
|||||||
char date[32];
|
char date[32];
|
||||||
m_DailyPrintHdr = false;
|
m_DailyPrintHdr = false;
|
||||||
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
|
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, SVN_FULL_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_list ap;
|
||||||
va_start(ap, vafmt);
|
va_start(ap, vafmt);
|
||||||
|
|||||||
+36
-8
@@ -5,6 +5,8 @@ SMSDK = ..
|
|||||||
SRCDS_BASE = ~/srcds
|
SRCDS_BASE = ~/srcds
|
||||||
HL2SDK_ORIG = ../../hl2sdk
|
HL2SDK_ORIG = ../../hl2sdk
|
||||||
HL2SDK_OB = ../../hl2sdk-ob
|
HL2SDK_OB = ../../hl2sdk-ob
|
||||||
|
HL2SDK_OB_VALVE = ../../hl2sdk-ob-valve
|
||||||
|
HL2SDK_L4D = ../../hl2sdk-l4d
|
||||||
MMSOURCE17 = ../../mmsource-1.7
|
MMSOURCE17 = ../../mmsource-1.7
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
@@ -18,7 +20,7 @@ OBJECTS = AdminCache.cpp CDataPack.cpp ConCmdManager.cpp ConVarManager.cpp CoreC
|
|||||||
sourcemm_api.cpp sourcemod.cpp MenuStyle_Base.cpp MenuStyle_Valve.cpp MenuManager.cpp \
|
sourcemm_api.cpp sourcemod.cpp MenuStyle_Base.cpp MenuStyle_Valve.cpp MenuManager.cpp \
|
||||||
MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp sm_crc32.cpp \
|
MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp sm_crc32.cpp \
|
||||||
frame_hooks.cpp concmd_cleaner.cpp Profiler.cpp PhraseCollection.cpp NextMap.cpp \
|
frame_hooks.cpp concmd_cleaner.cpp Profiler.cpp PhraseCollection.cpp NextMap.cpp \
|
||||||
NativeOwner.cpp GameDataFetcher.cpp md5.cpp
|
NativeOwner.cpp
|
||||||
OBJECTS += smn_admin.cpp smn_bitbuffer.cpp smn_console.cpp smn_core.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_datapacks.cpp smn_entities.cpp smn_events.cpp smn_fakenatives.cpp \
|
||||||
smn_filesystem.cpp smn_float.cpp smn_functions.cpp smn_gameconfigs.cpp smn_halflife.cpp \
|
smn_filesystem.cpp smn_float.cpp smn_functions.cpp smn_gameconfigs.cpp smn_halflife.cpp \
|
||||||
@@ -32,7 +34,8 @@ OBJECTS += ExtensionSys.cpp \
|
|||||||
LibrarySys.cpp \
|
LibrarySys.cpp \
|
||||||
PluginInfoDatabase.cpp \
|
PluginInfoDatabase.cpp \
|
||||||
PluginSys.cpp \
|
PluginSys.cpp \
|
||||||
ShareSys.cpp
|
ShareSys.cpp \
|
||||||
|
NativeInvoker.cpp
|
||||||
OBJECTS += thread/ThreadWorker.cpp thread/BaseWorker.cpp thread/PosixThreads.cpp ThreadSupport.cpp
|
OBJECTS += thread/ThreadWorker.cpp thread/BaseWorker.cpp thread/PosixThreads.cpp ThreadSupport.cpp
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
@@ -48,8 +51,9 @@ CPP = gcc
|
|||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
HL2SDK = $(HL2SDK_ORIG)
|
HL2SDK = $(HL2SDK_ORIG)
|
||||||
HL2PUB = $(HL2SDK_ORIG)/public
|
HL2PUB = $(HL2SDK)/public
|
||||||
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
|
HL2LIB = $(HL2SDK)/linux_sdk
|
||||||
|
CFLAGS += -DSOURCE_ENGINE=1
|
||||||
METAMOD = $(MMSOURCE17)/core-legacy
|
METAMOD = $(MMSOURCE17)/core-legacy
|
||||||
INCLUDE += -I$(HL2SDK)/public/dlls
|
INCLUDE += -I$(HL2SDK)/public/dlls
|
||||||
SRCDS = $(SRCDS_BASE)
|
SRCDS = $(SRCDS_BASE)
|
||||||
@@ -58,15 +62,39 @@ ifeq "$(ENGINE)" "original"
|
|||||||
endif
|
endif
|
||||||
ifeq "$(ENGINE)" "orangebox"
|
ifeq "$(ENGINE)" "orangebox"
|
||||||
HL2SDK = $(HL2SDK_OB)
|
HL2SDK = $(HL2SDK_OB)
|
||||||
HL2PUB = $(HL2SDK_OB)/public
|
HL2PUB = $(HL2SDK)/public
|
||||||
HL2LIB = $(HL2SDK_OB)/lib/linux
|
HL2LIB = $(HL2SDK)/lib/linux
|
||||||
CFLAGS += -DORANGEBOX_BUILD
|
CFLAGS += -DSOURCE_ENGINE=3
|
||||||
METAMOD = $(MMSOURCE17)/core
|
METAMOD = $(MMSOURCE17)/core
|
||||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||||
SRCDS = $(SRCDS_BASE)/orangebox
|
SRCDS = $(SRCDS_BASE)/orangebox
|
||||||
BINARY = sourcemod.2.ep2.so
|
BINARY = sourcemod.2.ep2.so
|
||||||
override ENGSET = true
|
override ENGSET = true
|
||||||
endif
|
endif
|
||||||
|
ifeq "$(ENGINE)" "orangeboxvalve"
|
||||||
|
HL2SDK = $(HL2SDK_OB_VALVE)
|
||||||
|
HL2PUB = $(HL2SDK)/public
|
||||||
|
HL2LIB = $(HL2SDK)/lib/linux
|
||||||
|
CFLAGS += -DSOURCE_ENGINE=4
|
||||||
|
METAMOD = $(MMSOURCE17)/core
|
||||||
|
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||||
|
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=5
|
||||||
|
METAMOD = $(MMSOURCE17)/core
|
||||||
|
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||||
|
SRCDS = $(SRCDS_BASE)/l4d
|
||||||
|
BINARY = sourcemod.2.l4d.so
|
||||||
|
override ENGSET = true
|
||||||
|
endif
|
||||||
|
|
||||||
|
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 -DSE_LEFT4DEAD=5
|
||||||
|
|
||||||
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a vstdlib_i486.so \
|
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a vstdlib_i486.so \
|
||||||
tier0_i486.so -lpthread -static-libgcc
|
tier0_i486.so -lpthread -static-libgcc
|
||||||
@@ -116,7 +144,7 @@ all: check
|
|||||||
|
|
||||||
check:
|
check:
|
||||||
if [ "$(ENGSET)" = "false" ]; then \
|
if [ "$(ENGSET)" = "false" ]; then \
|
||||||
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
|
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -798,5 +798,11 @@ bool MenuManager::IsClientInVotePool(int client)
|
|||||||
|
|
||||||
bool MenuManager::RedrawClientVoteMenu(int client)
|
bool MenuManager::RedrawClientVoteMenu(int client)
|
||||||
{
|
{
|
||||||
return s_VoteHandler.RedrawToClient(client);
|
return RedrawClientVoteMenu2(client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MenuManager::RedrawClientVoteMenu2(int client, bool revote)
|
||||||
|
{
|
||||||
|
return s_VoteHandler.RedrawToClient(client, revote);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ public:
|
|||||||
unsigned int GetRemainingVoteDelay();
|
unsigned int GetRemainingVoteDelay();
|
||||||
bool IsClientInVotePool(int client);
|
bool IsClientInVotePool(int client);
|
||||||
bool RedrawClientVoteMenu(int client);
|
bool RedrawClientVoteMenu(int client);
|
||||||
|
bool RedrawClientVoteMenu2(int client, bool revote);
|
||||||
public: //IHandleTypeDispatch
|
public: //IHandleTypeDispatch
|
||||||
void OnHandleDestroy(HandleType_t type, void *object);
|
void OnHandleDestroy(HandleType_t type, void *object);
|
||||||
bool GetHandleApproxSize(HandleType_t type, void *object, unsigned int *pSize);
|
bool GetHandleApproxSize(HandleType_t type, void *object, unsigned int *pSize);
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
|
|||||||
|
|
||||||
if (sound != NULL)
|
if (sound != NULL)
|
||||||
{
|
{
|
||||||
edict_t *pEdict = engine->PEntityOfEntIndex(client);
|
edict_t *pEdict = PEntityOfEntIndex(client);
|
||||||
if (pEdict)
|
if (pEdict)
|
||||||
{
|
{
|
||||||
ICollideable *pCollideable = pEdict->GetCollideable();
|
ICollideable *pCollideable = pEdict->GetCollideable();
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ void ValveMenuStyle::HookCreateMessage(edict_t *pEdict,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int client = engine->IndexOfEdict(pEdict);
|
int client = IndexOfEdict(pEdict);
|
||||||
if (client < 1 || client > 256)
|
if (client < 1 || client > 256)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -325,7 +325,7 @@ void CValveMenuDisplay::SendRawDisplay(int client, int priority, unsigned int ti
|
|||||||
m_pKv->SetInt("time", time ? time : 200);
|
m_pKv->SetInt("time", time ? time : 200);
|
||||||
|
|
||||||
SH_CALL(g_pSPHCC, &IServerPluginHelpers::CreateMessage)(
|
SH_CALL(g_pSPHCC, &IServerPluginHelpers::CreateMessage)(
|
||||||
engine->PEntityOfEntIndex(client),
|
PEntityOfEntIndex(client),
|
||||||
DIALOG_MENU,
|
DIALOG_MENU,
|
||||||
m_pKv,
|
m_pKv,
|
||||||
vsp_interface);
|
vsp_interface);
|
||||||
|
|||||||
+18
-5
@@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* vim: set ts=4 :
|
* vim: set ts=4 sw=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* 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
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
float g_next_vote = 0.0f;
|
float g_next_vote = 0.0f;
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void OnVoteDelayChange(IConVar *cvar, const char *value, float flOldValue);
|
void OnVoteDelayChange(IConVar *cvar, const char *value, float flOldValue);
|
||||||
#else
|
#else
|
||||||
void OnVoteDelayChange(ConVar *cvar, const char *value);
|
void OnVoteDelayChange(ConVar *cvar, const char *value);
|
||||||
@@ -52,7 +52,7 @@ ConVar sm_vote_delay("sm_vote_delay",
|
|||||||
0.0,
|
0.0,
|
||||||
OnVoteDelayChange);
|
OnVoteDelayChange);
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void OnVoteDelayChange(IConVar *cvar, const char *value, float flOldValue)
|
void OnVoteDelayChange(IConVar *cvar, const char *value, float flOldValue)
|
||||||
#else
|
#else
|
||||||
void OnVoteDelayChange(ConVar *cvar, const char *value)
|
void OnVoteDelayChange(ConVar *cvar, const char *value)
|
||||||
@@ -205,7 +205,7 @@ bool VoteMenuHandler::GetClientVoteChoice(int client, unsigned int *pItem)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VoteMenuHandler::RedrawToClient(int client)
|
bool VoteMenuHandler::RedrawToClient(int client, bool revotes)
|
||||||
{
|
{
|
||||||
unsigned int time_limit;
|
unsigned int time_limit;
|
||||||
|
|
||||||
@@ -214,6 +214,18 @@ bool VoteMenuHandler::RedrawToClient(int client)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_ClientVotes[client] >= 0)
|
||||||
|
{
|
||||||
|
if ((m_VoteFlags & VOTEFLAG_NO_REVOTES) == VOTEFLAG_NO_REVOTES || !revotes)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
assert((unsigned)m_ClientVotes[client] < m_Items);
|
||||||
|
assert(m_Votes[m_ClientVotes[client]] > 0);
|
||||||
|
m_Votes[m_ClientVotes[client]]--;
|
||||||
|
m_ClientVotes[client] = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_nMenuTime == MENU_TIME_FOREVER)
|
if (m_nMenuTime == MENU_TIME_FOREVER)
|
||||||
{
|
{
|
||||||
time_limit = m_nMenuTime;
|
time_limit = m_nMenuTime;
|
||||||
@@ -489,3 +501,4 @@ bool VoteMenuHandler::IsCancelling()
|
|||||||
{
|
{
|
||||||
return m_bCancelled;
|
return m_bCancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -74,7 +74,7 @@ public:
|
|||||||
unsigned int GetRemainingVoteDelay();
|
unsigned int GetRemainingVoteDelay();
|
||||||
bool IsClientInVotePool(int client);
|
bool IsClientInVotePool(int client);
|
||||||
bool GetClientVoteChoice(int client, unsigned int *pItem);
|
bool GetClientVoteChoice(int client, unsigned int *pItem);
|
||||||
bool RedrawToClient(int client);
|
bool RedrawToClient(int client, bool revote);
|
||||||
private:
|
private:
|
||||||
void Reset(IMenuHandler *mh);
|
void Reset(IMenuHandler *mh);
|
||||||
void DecrementPlayerCount();
|
void DecrementPlayerCount();
|
||||||
@@ -102,3 +102,4 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_MENUVOTING_H_
|
#endif //_INCLUDE_SOURCEMOD_MENUVOTING_H_
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,379 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* =============================================================================
|
||||||
|
* SourcePawn
|
||||||
|
* 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 "NativeInvoker.h"
|
||||||
|
#include "ShareSys.h"
|
||||||
|
|
||||||
|
NativeInterface g_NInvoke;
|
||||||
|
|
||||||
|
NativeInvoker::NativeInvoker()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
NativeInvoker::~NativeInvoker()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *NativeInterface::GetInterfaceName()
|
||||||
|
{
|
||||||
|
return SMINTERFACE_NINVOKE_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int NativeInterface::GetInterfaceVersion()
|
||||||
|
{
|
||||||
|
return SMINTERFACE_NINVOKE_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeInterface::OnSourceModAllInitialized()
|
||||||
|
{
|
||||||
|
g_ShareSys.AddInterface(NULL, &g_NInvoke);
|
||||||
|
}
|
||||||
|
|
||||||
|
IPluginRuntime *NativeInterface::CreateRuntime(const char *name, size_t bytes)
|
||||||
|
{
|
||||||
|
return g_pSourcePawn2->CreateEmptyRuntime(name, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
INativeInvoker *NativeInterface::CreateInvoker()
|
||||||
|
{
|
||||||
|
return new NativeInvoker();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NativeInvoker::Start(IPluginContext *pContext, const char *name)
|
||||||
|
{
|
||||||
|
NativeEntry *entry;
|
||||||
|
|
||||||
|
entry = g_ShareSys.FindNative(name);
|
||||||
|
if (entry == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
native = NULL;
|
||||||
|
if (entry->replacement.owner != NULL)
|
||||||
|
{
|
||||||
|
native = entry->replacement.func;
|
||||||
|
}
|
||||||
|
else if (entry->owner != NULL)
|
||||||
|
{
|
||||||
|
native = entry->func;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (native == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->pContext = pContext;
|
||||||
|
|
||||||
|
m_curparam = 0;
|
||||||
|
m_errorstate = SP_ERROR_NONE;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_t NativeInvoker::PushCell(cell_t cell)
|
||||||
|
{
|
||||||
|
if (m_curparam >= SP_MAX_EXEC_PARAMS)
|
||||||
|
{
|
||||||
|
return SetError(SP_ERROR_PARAMS_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_info[m_curparam].marked = false;
|
||||||
|
m_params[m_curparam] = cell;
|
||||||
|
m_curparam++;
|
||||||
|
|
||||||
|
return SP_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::PushCellByRef(cell_t *cell, int flags)
|
||||||
|
{
|
||||||
|
return PushArray(cell, 1, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::PushFloat(float number)
|
||||||
|
{
|
||||||
|
cell_t val = *(cell_t *)&number;
|
||||||
|
|
||||||
|
return PushCell(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::PushFloatByRef(float *number, int flags)
|
||||||
|
{
|
||||||
|
return PushCellByRef((cell_t *)number, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::PushArray(cell_t *inarray, unsigned int cells, int copyback)
|
||||||
|
{
|
||||||
|
if (m_curparam >= SP_MAX_EXEC_PARAMS)
|
||||||
|
{
|
||||||
|
return SetError(SP_ERROR_PARAMS_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
ParamInfo *info = &m_info[m_curparam];
|
||||||
|
|
||||||
|
info->flags = inarray ? copyback : 0;
|
||||||
|
info->marked = true;
|
||||||
|
info->size = cells;
|
||||||
|
info->str.is_sz = false;
|
||||||
|
info->orig_addr = inarray;
|
||||||
|
|
||||||
|
m_curparam++;
|
||||||
|
|
||||||
|
return SP_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::PushString(const char *string)
|
||||||
|
{
|
||||||
|
return _PushString(string, SM_PARAM_STRING_COPY, 0, strlen(string)+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::PushStringEx(char *buffer, size_t length, int sz_flags, int cp_flags)
|
||||||
|
{
|
||||||
|
return _PushString(buffer, sz_flags, cp_flags, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::_PushString(const char *string, int sz_flags, int cp_flags, size_t len)
|
||||||
|
{
|
||||||
|
if (m_curparam >= SP_MAX_EXEC_PARAMS)
|
||||||
|
{
|
||||||
|
return SetError(SP_ERROR_PARAMS_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
ParamInfo *info = &m_info[m_curparam];
|
||||||
|
|
||||||
|
info->marked = true;
|
||||||
|
info->orig_addr = (cell_t *)string;
|
||||||
|
info->flags = cp_flags;
|
||||||
|
info->size = len;
|
||||||
|
info->str.sz_flags = sz_flags;
|
||||||
|
info->str.is_sz = true;
|
||||||
|
|
||||||
|
m_curparam++;
|
||||||
|
|
||||||
|
return SP_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeInvoker::Cancel()
|
||||||
|
{
|
||||||
|
if (pContext == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_errorstate = SP_ERROR_NONE;
|
||||||
|
m_curparam = 0;
|
||||||
|
pContext = NULL;
|
||||||
|
native = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::SetError(int err)
|
||||||
|
{
|
||||||
|
m_errorstate = err;
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::Invoke(cell_t *result)
|
||||||
|
{
|
||||||
|
int err = SP_ERROR_NONE;
|
||||||
|
|
||||||
|
if (pContext == NULL)
|
||||||
|
{
|
||||||
|
return SP_ERROR_INVALID_NATIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_errorstate != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
err = m_errorstate;
|
||||||
|
Cancel();
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_t tresult;
|
||||||
|
|
||||||
|
if (result == NULL)
|
||||||
|
{
|
||||||
|
result = &tresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This is for re-entrancy!
|
||||||
|
IPluginContext *ctx = pContext;
|
||||||
|
cell_t _temp_params[SP_MAX_EXEC_PARAMS + 1];
|
||||||
|
cell_t *temp_params = &_temp_params[1];
|
||||||
|
ParamInfo temp_info[SP_MAX_EXEC_PARAMS];
|
||||||
|
unsigned int numparams = m_curparam;
|
||||||
|
unsigned int i;
|
||||||
|
bool docopies = true;
|
||||||
|
|
||||||
|
if (numparams)
|
||||||
|
{
|
||||||
|
//Save the info locally, then reset it for re-entrant calls.
|
||||||
|
memcpy(temp_info, m_info, numparams * sizeof(ParamInfo));
|
||||||
|
}
|
||||||
|
m_curparam = 0;
|
||||||
|
pContext = NULL;
|
||||||
|
|
||||||
|
/* Initialize 0th parameter */
|
||||||
|
_temp_params[0] = numparams;
|
||||||
|
|
||||||
|
/* Browse the parameters and build arrays */
|
||||||
|
for (i = 0; i < numparams; i++)
|
||||||
|
{
|
||||||
|
/* Is this marked as an array? */
|
||||||
|
if (temp_info[i].marked)
|
||||||
|
{
|
||||||
|
if (!temp_info[i].str.is_sz)
|
||||||
|
{
|
||||||
|
/* Allocate a normal/generic array */
|
||||||
|
if ((err = ctx->HeapAlloc(temp_info[i].size,
|
||||||
|
&temp_info[i].local_addr,
|
||||||
|
&temp_info[i].phys_addr))
|
||||||
|
!= SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (temp_info[i].orig_addr)
|
||||||
|
{
|
||||||
|
memcpy(temp_info[i].phys_addr, temp_info[i].orig_addr, sizeof(cell_t) * temp_info[i].size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Calculate cells required for the string */
|
||||||
|
size_t cells = (temp_info[i].size + sizeof(cell_t) - 1) / sizeof(cell_t);
|
||||||
|
|
||||||
|
/* Allocate the buffer */
|
||||||
|
if ((err = ctx->HeapAlloc(cells,
|
||||||
|
&temp_info[i].local_addr,
|
||||||
|
&temp_info[i].phys_addr))
|
||||||
|
!= SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* Copy original string if necessary */
|
||||||
|
if ((temp_info[i].str.sz_flags & SM_PARAM_STRING_COPY) && (temp_info[i].orig_addr != NULL))
|
||||||
|
{
|
||||||
|
/* Cut off UTF-8 properly */
|
||||||
|
if (temp_info[i].str.sz_flags & SM_PARAM_STRING_UTF8)
|
||||||
|
{
|
||||||
|
if ((err = ctx->StringToLocalUTF8(temp_info[i].local_addr,
|
||||||
|
temp_info[i].size,
|
||||||
|
(const char *)temp_info[i].orig_addr,
|
||||||
|
NULL))
|
||||||
|
!= SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Copy a binary blob */
|
||||||
|
else if (temp_info[i].str.sz_flags & SM_PARAM_STRING_BINARY)
|
||||||
|
{
|
||||||
|
memmove(temp_info[i].phys_addr, temp_info[i].orig_addr, temp_info[i].size);
|
||||||
|
}
|
||||||
|
/* Copy ASCII characters */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((err = ctx->StringToLocal(temp_info[i].local_addr,
|
||||||
|
temp_info[i].size,
|
||||||
|
(const char *)temp_info[i].orig_addr))
|
||||||
|
!= SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* End array/string calculation */
|
||||||
|
/* Update the pushed parameter with the byref local address */
|
||||||
|
temp_params[i] = temp_info[i].local_addr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Just copy the value normally */
|
||||||
|
temp_params[i] = m_params[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make the call if we can */
|
||||||
|
if (err == SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
*result = native(ctx, _temp_params);
|
||||||
|
if (ctx->GetLastNativeError() != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
docopies = false;
|
||||||
|
ctx->ClearLastNativeError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
docopies = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* i should be equal to the last valid parameter + 1 */
|
||||||
|
while (i--)
|
||||||
|
{
|
||||||
|
if (!temp_info[i].marked)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (docopies && (temp_info[i].flags & SM_PARAM_COPYBACK))
|
||||||
|
{
|
||||||
|
if (temp_info[i].orig_addr)
|
||||||
|
{
|
||||||
|
if (temp_info[i].str.is_sz)
|
||||||
|
{
|
||||||
|
memcpy(temp_info[i].orig_addr, temp_info[i].phys_addr, temp_info[i].size);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (temp_info[i].size == 1)
|
||||||
|
{
|
||||||
|
*temp_info[i].orig_addr = *(temp_info[i].phys_addr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memcpy(temp_info[i].orig_addr,
|
||||||
|
temp_info[i].phys_addr,
|
||||||
|
temp_info[i].size * sizeof(cell_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((err = ctx->HeapPop(temp_info[i].local_addr)) != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* =============================================================================
|
||||||
|
* 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_NATIVE_INVOKER_H_
|
||||||
|
#define _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_
|
||||||
|
|
||||||
|
#include "sm_globals.h"
|
||||||
|
#include <INativeInvoker.h>
|
||||||
|
|
||||||
|
struct ParamInfo
|
||||||
|
{
|
||||||
|
int flags; /* Copy-back flags */
|
||||||
|
bool marked; /* Whether this is marked as being used */
|
||||||
|
cell_t local_addr; /* Local address to free */
|
||||||
|
cell_t *phys_addr; /* Physical address of our copy */
|
||||||
|
cell_t *orig_addr; /* Original address to copy back to */
|
||||||
|
ucell_t size; /* Size of array in bytes */
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
bool is_sz; /* is a string */
|
||||||
|
int sz_flags; /* has sz flags */
|
||||||
|
} str;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NativeInvoker : public INativeInvoker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NativeInvoker();
|
||||||
|
~NativeInvoker();
|
||||||
|
public: /* ICallable */
|
||||||
|
int PushCell(cell_t cell);
|
||||||
|
int PushCellByRef(cell_t *cell, int flags=SM_PARAM_COPYBACK);
|
||||||
|
int PushFloat(float number);
|
||||||
|
int PushFloatByRef(float *number, int flags=SM_PARAM_COPYBACK);
|
||||||
|
int PushArray(cell_t *inarray, unsigned int cells, int flags=0);
|
||||||
|
int PushString(const char *string);
|
||||||
|
int PushStringEx(char *buffer, size_t length, int sz_flags, int cp_flags);
|
||||||
|
void Cancel();
|
||||||
|
public: /* INativeInvoker */
|
||||||
|
bool Start(IPluginContext *pContext, const char *name);
|
||||||
|
int Invoke(cell_t *result);
|
||||||
|
private:
|
||||||
|
int _PushString(const char *string, int sz_flags, int cp_flags, size_t len);
|
||||||
|
int SetError(int err);
|
||||||
|
private:
|
||||||
|
IPluginContext *pContext;
|
||||||
|
SPVM_NATIVE_FUNC native;
|
||||||
|
cell_t m_params[SP_MAX_EXEC_PARAMS];
|
||||||
|
ParamInfo m_info[SP_MAX_EXEC_PARAMS];
|
||||||
|
unsigned int m_curparam;
|
||||||
|
int m_errorstate;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NativeInterface :
|
||||||
|
public INativeInterface,
|
||||||
|
public SMGlobalClass
|
||||||
|
{
|
||||||
|
public: /* SMGlobalClass */
|
||||||
|
void OnSourceModAllInitialized();
|
||||||
|
public: /* SMInterface */
|
||||||
|
unsigned int GetInterfaceVersion();
|
||||||
|
const char *GetInterfaceName();
|
||||||
|
public: /* INativeInvoker */
|
||||||
|
IPluginRuntime *CreateRuntime(const char *name, size_t bytes);
|
||||||
|
INativeInvoker *CreateInvoker();
|
||||||
|
};
|
||||||
|
|
||||||
|
extern NativeInterface g_NInvoke;
|
||||||
|
|
||||||
|
#endif /* _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_ */
|
||||||
+19
-22
@@ -38,10 +38,16 @@
|
|||||||
|
|
||||||
NextMapManager g_NextMap;
|
NextMapManager g_NextMap;
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
SH_DECL_HOOK2_void(IVEngineServer, ChangeLevel, SH_NOATTRIB, 0, const char *, const char *);
|
SH_DECL_HOOK2_void(IVEngineServer, ChangeLevel, SH_NOATTRIB, 0, const char *, const char *);
|
||||||
|
#else
|
||||||
|
SH_DECL_HOOK4_void(IVEngineServer, ChangeLevel, SH_NOATTRIB, 0, const char *, const char *, const char *, bool);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
||||||
|
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||||
|
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||||
#else
|
#else
|
||||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||||
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||||
@@ -55,30 +61,13 @@ bool g_forcedChange = false;
|
|||||||
|
|
||||||
void NextMapManager::OnSourceModAllInitialized_Post()
|
void NextMapManager::OnSourceModAllInitialized_Post()
|
||||||
{
|
{
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
SH_ADD_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
|
SH_ADD_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
|
||||||
#else
|
#else
|
||||||
SH_ADD_HOOK_MEMFUNC(IVEngineServer, ChangeLevel, engine, this, &NextMapManager::HookChangeLevel, false);
|
SH_ADD_HOOK_MEMFUNC(IVEngineServer, ChangeLevel, engine, this, &NextMapManager::HookChangeLevel, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ConCommandBase *pBase = icvar->GetCommands();
|
ConCommand *pCmd = FindCommand("changelevel");
|
||||||
ConCommand *pCmd = NULL;
|
|
||||||
while (pBase)
|
|
||||||
{
|
|
||||||
if (strcmp(pBase->GetName(), "changelevel") == 0)
|
|
||||||
{
|
|
||||||
/* Don't want to return convar with same name */
|
|
||||||
if (!pBase->IsCommand())
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pCmd = (ConCommand *)pBase;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pCmd != NULL)
|
if (pCmd != NULL)
|
||||||
{
|
{
|
||||||
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pCmd, CmdChangeLevelCallback, false);
|
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pCmd, CmdChangeLevelCallback, false);
|
||||||
@@ -88,7 +77,7 @@ void NextMapManager::OnSourceModAllInitialized_Post()
|
|||||||
|
|
||||||
void NextMapManager::OnSourceModShutdown()
|
void NextMapManager::OnSourceModShutdown()
|
||||||
{
|
{
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
SH_REMOVE_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
|
SH_REMOVE_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
|
||||||
#else
|
#else
|
||||||
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, ChangeLevel, engine, this, &NextMapManager::HookChangeLevel, false);
|
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, ChangeLevel, engine, this, &NextMapManager::HookChangeLevel, false);
|
||||||
@@ -126,7 +115,11 @@ bool NextMapManager::SetNextMap(const char *map)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
void NextMapManager::HookChangeLevel(const char *map, const char *unknown)
|
void NextMapManager::HookChangeLevel(const char *map, const char *unknown)
|
||||||
|
#else
|
||||||
|
void NextMapManager::HookChangeLevel(const char *map, const char *unknown, const char *video, bool bLongLoading)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (g_forcedChange)
|
if (g_forcedChange)
|
||||||
{
|
{
|
||||||
@@ -146,7 +139,11 @@ void NextMapManager::HookChangeLevel(const char *map, const char *unknown)
|
|||||||
UTIL_Format(m_tempChangeInfo.m_mapName, sizeof(m_tempChangeInfo.m_mapName), newmap);
|
UTIL_Format(m_tempChangeInfo.m_mapName, sizeof(m_tempChangeInfo.m_mapName), newmap);
|
||||||
UTIL_Format(m_tempChangeInfo.m_changeReason, sizeof(m_tempChangeInfo.m_changeReason), "Normal level change");
|
UTIL_Format(m_tempChangeInfo.m_changeReason, sizeof(m_tempChangeInfo.m_changeReason), "Normal level change");
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::ChangeLevel, (newmap, unknown));
|
RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::ChangeLevel, (newmap, unknown));
|
||||||
|
#else
|
||||||
|
RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::ChangeLevel, (newmap, unknown, video, bLongLoading));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void NextMapManager::OnSourceModLevelChange( const char *mapName )
|
void NextMapManager::OnSourceModLevelChange( const char *mapName )
|
||||||
@@ -203,7 +200,7 @@ NextMapManager::NextMapManager()
|
|||||||
m_mapHistory = SourceHook::List<MapChangeData *>();
|
m_mapHistory = SourceHook::List<MapChangeData *>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void CmdChangeLevelCallback(const CCommand &command)
|
void CmdChangeLevelCallback(const CCommand &command)
|
||||||
{
|
{
|
||||||
#else
|
#else
|
||||||
|
|||||||
+6
-2
@@ -58,7 +58,7 @@ struct MapChangeData
|
|||||||
time_t startTime;
|
time_t startTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void CmdChangeLevelCallback(const CCommand &command);
|
void CmdChangeLevelCallback(const CCommand &command);
|
||||||
#else
|
#else
|
||||||
void CmdChangeLevelCallback();
|
void CmdChangeLevelCallback();
|
||||||
@@ -69,7 +69,7 @@ class NextMapManager : public SMGlobalClass
|
|||||||
public:
|
public:
|
||||||
NextMapManager();
|
NextMapManager();
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
friend void CmdChangeLevelCallback(const CCommand &command);
|
friend void CmdChangeLevelCallback(const CCommand &command);
|
||||||
#else
|
#else
|
||||||
friend void CmdChangeLevelCallback();
|
friend void CmdChangeLevelCallback();
|
||||||
@@ -84,7 +84,11 @@ public:
|
|||||||
|
|
||||||
void ForceChangeLevel(const char *mapName, const char* changeReason);
|
void ForceChangeLevel(const char *mapName, const char* changeReason);
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
void HookChangeLevel(const char *map, const char *unknown);
|
void HookChangeLevel(const char *map, const char *unknown);
|
||||||
|
#else
|
||||||
|
void HookChangeLevel(const char *map, const char *unknown, const char *video, bool bLongLoading);
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SourceHook::List<MapChangeData *> m_mapHistory;
|
SourceHook::List<MapChangeData *> m_mapHistory;
|
||||||
|
|||||||
+117
-35
@@ -47,6 +47,7 @@
|
|||||||
#include <iclient.h>
|
#include <iclient.h>
|
||||||
#include "GameConfigs.h"
|
#include "GameConfigs.h"
|
||||||
#include "ExtensionSys.h"
|
#include "ExtensionSys.h"
|
||||||
|
#include <sourcemod_version.h>
|
||||||
|
|
||||||
PlayerManager g_Players;
|
PlayerManager g_Players;
|
||||||
bool g_OnMapStarted = false;
|
bool g_OnMapStarted = false;
|
||||||
@@ -61,7 +62,7 @@ List<ICommandTargetProcessor *> target_processors;
|
|||||||
SH_DECL_HOOK5(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, edict_t *, const char *, const char *, char *, int);
|
SH_DECL_HOOK5(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, edict_t *, const char *, const char *, char *, int);
|
||||||
SH_DECL_HOOK2_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, edict_t *, const char *);
|
SH_DECL_HOOK2_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, edict_t *, const char *);
|
||||||
SH_DECL_HOOK1_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, edict_t *);
|
SH_DECL_HOOK1_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, edict_t *);
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &);
|
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &);
|
||||||
#else
|
#else
|
||||||
SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
|
SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
|
||||||
@@ -69,8 +70,10 @@ SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *)
|
|||||||
SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, edict_t *);
|
SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, edict_t *);
|
||||||
SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int);
|
SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int);
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
||||||
|
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||||
|
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||||
#else
|
#else
|
||||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||||
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||||
@@ -78,6 +81,8 @@ extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelega
|
|||||||
|
|
||||||
ConCommand *maxplayersCmd = NULL;
|
ConCommand *maxplayersCmd = NULL;
|
||||||
|
|
||||||
|
unsigned int g_PlayerSerialCount = 0;
|
||||||
|
|
||||||
class KickPlayerTimer : public ITimedEvent
|
class KickPlayerTimer : public ITimedEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -151,24 +156,7 @@ void PlayerManager::OnSourceModAllInitialized()
|
|||||||
|
|
||||||
g_ConVarManager.AddConVarChangeListener("tv_enable", this);
|
g_ConVarManager.AddConVarChangeListener("tv_enable", this);
|
||||||
|
|
||||||
ConCommandBase *pBase = icvar->GetCommands();
|
ConCommand *pCmd = FindCommand("maxplayers");
|
||||||
ConCommand *pCmd = NULL;
|
|
||||||
while (pBase)
|
|
||||||
{
|
|
||||||
if (strcmp(pBase->GetName(), "maxplayers") == 0)
|
|
||||||
{
|
|
||||||
/* Don't want to return convar with same name */
|
|
||||||
if (!pBase->IsCommand())
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pCmd = (ConCommand *)pBase;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pCmd != NULL)
|
if (pCmd != NULL)
|
||||||
{
|
{
|
||||||
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pCmd, CmdMaxplayersCallback, true);
|
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pCmd, CmdMaxplayersCallback, true);
|
||||||
@@ -415,7 +403,7 @@ void PlayerManager::RunAuthChecks()
|
|||||||
|
|
||||||
bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
||||||
{
|
{
|
||||||
int client = engine->IndexOfEdict(pEntity);
|
int client = IndexOfEdict(pEntity);
|
||||||
CPlayer *pPlayer = &m_Players[client];
|
CPlayer *pPlayer = &m_Players[client];
|
||||||
|
|
||||||
List<IClientListener *>::iterator iter;
|
List<IClientListener *>::iterator iter;
|
||||||
@@ -433,7 +421,7 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
|
|||||||
|
|
||||||
pPlayer->Initialize(pszName, pszAddress, pEntity);
|
pPlayer->Initialize(pszName, pszAddress, pEntity);
|
||||||
m_clconnect->PushCell(client);
|
m_clconnect->PushCell(client);
|
||||||
m_clconnect->PushStringEx(reject, maxrejectlen, SM_PARAM_STRING_UTF8, SM_PARAM_COPYBACK);
|
m_clconnect->PushStringEx(reject, maxrejectlen, SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
|
||||||
m_clconnect->PushCell(maxrejectlen);
|
m_clconnect->PushCell(maxrejectlen);
|
||||||
m_clconnect->Execute(&res);
|
m_clconnect->Execute(&res);
|
||||||
|
|
||||||
@@ -459,7 +447,7 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
|
|||||||
|
|
||||||
bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
||||||
{
|
{
|
||||||
int client = engine->IndexOfEdict(pEntity);
|
int client = IndexOfEdict(pEntity);
|
||||||
bool orig_value = META_RESULT_ORIG_RET(bool);
|
bool orig_value = META_RESULT_ORIG_RET(bool);
|
||||||
CPlayer *pPlayer = &m_Players[client];
|
CPlayer *pPlayer = &m_Players[client];
|
||||||
|
|
||||||
@@ -499,7 +487,7 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
|
|||||||
void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername)
|
void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername)
|
||||||
{
|
{
|
||||||
cell_t res;
|
cell_t res;
|
||||||
int client = engine->IndexOfEdict(pEntity);
|
int client = IndexOfEdict(pEntity);
|
||||||
CPlayer *pPlayer = &m_Players[client];
|
CPlayer *pPlayer = &m_Players[client];
|
||||||
|
|
||||||
/* If they're not connected, they're a bot */
|
/* If they're not connected, they're a bot */
|
||||||
@@ -597,7 +585,7 @@ void PlayerManager::OnSourceModLevelEnd()
|
|||||||
void PlayerManager::OnClientDisconnect(edict_t *pEntity)
|
void PlayerManager::OnClientDisconnect(edict_t *pEntity)
|
||||||
{
|
{
|
||||||
cell_t res;
|
cell_t res;
|
||||||
int client = engine->IndexOfEdict(pEntity);
|
int client = IndexOfEdict(pEntity);
|
||||||
CPlayer *pPlayer = &m_Players[client];
|
CPlayer *pPlayer = &m_Players[client];
|
||||||
|
|
||||||
if (pPlayer->IsConnected())
|
if (pPlayer->IsConnected())
|
||||||
@@ -635,7 +623,7 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
|
|||||||
void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
|
void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
|
||||||
{
|
{
|
||||||
cell_t res;
|
cell_t res;
|
||||||
int client = engine->IndexOfEdict(pEntity);
|
int client = IndexOfEdict(pEntity);
|
||||||
|
|
||||||
m_cldisconnect_post->PushCell(client);
|
m_cldisconnect_post->PushCell(client);
|
||||||
m_cldisconnect_post->Execute(&res, NULL);
|
m_cldisconnect_post->Execute(&res, NULL);
|
||||||
@@ -649,7 +637,28 @@ void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
void ClientConsolePrint(edict_t *e, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
char buffer[512];
|
||||||
|
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
size_t len = vsnprintf(buffer, sizeof(buffer), fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
if (len >= sizeof(buffer) - 1)
|
||||||
|
{
|
||||||
|
buffer[sizeof(buffer) - 2] = '\n';
|
||||||
|
buffer[sizeof(buffer) - 1] = '\0';
|
||||||
|
} else {
|
||||||
|
buffer[len++] = '\n';
|
||||||
|
buffer[len] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
engine->ClientPrintf(e, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void PlayerManager::OnClientCommand(edict_t *pEntity, const CCommand &args)
|
void PlayerManager::OnClientCommand(edict_t *pEntity, const CCommand &args)
|
||||||
{
|
{
|
||||||
#else
|
#else
|
||||||
@@ -657,7 +666,7 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
|
|||||||
{
|
{
|
||||||
CCommand args;
|
CCommand args;
|
||||||
#endif
|
#endif
|
||||||
int client = engine->IndexOfEdict(pEntity);
|
int client = IndexOfEdict(pEntity);
|
||||||
cell_t res = Pl_Continue;
|
cell_t res = Pl_Continue;
|
||||||
CPlayer *pPlayer = &m_Players[client];
|
CPlayer *pPlayer = &m_Players[client];
|
||||||
|
|
||||||
@@ -666,6 +675,39 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(args.Arg(0), "sm") == 0)
|
||||||
|
{
|
||||||
|
if (args.ArgC() > 1 && strcmp(args.Arg(1), "plugins") == 0)
|
||||||
|
{
|
||||||
|
g_PluginSys.ListPluginsToClient(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, Borja \"faluco\" Ferrer");
|
||||||
|
ClientConsolePrint(pEntity,
|
||||||
|
" Scott \"Damaged Soul\" 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", SM_FULL_VERSION);
|
||||||
|
ClientConsolePrint(pEntity,
|
||||||
|
"To see running plugins, type \"sm plugins\"");
|
||||||
|
ClientConsolePrint(pEntity,
|
||||||
|
"To see credits, type \"sm credits\"");
|
||||||
|
ClientConsolePrint(pEntity,
|
||||||
|
"Visit http://www.sourcemod.net/");
|
||||||
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
|
}
|
||||||
|
|
||||||
g_HL2.PushCommandStack(&args);
|
g_HL2.PushCommandStack(&args);
|
||||||
|
|
||||||
int argcount = args.ArgC() - 1;
|
int argcount = args.ArgC() - 1;
|
||||||
@@ -712,7 +754,7 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
|
|||||||
void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
|
void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
|
||||||
{
|
{
|
||||||
cell_t res;
|
cell_t res;
|
||||||
int client = engine->IndexOfEdict(pEntity);
|
int client = IndexOfEdict(pEntity);
|
||||||
CPlayer *pPlayer = &m_Players[client];
|
CPlayer *pPlayer = &m_Players[client];
|
||||||
|
|
||||||
if (!pPlayer->IsConnected())
|
if (!pPlayer->IsConnected())
|
||||||
@@ -720,9 +762,14 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_clinfochanged->PushCell(engine->IndexOfEdict(pEntity));
|
m_clinfochanged->PushCell(client);
|
||||||
m_clinfochanged->Execute(&res, NULL);
|
m_clinfochanged->Execute(&res, NULL);
|
||||||
|
|
||||||
|
if (pPlayer->IsFakeClient())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
IPlayerInfo *info = pPlayer->GetPlayerInfo();
|
IPlayerInfo *info = pPlayer->GetPlayerInfo();
|
||||||
const char *new_name = info ? info->GetName() : engine->GetClientConVarValue(client, "name");
|
const char *new_name = info ? info->GetName() : engine->GetClientConVarValue(client, "name");
|
||||||
const char *old_name = pPlayer->m_Name.c_str();
|
const char *old_name = pPlayer->m_Name.c_str();
|
||||||
@@ -840,7 +887,7 @@ void PlayerManager::RemoveClientListener(IClientListener *listener)
|
|||||||
|
|
||||||
IGamePlayer *PlayerManager::GetGamePlayer(edict_t *pEdict)
|
IGamePlayer *PlayerManager::GetGamePlayer(edict_t *pEdict)
|
||||||
{
|
{
|
||||||
int index = engine->IndexOfEdict(pEdict);
|
int index = IndexOfEdict(pEdict);
|
||||||
return GetGamePlayer(index);
|
return GetGamePlayer(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1280,6 +1327,11 @@ void PlayerManager::OnSourceModMaxPlayersChanged( int newvalue )
|
|||||||
|
|
||||||
void PlayerManager::MaxPlayersChanged( int newvalue /*= -1*/ )
|
void PlayerManager::MaxPlayersChanged( int newvalue /*= -1*/ )
|
||||||
{
|
{
|
||||||
|
if (!m_FirstPass)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (newvalue == -1)
|
if (newvalue == -1)
|
||||||
{
|
{
|
||||||
newvalue = gpGlobals->maxClients;
|
newvalue = gpGlobals->maxClients;
|
||||||
@@ -1311,7 +1363,29 @@ void PlayerManager::MaxPlayersChanged( int newvalue /*= -1*/ )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
int PlayerManager::GetClientFromSerial(unsigned int serial)
|
||||||
|
{
|
||||||
|
serial_t s;
|
||||||
|
s.value = serial;
|
||||||
|
|
||||||
|
int client = s.bits.index;
|
||||||
|
|
||||||
|
IGamePlayer *pPlayer = GetGamePlayer(client);
|
||||||
|
|
||||||
|
if (!pPlayer)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (serial == pPlayer->GetSerial())
|
||||||
|
{
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void CmdMaxplayersCallback(const CCommand &command)
|
void CmdMaxplayersCallback(const CCommand &command)
|
||||||
{
|
{
|
||||||
#else
|
#else
|
||||||
@@ -1349,9 +1423,12 @@ void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
|
|||||||
m_Name.assign(name);
|
m_Name.assign(name);
|
||||||
m_Ip.assign(ip);
|
m_Ip.assign(ip);
|
||||||
m_pEdict = pEntity;
|
m_pEdict = pEntity;
|
||||||
m_iIndex = engine->IndexOfEdict(pEntity);
|
m_iIndex = IndexOfEdict(pEntity);
|
||||||
m_LangId = g_Translator.GetServerLanguage();
|
m_LangId = g_Translator.GetServerLanguage();
|
||||||
|
|
||||||
|
m_Serial.bits.index = m_iIndex;
|
||||||
|
m_Serial.bits.serial = g_PlayerSerialCount++;
|
||||||
|
|
||||||
char ip2[24], *ptr;
|
char ip2[24], *ptr;
|
||||||
strncopy(ip2, ip, sizeof(ip2));
|
strncopy(ip2, ip, sizeof(ip2));
|
||||||
if ((ptr = strchr(ip2, ':')) != NULL)
|
if ((ptr = strchr(ip2, ':')) != NULL)
|
||||||
@@ -1371,7 +1448,7 @@ void CPlayer::Connect()
|
|||||||
m_IsInGame = true;
|
m_IsInGame = true;
|
||||||
|
|
||||||
const char *var = g_Players.GetPassInfoVar();
|
const char *var = g_Players.GetPassInfoVar();
|
||||||
int client = engine->IndexOfEdict(m_pEdict);
|
int client = IndexOfEdict(m_pEdict);
|
||||||
if (var[0] != '\0')
|
if (var[0] != '\0')
|
||||||
{
|
{
|
||||||
const char *pass = engine->GetClientConVarValue(client, var);
|
const char *pass = engine->GetClientConVarValue(client, var);
|
||||||
@@ -1618,7 +1695,7 @@ void CPlayer::DoBasicAdminChecks()
|
|||||||
|
|
||||||
/* First check the name */
|
/* First check the name */
|
||||||
AdminId id;
|
AdminId id;
|
||||||
int client = engine->IndexOfEdict(m_pEdict);
|
int client = IndexOfEdict(m_pEdict);
|
||||||
|
|
||||||
if ((id = g_Admins.FindAdminByIdentity("name", GetName())) != INVALID_ADMIN_ID)
|
if ((id = g_Admins.FindAdminByIdentity("name", GetName())) != INVALID_ADMIN_ID)
|
||||||
{
|
{
|
||||||
@@ -1715,3 +1792,8 @@ int CPlayer::GetLifeState()
|
|||||||
return PLAYER_LIFE_DEAD;
|
return PLAYER_LIFE_DEAD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int CPlayer::GetSerial()
|
||||||
|
{
|
||||||
|
return m_Serial.value;
|
||||||
|
}
|
||||||
|
|||||||
+17
-2
@@ -51,6 +51,16 @@ using namespace SourceHook;
|
|||||||
|
|
||||||
#define MIN_API_FOR_ADMINCALLS 7
|
#define MIN_API_FOR_ADMINCALLS 7
|
||||||
|
|
||||||
|
union serial_t
|
||||||
|
{
|
||||||
|
uint32_t value;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint8_t index;
|
||||||
|
uint32_t serial : 24;
|
||||||
|
} bits;
|
||||||
|
};
|
||||||
|
|
||||||
class CPlayer : public IGamePlayer
|
class CPlayer : public IGamePlayer
|
||||||
{
|
{
|
||||||
friend class PlayerManager;
|
friend class PlayerManager;
|
||||||
@@ -74,6 +84,7 @@ public:
|
|||||||
int GetUserId();
|
int GetUserId();
|
||||||
bool RunAdminCacheChecks();
|
bool RunAdminCacheChecks();
|
||||||
void NotifyPostAdminChecks();
|
void NotifyPostAdminChecks();
|
||||||
|
unsigned int GetSerial();
|
||||||
public:
|
public:
|
||||||
void DoBasicAdminChecks();
|
void DoBasicAdminChecks();
|
||||||
bool IsInKickQueue();
|
bool IsInKickQueue();
|
||||||
@@ -107,6 +118,7 @@ private:
|
|||||||
unsigned int m_LangId;
|
unsigned int m_LangId;
|
||||||
int m_UserId;
|
int m_UserId;
|
||||||
bool m_bFakeClient;
|
bool m_bFakeClient;
|
||||||
|
serial_t m_Serial;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PlayerManager :
|
class PlayerManager :
|
||||||
@@ -135,7 +147,7 @@ public:
|
|||||||
void OnClientPutInServer(edict_t *pEntity, char const *playername);
|
void OnClientPutInServer(edict_t *pEntity, char const *playername);
|
||||||
void OnClientDisconnect(edict_t *pEntity);
|
void OnClientDisconnect(edict_t *pEntity);
|
||||||
void OnClientDisconnect_Post(edict_t *pEntity);
|
void OnClientDisconnect_Post(edict_t *pEntity);
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void OnClientCommand(edict_t *pEntity, const CCommand &args);
|
void OnClientCommand(edict_t *pEntity, const CCommand &args);
|
||||||
#else
|
#else
|
||||||
void OnClientCommand(edict_t *pEntity);
|
void OnClientCommand(edict_t *pEntity);
|
||||||
@@ -156,6 +168,7 @@ public: //IPlayerManager
|
|||||||
void RegisterCommandTargetProcessor(ICommandTargetProcessor *pHandler);
|
void RegisterCommandTargetProcessor(ICommandTargetProcessor *pHandler);
|
||||||
void UnregisterCommandTargetProcessor(ICommandTargetProcessor *pHandler);
|
void UnregisterCommandTargetProcessor(ICommandTargetProcessor *pHandler);
|
||||||
void ProcessCommandTarget(cmd_target_info_t *info);
|
void ProcessCommandTarget(cmd_target_info_t *info);
|
||||||
|
int GetClientFromSerial(unsigned int serial);
|
||||||
public: // IConVarChangeListener
|
public: // IConVarChangeListener
|
||||||
void OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue);
|
void OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue);
|
||||||
public:
|
public:
|
||||||
@@ -204,12 +217,14 @@ private:
|
|||||||
int m_ListenClient;
|
int m_ListenClient;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void CmdMaxplayersCallback(const CCommand &command);
|
void CmdMaxplayersCallback(const CCommand &command);
|
||||||
#else
|
#else
|
||||||
void CmdMaxplayersCallback();
|
void CmdMaxplayersCallback();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern void ClientConsolePrint(edict_t *e, const char *fmt, ...);
|
||||||
|
|
||||||
extern PlayerManager g_Players;
|
extern PlayerManager g_Players;
|
||||||
extern bool g_OnMapStarted;
|
extern bool g_OnMapStarted;
|
||||||
extern const unsigned int *g_NumPlayersToAuth;
|
extern const unsigned int *g_NumPlayersToAuth;
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ SMCResult CPluginInfoDatabase::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
{
|
{
|
||||||
m_infodb_size *= 2;
|
m_infodb_size *= 2;
|
||||||
}
|
}
|
||||||
int newidx = memtab->CreateMem(m_infodb_size, (void **)&table);
|
int newidx = memtab->CreateMem(m_infodb_size * sizeof(int), (void **)&table);
|
||||||
if (m_infodb != -1)
|
if (m_infodb != -1)
|
||||||
{
|
{
|
||||||
void *oldtable = (int *)memtab->GetAddress(m_infodb);
|
void *oldtable = (int *)memtab->GetAddress(m_infodb);
|
||||||
|
|||||||
+102
-19
@@ -60,7 +60,7 @@ CPlugin::CPlugin(const char *file)
|
|||||||
m_serial = ++MySerial;
|
m_serial = ++MySerial;
|
||||||
m_pRuntime = NULL;
|
m_pRuntime = NULL;
|
||||||
m_errormsg[256] = '\0';
|
m_errormsg[256] = '\0';
|
||||||
snprintf(m_filename, sizeof(m_filename), "%s", file);
|
UTIL_Format(m_filename, sizeof(m_filename), "%s", file);
|
||||||
m_handle = 0;
|
m_handle = 0;
|
||||||
m_ident = NULL;
|
m_ident = NULL;
|
||||||
m_pProps = sm_trie_create();
|
m_pProps = sm_trie_create();
|
||||||
@@ -164,7 +164,7 @@ CPlugin *CPlugin::CreatePlugin(const char *file, char *error, size_t maxlength)
|
|||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
snprintf(error, maxlength, "Unable to open file");
|
UTIL_Format(error, maxlength, "Unable to open file");
|
||||||
}
|
}
|
||||||
pPlugin->m_status = Plugin_BadLoad;
|
pPlugin->m_status = Plugin_BadLoad;
|
||||||
return pPlugin;
|
return pPlugin;
|
||||||
@@ -210,7 +210,7 @@ void CPlugin::SetErrorState(PluginStatus status, const char *error_fmt, ...)
|
|||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, error_fmt);
|
va_start(ap, error_fmt);
|
||||||
vsnprintf(m_errormsg, sizeof(m_errormsg), error_fmt, ap);
|
UTIL_FormatArgs(m_errormsg, sizeof(m_errormsg), error_fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
if (m_pRuntime != NULL)
|
if (m_pRuntime != NULL)
|
||||||
@@ -273,13 +273,13 @@ bool CPlugin::UpdateInfo()
|
|||||||
|
|
||||||
base->GetPubvarAddrs(idx, &local_addr, (cell_t **)&info);
|
base->GetPubvarAddrs(idx, &local_addr, (cell_t **)&info);
|
||||||
m_FileVersion = info->version;
|
m_FileVersion = info->version;
|
||||||
if (m_FileVersion >= 3)
|
if (m_FileVersion >= 4)
|
||||||
{
|
{
|
||||||
base->LocalToString(info->date, (char **)&pDate);
|
base->LocalToString(info->date, (char **)&pDate);
|
||||||
base->LocalToString(info->time, (char **)&pTime);
|
base->LocalToString(info->time, (char **)&pTime);
|
||||||
UTIL_Format(m_DateTime, sizeof(m_DateTime), "%s %s", pDate, pTime);
|
UTIL_Format(m_DateTime, sizeof(m_DateTime), "%s %s", pDate, pTime);
|
||||||
}
|
}
|
||||||
if (m_FileVersion > 4)
|
if (m_FileVersion > 5)
|
||||||
{
|
{
|
||||||
base->LocalToString(info->filevers, (char **)&pFileVers);
|
base->LocalToString(info->filevers, (char **)&pFileVers);
|
||||||
SetErrorState(Plugin_Failed, "Newer SourceMod required (%s or higher)", pFileVers);
|
SetErrorState(Plugin_Failed, "Newer SourceMod required (%s or higher)", pFileVers);
|
||||||
@@ -851,7 +851,7 @@ void CPluginManager::LoadPluginsFromDir(const char *basedir, const char *localpa
|
|||||||
if (localpath == NULL)
|
if (localpath == NULL)
|
||||||
{
|
{
|
||||||
/* If no path yet, don't add a former slash */
|
/* If no path yet, don't add a former slash */
|
||||||
snprintf(new_local, sizeof(new_local), "%s", dir->GetEntryName());
|
UTIL_Format(new_local, sizeof(new_local), "%s", dir->GetEntryName());
|
||||||
} else {
|
} else {
|
||||||
g_LibSys.PathFormat(new_local, sizeof(new_local), "%s/%s", localpath, dir->GetEntryName());
|
g_LibSys.PathFormat(new_local, sizeof(new_local), "%s/%s", localpath, dir->GetEntryName());
|
||||||
}
|
}
|
||||||
@@ -866,7 +866,7 @@ void CPluginManager::LoadPluginsFromDir(const char *basedir, const char *localpa
|
|||||||
char plugin[PLATFORM_MAX_PATH];
|
char plugin[PLATFORM_MAX_PATH];
|
||||||
if (localpath == NULL)
|
if (localpath == NULL)
|
||||||
{
|
{
|
||||||
snprintf(plugin, sizeof(plugin), "%s", name);
|
UTIL_Format(plugin, sizeof(plugin), "%s", name);
|
||||||
} else {
|
} else {
|
||||||
g_LibSys.PathFormat(plugin, sizeof(plugin), "%s/%s", localpath, name);
|
g_LibSys.PathFormat(plugin, sizeof(plugin), "%s/%s", localpath, name);
|
||||||
}
|
}
|
||||||
@@ -965,7 +965,7 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
|
|||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
snprintf(error, maxlength, "Unable to set JIT option (key \"%s\") (value \"%s\")", key, val);
|
UTIL_Format(error, maxlength, "Unable to set JIT option (key \"%s\") (value \"%s\")", key, val);
|
||||||
}
|
}
|
||||||
co->Abort();
|
co->Abort();
|
||||||
co = NULL;
|
co = NULL;
|
||||||
@@ -984,7 +984,7 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
|
|||||||
pPlugin->m_pRuntime = g_pSourcePawn2->LoadPlugin(co, fullpath, &err);
|
pPlugin->m_pRuntime = g_pSourcePawn2->LoadPlugin(co, fullpath, &err);
|
||||||
if (pPlugin->m_pRuntime == NULL)
|
if (pPlugin->m_pRuntime == NULL)
|
||||||
{
|
{
|
||||||
snprintf(error,
|
UTIL_Format(error,
|
||||||
maxlength,
|
maxlength,
|
||||||
"Unable to load plugin (error %d: %s)",
|
"Unable to load plugin (error %d: %s)",
|
||||||
err,
|
err,
|
||||||
@@ -1053,13 +1053,16 @@ IPlugin *CPluginManager::LoadPlugin(const char *path, bool debug, PluginType typ
|
|||||||
|
|
||||||
if (res == LoadRes_NeverLoad)
|
if (res == LoadRes_NeverLoad)
|
||||||
{
|
{
|
||||||
if (m_LoadingLocked)
|
if (error)
|
||||||
{
|
{
|
||||||
UTIL_Format(error, maxlength, "There is a global plugin loading lock in effect");
|
if (m_LoadingLocked)
|
||||||
}
|
{
|
||||||
else
|
UTIL_Format(error, maxlength, "There is a global plugin loading lock in effect");
|
||||||
{
|
}
|
||||||
UTIL_Format(error, maxlength, "This plugin is blocked from loading (see plugin_settings.cfg)");
|
else
|
||||||
|
{
|
||||||
|
UTIL_Format(error, maxlength, "This plugin is blocked from loading (see plugin_settings.cfg)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1189,7 +1192,7 @@ bool CPluginManager::FindOrRequirePluginDeps(CPlugin *pPlugin, char *error, size
|
|||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
snprintf(error, maxlength, "Fatal error during initializing plugin load");
|
UTIL_Format(error, maxlength, "Fatal error during initializing plugin load");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1222,7 +1225,7 @@ bool CPluginManager::FindOrRequirePluginDeps(CPlugin *pPlugin, char *error, size
|
|||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
snprintf(error, maxlength, "Could not find required plugin \"%s\"", name);
|
UTIL_Format(error, maxlength, "Could not find required plugin \"%s\"", name);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1293,7 +1296,7 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass
|
|||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
snprintf(error, maxlength, "Required extension \"%s\" file(\"%s\") not running", name, file);
|
UTIL_Format(error, maxlength, "Required extension \"%s\" file(\"%s\") not running", name, file);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1361,7 +1364,7 @@ bool CPluginManager::RunSecondPass(CPlugin *pPlugin, char *error, size_t maxleng
|
|||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
snprintf(error, maxlength, "Native \"%s\" was not found", native->name);
|
UTIL_Format(error, maxlength, "Native \"%s\" was not found", native->name);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2624,3 +2627,83 @@ void CPluginManager::SyncMaxClients(int max_clients)
|
|||||||
(*iter)->SyncMaxClients(max_clients);
|
(*iter)->SyncMaxClients(max_clients);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPluginManager::ListPluginsToClient(CPlayer *player, const CCommand &args)
|
||||||
|
{
|
||||||
|
char buffer[256];
|
||||||
|
unsigned int id = 0;
|
||||||
|
int plnum = GetPluginCount();
|
||||||
|
edict_t *e = player->GetEdict();
|
||||||
|
unsigned int start = 0;
|
||||||
|
|
||||||
|
if (!plnum)
|
||||||
|
{
|
||||||
|
ClientConsolePrint(e, "[SM] No plugins found.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.ArgC() > 2)
|
||||||
|
{
|
||||||
|
start = atoi(args.Arg(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
CPlugin *pl;
|
||||||
|
SourceHook::List<CPlugin *>::iterator iter;
|
||||||
|
SourceHook::List<CPlugin *> m_FailList;
|
||||||
|
|
||||||
|
for (iter = m_plugins.begin();
|
||||||
|
iter != m_plugins.end();
|
||||||
|
iter++)
|
||||||
|
{
|
||||||
|
pl = (*iter);
|
||||||
|
|
||||||
|
if (pl->GetStatus() != Plugin_Running)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Count valid plugins */
|
||||||
|
id++;
|
||||||
|
if (id < start)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id - start > 10)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t len;
|
||||||
|
const sm_plugininfo_t *info = pl->GetPublicInfo();
|
||||||
|
len = UTIL_Format(buffer, sizeof(buffer), " \"%s\"", (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
|
||||||
|
if (IS_STR_FILLED(info->version))
|
||||||
|
{
|
||||||
|
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " (%s)", info->version);
|
||||||
|
}
|
||||||
|
if (IS_STR_FILLED(info->author))
|
||||||
|
{
|
||||||
|
UTIL_Format(&buffer[len], sizeof(buffer)-len, " by %s", info->author);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UTIL_Format(&buffer[len], sizeof(buffer)-len, " %s", pl->m_filename);
|
||||||
|
}
|
||||||
|
ClientConsolePrint(e, "%s", buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* See if we can get more plugins */
|
||||||
|
while (iter != m_plugins.end())
|
||||||
|
{
|
||||||
|
if ((*iter)->GetStatus() == Plugin_Running)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do we actually have more plugins? */
|
||||||
|
if (iter != m_plugins.end())
|
||||||
|
{
|
||||||
|
ClientConsolePrint(e, "To see more, type \"sm plugins %d\"", id + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+7
-1
@@ -47,7 +47,9 @@
|
|||||||
#include "sm_trie.h"
|
#include "sm_trie.h"
|
||||||
#include "sourcemod.h"
|
#include "sourcemod.h"
|
||||||
#include <IRootConsoleMenu.h>
|
#include <IRootConsoleMenu.h>
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
#include "convar_sm_l4d.h"
|
||||||
|
#elif (SOURCE_ENGINE == SE_ORANGEBOX) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE)
|
||||||
#include "convar_sm_ob.h"
|
#include "convar_sm_ob.h"
|
||||||
#else
|
#else
|
||||||
#include "convar_sm.h"
|
#include "convar_sm.h"
|
||||||
@@ -56,6 +58,8 @@
|
|||||||
#include "NativeOwner.h"
|
#include "NativeOwner.h"
|
||||||
#include "ShareSys.h"
|
#include "ShareSys.h"
|
||||||
|
|
||||||
|
class CPlayer;
|
||||||
|
|
||||||
using namespace SourceHook;
|
using namespace SourceHook;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -395,6 +399,8 @@ public:
|
|||||||
CPlugin *FindPluginByConsoleArg(const char *arg);
|
CPlugin *FindPluginByConsoleArg(const char *arg);
|
||||||
|
|
||||||
void SyncMaxClients(int max_clients);
|
void SyncMaxClients(int max_clients);
|
||||||
|
|
||||||
|
void ListPluginsToClient(CPlayer *player, const CCommand &args);
|
||||||
private:
|
private:
|
||||||
LoadRes _LoadPlugin(CPlugin **pPlugin, const char *path, bool debug, PluginType type, char error[], size_t maxlength);
|
LoadRes _LoadPlugin(CPlugin **pPlugin, const char *path, bool debug, PluginType type, char error[], size_t maxlength);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -128,10 +128,10 @@ public:
|
|||||||
void BindNativesToPlugin(CPlugin *pPlugin, bool bCoreOnly);
|
void BindNativesToPlugin(CPlugin *pPlugin, bool bCoreOnly);
|
||||||
void BindNativeToPlugin(CPlugin *pPlugin, NativeEntry *pEntry);
|
void BindNativeToPlugin(CPlugin *pPlugin, NativeEntry *pEntry);
|
||||||
NativeEntry *AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func);
|
NativeEntry *AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func);
|
||||||
|
NativeEntry *FindNative(const char *name);
|
||||||
private:
|
private:
|
||||||
NativeEntry *AddNativeToCache(CNativeOwner *pOwner, const sp_nativeinfo_t *ntv);
|
NativeEntry *AddNativeToCache(CNativeOwner *pOwner, const sp_nativeinfo_t *ntv);
|
||||||
void ClearNativeFromCache(CNativeOwner *pOwner, const char *name);
|
void ClearNativeFromCache(CNativeOwner *pOwner, const char *name);
|
||||||
NativeEntry *FindNative(const char *name);
|
|
||||||
void BindNativeToPlugin(CPlugin *pPlugin,
|
void BindNativeToPlugin(CPlugin *pPlugin,
|
||||||
sp_native_t *ntv,
|
sp_native_t *ntv,
|
||||||
uint32_t index,
|
uint32_t index,
|
||||||
|
|||||||
+59
-47
@@ -48,7 +48,7 @@ static int g_ws_chartable[255] = {0};
|
|||||||
|
|
||||||
bool TextParsers::IsWhitespace(const char *stream)
|
bool TextParsers::IsWhitespace(const char *stream)
|
||||||
{
|
{
|
||||||
return g_ws_chartable[(unsigned)*stream] == 1;
|
return g_ws_chartable[(unsigned char)*stream] == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextParsers::TextParsers()
|
TextParsers::TextParsers()
|
||||||
@@ -79,45 +79,6 @@ unsigned int TextParsers::GetUTF8CharBytes(const char *stream)
|
|||||||
return _GetUTF8CharBytes(stream);
|
return _GetUTF8CharBytes(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Character streams
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct CharStream
|
|
||||||
{
|
|
||||||
const char *curpos;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool CharStreamReader(void *stream, char *buffer, size_t maxlength, unsigned int *read)
|
|
||||||
{
|
|
||||||
CharStream *srdr = (CharStream *)stream;
|
|
||||||
|
|
||||||
const char *ptr = srdr->curpos;
|
|
||||||
for (size_t i=0; i<maxlength; i++)
|
|
||||||
{
|
|
||||||
if (*ptr == '\0')
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*buffer++ = *ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
*read = ptr - srdr->curpos;
|
|
||||||
|
|
||||||
srdr->curpos = ptr;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
SMCError TextParsers::ParseString_SMC(const char *stream,
|
|
||||||
ITextListener_SMC *smc,
|
|
||||||
SMCStates *states)
|
|
||||||
{
|
|
||||||
CharStream srdr = { stream };
|
|
||||||
|
|
||||||
return ParseStream_SMC(&srdr, CharStreamReader, smc, states);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File streams
|
* File streams
|
||||||
*/
|
*/
|
||||||
@@ -189,6 +150,57 @@ SMCError TextParsers::ParseSMCFile(const char *file,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct RawStream
|
||||||
|
{
|
||||||
|
const char *stream;
|
||||||
|
size_t length;
|
||||||
|
size_t pos;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool RawStreamReader(void *stream, char *buffer, size_t maxlength, unsigned int *read)
|
||||||
|
{
|
||||||
|
RawStream *rs = (RawStream *)stream;
|
||||||
|
|
||||||
|
if (rs->pos >= rs->length)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t remaining = rs->length - rs->pos;
|
||||||
|
|
||||||
|
/* Use the smaller of the two */
|
||||||
|
size_t copy = (remaining > maxlength) ? maxlength : remaining;
|
||||||
|
|
||||||
|
memcpy(buffer, &rs->stream[rs->pos], copy);
|
||||||
|
rs->pos += copy;
|
||||||
|
*read = copy;
|
||||||
|
assert(rs->pos <= rs->length);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
SMCError TextParsers::ParseSMCStream(const char *stream,
|
||||||
|
size_t length,
|
||||||
|
ITextListener_SMC *smc_listener,
|
||||||
|
SMCStates *states,
|
||||||
|
char *buffer,
|
||||||
|
size_t maxsize)
|
||||||
|
{
|
||||||
|
RawStream rs;
|
||||||
|
SMCError result;
|
||||||
|
|
||||||
|
rs.stream = stream;
|
||||||
|
rs.length = length;
|
||||||
|
rs.pos = 0;
|
||||||
|
|
||||||
|
result = ParseStream_SMC(&rs, RawStreamReader, smc_listener, states);
|
||||||
|
|
||||||
|
const char *errstr = GetSMCErrorString(result);
|
||||||
|
UTIL_Format(buffer, maxsize, "%s", errstr != NULL ? errstr : "Unknown error");
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raw parsing of streams with helper functions
|
* Raw parsing of streams with helper functions
|
||||||
*/
|
*/
|
||||||
@@ -496,7 +508,7 @@ SMCError TextParsers::ParseStream_SMC(void *stream,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Check if we're whitespace or not */
|
/* Check if we're whitespace or not */
|
||||||
if (!g_ws_chartable[(unsigned)c])
|
if (!g_ws_chartable[(unsigned char)c])
|
||||||
{
|
{
|
||||||
bool restage = false;
|
bool restage = false;
|
||||||
/* Check various special tokens:
|
/* Check various special tokens:
|
||||||
@@ -811,7 +823,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
|||||||
***************************************************/
|
***************************************************/
|
||||||
|
|
||||||
/* First strip beginning whitespace */
|
/* First strip beginning whitespace */
|
||||||
while (*ptr != '\0' && g_ws_chartable[(unsigned)*ptr] != 0)
|
while (*ptr != '\0' && g_ws_chartable[(unsigned char)*ptr] != 0)
|
||||||
{
|
{
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
@@ -864,7 +876,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
|||||||
/* Lastly, strip ending whitespace off */
|
/* Lastly, strip ending whitespace off */
|
||||||
for (size_t i=len-1; i>=0 && i<len; i--)
|
for (size_t i=len-1; i>=0 && i<len; i--)
|
||||||
{
|
{
|
||||||
if (g_ws_chartable[(unsigned)ptr[i]])
|
if (g_ws_chartable[(unsigned char)ptr[i]])
|
||||||
{
|
{
|
||||||
ptr[i] = '\0';
|
ptr[i] = '\0';
|
||||||
len--;
|
len--;
|
||||||
@@ -905,7 +917,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
|||||||
i += _GetUTF8CharBytes(&ptr[i]) - 1;
|
i += _GetUTF8CharBytes(&ptr[i]) - 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned)c] != 0);
|
alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned char)c] != 0);
|
||||||
}
|
}
|
||||||
if (!alnum)
|
if (!alnum)
|
||||||
{
|
{
|
||||||
@@ -958,12 +970,12 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
|||||||
i += _GetUTF8CharBytes(&ptr[i]) - 1;
|
i += _GetUTF8CharBytes(&ptr[i]) - 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned)c] != 0);
|
alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned char)c] != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!alnum)
|
if (!alnum)
|
||||||
{
|
{
|
||||||
if (g_ws_chartable[(unsigned)c])
|
if (g_ws_chartable[(unsigned char)c])
|
||||||
{
|
{
|
||||||
/* if it's a space, keep track of the first occurring space */
|
/* if it's a space, keep track of the first occurring space */
|
||||||
if (!first_space)
|
if (!first_space)
|
||||||
@@ -1002,7 +1014,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
|||||||
if (val_ptr)
|
if (val_ptr)
|
||||||
{
|
{
|
||||||
/* eat up spaces! there shouldn't be any h*/
|
/* eat up spaces! there shouldn't be any h*/
|
||||||
while ((*val_ptr != '\0') && g_ws_chartable[(unsigned)*val_ptr] != 0)
|
while ((*val_ptr != '\0') && g_ws_chartable[(unsigned char)*val_ptr] != 0)
|
||||||
{
|
{
|
||||||
val_ptr++;
|
val_ptr++;
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-3
@@ -70,14 +70,18 @@ public:
|
|||||||
char *buffer,
|
char *buffer,
|
||||||
size_t maxsize);
|
size_t maxsize);
|
||||||
|
|
||||||
|
SMCError ParseSMCStream(const char *stream,
|
||||||
|
size_t length,
|
||||||
|
ITextListener_SMC *smc_listener,
|
||||||
|
SMCStates *states,
|
||||||
|
char *buffer,
|
||||||
|
size_t maxsize);
|
||||||
|
|
||||||
unsigned int GetUTF8CharBytes(const char *stream);
|
unsigned int GetUTF8CharBytes(const char *stream);
|
||||||
|
|
||||||
const char *GetSMCErrorString(SMCError err);
|
const char *GetSMCErrorString(SMCError err);
|
||||||
bool IsWhitespace(const char *stream);
|
bool IsWhitespace(const char *stream);
|
||||||
private:
|
private:
|
||||||
SMCError ParseString_SMC(const char *stream,
|
|
||||||
ITextListener_SMC *smc,
|
|
||||||
SMCStates *states);
|
|
||||||
SMCError ParseStream_SMC(void *stream,
|
SMCError ParseStream_SMC(void *stream,
|
||||||
STREAMREADER srdr,
|
STREAMREADER srdr,
|
||||||
ITextListener_SMC *smc,
|
ITextListener_SMC *smc,
|
||||||
|
|||||||
+72
-13
@@ -34,7 +34,11 @@
|
|||||||
|
|
||||||
UserMessages g_UserMsgs;
|
UserMessages g_UserMsgs;
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
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);
|
SH_DECL_HOOK2(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int);
|
||||||
|
#endif
|
||||||
SH_DECL_HOOK0_void(IVEngineServer, MessageEnd, SH_NOATTRIB, 0);
|
SH_DECL_HOOK0_void(IVEngineServer, MessageEnd, SH_NOATTRIB, 0);
|
||||||
|
|
||||||
UserMessages::UserMessages() : m_InterceptBuffer(m_pBase, 2500)
|
UserMessages::UserMessages() : m_InterceptBuffer(m_pBase, 2500)
|
||||||
@@ -164,9 +168,17 @@ bf_write *UserMessages::StartMessage(int msg_id, const cell_t players[], unsigne
|
|||||||
|
|
||||||
if (m_CurFlags & USERMSG_BLOCKHOOKS)
|
if (m_CurFlags & USERMSG_BLOCKHOOKS)
|
||||||
{
|
{
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
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);
|
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
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);
|
buffer = engine->UserMessageBegin(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
@@ -193,7 +205,31 @@ bool UserMessages::EndMessage()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UserMessages::HookUserMessage2(int msg_id,
|
||||||
|
IUserMessageListener *pListener,
|
||||||
|
bool intercept)
|
||||||
|
{
|
||||||
|
return InternalHook(msg_id, pListener, intercept, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UserMessages::UnhookUserMessage2(int msg_id,
|
||||||
|
IUserMessageListener *pListener,
|
||||||
|
bool intercept)
|
||||||
|
{
|
||||||
|
return InternalUnhook(msg_id, pListener, intercept, true);
|
||||||
|
}
|
||||||
|
|
||||||
bool UserMessages::HookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
|
bool UserMessages::HookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
|
||||||
|
{
|
||||||
|
return InternalHook(msg_id, pListener, intercept, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UserMessages::UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
|
||||||
|
{
|
||||||
|
return InternalUnhook(msg_id, pListener, intercept, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UserMessages::InternalHook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew)
|
||||||
{
|
{
|
||||||
if (msg_id < 0 || msg_id >= 255)
|
if (msg_id < 0 || msg_id >= 255)
|
||||||
{
|
{
|
||||||
@@ -212,6 +248,7 @@ bool UserMessages::HookUserMessage(int msg_id, IUserMessageListener *pListener,
|
|||||||
pInfo->Callback = pListener;
|
pInfo->Callback = pListener;
|
||||||
pInfo->IsHooked = false;
|
pInfo->IsHooked = false;
|
||||||
pInfo->KillMe = false;
|
pInfo->KillMe = false;
|
||||||
|
pInfo->IsNew = isNew;
|
||||||
|
|
||||||
if (!m_HookCount++)
|
if (!m_HookCount++)
|
||||||
{
|
{
|
||||||
@@ -231,8 +268,8 @@ bool UserMessages::HookUserMessage(int msg_id, IUserMessageListener *pListener,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UserMessages::UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
|
bool UserMessages::InternalUnhook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew)
|
||||||
{
|
{
|
||||||
MsgList *pList;
|
MsgList *pList;
|
||||||
MsgIter iter;
|
MsgIter iter;
|
||||||
ListenerInfo *pInfo;
|
ListenerInfo *pInfo;
|
||||||
@@ -247,7 +284,7 @@ bool UserMessages::UnhookUserMessage(int msg_id, IUserMessageListener *pListener
|
|||||||
for (iter=pList->begin(); iter!=pList->end(); iter++)
|
for (iter=pList->begin(); iter!=pList->end(); iter++)
|
||||||
{
|
{
|
||||||
pInfo = (*iter);
|
pInfo = (*iter);
|
||||||
if (pInfo->Callback == pListener)
|
if (pInfo->Callback == pListener && pInfo->IsNew == isNew)
|
||||||
{
|
{
|
||||||
if (pInfo->IsHooked)
|
if (pInfo->IsHooked)
|
||||||
{
|
{
|
||||||
@@ -279,7 +316,11 @@ void UserMessages::_DecRefCounter()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
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)
|
bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
bool is_intercept_empty = m_msgIntercepts[msg_type].empty();
|
bool is_intercept_empty = m_msgIntercepts[msg_type].empty();
|
||||||
bool is_hook_empty = m_msgHooks[msg_type].empty();
|
bool is_hook_empty = m_msgHooks[msg_type].empty();
|
||||||
@@ -305,7 +346,11 @@ bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_typ
|
|||||||
RETURN_META_VALUE(MRES_IGNORED, NULL);
|
RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
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)
|
bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (!m_InHook)
|
if (!m_InHook)
|
||||||
{
|
{
|
||||||
@@ -319,7 +364,7 @@ bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_ty
|
|||||||
|
|
||||||
void UserMessages::OnMessageEnd_Post()
|
void UserMessages::OnMessageEnd_Post()
|
||||||
{
|
{
|
||||||
if (!m_InHook || m_BlockEndPost)
|
if (!m_InHook)
|
||||||
{
|
{
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
@@ -328,12 +373,22 @@ void UserMessages::OnMessageEnd_Post()
|
|||||||
MsgIter iter;
|
MsgIter iter;
|
||||||
ListenerInfo *pInfo;
|
ListenerInfo *pInfo;
|
||||||
|
|
||||||
|
m_InHook = false;
|
||||||
|
|
||||||
pList = &m_msgIntercepts[m_CurId];
|
pList = &m_msgIntercepts[m_CurId];
|
||||||
for (iter=pList->begin(); iter!=pList->end(); )
|
for (iter=pList->begin(); iter!=pList->end(); )
|
||||||
{
|
{
|
||||||
pInfo = (*iter);
|
pInfo = (*iter);
|
||||||
|
if (m_BlockEndPost && !pInfo->IsNew)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
pInfo->IsHooked = true;
|
pInfo->IsHooked = true;
|
||||||
pInfo->Callback->OnUserMessageSent(m_CurId);
|
pInfo->Callback->OnUserMessageSent(m_CurId);
|
||||||
|
if (pInfo->IsNew)
|
||||||
|
{
|
||||||
|
pInfo->Callback->OnPostUserMessage(m_CurId, !m_BlockEndPost);
|
||||||
|
}
|
||||||
|
|
||||||
if (pInfo->KillMe)
|
if (pInfo->KillMe)
|
||||||
{
|
{
|
||||||
@@ -347,14 +402,20 @@ void UserMessages::OnMessageEnd_Post()
|
|||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_InHook = false;
|
|
||||||
|
|
||||||
pList = &m_msgHooks[m_CurId];
|
pList = &m_msgHooks[m_CurId];
|
||||||
for (iter=pList->begin(); iter!=pList->end(); )
|
for (iter=pList->begin(); iter!=pList->end(); )
|
||||||
{
|
{
|
||||||
pInfo = (*iter);
|
pInfo = (*iter);
|
||||||
|
if (m_BlockEndPost && !pInfo->IsNew)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
pInfo->IsHooked = true;
|
pInfo->IsHooked = true;
|
||||||
pInfo->Callback->OnUserMessageSent(m_CurId);
|
pInfo->Callback->OnUserMessageSent(m_CurId);
|
||||||
|
if (pInfo->IsNew)
|
||||||
|
{
|
||||||
|
pInfo->Callback->OnPostUserMessage(m_CurId, !m_BlockEndPost);
|
||||||
|
}
|
||||||
|
|
||||||
if (pInfo->KillMe)
|
if (pInfo->KillMe)
|
||||||
{
|
{
|
||||||
@@ -435,16 +496,15 @@ void UserMessages::OnMessageEnd_Pre()
|
|||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handled)
|
if (!handled && intercepted)
|
||||||
{
|
|
||||||
goto supercede;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (intercepted)
|
|
||||||
{
|
{
|
||||||
bf_write *engine_bfw;
|
bf_write *engine_bfw;
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId, g_SMAPI->GetUserMessage(m_CurId));
|
||||||
|
#else
|
||||||
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId);
|
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId);
|
||||||
|
#endif
|
||||||
m_ReadBuffer.StartReading(m_InterceptBuffer.GetBasePointer(), m_InterceptBuffer.GetNumBytesWritten());
|
m_ReadBuffer.StartReading(m_InterceptBuffer.GetBasePointer(), m_InterceptBuffer.GetNumBytesWritten());
|
||||||
engine_bfw->WriteBitsFromBuffer(&m_ReadBuffer, m_InterceptBuffer.GetNumBitsWritten());
|
engine_bfw->WriteBitsFromBuffer(&m_ReadBuffer, m_InterceptBuffer.GetNumBitsWritten());
|
||||||
ENGINE_CALL(MessageEnd)();
|
ENGINE_CALL(MessageEnd)();
|
||||||
@@ -471,7 +531,6 @@ void UserMessages::OnMessageEnd_Pre()
|
|||||||
|
|
||||||
RETURN_META((intercepted) ? MRES_SUPERCEDE : MRES_IGNORED);
|
RETURN_META((intercepted) ? MRES_SUPERCEDE : MRES_IGNORED);
|
||||||
supercede:
|
supercede:
|
||||||
m_InHook = false;
|
|
||||||
m_BlockEndPost = true;
|
m_BlockEndPost = true;
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ struct ListenerInfo
|
|||||||
IUserMessageListener *Callback;
|
IUserMessageListener *Callback;
|
||||||
bool IsHooked;
|
bool IsHooked;
|
||||||
bool KillMe;
|
bool KillMe;
|
||||||
|
bool IsNew;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef List<ListenerInfo *> MsgList;
|
typedef List<ListenerInfo *> MsgList;
|
||||||
@@ -71,12 +72,25 @@ public: //IUserMessages
|
|||||||
bool UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept=false);
|
bool UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept=false);
|
||||||
bf_write *StartMessage(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 EndMessage();
|
||||||
|
bool HookUserMessage2(int msg_id,
|
||||||
|
IUserMessageListener *pListener,
|
||||||
|
bool intercept=false);
|
||||||
|
bool UnhookUserMessage2(int msg_id,
|
||||||
|
IUserMessageListener *pListener,
|
||||||
|
bool intercept=false);
|
||||||
public:
|
public:
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
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
|
||||||
bf_write *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type);
|
bf_write *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type);
|
||||||
bf_write *OnStartMessage_Post(IRecipientFilter *filter, int msg_type);
|
bf_write *OnStartMessage_Post(IRecipientFilter *filter, int msg_type);
|
||||||
|
#endif
|
||||||
void OnMessageEnd_Pre();
|
void OnMessageEnd_Pre();
|
||||||
void OnMessageEnd_Post();
|
void OnMessageEnd_Post();
|
||||||
private:
|
private:
|
||||||
|
bool InternalHook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew);
|
||||||
|
bool InternalUnhook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew);
|
||||||
void _DecRefCounter();
|
void _DecRefCounter();
|
||||||
private:
|
private:
|
||||||
List<ListenerInfo *> m_msgHooks[255];
|
List<ListenerInfo *> m_msgHooks[255];
|
||||||
|
|||||||
+4
-19
@@ -35,8 +35,9 @@
|
|||||||
#include "concmd_cleaner.h"
|
#include "concmd_cleaner.h"
|
||||||
#include "sm_stringutil.h"
|
#include "sm_stringutil.h"
|
||||||
#include "sourcemm_api.h"
|
#include "sourcemm_api.h"
|
||||||
|
#include "compat_wrappers.h"
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
SH_DECL_HOOK1_void(ICvar, UnregisterConCommand, SH_NOATTRIB, 0, ConCommandBase *);
|
SH_DECL_HOOK1_void(ICvar, UnregisterConCommand, SH_NOATTRIB, 0, ConCommandBase *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -56,7 +57,7 @@ ConCommandBase *FindConCommandBase(const char *name);
|
|||||||
class ConCommandCleaner : public SMGlobalClass
|
class ConCommandCleaner : public SMGlobalClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void OnSourceModAllInitialized()
|
void OnSourceModAllInitialized()
|
||||||
{
|
{
|
||||||
SH_ADD_HOOK_MEMFUNC(ICvar, UnregisterConCommand, icvar, this, &ConCommandCleaner::UnlinkConCommandBase, false);
|
SH_ADD_HOOK_MEMFUNC(ICvar, UnregisterConCommand, icvar, this, &ConCommandCleaner::UnlinkConCommandBase, false);
|
||||||
@@ -95,7 +96,7 @@ public:
|
|||||||
while (iter != tracked_bases.end())
|
while (iter != tracked_bases.end())
|
||||||
{
|
{
|
||||||
/* This is just god-awful! */
|
/* This is just god-awful! */
|
||||||
if (FindConCommandBase((*iter)->name) != (*iter)->pBase)
|
if (FindCommandBase((*iter)->name) != (*iter)->pBase)
|
||||||
{
|
{
|
||||||
pInfo = (*iter);
|
pInfo = (*iter);
|
||||||
iter = tracked_bases.erase(iter);
|
iter = tracked_bases.erase(iter);
|
||||||
@@ -143,22 +144,6 @@ public:
|
|||||||
}
|
}
|
||||||
} s_ConCmdTracker;
|
} s_ConCmdTracker;
|
||||||
|
|
||||||
ConCommandBase *FindConCommandBase(const char *name)
|
|
||||||
{
|
|
||||||
const ConCommandBase *pBase = icvar->GetCommands();
|
|
||||||
|
|
||||||
while (pBase != NULL)
|
|
||||||
{
|
|
||||||
if (strcmp(pBase->GetName(), name) == 0)
|
|
||||||
{
|
|
||||||
return const_cast<ConCommandBase *>(pBase);
|
|
||||||
}
|
|
||||||
pBase = pBase->GetNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me)
|
void TrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me)
|
||||||
{
|
{
|
||||||
s_ConCmdTracker.AddTarget(pBase, me);
|
s_ConCmdTracker.AddTarget(pBase, me);
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ public:
|
|||||||
virtual void OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name, bool is_read_safe) = 0;
|
virtual void OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name, bool is_read_safe) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
ConCommandBase *FindConCommandBase(const char *name);
|
|
||||||
void TrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me);
|
void TrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me);
|
||||||
void UntrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me);
|
void UntrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me);
|
||||||
void Global_OnUnlinkConCommandBase(ConCommandBase *pBase);
|
void Global_OnUnlinkConCommandBase(ConCommandBase *pBase);
|
||||||
|
|||||||
@@ -0,0 +1,712 @@
|
|||||||
|
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||||
|
//
|
||||||
|
// Purpose:
|
||||||
|
//
|
||||||
|
// $Workfile: $
|
||||||
|
// $Date: $
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// $NoKeywords: $
|
||||||
|
//===========================================================================//
|
||||||
|
|
||||||
|
#ifndef CONVAR_H
|
||||||
|
#define CONVAR_H
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
|
#pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "tier0/dbg.h"
|
||||||
|
#include "tier1/iconvar.h"
|
||||||
|
#include "tier1/utlvector.h"
|
||||||
|
#include "tier1/utlstring.h"
|
||||||
|
#include "icvar.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define FORCEINLINE_CVAR FORCEINLINE
|
||||||
|
#elif _LINUX
|
||||||
|
#define FORCEINLINE_CVAR inline
|
||||||
|
#else
|
||||||
|
#error "implement me"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Forward declarations
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class ConVar;
|
||||||
|
class CCommand;
|
||||||
|
class ConCommand;
|
||||||
|
class ConCommandBase;
|
||||||
|
struct characterset_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Any executable that wants to use ConVars need to implement one of
|
||||||
|
// these to hook up access to console variables.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class IConCommandBaseAccessor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Flags is a combination of FCVAR flags in cvar.h.
|
||||||
|
// hOut is filled in with a handle to the variable.
|
||||||
|
virtual bool RegisterConCommandBase( ConCommandBase *pVar ) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Helper method for console development
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#if defined( _X360 ) && !defined( _RETAIL )
|
||||||
|
void ConVar_PublishToVXConsole();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Called when a ConCommand needs to execute
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
typedef void ( *FnCommandCallbackV1_t )( void );
|
||||||
|
typedef void ( *FnCommandCallback_t )( const CCommand &command );
|
||||||
|
|
||||||
|
#define COMMAND_COMPLETION_MAXITEMS 64
|
||||||
|
#define COMMAND_COMPLETION_ITEM_LENGTH 64
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Returns 0 to COMMAND_COMPLETION_MAXITEMS worth of completion strings
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
typedef int ( *FnCommandCompletionCallback )( const char *partial, char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ] );
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Interface version
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class ICommandCallback
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void CommandCallback( const CCommand &command ) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ICommandCompletionCallback
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual int CommandCompletionCallback( const char *pPartial, CUtlVector< CUtlString > &commands ) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: The base console invoked command/cvar interface
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class ConCommandBase
|
||||||
|
{
|
||||||
|
friend class CCvar;
|
||||||
|
friend class ConVar;
|
||||||
|
friend class ConCommand;
|
||||||
|
friend void ConVar_Register( int nCVarFlag, IConCommandBaseAccessor *pAccessor );
|
||||||
|
friend void ConVar_PublishToVXConsole();
|
||||||
|
|
||||||
|
// FIXME: Remove when ConVar changes are done
|
||||||
|
friend class CDefaultCvar;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ConCommandBase( void );
|
||||||
|
ConCommandBase( const char *pName, const char *pHelpString = 0,
|
||||||
|
int flags = 0 );
|
||||||
|
|
||||||
|
virtual ~ConCommandBase( void );
|
||||||
|
|
||||||
|
virtual bool IsCommand( void ) const;
|
||||||
|
|
||||||
|
// Check flag
|
||||||
|
virtual bool IsFlagSet( int flag ) const;
|
||||||
|
// Set flag
|
||||||
|
virtual void AddFlags( int flags );
|
||||||
|
// Remove flag
|
||||||
|
virtual void RemoveFlags( int flags );
|
||||||
|
// Get flags
|
||||||
|
virtual int GetFlags( void ) const;
|
||||||
|
|
||||||
|
// Return name of cvar
|
||||||
|
virtual const char *GetName( void ) const;
|
||||||
|
|
||||||
|
// Return help text for cvar
|
||||||
|
virtual const char *GetHelpText( void ) const;
|
||||||
|
|
||||||
|
// Deal with next pointer
|
||||||
|
const ConCommandBase *GetNext( void ) const;
|
||||||
|
ConCommandBase *GetNext( void );
|
||||||
|
|
||||||
|
inline void SetNext(ConCommandBase *pBase)
|
||||||
|
{
|
||||||
|
m_pNext = pBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool IsRegistered( void ) const;
|
||||||
|
|
||||||
|
// Returns the DLL identifier
|
||||||
|
virtual CVarDLLIdentifier_t GetDLLIdentifier() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void Create( const char *pName, const char *pHelpString = 0,
|
||||||
|
int flags = 0 );
|
||||||
|
|
||||||
|
// Used internally by OneTimeInit to initialize/shutdown
|
||||||
|
virtual void Init();
|
||||||
|
void Shutdown();
|
||||||
|
|
||||||
|
// Internal copy routine ( uses new operator from correct module )
|
||||||
|
char *CopyString( const char *from );
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Next ConVar in chain
|
||||||
|
// Prior to register, it points to the next convar in the DLL.
|
||||||
|
// Once registered, though, m_pNext is reset to point to the next
|
||||||
|
// convar in the global list
|
||||||
|
ConCommandBase *m_pNext;
|
||||||
|
|
||||||
|
// Has the cvar been added to the global list?
|
||||||
|
bool m_bRegistered;
|
||||||
|
|
||||||
|
// Static data
|
||||||
|
const char *m_pszName;
|
||||||
|
const char *m_pszHelpString;
|
||||||
|
|
||||||
|
// ConVar flags
|
||||||
|
int m_nFlags;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// ConVars add themselves to this list for the executable.
|
||||||
|
// Then ConVar_Register runs through all the console variables
|
||||||
|
// and registers them into a global list stored in vstdlib.dll
|
||||||
|
static ConCommandBase *s_pConCommandBases;
|
||||||
|
|
||||||
|
// ConVars in this executable use this 'global' to access values.
|
||||||
|
static IConCommandBaseAccessor *s_pAccessor;
|
||||||
|
public:
|
||||||
|
inline void SetFlags(int flags)
|
||||||
|
{
|
||||||
|
m_nFlags = flags;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Command tokenizer
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class CCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommand();
|
||||||
|
CCommand( int nArgC, const char **ppArgV );
|
||||||
|
bool Tokenize( const char *pCommand, characterset_t *pBreakSet = NULL );
|
||||||
|
void Reset();
|
||||||
|
|
||||||
|
int ArgC() const;
|
||||||
|
const char **ArgV() const;
|
||||||
|
const char *ArgS() const; // All args that occur after the 0th arg, in string form
|
||||||
|
const char *GetCommandString() const; // The entire command in string form, including the 0th arg
|
||||||
|
const char *operator[]( int nIndex ) const; // Gets at arguments
|
||||||
|
const char *Arg( int nIndex ) const; // Gets at arguments
|
||||||
|
|
||||||
|
// Helper functions to parse arguments to commands.
|
||||||
|
const char* FindArg( const char *pName ) const;
|
||||||
|
int FindArgInt( const char *pName, int nDefaultVal ) const;
|
||||||
|
|
||||||
|
static int MaxCommandLength();
|
||||||
|
static characterset_t* DefaultBreakSet();
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
COMMAND_MAX_ARGC = 64,
|
||||||
|
COMMAND_MAX_LENGTH = 512,
|
||||||
|
};
|
||||||
|
|
||||||
|
int m_nArgc;
|
||||||
|
int m_nArgv0Size;
|
||||||
|
char m_pArgSBuffer[ COMMAND_MAX_LENGTH ];
|
||||||
|
char m_pArgvBuffer[ COMMAND_MAX_LENGTH ];
|
||||||
|
const char* m_ppArgv[ COMMAND_MAX_ARGC ];
|
||||||
|
};
|
||||||
|
|
||||||
|
inline int CCommand::MaxCommandLength()
|
||||||
|
{
|
||||||
|
return COMMAND_MAX_LENGTH - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int CCommand::ArgC() const
|
||||||
|
{
|
||||||
|
return m_nArgc;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char **CCommand::ArgV() const
|
||||||
|
{
|
||||||
|
return m_nArgc ? (const char**)m_ppArgv : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char *CCommand::ArgS() const
|
||||||
|
{
|
||||||
|
return m_nArgv0Size ? &m_pArgSBuffer[m_nArgv0Size] : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char *CCommand::GetCommandString() const
|
||||||
|
{
|
||||||
|
return m_nArgc ? m_pArgSBuffer : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char *CCommand::Arg( int nIndex ) const
|
||||||
|
{
|
||||||
|
// FIXME: Many command handlers appear to not be particularly careful
|
||||||
|
// about checking for valid argc range. For now, we're going to
|
||||||
|
// do the extra check and return an empty string if it's out of range
|
||||||
|
if ( nIndex < 0 || nIndex >= m_nArgc )
|
||||||
|
return "";
|
||||||
|
return m_ppArgv[nIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char *CCommand::operator[]( int nIndex ) const
|
||||||
|
{
|
||||||
|
return Arg( nIndex );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: The console invoked command
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class ConCommand : public ConCommandBase
|
||||||
|
{
|
||||||
|
friend class CCvar;
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef ConCommandBase BaseClass;
|
||||||
|
|
||||||
|
ConCommand( const char *pName, FnCommandCallbackV1_t callback,
|
||||||
|
const char *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 );
|
||||||
|
ConCommand( const char *pName, FnCommandCallback_t callback,
|
||||||
|
const char *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 );
|
||||||
|
ConCommand( const char *pName, ICommandCallback *pCallback,
|
||||||
|
const char *pHelpString = 0, int flags = 0, ICommandCompletionCallback *pCommandCompletionCallback = 0 );
|
||||||
|
|
||||||
|
virtual ~ConCommand( void );
|
||||||
|
|
||||||
|
virtual bool IsCommand( void ) const;
|
||||||
|
|
||||||
|
virtual int AutoCompleteSuggest( const char *partial, CUtlVector< CUtlString > &commands );
|
||||||
|
|
||||||
|
virtual bool CanAutoComplete( void );
|
||||||
|
|
||||||
|
// Invoke the function
|
||||||
|
virtual void Dispatch( const CCommand &command );
|
||||||
|
|
||||||
|
private:
|
||||||
|
// NOTE: To maintain backward compat, we have to be very careful:
|
||||||
|
// All public virtual methods must appear in the same order always
|
||||||
|
// since engine code will be calling into this code, which *does not match*
|
||||||
|
// in the mod code; it's using slightly different, but compatible versions
|
||||||
|
// of this class. Also: Be very careful about adding new fields to this class.
|
||||||
|
// Those fields will not exist in the version of this class that is instanced
|
||||||
|
// in mod code.
|
||||||
|
|
||||||
|
// Call this function when executing the command
|
||||||
|
union
|
||||||
|
{
|
||||||
|
FnCommandCallbackV1_t m_fnCommandCallbackV1;
|
||||||
|
FnCommandCallback_t m_fnCommandCallback;
|
||||||
|
ICommandCallback *m_pCommandCallback;
|
||||||
|
};
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
FnCommandCompletionCallback m_fnCompletionCallback;
|
||||||
|
ICommandCompletionCallback *m_pCommandCompletionCallback;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool m_bHasCompletionCallback : 1;
|
||||||
|
bool m_bUsingNewCommandCallback : 1;
|
||||||
|
bool m_bUsingCommandCallbackInterface : 1;
|
||||||
|
public:
|
||||||
|
inline FnCommandCallback_t GetCallback() const
|
||||||
|
{
|
||||||
|
return m_fnCommandCallback;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: A console variable
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class ConVar : public ConCommandBase, public IConVar
|
||||||
|
{
|
||||||
|
friend class CCvar;
|
||||||
|
friend class ConVarRef;
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef ConCommandBase BaseClass;
|
||||||
|
|
||||||
|
ConVar( const char *pName, const char *pDefaultValue, int flags = 0);
|
||||||
|
|
||||||
|
ConVar( const char *pName, const char *pDefaultValue, int flags,
|
||||||
|
const char *pHelpString );
|
||||||
|
ConVar( const char *pName, const char *pDefaultValue, int flags,
|
||||||
|
const char *pHelpString, bool bMin, float fMin, bool bMax, float fMax );
|
||||||
|
ConVar( const char *pName, const char *pDefaultValue, int flags,
|
||||||
|
const char *pHelpString, FnChangeCallback_t callback );
|
||||||
|
ConVar( const char *pName, const char *pDefaultValue, int flags,
|
||||||
|
const char *pHelpString, bool bMin, float fMin, bool bMax, float fMax,
|
||||||
|
FnChangeCallback_t callback );
|
||||||
|
|
||||||
|
virtual ~ConVar( void );
|
||||||
|
|
||||||
|
virtual bool IsCommand( void ) const;
|
||||||
|
virtual bool IsFlagSet( int flag ) const;
|
||||||
|
virtual void AddFlags( int flags );
|
||||||
|
virtual int GetFlags( void ) const;
|
||||||
|
virtual const char *GetName( void ) const;
|
||||||
|
virtual const char* GetHelpText( void ) const;
|
||||||
|
virtual bool IsRegistered( void ) const;
|
||||||
|
|
||||||
|
// Install a change callback (there shouldn't already be one....)
|
||||||
|
void InstallChangeCallback( FnChangeCallback_t callback );
|
||||||
|
|
||||||
|
// Retrieve value
|
||||||
|
FORCEINLINE_CVAR float GetFloat( void ) const;
|
||||||
|
FORCEINLINE_CVAR int GetInt( void ) const;
|
||||||
|
FORCEINLINE_CVAR bool GetBool() const { return !!GetInt(); }
|
||||||
|
FORCEINLINE_CVAR char const *GetString( void ) const;
|
||||||
|
|
||||||
|
// Used internally by OneTimeInit to initialize.
|
||||||
|
virtual void Init();
|
||||||
|
|
||||||
|
virtual const char *GetBaseName( void ) const;
|
||||||
|
virtual int GetSplitScreenPlayerSlot ( void ) const;
|
||||||
|
|
||||||
|
// Any function that allocates/frees memory needs to be virtual or else you'll have crashes
|
||||||
|
// from alloc/free across dll/exe boundaries.
|
||||||
|
|
||||||
|
// These just call into the IConCommandBaseAccessor to check flags and set the var (which ends up calling InternalSetValue).
|
||||||
|
virtual void SetValue( const char *value );
|
||||||
|
virtual void SetValue( float value );
|
||||||
|
virtual void SetValue( int value );
|
||||||
|
|
||||||
|
// Reset to default value
|
||||||
|
void Revert( void );
|
||||||
|
|
||||||
|
// True if it has a min/max setting
|
||||||
|
bool GetMin( float& minVal ) const;
|
||||||
|
bool GetMax( float& maxVal ) const;
|
||||||
|
const char *GetDefault( void ) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Called by CCvar when the value of a var is changing.
|
||||||
|
virtual void InternalSetValue(const char *value);
|
||||||
|
// For CVARs marked FCVAR_NEVER_AS_STRING
|
||||||
|
virtual void InternalSetFloatValue( float fNewValue );
|
||||||
|
virtual void InternalSetIntValue( int nValue );
|
||||||
|
|
||||||
|
virtual bool ClampValue( float& value );
|
||||||
|
virtual void ChangeStringValue( const char *tempVal, float flOldValue );
|
||||||
|
|
||||||
|
virtual void Create( const char *pName, const char *pDefaultValue, int flags = 0,
|
||||||
|
const char *pHelpString = 0, bool bMin = false, float fMin = 0.0,
|
||||||
|
bool bMax = false, float fMax = false, FnChangeCallback_t callback = 0 );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// This either points to "this" or it points to the original declaration of a ConVar.
|
||||||
|
// This allows ConVars to exist in separate modules, and they all use the first one to be declared.
|
||||||
|
// m_pParent->m_pParent must equal m_pParent (ie: m_pParent must be the root, or original, ConVar).
|
||||||
|
ConVar *m_pParent;
|
||||||
|
|
||||||
|
// Static data
|
||||||
|
const char *m_pszDefaultValue;
|
||||||
|
|
||||||
|
// Value
|
||||||
|
// Dynamically allocated
|
||||||
|
char *m_pszString;
|
||||||
|
int m_StringLength;
|
||||||
|
|
||||||
|
// Values
|
||||||
|
float m_fValue;
|
||||||
|
int m_nValue;
|
||||||
|
|
||||||
|
// Min/Max values
|
||||||
|
bool m_bHasMin;
|
||||||
|
float m_fMinVal;
|
||||||
|
bool m_bHasMax;
|
||||||
|
float m_fMaxVal;
|
||||||
|
|
||||||
|
// Call this function when ConVar changes
|
||||||
|
FnChangeCallback_t m_fnChangeCallback;
|
||||||
|
public:
|
||||||
|
inline FnChangeCallback_t GetCallback() const
|
||||||
|
{
|
||||||
|
return m_fnChangeCallback;
|
||||||
|
}
|
||||||
|
inline void SetMin(bool set, float min=0.0)
|
||||||
|
{
|
||||||
|
m_bHasMin = set;
|
||||||
|
m_fMinVal = min;
|
||||||
|
}
|
||||||
|
inline void SetMax(bool set, float max=0.0)
|
||||||
|
{
|
||||||
|
m_bHasMax = set;
|
||||||
|
m_fMaxVal = max;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Return ConVar value as a float
|
||||||
|
// Output : float
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FORCEINLINE_CVAR float ConVar::GetFloat( void ) const
|
||||||
|
{
|
||||||
|
return m_pParent->m_fValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Return ConVar value as an int
|
||||||
|
// Output : int
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FORCEINLINE_CVAR int ConVar::GetInt( void ) const
|
||||||
|
{
|
||||||
|
return m_pParent->m_nValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Return ConVar value as a string, return "" for bogus string pointer, etc.
|
||||||
|
// Output : const char *
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FORCEINLINE_CVAR const char *ConVar::GetString( void ) const
|
||||||
|
{
|
||||||
|
if ( m_nFlags & FCVAR_NEVER_AS_STRING )
|
||||||
|
return "FCVAR_NEVER_AS_STRING";
|
||||||
|
|
||||||
|
return ( m_pParent->m_pszString ) ? m_pParent->m_pszString : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Used to read/write convars that already exist (replaces the FindVar method)
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class ConVarRef
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ConVarRef( const char *pName );
|
||||||
|
ConVarRef( const char *pName, bool bIgnoreMissing );
|
||||||
|
ConVarRef( IConVar *pConVar );
|
||||||
|
|
||||||
|
void Init( const char *pName, bool bIgnoreMissing );
|
||||||
|
bool IsValid() const;
|
||||||
|
bool IsFlagSet( int nFlags ) const;
|
||||||
|
IConVar *GetLinkedConVar();
|
||||||
|
|
||||||
|
// Get/Set value
|
||||||
|
float GetFloat( void ) const;
|
||||||
|
int GetInt( void ) const;
|
||||||
|
bool GetBool() const { return !!GetInt(); }
|
||||||
|
const char *GetString( void ) const;
|
||||||
|
|
||||||
|
void SetValue( const char *pValue );
|
||||||
|
void SetValue( float flValue );
|
||||||
|
void SetValue( int nValue );
|
||||||
|
void SetValue( bool bValue );
|
||||||
|
|
||||||
|
const char *GetName() const;
|
||||||
|
|
||||||
|
const char *GetDefault() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// High-speed method to read convar data
|
||||||
|
IConVar *m_pConVar;
|
||||||
|
ConVar *m_pConVarState;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Did we find an existing convar of that name?
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FORCEINLINE_CVAR bool ConVarRef::IsFlagSet( int nFlags ) const
|
||||||
|
{
|
||||||
|
return ( m_pConVar->IsFlagSet( nFlags ) != 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE_CVAR IConVar *ConVarRef::GetLinkedConVar()
|
||||||
|
{
|
||||||
|
return m_pConVar;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE_CVAR const char *ConVarRef::GetName() const
|
||||||
|
{
|
||||||
|
return m_pConVar->GetName();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Return ConVar value as a float
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FORCEINLINE_CVAR float ConVarRef::GetFloat( void ) const
|
||||||
|
{
|
||||||
|
return m_pConVarState->m_fValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Return ConVar value as an int
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FORCEINLINE_CVAR int ConVarRef::GetInt( void ) const
|
||||||
|
{
|
||||||
|
return m_pConVarState->m_nValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Return ConVar value as a string, return "" for bogus string pointer, etc.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FORCEINLINE_CVAR const char *ConVarRef::GetString( void ) const
|
||||||
|
{
|
||||||
|
Assert( !IsFlagSet( FCVAR_NEVER_AS_STRING ) );
|
||||||
|
return m_pConVarState->m_pszString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FORCEINLINE_CVAR void ConVarRef::SetValue( const char *pValue )
|
||||||
|
{
|
||||||
|
m_pConVar->SetValue( pValue );
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE_CVAR void ConVarRef::SetValue( float flValue )
|
||||||
|
{
|
||||||
|
m_pConVar->SetValue( flValue );
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE_CVAR void ConVarRef::SetValue( int nValue )
|
||||||
|
{
|
||||||
|
m_pConVar->SetValue( nValue );
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE_CVAR void ConVarRef::SetValue( bool bValue )
|
||||||
|
{
|
||||||
|
m_pConVar->SetValue( bValue ? 1 : 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE_CVAR const char *ConVarRef::GetDefault() const
|
||||||
|
{
|
||||||
|
return m_pConVarState->m_pszDefaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Called by the framework to register ConCommands with the ICVar
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void ConVar_Register( int nCVarFlag = 0, IConCommandBaseAccessor *pAccessor = NULL );
|
||||||
|
void ConVar_Unregister( );
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Utility methods
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void ConVar_PrintFlags( const ConCommandBase *var );
|
||||||
|
void ConVar_PrintDescription( const ConCommandBase *pVar );
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Utility class to quickly allow ConCommands to call member methods
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning (disable : 4355 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template< class T >
|
||||||
|
class CConCommandMemberAccessor : public ConCommand, public ICommandCallback, public ICommandCompletionCallback
|
||||||
|
{
|
||||||
|
typedef ConCommand BaseClass;
|
||||||
|
typedef void ( T::*FnMemberCommandCallback_t )( const CCommand &command );
|
||||||
|
typedef int ( T::*FnMemberCommandCompletionCallback_t )( const char *pPartial, CUtlVector< CUtlString > &commands );
|
||||||
|
|
||||||
|
public:
|
||||||
|
CConCommandMemberAccessor( T* pOwner, const char *pName, FnMemberCommandCallback_t callback, const char *pHelpString = 0,
|
||||||
|
int flags = 0, FnMemberCommandCompletionCallback_t completionFunc = 0 ) :
|
||||||
|
BaseClass( pName, this, pHelpString, flags, ( completionFunc != 0 ) ? this : NULL )
|
||||||
|
{
|
||||||
|
m_pOwner = pOwner;
|
||||||
|
m_Func = callback;
|
||||||
|
m_CompletionFunc = completionFunc;
|
||||||
|
}
|
||||||
|
|
||||||
|
~CConCommandMemberAccessor()
|
||||||
|
{
|
||||||
|
Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetOwner( T* pOwner )
|
||||||
|
{
|
||||||
|
m_pOwner = pOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void CommandCallback( const CCommand &command )
|
||||||
|
{
|
||||||
|
Assert( m_pOwner && m_Func );
|
||||||
|
(m_pOwner->*m_Func)( command );
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int CommandCompletionCallback( const char *pPartial, CUtlVector< CUtlString > &commands )
|
||||||
|
{
|
||||||
|
Assert( m_pOwner && m_CompletionFunc );
|
||||||
|
return (m_pOwner->*m_CompletionFunc)( pPartial, commands );
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
T* m_pOwner;
|
||||||
|
FnMemberCommandCallback_t m_Func;
|
||||||
|
FnMemberCommandCompletionCallback_t m_CompletionFunc;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning ( default : 4355 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Utility macros to quicky generate a simple console command
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#define CON_COMMAND( name, description ) \
|
||||||
|
static void name( const CCommand &args ); \
|
||||||
|
static ConCommand name##_command( #name, name, description ); \
|
||||||
|
static void name( const CCommand &args )
|
||||||
|
|
||||||
|
#define CON_COMMAND_F( name, description, flags ) \
|
||||||
|
static void name( const CCommand &args ); \
|
||||||
|
static ConCommand name##_command( #name, name, description, flags ); \
|
||||||
|
static void name( const CCommand &args )
|
||||||
|
|
||||||
|
#define CON_COMMAND_F_COMPLETION( name, description, flags, completion ) \
|
||||||
|
static void name( const CCommand &args ); \
|
||||||
|
static ConCommand name##_command( #name, name, description, flags, completion ); \
|
||||||
|
static void name( const CCommand &args )
|
||||||
|
|
||||||
|
#define CON_COMMAND_EXTERN( name, _funcname, description ) \
|
||||||
|
void _funcname( const CCommand &args ); \
|
||||||
|
static ConCommand name##_command( #name, _funcname, description ); \
|
||||||
|
void _funcname( const CCommand &args )
|
||||||
|
|
||||||
|
#define CON_COMMAND_EXTERN_F( name, _funcname, description, flags ) \
|
||||||
|
void _funcname( const CCommand &args ); \
|
||||||
|
static ConCommand name##_command( #name, _funcname, description, flags ); \
|
||||||
|
void _funcname( const CCommand &args )
|
||||||
|
|
||||||
|
#define CON_COMMAND_MEMBER_F( _thisclass, name, _funcname, description, flags ) \
|
||||||
|
void _funcname( const CCommand &args ); \
|
||||||
|
friend class CCommandMemberInitializer_##_funcname; \
|
||||||
|
class CCommandMemberInitializer_##_funcname \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
CCommandMemberInitializer_##_funcname() : m_ConCommandAccessor( NULL, name, &_thisclass::_funcname, description, flags ) \
|
||||||
|
{ \
|
||||||
|
m_ConCommandAccessor.SetOwner( GET_OUTER( _thisclass, m_##_funcname##_register ) ); \
|
||||||
|
} \
|
||||||
|
private: \
|
||||||
|
CConCommandMemberAccessor< _thisclass > m_ConCommandAccessor; \
|
||||||
|
}; \
|
||||||
|
\
|
||||||
|
CCommandMemberInitializer_##_funcname m_##_funcname##_register; \
|
||||||
|
|
||||||
|
|
||||||
|
#endif // CONVAR_H
|
||||||
+6
-1
@@ -32,10 +32,15 @@
|
|||||||
#ifndef _INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
|
#ifndef _INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
|
||||||
#define _INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
|
#define _INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
|
||||||
|
|
||||||
typedef void (*FRAMEACTION)(void *data);
|
#include <ISourceMod.h>
|
||||||
|
|
||||||
|
using namespace SourceMod;
|
||||||
|
|
||||||
struct FrameAction
|
struct FrameAction
|
||||||
{
|
{
|
||||||
|
FrameAction(FRAMEACTION a, void *d) : data(d), action(a)
|
||||||
|
{
|
||||||
|
}
|
||||||
void *data;
|
void *data;
|
||||||
FRAMEACTION action;
|
FRAMEACTION action;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,33 +5,60 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sourcemod_mm", "sourcemod_m
|
|||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
CrazyDebug - Dark Messiah|Win32 = CrazyDebug - Dark Messiah|Win32
|
||||||
CrazyDebug - Episode 1|Win32 = CrazyDebug - Episode 1|Win32
|
CrazyDebug - Episode 1|Win32 = CrazyDebug - Episode 1|Win32
|
||||||
|
CrazyDebug - Left 4 Dead|Win32 = CrazyDebug - Left 4 Dead|Win32
|
||||||
CrazyDebug - Old Metamod|Win32 = CrazyDebug - Old Metamod|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
|
CrazyDebug - Orange Box|Win32 = CrazyDebug - Orange Box|Win32
|
||||||
|
Debug - Dark Messiah|Win32 = Debug - Dark Messiah|Win32
|
||||||
Debug - Episode 1|Win32 = Debug - Episode 1|Win32
|
Debug - Episode 1|Win32 = Debug - Episode 1|Win32
|
||||||
|
Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32
|
||||||
Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
|
Debug - 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
|
Debug - Orange Box|Win32 = Debug - Orange Box|Win32
|
||||||
|
Release - Dark Messiah|Win32 = Release - Dark Messiah|Win32
|
||||||
Release - Episode 1|Win32 = Release - Episode 1|Win32
|
Release - Episode 1|Win32 = Release - Episode 1|Win32
|
||||||
|
Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32
|
||||||
Release - Old Metamod|Win32 = Release - Old Metamod|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
|
Release - Orange Box|Win32 = Release - Orange Box|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{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.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 - Episode 1|Win32.Build.0 = CrazyDebug - Episode 1|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.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 - 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.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}.CrazyDebug - Orange Box|Win32.Build.0 = CrazyDebug - Orange Box|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.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 - Episode 1|Win32.Build.0 = Debug - Episode 1|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.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 - 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.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}.Debug - Orange Box|Win32.Build.0 = Debug - Orange Box|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.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 - Episode 1|Win32.Build.0 = Release - Episode 1|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.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 - 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.ActiveCfg = Release - Orange Box|Win32
|
||||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box|Win32.Build.0 = Release - Orange Box|Win32
|
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box|Win32.Build.0 = Release - Orange Box|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
|||||||
+823
-28
@@ -40,9 +40,10 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
Optimization="0"
|
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";"$(MMSOURCE17)\core-legacy";"$(MMSOURCE17)\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"
|
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"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
@@ -121,9 +122,10 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
Optimization="0"
|
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";"$(MMSOURCE17)\core-legacy";"$(MMSOURCE17)\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"
|
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"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
@@ -203,10 +205,10 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="/MP"
|
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
FavorSizeOrSpeed="1"
|
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";"$(MMSOURCE17)\core-legacy";"$(MMSOURCE17)\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"
|
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"
|
RuntimeLibrary="0"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableEnhancedInstructionSet="0"
|
||||||
RuntimeTypeInfo="false"
|
RuntimeTypeInfo="false"
|
||||||
@@ -261,6 +263,253 @@
|
|||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="CrazyDebug - Dark Messiah|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
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";"$(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"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDK-DARKM)\lib\public\tier0.lib" "$(HL2SDK-DARKM)\lib\public\tier1.lib" "$(HL2SDK-DARKM)\lib\public\vstdlib.lib" "$(HL2SDK-DARKM)\lib\public\mathlib.lib" dbghelp.lib "Wsock32.lib""
|
||||||
|
OutputFile="$(OutDir)\sourcemod.2.darkm.dll"
|
||||||
|
LinkIncremental="2"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug - Dark Messiah|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
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";"$(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"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDK-DARKM)\lib\public\tier0.lib" "$(HL2SDK-DARKM)\lib\public\tier1.lib" "$(HL2SDK-DARKM)\lib\public\vstdlib.lib" "$(HL2SDK-DARKM)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||||
|
OutputFile="$(OutDir)\sourcemod.2.darkm.dll"
|
||||||
|
LinkIncremental="2"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release - Dark Messiah|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
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";"$(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"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDK-DARKM)\lib\public\tier0.lib" "$(HL2SDK-DARKM)\lib\public\tier1.lib" "$(HL2SDK-DARKM)\lib\public\vstdlib.lib" "$(HL2SDK-DARKM)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||||
|
OutputFile="$(OutDir)\sourcemod.2.darkm.dll"
|
||||||
|
LinkIncremental="1"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="CrazyDebug - Orange Box|Win32"
|
Name="CrazyDebug - Orange Box|Win32"
|
||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
@@ -285,9 +534,10 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
Optimization="0"
|
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";"$(MMSOURCE17)\core";"$(MMSOURCE17)\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;ORANGEBOX_BUILD"
|
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"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
@@ -366,9 +616,10 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
Optimization="0"
|
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";"$(MMSOURCE17)\core";"$(MMSOURCE17)\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;ORANGEBOX_BUILD"
|
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"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
@@ -448,10 +699,10 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="/MP"
|
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
FavorSizeOrSpeed="1"
|
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";"$(MMSOURCE17)\core";"$(MMSOURCE17)\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;ORANGEBOX_BUILD"
|
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"
|
RuntimeLibrary="0"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableEnhancedInstructionSet="0"
|
||||||
RuntimeTypeInfo="false"
|
RuntimeTypeInfo="false"
|
||||||
@@ -530,9 +781,10 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
Optimization="0"
|
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";"$(MMSOURCE17)\core";"$(MMSOURCE17)\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"
|
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"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
@@ -611,9 +863,10 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
Optimization="0"
|
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";"$(MMSOURCE17)\core";"$(MMSOURCE17)\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"
|
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"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
@@ -693,10 +946,10 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="/MP"
|
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
FavorSizeOrSpeed="1"
|
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";"$(MMSOURCE17)\core";"$(MMSOURCE17)\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"
|
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"
|
RuntimeLibrary="0"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableEnhancedInstructionSet="0"
|
||||||
RuntimeTypeInfo="false"
|
RuntimeTypeInfo="false"
|
||||||
@@ -751,6 +1004,500 @@
|
|||||||
Name="VCPostBuildEventTool"
|
Name="VCPostBuildEventTool"
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="CrazyDebug - Left 4 Dead|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
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";"$(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"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDKL4D)\lib\public\tier0.lib" "$(HL2SDKL4D)\lib\public\tier1.lib" "$(HL2SDKL4D)\lib\public\vstdlib.lib" "$(HL2SDKL4D)\lib\public\mathlib.lib" dbghelp.lib "Wsock32.lib""
|
||||||
|
OutputFile="$(OutDir)\sourcemod.2.l4d.dll"
|
||||||
|
LinkIncremental="2"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug - Left 4 Dead|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
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";"$(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"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDKL4D)\lib\public\tier0.lib" "$(HL2SDKL4D)\lib\public\tier1.lib" "$(HL2SDKL4D)\lib\public\vstdlib.lib" "$(HL2SDKL4D)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||||
|
OutputFile="$(OutDir)\sourcemod.2.l4d.dll"
|
||||||
|
LinkIncremental="2"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release - Left 4 Dead|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
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";"$(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"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDKL4D)\lib\public\tier0.lib" "$(HL2SDKL4D)\lib\public\tier1.lib" "$(HL2SDKL4D)\lib\public\vstdlib.lib" "$(HL2SDKL4D)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||||
|
OutputFile="$(OutDir)\sourcemod.2.l4d.dll"
|
||||||
|
LinkIncremental="1"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="CrazyDebug - Orange Box Valve|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
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";"$(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"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDKOBVALVE)\lib\public\tier0.lib" "$(HL2SDKOBVALVE)\lib\public\tier1.lib" "$(HL2SDKOBVALVE)\lib\public\vstdlib.lib" "$(HL2SDKOBVALVE)\lib\public\mathlib.lib" dbghelp.lib "Wsock32.lib""
|
||||||
|
OutputFile="$(OutDir)\sourcemod.2.ep2v.dll"
|
||||||
|
LinkIncremental="2"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug - Orange Box Valve|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
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";"$(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"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDKOBVALVE)\lib\public\tier0.lib" "$(HL2SDKOBVALVE)\lib\public\tier1.lib" "$(HL2SDKOBVALVE)\lib\public\vstdlib.lib" "$(HL2SDKOBVALVE)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||||
|
OutputFile="$(OutDir)\sourcemod.2.ep2v.dll"
|
||||||
|
LinkIncremental="2"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release - Orange Box Valve|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
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";"$(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"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDKOBVALVE)\lib\public\tier0.lib" "$(HL2SDKOBVALVE)\lib\public\tier1.lib" "$(HL2SDKOBVALVE)\lib\public\vstdlib.lib" "$(HL2SDKOBVALVE)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||||
|
OutputFile="$(OutDir)\sourcemod.2.ep2v.dll"
|
||||||
|
LinkIncremental="1"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
</Configurations>
|
</Configurations>
|
||||||
<References>
|
<References>
|
||||||
</References>
|
</References>
|
||||||
@@ -811,6 +1558,22 @@
|
|||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug - Dark Messiah|Win32"
|
||||||
|
ExcludedFromBuild="true"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release - Dark Messiah|Win32"
|
||||||
|
ExcludedFromBuild="true"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Debug - Orange Box|Win32"
|
Name="Debug - Orange Box|Win32"
|
||||||
ExcludedFromBuild="true"
|
ExcludedFromBuild="true"
|
||||||
@@ -843,6 +1606,38 @@
|
|||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug - Left 4 Dead|Win32"
|
||||||
|
ExcludedFromBuild="true"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release - Left 4 Dead|Win32"
|
||||||
|
ExcludedFromBuild="true"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug - Orange Box Valve|Win32"
|
||||||
|
ExcludedFromBuild="true"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release - Orange Box Valve|Win32"
|
||||||
|
ExcludedFromBuild="true"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\Database.cpp"
|
RelativePath="..\Database.cpp"
|
||||||
@@ -872,10 +1667,6 @@
|
|||||||
RelativePath="..\GameConfigs.cpp"
|
RelativePath="..\GameConfigs.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\GameDataFetcher.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\HalfLife2.cpp"
|
RelativePath="..\HalfLife2.cpp"
|
||||||
>
|
>
|
||||||
@@ -892,10 +1683,6 @@
|
|||||||
RelativePath="..\Logger.cpp"
|
RelativePath="..\Logger.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\md5.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\MemoryUtils.cpp"
|
RelativePath="..\MemoryUtils.cpp"
|
||||||
>
|
>
|
||||||
@@ -920,6 +1707,10 @@
|
|||||||
RelativePath="..\MenuVoting.cpp"
|
RelativePath="..\MenuVoting.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\NativeInvoker.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\NativeOwner.cpp"
|
RelativePath="..\NativeOwner.cpp"
|
||||||
>
|
>
|
||||||
@@ -1082,10 +1873,6 @@
|
|||||||
RelativePath="..\GameConfigs.h"
|
RelativePath="..\GameConfigs.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\GameDataFetcher.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\HalfLife2.h"
|
RelativePath="..\HalfLife2.h"
|
||||||
>
|
>
|
||||||
@@ -1102,10 +1889,6 @@
|
|||||||
RelativePath="..\Logger.h"
|
RelativePath="..\Logger.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\md5.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\MemoryUtils.h"
|
RelativePath="..\MemoryUtils.h"
|
||||||
>
|
>
|
||||||
@@ -1130,6 +1913,10 @@
|
|||||||
RelativePath="..\MenuVoting.h"
|
RelativePath="..\MenuVoting.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\NativeInvoker.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\NativeOwner.h"
|
RelativePath="..\NativeOwner.h"
|
||||||
>
|
>
|
||||||
@@ -1230,6 +2017,10 @@
|
|||||||
RelativePath="..\TextParsers.h"
|
RelativePath="..\TextParsers.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\ThreadSupport.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\TimerSys.h"
|
RelativePath="..\TimerSys.h"
|
||||||
>
|
>
|
||||||
@@ -1295,6 +2086,10 @@
|
|||||||
RelativePath="..\..\public\IMenuManager.h"
|
RelativePath="..\..\public\IMenuManager.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\public\INativeInvoker.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\public\IPlayerHelpers.h"
|
RelativePath="..\..\public\IPlayerHelpers.h"
|
||||||
>
|
>
|
||||||
|
|||||||
+6
-6
@@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sm_srvcmds.h"
|
#include "sm_srvcmds.h"
|
||||||
#include "sm_version.h"
|
#include <sourcemod_version.h>
|
||||||
#include "sm_stringutil.h"
|
#include "sm_stringutil.h"
|
||||||
#include "HandleSys.h"
|
#include "HandleSys.h"
|
||||||
#include "CoreConfig.h"
|
#include "CoreConfig.h"
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
RootConsoleMenu g_RootMenu;
|
RootConsoleMenu g_RootMenu;
|
||||||
|
|
||||||
ConVar sourcemod_version("sourcemod_version", SVN_FULL_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()
|
RootConsoleMenu::RootConsoleMenu()
|
||||||
{
|
{
|
||||||
@@ -61,7 +61,7 @@ RootConsoleMenu::~RootConsoleMenu()
|
|||||||
|
|
||||||
void RootConsoleMenu::OnSourceModStartup(bool late)
|
void RootConsoleMenu::OnSourceModStartup(bool late)
|
||||||
{
|
{
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
g_pCVar = icvar;
|
g_pCVar = icvar;
|
||||||
#endif
|
#endif
|
||||||
CONVAR_REGISTER(this);
|
CONVAR_REGISTER(this);
|
||||||
@@ -280,7 +280,7 @@ void RootConsoleMenu::OnRootConsoleCommand(const char *cmdname, const CCommand &
|
|||||||
else if (strcmp(cmdname, "version") == 0)
|
else if (strcmp(cmdname, "version") == 0)
|
||||||
{
|
{
|
||||||
ConsolePrint(" SourceMod Version Information:");
|
ConsolePrint(" SourceMod Version Information:");
|
||||||
ConsolePrint(" SourceMod Version: %s", SVN_FULL_VERSION);
|
ConsolePrint(" SourceMod Version: %s", SM_FULL_VERSION);
|
||||||
ConsolePrint(" SourcePawn Engine: %s (build %s)", g_pSourcePawn2->GetEngineName(), g_pSourcePawn2->GetVersionString());
|
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(" SourcePawn API: v1 = %d, v2 = %d", g_pSourcePawn->GetEngineAPIVersion(), g_pSourcePawn2->GetAPIVersion());
|
||||||
ConsolePrint(" Compiled on: %s %s", __DATE__, __TIME__);
|
ConsolePrint(" Compiled on: %s %s", __DATE__, __TIME__);
|
||||||
@@ -291,7 +291,7 @@ void RootConsoleMenu::OnRootConsoleCommand(const char *cmdname, const CCommand &
|
|||||||
|
|
||||||
CON_COMMAND(sm, "SourceMod Menu")
|
CON_COMMAND(sm, "SourceMod Menu")
|
||||||
{
|
{
|
||||||
#if !defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE <= SE_DARKMESSIAH
|
||||||
CCommand args;
|
CCommand args;
|
||||||
#endif
|
#endif
|
||||||
g_RootMenu.GotRootCmd(args);
|
g_RootMenu.GotRootCmd(args);
|
||||||
@@ -327,7 +327,7 @@ void write_handles_to_game(const char *fmt, ...)
|
|||||||
|
|
||||||
CON_COMMAND(sm_dump_handles, "Dumps Handle usage to a file for finding Handle leaks")
|
CON_COMMAND(sm_dump_handles, "Dumps Handle usage to a file for finding Handle leaks")
|
||||||
{
|
{
|
||||||
#if !defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE <= SE_DARKMESSIAH
|
||||||
CCommand args;
|
CCommand args;
|
||||||
#endif
|
#endif
|
||||||
if (args.ArgC() < 2)
|
if (args.ArgC() < 2)
|
||||||
|
|||||||
@@ -857,7 +857,7 @@ try_again:
|
|||||||
memcpy(new_params, params, sizeof(void *) * numparams);
|
memcpy(new_params, params, sizeof(void *) * numparams);
|
||||||
for (i = 0; i < trans.fmt_count; i++)
|
for (i = 0; i < trans.fmt_count; i++)
|
||||||
{
|
{
|
||||||
new_params[i] = const_cast<void *>(params[curparam + trans.fmt_order[i]]);
|
new_params[curparam + i] = const_cast<void *>(params[curparam + trans.fmt_order[i]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gnprintf(buf_p,
|
if (!gnprintf(buf_p,
|
||||||
@@ -1362,14 +1362,14 @@ char *sm_strdup(const char *str)
|
|||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace)
|
unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive)
|
||||||
{
|
{
|
||||||
size_t searchLen = strlen(search);
|
size_t searchLen = strlen(search);
|
||||||
size_t replaceLen = strlen(replace);
|
size_t replaceLen = strlen(replace);
|
||||||
|
|
||||||
char *ptr = subject;
|
char *ptr = subject;
|
||||||
unsigned int total = 0;
|
unsigned int total = 0;
|
||||||
while ((ptr = UTIL_ReplaceEx(ptr, maxlength, search, searchLen, replace, replaceLen)) != NULL)
|
while ((ptr = UTIL_ReplaceEx(ptr, maxlength, search, searchLen, replace, replaceLen, caseSensitive)) != NULL)
|
||||||
{
|
{
|
||||||
total++;
|
total++;
|
||||||
if (*ptr == '\0')
|
if (*ptr == '\0')
|
||||||
@@ -1394,7 +1394,7 @@ unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search
|
|||||||
* bad buffer sizes. Instead, this function will smartly cut off the
|
* bad buffer sizes. Instead, this function will smartly cut off the
|
||||||
* string in a way that pushes old data out.
|
* 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)
|
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;
|
char *ptr = subject;
|
||||||
size_t browsed = 0;
|
size_t browsed = 0;
|
||||||
@@ -1414,7 +1414,7 @@ char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t se
|
|||||||
/* If the search matches and the replace length is 0,
|
/* If the search matches and the replace length is 0,
|
||||||
* we can just terminate the string and be done.
|
* we can just terminate the string and be done.
|
||||||
*/
|
*/
|
||||||
if (strcmp(subject, search) == 0 && replaceLen == 0)
|
if ((caseSensitive ? strcmp(subject, search) : strcasecmp(subject, search)) == 0 && replaceLen == 0)
|
||||||
{
|
{
|
||||||
*subject = '\0';
|
*subject = '\0';
|
||||||
return subject;
|
return subject;
|
||||||
@@ -1431,7 +1431,7 @@ char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t se
|
|||||||
while (*ptr != '\0' && (browsed <= textLen - searchLen))
|
while (*ptr != '\0' && (browsed <= textLen - searchLen))
|
||||||
{
|
{
|
||||||
/* See if we get a comparison */
|
/* See if we get a comparison */
|
||||||
if (strncmp(ptr, search, searchLen) == 0)
|
if ((caseSensitive ? strncmp(ptr, search, searchLen) : strncasecmp(ptr, search, searchLen)) == 0)
|
||||||
{
|
{
|
||||||
if (replaceLen > searchLen)
|
if (replaceLen > searchLen)
|
||||||
{
|
{
|
||||||
@@ -1507,7 +1507,7 @@ char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t se
|
|||||||
* Search : BBB
|
* Search : BBB
|
||||||
* Replace: D
|
* Replace: D
|
||||||
* OUTPUT : AADCCC
|
* OUTPUT : AADCCC
|
||||||
* POSOTION: ^
|
* POSITION: ^
|
||||||
*/
|
*/
|
||||||
/* If the replacement does not grow the string length, we do not
|
/* If the replacement does not grow the string length, we do not
|
||||||
* need to do any fancy checking at all. Yay!
|
* need to do any fancy checking at all. Yay!
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ bool gnprintf(char *buffer,
|
|||||||
size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...);
|
size_t UTIL_Format(char *buffer, size_t maxlength, const char *fmt, ...);
|
||||||
size_t UTIL_FormatArgs(char *buffer, size_t maxlength, const char *fmt, va_list ap);
|
size_t UTIL_FormatArgs(char *buffer, size_t maxlength, const char *fmt, va_list ap);
|
||||||
char *sm_strdup(const char *str);
|
char *sm_strdup(const char *str);
|
||||||
unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace);
|
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);
|
char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive = true);
|
||||||
char *UTIL_TrimWhitespace(char *str, size_t &len);
|
char *UTIL_TrimWhitespace(char *str, size_t &len);
|
||||||
|
|
||||||
#endif // _INCLUDE_SOURCEMOD_STRINGUTIL_H_
|
#endif // _INCLUDE_SOURCEMOD_STRINGUTIL_H_
|
||||||
|
|||||||
@@ -268,6 +268,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
|
|||||||
ban_flags = params[3];
|
ban_flags = params[3];
|
||||||
ban_source = params[7];
|
ban_source = params[7];
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
/* Check how we should ban the player */
|
/* Check how we should ban the player */
|
||||||
if ((ban_flags & BANFLAG_AUTO) == BANFLAG_AUTO)
|
if ((ban_flags & BANFLAG_AUTO) == BANFLAG_AUTO)
|
||||||
{
|
{
|
||||||
@@ -303,6 +304,11 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
|
|||||||
{
|
{
|
||||||
return pContext->ThrowNativeError("No valid ban method flags specified");
|
return pContext->ThrowNativeError("No valid ban method flags specified");
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
/* Dark Messiah doesn't have Steam IDs so there is only one ban method to choose */
|
||||||
|
ban_flags |= BANFLAG_IP;
|
||||||
|
ban_flags &= ~BANFLAG_AUTHID;
|
||||||
|
#endif
|
||||||
|
|
||||||
cell_t handled = 0;
|
cell_t handled = 0;
|
||||||
if (ban_cmd[0] != '\0' && g_pOnBanClient->GetFunctionCount() > 0)
|
if (ban_cmd[0] != '\0' && g_pOnBanClient->GetFunctionCount() > 0)
|
||||||
|
|||||||
+81
-13
@@ -44,7 +44,11 @@
|
|||||||
#include <bitbuf.h>
|
#include <bitbuf.h>
|
||||||
#include <sm_trie_tpl.h>
|
#include <sm_trie_tpl.h>
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
#define NET_SETCONVAR 6
|
||||||
|
#else
|
||||||
#define NET_SETCONVAR 5
|
#define NET_SETCONVAR 5
|
||||||
|
#endif
|
||||||
|
|
||||||
enum ConVarBounds
|
enum ConVarBounds
|
||||||
{
|
{
|
||||||
@@ -63,7 +67,11 @@ struct GlobCmdIter
|
|||||||
|
|
||||||
struct ConCmdIter
|
struct ConCmdIter
|
||||||
{
|
{
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
ICvarIteratorInternal *pLast;
|
||||||
|
#else
|
||||||
const ConCommandBase *pLast;
|
const ConCommandBase *pLast;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConsoleHelpers :
|
class ConsoleHelpers :
|
||||||
@@ -93,6 +101,10 @@ public:
|
|||||||
else if (type == htConCmdIter)
|
else if (type == htConCmdIter)
|
||||||
{
|
{
|
||||||
ConCmdIter *iter = (ConCmdIter * )object;
|
ConCmdIter *iter = (ConCmdIter * )object;
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
// ICvarIteratorInternal has no virtual destructor
|
||||||
|
g_pMemAlloc->Free(iter->pLast);
|
||||||
|
#endif
|
||||||
delete iter;
|
delete iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,7 +141,7 @@ public:
|
|||||||
*flags = (*ppCmd)->GetFlags();
|
*flags = (*ppCmd)->GetFlags();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ((pCmd=FindConCommandBase(name)))
|
else if ((pCmd=FindCommandBase(name)))
|
||||||
{
|
{
|
||||||
m_CmdFlags.insert(name, pCmd);
|
m_CmdFlags.insert(name, pCmd);
|
||||||
TrackConCommandBase(pCmd, this);
|
TrackConCommandBase(pCmd, this);
|
||||||
@@ -151,7 +163,7 @@ public:
|
|||||||
TrackConCommandBase((*ppCmd), this);
|
TrackConCommandBase((*ppCmd), this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ((pCmd=FindConCommandBase(name)))
|
else if ((pCmd=FindCommandBase(name)))
|
||||||
{
|
{
|
||||||
m_CmdFlags.insert(name, pCmd);
|
m_CmdFlags.insert(name, pCmd);
|
||||||
pCmd->SetFlags(flags);
|
pCmd->SetFlags(flags);
|
||||||
@@ -167,7 +179,7 @@ private:
|
|||||||
KTrie<ConCommandBase *> m_CmdFlags;
|
KTrie<ConCommandBase *> m_CmdFlags;
|
||||||
} s_CommandFlagsHelper;
|
} s_CommandFlagsHelper;
|
||||||
|
|
||||||
#ifndef ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
static void ReplicateConVar(ConVar *pConVar)
|
static void ReplicateConVar(ConVar *pConVar)
|
||||||
{
|
{
|
||||||
int maxClients = g_Players.GetMaxClients();
|
int maxClients = g_Players.GetMaxClients();
|
||||||
@@ -341,7 +353,7 @@ static cell_t sm_SetConVarNum(IPluginContext *pContext, const cell_t *params)
|
|||||||
|
|
||||||
pConVar->SetValue(params[2]);
|
pConVar->SetValue(params[2]);
|
||||||
|
|
||||||
#ifndef ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
/* Should we replicate it? */
|
/* Should we replicate it? */
|
||||||
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
|
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
|
||||||
{
|
{
|
||||||
@@ -390,7 +402,7 @@ static cell_t sm_SetConVarFloat(IPluginContext *pContext, const cell_t *params)
|
|||||||
float value = sp_ctof(params[2]);
|
float value = sp_ctof(params[2]);
|
||||||
pConVar->SetValue(value);
|
pConVar->SetValue(value);
|
||||||
|
|
||||||
#ifndef ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
/* Should we replicate it? */
|
/* Should we replicate it? */
|
||||||
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
|
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
|
||||||
{
|
{
|
||||||
@@ -441,7 +453,7 @@ static cell_t sm_SetConVarString(IPluginContext *pContext, const cell_t *params)
|
|||||||
|
|
||||||
pConVar->SetValue(value);
|
pConVar->SetValue(value);
|
||||||
|
|
||||||
#ifndef ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
/* Should we replicate it? */
|
/* Should we replicate it? */
|
||||||
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
|
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
|
||||||
{
|
{
|
||||||
@@ -472,7 +484,7 @@ static cell_t sm_ResetConVar(IPluginContext *pContext, const cell_t *params)
|
|||||||
|
|
||||||
pConVar->Revert();
|
pConVar->Revert();
|
||||||
|
|
||||||
#ifndef ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
/* Should we replicate it? */
|
/* Should we replicate it? */
|
||||||
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
|
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
|
||||||
{
|
{
|
||||||
@@ -653,6 +665,12 @@ static cell_t sm_RegServerCmd(IPluginContext *pContext, const cell_t *params)
|
|||||||
IPluginFunction *pFunction;
|
IPluginFunction *pFunction;
|
||||||
|
|
||||||
pContext->LocalToString(params[1], &name);
|
pContext->LocalToString(params[1], &name);
|
||||||
|
|
||||||
|
if (strcasecmp(name, "sm") == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
pContext->LocalToString(params[3], &help);
|
pContext->LocalToString(params[3], &help);
|
||||||
pFunction = pContext->GetFunctionById(params[2]);
|
pFunction = pContext->GetFunctionById(params[2]);
|
||||||
|
|
||||||
@@ -675,6 +693,12 @@ static cell_t sm_RegConsoleCmd(IPluginContext *pContext, const cell_t *params)
|
|||||||
IPluginFunction *pFunction;
|
IPluginFunction *pFunction;
|
||||||
|
|
||||||
pContext->LocalToString(params[1], &name);
|
pContext->LocalToString(params[1], &name);
|
||||||
|
|
||||||
|
if (strcasecmp(name, "sm") == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
pContext->LocalToString(params[3], &help);
|
pContext->LocalToString(params[3], &help);
|
||||||
pFunction = pContext->GetFunctionById(params[2]);
|
pFunction = pContext->GetFunctionById(params[2]);
|
||||||
|
|
||||||
@@ -700,6 +724,12 @@ static cell_t sm_RegAdminCmd(IPluginContext *pContext, const cell_t *params)
|
|||||||
int cmdflags = params[6];
|
int cmdflags = params[6];
|
||||||
|
|
||||||
pContext->LocalToString(params[1], &name);
|
pContext->LocalToString(params[1], &name);
|
||||||
|
|
||||||
|
if (strcasecmp(name, "sm") == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
pContext->LocalToString(params[4], &help);
|
pContext->LocalToString(params[4], &help);
|
||||||
pContext->LocalToString(params[5], (char **)&group);
|
pContext->LocalToString(params[5], (char **)&group);
|
||||||
pFunction = pContext->GetFunctionById(params[2]);
|
pFunction = pContext->GetFunctionById(params[2]);
|
||||||
@@ -1151,12 +1181,21 @@ static cell_t FindFirstConCommand(IPluginContext *pContext, const cell_t *params
|
|||||||
pContext->LocalToPhysAddr(params[3], &pIsCmd);
|
pContext->LocalToPhysAddr(params[3], &pIsCmd);
|
||||||
pContext->LocalToPhysAddr(params[4], &pFlags);
|
pContext->LocalToPhysAddr(params[4], &pFlags);
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
ICvarIteratorInternal *cvarIter = icvar->FactoryInternalIterator();
|
||||||
|
cvarIter->SetFirst();
|
||||||
|
if (!cvarIter->IsValid())
|
||||||
|
{
|
||||||
|
return BAD_HANDLE;
|
||||||
|
}
|
||||||
|
pConCmd = cvarIter->Get();
|
||||||
|
#else
|
||||||
pConCmd = icvar->GetCommands();
|
pConCmd = icvar->GetCommands();
|
||||||
|
|
||||||
if (pConCmd == NULL)
|
if (pConCmd == NULL)
|
||||||
{
|
{
|
||||||
return BAD_HANDLE;
|
return BAD_HANDLE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
pContext->StringToLocalUTF8(params[1], params[2], pConCmd->GetName(), NULL);
|
pContext->StringToLocalUTF8(params[1], params[2], pConCmd->GetName(), NULL);
|
||||||
*pIsCmd = pConCmd->IsCommand() ? 1 : 0;
|
*pIsCmd = pConCmd->IsCommand() ? 1 : 0;
|
||||||
@@ -1169,7 +1208,11 @@ static cell_t FindFirstConCommand(IPluginContext *pContext, const cell_t *params
|
|||||||
}
|
}
|
||||||
|
|
||||||
pIter = new ConCmdIter;
|
pIter = new ConCmdIter;
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
pIter->pLast = cvarIter;
|
||||||
|
#else
|
||||||
pIter->pLast = pConCmd;
|
pIter->pLast = pConCmd;
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((hndl = g_HandleSys.CreateHandle(htConCmdIter, pIter, pContext->GetIdentity(), g_pCoreIdent, NULL))
|
if ((hndl = g_HandleSys.CreateHandle(htConCmdIter, pIter, pContext->GetIdentity(), g_pCoreIdent, NULL))
|
||||||
== BAD_HANDLE)
|
== BAD_HANDLE)
|
||||||
@@ -1187,6 +1230,7 @@ static cell_t FindNextConCommand(IPluginContext *pContext, const cell_t *params)
|
|||||||
ConCmdIter *pIter;
|
ConCmdIter *pIter;
|
||||||
cell_t *pIsCmd, *pFlags;
|
cell_t *pIsCmd, *pFlags;
|
||||||
const char *desc;
|
const char *desc;
|
||||||
|
const ConCommandBase *pConCmd;
|
||||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||||
|
|
||||||
if ((err = g_HandleSys.ReadHandle(params[1], htConCmdIter, &sec, (void **)&pIter)) != HandleError_None)
|
if ((err = g_HandleSys.ReadHandle(params[1], htConCmdIter, &sec, (void **)&pIter)) != HandleError_None)
|
||||||
@@ -1199,21 +1243,33 @@ static cell_t FindNextConCommand(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pIter->pLast = pIter->pLast->GetNext()) == NULL)
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
ICvarIteratorInternal *cvarIter = pIter->pLast;
|
||||||
|
cvarIter->Next();
|
||||||
|
if (!cvarIter->IsValid())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
pConCmd = cvarIter->Get();
|
||||||
|
#else
|
||||||
|
pConCmd = pIter->pLast->GetNext();
|
||||||
|
if (pConCmd == NULL)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
pIter->pLast = pConCmd;
|
||||||
|
#endif
|
||||||
|
|
||||||
pContext->LocalToPhysAddr(params[4], &pIsCmd);
|
pContext->LocalToPhysAddr(params[4], &pIsCmd);
|
||||||
pContext->LocalToPhysAddr(params[5], &pFlags);
|
pContext->LocalToPhysAddr(params[5], &pFlags);
|
||||||
|
|
||||||
pContext->StringToLocalUTF8(params[2], params[3], pIter->pLast->GetName(), NULL);
|
pContext->StringToLocalUTF8(params[2], params[3], pConCmd->GetName(), NULL);
|
||||||
*pIsCmd = pIter->pLast->IsCommand() ? 1 : 0;
|
*pIsCmd = pConCmd->IsCommand() ? 1 : 0;
|
||||||
*pFlags = pIter->pLast->GetFlags();
|
*pFlags = pConCmd->GetFlags();
|
||||||
|
|
||||||
if (params[7])
|
if (params[7])
|
||||||
{
|
{
|
||||||
desc = pIter->pLast->GetHelpText();
|
desc = pConCmd->GetHelpText();
|
||||||
pContext->StringToLocalUTF8(params[6], params[7], (desc && desc[0]) ? desc : "", NULL);
|
pContext->StringToLocalUTF8(params[6], params[7], (desc && desc[0]) ? desc : "", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1266,6 +1322,16 @@ static cell_t SendConVarValue(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t AddServerTag(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell_t RemoveServerTag(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
REGISTER_NATIVES(consoleNatives)
|
REGISTER_NATIVES(consoleNatives)
|
||||||
{
|
{
|
||||||
{"CreateConVar", sm_CreateConVar},
|
{"CreateConVar", sm_CreateConVar},
|
||||||
@@ -1313,5 +1379,7 @@ REGISTER_NATIVES(consoleNatives)
|
|||||||
{"FindFirstConCommand", FindFirstConCommand},
|
{"FindFirstConCommand", FindFirstConCommand},
|
||||||
{"FindNextConCommand", FindNextConCommand},
|
{"FindNextConCommand", FindNextConCommand},
|
||||||
{"SendConVarValue", SendConVarValue},
|
{"SendConVarValue", SendConVarValue},
|
||||||
|
{"AddServerTag", AddServerTag},
|
||||||
|
{"RemoveServerTag", RemoveServerTag},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ enum PropFieldType
|
|||||||
|
|
||||||
inline edict_t *GetEdict(cell_t num)
|
inline edict_t *GetEdict(cell_t num)
|
||||||
{
|
{
|
||||||
edict_t *pEdict = engine->PEntityOfEntIndex(num);
|
edict_t *pEdict = PEntityOfEntIndex(num);
|
||||||
if (!pEdict || pEdict->IsFree())
|
if (!pEdict || pEdict->IsFree())
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -72,9 +72,9 @@ inline edict_t *GetEdict(cell_t num)
|
|||||||
return pEdict;
|
return pEdict;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline edict_t *GetEntity(cell_t num, CBaseEntity **pData)
|
edict_t *GetEntity(cell_t num, CBaseEntity **pData)
|
||||||
{
|
{
|
||||||
edict_t *pEdict = engine->PEntityOfEntIndex(num);
|
edict_t *pEdict = PEntityOfEntIndex(num);
|
||||||
if (!pEdict || pEdict->IsFree())
|
if (!pEdict || pEdict->IsFree())
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -156,12 +156,12 @@ static cell_t CreateEdict(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return engine->IndexOfEdict(pEdict);
|
return IndexOfEdict(pEdict);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t RemoveEdict(IPluginContext *pContext, const cell_t *params)
|
static cell_t RemoveEdict(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
edict_t *pEdict = engine->PEntityOfEntIndex(params[1]);
|
edict_t *pEdict = PEntityOfEntIndex(params[1]);
|
||||||
|
|
||||||
if (!pEdict)
|
if (!pEdict)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ static cell_t CreateFakeClient(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return engine->IndexOfEdict(pEdict);
|
return IndexOfEdict(pEdict);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t SetFakeClientConVar(IPluginContext *pContext, const cell_t *params)
|
static cell_t SetFakeClientConVar(IPluginContext *pContext, const cell_t *params)
|
||||||
@@ -445,6 +445,10 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
|
|||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
else if (version == SOURCE_ENGINE_DARKMESSIAH)
|
||||||
|
{
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
else if (version == SOURCE_ENGINE_EPISODEONE)
|
else if (version == SOURCE_ENGINE_EPISODEONE)
|
||||||
{
|
{
|
||||||
return 20;
|
return 20;
|
||||||
@@ -453,6 +457,10 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
|
|||||||
{
|
{
|
||||||
return 30;
|
return 30;
|
||||||
}
|
}
|
||||||
|
else if (version == SOURCE_ENGINE_LEFT4DEAD)
|
||||||
|
{
|
||||||
|
return 40;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
if (g_HL2.IsOriginalEngine())
|
if (g_HL2.IsOriginalEngine())
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-11
@@ -42,7 +42,7 @@ int g_HudMsgNum = -1;
|
|||||||
|
|
||||||
struct hud_syncobj_t
|
struct hud_syncobj_t
|
||||||
{
|
{
|
||||||
int *player_channels;
|
int player_channels[256 + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct player_chaninfo_t
|
struct player_chaninfo_t
|
||||||
@@ -116,7 +116,6 @@ public:
|
|||||||
{
|
{
|
||||||
hud_syncobj_t *obj = (hud_syncobj_t *)object;
|
hud_syncobj_t *obj = (hud_syncobj_t *)object;
|
||||||
|
|
||||||
delete [] obj->player_channels;
|
|
||||||
delete obj;
|
delete obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,27 +137,19 @@ public:
|
|||||||
Handle_t CreateHudSyncObj(IdentityToken_t *pIdent)
|
Handle_t CreateHudSyncObj(IdentityToken_t *pIdent)
|
||||||
{
|
{
|
||||||
Handle_t hndl;
|
Handle_t hndl;
|
||||||
int max_clients;
|
|
||||||
HandleError err;
|
HandleError err;
|
||||||
hud_syncobj_t *obj;
|
hud_syncobj_t *obj;
|
||||||
HandleSecurity sec;
|
HandleSecurity sec;
|
||||||
|
|
||||||
if ((max_clients = g_Players.MaxClients()) == 0)
|
|
||||||
{
|
|
||||||
max_clients = 256+1;
|
|
||||||
}
|
|
||||||
|
|
||||||
obj = new hud_syncobj_t;
|
obj = new hud_syncobj_t;
|
||||||
obj->player_channels = new int[max_clients];
|
|
||||||
|
|
||||||
memset(obj->player_channels, 0, sizeof(int) * max_clients);
|
memset(obj->player_channels, 0, sizeof(obj->player_channels));
|
||||||
|
|
||||||
sec = HandleSecurity(pIdent, g_pCoreIdent);
|
sec = HandleSecurity(pIdent, g_pCoreIdent);
|
||||||
|
|
||||||
if ((hndl = g_HandleSys.CreateHandleEx(m_hHudSyncObj, obj, &sec, NULL, &err))
|
if ((hndl = g_HandleSys.CreateHandleEx(m_hHudSyncObj, obj, &sec, NULL, &err))
|
||||||
== BAD_HANDLE)
|
== BAD_HANDLE)
|
||||||
{
|
{
|
||||||
delete [] obj->player_channels;
|
|
||||||
delete obj;
|
delete obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -770,10 +770,7 @@ static cell_t smn_KeyValuesToFile(IPluginContext *pCtx, const cell_t *params)
|
|||||||
|
|
||||||
pCtx->LocalToString(params[2], &path);
|
pCtx->LocalToString(params[2], &path);
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH];
|
return pStk->pCurRoot.front()->SaveToFile(basefilesystem, path);
|
||||||
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", path);
|
|
||||||
|
|
||||||
return pStk->pCurRoot.front()->SaveToFile(basefilesystem, realpath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t smn_FileToKeyValues(IPluginContext *pCtx, const cell_t *params)
|
static cell_t smn_FileToKeyValues(IPluginContext *pCtx, const cell_t *params)
|
||||||
@@ -796,11 +793,8 @@ static cell_t smn_FileToKeyValues(IPluginContext *pCtx, const cell_t *params)
|
|||||||
|
|
||||||
pCtx->LocalToString(params[2], &path);
|
pCtx->LocalToString(params[2], &path);
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH];
|
|
||||||
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", path);
|
|
||||||
|
|
||||||
kv = pStk->pCurRoot.front();
|
kv = pStk->pCurRoot.front();
|
||||||
return g_HL2.KVLoadFromFile(kv, basefilesystem, realpath);
|
return g_HL2.KVLoadFromFile(kv, basefilesystem, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t smn_KvSetEscapeSequences(IPluginContext *pCtx, const cell_t *params)
|
static cell_t smn_KvSetEscapeSequences(IPluginContext *pCtx, const cell_t *params)
|
||||||
|
|||||||
+15
-2
@@ -676,7 +676,13 @@ static cell_t VoteMenu(IPluginContext *pContext, const cell_t *params)
|
|||||||
cell_t *addr;
|
cell_t *addr;
|
||||||
pContext->LocalToPhysAddr(params[2], &addr);
|
pContext->LocalToPhysAddr(params[2], &addr);
|
||||||
|
|
||||||
if (!g_Menus.StartVote(menu, params[3], addr, params[4]))
|
cell_t flags = 0;
|
||||||
|
if (params[0] >= 5)
|
||||||
|
{
|
||||||
|
flags = params[5];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!g_Menus.StartVote(menu, params[3], addr, params[4], flags))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1445,7 +1451,13 @@ static cell_t RedrawClientVoteMenu(IPluginContext *pContext, const cell_t *param
|
|||||||
return pContext->ThrowNativeError("Client is not in the voting pool");
|
return pContext->ThrowNativeError("Client is not in the voting pool");
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_Menus.RedrawClientVoteMenu(client) ? 1 : 0;
|
bool revote = true;
|
||||||
|
if (params[0] >= 2 && !params[2])
|
||||||
|
{
|
||||||
|
revote = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_Menus.RedrawClientVoteMenu2(client, revote) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
class EmptyMenuHandler : public IMenuHandler
|
class EmptyMenuHandler : public IMenuHandler
|
||||||
@@ -1567,3 +1579,4 @@ REGISTER_NATIVES(menuNatives)
|
|||||||
{"VoteMenu", VoteMenu},
|
{"VoteMenu", VoteMenu},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1551,6 +1551,24 @@ static cell_t FormatActivitySource(IPluginContext *pContext, const cell_t *param
|
|||||||
return bShowActivity ? 1 : 0;
|
return bShowActivity ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t sm_GetClientSerial(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
int client = params[1];
|
||||||
|
|
||||||
|
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||||
|
if (!pPlayer)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pPlayer->GetSerial();
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell_t sm_GetClientFromSerial(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
return g_Players.GetClientFromSerial(params[1]);
|
||||||
|
}
|
||||||
|
|
||||||
REGISTER_NATIVES(playernatives)
|
REGISTER_NATIVES(playernatives)
|
||||||
{
|
{
|
||||||
{"AddUserFlags", AddUserFlags},
|
{"AddUserFlags", AddUserFlags},
|
||||||
@@ -1604,6 +1622,8 @@ REGISTER_NATIVES(playernatives)
|
|||||||
{"IsClientInKickQueue", IsClientInKickQueue},
|
{"IsClientInKickQueue", IsClientInKickQueue},
|
||||||
{"ProcessTargetString", ProcessTargetString},
|
{"ProcessTargetString", ProcessTargetString},
|
||||||
{"FormatActivitySource", FormatActivitySource},
|
{"FormatActivitySource", FormatActivitySource},
|
||||||
|
{"GetClientSerial", sm_GetClientSerial},
|
||||||
|
{"GetClientFromSerial", sm_GetClientFromSerial},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -34,9 +34,7 @@
|
|||||||
|
|
||||||
//Note: Do not add this to Linux yet, i haven't done the HPET timing research (if even available)
|
//Note: Do not add this to Linux yet, i haven't done the HPET timing research (if even available)
|
||||||
//nonetheless we need accurate counting
|
//nonetheless we need accurate counting
|
||||||
#if defined PLATFORM_LINUX
|
#if !defined PLATFORM_LINUX
|
||||||
#error "Not supported"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct Profiler
|
struct Profiler
|
||||||
{
|
{
|
||||||
@@ -183,3 +181,5 @@ REGISTER_NATIVES(profilerNatives)
|
|||||||
{"StopProfiling", StopProfiling},
|
{"StopProfiling", StopProfiling},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
+24
-2
@@ -491,24 +491,36 @@ static cell_t ReplaceString(IPluginContext *pContext, const cell_t *params)
|
|||||||
{
|
{
|
||||||
char *text, *search, *replace;
|
char *text, *search, *replace;
|
||||||
size_t maxlength;
|
size_t maxlength;
|
||||||
|
bool caseSensitive;
|
||||||
|
|
||||||
pContext->LocalToString(params[1], &text);
|
pContext->LocalToString(params[1], &text);
|
||||||
pContext->LocalToString(params[3], &search);
|
pContext->LocalToString(params[3], &search);
|
||||||
pContext->LocalToString(params[4], &replace);
|
pContext->LocalToString(params[4], &replace);
|
||||||
maxlength = (size_t)params[2];
|
maxlength = (size_t)params[2];
|
||||||
|
|
||||||
|
/* Account for old binary plugins that won't pass the last parameter */
|
||||||
|
if (params[0] == 5)
|
||||||
|
{
|
||||||
|
caseSensitive = (bool)params[5];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
caseSensitive = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (search[0] == '\0')
|
if (search[0] == '\0')
|
||||||
{
|
{
|
||||||
return pContext->ThrowNativeError("Cannot replace searches of empty strings");
|
return pContext->ThrowNativeError("Cannot replace searches of empty strings");
|
||||||
}
|
}
|
||||||
|
|
||||||
return UTIL_ReplaceAll(text, maxlength, search, replace);
|
return UTIL_ReplaceAll(text, maxlength, search, replace, caseSensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t ReplaceStringEx(IPluginContext *pContext, const cell_t *params)
|
static cell_t ReplaceStringEx(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
char *text, *search, *replace;
|
char *text, *search, *replace;
|
||||||
size_t maxlength;
|
size_t maxlength;
|
||||||
|
bool caseSensitive;
|
||||||
|
|
||||||
pContext->LocalToString(params[1], &text);
|
pContext->LocalToString(params[1], &text);
|
||||||
pContext->LocalToString(params[3], &search);
|
pContext->LocalToString(params[3], &search);
|
||||||
@@ -518,12 +530,22 @@ static cell_t ReplaceStringEx(IPluginContext *pContext, const cell_t *params)
|
|||||||
size_t searchLen = (params[5] == -1) ? strlen(search) : (size_t)params[5];
|
size_t searchLen = (params[5] == -1) ? strlen(search) : (size_t)params[5];
|
||||||
size_t replaceLen = (params[6] == -1) ? strlen(replace) : (size_t)params[6];
|
size_t replaceLen = (params[6] == -1) ? strlen(replace) : (size_t)params[6];
|
||||||
|
|
||||||
|
/* Account for old binary plugins that won't pass the last parameter */
|
||||||
|
if (params[0] == 7)
|
||||||
|
{
|
||||||
|
caseSensitive = (bool)params[7];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
caseSensitive = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (searchLen == 0)
|
if (searchLen == 0)
|
||||||
{
|
{
|
||||||
return pContext->ThrowNativeError("Cannot replace searches of empty strings");
|
return pContext->ThrowNativeError("Cannot replace searches of empty strings");
|
||||||
}
|
}
|
||||||
|
|
||||||
char *ptr = UTIL_ReplaceEx(text, maxlength, search, searchLen, replace, replaceLen);
|
char *ptr = UTIL_ReplaceEx(text, maxlength, search, searchLen, replace, replaceLen, caseSensitive);
|
||||||
|
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
+7
-6
@@ -35,7 +35,8 @@
|
|||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "DebugReporter.h"
|
#include "DebugReporter.h"
|
||||||
|
|
||||||
#define TIMER_HNDL_CLOSE (1<<9)
|
#define TIMER_DATA_HNDL_CLOSE (1<<9)
|
||||||
|
#define TIMER_HNDL_CLOSE (1<<9)
|
||||||
|
|
||||||
HandleType_t g_TimerType;
|
HandleType_t g_TimerType;
|
||||||
|
|
||||||
@@ -147,14 +148,14 @@ void TimerNatives::OnTimerEnd(ITimer *pTimer, void *pData)
|
|||||||
sec.pOwner = pInfo->pContext->GetIdentity();
|
sec.pOwner = pInfo->pContext->GetIdentity();
|
||||||
sec.pIdentity = g_pCoreIdent;
|
sec.pIdentity = g_pCoreIdent;
|
||||||
|
|
||||||
if (pInfo->Flags & TIMER_HNDL_CLOSE)
|
if (pInfo->Flags & TIMER_DATA_HNDL_CLOSE)
|
||||||
{
|
{
|
||||||
if ((herr=g_HandleSys.FreeHandle(usrhndl, &sec)) != HandleError_None)
|
if ((herr=g_HandleSys.FreeHandle(usrhndl, &sec)) != HandleError_None)
|
||||||
{
|
{
|
||||||
g_DbgReporter.GenerateError(pInfo->pContext,
|
g_DbgReporter.GenerateError(pInfo->pContext,
|
||||||
pInfo->Hook->GetFunctionID(),
|
pInfo->Hook->GetFunctionID(),
|
||||||
SP_ERROR_NATIVE,
|
SP_ERROR_NATIVE,
|
||||||
"Invalid data handle %x (error %d) passed during timer end",
|
"Invalid data handle %x (error %d) passed during timer end with TIMER_DATA_HNDL_CLOSE",
|
||||||
usrhndl,
|
usrhndl,
|
||||||
herr);
|
herr);
|
||||||
}
|
}
|
||||||
@@ -215,7 +216,7 @@ static cell_t smn_CreateTimer(IPluginContext *pCtx, const cell_t *params)
|
|||||||
if (hndl == BAD_HANDLE)
|
if (hndl == BAD_HANDLE)
|
||||||
{
|
{
|
||||||
/* Free this for completeness. */
|
/* Free this for completeness. */
|
||||||
if (flags & TIMER_HNDL_CLOSE)
|
if (flags & TIMER_DATA_HNDL_CLOSE)
|
||||||
{
|
{
|
||||||
HandleSecurity sec(pCtx->GetIdentity(), g_pCoreIdent);
|
HandleSecurity sec(pCtx->GetIdentity(), g_pCoreIdent);
|
||||||
g_HandleSys.FreeHandle(params[3], &sec);
|
g_HandleSys.FreeHandle(params[3], &sec);
|
||||||
@@ -255,14 +256,14 @@ static cell_t smn_KillTimer(IPluginContext *pCtx, const cell_t *params)
|
|||||||
|
|
||||||
g_Timers.KillTimer(pInfo->Timer);
|
g_Timers.KillTimer(pInfo->Timer);
|
||||||
|
|
||||||
if (params[2] && !(pInfo->Flags & TIMER_HNDL_CLOSE))
|
if (params[2] && !(pInfo->Flags & TIMER_DATA_HNDL_CLOSE))
|
||||||
{
|
{
|
||||||
sec.pOwner = pInfo->pContext->GetIdentity();
|
sec.pOwner = pInfo->pContext->GetIdentity();
|
||||||
sec.pIdentity = g_pCoreIdent;
|
sec.pIdentity = g_pCoreIdent;
|
||||||
|
|
||||||
if ((herr=g_HandleSys.FreeHandle(static_cast<Handle_t>(pInfo->UserData), &sec)) != HandleError_None)
|
if ((herr=g_HandleSys.FreeHandle(static_cast<Handle_t>(pInfo->UserData), &sec)) != HandleError_None)
|
||||||
{
|
{
|
||||||
return pCtx->ThrowNativeError("Invalid data handle %x (error %d)", hndl, herr);
|
return pCtx->ThrowNativeError("Invalid data handle %x (error %d) on timer kill with TIMER_DATA_HNDL_CLOSE", hndl, herr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ void UsrMessageNatives::OnPluginUnloaded(IPlugin *plugin)
|
|||||||
for (iter=pList->begin(); iter!=pList->end(); iter++)
|
for (iter=pList->begin(); iter!=pList->end(); iter++)
|
||||||
{
|
{
|
||||||
pListener = (*iter);
|
pListener = (*iter);
|
||||||
if (g_UserMsgs.UnhookUserMessage(pListener->GetMessageId(), pListener, pListener->IsInterceptHook()))
|
if (g_UserMsgs.UnhookUserMessage2(pListener->GetMessageId(), pListener, pListener->IsInterceptHook()))
|
||||||
{
|
{
|
||||||
m_FreeListeners.push(pListener);
|
m_FreeListeners.push(pListener);
|
||||||
}
|
}
|
||||||
@@ -309,7 +309,7 @@ ResultType MsgListenerWrapper::InterceptUserMessage(int msg_id, bf_write *bf, IR
|
|||||||
return static_cast<ResultType>(res);
|
return static_cast<ResultType>(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MsgListenerWrapper::OnUserMessageSent(int msg_id)
|
void MsgListenerWrapper::OnPostUserMessage(int msg_id, bool sent)
|
||||||
{
|
{
|
||||||
if (!m_Notify)
|
if (!m_Notify)
|
||||||
{
|
{
|
||||||
@@ -318,6 +318,7 @@ void MsgListenerWrapper::OnUserMessageSent(int msg_id)
|
|||||||
|
|
||||||
cell_t res;
|
cell_t res;
|
||||||
m_Notify->PushCell(msg_id);
|
m_Notify->PushCell(msg_id);
|
||||||
|
m_Notify->PushCell(sent ? 1 : 0);
|
||||||
m_Notify->Execute(&res);
|
m_Notify->Execute(&res);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -490,7 +491,7 @@ static cell_t smn_HookUserMessage(IPluginContext *pCtx, const cell_t *params)
|
|||||||
pListener = s_UsrMessageNatives.CreateListener(pCtx);
|
pListener = s_UsrMessageNatives.CreateListener(pCtx);
|
||||||
pListener->Initialize(msgid, pHook, pNotify, intercept);
|
pListener->Initialize(msgid, pHook, pNotify, intercept);
|
||||||
|
|
||||||
g_UserMsgs.HookUserMessage(msgid, pListener, intercept);
|
g_UserMsgs.HookUserMessage2(msgid, pListener, intercept);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -521,7 +522,7 @@ static cell_t smn_UnhookUserMessage(IPluginContext *pCtx, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pListener = (*iter);
|
pListener = (*iter);
|
||||||
if (!g_UserMsgs.UnhookUserMessage(msgid, pListener, intercept))
|
if (!g_UserMsgs.UnhookUserMessage2(msgid, pListener, intercept))
|
||||||
{
|
{
|
||||||
return pCtx->ThrowNativeError("Unable to unhook the current user message");
|
return pCtx->ThrowNativeError("Unable to unhook the current user message");
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ public:
|
|||||||
public: //IUserMessageListener
|
public: //IUserMessageListener
|
||||||
void OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter);
|
void OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter);
|
||||||
ResultType InterceptUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter);
|
ResultType InterceptUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter);
|
||||||
void OnUserMessageSent(int msg_id);
|
void OnPostUserMessage(int msg_id, bool sent);
|
||||||
private:
|
private:
|
||||||
size_t _FillInPlayers(int *pl_array, IRecipientFilter *pFilter);
|
size_t _FillInPlayers(int *pl_array, IRecipientFilter *pFilter);
|
||||||
private:
|
private:
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include <vector.h>
|
#include <vector.h>
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
#include <mathlib.h>
|
#include <mathlib.h>
|
||||||
#else
|
#else
|
||||||
#include <math_base.h>
|
#include <math_base.h>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include "sourcemod.h"
|
#include "sourcemod.h"
|
||||||
#include "sourcemm_api.h"
|
#include "sourcemm_api.h"
|
||||||
#include "sm_version.h"
|
#include <sourcemod_version.h>
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "ExtensionSys.h"
|
#include "ExtensionSys.h"
|
||||||
#include "concmd_cleaner.h"
|
#include "concmd_cleaner.h"
|
||||||
@@ -145,7 +145,7 @@ const char *SourceMod_Core::GetLicense()
|
|||||||
|
|
||||||
const char *SourceMod_Core::GetVersion()
|
const char *SourceMod_Core::GetVersion()
|
||||||
{
|
{
|
||||||
return SVN_FULL_VERSION;
|
return SM_FULL_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *SourceMod_Core::GetDate()
|
const char *SourceMod_Core::GetDate()
|
||||||
@@ -237,4 +237,3 @@ void *SourceMod_Core::OnMetamodQuery(const char *iface, int *ret)
|
|||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -32,10 +32,12 @@
|
|||||||
#ifndef _INCLUDE_SOURCEMOD_MM_API_H_
|
#ifndef _INCLUDE_SOURCEMOD_MM_API_H_
|
||||||
#define _INCLUDE_SOURCEMOD_MM_API_H_
|
#define _INCLUDE_SOURCEMOD_MM_API_H_
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
#include "convar_sm_ob.h"
|
#include "convar_sm_l4d.h"
|
||||||
|
#elif (SOURCE_ENGINE == SE_ORANGEBOX) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE)
|
||||||
|
#include "convar_sm_ob.h"
|
||||||
#else
|
#else
|
||||||
#include "convar_sm.h"
|
#include "convar_sm.h"
|
||||||
#endif
|
#endif
|
||||||
#include <ISmmPlugin.h>
|
#include <ISmmPlugin.h>
|
||||||
#include <eiface.h>
|
#include <eiface.h>
|
||||||
|
|||||||
+68
-9
@@ -48,6 +48,7 @@
|
|||||||
#include "GameConfigs.h"
|
#include "GameConfigs.h"
|
||||||
#include "DebugReporter.h"
|
#include "DebugReporter.h"
|
||||||
#include "Profiler.h"
|
#include "Profiler.h"
|
||||||
|
#include "frame_hooks.h"
|
||||||
|
|
||||||
SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, false, bool, const char *, const char *, const char *, const char *, bool, bool);
|
SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, false, bool, const char *, const char *, const char *, const char *, bool, bool);
|
||||||
SH_DECL_HOOK0_void(IServerGameDLL, LevelShutdown, SH_NOATTRIB, false);
|
SH_DECL_HOOK0_void(IServerGameDLL, LevelShutdown, SH_NOATTRIB, false);
|
||||||
@@ -69,6 +70,12 @@ typedef ISourcePawnEngine *(*GET_SP_V1)();
|
|||||||
typedef ISourcePawnEngine2 *(*GET_SP_V2)();
|
typedef ISourcePawnEngine2 *(*GET_SP_V2)();
|
||||||
typedef void (*NOTIFYSHUTDOWN)();
|
typedef void (*NOTIFYSHUTDOWN)();
|
||||||
|
|
||||||
|
#ifdef PLATFORM_WINDOWS
|
||||||
|
ConVar sm_basepath("sm_basepath", "addons\\sourcemod", 0, "SourceMod base path (set via command line)");
|
||||||
|
#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||||
|
ConVar sm_basepath("sm_basepath", "addons/sourcemod", 0, "SourceMod base path (set via command line)");
|
||||||
|
#endif
|
||||||
|
|
||||||
void ShutdownJIT()
|
void ShutdownJIT()
|
||||||
{
|
{
|
||||||
NOTIFYSHUTDOWN notify = (NOTIFYSHUTDOWN)g_pJIT->GetSymbolAddress("NotifyShutdown");
|
NOTIFYSHUTDOWN notify = (NOTIFYSHUTDOWN)g_pJIT->GetSymbolAddress("NotifyShutdown");
|
||||||
@@ -144,16 +151,26 @@ bool SourceModBase::InitializeSourceMod(char *error, size_t maxlength, bool late
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize CoreConfig so we can get SourceMod base path properly - this basically parses core.cfg */
|
const char *basepath = icvar->GetCommandLineValue("sm_basepath");
|
||||||
g_CoreConfig.Initialize();
|
/* Set a custom base path if there is one. */
|
||||||
|
if (basepath != NULL && basepath[0] != '\0')
|
||||||
/* This shouldn't happen, but can't hurt to be safe */
|
|
||||||
if (!g_LibSys.PathExists(m_SMBaseDir) || !m_GotBasePath)
|
|
||||||
{
|
{
|
||||||
g_LibSys.PathFormat(m_SMBaseDir, sizeof(m_SMBaseDir), "%s/addons/sourcemod", g_BaseDir.c_str());
|
|
||||||
g_LibSys.PathFormat(m_SMRelDir, sizeof(m_SMRelDir), "addons/sourcemod");
|
|
||||||
m_GotBasePath = true;
|
m_GotBasePath = true;
|
||||||
}
|
}
|
||||||
|
/* Otherwise, use a default and keep the m_GotBasePath unlocked. */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
basepath = sm_basepath.GetDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
g_LibSys.PathFormat(m_SMBaseDir, sizeof(m_SMBaseDir), "%s/%s", g_BaseDir.c_str(), basepath);
|
||||||
|
g_LibSys.PathFormat(m_SMRelDir, sizeof(m_SMRelDir), "%s", basepath);
|
||||||
|
|
||||||
|
/* Initialize CoreConfig to get the SourceMod base path properly - this parses core.cfg */
|
||||||
|
g_CoreConfig.Initialize();
|
||||||
|
|
||||||
|
/* There will always be a path by this point, since it was force-set above. */
|
||||||
|
m_GotBasePath = true;
|
||||||
|
|
||||||
/* Attempt to load the JIT! */
|
/* Attempt to load the JIT! */
|
||||||
char file[PLATFORM_MAX_PATH];
|
char file[PLATFORM_MAX_PATH];
|
||||||
@@ -200,7 +217,7 @@ bool SourceModBase::InitializeSourceMod(char *error, size_t maxlength, bool late
|
|||||||
g_pSourcePawn = getv1();
|
g_pSourcePawn = getv1();
|
||||||
g_pSourcePawn2 = getv2();
|
g_pSourcePawn2 = getv2();
|
||||||
|
|
||||||
if (g_pSourcePawn2->GetAPIVersion() < 2)
|
if (g_pSourcePawn2->GetAPIVersion() < 3)
|
||||||
{
|
{
|
||||||
g_pSourcePawn2 = NULL;
|
g_pSourcePawn2 = NULL;
|
||||||
if (error && maxlength)
|
if (error && maxlength)
|
||||||
@@ -283,6 +300,13 @@ void SourceModBase::StartSourceMod(bool late)
|
|||||||
{
|
{
|
||||||
g_SourceMod_Core.OnVSPListening(vsp_interface);
|
g_SourceMod_Core.OnVSPListening(vsp_interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If we want to autoload, do that now */
|
||||||
|
const char *disabled = GetCoreConfigValue("DisableAutoUpdate");
|
||||||
|
if (disabled == NULL || strcasecmp(disabled, "yes") != 0)
|
||||||
|
{
|
||||||
|
g_Extensions.LoadAutoExtension("updater.ext." PLATFORM_LIB_EXT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool g_LevelEndBarrier = false;
|
static bool g_LevelEndBarrier = false;
|
||||||
@@ -379,7 +403,7 @@ void SourceModBase::DoGlobalPluginLoads()
|
|||||||
g_Extensions.TryAutoload();
|
g_Extensions.TryAutoload();
|
||||||
|
|
||||||
/* Fire the extensions ready message */
|
/* Fire the extensions ready message */
|
||||||
g_SMAPI->MetaFactory(SOURCEMOD_NOTICE_EXTENSIONS, NULL, NULL);
|
g_SMAPI->MetaFactory(SOURCEMOD_NOTICE_EXTENSIONS, NULL, NULL);
|
||||||
|
|
||||||
/* Load any game extension */
|
/* Load any game extension */
|
||||||
const char *game_ext;
|
const char *game_ext;
|
||||||
@@ -670,6 +694,41 @@ void SourceModBase::ProcessGameFrameHooks(bool simulating)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t SourceModBase::Format(char *buffer, size_t maxlength, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
len = FormatArgs(buffer, maxlength, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t SourceModBase::FormatArgs(char *buffer,
|
||||||
|
size_t maxlength,
|
||||||
|
const char *fmt,
|
||||||
|
va_list ap)
|
||||||
|
{
|
||||||
|
return UTIL_FormatArgs(buffer, maxlength, fmt, ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SourceModBase::AddFrameAction(FRAMEACTION fn, void *data)
|
||||||
|
{
|
||||||
|
::AddFrameAction(FrameAction(fn, data));
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *SourceModBase::GetCoreConfigValue(const char *key)
|
||||||
|
{
|
||||||
|
return g_CoreConfig.GetCoreConfigValue(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
int SourceModBase::GetPluginId()
|
||||||
|
{
|
||||||
|
return g_PLID;
|
||||||
|
}
|
||||||
|
|
||||||
SMGlobalClass *SMGlobalClass::head = NULL;
|
SMGlobalClass *SMGlobalClass::head = NULL;
|
||||||
|
|
||||||
SMGlobalClass::SMGlobalClass()
|
SMGlobalClass::SMGlobalClass()
|
||||||
|
|||||||
@@ -129,6 +129,11 @@ public: // ISourceMod
|
|||||||
void AddGameFrameHook(GAME_FRAME_HOOK hook);
|
void AddGameFrameHook(GAME_FRAME_HOOK hook);
|
||||||
void RemoveGameFrameHook(GAME_FRAME_HOOK hook);
|
void RemoveGameFrameHook(GAME_FRAME_HOOK hook);
|
||||||
void ProcessGameFrameHooks(bool simulating);
|
void ProcessGameFrameHooks(bool simulating);
|
||||||
|
size_t Format(char *buffer, size_t maxlength, const char *fmt, ...);
|
||||||
|
size_t FormatArgs(char *buffer, size_t maxlength, const char *fmt, va_list ap);
|
||||||
|
void AddFrameAction(FRAMEACTION fn, void *data);
|
||||||
|
const char *GetCoreConfigValue(const char *key);
|
||||||
|
int GetPluginId();
|
||||||
private:
|
private:
|
||||||
CStack<CDataPack *> m_freepacks;
|
CStack<CDataPack *> m_freepacks;
|
||||||
char m_SMBaseDir[PLATFORM_MAX_PATH];
|
char m_SMBaseDir[PLATFORM_MAX_PATH];
|
||||||
|
|||||||
+5
-5
@@ -9,7 +9,7 @@
|
|||||||
//
|
//
|
||||||
#include "winres.h"
|
#include "winres.h"
|
||||||
|
|
||||||
#include "sm_version.h"
|
#include <sourcemod_version.h>
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
#undef APSTUDIO_READONLY_SYMBOLS
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
@@ -29,8 +29,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION SVN_FILE_VERSION
|
FILEVERSION SM_FILE_VERSION
|
||||||
PRODUCTVERSION SVN_FILE_VERSION
|
PRODUCTVERSION SM_FILE_VERSION
|
||||||
FILEFLAGSMASK 0x17L
|
FILEFLAGSMASK 0x17L
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
@@ -47,12 +47,12 @@ BEGIN
|
|||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Comments", "SourceMod"
|
VALUE "Comments", "SourceMod"
|
||||||
VALUE "FileDescription", "SourceMod Core"
|
VALUE "FileDescription", "SourceMod Core"
|
||||||
VALUE "FileVersion", SVN_FULL_VERSION
|
VALUE "FileVersion", SM_FULL_VERSION
|
||||||
VALUE "InternalName", "sourcemod"
|
VALUE "InternalName", "sourcemod"
|
||||||
VALUE "LegalCopyright", "Copyright (c) 2004-2008, AlliedModders LLC"
|
VALUE "LegalCopyright", "Copyright (c) 2004-2008, AlliedModders LLC"
|
||||||
VALUE "OriginalFilename", BINARY_NAME
|
VALUE "OriginalFilename", BINARY_NAME
|
||||||
VALUE "ProductName", "SourceMod"
|
VALUE "ProductName", "SourceMod"
|
||||||
VALUE "ProductVersion", SVN_FULL_VERSION
|
VALUE "ProductVersion", SM_FULL_VERSION
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||||
|
import os
|
||||||
|
|
||||||
|
for i in SM.sdkInfo:
|
||||||
|
sdk = SM.sdkInfo[i]
|
||||||
|
name = 'bintools.ext.' + sdk['ext']
|
||||||
|
|
||||||
|
compiler = SM.DefaultHL2Compiler('extensions/bintools', i, True, '')
|
||||||
|
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit'))
|
||||||
|
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit', 'x86'))
|
||||||
|
|
||||||
|
if i != 'ep1':
|
||||||
|
compiler['CDEFINES'].append('HOOKING_ENABLED')
|
||||||
|
|
||||||
|
extension = AMBuild.AddJob(name)
|
||||||
|
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
|
||||||
|
SM.PreSetupHL2Job(extension, binary, i)
|
||||||
|
binary.AddSourceFiles('extensions/bintools', [
|
||||||
|
'extension.cpp',
|
||||||
|
'CallMaker.cpp',
|
||||||
|
'CallWrapper.cpp',
|
||||||
|
'HookWrapper.cpp',
|
||||||
|
'jit_call.cpp',
|
||||||
|
'jit_hook.cpp',
|
||||||
|
'sdk/smsdk_ext.cpp'
|
||||||
|
])
|
||||||
|
SM.PostSetupHL2Job(extension, binary, i)
|
||||||
|
SM.AutoVersion('extensions/bintools', binary)
|
||||||
|
binary.SendToJob()
|
||||||
|
|
||||||
@@ -29,9 +29,54 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include "CallMaker.h"
|
#include "CallMaker.h"
|
||||||
#include "CallWrapper.h"
|
#include "jit_compile.h"
|
||||||
#include "jit_call.h"
|
#include "extension.h"
|
||||||
|
|
||||||
|
/* SourceMod <==> SourceHook type conversion functions */
|
||||||
|
|
||||||
|
SourceHook::ProtoInfo::CallConvention GetSHCallConvention(SourceMod::CallConvention cv)
|
||||||
|
{
|
||||||
|
if (cv < SourceMod::CallConv_ThisCall || cv > SourceMod::CallConv_Cdecl)
|
||||||
|
{
|
||||||
|
return SourceHook::ProtoInfo::CallConv_Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (SourceHook::ProtoInfo::CallConvention)(cv + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceMod::CallConvention GetSMCallConvention(SourceHook::ProtoInfo::CallConvention cv)
|
||||||
|
{
|
||||||
|
assert(cv >= SourceHook::ProtoInfo::CallConv_ThisCall || cv <= SourceHook::ProtoInfo::CallConv_Cdecl);
|
||||||
|
|
||||||
|
return (SourceMod::CallConvention)(cv - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceHook::PassInfo::PassType GetSHPassType(SourceMod::PassType type)
|
||||||
|
{
|
||||||
|
if (type < SourceMod::PassType_Basic || type > SourceMod::PassType_Object)
|
||||||
|
{
|
||||||
|
return SourceHook::PassInfo::PassType_Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (SourceHook::PassInfo::PassType)(type + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceMod::PassType GetSMPassType(int type)
|
||||||
|
{
|
||||||
|
/* SourceMod doesn't provide an Unknown type so we it must be an error */
|
||||||
|
assert(type >= SourceHook::PassInfo::PassType_Basic && type <= SourceHook::PassInfo::PassType_Object);
|
||||||
|
|
||||||
|
return (SourceMod::PassType)(type - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetSMPassInfo(SourceMod::PassInfo *out, const SourceHook::PassInfo *in)
|
||||||
|
{
|
||||||
|
out->size = in->size;
|
||||||
|
out->flags = in->flags;
|
||||||
|
out->type = GetSMPassType(in->type);
|
||||||
|
}
|
||||||
|
|
||||||
ICallWrapper *CallMaker::CreateCall(void *address,
|
ICallWrapper *CallMaker::CreateCall(void *address,
|
||||||
CallConvention cv,
|
CallConvention cv,
|
||||||
@@ -39,12 +84,26 @@ ICallWrapper *CallMaker::CreateCall(void *address,
|
|||||||
const PassInfo paramInfo[],
|
const PassInfo paramInfo[],
|
||||||
unsigned int numParams)
|
unsigned int numParams)
|
||||||
{
|
{
|
||||||
CallWrapper *pWrapper = new CallWrapper(cv, paramInfo, retInfo, numParams);
|
SourceHook::CProtoInfoBuilder protoInfo(GetSHCallConvention(cv));
|
||||||
pWrapper->m_Addrs[ADDR_CALLEE] = address;
|
|
||||||
|
|
||||||
JIT_Compile(pWrapper, FuncAddr_Direct);
|
for (unsigned int i=0; i<numParams; i++)
|
||||||
|
{
|
||||||
|
protoInfo.AddParam(paramInfo[i].size, GetSHPassType(paramInfo[i].type), paramInfo[i].flags,
|
||||||
|
NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
return pWrapper;
|
if (retInfo)
|
||||||
|
{
|
||||||
|
protoInfo.SetReturnType(retInfo->size, GetSHPassType(retInfo->type), retInfo->flags,
|
||||||
|
NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
protoInfo.SetReturnType(0, SourceHook::PassInfo::PassType_Unknown, 0,
|
||||||
|
NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_CallMaker2.CreateCall(address, &(*protoInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
ICallWrapper *CallMaker::CreateVCall(unsigned int vtblIdx,
|
ICallWrapper *CallMaker::CreateVCall(unsigned int vtblIdx,
|
||||||
@@ -54,12 +113,73 @@ ICallWrapper *CallMaker::CreateVCall(unsigned int vtblIdx,
|
|||||||
const PassInfo paramInfo[],
|
const PassInfo paramInfo[],
|
||||||
unsigned int numParams)
|
unsigned int numParams)
|
||||||
{
|
{
|
||||||
CallWrapper *pWrapper = new CallWrapper(CallConv_ThisCall, paramInfo, retInfo, numParams);
|
SourceHook::MemFuncInfo info;
|
||||||
pWrapper->m_VtInfo.thisOffs = thisOffs;
|
info.isVirtual = true;
|
||||||
pWrapper->m_VtInfo.vtblIdx = vtblIdx;
|
info.vtblindex = vtblIdx;
|
||||||
pWrapper->m_VtInfo.vtblOffs = vtblOffs;
|
info.vtbloffs = vtblOffs;
|
||||||
|
info.thisptroffs = thisOffs;
|
||||||
|
|
||||||
JIT_Compile(pWrapper, FuncAddr_VTable);
|
SourceHook::CProtoInfoBuilder protoInfo(SourceHook::ProtoInfo::CallConv_ThisCall);
|
||||||
|
|
||||||
|
for (unsigned int i=0; i<numParams; i++)
|
||||||
|
{
|
||||||
|
protoInfo.AddParam(paramInfo[i].size, GetSHPassType(paramInfo[i].type), paramInfo[i].flags,
|
||||||
|
NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (retInfo)
|
||||||
|
{
|
||||||
|
protoInfo.SetReturnType(retInfo->size, GetSHPassType(retInfo->type), retInfo->flags,
|
||||||
|
NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
protoInfo.SetReturnType(0, SourceHook::PassInfo::PassType_Unknown, 0,
|
||||||
|
NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return g_CallMaker2.CreateVirtualCall(&(*protoInfo), &info);
|
||||||
|
}
|
||||||
|
|
||||||
|
ICallWrapper *CallMaker2::CreateCall(void *address, const SourceHook::ProtoInfo *protoInfo)
|
||||||
|
{
|
||||||
|
CallWrapper *pWrapper = new CallWrapper(protoInfo);
|
||||||
|
pWrapper->SetCalleeAddr(address);
|
||||||
|
|
||||||
|
void *addr = JIT_CallCompile(pWrapper, FuncAddr_Direct);
|
||||||
|
pWrapper->SetCodeBaseAddr(addr);
|
||||||
|
|
||||||
return pWrapper;
|
return pWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ICallWrapper *CallMaker2::CreateVirtualCall(const SourceHook::ProtoInfo *protoInfo,
|
||||||
|
const SourceHook::MemFuncInfo *info)
|
||||||
|
{
|
||||||
|
CallWrapper *pWrapper = new CallWrapper(protoInfo);
|
||||||
|
pWrapper->SetMemFuncInfo(info);
|
||||||
|
|
||||||
|
void *addr = JIT_CallCompile(pWrapper, FuncAddr_VTable);
|
||||||
|
pWrapper->SetCodeBaseAddr(addr);
|
||||||
|
|
||||||
|
return pWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined HOOKING_ENABLED
|
||||||
|
IHookWrapper *CallMaker2::CreateVirtualHook(SourceHook::ISourceHook *pSH,
|
||||||
|
const SourceHook::ProtoInfo *protoInfo,
|
||||||
|
const SourceHook::MemFuncInfo *info,
|
||||||
|
VIRTUAL_HOOK_PROTO f)
|
||||||
|
{
|
||||||
|
HookWrapper *pWrapper = new HookWrapper(pSH, protoInfo, const_cast<SourceHook::MemFuncInfo *>(info), (void *)f);
|
||||||
|
|
||||||
|
void *addr = JIT_HookCompile(pWrapper);
|
||||||
|
pWrapper->SetHookWrpAddr(addr);
|
||||||
|
|
||||||
|
ICallWrapper *callWrap = CreateVirtualCall(protoInfo, info);
|
||||||
|
pWrapper->SetCallWrapperAddr(callWrap);
|
||||||
|
|
||||||
|
return pWrapper;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -32,16 +32,12 @@
|
|||||||
#ifndef _INCLUDE_SOURCEMOD_CALLMAKER_H_
|
#ifndef _INCLUDE_SOURCEMOD_CALLMAKER_H_
|
||||||
#define _INCLUDE_SOURCEMOD_CALLMAKER_H_
|
#define _INCLUDE_SOURCEMOD_CALLMAKER_H_
|
||||||
|
|
||||||
#include <IBinTools.h>
|
|
||||||
|
#include "CallWrapper.h"
|
||||||
|
#include "HookWrapper.h"
|
||||||
|
|
||||||
using namespace SourceMod;
|
using namespace SourceMod;
|
||||||
|
|
||||||
enum FuncAddrMethod
|
|
||||||
{
|
|
||||||
FuncAddr_Direct,
|
|
||||||
FuncAddr_VTable
|
|
||||||
};
|
|
||||||
|
|
||||||
class CallMaker : public IBinTools
|
class CallMaker : public IBinTools
|
||||||
{
|
{
|
||||||
public: //IBinTools
|
public: //IBinTools
|
||||||
@@ -58,4 +54,32 @@ public: //IBinTools
|
|||||||
unsigned int numParams);
|
unsigned int numParams);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CallMaker2
|
||||||
|
#if defined HOOKING_ENABLED
|
||||||
|
: public IBinTools2
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
public: //IBinTools2
|
||||||
|
virtual ICallWrapper *CreateCall(void *address,
|
||||||
|
const SourceHook::ProtoInfo *protoInfo);
|
||||||
|
virtual ICallWrapper *CreateVirtualCall(const SourceHook::ProtoInfo *protoInfo,
|
||||||
|
const SourceHook::MemFuncInfo *info);
|
||||||
|
#if defined HOOKING_ENABLED
|
||||||
|
virtual IHookWrapper *CreateVirtualHook(SourceHook::ISourceHook *pSH,
|
||||||
|
const SourceHook::ProtoInfo *protoInfo,
|
||||||
|
const SourceHook::MemFuncInfo *info,
|
||||||
|
VIRTUAL_HOOK_PROTO f);
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CallMaker2 g_CallMaker2;
|
||||||
|
|
||||||
|
SourceHook::ProtoInfo::CallConvention GetSHCallConvention(SourceMod::CallConvention cv);
|
||||||
|
SourceMod::CallConvention GetSMCallConvention(SourceHook::ProtoInfo::CallConvention cv);
|
||||||
|
SourceHook::PassInfo::PassType GetSHPassType(SourceMod::PassType type);
|
||||||
|
SourceMod::PassType GetSMPassType(int type);
|
||||||
|
void GetSMPassInfo(SourceMod::PassInfo *out, const SourceHook::PassInfo *in);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_CALLMAKER_H_
|
#endif //_INCLUDE_SOURCEMOD_CALLMAKER_H_
|
||||||
|
|||||||
@@ -31,40 +31,46 @@
|
|||||||
|
|
||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
#include "CallWrapper.h"
|
#include "CallWrapper.h"
|
||||||
|
#include "CallMaker.h"
|
||||||
|
|
||||||
CallWrapper::CallWrapper(CallConvention cv, const PassInfo *paramInfo, const PassInfo *retInfo, unsigned int numParams)
|
CallWrapper::CallWrapper(const SourceHook::ProtoInfo *protoInfo)
|
||||||
{
|
{
|
||||||
m_Cv = cv;
|
m_AddrCodeBase = NULL;
|
||||||
|
m_AddrCallee = NULL;
|
||||||
|
|
||||||
if (numParams)
|
unsigned int argnum = protoInfo->numOfParams;
|
||||||
|
|
||||||
|
m_Info = *protoInfo;
|
||||||
|
m_Info.paramsPassInfo = new SourceHook::PassInfo[argnum + 1];
|
||||||
|
memcpy((void *)m_Info.paramsPassInfo, protoInfo->paramsPassInfo, sizeof(SourceHook::PassInfo) * (argnum+1));
|
||||||
|
|
||||||
|
if (argnum)
|
||||||
{
|
{
|
||||||
m_Params = new PassEncode[numParams];
|
m_Params = new PassEncode[argnum];
|
||||||
for (size_t i=0; i<numParams; i++)
|
for (size_t i=0; i<argnum; i++)
|
||||||
{
|
{
|
||||||
m_Params[i].info = paramInfo[i];
|
GetSMPassInfo(&(m_Params[i].info), &(m_Info.paramsPassInfo[i+1]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_Params = NULL;
|
m_Params = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retInfo)
|
if (m_Info.retPassInfo.size != 0)
|
||||||
{
|
{
|
||||||
m_RetParam = new PassInfo;
|
m_RetParam = new PassInfo;
|
||||||
*m_RetParam = *retInfo;
|
GetSMPassInfo(m_RetParam, &(m_Info.retPassInfo));
|
||||||
} else {
|
} else {
|
||||||
m_RetParam = NULL;
|
m_RetParam = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_NumParams = numParams;
|
|
||||||
|
|
||||||
/* Calculate virtual stack offsets for each parameter */
|
/* Calculate virtual stack offsets for each parameter */
|
||||||
size_t offs = 0;
|
size_t offs = 0;
|
||||||
|
|
||||||
if (cv == CallConv_ThisCall)
|
if (m_Info.convention == SourceHook::ProtoInfo::CallConv_ThisCall)
|
||||||
{
|
{
|
||||||
offs += sizeof(void *);
|
offs += sizeof(void *);
|
||||||
}
|
}
|
||||||
for (size_t i=0; i<numParams; i++)
|
for (size_t i=0; i<argnum; i++)
|
||||||
{
|
{
|
||||||
m_Params[i].offset = offs;
|
m_Params[i].offset = offs;
|
||||||
offs += m_Params[i].info.size;
|
offs += m_Params[i].info.size;
|
||||||
@@ -75,22 +81,34 @@ CallWrapper::~CallWrapper()
|
|||||||
{
|
{
|
||||||
delete [] m_Params;
|
delete [] m_Params;
|
||||||
delete m_RetParam;
|
delete m_RetParam;
|
||||||
g_SPEngine->FreePageMemory(m_Addrs[ADDR_CODEBASE]);
|
delete [] m_Info.paramsPassInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallWrapper::Destroy()
|
void CallWrapper::Destroy()
|
||||||
{
|
{
|
||||||
|
if (m_AddrCodeBase != NULL)
|
||||||
|
{
|
||||||
|
g_SPEngine->FreePageMemory(m_AddrCodeBase);
|
||||||
|
m_AddrCodeBase = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CallConvention CallWrapper::GetCallConvention()
|
CallConvention CallWrapper::GetCallConvention()
|
||||||
{
|
{
|
||||||
return m_Cv;
|
/* Need to convert to a SourceMod convention for bcompat */
|
||||||
|
return GetSMCallConvention((SourceHook::ProtoInfo::CallConvention)m_Info.convention);
|
||||||
}
|
}
|
||||||
|
|
||||||
const PassEncode *CallWrapper::GetParamInfo(unsigned int num)
|
const PassEncode *CallWrapper::GetParamInfo(unsigned int num)
|
||||||
{
|
{
|
||||||
return (num+1 > m_NumParams) ? NULL : &m_Params[num];
|
if (num + 1 > GetParamCount() || num < 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return &m_Params[num];
|
||||||
}
|
}
|
||||||
|
|
||||||
const PassInfo *CallWrapper::GetReturnInfo()
|
const PassInfo *CallWrapper::GetReturnInfo()
|
||||||
@@ -100,12 +118,69 @@ const PassInfo *CallWrapper::GetReturnInfo()
|
|||||||
|
|
||||||
unsigned int CallWrapper::GetParamCount()
|
unsigned int CallWrapper::GetParamCount()
|
||||||
{
|
{
|
||||||
return m_NumParams;
|
return m_Info.numOfParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallWrapper::Execute(void *vParamStack, void *retBuffer)
|
void CallWrapper::Execute(void *vParamStack, void *retBuffer)
|
||||||
{
|
{
|
||||||
typedef void (*CALL_EXECUTE)(void *, void *);
|
typedef void (*CALL_EXECUTE)(void *, void *);
|
||||||
CALL_EXECUTE fn = (CALL_EXECUTE)m_Addrs[ADDR_CODEBASE];
|
CALL_EXECUTE fn = (CALL_EXECUTE)GetCodeBaseAddr();
|
||||||
fn(vParamStack, retBuffer);
|
fn(vParamStack, retBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CallWrapper::SetMemFuncInfo(const SourceHook::MemFuncInfo *funcInfo)
|
||||||
|
{
|
||||||
|
m_FuncInfo = *funcInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceHook::MemFuncInfo *CallWrapper::GetMemFuncInfo()
|
||||||
|
{
|
||||||
|
return &m_FuncInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CallWrapper::SetCalleeAddr(void *addr)
|
||||||
|
{
|
||||||
|
m_AddrCallee = addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CallWrapper::SetCodeBaseAddr(void *addr)
|
||||||
|
{
|
||||||
|
m_AddrCodeBase = addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *CallWrapper::GetCalleeAddr()
|
||||||
|
{
|
||||||
|
return m_AddrCallee;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *CallWrapper::GetCodeBaseAddr()
|
||||||
|
{
|
||||||
|
return m_AddrCodeBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SourceHook::PassInfo *CallWrapper::GetSHReturnInfo()
|
||||||
|
{
|
||||||
|
return &(m_Info.retPassInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceHook::ProtoInfo::CallConvention CallWrapper::GetSHCallConvention()
|
||||||
|
{
|
||||||
|
return (SourceHook::ProtoInfo::CallConvention)m_Info.convention;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SourceHook::PassInfo * CallWrapper::GetSHParamInfo(unsigned int num)
|
||||||
|
{
|
||||||
|
if (num + 1 > GetParamCount() || num < 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return &(m_Info.paramsPassInfo[num+1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CallWrapper::GetParamOffset(unsigned int num)
|
||||||
|
{
|
||||||
|
assert(num < GetParamCount() && num >= 0);
|
||||||
|
|
||||||
|
return m_Params[num].offset;
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,27 +29,24 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _INCLUDE_SOURCEMOD_CCALLWRAPPER_H_
|
#ifndef _INCLUDE_SOURCEMOD_CALLWRAPPER_H_
|
||||||
#define _INCLUDE_SOURCEMOD_CCALLWRAPPER_H_
|
#define _INCLUDE_SOURCEMOD_CALLWRAPPER_H_
|
||||||
|
|
||||||
#include <IBinTools.h>
|
#include <IBinTools.h>
|
||||||
|
#include <sourcehook_pibuilder.h>
|
||||||
|
|
||||||
using namespace SourceMod;
|
using namespace SourceMod;
|
||||||
|
|
||||||
#define ADDR_CALLEE 0
|
enum FuncAddrMethod
|
||||||
#define ADDR_CODEBASE 1
|
|
||||||
|
|
||||||
struct VtableInfo
|
|
||||||
{
|
{
|
||||||
unsigned int vtblIdx;
|
FuncAddr_Direct,
|
||||||
unsigned int vtblOffs;
|
FuncAddr_VTable
|
||||||
unsigned int thisOffs;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CallWrapper : public ICallWrapper
|
class CallWrapper : public ICallWrapper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CallWrapper(CallConvention cv, const PassInfo *paramInfo, const PassInfo *retInfo, unsigned int numParams);
|
CallWrapper(const SourceHook::ProtoInfo *protoInfo);
|
||||||
~CallWrapper();
|
~CallWrapper();
|
||||||
public: //ICallWrapper
|
public: //ICallWrapper
|
||||||
CallConvention GetCallConvention();
|
CallConvention GetCallConvention();
|
||||||
@@ -58,15 +55,25 @@ public: //ICallWrapper
|
|||||||
unsigned int GetParamCount();
|
unsigned int GetParamCount();
|
||||||
void Execute(void *vParamStack, void *retBuffer);
|
void Execute(void *vParamStack, void *retBuffer);
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
const SourceHook::PassInfo *GetSHReturnInfo();
|
||||||
|
SourceHook::ProtoInfo::CallConvention GetSHCallConvention();
|
||||||
|
const SourceHook::PassInfo *GetSHParamInfo(unsigned int num);
|
||||||
|
unsigned int GetParamOffset(unsigned int num);
|
||||||
public:
|
public:
|
||||||
inline void deleteThis() { delete this; }
|
void SetCalleeAddr(void *addr);
|
||||||
void *m_Addrs[4];
|
void SetCodeBaseAddr(void *addr);
|
||||||
VtableInfo m_VtInfo;
|
void *GetCalleeAddr();
|
||||||
|
void *GetCodeBaseAddr();
|
||||||
|
|
||||||
|
void SetMemFuncInfo(const SourceHook::MemFuncInfo *funcInfo);
|
||||||
|
SourceHook::MemFuncInfo *GetMemFuncInfo();
|
||||||
private:
|
private:
|
||||||
CallConvention m_Cv;
|
|
||||||
PassEncode *m_Params;
|
PassEncode *m_Params;
|
||||||
|
SourceHook::ProtoInfo m_Info;
|
||||||
PassInfo *m_RetParam;
|
PassInfo *m_RetParam;
|
||||||
unsigned int m_NumParams;
|
void *m_AddrCallee;
|
||||||
|
void *m_AddrCodeBase;
|
||||||
|
SourceHook::MemFuncInfo m_FuncInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_CCALLWRAPPER_H_
|
#endif //_INCLUDE_SOURCEMOD_CALLWRAPPER_H_
|
||||||
|
|||||||
@@ -0,0 +1,243 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* =============================================================================
|
||||||
|
* SourceMod BinTools Extension
|
||||||
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
|
* =============================================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||||
|
* 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: CallMaker.h 1964 2008-03-27 04:54:56Z damagedsoul $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined HOOKING_ENABLED
|
||||||
|
|
||||||
|
#include "HookWrapper.h"
|
||||||
|
#include "jit_compile.h"
|
||||||
|
|
||||||
|
/******************************
|
||||||
|
* HookWrapper Implementation *
|
||||||
|
******************************/
|
||||||
|
|
||||||
|
HookWrapper::HookWrapper(SourceHook::ISourceHook *pSH,
|
||||||
|
const SourceHook::ProtoInfo *proto,
|
||||||
|
SourceHook::MemFuncInfo *memfunc,
|
||||||
|
void *addr) : m_ParamOffs(NULL), m_ParamSize(0), m_RetSize(0)
|
||||||
|
{
|
||||||
|
unsigned int argnum = proto->numOfParams;
|
||||||
|
|
||||||
|
m_pSH = pSH;
|
||||||
|
m_ProtoInfo = *proto;
|
||||||
|
m_ProtoInfo.paramsPassInfo = new SourceHook::PassInfo[argnum + 1];
|
||||||
|
memcpy((void *)m_ProtoInfo.paramsPassInfo, proto->paramsPassInfo, sizeof(SourceHook::PassInfo) * (argnum+1));
|
||||||
|
m_MemFuncInfo = *memfunc;
|
||||||
|
m_FuncAddr = addr;
|
||||||
|
m_HookWrapper = NULL;
|
||||||
|
|
||||||
|
/* If the function has parameters calculate the parameter buffer size and offsets */
|
||||||
|
if (argnum > 0)
|
||||||
|
{
|
||||||
|
const SourceHook::PassInfo *info = m_ProtoInfo.paramsPassInfo;
|
||||||
|
m_ParamOffs = new unsigned int[argnum];
|
||||||
|
m_ParamOffs[0] = 0;
|
||||||
|
|
||||||
|
for (unsigned int i=1; i<=argnum; i++)
|
||||||
|
{
|
||||||
|
/* The stack should be at least aligned to a 4 byte boundary
|
||||||
|
* and byref params have the size of pointers
|
||||||
|
*/
|
||||||
|
if (((info[i].type == SourceHook::PassInfo::PassType_Basic) &&
|
||||||
|
(info[i].flags & SourceHook::PassInfo::PassFlag_ByVal) &&
|
||||||
|
(info[i].size < sizeof(void *))) ||
|
||||||
|
(info[i].flags & SourceHook::PassInfo::PassFlag_ByRef))
|
||||||
|
{
|
||||||
|
m_ParamSize += sizeof(void *);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_ParamSize += info[i].size;
|
||||||
|
}
|
||||||
|
|
||||||
|
//:TODO: fix this!
|
||||||
|
if (i < argnum)
|
||||||
|
{
|
||||||
|
m_ParamOffs[i] = m_ParamSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Finally calculate the retval size if any */
|
||||||
|
size_t retsize = m_ProtoInfo.retPassInfo.size;
|
||||||
|
if (retsize != 0)
|
||||||
|
{
|
||||||
|
if (m_ProtoInfo.retPassInfo.flags & SourceHook::PassInfo::PassFlag_ByRef)
|
||||||
|
{
|
||||||
|
m_RetSize = sizeof(void *);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_RetSize = (retsize < sizeof(void *)) ? sizeof(void *) : retsize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ISMDelegate *HookWrapper::CreateDelegate(void *data)
|
||||||
|
{
|
||||||
|
SMDelegate *pDeleg = new SMDelegate(data);
|
||||||
|
pDeleg->PatchVtable(m_HookWrapper);
|
||||||
|
|
||||||
|
return pDeleg;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int HookWrapper::GetParamCount()
|
||||||
|
{
|
||||||
|
return m_ProtoInfo.numOfParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int HookWrapper::GetParamOffset(unsigned int argnum, unsigned int *size)
|
||||||
|
{
|
||||||
|
assert(m_ParamOffs && argnum < (unsigned int)m_ProtoInfo.numOfParams);
|
||||||
|
|
||||||
|
if (size)
|
||||||
|
{
|
||||||
|
*size = m_ProtoInfo.paramsPassInfo[argnum+1].size;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_ParamOffs[argnum];
|
||||||
|
}
|
||||||
|
|
||||||
|
void HookWrapper::PerformRecall(void *params, void *retval)
|
||||||
|
{
|
||||||
|
/* Notify SourceHook of the upcoming recall */
|
||||||
|
SH_GLOB_SHPTR->DoRecall();
|
||||||
|
|
||||||
|
/* Add thisptr into params buffer */
|
||||||
|
unsigned char *newparams = new unsigned char[sizeof(void *) + m_ParamSize];
|
||||||
|
*(void **)newparams = META_IFACEPTR(void);
|
||||||
|
memcpy(newparams + sizeof(void *), params, m_ParamSize);
|
||||||
|
|
||||||
|
/* Execute the call */
|
||||||
|
m_CallWrapper->Execute(newparams, retval);
|
||||||
|
|
||||||
|
SET_META_RESULT(MRES_SUPERCEDE);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HookWrapper::Destroy()
|
||||||
|
{
|
||||||
|
if (m_HookWrapper != NULL)
|
||||||
|
{
|
||||||
|
JIT_FreeHook(m_HookWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_CallWrapper != NULL)
|
||||||
|
{
|
||||||
|
m_CallWrapper->Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int HookWrapper::GetParamSize()
|
||||||
|
{
|
||||||
|
return m_ParamSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceHook::ProtoInfo * HookWrapper::GetProtoInfo()
|
||||||
|
{
|
||||||
|
return &m_ProtoInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int HookWrapper::GetRetSize()
|
||||||
|
{
|
||||||
|
return m_RetSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void * HookWrapper::GetHandlerAddr()
|
||||||
|
{
|
||||||
|
return m_FuncAddr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HookWrapper::SetCallWrapperAddr( ICallWrapper *wrap )
|
||||||
|
{
|
||||||
|
m_CallWrapper = wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HookWrapper::SetHookWrpAddr( void *addr )
|
||||||
|
{
|
||||||
|
m_HookWrapper = addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
HookWrapper::~HookWrapper()
|
||||||
|
{
|
||||||
|
delete [] m_ProtoInfo.paramsPassInfo;
|
||||||
|
delete [] m_ParamOffs;
|
||||||
|
}
|
||||||
|
/*****************************
|
||||||
|
* SMDelegate Implementation *
|
||||||
|
*****************************/
|
||||||
|
|
||||||
|
SMDelegate::SMDelegate(void *data)
|
||||||
|
{
|
||||||
|
m_Data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SMDelegate::IsEqual(ISHDelegate *pOtherDeleg)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SMDelegate::DeleteThis()
|
||||||
|
{
|
||||||
|
/* Remove our allocated vtable */
|
||||||
|
delete [] *reinterpret_cast<void ***>(this);
|
||||||
|
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SMDelegate::Call()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void *SMDelegate::GetUserData()
|
||||||
|
{
|
||||||
|
return m_Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This duplicates the vtable (so each instance has a unique table) and patches SMDelgate::Call to point to our allocated function
|
||||||
|
*/
|
||||||
|
void SMDelegate::PatchVtable(void *addr)
|
||||||
|
{
|
||||||
|
void **new_vtptr = new void *[4];
|
||||||
|
void **cur_vtptr = *reinterpret_cast<void ***>(this);
|
||||||
|
memcpy(new_vtptr, cur_vtptr, sizeof(void *)*4);
|
||||||
|
|
||||||
|
*reinterpret_cast<void ***>(this) = new_vtptr;
|
||||||
|
|
||||||
|
void *cur_vfnptr = reinterpret_cast<void *>(new_vtptr + VTABLE_PATCH_OFFS);
|
||||||
|
|
||||||
|
*reinterpret_cast<void **>(cur_vfnptr) = addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* =============================================================================
|
||||||
|
* SourceMod BinTools Extension
|
||||||
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
|
* =============================================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||||
|
* 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: CallMaker.h 1964 2008-03-27 04:54:56Z damagedsoul $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _INCLUDE_SOURCEMOD_HOOKWRAPPER_H_
|
||||||
|
#define _INCLUDE_SOURCEMOD_HOOKWRAPPER_H_
|
||||||
|
|
||||||
|
#if defined HOOKING_ENABLED
|
||||||
|
|
||||||
|
#include "smsdk_ext.h"
|
||||||
|
#include "sourcehook.h"
|
||||||
|
#include "IBinTools.h"
|
||||||
|
|
||||||
|
#define VTABLE_PATCH_OFFS 2
|
||||||
|
|
||||||
|
using namespace SourceMod;
|
||||||
|
|
||||||
|
class HookWrapper : public IHookWrapper
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HookWrapper(SourceHook::ISourceHook *pSH,
|
||||||
|
const SourceHook::ProtoInfo *proto,
|
||||||
|
SourceHook::MemFuncInfo *memfunc,
|
||||||
|
void *addr
|
||||||
|
);
|
||||||
|
~HookWrapper();
|
||||||
|
public: //IHookWrapper
|
||||||
|
ISMDelegate *CreateDelegate(void *data);
|
||||||
|
unsigned int GetParamCount();
|
||||||
|
unsigned int GetParamOffset(unsigned int argnum, unsigned int *size);
|
||||||
|
void PerformRecall(void *params, void *retval);
|
||||||
|
void Destroy();
|
||||||
|
public:
|
||||||
|
unsigned int GetParamSize();
|
||||||
|
unsigned int GetRetSize();
|
||||||
|
SourceHook::ProtoInfo *GetProtoInfo();
|
||||||
|
void *GetHandlerAddr();
|
||||||
|
void SetHookWrpAddr(void *addr);
|
||||||
|
void SetCallWrapperAddr(ICallWrapper *wrap);
|
||||||
|
private:
|
||||||
|
void *m_FuncAddr;
|
||||||
|
void *m_HookWrapper;
|
||||||
|
SourceHook::ISourceHook *m_pSH;
|
||||||
|
unsigned int *m_ParamOffs;
|
||||||
|
unsigned int m_ParamSize;
|
||||||
|
unsigned int m_RetSize;
|
||||||
|
SourceHook::MemFuncInfo m_MemFuncInfo;
|
||||||
|
SourceHook::ProtoInfo m_ProtoInfo;
|
||||||
|
ICallWrapper *m_CallWrapper;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SMDelegate : public ISMDelegate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SMDelegate(void *data);
|
||||||
|
public: //SourceHook::ISHDelegate
|
||||||
|
bool IsEqual(ISHDelegate *pOtherDeleg);
|
||||||
|
void DeleteThis();
|
||||||
|
void Call();
|
||||||
|
public: //ISMDelegate
|
||||||
|
void *GetUserData();
|
||||||
|
public:
|
||||||
|
void PatchVtable(void *addr);
|
||||||
|
private:
|
||||||
|
void *m_Data;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //_INCLUDE_SOURCEMOD_HOOKWRAPPER_H_
|
||||||
@@ -5,6 +5,8 @@ SMSDK = ../..
|
|||||||
SRCDS_BASE = ~/srcds
|
SRCDS_BASE = ~/srcds
|
||||||
HL2SDK_ORIG = ../../../hl2sdk
|
HL2SDK_ORIG = ../../../hl2sdk
|
||||||
HL2SDK_OB = ../../../hl2sdk-ob
|
HL2SDK_OB = ../../../hl2sdk-ob
|
||||||
|
HL2SDK_OB_VALVE = ../../../hl2sdk-ob-valve
|
||||||
|
HL2SDK_L4D = ../../../hl2sdk-l4d
|
||||||
MMSOURCE17 = ../../../mmsource-1.7
|
MMSOURCE17 = ../../../mmsource-1.7
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
@@ -13,10 +15,7 @@ MMSOURCE17 = ../../../mmsource-1.7
|
|||||||
|
|
||||||
PROJECT = bintools
|
PROJECT = bintools
|
||||||
|
|
||||||
#Uncomment for Metamod: Source enabled extension
|
OBJECTS = sdk/smsdk_ext.cpp extension.cpp jit_call.cpp CallWrapper.cpp CallMaker.cpp HookWrapper.cpp jit_hook.cpp
|
||||||
#USEMETA = true
|
|
||||||
|
|
||||||
OBJECTS = sdk/smsdk_ext.cpp extension.cpp jit_call.cpp CallWrapper.cpp CallMaker.cpp
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||||
@@ -31,22 +30,54 @@ CPP = gcc
|
|||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
HL2SDK = $(HL2SDK_ORIG)
|
HL2SDK = $(HL2SDK_ORIG)
|
||||||
HL2PUB = $(HL2SDK_ORIG)/public
|
HL2PUB = $(HL2SDK)/public
|
||||||
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
|
HL2LIB = $(HL2SDK)/linux_sdk
|
||||||
|
CFLAGS += -DSOURCE_ENGINE=1
|
||||||
METAMOD = $(MMSOURCE17)/core-legacy
|
METAMOD = $(MMSOURCE17)/core-legacy
|
||||||
INCLUDE += -I$(HL2SDK)/public/dlls
|
INCLUDE += -I$(HL2SDK)/public/dlls
|
||||||
|
INCLUDE += -I$(MMSOURCE17)/core -I$(MMSOURCE17)/core/sourcehook
|
||||||
SRCDS = $(SRCDS_BASE)
|
SRCDS = $(SRCDS_BASE)
|
||||||
|
GAMEFIX = 1.ep1
|
||||||
override ENGSET = true
|
override ENGSET = true
|
||||||
endif
|
endif
|
||||||
ifeq "$(ENGINE)" "orangebox"
|
ifeq "$(ENGINE)" "orangebox"
|
||||||
HL2SDK = $(HL2SDK_OB)
|
HL2SDK = $(HL2SDK_OB)
|
||||||
HL2PUB = $(HL2SDK_OB)/public
|
HL2PUB = $(HL2SDK)/public
|
||||||
HL2LIB = $(HL2SDK_OB)/lib/linux
|
HL2LIB = $(HL2SDK)/lib/linux
|
||||||
CFLAGS += -DORANGEBOX_BUILD
|
CFLAGS += -DSOURCE_ENGINE=3
|
||||||
METAMOD = $(MMSOURCE17)/core
|
METAMOD = $(MMSOURCE17)/core
|
||||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||||
SRCDS = $(SRCDS_BASE)/orangebox
|
SRCDS = $(SRCDS_BASE)/orangebox
|
||||||
|
GAMEFIX = 2.ep2
|
||||||
override ENGSET = true
|
override ENGSET = true
|
||||||
|
USEMETA = true
|
||||||
|
CFLAGS += -DHOOKING_ENABLED
|
||||||
|
endif
|
||||||
|
ifeq "$(ENGINE)" "orangeboxvalve"
|
||||||
|
HL2SDK = $(HL2SDK_OB_VALVE)
|
||||||
|
HL2PUB = $(HL2SDK)/public
|
||||||
|
HL2LIB = $(HL2SDK)/lib/linux
|
||||||
|
CFLAGS += -DSOURCE_ENGINE=4
|
||||||
|
METAMOD = $(MMSOURCE17)/core
|
||||||
|
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||||
|
SRCDS = $(SRCDS_BASE)/orangebox
|
||||||
|
GAMEFIX = 2.ep2v
|
||||||
|
override ENGSET = true
|
||||||
|
USEMETA = true
|
||||||
|
CFLAGS += -DHOOKING_ENABLED
|
||||||
|
endif
|
||||||
|
ifeq "$(ENGINE)" "left4dead"
|
||||||
|
HL2SDK = $(HL2SDK_L4D)
|
||||||
|
HL2PUB = $(HL2SDK)/public
|
||||||
|
HL2LIB = $(HL2SDK)/lib/linux
|
||||||
|
CFLAGS += -DSOURCE_ENGINE=5
|
||||||
|
METAMOD = $(MMSOURCE17)/core
|
||||||
|
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||||
|
SRCDS = $(SRCDS_BASE)/l4d
|
||||||
|
GAMEFIX = 2.l4d
|
||||||
|
override ENGSET = true
|
||||||
|
USEMETA = true
|
||||||
|
CFLAGS += -DHOOKING_ENABLED
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq "$(USEMETA)" "true"
|
ifeq "$(USEMETA)" "true"
|
||||||
@@ -55,7 +86,9 @@ ifeq "$(USEMETA)" "true"
|
|||||||
LINK += $(LINK_HL2)
|
LINK += $(LINK_HL2)
|
||||||
|
|
||||||
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
|
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
|
||||||
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn \
|
||||||
|
-I$(SMSDK)/public/extensions -I$(SMSDK)/public/jit -I$(SMSDK)/public/jit/x86
|
||||||
|
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 -DSE_LEFT4DEAD=5
|
||||||
else
|
else
|
||||||
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/extensions -I$(SMSDK)/public/jit \
|
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/extensions -I$(SMSDK)/public/jit \
|
||||||
-I$(SMSDK)/public/jit/x86 -I$(SMSDK)/public/sourcepawn
|
-I$(SMSDK)/public/jit/x86 -I$(SMSDK)/public/sourcepawn
|
||||||
@@ -82,15 +115,17 @@ endif
|
|||||||
|
|
||||||
ifeq "$(USEMETA)" "true"
|
ifeq "$(USEMETA)" "true"
|
||||||
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
BIN_DIR := $(BIN_DIR).$(ENGINE)
|
||||||
|
else
|
||||||
|
BIN_DIR := $(BIN_DIR).original
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OS := $(shell uname -s)
|
OS := $(shell uname -s)
|
||||||
ifeq "$(OS)" "Darwin"
|
ifeq "$(OS)" "Darwin"
|
||||||
LINK += -dynamiclib
|
LINK += -dynamiclib
|
||||||
BINARY = $(PROJECT).ext.dylib
|
BINARY = $(PROJECT).ext.$(GAMEFIX).dylib
|
||||||
else
|
else
|
||||||
LINK += -static-libgcc -shared
|
LINK += -static-libgcc -shared
|
||||||
BINARY = $(PROJECT).ext.so
|
BINARY = $(PROJECT).ext.$(GAMEFIX).so
|
||||||
endif
|
endif
|
||||||
|
|
||||||
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
|
||||||
@@ -114,7 +149,7 @@ all: check
|
|||||||
|
|
||||||
check:
|
check:
|
||||||
if [ "$(USEMETA)" = "true" ] && [ "$(ENGSET)" = "false" ]; then \
|
if [ "$(USEMETA)" = "true" ] && [ "$(ENGSET)" = "false" ]; then \
|
||||||
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
|
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* vim: set ts=4 :
|
* vim: set ts=4 sw=4 tw=99 noet:
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod BinTools Extension
|
* SourceMod BinTools Extension
|
||||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
@@ -29,6 +29,7 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sourcemod_version.h>
|
||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
#include "CallMaker.h"
|
#include "CallMaker.h"
|
||||||
|
|
||||||
@@ -39,6 +40,7 @@
|
|||||||
|
|
||||||
BinTools g_BinTools; /**< Global singleton for extension's main interface */
|
BinTools g_BinTools; /**< Global singleton for extension's main interface */
|
||||||
CallMaker g_CallMaker;
|
CallMaker g_CallMaker;
|
||||||
|
CallMaker2 g_CallMaker2;
|
||||||
ISourcePawnEngine *g_SPEngine;
|
ISourcePawnEngine *g_SPEngine;
|
||||||
|
|
||||||
SMEXT_LINK(&g_BinTools);
|
SMEXT_LINK(&g_BinTools);
|
||||||
@@ -47,6 +49,20 @@ bool BinTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
{
|
{
|
||||||
g_SPEngine = g_pSM->GetScriptingEngine();
|
g_SPEngine = g_pSM->GetScriptingEngine();
|
||||||
g_pShareSys->AddInterface(myself, &g_CallMaker);
|
g_pShareSys->AddInterface(myself, &g_CallMaker);
|
||||||
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
|
g_pShareSys->AddInterface(myself, &g_CallMaker2);
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *BinTools::GetExtensionVerString()
|
||||||
|
{
|
||||||
|
return SM_FULL_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *BinTools::GetExtensionDateString()
|
||||||
|
{
|
||||||
|
return SM_BUILD_TIMESTAMP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ public:
|
|||||||
* @return True if working, false otherwise.
|
* @return True if working, false otherwise.
|
||||||
*/
|
*/
|
||||||
//virtual bool QueryRunning(char *error, size_t maxlength);
|
//virtual bool QueryRunning(char *error, size_t maxlength);
|
||||||
|
const char *GetExtensionVerString();
|
||||||
|
const char *GetExtensionDateString();
|
||||||
public:
|
public:
|
||||||
#if defined SMEXT_CONF_METAMOD
|
#if defined SMEXT_CONF_METAMOD
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -33,38 +33,12 @@
|
|||||||
#include "extension.h"
|
#include "extension.h"
|
||||||
#include <jit_helpers.h>
|
#include <jit_helpers.h>
|
||||||
#include <x86_macros.h>
|
#include <x86_macros.h>
|
||||||
#include "jit_call.h"
|
#include "jit_compile.h"
|
||||||
|
|
||||||
jit_uint32_t g_StackUsage = 0;
|
jit_uint32_t g_StackUsage = 0;
|
||||||
jit_uint32_t g_StackAlign = 0;
|
jit_uint32_t g_StackAlign = 0;
|
||||||
jit_uint32_t g_RegDecoder = 0;
|
jit_uint32_t g_RegDecoder = 0;
|
||||||
|
|
||||||
/********************
|
|
||||||
* Assembly Helpers *
|
|
||||||
********************/
|
|
||||||
|
|
||||||
inline jit_uint8_t _DecodeRegister3(jit_uint32_t val)
|
|
||||||
{
|
|
||||||
switch (val % 3)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
return REG_EAX;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
return REG_EDX;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
return REG_ECX;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Should never happen */
|
|
||||||
return 0xFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************
|
/********************
|
||||||
* Assembly Opcodes *
|
* Assembly Opcodes *
|
||||||
********************/
|
********************/
|
||||||
@@ -137,25 +111,25 @@ inline void Write_Function_Epilogue(JitWriter *jit, bool is_void, bool has_param
|
|||||||
IA32_Return(jit);
|
IA32_Return(jit);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Write_PushPOD(JitWriter *jit, const PassEncode *pEnc)
|
inline void Write_PushPOD(JitWriter *jit, const SourceHook::PassInfo *info, unsigned int offset)
|
||||||
{
|
{
|
||||||
jit_uint8_t reg = _DecodeRegister3(g_RegDecoder++);
|
jit_uint8_t reg = _DecodeRegister3(g_RegDecoder++);
|
||||||
|
|
||||||
if (pEnc->info.flags & PASSFLAG_BYVAL)
|
if (info->flags & PASSFLAG_BYVAL)
|
||||||
{
|
{
|
||||||
switch (pEnc->info.size)
|
switch (info->size)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
//movzx reg, BYTE PTR [ebx+<offset>]
|
//movzx reg, BYTE PTR [ebx+<offset>]
|
||||||
//push reg
|
//push reg
|
||||||
if (pEnc->offset < SCHAR_MAX)
|
if (offset < SCHAR_MAX)
|
||||||
{
|
{
|
||||||
IA32_Movzx_Reg32_Rm8_Disp8(jit, reg, REG_EBX, (jit_int8_t)pEnc->offset);
|
IA32_Movzx_Reg32_Rm8_Disp8(jit, reg, REG_EBX, (jit_int8_t)offset);
|
||||||
} else if (!pEnc->offset) {
|
} else if (!offset) {
|
||||||
IA32_Movzx_Reg32_Rm8(jit, reg, REG_EBX, MOD_MEM_REG);
|
IA32_Movzx_Reg32_Rm8(jit, reg, REG_EBX, MOD_MEM_REG);
|
||||||
} else {
|
} else {
|
||||||
IA32_Movzx_Reg32_Rm8_Disp32(jit, reg, REG_EBX, pEnc->offset);
|
IA32_Movzx_Reg32_Rm8_Disp32(jit, reg, REG_EBX, offset);
|
||||||
}
|
}
|
||||||
IA32_Push_Reg(jit, reg);
|
IA32_Push_Reg(jit, reg);
|
||||||
|
|
||||||
@@ -167,13 +141,13 @@ inline void Write_PushPOD(JitWriter *jit, const PassEncode *pEnc)
|
|||||||
//movzx reg, WORD PTR [ebx+<offset>]
|
//movzx reg, WORD PTR [ebx+<offset>]
|
||||||
//push reg
|
//push reg
|
||||||
jit->write_ubyte(IA32_16BIT_PREFIX);
|
jit->write_ubyte(IA32_16BIT_PREFIX);
|
||||||
if (pEnc->offset < SCHAR_MAX)
|
if (offset < SCHAR_MAX)
|
||||||
{
|
{
|
||||||
IA32_Movzx_Reg32_Rm16_Disp8(jit, reg, REG_EBX, (jit_int8_t)pEnc->offset);
|
IA32_Movzx_Reg32_Rm16_Disp8(jit, reg, REG_EBX, (jit_int8_t)offset);
|
||||||
} else if (!pEnc->offset) {
|
} else if (!offset) {
|
||||||
IA32_Movzx_Reg32_Rm16(jit, reg, REG_EBX, MOD_MEM_REG);
|
IA32_Movzx_Reg32_Rm16(jit, reg, REG_EBX, MOD_MEM_REG);
|
||||||
} else {
|
} else {
|
||||||
IA32_Movzx_Reg32_Rm16_Disp32(jit, reg, REG_EBX, pEnc->offset);
|
IA32_Movzx_Reg32_Rm16_Disp32(jit, reg, REG_EBX, offset);
|
||||||
}
|
}
|
||||||
IA32_Push_Reg(jit, reg);
|
IA32_Push_Reg(jit, reg);
|
||||||
|
|
||||||
@@ -184,13 +158,13 @@ inline void Write_PushPOD(JitWriter *jit, const PassEncode *pEnc)
|
|||||||
{
|
{
|
||||||
//mov reg, DWORD PTR [ebx+<offset>]
|
//mov reg, DWORD PTR [ebx+<offset>]
|
||||||
//push reg
|
//push reg
|
||||||
if (pEnc->offset < SCHAR_MAX)
|
if (offset < SCHAR_MAX)
|
||||||
{
|
{
|
||||||
IA32_Mov_Reg_Rm_Disp8(jit, reg, REG_EBX, (jit_int8_t)pEnc->offset);
|
IA32_Mov_Reg_Rm_Disp8(jit, reg, REG_EBX, (jit_int8_t)offset);
|
||||||
} else if (!pEnc->offset) {
|
} else if (!offset) {
|
||||||
IA32_Mov_Reg_Rm(jit, reg, REG_EBX, MOD_MEM_REG);
|
IA32_Mov_Reg_Rm(jit, reg, REG_EBX, MOD_MEM_REG);
|
||||||
} else {
|
} else {
|
||||||
IA32_Mov_Reg_Rm_Disp32(jit, reg, REG_EBX, pEnc->offset);
|
IA32_Mov_Reg_Rm_Disp32(jit, reg, REG_EBX, offset);
|
||||||
}
|
}
|
||||||
IA32_Push_Reg(jit, reg);
|
IA32_Push_Reg(jit, reg);
|
||||||
|
|
||||||
@@ -205,19 +179,19 @@ inline void Write_PushPOD(JitWriter *jit, const PassEncode *pEnc)
|
|||||||
//push reg2
|
//push reg2
|
||||||
jit_uint8_t reg2 = _DecodeRegister3(g_RegDecoder++);
|
jit_uint8_t reg2 = _DecodeRegister3(g_RegDecoder++);
|
||||||
|
|
||||||
if (pEnc->offset+4 < SCHAR_MAX)
|
if (offset+4 < SCHAR_MAX)
|
||||||
{
|
{
|
||||||
IA32_Mov_Reg_Rm_Disp8(jit, reg, REG_EBX, (jit_int8_t)(pEnc->offset+4));
|
IA32_Mov_Reg_Rm_Disp8(jit, reg, REG_EBX, (jit_int8_t)(offset+4));
|
||||||
} else {
|
} else {
|
||||||
IA32_Mov_Reg_Rm_Disp32(jit, reg, REG_EBX, pEnc->offset+4);
|
IA32_Mov_Reg_Rm_Disp32(jit, reg, REG_EBX, offset+4);
|
||||||
}
|
}
|
||||||
if (pEnc->offset < SCHAR_MAX)
|
if (offset < SCHAR_MAX)
|
||||||
{
|
{
|
||||||
IA32_Mov_Reg_Rm_Disp8(jit, reg2, REG_EBX, (jit_int8_t)pEnc->offset);
|
IA32_Mov_Reg_Rm_Disp8(jit, reg2, REG_EBX, (jit_int8_t)offset);
|
||||||
} else if (!pEnc->offset) {
|
} else if (!offset) {
|
||||||
IA32_Mov_Reg_Rm(jit, reg2, REG_EBX, MOD_MEM_REG);
|
IA32_Mov_Reg_Rm(jit, reg2, REG_EBX, MOD_MEM_REG);
|
||||||
} else {
|
} else {
|
||||||
IA32_Mov_Reg_Rm_Disp32(jit, reg2, REG_EBX, pEnc->offset);
|
IA32_Mov_Reg_Rm_Disp32(jit, reg2, REG_EBX, offset);
|
||||||
}
|
}
|
||||||
IA32_Push_Reg(jit, reg);
|
IA32_Push_Reg(jit, reg);
|
||||||
IA32_Push_Reg(jit, reg2);
|
IA32_Push_Reg(jit, reg2);
|
||||||
@@ -226,20 +200,20 @@ inline void Write_PushPOD(JitWriter *jit, const PassEncode *pEnc)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (pEnc->info.flags & PASSFLAG_BYREF) {
|
} else if (info->flags & PASSFLAG_BYREF) {
|
||||||
//lea reg, [ebx+<offset>]
|
//lea reg, [ebx+<offset>]
|
||||||
//push reg
|
//push reg
|
||||||
if (!pEnc->offset)
|
if (!offset)
|
||||||
{
|
{
|
||||||
IA32_Push_Reg(jit, REG_EBX);
|
IA32_Push_Reg(jit, REG_EBX);
|
||||||
g_StackUsage += 4;
|
g_StackUsage += 4;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pEnc->offset < SCHAR_MAX)
|
if (offset < SCHAR_MAX)
|
||||||
{
|
{
|
||||||
IA32_Lea_DispRegImm8(jit, reg, REG_EBX, (jit_int8_t)pEnc->offset);
|
IA32_Lea_DispRegImm8(jit, reg, REG_EBX, (jit_int8_t)offset);
|
||||||
} else {
|
} else {
|
||||||
IA32_Lea_DispRegImm32(jit, reg, REG_EBX, pEnc->offset);
|
IA32_Lea_DispRegImm32(jit, reg, REG_EBX, offset);
|
||||||
}
|
}
|
||||||
IA32_Push_Reg(jit, reg);
|
IA32_Push_Reg(jit, reg);
|
||||||
|
|
||||||
@@ -247,24 +221,24 @@ inline void Write_PushPOD(JitWriter *jit, const PassEncode *pEnc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Write_PushFloat(JitWriter *jit, const PassEncode *pEnc)
|
inline void Write_PushFloat(JitWriter *jit, const SourceHook::PassInfo *info, unsigned int offset)
|
||||||
{
|
{
|
||||||
if (pEnc->info.flags & PASSFLAG_BYVAL)
|
if (info->flags & PASSFLAG_BYVAL)
|
||||||
{
|
{
|
||||||
switch (pEnc->info.size)
|
switch (info->size)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
//fld DWORD PTR [ebx+<offset>]
|
//fld DWORD PTR [ebx+<offset>]
|
||||||
//push reg
|
//push reg
|
||||||
//fstp DWORD PTR [esp]
|
//fstp DWORD PTR [esp]
|
||||||
if (pEnc->offset < SCHAR_MAX)
|
if (offset < SCHAR_MAX)
|
||||||
{
|
{
|
||||||
IA32_Fld_Mem32_Disp8(jit, REG_EBX, (jit_int8_t)pEnc->offset);
|
IA32_Fld_Mem32_Disp8(jit, REG_EBX, (jit_int8_t)offset);
|
||||||
} else if (!pEnc->offset) {
|
} else if (!offset) {
|
||||||
IA32_Fld_Mem32(jit, REG_EBX);
|
IA32_Fld_Mem32(jit, REG_EBX);
|
||||||
} else {
|
} else {
|
||||||
IA32_Fld_Mem32_Disp32(jit, REG_EBX, pEnc->offset);
|
IA32_Fld_Mem32_Disp32(jit, REG_EBX, offset);
|
||||||
}
|
}
|
||||||
IA32_Push_Reg(jit, _DecodeRegister3(g_RegDecoder++));
|
IA32_Push_Reg(jit, _DecodeRegister3(g_RegDecoder++));
|
||||||
IA32_Fstp_Mem32_ESP(jit);
|
IA32_Fstp_Mem32_ESP(jit);
|
||||||
@@ -276,13 +250,13 @@ inline void Write_PushFloat(JitWriter *jit, const PassEncode *pEnc)
|
|||||||
//fld QWORD PTR [ebx+<offset>]
|
//fld QWORD PTR [ebx+<offset>]
|
||||||
//sub esp, 8
|
//sub esp, 8
|
||||||
//fstp QWORD PTR [esp]
|
//fstp QWORD PTR [esp]
|
||||||
if (pEnc->offset < SCHAR_MAX)
|
if (offset < SCHAR_MAX)
|
||||||
{
|
{
|
||||||
IA32_Fld_Mem64_Disp8(jit, REG_EBX, (jit_int8_t)pEnc->offset);
|
IA32_Fld_Mem64_Disp8(jit, REG_EBX, (jit_int8_t)offset);
|
||||||
} else if (!pEnc->offset) {
|
} else if (!offset) {
|
||||||
IA32_Fld_Mem64(jit, REG_EBX);
|
IA32_Fld_Mem64(jit, REG_EBX);
|
||||||
} else {
|
} else {
|
||||||
IA32_Fld_Mem64_Disp32(jit, REG_EBX, pEnc->offset);
|
IA32_Fld_Mem64_Disp32(jit, REG_EBX, offset);
|
||||||
}
|
}
|
||||||
IA32_Sub_Rm_Imm8(jit, REG_ESP, 8, MOD_REG);
|
IA32_Sub_Rm_Imm8(jit, REG_ESP, 8, MOD_REG);
|
||||||
IA32_Fstp_Mem64_ESP(jit);
|
IA32_Fstp_Mem64_ESP(jit);
|
||||||
@@ -290,10 +264,10 @@ inline void Write_PushFloat(JitWriter *jit, const PassEncode *pEnc)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (pEnc->info.flags & PASSFLAG_BYREF) {
|
} else if (info->flags & PASSFLAG_BYREF) {
|
||||||
//lea reg, [ebx+<offset>]
|
//lea reg, [ebx+<offset>]
|
||||||
//push reg
|
//push reg
|
||||||
if (!pEnc->offset)
|
if (!offset)
|
||||||
{
|
{
|
||||||
IA32_Push_Reg(jit, REG_EBX);
|
IA32_Push_Reg(jit, REG_EBX);
|
||||||
g_StackUsage += 4;
|
g_StackUsage += 4;
|
||||||
@@ -301,11 +275,11 @@ inline void Write_PushFloat(JitWriter *jit, const PassEncode *pEnc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
jit_uint8_t reg = _DecodeRegister3(g_RegDecoder++);
|
jit_uint8_t reg = _DecodeRegister3(g_RegDecoder++);
|
||||||
if (pEnc->offset < SCHAR_MAX)
|
if (offset < SCHAR_MAX)
|
||||||
{
|
{
|
||||||
IA32_Lea_DispRegImm8(jit, reg, REG_EBX, (jit_int8_t)pEnc->offset);
|
IA32_Lea_DispRegImm8(jit, reg, REG_EBX, (jit_int8_t)offset);
|
||||||
} else {
|
} else {
|
||||||
IA32_Lea_DispRegImm32(jit, reg, REG_EBX, pEnc->offset);
|
IA32_Lea_DispRegImm32(jit, reg, REG_EBX, offset);
|
||||||
}
|
}
|
||||||
IA32_Push_Reg(jit, reg);
|
IA32_Push_Reg(jit, reg);
|
||||||
|
|
||||||
@@ -313,18 +287,18 @@ inline void Write_PushFloat(JitWriter *jit, const PassEncode *pEnc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Write_PushObject(JitWriter *jit, const PassEncode *pEnc)
|
inline void Write_PushObject(JitWriter *jit, const SourceHook::PassInfo *info, unsigned int offset)
|
||||||
{
|
{
|
||||||
if (pEnc->info.flags & PASSFLAG_BYVAL)
|
if (info->flags & PASSFLAG_BYVAL)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_POSIX
|
#ifdef PLATFORM_POSIX
|
||||||
if (pEnc->info.flags & PASSFLAG_ODTOR)
|
if (info->flags & PASSFLAG_ODTOR)
|
||||||
{
|
{
|
||||||
goto push_byref;
|
goto push_byref;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
jit_uint32_t dwords = pEnc->info.size >> 2;
|
jit_uint32_t dwords = info->size >> 2;
|
||||||
jit_uint32_t bytes = pEnc->info.size & 0x3;
|
jit_uint32_t bytes = info->size & 0x3;
|
||||||
|
|
||||||
//sub esp, <size>
|
//sub esp, <size>
|
||||||
//cld
|
//cld
|
||||||
@@ -340,23 +314,23 @@ inline void Write_PushObject(JitWriter *jit, const PassEncode *pEnc)
|
|||||||
// rep movsb
|
// rep movsb
|
||||||
//pop esi
|
//pop esi
|
||||||
//pop edi
|
//pop edi
|
||||||
if (pEnc->info.size < SCHAR_MAX)
|
if (info->size < SCHAR_MAX)
|
||||||
{
|
{
|
||||||
IA32_Sub_Rm_Imm8(jit, REG_ESP, (jit_int8_t)pEnc->info.size, MOD_REG);
|
IA32_Sub_Rm_Imm8(jit, REG_ESP, (jit_int8_t)info->size, MOD_REG);
|
||||||
} else {
|
} else {
|
||||||
IA32_Sub_Rm_Imm32(jit, REG_ESP, pEnc->info.size, MOD_REG);
|
IA32_Sub_Rm_Imm32(jit, REG_ESP, info->size, MOD_REG);
|
||||||
}
|
}
|
||||||
IA32_Cld(jit);
|
IA32_Cld(jit);
|
||||||
IA32_Push_Reg(jit, REG_EDI);
|
IA32_Push_Reg(jit, REG_EDI);
|
||||||
IA32_Push_Reg(jit, REG_ESI);
|
IA32_Push_Reg(jit, REG_ESI);
|
||||||
IA32_Lea_Reg_DispRegMultImm8(jit, REG_EDI, REG_NOIDX, REG_ESP, NOSCALE, 8);
|
IA32_Lea_Reg_DispRegMultImm8(jit, REG_EDI, REG_NOIDX, REG_ESP, NOSCALE, 8);
|
||||||
if (pEnc->offset < SCHAR_MAX)
|
if (offset < SCHAR_MAX)
|
||||||
{
|
{
|
||||||
IA32_Lea_DispRegImm8(jit, REG_ESI, REG_EBX, (jit_int8_t)pEnc->offset);
|
IA32_Lea_DispRegImm8(jit, REG_ESI, REG_EBX, (jit_int8_t)offset);
|
||||||
} else if (!pEnc->offset) {
|
} else if (!offset) {
|
||||||
IA32_Mov_Reg_Rm(jit, REG_ESI, REG_EBX, MOD_REG);
|
IA32_Mov_Reg_Rm(jit, REG_ESI, REG_EBX, MOD_REG);
|
||||||
} else {
|
} else {
|
||||||
IA32_Lea_DispRegImm32(jit, REG_ESI, REG_EBX, pEnc->offset);
|
IA32_Lea_DispRegImm32(jit, REG_ESI, REG_EBX, offset);
|
||||||
}
|
}
|
||||||
if (dwords)
|
if (dwords)
|
||||||
{
|
{
|
||||||
@@ -373,12 +347,12 @@ inline void Write_PushObject(JitWriter *jit, const PassEncode *pEnc)
|
|||||||
IA32_Pop_Reg(jit, REG_ESI);
|
IA32_Pop_Reg(jit, REG_ESI);
|
||||||
IA32_Pop_Reg(jit, REG_EDI);
|
IA32_Pop_Reg(jit, REG_EDI);
|
||||||
|
|
||||||
g_StackUsage += pEnc->info.size;
|
g_StackUsage += info->size;
|
||||||
} else if (pEnc->info.flags & PASSFLAG_BYREF) {
|
} else if (info->flags & PASSFLAG_BYREF) {
|
||||||
#ifdef PLATFORM_POSIX
|
#ifdef PLATFORM_POSIX
|
||||||
push_byref:
|
push_byref:
|
||||||
#endif
|
#endif
|
||||||
if (!pEnc->offset)
|
if (!offset)
|
||||||
{
|
{
|
||||||
IA32_Push_Reg(jit, REG_EBX);
|
IA32_Push_Reg(jit, REG_EBX);
|
||||||
g_StackUsage += 4;
|
g_StackUsage += 4;
|
||||||
@@ -388,11 +362,11 @@ push_byref:
|
|||||||
//lea reg, [ebx+<offset>]
|
//lea reg, [ebx+<offset>]
|
||||||
//push reg
|
//push reg
|
||||||
jit_uint8_t reg = _DecodeRegister3(g_RegDecoder++);
|
jit_uint8_t reg = _DecodeRegister3(g_RegDecoder++);
|
||||||
if (pEnc->offset < SCHAR_MAX)
|
if (offset < SCHAR_MAX)
|
||||||
{
|
{
|
||||||
IA32_Lea_DispRegImm8(jit, reg, REG_EBX, (jit_int8_t)pEnc->offset);
|
IA32_Lea_DispRegImm8(jit, reg, REG_EBX, (jit_int8_t)offset);
|
||||||
} else {
|
} else {
|
||||||
IA32_Lea_DispRegImm32(jit, reg, REG_EBX, pEnc->offset);
|
IA32_Lea_DispRegImm32(jit, reg, REG_EBX, offset);
|
||||||
}
|
}
|
||||||
IA32_Push_Reg(jit, reg);
|
IA32_Push_Reg(jit, reg);
|
||||||
|
|
||||||
@@ -429,15 +403,16 @@ inline void Write_CallFunction(JitWriter *jit, FuncAddrMethod method, CallWrappe
|
|||||||
{
|
{
|
||||||
//call <addr>
|
//call <addr>
|
||||||
jitoffs_t call = IA32_Call_Imm32(jit, 0);
|
jitoffs_t call = IA32_Call_Imm32(jit, 0);
|
||||||
IA32_Write_Jump32_Abs(jit, call, pWrapper->m_Addrs[ADDR_CALLEE]);
|
IA32_Write_Jump32_Abs(jit, call, pWrapper->GetCalleeAddr());
|
||||||
} else if (method == FuncAddr_VTable) {
|
} else if (method == FuncAddr_VTable) {
|
||||||
//*(this + thisOffs + vtblOffs)[vtblIdx]
|
//*(this + thisOffs + vtblOffs)[vtblIdx]
|
||||||
//mov edx, [ebx]
|
//mov edx, [ebx]
|
||||||
//mov eax, [edx+<thisOffs>+<vtblOffs>]
|
//mov eax, [edx+<thisOffs>+<vtblOffs>]
|
||||||
//mov edx, [eax+<vtblIdx>*4]
|
//mov edx, [eax+<vtblIdx>*4]
|
||||||
//call edx
|
//call edx
|
||||||
jit_uint32_t total_offs = pWrapper->m_VtInfo.thisOffs + pWrapper->m_VtInfo.vtblOffs;
|
SourceHook::MemFuncInfo *funcInfo = pWrapper->GetMemFuncInfo();
|
||||||
jit_uint32_t vfunc_pos = pWrapper->m_VtInfo.vtblIdx * 4;
|
jit_uint32_t total_offs = funcInfo->thisptroffs + funcInfo->vtbloffs;
|
||||||
|
jit_uint32_t vfunc_pos = funcInfo->vtblindex * 4;
|
||||||
|
|
||||||
IA32_Mov_Reg_Rm(jit, REG_EDX, REG_EBX, MOD_MEM_REG);
|
IA32_Mov_Reg_Rm(jit, REG_EDX, REG_EBX, MOD_MEM_REG);
|
||||||
if (total_offs < SCHAR_MAX)
|
if (total_offs < SCHAR_MAX)
|
||||||
@@ -529,7 +504,7 @@ inline void Write_MovRet2Buf(JitWriter *jit, const PassInfo *pRet)
|
|||||||
* Assembly Compiler Function *
|
* Assembly Compiler Function *
|
||||||
******************************/
|
******************************/
|
||||||
|
|
||||||
void JIT_Compile(CallWrapper *pWrapper, FuncAddrMethod method)
|
void *JIT_CallCompile(CallWrapper *pWrapper, FuncAddrMethod method)
|
||||||
{
|
{
|
||||||
JitWriter writer;
|
JitWriter writer;
|
||||||
JitWriter *jit = &writer;
|
JitWriter *jit = &writer;
|
||||||
@@ -553,22 +528,25 @@ jit_rewind:
|
|||||||
/* Write parameter push code */
|
/* Write parameter push code */
|
||||||
for (jit_int32_t i=ParamCount-1; i>=0; i--)
|
for (jit_int32_t i=ParamCount-1; i>=0; i--)
|
||||||
{
|
{
|
||||||
const PassEncode *pEnc = pWrapper->GetParamInfo(i);
|
unsigned int offset = pWrapper->GetParamOffset(i);
|
||||||
switch (pEnc->info.type)
|
const SourceHook::PassInfo *info = pWrapper->GetSHParamInfo(i);
|
||||||
|
assert(info != NULL);
|
||||||
|
|
||||||
|
switch (info->type)
|
||||||
{
|
{
|
||||||
case PassType_Basic:
|
case SourceHook::PassInfo::PassType_Basic:
|
||||||
{
|
{
|
||||||
Write_PushPOD(jit, pEnc);
|
Write_PushPOD(jit, info, offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PassType_Float:
|
case SourceHook::PassInfo::PassType_Float:
|
||||||
{
|
{
|
||||||
Write_PushFloat(jit, pEnc);
|
Write_PushFloat(jit, info, offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PassType_Object:
|
case SourceHook::PassInfo::PassType_Object:
|
||||||
{
|
{
|
||||||
Write_PushObject(jit, pEnc);
|
Write_PushObject(jit, info, offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -640,7 +618,7 @@ skip_retbuffer:
|
|||||||
writer.outbase = (jitcode_t)g_SPEngine->AllocatePageMemory(CodeSize);
|
writer.outbase = (jitcode_t)g_SPEngine->AllocatePageMemory(CodeSize);
|
||||||
g_SPEngine->SetReadWrite(writer.outbase);
|
g_SPEngine->SetReadWrite(writer.outbase);
|
||||||
writer.outptr = writer.outbase;
|
writer.outptr = writer.outbase;
|
||||||
pWrapper->m_Addrs[ADDR_CODEBASE] = writer.outbase;
|
pWrapper->SetCodeBaseAddr(writer.outbase);
|
||||||
g_StackAlign = (g_StackUsage) ? ((g_StackUsage & 0xFFFFFFF0) + 16) - g_StackUsage : 0;
|
g_StackAlign = (g_StackUsage) ? ((g_StackUsage & 0xFFFFFFF0) + 16) - g_StackUsage : 0;
|
||||||
g_StackUsage = 0;
|
g_StackUsage = 0;
|
||||||
g_RegDecoder = 0;
|
g_RegDecoder = 0;
|
||||||
@@ -648,4 +626,5 @@ skip_retbuffer:
|
|||||||
goto jit_rewind;
|
goto jit_rewind;
|
||||||
}
|
}
|
||||||
g_SPEngine->SetReadExecute(writer.outbase);
|
g_SPEngine->SetReadExecute(writer.outbase);
|
||||||
|
return writer.outbase;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,12 +29,47 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _INCLUDE_SOURCEMOD_JIT_CALL_H_
|
#ifndef _INCLUDE_SOURCEMOD_JIT_COMPILE_H_
|
||||||
#define _INCLUDE_SOURCEMOD_JIT_CALL_H_
|
#define _INCLUDE_SOURCEMOD_JIT_COMPILE_H_
|
||||||
|
|
||||||
#include "CallMaker.h"
|
#include <jit_helpers.h>
|
||||||
|
#include <x86_macros.h>
|
||||||
#include "CallWrapper.h"
|
#include "CallWrapper.h"
|
||||||
|
#include "HookWrapper.h"
|
||||||
|
|
||||||
void JIT_Compile(CallWrapper *pWrapper, FuncAddrMethod method);
|
void *JIT_CallCompile(CallWrapper *pWrapper, FuncAddrMethod method);
|
||||||
|
#if defined HOOKING_ENABLED
|
||||||
|
void *JIT_HookCompile(HookWrapper *pWrapper);
|
||||||
|
void JIT_FreeHook(void *addr);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_JIT_CALL_H_
|
/********************
|
||||||
|
* Assembly Helpers *
|
||||||
|
********************/
|
||||||
|
|
||||||
|
inline jit_uint8_t _DecodeRegister3(jit_uint32_t val)
|
||||||
|
{
|
||||||
|
switch (val % 3)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
return REG_EAX;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
return REG_EDX;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
return REG_ECX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Should never happen */
|
||||||
|
assert(false);
|
||||||
|
return 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern jit_uint32_t g_RegDecoder;
|
||||||
|
|
||||||
|
#endif //_INCLUDE_SOURCEMOD_JIT_COMPILE_H_
|
||||||
@@ -0,0 +1,430 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* =============================================================================
|
||||||
|
* SourceMod BinTools Extension
|
||||||
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
|
* =============================================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||||
|
* 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: CallMaker.h 1964 2008-03-27 04:54:56Z damagedsoul $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined HOOKING_ENABLED
|
||||||
|
|
||||||
|
#include "jit_compile.h"
|
||||||
|
#include "sm_platform.h"
|
||||||
|
#include "extension.h"
|
||||||
|
|
||||||
|
/********************
|
||||||
|
* Assembly Opcodes *
|
||||||
|
********************/
|
||||||
|
|
||||||
|
inline void Write_Function_Prologue(JitWriter *jit, bool RetInMemory)
|
||||||
|
{
|
||||||
|
//push ebp
|
||||||
|
//push ebx
|
||||||
|
//mov ebp, esp
|
||||||
|
IA32_Push_Reg(jit, REG_EBP);
|
||||||
|
IA32_Push_Reg(jit, REG_EBX);
|
||||||
|
IA32_Mov_Reg_Rm(jit, REG_EBP, REG_ESP, MOD_REG);
|
||||||
|
#if defined PLATFORM_WINDOWS
|
||||||
|
//mov ebx, ecx
|
||||||
|
IA32_Mov_Reg_Rm(jit, REG_EBX, REG_ECX, MOD_REG);
|
||||||
|
#elif defined PLATFORM_LINUX
|
||||||
|
//mov ebx, [ebp+12+(RetInMemory)?4:0]
|
||||||
|
IA32_Mov_Reg_Rm_Disp8(jit, REG_EBX, REG_EBP, 12+((RetInMemory)?4:0));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Write_Function_Epilogue(JitWriter *jit, unsigned short size)
|
||||||
|
{
|
||||||
|
//mov esp, ebp
|
||||||
|
//pop ebx
|
||||||
|
//pop ebp
|
||||||
|
//ret <value>
|
||||||
|
IA32_Mov_Reg_Rm(jit, REG_ESP, REG_EBP, MOD_REG);
|
||||||
|
IA32_Pop_Reg(jit, REG_EBX);
|
||||||
|
IA32_Pop_Reg(jit, REG_EBP);
|
||||||
|
if (size == 0)
|
||||||
|
{
|
||||||
|
IA32_Return(jit);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IA32_Return_Popstack(jit, size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Write_Stack_Alloc(JitWriter *jit, jit_uint32_t size)
|
||||||
|
{
|
||||||
|
//sub esp, <value>
|
||||||
|
if (size <= SCHAR_MAX)
|
||||||
|
{
|
||||||
|
IA32_Sub_Rm_Imm8(jit, REG_ESP, (jit_int8_t)size, MOD_REG);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IA32_Sub_Rm_Imm32(jit, REG_ESP, size, MOD_REG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Write_Copy_Params(JitWriter *jit, bool RetInMemory, jit_uint32_t retsize, jit_uint32_t paramsize)
|
||||||
|
{
|
||||||
|
//:TODO: inline this memcpy!! - For small numbers of params mov's (with clever reg allocation?) would be faster
|
||||||
|
|
||||||
|
//cld
|
||||||
|
//push edi
|
||||||
|
//push esi
|
||||||
|
//lea edi, [ebp-<retsize>-<paramsize>]
|
||||||
|
//lea esi, [ebp+12+(RetInMemory)?4:0]
|
||||||
|
//if dwords
|
||||||
|
// mov ecx, <dwords>
|
||||||
|
// rep movsd
|
||||||
|
//if bytes
|
||||||
|
// mov ecx, <bytes>
|
||||||
|
// rep movsb
|
||||||
|
//pop esi
|
||||||
|
//pop edi
|
||||||
|
|
||||||
|
jit_int32_t offs;
|
||||||
|
jit_uint32_t dwords = paramsize >> 2;
|
||||||
|
jit_uint32_t bytes = paramsize & 0x3;
|
||||||
|
|
||||||
|
IA32_Cld(jit);
|
||||||
|
IA32_Push_Reg(jit, REG_EDI);
|
||||||
|
IA32_Push_Reg(jit, REG_ESI);
|
||||||
|
offs = -(jit_int32_t)retsize - paramsize;
|
||||||
|
|
||||||
|
if (offs > SCHAR_MIN)
|
||||||
|
{
|
||||||
|
IA32_Lea_DispRegImm8(jit, REG_EDI, REG_EBP, (jit_int8_t)offs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IA32_Lea_DispRegImm32(jit, REG_EDI, REG_EBP, offs);
|
||||||
|
}
|
||||||
|
offs = 12 + ((RetInMemory) ? sizeof(void *) : 0);
|
||||||
|
|
||||||
|
#if defined PLATFORM_LINUX
|
||||||
|
offs += 4;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (offs < SCHAR_MAX)
|
||||||
|
{
|
||||||
|
IA32_Lea_DispRegImm8(jit, REG_ESI, REG_EBP, (jit_int8_t)offs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IA32_Lea_DispRegImm32(jit, REG_ESI, REG_EBP, offs);
|
||||||
|
}
|
||||||
|
if (dwords)
|
||||||
|
{
|
||||||
|
IA32_Mov_Reg_Imm32(jit, REG_ECX, dwords);
|
||||||
|
IA32_Rep(jit);
|
||||||
|
IA32_Movsd(jit);
|
||||||
|
}
|
||||||
|
if (bytes)
|
||||||
|
{
|
||||||
|
IA32_Mov_Reg_Imm32(jit, REG_ECX, bytes);
|
||||||
|
IA32_Rep(jit);
|
||||||
|
IA32_Movsb(jit);
|
||||||
|
}
|
||||||
|
IA32_Pop_Reg(jit, REG_ESI);
|
||||||
|
IA32_Pop_Reg(jit, REG_EDI);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Write_Push_Params(JitWriter *jit,
|
||||||
|
bool isretvoid,
|
||||||
|
bool isvoid,
|
||||||
|
jit_uint32_t retsize,
|
||||||
|
jit_uint32_t paramsize,
|
||||||
|
HookWrapper *pWrapper)
|
||||||
|
{
|
||||||
|
//and esp, 0xFFFFFFF0
|
||||||
|
IA32_And_Rm_Imm8(jit, REG_ESP, MOD_REG, -16);
|
||||||
|
|
||||||
|
//if retvoid
|
||||||
|
// push 0
|
||||||
|
//else
|
||||||
|
// lea reg, [ebp-<retsize>]
|
||||||
|
// push reg
|
||||||
|
if (isretvoid)
|
||||||
|
{
|
||||||
|
IA32_Push_Imm8(jit, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jit_int32_t offs = -(jit_int32_t)retsize;
|
||||||
|
if (offs >= SCHAR_MIN)
|
||||||
|
{
|
||||||
|
IA32_Lea_DispRegImm8(jit, REG_EAX, REG_EBP, (jit_int8_t)offs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IA32_Lea_DispRegImm32(jit, REG_EAX, REG_EBP, offs);
|
||||||
|
}
|
||||||
|
IA32_Push_Reg(jit, REG_EAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
//if void
|
||||||
|
// push 0
|
||||||
|
//else
|
||||||
|
// lea reg, [ebp-<retsize>-<paramsize>]
|
||||||
|
// push reg
|
||||||
|
if (isvoid)
|
||||||
|
{
|
||||||
|
IA32_Push_Imm8(jit, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jit_int32_t offs = -(jit_int32_t)retsize - paramsize;
|
||||||
|
if (offs > SCHAR_MIN)
|
||||||
|
{
|
||||||
|
IA32_Lea_DispRegImm8(jit, REG_EDX, REG_EBP, (jit_int8_t)offs);
|
||||||
|
} else {
|
||||||
|
IA32_Lea_DispRegImm32(jit, REG_EDX, REG_EBP, offs);
|
||||||
|
}
|
||||||
|
IA32_Push_Reg(jit, REG_EDX);
|
||||||
|
}
|
||||||
|
|
||||||
|
//push eax (thisptr)
|
||||||
|
//IA32_Push_Reg(jit, REG_ECX);
|
||||||
|
|
||||||
|
//push ebx
|
||||||
|
IA32_Push_Reg(jit, REG_EBX);
|
||||||
|
|
||||||
|
//push <pWrapper>
|
||||||
|
IA32_Push_Imm32(jit, (jit_int32_t)pWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Write_Call_Handler(JitWriter *jit, void *addr)
|
||||||
|
{
|
||||||
|
//call <addr>
|
||||||
|
jitoffs_t call = IA32_Call_Imm32(jit, 0);
|
||||||
|
IA32_Write_Jump32_Abs(jit, call, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Write_Copy_RetVal(JitWriter *jit, SourceHook::PassInfo *pRetInfo)
|
||||||
|
{
|
||||||
|
/* If the return value is a reference the size will probably be >sizeof(void *)
|
||||||
|
* for objects, we need to fix that so we can actually return the reference.
|
||||||
|
*/
|
||||||
|
size_t size = pRetInfo->size;
|
||||||
|
if (pRetInfo->flags & PASSFLAG_BYREF)
|
||||||
|
{
|
||||||
|
size = sizeof(void *);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pRetInfo->type == SourceHook::PassInfo::PassType_Float &&
|
||||||
|
pRetInfo->flags & SourceHook::PassInfo::PassFlag_ByVal)
|
||||||
|
{
|
||||||
|
switch (size)
|
||||||
|
{
|
||||||
|
case 4:
|
||||||
|
{
|
||||||
|
//fld DWORD PTR [ebp-4]
|
||||||
|
IA32_Fld_Mem32_Disp8(jit, REG_EBP, -4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 8:
|
||||||
|
{
|
||||||
|
//fld QWORD PTR [ebp-8]
|
||||||
|
IA32_Fld_Mem64_Disp8(jit, REG_EBP, -8);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (pRetInfo->type == SourceHook::PassInfo::PassType_Object &&
|
||||||
|
pRetInfo->flags & SourceHook::PassInfo::PassFlag_ByVal)
|
||||||
|
{
|
||||||
|
//cld
|
||||||
|
//push edi
|
||||||
|
//push esi
|
||||||
|
//mov edi, [ebp+12]
|
||||||
|
//lea esi, [ebp-<retsize>]
|
||||||
|
//if dwords
|
||||||
|
// mov ecx, <dwords>
|
||||||
|
// rep movsd
|
||||||
|
//if bytes
|
||||||
|
// mov ecx, <bytes>
|
||||||
|
// rep movsb
|
||||||
|
//pop esi
|
||||||
|
//pop edi
|
||||||
|
|
||||||
|
jit_int32_t offs;
|
||||||
|
jit_uint32_t dwords = size >> 2;
|
||||||
|
jit_uint32_t bytes = size & 0x3;
|
||||||
|
|
||||||
|
IA32_Cld(jit);
|
||||||
|
IA32_Push_Reg(jit, REG_EDI);
|
||||||
|
IA32_Push_Reg(jit, REG_ESI);
|
||||||
|
|
||||||
|
IA32_Mov_Reg_Rm_Disp8(jit, REG_EDI, REG_EBP, 12);
|
||||||
|
|
||||||
|
offs = -(jit_int32_t)pRetInfo->size;
|
||||||
|
if (offs >= SCHAR_MIN)
|
||||||
|
{
|
||||||
|
IA32_Lea_DispRegImm8(jit, REG_ESI, REG_EBP, (jit_int8_t)offs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IA32_Lea_DispRegImm32(jit, REG_ESI, REG_EBP, offs);
|
||||||
|
}
|
||||||
|
IA32_Mov_Reg_Rm(jit, REG_EAX, REG_EDI, MOD_REG);
|
||||||
|
|
||||||
|
if (dwords)
|
||||||
|
{
|
||||||
|
IA32_Mov_Reg_Imm32(jit, REG_ECX, dwords);
|
||||||
|
IA32_Rep(jit);
|
||||||
|
IA32_Movsd(jit);
|
||||||
|
}
|
||||||
|
if (bytes)
|
||||||
|
{
|
||||||
|
IA32_Mov_Reg_Imm32(jit, REG_ECX, bytes);
|
||||||
|
IA32_Rep(jit);
|
||||||
|
IA32_Movsb(jit);
|
||||||
|
}
|
||||||
|
IA32_Pop_Reg(jit, REG_ESI);
|
||||||
|
IA32_Pop_Reg(jit, REG_EDI);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (size)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
//mov al, BYTE PTR [ebp-4]
|
||||||
|
IA32_Mov_Reg8_Rm8_Disp8(jit, REG_EAX, REG_EBP, -4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
//mov ax, WORD PTR [ebp-4]
|
||||||
|
jit->write_ubyte(IA32_16BIT_PREFIX);
|
||||||
|
IA32_Mov_Reg_Rm_Disp8(jit, REG_EAX, REG_EBP, -4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 4:
|
||||||
|
{
|
||||||
|
//mov eax, DWORD PTR [ebp-4]
|
||||||
|
IA32_Mov_Reg_Rm_Disp8(jit, REG_EAX, REG_EBP, -4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 8:
|
||||||
|
{
|
||||||
|
//mov eax, DWORD PTR [ebp-8]
|
||||||
|
//mov edx, DWORD PTR [ebp-4]
|
||||||
|
//:TODO: this is broken due to SH
|
||||||
|
IA32_Mov_Reg_Rm_Disp8(jit, REG_EAX, REG_EBP, -8);
|
||||||
|
IA32_Mov_Reg_Rm_Disp8(jit, REG_EDX, REG_EBP, -4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************
|
||||||
|
* Assembly Compiler Function *
|
||||||
|
******************************/
|
||||||
|
|
||||||
|
void *JIT_HookCompile(HookWrapper *pWrapper)
|
||||||
|
{
|
||||||
|
JitWriter writer;
|
||||||
|
JitWriter *jit = &writer;
|
||||||
|
|
||||||
|
jit_uint32_t CodeSize = 0;
|
||||||
|
jit_uint32_t ParamSize = pWrapper->GetParamSize();
|
||||||
|
jit_uint32_t RetSize = pWrapper->GetRetSize();
|
||||||
|
|
||||||
|
/* Local variable size allocated in the stack for the param and retval buffers */
|
||||||
|
jit_uint32_t LocalVarSize = ParamSize + RetSize;
|
||||||
|
|
||||||
|
/* Check if the return value is returned in memory */
|
||||||
|
bool RetInMemory = false;
|
||||||
|
SourceHook::PassInfo *pRetInfo = &pWrapper->GetProtoInfo()->retPassInfo;
|
||||||
|
if ((pRetInfo->type == SourceHook::PassInfo::PassType_Object) &&
|
||||||
|
(pRetInfo->flags & SourceHook::PassInfo::PassFlag_ByVal))
|
||||||
|
{
|
||||||
|
RetInMemory = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.outbase = NULL;
|
||||||
|
writer.outptr = NULL;
|
||||||
|
|
||||||
|
jit_rewind:
|
||||||
|
/* Write the function prologue */
|
||||||
|
Write_Function_Prologue(jit, RetInMemory);
|
||||||
|
|
||||||
|
/* Allocate the local variables into the stack */
|
||||||
|
if (LocalVarSize)
|
||||||
|
{
|
||||||
|
Write_Stack_Alloc(jit, LocalVarSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Copy all the parameters into the buffer */
|
||||||
|
if (ParamSize)
|
||||||
|
{
|
||||||
|
Write_Copy_Params(jit, RetInMemory, RetSize, ParamSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Push the parameters into the handler */
|
||||||
|
Write_Push_Params(jit, !RetSize, !ParamSize, RetSize, ParamSize, pWrapper);
|
||||||
|
|
||||||
|
/* Call the handler function */
|
||||||
|
Write_Call_Handler(jit, pWrapper->GetHandlerAddr());
|
||||||
|
|
||||||
|
/* Copy back the return value into eax or the hidden return buffer */
|
||||||
|
if (RetSize)
|
||||||
|
{
|
||||||
|
Write_Copy_RetVal(jit, pRetInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Write the function epilogue */
|
||||||
|
Write_Function_Epilogue(jit,
|
||||||
|
#if defined PLATFORM_WINDOWS
|
||||||
|
ParamSize + ((RetInMemory) ? sizeof(void *) : 0)
|
||||||
|
#elif defined PLATFORM_LINUX
|
||||||
|
(RetInMemory) ? sizeof(void *) : 0
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
|
if (writer.outbase == NULL)
|
||||||
|
{
|
||||||
|
CodeSize = writer.get_outputpos();
|
||||||
|
writer.outbase = (jitcode_t)g_SPEngine->AllocatePageMemory(CodeSize);
|
||||||
|
g_SPEngine->SetReadWrite(writer.outbase);
|
||||||
|
writer.outptr = writer.outbase;
|
||||||
|
g_RegDecoder = 0;
|
||||||
|
goto jit_rewind;
|
||||||
|
}
|
||||||
|
g_SPEngine->SetReadExecute(writer.outbase);
|
||||||
|
|
||||||
|
return writer.outbase;
|
||||||
|
}
|
||||||
|
|
||||||
|
void JIT_FreeHook(void *addr)
|
||||||
|
{
|
||||||
|
g_SPEngine->FreePageMemory(addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -5,14 +5,44 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bintools", "bintools.vcproj
|
|||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Win32 = Debug|Win32
|
Debug - Dark Messiah|Win32 = Debug - Dark Messiah|Win32
|
||||||
Release|Win32 = Release|Win32
|
Debug - Episode 1|Win32 = Debug - Episode 1|Win32
|
||||||
|
Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32
|
||||||
|
Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
|
||||||
|
Debug - Orange Box Valve|Win32 = Debug - Orange Box Valve|Win32
|
||||||
|
Debug - Orange Box|Win32 = Debug - Orange Box|Win32
|
||||||
|
Release - Dark Messiah|Win32 = Release - Dark Messiah|Win32
|
||||||
|
Release - Episode 1|Win32 = Release - Episode 1|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
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug|Win32.ActiveCfg = Debug|Win32
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Dark Messiah|Win32.ActiveCfg = Debug - Dark Messiah|Win32
|
||||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug|Win32.Build.0 = Debug|Win32
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Dark Messiah|Win32.Build.0 = Debug - Dark Messiah|Win32
|
||||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release|Win32.ActiveCfg = Release|Win32
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Episode 1|Win32.ActiveCfg = Debug - Episode 1|Win32
|
||||||
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release|Win32.Build.0 = Release|Win32
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Episode 1|Win32.Build.0 = Debug - Episode 1|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Left 4 Dead|Win32.ActiveCfg = Debug - Left 4 Dead|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Left 4 Dead|Win32.Build.0 = Debug - Left 4 Dead|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Old Metamod|Win32.Build.0 = Debug - Old Metamod|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Orange Box Valve|Win32.ActiveCfg = Debug - Orange Box Valve|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Orange Box Valve|Win32.Build.0 = Debug - Orange Box Valve|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Orange Box|Win32.ActiveCfg = Debug - Orange Box|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug - Orange Box|Win32.Build.0 = Debug - Orange Box|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Dark Messiah|Win32.ActiveCfg = Release - Dark Messiah|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Dark Messiah|Win32.Build.0 = Release - Dark Messiah|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Episode 1|Win32.ActiveCfg = Release - Episode 1|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Episode 1|Win32.Build.0 = Release - Episode 1|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Left 4 Dead|Win32.ActiveCfg = Release - Left 4 Dead|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Left 4 Dead|Win32.Build.0 = Release - Left 4 Dead|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Old Metamod|Win32.ActiveCfg = Release - Old Metamod|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Old Metamod|Win32.Build.0 = Release - Old Metamod|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Orange Box Valve|Win32.ActiveCfg = Release - Orange Box Valve|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Orange Box Valve|Win32.Build.0 = Release - Orange Box Valve|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Orange Box|Win32.ActiveCfg = Release - Orange Box|Win32
|
||||||
|
{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release - Orange Box|Win32.Build.0 = Release - Orange Box|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
</ToolFiles>
|
</ToolFiles>
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug - Orange Box|Win32"
|
||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
@@ -40,13 +40,14 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\sourcepawn"
|
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\extensions;..\..\..\public\sourcepawn;"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook";"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1""
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD;HOOKING_ENABLED;SOURCE_ENGINE=3"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
EnableEnhancedInstructionSet="1"
|
EnableEnhancedInstructionSet="0"
|
||||||
RuntimeTypeInfo="false"
|
RuntimeTypeInfo="false"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
@@ -58,13 +59,15 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(OutDir)\bintools.ext.dll"
|
AdditionalDependencies=""$(HL2SDKOB)\lib\public\tier0.lib" "$(HL2SDKOB)\lib\public\tier1.lib" "$(HL2SDKOB)\lib\public\vstdlib.lib" "$(HL2SDKOB)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\bintools.ext.2.ep2.dll"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
@@ -96,7 +99,7 @@
|
|||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release - Orange Box|Win32"
|
||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
@@ -120,11 +123,12 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/MP /D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\sourcepawn"
|
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\extensions;..\..\..\public\sourcepawn;"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook";"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;HOOKING_ENABLED;SOURCE_ENGINE=3"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
EnableEnhancedInstructionSet="1"
|
EnableEnhancedInstructionSet="0"
|
||||||
RuntimeTypeInfo="false"
|
RuntimeTypeInfo="false"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
@@ -136,13 +140,808 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(OutDir)\bintools.ext.dll"
|
AdditionalDependencies=""$(HL2SDKOB)\lib\public\tier0.lib" "$(HL2SDKOB)\lib\public\tier1.lib" "$(HL2SDKOB)\lib\public\vstdlib.lib" "$(HL2SDKOB)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\bintools.ext.2.ep2.dll"
|
||||||
|
LinkIncremental="1"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug - Left 4 Dead|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
|
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\extensions;..\..\..\public\sourcepawn;"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook";"$(HL2SDKL4D)\public";"$(HL2SDKL4D)\public\tier0";"$(HL2SDKL4D)\public\tier1""
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;HOOKING_ENABLED;SOURCE_ENGINE=5"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDKL4D)\lib\public\tier0.lib" "$(HL2SDKL4D)\lib\public\tier1.lib" "$(HL2SDKL4D)\lib\public\vstdlib.lib" "$(HL2SDKL4D)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\bintools.ext.2.l4d.dll"
|
||||||
|
LinkIncremental="2"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug - Old Metamod|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
|
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\extensions;..\..\..\public\sourcepawn;"$(MMSOURCE17)\core\sourcehook";"$(HL2SDK)\public";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1""
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\bintools.ext.1.ep1.dll"
|
||||||
|
LinkIncremental="2"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug - Episode 1|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
|
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\extensions;..\..\..\public\sourcepawn;"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook";"$(HL2SDK)\public";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1""
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;HOOKING_ENABLED;SOURCE_ENGINE=2"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\bintools.ext.1.ep1.dll"
|
||||||
|
LinkIncremental="2"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release - Left 4 Dead|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
|
FavorSizeOrSpeed="1"
|
||||||
|
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\extensions;..\..\..\public\sourcepawn;"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook";"$(HL2SDKL4D)\public";"$(HL2SDKL4D)\public\tier0";"$(HL2SDKL4D)\public\tier1""
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;HOOKING_ENABLED;SOURCE_ENGINE=5"
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDKL4D)\lib\public\tier0.lib" "$(HL2SDKL4D)\lib\public\tier1.lib" "$(HL2SDKL4D)\lib\public\vstdlib.lib" "$(HL2SDKL4D)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\bintools.ext.2.l4d.dll"
|
||||||
|
LinkIncremental="1"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release - Old Metamod|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
|
FavorSizeOrSpeed="1"
|
||||||
|
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\extensions;..\..\..\public\sourcepawn;"$(MMSOURCE17)\core\sourcehook";"$(HL2SDK)\public";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1""
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2"
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\bintools.ext.1.ep1.dll"
|
||||||
|
LinkIncremental="1"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release - Episode 1|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
|
FavorSizeOrSpeed="1"
|
||||||
|
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\extensions;..\..\..\public\sourcepawn;"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook";"$(HL2SDK)\public";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1""
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;HOOKING_ENABLED;SOURCE_ENGINE=2"
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\bintools.ext.1.ep1.dll"
|
||||||
|
LinkIncremental="1"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug - Dark Messiah|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
|
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\extensions;..\..\..\public\sourcepawn;"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook";"$(HL2SDK-DARKM)\public";"$(HL2SDK-DARKM)\public\tier0";"$(HL2SDK-DARKM)\public\tier1""
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;HOOKING_ENABLED;SOURCE_ENGINE=2"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDK-DARKM)\lib\public\tier0.lib" "$(HL2SDK-DARKM)\lib\public\tier1.lib" "$(HL2SDK-DARKM)\lib\public\vstdlib.lib" "$(HL2SDK-DARKM)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\bintools.ext.2.darkm.dll"
|
||||||
|
LinkIncremental="2"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release - Dark Messiah|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
|
FavorSizeOrSpeed="1"
|
||||||
|
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\extensions;..\..\..\public\sourcepawn;"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook";"$(HL2SDK-DARKM)\public";"$(HL2SDK-DARKM)\public\tier0";"$(HL2SDK-DARKM)\public\tier1""
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;HOOKING_ENABLED;SOURCE_ENGINE=2"
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDK-DARKM)\lib\public\tier0.lib" "$(HL2SDK-DARKM)\lib\public\tier1.lib" "$(HL2SDK-DARKM)\lib\public\vstdlib.lib" "$(HL2SDK-DARKM)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\bintools.ext.2.darkm.dll"
|
||||||
|
LinkIncremental="1"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug - Orange Box Valve|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\extensions;..\..\..\public\sourcepawn;"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook";"$(HL2SDKOBVALVE)\public";"$(HL2SDKOBVALVE)\public\tier0";"$(HL2SDKOBVALVE)\public\tier1""
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD;HOOKING_ENABLED;SOURCE_ENGINE=4"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDKOBVALVE)\lib\public\tier0.lib" "$(HL2SDKOBVALVE)\lib\public\tier1.lib" "$(HL2SDKOBVALVE)\lib\public\vstdlib.lib" "$(HL2SDKOBVALVE)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\bintools.ext.2.ep2v.dll"
|
||||||
|
LinkIncremental="2"
|
||||||
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="0"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release - Orange Box Valve|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalOptions="/MP /D SE_EPISODEONE=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||||
|
FavorSizeOrSpeed="1"
|
||||||
|
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\extensions;..\..\..\public\sourcepawn;"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook";"$(HL2SDKOBVALVE)\public";"$(HL2SDKOBVALVE)\public\tier0";"$(HL2SDKOBVALVE)\public\tier1""
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;HOOKING_ENABLED;SOURCE_ENGINE=4"
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="false"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies=""$(HL2SDKOBVALVE)\lib\public\tier0.lib" "$(HL2SDKOBVALVE)\lib\public\tier1.lib" "$(HL2SDKOBVALVE)\lib\public\vstdlib.lib" "$(HL2SDKOBVALVE)\lib\public\mathlib.lib""
|
||||||
|
OutputFile="$(OutDir)\bintools.ext.2.ep2v.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
@@ -204,6 +1003,10 @@
|
|||||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||||
UniqueIdentifier="{C06F7BFF-18EE-4994-8572-D6383011354B}"
|
UniqueIdentifier="{C06F7BFF-18EE-4994-8572-D6383011354B}"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\public\extensions\IBinTools.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\version.rc"
|
RelativePath="..\version.rc"
|
||||||
>
|
>
|
||||||
@@ -227,7 +1030,11 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\jit_call.h"
|
RelativePath="..\HookWrapper.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\jit_compile.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
@@ -244,10 +1051,18 @@
|
|||||||
RelativePath="..\CallWrapper.cpp"
|
RelativePath="..\CallWrapper.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\HookWrapper.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\jit_call.cpp"
|
RelativePath="..\jit_call.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\jit_hook.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
@@ -271,10 +1086,6 @@
|
|||||||
Name="Interfaces"
|
Name="Interfaces"
|
||||||
UniqueIdentifier="{7DE81EA3-99D9-4f34-823A-B314791F3514}"
|
UniqueIdentifier="{7DE81EA3-99D9-4f34-823A-B314791F3514}"
|
||||||
>
|
>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\public\extensions\IBinTools.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
|
#ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
|
||||||
#define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
|
#define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
|
||||||
#include "svn_version.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file smsdk_config.h
|
* @file smsdk_config.h
|
||||||
@@ -41,12 +40,12 @@
|
|||||||
/* Basic information exposed publicly */
|
/* Basic information exposed publicly */
|
||||||
#define SMEXT_CONF_NAME "BinTools"
|
#define SMEXT_CONF_NAME "BinTools"
|
||||||
#define SMEXT_CONF_DESCRIPTION "Low-level C/C++ Calling API"
|
#define SMEXT_CONF_DESCRIPTION "Low-level C/C++ Calling API"
|
||||||
#define SMEXT_CONF_VERSION SVN_FULL_VERSION
|
#define SMEXT_CONF_VERSION ""
|
||||||
#define SMEXT_CONF_AUTHOR "AlliedModders LLC"
|
#define SMEXT_CONF_AUTHOR "AlliedModders LLC"
|
||||||
#define SMEXT_CONF_URL "http://www.sourcemod.net/"
|
#define SMEXT_CONF_URL "http://www.sourcemod.net/"
|
||||||
#define SMEXT_CONF_LOGTAG "SAMPLE"
|
#define SMEXT_CONF_LOGTAG "SAMPLE"
|
||||||
#define SMEXT_CONF_LICENSE "GPL"
|
#define SMEXT_CONF_LICENSE "GPL"
|
||||||
#define SMEXT_CONF_DATESTRING __DATE__ " " __TIME__
|
#define SMEXT_CONF_DATESTRING ""
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Exposes plugin's main interface.
|
* @brief Exposes plugin's main interface.
|
||||||
@@ -57,7 +56,9 @@
|
|||||||
* @brief Sets whether or not this plugin required Metamod.
|
* @brief Sets whether or not this plugin required Metamod.
|
||||||
* NOTE: Uncomment to enable, comment to disable.
|
* NOTE: Uncomment to enable, comment to disable.
|
||||||
*/
|
*/
|
||||||
//#define SMEXT_CONF_METAMOD
|
#if defined HOOKING_ENABLED
|
||||||
|
#define SMEXT_CONF_METAMOD
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Enable interfaces you want to use here by uncommenting lines */
|
/** Enable interfaces you want to use here by uncommenting lines */
|
||||||
//#define SMEXT_ENABLE_FORWARDSYS
|
//#define SMEXT_ENABLE_FORWARDSYS
|
||||||
@@ -65,5 +66,17 @@
|
|||||||
//#define SMEXT_ENABLE_PLAYERHELPERS
|
//#define SMEXT_ENABLE_PLAYERHELPERS
|
||||||
//#define SMEXT_ENABLE_DBMANAGER
|
//#define SMEXT_ENABLE_DBMANAGER
|
||||||
//#define SMEXT_ENABLE_GAMECONF
|
//#define SMEXT_ENABLE_GAMECONF
|
||||||
|
//#define SMEXT_ENABLE_MEMUTILS
|
||||||
|
//#define SMEXT_ENABLE_GAMEHELPERS
|
||||||
|
//#define SMEXT_ENABLE_TIMERSYS
|
||||||
|
//#define SMEXT_ENABLE_THREADER
|
||||||
|
//#define SMEXT_ENABLE_LIBSYS
|
||||||
|
//#define SMEXT_ENABLE_MENUS
|
||||||
|
//#define SMEXT_ENABLE_ADTFACTORY
|
||||||
|
//#define SMEXT_ENABLE_PLUGINSYS
|
||||||
|
//#define SMEXT_ENABLE_ADMINSYS
|
||||||
|
//#define SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
//#define SMEXT_ENABLE_USERMSGS
|
||||||
|
//#define SMEXT_ENABLE_TRANSLATOR
|
||||||
|
|
||||||
#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
|
#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
|
||||||
|
|||||||
@@ -97,6 +97,24 @@ IUserMessages *usermsgs = NULL;
|
|||||||
#if defined SMEXT_ENABLE_TRANSLATOR
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
ITranslator *translator = NULL;
|
ITranslator *translator = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
SourceMod::IPluginManager *plsys;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
IMenuManager *menus = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
IAdminSystem *adminsys = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
ITextParsers *textparsers = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
IUserMessages *usermsgs = NULL;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
ITranslator *translator = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Exports the main interface */
|
/** Exports the main interface */
|
||||||
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
||||||
@@ -182,6 +200,24 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
|
|||||||
#if defined SMEXT_ENABLE_USERMSGS
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
SM_GET_IFACE(USERMSGS, usermsgs);
|
SM_GET_IFACE(USERMSGS, usermsgs);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
SM_GET_IFACE(TRANSLATOR, translator);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
SM_GET_IFACE(PLUGINSYSTEM, plsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
SM_GET_IFACE(MENUMANAGER, menus);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
SM_GET_IFACE(ADMINSYS, adminsys);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
SM_GET_IFACE(TEXTPARSERS, textparsers);
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
SM_GET_IFACE(USERMSGS, usermsgs);
|
||||||
|
#endif
|
||||||
#if defined SMEXT_ENABLE_TRANSLATOR
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
SM_GET_IFACE(TRANSLATOR, translator);
|
SM_GET_IFACE(TRANSLATOR, translator);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -73,6 +73,24 @@
|
|||||||
#if defined SMEXT_ENABLE_LIBSYS
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
#include <ILibrarySys.h>
|
#include <ILibrarySys.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
#include <IPluginSys.h>
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
#include <IMenuManager.h>
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
#include <IAdminSystem.h>
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TEXTPARSERS
|
||||||
|
#include <ITextParsers.h>
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
#include <IUserMessages.h>
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
#include <ITranslator.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined SMEXT_CONF_METAMOD
|
#if defined SMEXT_CONF_METAMOD
|
||||||
#include <ISmmPlugin.h>
|
#include <ISmmPlugin.h>
|
||||||
@@ -256,6 +274,21 @@ extern IThreader *threader;
|
|||||||
#if defined SMEXT_ENABLE_LIBSYS
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
extern ILibrarySys *libsys;
|
extern ILibrarySys *libsys;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_PLUGINSYS
|
||||||
|
extern SourceMod::IPluginManager *plsys;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_MENUS
|
||||||
|
extern IMenuManager *menus;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_ADMINSYS
|
||||||
|
extern IAdminSystem *adminsys;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_USERMSGS
|
||||||
|
extern IUserMessages *usermsgs;
|
||||||
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_TRANSLATOR
|
||||||
|
extern ITranslator *translator;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined SMEXT_CONF_METAMOD
|
#if defined SMEXT_CONF_METAMOD
|
||||||
PLUGIN_GLOBALVARS();
|
PLUGIN_GLOBALVARS();
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
/**
|
|
||||||
* vim: set ts=4 :
|
|
||||||
* =============================================================================
|
|
||||||
* SourceMod BinTools Extension
|
|
||||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
|
||||||
* =============================================================================
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
|
||||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
|
||||||
* 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$
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Autogenerated by build scripts
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _INCLUDE_BINTOOLS_VERSION_H_
|
|
||||||
#define _INCLUDE_BINTOOLS_VERSION_H_
|
|
||||||
|
|
||||||
#define SM_BUILD_STRING ""
|
|
||||||
#define SM_BUILD_UNIQUEID "2481:c1fe549598cd" SM_BUILD_STRING
|
|
||||||
#define SVN_FULL_VERSION "1.1.2" SM_BUILD_STRING
|
|
||||||
#define SVN_FILE_VERSION 1,1,2,0
|
|
||||||
|
|
||||||
#endif //_INCLUDE_BINTOOLS_VERSION_H_
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
/**
|
|
||||||
* vim: set ts=4 :
|
|
||||||
* =============================================================================
|
|
||||||
* SourceMod BinTools Extension
|
|
||||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
|
||||||
* =============================================================================
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
|
||||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
|
||||||
* 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$
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Autogenerated by build scripts
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _INCLUDE_BINTOOLS_VERSION_H_
|
|
||||||
#define _INCLUDE_BINTOOLS_VERSION_H_
|
|
||||||
|
|
||||||
#define SM_BUILD_STRING "$BUILD_STRING$"
|
|
||||||
#define SM_BUILD_UNIQUEID "$BUILD_ID$" SM_BUILD_STRING
|
|
||||||
#define SVN_FULL_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$" SM_BUILD_STRING
|
|
||||||
#define SVN_FILE_VERSION $PMAJOR$,$PMINOR$,$PREVISION$,0
|
|
||||||
|
|
||||||
#endif //_INCLUDE_BINTOOLS_VERSION_H_
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
//
|
//
|
||||||
#include "winres.h"
|
#include "winres.h"
|
||||||
|
|
||||||
#include "svn_version.h"
|
#include <sourcemod_version.h>
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
#undef APSTUDIO_READONLY_SYMBOLS
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
@@ -29,8 +29,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION SVN_FILE_VERSION
|
FILEVERSION SM_FILE_VERSION
|
||||||
PRODUCTVERSION SVN_FILE_VERSION
|
PRODUCTVERSION SM_FILE_VERSION
|
||||||
FILEFLAGSMASK 0x17L
|
FILEFLAGSMASK 0x17L
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
@@ -47,12 +47,12 @@ BEGIN
|
|||||||
BEGIN
|
BEGIN
|
||||||
VALUE "Comments", "BinTools Extension"
|
VALUE "Comments", "BinTools Extension"
|
||||||
VALUE "FileDescription", "SourceMod BinTools Extension"
|
VALUE "FileDescription", "SourceMod BinTools Extension"
|
||||||
VALUE "FileVersion", SVN_FULL_VERSION
|
VALUE "FileVersion", SM_FULL_VERSION
|
||||||
VALUE "InternalName", "SourceMod BinTools Extension"
|
VALUE "InternalName", "SourceMod BinTools Extension"
|
||||||
VALUE "LegalCopyright", "Copyright (c) 2004-2008, AlliedModders LLC"
|
VALUE "LegalCopyright", "Copyright (c) 2004-2008, AlliedModders LLC"
|
||||||
VALUE "OriginalFilename", "bintools.ext.dll"
|
VALUE "OriginalFilename", BINARY_NAME
|
||||||
VALUE "ProductName", "SourceMod BinTools Extension"
|
VALUE "ProductName", "SourceMod BinTools Extension"
|
||||||
VALUE "ProductVersion", SVN_FULL_VERSION
|
VALUE "ProductVersion", SM_FULL_VERSION
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||||
|
import os
|
||||||
|
|
||||||
|
compiler = SM.DefaultExtCompiler('extensions/clientprefs')
|
||||||
|
compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
|
||||||
|
|
||||||
|
extension = AMBuild.AddJob('clientprefs.ext')
|
||||||
|
binary = Cpp.LibraryBuilder('clientprefs.ext', AMBuild, extension, compiler)
|
||||||
|
binary.AddSourceFiles('extensions/clientprefs', [
|
||||||
|
'extension.cpp',
|
||||||
|
'cookie.cpp',
|
||||||
|
'menus.cpp',
|
||||||
|
'natives.cpp',
|
||||||
|
'query.cpp',
|
||||||
|
'sdk/smsdk_ext.cpp'
|
||||||
|
])
|
||||||
|
SM.AutoVersion('extensions/clientprefs', binary)
|
||||||
|
binary.SendToJob()
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user