Compare commits
825
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff38e3ded2 | ||
|
|
4f43f43297 | ||
|
|
60fccfface | ||
|
|
98690df815 | ||
|
|
52c537b2ab | ||
|
|
bbec55d5f6 | ||
|
|
0abdcb58cf | ||
|
|
902672aa58 | ||
|
|
aed47ac13d | ||
|
|
6928d046f4 | ||
|
|
6c396dfbef | ||
|
|
4b66ca079d | ||
|
|
ea2e448dd6 | ||
|
|
d7fe14221b | ||
|
|
e89d3e5616 | ||
|
|
253ed583e6 | ||
|
|
58cb84d0bf | ||
|
|
65d34bdb55 | ||
|
|
19fd09c102 | ||
|
|
434d458a54 | ||
|
|
aaae36dbd3 | ||
|
|
4427ec3a65 | ||
|
|
5f6c5cb4fb | ||
|
|
6425484608 | ||
|
|
8e897f62a3 | ||
|
|
d40423569a | ||
|
|
7f28a15a5c | ||
|
|
669f1aefa6 | ||
|
|
a65dfc4888 | ||
|
|
60292fa424 | ||
|
|
0303377f92 | ||
|
|
bfd9b061f4 | ||
|
|
b1bf2dece1 | ||
|
|
b9e2d2b690 | ||
|
|
15fe086e7a | ||
|
|
26eae4e396 | ||
|
|
72eeebb59f | ||
|
|
1c5a684f1c | ||
|
|
3f5cd0e0e7 | ||
|
|
536ef2c019 | ||
|
|
9320d4b378 | ||
|
|
5b6970561e | ||
|
|
83f374561c | ||
|
|
d914a6b982 | ||
|
|
9b14101586 | ||
|
|
46c87f509b | ||
|
|
4df1d19cf2 | ||
|
|
c1af9081c6 | ||
|
|
ae538916b6 | ||
|
|
1efea1fd82 | ||
|
|
ef255c9a3e | ||
|
|
0909a1ffae | ||
|
|
d725178405 | ||
|
|
148271c5ea | ||
|
|
6252676e57 | ||
|
|
d4709704ea | ||
|
|
e6d418c04e | ||
|
|
752f7bdefc | ||
|
|
ced6add9ea | ||
|
|
e9834a33b1 | ||
|
|
e2a6ae9ecc | ||
|
|
eb64e66e9f | ||
|
|
6a24b049cb | ||
|
|
1112dfffb3 | ||
|
|
3304bc2f3a | ||
|
|
4d2bee192f | ||
|
|
2d4fb8a463 | ||
|
|
56c5012bef | ||
|
|
bd97bdd378 | ||
|
|
211c5dcfcd | ||
|
|
2cdf1897b9 | ||
|
|
bf8c57c669 | ||
|
|
7fd6b308f8 | ||
|
|
6908c0f1d0 | ||
|
|
f74380b3e9 | ||
|
|
5096aef6e7 | ||
|
|
d9f5801a68 | ||
|
|
462e03d150 | ||
|
|
6aded88e14 | ||
|
|
74a25097b2 | ||
|
|
2c190f502f | ||
|
|
0122686541 | ||
|
|
187c0a9bf7 | ||
|
|
9def5e57de | ||
|
|
3d573c08a1 | ||
|
|
e1bb10d859 | ||
|
|
569f4646a0 | ||
|
|
16756e550f | ||
|
|
3ac9ecb4b7 | ||
|
|
3ee6bae4ba | ||
|
|
2e176b8b8d | ||
|
|
5b21fc89fc | ||
|
|
bc7b90a1b4 | ||
|
|
c0ee2ce345 | ||
|
|
2c7555366f | ||
|
|
72da49415e | ||
|
|
8e744ec5f7 | ||
|
|
7372b66680 | ||
|
|
8dfbcf5a9f | ||
|
|
01ff2cca0c | ||
|
|
e981c2b43f | ||
|
|
68bc33ef4d | ||
|
|
a7e447a3f5 | ||
|
|
096a04b3e4 | ||
|
|
86e600000d | ||
|
|
a0128d9b7c | ||
|
|
65996254c6 | ||
|
|
a85031be53 | ||
|
|
8509f0857a | ||
|
|
b24c75b400 | ||
|
|
d372e789a4 | ||
|
|
d9f7e4c9e0 | ||
|
|
e6ea726b69 | ||
|
|
98c1a18e57 | ||
|
|
e04d2a4a10 | ||
|
|
96a3671bb6 | ||
|
|
0c028ca9d0 | ||
|
|
64124447d5 | ||
|
|
037ea592ab | ||
|
|
6ebbb48f9f | ||
|
|
2e8a53ff34 | ||
|
|
f104438802 | ||
|
|
eb25650e26 | ||
|
|
c4cba5254c | ||
|
|
c90dda908a | ||
|
|
6aca0a8bfc | ||
|
|
864376e7ba | ||
|
|
71794fe511 | ||
|
|
c69989c56f | ||
|
|
cc91beece7 | ||
|
|
0d6c6bdb58 | ||
|
|
e234b1537c | ||
|
|
407e58604f | ||
|
|
2c3bf7dd23 | ||
|
|
5e6417eac0 | ||
|
|
a4db34a419 | ||
|
|
8c493576cc | ||
|
|
110a0d98fa | ||
|
|
449b52e5a4 | ||
|
|
d0fda1f919 | ||
|
|
79ea33beda | ||
|
|
fef5bd321c | ||
|
|
6c7a763b76 | ||
|
|
78fa1c9995 | ||
|
|
3623ee3ce8 | ||
|
|
ba28da5fdc | ||
|
|
c2b7bd10ec | ||
|
|
35ab37c76c | ||
|
|
c968dfa113 | ||
|
|
09b24e45f9 | ||
|
|
8541040bb9 | ||
|
|
8ae003046c | ||
|
|
fc7f9ac6e9 | ||
|
|
7dcc7ea99c | ||
|
|
4590015ed6 | ||
|
|
79f9dc61a4 | ||
|
|
3fac7d027a | ||
|
|
10ba5809d2 | ||
|
|
792204bd06 | ||
|
|
f19cb010a0 | ||
|
|
ca3df3bd50 | ||
|
|
db43487b5a | ||
|
|
38c37b8160 | ||
|
|
44a04e6167 | ||
|
|
9d6a9eb615 | ||
|
|
27070af1b9 | ||
|
|
32d2d4107d | ||
|
|
75ebac822d | ||
|
|
bd9fab6cf5 | ||
|
|
d75f8f11e1 | ||
|
|
47900db414 | ||
|
|
aec3469c03 | ||
|
|
b61542242c | ||
|
|
13c1fd09c4 | ||
|
|
fddb69e49e | ||
|
|
ed51d5cf84 | ||
|
|
3d7b0db114 | ||
|
|
9e445a5adf | ||
|
|
97e25c37de | ||
|
|
16033c1307 | ||
|
|
15d64b8486 | ||
|
|
5d06aa3c8c | ||
|
|
e276223b61 | ||
|
|
71b48fad0f | ||
|
|
a3fade1c1d | ||
|
|
6530f47b2d | ||
|
|
3ab1ef139f | ||
|
|
36bd6423c2 | ||
|
|
ffd8ff099a | ||
|
|
178347f9f1 | ||
|
|
e194f89b25 | ||
|
|
3bfc70aa3b | ||
|
|
93a6a0f211 | ||
|
|
cef6a2e389 | ||
|
|
4f5764e4a5 | ||
|
|
21770ff10f | ||
|
|
2b97461f54 | ||
|
|
0cf5f4ae2a | ||
|
|
7b6dcfce87 | ||
|
|
f9d472847c | ||
|
|
d69d97402b | ||
|
|
643c39690f | ||
|
|
6048144310 | ||
|
|
94303ea9a0 | ||
|
|
a017e4820a | ||
|
|
50e1c5ba1f | ||
|
|
c5ec369388 | ||
|
|
7d3ebce7d1 | ||
|
|
52826342fc | ||
|
|
29b357a2f6 | ||
|
|
747ed1e59a | ||
|
|
992c05b6aa | ||
|
|
f4a5457941 | ||
|
|
7167a807bf | ||
|
|
22675ba2e7 | ||
|
|
80602b011d | ||
|
|
abea8e2195 | ||
|
|
9075aecb18 | ||
|
|
6e9ac875d7 | ||
|
|
100ecb12e9 | ||
|
|
57b4701e57 | ||
|
|
fffc211989 | ||
|
|
5a0528de26 | ||
|
|
fb8f46ea45 | ||
|
|
a8e1a4f2fd | ||
|
|
157f050f89 | ||
|
|
3653f56331 | ||
|
|
e31cbbfe21 | ||
|
|
bc3491c5bd | ||
|
|
9a7c25047d | ||
|
|
7cef8b7363 | ||
|
|
e449b8384c | ||
|
|
9514c12982 | ||
|
|
489d6c5a65 | ||
|
|
ccc59ecdaf | ||
|
|
d2ce50f989 | ||
|
|
14e409adb4 | ||
|
|
4a0f639e89 | ||
|
|
32c5925652 | ||
|
|
4c91dd8621 | ||
|
|
f641aa92f5 | ||
|
|
3bdc8583e5 | ||
|
|
4e37900d93 | ||
|
|
c676ecc026 | ||
|
|
db760dc29b | ||
|
|
0fbb87e3b2 | ||
|
|
29996d0133 | ||
|
|
7807f3e31a | ||
|
|
e246d14a6b | ||
|
|
a34a27be65 | ||
|
|
e1d2b88c23 | ||
|
|
f96ca17f17 | ||
|
|
50580498c4 | ||
|
|
a21e688c96 | ||
|
|
4b1deee7e1 | ||
|
|
bf5fefe84f | ||
|
|
5c92b0d154 | ||
|
|
2b7ccf6625 | ||
|
|
004d450844 | ||
|
|
7705e88b57 | ||
|
|
3f250ba42d | ||
|
|
1b8bb4e049 | ||
|
|
1577fab93a | ||
|
|
181fe74b09 | ||
|
|
34b8d00548 | ||
|
|
0a6cbadcd8 | ||
|
|
701fef1ba4 | ||
|
|
cdd78b2ec3 | ||
|
|
ba04132142 | ||
|
|
ddc42bedf5 | ||
|
|
ea84302e28 | ||
|
|
a7a08a7d4e | ||
|
|
0a33a25a7d | ||
|
|
2c9622ea52 | ||
|
|
08e2fc8deb | ||
|
|
ebed45a0f6 | ||
|
|
d3c279fd05 | ||
|
|
e69ed4b0da | ||
|
|
4daca3c5ba | ||
|
|
cb41fa6de4 | ||
|
|
dc758ead10 | ||
|
|
1fe38c7473 | ||
|
|
5564c38a2f | ||
|
|
2a853a23d7 | ||
|
|
37da98c9bb | ||
|
|
5a5172be57 | ||
|
|
58ec9a4f38 | ||
|
|
b7477fc321 | ||
|
|
88afac51f0 | ||
|
|
2bb3e5fd6b | ||
|
|
dd338d40f3 | ||
|
|
1cc8440900 | ||
|
|
47cf8f4233 | ||
|
|
eedfd2d70d | ||
|
|
4e88626d65 | ||
|
|
a1b91ac136 | ||
|
|
4bbd74b702 | ||
|
|
1d07d24054 | ||
|
|
0a0fd0c64a | ||
|
|
a7c6fc12d8 | ||
|
|
48f0a49f9b | ||
|
|
b63d714a06 | ||
|
|
7bdcea5814 | ||
|
|
f418f38589 | ||
|
|
7d3e32b65f | ||
|
|
52377b509b | ||
|
|
14152bb7ba | ||
|
|
d51aaec97d | ||
|
|
ea3fe754f4 | ||
|
|
04354a809c | ||
|
|
3cf30f5e62 | ||
|
|
7ff0129f36 | ||
|
|
b684d3aad7 | ||
|
|
f164419baa | ||
|
|
f20603ad06 | ||
|
|
bac975331d | ||
|
|
dcccfbd26a | ||
|
|
4baf847062 | ||
|
|
90a44ea6c8 | ||
|
|
fef83838f9 | ||
|
|
1422a9abe3 | ||
|
|
2fc0520895 | ||
|
|
7b1adfe00b | ||
|
|
28e1568eb7 | ||
|
|
0a6eac7c27 | ||
|
|
ecaced40f2 | ||
|
|
984a2d26f4 | ||
|
|
f85bb7e490 | ||
|
|
321443450a | ||
|
|
25a0a192a2 | ||
|
|
843ff25de4 | ||
|
|
4563c00deb | ||
|
|
7a38e5584c | ||
|
|
e26ce2b457 | ||
|
|
9c1e45d97c | ||
|
|
c2756c731f | ||
|
|
d6fc82f8fa | ||
|
|
2acf1b08d5 | ||
|
|
6ffd39ac77 | ||
|
|
9ae456b9d1 | ||
|
|
5bbeddc134 | ||
|
|
373fbb6ca3 | ||
|
|
d1405f2ab3 | ||
|
|
2ff9b0aada | ||
|
|
43f5d71724 | ||
|
|
41b61ed36f | ||
|
|
31e30faace | ||
|
|
ff7a2c6b73 | ||
|
|
acea705df8 | ||
|
|
7e3f9ada31 | ||
|
|
0a956115eb | ||
|
|
30174c07de | ||
|
|
8e5c7713fc | ||
|
|
7b45342955 | ||
|
|
2f0965c14b | ||
|
|
c1c5d2656c | ||
|
|
af2af91300 | ||
|
|
c880919466 | ||
|
|
b1646accb9 | ||
|
|
00bb796db2 | ||
|
|
6c1259f6e6 | ||
|
|
a04521b55a | ||
|
|
c8b3c82a12 | ||
|
|
c1c8a4c988 | ||
|
|
335febca34 | ||
|
|
e191d446a7 | ||
|
|
412ad74aad | ||
|
|
e70fc299ac | ||
|
|
b3b972caf7 | ||
|
|
c25017e1a4 | ||
|
|
be1d12f94f | ||
|
|
3c18289465 | ||
|
|
ed29c837fa | ||
|
|
8d78c74554 | ||
|
|
e48bba5b4d | ||
|
|
547f7aecc1 | ||
|
|
67ba04bcee | ||
|
|
a1d84347ed | ||
|
|
253109d1c9 | ||
|
|
c0c9fc3267 | ||
|
|
918bec36d9 | ||
|
|
7b8cd751e1 | ||
|
|
849c4a70ae | ||
|
|
c231375e19 | ||
|
|
d8babe2a71 | ||
|
|
4e88a5a431 | ||
|
|
a6579c7bcb | ||
|
|
5a2f8afd33 | ||
|
|
3c12db8637 | ||
|
|
07cbe39552 | ||
|
|
974f31c149 | ||
|
|
4a1c565b62 | ||
|
|
32f9c46424 | ||
|
|
34d2d7760b | ||
|
|
2f36e3b231 | ||
|
|
b0d6e39035 | ||
|
|
b7a2f221f2 | ||
|
|
6d2bb90f51 | ||
|
|
fa1336623f | ||
|
|
2b65e2496d | ||
|
|
4953b1d889 | ||
|
|
ed75da0f85 | ||
|
|
ff7cb43f6a | ||
|
|
dc3b4a57cc | ||
|
|
7009e755fe | ||
|
|
bba2cfc6f7 | ||
|
|
759c76e188 | ||
|
|
db5a0be4ca | ||
|
|
29e57e77f7 | ||
|
|
f50c7469ca | ||
|
|
d9af295a29 | ||
|
|
4147bf7444 | ||
|
|
99e304d6b5 | ||
|
|
4e7000368f | ||
|
|
04b7b7b9ff | ||
|
|
2534fd1ce2 | ||
|
|
e10dd226ff | ||
|
|
b016623fb5 | ||
|
|
49d14111e2 | ||
|
|
f0a11d3cb7 | ||
|
|
168f42323b | ||
|
|
64e7d0b737 | ||
|
|
2e8c0c8f7d | ||
|
|
8f555543cc | ||
|
|
88a71ddad4 | ||
|
|
02e31bb576 | ||
|
|
32f7bec6c8 | ||
|
|
a935e6f90d | ||
|
|
f4dba84ae5 | ||
|
|
5cb4acf590 | ||
|
|
e83526aa63 | ||
|
|
04021ed8b1 | ||
|
|
31a4f40c9a | ||
|
|
4001b0f804 | ||
|
|
a838276ec2 | ||
|
|
6192efc078 | ||
|
|
4517031861 | ||
|
|
187ff255bd | ||
|
|
dec172f0e1 | ||
|
|
a0107299f3 | ||
|
|
bbbc2ce22c | ||
|
|
def0a8a0d6 | ||
|
|
46095d797c | ||
|
|
5687a7ba90 | ||
|
|
556c03babf | ||
|
|
09ea2e13aa | ||
|
|
ef62e3d665 | ||
|
|
fb2f0795c5 | ||
|
|
fb44b51d26 | ||
|
|
8680d07e0a | ||
|
|
9d8445b693 | ||
|
|
5de80c03db | ||
|
|
c5df0bf58f | ||
|
|
8c1502278b | ||
|
|
08e3e3b53d | ||
|
|
86591356b0 | ||
|
|
f62cf04f91 | ||
|
|
cf621eaf10 | ||
|
|
b8214a80c2 | ||
|
|
f79c9eec82 | ||
|
|
8fcecf3dec | ||
|
|
326e8ee205 | ||
|
|
bda56bf33f | ||
|
|
7439f15d7e | ||
|
|
7a4967abc9 | ||
|
|
6749545991 | ||
|
|
124c3f4575 | ||
|
|
56b77a536f | ||
|
|
e175cce776 | ||
|
|
097f42a01c | ||
|
|
bcf1b092ae | ||
|
|
d707ea0de5 | ||
|
|
2c107e3601 | ||
|
|
29d1246b8d | ||
|
|
514fc7dfe8 | ||
|
|
0691bca512 | ||
|
|
e1f8a0fd68 | ||
|
|
e141cf74d5 | ||
|
|
9ca1ca62ea | ||
|
|
99d27b979d | ||
|
|
681747d02c | ||
|
|
1ec936daf6 | ||
|
|
8eb6d9ccf5 | ||
|
|
d3394453ff | ||
|
|
5caeebf807 | ||
|
|
d6a9cb427f | ||
|
|
cb4b1dce71 | ||
|
|
e6c5adfa24 | ||
|
|
444896104f | ||
|
|
e2791a3702 | ||
|
|
16ed584e39 | ||
|
|
d6a0cb8992 | ||
|
|
f99b82b53a | ||
|
|
32b7e2df98 | ||
|
|
0137219fb8 | ||
|
|
51f914fb30 | ||
|
|
f85eeb2adb | ||
|
|
6b213a9caf | ||
|
|
35f31b0f1a | ||
|
|
56a68f4dfd | ||
|
|
6e930f6048 | ||
|
|
4fc7fce4fd | ||
|
|
f27202202b | ||
|
|
deb7a123a6 | ||
|
|
9ef7dca666 | ||
|
|
fe4e39a2dd | ||
|
|
4951dccded | ||
|
|
58870a30fb | ||
|
|
05e18833ac | ||
|
|
08c2a087d8 | ||
|
|
05c8681336 | ||
|
|
bf5ee181fa | ||
|
|
094acb1039 | ||
|
|
93944e7f4b | ||
|
|
1251093ec1 | ||
|
|
c951a6ca7c | ||
|
|
70a594f354 | ||
|
|
9b03490b1a | ||
|
|
edb7b49c25 | ||
|
|
0c1c984eaf | ||
|
|
b595047fdf | ||
|
|
2c25c09420 | ||
|
|
f6b088c2e6 | ||
|
|
1cf87d4ad9 | ||
|
|
0aad4353cf | ||
|
|
7875fe1acd | ||
|
|
95aca7b61b | ||
|
|
e52e3c4639 | ||
|
|
eee77228e6 | ||
|
|
2b0cc7b4ea | ||
|
|
eaccf6f90b | ||
|
|
a01848c774 | ||
|
|
ea748cfdbd | ||
|
|
401c6b445d | ||
|
|
3c0b289694 | ||
|
|
8182bdb476 | ||
|
|
ae7e5a6a4b | ||
|
|
50eb77926e | ||
|
|
bd24893837 | ||
|
|
dad66c9204 | ||
|
|
9292e0f816 | ||
|
|
4d48fc7ae5 | ||
|
|
463cfb0015 | ||
|
|
3ed5d1e8d7 | ||
|
|
e64e2534eb | ||
|
|
67e28d7475 | ||
|
|
64b8049d70 | ||
|
|
dd75e88cbb | ||
|
|
c75d607a00 | ||
|
|
8126aa6bb8 | ||
|
|
846caf1298 | ||
|
|
c2917a8dd4 | ||
|
|
9e443cfdd3 | ||
|
|
b743af8a72 | ||
|
|
8a4c96b252 | ||
|
|
0392e55ef7 | ||
|
|
fa5ee3287f | ||
|
|
e1882f97a1 | ||
|
|
1a156deca5 | ||
|
|
5668f23b50 | ||
|
|
232f344c41 | ||
|
|
79cf4e07eb | ||
|
|
f9b294d89e | ||
|
|
a88d7c1cdc | ||
|
|
85760603b7 | ||
|
|
ea1f5e86c0 | ||
|
|
b1072d3b09 | ||
|
|
81632dda97 | ||
|
|
80fdbcf8c7 | ||
|
|
bd2361c8ae | ||
|
|
c9a81c0651 | ||
|
|
aa096f2385 | ||
|
|
53acb70260 | ||
|
|
6ef4c4b3ad | ||
|
|
4ac38946f2 | ||
|
|
af54ae6af7 | ||
|
|
2c23544b29 | ||
|
|
5351bbec71 | ||
|
|
492c913aa9 | ||
|
|
31dd23fbd9 | ||
|
|
3f38171d8c | ||
|
|
307adb34ab | ||
|
|
8a4af4d22f | ||
|
|
2e7b6b5ba5 | ||
|
|
9a02cb9dc8 | ||
|
|
43c085eea3 | ||
|
|
6a834ffef7 | ||
|
|
86c8ec847a | ||
|
|
2df2b791d8 | ||
|
|
0e1ae4d85b | ||
|
|
3d96f8f127 | ||
|
|
2cc809be0c | ||
|
|
d2d2578314 | ||
|
|
76b51aed07 | ||
|
|
d0cbd943f1 | ||
|
|
c67a3cd749 | ||
|
|
bf0354dbb9 | ||
|
|
bc4f24e94d | ||
|
|
73203fb7b3 | ||
|
|
89c49c3976 | ||
|
|
89a56ac3e1 | ||
|
|
3cc5bebfa9 | ||
|
|
f9cfe7e9da | ||
|
|
5c58f8c97b | ||
|
|
bb9f31e555 | ||
|
|
ce57617744 | ||
|
|
77a7bf385b | ||
|
|
52d2a1797d | ||
|
|
111a3a7169 | ||
|
|
a513a2a6f8 | ||
|
|
f3f46fc126 | ||
|
|
3cff457c6d | ||
|
|
853b080aa4 | ||
|
|
261023800e | ||
|
|
7314d81947 | ||
|
|
d530d0c726 | ||
|
|
b01dd0798c | ||
|
|
968045ae62 | ||
|
|
4106620928 | ||
|
|
ac9b9f8c2a | ||
|
|
cdf54a3db1 | ||
|
|
8a5d833c89 | ||
|
|
57bba6d83f | ||
|
|
2c08bb3a96 | ||
|
|
6d4938f6b5 | ||
|
|
7104e187cc | ||
|
|
2fc7a017e1 | ||
|
|
e0a69507a0 | ||
|
|
29de57d415 | ||
|
|
42359a243a | ||
|
|
81e40c32c8 | ||
|
|
350044c9a8 | ||
|
|
bc1bb2cba2 | ||
|
|
6079c927ad | ||
|
|
42f61acc45 | ||
|
|
bc8c9ba691 | ||
|
|
6e59d8ae5c | ||
|
|
749177d0b3 | ||
|
|
4a32aff158 | ||
|
|
ac68a441ee | ||
|
|
119592eefe | ||
|
|
72a1fb06d0 | ||
|
|
8a7ced18de | ||
|
|
06c8f3a093 | ||
|
|
22aa6561b5 | ||
|
|
9ac54e5fb2 | ||
|
|
2c94b1268a | ||
|
|
46ce91c4f7 | ||
|
|
953da3f6e0 | ||
|
|
076b5191c9 | ||
|
|
20d12fad9f | ||
|
|
b18bd78c51 | ||
|
|
c3492f0192 | ||
|
|
d595e020cd | ||
|
|
5b4f98b354 | ||
|
|
6e2ac7376e | ||
|
|
1a86604d99 | ||
|
|
049f63e6fd | ||
|
|
3aea76cfb3 | ||
|
|
3b4c800baa | ||
|
|
ca9b2784bd | ||
|
|
df83dbc04e | ||
|
|
81af704f58 | ||
|
|
627e4fd115 | ||
|
|
044ee841f2 | ||
|
|
c93d05f622 | ||
|
|
c824afc61e | ||
|
|
3d015908d9 | ||
|
|
bff2b0a95d | ||
|
|
c9b320d645 | ||
|
|
29ee014a94 | ||
|
|
aa73e41f29 | ||
|
|
0a829027eb | ||
|
|
9c7249a1e9 | ||
|
|
d9357d5224 | ||
|
|
73a20de2ff | ||
|
|
8cd8228251 | ||
|
|
02faa8fbd6 | ||
|
|
79485eef38 | ||
|
|
b2d25f2a77 | ||
|
|
e794883b1f | ||
|
|
2a11739e86 | ||
|
|
dea6b06e2c | ||
|
|
13cf254f08 | ||
|
|
531c359fb9 | ||
|
|
9550e55160 | ||
|
|
40e0857a29 | ||
|
|
47fa9d9464 | ||
|
|
d827c0fd2d | ||
|
|
c16afc9cd3 | ||
|
|
a18b1e0790 | ||
|
|
80b2ea646a | ||
|
|
f7613f80f1 | ||
|
|
b90386276f | ||
|
|
8ad5d61878 | ||
|
|
b2fbd9691d | ||
|
|
0fac3fd74e | ||
|
|
3342a84cf4 | ||
|
|
21359ea17e | ||
|
|
a7cc2609e1 | ||
|
|
9023afff0d | ||
|
|
f388b0612b | ||
|
|
c7dbacc134 | ||
|
|
d88ba02fde | ||
|
|
6e91780e73 | ||
|
|
77ff2c40bd | ||
|
|
aee95b6c74 | ||
|
|
f1ef53cdff | ||
|
|
9a7c884c21 | ||
|
|
c7418e70ba | ||
|
|
1e70b04f48 | ||
|
|
1adb549a8d | ||
|
|
35eb2f2ce5 | ||
|
|
2030ef9114 | ||
|
|
c5330c73b7 | ||
|
|
7a968cb33c | ||
|
|
a2aa6b0daf | ||
|
|
8df36003a8 | ||
|
|
f226e6d70b | ||
|
|
394424c52f | ||
|
|
5c6a2868d9 | ||
|
|
62047b6d0d | ||
|
|
5e721623a0 | ||
|
|
90b739ae48 | ||
|
|
7262dd5e79 | ||
|
|
f41aefc525 | ||
|
|
0c22ab3972 | ||
|
|
221e7d48a7 | ||
|
|
21c0466b3d | ||
|
|
47f8d0eef5 | ||
|
|
d0286c1391 | ||
|
|
eac0e274a6 | ||
|
|
af05dbbcdf | ||
|
|
ac256a6c24 | ||
|
|
0771411eac | ||
|
|
e6de7c0c2d | ||
|
|
8d021c6caf | ||
|
|
9487f9d631 | ||
|
|
678cb82ec0 | ||
|
|
c4c8948d95 | ||
|
|
1e1f0de4ec | ||
|
|
84bde330cd | ||
|
|
e63a5cd3dc | ||
|
|
6c38c9264e | ||
|
|
946834b868 | ||
|
|
726aa68be9 | ||
|
|
16bdac4635 | ||
|
|
d014010a99 | ||
|
|
07915461e9 | ||
|
|
e24f15e7df | ||
|
|
90d4fed4a9 | ||
|
|
101d2359de | ||
|
|
046ce18e8b | ||
|
|
883e77bc60 | ||
|
|
6d2a3a7964 | ||
|
|
2fbd32cd1a | ||
|
|
800838d76a | ||
|
|
93b2edde8c | ||
|
|
a483ec5dc5 | ||
|
|
c42a26bb66 | ||
|
|
75a77c1925 | ||
|
|
c473d75d3d | ||
|
|
0c5e4b5a2f | ||
|
|
dcb9efa131 | ||
|
|
70301419b1 | ||
|
|
ad37496d34 | ||
|
|
472e9969d9 | ||
|
|
e1aba62c15 | ||
|
|
3a061aa38d | ||
|
|
d5f5239eeb | ||
|
|
8ba1d5e333 | ||
|
|
e618900688 | ||
|
|
ec69b34cbb | ||
|
|
430a860927 | ||
|
|
f08ce7f62f | ||
|
|
13e8cf9ed8 | ||
|
|
53d11eae63 | ||
|
|
72b6510e61 | ||
|
|
ea189849de | ||
|
|
8a2c175420 | ||
|
|
544ed79284 | ||
|
|
222b543adb | ||
|
|
2bec3aaa49 | ||
|
|
50c50a8f6c | ||
|
|
f0f44687b6 | ||
|
|
f295c6f4fd | ||
|
|
b455ac4f4e | ||
|
|
3d349378ad | ||
|
|
b865f96886 | ||
|
|
10bd6c298e | ||
|
|
4d3d51b5dd | ||
|
|
51d5f79f1e | ||
|
|
9b4bdd05b5 | ||
|
|
a0b05dc624 | ||
|
|
79fb305722 | ||
|
|
fbe46934a4 | ||
|
|
b9bd1b1037 | ||
|
|
b9aac380d4 | ||
|
|
127c89de4e | ||
|
|
251cced1f8 | ||
|
|
02931c94cf | ||
|
|
3a14544385 | ||
|
|
33b2847ec3 | ||
|
|
a3d5a0151d | ||
|
|
97c26eee3c | ||
|
|
cc3c16c079 | ||
|
|
c5af41d983 | ||
|
|
3bcd296d99 | ||
|
|
83a1ebcf0f | ||
|
|
8ba6d5cbba | ||
|
|
bb85c5eda2 | ||
|
|
a64894bbe4 | ||
|
|
50760d853f | ||
|
|
62b08e923c | ||
|
|
2f41af814e | ||
|
|
d28eca4bb3 | ||
|
|
306be48027 | ||
|
|
4ad308897f | ||
|
|
f6b6dff4c0 | ||
|
|
3ba7c63862 | ||
|
|
20112fe6cc | ||
|
|
3f49d29274 | ||
|
|
0601988e80 | ||
|
|
9eb41bc475 | ||
|
|
7cd5c96087 |
@@ -0,0 +1,15 @@
|
|||||||
|
# Binaries
|
||||||
|
\.dll$
|
||||||
|
\.exe$
|
||||||
|
\.so$
|
||||||
|
|
||||||
|
# Files generated by Visual Studio
|
||||||
|
\.aps$
|
||||||
|
\.ncb$
|
||||||
|
\.suo$
|
||||||
|
\.user$
|
||||||
|
|
||||||
|
# Build directories
|
||||||
|
/CrazyDebug.*
|
||||||
|
/Debug.*
|
||||||
|
/Release.*
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
54539fa4e51f98d7841c853c1370dff6ccd3cdf2 sourcemod-1.0.0
|
||||||
|
e6ef5ecdf8d75740ca2685a709bf321f8873bc3b sourcemod-1.1.0
|
||||||
|
e877885fac80be71822641f7a9122cebc9812521 sourcemod-1.1.1
|
||||||
|
b3ffa8a4511c4eadaf533fc790aa6b14f7f0c6ea sourcemod-1.1.2
|
||||||
|
3a73bbf60f34befa9b66be03fa5974b394bb3411 sourcemod-1.2.0
|
||||||
|
3c30a59c2296a13284a9f4eb42863b47db645adf sourcemod-1.2.1
|
||||||
+3
-33
@@ -1,36 +1,6 @@
|
|||||||
We now use svn:keywords "Id" on all .c/.cpp/.h/.inc/.sp/ files.
|
|
||||||
Please make sure your client is configured properly.
|
|
||||||
|
|
||||||
WINDOWS:
|
CONFIGURE YOUR IDENTITY FOR MERCURIAL!
|
||||||
- Open your Application Data directory.
|
IF YOU ARE A DEVELOPER WITH PUSH ACCESS, DO IT NOW KPLZTHX.
|
||||||
Windows XP/2000: C:\Documents and Settings\<user>\Application Data
|
|
||||||
Windows Vista: C:\Users\<user>\AppData\Roaming
|
|
||||||
|
|
||||||
- Now go to the Subversion directory.
|
http://wiki.alliedmods.net/Mercurial_Tutorial#Identity
|
||||||
- Open the "config" file with a text editor.
|
|
||||||
|
|
||||||
LINUX:
|
|
||||||
- Open ~/.subversion/config with your favorite text editor.
|
|
||||||
|
|
||||||
Under [miscellany], uncomment this line:
|
|
||||||
# enable-auto-props = yes
|
|
||||||
|
|
||||||
Under [auto-props], add these lines:
|
|
||||||
*.c = svn:keywords=Id
|
|
||||||
*.cpp = svn:keywords=Id
|
|
||||||
*.h = svn:keywords=Id
|
|
||||||
*.inc = svn:keywords=Id
|
|
||||||
*.sp = svn:keywords=Id
|
|
||||||
|
|
||||||
|
|
||||||
If you find a file with one of the above extensions that does not have the svn:keywords property...
|
|
||||||
|
|
||||||
TORTOISE SVN:
|
|
||||||
- Right click on the file(s) that do not have the property.
|
|
||||||
- In the context menu that appears, select TortoiseSVN -> Properties.
|
|
||||||
- A properties window should appear. Click the Add button.
|
|
||||||
- Select "svn:keywords" from the "Property name" combo box and type "Id" in the "Property value" text area.
|
|
||||||
- Click OK on both windows and commit the change(s).
|
|
||||||
|
|
||||||
CLI SVN CLIENT:
|
|
||||||
- Execute the following command: svn propset svn:keywords Id <files>
|
|
||||||
|
|||||||
+202
@@ -2,6 +2,208 @@ SourceMod Changelog
|
|||||||
|
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
|
SourceMod 1.2.2 [2009-08-28]
|
||||||
|
|
||||||
|
URL: http://wiki.alliedmods.net/SourceMod_1.2.2_Release_Notes
|
||||||
|
|
||||||
|
- Removed auto folders. (bug 3949).
|
||||||
|
- Added PointOutsideWorld native to sdktools. (bug 3906).
|
||||||
|
- Added "motd" chat trigger to basetriggers. (bug 2694).
|
||||||
|
- Added manual extension reloading command to root console menu. (bug 3934)
|
||||||
|
- Fixed 'list' type custom menu entries overwriting admin restrictions. (bug 3783).
|
||||||
|
- Added sm_resetcvar command to basecommands. (bug 3636).
|
||||||
|
- Updated gamedata for DOD:S. (bug 3948).
|
||||||
|
- Updated gamedata for TF2. (bug 3948).
|
||||||
|
- Added new .ep2v build config for valve OB based games. (bug 3948).
|
||||||
|
- Fixed incorrect escaping in clientprefs SQLite queries. (bug 3904)
|
||||||
|
- Updated gamedata for Synergy. (bug 3315).
|
||||||
|
- Upgraded to pcre-7.9 (bug 3923).
|
||||||
|
- Switched Insurgency chat printing to SayText. (bug 3738).
|
||||||
|
- Updated gamedata for Insurgency. (bug 3511).
|
||||||
|
- Updated gamedata for ZM. (bug 3746).
|
||||||
|
- Updated gamedata for Empires. (bug 3500).
|
||||||
|
- Updated gamedata for ZPS. (bug 3877).
|
||||||
|
- Updated gamedata for AoC. (bug 3891).
|
||||||
|
- Fixed RemovePlayerDisguise signature for TF2. (bug 3892).
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
SourceMod 1.2.1 [2009-05-31]
|
||||||
|
|
||||||
|
URL: http://wiki.alliedmods.net/SourceMod_1.2.1_Release_Notes
|
||||||
|
|
||||||
|
- Updated SDKTools for latest Team Fortress update.
|
||||||
|
- Added L4D handling to GuessSDKVersion() (bug 3842).
|
||||||
|
- Updated Zombie Panic Source offsets (bug 3632).
|
||||||
|
- Fixed crash when clientprefs saw disconnect from 64th client (bug 3821).
|
||||||
|
- Fixed Plugin_Handled acting like a Stop in usermsg hooks (bug 3685).
|
||||||
|
- Fixed early tv_enable causing crashes (bug 3766).
|
||||||
|
- Fixed unhook event crash (bug 3814).
|
||||||
|
- Fixed compiler reading uninitialized strings while processing varargs (bug 3811).
|
||||||
|
- Fixed compiler choosing whether to emit stradjust.pri on dynamic arrays based on uninitialized memory (bug 3810).
|
||||||
|
- Fixed Windows L4D CreateFakeClient signature (bug 3792).
|
||||||
|
- Fixed sm_slap for EP1 games (bug 3768).
|
||||||
|
- Fixed casting problems in TextParsers breaking TrimString for non-ASCII characters (bug 3800).
|
||||||
|
- Fixed OnClientConnect rejectmsg handling, improved doc (bug 3690).
|
||||||
|
- Fixed clientprefs not loading cookies for clients on late load (bug 3735).
|
||||||
|
- Fixed GetCommandFlags on original engine games (bug 3759).
|
||||||
|
- Fixed compiler asserting when returning a string literal (bug 3836).
|
||||||
|
- Fixed compiler erroring when tagging functions for string return (bug 3837).
|
||||||
|
- Fixed compiler not handling constant chained relational operators correctly (bug 3838).
|
||||||
|
- Fixed revote bug and inflexibilities in RedrawClientVoteMenu (bug 3834).
|
||||||
|
- Fixed auto update URL being set too late (bug 3699).
|
||||||
|
- Disabled nextmap in Synergy and Dystopia (bug 3687, bug 3741).
|
||||||
|
- Removed unnecessary SSE optimizations from msvc9 project files (bug 3756).
|
||||||
|
- Removed short-lived tag system (bug 3751).
|
||||||
|
- Removed the alive check from sm_rename. (bug 3698).
|
||||||
|
- Switched FortressForever to Valve menus (bug 3819).
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
SourceMod 1.2.0 [2009-03-05]
|
||||||
|
|
||||||
|
URL: http://wiki.alliedmods.net/SourceMod_1.2.0_Release_Notes
|
||||||
|
|
||||||
|
Major Features:
|
||||||
|
* Left 4 Dead Support
|
||||||
|
* Dark Messiah Support
|
||||||
|
* New and Improved Updater
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Added Left 4 Dead support (bug 3414).
|
||||||
|
- Added Dark Messiah game support (requires Metamod:Source 1.7.1 or higher).
|
||||||
|
- Added sm_name command (bug 2150).
|
||||||
|
- Added extension-level dynamic hooking to bintools (bug 2616).
|
||||||
|
- Added client validation API to replace passing userids asynchronously.
|
||||||
|
- Added cURL extension, available to other extensions (bug 3560).
|
||||||
|
- Added parsing of custom gamedata files (bug 3644).
|
||||||
|
- Added case insensitivity search to ReplaceString (bug 3639, Fyren).
|
||||||
|
- Added more detail to certain player-oriented menu titles (bug 2740, Fyren).
|
||||||
|
- Added sv_tags API (bug 3677).
|
||||||
|
- Greatly improved admin-sql-prefetch performance for large tables (bug 3354, FLOOR_MASTER).
|
||||||
|
- Exposed IServer address to extensions (bug 3545).
|
||||||
|
- New gamedata organization; files are now smaller and per-game (bug 3546).
|
||||||
|
- Split sound functions into a new plugin, sounds.smx.
|
||||||
|
- Fixed slap and slay on Insurgency (bug 2560).
|
||||||
|
- Fixed blank admins being created from invalid admin file lines (bug 3431).
|
||||||
|
- Fixed basetriggers not working on Insurgency (bug 3497).
|
||||||
|
- Fixed client preferences missing some clients (bug 3616).
|
||||||
|
- Improved database fallback mechanism in clientprefs (bug 3564).
|
||||||
|
- Improved timer handling in funcommands (bug 3498).
|
||||||
|
- Improved compile.sh to take filenames (bug 3550, jonasfietz).
|
||||||
|
- sm_kick now shows the kick reason when available.
|
||||||
|
- Fixed MsgPostHook (ex MsgSentNotify) callbacks not firing on intercept hook (bug 3631).
|
||||||
|
- Note: SourceMod now adds "sourcemod" to the sv_tags cvar.
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
SourceMod 1.1.2 [2009-02-26]
|
||||||
|
|
||||||
|
URL: http://wiki.alliedmods.net/SourceMod_1.1.2_Release_Notes
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Fixed critical hits being permanently disabled (bug 2674)
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
SourceMod 1.1.1 [2009-02-25]
|
||||||
|
|
||||||
|
URL: http://wiki.alliedmods.net/SourceMod_1.1.1_Release_Notes
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Added Age of Chivalry support (bug 3366, IceMatrix).
|
||||||
|
- Added Obsidian Conflict support (bug 2699, The DOO).
|
||||||
|
- Fixed compatibility issues with latest TF2 update.
|
||||||
|
- Fixed crash when an event handler fired an event of the same name (bug 3468).
|
||||||
|
- Fixed rare crash in the event manager on post hooks (bug 3548).
|
||||||
|
- Fixed formatting error with zero precision floats (bug 3447).
|
||||||
|
- Fixed various Insurgency offsets (bug 3544).
|
||||||
|
- Fixed admin menu (topmenu) categories being selectable when not usable (bug 3256).
|
||||||
|
- Fixed sm_sql_addgroup not working (bug 3578).
|
||||||
|
- Fixed memory leak when events were hooked as EventHookMode_Post.
|
||||||
|
- Fixed nextmap trigger showing wrong output with end-of-map voting disabled and sm_trigger_show set to zero (bug 3597, mr.e.unk).
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
SourceMod 1.1.0 [2008-12-28]
|
||||||
|
|
||||||
|
URL: http://wiki.alliedmods.net/SourceMod_1.1.0_Release_Notes
|
||||||
|
|
||||||
|
Major features:
|
||||||
|
* New map management plugins.
|
||||||
|
* New reserved slot type.
|
||||||
|
* GameData updates are retrieved remotely
|
||||||
|
* Client Preferences extension for per-client "cookies"
|
||||||
|
* New incremental and independent JIT
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Added new client preferences extension (API in clientprefs.inc, bug 1925).
|
||||||
|
- Added new gamedata auto-update functionality (bug 2602).
|
||||||
|
- Revamped and greatly expanded map management plugins and their functionality (bug 2201).
|
||||||
|
- Debug mode is now always on; as there is no longer a performance loss, there is no non-debug mode.
|
||||||
|
- The timeleft trigger can now handle mp_winlimit, mp_fraglimit, and mp_maxrounds (bug 2344).
|
||||||
|
- Translations can now be in separate files and placed in language-unique folders.
|
||||||
|
- The leading "STEAM_0:" or "STEAM_1:" in SteamIDs can now be omitted from admin files.
|
||||||
|
- Added sm_revote command so clients can participate in a vote that fell off their screen (bug 2156).
|
||||||
|
- Added Core API for creating stack structures (adt_stack.inc, bug 2441).
|
||||||
|
- Added API for extending mapchooser (mapchooser.inc, bug 2201).
|
||||||
|
- Added Core API for map transition control and history (nextmap.inc).
|
||||||
|
- Added TF2 forward for overriding how critical hits are calculated.
|
||||||
|
- Added SetClientInfo() native for modifying how a server sees a client's setinfo properties.
|
||||||
|
- Added CreateDirectory() native (bug 3253).
|
||||||
|
- Added "magic" MaxClients variable to replace slower GetMaxClients() call.
|
||||||
|
- Added support for three-letter language codes (bug 3526).
|
||||||
|
- Functions to control client versus client mic listening now work as described (bug 2498).
|
||||||
|
- Fixed SDKTools not being reloadable, and fixed a related bug in Handle type removal (bug 2753).
|
||||||
|
- Rewrote internal translation handling. Extensions now have access to an ITranslator API (bug 2535).
|
||||||
|
- Rewrote internal handling of dependencies (especially relating to native providers) (bug 2466).
|
||||||
|
- Added user config hooks to IGameConfigManager, for parsing user-defined sections.
|
||||||
|
- Revamped SourcePawn API. Removed and deprecated many structures and functions accidentally exposed publicly.
|
||||||
|
- Revamped SourcePawn structure, it is now separable from SourceMod for other projects.
|
||||||
|
- Renamed basefuncommands.phrases.txt to funcommands.phrases.txt (bug 2485).
|
||||||
|
- Renamed basefunvotes.phrases.txt to funvotes.phrases.txt (bug 2485).
|
||||||
|
- Added IDBDriver API call for extensions to handle IDBDriver dependencies properly.
|
||||||
|
- Usermessage natives now validate clients to prevent crashing.
|
||||||
|
- Fixed OnConfigsExecuted not working on listen servers.
|
||||||
|
- Fixed out-of-handle conditions in CreateTimer() causing crashes (bug 3381).
|
||||||
|
- Fixed accessing invalid Handles causing crashes (bug 3359).
|
||||||
|
- Fixed memory corruption with MySQL + FetchString (bug 3352).
|
||||||
|
- Fixed ReadFileString ignoring its fourth parameter (bug 3459).
|
||||||
|
- Fixed sm_sql_addadmin reading the immunity field as a password (bug 3395).
|
||||||
|
- Fixed ReadFile sign-extending instead of zero-extending (bug 3449).
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
SourceMod 1.0.4 [2008-09-14]
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Fixed amb1986: Format() with very long strings could crash if the input and output buffers overlapped.
|
||||||
|
- Fixed amb1938: The compiler ate too many characters in preprocessor macros.
|
||||||
|
- Fixed amb1935: Topmenu child names were not uncached when a category was deleted.
|
||||||
|
- Fixed amb1929: Banning via the console threw a runtime error.
|
||||||
|
- Fixed amb1918: Ban menu should compare userids, not client indexes
|
||||||
|
- Fixed amb1916: Threaded query delay is now 50ms instead of 500ms.
|
||||||
|
- Fixed amb1899: Duplicate maps in auto generated maplists.
|
||||||
|
- Fixed amb1891: Basechat didn't check for blank message in private says.
|
||||||
|
- Fixed amb1853: Ternary operators with string assignments could chop strings off.
|
||||||
|
- Fixed amb1815: Custom admin menu wasn't escaping input.
|
||||||
|
- Fixed amb1808: KickClient() is now delayed to prevent crashes, use KickClientEx for old functionality.
|
||||||
|
- Fixed amb1802: Possible crash when a client disconnected.
|
||||||
|
- Fixed amb1801: Improved bot detection, and fixed bots crashing if inside an OrangeBox server.cfg.
|
||||||
|
- Fixed amb1780: admin-sql-threaded had a debug spew turned on.
|
||||||
|
- Fixed amb1779: Crash in GetTeamName() on mods that don't support it.
|
||||||
|
- Fixed amb1763: Function call status is now cleared on a new function call.
|
||||||
|
- Fixed amb1749: Updated and improved DoD:S SDKTools coverage.
|
||||||
|
- Fixed team native crashes in SDKTools for mods like Insurgency.
|
||||||
|
- Fixed various file handle leaks.
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
|
||||||
SourceMod 1.0.3 [2008-06-21]
|
SourceMod 1.0.3 [2008-06-21]
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
// "@Full Admins"
|
// "@Full Admins"
|
||||||
//
|
//
|
||||||
// You can also specify immunity values. Two examples:
|
// You can also specify immunity values. Two examples:
|
||||||
// "83:abcdefg" //Immunity is 83, flags are abcefgh
|
// "83:abcdefgh" //Immunity is 83, flags are abcdefgh
|
||||||
// "6:@Full Admins" //Immunity is 6, group is "Full Admins"
|
// "6:@Full Admins" //Immunity is 6, group is "Full Admins"
|
||||||
//
|
//
|
||||||
// Immunity values can be any number. An admin cannot target an admin with
|
// Immunity values can be any number. An admin cannot target an admin with
|
||||||
@@ -37,9 +37,9 @@
|
|||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
// Examples: (do not put // in front of real lines, as // means 'comment')
|
// Examples: (do not put // in front of real lines, as // means 'comment')
|
||||||
//
|
//
|
||||||
// "STEAM_0:1:16" "bce" //kick, ban, slay for this steam ID, no immunity
|
// "STEAM_0:1:16" "bce" //generic, kick, unban for this steam ID, no immunity
|
||||||
// "!127.0.0.1" "99:z" //all permissions for this ip, immunity value is 99
|
// "!127.0.0.1" "99:z" //all permissions for this ip, immunity value is 99
|
||||||
// "BAILOPAN" "abc" "Gab3n" //name BAILOPAN, password "Gab3n": gets reservation, kick, ban
|
// "BAILOPAN" "abc" "Gab3n" //name BAILOPAN, password "Gab3n": gets reservation, generic, kick
|
||||||
//
|
//
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
|
|||||||
+27
-8
@@ -4,14 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
"Core"
|
"Core"
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Relative path to SourceMod's base directory. This is relative to the game/mod directory.
|
|
||||||
* Only change this if you have installed SourceMod in a non-default location.
|
|
||||||
*
|
|
||||||
* The default value is "addons/sourcemod"
|
|
||||||
*/
|
|
||||||
"BasePath" "addons/sourcemod"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This option determines if SourceMod logging is enabled.
|
* This option determines if SourceMod logging is enabled.
|
||||||
*
|
*
|
||||||
@@ -88,4 +80,31 @@
|
|||||||
* "off" - Translate using default server's language
|
* "off" - Translate using default server's language
|
||||||
*/
|
*/
|
||||||
"AllowClLanguageVar" "On"
|
"AllowClLanguageVar" "On"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables or Disables SourceMod's automatic gamedata updating.
|
||||||
|
*
|
||||||
|
* The default value is "no". A value of "yes" will block the Auto Updater.
|
||||||
|
*/
|
||||||
|
"DisableAutoUpdate" "no"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If set to yes, a successful gamedata update will attempt to restart SourceMod.
|
||||||
|
* SourceMod is unloaded and reloaded, and the map is changed to the current map.
|
||||||
|
* Since gamedata updates occur when the server loads, impact should be minimal.
|
||||||
|
* But to be safe, this option is disabled by default.
|
||||||
|
*/
|
||||||
|
"ForceRestartAfterUpdate" "no"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL to use for retrieving update information.
|
||||||
|
* SSL is not yet supported.
|
||||||
|
*/
|
||||||
|
"AutoUpdateURL" "http://update.sourcemod.net/update/"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to show debug spew.
|
||||||
|
* Currently this will log details about the gamedata updating process.
|
||||||
|
*/
|
||||||
|
"DebugSpew" "no"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,15 @@
|
|||||||
"driver" "sqlite"
|
"driver" "sqlite"
|
||||||
"database" "sourcemod-local"
|
"database" "sourcemod-local"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"clientprefs"
|
||||||
|
{
|
||||||
|
"driver" "sqlite"
|
||||||
|
"host" "localhost"
|
||||||
|
"database" "clientprefs-sqlite"
|
||||||
|
"user" "root"
|
||||||
|
"pass" ""
|
||||||
|
//"timeout" "0"
|
||||||
|
//"port" "0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
"Languages"
|
"Languages"
|
||||||
{
|
{
|
||||||
"en" "English"
|
"en" "English"
|
||||||
"es" "Español"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,8 @@
|
|||||||
"target" "default"
|
"target" "default"
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For the "rockthevote" plugin */
|
/* For the "nominations" plugin */
|
||||||
"rockthevote"
|
"nominations"
|
||||||
{
|
{
|
||||||
"target" "default"
|
"target" "default"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,14 +6,13 @@
|
|||||||
* Available properties for plugins are:
|
* Available properties for plugins are:
|
||||||
* "pause" - Whether or not the plugin should load paused - "yes" or "no" (default)
|
* "pause" - Whether or not the plugin should load paused - "yes" or "no" (default)
|
||||||
* "lifetime" - Lifetime of the plugin. Options:
|
* "lifetime" - Lifetime of the plugin. Options:
|
||||||
* "mapsync" - Plugins should be reloaded on mapchange if changed (default)
|
* "mapsync" - Plugins should be reloaded on mapchange if changed (default)
|
||||||
* "global" - Plugin will never be unloaded or updated
|
* "global" - Plugin will never be unloaded or updated
|
||||||
* "blockload" - Plugin will always be blocked from loading. Implicit (automatic) loads
|
* "blockload" - Plugin will always be blocked from loading. Implicit (automatic) loads
|
||||||
* produce no error, but explicit (manual) loads will show an error message.
|
* produce no error, but explicit (manual) loads will show an error message.
|
||||||
* (Options are one of "yes" or "no")
|
* (Options are one of "yes" or "no")
|
||||||
*
|
*
|
||||||
* You can also have an "Options" section declaring options to pass onto the JIT:
|
* You can also have an "Options" section declaring options to pass onto the JIT:
|
||||||
* "debug" - Whether or not to load the plugin in debug mode
|
|
||||||
* "profile" - Bit flags for profiling level. Add flags together to reach a value.
|
* "profile" - Bit flags for profiling level. Add flags together to reach a value.
|
||||||
* WARNING: Profiler is _ALPHA_ software! Use it at your own risk for
|
* WARNING: Profiler is _ALPHA_ software! Use it at your own risk for
|
||||||
* development cycles only (not production setups).
|
* development cycles only (not production setups).
|
||||||
@@ -32,7 +31,6 @@
|
|||||||
|
|
||||||
"Options"
|
"Options"
|
||||||
{
|
{
|
||||||
"debug" "no"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
CREATE TABLE sm_cookies
|
||||||
|
(
|
||||||
|
id INTEGER unsigned NOT NULL auto_increment,
|
||||||
|
name varchar(30) NOT NULL UNIQUE,
|
||||||
|
description varchar(255),
|
||||||
|
access INTEGER,
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE sm_cookie_cache
|
||||||
|
(
|
||||||
|
player varchar(65) NOT NULL,
|
||||||
|
cookie_id int(10) NOT NULL,
|
||||||
|
value varchar(100),
|
||||||
|
timestamp int NOT NULL,
|
||||||
|
PRIMARY KEY (player, cookie_id)
|
||||||
|
);
|
||||||
Binary file not shown.
@@ -0,0 +1,16 @@
|
|||||||
|
CREATE TABLE sm_cookies
|
||||||
|
(
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
name varchar(30) NOT NULL UNIQUE,
|
||||||
|
description varchar(255),
|
||||||
|
access INTEGER
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE sm_cookie_cache
|
||||||
|
(
|
||||||
|
player varchar(65) NOT NULL,
|
||||||
|
cookie_id int(10) NOT NULL,
|
||||||
|
value varchar(100),
|
||||||
|
timestamp int,
|
||||||
|
PRIMARY KEY (player, cookie_id)
|
||||||
|
);
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
+17
-2
@@ -162,8 +162,6 @@ private:
|
|||||||
|
|
||||||
c -= (unsigned)'a';
|
c -= (unsigned)'a';
|
||||||
|
|
||||||
assert(c >= 0 && c < 26);
|
|
||||||
|
|
||||||
if (!g_Admins.FindFlag(key, &g_FlagLetters[c]))
|
if (!g_Admins.FindFlag(key, &g_FlagLetters[c]))
|
||||||
{
|
{
|
||||||
ParseError(states, "Unrecognized admin level \"%s\"", key);
|
ParseError(states, "Unrecognized admin level \"%s\"", key);
|
||||||
@@ -1172,6 +1170,11 @@ bool AdminCache::GetMethodIndex(const char *name, unsigned int *_index)
|
|||||||
|
|
||||||
bool AdminCache::BindAdminIdentity(AdminId id, const char *auth, const char *ident)
|
bool AdminCache::BindAdminIdentity(AdminId id, const char *auth, const char *ident)
|
||||||
{
|
{
|
||||||
|
if (ident[0] == '\0')
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
AdminUser *pUser = (AdminUser *)m_pMemory->GetAddress(id);
|
AdminUser *pUser = (AdminUser *)m_pMemory->GetAddress(id);
|
||||||
if (!pUser || pUser->magic != USR_MAGIC_SET)
|
if (!pUser || pUser->magic != USR_MAGIC_SET)
|
||||||
{
|
{
|
||||||
@@ -1184,6 +1187,12 @@ bool AdminCache::BindAdminIdentity(AdminId id, const char *auth, const char *ide
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the id was a steam id strip off the STEAM_*: part */
|
||||||
|
if (strcmp(auth, "steam") == 0 && strncmp(ident, "STEAM_", 6) == 0)
|
||||||
|
{
|
||||||
|
ident += 8;
|
||||||
|
}
|
||||||
|
|
||||||
if (sm_trie_retrieve(pTable, ident, NULL))
|
if (sm_trie_retrieve(pTable, ident, NULL))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -1206,6 +1215,12 @@ AdminId AdminCache::FindAdminByIdentity(const char *auth, const char *identity)
|
|||||||
return INVALID_ADMIN_ID;
|
return INVALID_ADMIN_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the id was a steam id strip off the STEAM_*: part */
|
||||||
|
if (strcmp(auth, "steam") == 0 && strncmp(identity, "STEAM_", 6) == 0)
|
||||||
|
{
|
||||||
|
identity += 8;
|
||||||
|
}
|
||||||
|
|
||||||
void *object;
|
void *object;
|
||||||
if (!sm_trie_retrieve(pTable, identity, &object))
|
if (!sm_trie_retrieve(pTable, identity, &object))
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "CDataPack.h"
|
#include "CDataPack.h"
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
+13
-3
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <malloc.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
extern HandleType_t htCellArray;
|
extern HandleType_t htCellArray;
|
||||||
@@ -40,14 +40,17 @@ public:
|
|||||||
CellArray(size_t blocksize) : m_Data(NULL), m_BlockSize(blocksize), m_AllocSize(0), m_Size(0)
|
CellArray(size_t blocksize) : m_Data(NULL), m_BlockSize(blocksize), m_AllocSize(0), m_Size(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
~CellArray()
|
~CellArray()
|
||||||
{
|
{
|
||||||
free(m_Data);
|
free(m_Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size() const
|
size_t size() const
|
||||||
{
|
{
|
||||||
return m_Size;
|
return m_Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell_t *push()
|
cell_t *push()
|
||||||
{
|
{
|
||||||
if (!GrowIfNeeded(1))
|
if (!GrowIfNeeded(1))
|
||||||
@@ -58,18 +61,22 @@ public:
|
|||||||
m_Size++;
|
m_Size++;
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell_t *at(size_t b) const
|
cell_t *at(size_t b) const
|
||||||
{
|
{
|
||||||
return &m_Data[b * m_BlockSize];
|
return &m_Data[b * m_BlockSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t blocksize() const
|
size_t blocksize() const
|
||||||
{
|
{
|
||||||
return m_BlockSize;
|
return m_BlockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
m_Size = 0;
|
m_Size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool swap(size_t item1, size_t item2)
|
bool swap(size_t item1, size_t item2)
|
||||||
{
|
{
|
||||||
/* Make sure there is extra space available */
|
/* Make sure there is extra space available */
|
||||||
@@ -90,6 +97,7 @@ public:
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove(size_t index)
|
void remove(size_t index)
|
||||||
{
|
{
|
||||||
/* If we're at the end, take the easy way out */
|
/* If we're at the end, take the easy way out */
|
||||||
@@ -107,6 +115,7 @@ public:
|
|||||||
|
|
||||||
m_Size--;
|
m_Size--;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell_t *insert_at(size_t index)
|
cell_t *insert_at(size_t index)
|
||||||
{
|
{
|
||||||
/* Make sure it'll fit */
|
/* Make sure it'll fit */
|
||||||
@@ -124,6 +133,7 @@ public:
|
|||||||
|
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool resize(size_t count)
|
bool resize(size_t count)
|
||||||
{
|
{
|
||||||
if (count <= m_Size)
|
if (count <= m_Size)
|
||||||
@@ -132,7 +142,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!GrowIfNeeded(count - m_Size))
|
if (!GrowIfNeeded(count - m_Size))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
+15
-43
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
* While the OB build only runs on MM:S 1.6.0+ (SH 5+), the older one
|
* While the OB build only runs on MM:S 1.6.0+ (SH 5+), the older one
|
||||||
* can technically be compiled against any MM:S version after 1.4.2.
|
* can technically be compiled against any MM:S version after 1.4.2.
|
||||||
*/
|
*/
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
extern bool __SourceHook_FHRemoveConCommandDispatch(void *, bool, class fastdelegate::FastDelegate1<const CCommand &, void>);
|
extern bool __SourceHook_FHRemoveConCommandDispatch(void *, bool, class fastdelegate::FastDelegate1<const CCommand &, void>);
|
||||||
extern int __SourceHook_FHAddConCommandDispatch(void *, ISourceHook::AddHookMode, bool, class fastdelegate::FastDelegate1<const CCommand &, void>);
|
extern int __SourceHook_FHAddConCommandDispatch(void *, ISourceHook::AddHookMode, bool, class fastdelegate::FastDelegate1<const CCommand &, void>);
|
||||||
#else
|
#else
|
||||||
@@ -53,11 +53,10 @@ extern int __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate
|
|||||||
#elif SH_IMPL_VERSION == 3
|
#elif SH_IMPL_VERSION == 3
|
||||||
extern bool __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
|
extern bool __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
|
||||||
#endif //SH_IMPL_VERSION
|
#endif //SH_IMPL_VERSION
|
||||||
#endif //ORANGEBOX_BUILD
|
#endif //SE_ORANGEBOX
|
||||||
|
|
||||||
ChatTriggers g_ChatTriggers;
|
ChatTriggers g_ChatTriggers;
|
||||||
bool g_bSupressSilentFails = false;
|
bool g_bSupressSilentFails = false;
|
||||||
CPhraseFile *g_pFloodPhrases = NULL;
|
|
||||||
|
|
||||||
ChatTriggers::ChatTriggers() : m_pSayCmd(NULL), m_bWillProcessInPost(false),
|
ChatTriggers::ChatTriggers() : m_pSayCmd(NULL), m_bWillProcessInPost(false),
|
||||||
m_bTriggerWasSilent(false), m_ReplyTo(SM_REPLY_CONSOLE)
|
m_bTriggerWasSilent(false), m_ReplyTo(SM_REPLY_CONSOLE)
|
||||||
@@ -114,39 +113,13 @@ void ChatTriggers::OnSourceModAllInitialized()
|
|||||||
|
|
||||||
void ChatTriggers::OnSourceModAllInitialized_Post()
|
void ChatTriggers::OnSourceModAllInitialized_Post()
|
||||||
{
|
{
|
||||||
unsigned int file_id;
|
g_pCorePhrases->AddPhraseFile("antiflood.phrases");
|
||||||
|
|
||||||
file_id = g_Translator.FindOrAddPhraseFile("antiflood.phrases.txt");
|
|
||||||
g_pFloodPhrases = g_Translator.GetFileByIndex(file_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatTriggers::OnSourceModGameInitialized()
|
void ChatTriggers::OnSourceModGameInitialized()
|
||||||
{
|
{
|
||||||
unsigned int total = 2;
|
m_pSayCmd = FindCommand("say");
|
||||||
ConCommandBase *pCmd = icvar->GetCommands();
|
m_pSayTeamCmd = FindCommand("say_team");
|
||||||
const char *name;
|
|
||||||
while (pCmd)
|
|
||||||
{
|
|
||||||
if (pCmd->IsCommand())
|
|
||||||
{
|
|
||||||
name = pCmd->GetName();
|
|
||||||
if (!m_pSayCmd && strcmp(name, "say") == 0)
|
|
||||||
{
|
|
||||||
m_pSayCmd = (ConCommand *)pCmd;
|
|
||||||
if (--total == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (!m_pSayTeamCmd && strcmp(name, "say_team") == 0) {
|
|
||||||
m_pSayTeamCmd = (ConCommand *)pCmd;
|
|
||||||
if (--total == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pCmd = const_cast<ConCommandBase *>(pCmd->GetNext());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_pSayCmd)
|
if (m_pSayCmd)
|
||||||
{
|
{
|
||||||
@@ -177,7 +150,7 @@ void ChatTriggers::OnSourceModShutdown()
|
|||||||
g_Forwards.ReleaseForward(m_pDidFloodBlock);
|
g_Forwards.ReleaseForward(m_pDidFloodBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void ChatTriggers::OnSayCommand_Pre(const CCommand &command)
|
void ChatTriggers::OnSayCommand_Pre(const CCommand &command)
|
||||||
{
|
{
|
||||||
#else
|
#else
|
||||||
@@ -216,15 +189,14 @@ void ChatTriggers::OnSayCommand_Pre()
|
|||||||
{
|
{
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
|
|
||||||
/* :TODO: log an error? */
|
if (!CoreTranslate(
|
||||||
if (g_Translator.CoreTransEx(g_pFloodPhrases,
|
|
||||||
client,
|
|
||||||
buffer,
|
buffer,
|
||||||
sizeof(buffer),
|
sizeof(buffer),
|
||||||
"Flooding the server",
|
"%T",
|
||||||
|
2,
|
||||||
NULL,
|
NULL,
|
||||||
NULL)
|
"Flooding the server",
|
||||||
!= Trans_Okay)
|
&client))
|
||||||
{
|
{
|
||||||
UTIL_Format(buffer, sizeof(buffer), "You are flooding the server!");
|
UTIL_Format(buffer, sizeof(buffer), "You are flooding the server!");
|
||||||
}
|
}
|
||||||
@@ -272,7 +244,7 @@ void ChatTriggers::OnSayCommand_Pre()
|
|||||||
/**
|
/**
|
||||||
* Test if this is actually a command!
|
* Test if this is actually a command!
|
||||||
*/
|
*/
|
||||||
if (!PreProcessTrigger(engine->PEntityOfEntIndex(client), args, is_quoted))
|
if (!PreProcessTrigger(PEntityOfEntIndex(client), args, is_quoted))
|
||||||
{
|
{
|
||||||
CPlayer *pPlayer;
|
CPlayer *pPlayer;
|
||||||
if (is_silent
|
if (is_silent
|
||||||
@@ -304,7 +276,7 @@ void ChatTriggers::OnSayCommand_Pre()
|
|||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void ChatTriggers::OnSayCommand_Post(const CCommand &command)
|
void ChatTriggers::OnSayCommand_Post(const CCommand &command)
|
||||||
#else
|
#else
|
||||||
void ChatTriggers::OnSayCommand_Post()
|
void ChatTriggers::OnSayCommand_Post()
|
||||||
@@ -320,7 +292,7 @@ void ChatTriggers::OnSayCommand_Post()
|
|||||||
/* Execute the cached command */
|
/* Execute the cached command */
|
||||||
int client = g_ConCmds.GetCommandClient();
|
int client = g_ConCmds.GetCommandClient();
|
||||||
unsigned int old = SetReplyTo(SM_REPLY_CHAT);
|
unsigned int old = SetReplyTo(SM_REPLY_CHAT);
|
||||||
serverpluginhelpers->ClientCommand(engine->PEntityOfEntIndex(client), m_ToExecute);
|
serverpluginhelpers->ClientCommand(PEntityOfEntIndex(client), m_ToExecute);
|
||||||
SetReplyTo(old);
|
SetReplyTo(old);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -54,7 +54,7 @@ public: //SMGlobalClass
|
|||||||
char *error,
|
char *error,
|
||||||
size_t maxlength);
|
size_t maxlength);
|
||||||
private: //ConCommand
|
private: //ConCommand
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void OnSayCommand_Pre(const CCommand &command);
|
void OnSayCommand_Pre(const CCommand &command);
|
||||||
void OnSayCommand_Post(const CCommand &command);
|
void OnSayCommand_Post(const CCommand &command);
|
||||||
#else
|
#else
|
||||||
|
|||||||
+81
-52
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
ConCmdManager g_ConCmds;
|
ConCmdManager g_ConCmds;
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
SH_DECL_HOOK1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
SH_DECL_HOOK1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
||||||
#else
|
#else
|
||||||
SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||||
@@ -205,7 +205,7 @@ void ConCmdManager::OnPluginDestroyed(IPlugin *plugin)
|
|||||||
delete pList;
|
delete pList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void CommandCallback(const CCommand &command)
|
void CommandCallback(const CCommand &command)
|
||||||
{
|
{
|
||||||
#else
|
#else
|
||||||
@@ -229,46 +229,67 @@ void ConCmdManager::SetCommandClient(int client)
|
|||||||
ResultType ConCmdManager::DispatchClientCommand(int client, const char *cmd, int args, ResultType type)
|
ResultType ConCmdManager::DispatchClientCommand(int client, const char *cmd, int args, ResultType type)
|
||||||
{
|
{
|
||||||
ConCmdInfo *pInfo;
|
ConCmdInfo *pInfo;
|
||||||
if (sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
|
|
||||||
|
if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
|
||||||
{
|
{
|
||||||
cell_t result = type;
|
List<ConCmdInfo *>::iterator iter;
|
||||||
cell_t tempres = result;
|
|
||||||
List<CmdHook *>::iterator iter;
|
pInfo = NULL;
|
||||||
CmdHook *pHook;
|
iter = m_CmdList.begin();
|
||||||
for (iter=pInfo->conhooks.begin();
|
while (iter != m_CmdList.end())
|
||||||
iter!=pInfo->conhooks.end();
|
|
||||||
iter++)
|
|
||||||
{
|
{
|
||||||
pHook = (*iter);
|
if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
|
||||||
if (!pHook->pf->IsRunnable())
|
|
||||||
{
|
{
|
||||||
continue;
|
pInfo = (*iter);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (pHook->pAdmin && !CheckAccess(client, cmd, pHook->pAdmin))
|
iter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pInfo == NULL)
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_t result = type;
|
||||||
|
cell_t tempres = result;
|
||||||
|
List<CmdHook *>::iterator iter;
|
||||||
|
CmdHook *pHook;
|
||||||
|
for (iter=pInfo->conhooks.begin();
|
||||||
|
iter!=pInfo->conhooks.end();
|
||||||
|
iter++)
|
||||||
|
{
|
||||||
|
pHook = (*iter);
|
||||||
|
if (!pHook->pf->IsRunnable())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (pHook->pAdmin && !CheckAccess(client, cmd, pHook->pAdmin))
|
||||||
|
{
|
||||||
|
if (result < Pl_Handled)
|
||||||
{
|
{
|
||||||
if (result < Pl_Handled)
|
result = Pl_Handled;
|
||||||
{
|
|
||||||
result = Pl_Handled;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
pHook->pf->PushCell(client);
|
continue;
|
||||||
pHook->pf->PushCell(args);
|
}
|
||||||
if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
|
pHook->pf->PushCell(client);
|
||||||
|
pHook->pf->PushCell(args);
|
||||||
|
if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
if (tempres > result)
|
||||||
{
|
{
|
||||||
if (tempres > result)
|
result = tempres;
|
||||||
{
|
}
|
||||||
result = tempres;
|
if (result == Pl_Stop)
|
||||||
}
|
{
|
||||||
if (result == Pl_Stop)
|
break;
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
type = (ResultType)result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type = (ResultType)result;
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +317,32 @@ void ConCmdManager::InternalDispatch(const CCommand &command)
|
|||||||
ConCmdInfo *pInfo;
|
ConCmdInfo *pInfo;
|
||||||
if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
|
if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
|
||||||
{
|
{
|
||||||
return;
|
/* 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;
|
||||||
|
|
||||||
|
pInfo = NULL;
|
||||||
|
iter = m_CmdList.begin();
|
||||||
|
while (iter != m_CmdList.end())
|
||||||
|
{
|
||||||
|
if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
|
||||||
|
{
|
||||||
|
pInfo = (*iter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
iter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pInfo == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is a hack to prevent say triggers from firing on messages that were
|
/* This is a hack to prevent say triggers from firing on messages that were
|
||||||
@@ -490,12 +536,11 @@ bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmi
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
edict_t *pEdict = engine->PEntityOfEntIndex(client);
|
edict_t *pEdict = PEntityOfEntIndex(client);
|
||||||
|
|
||||||
/* If we got here, the command failed... */
|
/* If we got here, the command failed... */
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
if (g_Translator.CoreTrans(client, buffer, sizeof(buffer), "No Access", NULL, NULL)
|
if (!CoreTranslate(buffer, sizeof(buffer), "%T", 2, NULL, "No Access", &client))
|
||||||
!= Trans_Okay)
|
|
||||||
{
|
{
|
||||||
UTIL_Format(buffer, sizeof(buffer), "You do not have access to this command");
|
UTIL_Format(buffer, sizeof(buffer), "You do not have access to this command");
|
||||||
}
|
}
|
||||||
@@ -873,23 +918,7 @@ ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *descri
|
|||||||
{
|
{
|
||||||
pInfo = new ConCmdInfo();
|
pInfo = new ConCmdInfo();
|
||||||
/* Find the commandopan */
|
/* Find the commandopan */
|
||||||
ConCommandBase *pBase = icvar->GetCommands();
|
ConCommand *pCmd = FindCommand(name);
|
||||||
ConCommand *pCmd = NULL;
|
|
||||||
while (pBase)
|
|
||||||
{
|
|
||||||
if (strcmp(pBase->GetName(), name) == 0)
|
|
||||||
{
|
|
||||||
/* Don't want to return convar with same name */
|
|
||||||
if (!pBase->IsCommand())
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pCmd = (ConCommand *)pBase;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pCmd)
|
if (!pCmd)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -98,7 +98,7 @@ class ConCmdManager :
|
|||||||
public IPluginsListener,
|
public IPluginsListener,
|
||||||
public IConCommandTracker
|
public IConCommandTracker
|
||||||
{
|
{
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
friend void CommandCallback(const CCommand &command);
|
friend void CommandCallback(const CCommand &command);
|
||||||
#else
|
#else
|
||||||
friend void CommandCallback();
|
friend void CommandCallback();
|
||||||
|
|||||||
+21
-18
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -41,18 +41,20 @@
|
|||||||
|
|
||||||
ConVarManager g_ConVarManager;
|
ConVarManager g_ConVarManager;
|
||||||
|
|
||||||
#if !defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE <= SE_DARKMESSIAH
|
||||||
#define CallGlobalChangeCallbacks CallGlobalChangeCallback
|
#define CallGlobalChangeCallbacks CallGlobalChangeCallback
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
SH_DECL_HOOK3_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar *, const char *, float);
|
SH_DECL_HOOK3_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar *, const char *, float);
|
||||||
#else
|
#else
|
||||||
SH_DECL_HOOK2_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar *, const char *);
|
SH_DECL_HOOK2_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar *, const char *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
SH_DECL_HOOK5_void(IServerGameDLL, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *);
|
SH_DECL_HOOK5_void(IServerGameDLL, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *);
|
||||||
SH_DECL_HOOK5_void(IServerPluginCallbacks, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *);
|
SH_DECL_HOOK5_void(IServerPluginCallbacks, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *);
|
||||||
|
#endif
|
||||||
|
|
||||||
const ParamType CONVARCHANGE_PARAMS[] = {Param_Cell, Param_String, Param_String};
|
const ParamType CONVARCHANGE_PARAMS[] = {Param_Cell, Param_String, Param_String};
|
||||||
typedef List<const ConVar *> ConVarList;
|
typedef List<const ConVar *> ConVarList;
|
||||||
@@ -84,7 +86,7 @@ void ConVarManager::OnSourceModAllInitialized()
|
|||||||
/**
|
/**
|
||||||
* Episode 2 has this function by default, but the older versions do not.
|
* Episode 2 has this function by default, but the older versions do not.
|
||||||
*/
|
*/
|
||||||
#if !defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE == SE_EPISODEONE
|
||||||
if (g_SMAPI->GetGameDLLVersion() >= 6)
|
if (g_SMAPI->GetGameDLLVersion() >= 6)
|
||||||
{
|
{
|
||||||
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, OnQueryCvarValueFinished, gamedll, this, &ConVarManager::OnQueryCvarValueFinished, false);
|
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, OnQueryCvarValueFinished, gamedll, this, &ConVarManager::OnQueryCvarValueFinished, false);
|
||||||
@@ -141,6 +143,7 @@ void ConVarManager::OnSourceModShutdown()
|
|||||||
}
|
}
|
||||||
convar_cache.clear();
|
convar_cache.clear();
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
/* Unhook things */
|
/* Unhook things */
|
||||||
if (m_bIsDLLQueryHooked)
|
if (m_bIsDLLQueryHooked)
|
||||||
{
|
{
|
||||||
@@ -152,6 +155,7 @@ void ConVarManager::OnSourceModShutdown()
|
|||||||
SH_REMOVE_HOOK_MEMFUNC(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, this, &ConVarManager::OnQueryCvarValueFinished, false);
|
SH_REMOVE_HOOK_MEMFUNC(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, this, &ConVarManager::OnQueryCvarValueFinished, false);
|
||||||
m_bIsVSPQueryHooked = false;
|
m_bIsVSPQueryHooked = false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
SH_REMOVE_HOOK_STATICFUNC(ICvar, CallGlobalChangeCallbacks, icvar, OnConVarChanged, false);
|
SH_REMOVE_HOOK_STATICFUNC(ICvar, CallGlobalChangeCallbacks, icvar, OnConVarChanged, false);
|
||||||
|
|
||||||
@@ -189,8 +193,10 @@ void ConVarManager::OnSourceModVSPReceived()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
SH_ADD_HOOK_MEMFUNC(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, this, &ConVarManager::OnQueryCvarValueFinished, false);
|
SH_ADD_HOOK_MEMFUNC(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, this, &ConVarManager::OnQueryCvarValueFinished, false);
|
||||||
m_bIsVSPQueryHooked = true;
|
m_bIsVSPQueryHooked = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool convar_cache_lookup(const char *name, ConVarInfo **pVar)
|
bool convar_cache_lookup(const char *name, ConVarInfo **pVar)
|
||||||
@@ -359,17 +365,10 @@ Handle_t ConVarManager::CreateConVar(IPluginContext *pContext, const char *name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* To prevent creating a convar that has the same name as a console command... ugh */
|
/* Prevent creating a convar that has the same name as a console command */
|
||||||
ConCommandBase *pBase = icvar->GetCommands();
|
if (FindCommand(name))
|
||||||
|
|
||||||
while (pBase)
|
|
||||||
{
|
{
|
||||||
if (pBase->IsCommand() && strcmp(pBase->GetName(), name) == 0)
|
return BAD_HANDLE;
|
||||||
{
|
|
||||||
return BAD_HANDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create and initialize ConVarInfo structure */
|
/* Create and initialize ConVarInfo structure */
|
||||||
@@ -535,8 +534,9 @@ void ConVarManager::UnhookConVarChange(ConVar *pConVar, IPluginFunction *pFuncti
|
|||||||
|
|
||||||
QueryCvarCookie_t ConVarManager::QueryClientConVar(edict_t *pPlayer, const char *name, IPluginFunction *pCallback, Handle_t hndl)
|
QueryCvarCookie_t ConVarManager::QueryClientConVar(edict_t *pPlayer, const char *name, IPluginFunction *pCallback, Handle_t hndl)
|
||||||
{
|
{
|
||||||
QueryCvarCookie_t cookie;
|
QueryCvarCookie_t cookie = 0;
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
/* Call StartQueryCvarValue() in either the IVEngineServer or IServerPluginHelpers depending on situation */
|
/* Call StartQueryCvarValue() in either the IVEngineServer or IServerPluginHelpers depending on situation */
|
||||||
if (m_bIsDLLQueryHooked)
|
if (m_bIsDLLQueryHooked)
|
||||||
{
|
{
|
||||||
@@ -553,6 +553,7 @@ QueryCvarCookie_t ConVarManager::QueryClientConVar(edict_t *pPlayer, const char
|
|||||||
|
|
||||||
ConVarQuery query = {cookie, pCallback, hndl};
|
ConVarQuery query = {cookie, pCallback, hndl};
|
||||||
m_ConVarQueries.push_back(query);
|
m_ConVarQueries.push_back(query);
|
||||||
|
#endif
|
||||||
|
|
||||||
return cookie;
|
return cookie;
|
||||||
}
|
}
|
||||||
@@ -595,7 +596,7 @@ void ConVarManager::AddConVarToPluginList(IPluginContext *pContext, const ConVar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue)
|
void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue)
|
||||||
#else
|
#else
|
||||||
void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue)
|
void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue)
|
||||||
@@ -623,7 +624,7 @@ void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue)
|
|||||||
i != pInfo->changeListeners.end();
|
i != pInfo->changeListeners.end();
|
||||||
i++)
|
i++)
|
||||||
{
|
{
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
(*i)->OnConVarChanged(pConVar, oldValue, flOldValue);
|
(*i)->OnConVarChanged(pConVar, oldValue, flOldValue);
|
||||||
#else
|
#else
|
||||||
(*i)->OnConVarChanged(pConVar, oldValue, atof(oldValue));
|
(*i)->OnConVarChanged(pConVar, oldValue, atof(oldValue));
|
||||||
@@ -646,6 +647,7 @@ bool ConVarManager::IsQueryingSupported()
|
|||||||
return (m_bIsDLLQueryHooked || m_bIsVSPQueryHooked);
|
return (m_bIsDLLQueryHooked || m_bIsVSPQueryHooked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue)
|
void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue)
|
||||||
{
|
{
|
||||||
IPluginFunction *pCallback = NULL;
|
IPluginFunction *pCallback = NULL;
|
||||||
@@ -668,7 +670,7 @@ void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *
|
|||||||
cell_t ret;
|
cell_t ret;
|
||||||
|
|
||||||
pCallback->PushCell(cookie);
|
pCallback->PushCell(cookie);
|
||||||
pCallback->PushCell(engine->IndexOfEdict(pPlayer));
|
pCallback->PushCell(IndexOfEdict(pPlayer));
|
||||||
pCallback->PushCell(result);
|
pCallback->PushCell(result);
|
||||||
pCallback->PushString(cvarName);
|
pCallback->PushString(cvarName);
|
||||||
|
|
||||||
@@ -687,6 +689,7 @@ void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *
|
|||||||
m_ConVarQueries.erase(iter);
|
m_ConVarQueries.erase(iter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
HandleError ConVarManager::ReadConVarHandle(Handle_t hndl, ConVar **pVar)
|
HandleError ConVarManager::ReadConVarHandle(Handle_t hndl, ConVar **pVar)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -42,6 +42,11 @@
|
|||||||
#include <compat_wrappers.h>
|
#include <compat_wrappers.h>
|
||||||
#include "concmd_cleaner.h"
|
#include "concmd_cleaner.h"
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_DARKMESSIAH
|
||||||
|
class EQueryCvarValueStatus;
|
||||||
|
typedef int QueryCvarCookie_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace SourceHook;
|
using namespace SourceHook;
|
||||||
|
|
||||||
class IConVarChangeListener
|
class IConVarChangeListener
|
||||||
@@ -140,7 +145,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* Static callback that Valve's ConVar object executes when the convar's value changes.
|
* Static callback that Valve's ConVar object executes when the convar's value changes.
|
||||||
*/
|
*/
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
static void OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue);
|
static void OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue);
|
||||||
#else
|
#else
|
||||||
static void OnConVarChanged(ConVar *pConVar, const char *oldValue);
|
static void OnConVarChanged(ConVar *pConVar, const char *oldValue);
|
||||||
@@ -149,8 +154,10 @@ private:
|
|||||||
/**
|
/**
|
||||||
* Callback for when StartQueryCvarValue() has finished.
|
* Callback for when StartQueryCvarValue() has finished.
|
||||||
*/
|
*/
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
void OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result,
|
void OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result,
|
||||||
const char *cvarName, const char *cvarValue);
|
const char *cvarName, const char *cvarValue);
|
||||||
|
#endif
|
||||||
private:
|
private:
|
||||||
HandleType_t m_ConVarType;
|
HandleType_t m_ConVarType;
|
||||||
List<ConVarInfo *> m_ConVars;
|
List<ConVarInfo *> m_ConVars;
|
||||||
|
|||||||
+59
-29
@@ -40,10 +40,11 @@
|
|||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "PluginSys.h"
|
#include "PluginSys.h"
|
||||||
#include "ForwardSys.h"
|
#include "ForwardSys.h"
|
||||||
|
#include "frame_hooks.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
ConVar sm_corecfgfile("sm_corecfgfile", "addons\\sourcemod\\configs\\core.cfg", 0, "SourceMod core configuration file");
|
ConVar sm_corecfgfile("sm_corecfgfile", "addons\\sourcemod\\configs\\core.cfg", 0, "SourceMod core configuration file");
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||||
ConVar sm_corecfgfile("sm_corecfgfile", "addons/sourcemod/configs/core.cfg", 0, "SourceMod core configuration file");
|
ConVar sm_corecfgfile("sm_corecfgfile", "addons/sourcemod/configs/core.cfg", 0, "SourceMod core configuration file");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -60,30 +61,31 @@ ConVar *g_ServerCfgFile = NULL;
|
|||||||
|
|
||||||
void CheckAndFinalizeConfigs();
|
void CheckAndFinalizeConfigs();
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
||||||
void Hook_ExecDispatchPre(const CCommand &cmd)
|
void Hook_ExecDispatchPre(const CCommand &cmd)
|
||||||
|
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||||
|
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||||
|
void Hook_ExecDispatchPre()
|
||||||
#else
|
#else
|
||||||
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||||
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||||
void Hook_ExecDispatchPre()
|
void Hook_ExecDispatchPre()
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if !defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE <= SE_DARKMESSIAH
|
||||||
CCommand cmd;
|
CCommand cmd;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *arg = cmd.Arg(1);
|
const char *arg = cmd.Arg(1);
|
||||||
|
|
||||||
if (!g_bServerExecd
|
if (!g_bServerExecd && arg != NULL && strcmp(arg, g_ServerCfgFile->GetString()) == 0)
|
||||||
&& arg != NULL
|
|
||||||
&& strcmp(arg, g_ServerCfgFile->GetString()) == 0)
|
|
||||||
{
|
{
|
||||||
g_bGotTrigger = true;
|
g_bGotTrigger = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void Hook_ExecDispatchPost(const CCommand &cmd)
|
void Hook_ExecDispatchPost(const CCommand &cmd)
|
||||||
#else
|
#else
|
||||||
void Hook_ExecDispatchPost()
|
void Hook_ExecDispatchPost()
|
||||||
@@ -99,12 +101,13 @@ void Hook_ExecDispatchPost()
|
|||||||
|
|
||||||
void CheckAndFinalizeConfigs()
|
void CheckAndFinalizeConfigs()
|
||||||
{
|
{
|
||||||
if ((g_bServerExecd || g_ServerCfgFile == NULL)
|
if ((g_bServerExecd || g_ServerCfgFile == NULL) && g_bGotServerStart)
|
||||||
&& g_bGotServerStart)
|
|
||||||
{
|
{
|
||||||
/* Order is important here. We need to buffer things before we send the command out. */
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
g_pOnAutoConfigsBuffered->Execute(NULL);
|
g_PendingInternalPush = true;
|
||||||
engine->ServerCommand("sm internal 1\n");
|
#else
|
||||||
|
SM_InternalCmdTrigger();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,6 +119,14 @@ void CoreConfig::OnSourceModAllInitialized()
|
|||||||
g_pOnAutoConfigsBuffered = g_Forwards.CreateForward("OnAutoConfigsBuffered", ET_Ignore, 0, NULL);
|
g_pOnAutoConfigsBuffered = g_Forwards.CreateForward("OnAutoConfigsBuffered", ET_Ignore, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CoreConfig::CoreConfig() : m_Strings(512)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CoreConfig::~CoreConfig()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void CoreConfig::OnSourceModShutdown()
|
void CoreConfig::OnSourceModShutdown()
|
||||||
{
|
{
|
||||||
g_RootMenu.RemoveRootConsoleCommand("config", this);
|
g_RootMenu.RemoveRootConsoleCommand("config", this);
|
||||||
@@ -137,20 +148,18 @@ void CoreConfig::OnSourceModLevelChange(const char *mapName)
|
|||||||
|
|
||||||
if (!already_checked)
|
if (!already_checked)
|
||||||
{
|
{
|
||||||
g_ServerCfgFile = icvar->FindVar("servercfgfile");
|
if (engine->IsDedicatedServer())
|
||||||
|
{
|
||||||
|
g_ServerCfgFile = icvar->FindVar("servercfgfile");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_ServerCfgFile = icvar->FindVar("lservercfgfile");
|
||||||
|
}
|
||||||
|
|
||||||
if (g_ServerCfgFile != NULL)
|
if (g_ServerCfgFile != NULL)
|
||||||
{
|
{
|
||||||
ConCommandBase *pBase = icvar->GetCommands();
|
g_pExecPtr = FindCommand("exec");
|
||||||
while (pBase != NULL)
|
|
||||||
{
|
|
||||||
if (pBase->IsCommand() && strcmp(pBase->GetName(), "exec") == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
|
|
||||||
}
|
|
||||||
|
|
||||||
g_pExecPtr = (ConCommand *)pBase;
|
|
||||||
if (g_pExecPtr != NULL)
|
if (g_pExecPtr != NULL)
|
||||||
{
|
{
|
||||||
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, g_pExecPtr, Hook_ExecDispatchPre, false);
|
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, g_pExecPtr, Hook_ExecDispatchPre, false);
|
||||||
@@ -214,6 +223,10 @@ void CoreConfig::Initialize()
|
|||||||
/* Format path to config file */
|
/* Format path to config file */
|
||||||
g_LibSys.PathFormat(filePath, sizeof(filePath), "%s/%s", g_SourceMod.GetGamePath(), corecfg);
|
g_LibSys.PathFormat(filePath, sizeof(filePath), "%s/%s", g_SourceMod.GetGamePath(), corecfg);
|
||||||
|
|
||||||
|
/* Reset cached key values */
|
||||||
|
m_KeyValues.clear();
|
||||||
|
m_Strings.Reset();
|
||||||
|
|
||||||
/* Parse config file */
|
/* Parse config file */
|
||||||
if ((err=textparsers->ParseFile_SMC(filePath, this, NULL)) != SMCError_Okay)
|
if ((err=textparsers->ParseFile_SMC(filePath, this, NULL)) != SMCError_Okay)
|
||||||
{
|
{
|
||||||
@@ -252,9 +265,21 @@ ConfigResult CoreConfig::SetConfigOption(const char *option, const char *value,
|
|||||||
pBase = pBase->m_pGlobalClassNext;
|
pBase = pBase->m_pGlobalClassNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_KeyValues.replace(option, m_Strings.AddString(value));
|
||||||
|
|
||||||
return ConfigResult_Ignore;
|
return ConfigResult_Ignore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *CoreConfig::GetCoreConfigValue(const char *key)
|
||||||
|
{
|
||||||
|
int *pKey = m_KeyValues.retrieve(key);
|
||||||
|
if (pKey == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return m_Strings.GetString(*pKey);
|
||||||
|
}
|
||||||
|
|
||||||
bool SM_AreConfigsExecuted()
|
bool SM_AreConfigsExecuted()
|
||||||
{
|
{
|
||||||
return g_bConfigsExecd;
|
return g_bConfigsExecd;
|
||||||
@@ -264,7 +289,7 @@ inline bool IsPathSepChar(char c)
|
|||||||
{
|
{
|
||||||
#if defined PLATFORM_WINDOWS
|
#if defined PLATFORM_WINDOWS
|
||||||
return (c == '\\' || c == '/');
|
return (c == '\\' || c == '/');
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_LINUX || defined PLATFORM_POSIX
|
||||||
return (c == '/');
|
return (c == '/');
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -502,10 +527,6 @@ void SM_ExecuteAllConfigs()
|
|||||||
}
|
}
|
||||||
iter->Release();
|
iter->Release();
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
|
||||||
engine->ServerExecute();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_bGotServerStart = true;
|
g_bGotServerStart = true;
|
||||||
CheckAndFinalizeConfigs();
|
CheckAndFinalizeConfigs();
|
||||||
}
|
}
|
||||||
@@ -522,3 +543,12 @@ void SM_ConfigsExecuted_Global()
|
|||||||
g_pOnServerCfg->Execute(NULL);
|
g_pOnServerCfg->Execute(NULL);
|
||||||
g_pOnConfigsExecuted->Execute(NULL);
|
g_pOnConfigsExecuted->Execute(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SM_InternalCmdTrigger()
|
||||||
|
{
|
||||||
|
/* Order is important here. We need to buffer things before we send the command out. */
|
||||||
|
g_pOnAutoConfigsBuffered->Execute(NULL);
|
||||||
|
engine->ServerCommand("sm internal 1\n");
|
||||||
|
g_PendingInternalPush = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -35,6 +35,8 @@
|
|||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include <ITextParsers.h>
|
#include <ITextParsers.h>
|
||||||
#include <IRootConsoleMenu.h>
|
#include <IRootConsoleMenu.h>
|
||||||
|
#include <sm_trie_tpl.h>
|
||||||
|
#include "sm_memtable.h"
|
||||||
|
|
||||||
using namespace SourceMod;
|
using namespace SourceMod;
|
||||||
|
|
||||||
@@ -43,6 +45,9 @@ class CoreConfig :
|
|||||||
public ITextListener_SMC,
|
public ITextListener_SMC,
|
||||||
public IRootConsoleCommand
|
public IRootConsoleCommand
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
CoreConfig();
|
||||||
|
~CoreConfig();
|
||||||
public: // SMGlobalClass
|
public: // SMGlobalClass
|
||||||
void OnSourceModAllInitialized();
|
void OnSourceModAllInitialized();
|
||||||
void OnSourceModShutdown();
|
void OnSourceModShutdown();
|
||||||
@@ -56,11 +61,15 @@ public:
|
|||||||
* Initializes CoreConfig by reading from core.cfg file
|
* Initializes CoreConfig by reading from core.cfg file
|
||||||
*/
|
*/
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
const char *GetCoreConfigValue(const char *key);
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Sets configuration option by notifying SourceMod components that rely on core.cfg
|
* Sets configuration option by notifying SourceMod components that rely on core.cfg
|
||||||
*/
|
*/
|
||||||
ConfigResult SetConfigOption(const char *option, const char *value, ConfigSource, char *Error, size_t maxlength);
|
ConfigResult SetConfigOption(const char *option, const char *value, ConfigSource, char *Error, size_t maxlength);
|
||||||
|
private:
|
||||||
|
BaseStringTable m_Strings;
|
||||||
|
KTrie<int> m_KeyValues;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern bool SM_AreConfigsExecuted();
|
extern bool SM_AreConfigsExecuted();
|
||||||
@@ -68,6 +77,7 @@ extern void SM_ExecuteAllConfigs();
|
|||||||
extern void SM_ExecuteForPlugin(IPluginContext *ctx);
|
extern void SM_ExecuteForPlugin(IPluginContext *ctx);
|
||||||
extern void SM_ConfigsExecuted_Global();
|
extern void SM_ConfigsExecuted_Global();
|
||||||
extern void SM_ConfigsExecuted_Plugin(unsigned int serial);
|
extern void SM_ConfigsExecuted_Plugin(unsigned int serial);
|
||||||
|
extern void SM_InternalCmdTrigger();
|
||||||
|
|
||||||
extern CoreConfig g_CoreConfig;
|
extern CoreConfig g_CoreConfig;
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -717,3 +717,9 @@ const char *DBManager::GetDefaultDriverName()
|
|||||||
{
|
{
|
||||||
return m_DefDriver.c_str();
|
return m_DefDriver.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DBManager::AddDependency(IExtension *myself, IDBDriver *driver)
|
||||||
|
{
|
||||||
|
g_Extensions.AddRawDependency(myself, driver->GetIdentity(), driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -92,6 +92,7 @@ public: //IDBManager
|
|||||||
Handle_t CreateHandle(DBHandleType type, void *ptr, IdentityToken_t *pToken);
|
Handle_t CreateHandle(DBHandleType type, void *ptr, IdentityToken_t *pToken);
|
||||||
HandleError ReadHandle(Handle_t hndl, DBHandleType type, void **ptr);
|
HandleError ReadHandle(Handle_t hndl, DBHandleType type, void **ptr);
|
||||||
HandleError ReleaseHandle(Handle_t hndl, DBHandleType type, IdentityToken_t *token);
|
HandleError ReleaseHandle(Handle_t hndl, DBHandleType type, IdentityToken_t *token);
|
||||||
|
void AddDependency(IExtension *myself, IDBDriver *driver);
|
||||||
public: //ITextListener_SMC
|
public: //ITextListener_SMC
|
||||||
void ReadSMC_ParseStart();
|
void ReadSMC_ParseStart();
|
||||||
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
|
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
|
||||||
|
|||||||
+16
-9
@@ -36,16 +36,23 @@
|
|||||||
|
|
||||||
DebugReport g_DbgReporter;
|
DebugReport g_DbgReporter;
|
||||||
|
|
||||||
/* I'm really lazy. This should probably be exported to ISourcePawnEngine someday,
|
|
||||||
* but we need to make sure the JIT will deal with the version bump.
|
|
||||||
*/
|
|
||||||
extern const char *GetSourcePawnErrorMessage(int error);
|
|
||||||
|
|
||||||
void DebugReport::OnSourceModAllInitialized()
|
void DebugReport::OnSourceModAllInitialized()
|
||||||
{
|
{
|
||||||
g_pSourcePawn->SetDebugListener(this);
|
g_pSourcePawn->SetDebugListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebugReport::OnDebugSpew(const char *msg, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
char buffer[512];
|
||||||
|
|
||||||
|
va_start(ap, msg);
|
||||||
|
UTIL_FormatArgs(buffer, sizeof(buffer), msg, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
g_Logger.LogMessage("[SM] %s", buffer);
|
||||||
|
}
|
||||||
|
|
||||||
void DebugReport::GenerateError(IPluginContext *ctx, cell_t func_idx, int err, const char *message, ...)
|
void DebugReport::GenerateError(IPluginContext *ctx, cell_t func_idx, int err, const char *message, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@@ -56,7 +63,7 @@ void DebugReport::GenerateError(IPluginContext *ctx, cell_t func_idx, int err, c
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
const char *plname = g_PluginSys.FindPluginByContext(ctx->GetContext())->GetFilename();
|
const char *plname = g_PluginSys.FindPluginByContext(ctx->GetContext())->GetFilename();
|
||||||
const char *error = GetSourcePawnErrorMessage(err);
|
const char *error = g_pSourcePawn2->GetErrorString(err);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
@@ -73,7 +80,7 @@ void DebugReport::GenerateError(IPluginContext *ctx, cell_t func_idx, int err, c
|
|||||||
{
|
{
|
||||||
func_idx >>= 1;
|
func_idx >>= 1;
|
||||||
sp_public_t *function;
|
sp_public_t *function;
|
||||||
if (ctx->GetPublicByIndex(func_idx, &function) == SP_ERROR_NONE)
|
if (ctx->GetRuntime()->GetPublicByIndex(func_idx, &function) == SP_ERROR_NONE)
|
||||||
{
|
{
|
||||||
g_Logger.LogError("[SM] Unable to call function \"%s\" due to above error(s).", function->name);
|
g_Logger.LogError("[SM] Unable to call function \"%s\" due to above error(s).", function->name);
|
||||||
}
|
}
|
||||||
@@ -91,7 +98,7 @@ void DebugReport::GenerateCodeError(IPluginContext *pContext, uint32_t code_addr
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
const char *plname = g_PluginSys.FindPluginByContext(pContext->GetContext())->GetFilename();
|
const char *plname = g_PluginSys.FindPluginByContext(pContext->GetContext())->GetFilename();
|
||||||
const char *error = GetSourcePawnErrorMessage(err);
|
const char *error = g_pSourcePawn2->GetErrorString(err);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
@@ -103,7 +110,7 @@ void DebugReport::GenerateCodeError(IPluginContext *pContext, uint32_t code_addr
|
|||||||
g_Logger.LogError("[SM] %s", buffer);
|
g_Logger.LogError("[SM] %s", buffer);
|
||||||
|
|
||||||
IPluginDebugInfo *pDebug;
|
IPluginDebugInfo *pDebug;
|
||||||
if ((pDebug = pContext->GetDebugInfo()) == NULL)
|
if ((pDebug = pContext->GetRuntime()->GetDebugInfo()) == NULL)
|
||||||
{
|
{
|
||||||
g_Logger.LogError("[SM] Debug mode is not enabled for \"%s\"", plname);
|
g_Logger.LogError("[SM] Debug mode is not enabled for \"%s\"", plname);
|
||||||
g_Logger.LogError("[SM] To enable debug mode, edit plugin_settings.cfg, or type: sm plugins debug %d on",
|
g_Logger.LogError("[SM] To enable debug mode, edit plugin_settings.cfg, or type: sm plugins debug %d on",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -43,6 +43,8 @@ public: // SMGlobalClass
|
|||||||
void OnSourceModAllInitialized();
|
void OnSourceModAllInitialized();
|
||||||
public: // IDebugListener
|
public: // IDebugListener
|
||||||
void OnContextExecuteError(IPluginContext *ctx, IContextTrace *error);
|
void OnContextExecuteError(IPluginContext *ctx, IContextTrace *error);
|
||||||
|
void OnDebugSpew(const char *msg, ...);
|
||||||
|
public:
|
||||||
void GenerateError(IPluginContext *ctx, cell_t func_idx, int err, const char *message, ...);
|
void GenerateError(IPluginContext *ctx, cell_t func_idx, int err, const char *message, ...);
|
||||||
void GenerateCodeError(IPluginContext *ctx, uint32_t code_addr, int err, const char *message, ...);
|
void GenerateCodeError(IPluginContext *ctx, uint32_t code_addr, int err, const char *message, ...);
|
||||||
private:
|
private:
|
||||||
|
|||||||
+40
-18
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -193,6 +193,9 @@ EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunct
|
|||||||
pHook->pPostHook->AddFunction(pFunction);
|
pHook->pPostHook->AddFunction(pFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Cache the name for post hooks */
|
||||||
|
pHook->name = sm_strdup(name);
|
||||||
|
|
||||||
/* Increase reference count */
|
/* Increase reference count */
|
||||||
pHook->refCount++;
|
pHook->refCount++;
|
||||||
|
|
||||||
@@ -296,6 +299,9 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun
|
|||||||
/* Delete entry in trie */
|
/* Delete entry in trie */
|
||||||
sm_trie_delete(m_EventHooks, name);
|
sm_trie_delete(m_EventHooks, name);
|
||||||
|
|
||||||
|
/* Free the cached name */
|
||||||
|
delete pHook->name;
|
||||||
|
|
||||||
/* And finally free structure memory */
|
/* And finally free structure memory */
|
||||||
delete pHook;
|
delete pHook;
|
||||||
}
|
}
|
||||||
@@ -366,32 +372,35 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
|
|||||||
RETURN_META_VALUE(MRES_IGNORED, false);
|
RETURN_META_VALUE(MRES_IGNORED, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the event name, we're going to need this for passing to post hooks */
|
|
||||||
name = pEvent->GetName();
|
name = pEvent->GetName();
|
||||||
|
|
||||||
m_EventNames.push(name);
|
|
||||||
|
|
||||||
if (sm_trie_retrieve(m_EventHooks, name, reinterpret_cast<void **>(&pHook)))
|
if (sm_trie_retrieve(m_EventHooks, name, reinterpret_cast<void **>(&pHook)))
|
||||||
{
|
{
|
||||||
|
/* Push the event onto the event stack. The reference count is increased to make sure
|
||||||
|
* the structure is not garbage collected in between now and the post hook.
|
||||||
|
*/
|
||||||
|
pHook->refCount++;
|
||||||
|
m_EventStack.push(pHook);
|
||||||
|
|
||||||
pForward = pHook->pPreHook;
|
pForward = pHook->pPreHook;
|
||||||
|
|
||||||
if (pForward)
|
if (pForward)
|
||||||
{
|
{
|
||||||
EventInfo info = { pEvent, NULL };
|
EventInfo info(pEvent, NULL);
|
||||||
|
HandleSecurity sec(NULL, g_pCoreIdent);
|
||||||
Handle_t hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
|
Handle_t hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
|
||||||
|
|
||||||
pForward->PushCell(hndl);
|
pForward->PushCell(hndl);
|
||||||
pForward->PushString(name);
|
pForward->PushString(name);
|
||||||
pForward->PushCell(bDontBroadcast);
|
pForward->PushCell(bDontBroadcast);
|
||||||
pForward->Execute(&res, NULL);
|
pForward->Execute(&res, NULL);
|
||||||
|
|
||||||
HandleSecurity sec(NULL, g_pCoreIdent);
|
|
||||||
g_HandleSys.FreeHandle(hndl, &sec);
|
g_HandleSys.FreeHandle(hndl, &sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pHook->postCopy)
|
if (pHook->postCopy)
|
||||||
{
|
{
|
||||||
pHook->pEventCopy = gameevents->DuplicateEvent(pEvent);
|
m_EventCopies.push(gameevents->DuplicateEvent(pEvent));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
@@ -400,6 +409,10 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
|
|||||||
RETURN_META_VALUE(MRES_SUPERCEDE, false);
|
RETURN_META_VALUE(MRES_SUPERCEDE, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_EventStack.push(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
RETURN_META_VALUE(MRES_IGNORED, true);
|
RETURN_META_VALUE(MRES_IGNORED, true);
|
||||||
}
|
}
|
||||||
@@ -407,10 +420,9 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
|
|||||||
/* IGameEventManager2::FireEvent post hook */
|
/* IGameEventManager2::FireEvent post hook */
|
||||||
bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
||||||
{
|
{
|
||||||
IGameEvent *pEventCopy = NULL;
|
|
||||||
EventHook *pHook;
|
EventHook *pHook;
|
||||||
|
EventInfo info;
|
||||||
IChangeableForward *pForward;
|
IChangeableForward *pForward;
|
||||||
const char *name;
|
|
||||||
Handle_t hndl = 0;
|
Handle_t hndl = 0;
|
||||||
|
|
||||||
/* The engine accepts NULL without crashing, so to prevent a crash in SM we ignore these */
|
/* The engine accepts NULL without crashing, so to prevent a crash in SM we ignore these */
|
||||||
@@ -419,18 +431,18 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
|||||||
RETURN_META_VALUE(MRES_IGNORED, false);
|
RETURN_META_VALUE(MRES_IGNORED, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
name = m_EventNames.front();
|
pHook = m_EventStack.front();
|
||||||
|
|
||||||
if (sm_trie_retrieve(m_EventHooks, name, reinterpret_cast<void **>(&pHook)))
|
if (pHook != NULL)
|
||||||
{
|
{
|
||||||
pForward = pHook->pPostHook;
|
pForward = pHook->pPostHook;
|
||||||
|
|
||||||
if (pForward)
|
if (pForward)
|
||||||
{
|
{
|
||||||
EventInfo info = { pHook->pEventCopy, NULL };
|
|
||||||
|
|
||||||
if (pHook->postCopy)
|
if (pHook->postCopy)
|
||||||
{
|
{
|
||||||
|
info.pEvent = m_EventCopies.front();
|
||||||
|
info.pOwner = NULL;
|
||||||
hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
|
hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
|
||||||
|
|
||||||
pForward->PushCell(hndl);
|
pForward->PushCell(hndl);
|
||||||
@@ -438,7 +450,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
|||||||
pForward->PushCell(BAD_HANDLE);
|
pForward->PushCell(BAD_HANDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
pForward->PushString(name);
|
pForward->PushString(pHook->name);
|
||||||
pForward->PushCell(bDontBroadcast);
|
pForward->PushCell(bDontBroadcast);
|
||||||
pForward->Execute(NULL);
|
pForward->Execute(NULL);
|
||||||
|
|
||||||
@@ -449,13 +461,23 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
|
|||||||
g_HandleSys.FreeHandle(hndl, &sec);
|
g_HandleSys.FreeHandle(hndl, &sec);
|
||||||
|
|
||||||
/* Free event structure */
|
/* Free event structure */
|
||||||
gameevents->FreeEvent(pEventCopy);
|
gameevents->FreeEvent(info.pEvent);
|
||||||
pHook->pEventCopy = NULL;
|
m_EventCopies.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Decrement reference count, check if a delayed delete is needed */
|
||||||
|
if (--pHook->refCount == 0)
|
||||||
|
{
|
||||||
|
assert(pHook->pPostHook == NULL);
|
||||||
|
assert(pHook->pPreHook == NULL);
|
||||||
|
sm_trie_delete(m_EventHooks, pHook->name);
|
||||||
|
delete pHook->name;
|
||||||
|
delete pHook;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_EventNames.pop();
|
m_EventStack.pop();
|
||||||
|
|
||||||
RETURN_META_VALUE(MRES_IGNORED, true);
|
RETURN_META_VALUE(MRES_IGNORED, true);
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-4
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -45,6 +45,12 @@ using namespace SourceHook;
|
|||||||
|
|
||||||
struct EventInfo
|
struct EventInfo
|
||||||
{
|
{
|
||||||
|
EventInfo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
EventInfo(IGameEvent *ev, IdentityToken_t *owner) : pEvent(ev), pOwner(owner)
|
||||||
|
{
|
||||||
|
}
|
||||||
IGameEvent *pEvent;
|
IGameEvent *pEvent;
|
||||||
IdentityToken_t *pOwner;
|
IdentityToken_t *pOwner;
|
||||||
};
|
};
|
||||||
@@ -56,14 +62,13 @@ struct EventHook
|
|||||||
pPreHook = NULL;
|
pPreHook = NULL;
|
||||||
pPostHook = NULL;
|
pPostHook = NULL;
|
||||||
postCopy = false;
|
postCopy = false;
|
||||||
pEventCopy = NULL;
|
|
||||||
refCount = 0;
|
refCount = 0;
|
||||||
}
|
}
|
||||||
IChangeableForward *pPreHook;
|
IChangeableForward *pPreHook;
|
||||||
IChangeableForward *pPostHook;
|
IChangeableForward *pPostHook;
|
||||||
bool postCopy;
|
bool postCopy;
|
||||||
IGameEvent *pEventCopy;
|
|
||||||
unsigned int refCount;
|
unsigned int refCount;
|
||||||
|
char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EventHookMode
|
enum EventHookMode
|
||||||
@@ -120,7 +125,8 @@ private:
|
|||||||
HandleType_t m_EventType;
|
HandleType_t m_EventType;
|
||||||
Trie *m_EventHooks;
|
Trie *m_EventHooks;
|
||||||
CStack<EventInfo *> m_FreeEvents;
|
CStack<EventInfo *> m_FreeEvents;
|
||||||
CStack<const char *> m_EventNames;
|
CStack<EventHook *> m_EventStack;
|
||||||
|
CStack<IGameEvent *> m_EventCopies;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EventManager g_EventManager;
|
extern EventManager g_EventManager;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* vim: set ts=4 :
|
* vim: set ts=4 sw=4 tw=99 noet :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -49,6 +49,9 @@ void CExtension::Initialize(const char *filename, const char *path)
|
|||||||
m_bFullyLoaded = false;
|
m_bFullyLoaded = false;
|
||||||
m_File.assign(filename);
|
m_File.assign(filename);
|
||||||
m_Path.assign(path);
|
m_Path.assign(path);
|
||||||
|
char real_name[PLATFORM_MAX_PATH];
|
||||||
|
g_LibSys.GetFileFromPath(real_name, sizeof(real_name), m_Path.c_str());
|
||||||
|
m_RealFile.assign(real_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filename, const char *path)
|
CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filename, const char *path)
|
||||||
@@ -57,6 +60,22 @@ CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filena
|
|||||||
m_pAPI = pAPI;
|
m_pAPI = pAPI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
#define GAMEFIX "2.l4d"
|
||||||
|
#elif SOURCE_ENGINE == SE_ORANGEBOX
|
||||||
|
#define GAMEFIX "2.ep2"
|
||||||
|
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
||||||
|
#define GAMEFIX "2.ep2v"
|
||||||
|
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||||
|
#define GAMEFIX "2.darkm"
|
||||||
|
#else
|
||||||
|
#define GAMEFIX "2.ep1"
|
||||||
|
#endif //SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
#else //METAMOD_PLAPI_VERSION
|
||||||
|
#define GAMEFIX "1.ep1"
|
||||||
|
#endif //METAMOD_PLAPI_VERSION
|
||||||
|
|
||||||
CLocalExtension::CLocalExtension(const char *filename)
|
CLocalExtension::CLocalExtension(const char *filename)
|
||||||
{
|
{
|
||||||
m_PlId = 0;
|
m_PlId = 0;
|
||||||
@@ -64,27 +83,36 @@ CLocalExtension::CLocalExtension(const char *filename)
|
|||||||
|
|
||||||
char path[PLATFORM_MAX_PATH];
|
char path[PLATFORM_MAX_PATH];
|
||||||
|
|
||||||
|
/* Zeroth, see if there is an engine specific build in the new place. */
|
||||||
|
g_SourceMod.BuildPath(Path_SM,
|
||||||
|
path,
|
||||||
|
PLATFORM_MAX_PATH,
|
||||||
|
"extensions/%s." GAMEFIX "." PLATFORM_LIB_EXT,
|
||||||
|
filename);
|
||||||
|
|
||||||
|
if (g_LibSys.IsPathFile(path))
|
||||||
|
{
|
||||||
|
goto found;
|
||||||
|
}
|
||||||
|
|
||||||
/* First see if there is an engine specific build! */
|
/* First see if there is an engine specific build! */
|
||||||
g_SourceMod.BuildPath(Path_SM,
|
g_SourceMod.BuildPath(Path_SM,
|
||||||
path,
|
path,
|
||||||
PLATFORM_MAX_PATH,
|
PLATFORM_MAX_PATH,
|
||||||
#if defined METAMOD_PLAPI_VERSION
|
"extensions/auto." GAMEFIX "/%s." PLATFORM_LIB_EXT,
|
||||||
#if defined ORANGEBOX_BUILD
|
|
||||||
"extensions/auto.2.ep2/%s",
|
|
||||||
#else
|
|
||||||
"extensions/auto.2.ep1/%s",
|
|
||||||
#endif //ORANGEBOX_BUILD
|
|
||||||
#else //METAMOD_PLAPI_VERSION
|
|
||||||
"extensions/auto.1.ep1/%s",
|
|
||||||
#endif //METAMOD_PLAPI_VERSION
|
|
||||||
filename);
|
filename);
|
||||||
|
|
||||||
/* Try the "normal" version */
|
/* Try the "normal" version */
|
||||||
if (!g_LibSys.IsPathFile(path))
|
if (!g_LibSys.IsPathFile(path))
|
||||||
{
|
{
|
||||||
g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "extensions/%s", filename);
|
g_SourceMod.BuildPath(Path_SM,
|
||||||
|
path,
|
||||||
|
PLATFORM_MAX_PATH,
|
||||||
|
"extensions/%s." PLATFORM_LIB_EXT,
|
||||||
|
filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
found:
|
||||||
Initialize(filename, path);
|
Initialize(filename, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,6 +211,23 @@ void CLocalExtension::Unload()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CRemoteExtension::Reload(char *error, size_t maxlength)
|
||||||
|
{
|
||||||
|
snprintf(error, maxlength, "Remote extensions do not support reloading");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CLocalExtension::Reload(char *error, size_t maxlength)
|
||||||
|
{
|
||||||
|
if (m_pLib == NULL) // FIXME: just load it instead?
|
||||||
|
return false;
|
||||||
|
|
||||||
|
m_pAPI->OnExtensionUnload();
|
||||||
|
Unload();
|
||||||
|
|
||||||
|
return Load(error, maxlength);
|
||||||
|
}
|
||||||
|
|
||||||
bool CRemoteExtension::IsExternal()
|
bool CRemoteExtension::IsExternal()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -266,43 +311,12 @@ void CExtension::MarkAllLoaded()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CExtension::AddPlugin(IPlugin *pPlugin)
|
void CExtension::AddPlugin(CPlugin *pPlugin)
|
||||||
{
|
{
|
||||||
/* Unfortunately we have to do this :( */
|
/* Unfortunately we have to do this :( */
|
||||||
if (m_Plugins.find(pPlugin) != m_Plugins.end())
|
if (m_Dependents.find(pPlugin) != m_Dependents.end())
|
||||||
{
|
{
|
||||||
m_Plugins.push_back(pPlugin);
|
m_Dependents.push_back(pPlugin);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CExtension::RemovePlugin(IPlugin *pPlugin)
|
|
||||||
{
|
|
||||||
m_Plugins.remove(pPlugin);
|
|
||||||
|
|
||||||
List<WeakNative>::iterator iter = m_WeakNatives.begin();
|
|
||||||
while (iter != m_WeakNatives.end())
|
|
||||||
{
|
|
||||||
if ((*iter).pl == pPlugin)
|
|
||||||
{
|
|
||||||
iter = m_WeakNatives.erase(iter);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
iter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
iter = m_ReplacedNatives.begin();
|
|
||||||
while (iter != m_ReplacedNatives.end())
|
|
||||||
{
|
|
||||||
if ((*iter).pl == pPlugin)
|
|
||||||
{
|
|
||||||
iter = m_ReplacedNatives.erase(iter);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
iter++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,7 +332,7 @@ IExtensionInterface *CExtension::GetAPI()
|
|||||||
|
|
||||||
const char *CExtension::GetFilename()
|
const char *CExtension::GetFilename()
|
||||||
{
|
{
|
||||||
return m_File.c_str();
|
return m_RealFile.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
IdentityToken_t *CExtension::GetIdentity()
|
IdentityToken_t *CExtension::GetIdentity()
|
||||||
@@ -336,7 +350,7 @@ bool CLocalExtension::IsLoaded()
|
|||||||
return (m_pLib != NULL);
|
return (m_pLib != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CExtension::AddDependency(IfaceInfo *pInfo)
|
void CExtension::AddDependency(const IfaceInfo *pInfo)
|
||||||
{
|
{
|
||||||
if (m_Deps.find(*pInfo) == m_Deps.end())
|
if (m_Deps.find(*pInfo) == m_Deps.end())
|
||||||
{
|
{
|
||||||
@@ -521,7 +535,7 @@ void CExtensionManager::TryAutoload()
|
|||||||
|
|
||||||
char file[PLATFORM_MAX_PATH];
|
char file[PLATFORM_MAX_PATH];
|
||||||
len = UTIL_Format(file, sizeof(file), "%s", lfile);
|
len = UTIL_Format(file, sizeof(file), "%s", lfile);
|
||||||
strcpy(&file[len - 9], ".ext." PLATFORM_LIB_EXT);
|
strcpy(&file[len - 9], ".ext");
|
||||||
|
|
||||||
LoadAutoExtension(file);
|
LoadAutoExtension(file);
|
||||||
|
|
||||||
@@ -531,11 +545,14 @@ void CExtensionManager::TryAutoload()
|
|||||||
|
|
||||||
IExtension *CExtensionManager::LoadAutoExtension(const char *path)
|
IExtension *CExtensionManager::LoadAutoExtension(const char *path)
|
||||||
{
|
{
|
||||||
if (!strstr(path, "." PLATFORM_LIB_EXT))
|
/* Remove platform extension if it's there. Compat hack. */
|
||||||
|
const char *ext = g_LibSys.GetFileExtension(path);
|
||||||
|
if (strcmp(ext, PLATFORM_LIB_EXT) == 0)
|
||||||
{
|
{
|
||||||
char newpath[PLATFORM_MAX_PATH];
|
char path2[PLATFORM_MAX_PATH];
|
||||||
g_LibSys.PathFormat(newpath, sizeof(newpath), "%s.%s", path, PLATFORM_LIB_EXT);
|
UTIL_Format(path2, sizeof(path2), "%s", path);
|
||||||
return LoadAutoExtension(newpath);
|
path2[strlen(path) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
|
||||||
|
return LoadAutoExtension(path2);
|
||||||
}
|
}
|
||||||
|
|
||||||
IExtension *pAlready;
|
IExtension *pAlready;
|
||||||
@@ -573,24 +590,12 @@ IExtension *CExtensionManager::FindExtensionByFile(const char *file)
|
|||||||
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
|
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
|
||||||
{
|
{
|
||||||
pExt = (*iter);
|
pExt = (*iter);
|
||||||
char short_file[PLATFORM_MAX_PATH];
|
if (pExt->IsSameFile(file))
|
||||||
g_LibSys.GetFileFromPath(short_file, sizeof(short_file), pExt->GetFilename());
|
|
||||||
if (strcmp(lookup, short_file) == 0)
|
|
||||||
{
|
{
|
||||||
return pExt;
|
return pExt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we got no results, test if there was a platform extension.
|
|
||||||
* If not, add one.
|
|
||||||
*/
|
|
||||||
if (!strstr(file, "." PLATFORM_LIB_EXT))
|
|
||||||
{
|
|
||||||
char path[PLATFORM_MAX_PATH];
|
|
||||||
UTIL_Format(path, sizeof(path), "%s.%s", file, PLATFORM_LIB_EXT);
|
|
||||||
return FindExtensionByFile(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -628,6 +633,16 @@ IExtension *CExtensionManager::FindExtensionByName(const char *ext)
|
|||||||
|
|
||||||
IExtension *CExtensionManager::LoadExtension(const char *file, char *error, size_t maxlength)
|
IExtension *CExtensionManager::LoadExtension(const char *file, char *error, size_t maxlength)
|
||||||
{
|
{
|
||||||
|
/* Remove platform extension if it's there. Compat hack. */
|
||||||
|
const char *ext = g_LibSys.GetFileExtension(file);
|
||||||
|
if (strcmp(ext, PLATFORM_LIB_EXT) == 0)
|
||||||
|
{
|
||||||
|
char path2[PLATFORM_MAX_PATH];
|
||||||
|
UTIL_Format(path2, sizeof(path2), "%s", file);
|
||||||
|
path2[strlen(file) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
|
||||||
|
return LoadExtension(path2, error, maxlength);
|
||||||
|
}
|
||||||
|
|
||||||
IExtension *pAlready;
|
IExtension *pAlready;
|
||||||
if ((pAlready=FindExtensionByFile(file)) != NULL)
|
if ((pAlready=FindExtensionByFile(file)) != NULL)
|
||||||
{
|
{
|
||||||
@@ -664,6 +679,20 @@ void CExtensionManager::BindDependency(IExtension *pRequester, IfaceInfo *pInfo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CExtensionManager::AddRawDependency(IExtension *ext, IdentityToken_t *other, void *iface)
|
||||||
|
{
|
||||||
|
CExtension *pExt = (CExtension *)ext;
|
||||||
|
CExtension *pOwner = GetExtensionFromIdent(other);
|
||||||
|
|
||||||
|
IfaceInfo info;
|
||||||
|
|
||||||
|
info.iface = (SMInterface *)iface;
|
||||||
|
info.owner = pOwner;
|
||||||
|
|
||||||
|
pExt->AddDependency(&info);
|
||||||
|
pOwner->AddChildDependent(pExt, (SMInterface *)iface);
|
||||||
|
}
|
||||||
|
|
||||||
void CExtensionManager::AddInterface(IExtension *pOwner, SMInterface *pInterface)
|
void CExtensionManager::AddInterface(IExtension *pOwner, SMInterface *pInterface)
|
||||||
{
|
{
|
||||||
CExtension *pExt = (CExtension *)pOwner;
|
CExtension *pExt = (CExtension *)pOwner;
|
||||||
@@ -671,7 +700,7 @@ void CExtensionManager::AddInterface(IExtension *pOwner, SMInterface *pInterface
|
|||||||
pExt->AddInterface(pInterface);
|
pExt->AddInterface(pInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CExtensionManager::BindChildPlugin(IExtension *pParent, IPlugin *pPlugin)
|
void CExtensionManager::BindChildPlugin( IExtension *pParent, CPlugin *pPlugin )
|
||||||
{
|
{
|
||||||
CExtension *pExt = (CExtension *)pParent;
|
CExtension *pExt = (CExtension *)pParent;
|
||||||
|
|
||||||
@@ -684,7 +713,7 @@ void CExtensionManager::OnPluginDestroyed(IPlugin *plugin)
|
|||||||
|
|
||||||
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
|
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
|
||||||
{
|
{
|
||||||
(*iter)->RemovePlugin(plugin);
|
(*iter)->DropRefsTo((CPlugin *)plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -709,77 +738,6 @@ CExtension *CExtensionManager::FindByOrder(unsigned int num)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CExtensionManager::BindAllNativesToPlugin(IPlugin *pPlugin)
|
|
||||||
{
|
|
||||||
IPluginContext *pContext = pPlugin->GetBaseContext();
|
|
||||||
|
|
||||||
List<CExtension *> exts;
|
|
||||||
|
|
||||||
uint32_t natives = pContext->GetNativesNum();
|
|
||||||
sp_native_t *native;
|
|
||||||
sm_extnative_t *x_native;
|
|
||||||
sm_repnative_t *r_native;
|
|
||||||
for (uint32_t i=0; i<natives; i++)
|
|
||||||
{
|
|
||||||
/* Make sure the native is valid */
|
|
||||||
if (pContext->GetNativeByIndex(i, &native) != SP_ERROR_NONE)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make sure the native is not already bound */
|
|
||||||
if (native->status == SP_NATIVE_BOUND)
|
|
||||||
{
|
|
||||||
/* If it is bound, see if there is a replacement. */
|
|
||||||
if ((r_native = m_RepNatives.retrieve(native->name)) == NULL)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Rewrite the address. Whee! */
|
|
||||||
native->pfn = r_native->info.func;
|
|
||||||
|
|
||||||
/* Make sure this will unload safely */
|
|
||||||
WeakNative wn((CPlugin *)pPlugin, i);
|
|
||||||
r_native->owner->m_ReplacedNatives.push_back(wn);
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See if we've got this native in our cache */
|
|
||||||
if ((x_native = m_ExtNatives.retrieve(native->name)) == NULL)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* Try and bind it */
|
|
||||||
if (pContext->BindNativeToIndex(i, x_native->info->func) != SP_ERROR_NONE)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* See if it's optional */
|
|
||||||
if (native->flags & SP_NTVFLAG_OPTIONAL)
|
|
||||||
{
|
|
||||||
WeakNative wkn = WeakNative((CPlugin *)pPlugin, i);
|
|
||||||
x_native->owner->m_WeakNatives.push_back(wkn);
|
|
||||||
}
|
|
||||||
else if (exts.find(x_native->owner) == exts.end())
|
|
||||||
{
|
|
||||||
exts.push_back(x_native->owner);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<CExtension *>::iterator iter;
|
|
||||||
for (iter = exts.begin(); iter != exts.end(); iter++)
|
|
||||||
{
|
|
||||||
CExtension *pExt = (*iter);
|
|
||||||
if (pExt->m_Plugins.find(pPlugin) != pExt->m_Plugins.end())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
pExt->m_Plugins.push_back(pPlugin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CExtensionManager::UnloadExtension(IExtension *_pExt)
|
bool CExtensionManager::UnloadExtension(IExtension *_pExt)
|
||||||
{
|
{
|
||||||
if (!_pExt)
|
if (!_pExt)
|
||||||
@@ -804,12 +762,12 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
|
|||||||
if (pExt->IsLoaded())
|
if (pExt->IsLoaded())
|
||||||
{
|
{
|
||||||
/* Unload any dependent plugins */
|
/* Unload any dependent plugins */
|
||||||
List<IPlugin *>::iterator p_iter = pExt->m_Plugins.begin();
|
List<CPlugin *>::iterator p_iter = pExt->m_Dependents.begin();
|
||||||
while (p_iter != pExt->m_Plugins.end())
|
while (p_iter != pExt->m_Dependents.end())
|
||||||
{
|
{
|
||||||
/* We have to manually unlink ourselves here, since we're no longer being managed */
|
/* We have to manually unlink ourselves here, since we're no longer being managed */
|
||||||
g_PluginSys.UnloadPlugin((*p_iter));
|
g_PluginSys.UnloadPlugin((*p_iter));
|
||||||
p_iter = pExt->m_Plugins.erase(p_iter);
|
p_iter = pExt->m_Dependents.erase(p_iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String>::iterator s_iter;
|
List<String>::iterator s_iter;
|
||||||
@@ -820,30 +778,6 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
|
|||||||
g_PluginSys.OnLibraryAction((*s_iter).c_str(), false, true);
|
g_PluginSys.OnLibraryAction((*s_iter).c_str(), false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unbind weak natives */
|
|
||||||
List<WeakNative>::iterator wkn_iter;
|
|
||||||
for (wkn_iter=pExt->m_WeakNatives.begin(); wkn_iter!=pExt->m_WeakNatives.end(); wkn_iter++)
|
|
||||||
{
|
|
||||||
WeakNative & wkn = (*wkn_iter);
|
|
||||||
sp_context_t *ctx = wkn.pl->GetContext();
|
|
||||||
ctx->natives[wkn.idx].status = SP_NATIVE_UNBOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Unbind replacement natives, link them back to their originals */
|
|
||||||
for (wkn_iter = pExt->m_ReplacedNatives.begin();
|
|
||||||
wkn_iter != pExt->m_ReplacedNatives.end();
|
|
||||||
wkn_iter++)
|
|
||||||
{
|
|
||||||
WeakNative & wkn = (*wkn_iter);
|
|
||||||
sp_context_t *ctx = wkn.pl->GetContext();
|
|
||||||
sm_repnative_t *r_native = m_RepNatives.retrieve(ctx->natives[wkn.idx].name);
|
|
||||||
if (r_native == NULL || ctx->natives[wkn.idx].pfn != r_native->info.func)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ctx->natives[wkn.idx].pfn = r_native->original;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Notify and/or unload all dependencies */
|
/* Notify and/or unload all dependencies */
|
||||||
List<CExtension *>::iterator c_iter;
|
List<CExtension *>::iterator c_iter;
|
||||||
CExtension *pDep;
|
CExtension *pDep;
|
||||||
@@ -898,44 +832,7 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Unbind our natives from Core */
|
/* Unbind our natives from Core */
|
||||||
List<const sp_nativeinfo_t *>::iterator native_iter;
|
pExt->DropEverything();
|
||||||
for (native_iter = pExt->m_Natives.begin();
|
|
||||||
native_iter != pExt->m_Natives.end();
|
|
||||||
native_iter++)
|
|
||||||
{
|
|
||||||
const sp_nativeinfo_t *natives = (*native_iter);
|
|
||||||
sm_extnative_t *x_native;
|
|
||||||
for (unsigned int n = 0;
|
|
||||||
natives[n].name != NULL && natives[n].func != NULL;
|
|
||||||
n++)
|
|
||||||
{
|
|
||||||
x_native = m_ExtNatives.retrieve(natives[n].name);
|
|
||||||
if (x_native && x_native->owner == pExt)
|
|
||||||
{
|
|
||||||
m_ExtNatives.remove(natives[n].name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Unbind our replacement natives */
|
|
||||||
List<sm_repnative_t>::iterator rep_iter = m_RepNativeList.begin();
|
|
||||||
while (rep_iter != m_RepNativeList.end())
|
|
||||||
{
|
|
||||||
sm_repnative_t & r_native = (*rep_iter);
|
|
||||||
if (r_native.owner == pExt)
|
|
||||||
{
|
|
||||||
m_RepNatives.remove(r_native.info.name);
|
|
||||||
rep_iter = m_RepNativeList.erase(rep_iter);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rep_iter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Tell it to unload */
|
|
||||||
pAPI = pExt->GetAPI();
|
|
||||||
pAPI->OnExtensionUnload();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IdentityToken_t *pIdentity;
|
IdentityToken_t *pIdentity;
|
||||||
@@ -949,6 +846,13 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Tell it to unload */
|
||||||
|
if (pExt->IsLoaded())
|
||||||
|
{
|
||||||
|
IExtensionInterface *pAPI = pExt->GetAPI();
|
||||||
|
pAPI->OnExtensionUnload();
|
||||||
|
}
|
||||||
|
|
||||||
pExt->Unload();
|
pExt->Unload();
|
||||||
delete pExt;
|
delete pExt;
|
||||||
|
|
||||||
@@ -962,44 +866,6 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CExtensionManager::AddNatives(IExtension *pOwner, const sp_nativeinfo_t *natives)
|
|
||||||
{
|
|
||||||
CExtension *pExt = (CExtension *)pOwner;
|
|
||||||
|
|
||||||
pExt->m_Natives.push_back(natives);
|
|
||||||
|
|
||||||
for (unsigned int i = 0; natives[i].func != NULL && natives[i].name != NULL; i++)
|
|
||||||
{
|
|
||||||
if (m_ExtNatives.retrieve(natives[i].name) != NULL)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
sm_extnative_t x_native;
|
|
||||||
x_native.info = &natives[i];
|
|
||||||
x_native.owner = pExt;
|
|
||||||
m_ExtNatives.insert(natives[i].name, x_native);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CExtensionManager::OverrideNatives(IExtension *myself, const sp_nativeinfo_t *natives)
|
|
||||||
{
|
|
||||||
SPVM_NATIVE_FUNC orig;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; natives[i].func != NULL && natives[i].name != NULL; i++)
|
|
||||||
{
|
|
||||||
if ((orig = g_PluginSys.FindCoreNative(natives[i].name)) == NULL)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
sm_repnative_t rep;
|
|
||||||
rep.info = natives[i];
|
|
||||||
rep.owner = (CExtension *)myself;
|
|
||||||
rep.original = orig;
|
|
||||||
m_RepNativeList.push_back(rep);
|
|
||||||
m_RepNatives.insert(natives[i].name, rep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CExtensionManager::MarkAllLoaded()
|
void CExtensionManager::MarkAllLoaded()
|
||||||
{
|
{
|
||||||
List<CExtension *>::iterator iter;
|
List<CExtension *>::iterator iter;
|
||||||
@@ -1085,6 +951,37 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(cmd, "load") == 0)
|
||||||
|
{
|
||||||
|
if (argcount < 4)
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Usage: sm exts load <file>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *filename = command.Arg(3);
|
||||||
|
char path[PLATFORM_MAX_PATH];
|
||||||
|
char error[256];
|
||||||
|
|
||||||
|
UTIL_Format(path, sizeof(path), "%s%s%s", filename, !strstr(filename, ".ext") ? ".ext" : "",
|
||||||
|
!strstr(filename, "." PLATFORM_LIB_EXT) ? "." PLATFORM_LIB_EXT : "");
|
||||||
|
|
||||||
|
if (FindExtensionByFile(path) != NULL)
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Extension %s is already loaded.", path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LoadExtension(path, error, sizeof(error)))
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Loaded extension %s successfully.", path);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Extension %s failed to load: %s", path, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if (strcmp(cmd, "info") == 0)
|
else if (strcmp(cmd, "info") == 0)
|
||||||
{
|
{
|
||||||
if (argcount < 4)
|
if (argcount < 4)
|
||||||
@@ -1206,7 +1103,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!pExt->IsLoaded()
|
if (!pExt->IsLoaded()
|
||||||
|| (!pExt->m_ChildDeps.size() && !pExt->m_Plugins.size()))
|
|| (!pExt->m_ChildDeps.size() && !pExt->m_Dependents.size()))
|
||||||
{
|
{
|
||||||
char filename[PLATFORM_MAX_PATH];
|
char filename[PLATFORM_MAX_PATH];
|
||||||
snprintf(filename, PLATFORM_MAX_PATH, "%s", pExt->GetFilename());
|
snprintf(filename, PLATFORM_MAX_PATH, "%s", pExt->GetFilename());
|
||||||
@@ -1216,7 +1113,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<IPlugin *> plugins;
|
List<CPlugin *> plugins;
|
||||||
if (pExt->m_ChildDeps.size())
|
if (pExt->m_ChildDeps.size())
|
||||||
{
|
{
|
||||||
g_RootMenu.ConsolePrint("[SM] Unloading %s will unload the following extensions: ", pExt->GetFilename());
|
g_RootMenu.ConsolePrint("[SM] Unloading %s will unload the following extensions: ", pExt->GetFilename());
|
||||||
@@ -1246,9 +1143,9 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
|||||||
{
|
{
|
||||||
g_RootMenu.ConsolePrint(" -> %s", pExt->GetFilename());
|
g_RootMenu.ConsolePrint(" -> %s", pExt->GetFilename());
|
||||||
/* Add to plugin unload list */
|
/* Add to plugin unload list */
|
||||||
List<IPlugin *>::iterator p_iter;
|
List<CPlugin *>::iterator p_iter;
|
||||||
for (p_iter=pOther->m_Plugins.begin();
|
for (p_iter=pOther->m_Dependents.begin();
|
||||||
p_iter!=pOther->m_Plugins.end();
|
p_iter!=pOther->m_Dependents.end();
|
||||||
p_iter++)
|
p_iter++)
|
||||||
{
|
{
|
||||||
if (plugins.find((*p_iter)) == plugins.end())
|
if (plugins.find((*p_iter)) == plugins.end())
|
||||||
@@ -1260,12 +1157,12 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pExt->m_Plugins.size())
|
if (pExt->m_Dependents.size())
|
||||||
{
|
{
|
||||||
g_RootMenu.ConsolePrint("[SM] Unloading %s will unload the following plugins: ", pExt->GetFilename());
|
g_RootMenu.ConsolePrint("[SM] Unloading %s will unload the following plugins: ", pExt->GetFilename());
|
||||||
List<IPlugin *>::iterator iter;
|
List<CPlugin *>::iterator iter;
|
||||||
IPlugin *pPlugin;
|
CPlugin *pPlugin;
|
||||||
for (iter = pExt->m_Plugins.begin(); iter != pExt->m_Plugins.end(); iter++)
|
for (iter = pExt->m_Dependents.begin(); iter != pExt->m_Dependents.end(); iter++)
|
||||||
{
|
{
|
||||||
pPlugin = (*iter);
|
pPlugin = (*iter);
|
||||||
if (plugins.find(pPlugin) == plugins.end())
|
if (plugins.find(pPlugin) == plugins.end())
|
||||||
@@ -1287,11 +1184,57 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (strcmp(cmd, "reload") == 0)
|
||||||
|
{
|
||||||
|
if (argcount < 4)
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Usage: sm exts reload <#>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *arg = command.Arg(3);
|
||||||
|
unsigned int num = atoi(arg);
|
||||||
|
CExtension *pExt = FindByOrder(num);
|
||||||
|
|
||||||
|
if (!pExt)
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Extension number %d was not found.", num);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pExt->IsLoaded())
|
||||||
|
{
|
||||||
|
char filename[PLATFORM_MAX_PATH];
|
||||||
|
char error[255];
|
||||||
|
|
||||||
|
snprintf(filename, PLATFORM_MAX_PATH, "%s", pExt->GetFilename());
|
||||||
|
|
||||||
|
if (pExt->Reload(error, sizeof(error)))
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Extension %s is now reloaded.", filename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Extension %s failed to reload: %s", filename, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_RootMenu.ConsolePrint("[SM] Extension %s is not loaded.", pExt->GetFilename());
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_RootMenu.ConsolePrint("SourceMod Extensions Menu:");
|
g_RootMenu.ConsolePrint("SourceMod Extensions Menu:");
|
||||||
g_RootMenu.DrawGenericOption("info", "Extra extension information");
|
g_RootMenu.DrawGenericOption("info", "Extra extension information");
|
||||||
g_RootMenu.DrawGenericOption("list", "List extensions");
|
g_RootMenu.DrawGenericOption("list", "List extensions");
|
||||||
|
g_RootMenu.DrawGenericOption("load", "Load an extension");
|
||||||
|
g_RootMenu.DrawGenericOption("reload", "Reload an extension");
|
||||||
g_RootMenu.DrawGenericOption("unload", "Unload an extension");
|
g_RootMenu.DrawGenericOption("unload", "Unload an extension");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1386,3 +1329,16 @@ void CExtensionManager::CallOnCoreMapStart(edict_t *pEdictList, int edictCount,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CLocalExtension::IsSameFile(const char *file)
|
||||||
|
{
|
||||||
|
/* Only care about the shortened name. */
|
||||||
|
return strcmp(file, m_File.c_str()) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRemoteExtension::IsSameFile(const char *file)
|
||||||
|
{
|
||||||
|
/* :TODO: this could be better, but no one uses this API anyway. */
|
||||||
|
return strcmp(file, m_Path.c_str()) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
#include <IPluginSys.h>
|
#include <IPluginSys.h>
|
||||||
#include <IRootConsoleMenu.h>
|
#include <IRootConsoleMenu.h>
|
||||||
#include "PluginSys.h"
|
#include "PluginSys.h"
|
||||||
|
#include "NativeOwner.h"
|
||||||
|
|
||||||
using namespace SourceMod;
|
using namespace SourceMod;
|
||||||
using namespace SourceHook;
|
using namespace SourceHook;
|
||||||
@@ -55,15 +56,9 @@ struct sm_extnative_t
|
|||||||
const sp_nativeinfo_t *info;
|
const sp_nativeinfo_t *info;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Replacement native */
|
class CExtension :
|
||||||
struct sm_repnative_t
|
public IExtension,
|
||||||
{
|
public CNativeOwner
|
||||||
CExtension *owner;
|
|
||||||
sp_nativeinfo_t info;
|
|
||||||
SPVM_NATIVE_FUNC original;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CExtension : public IExtension
|
|
||||||
{
|
{
|
||||||
friend class CExtensionManager;
|
friend class CExtensionManager;
|
||||||
public:
|
public:
|
||||||
@@ -78,17 +73,18 @@ public: //IExtension
|
|||||||
bool IsRunning(char *error, size_t maxlength);
|
bool IsRunning(char *error, size_t maxlength);
|
||||||
public:
|
public:
|
||||||
void SetError(const char *error);
|
void SetError(const char *error);
|
||||||
void AddDependency(IfaceInfo *pInfo);
|
void AddDependency(const IfaceInfo *pInfo);
|
||||||
void AddChildDependent(CExtension *pOther, SMInterface *iface);
|
void AddChildDependent(CExtension *pOther, SMInterface *iface);
|
||||||
void AddInterface(SMInterface *pInterface);
|
void AddInterface(SMInterface *pInterface);
|
||||||
void AddPlugin(IPlugin *pPlugin);
|
void AddPlugin(CPlugin *pPlugin);
|
||||||
void RemovePlugin(IPlugin *pPlugin);
|
|
||||||
void MarkAllLoaded();
|
void MarkAllLoaded();
|
||||||
void AddLibrary(const char *library);
|
void AddLibrary(const char *library);
|
||||||
public:
|
public:
|
||||||
virtual bool Load(char *error, size_t maxlength);
|
virtual bool Load(char *error, size_t maxlength);
|
||||||
virtual bool IsLoaded() =0;
|
virtual bool IsLoaded() =0;
|
||||||
virtual void Unload() =0;
|
virtual void Unload() =0;
|
||||||
|
virtual bool Reload(char *error, size_t maxlength) =0;
|
||||||
|
virtual bool IsSameFile(const char* file) =0;
|
||||||
protected:
|
protected:
|
||||||
void Initialize(const char *filename, const char *path);
|
void Initialize(const char *filename, const char *path);
|
||||||
bool PerformAPICheck(char *error, size_t maxlength);
|
bool PerformAPICheck(char *error, size_t maxlength);
|
||||||
@@ -98,15 +94,12 @@ protected:
|
|||||||
IdentityToken_t *m_pIdentToken;
|
IdentityToken_t *m_pIdentToken;
|
||||||
IExtensionInterface *m_pAPI;
|
IExtensionInterface *m_pAPI;
|
||||||
String m_File;
|
String m_File;
|
||||||
|
String m_RealFile;
|
||||||
String m_Path;
|
String m_Path;
|
||||||
String m_Error;
|
String m_Error;
|
||||||
List<IfaceInfo> m_Deps; /** Dependencies */
|
List<IfaceInfo> m_Deps; /** Dependencies */
|
||||||
List<IfaceInfo> m_ChildDeps; /** Children who might depend on us */
|
List<IfaceInfo> m_ChildDeps; /** Children who might depend on us */
|
||||||
List<SMInterface *> m_Interfaces;
|
List<SMInterface *> m_Interfaces;
|
||||||
List<IPlugin *> m_Plugins;
|
|
||||||
List<const sp_nativeinfo_t *> m_Natives;
|
|
||||||
List<WeakNative> m_WeakNatives;
|
|
||||||
List<WeakNative> m_ReplacedNatives;
|
|
||||||
List<String> m_Libraries;
|
List<String> m_Libraries;
|
||||||
unsigned int unload_code;
|
unsigned int unload_code;
|
||||||
bool m_bFullyLoaded;
|
bool m_bFullyLoaded;
|
||||||
@@ -120,7 +113,9 @@ public:
|
|||||||
bool Load(char *error, size_t maxlength);
|
bool Load(char *error, size_t maxlength);
|
||||||
bool IsLoaded();
|
bool IsLoaded();
|
||||||
void Unload();
|
void Unload();
|
||||||
|
bool Reload(char *error, size_t maxlength);
|
||||||
bool IsExternal();
|
bool IsExternal();
|
||||||
|
bool IsSameFile(const char *file);
|
||||||
private:
|
private:
|
||||||
PluginId m_PlId;
|
PluginId m_PlId;
|
||||||
ILibrary *m_pLib;
|
ILibrary *m_pLib;
|
||||||
@@ -134,7 +129,9 @@ public:
|
|||||||
bool Load(char *error, size_t maxlength);
|
bool Load(char *error, size_t maxlength);
|
||||||
bool IsLoaded();
|
bool IsLoaded();
|
||||||
void Unload();
|
void Unload();
|
||||||
|
bool Reload(char *error, size_t maxlength);
|
||||||
bool IsExternal();
|
bool IsExternal();
|
||||||
|
bool IsSameFile(const char *file);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CExtensionManager :
|
class CExtensionManager :
|
||||||
@@ -169,26 +166,26 @@ public:
|
|||||||
IExtension *LoadAutoExtension(const char *path);
|
IExtension *LoadAutoExtension(const char *path);
|
||||||
void BindDependency(IExtension *pOwner, IfaceInfo *pInfo);
|
void BindDependency(IExtension *pOwner, IfaceInfo *pInfo);
|
||||||
void AddInterface(IExtension *pOwner, SMInterface *pInterface);
|
void AddInterface(IExtension *pOwner, SMInterface *pInterface);
|
||||||
void BindChildPlugin(IExtension *pParent, IPlugin *pPlugin);
|
void BindChildPlugin(IExtension *pParent, CPlugin *pPlugin);
|
||||||
void AddNatives(IExtension *pOwner, const sp_nativeinfo_t *natives);
|
|
||||||
void BindAllNativesToPlugin(IPlugin *pPlugin);
|
|
||||||
void MarkAllLoaded();
|
void MarkAllLoaded();
|
||||||
void AddDependency(IExtension *pSource, const char *file, bool required, bool autoload);
|
void AddDependency(IExtension *pSource, const char *file, bool required, bool autoload);
|
||||||
void TryAutoload();
|
void TryAutoload();
|
||||||
void AddLibrary(IExtension *pSource, const char *library);
|
void AddLibrary(IExtension *pSource, const char *library);
|
||||||
bool LibraryExists(const char *library);
|
bool LibraryExists(const char *library);
|
||||||
void OverrideNatives(IExtension *myself, const sp_nativeinfo_t *natives);
|
|
||||||
void CallOnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax);
|
void CallOnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax);
|
||||||
|
void AddRawDependency(IExtension *ext, IdentityToken_t *other, void *iface);
|
||||||
public:
|
public:
|
||||||
CExtension *GetExtensionFromIdent(IdentityToken_t *ptr);
|
CExtension *GetExtensionFromIdent(IdentityToken_t *ptr);
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
CNativeOwner *GetNativeOwner(IExtension *pExt)
|
||||||
|
{
|
||||||
|
CExtension *p = (CExtension *)pExt;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
CExtension *FindByOrder(unsigned int num);
|
CExtension *FindByOrder(unsigned int num);
|
||||||
private:
|
private:
|
||||||
List<CExtension *> m_Libs;
|
List<CExtension *> m_Libs;
|
||||||
List<sm_repnative_t> m_RepNativeList;
|
|
||||||
KTrie<sm_repnative_t> m_RepNatives;
|
|
||||||
KTrie<sm_extnative_t> m_ExtNatives;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CExtensionManager g_Extensions;
|
extern CExtensionManager g_Extensions;
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -186,6 +186,11 @@ void CForwardManager::ReleaseForward(IForward *forward)
|
|||||||
|
|
||||||
void CForwardManager::ForwardFree(CForward *fwd)
|
void CForwardManager::ForwardFree(CForward *fwd)
|
||||||
{
|
{
|
||||||
|
if (fwd == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_FreeForwards.push(fwd);
|
m_FreeForwards.push(fwd);
|
||||||
m_managed.remove(fwd);
|
m_managed.remove(fwd);
|
||||||
}
|
}
|
||||||
@@ -283,15 +288,11 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter)
|
|
||||||
{
|
|
||||||
filter->OnExecuteBegin();
|
|
||||||
}
|
|
||||||
|
|
||||||
FuncIter iter = m_functions.begin();
|
FuncIter iter = m_functions.begin();
|
||||||
IPluginFunction *func;
|
IPluginFunction *func;
|
||||||
cell_t cur_result = 0;
|
cell_t cur_result = 0;
|
||||||
cell_t high_result = 0;
|
cell_t high_result = 0;
|
||||||
|
cell_t low_result = 0;
|
||||||
int err;
|
int err;
|
||||||
unsigned int failed=0, success=0;
|
unsigned int failed=0, success=0;
|
||||||
unsigned int num_params = m_curparam;
|
unsigned int num_params = m_curparam;
|
||||||
@@ -311,12 +312,16 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
|||||||
{
|
{
|
||||||
int err = SP_ERROR_PARAM;
|
int err = SP_ERROR_PARAM;
|
||||||
param = &temp_info[i];
|
param = &temp_info[i];
|
||||||
|
|
||||||
if (i >= m_numparams || m_types[i] == Param_Any)
|
if (i >= m_numparams || m_types[i] == Param_Any)
|
||||||
{
|
{
|
||||||
type = param->pushedas;
|
type = param->pushedas;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
type = m_types[i];
|
type = m_types[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((i >= m_numparams) || (type & SP_PARAMFLAG_BYREF))
|
if ((i >= m_numparams) || (type & SP_PARAMFLAG_BYREF))
|
||||||
{
|
{
|
||||||
/* If we're byref or we're vararg, we always push everything by ref.
|
/* If we're byref or we're vararg, we always push everything by ref.
|
||||||
@@ -325,26 +330,30 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
|||||||
if (type == Param_String)
|
if (type == Param_String)
|
||||||
{
|
{
|
||||||
err = func->PushStringEx((char *)param->byref.orig_addr, param->byref.cells, param->byref.sz_flags, param->byref.flags);
|
err = func->PushStringEx((char *)param->byref.orig_addr, param->byref.cells, param->byref.sz_flags, param->byref.flags);
|
||||||
} else if (type == Param_Float || type == Param_Cell) {
|
}
|
||||||
|
else if (type == Param_Float || type == Param_Cell)
|
||||||
|
{
|
||||||
err = func->PushCellByRef(¶m->val);
|
err = func->PushCellByRef(¶m->val);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
err = func->PushArray(param->byref.orig_addr, param->byref.cells, param->byref.flags);
|
err = func->PushArray(param->byref.orig_addr, param->byref.cells, param->byref.flags);
|
||||||
assert(type == Param_Array || type == Param_FloatByRef || type == Param_CellByRef);
|
assert(type == Param_Array || type == Param_FloatByRef || type == Param_CellByRef);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* If we're not byref or not vararg, our job is a bit easier. */
|
/* If we're not byref or not vararg, our job is a bit easier. */
|
||||||
assert(type == Param_Cell || type == Param_Float);
|
assert(type == Param_Cell || type == Param_Float);
|
||||||
err = func->PushCell(param->val);
|
err = func->PushCell(param->val);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err != SP_ERROR_NONE)
|
if (err != SP_ERROR_NONE)
|
||||||
{
|
{
|
||||||
if (!filter || !filter->OnErrorReport(this, func, err))
|
g_DbgReporter.GenerateError(func->GetParentContext(),
|
||||||
{
|
func->GetFunctionID(),
|
||||||
g_DbgReporter.GenerateError(func->GetParentContext(),
|
err,
|
||||||
func->GetFunctionID(),
|
"Failed to push parameter while executing forward");
|
||||||
err,
|
|
||||||
"Failed to push parameter while executing forward");
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -352,12 +361,10 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
|||||||
/* Call the function and deal with the return value. */
|
/* Call the function and deal with the return value. */
|
||||||
if ((err=func->Execute(&cur_result)) != SP_ERROR_NONE)
|
if ((err=func->Execute(&cur_result)) != SP_ERROR_NONE)
|
||||||
{
|
{
|
||||||
if (filter)
|
|
||||||
{
|
|
||||||
filter->OnErrorReport(this, func, err);
|
|
||||||
}
|
|
||||||
failed++;
|
failed++;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
success++;
|
success++;
|
||||||
switch (m_ExecType)
|
switch (m_ExecType)
|
||||||
{
|
{
|
||||||
@@ -381,14 +388,12 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ET_Custom:
|
case ET_LowEvent:
|
||||||
{
|
{
|
||||||
if (filter)
|
/* Check if the current result is the lowest so far (or if it's the first result) */
|
||||||
|
if (cur_result < low_result || success == 1)
|
||||||
{
|
{
|
||||||
if (filter->OnFunctionReturn(this, func, &cur_result) == Pl_Stop)
|
low_result = cur_result;
|
||||||
{
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -401,25 +406,39 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
if (m_ExecType == ET_Event || m_ExecType == ET_Hook)
|
switch (m_ExecType)
|
||||||
{
|
{
|
||||||
cur_result = high_result;
|
case ET_Ignore:
|
||||||
} else if (m_ExecType == ET_Ignore) {
|
{
|
||||||
cur_result = 0;
|
cur_result = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ET_Event:
|
||||||
|
case ET_Hook:
|
||||||
|
{
|
||||||
|
cur_result = high_result;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ET_LowEvent:
|
||||||
|
{
|
||||||
|
cur_result = low_result;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
*result = cur_result;
|
*result = cur_result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter)
|
|
||||||
{
|
|
||||||
filter->OnExecuteEnd(&cur_result, success, failed);
|
|
||||||
}
|
|
||||||
|
|
||||||
return SP_ERROR_NONE;
|
return SP_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -43,7 +43,7 @@ using namespace SourceHook;
|
|||||||
|
|
||||||
typedef List<IPluginFunction *>::iterator FuncIter;
|
typedef List<IPluginFunction *>::iterator FuncIter;
|
||||||
|
|
||||||
//:TODO: a global name max define for sourcepawn, should mirror compiler's sNAMEMAX
|
/* :TODO: a global name max define for sourcepawn, should mirror compiler's sNAMEMAX */
|
||||||
#define FORWARDS_NAME_MAX 64
|
#define FORWARDS_NAME_MAX 64
|
||||||
|
|
||||||
struct ByrefInfo
|
struct ByrefInfo
|
||||||
+385
-40
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -49,9 +49,9 @@
|
|||||||
|
|
||||||
GameConfigManager g_GameConfigs;
|
GameConfigManager g_GameConfigs;
|
||||||
IGameConfig *g_pGameConf = NULL;
|
IGameConfig *g_pGameConf = NULL;
|
||||||
char g_Game[256];
|
static char g_Game[256];
|
||||||
char g_GameDesc[256] = {'!', '\0'};
|
static char g_GameDesc[256] = {'!', '\0'};
|
||||||
char g_GameName[256] = {'$', '\0'};
|
static char g_GameName[256] = {'$', '\0'};
|
||||||
|
|
||||||
#define PSTATE_NONE 0
|
#define PSTATE_NONE 0
|
||||||
#define PSTATE_GAMES 1
|
#define PSTATE_GAMES 1
|
||||||
@@ -64,6 +64,7 @@ char g_GameName[256] = {'$', '\0'};
|
|||||||
#define PSTATE_GAMEDEFS_SIGNATURES_SIG 8
|
#define PSTATE_GAMEDEFS_SIGNATURES_SIG 8
|
||||||
#define PSTATE_GAMEDEFS_CRC 9
|
#define PSTATE_GAMEDEFS_CRC 9
|
||||||
#define PSTATE_GAMEDEFS_CRC_BINARY 10
|
#define PSTATE_GAMEDEFS_CRC_BINARY 10
|
||||||
|
#define PSTATE_GAMEDEFS_CUSTOM 11
|
||||||
|
|
||||||
#if defined PLATFORM_WINDOWS
|
#if defined PLATFORM_WINDOWS
|
||||||
#define PLATFORM_NAME "windows"
|
#define PLATFORM_NAME "windows"
|
||||||
@@ -71,6 +72,9 @@ char g_GameName[256] = {'$', '\0'};
|
|||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_LINUX
|
||||||
#define PLATFORM_NAME "linux"
|
#define PLATFORM_NAME "linux"
|
||||||
#define PLATFORM_SERVER_BINARY "server_i486.so"
|
#define PLATFORM_SERVER_BINARY "server_i486.so"
|
||||||
|
#elif defined PLATFORM_APPLE
|
||||||
|
#define PLATFORM_NAME "undef"
|
||||||
|
#define PLATFORM_SERVER_BINARY "undef.dylib"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct TempSigInfo
|
struct TempSigInfo
|
||||||
@@ -86,15 +90,50 @@ struct TempSigInfo
|
|||||||
unsigned int s_ServerBinCRC;
|
unsigned int s_ServerBinCRC;
|
||||||
bool s_ServerBinCRC_Ok = false;
|
bool s_ServerBinCRC_Ok = false;
|
||||||
|
|
||||||
|
static bool DoesGameMatch(const char *value)
|
||||||
|
{
|
||||||
|
if (strcmp(value, g_Game) == 0 ||
|
||||||
|
strcmp(value, g_GameDesc) == 0 ||
|
||||||
|
strcmp(value, g_GameName) == 0)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool DoesEngineMatch(const char *value)
|
||||||
|
{
|
||||||
|
#if SOURCE_ENGINE == SE_EPISODEONE
|
||||||
|
if (strcmp(value, "original") == 0)
|
||||||
|
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||||
|
if (strcmp(value, "darkmessiah") == 0)
|
||||||
|
#elif SOURCE_ENGINE == SE_ORANGEBOX
|
||||||
|
if (strcmp(value, "orangebox") == 0)
|
||||||
|
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
||||||
|
if (strcmp(value, "orangebox_valve") == 0)
|
||||||
|
#elif SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
if (strcmp(value, "left4dead") == 0)
|
||||||
|
#else
|
||||||
|
#error "Unknown engine type"
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
CGameConfig::CGameConfig(const char *file)
|
CGameConfig::CGameConfig(const char *file)
|
||||||
{
|
{
|
||||||
m_pFile = sm_strdup(file);
|
strncopy(m_File, file, sizeof(m_File));
|
||||||
m_pOffsets = sm_trie_create();
|
m_pOffsets = sm_trie_create();
|
||||||
m_pProps = sm_trie_create();
|
m_pProps = sm_trie_create();
|
||||||
m_pKeys = sm_trie_create();
|
m_pKeys = sm_trie_create();
|
||||||
m_pSigs = sm_trie_create();
|
m_pSigs = sm_trie_create();
|
||||||
m_pStrings = new BaseStringTable(512);
|
m_pStrings = new BaseStringTable(512);
|
||||||
m_RefCount = 0;
|
m_RefCount = 0;
|
||||||
|
|
||||||
|
m_CustomLevel = 0;
|
||||||
|
m_CustomHandler = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGameConfig::~CGameConfig()
|
CGameConfig::~CGameConfig()
|
||||||
@@ -103,7 +142,6 @@ CGameConfig::~CGameConfig()
|
|||||||
sm_trie_destroy(m_pProps);
|
sm_trie_destroy(m_pProps);
|
||||||
sm_trie_destroy(m_pKeys);
|
sm_trie_destroy(m_pKeys);
|
||||||
sm_trie_destroy(m_pSigs);
|
sm_trie_destroy(m_pSigs);
|
||||||
delete [] m_pFile;
|
|
||||||
delete m_pStrings;
|
delete m_pStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,11 +167,9 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
|||||||
}
|
}
|
||||||
case PSTATE_GAMES:
|
case PSTATE_GAMES:
|
||||||
{
|
{
|
||||||
if ((strcmp(name, "*") == 0)
|
if (strcmp(name, "*") == 0 ||
|
||||||
|| (strcmp(name, "#default") == 0)
|
strcmp(name, "#default") == 0 ||
|
||||||
|| (strcasecmp(name, g_Game) == 0)
|
DoesGameMatch(name))
|
||||||
|| (strcasecmp(name, g_GameDesc) == 0)
|
|
||||||
|| (strcasecmp(name, g_GameName) == 0))
|
|
||||||
{
|
{
|
||||||
bShouldBeReadingDefault = true;
|
bShouldBeReadingDefault = true;
|
||||||
m_ParseState = PSTATE_GAMEDEFS;
|
m_ParseState = PSTATE_GAMEDEFS;
|
||||||
@@ -153,12 +189,15 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
|||||||
{
|
{
|
||||||
m_ParseState = PSTATE_GAMEDEFS_KEYS;
|
m_ParseState = PSTATE_GAMEDEFS_KEYS;
|
||||||
}
|
}
|
||||||
else if ((strcmp(name, "#supported") == 0)
|
else if ((strcmp(name, "#supported") == 0) && (strcmp(m_Game, "#default") == 0))
|
||||||
&& (strcmp(m_Game, "#default") == 0))
|
|
||||||
{
|
{
|
||||||
m_ParseState = PSTATE_GAMEDEFS_SUPPORTED;
|
m_ParseState = PSTATE_GAMEDEFS_SUPPORTED;
|
||||||
/* Ignore this section unless we get a game. */
|
/* Ignore this section unless we get a game. */
|
||||||
bShouldBeReadingDefault = false;
|
bShouldBeReadingDefault = false;
|
||||||
|
had_game = false;
|
||||||
|
matched_game = false;
|
||||||
|
had_engine = false;
|
||||||
|
matched_engine = false;
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "Signatures") == 0)
|
else if (strcmp(name, "Signatures") == 0)
|
||||||
{
|
{
|
||||||
@@ -171,6 +210,17 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ITextListener_SMC **pListen = g_GameConfigs.m_customHandlers.retrieve(name);
|
||||||
|
|
||||||
|
if (pListen != NULL)
|
||||||
|
{
|
||||||
|
m_CustomLevel = 0;
|
||||||
|
m_ParseState = PSTATE_GAMEDEFS_CUSTOM;
|
||||||
|
m_CustomHandler = *pListen;
|
||||||
|
m_CustomHandler->ReadSMC_ParseStart();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
m_IgnoreLevel++;
|
m_IgnoreLevel++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -220,18 +270,25 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
|
|||||||
s_ServerBinCRC = UTIL_CRC32(buffer, size);
|
s_ServerBinCRC = UTIL_CRC32(buffer, size);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
s_ServerBinCRC_Ok = true;
|
s_ServerBinCRC_Ok = true;
|
||||||
|
fclose(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (error[0] != '\0')
|
if (error[0] != '\0')
|
||||||
{
|
{
|
||||||
m_IgnoreLevel = 1;
|
m_IgnoreLevel = 1;
|
||||||
g_Logger.LogError("[SM] Error while parsing CRC section for \"%s\" (%s):", m_Game, m_pFile);
|
g_Logger.LogError("[SM] Error while parsing CRC section for \"%s\" (%s):", m_Game, m_CurFile);
|
||||||
g_Logger.LogError("[SM] %s", error);
|
g_Logger.LogError("[SM] %s", error);
|
||||||
} else {
|
} else {
|
||||||
m_ParseState = PSTATE_GAMEDEFS_CRC_BINARY;
|
m_ParseState = PSTATE_GAMEDEFS_CRC_BINARY;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case PSTATE_GAMEDEFS_CUSTOM:
|
||||||
|
{
|
||||||
|
m_CustomLevel++;
|
||||||
|
return m_CustomHandler->ReadSMC_NewSection(states, name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
/* No sub-sections allowed:
|
/* No sub-sections allowed:
|
||||||
case PSTATE_GAMEDEFS_OFFSETS_OFFSET:
|
case PSTATE_GAMEDEFS_OFFSETS_OFFSET:
|
||||||
case PSTATE_GAMEDEFS_KEYS:
|
case PSTATE_GAMEDEFS_KEYS:
|
||||||
@@ -272,13 +329,29 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
|
|||||||
int id = m_pStrings->AddString(value);
|
int id = m_pStrings->AddString(value);
|
||||||
sm_trie_replace(m_pKeys, key, (void *)id);
|
sm_trie_replace(m_pKeys, key, (void *)id);
|
||||||
} else if (m_ParseState == PSTATE_GAMEDEFS_SUPPORTED) {
|
} else if (m_ParseState == PSTATE_GAMEDEFS_SUPPORTED) {
|
||||||
if (strcmp(key, "game") == 0
|
if (strcmp(key, "game") == 0)
|
||||||
&& (strcasecmp(value, g_Game) == 0
|
|
||||||
|| strcasecmp(value, g_GameDesc) == 0
|
|
||||||
|| strcasecmp(value, g_GameName) == 0)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
bShouldBeReadingDefault = true;
|
had_game = true;
|
||||||
|
if (DoesGameMatch(value))
|
||||||
|
{
|
||||||
|
matched_game = true;
|
||||||
|
}
|
||||||
|
if ((!had_engine && matched_game) || (matched_engine && matched_game))
|
||||||
|
{
|
||||||
|
bShouldBeReadingDefault = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "engine") == 0)
|
||||||
|
{
|
||||||
|
had_engine = true;
|
||||||
|
if (DoesEngineMatch(value))
|
||||||
|
{
|
||||||
|
matched_engine = true;
|
||||||
|
}
|
||||||
|
if ((!had_game && matched_engine) || (matched_game && matched_engine))
|
||||||
|
{
|
||||||
|
bShouldBeReadingDefault = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (m_ParseState == PSTATE_GAMEDEFS_SIGNATURES_SIG) {
|
} else if (m_ParseState == PSTATE_GAMEDEFS_SIGNATURES_SIG) {
|
||||||
if (strcmp(key, PLATFORM_NAME) == 0)
|
if (strcmp(key, PLATFORM_NAME) == 0)
|
||||||
@@ -299,6 +372,8 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
|
|||||||
bShouldBeReadingDefault = true;
|
bShouldBeReadingDefault = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (m_ParseState == PSTATE_GAMEDEFS_CUSTOM) {
|
||||||
|
return m_CustomHandler->ReadSMC_KeyValue(states, key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SMCResult_Continue;
|
return SMCResult_Continue;
|
||||||
@@ -312,6 +387,13 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
return SMCResult_Continue;
|
return SMCResult_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_CustomLevel)
|
||||||
|
{
|
||||||
|
m_CustomLevel--;
|
||||||
|
m_CustomHandler->ReadSMC_LeavingSection(states);
|
||||||
|
return SMCResult_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch (m_ParseState)
|
switch (m_ParseState)
|
||||||
{
|
{
|
||||||
case PSTATE_GAMES:
|
case PSTATE_GAMES:
|
||||||
@@ -324,6 +406,12 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
m_ParseState = PSTATE_GAMES;
|
m_ParseState = PSTATE_GAMES;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case PSTATE_GAMEDEFS_CUSTOM:
|
||||||
|
{
|
||||||
|
m_ParseState = PSTATE_GAMEDEFS;
|
||||||
|
m_CustomHandler->ReadSMC_ParseEnd(false, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case PSTATE_GAMEDEFS_KEYS:
|
case PSTATE_GAMEDEFS_KEYS:
|
||||||
case PSTATE_GAMEDEFS_OFFSETS:
|
case PSTATE_GAMEDEFS_OFFSETS:
|
||||||
{
|
{
|
||||||
@@ -350,7 +438,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
g_Logger.LogError("[SM] Unable to find property %s.%s (file \"%s\") (mod \"%s\")",
|
g_Logger.LogError("[SM] Unable to find property %s.%s (file \"%s\") (mod \"%s\")",
|
||||||
m_Class,
|
m_Class,
|
||||||
m_Prop,
|
m_Prop,
|
||||||
m_pFile,
|
m_CurFile,
|
||||||
m_Game);
|
m_Game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -400,7 +488,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
{
|
{
|
||||||
g_Logger.LogError("[SM] Unrecognized library \"%s\" (gameconf \"%s\")",
|
g_Logger.LogError("[SM] Unrecognized library \"%s\" (gameconf \"%s\")",
|
||||||
s_TempSig.library,
|
s_TempSig.library,
|
||||||
m_pFile);
|
m_CurFile);
|
||||||
} else {
|
} else {
|
||||||
#if defined PLATFORM_LINUX
|
#if defined PLATFORM_LINUX
|
||||||
if (s_TempSig.sig[0] == '@')
|
if (s_TempSig.sig[0] == '@')
|
||||||
@@ -417,12 +505,12 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
} else {
|
} else {
|
||||||
g_Logger.LogError("[SM] Unable to load library \"%s\" (gameconf \"%s\")",
|
g_Logger.LogError("[SM] Unable to load library \"%s\" (gameconf \"%s\")",
|
||||||
s_TempSig.library,
|
s_TempSig.library,
|
||||||
m_pFile);
|
m_File);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
g_Logger.LogError("[SM] Unable to find library \"%s\" in memory (gameconf \"%s\")",
|
g_Logger.LogError("[SM] Unable to find library \"%s\" in memory (gameconf \"%s\")",
|
||||||
s_TempSig.library,
|
s_TempSig.library,
|
||||||
m_pFile);
|
m_File);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (final_addr)
|
if (final_addr)
|
||||||
@@ -486,42 +574,258 @@ skip_find:
|
|||||||
return SMCResult_Continue;
|
return SMCResult_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameConfig::Reparse(char *error, size_t maxlength)
|
#define MSTATE_NONE 0
|
||||||
{
|
#define MSTATE_MAIN 1
|
||||||
SMCError err;
|
#define MSTATE_FILE 2
|
||||||
SMCStates state = {0, 0};
|
|
||||||
|
|
||||||
char path[PLATFORM_MAX_PATH];
|
class MasterReader : public ITextListener_SMC
|
||||||
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "gamedata/%s.txt", m_pFile);
|
{
|
||||||
/* Backwards compatibility */
|
public:
|
||||||
if (!g_LibSys.PathExists(path))
|
virtual void ReadSMC_ParseStart()
|
||||||
{
|
{
|
||||||
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "configs/gamedata/%s.txt", m_pFile);
|
state = MSTATE_NONE;
|
||||||
|
ignoreLevel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize parse states */
|
virtual SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name)
|
||||||
m_IgnoreLevel = 0;
|
{
|
||||||
bShouldBeReadingDefault = true;
|
if (ignoreLevel)
|
||||||
m_ParseState = PSTATE_NONE;
|
{
|
||||||
|
return SMCResult_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == MSTATE_NONE)
|
||||||
|
{
|
||||||
|
if (strcmp(name, "Game Master") == 0)
|
||||||
|
{
|
||||||
|
state = MSTATE_MAIN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ignoreLevel++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (state == MSTATE_MAIN)
|
||||||
|
{
|
||||||
|
strncopy(cur_file, name, sizeof(cur_file));
|
||||||
|
had_engine = false;
|
||||||
|
matched_engine = false;
|
||||||
|
had_game = false;
|
||||||
|
matched_game = false;
|
||||||
|
state = MSTATE_FILE;
|
||||||
|
}
|
||||||
|
else if (state == MSTATE_FILE)
|
||||||
|
{
|
||||||
|
ignoreLevel++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SMCResult_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value)
|
||||||
|
{
|
||||||
|
if (ignoreLevel || state != MSTATE_FILE)
|
||||||
|
{
|
||||||
|
return SMCResult_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(key, "engine") == 0)
|
||||||
|
{
|
||||||
|
had_engine = true;
|
||||||
|
if (DoesEngineMatch(value))
|
||||||
|
{
|
||||||
|
matched_engine = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (strcmp(key, "game") == 0)
|
||||||
|
{
|
||||||
|
had_game = true;
|
||||||
|
if (DoesGameMatch(value))
|
||||||
|
{
|
||||||
|
matched_game = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return SMCResult_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual SMCResult ReadSMC_LeavingSection(const SMCStates *states)
|
||||||
|
{
|
||||||
|
if (ignoreLevel)
|
||||||
|
{
|
||||||
|
ignoreLevel--;
|
||||||
|
return SMCResult_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == MSTATE_FILE)
|
||||||
|
{
|
||||||
|
/* The four success conditions:
|
||||||
|
* 1. Needed nothing.
|
||||||
|
* 2. Needed game only.
|
||||||
|
* 3. Needed engine only.
|
||||||
|
* 4. Needed both engine and game.
|
||||||
|
* Final result is minimized via k-map.
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
if ((!had_engine && !had_game) ||
|
||||||
|
(!had_engine && (had_game && matched_game)) ||
|
||||||
|
(!had_game && (had_engine && matched_engine)) ||
|
||||||
|
((had_game && had_engine) && (matched_game && matched_engine)))
|
||||||
|
#endif
|
||||||
|
if ((!had_engine && !had_game) ||
|
||||||
|
(!had_engine && matched_game) ||
|
||||||
|
(!had_game && matched_engine) ||
|
||||||
|
(matched_engine && matched_game))
|
||||||
|
{
|
||||||
|
fileList->push_back(cur_file);
|
||||||
|
}
|
||||||
|
state = MSTATE_MAIN;
|
||||||
|
}
|
||||||
|
else if (state == MSTATE_MAIN)
|
||||||
|
{
|
||||||
|
state = MSTATE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SMCResult_Continue;
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
List<String> *fileList;
|
||||||
|
unsigned int state;
|
||||||
|
unsigned int ignoreLevel;
|
||||||
|
char cur_file[PLATFORM_MAX_PATH];
|
||||||
|
bool had_engine;
|
||||||
|
bool matched_engine;
|
||||||
|
bool had_game;
|
||||||
|
bool matched_game;
|
||||||
|
};
|
||||||
|
|
||||||
|
static MasterReader master_reader;
|
||||||
|
|
||||||
|
bool CGameConfig::Reparse(char *error, size_t maxlength)
|
||||||
|
{
|
||||||
/* Reset cached data */
|
/* Reset cached data */
|
||||||
m_pStrings->Reset();
|
m_pStrings->Reset();
|
||||||
sm_trie_clear(m_pOffsets);
|
sm_trie_clear(m_pOffsets);
|
||||||
sm_trie_clear(m_pProps);
|
sm_trie_clear(m_pProps);
|
||||||
sm_trie_clear(m_pKeys);
|
sm_trie_clear(m_pKeys);
|
||||||
|
|
||||||
if ((err=textparsers->ParseSMCFile(path, this, &state, error, maxlength))
|
char path[PLATFORM_MAX_PATH];
|
||||||
|
|
||||||
|
/* See if we can use the extended gamedata format. */
|
||||||
|
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "gamedata/%s/master.games.txt", m_File);
|
||||||
|
if (!g_LibSys.PathExists(path))
|
||||||
|
{
|
||||||
|
/* Nope, use the old mechanism. */
|
||||||
|
UTIL_Format(path, sizeof(path), "%s.txt", m_File);
|
||||||
|
return EnterFile(path, error, maxlength);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otherwise, it's time to parse the master. */
|
||||||
|
SMCError err;
|
||||||
|
SMCStates state = {0, 0};
|
||||||
|
List<String> fileList;
|
||||||
|
master_reader.fileList = &fileList;
|
||||||
|
|
||||||
|
err = textparsers->ParseSMCFile(path, &master_reader, &state, error, maxlength);
|
||||||
|
if (err != SMCError_Okay)
|
||||||
|
{
|
||||||
|
const char *msg = textparsers->GetSMCErrorString(err);
|
||||||
|
|
||||||
|
g_Logger.LogError("[SM] Error parsing master gameconf file \"%s\":", path);
|
||||||
|
g_Logger.LogError("[SM] Error %d on line %d, col %d: %s",
|
||||||
|
err,
|
||||||
|
state.line,
|
||||||
|
state.col,
|
||||||
|
msg ? msg : "Unknown error");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Go through each file we found and parse it. */
|
||||||
|
List<String>::iterator iter;
|
||||||
|
for (iter = fileList.begin(); iter != fileList.end(); iter++)
|
||||||
|
{
|
||||||
|
UTIL_Format(path, sizeof(path), "%s/%s", m_File, (*iter).c_str());
|
||||||
|
if (!EnterFile(path, error, maxlength))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Parse the contents of the 'custom' directory */
|
||||||
|
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "gamedata/%s/custom", m_File);
|
||||||
|
IDirectory *customDir = g_LibSys.OpenDirectory(path);
|
||||||
|
|
||||||
|
if (!customDir)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (customDir->MoreFiles())
|
||||||
|
{
|
||||||
|
if (!customDir->IsEntryFile())
|
||||||
|
{
|
||||||
|
customDir->NextEntry();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *curFile = customDir->GetEntryName();
|
||||||
|
|
||||||
|
/* Only allow .txt files */
|
||||||
|
int len = strlen(curFile);
|
||||||
|
if (len > 4 && strcmp(&curFile[len-4], ".txt") != 0)
|
||||||
|
{
|
||||||
|
customDir->NextEntry();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
UTIL_Format(path, sizeof(path), "%s/custom/%s", m_File, curFile);
|
||||||
|
if (!EnterFile(path, error, maxlength))
|
||||||
|
{
|
||||||
|
g_LibSys.CloseDirectory(customDir);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
customDir->NextEntry();
|
||||||
|
}
|
||||||
|
|
||||||
|
g_LibSys.CloseDirectory(customDir);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CGameConfig::EnterFile(const char *file, char *error, size_t maxlength)
|
||||||
|
{
|
||||||
|
SMCError err;
|
||||||
|
SMCStates state = {0, 0};
|
||||||
|
|
||||||
|
g_SourceMod.BuildPath(Path_SM, m_CurFile, sizeof(m_CurFile), "gamedata/%s", file);
|
||||||
|
|
||||||
|
/* Initialize parse states */
|
||||||
|
m_IgnoreLevel = 0;
|
||||||
|
bShouldBeReadingDefault = true;
|
||||||
|
m_ParseState = PSTATE_NONE;
|
||||||
|
|
||||||
|
if ((err=textparsers->ParseSMCFile(m_CurFile, this, &state, error, maxlength))
|
||||||
!= SMCError_Okay)
|
!= SMCError_Okay)
|
||||||
{
|
{
|
||||||
const char *msg;
|
const char *msg;
|
||||||
|
|
||||||
msg = textparsers->GetSMCErrorString(err);
|
msg = textparsers->GetSMCErrorString(err);
|
||||||
|
|
||||||
g_Logger.LogError("[SM] Error parsing gameconfig file \"%s\":", path);
|
g_Logger.LogError("[SM] Error parsing gameconfig file \"%s\":", m_CurFile);
|
||||||
g_Logger.LogError("[SM] Error %d on line %d, col %d: %s",
|
g_Logger.LogError("[SM] Error %d on line %d, col %d: %s",
|
||||||
err,
|
err,
|
||||||
state.line,
|
state.line,
|
||||||
state.col,
|
state.col,
|
||||||
msg ? msg : "Unknown error");
|
msg ? msg : "Unknown error");
|
||||||
|
|
||||||
|
if (m_ParseState == PSTATE_GAMEDEFS_CUSTOM)
|
||||||
|
{
|
||||||
|
//error occurred while parsing a custom section
|
||||||
|
m_CustomHandler->ReadSMC_ParseEnd(true, true);
|
||||||
|
m_CustomHandler = NULL;
|
||||||
|
m_CustomLevel = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -630,6 +934,15 @@ void GameConfigManager::OnSourceModAllShutdown()
|
|||||||
|
|
||||||
bool GameConfigManager::LoadGameConfigFile(const char *file, IGameConfig **_pConfig, char *error, size_t maxlength)
|
bool GameConfigManager::LoadGameConfigFile(const char *file, IGameConfig **_pConfig, char *error, size_t maxlength)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
|
/* A crash was detected during last load - We block the gamedata loading so it hopefully won't happen again */
|
||||||
|
if (g_blockGameDataLoad)
|
||||||
|
{
|
||||||
|
UTIL_Format(error, maxlength, "GameData loaded blocked due to detected crash");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CGameConfig *pConfig;
|
CGameConfig *pConfig;
|
||||||
|
|
||||||
if (sm_trie_retrieve(m_pLookup, file, (void **)&pConfig))
|
if (sm_trie_retrieve(m_pLookup, file, (void **)&pConfig))
|
||||||
@@ -664,7 +977,7 @@ void GameConfigManager::CloseGameConfigFile(IGameConfig *cfg)
|
|||||||
|
|
||||||
if (pConfig->DecRefCount() == 0)
|
if (pConfig->DecRefCount() == 0)
|
||||||
{
|
{
|
||||||
sm_trie_delete(m_pLookup, pConfig->m_pFile);
|
sm_trie_delete(m_pLookup, pConfig->m_File);
|
||||||
delete pConfig;
|
delete pConfig;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -684,3 +997,35 @@ IGameConfig *GameConfigManager::ReadHandle(Handle_t hndl, IdentityToken_t *ident
|
|||||||
|
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameConfigManager::AddUserConfigHook(const char *sectionname, ITextListener_SMC *listener)
|
||||||
|
{
|
||||||
|
m_customHandlers.insert(sectionname, listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameConfigManager::RemoveUserConfigHook(const char *sectionname, ITextListener_SMC *listener)
|
||||||
|
{
|
||||||
|
ITextListener_SMC **pListener = m_customHandlers.retrieve(sectionname);
|
||||||
|
|
||||||
|
if (pListener == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*pListener != listener)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_customHandlers.remove(sectionname);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameConfigManager::AcquireLock()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameConfigManager::ReleaseLock()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|||||||
+20
-2
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -38,6 +38,8 @@
|
|||||||
#include "sm_trie.h"
|
#include "sm_trie.h"
|
||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "sm_memtable.h"
|
#include "sm_memtable.h"
|
||||||
|
#include "sm_trie_tpl.h"
|
||||||
|
#include "ThreadSupport.h"
|
||||||
|
|
||||||
using namespace SourceMod;
|
using namespace SourceMod;
|
||||||
using namespace SourceHook;
|
using namespace SourceHook;
|
||||||
@@ -54,6 +56,7 @@ public:
|
|||||||
~CGameConfig();
|
~CGameConfig();
|
||||||
public:
|
public:
|
||||||
bool Reparse(char *error, size_t maxlength);
|
bool Reparse(char *error, size_t maxlength);
|
||||||
|
bool EnterFile(const char *file, char *error, size_t maxlength);
|
||||||
public: //ITextListener_SMC
|
public: //ITextListener_SMC
|
||||||
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
|
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
|
||||||
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
|
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
|
||||||
@@ -68,7 +71,8 @@ public:
|
|||||||
unsigned int DecRefCount();
|
unsigned int DecRefCount();
|
||||||
private:
|
private:
|
||||||
BaseStringTable *m_pStrings;
|
BaseStringTable *m_pStrings;
|
||||||
char *m_pFile;
|
char m_File[PLATFORM_MAX_PATH];
|
||||||
|
char m_CurFile[PLATFORM_MAX_PATH];
|
||||||
Trie *m_pOffsets;
|
Trie *m_pOffsets;
|
||||||
Trie *m_pProps;
|
Trie *m_pProps;
|
||||||
Trie *m_pKeys;
|
Trie *m_pKeys;
|
||||||
@@ -82,6 +86,14 @@ private:
|
|||||||
char m_offset[64];
|
char m_offset[64];
|
||||||
char m_Game[256];
|
char m_Game[256];
|
||||||
bool bShouldBeReadingDefault;
|
bool bShouldBeReadingDefault;
|
||||||
|
bool had_game;
|
||||||
|
bool matched_game;
|
||||||
|
bool had_engine;
|
||||||
|
bool matched_engine;
|
||||||
|
|
||||||
|
/* Custom Sections */
|
||||||
|
unsigned int m_CustomLevel;
|
||||||
|
ITextListener_SMC *m_CustomHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GameConfigManager :
|
class GameConfigManager :
|
||||||
@@ -97,6 +109,10 @@ public: //IGameConfigManager
|
|||||||
IGameConfig *ReadHandle(Handle_t hndl,
|
IGameConfig *ReadHandle(Handle_t hndl,
|
||||||
IdentityToken_t *ident,
|
IdentityToken_t *ident,
|
||||||
HandleError *err);
|
HandleError *err);
|
||||||
|
void AddUserConfigHook(const char *sectionname, ITextListener_SMC *listener);
|
||||||
|
void RemoveUserConfigHook(const char *sectionname, ITextListener_SMC *listener);
|
||||||
|
void AcquireLock();
|
||||||
|
void ReleaseLock();
|
||||||
public: //SMGlobalClass
|
public: //SMGlobalClass
|
||||||
void OnSourceModStartup(bool late);
|
void OnSourceModStartup(bool late);
|
||||||
void OnSourceModAllInitialized();
|
void OnSourceModAllInitialized();
|
||||||
@@ -104,6 +120,8 @@ public: //SMGlobalClass
|
|||||||
private:
|
private:
|
||||||
List<CGameConfig *> m_cfgs;
|
List<CGameConfig *> m_cfgs;
|
||||||
Trie *m_pLookup;
|
Trie *m_pLookup;
|
||||||
|
public:
|
||||||
|
KTrie<ITextListener_SMC *> m_customHandlers;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GameConfigManager g_GameConfigs;
|
extern GameConfigManager g_GameConfigs;
|
||||||
|
|||||||
+134
-3
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -88,11 +88,16 @@ CHalfLife2::~CHalfLife2()
|
|||||||
m_Maps.clear();
|
m_Maps.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
CSharedEdictChangeInfo *g_pSharedChangeInfo = NULL;
|
CSharedEdictChangeInfo *g_pSharedChangeInfo = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool is_original_engine = false;
|
bool is_original_engine = false;
|
||||||
|
|
||||||
void CHalfLife2::OnSourceModStartup(bool late)
|
void CHalfLife2::OnSourceModStartup(bool late)
|
||||||
{
|
{
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
|
|
||||||
/* The Ship currently is the only known game to use an older version of the engine */
|
/* The Ship currently is the only known game to use an older version of the engine */
|
||||||
#if defined METAMOD_PLAPI_VERSION
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL)
|
if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL)
|
||||||
@@ -106,12 +111,14 @@ void CHalfLife2::OnSourceModStartup(bool late)
|
|||||||
{
|
{
|
||||||
g_pSharedChangeInfo = engine->GetSharedEdictChangeInfo();
|
g_pSharedChangeInfo = engine->GetSharedEdictChangeInfo();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHalfLife2::OnSourceModAllInitialized()
|
void CHalfLife2::OnSourceModAllInitialized()
|
||||||
{
|
{
|
||||||
m_MsgTextMsg = g_UserMsgs.GetMessageIndex("TextMsg");
|
m_MsgTextMsg = g_UserMsgs.GetMessageIndex("TextMsg");
|
||||||
m_HinTextMsg = g_UserMsgs.GetMessageIndex("HintText");
|
m_HinTextMsg = g_UserMsgs.GetMessageIndex("HintText");
|
||||||
|
m_SayTextMsg = g_UserMsgs.GetMessageIndex("SayText");
|
||||||
m_VGUIMenu = g_UserMsgs.GetMessageIndex("VGUIMenu");
|
m_VGUIMenu = g_UserMsgs.GetMessageIndex("VGUIMenu");
|
||||||
g_ShareSys.AddInterface(NULL, this);
|
g_ShareSys.AddInterface(NULL, this);
|
||||||
}
|
}
|
||||||
@@ -123,10 +130,12 @@ bool CHalfLife2::IsOriginalEngine()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
|
IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
|
||||||
{
|
{
|
||||||
return engine->GetChangeAccessor( (const edict_t *)this );
|
return engine->GetChangeAccessor( (const edict_t *)this );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool UTIL_FindInSendTable(SendTable *pTable,
|
bool UTIL_FindInSendTable(SendTable *pTable,
|
||||||
const char *name,
|
const char *name,
|
||||||
@@ -296,6 +305,7 @@ typedescription_t *CHalfLife2::FindInDataMap(datamap_t *pMap, const char *offset
|
|||||||
|
|
||||||
void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
|
void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
|
||||||
{
|
{
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
if (g_pSharedChangeInfo != NULL)
|
if (g_pSharedChangeInfo != NULL)
|
||||||
{
|
{
|
||||||
if (offset)
|
if (offset)
|
||||||
@@ -308,6 +318,7 @@ void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
pEdict->m_fStateFlags |= FL_EDICT_CHANGED;
|
pEdict->m_fStateFlags |= FL_EDICT_CHANGED;
|
||||||
}
|
}
|
||||||
@@ -318,6 +329,31 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
|
|||||||
bf_write *pBitBuf = NULL;
|
bf_write *pBitBuf = NULL;
|
||||||
cell_t players[] = {client};
|
cell_t players[] = {client};
|
||||||
|
|
||||||
|
if (dest == HUD_PRINTTALK)
|
||||||
|
{
|
||||||
|
const char *chat_saytext = g_pGameConf->GetKeyValue("ChatSayText");
|
||||||
|
|
||||||
|
/* Use SayText user message instead */
|
||||||
|
if (chat_saytext != NULL && strcmp(chat_saytext, "yes") == 0)
|
||||||
|
{
|
||||||
|
char buffer[192];
|
||||||
|
UTIL_Format(buffer, sizeof(buffer), "%s\1\n", msg);
|
||||||
|
|
||||||
|
if ((pBitBuf = g_UserMsgs.StartMessage(m_SayTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pBitBuf->WriteByte(0);
|
||||||
|
pBitBuf->WriteString(buffer);
|
||||||
|
pBitBuf->WriteByte(1);
|
||||||
|
|
||||||
|
g_UserMsgs.EndMessage();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((pBitBuf = g_UserMsgs.StartMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
if ((pBitBuf = g_UserMsgs.StartMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -325,6 +361,7 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
|
|||||||
|
|
||||||
pBitBuf->WriteByte(dest);
|
pBitBuf->WriteByte(dest);
|
||||||
pBitBuf->WriteString(msg);
|
pBitBuf->WriteString(msg);
|
||||||
|
|
||||||
g_UserMsgs.EndMessage();
|
g_UserMsgs.EndMessage();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -481,7 +518,7 @@ void CHalfLife2::PushCommandStack(const CCommand *cmd)
|
|||||||
CachedCommandInfo info;
|
CachedCommandInfo info;
|
||||||
|
|
||||||
info.args = cmd;
|
info.args = cmd;
|
||||||
#if !defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE <= SE_DARKMESSIAH
|
||||||
strncopy(info.cmd, cmd->Arg(0), sizeof(info.cmd));
|
strncopy(info.cmd, cmd->Arg(0), sizeof(info.cmd));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -505,9 +542,103 @@ void CHalfLife2::PopCommandStack()
|
|||||||
|
|
||||||
const char *CHalfLife2::CurrentCommandName()
|
const char *CHalfLife2::CurrentCommandName()
|
||||||
{
|
{
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
return m_CommandStack.front().args->Arg(0);
|
return m_CommandStack.front().args->Arg(0);
|
||||||
#else
|
#else
|
||||||
return m_CommandStack.front().cmd;
|
return m_CommandStack.front().cmd;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CHalfLife2::AddDelayedKick(int client, int userid, const char *msg)
|
||||||
|
{
|
||||||
|
DelayedKickInfo kick;
|
||||||
|
|
||||||
|
kick.client = client;
|
||||||
|
kick.userid = userid;
|
||||||
|
UTIL_Format(kick.buffer, sizeof(kick.buffer), "%s", msg);
|
||||||
|
|
||||||
|
m_DelayedKicks.push(kick);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CHalfLife2::ProcessDelayedKicks()
|
||||||
|
{
|
||||||
|
while (!m_DelayedKicks.empty())
|
||||||
|
{
|
||||||
|
DelayedKickInfo info = m_DelayedKicks.first();
|
||||||
|
m_DelayedKicks.pop();
|
||||||
|
|
||||||
|
CPlayer *player = g_Players.GetPlayerByIndex(info.client);
|
||||||
|
if (player == NULL || player->GetUserId() != info.userid)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
player->Kick(info.buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
edict_t *CHalfLife2::EdictOfIndex(int index)
|
||||||
|
{
|
||||||
|
return ::PEntityOfEntIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CHalfLife2::IndexOfEdict(edict_t *pEnt)
|
||||||
|
{
|
||||||
|
return ::IndexOfEdict(pEnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
edict_t *CHalfLife2::GetHandleEntity(CBaseHandle &hndl)
|
||||||
|
{
|
||||||
|
if (!hndl.IsValid())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = hndl.GetEntryIndex();
|
||||||
|
|
||||||
|
edict_t *pStoredEdict;
|
||||||
|
CBaseEntity *pStoredEntity;
|
||||||
|
|
||||||
|
pStoredEdict = GetEntity(index, &pStoredEntity);
|
||||||
|
|
||||||
|
if (pStoredEdict == NULL || pStoredEntity == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
IServerEntity *pSE = pStoredEdict->GetIServerEntity();
|
||||||
|
|
||||||
|
if (pSE == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pSE->GetRefEHandle() != hndl)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pStoredEdict;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CHalfLife2::SetHandleEntity(CBaseHandle &hndl, edict_t *pEnt)
|
||||||
|
{
|
||||||
|
IServerEntity *pEntOther = pEnt->GetIServerEntity();
|
||||||
|
|
||||||
|
if (pEntOther == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hndl.Set(pEntOther);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *CHalfLife2::GetCurrentMap()
|
||||||
|
{
|
||||||
|
return STRING(gpGlobals->mapname);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CHalfLife2::ServerCommand(const char *buffer)
|
||||||
|
{
|
||||||
|
engine->ServerCommand(buffer);
|
||||||
|
}
|
||||||
|
|||||||
+21
-2
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -74,11 +74,18 @@ struct DelayedFakeCliCmd
|
|||||||
struct CachedCommandInfo
|
struct CachedCommandInfo
|
||||||
{
|
{
|
||||||
const CCommand *args;
|
const CCommand *args;
|
||||||
#if !defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE <= SE_DARKMESSIAH
|
||||||
char cmd[300];
|
char cmd[300];
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct DelayedKickInfo
|
||||||
|
{
|
||||||
|
int userid;
|
||||||
|
int client;
|
||||||
|
char buffer[384];
|
||||||
|
};
|
||||||
|
|
||||||
class CHalfLife2 :
|
class CHalfLife2 :
|
||||||
public SMGlobalClass,
|
public SMGlobalClass,
|
||||||
public IGameHelpers
|
public IGameHelpers
|
||||||
@@ -102,6 +109,12 @@ public: //IGameHelpers
|
|||||||
bool ShowVGUIMenu(int client, const char *name, KeyValues *data, bool show);
|
bool ShowVGUIMenu(int client, const char *name, KeyValues *data, bool show);
|
||||||
bool IsLANServer();
|
bool IsLANServer();
|
||||||
bool KVLoadFromFile(KeyValues *kv, IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL);
|
bool KVLoadFromFile(KeyValues *kv, IBaseFileSystem *filesystem, const char *resourceName, const char *pathID = NULL);
|
||||||
|
edict_t *EdictOfIndex(int index);
|
||||||
|
int IndexOfEdict(edict_t *pEnt);
|
||||||
|
edict_t *GetHandleEntity(CBaseHandle &hndl);
|
||||||
|
void SetHandleEntity(CBaseHandle &hndl, edict_t *pEnt);
|
||||||
|
const char *GetCurrentMap();
|
||||||
|
void ServerCommand(const char *buffer);
|
||||||
public:
|
public:
|
||||||
void AddToFakeCliCmdQueue(int client, int userid, const char *cmd);
|
void AddToFakeCliCmdQueue(int client, int userid, const char *cmd);
|
||||||
void ProcessFakeCliCmdQueue();
|
void ProcessFakeCliCmdQueue();
|
||||||
@@ -110,6 +123,8 @@ public:
|
|||||||
void PopCommandStack();
|
void PopCommandStack();
|
||||||
const CCommand *PeekCommandStack();
|
const CCommand *PeekCommandStack();
|
||||||
const char *CurrentCommandName();
|
const char *CurrentCommandName();
|
||||||
|
void AddDelayedKick(int client, int userid, const char *msg);
|
||||||
|
void ProcessDelayedKicks();
|
||||||
#if !defined METAMOD_PLAPI_VERSION
|
#if !defined METAMOD_PLAPI_VERSION
|
||||||
bool IsOriginalEngine();
|
bool IsOriginalEngine();
|
||||||
#endif
|
#endif
|
||||||
@@ -121,12 +136,16 @@ private:
|
|||||||
THash<datamap_t *, DataMapTrie> m_Maps;
|
THash<datamap_t *, DataMapTrie> m_Maps;
|
||||||
int m_MsgTextMsg;
|
int m_MsgTextMsg;
|
||||||
int m_HinTextMsg;
|
int m_HinTextMsg;
|
||||||
|
int m_SayTextMsg;
|
||||||
int m_VGUIMenu;
|
int m_VGUIMenu;
|
||||||
Queue<DelayedFakeCliCmd *> m_CmdQueue;
|
Queue<DelayedFakeCliCmd *> m_CmdQueue;
|
||||||
CStack<DelayedFakeCliCmd *> m_FreeCmds;
|
CStack<DelayedFakeCliCmd *> m_FreeCmds;
|
||||||
CStack<CachedCommandInfo> m_CommandStack;
|
CStack<CachedCommandInfo> m_CommandStack;
|
||||||
|
Queue<DelayedKickInfo> m_DelayedKicks;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CHalfLife2 g_HL2;
|
extern CHalfLife2 g_HL2;
|
||||||
|
|
||||||
|
edict_t *GetEntity(cell_t num, CBaseEntity **pData);
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_CHALFLIFE2_H_
|
#endif //_INCLUDE_SOURCEMOD_CHALFLIFE2_H_
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -493,7 +493,7 @@ HandleError HandleSystem::GetHandle(Handle_t handle,
|
|||||||
unsigned int serial = (handle >> 16);
|
unsigned int serial = (handle >> 16);
|
||||||
unsigned int index = (handle & HANDLESYS_HANDLE_MASK);
|
unsigned int index = (handle & HANDLESYS_HANDLE_MASK);
|
||||||
|
|
||||||
if (index == 0 || index == 0xFFFF)
|
if (index == 0 || index > m_HandleTail || index > HANDLESYS_MAX_HANDLES)
|
||||||
{
|
{
|
||||||
return HandleError_Index;
|
return HandleError_Index;
|
||||||
}
|
}
|
||||||
@@ -910,6 +910,15 @@ bool HandleSystem::RemoveType(HandleType_t type, IdentityToken_t *ident)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Remove it from the type cache. */
|
||||||
|
if (pType->nameIdx != -1)
|
||||||
|
{
|
||||||
|
const char *typeName;
|
||||||
|
|
||||||
|
typeName = m_strtab->GetString(pType->nameIdx);
|
||||||
|
sm_trie_delete(m_TypeLookup, typeName);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -987,10 +996,10 @@ bool HandleSystem::TryAndFreeSomeHandles()
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_Logger.LogFatal("[SM] MEMORY LEAK DETECTED IN PLUGIN (file \"%s\")", highest_owner->GetFilename());
|
g_Logger.LogFatal("[SM] MEMORY LEAK DETECTED IN PLUGIN (file \"%s\")", highest_owner->GetFilename());
|
||||||
g_Logger.LogFatal("[SM] Reloading plugin to free %d handles.", highest_handle_count);
|
g_Logger.LogFatal("[SM] Unloading plugin to free %d handles.", highest_handle_count);
|
||||||
g_Logger.LogFatal("[SM] Contact the author(s) of this plugin to correct this error.", highest_handle_count);
|
g_Logger.LogFatal("[SM] Contact the author(s) of this plugin to correct this error.", highest_handle_count);
|
||||||
|
|
||||||
highest_owner->GetContext()->n_err = SP_ERROR_MEMACCESS;
|
highest_owner->GetBaseContext()->ThrowNativeErrorEx(SP_ERROR_MEMACCESS, "Memory leak");
|
||||||
|
|
||||||
return g_PluginSys.UnloadPlugin(highest_owner);
|
return g_PluginSys.UnloadPlugin(highest_owner);
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -138,7 +138,7 @@ bool CDirectory::IsEntryDirectory()
|
|||||||
{
|
{
|
||||||
#if defined PLATFORM_WINDOWS
|
#if defined PLATFORM_WINDOWS
|
||||||
return ((m_fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY);
|
return ((m_fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY);
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_POSIX
|
||||||
char temppath[PLATFORM_MAX_PATH];
|
char temppath[PLATFORM_MAX_PATH];
|
||||||
snprintf(temppath, sizeof(temppath), "%s/%s", m_origpath, GetEntryName());
|
snprintf(temppath, sizeof(temppath), "%s/%s", m_origpath, GetEntryName());
|
||||||
return g_LibSys.IsPathDirectory(temppath);
|
return g_LibSys.IsPathDirectory(temppath);
|
||||||
@@ -160,7 +160,7 @@ const char *CDirectory::GetEntryName()
|
|||||||
{
|
{
|
||||||
#if defined PLATFORM_WINDOWS
|
#if defined PLATFORM_WINDOWS
|
||||||
return m_fd.cFileName;
|
return m_fd.cFileName;
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_POSIX
|
||||||
return ep ? ep->d_name : "";
|
return ep ? ep->d_name : "";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -174,7 +174,7 @@ bool CDirectory::IsValid()
|
|||||||
{
|
{
|
||||||
#if defined PLATFORM_WINDOWS
|
#if defined PLATFORM_WINDOWS
|
||||||
return (m_dir != INVALID_HANDLE_VALUE);
|
return (m_dir != INVALID_HANDLE_VALUE);
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_POSIX
|
||||||
return (m_dir != NULL);
|
return (m_dir != NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -214,7 +214,7 @@ bool LibrarySystem::IsPathFile(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
#elif defined PLATFORM_LINUX
|
#elif defined PLATFORM_POSIX
|
||||||
struct stat s;
|
struct stat s;
|
||||||
|
|
||||||
if (stat(path, &s) != 0)
|
if (stat(path, &s) != 0)
|
||||||
@@ -272,21 +272,37 @@ IDirectory *LibrarySystem::OpenDirectory(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LibrarySystem::GetPlatformError(char *error, size_t maxlength)
|
void LibrarySystem::GetPlatformError(char *error, size_t maxlength)
|
||||||
|
{
|
||||||
|
#if defined PLATFORM_WINDOWS
|
||||||
|
return GetPlatformErrorEx(GetLastError(), error, maxlength);
|
||||||
|
#elif defined PLATFORM_POSIX
|
||||||
|
return GetPlatformErrorEx(errno, error, maxlength);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibrarySystem::GetPlatformErrorEx(int code, char *error, size_t maxlength)
|
||||||
{
|
{
|
||||||
if (error && maxlength)
|
if (error && maxlength)
|
||||||
{
|
{
|
||||||
#if defined PLATFORM_WINDOWS
|
#if defined PLATFORM_WINDOWS
|
||||||
DWORD dw = GetLastError();
|
if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
FormatMessageA(
|
NULL,
|
||||||
FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
(DWORD)code,
|
||||||
NULL,
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
dw,
|
(LPSTR)error,
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
maxlength,
|
||||||
(LPSTR)error,
|
NULL) == 0)
|
||||||
maxlength,
|
{
|
||||||
NULL);
|
UTIL_Format(error, maxlength, "error code %08x", code);
|
||||||
|
}
|
||||||
|
#elif defined PLATFORM_LINUX
|
||||||
|
const char *ae = strerror_r(code, error, maxlength);
|
||||||
|
if (ae != error)
|
||||||
|
{
|
||||||
|
UTIL_Format(error, maxlength, "%s", ae);
|
||||||
|
}
|
||||||
#elif defined PLATFORM_POSIX
|
#elif defined PLATFORM_POSIX
|
||||||
UTIL_Format(error, maxlength, "%s", strerror(errno));
|
strerror_r(code, error, maxlength);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -90,6 +90,7 @@ public:
|
|||||||
bool IsPathFile(const char *path);
|
bool IsPathFile(const char *path);
|
||||||
bool IsPathDirectory(const char *path);
|
bool IsPathDirectory(const char *path);
|
||||||
void GetPlatformError(char *error, size_t maxlength);
|
void GetPlatformError(char *error, size_t maxlength);
|
||||||
|
void GetPlatformErrorEx(int code, char *error, size_t maxlength);
|
||||||
size_t PathFormat(char *buffer, size_t len, const char *fmt, ...);
|
size_t PathFormat(char *buffer, size_t len, const char *fmt, ...);
|
||||||
const char *GetFileExtension(const char *filename);
|
const char *GetFileExtension(const char *filename);
|
||||||
bool CreateFolder(const char *path);
|
bool CreateFolder(const char *path);
|
||||||
+35
-2
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
#include "sourcemm_api.h"
|
#include "sourcemm_api.h"
|
||||||
#include "sm_stringutil.h"
|
#include "sm_stringutil.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "systems/LibrarySys.h"
|
#include "LibrarySys.h"
|
||||||
#include "TimerSys.h"
|
#include "TimerSys.h"
|
||||||
#include "sm_version.h"
|
#include "sm_version.h"
|
||||||
|
|
||||||
@@ -245,6 +245,19 @@ void Logger::LogToOpenFile(FILE *fp, const char *msg, ...)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Logger::LogToFileOnly(FILE *fp, const char *msg, ...)
|
||||||
|
{
|
||||||
|
if (!m_Active)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, msg);
|
||||||
|
LogToFileOnlyEx(fp, msg, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
void Logger::LogToOpenFileEx(FILE *fp, const char *msg, va_list ap)
|
void Logger::LogToOpenFileEx(FILE *fp, const char *msg, va_list ap)
|
||||||
{
|
{
|
||||||
if (!m_Active)
|
if (!m_Active)
|
||||||
@@ -265,6 +278,26 @@ void Logger::LogToOpenFileEx(FILE *fp, const char *msg, va_list ap)
|
|||||||
g_SMAPI->ConPrintf("L %s: %s\n", date, buffer);
|
g_SMAPI->ConPrintf("L %s: %s\n", date, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Logger::LogToFileOnlyEx(FILE *fp, const char *msg, va_list ap)
|
||||||
|
{
|
||||||
|
if (!m_Active)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char buffer[3072];
|
||||||
|
UTIL_FormatArgs(buffer, sizeof(buffer), msg, ap);
|
||||||
|
|
||||||
|
char date[32];
|
||||||
|
time_t t;
|
||||||
|
GetAdjustedTime(&t);
|
||||||
|
tm *curtime = localtime(&t);
|
||||||
|
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
|
||||||
|
|
||||||
|
fprintf(fp, "L %s: %s\n", date, buffer);
|
||||||
|
fflush(fp);
|
||||||
|
}
|
||||||
|
|
||||||
void Logger::LogMessage(const char *vafmt, ...)
|
void Logger::LogMessage(const char *vafmt, ...)
|
||||||
{
|
{
|
||||||
if (!m_Active)
|
if (!m_Active)
|
||||||
|
|||||||
+4
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -78,6 +78,9 @@ public:
|
|||||||
void LogFatal(const char *msg, ...);
|
void LogFatal(const char *msg, ...);
|
||||||
void LogToOpenFile(FILE *fp, const char *msg, ...);
|
void LogToOpenFile(FILE *fp, const char *msg, ...);
|
||||||
void LogToOpenFileEx(FILE *fp, const char *msg, va_list ap);
|
void LogToOpenFileEx(FILE *fp, const char *msg, va_list ap);
|
||||||
|
/* This version does not print to console, and is thus thread-safe */
|
||||||
|
void LogToFileOnly(FILE *fp, const char *msg, ...);
|
||||||
|
void LogToFileOnlyEx(FILE *fp, const char *msg, va_list ap);
|
||||||
void MapChange(const char *mapname);
|
void MapChange(const char *mapname);
|
||||||
const char *GetLogFileName(LogType type) const;
|
const char *GetLogFileName(LogType type) const;
|
||||||
LoggingMode GetLoggingMode() const;
|
LoggingMode GetLoggingMode() const;
|
||||||
|
|||||||
+51
-35
@@ -5,8 +5,9 @@ SMSDK = ..
|
|||||||
SRCDS_BASE = ~/srcds
|
SRCDS_BASE = ~/srcds
|
||||||
HL2SDK_ORIG = ../../hl2sdk
|
HL2SDK_ORIG = ../../hl2sdk
|
||||||
HL2SDK_OB = ../../hl2sdk-ob
|
HL2SDK_OB = ../../hl2sdk-ob
|
||||||
SOURCEMM14 = ../../sourcemm-1.4
|
HL2SDK_OB_VALVE = ../../hl2sdk-ob-valve
|
||||||
SOURCEMM16 = ../../sourcemm-1.6
|
HL2SDK_L4D = ../../hl2sdk-l4d
|
||||||
|
MMSOURCE17 = ../../mmsource-1.7
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||||
@@ -18,22 +19,24 @@ OBJECTS = AdminCache.cpp CDataPack.cpp ConCmdManager.cpp ConVarManager.cpp CoreC
|
|||||||
sm_autonatives.cpp sm_memtable.cpp sm_srvcmds.cpp sm_stringutil.cpp sm_trie.cpp \
|
sm_autonatives.cpp sm_memtable.cpp sm_srvcmds.cpp sm_stringutil.cpp sm_trie.cpp \
|
||||||
sourcemm_api.cpp sourcemod.cpp MenuStyle_Base.cpp MenuStyle_Valve.cpp MenuManager.cpp \
|
sourcemm_api.cpp sourcemod.cpp MenuStyle_Base.cpp MenuStyle_Valve.cpp MenuManager.cpp \
|
||||||
MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp sm_crc32.cpp \
|
MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp sm_crc32.cpp \
|
||||||
frame_hooks.cpp concmd_cleaner.cpp Profiler.cpp
|
frame_hooks.cpp concmd_cleaner.cpp Profiler.cpp PhraseCollection.cpp NextMap.cpp \
|
||||||
|
NativeOwner.cpp
|
||||||
OBJECTS += smn_admin.cpp smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
|
OBJECTS += smn_admin.cpp smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
|
||||||
smn_datapacks.cpp smn_entities.cpp smn_events.cpp smn_fakenatives.cpp \
|
smn_datapacks.cpp smn_entities.cpp smn_events.cpp smn_fakenatives.cpp \
|
||||||
smn_filesystem.cpp smn_float.cpp smn_functions.cpp smn_gameconfigs.cpp smn_halflife.cpp \
|
smn_filesystem.cpp smn_float.cpp smn_functions.cpp smn_gameconfigs.cpp smn_halflife.cpp \
|
||||||
smn_handles.cpp smn_keyvalues.cpp smn_banning.cpp smn_maplists.cpp \
|
smn_handles.cpp smn_keyvalues.cpp smn_banning.cpp smn_maplists.cpp \
|
||||||
smn_lang.cpp smn_player.cpp smn_string.cpp smn_sorting.cpp smn_textparse.cpp smn_timers.cpp \
|
smn_lang.cpp smn_player.cpp smn_string.cpp smn_sorting.cpp smn_textparse.cpp smn_timers.cpp \
|
||||||
smn_usermsgs.cpp smn_menus.cpp smn_database.cpp smn_vector.cpp smn_adt_array.cpp \
|
smn_usermsgs.cpp smn_menus.cpp smn_database.cpp smn_vector.cpp smn_adt_array.cpp \
|
||||||
smn_adt_trie.cpp smn_hudtext.cpp
|
smn_adt_trie.cpp smn_hudtext.cpp smn_adt_stack.cpp smn_nextmap.cpp
|
||||||
OBJECTS += systems/ExtensionSys.cpp systems/ForwardSys.cpp systems/HandleSys.cpp \
|
OBJECTS += ExtensionSys.cpp \
|
||||||
systems/LibrarySys.cpp systems/PluginInfoDatabase.cpp systems/PluginSys.cpp \
|
ForwardSys.cpp \
|
||||||
systems/ShareSys.cpp vm/sp_vm_basecontext.cpp vm/sp_vm_engine.cpp \
|
HandleSys.cpp \
|
||||||
vm/sp_vm_function.cpp
|
LibrarySys.cpp \
|
||||||
|
PluginInfoDatabase.cpp \
|
||||||
|
PluginSys.cpp \
|
||||||
|
ShareSys.cpp \
|
||||||
|
NativeInvoker.cpp
|
||||||
OBJECTS += thread/ThreadWorker.cpp thread/BaseWorker.cpp thread/PosixThreads.cpp ThreadSupport.cpp
|
OBJECTS += thread/ThreadWorker.cpp thread/BaseWorker.cpp thread/PosixThreads.cpp ThreadSupport.cpp
|
||||||
OBJECTS += zlib/adler32.c zlib/compress.c zlib/crc32.c zlib/deflate.c zlib/gzio.c \
|
|
||||||
zlib/infback.c zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c \
|
|
||||||
zlib/uncompr.c zlib/zutil.c
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
|
||||||
@@ -43,14 +46,15 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
|
|||||||
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
|
||||||
C_GCC4_FLAGS = -fvisibility=hidden
|
C_GCC4_FLAGS = -fvisibility=hidden
|
||||||
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
|
||||||
CPP = gcc-4.1
|
CPP = gcc
|
||||||
|
|
||||||
override ENGSET = false
|
override ENGSET = false
|
||||||
ifeq "$(ENGINE)" "original"
|
ifeq "$(ENGINE)" "original"
|
||||||
HL2SDK = $(HL2SDK_ORIG)
|
HL2SDK = $(HL2SDK_ORIG)
|
||||||
HL2PUB = $(HL2SDK_ORIG)/public
|
HL2PUB = $(HL2SDK)/public
|
||||||
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
|
HL2LIB = $(HL2SDK)/linux_sdk
|
||||||
METAMOD = $(SOURCEMM14)
|
CFLAGS += -DSOURCE_ENGINE=1
|
||||||
|
METAMOD = $(MMSOURCE17)/core-legacy
|
||||||
INCLUDE += -I$(HL2SDK)/public/dlls
|
INCLUDE += -I$(HL2SDK)/public/dlls
|
||||||
SRCDS = $(SRCDS_BASE)
|
SRCDS = $(SRCDS_BASE)
|
||||||
BINARY = sourcemod.1.ep1.so
|
BINARY = sourcemod.1.ep1.so
|
||||||
@@ -58,26 +62,46 @@ ifeq "$(ENGINE)" "original"
|
|||||||
endif
|
endif
|
||||||
ifeq "$(ENGINE)" "orangebox"
|
ifeq "$(ENGINE)" "orangebox"
|
||||||
HL2SDK = $(HL2SDK_OB)
|
HL2SDK = $(HL2SDK_OB)
|
||||||
HL2PUB = $(HL2SDK_OB)/public
|
HL2PUB = $(HL2SDK)/public
|
||||||
HL2LIB = $(HL2SDK_OB)/linux_sdk
|
HL2LIB = $(HL2SDK)/lib/linux
|
||||||
CFLAGS += -DORANGEBOX_BUILD
|
CFLAGS += -DSOURCE_ENGINE=3
|
||||||
METAMOD = $(SOURCEMM16)
|
METAMOD = $(MMSOURCE17)/core
|
||||||
INCLUDE += -I$(HL2SDK)/public/game/server
|
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||||
SRCDS = $(SRCDS_BASE)/orangebox
|
SRCDS = $(SRCDS_BASE)/orangebox
|
||||||
BINARY = sourcemod.2.ep2.so
|
BINARY = sourcemod.2.ep2.so
|
||||||
override ENGSET = true
|
override ENGSET = true
|
||||||
endif
|
endif
|
||||||
|
ifeq "$(ENGINE)" "orangeboxvalve"
|
||||||
|
HL2SDK = $(HL2SDK_OB_VALVE)
|
||||||
|
HL2PUB = $(HL2SDK)/public
|
||||||
|
HL2LIB = $(HL2SDK)/lib/linux
|
||||||
|
CFLAGS += -DSOURCE_ENGINE=4
|
||||||
|
METAMOD = $(MMSOURCE17)/core
|
||||||
|
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||||
|
SRCDS = $(SRCDS_BASE)/orangebox
|
||||||
|
BINARY = sourcemod.2.ep2v.so
|
||||||
|
override ENGSET = true
|
||||||
|
endif
|
||||||
|
ifeq "$(ENGINE)" "left4dead"
|
||||||
|
HL2SDK = $(HL2SDK_L4D)
|
||||||
|
HL2PUB = $(HL2SDK)/public
|
||||||
|
HL2LIB = $(HL2SDK)/lib/linux
|
||||||
|
CFLAGS += -DSOURCE_ENGINE=5
|
||||||
|
METAMOD = $(MMSOURCE17)/core
|
||||||
|
INCLUDE += -I$(HL2SDK)/public/game/server
|
||||||
|
SRCDS = $(SRCDS_BASE)/l4d
|
||||||
|
BINARY = sourcemod.2.l4d.so
|
||||||
|
override ENGSET = true
|
||||||
|
endif
|
||||||
|
|
||||||
|
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 -DSE_LEFT4DEAD=5
|
||||||
|
|
||||||
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a vstdlib_i486.so \
|
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a vstdlib_i486.so \
|
||||||
tier0_i486.so -lpthread -static-libgcc
|
tier0_i486.so -lpthread -static-libgcc
|
||||||
|
|
||||||
INCLUDE_SMSDK = -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
|
||||||
|
|
||||||
INCLUDE_SM16 = -I. -I.. -I$(SOURCEMM16)/sourcehook $(INCLUDE_SMSDK)
|
|
||||||
|
|
||||||
INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \
|
INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \
|
||||||
-I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook \
|
-I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook \
|
||||||
-I$(METAMOD)/sourcemm -Isystems $(INCLUDE_SMSDK)
|
-I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
|
||||||
|
|
||||||
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||||
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror \
|
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror \
|
||||||
@@ -102,13 +126,9 @@ ifeq "$(GCC_VERSION)" "4"
|
|||||||
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
CPPFLAGS += $(CPP_GCC4_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OBJ_LINUX := $(OBJECTS:%vm_engine.cpp=$(BIN_DIR)/%vm_engine.o)
|
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||||
OBJ_LINUX := $(OBJ_LINUX:%.cpp=$(BIN_DIR)/%.o)
|
|
||||||
OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o)
|
OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o)
|
||||||
|
|
||||||
$(BIN_DIR)/%vm_engine.o: %vm_engine.cpp
|
|
||||||
$(CPP) $(INCLUDE_SM16) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
|
||||||
|
|
||||||
$(BIN_DIR)/%.o: %.cpp
|
$(BIN_DIR)/%.o: %.cpp
|
||||||
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
@@ -117,16 +137,14 @@ $(BIN_DIR)/%.o: %.c
|
|||||||
|
|
||||||
all: check
|
all: check
|
||||||
mkdir -p $(BIN_DIR)/systems
|
mkdir -p $(BIN_DIR)/systems
|
||||||
mkdir -p $(BIN_DIR)/vm
|
|
||||||
mkdir -p $(BIN_DIR)/zlib
|
|
||||||
mkdir -p $(BIN_DIR)/thread
|
mkdir -p $(BIN_DIR)/thread
|
||||||
ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so;
|
ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so;
|
||||||
ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so;
|
ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so;
|
||||||
$(MAKE) -f Makefile sourcemod
|
$(MAKE) -f Makefile sourcemod
|
||||||
|
|
||||||
check:
|
check:
|
||||||
if [ "$(ENGSET)" == "false" ]; then \
|
if [ "$(ENGSET)" = "false" ]; then \
|
||||||
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
|
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -141,7 +159,5 @@ default: all
|
|||||||
clean: check
|
clean: check
|
||||||
rm -rf $(BIN_DIR)/*.o
|
rm -rf $(BIN_DIR)/*.o
|
||||||
rm -rf $(BIN_DIR)/systems/*.o
|
rm -rf $(BIN_DIR)/systems/*.o
|
||||||
rm -rf $(BIN_DIR)/zlib/*.o
|
|
||||||
rm -rf $(BIN_DIR)/vm/*.o
|
|
||||||
rm -rf $(BIN_DIR)/thread/*.o
|
rm -rf $(BIN_DIR)/thread/*.o
|
||||||
rm -rf $(BIN_DIR)/$(BINARY)
|
rm -rf $(BIN_DIR)/$(BINARY)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
+34
-5
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
#include "ShareSys.h"
|
#include "ShareSys.h"
|
||||||
#include "HandleSys.h"
|
#include "HandleSys.h"
|
||||||
#include "sourcemm_api.h"
|
#include "sourcemm_api.h"
|
||||||
|
#include "Translator.h"
|
||||||
|
|
||||||
MenuManager g_Menus;
|
MenuManager g_Menus;
|
||||||
VoteMenuHandler s_VoteHandler;
|
VoteMenuHandler s_VoteHandler;
|
||||||
@@ -585,14 +586,20 @@ skip_search:
|
|||||||
{
|
{
|
||||||
if (exitBackButton)
|
if (exitBackButton)
|
||||||
{
|
{
|
||||||
CorePlayerTranslate(client, text, sizeof(text), "Back", NULL);
|
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Back", &client))
|
||||||
|
{
|
||||||
|
UTIL_Format(text, sizeof(text), "Back");
|
||||||
|
}
|
||||||
dr.style = ITEMDRAW_CONTROL;
|
dr.style = ITEMDRAW_CONTROL;
|
||||||
position = panel->DrawItem(dr);
|
position = panel->DrawItem(dr);
|
||||||
slots[position].type = ItemSel_ExitBack;
|
slots[position].type = ItemSel_ExitBack;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CorePlayerTranslate(client, text, sizeof(text), "Previous", NULL);
|
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Previous", &client))
|
||||||
|
{
|
||||||
|
UTIL_Format(text, sizeof(text), "Previous");
|
||||||
|
}
|
||||||
dr.style = (displayPrev ? 0 : ITEMDRAW_DISABLED)|ITEMDRAW_CONTROL;
|
dr.style = (displayPrev ? 0 : ITEMDRAW_DISABLED)|ITEMDRAW_CONTROL;
|
||||||
position = panel->DrawItem(dr);
|
position = panel->DrawItem(dr);
|
||||||
slots[position].type = ItemSel_Back;
|
slots[position].type = ItemSel_Back;
|
||||||
@@ -610,7 +617,10 @@ skip_search:
|
|||||||
/* NEXT */
|
/* NEXT */
|
||||||
if (displayNext || canDrawDisabled)
|
if (displayNext || canDrawDisabled)
|
||||||
{
|
{
|
||||||
CorePlayerTranslate(client, text, sizeof(text), "Next", NULL);
|
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Next", &client))
|
||||||
|
{
|
||||||
|
UTIL_Format(text, sizeof(text), "Next");
|
||||||
|
}
|
||||||
dr.style = (displayNext ? 0 : ITEMDRAW_DISABLED)|ITEMDRAW_CONTROL;
|
dr.style = (displayNext ? 0 : ITEMDRAW_DISABLED)|ITEMDRAW_CONTROL;
|
||||||
position = panel->DrawItem(dr);
|
position = panel->DrawItem(dr);
|
||||||
slots[position].type = ItemSel_Next;
|
slots[position].type = ItemSel_Next;
|
||||||
@@ -638,7 +648,10 @@ skip_search:
|
|||||||
/* EXIT */
|
/* EXIT */
|
||||||
if (exitButton)
|
if (exitButton)
|
||||||
{
|
{
|
||||||
CorePlayerTranslate(client, text, sizeof(text), "Exit", NULL);
|
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Exit", &client))
|
||||||
|
{
|
||||||
|
UTIL_Format(text, sizeof(text), "Exit");
|
||||||
|
}
|
||||||
dr.style = ITEMDRAW_CONTROL;
|
dr.style = ITEMDRAW_CONTROL;
|
||||||
position = panel->DrawItem(dr);
|
position = panel->DrawItem(dr);
|
||||||
slots[position].type = ItemSel_Exit;
|
slots[position].type = ItemSel_Exit;
|
||||||
@@ -777,3 +790,19 @@ unsigned int MenuManager::GetRemainingVoteDelay()
|
|||||||
{
|
{
|
||||||
return s_VoteHandler.GetRemainingVoteDelay();
|
return s_VoteHandler.GetRemainingVoteDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MenuManager::IsClientInVotePool(int client)
|
||||||
|
{
|
||||||
|
return s_VoteHandler.IsClientInVotePool(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MenuManager::RedrawClientVoteMenu(int client)
|
||||||
|
{
|
||||||
|
return RedrawClientVoteMenu2(client, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MenuManager::RedrawClientVoteMenu2(int client, bool revote)
|
||||||
|
{
|
||||||
|
return s_VoteHandler.RedrawToClient(client, revote);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -89,6 +89,9 @@ public:
|
|||||||
bool IsVoteInProgress();
|
bool IsVoteInProgress();
|
||||||
void CancelVoting();
|
void CancelVoting();
|
||||||
unsigned int GetRemainingVoteDelay();
|
unsigned int GetRemainingVoteDelay();
|
||||||
|
bool IsClientInVotePool(int client);
|
||||||
|
bool RedrawClientVoteMenu(int client);
|
||||||
|
bool RedrawClientVoteMenu2(int client, bool revote);
|
||||||
public: //IHandleTypeDispatch
|
public: //IHandleTypeDispatch
|
||||||
void OnHandleDestroy(HandleType_t type, void *object);
|
void OnHandleDestroy(HandleType_t type, void *object);
|
||||||
bool GetHandleApproxSize(HandleType_t type, void *object, unsigned int *pSize);
|
bool GetHandleApproxSize(HandleType_t type, void *object, unsigned int *pSize);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -314,7 +314,7 @@ void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
|
|||||||
|
|
||||||
if (sound != NULL)
|
if (sound != NULL)
|
||||||
{
|
{
|
||||||
edict_t *pEdict = engine->PEntityOfEntIndex(client);
|
edict_t *pEdict = PEntityOfEntIndex(client);
|
||||||
if (pEdict)
|
if (pEdict)
|
||||||
{
|
{
|
||||||
ICollideable *pCollideable = pEdict->GetCollideable();
|
ICollideable *pCollideable = pEdict->GetCollideable();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -88,7 +88,7 @@ void ValveMenuStyle::HookCreateMessage(edict_t *pEdict,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int client = engine->IndexOfEdict(pEdict);
|
int client = IndexOfEdict(pEdict);
|
||||||
if (client < 1 || client > 256)
|
if (client < 1 || client > 256)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -325,7 +325,7 @@ void CValveMenuDisplay::SendRawDisplay(int client, int priority, unsigned int ti
|
|||||||
m_pKv->SetInt("time", time ? time : 200);
|
m_pKv->SetInt("time", time ? time : 200);
|
||||||
|
|
||||||
SH_CALL(g_pSPHCC, &IServerPluginHelpers::CreateMessage)(
|
SH_CALL(g_pSPHCC, &IServerPluginHelpers::CreateMessage)(
|
||||||
engine->PEntityOfEntIndex(client),
|
PEntityOfEntIndex(client),
|
||||||
DIALOG_MENU,
|
DIALOG_MENU,
|
||||||
m_pKv,
|
m_pKv,
|
||||||
vsp_interface);
|
vsp_interface);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
+105
-14
@@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* vim: set ts=4 :
|
* vim: set ts=4 sw=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
float g_next_vote = 0.0f;
|
float g_next_vote = 0.0f;
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void OnVoteDelayChange(IConVar *cvar, const char *value, float flOldValue);
|
void OnVoteDelayChange(IConVar *cvar, const char *value, float flOldValue);
|
||||||
#else
|
#else
|
||||||
void OnVoteDelayChange(ConVar *cvar, const char *value);
|
void OnVoteDelayChange(ConVar *cvar, const char *value);
|
||||||
@@ -52,7 +52,7 @@ ConVar sm_vote_delay("sm_vote_delay",
|
|||||||
0.0,
|
0.0,
|
||||||
OnVoteDelayChange);
|
OnVoteDelayChange);
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void OnVoteDelayChange(IConVar *cvar, const char *value, float flOldValue)
|
void OnVoteDelayChange(IConVar *cvar, const char *value, float flOldValue)
|
||||||
#else
|
#else
|
||||||
void OnVoteDelayChange(ConVar *cvar, const char *value)
|
void OnVoteDelayChange(ConVar *cvar, const char *value)
|
||||||
@@ -113,14 +113,19 @@ void VoteMenuHandler::OnClientDisconnected(int client)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wipe out their vote if they had one */
|
/* Wipe out their vote if they had one. We have to make sure the the the
|
||||||
|
* newly connected client is not allowed to vote.
|
||||||
|
*/
|
||||||
int item;
|
int item;
|
||||||
if ((item = m_ClientVotes[client]) >= 0)
|
if ((item = m_ClientVotes[client]) >= -1)
|
||||||
{
|
{
|
||||||
assert((unsigned)item < m_Items);
|
if (item >= 0)
|
||||||
assert(m_Votes[item] > 0);
|
{
|
||||||
m_Votes[item]--;
|
assert((unsigned)item < m_Items);
|
||||||
m_ClientVotes[client] = -1;
|
assert(m_Votes[item] > 0);
|
||||||
|
m_Votes[item]--;
|
||||||
|
}
|
||||||
|
m_ClientVotes[client] = -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,18 +134,28 @@ bool VoteMenuHandler::IsVoteInProgress()
|
|||||||
return (m_pCurMenu != NULL);
|
return (m_pCurMenu != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VoteMenuHandler::StartVote(IBaseMenu *menu, unsigned int num_clients, int clients[], unsigned int max_time, unsigned int flags/* =0 */)
|
bool VoteMenuHandler::StartVote(IBaseMenu *menu,
|
||||||
|
unsigned int num_clients,
|
||||||
|
int clients[],
|
||||||
|
unsigned int max_time,
|
||||||
|
unsigned int flags/* =0 */)
|
||||||
{
|
{
|
||||||
if (!InitializeVoting(menu, menu->GetHandler(), max_time, flags))
|
if (!InitializeVoting(menu, menu->GetHandler(), max_time, flags))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Note: we can use game time and not universal time because
|
||||||
|
* if we're voting then players are in-game.
|
||||||
|
*/
|
||||||
|
|
||||||
float fVoteDelay = sm_vote_delay.GetFloat();
|
float fVoteDelay = sm_vote_delay.GetFloat();
|
||||||
if (fVoteDelay < 1.0)
|
if (fVoteDelay < 1.0)
|
||||||
{
|
{
|
||||||
g_next_vote = 0.0;
|
g_next_vote = 0.0;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* This little trick breaks for infinite votes!
|
/* This little trick breaks for infinite votes!
|
||||||
* However, we just ignore that since those 1) shouldn't exist and
|
* However, we just ignore that since those 1) shouldn't exist and
|
||||||
* 2) people must be checking IsVoteInProgress() beforehand anyway.
|
* 2) people must be checking IsVoteInProgress() beforehand anyway.
|
||||||
@@ -148,8 +163,15 @@ bool VoteMenuHandler::StartVote(IBaseMenu *menu, unsigned int num_clients, int c
|
|||||||
g_next_vote = gpGlobals->curtime + fVoteDelay + (float)max_time;
|
g_next_vote = gpGlobals->curtime + fVoteDelay + (float)max_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_fStartTime = gpGlobals->curtime;
|
||||||
|
m_nMenuTime = max_time;
|
||||||
|
|
||||||
for (unsigned int i=0; i<num_clients; i++)
|
for (unsigned int i=0; i<num_clients; i++)
|
||||||
{
|
{
|
||||||
|
if (clients[i] < 1 || clients[i] > 256)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
menu->Display(clients[i], max_time, this);
|
menu->Display(clients[i], max_time, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,6 +180,70 @@ bool VoteMenuHandler::StartVote(IBaseMenu *menu, unsigned int num_clients, int c
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VoteMenuHandler::IsClientInVotePool(int client)
|
||||||
|
{
|
||||||
|
if (client < 1
|
||||||
|
|| client > g_Players.MaxClients()
|
||||||
|
|| m_pCurMenu == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (m_ClientVotes[client] > -2);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VoteMenuHandler::GetClientVoteChoice(int client, unsigned int *pItem)
|
||||||
|
{
|
||||||
|
if (!IsClientInVotePool(client)
|
||||||
|
|| m_ClientVotes[client] == -1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pItem = m_ClientVotes[client];
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VoteMenuHandler::RedrawToClient(int client, bool revotes)
|
||||||
|
{
|
||||||
|
unsigned int time_limit;
|
||||||
|
|
||||||
|
if (!IsClientInVotePool(client))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_ClientVotes[client] >= 0)
|
||||||
|
{
|
||||||
|
if ((m_VoteFlags & VOTEFLAG_NO_REVOTES) == VOTEFLAG_NO_REVOTES || !revotes)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
assert((unsigned)m_ClientVotes[client] < m_Items);
|
||||||
|
assert(m_Votes[m_ClientVotes[client]] > 0);
|
||||||
|
m_Votes[m_ClientVotes[client]]--;
|
||||||
|
m_ClientVotes[client] = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_nMenuTime == MENU_TIME_FOREVER)
|
||||||
|
{
|
||||||
|
time_limit = m_nMenuTime;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
time_limit = (int)((float)m_nMenuTime - (gpGlobals->curtime - m_fStartTime));
|
||||||
|
|
||||||
|
/* Make sure this doesn't round to zero */
|
||||||
|
if (time_limit == MENU_TIME_FOREVER)
|
||||||
|
{
|
||||||
|
time_limit = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_pCurMenu->Display(client, time_limit, this);
|
||||||
|
}
|
||||||
|
|
||||||
bool VoteMenuHandler::InitializeVoting(IBaseMenu *menu,
|
bool VoteMenuHandler::InitializeVoting(IBaseMenu *menu,
|
||||||
IMenuHandler *handler,
|
IMenuHandler *handler,
|
||||||
unsigned int time,
|
unsigned int time,
|
||||||
@@ -187,7 +273,9 @@ bool VoteMenuHandler::InitializeVoting(IBaseMenu *menu,
|
|||||||
m_Votes[i] = 0;
|
m_Votes[i] = 0;
|
||||||
}
|
}
|
||||||
m_Votes.resize(m_Items, 0);
|
m_Votes.resize(m_Items, 0);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for (unsigned int i=0; i<m_Items; i++)
|
for (unsigned int i=0; i<m_Items; i++)
|
||||||
{
|
{
|
||||||
m_Votes[i] = 0;
|
m_Votes[i] = 0;
|
||||||
@@ -252,7 +340,9 @@ void VoteMenuHandler::EndVoting()
|
|||||||
if (fVoteDelay < 1.0)
|
if (fVoteDelay < 1.0)
|
||||||
{
|
{
|
||||||
g_next_vote = 0.0;
|
g_next_vote = 0.0;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
g_next_vote = gpGlobals->curtime + fVoteDelay;
|
g_next_vote = gpGlobals->curtime + fVoteDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,3 +501,4 @@ bool VoteMenuHandler::IsCancelling()
|
|||||||
{
|
{
|
||||||
return m_bCancelled;
|
return m_bCancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -72,6 +72,9 @@ public:
|
|||||||
IBaseMenu *GetCurrentMenu();
|
IBaseMenu *GetCurrentMenu();
|
||||||
bool IsCancelling();
|
bool IsCancelling();
|
||||||
unsigned int GetRemainingVoteDelay();
|
unsigned int GetRemainingVoteDelay();
|
||||||
|
bool IsClientInVotePool(int client);
|
||||||
|
bool GetClientVoteChoice(int client, unsigned int *pItem);
|
||||||
|
bool RedrawToClient(int client, bool revote);
|
||||||
private:
|
private:
|
||||||
void Reset(IMenuHandler *mh);
|
void Reset(IMenuHandler *mh);
|
||||||
void DecrementPlayerCount();
|
void DecrementPlayerCount();
|
||||||
@@ -93,7 +96,10 @@ private:
|
|||||||
unsigned int m_NumVotes;
|
unsigned int m_NumVotes;
|
||||||
unsigned int m_VoteTime;
|
unsigned int m_VoteTime;
|
||||||
unsigned int m_VoteFlags;
|
unsigned int m_VoteFlags;
|
||||||
|
float m_fStartTime;
|
||||||
|
unsigned int m_nMenuTime;
|
||||||
int m_ClientVotes[256+1];
|
int m_ClientVotes[256+1];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_MENUVOTING_H_
|
#endif //_INCLUDE_SOURCEMOD_MENUVOTING_H_
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,379 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* =============================================================================
|
||||||
|
* SourcePawn
|
||||||
|
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||||
|
* =============================================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||||
|
* Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||||
|
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||||
|
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||||
|
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||||
|
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||||
|
* this exception to all derivative works. AlliedModders LLC defines further
|
||||||
|
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||||
|
* or <http://www.sourcemod.net/license.php>.
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "NativeInvoker.h"
|
||||||
|
#include "ShareSys.h"
|
||||||
|
|
||||||
|
NativeInterface g_NInvoke;
|
||||||
|
|
||||||
|
NativeInvoker::NativeInvoker()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
NativeInvoker::~NativeInvoker()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *NativeInterface::GetInterfaceName()
|
||||||
|
{
|
||||||
|
return SMINTERFACE_NINVOKE_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int NativeInterface::GetInterfaceVersion()
|
||||||
|
{
|
||||||
|
return SMINTERFACE_NINVOKE_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeInterface::OnSourceModAllInitialized()
|
||||||
|
{
|
||||||
|
g_ShareSys.AddInterface(NULL, &g_NInvoke);
|
||||||
|
}
|
||||||
|
|
||||||
|
IPluginRuntime *NativeInterface::CreateRuntime(const char *name, size_t bytes)
|
||||||
|
{
|
||||||
|
return g_pSourcePawn2->CreateEmptyRuntime(name, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
INativeInvoker *NativeInterface::CreateInvoker()
|
||||||
|
{
|
||||||
|
return new NativeInvoker();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NativeInvoker::Start(IPluginContext *pContext, const char *name)
|
||||||
|
{
|
||||||
|
NativeEntry *entry;
|
||||||
|
|
||||||
|
entry = g_ShareSys.FindNative(name);
|
||||||
|
if (entry == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
native = NULL;
|
||||||
|
if (entry->replacement.owner != NULL)
|
||||||
|
{
|
||||||
|
native = entry->replacement.func;
|
||||||
|
}
|
||||||
|
else if (entry->owner != NULL)
|
||||||
|
{
|
||||||
|
native = entry->func;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (native == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->pContext = pContext;
|
||||||
|
|
||||||
|
m_curparam = 0;
|
||||||
|
m_errorstate = SP_ERROR_NONE;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_t NativeInvoker::PushCell(cell_t cell)
|
||||||
|
{
|
||||||
|
if (m_curparam >= SP_MAX_EXEC_PARAMS)
|
||||||
|
{
|
||||||
|
return SetError(SP_ERROR_PARAMS_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_info[m_curparam].marked = false;
|
||||||
|
m_params[m_curparam] = cell;
|
||||||
|
m_curparam++;
|
||||||
|
|
||||||
|
return SP_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::PushCellByRef(cell_t *cell, int flags)
|
||||||
|
{
|
||||||
|
return PushArray(cell, 1, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::PushFloat(float number)
|
||||||
|
{
|
||||||
|
cell_t val = *(cell_t *)&number;
|
||||||
|
|
||||||
|
return PushCell(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::PushFloatByRef(float *number, int flags)
|
||||||
|
{
|
||||||
|
return PushCellByRef((cell_t *)number, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::PushArray(cell_t *inarray, unsigned int cells, int copyback)
|
||||||
|
{
|
||||||
|
if (m_curparam >= SP_MAX_EXEC_PARAMS)
|
||||||
|
{
|
||||||
|
return SetError(SP_ERROR_PARAMS_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
ParamInfo *info = &m_info[m_curparam];
|
||||||
|
|
||||||
|
info->flags = inarray ? copyback : 0;
|
||||||
|
info->marked = true;
|
||||||
|
info->size = cells;
|
||||||
|
info->str.is_sz = false;
|
||||||
|
info->orig_addr = inarray;
|
||||||
|
|
||||||
|
m_curparam++;
|
||||||
|
|
||||||
|
return SP_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::PushString(const char *string)
|
||||||
|
{
|
||||||
|
return _PushString(string, SM_PARAM_STRING_COPY, 0, strlen(string)+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::PushStringEx(char *buffer, size_t length, int sz_flags, int cp_flags)
|
||||||
|
{
|
||||||
|
return _PushString(buffer, sz_flags, cp_flags, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::_PushString(const char *string, int sz_flags, int cp_flags, size_t len)
|
||||||
|
{
|
||||||
|
if (m_curparam >= SP_MAX_EXEC_PARAMS)
|
||||||
|
{
|
||||||
|
return SetError(SP_ERROR_PARAMS_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
ParamInfo *info = &m_info[m_curparam];
|
||||||
|
|
||||||
|
info->marked = true;
|
||||||
|
info->orig_addr = (cell_t *)string;
|
||||||
|
info->flags = cp_flags;
|
||||||
|
info->size = len;
|
||||||
|
info->str.sz_flags = sz_flags;
|
||||||
|
info->str.is_sz = true;
|
||||||
|
|
||||||
|
m_curparam++;
|
||||||
|
|
||||||
|
return SP_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeInvoker::Cancel()
|
||||||
|
{
|
||||||
|
if (pContext == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_errorstate = SP_ERROR_NONE;
|
||||||
|
m_curparam = 0;
|
||||||
|
pContext = NULL;
|
||||||
|
native = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::SetError(int err)
|
||||||
|
{
|
||||||
|
m_errorstate = err;
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
int NativeInvoker::Invoke(cell_t *result)
|
||||||
|
{
|
||||||
|
int err = SP_ERROR_NONE;
|
||||||
|
|
||||||
|
if (pContext == NULL)
|
||||||
|
{
|
||||||
|
return SP_ERROR_INVALID_NATIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_errorstate != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
err = m_errorstate;
|
||||||
|
Cancel();
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_t tresult;
|
||||||
|
|
||||||
|
if (result == NULL)
|
||||||
|
{
|
||||||
|
result = &tresult;
|
||||||
|
}
|
||||||
|
|
||||||
|
//This is for re-entrancy!
|
||||||
|
IPluginContext *ctx = pContext;
|
||||||
|
cell_t _temp_params[SP_MAX_EXEC_PARAMS + 1];
|
||||||
|
cell_t *temp_params = &_temp_params[1];
|
||||||
|
ParamInfo temp_info[SP_MAX_EXEC_PARAMS];
|
||||||
|
unsigned int numparams = m_curparam;
|
||||||
|
unsigned int i;
|
||||||
|
bool docopies = true;
|
||||||
|
|
||||||
|
if (numparams)
|
||||||
|
{
|
||||||
|
//Save the info locally, then reset it for re-entrant calls.
|
||||||
|
memcpy(temp_info, m_info, numparams * sizeof(ParamInfo));
|
||||||
|
}
|
||||||
|
m_curparam = 0;
|
||||||
|
pContext = NULL;
|
||||||
|
|
||||||
|
/* Initialize 0th parameter */
|
||||||
|
_temp_params[0] = numparams;
|
||||||
|
|
||||||
|
/* Browse the parameters and build arrays */
|
||||||
|
for (i = 0; i < numparams; i++)
|
||||||
|
{
|
||||||
|
/* Is this marked as an array? */
|
||||||
|
if (temp_info[i].marked)
|
||||||
|
{
|
||||||
|
if (!temp_info[i].str.is_sz)
|
||||||
|
{
|
||||||
|
/* Allocate a normal/generic array */
|
||||||
|
if ((err = ctx->HeapAlloc(temp_info[i].size,
|
||||||
|
&temp_info[i].local_addr,
|
||||||
|
&temp_info[i].phys_addr))
|
||||||
|
!= SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (temp_info[i].orig_addr)
|
||||||
|
{
|
||||||
|
memcpy(temp_info[i].phys_addr, temp_info[i].orig_addr, sizeof(cell_t) * temp_info[i].size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Calculate cells required for the string */
|
||||||
|
size_t cells = (temp_info[i].size + sizeof(cell_t) - 1) / sizeof(cell_t);
|
||||||
|
|
||||||
|
/* Allocate the buffer */
|
||||||
|
if ((err = ctx->HeapAlloc(cells,
|
||||||
|
&temp_info[i].local_addr,
|
||||||
|
&temp_info[i].phys_addr))
|
||||||
|
!= SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* Copy original string if necessary */
|
||||||
|
if ((temp_info[i].str.sz_flags & SM_PARAM_STRING_COPY) && (temp_info[i].orig_addr != NULL))
|
||||||
|
{
|
||||||
|
/* Cut off UTF-8 properly */
|
||||||
|
if (temp_info[i].str.sz_flags & SM_PARAM_STRING_UTF8)
|
||||||
|
{
|
||||||
|
if ((err = ctx->StringToLocalUTF8(temp_info[i].local_addr,
|
||||||
|
temp_info[i].size,
|
||||||
|
(const char *)temp_info[i].orig_addr,
|
||||||
|
NULL))
|
||||||
|
!= SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Copy a binary blob */
|
||||||
|
else if (temp_info[i].str.sz_flags & SM_PARAM_STRING_BINARY)
|
||||||
|
{
|
||||||
|
memmove(temp_info[i].phys_addr, temp_info[i].orig_addr, temp_info[i].size);
|
||||||
|
}
|
||||||
|
/* Copy ASCII characters */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((err = ctx->StringToLocal(temp_info[i].local_addr,
|
||||||
|
temp_info[i].size,
|
||||||
|
(const char *)temp_info[i].orig_addr))
|
||||||
|
!= SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* End array/string calculation */
|
||||||
|
/* Update the pushed parameter with the byref local address */
|
||||||
|
temp_params[i] = temp_info[i].local_addr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Just copy the value normally */
|
||||||
|
temp_params[i] = m_params[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make the call if we can */
|
||||||
|
if (err == SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
*result = native(ctx, _temp_params);
|
||||||
|
if (ctx->GetLastNativeError() != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
docopies = false;
|
||||||
|
ctx->ClearLastNativeError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
docopies = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* i should be equal to the last valid parameter + 1 */
|
||||||
|
while (i--)
|
||||||
|
{
|
||||||
|
if (!temp_info[i].marked)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (docopies && (temp_info[i].flags & SM_PARAM_COPYBACK))
|
||||||
|
{
|
||||||
|
if (temp_info[i].orig_addr)
|
||||||
|
{
|
||||||
|
if (temp_info[i].str.is_sz)
|
||||||
|
{
|
||||||
|
memcpy(temp_info[i].orig_addr, temp_info[i].phys_addr, temp_info[i].size);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (temp_info[i].size == 1)
|
||||||
|
{
|
||||||
|
*temp_info[i].orig_addr = *(temp_info[i].phys_addr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memcpy(temp_info[i].orig_addr,
|
||||||
|
temp_info[i].phys_addr,
|
||||||
|
temp_info[i].size * sizeof(cell_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((err = ctx->HeapPop(temp_info[i].local_addr)) != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
/**
|
||||||
|
* vim: set ts=4 :
|
||||||
|
* =============================================================================
|
||||||
|
* SourceMod
|
||||||
|
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||||
|
* =============================================================================
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||||
|
* Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||||
|
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
||||||
|
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||||
|
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||||
|
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||||
|
* this exception to all derivative works. AlliedModders LLC defines further
|
||||||
|
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
||||||
|
* or <http://www.sourcemod.net/license.php>.
|
||||||
|
*
|
||||||
|
* Version: $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_
|
||||||
|
#define _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_
|
||||||
|
|
||||||
|
#include "sm_globals.h"
|
||||||
|
#include <INativeInvoker.h>
|
||||||
|
|
||||||
|
struct ParamInfo
|
||||||
|
{
|
||||||
|
int flags; /* Copy-back flags */
|
||||||
|
bool marked; /* Whether this is marked as being used */
|
||||||
|
cell_t local_addr; /* Local address to free */
|
||||||
|
cell_t *phys_addr; /* Physical address of our copy */
|
||||||
|
cell_t *orig_addr; /* Original address to copy back to */
|
||||||
|
ucell_t size; /* Size of array in bytes */
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
bool is_sz; /* is a string */
|
||||||
|
int sz_flags; /* has sz flags */
|
||||||
|
} str;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NativeInvoker : public INativeInvoker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NativeInvoker();
|
||||||
|
~NativeInvoker();
|
||||||
|
public: /* ICallable */
|
||||||
|
int PushCell(cell_t cell);
|
||||||
|
int PushCellByRef(cell_t *cell, int flags=SM_PARAM_COPYBACK);
|
||||||
|
int PushFloat(float number);
|
||||||
|
int PushFloatByRef(float *number, int flags=SM_PARAM_COPYBACK);
|
||||||
|
int PushArray(cell_t *inarray, unsigned int cells, int flags=0);
|
||||||
|
int PushString(const char *string);
|
||||||
|
int PushStringEx(char *buffer, size_t length, int sz_flags, int cp_flags);
|
||||||
|
void Cancel();
|
||||||
|
public: /* INativeInvoker */
|
||||||
|
bool Start(IPluginContext *pContext, const char *name);
|
||||||
|
int Invoke(cell_t *result);
|
||||||
|
private:
|
||||||
|
int _PushString(const char *string, int sz_flags, int cp_flags, size_t len);
|
||||||
|
int SetError(int err);
|
||||||
|
private:
|
||||||
|
IPluginContext *pContext;
|
||||||
|
SPVM_NATIVE_FUNC native;
|
||||||
|
cell_t m_params[SP_MAX_EXEC_PARAMS];
|
||||||
|
ParamInfo m_info[SP_MAX_EXEC_PARAMS];
|
||||||
|
unsigned int m_curparam;
|
||||||
|
int m_errorstate;
|
||||||
|
};
|
||||||
|
|
||||||
|
class NativeInterface :
|
||||||
|
public INativeInterface,
|
||||||
|
public SMGlobalClass
|
||||||
|
{
|
||||||
|
public: /* SMGlobalClass */
|
||||||
|
void OnSourceModAllInitialized();
|
||||||
|
public: /* SMInterface */
|
||||||
|
unsigned int GetInterfaceVersion();
|
||||||
|
const char *GetInterfaceName();
|
||||||
|
public: /* INativeInvoker */
|
||||||
|
IPluginRuntime *CreateRuntime(const char *name, size_t bytes);
|
||||||
|
INativeInvoker *CreateInvoker();
|
||||||
|
};
|
||||||
|
|
||||||
|
extern NativeInterface g_NInvoke;
|
||||||
|
|
||||||
|
#endif /* _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_ */
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
#include "NativeOwner.h"
|
||||||
|
#include "ShareSys.h"
|
||||||
|
#include "PluginSys.h"
|
||||||
|
|
||||||
|
CNativeOwner::CNativeOwner() : m_nMarkSerial(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNativeOwner::SetMarkSerial(unsigned int serial)
|
||||||
|
{
|
||||||
|
m_nMarkSerial = serial;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CNativeOwner::GetMarkSerial()
|
||||||
|
{
|
||||||
|
return m_nMarkSerial;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNativeOwner::AddDependent(CPlugin *pPlugin)
|
||||||
|
{
|
||||||
|
m_Dependents.push_back(pPlugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNativeOwner::AddWeakRef(const WeakNative & ref)
|
||||||
|
{
|
||||||
|
m_WeakRefs.push_back(ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNativeOwner::AddNatives(const sp_nativeinfo_t *natives)
|
||||||
|
{
|
||||||
|
NativeEntry *pEntry;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; natives[i].func != NULL && natives[i].name != NULL; i++)
|
||||||
|
{
|
||||||
|
if ((pEntry = g_ShareSys.AddNativeToCache(this, &natives[i])) == NULL)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Natives.push_back(pEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNativeOwner::PropogateMarkSerial(unsigned int serial)
|
||||||
|
{
|
||||||
|
CNativeOwner *pOwner;
|
||||||
|
List<CPlugin *>::iterator iter;
|
||||||
|
|
||||||
|
for (iter = m_Dependents.begin();
|
||||||
|
iter != m_Dependents.end();
|
||||||
|
iter++)
|
||||||
|
{
|
||||||
|
pOwner = (*iter);
|
||||||
|
pOwner->SetMarkSerial(serial);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNativeOwner::UnbindWeakRef(const WeakNative & ref)
|
||||||
|
{
|
||||||
|
sp_native_t *native;
|
||||||
|
IPluginContext *pContext;
|
||||||
|
|
||||||
|
pContext = ref.pl->GetBaseContext();
|
||||||
|
if ((pContext->GetNativeByIndex(ref.idx, &native)) == SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
/* If there is no reference, the native must be unbound */
|
||||||
|
if (ref.entry == NULL)
|
||||||
|
{
|
||||||
|
native->status = SP_NATIVE_UNBOUND;
|
||||||
|
native->pfn = NULL;
|
||||||
|
}
|
||||||
|
/* If we've cached a reference, it's a core native we can
|
||||||
|
* rebind back to its original (this was a replacement).
|
||||||
|
*/
|
||||||
|
else
|
||||||
|
{
|
||||||
|
native->pfn = ref.entry->func;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNativeOwner::DropEverything()
|
||||||
|
{
|
||||||
|
NativeEntry *pEntry;
|
||||||
|
List<WeakNative>::iterator iter;
|
||||||
|
List<NativeEntry *>::iterator ntv_iter;
|
||||||
|
|
||||||
|
/* Unbind and remove all weak references to us */
|
||||||
|
iter = m_WeakRefs.begin();
|
||||||
|
while (iter != m_WeakRefs.end())
|
||||||
|
{
|
||||||
|
UnbindWeakRef((*iter));
|
||||||
|
iter = m_WeakRefs.erase(iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Unmark our replacement natives */
|
||||||
|
ntv_iter = m_ReplacedNatives.begin();
|
||||||
|
while (ntv_iter != m_ReplacedNatives.end())
|
||||||
|
{
|
||||||
|
pEntry = (*ntv_iter);
|
||||||
|
pEntry->replacement.func = NULL;
|
||||||
|
pEntry->replacement.owner = NULL;
|
||||||
|
ntv_iter = m_ReplacedNatives.erase(ntv_iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Strip all of our natives from the cache */
|
||||||
|
ntv_iter = m_Natives.begin();
|
||||||
|
while (ntv_iter != m_Natives.end())
|
||||||
|
{
|
||||||
|
g_ShareSys.ClearNativeFromCache(this, (*ntv_iter)->name);
|
||||||
|
ntv_iter = m_Natives.erase(ntv_iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNativeOwner::DropWeakRefsTo(CPlugin *pPlugin)
|
||||||
|
{
|
||||||
|
List<WeakNative>::iterator iter;
|
||||||
|
|
||||||
|
iter = m_WeakRefs.begin();
|
||||||
|
while (iter != m_WeakRefs.end())
|
||||||
|
{
|
||||||
|
WeakNative & ref = (*iter);
|
||||||
|
|
||||||
|
if (ref.pl == pPlugin)
|
||||||
|
{
|
||||||
|
iter = m_WeakRefs.erase(iter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNativeOwner::DropRefsTo(CPlugin *pPlugin)
|
||||||
|
{
|
||||||
|
m_Dependents.remove(pPlugin);
|
||||||
|
DropWeakRefsTo(pPlugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNativeOwner::AddReplacedNative(NativeEntry *pEntry)
|
||||||
|
{
|
||||||
|
m_ReplacedNatives.push_back(pEntry);
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
#ifndef _INCLUDE_SOURCEMOD_NATIVE_OWNER_H_
|
||||||
|
#define _INCLUDE_SOURCEMOD_NATIVE_OWNER_H_
|
||||||
|
|
||||||
|
#include <sp_vm_types.h>
|
||||||
|
#include <sh_list.h>
|
||||||
|
|
||||||
|
class CPlugin;
|
||||||
|
struct NativeEntry;
|
||||||
|
|
||||||
|
struct WeakNative
|
||||||
|
{
|
||||||
|
WeakNative(CPlugin *plugin, uint32_t index) :
|
||||||
|
pl(plugin), idx(index), entry(NULL)
|
||||||
|
{
|
||||||
|
pl = plugin;
|
||||||
|
idx = index;
|
||||||
|
}
|
||||||
|
WeakNative(CPlugin *plugin, uint32_t index, NativeEntry *pEntry) :
|
||||||
|
pl(plugin), idx(index), entry(pEntry)
|
||||||
|
{
|
||||||
|
pl = plugin;
|
||||||
|
idx = index;
|
||||||
|
}
|
||||||
|
CPlugin *pl;
|
||||||
|
uint32_t idx;
|
||||||
|
NativeEntry *entry;
|
||||||
|
};
|
||||||
|
|
||||||
|
using namespace SourceHook;
|
||||||
|
|
||||||
|
class CNativeOwner
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CNativeOwner();
|
||||||
|
public:
|
||||||
|
virtual void DropEverything();
|
||||||
|
public:
|
||||||
|
void AddNatives(const sp_nativeinfo_t *info);
|
||||||
|
public:
|
||||||
|
void SetMarkSerial(unsigned int serial);
|
||||||
|
unsigned int GetMarkSerial();
|
||||||
|
void PropogateMarkSerial(unsigned int serial);
|
||||||
|
public:
|
||||||
|
void AddDependent(CPlugin *pPlugin);
|
||||||
|
void AddWeakRef(const WeakNative & ref);
|
||||||
|
void DropRefsTo(CPlugin *pPlugin);
|
||||||
|
void AddReplacedNative(NativeEntry *pEntry);
|
||||||
|
private:
|
||||||
|
void DropWeakRefsTo(CPlugin *pPlugin);
|
||||||
|
void UnbindWeakRef(const WeakNative & ref);
|
||||||
|
protected:
|
||||||
|
List<CPlugin *> m_Dependents;
|
||||||
|
unsigned int m_nMarkSerial;
|
||||||
|
List<WeakNative> m_WeakRefs;
|
||||||
|
List<NativeEntry *> m_Natives;
|
||||||
|
List<NativeEntry *> m_ReplacedNatives;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //_INCLUDE_SOURCEMOD_NATIVE_OWNER_H_
|
||||||
@@ -0,0 +1,222 @@
|
|||||||
|
/**
|
||||||
|
* 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 "NextMap.h"
|
||||||
|
#include "Logger.h"
|
||||||
|
#include "sourcemm_api.h"
|
||||||
|
#include "sm_stringutil.h"
|
||||||
|
#include "sourcehook.h"
|
||||||
|
#include "sm_srvcmds.h"
|
||||||
|
|
||||||
|
NextMapManager g_NextMap;
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
|
SH_DECL_HOOK2_void(IVEngineServer, ChangeLevel, SH_NOATTRIB, 0, const char *, const char *);
|
||||||
|
#else
|
||||||
|
SH_DECL_HOOK4_void(IVEngineServer, ChangeLevel, SH_NOATTRIB, 0, const char *, const char *, const char *, bool);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
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>);
|
||||||
|
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ConCommand *changeLevelCmd = NULL;
|
||||||
|
|
||||||
|
ConVar sm_nextmap("sm_nextmap", "", FCVAR_NOTIFY);
|
||||||
|
|
||||||
|
bool g_forcedChange = false;
|
||||||
|
|
||||||
|
void NextMapManager::OnSourceModAllInitialized_Post()
|
||||||
|
{
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
SH_ADD_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
|
||||||
|
#else
|
||||||
|
SH_ADD_HOOK_MEMFUNC(IVEngineServer, ChangeLevel, engine, this, &NextMapManager::HookChangeLevel, false);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ConCommand *pCmd = FindCommand("changelevel");
|
||||||
|
if (pCmd != NULL)
|
||||||
|
{
|
||||||
|
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pCmd, CmdChangeLevelCallback, false);
|
||||||
|
changeLevelCmd = pCmd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NextMapManager::OnSourceModShutdown()
|
||||||
|
{
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
SH_REMOVE_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
|
||||||
|
#else
|
||||||
|
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, ChangeLevel, engine, this, &NextMapManager::HookChangeLevel, false);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (changeLevelCmd != NULL)
|
||||||
|
{
|
||||||
|
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, changeLevelCmd, CmdChangeLevelCallback, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceHook::List<MapChangeData *>::iterator iter;
|
||||||
|
iter = m_mapHistory.begin();
|
||||||
|
|
||||||
|
while (iter != m_mapHistory.end())
|
||||||
|
{
|
||||||
|
delete (MapChangeData *)*iter;
|
||||||
|
iter = m_mapHistory.erase(iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *NextMapManager::GetNextMap()
|
||||||
|
{
|
||||||
|
return sm_nextmap.GetString();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NextMapManager::SetNextMap(const char *map)
|
||||||
|
{
|
||||||
|
if (!engine->IsMapValid(map))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
sm_nextmap.SetValue(map);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
|
void NextMapManager::HookChangeLevel(const char *map, const char *unknown)
|
||||||
|
#else
|
||||||
|
void NextMapManager::HookChangeLevel(const char *map, const char *unknown, const char *video, bool bLongLoading)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (g_forcedChange)
|
||||||
|
{
|
||||||
|
g_Logger.LogMessage("[SM] Changed map to \"%s\"", map);
|
||||||
|
RETURN_META(MRES_IGNORED);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *newmap = sm_nextmap.GetString();
|
||||||
|
|
||||||
|
if (newmap[0] == 0 || !engine->IsMapValid(newmap))
|
||||||
|
{
|
||||||
|
RETURN_META(MRES_IGNORED);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_Logger.LogMessage("[SM] Changed map to \"%s\"", newmap);
|
||||||
|
|
||||||
|
UTIL_Format(m_tempChangeInfo.m_mapName, sizeof(m_tempChangeInfo.m_mapName), newmap);
|
||||||
|
UTIL_Format(m_tempChangeInfo.m_changeReason, sizeof(m_tempChangeInfo.m_changeReason), "Normal level change");
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
|
RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::ChangeLevel, (newmap, unknown));
|
||||||
|
#else
|
||||||
|
RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::ChangeLevel, (newmap, unknown, video, bLongLoading));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void NextMapManager::OnSourceModLevelChange( const char *mapName )
|
||||||
|
{
|
||||||
|
/* Skip the first 'mapchange' when the server starts up */
|
||||||
|
if (m_tempChangeInfo.startTime != 0)
|
||||||
|
{
|
||||||
|
if (strcmp(mapName, m_tempChangeInfo.m_mapName) == 0)
|
||||||
|
{
|
||||||
|
/* The map change was as we expected */
|
||||||
|
m_mapHistory.push_back(new MapChangeData(lastMap, m_tempChangeInfo.m_changeReason, m_tempChangeInfo.startTime));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Something intercepted the mapchange */
|
||||||
|
char newReason[255];
|
||||||
|
UTIL_Format(newReason, sizeof(newReason), "%s (Map overridden)", m_tempChangeInfo.m_changeReason);
|
||||||
|
m_mapHistory.push_back(new MapChangeData(lastMap, newReason, m_tempChangeInfo.startTime));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: Should this be customizable? */
|
||||||
|
if (m_mapHistory.size() > 20)
|
||||||
|
{
|
||||||
|
SourceHook::List<MapChangeData *>::iterator iter;
|
||||||
|
iter = m_mapHistory.begin();
|
||||||
|
|
||||||
|
delete (MapChangeData *)*iter;
|
||||||
|
|
||||||
|
m_mapHistory.erase(iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_tempChangeInfo.m_mapName[0] ='\0';
|
||||||
|
m_tempChangeInfo.m_changeReason[0] = '\0';
|
||||||
|
m_tempChangeInfo.startTime = time(NULL);
|
||||||
|
UTIL_Format(lastMap, sizeof(lastMap), mapName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NextMapManager::ForceChangeLevel( const char *mapName, const char* changeReason )
|
||||||
|
{
|
||||||
|
/* Store the mapname and reason */
|
||||||
|
UTIL_Format(m_tempChangeInfo.m_mapName, sizeof(m_tempChangeInfo.m_mapName), mapName);
|
||||||
|
UTIL_Format(m_tempChangeInfo.m_changeReason, sizeof(m_tempChangeInfo.m_changeReason), changeReason);
|
||||||
|
|
||||||
|
/* Change level and skip our hook */
|
||||||
|
g_forcedChange = true;
|
||||||
|
engine->ChangeLevel(mapName, NULL);
|
||||||
|
g_forcedChange = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
NextMapManager::NextMapManager()
|
||||||
|
{
|
||||||
|
m_tempChangeInfo = MapChangeData();
|
||||||
|
m_mapHistory = SourceHook::List<MapChangeData *>();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
void CmdChangeLevelCallback(const CCommand &command)
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
void CmdChangeLevelCallback()
|
||||||
|
{
|
||||||
|
CCommand command;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (command.ArgC() < 2)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_NextMap.m_tempChangeInfo.m_mapName[0] == '\0')
|
||||||
|
{
|
||||||
|
UTIL_Format(g_NextMap.m_tempChangeInfo.m_mapName, sizeof(g_NextMap.m_tempChangeInfo.m_mapName), command.Arg(1));
|
||||||
|
UTIL_Format(g_NextMap.m_tempChangeInfo.m_changeReason, sizeof(g_NextMap.m_tempChangeInfo.m_changeReason), "changelevel Command");
|
||||||
|
}
|
||||||
|
}
|
||||||
+103
@@ -0,0 +1,103 @@
|
|||||||
|
/**
|
||||||
|
* 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_NEXTMAP_H_
|
||||||
|
#define _INCLUDE_SOURCEMOD_NEXTMAP_H_
|
||||||
|
|
||||||
|
#include "sm_globals.h"
|
||||||
|
#include "eiface.h"
|
||||||
|
#include "sh_list.h"
|
||||||
|
#include "sm_stringutil.h"
|
||||||
|
|
||||||
|
struct MapChangeData
|
||||||
|
{
|
||||||
|
MapChangeData(const char *mapName, const char *changeReason, time_t time)
|
||||||
|
{
|
||||||
|
UTIL_Format(m_mapName, sizeof(m_mapName), mapName);
|
||||||
|
UTIL_Format(m_changeReason, sizeof(m_changeReason), changeReason);
|
||||||
|
startTime = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
MapChangeData()
|
||||||
|
{
|
||||||
|
m_mapName[0] = '\0';
|
||||||
|
m_changeReason[0] = '\0';
|
||||||
|
startTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char m_mapName[32];
|
||||||
|
char m_changeReason[100];
|
||||||
|
time_t startTime;
|
||||||
|
};
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
void CmdChangeLevelCallback(const CCommand &command);
|
||||||
|
#else
|
||||||
|
void CmdChangeLevelCallback();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class NextMapManager : public SMGlobalClass
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NextMapManager();
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
friend void CmdChangeLevelCallback(const CCommand &command);
|
||||||
|
#else
|
||||||
|
friend void CmdChangeLevelCallback();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void OnSourceModAllInitialized_Post();
|
||||||
|
void OnSourceModShutdown();
|
||||||
|
void OnSourceModLevelChange(const char *mapName);
|
||||||
|
|
||||||
|
const char *GetNextMap();
|
||||||
|
bool SetNextMap(const char *map);
|
||||||
|
|
||||||
|
void ForceChangeLevel(const char *mapName, const char* changeReason);
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
|
void HookChangeLevel(const char *map, const char *unknown);
|
||||||
|
#else
|
||||||
|
void HookChangeLevel(const char *map, const char *unknown, const char *video, bool bLongLoading);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public:
|
||||||
|
SourceHook::List<MapChangeData *> m_mapHistory;
|
||||||
|
|
||||||
|
private:
|
||||||
|
MapChangeData m_tempChangeInfo;
|
||||||
|
char lastMap[32];
|
||||||
|
};
|
||||||
|
|
||||||
|
extern NextMapManager g_NextMap;
|
||||||
|
|
||||||
|
#endif //_INCLUDE_SOURCEMOD_NEXTMAP_H_
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
/**
|
||||||
|
* 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 "PhraseCollection.h"
|
||||||
|
#include "Translator.h"
|
||||||
|
#include "sm_stringutil.h"
|
||||||
|
|
||||||
|
CPhraseCollection::CPhraseCollection()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CPhraseCollection::~CPhraseCollection()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPhraseCollection::Destroy()
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPhraseFile *CPhraseCollection::AddPhraseFile(const char *filename)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
unsigned int fid;
|
||||||
|
IPhraseFile *pFile;
|
||||||
|
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);
|
||||||
|
|
||||||
|
fid = g_Translator.FindOrAddPhraseFile(full_name);
|
||||||
|
pFile = g_Translator.GetFileByIndex(fid);
|
||||||
|
|
||||||
|
for (i = 0; i < m_Files.size(); i++)
|
||||||
|
{
|
||||||
|
if (m_Files[i] == pFile)
|
||||||
|
{
|
||||||
|
return pFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Files.push_back(pFile);
|
||||||
|
|
||||||
|
return pFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CPhraseCollection::GetFileCount()
|
||||||
|
{
|
||||||
|
return (unsigned int)m_Files.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
IPhraseFile *CPhraseCollection::GetFile(unsigned int file)
|
||||||
|
{
|
||||||
|
if (file >= m_Files.size())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_Files[file];
|
||||||
|
}
|
||||||
|
|
||||||
|
TransError CPhraseCollection::FindTranslation(const char *key, unsigned int langid, Translation *pTrans)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < m_Files.size(); i++)
|
||||||
|
{
|
||||||
|
if (m_Files[i]->GetTranslation(key, langid, pTrans) == Trans_Okay)
|
||||||
|
{
|
||||||
|
return Trans_Okay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Trans_BadPhrase;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPhraseCollection::FormatString(char *buffer,
|
||||||
|
size_t maxlength,
|
||||||
|
const char *format,
|
||||||
|
void **params,
|
||||||
|
unsigned int numparams,
|
||||||
|
size_t *pOutLength,
|
||||||
|
const char **pFailPhrase)
|
||||||
|
{
|
||||||
|
unsigned int arg;
|
||||||
|
|
||||||
|
arg = 0;
|
||||||
|
if (!gnprintf(buffer, maxlength, format, this, params, numparams, arg, pOutLength, pFailPhrase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg != numparams)
|
||||||
|
{
|
||||||
|
if (pFailPhrase != NULL)
|
||||||
|
{
|
||||||
|
*pFailPhrase = NULL;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
* 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_PHRASECOLLECTION_H_
|
||||||
|
#define _INCLUDE_SOURCEMOD_PHRASECOLLECTION_H_
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <sh_vector.h>
|
||||||
|
#include <ITranslator.h>
|
||||||
|
|
||||||
|
using namespace SourceHook;
|
||||||
|
using namespace SourceMod;
|
||||||
|
|
||||||
|
class CPhraseCollection : public IPhraseCollection
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CPhraseCollection();
|
||||||
|
~CPhraseCollection();
|
||||||
|
public:
|
||||||
|
IPhraseFile *AddPhraseFile(const char *filename);
|
||||||
|
unsigned int GetFileCount();
|
||||||
|
IPhraseFile *GetFile(unsigned int file);
|
||||||
|
void Destroy();
|
||||||
|
TransError FindTranslation(const char *key, unsigned int langid, Translation *pTrans);
|
||||||
|
bool FormatString(
|
||||||
|
char *buffer,
|
||||||
|
size_t maxlength,
|
||||||
|
const char *format,
|
||||||
|
void **params,
|
||||||
|
unsigned int numparams,
|
||||||
|
size_t *pOutLength,
|
||||||
|
const char **pFailPhrase);
|
||||||
|
private:
|
||||||
|
CVector<IPhraseFile *> m_Files;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //_INCLUDE_SOURCEMOD_PHRASECOLLECTION_H_
|
||||||
+300
-80
@@ -46,13 +46,15 @@
|
|||||||
#include <inetchannel.h>
|
#include <inetchannel.h>
|
||||||
#include <iclient.h>
|
#include <iclient.h>
|
||||||
#include "GameConfigs.h"
|
#include "GameConfigs.h"
|
||||||
#include "systems/ExtensionSys.h"
|
#include "ExtensionSys.h"
|
||||||
|
#include "sm_version.h"
|
||||||
|
|
||||||
PlayerManager g_Players;
|
PlayerManager g_Players;
|
||||||
bool g_OnMapStarted = false;
|
bool g_OnMapStarted = false;
|
||||||
IForward *PreAdminCheck = NULL;
|
IForward *PreAdminCheck = NULL;
|
||||||
IForward *PostAdminCheck = NULL;
|
IForward *PostAdminCheck = NULL;
|
||||||
IForward *PostAdminFilter = NULL;
|
IForward *PostAdminFilter = NULL;
|
||||||
|
IForward *OnClientConnected = NULL;
|
||||||
const unsigned int *g_NumPlayersToAuth = NULL;
|
const unsigned int *g_NumPlayersToAuth = NULL;
|
||||||
int lifestate_offset = -1;
|
int lifestate_offset = -1;
|
||||||
List<ICommandTargetProcessor *> target_processors;
|
List<ICommandTargetProcessor *> target_processors;
|
||||||
@@ -60,7 +62,7 @@ List<ICommandTargetProcessor *> target_processors;
|
|||||||
SH_DECL_HOOK5(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, edict_t *, const char *, const char *, char *, int);
|
SH_DECL_HOOK5(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, edict_t *, const char *, const char *, char *, int);
|
||||||
SH_DECL_HOOK2_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, edict_t *, const char *);
|
SH_DECL_HOOK2_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, edict_t *, const char *);
|
||||||
SH_DECL_HOOK1_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, edict_t *);
|
SH_DECL_HOOK1_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, edict_t *);
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &);
|
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &);
|
||||||
#else
|
#else
|
||||||
SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
|
SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
|
||||||
@@ -68,6 +70,19 @@ SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *)
|
|||||||
SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, edict_t *);
|
SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, edict_t *);
|
||||||
SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int);
|
SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int);
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
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>);
|
||||||
|
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ConCommand *maxplayersCmd = NULL;
|
||||||
|
|
||||||
|
unsigned int g_PlayerSerialCount = 0;
|
||||||
|
|
||||||
class KickPlayerTimer : public ITimedEvent
|
class KickPlayerTimer : public ITimedEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -121,7 +136,7 @@ void PlayerManager::OnSourceModAllInitialized()
|
|||||||
ParamType p1[] = {Param_Cell, Param_String, Param_Cell};
|
ParamType p1[] = {Param_Cell, Param_String, Param_Cell};
|
||||||
ParamType p2[] = {Param_Cell};
|
ParamType p2[] = {Param_Cell};
|
||||||
|
|
||||||
m_clconnect = g_Forwards.CreateForward("OnClientConnect", ET_Event, 3, p1);
|
m_clconnect = g_Forwards.CreateForward("OnClientConnect", ET_LowEvent, 3, p1);
|
||||||
m_clputinserver = g_Forwards.CreateForward("OnClientPutInServer", 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 = g_Forwards.CreateForward("OnClientDisconnect", ET_Ignore, 1, p2);
|
||||||
m_cldisconnect_post = g_Forwards.CreateForward("OnClientDisconnect_Post", ET_Ignore, 1, p2);
|
m_cldisconnect_post = g_Forwards.CreateForward("OnClientDisconnect_Post", ET_Ignore, 1, p2);
|
||||||
@@ -130,6 +145,7 @@ void PlayerManager::OnSourceModAllInitialized()
|
|||||||
m_clauth = g_Forwards.CreateForward("OnClientAuthorized", ET_Ignore, 2, NULL, Param_Cell, Param_String);
|
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_onActivate = g_Forwards.CreateForward("OnServerLoad", ET_Ignore, 0, NULL);
|
||||||
m_onActivate2 = g_Forwards.CreateForward("OnMapStart", 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);
|
PreAdminCheck = g_Forwards.CreateForward("OnClientPreAdminCheck", ET_Event, 1, p1);
|
||||||
PostAdminCheck = g_Forwards.CreateForward("OnClientPostAdminCheck", ET_Ignore, 1, p1);
|
PostAdminCheck = g_Forwards.CreateForward("OnClientPostAdminCheck", ET_Ignore, 1, p1);
|
||||||
@@ -137,6 +153,15 @@ void PlayerManager::OnSourceModAllInitialized()
|
|||||||
|
|
||||||
m_bIsListenServer = !engine->IsDedicatedServer();
|
m_bIsListenServer = !engine->IsDedicatedServer();
|
||||||
m_ListenClient = 0;
|
m_ListenClient = 0;
|
||||||
|
|
||||||
|
g_ConVarManager.AddConVarChangeListener("tv_enable", this);
|
||||||
|
|
||||||
|
ConCommand *pCmd = FindCommand("maxplayers");
|
||||||
|
if (pCmd != NULL)
|
||||||
|
{
|
||||||
|
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pCmd, CmdMaxplayersCallback, true);
|
||||||
|
maxplayersCmd = pCmd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerManager::OnSourceModShutdown()
|
void PlayerManager::OnSourceModShutdown()
|
||||||
@@ -159,12 +184,20 @@ void PlayerManager::OnSourceModShutdown()
|
|||||||
g_Forwards.ReleaseForward(m_clauth);
|
g_Forwards.ReleaseForward(m_clauth);
|
||||||
g_Forwards.ReleaseForward(m_onActivate);
|
g_Forwards.ReleaseForward(m_onActivate);
|
||||||
g_Forwards.ReleaseForward(m_onActivate2);
|
g_Forwards.ReleaseForward(m_onActivate2);
|
||||||
|
g_Forwards.ReleaseForward(OnClientConnected);
|
||||||
|
|
||||||
g_Forwards.ReleaseForward(PreAdminCheck);
|
g_Forwards.ReleaseForward(PreAdminCheck);
|
||||||
g_Forwards.ReleaseForward(PostAdminCheck);
|
g_Forwards.ReleaseForward(PostAdminCheck);
|
||||||
g_Forwards.ReleaseForward(PostAdminFilter);
|
g_Forwards.ReleaseForward(PostAdminFilter);
|
||||||
|
|
||||||
delete [] m_Players;
|
delete [] m_Players;
|
||||||
|
|
||||||
|
g_ConVarManager.RemoveConVarChangeListener("tv_enable", this);
|
||||||
|
|
||||||
|
if (maxplayersCmd != NULL)
|
||||||
|
{
|
||||||
|
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, maxplayersCmd, CmdMaxplayersCallback, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigResult PlayerManager::OnSourceModConfigChanged(const char *key,
|
ConfigResult PlayerManager::OnSourceModConfigChanged(const char *key,
|
||||||
@@ -202,13 +235,15 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
|
|||||||
/* Initialize all players */
|
/* Initialize all players */
|
||||||
m_maxClients = clientMax;
|
m_maxClients = clientMax;
|
||||||
m_PlayerCount = 0;
|
m_PlayerCount = 0;
|
||||||
m_Players = new CPlayer[m_maxClients + 1];
|
m_Players = new CPlayer[ABSOLUTE_PLAYER_LIMIT + 1];
|
||||||
m_AuthQueue = new unsigned int[m_maxClients + 1];
|
m_AuthQueue = new unsigned int[ABSOLUTE_PLAYER_LIMIT + 1];
|
||||||
m_FirstPass = true;
|
m_FirstPass = true;
|
||||||
|
|
||||||
memset(m_AuthQueue, 0, sizeof(unsigned int) * (m_maxClients + 1));
|
memset(m_AuthQueue, 0, sizeof(unsigned int) * (ABSOLUTE_PLAYER_LIMIT + 1));
|
||||||
|
|
||||||
g_NumPlayersToAuth = &m_AuthQueue[0];
|
g_NumPlayersToAuth = &m_AuthQueue[0];
|
||||||
|
|
||||||
|
g_PluginSys.SyncMaxClients(clientMax);
|
||||||
}
|
}
|
||||||
g_Extensions.CallOnCoreMapStart(pEdictList, edictCount, clientMax);
|
g_Extensions.CallOnCoreMapStart(pEdictList, edictCount, clientMax);
|
||||||
m_onActivate->Execute(NULL);
|
m_onActivate->Execute(NULL);
|
||||||
@@ -225,6 +260,13 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
|
|||||||
|
|
||||||
g_OnMapStarted = true;
|
g_OnMapStarted = true;
|
||||||
|
|
||||||
|
SMGlobalClass *cls = SMGlobalClass::head;
|
||||||
|
while (cls)
|
||||||
|
{
|
||||||
|
cls->OnSourceModLevelActivated();
|
||||||
|
cls = cls->m_pGlobalClassNext;
|
||||||
|
}
|
||||||
|
|
||||||
SM_ExecuteAllConfigs();
|
SM_ExecuteAllConfigs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,7 +330,7 @@ void PlayerManager::RunAuthChecks()
|
|||||||
unsigned int removed = 0;
|
unsigned int removed = 0;
|
||||||
for (unsigned int i=1; i<=m_AuthQueue[0]; i++)
|
for (unsigned int i=1; i<=m_AuthQueue[0]; i++)
|
||||||
{
|
{
|
||||||
pPlayer = GetPlayerByIndex(m_AuthQueue[i]);
|
pPlayer = &m_Players[m_AuthQueue[i]];
|
||||||
authstr = engine->GetPlayerNetworkIDString(pPlayer->m_pEdict);
|
authstr = engine->GetPlayerNetworkIDString(pPlayer->m_pEdict);
|
||||||
if (authstr && authstr[0] != '\0'
|
if (authstr && authstr[0] != '\0'
|
||||||
&& (strcmp(authstr, "STEAM_ID_PENDING") != 0))
|
&& (strcmp(authstr, "STEAM_ID_PENDING") != 0))
|
||||||
@@ -361,7 +403,8 @@ void PlayerManager::RunAuthChecks()
|
|||||||
|
|
||||||
bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
||||||
{
|
{
|
||||||
int client = engine->IndexOfEdict(pEntity);
|
int client = IndexOfEdict(pEntity);
|
||||||
|
CPlayer *pPlayer = &m_Players[client];
|
||||||
|
|
||||||
List<IClientListener *>::iterator iter;
|
List<IClientListener *>::iterator iter;
|
||||||
IClientListener *pListener = NULL;
|
IClientListener *pListener = NULL;
|
||||||
@@ -376,34 +419,37 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
|
|||||||
|
|
||||||
cell_t res = 1;
|
cell_t res = 1;
|
||||||
|
|
||||||
m_Players[client].Initialize(pszName, pszAddress, pEntity);
|
pPlayer->Initialize(pszName, pszAddress, pEntity);
|
||||||
m_clconnect->PushCell(client);
|
m_clconnect->PushCell(client);
|
||||||
m_clconnect->PushStringEx(reject, maxrejectlen, SM_PARAM_STRING_UTF8, SM_PARAM_COPYBACK);
|
m_clconnect->PushStringEx(reject, maxrejectlen, SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
|
||||||
m_clconnect->PushCell(maxrejectlen);
|
m_clconnect->PushCell(maxrejectlen);
|
||||||
m_clconnect->Execute(&res, NULL);
|
m_clconnect->Execute(&res);
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
if (!m_Players[client].IsAuthorized())
|
if (!pPlayer->IsAuthorized())
|
||||||
{
|
{
|
||||||
m_AuthQueue[++m_AuthQueue[0]] = client;
|
m_AuthQueue[++m_AuthQueue[0]] = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_UserIdLookUp[engine->GetPlayerUserId(pEntity)] = client;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RETURN_META_VALUE(MRES_SUPERCEDE, false);
|
if (!pPlayer->IsFakeClient())
|
||||||
|
{
|
||||||
|
RETURN_META_VALUE(MRES_SUPERCEDE, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_UserIdLookUp[engine->GetPlayerUserId(pEntity)] = client;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
||||||
{
|
{
|
||||||
int client = engine->IndexOfEdict(pEntity);
|
int client = IndexOfEdict(pEntity);
|
||||||
bool orig_value = META_RESULT_ORIG_RET(bool);
|
bool orig_value = META_RESULT_ORIG_RET(bool);
|
||||||
CPlayer *pPlayer = GetPlayerByIndex(client);
|
CPlayer *pPlayer = &m_Players[client];
|
||||||
|
|
||||||
if (orig_value)
|
if (orig_value)
|
||||||
{
|
{
|
||||||
@@ -418,13 +464,21 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!pPlayer->IsFakeClient()
|
if (!pPlayer->IsFakeClient()
|
||||||
&& m_bIsListenServer
|
&& m_bIsListenServer
|
||||||
&& strncmp(pszAddress, "127.0.0.1", 9) == 0)
|
&& strncmp(pszAddress, "127.0.0.1", 9) == 0)
|
||||||
|
{
|
||||||
|
m_ListenClient = client;
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_t res;
|
||||||
|
OnClientConnected->PushCell(client);
|
||||||
|
OnClientConnected->Execute(&res, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
m_ListenClient = client;
|
InvalidatePlayer(pPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -433,9 +487,9 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
|
|||||||
void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername)
|
void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername)
|
||||||
{
|
{
|
||||||
cell_t res;
|
cell_t res;
|
||||||
int client = engine->IndexOfEdict(pEntity);
|
int client = IndexOfEdict(pEntity);
|
||||||
|
CPlayer *pPlayer = &m_Players[client];
|
||||||
|
|
||||||
CPlayer *pPlayer = GetPlayerByIndex(client);
|
|
||||||
/* If they're not connected, they're a bot */
|
/* If they're not connected, they're a bot */
|
||||||
if (!pPlayer->IsConnected())
|
if (!pPlayer->IsConnected())
|
||||||
{
|
{
|
||||||
@@ -443,6 +497,7 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
|
|||||||
char error[255];
|
char error[255];
|
||||||
const char *authid = engine->GetPlayerNetworkIDString(pEntity);
|
const char *authid = engine->GetPlayerNetworkIDString(pEntity);
|
||||||
pPlayer->Authorize(authid);
|
pPlayer->Authorize(authid);
|
||||||
|
pPlayer->m_bFakeClient = true;
|
||||||
if (!OnClientConnect(pEntity, playername, "127.0.0.1", error, sizeof(error)))
|
if (!OnClientConnect(pEntity, playername, "127.0.0.1", error, sizeof(error)))
|
||||||
{
|
{
|
||||||
/* :TODO: kick the bot if it's rejected */
|
/* :TODO: kick the bot if it's rejected */
|
||||||
@@ -494,7 +549,7 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Players[client].Connect();
|
pPlayer->Connect();
|
||||||
m_PlayerCount++;
|
m_PlayerCount++;
|
||||||
|
|
||||||
List<IClientListener *>::iterator iter;
|
List<IClientListener *>::iterator iter;
|
||||||
@@ -508,9 +563,9 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
|
|||||||
m_clputinserver->PushCell(client);
|
m_clputinserver->PushCell(client);
|
||||||
m_clputinserver->Execute(&res, NULL);
|
m_clputinserver->Execute(&res, NULL);
|
||||||
|
|
||||||
if (m_Players[client].IsAuthorized())
|
if (pPlayer->IsAuthorized())
|
||||||
{
|
{
|
||||||
m_Players[client].DoPostConnectAuthorization();
|
pPlayer->DoPostConnectAuthorization();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,9 +585,10 @@ void PlayerManager::OnSourceModLevelEnd()
|
|||||||
void PlayerManager::OnClientDisconnect(edict_t *pEntity)
|
void PlayerManager::OnClientDisconnect(edict_t *pEntity)
|
||||||
{
|
{
|
||||||
cell_t res;
|
cell_t res;
|
||||||
int client = engine->IndexOfEdict(pEntity);
|
int client = IndexOfEdict(pEntity);
|
||||||
|
CPlayer *pPlayer = &m_Players[client];
|
||||||
|
|
||||||
if (m_Players[client].IsConnected())
|
if (pPlayer->IsConnected())
|
||||||
{
|
{
|
||||||
m_cldisconnect->PushCell(client);
|
m_cldisconnect->PushCell(client);
|
||||||
m_cldisconnect->Execute(&res, NULL);
|
m_cldisconnect->Execute(&res, NULL);
|
||||||
@@ -543,7 +599,7 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Players[client].WasCountedAsInGame())
|
if (pPlayer->WasCountedAsInGame())
|
||||||
{
|
{
|
||||||
m_PlayerCount--;
|
m_PlayerCount--;
|
||||||
}
|
}
|
||||||
@@ -556,29 +612,7 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
|
|||||||
pListener->OnClientDisconnecting(client);
|
pListener->OnClientDisconnecting(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
InvalidatePlayer(pPlayer);
|
||||||
* Remove client from auth queue if necessary
|
|
||||||
*/
|
|
||||||
if (!m_Players[client].IsAuthorized())
|
|
||||||
{
|
|
||||||
for (unsigned int i=1; i<=m_AuthQueue[0]; i++)
|
|
||||||
{
|
|
||||||
if (m_AuthQueue[i] == (unsigned)client)
|
|
||||||
{
|
|
||||||
/* Move everything ahead of us back by one */
|
|
||||||
for (unsigned int j=i+1; j<=m_AuthQueue[0]; j++)
|
|
||||||
{
|
|
||||||
m_AuthQueue[j-1] = m_AuthQueue[j];
|
|
||||||
}
|
|
||||||
/* Remove us and break */
|
|
||||||
m_AuthQueue[0]--;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Players[client].Disconnect();
|
|
||||||
m_UserIdLookUp[engine->GetPlayerUserId(pEntity)] = 0;
|
|
||||||
|
|
||||||
if (m_ListenClient == client)
|
if (m_ListenClient == client)
|
||||||
{
|
{
|
||||||
@@ -589,7 +623,7 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
|
|||||||
void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
|
void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
|
||||||
{
|
{
|
||||||
cell_t res;
|
cell_t res;
|
||||||
int client = engine->IndexOfEdict(pEntity);
|
int client = IndexOfEdict(pEntity);
|
||||||
|
|
||||||
m_cldisconnect_post->PushCell(client);
|
m_cldisconnect_post->PushCell(client);
|
||||||
m_cldisconnect_post->Execute(&res, NULL);
|
m_cldisconnect_post->Execute(&res, NULL);
|
||||||
@@ -603,7 +637,28 @@ void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
void ClientConsolePrint(edict_t *e, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
char buffer[512];
|
||||||
|
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
size_t len = vsnprintf(buffer, sizeof(buffer), fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
if (len >= sizeof(buffer) - 1)
|
||||||
|
{
|
||||||
|
buffer[sizeof(buffer) - 2] = '\n';
|
||||||
|
buffer[sizeof(buffer) - 1] = '\0';
|
||||||
|
} else {
|
||||||
|
buffer[len++] = '\n';
|
||||||
|
buffer[len] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
engine->ClientPrintf(e, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void PlayerManager::OnClientCommand(edict_t *pEntity, const CCommand &args)
|
void PlayerManager::OnClientCommand(edict_t *pEntity, const CCommand &args)
|
||||||
{
|
{
|
||||||
#else
|
#else
|
||||||
@@ -611,15 +666,48 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
|
|||||||
{
|
{
|
||||||
CCommand args;
|
CCommand args;
|
||||||
#endif
|
#endif
|
||||||
int client = engine->IndexOfEdict(pEntity);
|
int client = IndexOfEdict(pEntity);
|
||||||
cell_t res = Pl_Continue;
|
cell_t res = Pl_Continue;
|
||||||
|
CPlayer *pPlayer = &m_Players[client];
|
||||||
|
|
||||||
CPlayer *pPlayer = GetPlayerByIndex(client);
|
if (!pPlayer->IsConnected())
|
||||||
if (!pPlayer || !pPlayer->IsConnected())
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(args.Arg(0), "sm") == 0)
|
||||||
|
{
|
||||||
|
if (args.ArgC() > 1 && strcmp(args.Arg(1), "plugins") == 0)
|
||||||
|
{
|
||||||
|
g_PluginSys.ListPluginsToClient(pPlayer, args);
|
||||||
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
|
}
|
||||||
|
else if (args.ArgC() > 1 && strcmp(args.Arg(1), "credits") == 0)
|
||||||
|
{
|
||||||
|
ClientConsolePrint(pEntity,
|
||||||
|
"SourceMod would not be possible without:");
|
||||||
|
ClientConsolePrint(pEntity,
|
||||||
|
" David \"BAILOPAN\" Anderson, Borja \"faluco\" Ferrer");
|
||||||
|
ClientConsolePrint(pEntity,
|
||||||
|
" Scott \"Damaged Soul\" Ehlert, Matt \"pRED\" Woodrow");
|
||||||
|
ClientConsolePrint(pEntity,
|
||||||
|
" Michael \"ferret\" McKoy, Pavol \"PM OnoTo\" Marko");
|
||||||
|
ClientConsolePrint(pEntity,
|
||||||
|
"SourceMod is open source under the GNU General Public License.");
|
||||||
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientConsolePrint(pEntity,
|
||||||
|
"SourceMod %s, by AlliedModders LLC", SVN_FULL_VERSION);
|
||||||
|
ClientConsolePrint(pEntity,
|
||||||
|
"To see running plugins, type \"sm plugins\"");
|
||||||
|
ClientConsolePrint(pEntity,
|
||||||
|
"To see credits, type \"sm credits\"");
|
||||||
|
ClientConsolePrint(pEntity,
|
||||||
|
"Visit http://www.sourcemod.net/");
|
||||||
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
|
}
|
||||||
|
|
||||||
g_HL2.PushCommandStack(&args);
|
g_HL2.PushCommandStack(&args);
|
||||||
|
|
||||||
int argcount = args.ArgC() - 1;
|
int argcount = args.ArgC() - 1;
|
||||||
@@ -666,52 +754,58 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
|
|||||||
void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
|
void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
|
||||||
{
|
{
|
||||||
cell_t res;
|
cell_t res;
|
||||||
int client = engine->IndexOfEdict(pEntity);
|
int client = IndexOfEdict(pEntity);
|
||||||
|
CPlayer *pPlayer = &m_Players[client];
|
||||||
|
|
||||||
if (!m_Players[client].IsConnected())
|
if (!pPlayer->IsConnected())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_clinfochanged->PushCell(engine->IndexOfEdict(pEntity));
|
m_clinfochanged->PushCell(client);
|
||||||
m_clinfochanged->Execute(&res, NULL);
|
m_clinfochanged->Execute(&res, NULL);
|
||||||
|
|
||||||
IPlayerInfo *info = m_Players[client].GetPlayerInfo();
|
if (pPlayer->IsFakeClient())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPlayerInfo *info = pPlayer->GetPlayerInfo();
|
||||||
const char *new_name = info ? info->GetName() : engine->GetClientConVarValue(client, "name");
|
const char *new_name = info ? info->GetName() : engine->GetClientConVarValue(client, "name");
|
||||||
const char *old_name = m_Players[client].m_Name.c_str();
|
const char *old_name = pPlayer->m_Name.c_str();
|
||||||
|
|
||||||
if (strcmp(old_name, new_name) != 0)
|
if (strcmp(old_name, new_name) != 0)
|
||||||
{
|
{
|
||||||
AdminId id = g_Admins.FindAdminByIdentity("name", new_name);
|
AdminId id = g_Admins.FindAdminByIdentity("name", new_name);
|
||||||
if (id != INVALID_ADMIN_ID && m_Players[client].GetAdminId() != id)
|
if (id != INVALID_ADMIN_ID && pPlayer->GetAdminId() != id)
|
||||||
{
|
{
|
||||||
if (!CheckSetAdminName(client, &m_Players[client], id))
|
if (!CheckSetAdminName(client, pPlayer, id))
|
||||||
{
|
{
|
||||||
m_Players[client].Kick("Your name is reserved by SourceMod; set your password to use it.");
|
pPlayer->Kick("Your name is reserved by SourceMod; set your password to use it.");
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
} else if ((id = g_Admins.FindAdminByIdentity("name", old_name)) != INVALID_ADMIN_ID) {
|
} else if ((id = g_Admins.FindAdminByIdentity("name", old_name)) != INVALID_ADMIN_ID) {
|
||||||
if (id == m_Players[client].GetAdminId())
|
if (id == pPlayer->GetAdminId())
|
||||||
{
|
{
|
||||||
/* This player is changing their name; force them to drop admin privileges! */
|
/* This player is changing their name; force them to drop admin privileges! */
|
||||||
m_Players[client].SetAdminId(INVALID_ADMIN_ID, false);
|
pPlayer->SetAdminId(INVALID_ADMIN_ID, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_Players[client].SetName(new_name);
|
pPlayer->SetName(new_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_PassInfoVar.size() > 0)
|
if (m_PassInfoVar.size() > 0)
|
||||||
{
|
{
|
||||||
/* Try for a password change */
|
/* Try for a password change */
|
||||||
const char *old_pass = m_Players[client].m_LastPassword.c_str();
|
const char *old_pass = pPlayer->m_LastPassword.c_str();
|
||||||
const char *new_pass = engine->GetClientConVarValue(client, m_PassInfoVar.c_str());
|
const char *new_pass = engine->GetClientConVarValue(client, m_PassInfoVar.c_str());
|
||||||
if (strcmp(old_pass, new_pass) != 0)
|
if (strcmp(old_pass, new_pass) != 0)
|
||||||
{
|
{
|
||||||
m_Players[client].m_LastPassword.assign(new_pass);
|
pPlayer->m_LastPassword.assign(new_pass);
|
||||||
if (m_Players[client].IsInGame() && m_Players[client].IsAuthorized())
|
if (pPlayer->IsInGame() && pPlayer->IsAuthorized())
|
||||||
{
|
{
|
||||||
/* If there is already an admin id assigned, this will just bail out. */
|
/* If there is already an admin id assigned, this will just bail out. */
|
||||||
m_Players[client].DoBasicAdminChecks();
|
pPlayer->DoBasicAdminChecks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -793,7 +887,7 @@ void PlayerManager::RemoveClientListener(IClientListener *listener)
|
|||||||
|
|
||||||
IGamePlayer *PlayerManager::GetGamePlayer(edict_t *pEdict)
|
IGamePlayer *PlayerManager::GetGamePlayer(edict_t *pEdict)
|
||||||
{
|
{
|
||||||
int index = engine->IndexOfEdict(pEdict);
|
int index = IndexOfEdict(pEdict);
|
||||||
return GetGamePlayer(index);
|
return GetGamePlayer(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -862,6 +956,33 @@ void PlayerManager::UnregisterCommandTargetProcessor(ICommandTargetProcessor *pH
|
|||||||
target_processors.remove(pHandler);
|
target_processors.remove(pHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlayerManager::InvalidatePlayer(CPlayer *pPlayer)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Remove client from auth queue if necessary
|
||||||
|
*/
|
||||||
|
if (!pPlayer->IsAuthorized())
|
||||||
|
{
|
||||||
|
for (unsigned int i=1; i<=m_AuthQueue[0]; i++)
|
||||||
|
{
|
||||||
|
if (m_AuthQueue[i] == (unsigned)pPlayer->m_iIndex)
|
||||||
|
{
|
||||||
|
/* Move everything ahead of us back by one */
|
||||||
|
for (unsigned int j=i+1; j<=m_AuthQueue[0]; j++)
|
||||||
|
{
|
||||||
|
m_AuthQueue[j-1] = m_AuthQueue[j];
|
||||||
|
}
|
||||||
|
/* Remove us and break */
|
||||||
|
m_AuthQueue[0]--;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_UserIdLookUp[engine->GetPlayerUserId(pPlayer->m_pEdict)] = 0;
|
||||||
|
pPlayer->Disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
int PlayerManager::InternalFilterCommandTarget(CPlayer *pAdmin, CPlayer *pTarget, int flags)
|
int PlayerManager::InternalFilterCommandTarget(CPlayer *pAdmin, CPlayer *pTarget, int flags)
|
||||||
{
|
{
|
||||||
if ((flags & COMMAND_FILTER_CONNECTED) == COMMAND_FILTER_CONNECTED
|
if ((flags & COMMAND_FILTER_CONNECTED) == COMMAND_FILTER_CONNECTED
|
||||||
@@ -1187,6 +1308,95 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerManager::MaxPlayersChanged( int newvalue /*= -1*/ )
|
||||||
|
{
|
||||||
|
if (!m_FirstPass)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newvalue == -1)
|
||||||
|
{
|
||||||
|
newvalue = gpGlobals->maxClients;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newvalue == MaxClients())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Notify the rest of core */
|
||||||
|
SMGlobalClass *pBase = SMGlobalClass::head;
|
||||||
|
while (pBase)
|
||||||
|
{
|
||||||
|
pBase->OnSourceModMaxPlayersChanged(newvalue);
|
||||||
|
pBase = pBase->m_pGlobalClassNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Notify Extensions */
|
||||||
|
List<IClientListener *>::iterator iter;
|
||||||
|
IClientListener *pListener = NULL;
|
||||||
|
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
|
||||||
|
{
|
||||||
|
pListener = (*iter);
|
||||||
|
if (pListener->GetClientListenerVersion() >= 8)
|
||||||
|
{
|
||||||
|
pListener->OnMaxPlayersChanged(newvalue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int PlayerManager::GetClientFromSerial(unsigned int serial)
|
||||||
|
{
|
||||||
|
serial_t s;
|
||||||
|
s.value = serial;
|
||||||
|
|
||||||
|
int client = s.bits.index;
|
||||||
|
|
||||||
|
IGamePlayer *pPlayer = GetGamePlayer(client);
|
||||||
|
|
||||||
|
if (!pPlayer)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (serial == pPlayer->GetSerial())
|
||||||
|
{
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
void CmdMaxplayersCallback(const CCommand &command)
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
void CmdMaxplayersCallback()
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
g_Players.MaxPlayersChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************
|
/*******************
|
||||||
*** PLAYER CODE ***
|
*** PLAYER CODE ***
|
||||||
*******************/
|
*******************/
|
||||||
@@ -1203,7 +1413,8 @@ CPlayer::CPlayer()
|
|||||||
m_bAdminCheckSignalled = false;
|
m_bAdminCheckSignalled = false;
|
||||||
m_bIsInKickQueue = false;
|
m_bIsInKickQueue = false;
|
||||||
m_LastPassword.clear();
|
m_LastPassword.clear();
|
||||||
m_LangId = LANGUAGE_ENGLISH;
|
m_LangId = SOURCEMOD_LANGUAGE_ENGLISH;
|
||||||
|
m_bFakeClient = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
|
void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
|
||||||
@@ -1212,9 +1423,12 @@ void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
|
|||||||
m_Name.assign(name);
|
m_Name.assign(name);
|
||||||
m_Ip.assign(ip);
|
m_Ip.assign(ip);
|
||||||
m_pEdict = pEntity;
|
m_pEdict = pEntity;
|
||||||
m_iIndex = engine->IndexOfEdict(pEntity);
|
m_iIndex = IndexOfEdict(pEntity);
|
||||||
m_LangId = g_Translator.GetServerLanguage();
|
m_LangId = g_Translator.GetServerLanguage();
|
||||||
|
|
||||||
|
m_Serial.bits.index = m_iIndex;
|
||||||
|
m_Serial.bits.serial = g_PlayerSerialCount++;
|
||||||
|
|
||||||
char ip2[24], *ptr;
|
char ip2[24], *ptr;
|
||||||
strncopy(ip2, ip, sizeof(ip2));
|
strncopy(ip2, ip, sizeof(ip2));
|
||||||
if ((ptr = strchr(ip2, ':')) != NULL)
|
if ((ptr = strchr(ip2, ':')) != NULL)
|
||||||
@@ -1234,7 +1448,7 @@ void CPlayer::Connect()
|
|||||||
m_IsInGame = true;
|
m_IsInGame = true;
|
||||||
|
|
||||||
const char *var = g_Players.GetPassInfoVar();
|
const char *var = g_Players.GetPassInfoVar();
|
||||||
int client = engine->IndexOfEdict(m_pEdict);
|
int client = IndexOfEdict(m_pEdict);
|
||||||
if (var[0] != '\0')
|
if (var[0] != '\0')
|
||||||
{
|
{
|
||||||
const char *pass = engine->GetClientConVarValue(client, var);
|
const char *pass = engine->GetClientConVarValue(client, var);
|
||||||
@@ -1271,6 +1485,7 @@ void CPlayer::Disconnect()
|
|||||||
m_bAdminCheckSignalled = false;
|
m_bAdminCheckSignalled = false;
|
||||||
m_UserId = -1;
|
m_UserId = -1;
|
||||||
m_bIsInKickQueue = false;
|
m_bIsInKickQueue = false;
|
||||||
|
m_bFakeClient = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayer::SetName(const char *name)
|
void CPlayer::SetName(const char *name)
|
||||||
@@ -1335,7 +1550,7 @@ IPlayerInfo *CPlayer::GetPlayerInfo()
|
|||||||
|
|
||||||
bool CPlayer::IsFakeClient()
|
bool CPlayer::IsFakeClient()
|
||||||
{
|
{
|
||||||
return (strcmp(m_AuthID.c_str(), "BOT") == 0);
|
return m_bFakeClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayer::SetAdminId(AdminId id, bool temporary)
|
void CPlayer::SetAdminId(AdminId id, bool temporary)
|
||||||
@@ -1480,7 +1695,7 @@ void CPlayer::DoBasicAdminChecks()
|
|||||||
|
|
||||||
/* First check the name */
|
/* First check the name */
|
||||||
AdminId id;
|
AdminId id;
|
||||||
int client = engine->IndexOfEdict(m_pEdict);
|
int client = IndexOfEdict(m_pEdict);
|
||||||
|
|
||||||
if ((id = g_Admins.FindAdminByIdentity("name", GetName())) != INVALID_ADMIN_ID)
|
if ((id = g_Admins.FindAdminByIdentity("name", GetName())) != INVALID_ADMIN_ID)
|
||||||
{
|
{
|
||||||
@@ -1501,7 +1716,7 @@ void CPlayer::DoBasicAdminChecks()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check IP address */
|
/* Check steam id */
|
||||||
if ((id = g_Admins.FindAdminByIdentity("steam", m_AuthID.c_str())) != INVALID_ADMIN_ID)
|
if ((id = g_Admins.FindAdminByIdentity("steam", m_AuthID.c_str())) != INVALID_ADMIN_ID)
|
||||||
{
|
{
|
||||||
if (g_Players.CheckSetAdmin(client, this, id))
|
if (g_Players.CheckSetAdmin(client, this, id))
|
||||||
@@ -1577,3 +1792,8 @@ int CPlayer::GetLifeState()
|
|||||||
return PLAYER_LIFE_DEAD;
|
return PLAYER_LIFE_DEAD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int CPlayer::GetSerial()
|
||||||
|
{
|
||||||
|
return m_Serial.value;
|
||||||
|
}
|
||||||
|
|||||||
+31
-2
@@ -41,6 +41,7 @@
|
|||||||
#include <sh_string.h>
|
#include <sh_string.h>
|
||||||
#include <sh_list.h>
|
#include <sh_list.h>
|
||||||
#include <sh_vector.h>
|
#include <sh_vector.h>
|
||||||
|
#include "ConVarManager.h"
|
||||||
|
|
||||||
using namespace SourceHook;
|
using namespace SourceHook;
|
||||||
|
|
||||||
@@ -50,6 +51,16 @@ using namespace SourceHook;
|
|||||||
|
|
||||||
#define MIN_API_FOR_ADMINCALLS 7
|
#define MIN_API_FOR_ADMINCALLS 7
|
||||||
|
|
||||||
|
union serial_t
|
||||||
|
{
|
||||||
|
uint32_t value;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint8_t index;
|
||||||
|
uint32_t serial : 24;
|
||||||
|
} bits;
|
||||||
|
};
|
||||||
|
|
||||||
class CPlayer : public IGamePlayer
|
class CPlayer : public IGamePlayer
|
||||||
{
|
{
|
||||||
friend class PlayerManager;
|
friend class PlayerManager;
|
||||||
@@ -73,6 +84,7 @@ public:
|
|||||||
int GetUserId();
|
int GetUserId();
|
||||||
bool RunAdminCacheChecks();
|
bool RunAdminCacheChecks();
|
||||||
void NotifyPostAdminChecks();
|
void NotifyPostAdminChecks();
|
||||||
|
unsigned int GetSerial();
|
||||||
public:
|
public:
|
||||||
void DoBasicAdminChecks();
|
void DoBasicAdminChecks();
|
||||||
bool IsInKickQueue();
|
bool IsInKickQueue();
|
||||||
@@ -105,11 +117,14 @@ private:
|
|||||||
int m_iIndex;
|
int m_iIndex;
|
||||||
unsigned int m_LangId;
|
unsigned int m_LangId;
|
||||||
int m_UserId;
|
int m_UserId;
|
||||||
|
bool m_bFakeClient;
|
||||||
|
serial_t m_Serial;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PlayerManager :
|
class PlayerManager :
|
||||||
public SMGlobalClass,
|
public SMGlobalClass,
|
||||||
public IPlayerManager
|
public IPlayerManager,
|
||||||
|
public IConVarChangeListener
|
||||||
{
|
{
|
||||||
friend class CPlayer;
|
friend class CPlayer;
|
||||||
public:
|
public:
|
||||||
@@ -120,6 +135,7 @@ public: //SMGlobalClass
|
|||||||
void OnSourceModShutdown();
|
void OnSourceModShutdown();
|
||||||
void OnSourceModLevelEnd();
|
void OnSourceModLevelEnd();
|
||||||
ConfigResult OnSourceModConfigChanged(const char *key, const char *value, ConfigSource source, char *error, size_t maxlength);
|
ConfigResult OnSourceModConfigChanged(const char *key, const char *value, ConfigSource source, char *error, size_t maxlength);
|
||||||
|
void OnSourceModMaxPlayersChanged(int newvalue);
|
||||||
public:
|
public:
|
||||||
CPlayer *GetPlayerByIndex(int client) const;
|
CPlayer *GetPlayerByIndex(int client) const;
|
||||||
void RunAuthChecks();
|
void RunAuthChecks();
|
||||||
@@ -131,7 +147,7 @@ public:
|
|||||||
void OnClientPutInServer(edict_t *pEntity, char const *playername);
|
void OnClientPutInServer(edict_t *pEntity, char const *playername);
|
||||||
void OnClientDisconnect(edict_t *pEntity);
|
void OnClientDisconnect(edict_t *pEntity);
|
||||||
void OnClientDisconnect_Post(edict_t *pEntity);
|
void OnClientDisconnect_Post(edict_t *pEntity);
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void OnClientCommand(edict_t *pEntity, const CCommand &args);
|
void OnClientCommand(edict_t *pEntity, const CCommand &args);
|
||||||
#else
|
#else
|
||||||
void OnClientCommand(edict_t *pEntity);
|
void OnClientCommand(edict_t *pEntity);
|
||||||
@@ -152,6 +168,9 @@ public: //IPlayerManager
|
|||||||
void RegisterCommandTargetProcessor(ICommandTargetProcessor *pHandler);
|
void RegisterCommandTargetProcessor(ICommandTargetProcessor *pHandler);
|
||||||
void UnregisterCommandTargetProcessor(ICommandTargetProcessor *pHandler);
|
void UnregisterCommandTargetProcessor(ICommandTargetProcessor *pHandler);
|
||||||
void ProcessCommandTarget(cmd_target_info_t *info);
|
void ProcessCommandTarget(cmd_target_info_t *info);
|
||||||
|
int GetClientFromSerial(unsigned int serial);
|
||||||
|
public: // IConVarChangeListener
|
||||||
|
void OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue);
|
||||||
public:
|
public:
|
||||||
inline int MaxClients()
|
inline int MaxClients()
|
||||||
{
|
{
|
||||||
@@ -171,8 +190,10 @@ public:
|
|||||||
void RecheckAnyAdmins();
|
void RecheckAnyAdmins();
|
||||||
unsigned int GetReplyTo();
|
unsigned int GetReplyTo();
|
||||||
unsigned int SetReplyTo(unsigned int reply);
|
unsigned int SetReplyTo(unsigned int reply);
|
||||||
|
void MaxPlayersChanged(int newvalue = -1);
|
||||||
private:
|
private:
|
||||||
void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
|
void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
|
||||||
|
void InvalidatePlayer(CPlayer *pPlayer);
|
||||||
private:
|
private:
|
||||||
List<IClientListener *> m_hooks;
|
List<IClientListener *> m_hooks;
|
||||||
IForward *m_clconnect;
|
IForward *m_clconnect;
|
||||||
@@ -196,6 +217,14 @@ private:
|
|||||||
int m_ListenClient;
|
int m_ListenClient;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
void CmdMaxplayersCallback(const CCommand &command);
|
||||||
|
#else
|
||||||
|
void CmdMaxplayersCallback();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void ClientConsolePrint(edict_t *e, const char *fmt, ...);
|
||||||
|
|
||||||
extern PlayerManager g_Players;
|
extern PlayerManager g_Players;
|
||||||
extern bool g_OnMapStarted;
|
extern bool g_OnMapStarted;
|
||||||
extern const unsigned int *g_NumPlayersToAuth;
|
extern const unsigned int *g_NumPlayersToAuth;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -43,16 +43,22 @@
|
|||||||
#include <sh_vector.h>
|
#include <sh_vector.h>
|
||||||
#include <sh_string.h>
|
#include <sh_string.h>
|
||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "vm/sp_vm_basecontext.h"
|
|
||||||
#include "PluginInfoDatabase.h"
|
#include "PluginInfoDatabase.h"
|
||||||
#include "sm_trie.h"
|
#include "sm_trie.h"
|
||||||
#include "sourcemod.h"
|
#include "sourcemod.h"
|
||||||
#include <IRootConsoleMenu.h>
|
#include <IRootConsoleMenu.h>
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
#include "convar_sm_l4d.h"
|
||||||
|
#elif (SOURCE_ENGINE == SE_ORANGEBOX) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE)
|
||||||
#include "convar_sm_ob.h"
|
#include "convar_sm_ob.h"
|
||||||
#else
|
#else
|
||||||
#include "convar_sm.h"
|
#include "convar_sm.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "ITranslator.h"
|
||||||
|
#include "NativeOwner.h"
|
||||||
|
#include "ShareSys.h"
|
||||||
|
|
||||||
|
class CPlayer;
|
||||||
|
|
||||||
using namespace SourceHook;
|
using namespace SourceHook;
|
||||||
|
|
||||||
@@ -106,27 +112,6 @@ using namespace SourceHook;
|
|||||||
* 7. Once all plugins are deemed to be loaded, OnPluginStart() is called
|
* 7. Once all plugins are deemed to be loaded, OnPluginStart() is called
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SM_CONTEXTVAR_MYSELF 0
|
|
||||||
|
|
||||||
struct ContextPair
|
|
||||||
{
|
|
||||||
ContextPair() : base(NULL), ctx(NULL), co(NULL)
|
|
||||||
{
|
|
||||||
};
|
|
||||||
BaseContext *base;
|
|
||||||
sp_context_t *ctx;
|
|
||||||
ICompilation *co;
|
|
||||||
IVirtualMachine *vm;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FakeNative
|
|
||||||
{
|
|
||||||
IPluginContext *ctx;
|
|
||||||
IPluginFunction *call;
|
|
||||||
String name;
|
|
||||||
SPVM_NATIVE_FUNC func;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum LoadRes
|
enum LoadRes
|
||||||
{
|
{
|
||||||
LoadRes_Successful,
|
LoadRes_Successful,
|
||||||
@@ -143,18 +128,10 @@ struct AutoConfig
|
|||||||
};
|
};
|
||||||
|
|
||||||
class CPlugin;
|
class CPlugin;
|
||||||
struct WeakNative
|
|
||||||
{
|
|
||||||
WeakNative(CPlugin *plugin, uint32_t index)
|
|
||||||
{
|
|
||||||
pl = plugin;
|
|
||||||
idx = index;
|
|
||||||
}
|
|
||||||
CPlugin *pl;
|
|
||||||
uint32_t idx;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CPlugin : public IPlugin
|
class CPlugin :
|
||||||
|
public IPlugin,
|
||||||
|
public CNativeOwner
|
||||||
{
|
{
|
||||||
friend class CPluginManager;
|
friend class CPluginManager;
|
||||||
friend class CFunction;
|
friend class CFunction;
|
||||||
@@ -165,17 +142,19 @@ public:
|
|||||||
PluginType GetType();
|
PluginType GetType();
|
||||||
SourcePawn::IPluginContext *GetBaseContext();
|
SourcePawn::IPluginContext *GetBaseContext();
|
||||||
sp_context_t *GetContext();
|
sp_context_t *GetContext();
|
||||||
const sm_plugininfo_t *GetPublicInfo();
|
void *GetPluginStructure();
|
||||||
const char *GetFilename();
|
const char *GetFilename();
|
||||||
bool IsDebugging();
|
bool IsDebugging();
|
||||||
PluginStatus GetStatus();
|
PluginStatus GetStatus();
|
||||||
|
const sm_plugininfo_t *GetPublicInfo();
|
||||||
bool SetPauseState(bool paused);
|
bool SetPauseState(bool paused);
|
||||||
unsigned int GetSerial();
|
unsigned int GetSerial();
|
||||||
const sp_plugin_t *GetPluginStructure();
|
|
||||||
IdentityToken_t *GetIdentity();
|
IdentityToken_t *GetIdentity();
|
||||||
unsigned int CalcMemUsage();
|
unsigned int CalcMemUsage();
|
||||||
bool SetProperty(const char *prop, void *ptr);
|
bool SetProperty(const char *prop, void *ptr);
|
||||||
bool GetProperty(const char *prop, void **ptr, bool remove=false);
|
bool GetProperty(const char *prop, void **ptr, bool remove=false);
|
||||||
|
void DropEverything();
|
||||||
|
SourcePawn::IPluginRuntime *GetRuntime();
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Creates a plugin object with default values.
|
* Creates a plugin object with default values.
|
||||||
@@ -186,16 +165,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
static CPlugin *CreatePlugin(const char *file, char *error, size_t maxlength);
|
static CPlugin *CreatePlugin(const char *file, char *error, size_t maxlength);
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* Starts the initial compilation of a plugin.
|
|
||||||
* Returns false if another compilation exists or there is a current context set.
|
|
||||||
*/
|
|
||||||
ICompilation *StartMyCompile(IVirtualMachine *vm);
|
|
||||||
/**
|
|
||||||
* Finalizes a compilation. If error buffer is NULL, the error is saved locally.
|
|
||||||
*/
|
|
||||||
bool FinishMyCompile(char *error, size_t maxlength);
|
|
||||||
void CancelMyCompile();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets an error state on the plugin
|
* Sets an error state on the plugin
|
||||||
@@ -233,30 +202,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
void Call_OnAllPluginsLoaded();
|
void Call_OnAllPluginsLoaded();
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggles debug mode in the plugin
|
|
||||||
*/
|
|
||||||
bool ToggleDebugMode(bool debug, char *error, size_t maxlength);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if a plugin is usable.
|
* Returns true if a plugin is usable.
|
||||||
*/
|
*/
|
||||||
bool IsRunnable();
|
bool IsRunnable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a language file index to the plugin's list.
|
* Get languages info.
|
||||||
*/
|
*/
|
||||||
void AddLangFile(unsigned int index);
|
IPhraseCollection *GetPhrases();
|
||||||
|
|
||||||
/**
|
|
||||||
* Get language file count for this plugin.
|
|
||||||
*/
|
|
||||||
size_t GetLangFileCount();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get language file index based on the vector index.
|
|
||||||
*/
|
|
||||||
unsigned int GetLangFileByIndex(unsigned int index);
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Returns the modification time during last plugin load.
|
* Returns the modification time during last plugin load.
|
||||||
@@ -275,6 +229,7 @@ public:
|
|||||||
|
|
||||||
Handle_t GetMyHandle();
|
Handle_t GetMyHandle();
|
||||||
|
|
||||||
|
bool AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func);
|
||||||
void AddConfig(bool autoCreate, const char *cfg, const char *folder);
|
void AddConfig(bool autoCreate, const char *cfg, const char *folder);
|
||||||
unsigned int GetConfigCount();
|
unsigned int GetConfigCount();
|
||||||
AutoConfig *GetConfig(unsigned int i);
|
AutoConfig *GetConfig(unsigned int i);
|
||||||
@@ -283,28 +238,23 @@ public:
|
|||||||
m_Libraries.push_back(name);
|
m_Libraries.push_back(name);
|
||||||
}
|
}
|
||||||
void LibraryActions(bool dropping);
|
void LibraryActions(bool dropping);
|
||||||
|
void SyncMaxClients(int max_clients);
|
||||||
protected:
|
protected:
|
||||||
void UpdateInfo();
|
bool UpdateInfo();
|
||||||
void SetTimeStamp(time_t t);
|
void SetTimeStamp(time_t t);
|
||||||
void DependencyDropped(CPlugin *pOwner);
|
void DependencyDropped(CPlugin *pOwner);
|
||||||
private:
|
private:
|
||||||
ContextPair m_ctx;
|
|
||||||
PluginType m_type;
|
PluginType m_type;
|
||||||
char m_filename[PLATFORM_MAX_PATH];
|
char m_filename[PLATFORM_MAX_PATH];
|
||||||
PluginStatus m_status;
|
PluginStatus m_status;
|
||||||
unsigned int m_serial;
|
unsigned int m_serial;
|
||||||
sm_plugininfo_t m_info;
|
sm_plugininfo_t m_info;
|
||||||
sp_plugin_t *m_plugin;
|
|
||||||
char m_errormsg[256];
|
char m_errormsg[256];
|
||||||
time_t m_LastAccess;
|
time_t m_LastAccess;
|
||||||
IdentityToken_t *m_ident;
|
IdentityToken_t *m_ident;
|
||||||
Handle_t m_handle;
|
Handle_t m_handle;
|
||||||
bool m_WasRunning;
|
bool m_WasRunning;
|
||||||
CVector<unsigned int> m_PhraseFiles;
|
IPhraseCollection *m_pPhrases;
|
||||||
List<CPlugin *> m_dependents;
|
|
||||||
List<CPlugin *> m_dependsOn;
|
|
||||||
List<FakeNative *> m_fakeNatives;
|
|
||||||
List<WeakNative> m_WeakNatives;
|
|
||||||
List<String> m_RequiredLibs;
|
List<String> m_RequiredLibs;
|
||||||
List<String> m_Libraries;
|
List<String> m_Libraries;
|
||||||
Trie *m_pProps;
|
Trie *m_pProps;
|
||||||
@@ -314,6 +264,9 @@ private:
|
|||||||
bool m_bGotAllLoaded;
|
bool m_bGotAllLoaded;
|
||||||
int m_FileVersion;
|
int m_FileVersion;
|
||||||
char m_DateTime[256];
|
char m_DateTime[256];
|
||||||
|
IPluginRuntime *m_pRuntime;
|
||||||
|
IPluginContext *m_pContext;
|
||||||
|
sp_pubvar_t *m_MaxClientsVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPluginManager :
|
class CPluginManager :
|
||||||
@@ -360,6 +313,7 @@ public: //IPluginManager
|
|||||||
public: //SMGlobalClass
|
public: //SMGlobalClass
|
||||||
void OnSourceModAllInitialized();
|
void OnSourceModAllInitialized();
|
||||||
void OnSourceModShutdown();
|
void OnSourceModShutdown();
|
||||||
|
void OnSourceModMaxPlayersChanged(int newvalue);
|
||||||
public: //IHandleTypeDispatch
|
public: //IHandleTypeDispatch
|
||||||
void OnHandleDestroy(HandleType_t type, void *object);
|
void OnHandleDestroy(HandleType_t type, void *object);
|
||||||
bool GetHandleApproxSize(HandleType_t type, void *object, unsigned int *pSize);
|
bool GetHandleApproxSize(HandleType_t type, void *object, unsigned int *pSize);
|
||||||
@@ -392,11 +346,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool IsLateLoadTime() const;
|
bool IsLateLoadTime() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds natives from core into the native pool.
|
|
||||||
*/
|
|
||||||
void RegisterNativesFromCore(sp_nativeinfo_t *natives);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a Handle to an IPlugin if possible.
|
* Converts a Handle to an IPlugin if possible.
|
||||||
*/
|
*/
|
||||||
@@ -412,10 +361,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Internal version of FindPluginByContext()
|
* Internal version of FindPluginByContext()
|
||||||
*/
|
*/
|
||||||
inline CPlugin *GetPluginByCtx(const sp_context_t *ctx)
|
CPlugin *GetPluginByCtx(const sp_context_t *ctx);
|
||||||
{
|
|
||||||
return reinterpret_cast<CPlugin *>(ctx->user[SM_CONTEXTVAR_MYSELF]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets status text for a status code
|
* Gets status text for a status code
|
||||||
@@ -451,6 +397,10 @@ public:
|
|||||||
void UnloadAll();
|
void UnloadAll();
|
||||||
|
|
||||||
CPlugin *FindPluginByConsoleArg(const char *arg);
|
CPlugin *FindPluginByConsoleArg(const char *arg);
|
||||||
|
|
||||||
|
void SyncMaxClients(int max_clients);
|
||||||
|
|
||||||
|
void ListPluginsToClient(CPlayer *player, const CCommand &args);
|
||||||
private:
|
private:
|
||||||
LoadRes _LoadPlugin(CPlugin **pPlugin, const char *path, bool debug, PluginType type, char error[], size_t maxlength);
|
LoadRes _LoadPlugin(CPlugin **pPlugin, const char *path, bool debug, PluginType type, char error[], size_t maxlength);
|
||||||
|
|
||||||
@@ -471,11 +421,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
bool RunSecondPass(CPlugin *pPlugin, char *error, size_t maxlength);
|
bool RunSecondPass(CPlugin *pPlugin, char *error, size_t maxlength);
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds any globally registered natives to a plugin
|
|
||||||
*/
|
|
||||||
void AddCoreNativesToPlugin(CPlugin *pPlugin);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs an extension pass on a plugin.
|
* Runs an extension pass on a plugin.
|
||||||
*/
|
*/
|
||||||
@@ -497,11 +442,7 @@ public:
|
|||||||
{
|
{
|
||||||
return m_MyIdent;
|
return m_MyIdent;
|
||||||
}
|
}
|
||||||
public:
|
|
||||||
bool AddFakeNative(IPluginFunction *pFunction, const char *name, SPVM_FAKENATIVE_FUNC func);
|
|
||||||
SPVM_NATIVE_FUNC FindCoreNative(const char *name);
|
|
||||||
private:
|
private:
|
||||||
void AddFakeNativesToPlugin(CPlugin *pPlugin);
|
|
||||||
void TryRefreshDependencies(CPlugin *pOther);
|
void TryRefreshDependencies(CPlugin *pOther);
|
||||||
private:
|
private:
|
||||||
List<IPluginsListener *> m_listeners;
|
List<IPluginsListener *> m_listeners;
|
||||||
@@ -511,11 +452,9 @@ private:
|
|||||||
Trie *m_LoadLookup;
|
Trie *m_LoadLookup;
|
||||||
bool m_AllPluginsLoaded;
|
bool m_AllPluginsLoaded;
|
||||||
IdentityToken_t *m_MyIdent;
|
IdentityToken_t *m_MyIdent;
|
||||||
Trie *m_pCoreNatives;
|
|
||||||
|
|
||||||
/* Dynamic native stuff */
|
/* Dynamic native stuff */
|
||||||
List<FakeNative *> m_Natives;
|
List<FakeNative *> m_Natives;
|
||||||
Trie *m_pNativeLookup;
|
|
||||||
|
|
||||||
bool m_LoadingLocked;
|
bool m_LoadingLocked;
|
||||||
};
|
};
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
@@ -0,0 +1,529 @@
|
|||||||
|
/**
|
||||||
|
* 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 "ShareSys.h"
|
||||||
|
#include "HandleSys.h"
|
||||||
|
#include "ExtensionSys.h"
|
||||||
|
#include "LibrarySys.h"
|
||||||
|
#include "PluginSys.h"
|
||||||
|
#include "sm_stringutil.h"
|
||||||
|
|
||||||
|
ShareSystem g_ShareSys;
|
||||||
|
static unsigned int g_mark_serial = 0;
|
||||||
|
|
||||||
|
ShareSystem::ShareSystem()
|
||||||
|
{
|
||||||
|
m_IdentRoot.ident = 0;
|
||||||
|
m_TypeRoot = 0;
|
||||||
|
m_IfaceType = 0;
|
||||||
|
m_CoreType = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
IdentityToken_t *ShareSystem::CreateCoreIdentity()
|
||||||
|
{
|
||||||
|
if (!m_CoreType)
|
||||||
|
{
|
||||||
|
m_CoreType = CreateIdentType("CORE");
|
||||||
|
}
|
||||||
|
|
||||||
|
return CreateIdentity(m_CoreType, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareSystem::Initialize()
|
||||||
|
{
|
||||||
|
TypeAccess sec;
|
||||||
|
|
||||||
|
g_HandleSys.InitAccessDefaults(&sec, NULL);
|
||||||
|
sec.ident = GetIdentRoot();
|
||||||
|
|
||||||
|
m_TypeRoot = g_HandleSys.CreateType("Identity", this, 0, &sec, NULL, NULL, NULL);
|
||||||
|
m_IfaceType = g_HandleSys.CreateType("Interface", this, 0, NULL, NULL, GetIdentRoot(), NULL);
|
||||||
|
|
||||||
|
/* Initialize our static identity handle */
|
||||||
|
m_IdentRoot.ident = g_HandleSys.CreateHandle(m_TypeRoot, NULL, NULL, GetIdentRoot(), NULL);
|
||||||
|
|
||||||
|
/* Add the Handle System and others... they are too innocent and pure to do it themselves */
|
||||||
|
AddInterface(NULL, &g_HandleSys);
|
||||||
|
AddInterface(NULL, &g_LibSys);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareSystem::OnSourceModShutdown()
|
||||||
|
{
|
||||||
|
if (m_CoreType)
|
||||||
|
{
|
||||||
|
g_HandleSys.RemoveType(m_CoreType, GetIdentRoot());
|
||||||
|
}
|
||||||
|
|
||||||
|
g_HandleSys.RemoveType(m_IfaceType, GetIdentRoot());
|
||||||
|
g_HandleSys.RemoveType(m_TypeRoot, GetIdentRoot());
|
||||||
|
}
|
||||||
|
|
||||||
|
IdentityType_t ShareSystem::FindIdentType(const char *name)
|
||||||
|
{
|
||||||
|
HandleType_t type;
|
||||||
|
|
||||||
|
if (g_HandleSys.FindHandleType(name, &type))
|
||||||
|
{
|
||||||
|
if (g_HandleSys.TypeCheck(type, m_TypeRoot))
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
IdentityType_t ShareSystem::CreateIdentType(const char *name)
|
||||||
|
{
|
||||||
|
if (!m_TypeRoot)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_HandleSys.CreateType(name, this, m_TypeRoot, NULL, NULL, GetIdentRoot(), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareSystem::OnHandleDestroy(HandleType_t type, void *object)
|
||||||
|
{
|
||||||
|
/* THIS WILL NEVER BE CALLED FOR ANYTHING WITH THE IDENTITY TYPE */
|
||||||
|
}
|
||||||
|
|
||||||
|
IdentityToken_t *ShareSystem::CreateIdentity(IdentityType_t type, void *ptr)
|
||||||
|
{
|
||||||
|
if (!m_TypeRoot)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* :TODO: Cache? */
|
||||||
|
IdentityToken_t *pToken = new IdentityToken_t;
|
||||||
|
|
||||||
|
HandleSecurity sec;
|
||||||
|
sec.pOwner = sec.pIdentity = GetIdentRoot();
|
||||||
|
|
||||||
|
pToken->ident = g_HandleSys.CreateHandleInt(type, NULL, &sec, NULL, NULL, true);
|
||||||
|
pToken->ptr = ptr;
|
||||||
|
pToken->type = type;
|
||||||
|
|
||||||
|
return pToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShareSystem::AddInterface(IExtension *myself, SMInterface *iface)
|
||||||
|
{
|
||||||
|
if (!iface)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
IfaceInfo info;
|
||||||
|
|
||||||
|
info.owner = myself;
|
||||||
|
info.iface = iface;
|
||||||
|
|
||||||
|
m_Interfaces.push_back(info);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShareSystem::RequestInterface(const char *iface_name,
|
||||||
|
unsigned int iface_vers,
|
||||||
|
IExtension *myself,
|
||||||
|
SMInterface **pIface)
|
||||||
|
{
|
||||||
|
/* See if the interface exists */
|
||||||
|
List<IfaceInfo>::iterator iter;
|
||||||
|
SMInterface *iface;
|
||||||
|
IExtension *iface_owner;
|
||||||
|
bool found = false;
|
||||||
|
for (iter=m_Interfaces.begin(); iter!=m_Interfaces.end(); iter++)
|
||||||
|
{
|
||||||
|
IfaceInfo &info = (*iter);
|
||||||
|
iface = info.iface;
|
||||||
|
if (strcmp(iface->GetInterfaceName(), iface_name) == 0)
|
||||||
|
{
|
||||||
|
if (iface->GetInterfaceVersion() == iface_vers
|
||||||
|
|| iface->IsVersionCompatible(iface_vers))
|
||||||
|
{
|
||||||
|
iface_owner = info.owner;
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add a dependency node */
|
||||||
|
if (iface_owner)
|
||||||
|
{
|
||||||
|
IfaceInfo info;
|
||||||
|
info.iface = iface;
|
||||||
|
info.owner = iface_owner;
|
||||||
|
g_Extensions.BindDependency(myself, &info);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pIface)
|
||||||
|
{
|
||||||
|
*pIface = iface;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareSystem::AddNatives(IExtension *myself, const sp_nativeinfo_t *natives)
|
||||||
|
{
|
||||||
|
CNativeOwner *pOwner;
|
||||||
|
|
||||||
|
pOwner = g_Extensions.GetNativeOwner(myself);
|
||||||
|
|
||||||
|
pOwner->AddNatives(natives);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareSystem::DestroyIdentity(IdentityToken_t *identity)
|
||||||
|
{
|
||||||
|
HandleSecurity sec;
|
||||||
|
|
||||||
|
sec.pOwner = GetIdentRoot();
|
||||||
|
sec.pIdentity = GetIdentRoot();
|
||||||
|
|
||||||
|
g_HandleSys.FreeHandle(identity->ident, &sec);
|
||||||
|
delete identity;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareSystem::DestroyIdentType(IdentityType_t type)
|
||||||
|
{
|
||||||
|
g_HandleSys.RemoveType(type, GetIdentRoot());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareSystem::RemoveInterfaces(IExtension *pExtension)
|
||||||
|
{
|
||||||
|
List<IfaceInfo>::iterator iter = m_Interfaces.begin();
|
||||||
|
|
||||||
|
while (iter != m_Interfaces.end())
|
||||||
|
{
|
||||||
|
if ((*iter).owner == pExtension)
|
||||||
|
{
|
||||||
|
iter = m_Interfaces.erase(iter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareSystem::AddDependency(IExtension *myself, const char *filename, bool require, bool autoload)
|
||||||
|
{
|
||||||
|
g_Extensions.AddDependency(myself, filename, require, autoload);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareSystem::RegisterLibrary(IExtension *myself, const char *name)
|
||||||
|
{
|
||||||
|
g_Extensions.AddLibrary(myself, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareSystem::OverrideNatives(IExtension *myself, const sp_nativeinfo_t *natives)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
NativeEntry *pEntry;
|
||||||
|
CNativeOwner *pOwner;
|
||||||
|
|
||||||
|
pOwner = g_Extensions.GetNativeOwner(myself);
|
||||||
|
|
||||||
|
for (i = 0; natives[i].func != NULL && natives[i].name != NULL; i++)
|
||||||
|
{
|
||||||
|
if ((pEntry = FindNative(natives[i].name)) == NULL)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pEntry->owner != g_pCoreNatives)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pEntry->replacement.owner != NULL)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now it's safe to add the override */
|
||||||
|
pEntry->replacement.func = natives[i].func;
|
||||||
|
pEntry->replacement.owner = pOwner;
|
||||||
|
pOwner->AddReplacedNative(pEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NativeEntry *ShareSystem::FindNative(const char *name)
|
||||||
|
{
|
||||||
|
NativeEntry **ppEntry;
|
||||||
|
|
||||||
|
if ((ppEntry = m_NtvCache.retrieve(name)) == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return *ppEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareSystem::BindNativesToPlugin(CPlugin *pPlugin, bool bCoreOnly)
|
||||||
|
{
|
||||||
|
NativeEntry *pEntry;
|
||||||
|
sp_native_t *native;
|
||||||
|
uint32_t i, native_count;
|
||||||
|
IPluginContext *pContext;
|
||||||
|
|
||||||
|
pContext = pPlugin->GetBaseContext();
|
||||||
|
|
||||||
|
/* Generate a new serial ID, mark our dependencies with it. */
|
||||||
|
g_mark_serial++;
|
||||||
|
pPlugin->PropogateMarkSerial(g_mark_serial);
|
||||||
|
|
||||||
|
native_count = pContext->GetNativesNum();
|
||||||
|
for (i = 0; i < native_count; i++)
|
||||||
|
{
|
||||||
|
if (pContext->GetNativeByIndex(i, &native) != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we're bound, check if there is a replacement available.
|
||||||
|
* If not, this native is totally finalized.
|
||||||
|
*/
|
||||||
|
if (native->status == SP_NATIVE_BOUND)
|
||||||
|
{
|
||||||
|
pEntry = (NativeEntry *)native->user;
|
||||||
|
assert(pEntry != NULL);
|
||||||
|
if (pEntry->replacement.owner == NULL
|
||||||
|
|| (pEntry->replacement.owner != NULL
|
||||||
|
&& pEntry->replacement.func == native->pfn))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Otherwise, the native must be in our cache. */
|
||||||
|
else if ((pEntry = FindNative(native->name)) == NULL)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bCoreOnly && pEntry->owner != g_pCoreNatives)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
BindNativeToPlugin(pPlugin, native, i, pEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareSystem::BindNativeToPlugin(CPlugin *pPlugin, NativeEntry *pEntry)
|
||||||
|
{
|
||||||
|
uint32_t i;
|
||||||
|
sp_native_t *native;
|
||||||
|
IPluginContext *pContext;
|
||||||
|
|
||||||
|
pContext = pPlugin->GetBaseContext();
|
||||||
|
|
||||||
|
if (pContext->FindNativeByName(pEntry->name, &i) != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pContext->GetNativeByIndex(i, &native) != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (native->status == SP_NATIVE_BOUND)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BindNativeToPlugin(pPlugin, native, i, pEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareSystem::BindNativeToPlugin(CPlugin *pPlugin,
|
||||||
|
sp_native_t *native,
|
||||||
|
uint32_t index,
|
||||||
|
NativeEntry *pEntry)
|
||||||
|
{
|
||||||
|
/* Mark as bound... we do the rest next. */
|
||||||
|
native->status = SP_NATIVE_BOUND;
|
||||||
|
native->user = pEntry;
|
||||||
|
|
||||||
|
/* See if a replacement is available. */
|
||||||
|
if (pEntry->replacement.owner != NULL)
|
||||||
|
{
|
||||||
|
/* Perform a replacement bind. */
|
||||||
|
native->pfn = pEntry->replacement.func;
|
||||||
|
pEntry->replacement.owner->AddWeakRef(WeakNative(pPlugin, index, pEntry));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Perform a normal bind. */
|
||||||
|
native->pfn = pEntry->func;
|
||||||
|
|
||||||
|
/* We don't bother with dependency crap if the owner is Core. */
|
||||||
|
if (pEntry->owner != g_pCoreNatives)
|
||||||
|
{
|
||||||
|
/* The native is optional, this is a special case */
|
||||||
|
if ((native->flags & SP_NTVFLAG_OPTIONAL) == SP_NTVFLAG_OPTIONAL)
|
||||||
|
{
|
||||||
|
/* Only add if there is a valid owner. */
|
||||||
|
if (pEntry->owner != NULL)
|
||||||
|
{
|
||||||
|
pEntry->owner->AddWeakRef(WeakNative(pPlugin, index));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
native->status = SP_NATIVE_UNBOUND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Otherwise, we're a strong dependent and not a weak one */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* See if this has already been marked as a dependent.
|
||||||
|
* If it has, it means this relationship has already occurred,
|
||||||
|
* and there is no reason to do it again.
|
||||||
|
*/
|
||||||
|
if (pEntry->owner != pPlugin
|
||||||
|
&& pEntry->owner->GetMarkSerial() != g_mark_serial)
|
||||||
|
{
|
||||||
|
/* This has not been marked as a dependency yet */
|
||||||
|
//pPlugin->AddDependency(pEntry->owner);
|
||||||
|
pEntry->owner->AddDependent(pPlugin);
|
||||||
|
pEntry->owner->SetMarkSerial(g_mark_serial);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NativeEntry *ShareSystem::AddNativeToCache(CNativeOwner *pOwner, const sp_nativeinfo_t *ntv)
|
||||||
|
{
|
||||||
|
NativeEntry *pEntry;
|
||||||
|
|
||||||
|
if ((pEntry = FindNative(ntv->name)) == NULL)
|
||||||
|
{
|
||||||
|
pEntry = new NativeEntry;
|
||||||
|
|
||||||
|
pEntry->owner = pOwner;
|
||||||
|
pEntry->name = ntv->name;
|
||||||
|
pEntry->func = ntv->func;
|
||||||
|
pEntry->replacement.func = NULL;
|
||||||
|
pEntry->replacement.owner = NULL;
|
||||||
|
pEntry->fake = NULL;
|
||||||
|
|
||||||
|
m_NtvCache.insert(ntv->name, pEntry);
|
||||||
|
|
||||||
|
return pEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pEntry->owner != NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pEntry->owner = pOwner;
|
||||||
|
pEntry->func = ntv->func;
|
||||||
|
pEntry->name = ntv->name;
|
||||||
|
|
||||||
|
return pEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareSystem::ClearNativeFromCache(CNativeOwner *pOwner, const char *name)
|
||||||
|
{
|
||||||
|
NativeEntry *pEntry;
|
||||||
|
|
||||||
|
if ((pEntry = FindNative(name)) == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pEntry->owner != pOwner)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pEntry->fake != NULL)
|
||||||
|
{
|
||||||
|
g_pSourcePawn2->DestroyFakeNative(pEntry->func);
|
||||||
|
delete pEntry->fake;
|
||||||
|
pEntry->fake = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pEntry->func = NULL;
|
||||||
|
pEntry->name = NULL;
|
||||||
|
pEntry->owner = NULL;
|
||||||
|
pEntry->replacement.func = NULL;
|
||||||
|
pEntry->replacement.owner = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
NativeEntry *ShareSystem::AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func)
|
||||||
|
{
|
||||||
|
FakeNative *pFake;
|
||||||
|
NativeEntry *pEntry;
|
||||||
|
SPVM_NATIVE_FUNC gate;
|
||||||
|
|
||||||
|
if ((pEntry = FindNative(name)) != NULL && pEntry->owner != NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFake = new FakeNative;
|
||||||
|
|
||||||
|
if ((gate = g_pSourcePawn2->CreateFakeNative(func, pFake)) == NULL)
|
||||||
|
{
|
||||||
|
delete pFake;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pEntry == NULL)
|
||||||
|
{
|
||||||
|
pEntry = new NativeEntry;
|
||||||
|
m_NtvCache.insert(name, pEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
pFake->call = pFunc;
|
||||||
|
pFake->ctx = pFunc->GetParentContext();
|
||||||
|
strncopy(pFake->name, name, sizeof(pFake->name));
|
||||||
|
|
||||||
|
pEntry->fake = pFake;
|
||||||
|
pEntry->func = gate;
|
||||||
|
pEntry->name = pFake->name;
|
||||||
|
pEntry->owner = g_PluginSys.GetPluginByCtx(pFake->ctx->GetContext());
|
||||||
|
pEntry->replacement.func = NULL;
|
||||||
|
pEntry->replacement.owner = NULL;
|
||||||
|
|
||||||
|
return pEntry;
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
#include <IShareSys.h>
|
#include <IShareSys.h>
|
||||||
#include <IHandleSys.h>
|
#include <IHandleSys.h>
|
||||||
#include <sh_list.h>
|
#include <sh_list.h>
|
||||||
|
#include <sm_trie_tpl.h>
|
||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "sourcemod.h"
|
#include "sourcemod.h"
|
||||||
|
|
||||||
@@ -60,11 +61,38 @@ struct IfaceInfo
|
|||||||
IExtension *owner;
|
IExtension *owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CNativeOwner;
|
||||||
|
class CPlugin;
|
||||||
|
struct NativeEntry;
|
||||||
|
|
||||||
|
struct ReplaceNative
|
||||||
|
{
|
||||||
|
CNativeOwner *owner;
|
||||||
|
SPVM_NATIVE_FUNC func;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FakeNative
|
||||||
|
{
|
||||||
|
char name[64];
|
||||||
|
IPluginContext *ctx;
|
||||||
|
IPluginFunction *call;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct NativeEntry
|
||||||
|
{
|
||||||
|
CNativeOwner *owner;
|
||||||
|
SPVM_NATIVE_FUNC func;
|
||||||
|
const char *name;
|
||||||
|
ReplaceNative replacement;
|
||||||
|
FakeNative *fake;
|
||||||
|
};
|
||||||
|
|
||||||
class ShareSystem :
|
class ShareSystem :
|
||||||
public IShareSys,
|
public IShareSys,
|
||||||
public SMGlobalClass,
|
public SMGlobalClass,
|
||||||
public IHandleTypeDispatch
|
public IHandleTypeDispatch
|
||||||
{
|
{
|
||||||
|
friend class CNativeOwner;
|
||||||
public:
|
public:
|
||||||
ShareSystem();
|
ShareSystem();
|
||||||
public: //IShareSys
|
public: //IShareSys
|
||||||
@@ -96,12 +124,25 @@ public:
|
|||||||
{
|
{
|
||||||
return &m_IdentRoot;
|
return &m_IdentRoot;
|
||||||
}
|
}
|
||||||
|
public:
|
||||||
|
void BindNativesToPlugin(CPlugin *pPlugin, bool bCoreOnly);
|
||||||
|
void BindNativeToPlugin(CPlugin *pPlugin, NativeEntry *pEntry);
|
||||||
|
NativeEntry *AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func);
|
||||||
|
NativeEntry *FindNative(const char *name);
|
||||||
|
private:
|
||||||
|
NativeEntry *AddNativeToCache(CNativeOwner *pOwner, const sp_nativeinfo_t *ntv);
|
||||||
|
void ClearNativeFromCache(CNativeOwner *pOwner, const char *name);
|
||||||
|
void BindNativeToPlugin(CPlugin *pPlugin,
|
||||||
|
sp_native_t *ntv,
|
||||||
|
uint32_t index,
|
||||||
|
NativeEntry *pEntry);
|
||||||
private:
|
private:
|
||||||
List<IfaceInfo> m_Interfaces;
|
List<IfaceInfo> m_Interfaces;
|
||||||
HandleType_t m_TypeRoot;
|
HandleType_t m_TypeRoot;
|
||||||
IdentityToken_t m_IdentRoot;
|
IdentityToken_t m_IdentRoot;
|
||||||
HandleType_t m_IfaceType;
|
HandleType_t m_IfaceType;
|
||||||
IdentityType_t m_CoreType;
|
IdentityType_t m_CoreType;
|
||||||
|
KTrie<NativeEntry *> m_NtvCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ShareSystem g_ShareSys;
|
extern ShareSystem g_ShareSys;
|
||||||
+60
-48
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -48,7 +48,7 @@ static int g_ws_chartable[255] = {0};
|
|||||||
|
|
||||||
bool TextParsers::IsWhitespace(const char *stream)
|
bool TextParsers::IsWhitespace(const char *stream)
|
||||||
{
|
{
|
||||||
return g_ws_chartable[(unsigned)*stream] == 1;
|
return g_ws_chartable[(unsigned char)*stream] == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextParsers::TextParsers()
|
TextParsers::TextParsers()
|
||||||
@@ -79,45 +79,6 @@ unsigned int TextParsers::GetUTF8CharBytes(const char *stream)
|
|||||||
return _GetUTF8CharBytes(stream);
|
return _GetUTF8CharBytes(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Character streams
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct CharStream
|
|
||||||
{
|
|
||||||
const char *curpos;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool CharStreamReader(void *stream, char *buffer, size_t maxlength, unsigned int *read)
|
|
||||||
{
|
|
||||||
CharStream *srdr = (CharStream *)stream;
|
|
||||||
|
|
||||||
const char *ptr = srdr->curpos;
|
|
||||||
for (size_t i=0; i<maxlength; i++)
|
|
||||||
{
|
|
||||||
if (*ptr == '\0')
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*buffer++ = *ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
*read = ptr - srdr->curpos;
|
|
||||||
|
|
||||||
srdr->curpos = ptr;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
SMCError TextParsers::ParseString_SMC(const char *stream,
|
|
||||||
ITextListener_SMC *smc,
|
|
||||||
SMCStates *states)
|
|
||||||
{
|
|
||||||
CharStream srdr = { stream };
|
|
||||||
|
|
||||||
return ParseStream_SMC(&srdr, CharStreamReader, smc, states);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File streams
|
* File streams
|
||||||
*/
|
*/
|
||||||
@@ -189,6 +150,57 @@ SMCError TextParsers::ParseSMCFile(const char *file,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct RawStream
|
||||||
|
{
|
||||||
|
const char *stream;
|
||||||
|
size_t length;
|
||||||
|
size_t pos;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool RawStreamReader(void *stream, char *buffer, size_t maxlength, unsigned int *read)
|
||||||
|
{
|
||||||
|
RawStream *rs = (RawStream *)stream;
|
||||||
|
|
||||||
|
if (rs->pos >= rs->length)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t remaining = rs->length - rs->pos;
|
||||||
|
|
||||||
|
/* Use the smaller of the two */
|
||||||
|
size_t copy = (remaining > maxlength) ? maxlength : remaining;
|
||||||
|
|
||||||
|
memcpy(buffer, &rs->stream[rs->pos], copy);
|
||||||
|
rs->pos += copy;
|
||||||
|
*read = copy;
|
||||||
|
assert(rs->pos <= rs->length);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
SMCError TextParsers::ParseSMCStream(const char *stream,
|
||||||
|
size_t length,
|
||||||
|
ITextListener_SMC *smc_listener,
|
||||||
|
SMCStates *states,
|
||||||
|
char *buffer,
|
||||||
|
size_t maxsize)
|
||||||
|
{
|
||||||
|
RawStream rs;
|
||||||
|
SMCError result;
|
||||||
|
|
||||||
|
rs.stream = stream;
|
||||||
|
rs.length = length;
|
||||||
|
rs.pos = 0;
|
||||||
|
|
||||||
|
result = ParseStream_SMC(&rs, RawStreamReader, smc_listener, states);
|
||||||
|
|
||||||
|
const char *errstr = GetSMCErrorString(result);
|
||||||
|
UTIL_Format(buffer, maxsize, "%s", errstr != NULL ? errstr : "Unknown error");
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raw parsing of streams with helper functions
|
* Raw parsing of streams with helper functions
|
||||||
*/
|
*/
|
||||||
@@ -496,7 +508,7 @@ SMCError TextParsers::ParseStream_SMC(void *stream,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Check if we're whitespace or not */
|
/* Check if we're whitespace or not */
|
||||||
if (!g_ws_chartable[(unsigned)c])
|
if (!g_ws_chartable[(unsigned char)c])
|
||||||
{
|
{
|
||||||
bool restage = false;
|
bool restage = false;
|
||||||
/* Check various special tokens:
|
/* Check various special tokens:
|
||||||
@@ -811,7 +823,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
|||||||
***************************************************/
|
***************************************************/
|
||||||
|
|
||||||
/* First strip beginning whitespace */
|
/* First strip beginning whitespace */
|
||||||
while (*ptr != '\0' && g_ws_chartable[(unsigned)*ptr] != 0)
|
while (*ptr != '\0' && g_ws_chartable[(unsigned char)*ptr] != 0)
|
||||||
{
|
{
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
@@ -864,7 +876,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
|||||||
/* Lastly, strip ending whitespace off */
|
/* Lastly, strip ending whitespace off */
|
||||||
for (size_t i=len-1; i>=0 && i<len; i--)
|
for (size_t i=len-1; i>=0 && i<len; i--)
|
||||||
{
|
{
|
||||||
if (g_ws_chartable[(unsigned)ptr[i]])
|
if (g_ws_chartable[(unsigned char)ptr[i]])
|
||||||
{
|
{
|
||||||
ptr[i] = '\0';
|
ptr[i] = '\0';
|
||||||
len--;
|
len--;
|
||||||
@@ -905,7 +917,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
|||||||
i += _GetUTF8CharBytes(&ptr[i]) - 1;
|
i += _GetUTF8CharBytes(&ptr[i]) - 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned)c] != 0);
|
alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned char)c] != 0);
|
||||||
}
|
}
|
||||||
if (!alnum)
|
if (!alnum)
|
||||||
{
|
{
|
||||||
@@ -958,12 +970,12 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
|||||||
i += _GetUTF8CharBytes(&ptr[i]) - 1;
|
i += _GetUTF8CharBytes(&ptr[i]) - 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned)c] != 0);
|
alnum = (isalnum(c) != 0) || (g_ini_chartable1[(unsigned char)c] != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!alnum)
|
if (!alnum)
|
||||||
{
|
{
|
||||||
if (g_ws_chartable[(unsigned)c])
|
if (g_ws_chartable[(unsigned char)c])
|
||||||
{
|
{
|
||||||
/* if it's a space, keep track of the first occurring space */
|
/* if it's a space, keep track of the first occurring space */
|
||||||
if (!first_space)
|
if (!first_space)
|
||||||
@@ -1002,7 +1014,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
|
|||||||
if (val_ptr)
|
if (val_ptr)
|
||||||
{
|
{
|
||||||
/* eat up spaces! there shouldn't be any h*/
|
/* eat up spaces! there shouldn't be any h*/
|
||||||
while ((*val_ptr != '\0') && g_ws_chartable[(unsigned)*val_ptr] != 0)
|
while ((*val_ptr != '\0') && g_ws_chartable[(unsigned char)*val_ptr] != 0)
|
||||||
{
|
{
|
||||||
val_ptr++;
|
val_ptr++;
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-4
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -70,14 +70,18 @@ public:
|
|||||||
char *buffer,
|
char *buffer,
|
||||||
size_t maxsize);
|
size_t maxsize);
|
||||||
|
|
||||||
|
SMCError ParseSMCStream(const char *stream,
|
||||||
|
size_t length,
|
||||||
|
ITextListener_SMC *smc_listener,
|
||||||
|
SMCStates *states,
|
||||||
|
char *buffer,
|
||||||
|
size_t maxsize);
|
||||||
|
|
||||||
unsigned int GetUTF8CharBytes(const char *stream);
|
unsigned int GetUTF8CharBytes(const char *stream);
|
||||||
|
|
||||||
const char *GetSMCErrorString(SMCError err);
|
const char *GetSMCErrorString(SMCError err);
|
||||||
bool IsWhitespace(const char *stream);
|
bool IsWhitespace(const char *stream);
|
||||||
private:
|
private:
|
||||||
SMCError ParseString_SMC(const char *stream,
|
|
||||||
ITextListener_SMC *smc,
|
|
||||||
SMCStates *states);
|
|
||||||
SMCError ParseStream_SMC(void *stream,
|
SMCError ParseStream_SMC(void *stream,
|
||||||
STREAMREADER srdr,
|
STREAMREADER srdr,
|
||||||
ITextListener_SMC *smc,
|
ITextListener_SMC *smc,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
+173
-85
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -38,9 +38,11 @@
|
|||||||
#include "sm_stringutil.h"
|
#include "sm_stringutil.h"
|
||||||
#include "sourcemod.h"
|
#include "sourcemod.h"
|
||||||
#include "PlayerManager.h"
|
#include "PlayerManager.h"
|
||||||
|
#include "PhraseCollection.h"
|
||||||
|
#include "ShareSys.h"
|
||||||
|
|
||||||
Translator g_Translator;
|
Translator g_Translator;
|
||||||
CPhraseFile *g_pCorePhrases = NULL;
|
IPhraseCollection *g_pCorePhrases = NULL;
|
||||||
unsigned int g_pCorePhraseID = 0;
|
unsigned int g_pCorePhraseID = 0;
|
||||||
|
|
||||||
struct trans_t
|
struct trans_t
|
||||||
@@ -101,7 +103,7 @@ void CPhraseFile::ParseWarning(const char *message, ...)
|
|||||||
m_FileLogged = true;
|
m_FileLogged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_Logger.LogError("[SM] %s", message);
|
g_Logger.LogError("[SM] %s", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPhraseFile::ReparseFile()
|
void CPhraseFile::ReparseFile()
|
||||||
@@ -150,6 +152,45 @@ void CPhraseFile::ReparseFile()
|
|||||||
g_Logger.LogError("[SM] Fatal error encountered parsing translation file \"%s\"", m_File.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);
|
g_Logger.LogError("[SM] Error (line %d, column %d): %s", states.line, states.col, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *code;
|
||||||
|
for (unsigned int i = 1; i < m_LangCount; i++)
|
||||||
|
{
|
||||||
|
if (!m_pTranslator->GetLanguageInfo(i, &code, NULL))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_SourceMod.BuildPath(Path_SM,
|
||||||
|
path,
|
||||||
|
PLATFORM_MAX_PATH,
|
||||||
|
"translations/%s/%s",
|
||||||
|
code,
|
||||||
|
m_File.c_str());
|
||||||
|
|
||||||
|
/* Speculatively load these. */
|
||||||
|
if (!g_LibSys.PathExists(path))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((err=textparsers->ParseFile_SMC(path, this, &states)) != SMCError_Okay)
|
||||||
|
{
|
||||||
|
const char *msg = textparsers->GetSMCErrorString(err);
|
||||||
|
if (!msg)
|
||||||
|
{
|
||||||
|
msg = m_ParseError.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
g_Logger.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",
|
||||||
|
states.line,
|
||||||
|
states.col,
|
||||||
|
msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPhraseFile::ReadSMC_ParseStart()
|
void CPhraseFile::ReadSMC_ParseStart()
|
||||||
@@ -176,18 +217,18 @@ SMCResult CPhraseFile::ReadSMC_NewSection(const SMCStates *states, const char *n
|
|||||||
m_ParseState = PPS_InPhrase;
|
m_ParseState = PPS_InPhrase;
|
||||||
recognized = true;
|
recognized = true;
|
||||||
|
|
||||||
phrase_t *pPhrase;
|
void *value;
|
||||||
m_CurPhrase = m_pMemory->CreateMem(sizeof(phrase_t), (void **)&pPhrase);
|
if (sm_trie_retrieve(m_pPhraseLookup, name, &value))
|
||||||
|
|
||||||
/* Create the reverse lookup */
|
|
||||||
if (!sm_trie_insert(m_pPhraseLookup, name, reinterpret_cast<void *>(m_CurPhrase)))
|
|
||||||
{
|
{
|
||||||
ParseWarning("Skipping duplicate phrase \"%s\" on line %d.", name, states->line);
|
m_CurPhrase = reinterpret_cast<int>(value);
|
||||||
/* :IDEA: prevent memory waste by seeking backwards in memtable? */
|
|
||||||
m_CurPhrase = -1;
|
|
||||||
}
|
}
|
||||||
else
|
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));
|
||||||
|
|
||||||
/* Initialize new phrase */
|
/* Initialize new phrase */
|
||||||
trans_t *pTrans;
|
trans_t *pTrans;
|
||||||
|
|
||||||
@@ -205,8 +246,9 @@ SMCResult CPhraseFile::ReadSMC_NewSection(const SMCStates *states, const char *n
|
|||||||
{
|
{
|
||||||
pTrans[i].stridx = -1;
|
pTrans[i].stridx = -1;
|
||||||
}
|
}
|
||||||
m_LastPhraseString.assign(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_LastPhraseString.assign(name);
|
||||||
}
|
}
|
||||||
else if (m_ParseState == PPS_InPhrase)
|
else if (m_ParseState == PPS_InPhrase)
|
||||||
{
|
{
|
||||||
@@ -232,14 +274,11 @@ SMCResult CPhraseFile::ReadSMC_KeyValue(const SMCStates *states, const char *key
|
|||||||
|
|
||||||
phrase_t *pPhrase = (phrase_t *)m_pMemory->GetAddress(m_CurPhrase);
|
phrase_t *pPhrase = (phrase_t *)m_pMemory->GetAddress(m_CurPhrase);
|
||||||
|
|
||||||
if (key[0] == '#' && strcmp(key, "#format") == 0)
|
/* Duplicate format keys get silently ignored. */
|
||||||
|
if (key[0] == '#'
|
||||||
|
&& strcmp(key, "#format") == 0
|
||||||
|
&& pPhrase->fmt_list == -1)
|
||||||
{
|
{
|
||||||
if (pPhrase->fmt_list != -1)
|
|
||||||
{
|
|
||||||
ParseWarning("Ignoring duplicated #format property on line %d", states->line);
|
|
||||||
return SMCResult_Continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pPhrase->translations > 0)
|
if (pPhrase->translations > 0)
|
||||||
{
|
{
|
||||||
ParseWarning("#format property should come before translations on line %d, ignoring", states->line);
|
ParseWarning("#format property should come before translations on line %d, ignoring", states->line);
|
||||||
@@ -448,7 +487,7 @@ SMCResult CPhraseFile::ReadSMC_KeyValue(const SMCStates *states, const char *key
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t len = strlen(key);
|
size_t len = strlen(key);
|
||||||
if (len != 2)
|
if (len < 2 || len > 3)
|
||||||
{
|
{
|
||||||
ParseWarning("Ignoring translation to invalid language \"%s\" on line %d.", key, states->line);
|
ParseWarning("Ignoring translation to invalid language \"%s\" on line %d.", key, states->line);
|
||||||
return SMCResult_Continue;
|
return SMCResult_Continue;
|
||||||
@@ -663,7 +702,7 @@ const char *CPhraseFile::GetFilename()
|
|||||||
** MAIN TRANSLATOR CODE **
|
** MAIN TRANSLATOR CODE **
|
||||||
**************************/
|
**************************/
|
||||||
|
|
||||||
Translator::Translator() : m_ServerLang(LANGUAGE_ENGLISH)
|
Translator::Translator() : m_ServerLang(SOURCEMOD_LANGUAGE_ENGLISH)
|
||||||
{
|
{
|
||||||
m_pStringTab = new BaseStringTable(2048);
|
m_pStringTab = new BaseStringTable(2048);
|
||||||
m_pLCodeLookup = sm_trie_create();
|
m_pLCodeLookup = sm_trie_create();
|
||||||
@@ -727,11 +766,15 @@ void Translator::OnSourceModAllInitialized()
|
|||||||
{
|
{
|
||||||
AddLanguage("en", "English");
|
AddLanguage("en", "English");
|
||||||
|
|
||||||
unsigned int id;
|
g_pCorePhrases = CreatePhraseCollection();
|
||||||
|
g_pCorePhrases->AddPhraseFile("core.phrases");
|
||||||
|
|
||||||
id = FindOrAddPhraseFile("core.phrases.txt");
|
g_ShareSys.AddInterface(NULL, this);
|
||||||
g_pCorePhraseID = id;
|
}
|
||||||
g_pCorePhrases = GetFileByIndex(id);
|
|
||||||
|
void Translator::OnSourceModShutdown()
|
||||||
|
{
|
||||||
|
g_pCorePhrases->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Translator::GetLanguageByCode(const char *code, unsigned int *index)
|
bool Translator::GetLanguageByCode(const char *code, unsigned int *index)
|
||||||
@@ -842,7 +885,7 @@ void Translator::RebuildLanguageDatabase(const char *lang_header_file)
|
|||||||
g_Logger.LogError("Server language was set to bad language \"%s\" -- reverting to English", m_InitialLang);
|
g_Logger.LogError("Server language was set to bad language \"%s\" -- reverting to English", m_InitialLang);
|
||||||
|
|
||||||
strncopy(m_InitialLang, "en", sizeof(m_InitialLang));
|
strncopy(m_InitialLang, "en", sizeof(m_InitialLang));
|
||||||
m_ServerLang = LANGUAGE_ENGLISH;
|
m_ServerLang = SOURCEMOD_LANGUAGE_ENGLISH;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ServerLang = reinterpret_cast<unsigned int>(serverLang);
|
m_ServerLang = reinterpret_cast<unsigned int>(serverLang);
|
||||||
@@ -893,7 +936,7 @@ SMCResult Translator::ReadSMC_KeyValue(const SMCStates *states, const char *key,
|
|||||||
{
|
{
|
||||||
size_t len = strlen(key);
|
size_t len = strlen(key);
|
||||||
|
|
||||||
if (len != 2)
|
if (len < 2 || len > 3)
|
||||||
{
|
{
|
||||||
g_Logger.LogError("[SM] Warning encountered parsing languages.cfg file.");
|
g_Logger.LogError("[SM] Warning encountered parsing languages.cfg file.");
|
||||||
g_Logger.LogError("[SM] Invalid language code \"%s\" is being ignored.", key);
|
g_Logger.LogError("[SM] Invalid language code \"%s\" is being ignored.", key);
|
||||||
@@ -914,9 +957,7 @@ bool Translator::AddLanguage(const char *langcode, const char *description)
|
|||||||
Language *pLanguage = new Language;
|
Language *pLanguage = new Language;
|
||||||
unsigned int idx = m_Languages.size();
|
unsigned int idx = m_Languages.size();
|
||||||
|
|
||||||
pLanguage->m_code2[0] = langcode[0];
|
UTIL_Format(pLanguage->m_code2, sizeof(pLanguage->m_code2), "%s", langcode);
|
||||||
pLanguage->m_code2[1] = langcode[1];
|
|
||||||
pLanguage->m_code2[2] = langcode[2];
|
|
||||||
pLanguage->m_FullName = m_pStringTab->AddString(description);
|
pLanguage->m_FullName = m_pStringTab->AddString(description);
|
||||||
|
|
||||||
sm_trie_insert(m_pLCodeLookup, langcode, reinterpret_cast<void *>(idx));
|
sm_trie_insert(m_pLCodeLookup, langcode, reinterpret_cast<void *>(idx));
|
||||||
@@ -936,61 +977,6 @@ CPhraseFile *Translator::GetFileByIndex(unsigned int index)
|
|||||||
return m_Files[index];
|
return m_Files[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Translator::Translate(char *buffer, size_t maxlength, void **params, const Translation *pTrans)
|
|
||||||
{
|
|
||||||
void *new_params[MAX_TRANSLATE_PARAMS];
|
|
||||||
|
|
||||||
/* Rewrite the parameter order */
|
|
||||||
for (unsigned int i=0; i<pTrans->fmt_count; i++)
|
|
||||||
{
|
|
||||||
new_params[i] = params[pTrans->fmt_order[i]];
|
|
||||||
}
|
|
||||||
|
|
||||||
return gnprintf(buffer, maxlength, pTrans->szPhrase, new_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
TransError Translator::CoreTransEx(CPhraseFile *pFile,
|
|
||||||
int client,
|
|
||||||
char *buffer,
|
|
||||||
size_t maxlength,
|
|
||||||
const char *phrase,
|
|
||||||
void **params,
|
|
||||||
size_t *outlen)
|
|
||||||
{
|
|
||||||
Translation trans;
|
|
||||||
TransError err;
|
|
||||||
|
|
||||||
/* Using server lang temporarily until client lang stuff is implemented */
|
|
||||||
if ((err = pFile->GetTranslation(phrase, m_ServerLang, &trans)) != Trans_Okay)
|
|
||||||
{
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t len = Translate(buffer, maxlength, params, &trans);
|
|
||||||
|
|
||||||
if (outlen)
|
|
||||||
{
|
|
||||||
*outlen = len;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Trans_Okay;
|
|
||||||
}
|
|
||||||
|
|
||||||
TransError Translator::CoreTrans(int client,
|
|
||||||
char *buffer,
|
|
||||||
size_t maxlength,
|
|
||||||
const char *phrase,
|
|
||||||
void **params,
|
|
||||||
size_t *outlen)
|
|
||||||
{
|
|
||||||
if (!g_pCorePhrases)
|
|
||||||
{
|
|
||||||
return Trans_BadPhraseFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CoreTransEx(g_pCorePhrases, client, buffer, maxlength, phrase, params, outlen);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int Translator::GetServerLanguage()
|
unsigned int Translator::GetServerLanguage()
|
||||||
{
|
{
|
||||||
return m_ServerLang;
|
return m_ServerLang;
|
||||||
@@ -1021,3 +1007,105 @@ bool Translator::GetLanguageInfo(unsigned int number, const char **code, const c
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *Translator::GetInterfaceName()
|
||||||
|
{
|
||||||
|
return SMINTERFACE_TRANSLATOR_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int Translator::GetInterfaceVersion()
|
||||||
|
{
|
||||||
|
return SMINTERFACE_TRANSLATOR_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPhraseCollection *Translator::CreatePhraseCollection()
|
||||||
|
{
|
||||||
|
return new CPhraseCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
int Translator::SetGlobalTarget(int index)
|
||||||
|
{
|
||||||
|
return g_SourceMod.SetGlobalTarget(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Translator::GetGlobalTarget() const
|
||||||
|
{
|
||||||
|
return g_SourceMod.GetGlobalTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CoreTranslate(char *buffer,
|
||||||
|
size_t maxlength,
|
||||||
|
const char *format,
|
||||||
|
unsigned int numparams,
|
||||||
|
size_t *pOutLength,
|
||||||
|
...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
unsigned int i;
|
||||||
|
const char *fail_phrase;
|
||||||
|
void *params[MAX_TRANSLATE_PARAMS];
|
||||||
|
|
||||||
|
if (numparams > MAX_TRANSLATE_PARAMS)
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
va_start(ap, pOutLength);
|
||||||
|
for (i = 0; i < numparams; i++)
|
||||||
|
{
|
||||||
|
params[i] = va_arg(ap, void *);
|
||||||
|
}
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
if (!g_pCorePhrases->FormatString(buffer,
|
||||||
|
maxlength,
|
||||||
|
format,
|
||||||
|
params,
|
||||||
|
numparams,
|
||||||
|
pOutLength,
|
||||||
|
&fail_phrase))
|
||||||
|
{
|
||||||
|
if (fail_phrase != NULL)
|
||||||
|
{
|
||||||
|
g_Logger.LogError("[SM] Could not find core phrase: %s", fail_phrase);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_Logger.LogError("[SM] Unknown fatal error while translating a core phrase.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Translator::FormatString(char *buffer,
|
||||||
|
size_t maxlength,
|
||||||
|
const char *format,
|
||||||
|
IPhraseCollection *pPhrases,
|
||||||
|
void **params,
|
||||||
|
unsigned int numparams,
|
||||||
|
size_t *pOutLength,
|
||||||
|
const char **pFailPhrase)
|
||||||
|
{
|
||||||
|
unsigned int arg;
|
||||||
|
|
||||||
|
arg = 0;
|
||||||
|
if (!gnprintf(buffer, maxlength, format, pPhrases, params, numparams, arg, pOutLength, pFailPhrase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg != numparams)
|
||||||
|
{
|
||||||
|
if (pFailPhrase != NULL)
|
||||||
|
{
|
||||||
|
*pFailPhrase = NULL;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
+40
-38
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "sm_memtable.h"
|
#include "sm_memtable.h"
|
||||||
#include "ITextParsers.h"
|
#include "ITextParsers.h"
|
||||||
|
#include <ITranslator.h>
|
||||||
|
|
||||||
#define MAX_TRANSLATE_PARAMS 32
|
#define MAX_TRANSLATE_PARAMS 32
|
||||||
#define CORELANG_ENGLISH 0
|
#define CORELANG_ENGLISH 0
|
||||||
@@ -56,29 +57,13 @@ enum PhraseParseState
|
|||||||
|
|
||||||
struct Language
|
struct Language
|
||||||
{
|
{
|
||||||
char m_code2[3];
|
char m_code2[4];
|
||||||
int m_FullName;
|
int m_FullName;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Translation
|
class CPhraseFile :
|
||||||
{
|
public ITextListener_SMC,
|
||||||
const char *szPhrase; /**< Translated phrase. */
|
public IPhraseFile
|
||||||
unsigned int fmt_count; /**< Number of format parameters. */
|
|
||||||
int *fmt_order; /**< Format phrase order. */
|
|
||||||
};
|
|
||||||
|
|
||||||
#define LANGUAGE_ENGLISH 0
|
|
||||||
|
|
||||||
enum TransError
|
|
||||||
{
|
|
||||||
Trans_Okay = 0,
|
|
||||||
Trans_BadLanguage = 1,
|
|
||||||
Trans_BadPhrase = 2,
|
|
||||||
Trans_BadPhraseLanguage = 3,
|
|
||||||
Trans_BadPhraseFile = 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
class CPhraseFile : public ITextListener_SMC
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CPhraseFile(Translator *pTranslator, const char *file);
|
CPhraseFile(Translator *pTranslator, const char *file);
|
||||||
@@ -112,7 +97,8 @@ private:
|
|||||||
|
|
||||||
class Translator :
|
class Translator :
|
||||||
public ITextListener_SMC,
|
public ITextListener_SMC,
|
||||||
public SMGlobalClass
|
public SMGlobalClass,
|
||||||
|
public ITranslator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Translator();
|
Translator();
|
||||||
@@ -125,6 +111,7 @@ public: // SMGlobalClass
|
|||||||
size_t maxlength);
|
size_t maxlength);
|
||||||
void OnSourceModAllInitialized();
|
void OnSourceModAllInitialized();
|
||||||
void OnSourceModLevelChange(const char *mapName);
|
void OnSourceModLevelChange(const char *mapName);
|
||||||
|
void OnSourceModShutdown();
|
||||||
public: // ITextListener_SMC
|
public: // ITextListener_SMC
|
||||||
void ReadSMC_ParseStart();
|
void ReadSMC_ParseStart();
|
||||||
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
|
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
|
||||||
@@ -138,23 +125,30 @@ public:
|
|||||||
bool GetLanguageInfo(unsigned int number, const char **code, const char **name);
|
bool GetLanguageInfo(unsigned int number, const char **code, const char **name);
|
||||||
bool GetLanguageByCode(const char *code, unsigned int *index);
|
bool GetLanguageByCode(const char *code, unsigned int *index);
|
||||||
bool GetLanguageByName(const char *name, unsigned int *index);
|
bool GetLanguageByName(const char *name, unsigned int *index);
|
||||||
size_t Translate(char *buffer, size_t maxlength, void **params, const Translation *pTrans);
|
|
||||||
CPhraseFile *GetFileByIndex(unsigned int index);
|
CPhraseFile *GetFileByIndex(unsigned int index);
|
||||||
TransError CoreTransEx(CPhraseFile *pFile,
|
public: //ITranslator
|
||||||
int client,
|
|
||||||
char *buffer,
|
|
||||||
size_t maxlength,
|
|
||||||
const char *phrase,
|
|
||||||
void **params,
|
|
||||||
size_t *outlen=NULL);
|
|
||||||
TransError CoreTrans(int client,
|
|
||||||
char *buffer,
|
|
||||||
size_t maxlength,
|
|
||||||
const char *phrase,
|
|
||||||
void **params,
|
|
||||||
size_t *outlen=NULL);
|
|
||||||
unsigned int GetServerLanguage();
|
unsigned int GetServerLanguage();
|
||||||
unsigned int GetClientLanguage(int client);
|
unsigned int GetClientLanguage(int client);
|
||||||
|
const char *GetInterfaceName();
|
||||||
|
unsigned int GetInterfaceVersion();
|
||||||
|
IPhraseCollection *CreatePhraseCollection();
|
||||||
|
int SetGlobalTarget(int index);
|
||||||
|
int GetGlobalTarget() const;
|
||||||
|
size_t FormatString(
|
||||||
|
char *buffer,
|
||||||
|
size_t maxlength,
|
||||||
|
SourcePawn::IPluginContext *pContext,
|
||||||
|
const cell_t *params,
|
||||||
|
unsigned int param);
|
||||||
|
bool FormatString(
|
||||||
|
char *buffer,
|
||||||
|
size_t maxlength,
|
||||||
|
const char *format,
|
||||||
|
IPhraseCollection *pPhrases,
|
||||||
|
void **params,
|
||||||
|
unsigned int numparams,
|
||||||
|
size_t *pOutLength,
|
||||||
|
const char **pFailPhrase);
|
||||||
private:
|
private:
|
||||||
bool AddLanguage(const char *langcode, const char *description);
|
bool AddLanguage(const char *langcode, const char *description);
|
||||||
private:
|
private:
|
||||||
@@ -165,10 +159,18 @@ private:
|
|||||||
bool m_InLanguageSection;
|
bool m_InLanguageSection;
|
||||||
String m_CustomError;
|
String m_CustomError;
|
||||||
unsigned int m_ServerLang;
|
unsigned int m_ServerLang;
|
||||||
char m_InitialLang[3];
|
char m_InitialLang[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CPhraseFile *g_pCorePhrases;
|
/* Nice little wrapper to handle error logging and whatnot */
|
||||||
|
bool CoreTranslate(char *buffer,
|
||||||
|
size_t maxlength,
|
||||||
|
const char *format,
|
||||||
|
unsigned int numparams,
|
||||||
|
size_t *pOutLength,
|
||||||
|
...);
|
||||||
|
|
||||||
|
extern IPhraseCollection *g_pCorePhrases;
|
||||||
extern unsigned int g_pCorePhraseID;
|
extern unsigned int g_pCorePhraseID;
|
||||||
extern Translator g_Translator;
|
extern Translator g_Translator;
|
||||||
|
|
||||||
|
|||||||
+72
-13
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -34,7 +34,11 @@
|
|||||||
|
|
||||||
UserMessages g_UserMsgs;
|
UserMessages g_UserMsgs;
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
SH_DECL_HOOK3(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int, const char *);
|
||||||
|
#else
|
||||||
SH_DECL_HOOK2(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int);
|
SH_DECL_HOOK2(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int);
|
||||||
|
#endif
|
||||||
SH_DECL_HOOK0_void(IVEngineServer, MessageEnd, SH_NOATTRIB, 0);
|
SH_DECL_HOOK0_void(IVEngineServer, MessageEnd, SH_NOATTRIB, 0);
|
||||||
|
|
||||||
UserMessages::UserMessages() : m_InterceptBuffer(m_pBase, 2500)
|
UserMessages::UserMessages() : m_InterceptBuffer(m_pBase, 2500)
|
||||||
@@ -164,9 +168,17 @@ bf_write *UserMessages::StartMessage(int msg_id, const cell_t players[], unsigne
|
|||||||
|
|
||||||
if (m_CurFlags & USERMSG_BLOCKHOOKS)
|
if (m_CurFlags & USERMSG_BLOCKHOOKS)
|
||||||
{
|
{
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, g_SMAPI->GetUserMessage(msg_id));
|
||||||
|
#else
|
||||||
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
|
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
buffer = engine->UserMessageBegin(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, g_SMAPI->GetUserMessage(msg_id));
|
||||||
|
#else
|
||||||
buffer = engine->UserMessageBegin(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
|
buffer = engine->UserMessageBegin(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
@@ -193,7 +205,31 @@ bool UserMessages::EndMessage()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UserMessages::HookUserMessage2(int msg_id,
|
||||||
|
IUserMessageListener *pListener,
|
||||||
|
bool intercept)
|
||||||
|
{
|
||||||
|
return InternalHook(msg_id, pListener, intercept, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UserMessages::UnhookUserMessage2(int msg_id,
|
||||||
|
IUserMessageListener *pListener,
|
||||||
|
bool intercept)
|
||||||
|
{
|
||||||
|
return InternalUnhook(msg_id, pListener, intercept, true);
|
||||||
|
}
|
||||||
|
|
||||||
bool UserMessages::HookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
|
bool UserMessages::HookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
|
||||||
|
{
|
||||||
|
return InternalHook(msg_id, pListener, intercept, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UserMessages::UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
|
||||||
|
{
|
||||||
|
return InternalUnhook(msg_id, pListener, intercept, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UserMessages::InternalHook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew)
|
||||||
{
|
{
|
||||||
if (msg_id < 0 || msg_id >= 255)
|
if (msg_id < 0 || msg_id >= 255)
|
||||||
{
|
{
|
||||||
@@ -212,6 +248,7 @@ bool UserMessages::HookUserMessage(int msg_id, IUserMessageListener *pListener,
|
|||||||
pInfo->Callback = pListener;
|
pInfo->Callback = pListener;
|
||||||
pInfo->IsHooked = false;
|
pInfo->IsHooked = false;
|
||||||
pInfo->KillMe = false;
|
pInfo->KillMe = false;
|
||||||
|
pInfo->IsNew = isNew;
|
||||||
|
|
||||||
if (!m_HookCount++)
|
if (!m_HookCount++)
|
||||||
{
|
{
|
||||||
@@ -231,7 +268,7 @@ bool UserMessages::HookUserMessage(int msg_id, IUserMessageListener *pListener,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UserMessages::UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
|
bool UserMessages::InternalUnhook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew)
|
||||||
{
|
{
|
||||||
MsgList *pList;
|
MsgList *pList;
|
||||||
MsgIter iter;
|
MsgIter iter;
|
||||||
@@ -247,7 +284,7 @@ bool UserMessages::UnhookUserMessage(int msg_id, IUserMessageListener *pListener
|
|||||||
for (iter=pList->begin(); iter!=pList->end(); iter++)
|
for (iter=pList->begin(); iter!=pList->end(); iter++)
|
||||||
{
|
{
|
||||||
pInfo = (*iter);
|
pInfo = (*iter);
|
||||||
if (pInfo->Callback == pListener)
|
if (pInfo->Callback == pListener && pInfo->IsNew == isNew)
|
||||||
{
|
{
|
||||||
if (pInfo->IsHooked)
|
if (pInfo->IsHooked)
|
||||||
{
|
{
|
||||||
@@ -279,7 +316,11 @@ void UserMessages::_DecRefCounter()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name)
|
||||||
|
#else
|
||||||
bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type)
|
bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
bool is_intercept_empty = m_msgIntercepts[msg_type].empty();
|
bool is_intercept_empty = m_msgIntercepts[msg_type].empty();
|
||||||
bool is_hook_empty = m_msgHooks[msg_type].empty();
|
bool is_hook_empty = m_msgHooks[msg_type].empty();
|
||||||
@@ -305,7 +346,11 @@ bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_typ
|
|||||||
RETURN_META_VALUE(MRES_IGNORED, NULL);
|
RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name)
|
||||||
|
#else
|
||||||
bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type)
|
bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (!m_InHook)
|
if (!m_InHook)
|
||||||
{
|
{
|
||||||
@@ -319,7 +364,7 @@ bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_ty
|
|||||||
|
|
||||||
void UserMessages::OnMessageEnd_Post()
|
void UserMessages::OnMessageEnd_Post()
|
||||||
{
|
{
|
||||||
if (!m_InHook || m_BlockEndPost)
|
if (!m_InHook)
|
||||||
{
|
{
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
@@ -328,12 +373,22 @@ void UserMessages::OnMessageEnd_Post()
|
|||||||
MsgIter iter;
|
MsgIter iter;
|
||||||
ListenerInfo *pInfo;
|
ListenerInfo *pInfo;
|
||||||
|
|
||||||
|
m_InHook = false;
|
||||||
|
|
||||||
pList = &m_msgIntercepts[m_CurId];
|
pList = &m_msgIntercepts[m_CurId];
|
||||||
for (iter=pList->begin(); iter!=pList->end(); )
|
for (iter=pList->begin(); iter!=pList->end(); )
|
||||||
{
|
{
|
||||||
pInfo = (*iter);
|
pInfo = (*iter);
|
||||||
|
if (m_BlockEndPost && !pInfo->IsNew)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
pInfo->IsHooked = true;
|
pInfo->IsHooked = true;
|
||||||
pInfo->Callback->OnUserMessageSent(m_CurId);
|
pInfo->Callback->OnUserMessageSent(m_CurId);
|
||||||
|
if (pInfo->IsNew)
|
||||||
|
{
|
||||||
|
pInfo->Callback->OnPostUserMessage(m_CurId, !m_BlockEndPost);
|
||||||
|
}
|
||||||
|
|
||||||
if (pInfo->KillMe)
|
if (pInfo->KillMe)
|
||||||
{
|
{
|
||||||
@@ -347,14 +402,20 @@ void UserMessages::OnMessageEnd_Post()
|
|||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_InHook = false;
|
|
||||||
|
|
||||||
pList = &m_msgHooks[m_CurId];
|
pList = &m_msgHooks[m_CurId];
|
||||||
for (iter=pList->begin(); iter!=pList->end(); )
|
for (iter=pList->begin(); iter!=pList->end(); )
|
||||||
{
|
{
|
||||||
pInfo = (*iter);
|
pInfo = (*iter);
|
||||||
|
if (m_BlockEndPost && !pInfo->IsNew)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
pInfo->IsHooked = true;
|
pInfo->IsHooked = true;
|
||||||
pInfo->Callback->OnUserMessageSent(m_CurId);
|
pInfo->Callback->OnUserMessageSent(m_CurId);
|
||||||
|
if (pInfo->IsNew)
|
||||||
|
{
|
||||||
|
pInfo->Callback->OnPostUserMessage(m_CurId, !m_BlockEndPost);
|
||||||
|
}
|
||||||
|
|
||||||
if (pInfo->KillMe)
|
if (pInfo->KillMe)
|
||||||
{
|
{
|
||||||
@@ -435,16 +496,15 @@ void UserMessages::OnMessageEnd_Pre()
|
|||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handled)
|
if (!handled && intercepted)
|
||||||
{
|
|
||||||
goto supercede;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (intercepted)
|
|
||||||
{
|
{
|
||||||
bf_write *engine_bfw;
|
bf_write *engine_bfw;
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId, g_SMAPI->GetUserMessage(m_CurId));
|
||||||
|
#else
|
||||||
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId);
|
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId);
|
||||||
|
#endif
|
||||||
m_ReadBuffer.StartReading(m_InterceptBuffer.GetBasePointer(), m_InterceptBuffer.GetNumBytesWritten());
|
m_ReadBuffer.StartReading(m_InterceptBuffer.GetBasePointer(), m_InterceptBuffer.GetNumBytesWritten());
|
||||||
engine_bfw->WriteBitsFromBuffer(&m_ReadBuffer, m_InterceptBuffer.GetNumBitsWritten());
|
engine_bfw->WriteBitsFromBuffer(&m_ReadBuffer, m_InterceptBuffer.GetNumBitsWritten());
|
||||||
ENGINE_CALL(MessageEnd)();
|
ENGINE_CALL(MessageEnd)();
|
||||||
@@ -471,7 +531,6 @@ void UserMessages::OnMessageEnd_Pre()
|
|||||||
|
|
||||||
RETURN_META((intercepted) ? MRES_SUPERCEDE : MRES_IGNORED);
|
RETURN_META((intercepted) ? MRES_SUPERCEDE : MRES_IGNORED);
|
||||||
supercede:
|
supercede:
|
||||||
m_InHook = false;
|
|
||||||
m_BlockEndPost = true;
|
m_BlockEndPost = true;
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -48,6 +48,7 @@ struct ListenerInfo
|
|||||||
IUserMessageListener *Callback;
|
IUserMessageListener *Callback;
|
||||||
bool IsHooked;
|
bool IsHooked;
|
||||||
bool KillMe;
|
bool KillMe;
|
||||||
|
bool IsNew;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef List<ListenerInfo *> MsgList;
|
typedef List<ListenerInfo *> MsgList;
|
||||||
@@ -71,12 +72,25 @@ public: //IUserMessages
|
|||||||
bool UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept=false);
|
bool UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept=false);
|
||||||
bf_write *StartMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags);
|
bf_write *StartMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags);
|
||||||
bool EndMessage();
|
bool EndMessage();
|
||||||
|
bool HookUserMessage2(int msg_id,
|
||||||
|
IUserMessageListener *pListener,
|
||||||
|
bool intercept=false);
|
||||||
|
bool UnhookUserMessage2(int msg_id,
|
||||||
|
IUserMessageListener *pListener,
|
||||||
|
bool intercept=false);
|
||||||
public:
|
public:
|
||||||
|
#if SOURCE_ENGINE == SE_LEFT4DEAD
|
||||||
|
bf_write *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name);
|
||||||
|
bf_write *OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name);
|
||||||
|
#else
|
||||||
bf_write *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type);
|
bf_write *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type);
|
||||||
bf_write *OnStartMessage_Post(IRecipientFilter *filter, int msg_type);
|
bf_write *OnStartMessage_Post(IRecipientFilter *filter, int msg_type);
|
||||||
|
#endif
|
||||||
void OnMessageEnd_Pre();
|
void OnMessageEnd_Pre();
|
||||||
void OnMessageEnd_Post();
|
void OnMessageEnd_Post();
|
||||||
private:
|
private:
|
||||||
|
bool InternalHook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew);
|
||||||
|
bool InternalUnhook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew);
|
||||||
void _DecRefCounter();
|
void _DecRefCounter();
|
||||||
private:
|
private:
|
||||||
List<ListenerInfo *> m_msgHooks[255];
|
List<ListenerInfo *> m_msgHooks[255];
|
||||||
|
|||||||
+5
-20
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -35,8 +35,9 @@
|
|||||||
#include "concmd_cleaner.h"
|
#include "concmd_cleaner.h"
|
||||||
#include "sm_stringutil.h"
|
#include "sm_stringutil.h"
|
||||||
#include "sourcemm_api.h"
|
#include "sourcemm_api.h"
|
||||||
|
#include "compat_wrappers.h"
|
||||||
|
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
SH_DECL_HOOK1_void(ICvar, UnregisterConCommand, SH_NOATTRIB, 0, ConCommandBase *);
|
SH_DECL_HOOK1_void(ICvar, UnregisterConCommand, SH_NOATTRIB, 0, ConCommandBase *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -56,7 +57,7 @@ ConCommandBase *FindConCommandBase(const char *name);
|
|||||||
class ConCommandCleaner : public SMGlobalClass
|
class ConCommandCleaner : public SMGlobalClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if defined ORANGEBOX_BUILD
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
void OnSourceModAllInitialized()
|
void OnSourceModAllInitialized()
|
||||||
{
|
{
|
||||||
SH_ADD_HOOK_MEMFUNC(ICvar, UnregisterConCommand, icvar, this, &ConCommandCleaner::UnlinkConCommandBase, false);
|
SH_ADD_HOOK_MEMFUNC(ICvar, UnregisterConCommand, icvar, this, &ConCommandCleaner::UnlinkConCommandBase, false);
|
||||||
@@ -95,7 +96,7 @@ public:
|
|||||||
while (iter != tracked_bases.end())
|
while (iter != tracked_bases.end())
|
||||||
{
|
{
|
||||||
/* This is just god-awful! */
|
/* This is just god-awful! */
|
||||||
if (FindConCommandBase((*iter)->name) != (*iter)->pBase)
|
if (FindCommandBase((*iter)->name) != (*iter)->pBase)
|
||||||
{
|
{
|
||||||
pInfo = (*iter);
|
pInfo = (*iter);
|
||||||
iter = tracked_bases.erase(iter);
|
iter = tracked_bases.erase(iter);
|
||||||
@@ -143,22 +144,6 @@ public:
|
|||||||
}
|
}
|
||||||
} s_ConCmdTracker;
|
} s_ConCmdTracker;
|
||||||
|
|
||||||
ConCommandBase *FindConCommandBase(const char *name)
|
|
||||||
{
|
|
||||||
const ConCommandBase *pBase = icvar->GetCommands();
|
|
||||||
|
|
||||||
while (pBase != NULL)
|
|
||||||
{
|
|
||||||
if (strcmp(pBase->GetName(), name) == 0)
|
|
||||||
{
|
|
||||||
return const_cast<ConCommandBase *>(pBase);
|
|
||||||
}
|
|
||||||
pBase = pBase->GetNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me)
|
void TrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me)
|
||||||
{
|
{
|
||||||
s_ConCmdTracker.AddTarget(pBase, me);
|
s_ConCmdTracker.AddTarget(pBase, me);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -38,7 +38,6 @@ public:
|
|||||||
virtual void OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name, bool is_read_safe) = 0;
|
virtual void OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name, bool is_read_safe) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
ConCommandBase *FindConCommandBase(const char *name);
|
|
||||||
void TrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me);
|
void TrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me);
|
||||||
void UntrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me);
|
void UntrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me);
|
||||||
void Global_OnUnlinkConCommandBase(ConCommandBase *pBase);
|
void Global_OnUnlinkConCommandBase(ConCommandBase *pBase);
|
||||||
|
|||||||
@@ -0,0 +1,712 @@
|
|||||||
|
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||||
|
//
|
||||||
|
// Purpose:
|
||||||
|
//
|
||||||
|
// $Workfile: $
|
||||||
|
// $Date: $
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// $NoKeywords: $
|
||||||
|
//===========================================================================//
|
||||||
|
|
||||||
|
#ifndef CONVAR_H
|
||||||
|
#define CONVAR_H
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
|
#pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "tier0/dbg.h"
|
||||||
|
#include "tier1/iconvar.h"
|
||||||
|
#include "tier1/utlvector.h"
|
||||||
|
#include "tier1/utlstring.h"
|
||||||
|
#include "icvar.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define FORCEINLINE_CVAR FORCEINLINE
|
||||||
|
#elif _LINUX
|
||||||
|
#define FORCEINLINE_CVAR inline
|
||||||
|
#else
|
||||||
|
#error "implement me"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Forward declarations
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class ConVar;
|
||||||
|
class CCommand;
|
||||||
|
class ConCommand;
|
||||||
|
class ConCommandBase;
|
||||||
|
struct characterset_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Any executable that wants to use ConVars need to implement one of
|
||||||
|
// these to hook up access to console variables.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class IConCommandBaseAccessor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Flags is a combination of FCVAR flags in cvar.h.
|
||||||
|
// hOut is filled in with a handle to the variable.
|
||||||
|
virtual bool RegisterConCommandBase( ConCommandBase *pVar ) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Helper method for console development
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#if defined( _X360 ) && !defined( _RETAIL )
|
||||||
|
void ConVar_PublishToVXConsole();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Called when a ConCommand needs to execute
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
typedef void ( *FnCommandCallbackV1_t )( void );
|
||||||
|
typedef void ( *FnCommandCallback_t )( const CCommand &command );
|
||||||
|
|
||||||
|
#define COMMAND_COMPLETION_MAXITEMS 64
|
||||||
|
#define COMMAND_COMPLETION_ITEM_LENGTH 64
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Returns 0 to COMMAND_COMPLETION_MAXITEMS worth of completion strings
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
typedef int ( *FnCommandCompletionCallback )( const char *partial, char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ] );
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Interface version
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class ICommandCallback
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void CommandCallback( const CCommand &command ) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ICommandCompletionCallback
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual int CommandCompletionCallback( const char *pPartial, CUtlVector< CUtlString > &commands ) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: The base console invoked command/cvar interface
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class ConCommandBase
|
||||||
|
{
|
||||||
|
friend class CCvar;
|
||||||
|
friend class ConVar;
|
||||||
|
friend class ConCommand;
|
||||||
|
friend void ConVar_Register( int nCVarFlag, IConCommandBaseAccessor *pAccessor );
|
||||||
|
friend void ConVar_PublishToVXConsole();
|
||||||
|
|
||||||
|
// FIXME: Remove when ConVar changes are done
|
||||||
|
friend class CDefaultCvar;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ConCommandBase( void );
|
||||||
|
ConCommandBase( const char *pName, const char *pHelpString = 0,
|
||||||
|
int flags = 0 );
|
||||||
|
|
||||||
|
virtual ~ConCommandBase( void );
|
||||||
|
|
||||||
|
virtual bool IsCommand( void ) const;
|
||||||
|
|
||||||
|
// Check flag
|
||||||
|
virtual bool IsFlagSet( int flag ) const;
|
||||||
|
// Set flag
|
||||||
|
virtual void AddFlags( int flags );
|
||||||
|
// Remove flag
|
||||||
|
virtual void RemoveFlags( int flags );
|
||||||
|
// Get flags
|
||||||
|
virtual int GetFlags( void ) const;
|
||||||
|
|
||||||
|
// Return name of cvar
|
||||||
|
virtual const char *GetName( void ) const;
|
||||||
|
|
||||||
|
// Return help text for cvar
|
||||||
|
virtual const char *GetHelpText( void ) const;
|
||||||
|
|
||||||
|
// Deal with next pointer
|
||||||
|
const ConCommandBase *GetNext( void ) const;
|
||||||
|
ConCommandBase *GetNext( void );
|
||||||
|
|
||||||
|
inline void SetNext(ConCommandBase *pBase)
|
||||||
|
{
|
||||||
|
m_pNext = pBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool IsRegistered( void ) const;
|
||||||
|
|
||||||
|
// Returns the DLL identifier
|
||||||
|
virtual CVarDLLIdentifier_t GetDLLIdentifier() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void Create( const char *pName, const char *pHelpString = 0,
|
||||||
|
int flags = 0 );
|
||||||
|
|
||||||
|
// Used internally by OneTimeInit to initialize/shutdown
|
||||||
|
virtual void Init();
|
||||||
|
void Shutdown();
|
||||||
|
|
||||||
|
// Internal copy routine ( uses new operator from correct module )
|
||||||
|
char *CopyString( const char *from );
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Next ConVar in chain
|
||||||
|
// Prior to register, it points to the next convar in the DLL.
|
||||||
|
// Once registered, though, m_pNext is reset to point to the next
|
||||||
|
// convar in the global list
|
||||||
|
ConCommandBase *m_pNext;
|
||||||
|
|
||||||
|
// Has the cvar been added to the global list?
|
||||||
|
bool m_bRegistered;
|
||||||
|
|
||||||
|
// Static data
|
||||||
|
const char *m_pszName;
|
||||||
|
const char *m_pszHelpString;
|
||||||
|
|
||||||
|
// ConVar flags
|
||||||
|
int m_nFlags;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// ConVars add themselves to this list for the executable.
|
||||||
|
// Then ConVar_Register runs through all the console variables
|
||||||
|
// and registers them into a global list stored in vstdlib.dll
|
||||||
|
static ConCommandBase *s_pConCommandBases;
|
||||||
|
|
||||||
|
// ConVars in this executable use this 'global' to access values.
|
||||||
|
static IConCommandBaseAccessor *s_pAccessor;
|
||||||
|
public:
|
||||||
|
inline void SetFlags(int flags)
|
||||||
|
{
|
||||||
|
m_nFlags = flags;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Command tokenizer
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class CCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CCommand();
|
||||||
|
CCommand( int nArgC, const char **ppArgV );
|
||||||
|
bool Tokenize( const char *pCommand, characterset_t *pBreakSet = NULL );
|
||||||
|
void Reset();
|
||||||
|
|
||||||
|
int ArgC() const;
|
||||||
|
const char **ArgV() const;
|
||||||
|
const char *ArgS() const; // All args that occur after the 0th arg, in string form
|
||||||
|
const char *GetCommandString() const; // The entire command in string form, including the 0th arg
|
||||||
|
const char *operator[]( int nIndex ) const; // Gets at arguments
|
||||||
|
const char *Arg( int nIndex ) const; // Gets at arguments
|
||||||
|
|
||||||
|
// Helper functions to parse arguments to commands.
|
||||||
|
const char* FindArg( const char *pName ) const;
|
||||||
|
int FindArgInt( const char *pName, int nDefaultVal ) const;
|
||||||
|
|
||||||
|
static int MaxCommandLength();
|
||||||
|
static characterset_t* DefaultBreakSet();
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
COMMAND_MAX_ARGC = 64,
|
||||||
|
COMMAND_MAX_LENGTH = 512,
|
||||||
|
};
|
||||||
|
|
||||||
|
int m_nArgc;
|
||||||
|
int m_nArgv0Size;
|
||||||
|
char m_pArgSBuffer[ COMMAND_MAX_LENGTH ];
|
||||||
|
char m_pArgvBuffer[ COMMAND_MAX_LENGTH ];
|
||||||
|
const char* m_ppArgv[ COMMAND_MAX_ARGC ];
|
||||||
|
};
|
||||||
|
|
||||||
|
inline int CCommand::MaxCommandLength()
|
||||||
|
{
|
||||||
|
return COMMAND_MAX_LENGTH - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int CCommand::ArgC() const
|
||||||
|
{
|
||||||
|
return m_nArgc;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char **CCommand::ArgV() const
|
||||||
|
{
|
||||||
|
return m_nArgc ? (const char**)m_ppArgv : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char *CCommand::ArgS() const
|
||||||
|
{
|
||||||
|
return m_nArgv0Size ? &m_pArgSBuffer[m_nArgv0Size] : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char *CCommand::GetCommandString() const
|
||||||
|
{
|
||||||
|
return m_nArgc ? m_pArgSBuffer : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char *CCommand::Arg( int nIndex ) const
|
||||||
|
{
|
||||||
|
// FIXME: Many command handlers appear to not be particularly careful
|
||||||
|
// about checking for valid argc range. For now, we're going to
|
||||||
|
// do the extra check and return an empty string if it's out of range
|
||||||
|
if ( nIndex < 0 || nIndex >= m_nArgc )
|
||||||
|
return "";
|
||||||
|
return m_ppArgv[nIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const char *CCommand::operator[]( int nIndex ) const
|
||||||
|
{
|
||||||
|
return Arg( nIndex );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: The console invoked command
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class ConCommand : public ConCommandBase
|
||||||
|
{
|
||||||
|
friend class CCvar;
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef ConCommandBase BaseClass;
|
||||||
|
|
||||||
|
ConCommand( const char *pName, FnCommandCallbackV1_t callback,
|
||||||
|
const char *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 );
|
||||||
|
ConCommand( const char *pName, FnCommandCallback_t callback,
|
||||||
|
const char *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 );
|
||||||
|
ConCommand( const char *pName, ICommandCallback *pCallback,
|
||||||
|
const char *pHelpString = 0, int flags = 0, ICommandCompletionCallback *pCommandCompletionCallback = 0 );
|
||||||
|
|
||||||
|
virtual ~ConCommand( void );
|
||||||
|
|
||||||
|
virtual bool IsCommand( void ) const;
|
||||||
|
|
||||||
|
virtual int AutoCompleteSuggest( const char *partial, CUtlVector< CUtlString > &commands );
|
||||||
|
|
||||||
|
virtual bool CanAutoComplete( void );
|
||||||
|
|
||||||
|
// Invoke the function
|
||||||
|
virtual void Dispatch( const CCommand &command );
|
||||||
|
|
||||||
|
private:
|
||||||
|
// NOTE: To maintain backward compat, we have to be very careful:
|
||||||
|
// All public virtual methods must appear in the same order always
|
||||||
|
// since engine code will be calling into this code, which *does not match*
|
||||||
|
// in the mod code; it's using slightly different, but compatible versions
|
||||||
|
// of this class. Also: Be very careful about adding new fields to this class.
|
||||||
|
// Those fields will not exist in the version of this class that is instanced
|
||||||
|
// in mod code.
|
||||||
|
|
||||||
|
// Call this function when executing the command
|
||||||
|
union
|
||||||
|
{
|
||||||
|
FnCommandCallbackV1_t m_fnCommandCallbackV1;
|
||||||
|
FnCommandCallback_t m_fnCommandCallback;
|
||||||
|
ICommandCallback *m_pCommandCallback;
|
||||||
|
};
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
FnCommandCompletionCallback m_fnCompletionCallback;
|
||||||
|
ICommandCompletionCallback *m_pCommandCompletionCallback;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool m_bHasCompletionCallback : 1;
|
||||||
|
bool m_bUsingNewCommandCallback : 1;
|
||||||
|
bool m_bUsingCommandCallbackInterface : 1;
|
||||||
|
public:
|
||||||
|
inline FnCommandCallback_t GetCallback() const
|
||||||
|
{
|
||||||
|
return m_fnCommandCallback;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: A console variable
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class ConVar : public ConCommandBase, public IConVar
|
||||||
|
{
|
||||||
|
friend class CCvar;
|
||||||
|
friend class ConVarRef;
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef ConCommandBase BaseClass;
|
||||||
|
|
||||||
|
ConVar( const char *pName, const char *pDefaultValue, int flags = 0);
|
||||||
|
|
||||||
|
ConVar( const char *pName, const char *pDefaultValue, int flags,
|
||||||
|
const char *pHelpString );
|
||||||
|
ConVar( const char *pName, const char *pDefaultValue, int flags,
|
||||||
|
const char *pHelpString, bool bMin, float fMin, bool bMax, float fMax );
|
||||||
|
ConVar( const char *pName, const char *pDefaultValue, int flags,
|
||||||
|
const char *pHelpString, FnChangeCallback_t callback );
|
||||||
|
ConVar( const char *pName, const char *pDefaultValue, int flags,
|
||||||
|
const char *pHelpString, bool bMin, float fMin, bool bMax, float fMax,
|
||||||
|
FnChangeCallback_t callback );
|
||||||
|
|
||||||
|
virtual ~ConVar( void );
|
||||||
|
|
||||||
|
virtual bool IsCommand( void ) const;
|
||||||
|
virtual bool IsFlagSet( int flag ) const;
|
||||||
|
virtual void AddFlags( int flags );
|
||||||
|
virtual int GetFlags( void ) const;
|
||||||
|
virtual const char *GetName( void ) const;
|
||||||
|
virtual const char* GetHelpText( void ) const;
|
||||||
|
virtual bool IsRegistered( void ) const;
|
||||||
|
|
||||||
|
// Install a change callback (there shouldn't already be one....)
|
||||||
|
void InstallChangeCallback( FnChangeCallback_t callback );
|
||||||
|
|
||||||
|
// Retrieve value
|
||||||
|
FORCEINLINE_CVAR float GetFloat( void ) const;
|
||||||
|
FORCEINLINE_CVAR int GetInt( void ) const;
|
||||||
|
FORCEINLINE_CVAR bool GetBool() const { return !!GetInt(); }
|
||||||
|
FORCEINLINE_CVAR char const *GetString( void ) const;
|
||||||
|
|
||||||
|
// Used internally by OneTimeInit to initialize.
|
||||||
|
virtual void Init();
|
||||||
|
|
||||||
|
virtual const char *GetBaseName( void ) const;
|
||||||
|
virtual int GetSplitScreenPlayerSlot ( void ) const;
|
||||||
|
|
||||||
|
// Any function that allocates/frees memory needs to be virtual or else you'll have crashes
|
||||||
|
// from alloc/free across dll/exe boundaries.
|
||||||
|
|
||||||
|
// These just call into the IConCommandBaseAccessor to check flags and set the var (which ends up calling InternalSetValue).
|
||||||
|
virtual void SetValue( const char *value );
|
||||||
|
virtual void SetValue( float value );
|
||||||
|
virtual void SetValue( int value );
|
||||||
|
|
||||||
|
// Reset to default value
|
||||||
|
void Revert( void );
|
||||||
|
|
||||||
|
// True if it has a min/max setting
|
||||||
|
bool GetMin( float& minVal ) const;
|
||||||
|
bool GetMax( float& maxVal ) const;
|
||||||
|
const char *GetDefault( void ) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Called by CCvar when the value of a var is changing.
|
||||||
|
virtual void InternalSetValue(const char *value);
|
||||||
|
// For CVARs marked FCVAR_NEVER_AS_STRING
|
||||||
|
virtual void InternalSetFloatValue( float fNewValue );
|
||||||
|
virtual void InternalSetIntValue( int nValue );
|
||||||
|
|
||||||
|
virtual bool ClampValue( float& value );
|
||||||
|
virtual void ChangeStringValue( const char *tempVal, float flOldValue );
|
||||||
|
|
||||||
|
virtual void Create( const char *pName, const char *pDefaultValue, int flags = 0,
|
||||||
|
const char *pHelpString = 0, bool bMin = false, float fMin = 0.0,
|
||||||
|
bool bMax = false, float fMax = false, FnChangeCallback_t callback = 0 );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// This either points to "this" or it points to the original declaration of a ConVar.
|
||||||
|
// This allows ConVars to exist in separate modules, and they all use the first one to be declared.
|
||||||
|
// m_pParent->m_pParent must equal m_pParent (ie: m_pParent must be the root, or original, ConVar).
|
||||||
|
ConVar *m_pParent;
|
||||||
|
|
||||||
|
// Static data
|
||||||
|
const char *m_pszDefaultValue;
|
||||||
|
|
||||||
|
// Value
|
||||||
|
// Dynamically allocated
|
||||||
|
char *m_pszString;
|
||||||
|
int m_StringLength;
|
||||||
|
|
||||||
|
// Values
|
||||||
|
float m_fValue;
|
||||||
|
int m_nValue;
|
||||||
|
|
||||||
|
// Min/Max values
|
||||||
|
bool m_bHasMin;
|
||||||
|
float m_fMinVal;
|
||||||
|
bool m_bHasMax;
|
||||||
|
float m_fMaxVal;
|
||||||
|
|
||||||
|
// Call this function when ConVar changes
|
||||||
|
FnChangeCallback_t m_fnChangeCallback;
|
||||||
|
public:
|
||||||
|
inline FnChangeCallback_t GetCallback() const
|
||||||
|
{
|
||||||
|
return m_fnChangeCallback;
|
||||||
|
}
|
||||||
|
inline void SetMin(bool set, float min=0.0)
|
||||||
|
{
|
||||||
|
m_bHasMin = set;
|
||||||
|
m_fMinVal = min;
|
||||||
|
}
|
||||||
|
inline void SetMax(bool set, float max=0.0)
|
||||||
|
{
|
||||||
|
m_bHasMax = set;
|
||||||
|
m_fMaxVal = max;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Return ConVar value as a float
|
||||||
|
// Output : float
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FORCEINLINE_CVAR float ConVar::GetFloat( void ) const
|
||||||
|
{
|
||||||
|
return m_pParent->m_fValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Return ConVar value as an int
|
||||||
|
// Output : int
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FORCEINLINE_CVAR int ConVar::GetInt( void ) const
|
||||||
|
{
|
||||||
|
return m_pParent->m_nValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Return ConVar value as a string, return "" for bogus string pointer, etc.
|
||||||
|
// Output : const char *
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FORCEINLINE_CVAR const char *ConVar::GetString( void ) const
|
||||||
|
{
|
||||||
|
if ( m_nFlags & FCVAR_NEVER_AS_STRING )
|
||||||
|
return "FCVAR_NEVER_AS_STRING";
|
||||||
|
|
||||||
|
return ( m_pParent->m_pszString ) ? m_pParent->m_pszString : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Used to read/write convars that already exist (replaces the FindVar method)
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class ConVarRef
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ConVarRef( const char *pName );
|
||||||
|
ConVarRef( const char *pName, bool bIgnoreMissing );
|
||||||
|
ConVarRef( IConVar *pConVar );
|
||||||
|
|
||||||
|
void Init( const char *pName, bool bIgnoreMissing );
|
||||||
|
bool IsValid() const;
|
||||||
|
bool IsFlagSet( int nFlags ) const;
|
||||||
|
IConVar *GetLinkedConVar();
|
||||||
|
|
||||||
|
// Get/Set value
|
||||||
|
float GetFloat( void ) const;
|
||||||
|
int GetInt( void ) const;
|
||||||
|
bool GetBool() const { return !!GetInt(); }
|
||||||
|
const char *GetString( void ) const;
|
||||||
|
|
||||||
|
void SetValue( const char *pValue );
|
||||||
|
void SetValue( float flValue );
|
||||||
|
void SetValue( int nValue );
|
||||||
|
void SetValue( bool bValue );
|
||||||
|
|
||||||
|
const char *GetName() const;
|
||||||
|
|
||||||
|
const char *GetDefault() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// High-speed method to read convar data
|
||||||
|
IConVar *m_pConVar;
|
||||||
|
ConVar *m_pConVarState;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Did we find an existing convar of that name?
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FORCEINLINE_CVAR bool ConVarRef::IsFlagSet( int nFlags ) const
|
||||||
|
{
|
||||||
|
return ( m_pConVar->IsFlagSet( nFlags ) != 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE_CVAR IConVar *ConVarRef::GetLinkedConVar()
|
||||||
|
{
|
||||||
|
return m_pConVar;
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE_CVAR const char *ConVarRef::GetName() const
|
||||||
|
{
|
||||||
|
return m_pConVar->GetName();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Return ConVar value as a float
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FORCEINLINE_CVAR float ConVarRef::GetFloat( void ) const
|
||||||
|
{
|
||||||
|
return m_pConVarState->m_fValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Return ConVar value as an int
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FORCEINLINE_CVAR int ConVarRef::GetInt( void ) const
|
||||||
|
{
|
||||||
|
return m_pConVarState->m_nValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Return ConVar value as a string, return "" for bogus string pointer, etc.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FORCEINLINE_CVAR const char *ConVarRef::GetString( void ) const
|
||||||
|
{
|
||||||
|
Assert( !IsFlagSet( FCVAR_NEVER_AS_STRING ) );
|
||||||
|
return m_pConVarState->m_pszString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FORCEINLINE_CVAR void ConVarRef::SetValue( const char *pValue )
|
||||||
|
{
|
||||||
|
m_pConVar->SetValue( pValue );
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE_CVAR void ConVarRef::SetValue( float flValue )
|
||||||
|
{
|
||||||
|
m_pConVar->SetValue( flValue );
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE_CVAR void ConVarRef::SetValue( int nValue )
|
||||||
|
{
|
||||||
|
m_pConVar->SetValue( nValue );
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE_CVAR void ConVarRef::SetValue( bool bValue )
|
||||||
|
{
|
||||||
|
m_pConVar->SetValue( bValue ? 1 : 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
FORCEINLINE_CVAR const char *ConVarRef::GetDefault() const
|
||||||
|
{
|
||||||
|
return m_pConVarState->m_pszDefaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Called by the framework to register ConCommands with the ICVar
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void ConVar_Register( int nCVarFlag = 0, IConCommandBaseAccessor *pAccessor = NULL );
|
||||||
|
void ConVar_Unregister( );
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Utility methods
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void ConVar_PrintFlags( const ConCommandBase *var );
|
||||||
|
void ConVar_PrintDescription( const ConCommandBase *pVar );
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Utility class to quickly allow ConCommands to call member methods
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning (disable : 4355 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template< class T >
|
||||||
|
class CConCommandMemberAccessor : public ConCommand, public ICommandCallback, public ICommandCompletionCallback
|
||||||
|
{
|
||||||
|
typedef ConCommand BaseClass;
|
||||||
|
typedef void ( T::*FnMemberCommandCallback_t )( const CCommand &command );
|
||||||
|
typedef int ( T::*FnMemberCommandCompletionCallback_t )( const char *pPartial, CUtlVector< CUtlString > &commands );
|
||||||
|
|
||||||
|
public:
|
||||||
|
CConCommandMemberAccessor( T* pOwner, const char *pName, FnMemberCommandCallback_t callback, const char *pHelpString = 0,
|
||||||
|
int flags = 0, FnMemberCommandCompletionCallback_t completionFunc = 0 ) :
|
||||||
|
BaseClass( pName, this, pHelpString, flags, ( completionFunc != 0 ) ? this : NULL )
|
||||||
|
{
|
||||||
|
m_pOwner = pOwner;
|
||||||
|
m_Func = callback;
|
||||||
|
m_CompletionFunc = completionFunc;
|
||||||
|
}
|
||||||
|
|
||||||
|
~CConCommandMemberAccessor()
|
||||||
|
{
|
||||||
|
Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetOwner( T* pOwner )
|
||||||
|
{
|
||||||
|
m_pOwner = pOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void CommandCallback( const CCommand &command )
|
||||||
|
{
|
||||||
|
Assert( m_pOwner && m_Func );
|
||||||
|
(m_pOwner->*m_Func)( command );
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int CommandCompletionCallback( const char *pPartial, CUtlVector< CUtlString > &commands )
|
||||||
|
{
|
||||||
|
Assert( m_pOwner && m_CompletionFunc );
|
||||||
|
return (m_pOwner->*m_CompletionFunc)( pPartial, commands );
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
T* m_pOwner;
|
||||||
|
FnMemberCommandCallback_t m_Func;
|
||||||
|
FnMemberCommandCompletionCallback_t m_CompletionFunc;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning ( default : 4355 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Utility macros to quicky generate a simple console command
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#define CON_COMMAND( name, description ) \
|
||||||
|
static void name( const CCommand &args ); \
|
||||||
|
static ConCommand name##_command( #name, name, description ); \
|
||||||
|
static void name( const CCommand &args )
|
||||||
|
|
||||||
|
#define CON_COMMAND_F( name, description, flags ) \
|
||||||
|
static void name( const CCommand &args ); \
|
||||||
|
static ConCommand name##_command( #name, name, description, flags ); \
|
||||||
|
static void name( const CCommand &args )
|
||||||
|
|
||||||
|
#define CON_COMMAND_F_COMPLETION( name, description, flags, completion ) \
|
||||||
|
static void name( const CCommand &args ); \
|
||||||
|
static ConCommand name##_command( #name, name, description, flags, completion ); \
|
||||||
|
static void name( const CCommand &args )
|
||||||
|
|
||||||
|
#define CON_COMMAND_EXTERN( name, _funcname, description ) \
|
||||||
|
void _funcname( const CCommand &args ); \
|
||||||
|
static ConCommand name##_command( #name, _funcname, description ); \
|
||||||
|
void _funcname( const CCommand &args )
|
||||||
|
|
||||||
|
#define CON_COMMAND_EXTERN_F( name, _funcname, description, flags ) \
|
||||||
|
void _funcname( const CCommand &args ); \
|
||||||
|
static ConCommand name##_command( #name, _funcname, description, flags ); \
|
||||||
|
void _funcname( const CCommand &args )
|
||||||
|
|
||||||
|
#define CON_COMMAND_MEMBER_F( _thisclass, name, _funcname, description, flags ) \
|
||||||
|
void _funcname( const CCommand &args ); \
|
||||||
|
friend class CCommandMemberInitializer_##_funcname; \
|
||||||
|
class CCommandMemberInitializer_##_funcname \
|
||||||
|
{ \
|
||||||
|
public: \
|
||||||
|
CCommandMemberInitializer_##_funcname() : m_ConCommandAccessor( NULL, name, &_thisclass::_funcname, description, flags ) \
|
||||||
|
{ \
|
||||||
|
m_ConCommandAccessor.SetOwner( GET_OUTER( _thisclass, m_##_funcname##_register ) ); \
|
||||||
|
} \
|
||||||
|
private: \
|
||||||
|
CConCommandMemberAccessor< _thisclass > m_ConCommandAccessor; \
|
||||||
|
}; \
|
||||||
|
\
|
||||||
|
CCommandMemberInitializer_##_funcname m_##_funcname##_register; \
|
||||||
|
|
||||||
|
|
||||||
|
#endif // CONVAR_H
|
||||||
+63
-3
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -35,15 +35,75 @@
|
|||||||
#include "MenuStyle_Valve.h"
|
#include "MenuStyle_Valve.h"
|
||||||
#include "MenuStyle_Radio.h"
|
#include "MenuStyle_Radio.h"
|
||||||
#include "PlayerManager.h"
|
#include "PlayerManager.h"
|
||||||
|
#include "CoreConfig.h"
|
||||||
|
#include <sm_queue.h>
|
||||||
|
#include "ThreadSupport.h"
|
||||||
|
|
||||||
float g_LastMenuTime = 0.0f;
|
static IMutex *frame_mutex;
|
||||||
float g_LastAuthCheck = 0.0f;
|
static Queue<FrameAction> *frame_queue;
|
||||||
|
static Queue<FrameAction> *frame_actions;
|
||||||
|
static float g_LastMenuTime = 0.0f;
|
||||||
|
static float g_LastAuthCheck = 0.0f;
|
||||||
|
bool g_PendingInternalPush = false;
|
||||||
|
|
||||||
|
class FrameActionInit : public SMGlobalClass
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void OnSourceModAllInitialized()
|
||||||
|
{
|
||||||
|
frame_queue = new Queue<FrameAction>();
|
||||||
|
frame_actions = new Queue<FrameAction>();
|
||||||
|
frame_mutex = g_pThreader->MakeMutex();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnSourceModShutdown()
|
||||||
|
{
|
||||||
|
delete frame_queue;
|
||||||
|
delete frame_actions;
|
||||||
|
frame_mutex->DestroyThis();
|
||||||
|
}
|
||||||
|
} s_FrameActionInit;
|
||||||
|
|
||||||
|
void AddFrameAction(const FrameAction & action)
|
||||||
|
{
|
||||||
|
frame_mutex->Lock();
|
||||||
|
frame_queue->push(action);
|
||||||
|
frame_mutex->Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
void RunFrameHooks(bool simulating)
|
void RunFrameHooks(bool simulating)
|
||||||
{
|
{
|
||||||
|
/* It's okay if this check races. */
|
||||||
|
if (frame_queue->size())
|
||||||
|
{
|
||||||
|
Queue<FrameAction> *temp;
|
||||||
|
|
||||||
|
/* Very quick lock to move queue/actions back and forth */
|
||||||
|
frame_mutex->Lock();
|
||||||
|
temp = frame_queue;
|
||||||
|
frame_queue = frame_actions;
|
||||||
|
frame_actions = temp;
|
||||||
|
frame_mutex->Unlock();
|
||||||
|
|
||||||
|
/* The server will now be adding to the other queue, so we can process events. */
|
||||||
|
while (!frame_actions->empty())
|
||||||
|
{
|
||||||
|
FrameAction &item = frame_actions->first();
|
||||||
|
frame_actions->pop();
|
||||||
|
item.action(item.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Frame based hooks */
|
/* Frame based hooks */
|
||||||
g_DBMan.RunFrame();
|
g_DBMan.RunFrame();
|
||||||
g_HL2.ProcessFakeCliCmdQueue();
|
g_HL2.ProcessFakeCliCmdQueue();
|
||||||
|
g_HL2.ProcessDelayedKicks();
|
||||||
|
|
||||||
|
if (g_PendingInternalPush)
|
||||||
|
{
|
||||||
|
SM_InternalCmdTrigger();
|
||||||
|
}
|
||||||
|
|
||||||
g_SourceMod.ProcessGameFrameHooks(simulating);
|
g_SourceMod.ProcessGameFrameHooks(simulating);
|
||||||
|
|
||||||
float curtime = *g_pUniversalTime;
|
float curtime = *g_pUniversalTime;
|
||||||
|
|||||||
+17
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -32,6 +32,22 @@
|
|||||||
#ifndef _INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
|
#ifndef _INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
|
||||||
#define _INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
|
#define _INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
|
||||||
|
|
||||||
|
#include <ISourceMod.h>
|
||||||
|
|
||||||
|
using namespace SourceMod;
|
||||||
|
|
||||||
|
struct FrameAction
|
||||||
|
{
|
||||||
|
FrameAction(FRAMEACTION a, void *d) : data(d), action(a)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void *data;
|
||||||
|
FRAMEACTION action;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern bool g_PendingInternalPush;
|
||||||
|
|
||||||
|
void AddFrameAction(const FrameAction & action);
|
||||||
void RunFrameHooks(bool simulating);
|
void RunFrameHooks(bool simulating);
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
|
#endif //_INCLUDE_SOURCEMOD_FRAME_HOOKS_H_
|
||||||
|
|||||||
+151
-291
@@ -39,9 +39,8 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="/MP"
|
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(SOURCEMM14)";"$(SOURCEMM14)\sourcemm";"$(SOURCEMM14)\sourcehook""
|
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE17)\core-legacy";"$(MMSOURCE17)\core-legacy\sourcehook""
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
@@ -58,13 +57,14 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib" dbghelp.lib"
|
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib" dbghelp.lib "Wsock32.lib""
|
||||||
OutputFile="$(OutDir)\sourcemod.1.ep1.dll"
|
OutputFile="$(OutDir)\sourcemod.1.ep1.dll"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
@@ -121,9 +121,8 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="/MP"
|
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(SOURCEMM14)";"$(SOURCEMM14)\sourcemm";"$(SOURCEMM14)\sourcehook""
|
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE17)\core-legacy";"$(MMSOURCE17)\core-legacy\sourcehook""
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
@@ -140,13 +139,14 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib""
|
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||||
OutputFile="$(OutDir)\sourcemod.1.ep1.dll"
|
OutputFile="$(OutDir)\sourcemod.1.ep1.dll"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
@@ -206,7 +206,7 @@
|
|||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="/MP"
|
AdditionalOptions="/MP"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(SOURCEMM14)";"$(SOURCEMM14)\sourcemm";"$(SOURCEMM14)\sourcehook""
|
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE17)\core-legacy";"$(MMSOURCE17)\core-legacy\sourcehook""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableEnhancedInstructionSet="0"
|
||||||
@@ -221,13 +221,14 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib""
|
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||||
OutputFile="$(OutDir)\sourcemod.1.ep1.dll"
|
OutputFile="$(OutDir)\sourcemod.1.ep1.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
||||||
@@ -286,9 +287,8 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="/MP"
|
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public\vstdlib";"$(SOURCEMM16)";"$(SOURCEMM16)\sourcemm";"$(SOURCEMM16)\sourcehook""
|
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;ORANGEBOX_BUILD"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;ORANGEBOX_BUILD"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
@@ -305,13 +305,14 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies=""$(HL2SDKOB)\lib\public\tier0.lib" "$(HL2SDKOB)\lib\public\tier1.lib" "$(HL2SDKOB)\lib\public\vstdlib.lib" "$(HL2SDKOB)\lib\public\mathlib.lib" dbghelp.lib"
|
AdditionalDependencies=""$(HL2SDKOB)\lib\public\tier0.lib" "$(HL2SDKOB)\lib\public\tier1.lib" "$(HL2SDKOB)\lib\public\vstdlib.lib" "$(HL2SDKOB)\lib\public\mathlib.lib" dbghelp.lib "Wsock32.lib""
|
||||||
OutputFile="$(OutDir)\sourcemod.2.ep2.dll"
|
OutputFile="$(OutDir)\sourcemod.2.ep2.dll"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
@@ -368,9 +369,8 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="/MP"
|
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public\vstdlib";"$(SOURCEMM16)";"$(SOURCEMM16)\sourcemm";"$(SOURCEMM16)\sourcehook""
|
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;ORANGEBOX_BUILD"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;ORANGEBOX_BUILD"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
@@ -387,13 +387,14 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies=""$(HL2SDKOB)\lib\public\tier0.lib" "$(HL2SDKOB)\lib\public\tier1.lib" "$(HL2SDKOB)\lib\public\vstdlib.lib" "$(HL2SDKOB)\lib\public\mathlib.lib""
|
AdditionalDependencies=""$(HL2SDKOB)\lib\public\tier0.lib" "$(HL2SDKOB)\lib\public\tier1.lib" "$(HL2SDKOB)\lib\public\vstdlib.lib" "$(HL2SDKOB)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||||
OutputFile="$(OutDir)\sourcemod.2.ep2.dll"
|
OutputFile="$(OutDir)\sourcemod.2.ep2.dll"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
@@ -453,8 +454,8 @@
|
|||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="/MP"
|
AdditionalOptions="/MP"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public\vstdlib";"$(SOURCEMM16)";"$(SOURCEMM16)\sourcemm";"$(SOURCEMM16)\sourcehook""
|
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(HL2SDKOB)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;ORANGEBOX_BUILD;ENABLE_CRAZYDEBUGGING"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;ORANGEBOX_BUILD"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableEnhancedInstructionSet="0"
|
||||||
RuntimeTypeInfo="false"
|
RuntimeTypeInfo="false"
|
||||||
@@ -468,13 +469,14 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies=""$(HL2SDKOB)\lib\public\tier0.lib" "$(HL2SDKOB)\lib\public\tier1.lib" "$(HL2SDKOB)\lib\public\vstdlib.lib" "$(HL2SDKOB)\lib\public\mathlib.lib""
|
AdditionalDependencies=""$(HL2SDKOB)\lib\public\tier0.lib" "$(HL2SDKOB)\lib\public\tier1.lib" "$(HL2SDKOB)\lib\public\vstdlib.lib" "$(HL2SDKOB)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||||
OutputFile="$(OutDir)\sourcemod.2.ep2.dll"
|
OutputFile="$(OutDir)\sourcemod.2.ep2.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
||||||
@@ -533,9 +535,8 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="/MP"
|
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(SOURCEMM16)";"$(SOURCEMM16)\sourcemm";"$(SOURCEMM16)\sourcehook""
|
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
@@ -552,13 +553,14 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib" dbghelp.lib"
|
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib" dbghelp.lib "Wsock32.lib""
|
||||||
OutputFile="$(OutDir)\sourcemod.2.ep1.dll"
|
OutputFile="$(OutDir)\sourcemod.2.ep1.dll"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
@@ -615,9 +617,8 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="/MP"
|
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(SOURCEMM16)";"$(SOURCEMM16)\sourcemm";"$(SOURCEMM16)\sourcehook""
|
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
@@ -634,13 +635,14 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib""
|
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||||
OutputFile="$(OutDir)\sourcemod.2.ep1.dll"
|
OutputFile="$(OutDir)\sourcemod.2.ep1.dll"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
|
||||||
@@ -700,7 +702,7 @@
|
|||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="/MP"
|
AdditionalOptions="/MP"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(SOURCEMM16)";"$(SOURCEMM16)\sourcemm";"$(SOURCEMM16)\sourcehook""
|
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;"$(HL2SDK)\public";"$(HL2SDK)\public\dlls";"$(HL2SDK)\public\engine";"$(HL2SDK)\public\mathlib";"$(HL2SDK)\public\tier0";"$(HL2SDK)\public\tier1";"$(HL2SDK)\public\vstdlib";"$(MMSOURCE17)\core";"$(MMSOURCE17)\core\sourcehook""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableEnhancedInstructionSet="0"
|
||||||
@@ -715,13 +717,14 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="BINARY_NAME=\"$(TargetFileName)\""
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib""
|
AdditionalDependencies=""$(HL2SDK)\lib\public\tier0.lib" "$(HL2SDK)\lib\public\tier1.lib" "$(HL2SDK)\lib\public\vstdlib.lib" "$(HL2SDK)\lib\public\mathlib.lib" "Wsock32.lib""
|
||||||
OutputFile="$(OutDir)\sourcemod.2.ep1.dll"
|
OutputFile="$(OutDir)\sourcemod.2.ep1.dll"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
|
||||||
@@ -861,6 +864,14 @@
|
|||||||
RelativePath="..\EventManager.cpp"
|
RelativePath="..\EventManager.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\ExtensionSys.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\ForwardSys.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\frame_hooks.cpp"
|
RelativePath="..\frame_hooks.cpp"
|
||||||
>
|
>
|
||||||
@@ -869,14 +880,30 @@
|
|||||||
RelativePath="..\GameConfigs.cpp"
|
RelativePath="..\GameConfigs.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\GameDataFetcher.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\HalfLife2.cpp"
|
RelativePath="..\HalfLife2.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\HandleSys.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\LibrarySys.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\Logger.cpp"
|
RelativePath="..\Logger.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\md5.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\MemoryUtils.cpp"
|
RelativePath="..\MemoryUtils.cpp"
|
||||||
>
|
>
|
||||||
@@ -901,14 +928,38 @@
|
|||||||
RelativePath="..\MenuVoting.cpp"
|
RelativePath="..\MenuVoting.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\NativeOwner.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\NextMap.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\PhraseCollection.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\PlayerManager.cpp"
|
RelativePath="..\PlayerManager.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\PluginInfoDatabase.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\PluginSys.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\Profiler.cpp"
|
RelativePath="..\Profiler.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\ShareSys.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\sm_autonatives.cpp"
|
RelativePath="..\sm_autonatives.cpp"
|
||||||
>
|
>
|
||||||
@@ -1023,6 +1074,14 @@
|
|||||||
RelativePath="..\EventManager.h"
|
RelativePath="..\EventManager.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\ExtensionSys.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\ForwardSys.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\frame_hooks.h"
|
RelativePath="..\frame_hooks.h"
|
||||||
>
|
>
|
||||||
@@ -1031,14 +1090,30 @@
|
|||||||
RelativePath="..\GameConfigs.h"
|
RelativePath="..\GameConfigs.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\GameDataFetcher.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\HalfLife2.h"
|
RelativePath="..\HalfLife2.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\HandleSys.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\LibrarySys.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\Logger.h"
|
RelativePath="..\Logger.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\md5.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\MemoryUtils.h"
|
RelativePath="..\MemoryUtils.h"
|
||||||
>
|
>
|
||||||
@@ -1063,14 +1138,38 @@
|
|||||||
RelativePath="..\MenuVoting.h"
|
RelativePath="..\MenuVoting.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\NativeOwner.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\NextMap.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\PhraseCollection.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\PlayerManager.h"
|
RelativePath="..\PlayerManager.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\PluginInfoDatabase.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\PluginSys.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\Profiler.h"
|
RelativePath="..\Profiler.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\ShareSys.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\sm_autonatives.h"
|
RelativePath="..\sm_autonatives.h"
|
||||||
>
|
>
|
||||||
@@ -1232,286 +1331,39 @@
|
|||||||
RelativePath="..\..\public\ITimerSystem.h"
|
RelativePath="..\..\public\ITimerSystem.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\public\ITranslator.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\public\IUserMessages.h"
|
RelativePath="..\..\public\IUserMessages.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
|
||||||
Name="Systems"
|
|
||||||
UniqueIdentifier="{63775418-DF3F-4198-BFB1-738B19EE3EE0}"
|
|
||||||
>
|
|
||||||
<Filter
|
|
||||||
Name="Header Files"
|
|
||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
|
||||||
UniqueIdentifier="{7D3AB33D-C1AD-46ee-B505-FEA8B6EF18E4}"
|
|
||||||
>
|
|
||||||
<File
|
|
||||||
RelativePath="..\systems\ExtensionSys.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\systems\ForwardSys.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\systems\HandleSys.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\systems\LibrarySys.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\systems\PluginInfoDatabase.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\systems\PluginSys.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\systems\ShareSys.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="Source Files"
|
|
||||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
|
||||||
UniqueIdentifier="{D1864A10-FF5F-4672-A70E-57C9F7486F92}"
|
|
||||||
>
|
|
||||||
<File
|
|
||||||
RelativePath="..\systems\ExtensionSys.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\systems\ForwardSys.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\systems\HandleSys.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\systems\LibrarySys.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\systems\PluginInfoDatabase.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\systems\PluginSys.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\systems\ShareSys.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
<Filter
|
||||||
Name="SourcePawn"
|
Name="SourcePawn"
|
||||||
UniqueIdentifier="{C3C3DC6E-E392-4916-B893-7ACB92192DE0}"
|
UniqueIdentifier="{C3C3DC6E-E392-4916-B893-7ACB92192DE0}"
|
||||||
>
|
>
|
||||||
<Filter
|
<File
|
||||||
Name="Header Files"
|
RelativePath="..\..\public\sourcepawn\sp_file_headers.h"
|
||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
|
||||||
UniqueIdentifier="{D06F7D18-C940-4200-990B-2D0CF72F91AB}"
|
|
||||||
>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\vm\sp_vm_basecontext.h"
|
<File
|
||||||
>
|
RelativePath="..\..\public\sourcepawn\sp_typeutil.h"
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\vm\sp_vm_engine.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\vm\sp_vm_function.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="Source Files"
|
|
||||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
|
||||||
UniqueIdentifier="{605A5261-30CD-4cca-BBE2-23BB190DA44E}"
|
|
||||||
>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\vm\sp_vm_basecontext.cpp"
|
<File
|
||||||
>
|
RelativePath="..\..\public\sourcepawn\sp_vm_api.h"
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\vm\sp_vm_engine.cpp"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="CrazyDebug - Old Metamod|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""$(SOURCEMM16)\sourcehook""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug - Old Metamod|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""$(SOURCEMM16)\sourcehook""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release - Old Metamod|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""$(SOURCEMM16)\sourcehook""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="CrazyDebug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""$(SOURCEMM16)\sourcehook""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\vm\sp_vm_function.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="SDK"
|
|
||||||
UniqueIdentifier="{A76160D7-4623-42c7-9587-62049792B924}"
|
|
||||||
>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\..\public\sourcepawn\sp_file_headers.h"
|
<File
|
||||||
>
|
RelativePath="..\..\public\sourcepawn\sp_vm_base.h"
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\public\sourcepawn\sp_typeutil.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\public\sourcepawn\sp_vm_api.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\public\sourcepawn\sp_vm_base.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\public\sourcepawn\sp_vm_types.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="zlib"
|
|
||||||
UniqueIdentifier="{27E223C9-0208-4c7d-BBAA-DE4BF1745020}"
|
|
||||||
>
|
|
||||||
<Filter
|
|
||||||
Name="Header Files"
|
|
||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
|
||||||
UniqueIdentifier="{65A17C3B-0B6E-450f-96B8-661D47876D4B}"
|
|
||||||
>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\zlib\crc32.h"
|
<File
|
||||||
>
|
RelativePath="..\..\public\sourcepawn\sp_vm_types.h"
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\deflate.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\inffast.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\inffixed.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\inflate.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\inftrees.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\trees.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\zconf.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\zlib.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\zutil.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="Source Files"
|
|
||||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
|
||||||
UniqueIdentifier="{9279E65A-C154-4296-AE23-949EB8C62BEB}"
|
|
||||||
>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="..\zlib\adler32.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\compress.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\crc32.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\deflate.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\gzio.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\infback.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\inffast.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\inflate.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\inftrees.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\trees.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\uncompr.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\zlib\zutil.c"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="HL2SDK"
|
Name="HL2SDK"
|
||||||
@@ -1534,6 +1386,10 @@
|
|||||||
RelativePath="..\smn_adt_array.cpp"
|
RelativePath="..\smn_adt_array.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\smn_adt_stack.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\smn_adt_trie.cpp"
|
RelativePath="..\smn_adt_trie.cpp"
|
||||||
>
|
>
|
||||||
@@ -1618,6 +1474,10 @@
|
|||||||
RelativePath="..\smn_menus.cpp"
|
RelativePath="..\smn_menus.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\smn_nextmap.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\smn_player.cpp"
|
RelativePath="..\smn_player.cpp"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
|
# Visual Studio 2008
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sourcemod_mm", "sourcemod_mm.vcproj", "{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|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|Win32 = Debug - Left 4 Dead|Win32
|
||||||
|
Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
|
||||||
|
Debug - Orange Box Valve|Win32 = Debug - Orange Box Valve|Win32
|
||||||
|
Debug - Orange Box|Win32 = Debug - Orange Box|Win32
|
||||||
|
Release - Dark Messiah|Win32 = Release - Dark Messiah|Win32
|
||||||
|
Release - Episode 1|Win32 = Release - Episode 1|Win32
|
||||||
|
Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32
|
||||||
|
Release - Old Metamod|Win32 = Release - Old Metamod|Win32
|
||||||
|
Release - Orange Box Valve|Win32 = Release - Orange Box Valve|Win32
|
||||||
|
Release - Orange Box|Win32 = Release - Orange Box|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
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|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|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|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
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -31,8 +31,13 @@
|
|||||||
|
|
||||||
#include "sm_autonatives.h"
|
#include "sm_autonatives.h"
|
||||||
#include "PluginSys.h"
|
#include "PluginSys.h"
|
||||||
|
#include "NativeOwner.h"
|
||||||
|
|
||||||
|
CNativeOwner g_CoreNatives;
|
||||||
|
|
||||||
|
CNativeOwner *g_pCoreNatives = &g_CoreNatives;
|
||||||
|
|
||||||
void CoreNativesToAdd::OnSourceModAllInitialized()
|
void CoreNativesToAdd::OnSourceModAllInitialized()
|
||||||
{
|
{
|
||||||
g_PluginSys.RegisterNativesFromCore(m_NativeList);
|
g_CoreNatives.AddNatives(m_NativeList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@@ -50,4 +50,8 @@ public:
|
|||||||
sp_nativeinfo_t *m_NativeList;
|
sp_nativeinfo_t *m_NativeList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CNativeOwner;
|
||||||
|
|
||||||
|
extern CNativeOwner *g_pCoreNatives;
|
||||||
|
|
||||||
#endif //_INCLUDE_SOURCEMOD_CORE_AUTONATIVES_H_
|
#endif //_INCLUDE_SOURCEMOD_CORE_AUTONATIVES_H_
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user