Compare commits
589
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9389a0f138 | ||
|
|
997687c3ab | ||
|
|
fe05b6c2d0 | ||
|
|
097ca03761 | ||
|
|
f182cd1d6a | ||
|
|
4d54bfa6b4 | ||
|
|
28d1dab18a | ||
|
|
f3d19a860a | ||
|
|
5732e34f50 | ||
|
|
ca94a61acf | ||
|
|
a875c61b5f | ||
|
|
5ec70c9e0d | ||
|
|
4b0373408d | ||
|
|
7f8c4eff39 | ||
|
|
00f152910b | ||
|
|
95fdeb03c3 | ||
|
|
66e9ef9cf6 | ||
|
|
6b3221f1da | ||
|
|
25ad7bcf5e | ||
|
|
9a04a6bdb1 | ||
|
|
1b9fb906e2 | ||
|
|
e23d7ca51b | ||
|
|
92773c2e1b | ||
|
|
776889cfbb | ||
|
|
67163e14e6 | ||
|
|
45f68840ed | ||
|
|
325ae5e977 | ||
|
|
14919c65d9 | ||
|
|
8888e88dc4 | ||
|
|
0533664f90 | ||
|
|
64b824f457 | ||
|
|
b6592d799f | ||
|
|
c89711a863 | ||
|
|
91a1292b12 | ||
|
|
b2d469cb84 | ||
|
|
4f41da34c6 | ||
|
|
f136f2dcaf | ||
|
|
e6df54537a | ||
|
|
e62278859e | ||
|
|
51b91bce6d | ||
|
|
d96a23d4f2 | ||
|
|
98e049b336 | ||
|
|
3c297f5d1d | ||
|
|
d64d196409 | ||
|
|
b1638e79c0 | ||
|
|
13753757d4 | ||
|
|
739e341218 | ||
|
|
fda282604d | ||
|
|
2cd7fa68d6 | ||
|
|
d78a0c87b8 | ||
|
|
88d4abeaf8 | ||
|
|
1c0abbfce6 | ||
|
|
1492e12ca2 | ||
|
|
2b9a39e2eb | ||
|
|
301ae447b4 | ||
|
|
3d47010cbd | ||
|
|
dd0ff999e4 | ||
|
|
05e5c93e91 | ||
|
|
1bd97730ce | ||
|
|
458378be66 | ||
|
|
c01101dbd0 | ||
|
|
f7364111f2 | ||
|
|
f3b84b8670 | ||
|
|
ec11a31d9d | ||
|
|
2271469d1b | ||
|
|
7fe92d87c2 | ||
|
|
6046b8fb79 | ||
|
|
a65239a8af | ||
|
|
746cd5f49c | ||
|
|
75c315ad8a | ||
|
|
c1926c6e25 | ||
|
|
3f8ba353b7 | ||
|
|
39a2152a46 | ||
|
|
ddd967534b | ||
|
|
4d52fe0490 | ||
|
|
264ffa80ce | ||
|
|
258a9c636a | ||
|
|
8015d1827c | ||
|
|
ae10bc6601 | ||
|
|
51c27afcd2 | ||
|
|
e09d4f2cf2 | ||
|
|
7e87f56699 | ||
|
|
ca9150a731 | ||
|
|
5250d819d0 | ||
|
|
d93413a4ae | ||
|
|
bb7f7eff51 | ||
|
|
838e8c7b35 | ||
|
|
bb48a16466 | ||
|
|
a02ff01d84 | ||
|
|
66d27d6ac5 | ||
|
|
5ba82ef0fc | ||
|
|
053b522aff | ||
|
|
4521f80e5a | ||
|
|
f24efc17c1 | ||
|
|
f32d3849e5 | ||
|
|
f2fb064ea6 | ||
|
|
ce5093f91f | ||
|
|
75121588c4 | ||
|
|
1ff0f478d4 | ||
|
|
6c68082359 | ||
|
|
a752d220cc | ||
|
|
ee1bbd5994 | ||
|
|
91368e5656 | ||
|
|
c4c554b420 | ||
|
|
52ec8bf049 | ||
|
|
5c40e02ee6 | ||
|
|
d2a89c5856 | ||
|
|
9ec3f1b89d | ||
|
|
3ab81c764d | ||
|
|
c072ce8f0c | ||
|
|
e44dbd0e77 | ||
|
|
ec12022550 | ||
|
|
e0f670499c | ||
|
|
177cc87985 | ||
|
|
3e387f35e9 | ||
|
|
7037723993 | ||
|
|
b1098d6287 | ||
|
|
be222a16ce | ||
|
|
17f9a3eba6 | ||
|
|
0ee77c0e7d | ||
|
|
b92fa45da7 | ||
|
|
e64c2fc110 | ||
|
|
49a6508888 | ||
|
|
859678536f | ||
|
|
9a5f788807 | ||
|
|
84b3b1d29c | ||
|
|
80eb18a425 | ||
|
|
3e1ab53abd | ||
|
|
18c119b4d5 | ||
|
|
e67a65c0db | ||
|
|
4c878c4963 | ||
|
|
e8fbe0f36c | ||
|
|
243b7e25f8 | ||
|
|
f1a4a08c7f | ||
|
|
c0fa36b9a1 | ||
|
|
835b2d7ced | ||
|
|
13c2381ba7 | ||
|
|
fbc8e899dd | ||
|
|
5ee8c8ce91 | ||
|
|
971793d6a1 | ||
|
|
9d7a905fb1 | ||
|
|
731f002175 | ||
|
|
7e6f3bfd83 | ||
|
|
3e14739b29 | ||
|
|
d7fb6b2892 | ||
|
|
7527f441ae | ||
|
|
5228ee1d91 | ||
|
|
297a98e065 | ||
|
|
727d8afd94 | ||
|
|
c292fba3df | ||
|
|
9954ff55f5 | ||
|
|
fefd84d431 | ||
|
|
b4a7d21b9e | ||
|
|
d03e051611 | ||
|
|
e8c141d775 | ||
|
|
5b45e29533 | ||
|
|
024d094459 | ||
|
|
df977577e2 | ||
|
|
b63b94bc81 | ||
|
|
7e514f5d34 | ||
|
|
cb2de2e5c4 | ||
|
|
f2fedbc3e6 | ||
|
|
8ef686fd21 | ||
|
|
4c96e9a17d | ||
|
|
939bc00b2b | ||
|
|
0b06d3412e | ||
|
|
94f6f60105 | ||
|
|
4bd6bc9683 | ||
|
|
3c59621425 | ||
|
|
a37e2ab26a | ||
|
|
d099febf7b | ||
|
|
b9f82332c8 | ||
|
|
c02c4c6d6a | ||
|
|
17476ec137 | ||
|
|
ee51a68c6f | ||
|
|
0120ce5d7c | ||
|
|
42c6e640fc | ||
|
|
bc571316b9 | ||
|
|
3cc1af9618 | ||
|
|
6957bf504b | ||
|
|
d47dd70141 | ||
|
|
86eb2360db | ||
|
|
c55e350cb2 | ||
|
|
b0fe032b8d | ||
|
|
aa25870fb8 | ||
|
|
a8118ea8f4 | ||
|
|
1a344c1441 | ||
|
|
86a1641ac1 | ||
|
|
10129fa568 | ||
|
|
935a8d36da | ||
|
|
2516a3af8a | ||
|
|
120a265fc3 | ||
|
|
33aebeb727 | ||
|
|
7e06cfb471 | ||
|
|
f2bcff69a9 | ||
|
|
39b7d175b9 | ||
|
|
b9cebe8d87 | ||
|
|
6814cfbcd7 | ||
|
|
2884696024 | ||
|
|
6930046bc6 | ||
|
|
174cbfe3b9 | ||
|
|
611c7633cf | ||
|
|
822d4269c4 | ||
|
|
8fd16efc33 | ||
|
|
ef082d855c | ||
|
|
a5c4739804 | ||
|
|
d1f1a88ffd | ||
|
|
c05f6b7bf3 | ||
|
|
4b5fa26cd6 | ||
|
|
0162d18343 | ||
|
|
b6415818f6 | ||
|
|
e16efbf58b | ||
|
|
46804d0faf | ||
|
|
a81567e2d6 | ||
|
|
217670b54a | ||
|
|
f2e19c0387 | ||
|
|
9799970042 | ||
|
|
ca75d0d765 | ||
|
|
0824e49000 | ||
|
|
c3a98db0ea | ||
|
|
f27685717b | ||
|
|
55034bfa6f | ||
|
|
6f8b420d0d | ||
|
|
2ed7e14a99 | ||
|
|
ee3bcef8ab | ||
|
|
adbcb97515 | ||
|
|
c667723958 | ||
|
|
d94634398e | ||
|
|
f348e58508 | ||
|
|
60f16970ac | ||
|
|
39c5eafafc | ||
|
|
b7f6c223d8 | ||
|
|
bf9a65338b | ||
|
|
5b3ae5eff9 | ||
|
|
f80a8d306b | ||
|
|
9ed9060940 | ||
|
|
5453e60099 | ||
|
|
3de61b69ad | ||
|
|
322a4ed05d | ||
|
|
8f3b4afcf7 | ||
|
|
ebdc6b94fc | ||
|
|
a7218d2e59 | ||
|
|
6d93beac8e | ||
|
|
1fb1309e77 | ||
|
|
5916f40b7a | ||
|
|
5226714bbd | ||
|
|
dabf486a9f | ||
|
|
c78f4407ea | ||
|
|
fae4127ddc | ||
|
|
9cc1497e9e | ||
|
|
cdd64d52eb | ||
|
|
4d319c12f8 | ||
|
|
8fc3e4ab12 | ||
|
|
ed7d68d6a7 | ||
|
|
59820519ce | ||
|
|
767c807a40 | ||
|
|
d25adc1b10 | ||
|
|
35f0067fe5 | ||
|
|
f1b01dd086 | ||
|
|
3df08d64e2 | ||
|
|
f56cc43331 | ||
|
|
b4b37daaf6 | ||
|
|
1f187d24c8 | ||
|
|
5b806a467b | ||
|
|
20d14d5a10 | ||
|
|
043b2df345 | ||
|
|
9ec7feb9ab | ||
|
|
57cf6db4e0 | ||
|
|
61b677c073 | ||
|
|
264e42a4c5 | ||
|
|
251fd660f9 | ||
|
|
6459f53263 | ||
|
|
55c8d93862 | ||
|
|
c6f83f8c14 | ||
|
|
c9eaca0e56 | ||
|
|
6267c17c6b | ||
|
|
616113d384 | ||
|
|
ac738aff10 | ||
|
|
7627bf80b9 | ||
|
|
172abb2710 | ||
|
|
a643c6ef1e | ||
|
|
64bfb0961e | ||
|
|
68d822f50a | ||
|
|
56e3bab02a | ||
|
|
9dd5ab4ebd | ||
|
|
b1ef86de75 | ||
|
|
b4a0d7a5b7 | ||
|
|
e6a93a799a | ||
|
|
4e175f9cd6 | ||
|
|
62e3fe1414 | ||
|
|
eeb7285528 | ||
|
|
0340b62b7c | ||
|
|
5488f60260 | ||
|
|
be7ef860d5 | ||
|
|
9aba700d8c | ||
|
|
7972acf5bf | ||
|
|
430c001d58 | ||
|
|
943777e5d0 | ||
|
|
c086c3b03b | ||
|
|
e517eceb24 | ||
|
|
7fb57a4064 | ||
|
|
888bca13c0 | ||
|
|
8b39e0631d | ||
|
|
d0d0148a58 | ||
|
|
a73b62c5bf | ||
|
|
bee0afd301 | ||
|
|
8f37940f4c | ||
|
|
0fa8d8cb51 | ||
|
|
1f589d0d5d | ||
|
|
ad36745a7c | ||
|
|
99b9860ea5 | ||
|
|
dc5f82cce2 | ||
|
|
dc3050537b | ||
|
|
5acd0dd2d1 | ||
|
|
0d933a1901 | ||
|
|
9f21865caf | ||
|
|
2ba81d3fef | ||
|
|
bcc1c2e658 | ||
|
|
5fa8972ae6 | ||
|
|
96363a0ce3 | ||
|
|
817fa9d9be | ||
|
|
89334bb459 | ||
|
|
0ae2d99599 | ||
|
|
e1199a02ee | ||
|
|
9408a61eb1 | ||
|
|
78d7e1bdfe | ||
|
|
dd44a0aaea | ||
|
|
b3144dd19a | ||
|
|
2722e96fac | ||
|
|
488de0014e | ||
|
|
9c2e0ebd4c | ||
|
|
28cc96cfd0 | ||
|
|
4ab3b15efd | ||
|
|
ff363e3893 | ||
|
|
cd2c10b6dc | ||
|
|
563e981902 | ||
|
|
c3e20d5d12 | ||
|
|
2802486671 | ||
|
|
1507d03c21 | ||
|
|
fbbf193345 | ||
|
|
78e51e6b11 | ||
|
|
be2bbec526 | ||
|
|
a366096ef4 | ||
|
|
c72222f718 | ||
|
|
fba0ec93bf | ||
|
|
86f767e1aa | ||
|
|
7e54192713 | ||
|
|
e76a73e276 | ||
|
|
ccf0490624 | ||
|
|
fe2721e04e | ||
|
|
fdd1a9afef | ||
|
|
abf7aed880 | ||
|
|
d986c7cdc0 | ||
|
|
9d5e994c01 | ||
|
|
6f16fc77b8 | ||
|
|
651dfb796c | ||
|
|
4f2fc17a8f | ||
|
|
7bc019547f | ||
|
|
f8c2629a3e | ||
|
|
b5b4bff2fc | ||
|
|
7054b92a14 | ||
|
|
5856f9a45f | ||
|
|
cec10060c6 | ||
|
|
74a479ab41 | ||
|
|
e51ab09bb1 | ||
|
|
0cd98bc353 | ||
|
|
158f9b0dc7 | ||
|
|
95fe6eaf86 | ||
|
|
40b4859b16 | ||
|
|
e4832f0d08 | ||
|
|
5d5400a9ac | ||
|
|
f439cad46c | ||
|
|
9fe2e8e31a | ||
|
|
92d3fc3d8c | ||
|
|
5d89599799 | ||
|
|
2eb5b5eb67 | ||
|
|
45549a8173 | ||
|
|
d7ebf2edc1 | ||
|
|
a9aed2e557 | ||
|
|
d691a0cf24 | ||
|
|
cbaa959521 | ||
|
|
2f128113b6 | ||
|
|
70251a8b2e | ||
|
|
e332f4e12b | ||
|
|
9a140ff93f | ||
|
|
97ab5dd1b5 | ||
|
|
075b4e92a9 | ||
|
|
f22dcfe03c | ||
|
|
124086419e | ||
|
|
0712db0d29 | ||
|
|
895f7edd12 | ||
|
|
a3c5c0c23a | ||
|
|
f7a3a6c17b | ||
|
|
98bec2580e | ||
|
|
5ca2d469a8 | ||
|
|
b413405876 | ||
|
|
330ff93e3e | ||
|
|
fe08104d18 | ||
|
|
e518605d69 | ||
|
|
9a35085ac3 | ||
|
|
b0cf41de08 | ||
|
|
00c3dc73f3 | ||
|
|
a73cc93d21 | ||
|
|
5a10299074 | ||
|
|
77d243f87f | ||
|
|
fb4f6406c9 | ||
|
|
3133b9b010 | ||
|
|
12723167fc | ||
|
|
2cc22778b5 | ||
|
|
790d3f12a6 | ||
|
|
beb1ab81e0 | ||
|
|
e5126b4c65 | ||
|
|
a2a4df5d06 | ||
|
|
ac0bd9714b | ||
|
|
60226d9195 | ||
|
|
64455b9852 | ||
|
|
96f6cdf677 | ||
|
|
c188491289 | ||
|
|
e9e4d566a5 | ||
|
|
85bedca236 | ||
|
|
d80191df3d | ||
|
|
9137e92c09 | ||
|
|
721dae3892 | ||
|
|
1cdacf69be | ||
|
|
b5b002aa4b | ||
|
|
78f5b513c0 | ||
|
|
0032fcaa66 | ||
|
|
0fba0923c8 | ||
|
|
e0169f6696 | ||
|
|
28217f10cb | ||
|
|
fb28f4bcd0 | ||
|
|
8852256ab6 | ||
|
|
95de453677 | ||
|
|
5ef40e15c4 | ||
|
|
31f223bff5 | ||
|
|
9fce2b1d8e | ||
|
|
a6ceb337b2 | ||
|
|
f4e22cb44c | ||
|
|
ab9750f8b2 | ||
|
|
fe8e0b0e0a | ||
|
|
c2565cf3b7 | ||
|
|
af82971bf5 | ||
|
|
271b52158e | ||
|
|
26c404adee | ||
|
|
f06af54165 | ||
|
|
2a77dfbcd2 | ||
|
|
738fcb6563 | ||
|
|
3d4754d4ad | ||
|
|
b9ea1d1be4 | ||
|
|
b1b0484dae | ||
|
|
20b79784bf | ||
|
|
4baa3358df | ||
|
|
8fe7f8b8d8 | ||
|
|
6996a0db2b | ||
|
|
b89a899c82 | ||
|
|
bbbbb660b3 | ||
|
|
6ba29219e5 | ||
|
|
dd97bdcc2c | ||
|
|
b63e0f08bf | ||
|
|
c5ae9d45ad | ||
|
|
e906a0da8c | ||
|
|
2edfb0aaac | ||
|
|
dc116858a9 | ||
|
|
1a938f8711 | ||
|
|
fc88cd3cb1 | ||
|
|
55205e631b | ||
|
|
a36fa76d21 | ||
|
|
b8d512f5e1 | ||
|
|
d4263b59c6 | ||
|
|
e5e1507dff | ||
|
|
2edf63c5fd | ||
|
|
5ec4b3441e | ||
|
|
dd1757b3c3 | ||
|
|
dda26545e5 | ||
|
|
410ef8ce96 | ||
|
|
ce7cb9cf64 | ||
|
|
31a16375ab | ||
|
|
ec7b47da22 | ||
|
|
0124020ba4 | ||
|
|
28f71d18bd | ||
|
|
fe226c1c8d | ||
|
|
18e20de4d6 | ||
|
|
956d345e17 | ||
|
|
ddfb958647 | ||
|
|
145d0ef37d | ||
|
|
019e3956f7 | ||
|
|
a72daff4ac | ||
|
|
58ce9cd37f | ||
|
|
687bdaff8f | ||
|
|
2143a66ad6 | ||
|
|
74892f1562 | ||
|
|
4a59ac011f | ||
|
|
e0fd2e8f27 | ||
|
|
ba76506773 | ||
|
|
d224827544 | ||
|
|
8d35b5bd11 | ||
|
|
9df28c25d7 | ||
|
|
5f9b2a91fd | ||
|
|
46a46f5e49 | ||
|
|
4bdc495d01 | ||
|
|
e60d5e6aeb | ||
|
|
7c3387755d | ||
|
|
6f04dad428 | ||
|
|
6ed4720df3 | ||
|
|
ac7b454039 | ||
|
|
0af39de346 | ||
|
|
d484979fe8 | ||
|
|
6e87e5c05f | ||
|
|
7633c8e76e | ||
|
|
c78e89c3c1 | ||
|
|
1852aaf332 | ||
|
|
8b4c8f63c0 | ||
|
|
d7b64c18c2 | ||
|
|
09668c972e | ||
|
|
68a0d10443 | ||
|
|
0708e7f8f6 | ||
|
|
1235e989d4 | ||
|
|
3a6808e4d8 | ||
|
|
dbfb034548 | ||
|
|
94d01e9e5a | ||
|
|
5e48b49b7e | ||
|
|
3b0785cae0 | ||
|
|
bd3b46d624 | ||
|
|
1cbe996831 | ||
|
|
18865c44c8 | ||
|
|
ead6ca73e5 | ||
|
|
deb3f6d9c4 | ||
|
|
b1b98c5256 | ||
|
|
4dc2227f23 | ||
|
|
a76f9e11fb | ||
|
|
abeb91a5e4 | ||
|
|
6d5e7cbe08 | ||
|
|
c468c26ad6 | ||
|
|
a0e940c5a9 | ||
|
|
2f1de22cae | ||
|
|
4631282709 | ||
|
|
306ac5243a | ||
|
|
956fe42a6c | ||
|
|
1824bdfe7e | ||
|
|
5f53284cbd | ||
|
|
7a84b71eb2 | ||
|
|
85382cd6c2 | ||
|
|
02a99f1e51 | ||
|
|
fe405df704 | ||
|
|
ac5ee90c9b | ||
|
|
fb6b34e155 | ||
|
|
caa8932c9a | ||
|
|
75611f3bca | ||
|
|
f0f14d8a22 | ||
|
|
98ad6cd23b | ||
|
|
bd80d1cd76 | ||
|
|
5a4670ec2f | ||
|
|
6fd039925a | ||
|
|
cd602ab5e3 | ||
|
|
f59ead54d3 | ||
|
|
4030f1e40d | ||
|
|
b7ac7452f7 | ||
|
|
5dd6867408 | ||
|
|
9d410df287 | ||
|
|
fe8dc36074 | ||
|
|
0cef3fbf27 | ||
|
|
b5d9b18da4 | ||
|
|
dc0ea197cd | ||
|
|
5bf17fc5ae | ||
|
|
33ca5943fa | ||
|
|
edc6591041 | ||
|
|
113ec33743 | ||
|
|
8c297832f6 | ||
|
|
e767b2ff94 | ||
|
|
a1ff408c13 | ||
|
|
440184e83c | ||
|
|
8ee6cad7ea | ||
|
|
edb17b76f0 | ||
|
|
31dc5f335d | ||
|
|
eb68e4c627 | ||
|
|
98e97920ae | ||
|
|
533723cd8b | ||
|
|
9e69afbbd6 | ||
|
|
2dea76dfa1 | ||
|
|
8a8bafb199 | ||
|
|
5a21d8c24d | ||
|
|
5111b4799c | ||
|
|
528bbe0116 | ||
|
|
3030ab8664 | ||
|
|
2698ff1a04 | ||
|
|
084dd1c8dd | ||
|
|
a8392889de | ||
|
|
3bf5edc2b3 | ||
|
|
97be0ff22a |
@@ -1,11 +1,15 @@
|
||||
# Binaries
|
||||
\.dll$
|
||||
\.dylib$
|
||||
\.exe$
|
||||
\.so$
|
||||
|
||||
# Files generated by Visual Studio
|
||||
\.aps$
|
||||
\.ipch$
|
||||
\.ncb$
|
||||
\.opensdf$
|
||||
\.sdf$
|
||||
\.suo$
|
||||
\.user$
|
||||
|
||||
@@ -13,3 +17,10 @@
|
||||
/CrazyDebug.*
|
||||
/Debug.*
|
||||
/Release.*
|
||||
|
||||
# Files generated by Mac OS X Finder
|
||||
(^|/)\.DS_Store$
|
||||
|
||||
# Files generated by Windows Explorer
|
||||
(^|/)[dD]esktop\.ini$
|
||||
(^|/)[tT]humbs\.db$
|
||||
|
||||
+142
-37
@@ -8,64 +8,102 @@ class SM:
|
||||
self.compiler = Cpp.Compiler()
|
||||
|
||||
#Build SDK info
|
||||
self.possibleSdks = { }
|
||||
self.possibleSdks['ep1'] = {'sdk': 'HL2SDK', 'ext': '1.ep1', 'def': '1',
|
||||
'name': 'EPISODEONE', 'platform': ['windows', 'linux']}
|
||||
self.possibleSdks['ep2'] = {'sdk': 'HL2SDKOB', 'ext': '2.ep2', 'def': '3',
|
||||
'name': 'ORANGEBOX', 'platform': ['windows', 'linux']}
|
||||
self.possibleSdks['ep2v'] = {'sdk': 'HL2SDKOBVALVE', 'ext': '2.ep2v', 'def': '6',
|
||||
'name': 'ORANGEBOXVALVE', 'platform': ['windows', 'linux', 'darwin']}
|
||||
self.possibleSdks['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '7',
|
||||
'name': 'LEFT4DEAD', 'platform': ['windows', 'linux', 'darwin']}
|
||||
self.possibleSdks['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '8',
|
||||
'name': 'LEFT4DEAD2', 'platform': ['windows', 'linux', 'darwin']}
|
||||
self.possibleSdks['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
|
||||
'name': 'DARKMESSIAH', 'platform': ['windows']}
|
||||
self.possibleSdks['swarm'] = {'sdk': 'HL2SDK-SWARM', 'ext': '2.swarm', 'def': '9',
|
||||
'name': 'ALIENSWARM', 'platform': ['windows']}
|
||||
self.possibleSdks['bgt'] = {'sdk': 'HL2SDK-BGT', 'ext': '2.bgt', 'def': '4',
|
||||
'name': 'BLOODYGOODTIME', 'platform': ['windows']}
|
||||
self.possibleSdks['eye'] = {'sdk': 'HL2SDK-EYE', 'ext': '2.eye', 'def': '5',
|
||||
'name': 'EYE', 'platform': ['windows']}
|
||||
|
||||
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',
|
||||
envvars = { 'MMSOURCE18': 'mmsource-1.8',
|
||||
'HL2SDKOBVALVE': 'hl2sdk-ob-valve',
|
||||
'HL2SDKL4D': 'hl2sdk-l4d',
|
||||
'HL2SDKL4D2': 'hl2sdk-l4d2',
|
||||
'MYSQL5': 'mysql-5.0'
|
||||
}
|
||||
|
||||
if AMBuild.target['platform'] != 'darwin':
|
||||
envvars['HL2SDK'] = 'hl2sdk'
|
||||
envvars['HL2SDKOB'] = 'hl2sdk-ob'
|
||||
|
||||
#Dark Messiah is Windows-only
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
envvars['HL2SDK-DARKM'] = 'hl2sdk-darkm'
|
||||
envvars['HL2SDK-SWARM'] = 'hl2sdk-swarm'
|
||||
envvars['HL2SDK-BGT'] = 'hl2sdk-bgt'
|
||||
envvars['HL2SDK-EYE'] = 'hl2sdk-eye'
|
||||
|
||||
# Finds if a dict with `key` set to `value` is present on the dict of dicts `dictionary`
|
||||
def findDictByKey(dictionary, key, value):
|
||||
for index in dictionary:
|
||||
elem = dictionary[index]
|
||||
if elem[key] == value:
|
||||
return (elem, index)
|
||||
return None
|
||||
|
||||
#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))
|
||||
elif i.startswith('HL2SDK'):
|
||||
(info, sdk) = findDictByKey(self.possibleSdks, 'sdk', i)
|
||||
self.sdkInfo[sdk] = info
|
||||
else:
|
||||
head = os.getcwd()
|
||||
while head != None and head != '/':
|
||||
oldhead = None
|
||||
while head != None and head != oldhead:
|
||||
path = os.path.join(head, envvars[i])
|
||||
if os.path.isdir(path):
|
||||
break
|
||||
oldhead = head
|
||||
head, tail = os.path.split(head)
|
||||
if head == None or head == '/':
|
||||
if i.startswith('HL2SDK'):
|
||||
(info, sdk) = findDictByKey(self.possibleSdks, 'sdk', i)
|
||||
self.sdkInfo[sdk] = info
|
||||
elif head == None or head == oldhead:
|
||||
raise Exception('Could not find a valid path for {0}'.format(i))
|
||||
AMBuild.cache.CacheVariable(i, path)
|
||||
|
||||
if len(self.sdkInfo) < 1:
|
||||
raise Exception('At least one SDK must be available.')
|
||||
|
||||
AMBuild.cache.CacheVariable('sdkInfo', self.sdkInfo)
|
||||
|
||||
#Set up defines
|
||||
cxx = self.compiler.cxx
|
||||
if isinstance(cxx, Cpp.GCC):
|
||||
self.vendor = 'gcc'
|
||||
if isinstance(cxx, Cpp.CompatGCC):
|
||||
if isinstance(cxx, Cpp.GCC):
|
||||
self.vendor = 'gcc'
|
||||
elif isinstance(cxx, Cpp.Clang):
|
||||
self.vendor = 'clang'
|
||||
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:
|
||||
if (self.vendor == 'gcc' and cxx.majorVersion >= 4) or self.vendor == 'clang':
|
||||
self.compiler.AddToListVar('CFLAGS', '-fvisibility=hidden')
|
||||
self.compiler.AddToListVar('CXXFLAGS', '-fvisibility-inlines-hidden')
|
||||
self.compiler.AddToListVar('CFLAGS', '-Wall')
|
||||
@@ -73,19 +111,23 @@ class SM:
|
||||
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('POSTLINKFLAGS', '-m32')
|
||||
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('CXXFLAGS', '-Wno-overloaded-virtual')
|
||||
self.compiler.AddToListVar('CDEFINES', 'HAVE_STDINT_H')
|
||||
self.compiler.AddToListVar('CDEFINES', 'GNUC')
|
||||
if self.vendor == 'gcc':
|
||||
self.compiler.AddToListVar('CFLAGS', '-mfpmath=sse')
|
||||
elif isinstance(cxx, Cpp.MSVC):
|
||||
self.vendor = 'msvc'
|
||||
if AMBuild.options.debug == '1':
|
||||
self.compiler.AddToListVar('CFLAGS', '/MTd')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '/NODEFAULTLIB:libcmt')
|
||||
else:
|
||||
self.compiler.AddToListVar('CFLAGS', '/MT')
|
||||
self.compiler.AddToListVar('CDEFINES', '_CRT_SECURE_NO_DEPRECATE')
|
||||
@@ -116,17 +158,18 @@ class SM:
|
||||
#Optimization
|
||||
if AMBuild.options.opt == '1':
|
||||
self.compiler.AddToListVar('CDEFINES', 'NDEBUG')
|
||||
if self.vendor == 'gcc':
|
||||
if self.vendor == 'gcc' or self.vendor == 'clang':
|
||||
self.compiler.AddToListVar('CFLAGS', '-O3')
|
||||
elif self.vendor == 'msvc':
|
||||
self.compiler.AddToListVar('CFLAGS', '/Ot')
|
||||
self.compiler.AddToListVar('CFLAGS', '/Ox')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '/OPT:ICF')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '/OPT:REF')
|
||||
|
||||
#Debugging
|
||||
if AMBuild.options.debug == '1':
|
||||
self.compiler.AddToListVar('CDEFINES', 'DEBUG')
|
||||
self.compiler.AddToListVar('CDEFINES', '_DEBUG')
|
||||
if self.vendor == 'gcc':
|
||||
if self.vendor == 'gcc' or self.vendor == 'clang':
|
||||
self.compiler.AddToListVar('CFLAGS', '-g3')
|
||||
elif self.vendor == 'msvc':
|
||||
self.compiler.AddToListVar('CFLAGS', '/Od')
|
||||
@@ -135,6 +178,29 @@ class SM:
|
||||
#Platform-specifics
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
self.compiler.AddToListVar('CDEFINES', '_LINUX')
|
||||
if self.vendor == 'gcc':
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '-static-libgcc')
|
||||
if self.vendor == 'clang':
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '-lgcc_eh')
|
||||
elif AMBuild.target['platform'] == 'darwin':
|
||||
self.compiler.AddToListVar('CFLAGS', ['-isysroot',
|
||||
'/Developer/SDKs/MacOSX10.5.sdk'])
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '-mmacosx-version-min=10.5')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', ['-arch', 'i386'])
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '-lstdc++')
|
||||
|
||||
# For OS X dylib versioning
|
||||
import re
|
||||
productFile = open(os.path.join(AMBuild.sourceFolder, 'product.version'), 'r')
|
||||
productContents = productFile.read()
|
||||
productFile.close()
|
||||
m = re.match('(\d+)\.(\d+)\.(\d+).*', productContents)
|
||||
if m == None:
|
||||
self.version = '1.0.0'
|
||||
else:
|
||||
major, minor, release = m.groups()
|
||||
self.version = '{0}.{1}.{2}'.format(major, minor, release)
|
||||
AMBuild.cache.CacheVariable('version', self.version)
|
||||
elif AMBuild.target['platform'] == 'windows':
|
||||
self.compiler.AddToListVar('CDEFINES', 'WIN32')
|
||||
self.compiler.AddToListVar('CDEFINES', '_WINDOWS')
|
||||
@@ -149,6 +215,7 @@ class SM:
|
||||
self.targetMap = { }
|
||||
AMBuild.cache.CacheVariable('targetMap', self.targetMap)
|
||||
else:
|
||||
self.sdkInfo = AMBuild.cache['sdkInfo']
|
||||
self.compiler.FromConfig(AMBuild, 'compiler')
|
||||
self.targetMap = AMBuild.cache['targetMap']
|
||||
|
||||
@@ -156,7 +223,7 @@ class SM:
|
||||
self.compiler.AddToListVar('RCINCLUDES', os.path.join(AMBuild.sourceFolder, 'public'))
|
||||
self.compiler.AddToListVar('RCINCLUDES',
|
||||
os.path.join(AMBuild.outputFolder, 'includes'))
|
||||
self.mmsPath = AMBuild.cache['MMSOURCE17']
|
||||
self.mmsPath = AMBuild.cache['MMSOURCE18']
|
||||
|
||||
def DefaultCompiler(self):
|
||||
return self.compiler.Clone()
|
||||
@@ -181,10 +248,14 @@ class SM:
|
||||
return compiler
|
||||
|
||||
def AutoVersion(self, folder, binary):
|
||||
if AMBuild.target['platform'] != 'windows':
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
env = {'RCDEFINES': ['BINARY_NAME="' + binary.binaryFile + '"', 'SM_GENERATED_BUILD']}
|
||||
binary.AddResourceFile(os.path.join(folder, 'version.rc' ), env)
|
||||
elif AMBuild.target['platform'] == 'darwin' and isinstance(binary, Cpp.LibraryBuilder):
|
||||
binary.compiler['POSTLINKFLAGS'].extend(['-compatibility_version', '1.0.0'])
|
||||
binary.compiler['POSTLINKFLAGS'].extend(['-current_version', AMBuild.cache['version']])
|
||||
else:
|
||||
return
|
||||
env = {'RCDEFINES': ['BINARY_NAME="' + binary.binaryFile + '"', 'SM_GENERATED_BUILD']}
|
||||
binary.AddResourceFile(os.path.join(folder, 'version.rc' ), env)
|
||||
|
||||
def PreSetupHL2Job(self, job, builder, sdk):
|
||||
info = self.sdkInfo[sdk]
|
||||
@@ -195,7 +266,26 @@ class SM:
|
||||
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']:
|
||||
if sdk in ['ep2v', 'l4d', 'l4d2']:
|
||||
for i in ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.so', 'libtier0.so']:
|
||||
link = os.path.join(workFolder, i)
|
||||
target = os.path.join(staticLibs, i)
|
||||
try:
|
||||
os.lstat(link)
|
||||
except:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
else:
|
||||
for i in ['tier1_i486.a', 'mathlib_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']:
|
||||
link = os.path.join(workFolder, i)
|
||||
target = os.path.join(staticLibs, i)
|
||||
try:
|
||||
os.lstat(link)
|
||||
except:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
elif AMBuild.target['platform'] == 'darwin':
|
||||
staticLibs = os.path.join(sdkPath, 'lib', 'mac')
|
||||
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
|
||||
for i in ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.dylib', 'libtier0.dylib']:
|
||||
link = os.path.join(workFolder, i)
|
||||
target = os.path.join(staticLibs, i)
|
||||
try:
|
||||
@@ -203,13 +293,16 @@ class SM:
|
||||
except:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
elif AMBuild.target['platform'] == 'windows':
|
||||
for lib in ['tier0', 'tier1', 'vstdlib', 'mathlib']:
|
||||
libs = ['tier0', 'tier1', 'vstdlib', 'mathlib']
|
||||
if sdk == 'swarm':
|
||||
libs.append('interfaces')
|
||||
for lib in libs:
|
||||
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':
|
||||
if AMBuild.target['platform'] in ['linux', 'darwin']:
|
||||
builder.AddObjectFiles(['tier1_i486.a', 'mathlib_i486.a'])
|
||||
|
||||
def DefaultHL2Compiler(self, path, sdk, noLink = False, oldMms = '-legacy'):
|
||||
@@ -222,9 +315,8 @@ class SM:
|
||||
compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms))
|
||||
compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms, 'sourcehook'))
|
||||
|
||||
info = self.sdkInfo
|
||||
info = self.possibleSdks
|
||||
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']]
|
||||
@@ -233,6 +325,7 @@ class SM:
|
||||
paths.append(['game_shared'])
|
||||
else:
|
||||
paths.append(['public', 'game', 'server'])
|
||||
paths.append(['public', 'toolframework'])
|
||||
paths.append(['game', 'shared'])
|
||||
paths.append(['common'])
|
||||
|
||||
@@ -241,12 +334,17 @@ class SM:
|
||||
|
||||
compiler['CDEFINES'].append('SOURCE_ENGINE=' + info['def'])
|
||||
|
||||
if sdk == 'swarm' and AMBuild.target['platform'] == 'windows':
|
||||
compiler['CDEFINES'].extend(['COMPILER_MSVC', 'COMPILER_MSVC32'])
|
||||
|
||||
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')
|
||||
elif AMBuild.target['platform'] == 'darwin':
|
||||
staticLibs = os.path.join(sdkPath, 'lib', 'mac')
|
||||
|
||||
for i in paths:
|
||||
compiler['CXXINCLUDES'].append(os.path.join(sdkPath, *i))
|
||||
@@ -254,8 +352,15 @@ class SM:
|
||||
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']
|
||||
if sdk in ['ep2v', 'l4d', 'l4d2']:
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libtier0.so']
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.so']
|
||||
else:
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['tier0_i486.so']
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['vstdlib_i486.so']
|
||||
elif AMBuild.target['platform'] == 'darwin':
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libtier0.dylib']
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.dylib']
|
||||
|
||||
return compiler
|
||||
|
||||
|
||||
@@ -3,4 +3,3 @@ CONFIGURE YOUR IDENTITY FOR MERCURIAL!
|
||||
IF YOU ARE A DEVELOPER WITH PUSH ACCESS, DO IT NOW KPLZTHX.
|
||||
|
||||
http://wiki.alliedmods.net/Mercurial_Tutorial#Identity
|
||||
|
||||
|
||||
+395
@@ -1,5 +1,400 @@
|
||||
SourceMod Changelog
|
||||
|
||||
-----------------------------
|
||||
|
||||
SourceMod 1.4.0 [2011-10-28]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.4.0_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Added support for Max OS X (bug 4392).
|
||||
- Added support for Bloody Good Time (bug 4780).
|
||||
- Added support for E.Y.E Divine Cybermancy (bug 5035).
|
||||
- Added gamedata for Nuclear Dawn.
|
||||
- Added gamedata for International Online Soccer: Source (bug 5019).
|
||||
- Added gamedata for Half-Life 2 Capture the Flag (bug 5114).
|
||||
- Updated mapchooser and other base plugins with Nuclear Dawn specific fixes (bug 5117).
|
||||
- Fixed ServerLang value not being read properly on startup (bug 4675).
|
||||
- Added support for aliases in languages.cfg (bug 4858).
|
||||
- Added output display to sm_rcon command (bug 5018).
|
||||
- Flood protection bypass access can now be overridden with command name sm_flood_access (bug 4584).
|
||||
- Added a reset argument to sm cvars command to revset cvar values to default (bug 5043).
|
||||
- Fixed incorrect language identifiers for Chinese (both Trad. and Simplified) and Brazilian Portuguese not matching cl_language values (bug 5067).
|
||||
- Added translation support for Bulgarian (bg).
|
||||
- Fixed incorrect number of slots being hidden for reserve with sm_hideslots on Source 2009 with SourceTV or replay (bug 5094).
|
||||
- sm_hideslots changes now take effect immediately instead of waiting until a client joins or leaves (bug 5094).
|
||||
- Fixed sv_visiblemaxplayers getting stuck at previous max clients in some cases with reserves and SourceTV or replay (bug 5094).
|
||||
- Removed error logging if an optional extension is not found (bug 5112).
|
||||
- Fixed bots with semicolon in name being unkickable (bug 5120).
|
||||
- Changed strings in ice-related funcommands to be translatable (bug 4540).
|
||||
- Changed Bintools extension to use a single build for every engine (bug 4548).
|
||||
|
||||
Developer Changes:
|
||||
- Provided native interface for basecomm (bug 2594).
|
||||
- Client language detection is too late. (bug 3714) (Tony A. "GoD-Tony").
|
||||
- Added ServerCommandEx native to execute server command and retrieve output (bug 3873).
|
||||
- Added ability to update clientprefs cookies values on clients not currently connected (bug 3882) (databomb).
|
||||
- Added library "matchmaking_ds" support to gamedata lookups (bug 4158).
|
||||
- Rooted menu handles to callbacks (bug 4353).
|
||||
- Fixed corner cases with ExplodeString (bug 4629). (Michael "LumiStance").
|
||||
- Fixed return omission with else-after-return (bug 4852).
|
||||
- Added OnConditionAdded and OnConditionRemoved forwards to TF2 extension (bug 4851).
|
||||
- Added new natives and forward to the cstrike extension (bug 4732, bug 4985) (Dr!fter).
|
||||
- Added WaitingForPlayers forwards to the TF2 extension (bug 4704) (CrimsonGT).
|
||||
- Updated and added more TF2 condition, weapon, and damagecustom defines (multiple bug#s).
|
||||
- Fixed TF2_RemoveCondition not always removing conditions (bug 4981).
|
||||
- Fixed MaxClients not being updated correctly in some places with SourceTV or replay active (bug 4986).
|
||||
- Fixed some vars not being marked for init on first compile pass (bug 4643).
|
||||
- Increased symbol name limit to 63 characters (bug 4564) (javalia).
|
||||
- Fixed crash when dynamic arrays run out of memory (bug 4632).
|
||||
- Fixed a crash that could happen from looking up out-of-bounds edict or entity indexes (bug 5080).
|
||||
- Fixed client serials not getting cleared on disconnect (bug 5121).
|
||||
- Added error on declaring arrays that the compiler is too buggy to handle (bug 4977).
|
||||
- Removed reliance on gamedata for multiple SDKTools functions in ep2 and later (bug 4899).
|
||||
- Added InvalidateClient and ReconnectClient natives to SDKTools (bug 4931) (Brian "Afronanny" Simon).
|
||||
- Added ability to lookup and set values on the gamerules class (bug 4983.
|
||||
- BaseComm now uses AddCommandListener for chat hooks (bug 4991).
|
||||
- Fixed shutdown bug in SDKTools (bug 5063).
|
||||
- Fixed MM-enabled extensions continuing to load after failing MM attach (bug 5042).
|
||||
- Added GetDistGainFromSoundLevel native to SDKTools (bug 5066) (javalia).
|
||||
- Added CheckAccess native to check an AdminId's command access (bug 5083).
|
||||
- Fixed GetEntProp not sign-extending unsigned values less than 32 bits (bug 5105).
|
||||
- Fixed crashing when calling CreateEntityByName or CreateFakeClient when no map is running (now errors) (bug 5119).
|
||||
- Fixed erring in kick function (e. bad translation) causing client to become unkickable until disconnect (bug 5120).
|
||||
- Fixed KickClientEx not immediately kicking client if client was in kick queue (bug 5120).
|
||||
- Added IsClientSourceTV and IsClientReplay natives (bug 5124).
|
||||
- Added support for getting and setting individual array elements with Get/Set EntProp functions (bug 4160).
|
||||
- Added support for threaded query handles to SQL_GetInsertId and SQL_GetAffectedRows (bug 4699) (Nephyrin).
|
||||
- Added a GetGameRules function to ISDKTools for extensions to easily get the GameRules class pointer (bug 4707).
|
||||
- Added GetMessageName to IUserMessages (bug 4573) (Zach "theY4Kman" Kanzler)
|
||||
- Added HintTextMsg to IGameHelpers (bug 4950).
|
||||
- Added ProcessTargetString simple filter API (bug 4404).
|
||||
- Moved much functionality from core bins to logic bin (bug 4406, bug 4402).
|
||||
- Fixed bogus asserts in sp compiler (bug 4486, bug 4487).
|
||||
- Greatly improved sp compiler performance (~5x overall speedup) (bug 3820, bug 4493, bug 4495).
|
||||
- Changed entity output detours to use CDetour (bug 4416).
|
||||
- Enhanced nominations API (bug 4677) (CrimsonGT).
|
||||
- Added Linux support for profiling natives (bug 4927).
|
||||
- Added a new ValveCallType that allows for arbitrary |this| parameters, as well as associated features in gamedata and for reading/writing memory (bug 3520) (Downtown1).
|
||||
- Updated TF2 extension to handle Valve's changes to the "holiday" system (bug 5150).
|
||||
|
||||
-----------------------------
|
||||
|
||||
SourceMod 1.3.8 [2011-06-23]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.8_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Updated support for latest OrangeBox engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
|
||||
- Updated support for various games, including Garry's Mod, Zombie Panic, and Dino D-Day.
|
||||
- Added gamedata for Eternal Silence.
|
||||
- Fixed libgcc_s.so.1 load error present on some systems (bug 4876).
|
||||
- Handle leak notices now print to error log (in addition fatal log) (bug 4929).
|
||||
- Translator now properly falls back on bad server language (bug 4861).
|
||||
- Fixed invalid client errors from bad MaxClients value when SourceTV is late-loaded (bug 4881).
|
||||
- Fixed crash on plugin unload when two commands exist with same name, different casing (bug 4698).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Updated TF2 condition defines (bug 4916).
|
||||
- Fixed var names and docs for TF2_MakeBleed native (bug 4928).
|
||||
- Removed compiler double include check (bug 4863).
|
||||
- Fixed plugin compile errors when using GetEntityClassname (bug 4798).
|
||||
|
||||
---------------------------
|
||||
|
||||
SourceMod 1.3.7 [2011-04-15]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.7_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Updated support for latest OrangeBox engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
|
||||
- Updated support for various games, including Zombie Panic, CS ProMod, Empires, and GoldenEye: Source.
|
||||
- Added gamedata for Dino D-Day.
|
||||
- Fix precedence of voice mute flag versus specific client overrides (bug 4826).
|
||||
- Fix mistaken unhooking of voice hooks (bug 4804).
|
||||
- Fixed graphical glitches with funcommands effects in L4D1 (bug 3486).
|
||||
- Fixed bug in nominations that could cause "Unknown command" error (bug 4797).
|
||||
- Removed tv_enable hook to fix rare max client count issue (bug 4791).
|
||||
- Added missing unhooking of ClientConnect in PlayerManager (bug 4749).
|
||||
- Fixed sm_rtv printing "unknown command" (bug 4730).
|
||||
- Fixed voting crash when client console, chat, and SourceTV are enabled (bug 4676).
|
||||
- Fixed CDetour crash in TF2 extension when last plugin using forward is unloaded (bug 4713).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- SetEntProp now marks edict state as changed (bug 4855).
|
||||
- Added GetEntityClassname stock (bug 4798).
|
||||
- Fix compiler hanging when #including a directory (bug 4822).
|
||||
- Added GetEntityFlags and SetEntityFlags natives for better cross-engine compatibility. (bug 4809).
|
||||
- Fixed ClientPrefs natives not being marked optional when REQUIRE_EXTENSIONS not defined (bug 4839).
|
||||
- Changed some instances of LogMessage to LogAction (bug 4649).
|
||||
- Added some new language natives (bug 4613).
|
||||
- Fixed SetTeamScore not updating score on client (bug 2736).
|
||||
- Raised MAXPLAYERS from 64 to 65 (bug 4490).
|
||||
- Added and updated many TF2-specific defines in tf2.inc and tf2_stocks.inc.
|
||||
- Fixed TF2_GetPlayerConditionFlags no longer necessarily returning all set flags (bug 4726).
|
||||
- Fixed profiler flush not clearing, added 'report' and 'clear' (bug 4674).
|
||||
- Fixed GetPlayerDecalFile crash on L4D and L4D2 (bug 4729).
|
||||
- Fixed TF2_OnGetHoliday detour no longer firing under all circumstances (bug 4700).
|
||||
- Added TF2_IsPlayerInDuel native to TF2 extension (bug 4695).
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.3.6 [2010-10-31]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.6_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Updated support for latest Left 4 Dead 1 (bug 4681).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Updated TF2 custom kill defines (bug 4682).
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.3.5 [2010-10-17]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.5_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Updated support for CS:S, Garry's Mod, DoD:S, TF2, HL2DM.
|
||||
- Added support for Firearms: Source (bug 4537).
|
||||
- Added support for Fistful of Frags (bug 3883).
|
||||
- Added support for Alien Swarm (bug 4530).
|
||||
- Fixed living players hearing dead players if alltalk is disabled while deadtalk is on (bug 4533, thanks Zach Callear).
|
||||
- Fixed timeleft not getting reset on Game_Commencing in CS:S (bug 4557).
|
||||
- Fixed PlayerRunCmd being hooked when not used (bug 3990).
|
||||
- Fixed errors and missing effects caused by missing sprites on L4D2 (bug 4512).
|
||||
- Fixed 'sm plugins' public command skipping plugins in recommended listing (bug 4501).
|
||||
- Fixed corruption with large database.cfg files (bug 4286).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Added TF2 object stocks (bug 4536).
|
||||
- Added TF2_MakeBleed native to TF2 ext (bug 4542).
|
||||
- Added support for logical entities in Synergy (bug 4534).
|
||||
- Updated TF2 conditions enum and defines (bug 4526).
|
||||
- Fixed potential crash with IMemUtils::FindPattern on Linux (bug 4554).
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.3.4 [2010-07-18]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.4_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Support for latest TF update (bug 4506).
|
||||
- Support for latest L4D2 update (bug 4509).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Added FindFlagChar native (bug 3776).
|
||||
- Added GetConVarDefault native (bug 4502).
|
||||
- Added forward for TF's GetHoliday function (bug 4462).
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.3.3 [2010-06-23]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.3_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Added support for CS:S on Orange Box
|
||||
- Added gamedata for Resistance and Liberation (bug 4418).
|
||||
- Updated gamedata for SourceForts, Empires, Obsidian Conflict, Zombie Master.
|
||||
- Fixed memory corruption and leaks with some voice functionality (bug 4415).
|
||||
- Fixed UI bug in sm_motd (bug 4460).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Added new player condition (TFCond_CritCola, bug 4447).
|
||||
- Fixed clientprefs deleting cookies twice in rare cases (bug 4412).
|
||||
- Fixed OnClientConnected forward not firing for bots (bug 4443).
|
||||
- Fixed sm_dump_datamaps crash (bug 4424).
|
||||
- Fixed switch case comparisons failing with large numbers (bug 4457).
|
||||
- Fixed rare crash in output hooks (bug 4422).
|
||||
- Fixed bug with dynamically sized arrays being sliced (bug 4428).
|
||||
- Fixed SendConVarValue() on TF2, DOD:S, L4D, and L4D2 (bug 4273).
|
||||
- Fixed TF2 natives not being marked optional (bug 4389).
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.3.2 [2010-05-02]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.2_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Support for recent TF, DoD, and L4D2 updates (bug 4356, bug 4361, bug 4371, bug 4374, bug 4375).
|
||||
- Fixed rare crash when replicating cvars to clients (bug 4315).
|
||||
- Lots of extra game support for Insurgency, ZPS, CSProMod, PVKII, and FortressForever (thanks
|
||||
Nicholas "psychonic" hastings).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Added TF functions for stunning, conditions, regeneration, and power play (bug 4166, bug 4331).
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.3.1 [2010-02-09]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.1_Release_Notes
|
||||
|
||||
User Changes:
|
||||
|
||||
- Added extended support for CSProMod (bug 4255).
|
||||
- Fixed client disconnect crash on many third party games (bug 4231).
|
||||
- Improved support for Battlegrounds 2 (bug 4146).
|
||||
- Improved support for Insurgency (bug 4180).
|
||||
- Improved support for Garry's Mod (bug 4230, bug 4268).
|
||||
- Improved support for Synergy (bug 4235).
|
||||
- Updated Day of Defeat support for 20010123 update (bug 4262).
|
||||
- Fixed Webternet extension not loading on Windows 2000 (bug 4234).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Fixed compiler complaints when using |any| tag on array arguments (bug 4274).
|
||||
- Fixed GetClientCookieTime not being exported (bug 4237).
|
||||
- Fixed potential crash in entity handling code (bug 4249).
|
||||
|
||||
----------------------------
|
||||
|
||||
SourceMod 1.3.0 [2010-01-15]
|
||||
|
||||
URL: http://wiki.alliedmods.net/SourceMod_1.3.0_Release_Notes
|
||||
|
||||
Major Features:
|
||||
* Left 4 Dead 2 support
|
||||
* Non-networked entity support
|
||||
|
||||
User Changes:
|
||||
|
||||
- Added Left 4 Dead 2 support (bug 4075).
|
||||
- Added much richer voting progress feedback (bug 1997).
|
||||
- Improved support for various third-party games (Nicholas "psychonic" Hastings).
|
||||
- Added @spec target (bug 2718).
|
||||
- Added sm_resetcvar command (bug 3636).
|
||||
- Added "motd" chat trigger (bug 2694).
|
||||
- Updated GeoIP to OCT-2009.
|
||||
- Fixed rare map vote error (bug 3905).
|
||||
- Fixed small leak in the nominations plugin (bug 4104).
|
||||
- Fixed last client being excluded from some command effects (bug 3984).
|
||||
- Fixed crashes in plugin [|un|re]loading (bug 4034, bug 4038, bug 4044, bug 4153).
|
||||
- Special target "@me" is now filtered for certain statuses properly (bug 4000).
|
||||
- Improved non-admin to admin chat (bug 3844).
|
||||
- Removed "auto.*" extension folders (bug 3949).
|
||||
|
||||
Developer Changes:
|
||||
|
||||
- Added non-networked entity support (bug 2459).
|
||||
- Added improved random number generator (bug 3831).
|
||||
- Added GetClientCookieTime native (bug 3736).
|
||||
- Added AskPluginLoad2 callback (bug 3716).
|
||||
- Added PlayerRunCmd callback (bug 3289).
|
||||
- Added PointOutsideWorld native (bug 3906).
|
||||
- Added API for "blanket" command hooks (bug 4015).
|
||||
- Added ability to test for SourceMod features (bug 4021).
|
||||
- Added ability to change broadcast status on hooked events (bug 3886).
|
||||
- OnClientCommand no longer receives unconnected clients (bug 3732).
|
||||
- Fixed various bugs in client listening API (bug 3818).
|
||||
- Fixed crash in BanClient (bug 3912).
|
||||
- Fixed various crashes in self-removing callbacks (bug 4059).
|
||||
- Fixed rare HUD text crash on TF (bug 4016).
|
||||
- Fixed OnConfigsExecuted not running on EP1 games with large configs (bug 3828).
|
||||
- Fixed entity output hooks not working (bug 3988).
|
||||
- Gamedata folder matches are now case-insensitive (bug 3913).
|
||||
- Blocked plugins from hooking "sm" command (bug 4013).
|
||||
|
||||
----------------------------
|
||||
|
||||
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]
|
||||
|
||||
@@ -80,21 +80,21 @@ sm_reserve_type 0
|
||||
sm_reserved_slots 0
|
||||
|
||||
// Specifies whether or not reserved slots will be hidden (subtracted from max
|
||||
// slot count). Valid values are 0 (visible) or 1 (hidden).
|
||||
// slot count). Valid values are 0 (Visible) or 1 (Hidden).
|
||||
// --
|
||||
// Requires: reservedslots.smx
|
||||
// Default: 0
|
||||
sm_hide_slots 0
|
||||
|
||||
// Specifies whether or not non-admins can send messages to admins using
|
||||
// say_team @<message>. Valid values are 0 (disabled) or 1 (enabled)
|
||||
// say_team @<message>. Valid values are 0 (Disabled) or 1 (Enabled)
|
||||
// --
|
||||
// Requires: basechat.smx
|
||||
// Default: 1
|
||||
sm_chat_mode 1
|
||||
|
||||
// Specifies whether or not "timeleft" will automaticly be triggered every
|
||||
// x seconds. Valid values are 0 (disabled) to 1800 seconds.
|
||||
// x seconds. Valid values are 0 (Disabled) to 1800 seconds.
|
||||
// --
|
||||
// Requires: basetriggers.smx
|
||||
// Default: 0
|
||||
@@ -107,3 +107,28 @@ sm_timeleft_interval 0
|
||||
// Requires: basetriggers.smx
|
||||
// Default: 1
|
||||
sm_trigger_show 1
|
||||
|
||||
// Specifies whether or not to display vote progress to clients in the
|
||||
// "hint" box (near the bottom of the screen in most games).
|
||||
// Valid values are 0 (Disabled) or 1 (Enabled).
|
||||
// --
|
||||
// Default: 0
|
||||
sm_vote_progress_hintbox 0
|
||||
|
||||
// Specifies whether or not to display vote progress to clients in the
|
||||
// chat area. Valid values are 0 (Disabled) or 1 (Enabled).
|
||||
// --
|
||||
// Default: 0
|
||||
sm_vote_progress_chat 0
|
||||
|
||||
// Specifies whether or not to display vote progress in the server console.
|
||||
// Valid values are 0 (Disabled) or 1 (Enabled).
|
||||
// --
|
||||
// Default: 0
|
||||
sm_vote_progress_console 0
|
||||
|
||||
// Specifies whether or not to display vote progress to clients in the
|
||||
// client console. Valid values are 0 (Disabled) or 1 (Enabled).
|
||||
// --
|
||||
// Default: 0
|
||||
sm_vote_progress_client_console 0
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
{
|
||||
"driver_default" "mysql"
|
||||
|
||||
// When specifying "host", you may use an IP address, a hostname, or a socket file path
|
||||
|
||||
"default"
|
||||
{
|
||||
"driver" "default"
|
||||
|
||||
+3
-15
@@ -3,6 +3,9 @@ import os
|
||||
|
||||
for i in SM.sdkInfo:
|
||||
sdk = SM.sdkInfo[i]
|
||||
if AMBuild.target['platform'] not in sdk['platform']:
|
||||
continue
|
||||
|
||||
name = 'sourcemod.' + sdk['ext']
|
||||
|
||||
compiler = SM.DefaultHL2Compiler('core', i)
|
||||
@@ -14,26 +17,22 @@ for i in SM.sdkInfo:
|
||||
'AdminCache.cpp',
|
||||
'ExtensionSys.cpp',
|
||||
'MenuStyle_Valve.cpp',
|
||||
'sm_crc32.cpp',
|
||||
'logic_bridge.cpp',
|
||||
'smn_entities.cpp',
|
||||
'sm_stringutil.cpp',
|
||||
'ADTFactory.cpp',
|
||||
'ForwardSys.cpp',
|
||||
'MenuVoting.cpp',
|
||||
'sm_memtable.cpp',
|
||||
'smn_events.cpp',
|
||||
'smn_menus.cpp',
|
||||
'sm_trie.cpp',
|
||||
'CDataPack.cpp',
|
||||
'frame_hooks.cpp',
|
||||
'NativeInvoker.cpp',
|
||||
'smn_admin.cpp',
|
||||
'smn_fakenatives.cpp',
|
||||
'smn_nextmap.cpp',
|
||||
'sourcemm_api.cpp',
|
||||
'ChatTriggers.cpp',
|
||||
'GameConfigs.cpp',
|
||||
'NativeOwner.cpp',
|
||||
'smn_filesystem.cpp',
|
||||
'smn_player.cpp',
|
||||
@@ -41,28 +40,19 @@ for i in SM.sdkInfo:
|
||||
'concmd_cleaner.cpp',
|
||||
'HalfLife2.cpp',
|
||||
'NextMap.cpp',
|
||||
'smn_profiler.cpp',
|
||||
'ConCmdManager.cpp',
|
||||
'HandleSys.cpp',
|
||||
'PhraseCollection.cpp',
|
||||
'ConVarManager.cpp',
|
||||
'LibrarySys.cpp',
|
||||
'PlayerManager.cpp',
|
||||
'smn_banning.cpp',
|
||||
'smn_gameconfigs.cpp',
|
||||
'smn_string.cpp',
|
||||
'TimerSys.cpp',
|
||||
'CoreConfig.cpp',
|
||||
'Logger.cpp',
|
||||
'PluginInfoDatabase.cpp',
|
||||
'smn_bitbuffer.cpp',
|
||||
'smn_halflife.cpp',
|
||||
'Translator.cpp',
|
||||
'MemoryUtils.cpp',
|
||||
'PluginSys.cpp',
|
||||
'smn_console.cpp',
|
||||
'smn_handles.cpp',
|
||||
'smn_timers.cpp',
|
||||
'UserMessages.cpp',
|
||||
'Database.cpp',
|
||||
'MenuManager.cpp',
|
||||
@@ -78,8 +68,6 @@ for i in SM.sdkInfo:
|
||||
'EventManager.cpp',
|
||||
'MenuStyle_Radio.cpp',
|
||||
'sm_autonatives.cpp',
|
||||
'smn_datapacks.cpp',
|
||||
'smn_lang.cpp',
|
||||
'sm_srvcmds.cpp',
|
||||
'ConsoleDetours.cpp'
|
||||
]
|
||||
|
||||
+2
-2
@@ -1719,7 +1719,7 @@ bool AdminCache::CanAdminUseCommand(int client, const char *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
return g_ConCmds.CheckCommandAccess(client, cmd, bits);
|
||||
return g_ConCmds.CheckClientCommandAccess(client, cmd, bits);
|
||||
}
|
||||
|
||||
unsigned int AdminCache::SetGroupImmunityLevel(GroupId gid, unsigned int level)
|
||||
@@ -1794,7 +1794,7 @@ bool AdminCache::CheckAccess(int client, const char *cmd, FlagBits flags, bool o
|
||||
GetCommandOverride(cmd, Override_Command, &bits);
|
||||
}
|
||||
|
||||
return g_ConCmds.CheckCommandAccess(client, cmd, bits) ? 1 : 0;
|
||||
return g_ConCmds.CheckClientCommandAccess(client, cmd, bits) ? 1 : 0;
|
||||
}
|
||||
|
||||
void iterator_glob_basic_override(Trie *pTrie, const char *key, void **value, void *data)
|
||||
|
||||
+3
-12
@@ -34,8 +34,8 @@
|
||||
#include "sm_stringutil.h"
|
||||
#include "ConCmdManager.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "Translator.h"
|
||||
#include "HalfLife2.h"
|
||||
#include "logic_bridge.h"
|
||||
|
||||
/* :HACKHACK: We can't SH_DECL here because ConCmdManager.cpp does.
|
||||
* While the OB build only runs on MM:S 1.6.0+ (SH 5+), the older one
|
||||
@@ -113,7 +113,7 @@ void ChatTriggers::OnSourceModAllInitialized()
|
||||
|
||||
void ChatTriggers::OnSourceModAllInitialized_Post()
|
||||
{
|
||||
g_pCorePhrases->AddPhraseFile("antiflood.phrases");
|
||||
logicore.AddCorePhraseFile("antiflood.phrases");
|
||||
}
|
||||
|
||||
void ChatTriggers::OnSourceModGameInitialized()
|
||||
@@ -189,17 +189,8 @@ void ChatTriggers::OnSayCommand_Pre()
|
||||
{
|
||||
char buffer[128];
|
||||
|
||||
if (!CoreTranslate(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"%T",
|
||||
2,
|
||||
NULL,
|
||||
"Flooding the server",
|
||||
&client))
|
||||
{
|
||||
if (!logicore.CoreTranslate(buffer, sizeof(buffer), "%T", 2, NULL, "Flooding the server", &client))
|
||||
UTIL_Format(buffer, sizeof(buffer), "You are flooding the server!");
|
||||
}
|
||||
|
||||
/* :TODO: we should probably kick people who spam too much. */
|
||||
|
||||
|
||||
+45
-44
@@ -34,9 +34,9 @@
|
||||
#include "AdminCache.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "Translator.h"
|
||||
#include "HalfLife2.h"
|
||||
#include "ChatTriggers.h"
|
||||
#include "logic_bridge.h"
|
||||
|
||||
ConCmdManager g_ConCmds;
|
||||
|
||||
@@ -226,30 +226,38 @@ void ConCmdManager::SetCommandClient(int client)
|
||||
m_CmdClient = client + 1;
|
||||
}
|
||||
|
||||
ConCmdInfo *ConCmdManager::FindInTrie(const char *name)
|
||||
{
|
||||
ConCmdInfo *pInfo;
|
||||
if (!sm_trie_retrieve(m_pCmds, name, (void **)&pInfo))
|
||||
return NULL;
|
||||
return pInfo;
|
||||
}
|
||||
|
||||
ConCmdList::iterator ConCmdManager::FindInList(const char *cmd)
|
||||
{
|
||||
List<ConCmdInfo *>::iterator iter = m_CmdList.begin();
|
||||
|
||||
while (iter != m_CmdList.end())
|
||||
{
|
||||
if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
|
||||
break;
|
||||
iter++;
|
||||
}
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
||||
ResultType ConCmdManager::DispatchClientCommand(int client, const char *cmd, int args, ResultType type)
|
||||
{
|
||||
ConCmdInfo *pInfo;
|
||||
|
||||
if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
|
||||
if ((pInfo = FindInTrie(cmd)) == NULL)
|
||||
{
|
||||
List<ConCmdInfo *>::iterator iter;
|
||||
|
||||
pInfo = NULL;
|
||||
iter = m_CmdList.begin();
|
||||
while (iter != m_CmdList.end())
|
||||
{
|
||||
if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
|
||||
{
|
||||
pInfo = (*iter);
|
||||
break;
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
ConCmdList::iterator item = FindInList(cmd);
|
||||
if (item == m_CmdList.end())
|
||||
return type;
|
||||
}
|
||||
pInfo = *item;
|
||||
}
|
||||
|
||||
cell_t result = type;
|
||||
@@ -314,35 +322,20 @@ void ConCmdManager::InternalDispatch(const CCommand &command)
|
||||
*/
|
||||
const char *cmd = g_HL2.CurrentCommandName();
|
||||
|
||||
ConCmdInfo *pInfo;
|
||||
if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
|
||||
ConCmdInfo *pInfo = FindInTrie(cmd);
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
/* Unfortunately, we now have to do a slow lookup because Valve made client commands
|
||||
* case-insensitive. We can't even use our sortedness.
|
||||
*/
|
||||
if (client == 0 && !engine->IsDedicatedServer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<ConCmdInfo *>::iterator iter;
|
||||
ConCmdList::iterator item = FindInList(cmd);
|
||||
if (item == m_CmdList.end())
|
||||
return;
|
||||
|
||||
pInfo = NULL;
|
||||
iter = m_CmdList.begin();
|
||||
while (iter != m_CmdList.end())
|
||||
{
|
||||
if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
|
||||
{
|
||||
pInfo = (*iter);
|
||||
break;
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pInfo = *item;
|
||||
}
|
||||
|
||||
/* This is a hack to prevent say triggers from firing on messages that were
|
||||
@@ -457,7 +450,7 @@ void ConCmdManager::InternalDispatch(const CCommand &command)
|
||||
}
|
||||
}
|
||||
|
||||
bool ConCmdManager::CheckCommandAccess(int client, const char *cmd, FlagBits cmdflags)
|
||||
bool ConCmdManager::CheckClientCommandAccess(int client, const char *cmd, FlagBits cmdflags)
|
||||
{
|
||||
if (cmdflags == 0 || client == 0)
|
||||
{
|
||||
@@ -478,7 +471,11 @@ bool ConCmdManager::CheckCommandAccess(int client, const char *cmd, FlagBits cmd
|
||||
return false;
|
||||
}
|
||||
|
||||
AdminId adm = player->GetAdminId();
|
||||
return CheckAdminCommandAccess(player->GetAdminId(), cmd, cmdflags);
|
||||
}
|
||||
|
||||
bool ConCmdManager::CheckAdminCommandAccess(AdminId adm, const char *cmd, FlagBits cmdflags)
|
||||
{
|
||||
if (adm != INVALID_ADMIN_ID)
|
||||
{
|
||||
FlagBits bits = g_Admins.GetAdminFlags(adm, Access_Effective);
|
||||
@@ -531,7 +528,7 @@ bool ConCmdManager::CheckCommandAccess(int client, const char *cmd, FlagBits cmd
|
||||
|
||||
bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmin)
|
||||
{
|
||||
if (CheckCommandAccess(client, cmd, pAdmin->eflags))
|
||||
if (CheckClientCommandAccess(client, cmd, pAdmin->eflags))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -540,7 +537,7 @@ bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmi
|
||||
|
||||
/* If we got here, the command failed... */
|
||||
char buffer[128];
|
||||
if (!CoreTranslate(buffer, sizeof(buffer), "%T", 2, NULL, "No Access", &client))
|
||||
if (!logicore.CoreTranslate(buffer, sizeof(buffer), "%T", 2, NULL, "No Access", &client))
|
||||
{
|
||||
UTIL_Format(buffer, sizeof(buffer), "You do not have access to this command");
|
||||
}
|
||||
@@ -916,6 +913,10 @@ ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *descri
|
||||
ConCmdInfo *pInfo;
|
||||
if (!sm_trie_retrieve(m_pCmds, name, (void **)&pInfo))
|
||||
{
|
||||
ConCmdList::iterator item = FindInList(name);
|
||||
if (item != m_CmdList.end())
|
||||
return *item;
|
||||
|
||||
pInfo = new ConCmdInfo();
|
||||
/* Find the commandopan */
|
||||
ConCommand *pCmd = FindCommand(name);
|
||||
|
||||
+11
-2
@@ -92,6 +92,8 @@ struct ConCmdInfo
|
||||
bool is_admin_set; /**< Whether or not admin info is set */
|
||||
};
|
||||
|
||||
typedef List<ConCmdInfo *> ConCmdList;
|
||||
|
||||
class ConCmdManager :
|
||||
public SMGlobalClass,
|
||||
public IRootConsoleCommand,
|
||||
@@ -128,7 +130,8 @@ public:
|
||||
void UpdateAdminCmdFlags(const char *cmd, OverrideType type, FlagBits bits, bool remove);
|
||||
bool LookForSourceModCommand(const char *cmd);
|
||||
bool LookForCommandAdminFlags(const char *cmd, FlagBits *pFlags);
|
||||
bool CheckCommandAccess(int client, const char *cmd, FlagBits flags);
|
||||
bool CheckClientCommandAccess(int client, const char *cmd, FlagBits flags);
|
||||
bool CheckAdminCommandAccess(AdminId adm, const char *cmd, FlagBits flags);
|
||||
private:
|
||||
void InternalDispatch(const CCommand &command);
|
||||
ResultType RunAdminCommand(ConCmdInfo *pInfo, int client, int args);
|
||||
@@ -139,6 +142,12 @@ private:
|
||||
void RemoveConCmds(List<CmdHook *> &cmdlist);
|
||||
void RemoveConCmds(List<CmdHook *> &cmdlist, IPluginContext *pContext);
|
||||
bool CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmin);
|
||||
|
||||
// Case insensitive
|
||||
ConCmdList::iterator FindInList(const char *name);
|
||||
|
||||
// Case sensitive
|
||||
ConCmdInfo *FindInTrie(const char *name);
|
||||
public:
|
||||
inline int GetCommandClient()
|
||||
{
|
||||
@@ -151,7 +160,7 @@ public:
|
||||
private:
|
||||
Trie *m_pCmds; /* command lookup */
|
||||
Trie *m_pCmdGrps; /* command group lookup */
|
||||
List<ConCmdInfo *> m_CmdList; /* command list */
|
||||
ConCmdList m_CmdList; /* command list */
|
||||
int m_CmdClient; /* current client */
|
||||
BaseStringTable m_Strings; /* string table */
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -31,59 +31,59 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_
|
||||
#define _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_
|
||||
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
class ConCommandBaseIterator
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
ICvarIteratorInternal *cvarIter;
|
||||
#else
|
||||
ConCommandBase *cvarIter;
|
||||
#endif
|
||||
|
||||
public:
|
||||
ConCommandBaseIterator()
|
||||
inline ConCommandBaseIterator() : iter(icvar)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
cvarIter = icvar->FactoryInternalIterator();
|
||||
cvarIter->SetFirst();
|
||||
#else
|
||||
cvarIter = icvar->GetCommands();
|
||||
#endif
|
||||
}
|
||||
|
||||
~ConCommandBaseIterator()
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
g_pMemAlloc->Free(cvarIter);
|
||||
#endif
|
||||
iter.SetFirst();
|
||||
}
|
||||
|
||||
inline bool IsValid()
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
return cvarIter->IsValid();
|
||||
#else
|
||||
return cvarIter != NULL;
|
||||
#endif
|
||||
return iter.IsValid();
|
||||
}
|
||||
|
||||
inline void Next()
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
cvarIter->Next();
|
||||
#else
|
||||
cvarIter = const_cast<ConCommandBase*>(cvarIter->GetNext());
|
||||
#endif
|
||||
iter.Next();
|
||||
}
|
||||
|
||||
inline ConCommandBase *Get()
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
return cvarIter->Get();
|
||||
#else
|
||||
return cvarIter;
|
||||
#endif
|
||||
return iter.Get();
|
||||
}
|
||||
private:
|
||||
ICvar::Iterator iter;
|
||||
};
|
||||
#else
|
||||
class ConCommandBaseIterator
|
||||
{
|
||||
public:
|
||||
inline ConCommandBaseIterator()
|
||||
{
|
||||
iter = icvar->GetCommands();
|
||||
}
|
||||
|
||||
inline bool IsValid()
|
||||
{
|
||||
return iter != NULL;
|
||||
}
|
||||
|
||||
inline void Next()
|
||||
{
|
||||
iter = const_cast<ConCommandBase *>(iter->GetNext());
|
||||
}
|
||||
|
||||
inline ConCommandBase *Get()
|
||||
{
|
||||
return iter;
|
||||
}
|
||||
private:
|
||||
ConCommandBase *iter;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_ */
|
||||
|
||||
|
||||
+66
-9
@@ -58,6 +58,40 @@ const ParamType CONVARCHANGE_PARAMS[] = {Param_Cell, Param_String, Param_String}
|
||||
typedef List<const ConVar *> ConVarList;
|
||||
KTrie<ConVarInfo *> convar_cache;
|
||||
|
||||
class ConVarReentrancyGuard
|
||||
{
|
||||
ConVar *cvar;
|
||||
ConVarReentrancyGuard *up;
|
||||
public:
|
||||
static ConVarReentrancyGuard *chain;
|
||||
|
||||
ConVarReentrancyGuard(ConVar *cvar)
|
||||
: cvar(cvar), up(chain)
|
||||
{
|
||||
chain = this;
|
||||
}
|
||||
|
||||
~ConVarReentrancyGuard()
|
||||
{
|
||||
assert(chain == this);
|
||||
chain = up;
|
||||
}
|
||||
|
||||
static bool IsCvarInChain(ConVar *cvar)
|
||||
{
|
||||
ConVarReentrancyGuard *guard = chain;
|
||||
while (guard != NULL)
|
||||
{
|
||||
if (guard->cvar == cvar)
|
||||
return true;
|
||||
guard = guard->up;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
ConVarReentrancyGuard *ConVarReentrancyGuard::chain = NULL;
|
||||
|
||||
ConVarManager::ConVarManager() : m_ConVarType(0), m_bIsDLLQueryHooked(false), m_bIsVSPQueryHooked(false)
|
||||
{
|
||||
}
|
||||
@@ -182,7 +216,7 @@ void ConVarManager::OnSourceModVSPReceived()
|
||||
}
|
||||
|
||||
/* For later MM:S versions, use the updated API, since it's cleaner. */
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
||||
int engine = g_SMAPI->GetSourceEngineBuild();
|
||||
if (engine == SOURCE_ENGINE_ORIGINAL || vsp_version < 2)
|
||||
{
|
||||
@@ -288,8 +322,15 @@ void ConVarManager::OnRootConsoleCommand(const char *cmdname, const CCommand &co
|
||||
int argcount = command.ArgC();
|
||||
if (argcount >= 3)
|
||||
{
|
||||
bool wantReset = false;
|
||||
|
||||
/* Get plugin index that was passed */
|
||||
const char *arg = command.Arg(2);
|
||||
if (argcount >= 4 && strcmp(arg, "reset") == 0)
|
||||
{
|
||||
wantReset = true;
|
||||
arg = command.Arg(3);
|
||||
}
|
||||
|
||||
/* Get plugin object */
|
||||
CPlugin *plugin = g_PluginSys.FindPluginByConsoleArg(arg);
|
||||
@@ -314,21 +355,34 @@ void ConVarManager::OnRootConsoleCommand(const char *cmdname, const CCommand &co
|
||||
return;
|
||||
}
|
||||
|
||||
g_RootMenu.ConsolePrint("[SM] Listing %d convars for: %s", pConVarList->size(), plname);
|
||||
g_RootMenu.ConsolePrint(" %-32.31s %s", "[Name]", "[Value]");
|
||||
|
||||
/* Iterate convar list and display each one */
|
||||
if (!wantReset)
|
||||
{
|
||||
g_RootMenu.ConsolePrint("[SM] Listing %d convars for: %s", pConVarList->size(), plname);
|
||||
g_RootMenu.ConsolePrint(" %-32.31s %s", "[Name]", "[Value]");
|
||||
}
|
||||
|
||||
/* Iterate convar list and display/reset each one */
|
||||
for (iter = pConVarList->begin(); iter != pConVarList->end(); iter++)
|
||||
{
|
||||
const ConVar *pConVar = (*iter);
|
||||
g_RootMenu.ConsolePrint(" %-32.31s %s", pConVar->GetName(), pConVar->GetString());
|
||||
/*const */ConVar *pConVar = const_cast<ConVar *>(*iter);
|
||||
if (!wantReset)
|
||||
{
|
||||
g_RootMenu.ConsolePrint(" %-32.31s %s", pConVar->GetName(), pConVar->GetString());
|
||||
} else {
|
||||
pConVar->Revert();
|
||||
}
|
||||
}
|
||||
|
||||
if (wantReset)
|
||||
{
|
||||
g_RootMenu.ConsolePrint("[SM] Reset %d convars for: %s", pConVarList->size(), plname);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Display usage of subcommand */
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm cvars <plugin #>");
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm cvars [reset] <plugin #>");
|
||||
}
|
||||
|
||||
Handle_t ConVarManager::CreateConVar(IPluginContext *pContext, const char *name, const char *defaultVal, const char *description, int flags, bool hasMin, float min, bool hasMax, float max)
|
||||
@@ -536,7 +590,8 @@ void ConVarManager::UnhookConVarChange(ConVar *pConVar, IPluginFunction *pFuncti
|
||||
}
|
||||
|
||||
/* If the forward now has 0 functions in it... */
|
||||
if (pForward->GetFunctionCount() == 0)
|
||||
if (pForward->GetFunctionCount() == 0 &&
|
||||
!ConVarReentrancyGuard::IsCvarInChain(pConVar))
|
||||
{
|
||||
/* Free this forward */
|
||||
g_Forwards.ReleaseForward(pForward);
|
||||
@@ -647,6 +702,8 @@ void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue)
|
||||
|
||||
if (pForward != NULL)
|
||||
{
|
||||
ConVarReentrancyGuard guard(pConVar);
|
||||
|
||||
/* Now call forwards in plugins that have hooked this */
|
||||
pForward->PushCell(pInfo->handle);
|
||||
pForward->PushString(oldValue);
|
||||
|
||||
+53
-13
@@ -31,7 +31,7 @@
|
||||
|
||||
/**
|
||||
* On SourceHook v4.3 or lower, there are no DVP hooks. Very sad, right?
|
||||
* Only do this on newer version. For the older code, we'll do an incredibly
|
||||
* Only do this on newer versions. For the older code, we'll do an incredibly
|
||||
* hacky detour.
|
||||
*
|
||||
* The idea of the "non-hacky" (yeah... no) code is that every unique
|
||||
@@ -44,13 +44,14 @@
|
||||
#include "Logger.h"
|
||||
#include "compat_wrappers.h"
|
||||
#include "ConsoleDetours.h"
|
||||
#include "GameConfigs.h"
|
||||
#include <IGameConfigs.h>
|
||||
#include "sm_stringutil.h"
|
||||
#include "ConCmdManager.h"
|
||||
#include "HalfLife2.h"
|
||||
#include "ConCommandBaseIterator.h"
|
||||
#include "ShareSys.h"
|
||||
|
||||
#if defined PLATFORM_LINUX
|
||||
#if defined PLATFORM_POSIX
|
||||
# include <dlfcn.h>
|
||||
# include <sys/mman.h>
|
||||
# include <stdint.h>
|
||||
@@ -63,8 +64,13 @@
|
||||
# else
|
||||
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||
# endif
|
||||
#elif SH_IMPL_VERSION == 3
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
|
||||
#else
|
||||
# if SH_IMPL_VERSION >= 4
|
||||
extern int __SourceHook_FHVPAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>,bool);
|
||||
extern int __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
|
||||
# else
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
|
||||
# endif
|
||||
extern bool __SourceHook_FHRemoveConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
|
||||
#endif
|
||||
|
||||
@@ -150,7 +156,10 @@ class GenericCommandHooker : public IConCommandLinkListener
|
||||
while (iter != vtables.end())
|
||||
{
|
||||
if ((*iter).refcount)
|
||||
{
|
||||
iter++;
|
||||
continue;
|
||||
}
|
||||
/* Damn it. This event happens AFTER the plugin has unloaded!
|
||||
* There's two options. Remove the hook now and hope SH's memory
|
||||
* protection will prevent a crash. Otherwise, we can wait until
|
||||
@@ -283,6 +292,23 @@ class GenericCommandHooker
|
||||
Patch cgc;
|
||||
|
||||
public:
|
||||
static void DelayedActivation(void *inparam)
|
||||
{
|
||||
GenericCommandHooker *cdtrs = reinterpret_cast<GenericCommandHooker*>(inparam);
|
||||
/* Safe to re-enter because the frame queue is lock+swapped. */
|
||||
if ((!cdtrs->ces.applied || !cdtrs->cgc.applied) &&
|
||||
g_HL2.PeekCommandStack() != NULL)
|
||||
{
|
||||
g_SourceMod.AddFrameAction(GenericCommandHooker::DelayedActivation, cdtrs);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cdtrs->ces.applied)
|
||||
cdtrs->ApplyPatch(&cdtrs->ces);
|
||||
if (!cdtrs->cgc.applied)
|
||||
cdtrs->ApplyPatch(&cdtrs->cgc);
|
||||
}
|
||||
|
||||
bool Enable()
|
||||
{
|
||||
const char *platform = NULL;
|
||||
@@ -320,6 +346,12 @@ public:
|
||||
if (!PrepPatch("CGameClient::ExecuteString", "CGC", platform, &cgc))
|
||||
return false;
|
||||
|
||||
if (g_HL2.PeekCommandStack() != NULL)
|
||||
{
|
||||
g_SourceMod.AddFrameAction(GenericCommandHooker::DelayedActivation, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
ApplyPatch(&ces);
|
||||
ApplyPatch(&cgc);
|
||||
|
||||
@@ -531,10 +563,12 @@ void DummyHook()
|
||||
* BEGIN THE ACTUALLY GENERIC CODE.
|
||||
*/
|
||||
|
||||
#define FEATURECAP_COMMANDLISTENER "command listener"
|
||||
|
||||
static GenericCommandHooker s_GenericHooker;
|
||||
ConsoleDetours g_ConsoleDetours;
|
||||
|
||||
ConsoleDetours::ConsoleDetours() : triedToEnable(false), isEnabled(false)
|
||||
ConsoleDetours::ConsoleDetours() : status(FeatureStatus_Unknown)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -542,6 +576,7 @@ void ConsoleDetours::OnSourceModAllInitialized()
|
||||
{
|
||||
m_pForward = g_Forwards.CreateForwardEx("OnAnyCommand", ET_Hook, 3, NULL, Param_Cell,
|
||||
Param_String, Param_Cell);
|
||||
g_ShareSys.AddCapabilityProvider(NULL, this, FEATURECAP_COMMANDLISTENER);
|
||||
}
|
||||
|
||||
void ConsoleDetours::OnSourceModShutdown()
|
||||
@@ -559,18 +594,23 @@ void ConsoleDetours::OnSourceModShutdown()
|
||||
s_GenericHooker.Disable();
|
||||
}
|
||||
|
||||
bool ConsoleDetours::IsAvailable()
|
||||
FeatureStatus ConsoleDetours::GetFeatureStatus(FeatureType type, const char *name)
|
||||
{
|
||||
if (triedToEnable)
|
||||
return isEnabled;
|
||||
isEnabled = s_GenericHooker.Enable();
|
||||
triedToEnable = true;
|
||||
return isEnabled;
|
||||
return GetStatus();
|
||||
}
|
||||
|
||||
FeatureStatus ConsoleDetours::GetStatus()
|
||||
{
|
||||
if (status == FeatureStatus_Unknown)
|
||||
{
|
||||
status = s_GenericHooker.Enable() ? FeatureStatus_Available : FeatureStatus_Unavailable;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
bool ConsoleDetours::AddListener(IPluginFunction *fun, const char *command)
|
||||
{
|
||||
if (!IsAvailable())
|
||||
if (GetStatus() != FeatureStatus_Available)
|
||||
return false;
|
||||
|
||||
if (command == NULL)
|
||||
|
||||
@@ -36,7 +36,9 @@
|
||||
#include "ForwardSys.h"
|
||||
#include <sm_trie_tpl.h>
|
||||
|
||||
class ConsoleDetours : public SMGlobalClass
|
||||
class ConsoleDetours :
|
||||
public SMGlobalClass,
|
||||
public IFeatureProvider
|
||||
{
|
||||
friend class PlayerManager;
|
||||
friend class GenericCommandHooker;
|
||||
@@ -50,6 +52,8 @@ public:
|
||||
public: //SMGlobalClass
|
||||
void OnSourceModAllInitialized();
|
||||
void OnSourceModShutdown();
|
||||
public: //IFeatureProvider
|
||||
FeatureStatus GetFeatureStatus(FeatureType type, const char *name);
|
||||
public:
|
||||
bool AddListener(IPluginFunction *fun, const char *command);
|
||||
bool RemoveListener(IPluginFunction *fun, const char *command);
|
||||
@@ -60,15 +64,14 @@ private:
|
||||
#else
|
||||
static cell_t Dispatch(ConCommand *pBase);
|
||||
#endif
|
||||
bool IsAvailable();
|
||||
public:
|
||||
inline bool IsEnabled()
|
||||
FeatureStatus GetStatus();
|
||||
bool IsEnabled()
|
||||
{
|
||||
return isEnabled;
|
||||
return status == FeatureStatus_Available;
|
||||
}
|
||||
private:
|
||||
bool triedToEnable;
|
||||
bool isEnabled;
|
||||
FeatureStatus status;
|
||||
IChangeableForward *m_pForward;
|
||||
KTrie<Listener*> m_CmdLookup;
|
||||
List<Listener*> m_Listeners;
|
||||
|
||||
+5
-1
@@ -68,7 +68,11 @@ void Hook_ExecDispatchPre(const CCommand &cmd)
|
||||
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||
void Hook_ExecDispatchPre()
|
||||
#else
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
# if SH_IMPL_VERSION >= 4
|
||||
extern int __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
# else
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
# endif
|
||||
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
void Hook_ExecDispatchPre()
|
||||
#endif
|
||||
|
||||
+40
-31
@@ -47,7 +47,7 @@ DBManager g_DBMan;
|
||||
static bool s_OneTimeThreaderErrorMsg = false;
|
||||
|
||||
DBManager::DBManager()
|
||||
: m_StrTab(512), m_ParseLevel(0), m_ParseState(0), m_pDefault(NULL)
|
||||
: m_ParseLevel(0), m_ParseState(0), m_pDefault(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -104,6 +104,7 @@ void DBManager::OnSourceModShutdown()
|
||||
m_pQueueLock->DestroyThis();
|
||||
g_HandleSys.RemoveType(m_DatabaseType, g_pCoreIdent);
|
||||
g_HandleSys.RemoveType(m_DriverType, g_pCoreIdent);
|
||||
ClearConfigs();
|
||||
}
|
||||
|
||||
unsigned int DBManager::GetInterfaceVersion()
|
||||
@@ -133,13 +134,20 @@ void DBManager::OnHandleDestroy(HandleType_t type, void *object)
|
||||
|
||||
void DBManager::ReadSMC_ParseStart()
|
||||
{
|
||||
m_confs.clear();
|
||||
ClearConfigs();
|
||||
m_ParseLevel = 0;
|
||||
m_ParseState = DBPARSE_LEVEL_NONE;
|
||||
m_StrTab.Reset();
|
||||
m_DefDriver.clear();
|
||||
}
|
||||
|
||||
void DBManager::ClearConfigs()
|
||||
{
|
||||
List<ConfDbInfo *>::iterator iter;
|
||||
for (iter=m_confs.begin(); iter!=m_confs.end(); iter++)
|
||||
delete (*iter);
|
||||
m_confs.clear();
|
||||
}
|
||||
|
||||
ConfDbInfo s_CurInfo;
|
||||
SMCResult DBManager::ReadSMC_NewSection(const SMCStates *states, const char *name)
|
||||
{
|
||||
@@ -159,7 +167,7 @@ SMCResult DBManager::ReadSMC_NewSection(const SMCStates *states, const char *nam
|
||||
}
|
||||
} else if (m_ParseState == DBPARSE_LEVEL_MAIN) {
|
||||
s_CurInfo = ConfDbInfo();
|
||||
s_CurInfo.name = m_StrTab.AddString(name);
|
||||
s_CurInfo.name = name;
|
||||
m_ParseState = DBPARSE_LEVEL_DATABASE;
|
||||
} else if (m_ParseState == DBPARSE_LEVEL_DATABASE) {
|
||||
m_ParseLevel++;
|
||||
@@ -186,16 +194,16 @@ SMCResult DBManager::ReadSMC_KeyValue(const SMCStates *states, const char *key,
|
||||
{
|
||||
if (strcmp(value, "default") != 0)
|
||||
{
|
||||
s_CurInfo.driver = m_StrTab.AddString(value);
|
||||
s_CurInfo.driver = value;
|
||||
}
|
||||
} else if (strcmp(key, "database") == 0) {
|
||||
s_CurInfo.database = m_StrTab.AddString(value);
|
||||
s_CurInfo.database = value;
|
||||
} else if (strcmp(key, "host") == 0) {
|
||||
s_CurInfo.host = m_StrTab.AddString(value);
|
||||
s_CurInfo.host = value;
|
||||
} else if (strcmp(key, "user") == 0) {
|
||||
s_CurInfo.user = m_StrTab.AddString(value);
|
||||
s_CurInfo.user = value;
|
||||
} else if (strcmp(key, "pass") == 0) {
|
||||
s_CurInfo.pass = m_StrTab.AddString(value);
|
||||
s_CurInfo.pass = value;
|
||||
} else if (strcmp(key, "timeout") == 0) {
|
||||
s_CurInfo.info.maxTimeout = atoi(value);
|
||||
} else if (strcmp(key, "port") == 0) {
|
||||
@@ -206,13 +214,6 @@ SMCResult DBManager::ReadSMC_KeyValue(const SMCStates *states, const char *key,
|
||||
return SMCResult_Continue;
|
||||
}
|
||||
|
||||
#define ASSIGN_VAR(var) \
|
||||
if (s_CurInfo.var == -1) { \
|
||||
s_CurInfo.info.var = ""; \
|
||||
} else { \
|
||||
s_CurInfo.info.var = m_StrTab.GetString(s_CurInfo.var); \
|
||||
}
|
||||
|
||||
SMCResult DBManager::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
{
|
||||
if (m_ParseLevel)
|
||||
@@ -223,17 +224,26 @@ SMCResult DBManager::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
|
||||
if (m_ParseState == DBPARSE_LEVEL_DATABASE)
|
||||
{
|
||||
/* Set all of the info members to either a blank string
|
||||
* or the string pointer from the string table.
|
||||
*/
|
||||
ASSIGN_VAR(driver);
|
||||
ASSIGN_VAR(database);
|
||||
ASSIGN_VAR(host);
|
||||
ASSIGN_VAR(user);
|
||||
ASSIGN_VAR(pass);
|
||||
ConfDbInfo *cdb = new ConfDbInfo();
|
||||
|
||||
cdb->name = s_CurInfo.name;
|
||||
cdb->driver = s_CurInfo.driver;
|
||||
cdb->host = s_CurInfo.host;
|
||||
cdb->user = s_CurInfo.user;
|
||||
cdb->pass = s_CurInfo.pass;
|
||||
cdb->database = s_CurInfo.database;
|
||||
cdb->realDriver = s_CurInfo.realDriver;
|
||||
cdb->info.maxTimeout = s_CurInfo.info.maxTimeout;
|
||||
cdb->info.port = s_CurInfo.info.port;
|
||||
|
||||
cdb->info.driver = cdb->driver.c_str();
|
||||
cdb->info.database = cdb->database.c_str();
|
||||
cdb->info.host = cdb->host.c_str();
|
||||
cdb->info.user = cdb->user.c_str();
|
||||
cdb->info.pass = cdb->pass.c_str();
|
||||
|
||||
/* Save it.. */
|
||||
m_confs.push_back(s_CurInfo);
|
||||
m_confs.push_back(cdb);
|
||||
|
||||
/* Go up one level */
|
||||
m_ParseState = DBPARSE_LEVEL_MAIN;
|
||||
@@ -244,7 +254,6 @@ SMCResult DBManager::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
|
||||
return SMCResult_Continue;
|
||||
}
|
||||
#undef ASSIGN_VAR
|
||||
|
||||
void DBManager::ReadSMC_ParseEnd(bool halted, bool failed)
|
||||
{
|
||||
@@ -333,10 +342,10 @@ void DBManager::RemoveDriver(IDBDriver *pDriver)
|
||||
}
|
||||
|
||||
/* Make sure NOTHING references this! */
|
||||
List<ConfDbInfo>::iterator iter;
|
||||
List<ConfDbInfo *>::iterator iter;
|
||||
for (iter=m_confs.begin(); iter!=m_confs.end(); iter++)
|
||||
{
|
||||
ConfDbInfo &db = (*iter);
|
||||
ConfDbInfo &db = *(*iter);
|
||||
if (db.realDriver == pDriver)
|
||||
{
|
||||
db.realDriver = NULL;
|
||||
@@ -448,12 +457,12 @@ const DatabaseInfo *DBManager::FindDatabaseConf(const char *name)
|
||||
|
||||
ConfDbInfo *DBManager::GetDatabaseConf(const char *name)
|
||||
{
|
||||
List<ConfDbInfo>::iterator iter;
|
||||
List<ConfDbInfo *>::iterator iter;
|
||||
|
||||
for (iter=m_confs.begin(); iter!=m_confs.end(); iter++)
|
||||
{
|
||||
ConfDbInfo &conf = (*iter);
|
||||
if (strcmp(m_StrTab.GetString(conf.name), name) == 0)
|
||||
ConfDbInfo &conf = *(*iter);
|
||||
if (conf.name == name)
|
||||
{
|
||||
return &conf;
|
||||
}
|
||||
|
||||
+9
-10
@@ -47,16 +47,15 @@ using namespace SourceHook;
|
||||
|
||||
struct ConfDbInfo
|
||||
{
|
||||
ConfDbInfo() : name(-1), driver(-1), host(-1), user(-1), pass(-1),
|
||||
database(-1), realDriver(NULL)
|
||||
ConfDbInfo() : realDriver(NULL)
|
||||
{
|
||||
}
|
||||
int name;
|
||||
int driver;
|
||||
int host;
|
||||
int user;
|
||||
int pass;
|
||||
int database;
|
||||
String name;
|
||||
String driver;
|
||||
String host;
|
||||
String user;
|
||||
String pass;
|
||||
String database;
|
||||
IDBDriver *realDriver;
|
||||
DatabaseInfo info;
|
||||
};
|
||||
@@ -121,6 +120,7 @@ public:
|
||||
return m_DatabaseType;
|
||||
}
|
||||
private:
|
||||
void ClearConfigs();
|
||||
void KillWorkerThread();
|
||||
private:
|
||||
CVector<IDBDriver *> m_drivers;
|
||||
@@ -134,11 +134,10 @@ private:
|
||||
IMutex *m_pQueueLock; /* Queue safety lock */
|
||||
IMutex *m_pThinkLock; /* Think-queue lock */
|
||||
|
||||
List<ConfDbInfo> m_confs;
|
||||
List<ConfDbInfo *> m_confs;
|
||||
HandleType_t m_DriverType;
|
||||
HandleType_t m_DatabaseType;
|
||||
String m_DefDriver;
|
||||
BaseStringTable m_StrTab;
|
||||
char m_Filename[PLATFORM_MAX_PATH];
|
||||
unsigned int m_ParseLevel;
|
||||
unsigned int m_ParseState;
|
||||
|
||||
@@ -56,11 +56,16 @@ void DebugReport::OnDebugSpew(const char *msg, ...)
|
||||
void DebugReport::GenerateError(IPluginContext *ctx, cell_t func_idx, int err, const char *message, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char buffer[512];
|
||||
|
||||
va_start(ap, message);
|
||||
UTIL_FormatArgs(buffer, sizeof(buffer), message, ap);
|
||||
GenerateErrorVA(ctx, func_idx, err, message, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void DebugReport::GenerateErrorVA(IPluginContext *ctx, cell_t func_idx, int err, const char *message, va_list ap)
|
||||
{
|
||||
char buffer[512];
|
||||
UTIL_FormatArgs(buffer, sizeof(buffer), message, ap);
|
||||
|
||||
const char *plname = g_PluginSys.FindPluginByContext(ctx->GetContext())->GetFilename();
|
||||
const char *error = g_pSourcePawn2->GetErrorString(err);
|
||||
|
||||
@@ -46,6 +46,7 @@ public: // IDebugListener
|
||||
void OnDebugSpew(const char *msg, ...);
|
||||
public:
|
||||
void GenerateError(IPluginContext *ctx, cell_t func_idx, int err, const char *message, ...);
|
||||
void GenerateErrorVA(IPluginContext *ctx, cell_t func_idx, int err, const char *message, va_list ap);
|
||||
void GenerateCodeError(IPluginContext *ctx, uint32_t code_addr, int err, const char *message, ...);
|
||||
private:
|
||||
int _GetPluginIndex(IPluginContext *ctx);
|
||||
|
||||
+36
-3
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -42,6 +42,20 @@ SH_DECL_HOOK2(IGameEventManager2, FireEvent, SH_NOATTRIB, 0, bool, IGameEvent *,
|
||||
const ParamType GAMEEVENT_PARAMS[] = {Param_Cell, Param_String, Param_Cell};
|
||||
typedef List<EventHook *> EventHookList;
|
||||
|
||||
class EventForwardFilter : public IForwardFilter
|
||||
{
|
||||
EventInfo *pEventInfo;
|
||||
public:
|
||||
EventForwardFilter(EventInfo *pEventInfo) : pEventInfo(pEventInfo)
|
||||
{
|
||||
}
|
||||
|
||||
void Preprocess(IPluginFunction *fun, FwdParamInfo *params)
|
||||
{
|
||||
params[2].val = pEventInfo->bDontBroadcast ? 1 : 0;
|
||||
}
|
||||
};
|
||||
|
||||
EventManager::EventManager() : m_EventType(0)
|
||||
{
|
||||
/* Create an event lookup trie */
|
||||
@@ -147,6 +161,13 @@ void EventManager::FireGameEvent(IGameEvent *pEvent)
|
||||
Just need to add ourselves as a listener to make our hook on IGameEventManager2::FireEvent work */
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
int EventManager::GetEventDebugID()
|
||||
{
|
||||
return EVENT_DEBUG_ID_INIT;
|
||||
}
|
||||
#endif
|
||||
|
||||
EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunction, EventHookMode mode)
|
||||
{
|
||||
EventHook *pHook;
|
||||
@@ -327,6 +348,7 @@ EventInfo *EventManager::CreateEvent(IPluginContext *pContext, const char *name,
|
||||
|
||||
pInfo->pEvent = pEvent;
|
||||
pInfo->pOwner = pContext->GetIdentity();
|
||||
pInfo->bDontBroadcast = false;
|
||||
|
||||
return pInfo;
|
||||
}
|
||||
@@ -365,6 +387,7 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
|
||||
IChangeableForward *pForward;
|
||||
const char *name;
|
||||
cell_t res = Pl_Continue;
|
||||
bool broadcast = bDontBroadcast;
|
||||
|
||||
/* The engine accepts NULL without crashing, so to prevent a crash in SM we ignore these */
|
||||
if (!pEvent)
|
||||
@@ -390,10 +413,16 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
|
||||
HandleSecurity sec(NULL, g_pCoreIdent);
|
||||
Handle_t hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
|
||||
|
||||
info.bDontBroadcast = bDontBroadcast;
|
||||
|
||||
EventForwardFilter filter(&info);
|
||||
|
||||
pForward->PushCell(hndl);
|
||||
pForward->PushString(name);
|
||||
pForward->PushCell(bDontBroadcast);
|
||||
pForward->Execute(&res, NULL);
|
||||
pForward->Execute(&res, &filter);
|
||||
|
||||
broadcast = info.bDontBroadcast;
|
||||
|
||||
g_HandleSys.FreeHandle(hndl, &sec);
|
||||
}
|
||||
@@ -414,6 +443,9 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
|
||||
m_EventStack.push(NULL);
|
||||
}
|
||||
|
||||
if (broadcast != bDontBroadcast)
|
||||
RETURN_META_VALUE_NEWPARAMS(MRES_IGNORED, true, &IGameEventManager2::FireEvent, (pEvent, broadcast));
|
||||
|
||||
RETURN_META_VALUE(MRES_IGNORED, true);
|
||||
}
|
||||
|
||||
@@ -441,6 +473,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
||||
{
|
||||
if (pHook->postCopy)
|
||||
{
|
||||
info.bDontBroadcast = bDontBroadcast;
|
||||
info.pEvent = m_EventCopies.front();
|
||||
info.pOwner = NULL;
|
||||
hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
|
||||
|
||||
+5
-1
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -53,6 +53,7 @@ struct EventInfo
|
||||
}
|
||||
IGameEvent *pEvent;
|
||||
IdentityToken_t *pOwner;
|
||||
bool bDontBroadcast;
|
||||
};
|
||||
|
||||
struct EventHook
|
||||
@@ -104,6 +105,9 @@ public: // IPluginsListener
|
||||
void OnPluginUnloaded(IPlugin *plugin);
|
||||
public: // IGameEventListener2
|
||||
void FireGameEvent(IGameEvent *pEvent);
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
int GetEventDebugID();
|
||||
#endif
|
||||
public:
|
||||
/**
|
||||
* Get the 'GameEvent' handle type ID.
|
||||
|
||||
+54
-8
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -63,15 +63,23 @@ CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filena
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#define GAMEFIX "2.l4d"
|
||||
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
#define GAMEFIX "2.l4d2"
|
||||
#elif SOURCE_ENGINE == SE_ALIENSWARM
|
||||
#define GAMEFIX "2.swarm"
|
||||
#elif SOURCE_ENGINE == SE_ORANGEBOX
|
||||
#define GAMEFIX "2.ep2"
|
||||
#elif SOURCE_ENGINE == SE_BLOODYGOODTIME
|
||||
#define GAMEFIX "2.bgt"
|
||||
#elif SOURCE_ENGINE == SE_EYE
|
||||
#define GAMEFIX "2.eye"
|
||||
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
||||
#define GAMEFIX "2.ep2v"
|
||||
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||
#define GAMEFIX "2.darkm"
|
||||
#else
|
||||
#define GAMEFIX "2.ep1"
|
||||
#endif //SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#endif //(SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#else //METAMOD_PLAPI_VERSION
|
||||
#define GAMEFIX "1.ep1"
|
||||
#endif //METAMOD_PLAPI_VERSION
|
||||
@@ -83,6 +91,12 @@ CLocalExtension::CLocalExtension(const char *filename)
|
||||
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
|
||||
/* Special case for new bintools binary */
|
||||
if (strcmp(filename, "bintools.ext") == 0)
|
||||
{
|
||||
goto normal;
|
||||
}
|
||||
|
||||
/* Zeroth, see if there is an engine specific build in the new place. */
|
||||
g_SourceMod.BuildPath(Path_SM,
|
||||
path,
|
||||
@@ -102,6 +116,7 @@ CLocalExtension::CLocalExtension(const char *filename)
|
||||
"extensions/auto." GAMEFIX "/%s." PLATFORM_LIB_EXT,
|
||||
filename);
|
||||
|
||||
normal:
|
||||
/* Try the "normal" version */
|
||||
if (!g_LibSys.IsPathFile(path))
|
||||
{
|
||||
@@ -169,6 +184,28 @@ bool CLocalExtension::Load(char *error, size_t maxlength)
|
||||
{
|
||||
bool already;
|
||||
m_PlId = g_pMMPlugins->Load(m_Path.c_str(), g_PLID, already, error, maxlength);
|
||||
|
||||
// Check the plugin didn't refuse load
|
||||
Pl_Status status;
|
||||
|
||||
#ifndef METAMOD_PLAPI_VERSION
|
||||
const char *file;
|
||||
PluginId source;
|
||||
#endif
|
||||
|
||||
if (!m_PlId || (
|
||||
#ifndef METAMOD_PLAPI_VERSION
|
||||
g_pMMPlugins->Query(m_PlId, file, status, source)
|
||||
#else
|
||||
g_pMMPlugins->Query(m_PlId, NULL, &status, NULL)
|
||||
#endif
|
||||
&& status < Pl_Paused))
|
||||
{
|
||||
m_pLib->CloseLibrary();
|
||||
m_pLib = NULL;
|
||||
m_pAPI = NULL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!CExtension::Load(error, maxlength))
|
||||
@@ -335,6 +372,11 @@ const char *CExtension::GetFilename()
|
||||
return m_RealFile.c_str();
|
||||
}
|
||||
|
||||
const char *CExtension::GetPath() const
|
||||
{
|
||||
return m_Path.c_str();
|
||||
}
|
||||
|
||||
IdentityToken_t *CExtension::GetIdentity()
|
||||
{
|
||||
return m_pIdentToken;
|
||||
@@ -543,7 +585,7 @@ void CExtensionManager::TryAutoload()
|
||||
}
|
||||
}
|
||||
|
||||
IExtension *CExtensionManager::LoadAutoExtension(const char *path)
|
||||
IExtension *CExtensionManager::LoadAutoExtension(const char *path, bool bErrorOnMissing)
|
||||
{
|
||||
/* Remove platform extension if it's there. Compat hack. */
|
||||
const char *ext = g_LibSys.GetFileExtension(path);
|
||||
@@ -552,7 +594,7 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path)
|
||||
char path2[PLATFORM_MAX_PATH];
|
||||
UTIL_Format(path2, sizeof(path2), "%s", path);
|
||||
path2[strlen(path) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
|
||||
return LoadAutoExtension(path2);
|
||||
return LoadAutoExtension(path2, bErrorOnMissing);
|
||||
}
|
||||
|
||||
IExtension *pAlready;
|
||||
@@ -571,7 +613,11 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path)
|
||||
|
||||
if (!p->Load(error, sizeof(error)) || !p->IsLoaded())
|
||||
{
|
||||
g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
|
||||
if (bErrorOnMissing || g_LibSys.IsPathFile(p->GetPath()))
|
||||
{
|
||||
g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
|
||||
}
|
||||
|
||||
p->SetError(error);
|
||||
}
|
||||
|
||||
@@ -986,7 +1032,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
||||
{
|
||||
if (argcount < 4)
|
||||
{
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm info <#>");
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm exts info <#>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -994,7 +1040,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
||||
unsigned int id = atoi(sId);
|
||||
if (id <= 0)
|
||||
{
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm info <#>");
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm exts info <#>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1071,7 +1117,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
||||
{
|
||||
if (argcount < 4)
|
||||
{
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm unload <#> [code]");
|
||||
g_RootMenu.ConsolePrint("[SM] Usage: sm exts unload <#> [code]");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -66,6 +66,7 @@ public:
|
||||
public: //IExtension
|
||||
IExtensionInterface *GetAPI();
|
||||
const char *GetFilename();
|
||||
const char *GetPath() const;
|
||||
IdentityToken_t *GetIdentity();
|
||||
ITERATOR *FindFirstDependency(IExtension **pOwner, SMInterface **pInterface);
|
||||
bool FindNextDependency(ITERATOR *iter, IExtension **pOwner, SMInterface **pInterface);
|
||||
@@ -163,7 +164,7 @@ public: //IPluginsListener
|
||||
public: //IRootConsoleCommand
|
||||
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
|
||||
public:
|
||||
IExtension *LoadAutoExtension(const char *path);
|
||||
IExtension *LoadAutoExtension(const char *path, bool bErrorOnMissing=true);
|
||||
void BindDependency(IExtension *pOwner, IfaceInfo *pInfo);
|
||||
void AddInterface(IExtension *pOwner, SMInterface *pInterface);
|
||||
void BindChildPlugin(IExtension *pParent, CPlugin *pPlugin);
|
||||
|
||||
+14
-8
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
@@ -255,6 +255,7 @@ CForward *CForward::CreateForward(const char *name, ExecType et, unsigned int nu
|
||||
}
|
||||
|
||||
CForward *pForward = g_Forwards.ForwardMake();
|
||||
pForward->m_IterGuard = NULL;
|
||||
pForward->m_curparam = 0;
|
||||
pForward->m_ExecType = et;
|
||||
snprintf(pForward->m_name, FORWARDS_NAME_MAX, "%s", name ? name : "");
|
||||
@@ -294,7 +295,7 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
||||
cell_t high_result = 0;
|
||||
cell_t low_result = 0;
|
||||
int err;
|
||||
unsigned int failed=0, success=0;
|
||||
unsigned int success=0;
|
||||
unsigned int num_params = m_curparam;
|
||||
FwdParamInfo temp_info[SP_MAX_EXEC_PARAMS];
|
||||
FwdParamInfo *param;
|
||||
@@ -304,10 +305,15 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
||||
memcpy(temp_info, m_params, sizeof(m_params));
|
||||
m_curparam = 0;
|
||||
|
||||
for (iter=m_functions.begin(); iter!=m_functions.end(); iter++)
|
||||
FuncIteratorGuard guard(&m_IterGuard, &iter);
|
||||
|
||||
while (iter != m_functions.end())
|
||||
{
|
||||
func = (*iter);
|
||||
|
||||
if (filter)
|
||||
filter->Preprocess(func, temp_info);
|
||||
|
||||
for (unsigned int i=0; i<num_params; i++)
|
||||
{
|
||||
int err = SP_ERROR_PARAM;
|
||||
@@ -359,11 +365,7 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
||||
}
|
||||
|
||||
/* Call the function and deal with the return value. */
|
||||
if ((err=func->Execute(&cur_result)) != SP_ERROR_NONE)
|
||||
{
|
||||
failed++;
|
||||
}
|
||||
else
|
||||
if ((err=func->Execute(&cur_result)) == SP_ERROR_NONE)
|
||||
{
|
||||
success++;
|
||||
switch (m_ExecType)
|
||||
@@ -403,6 +405,9 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!guard.Triggered())
|
||||
iter++;
|
||||
}
|
||||
|
||||
done:
|
||||
@@ -682,6 +687,7 @@ bool CForward::RemoveFunction(IPluginFunction *func)
|
||||
{
|
||||
if ((*iter) == func)
|
||||
{
|
||||
m_IterGuard->FixIteratorChain(iter);
|
||||
found = true;
|
||||
lst->erase(iter);
|
||||
break;
|
||||
|
||||
@@ -61,6 +61,58 @@ struct FwdParamInfo
|
||||
ParamType pushedas;
|
||||
};
|
||||
|
||||
class SourceMod::IForwardFilter
|
||||
{
|
||||
public:
|
||||
virtual void Preprocess(IPluginFunction *fun, FwdParamInfo *params)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class FuncIteratorGuard
|
||||
{
|
||||
bool triggered;
|
||||
FuncIteratorGuard **pprev;
|
||||
FuncIter *iter;
|
||||
FuncIteratorGuard *next;
|
||||
public:
|
||||
FuncIteratorGuard(FuncIteratorGuard **pprev, FuncIter *iter)
|
||||
: triggered(false), pprev(pprev), iter(iter), next(*pprev)
|
||||
{
|
||||
*pprev = this;
|
||||
}
|
||||
|
||||
~FuncIteratorGuard()
|
||||
{
|
||||
*pprev = next;
|
||||
}
|
||||
|
||||
inline bool Triggered()
|
||||
{
|
||||
bool t = triggered;
|
||||
triggered = false;
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* This should not read from |this| before the NULL check, because FwdSys
|
||||
* can call (NULL)->FixIteratorChain().
|
||||
*/
|
||||
void FixIteratorChain(FuncIter &other)
|
||||
{
|
||||
FuncIteratorGuard *guard = this;
|
||||
while (guard != NULL)
|
||||
{
|
||||
if (*guard->iter == other)
|
||||
{
|
||||
*(guard->iter) = ++(*(guard->iter));
|
||||
guard->triggered = true;
|
||||
}
|
||||
guard = guard->next;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class CForward : public IChangeableForward
|
||||
{
|
||||
public: //ICallable
|
||||
@@ -103,6 +155,7 @@ protected:
|
||||
*/
|
||||
mutable List<IPluginFunction *> m_functions;
|
||||
mutable List<IPluginFunction *> m_paused;
|
||||
FuncIteratorGuard *m_IterGuard;
|
||||
|
||||
/* Type and name information */
|
||||
FwdParamInfo m_params[SP_MAX_EXEC_PARAMS];
|
||||
|
||||
+69
-30
@@ -35,9 +35,10 @@
|
||||
#include "UserMessages.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "GameConfigs.h"
|
||||
#include <IGameConfigs.h>
|
||||
#include <compat_wrappers.h>
|
||||
#include <Logger.h>
|
||||
#include "logic_bridge.h"
|
||||
|
||||
CHalfLife2 g_HL2;
|
||||
ConVar *sv_lan = NULL;
|
||||
@@ -96,14 +97,16 @@ CHalfLife2::~CHalfLife2()
|
||||
CSharedEdictChangeInfo *g_pSharedChangeInfo = NULL;
|
||||
#endif
|
||||
|
||||
#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11
|
||||
bool is_original_engine = false;
|
||||
#endif
|
||||
|
||||
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 */
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
||||
if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL)
|
||||
#else
|
||||
if (strcasecmp(g_SourceMod.GetGameFolderName(), "ship") == 0)
|
||||
@@ -130,40 +133,61 @@ void CHalfLife2::OnSourceModAllInitialized()
|
||||
void CHalfLife2::OnSourceModAllInitialized_Post()
|
||||
{
|
||||
char *addr = NULL;
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
int offset;
|
||||
|
||||
/* gEntList and/or g_pEntityList */
|
||||
if (!g_pGameConf->GetMemSig("LevelShutdown", (void **)&addr))
|
||||
/*
|
||||
* gEntList and/or g_pEntityList
|
||||
*
|
||||
* First try to lookup pointer directly for platforms with symbols.
|
||||
* If symbols aren't present (Windows or stripped Linux/Mac),
|
||||
* attempt find via LevelShutdown + offset
|
||||
*/
|
||||
if (g_pGameConf->GetMemSig("gEntList", (void **)&addr))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (LevelShutdown) - Reverting to networkable entities only");
|
||||
return;
|
||||
#if !defined PLATFORM_WINDOWS
|
||||
if (!addr)
|
||||
{
|
||||
// Key exists so notify if lookup fails, but try other method.
|
||||
g_Logger.LogError("Failed lookup of gEntList directly - Reverting to lookup via LevelShutdown");
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
g_EntList = reinterpret_cast<void *>(addr);
|
||||
#if !defined PLATFORM_WINDOWS
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (!addr)
|
||||
|
||||
|
||||
if (!g_EntList)
|
||||
{
|
||||
g_Logger.LogError("Failed lookup of LevelShutdown - Reverting to networkable entities only");
|
||||
return;
|
||||
if (!g_pGameConf->GetMemSig("LevelShutdown", (void **)&addr))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (LevelShutdown) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!addr)
|
||||
{
|
||||
g_Logger.LogError("Failed lookup of LevelShutdown - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
|
||||
int offset;
|
||||
if (!g_pGameConf->GetOffset("gEntList", &offset))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
|
||||
g_EntList = *reinterpret_cast<void **>(addr + offset);
|
||||
}
|
||||
if (!g_pGameConf->GetOffset("gEntList", &offset))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
g_EntList = *reinterpret_cast<void **>(addr + offset);
|
||||
#elif defined PLATFORM_LINUX
|
||||
/* gEntList and/or g_pEntityList */
|
||||
if (!g_pGameConf->GetMemSig("gEntList", (void **)&addr))
|
||||
{
|
||||
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
if (!addr)
|
||||
|
||||
if (!g_EntList)
|
||||
{
|
||||
g_Logger.LogError("Failed lookup of gEntList - Reverting to networkable entities only");
|
||||
return;
|
||||
}
|
||||
g_EntList = reinterpret_cast<void *>(addr);
|
||||
#endif
|
||||
|
||||
if (!g_pGameConf->GetOffset("EntInfo", &entInfoOffset))
|
||||
{
|
||||
@@ -172,7 +196,7 @@ void CHalfLife2::OnSourceModAllInitialized_Post()
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined METAMOD_PLAPI_VERSION
|
||||
#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11
|
||||
bool CHalfLife2::IsOriginalEngine()
|
||||
{
|
||||
return is_original_engine;
|
||||
@@ -543,7 +567,7 @@ bool CHalfLife2::IsLANServer()
|
||||
|
||||
bool CHalfLife2::KVLoadFromFile(KeyValues *kv, IBaseFileSystem *filesystem, const char *resourceName, const char *pathID)
|
||||
{
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
||||
if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL)
|
||||
#else
|
||||
if (strcasecmp(g_SourceMod.GetGameFolderName(), "ship") == 0)
|
||||
@@ -668,7 +692,10 @@ edict_t *CHalfLife2::GetHandleEntity(CBaseHandle &hndl)
|
||||
edict_t *pStoredEdict;
|
||||
CBaseEntity *pStoredEntity;
|
||||
|
||||
pStoredEdict = GetEntity(index, &pStoredEntity);
|
||||
if (!IndexToAThings(index, &pStoredEntity, &pStoredEdict))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pStoredEdict == NULL || pStoredEntity == NULL)
|
||||
{
|
||||
@@ -760,6 +787,12 @@ CBaseEntity *CHalfLife2::ReferenceToEntity(cell_t entRef)
|
||||
*/
|
||||
CEntInfo *CHalfLife2::LookupEntity(int entIndex)
|
||||
{
|
||||
// Make sure that our index is within the bounds of the global ent array
|
||||
if (entIndex < 0 || entIndex >= NUM_ENT_ENTRIES)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!g_EntList || entInfoOffset == -1)
|
||||
{
|
||||
/* Attempt to use engine interface instead */
|
||||
@@ -881,3 +914,9 @@ void *CHalfLife2::GetGlobalEntityList()
|
||||
{
|
||||
return g_EntList;
|
||||
}
|
||||
|
||||
int CHalfLife2::GetSendPropOffset(SendProp *prop)
|
||||
{
|
||||
return prop->GetOffset();
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -135,6 +135,7 @@ public: //IGameHelpers
|
||||
CEntInfo *LookupEntity(int entIndex);
|
||||
cell_t EntityToBCompatRef(CBaseEntity *pEntity);
|
||||
void *GetGlobalEntityList();
|
||||
int GetSendPropOffset(SendProp *prop);
|
||||
public:
|
||||
void AddToFakeCliCmdQueue(int client, int userid, const char *cmd);
|
||||
void ProcessFakeCliCmdQueue();
|
||||
@@ -145,7 +146,7 @@ public:
|
||||
const char *CurrentCommandName();
|
||||
void AddDelayedKick(int client, int userid, const char *msg);
|
||||
void ProcessDelayedKicks();
|
||||
#if !defined METAMOD_PLAPI_VERSION
|
||||
#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11
|
||||
bool IsOriginalEngine();
|
||||
#endif
|
||||
private:
|
||||
@@ -166,6 +167,6 @@ private:
|
||||
|
||||
extern CHalfLife2 g_HL2;
|
||||
|
||||
edict_t *GetEntity(cell_t num, CBaseEntity **pData);
|
||||
bool IndexToAThings(cell_t, CBaseEntity **pEntData, edict_t **pEdictData);
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_CHALFLIFE2_H_
|
||||
|
||||
+44
-3
@@ -620,6 +620,43 @@ HandleError HandleSystem::CloneHandle(Handle_t handle, Handle_t *newhandle, Iden
|
||||
return CloneHandle(pHandle, index, newhandle, newOwner);
|
||||
}
|
||||
|
||||
Handle_t HandleSystem::FastCloneHandle(QHandle *pHandle, unsigned int index)
|
||||
{
|
||||
if (pHandle->clone)
|
||||
return FastCloneHandle(&m_Handles[pHandle->clone], pHandle->clone);
|
||||
|
||||
Handle_t hndl;
|
||||
if (CloneHandle(pHandle, index, &hndl, g_pCoreIdent) != HandleError_None)
|
||||
return BAD_HANDLE;
|
||||
|
||||
return hndl;
|
||||
}
|
||||
|
||||
Handle_t HandleSystem::FastCloneHandle(Handle_t hndl)
|
||||
{
|
||||
QHandle *pHandle;
|
||||
unsigned int index;
|
||||
|
||||
GetHandleUnchecked(hndl, pHandle, index);
|
||||
|
||||
return FastCloneHandle(pHandle, index);
|
||||
}
|
||||
|
||||
void HandleSystem::GetHandleUnchecked(Handle_t hndl, QHandle *& pHandle, unsigned int &index)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
unsigned int serial = (hndl >> 16);
|
||||
#endif
|
||||
index = (hndl & HANDLESYS_HANDLE_MASK);
|
||||
|
||||
assert(index != 0 && index <= m_HandleTail && index < HANDLESYS_MAX_HANDLES);
|
||||
|
||||
pHandle = &m_Handles[index];
|
||||
|
||||
assert(pHandle->set && pHandle->set != HandleSet_Freed);
|
||||
assert(pHandle->serial == serial);
|
||||
}
|
||||
|
||||
HandleError HandleSystem::FreeHandle(QHandle *pHandle, unsigned int index)
|
||||
{
|
||||
QHandleType *pType = &m_Types[pHandle->type];
|
||||
@@ -950,6 +987,10 @@ bool HandleSystem::InitAccessDefaults(TypeAccess *pTypeAccess, HandleAccess *pHa
|
||||
return true;
|
||||
}
|
||||
|
||||
#define HANDLE_LOG_VERY_BAD(message, ...) \
|
||||
g_Logger.LogFatal(message, ##__VA_ARGS__); \
|
||||
g_Logger.LogError(message, ##__VA_ARGS__);
|
||||
|
||||
bool HandleSystem::TryAndFreeSomeHandles()
|
||||
{
|
||||
IPluginIterator *pl_iter = g_PluginSys.GetPluginIterator();
|
||||
@@ -995,9 +1036,9 @@ bool HandleSystem::TryAndFreeSomeHandles()
|
||||
return false;
|
||||
}
|
||||
|
||||
g_Logger.LogFatal("[SM] MEMORY LEAK DETECTED IN PLUGIN (file \"%s\")", highest_owner->GetFilename());
|
||||
g_Logger.LogFatal("[SM] Unloading plugin to free %d handles.", highest_handle_count);
|
||||
g_Logger.LogFatal("[SM] Contact the author(s) of this plugin to correct this error.", highest_handle_count);
|
||||
HANDLE_LOG_VERY_BAD("[SM] MEMORY LEAK DETECTED IN PLUGIN (file \"%s\")", highest_owner->GetFilename());
|
||||
HANDLE_LOG_VERY_BAD("[SM] Unloading plugin to free %d handles.", highest_handle_count);
|
||||
HANDLE_LOG_VERY_BAD("[SM] Contact the author(s) of this plugin to correct this error.", highest_handle_count);
|
||||
|
||||
highest_owner->GetBaseContext()->ThrowNativeErrorEx(SP_ERROR_MEMACCESS, "Memory leak");
|
||||
|
||||
|
||||
@@ -160,6 +160,9 @@ public: //IHandleSystem
|
||||
HandleError *err);
|
||||
|
||||
void Dump(HANDLE_REPORTER rep);
|
||||
|
||||
/* Bypasses security checks. */
|
||||
Handle_t FastCloneHandle(Handle_t hndl);
|
||||
protected:
|
||||
/**
|
||||
* Decodes a handle with sanity and security checking.
|
||||
@@ -170,6 +173,9 @@ protected:
|
||||
unsigned int *index,
|
||||
bool ignoreFree=false);
|
||||
|
||||
Handle_t FastCloneHandle(QHandle *pHandle, unsigned int index);
|
||||
void GetHandleUnchecked(Handle_t hndl, QHandle *& pHandle, unsigned int &index);
|
||||
|
||||
/**
|
||||
* Creates a basic handle and sets its reference count to 1.
|
||||
* Does not do any type or security checking.
|
||||
@@ -222,4 +228,27 @@ private:
|
||||
|
||||
extern HandleSystem g_HandleSys;
|
||||
|
||||
struct AutoHandleRooter
|
||||
{
|
||||
public:
|
||||
AutoHandleRooter(Handle_t hndl)
|
||||
{
|
||||
if (hndl != BAD_HANDLE)
|
||||
this->hndl = g_HandleSys.FastCloneHandle(hndl);
|
||||
else
|
||||
this->hndl = BAD_HANDLE;
|
||||
}
|
||||
|
||||
~AutoHandleRooter()
|
||||
{
|
||||
if (hndl != BAD_HANDLE)
|
||||
{
|
||||
HandleSecurity sec(g_pCoreIdent, g_pCoreIdent);
|
||||
g_HandleSys.FreeHandle(hndl, &sec);
|
||||
}
|
||||
}
|
||||
private:
|
||||
Handle_t hndl;
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_HANDLESYSTEM_H_
|
||||
|
||||
+2
-2
@@ -241,7 +241,7 @@ bool LibrarySystem::IsPathDirectory(const char *path)
|
||||
return true;
|
||||
}
|
||||
|
||||
#elif defined PLATFORM_LINUX
|
||||
#elif defined PLATFORM_POSIX
|
||||
struct stat s;
|
||||
|
||||
if (stat(path, &s) != 0)
|
||||
@@ -410,7 +410,7 @@ size_t LibrarySystem::GetFileFromPath(char *buffer, size_t maxlength, const char
|
||||
size_t length = strlen(path);
|
||||
|
||||
for (size_t i = length - 1;
|
||||
i >= 0 && i <= length - 1;
|
||||
i <= length - 1;
|
||||
i--)
|
||||
{
|
||||
if (path[i] == '/'
|
||||
|
||||
+64
-38
@@ -2,31 +2,30 @@
|
||||
# Makefile written by David "BAILOPAN" Anderson
|
||||
|
||||
SMSDK = ..
|
||||
SRCDS_BASE = ~/srcds
|
||||
HL2SDK_ORIG = ../../hl2sdk
|
||||
HL2SDK_OB = ../../hl2sdk-ob
|
||||
HL2SDK_OB_VALVE = ../../hl2sdk-ob-valve
|
||||
HL2SDK_L4D = ../../hl2sdk-l4d
|
||||
MMSOURCE17 = ../../mmsource-1.7
|
||||
HL2SDK_L4D2 = ../../hl2sdk-l4d2
|
||||
MMSOURCE = ../../mmsource-central
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
#####################################
|
||||
|
||||
OBJECTS = AdminCache.cpp CDataPack.cpp ConCmdManager.cpp ConVarManager.cpp CoreConfig.cpp \
|
||||
Database.cpp DebugReporter.cpp EventManager.cpp GameConfigs.cpp HalfLife2.cpp Logger.cpp \
|
||||
MemoryUtils.cpp PlayerManager.cpp TimerSys.cpp Translator.cpp UserMessages.cpp \
|
||||
sm_autonatives.cpp sm_memtable.cpp sm_srvcmds.cpp sm_stringutil.cpp sm_trie.cpp \
|
||||
Database.cpp DebugReporter.cpp EventManager.cpp HalfLife2.cpp Logger.cpp \
|
||||
PlayerManager.cpp TimerSys.cpp UserMessages.cpp \
|
||||
sm_autonatives.cpp sm_srvcmds.cpp sm_stringutil.cpp sm_trie.cpp \
|
||||
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 \
|
||||
frame_hooks.cpp concmd_cleaner.cpp PhraseCollection.cpp NextMap.cpp \
|
||||
MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp \
|
||||
frame_hooks.cpp concmd_cleaner.cpp NextMap.cpp \
|
||||
NativeOwner.cpp logic_bridge.cpp ConsoleDetours.cpp
|
||||
OBJECTS += smn_admin.cpp smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
|
||||
smn_datapacks.cpp smn_entities.cpp smn_events.cpp smn_fakenatives.cpp \
|
||||
smn_filesystem.cpp smn_gameconfigs.cpp smn_halflife.cpp \
|
||||
smn_handles.cpp smn_keyvalues.cpp smn_banning.cpp \
|
||||
smn_lang.cpp smn_player.cpp smn_string.cpp smn_timers.cpp \
|
||||
smn_usermsgs.cpp smn_menus.cpp smn_database.cpp smn_vector.cpp \
|
||||
OBJECTS += smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
|
||||
smn_entities.cpp smn_events.cpp smn_fakenatives.cpp \
|
||||
smn_filesystem.cpp smn_halflife.cpp \
|
||||
smn_keyvalues.cpp smn_player.cpp \
|
||||
smn_usermsgs.cpp smn_menus.cpp smn_vector.cpp \
|
||||
smn_hudtext.cpp smn_nextmap.cpp
|
||||
OBJECTS += ExtensionSys.cpp \
|
||||
ForwardSys.cpp \
|
||||
@@ -48,55 +47,81 @@ CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||
CPP = gcc
|
||||
|
||||
override ENGSET = false
|
||||
|
||||
ifneq (,$(filter original orangebox orangeboxvalve left4dead left4dead2,$(ENGINE)))
|
||||
override ENGSET = true
|
||||
endif
|
||||
|
||||
ifeq "$(ENGINE)" "original"
|
||||
HL2SDK = $(HL2SDK_ORIG)
|
||||
HL2PUB = $(HL2SDK)/public
|
||||
HL2LIB = $(HL2SDK)/linux_sdk
|
||||
CFLAGS += -DSOURCE_ENGINE=1
|
||||
METAMOD = $(MMSOURCE17)/core-legacy
|
||||
METAMOD = $(MMSOURCE)/core-legacy
|
||||
INCLUDE += -I$(HL2SDK)/public/dlls
|
||||
SRCDS = $(SRCDS_BASE)
|
||||
BINARY = sourcemod.1.ep1.so
|
||||
override ENGSET = true
|
||||
endif
|
||||
ifeq "$(ENGINE)" "orangebox"
|
||||
HL2SDK = $(HL2SDK_OB)
|
||||
HL2PUB = $(HL2SDK)/public
|
||||
HL2LIB = $(HL2SDK)/lib/linux
|
||||
CFLAGS += -DSOURCE_ENGINE=3
|
||||
METAMOD = $(MMSOURCE17)/core
|
||||
METAMOD = $(MMSOURCE)/core
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||
SRCDS = $(SRCDS_BASE)/orangebox
|
||||
BINARY = sourcemod.2.ep2.so
|
||||
override ENGSET = true
|
||||
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 -I$(HL2SDK)/common
|
||||
SRCDS = $(SRCDS_BASE)/orangebox
|
||||
CFLAGS += -DSOURCE_ENGINE=6
|
||||
METAMOD = $(MMSOURCE)/core
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||
#-I$(HL2SDK)/common
|
||||
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
|
||||
CFLAGS += -DSOURCE_ENGINE=7
|
||||
METAMOD = $(MMSOURCE)/core
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||
SRCDS = $(SRCDS_BASE)/l4d
|
||||
BINARY = sourcemod.2.l4d.so
|
||||
override ENGSET = true
|
||||
endif
|
||||
ifeq "$(ENGINE)" "left4dead2"
|
||||
HL2SDK = $(HL2SDK_L4D2)
|
||||
HL2LIB = $(HL2SDK)/lib/linux
|
||||
CFLAGS += -DSOURCE_ENGINE=8
|
||||
METAMOD = $(MMSOURCE)/core
|
||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||
BINARY = sourcemod.2.l4d2.so
|
||||
endif
|
||||
|
||||
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 -DSE_LEFT4DEAD=5
|
||||
HL2PUB = $(HL2SDK)/public
|
||||
|
||||
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a vstdlib_i486.so \
|
||||
tier0_i486.so -static-libgcc
|
||||
OS := $(shell uname -s)
|
||||
|
||||
ifeq "$(OS)" "Darwin"
|
||||
LIB_EXT = dylib
|
||||
HL2LIB = $(HL2SDK)/lib/mac
|
||||
else
|
||||
LIB_EXT = so
|
||||
ifeq "$(ENGINE)" "original"
|
||||
HL2LIB = $(HL2SDK)/linux_sdk
|
||||
else
|
||||
HL2LIB = $(HL2SDK)/lib/linux
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter original orangebox left4dead,$(ENGINE)))
|
||||
LIB_SUFFIX = _i486.$(LIB_EXT)
|
||||
else
|
||||
LIB_PREFIX = lib
|
||||
LIB_SUFFIX = .$(LIB_EXT)
|
||||
endif
|
||||
|
||||
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 \
|
||||
-DSE_ORANGEBOXVALVE=6 -DSE_LEFT4DEAD=7 -DSE_LEFT4DEAD2=8 -DSE_ALIENSWARM=9
|
||||
|
||||
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a $(LIB_PREFIX)vstdlib$(LIB_SUFFIX) \
|
||||
$(LIB_PREFIX)tier0$(LIB_SUFFIX) -static-libgcc
|
||||
|
||||
INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \
|
||||
-I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook \
|
||||
@@ -136,13 +161,14 @@ $(BIN_DIR)/%.o: %.c
|
||||
|
||||
all: check
|
||||
mkdir -p $(BIN_DIR)
|
||||
ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so;
|
||||
ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so;
|
||||
ln -sf $(HL2LIB)/$(LIB_PREFIX)vstdlib$(LIB_SUFFIX)
|
||||
ln -sf $(HL2LIB)/$(LIB_PREFIX)tier0$(LIB_SUFFIX)
|
||||
$(MAKE) -f Makefile sourcemod
|
||||
|
||||
check:
|
||||
if [ "$(ENGSET)" = "false" ]; then \
|
||||
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
|
||||
echo "You must supply one of the following values for ENGINE:"; \
|
||||
echo "left4dead2, left4dead, orangeboxvalve, orangebox, or original"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,220 +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 "MemoryUtils.h"
|
||||
#include "ShareSys.h"
|
||||
#ifdef PLATFORM_LINUX
|
||||
#include <string.h>
|
||||
#include <elf.h>
|
||||
#endif
|
||||
|
||||
MemoryUtils g_MemUtils;
|
||||
|
||||
#if 0
|
||||
MemoryUtils::MemoryUtils()
|
||||
{
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
|
||||
SYSTEM_INFO info;
|
||||
GetSystemInfo(&info);
|
||||
|
||||
m_PageSize = info.dwPageSize;
|
||||
|
||||
#elif defined PLATFORM_POSIX
|
||||
|
||||
m_PageSize = sysconf(_SC_PAGE_SIZE);
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void MemoryUtils::OnSourceModAllInitialized()
|
||||
{
|
||||
g_ShareSys.AddInterface(NULL, this);
|
||||
}
|
||||
|
||||
void *MemoryUtils::FindPattern(const void *libPtr, const char *pattern, size_t len)
|
||||
{
|
||||
DynLibInfo lib;
|
||||
bool found;
|
||||
char *ptr, *end;
|
||||
|
||||
memset(&lib, 0, sizeof(DynLibInfo));
|
||||
|
||||
if (!GetLibraryInfo(libPtr, lib))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr = reinterpret_cast<char *>(lib.baseAddress);
|
||||
end = ptr + lib.memorySize;
|
||||
|
||||
while (ptr < end)
|
||||
{
|
||||
found = true;
|
||||
for (register size_t i = 0; i < len; i++)
|
||||
{
|
||||
if (pattern[i] != '\x2A' && pattern[i] != ptr[i])
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
return ptr;
|
||||
|
||||
ptr++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool MemoryUtils::GetLibraryInfo(const void *libPtr, DynLibInfo &lib)
|
||||
{
|
||||
unsigned long baseAddr;
|
||||
|
||||
if (libPtr == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
|
||||
MEMORY_BASIC_INFORMATION info;
|
||||
IMAGE_DOS_HEADER *dos;
|
||||
IMAGE_NT_HEADERS *pe;
|
||||
IMAGE_FILE_HEADER *file;
|
||||
IMAGE_OPTIONAL_HEADER *opt;
|
||||
|
||||
if (!VirtualQuery(libPtr, &info, sizeof(MEMORY_BASIC_INFORMATION)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
baseAddr = reinterpret_cast<unsigned long>(info.AllocationBase);
|
||||
|
||||
/* All this is for our insane sanity checks :o */
|
||||
dos = reinterpret_cast<IMAGE_DOS_HEADER *>(baseAddr);
|
||||
pe = reinterpret_cast<IMAGE_NT_HEADERS *>(baseAddr + dos->e_lfanew);
|
||||
file = &pe->FileHeader;
|
||||
opt = &pe->OptionalHeader;
|
||||
|
||||
/* Check PE magic and signature */
|
||||
if (dos->e_magic != IMAGE_DOS_SIGNATURE || pe->Signature != IMAGE_NT_SIGNATURE || opt->Magic != IMAGE_NT_OPTIONAL_HDR32_MAGIC)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check architecture, which is 32-bit/x86 right now
|
||||
* Should change this for 64-bit if Valve gets their act together
|
||||
*/
|
||||
if (file->Machine != IMAGE_FILE_MACHINE_I386)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* For our purposes, this must be a dynamic library */
|
||||
if ((file->Characteristics & IMAGE_FILE_DLL) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Finally, we can do this */
|
||||
lib.memorySize = opt->SizeOfImage;
|
||||
|
||||
#elif defined PLATFORM_LINUX
|
||||
|
||||
Dl_info info;
|
||||
Elf32_Ehdr *file;
|
||||
Elf32_Phdr *phdr;
|
||||
uint16_t phdrCount;
|
||||
|
||||
if (!dladdr(libPtr, &info))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!info.dli_fbase || !info.dli_fname)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* This is for our insane sanity checks :o */
|
||||
baseAddr = reinterpret_cast<unsigned long>(info.dli_fbase);
|
||||
file = reinterpret_cast<Elf32_Ehdr *>(baseAddr);
|
||||
|
||||
/* Check ELF magic */
|
||||
if (memcmp(ELFMAG, file->e_ident, SELFMAG) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check ELF version */
|
||||
if (file->e_ident[EI_VERSION] != EV_CURRENT)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check ELF architecture, which is 32-bit/x86 right now
|
||||
* Should change this for 64-bit if Valve gets their act together
|
||||
*/
|
||||
if (file->e_ident[EI_CLASS] != ELFCLASS32 || file->e_machine != EM_386 || file->e_ident[EI_DATA] != ELFDATA2LSB)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* For our purposes, this must be a dynamic library/shared object */
|
||||
if (file->e_type != ET_DYN)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
phdrCount = file->e_phnum;
|
||||
phdr = reinterpret_cast<Elf32_Phdr *>(baseAddr + file->e_phoff);
|
||||
|
||||
/* Add up the memory sizes of segments marked as PT_LOAD as those are the only ones that should be in memory */
|
||||
for (uint16_t i = 0; i < phdrCount; i++)
|
||||
{
|
||||
Elf32_Phdr &hdr = phdr[i];
|
||||
|
||||
if (hdr.p_type == PT_LOAD)
|
||||
{
|
||||
lib.memorySize += hdr.p_memsz;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
lib.baseAddress = reinterpret_cast<void *>(baseAddr);
|
||||
|
||||
return true;
|
||||
}
|
||||
+25
-5
@@ -41,7 +41,7 @@
|
||||
#include "ShareSys.h"
|
||||
#include "HandleSys.h"
|
||||
#include "sourcemm_api.h"
|
||||
#include "Translator.h"
|
||||
#include "logic_bridge.h"
|
||||
|
||||
MenuManager g_Menus;
|
||||
VoteMenuHandler s_VoteHandler;
|
||||
@@ -231,6 +231,7 @@ IMenuPanel *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder ord
|
||||
unsigned int pgn = menu->GetPagination();
|
||||
unsigned int maxItems = style->GetMaxPageItems();
|
||||
bool exitButton = (menu->GetMenuOptionFlags() & MENUFLAG_BUTTON_EXIT) == MENUFLAG_BUTTON_EXIT;
|
||||
bool novoteButton = (menu->GetMenuOptionFlags() & MENUFLAG_BUTTON_NOVOTE) == MENUFLAG_BUTTON_NOVOTE;
|
||||
|
||||
if (pgn != MENU_NO_PAGINATION)
|
||||
{
|
||||
@@ -241,6 +242,11 @@ IMenuPanel *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder ord
|
||||
maxItems--;
|
||||
}
|
||||
|
||||
if (novoteButton)
|
||||
{
|
||||
maxItems--;
|
||||
}
|
||||
|
||||
/* This is very not allowed! */
|
||||
if (maxItems < 2)
|
||||
{
|
||||
@@ -436,6 +442,20 @@ skip_search:
|
||||
/* Draw the item according to the order */
|
||||
menu_slots_t *slots = md.slots;
|
||||
unsigned int position = 0; /* Keep track of the last position */
|
||||
|
||||
if (novoteButton)
|
||||
{
|
||||
char text[50];
|
||||
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "No Vote", &client))
|
||||
{
|
||||
UTIL_Format(text, sizeof(text), "No Vote");
|
||||
}
|
||||
ItemDrawInfo dr(text, 0);
|
||||
position = panel->DrawItem(dr);
|
||||
slots[position].type = ItemSel_Exit;
|
||||
position++;
|
||||
}
|
||||
|
||||
if (order == ItemOrder_Ascending)
|
||||
{
|
||||
md.item_on_page = drawItems[0].position;
|
||||
@@ -586,7 +606,7 @@ skip_search:
|
||||
{
|
||||
if (exitBackButton)
|
||||
{
|
||||
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Back", &client))
|
||||
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Back", &client))
|
||||
{
|
||||
UTIL_Format(text, sizeof(text), "Back");
|
||||
}
|
||||
@@ -596,7 +616,7 @@ skip_search:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Previous", &client))
|
||||
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Previous", &client))
|
||||
{
|
||||
UTIL_Format(text, sizeof(text), "Previous");
|
||||
}
|
||||
@@ -617,7 +637,7 @@ skip_search:
|
||||
/* NEXT */
|
||||
if (displayNext || canDrawDisabled)
|
||||
{
|
||||
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Next", &client))
|
||||
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Next", &client))
|
||||
{
|
||||
UTIL_Format(text, sizeof(text), "Next");
|
||||
}
|
||||
@@ -648,7 +668,7 @@ skip_search:
|
||||
/* EXIT */
|
||||
if (exitButton)
|
||||
{
|
||||
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Exit", &client))
|
||||
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Exit", &client))
|
||||
{
|
||||
UTIL_Format(text, sizeof(text), "Exit");
|
||||
}
|
||||
|
||||
@@ -377,6 +377,9 @@ void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
|
||||
RemoveClientFromWatch(client);
|
||||
}
|
||||
|
||||
Handle_t hndl = menu ? menu->GetHandle() : BAD_HANDLE;
|
||||
AutoHandleRooter ahr(hndl);
|
||||
|
||||
if (cancel)
|
||||
{
|
||||
mh->OnMenuCancel(menu, client, reason);
|
||||
|
||||
@@ -32,11 +32,12 @@
|
||||
#include "MenuStyle_Radio.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "UserMessages.h"
|
||||
#include "GameConfigs.h"
|
||||
#include <IGameConfigs.h>
|
||||
#include "PlayerManager.h"
|
||||
#if defined MENU_DEBUG
|
||||
#include "Logger.h"
|
||||
#endif
|
||||
#include "logic_bridge.h"
|
||||
|
||||
extern const char *g_RadioNumTable[];
|
||||
CRadioStyle g_RadioMenuStyle;
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "sm_stringutil.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "MenuStyle_Valve.h"
|
||||
#include "Translator.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "ConCmdManager.h"
|
||||
|
||||
|
||||
+11
-6
@@ -39,7 +39,8 @@
|
||||
#include <HalfLife2.h>
|
||||
#include <mathlib.h>
|
||||
#include <const.h>
|
||||
#include <Translator.h>
|
||||
#include <ITranslator.h>
|
||||
#include "logic_bridge.h"
|
||||
|
||||
float g_next_vote = 0.0f;
|
||||
|
||||
@@ -526,7 +527,8 @@ void VoteMenuHandler::OnMenuSelect(IBaseMenu *menu, int client, unsigned int ite
|
||||
if (sm_vote_console.GetBool())
|
||||
{
|
||||
int target = SOURCEMOD_SERVER_LANGUAGE;
|
||||
CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Voted For", &target, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
logicore.CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Voted For",
|
||||
&target, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
Engine_LogPrintWrapper(buffer);
|
||||
}
|
||||
|
||||
@@ -538,15 +540,17 @@ void VoteMenuHandler::OnMenuSelect(IBaseMenu *menu, int client, unsigned int ite
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
|
||||
assert(pPlayer);
|
||||
|
||||
if (pPlayer->IsInGame())
|
||||
if (pPlayer->IsInGame() && !pPlayer->IsFakeClient())
|
||||
{
|
||||
if (m_Revoting[client])
|
||||
{
|
||||
CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Changed Vote", &i, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
logicore.CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Changed Vote",
|
||||
&i, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
}
|
||||
else
|
||||
{
|
||||
CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Voted For", &i, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
logicore.CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Voted For",
|
||||
&i, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
|
||||
}
|
||||
|
||||
if (sm_vote_chat.GetBool())
|
||||
@@ -634,7 +638,8 @@ void VoteMenuHandler::DrawHintProgress()
|
||||
{
|
||||
if (g_Players.GetPlayerByIndex(i)->IsInGame())
|
||||
{
|
||||
CoreTranslate(buffer, sizeof(buffer), "%T%s", 6, NULL, "Vote Count", &i, &m_NumVotes, &m_TotalClients, &iTimeRemaining, &m_leaderList);
|
||||
logicore.CoreTranslate(buffer, sizeof(buffer), "%T%s", 6, NULL, "Vote Count",
|
||||
&i, &m_NumVotes, &m_TotalClients, &iTimeRemaining, &m_leaderList);
|
||||
g_HL2.HintTextMsg(i, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -49,7 +49,11 @@ 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
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
# if SH_IMPL_VERSION >= 4
|
||||
extern int __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
# else
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
#endif
|
||||
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
#endif
|
||||
|
||||
|
||||
+147
-50
@@ -39,23 +39,24 @@
|
||||
#include "sm_stringutil.h"
|
||||
#include "CoreConfig.h"
|
||||
#include "TimerSys.h"
|
||||
#include "Translator.h"
|
||||
#include "Logger.h"
|
||||
#include "ChatTriggers.h"
|
||||
#include "HalfLife2.h"
|
||||
#include <inetchannel.h>
|
||||
#include <iclient.h>
|
||||
#include "GameConfigs.h"
|
||||
#include <tier0/icommandline.h>
|
||||
#include <IGameConfigs.h>
|
||||
#include "ExtensionSys.h"
|
||||
#include <sourcemod_version.h>
|
||||
#include "ConsoleDetours.h"
|
||||
#include "logic_bridge.h"
|
||||
|
||||
PlayerManager g_Players;
|
||||
bool g_OnMapStarted = false;
|
||||
IForward *PreAdminCheck = NULL;
|
||||
IForward *PostAdminCheck = NULL;
|
||||
IForward *PostAdminFilter = NULL;
|
||||
IForward *OnClientConnected = NULL;
|
||||
|
||||
const unsigned int *g_NumPlayersToAuth = NULL;
|
||||
int lifestate_offset = -1;
|
||||
List<ICommandTargetProcessor *> target_processors;
|
||||
@@ -76,7 +77,11 @@ 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
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
# if SH_IMPL_VERSION >= 4
|
||||
extern int __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
# else
|
||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
# endif
|
||||
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||
#endif
|
||||
|
||||
@@ -109,6 +114,9 @@ PlayerManager::PlayerManager()
|
||||
m_FirstPass = false;
|
||||
m_maxClients = 0;
|
||||
|
||||
m_SourceTVUserId = -1;
|
||||
m_ReplayUserId = -1;
|
||||
|
||||
m_UserIdLookUp = new int[USHRT_MAX+1];
|
||||
memset(m_UserIdLookUp, 0, sizeof(int) * (USHRT_MAX+1));
|
||||
}
|
||||
@@ -138,6 +146,7 @@ void PlayerManager::OnSourceModAllInitialized()
|
||||
ParamType p2[] = {Param_Cell};
|
||||
|
||||
m_clconnect = g_Forwards.CreateForward("OnClientConnect", ET_LowEvent, 3, p1);
|
||||
m_clconnect_post = g_Forwards.CreateForward("OnClientConnected", ET_Ignore, 1, p2);
|
||||
m_clputinserver = g_Forwards.CreateForward("OnClientPutInServer", ET_Ignore, 1, p2);
|
||||
m_cldisconnect = g_Forwards.CreateForward("OnClientDisconnect", ET_Ignore, 1, p2);
|
||||
m_cldisconnect_post = g_Forwards.CreateForward("OnClientDisconnect_Post", ET_Ignore, 1, p2);
|
||||
@@ -146,7 +155,6 @@ void PlayerManager::OnSourceModAllInitialized()
|
||||
m_clauth = g_Forwards.CreateForward("OnClientAuthorized", ET_Ignore, 2, NULL, Param_Cell, Param_String);
|
||||
m_onActivate = g_Forwards.CreateForward("OnServerLoad", ET_Ignore, 0, NULL);
|
||||
m_onActivate2 = g_Forwards.CreateForward("OnMapStart", ET_Ignore, 0, NULL);
|
||||
OnClientConnected = g_Forwards.CreateForward("OnClientConnected", ET_Ignore, 1, p2);
|
||||
|
||||
PreAdminCheck = g_Forwards.CreateForward("OnClientPreAdminCheck", ET_Event, 1, p1);
|
||||
PostAdminCheck = g_Forwards.CreateForward("OnClientPostAdminCheck", ET_Ignore, 1, p1);
|
||||
@@ -155,8 +163,6 @@ void PlayerManager::OnSourceModAllInitialized()
|
||||
m_bIsListenServer = !engine->IsDedicatedServer();
|
||||
m_ListenClient = 0;
|
||||
|
||||
g_ConVarManager.AddConVarChangeListener("tv_enable", this);
|
||||
|
||||
ConCommand *pCmd = FindCommand("maxplayers");
|
||||
if (pCmd != NULL)
|
||||
{
|
||||
@@ -168,6 +174,7 @@ void PlayerManager::OnSourceModAllInitialized()
|
||||
void PlayerManager::OnSourceModShutdown()
|
||||
{
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverClients, this, &PlayerManager::OnClientConnect, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverClients, this, &PlayerManager::OnClientConnect_Post, true);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientPutInServer, serverClients, this, &PlayerManager::OnClientPutInServer, true);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverClients, this, &PlayerManager::OnClientDisconnect, false);
|
||||
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverClients, this, &PlayerManager::OnClientDisconnect_Post, true);
|
||||
@@ -177,6 +184,7 @@ void PlayerManager::OnSourceModShutdown()
|
||||
|
||||
/* Release forwards */
|
||||
g_Forwards.ReleaseForward(m_clconnect);
|
||||
g_Forwards.ReleaseForward(m_clconnect_post);
|
||||
g_Forwards.ReleaseForward(m_clputinserver);
|
||||
g_Forwards.ReleaseForward(m_cldisconnect);
|
||||
g_Forwards.ReleaseForward(m_cldisconnect_post);
|
||||
@@ -185,7 +193,6 @@ void PlayerManager::OnSourceModShutdown()
|
||||
g_Forwards.ReleaseForward(m_clauth);
|
||||
g_Forwards.ReleaseForward(m_onActivate);
|
||||
g_Forwards.ReleaseForward(m_onActivate2);
|
||||
g_Forwards.ReleaseForward(OnClientConnected);
|
||||
|
||||
g_Forwards.ReleaseForward(PreAdminCheck);
|
||||
g_Forwards.ReleaseForward(PostAdminCheck);
|
||||
@@ -193,8 +200,6 @@ void PlayerManager::OnSourceModShutdown()
|
||||
|
||||
delete [] m_Players;
|
||||
|
||||
g_ConVarManager.RemoveConVarChangeListener("tv_enable", this);
|
||||
|
||||
if (maxplayersCmd != NULL)
|
||||
{
|
||||
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, maxplayersCmd, CmdMaxplayersCallback, true);
|
||||
@@ -231,10 +236,25 @@ ConfigResult PlayerManager::OnSourceModConfigChanged(const char *key,
|
||||
|
||||
void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
||||
{
|
||||
static ConVar *tv_enable = icvar->FindVar("tv_enable");
|
||||
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
||||
static ConVar *replay_enable = icvar->FindVar("replay_enable");
|
||||
#endif
|
||||
|
||||
// clientMax will not necessarily be correct here (such as on late SourceTV enable)
|
||||
m_maxClients = gpGlobals->maxClients;
|
||||
|
||||
m_bIsSourceTVActive = (tv_enable && tv_enable->GetBool() && CommandLine()->FindParm("-nohltv") == 0);
|
||||
m_bIsReplayActive = false;
|
||||
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
||||
m_bIsReplayActive = (replay_enable && replay_enable->GetBool());
|
||||
#endif
|
||||
m_PlayersSinceActive = 0;
|
||||
|
||||
if (!m_FirstPass)
|
||||
{
|
||||
/* Initialize all players */
|
||||
m_maxClients = clientMax;
|
||||
|
||||
m_PlayerCount = 0;
|
||||
m_Players = new CPlayer[ABSOLUTE_PLAYER_LIMIT + 1];
|
||||
m_AuthQueue = new unsigned int[ABSOLUTE_PLAYER_LIMIT + 1];
|
||||
@@ -244,9 +264,12 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
|
||||
|
||||
g_NumPlayersToAuth = &m_AuthQueue[0];
|
||||
|
||||
g_PluginSys.SyncMaxClients(clientMax);
|
||||
g_PluginSys.SyncMaxClients(m_maxClients);
|
||||
}
|
||||
g_Extensions.CallOnCoreMapStart(pEdictList, edictCount, clientMax);
|
||||
|
||||
g_OnMapStarted = true;
|
||||
|
||||
g_Extensions.CallOnCoreMapStart(pEdictList, edictCount, m_maxClients);
|
||||
m_onActivate->Execute(NULL);
|
||||
m_onActivate2->Execute(NULL);
|
||||
|
||||
@@ -255,12 +278,10 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
|
||||
{
|
||||
if ((*iter)->GetClientListenerVersion() >= 5)
|
||||
{
|
||||
(*iter)->OnServerActivated(clientMax);
|
||||
(*iter)->OnServerActivated(m_maxClients);
|
||||
}
|
||||
}
|
||||
|
||||
g_OnMapStarted = true;
|
||||
|
||||
SMGlobalClass *cls = SMGlobalClass::head;
|
||||
while (cls)
|
||||
{
|
||||
@@ -406,7 +427,23 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
|
||||
{
|
||||
int client = IndexOfEdict(pEntity);
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
++m_PlayersSinceActive;
|
||||
|
||||
pPlayer->Initialize(pszName, pszAddress, pEntity);
|
||||
|
||||
/* Get the client's language */
|
||||
if (m_QueryLang)
|
||||
{
|
||||
const char *name;
|
||||
if (!pPlayer->IsFakeClient() && (name=engine->GetClientConVarValue(client, "cl_language")))
|
||||
{
|
||||
unsigned int langid;
|
||||
pPlayer->m_LangId = (translator->GetLanguageByName(name, &langid)) ? langid : translator->GetServerLanguage();
|
||||
} else {
|
||||
pPlayer->m_LangId = translator->GetServerLanguage();
|
||||
}
|
||||
}
|
||||
|
||||
List<IClientListener *>::iterator iter;
|
||||
IClientListener *pListener = NULL;
|
||||
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
|
||||
@@ -420,7 +457,6 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
|
||||
|
||||
cell_t res = 1;
|
||||
|
||||
pPlayer->Initialize(pszName, pszAddress, pEntity);
|
||||
m_clconnect->PushCell(client);
|
||||
m_clconnect->PushStringEx(reject, maxrejectlen, SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
|
||||
m_clconnect->PushCell(maxrejectlen);
|
||||
@@ -462,7 +498,7 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
|
||||
pListener->OnClientConnected(client);
|
||||
if (!pPlayer->IsConnected())
|
||||
{
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,8 +510,8 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
|
||||
}
|
||||
|
||||
cell_t res;
|
||||
OnClientConnected->PushCell(client);
|
||||
OnClientConnected->Execute(&res, NULL);
|
||||
m_clconnect_post->PushCell(client);
|
||||
m_clconnect_post->Execute(&res, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -499,6 +535,40 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
|
||||
const char *authid = engine->GetPlayerNetworkIDString(pEntity);
|
||||
pPlayer->Authorize(authid);
|
||||
pPlayer->m_bFakeClient = true;
|
||||
|
||||
/*
|
||||
* While we're already filtered to just bots, we'll do other checks to
|
||||
* make sure that the requisite services are enabled and that the bots
|
||||
* have joined at the expected time.
|
||||
*
|
||||
* Checking playerinfo's IsHLTV and IsReplay would be better and less
|
||||
* error-prone but will always show false until later in the frame,
|
||||
* after PutInServer and Activate, and we want it now!
|
||||
*/
|
||||
|
||||
// This doesn't actually get incremented until OnClientConnect. Fake it to check.
|
||||
int newCount = m_PlayersSinceActive + 1;
|
||||
int userId = engine->GetPlayerUserId(pEntity);
|
||||
|
||||
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
||||
if (m_bIsReplayActive && newCount == 1
|
||||
&& (m_ReplayUserId == userId || strcmp(playername, "Replay") == 0))
|
||||
{
|
||||
pPlayer->m_bIsReplay = true;
|
||||
m_ReplayUserId = userId;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m_bIsSourceTVActive
|
||||
&& ((!m_bIsReplayActive && newCount == 1)
|
||||
|| (m_bIsReplayActive && newCount == 2))
|
||||
&& (m_SourceTVUserId == userId || strcmp(playername, "SourceTV") == 0)
|
||||
)
|
||||
{
|
||||
pPlayer->m_bIsSourceTV = true;
|
||||
m_SourceTVUserId = userId;
|
||||
}
|
||||
|
||||
if (!OnClientConnect(pEntity, playername, "127.0.0.1", error, sizeof(error)))
|
||||
{
|
||||
/* :TODO: kick the bot if it's rejected */
|
||||
@@ -516,6 +586,11 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cell_t res;
|
||||
m_clconnect_post->PushCell(client);
|
||||
m_clconnect_post->Execute(&res, NULL);
|
||||
|
||||
/* Now do authorization */
|
||||
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
|
||||
{
|
||||
@@ -537,19 +612,6 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
|
||||
pPlayer->m_Info = playerinfo->GetPlayerInfo(pEntity);
|
||||
}
|
||||
|
||||
/* Get the client's language */
|
||||
if (m_QueryLang)
|
||||
{
|
||||
const char *name;
|
||||
if (!pPlayer->IsFakeClient() && (name=engine->GetClientConVarValue(client, "cl_language")))
|
||||
{
|
||||
unsigned int langid;
|
||||
pPlayer->m_LangId = (g_Translator.GetLanguageByName(name, &langid)) ? langid : g_Translator.GetServerLanguage();
|
||||
} else {
|
||||
pPlayer->m_LangId = g_Translator.GetServerLanguage();
|
||||
}
|
||||
}
|
||||
|
||||
pPlayer->Connect();
|
||||
m_PlayerCount++;
|
||||
|
||||
@@ -690,7 +752,7 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
|
||||
ClientConsolePrint(pEntity,
|
||||
" David \"BAILOPAN\" Anderson, Borja \"faluco\" Ferrer");
|
||||
ClientConsolePrint(pEntity,
|
||||
" Scott \"Damaged Soul\" Ehlert, Matt \"pRED\" Woodrow");
|
||||
" Scott \"DS\" Ehlert, Matt \"pRED\" Woodrow");
|
||||
ClientConsolePrint(pEntity,
|
||||
" Michael \"ferret\" McKoy, Pavol \"PM OnoTo\" Marko");
|
||||
ClientConsolePrint(pEntity,
|
||||
@@ -827,6 +889,17 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Notify Extensions */
|
||||
List<IClientListener *>::iterator iter;
|
||||
IClientListener *pListener = NULL;
|
||||
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
|
||||
{
|
||||
pListener = (*iter);
|
||||
if (pListener->GetClientListenerVersion() >= 13)
|
||||
{
|
||||
pListener->OnClientSettingsChanged(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int PlayerManager::GetMaxClients()
|
||||
@@ -1296,7 +1369,7 @@ void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stristr(pTarget->GetName(), info->pattern) != NULL)
|
||||
if (logicore.stristr(pTarget->GetName(), info->pattern) != NULL)
|
||||
{
|
||||
if (found_client)
|
||||
{
|
||||
@@ -1334,18 +1407,6 @@ void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerManager::OnConVarChanged( ConVar *pConVar, const char *oldValue, float flOldValue )
|
||||
{
|
||||
if (pConVar->GetBool() && !atoi(oldValue))
|
||||
{
|
||||
MaxPlayersChanged(gpGlobals->maxClients + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MaxPlayersChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerManager::OnSourceModMaxPlayersChanged( int newvalue )
|
||||
{
|
||||
m_maxClients = newvalue;
|
||||
@@ -1437,10 +1498,14 @@ CPlayer::CPlayer()
|
||||
m_TempAdmin = false;
|
||||
m_Info = NULL;
|
||||
m_bAdminCheckSignalled = false;
|
||||
m_UserId = -1;
|
||||
m_bIsInKickQueue = false;
|
||||
m_LastPassword.clear();
|
||||
m_LangId = SOURCEMOD_LANGUAGE_ENGLISH;
|
||||
m_bFakeClient = false;
|
||||
m_bIsSourceTV = false;
|
||||
m_bIsReplay = false;
|
||||
m_Serial.value = -1;
|
||||
}
|
||||
|
||||
void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
|
||||
@@ -1450,7 +1515,7 @@ void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
|
||||
m_Ip.assign(ip);
|
||||
m_pEdict = pEntity;
|
||||
m_iIndex = IndexOfEdict(pEntity);
|
||||
m_LangId = g_Translator.GetServerLanguage();
|
||||
m_LangId = translator->GetServerLanguage();
|
||||
|
||||
m_Serial.bits.index = m_iIndex;
|
||||
m_Serial.bits.serial = g_PlayerSerialCount++;
|
||||
@@ -1512,6 +1577,9 @@ void CPlayer::Disconnect()
|
||||
m_UserId = -1;
|
||||
m_bIsInKickQueue = false;
|
||||
m_bFakeClient = false;
|
||||
m_bIsSourceTV = false;
|
||||
m_bIsReplay = false;
|
||||
m_Serial.value = -1;
|
||||
}
|
||||
|
||||
void CPlayer::SetName(const char *name)
|
||||
@@ -1579,6 +1647,16 @@ bool CPlayer::IsFakeClient()
|
||||
return m_bFakeClient;
|
||||
}
|
||||
|
||||
bool CPlayer::IsSourceTV() const
|
||||
{
|
||||
return m_bIsSourceTV;
|
||||
}
|
||||
|
||||
bool CPlayer::IsReplay() const
|
||||
{
|
||||
return m_bIsReplay;
|
||||
}
|
||||
|
||||
void CPlayer::SetAdminId(AdminId id, bool temporary)
|
||||
{
|
||||
if (!m_IsConnected)
|
||||
@@ -1614,8 +1692,22 @@ void CPlayer::Kick(const char *str)
|
||||
{
|
||||
MarkAsBeingKicked();
|
||||
INetChannel *pNetChan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(m_iIndex));
|
||||
IClient *pClient = static_cast<IClient *>(pNetChan->GetMsgHandler());
|
||||
pClient->Disconnect("%s", str);
|
||||
if (pNetChan == NULL)
|
||||
{
|
||||
/* What does this even mean? Hell if I know. */
|
||||
int userid = GetUserId();
|
||||
if (userid > 0)
|
||||
{
|
||||
char buffer[255];
|
||||
UTIL_Format(buffer, sizeof(buffer), "kickid %d %s\n", userid, str);
|
||||
engine->ServerCommand(buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IClient *pClient = static_cast<IClient *>(pNetChan->GetMsgHandler());
|
||||
pClient->Disconnect("%s", str);
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayer::Authorize_Post()
|
||||
@@ -1757,6 +1849,11 @@ unsigned int CPlayer::GetLanguageId()
|
||||
return m_LangId;
|
||||
}
|
||||
|
||||
void CPlayer::SetLanguageId(unsigned int id)
|
||||
{
|
||||
m_LangId = id;
|
||||
}
|
||||
|
||||
int CPlayer::GetUserId()
|
||||
{
|
||||
if (m_UserId == -1)
|
||||
|
||||
+12
-4
@@ -76,12 +76,15 @@ public:
|
||||
bool IsConnected();
|
||||
bool IsAuthorized();
|
||||
bool IsFakeClient();
|
||||
bool IsSourceTV() const;
|
||||
bool IsReplay() const;
|
||||
void SetAdminId(AdminId id, bool temporary);
|
||||
AdminId GetAdminId();
|
||||
void Kick(const char *str);
|
||||
bool IsInKickQueue();
|
||||
IPlayerInfo *GetPlayerInfo();
|
||||
unsigned int GetLanguageId();
|
||||
void SetLanguageId(unsigned int id);
|
||||
int GetUserId();
|
||||
bool RunAdminCacheChecks();
|
||||
void NotifyPostAdminChecks();
|
||||
@@ -118,13 +121,14 @@ private:
|
||||
unsigned int m_LangId;
|
||||
int m_UserId;
|
||||
bool m_bFakeClient;
|
||||
bool m_bIsSourceTV;
|
||||
bool m_bIsReplay;
|
||||
serial_t m_Serial;
|
||||
};
|
||||
|
||||
class PlayerManager :
|
||||
public SMGlobalClass,
|
||||
public IPlayerManager,
|
||||
public IConVarChangeListener
|
||||
public IPlayerManager
|
||||
{
|
||||
friend class CPlayer;
|
||||
public:
|
||||
@@ -169,8 +173,6 @@ public: //IPlayerManager
|
||||
void UnregisterCommandTargetProcessor(ICommandTargetProcessor *pHandler);
|
||||
void ProcessCommandTarget(cmd_target_info_t *info);
|
||||
int GetClientFromSerial(unsigned int serial);
|
||||
public: // IConVarChangeListener
|
||||
void OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue);
|
||||
public:
|
||||
inline int MaxClients()
|
||||
{
|
||||
@@ -197,6 +199,7 @@ private:
|
||||
private:
|
||||
List<IClientListener *> m_hooks;
|
||||
IForward *m_clconnect;
|
||||
IForward *m_clconnect_post;
|
||||
IForward *m_cldisconnect;
|
||||
IForward *m_cldisconnect_post;
|
||||
IForward *m_clputinserver;
|
||||
@@ -209,12 +212,17 @@ private:
|
||||
int *m_UserIdLookUp;
|
||||
int m_maxClients;
|
||||
int m_PlayerCount;
|
||||
int m_PlayersSinceActive;
|
||||
bool m_FirstPass;
|
||||
unsigned int *m_AuthQueue;
|
||||
String m_PassInfoVar;
|
||||
bool m_QueryLang;
|
||||
bool m_bIsListenServer;
|
||||
int m_ListenClient;
|
||||
bool m_bIsSourceTVActive;
|
||||
bool m_bIsReplayActive;
|
||||
int m_SourceTVUserId;
|
||||
int m_ReplayUserId;
|
||||
};
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
|
||||
+15
-11
@@ -44,7 +44,7 @@
|
||||
#include "ConCmdManager.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "CoreConfig.h"
|
||||
#include "Translator.h"
|
||||
#include "logic_bridge.h"
|
||||
|
||||
CPluginManager g_PluginSys;
|
||||
HandleType_t g_PluginType = 0;
|
||||
@@ -67,7 +67,7 @@ CPlugin::CPlugin(const char *file)
|
||||
m_FakeNativesMissing = false;
|
||||
m_LibraryMissing = false;
|
||||
m_bGotAllLoaded = false;
|
||||
m_pPhrases = g_Translator.CreatePhraseCollection();
|
||||
m_pPhrases = translator->CreatePhraseCollection();
|
||||
m_MaxClientsVar = NULL;
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ void CPlugin::Call_OnAllPluginsLoaded()
|
||||
pFunction->Execute(&result);
|
||||
}
|
||||
|
||||
if (g_OnMapStarted)
|
||||
if (g_SourceMod.IsMapRunning())
|
||||
{
|
||||
if ((pFunction = m_pRuntime->GetFunctionByName("OnMapStart")) != NULL)
|
||||
{
|
||||
@@ -1125,7 +1125,7 @@ void CPluginManager::LoadAutoPlugin(const char *plugin)
|
||||
{
|
||||
g_Logger.LogError("[SM] Failed to load plugin \"%s\": %s", plugin, error);
|
||||
pl->SetErrorState(
|
||||
pl->GetStatus() == Plugin_BadLoad ? Plugin_BadLoad : Plugin_Failed,
|
||||
pl->GetStatus() <= Plugin_Created ? Plugin_BadLoad : pl->GetStatus(),
|
||||
"%s",
|
||||
error);
|
||||
}
|
||||
@@ -1308,7 +1308,8 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass
|
||||
if (ext->autoload)
|
||||
{
|
||||
g_LibSys.PathFormat(path, PLATFORM_MAX_PATH, "%s", file);
|
||||
g_Extensions.LoadAutoExtension(path);
|
||||
bool bErrorOnMissing = ext->required ? true : false;
|
||||
g_Extensions.LoadAutoExtension(path, bErrorOnMissing);
|
||||
}
|
||||
}
|
||||
else if (pass == 2)
|
||||
@@ -2052,7 +2053,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
|
||||
char pluginfile[256];
|
||||
const char *ext = g_LibSys.GetFileExtension(filename) ? "" : ".smx";
|
||||
UTIL_Format(pluginfile, sizeof(pluginfile), "%s%s", filename, ext);
|
||||
g_SourceMod.BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", filename, ext);
|
||||
|
||||
IPlugin *pl = LoadPlugin(pluginfile, false, PluginType_MapUpdated, error, sizeof(error), &wasloaded);
|
||||
|
||||
@@ -2099,7 +2100,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
{
|
||||
char pluginfile[256];
|
||||
const char *ext = g_LibSys.GetFileExtension(arg) ? "" : ".smx";
|
||||
UTIL_Format(pluginfile, sizeof(pluginfile), "%s%s", arg, ext);
|
||||
g_SourceMod.BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", arg, ext);
|
||||
|
||||
if (!sm_trie_retrieve(m_LoadLookup, pluginfile, (void **)&pl))
|
||||
{
|
||||
@@ -2189,7 +2190,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
{
|
||||
char pluginfile[256];
|
||||
const char *ext = g_LibSys.GetFileExtension(arg) ? "" : ".smx";
|
||||
UTIL_Format(pluginfile, sizeof(pluginfile), "%s%s", arg, ext);
|
||||
g_SourceMod.BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", arg, ext);
|
||||
|
||||
if (!sm_trie_retrieve(m_LoadLookup, pluginfile, (void **)&pl))
|
||||
{
|
||||
@@ -2310,7 +2311,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
{
|
||||
char pluginfile[256];
|
||||
const char *ext = g_LibSys.GetFileExtension(arg) ? "" : ".smx";
|
||||
UTIL_Format(pluginfile, sizeof(pluginfile), "%s%s", arg, ext);
|
||||
g_SourceMod.BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", arg, ext);
|
||||
|
||||
if (!sm_trie_retrieve(m_LoadLookup, pluginfile, (void **)&pl))
|
||||
{
|
||||
@@ -2321,7 +2322,10 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
|
||||
char name[PLATFORM_MAX_PATH];
|
||||
const sm_plugininfo_t *info = pl->GetPublicInfo();
|
||||
strcpy(name, (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
|
||||
if (pl->GetStatus() <= Plugin_Paused)
|
||||
strcpy(name, (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
|
||||
else
|
||||
strcpy(name, pl->GetFilename());
|
||||
|
||||
if (ReloadPlugin(pl))
|
||||
{
|
||||
@@ -2738,6 +2742,6 @@ void CPluginManager::ListPluginsToClient(CPlayer *player, const CCommand &args)
|
||||
/* Do we actually have more plugins? */
|
||||
if (iter != m_plugins.end())
|
||||
{
|
||||
ClientConsolePrint(e, "To see more, type \"sm plugins %d\"", id + 1);
|
||||
ClientConsolePrint(e, "To see more, type \"sm plugins %d\"", id);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-3
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -47,9 +47,11 @@
|
||||
#include "sm_trie.h"
|
||||
#include "sourcemod.h"
|
||||
#include <IRootConsoleMenu.h>
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#if SOURCE_ENGINE == SE_ALIENSWARM
|
||||
#include "convar_sm_swarm.h"
|
||||
#elif (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#include "convar_sm_l4d.h"
|
||||
#elif (SOURCE_ENGINE == SE_ORANGEBOX) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE)
|
||||
#elif (SOURCE_ENGINE == SE_ORANGEBOX) || (SOURCE_ENGINE == SE_BLOODYGOODTIME) || (SOURCE_ENGINE == SE_EYE) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE)
|
||||
#include "convar_sm_ob.h"
|
||||
#else
|
||||
#include "convar_sm.h"
|
||||
@@ -473,3 +475,4 @@ private:
|
||||
extern CPluginManager g_PluginSys;
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_PLUGINSYSTEM_H_
|
||||
|
||||
|
||||
@@ -527,3 +527,85 @@ NativeEntry *ShareSystem::AddFakeNative(IPluginFunction *pFunc, const char *name
|
||||
|
||||
return pEntry;
|
||||
}
|
||||
|
||||
void ShareSystem::AddCapabilityProvider(IExtension *myself, IFeatureProvider *provider,
|
||||
const char *name)
|
||||
{
|
||||
if (m_caps.retrieve(name) != NULL)
|
||||
return;
|
||||
|
||||
Capability cap;
|
||||
cap.ext = myself;
|
||||
cap.provider = provider;
|
||||
|
||||
m_caps.insert(name, cap);
|
||||
}
|
||||
|
||||
void ShareSystem::DropCapabilityProvider(IExtension *myself, IFeatureProvider *provider,
|
||||
const char *name)
|
||||
{
|
||||
Capability *pCap = m_caps.retrieve(name);
|
||||
if (pCap == NULL)
|
||||
return;
|
||||
|
||||
if (pCap->ext != myself || pCap->provider != provider)
|
||||
return;
|
||||
|
||||
m_caps.remove(name);
|
||||
}
|
||||
|
||||
FeatureStatus ShareSystem::TestFeature(IPluginRuntime *pRuntime, FeatureType feature,
|
||||
const char *name)
|
||||
{
|
||||
switch (feature)
|
||||
{
|
||||
case FeatureType_Native:
|
||||
return TestNative(pRuntime, name);
|
||||
case FeatureType_Capability:
|
||||
return TestCap(name);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return FeatureStatus_Unknown;
|
||||
}
|
||||
|
||||
FeatureStatus ShareSystem::TestNative(IPluginRuntime *pRuntime, const char *name)
|
||||
{
|
||||
uint32_t index;
|
||||
|
||||
if (pRuntime->FindNativeByName(name, &index) == SP_ERROR_NONE)
|
||||
{
|
||||
sp_native_t *native;
|
||||
if (pRuntime->GetNativeByIndex(index, &native) == SP_ERROR_NONE)
|
||||
{
|
||||
if (native->status == SP_NATIVE_BOUND)
|
||||
return FeatureStatus_Available;
|
||||
else
|
||||
return FeatureStatus_Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
NativeEntry *entry = FindNative(name);
|
||||
if (entry == NULL)
|
||||
return FeatureStatus_Unknown;
|
||||
|
||||
if ((entry->replacement.owner != NULL || entry->owner != NULL) &&
|
||||
(entry->replacement.func != NULL || entry->func != NULL))
|
||||
{
|
||||
return FeatureStatus_Available;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FeatureStatus_Unavailable;
|
||||
}
|
||||
}
|
||||
|
||||
FeatureStatus ShareSystem::TestCap(const char *name)
|
||||
{
|
||||
Capability *cap = m_caps.retrieve(name);
|
||||
if (cap == NULL)
|
||||
return FeatureStatus_Unknown;
|
||||
|
||||
return cap->provider->GetFeatureStatus(FeatureType_Capability, name);
|
||||
}
|
||||
|
||||
+15
-1
@@ -87,7 +87,13 @@ struct NativeEntry
|
||||
FakeNative *fake;
|
||||
};
|
||||
|
||||
class ShareSystem :
|
||||
struct Capability
|
||||
{
|
||||
IExtension *ext;
|
||||
IFeatureProvider *provider;
|
||||
};
|
||||
|
||||
class ShareSystem :
|
||||
public IShareSys,
|
||||
public SMGlobalClass,
|
||||
public IHandleTypeDispatch
|
||||
@@ -110,6 +116,10 @@ public: //IShareSys
|
||||
void AddDependency(IExtension *myself, const char *filename, bool require, bool autoload);
|
||||
void RegisterLibrary(IExtension *myself, const char *name);
|
||||
void OverrideNatives(IExtension *myself, const sp_nativeinfo_t *natives);
|
||||
void AddCapabilityProvider(IExtension *myself, IFeatureProvider *provider,
|
||||
const char *name);
|
||||
void DropCapabilityProvider(IExtension *myself, IFeatureProvider *provider,
|
||||
const char *name);
|
||||
public: //SMGlobalClass
|
||||
/* Pre-empt in case anything tries to register idents early */
|
||||
void Initialize();
|
||||
@@ -119,6 +129,9 @@ public: //IHandleTypeDispatch
|
||||
public:
|
||||
IdentityToken_t *CreateCoreIdentity();
|
||||
void RemoveInterfaces(IExtension *pExtension);
|
||||
FeatureStatus TestFeature(IPluginRuntime *pRuntime, FeatureType feature, const char *name);
|
||||
FeatureStatus TestNative(IPluginRuntime *pRuntime, const char *name);
|
||||
FeatureStatus TestCap(const char *name);
|
||||
public:
|
||||
inline IdentityToken_t *GetIdentRoot()
|
||||
{
|
||||
@@ -143,6 +156,7 @@ private:
|
||||
HandleType_t m_IfaceType;
|
||||
IdentityType_t m_CoreType;
|
||||
KTrie<NativeEntry *> m_NtvCache;
|
||||
KTrie<Capability> m_caps;
|
||||
};
|
||||
|
||||
extern ShareSystem g_ShareSys;
|
||||
|
||||
+1
-1
@@ -78,11 +78,11 @@ public: //ITimerSystem
|
||||
float GetTickedTime();
|
||||
void NotifyOfGameStart(float offset /* = 0.0f */);
|
||||
bool GetMapTimeLeft(float *pTime);
|
||||
IMapTimer *GetMapTimer();
|
||||
public:
|
||||
void RunFrame();
|
||||
void RemoveMapChangeTimers();
|
||||
void GameFrame(bool simulating);
|
||||
IMapTimer *GetMapTimer();
|
||||
private:
|
||||
List<ITimer *> m_SingleTimers;
|
||||
List<ITimer *> m_LoopTimers;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
UserMessages g_UserMsgs;
|
||||
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#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);
|
||||
@@ -168,13 +168,13 @@ bf_write *UserMessages::StartMessage(int msg_id, const cell_t players[], unsigne
|
||||
|
||||
if (m_CurFlags & USERMSG_BLOCKHOOKS)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#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);
|
||||
#endif
|
||||
} else {
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#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);
|
||||
@@ -316,7 +316,7 @@ void UserMessages::_DecRefCounter()
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#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)
|
||||
@@ -346,7 +346,7 @@ bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_typ
|
||||
RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#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)
|
||||
@@ -500,7 +500,7 @@ void UserMessages::OnMessageEnd_Pre()
|
||||
{
|
||||
bf_write *engine_bfw;
|
||||
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#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);
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -79,7 +79,7 @@ public: //IUserMessages
|
||||
IUserMessageListener *pListener,
|
||||
bool intercept=false);
|
||||
public:
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
#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
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#define FORCEINLINE_CVAR FORCEINLINE
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
#define FORCEINLINE_CVAR inline
|
||||
#else
|
||||
#error "implement me"
|
||||
@@ -386,6 +386,9 @@ public:
|
||||
virtual void SetValue( const char *value );
|
||||
virtual void SetValue( float value );
|
||||
virtual void SetValue( int value );
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD2
|
||||
virtual void SetValue( Color value );
|
||||
#endif
|
||||
|
||||
// Reset to default value
|
||||
void Revert( void );
|
||||
@@ -401,6 +404,9 @@ private:
|
||||
// For CVARs marked FCVAR_NEVER_AS_STRING
|
||||
virtual void InternalSetFloatValue( float fNewValue );
|
||||
virtual void InternalSetIntValue( int nValue );
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD2
|
||||
virtual void InternalSetColorValue( Color value );
|
||||
#endif
|
||||
|
||||
virtual bool ClampValue( float& value );
|
||||
virtual void ChangeStringValue( const char *tempVal, float flOldValue );
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#define FORCEINLINE_CVAR FORCEINLINE
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
#define FORCEINLINE_CVAR inline
|
||||
#else
|
||||
#error "implement me"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+19
-1
@@ -12,6 +12,8 @@ compiler['CDEFINES'].append('SM_LOGIC')
|
||||
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
compiler['POSTLINKFLAGS'].append('-lpthread')
|
||||
if AMBuild.target['platform'] == 'darwin':
|
||||
compiler['POSTLINKFLAGS'].extend(['-framework', 'CoreServices'])
|
||||
|
||||
extension = AMBuild.AddJob('sourcemod.logic')
|
||||
binary = Cpp.LibraryBuilder('sourcemod.logic', AMBuild, extension, compiler)
|
||||
@@ -29,7 +31,23 @@ files = [
|
||||
'smn_textparse.cpp',
|
||||
'smn_adt_trie.cpp',
|
||||
'Profiler.cpp',
|
||||
'smn_functions.cpp'
|
||||
'smn_functions.cpp',
|
||||
'smn_timers.cpp',
|
||||
'smn_players.cpp',
|
||||
'MemoryUtils.cpp',
|
||||
'smn_admin.cpp',
|
||||
'smn_banning.cpp',
|
||||
'stringutil.cpp',
|
||||
'Translator.cpp',
|
||||
'PhraseCollection.cpp',
|
||||
'smn_lang.cpp',
|
||||
'smn_string.cpp',
|
||||
'smn_handles.cpp',
|
||||
'smn_datapacks.cpp',
|
||||
'smn_gameconfigs.cpp',
|
||||
'GameConfigs.cpp',
|
||||
'sm_crc32.cpp',
|
||||
'smn_profiler.cpp'
|
||||
]
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
files.append('thread/WinThreads.cpp')
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_AUTO_HANDLE_ROOTER_H_
|
||||
#define _INCLUDE_SOURCEMOD_AUTO_HANDLE_ROOTER_H_
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <IHandleSys.h>
|
||||
|
||||
class AutoHandleRooter
|
||||
{
|
||||
public:
|
||||
AutoHandleRooter(Handle_t hndl)
|
||||
{
|
||||
if (hndl != BAD_HANDLE)
|
||||
this->hndl = handlesys->FastCloneHandle(hndl);
|
||||
else
|
||||
this->hndl = BAD_HANDLE;
|
||||
}
|
||||
|
||||
~AutoHandleRooter()
|
||||
{
|
||||
if (hndl != BAD_HANDLE)
|
||||
{
|
||||
HandleSecurity sec(g_pCoreIdent, g_pCoreIdent);
|
||||
handlesys->FreeHandle(hndl, &sec);
|
||||
}
|
||||
}
|
||||
|
||||
Handle_t getHandle()
|
||||
{
|
||||
return hndl;
|
||||
}
|
||||
private:
|
||||
Handle_t hndl;
|
||||
};
|
||||
|
||||
class AutoHandleCloner
|
||||
{
|
||||
Handle_t original;
|
||||
HandleSecurity sec;
|
||||
AutoHandleRooter ahr;
|
||||
public:
|
||||
AutoHandleCloner(Handle_t original, HandleSecurity sec)
|
||||
: original(original), sec(sec), ahr(original)
|
||||
{
|
||||
}
|
||||
|
||||
~AutoHandleCloner()
|
||||
{
|
||||
if (original != BAD_HANDLE)
|
||||
{
|
||||
handlesys->FreeHandle(original, &sec);
|
||||
}
|
||||
}
|
||||
|
||||
Handle_t getClone()
|
||||
{
|
||||
return ahr.getHandle();
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_AUTO_HANDLE_ROOTER_H_ */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -25,28 +25,30 @@
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sh_list.h>
|
||||
#include <sh_string.h>
|
||||
#include "GameConfigs.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "sourcemod.h"
|
||||
#include "sourcemm_api.h"
|
||||
#include "HalfLife2.h"
|
||||
#include "Logger.h"
|
||||
#include "ShareSys.h"
|
||||
#include "MemoryUtils.h"
|
||||
#include "LibrarySys.h"
|
||||
#include "HandleSys.h"
|
||||
#include "stringutil.h"
|
||||
#include <IGameHelpers.h>
|
||||
#include <ILibrarySys.h>
|
||||
#include <IHandleSys.h>
|
||||
#include <IMemoryUtils.h>
|
||||
#include <ISourceMod.h>
|
||||
#include "common_logic.h"
|
||||
#include "sm_crc32.h"
|
||||
#include "MemoryUtils.h"
|
||||
|
||||
#if defined PLATFORM_LINUX
|
||||
#if defined PLATFORM_POSIX
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
using namespace SourceHook;
|
||||
|
||||
GameConfigManager g_GameConfigs;
|
||||
IGameConfig *g_pGameConf = NULL;
|
||||
static char g_Game[256];
|
||||
@@ -65,6 +67,9 @@ static char g_GameName[256] = {'$', '\0'};
|
||||
#define PSTATE_GAMEDEFS_CRC 9
|
||||
#define PSTATE_GAMEDEFS_CRC_BINARY 10
|
||||
#define PSTATE_GAMEDEFS_CUSTOM 11
|
||||
#define PSTATE_GAMEDEFS_ADDRESSES 12
|
||||
#define PSTATE_GAMEDEFS_ADDRESSES_ADDRESS 13
|
||||
#define PSTATE_GAMEDEFS_ADDRESSES_ADDRESS_READ 14
|
||||
|
||||
#if defined PLATFORM_WINDOWS
|
||||
#define PLATFORM_NAME "windows"
|
||||
@@ -73,8 +78,8 @@ static char g_GameName[256] = {'$', '\0'};
|
||||
#define PLATFORM_NAME "linux"
|
||||
#define PLATFORM_SERVER_BINARY "server_i486.so"
|
||||
#elif defined PLATFORM_APPLE
|
||||
#define PLATFORM_NAME "undef"
|
||||
#define PLATFORM_SERVER_BINARY "undef.dylib"
|
||||
#define PLATFORM_NAME "mac"
|
||||
#define PLATFORM_SERVER_BINARY "server.dylib"
|
||||
#endif
|
||||
|
||||
struct TempSigInfo
|
||||
@@ -107,32 +112,13 @@ static bool DoesGameMatch(const char *value)
|
||||
|
||||
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;
|
||||
return strcmp(value, smcore.GetSourceEngineName()) == 0;
|
||||
}
|
||||
|
||||
CGameConfig::CGameConfig(const char *file)
|
||||
{
|
||||
strncopy(m_File, file, sizeof(m_File));
|
||||
m_pOffsets = sm_trie_create();
|
||||
m_pProps = sm_trie_create();
|
||||
m_pKeys = sm_trie_create();
|
||||
m_pSigs = sm_trie_create();
|
||||
m_pAddresses = new KTrie<AddressConf>();
|
||||
m_pStrings = new BaseStringTable(512);
|
||||
m_RefCount = 0;
|
||||
|
||||
@@ -142,10 +128,7 @@ CGameConfig::CGameConfig(const char *file)
|
||||
|
||||
CGameConfig::~CGameConfig()
|
||||
{
|
||||
sm_trie_destroy(m_pOffsets);
|
||||
sm_trie_destroy(m_pProps);
|
||||
sm_trie_destroy(m_pKeys);
|
||||
sm_trie_destroy(m_pSigs);
|
||||
delete m_pAddresses;
|
||||
delete m_pStrings;
|
||||
}
|
||||
|
||||
@@ -212,6 +195,10 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
||||
m_ParseState = PSTATE_GAMEDEFS_CRC;
|
||||
bShouldBeReadingDefault = false;
|
||||
}
|
||||
else if (strcmp(name, "Addresses") == 0)
|
||||
{
|
||||
m_ParseState = PSTATE_GAMEDEFS_ADDRESSES;
|
||||
}
|
||||
else
|
||||
{
|
||||
ITextListener_SMC **pListen = g_GameConfigs.m_customHandlers.retrieve(name);
|
||||
@@ -250,17 +237,17 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
||||
error[0] = '\0';
|
||||
if (strcmp(name, "server") != 0)
|
||||
{
|
||||
UTIL_Format(error, sizeof(error), "Unrecognized library \"%s\"", name);
|
||||
smcore.Format(error, sizeof(error), "Unrecognized library \"%s\"", name);
|
||||
}
|
||||
else if (!s_ServerBinCRC_Ok)
|
||||
{
|
||||
FILE *fp;
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
|
||||
g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "bin/" PLATFORM_SERVER_BINARY);
|
||||
g_pSM->BuildPath(Path_Game, path, sizeof(path), "bin/" PLATFORM_SERVER_BINARY);
|
||||
if ((fp = fopen(path, "rb")) == NULL)
|
||||
{
|
||||
UTIL_Format(error, sizeof(error), "Could not open binary: %s", path);
|
||||
smcore.Format(error, sizeof(error), "Could not open binary: %s", path);
|
||||
} else {
|
||||
size_t size;
|
||||
void *buffer;
|
||||
@@ -280,8 +267,8 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
||||
if (error[0] != '\0')
|
||||
{
|
||||
m_IgnoreLevel = 1;
|
||||
g_Logger.LogError("[SM] Error while parsing CRC section for \"%s\" (%s):", m_Game, m_CurFile);
|
||||
g_Logger.LogError("[SM] %s", error);
|
||||
smcore.LogError("[SM] Error while parsing CRC section for \"%s\" (%s):", m_Game, m_CurFile);
|
||||
smcore.LogError("[SM] %s", error);
|
||||
} else {
|
||||
m_ParseState = PSTATE_GAMEDEFS_CRC_BINARY;
|
||||
}
|
||||
@@ -293,12 +280,41 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
||||
return m_CustomHandler->ReadSMC_NewSection(states, name);
|
||||
break;
|
||||
}
|
||||
case PSTATE_GAMEDEFS_ADDRESSES:
|
||||
{
|
||||
m_Address[0] = '\0';
|
||||
m_AddressSignature[0] = '\0';
|
||||
m_AddressReadCount = 0;
|
||||
|
||||
strncopy(m_Address, name, sizeof(m_Address));
|
||||
m_ParseState = PSTATE_GAMEDEFS_ADDRESSES_ADDRESS;
|
||||
|
||||
break;
|
||||
}
|
||||
case PSTATE_GAMEDEFS_ADDRESSES_ADDRESS:
|
||||
{
|
||||
if (strcmp(name, PLATFORM_NAME) == 0)
|
||||
{
|
||||
m_ParseState = PSTATE_GAMEDEFS_ADDRESSES_ADDRESS_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp(name, "linux") != 0 && strcmp(name, "windows") != 0 && strcmp(name, "mac") != 0)
|
||||
{
|
||||
smcore.LogError("[SM] Error while parsing Address section for \"%s\" (%s):", m_Address, m_CurFile);
|
||||
smcore.LogError("[SM] Unrecognized platform \"%s\"", name);
|
||||
}
|
||||
m_IgnoreLevel = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* No sub-sections allowed:
|
||||
case PSTATE_GAMEDEFS_OFFSETS_OFFSET:
|
||||
case PSTATE_GAMEDEFS_KEYS:
|
||||
case PSTATE_GAMEDEFS_SUPPORTED:
|
||||
case PSTATE_GAMEDEFS_SIGNATURES_SIG:
|
||||
case PSTATE_GAMEDEFS_CRC_BINARY:
|
||||
case PSTATE_GAMEDEFS_ADDRESSES_ADDRESS_READ:
|
||||
*/
|
||||
default:
|
||||
{
|
||||
@@ -326,12 +342,10 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
|
||||
} else if (strcmp(key, "prop") == 0) {
|
||||
strncopy(m_Prop, value, sizeof(m_Prop));
|
||||
} else if (strcmp(key, PLATFORM_NAME) == 0) {
|
||||
int val = atoi(value);
|
||||
sm_trie_replace(m_pOffsets, m_offset, (void *)val);
|
||||
m_Offsets.replace(m_offset, atoi(value));
|
||||
}
|
||||
} else if (m_ParseState == PSTATE_GAMEDEFS_KEYS) {
|
||||
int id = m_pStrings->AddString(value);
|
||||
sm_trie_replace(m_pKeys, key, (void *)id);
|
||||
m_Keys.replace(key, m_pStrings->AddString(value));
|
||||
} else if (m_ParseState == PSTATE_GAMEDEFS_SUPPORTED) {
|
||||
if (strcmp(key, "game") == 0)
|
||||
{
|
||||
@@ -376,6 +390,21 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
|
||||
bShouldBeReadingDefault = true;
|
||||
}
|
||||
}
|
||||
} else if (m_ParseState == PSTATE_GAMEDEFS_ADDRESSES_ADDRESS || m_ParseState == PSTATE_GAMEDEFS_ADDRESSES_ADDRESS_READ) {
|
||||
if (strcmp(key, "read") == 0) {
|
||||
int limit = sizeof(m_AddressRead)/sizeof(m_AddressRead[0]);
|
||||
if (m_AddressReadCount < limit)
|
||||
{
|
||||
m_AddressRead[m_AddressReadCount] = atoi(value);
|
||||
m_AddressReadCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
smcore.LogError("[SM] Error parsing Address \"%s\", does not support more than %d read offsets (gameconf \"%s\")", m_Address, limit, m_CurFile);
|
||||
}
|
||||
} else if (strcmp(key, "signature") == 0) {
|
||||
strncopy(m_AddressSignature, value, sizeof(m_AddressSignature));
|
||||
}
|
||||
} else if (m_ParseState == PSTATE_GAMEDEFS_CUSTOM) {
|
||||
return m_CustomHandler->ReadSMC_KeyValue(states, key, value);
|
||||
}
|
||||
@@ -428,18 +457,18 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
if (m_Class[0] != '\0'
|
||||
&& m_Prop[0] != '\0')
|
||||
{
|
||||
SendProp *pProp = g_HL2.FindInSendTable(m_Class, m_Prop);
|
||||
SendProp *pProp = gamehelpers->FindInSendTable(m_Class, m_Prop);
|
||||
if (pProp)
|
||||
{
|
||||
int val = pProp->GetOffset();
|
||||
sm_trie_replace(m_pOffsets, m_offset, (void *)val);
|
||||
sm_trie_replace(m_pProps, m_offset, pProp);
|
||||
int val = gamehelpers->GetSendPropOffset(pProp);
|
||||
m_Offsets.replace(m_offset, val);
|
||||
m_Props.replace(m_offset, pProp);
|
||||
} else {
|
||||
/* Check if it's a non-default game and no offsets exist */
|
||||
if (((strcmp(m_Game, "*") != 0) && strcmp(m_Game, "#default") != 0)
|
||||
&& (!sm_trie_retrieve(m_pOffsets, m_offset, NULL)))
|
||||
&& (!m_Offsets.retrieve(m_offset)))
|
||||
{
|
||||
g_Logger.LogError("[SM] Unable to find property %s.%s (file \"%s\") (mod \"%s\")",
|
||||
smcore.LogError("[SM] Unable to find property %s.%s (file \"%s\") (mod \"%s\")",
|
||||
m_Class,
|
||||
m_Prop,
|
||||
m_CurFile,
|
||||
@@ -483,18 +512,20 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
void *addrInBase = NULL;
|
||||
if (strcmp(s_TempSig.library, "server") == 0)
|
||||
{
|
||||
addrInBase = (void *)g_SMAPI->GetServerFactory(false);
|
||||
addrInBase = smcore.serverFactory;
|
||||
} else if (strcmp(s_TempSig.library, "engine") == 0) {
|
||||
addrInBase = (void *)g_SMAPI->GetEngineFactory(false);
|
||||
addrInBase = smcore.engineFactory;
|
||||
} else if (strcmp(s_TempSig.library, "matchmaking_ds") == 0) {
|
||||
addrInBase = smcore.matchmakingDSFactory;
|
||||
}
|
||||
void *final_addr = NULL;
|
||||
if (addrInBase == NULL)
|
||||
{
|
||||
g_Logger.LogError("[SM] Unrecognized library \"%s\" (gameconf \"%s\")",
|
||||
smcore.LogError("[SM] Unrecognized library \"%s\" (gameconf \"%s\")",
|
||||
s_TempSig.library,
|
||||
m_CurFile);
|
||||
} else {
|
||||
#if defined PLATFORM_LINUX
|
||||
#if defined PLATFORM_POSIX
|
||||
if (s_TempSig.sig[0] == '@')
|
||||
{
|
||||
Dl_info info;
|
||||
@@ -504,15 +535,18 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
void *handle = dlopen(info.dli_fname, RTLD_NOW);
|
||||
if (handle)
|
||||
{
|
||||
final_addr = dlsym(handle, &s_TempSig.sig[1]);
|
||||
if (smcore.SymbolsAreHidden())
|
||||
final_addr = g_MemUtils.ResolveSymbol(handle, &s_TempSig.sig[1]);
|
||||
else
|
||||
final_addr = dlsym(handle, &s_TempSig.sig[1]);
|
||||
dlclose(handle);
|
||||
} else {
|
||||
g_Logger.LogError("[SM] Unable to load library \"%s\" (gameconf \"%s\")",
|
||||
smcore.LogError("[SM] Unable to load library \"%s\" (gameconf \"%s\")",
|
||||
s_TempSig.library,
|
||||
m_File);
|
||||
}
|
||||
} else {
|
||||
g_Logger.LogError("[SM] Unable to find library \"%s\" in memory (gameconf \"%s\")",
|
||||
smcore.LogError("[SM] Unable to find library \"%s\" in memory (gameconf \"%s\")",
|
||||
s_TempSig.library,
|
||||
m_File);
|
||||
}
|
||||
@@ -538,12 +572,42 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined PLATFORM_LINUX
|
||||
#if defined PLATFORM_POSIX
|
||||
skip_find:
|
||||
#endif
|
||||
sm_trie_replace(m_pSigs, m_offset, final_addr);
|
||||
m_Sigs.replace(m_offset, final_addr);
|
||||
m_ParseState = PSTATE_GAMEDEFS_SIGNATURES;
|
||||
|
||||
break;
|
||||
}
|
||||
case PSTATE_GAMEDEFS_ADDRESSES:
|
||||
{
|
||||
m_ParseState = PSTATE_GAMEDEFS;
|
||||
break;
|
||||
}
|
||||
case PSTATE_GAMEDEFS_ADDRESSES_ADDRESS:
|
||||
{
|
||||
m_ParseState = PSTATE_GAMEDEFS_ADDRESSES;
|
||||
|
||||
if (m_Address[0] == '\0')
|
||||
{
|
||||
smcore.LogError("[SM] Address sections must have names (gameconf \"%s\")", m_CurFile);
|
||||
break;
|
||||
}
|
||||
if (m_AddressSignature[0] == '\0')
|
||||
{
|
||||
smcore.LogError("[SM] Address section for \"%s\" did not specify a signature (gameconf \"%s\")", m_Address, m_CurFile);
|
||||
break;
|
||||
}
|
||||
|
||||
AddressConf addrConf(m_AddressSignature, sizeof(m_AddressSignature), m_AddressReadCount, m_AddressRead);
|
||||
m_pAddresses->replace(m_Address, addrConf);
|
||||
|
||||
break;
|
||||
}
|
||||
case PSTATE_GAMEDEFS_ADDRESSES_ADDRESS_READ:
|
||||
{
|
||||
m_ParseState = PSTATE_GAMEDEFS_ADDRESSES_ADDRESS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -682,18 +746,19 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
|
||||
{
|
||||
/* Reset cached data */
|
||||
m_pStrings->Reset();
|
||||
sm_trie_clear(m_pOffsets);
|
||||
sm_trie_clear(m_pProps);
|
||||
sm_trie_clear(m_pKeys);
|
||||
m_Offsets.clear();
|
||||
m_Props.clear();
|
||||
m_Keys.clear();
|
||||
m_pAddresses->clear();
|
||||
|
||||
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))
|
||||
g_pSM->BuildPath(Path_SM, path, sizeof(path), "gamedata/%s/master.games.txt", m_File);
|
||||
if (!libsys->PathExists(path))
|
||||
{
|
||||
/* Nope, use the old mechanism. */
|
||||
UTIL_Format(path, sizeof(path), "%s.txt", m_File);
|
||||
smcore.Format(path, sizeof(path), "%s.txt", m_File);
|
||||
return EnterFile(path, error, maxlength);
|
||||
}
|
||||
|
||||
@@ -708,8 +773,8 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
|
||||
{
|
||||
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",
|
||||
smcore.LogError("[SM] Error parsing master gameconf file \"%s\":", path);
|
||||
smcore.LogError("[SM] Error %d on line %d, col %d: %s",
|
||||
err,
|
||||
state.line,
|
||||
state.col,
|
||||
@@ -721,7 +786,7 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
|
||||
List<String>::iterator iter;
|
||||
for (iter = fileList.begin(); iter != fileList.end(); iter++)
|
||||
{
|
||||
UTIL_Format(path, sizeof(path), "%s/%s", m_File, (*iter).c_str());
|
||||
smcore.Format(path, sizeof(path), "%s/%s", m_File, (*iter).c_str());
|
||||
if (!EnterFile(path, error, maxlength))
|
||||
{
|
||||
return false;
|
||||
@@ -729,8 +794,8 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
|
||||
}
|
||||
|
||||
/* 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);
|
||||
g_pSM->BuildPath(Path_SM, path, sizeof(path), "gamedata/%s/custom", m_File);
|
||||
IDirectory *customDir = libsys->OpenDirectory(path);
|
||||
|
||||
if (!customDir)
|
||||
{
|
||||
@@ -755,17 +820,17 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
|
||||
continue;
|
||||
}
|
||||
|
||||
UTIL_Format(path, sizeof(path), "%s/custom/%s", m_File, curFile);
|
||||
smcore.Format(path, sizeof(path), "%s/custom/%s", m_File, curFile);
|
||||
if (!EnterFile(path, error, maxlength))
|
||||
{
|
||||
g_LibSys.CloseDirectory(customDir);
|
||||
libsys->CloseDirectory(customDir);
|
||||
return false;
|
||||
}
|
||||
|
||||
customDir->NextEntry();
|
||||
}
|
||||
|
||||
g_LibSys.CloseDirectory(customDir);
|
||||
libsys->CloseDirectory(customDir);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -774,7 +839,7 @@ 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);
|
||||
g_pSM->BuildPath(Path_SM, m_CurFile, sizeof(m_CurFile), "gamedata/%s", file);
|
||||
|
||||
/* Initialize parse states */
|
||||
m_IgnoreLevel = 0;
|
||||
@@ -788,8 +853,8 @@ bool CGameConfig::EnterFile(const char *file, char *error, size_t maxlength)
|
||||
|
||||
msg = textparsers->GetSMCErrorString(err);
|
||||
|
||||
g_Logger.LogError("[SM] Error parsing gameconfig file \"%s\":", m_CurFile);
|
||||
g_Logger.LogError("[SM] Error %d on line %d, col %d: %s",
|
||||
smcore.LogError("[SM] Error parsing gameconfig file \"%s\":", m_CurFile);
|
||||
smcore.LogError("[SM] Error %d on line %d, col %d: %s",
|
||||
err,
|
||||
state.line,
|
||||
state.col,
|
||||
@@ -811,43 +876,91 @@ bool CGameConfig::EnterFile(const char *file, char *error, size_t maxlength)
|
||||
|
||||
bool CGameConfig::GetOffset(const char *key, int *value)
|
||||
{
|
||||
void *obj;
|
||||
|
||||
if (!sm_trie_retrieve(m_pOffsets, key, &obj))
|
||||
{
|
||||
int *pvalue;
|
||||
if ((pvalue = m_Offsets.retrieve(key)) == NULL)
|
||||
return false;
|
||||
}
|
||||
|
||||
*value = (int)obj;
|
||||
|
||||
*value = *pvalue;
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *CGameConfig::GetKeyValue(const char *key)
|
||||
{
|
||||
void *obj;
|
||||
if (!sm_trie_retrieve(m_pKeys, key, &obj))
|
||||
{
|
||||
int *pkey;
|
||||
if ((pkey = m_Keys.retrieve(key)) == NULL)
|
||||
return NULL;
|
||||
return m_pStrings->GetString(*pkey);
|
||||
}
|
||||
|
||||
//memory addresses below 0x10000 are automatically considered invalid for dereferencing
|
||||
#define VALID_MINIMUM_MEMORY_ADDRESS 0x10000
|
||||
|
||||
bool CGameConfig::GetAddress(const char *key, void **retaddr)
|
||||
{
|
||||
AddressConf *addrConf;
|
||||
|
||||
addrConf = m_pAddresses->retrieve(key);
|
||||
if (!addrConf)
|
||||
{
|
||||
*retaddr = NULL;
|
||||
return false;
|
||||
}
|
||||
return m_pStrings->GetString((int)obj);
|
||||
|
||||
void *addr;
|
||||
if (!GetMemSig(addrConf->signatureName, &addr))
|
||||
{
|
||||
*retaddr = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < addrConf->readCount; ++i)
|
||||
{
|
||||
int offset = addrConf->read[i];
|
||||
|
||||
//NULLs in the middle of an indirection chain are bad, end NULL is ok
|
||||
if (addr == NULL || reinterpret_cast<uintptr_t>(addr) < VALID_MINIMUM_MEMORY_ADDRESS)
|
||||
{
|
||||
*retaddr = NULL;
|
||||
return false;
|
||||
}
|
||||
addr = *(reinterpret_cast<void**>(reinterpret_cast<uint8_t*>(addr) + offset));
|
||||
}
|
||||
|
||||
*retaddr = addr;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline unsigned minOf(unsigned a, unsigned b)
|
||||
{
|
||||
return a <= b ? a : b;
|
||||
}
|
||||
|
||||
CGameConfig::AddressConf::AddressConf(char *sigName, unsigned sigLength, unsigned readCount, int *read)
|
||||
{
|
||||
unsigned readLimit = minOf(readCount, sizeof(this->read) / sizeof(this->read[0]));
|
||||
|
||||
strncopy(signatureName, sigName, sizeof(signatureName) / sizeof(signatureName[0]));
|
||||
this->readCount = readLimit;
|
||||
memcpy(&this->read[0], read, sizeof(this->read[0])*readLimit);
|
||||
}
|
||||
|
||||
SendProp *CGameConfig::GetSendProp(const char *key)
|
||||
{
|
||||
SendProp *pProp;
|
||||
SendProp **pProp;
|
||||
|
||||
if (!sm_trie_retrieve(m_pProps, key, (void **)&pProp))
|
||||
{
|
||||
if ((pProp = m_Props.retrieve(key)) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pProp;
|
||||
return *pProp;
|
||||
}
|
||||
|
||||
bool CGameConfig::GetMemSig(const char *key, void **addr)
|
||||
{
|
||||
return sm_trie_retrieve(m_pSigs, key, addr);
|
||||
void **paddr;
|
||||
if ((paddr = m_Sigs.retrieve(key)) == NULL)
|
||||
return false;
|
||||
*addr = *paddr;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CGameConfig::IncRefCount()
|
||||
@@ -863,31 +976,19 @@ unsigned int CGameConfig::DecRefCount()
|
||||
|
||||
GameConfigManager::GameConfigManager()
|
||||
{
|
||||
m_pLookup = sm_trie_create();
|
||||
}
|
||||
|
||||
GameConfigManager::~GameConfigManager()
|
||||
{
|
||||
sm_trie_destroy(m_pLookup);
|
||||
}
|
||||
|
||||
void GameConfigManager::OnSourceModStartup(bool late)
|
||||
{
|
||||
LoadGameConfigFile("core.games", &g_pGameConf, NULL, 0);
|
||||
|
||||
strncopy(g_Game, g_SourceMod.GetGameFolderName(), sizeof(g_Game));
|
||||
strncopy(g_GameDesc + 1, SERVER_CALL(GetGameDescription)(), sizeof(g_GameDesc) - 1);
|
||||
|
||||
KeyValues *pGameInfo = new KeyValues("GameInfo");
|
||||
if (g_HL2.KVLoadFromFile(pGameInfo, basefilesystem, "gameinfo.txt"))
|
||||
{
|
||||
const char *str;
|
||||
if ((str = pGameInfo->GetString("game", NULL)) != NULL)
|
||||
{
|
||||
strncopy(g_GameName + 1, str, sizeof(g_GameName) - 1);
|
||||
}
|
||||
}
|
||||
pGameInfo->deleteThis();
|
||||
strncopy(g_Game, g_pSM->GetGameFolderName(), sizeof(g_Game));
|
||||
strncopy(g_GameDesc + 1, smcore.GetGameDescription(), sizeof(g_GameDesc) - 1);
|
||||
smcore.GetGameName(g_GameName + 1, sizeof(g_GameName) - 1);
|
||||
}
|
||||
|
||||
void GameConfigManager::OnSourceModAllInitialized()
|
||||
@@ -901,7 +1002,7 @@ void GameConfigManager::OnSourceModAllInitialized()
|
||||
/* :TODO: log */
|
||||
}
|
||||
|
||||
g_ShareSys.AddInterface(NULL, this);
|
||||
sharesys->AddInterface(NULL, this);
|
||||
}
|
||||
|
||||
void GameConfigManager::OnSourceModAllShutdown()
|
||||
@@ -921,9 +1022,11 @@ bool GameConfigManager::LoadGameConfigFile(const char *file, IGameConfig **_pCon
|
||||
#endif
|
||||
|
||||
CGameConfig *pConfig;
|
||||
CGameConfig **ppConfig;
|
||||
|
||||
if (sm_trie_retrieve(m_pLookup, file, (void **)&pConfig))
|
||||
if ((ppConfig = m_Lookup.retrieve(file)) != NULL)
|
||||
{
|
||||
pConfig = *ppConfig;
|
||||
pConfig->IncRefCount();
|
||||
*_pConfig = pConfig;
|
||||
return true;
|
||||
@@ -939,7 +1042,7 @@ bool GameConfigManager::LoadGameConfigFile(const char *file, IGameConfig **_pCon
|
||||
}
|
||||
|
||||
m_cfgs.push_back(pConfig);
|
||||
sm_trie_insert(m_pLookup, file, pConfig);
|
||||
m_Lookup.insert(file, pConfig);
|
||||
|
||||
pConfig->IncRefCount();
|
||||
|
||||
@@ -954,18 +1057,18 @@ void GameConfigManager::CloseGameConfigFile(IGameConfig *cfg)
|
||||
|
||||
if (pConfig->DecRefCount() == 0)
|
||||
{
|
||||
sm_trie_delete(m_pLookup, pConfig->m_File);
|
||||
m_Lookup.remove(pConfig->m_File);
|
||||
delete pConfig;
|
||||
}
|
||||
}
|
||||
|
||||
extern HandleType_t g_GameConfigsType;
|
||||
extern Handle_t g_GameConfigsType;
|
||||
|
||||
IGameConfig *GameConfigManager::ReadHandle(Handle_t hndl, IdentityToken_t *ident, HandleError *err)
|
||||
{
|
||||
HandleSecurity sec(ident, g_pCoreIdent);
|
||||
IGameConfig *conf = NULL;
|
||||
HandleError _err = g_HandleSys.ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&conf);
|
||||
HandleError _err = handlesys->ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&conf);
|
||||
|
||||
if (err)
|
||||
{
|
||||
@@ -32,13 +32,12 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_CGAMECONFIGS_H_
|
||||
#define _INCLUDE_SOURCEMOD_CGAMECONFIGS_H_
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <IGameConfigs.h>
|
||||
#include <ITextParsers.h>
|
||||
#include <sh_list.h>
|
||||
#include "sm_trie.h"
|
||||
#include "sm_globals.h"
|
||||
#include "sm_memtable.h"
|
||||
#include "sm_trie_tpl.h"
|
||||
#include <sm_trie_tpl.h>
|
||||
|
||||
using namespace SourceMod;
|
||||
using namespace SourceHook;
|
||||
@@ -65,6 +64,7 @@ public: //IGameConfig
|
||||
bool GetOffset(const char *key, int *value);
|
||||
SendProp *GetSendProp(const char *key);
|
||||
bool GetMemSig(const char *key, void **addr);
|
||||
bool GetAddress(const char *key, void **addr);
|
||||
public:
|
||||
void IncRefCount();
|
||||
unsigned int DecRefCount();
|
||||
@@ -72,10 +72,10 @@ private:
|
||||
BaseStringTable *m_pStrings;
|
||||
char m_File[PLATFORM_MAX_PATH];
|
||||
char m_CurFile[PLATFORM_MAX_PATH];
|
||||
Trie *m_pOffsets;
|
||||
Trie *m_pProps;
|
||||
Trie *m_pKeys;
|
||||
Trie *m_pSigs;
|
||||
KTrie<int> m_Offsets;
|
||||
KTrie<SendProp *> m_Props;
|
||||
KTrie<int> m_Keys;
|
||||
KTrie<void *> m_Sigs;
|
||||
unsigned int m_RefCount;
|
||||
/* Parse states */
|
||||
int m_ParseState;
|
||||
@@ -93,6 +93,24 @@ private:
|
||||
/* Custom Sections */
|
||||
unsigned int m_CustomLevel;
|
||||
ITextListener_SMC *m_CustomHandler;
|
||||
|
||||
/* Support for reading Addresses */
|
||||
struct AddressConf
|
||||
{
|
||||
char signatureName[64];
|
||||
int readCount;
|
||||
int read[8];
|
||||
|
||||
AddressConf(char *sigName, unsigned sigLength, unsigned readCount, int *read);
|
||||
|
||||
AddressConf() {}
|
||||
};
|
||||
|
||||
char m_Address[64];
|
||||
char m_AddressSignature[64];
|
||||
int m_AddressReadCount;
|
||||
int m_AddressRead[8];
|
||||
KTrie<AddressConf> *m_pAddresses;
|
||||
};
|
||||
|
||||
class GameConfigManager :
|
||||
@@ -118,7 +136,7 @@ public: //SMGlobalClass
|
||||
void OnSourceModAllShutdown();
|
||||
private:
|
||||
List<CGameConfig *> m_cfgs;
|
||||
Trie *m_pLookup;
|
||||
KTrie<CGameConfig *> m_Lookup;
|
||||
public:
|
||||
KTrie<ITextListener_SMC *> m_customHandlers;
|
||||
};
|
||||
+16
-1
@@ -25,7 +25,22 @@ OBJECTS = \
|
||||
smn_textparse.cpp \
|
||||
smn_adt_trie.cpp \
|
||||
Profiler.cpp \
|
||||
smn_functions.cpp
|
||||
smn_functions.cpp \
|
||||
sm_crc32.cpp \
|
||||
smn_timers.cpp \
|
||||
MemoryUtils.cpp \
|
||||
smn_admin.cpp \
|
||||
smn_banning.cpp \
|
||||
stringutil.cpp \
|
||||
Translator.cpp \
|
||||
PhraseCollection.cpp \
|
||||
smn_lang.cpp \
|
||||
smn_string.cpp \
|
||||
smn_handles.cpp \
|
||||
smn_datapacks.cpp \
|
||||
smn_gameconfigs.cpp \
|
||||
GameConfigs.cpp \
|
||||
smn_players.cpp
|
||||
|
||||
##############################################
|
||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||
|
||||
@@ -0,0 +1,612 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2011 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*/
|
||||
|
||||
#include "MemoryUtils.h"
|
||||
#ifdef PLATFORM_LINUX
|
||||
#include <fcntl.h>
|
||||
#include <link.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
#define PAGE_ALIGN_UP(x) ((x + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_APPLE
|
||||
#include <AvailabilityMacros.h>
|
||||
#include <mach/task.h>
|
||||
#include <mach-o/dyld_images.h>
|
||||
#include <mach-o/loader.h>
|
||||
#include <mach-o/nlist.h>
|
||||
|
||||
/* Define things from 10.6 SDK for older SDKs */
|
||||
#ifndef MAC_OS_X_VERSION_10_6
|
||||
struct task_dyld_info
|
||||
{
|
||||
mach_vm_address_t all_image_info_addr;
|
||||
mach_vm_size_t all_image_info_size;
|
||||
};
|
||||
typedef struct task_dyld_info task_dyld_info_data_t;
|
||||
#define TASK_DYLD_INFO 17
|
||||
#define TASK_DYLD_INFO_COUNT (sizeof(task_dyld_info_data_t) / sizeof(natural_t))
|
||||
#endif // MAC_OS_X_VERSION_10_6
|
||||
#endif // PLATFORM_APPLE
|
||||
|
||||
MemoryUtils g_MemUtils;
|
||||
|
||||
MemoryUtils::MemoryUtils()
|
||||
{
|
||||
#ifdef PLATFORM_APPLE
|
||||
|
||||
Gestalt(gestaltSystemVersionMajor, &m_OSXMajor);
|
||||
Gestalt(gestaltSystemVersionMinor, &m_OSXMinor);
|
||||
|
||||
/* Get pointer to struct that describes all loaded mach-o images in process */
|
||||
if ((m_OSXMajor == 10 && m_OSXMinor >= 6) || m_OSXMajor > 10)
|
||||
{
|
||||
task_dyld_info_data_t dyld_info;
|
||||
mach_msg_type_number_t count = TASK_DYLD_INFO_COUNT;
|
||||
task_info(mach_task_self(), TASK_DYLD_INFO, (task_info_t)&dyld_info, &count);
|
||||
m_ImageList = (struct dyld_all_image_infos *)dyld_info.all_image_info_addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct nlist list[2];
|
||||
memset(list, 0, sizeof(list));
|
||||
list[0].n_un.n_name = (char *)"_dyld_all_image_infos";
|
||||
nlist("/usr/lib/dyld", list);
|
||||
m_ImageList = (struct dyld_all_image_infos *)list[0].n_value;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
MemoryUtils::~MemoryUtils()
|
||||
{
|
||||
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
for (size_t i = 0; i < m_SymTables.size(); i++)
|
||||
{
|
||||
delete m_SymTables[i];
|
||||
}
|
||||
m_SymTables.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
void MemoryUtils::OnSourceModAllInitialized()
|
||||
{
|
||||
sharesys->AddInterface(NULL, this);
|
||||
}
|
||||
|
||||
void *MemoryUtils::FindPattern(const void *libPtr, const char *pattern, size_t len)
|
||||
{
|
||||
DynLibInfo lib;
|
||||
bool found;
|
||||
char *ptr, *end;
|
||||
|
||||
memset(&lib, 0, sizeof(DynLibInfo));
|
||||
|
||||
if (!GetLibraryInfo(libPtr, lib))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr = reinterpret_cast<char *>(lib.baseAddress);
|
||||
end = ptr + lib.memorySize;
|
||||
|
||||
while (ptr < end)
|
||||
{
|
||||
found = true;
|
||||
for (register size_t i = 0; i < len; i++)
|
||||
{
|
||||
if (pattern[i] != '\x2A' && pattern[i] != ptr[i])
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
return ptr;
|
||||
|
||||
ptr++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *MemoryUtils::ResolveSymbol(void *handle, const char *symbol)
|
||||
{
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
|
||||
return GetProcAddress((HMODULE)handle, symbol);
|
||||
|
||||
#elif defined PLATFORM_LINUX
|
||||
|
||||
struct link_map *dlmap;
|
||||
struct stat dlstat;
|
||||
int dlfile;
|
||||
uintptr_t map_base;
|
||||
Elf32_Ehdr *file_hdr;
|
||||
Elf32_Shdr *sections, *shstrtab_hdr, *symtab_hdr, *strtab_hdr;
|
||||
Elf32_Sym *symtab;
|
||||
const char *shstrtab, *strtab;
|
||||
uint16_t section_count;
|
||||
uint32_t symbol_count;
|
||||
LibSymbolTable *libtable;
|
||||
SymbolTable *table;
|
||||
Symbol *symbol_entry;
|
||||
|
||||
dlmap = (struct link_map *)handle;
|
||||
symtab_hdr = NULL;
|
||||
strtab_hdr = NULL;
|
||||
table = NULL;
|
||||
|
||||
/* See if we already have a symbol table for this library */
|
||||
for (size_t i = 0; i < m_SymTables.size(); i++)
|
||||
{
|
||||
libtable = m_SymTables[i];
|
||||
if (libtable->lib_base == dlmap->l_addr)
|
||||
{
|
||||
table = &libtable->table;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we don't have a symbol table for this library, then create one */
|
||||
if (table == NULL)
|
||||
{
|
||||
libtable = new LibSymbolTable();
|
||||
libtable->table.Initialize();
|
||||
libtable->lib_base = dlmap->l_addr;
|
||||
libtable->last_pos = 0;
|
||||
table = &libtable->table;
|
||||
m_SymTables.push_back(libtable);
|
||||
}
|
||||
|
||||
/* See if the symbol is already cached in our table */
|
||||
symbol_entry = table->FindSymbol(symbol, strlen(symbol));
|
||||
if (symbol_entry != NULL)
|
||||
{
|
||||
return symbol_entry->address;
|
||||
}
|
||||
|
||||
/* If symbol isn't in our table, then we have open the actual library */
|
||||
dlfile = open(dlmap->l_name, O_RDONLY);
|
||||
if (dlfile == -1 || fstat(dlfile, &dlstat) == -1)
|
||||
{
|
||||
close(dlfile);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Map library file into memory */
|
||||
file_hdr = (Elf32_Ehdr *)mmap(NULL, dlstat.st_size, PROT_READ, MAP_PRIVATE, dlfile, 0);
|
||||
map_base = (uintptr_t)file_hdr;
|
||||
if (file_hdr == MAP_FAILED)
|
||||
{
|
||||
close(dlfile);
|
||||
return NULL;
|
||||
}
|
||||
close(dlfile);
|
||||
|
||||
if (file_hdr->e_shoff == 0 || file_hdr->e_shstrndx == SHN_UNDEF)
|
||||
{
|
||||
munmap(file_hdr, dlstat.st_size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sections = (Elf32_Shdr *)(map_base + file_hdr->e_shoff);
|
||||
section_count = file_hdr->e_shnum;
|
||||
/* Get ELF section header string table */
|
||||
shstrtab_hdr = §ions[file_hdr->e_shstrndx];
|
||||
shstrtab = (const char *)(map_base + shstrtab_hdr->sh_offset);
|
||||
|
||||
/* Iterate sections while looking for ELF symbol table and string table */
|
||||
for (uint16_t i = 0; i < section_count; i++)
|
||||
{
|
||||
Elf32_Shdr &hdr = sections[i];
|
||||
const char *section_name = shstrtab + hdr.sh_name;
|
||||
|
||||
if (strcmp(section_name, ".symtab") == 0)
|
||||
{
|
||||
symtab_hdr = &hdr;
|
||||
}
|
||||
else if (strcmp(section_name, ".strtab") == 0)
|
||||
{
|
||||
strtab_hdr = &hdr;
|
||||
}
|
||||
}
|
||||
|
||||
/* Uh oh, we don't have a symbol table or a string table */
|
||||
if (symtab_hdr == NULL || strtab_hdr == NULL)
|
||||
{
|
||||
munmap(file_hdr, dlstat.st_size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
symtab = (Elf32_Sym *)(map_base + symtab_hdr->sh_offset);
|
||||
strtab = (const char *)(map_base + strtab_hdr->sh_offset);
|
||||
symbol_count = symtab_hdr->sh_size / symtab_hdr->sh_entsize;
|
||||
|
||||
/* Iterate symbol table starting from the position we were at last time */
|
||||
for (uint32_t i = libtable->last_pos; i < symbol_count; i++)
|
||||
{
|
||||
Elf32_Sym &sym = symtab[i];
|
||||
unsigned char sym_type = ELF32_ST_TYPE(sym.st_info);
|
||||
const char *sym_name = strtab + sym.st_name;
|
||||
Symbol *cur_sym;
|
||||
|
||||
/* Skip symbols that are undefined or do not refer to functions or objects */
|
||||
if (sym.st_shndx == SHN_UNDEF || (sym_type != STT_FUNC && sym_type != STT_OBJECT))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Caching symbols as we go along */
|
||||
cur_sym = table->InternSymbol(sym_name, strlen(sym_name), (void *)(dlmap->l_addr + sym.st_value));
|
||||
if (strcmp(symbol, sym_name) == 0)
|
||||
{
|
||||
symbol_entry = cur_sym;
|
||||
libtable->last_pos = ++i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
munmap(file_hdr, dlstat.st_size);
|
||||
return symbol_entry ? symbol_entry->address : NULL;
|
||||
|
||||
#elif defined PLATFORM_APPLE
|
||||
|
||||
uintptr_t dlbase, linkedit_addr;
|
||||
uint32_t image_count;
|
||||
struct mach_header *file_hdr;
|
||||
struct load_command *loadcmds;
|
||||
struct segment_command *linkedit_hdr;
|
||||
struct symtab_command *symtab_hdr;
|
||||
struct nlist *symtab;
|
||||
const char *strtab;
|
||||
uint32_t loadcmd_count;
|
||||
uint32_t symbol_count;
|
||||
LibSymbolTable *libtable;
|
||||
SymbolTable *table;
|
||||
Symbol *symbol_entry;
|
||||
|
||||
dlbase = 0;
|
||||
image_count = m_ImageList->infoArrayCount;
|
||||
linkedit_hdr = NULL;
|
||||
symtab_hdr = NULL;
|
||||
table = NULL;
|
||||
|
||||
/* Loop through mach-o images in process.
|
||||
* We can skip index 0 since that is just the executable.
|
||||
*/
|
||||
for (uint32_t i = 1; i < image_count; i++)
|
||||
{
|
||||
const struct dyld_image_info &info = m_ImageList->infoArray[i];
|
||||
|
||||
/* "Load" each one until we get a matching handle */
|
||||
void *h = dlopen(info.imageFilePath, RTLD_NOLOAD);
|
||||
if (h == handle)
|
||||
{
|
||||
dlbase = (uintptr_t)info.imageLoadAddress;
|
||||
dlclose(h);
|
||||
break;
|
||||
}
|
||||
|
||||
dlclose(h);
|
||||
}
|
||||
|
||||
if (!dlbase)
|
||||
{
|
||||
/* Uh oh, we couldn't find a matching handle */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* See if we already have a symbol table for this library */
|
||||
for (size_t i = 0; i < m_SymTables.size(); i++)
|
||||
{
|
||||
libtable = m_SymTables[i];
|
||||
if (libtable->lib_base == dlbase)
|
||||
{
|
||||
table = &libtable->table;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we don't have a symbol table for this library, then create one */
|
||||
if (table == NULL)
|
||||
{
|
||||
libtable = new LibSymbolTable();
|
||||
libtable->table.Initialize();
|
||||
libtable->lib_base = dlbase;
|
||||
libtable->last_pos = 0;
|
||||
table = &libtable->table;
|
||||
m_SymTables.push_back(libtable);
|
||||
}
|
||||
|
||||
/* See if the symbol is already cached in our table */
|
||||
symbol_entry = table->FindSymbol(symbol, strlen(symbol));
|
||||
if (symbol_entry != NULL)
|
||||
{
|
||||
return symbol_entry->address;
|
||||
}
|
||||
|
||||
/* If symbol isn't in our table, then we have to locate it in memory */
|
||||
|
||||
file_hdr = (struct mach_header *)dlbase;
|
||||
loadcmds = (struct load_command *)(dlbase + sizeof(struct mach_header));
|
||||
loadcmd_count = file_hdr->ncmds;
|
||||
|
||||
/* Loop through load commands until we find the ones for the symbol table */
|
||||
for (uint32_t i = 0; i < loadcmd_count; i++)
|
||||
{
|
||||
if (loadcmds->cmd == LC_SEGMENT && !linkedit_hdr)
|
||||
{
|
||||
struct segment_command *seg = (struct segment_command *)loadcmds;
|
||||
if (strcmp(seg->segname, "__LINKEDIT") == 0)
|
||||
{
|
||||
linkedit_hdr = seg;
|
||||
if (symtab_hdr)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (loadcmds->cmd == LC_SYMTAB)
|
||||
{
|
||||
symtab_hdr = (struct symtab_command *)loadcmds;
|
||||
if (linkedit_hdr)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Load commands are not of a fixed size which is why we add the size */
|
||||
loadcmds = (struct load_command *)((uintptr_t)loadcmds + loadcmds->cmdsize);
|
||||
}
|
||||
|
||||
if (!linkedit_hdr || !symtab_hdr || !symtab_hdr->symoff || !symtab_hdr->stroff)
|
||||
{
|
||||
/* Uh oh, no symbol table */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
linkedit_addr = dlbase + linkedit_hdr->vmaddr;
|
||||
symtab = (struct nlist *)(linkedit_addr + symtab_hdr->symoff - linkedit_hdr->fileoff);
|
||||
strtab = (const char *)(linkedit_addr + symtab_hdr->stroff - linkedit_hdr->fileoff);
|
||||
symbol_count = symtab_hdr->nsyms;
|
||||
|
||||
/* Iterate symbol table starting from the position we were at last time */
|
||||
for (uint32_t i = libtable->last_pos; i < symbol_count; i++)
|
||||
{
|
||||
struct nlist &sym = symtab[i];
|
||||
/* Ignore the prepended underscore on all symbols, so +1 here */
|
||||
const char *sym_name = strtab + sym.n_un.n_strx + 1;
|
||||
Symbol *cur_sym;
|
||||
|
||||
/* Skip symbols that are undefined */
|
||||
if (sym.n_sect == NO_SECT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Caching symbols as we go along */
|
||||
cur_sym = table->InternSymbol(sym_name, strlen(sym_name), (void *)(dlbase + sym.n_value));
|
||||
if (strcmp(symbol, sym_name) == 0)
|
||||
{
|
||||
symbol_entry = cur_sym;
|
||||
libtable->last_pos = ++i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return symbol_entry ? symbol_entry->address : NULL;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
bool MemoryUtils::GetLibraryInfo(const void *libPtr, DynLibInfo &lib)
|
||||
{
|
||||
uintptr_t baseAddr;
|
||||
|
||||
if (libPtr == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
|
||||
MEMORY_BASIC_INFORMATION info;
|
||||
IMAGE_DOS_HEADER *dos;
|
||||
IMAGE_NT_HEADERS *pe;
|
||||
IMAGE_FILE_HEADER *file;
|
||||
IMAGE_OPTIONAL_HEADER *opt;
|
||||
|
||||
if (!VirtualQuery(libPtr, &info, sizeof(MEMORY_BASIC_INFORMATION)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
baseAddr = reinterpret_cast<uintptr_t>(info.AllocationBase);
|
||||
|
||||
/* All this is for our insane sanity checks :o */
|
||||
dos = reinterpret_cast<IMAGE_DOS_HEADER *>(baseAddr);
|
||||
pe = reinterpret_cast<IMAGE_NT_HEADERS *>(baseAddr + dos->e_lfanew);
|
||||
file = &pe->FileHeader;
|
||||
opt = &pe->OptionalHeader;
|
||||
|
||||
/* Check PE magic and signature */
|
||||
if (dos->e_magic != IMAGE_DOS_SIGNATURE || pe->Signature != IMAGE_NT_SIGNATURE || opt->Magic != IMAGE_NT_OPTIONAL_HDR32_MAGIC)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check architecture, which is 32-bit/x86 right now
|
||||
* Should change this for 64-bit if Valve gets their act together
|
||||
*/
|
||||
if (file->Machine != IMAGE_FILE_MACHINE_I386)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* For our purposes, this must be a dynamic library */
|
||||
if ((file->Characteristics & IMAGE_FILE_DLL) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Finally, we can do this */
|
||||
lib.memorySize = opt->SizeOfImage;
|
||||
|
||||
#elif defined PLATFORM_LINUX
|
||||
|
||||
Dl_info info;
|
||||
Elf32_Ehdr *file;
|
||||
Elf32_Phdr *phdr;
|
||||
uint16_t phdrCount;
|
||||
|
||||
if (!dladdr(libPtr, &info))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!info.dli_fbase || !info.dli_fname)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* This is for our insane sanity checks :o */
|
||||
baseAddr = reinterpret_cast<uintptr_t>(info.dli_fbase);
|
||||
file = reinterpret_cast<Elf32_Ehdr *>(baseAddr);
|
||||
|
||||
/* Check ELF magic */
|
||||
if (memcmp(ELFMAG, file->e_ident, SELFMAG) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check ELF version */
|
||||
if (file->e_ident[EI_VERSION] != EV_CURRENT)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check ELF architecture, which is 32-bit/x86 right now
|
||||
* Should change this for 64-bit if Valve gets their act together
|
||||
*/
|
||||
if (file->e_ident[EI_CLASS] != ELFCLASS32 || file->e_machine != EM_386 || file->e_ident[EI_DATA] != ELFDATA2LSB)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* For our purposes, this must be a dynamic library/shared object */
|
||||
if (file->e_type != ET_DYN)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
phdrCount = file->e_phnum;
|
||||
phdr = reinterpret_cast<Elf32_Phdr *>(baseAddr + file->e_phoff);
|
||||
|
||||
for (uint16_t i = 0; i < phdrCount; i++)
|
||||
{
|
||||
Elf32_Phdr &hdr = phdr[i];
|
||||
|
||||
/* We only really care about the segment with executable code */
|
||||
if (hdr.p_type == PT_LOAD && hdr.p_flags == (PF_X|PF_R))
|
||||
{
|
||||
/* From glibc, elf/dl-load.c:
|
||||
* c->mapend = ((ph->p_vaddr + ph->p_filesz + GLRO(dl_pagesize) - 1)
|
||||
* & ~(GLRO(dl_pagesize) - 1));
|
||||
*
|
||||
* In glibc, the segment file size is aligned up to the nearest page size and
|
||||
* added to the virtual address of the segment. We just want the size here.
|
||||
*/
|
||||
lib.memorySize = PAGE_ALIGN_UP(hdr.p_filesz);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined PLATFORM_APPLE
|
||||
|
||||
Dl_info info;
|
||||
struct mach_header *file;
|
||||
struct segment_command *seg;
|
||||
uint32_t cmd_count;
|
||||
|
||||
if (!dladdr(libPtr, &info))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!info.dli_fbase || !info.dli_fname)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* This is for our insane sanity checks :o */
|
||||
baseAddr = (uintptr_t)info.dli_fbase;
|
||||
file = (struct mach_header *)baseAddr;
|
||||
|
||||
/* Check Mach-O magic */
|
||||
if (file->magic != MH_MAGIC)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check architecture (32-bit/x86) */
|
||||
if (file->cputype != CPU_TYPE_I386 || file->cpusubtype != CPU_SUBTYPE_I386_ALL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* For our purposes, this must be a dynamic library */
|
||||
if (file->filetype != MH_DYLIB)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
cmd_count = file->ncmds;
|
||||
seg = (struct segment_command *)(baseAddr + sizeof(struct mach_header));
|
||||
|
||||
/* Add up memory sizes of mapped segments */
|
||||
for (uint32_t i = 0; i < cmd_count; i++)
|
||||
{
|
||||
if (seg->cmd == LC_SEGMENT)
|
||||
{
|
||||
lib.memorySize += seg->vmsize;
|
||||
}
|
||||
|
||||
seg = (struct segment_command *)((uintptr_t)seg + seg->cmdsize);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
lib.baseAddress = reinterpret_cast<void *>(baseAddr);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2011 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
|
||||
#define _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <IMemoryUtils.h>
|
||||
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
#include <sh_vector.h>
|
||||
#include "sm_symtable.h"
|
||||
|
||||
using namespace SourceHook;
|
||||
#endif
|
||||
|
||||
using namespace SourceMod;
|
||||
|
||||
#ifdef PLATFORM_APPLE
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#endif
|
||||
|
||||
struct DynLibInfo
|
||||
{
|
||||
void *baseAddress;
|
||||
size_t memorySize;
|
||||
};
|
||||
|
||||
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
struct LibSymbolTable
|
||||
{
|
||||
SymbolTable table;
|
||||
uintptr_t lib_base;
|
||||
uint32_t last_pos;
|
||||
};
|
||||
#endif
|
||||
|
||||
class MemoryUtils :
|
||||
public IMemoryUtils,
|
||||
public SMGlobalClass
|
||||
{
|
||||
public:
|
||||
MemoryUtils();
|
||||
~MemoryUtils();
|
||||
public: // SMGlobalClass
|
||||
void OnSourceModAllInitialized();
|
||||
public: // IMemoryUtils
|
||||
void *FindPattern(const void *libPtr, const char *pattern, size_t len);
|
||||
void *ResolveSymbol(void *handle, const char *symbol);
|
||||
public:
|
||||
bool GetLibraryInfo(const void *libPtr, DynLibInfo &lib);
|
||||
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
private:
|
||||
CVector<LibSymbolTable *> m_SymTables;
|
||||
#ifdef PLATFORM_APPLE
|
||||
struct dyld_all_image_infos *m_ImageList;
|
||||
SInt32 m_OSXMajor;
|
||||
SInt32 m_OSXMinor;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
extern MemoryUtils g_MemUtils;
|
||||
|
||||
#endif // _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
|
||||
@@ -29,9 +29,9 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "common_logic.h"
|
||||
#include "PhraseCollection.h"
|
||||
#include "Translator.h"
|
||||
#include "sm_stringutil.h"
|
||||
|
||||
CPhraseCollection::CPhraseCollection()
|
||||
{
|
||||
@@ -54,7 +54,7 @@ IPhraseFile *CPhraseCollection::AddPhraseFile(const char *filename)
|
||||
char full_name[PLATFORM_MAX_PATH];
|
||||
|
||||
/* No compat shim here. The user should have read the doc. */
|
||||
UTIL_Format(full_name, sizeof(full_name), "%s.txt", filename);
|
||||
smcore.Format(full_name, sizeof(full_name), "%s.txt", filename);
|
||||
|
||||
fid = g_Translator.FindOrAddPhraseFile(full_name);
|
||||
pFile = g_Translator.GetFileByIndex(fid);
|
||||
@@ -113,7 +113,7 @@ bool CPhraseCollection::FormatString(char *buffer,
|
||||
unsigned int arg;
|
||||
|
||||
arg = 0;
|
||||
if (!gnprintf(buffer, maxlength, format, this, params, numparams, arg, pOutLength, pFailPhrase))
|
||||
if (!smcore.gnprintf(buffer, maxlength, format, this, params, numparams, arg, pOutLength, pFailPhrase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
+35
-3
@@ -36,6 +36,7 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
#include <IPluginSys.h>
|
||||
#include "stringutil.h"
|
||||
|
||||
ProfileEngine g_Profiler;
|
||||
IProfiler *sm_profiler = &g_Profiler;
|
||||
@@ -341,15 +342,46 @@ void ProfileEngine::OnRootConsoleCommand2(const char *cmdname, const ICommandArg
|
||||
GenerateReport(fp);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
Clear();
|
||||
|
||||
rootmenu->ConsolePrint("Profiler report generated as: %s\n", path);
|
||||
|
||||
return;
|
||||
}
|
||||
else if (strcmp(command->Arg(2), "report") == 0)
|
||||
{
|
||||
FILE *fp;
|
||||
char path[256];
|
||||
|
||||
g_pSM->BuildPath(Path_SM, path, sizeof(path), "logs/profile_%d.xml", (int)time(NULL));
|
||||
|
||||
if ((fp = fopen(path, "wt")) == NULL)
|
||||
{
|
||||
rootmenu->ConsolePrint("Failed, could not open file for writing: %s", path);
|
||||
return;
|
||||
}
|
||||
|
||||
GenerateReport(fp);
|
||||
|
||||
fclose(fp);
|
||||
|
||||
rootmenu->ConsolePrint("Profiler report generated as: %s\n", path);
|
||||
return;
|
||||
}
|
||||
else if (strcmp(command->Arg(2), "clear") == 0)
|
||||
{
|
||||
Clear();
|
||||
|
||||
rootmenu->ConsolePrint("Profiler statistics cleared.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rootmenu->ConsolePrint("Profiler commands:");
|
||||
rootmenu->DrawGenericOption("flush", "Flushes statistics to disk and starts over");
|
||||
rootmenu->DrawGenericOption("report", "Flushes statistics to disk");
|
||||
rootmenu->DrawGenericOption("clear", "Clears statistics");
|
||||
}
|
||||
|
||||
bool ProfileEngine::GenerateReport(FILE *fp)
|
||||
@@ -386,9 +418,9 @@ void ProfileEngine::WriteReport(FILE *fp, ProfileReport *report, const char *nam
|
||||
{
|
||||
ar = report->GetReport(i);
|
||||
|
||||
smcore.strncopy(new_name, ar->atom_name, sizeof(new_name));
|
||||
smcore.ReplaceAll(new_name, sizeof(new_name), "<", "<", true);
|
||||
smcore.ReplaceAll(new_name, sizeof(new_name), ">", ">", true);
|
||||
strncopy(new_name, ar->atom_name, sizeof(new_name));
|
||||
UTIL_ReplaceAll(new_name, sizeof(new_name), "<", "<", true);
|
||||
UTIL_ReplaceAll(new_name, sizeof(new_name), ">", ">", true);
|
||||
|
||||
fprintf(fp, " <item name=\"%s\" numcalls=\"%d\" mintime=\"%f\" maxtime=\"%f\" totaltime=\"%f\"/>\n",
|
||||
new_name,
|
||||
|
||||
@@ -126,6 +126,6 @@ private:
|
||||
prof_point_t m_ProfStart;
|
||||
};
|
||||
|
||||
extern ProfileEngine g_Profiler;
|
||||
extern IProfiler *sm_profiler;
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_PLUGIN_PROFILER_H_
|
||||
|
||||
@@ -872,7 +872,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
||||
ptr = save_ptr;
|
||||
|
||||
/* Lastly, strip ending whitespace off */
|
||||
for (size_t i=len-1; i>=0 && i<len; i--)
|
||||
for (size_t i=len-1; i<len; i--)
|
||||
{
|
||||
if (g_ws_chartable[(unsigned char)ptr[i]])
|
||||
{
|
||||
|
||||
@@ -29,22 +29,24 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <sm_platform.h>
|
||||
#include "Translator.h"
|
||||
#include "Logger.h"
|
||||
#include "LibrarySys.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "sourcemod.h"
|
||||
#include "PlayerManager.h"
|
||||
#include <IPlayerHelpers.h>
|
||||
#include <ISourceMod.h>
|
||||
#include <ILibrarySys.h>
|
||||
#include "PhraseCollection.h"
|
||||
#include "ShareSys.h"
|
||||
#include "stringutil.h"
|
||||
|
||||
Translator g_Translator;
|
||||
IPhraseCollection *g_pCorePhrases = NULL;
|
||||
unsigned int g_pCorePhraseID = 0;
|
||||
|
||||
using namespace SourceMod;
|
||||
|
||||
struct trans_t
|
||||
{
|
||||
int stridx;
|
||||
@@ -67,15 +69,10 @@ CPhraseFile::CPhraseFile(Translator *pTranslator, const char *file)
|
||||
m_LangCount = pTranslator->GetLanguageCount();
|
||||
m_File.assign(file);
|
||||
m_pTranslator = pTranslator;
|
||||
m_pPhraseLookup = NULL;
|
||||
}
|
||||
|
||||
CPhraseFile::~CPhraseFile()
|
||||
{
|
||||
if (m_pPhraseLookup)
|
||||
{
|
||||
sm_trie_destroy(m_pPhraseLookup);
|
||||
}
|
||||
}
|
||||
|
||||
void CPhraseFile::ParseError(const char *message, ...)
|
||||
@@ -99,20 +96,16 @@ void CPhraseFile::ParseWarning(const char *message, ...)
|
||||
|
||||
if (!m_FileLogged)
|
||||
{
|
||||
g_Logger.LogError("[SM] Warning(s) encountered in translation file \"%s\"", m_File.c_str());
|
||||
smcore.LogError("[SM] Warning(s) encountered in translation file \"%s\"", m_File.c_str());
|
||||
m_FileLogged = true;
|
||||
}
|
||||
|
||||
g_Logger.LogError("[SM] %s", buffer);
|
||||
smcore.LogError("[SM] %s", buffer);
|
||||
}
|
||||
|
||||
void CPhraseFile::ReparseFile()
|
||||
{
|
||||
if (m_pPhraseLookup)
|
||||
{
|
||||
sm_trie_destroy(m_pPhraseLookup);
|
||||
}
|
||||
m_pPhraseLookup = sm_trie_create();
|
||||
m_PhraseLookup.clear();
|
||||
|
||||
m_LangCount = m_pTranslator->GetLanguageCount();
|
||||
|
||||
@@ -123,19 +116,19 @@ void CPhraseFile::ReparseFile()
|
||||
|
||||
SMCError err;
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "translations/%s", m_File.c_str());
|
||||
g_pSM->BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "translations/%s", m_File.c_str());
|
||||
|
||||
//backwards compatibility shim
|
||||
/* :HACKHACK: Change .cfg/.txt and vice versa for compatibility */
|
||||
if (!g_LibSys.PathExists(path))
|
||||
if (!libsys->PathExists(path))
|
||||
{
|
||||
if (m_File.compare("common.cfg") == 0)
|
||||
{
|
||||
UTIL_ReplaceAll(path, sizeof(path), "common.cfg", "common.phrases.txt");
|
||||
UTIL_ReplaceAll(path, sizeof(path), "common.cfg", "common.phrases.txt", true);
|
||||
} else if (strstr(path, ".cfg")) {
|
||||
UTIL_ReplaceAll(path, sizeof(path), ".cfg", ".txt");
|
||||
UTIL_ReplaceAll(path, sizeof(path), ".cfg", ".txt", true);
|
||||
} else if (strstr(path, ".txt")) {
|
||||
UTIL_ReplaceAll(path, sizeof(path), ".txt", ".cfg");
|
||||
UTIL_ReplaceAll(path, sizeof(path), ".txt", ".cfg", true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,8 +142,8 @@ void CPhraseFile::ReparseFile()
|
||||
msg = m_ParseError.c_str();
|
||||
}
|
||||
|
||||
g_Logger.LogError("[SM] Fatal error encountered parsing translation file \"%s\"", m_File.c_str());
|
||||
g_Logger.LogError("[SM] Error (line %d, column %d): %s", states.line, states.col, msg);
|
||||
smcore.LogError("[SM] Fatal error encountered parsing translation file \"%s\"", m_File.c_str());
|
||||
smcore.LogError("[SM] Error (line %d, column %d): %s", states.line, states.col, msg);
|
||||
}
|
||||
|
||||
const char *code;
|
||||
@@ -161,7 +154,7 @@ void CPhraseFile::ReparseFile()
|
||||
continue;
|
||||
}
|
||||
|
||||
g_SourceMod.BuildPath(Path_SM,
|
||||
g_pSM->BuildPath(Path_SM,
|
||||
path,
|
||||
PLATFORM_MAX_PATH,
|
||||
"translations/%s/%s",
|
||||
@@ -169,7 +162,7 @@ void CPhraseFile::ReparseFile()
|
||||
m_File.c_str());
|
||||
|
||||
/* Speculatively load these. */
|
||||
if (!g_LibSys.PathExists(path))
|
||||
if (!libsys->PathExists(path))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -182,10 +175,10 @@ void CPhraseFile::ReparseFile()
|
||||
msg = m_ParseError.c_str();
|
||||
}
|
||||
|
||||
g_Logger.LogError("[SM] Fatal error encountered parsing translation file \"%s/%s\"",
|
||||
smcore.LogError("[SM] Fatal error encountered parsing translation file \"%s/%s\"",
|
||||
code,
|
||||
m_File.c_str());
|
||||
g_Logger.LogError("[SM] Error (line %d, column %d): %s",
|
||||
smcore.LogError("[SM] Error (line %d, column %d): %s",
|
||||
states.line,
|
||||
states.col,
|
||||
msg);
|
||||
@@ -217,17 +210,17 @@ SMCResult CPhraseFile::ReadSMC_NewSection(const SMCStates *states, const char *n
|
||||
m_ParseState = PPS_InPhrase;
|
||||
recognized = true;
|
||||
|
||||
void *value;
|
||||
if (sm_trie_retrieve(m_pPhraseLookup, name, &value))
|
||||
int *pvalue;
|
||||
if ((pvalue = m_PhraseLookup.retrieve(name)) != NULL)
|
||||
{
|
||||
m_CurPhrase = reinterpret_cast<int>(value);
|
||||
m_CurPhrase = *pvalue;
|
||||
}
|
||||
else
|
||||
{
|
||||
phrase_t *pPhrase;
|
||||
|
||||
m_CurPhrase = m_pMemory->CreateMem(sizeof(phrase_t), (void **)&pPhrase);
|
||||
sm_trie_insert(m_pPhraseLookup, name, reinterpret_cast<void *>(m_CurPhrase));
|
||||
m_PhraseLookup.insert(name, m_CurPhrase);
|
||||
|
||||
/* Initialize new phrase */
|
||||
trans_t *pTrans;
|
||||
@@ -639,9 +632,7 @@ SMCResult CPhraseFile::ReadSMC_LeavingSection(const SMCStates *states)
|
||||
if (m_ParseState == PPS_InPhrase)
|
||||
{
|
||||
if (m_CurPhrase == -1 && m_LastPhraseString.size())
|
||||
{
|
||||
sm_trie_delete(m_pPhraseLookup, m_LastPhraseString.c_str());
|
||||
}
|
||||
m_PhraseLookup.remove(m_LastPhraseString.c_str());
|
||||
m_CurPhrase = -1;
|
||||
m_ParseState = PPS_Phrases;
|
||||
m_LastPhraseString.assign("");
|
||||
@@ -658,9 +649,7 @@ void CPhraseFile::ReadSMC_ParseEnd(bool halted, bool failed)
|
||||
{
|
||||
/* Check to see if we have any dangling phrases that weren't completed, and scrap them */
|
||||
if ((halted || failed) && m_LastPhraseString.size())
|
||||
{
|
||||
sm_trie_delete(m_pPhraseLookup, m_LastPhraseString.c_str());
|
||||
}
|
||||
m_PhraseLookup.remove(m_LastPhraseString.c_str());
|
||||
}
|
||||
|
||||
TransError CPhraseFile::GetTranslation(const char *szPhrase, unsigned int lang_id, Translation *pTrans)
|
||||
@@ -670,13 +659,11 @@ TransError CPhraseFile::GetTranslation(const char *szPhrase, unsigned int lang_i
|
||||
return Trans_BadLanguage;
|
||||
}
|
||||
|
||||
void *object;
|
||||
if (!sm_trie_retrieve(m_pPhraseLookup, szPhrase, &object))
|
||||
{
|
||||
int *pvalue;
|
||||
if ((pvalue = m_PhraseLookup.retrieve(szPhrase)) == NULL)
|
||||
return Trans_BadPhrase;
|
||||
}
|
||||
|
||||
phrase_t *pPhrase = (phrase_t *)m_pMemory->GetAddress(reinterpret_cast<int>(object));
|
||||
phrase_t *pPhrase = (phrase_t *)m_pMemory->GetAddress(*pvalue);
|
||||
trans_t *trans = (trans_t *)m_pMemory->GetAddress(pPhrase->trans_tbl);
|
||||
|
||||
trans = &trans[lang_id];
|
||||
@@ -705,7 +692,6 @@ const char *CPhraseFile::GetFilename()
|
||||
Translator::Translator() : m_ServerLang(SOURCEMOD_LANGUAGE_ENGLISH)
|
||||
{
|
||||
m_pStringTab = new BaseStringTable(2048);
|
||||
m_pLCodeLookup = sm_trie_create();
|
||||
strncopy(m_InitialLang, "en", sizeof(m_InitialLang));
|
||||
}
|
||||
|
||||
@@ -721,8 +707,6 @@ Translator::~Translator()
|
||||
delete m_Languages[i];
|
||||
}
|
||||
|
||||
sm_trie_destroy(m_pLCodeLookup);
|
||||
|
||||
delete m_pStringTab;
|
||||
}
|
||||
|
||||
@@ -739,13 +723,13 @@ ConfigResult Translator::OnSourceModConfigChanged(const char *key,
|
||||
unsigned int index;
|
||||
if (!GetLanguageByCode(value, &index))
|
||||
{
|
||||
UTIL_Format(error, maxlength, "Language code \"%s\" is not registered", value);
|
||||
smcore.Format(error, maxlength, "Language code \"%s\" is not registered", value);
|
||||
return ConfigResult_Reject;
|
||||
}
|
||||
|
||||
m_ServerLang = index;
|
||||
} else {
|
||||
strncopy(m_InitialLang, value, sizeof(m_InitialLang));
|
||||
smcore.strncopy(m_InitialLang, value, sizeof(m_InitialLang));
|
||||
}
|
||||
|
||||
return ConfigResult_Accept;
|
||||
@@ -758,7 +742,7 @@ void Translator::OnSourceModLevelChange(const char *mapName)
|
||||
{
|
||||
/* Refresh language stuff */
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "configs/languages.cfg");
|
||||
g_pSM->BuildPath(Path_SM, path, sizeof(path), "configs/languages.cfg");
|
||||
RebuildLanguageDatabase(path);
|
||||
}
|
||||
|
||||
@@ -766,10 +750,16 @@ void Translator::OnSourceModAllInitialized()
|
||||
{
|
||||
AddLanguage("en", "English");
|
||||
|
||||
const char* lang = smcore.GetCoreConfigValue("ServerLang");
|
||||
if (lang)
|
||||
{
|
||||
strncpy(m_InitialLang, lang, sizeof(m_InitialLang));
|
||||
}
|
||||
|
||||
g_pCorePhrases = CreatePhraseCollection();
|
||||
g_pCorePhrases->AddPhraseFile("core.phrases");
|
||||
|
||||
g_ShareSys.AddInterface(NULL, this);
|
||||
sharesys->AddInterface(NULL, this);
|
||||
}
|
||||
|
||||
void Translator::OnSourceModShutdown()
|
||||
@@ -779,43 +769,38 @@ void Translator::OnSourceModShutdown()
|
||||
|
||||
bool Translator::GetLanguageByCode(const char *code, unsigned int *index)
|
||||
{
|
||||
void *_index;
|
||||
unsigned int *pindex;
|
||||
|
||||
if (!sm_trie_retrieve(m_pLCodeLookup, code, &_index))
|
||||
{
|
||||
if ((pindex = m_LCodeLookup.retrieve(code)) == NULL)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (index)
|
||||
{
|
||||
*index = reinterpret_cast<unsigned int>(_index);
|
||||
}
|
||||
*index = *pindex;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Translator::GetLanguageByName(const char *name, unsigned int *index)
|
||||
{
|
||||
CVector<Language *>::iterator iter;
|
||||
unsigned int id = 0;
|
||||
|
||||
for (iter=m_Languages.begin(); iter!=m_Languages.end(); iter++, id++)
|
||||
char lower[256];
|
||||
size_t len = strlen(name);
|
||||
if (len > 255) len = 255;
|
||||
for (size_t i = 0; i < len; i++)
|
||||
{
|
||||
if (strcasecmp(m_pStringTab->GetString((*iter)->m_FullName), name) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (name[i] >= 'A' && name[i] <= 'Z')
|
||||
lower[i] = tolower(name[i]);
|
||||
else
|
||||
lower[i] = name[i];
|
||||
}
|
||||
lower[len] = '\0';
|
||||
|
||||
if (iter == m_Languages.end())
|
||||
{
|
||||
unsigned int *pIndex;
|
||||
|
||||
if ((pIndex = m_LAliases.retrieve(lower)) == NULL)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (index)
|
||||
{
|
||||
*index = id;
|
||||
}
|
||||
*index = *pIndex;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -853,8 +838,8 @@ unsigned int Translator::FindOrAddPhraseFile(const char *phrase_file)
|
||||
void Translator::RebuildLanguageDatabase(const char *lang_header_file)
|
||||
{
|
||||
/* Erase everything we have */
|
||||
sm_trie_destroy(m_pLCodeLookup);
|
||||
m_pLCodeLookup = sm_trie_create();
|
||||
m_LCodeLookup.clear();
|
||||
m_LAliases.clear();
|
||||
m_pStringTab->Reset();
|
||||
|
||||
for (size_t i=0; i<m_Languages.size(); i++)
|
||||
@@ -874,25 +859,27 @@ void Translator::RebuildLanguageDatabase(const char *lang_header_file)
|
||||
str_err = m_CustomError.c_str();
|
||||
}
|
||||
|
||||
g_Logger.LogError("[SM] Failed to parse language header file: \"%s\"", lang_header_file);
|
||||
g_Logger.LogError("[SM] Parse error (line %d, column %d): %s", states.line, states.col, str_err);
|
||||
smcore.LogError("[SM] Failed to parse language header file: \"%s\"", lang_header_file);
|
||||
smcore.LogError("[SM] Parse error (line %d, column %d): %s", states.line, states.col, str_err);
|
||||
}
|
||||
|
||||
void *serverLang;
|
||||
unsigned int *pServerLang;
|
||||
|
||||
if (!sm_trie_retrieve(m_pLCodeLookup, m_InitialLang, &serverLang))
|
||||
if ((pServerLang = m_LCodeLookup.retrieve(m_InitialLang)) == NULL)
|
||||
{
|
||||
g_Logger.LogError("Server language was set to bad language \"%s\" -- reverting to English", m_InitialLang);
|
||||
smcore.LogError("Server language was set to bad language \"%s\" -- reverting to English", m_InitialLang);
|
||||
|
||||
strncopy(m_InitialLang, "en", sizeof(m_InitialLang));
|
||||
smcore.strncopy(m_InitialLang, "en", sizeof(m_InitialLang));
|
||||
m_ServerLang = SOURCEMOD_LANGUAGE_ENGLISH;
|
||||
}
|
||||
|
||||
m_ServerLang = reinterpret_cast<unsigned int>(serverLang);
|
||||
else
|
||||
{
|
||||
m_ServerLang = *pServerLang;
|
||||
}
|
||||
|
||||
if (!m_Languages.size())
|
||||
{
|
||||
g_Logger.LogError("[SM] Fatal error, no languages found! Translation will not work.");
|
||||
smcore.LogError("[SM] Fatal error, no languages found! Translation will not work.");
|
||||
}
|
||||
|
||||
for (size_t i=0; i<m_Files.size(); i++)
|
||||
@@ -919,7 +906,7 @@ SMCResult Translator::ReadSMC_NewSection(const SMCStates *states, const char *na
|
||||
|
||||
if (!m_InLanguageSection)
|
||||
{
|
||||
g_Logger.LogError("[SM] Warning: Unrecognized section \"%s\" in languages.cfg", name);
|
||||
smcore.LogError("[SM] Warning: Unrecognized section \"%s\" in languages.cfg", name);
|
||||
}
|
||||
|
||||
return SMCResult_Continue;
|
||||
@@ -938,8 +925,8 @@ SMCResult Translator::ReadSMC_KeyValue(const SMCStates *states, const char *key,
|
||||
|
||||
if (len < 2 || len > 3)
|
||||
{
|
||||
g_Logger.LogError("[SM] Warning encountered parsing languages.cfg file.");
|
||||
g_Logger.LogError("[SM] Invalid language code \"%s\" is being ignored.", key);
|
||||
smcore.LogError("[SM] Warning encountered parsing languages.cfg file.");
|
||||
smcore.LogError("[SM] Invalid language code \"%s\" is being ignored.", key);
|
||||
}
|
||||
|
||||
AddLanguage(key, value);
|
||||
@@ -949,20 +936,40 @@ SMCResult Translator::ReadSMC_KeyValue(const SMCStates *states, const char *key,
|
||||
|
||||
bool Translator::AddLanguage(const char *langcode, const char *description)
|
||||
{
|
||||
if (sm_trie_retrieve(m_pLCodeLookup, langcode, NULL))
|
||||
char lower[256];
|
||||
size_t len = strlen(description);
|
||||
if (len > 255) len = 255;
|
||||
for (size_t i = 0; i < len; i++)
|
||||
{
|
||||
return false;
|
||||
if (description[i] >= 'A' && description[i] <= 'Z')
|
||||
lower[i] = tolower(description[i]);
|
||||
else
|
||||
lower[i] = description[i];
|
||||
}
|
||||
lower[len] = '\0';
|
||||
|
||||
Language *pLanguage = new Language;
|
||||
unsigned int idx = m_Languages.size();
|
||||
if (m_LAliases.retrieve(lower))
|
||||
return false;
|
||||
|
||||
UTIL_Format(pLanguage->m_code2, sizeof(pLanguage->m_code2), "%s", langcode);
|
||||
pLanguage->m_FullName = m_pStringTab->AddString(description);
|
||||
unsigned int idx;
|
||||
if (unsigned int *pIdx = m_LCodeLookup.retrieve(langcode))
|
||||
{
|
||||
idx = *pIdx;
|
||||
}
|
||||
else
|
||||
{
|
||||
Language *pLanguage = new Language;
|
||||
idx = m_Languages.size();
|
||||
|
||||
sm_trie_insert(m_pLCodeLookup, langcode, reinterpret_cast<void *>(idx));
|
||||
smcore.Format(pLanguage->m_code2, sizeof(pLanguage->m_code2), "%s", langcode);
|
||||
pLanguage->m_CanonicalName = m_pStringTab->AddString(lower);
|
||||
|
||||
m_Languages.push_back(pLanguage);
|
||||
m_LCodeLookup.insert(langcode, idx);
|
||||
|
||||
m_Languages.push_back(pLanguage);
|
||||
}
|
||||
|
||||
m_LAliases.insert(lower, idx);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -984,7 +991,7 @@ unsigned int Translator::GetServerLanguage()
|
||||
|
||||
unsigned int Translator::GetClientLanguage(int client)
|
||||
{
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||
IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(client);
|
||||
return pPlayer->GetLanguageId();
|
||||
}
|
||||
|
||||
@@ -1002,7 +1009,7 @@ bool Translator::GetLanguageInfo(unsigned int number, const char **code, const c
|
||||
}
|
||||
if (name)
|
||||
{
|
||||
*name = m_pStringTab->GetString(l->m_FullName);
|
||||
*name = m_pStringTab->GetString(l->m_CanonicalName);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1025,20 +1032,16 @@ IPhraseCollection *Translator::CreatePhraseCollection()
|
||||
|
||||
int Translator::SetGlobalTarget(int index)
|
||||
{
|
||||
return g_SourceMod.SetGlobalTarget(index);
|
||||
return g_pSM->SetGlobalTarget(index);
|
||||
}
|
||||
|
||||
int Translator::GetGlobalTarget() const
|
||||
{
|
||||
return g_SourceMod.GetGlobalTarget();
|
||||
return g_pSM->GetGlobalTarget();
|
||||
}
|
||||
|
||||
bool CoreTranslate(char *buffer,
|
||||
size_t maxlength,
|
||||
const char *format,
|
||||
unsigned int numparams,
|
||||
size_t *pOutLength,
|
||||
...)
|
||||
bool CoreTranslate(char *buffer, size_t maxlength, const char *format, unsigned int numparams,
|
||||
size_t *pOutLength, ...)
|
||||
{
|
||||
va_list ap;
|
||||
unsigned int i;
|
||||
@@ -1068,11 +1071,11 @@ bool CoreTranslate(char *buffer,
|
||||
{
|
||||
if (fail_phrase != NULL)
|
||||
{
|
||||
g_Logger.LogError("[SM] Could not find core phrase: %s", fail_phrase);
|
||||
smcore.LogError("[SM] Could not find core phrase: %s", fail_phrase);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_Logger.LogError("[SM] Unknown fatal error while translating a core phrase.");
|
||||
smcore.LogError("[SM] Unknown fatal error while translating a core phrase.");
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1093,7 +1096,7 @@ bool Translator::FormatString(char *buffer,
|
||||
unsigned int arg;
|
||||
|
||||
arg = 0;
|
||||
if (!gnprintf(buffer, maxlength, format, pPhrases, params, numparams, arg, pOutLength, pFailPhrase))
|
||||
if (!smcore.gnprintf(buffer, maxlength, format, pPhrases, params, numparams, arg, pOutLength, pFailPhrase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -32,17 +32,14 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_TRANSLATOR_H_
|
||||
#define _INCLUDE_SOURCEMOD_TRANSLATOR_H_
|
||||
|
||||
#include "sm_trie.h"
|
||||
#include "common_logic.h"
|
||||
#include <sm_trie_tpl.h>
|
||||
#include <sh_string.h>
|
||||
#include <sh_vector.h>
|
||||
#include "sm_globals.h"
|
||||
#include "sm_memtable.h"
|
||||
#include "ITextParsers.h"
|
||||
#include <ITranslator.h>
|
||||
|
||||
#define MAX_TRANSLATE_PARAMS 32
|
||||
#define CORELANG_ENGLISH 0
|
||||
|
||||
/* :TODO: write a templatized version of tries? */
|
||||
|
||||
using namespace SourceHook;
|
||||
@@ -58,7 +55,7 @@ enum PhraseParseState
|
||||
struct Language
|
||||
{
|
||||
char m_code2[4];
|
||||
int m_FullName;
|
||||
int m_CanonicalName;
|
||||
};
|
||||
|
||||
class CPhraseFile :
|
||||
@@ -82,7 +79,7 @@ private:
|
||||
void ParseError(const char *message, ...);
|
||||
void ParseWarning(const char *message, ...);
|
||||
private:
|
||||
Trie *m_pPhraseLookup;
|
||||
KTrie<int> m_PhraseLookup;
|
||||
String m_File;
|
||||
Translator *m_pTranslator;
|
||||
PhraseParseState m_ParseState;
|
||||
@@ -155,7 +152,8 @@ private:
|
||||
CVector<Language *> m_Languages;
|
||||
CVector<CPhraseFile *> m_Files;
|
||||
BaseStringTable *m_pStringTab;
|
||||
Trie *m_pLCodeLookup;
|
||||
KTrie<unsigned int> m_LCodeLookup;
|
||||
KTrie<unsigned int> m_LAliases;
|
||||
bool m_InLanguageSection;
|
||||
String m_CustomError;
|
||||
unsigned int m_ServerLang;
|
||||
@@ -175,3 +173,4 @@ extern unsigned int g_pCorePhraseID;
|
||||
extern Translator g_Translator;
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_TRANSLATOR_H_
|
||||
|
||||
@@ -33,8 +33,14 @@
|
||||
#include <sm_platform.h>
|
||||
#include <string.h>
|
||||
#include "common_logic.h"
|
||||
#include "ThreadSupport.h"
|
||||
#include "TextParsers.h"
|
||||
#include "Profiler.h"
|
||||
#include "sm_crc32.h"
|
||||
#include "MemoryUtils.h"
|
||||
#include "stringutil.h"
|
||||
#include "ThreadSupport.h"
|
||||
#include "Translator.h"
|
||||
#include "GameConfigs.h"
|
||||
|
||||
sm_core_t smcore;
|
||||
IHandleSys *handlesys;
|
||||
@@ -48,11 +54,35 @@ IShareSys *sharesys;
|
||||
IRootConsole *rootmenu;
|
||||
IPluginManager *pluginsys;
|
||||
IForwardManager *forwardsys;
|
||||
ITimerSystem *timersys;
|
||||
ServerGlobals serverGlobals;
|
||||
IPlayerManager *playerhelpers;
|
||||
IAdminSystem *adminsys;
|
||||
IGameHelpers *gamehelpers;
|
||||
|
||||
static void AddCorePhraseFile(const char *filename)
|
||||
{
|
||||
g_pCorePhrases->AddPhraseFile("antiflood.phrases");
|
||||
}
|
||||
|
||||
static IGameConfig *GetCoreGameConfig()
|
||||
{
|
||||
return g_pGameConf;
|
||||
}
|
||||
|
||||
static sm_logic_t logic =
|
||||
{
|
||||
NULL,
|
||||
g_pThreader
|
||||
g_pThreader,
|
||||
sm_profiler,
|
||||
&g_Translator,
|
||||
stristr,
|
||||
CoreTranslate,
|
||||
AddCorePhraseFile,
|
||||
UTIL_ReplaceAll,
|
||||
UTIL_ReplaceEx,
|
||||
UTIL_DecodeHexString,
|
||||
GetCoreGameConfig
|
||||
};
|
||||
|
||||
static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
|
||||
@@ -61,6 +91,7 @@ static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
|
||||
|
||||
memcpy(&smcore, core, sizeof(sm_core_t));
|
||||
memcpy(_logic, &logic, sizeof(sm_logic_t));
|
||||
memcpy(&serverGlobals, core->serverGlobals, sizeof(ServerGlobals));
|
||||
|
||||
handlesys = core->handlesys;
|
||||
libsys = core->libsys;
|
||||
@@ -71,6 +102,10 @@ static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
|
||||
rootmenu = core->rootmenu;
|
||||
pluginsys = core->pluginsys;
|
||||
forwardsys = core->forwardsys;
|
||||
timersys = core->timersys;
|
||||
playerhelpers = core->playerhelpers;
|
||||
adminsys = core->adminsys;
|
||||
gamehelpers = core->gamehelpers;
|
||||
}
|
||||
|
||||
PLATFORM_EXTERN_C ITextParsers *get_textparsers()
|
||||
|
||||
@@ -47,6 +47,11 @@ extern IShareSys *sharesys;
|
||||
extern IRootConsole *rootmenu;
|
||||
extern IPluginManager *pluginsys;
|
||||
extern IForwardManager *forwardsys;
|
||||
extern ITimerSystem *timersys;
|
||||
extern ServerGlobals serverGlobals;
|
||||
extern IPlayerManager *playerhelpers;
|
||||
extern IAdminSystem *adminsys;
|
||||
extern IGameHelpers *gamehelpers;
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_COMMON_LOGIC_H_ */
|
||||
|
||||
|
||||
+42
-2
@@ -42,7 +42,7 @@ using namespace SourceMod;
|
||||
* Add 1 to the RHS of this expression to bump the intercom file
|
||||
* This is to prevent mismatching core/logic binaries
|
||||
*/
|
||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 2)
|
||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 17)
|
||||
|
||||
#if defined SM_LOGIC
|
||||
class IVEngineServer
|
||||
@@ -52,6 +52,7 @@ class IVEngineServer_Logic
|
||||
{
|
||||
public:
|
||||
virtual bool IsMapValid(const char *map) = 0;
|
||||
virtual void ServerCommand(const char *cmd) = 0;
|
||||
};
|
||||
|
||||
namespace SourceMod
|
||||
@@ -63,11 +64,25 @@ namespace SourceMod
|
||||
class IRootConsole;
|
||||
class IPluginManager;
|
||||
class IForwardManager;
|
||||
class ITimerSystem;
|
||||
class IPlayerManager;
|
||||
class IAdminSystem;
|
||||
class IGameHelpers;
|
||||
class IPhraseCollection;
|
||||
class ITranslator;
|
||||
class IGameConfig;
|
||||
}
|
||||
|
||||
class IVEngineServer;
|
||||
class ConVar;
|
||||
|
||||
struct ServerGlobals
|
||||
{
|
||||
const double *universalTime;
|
||||
float *interval_per_tick;
|
||||
float *frametime;
|
||||
};
|
||||
|
||||
struct sm_core_t
|
||||
{
|
||||
/* Objects */
|
||||
@@ -80,6 +95,10 @@ struct sm_core_t
|
||||
IRootConsole *rootmenu;
|
||||
IPluginManager *pluginsys;
|
||||
IForwardManager *forwardsys;
|
||||
ITimerSystem *timersys;
|
||||
IPlayerManager *playerhelpers;
|
||||
IAdminSystem *adminsys;
|
||||
IGameHelpers *gamehelpers;
|
||||
/* Functions */
|
||||
void (*AddNatives)(sp_nativeinfo_t* nlist);
|
||||
ConVar * (*FindConVar)(const char*);
|
||||
@@ -88,7 +107,20 @@ struct sm_core_t
|
||||
void (*LogError)(const char*, ...);
|
||||
const char * (*GetCvarString)(ConVar*);
|
||||
size_t (*Format)(char*, size_t, const char*, ...);
|
||||
unsigned int (*ReplaceAll)(char*, size_t, const char *, const char *, bool);
|
||||
void (*GenerateError)(IPluginContext *, cell_t, int, const char *, ...);
|
||||
bool (*gnprintf)(char *, size_t, const char *, IPhraseCollection *, void **,
|
||||
unsigned int, unsigned int &, size_t *, const char **);
|
||||
size_t (*atcprintf)(char *, size_t, const char *, IPluginContext *, const cell_t *, int *);
|
||||
bool (*GetGameName)(char *buffer, size_t maxlength);
|
||||
const char * (*GetGameDescription)();
|
||||
const char * (*GetSourceEngineName)();
|
||||
bool (*SymbolsAreHidden)();
|
||||
const char * (*GetCoreConfigValue)(const char*);
|
||||
/* Data */
|
||||
ServerGlobals *serverGlobals;
|
||||
void * serverFactory;
|
||||
void * engineFactory;
|
||||
void * matchmakingDSFactory;
|
||||
};
|
||||
|
||||
struct sm_logic_t
|
||||
@@ -96,6 +128,14 @@ struct sm_logic_t
|
||||
SMGlobalClass *head;
|
||||
IThreader *threader;
|
||||
IProfiler *profiler;
|
||||
ITranslator *translator;
|
||||
const char *(*stristr)(const char *, const char *);
|
||||
bool (*CoreTranslate)(char *, size_t, const char *, unsigned int, size_t *, ...);
|
||||
void (*AddCorePhraseFile)(const char *filename);
|
||||
unsigned int (*ReplaceAll)(char*, size_t, const char *, const char *, bool);
|
||||
char *(*ReplaceEx)(char *, size_t, const char *, size_t, const char *, size_t, bool);
|
||||
size_t (*DecodeHexString)(unsigned char *, size_t, const char *);
|
||||
IGameConfig * (*GetCoreGameConfig)();
|
||||
};
|
||||
|
||||
typedef void (*LogicInitFunction)(const sm_core_t *core, sm_logic_t *logic);
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "logic", "logic.vcxproj", "{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}</ProjectGuid>
|
||||
<RootNamespace>jitx86</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..;$(MMSOURCE18)\core\sourcehook;..\..\..\public;..\..\..\public\sourcepawn;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;JITX86_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SM_DEFAULT_THREADER;SM_LOGIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)sourcemod.logic.dll</OutputFile>
|
||||
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>..;$(MMSOURCE17)\core\sourcehook;..\..\..\public;..\..\..\public\sourcepawn;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;JITX86_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SM_LOGIC;SM_DEFAULT_THREADER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)sourcemod.logic.dll</OutputFile>
|
||||
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\common_logic.cpp" />
|
||||
<ClCompile Include="..\GameConfigs.cpp" />
|
||||
<ClCompile Include="..\MemoryUtils.cpp" />
|
||||
<ClCompile Include="..\PhraseCollection.cpp" />
|
||||
<ClCompile Include="..\Profiler.cpp" />
|
||||
<ClCompile Include="..\sm_crc32.cpp" />
|
||||
<ClCompile Include="..\smn_admin.cpp" />
|
||||
<ClCompile Include="..\smn_adt_array.cpp" />
|
||||
<ClCompile Include="..\smn_adt_stack.cpp" />
|
||||
<ClCompile Include="..\smn_adt_trie.cpp" />
|
||||
<ClCompile Include="..\smn_banning.cpp" />
|
||||
<ClCompile Include="..\smn_datapacks.cpp" />
|
||||
<ClCompile Include="..\smn_float.cpp" />
|
||||
<ClCompile Include="..\smn_functions.cpp" />
|
||||
<ClCompile Include="..\smn_gameconfigs.cpp" />
|
||||
<ClCompile Include="..\smn_handles.cpp" />
|
||||
<ClCompile Include="..\smn_lang.cpp" />
|
||||
<ClCompile Include="..\smn_maplists.cpp" />
|
||||
<ClCompile Include="..\smn_players.cpp" />
|
||||
<ClCompile Include="..\smn_sorting.cpp" />
|
||||
<ClCompile Include="..\smn_string.cpp" />
|
||||
<ClCompile Include="..\smn_textparse.cpp" />
|
||||
<ClCompile Include="..\smn_timers.cpp" />
|
||||
<ClCompile Include="..\stringutil.cpp" />
|
||||
<ClCompile Include="..\TextParsers.cpp" />
|
||||
<ClCompile Include="..\ThreadSupport.cpp" />
|
||||
<ClCompile Include="..\Translator.cpp" />
|
||||
<ClCompile Include="..\thread\BaseWorker.cpp" />
|
||||
<ClCompile Include="..\thread\ThreadWorker.cpp" />
|
||||
<ClCompile Include="..\thread\WinThreads.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\AutoHandleRooter.h" />
|
||||
<ClInclude Include="..\CellArray.h" />
|
||||
<ClInclude Include="..\common_logic.h" />
|
||||
<ClInclude Include="..\GameConfigs.h" />
|
||||
<ClInclude Include="..\intercom.h" />
|
||||
<ClInclude Include="..\MemoryUtils.h" />
|
||||
<ClInclude Include="..\MersenneTwister.h" />
|
||||
<ClInclude Include="..\PhraseCollection.h" />
|
||||
<ClInclude Include="..\Profiler.h" />
|
||||
<ClInclude Include="..\sm_crc32.h" />
|
||||
<ClInclude Include="..\sm_memtable.h" />
|
||||
<ClInclude Include="..\sm_symtable.h" />
|
||||
<ClInclude Include="..\stringutil.h" />
|
||||
<ClInclude Include="..\svn_version.h" />
|
||||
<ClInclude Include="..\TextParsers.h" />
|
||||
<ClInclude Include="..\ThreadSupport.h" />
|
||||
<ClInclude Include="..\thread\BaseWorker.h" />
|
||||
<ClInclude Include="..\thread\ThreadWorker.h" />
|
||||
<ClInclude Include="..\thread\WinThreads.h" />
|
||||
<ClInclude Include="..\Translator.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\version.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,188 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Threads">
|
||||
<UniqueIdentifier>{67c1ebce-c1f8-4d2c-9ef4-33f0ef6343e9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Threads\Header Files">
|
||||
<UniqueIdentifier>{c6e2ebb3-4869-4453-9b83-e49f70cb8a05}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Threads\Source Files">
|
||||
<UniqueIdentifier>{e6d8a9af-1c1b-4f0c-ae06-a9ebd5cd32e4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Natives">
|
||||
<UniqueIdentifier>{126462f2-e517-4854-8a94-759e56787536}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\common_logic.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GameConfigs.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\MemoryUtils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\PhraseCollection.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Profiler.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sm_crc32.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\stringutil.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\TextParsers.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ThreadSupport.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Translator.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\thread\BaseWorker.cpp">
|
||||
<Filter>Threads\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\thread\ThreadWorker.cpp">
|
||||
<Filter>Threads\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\thread\WinThreads.cpp">
|
||||
<Filter>Threads\Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_admin.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_timers.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_adt_array.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_adt_stack.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_adt_trie.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_banning.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_datapacks.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_float.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_functions.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_gameconfigs.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_handles.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_lang.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_maplists.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_players.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_sorting.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_string.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_textparse.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\CellArray.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\common_logic.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\intercom.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Profiler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\svn_version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\TextParsers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ThreadSupport.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\thread\BaseWorker.h">
|
||||
<Filter>Threads\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\thread\ThreadWorker.h">
|
||||
<Filter>Threads\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\thread\WinThreads.h">
|
||||
<Filter>Threads\Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\AutoHandleRooter.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GameConfigs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MemoryUtils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MersenneTwister.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\PhraseCollection.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_crc32.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_memtable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_symtable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\stringutil.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Translator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\version.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -42,7 +42,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..;"$(MMSOURCE17)\core\sourcehook";..\..\..\public;..\..\..\public\sourcepawn"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;JITX86_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SM_DEFAULT_THREADER"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;JITX86_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SM_DEFAULT_THREADER;SM_LOGIC"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@@ -64,7 +64,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\sourcepawn.jit.x86.dll"
|
||||
OutputFile="$(OutDir)\sourcemod.logic.dll"
|
||||
LinkIncremental="2"
|
||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||
GenerateDebugInformation="true"
|
||||
@@ -185,11 +185,19 @@
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\smn_functions.cpp"
|
||||
RelativePath="..\common_logic.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_adt_trie.cpp"
|
||||
RelativePath="..\GameConfigs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\MemoryUtils.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PhraseCollection.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -197,7 +205,11 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\common_logic.cpp"
|
||||
RelativePath="..\sm_crc32.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_admin.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -208,22 +220,66 @@
|
||||
RelativePath="..\smn_adt_stack.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_adt_trie.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_banning.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_datapacks.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_float.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_functions.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_gameconfigs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_handles.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_lang.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_maplists.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_players.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_sorting.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_string.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_textparse.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_timers.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\stringutil.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\TextParsers.cpp"
|
||||
>
|
||||
@@ -232,6 +288,10 @@
|
||||
RelativePath="..\ThreadSupport.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Translator.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
@@ -250,6 +310,10 @@
|
||||
RelativePath="..\intercom.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Profiler.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\svn_version.h"
|
||||
>
|
||||
@@ -262,10 +326,6 @@
|
||||
RelativePath="..\ThreadSupport.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Profiler.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
@@ -276,10 +336,6 @@
|
||||
RelativePath="..\svn_version.tpl"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\version.rc"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Threads"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* vim: set ts=4 sw=4 tw=99 noet:
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -25,8 +25,6 @@
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "sm_crc32.h"
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* vim: set ts=4 sw=4 tw=99 noet:
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
@@ -25,8 +25,6 @@
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_CRC32_H_
|
||||
@@ -0,0 +1,163 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
|
||||
#define _INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
class BaseMemTable
|
||||
{
|
||||
public:
|
||||
BaseMemTable(unsigned int init_size)
|
||||
{
|
||||
membase = (unsigned char *)malloc(init_size);
|
||||
size = init_size;
|
||||
tail = 0;
|
||||
}
|
||||
~BaseMemTable()
|
||||
{
|
||||
free(membase);
|
||||
membase = NULL;
|
||||
}
|
||||
public:
|
||||
/**
|
||||
* Allocates 'size' bytes of memory.
|
||||
* Optionally outputs the address through 'addr'.
|
||||
* Returns an index >= 0 on success, < 0 on failure.
|
||||
*/
|
||||
int CreateMem(unsigned int addsize, void **addr)
|
||||
{
|
||||
int idx = (int)tail;
|
||||
|
||||
while (tail + addsize >= size) {
|
||||
size *= 2;
|
||||
membase = (unsigned char *)realloc(membase, size);
|
||||
}
|
||||
|
||||
tail += addsize;
|
||||
if (addr)
|
||||
*addr = (void *)&membase[idx];
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an index into the memory table, returns its address.
|
||||
* Returns NULL if invalid.
|
||||
*/
|
||||
void *GetAddress(int index)
|
||||
{
|
||||
if (index < 0 || (unsigned int)index >= tail)
|
||||
return NULL;
|
||||
return &membase[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Scraps the memory table. For caching purposes, the memory
|
||||
* is not freed, however subsequent calls to CreateMem() will
|
||||
* begin at the first index again.
|
||||
*/
|
||||
void Reset()
|
||||
{
|
||||
tail = 0;
|
||||
}
|
||||
|
||||
inline unsigned int GetMemUsage()
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
inline unsigned int GetActualMemUsed()
|
||||
{
|
||||
return tail;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned char *membase;
|
||||
unsigned int size;
|
||||
unsigned int tail;
|
||||
};
|
||||
|
||||
class BaseStringTable
|
||||
{
|
||||
public:
|
||||
BaseStringTable(unsigned int init_size) : m_table(init_size)
|
||||
{
|
||||
}
|
||||
public:
|
||||
/**
|
||||
* Adds a string to the string table and returns its index.
|
||||
*/
|
||||
int AddString(const char *string)
|
||||
{
|
||||
size_t len = strlen(string) + 1;
|
||||
int idx;
|
||||
char *addr;
|
||||
|
||||
idx = m_table.CreateMem(len, (void **)&addr);
|
||||
strcpy(addr, string);
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an index into the string table, returns the associated string.
|
||||
*/
|
||||
inline const char *GetString(int str)
|
||||
{
|
||||
return (const char *)m_table.GetAddress(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scraps the string table. For caching purposes, the memory
|
||||
* is not freed, however subsequent calls to AddString() will
|
||||
* begin at the first index again.
|
||||
*/
|
||||
void Reset()
|
||||
{
|
||||
m_table.Reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parent BaseMemTable that this string table uses.
|
||||
*/
|
||||
inline BaseMemTable *GetMemTable()
|
||||
{
|
||||
return &m_table;
|
||||
}
|
||||
private:
|
||||
BaseMemTable m_table;
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_CORE_SYMBOLTABLE_H_
|
||||
#define _INCLUDE_SOURCEMOD_CORE_SYMBOLTABLE_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define KESTRING_TABLE_START_SIZE 65536
|
||||
|
||||
struct Symbol
|
||||
{
|
||||
size_t length;
|
||||
uint32_t hash;
|
||||
void *address;
|
||||
Symbol *tbl_next;
|
||||
|
||||
inline char *buffer()
|
||||
{
|
||||
return reinterpret_cast<char *>(this + 1);
|
||||
}
|
||||
};
|
||||
|
||||
class SymbolTable
|
||||
{
|
||||
public:
|
||||
~SymbolTable()
|
||||
{
|
||||
for (uint32_t i = 0; i < nbuckets; i++)
|
||||
{
|
||||
Symbol *sym = buckets[i];
|
||||
while (sym != NULL)
|
||||
{
|
||||
Symbol *next = sym->tbl_next;
|
||||
free(sym);
|
||||
sym = next;
|
||||
}
|
||||
}
|
||||
free(buckets);
|
||||
}
|
||||
|
||||
bool Initialize()
|
||||
{
|
||||
buckets = (Symbol **)malloc(sizeof(Symbol *) * KESTRING_TABLE_START_SIZE);
|
||||
if (buckets == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
memset(buckets, 0, sizeof(Symbol *) * KESTRING_TABLE_START_SIZE);
|
||||
|
||||
nbuckets = KESTRING_TABLE_START_SIZE;
|
||||
nused = 0;
|
||||
bucketmask = KESTRING_TABLE_START_SIZE - 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline uint32_t HashString(const char *data, size_t len)
|
||||
{
|
||||
#undef get16bits
|
||||
#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \
|
||||
|| defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
|
||||
#define get16bits(d) (*((const uint16_t *) (d)))
|
||||
#endif
|
||||
#if !defined (get16bits)
|
||||
#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\
|
||||
+(uint32_t)(((const uint8_t *)(d))[0]) )
|
||||
#endif
|
||||
uint32_t hash = len, tmp;
|
||||
int rem;
|
||||
|
||||
if (len <= 0 || data == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
rem = len & 3;
|
||||
len >>= 2;
|
||||
|
||||
/* Main loop */
|
||||
for (;len > 0; len--) {
|
||||
hash += get16bits (data);
|
||||
tmp = (get16bits (data+2) << 11) ^ hash;
|
||||
hash = (hash << 16) ^ tmp;
|
||||
data += 2 * sizeof (uint16_t);
|
||||
hash += hash >> 11;
|
||||
}
|
||||
|
||||
/* Handle end cases */
|
||||
switch (rem) {
|
||||
case 3: hash += get16bits (data);
|
||||
hash ^= hash << 16;
|
||||
hash ^= data[sizeof (uint16_t)] << 18;
|
||||
hash += hash >> 11;
|
||||
break;
|
||||
case 2: hash += get16bits (data);
|
||||
hash ^= hash << 11;
|
||||
hash += hash >> 17;
|
||||
break;
|
||||
case 1: hash += *data;
|
||||
hash ^= hash << 10;
|
||||
hash += hash >> 1;
|
||||
}
|
||||
|
||||
/* Force "avalanching" of final 127 bits */
|
||||
hash ^= hash << 3;
|
||||
hash += hash >> 5;
|
||||
hash ^= hash << 4;
|
||||
hash += hash >> 17;
|
||||
hash ^= hash << 25;
|
||||
hash += hash >> 6;
|
||||
|
||||
return hash;
|
||||
|
||||
#undef get16bits
|
||||
}
|
||||
|
||||
Symbol **FindSymbolBucket(const char *str, size_t len, uint32_t hash)
|
||||
{
|
||||
uint32_t bucket = hash & bucketmask;
|
||||
Symbol **pkvs = &buckets[bucket];
|
||||
|
||||
Symbol *kvs = *pkvs;
|
||||
while (kvs != NULL)
|
||||
{
|
||||
if (len == kvs->length && memcmp(str, kvs->buffer(), len * sizeof(char)) == 0)
|
||||
{
|
||||
return pkvs;
|
||||
}
|
||||
pkvs = &kvs->tbl_next;
|
||||
kvs = *pkvs;
|
||||
}
|
||||
|
||||
return pkvs;
|
||||
}
|
||||
|
||||
void ResizeSymbolTable()
|
||||
{
|
||||
uint32_t xnbuckets = nbuckets * 2;
|
||||
Symbol **xbuckets = (Symbol **)malloc(sizeof(Symbol *) * xnbuckets);
|
||||
if (xbuckets == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
memset(xbuckets, 0, sizeof(Symbol *) * xnbuckets);
|
||||
uint32_t xbucketmask = xnbuckets - 1;
|
||||
for (uint32_t i = 0; i < nbuckets; i++)
|
||||
{
|
||||
Symbol *sym = buckets[i];
|
||||
while (sym != NULL)
|
||||
{
|
||||
Symbol *next = sym->tbl_next;
|
||||
uint32_t bucket = sym->hash & xbucketmask;
|
||||
sym->tbl_next = xbuckets[bucket];
|
||||
xbuckets[bucket] = sym;
|
||||
sym = next;
|
||||
}
|
||||
}
|
||||
free(buckets);
|
||||
buckets = xbuckets;
|
||||
nbuckets = xnbuckets;
|
||||
bucketmask = xbucketmask;
|
||||
}
|
||||
|
||||
Symbol *FindSymbol(const char *str, size_t len)
|
||||
{
|
||||
uint32_t hash = HashString(str, len);
|
||||
Symbol **pkvs = FindSymbolBucket(str, len, hash);
|
||||
return *pkvs;
|
||||
}
|
||||
|
||||
Symbol *InternSymbol(const char* str, size_t len, void *address)
|
||||
{
|
||||
uint32_t hash = HashString(str, len);
|
||||
Symbol **pkvs = FindSymbolBucket(str, len, hash);
|
||||
if (*pkvs != NULL)
|
||||
{
|
||||
return *pkvs;
|
||||
}
|
||||
|
||||
Symbol *kvs = (Symbol *)malloc(sizeof(Symbol) + sizeof(char) * (len + 1));
|
||||
kvs->length = len;
|
||||
kvs->hash = hash;
|
||||
kvs->address = address;
|
||||
kvs->tbl_next = NULL;
|
||||
memcpy(kvs + 1, str, sizeof(char) * (len + 1));
|
||||
*pkvs = kvs;
|
||||
nused++;
|
||||
|
||||
if (nused > nbuckets && nbuckets <= INT_MAX / 2)
|
||||
{
|
||||
ResizeSymbolTable();
|
||||
}
|
||||
|
||||
return kvs;
|
||||
}
|
||||
private:
|
||||
uint32_t nbuckets;
|
||||
uint32_t nused;
|
||||
uint32_t bucketmask;
|
||||
Symbol **buckets;
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_CORE_SYMBOLTABLE_H_
|
||||
@@ -29,13 +29,15 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "sm_globals.h"
|
||||
#include "AdminCache.h"
|
||||
#include "ForwardSys.h"
|
||||
#include "common_logic.h"
|
||||
#include <IAdminSystem.h>
|
||||
#include <IForwardSys.h>
|
||||
|
||||
using namespace SourceMod;
|
||||
|
||||
static cell_t DumpAdminCache(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
g_Admins.DumpAdminCache((AdminCachePart)params[1], (params[2] == 1) ? true : false);
|
||||
adminsys->DumpAdminCache((AdminCachePart)params[1], (params[2] == 1) ? true : false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -44,7 +46,7 @@ static cell_t AddCommandOverride(IPluginContext *pContext, const cell_t *params)
|
||||
char *str;
|
||||
|
||||
pContext->LocalToString(params[1], &str);
|
||||
g_Admins.AddCommandOverride(str, (OverrideType)params[2], (AdminFlag)params[3]);
|
||||
adminsys->AddCommandOverride(str, (OverrideType)params[2], (AdminFlag)params[3]);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -56,7 +58,7 @@ static cell_t GetCommandOverride(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
pContext->LocalToString(params[1], &cmd);
|
||||
|
||||
if (!g_Admins.GetCommandOverride(cmd, (OverrideType)params[2], &flags))
|
||||
if (!adminsys->GetCommandOverride(cmd, (OverrideType)params[2], &flags))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -75,7 +77,7 @@ static cell_t UnsetCommandOverride(IPluginContext *pContext, const cell_t *param
|
||||
|
||||
pContext->LocalToString(params[1], &cmd);
|
||||
|
||||
g_Admins.UnsetCommandOverride(cmd, (OverrideType)params[2]);
|
||||
adminsys->UnsetCommandOverride(cmd, (OverrideType)params[2]);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -86,7 +88,7 @@ static cell_t CreateAdmGroup(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
pContext->LocalToString(params[1], &str);
|
||||
|
||||
return g_Admins.AddGroup(str);
|
||||
return adminsys->AddGroup(str);
|
||||
}
|
||||
|
||||
static cell_t FindAdmGroup(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -95,7 +97,7 @@ static cell_t FindAdmGroup(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
pContext->LocalToString(params[1], &str);
|
||||
|
||||
return g_Admins.FindGroupByName(str);
|
||||
return adminsys->FindGroupByName(str);
|
||||
}
|
||||
|
||||
static cell_t SetAdmGroupAddFlag(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -104,7 +106,7 @@ static cell_t SetAdmGroupAddFlag(IPluginContext *pContext, const cell_t *params)
|
||||
AdminFlag flag = (AdminFlag)params[2];
|
||||
bool enabled = params[3] ? 1 : 0;
|
||||
|
||||
g_Admins.SetGroupAddFlag(id, flag, enabled);
|
||||
adminsys->SetGroupAddFlag(id, flag, enabled);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -114,7 +116,7 @@ static cell_t GetAdmGroupAddFlag(IPluginContext *pContext, const cell_t *params)
|
||||
GroupId id = (GroupId)params[1];
|
||||
AdminFlag flag = (AdminFlag)params[2];
|
||||
|
||||
return g_Admins.GetGroupAddFlag(id, flag) ? 1 : 0;
|
||||
return adminsys->GetGroupAddFlag(id, flag) ? 1 : 0;
|
||||
}
|
||||
|
||||
static cell_t SetAdmGroupImmunity(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -123,7 +125,7 @@ static cell_t SetAdmGroupImmunity(IPluginContext *pContext, const cell_t *params
|
||||
ImmunityType type = (ImmunityType)params[2];
|
||||
bool enabled = params[3] ? 1 : 0;
|
||||
|
||||
g_Admins.SetGroupGenericImmunity(id, type, enabled);
|
||||
adminsys->SetGroupGenericImmunity(id, type, enabled);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -133,7 +135,7 @@ static cell_t GetAdmGroupImmunity(IPluginContext *pContext, const cell_t *params
|
||||
GroupId id = (GroupId)params[1];
|
||||
ImmunityType type = (ImmunityType)params[2];
|
||||
|
||||
return g_Admins.GetGroupGenericImmunity(id, type) ? 1 : 0;
|
||||
return adminsys->GetGroupGenericImmunity(id, type) ? 1 : 0;
|
||||
}
|
||||
|
||||
static cell_t SetAdmGroupImmuneFrom(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -141,7 +143,7 @@ static cell_t SetAdmGroupImmuneFrom(IPluginContext *pContext, const cell_t *para
|
||||
GroupId id = (GroupId)params[1];
|
||||
GroupId other_id = (GroupId)params[2];
|
||||
|
||||
g_Admins.AddGroupImmunity(id, other_id);
|
||||
adminsys->AddGroupImmunity(id, other_id);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -150,14 +152,14 @@ static cell_t GetAdmGroupImmuneCount(IPluginContext *pContext, const cell_t *par
|
||||
{
|
||||
GroupId id = (GroupId)params[1];
|
||||
|
||||
return g_Admins.GetGroupImmunityCount(id);
|
||||
return adminsys->GetGroupImmunityCount(id);
|
||||
}
|
||||
|
||||
static cell_t GetAdmGroupImmuneFrom(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
GroupId id = (GroupId)params[1];
|
||||
|
||||
return g_Admins.GetGroupImmunity(id, params[2]);
|
||||
return adminsys->GetGroupImmunity(id, params[2]);
|
||||
}
|
||||
|
||||
static cell_t AddAdmGroupCmdOverride(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -169,7 +171,7 @@ static cell_t AddAdmGroupCmdOverride(IPluginContext *pContext, const cell_t *par
|
||||
|
||||
pContext->LocalToString(params[2], &cmd);
|
||||
|
||||
g_Admins.AddGroupCommandOverride(id, cmd, type, rule);
|
||||
adminsys->AddGroupCommandOverride(id, cmd, type, rule);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -183,7 +185,7 @@ static cell_t GetAdmGroupCmdOverride(IPluginContext *pContext, const cell_t *par
|
||||
|
||||
pContext->LocalToString(params[2], &cmd);
|
||||
|
||||
if (!g_Admins.GetGroupCommandOverride(id, cmd, type, &rule))
|
||||
if (!adminsys->GetGroupCommandOverride(id, cmd, type, &rule))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -198,7 +200,7 @@ static cell_t GetAdmGroupCmdOverride(IPluginContext *pContext, const cell_t *par
|
||||
static cell_t GetAdmGroupAddFlags(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
GroupId id = (GroupId)params[1];
|
||||
return g_Admins.GetGroupAddFlags(id);
|
||||
return adminsys->GetGroupAddFlags(id);
|
||||
}
|
||||
|
||||
static cell_t RegisterAuthIdentType(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -206,7 +208,7 @@ static cell_t RegisterAuthIdentType(IPluginContext *pContext, const cell_t *para
|
||||
char *type;
|
||||
pContext->LocalToString(params[1], &type);
|
||||
|
||||
g_Admins.RegisterAuthIdentType(type);
|
||||
adminsys->RegisterAuthIdentType(type);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -221,14 +223,14 @@ static cell_t CreateAdmin(IPluginContext *pContext, const cell_t *params)
|
||||
admin = NULL;
|
||||
}
|
||||
|
||||
return g_Admins.CreateAdmin(admin);
|
||||
return adminsys->CreateAdmin(admin);
|
||||
}
|
||||
|
||||
static cell_t GetAdminUsername(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
AdminId id = params[1];
|
||||
size_t written;
|
||||
const char *name = g_Admins.GetAdminName(id);
|
||||
const char *name = adminsys->GetAdminName(id);
|
||||
|
||||
if (!name)
|
||||
{
|
||||
@@ -248,7 +250,7 @@ static cell_t BindAdminIdentity(IPluginContext *pContext, const cell_t *params)
|
||||
pContext->LocalToString(params[2], &auth);
|
||||
pContext->LocalToString(params[3], &ident);
|
||||
|
||||
return g_Admins.BindAdminIdentity(id, auth, ident);
|
||||
return adminsys->BindAdminIdentity(id, auth, ident);
|
||||
}
|
||||
|
||||
static cell_t SetAdminFlag(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -257,7 +259,7 @@ static cell_t SetAdminFlag(IPluginContext *pContext, const cell_t *params)
|
||||
AdminFlag flag = (AdminFlag)params[2];
|
||||
bool enabled = params[3] ? true : false;
|
||||
|
||||
g_Admins.SetAdminFlag(id, flag, enabled);
|
||||
adminsys->SetAdminFlag(id, flag, enabled);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -268,7 +270,7 @@ static cell_t GetAdminFlag(IPluginContext *pContext, const cell_t *params)
|
||||
AdminFlag flag = (AdminFlag)params[2];
|
||||
AccessMode mode = (AccessMode)params[3];
|
||||
|
||||
return g_Admins.GetAdminFlag(id, flag, mode);
|
||||
return adminsys->GetAdminFlag(id, flag, mode);
|
||||
}
|
||||
|
||||
static cell_t GetAdminFlags(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -276,7 +278,7 @@ static cell_t GetAdminFlags(IPluginContext *pContext, const cell_t *params)
|
||||
AdminId id = params[1];
|
||||
AccessMode mode = (AccessMode)params[2];
|
||||
|
||||
return g_Admins.GetAdminFlags(id, mode);
|
||||
return adminsys->GetAdminFlags(id, mode);
|
||||
}
|
||||
|
||||
static cell_t AdminInheritGroup(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -284,14 +286,14 @@ static cell_t AdminInheritGroup(IPluginContext *pContext, const cell_t *params)
|
||||
AdminId id = params[1];
|
||||
GroupId gid = params[2];
|
||||
|
||||
return g_Admins.AdminInheritGroup(id, gid);
|
||||
return adminsys->AdminInheritGroup(id, gid);
|
||||
}
|
||||
|
||||
static cell_t GetAdminGroupCount(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
AdminId id = params[1];
|
||||
|
||||
return g_Admins.GetAdminGroupCount(id);
|
||||
return adminsys->GetAdminGroupCount(id);
|
||||
}
|
||||
|
||||
static cell_t GetAdminGroup(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -301,7 +303,7 @@ static cell_t GetAdminGroup(IPluginContext *pContext, const cell_t *params)
|
||||
const char *name;
|
||||
GroupId gid;
|
||||
|
||||
if ((gid=g_Admins.GetAdminGroup(id, index, &name)) == INVALID_GROUP_ID)
|
||||
if ((gid=adminsys->GetAdminGroup(id, index, &name)) == INVALID_GROUP_ID)
|
||||
{
|
||||
return gid;
|
||||
}
|
||||
@@ -323,7 +325,7 @@ static cell_t SetAdminPassword(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
pContext->LocalToString(params[2], &password);
|
||||
|
||||
g_Admins.SetAdminPassword(id, password);
|
||||
adminsys->SetAdminPassword(id, password);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -331,7 +333,7 @@ static cell_t SetAdminPassword(IPluginContext *pContext, const cell_t *params)
|
||||
static cell_t GetAdminPassword(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
AdminId id = params[1];
|
||||
const char *password = g_Admins.GetAdminPassword(id);
|
||||
const char *password = adminsys->GetAdminPassword(id);
|
||||
|
||||
if (!password)
|
||||
{
|
||||
@@ -350,14 +352,14 @@ static cell_t FindAdminByIdentity(IPluginContext *pContext, const cell_t *params
|
||||
pContext->LocalToString(params[1], &auth);
|
||||
pContext->LocalToString(params[2], &ident);
|
||||
|
||||
return g_Admins.FindAdminByIdentity(auth, ident);
|
||||
return adminsys->FindAdminByIdentity(auth, ident);
|
||||
}
|
||||
|
||||
static cell_t RemoveAdmin(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
AdminId id = params[1];
|
||||
|
||||
return g_Admins.InvalidateAdmin(id);
|
||||
return adminsys->InvalidateAdmin(id);
|
||||
}
|
||||
|
||||
static cell_t FlagBitsToBitArray(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -365,7 +367,7 @@ static cell_t FlagBitsToBitArray(IPluginContext *pContext, const cell_t *params)
|
||||
FlagBits bits = (FlagBits)params[1];
|
||||
bool array[AdminFlags_TOTAL];
|
||||
cell_t *addr;
|
||||
unsigned int numWr = g_Admins.FlagBitsToBitArray(bits, array, AdminFlags_TOTAL);
|
||||
unsigned int numWr = adminsys->FlagBitsToBitArray(bits, array, AdminFlags_TOTAL);
|
||||
|
||||
pContext->LocalToPhysAddr(params[2], &addr);
|
||||
|
||||
@@ -391,7 +393,7 @@ static cell_t FlagBitArrayToBits(IPluginContext *pContext, const cell_t *params)
|
||||
array[i] = addr[i] ? true : false;
|
||||
}
|
||||
|
||||
return g_Admins.FlagBitArrayToBits(array, num);
|
||||
return adminsys->FlagBitArrayToBits(array, num);
|
||||
}
|
||||
|
||||
static cell_t FlagArrayToBits(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -401,7 +403,7 @@ static cell_t FlagArrayToBits(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
if (sizeof(AdminFlag) == sizeof(cell_t))
|
||||
{
|
||||
return g_Admins.FlagArrayToBits((const AdminFlag *)addr, params[2]);
|
||||
return adminsys->FlagArrayToBits((const AdminFlag *)addr, params[2]);
|
||||
} else {
|
||||
AdminFlag flags[AdminFlags_TOTAL];
|
||||
unsigned int num = ((unsigned)params[2] > AdminFlags_TOTAL ? AdminFlags_TOTAL : params[2]);
|
||||
@@ -410,7 +412,7 @@ static cell_t FlagArrayToBits(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
flags[i] = (AdminFlag)addr[i];
|
||||
}
|
||||
return g_Admins.FlagArrayToBits(flags, num);
|
||||
return adminsys->FlagArrayToBits(flags, num);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,11 +423,11 @@ static cell_t FlagBitsToArray(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
if (sizeof(AdminFlag) == sizeof(cell_t))
|
||||
{
|
||||
return g_Admins.FlagBitsToArray(params[1], (AdminFlag *)addr, params[3]);
|
||||
return adminsys->FlagBitsToArray(params[1], (AdminFlag *)addr, params[3]);
|
||||
} else {
|
||||
AdminFlag flags[AdminFlags_TOTAL];
|
||||
unsigned int num = ((unsigned)params[2] > AdminFlags_TOTAL ? AdminFlags_TOTAL : params[2]);
|
||||
num = g_Admins.FlagBitsToArray(params[1], flags, num);
|
||||
num = adminsys->FlagBitsToArray(params[1], flags, num);
|
||||
|
||||
for (unsigned int i=0; i<num; i++)
|
||||
{
|
||||
@@ -438,36 +440,36 @@ static cell_t FlagBitsToArray(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t CanAdminTarget(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
return g_Admins.CanAdminTarget(params[1], params[2]) ? 1 : 0;
|
||||
return adminsys->CanAdminTarget(params[1], params[2]) ? 1 : 0;
|
||||
}
|
||||
|
||||
static cell_t CreateAuthMethod(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
char *name;
|
||||
pContext->LocalToString(params[1], &name);
|
||||
g_Admins.RegisterAuthIdentType(name);
|
||||
adminsys->RegisterAuthIdentType(name);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t SetAdmGroupImmunityLevel(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
return g_Admins.SetGroupImmunityLevel(params[1], params[2]);
|
||||
return adminsys->SetGroupImmunityLevel(params[1], params[2]);
|
||||
}
|
||||
|
||||
static cell_t GetAdmGroupImmunityLevel(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
return g_Admins.GetGroupImmunityLevel(params[1]);
|
||||
return adminsys->GetGroupImmunityLevel(params[1]);
|
||||
}
|
||||
|
||||
static cell_t SetAdminImmunityLevel(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
return g_Admins.SetAdminImmunityLevel(params[1], params[2]);
|
||||
return adminsys->SetAdminImmunityLevel(params[1], params[2]);
|
||||
}
|
||||
|
||||
static cell_t GetAdminImmunityLevel(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
return g_Admins.GetAdminImmunityLevel(params[1]);
|
||||
return adminsys->GetAdminImmunityLevel(params[1]);
|
||||
}
|
||||
|
||||
static cell_t FindFlagByName(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -479,7 +481,7 @@ static cell_t FindFlagByName(IPluginContext *pContext, const cell_t *params)
|
||||
pContext->LocalToPhysAddr(params[2], &addr);
|
||||
|
||||
AdminFlag admflag;
|
||||
if (!g_Admins.FindFlag(flag, &admflag))
|
||||
if (!adminsys->FindFlag(flag, &admflag))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -495,7 +497,7 @@ static cell_t FindFlagByChar(IPluginContext *pContext, const cell_t *params)
|
||||
pContext->LocalToPhysAddr(params[2], &addr);
|
||||
|
||||
AdminFlag admflag;
|
||||
if (!g_Admins.FindFlag((char)params[1], &admflag))
|
||||
if (!adminsys->FindFlag((char)params[1], &admflag))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -505,6 +507,22 @@ static cell_t FindFlagByChar(IPluginContext *pContext, const cell_t *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t FindFlagChar(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
cell_t *addr;
|
||||
pContext->LocalToPhysAddr(params[2], &addr);
|
||||
|
||||
char flagchar;
|
||||
if (!adminsys->FindFlagChar((AdminFlag)params[1], &flagchar))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
*addr = (cell_t)flagchar;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t ReadFlagString(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
char *flag;
|
||||
@@ -514,7 +532,7 @@ static cell_t ReadFlagString(IPluginContext *pContext, const cell_t *params)
|
||||
pContext->LocalToPhysAddr(params[2], &addr);
|
||||
|
||||
const char *end = flag;
|
||||
FlagBits bits = g_Admins.ReadFlagString(flag, &end);
|
||||
FlagBits bits = adminsys->ReadFlagString(flag, &end);
|
||||
|
||||
*addr = end - flag;
|
||||
|
||||
@@ -561,6 +579,7 @@ REGISTER_NATIVES(adminNatives)
|
||||
{"CreateAuthMethod", CreateAuthMethod},
|
||||
{"FindFlagByName", FindFlagByName},
|
||||
{"FindFlagByChar", FindFlagByChar},
|
||||
{"FindFlagChar", FindFlagChar},
|
||||
{"ReadFlagString", ReadFlagString},
|
||||
{"GetAdmGroupImmunityLevel",GetAdmGroupImmunityLevel},
|
||||
{"SetAdmGroupImmunityLevel",SetAdmGroupImmunityLevel},
|
||||
@@ -29,11 +29,12 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "sm_globals.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "HalfLife2.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "ForwardSys.h"
|
||||
#include "common_logic.h"
|
||||
#include <string.h>
|
||||
#include <IGameHelpers.h>
|
||||
#include <IPlayerHelpers.h>
|
||||
#include <IForwardSys.h>
|
||||
#include "stringutil.h"
|
||||
|
||||
#define BANFLAG_AUTO (1<<0) /**< Auto-detects whether to ban by steamid or IP */
|
||||
#define BANFLAG_IP (1<<1) /**< Always ban by IP address */
|
||||
@@ -50,7 +51,7 @@ class BanNativeHelpers : public SMGlobalClass
|
||||
public:
|
||||
void OnSourceModAllInitialized()
|
||||
{
|
||||
g_pOnBanClient = g_Forwards.CreateForward(
|
||||
g_pOnBanClient = forwardsys->CreateForward(
|
||||
"OnBanClient",
|
||||
ET_Event,
|
||||
7,
|
||||
@@ -62,7 +63,7 @@ public:
|
||||
Param_String,
|
||||
Param_String,
|
||||
Param_Cell);
|
||||
g_pOnBanIdentity = g_Forwards.CreateForward(
|
||||
g_pOnBanIdentity = forwardsys->CreateForward(
|
||||
"OnBanIdentity",
|
||||
ET_Event,
|
||||
6,
|
||||
@@ -73,7 +74,7 @@ public:
|
||||
Param_String,
|
||||
Param_String,
|
||||
Param_Cell);
|
||||
g_pOnRemoveBan = g_Forwards.CreateForward(
|
||||
g_pOnRemoveBan = forwardsys->CreateForward(
|
||||
"OnRemoveBan",
|
||||
ET_Event,
|
||||
4,
|
||||
@@ -85,9 +86,9 @@ public:
|
||||
}
|
||||
void OnSourceModShutdown()
|
||||
{
|
||||
g_Forwards.ReleaseForward(g_pOnBanClient);
|
||||
g_Forwards.ReleaseForward(g_pOnBanIdentity);
|
||||
g_Forwards.ReleaseForward(g_pOnRemoveBan);
|
||||
forwardsys->ReleaseForward(g_pOnBanClient);
|
||||
forwardsys->ReleaseForward(g_pOnBanIdentity);
|
||||
forwardsys->ReleaseForward(g_pOnRemoveBan);
|
||||
|
||||
g_pOnBanClient = NULL;
|
||||
g_pOnBanIdentity = NULL;
|
||||
@@ -118,7 +119,7 @@ static cell_t BanIdentity(IPluginContext *pContext, const cell_t *params)
|
||||
/* Sanitize the input */
|
||||
char identity[64];
|
||||
strncopy(identity, r_identity, sizeof(identity));
|
||||
UTIL_ReplaceAll(identity, sizeof(identity), ";", "");
|
||||
UTIL_ReplaceAll(identity, sizeof(identity), ";", "", true);
|
||||
|
||||
cell_t handled = 0;
|
||||
if (ban_cmd[0] != '\0' && g_pOnBanIdentity->GetFunctionCount() > 0)
|
||||
@@ -139,7 +140,7 @@ static cell_t BanIdentity(IPluginContext *pContext, const cell_t *params)
|
||||
char command[256];
|
||||
if (ban_by_ip)
|
||||
{
|
||||
UTIL_Format(
|
||||
smcore.Format(
|
||||
command,
|
||||
sizeof(command),
|
||||
"addip %d %s\n",
|
||||
@@ -152,9 +153,9 @@ static cell_t BanIdentity(IPluginContext *pContext, const cell_t *params)
|
||||
engine->ServerCommand("writeip\n");
|
||||
}
|
||||
}
|
||||
else if (!g_HL2.IsLANServer())
|
||||
else if (!gamehelpers->IsLANServer())
|
||||
{
|
||||
UTIL_Format(
|
||||
smcore.Format(
|
||||
command,
|
||||
sizeof(command),
|
||||
"banid %d %s\n",
|
||||
@@ -195,7 +196,7 @@ static cell_t RemoveBan(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
char identity[64];
|
||||
strncopy(identity, r_identity, sizeof(identity));
|
||||
UTIL_ReplaceAll(identity, sizeof(identity), ";", "");
|
||||
UTIL_ReplaceAll(identity, sizeof(identity), ";", "", true);
|
||||
|
||||
cell_t handled = 0;
|
||||
if (ban_cmd[0] != '\0' && g_pOnRemoveBan->GetFunctionCount() > 0)
|
||||
@@ -212,7 +213,7 @@ static cell_t RemoveBan(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
if (!handled)
|
||||
{
|
||||
UTIL_Format(
|
||||
smcore.Format(
|
||||
command,
|
||||
sizeof(command),
|
||||
"removeip %s\n",
|
||||
@@ -221,11 +222,11 @@ static cell_t RemoveBan(IPluginContext *pContext, const cell_t *params)
|
||||
engine->ServerCommand("writeip\n");
|
||||
}
|
||||
}
|
||||
else if (!g_HL2.IsLANServer())
|
||||
else if (!gamehelpers->IsLANServer())
|
||||
{
|
||||
if (!handled)
|
||||
{
|
||||
UTIL_Format(
|
||||
smcore.Format(
|
||||
command,
|
||||
sizeof(command),
|
||||
"removeid %s\n",
|
||||
@@ -248,9 +249,9 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
|
||||
char *ban_reason, *ban_cmd;
|
||||
int client, ban_flags, ban_source, ban_time;
|
||||
|
||||
client = g_HL2.ReferenceToIndex(params[1]);
|
||||
client = gamehelpers->ReferenceToIndex(params[1]);
|
||||
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||
IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(client);
|
||||
if (!pPlayer || !pPlayer->IsConnected())
|
||||
{
|
||||
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
||||
@@ -268,11 +269,16 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
|
||||
ban_flags = params[3];
|
||||
ban_source = params[7];
|
||||
|
||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||
/* Check how we should ban the player */
|
||||
if ((ban_flags & BANFLAG_AUTO) == BANFLAG_AUTO)
|
||||
if (!strcmp(smcore.GetSourceEngineName(), "darkmessiah"))
|
||||
{
|
||||
if (g_HL2.IsLANServer() || !pPlayer->IsAuthorized())
|
||||
/* Dark Messiah doesn't have Steam IDs so there is only one ban method to choose */
|
||||
ban_flags |= BANFLAG_IP;
|
||||
ban_flags &= ~BANFLAG_AUTHID;
|
||||
}
|
||||
else if ((ban_flags & BANFLAG_AUTO) == BANFLAG_AUTO)
|
||||
{
|
||||
if (gamehelpers->IsLANServer() || !pPlayer->IsAuthorized())
|
||||
{
|
||||
ban_flags |= BANFLAG_IP;
|
||||
ban_flags &= ~BANFLAG_AUTHID;
|
||||
@@ -304,11 +310,6 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
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;
|
||||
if (ban_cmd[0] != '\0' && g_pOnBanClient->GetFunctionCount() > 0)
|
||||
@@ -335,7 +336,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
/* Get the IP address and strip the port */
|
||||
char ip[24], *ptr;
|
||||
strncopy(ip, pPlayer->GetIPAddress(), sizeof(ip));
|
||||
smcore.strncopy(ip, pPlayer->GetIPAddress(), sizeof(ip));
|
||||
if ((ptr = strchr(ip, ':')) != NULL)
|
||||
{
|
||||
*ptr = '\0';
|
||||
@@ -343,7 +344,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
/* Tell the server to ban the ip */
|
||||
char command[256];
|
||||
UTIL_Format(
|
||||
smcore.Format(
|
||||
command,
|
||||
sizeof(command),
|
||||
"addip %d %s\n",
|
||||
@@ -367,7 +368,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
/* Tell the server to ban the auth string */
|
||||
char command[256];
|
||||
UTIL_Format(
|
||||
smcore.Format(
|
||||
command,
|
||||
sizeof(command),
|
||||
"banid %d %s\n",
|
||||
@@ -377,7 +378,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
|
||||
/* Kick, then ban */
|
||||
if ((ban_flags & BANFLAG_NOKICK) != BANFLAG_NOKICK)
|
||||
{
|
||||
g_HL2.AddDelayedKick(client, pPlayer->GetUserId(), kick_message);
|
||||
gamehelpers->AddDelayedKick(client, pPlayer->GetUserId(), kick_message);
|
||||
}
|
||||
engine->ServerCommand(command);
|
||||
|
||||
@@ -390,7 +391,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
else if ((ban_flags & BANFLAG_NOKICK) != BANFLAG_NOKICK)
|
||||
{
|
||||
g_HL2.AddDelayedKick(client, pPlayer->GetUserId(), kick_message);
|
||||
gamehelpers->AddDelayedKick(client, pPlayer->GetUserId(), kick_message);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -29,9 +29,10 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "sm_globals.h"
|
||||
#include "HandleSys.h"
|
||||
#include "CDataPack.h"
|
||||
#include "common_logic.h"
|
||||
#include <IHandleSys.h>
|
||||
#include <IDataPack.h>
|
||||
#include <ISourceMod.h>
|
||||
|
||||
HandleType_t g_DataPackType;
|
||||
|
||||
@@ -45,35 +46,35 @@ public:
|
||||
HandleAccess hacc;
|
||||
TypeAccess tacc;
|
||||
|
||||
g_HandleSys.InitAccessDefaults(&tacc, &hacc);
|
||||
handlesys->InitAccessDefaults(&tacc, &hacc);
|
||||
tacc.access[HTypeAccess_Create] = true;
|
||||
tacc.access[HTypeAccess_Inherit] = true;
|
||||
tacc.ident = g_pCoreIdent;
|
||||
hacc.access[HandleAccess_Read] = HANDLE_RESTRICT_OWNER;
|
||||
|
||||
g_DataPackType = g_HandleSys.CreateType("DataPack", this, 0, &tacc, &hacc, g_pCoreIdent, NULL);
|
||||
g_DataPackType = handlesys->CreateType("DataPack", this, 0, &tacc, &hacc, g_pCoreIdent, NULL);
|
||||
}
|
||||
void OnSourceModShutdown()
|
||||
{
|
||||
g_HandleSys.RemoveType(g_DataPackType, g_pCoreIdent);
|
||||
handlesys->RemoveType(g_DataPackType, g_pCoreIdent);
|
||||
g_DataPackType = 0;
|
||||
}
|
||||
void OnHandleDestroy(HandleType_t type, void *object)
|
||||
{
|
||||
g_SourceMod.FreeDataPack(reinterpret_cast<IDataPack *>(object));
|
||||
g_pSM->FreeDataPack(reinterpret_cast<IDataPack *>(object));
|
||||
}
|
||||
};
|
||||
|
||||
static cell_t smn_CreateDataPack(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
IDataPack *pDataPack = g_SourceMod.CreateDataPack();
|
||||
IDataPack *pDataPack = g_pSM->CreateDataPack();
|
||||
|
||||
if (!pDataPack)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return g_HandleSys.CreateHandle(g_DataPackType, pDataPack, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
return handlesys->CreateHandle(g_DataPackType, pDataPack, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
}
|
||||
|
||||
static cell_t smn_WritePackCell(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -86,7 +87,7 @@ static cell_t smn_WritePackCell(IPluginContext *pContext, const cell_t *params)
|
||||
sec.pOwner = pContext->GetIdentity();
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
|
||||
@@ -107,7 +108,7 @@ static cell_t smn_WritePackFloat(IPluginContext *pContext, const cell_t *params)
|
||||
sec.pOwner = pContext->GetIdentity();
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
|
||||
@@ -129,7 +130,7 @@ static cell_t smn_WritePackString(IPluginContext *pContext, const cell_t *params
|
||||
sec.pOwner = pContext->GetIdentity();
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
|
||||
@@ -157,7 +158,7 @@ static cell_t smn_ReadPackCell(IPluginContext *pContext, const cell_t *params)
|
||||
sec.pOwner = pContext->GetIdentity();
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
|
||||
@@ -181,7 +182,7 @@ static cell_t smn_ReadPackFloat(IPluginContext *pContext, const cell_t *params)
|
||||
sec.pOwner = pContext->GetIdentity();
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
|
||||
@@ -205,7 +206,7 @@ static cell_t smn_ReadPackString(IPluginContext *pContext, const cell_t *params)
|
||||
sec.pOwner = pContext->GetIdentity();
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
|
||||
@@ -232,7 +233,7 @@ static cell_t smn_ResetPack(IPluginContext *pContext, const cell_t *params)
|
||||
sec.pOwner = pContext->GetIdentity();
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
|
||||
@@ -257,7 +258,7 @@ static cell_t smn_GetPackPosition(IPluginContext *pContext, const cell_t *params
|
||||
sec.pOwner = pContext->GetIdentity();
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
|
||||
@@ -276,7 +277,7 @@ static cell_t smn_SetPackPosition(IPluginContext *pContext, const cell_t *params
|
||||
sec.pOwner = pContext->GetIdentity();
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
|
||||
@@ -300,7 +301,7 @@ static cell_t smn_IsPackReadable(IPluginContext *pContext, const cell_t *params)
|
||||
sec.pOwner = pContext->GetIdentity();
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
|
||||
@@ -29,24 +29,24 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "sourcemod.h"
|
||||
#include "HandleSys.h"
|
||||
#include "common_logic.h"
|
||||
#include <IHandleSys.h>
|
||||
#include "GameConfigs.h"
|
||||
|
||||
HandleType_t g_GameConfigsType;
|
||||
|
||||
class GameConfigsNatives :
|
||||
public IHandleTypeDispatch,
|
||||
public SourceModBase
|
||||
public SMGlobalClass
|
||||
{
|
||||
public:
|
||||
void OnSourceModAllInitialized()
|
||||
{
|
||||
g_GameConfigsType = g_HandleSys.CreateType("GameConfigs", this, 0, NULL, NULL, g_pCoreIdent, NULL);
|
||||
g_GameConfigsType = handlesys->CreateType("GameConfigs", this, 0, NULL, NULL, g_pCoreIdent, NULL);
|
||||
}
|
||||
void OnSourceModShutdown()
|
||||
{
|
||||
g_HandleSys.RemoveType(g_GameConfigsType, g_pCoreIdent);
|
||||
handlesys->RemoveType(g_GameConfigsType, g_pCoreIdent);
|
||||
g_GameConfigsType = 0;
|
||||
}
|
||||
void OnHandleDestroy(HandleType_t type, void *object)
|
||||
@@ -67,7 +67,7 @@ static cell_t smn_LoadGameConfigFile(IPluginContext *pCtx, const cell_t *params)
|
||||
return pCtx->ThrowNativeError("Unable to open %s: %s", filename, error);
|
||||
}
|
||||
|
||||
return g_HandleSys.CreateHandle(g_GameConfigsType, gc, pCtx->GetIdentity(), g_pCoreIdent, NULL);
|
||||
return handlesys->CreateHandle(g_GameConfigsType, gc, pCtx->GetIdentity(), g_pCoreIdent, NULL);
|
||||
}
|
||||
|
||||
static cell_t smn_GameConfGetOffset(IPluginContext *pCtx, const cell_t *params)
|
||||
@@ -80,7 +80,7 @@ static cell_t smn_GameConfGetOffset(IPluginContext *pCtx, const cell_t *params)
|
||||
sec.pOwner = NULL;
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&gc))
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&gc))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid game config handle %x (error %d)", hndl, herr);
|
||||
@@ -108,7 +108,7 @@ static cell_t smn_GameConfGetKeyValue(IPluginContext *pCtx, const cell_t *params
|
||||
sec.pOwner = NULL;
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&gc))
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&gc))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid game config handle %x (error %d)", hndl, herr);
|
||||
@@ -128,6 +128,33 @@ static cell_t smn_GameConfGetKeyValue(IPluginContext *pCtx, const cell_t *params
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static cell_t smn_GameConfGetAddress(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
Handle_t hndl = static_cast<Handle_t>(params[1]);
|
||||
HandleError herr;
|
||||
HandleSecurity sec;
|
||||
IGameConfig *gc;
|
||||
|
||||
sec.pOwner = NULL;
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&gc))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid game config handle %x (error %d)", hndl, herr);
|
||||
}
|
||||
|
||||
char *key;
|
||||
void* val;
|
||||
pCtx->LocalToString(params[2], &key);
|
||||
|
||||
if (!gc->GetAddress(key, &val))
|
||||
return 0;
|
||||
|
||||
return (cell_t)val;
|
||||
}
|
||||
|
||||
static GameConfigsNatives s_GameConfigsNatives;
|
||||
|
||||
REGISTER_NATIVES(gameconfignatives)
|
||||
@@ -135,5 +162,6 @@ REGISTER_NATIVES(gameconfignatives)
|
||||
{"LoadGameConfigFile", smn_LoadGameConfigFile},
|
||||
{"GameConfGetOffset", smn_GameConfGetOffset},
|
||||
{"GameConfGetKeyValue", smn_GameConfGetKeyValue},
|
||||
{"GameConfGetAddress", smn_GameConfGetAddress},
|
||||
{NULL, NULL}
|
||||
};
|
||||
@@ -29,15 +29,17 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "sm_globals.h"
|
||||
#include "HandleSys.h"
|
||||
#include "PluginSys.h"
|
||||
#include "common_logic.h"
|
||||
#include <IHandleSys.h>
|
||||
#include <IPluginSys.h>
|
||||
|
||||
using namespace SourceMod;
|
||||
|
||||
static cell_t sm_IsValidHandle(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
Handle_t hndl = static_cast<Handle_t>(params[1]);
|
||||
|
||||
HandleError err = g_HandleSys.ReadHandle(hndl, 0, NULL, NULL);
|
||||
HandleError err = handlesys->ReadHandle(hndl, 0, NULL, NULL);
|
||||
|
||||
if (err != HandleError_Access
|
||||
&& err != HandleError_None)
|
||||
@@ -56,7 +58,7 @@ static cell_t sm_CloseHandle(IPluginContext *pContext, const cell_t *params)
|
||||
sec.pIdentity = NULL;
|
||||
sec.pOwner = pContext->GetIdentity();
|
||||
|
||||
HandleError err = g_HandleSys.FreeHandle(hndl, &sec);
|
||||
HandleError err = handlesys->FreeHandle(hndl, &sec);
|
||||
|
||||
if (err == HandleError_None)
|
||||
{
|
||||
@@ -80,7 +82,7 @@ static cell_t sm_CloneHandle(IPluginContext *pContext, const cell_t *params)
|
||||
pNewOwner = pContext->GetIdentity();
|
||||
} else {
|
||||
Handle_t hPlugin = static_cast<Handle_t>(params[2]);
|
||||
IPlugin *pPlugin = g_PluginSys.PluginFromHandle(hPlugin, &err);
|
||||
IPlugin *pPlugin = pluginsys->PluginFromHandle(hPlugin, &err);
|
||||
if (!pPlugin)
|
||||
{
|
||||
return pContext->ThrowNativeError("Plugin handle %x is invalid (error %d)", hndl, err);
|
||||
@@ -88,7 +90,7 @@ static cell_t sm_CloneHandle(IPluginContext *pContext, const cell_t *params)
|
||||
pNewOwner = pPlugin->GetIdentity();
|
||||
}
|
||||
|
||||
err = g_HandleSys.CloneHandle(hndl, &new_hndl, pNewOwner, NULL);
|
||||
err = handlesys->CloneHandle(hndl, &new_hndl, pNewOwner, NULL);
|
||||
|
||||
if (err == HandleError_Access)
|
||||
{
|
||||
@@ -102,7 +104,7 @@ static cell_t sm_CloneHandle(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t sm_GetMyHandle(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
|
||||
IPlugin *pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
|
||||
return pPlugin->GetMyHandle();
|
||||
}
|
||||
@@ -29,20 +29,20 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "PluginSys.h"
|
||||
#include "common_logic.h"
|
||||
#include "Translator.h"
|
||||
#include "LibrarySys.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include "PlayerManager.h"
|
||||
#include <IPlayerHelpers.h>
|
||||
#include <IPluginSys.h>
|
||||
#include <ISourceMod.h>
|
||||
|
||||
static cell_t sm_LoadTranslations(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
char *filename, *ext;
|
||||
char buffer[PLATFORM_MAX_PATH];
|
||||
CPlugin *pl = (CPlugin *)g_PluginSys.FindPluginByContext(pCtx->GetContext());
|
||||
IPlugin *pl = pluginsys->FindPluginByContext(pCtx->GetContext());
|
||||
|
||||
pCtx->LocalToString(params[1], &filename);
|
||||
UTIL_Format(buffer, sizeof(buffer), "%s", filename);
|
||||
smcore.Format(buffer, sizeof(buffer), "%s", filename);
|
||||
|
||||
/* Make sure there is no extension */
|
||||
if ((ext = strstr(buffer, ".txt")) != NULL
|
||||
@@ -62,14 +62,14 @@ static cell_t sm_LoadTranslations(IPluginContext *pCtx, const cell_t *params)
|
||||
|
||||
static cell_t sm_SetGlobalTransTarget(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
g_SourceMod.SetGlobalTarget(params[1]);
|
||||
g_pSM->SetGlobalTarget(params[1]);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t sm_GetClientLanguage(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CPlayer *player = g_Players.GetPlayerByIndex(params[1]);
|
||||
IGamePlayer *player = playerhelpers->GetGamePlayer(params[1]);
|
||||
if (!player || !player->IsConnected())
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid client index %d", params[1]);
|
||||
@@ -104,6 +104,46 @@ static cell_t sm_GetLanguageInfo(IPluginContext *pContext, const cell_t *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t sm_SetClientLanguage(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
IGamePlayer *player = playerhelpers->GetGamePlayer(params[1]);
|
||||
|
||||
if (!player || !player->IsConnected())
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid client index %d", params[1]);
|
||||
}
|
||||
|
||||
player->SetLanguageId(params[2]);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t sm_GetLanguageByCode(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
char *code;
|
||||
unsigned int langid;
|
||||
|
||||
pContext->LocalToString(params[1], &code);
|
||||
|
||||
if (g_Translator.GetLanguageByCode(code, &langid))
|
||||
return langid;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static cell_t sm_GetLanguageByName(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
char *name;
|
||||
unsigned int langid;
|
||||
|
||||
pContext->LocalToString(params[1], &name);
|
||||
|
||||
if (g_Translator.GetLanguageByName(name, &langid))
|
||||
return langid;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(langNatives)
|
||||
{
|
||||
{"LoadTranslations", sm_LoadTranslations},
|
||||
@@ -112,5 +152,8 @@ REGISTER_NATIVES(langNatives)
|
||||
{"GetServerLanguage", sm_GetServerLanguage},
|
||||
{"GetLanguageCount", sm_GetLanguageCount},
|
||||
{"GetLanguageInfo", sm_GetLanguageInfo},
|
||||
{"SetClientLanguage", sm_SetClientLanguage},
|
||||
{"GetLanguageByCode", sm_GetLanguageByCode},
|
||||
{"GetLanguageByName", sm_GetLanguageByName},
|
||||
{NULL, NULL},
|
||||
};
|
||||
@@ -0,0 +1,235 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <IPluginSys.h>
|
||||
#include <IPlayerHelpers.h>
|
||||
#include <sh_string.h>
|
||||
#include <sh_list.h>
|
||||
#include "AutoHandleRooter.h"
|
||||
#include "CellArray.h"
|
||||
|
||||
using namespace SourceHook;
|
||||
using namespace SourceMod;
|
||||
|
||||
class PlayerLogicHelpers :
|
||||
public SMGlobalClass,
|
||||
public IPluginsListener,
|
||||
public ICommandTargetProcessor
|
||||
{
|
||||
struct SimpleMultiTargetFilter
|
||||
{
|
||||
IPlugin *plugin;
|
||||
SourceHook::String pattern;
|
||||
IPluginFunction *fun;
|
||||
SourceHook::String phrase;
|
||||
bool phraseIsML;
|
||||
|
||||
SimpleMultiTargetFilter(IPlugin *plugin, const char *pattern, IPluginFunction *fun,
|
||||
const char *phrase, bool phraseIsML)
|
||||
: plugin(plugin), pattern(pattern), fun(fun), phrase(phrase), phraseIsML(phraseIsML)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
List<SimpleMultiTargetFilter *> simpleMultis;
|
||||
bool filterEnabled;
|
||||
|
||||
public:
|
||||
void AddMultiTargetFilter(IPlugin *plugin, const char *pattern, IPluginFunction *fun,
|
||||
const char *phrase, bool phraseIsML)
|
||||
{
|
||||
SimpleMultiTargetFilter *smtf = new SimpleMultiTargetFilter(plugin, pattern, fun, phrase,
|
||||
phraseIsML);
|
||||
|
||||
simpleMultis.push_back(smtf);
|
||||
|
||||
if (!filterEnabled) {
|
||||
playerhelpers->RegisterCommandTargetProcessor(this);
|
||||
filterEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveMultiTargetFilter(const char *pattern, IPluginFunction *fun)
|
||||
{
|
||||
List<SimpleMultiTargetFilter *>::iterator iter = simpleMultis.begin();
|
||||
|
||||
while (iter != simpleMultis.end()) {
|
||||
if ((*iter)->fun == fun && strcmp((*iter)->pattern.c_str(), pattern) == 0) {
|
||||
delete (*iter);
|
||||
iter = simpleMultis.erase(iter);
|
||||
break;
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
PlayerLogicHelpers()
|
||||
: filterEnabled(false)
|
||||
{
|
||||
}
|
||||
|
||||
public: //ICommandTargetProcessor
|
||||
bool ProcessCommandTarget(cmd_target_info_t *info)
|
||||
{
|
||||
List<SimpleMultiTargetFilter *>::iterator iter;
|
||||
|
||||
for (iter = simpleMultis.begin(); iter != simpleMultis.end(); iter++) {
|
||||
SimpleMultiTargetFilter *smtf = (*iter);
|
||||
if (strcmp(smtf->pattern.c_str(), info->pattern) == 0) {
|
||||
CellArray *array = new CellArray(1);
|
||||
HandleSecurity sec(g_pCoreIdent, g_pCoreIdent);
|
||||
Handle_t hndl = handlesys->CreateHandleEx(htCellArray, array, &sec, NULL, NULL);
|
||||
AutoHandleCloner ahc(hndl, sec);
|
||||
if (ahc.getClone() == BAD_HANDLE) {
|
||||
smcore.LogError("[SM] Could not allocate a handle (%s, %d)", __FILE__, __LINE__);
|
||||
delete array;
|
||||
return false;
|
||||
}
|
||||
|
||||
smtf->fun->PushString(info->pattern);
|
||||
smtf->fun->PushCell(ahc.getClone());
|
||||
cell_t result = 0;
|
||||
if (smtf->fun->Execute(&result) != SP_ERROR_NONE || !result)
|
||||
return false;
|
||||
|
||||
IGamePlayer *pAdmin = info->admin
|
||||
? playerhelpers->GetGamePlayer(info->admin)
|
||||
: NULL;
|
||||
|
||||
info->num_targets = 0;
|
||||
for (size_t i = 0; i < array->size(); i++) {
|
||||
cell_t client = *array->at(i);
|
||||
IGamePlayer *pClient = playerhelpers->GetGamePlayer(client);
|
||||
if (pClient == NULL || !pClient->IsConnected())
|
||||
continue;
|
||||
if (playerhelpers->FilterCommandTarget(pAdmin, pClient, info->flags) ==
|
||||
COMMAND_TARGET_VALID)
|
||||
{
|
||||
info->targets[info->num_targets++] = client;
|
||||
if (info->num_targets >= unsigned(info->max_targets))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
info->reason = info->num_targets > 0
|
||||
? COMMAND_TARGET_VALID
|
||||
: COMMAND_TARGET_EMPTY_FILTER;
|
||||
if (info->num_targets) {
|
||||
smcore.strncopy(info->target_name, smtf->phrase.c_str(), info->target_name_maxlength);
|
||||
info->target_name_style = smtf->phraseIsML
|
||||
? COMMAND_TARGETNAME_ML
|
||||
: COMMAND_TARGETNAME_RAW;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public: //SMGlobalClass
|
||||
void OnSourceModAllInitialized()
|
||||
{
|
||||
pluginsys->AddPluginsListener(this);
|
||||
}
|
||||
|
||||
void OnSourceModShutdown()
|
||||
{
|
||||
pluginsys->RemovePluginsListener(this);
|
||||
if (filterEnabled) {
|
||||
playerhelpers->UnregisterCommandTargetProcessor(this);
|
||||
filterEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public: //IPluginsListener
|
||||
|
||||
void OnPluginDestroyed(IPlugin *plugin)
|
||||
{
|
||||
List<SimpleMultiTargetFilter *>::iterator iter = simpleMultis.begin();
|
||||
|
||||
while (iter != simpleMultis.end()) {
|
||||
if ((*iter)->plugin != plugin) {
|
||||
iter++;
|
||||
} else {
|
||||
delete (*iter);
|
||||
iter = simpleMultis.erase(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
} s_PlayerLogicHelpers;
|
||||
|
||||
static cell_t
|
||||
AddMultiTargetFilter(IPluginContext *ctx, const cell_t *params)
|
||||
{
|
||||
IPluginFunction *fun = ctx->GetFunctionById(funcid_t(params[2]));
|
||||
if (fun == NULL)
|
||||
return ctx->ThrowNativeError("Invalid function id (%X)", params[2]);
|
||||
|
||||
char *pattern;
|
||||
char *phrase;
|
||||
|
||||
ctx->LocalToString(params[1], &pattern);
|
||||
ctx->LocalToString(params[3], &phrase);
|
||||
|
||||
bool phraseIsML = !!params[4];
|
||||
IPlugin *plugin = pluginsys->FindPluginByContext(ctx->GetContext());
|
||||
|
||||
s_PlayerLogicHelpers.AddMultiTargetFilter(plugin, pattern, fun, phrase, phraseIsML);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t
|
||||
RemoveMultiTargetFilter(IPluginContext *ctx, const cell_t *params)
|
||||
{
|
||||
IPluginFunction *fun = ctx->GetFunctionById(funcid_t(params[2]));
|
||||
if (fun == NULL)
|
||||
return ctx->ThrowNativeError("Invalid function id (%X)", params[2]);
|
||||
|
||||
char *pattern;
|
||||
|
||||
ctx->LocalToString(params[1], &pattern);
|
||||
|
||||
s_PlayerLogicHelpers.RemoveMultiTargetFilter(pattern, fun);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(playernatives)
|
||||
{
|
||||
{"AddMultiTargetFilter", AddMultiTargetFilter},
|
||||
{"RemoveMultiTargetFilter", RemoveMultiTargetFilter},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -29,12 +29,13 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "sm_globals.h"
|
||||
#include "HandleSys.h"
|
||||
|
||||
//Note: Do not add this to Linux yet, i haven't done the HPET timing research (if even available)
|
||||
//nonetheless we need accurate counting
|
||||
#if !defined PLATFORM_LINUX
|
||||
#include "common_logic.h"
|
||||
#include <IHandleSys.h>
|
||||
#if !defined PLATFORM_WINDOWS
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
struct Profiler
|
||||
{
|
||||
@@ -47,6 +48,9 @@ struct Profiler
|
||||
LARGE_INTEGER start;
|
||||
LARGE_INTEGER end;
|
||||
double freq;
|
||||
#else
|
||||
struct timeval start;
|
||||
struct timeval end;
|
||||
#endif
|
||||
bool started;
|
||||
bool stopped;
|
||||
@@ -61,11 +65,11 @@ class ProfilerHelpers :
|
||||
public:
|
||||
void OnSourceModAllInitialized()
|
||||
{
|
||||
g_ProfilerType = g_HandleSys.CreateType("Profiler", this, 0, NULL, NULL, g_pCoreIdent, NULL);
|
||||
g_ProfilerType = handlesys->CreateType("Profiler", this, 0, NULL, NULL, g_pCoreIdent, NULL);
|
||||
}
|
||||
void OnSourceModShutdown()
|
||||
{
|
||||
g_HandleSys.RemoveType(g_ProfilerType, g_pCoreIdent);
|
||||
handlesys->RemoveType(g_ProfilerType, g_pCoreIdent);
|
||||
}
|
||||
void OnHandleDestroy(HandleType_t type, void *object)
|
||||
{
|
||||
@@ -84,7 +88,7 @@ static cell_t CreateProfiler(IPluginContext *pContext, const cell_t *params)
|
||||
p->freq = 1.0 / (double)(qpf.QuadPart);
|
||||
#endif
|
||||
|
||||
Handle_t hndl = g_HandleSys.CreateHandle(g_ProfilerType, p, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
Handle_t hndl = handlesys->CreateHandle(g_ProfilerType, p, pContext->GetIdentity(), g_pCoreIdent, NULL);
|
||||
if (hndl == BAD_HANDLE)
|
||||
{
|
||||
delete p;
|
||||
@@ -100,7 +104,7 @@ static cell_t StartProfiling(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
Profiler *prof;
|
||||
|
||||
if ((err = g_HandleSys.ReadHandle(hndl, g_ProfilerType, &sec, (void **)&prof))
|
||||
if ((err = handlesys->ReadHandle(hndl, g_ProfilerType, &sec, (void **)&prof))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
|
||||
@@ -108,6 +112,8 @@ static cell_t StartProfiling(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
#if defined PLATFORM_WINDOWS
|
||||
QueryPerformanceCounter(&prof->start);
|
||||
#else
|
||||
gettimeofday(&prof->start, NULL);
|
||||
#endif
|
||||
|
||||
prof->started = true;
|
||||
@@ -123,7 +129,7 @@ static cell_t StopProfiling(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
Profiler *prof;
|
||||
|
||||
if ((err = g_HandleSys.ReadHandle(hndl, g_ProfilerType, &sec, (void **)&prof))
|
||||
if ((err = handlesys->ReadHandle(hndl, g_ProfilerType, &sec, (void **)&prof))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
|
||||
@@ -136,6 +142,8 @@ static cell_t StopProfiling(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
#if defined PLATFORM_WINDOWS
|
||||
QueryPerformanceCounter(&prof->end);
|
||||
#else
|
||||
gettimeofday(&prof->end, NULL);
|
||||
#endif
|
||||
|
||||
prof->started = false;
|
||||
@@ -151,7 +159,7 @@ static cell_t GetProfilerTime(IPluginContext *pContext, const cell_t *params)
|
||||
HandleError err;
|
||||
Profiler *prof;
|
||||
|
||||
if ((err = g_HandleSys.ReadHandle(hndl, g_ProfilerType, &sec, (void **)&prof))
|
||||
if ((err = handlesys->ReadHandle(hndl, g_ProfilerType, &sec, (void **)&prof))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
|
||||
@@ -168,6 +176,10 @@ static cell_t GetProfilerTime(IPluginContext *pContext, const cell_t *params)
|
||||
LONGLONG diff = prof->end.QuadPart - prof->start.QuadPart;
|
||||
double seconds = diff * prof->freq;
|
||||
fTime = (float)seconds;
|
||||
#else
|
||||
int64_t start_us = int64_t(prof->start.tv_sec) * 1000000 + prof->start.tv_usec;
|
||||
int64_t stop_us = int64_t(prof->end.tv_sec) * 1000000 + prof->end.tv_usec;
|
||||
fTime = double((stop_us - start_us) / 1000) / 1000.0;
|
||||
#endif
|
||||
|
||||
return sp_ftoc(fTime);
|
||||
@@ -181,5 +193,4 @@ REGISTER_NATIVES(profilerNatives)
|
||||
{"StopProfiling", StopProfiling},
|
||||
{NULL, NULL},
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
@@ -29,12 +29,12 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "sm_globals.h"
|
||||
#include "sm_stringutil.h"
|
||||
#include <ITextParsers.h>
|
||||
#include <ctype.h>
|
||||
#include "stringutil.h"
|
||||
|
||||
inline const char *_strstr(const char *str, const char *substr)
|
||||
{
|
||||
@@ -141,7 +141,7 @@ static cell_t sm_numtostr(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
char *str;
|
||||
pCtx->LocalToString(params[2], &str);
|
||||
size_t res = UTIL_Format(str, params[3], "%d", params[1]);
|
||||
size_t res = smcore.Format(str, params[3], "%d", params[1]);
|
||||
|
||||
return static_cast<cell_t>(res);
|
||||
}
|
||||
@@ -174,7 +174,7 @@ static cell_t sm_floattostr(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
char *str;
|
||||
pCtx->LocalToString(params[2], &str);
|
||||
size_t res = UTIL_Format(str, params[3], "%f", sp_ctof(params[1]));
|
||||
size_t res = smcore.Format(str, params[3], "%f", sp_ctof(params[1]));
|
||||
|
||||
return static_cast<cell_t>(res);
|
||||
}
|
||||
@@ -187,7 +187,7 @@ static cell_t sm_formatex(IPluginContext *pCtx, const cell_t *params)
|
||||
|
||||
pCtx->LocalToString(params[1], &buf);
|
||||
pCtx->LocalToString(params[3], &fmt);
|
||||
res = atcprintf(buf, static_cast<size_t>(params[2]), fmt, pCtx, params, &arg);
|
||||
res = smcore.atcprintf(buf, static_cast<size_t>(params[2]), fmt, pCtx, params, &arg);
|
||||
|
||||
return static_cast<cell_t>(res);
|
||||
}
|
||||
@@ -256,7 +256,7 @@ static cell_t sm_format(IPluginContext *pCtx, const cell_t *params)
|
||||
}
|
||||
|
||||
buf = (copy) ? __copy_buf : destbuf;
|
||||
res = atcprintf(buf, maxlen, fmt, pCtx, params, &arg);
|
||||
res = smcore.atcprintf(buf, maxlen, fmt, pCtx, params, &arg);
|
||||
|
||||
if (copy)
|
||||
{
|
||||
@@ -306,7 +306,7 @@ static cell_t sm_vformat(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
pContext->LocalToString(params[3], &format);
|
||||
|
||||
size_t total = atcprintf(destination, maxlen, format, pContext, local_params, &vargPos);
|
||||
size_t total = smcore.atcprintf(destination, maxlen, format, pContext, local_params, &vargPos);
|
||||
|
||||
/* Perform copy-on-write if we need to */
|
||||
if (copy)
|
||||
@@ -29,11 +29,14 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "HandleSys.h"
|
||||
#include "TimerSys.h"
|
||||
#include "PluginSys.h"
|
||||
#include "Logger.h"
|
||||
#include "DebugReporter.h"
|
||||
#include "common_logic.h"
|
||||
#include <string.h>
|
||||
#include <IHandleSys.h>
|
||||
#include <ITimerSystem.h>
|
||||
#include <IPluginSys.h>
|
||||
#include <sh_stack.h>
|
||||
|
||||
using namespace SourceHook;
|
||||
|
||||
#define TIMER_DATA_HNDL_CLOSE (1<<9)
|
||||
#define TIMER_HNDL_CLOSE (1<<9)
|
||||
@@ -86,15 +89,15 @@ void TimerNatives::OnSourceModAllInitialized()
|
||||
{
|
||||
HandleAccess sec;
|
||||
|
||||
g_HandleSys.InitAccessDefaults(NULL, &sec);
|
||||
handlesys->InitAccessDefaults(NULL, &sec);
|
||||
sec.access[HandleAccess_Clone] = HANDLE_RESTRICT_IDENTITY;
|
||||
|
||||
g_TimerType = g_HandleSys.CreateType("Timer", this, 0, NULL, &sec, g_pCoreIdent, NULL);
|
||||
g_TimerType = handlesys->CreateType("Timer", this, 0, NULL, &sec, g_pCoreIdent, NULL);
|
||||
}
|
||||
|
||||
void TimerNatives::OnSourceModShutdown()
|
||||
{
|
||||
g_HandleSys.RemoveType(g_TimerType, g_pCoreIdent);
|
||||
handlesys->RemoveType(g_TimerType, g_pCoreIdent);
|
||||
g_TimerType = 0;
|
||||
}
|
||||
|
||||
@@ -102,7 +105,7 @@ void TimerNatives::OnHandleDestroy(HandleType_t type, void *object)
|
||||
{
|
||||
TimerInfo *pTimer = reinterpret_cast<TimerInfo *>(object);
|
||||
|
||||
g_Timers.KillTimer(pTimer->Timer);
|
||||
timersys->KillTimer(pTimer->Timer);
|
||||
}
|
||||
|
||||
TimerInfo *TimerNatives::CreateTimerInfo()
|
||||
@@ -150,27 +153,23 @@ void TimerNatives::OnTimerEnd(ITimer *pTimer, void *pData)
|
||||
|
||||
if (pInfo->Flags & TIMER_DATA_HNDL_CLOSE)
|
||||
{
|
||||
if ((herr=g_HandleSys.FreeHandle(usrhndl, &sec)) != HandleError_None)
|
||||
if ((herr=handlesys->FreeHandle(usrhndl, &sec)) != HandleError_None)
|
||||
{
|
||||
g_DbgReporter.GenerateError(pInfo->pContext,
|
||||
pInfo->Hook->GetFunctionID(),
|
||||
SP_ERROR_NATIVE,
|
||||
"Invalid data handle %x (error %d) passed during timer end with TIMER_DATA_HNDL_CLOSE",
|
||||
usrhndl,
|
||||
herr);
|
||||
smcore.GenerateError(pInfo->pContext, pInfo->Hook->GetFunctionID(),
|
||||
SP_ERROR_NATIVE,
|
||||
"Invalid data handle %x (error %d) passed during timer end with TIMER_DATA_HNDL_CLOSE",
|
||||
usrhndl, herr);
|
||||
}
|
||||
}
|
||||
|
||||
if (pInfo->TimerHandle != BAD_HANDLE)
|
||||
{
|
||||
if ((herr=g_HandleSys.FreeHandle(pInfo->TimerHandle, &sec)) != HandleError_None)
|
||||
if ((herr=handlesys->FreeHandle(pInfo->TimerHandle, &sec)) != HandleError_None)
|
||||
{
|
||||
g_DbgReporter.GenerateError(pInfo->pContext,
|
||||
pInfo->Hook->GetFunctionID(),
|
||||
smcore.GenerateError(pInfo->pContext, pInfo->Hook->GetFunctionID(),
|
||||
SP_ERROR_NATIVE,
|
||||
"Invalid timer handle %x (error %d) during timer end, displayed function is timer callback, not the stack trace",
|
||||
pInfo->TimerHandle,
|
||||
herr);
|
||||
pInfo->TimerHandle, herr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +199,7 @@ static cell_t smn_CreateTimer(IPluginContext *pCtx, const cell_t *params)
|
||||
}
|
||||
|
||||
pInfo = s_TimerNatives.CreateTimerInfo();
|
||||
pTimer = g_Timers.CreateTimer(&s_TimerNatives, sp_ctof(params[1]), pInfo, flags);
|
||||
pTimer = timersys->CreateTimer(&s_TimerNatives, sp_ctof(params[1]), pInfo, flags);
|
||||
|
||||
if (!pTimer)
|
||||
{
|
||||
@@ -208,7 +207,7 @@ static cell_t smn_CreateTimer(IPluginContext *pCtx, const cell_t *params)
|
||||
return 0;
|
||||
}
|
||||
|
||||
hndl = g_HandleSys.CreateHandle(g_TimerType, pInfo, pCtx->GetIdentity(), g_pCoreIdent, NULL);
|
||||
hndl = handlesys->CreateHandle(g_TimerType, pInfo, pCtx->GetIdentity(), g_pCoreIdent, NULL);
|
||||
|
||||
/* If we can't get a handle, the timer isn't refcounted against the plugin and
|
||||
* we need to bail out to prevent a crash.
|
||||
@@ -219,11 +218,11 @@ static cell_t smn_CreateTimer(IPluginContext *pCtx, const cell_t *params)
|
||||
if (flags & TIMER_DATA_HNDL_CLOSE)
|
||||
{
|
||||
HandleSecurity sec(pCtx->GetIdentity(), g_pCoreIdent);
|
||||
g_HandleSys.FreeHandle(params[3], &sec);
|
||||
handlesys->FreeHandle(params[3], &sec);
|
||||
}
|
||||
/* Zero everything so there's no conflicts */
|
||||
memset(pInfo, 0, sizeof(TimerInfo));
|
||||
g_Timers.KillTimer(pTimer);
|
||||
timersys->KillTimer(pTimer);
|
||||
|
||||
return pCtx->ThrowNativeError("Could not create timer, no more handles");
|
||||
}
|
||||
@@ -248,20 +247,20 @@ static cell_t smn_KillTimer(IPluginContext *pCtx, const cell_t *params)
|
||||
sec.pOwner = pCtx->GetIdentity();
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_TimerType, &sec, (void **)&pInfo))
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_TimerType, &sec, (void **)&pInfo))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid timer handle %x (error %d)", hndl, herr);
|
||||
}
|
||||
|
||||
g_Timers.KillTimer(pInfo->Timer);
|
||||
timersys->KillTimer(pInfo->Timer);
|
||||
|
||||
if (params[2] && !(pInfo->Flags & TIMER_DATA_HNDL_CLOSE))
|
||||
{
|
||||
sec.pOwner = pInfo->pContext->GetIdentity();
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.FreeHandle(static_cast<Handle_t>(pInfo->UserData), &sec)) != HandleError_None)
|
||||
if ((herr=handlesys->FreeHandle(static_cast<Handle_t>(pInfo->UserData), &sec)) != HandleError_None)
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid data handle %x (error %d) on timer kill with TIMER_DATA_HNDL_CLOSE", hndl, herr);
|
||||
}
|
||||
@@ -280,26 +279,26 @@ static cell_t smn_TriggerTimer(IPluginContext *pCtx, const cell_t *params)
|
||||
sec.pOwner = pCtx->GetIdentity();
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_TimerType, &sec, (void **)&pInfo))
|
||||
if ((herr=handlesys->ReadHandle(hndl, g_TimerType, &sec, (void **)&pInfo))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid timer handle %x (error %d)", hndl, herr);
|
||||
}
|
||||
|
||||
g_Timers.FireTimerOnce(pInfo->Timer, params[2] ? true : false);
|
||||
timersys->FireTimerOnce(pInfo->Timer, params[2] ? true : false);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t smn_GetTickedTime(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
return sp_ftoc(*g_pUniversalTime);
|
||||
return sp_ftoc(*serverGlobals.universalTime);
|
||||
}
|
||||
|
||||
static cell_t smn_GetMapTimeLeft(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
float time_left;
|
||||
if (!g_Timers.GetMapTimeLeft(&time_left))
|
||||
if (!timersys->GetMapTimeLeft(&time_left))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -313,7 +312,7 @@ static cell_t smn_GetMapTimeLeft(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t smn_GetMapTimeLimit(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
IMapTimer *pMapTimer = g_Timers.GetMapTimer();
|
||||
IMapTimer *pMapTimer = timersys->GetMapTimer();
|
||||
|
||||
if (!pMapTimer)
|
||||
{
|
||||
@@ -330,7 +329,7 @@ static cell_t smn_GetMapTimeLimit(IPluginContext *pContext, const cell_t *params
|
||||
|
||||
static cell_t smn_ExtendMapTimeLimit(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
IMapTimer *pMapTimer = g_Timers.GetMapTimer();
|
||||
IMapTimer *pMapTimer = timersys->GetMapTimer();
|
||||
|
||||
if (!pMapTimer)
|
||||
{
|
||||
@@ -344,12 +343,12 @@ static cell_t smn_ExtendMapTimeLimit(IPluginContext *pContext, const cell_t *par
|
||||
|
||||
static cell_t smn_IsServerProcessing(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
return (gpGlobals->frametime > 0.0f) ? 1 : 0;
|
||||
return (*serverGlobals.frametime > 0.0f) ? 1 : 0;
|
||||
}
|
||||
|
||||
static cell_t smn_GetTickInterval(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
return sp_ftoc(gpGlobals->interval_per_tick);
|
||||
return sp_ftoc(*serverGlobals.interval_per_tick);
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(timernatives)
|
||||
@@ -0,0 +1,305 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 et :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <sm_platform.h>
|
||||
#include "stringutil.h"
|
||||
|
||||
const char *stristr(const char *str, const char *substr)
|
||||
{
|
||||
if (!*substr)
|
||||
{
|
||||
return ((char *)str);
|
||||
}
|
||||
|
||||
char *needle = (char *)substr;
|
||||
char *prevloc = (char *)str;
|
||||
char *haystack = (char *)str;
|
||||
|
||||
while (*haystack)
|
||||
{
|
||||
if (tolower(*haystack) == tolower(*needle))
|
||||
{
|
||||
haystack++;
|
||||
if (!*++needle)
|
||||
{
|
||||
return prevloc;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
haystack = ++prevloc;
|
||||
needle = (char *)substr;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int strncopy(char *dest, const char *src, size_t count)
|
||||
{
|
||||
if (!count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *start = dest;
|
||||
while ((*src) && (--count))
|
||||
{
|
||||
*dest++ = *src++;
|
||||
}
|
||||
*dest = '\0';
|
||||
|
||||
return (dest - start);
|
||||
}
|
||||
|
||||
unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive)
|
||||
{
|
||||
size_t searchLen = strlen(search);
|
||||
size_t replaceLen = strlen(replace);
|
||||
|
||||
char *ptr = subject;
|
||||
unsigned int total = 0;
|
||||
while ((ptr = UTIL_ReplaceEx(ptr, maxlength, search, searchLen, replace, replaceLen, caseSensitive)) != NULL)
|
||||
{
|
||||
total++;
|
||||
if (*ptr == '\0')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* NOTE: Do not edit this for the love of god unless you have
|
||||
* read the test cases and understand the code behind each one.
|
||||
* While I don't guarantee there aren't mistakes, I do guarantee
|
||||
* that plugins will end up relying on tiny idiosyncrasies of this
|
||||
* function, just like they did with AMX Mod X.
|
||||
*
|
||||
* There are explicitly more cases than the AMX Mod X version because
|
||||
* we're not doing a blind copy. Each case is specifically optimized
|
||||
* for what needs to be done. Even better, we don't have to error on
|
||||
* bad buffer sizes. Instead, this function will smartly cut off the
|
||||
* string in a way that pushes old data out.
|
||||
*/
|
||||
char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive)
|
||||
{
|
||||
char *ptr = subject;
|
||||
size_t browsed = 0;
|
||||
size_t textLen = strlen(subject);
|
||||
|
||||
/* It's not possible to search or replace */
|
||||
if (searchLen > textLen)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Handle the case of one byte replacement.
|
||||
* It's only valid in one case.
|
||||
*/
|
||||
if (maxLen == 1)
|
||||
{
|
||||
/* If the search matches and the replace length is 0,
|
||||
* we can just terminate the string and be done.
|
||||
*/
|
||||
if ((caseSensitive ? strcmp(subject, search) : strcasecmp(subject, search)) == 0 && replaceLen == 0)
|
||||
{
|
||||
*subject = '\0';
|
||||
return subject;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Subtract one off the maxlength so we can include the null terminator */
|
||||
maxLen--;
|
||||
|
||||
while (*ptr != '\0' && (browsed <= textLen - searchLen))
|
||||
{
|
||||
/* See if we get a comparison */
|
||||
if ((caseSensitive ? strncmp(ptr, search, searchLen) : strncasecmp(ptr, search, searchLen)) == 0)
|
||||
{
|
||||
if (replaceLen > searchLen)
|
||||
{
|
||||
/* First, see if we have enough space to do this operation */
|
||||
if (maxLen - textLen < replaceLen - searchLen)
|
||||
{
|
||||
/* First, see if the replacement length goes out of bounds. */
|
||||
if (browsed + replaceLen >= maxLen)
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDDDDDDDDD
|
||||
* OUTPUT : AADDDDDDDDD
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* If it does, we'll just bound the length and do a strcpy. */
|
||||
replaceLen = maxLen - browsed;
|
||||
/* Note, we add one to the final result for the null terminator */
|
||||
strncopy(ptr, replace, replaceLen+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDDDDDD
|
||||
* OUTPUT : AADDDDDDDCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* We're going to have some bytes left over... */
|
||||
size_t origBytesToCopy = (textLen - (browsed + searchLen)) + 1;
|
||||
size_t realBytesToCopy = (maxLen - (browsed + replaceLen)) + 1;
|
||||
char *moveFrom = ptr + searchLen + (origBytesToCopy - realBytesToCopy);
|
||||
char *moveTo = ptr + replaceLen;
|
||||
|
||||
/* First, move our old data out of the way. */
|
||||
memmove(moveTo, moveFrom, realBytesToCopy);
|
||||
|
||||
/* Now, do our replacement. */
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDDD
|
||||
* OUTPUT : AADDDDCCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* Yes, we have enough space. Do a normal move operation. */
|
||||
char *moveFrom = ptr + searchLen;
|
||||
char *moveTo = ptr + replaceLen;
|
||||
|
||||
/* First move our old data out of the way. */
|
||||
size_t bytesToCopy = (textLen - (browsed + searchLen)) + 1;
|
||||
memmove(moveTo, moveFrom, bytesToCopy);
|
||||
|
||||
/* Now do our replacement. */
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
}
|
||||
else if (replaceLen < searchLen)
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: D
|
||||
* OUTPUT : AADCCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* If the replacement does not grow the string length, we do not
|
||||
* need to do any fancy checking at all. Yay!
|
||||
*/
|
||||
char *moveFrom = ptr + searchLen; /* Start after the search pointer */
|
||||
char *moveTo = ptr + replaceLen; /* Copy to where the replacement ends */
|
||||
|
||||
/* Copy our replacement in, if any */
|
||||
if (replaceLen)
|
||||
{
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
|
||||
/* Figure out how many bytes to move down, including null terminator */
|
||||
size_t bytesToCopy = (textLen - (browsed + searchLen)) + 1;
|
||||
|
||||
/* Move the rest of the string down */
|
||||
memmove(moveTo, moveFrom, bytesToCopy);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDD
|
||||
* OUTPUT : AADDDCCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* We don't have to move anything around, just do a straight copy */
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
|
||||
return ptr + replaceLen;
|
||||
}
|
||||
ptr++;
|
||||
browsed++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t UTIL_DecodeHexString(unsigned char *buffer, size_t maxlength, const char *hexstr)
|
||||
{
|
||||
size_t written = 0;
|
||||
size_t length = strlen(hexstr);
|
||||
|
||||
for (size_t i = 0; i < length; i++)
|
||||
{
|
||||
if (written >= maxlength)
|
||||
break;
|
||||
buffer[written++] = hexstr[i];
|
||||
if (hexstr[i] == '\\' && hexstr[i + 1] == 'x')
|
||||
{
|
||||
if (i + 3 >= length)
|
||||
continue;
|
||||
/* Get the hex part. */
|
||||
char s_byte[3];
|
||||
int r_byte;
|
||||
s_byte[0] = hexstr[i + 2];
|
||||
s_byte[1] = hexstr[i + 3];
|
||||
s_byte[2] = '\0';
|
||||
/* Read it as an integer */
|
||||
sscanf(s_byte, "%x", &r_byte);
|
||||
/* Save the value */
|
||||
buffer[written - 1] = r_byte;
|
||||
/* Adjust index */
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* vim: set ts=4 sw=4 tw=99 et :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||
* this exception to all derivative works. AlliedModders LLC defines further
|
||||
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||
* or <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_COMMON_STRINGUTIL_H_
|
||||
#define _INCLUDE_SOURCEMOD_COMMON_STRINGUTIL_H_
|
||||
|
||||
const char *stristr(const char *str, const char *substr);
|
||||
unsigned int strncopy(char *dest, const char *src, size_t count);
|
||||
unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search,
|
||||
const char *replace, bool caseSensitive = true);
|
||||
char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen,
|
||||
const char *replace, size_t replaceLen, bool caseSensitive = true);
|
||||
size_t UTIL_DecodeHexString(unsigned char *buffer, size_t maxlength, const char *hexstr);
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_COMMON_STRINGUTIL_H_ */
|
||||
|
||||
+138
-7
@@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 sw=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@@ -43,12 +43,36 @@
|
||||
#include "ShareSys.h"
|
||||
#include "sm_srvcmds.h"
|
||||
#include "ForwardSys.h"
|
||||
#include "TimerSys.h"
|
||||
#include "logic_bridge.h"
|
||||
#include "DebugReporter.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "AdminCache.h"
|
||||
#include "HalfLife2.h"
|
||||
#include "CoreConfig.h"
|
||||
|
||||
#if defined _WIN32
|
||||
#define MATCHMAKINGDS_SUFFIX ""
|
||||
#define MATCHMAKINGDS_EXT "dll"
|
||||
#elif defined __APPLE__
|
||||
#define MATCHMAKINGDS_SUFFIX ""
|
||||
#define MATCHMAKINGDS_EXT "dylib"
|
||||
#elif defined __linux__
|
||||
#if SOURCE_ENGINE < SE_LEFT4DEAD2
|
||||
#define MATCHMAKINGDS_SUFFIX "_i486"
|
||||
#else
|
||||
#define MATCHMAKINGDS_SUFFIX ""
|
||||
#endif
|
||||
#define MATCHMAKINGDS_EXT "so"
|
||||
#endif
|
||||
|
||||
static ILibrary *g_pLogic = NULL;
|
||||
static LogicInitFunction logic_init_fn;
|
||||
|
||||
IThreader *g_pThreader;
|
||||
ITextParsers *textparsers;
|
||||
sm_logic_t logicore;
|
||||
ITranslator *translator;
|
||||
|
||||
class VEngineServer_Logic : public IVEngineServer_Logic
|
||||
{
|
||||
@@ -57,6 +81,11 @@ public:
|
||||
{
|
||||
return engine->IsMapValid(map);
|
||||
}
|
||||
|
||||
virtual void ServerCommand(const char *cmd)
|
||||
{
|
||||
engine->ServerCommand(cmd);
|
||||
}
|
||||
};
|
||||
|
||||
static VEngineServer_Logic logic_engine;
|
||||
@@ -80,11 +109,83 @@ static void log_error(const char *fmt, ...)
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static void generate_error(IPluginContext *ctx, cell_t func_idx, int err, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
g_DbgReporter.GenerateErrorVA(ctx, func_idx, err, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static const char *get_cvar_string(ConVar* cvar)
|
||||
{
|
||||
return cvar->GetString();
|
||||
}
|
||||
|
||||
static bool get_game_name(char *buffer, size_t maxlength)
|
||||
{
|
||||
KeyValues *pGameInfo = new KeyValues("GameInfo");
|
||||
if (g_HL2.KVLoadFromFile(pGameInfo, basefilesystem, "gameinfo.txt"))
|
||||
{
|
||||
const char *str;
|
||||
if ((str = pGameInfo->GetString("game", NULL)) != NULL)
|
||||
{
|
||||
strncopy(buffer, str, maxlength);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
pGameInfo->deleteThis();
|
||||
return false;
|
||||
}
|
||||
|
||||
static const char *get_game_description()
|
||||
{
|
||||
return SERVER_CALL(GetGameDescription)();
|
||||
}
|
||||
|
||||
static const char *get_source_engine_name()
|
||||
{
|
||||
#if !defined SOURCE_ENGINE
|
||||
# error "Unknown engine type"
|
||||
#endif
|
||||
#if SOURCE_ENGINE == SE_EPISODEONE
|
||||
return "original";
|
||||
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||
return "darkmessiah";
|
||||
#elif SOURCE_ENGINE == SE_ORANGEBOX
|
||||
return "orangebox";
|
||||
#elif SOURCE_ENGINE == SE_BLOODYGOODTIME
|
||||
return "bloodygoodtime";
|
||||
#elif SOURCE_ENGINE == SE_EYE
|
||||
return "eye";
|
||||
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
||||
return "orangebox_valve";
|
||||
#elif SOURCE_ENGINE == SE_LEFT4DEAD
|
||||
return "left4dead";
|
||||
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
return "left4dead2";
|
||||
#elif SOURCE_ENGINE == SE_ALIENSWARM
|
||||
return "alienswarm";
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool symbols_are_hidden()
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_ORANGEBOXVALVE) || (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static const char* get_core_config_value(const char* key)
|
||||
{
|
||||
return g_CoreConfig.GetCoreConfigValue(key);
|
||||
}
|
||||
|
||||
static ServerGlobals serverGlobals;
|
||||
|
||||
static sm_core_t core_bridge =
|
||||
{
|
||||
/* Objects */
|
||||
@@ -97,6 +198,10 @@ static sm_core_t core_bridge =
|
||||
&g_RootMenu,
|
||||
&g_PluginSys,
|
||||
&g_Forwards,
|
||||
&g_Timers,
|
||||
&g_Players,
|
||||
&g_Admins,
|
||||
&g_HL2,
|
||||
/* Functions */
|
||||
add_natives,
|
||||
find_convar,
|
||||
@@ -104,15 +209,40 @@ static sm_core_t core_bridge =
|
||||
UTIL_TrimWhitespace,
|
||||
log_error,
|
||||
get_cvar_string,
|
||||
UTIL_Format
|
||||
UTIL_Format,
|
||||
generate_error,
|
||||
gnprintf,
|
||||
atcprintf,
|
||||
get_game_name,
|
||||
get_game_description,
|
||||
get_source_engine_name,
|
||||
symbols_are_hidden,
|
||||
get_core_config_value,
|
||||
&serverGlobals
|
||||
};
|
||||
|
||||
void InitLogicBridge()
|
||||
{
|
||||
sm_logic_t logic;
|
||||
serverGlobals.universalTime = g_pUniversalTime;
|
||||
serverGlobals.frametime = &gpGlobals->frametime;
|
||||
serverGlobals.interval_per_tick = &gpGlobals->interval_per_tick;
|
||||
|
||||
core_bridge.core_ident = g_pCoreIdent;
|
||||
logic_init_fn(&core_bridge, &logic);
|
||||
core_bridge.engineFactory = (void *)g_SMAPI->GetEngineFactory(false);
|
||||
core_bridge.serverFactory = (void *)g_SMAPI->GetServerFactory(false);
|
||||
|
||||
ILibrary *mmlib;
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
|
||||
g_LibSys.PathFormat(path, sizeof(path), "%s/bin/matchmaking_ds%s.%s", g_SMAPI->GetBaseDir(), MATCHMAKINGDS_SUFFIX, MATCHMAKINGDS_EXT);
|
||||
|
||||
if ((mmlib = g_LibSys.OpenLibrary(path, NULL, 0)))
|
||||
{
|
||||
core_bridge.matchmakingDSFactory = mmlib->GetSymbolAddress("CreateInterface");
|
||||
mmlib->CloseLibrary();
|
||||
}
|
||||
|
||||
logic_init_fn(&core_bridge, &logicore);
|
||||
|
||||
/* Add SMGlobalClass instances */
|
||||
SMGlobalClass* glob = SMGlobalClass::head;
|
||||
@@ -121,10 +251,11 @@ void InitLogicBridge()
|
||||
glob = glob->m_pGlobalClassNext;
|
||||
}
|
||||
assert(glob->m_pGlobalClassNext == NULL);
|
||||
glob->m_pGlobalClassNext = logic.head;
|
||||
glob->m_pGlobalClassNext = logicore.head;
|
||||
|
||||
g_pThreader = logic.threader;
|
||||
g_pSourcePawn2->SetProfiler(logic.profiler);
|
||||
g_pThreader = logicore.threader;
|
||||
g_pSourcePawn2->SetProfiler(logicore.profiler);
|
||||
translator = logicore.translator;
|
||||
}
|
||||
|
||||
bool StartLogicBridge(char *error, size_t maxlength)
|
||||
|
||||
@@ -31,9 +31,17 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_LOGIC_BRIDGE_H_
|
||||
#define _INCLUDE_SOURCEMOD_LOGIC_BRIDGE_H_
|
||||
|
||||
#include "logic/intercom.h"
|
||||
|
||||
void InitLogicBridge();
|
||||
bool StartLogicBridge(char *error, size_t maxlength);
|
||||
void ShutdownLogicBridge();
|
||||
|
||||
struct sm_logic_t;
|
||||
|
||||
extern sm_logic_t logicore;
|
||||
extern ITranslator *translator;
|
||||
extern IGameConfig *g_pGameConf;
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_LOGIC_BRIDGE_H_ */
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sourcemod_mm", "sourcemod_mm.vcxproj", "{E39527CD-7CAB-4420-97CC-DA1B93B260BC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CrazyDebug - Dark Messiah|Win32 = CrazyDebug - Dark Messiah|Win32
|
||||
CrazyDebug - Episode 1|Win32 = CrazyDebug - Episode 1|Win32
|
||||
CrazyDebug - Left 4 Dead 2|Win32 = CrazyDebug - Left 4 Dead 2|Win32
|
||||
CrazyDebug - Left 4 Dead|Win32 = CrazyDebug - Left 4 Dead|Win32
|
||||
CrazyDebug - Old Metamod|Win32 = CrazyDebug - Old Metamod|Win32
|
||||
CrazyDebug - Orange Box Valve|Win32 = CrazyDebug - Orange Box Valve|Win32
|
||||
CrazyDebug - Orange Box|Win32 = CrazyDebug - Orange Box|Win32
|
||||
Debug - Dark Messiah|Win32 = Debug - Dark Messiah|Win32
|
||||
Debug - Episode 1|Win32 = Debug - Episode 1|Win32
|
||||
Debug - Left 4 Dead 2|Win32 = Debug - Left 4 Dead 2|Win32
|
||||
Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32
|
||||
Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
|
||||
Debug - Orange Box Valve|Win32 = Debug - Orange Box Valve|Win32
|
||||
Debug - Orange Box|Win32 = Debug - Orange Box|Win32
|
||||
Release - Dark Messiah|Win32 = Release - Dark Messiah|Win32
|
||||
Release - Episode 1|Win32 = Release - Episode 1|Win32
|
||||
Release - Left 4 Dead 2|Win32 = Release - Left 4 Dead 2|Win32
|
||||
Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32
|
||||
Release - Old Metamod|Win32 = Release - Old Metamod|Win32
|
||||
Release - Orange Box Valve|Win32 = Release - Orange Box Valve|Win32
|
||||
Release - Orange Box|Win32 = Release - Orange Box|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Dark Messiah|Win32.ActiveCfg = CrazyDebug - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Dark Messiah|Win32.Build.0 = CrazyDebug - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.ActiveCfg = CrazyDebug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.Build.0 = CrazyDebug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead 2|Win32.ActiveCfg = CrazyDebug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead 2|Win32.Build.0 = CrazyDebug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead|Win32.ActiveCfg = CrazyDebug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead|Win32.Build.0 = CrazyDebug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.ActiveCfg = CrazyDebug - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.Build.0 = CrazyDebug - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box Valve|Win32.ActiveCfg = CrazyDebug - Orange Box Valve|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box Valve|Win32.Build.0 = CrazyDebug - Orange Box Valve|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box|Win32.ActiveCfg = CrazyDebug - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box|Win32.Build.0 = CrazyDebug - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Dark Messiah|Win32.ActiveCfg = Debug - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Dark Messiah|Win32.Build.0 = Debug - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.ActiveCfg = Debug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.Build.0 = Debug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead 2|Win32.ActiveCfg = Debug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead 2|Win32.Build.0 = Debug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead|Win32.ActiveCfg = Debug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead|Win32.Build.0 = Debug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.Build.0 = Debug - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box Valve|Win32.ActiveCfg = Debug - Orange Box Valve|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box Valve|Win32.Build.0 = Debug - Orange Box Valve|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box|Win32.ActiveCfg = Debug - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box|Win32.Build.0 = Debug - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Dark Messiah|Win32.ActiveCfg = Release - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Dark Messiah|Win32.Build.0 = Release - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.ActiveCfg = Release - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.Build.0 = Release - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead 2|Win32.ActiveCfg = Release - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead 2|Win32.Build.0 = Release - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead|Win32.ActiveCfg = Release - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead|Win32.Build.0 = Release - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Old Metamod|Win32.ActiveCfg = Release - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Old Metamod|Win32.Build.0 = Release - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box Valve|Win32.ActiveCfg = Release - Orange Box Valve|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box Valve|Win32.Build.0 = Release - Orange Box Valve|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box|Win32.ActiveCfg = Release - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box|Win32.Build.0 = Release - Orange Box|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,467 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Interfaces">
|
||||
<UniqueIdentifier>{10C69360-9E8E-4a43-BCEF-E9373B3641BC}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="SourcePawn">
|
||||
<UniqueIdentifier>{C3C3DC6E-E392-4916-B893-7ACB92192DE0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="HL2SDK">
|
||||
<UniqueIdentifier>{80B56842-7A9F-4d5d-8149-767C285D0EB4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Natives">
|
||||
<UniqueIdentifier>{052D6D9B-7B50-4c3c-9B82-32CA908DEF24}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Resources">
|
||||
<UniqueIdentifier>{2A750240-7C10-455f-A900-B9A9D362356C}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\AdminCache.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ADTFactory.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\CDataPack.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ChatTriggers.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\concmd_cleaner.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ConCmdManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ConsoleDetours.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ConVarManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\CoreConfig.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\CrazyDebugger.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Database.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\DebugReporter.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\EventManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ExtensionSys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ForwardSys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\frame_hooks.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\HalfLife2.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\HandleSys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\LibrarySys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Logger.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\logic_bridge.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\MenuManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\MenuStyle_Base.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\MenuStyle_Radio.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\MenuStyle_Valve.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\MenuVoting.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\NativeInvoker.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\NativeOwner.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\NextMap.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\PlayerManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\PluginInfoDatabase.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\PluginSys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ShareSys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sm_autonatives.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sm_srvcmds.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sm_stringutil.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sm_trie.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sourcemm_api.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sourcemod.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\TimerSys.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\UserMessages.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_bitbuffer.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_console.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_core.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_database.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_entities.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_events.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_fakenatives.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_filesystem.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_halflife.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_hudtext.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_keyvalues.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_menus.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_nextmap.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_player.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_usermsgs.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\smn_vector.cpp">
|
||||
<Filter>Natives</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\AdminCache.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ADTFactory.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CDataPack.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CellArray.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CellRecipientFilter.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ChatTriggers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\compat_wrappers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\concmd_cleaner.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ConCmdManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ConCommandBaseIterator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ConsoleDetours.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ConVarManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CoreConfig.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Database.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\DebugReporter.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\EventManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ExtensionSys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ForwardSys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\frame_hooks.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GameConfigs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\HalfLife2.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\HandleSys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\LibrarySys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Logger.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\logic_bridge.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MemoryUtils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MenuManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MenuStyle_Base.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MenuStyle_Radio.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MenuStyle_Valve.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MenuVoting.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\NativeInvoker.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\NativeOwner.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\NextMap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\PhraseCollection.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\PlayerManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\PluginInfoDatabase.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\PluginSys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ShareSys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_autonatives.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_fastlink.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_globals.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_memtable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sm_platform.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_queue.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_simple_prioqueue.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_srvcmds.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_stringutil.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_symtable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_trie.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sm_trie_tpl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sm_version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\smn_usermsgs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sourcemm_api.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sourcemod.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\TimerSys.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Translator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\UserMessages.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IAdminSystem.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IADTFactory.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IDataPack.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IDBDriver.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IExtensionSys.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IForwardSys.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IGameConfigs.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IGameHelpers.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IHandleSys.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\ILibrarySys.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IMemoryUtils.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IMenuManager.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\INativeInvoker.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IPlayerHelpers.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IPluginSys.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IRootConsoleMenu.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IShareSys.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\ISourceMod.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\ITextParsers.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\ITimerSystem.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\ITranslator.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\IUserMessages.h">
|
||||
<Filter>Interfaces</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sourcepawn\sp_file_headers.h">
|
||||
<Filter>SourcePawn</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sourcepawn\sp_typeutil.h">
|
||||
<Filter>SourcePawn</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sourcepawn\sp_vm_api.h">
|
||||
<Filter>SourcePawn</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sourcepawn\sp_vm_base.h">
|
||||
<Filter>SourcePawn</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\public\sourcepawn\sp_vm_types.h">
|
||||
<Filter>SourcePawn</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\convar_sm.h">
|
||||
<Filter>HL2SDK</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\version.rc">
|
||||
<Filter>Resources</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -7,18 +7,21 @@ Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CrazyDebug - Dark Messiah|Win32 = CrazyDebug - Dark Messiah|Win32
|
||||
CrazyDebug - Episode 1|Win32 = CrazyDebug - Episode 1|Win32
|
||||
CrazyDebug - Left 4 Dead 2|Win32 = CrazyDebug - Left 4 Dead 2|Win32
|
||||
CrazyDebug - Left 4 Dead|Win32 = CrazyDebug - Left 4 Dead|Win32
|
||||
CrazyDebug - Old Metamod|Win32 = CrazyDebug - Old Metamod|Win32
|
||||
CrazyDebug - Orange Box Valve|Win32 = CrazyDebug - Orange Box Valve|Win32
|
||||
CrazyDebug - Orange Box|Win32 = CrazyDebug - Orange Box|Win32
|
||||
Debug - Dark Messiah|Win32 = Debug - Dark Messiah|Win32
|
||||
Debug - Episode 1|Win32 = Debug - Episode 1|Win32
|
||||
Debug - Left 4 Dead 2|Win32 = Debug - Left 4 Dead 2|Win32
|
||||
Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32
|
||||
Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
|
||||
Debug - Orange Box Valve|Win32 = Debug - Orange Box Valve|Win32
|
||||
Debug - Orange Box|Win32 = Debug - Orange Box|Win32
|
||||
Release - Dark Messiah|Win32 = Release - Dark Messiah|Win32
|
||||
Release - Episode 1|Win32 = Release - Episode 1|Win32
|
||||
Release - Left 4 Dead 2|Win32 = Release - Left 4 Dead 2|Win32
|
||||
Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32
|
||||
Release - Old Metamod|Win32 = Release - Old Metamod|Win32
|
||||
Release - Orange Box Valve|Win32 = Release - Orange Box Valve|Win32
|
||||
@@ -29,6 +32,8 @@ Global
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Dark Messiah|Win32.Build.0 = CrazyDebug - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.ActiveCfg = CrazyDebug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.Build.0 = CrazyDebug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead 2|Win32.ActiveCfg = CrazyDebug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead 2|Win32.Build.0 = CrazyDebug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead|Win32.ActiveCfg = CrazyDebug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead|Win32.Build.0 = CrazyDebug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.ActiveCfg = CrazyDebug - Old Metamod|Win32
|
||||
@@ -41,6 +46,8 @@ Global
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Dark Messiah|Win32.Build.0 = Debug - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.ActiveCfg = Debug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.Build.0 = Debug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead 2|Win32.ActiveCfg = Debug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead 2|Win32.Build.0 = Debug - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead|Win32.ActiveCfg = Debug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead|Win32.Build.0 = Debug - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32
|
||||
@@ -53,6 +60,8 @@ Global
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Dark Messiah|Win32.Build.0 = Release - Dark Messiah|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.ActiveCfg = Release - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.Build.0 = Release - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead 2|Win32.ActiveCfg = Release - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead 2|Win32.Build.0 = Release - Left 4 Dead 2|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead|Win32.ActiveCfg = Release - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead|Win32.Build.0 = Release - Left 4 Dead|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Old Metamod|Win32.ActiveCfg = Release - Old Metamod|Win32
|
||||
|
||||
+319
-100
@@ -40,9 +40,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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";"$(MMSOURCE18)\core-legacy";"$(MMSOURCE18)\core-legacy\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -60,6 +60,7 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -122,9 +123,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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";"$(MMSOURCE18)\core-legacy";"$(MMSOURCE18)\core-legacy\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -206,9 +207,9 @@
|
||||
/>
|
||||
<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"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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";"$(MMSOURCE18)\core-legacy";"$(MMSOURCE18)\core-legacy\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
@@ -224,6 +225,7 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -288,9 +290,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK-DARKM)\public";"$(HL2SDK-DARKM)\public\dlls";"$(HL2SDK-DARKM)\public\engine";"$(HL2SDK-DARKM)\public\mathlib";"$(HL2SDK-DARKM)\public\tier0";"$(HL2SDK-DARKM)\public\tier1";"$(HL2SDK-DARKM)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
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"
|
||||
@@ -308,6 +310,7 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -370,9 +373,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK-DARKM)\public";"$(HL2SDK-DARKM)\public\dlls";"$(HL2SDK-DARKM)\public\engine";"$(HL2SDK-DARKM)\public\mathlib";"$(HL2SDK-DARKM)\public\tier0";"$(HL2SDK-DARKM)\public\tier1";"$(HL2SDK-DARKM)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
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"
|
||||
@@ -454,9 +457,9 @@
|
||||
/>
|
||||
<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"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK-DARKM)\public";"$(HL2SDK-DARKM)\public\dlls";"$(HL2SDK-DARKM)\public\engine";"$(HL2SDK-DARKM)\public\mathlib";"$(HL2SDK-DARKM)\public\tier0";"$(HL2SDK-DARKM)\public\tier1";"$(HL2SDK-DARKM)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
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"
|
||||
@@ -472,6 +475,7 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -536,9 +540,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=3"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -556,6 +560,7 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -618,9 +623,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=3"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -638,6 +643,7 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -701,9 +707,9 @@
|
||||
/>
|
||||
<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"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=3"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
@@ -719,6 +725,7 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -783,9 +790,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -803,6 +810,7 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -865,9 +873,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -885,6 +893,7 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -948,9 +957,9 @@
|
||||
/>
|
||||
<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"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
@@ -966,6 +975,7 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -1030,9 +1040,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D)\public";"$(HL2SDKL4D)\public\engine";"$(HL2SDKL4D)\public\game\server";"$(HL2SDKL4D)\public\mathlib";"$(HL2SDKL4D)\public\tier0";"$(HL2SDKL4D)\public\tier1";"$(HL2SDKL4D)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
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"
|
||||
@@ -1050,6 +1060,7 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -1112,9 +1123,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D)\public";"$(HL2SDKL4D)\public\engine";"$(HL2SDKL4D)\public\game\server";"$(HL2SDKL4D)\public\mathlib";"$(HL2SDKL4D)\public\tier0";"$(HL2SDKL4D)\public\tier1";"$(HL2SDKL4D)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
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"
|
||||
@@ -1196,9 +1207,9 @@
|
||||
/>
|
||||
<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"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D)\public";"$(HL2SDKL4D)\public\engine";"$(HL2SDKL4D)\public\game\server";"$(HL2SDKL4D)\public\mathlib";"$(HL2SDKL4D)\public\tier0";"$(HL2SDKL4D)\public\tier1";"$(HL2SDKL4D)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
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"
|
||||
@@ -1214,6 +1225,7 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -1278,9 +1290,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOBVALVE)\public";"$(HL2SDKOBVALVE)\public\engine";"$(HL2SDKOBVALVE)\public\game\server";"$(HL2SDKOBVALVE)\public\mathlib";"$(HL2SDKOBVALVE)\public\tier0";"$(HL2SDKOBVALVE)\public\tier1";"$(HL2SDKOBVALVE)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
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"
|
||||
@@ -1298,6 +1310,7 @@
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
@@ -1360,9 +1373,9 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_ORANGEBOXVALVE=4 /D SE_LEFT4DEAD=5"
|
||||
AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOBVALVE)\public";"$(HL2SDKOBVALVE)\public\engine";"$(HL2SDKOBVALVE)\public\game\server";"$(HL2SDKOBVALVE)\public\mathlib";"$(HL2SDKOBVALVE)\public\tier0";"$(HL2SDKOBVALVE)\public\tier1";"$(HL2SDKOBVALVE)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
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"
|
||||
@@ -1444,9 +1457,9 @@
|
||||
/>
|
||||
<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"
|
||||
AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8"
|
||||
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""
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOBVALVE)\public";"$(HL2SDKOBVALVE)\public\engine";"$(HL2SDKOBVALVE)\public\game\server";"$(HL2SDKOBVALVE)\public\mathlib";"$(HL2SDKOBVALVE)\public\tier0";"$(HL2SDKOBVALVE)\public\tier1";"$(HL2SDKOBVALVE)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
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"
|
||||
@@ -1504,6 +1517,256 @@
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="CrazyDebug - Left 4 Dead 2|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_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 /D SE_LEFT4DEAD2=6"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D2)\public";"$(HL2SDKL4D2)\public\engine";"$(HL2SDKL4D2)\public\game\server";"$(HL2SDKL4D2)\public\mathlib";"$(HL2SDKL4D2)\public\tier0";"$(HL2SDKL4D2)\public\tier1";"$(HL2SDKL4D2)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=6"
|
||||
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)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies=""$(HL2SDKL4D2)\lib\public\tier0.lib" "$(HL2SDKL4D2)\lib\public\tier1.lib" "$(HL2SDKL4D2)\lib\public\vstdlib.lib" "$(HL2SDKL4D2)\lib\public\mathlib.lib" dbghelp.lib "Wsock32.lib""
|
||||
OutputFile="$(OutDir)\sourcemod.2.l4d2.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 2|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_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 /D SE_LEFT4DEAD2=6"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D2)\public";"$(HL2SDKL4D2)\public\engine";"$(HL2SDKL4D2)\public\game\server";"$(HL2SDKL4D2)\public\mathlib";"$(HL2SDKL4D2)\public\tier0";"$(HL2SDKL4D2)\public\tier1";"$(HL2SDKL4D2)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=6"
|
||||
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)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies=""$(HL2SDKL4D2)\lib\public\tier0.lib" "$(HL2SDKL4D2)\lib\public\tier1.lib" "$(HL2SDKL4D2)\lib\public\vstdlib.lib" "$(HL2SDKL4D2)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||
OutputFile="$(OutDir)\sourcemod.2.l4d2.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 2|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_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 /D SE_LEFT4DEAD2=6"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKL4D2)\public";"$(HL2SDKL4D2)\public\engine";"$(HL2SDKL4D2)\public\game\server";"$(HL2SDKL4D2)\public\mathlib";"$(HL2SDKL4D2)\public\tier0";"$(HL2SDKL4D2)\public\tier1";"$(HL2SDKL4D2)\public\vstdlib";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=6"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||
AdditionalIncludeDirectories="..\..\public"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies=""$(HL2SDKL4D2)\lib\public\tier0.lib" "$(HL2SDKL4D2)\lib\public\tier1.lib" "$(HL2SDKL4D2)\lib\public\vstdlib.lib" "$(HL2SDKL4D2)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||
OutputFile="$(OutDir)\sourcemod.2.l4d2.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>
|
||||
<References>
|
||||
</References>
|
||||
@@ -1648,6 +1911,22 @@
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug - Left 4 Dead 2|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release - Left 4 Dead 2|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Database.cpp"
|
||||
@@ -1673,10 +1952,6 @@
|
||||
RelativePath="..\frame_hooks.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\GameConfigs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\HalfLife2.cpp"
|
||||
>
|
||||
@@ -1697,10 +1972,6 @@
|
||||
RelativePath="..\logic_bridge.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\MemoryUtils.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\MenuManager.cpp"
|
||||
>
|
||||
@@ -1733,10 +2004,6 @@
|
||||
RelativePath="..\NextMap.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PhraseCollection.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PlayerManager.cpp"
|
||||
>
|
||||
@@ -1757,14 +2024,6 @@
|
||||
RelativePath="..\sm_autonatives.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_crc32.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_memtable.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_srvcmds.cpp"
|
||||
>
|
||||
@@ -1789,10 +2048,6 @@
|
||||
RelativePath="..\TimerSys.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Translator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\UserMessages.cpp"
|
||||
>
|
||||
@@ -1963,10 +2218,6 @@
|
||||
RelativePath="..\sm_autonatives.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_crc32.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_fastlink.h"
|
||||
>
|
||||
@@ -1999,6 +2250,10 @@
|
||||
RelativePath="..\sm_stringutil.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_symtable.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sm_trie.h"
|
||||
>
|
||||
@@ -2167,14 +2422,6 @@
|
||||
Name="Natives"
|
||||
UniqueIdentifier="{052D6D9B-7B50-4c3c-9B82-32CA908DEF24}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\smn_admin.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_banning.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_bitbuffer.cpp"
|
||||
>
|
||||
@@ -2191,10 +2438,6 @@
|
||||
RelativePath="..\smn_database.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_datapacks.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_entities.cpp"
|
||||
>
|
||||
@@ -2211,18 +2454,10 @@
|
||||
RelativePath="..\smn_filesystem.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_gameconfigs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_halflife.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_handles.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_hudtext.cpp"
|
||||
>
|
||||
@@ -2231,10 +2466,6 @@
|
||||
RelativePath="..\smn_keyvalues.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_lang.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_menus.cpp"
|
||||
>
|
||||
@@ -2247,18 +2478,6 @@
|
||||
RelativePath="..\smn_player.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_profiler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_string.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_timers.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_usermsgs.cpp"
|
||||
>
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
template <typename T>
|
||||
class FastLink
|
||||
{
|
||||
friend class iterator;
|
||||
public:
|
||||
struct FastLinkNode
|
||||
{
|
||||
|
||||
+58
-9
@@ -32,31 +32,65 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
|
||||
#define _INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
class BaseMemTable
|
||||
{
|
||||
public:
|
||||
BaseMemTable(unsigned int init_size);
|
||||
~BaseMemTable();
|
||||
BaseMemTable(unsigned int init_size)
|
||||
{
|
||||
membase = (unsigned char *)malloc(init_size);
|
||||
size = init_size;
|
||||
tail = 0;
|
||||
}
|
||||
~BaseMemTable()
|
||||
{
|
||||
free(membase);
|
||||
membase = NULL;
|
||||
}
|
||||
public:
|
||||
/**
|
||||
* Allocates 'size' bytes of memory.
|
||||
* Optionally outputs the address through 'addr'.
|
||||
* Returns an index >= 0 on success, < 0 on failure.
|
||||
*/
|
||||
int CreateMem(unsigned int size, void **addr);
|
||||
int CreateMem(unsigned int addsize, void **addr)
|
||||
{
|
||||
int idx = (int)tail;
|
||||
|
||||
while (tail + addsize >= size) {
|
||||
size *= 2;
|
||||
membase = (unsigned char *)realloc(membase, size);
|
||||
}
|
||||
|
||||
tail += addsize;
|
||||
if (addr)
|
||||
*addr = (void *)&membase[idx];
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an index into the memory table, returns its address.
|
||||
* Returns NULL if invalid.
|
||||
*/
|
||||
void *GetAddress(int index);
|
||||
void *GetAddress(int index)
|
||||
{
|
||||
if (index < 0 || (unsigned int)index >= tail)
|
||||
return NULL;
|
||||
return &membase[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Scraps the memory table. For caching purposes, the memory
|
||||
* is not freed, however subsequent calls to CreateMem() will
|
||||
* begin at the first index again.
|
||||
*/
|
||||
void Reset();
|
||||
void Reset()
|
||||
{
|
||||
tail = 0;
|
||||
}
|
||||
|
||||
inline unsigned int GetMemUsage()
|
||||
{
|
||||
@@ -77,13 +111,24 @@ private:
|
||||
class BaseStringTable
|
||||
{
|
||||
public:
|
||||
BaseStringTable(unsigned int init_size);
|
||||
~BaseStringTable();
|
||||
BaseStringTable(unsigned int init_size) : m_table(init_size)
|
||||
{
|
||||
}
|
||||
public:
|
||||
/**
|
||||
* Adds a string to the string table and returns its index.
|
||||
*/
|
||||
int AddString(const char *string);
|
||||
int AddString(const char *string)
|
||||
{
|
||||
size_t len = strlen(string) + 1;
|
||||
int idx;
|
||||
char *addr;
|
||||
|
||||
idx = m_table.CreateMem(len, (void **)&addr);
|
||||
strcpy(addr, string);
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an index into the string table, returns the associated string.
|
||||
@@ -98,7 +143,10 @@ public:
|
||||
* is not freed, however subsequent calls to AddString() will
|
||||
* begin at the first index again.
|
||||
*/
|
||||
void Reset();
|
||||
void Reset()
|
||||
{
|
||||
m_table.Reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parent BaseMemTable that this string table uses.
|
||||
@@ -112,3 +160,4 @@ private:
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
|
||||
|
||||
|
||||
+9
-8
@@ -324,14 +324,15 @@ void RootConsoleMenu::OnRootConsoleCommand(const char *cmdname, const CCommand &
|
||||
{
|
||||
ConsolePrint(" SourceMod was developed by AlliedModders, LLC.");
|
||||
ConsolePrint(" Development would not have been possible without the following people:");
|
||||
ConsolePrint(" David \"BAILOPAN\" Anderson, lead developer");
|
||||
ConsolePrint(" Borja \"faluco\" Ferrer, core developer");
|
||||
ConsolePrint(" Scott \"Damaged Soul\" Ehlert, core developer");
|
||||
ConsolePrint(" Matt \"pRED\" Woodrow, core developer");
|
||||
ConsolePrint(" Michael \"ferret\" McKoy, plugin developer");
|
||||
ConsolePrint(" Pavol \"PM OnoTo\" Marko, SourceHook developer");
|
||||
ConsolePrint(" Special thanks to Viper of GameConnect");
|
||||
ConsolePrint(" Special thanks to Mani of Mani-Admin-Plugin");
|
||||
ConsolePrint(" David \"BAILOPAN\" Anderson");
|
||||
ConsolePrint(" Matt \"pRED\" Woodrow");
|
||||
ConsolePrint(" Scott \"DS\" Ehlert");
|
||||
ConsolePrint(" Fyren");
|
||||
ConsolePrint(" Nicholas \"psychonic\" Hastings");
|
||||
ConsolePrint(" Borja \"faluco\" Ferrer");
|
||||
ConsolePrint(" Pavol \"PM OnoTo\" Marko");
|
||||
ConsolePrint(" Special thanks to asherkin, Liam, ferret, and Mani");
|
||||
ConsolePrint(" Special thanks to Viper and SteamFriends");
|
||||
ConsolePrint(" http://www.sourcemod.net/");
|
||||
}
|
||||
else if (strcmp(cmdname, "version") == 0)
|
||||
|
||||
+9
-260
@@ -35,8 +35,8 @@
|
||||
#include "sm_stringutil.h"
|
||||
#include "Logger.h"
|
||||
#include "PluginSys.h"
|
||||
#include "Translator.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "logic_bridge.h"
|
||||
|
||||
#define LADJUST 0x00000004 /* left adjustment */
|
||||
#define ZEROPAD 0x00000080 /* zero (as opposed to blank) pad */
|
||||
@@ -81,11 +81,11 @@ size_t Translate(char *buffer,
|
||||
try_serverlang:
|
||||
if (target == SOURCEMOD_SERVER_LANGUAGE)
|
||||
{
|
||||
langid = g_Translator.GetServerLanguage();
|
||||
langid = translator->GetServerLanguage();
|
||||
}
|
||||
else if ((target >= 1) && (target <= g_Players.GetMaxClients()))
|
||||
{
|
||||
langid = g_Translator.GetClientLanguage(target);
|
||||
langid = translator->GetClientLanguage(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -95,7 +95,7 @@ try_serverlang:
|
||||
|
||||
if (pPhrases->FindTranslation(key, langid, &pTrans) != Trans_Okay)
|
||||
{
|
||||
if (target != SOURCEMOD_SERVER_LANGUAGE && langid != g_Translator.GetServerLanguage())
|
||||
if (target != SOURCEMOD_SERVER_LANGUAGE && langid != translator->GetServerLanguage())
|
||||
{
|
||||
target = SOURCEMOD_SERVER_LANGUAGE;
|
||||
goto try_serverlang;
|
||||
@@ -785,21 +785,21 @@ reswitch:
|
||||
}
|
||||
else
|
||||
{
|
||||
target = g_Translator.GetGlobalTarget();
|
||||
target = translator->GetGlobalTarget();
|
||||
}
|
||||
|
||||
try_again:
|
||||
if (target == SOURCEMOD_SERVER_LANGUAGE)
|
||||
{
|
||||
lang_id = g_Translator.GetServerLanguage();
|
||||
lang_id = translator->GetServerLanguage();
|
||||
}
|
||||
else if (target >= 1 && target <= g_Players.GetMaxClients())
|
||||
{
|
||||
lang_id = g_Translator.GetClientLanguage(target);
|
||||
lang_id = translator->GetClientLanguage(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
lang_id = g_Translator.GetServerLanguage();
|
||||
lang_id = translator->GetServerLanguage();
|
||||
}
|
||||
|
||||
if (pPhrases == NULL)
|
||||
@@ -813,7 +813,7 @@ try_again:
|
||||
|
||||
if (pPhrases->FindTranslation(key, lang_id, &trans) != Trans_Okay)
|
||||
{
|
||||
if (target != SOURCEMOD_SERVER_LANGUAGE && lang_id != g_Translator.GetServerLanguage())
|
||||
if (target != SOURCEMOD_SERVER_LANGUAGE && lang_id != translator->GetServerLanguage())
|
||||
{
|
||||
target = SOURCEMOD_SERVER_LANGUAGE;
|
||||
goto try_again;
|
||||
@@ -1274,37 +1274,6 @@ done:
|
||||
return (maxlen - llen - 1);
|
||||
}
|
||||
|
||||
const char *stristr(const char *str, const char *substr)
|
||||
{
|
||||
if (!*substr)
|
||||
{
|
||||
return ((char *)str);
|
||||
}
|
||||
|
||||
char *needle = (char *)substr;
|
||||
char *prevloc = (char *)str;
|
||||
char *haystack = (char *)str;
|
||||
|
||||
while (*haystack)
|
||||
{
|
||||
if (tolower(*haystack) == tolower(*needle))
|
||||
{
|
||||
haystack++;
|
||||
if (!*++needle)
|
||||
{
|
||||
return prevloc;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
haystack = ++prevloc;
|
||||
needle = (char *)substr;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int strncopy(char *dest, const char *src, size_t count)
|
||||
{
|
||||
if (!count)
|
||||
@@ -1362,194 +1331,6 @@ char *sm_strdup(const char *str)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive)
|
||||
{
|
||||
size_t searchLen = strlen(search);
|
||||
size_t replaceLen = strlen(replace);
|
||||
|
||||
char *ptr = subject;
|
||||
unsigned int total = 0;
|
||||
while ((ptr = UTIL_ReplaceEx(ptr, maxlength, search, searchLen, replace, replaceLen, caseSensitive)) != NULL)
|
||||
{
|
||||
total++;
|
||||
if (*ptr == '\0')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* NOTE: Do not edit this for the love of god unless you have
|
||||
* read the test cases and understand the code behind each one.
|
||||
* While I don't guarantee there aren't mistakes, I do guarantee
|
||||
* that plugins will end up relying on tiny idiosyncrasies of this
|
||||
* function, just like they did with AMX Mod X.
|
||||
*
|
||||
* There are explicitly more cases than the AMX Mod X version because
|
||||
* we're not doing a blind copy. Each case is specifically optimized
|
||||
* for what needs to be done. Even better, we don't have to error on
|
||||
* bad buffer sizes. Instead, this function will smartly cut off the
|
||||
* string in a way that pushes old data out.
|
||||
*/
|
||||
char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive)
|
||||
{
|
||||
char *ptr = subject;
|
||||
size_t browsed = 0;
|
||||
size_t textLen = strlen(subject);
|
||||
|
||||
/* It's not possible to search or replace */
|
||||
if (searchLen > textLen)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Handle the case of one byte replacement.
|
||||
* It's only valid in one case.
|
||||
*/
|
||||
if (maxLen == 1)
|
||||
{
|
||||
/* If the search matches and the replace length is 0,
|
||||
* we can just terminate the string and be done.
|
||||
*/
|
||||
if ((caseSensitive ? strcmp(subject, search) : strcasecmp(subject, search)) == 0 && replaceLen == 0)
|
||||
{
|
||||
*subject = '\0';
|
||||
return subject;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Subtract one off the maxlength so we can include the null terminator */
|
||||
maxLen--;
|
||||
|
||||
while (*ptr != '\0' && (browsed <= textLen - searchLen))
|
||||
{
|
||||
/* See if we get a comparison */
|
||||
if ((caseSensitive ? strncmp(ptr, search, searchLen) : strncasecmp(ptr, search, searchLen)) == 0)
|
||||
{
|
||||
if (replaceLen > searchLen)
|
||||
{
|
||||
/* First, see if we have enough space to do this operation */
|
||||
if (maxLen - textLen < replaceLen - searchLen)
|
||||
{
|
||||
/* First, see if the replacement length goes out of bounds. */
|
||||
if (browsed + replaceLen >= maxLen)
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDDDDDDDDD
|
||||
* OUTPUT : AADDDDDDDDD
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* If it does, we'll just bound the length and do a strcpy. */
|
||||
replaceLen = maxLen - browsed;
|
||||
/* Note, we add one to the final result for the null terminator */
|
||||
strncopy(ptr, replace, replaceLen+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDDDDDD
|
||||
* OUTPUT : AADDDDDDDCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* We're going to have some bytes left over... */
|
||||
size_t origBytesToCopy = (textLen - (browsed + searchLen)) + 1;
|
||||
size_t realBytesToCopy = (maxLen - (browsed + replaceLen)) + 1;
|
||||
char *moveFrom = ptr + searchLen + (origBytesToCopy - realBytesToCopy);
|
||||
char *moveTo = ptr + replaceLen;
|
||||
|
||||
/* First, move our old data out of the way. */
|
||||
memmove(moveTo, moveFrom, realBytesToCopy);
|
||||
|
||||
/* Now, do our replacement. */
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDDD
|
||||
* OUTPUT : AADDDDCCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* Yes, we have enough space. Do a normal move operation. */
|
||||
char *moveFrom = ptr + searchLen;
|
||||
char *moveTo = ptr + replaceLen;
|
||||
|
||||
/* First move our old data out of the way. */
|
||||
size_t bytesToCopy = (textLen - (browsed + searchLen)) + 1;
|
||||
memmove(moveTo, moveFrom, bytesToCopy);
|
||||
|
||||
/* Now do our replacement. */
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
}
|
||||
else if (replaceLen < searchLen)
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: D
|
||||
* OUTPUT : AADCCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* If the replacement does not grow the string length, we do not
|
||||
* need to do any fancy checking at all. Yay!
|
||||
*/
|
||||
char *moveFrom = ptr + searchLen; /* Start after the search pointer */
|
||||
char *moveTo = ptr + replaceLen; /* Copy to where the replacement ends */
|
||||
|
||||
/* Copy our replacement in, if any */
|
||||
if (replaceLen)
|
||||
{
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
|
||||
/* Figure out how many bytes to move down, including null terminator */
|
||||
size_t bytesToCopy = (textLen - (browsed + searchLen)) + 1;
|
||||
|
||||
/* Move the rest of the string down */
|
||||
memmove(moveTo, moveFrom, bytesToCopy);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* EXAMPLE CASE:
|
||||
* Subject: AABBBCCC
|
||||
* Buffer : 12 bytes
|
||||
* Search : BBB
|
||||
* Replace: DDD
|
||||
* OUTPUT : AADDDCCC
|
||||
* POSITION: ^
|
||||
*/
|
||||
/* We don't have to move anything around, just do a straight copy */
|
||||
memcpy(ptr, replace, replaceLen);
|
||||
}
|
||||
|
||||
return ptr + replaceLen;
|
||||
}
|
||||
ptr++;
|
||||
browsed++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *UTIL_TrimWhitespace(char *str, size_t &len)
|
||||
{
|
||||
char *end = str + len - 1;
|
||||
@@ -1580,38 +1361,6 @@ char *UTIL_TrimWhitespace(char *str, size_t &len)
|
||||
return str;
|
||||
}
|
||||
|
||||
size_t UTIL_DecodeHexString(unsigned char *buffer, size_t maxlength, const char *hexstr)
|
||||
{
|
||||
size_t written = 0;
|
||||
size_t length = strlen(hexstr);
|
||||
|
||||
for (size_t i = 0; i < length; i++)
|
||||
{
|
||||
if (written >= maxlength)
|
||||
break;
|
||||
buffer[written++] = hexstr[i];
|
||||
if (hexstr[i] == '\\' && hexstr[i + 1] == 'x')
|
||||
{
|
||||
if (i + 3 >= length)
|
||||
continue;
|
||||
/* Get the hex part. */
|
||||
char s_byte[3];
|
||||
int r_byte;
|
||||
s_byte[0] = hexstr[i + 2];
|
||||
s_byte[1] = hexstr[i + 3];
|
||||
s_byte[2] = '\0';
|
||||
/* Read it as an integer */
|
||||
sscanf(s_byte, "%x", &r_byte);
|
||||
/* Save the value */
|
||||
buffer[written - 1] = r_byte;
|
||||
/* Adjust index */
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
char *UTIL_ToLowerCase(const char *str)
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user