Compare commits

..
Author SHA1 Message Date
Nicholas Hastings b635dace11 Update versioning for 1.5.2 release. 2013-10-29 20:21:20 -04:00
Nicholas Hastings d990f956f9 Updated changelog for version 1.5.2. 2013-10-29 20:20:35 -04:00
Nicholas Hastings 955f1e0d3a Updated TF2 enums. 2013-10-29 20:08:18 -04:00
Nicholas Hastings b4cd559186 Fix GetEngineVersion ret values for MM:S 1.9.x on orangebox (bug 5967, r=asherkin). 2013-10-29 19:00:21 -04:00
Nicholas Hastings 46e89891e1 Have SDKTools use IServerTools to get ent facts where available (bug 5968, r=asherkin). 2013-10-29 18:59:36 -04:00
Nicholas Hastings 080e2563c3 Updated TF2 ext Burn call with new parameter. 2013-10-29 18:59:12 -04:00
Nicholas Hastings e1e0c33f2c Updated TF2 gamedata. 2013-10-29 18:59:00 -04:00
Kyle Sanderson 0160d3cc71 Fix regression in SDKTools SetClientListening hook refcounting (bug 5956, r=fyren). 2013-10-24 13:20:42 -04:00
Dr!fter 81f0d82c67 Update CS:GO sdktools gamedata 2013-10-23 22:28:11 -04:00
Scott Ehlert b5276b435a Trigger build. 2013-10-21 03:20:17 -05:00
Nicholas Hastings 16aecfb404 Update CTakeDamageInfo var names from sdk update. 2013-10-06 10:57:38 -04:00
Nicholas Hastings 7054ef56f6 Added missing change from cset e9e163571fde. 2013-10-03 10:48:58 -04:00
Nicholas Hastings bfae78d1ec Updated gamedata for CS:GO Get/SetClientContribution score.
--HG--
extra : rebase_source : fee683e74786f060f670ea6a7c98bd6645c07da5
2013-10-03 10:43:20 -04:00
Nicholas Hastings c82f2b4659 Ported new TF2 critical hit detection logic from sm-central (bug 5894).
--HG--
extra : rebase_source : 687edebc87d34924fdb7c70924a2910389dedd47
2013-10-03 10:44:53 -04:00
Dr!fter 46d71790be Fix Team Score Offset's for linux on CS:GO 2013-09-26 21:00:58 -04:00
Nicholas Hastings 647811f930 Updated HL2DM gamedata. 2013-09-18 21:50:44 -04:00
Kyle Sanderson 7ca80d1c7c Update CS:S gamedata 2013-09-16 21:23:20 -04:00
Nicholas Hastings 8823bab3f3 Fix some format string misuse with map names.
--HG--
extra : rebase_source : 9dc894bfde14718cb96833f6076fae4261f06f5a
2013-09-13 13:47:55 -04:00
Nicholas Hastings b9d5b59bd1 Increase mapname buffer size in nextmap to accomodate longer map names.
--HG--
extra : rebase_source : fef22cc353663630ed54d3f07d4b243b01e84b44
2013-09-13 13:47:55 -04:00
Dr!fter 7fc892d38b Update gamedata for CS:GO update 2013-09-12 21:56:36 -04:00
Asher Baker 09040231a0 Updated plugin blacklist. 2013-09-11 06:18:45 +01:00
Nicholas Hastings 16541a5668 Bumping version. 2013-09-10 16:27:52 -04:00
Nicholas Hastings e1b3b14311 Added tag sourcemod-1.5.1 for changeset 5574bfe07731 2013-09-10 16:27:24 -04:00
Nicholas Hastings 300632db86 Update versioning for 1.5.1 release. 2013-09-10 14:59:41 -04:00
Nicholas Hastings d1776dd641 Updated changelog for version 1.5.1. 2013-09-10 14:58:42 -04:00
Drifter 22cee6a2dd Add CS_UpdateClientModel native to cstrike extension (bug 5905, r=psychonic). 2013-09-10 13:08:14 -04:00
Nicholas Hastings a2194df273 Fix attempted triggers from gagged users displaying in chat (bug 5918, r=asherkin). 2013-09-10 09:52:37 -04:00
Nicholas Hastings 27e20996dd Initialize DamageCustom var in SDKHooks CTakeDamageInfoHack (nobug, r=asherkin). 2013-09-09 18:41:54 -04:00
Kyle Sanderson b5f16142e5 Fix incorrect assignment in SDKHook_TakeDamage + cleanup (bug 5911, r=psychonic). 2013-09-06 18:37:13 -04:00
Peace-Maker 23f1f9e148 Added missing DispatchKeyValues and SDKHooks gamedata for HL2CTF (bug 5114, r=psychonic). 2013-09-05 22:31:44 -04:00
Nicholas Hastings 990f99af5a Reserved slot fixes for OB games when SourceTV or Replay are enabled (bug 5499, r=drifter). 2013-08-30 14:15:02 -04:00
Nicholas Hastings 6ca9d86e8f Make sm_mapvote_runoffpercent cvar work as advertised (bug 5890, r=asherkin). 2013-08-30 14:14:59 -04:00
Nicholas Hastings fae8b4d49a Fix translator system not loading languages with long identifier (bug 5888, r=dvander). 2013-08-28 13:18:55 -04:00
Nicholas Hastings 7f2d9dd8eb Updated TF2 Regenerate signature. 2013-08-27 23:32:56 -04:00
Nicholas Hastings 8ae1b3e1e7 Updated TF2 AddCond signature. 2013-08-27 21:08:37 -04:00
Nicholas Hastings c77c853c02 Updated plugin blacklist. 2013-08-26 10:31:25 -04:00
Nicholas Hastings 2b0daba573 Bumping version. 2013-08-25 19:45:28 -04:00
Nicholas Hastings ba4aa4d37f Added tag sourcemod-1.5.0 for changeset 78a1f1b1c6fa 2013-08-25 19:44:52 -04:00
Nicholas Hastings e3f31af5d3 Update versioning for 1.5.0 release. 2013-08-25 17:38:09 -04:00
Nicholas Hastings bc0bf4e270 Updated changelog for version 1.5.0. 2013-08-25 16:59:14 -04:00
Nicholas Hastings 60c5ad6324 Synced changelog.txt from releases/sourcemod-1.4. 2013-08-25 12:16:54 -04:00
Nicholas Hastings e996a00675 Add missing MarkNativeAsOptional calls for cstrike.inc (r=me). 2013-08-25 11:01:55 -04:00
Kyle Sanderson 0be3f0afed Fix broken translating in some plugins and natives (bug 5612, r=psychonic). 2013-08-25 10:15:35 -04:00
Kyle Sanderson 86bdfa2205 Fixed potential deadlock in HandleSystem::TryAndFreeSomeHandles (bug 5665, r=dvander). 2013-08-25 09:59:53 -04:00
Nicholas Hastings 56c87e927f Fix cmd listener callback return behavior to match func doc (bug 5882, r=asherkin). 2013-08-24 23:56:39 -04:00
Nicholas Hastings be54443918 Replace hardcoded "/ff" check in basetriggers (bug 5863, r=drifter). 2013-08-24 21:59:52 -04:00
Nicholas Hastings 676ea8b29c Don't call SayCommand forwards for chat triggers (bug 5863, r=asherkin). 2013-08-24 21:59:52 -04:00
Nicholas Hastings d77ff38428 Fixed regression causing public triggers to no longer display (bug 5863, r=drifter). 2013-08-24 21:59:52 -04:00
Nicholas Hastings d3256ef339 Removed unused var m_bTriggerWasSilent from core ChatTriggers (bug 5863, r=asherkin). 2013-08-24 21:59:52 -04:00
Nicholas Hastings 3d11742f91 Add missing GetFunctionCount check in ChatTriggers::OnSayCommand_Pre (bug 5864, r=kyles). 2013-08-23 18:48:06 -04:00
Peace-Maker a2aa5d1cda Fixed crash in OnSayCommand_Post with console chat, pass console chat (bug 5864, r=kyles). 2013-08-23 07:31:04 -04:00
Nicholas Hastings 8860e18026 Backed out changeset: 6118b70b1103 (bug 5864). 2013-08-23 07:31:56 -04:00
Nicholas Hastings 7dba540b97 Fixed crash in OnSayCommand_Post with console chat, pass console chat (bug 5864, r=voided);
--HG--
extra : rebase_source : 3090e700ea04a1b2cc6a92c727e3bb58df69500d
2013-08-22 21:45:42 -04:00
Nicholas Hastings 0dd9a5b842 Changed from RemoveEdict to using the Kill input for TF2_RemoveWeapon (r=voided).
--HG--
extra : rebase_source : 1bc5d8aa9aa6be4022b3e1e730ff06de3e428f8e
2013-08-22 21:45:40 -04:00
Nicholas Hastings e6c3565544 Fixed SDKHooks thinking a hook type was supported when gamedata missing (r=voided).
--HG--
extra : rebase_source : 8e89e780c12309a3a772f1edfadc9c4541318b48
2013-08-22 21:45:19 -04:00
Kyle Sanderson 8cacba922a Fix weapon ID checks (bug 5872, r=Dr!fter) 2013-08-21 10:56:04 -04:00
Nicholas Hastings 767396d4ee Fixed GuessSDKVersion return value when using MM:S versions < 1.10 (r=me). 2013-08-16 11:47:35 -04:00
Nicholas Hastings 07a51a0d4e Fixed char * constant conversion warning in cstrike ext. 2013-08-15 18:43:14 -04:00
Drifter 9f042625d0 Fix CS:GO GetWeaponPrice and OnGetWeaponPrice using outdated method (r=psychonic). 2013-08-15 14:40:30 -04:00
Dr!fter fc29f4249a Update some more CS:GO gamedata 2013-08-15 17:04:33 -04:00
Nicholas Hastings 5ca5ecee85 Fixed chat trigger crash regression on ep1 (bug 5394, r=asherkin). 2013-08-15 10:21:04 -04:00
Nicholas Hastings c79d547492 Update BuyCommand detour in CStrike extension with new param on CS:GO. 2013-08-14 17:08:02 -04:00
Nicholas Hastings f079773195 Update GivePlayerItem for new params in CS:GO. 2013-08-14 17:07:27 -04:00
Dr!fter e6ead8b5aa Update some more CS:GO gamedata 2013-08-14 16:40:58 -04:00
Nicholas Hastings 9eba6402eb Updated some CS:GO gamedata. 2013-08-14 14:20:57 -04:00
Nicholas Hastings f95be3b10c Fixed typo in Nuclear Dawn gamedata backcompat fix. 2013-08-14 13:14:59 -04:00
Nicholas Hastings 2220cc961e Added compat shim to load on Nuclear Dawn with MM:S < 1.9.3. (bug 5813, r=me). 2013-08-14 12:55:55 -04:00
Nicholas Hastings cfc6b2fee9 Added gamedata and extension loading compat shims for Nuclear Dawn (bug 5813, r=asherkin). 2013-08-14 11:56:34 -04:00
Nicholas Hastings d188859fc5 Readded another missing hunk from 394499aa9d33 merge. 2013-08-14 12:10:31 -04:00
Kyle Sanderson 96a8003448 Added global pre and post forwards for client chat (bug 5394, r=psychonic). 2013-08-05 11:46:29 -04:00
Nicholas Hastings 696f702204 Fixed a path not using updated mapcycle file detection (bug 5719). 2013-08-05 11:36:59 -04:00
Nicholas Hastings 8b26ce73c2 Triggering build. 2013-08-05 08:36:34 -04:00
GoD-Tony ee5f488aa2 Added ISDKHooks interface with entity listeners (bug 5602, r=psychonic). 2013-08-04 10:03:40 -04:00
Nicholas Hastings 3a5cf80e2b Fixed build. 2013-08-03 20:22:01 -04:00
Nicholas Hastings 3e4f7af96a Readded missing hunk from 394499aa9d33 merge for ep2v extension loading backcompat. 2013-08-03 19:10:23 -04:00
Erik Minekus a1a483fa27 Numerous code documentation fixups (bug 5720, r=psychonic).
--HG--
extra : rebase_source : 864171c29442accaef2a051e37dfd25c2ee1566c
2013-08-01 09:26:34 -04:00
Asher Baker b32f8a4803 Disable SteamAuthstringValidation config option by default (bug 5791, r=psychonic). 2013-08-01 14:33:06 +01:00
Nicholas Hastings 96ee6dbf8a Check all possible mapcycle paths on newer orangebox games (bug 5719, r=asherkin). 2013-07-31 22:57:50 -04:00
Drifter ac07cf95e1 Added CS_IsValidWeaponID native and validity checks to other natives (bug 5566, r=psychonic). 2013-07-31 22:11:15 -04:00
Drifter 8f51e33167 Fixed incorrect return for some weapons in CS_GetWeaponPrice (bug 5562, r=psychonic). 2013-07-31 22:08:23 -04:00
Kyle Sanderson 8366f371ad Fixed crash in SDKHooks when throwing bad ent type error on logical ent (r=psychonic). 2013-07-31 22:03:59 -04:00
Nicholas Hastings 9b44dfea11 Build against MM:S 1.10.
--HG--
extra : rebase_source : 3ae670b671c8bbc964affa77ccf3f2c9191c7f90
2013-07-31 18:42:15 -04:00
Nicholas Hastings 7ede8e0924 Split TF2, DoD:S, HL2:DM, and ND to separate binaries (bug 5813, r=asherkin).
--HG--
extra : rebase_source : 89a3d9703bbb0f5c3225ce8f5da85ce1fabafeaa
2013-07-21 11:53:56 -04:00
Dr!fter 9fe2d9c1cf Update WeaponIDToAlias Sig for CS:GO 2013-07-26 14:42:36 -04:00
Kyle Sanderson 1836ec9d45 Fixed handle misuse in clientprefs plugin (bug 5805, r=psychonic). 2013-07-20 15:17:43 -04:00
Kyle Sanderson 380d7adc09 Make compile.sh set working dir to own dir (bug 5710, r=psychonic). 2013-07-18 19:40:42 -04:00
Kyle Sanderson 4109d0df39 Fixed accidental assignment in each of SDKTools and sp compiler (bug 5745, r=psychonic). 2013-07-18 15:50:50 -04:00
systematicmania 9cab1e3ab7 Fixed clients not being marked as in kick queue in some cases (bug 5746, r=psychonic). 2013-07-18 11:38:04 -04:00
Kyle Sanderson e9d8bfcdfc Throw error instead of crash when calling SetTeamScore between maps (bug 5718, r=psychonic). 2013-07-18 11:38:04 -04:00
Peace-Maker f134602991 Fixed typo in too-many-params native error message (r=psychonic). 2013-07-17 08:09:10 -04:00
Nicholas Hastings b493532ee1 Updated DoD:S gamedata. 2013-07-16 20:45:02 -04:00
Dr!fter 84dec75fb8 Fix SDKHooks gamedata for Half-Life 2 and DOD:S 2013-07-10 20:46:13 -04:00
Dr!fter b1094f87c6 Update TF2 Reload Offset 2013-07-10 20:33:28 -04:00
Dr!fter 284b4bfe20 Update GroundEndChanged for CS:S and CS:GO 2013-07-10 19:56:43 -04:00
Dr!fter b46537ddd5 Update TF2 ForceRespawn offset 2013-07-10 19:14:06 -04:00
Dr!fter c9446c4d7d Update TF2 Gamedata 2013-07-10 18:53:12 -04:00
Nicholas Hastings d4610ab340 Updated L4D2 IServer gamedata for Windows. 2013-07-08 16:13:47 -04:00
Nicholas Hastings 0016b8ef2f Fix tier0/vstdlib lookup in core for recent L4D2 changes. 2013-07-06 12:02:42 -04:00
Nicholas Hastings 72e08f7e44 Define POSIX when compiling for any build on linux/mac. 2013-07-06 12:02:01 -04:00
Nicholas Hastings b06cfa5414 Updated L4D2 gamedata. 2013-07-05 14:30:20 -04:00
Nicholas Hastings a7742cae3d Triggering build for L4D2 sdk update. 2013-07-04 16:45:31 -04:00
Nicholas Hastings 8a78285659 Fixed build. 2013-07-04 11:29:18 -04:00
Ryan Stecker 6847c8eec0 Fixed ReadMapList not seeing maps in all valveFS paths (bug 5715, r=asherkin). 2013-07-03 23:23:05 -04:00
Nicholas Hastings 66790254ac Updated ambuild script for new l4d2 library names. 2013-06-30 10:45:19 -04:00
Ryan Stecker 86b8a0b16a Updated TF2 CalcCriticalMelee Windows byte signature.
--HG--
extra : rebase_source : 7ecde66470b85425c9836fbf61b6d042264a210e
2013-06-13 21:37:05 -04:00
Asher Baker 25fced78e8 File upload support for webternet (r=psychonic). 2013-05-16 14:49:03 +01:00
Dr!fter 22d11160ba Update Remove Disguise sig 2013-05-13 19:07:13 -04:00
Nicholas Hastings 8d65b3e94e Don't omit frame pointer on msvc builds. 2013-05-13 14:19:17 -04:00
Nicholas Hastings 5518544ecd Fixed CS:S CommitSuicide offset. 2013-05-03 15:29:20 -04:00
Nicholas Hastings af3523bd2d Backed out changeset: d1a5f4fe8f61. 2013-05-02 15:31:36 -04:00
Nicholas Hastings 8646cca538 Backed out changeset: 1bdf91c47e13. 2013-05-02 15:31:25 -04:00
Nicholas Hastings c7cea1b40b Backed out changeset: a4fe868541d6. 2013-05-02 15:31:13 -04:00
Nicholas Hastings 58914f71bd Backed out changeset: 3e8245271fd8. 2013-04-30 15:38:50 -04:00
Nicholas Hastings 3841e98c4f Updated TF2 gamedata. 2013-04-29 21:20:11 -04:00
Nicholas Hastings acd025dba2 Merge. 2013-04-16 13:25:22 -04:00
Nicholas Hastings 78c2206628 Updated CS:S gamedata. 2013-04-16 12:19:45 -04:00
Brian Simon 5c47bf8803 Added more alternative names for TFClass_Heavy (bug 5338, r=asherkin). 2013-04-11 03:07:50 +01:00
Kyle Sanderson 8e78ee6f57 Remove debug printout from PerformGravity (bug 5679, r=asherkin). 2013-04-11 03:03:29 +01:00
Asher Baker a2da4cc868 Only split DWARF data out for non-explicit-debug builds (bug 5683, r=dvander). 2013-04-11 00:34:52 +01:00
Asher Baker 00e44ad3c3 Fixed JIT conflicts with SELinux (bug 5581, r=dvander). 2013-04-11 00:33:12 +01:00
Nicholas Hastings 29ba84fc5c Allow localizaton of more base plugin strings (bug 5120, r=asherkin). 2013-04-08 08:00:13 -04:00
Nicholas Hastings 283f1f012d Allow localization of name-reserved kick message (bug 5146, r=asherkin). 2013-04-08 08:00:13 -04:00
Nicholas Hastings fff17f8043 Updated HL2DM gamedata. 2013-04-03 12:26:08 -04:00
Nicholas Hastings 847eaf38f9 Updated DoD:S gamedata. 2013-03-29 15:45:16 -04:00
Drifter 1d59a329eb Update gamedata for CS:GO update 2013-03-21 20:00:29 -04:00
Nicholas Hastings 5689888682 Fixed IsMapValid passing blank string to engine's IsMapValid which crashes some games. 2013-03-21 01:22:08 -04:00
Nicholas Hastings a01768525a Backed out changeset: f38675c67f64 (bug 5484). 2013-03-20 07:08:49 -04:00
Kyle Sanderson e3d2ddf278 Fix a number of issues with cloned handles (bug 5240, r=asherkin). 2013-03-17 22:05:33 +00:00
Kyle Sanderson b3e48b0ad7 Check for cloned handles when dumping (bug 5245, r=asherkin). 2013-03-17 21:58:56 +00:00
Nicholas Hastings 6d528b5c55 Merge. 2013-03-18 20:39:41 -04:00
Peace-Maker 22daf26e3e Fixed possible rte in basetriggers for !ingame clients (bug 5191, r=psychonic). 2013-03-18 20:11:50 -04:00
Michael McKoy 73061969da Fixed mapchooser interaction with CS:GO winlimits (bug 5484, r=psychonic). 2013-03-18 20:10:31 -04:00
Kyle Sanderson 4653530095 Fixed check against uninitialized string in extension loader (bug 5546, r=psychonic). 2013-03-18 20:03:17 -04:00
Peace-Maker ef5faaaa4a Fixed double print when sending psay to self (bug 5649, r=psychonic). 2013-03-18 19:58:18 -04:00
GoD-Tony f52ea98eb4 Added logged error when PlayerRunCommand offset lookup fails (bug 5535, r=psychonic). 2013-03-18 19:53:30 -04:00
Asher Baker d315d4bf53 Backport some clientprefs crash fixes from 1.6. 2013-03-18 18:54:00 +00:00
Kyle Sanderson eaef2a46fb Change extension unload order to avoid exposing finalisation window (bug 5556, r=asherkin). 2013-03-18 18:06:55 +00:00
Nicholas Hastings b0304a89a6 Fixed errors with SendConVarValue on CS:GO (bug 5638, r=asherkin). 2013-03-18 11:47:55 -04:00
Asher Baker a4790f0358 Generate debugging information during compilation (bug 5227, r=ds). 2013-03-17 21:00:28 +00:00
Scott Ehlert d3d5cd8181 Added --no-mysql option to configure script to make MySQL optional (bug 5661, r+a=dvander). 2013-03-17 04:09:44 -05:00
Peace-Maker 64be2bc5a0 Increased map name buffer sizes in mapchooser (bug 5609, r=psychonic). 2013-03-16 23:17:22 -04:00
Kyle Sanderson 30e476c35e Added GetSteamAccountID function to IPlayerHelpers and native for sp (bug 5548, r=asherkin). 2013-03-16 23:12:40 -04:00
Nicholas Hastings 88af208cdd Add DPT_Int64 type to netprop dumps (bug 5655, r=asherkin). 2013-03-16 22:57:57 -04:00
Scott Ehlert b64751c1af Made BreakpadSymbols script compatbile with Python 2.6 and above (bug 5660, r=asherkin). 2013-03-16 22:55:59 -04:00
FlaminSarge 2e158a72e2 Exposed third parameter of TF2's AddCond in TF2_AddCondition (bug 5641, r=psychonic). 2013-03-16 18:05:22 -04:00
Nicholas Hastings c8fb05dd4b Fixed some engine builds failing. 2013-03-16 14:11:56 -04:00
Nicholas Hastings 860af1e6cb Add GetPlayerResourceEntity to SDKTools; deprecate old, broken TF2-specific impl (bug 5491, r=asherkin). 2013-03-16 13:50:36 -04:00
Nicholas Hastings 5c1cadb64e Move UserMessages::m_pBase to only engines without protobuf msgs (r=asherkin). 2013-03-16 13:42:11 -04:00
Nicholas Hastings bfb97a4207 Added repeated field handing to PbSet* natives (bug 5633, r=asherkin). 2013-03-16 13:31:56 -04:00
Nicholas Hastings 7e26691b99 Added repeated field handling to PbRead* natives. Deprecate PbReadRepeated* (bug 5633, r=asherkin). 2013-03-16 13:31:35 -04:00
FlaminSarge ca469a218a Updated TF2 TFCond defines (bug 5642, r=psychonic). 2013-03-16 13:30:00 -04:00
Scott Ehlert 6052ddaa64 Triggering a build. 2013-03-14 00:07:11 -05:00
Scott Ehlert 0ddc675472 Added --sdks option to configure script to specify which SDKs to build againt (bug 5630, r+a=dvander).
Valid arguments are "all", "present", or a comma delimited list of engine names.

The "all" option will try to build against all supported SDKs. (This is the default.)
The "present" option will only attempt to build against SDKs that exist on the system.

Examples:

configure.py --sdks=css,csgo,ep2v
configure.py --sdks=l4d
configure.py -s present
2013-03-13 22:02:40 -05:00
Asher Baker 9412f687cb Fixed issues with COMMAND_FILTER_NO_BOTS and @bots multi-target. (r=fennec) 2013-03-10 03:24:03 +00:00
Asher Baker 0e865c0618 Allow access to unvalidated authstrings (bug 5587, r=psychonic). 2013-03-07 00:58:17 +00:00
Nicholas Hastings 462b5213d7 Fixed SDKHooks GetMaxHealth callback being passed incorrect parameters. 2013-03-02 13:42:07 -05:00
Scott Ehlert f52e84730f Triggering a build. 2013-03-02 11:56:31 -06:00
Asher Baker b8873efa0d Error on access to nested datamap props (bug 5446, r=psychonic). 2012-09-03 20:26:39 +01:00
Scott Ehlert 4132b9bd21 Added L4D and L4D2 gamedata for SDK Hooks on Mac OS X (bug 5628, r=psychonic). 2013-02-25 20:45:11 -06:00
Kyle Sanderson c0caa9f158 Removed call to getchar() in debug build of compiler (bug 5626, r=ds). 2013-02-25 18:02:10 -06:00
Nicholas Hastings 7346b0c081 Added support for "fuzzy" map names in L4D and later (bug 5599, r=asherkin). 2013-02-14 19:28:12 -05:00
Nicholas Hastings 6a361e3045 Updated CS:GO gamedata. 2013-02-13 22:25:15 -05:00
Nicholas Hastings 61d7519ef5 More, hopefully final CS:GO/protobuf usermessage fixups (bug 5588). 2013-02-11 15:11:04 -05:00
Ruben Gonzalez 3e1a78703e Fix CS_WeaponIDToAlias param missing CSWeaponID tag (bug 5460) 2013-02-11 11:17:46 -05:00
Nicholas Hastings bb195a9b2d Added missing smn_protobuf.cpp to core msvc10 project (NPOTB). 2013-02-11 09:39:23 -05:00
Nicholas Hastings 6f095a064c Removed intentional invalid steamid crash in SDK Hooks. 2013-02-11 09:39:23 -05:00
Nicholas Hastings eb334f5fe2 Fixed typo in Fortress Forever gamedat.a 2013-02-11 09:39:23 -05:00
Nicholas Hastings ef825d8a94 Fixed non-CS:GO builds. 2013-02-10 23:11:04 -05:00
Nicholas Hastings 6775898712 Serialize and deserialize usermessages from the server on CS:GO to avoid issues on linux (bug 5588). 2013-02-10 23:06:26 -05:00
Nicholas Hastings d3dd82f190 Updated core msvc10 project file for CS:GO w/ protobuf (NPOTB). 2013-02-10 09:44:33 -05:00
Nicholas Hastings 95409f7ec7 Updated gdc-psyfork symbols.txt with support for ep1 (NPOTB). 2013-02-09 14:21:50 -05:00
Nicholas Hastings 1141a73945 Updated Fortress Forever gamedata. 2013-02-09 14:19:43 -05:00
Peace-Maker 176c003658 Fixed SDKHooks missing version info. 2013-02-09 11:37:51 -05:00
Nicholas Hastings 74aafaa72f Fixed SDKHooks looking for IServerTools on < Orangebox, causing load failure (bug 5603). 2013-02-08 22:46:49 -05:00
Nicholas Hastings 0ac7867b3d Updated SDKHooks msvc10 project files and added to SM solution (NPOTB). 2013-02-08 22:26:51 -05:00
Nicholas Hastings c1b65f52be Minor typo fix in SDKHooks version.rc. 2013-02-08 07:57:16 -05:00
Nicholas Hastings 1d242ee161 Triggering build. 2013-02-08 00:08:51 -05:00
Nicholas Hastings 230e4e3a32 Build fix. 2013-02-08 00:00:09 -05:00
Nicholas Hastings 7ff4724e28 Typo fix in SDKHooks AMBuildScript. 2013-02-07 23:46:48 -05:00
Nicholas Hastings 0015d00243 Initial commit of latest functional SDKHooks extension. 2013-02-07 23:43:33 -05:00
Nicholas Hastings 5ca8967375 Updated CS:GO gamedata. 2013-02-07 13:50:22 -05:00
Nicholas Hastings 4e0c1f97ac Updated more CS:S gamedata. 2013-02-06 17:41:17 -05:00
Nicholas Hastings 191c3dabdb Updated CS:S gamedata. 2013-02-05 17:20:00 -05:00
Peace-Maker cd9a28864a Updated for CS:S sync (r=asherkin). 2013-02-05 21:45:11 +00:00
Nicholas Hastings c2ecb7363c Fixed VARINT & UNSIGNED flags being read from dt instead of member in SendProp arrays (bug 5591, r=prodigysim). 2013-02-04 07:38:30 -05:00
Alexandr e20e272ee1 Fixed basecomm forwards firing with incorrect client parameter value (bug 5583, r=psychonic). 2013-01-28 18:30:44 -05:00
Michael Busby 8dc7f78b0f Fix GameRules_SetPropVector writing data to unexpected addresses instead of to the proxy entity (bug 5592, r=psychonic). 2013-01-27 14:59:14 -08:00
Nicholas Hastings c4331c4795 Fixed pb non-intercept hook callbacks being passed handle with NULL pb msg (bug 5579, bug 5590). 2013-01-27 12:29:16 -05:00
Nicholas Hastings d071ecc17c Removed accidental resetting of pb msg and memory leak in hooked pb messages (bug 5579, bug 5588). 2013-01-26 21:10:25 -05:00
Nicholas Hastings 7c03276b50 Replaced remaining calls to old MM:S usermessages functions when using protobuf system (bug 5579, bug 5588). 2013-01-26 12:14:40 -05:00
Nicholas Hastings ee8b180341 Marked some missed Pb natives as optional (bug 5579). 2013-01-23 18:28:06 -05:00
Nicholas Hastings 5258a1dc85 Updated CS:GO Cstrike extension gamedata. 2013-01-23 14:46:23 -05:00
Nicholas Hastings e74d5593a8 Updated CS:GO HandleCommand_Buy_Internal detour with new bool param. 2013-01-23 14:46:12 -05:00
Nicholas Hastings 18285ca751 Fixed potential for reading out of library bounds in MemoryUtils;:FindPattern (r=asherkin). 2013-01-23 14:05:35 -05:00
Peace-Maker 764a04a201 Fixed Sort_Random not including first value in array sorting functions (bug 4292, r=psychonic). 2013-01-23 12:51:19 -05:00
Nicholas Hastings 1e5a375203 Fixed native error when using PbReadRepeated* natives for index 0 (bug 5579). 2013-01-23 11:14:51 -05:00
Nicholas Hastings 3a2504dc18 Triggering build against new mac libprotobuf. 2013-01-22 23:40:45 -05:00
Nicholas Hastings 7bc4c10660 Triggering build against new mac libprotobuf. 2013-01-22 23:18:27 -05:00
Asher Baker 0fcfead475 Fixed missing libprotobuf linking to core on linux, mac. 2013-01-22 22:47:35 -05:00
Nicholas Hastings ab9c1217e4 Fixed numerous instances of same "cannot pass objects of non-POD type" error in smn_protobuf.cpp. 2013-01-22 22:36:38 -05:00
Nicholas Hastings e9f002e9c5 Fixed typo in core causing CS:GO build break. 2013-01-22 22:23:40 -05:00
Nicholas Hastings a9b6bcf779 CS:GO core build fix for warnings in protobuf headers. 2013-01-22 22:17:24 -05:00
Nicholas Hastings 52e427117c Triggering build against hl2sdk-csgo with merged protobuf. 2013-01-22 22:02:18 -05:00
Nicholas Hastings 312e26a5cf Added initial support for protobuf usermessages on CS:GO (bug 5579, r=asherkin). 2013-01-22 21:43:12 -05:00
Nicholas Hastings f757d5f09b Updated gdc-psyfork with current (NPOTB).
- Added support for custom symbols.txt path (-s <path>).
- Added support for dlsym symbol lookup in linux bins (-n).
- Updated gdc_core.sh example script to account for new options above.
- Updated symbols.txt.
2013-01-07 09:09:14 -05:00
Nicholas Hastings a66adcbc88 Fixed gamedata offsets for CSPromod, GESource, and Synergy. 2013-01-06 09:35:22 -05:00
Nicholas Hastings f4f930e8bd Merge. 2012-12-31 18:17:11 -05:00
Nicholas Hastings 5200940f2f Updated gamedata offsets for CSPromod, GESource, and Synergy. 2012-12-31 18:15:25 -05:00
Asher Baker 63f8262a57 Updated plugin blacklist. 2012-12-28 11:58:31 +00:00
Nicholas Hastings bb9d5e11f1 Backed out changeset: 8048e61b5382. 2012-12-27 16:39:04 -05:00
Nicholas Hastings df76b7285c Backed out changeset: c283854680ad. 2012-12-27 16:38:49 -05:00
Nicholas Hastings e105711678 Backed out changeset: 951598961ea8. 2012-12-27 16:38:34 -05:00
Nicholas Hastings b206858c67 Triggering build. 2012-12-26 18:05:22 -05:00
Nicholas Hastings bc1b803093 Backed out changeset: b65f88522631. 2012-12-26 17:57:03 -05:00
Nicholas Hastings 6e54e0f6e4 Backed out changeset: 9d722aa39e4c. 2012-12-26 17:56:43 -05:00
Nicholas Hastings e0d2287973 Let's try that again... 2012-12-26 13:56:57 -05:00
Nicholas Hastings 7f26803dee Ifdefing out usermessaging on CS:GO to fix builds. 2012-12-26 13:34:32 -05:00
Nicholas Hastings 22cbe23f85 Merge. 2012-12-26 12:28:43 -05:00
Nicholas Hastings 8f0c442024 Fixed TF2_RemoveCondition being called for added conds instead of removed conds. 2012-12-26 12:27:24 -05:00
Nicholas Hastings 02b8e3f7c0 Fixed typo in TF2 ext asm.c causing accidental assignment instead of compare. 2012-12-26 12:19:15 -05:00
Nicholas Hastings 7846ff1666 Updated Makefile for TF2 extension (NPOTB). 2012-12-26 12:19:15 -05:00
Asher Baker 3e1e20dbe2 Fixed PackageScript to not try and include extra extensions. 2012-12-25 21:44:58 +00:00
Nicholas Hastings eaf441c226 Add -Wno-array-bounds for TF2 extension to avoid GCC bugged warning (msvc and Clang fine). 2012-12-23 22:06:52 -05:00
Nicholas Hastings 942b1d2591 Triggering build. 2012-12-23 17:22:19 -05:00
Nicholas Hastings 710456f871 Added new IN_ATTACK3 button define to entity_prop_stocks (bug 5564). 2012-12-23 17:06:14 -05:00
Nicholas Hastings 59df217a09 Updated SQLite to version 3.7.15.1 (bug 5235). 2012-12-23 17:06:11 -05:00
Nicholas Hastings ffd7603b17 Added support in TF2 ext for detection of player conds >= 64 (bug 5565, r=asherkin). 2012-12-23 16:59:50 -05:00
Nicholas Hastings 329616c029 Fixed hang in TF2 extension when player condition 63 is added. 2012-12-21 01:17:30 -05:00
Nicholas Hastings 8723a69a8f Updated more TF2 gamedata. 2012-12-20 18:24:47 -05:00
Nicholas Hastings edddca4857 Updated DOD:S and HL2DM gamedata. 2012-12-20 17:58:43 -05:00
Nicholas Hastings 536123ec59 Updated TF_WEAPON_* and TF_CUSTOM_* defines. 2012-12-19 07:58:21 -05:00
Nicholas Hastings db699ed2c3 Updated TF2_IsPlayerInCondition stock for m_nPlayerCondEx2... 2012-12-19 07:55:03 -05:00
Nicholas Hastings bf9c58b8ed Updated TF2 gamedata. 2012-12-19 07:55:03 -05:00
Nicholas Hastings 8eeec3dc48 Added new param for CTFPlayerShared::AddCond call in TF2 ext. 2012-12-19 07:55:03 -05:00
Nicholas Hastings 4a1dd5f519 Added support for new SPROP_VARINT sendprops. 2012-12-18 17:58:45 -05:00
Nicholas Hastings 5256edf0e5 Ported GetEntProp's unsigned prop support to GameRules_GetProp. 2012-12-18 17:53:45 -05:00
Nicholas Hastings e9385e6eb6 Validate entity in GameRules_GetPropEnt and in CS_DropWeapon safety checks. 2012-12-17 14:34:44 -05:00
Nicholas Hastings 80f7e3092b Fixed regressions in a988c42d4248:
* Fixed crash when prop/data ent is invalid.
* Restored GetEntPropEnt/GetEntDataEnt2 functionality when logical ent support is not available.
2012-12-17 14:33:57 -05:00
Nicholas Hastings ab06cf4788 Validate entity in GetEntPropEnt, GetEntDataEnt2 (r=me). 2012-12-16 19:52:31 -05:00
Powerlord c2300f7b2b Updated TFHoliday enum (bug 5526, r=psychonic). 2012-12-15 14:40:51 -05:00
Nicholas Hastings ba2915ce4e Added natives to CStrike ext to access assists/score in CSGO (bug 5525, r=asherkin). 2012-12-15 14:36:52 -05:00
Ryan Stecker c0b91dd107 Fixed VoteMenuToAll stock adding bots to list (bug 5253, r=asherkin). 2012-12-14 15:18:30 -05:00
Asher Baker 439986e3fe Made thread worker processing limits configurable at runtime (bug 5326, r=psychonic). 2012-12-14 15:16:35 -05:00
Asher Baker e77ad244ad Fixed OnLibraryAdded/Removed not being called in all plugins (bug 5431, r=psychonic). 2012-12-14 15:15:12 -05:00
Kyle Sanderson 2e3c5e367e Added WeaponIDToAlias native to CStrike extension (bug 5460, r=psychonic). 2012-12-14 15:12:22 -05:00
GoD-Tony eb230a45f6 Added PlayerRunCmd gamedata for The Hidden: Source (bug 5534, r=psychonic). 2012-12-14 15:07:47 -05:00
David Anderson 5aacf886e1 Call OnPluginEnd before finalizer hooks have run (bug 4519, r=fyren). 2012-12-14 15:05:18 -05:00
FlaminSarge 0cae86e2ad Added new values to TFCond(ition) enum (bug 5537, r=asherkin). 2012-12-14 15:01:28 -05:00
Nicholas Hastings e7f0a005e2 Updated CSPromod gamedata. 2012-12-10 23:35:57 -05:00
Nicholas Hastings b3c506c69e Updated Reserved Slots to use max humans as max count (bug 5444, r=asherkin). 2012-12-02 15:37:13 -05:00
Nicholas Hastings 99f741fb3b Added GetMaxHumanPlayers native exposing IServerGameClients func (bug 5551, r=asherkin). 2012-12-02 11:03:27 -05:00
Kyle Sanderson 52aa0a5b27 Added a sanity check on handle index in EntityToBCompatRef (bug 5539, r=psychonic). 2012-12-01 13:41:00 -05:00
Nicholas Hastings b7ac61cbea Updated gdc-psyfork with current (NPOTB).
- Added script support for Steam3 content (CS:GO, ND, etc.).
- Removed script steam.inf temp-move hack now that DepotDownloader correctly handles checksums.
- Updated symbols.txt.
- Fixed gdc having issues with gamedata files that contain new or unknown sections ("Addresses").
2012-12-01 13:39:34 -05:00
Nicholas Hastings 2896e7bd4b Added missing and removed non-existant headers in vc10 Core and Logic proj files (NPTOB). 2012-12-01 13:37:08 -05:00
Nicholas Hastings 8a10f4b7a2 Fixed Replay dectection on TF2 and SourceTV detection on ND (bug 5529, r=asherkin). 2012-11-24 09:56:46 -05:00
Drifter 7619d0d7ff AutoExecConfig now logs an error when it cannot create cfg (bug 5465, r=asherkin). 2012-11-24 09:53:44 -05:00
Nicholas Hastings 2175357e72 Updated more L4D2 gamedata. 2012-11-21 08:30:08 -05:00
Nicholas Hastings bd9f126973 Merge 2012-11-20 20:57:36 -05:00
Nicholas Hastings 4260a5b3df Updated L4D2 gamedata. 2012-11-20 20:55:28 -05:00
Asher Baker 247fabaaf0 Added the ability to override RegConsoleCommand-created commands (bug 5199, r=psychonic). 2012-11-15 17:53:11 +00:00
Asher Baker a991d327e6 Improved sendtable dump output (bug 5471, r=psychonic). 2012-11-15 17:50:11 +00:00
Asher Baker c19712dccc Improved console config editing (bug 5470, r=psychonic). 2012-11-15 17:49:13 +00:00
Nicholas Hastings 7d67e851c9 Fixed typo in game.nucleardawn.txt. 2012-11-08 12:56:19 -05:00
Nicholas Hastings 7492ee5d2e Fixed build. 2012-11-03 15:09:10 -04:00
Daniel Varnai 7ea6080689 Fixed SourceTV detection on EP2V, CSS, and CS:GO (bug 5529, r=psychonic). 2012-11-03 14:58:40 -04:00
Nicholas Hastings 272dbf94e0 Updated ZPS gamedata (bug 5536). 2012-11-02 13:39:33 -04:00
Nicholas Hastings d96f7ae4ae Updated Nuclear Dawn gamedata. 2012-10-31 09:58:13 -04:00
Nicholas Hastings 20d4597fa0 Updated tf2 weapon and dmg custom defines. 2012-10-28 19:14:04 -04:00
Nicholas Hastings c5947e2dd7 Triggering build. 2012-10-28 15:56:05 -04:00
Nicholas Hastings 544bd7d4cc Triggering build. 2012-10-27 17:42:43 -04:00
Nicholas Hastings d1c1cb5f7c Makefile updates. 2012-10-27 11:59:27 -04:00
Nicholas Hastings a1165183c2 Updated last piece of gamedata for today's TF2 update. 2012-10-26 22:59:20 -04:00
Nicholas Hastings 07520fb26e Merge. 2012-10-26 22:03:05 -04:00
Nicholas Hastings 46393d63af Updated more ep2v gamedata. 2012-10-26 22:02:46 -04:00
Asher Baker ccc067a1c6 Merge. 2012-10-27 01:09:43 +01:00
Asher Baker 0cd954749c Updated plugin blacklist. 2012-10-27 01:08:25 +01:00
Nicholas Hastings 916f60b59b Updated TF2 extension gamedata. 2012-10-26 20:06:50 -04:00
Nicholas Hastings 115d17de01 Updated core to compile for new ep2v lib names (bug 5524). 2012-10-26 16:28:05 -04:00
Nicholas Hastings 8dfae523a3 Updated ambuilder script for ep2v lib name changes (bug 5524). 2012-10-26 16:27:00 -04:00
Nicholas Hastings 0532135dc3 Updated CS:GO gamedata. 2012-10-26 01:26:45 -04:00
Nicholas Hastings b28c6d6e4a Updated PVKII gamedata. 2012-10-24 13:55:07 -04:00
Nicholas Hastings f703b285bb Updated NMRiH gamedata (bug 5482). 2012-10-14 18:25:59 -04:00
GoD-Tony 749b9dd1bb Added symbol lookup support to gamedata on Windows (bug 5511, r=ds). 2012-10-14 18:10:46 -04:00
Daniel Varnai 42ff151ae4 Added clan tag support for CS:GO in CStrike ext (bug 5429, r=psychonic). 2012-08-13 14:59:31 -04:00
Drifter 5ec6f851c9 Updated CS:GO Cstrike ext gamedata. 2012-10-11 23:16:47 -04:00
Asher Baker 89be7adc80 Updated plugin blacklist. 2012-10-12 02:25:53 +01:00
Drifter 39f9702db4 Updated CS:GO Cstrike ext gamedata. 2012-10-11 20:01:02 -04:00
Nicholas Hastings 021c390091 Merge. 2012-10-02 08:55:04 -04:00
Drifter cec1d4a28b Updated CSGO gamedata for CStrike extension. 2012-10-02 08:54:06 -04:00
Asher Baker 38969dde2f Updated plugin blacklist. 2012-09-22 12:59:14 +01:00
Asher Baker 3061ef9d4c Updated plugin blacklist. 2012-09-21 01:33:43 +01:00
Nicholas Hastings e55b7fa70f Merge. 2012-09-11 18:27:50 -04:00
Drifter 79d04c2d24 Updated CS:S gamedata for CStrike extension. 2012-09-11 18:26:48 -04:00
Nicholas Hastings d11be6fcf4 Updated CS:S SDKTools gamedata. 2012-09-11 18:23:39 -04:00
Asher Baker bed417dc62 Include the auto-version file in the build, so 3rd party plugins compiled aginst the includes get useful versioning info (bug 5453, r=dvander). 2012-09-08 21:02:46 +01:00
Asher Baker 7625ca439e Check the debug stringbase when loading plugins, lest it be null and cause crashes down the line (bug 5478, r=dvander). 2012-09-08 17:31:31 +01:00
Nicholas Hastings 6ff5733d7b Removed old, unsupported msvc8/9 project files for TF2 and CStrike exts (NPOTB). 2012-09-08 12:14:01 -04:00
Nicholas Hastings a3117ef272 Fixed output name in msvc10 files for TF2 and CStrike exts. (NPOTB) (bug 5479). 2012-09-08 12:13:20 -04:00
Nicholas Hastings 2fdbedfe95 Updated TF2 gamedata. 2012-09-06 18:45:13 -04:00
Nicholas Hastings 5567484a8e Updated ep2v gamedata. 2012-09-06 17:41:08 -04:00
Nicholas Hastings d79c5bd1dc Triggering build for hl2sdk-csgo change. 2012-09-04 13:00:12 -04:00
Drifter 34d2db6d78 Added forwards to basecomm plugin (bug 5466, r=asherkin). 2012-09-03 20:45:11 +01:00
Asher Baker eceb9008cd Populated initial plugin blacklist (r=psychonic). 2012-09-03 14:46:05 +01:00
Nicholas Hastings 731245773a Fixed core darkm output name in vcxproj (NPOTB). 2012-09-01 11:10:29 -04:00
Nicholas Hastings d4a80ab3d0 Removed line of last commit that wasn't meant to persist (NPOTB). 2012-09-01 00:11:39 -04:00
Nicholas Hastings ce709298cc Merge. 2012-09-01 00:09:46 -04:00
Nicholas Hastings 6ab7a6678c Fixed sourcemod_mm vcxproj l4d2 build (NPOTB). 2012-09-01 00:09:19 -04:00
Asher Baker f62283b595 Fixed resolution of GetProfilerTime on non-Windows platforms (r=me). 2012-08-29 16:35:08 +01:00
Kyle Sanderson e8058912b8 Fixed crash in EntProp natives (bug 5297, r=psychonic). 2012-08-28 16:20:15 -04:00
Nicholas Hastings 4f800fbd00 Updated SDKCall SetSignature to use same hidden-symbols engine list as core (bug 5440, r=me). 2012-08-27 19:31:38 -04:00
Nicholas Hastings e367d456e1 Updated GMod gamedata (bug 5408). 2012-08-27 18:56:33 -04:00
Nicholas Hastings 3025b9b5e0 Merge. 2012-08-26 23:35:18 -04:00
Kyle Sanderson b0075842d1 Fixed minor memory leaks in cstrike ext (bug 5456, r=psychonic). 2012-08-26 23:33:11 -04:00
Nicholas Hastings 0a10d6022f Added build directory to hgignore (NPOTB). 2012-08-26 23:33:11 -04:00
Anthony Iacono a634da2c0a Fixed OnClientConnect blocking not actually functioning (bug 5461, r=psychonic). 2012-08-26 23:33:04 -04:00
Drifter 94f0fc58cc Fixed TTeamScoreOffset in CS:GO cstrike ext gamedata. 2012-08-26 22:51:14 -04:00
Asher Baker bf76be5dfa Overhauled versioning information (bug 5453, r=dvander). 2012-08-26 01:33:54 +01:00
Scott Ehlert a62aeb36d8 Updated sample extension makefiles for CS:GO on Mac OS X (bug 5459, r=psychonic). 2012-08-25 11:32:33 -05:00
Scott Ehlert 0d795fc651 Added support for CS:GO on Mac OS X (bug 5459, r=psychonic). 2012-08-25 11:28:52 -05:00
Nicholas Hastings 7441af67a8 Really fixed issues for today's TF2 engine update (bug 5450). 2012-08-24 01:36:42 -04:00
Nicholas Hastings 9077686998 Updated gamedata for today's TF2 engine update. 2012-08-24 00:52:44 -04:00
Nicholas Hastings d88f07fd31 Updated SDKTools IServer finding on Windows for Ep2v and CSS (bug 5450, r=me). 2012-08-23 07:47:44 -04:00
Nicholas Hastings 805306bdf0 Triggering build. 2012-08-22 21:50:01 -04:00
Asher Baker da53fdb50c Updated cstrike gamedata. 2012-08-22 23:23:31 +01:00
Asher Baker 549e5a85cb Merge 2012-08-22 18:44:27 +01:00
Asher Baker cd75c56ac4 Updated credits. (r=psychonic) 2012-08-22 18:39:16 +01:00
Powerlord 82883d8187 Updated TFHoliday enum (bug 5436, r=asherkin). 2012-08-21 00:44:44 -04:00
Tony 74f49ec38f Added more parameters to PlayerRunCommand forward (bug 5346, r=asherkin). 2012-08-21 00:42:46 -04:00
Nicholas Hastings cb3411481d Triggering build. 2012-08-21 00:17:48 -04:00
Nicholas Hastings 3aad0dff2e Triggering build. 2012-08-20 23:48:22 -04:00
Nicholas Hastings 0510723ac1 Triggering build. 2012-08-20 23:28:15 -04:00
Nicholas Hastings 294a120f14 Project files changes for CS:S as separate build (bug 5370) (NPOTB). 2012-08-20 21:54:42 -04:00
Nicholas Hastings e6313c89bc Gamedata changes for CS:S as separate build (bug 5370). 2012-08-20 21:54:22 -04:00
Nicholas Hastings 8362b8d226 Split CS:S support off to a separate engine/build (bug 5370, r=asherkin). 2012-08-20 21:53:59 -04:00
Nicholas Hastings 7675472b41 Force build. 2012-08-16 07:40:06 -04:00
Asher Baker c07f84911c Force build. 2012-08-16 02:06:31 +01:00
Asher Baker 6f18a50945 Merge. 2012-08-16 01:42:55 +01:00
Nicholas Hastings d5c9ce9125 Updated HL2DM and DODS gamedata for today's game update. 2012-08-15 23:29:07 +01:00
Nicholas Hastings 3b4ac1c64d Updated tf2 weapon and dmg custom defines, added new round state. 2012-08-15 23:29:05 +01:00
Nicholas Hastings 717b4ce4fa Updated gamedata for latest TF2 update. 2012-08-15 23:29:04 +01:00
Nicholas Hastings 6efc6074cc Updated TF2 ext MakeBleed and Regenerate natives for latest TF2 update. 2012-08-15 23:29:00 +01:00
Nicholas Hastings 76fa100c1d Updated jit vcproj/makefile (NPOTB). 2012-08-15 15:10:55 -04:00
Asher Baker 981171f42a Fixed bugs in IDAPython vtable dump script (NPOTB). 2012-08-15 16:05:16 +01:00
Nicholas Hastings 33ef2ff5c9 Merge. 2012-08-10 21:54:03 -04:00
Nicholas Hastings 380d0b9623 Updated CSGO gamedata. 2012-08-10 21:49:40 -04:00
Asher Baker de27cb8a2f Added system to block malware or illegal plugins (bug 5289, r=dvander). 2012-08-09 01:54:43 +01:00
Asher Baker ac6c162a13 Changed TFWeaponSlot enum description (r=me). 2012-08-07 18:04:10 +01:00
Asher Baker a8021e0d79 Updated IDAPython vtable dump script (NPOTB). 2012-08-07 02:11:07 +01:00
David Anderson b52f696d49 Push build. 2012-08-04 13:53:51 -07:00
David Anderson 983e37a0be Upgrade the Windows python version for debugging. 2012-08-04 13:26:52 -07:00
Zach Kanzler f1e01a3cf6 Increase maximum .sp line length to 4095 characters. (bug 5347, r=dvander) 2012-08-04 13:08:08 -07:00
Nicholas Hastings 858c3f653c Updated sqlite ext vc project file and added to meta SM solution (NPOTB). 2012-08-03 16:12:10 -04:00
Nicholas Hastings 4618588494 Updated SQLite for SQLite extension to version 3.7.13 (bug 5235). 2012-08-03 16:10:28 -04:00
Nicholas Hastings cd3c3fffde Updated defines in tf2_stocks.inc. 2012-08-03 07:56:31 -04:00
Ryan Stecker 148b5ea376 Updated TF2 gamedata. 2012-08-02 20:11:02 -04:00
Nicholas Hastings 6f9c197400 Updated Dino D-Day gamedata (bug 5410). 2012-08-01 22:23:03 -04:00
Asher Baker 67ae85b840 Added some useful IDA scripts (NPOTB). 2012-07-29 02:51:50 +01:00
Nicholas Hastings 0f6e8dd311 Updated ZPS gamedata. 2012-07-26 14:09:34 -04:00
Nicholas Hastings cb86d4d967 Merge. 2012-07-25 08:38:11 -04:00
Nicholas Hastings 80fbc25442 Updated vc projs to use MMSOURCE19, added loader & topmenus, fixed CSGO sdk path in cstrike (NPOTB). 2012-07-25 08:31:01 -04:00
Asher Baker c1f9fb6c3a Fixed plugins being compiled with a version number of 1.4.0-dev (r=psychonic). 2012-07-25 00:17:58 +01:00
Michael Busby a46dcd45d7 Added GetEntityAddress native (bug 5269, r=dvander). 2012-07-22 13:40:37 -04:00
Nicholas Hastings 99ff1179cc Triggering another build for bug 5391. 2012-07-22 12:01:35 -04:00
Nicholas Hastings 4871dbaaa1 Triggering build for bug 5391. 2012-07-21 20:41:52 -04:00
Nicholas Hastings 832dc259af Updated DoD:S and HL2:DM gamedata. 2012-07-20 15:43:15 -04:00
Nicholas Hastings 78f4640736 VC10 proj: removed old bintools cfgs, fixed swarm build, fixed jit dll name (NPOTB). 2012-07-20 15:43:15 -04:00
Nicholas Hastings 0b7831c6df Updated Nuclear Dawn gamedata. 2012-07-19 20:13:47 -04:00
Nicholas Hastings 73a701f08c Added missing files to each core and logic makefiles (NPOTB). 2012-07-15 12:31:06 -04:00
Nicholas Hastings 080405c022 Added some missing proj files from last commit (NPOTB). 2012-07-12 19:43:01 -04:00
Nicholas Hastings 58ae7f1cab Overhauled msvc10 proj files, fixed .rc errors, added combined sln, added SMOUTDIR env var support (NPOTB). 2012-07-12 19:40:06 -04:00
Powerlord 59b1bd3d96 Updated TFHoliday enum for latest TF2 updates (bug 5364, r=psychonic). 2012-07-03 18:03:06 -04:00
Nicholas Hastings 4d4979cc98 Updated gdc-psyfork readme (NPOTB). 2012-07-03 10:33:54 -04:00
Nicholas Hastings 542c515bc1 Updated gdc-psyfork with latest (NPOTB). 2012-07-03 10:27:27 -04:00
Nicholas Hastings 3479e452de Fixed clientprefs prefab menu double free crash (bug 5374, r=asherkin). 2012-07-03 07:51:12 -04:00
Nicholas Hastings 49ad25d001 Updated CS:S gamedata. 2012-07-02 23:27:22 -04:00
Nicholas Hastings 13c8336c82 Added RadioMenuMaxPageItems of 9 to csgo core gamedata (bug 5310, r=me). 2012-07-02 12:53:42 -04:00
Nicholas Hastings 601186fd6a Added support for custom maxitems on radio menus (bug 5371, r=asherkin). 2012-07-02 10:57:22 -04:00
Brian Simon dfadfe37f6 Fixed NULL ninvoke ptr in sample ext when SMEXT_ENABLE_NINVOKE defined (bug 5340, r=psychonic). 2012-07-01 12:05:21 -04:00
Nicholas Hastings b3372ebba2 Updated GMod gamedata. 2012-06-30 09:08:06 -04:00
Nicholas Hastings 01de453d25 Added new TF2 weapon and custom dmg defines. 2012-06-28 11:27:31 -04:00
Nicholas Hastings 64b6c0d0eb Updated EmitSentence native for sdk change on ep2v. 2012-06-28 11:27:14 -04:00
Nicholas Hastings 2f684e0255 Updated TF2, DOD:S, and HL2:DM gamedata. 2012-06-27 23:24:38 -04:00
Nicholas Hastings 3a77fcd005 Updated Core and SDK Tools for ep2v EmitSound sdk change. 2012-06-27 22:42:23 -04:00
Nicholas Hastings 06492d18a7 Triggering a build. 2012-06-27 22:18:38 -04:00
Nicholas Hastings 0297e974d4 Updated TF2 gamedata. 2012-06-27 21:41:04 -04:00
Drifter 354279bc1e Fixed CS:S "TTeamScoreOffset" gamedata offset (bug 5352, r=psychonic). 2012-06-26 19:07:22 -04:00
Drifter e0278071cf Fixed CS_GetWeaponPrice sometimes using incorrect weapon id (bug 5363, r=psychonic). 2012-06-26 19:06:41 -04:00
Nicholas Hastings a9bd1ced2e Updated Nuclear Dawn gamedata. 2012-06-20 21:00:53 -04:00
Nicholas Hastings 8cd397e56f Triggering a build to fix vars in SDKTools OnPlayerRunCmd forward on CSGO. 2012-06-14 08:16:59 -04:00
Nicholas Hastings 7423fd9c98 Merge. 2012-06-13 09:25:21 -04:00
Nicholas Hastings cd75262ad1 Updated sample ext project/make files. (NPOTB). 2012-06-13 09:24:45 -04:00
Asher Baker 70f91f8345 Fixed target client index error in TF2 Disguise native (r=me). 2012-06-13 10:07:02 +01:00
Asher Baker 61a28c290b Updated sdktools msvc10 proj file to use MMSOURCE19. (NPOTB). 2012-06-09 20:02:08 -04:00
Asher Baker 40c2674d49 Worked around possible admin detection issues on newer engines (bug 5327, r=psychonic). 2012-06-09 20:00:55 -04:00
Asher Baker b3d38bd4f1 Lowered default think time to 20ms (bug 4733, r=psychonic). 2012-06-08 20:31:42 -04:00
Asher Baker 7e199b0c7c Fixed CStrike extension shutdown crash (bug 5328, r=psychonic). 2012-06-08 20:29:06 -04:00
Nicholas Hastings 6af30e8992 Fixed linux CS:GO logged tier0_i486 startup error and bad sourcetv handling (r=me). 2012-06-02 12:48:54 -04:00
Nicholas Hastings e7c86713c8 Added missing CS:GO GameRulesProxy gamedata. 2012-06-02 10:07:25 -04:00
Nicholas Hastings 7cd480a1a9 Updated TF2 gamedata. 2012-05-31 22:47:08 -04:00
Nicholas Hastings 3f249c2e93 Fixed compile error on gcc. 2012-05-31 07:43:11 -04:00
Drifter 36f5200abc Fixed crash when passed bad ref in ReferenceToEntity (bug 5330, r=asherkin). 2012-05-31 07:32:07 -04:00
Drifter 89325f9995 Fixed linux CTTeamScoreOffset and TTeamScoreOffset offsets for CS:GO. 2012-05-31 00:36:36 -04:00
Nicholas Hastings 83b3c3ab8f Merge. 2012-05-30 23:01:08 -04:00
Drifter 02277225d7 Fix for SDKTools TeamScore natives crash on CS:GO (bug 5319, r=psychonic). 2012-05-30 23:00:16 -04:00
Nicholas Hastings 6f55c3e75a Updated core msvc10 proj to compile against MMSOURCE19 (NPOTB). 2012-05-30 22:37:41 -04:00
Asher Baker 56131fd63a Removed files accidentally commited in 33b39cd05faf. 2012-05-30 14:20:18 +01:00
Tony f65de3bbbb Added GetGameTickCount native (bug 5209, r=psychonic). 2012-05-30 14:13:43 +01:00
Nicholas Hastings 44d9551bd6 Fixed typo in cstrike.inc causing compile error. 2012-05-29 20:17:57 -04:00
Nicholas Hastings 1aab29a958 Added missing sprites for funcommands on some games (bug 5324, r=asherkin). 2012-05-29 18:39:59 -04:00
Nicholas Hastings 0439d08689 Triggering a build for bug 5312. 2012-05-29 18:08:49 -04:00
Asher Baker 618eb254c0 Fixed intermittent crashes in clientprefs (bug 4660, r=psychonic). 2012-05-29 17:41:48 +01:00
Drifter e2340363e3 Typo fix in cstrike.inc (r=psychonic). 2012-05-28 11:42:58 -04:00
Drifter a68125a5ee Fixed some CS:GO gamedata for CStrike extension. 2012-05-28 11:08:57 -04:00
Ryan Stecker 3d25938dd7 Added TF2_CanPlayerTeleport forward to the TF2 game extension (bug 5283, r=asherkin). 2012-05-28 01:14:46 +01:00
Ryan Stecker 70994cb4b2 Exposed GetLanguageInfo in ITranslator interface (bug 5249, r=asherkin). 2012-05-28 00:58:59 +01:00
Asher Baker 0d5ef132f3 Fixed erroneous const-qualification of name param of GetAdminUsername (bug 5267, r=psychonic). 2012-05-28 00:52:59 +01:00
Drifter 5610aeb917 Added natives for changing team score and mvp stars on CSS/CSGO (bug 5295, r=psychonic). 2012-05-27 19:07:44 -04:00
Drifter 02f8991fb3 Added missing CSWeaponID tag on CS_AliasToWeaponID (r=psychonic). 2012-05-27 18:48:54 -04:00
Drifter f53255570d Added new CSRoundEnd entries for CS:GO (r=psychonic). 2012-05-27 18:48:22 -04:00
Nicholas Hastings 543f3440dc ANOTHER typo fix. 2012-05-27 17:47:41 -04:00
Nicholas Hastings 1a8417951f Fixed package script on mac. 2012-05-27 17:44:46 -04:00
Nicholas Hastings 2f68781ff9 Updated package script for cstrike extension changes. 2012-05-27 17:40:42 -04:00
Nicholas Hastings d29e546678 Fixed cstrike extension not building for ep2v on mac. 2012-05-27 17:40:12 -04:00
Nicholas Hastings a39943d57d Windows build fix. 2012-05-27 17:21:05 -04:00
Nicholas Hastings c20ac116a8 Typo fix. 2012-05-27 17:19:17 -04:00
Nicholas Hastings c8f5ef8afb (Real) Cstrike extension mac build fix. 2012-05-27 17:17:30 -04:00
Nicholas Hastings 1ebef323de Cstrike extension mac build fix. 2012-05-27 17:11:29 -04:00
Drifter 3b18745bcd Added support for CS:GO to cstrike extension (bug 5299, r=asherkin). 2012-05-26 18:31:23 -04:00
Nicholas Hastings 236579a930 Build fix (casing issue with sdk Color.h include). 2012-05-27 16:51:29 -04:00
Nicholas Hastings 9b49b2694d Triggering build. 2012-05-27 16:28:36 -04:00
Nicholas Hastings 62336b60b2 Triggering build. 2012-05-27 16:26:30 -04:00
Nicholas Hastings 917b6d4521 Added support for CS: Global Offensive (bug 5299, r=asherkin). 2012-05-27 16:08:03 -04:00
Nicholas Hastings fdec003973 Added example scripts missing from last commit (NPOTB). 2012-05-27 11:39:50 -04:00
Nicholas Hastings 55b4854cd4 Added "psyfork" of gdc and example scripts to tools/ (NPOTB). 2012-05-27 11:36:49 -04:00
Ryan Stecker 6aca18193a Added missing SteamAuthstringValidation config option (bug 4837, r=asherkin). 2012-05-27 02:11:01 +01:00
Ryan Stecker 745b2f0668 Exposed extensions list to clients (bug 5221, r=asherkin). 2012-05-27 01:51:08 +01:00
Tony 2b207359f9 Adding missing SetMenuNoVoteButton native declaration (bug 4522, r=asherkin). 2012-05-27 01:51:06 +01:00
Asher Baker 6121c098c8 Fixed possible crash when reloading a plugin with an invalid binary (bug 5288, r=psychonic). 2012-05-27 01:51:03 +01:00
Asher Baker c15a91dbcc Fixed intermittent crash when looking for an invalid signature (bug 5301, r=fyren). 2012-05-27 01:51:02 +01:00
Asher Baker f46c58deaa Fixed error when reloading dependant plugins using aliased natives (bug 5302, r=psychonic). 2012-05-27 01:50:57 +01:00
FlaminSarge c9b7e9f9aa Updated TF2 condition defines (bug 5259, r=psychonic). 2012-05-26 19:17:49 -04:00
FlaminSarge 6a8c99eef1 Fixed client console vote output missing newlines (bug 5205, r=psychonic). 2012-05-26 18:25:28 -04:00
FlaminSarge 7025e07e8a Fixed client console vote progress not displaying in some cases (bug 5290, r=psychonic). 2012-05-26 16:25:05 -04:00
Nicholas Hastings 2ba12008c8 Don't add -Wno-delete-non-virtual-dtor for gcc < 4.7. (bug 5205, r=DS). 2012-05-26 15:46:43 -04:00
Ryan Stecker ac2bbf16f6 Require Steam validation before granting admin access (bug 4837, r=asherkin). 2012-05-24 17:55:46 +01:00
Nicholas Hastings d77ebd60cf Log functions now respect sv_logecho (bug 5135, r=asherkin). 2012-05-24 16:09:44 +01:00
Asher Baker 997c7ebbcf Made clientprefs attempt to reconnect to the database on map change (bug 4745, r=dvander). 2012-05-24 16:07:28 +01:00
Asher Baker afe5425163 Updated the location of the blue crab (bug 4959, r=pred). 2012-05-24 16:04:23 +01:00
Asher Baker 32eadc0ea3 Fixed typo in logic bridge (bug 5287, r=psychonic). 2012-05-24 15:59:53 +01:00
Asher Baker e75b244cae Fixed Float negation operator (bug 5292, r=psychonic). 2012-05-24 15:56:19 +01:00
Nicholas Hastings bb448905ac Updated CS:S gamedata for today's update. 2012-05-22 17:32:04 -04:00
Nicholas Hastings 6928ce9cd3 Added msvc10 proj files for cstrike extension (NPOTB). 2012-05-20 12:34:29 -04:00
Nicholas Hastings b7394ad02e Missed a couple of spots on cstrike proj file (¡NPOTB!). 2012-05-18 19:02:05 -04:00
Nicholas Hastings eca39b1a51 Updated sdktools and cstrike ms proj files (NPOTB). 2012-05-18 18:53:46 -04:00
Nicholas Hastings f66e63c690 Updated core msvc10 files (NPOTB). 2012-05-18 18:28:08 -04:00
Paul Clothier 42c2fc61b8 Fixed tier0 error and broken SourceTV detection on L4D1 (bug 5216, r=asherkin). 2012-04-28 13:49:25 -04:00
Nicholas Hastings 24303a5365 Updated Garry's Mod gamedata. 2012-04-28 13:47:35 -04:00
Asher Baker 0ecae8a844 Merge 2012-04-26 17:01:16 +01:00
Asher Baker 9e45f2da9f Fixed client serials not being unique on Windows (bug 5285, r=psychonic). 2012-04-26 16:58:18 +01:00
Asher Baker d676886dee Updated TF2 RemoveDisguise gamedata. 2012-04-18 21:16:01 -04:00
Nicholas Hastings 2d0a0b5a62 Fixed tempents gamedata on GMod. 2012-04-18 07:17:18 -04:00
Ryan Stecker 6fe32b3b49 Updated more TF2 gamedata. 2012-04-18 07:12:19 -04:00
Ryan Stecker 525145f2a3 Updated Windows ep2v tempent gamedata. 2012-04-18 00:16:34 -04:00
Paul Clothier 2b8038d700 Fixed IServer in SDKTools on Windows. 2012-04-17 22:27:03 -04:00
Nicholas Hastings 2454c0baae Always trust Wazz. 2012-04-17 22:12:44 -04:00
Nicholas Hastings 0189c5b990 Fixed tempent gamedata on Windows. Fixed cstrike gamedata. 2012-04-17 22:07:25 -04:00
Nicholas Hastings c70285dcfc Updated more ep2v gamedata. 2012-04-17 21:17:32 -04:00
Paul Clothier f5a392e189 Updated ep2v and TF2 gamedata. 2012-04-17 21:17:09 -04:00
Asher Baker cd729f054c Merge. 2012-04-14 01:14:14 +01:00
Asher Baker 5f551fa67a Backed out changeset: 387b27fb575b (bug 5227) 2012-04-14 01:12:24 +01:00
David Anderson 1e57376cc7 Fix bug in lower-casing API guarantee (r=fyren).
--HG--
extra : rebase_source : aa591e06a6dcf13b8964c893240ab56436a1efd3
2012-04-13 16:50:44 -07:00
Ryan Stecker 4771398e1e Fixed return value of VoteMenuToAll (bug 5254, r=asherkin). 2012-04-14 00:31:50 +01:00
Drifter ee49dfa505 Fixed crash with StoreToAddress if memory wasn't writable (bug 5252, r=asherkin). 2012-04-14 00:31:07 +01:00
Scott Ehlert 20d1551216 Removed hardcoded SDK path for curl on OS X. 2012-03-21 22:04:05 -05:00
Scott Ehlert a3593a5124 Fixed build scripts for OS X 10.7 build slave. 2012-03-21 21:35:07 -05:00
Reuben Morais c7646976fb Removed hardcoded SDK path on OS X (bug 5032, r=ds). 2012-03-21 21:27:26 -05:00
Reuben Morais 8a10cc982c Followup, re-added check for invalid HL2SDK paths (bug 5023, r=ds). 2012-03-21 21:25:34 -05:00
Michael Busby 74e546e145 Fixed StoreToAddress always writing 32 bits and throwing an error. 2012-03-11 18:07:24 -05:00
Nicholas Hastings 5586f7c517 Added some missing compiler flags from AMBuild script to core Makefile. (NPOTB) 2012-03-04 15:16:17 -05:00
Asher Baker fbeeaa4c1e Merge. 2012-03-04 20:03:52 +00:00
Asher Baker 48738bbae9 Partially added minimal-rebuild support for debug info generation. (bug 5227, r=a-very-sad-buildbot) 2012-03-04 20:01:40 +00:00
FlaminSarge 7f74948e91 Fixed potential player lag issue when "drugged" (bug 5217, r=asherkin). 2012-03-04 14:16:58 -05:00
FlaminSarge a31bb79b78 Fixed sm_drug disable functionality not functioning (bug 5218, r=psychonic). 2012-03-04 14:13:38 -05:00
Nicholas Hastings 821fcd5be4 Last fix. 2012-02-25 17:06:23 -05:00
Nicholas Hastings 0c75229250 More mac/linux compile fixes. 2012-02-25 16:41:00 -05:00
Nicholas Hastings 5f67a600fc Linux/Mac build fix. 2012-02-25 15:23:39 -05:00
Nicholas Hastings 4669c320f6 Added better cross-engine support for finding Valve commandline (bug 5216, r=asherkin). 2012-02-25 15:09:56 -05:00
Asher Baker 545868da38 Forcing build. 2012-02-17 12:04:20 +00:00
Asher Baker e154f3edb7 Generate and upload breakpad symbols if BREAKPAD_SYMBOL_SERVER variable is set. (bug 5229, r=dvander) 2012-02-17 03:28:02 +00:00
Asher Baker 393c54fdc2 Generate debugging information during compilation. (bug 5227, r=ds) 2012-02-16 19:26:49 +00:00
Nicholas Hastings 02981cec57 Added new TFHoliday_Christmas to TFHoliday enum (bug 5194, r=asherkin). 2011-12-16 09:43:05 -05:00
Nicholas Hastings 6e499c8213 Added new TF2 weapon defines (r=me). 2011-12-16 00:24:03 -05:00
Nicholas Hastings 9ca1ced6a2 Updated linux CS:S ClanTagOffset gamedata. 2011-12-08 14:52:20 -05:00
Nicholas Hastings 6470222a06 Added gamedata support for No More Room in Hell (bug 5162). 2011-12-07 20:17:34 -05:00
Brian Simon eedf8b845c Increased ServerCommandEx's internal buffer (bug 5169, r=asherkin). 2011-12-07 12:13:52 -05:00
Nicholas Hastings 01c94596a4 Added gamedata support for Adreneline Gamer 2 (bug 5186). 2011-12-07 11:54:53 -05:00
Nicholas Hastings 978d7c0fca Fixed typo in basebans ban reason (bug 5188, r=me). 2011-12-06 14:42:30 -05:00
Nicholas Hastings 3bd53b4f61 Updated gamedata for Garry's Mod. 2011-12-02 10:04:28 -05:00
Nicholas Hastings 8d9c325000 Updated gamedata for HL2MP and DOD:S. 2011-11-29 18:09:51 -05:00
Fyren dfe8ae4fd1 Bring compiler Makefile more in line with ambuild (NPOTB) 2011-11-10 20:26:21 +00:00
Nicholas Hastings 069d67b24b Third try's a charm. 2011-11-09 21:34:30 -05:00
Nicholas Hastings 0c926b84bc Another build fix. 2011-11-09 21:29:36 -05:00
Nicholas Hastings 11bdd68d73 Maybe fixed build. 2011-11-09 21:19:04 -05:00
Nicholas Hastings 1beeaf3d4f Removed GLIBC_2.7 dependency from spcomp (r=fyren). 2011-11-09 21:10:29 -05:00
Nicholas Hastings 8cc850de97 Fixed CS:S gamedata. 2011-11-07 18:23:56 -05:00
Nicholas Hastings 0931794f10 Updated gamedata for today's CS:S update. If wrong, blame gdc! 2011-11-07 18:01:49 -05:00
Matt Woodrow 3b12883a1b Added support for runoff voting in mapchooser (bug 4218, r=dvander). 2011-11-05 20:36:20 -04:00
Nicholas Hastings e18faf085f Merge. 2011-11-04 10:02:32 -04:00
Nicholas Hastings a98edd42d1 Updated TF2_OnIsHolidayActive ret behavior to match doc (bug 5155, r=fyren). 2011-11-04 10:01:33 -04:00
Nicholas Hastings c1aa49ef3a Fixed a few minor spacing things in sp incs to not fool API parser. 2011-11-04 10:01:33 -04:00
Nicholas Hastings 49a860bc9e Fixed sp MaxClients not being updated on map changes after load (5160, r=fyren). 2011-11-04 10:01:28 -04:00
Scott Ehlert 1b94a30c9f Triggering build to hopefully fix mac builds. 2011-11-03 14:16:05 -05:00
Nicholas Hastings 5a52fc3657 Fixed TFHoliday enum (bug 5155, r=asherkin). 2011-11-03 10:03:01 -04:00
Nicholas Hastings df7680aa73 Fixed ff trigger printing in triggerer's language to all (bug 5161, r=asherkin). 2011-11-03 09:59:14 -04:00
Nicholas Hastings f42a16643c Added new TF2 deathflag and dmg custom defines (bug 5157, r=asherkin). 2011-11-03 09:06:59 -04:00
Nicholas Hastings 96e5dc3fc6 Registered basecomm as lib to allow requiring it (bug 5156, r=asherkin). 2011-11-03 09:06:22 -04:00
otstrel 6c0eca0eca Fixed "not connected" error in reserved slots plugin (bug 5158, r=psychonic). 2011-11-03 09:05:40 -04:00
Nicholas Hastings fefff70645 Preemptive gamedata update for tonight's TF2 update. 2011-11-02 18:24:12 -04:00
Nicholas Hastings 18fa18f612 Updated Dino D-Day gamedata for today's update. 2011-10-28 20:27:44 -04:00
Nicholas Hastings b2311e2ea5 Added missing EYE def to halflife.inc, updated EYE def# (bug 5151, r=asherkn). 2011-10-28 19:09:40 -04:00
Nicholas Hastings ee42f09b8d TF2 ext fixes for TF2 holiday system changes (bug 5150, r=asherkin). 2011-10-28 19:07:40 -04:00
Nicholas Hastings e7f5f4a6af Merge. 2011-10-28 11:24:08 -04:00
Nicholas Hastings 4d07acd384 Backed out changeset: 294fded6a0d0 (bug 4902, bug 5068). 2011-10-28 11:23:02 -04:00
David Anderson 2c06bb46ea Pushing build. 2011-10-27 23:18:43 -07:00
David Anderson 3c3bfff0cf Pushing build. 2011-10-27 23:15:55 -07:00
David Anderson a86f6d0e64 Bump major version! 2011-10-27 22:10:46 -07:00
Nicholas Hastings 4d54bfa6b4 Preemptive gamedata update for tonight's TF2 update. 2011-10-27 20:28:26 -04:00
Nicholas Hastings 28d1dab18a Small fixes to reservedslots, including ep2v Replay/SourceTV fix (bug 5094, r=fyren). 2011-10-20 21:42:18 -04:00
Nicholas Hastings f3d19a860a Added detection of Replay and SourceTV, and natives to query (bug 5124, r=fyren). 2011-10-20 21:39:57 -04:00
Nicholas Hastings 5732e34f50 Added check for element in Get/SetEntProp funcs >= 0 (bug 5141, r=fyren). 2011-10-20 21:35:50 -04:00
Asher Baker ca94a61acf Fixed ServerCommandEx native appending to buffer instead of overwriting (bug 5047, r=fyren). 2011-10-17 11:02:42 -04:00
Brian Simon a875c61b5f Added RootConsoleMenu iface support to sample ext (bug 5021, r=psychonic). 2011-10-17 10:55:44 -04:00
David Anderson 5ec70c9e0d Fixed shutdown bug in SDKTools (created EntOutputMgr shutdown func) (bug 5063, r=fyren). 2011-10-17 10:47:13 -04:00
GoD-Tony 4b0373408d Moved client language detection to be earlier (on connect) (bug 3714, r=psychonic). 2011-10-15 12:07:55 -04:00
Nicholas Hastings 7f8c4eff39 Updated GMod gamedata. 2011-10-14 15:21:12 -04:00
Don 00f152910b Added native to clientprefs to alter data on a disconnected player (bug 3882, r=pred). 2011-10-14 11:28:53 -04:00
Nicholas Hastings 95fdeb03c3 Move marking of mapstarted to before calling of map start notifs. (bug 5119, r=asherkin). 2011-10-14 09:25:42 -04:00
Nicholas Hastings 66e9ef9cf6 Updated HL2DM and DOD:S gamedata. 2011-10-13 20:06:40 -04:00
Peace-Maker 6b3221f1da Updated CS:S gamedata. 2011-10-13 19:15:02 -04:00
GoD-Tony 25ad7bcf5e Updated TF2 gamedata for today's update. 2011-10-13 18:31:24 -04:00
GoD-Tony 9a04a6bdb1 Added optional autoload of sdktools to cstrike ext.(bug 5125, r=psychonic). 2011-10-13 13:17:37 -04:00
Nicholas Hastings 1b9fb906e2 Added CS_GetClanTag and CS_SetClanTag natives to cstrike ext (bug 5122, r=fyren). 2011-10-13 13:17:29 -04:00
Nicholas Hastings e23d7ca51b Added TextMsg destination constants to IGameHelpers header (bug 5123, r=fyren). 2011-10-13 13:17:22 -04:00
Fyren 92773c2e1b Fixed client serials not getting cleared on disconnect (bug 5121, r=psychonic). 2011-10-12 00:51:58 -04:00
Nicholas Hastings 776889cfbb Removed error when optional ext dep is missing (bug 5112, r=fyren). 2011-10-11 22:51:24 -04:00
Nicholas Hastings 67163e14e6 Added checks to avoid crashing in some natives before map start (bug 5119, r=fyren). 2011-10-11 22:50:21 -04:00
Nicholas Hastings 45f68840ed Fixed multiple small issues with KickClient/Ex natives (bug 5120, r=fyren). 2011-10-11 19:50:53 -04:00
Nicholas Hastings 325ae5e977 Added better Nuclear Dawn compatibility to base plugins (bug 5117, r=fyren). 2011-10-11 19:47:20 -04:00
Nicholas Hastings 14919c65d9 Fixed wrong values for unsigned, >= 16-bit props in GetEntProp (bug 5105, r=fyren). 2011-10-11 19:41:56 -04:00
Nicholas Hastings 8888e88dc4 Updated tf2 inc files with more condition and custom dmg defs (bug 5118, r=asherkin). 2011-10-10 21:44:36 -04:00
javalia 0533664f90 Removed non-existant param from SetTrieString function doc (bug 5108, r=dvander). 2011-10-10 16:02:44 -04:00
Peace-Maker 64b824f457 Added gamedata for HL2CTF (bug 5114, r=psychonic). 2011-10-10 15:59:48 -04:00
Nicholas Hastings b6592d799f Updated Nuclear Dawn gamedata to use ShowMenu (now works). 2011-09-26 13:54:17 -04:00
Drifter c89711a863 Updated cstrike ext WeaponPrice offset. 2011-09-20 16:21:17 -04:00
Drifter 91a1292b12 Updated cstrike ext gamedata. 2011-09-16 11:36:37 -04:00
Paul Clothier b2d469cb84 Updated TF2 SetPowerplayEnabled gamedata (bug 5095, r=psychonic). 2011-09-15 18:43:33 -04:00
Nicholas Hastings 4f41da34c6 Merge. 2011-09-10 12:10:05 -04:00
Nicholas Hastings f136f2dcaf Added CheckAccess native to check cmd/override access of AdminId (bug 5083, r=fyren). 2011-09-10 12:08:38 -04:00
Reuben Morais e6df54537a Changed build system so that it no longer requires all SDKs to be available (bug 5023, r=ds). 2011-09-09 18:37:09 -05:00
Nicholas Hastings e62278859e Validate ent index bounds in LookupEntity (bug 5080, r=fyren). 2011-09-09 15:29:17 -04:00
Peace-Maker 51b91bce6d Updated Nuclear Dawn gamedata. 2011-09-08 19:59:09 -04:00
Nicholas Hastings d96a23d4f2 Fixed build. 2011-09-03 14:23:46 -04:00
javalia 98e049b336 Added GetDistGainFromSoundLevel native to SDKTools (bug 5066, r=dvander). 2011-09-03 14:18:08 -04:00
FlaminSarge 3c297f5d1d Fixed typo in tf2_stocks (persistant -> persistent) (bug 5074, r=psychonic). 2011-09-03 14:11:38 -04:00
FlaminSarge d64d196409 Fixed mixup of arrow stab and telefrag defs in tf2_stocks (bug 5074, r=psychonic). 2011-09-03 14:10:24 -04:00
Nicholas Hastings b1638e79c0 Added missing clientnatives files to sdktools proj file (NPOTB). 2011-08-29 13:55:11 -04:00
Nicholas Hastings 13753757d4 Fixed error in sdktools msvc10 proj file (NPOTB). 2011-08-28 16:18:48 -04:00
Nicholas Hastings 739e341218 Fixed Nuclear Dawn menus. 2011-08-25 13:58:12 -04:00
Nicholas Hastings fda282604d Added gamedata support for Nuclear Dawn. 2011-08-25 13:20:26 -04:00
Fyren 2cd7fa68d6 Reshove. 2011-08-20 16:45:44 -07:00
Fyren d78a0c87b8 Backed out changeset 42462959f48d 2011-08-20 16:44:16 -07:00
Fyren 88d4abeaf8 Shove. 2011-08-20 16:41:14 -07:00
Nicholas Hastings 1c0abbfce6 Partially fixed build. 2011-08-20 19:21:27 -04:00
Nicholas Hastings 1492e12ca2 Added support for E.Y.E Divine Cybermancy (bug 5035, r=fyren). 2011-08-20 18:58:37 -04:00
Nicholas Hastings 2b9a39e2eb Updated Fortress Forever gamedata to include support for newer features. 2011-08-20 13:25:38 -04:00
Nicholas Hastings 301ae447b4 Added more new TF2 weapon and custom damage defs (bug 5055, r=asherkin). 2011-08-20 13:25:07 -04:00
Asher Baker 3d47010cbd Fail to load a metamod-enabled extension if it refuses to attach to MM:S (bug 5042, r=dvander). 2011-08-15 20:19:07 +01:00
Asher Baker dd0ff999e4 Backed out changeset: 602945928c23 2011-08-15 20:06:14 +01:00
Asher Baker 05e5c93e91 Fail to load a metamod-enabled extension if it refuses to attach to MM:S (bug 5042, r=dvander). 2011-08-15 19:30:56 +01:00
Asher Baker 1bd97730ce Added a reset argument to 'sm cvars' (bug 5043, r=psychonic). 2011-08-14 21:42:32 +01:00
Fyren 458378be66 Let logic binary access ServerLang value on startup (bug 4675, r=dvander). 2011-07-24 19:52:22 -07:00
David Anderson c01101dbd0 Fix build. 2011-07-24 19:44:15 -07:00
Michael (LumiStance) f7364111f2 Fix corner cases with ExplodeString (bug 4629, r=dvander).
--HG--
extra : rebase_source : ebb338bc93d32544e66c16fcba4494d5eae7ee8e
2011-07-24 19:30:15 -07:00
Nicholas Hastings f3b84b8670 Added gamedata for International Online Soccer: Source (bug 5019). 2011-07-22 13:48:34 -04:00
Asher Baker ec11a31d9d Updated sm_rcon to use new ServerCommandEx native (bug 5018, r=ds). 2011-07-18 03:25:01 +01:00
Asher Baker 2271469d1b Added ServerCommandEx native to get the response when running a command (bug 3873, r=ds). 2011-07-18 03:23:03 +01:00
Asher Baker 7fe92d87c2 Added missing brackets back to l4d and l4d2 gamedata (bug 5016, r=psychonic). 2011-07-16 17:55:43 -04:00
Drifter 6046b8fb79 Fixed CS_GetWeaponPrice for some weapon (bug 4994, r=psychonic). 2011-07-14 12:57:18 -04:00
FlaminSarge a65239a8af Added defines for more new TF2 conditions to tf2.inc (bug 5000, r=psychonic). 2011-07-14 12:53:05 -04:00
Nicholas Hastings 746cd5f49c Merge. 2011-07-12 20:07:51 -04:00
Nicholas Hastings 75c315ad8a Fixed maxClients not being updated correctly in some cases/areas (bug 4986, r=fyren). 2011-07-12 20:06:08 -04:00
Nicholas Hastings c1926c6e25 Added FireOutput gamedata support for The Hidden. 2011-07-12 19:58:37 -04:00
Nicholas Hastings 3f8ba353b7 Updated Fistful of Frags gamedata for FoF 3.6 release. 2011-07-12 19:58:30 -04:00
Nicholas Hastings 39a2152a46 Reverted FindEntityByClassname gamedata obliteration from 7aea1316eff7 per bug 4963. 2011-07-12 19:58:16 -04:00
Nicholas Hastings ddd967534b Sped up native impl. of FindEntityByClassname (bug 4963, r=fyren). 2011-07-12 19:48:28 -04:00
Fyren 4d52fe0490 Revert 3336, try fix #2 (bug 4852, r=dvander) 2011-07-09 20:47:43 -07:00
Nicholas Hastings 264ffa80ce Backed out changeset: b5969264060e 2011-07-08 07:55:20 -04:00
Nicholas Hastings 258a9c636a Backed out changeset: 049c7073d1a4 2011-07-08 07:54:21 -04:00
Nicholas Hastings 8015d1827c Backed out changeset: 9007dacc012d 2011-07-08 07:53:31 -04:00
Nicholas Hastings ae10bc6601 Backed out changeset: 344daca49587 2011-07-08 07:53:14 -04:00
Nicholas Hastings 51c27afcd2 Fixed more crashes related to early, nonzero maxclients (bug 5008, r=dvander). 2011-07-07 21:31:07 -04:00
Nicholas Hastings e09d4f2cf2 Merge. 2011-07-07 19:53:56 -04:00
Nicholas Hastings 7e87f56699 Fixed nonzero maxClients startup crash in SDKTools (bug 5010, r=bee). 2011-07-07 19:51:05 -04:00
Scott Ehlert ca9150a731 Triggering build, ugh. 2011-07-07 11:25:00 -05:00
Nicholas Hastings 5250d819d0 Triggering a build, hoping for luck. 2011-07-07 09:27:24 -04:00
Nicholas Hastings d93413a4ae Fixed use of m_Players before init'd in PlayerManager (bug 5008, r=dvander). 2011-07-06 22:34:23 -04:00
Nicholas Hastings bb7f7eff51 Added native interface for Basecomm plugin (bug 2594, r=fyren). 2011-07-06 22:34:21 -04:00
Brian Simon 838e8c7b35 Added InactivateClient and ReconnectClient natives to SDKTools (bug 4931, r=fyren). 2011-07-06 18:11:02 -04:00
David Anderson bb48a16466 Fix compiler creating bogus arrays when missing a dimension (bug 4902, r=fyren). 2011-07-06 17:56:40 -04:00
David Anderson a02ff01d84 Prevent declaring arrays that the compiler is too buggy to handle (bug 4977, r=fyren). 2011-07-06 17:56:03 -04:00
David Anderson 66d27d6ac5 Fix return omission with else-after-return (bug 4852, r=fyren). 2011-07-06 17:55:14 -04:00
Nicholas Hastings 5ba82ef0fc Removed maxClients caching in core (bug 5007, bug 4986, r=fyren). 2011-07-06 17:50:37 -04:00
David Anderson 053b522aff Fixed some vars not being marked for init on first compile pass (bug 4643, r=fyren). 2011-07-06 17:50:26 -04:00
Nicholas Hastings 4521f80e5a Added ability in SDKTools to get/set prop values on gamerules class (bug 4983, r=fyren). 2011-07-06 17:37:35 -04:00
Nicholas Hastings f24efc17c1 Fixed TF2 OnConditionAdded/Removed forwards to catch all cases (bug 4982, r=fyren). 2011-07-06 17:37:35 -04:00
Nicholas Hastings f32d3849e5 Merge. 2011-07-06 15:30:19 -04:00
Michael Busby f2fb064ea6 Fixed typo in GetEntDataFloat function doc (bug 4993, r=psychonic). 2011-07-06 15:27:41 -04:00
Nicholas Hastings ce5093f91f BaseComm now uses CommandListeners for chat hooks (bug 4991, r=fyren). 2011-07-06 15:24:43 -04:00
David Anderson 75121588c4 Clobber 2011-07-04 15:33:11 -07:00
javalia 1ff0f478d4 Increase symbol name limit to 63 characters (bug 4564, r=dvander). 2011-07-04 15:26:08 -07:00
David Anderson 6c68082359 Fix crash when dynamic arrays run out of memory (bug 4632, r=fyren). 2011-07-04 01:57:19 -07:00
David Anderson a752d220cc Use active, not passive FTP. 2011-06-29 16:05:18 -07:00
Drifter ee1bbd5994 Added new CS_GetWeaponPrice native to cstrike extension (bug 4985, r=psychonic). 2011-06-28 20:32:55 -04:00
Michael Busby 91368e5656 Fixed typo in keyvalues.inc doc (bug 4990, r=psychonic). 2011-06-28 20:26:40 -04:00
Drifter c4c554b420 Added some small fixes for new CStrike patch (2ddc75e24c53) (bug 4732, r=psychonic). 2011-06-28 20:16:05 -04:00
Nicholas Hastings 52ec8bf049 Fixed build. 2011-06-27 09:35:38 -04:00
Nicholas Hastings 5c40e02ee6 Added support for gamedata lookups from matchmaking_ds lib (bug 4158, r=Fyren). 2011-06-27 09:30:52 -04:00
Nicholas Hastings d2a89c5856 Added gamedata for TF2 SetInWaitingForPlayers (bug 4704). 2011-06-27 08:29:11 -04:00
Nicholas Hastings 9ec3f1b89d Fixed TF2_RemoveCondition not always removing conditions (bug 4981, r=asherkin). 2011-06-26 21:00:03 -04:00
Nicholas Hastings 3ab81c764d Added more TF2 condition defines (bug 4979, r=asherkin). 2011-06-26 20:55:18 -04:00
Nicholas Hastings c072ce8f0c Fixed TF2 RemoveCondition gamedata. 2011-06-26 18:10:29 -04:00
Nicholas Hastings e44dbd0e77 Merge. 2011-06-26 18:09:55 -04:00
Nicholas Hastings ec12022550 Added msvc10 project files for TF2 ext (NPOTB). 2011-06-26 10:54:12 -04:00
Drifer e0f670499c Add a number of useful forwards and natives to the cstrike extension (bug 4732, r=fyren). 2011-06-26 01:25:42 -07:00
David Anderson 177cc87985 Doc improvement. 2011-06-25 15:31:11 -07:00
David Anderson 3e387f35e9 Updated credits. 2011-06-25 15:26:09 -07:00
Nicholas Hastings 7037723993 Fixed TF2 identifiers and condition stocks (bug 4974, r=me). 2011-06-24 19:45:16 -04:00
Scott Ehlert b1098d6287 Using gcc 4.4 from Debian 6 for Linux builds now. 2011-06-24 17:29:05 -05:00
Nicholas Hastings be222a16ce Updated TF2 identifiers and condition stocks. 2011-06-24 02:01:03 -04:00
Nicholas Hastings 17f9a3eba6 Updated TF2 gamedata. 2011-06-24 00:53:17 -04:00
Scott Ehlert 0ee77c0e7d Triggering a build. 2011-06-23 21:21:27 -05:00
Nicholas Hastings b92fa45da7 Triggering build. 2011-06-23 19:14:58 -04:00
Nicholas Hastings e64c2fc110 Triggering build. 2011-06-23 18:09:31 -04:00
Nicholas Hastings 49a6508888 Added msvc10 project for SDKTools (NPOTB). 2011-06-22 09:46:56 -04:00
David Anderson 859678536f Fixed crash on plugin unload when two cmds exist with same name, different casing (bug 4698, r=Fyren). 2011-06-20 13:30:14 -04:00
Nicholas Hastings 9a5f788807 Normalized line endings in IGameHelpers.h to appease FYREN. 2011-06-18 14:36:20 -04:00
Nicholas Hastings 84b3b1d29c Added HintTextMsg to IGameHelpers (bug 4950, r=Fyren). 2011-06-18 14:34:17 -04:00
Nicholas Hastings 80eb18a425 Moved GetEntityClassname to end of entity.inc to fix plugin compile errors (bug 4798). 2011-06-18 14:31:46 -04:00
Scott Ehlert 3e1ab53abd Fixed clang OS X build. 2011-06-17 18:21:17 -05:00
Scott Ehlert 18c119b4d5 Removed -static-libgcc for Mac OS X build (no bug, r=dvander).
This fixes the ld warning: could not create compact unwind for __Unwind_Resume: non-standard register 0 being saved in prolog
2011-06-17 18:00:32 -05:00
Nicholas Hastings e67a65c0db Fixed build. 2011-06-16 15:59:27 -04:00
Scott Ehlert 4c878c4963 Fixed crash in MemoryUtils::ResolveSymbol() on OS X Lion (10.7) (bug 4951, r=dvander). 2011-06-15 16:02:05 -05:00
Nicholas Hastings e8fbe0f36c Fixed uninit'ed string and other minor issues in basetriggers (bug 4945, r=fyren). 2011-06-05 23:13:25 -04:00
Nicholas Hastings 243b7e25f8 Added array element selection with Get/SetEntProp* on arrays (bug 4160, r=fyren). 2011-06-05 21:52:36 -04:00
John Schoenick f1a4a08c7f Fixed regression in FindEntityByClassname from bug 4899 (bug 4941, r=predcrab). 2011-06-01 20:36:16 -04:00
Fyren c0fa36b9a1 Added support for language aliases (bug 4858, r=dvander). 2011-05-25 21:10:18 -04:00
Nicholas Hastings 835b2d7ced Slight ep1 gamedata cleanup. 2011-05-25 20:56:30 -04:00
Nicholas Hastings 13c2381ba7 Added gamedata for Eternal Silence (bug 4880). 2011-05-25 20:50:51 -04:00
Fyren fbc8e899dd Forcing build. 2011-05-25 13:57:17 -04:00
Nicholas Hastings 5ee8c8ce91 Backed out changeset: a7a73225f8ee 2011-05-25 13:56:34 -04:00
Nicholas Hastings 971793d6a1 Backed out changeset: 065beec73902 2011-05-25 13:56:13 -04:00
Nicholas Hastings 9d7a905fb1 Backed out changeset: 65eb3df32b1c 2011-05-25 13:31:14 -04:00
Nicholas Hastings 731f002175 Backed out changeset: abe4ce9d3e0e 2011-05-25 13:30:40 -04:00
Nicholas Hastings 7e6f3bfd83 Adjusting the proper set of flags this time. 2011-05-25 11:25:20 -04:00
Nicholas Hastings 3e14739b29 Attempting to fix SDKTools build. 2011-05-25 11:21:16 -04:00
Nicholas Hastings d7fb6b2892 Fixed invalid client errors from late-load of SourceTV (bug 4881, r=fyren). 2011-05-25 08:31:12 -04:00
Nicholas Hastings 7527f441ae Switched to using IServerTools in SDKTools where possible. (bug 4899, r=fyren). 2011-05-25 08:27:27 -04:00
Nicholas Hastings 5228ee1d91 Updated garrysmod gamedata. 2011-05-24 20:36:09 -04:00
Nicholas Hastings 297a98e065 Handle leak notice now prints to error log (as well as fatal) (bug 4929, r=dvander). 2011-05-24 18:37:45 -04:00
Nicholas Hastings 727d8afd94 Updated core msvc10 proj file (no smn_profiler) (NPOTB). 2011-05-24 18:35:09 -04:00
Nicholas Hastings c292fba3df Updated core msvc9 proj file (engine defs, -smn_profiler, mms17 -> mms18) (NPOTB). 2011-05-24 18:34:45 -04:00
Nicholas Hastings 9954ff55f5 Added msvc10 project file for sm logic. (NPOTB). 2011-05-24 14:21:24 -04:00
Fyren fefd84d431 Translator now properly falls back on bad server language (bug 4861, r=dvander). 2011-05-24 13:25:28 -04:00
Fyren b4a7d21b9e Removed compiler double include check (bug 4863, r=dvander). 2011-05-24 10:49:40 -04:00
Nicholas Hastings d03e051611 Fixed var names and docs for TF2_MakeBleed native (bug 4928, r=fyren). 2011-05-24 10:17:48 -04:00
John Schoenick e8c141d775 Make SQL_LastInsertId and SQL_GetAffectedRows work on query handles, allowing their use with threaded queries 2011-05-14 20:21:37 -07:00
David Anderson 5b45e29533 Move profile natives to logic, add linux support (bug 4927, r=ds). 2011-05-22 02:04:34 -07:00
FlaminSarge 024d094459 Added TF2 megaheal cond defines to tf2 incs (bug 4916, r=psychonic). 2011-05-12 11:33:50 -04:00
Gareth Clarke df977577e2 Updated ep2v SetUserCvar gamedata (bug 4904). 2011-05-06 08:07:40 -04:00
Scott Ehlert b63b94bc81 Updated buildbot scripts to support clang builders. 2011-05-01 00:17:11 -05:00
Scott Ehlert 7e514f5d34 Moved -static-libgcc to linker flags. 2011-05-01 00:09:25 -05:00
Scott Ehlert cb2de2e5c4 Avoid depending on __isoc99_sscanf@GLIBC_2.7 when building on Linux with glibc >= 2.7 (bug 4894, r=dvander). 2011-04-28 02:43:55 -05:00
Nicholas Hastings f2fedbc3e6 Merge. 2011-04-25 19:05:48 -04:00
Nicholas Hastings 8ef686fd21 Updated dinodday gamedata for today's game update. 2011-04-25 19:05:01 -04:00
Nicholas Hastings 4c96e9a17d Updated zps gamedata for today's game update. 2011-04-25 19:04:34 -04:00
Scott Ehlert 939bc00b2b Added detection for clang compiler and fixed various warnings triggered by it (bug 4878, r=dvander). 2011-04-23 21:53:53 -05:00
Nicholas Hastings 0b06d3412e Updated Windows signature for GMod CreateEntityByName. 2011-04-17 16:12:45 -04:00
Nicholas Hastings 94f6f60105 Merge. 2011-04-15 15:40:38 -04:00
Nicholas Hastings 4bd6bc9683 Updated Garry's Mod gamedata. 2011-04-15 15:16:47 -04:00
David Anderson 3c59621425 Backed out changeset d6853d8d39fd 2011-04-15 10:59:10 -07:00
David Anderson a37e2ab26a Fix bug where globals can be assigned invalid memory (bug 4643, r=ds). 2011-04-15 10:50:09 -07:00
Nicholas Hastings d099febf7b Added new param to CTFPlayerShared::Disguise call in TF2 ext (bug 4866, r=fyren). 2011-04-15 12:11:32 -04:00
Nicholas Hastings b9f82332c8 Shortened __ext name for ClientPrefs to avoid hitting symbol limit (bug 4839). 2011-04-15 02:06:50 -04:00
Nicholas Hastings c02c4c6d6a Gamedata update for CS:S, TF2, DOD:S, and HL2DM. 2011-04-15 01:34:18 -04:00
Nicholas Hastings 17476ec137 Triggering build to (hopefully) fix load on linux. 2011-04-15 00:34:51 -04:00
Nicholas Hastings ee51a68c6f Triggering build... again. 2011-04-14 23:35:08 -04:00
Nicholas Hastings 0120ce5d7c Merge. 2011-04-14 23:30:04 -04:00
Nicholas Hastings 42c6e640fc Triggering build. 2011-04-14 23:26:39 -04:00
Scott Ehlert bc571316b9 Triggering a build for goodness sake. 2011-04-14 20:53:59 -05:00
Scott Ehlert 3cc1af9618 Triggering a build. 2011-04-13 20:25:10 -05:00
Scott Ehlert 6957bf504b Triggering a build. 2011-04-13 19:05:41 -05:00
Scott Ehlert d47dd70141 Attempt #2 at meaningful bootstrap error message. 2011-04-13 18:37:41 -05:00
Scott Ehlert 86eb2360db Attempt at getting a meaningful error message out of buildbot bootstrap. 2011-04-13 18:30:34 -05:00
Scott Ehlert c55e350cb2 Triggering a build, argh. 2011-04-13 17:08:39 -05:00
Scott Ehlert b0fe032b8d Triggering a build. 2011-04-13 16:44:20 -05:00
Scott Ehlert aa25870fb8 Triggering a build. 2011-04-13 16:09:36 -05:00
Nicholas Hastings a8118ea8f4 Merge. 2011-04-13 08:31:02 -04:00
Nicholas Hastings 1a344c1441 SetEntProp now marks edict state as changed at offset (bug 4855, r=fyren). 2011-04-13 08:13:49 -04:00
Berni 86a1641ac1 Fix compiler hanging when #including a directory (bug 4822, r=dvander) 2011-04-13 04:02:22 -07:00
Nicholas Hastings 10129fa568 Removed gEntList failure notify on Windows. (bug 4832, r=fyren). 2011-04-11 22:30:03 -04:00
David Anderson 935a8d36da Triggering build. 2011-04-09 18:18:59 -07:00
Nicholas Hastings 2516a3af8a Updated hgignore to catch msvc temp files (npotb). 2011-04-09 15:52:58 -04:00
Nicholas Hastings 120a265fc3 Removed core/msvc10/sourcemod_mm.sdf from version control (npotb). 2011-04-09 15:43:10 -04:00
Nicholas Hastings 33aebeb727 Added forwards to TF2 ext for cond addition and removal (bug 4851, r=fyren). 2011-04-09 00:33:55 -04:00
Nicholas Hastings 7e06cfb471 Added gamedata for Dino d-day. 2011-04-09 00:29:57 -04:00
Berni f2bcff69a9 Added GetEntityClassname stock (bug 4798, r=dvander). 2011-04-09 00:29:46 -04:00
Nicholas Hastings 39b7d175b9 Merge 2011-04-07 23:03:51 -04:00
Nicholas Hastings b9cebe8d87 triggering build. 2011-04-07 23:01:16 -04:00
Scott Ehlert 6814cfbcd7 Triggering a build, please. 2011-04-07 15:09:56 -05:00
Scott Ehlert 2884696024 Triggering a build, perhaps. 2011-04-07 14:51:56 -05:00
David Anderson 6930046bc6 Triggering build. 2011-04-07 04:16:38 -05:00
David Anderson 174cbfe3b9 Triggering build. 2011-04-07 04:13:54 -05:00
David Anderson 611c7633cf Triggering build. 2011-04-07 04:05:00 -05:00
David Anderson 822d4269c4 Pushing build. 2011-04-07 04:04:02 -05:00
David Anderson 8fd16efc33 Triggering build. 2011-04-07 03:58:20 -05:00
Nicholas Hastings ef082d855c Fixed some gamedata lookups requiring symbols on linux/mac (bug 4832, r=fyren). 2011-04-04 13:44:19 -04:00
Nicholas Hastings a5c4739804 Added better cross-engine entity flag compatibility. (bug 4809, r=fyren). 2011-04-04 13:37:29 -04:00
Nicholas Hastings d1f1a88ffd Mark clientprefs natives as optional when ext not required. (bug 4839, r=fyren). 2011-03-24 09:48:36 -04:00
David Anderson c05f6b7bf3 Trigger build. 2011-03-22 21:45:20 -07:00
Nicholas Hastings 4b5fa26cd6 Changed some instances of LogMessage to LogAction. (bug 4649, r=fyren). 2011-03-20 19:37:25 -04:00
Nicholas Hastings 0162d18343 Updated SM core vcxproj. MMSOURCE17 -> 18, Removed files moved to logic. (NPOTB) 2011-03-13 14:03:33 -04:00
Nicholas Hastings b6415818f6 Added new TF2 condition defines (bug 4834, r=fyren). 2011-03-13 14:03:26 -04:00
David Anderson e16efbf58b Upgraded symstore. 2011-03-12 23:01:29 -08:00
Nicholas Hastings 46804d0faf SM Central fixes for new language natives (bug 4613). 2011-03-12 23:56:04 -05:00
Dr\!fter a81567e2d6 Add OnClientSettingsChanged to IPlayerHelpers (bug 4812, r=fyren) 2011-03-08 12:59:42 -08:00
databomb 217670b54a Fix precedence of voice mute flag versus specific client overrides (bug 4826, r=fyren) 2011-03-08 12:23:34 -08:00
databomb f2e19c0387 Fix mistaken unhooking of voice hooks (bug 4804, r=fyren) 2011-03-08 12:17:21 -08:00
Fyren 9799970042 Update spcomp Makefile 2011-03-08 12:07:06 -08:00
GoD-Tony ca75d0d765 Added new language natives (bug 4613, r+a13=dvander). 2011-03-08 08:38:21 -05:00
Asher Baker 0824e49000 Added missing files to the spcomp project file (bug 4824, r=dvander). 2011-03-07 15:05:51 +07:00
Nicholas Hastings c3a98db0ea Fixed SetTeamScore not updating score on client (bug 2736, r=fyren). 2011-02-28 19:40:21 -05:00
Nicholas Hastings f27685717b Updated SDKTools vc project file (NPOTB). 2011-03-01 21:25:02 -05:00
Nicholas Hastings 55034bfa6f Merge 2011-03-01 21:22:09 -05:00
Nicholas Hastings 6f8b420d0d Backed out changeset: 6da59ea19165 2011-03-01 21:22:01 -05:00
Nicholas Hastings 2ed7e14a99 Merge. 2011-02-28 19:47:14 -05:00
Nicholas Hastings ee3bcef8ab Updated Empires Mod gamedata for version 2.31a. 2011-02-28 19:45:44 -05:00
Nicholas Hastings adbcb97515 Fixed graphical glitches with funcommands effects in L4D1 (bug 3486, r=fyren). 2011-02-28 19:45:36 -05:00
Nicholas Hastings c667723958 Added identifier for new TF2 flag event, 'returned' (bug 4808, r=fyren). 2011-02-28 19:44:41 -05:00
Nicholas Hastings d94634398e Updated TF2 condition idenifiers (bug 4801, r=fyren).
Added TFCond_InHealRadius (amputator glow) and fixed TFCond_Healing.
2011-02-28 19:43:08 -05:00
Nicholas Hastings f348e58508 Fixed SetTeamScore not updating score on client (bug 2736, r=fyren). 2011-02-28 19:40:21 -05:00
David Anderson 60f16970ac Trigger build. 2011-02-27 23:58:10 -08:00
David Anderson 39c5eafafc Trigger build. 2011-02-27 23:33:15 -08:00
David Anderson b7f6c223d8 Push build. 2011-02-27 23:04:10 -08:00
Nicholas Hastings bf9a65338b Forcing build to see if upload is fixed. 2011-02-27 12:43:13 -05:00
Nicholas Hastings 5b3ae5eff9 Updated ZPS gamedata. 2011-02-07 15:50:27 -05:00
Asher Baker f80a8d306b Added defines for TF2 weapon slots (r=dvander). 2011-02-01 14:45:19 -05:00
Nicholas Hastings 9ed9060940 Updated CSPromod gamedata. 2011-02-01 13:50:17 -05:00
Nicholas Hastings 5453e60099 Updated customkill and deathflag defines in tf2_stocks (bug 4799, r=dvander). 2011-01-16 20:25:44 -05:00
Nicholas Hastings 3de61b69ad Raised MAXPLAYERS from 64 to 65 (bug 4490, r=dvander). 2011-01-16 20:06:55 -05:00
Erik Minekus 322a4ed05d Fixed bug in nominations that could cause "Unknown command" error (bug 4797, r=psychonic). 2011-01-16 20:00:44 -05:00
Nicholas Hastings 8f3b4afcf7 Removed tv_enable hook to fix rare max client count issue (bug 4791, r=fyren). 2011-01-12 18:59:34 -05:00
Nicholas Hastings ebdc6b94fc forcing build. 2011-01-12 06:47:13 -05:00
Nicholas Hastings a7218d2e59 Added missing SOURCE_SDK_BLOODYGOODTIME define to halflife.inc (bug 4780, rs=dvander). 2011-01-12 00:30:47 -05:00
Nicholas Hastings 6d93beac8e maybe i was too impatient... 2011-01-12 00:12:06 -05:00
Nicholas Hastings 1fb1309e77 forcing build 2011-01-12 00:07:20 -05:00
Nicholas Hastings 5916f40b7a Added Bloody Good Time gamedata (bug 4780, r=fyren). 2011-01-11 23:36:32 -05:00
Nicholas Hastings 5226714bbd Added support for Bloody Good Time (bug 4780, r=fyren). 2011-01-11 23:35:58 -05:00
Asher Baker dabf486a9f Added missing MENUFLAG_BUTTON_NOVOTE define to menus.inc (bug 4217, r=psychonic). 2011-01-04 11:02:39 -05:00
Zach Kanzler c78f4407ea Exposed ProcessCommandTarget in IPlayerHelpers (bug 4742, r=fyren). 2010-12-31 20:04:59 -05:00
Asher Baker fae4127ddc Added missing unhooking of ClientConnect in PlayerManager (bug 4749, r=fyren). 2010-12-31 20:02:41 -05:00
Zach Kanzler 9cc1497e9e Fixed namespace-related compile issue in INativeInvoker.h (bug 4750, r=fyren). 2010-12-31 20:00:07 -05:00
Nicholas Hastings cdd64d52eb Updated Garry's Mod gamedata (bug 4762, r=fyren). 2010-12-19 14:10:36 -05:00
Nicholas Hastings 4d319c12f8 Updated TF2 includes with new weapon and condition identifiers (bug 4761, r=fyren). 2010-12-18 17:07:42 -05:00
Nicholas Hastings 8fc3e4ab12 Updated HL2DM gamedata (bug 4756, r=fyren). 2010-12-18 00:11:51 -05:00
Nicholas Hastings ed7d68d6a7 Updated DOD:S gamedata (bug 4755, r=fyren). 2010-12-18 00:03:31 -05:00
Nicholas Hastings 59820519ce Updated CS:S gamedata (bug 4754, r=fyren). 2010-12-18 00:03:04 -05:00
Nicholas Hastings 767c807a40 Updated TF2 gamedata (bug 4753, r=DS). 2010-12-17 23:08:49 -05:00
Nicholas Hastings d25adc1b10 Updated Goldeneye:Source gamedata (bug 4751, r=fyren). 2010-12-17 23:07:54 -05:00
Nicholas Hastings 35f0067fe5 Updated Garry's Mod gamedata (bug 4747, r=fyren). 2010-12-15 21:29:59 -05:00
Nicholas Hastings f1b01dd086 Triggering build to fix bug 4729 on L4D1 now. 2010-12-13 15:37:39 -05:00
Asher Baker 3df08d64e2 Fix permissions check in antiflood (bug 4584, r=dvander). 2010-12-12 18:13:05 -08:00
Erik Minekus f56cc43331 Fixed sm_rtv printing "unknown command" (bug 4730, r=psychonic). 2010-12-04 15:28:15 -05:00
Scott Ehlert b4b37daaf6 Triggering build to fix bug 4729. 2010-12-03 23:58:41 -08:00
Nicholas Hastings 1f187d24c8 Updated TF2_GetPlayerConditionFlags to match Valve's current logic. 2010-12-03 17:12:06 -05:00
Nicholas Hastings 5b806a467b Fixed BanClient always banning by IP address (bug 4626, r=fyren). 2010-11-30 13:09:30 -05:00
Jason Booth 20d14d5a10 Fixed profiler flush not clearing, added 'report' and 'clear' (bug 4674, r=dvander). 2010-11-30 13:08:30 -05:00
Nicholas Hastings 043b2df345 Fixed voting crash when client console, chat, and SourceTV are enabled (bug 4676, r=fyren). 2010-11-30 13:04:13 -05:00
Nicholas Hastings 9ec7feb9ab Fixed CDetour crash in TF2 extension when last plugin using forward is unloaded (bug 4713, r=fyren). 2010-11-28 22:41:48 -05:00
Nicholas Hastings 57cf6db4e0 Fixed TF2 GetHoliday Windows signature (bug 4714, r=fyren). 2010-11-24 20:46:17 -05:00
Nicholas Hastings 61b677c073 Add GetGameRules to ISDKTools (bug 4707, r=fyren) 2010-11-19 23:02:27 -05:00
Nicholas Hastings 264e42a4c5 Merge 2010-11-19 15:52:41 -05:00
Nicholas Hastings 251fd660f9 Backed out changeset: 07fb9b761438 2010-11-19 15:52:33 -05:00
Matt Woodrow 6459f53263 Why, oh why, do you do this to me gcc? 2010-11-19 18:16:24 +13:00
Matt Woodrow 55c8d93862 gcc strikes again with the no newline error. Bustage fix 2010-11-19 18:12:40 +13:00
Matt Woodrow c6f83f8c14 Bustage fix. Thanks for nothing Crimson 2010-11-19 18:07:28 +13:00
Brett Powell c9eaca0e56 Add WaitingForPlayers forwards to TF2 extension (bug 4704, r=pred) 2010-11-19 17:58:46 +13:00
Brett Powell 6267c17c6b Extend Nominations API (bug 4677, r=pred) 2010-11-19 17:39:53 +13:00
Brett Powell 616113d384 Add GetGameRules to ISDKTools (bug 4707, r=pred) 2010-11-19 17:37:26 +13:00
Nicholas Hastings ac738aff10 TF2 GetHoliday detour now detours UTIL_GetHoliday (bug 4700, r=fyren). 2010-11-09 21:12:38 -05:00
A.W. Stanley 7627bf80b9 Added TF2_IsPlayerInDuel native to TF2 extension (bug 4695, r=psychonic). 2010-11-07 19:05:32 -05:00
Scott Ehlert 172abb2710 Added support for L4D on Mac OS X (bug 4684, r=fyren). 2010-10-29 20:04:50 -05:00
Scott Ehlert a643c6ef1e Fixed sample ext makefiles for L4D Linux builds (bug 4681, r=fyren). 2010-10-28 12:42:13 -07:00
Nicholas Hastings 64bfb0961e Updated TF2 customkill defines (bug 4682, r=fyren). 2010-10-28 10:23:30 -04:00
Scott Ehlert 68d822f50a Fixed loading L4D on Linux (bug 4681, r=dvander). 2010-10-27 22:05:56 -07:00
Fyren 56e3bab02a vcproj crap (NPOTB) 2010-10-20 05:13:48 -07:00
Fyren 9dd5ab4ebd Fix Windows entity output hooks (bug 4644, r=dvander) 2010-10-20 05:10:13 -07:00
David Anderson b1ef86de75 Follow-up fixes to database conf reading (bug 4286, r=fyren). 2010-10-16 22:27:34 -07:00
Fyren b4a0d7a5b7 Use SH strings for database configs (bug 4286, r=dvander) 2010-10-16 03:52:36 -07:00
Scott Ehlert e6a93a799a Added support for L4D2 on Mac OS X (bug 4647, r=fyren). 2010-10-14 18:27:37 -05:00
Nicholas Hastings 4e175f9cd6 Updated Gmod gamedata (bug 4652, r=fyren). 2010-10-07 18:35:26 -04:00
Nicholas Hastings 62e3fe1414 Merge. 2010-10-06 20:47:16 -04:00
Nicholas Hastings eeb7285528 Updated CSS/DODS/TF2/HL2DM CommitSuicide offset (bug 4650, r=fyren). 2010-10-06 20:46:29 -04:00
Scott Ehlert 0340b62b7c Triggering build against L4D2 SDK changes.
This should fix sm_kick.
2010-10-05 23:32:27 -07:00
Scott Ehlert 5488f60260 Triggering build against L4D1 SDK changes. 2010-10-05 20:07:14 -07:00
Fyren be7ef860d5 Revert mistaken vsound.cpp change 2010-10-04 19:45:21 -07:00
Zach Kanzler 9aba700d8c Added GetMessageName to IUserMessages (bug 4573, r=pred). 2010-10-02 17:58:06 -04:00
Nicholas Hastings 7972acf5bf Added one more missing enum value in tf2_stocks. 2010-10-01 15:24:30 -04:00
Fyren 430c001d58 Static gamedata checker (NPOTB) 2010-10-01 12:15:43 -07:00
Nicholas Hastings 943777e5d0 Fixed/updated TF2_DisguisePlayer (bug 4641, r=fyren). 2010-10-01 10:46:21 -04:00
Nicholas Hastings c086c3b03b Updated more TF2 gamedata and fixed RemoveCondition call (bug 4641, r=fyren). 2010-10-01 09:07:51 -04:00
Nicholas Hastings e517eceb24 Shortened names of some symbols in tf2_stocks (bug 4642, r=fyren). 2010-10-01 08:50:18 -04:00
Nicholas Hastings 7fb57a4064 Updated TF2 includes with more defined identifiers (bug 4640, r=dvander). 2010-09-30 23:40:42 -04:00
Nicholas Hastings 888bca13c0 Updated HL2DM gamedata (bug 4636, r=fyren). 2010-09-30 20:09:10 -04:00
psychonic 8b39e0631d Updated DODS gamedata (bug 4638, r=fyren). 2010-09-30 17:24:19 -04:00
psychonic d0d0148a58 Updated TF2 gamedata (bug 4635, r=fyren). 2010-09-30 17:23:54 -04:00
psychonic a73b62c5bf Updated CSS gamedata (bug 4637, r=fyren). 2010-09-30 17:23:37 -04:00
Nicholas Hastings bee0afd301 forcing build 2010-08-27 20:15:28 -04:00
Nicholas Hastings 8f37940f4c Updated cstrike ext gamedata for 2010-08-26 update (bug 4595, r=fyren). 2010-08-26 22:23:07 -04:00
Nicholas Hastings 0fa8d8cb51 Updated Gmod gamedata, including linux support (bug 4569, r=fyren). 2010-08-24 19:23:57 -04:00
Nicholas Hastings 1f589d0d5d Added AMXX Pawn geshi generation script. 2010-08-23 13:53:44 -04:00
Nicholas Hastings ad36745a7c Normalized spacing and fixed warnings with newest geshi in (Source)Pawn geshi script. 2010-08-23 13:52:42 -04:00
Scott Ehlert 99b9860ea5 Added Alien Swarm build config for sample extension (bug 4530, r=psychonic). 2010-08-20 10:42:16 -05:00
Scott Ehlert dc5f82cce2 Fixed alignment on a couple of SourcePawn debugging structures on OS X (bug 4578, r=dvander).
This problem only affected plugins compiled with a fairly old version of spcomp.
2010-08-19 22:51:42 -05:00
Nicholas Hastings dc3050537b Fixed timeleft not getting reset on Game_Commencing in CS:S (bug 4557, r=fyren). 2010-08-19 21:57:09 -04:00
Nicholas Hastings 5acd0dd2d1 Fixed Curl lib AMBuilder script failing with vs2010 (bug 4575, r=ds). 2010-08-19 13:03:14 -04:00
Scott Ehlert 0d933a1901 Disabled nextmap plugin on Alien Swarm (bug 4571, r=fyren). 2010-08-16 15:13:47 -05:00
Nicholas Hastings 9f21865caf Fixed typo in edd61d1e1e26 (bug 4542) 2010-08-05 19:24:30 -04:00
Nicholas Hastings 2ba81d3fef Added initial gamedata for Alien Swarm (bug 4530, r=ds). 2010-08-02 12:28:38 -04:00
Erik Minekus bcc1c2e658 Fixed typos in some usage replies (bug 4552, r=dvander). 2010-08-02 09:44:49 -04:00
Nicholas Hastings 5fa8972ae6 Fixed Ignite crash on Fistful of Frags (bug 4556, r=fyren). 2010-08-02 09:37:36 -04:00
Nicholas Hastings 96363a0ce3 Fixed Firearms Source FireOutput signature (bug 4555, r=fyren). 2010-08-02 09:36:10 -04:00
Scott Ehlert 817fa9d9be Oh, fixed package script for new bintools binary (bug 4548). 2010-08-01 15:09:48 -05:00
Scott Ehlert 89334bb459 Bintools extension no longer needs a separate build for each engine (bug 4548, r=dvander). 2010-08-01 14:57:54 -05:00
Scott Ehlert 0ae2d99599 Fixed potential crash with IMemUtils::FindPattern on Linux (bug 4554, r=dvander). 2010-07-31 16:06:22 -05:00
Scott Ehlert e1199a02ee Fixed missing version string and compile date for MySQL extension (bug 4547, r=dvander). 2010-07-28 14:48:51 -05:00
Scott Ehlert 9408a61eb1 Ugh, fixed builds for real. How did that even happen? 2010-07-27 20:28:27 -05:00
Scott Ehlert 78d7e1bdfe Hopefully fixed build. 2010-07-27 18:02:37 -05:00
Scott Ehlert dd44a0aaea Added support for Alien Swarm (bug 4530, r=dvander). 2010-07-27 17:32:32 -05:00
Nicholas Hastings b3144dd19a Added gamedata for Fistful of Frags (bug 3883, r=fyren). 2010-07-26 19:26:32 -04:00
Nicholas Hastings 2722e96fac Two more phrases in ice.sp are now able to use translations (bug 4540, r=fyren). 2010-07-26 19:11:06 -04:00
pheadxdll 488de0014e Added TF2_MakeBleed native to TF2 ext (bug 4542, r=fyren,psychonic). 2010-07-26 11:06:08 -04:00
Zach Callear 9c2e0ebd4c Fixed living players hearing dead players if alltalk is disabled while deadtalk is on (bug 4533, r=fyren). 2010-07-26 08:23:49 -04:00
Nicholas Hastings 28cc96cfd0 Fixed errors and missing effects caused by missing sprites on L4D2 (bug 4512, r=fyren). 2010-07-26 08:15:52 -04:00
Erik Minekus 4ab3b15efd Added TF2 object stocks (bug 4536, r=psychonic). 2010-07-23 21:23:35 -04:00
Nicholas Hastings ff363e3893 Added gamedata for Firearms: Source (bug 4537 r=fyren). 2010-07-23 21:16:15 -04:00
Nicholas Hastings cd2c10b6dc Added support for logical entities to gamedata for Synergy. (bug 4534, r=fyren) 2010-07-22 21:38:55 -04:00
Scott Ehlert 563e981902 Fixed Linux and OS X builds. 2010-07-21 22:23:56 -05:00
Fyren c3e20d5d12 FireOutput detour in SDKTools now uses CDetour (bug 4416, r=pred). 2010-07-21 22:09:03 -05:00
Nicholas Hastings 2802486671 Fixed a couple small things in npp xml generation script. 2010-07-21 08:46:52 -04:00
Nicholas Hastings 1507d03c21 Updated TF2 conditions enum and defines (bug 4526, r=fyren) 2010-07-20 11:21:37 -04:00
Jason Booth fbbf193345 Fixed duplicated entries and unnecessary file locking in ProfViewer (bug 4510, r=dvander) 2010-07-18 21:39:15 -04:00
Jason Booth 78e51e6b11 Fixed problems with ProfViewer project file (bug 4510, r=dvander) 2010-07-18 21:37:18 -04:00
Nicholas Hastings be2bbec526 Fixed PlayerRunCmd being hooked when not used. (bug 3990, r=fyren) 2010-07-18 15:43:56 -04:00
Scott Ehlert a366096ef4 Added MSVC10 project file for sample extension (bug 4521, r=dvander). 2010-07-15 15:19:14 -05:00
Scott Ehlert c72222f718 Updated docs on replicate and notify params for SetConVar* and ResetConVar (bug 4517, r=pred). 2010-07-14 20:29:53 -05:00
Scott Ehlert fba0ec93bf Fixed replicate and notify params not working on old engine games (bug 4516, r=pred).
This also fixes an issue where clients could be notified of convar changes twice on newer engines (Orange Box and later).
2010-07-14 20:29:45 -05:00
Scott Ehlert 86f767e1aa Made name param of GetConVarName() non-const (bug 4515, r=pred). 2010-07-14 20:29:29 -05:00
Scott Ehlert 7e54192713 Added gamedata for DOD:S on Mac OS X. (bug 4513, r=dvander). 2010-07-12 21:03:25 -05:00
David Anderson e76a73e276 Fixed Windows build fo' realz. 2010-07-11 18:06:06 -07:00
David Anderson ccf0490624 Windows build fix. 2010-07-11 17:45:35 -07:00
David Anderson fe2721e04e Merge. 2010-07-11 17:33:09 -07:00
David Anderson fdd1a9afef Use hash table for global name lookups (bug 4496, r=fyren). 2010-07-11 17:32:46 -07:00
Scott Ehlert abf7aed880 Triggering a build to compile against L4D2 SDK changes (bug 4509). 2010-07-11 03:00:30 -05:00
Nicholas Hastings d986c7cdc0 Fixed TF2 sigs that broke with recent update (bug 4506, r=fyren) 2010-07-08 21:07:06 -04:00
Scott Ehlert 9d5e994c01 Bleh, fixed compiler error in console.inc caused by previous changeset. 2010-07-07 02:27:59 -05:00
Scott Ehlert 6f16fc77b8 Added GetConVarDefault() native (bug 4502, r=dvander). 2010-07-06 17:32:58 -05:00
David Anderson 651dfb796c Merge. 2010-07-02 18:17:16 -07:00
David Anderson 4f2fc17a8f Fixed staging buffers reallocating on every operation (bug 3820, r=fyren+fyren). 2010-07-02 18:16:50 -07:00
David Anderson 7bc019547f Fixed O(n) insertion of debug strings (bug 4495, r=fyren). 2010-07-02 18:16:15 -07:00
David Anderson f8c2629a3e Fixed O(n^2) generation of debug info tables (bug 4493, r=fyren). 2010-07-02 18:15:59 -07:00
David Anderson b5b4bff2fc Fixed bogus assert in callfunction (bug 4487, r=fyren). 2010-07-02 18:15:21 -07:00
David Anderson 7054b92a14 Fixed bogus assert about name lengths (bug 4486, r=fyren). 2010-07-02 18:12:31 -07:00
Nicholas Hastings 5856f9a45f Gmod gamedata update (bug 4489, r=fyren) 2010-06-29 18:17:25 -04:00
Fyren cec10060c6 How did I even do that. 2010-06-28 17:25:06 -07:00
Fyren 74a479ab41 Fix build 2010-06-28 16:41:08 -07:00
Nicholas Hastings e51ab09bb1 Backed out changeset: f1bfc4089ce5 2010-06-28 19:17:10 -04:00
Nicholas Hastings 0cd98bc353 Another try at fixing build. 2010-06-28 19:12:37 -04:00
Nicholas Hastings 158f9b0dc7 Backed out changeset: 54086a5d694b 2010-06-28 19:12:05 -04:00
Nicholas Hastings 95fe6eaf86 Fix build. 2010-06-28 19:03:16 -04:00
Nicholas Hastings 40b4859b16 newline 2010-06-28 18:37:43 -04:00
Nicholas Hastings e4832f0d08 Added forward/detour for TF2's GetHoliday function (bug 4462, r=pred) 2010-06-28 17:48:14 -04:00
_KaszpiR_ 5d5400a9ac Added FindFlagChar native. (bug 3776, r=dvander) 2010-06-27 19:17:25 -04:00
David Anderson f439cad46c Removed code now dead from CS:S Orange Box move (bug 4399, r=ds). 2010-06-23 23:35:28 -07:00
Nicholas Hastings 9fe2e8e31a Removed cstrike ep1 and cstrike_beta builds and references. 2010-06-23 23:49:06 -04:00
Erik Minekus 92d3fc3d8c Fixed lack of error checking on sm_motd. (bug 4460, r=dvander) 2010-06-23 23:41:47 -04:00
Nicholas Hastings 5d89599799 Backed out changeset: 6c4d95b625ea 2010-06-23 23:40:53 -04:00
Erik Minekus 2eb5b5eb67 Fixed lack of error checking on sm_motd. 2010-06-23 23:39:39 -04:00
Nicholas Hastings 45549a8173 Cstrike ext now recognizes and loads on cstrike_beta (bug 4399, r=fyren) 2010-06-23 10:08:08 -04:00
devicenull d7ebf2edc1 Fixed inaccuracy in CommandListener documentation 2010-06-23 09:22:49 -04:00
Greyscale a9aed2e557 Removed unnecessary tag from return value of SetArrayCell 2010-06-23 09:17:21 -04:00
Nicholas Hastings d691a0cf24 Ep2v cstrike ext now gets added to package. 2010-06-23 08:54:56 -04:00
Nicholas Hastings cbaa959521 Adding building of cstrike ext for ep2v (bug 4399, r=fyren) 2010-06-23 08:19:19 -04:00
Nicholas Hastings 2f128113b6 Added missing TF2 critcola condflag define (bug 4464, r=fyren) 2010-06-22 19:31:33 -04:00
Nicholas Hastings 70251a8b2e Updated TF2 'Burn' signature (bug 4463, r=fyren) 2010-06-22 19:26:07 -04:00
Fyren e332f4e12b Possible dynamic array dimension fix (bug 4428, r=dvander) 2010-06-19 15:15:23 -07:00
Nicholas Hastings 9a140ff93f Fixed outputname null pointer crash in sdktools (bug 4422, r=fyren) 2010-06-14 09:32:50 -04:00
David Anderson 97ab5dd1b5 Fixed switch case comparisons failing with large numbers (bug 4457, r=pred). 2010-06-13 20:26:58 -07:00
Scott Ehlert 075b4e92a9 Added gamedata for TF2 on Mac OS X. (bug 4455, r=dvander). 2010-06-10 17:12:52 -05:00
Nicholas Hastings f22dcfe03c Added missing FireOutput and PlayerRunCmd gamedata for zombie_master (bug 4452, r=fyren) 2010-06-07 19:35:34 -04:00
Scott Ehlert 124086419e Fixed IMemUtils::ResolveSymbol() on Mac OS X (bug 4448, r=dvander). 2010-06-07 13:26:45 -05:00
Nicholas Hastings 0712db0d29 Merge. 2010-06-06 20:53:13 -04:00
Nicholas Hastings 895f7edd12 Added new player condition (TFCond_CritCola) to tf2.inc. (bug 4447, r=fyren) 2010-06-06 20:51:35 -04:00
Matt Woodrow a3c5c0c23a Merge 2010-06-07 10:33:47 +12:00
Matt Woodrow f7a3a6c17b Fixed clientprefs deleting cookies twice in rare cases (bug 4412, r=Fyren) 2010-06-07 10:30:33 +12:00
Nicholas Hastings 98bec2580e Fixed OnClientConnected forward not firing for bots (bug 4443, r=fyren) 2010-06-06 17:53:38 -04:00
Fyren 5ca2d469a8 Fix sdktools voice memory corruption (bug 4415, r=dvander) 2010-06-05 23:15:29 -07:00
Scott Ehlert b413405876 Added gamedata for CS:S Beta (ep2v) on Mac OS X. (bug 4399, r=dvander). 2010-06-04 17:14:52 -05:00
Nicholas Hastings 330ff93e3e Updated Obsidian Conflict gamedata (bug 4439, r=fyren) 2010-06-02 07:47:00 -04:00
Nicholas Hastings fe08104d18 Fixed tf2.inc incorrectly attempting to load tf2 ext on all games (bug 4197, r=fyren) 2010-05-31 16:31:10 -04:00
Scott Ehlert e518605d69 Fixed various areas where code was being compiled for Linux only, but should actually be used on OS X too (bug 4392, r=dvander). 2010-05-29 18:11:47 -04:00
Scott Ehlert 9a35085ac3 Merge. 2010-05-29 00:38:08 -05:00
Scott Ehlert b0cf41de08 Fixed potential problem when using bintools to call functions that return objects by value on OS X (bug 4392, r=dvander).
Objects are only returned in memory when their sizes are greater than 8 or are not a power of 2.
2010-05-29 00:22:21 -05:00
Nicholas Hastings 00c3dc73f3 Updated/fixed SourceForts gamedata (bug 4429, r=fyren) 2010-05-28 13:28:04 -04:00
Scott Ehlert a73cc93d21 Added version information to Mac OS X binaries (bug 4392, r=dvander). 2010-05-27 21:05:32 -05:00
Scott Ehlert 5a10299074 Added Mac OS X build support to sample extension makefiles (bug 4392, r=dvander). 2010-05-27 21:04:49 -05:00
Scott Ehlert 77d243f87f Merge. 2010-05-27 21:04:22 -05:00
Nicholas Hastings fb4f6406c9 Fixed SDKTools sm_dump_datamaps crash on improperly created entities (bug 4424, r=pred) 2010-05-26 08:30:13 -04:00
Scott Ehlert 3133b9b010 Merge. 2010-05-22 01:08:42 -05:00
Nicholas Hastings 12723167fc Added gamedata for Resistance and Liberation (bug 4418, r=fyren) 2010-05-21 14:04:19 -04:00
Nicholas Hastings 2cc22778b5 Added comment to databases.cfg to denote acceptable "host" types 2010-05-21 14:00:33 -04:00
Nicholas Hastings 790d3f12a6 Empires gamedata fixes (bug 4417, r=fyren). 2010-05-21 13:55:29 -04:00
Scott Ehlert beb1ab81e0 Updated .hgignore to ignore dylib binaries on OS X. 2010-05-19 04:31:10 -05:00
Scott Ehlert e5126b4c65 Added support for "mac" in game data files (bug 4393, r=dvander). 2010-05-16 02:27:53 -04:00
Scott Ehlert a2a4df5d06 Triggering build. 2010-05-15 20:50:24 -04:00
Scott Ehlert ac0bd9714b Triggering build. 2010-05-15 20:00:55 -04:00
David Anderson 60226d9195 Fixed windows build. 2010-05-15 13:01:23 -07:00
David Anderson 64455b9852 Moved gameconf code from core to logic (bug 4406 part 11, r=ds).
--HG--
rename : core/GameConfigs.cpp => core/logic/GameConfigs.cpp
rename : core/GameConfigs.h => core/logic/GameConfigs.h
rename : core/smn_gameconfigs.cpp => core/logic/smn_gameconfigs.cpp
2010-05-14 23:35:42 -07:00
David Anderson 96f6cdf677 Moved datapack natives from core to logic (bug 4406 part 10, r=ds).
--HG--
rename : core/smn_datapacks.cpp => core/logic/smn_datapacks.cpp
2010-05-14 21:16:35 -07:00
David Anderson c188491289 Moved handle natives from core to logic (bug 4406 part 9, r=ds).
--HG--
rename : core/smn_handles.cpp => core/logic/smn_handles.cpp
2010-05-14 21:06:06 -07:00
David Anderson e9e4d566a5 Build fix. 2010-05-14 20:56:40 -07:00
David Anderson 85bedca236 Move string natives from logic to core (bug 4406 part 8, r=fyren).
--HG--
rename : core/smn_string.cpp => core/logic/smn_string.cpp
2010-05-14 20:04:44 -07:00
David Anderson d80191df3d Move replace functions from logic to core (bug 4406 part 7, r=fyren). 2010-05-14 20:04:30 -07:00
David Anderson 9137e92c09 Move translator from logic to core (bug 4406 part 6, r=ds).
--HG--
rename : core/PhraseCollection.cpp => core/logic/PhraseCollection.cpp
rename : core/PhraseCollection.h => core/logic/PhraseCollection.h
rename : core/Translator.cpp => core/logic/Translator.cpp
rename : core/Translator.h => core/logic/Translator.h
rename : core/sm_memtable.h => core/logic/sm_memtable.h
rename : core/smn_lang.cpp => core/logic/smn_lang.cpp
2010-05-14 19:43:53 -07:00
David Anderson 721dae3892 Inline sm_memtable (bug 4406 part 5, r=ds). 2010-05-14 19:43:38 -07:00
David Anderson 1cdacf69be Move some string functions from core to logic (bug 4406 part 4, r=fyren). 2010-05-14 19:28:10 -07:00
David Anderson b5b002aa4b Move banning natives from core to logic (bug 4406 part 3, r=fyren).
--HG--
rename : core/smn_banning.cpp => core/logic/smn_banning.cpp
2010-05-14 18:22:03 -07:00
David Anderson 78f5b513c0 Move admin natives from core to logic (bug 4406 part 2, r=ds).
--HG--
rename : core/smn_admin.cpp => core/logic/smn_admin.cpp
2010-05-14 17:46:19 -07:00
David Anderson 0032fcaa66 Move memutils from core to logic (bug 4406, r=ds).
--HG--
rename : core/MemoryUtils.cpp => core/logic/MemoryUtils.cpp
rename : core/MemoryUtils.h => core/logic/MemoryUtils.h
rename : core/sm_symtable.h => core/logic/sm_symtable.h
2010-05-14 16:14:59 -07:00
Scott Ehlert 0fba0923c8 Changed MSVC compiler flag /Ot to /Ox and added /OPT:REF linker flag. 2010-05-14 02:42:08 -05:00
Scott Ehlert e0169f6696 Fixed loader on Mac OS X (bug 4392, r=dvander). 2010-05-14 01:04:17 -05:00
David Anderson 28217f10cb Added ProcessTargetString simple filter API (bug 4404, r=ds). 2010-05-13 12:28:51 -07:00
Scott Ehlert fb28f4bcd0 Fixed package name for Windows (bug 4395). 2010-05-13 04:54:31 -05:00
Scott Ehlert 8852256ab6 Appended OS names to package archives (bug 4395, r=dvander). 2010-05-13 04:23:43 -05:00
Scott Ehlert 95de453677 Compile and link fixes for Mac OS X (bug 4392, r=dvander). 2010-05-13 04:22:31 -05:00
Scott Ehlert 5ef40e15c4 Add support for Mac OS X to ResolveSymbol() and FindPattern() in IMemUtils (bug 4392, r=dvander). 2010-05-13 04:20:41 -05:00
Scott Ehlert 31f223bff5 Merge. 2010-05-13 04:19:39 -05:00
Scott Ehlert 9fce2b1d8e Only build OB-Valve binaries on Mac OS X for now (bug 4392, r=dvander). 2010-05-13 04:18:58 -05:00
David Anderson a6ceb337b2 Move timer natives into logic binary (bug 4402, r=ds).
--HG--
rename : core/smn_timers.cpp => core/logic/smn_timers.cpp
2010-05-13 01:47:12 -07:00
Scott Ehlert f4e22cb44c Backed out changeset 29e6cc6f2124 (bug 4392). 2010-05-12 04:13:56 -05:00
David Anderson ab9750f8b2 Only build OB-Valve binaries on Mac OS X right now (bug 4392, r=ds). 2010-05-11 23:48:39 -05:00
Nicholas Hastings fe8e0b0e0a Merge 2010-05-11 20:41:19 -04:00
Nicholas Hastings c2565cf3b7 Updated gamedata for ep2v cstrike(_beta) (bug 4399, r=fyren) 2010-05-11 20:40:14 -04:00
David Anderson af82971bf5 Fixed Windows build. 2010-05-11 02:07:35 -07:00
David Anderson 271b52158e Mac build fixes (bug 4392, r=me). 2010-05-11 01:46:55 -07:00
Fyren 26c404adee Mac build fixes (bug 4392, r=dvander). 2010-05-11 01:46:54 -07:00
Scott Ehlert f06af54165 Fixed compiler and linker flags for darwin (r=dvander).
The previous commit by 'me' was a fake atrocity created by dvander. :o
2010-05-11 02:36:03 -05:00
Fyren 2a77dfbcd2 Fixed buildbot scripts for darwin (r=dvander). 2010-05-11 00:16:52 -07:00
David Anderson 738fcb6563 Added pcre-7.9 build for darwin. 2010-05-11 00:10:37 -07:00
Scott Ehlert 3d4754d4ad Fixed master amb script for darwin (r=dvander). 2010-05-11 00:10:36 -07:00
Scott Ehlert b9ea1d1be4 Fixed master amb script for darwin (r=dvander). 2010-05-11 00:10:36 -07:00
Nicholas Hastings b1b0484dae Fixed TF2 natives not being marked optional when ext not required (bug 4389, r=fyren) 2010-05-10 18:18:15 -04:00
Nicholas Hastings 20b79784bf Updated Empires gamedata (bug 4390, r=fyren) 2010-05-08 21:37:21 -04:00
Nicholas Hastings 4baa3358df Updated geshi and npp sp language files for SM 1.3.2
Also fixed typo in geshi generator and added 'default' to list of reserved words.
2010-05-08 21:31:32 -04:00
Scott Ehlert 8fe7f8b8d8 Fixed SendConVarValue() on TF2, DOD:S, L4D, and L4D2 (bug 4273, r=dvander). 2010-05-04 22:53:26 -04:00
Scott Ehlert 6996a0db2b Argh, really fixed HookEntityOutput() crash on TF2 (bug 4375). 2010-04-30 11:18:45 -04:00
Scott Ehlert b89a899c82 Fixed HookEntityOutput() crash with recent updates to TF2 and L4D2 (bug 4375, r=pred, a=blocking). 2010-04-30 03:51:35 -04:00
Fyren bbbbb660b3 Triggering build 2010-04-29 20:48:17 -07:00
Scott Ehlert 6ba29219e5 Updated sample extension makefiles to compile against latest changes for L4D2 and TF2 (bug 4374, r=dvander). 2010-04-29 16:06:32 -04:00
Nicholas Hastings dd97bdcc2c Fixed SetUserCvar offset for ep2v (bug 4371, r=fyren) 2010-04-29 14:12:08 -04:00
Nicholas Hastings b63e0f08bf Backed out changeset 907677755029 2010-04-29 14:11:03 -04:00
Nicholas Hastings c5ae9d45ad Fixed SetUserCvar offset for ep2v (bug 4371, r=fyren) 2010-04-29 14:05:22 -04:00
David Anderson e906a0da8c Merge. 2010-04-29 01:28:27 -07:00
David Anderson 2edfb0aaac Fixed regression when using panels (no bug, r=me). 2010-04-29 01:28:11 -07:00
Nicholas Hastings dc116858a9 ep2v gamedata (bug 4371, r=fyren) 2010-04-29 00:09:35 -07:00
Fyren 1a938f8711 ep2v build changes (bug 4371, r=dvander) 2010-04-29 00:08:08 -07:00
David Anderson fc88cd3cb1 Check return value of GetPlayerNetInfo (bug 4315, r=fyren). 2010-04-27 23:40:04 -07:00
David Anderson 55205e631b Merge. 2010-04-27 21:07:59 -07:00
David Anderson a36fa76d21 Root menu handles in callbacks (bug 4353, r=fyren). 2010-04-27 21:03:20 -07:00
Nicholas Hastings b8d512f5e1 Fixed entity output hooks not working in Insurgency (bug 4365, r=fyren) 2010-04-24 21:10:23 -04:00
Nicholas Hastings d4263b59c6 Added obsidian to list of games which support tempents with ep2 gamedata (thread 75480, r=me). 2010-04-24 21:08:06 -04:00
Nicholas Hastings e5e1507dff Fixed functions.inc not having double-include prevention (bug 4342, r=fyren) 2010-04-24 21:06:10 -04:00
Zach Kanzler 2edf63c5fd Fixed IGamePlayer->GetUserId() returning junk (bug 3916, r=fyren) 2010-04-24 21:00:43 -04:00
Fyren 5ec4b3441e Build stuff for L4D2 DLC (bug 4361, r=SAWCE) 2010-04-23 11:39:12 -07:00
Nicholas Hastings dd1757b3c3 Updated L4D2 gamedata for The Passing update (bug 4361, r=pending) 2010-04-23 14:22:41 -04:00
Nicholas Hastings dda26545e5 Updated Insurgency gamedata for Insurgency 2010-04-19 update (bug 4356, r=fyren) 2010-04-23 10:38:16 -04:00
Nicholas Hastings 410ef8ce96 Merge 2010-04-19 11:18:46 -04:00
Nicholas Hastings ce7cb9cf64 Added Notepad++ userDefineLang.xml generator for Sourcepawn
(based on the SP GeSHi generator)
2010-04-19 11:10:26 -04:00
Nicholas Hastings 31a16375ab Enhanced Sourcepawn GeSHi generation script
* Added a few missing keywords.
* Added better preprocessor, number, and string control char highlighting.
* Added default tab width (of 4 spaces).
* Fixed parsing of some enum values.
* Changed keywords to be case sensitive.
* Changed colors to be more sane.
2010-04-19 11:08:23 -04:00
Nicholas Hastings ec7b47da22 Updated Empires gamedata for Empires 2.25a release (bug 4108, r=fyren) 2010-04-19 10:38:28 -04:00
David Anderson 0124020ba4 Added obsidian to list of games which need menu redraws (thread 123237, r=me). 2010-04-04 23:50:27 -07:00
David Anderson 28f71d18bd Added obsidian to radiotimeout game list (t=123237, r=me). 2010-04-04 23:49:28 -07:00
Nicholas Hastings fe226c1c8d Updated sourcepawn GeSHi colors slightly to appease 2.53% of the haterz. 2010-03-31 18:40:03 -04:00
Nicholas Hastings 18e20de4d6 Added GeSHi language file generator for Sourcepawn 2010-03-31 14:27:09 -04:00
Nicholas Hastings 956d345e17 Added TF2_StunPlayer native and TF2_GetPlayerConditionFlags stock to TF2 ext. (bug 4331, r=pred) 2010-03-31 08:51:25 -04:00
Nicholas Hastings ddfb958647 Added missing semicolon in plugins/include/tf2.inc. 2010-03-23 20:06:13 -04:00
Nicholas Hastings 145d0ef37d Added Gamerules SDKCall support to CSPromod gamedata (bug 4320, r=pred) 2010-03-23 19:42:19 -04:00
Nicholas Hastings 019e3956f7 Fixed bad caller crash with HookEntityOutput (bug 4311, r=fyren) 2010-03-20 11:07:45 -04:00
Nicholas Hastings a72daff4ac Added 4 new natives to TF2 ext. (bug 4166, r=pred)
Added natives for Regenerate, add/remove condition, and SetPlayerPowerPlay. Also updated TF2 test plugin.
2010-03-18 11:35:05 -04:00
Nicholas Hastings 58ce9cd37f Added missing core voting cvars to sourcemod.cfg (bug 4309, r=fyren) 2010-03-11 22:00:46 -05:00
Nicholas Hastings 687bdaff8f Added missing core voting cvars to sourcemod.cfg (bug 4224, r=pred) 2010-03-11 17:43:46 -05:00
Nicholas Hastings 2143a66ad6 Fixed incorrect DispatchSpawn signature for ZPS and added ShowMenu and Hudtext support (bug 4279, r=Fyren) 2010-03-09 20:39:56 -05:00
Nicholas Hastings 74892f1562 Re-enabled ShowMenu support for FortressForever (bug 4028, r=dvander) 2010-03-09 18:50:47 -05:00
Nicholas Hastings 4a59ac011f Fixed FireOutput signature for FortressForever (bug 4062, r=dvander) 2010-03-09 18:47:56 -05:00
Nicholas Hastings e0fd2e8f27 Fixed sm_rename on L4D2 on Windows (bug 4131, r=dvander) 2010-03-09 18:44:18 -05:00
Nicholas Hastings ba76506773 Fixed inaccurate description for sm_unban (bug 4245, r=dvander) 2010-03-09 18:41:25 -05:00
Nicholas Hastings d224827544 Fixed CSPromod SDKTools Support (bug 4255, r=dvander) 2010-03-09 18:36:45 -05:00
Nicholas Hastings 8d35b5bd11 Updated PVKII support for PVKII 2.3 (bug 4276, r=dvander) 2010-03-09 18:29:31 -05:00
Nicholas Hastings 9df28c25d7 Fixed CreateGameRulesObject sig for ZPS (bug 4285, r=dvander). 2010-03-09 18:13:21 -05:00
Matt Woodrow 5f9b2a91fd Added optional 'No Vote' option to vote menu (bug 4217, r=dvander) 2010-02-27 14:56:02 +13:00
Erik Minekus 46a46f5e49 Fixed Insurgency gamedata file (bug 4282, r=dvander). 2010-02-24 23:41:06 -08:00
Liam 4bdc495d01 Corrected a typo in the string.inc file. (bug 4207, r=fyren) 2010-02-13 01:49:39 -05:00
Liam e60d5e6aeb Updated VC2010 files. 2010-02-13 01:13:43 -05:00
UNLOZE 7c3387755d Added MSVC10 files for Visual Studio 2010 support. 2010-02-13 00:40:53 -05:00
Fyren 6f04dad428 maxClients -> MaxClients in sdktools_sound.inc (fix bug 3985, r=psychonicsux) 2010-02-10 11:07:21 -08:00
Nicholas Hastings 6ed4720df3 Added missing file for Battlegrounds support (bug 4146). 2010-02-08 20:47:51 -08:00
Nicholas Hastings ac7b454039 Added SDKTools support for CSProMod (bug 4255, r=dvander) 2010-02-08 20:25:11 -08:00
Nicholas Hastings 0af39de346 Fixed base plugins using GetMaxClients() instead of MaxClients (bug 3985, r=dvander). 2010-02-08 20:14:52 -08:00
Nicholas Hastings d484979fe8 Fixed CreateEntityByName for Insurgency (bug 4180, r=dvander). 2010-02-08 20:10:24 -08:00
Nicholas Hastings 6e87e5c05f Updated Garry's Mod offsets (bug 4230, r=dvander). 2010-02-08 20:08:14 -08:00
Nicholas Hastings 7633c8e76e Fixed nextmap errors on Garry's Mod (bug 4268, r=dvander). 2010-02-08 20:06:48 -08:00
Fyren c78e89c3c1 Compiler confused |any| tag with |String| on array arguments. 2010-02-08 20:00:06 -08:00
David Anderson 1852aaf332 Fixed GetClientCookieTime not being exported (bug 4237, r=fyren). 2010-02-08 19:58:36 -08:00
Nicholas Hastings 8b4c8f63c0 Fixed FindEntityByClassname crash in Synergy (bug 4235, r=dvander). 2010-02-08 19:57:20 -08:00
Fyren d7b64c18c2 Fixed NULL-deref in entity handling code. 2010-02-08 19:55:14 -08:00
Nicholas Hastings 09668c972e Fixed Day of Defeat offsets for 20100203 update (bug 4262, r=dvander). 2010-02-04 19:28:06 -06:00
Scott Ehlert 68a0d10443 Webternet and Updater extensions now load on Windows 2000 (bug 4234, r=dvander). 2010-01-20 15:12:57 -06:00
David Anderson 0708e7f8f6 Fixed accidental hook against garbage offset (bug 4231, r=fyren). 2010-01-20 04:03:46 -08:00
David Anderson 1235e989d4 Added PlayerRunCmd offset for DoD:s (bug 4231 mitigation, r=me). 2010-01-20 04:01:39 -08:00
Scott Ehlert 3a6808e4d8 Updated .hgignore for Explorer files beginning with a lowercase letter (argh!) 2010-01-20 02:40:55 -06:00
David Anderson dbfb034548 Mercurial queues... oh, how terrible. 2010-01-18 03:20:44 -08:00
David Anderson 94d01e9e5a Moved CRC32 from core to logic (no bug, r=me). 2010-01-18 03:08:52 -08:00
David Anderson 5e48b49b7e Updated credits for 1.3 release. 2010-01-14 03:29:31 -08:00
Greyscale 3b0785cae0 Fixed missing #endif in adminmenu.inc (bug 4216, r=dvander). 2010-01-14 00:22:45 -08:00
David Anderson bd3b46d624 Fixed command listener spew on server shutdown (bug 4198, r=fyren). 2010-01-13 21:48:51 -08:00
David Anderson 1cbe996831 Linux build fix (bug 3520 fallout). 2010-01-11 22:50:44 -08:00
Downtown1 18865c44c8 Added a new ValveCallType that allows for arbitrary |this| parameters, as well as associated features in gamedata and for reading/writing memory (bug 3520, r=dvander, sr=fyren). 2010-01-11 22:46:44 -08:00
David Anderson ead6ca73e5 Triggering build. 2010-01-11 20:09:34 -08:00
Nicholas Hastings deb3f6d9c4 Changed basechat to use %N instead of GetClientName (bug 4205, r=dvander). 2010-01-10 17:57:34 -08:00
Nicholas Hastings b1b98c5256 Fixed basechat not using color messages on hl2mp (bug 4204, r=dvander). 2010-01-10 17:51:24 -08:00
Nicholas Hastings 4dc2227f23 Fixed lack of quotes on some basechat log messages (bug 4132, r=dvander). 2010-01-10 17:50:30 -08:00
David Anderson a76f9e11fb Backed out changeset 9a52d61fe6ba (bad commit). 2010-01-10 17:49:44 -08:00
Nicholas Hastings abeb91a5e4 Fixed lack of quotes on some basechat log messages (bug 4132, r=dvander). 2010-01-10 17:47:11 -08:00
Nicholas Hastings 6d5e7cbe08 Added missing SDK define for L4D2 (bug 4209, r=dvander). 2010-01-10 17:38:03 -08:00
Nicholas Hastings c468c26ad6 Follow-up to bug 4194 (r=dvander). 2010-01-10 17:29:32 -08:00
David Anderson a0e940c5a9 Merge. 2010-01-10 17:16:08 -08:00
David Anderson 2f1de22cae Backed out changeset 292be4eb9d0c (bug 4211). 2010-01-10 17:16:02 -08:00
David Anderson 4631282709 Fixed reentrancy problems with iterators, forwards, and function removals (bug
4059, r=fyren).
2010-01-10 16:58:17 -08:00
Fyren 306ac5243a Fixed GuessSDKVersion() not working on ep2v (bug 4194, r=dvander). 2010-01-09 11:33:19 -08:00
Nicholas Hastings 956fe42a6c Fixed SetUserCvar (sm_rename) on TF/DoD Linux (bug 4196, r=dvander). 2010-01-07 01:26:01 -08:00
Nicholas Hastings 1824bdfe7e Add Insurgency to list of games that support HUD messages (bug 4136, r=dvander). 2009-12-19 20:42:32 -08:00
David Anderson 5f53284cbd Fixed build, wrong enum comparison. 2009-12-19 18:25:56 -08:00
David Anderson 7a84b71eb2 Fixed crashes from rare plugin loading errors (bug 4153, r=ds). 2009-12-19 18:19:28 -08:00
David Anderson 85382cd6c2 Fixed SourceMod crashing after flushing the profiler (bug 4149, r=ds). 2009-12-19 18:18:17 -08:00
David Anderson 02a99f1e51 Add ability to change dontBroadcast status on hooked events (bug 3886, r=ds). 2009-12-19 18:16:41 -08:00
Nicholas Hastings fe405df704 Another TF2 gamedata fix (bug 4151, r=dvander). 2009-12-19 12:57:26 -08:00
Nicholas Hastings ac5ee90c9b Battlegrounds 2 gamedata support (bug 4146, r=dvander). 2009-12-19 00:03:57 -08:00
Nicholas Hastings fb6b34e155 TF2 gamedata updates (bug 4147, r=dvander). 2009-12-18 22:01:41 -08:00
Fyren caa8932c9a Improve/fix GetEntity (bug 4092, r=pred) 2009-12-15 23:14:53 -08:00
David Anderson 75611f3bca Fixed profiler being set to NULL (bug 4143, r=fyren). 2009-12-14 23:08:15 -08:00
David Anderson f0f14d8a22 Fixed infinite loop in Windows build failure path (bug 4144, r=ds). 2009-12-14 23:07:54 -08:00
Nicholas Hastings 98ad6cd23b Fixed CreateEntityByName for Insurgency (bug 4046, r=dvander). 2009-12-14 20:31:16 -08:00
Nicholas Hastings bd80d1cd76 Updated Synergy gamedata (bug 3987, r=dvander). 2009-12-14 20:30:44 -08:00
Nicholas Hastings 5a4670ec2f Added HudText support for Zombie Master (bug 4004, r=dvander). 2009-12-14 20:30:04 -08:00
Nicholas Hastings 6fd039925a Added Neotokyo support (bug 4126, r=dvander). 2009-12-14 20:29:23 -08:00
David Anderson cd602ab5e3 Fixed basecomm description spelling (bug 4112, r=me). 2009-12-14 20:27:26 -08:00
Dog f59ead54d3 Fixed CommitSuicide offset on DoD:S (bug 4109, r=dvander). 2009-12-14 20:26:45 -08:00
Fyren 4030f1e40d Merge 2009-11-23 01:50:28 -08:00
Fyren b7ac7452f7 Fix wonky handling of path separators for "sm plugins" commands (bug 3857, r=dvander) 2009-11-23 01:47:32 -08:00
Scott Ehlert 5dd6867408 Updated .hgignore to ignore some Windows and OS X files. 2009-11-22 01:39:29 -06:00
Scott Ehlert 9d410df287 Updated sample_ext and mms_sample_ext for Orange Box Valve and Left 4 Dead 2 (bug 4118, r=pred). 2009-11-22 01:33:08 -06:00
David Anderson fe8dc36074 Use GetVSPInfo() from MM:S 1.8 legacy API (bug 4081, r=ds). 2009-11-20 15:18:58 -06:00
Fyren 0cef3fbf27 Fix leak in nominations plugin (bug 4104, r=pred) 2009-11-18 15:44:51 -08:00
Fyren b5d9b18da4 Fix rare basevotes map vote problem (bug 3905, r=dvander) 2009-11-18 15:42:21 -08:00
Scott Ehlert dc0ea197cd Added IMemoryUtils::ResolveSymbol() for resolving symbols hidden via GCC's -fvisibility=hidden (bug 4091, r=dvander,pred).
Right now, this is only used on L4D2 where it is needed.
2009-11-06 16:24:40 -06:00
David Anderson 5bf17fc5ae Clarified handle invariants in clientprefs.inc (no bug, r=me). 2009-11-04 13:52:12 -05:00
Fyren 33ca5943fa Don't call edict_t::StateChanged(ushort) on L4D2 (bug 4090, r=dvander) 2009-11-01 02:53:34 -08:00
Scott Ehlert edc6591041 Use SOURCE_ENGINE_ORANGEBOXVALVE constant from MM:S 1.8 (bug 4087, r=dvander). 2009-10-30 14:04:43 -05:00
Fyren 113ec33743 More L4D2 gamedata changes 2009-10-30 01:24:55 -07:00
Scott Ehlert 8c297832f6 Fixed Windows build, I think. 2009-10-30 00:03:54 -05:00
Fyren e767b2ff94 Typo fix 2009-10-29 20:34:00 -07:00
Scott Ehlert a1ff408c13 Merge. 2009-10-29 21:47:27 -05:00
Matt Woodrow 440184e83c New sdk uses _linux for vstdlib/tier0 2009-10-30 15:20:48 +13:00
Matt Woodrow 8ee6cad7ea Build Trigger 2009-10-30 15:10:34 +13:00
Matt Woodrow edb17b76f0 AMBuild updated to use new MM:S version 2009-10-30 14:58:17 +13:00
Fyren 31dc5f335d Updated GuessSDKVersion 2009-10-30 14:34:34 +13:00
Matt Woodrow eb68e4c627 SourceMod MSVC project files updated, windows tested and loading, gamedata fix. 2009-10-30 14:29:45 +13:00
Matt Woodrow 98e97920ae AMBuild updated for new L4D2 engine 2009-10-30 13:27:19 +13:00
Matt Woodrow 533723cd8b L4D2 gamedata updates 2009-10-30 13:27:05 +13:00
Fyren 9e69afbbd6 Inital SM fixes for l4d2 and linux makefile updates 2009-10-30 13:26:13 +13:00
Scott Ehlert 2dea76dfa1 Changed name in credits. 2009-10-29 17:35:00 -05:00
David Anderson 8a8bafb199 Use GetSourceEngineBuild() from MM:S 1.8 legacy API (bug 4083, r=ds). 2009-10-29 01:33:57 -07:00
David Anderson 5a21d8c24d Let SourceMod use OnUnlinkConCommandBase from MM:S 1.8 legacy API (bug 4080, r=ds). 2009-10-29 00:53:31 -07:00
David Anderson 5111b4799c Fix iloop race when using AddCommandListener and SourceMod unloads (bug 4077, r=pred). 2009-10-29 00:06:12 -07:00
David Anderson 528bbe0116 Build against MM:S 1.8 with core-legacy (bug 4076, r=ds). 2009-10-28 23:30:52 -07:00
David Anderson 3030ab8664 Fixed crash when activating command listeners on EP1 while inside a command callback (bug 4072, r=pred). 2009-10-28 00:50:48 -07:00
David Anderson 2698ff1a04 Added feature testing functionality (bug 4021, r=pred). 2009-10-28 00:37:34 -07:00
David Anderson 084dd1c8dd Build fix. 2009-10-28 00:31:48 -07:00
David Anderson a8392889de Fix maphistory command not returning a value (bug 4069, r=pred). 2009-10-28 00:08:15 -07:00
David Anderson 3bf5edc2b3 Added @spec target (bug 2718, r=fyren). 2009-10-27 03:41:36 -07:00
David Anderson 97be0ff22a Bumped trunk version. 2009-10-27 03:11:34 -07:00
667 changed files with 201052 additions and 76986 deletions
+6
View File
@@ -1,11 +1,15 @@
# Binaries
\.dll$
\.dylib$
\.exe$
\.so$
# Files generated by Visual Studio
\.aps$
\.ipch$
\.ncb$
\.opensdf$
\.sdf$
\.suo$
\.user$
@@ -20,3 +24,5 @@
# Files generated by Windows Explorer
(^|/)[dD]esktop\.ini$
(^|/)[tT]humbs\.db$
syntax: glob
build/*
+2 -2
View File
@@ -3,5 +3,5 @@ e6ef5ecdf8d75740ca2685a709bf321f8873bc3b sourcemod-1.1.0
e877885fac80be71822641f7a9122cebc9812521 sourcemod-1.1.1
b3ffa8a4511c4eadaf533fc790aa6b14f7f0c6ea sourcemod-1.1.2
3a73bbf60f34befa9b66be03fa5974b394bb3411 sourcemod-1.2.0
a71318396392e3c6d0ff31e069a60fbde59e0cea sourcemod-1.3.0
3f33d01fcc28b509bed30f7be07ed215cc000538 sourcemod-1.3.1
78a1f1b1c6fa86fd7691c70ebf48a9fb3dfb3c11 sourcemod-1.5.0
5574bfe07731b7dba171c1300f6022319d2dbc89 sourcemod-1.5.1
+261 -73
View File
@@ -1,76 +1,148 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os
import sys
from ambuild.command import Command
from ambuild.command import ShellCommand
from ambuild.command import SymlinkCommand
class ExtractDebugInfoCommand(Command):
def __init__(self, binary, outfile):
Command.__init__(self)
self.binary = binary
self.outfile = outfile
def run(self, runner, job):
if AMBuild.cache['debug']:
return
if not self.binary.NeedsRelink(self.outfile):
return
if AMBuild.target['platform'] == 'linux':
job.AddCommand(ShellCommand('objcopy --only-keep-debug ' + self.outfile + ' ' + self.outfile + '.dbg'))
job.AddCommand(ShellCommand('objcopy --strip-debug ' + self.outfile))
job.AddCommand(ShellCommand('objcopy --add-gnu-debuglink=' + os.path.basename(self.outfile) + '.dbg ' + self.outfile))
elif AMBuild.target['platform'] == 'darwin':
job.AddCommand(ShellCommand('dsymutil ' + self.outfile))
job.AddCommand(ShellCommand('strip -S ' + self.outfile))
class SM:
def __init__(self):
self.compiler = Cpp.Compiler()
#Build SDK info
self.possibleSdks = { }
self.possibleSdks['ep1'] = {'sdk': 'HL2SDK', 'ext': '1.ep1', 'def': '1',
'name': 'EPISODEONE', 'platform': ['windows', 'linux'],
'dir': 'hl2sdk'}
self.possibleSdks['ep2'] = {'sdk': 'HL2SDKOB', 'ext': '2.ep2', 'def': '3',
'name': 'ORANGEBOX', 'platform': ['windows', 'linux'],
'dir': 'hl2sdk-ob'}
self.possibleSdks['css'] = {'sdk': 'HL2SDKCSS', 'ext': '2.css', 'def': '6',
'name': 'CSS', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-css'}
self.possibleSdks['hl2dm'] = {'sdk': 'HL2SDKHL2DM', 'ext': '2.hl2dm', 'def': '7',
'name': 'HL2DM', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-hl2dm'}
self.possibleSdks['dods'] = {'sdk': 'HL2SDKDODS', 'ext': '2.dods', 'def': '8',
'name': 'DODS', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-dods'}
self.possibleSdks['tf2'] = {'sdk': 'HL2SDKTF2', 'ext': '2.tf2', 'def': '9',
'name': 'TF2', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-tf2'}
self.possibleSdks['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '10',
'name': 'LEFT4DEAD', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-l4d'}
self.possibleSdks['nd'] = {'sdk': 'HL2SDKND', 'ext': '2.nd', 'def': '11',
'name': 'NUCLEARDAWN', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-nd'}
self.possibleSdks['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '12',
'name': 'LEFT4DEAD2', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-l4d2'}
self.possibleSdks['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
'name': 'DARKMESSIAH', 'platform': ['windows'],
'dir': 'hl2sdk-darkm'}
self.possibleSdks['swarm'] = {'sdk': 'HL2SDK-SWARM', 'ext': '2.swarm', 'def': '13',
'name': 'ALIENSWARM', 'platform': ['windows'],
'dir': 'hl2sdk-swarm'}
self.possibleSdks['bgt'] = {'sdk': 'HL2SDK-BGT', 'ext': '2.bgt', 'def': '4',
'name': 'BLOODYGOODTIME', 'platform': ['windows'],
'dir': 'hl2sdk-bgt'}
self.possibleSdks['eye'] = {'sdk': 'HL2SDK-EYE', 'ext': '2.eye', 'def': '5',
'name': 'EYE', 'platform': ['windows'],
'dir': 'hl2sdk-eye'}
self.possibleSdks['csgo'] = {'sdk': 'HL2SDKCSGO', 'ext': '2.csgo', 'def': '15',
'name': 'CSGO', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-csgo'}
# self.possibleSdks['portal2'] = {'sdk': 'HL2SDK-PORTAL2', 'ext': '2.portal2', 'def': '14',
# 'name': 'PORTAL2', 'platform': ['windows'],
# 'dir': 'hl2sdk-portal'}
self.sdkInfo = { }
self.sdkInfo['ep1'] = {'sdk': 'HL2SDK', 'ext': '1.ep1', 'def': '1',
'name': 'EPISODEONE'}
self.sdkInfo['ep2'] = {'sdk': 'HL2SDKOB', 'ext': '2.ep2', 'def': '3',
'name': 'ORANGEBOX'}
self.sdkInfo['ep2v'] = {'sdk': 'HL2SDKOBVALVE', 'ext': '2.ep2v', 'def': '4',
'name': 'ORANGEBOXVALVE'}
self.sdkInfo['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '5',
'name': 'LEFT4DEAD'}
self.sdkInfo['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '6',
'name': 'LEFT4DEAD2'}
if AMBuild.target['platform'] == 'windows':
self.sdkInfo['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
'name': 'DARKMESSIAH'}
if AMBuild.mode == 'config':
#Detect compilers
self.compiler.DetectAll(AMBuild)
self.hasMySql = AMBuild.options.hasMySql
AMBuild.cache.CacheVariable('hasMySql', self.hasMySql)
#Detect variables
envvars = { 'MMSOURCE18': 'mmsource-1.8',
'HL2SDK': 'hl2sdk',
'HL2SDKOB': 'hl2sdk-ob',
'HL2SDKL4D': 'hl2sdk-l4d',
'HL2SDKOBVALVE': 'hl2sdk-ob-valve',
'HL2SDKL4D2': 'hl2sdk-l4d2',
'MYSQL5': 'mysql-5.0'
}
AMBuild.cache.CacheVariable('debug', AMBuild.options.debug)
#Environment variable paths to external headers
envvars = { 'MMSOURCE110': 'mmsource-1.10', 'MYSQL5': 'mysql-5.0' }
#Look for Metamod:Source and MySQL if not disabled
for env in envvars:
if not self.hasMySql and env == 'MYSQL5':
continue
path = self.ResolveEnvPath(env, envvars[env])
if path == None:
raise Exception('Could not find a valid path for {0}'.format(env))
AMBuild.cache.CacheVariable(env, path)
#Look for SDK directories
for sdk in self.possibleSdks:
#Get list of SDKs to build against or 'all' or 'present'
sdkList = AMBuild.options.sdks.split(',')
#Build against all supported SDKs?
useAll = sdkList[0] == 'all'
#Build against supported SDKs that exist?
usePresent = sdkList[0] == 'present'
#Dark Messiah is Windows-only
if AMBuild.target['platform'] == 'windows':
envvars['HL2SDK-DARKM'] = 'hl2sdk-darkm'
info = self.possibleSdks[sdk]
if AMBuild.target['platform'] in info['platform']:
env = info['sdk']
dir = info['dir']
sdkPath = self.ResolveEnvPath(env, dir)
if sdkPath == None:
if useAll or sdk in sdkList:
raise Exception('Could not find a valid path for {0}'.format(env))
else:
continue
if useAll or usePresent or sdk in sdkList:
self.sdkInfo[sdk] = info
AMBuild.cache.CacheVariable(env, sdkPath)
#Must have a path for each envvar (file a bug if you don't like this)
for i in envvars:
if i in os.environ:
path = os.environ[i]
if not os.path.isdir(path):
raise Exception('Path for {0} was not found: {1}'.format(i, path))
else:
head = os.getcwd()
oldhead = None
while head != None and head != oldhead:
path = os.path.join(head, envvars[i])
if os.path.isdir(path):
break
oldhead = head
head, tail = os.path.split(head)
if head == None or head == oldhead:
raise Exception('Could not find a valid path for {0}'.format(i))
AMBuild.cache.CacheVariable(i, path)
if len(self.sdkInfo) < 1:
raise Exception('At least one SDK must be available.')
AMBuild.cache.CacheVariable('sdkInfo', self.sdkInfo)
#Set up defines
cxx = self.compiler.cxx
if isinstance(cxx, Cpp.GCC):
self.vendor = 'gcc'
if isinstance(cxx, Cpp.CompatGCC):
if isinstance(cxx, Cpp.GCC):
self.vendor = 'gcc'
elif isinstance(cxx, Cpp.Clang):
self.vendor = 'clang'
self.compiler.AddToListVar('CDEFINES', 'stricmp=strcasecmp')
self.compiler.AddToListVar('CDEFINES', '_stricmp=strcasecmp')
self.compiler.AddToListVar('CDEFINES', '_snprintf=snprintf')
self.compiler.AddToListVar('CDEFINES', '_vsnprintf=vsnprintf')
self.compiler.AddToListVar('CFLAGS', '-pipe')
self.compiler.AddToListVar('CFLAGS', '-fno-strict-aliasing')
if cxx.majorVersion >= 4:
if (self.vendor == 'gcc' and cxx.majorVersion >= 4) or self.vendor == 'clang':
self.compiler.AddToListVar('CFLAGS', '-fvisibility=hidden')
self.compiler.AddToListVar('CXXFLAGS', '-fvisibility-inlines-hidden')
self.compiler.AddToListVar('CFLAGS', '-Wall')
@@ -78,19 +150,26 @@ class SM:
self.compiler.AddToListVar('CFLAGS', '-Wno-uninitialized')
self.compiler.AddToListVar('CFLAGS', '-Wno-unused')
self.compiler.AddToListVar('CFLAGS', '-Wno-switch')
self.compiler.AddToListVar('CFLAGS', '-mfpmath=sse')
self.compiler.AddToListVar('CFLAGS', '-msse')
self.compiler.AddToListVar('CFLAGS', '-g3')
self.compiler.AddToListVar('CFLAGS', '-m32')
self.compiler.AddToListVar('CFLAGS', '-static-libgcc')
self.compiler.AddToListVar('POSTLINKFLAGS', '-m32')
self.compiler.AddToListVar('CXXFLAGS', '-fno-exceptions')
self.compiler.AddToListVar('CXXFLAGS', '-fno-rtti')
self.compiler.AddToListVar('CXXFLAGS', '-fno-threadsafe-statics')
self.compiler.AddToListVar('CXXFLAGS', '-Wno-non-virtual-dtor')
self.compiler.AddToListVar('CXXFLAGS', '-Wno-overloaded-virtual')
if (self.vendor == 'gcc' and cxx.majorVersion >= 4 and cxx.minorVersion >= 7) or \
(self.vendor == 'clang' and cxx.majorVersion >= 3):
self.compiler.AddToListVar('CXXFLAGS', '-Wno-delete-non-virtual-dtor')
self.compiler.AddToListVar('CDEFINES', 'HAVE_STDINT_H')
self.compiler.AddToListVar('CDEFINES', 'GNUC')
if self.vendor == 'gcc':
self.compiler.AddToListVar('CFLAGS', '-mfpmath=sse')
elif isinstance(cxx, Cpp.MSVC):
self.vendor = 'msvc'
if AMBuild.options.debug == '1':
self.compiler.AddToListVar('CFLAGS', '/MTd')
self.compiler.AddToListVar('POSTLINKFLAGS', '/NODEFAULTLIB:libcmt')
else:
self.compiler.AddToListVar('CFLAGS', '/MT')
self.compiler.AddToListVar('CDEFINES', '_CRT_SECURE_NO_DEPRECATE')
@@ -121,25 +200,54 @@ class SM:
#Optimization
if AMBuild.options.opt == '1':
self.compiler.AddToListVar('CDEFINES', 'NDEBUG')
if self.vendor == 'gcc':
if self.vendor == 'gcc' or self.vendor == 'clang':
self.compiler.AddToListVar('CFLAGS', '-O3')
elif self.vendor == 'msvc':
self.compiler.AddToListVar('CFLAGS', '/Ot')
self.compiler.AddToListVar('CFLAGS', '/Ox')
self.compiler.AddToListVar('POSTLINKFLAGS', '/OPT:ICF')
self.compiler.AddToListVar('POSTLINKFLAGS', '/OPT:REF')
#Debugging
if AMBuild.options.debug == '1':
self.compiler.AddToListVar('CDEFINES', 'DEBUG')
self.compiler.AddToListVar('CDEFINES', '_DEBUG')
if self.vendor == 'gcc':
self.compiler.AddToListVar('CFLAGS', '-g3')
elif self.vendor == 'msvc':
if self.vendor == 'msvc':
self.compiler.AddToListVar('CFLAGS', '/Od')
self.compiler.AddToListVar('CFLAGS', '/RTC1')
#This needs to be after our optimization flags which could otherwise disable it.
if self.vendor == 'msvc':
# Don't omit frame pointer
self.compiler.AddToListVar('CFLAGS', '/Oy-')
#Platform-specifics
if AMBuild.target['platform'] == 'linux':
self.compiler.AddToListVar('CDEFINES', '_LINUX')
self.compiler.AddToListVar('CDEFINES', 'POSIX')
if self.vendor == 'gcc':
self.compiler.AddToListVar('POSTLINKFLAGS', '-static-libgcc')
if self.vendor == 'clang':
self.compiler.AddToListVar('POSTLINKFLAGS', '-lgcc_eh')
elif AMBuild.target['platform'] == 'darwin':
self.compiler.AddToListVar('CDEFINES', 'OSX')
self.compiler.AddToListVar('CDEFINES', '_OSX')
self.compiler.AddToListVar('CDEFINES', 'POSIX')
self.compiler.AddToListVar('POSTLINKFLAGS', '-mmacosx-version-min=10.5')
self.compiler.AddToListVar('POSTLINKFLAGS', ['-arch', 'i386'])
self.compiler.AddToListVar('POSTLINKFLAGS', '-lstdc++')
# For OS X dylib versioning
import re
productFile = open(os.path.join(AMBuild.sourceFolder, 'product.version'), 'r')
productContents = productFile.read()
productFile.close()
m = re.match('(\d+)\.(\d+)\.(\d+).*', productContents)
if m == None:
self.version = '1.0.0'
else:
major, minor, release = m.groups()
self.version = '{0}.{1}.{2}'.format(major, minor, release)
AMBuild.cache.CacheVariable('version', self.version)
elif AMBuild.target['platform'] == 'windows':
self.compiler.AddToListVar('CDEFINES', 'WIN32')
self.compiler.AddToListVar('CDEFINES', '_WINDOWS')
@@ -154,14 +262,16 @@ class SM:
self.targetMap = { }
AMBuild.cache.CacheVariable('targetMap', self.targetMap)
else:
self.sdkInfo = AMBuild.cache['sdkInfo']
self.compiler.FromConfig(AMBuild, 'compiler')
self.targetMap = AMBuild.cache['targetMap']
self.hasMySql = AMBuild.cache['hasMySql']
if AMBuild.target['platform'] == 'windows':
self.compiler.AddToListVar('RCINCLUDES', os.path.join(AMBuild.sourceFolder, 'public'))
self.compiler.AddToListVar('RCINCLUDES',
os.path.join(AMBuild.outputFolder, 'includes'))
self.mmsPath = AMBuild.cache['MMSOURCE18']
self.mmsPath = AMBuild.cache['MMSOURCE110']
def DefaultCompiler(self):
return self.compiler.Clone()
@@ -186,10 +296,18 @@ class SM:
return compiler
def AutoVersion(self, folder, binary):
if AMBuild.target['platform'] != 'windows':
if AMBuild.target['platform'] == 'windows':
env = {'RCDEFINES': ['BINARY_NAME="' + binary.binaryFile + '"', 'SM_GENERATED_BUILD']}
binary.AddResourceFile(os.path.join(folder, 'version.rc' ), env)
elif AMBuild.target['platform'] == 'darwin' and isinstance(binary, Cpp.LibraryBuilder):
binary.compiler['POSTLINKFLAGS'].extend(['-compatibility_version', '1.0.0'])
binary.compiler['POSTLINKFLAGS'].extend(['-current_version', AMBuild.cache['version']])
else:
return
env = {'RCDEFINES': ['BINARY_NAME="' + binary.binaryFile + '"', 'SM_GENERATED_BUILD']}
binary.AddResourceFile(os.path.join(folder, 'version.rc' ), env)
def ExtractDebugInfo(self, job, binary):
src = os.path.join('..', AMBuild.outputFolder, job.workFolder, binary.binaryFile)
job.AddCommand(ExtractDebugInfoCommand(binary, src))
def PreSetupHL2Job(self, job, builder, sdk):
info = self.sdkInfo[sdk]
@@ -200,32 +318,63 @@ class SM:
else:
staticLibs = os.path.join(sdkPath, 'lib', 'linux')
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
if sdk == 'ep2v' or sdk == 'l4d2':
for i in ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.so', 'libtier0.so']:
link = os.path.join(workFolder, i)
target = os.path.join(staticLibs, i)
if sdk in ['css', 'hl2dm', 'dods', 'tf2', 'l4d2']:
libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib_srv.so', 'libtier0_srv.so']
for lib in libs:
link = os.path.join(workFolder, lib)
target = os.path.join(staticLibs, lib)
try:
os.lstat(link)
except:
job.AddCommand(SymlinkCommand(link, target))
elif sdk in ['l4d', 'nd', 'csgo']:
libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.so', 'libtier0.so']
if sdk == 'csgo':
libs.append('interfaces_i486.a')
for lib in libs:
link = os.path.join(workFolder, lib)
target = os.path.join(staticLibs, lib)
try:
os.lstat(link)
except:
job.AddCommand(SymlinkCommand(link, target))
else:
for i in ['tier1_i486.a', 'mathlib_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']:
link = os.path.join(workFolder, i)
target = os.path.join(staticLibs, i)
libs = ['tier1_i486.a', 'mathlib_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']
for lib in libs:
link = os.path.join(workFolder, lib)
target = os.path.join(staticLibs, lib)
try:
os.lstat(link)
except:
job.AddCommand(SymlinkCommand(link, target))
elif AMBuild.target['platform'] == 'darwin':
staticLibs = os.path.join(sdkPath, 'lib', 'mac')
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.dylib', 'libtier0.dylib']
if sdk == 'csgo':
libs.append('interfaces_i486.a')
for lib in libs:
link = os.path.join(workFolder, lib)
target = os.path.join(staticLibs, lib)
try:
os.lstat(link)
except:
job.AddCommand(SymlinkCommand(link, target))
elif AMBuild.target['platform'] == 'windows':
for lib in ['tier0', 'tier1', 'vstdlib', 'mathlib']:
libs = ['tier0', 'tier1', 'vstdlib', 'mathlib']
if sdk in ['swarm', 'csgo']:
libs.append('interfaces')
for lib in libs:
libPath = os.path.join(sdkPath, 'lib', 'public', lib) + '.lib'
builder.RebuildIfNewer(libPath)
builder['POSTLINKFLAGS'].append(libPath)
def PostSetupHL2Job(self, job, builder, sdk):
if AMBuild.target['platform'] == 'linux':
if AMBuild.target['platform'] in ['linux', 'darwin']:
builder.AddObjectFiles(['tier1_i486.a', 'mathlib_i486.a'])
if sdk == 'csgo':
builder.AddObjectFiles(['interfaces_i486.a'])
def DefaultHL2Compiler(self, path, sdk, noLink = False, oldMms = '-legacy'):
compiler = self.DefaultExtCompiler(path)
@@ -236,9 +385,12 @@ class SM:
compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms))
compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms, 'sourcehook'))
info = self.sdkInfo
info = self.possibleSdks
compiler['CDEFINES'].extend(['SE_' + info[i]['name'] + '=' + info[i]['def'] for i in info])
compiler['CDEFINES'].append('SE_DARKMESSIAH=2')
# We don't build for Portal 2 (yet?, ever?), but using this define in code as
# it saves trouble if we ever need to
compiler['CDEFINES'].append('SE_PORTAL2=14')
paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'],
['public', 'tier0'], ['public', 'tier1']]
@@ -247,6 +399,7 @@ class SM:
paths.append(['game_shared'])
else:
paths.append(['public', 'game', 'server'])
paths.append(['public', 'toolframework'])
paths.append(['game', 'shared'])
paths.append(['common'])
@@ -255,12 +408,20 @@ class SM:
compiler['CDEFINES'].append('SOURCE_ENGINE=' + info['def'])
if sdk in ['swarm','csgo']:
if AMBuild.target['platform'] == 'windows':
compiler['CDEFINES'].extend(['COMPILER_MSVC', 'COMPILER_MSVC32'])
else:
compiler['CDEFINES'].extend(['COMPILER_GCC'])
if sdk == 'ep1':
if AMBuild.target['platform'] == 'linux':
staticLibs = os.path.join(sdkPath, 'linux_sdk')
else:
if AMBuild.target['platform'] == 'linux':
staticLibs = os.path.join(sdkPath, 'lib', 'linux')
elif AMBuild.target['platform'] == 'darwin':
staticLibs = os.path.join(sdkPath, 'lib', 'mac')
for i in paths:
compiler['CXXINCLUDES'].append(os.path.join(sdkPath, *i))
@@ -268,14 +429,36 @@ class SM:
if not noLink:
if AMBuild.target['platform'] == 'linux':
compiler['POSTLINKFLAGS'][0:0] = ['-lm']
if sdk == 'ep2v' or sdk == 'l4d2':
if sdk in ['css', 'hl2dm', 'dods', 'tf2', 'l4d2']:
compiler['POSTLINKFLAGS'][0:0] = ['libtier0_srv.so']
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib_srv.so']
elif sdk in ['l4d', 'nd', 'csgo']:
compiler['POSTLINKFLAGS'][0:0] = ['libtier0.so']
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.so']
else:
compiler['POSTLINKFLAGS'][0:0] = ['tier0_i486.so']
compiler['POSTLINKFLAGS'][0:0] = ['vstdlib_i486.so']
compiler['POSTLINKFLAGS'][0:0] = ['vstdlib_i486.so']
elif AMBuild.target['platform'] == 'darwin':
compiler['POSTLINKFLAGS'][0:0] = ['libtier0.dylib']
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.dylib']
return compiler
def ResolveEnvPath(self, env, defaultDir):
if env in os.environ:
path = os.environ[env]
if os.path.isdir(path):
return path
else:
head = os.getcwd()
oldhead = None
while head != None and head != oldhead:
path = os.path.join(head, defaultDir)
if os.path.isdir(path):
return path
oldhead = head
head, tail = os.path.split(head)
return None
sm = SM()
globals = {
@@ -294,6 +477,7 @@ FileList = [
['extensions', 'curl', 'AMBuilder'],
['extensions', 'geoip', 'AMBuilder'],
['extensions', 'mysql', 'AMBuilder'],
['extensions', 'sdkhooks', 'AMBuilder'],
['extensions', 'sdktools', 'AMBuilder'],
['extensions', 'topmenus', 'AMBuilder'],
['extensions', 'updater', 'AMBuilder'],
@@ -303,9 +487,13 @@ FileList = [
['sourcepawn', 'jit', 'AMBuilder'],
['sourcepawn', 'compiler', 'AMBuilder'],
['plugins', 'AMBuilder'],
['tools', 'buildbot', 'PackageScript']
['tools', 'buildbot', 'PackageScript'],
['tools', 'buildbot', 'BreakpadSymbols']
]
if not sm.hasMySql:
FileList.remove(['extensions', 'mysql', 'AMBuilder'])
for parts in FileList:
AMBuild.Include(os.path.join(*parts), globals)
-1
View File
@@ -3,4 +3,3 @@ CONFIGURE YOUR IDENTITY FOR MERCURIAL!
IF YOU ARE A DEVELOPER WITH PUSH ACCESS, DO IT NOW KPLZTHX.
http://wiki.alliedmods.net/Mercurial_Tutorial#Identity
+494
View File
@@ -1,5 +1,499 @@
SourceMod Changelog
SourceMod 1.5.2 [2013-10-29]
URL: http://wiki.alliedmods.net/SourceMod_1.5.2_Release_Notes
User Changes:
- Updated gamedata support for TF2, CS:S, CS:GO, and HL2:DM.
- Fixed crash from regression in SDKTools SetClientListening hook refcounting (bug 5956) (KyleS).
- Fixed potential crash when having maps with format characters in name.
- Fixed some nextmap issues with long map names.
- SDKTools no longer requires gamedata for sm_dump_datamaps on TF2, CS:S, HL2:DM, and DoD:S (bug 5968).
Developer Changes:
- Updated TFCond and TF custom dmg enums.
- Updated TF2 critical hit detection logic in TF2_OnCalcIsAttackCritical to handle more cases, including when criticals are disabled (bug 5894).
- Fixed GetEngineVersion native returning a bad value when running on MM:S 1.9.x or earlier (bug 5697).
----------------------------------------------------------
SourceMod 1.5.1 [2013-09-10]
URL: http://wiki.alliedmods.net/SourceMod_1.5.1_Release_Notes
User Changes:
- Updated gamedata support for TF2.
- Added missing DispatchKeyValue gamedata for HL2 CTF (bug 5114) (peace-maker).
- Fixed translations not being loaded if identifier was not two or three characters (fixes Portuguese) (bug 5888).
- Fixed runoff voting occurring when receiving the exact number of required votes (bug 5890).
- Fixed reserve slot plugin hiding too many slots on Orangebox gamesif SourceTV and/or Replay are present (bug 5499).
- Fixed some crashes in TF2 and unexpected behavior in all games with SDKHook_TakeDamage due to uninitialized var.
- Fixed attempted triggers from gagged users displaying in chat (bug 5918).
- Fixed errors in Italian translation (Oktober).
- Added Norwegian translation (checkster).
Developer Changes:
- Added CS_UpdateClientModel native to CStrike extension for CS:S and CS:GO (bug 5905) (Drifter).
- Fixed setting weapon param in SDKHook_TakeDamage overwriting attacker instead of setting weapon (bug 5911) (KyleS)
----------------------------------------------------------
SourceMod 1.5.0 [2013-08-25]
URL: http://wiki.alliedmods.net/SourceMod_1.5.0_Release_Notes
User Changes:
- Added support for Counter-Strike: Global Offensive (bug 5299, bug 5579).
- Split CS:S, TF2, DoD:S, HL2:DM, and ND to separate binaries (bug 5370, bug 5813).
- Added support for runoff voting in mapchooser (bug 4218).
- Added option to require Steam validation before granting admin access (bug 4837) (VoiDeD).
- Added localization support for many more core and base plugin messages (bug 5120, bug 5146).
- Added the ability to override RegConsoleCommand-created commands (bug 5199).
- Added support for "fuzzy" (partial) map names in map-related natives and cmds for L4D and later (bug 5599).
- Updated Reserved Slots to use max humans as max count (bug 5444).
- Added support for custom maxitems on radio menus (bug 5371).
- Improved console config editing (bug 5470).
- Increased map name buffer sizes in mapchooser to better account for nested maps (bug 5609) (Peace-Maker).
- Fixed JIT conflicts with SELinux (bug 5581).
- Added logged error when PlayerRunCommand offset lookup fails (bug 5535) (GoD-Tony).
- Fixed double print when sending psay to self (bug 5649) (Peace-Maker).
- Fixed check against uninitialized string in extension loader (bug 5546) (KyleS).
- Fixed possible runtime errors in basetriggers for not-ingame clients (bug 5191) (Peace-Maker).
- Check all possible mapcycle paths on newer orangebox games (bug 5719).
- Fixed ReadMapList not seeing maps in all valve search paths (bug 5715) (VoiDeD).
- Fixed typo in too-many-params native error message (Peace-Maker).
- Fixed various issues in clientprefs (bug 5538) (KyleS).
- Removed debug printout from PerformGravity (bug 5679) (KyleS).
- Fixed broken translating in some plugins and natives (bug 5612) (KyleS).
- Fixed issues with COMMAND_FILTER_NO_BOTS and @bots multi-target.
- Fixed crash in SDKHooks when throwing bad ent type error on logical ent (KyleS).
Developer Changes:
- Added support for CS:GO to the CStrike extension (bug 5299) (Drifter).
- Added support for new protobuf usermessages used in newer games (bug 5579, bug 5588, bug 5590, bug 5633).
- Added latest SDKHooks version as first-party extension.
- Updated SQLite to version 3.7.15.1 (bug 5235).
- Added natives for changing team score and mvp stars on CSS/CSGO (bug 5295) (Drifter).
- Added global pre and post forwards for client chat (bug 5394) (KyleS).
- Added TF2_CanPlayerTeleport forward to the TF2 game extension (bug 5283) (VoiDeD).
- Added GetEntityAddress native (bug 5269) (ProdigySim).
- Added more parameters to PlayerRunCommand forward (bug 5346) (GoD-Tony).
- Added forwards to basecomm plugin (bug 5466) (Drifter).
- Added symbol lookup support to gamedata on Windows (bug 5511) (GoD-Tony).
- Exposed GetLanguageInfo in ITranslator interface (bug 5249) (VoiDeD).
- Increase maximum .sp line length to 4095 characters. (bug 5347) (theY4Kman).
- Improved netprop dump output (bug 5471).
- Added int64 typename to netprop dumps (bug 5655).
- Added GetMaxHumanPlayers native exposing IServerGameClients func (bug 5551).
- Added WeaponIDToAlias native to CStrike extension (bug 5460) (KyleS).
- Fixed OnLibraryAdded/Removed not being called in all plugins (bug 5431).
- Made thread worker processing limits configurable at runtime (bug 5326).
- Added support in TF2 ext for detection of player conds >= 64 (bug 5565).
- Updated button defines in entity_prop_stocks (bug 5564).
- Added GetPlayerResourceEntity to SDKTools to replace old, semi-broken TF2-only version (bug 5491).
- Exposed third parameter of TF2's AddCond in TF2_AddCondition (bug 5641) (FlaminSarge).
- Added GetSteamAccountID function to IPlayerHelpers and native for sp (bug 5548) (KyleS).
- Added ISDKHooks interface with entity listeners (bug 5602) (GoD-Tony).
- Added file upload support to webternet extension.
- Added more alternative names for TFClass_Heavy (bug 5338) (Afronanny).
- Throw error instead of crash when calling SetTeamScore between maps (bug 5718) (KyleS).
- Fixed clients not being marked as in kick queue in some cases (bug 5746) (SystematicMania).
- Made compile.sh set working dir to own dir (bug 5710) (KyleS).
- Added CS_IsValidWeaponID native and validity checks to other natives (bug 5566) (Drifter).
- Numerous code documentation fixups (bug 5720) (Tsunami).
- Fixed cmd listener callback return behavior to match func doc (bug 5882).
Internal Changes:
- Fixed handle misuse in clientprefs plugin (bug 5805) (KyleS).
- Removed call to getchar() in debug build of compiler (bug 5626) (KyleS).
- Fixed instability issues with cloned handles (bug 5245, bug 5240) (KyleS).
- Changed extension unload order to avoid exposing finalization window (bug 5556) (KyleS).
- Call OnPluginEnd before finalizer hooks have run (bug 4519).
- Fixed potential for reading out of library bounds in MemoryUtils::FindPattern.
- Fixed typo in TF2 ext asm.c causing accidental assignment instead of compare.
- Overhauled versioning information (bug 5453).
- Changed from RemoveEdict to using the Kill input for TF2_RemoveWeapon.
- Fixed accidental assignment in each of SDKTools and sp compiler (bug 5745) (KyleS).
- Fixed potential deadlock in HandleSystem::TryAndFreeSomeHandles (bug 5665) (KyleS).
----------------------------------------------------------
SourceMod 1.4.7 [2013-02-06]
URL: http://wiki.alliedmods.net/SourceMod_1.4.7_Release_Notes
User Changes:
- Updated support for latest Source 2009 engine changes (CS:S, DoD:S, TF2, HL2DM).
- Updated gamedata for Left 4 Dead 2, Nuclear Dawn, No More Room in Hell, Zombie Panic Source, CSPromod, GoldenEye Source, Synergy, The Hidden, and PVKII.
- Added system to block malware or illegal plugins (bug 5289).
- Fixed a potential crash when a bad entity index is passed to certain functions (bug 5539) (KyleS).
- Added an error message for when auto plugin configs fail to be created due to write error (bug 5465) (Drifter).
- Fixed an issue where a malformed plugin could cause crashes (bug 5478).
Developer Changes:
- Added new values to the TFCond TF2 conditions enum (bug 5537) (FlaminSarge).
- Updated TFHoliday TF2 holidays enum (bug 5526) (Powerlord).
- Fixed regression in SourceMod 1.3.0 causing GetEntPropEnt, GetEntDataEnt2, and GameRules_GetPropEnt to possibly return stale (incorrect) entity indexes in place of -1.
- Added support for < 32-bit unsigned sign extension to GameRules_GetProp lookup (already in GetEntProp since SM 1.4.0).
- Fixed < 32-bit unsigned sign extension in GetEntProp not being applied for array prop elements (bug 5591).
- Fixed value size auto-detection in GetEntProp and GameRules_GetProp for ep2v's new SPROP_VARINT sendprops.
- Fixed Sort_Random sort type not including first value in array sorting functions (bug 4292) (Peace-Maker).
- Fixed GameRules_SetPropVector writing data to unexpected addresses instead of to the gamerules proxy entity (bug 5592) (ProdigySim).
- Fixed VoteMenuToAll stock adding bots to list (bug 5253 (VoiDeD).
----------------------------------------------------------
SourceMod 1.4.6 [2012-09-04]
URL: http://wiki.alliedmods.net/SourceMod_1.4.6_Release_Notes
User Changes:
- Fixed extraneous errors resulting from a bug in 1.4.5.
----------------------------------------------------------
SourceMod 1.4.5 [2012-09-03]
URL: http://wiki.alliedmods.net/SourceMod_1.4.5_Release_Notes
User Changes:
- Updated support for latest Source 2009 engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
- Updated Nuclear Dawn, Dino D-Day, and Zombie Panic gamedata.
- Added compatibility for running on Metamod:Source 1.9.0.
- Fixed very minor memory leaks in CStrike extension (bug 5456) (KyleS).
- Fixed crash from plugins accessing netprops too early (bug 5297) (KyleS).
- Fixed crash from plugins trying to access nested datadesc members (bug 5446).
Developer Changes:
- Added new TF2 weapon and custom dmg defines.
- Added new TF2 TFHoliday value (bug 5436) (Powerlord).
- Fixed IClientListener::InterceptClientConnect not being able to properly block connections (bug 5461) (PimpinJuice).
- Fixed PrepSDKCall_SetSignature native not working with symbol names on L4D2 linux (bug 5440).
- Fixed resolution of GetProfilerTime native on non-Windows platforms.
-----------------------------
SourceMod 1.4.4 [2012-07-03]
URL: http://wiki.alliedmods.net/SourceMod_1.4.4_Release_Notes
User Changes:
- Updated support for latest Source 2009 engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
- Updated Nuclear Dawn gamedata.
- Fixed a crash that could occur when selecting an option on a clientprefs prefab menu (bug 5374).
Developer Changes:
- Added new TF2 weapon and custom dmg defines.
- Added new TF2 TFHoliday value (bug 5364) (Powerlord).
- Updated sample extension to properly fill ninvoke with INativeInvoker ptr (bug 5340) (Afronanny).
-----------------------------
SourceMod 1.4.3 [2012-06-09]
URL: http://wiki.alliedmods.net/SourceMod_1.4.3_Release_Notes
User Changes:
- Updated support for latest OrangeBox engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
- Made clientprefs attempt to reconnect to the database on map change (bug 4745).
- Log functions now respect sv_logecho (bug 5135).
- Fixed client console vote output (bug 5290, bug 5205) (FlaminSarge).
- Fixed error when reloading dependant plugins using aliased natives (bug 5302).
- Fixed intermittent crash when looking for an invalid signature (bug 5301).
- Fixed possible crash when reloading a plugin with an invalid binary (bug 5288).
- Exposed extensions list to clients (bug 5221) (VoiDeD).
- Fixed intermittent crashes in clientprefs (bug 4660).
- Fixed crash when passing an invalid entity reference to ReferenceToEntity (bug 5330).
- Fixed cstrike extension crash on shutdown (bug 5328).
- Lowered threading API think time to 20ms, making threaded MySQL queries complete faster (bug 4733).
Developer Changes:
- Fixed client serials not being unique on Windows (bug 5285).
- Fixed broken SourceTV detection on L4D1 (bug 5216).
- Fixed Float negation operator (bug 5292).
- Updated TF2 condition defines (bug 5259) (FlaminSarge).
- Adding missing SetMenuNoVoteButton native declaration (bug 4522) (GoD-Tony).
- Fixed erroneous const-qualification of name param of GetAdminUsername (bug 5267).
- Added GetGameTickCount native (bug 5209) (GoD-Tony).
-----------------------------
SourceMod 1.4.2 [2011-04-13]
URL: http://wiki.alliedmods.net/SourceMod_1.4.2_Release_Notes
User Changes:
- Updated support for latest OrangeBox engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
- Fixed regression in SourceMod 1.4.0 causing SM to cause load errors on The Ship (bug 5216).
- Fixed toggling and player lag issues with sm_drug command (bugs 5217, 5218) (FlaminSarge).
Developer Changes:
- Updated TF2-specific defines and enums (bug 5194).
- Fixed StoreToAddress always writing 32 bits and throwing an error (bug 5248) (ProdigySim).
- Fixed crash with StoreToAddress if memory wasn't writable (bug 5252) (Dr!fter).
- Fixed return value of VoteMenuToAll (bug 5254) (VoiDeD).
- Fixed bug in command lower-casing API guarantee
-----------------------------
SourceMod 1.4.1 [2011-12-07]
URL: http://wiki.alliedmods.net/SourceMod_1.4.1_Release_Notes
User Changes:
- Updated support for latest OrangeBox engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
- Added gamedata for Adrenaline Gamer 2 and No More Room in Hell.
- Fixed "not connected" error in reserve slots plugin (bug 5158) (ostrel).
- Fixed ff trigger output printing to all in triggerer's language (rather than viewer's language) (bug 5161).
- Fixed typo in one of basebans ban reasons (bug 5188).
- Fixed formatting error in Swedish "Vote Count" phrase (bug 5174).
Developer Changes:
- Fixed sp MaxClients not being updated on map changes after load (bug 5160).
- Removed GLIBC_2.7 dependency from spcomp.
- Increased buffer for sm_rcon command to fit larger responses (bug 5169).
- BaseComm now properly registers a library allowing it to be required by other plugins (bug 5156).
- Fixed TFHoliday enum values (bug 5155).
- Updated TF2_OnIsHolidayActive ret behavior to match doc (bug 5155).
- Added new TF2 deathflag and dmg custom defines (bug 5157).
-----------------------------
SourceMod 1.4.0 [2011-10-28]
URL: http://wiki.alliedmods.net/SourceMod_1.4.0_Release_Notes
User Changes:
- Added support for Max OS X (bug 4392).
- Added support for Bloody Good Time (bug 4780).
- Added support for E.Y.E Divine Cybermancy (bug 5035).
- Added gamedata for Nuclear Dawn.
- Added gamedata for International Online Soccer: Source (bug 5019).
- Added gamedata for Half-Life 2 Capture the Flag (bug 5114).
- Updated mapchooser and other base plugins with Nuclear Dawn specific fixes (bug 5117).
- Fixed ServerLang value not being read properly on startup (bug 4675).
- Added support for aliases in languages.cfg (bug 4858).
- Added output display to sm_rcon command (bug 5018).
- Flood protection bypass access can now be overridden with command name sm_flood_access (bug 4584).
- Added a reset argument to sm cvars command to revset cvar values to default (bug 5043).
- Fixed incorrect language identifiers for Chinese (both Trad. and Simplified) and Brazilian Portuguese not matching cl_language values (bug 5067).
- Added translation support for Bulgarian (bg).
- Fixed incorrect number of slots being hidden for reserve with sm_hideslots on Source 2009 with SourceTV or replay (bug 5094).
- sm_hideslots changes now take effect immediately instead of waiting until a client joins or leaves (bug 5094).
- Fixed sv_visiblemaxplayers getting stuck at previous max clients in some cases with reserves and SourceTV or replay (bug 5094).
- Removed error logging if an optional extension is not found (bug 5112).
- Fixed bots with semicolon in name being unkickable (bug 5120).
- Changed strings in ice-related funcommands to be translatable (bug 4540).
- Changed Bintools extension to use a single build for every engine (bug 4548).
Developer Changes:
- Provided native interface for basecomm (bug 2594).
- Client language detection is too late. (bug 3714) (Tony A. "GoD-Tony").
- Added ServerCommandEx native to execute server command and retrieve output (bug 3873).
- Added ability to update clientprefs cookies values on clients not currently connected (bug 3882) (databomb).
- Added library "matchmaking_ds" support to gamedata lookups (bug 4158).
- Rooted menu handles to callbacks (bug 4353).
- Fixed corner cases with ExplodeString (bug 4629). (Michael "LumiStance").
- Fixed return omission with else-after-return (bug 4852).
- Added OnConditionAdded and OnConditionRemoved forwards to TF2 extension (bug 4851).
- Added new natives and forward to the cstrike extension (bug 4732, bug 4985) (Dr!fter).
- Added WaitingForPlayers forwards to the TF2 extension (bug 4704) (CrimsonGT).
- Updated and added more TF2 condition, weapon, and damagecustom defines (multiple bug#s).
- Fixed TF2_RemoveCondition not always removing conditions (bug 4981).
- Fixed MaxClients not being updated correctly in some places with SourceTV or replay active (bug 4986).
- Fixed some vars not being marked for init on first compile pass (bug 4643).
- Increased symbol name limit to 63 characters (bug 4564) (javalia).
- Fixed crash when dynamic arrays run out of memory (bug 4632).
- Fixed a crash that could happen from looking up out-of-bounds edict or entity indexes (bug 5080).
- Fixed client serials not getting cleared on disconnect (bug 5121).
- Added error on declaring arrays that the compiler is too buggy to handle (bug 4977).
- Removed reliance on gamedata for multiple SDKTools functions in ep2 and later (bug 4899).
- Added InvalidateClient and ReconnectClient natives to SDKTools (bug 4931) (Brian "Afronanny" Simon).
- Added ability to lookup and set values on the gamerules class (bug 4983.
- BaseComm now uses AddCommandListener for chat hooks (bug 4991).
- Fixed shutdown bug in SDKTools (bug 5063).
- Fixed MM-enabled extensions continuing to load after failing MM attach (bug 5042).
- Added GetDistGainFromSoundLevel native to SDKTools (bug 5066) (javalia).
- Added CheckAccess native to check an AdminId's command access (bug 5083).
- Fixed GetEntProp not sign-extending unsigned values less than 32 bits (bug 5105).
- Fixed crashing when calling CreateEntityByName or CreateFakeClient when no map is running (now errors) (bug 5119).
- Fixed erring in kick function (e. bad translation) causing client to become unkickable until disconnect (bug 5120).
- Fixed KickClientEx not immediately kicking client if client was in kick queue (bug 5120).
- Added IsClientSourceTV and IsClientReplay natives (bug 5124).
- Added support for getting and setting individual array elements with Get/Set EntProp functions (bug 4160).
- Added support for threaded query handles to SQL_GetInsertId and SQL_GetAffectedRows (bug 4699) (Nephyrin).
- Added a GetGameRules function to ISDKTools for extensions to easily get the GameRules class pointer (bug 4707).
- Added GetMessageName to IUserMessages (bug 4573) (Zach "theY4Kman" Kanzler)
- Added HintTextMsg to IGameHelpers (bug 4950).
- Added ProcessTargetString simple filter API (bug 4404).
- Moved much functionality from core bins to logic bin (bug 4406, bug 4402).
- Fixed bogus asserts in sp compiler (bug 4486, bug 4487).
- Greatly improved sp compiler performance (~5x overall speedup) (bug 3820, bug 4493, bug 4495).
- Changed entity output detours to use CDetour (bug 4416).
- Enhanced nominations API (bug 4677) (CrimsonGT).
- Added Linux support for profiling natives (bug 4927).
- Added a new ValveCallType that allows for arbitrary |this| parameters, as well as associated features in gamedata and for reading/writing memory (bug 3520) (Downtown1).
- Updated TF2 extension to handle Valve's changes to the "holiday" system (bug 5150).
-----------------------------
SourceMod 1.3.8 [2011-06-23]
URL: http://wiki.alliedmods.net/SourceMod_1.3.8_Release_Notes
User Changes:
- Updated support for latest OrangeBox engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
- Updated support for various games, including Garry's Mod, Zombie Panic, and Dino D-Day.
- Added gamedata for Eternal Silence.
- Fixed libgcc_s.so.1 load error present on some systems (bug 4876).
- Handle leak notices now print to error log (in addition fatal log) (bug 4929).
- Translator now properly falls back on bad server language (bug 4861).
- Fixed invalid client errors from bad MaxClients value when SourceTV is late-loaded (bug 4881).
- Fixed crash on plugin unload when two commands exist with same name, different casing (bug 4698).
Developer Changes:
- Updated TF2 condition defines (bug 4916).
- Fixed var names and docs for TF2_MakeBleed native (bug 4928).
- Removed compiler double include check (bug 4863).
- Fixed plugin compile errors when using GetEntityClassname (bug 4798).
---------------------------
SourceMod 1.3.7 [2011-04-15]
URL: http://wiki.alliedmods.net/SourceMod_1.3.7_Release_Notes
User Changes:
- Updated support for latest OrangeBox engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
- Updated support for various games, including Zombie Panic, CS ProMod, Empires, and GoldenEye: Source.
- Added gamedata for Dino D-Day.
- Fix precedence of voice mute flag versus specific client overrides (bug 4826).
- Fix mistaken unhooking of voice hooks (bug 4804).
- Fixed graphical glitches with funcommands effects in L4D1 (bug 3486).
- Fixed bug in nominations that could cause "Unknown command" error (bug 4797).
- Removed tv_enable hook to fix rare max client count issue (bug 4791).
- Added missing unhooking of ClientConnect in PlayerManager (bug 4749).
- Fixed sm_rtv printing "unknown command" (bug 4730).
- Fixed voting crash when client console, chat, and SourceTV are enabled (bug 4676).
- Fixed CDetour crash in TF2 extension when last plugin using forward is unloaded (bug 4713).
Developer Changes:
- SetEntProp now marks edict state as changed (bug 4855).
- Added GetEntityClassname stock (bug 4798).
- Fix compiler hanging when #including a directory (bug 4822).
- Added GetEntityFlags and SetEntityFlags natives for better cross-engine compatibility. (bug 4809).
- Fixed ClientPrefs natives not being marked optional when REQUIRE_EXTENSIONS not defined (bug 4839).
- Changed some instances of LogMessage to LogAction (bug 4649).
- Added some new language natives (bug 4613).
- Fixed SetTeamScore not updating score on client (bug 2736).
- Raised MAXPLAYERS from 64 to 65 (bug 4490).
- Added and updated many TF2-specific defines in tf2.inc and tf2_stocks.inc.
- Fixed TF2_GetPlayerConditionFlags no longer necessarily returning all set flags (bug 4726).
- Fixed profiler flush not clearing, added 'report' and 'clear' (bug 4674).
- Fixed GetPlayerDecalFile crash on L4D and L4D2 (bug 4729).
- Fixed TF2_OnGetHoliday detour no longer firing under all circumstances (bug 4700).
- Added TF2_IsPlayerInDuel native to TF2 extension (bug 4695).
----------------------------
SourceMod 1.3.6 [2010-10-31]
URL: http://wiki.alliedmods.net/SourceMod_1.3.6_Release_Notes
User Changes:
- Updated support for latest Left 4 Dead 1 (bug 4681).
Developer Changes:
- Updated TF2 custom kill defines (bug 4682).
----------------------------
SourceMod 1.3.5 [2010-10-17]
URL: http://wiki.alliedmods.net/SourceMod_1.3.5_Release_Notes
User Changes:
- Updated support for CS:S, Garry's Mod, DoD:S, TF2, HL2DM.
- Added support for Firearms: Source (bug 4537).
- Added support for Fistful of Frags (bug 3883).
- Added support for Alien Swarm (bug 4530).
- Fixed living players hearing dead players if alltalk is disabled while deadtalk is on (bug 4533, thanks Zach Callear).
- Fixed timeleft not getting reset on Game_Commencing in CS:S (bug 4557).
- Fixed PlayerRunCmd being hooked when not used (bug 3990).
- Fixed errors and missing effects caused by missing sprites on L4D2 (bug 4512).
- Fixed 'sm plugins' public command skipping plugins in recommended listing (bug 4501).
- Fixed corruption with large database.cfg files (bug 4286).
Developer Changes:
- Added TF2 object stocks (bug 4536).
- Added TF2_MakeBleed native to TF2 ext (bug 4542).
- Added support for logical entities in Synergy (bug 4534).
- Updated TF2 conditions enum and defines (bug 4526).
- Fixed potential crash with IMemUtils::FindPattern on Linux (bug 4554).
----------------------------
SourceMod 1.3.4 [2010-07-18]
URL: http://wiki.alliedmods.net/SourceMod_1.3.4_Release_Notes
User Changes:
- Support for latest TF update (bug 4506).
- Support for latest L4D2 update (bug 4509).
Developer Changes:
- Added FindFlagChar native (bug 3776).
- Added GetConVarDefault native (bug 4502).
- Added forward for TF's GetHoliday function (bug 4462).
----------------------------
SourceMod 1.3.3 [2010-06-23]
URL: http://wiki.alliedmods.net/SourceMod_1.3.3_Release_Notes
User Changes:
- Added support for CS:S on Orange Box
- Added gamedata for Resistance and Liberation (bug 4418).
- Updated gamedata for SourceForts, Empires, Obsidian Conflict, Zombie Master.
- Fixed memory corruption and leaks with some voice functionality (bug 4415).
- Fixed UI bug in sm_motd (bug 4460).
Developer Changes:
- Added new player condition (TFCond_CritCola, bug 4447).
- Fixed clientprefs deleting cookies twice in rare cases (bug 4412).
- Fixed OnClientConnected forward not firing for bots (bug 4443).
- Fixed sm_dump_datamaps crash (bug 4424).
- Fixed switch case comparisons failing with large numbers (bug 4457).
- Fixed rare crash in output hooks (bug 4422).
- Fixed bug with dynamically sized arrays being sliced (bug 4428).
- Fixed SendConVarValue() on TF2, DOD:S, L4D, and L4D2 (bug 4273).
- Fixed TF2 natives not being marked optional (bug 4389).
----------------------------
SourceMod 1.3.2 [2010-05-02]
+18
View File
@@ -107,4 +107,22 @@
* Currently this will log details about the gamedata updating process.
*/
"DebugSpew" "no"
/**
* If set to yes, SourceMod will validate steamid auth strings with the Steam backend before giving out admin access.
* This can prevent malicious users from impersonating admins with stolen Steam apptickets.
* If Steam is down, admins will not be authenticated until Steam comes back up.
* This option increases the security of your server, but is still experimental.
*/
"SteamAuthstringValidation" "no"
/**
* Enables or disables whether SourceMod blocks known or potentially malicious plugins from loading.
* It is STRONGLY advised that this is left enabled, there have been cases in the past with plugins that
* allow anyone to delete files on the server, gain full rcon control, etc.
*
* "yes" - Block malware or illegal plugins from loading (default)
* "no" - Warn about malware or illegal plugins loading
*/
"BlockBadPlugins" "yes"
}
+2
View File
@@ -2,6 +2,8 @@
{
"driver_default" "mysql"
// When specifying "host", you may use an IP address, a hostname, or a socket file path
"default"
{
"driver" "default"
+5
View File
@@ -7,4 +7,9 @@ run.options.add_option('--enable-debug', action='store_const', const='1', dest='
help='Enable debugging symbols')
run.options.add_option('--enable-optimize', action='store_const', const='1', dest='opt',
help='Enable optimization')
run.options.add_option('--no-mysql', action='store_false', default=True, dest='hasMySql',
help='Disable building MySQL extension')
run.options.add_option('-s', '--sdks', default='all', dest='sdks',
help='Build against specified SDKs; valid args are "all", "present", or '
'comma-delimited list of engine names (default: %default)')
run.Configure(sys.path[0])
+54 -16
View File
@@ -1,39 +1,68 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os
from ambuild.command import SymlinkCommand
for i in SM.sdkInfo:
sdk = SM.sdkInfo[i]
if AMBuild.target['platform'] not in sdk['platform']:
continue
name = 'sourcemod.' + sdk['ext']
compiler = SM.DefaultHL2Compiler('core', i)
if i == 'csgo':
# Protobuf 2.3 headers have some signed/unsigned compares. I believe that it's fixed in later versions, but Valve.
if isinstance(compiler.cxx, Cpp.CompatGCC):
compiler.AddToListVar('CFLAGS', '-Wno-sign-compare')
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'common', 'protobuf-2.3.0', 'src'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'engine', 'protobuf'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'game', 'shared', 'csgo', 'protobuf'))
extension = AMBuild.AddJob(name)
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
SM.PreSetupHL2Job(extension, binary, i)
if i == 'csgo':
if AMBuild.target['platform'] == 'linux':
link = os.path.join(os.path.join(AMBuild.outputFolder, extension.workFolder), 'libprotobuf.a')
target = os.path.join(os.path.join(AMBuild.cache[sdk['sdk']], 'lib', 'linux32', 'release'), 'libprotobuf.a')
try:
os.lstat(link)
except:
extension.AddCommand(SymlinkCommand(link, target))
elif AMBuild.target['platform'] == 'darwin':
link = os.path.join(os.path.join(AMBuild.outputFolder, extension.workFolder), 'libprotobuf.a')
target = os.path.join(os.path.join(AMBuild.cache[sdk['sdk']], 'lib', 'osx32', 'release'), 'libprotobuf.a')
try:
os.lstat(link)
except:
extension.AddCommand(SymlinkCommand(link, target))
elif AMBuild.target['platform'] == 'windows':
libPath = os.path.join(AMBuild.cache[sdk['sdk']], 'lib', 'win32', 'release', 'vs2010', 'libprotobuf.lib')
binary.RebuildIfNewer(libPath)
binary['POSTLINKFLAGS'].append(libPath)
files = [
'AdminCache.cpp',
'ExtensionSys.cpp',
'MenuStyle_Valve.cpp',
'sm_crc32.cpp',
'logic_bridge.cpp',
'smn_entities.cpp',
'sm_stringutil.cpp',
'ADTFactory.cpp',
'ForwardSys.cpp',
'MenuVoting.cpp',
'sm_memtable.cpp',
'smn_events.cpp',
'smn_menus.cpp',
'sm_trie.cpp',
'CDataPack.cpp',
'frame_hooks.cpp',
'NativeInvoker.cpp',
'smn_admin.cpp',
'smn_fakenatives.cpp',
'smn_nextmap.cpp',
'sourcemm_api.cpp',
'ChatTriggers.cpp',
'GameConfigs.cpp',
'NativeOwner.cpp',
'smn_filesystem.cpp',
'smn_player.cpp',
@@ -41,28 +70,18 @@ for i in SM.sdkInfo:
'concmd_cleaner.cpp',
'HalfLife2.cpp',
'NextMap.cpp',
'smn_profiler.cpp',
'ConCmdManager.cpp',
'HandleSys.cpp',
'PhraseCollection.cpp',
'ConVarManager.cpp',
'LibrarySys.cpp',
'PlayerManager.cpp',
'smn_banning.cpp',
'smn_gameconfigs.cpp',
'smn_string.cpp',
'TimerSys.cpp',
'CoreConfig.cpp',
'Logger.cpp',
'PluginInfoDatabase.cpp',
'smn_bitbuffer.cpp',
'smn_halflife.cpp',
'Translator.cpp',
'MemoryUtils.cpp',
'PluginSys.cpp',
'smn_console.cpp',
'smn_handles.cpp',
'smn_timers.cpp',
'UserMessages.cpp',
'Database.cpp',
'MenuManager.cpp',
@@ -78,13 +97,32 @@ for i in SM.sdkInfo:
'EventManager.cpp',
'MenuStyle_Radio.cpp',
'sm_autonatives.cpp',
'smn_datapacks.cpp',
'smn_lang.cpp',
'sm_srvcmds.cpp',
'ConsoleDetours.cpp'
]
if i == 'csgo':
files.append('smn_protobuf.cpp')
else:
files.append('smn_bitbuffer.cpp')
binary.AddSourceFiles('core', files)
if i == 'csgo':
files = [
os.path.join('public', 'engine', 'protobuf', 'netmessages.pb.cc'),
os.path.join('public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessages.pb.cc'),
os.path.join('public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessage_helpers.cpp'),
]
binary.AddSourceFiles(AMBuild.cache[sdk['sdk']], files)
SM.PostSetupHL2Job(extension, binary, i)
if i == 'csgo':
if AMBuild.target['platform'] in ['linux', 'darwin']:
binary.AddObjectFiles(['libprotobuf.a'])
SM.AutoVersion('core', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
+2 -2
View File
@@ -1719,7 +1719,7 @@ bool AdminCache::CanAdminUseCommand(int client, const char *cmd)
}
}
return g_ConCmds.CheckCommandAccess(client, cmd, bits);
return g_ConCmds.CheckClientCommandAccess(client, cmd, bits);
}
unsigned int AdminCache::SetGroupImmunityLevel(GroupId gid, unsigned int level)
@@ -1794,7 +1794,7 @@ bool AdminCache::CheckAccess(int client, const char *cmd, FlagBits flags, bool o
GetCommandOverride(cmd, Override_Command, &bits);
}
return g_ConCmds.CheckCommandAccess(client, cmd, bits) ? 1 : 0;
return g_ConCmds.CheckClientCommandAccess(client, cmd, bits) ? 1 : 0;
}
void iterator_glob_basic_override(Trie *pTrie, const char *key, void **value, void *data)
+132 -61
View File
@@ -34,8 +34,8 @@
#include "sm_stringutil.h"
#include "ConCmdManager.h"
#include "PlayerManager.h"
#include "Translator.h"
#include "HalfLife2.h"
#include "logic_bridge.h"
/* :HACKHACK: We can't SH_DECL here because ConCmdManager.cpp does.
* While the OB build only runs on MM:S 1.6.0+ (SH 5+), the older one
@@ -59,13 +59,17 @@ ChatTriggers g_ChatTriggers;
bool g_bSupressSilentFails = false;
ChatTriggers::ChatTriggers() : m_pSayCmd(NULL), m_bWillProcessInPost(false),
m_bTriggerWasSilent(false), m_ReplyTo(SM_REPLY_CONSOLE)
m_ReplyTo(SM_REPLY_CONSOLE)
{
m_PubTrigger = sm_strdup("!");
m_PrivTrigger = sm_strdup("/");
m_PubTriggerSize = 1;
m_PrivTriggerSize = 1;
m_bIsChatTrigger = false;
m_bPluginIgnored = false;
#if SOURCE_ENGINE == SE_EPISODEONE
m_bIsINS = false;
#endif
}
ChatTriggers::~ChatTriggers()
@@ -109,11 +113,13 @@ void ChatTriggers::OnSourceModAllInitialized()
{
m_pShouldFloodBlock = g_Forwards.CreateForward("OnClientFloodCheck", ET_Event, 1, NULL, Param_Cell);
m_pDidFloodBlock = g_Forwards.CreateForward("OnClientFloodResult", ET_Event, 2, NULL, Param_Cell, Param_Cell);
m_pOnClientSayCmd = g_Forwards.CreateForward("OnClientSayCommand", ET_Event, 3, NULL, Param_Cell, Param_String, Param_String);
m_pOnClientSayCmd_Post = g_Forwards.CreateForward("OnClientSayCommand_Post", ET_Ignore, 3, NULL, Param_Cell, Param_String, Param_String);
}
void ChatTriggers::OnSourceModAllInitialized_Post()
{
g_pCorePhrases->AddPhraseFile("antiflood.phrases");
logicore.AddCorePhraseFile("antiflood.phrases");
}
void ChatTriggers::OnSourceModGameInitialized()
@@ -131,23 +137,62 @@ void ChatTriggers::OnSourceModGameInitialized()
SH_ADD_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayTeamCmd, this, &ChatTriggers::OnSayCommand_Pre, false);
SH_ADD_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayTeamCmd, this, &ChatTriggers::OnSayCommand_Post, true);
}
#if SOURCE_ENGINE == SE_EPISODEONE
m_bIsINS = (strcmp(g_SourceMod.GetGameFolderName(), "insurgency") == 0);
if (m_bIsINS)
{
m_pSay2Cmd = FindCommand("say2");
if (m_pSay2Cmd)
{
SH_ADD_HOOK(ConCommand, Dispatch, m_pSay2Cmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
SH_ADD_HOOK(ConCommand, Dispatch, m_pSay2Cmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
}
}
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
m_pSaySquadCmd = FindCommand("say_squad");
if (m_pSaySquadCmd)
{
SH_ADD_HOOK(ConCommand, Dispatch, m_pSaySquadCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
SH_ADD_HOOK(ConCommand, Dispatch, m_pSaySquadCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
}
#endif
}
void ChatTriggers::OnSourceModShutdown()
{
if (m_pSayTeamCmd)
{
SH_REMOVE_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayTeamCmd, this, &ChatTriggers::OnSayCommand_Post, true);
SH_REMOVE_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayTeamCmd, this, &ChatTriggers::OnSayCommand_Pre, false);
}
if (m_pSayCmd)
{
SH_REMOVE_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayCmd, this, &ChatTriggers::OnSayCommand_Post, true);
SH_REMOVE_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayCmd, this, &ChatTriggers::OnSayCommand_Pre, false);
}
if (m_pSayTeamCmd)
{
SH_REMOVE_HOOK(ConCommand, Dispatch, m_pSayTeamCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
SH_REMOVE_HOOK(ConCommand, Dispatch, m_pSayTeamCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
}
#if SOURCE_ENGINE == SE_EPISODEONE
if (m_bIsINS && m_pSay2Cmd)
{
SH_REMOVE_HOOK(ConCommand, Dispatch, m_pSay2Cmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
SH_REMOVE_HOOK(ConCommand, Dispatch, m_pSay2Cmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
}
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
if (m_pSaySquadCmd)
{
SH_REMOVE_HOOK(ConCommand, Dispatch, m_pSaySquadCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
SH_REMOVE_HOOK(ConCommand, Dispatch, m_pSaySquadCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
}
#endif
g_Forwards.ReleaseForward(m_pShouldFloodBlock);
g_Forwards.ReleaseForward(m_pDidFloodBlock);
g_Forwards.ReleaseForward(m_pOnClientSayCmd);
g_Forwards.ReleaseForward(m_pOnClientSayCmd_Post);
}
#if SOURCE_ENGINE >= SE_ORANGEBOX
@@ -158,24 +203,10 @@ void ChatTriggers::OnSayCommand_Pre()
{
CCommand command;
#endif
int client;
CPlayer *pPlayer;
client = g_ConCmds.GetCommandClient();
int client = g_ConCmds.GetCommandClient();
m_bIsChatTrigger = false;
m_bWasFloodedMessage = false;
/* The server console cannot do this */
if (client == 0 || (pPlayer = g_Players.GetPlayerByIndex(client)) == NULL)
{
RETURN_META(MRES_IGNORED);
}
/* We guarantee the client is connected */
if (!pPlayer->IsConnected())
{
RETURN_META(MRES_IGNORED);
}
m_bPluginIgnored = false;
const char *args = command.ArgS();
@@ -184,22 +215,38 @@ void ChatTriggers::OnSayCommand_Pre()
RETURN_META(MRES_IGNORED);
}
/* Save these off for post hook as the command data returned from the engine in older engine versions
* can be NULL, despite the data still being there and valid. */
m_Arg0Backup = command.Arg(0);
m_ArgSBackup = command.ArgS();
/* The server console cannot do this */
if (client == 0)
{
cell_t res = CallOnClientSayCommand(client);
if (res >= Pl_Handled)
{
m_bPluginIgnored = (res >= Pl_Stop);
RETURN_META(MRES_SUPERCEDE);
}
RETURN_META(MRES_IGNORED);
}
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
/* We guarantee the client is connected */
if (!pPlayer || !pPlayer->IsConnected())
{
RETURN_META(MRES_IGNORED);
}
/* Check if we need to block this message from being sent */
if (ClientIsFlooding(client))
{
char buffer[128];
if (!CoreTranslate(
buffer,
sizeof(buffer),
"%T",
2,
NULL,
"Flooding the server",
&client))
{
if (!logicore.CoreTranslate(buffer, sizeof(buffer), "%T", 2, NULL, "Flooding the server", &client))
UTIL_Format(buffer, sizeof(buffer), "You are flooding the server!");
}
/* :TODO: we should probably kick people who spam too much. */
@@ -220,6 +267,13 @@ void ChatTriggers::OnSayCommand_Pre()
is_quoted = true;
}
#if SOURCE_ENGINE == SE_EPISODEONE
if (m_bIsINS && strcmp(m_Arg0Backup, "say2") == 0 && strlen(args) >= 4)
{
args += 4;
}
#endif
bool is_trigger = false;
bool is_silent = false;
@@ -236,38 +290,28 @@ void ChatTriggers::OnSayCommand_Pre()
args = &args[m_PrivTriggerSize];
}
if (!is_trigger)
{
RETURN_META(MRES_IGNORED);
}
/**
* Test if this is actually a command!
*/
if (!PreProcessTrigger(PEntityOfEntIndex(client), args, is_quoted))
if (is_trigger && PreProcessTrigger(PEntityOfEntIndex(client), args, is_quoted))
{
CPlayer *pPlayer;
if (is_silent
&& g_bSupressSilentFails
&& client != 0
&& (pPlayer = g_Players.GetPlayerByIndex(client)) != NULL
&& pPlayer->GetAdminId() != INVALID_ADMIN_ID)
{
RETURN_META(MRES_SUPERCEDE);
}
RETURN_META(MRES_IGNORED);
m_bIsChatTrigger = true;
/**
* We'll execute it in post.
*/
m_bWillProcessInPost = true;
}
m_bIsChatTrigger = true;
cell_t res = CallOnClientSayCommand(client);
/**
* We'll execute it in post.
*/
m_bWillProcessInPost = true;
m_bTriggerWasSilent = is_silent;
if (res >= Pl_Handled)
{
m_bPluginIgnored = (res >= Pl_Stop);
RETURN_META(MRES_SUPERCEDE);
}
/* If we're silent, block */
if (is_silent)
if (is_silent && (m_bIsChatTrigger || (g_bSupressSilentFails && pPlayer->GetAdminId() != INVALID_ADMIN_ID)))
{
RETURN_META(MRES_SUPERCEDE);
}
@@ -282,19 +326,33 @@ void ChatTriggers::OnSayCommand_Post(const CCommand &command)
void ChatTriggers::OnSayCommand_Post()
#endif
{
m_bIsChatTrigger = false;
m_bWasFloodedMessage = false;
int client = g_ConCmds.GetCommandClient();
if (m_bWillProcessInPost)
{
/* Reset this for re-entrancy */
m_bWillProcessInPost = false;
/* Execute the cached command */
int client = g_ConCmds.GetCommandClient();
unsigned int old = SetReplyTo(SM_REPLY_CHAT);
serverpluginhelpers->ClientCommand(PEntityOfEntIndex(client), m_ToExecute);
SetReplyTo(old);
}
if (m_bPluginIgnored)
{
m_bPluginIgnored = false;
}
else if (!m_bWasFloodedMessage && !m_bIsChatTrigger && m_pOnClientSayCmd_Post->GetFunctionCount() != 0)
{
m_pOnClientSayCmd_Post->PushCell(client);
m_pOnClientSayCmd_Post->PushString(m_Arg0Backup);
m_pOnClientSayCmd_Post->PushString(m_ArgSBackup);
m_pOnClientSayCmd_Post->Execute(NULL);
}
m_bIsChatTrigger = false;
m_bWasFloodedMessage = false;
}
bool ChatTriggers::PreProcessTrigger(edict_t *pEdict, const char *args, bool is_quoted)
@@ -371,6 +429,19 @@ bool ChatTriggers::PreProcessTrigger(edict_t *pEdict, const char *args, bool is_
return true;
}
cell_t ChatTriggers::CallOnClientSayCommand(int client)
{
cell_t res = Pl_Continue;
if (!m_bIsChatTrigger && m_pOnClientSayCmd->GetFunctionCount() != 0)
{
m_pOnClientSayCmd->PushCell(client);
m_pOnClientSayCmd->PushString(m_Arg0Backup);
m_pOnClientSayCmd->PushString(m_ArgSBackup);
m_pOnClientSayCmd->Execute(&res);
}
return res;
}
unsigned int ChatTriggers::SetReplyTo(unsigned int reply)
{
unsigned int old = m_ReplyTo;
+14 -1
View File
@@ -69,21 +69,34 @@ public:
private:
bool PreProcessTrigger(edict_t *pEdict, const char *args, bool is_quoted);
bool ClientIsFlooding(int client);
cell_t CallOnClientSayCommand(int client);
private:
ConCommand *m_pSayCmd;
ConCommand *m_pSayTeamCmd;
#if SOURCE_ENGINE == SE_EPISODEONE
ConCommand *m_pSay2Cmd;
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
ConCommand *m_pSaySquadCmd;
#endif
char *m_PubTrigger;
size_t m_PubTriggerSize;
char *m_PrivTrigger;
size_t m_PrivTriggerSize;
bool m_bWillProcessInPost;
bool m_bTriggerWasSilent;
bool m_bIsChatTrigger;
bool m_bWasFloodedMessage;
bool m_bPluginIgnored;
unsigned int m_ReplyTo;
char m_ToExecute[300];
const char *m_Arg0Backup;
const char *m_ArgSBackup;
IForward *m_pShouldFloodBlock;
IForward *m_pDidFloodBlock;
IForward *m_pOnClientSayCmd;
IForward *m_pOnClientSayCmd_Post;
#if SOURCE_ENGINE == SE_EPISODEONE
bool m_bIsINS;
#endif
};
extern ChatTriggers g_ChatTriggers;
+47 -92
View File
@@ -34,9 +34,9 @@
#include "AdminCache.h"
#include "sm_stringutil.h"
#include "PlayerManager.h"
#include "Translator.h"
#include "HalfLife2.h"
#include "ChatTriggers.h"
#include "logic_bridge.h"
ConCmdManager g_ConCmds;
@@ -226,30 +226,38 @@ void ConCmdManager::SetCommandClient(int client)
m_CmdClient = client + 1;
}
ConCmdInfo *ConCmdManager::FindInTrie(const char *name)
{
ConCmdInfo *pInfo;
if (!sm_trie_retrieve(m_pCmds, name, (void **)&pInfo))
return NULL;
return pInfo;
}
ConCmdList::iterator ConCmdManager::FindInList(const char *cmd)
{
List<ConCmdInfo *>::iterator iter = m_CmdList.begin();
while (iter != m_CmdList.end())
{
if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
break;
iter++;
}
return iter;
}
ResultType ConCmdManager::DispatchClientCommand(int client, const char *cmd, int args, ResultType type)
{
ConCmdInfo *pInfo;
if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
if ((pInfo = FindInTrie(cmd)) == NULL)
{
List<ConCmdInfo *>::iterator iter;
pInfo = NULL;
iter = m_CmdList.begin();
while (iter != m_CmdList.end())
{
if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
{
pInfo = (*iter);
break;
}
iter++;
}
if (pInfo == NULL)
{
ConCmdList::iterator item = FindInList(cmd);
if (item == m_CmdList.end())
return type;
}
pInfo = *item;
}
cell_t result = type;
@@ -314,35 +322,20 @@ void ConCmdManager::InternalDispatch(const CCommand &command)
*/
const char *cmd = g_HL2.CurrentCommandName();
ConCmdInfo *pInfo;
if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
ConCmdInfo *pInfo = FindInTrie(cmd);
if (pInfo == NULL)
{
/* Unfortunately, we now have to do a slow lookup because Valve made client commands
* case-insensitive. We can't even use our sortedness.
*/
if (client == 0 && !engine->IsDedicatedServer())
{
return;
}
List<ConCmdInfo *>::iterator iter;
ConCmdList::iterator item = FindInList(cmd);
if (item == m_CmdList.end())
return;
pInfo = NULL;
iter = m_CmdList.begin();
while (iter != m_CmdList.end())
{
if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
{
pInfo = (*iter);
break;
}
iter++;
}
if (pInfo == NULL)
{
return;
}
pInfo = *item;
}
/* This is a hack to prevent say triggers from firing on messages that were
@@ -457,7 +450,7 @@ void ConCmdManager::InternalDispatch(const CCommand &command)
}
}
bool ConCmdManager::CheckCommandAccess(int client, const char *cmd, FlagBits cmdflags)
bool ConCmdManager::CheckClientCommandAccess(int client, const char *cmd, FlagBits cmdflags)
{
if (cmdflags == 0 || client == 0)
{
@@ -478,7 +471,11 @@ bool ConCmdManager::CheckCommandAccess(int client, const char *cmd, FlagBits cmd
return false;
}
AdminId adm = player->GetAdminId();
return CheckAdminCommandAccess(player->GetAdminId(), cmd, cmdflags);
}
bool ConCmdManager::CheckAdminCommandAccess(AdminId adm, const char *cmd, FlagBits cmdflags)
{
if (adm != INVALID_ADMIN_ID)
{
FlagBits bits = g_Admins.GetAdminFlags(adm, Access_Effective);
@@ -531,7 +528,7 @@ bool ConCmdManager::CheckCommandAccess(int client, const char *cmd, FlagBits cmd
bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmin)
{
if (CheckCommandAccess(client, cmd, pAdmin->eflags))
if (CheckClientCommandAccess(client, cmd, pAdmin->eflags))
{
return true;
}
@@ -540,7 +537,7 @@ bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmi
/* If we got here, the command failed... */
char buffer[128];
if (!CoreTranslate(buffer, sizeof(buffer), "%T", 2, NULL, "No Access", &client))
if (!logicore.CoreTranslate(buffer, sizeof(buffer), "%T", 2, NULL, "No Access", &client))
{
UTIL_Format(buffer, sizeof(buffer), "You do not have access to this command");
}
@@ -562,44 +559,6 @@ bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmi
return false;
}
bool ConCmdManager::AddConsoleCommand(IPluginFunction *pFunction,
const char *name,
const char *description,
int flags)
{
ConCmdInfo *pInfo = AddOrFindCommand(name, description, flags);
if (!pInfo)
{
return false;
}
CmdHook *pHook = new CmdHook();
pHook->pf = pFunction;
if (description && description[0])
{
pHook->helptext.assign(description);
}
pInfo->conhooks.push_back(pHook);
/* Add to the plugin */
CmdList *pList;
IPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
if (!pPlugin->GetProperty("CommandList", (void **)&pList))
{
pList = new CmdList();
pPlugin->SetProperty("CommandList", pList);
}
PlCmdInfo info;
info.pInfo = pInfo;
info.type = Cmd_Console;
info.pHook = pHook;
AddToPlCmdList(pList, info);
return true;
}
bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
const char *name,
const char *group,
@@ -661,7 +620,6 @@ bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
/* Finally, add the hook */
pInfo->conhooks.push_back(pHook);
pInfo->admin = *(pHook->pAdmin);
pInfo->is_admin_set = true;
/* Now add to the plugin */
CmdList *pList;
@@ -806,7 +764,6 @@ void ConCmdManager::UpdateAdminCmdFlags(const char *cmd, OverrideType type, Flag
pInfo->admin = *(pHook->pAdmin);
}
}
pInfo->is_admin_set = true;
}
else if (type == Override_CommandGroup)
{
@@ -840,7 +797,6 @@ void ConCmdManager::UpdateAdminCmdFlags(const char *cmd, OverrideType type, Flag
}
}
}
pInfo->is_admin_set = true;
}
}
@@ -908,7 +864,7 @@ bool ConCmdManager::LookForCommandAdminFlags(const char *cmd, FlagBits *pFlags)
*pFlags = pInfo->admin.eflags;
return pInfo->is_admin_set;
return true;
}
ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *description, int flags)
@@ -916,6 +872,10 @@ ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *descri
ConCmdInfo *pInfo;
if (!sm_trie_retrieve(m_pCmds, name, (void **)&pInfo))
{
ConCmdList::iterator item = FindInList(name);
if (item != m_CmdList.end())
return *item;
pInfo = new ConCmdInfo();
/* Find the commandopan */
ConCommand *pCmd = FindCommand(name);
@@ -941,7 +901,6 @@ ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *descri
}
pInfo->pCmd = pCmd;
pInfo->is_admin_set = false;
sm_trie_insert(m_pCmds, name, pInfo);
AddToCmdList(pInfo);
@@ -994,13 +953,9 @@ void ConCmdManager::OnRootConsoleCommand(const char *cmdname, const CCommand &co
{
type = "server";
}
else if (cmd.type == Cmd_Console)
{
type = "console";
}
else if (cmd.type == Cmd_Admin)
{
type = "admin";
type = (cmd.pInfo->admin.eflags == 0)?"console":"admin";
}
name = cmd.pInfo->pCmd->GetName();
if (cmd.pHook->helptext.size())
+11 -5
View File
@@ -48,7 +48,6 @@ using namespace SourceHook;
enum CmdType
{
Cmd_Server,
Cmd_Console,
Cmd_Admin,
};
@@ -89,9 +88,10 @@ struct ConCmdInfo
List<CmdHook *> srvhooks; /**< Hooks as a server command */
List<CmdHook *> conhooks; /**< Hooks as a console command */
AdminCmdInfo admin; /**< Admin info, if any */
bool is_admin_set; /**< Whether or not admin info is set */
};
typedef List<ConCmdInfo *> ConCmdList;
class ConCmdManager :
public SMGlobalClass,
public IRootConsoleCommand,
@@ -117,7 +117,6 @@ public: //IConCommandTracker
void OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name, bool is_read_safe);
public:
bool AddServerCommand(IPluginFunction *pFunction, const char *name, const char *description, int flags);
bool AddConsoleCommand(IPluginFunction *pFunction, const char *name, const char *description, int flags);
bool AddAdminCommand(IPluginFunction *pFunction,
const char *name,
const char *group,
@@ -128,7 +127,8 @@ public:
void UpdateAdminCmdFlags(const char *cmd, OverrideType type, FlagBits bits, bool remove);
bool LookForSourceModCommand(const char *cmd);
bool LookForCommandAdminFlags(const char *cmd, FlagBits *pFlags);
bool CheckCommandAccess(int client, const char *cmd, FlagBits flags);
bool CheckClientCommandAccess(int client, const char *cmd, FlagBits flags);
bool CheckAdminCommandAccess(AdminId adm, const char *cmd, FlagBits flags);
private:
void InternalDispatch(const CCommand &command);
ResultType RunAdminCommand(ConCmdInfo *pInfo, int client, int args);
@@ -139,6 +139,12 @@ private:
void RemoveConCmds(List<CmdHook *> &cmdlist);
void RemoveConCmds(List<CmdHook *> &cmdlist, IPluginContext *pContext);
bool CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmin);
// Case insensitive
ConCmdList::iterator FindInList(const char *name);
// Case sensitive
ConCmdInfo *FindInTrie(const char *name);
public:
inline int GetCommandClient()
{
@@ -151,7 +157,7 @@ public:
private:
Trie *m_pCmds; /* command lookup */
Trie *m_pCmdGrps; /* command group lookup */
List<ConCmdInfo *> m_CmdList; /* command list */
ConCmdList m_CmdList; /* command list */
int m_CmdClient; /* current client */
BaseStringTable m_Strings; /* string table */
};
+36 -36
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -31,59 +31,59 @@
#ifndef _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_
#define _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_
#if SOURCE_ENGINE >= SE_LEFT4DEAD
class ConCommandBaseIterator
{
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
ICvarIteratorInternal *cvarIter;
#else
ConCommandBase *cvarIter;
#endif
public:
ConCommandBaseIterator()
inline ConCommandBaseIterator() : iter(icvar)
{
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
cvarIter = icvar->FactoryInternalIterator();
cvarIter->SetFirst();
#else
cvarIter = icvar->GetCommands();
#endif
}
~ConCommandBaseIterator()
{
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
g_pMemAlloc->Free(cvarIter);
#endif
iter.SetFirst();
}
inline bool IsValid()
{
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
return cvarIter->IsValid();
#else
return cvarIter != NULL;
#endif
return iter.IsValid();
}
inline void Next()
{
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
cvarIter->Next();
#else
cvarIter = const_cast<ConCommandBase*>(cvarIter->GetNext());
#endif
iter.Next();
}
inline ConCommandBase *Get()
{
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
return cvarIter->Get();
#else
return cvarIter;
#endif
return iter.Get();
}
private:
ICvar::Iterator iter;
};
#else
class ConCommandBaseIterator
{
public:
inline ConCommandBaseIterator()
{
iter = icvar->GetCommands();
}
inline bool IsValid()
{
return iter != NULL;
}
inline void Next()
{
iter = const_cast<ConCommandBase *>(iter->GetNext());
}
inline ConCommandBase *Get()
{
return iter;
}
private:
ConCommandBase *iter;
};
#endif
#endif /* _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_ */
+27 -7
View File
@@ -322,8 +322,15 @@ void ConVarManager::OnRootConsoleCommand(const char *cmdname, const CCommand &co
int argcount = command.ArgC();
if (argcount >= 3)
{
bool wantReset = false;
/* Get plugin index that was passed */
const char *arg = command.Arg(2);
if (argcount >= 4 && strcmp(arg, "reset") == 0)
{
wantReset = true;
arg = command.Arg(3);
}
/* Get plugin object */
CPlugin *plugin = g_PluginSys.FindPluginByConsoleArg(arg);
@@ -348,21 +355,34 @@ void ConVarManager::OnRootConsoleCommand(const char *cmdname, const CCommand &co
return;
}
g_RootMenu.ConsolePrint("[SM] Listing %d convars for: %s", pConVarList->size(), plname);
g_RootMenu.ConsolePrint(" %-32.31s %s", "[Name]", "[Value]");
/* Iterate convar list and display each one */
if (!wantReset)
{
g_RootMenu.ConsolePrint("[SM] Listing %d convars for: %s", pConVarList->size(), plname);
g_RootMenu.ConsolePrint(" %-32.31s %s", "[Name]", "[Value]");
}
/* Iterate convar list and display/reset each one */
for (iter = pConVarList->begin(); iter != pConVarList->end(); iter++)
{
const ConVar *pConVar = (*iter);
g_RootMenu.ConsolePrint(" %-32.31s %s", pConVar->GetName(), pConVar->GetString());
/*const */ConVar *pConVar = const_cast<ConVar *>(*iter);
if (!wantReset)
{
g_RootMenu.ConsolePrint(" %-32.31s %s", pConVar->GetName(), pConVar->GetString());
} else {
pConVar->Revert();
}
}
if (wantReset)
{
g_RootMenu.ConsolePrint("[SM] Reset %d convars for: %s", pConVarList->size(), plname);
}
return;
}
/* Display usage of subcommand */
g_RootMenu.ConsolePrint("[SM] Usage: sm cvars <plugin #>");
g_RootMenu.ConsolePrint("[SM] Usage: sm cvars [reset] <plugin #>");
}
Handle_t ConVarManager::CreateConVar(IPluginContext *pContext, const char *name, const char *defaultVal, const char *description, int flags, bool hasMin, float min, bool hasMax, float max)
+8 -3
View File
@@ -44,14 +44,14 @@
#include "Logger.h"
#include "compat_wrappers.h"
#include "ConsoleDetours.h"
#include "GameConfigs.h"
#include <IGameConfigs.h>
#include "sm_stringutil.h"
#include "ConCmdManager.h"
#include "HalfLife2.h"
#include "ConCommandBaseIterator.h"
#include "ShareSys.h"
#if defined PLATFORM_LINUX
#if defined PLATFORM_POSIX
# include <dlfcn.h>
# include <sys/mman.h>
# include <stdint.h>
@@ -664,6 +664,11 @@ cell_t ConsoleDetours::InternalDispatch(int client, const CCommand& args)
char name[255];
const char *realname = args.Arg(0);
size_t len = strlen(realname);
// Disallow command strings that are too long, for now.
if (len >= sizeof(name) - 1)
return Pl_Continue;
for (size_t i = 0; i < len; i++)
{
if (realname[i] >= 'A' && realname[i] <= 'Z')
@@ -683,7 +688,7 @@ cell_t ConsoleDetours::InternalDispatch(int client, const CCommand& args)
if (strcmp(name, "sm") == 0)
result = Pl_Continue;
if (result >= Pl_Stop)
if (result >= Pl_Handled)
return result;
Listener **plistener = m_CmdLookup.retrieve(name);
+22 -4
View File
@@ -193,17 +193,30 @@ void CoreConfig::OnRootConsoleCommand(const char *cmdname, const CCommand &comma
if (res == ConfigResult_Reject)
{
g_RootMenu.ConsolePrint("[SM] Could not set config option \"%s\" to \"%s\" (%s)", option, value, error);
g_RootMenu.ConsolePrint("[SM] Could not set config option \"%s\" to \"%s\". (%s)", option, value, error);
} else if (res == ConfigResult_Ignore) {
g_RootMenu.ConsolePrint("[SM] No such config option \"%s\" exists.", option);
} else {
g_RootMenu.ConsolePrint("Config option \"%s\" successfully set to \"%s.\"", option, value);
g_RootMenu.ConsolePrint("[SM] Config option \"%s\" successfully set to \"%s\".", option, value);
}
return;
} else if (argcount >= 3) {
const char *option = command.Arg(2);
const char *value = GetCoreConfigValue(option);
if (value == NULL)
{
g_RootMenu.ConsolePrint("[SM] No such config option \"%s\" exists.", option);
} else {
g_RootMenu.ConsolePrint("[SM] Config option \"%s\" is set to \"%s\".", option, value);
}
return;
}
g_RootMenu.ConsolePrint("[SM] Usage: sm config <option> <value>");
g_RootMenu.ConsolePrint("[SM] Usage: sm config <option> [value]");
}
void CoreConfig::Initialize()
@@ -395,7 +408,7 @@ bool SM_ExecuteConfig(CPlugin *pl, AutoConfig *cfg, bool can_create)
FILE *fp = fopen(file, "wt");
if (fp)
{
fprintf(fp, "// This file was auto-generated by SourceMod (v%s)\n", SM_FULL_VERSION);
fprintf(fp, "// This file was auto-generated by SourceMod (v%s)\n", SM_VERSION_STRING);
fprintf(fp, "// ConVars for plugin \"%s\"\n", pl->GetFilename());
fprintf(fp, "\n\n");
@@ -452,6 +465,11 @@ bool SM_ExecuteConfig(CPlugin *pl, AutoConfig *cfg, bool can_create)
can_create = false;
fclose(fp);
}
else
{
g_Logger.LogError("Failed to auto generate config for %s, make sure the directory has write permission.", pl->GetFilename());
return can_create;
}
}
}
+40 -31
View File
@@ -47,7 +47,7 @@ DBManager g_DBMan;
static bool s_OneTimeThreaderErrorMsg = false;
DBManager::DBManager()
: m_StrTab(512), m_ParseLevel(0), m_ParseState(0), m_pDefault(NULL)
: m_ParseLevel(0), m_ParseState(0), m_pDefault(NULL)
{
}
@@ -104,6 +104,7 @@ void DBManager::OnSourceModShutdown()
m_pQueueLock->DestroyThis();
g_HandleSys.RemoveType(m_DatabaseType, g_pCoreIdent);
g_HandleSys.RemoveType(m_DriverType, g_pCoreIdent);
ClearConfigs();
}
unsigned int DBManager::GetInterfaceVersion()
@@ -133,13 +134,20 @@ void DBManager::OnHandleDestroy(HandleType_t type, void *object)
void DBManager::ReadSMC_ParseStart()
{
m_confs.clear();
ClearConfigs();
m_ParseLevel = 0;
m_ParseState = DBPARSE_LEVEL_NONE;
m_StrTab.Reset();
m_DefDriver.clear();
}
void DBManager::ClearConfigs()
{
List<ConfDbInfo *>::iterator iter;
for (iter=m_confs.begin(); iter!=m_confs.end(); iter++)
delete (*iter);
m_confs.clear();
}
ConfDbInfo s_CurInfo;
SMCResult DBManager::ReadSMC_NewSection(const SMCStates *states, const char *name)
{
@@ -159,7 +167,7 @@ SMCResult DBManager::ReadSMC_NewSection(const SMCStates *states, const char *nam
}
} else if (m_ParseState == DBPARSE_LEVEL_MAIN) {
s_CurInfo = ConfDbInfo();
s_CurInfo.name = m_StrTab.AddString(name);
s_CurInfo.name = name;
m_ParseState = DBPARSE_LEVEL_DATABASE;
} else if (m_ParseState == DBPARSE_LEVEL_DATABASE) {
m_ParseLevel++;
@@ -186,16 +194,16 @@ SMCResult DBManager::ReadSMC_KeyValue(const SMCStates *states, const char *key,
{
if (strcmp(value, "default") != 0)
{
s_CurInfo.driver = m_StrTab.AddString(value);
s_CurInfo.driver = value;
}
} else if (strcmp(key, "database") == 0) {
s_CurInfo.database = m_StrTab.AddString(value);
s_CurInfo.database = value;
} else if (strcmp(key, "host") == 0) {
s_CurInfo.host = m_StrTab.AddString(value);
s_CurInfo.host = value;
} else if (strcmp(key, "user") == 0) {
s_CurInfo.user = m_StrTab.AddString(value);
s_CurInfo.user = value;
} else if (strcmp(key, "pass") == 0) {
s_CurInfo.pass = m_StrTab.AddString(value);
s_CurInfo.pass = value;
} else if (strcmp(key, "timeout") == 0) {
s_CurInfo.info.maxTimeout = atoi(value);
} else if (strcmp(key, "port") == 0) {
@@ -206,13 +214,6 @@ SMCResult DBManager::ReadSMC_KeyValue(const SMCStates *states, const char *key,
return SMCResult_Continue;
}
#define ASSIGN_VAR(var) \
if (s_CurInfo.var == -1) { \
s_CurInfo.info.var = ""; \
} else { \
s_CurInfo.info.var = m_StrTab.GetString(s_CurInfo.var); \
}
SMCResult DBManager::ReadSMC_LeavingSection(const SMCStates *states)
{
if (m_ParseLevel)
@@ -223,17 +224,26 @@ SMCResult DBManager::ReadSMC_LeavingSection(const SMCStates *states)
if (m_ParseState == DBPARSE_LEVEL_DATABASE)
{
/* Set all of the info members to either a blank string
* or the string pointer from the string table.
*/
ASSIGN_VAR(driver);
ASSIGN_VAR(database);
ASSIGN_VAR(host);
ASSIGN_VAR(user);
ASSIGN_VAR(pass);
ConfDbInfo *cdb = new ConfDbInfo();
cdb->name = s_CurInfo.name;
cdb->driver = s_CurInfo.driver;
cdb->host = s_CurInfo.host;
cdb->user = s_CurInfo.user;
cdb->pass = s_CurInfo.pass;
cdb->database = s_CurInfo.database;
cdb->realDriver = s_CurInfo.realDriver;
cdb->info.maxTimeout = s_CurInfo.info.maxTimeout;
cdb->info.port = s_CurInfo.info.port;
cdb->info.driver = cdb->driver.c_str();
cdb->info.database = cdb->database.c_str();
cdb->info.host = cdb->host.c_str();
cdb->info.user = cdb->user.c_str();
cdb->info.pass = cdb->pass.c_str();
/* Save it.. */
m_confs.push_back(s_CurInfo);
m_confs.push_back(cdb);
/* Go up one level */
m_ParseState = DBPARSE_LEVEL_MAIN;
@@ -244,7 +254,6 @@ SMCResult DBManager::ReadSMC_LeavingSection(const SMCStates *states)
return SMCResult_Continue;
}
#undef ASSIGN_VAR
void DBManager::ReadSMC_ParseEnd(bool halted, bool failed)
{
@@ -333,10 +342,10 @@ void DBManager::RemoveDriver(IDBDriver *pDriver)
}
/* Make sure NOTHING references this! */
List<ConfDbInfo>::iterator iter;
List<ConfDbInfo *>::iterator iter;
for (iter=m_confs.begin(); iter!=m_confs.end(); iter++)
{
ConfDbInfo &db = (*iter);
ConfDbInfo &db = *(*iter);
if (db.realDriver == pDriver)
{
db.realDriver = NULL;
@@ -448,12 +457,12 @@ const DatabaseInfo *DBManager::FindDatabaseConf(const char *name)
ConfDbInfo *DBManager::GetDatabaseConf(const char *name)
{
List<ConfDbInfo>::iterator iter;
List<ConfDbInfo *>::iterator iter;
for (iter=m_confs.begin(); iter!=m_confs.end(); iter++)
{
ConfDbInfo &conf = (*iter);
if (strcmp(m_StrTab.GetString(conf.name), name) == 0)
ConfDbInfo &conf = *(*iter);
if (conf.name == name)
{
return &conf;
}
+9 -10
View File
@@ -47,16 +47,15 @@ using namespace SourceHook;
struct ConfDbInfo
{
ConfDbInfo() : name(-1), driver(-1), host(-1), user(-1), pass(-1),
database(-1), realDriver(NULL)
ConfDbInfo() : realDriver(NULL)
{
}
int name;
int driver;
int host;
int user;
int pass;
int database;
String name;
String driver;
String host;
String user;
String pass;
String database;
IDBDriver *realDriver;
DatabaseInfo info;
};
@@ -121,6 +120,7 @@ public:
return m_DatabaseType;
}
private:
void ClearConfigs();
void KillWorkerThread();
private:
CVector<IDBDriver *> m_drivers;
@@ -134,11 +134,10 @@ private:
IMutex *m_pQueueLock; /* Queue safety lock */
IMutex *m_pThinkLock; /* Think-queue lock */
List<ConfDbInfo> m_confs;
List<ConfDbInfo *> m_confs;
HandleType_t m_DriverType;
HandleType_t m_DatabaseType;
String m_DefDriver;
BaseStringTable m_StrTab;
char m_Filename[PLATFORM_MAX_PATH];
unsigned int m_ParseLevel;
unsigned int m_ParseState;
+7 -2
View File
@@ -56,11 +56,16 @@ void DebugReport::OnDebugSpew(const char *msg, ...)
void DebugReport::GenerateError(IPluginContext *ctx, cell_t func_idx, int err, const char *message, ...)
{
va_list ap;
char buffer[512];
va_start(ap, message);
UTIL_FormatArgs(buffer, sizeof(buffer), message, ap);
GenerateErrorVA(ctx, func_idx, err, message, ap);
va_end(ap);
}
void DebugReport::GenerateErrorVA(IPluginContext *ctx, cell_t func_idx, int err, const char *message, va_list ap)
{
char buffer[512];
UTIL_FormatArgs(buffer, sizeof(buffer), message, ap);
const char *plname = g_PluginSys.FindPluginByContext(ctx->GetContext())->GetFilename();
const char *error = g_pSourcePawn2->GetErrorString(err);
+1
View File
@@ -46,6 +46,7 @@ public: // IDebugListener
void OnDebugSpew(const char *msg, ...);
public:
void GenerateError(IPluginContext *ctx, cell_t func_idx, int err, const char *message, ...);
void GenerateErrorVA(IPluginContext *ctx, cell_t func_idx, int err, const char *message, va_list ap);
void GenerateCodeError(IPluginContext *ctx, uint32_t code_addr, int err, const char *message, ...);
private:
int _GetPluginIndex(IPluginContext *ctx);
+8 -1
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -161,6 +161,13 @@ void EventManager::FireGameEvent(IGameEvent *pEvent)
Just need to add ourselves as a listener to make our hook on IGameEventManager2::FireEvent work */
}
#if SOURCE_ENGINE >= SE_LEFT4DEAD
int EventManager::GetEventDebugID()
{
return EVENT_DEBUG_ID_INIT;
}
#endif
EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunction, EventHookMode mode)
{
EventHook *pHook;
+4 -1
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -105,6 +105,9 @@ public: // IPluginsListener
void OnPluginUnloaded(IPlugin *plugin);
public: // IGameEventListener2
void FireGameEvent(IGameEvent *pEvent);
#if SOURCE_ENGINE >= SE_LEFT4DEAD
int GetEventDebugID();
#endif
public:
/**
* Get the 'GameEvent' handle type ID.
+188 -18
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -37,6 +37,7 @@
#include "sourcemm_api.h"
#include "sm_srvcmds.h"
#include "sm_stringutil.h"
#include "PlayerManager.h"
CExtensionManager g_Extensions;
IdentityType_t g_ExtType;
@@ -65,12 +66,30 @@ CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filena
#define GAMEFIX "2.l4d"
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
#define GAMEFIX "2.l4d2"
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
#define GAMEFIX "2.nd"
#elif SOURCE_ENGINE == SE_ALIENSWARM
#define GAMEFIX "2.swarm"
#elif SOURCE_ENGINE == SE_ORANGEBOX
#define GAMEFIX "2.ep2"
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE
#define GAMEFIX "2.ep2v"
#elif SOURCE_ENGINE == SE_BLOODYGOODTIME
#define GAMEFIX "2.bgt"
#elif SOURCE_ENGINE == SE_EYE
#define GAMEFIX "2.eye"
#elif SOURCE_ENGINE == SE_CSS
#define GAMEFIX "2.css"
#elif SOURCE_ENGINE == SE_HL2DM
#define GAMEFIX "2.hl2dm"
#elif SOURCE_ENGINE == SE_DODS
#define GAMEFIX "2.dods"
#elif SOURCE_ENGINE == SE_TF2
#define GAMEFIX "2.tf2"
#elif SOURCE_ENGINE == SE_DARKMESSIAH
#define GAMEFIX "2.darkm"
#elif SOURCE_ENGINE == SE_PORTAL2
#define GAMEFIX "2.portal2"
#elif SOURCE_ENGINE == SE_CSGO
#define GAMEFIX "2.csgo"
#else
#define GAMEFIX "2.ep1"
#endif //(SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
@@ -85,6 +104,12 @@ CLocalExtension::CLocalExtension(const char *filename)
char path[PLATFORM_MAX_PATH];
/* Special case for new bintools binary */
if (strcmp(filename, "bintools.ext") == 0)
{
goto normal;
}
/* Zeroth, see if there is an engine specific build in the new place. */
g_SourceMod.BuildPath(Path_SM,
path,
@@ -97,6 +122,31 @@ CLocalExtension::CLocalExtension(const char *filename)
goto found;
}
#if SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_HL2DM
/* COMPAT HACK: One-halfth, if ep2v, see if there is an engine specific build in the new place with old naming */
g_SourceMod.BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
"extensions/%s.2.ep2v." PLATFORM_LIB_EXT,
filename);
if (g_LibSys.IsPathFile(path))
{
goto found;
}
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
g_SourceMod.BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
"extensions/%s.2.l4d2." PLATFORM_LIB_EXT,
filename);
if (g_LibSys.IsPathFile(path))
{
goto found;
}
#endif
/* First see if there is an engine specific build! */
g_SourceMod.BuildPath(Path_SM,
path,
@@ -107,6 +157,7 @@ CLocalExtension::CLocalExtension(const char *filename)
/* Try the "normal" version */
if (!g_LibSys.IsPathFile(path))
{
normal:
g_SourceMod.BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
@@ -171,6 +222,28 @@ bool CLocalExtension::Load(char *error, size_t maxlength)
{
bool already;
m_PlId = g_pMMPlugins->Load(m_Path.c_str(), g_PLID, already, error, maxlength);
// Check the plugin didn't refuse load
Pl_Status status;
#ifndef METAMOD_PLAPI_VERSION
const char *file;
PluginId source;
#endif
if (!m_PlId || (
#ifndef METAMOD_PLAPI_VERSION
g_pMMPlugins->Query(m_PlId, file, status, source)
#else
g_pMMPlugins->Query(m_PlId, NULL, &status, NULL)
#endif
&& status < Pl_Paused))
{
m_pLib->CloseLibrary();
m_pLib = NULL;
m_pAPI = NULL;
return false;
}
}
if (!CExtension::Load(error, maxlength))
@@ -337,6 +410,11 @@ const char *CExtension::GetFilename()
return m_RealFile.c_str();
}
const char *CExtension::GetPath() const
{
return m_Path.c_str();
}
IdentityToken_t *CExtension::GetIdentity()
{
return m_pIdentToken;
@@ -545,7 +623,7 @@ void CExtensionManager::TryAutoload()
}
}
IExtension *CExtensionManager::LoadAutoExtension(const char *path)
IExtension *CExtensionManager::LoadAutoExtension(const char *path, bool bErrorOnMissing)
{
/* Remove platform extension if it's there. Compat hack. */
const char *ext = g_LibSys.GetFileExtension(path);
@@ -554,7 +632,7 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path)
char path2[PLATFORM_MAX_PATH];
UTIL_Format(path2, sizeof(path2), "%s", path);
path2[strlen(path) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
return LoadAutoExtension(path2);
return LoadAutoExtension(path2, bErrorOnMissing);
}
IExtension *pAlready;
@@ -573,7 +651,11 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path)
if (!p->Load(error, sizeof(error)) || !p->IsLoaded())
{
g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
if (bErrorOnMissing || g_LibSys.IsPathFile(p->GetPath()))
{
g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
}
p->SetError(error);
}
@@ -754,6 +836,13 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
return false;
}
/* Tell it to unload */
if (pExt->IsLoaded())
{
IExtensionInterface *pAPI = pExt->GetAPI();
pAPI->OnExtensionUnload();
}
/* First remove us from internal lists */
g_ShareSys.RemoveInterfaces(_pExt);
m_Libs.remove(pExt);
@@ -777,7 +866,7 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
s_iter != pExt->m_Libraries.end();
s_iter++)
{
g_PluginSys.OnLibraryAction((*s_iter).c_str(), false, true);
g_PluginSys.OnLibraryAction((*s_iter).c_str(), LibraryAction_Removed);
}
/* Notify and/or unload all dependencies */
@@ -848,13 +937,6 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
}
}
/* Tell it to unload */
if (pExt->IsLoaded())
{
IExtensionInterface *pAPI = pExt->GetAPI();
pAPI->OnExtensionUnload();
}
pExt->Unload();
delete pExt;
@@ -988,7 +1070,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
{
if (argcount < 4)
{
g_RootMenu.ConsolePrint("[SM] Usage: sm info <#>");
g_RootMenu.ConsolePrint("[SM] Usage: sm exts info <#>");
return;
}
@@ -996,7 +1078,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
unsigned int id = atoi(sId);
if (id <= 0)
{
g_RootMenu.ConsolePrint("[SM] Usage: sm info <#>");
g_RootMenu.ConsolePrint("[SM] Usage: sm exts info <#>");
return;
}
@@ -1073,7 +1155,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
{
if (argcount < 4)
{
g_RootMenu.ConsolePrint("[SM] Usage: sm unload <#> [code]");
g_RootMenu.ConsolePrint("[SM] Usage: sm exts unload <#> [code]");
return;
}
@@ -1240,6 +1322,94 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
g_RootMenu.DrawGenericOption("unload", "Unload an extension");
}
void CExtensionManager::ListExtensionsToClient(CPlayer *player, const CCommand &args)
{
char buffer[256];
int numExtensions = m_Libs.size();
edict_t *edict = player->GetEdict();
unsigned int id = 0;
unsigned int start = 0;
if (!numExtensions)
{
ClientConsolePrint(edict, "[SM] No extensions found.");
return;
}
if (args.ArgC() > 2)
{
start = atoi(args.Arg(2));
}
CExtension *ext;
SourceHook::List<CExtension *>::iterator iter;
for (iter = m_Libs.begin();
iter != m_Libs.end();
iter++)
{
ext = (*iter);
char error[255];
if (!ext->IsRunning(error, sizeof(error)))
{
continue;
}
id++;
if (id < start)
{
continue;
}
if (id - start > 10)
{
break;
}
IExtensionInterface *api = ext->GetAPI();
const char *name = api->GetExtensionName();
const char *version = api->GetExtensionVerString();
const char *author = api->GetExtensionAuthor();
const char *description = api->GetExtensionDescription();
size_t len = UTIL_Format(buffer, sizeof(buffer), " \"%s\"", name);
if (version != NULL && IS_STR_FILLED(version))
{
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " (%s)", version);
}
if (author != NULL && IS_STR_FILLED(author))
{
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " by %s", author);
}
if (description != NULL && IS_STR_FILLED(description))
{
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, ": %s", description);
}
ClientConsolePrint(edict, "%s", buffer);
}
while (iter != m_Libs.end())
{
char error[255];
if ((*iter)->IsRunning(error, sizeof(error)))
{
break;
}
}
if (iter != m_Libs.end())
{
ClientConsolePrint(edict, "To see more, type \"sm exts %d\"", id);
}
}
CExtension *CExtensionManager::GetExtensionFromIdent(IdentityToken_t *ptr)
{
if (ptr->type == g_ExtType)
@@ -1262,7 +1432,7 @@ void CExtensionManager::AddLibrary(IExtension *pSource, const char *library)
{
CExtension *pExt = (CExtension *)pSource;
pExt->AddLibrary(library);
g_PluginSys.OnLibraryAction(library, false, false);
g_PluginSys.OnLibraryAction(library, LibraryAction_Added);
}
bool CExtensionManager::LibraryExists(const char *library)
+6 -1
View File
@@ -45,6 +45,8 @@
#include "PluginSys.h"
#include "NativeOwner.h"
class CPlayer;
using namespace SourceMod;
using namespace SourceHook;
@@ -66,6 +68,7 @@ public:
public: //IExtension
IExtensionInterface *GetAPI();
const char *GetFilename();
const char *GetPath() const;
IdentityToken_t *GetIdentity();
ITERATOR *FindFirstDependency(IExtension **pOwner, SMInterface **pInterface);
bool FindNextDependency(ITERATOR *iter, IExtension **pOwner, SMInterface **pInterface);
@@ -163,7 +166,7 @@ public: //IPluginsListener
public: //IRootConsoleCommand
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
public:
IExtension *LoadAutoExtension(const char *path);
IExtension *LoadAutoExtension(const char *path, bool bErrorOnMissing=true);
void BindDependency(IExtension *pOwner, IfaceInfo *pInfo);
void AddInterface(IExtension *pOwner, SMInterface *pInterface);
void BindChildPlugin(IExtension *pParent, CPlugin *pPlugin);
@@ -174,6 +177,8 @@ public:
bool LibraryExists(const char *library);
void CallOnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax);
void AddRawDependency(IExtension *ext, IdentityToken_t *other, void *iface);
public:
void ListExtensionsToClient(CPlayer *player, const CCommand &args);
public:
CExtension *GetExtensionFromIdent(IdentityToken_t *ptr);
void Shutdown();
+358 -42
View File
@@ -35,9 +35,38 @@
#include "UserMessages.h"
#include "PlayerManager.h"
#include "sm_stringutil.h"
#include "GameConfigs.h"
#include <IGameConfigs.h>
#include <compat_wrappers.h>
#include <Logger.h>
#include "LibrarySys.h"
#include "logic_bridge.h"
#include <tier0/mem.h>
#if SOURCE_ENGINE == SE_CSGO
#include <cstrike15_usermessages.pb.h>
#endif
typedef ICommandLine *(*FakeGetCommandLine)();
#if defined _WIN32
#define TIER0_NAME "tier0.dll"
#define VSTDLIB_NAME "vstdlib.dll"
#elif defined __APPLE__
#define TIER0_NAME "libtier0.dylib"
#define VSTDLIB_NAME "libvstdlib.dylib"
#elif defined __linux__
#if SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_LEFT4DEAD2
#define TIER0_NAME "libtier0_srv.so"
#define VSTDLIB_NAME "libvstdlib_srv.so"
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
#define TIER0_NAME "libtier0.so"
#define VSTDLIB_NAME "libvstdlib.so"
#else
#define TIER0_NAME "tier0_i486.so"
#define VSTDLIB_NAME "vstdlib_i486.so"
#endif
#endif
CHalfLife2 g_HL2;
ConVar *sv_lan = NULL;
@@ -131,41 +160,68 @@ void CHalfLife2::OnSourceModAllInitialized()
void CHalfLife2::OnSourceModAllInitialized_Post()
{
char *addr = NULL;
#ifdef PLATFORM_WINDOWS
int offset;
InitLogicalEntData();
InitCommandLine();
}
/* gEntList and/or g_pEntityList */
if (!g_pGameConf->GetMemSig("LevelShutdown", (void **)&addr))
void CHalfLife2::InitLogicalEntData()
{
char *addr = NULL;
/*
* gEntList and/or g_pEntityList
*
* First try to lookup pointer directly for platforms with symbols.
* If symbols aren't present (Windows or stripped Linux/Mac),
* attempt find via LevelShutdown + offset
*/
if (g_pGameConf->GetMemSig("gEntList", (void **)&addr))
{
g_Logger.LogError("Logical Entities not supported by this mod (LevelShutdown) - Reverting to networkable entities only");
return;
#if !defined PLATFORM_WINDOWS
if (!addr)
{
// Key exists so notify if lookup fails, but try other method.
g_Logger.LogError("Failed lookup of gEntList directly - Reverting to lookup via LevelShutdown");
}
else
{
#endif
g_EntList = reinterpret_cast<void *>(addr);
#if !defined PLATFORM_WINDOWS
}
#endif
}
if (!addr)
if (!g_EntList)
{
g_Logger.LogError("Failed lookup of LevelShutdown - Reverting to networkable entities only");
return;
if (!g_pGameConf->GetMemSig("LevelShutdown", (void **)&addr))
{
g_Logger.LogError("Logical Entities not supported by this mod (LevelShutdown) - Reverting to networkable entities only");
return;
}
if (!addr)
{
g_Logger.LogError("Failed lookup of LevelShutdown - Reverting to networkable entities only");
return;
}
int offset;
if (!g_pGameConf->GetOffset("gEntList", &offset))
{
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
return;
}
g_EntList = *reinterpret_cast<void **>(addr + offset);
}
if (!g_pGameConf->GetOffset("gEntList", &offset))
{
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
return;
}
g_EntList = *reinterpret_cast<void **>(addr + offset);
#elif defined PLATFORM_LINUX
/* gEntList and/or g_pEntityList */
if (!g_pGameConf->GetMemSig("gEntList", (void **)&addr))
{
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
return;
}
if (!addr)
if (!g_EntList)
{
g_Logger.LogError("Failed lookup of gEntList - Reverting to networkable entities only");
return;
}
g_EntList = reinterpret_cast<void *>(addr);
#endif
if (!g_pGameConf->GetOffset("EntInfo", &entInfoOffset))
{
@@ -174,6 +230,64 @@ void CHalfLife2::OnSourceModAllInitialized_Post()
}
}
void CHalfLife2::InitCommandLine()
{
char path[PLATFORM_MAX_PATH];
char error[256];
g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "../bin/" TIER0_NAME);
if (!g_LibSys.IsPathFile(path))
{
g_Logger.LogError("Could not find path for: " TIER0_NAME);
return;
}
ILibrary *lib = g_LibSys.OpenLibrary(path, error, sizeof(error));
m_pGetCommandLine = lib->GetSymbolAddress("CommandLine_Tier0");
/* '_Tier0' dropped on Alien Swarm version */
if (m_pGetCommandLine == NULL)
{
m_pGetCommandLine = lib->GetSymbolAddress("CommandLine");
}
if (m_pGetCommandLine == NULL)
{
/* We probably have a Ship engine. */
lib->CloseLibrary();
g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "../bin/" VSTDLIB_NAME);
if (!g_LibSys.IsPathFile(path))
{
g_Logger.LogError("Could not find path for: " VSTDLIB_NAME);
return;
}
if ((lib = g_LibSys.OpenLibrary(path, error, sizeof(error))) == NULL)
{
g_Logger.LogError("Could not load %s: %s", path, error);
return;
}
m_pGetCommandLine = lib->GetSymbolAddress("CommandLine");
if (m_pGetCommandLine == NULL)
{
g_Logger.LogError("Could not locate any command line functionality");
}
lib->CloseLibrary();
}
}
ICommandLine *CHalfLife2::GetValveCommandLine()
{
if (!m_pGetCommandLine)
return NULL;
return ((FakeGetCommandLine)((FakeGetCommandLine *)m_pGetCommandLine))();
}
#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11
bool CHalfLife2::IsOriginalEngine()
{
@@ -223,8 +337,13 @@ bool UTIL_FindInSendTable(SendTable *pTable,
return false;
}
typedescription_t *UTIL_FindInDataMap(datamap_t *pMap, const char *name)
typedescription_t *UTIL_FindInDataMap(datamap_t *pMap, const char *name, bool *isNested)
{
if (isNested)
{
*isNested = false;
}
while (pMap)
{
for (int i=0; i<pMap->dataNumFields; i++)
@@ -239,10 +358,21 @@ typedescription_t *UTIL_FindInDataMap(datamap_t *pMap, const char *name)
}
if (pMap->dataDesc[i].td)
{
typedescription_t *_td;
if ((_td=UTIL_FindInDataMap(pMap->dataDesc[i].td, name)) != NULL)
if (isNested)
{
return _td;
*isNested = (UTIL_FindInDataMap(pMap->dataDesc[i].td, name, NULL) != NULL);
if (*isNested)
{
return NULL;
} else {
continue;
}
} else { // Use the old behaviour, we dont want to spring this on extensions - even if they're doing bad things.
typedescription_t *_td;
if ((_td=UTIL_FindInDataMap(pMap->dataDesc[i].td, name, NULL)) != NULL)
{
return _td;
}
}
}
}
@@ -335,6 +465,11 @@ SendProp *CHalfLife2::FindInSendTable(const char *classname, const char *offset)
}
typedescription_t *CHalfLife2::FindInDataMap(datamap_t *pMap, const char *offset)
{
return this->FindInDataMap(pMap, offset, NULL);
}
typedescription_t *CHalfLife2::FindInDataMap(datamap_t *pMap, const char *offset, bool *isNested)
{
typedescription_t *td = NULL;
DataMapTrie &val = m_Maps[pMap];
@@ -345,7 +480,7 @@ typedescription_t *CHalfLife2::FindInDataMap(datamap_t *pMap, const char *offset
}
if (!sm_trie_retrieve(val.trie, offset, (void **)&td))
{
if ((td = UTIL_FindInDataMap(pMap, offset)) != NULL)
if ((td = UTIL_FindInDataMap(pMap, offset, isNested)) != NULL)
{
sm_trie_insert(val.trie, offset, td);
}
@@ -359,13 +494,11 @@ void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
#if SOURCE_ENGINE != SE_DARKMESSIAH
if (g_pSharedChangeInfo != NULL)
{
#if SOURCE_ENGINE != SE_LEFT4DEAD2
if (offset)
{
pEdict->StateChanged(offset);
}
else
#endif
{
pEdict->StateChanged();
}
@@ -379,7 +512,9 @@ void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
{
#if SOURCE_ENGINE != SE_CSGO
bf_write *pBitBuf = NULL;
#endif
cell_t players[] = {client};
if (dest == HUD_PRINTTALK)
@@ -392,7 +527,18 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
char buffer[192];
UTIL_Format(buffer, sizeof(buffer), "%s\1\n", msg);
if ((pBitBuf = g_UserMsgs.StartMessage(m_SayTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
#if SOURCE_ENGINE == SE_CSGO
CCSUsrMsg_SayText *pMsg;
if ((pMsg = (CCSUsrMsg_SayText *)g_UserMsgs.StartProtobufMessage(m_SayTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
{
return false;
}
pMsg->set_ent_idx(0);
pMsg->set_text(buffer);
pMsg->set_chat(false);
#else
if ((pBitBuf = g_UserMsgs.StartBitBufMessage(m_SayTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
{
return false;
}
@@ -400,6 +546,7 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
pBitBuf->WriteByte(0);
pBitBuf->WriteString(buffer);
pBitBuf->WriteByte(1);
#endif
g_UserMsgs.EndMessage();
@@ -407,13 +554,29 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
}
}
if ((pBitBuf = g_UserMsgs.StartMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
#if SOURCE_ENGINE == SE_CSGO
CCSUsrMsg_TextMsg *pMsg;
if ((pMsg = (CCSUsrMsg_TextMsg *)g_UserMsgs.StartProtobufMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
{
return false;
}
// Client tries to read all 5 'params' and will crash if less
pMsg->set_msg_dst(dest);
pMsg->add_params(msg);
pMsg->add_params("");
pMsg->add_params("");
pMsg->add_params("");
pMsg->add_params("");
#else
if ((pBitBuf = g_UserMsgs.StartBitBufMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
{
return false;
}
pBitBuf->WriteByte(dest);
pBitBuf->WriteString(msg);
#endif
g_UserMsgs.EndMessage();
@@ -422,10 +585,20 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
bool CHalfLife2::HintTextMsg(int client, const char *msg)
{
bf_write *pBitBuf = NULL;
cell_t players[] = {client};
if ((pBitBuf = g_UserMsgs.StartMessage(m_HinTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
#if SOURCE_ENGINE == SE_CSGO
CCSUsrMsg_HintText *pMsg;
if ((pMsg = (CCSUsrMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
{
return false;
}
pMsg->set_text(msg);
#else
bf_write *pBitBuf = NULL;
if ((pBitBuf = g_UserMsgs.StartBitBufMessage(m_HinTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
{
return false;
}
@@ -436,6 +609,7 @@ bool CHalfLife2::HintTextMsg(int client, const char *msg)
pBitBuf->WriteByte(1);
}
pBitBuf->WriteString(msg);
#endif
g_UserMsgs.EndMessage();
return true;
@@ -443,9 +617,18 @@ bool CHalfLife2::HintTextMsg(int client, const char *msg)
bool CHalfLife2::HintTextMsg(cell_t *players, int count, const char *msg)
{
#if SOURCE_ENGINE == SE_CSGO
CCSUsrMsg_HintText *pMsg;
if ((pMsg = (CCSUsrMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, count, USERMSG_RELIABLE)) == NULL)
{
return false;
}
pMsg->set_text(msg);
#else
bf_write *pBitBuf = NULL;
if ((pBitBuf = g_UserMsgs.StartMessage(m_HinTextMsg, players, count, USERMSG_RELIABLE)) == NULL)
if ((pBitBuf = g_UserMsgs.StartBitBufMessage(m_HinTextMsg, players, count, USERMSG_RELIABLE)) == NULL)
{
return false;
}
@@ -456,6 +639,8 @@ bool CHalfLife2::HintTextMsg(cell_t *players, int count, const char *msg)
pBitBuf->WriteByte(1);
}
pBitBuf->WriteString(msg);
#endif
g_UserMsgs.EndMessage();
return true;
@@ -463,15 +648,23 @@ bool CHalfLife2::HintTextMsg(cell_t *players, int count, const char *msg)
bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, bool show)
{
bf_write *pBitBuf = NULL;
KeyValues *SubKey = NULL;
int count = 0;
cell_t players[] = {client};
if ((pBitBuf = g_UserMsgs.StartMessage(m_VGUIMenu, players, 1, USERMSG_RELIABLE)) == NULL)
#if SOURCE_ENGINE == SE_CSGO
CCSUsrMsg_VGUIMenu *pMsg;
if ((pMsg = (CCSUsrMsg_VGUIMenu *)g_UserMsgs.StartProtobufMessage(m_VGUIMenu, players, 1, USERMSG_RELIABLE)) == NULL)
{
return false;
}
#else
bf_write *pBitBuf = NULL;
if ((pBitBuf = g_UserMsgs.StartBitBufMessage(m_VGUIMenu, players, 1, USERMSG_RELIABLE)) == NULL)
{
return false;
}
#endif
if (data)
{
@@ -484,6 +677,18 @@ bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, boo
SubKey = data->GetFirstSubKey();
}
#if SOURCE_ENGINE == SE_CSGO
pMsg->set_name(name);
pMsg->set_show(show);
while (SubKey)
{
CCSUsrMsg_VGUIMenu_Subkey *key = pMsg->add_subkeys();
key->set_name(SubKey->GetName());
key->set_str(SubKey->GetString());
SubKey = SubKey->GetNextKey();
}
#else
pBitBuf->WriteString(name);
pBitBuf->WriteByte((show) ? 1 : 0);
pBitBuf->WriteByte(count);
@@ -493,6 +698,8 @@ bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, boo
pBitBuf->WriteString(SubKey->GetString());
SubKey = SubKey->GetNextKey();
}
#endif
g_UserMsgs.EndMessage();
return true;
@@ -624,6 +831,14 @@ const char *CHalfLife2::CurrentCommandName()
void CHalfLife2::AddDelayedKick(int client, int userid, const char *msg)
{
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
if (!pPlayer || !pPlayer->IsConnected() || pPlayer->IsInKickQueue())
{
return;
}
pPlayer->MarkAsBeingKicked();
DelayedKickInfo kick;
kick.client = client;
@@ -728,6 +943,11 @@ cell_t CHalfLife2::EntityToReference(CBaseEntity *pEntity)
CBaseEntity *CHalfLife2::ReferenceToEntity(cell_t entRef)
{
if ((unsigned)entRef == INVALID_EHANDLE_INDEX)
{
return NULL;
}
CEntInfo *pInfo = NULL;
if (entRef & (1<<31))
@@ -737,7 +957,7 @@ CBaseEntity *CHalfLife2::ReferenceToEntity(cell_t entRef)
CBaseHandle hndl(hndlValue);
pInfo = LookupEntity(hndl.GetEntryIndex());
if (pInfo->m_SerialNumber != hndl.GetSerialNumber())
if (!pInfo || pInfo->m_SerialNumber != hndl.GetSerialNumber())
{
return NULL;
}
@@ -767,6 +987,12 @@ CBaseEntity *CHalfLife2::ReferenceToEntity(cell_t entRef)
*/
CEntInfo *CHalfLife2::LookupEntity(int entIndex)
{
// Make sure that our index is within the bounds of the global ent array
if (entIndex < 0 || entIndex >= NUM_ENT_ENTRIES)
{
return NULL;
}
if (!g_EntList || entInfoOffset == -1)
{
/* Attempt to use engine interface instead */
@@ -856,6 +1082,11 @@ cell_t CHalfLife2::EntityToBCompatRef(CBaseEntity *pEntity)
IServerUnknown *pUnknown = (IServerUnknown *)pEntity;
CBaseHandle hndl = pUnknown->GetRefEHandle();
if (hndl == INVALID_EHANDLE_INDEX)
{
return INVALID_EHANDLE_INDEX;
}
if (hndl.GetEntryIndex() >= MAX_EDICTS)
{
return (hndl.ToInt() | (1<<31));
@@ -888,3 +1119,88 @@ void *CHalfLife2::GetGlobalEntityList()
{
return g_EntList;
}
int CHalfLife2::GetSendPropOffset(SendProp *prop)
{
return prop->GetOffset();
}
const char *CHalfLife2::GetEntityClassname(edict_t * pEdict)
{
if (pEdict == NULL || pEdict->IsFree())
{
return NULL;
}
IServerUnknown *pUnk = pEdict->GetUnknown();
if (pUnk == NULL)
{
return NULL;
}
CBaseEntity * pEntity = pUnk->GetBaseEntity();
if (pEntity == NULL)
{
return NULL;
}
return GetEntityClassname(pEntity);
}
const char *CHalfLife2::GetEntityClassname(CBaseEntity *pEntity)
{
static int offset = -1;
if (offset == -1)
{
datamap_t *pMap = GetDataMap(pEntity);
typedescription_t *pDesc = FindInDataMap(pMap, "m_iClassname");
offset = GetTypeDescOffs(pDesc);
}
return *(const char **)(((unsigned char *)pEntity) + offset);
}
#if SOURCE_ENGINE >= SE_LEFT4DEAD
static bool ResolveFuzzyMapName(const char *fuzzyName, char *outFullname, int size)
{
static ConCommand *pHelperCmd = g_pCVar->FindCommand("changelevel");
if (!pHelperCmd || !pHelperCmd->CanAutoComplete())
return false;
static size_t helperCmdLen = strlen(pHelperCmd->GetName());
CUtlVector<CUtlString> results;
pHelperCmd->AutoCompleteSuggest(fuzzyName, results);
if (results.Count() == 0)
return false;
// Results come back as you'd see in autocomplete. (ie. "changelevel fullmapnamehere"),
// so skip ahead to start of map path/name
// Like the engine, we're only going to deal with the first match.
strncopy(outFullname, &results[0][helperCmdLen + 1], size);
return true;
}
#endif
bool CHalfLife2::IsMapValid(const char *map)
{
if (!map || !map[0])
return false;
bool ret = engine->IsMapValid(map);
#if SOURCE_ENGINE >= SE_LEFT4DEAD
if (!ret)
{
static char szFuzzyName[PLATFORM_MAX_PATH];
if (ResolveFuzzyMapName(map, szFuzzyName, sizeof(szFuzzyName)))
{
ret = engine->IsMapValid(szFuzzyName);
}
}
#endif
return ret;
}
+19
View File
@@ -44,6 +44,10 @@
#include <server_class.h>
#include <datamap.h>
#include <ihandleentity.h>
#include <tier0/icommandline.h>
#if SOURCE_ENGINE >= SE_PORTAL2
#include <string_t.h>
#endif
class CCommand;
@@ -87,6 +91,7 @@ struct DelayedKickInfo
char buffer[384];
};
// copy from game/shared/entitylist_base.h
class CEntInfo
{
public:
@@ -94,6 +99,10 @@ public:
int m_SerialNumber;
CEntInfo *m_pPrev;
CEntInfo *m_pNext;
#if SOURCE_ENGINE >= SE_PORTAL2
string_t m_iName;
string_t m_iClassName;
#endif
};
class CHalfLife2 :
@@ -114,6 +123,7 @@ public: //IGameHelpers
datamap_t *GetDataMap(CBaseEntity *pEntity);
ServerClass *FindServerClass(const char *classname);
typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset);
typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset, bool *isNested);
void SetEdictStateChanged(edict_t *pEdict, unsigned short offset);
bool TextMsg(int client, int dest, const char *msg);
bool HintTextMsg(int client, const char *msg);
@@ -135,6 +145,11 @@ public: //IGameHelpers
CEntInfo *LookupEntity(int entIndex);
cell_t EntityToBCompatRef(CBaseEntity *pEntity);
void *GetGlobalEntityList();
int GetSendPropOffset(SendProp *prop);
ICommandLine *GetValveCommandLine();
const char *GetEntityClassname(edict_t *pEdict);
const char *GetEntityClassname(CBaseEntity *pEntity);
bool IsMapValid(const char *map);
public:
void AddToFakeCliCmdQueue(int client, int userid, const char *cmd);
void ProcessFakeCliCmdQueue();
@@ -150,6 +165,9 @@ public:
#endif
private:
DataTableInfo *_FindServerClass(const char *classname);
private:
void InitLogicalEntData();
void InitCommandLine();
private:
Trie *m_pClasses;
List<DataTableInfo *> m_Tables;
@@ -162,6 +180,7 @@ private:
CStack<DelayedFakeCliCmd *> m_FreeCmds;
CStack<CachedCommandInfo> m_CommandStack;
Queue<DelayedKickInfo> m_DelayedKicks;
void *m_pGetCommandLine;
};
extern CHalfLife2 g_HL2;
+91 -41
View File
@@ -579,6 +579,7 @@ HandleError HandleSystem::CloneHandle(QHandle *pHandle, unsigned int index, Hand
}
pNewHandle->clone = index;
pNewHandle->object = NULL;
pHandle->refcount++;
*newhandle = new_handle;
@@ -620,8 +621,53 @@ HandleError HandleSystem::CloneHandle(Handle_t handle, Handle_t *newhandle, Iden
return CloneHandle(pHandle, index, newhandle, newOwner);
}
Handle_t HandleSystem::FastCloneHandle(QHandle *pHandle, unsigned int index)
{
if (pHandle->clone)
return FastCloneHandle(&m_Handles[pHandle->clone], pHandle->clone);
Handle_t hndl;
if (CloneHandle(pHandle, index, &hndl, g_pCoreIdent) != HandleError_None)
return BAD_HANDLE;
return hndl;
}
Handle_t HandleSystem::FastCloneHandle(Handle_t hndl)
{
QHandle *pHandle;
unsigned int index;
GetHandleUnchecked(hndl, pHandle, index);
return FastCloneHandle(pHandle, index);
}
void HandleSystem::GetHandleUnchecked(Handle_t hndl, QHandle *& pHandle, unsigned int &index)
{
#ifndef NDEBUG
unsigned int serial = (hndl >> 16);
#endif
index = (hndl & HANDLESYS_HANDLE_MASK);
assert(index != 0 && index <= m_HandleTail && index < HANDLESYS_MAX_HANDLES);
pHandle = &m_Handles[index];
assert(pHandle->set && pHandle->set != HandleSet_Freed);
assert(pHandle->serial == serial);
}
HandleError HandleSystem::FreeHandle(QHandle *pHandle, unsigned int index)
{
if (pHandle->is_destroying)
{
/* Someone tried to free this recursively.
* We'll just ignore this safely.
*/
return HandleError_None;
}
QHandleType *pType = &m_Types[pHandle->type];
if (pHandle->clone)
@@ -636,6 +682,7 @@ HandleError HandleSystem::FreeHandle(QHandle *pHandle, unsigned int index)
pMaster = &m_Handles[master];
/* Release the clone now */
pHandle->is_destroying = true;
ReleasePrimHandle(index);
/* Decrement the master's reference count */
@@ -644,20 +691,27 @@ HandleError HandleSystem::FreeHandle(QHandle *pHandle, unsigned int index)
/* Type should be the same but do this anyway... */
pType = &m_Types[pMaster->type];
pMaster->is_destroying = true;
pType->dispatch->OnHandleDestroy(pMaster->type, pMaster->object);
if (pMaster->object)
{
pType->dispatch->OnHandleDestroy(pMaster->type, pMaster->object);
}
ReleasePrimHandle(master);
}
} else if (pHandle->set == HandleSet_Identity) {
/* If we're an identity, skip all this stuff!
* NOTE: SHARESYS DOES NOT CARE ABOUT THE DESTRUCTOR
*/
pHandle->is_destroying = true;
ReleasePrimHandle(index);
} else {
/* Decrement, free if necessary */
if (--pHandle->refcount == 0)
{
pHandle->is_destroying = true;
pType->dispatch->OnHandleDestroy(pHandle->type, pHandle->object);
if (pHandle->object)
{
pType->dispatch->OnHandleDestroy(pHandle->type, pHandle->object);
}
ReleasePrimHandle(index);
} else {
/* We must be cloned, so mark ourselves as freed */
@@ -690,14 +744,6 @@ HandleError HandleSystem::FreeHandle(Handle_t handle, const HandleSecurity *pSec
return HandleError_Access;
}
if (pHandle->is_destroying)
{
/* Someone tried to free this recursively.
* We'll just ignore this safely.
*/
return HandleError_None;
}
return FreeHandle(pHandle, index);
}
@@ -756,6 +802,9 @@ void HandleSystem::UnlinkHandleFromOwner(QHandle *pHandle, unsigned int index)
assert(pHandle->owner == 0);
return;
}
pHandle->owner = NULL;
/* Note that since 0 is an invalid handle, if any of these links are 0,
* the data can still be set.
*/
@@ -880,29 +929,9 @@ bool HandleSystem::RemoveType(HandleType_t type, IdentityToken_t *ident)
{
continue;
}
if (pHandle->clone)
{
/* Get parent */
QHandle *pOther = &m_Handles[pHandle->clone];
if (--pOther->refcount == 0)
{
/* Free! */
dispatch->OnHandleDestroy(type, pOther->object);
ReleasePrimHandle(pHandle->clone);
}
/* Unlink ourselves since we don't have a reference count */
ReleasePrimHandle(i);
} else {
/* If it's not a clone, we still have to check the reference count.
* Either way, we'll be destroyed eventually because the handle types do not change.
*/
if (--pHandle->refcount == 0)
{
/* Free! */
dispatch->OnHandleDestroy(type, pHandle->object);
ReleasePrimHandle(i);
}
}
FreeHandle(pHandle, i);
if (pType->opened == 0)
{
break;
@@ -950,14 +979,17 @@ bool HandleSystem::InitAccessDefaults(TypeAccess *pTypeAccess, HandleAccess *pHa
return true;
}
#define HANDLE_LOG_VERY_BAD(message, ...) \
g_Logger.LogFatal(message, ##__VA_ARGS__); \
g_Logger.LogError(message, ##__VA_ARGS__);
bool HandleSystem::TryAndFreeSomeHandles()
{
IPluginIterator *pl_iter = g_PluginSys.GetPluginIterator();
IPlugin *highest_owner = NULL;
unsigned int highest_handle_count = 0;
/* Search all plugins */
while (pl_iter->MorePlugins())
for (IPluginIterator *pl_iter = g_PluginSys.GetPluginIterator(); pl_iter->MorePlugins(); pl_iter->NextPlugin())
{
IPlugin *plugin = pl_iter->GetPlugin();
IdentityToken_t *identity = plugin->GetIdentity();
@@ -986,8 +1018,6 @@ bool HandleSystem::TryAndFreeSomeHandles()
highest_owner = plugin;
highest_handle_count = handle_count;
}
pl_iter->NextPlugin();
}
if (highest_owner == NULL || highest_handle_count == 0)
@@ -995,9 +1025,9 @@ bool HandleSystem::TryAndFreeSomeHandles()
return false;
}
g_Logger.LogFatal("[SM] MEMORY LEAK DETECTED IN PLUGIN (file \"%s\")", highest_owner->GetFilename());
g_Logger.LogFatal("[SM] Unloading plugin to free %d handles.", highest_handle_count);
g_Logger.LogFatal("[SM] Contact the author(s) of this plugin to correct this error.", highest_handle_count);
HANDLE_LOG_VERY_BAD("[SM] MEMORY LEAK DETECTED IN PLUGIN (file \"%s\")", highest_owner->GetFilename());
HANDLE_LOG_VERY_BAD("[SM] Unloading plugin to free %d handles.", highest_handle_count);
HANDLE_LOG_VERY_BAD("[SM] Contact the author(s) of this plugin to correct this error.", highest_handle_count);
highest_owner->GetBaseContext()->ThrowNativeErrorEx(SP_ERROR_MEMACCESS, "Memory leak");
@@ -1054,12 +1084,32 @@ void HandleSystem::Dump(HANDLE_REPORTER rep)
const char *type = "ANON";
QHandleType *pType = &m_Types[m_Handles[i].type];
unsigned int size = 0;
unsigned int parentIdx;
bool bresult;
if (pType->nameIdx != -1)
{
type = m_strtab->GetString(pType->nameIdx);
}
if ((parentIdx = m_Handles[i].clone) != 0)
{
if (m_Handles[parentIdx].refcount > 0)
{
size = 0;
bresult = true;
}
else
{
bresult = pType->dispatch->GetHandleApproxSize(m_Handles[parentIdx].type, m_Handles[parentIdx].object, &size);
}
}
else
{
bresult = pType->dispatch->GetHandleApproxSize(m_Handles[i].type, m_Handles[i].object, &size);
}
if (pType->dispatch->GetDispatchVersion() < HANDLESYS_MEMUSAGE_MIN_VERSION
|| !pType->dispatch->GetHandleApproxSize(m_Handles[i].type, m_Handles[i].object, &size))
|| !bresult)
{
rep("0x%08x\t%-20.20s\t%-20.20s\t%-10.10s", index, owner, type, "-1");
}
+29
View File
@@ -160,6 +160,9 @@ public: //IHandleSystem
HandleError *err);
void Dump(HANDLE_REPORTER rep);
/* Bypasses security checks. */
Handle_t FastCloneHandle(Handle_t hndl);
protected:
/**
* Decodes a handle with sanity and security checking.
@@ -170,6 +173,9 @@ protected:
unsigned int *index,
bool ignoreFree=false);
Handle_t FastCloneHandle(QHandle *pHandle, unsigned int index);
void GetHandleUnchecked(Handle_t hndl, QHandle *& pHandle, unsigned int &index);
/**
* Creates a basic handle and sets its reference count to 1.
* Does not do any type or security checking.
@@ -222,4 +228,27 @@ private:
extern HandleSystem g_HandleSys;
struct AutoHandleRooter
{
public:
AutoHandleRooter(Handle_t hndl)
{
if (hndl != BAD_HANDLE)
this->hndl = g_HandleSys.FastCloneHandle(hndl);
else
this->hndl = BAD_HANDLE;
}
~AutoHandleRooter()
{
if (hndl != BAD_HANDLE)
{
HandleSecurity sec(g_pCoreIdent, g_pCoreIdent);
g_HandleSys.FreeHandle(hndl, &sec);
}
}
private:
Handle_t hndl;
};
#endif //_INCLUDE_SOURCEMOD_HANDLESYSTEM_H_
+2 -2
View File
@@ -241,7 +241,7 @@ bool LibrarySystem::IsPathDirectory(const char *path)
return true;
}
#elif defined PLATFORM_LINUX
#elif defined PLATFORM_POSIX
struct stat s;
if (stat(path, &s) != 0)
@@ -410,7 +410,7 @@ size_t LibrarySystem::GetFileFromPath(char *buffer, size_t maxlength, const char
size_t length = strlen(path);
for (size_t i = length - 1;
i >= 0 && i <= length - 1;
i <= length - 1;
i--)
{
if (path[i] == '/'
+9 -3
View File
@@ -149,7 +149,7 @@ void Logger::_NewMapFile()
} else {
char date[32];
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
fprintf(fp, "L %s: SourceMod log file started (file \"L%02d%02d%03d.log\") (Version \"%s\")\n", date, curtime->tm_mon + 1, curtime->tm_mday, i, SM_FULL_VERSION);
fprintf(fp, "L %s: SourceMod log file started (file \"L%02d%02d%03d.log\") (Version \"%s\")\n", date, curtime->tm_mon + 1, curtime->tm_mday, i, SM_VERSION_STRING);
fclose(fp);
}
}
@@ -265,6 +265,8 @@ void Logger::LogToOpenFileEx(FILE *fp, const char *msg, va_list ap)
return;
}
static ConVar *sv_logecho = icvar->FindVar("sv_logecho");
char buffer[3072];
UTIL_FormatArgs(buffer, sizeof(buffer), msg, ap);
@@ -275,7 +277,11 @@ void Logger::LogToOpenFileEx(FILE *fp, const char *msg, va_list ap)
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
fprintf(fp, "L %s: %s\n", date, buffer);
g_SMAPI->ConPrintf("L %s: %s\n", date, buffer);
if (!sv_logecho || sv_logecho->GetBool())
{
g_SMAPI->ConPrintf("L %s: %s\n", date, buffer);
}
}
void Logger::LogToFileOnlyEx(FILE *fp, const char *msg, va_list ap)
@@ -356,7 +362,7 @@ void Logger::LogMessage(const char *vafmt, ...)
char date[32];
m_DailyPrintHdr = false;
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
fprintf(fp, "L %s: SourceMod log file session started (file \"L%04d%02d%02d.log\") (Version \"%s\")\n", date, curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday, SM_FULL_VERSION);
fprintf(fp, "L %s: SourceMod log file session started (file \"L%04d%02d%02d.log\") (Version \"%s\")\n", date, curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday, SM_VERSION_STRING);
}
va_list ap;
va_start(ap, vafmt);
+89 -54
View File
@@ -2,32 +2,32 @@
# Makefile written by David "BAILOPAN" Anderson
SMSDK = ..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../hl2sdk
HL2SDK_OB = ../../hl2sdk-ob
HL2SDK_CSS = ../../hl2sdk-css
HL2SDK_OB_VALVE = ../../hl2sdk-ob-valve
HL2SDK_L4D = ../../hl2sdk-l4d
HL2SDK_L4D2 = ../../hl2sdk-l4d2
MMSOURCE17 = ../../mmsource-central
HL2SDK_CSGO = ../../hl2sdk-csgo
MMSOURCE = ../../mmsource-central
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
#####################################
OBJECTS = AdminCache.cpp CDataPack.cpp ConCmdManager.cpp ConVarManager.cpp CoreConfig.cpp \
Database.cpp DebugReporter.cpp EventManager.cpp GameConfigs.cpp HalfLife2.cpp Logger.cpp \
MemoryUtils.cpp PlayerManager.cpp TimerSys.cpp Translator.cpp UserMessages.cpp \
sm_autonatives.cpp sm_memtable.cpp sm_srvcmds.cpp sm_stringutil.cpp sm_trie.cpp \
Database.cpp DebugReporter.cpp EventManager.cpp HalfLife2.cpp Logger.cpp \
PlayerManager.cpp TimerSys.cpp UserMessages.cpp \
sm_autonatives.cpp sm_srvcmds.cpp sm_stringutil.cpp sm_trie.cpp \
sourcemm_api.cpp sourcemod.cpp MenuStyle_Base.cpp MenuStyle_Valve.cpp MenuManager.cpp \
MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp sm_crc32.cpp \
frame_hooks.cpp concmd_cleaner.cpp PhraseCollection.cpp NextMap.cpp \
MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp \
frame_hooks.cpp concmd_cleaner.cpp NextMap.cpp \
NativeOwner.cpp logic_bridge.cpp ConsoleDetours.cpp
OBJECTS += smn_admin.cpp smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
smn_datapacks.cpp smn_entities.cpp smn_events.cpp smn_fakenatives.cpp \
smn_filesystem.cpp smn_gameconfigs.cpp smn_halflife.cpp \
smn_handles.cpp smn_keyvalues.cpp smn_banning.cpp \
smn_lang.cpp smn_player.cpp smn_string.cpp smn_timers.cpp \
smn_usermsgs.cpp smn_menus.cpp smn_database.cpp smn_vector.cpp \
OBJECTS += smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
smn_database.cpp smn_entities.cpp smn_events.cpp \
smn_fakenatives.cpp smn_filesystem.cpp smn_halflife.cpp \
smn_keyvalues.cpp smn_player.cpp \
smn_usermsgs.cpp smn_menus.cpp smn_vector.cpp \
smn_hudtext.cpp smn_nextmap.cpp
OBJECTS += ExtensionSys.cpp \
ForwardSys.cpp \
@@ -49,80 +49,119 @@ CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
CPP = gcc
override ENGSET = false
ifneq (,$(filter original orangebox css orangeboxvalve left4dead left4dead2 csgo,$(ENGINE)))
override ENGSET = true
endif
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=1
METAMOD = $(MMSOURCE17)/core-legacy
METAMOD = $(MMSOURCE)/core-legacy
INCLUDE += -I$(HL2SDK)/public/dlls
SRCDS = $(SRCDS_BASE)
BINARY = sourcemod.1.ep1.so
override ENGSET = true
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(MMSOURCE17)/core
METAMOD = $(MMSOURCE)/core
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/orangebox
BINARY = sourcemod.2.ep2.so
override ENGSET = true
endif
ifeq "$(ENGINE)" "css"
HL2SDK = $(HL2SDK_CSS)
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=6
METAMOD = $(MMSOURCE)/core
INCLUDE += -I$(HL2SDK)/public/game/server
BINARY = sourcemod.2.css.so
endif
ifeq "$(ENGINE)" "orangeboxvalve"
HL2SDK = $(HL2SDK_OB_VALVE)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(MMSOURCE17)/core
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common
SRCDS = $(SRCDS_BASE)/orangebox
CFLAGS += -DSOURCE_ENGINE=7
METAMOD = $(MMSOURCE)/core
INCLUDE += -I$(HL2SDK)/public/game/server
BINARY = sourcemod.2.ep2v.so
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=5
METAMOD = $(MMSOURCE17)/core
CFLAGS += -DSOURCE_ENGINE=8
METAMOD = $(MMSOURCE)/core
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/l4d
BINARY = sourcemod.2.l4d.so
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead2"
HL2SDK = $(HL2SDK_L4D2)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=6
METAMOD = $(MMSOURCE17)/core
CFLAGS += -DSOURCE_ENGINE=9
METAMOD = $(MMSOURCE)/core
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/left4dead2
BINARY = sourcemod.2.l4d2.so
override ENGSET = true
endif
ifeq "$(ENGINE)" "csgo"
HL2SDK = $(HL2SDK_CSGO)
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=12
METAMOD = $(MMSOURCE)/core
INCLUDE += -I$(HL2SDK)/public/game/server
BINARY = sourcemod.2.csgo.so
endif
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_ORANGEBOXVALVE=4 -DSE_LEFT4DEAD=5 -DSE_LEFT4DEAD2=6
HL2PUB = $(HL2SDK)/public
ifeq "$(ENGINE)" "left4dead2"
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a libvstdlib.so \
libtier0.so -static-libgcc
OS := $(shell uname -s)
ifeq "$(OS)" "Darwin"
LIB_EXT = dylib
HL2LIB = $(HL2SDK)/lib/mac
else
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a vstdlib_i486.so \
tier0_i486.so -static-libgcc
LIB_EXT = so
ifeq "$(ENGINE)" "original"
HL2LIB = $(HL2SDK)/linux_sdk
else
HL2LIB = $(HL2SDK)/lib/linux
endif
endif
ifneq (,$(filter original orangebox left4dead,$(ENGINE)))
LIB_SUFFIX = _i486.$(LIB_EXT)
else
LIB_PREFIX = lib
ifneq (,$(filter orangeboxvalve css,$(ENGINE)))
ifneq "$(OS)" "Darwin"
LIB_SUFFIX = _srv.$(LIB_EXT)
else
LIB_SUFFIX = .$(LIB_EXT)
endif
else
LIB_SUFFIX = .$(LIB_EXT)
endif
endif
CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 \
-DSE_CSS=6 -DSE_ORANGEBOXVALVE=7 -DSE_LEFT4DEAD=8 -DSE_LEFT4DEAD2=9 -DSE_ALIENSWARM=10 \
-DSE_PORTAL2=11 -DSE_CSGO=12
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a $(LIB_PREFIX)vstdlib$(LIB_SUFFIX) \
$(LIB_PREFIX)tier0$(LIB_SUFFIX) -static-libgcc
ifeq "$(ENGINE)" "csgo"
LINK += $(HL2LIB)/interfaces_i486.a
endif
INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \
-I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook \
-I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
CFLAGS += -D_LINUX -DPOSIX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror \
-Wno-uninitialized -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H -DSM_DEFAULT_THREADER -m32
CPPFLAGS += -Wno-non-virtual-dtor -fno-exceptions -fno-rtti
-Wno-uninitialized -Wno-unused -Wno-switch -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H \
-DSM_DEFAULT_THREADER -m32 -DCOMPILER_GCC
CPPFLAGS += -Wno-non-virtual-dtor -Wno-overloaded-virtual -fno-threadsafe-statics -fno-exceptions -fno-rtti
################################################
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
@@ -153,18 +192,14 @@ $(BIN_DIR)/%.o: %.c
all: check
mkdir -p $(BIN_DIR)
ifeq "$(ENGINE)" "left4dead2"
ln -sf $(SRCDS)/bin/libvstdlib.so libvstdlib.so;
ln -sf $(SRCDS)/bin/libtier0.so libtier0.so;
else
ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so;
ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so;
endif
ln -sf $(HL2LIB)/$(LIB_PREFIX)vstdlib$(LIB_SUFFIX)
ln -sf $(HL2LIB)/$(LIB_PREFIX)tier0$(LIB_SUFFIX)
$(MAKE) -f Makefile sourcemod
check:
if [ "$(ENGSET)" = "false" ]; then \
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
echo "You must supply one of the following values for ENGINE:"; \
echo "csgo, left4dead2, left4dead, orangeboxvalve, css, orangebox, or original"; \
exit 1; \
fi
+25 -5
View File
@@ -41,7 +41,7 @@
#include "ShareSys.h"
#include "HandleSys.h"
#include "sourcemm_api.h"
#include "Translator.h"
#include "logic_bridge.h"
MenuManager g_Menus;
VoteMenuHandler s_VoteHandler;
@@ -231,6 +231,7 @@ IMenuPanel *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder ord
unsigned int pgn = menu->GetPagination();
unsigned int maxItems = style->GetMaxPageItems();
bool exitButton = (menu->GetMenuOptionFlags() & MENUFLAG_BUTTON_EXIT) == MENUFLAG_BUTTON_EXIT;
bool novoteButton = (menu->GetMenuOptionFlags() & MENUFLAG_BUTTON_NOVOTE) == MENUFLAG_BUTTON_NOVOTE;
if (pgn != MENU_NO_PAGINATION)
{
@@ -241,6 +242,11 @@ IMenuPanel *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder ord
maxItems--;
}
if (novoteButton)
{
maxItems--;
}
/* This is very not allowed! */
if (maxItems < 2)
{
@@ -436,6 +442,20 @@ skip_search:
/* Draw the item according to the order */
menu_slots_t *slots = md.slots;
unsigned int position = 0; /* Keep track of the last position */
if (novoteButton)
{
char text[50];
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "No Vote", &client))
{
UTIL_Format(text, sizeof(text), "No Vote");
}
ItemDrawInfo dr(text, 0);
position = panel->DrawItem(dr);
slots[position].type = ItemSel_Exit;
position++;
}
if (order == ItemOrder_Ascending)
{
md.item_on_page = drawItems[0].position;
@@ -586,7 +606,7 @@ skip_search:
{
if (exitBackButton)
{
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Back", &client))
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Back", &client))
{
UTIL_Format(text, sizeof(text), "Back");
}
@@ -596,7 +616,7 @@ skip_search:
}
else
{
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Previous", &client))
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Previous", &client))
{
UTIL_Format(text, sizeof(text), "Previous");
}
@@ -617,7 +637,7 @@ skip_search:
/* NEXT */
if (displayNext || canDrawDisabled)
{
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Next", &client))
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Next", &client))
{
UTIL_Format(text, sizeof(text), "Next");
}
@@ -648,7 +668,7 @@ skip_search:
/* EXIT */
if (exitButton)
{
if (!CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Exit", &client))
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Exit", &client))
{
UTIL_Format(text, sizeof(text), "Exit");
}
+13 -1
View File
@@ -322,15 +322,24 @@ void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
if (pCollideable)
{
const Vector & pos = pCollideable->GetCollisionOrigin();
enginesound->EmitSound(filter,
client,
CHAN_AUTO,
#if SOURCE_ENGINE >= SE_PORTAL2
sound,
-1,
#endif
sound,
VOL_NORM,
ATTN_NORM,
#if SOURCE_ENGINE >= SE_PORTAL2
0,
#endif
0,
PITCH_NORM,
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
0,
#endif
&pos);
}
}
@@ -377,6 +386,9 @@ void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
RemoveClientFromWatch(client);
}
Handle_t hndl = menu ? menu->GetHandle() : BAD_HANDLE;
AutoHandleRooter ahr(hndl);
if (cancel)
{
mh->OnMenuCancel(menu, client, reason);
+66 -5
View File
@@ -32,11 +32,20 @@
#include "MenuStyle_Radio.h"
#include "sm_stringutil.h"
#include "UserMessages.h"
#include "GameConfigs.h"
#include <IGameConfigs.h>
#include "PlayerManager.h"
#if defined MENU_DEBUG
#include "Logger.h"
#endif
#include "logic_bridge.h"
#ifdef USE_PROTOBUF_USERMESSAGES
#include <google/protobuf/descriptor.h>
#endif
#if SOURCE_ENGINE == SE_CSGO
#include <game/shared/csgo/protobuf/cstrike15_usermessages.pb.h>
#endif
extern const char *g_RadioNumTable[];
CRadioStyle g_RadioMenuStyle;
@@ -44,6 +53,14 @@ int g_ShowMenuId = -1;
bool g_bRadioInit = false;
unsigned int g_RadioMenuTimeout = 0;
// back, next, exit
#define MAX_PAGINATION_OPTIONS 3
#define MAX_MENUSLOT_KEYS 10
static unsigned int s_RadioMaxPageItems = MAX_MENUSLOT_KEYS;
CRadioStyle::CRadioStyle()
{
m_players = new CRadioMenuPlayer[256+1];
@@ -89,6 +106,18 @@ void CRadioStyle::OnSourceModLevelChange(const char *mapName)
g_RadioMenuTimeout = 0;
}
const char *items = g_pGameConf->GetKeyValue("RadioMenuMaxPageItems");
if (items != NULL)
{
int value = atoi(items);
// Only override the mostly-safe default if it's a sane value
if (value > MAX_PAGINATION_OPTIONS && value <= MAX_MENUSLOT_KEYS)
{
s_RadioMaxPageItems = value;
}
}
g_Menus.AddStyle(this);
g_Menus.SetDefaultStyle(this);
@@ -134,13 +163,22 @@ static unsigned int g_last_holdtime = 0;
static unsigned int g_last_client_count = 0;
static int g_last_clients[256];
#ifdef USE_PROTOBUF_USERMESSAGES
void CRadioStyle::OnUserMessage(int msg_id, protobuf::Message &msg, IRecipientFilter *pFilter)
#else
void CRadioStyle::OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter)
#endif
{
int count = pFilter->GetRecipientCount();
#ifdef USE_PROTOBUF_USERMESSAGES
int c = ((CCSUsrMsg_ShowMenu &)msg).display_time();
#else
bf_read br(bf->GetBasePointer(), 3);
br.ReadWord();
int c = br.ReadChar();
#endif
g_last_holdtime = (c == -1) ? 0 : (unsigned)c;
@@ -188,7 +226,7 @@ IBaseMenu *CRadioStyle::CreateMenu(IMenuHandler *pHandler, IdentityToken_t *pOwn
unsigned int CRadioStyle::GetMaxPageItems()
{
return 10;
return s_RadioMaxPageItems;
}
const char *CRadioStyle::GetStyleName()
@@ -306,7 +344,7 @@ unsigned int CRadioDisplay::GetCurrentKey()
bool CRadioDisplay::SetCurrentKey(unsigned int key)
{
if (key < m_NextPos || m_NextPos > 10)
if (key < m_NextPos || m_NextPos > s_RadioMaxPageItems)
{
return false;
}
@@ -342,7 +380,7 @@ void CRadioDisplay::DrawTitle(const char *text, bool onlyIfEmpty/* =false */)
unsigned int CRadioDisplay::DrawItem(const ItemDrawInfo &item)
{
if (m_NextPos > 10 || !CanDrawItem(item.style))
if (m_NextPos > s_RadioMaxPageItems || !CanDrawItem(item.style))
{
return 0;
}
@@ -451,6 +489,15 @@ void CRadioMenuPlayer::Radio_Refresh()
time = menuHoldTime - (unsigned int)(gpGlobals->curtime - menuStartTime);
}
#ifdef USE_PROTOBUF_USERMESSAGES
// If or when we need to support multiple games per engine with this, we can switch to reflection
// TODO: find what happens past 240 on CS:GO
CCSUsrMsg_ShowMenu *msg = (CCSUsrMsg_ShowMenu *)g_UserMsgs.StartProtobufMessage(g_ShowMenuId, players, 1, USERMSG_BLOCKHOOKS);
msg->set_bits_valid_slots(display_keys);
msg->set_display_time(time);
msg->set_menu_string(ptr);
g_UserMsgs.EndMessage();
#else
while (true)
{
if (len > 240)
@@ -458,7 +505,8 @@ void CRadioMenuPlayer::Radio_Refresh()
save = ptr[240];
ptr[240] = '\0';
}
bf_write *buffer = g_UserMsgs.StartMessage(g_ShowMenuId, players, 1, USERMSG_BLOCKHOOKS);
bf_write *buffer = g_UserMsgs.StartBitBufMessage(g_ShowMenuId, players, 1, USERMSG_BLOCKHOOKS);
buffer->WriteWord(display_keys);
buffer->WriteChar(time ? time : -1);
buffer->WriteByte( (len > 240) ? 1 : 0 );
@@ -475,6 +523,7 @@ void CRadioMenuPlayer::Radio_Refresh()
break;
}
}
#endif
display_last_refresh = gpGlobals->curtime;
}
@@ -510,6 +559,7 @@ unsigned int CRadioDisplay::GetApproxMemUsage()
CRadioMenu::CRadioMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner) :
CBaseMenu(pHandler, &g_RadioMenuStyle, pOwner)
{
m_Pagination = s_RadioMaxPageItems - MAX_PAGINATION_OPTIONS;
}
bool CRadioMenu::SetExtOption(MenuOption option, const void *valuePtr)
@@ -550,6 +600,17 @@ bool CRadioMenu::DisplayAtItem(int client,
time);
}
bool CRadioMenu::SetPagination(unsigned int itemsPerPage)
{
const unsigned int maxPerPage = s_RadioMaxPageItems - MAX_PAGINATION_OPTIONS;
if (itemsPerPage > maxPerPage)
{
return false;
}
return CBaseMenu::SetPagination(itemsPerPage);
}
void CRadioMenu::Cancel_Finally()
{
g_RadioMenuStyle.CancelMenu(this);
+11 -2
View File
@@ -37,7 +37,7 @@
#include "MenuStyle_Base.h"
#include "sourcemm_api.h"
#include <IPlayerHelpers.h>
#include <IUserMessages.h>
#include "UserMessages.h"
#include "sm_fastlink.h"
#include <sh_stack.h>
#include <compat_wrappers.h>
@@ -65,7 +65,11 @@ private:
class CRadioStyle :
public BaseMenuStyle,
public SMGlobalClass,
public IUserMessageListener
#ifdef USE_PROTOBUF_USERMESSAGES
public IProtobufUserMessageListener
#else
public IBitBufUserMessageListener
#endif
{
public:
CRadioStyle();
@@ -84,7 +88,11 @@ public: //IMenuStyle
unsigned int GetMaxPageItems();
unsigned int GetApproxMemUsage();
public: //IUserMessageListener
#ifdef USE_PROTOBUF_USERMESSAGES
void OnUserMessage(int msg_id, protobuf::Message &msg, IRecipientFilter *pFilter);
#else
void OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter);
#endif
void OnUserMessageSent(int msg_id);
public:
bool IsSupported();
@@ -142,6 +150,7 @@ public:
unsigned int time,
unsigned int start_item,
IMenuHandler *alt_handler/* =NULL */);
bool SetPagination(unsigned int itemsPerPage);
void Cancel_Finally();
unsigned int GetApproxMemUsage();
};
-1
View File
@@ -32,7 +32,6 @@
#include "sm_stringutil.h"
#include "PlayerManager.h"
#include "MenuStyle_Valve.h"
#include "Translator.h"
#include "PlayerManager.h"
#include "ConCmdManager.h"
+13 -8
View File
@@ -39,7 +39,8 @@
#include <HalfLife2.h>
#include <mathlib.h>
#include <const.h>
#include <Translator.h>
#include <ITranslator.h>
#include "logic_bridge.h"
float g_next_vote = 0.0f;
@@ -517,7 +518,7 @@ void VoteMenuHandler::OnMenuSelect(IBaseMenu *menu, int client, unsigned int ite
m_Votes[item]++;
m_NumVotes++;
if (sm_vote_chat.GetBool() || sm_vote_console.GetBool())
if (sm_vote_chat.GetBool() || sm_vote_console.GetBool() || sm_vote_client_console.GetBool())
{
static char buffer[1024];
ItemDrawInfo dr;
@@ -526,7 +527,8 @@ void VoteMenuHandler::OnMenuSelect(IBaseMenu *menu, int client, unsigned int ite
if (sm_vote_console.GetBool())
{
int target = SOURCEMOD_SERVER_LANGUAGE;
CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Voted For", &target, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
logicore.CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Voted For",
&target, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
Engine_LogPrintWrapper(buffer);
}
@@ -538,15 +540,17 @@ void VoteMenuHandler::OnMenuSelect(IBaseMenu *menu, int client, unsigned int ite
CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
assert(pPlayer);
if (pPlayer->IsInGame())
if (pPlayer->IsInGame() && !pPlayer->IsFakeClient())
{
if (m_Revoting[client])
{
CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Changed Vote", &i, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
logicore.CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Changed Vote",
&i, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
}
else
{
CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Voted For", &i, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
logicore.CoreTranslate(buffer, sizeof(buffer), "[SM] %T", 4, NULL, "Voted For",
&i, g_Players.GetPlayerByIndex(client)->GetName(), dr.display);
}
if (sm_vote_chat.GetBool())
@@ -556,7 +560,7 @@ void VoteMenuHandler::OnMenuSelect(IBaseMenu *menu, int client, unsigned int ite
if (sm_vote_client_console.GetBool())
{
engine->ClientPrintf(pPlayer->GetEdict(), buffer);
ClientConsolePrint(pPlayer->GetEdict(), buffer);
}
}
}
@@ -634,7 +638,8 @@ void VoteMenuHandler::DrawHintProgress()
{
if (g_Players.GetPlayerByIndex(i)->IsInGame())
{
CoreTranslate(buffer, sizeof(buffer), "%T%s", 6, NULL, "Vote Count", &i, &m_NumVotes, &m_TotalClients, &iTimeRemaining, &m_leaderList);
logicore.CoreTranslate(buffer, sizeof(buffer), "%T%s", 6, NULL, "Vote Count",
&i, &m_NumVotes, &m_TotalClients, &iTimeRemaining, &m_leaderList);
g_HL2.HintTextMsg(i, buffer);
}
}
+6 -5
View File
@@ -31,6 +31,7 @@
#include "NextMap.h"
#include "Logger.h"
#include "HalfLife2.h"
#include "sourcemm_api.h"
#include "sm_stringutil.h"
#include "sourcehook.h"
@@ -109,7 +110,7 @@ const char *NextMapManager::GetNextMap()
bool NextMapManager::SetNextMap(const char *map)
{
if (!engine->IsMapValid(map))
if (!g_HL2.IsMapValid(map))
{
return false;
}
@@ -133,7 +134,7 @@ void NextMapManager::HookChangeLevel(const char *map, const char *unknown, const
const char *newmap = sm_nextmap.GetString();
if (newmap[0] == 0 || !engine->IsMapValid(newmap))
if (newmap[0] == 0 || !g_HL2.IsMapValid(newmap))
{
RETURN_META(MRES_IGNORED);
}
@@ -183,14 +184,14 @@ void NextMapManager::OnSourceModLevelChange( const char *mapName )
m_tempChangeInfo.m_mapName[0] ='\0';
m_tempChangeInfo.m_changeReason[0] = '\0';
m_tempChangeInfo.startTime = time(NULL);
UTIL_Format(lastMap, sizeof(lastMap), mapName);
UTIL_Format(lastMap, sizeof(lastMap), "%s", 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);
UTIL_Format(m_tempChangeInfo.m_mapName, sizeof(m_tempChangeInfo.m_mapName), "%s", mapName);
UTIL_Format(m_tempChangeInfo.m_changeReason, sizeof(m_tempChangeInfo.m_changeReason), "%s", changeReason);
/* Change level and skip our hook */
g_forcedChange = true;
+1 -1
View File
@@ -53,7 +53,7 @@ struct MapChangeData
startTime = 0;
}
char m_mapName[32];
char m_mapName[PLATFORM_MAX_PATH];
char m_changeReason[100];
time_t startTime;
};
+267 -65
View File
@@ -39,23 +39,23 @@
#include "sm_stringutil.h"
#include "CoreConfig.h"
#include "TimerSys.h"
#include "Translator.h"
#include "Logger.h"
#include "ChatTriggers.h"
#include "HalfLife2.h"
#include <inetchannel.h>
#include <iclient.h>
#include "GameConfigs.h"
#include <IGameConfigs.h>
#include "ExtensionSys.h"
#include <sourcemod_version.h>
#include "ConsoleDetours.h"
#include "logic_bridge.h"
PlayerManager g_Players;
bool g_OnMapStarted = false;
IForward *PreAdminCheck = NULL;
IForward *PostAdminCheck = NULL;
IForward *PostAdminFilter = NULL;
IForward *OnClientConnected = NULL;
const unsigned int *g_NumPlayersToAuth = NULL;
int lifestate_offset = -1;
List<ICommandTargetProcessor *> target_processors;
@@ -113,6 +113,11 @@ PlayerManager::PlayerManager()
m_FirstPass = false;
m_maxClients = 0;
m_SourceTVUserId = -1;
m_ReplayUserId = -1;
m_bAuthstringValidation = false; // don't use steam auth by default... yet
m_UserIdLookUp = new int[USHRT_MAX+1];
memset(m_UserIdLookUp, 0, sizeof(int) * (USHRT_MAX+1));
}
@@ -142,6 +147,7 @@ void PlayerManager::OnSourceModAllInitialized()
ParamType p2[] = {Param_Cell};
m_clconnect = g_Forwards.CreateForward("OnClientConnect", ET_LowEvent, 3, p1);
m_clconnect_post = g_Forwards.CreateForward("OnClientConnected", ET_Ignore, 1, p2);
m_clputinserver = g_Forwards.CreateForward("OnClientPutInServer", ET_Ignore, 1, p2);
m_cldisconnect = g_Forwards.CreateForward("OnClientDisconnect", ET_Ignore, 1, p2);
m_cldisconnect_post = g_Forwards.CreateForward("OnClientDisconnect_Post", ET_Ignore, 1, p2);
@@ -150,7 +156,6 @@ void PlayerManager::OnSourceModAllInitialized()
m_clauth = g_Forwards.CreateForward("OnClientAuthorized", ET_Ignore, 2, NULL, Param_Cell, Param_String);
m_onActivate = g_Forwards.CreateForward("OnServerLoad", ET_Ignore, 0, NULL);
m_onActivate2 = g_Forwards.CreateForward("OnMapStart", ET_Ignore, 0, NULL);
OnClientConnected = g_Forwards.CreateForward("OnClientConnected", ET_Ignore, 1, p2);
PreAdminCheck = g_Forwards.CreateForward("OnClientPreAdminCheck", ET_Event, 1, p1);
PostAdminCheck = g_Forwards.CreateForward("OnClientPostAdminCheck", ET_Ignore, 1, p1);
@@ -159,8 +164,6 @@ void PlayerManager::OnSourceModAllInitialized()
m_bIsListenServer = !engine->IsDedicatedServer();
m_ListenClient = 0;
g_ConVarManager.AddConVarChangeListener("tv_enable", this);
ConCommand *pCmd = FindCommand("maxplayers");
if (pCmd != NULL)
{
@@ -172,6 +175,7 @@ void PlayerManager::OnSourceModAllInitialized()
void PlayerManager::OnSourceModShutdown()
{
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverClients, this, &PlayerManager::OnClientConnect, false);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientConnect, serverClients, this, &PlayerManager::OnClientConnect_Post, true);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientPutInServer, serverClients, this, &PlayerManager::OnClientPutInServer, true);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverClients, this, &PlayerManager::OnClientDisconnect, false);
SH_REMOVE_HOOK_MEMFUNC(IServerGameClients, ClientDisconnect, serverClients, this, &PlayerManager::OnClientDisconnect_Post, true);
@@ -181,6 +185,7 @@ void PlayerManager::OnSourceModShutdown()
/* Release forwards */
g_Forwards.ReleaseForward(m_clconnect);
g_Forwards.ReleaseForward(m_clconnect_post);
g_Forwards.ReleaseForward(m_clputinserver);
g_Forwards.ReleaseForward(m_cldisconnect);
g_Forwards.ReleaseForward(m_cldisconnect_post);
@@ -189,7 +194,6 @@ void PlayerManager::OnSourceModShutdown()
g_Forwards.ReleaseForward(m_clauth);
g_Forwards.ReleaseForward(m_onActivate);
g_Forwards.ReleaseForward(m_onActivate2);
g_Forwards.ReleaseForward(OnClientConnected);
g_Forwards.ReleaseForward(PreAdminCheck);
g_Forwards.ReleaseForward(PostAdminCheck);
@@ -197,8 +201,6 @@ void PlayerManager::OnSourceModShutdown()
delete [] m_Players;
g_ConVarManager.RemoveConVarChangeListener("tv_enable", this);
if (maxplayersCmd != NULL)
{
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, maxplayersCmd, CmdMaxplayersCallback, true);
@@ -229,16 +231,43 @@ ConfigResult PlayerManager::OnSourceModConfigChanged(const char *key,
return ConfigResult_Reject;
}
return ConfigResult_Accept;
} else if (strcmp( key, "SteamAuthstringValidation" ) == 0) {
if (strcasecmp(value, "yes") == 0)
{
m_bAuthstringValidation = true;
} else if ( strcasecmp(value, "no") == 0) {
m_bAuthstringValidation = false;
} else {
UTIL_Format(error, maxlength, "Invalid value: must be \"yes\" or \"no\"");
return ConfigResult_Reject;
}
return ConfigResult_Accept;
}
return ConfigResult_Ignore;
}
void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
{
static ConVar *tv_enable = icvar->FindVar("tv_enable");
#if SOURCE_ENGINE == SE_TF2
static ConVar *replay_enable = icvar->FindVar("replay_enable");
#endif
// clientMax will not necessarily be correct here (such as on late SourceTV enable)
m_maxClients = gpGlobals->maxClients;
ICommandLine *commandLine = g_HL2.GetValveCommandLine();
m_bIsSourceTVActive = (tv_enable && tv_enable->GetBool() && (!commandLine || commandLine->FindParm("-nohltv") == 0));
m_bIsReplayActive = false;
#if SOURCE_ENGINE == SE_TF2
m_bIsReplayActive = (replay_enable && replay_enable->GetBool());
#endif
m_PlayersSinceActive = 0;
if (!m_FirstPass)
{
/* Initialize all players */
m_maxClients = clientMax;
m_PlayerCount = 0;
m_Players = new CPlayer[ABSOLUTE_PLAYER_LIMIT + 1];
m_AuthQueue = new unsigned int[ABSOLUTE_PLAYER_LIMIT + 1];
@@ -247,10 +276,13 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
memset(m_AuthQueue, 0, sizeof(unsigned int) * (ABSOLUTE_PLAYER_LIMIT + 1));
g_NumPlayersToAuth = &m_AuthQueue[0];
g_PluginSys.SyncMaxClients(clientMax);
}
g_Extensions.CallOnCoreMapStart(pEdictList, edictCount, clientMax);
g_PluginSys.SyncMaxClients(m_maxClients);
g_OnMapStarted = true;
g_Extensions.CallOnCoreMapStart(pEdictList, edictCount, m_maxClients);
m_onActivate->Execute(NULL);
m_onActivate2->Execute(NULL);
@@ -259,12 +291,10 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
{
if ((*iter)->GetClientListenerVersion() >= 5)
{
(*iter)->OnServerActivated(clientMax);
(*iter)->OnServerActivated(m_maxClients);
}
}
g_OnMapStarted = true;
SMGlobalClass *cls = SMGlobalClass::head;
while (cls)
{
@@ -337,11 +367,18 @@ void PlayerManager::RunAuthChecks()
{
pPlayer = &m_Players[m_AuthQueue[i]];
authstr = engine->GetPlayerNetworkIDString(pPlayer->m_pEdict);
pPlayer->SetAuthString(authstr);
if (!pPlayer->IsAuthStringValidated())
{
continue; // we're using steam auth, and steam doesn't know about this player yet so we can't do anything about them for now
}
if (authstr && authstr[0] != '\0'
&& (strcmp(authstr, "STEAM_ID_PENDING") != 0))
{
/* Set authorization */
pPlayer->Authorize(authstr);
pPlayer->Authorize();
/* Mark as removed from queue */
unsigned int client = m_AuthQueue[i];
@@ -410,7 +447,23 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
{
int client = IndexOfEdict(pEntity);
CPlayer *pPlayer = &m_Players[client];
++m_PlayersSinceActive;
pPlayer->Initialize(pszName, pszAddress, pEntity);
/* Get the client's language */
if (m_QueryLang)
{
const char *name;
if (!pPlayer->IsFakeClient() && (name=engine->GetClientConVarValue(client, "cl_language")))
{
unsigned int langid;
pPlayer->m_LangId = (translator->GetLanguageByName(name, &langid)) ? langid : translator->GetServerLanguage();
} else {
pPlayer->m_LangId = translator->GetServerLanguage();
}
}
List<IClientListener *>::iterator iter;
IClientListener *pListener = NULL;
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
@@ -418,13 +471,12 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
pListener = (*iter);
if (!pListener->InterceptClientConnect(client, reject, maxrejectlen))
{
return false;
RETURN_META_VALUE(MRES_SUPERCEDE, false);
}
}
cell_t res = 1;
pPlayer->Initialize(pszName, pszAddress, pEntity);
m_clconnect->PushCell(client);
m_clconnect->PushStringEx(reject, maxrejectlen, SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
m_clconnect->PushCell(maxrejectlen);
@@ -466,7 +518,7 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
pListener->OnClientConnected(client);
if (!pPlayer->IsConnected())
{
break;
return true;
}
}
@@ -478,8 +530,8 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
}
cell_t res;
OnClientConnected->PushCell(client);
OnClientConnected->Execute(&res, NULL);
m_clconnect_post->PushCell(client);
m_clconnect_post->Execute(&res, NULL);
}
else
{
@@ -501,8 +553,70 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
/* Run manual connection routines */
char error[255];
const char *authid = engine->GetPlayerNetworkIDString(pEntity);
pPlayer->Authorize(authid);
pPlayer->SetAuthString(authid);
pPlayer->Authorize();
pPlayer->m_bFakeClient = true;
/*
* While we're already filtered to just bots, we'll do other checks to
* make sure that the requisite services are enabled and that the bots
* have joined at the expected time.
*
* Checking playerinfo's IsHLTV and IsReplay would be better and less
* error-prone but will always show false until later in the frame,
* after PutInServer and Activate, and we want it now!
*
* These checks are hairy as hell due to differences between engines and games.
*
* Most engines use "Replay" and "SourceTV" as bot names for these when they're
* created. EP2V, CSS and Nuclear Dawn (but not L4D2) differ from this by now using
* replay_/tv_name directly when creating the bot(s). To complicate it slightly
* further, the cvar can be empty and the engine's fallback to "unnamed" will be used.
* We can maybe just rip out the name checks at some point and rely solely on whether
* they're enabled and the join order.
*/
// This doesn't actually get incremented until OnClientConnect. Fake it to check.
int newCount = m_PlayersSinceActive + 1;
int userId = engine->GetPlayerUserId(pEntity);
#if (SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_NUCLEARDAWN || SOURCE_ENGINE == SE_LEFT4DEAD2)
static ConVar *tv_name = icvar->FindVar("tv_name");
#endif
#if SOURCE_ENGINE == SE_TF2
static ConVar *replay_name = icvar->FindVar("replay_name");
#endif
#if SOURCE_ENGINE == SE_TF2
if (m_bIsReplayActive && newCount == 1
&& (m_ReplayUserId == userId
|| (replay_name && strcmp(playername, replay_name->GetString()) == 0) || (replay_name && replay_name->GetString()[0] == 0 && strcmp(playername, "unnamed") == 0)
)
)
{
pPlayer->m_bIsReplay = true;
m_ReplayUserId = userId;
}
#endif
if (m_bIsSourceTVActive
&& ((!m_bIsReplayActive && newCount == 1)
|| (m_bIsReplayActive && newCount == 2))
&& (m_SourceTVUserId == userId
#if SOURCE_ENGINE == SE_CSGO
|| strcmp(playername, "GOTV") == 0
#elif (SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_NUCLEARDAWN)
|| (tv_name && strcmp(playername, tv_name->GetString()) == 0) || (tv_name && tv_name->GetString()[0] == 0 && strcmp(playername, "unnamed") == 0)
#else
|| strcmp(playername, "SourceTV") == 0
#endif
)
)
{
pPlayer->m_bIsSourceTV = true;
m_SourceTVUserId = userId;
}
if (!OnClientConnect(pEntity, playername, "127.0.0.1", error, sizeof(error)))
{
/* :TODO: kick the bot if it's rejected */
@@ -520,6 +634,11 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
return;
}
}
cell_t res;
m_clconnect_post->PushCell(client);
m_clconnect_post->Execute(&res, NULL);
/* Now do authorization */
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
@@ -541,19 +660,6 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
pPlayer->m_Info = playerinfo->GetPlayerInfo(pEntity);
}
/* Get the client's language */
if (m_QueryLang)
{
const char *name;
if (!pPlayer->IsFakeClient() && (name=engine->GetClientConVarValue(client, "cl_language")))
{
unsigned int langid;
pPlayer->m_LangId = (g_Translator.GetLanguageByName(name, &langid)) ? langid : g_Translator.GetServerLanguage();
} else {
pPlayer->m_LangId = g_Translator.GetServerLanguage();
}
}
pPlayer->Connect();
m_PlayerCount++;
@@ -687,23 +793,30 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
g_PluginSys.ListPluginsToClient(pPlayer, args);
RETURN_META(MRES_SUPERCEDE);
}
else if (args.ArgC() > 1 && strcmp(args.Arg(1), "exts") == 0)
{
g_Extensions.ListExtensionsToClient(pPlayer, args);
RETURN_META(MRES_SUPERCEDE);
}
else if (args.ArgC() > 1 && strcmp(args.Arg(1), "credits") == 0)
{
ClientConsolePrint(pEntity,
"SourceMod would not be possible without:");
ClientConsolePrint(pEntity,
" David \"BAILOPAN\" Anderson, Matt \"pRED\" Woodrow");
ClientConsolePrint(pEntity,
" Scott \"DS\" Ehlert, Fyren");
ClientConsolePrint(pEntity,
" Nicholas \"psychonic\" Hastings, Asher \"asherkin\" Baker");
ClientConsolePrint(pEntity,
"SourceMod would not be possible without:");
ClientConsolePrint(pEntity,
" David \"BAILOPAN\" Anderson, Borja \"faluco\" Ferrer");
ClientConsolePrint(pEntity,
" Scott \"DS\" Ehlert, Matt \"pRED\" Woodrow");
ClientConsolePrint(pEntity,
" Michael \"ferret\" McKoy, Pavol \"PM OnoTo\" Marko");
" Borja \"faluco\" Ferrer, Pavol \"PM OnoTo\" Marko");
ClientConsolePrint(pEntity,
"SourceMod is open source under the GNU General Public License.");
RETURN_META(MRES_SUPERCEDE);
}
ClientConsolePrint(pEntity,
"SourceMod %s, by AlliedModders LLC", SM_FULL_VERSION);
"SourceMod %s, by AlliedModders LLC", SM_VERSION_STRING);
ClientConsolePrint(pEntity,
"To see running plugins, type \"sm plugins\"");
ClientConsolePrint(pEntity,
@@ -796,6 +909,19 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
const char *new_name = info ? info->GetName() : engine->GetClientConVarValue(client, "name");
const char *old_name = pPlayer->m_Name.c_str();
#if SOURCE_ENGINE >= SE_LEFT4DEAD
const char *networkid_force;
if ((networkid_force = engine->GetClientConVarValue(client, "networkid_force")) && networkid_force[0] != '\0')
{
unsigned int accountId = pPlayer->GetSteamAccountID();
g_Logger.LogMessage("\"%s<%d><STEAM_1:%d:%d><>\" has bad networkid (id \"%s\") (ip \"%s\")",
new_name, pPlayer->GetUserId(), accountId & 1, accountId >> 1, networkid_force, pPlayer->GetIPAddress());
pPlayer->Kick("NetworkID spoofing detected.");
RETURN_META(MRES_IGNORED);
}
#endif
if (strcmp(old_name, new_name) != 0)
{
AdminId id = g_Admins.FindAdminByIdentity("name", new_name);
@@ -803,7 +929,9 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
{
if (!CheckSetAdminName(client, pPlayer, id))
{
pPlayer->Kick("Your name is reserved by SourceMod; set your password to use it.");
char kickMsg[128];
logicore.CoreTranslate(kickMsg, sizeof(kickMsg), "%T", 2, NULL, "Name Reserved", &client);
pPlayer->Kick(kickMsg);
RETURN_META(MRES_IGNORED);
}
} else if ((id = g_Admins.FindAdminByIdentity("name", old_name)) != INVALID_ADMIN_ID) {
@@ -831,6 +959,17 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
}
}
}
/* Notify Extensions */
List<IClientListener *>::iterator iter;
IClientListener *pListener = NULL;
for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
{
pListener = (*iter);
if (pListener->GetClientListenerVersion() >= 13)
{
pListener->OnClientSettingsChanged(client);
}
}
}
int PlayerManager::GetMaxClients()
@@ -1120,11 +1259,12 @@ void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
{
continue;
}
if (!pTarget->IsConnected() || !pTarget->IsAuthorized())
if (!pTarget->IsConnected())
{
continue;
}
if (strcmp(pTarget->GetAuthString(), new_pattern) == 0)
const char *authstr = pTarget->GetAuthString(false); // We want to make it easy for people to be kicked/banned, so don't require validation for command targets.
if (authstr && strcmp(authstr, new_pattern) == 0)
{
if ((info->reason = FilterCommandTarget(pAdmin, pTarget, info->flags))
== COMMAND_TARGET_VALID)
@@ -1234,7 +1374,7 @@ void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
if ((info->flags & COMMAND_FILTER_NO_BOTS) == COMMAND_FILTER_NO_BOTS)
{
info->num_targets = 0;
info->reason = COMMAND_FILTER_NO_BOTS;
info->reason = COMMAND_TARGET_NOT_HUMAN;
return;
}
strncopy(info->target_name, "all bots", info->target_name_maxlength);
@@ -1300,7 +1440,7 @@ void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
continue;
}
if (stristr(pTarget->GetName(), info->pattern) != NULL)
if (logicore.stristr(pTarget->GetName(), info->pattern) != NULL)
{
if (found_client)
{
@@ -1338,18 +1478,6 @@ void PlayerManager::ProcessCommandTarget(cmd_target_info_t *info)
}
}
void PlayerManager::OnConVarChanged( ConVar *pConVar, const char *oldValue, float flOldValue )
{
if (pConVar->GetBool() && !atoi(oldValue))
{
MaxPlayersChanged(gpGlobals->maxClients + 1);
}
else
{
MaxPlayersChanged();
}
}
void PlayerManager::OnSourceModMaxPlayersChanged( int newvalue )
{
m_maxClients = newvalue;
@@ -1446,6 +1574,10 @@ CPlayer::CPlayer()
m_LastPassword.clear();
m_LangId = SOURCEMOD_LANGUAGE_ENGLISH;
m_bFakeClient = false;
m_bIsSourceTV = false;
m_bIsReplay = false;
m_Serial.value = -1;
m_SteamAccountID = 0;
}
void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
@@ -1455,7 +1587,7 @@ void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
m_Ip.assign(ip);
m_pEdict = pEntity;
m_iIndex = IndexOfEdict(pEntity);
m_LangId = g_Translator.GetServerLanguage();
m_LangId = translator->GetServerLanguage();
m_Serial.bits.index = m_iIndex;
m_Serial.bits.serial = g_PlayerSerialCount++;
@@ -1491,17 +1623,22 @@ void CPlayer::Connect()
}
}
void CPlayer::Authorize(const char *steamid)
void CPlayer::SetAuthString(const char *steamid)
{
if (m_IsAuthorized)
{
return;
}
m_IsAuthorized = true;
m_AuthID.assign(steamid);
}
// Ensure a valid AuthString is set before calling.
void CPlayer::Authorize()
{
m_IsAuthorized = true;
}
void CPlayer::Disconnect()
{
DumpAdmin(false);
@@ -1517,6 +1654,10 @@ void CPlayer::Disconnect()
m_UserId = -1;
m_bIsInKickQueue = false;
m_bFakeClient = false;
m_bIsSourceTV = false;
m_bIsReplay = false;
m_Serial.value = -1;
m_SteamAccountID = 0;
}
void CPlayer::SetName(const char *name)
@@ -1539,11 +1680,45 @@ const char *CPlayer::GetIPAddress()
return m_Ip.c_str();
}
const char *CPlayer::GetAuthString()
const char *CPlayer::GetAuthString(bool validated)
{
if (validated && !IsAuthStringValidated())
{
return NULL;
}
return m_AuthID.c_str();
}
unsigned int CPlayer::GetSteamAccountID(bool validated)
{
if (IsFakeClient() || (validated && !IsAuthStringValidated()))
{
return 0;
}
if (m_SteamAccountID != 0)
{
return m_SteamAccountID;
}
#if SOURCE_ENGINE < SE_ORANGEBOX
const char * pAuth = GetAuthString();
/* STEAM_0:1:123123 | STEAM_ID_LAN | STEAM_ID_PENDING */
if (pAuth && (strlen(pAuth) > 10) && pAuth[8] != '_')
{
m_SteamAccountID = (atoi(&pAuth[8]) | (atoi(&pAuth[10]) << 1));
}
#else
unsigned long long *steamId = (unsigned long long *)engine->GetClientSteamID(m_pEdict);
if (steamId)
{
m_SteamAccountID = (*steamId & 0xFFFFFFFF);
}
#endif
return m_SteamAccountID;
}
edict_t *CPlayer::GetEdict()
{
return m_pEdict;
@@ -1569,6 +1744,18 @@ bool CPlayer::IsAuthorized()
return m_IsAuthorized;
}
bool CPlayer::IsAuthStringValidated()
{
#if SOURCE_ENGINE >= SE_ORANGEBOX
if (g_Players.m_bAuthstringValidation && !g_HL2.IsLANServer())
{
return engine->IsClientFullyAuthenticated(m_pEdict);
}
#endif
return true;
}
IPlayerInfo *CPlayer::GetPlayerInfo()
{
if (m_pEdict->GetUnknown())
@@ -1584,6 +1771,16 @@ bool CPlayer::IsFakeClient()
return m_bFakeClient;
}
bool CPlayer::IsSourceTV() const
{
return m_bIsSourceTV;
}
bool CPlayer::IsReplay() const
{
return m_bIsReplay;
}
void CPlayer::SetAdminId(AdminId id, bool temporary)
{
if (!m_IsConnected)
@@ -1776,6 +1973,11 @@ unsigned int CPlayer::GetLanguageId()
return m_LangId;
}
void CPlayer::SetLanguageId(unsigned int id)
{
m_LangId = id;
}
int CPlayer::GetUserId()
{
if (m_UserId == -1)
+20 -7
View File
@@ -56,7 +56,7 @@ union serial_t
uint32_t value;
struct
{
uint8_t index;
uint32_t index : 8;
uint32_t serial : 24;
} bits;
};
@@ -69,19 +69,23 @@ public:
public:
const char *GetName();
const char *GetIPAddress();
const char *GetAuthString();
const char *GetAuthString(bool validated = true);
unsigned int GetSteamAccountID(bool validated = true);
edict_t *GetEdict();
bool IsInGame();
bool WasCountedAsInGame();
bool IsConnected();
bool IsAuthorized();
bool IsFakeClient();
bool IsSourceTV() const;
bool IsReplay() const;
void SetAdminId(AdminId id, bool temporary);
AdminId GetAdminId();
void Kick(const char *str);
bool IsInKickQueue();
IPlayerInfo *GetPlayerInfo();
unsigned int GetLanguageId();
void SetLanguageId(unsigned int id);
int GetUserId();
bool RunAdminCacheChecks();
void NotifyPostAdminChecks();
@@ -96,9 +100,11 @@ private:
void Disconnect();
void SetName(const char *name);
void DumpAdmin(bool deleting);
void Authorize(const char *auth);
void SetAuthString(const char *auth);
void Authorize();
void Authorize_Post();
void DoPostConnectAuthorization();
bool IsAuthStringValidated();
private:
bool m_IsConnected;
bool m_IsInGame;
@@ -118,13 +124,15 @@ private:
unsigned int m_LangId;
int m_UserId;
bool m_bFakeClient;
bool m_bIsSourceTV;
bool m_bIsReplay;
serial_t m_Serial;
unsigned int m_SteamAccountID;
};
class PlayerManager :
public SMGlobalClass,
public IPlayerManager,
public IConVarChangeListener
public IPlayerManager
{
friend class CPlayer;
public:
@@ -169,8 +177,6 @@ public: //IPlayerManager
void UnregisterCommandTargetProcessor(ICommandTargetProcessor *pHandler);
void ProcessCommandTarget(cmd_target_info_t *info);
int GetClientFromSerial(unsigned int serial);
public: // IConVarChangeListener
void OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue);
public:
inline int MaxClients()
{
@@ -197,6 +203,7 @@ private:
private:
List<IClientListener *> m_hooks;
IForward *m_clconnect;
IForward *m_clconnect_post;
IForward *m_cldisconnect;
IForward *m_cldisconnect_post;
IForward *m_clputinserver;
@@ -209,12 +216,18 @@ private:
int *m_UserIdLookUp;
int m_maxClients;
int m_PlayerCount;
int m_PlayersSinceActive;
bool m_FirstPass;
unsigned int *m_AuthQueue;
String m_PassInfoVar;
bool m_QueryLang;
bool m_bAuthstringValidation; // are we validating admins with steam before authorizing?
bool m_bIsListenServer;
int m_ListenClient;
bool m_bIsSourceTVActive;
bool m_bIsReplayActive;
int m_SourceTVUserId;
int m_ReplayUserId;
};
#if SOURCE_ENGINE >= SE_ORANGEBOX
+114 -96
View File
@@ -44,7 +44,7 @@
#include "ConCmdManager.h"
#include "PlayerManager.h"
#include "CoreConfig.h"
#include "Translator.h"
#include "logic_bridge.h"
CPluginManager g_PluginSys;
HandleType_t g_PluginType = 0;
@@ -67,7 +67,7 @@ CPlugin::CPlugin(const char *file)
m_FakeNativesMissing = false;
m_LibraryMissing = false;
m_bGotAllLoaded = false;
m_pPhrases = g_Translator.CreatePhraseCollection();
m_pPhrases = translator->CreatePhraseCollection();
m_MaxClientsVar = NULL;
}
@@ -372,7 +372,7 @@ void CPlugin::Call_OnAllPluginsLoaded()
pFunction->Execute(&result);
}
if (g_OnMapStarted)
if (g_SourceMod.IsMapRunning())
{
if ((pFunction = m_pRuntime->GetFunctionByName("OnMapStart")) != NULL)
{
@@ -501,14 +501,14 @@ void CPlugin::SetSilentlyFailed(bool sf)
m_bSilentlyFailed = sf;
}
void CPlugin::LibraryActions(bool dropping)
void CPlugin::LibraryActions(LibraryAction action)
{
List<String>::iterator iter;
for (iter = m_Libraries.begin();
iter != m_Libraries.end();
iter++)
{
g_PluginSys.OnLibraryAction((*iter).c_str(), true, dropping);
g_PluginSys.OnLibraryAction((*iter).c_str(), action);
}
}
@@ -523,7 +523,7 @@ bool CPlugin::SetPauseState(bool paused)
if (paused)
{
LibraryActions(true);
LibraryActions(LibraryAction_Removed);
}
IPluginFunction *pFunction = m_pRuntime->GetFunctionByName("OnPluginPauseChange");
@@ -547,7 +547,7 @@ bool CPlugin::SetPauseState(bool paused)
if (!paused)
{
LibraryActions(false);
LibraryActions(LibraryAction_Added);
}
return true;
@@ -789,6 +789,8 @@ CPluginManager::CPluginManager()
m_AllPluginsLoaded = false;
m_MyIdent = NULL;
m_LoadingLocked = false;
m_bBlockBadPlugins = true;
}
CPluginManager::~CPluginManager()
@@ -1005,11 +1007,14 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
pPlugin->m_pRuntime = g_pSourcePawn2->LoadPlugin(co, fullpath, &err);
if (pPlugin->m_pRuntime == NULL)
{
UTIL_Format(error,
maxlength,
"Unable to load plugin (error %d: %s)",
err,
g_pSourcePawn2->GetErrorString(err));
if (error)
{
UTIL_Format(error,
maxlength,
"Unable to load plugin (error %d: %s)",
err,
g_pSourcePawn2->GetErrorString(err));
}
pPlugin->m_status = Plugin_BadLoad;
}
else
@@ -1020,7 +1025,45 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
}
else
{
UTIL_Format(error, maxlength, "%s", pPlugin->m_errormsg);
if (error)
{
UTIL_Format(error, maxlength, "%s", pPlugin->m_errormsg);
}
}
}
}
if (pPlugin->GetStatus() == Plugin_Created)
{
unsigned char *pCodeHash = pPlugin->m_pRuntime->GetCodeHash();
char codeHashBuf[40];
UTIL_Format(codeHashBuf, 40, "plugin_");
for (int i = 0; i < 16; i++)
UTIL_Format(codeHashBuf + 7 + (i * 2), 3, "%02x", pCodeHash[i]);
const char *bulletinUrl = g_pGameConf->GetKeyValue(codeHashBuf);
if (bulletinUrl != NULL)
{
if (m_bBlockBadPlugins)
{
if (error)
{
if (bulletinUrl[0] != '\0')
{
UTIL_Format(error, maxlength, "Known malware detected and blocked. See %s for more info", bulletinUrl);
} else {
UTIL_Format(error, maxlength, "Possible malware or illegal plugin detected and blocked");
}
}
pPlugin->m_status = Plugin_BadLoad;
} else {
if (bulletinUrl[0] != '\0')
{
g_Logger.LogMessage("%s: Known malware detected. See %s for more info, blocking disabled in core.cfg", pPlugin->GetFilename(), bulletinUrl);
} else {
g_Logger.LogMessage("%s: Possible malware or illegal plugin detected, blocking disabled in core.cfg", pPlugin->GetFilename());
}
}
}
}
@@ -1123,7 +1166,7 @@ void CPluginManager::LoadAutoPlugin(const char *plugin)
if ((res=_LoadPlugin(&pl, plugin, false, PluginType_MapUpdated, error, sizeof(error))) == LoadRes_Failure)
{
g_Logger.LogError("[SM] Failed to load plugin \"%s\": %s", plugin, error);
g_Logger.LogError("[SM] Failed to load plugin \"%s\": %s.", plugin, error);
pl->SetErrorState(
pl->GetStatus() <= Plugin_Created ? Plugin_BadLoad : pl->GetStatus(),
"%s",
@@ -1308,7 +1351,8 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass
if (ext->autoload)
{
g_LibSys.PathFormat(path, PLATFORM_MAX_PATH, "%s", file);
g_Extensions.LoadAutoExtension(path);
bool bErrorOnMissing = ext->required ? true : false;
g_Extensions.LoadAutoExtension(path, bErrorOnMissing);
}
}
else if (pass == 2)
@@ -1451,7 +1495,7 @@ bool CPluginManager::RunSecondPass(CPlugin *pPlugin, char *error, size_t maxleng
s_iter != pPlugin->m_Libraries.end();
s_iter++)
{
OnLibraryAction((*s_iter).c_str(), true, false);
OnLibraryAction((*s_iter).c_str(), LibraryAction_Added);
}
/* :TODO: optimize? does this even matter? */
@@ -1503,7 +1547,9 @@ void CPluginManager::TryRefreshDependencies(CPlugin *pPlugin)
{
break;
}
if (native->status == SP_NATIVE_UNBOUND && !(native->flags & SP_NTVFLAG_OPTIONAL))
if (native->status == SP_NATIVE_UNBOUND
&& native->name[0] != '@'
&& !(native->flags & SP_NTVFLAG_OPTIONAL))
{
pPlugin->SetErrorState(Plugin_Error, "Native not found: %s", native->name);
return;
@@ -1551,7 +1597,7 @@ bool CPluginManager::UnloadPlugin(IPlugin *plugin)
s_iter != pPlugin->m_Libraries.end();
s_iter++)
{
OnLibraryAction((*s_iter).c_str(), true, true);
OnLibraryAction((*s_iter).c_str(), LibraryAction_Removed);
}
List<IPluginsListener *>::iterator iter;
@@ -1559,14 +1605,15 @@ bool CPluginManager::UnloadPlugin(IPlugin *plugin)
if (pPlugin->GetStatus() <= Plugin_Error)
{
/* Notify plugin */
pPlugin->Call_OnPluginEnd();
/* Notify listeners of unloading */
for (iter=m_listeners.begin(); iter!=m_listeners.end(); iter++)
{
pListener = (*iter);
pListener->OnPluginUnloaded(pPlugin);
}
/* Notify plugin */
pPlugin->Call_OnPluginEnd();
}
pPlugin->DropEverything();
@@ -1867,6 +1914,9 @@ void CPluginManager::OnSourceModAllInitialized()
g_RootMenu.AddRootConsoleCommand("plugins", "Manage Plugins", this);
g_ShareSys.AddInterface(NULL, this);
m_pOnLibraryAdded = g_Forwards.CreateForward("OnLibraryAdded", ET_Ignore, 1, NULL, Param_String);
m_pOnLibraryRemoved = g_Forwards.CreateForward("OnLibraryRemoved", ET_Ignore, 1, NULL, Param_String);
}
void CPluginManager::OnSourceModShutdown()
@@ -1878,6 +1928,30 @@ void CPluginManager::OnSourceModShutdown()
g_HandleSys.RemoveType(g_PluginType, m_MyIdent);
g_ShareSys.DestroyIdentType(g_PluginIdent);
g_ShareSys.DestroyIdentity(m_MyIdent);
g_Forwards.ReleaseForward(m_pOnLibraryAdded);
g_Forwards.ReleaseForward(m_pOnLibraryRemoved);
}
ConfigResult CPluginManager::OnSourceModConfigChanged(const char *key,
const char *value,
ConfigSource source,
char *error,
size_t maxlength)
{
if (strcmp(key, "BlockBadPlugins") == 0) {
if (strcasecmp(value, "yes") == 0)
{
m_bBlockBadPlugins = true;
} else if (strcasecmp(value, "no") == 0) {
m_bBlockBadPlugins = false;
} else {
UTIL_Format(error, maxlength, "Invalid value: must be \"yes\" or \"no\"");
return ConfigResult_Reject;
}
return ConfigResult_Accept;
}
return ConfigResult_Ignore;
}
void CPluginManager::OnHandleDestroy(HandleType_t type, void *object)
@@ -2260,6 +2334,15 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
{
g_RootMenu.ConsolePrint(" Timestamp: %s", pl->m_DateTime);
}
unsigned char *pCodeHash = pl->m_pRuntime->GetCodeHash();
unsigned char *pDataHash = pl->m_pRuntime->GetDataHash();
char combinedHash[33];
for (int i = 0; i < 16; i++)
UTIL_Format(combinedHash + (i * 2), 3, "%02x", pCodeHash[i] ^ pDataHash[i]);
g_RootMenu.ConsolePrint(" Hash: %s", combinedHash);
}
else
{
@@ -2474,83 +2557,18 @@ CPlugin *CPluginManager::GetPluginFromIdentity(IdentityToken_t *pToken)
return (CPlugin *)(pToken->ptr);
}
void CPluginManager::OnLibraryAction(const char *lib, bool is_a_plugin, bool drop)
void CPluginManager::OnLibraryAction(const char *lib, LibraryAction action)
{
List<CPlugin *>::iterator iter;
struct _pl
switch (action)
{
cell_t name;
cell_t file;
cell_t required;
} *plc;
struct _ext
{
cell_t name;
cell_t file;
cell_t autoload;
cell_t required;
} *ext;
const char *name = drop ? "OnLibraryRemoved" : "OnLibraryAdded";
for (iter=m_plugins.begin();
iter!=m_plugins.end();
iter++)
{
CPlugin *pl = (*iter);
if (pl->GetStatus() != Plugin_Running)
{
continue;
}
IPluginContext *pContext = pl->GetBaseContext();
IPluginFunction *pf = pContext->GetFunctionByName(name);
if (!pf)
{
continue;
}
uint32_t num_vars = pContext->GetPubVarsNum();
for (uint32_t i=0; i<num_vars; i++)
{
sp_pubvar_t *pubvar;
if (pContext->GetPubvarByIndex(i, &pubvar) != SP_ERROR_NONE)
{
continue;
}
if (is_a_plugin && strncmp(pubvar->name, "__pl_", 5) == 0)
{
plc = (_pl *)pubvar->offs;
if (plc->required)
{
continue;
}
char *str;
pContext->LocalToString(plc->name, &str);
if (strcmp(str, lib) != 0)
{
continue;
}
pf->PushString(lib);
pf->Execute(NULL);
}
else if (!is_a_plugin && strncmp(pubvar->name, "__ext_", 6) == 0)
{
ext = (_ext *)pubvar->offs;
if (ext->required)
{
continue;
}
char *str;
pContext->LocalToString(ext->name, &str);
if (strcmp(str, lib) != 0)
{
continue;
}
pf->PushString(lib);
pf->Execute(NULL);
}
}
case LibraryAction_Removed:
m_pOnLibraryRemoved->PushString(lib);
m_pOnLibraryRemoved->Execute(NULL);
break;
case LibraryAction_Added:
m_pOnLibraryAdded->PushString(lib);
m_pOnLibraryAdded->Execute(NULL);
break;
}
}
@@ -2741,6 +2759,6 @@ void CPluginManager::ListPluginsToClient(CPlayer *player, const CCommand &args)
/* Do we actually have more plugins? */
if (iter != m_plugins.end())
{
ClientConsolePrint(e, "To see more, type \"sm plugins %d\"", id + 1);
ClientConsolePrint(e, "To see more, type \"sm plugins %d\"", id);
}
}
+23 -5
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -47,14 +47,17 @@
#include "sm_trie.h"
#include "sourcemod.h"
#include <IRootConsoleMenu.h>
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
#if SOURCE_ENGINE >= SE_ALIENSWARM
#include "convar_sm_swarm.h"
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
#include "convar_sm_l4d.h"
#elif (SOURCE_ENGINE == SE_ORANGEBOX) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE)
#elif SOURCE_ENGINE >= SE_ORANGEBOX
#include "convar_sm_ob.h"
#else
#include "convar_sm.h"
#endif
#include "ITranslator.h"
#include "IGameConfigs.h"
#include "NativeOwner.h"
#include "ShareSys.h"
@@ -128,6 +131,12 @@ enum APLRes
APLRes_SilentFailure
};
enum LibraryAction
{
LibraryAction_Removed,
LibraryAction_Added
};
struct AutoConfig
{
String autocfg;
@@ -247,7 +256,7 @@ public:
{
m_Libraries.push_back(name);
}
void LibraryActions(bool dropping);
void LibraryActions(LibraryAction action);
void SyncMaxClients(int max_clients);
protected:
bool UpdateInfo();
@@ -324,6 +333,7 @@ public: //IPluginManager
public: //SMGlobalClass
void OnSourceModAllInitialized();
void OnSourceModShutdown();
ConfigResult OnSourceModConfigChanged(const char *key, const char *value, ConfigSource source, char *error, size_t maxlength);
void OnSourceModMaxPlayersChanged(int newvalue);
public: //IHandleTypeDispatch
void OnHandleDestroy(HandleType_t type, void *object);
@@ -399,7 +409,7 @@ public:
void Shutdown();
void OnLibraryAction(const char *lib, bool is_a_plugin, bool drop);
void OnLibraryAction(const char *lib, LibraryAction action);
bool LibraryExists(const char *lib);
@@ -468,8 +478,16 @@ private:
List<FakeNative *> m_Natives;
bool m_LoadingLocked;
// Config
bool m_bBlockBadPlugins;
// Forwards
IForward *m_pOnLibraryAdded;
IForward *m_pOnLibraryRemoved;
};
extern CPluginManager g_PluginSys;
#endif //_INCLUDE_SOURCEMOD_PLUGINSYSTEM_H_
+1 -1
View File
@@ -78,11 +78,11 @@ public: //ITimerSystem
float GetTickedTime();
void NotifyOfGameStart(float offset /* = 0.0f */);
bool GetMapTimeLeft(float *pTime);
IMapTimer *GetMapTimer();
public:
void RunFrame();
void RemoveMapChangeTimers();
void GameFrame(bool simulating);
IMapTimer *GetMapTimer();
private:
List<ITimer *> m_SingleTimers;
List<ITimer *> m_LoopTimers;
File diff suppressed because it is too large Load Diff
+303 -37
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -32,18 +32,32 @@
#include "UserMessages.h"
#include "sm_stringutil.h"
#if SOURCE_ENGINE == SE_CSGO
#include <cstrike15_usermessage_helpers.h>
#endif
UserMessages g_UserMsgs;
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
#if SOURCE_ENGINE == SE_CSGO
SH_DECL_HOOK3_void(IVEngineServer, SendUserMessage, SH_NOATTRIB, 0, IRecipientFilter &, int, const protobuf::Message &);
#else
#if SOURCE_ENGINE >= SE_LEFT4DEAD
SH_DECL_HOOK3(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int, const char *);
#else
SH_DECL_HOOK2(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int);
#endif
SH_DECL_HOOK0_void(IVEngineServer, MessageEnd, SH_NOATTRIB, 0);
#endif // ==SE_CSGO
UserMessages::UserMessages() : m_InterceptBuffer(m_pBase, 2500)
UserMessages::UserMessages()
#ifndef USE_PROTOBUF_USERMESSAGES
: m_InterceptBuffer(m_pBase, 2500)
{
m_Names = sm_trie_create();
#else
: m_InterceptBuffer(NULL)
{
#endif
m_HookCount = 0;
m_InExec = false;
m_InHook = false;
@@ -53,7 +67,9 @@ UserMessages::UserMessages() : m_InterceptBuffer(m_pBase, 2500)
UserMessages::~UserMessages()
{
#ifndef USE_PROTOBUF_USERMESSAGES
sm_trie_destroy(m_Names);
#endif
CStack<ListenerInfo *>::iterator iter;
for (iter=m_FreeListeners.begin(); iter!=m_FreeListeners.end(); iter++)
@@ -65,8 +81,10 @@ UserMessages::~UserMessages()
void UserMessages::OnSourceModStartup(bool late)
{
#ifndef USE_PROTOBUF_USERMESSAGES
/* -1 means SourceMM was unable to get the user message list */
m_FallbackSearch = (g_SMAPI->GetUserMessageCount() == -1);
#endif
}
void UserMessages::OnSourceModAllInitialized()
@@ -78,16 +96,25 @@ void UserMessages::OnSourceModAllShutdown()
{
if (m_HookCount)
{
#if SOURCE_ENGINE == SE_CSGO
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, SendUserMessage, engine, this, &UserMessages::OnSendUserMessage_Pre, false);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, SendUserMessage, engine, this, &UserMessages::OnSendUserMessage_Post, true);
#else
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Pre, false);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Post, true);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Pre, false);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Post, true);
#endif
}
m_HookCount = 0;
}
int UserMessages::GetMessageIndex(const char *msg)
{
#if SOURCE_ENGINE == SE_CSGO
// Can split this per engine and/or game later
return g_Cstrike15UsermessageHelpers.GetIndex(msg);
#else
int msgid;
if (!sm_trie_retrieve(m_Names, msg, reinterpret_cast<void **>(&msgid)))
@@ -118,10 +145,19 @@ int UserMessages::GetMessageIndex(const char *msg)
}
return msgid;
#endif
}
bool UserMessages::GetMessageName(int msgid, char *buffer, size_t maxlength) const
{
#if SOURCE_ENGINE == SE_CSGO
const char *pszName = g_Cstrike15UsermessageHelpers.GetName(msgid);
if (!pszName)
return false;
strncopy(buffer, pszName, maxlength);
return true;
#else
if (m_FallbackSearch)
{
int size;
@@ -137,10 +173,14 @@ bool UserMessages::GetMessageName(int msgid, char *buffer, size_t maxlength) con
}
return false;
#endif
}
bf_write *UserMessages::StartMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags)
bf_write *UserMessages::StartBitBufMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags)
{
#ifdef USE_PROTOBUF_USERMESSAGES
return NULL;
#else
bf_write *buffer;
if (m_InExec || m_InHook)
@@ -168,13 +208,13 @@ bf_write *UserMessages::StartMessage(int msg_id, const cell_t players[], unsigne
if (m_CurFlags & USERMSG_BLOCKHOOKS)
{
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
#if SOURCE_ENGINE >= SE_LEFT4DEAD
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, g_SMAPI->GetUserMessage(msg_id));
#else
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
#endif
} else {
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
#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);
@@ -182,6 +222,75 @@ bf_write *UserMessages::StartMessage(int msg_id, const cell_t players[], unsigne
}
return buffer;
#endif // USE_PROTOBUF_USERMESSAGES
}
google::protobuf::Message *UserMessages::StartProtobufMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags)
{
#ifndef USE_PROTOBUF_USERMESSAGES
return NULL;
#else
protobuf::Message *buffer;
if (m_InExec || m_InHook)
{
return NULL;
}
if (msg_id < 0 || msg_id >= 255)
{
return NULL;
}
m_CurId = msg_id;
m_CellRecFilter.Initialize(players, playersNum);
m_CurFlags = flags;
if (m_CurFlags & USERMSG_INITMSG)
{
m_CellRecFilter.SetToInit(true);
}
if (m_CurFlags & USERMSG_RELIABLE)
{
m_CellRecFilter.SetToReliable(true);
}
m_InExec = true;
if (m_CurFlags & USERMSG_BLOCKHOOKS)
{
// direct message creation, return buffer "from engine". keep track
m_FakeEngineBuffer = g_Cstrike15UsermessageHelpers.GetPrototype(msg_id)->New();
buffer = m_FakeEngineBuffer;
} else {
char messageName[32];
if (!GetMessageName(msg_id, messageName, sizeof(messageName)))
{
m_InExec = false;
return NULL;
}
protobuf::Message *msg = OnStartMessage_Pre(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, messageName);
switch (m_FakeMetaRes)
{
case MRES_IGNORED:
case MRES_HANDLED:
m_FakeEngineBuffer = g_Cstrike15UsermessageHelpers.GetPrototype(msg_id)->New();
buffer = m_FakeEngineBuffer;
break;
case MRES_OVERRIDE:
m_FakeEngineBuffer = g_Cstrike15UsermessageHelpers.GetPrototype(msg_id)->New();
// fallthrough
case MRES_SUPERCEDE:
buffer = msg;
break;
}
OnStartMessage_Post(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, messageName);
}
return buffer;
#endif // USE_PROTOBUF_USERMESSAGES
}
bool UserMessages::EndMessage()
@@ -191,12 +300,37 @@ bool UserMessages::EndMessage()
return false;
}
#if SOURCE_ENGINE == SE_CSGO
if (m_CurFlags & USERMSG_BLOCKHOOKS)
{
ENGINE_CALL(SendUserMessage)(static_cast<IRecipientFilter &>(m_CellRecFilter), m_CurId, *m_FakeEngineBuffer);
delete m_FakeEngineBuffer;
m_FakeEngineBuffer = NULL;
} else {
OnMessageEnd_Pre();
switch (m_FakeMetaRes)
{
case MRES_IGNORED:
case MRES_HANDLED:
case MRES_OVERRIDE:
engine->SendUserMessage(static_cast<IRecipientFilter &>(m_CellRecFilter), m_CurId, *m_FakeEngineBuffer);
delete m_FakeEngineBuffer;
m_FakeEngineBuffer = NULL;
break;
//case MRES_SUPERCEDE:
}
OnMessageEnd_Post();
}
#else
if (m_CurFlags & USERMSG_BLOCKHOOKS)
{
ENGINE_CALL(MessageEnd)();
} else {
engine->MessageEnd();
}
#endif // SE_CSGO
m_InExec = false;
m_CurFlags = 0;
@@ -205,31 +339,60 @@ bool UserMessages::EndMessage()
return true;
}
UserMessageType UserMessages::GetUserMessageType() const
{
#ifdef USE_PROTOBUF_USERMESSAGES
return UM_Protobuf;
#else
return UM_BitBuf;
#endif
}
bool UserMessages::HookUserMessage2(int msg_id,
IUserMessageListener *pListener,
bool intercept)
{
return InternalHook(msg_id, pListener, intercept, true);
#ifdef USE_PROTOBUF_USERMESSAGES
return InternalHook(msg_id, (IProtobufUserMessageListener *)pListener, intercept, true);
#else
return InternalHook(msg_id, (IBitBufUserMessageListener *)pListener, intercept, true);
#endif
}
bool UserMessages::UnhookUserMessage2(int msg_id,
IUserMessageListener *pListener,
bool intercept)
{
return InternalUnhook(msg_id, pListener, intercept, true);
#ifdef USE_PROTOBUF_USERMESSAGES
return InternalUnhook(msg_id, (IProtobufUserMessageListener *)pListener, intercept, true);
#else
return InternalUnhook(msg_id, (IBitBufUserMessageListener *)pListener, intercept, true);
#endif
}
bool UserMessages::HookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
{
return InternalHook(msg_id, pListener, intercept, false);
#ifdef USE_PROTOBUF_USERMESSAGES
return InternalHook(msg_id, (IProtobufUserMessageListener *)pListener, intercept, false);
#else
return InternalHook(msg_id, (IBitBufUserMessageListener *)pListener, intercept, false);
#endif
}
bool UserMessages::UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept)
{
return InternalUnhook(msg_id, pListener, intercept, false);
#ifdef USE_PROTOBUF_USERMESSAGES
return InternalUnhook(msg_id, (IProtobufUserMessageListener *)pListener, intercept, false);
#else
return InternalUnhook(msg_id, (IBitBufUserMessageListener *)pListener, intercept, false);
#endif
}
bool UserMessages::InternalHook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew)
#ifdef USE_PROTOBUF_USERMESSAGES
bool UserMessages::InternalHook(int msg_id, IProtobufUserMessageListener *pListener, bool intercept, bool isNew)
#else
bool UserMessages::InternalHook(int msg_id, IBitBufUserMessageListener *pListener, bool intercept, bool isNew)
#endif
{
if (msg_id < 0 || msg_id >= 255)
{
@@ -252,10 +415,15 @@ bool UserMessages::InternalHook(int msg_id, IUserMessageListener *pListener, boo
if (!m_HookCount++)
{
#if SOURCE_ENGINE == SE_CSGO
SH_ADD_HOOK_MEMFUNC(IVEngineServer, SendUserMessage, engine, this, &UserMessages::OnSendUserMessage_Pre, false);
SH_ADD_HOOK_MEMFUNC(IVEngineServer, SendUserMessage, engine, this, &UserMessages::OnSendUserMessage_Post, true);
#else
SH_ADD_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Pre, false);
SH_ADD_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Post, true);
SH_ADD_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Pre, false);
SH_ADD_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Post, true);
#endif
}
if (intercept)
@@ -268,7 +436,11 @@ bool UserMessages::InternalHook(int msg_id, IUserMessageListener *pListener, boo
return true;
}
bool UserMessages::InternalUnhook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew)
#ifdef USE_PROTOBUF_USERMESSAGES
bool UserMessages::InternalUnhook(int msg_id, IProtobufUserMessageListener *pListener, bool intercept, bool isNew)
#else
bool UserMessages::InternalUnhook(int msg_id, IBitBufUserMessageListener *pListener, bool intercept, bool isNew)
#endif
{
MsgList *pList;
MsgIter iter;
@@ -309,14 +481,69 @@ void UserMessages::_DecRefCounter()
{
if (--m_HookCount == 0)
{
#if SOURCE_ENGINE == SE_CSGO
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, SendUserMessage, engine, this, &UserMessages::OnSendUserMessage_Pre, false);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, SendUserMessage, engine, this, &UserMessages::OnSendUserMessage_Post, true);
#else
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Pre, false);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, UserMessageBegin, engine, this, &UserMessages::OnStartMessage_Post, true);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Pre, false);
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, MessageEnd, engine, this, &UserMessages::OnMessageEnd_Post, true);
#endif
}
}
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
#if SOURCE_ENGINE == SE_CSGO
void UserMessages::OnSendUserMessage_Pre(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg)
{
OnStartMessage_Pre(&filter, msg_type, g_Cstrike15UsermessageHelpers.GetName(msg_type));
if (m_FakeMetaRes == MRES_SUPERCEDE)
{
int size = msg.ByteSize();
uint8 *data = (uint8 *)stackalloc(size);
msg.SerializePartialToArray(data, size);
m_InterceptBuffer->ParsePartialFromArray(data, size);
}
else
{
m_FakeEngineBuffer = &const_cast<protobuf::Message &>(msg);
}
OnStartMessage_Post(&filter, msg_type, g_Cstrike15UsermessageHelpers.GetName(msg_type));
OnMessageEnd_Pre();
if (m_FakeMetaRes == MRES_SUPERCEDE)
RETURN_META(MRES_SUPERCEDE);
RETURN_META(MRES_IGNORED);
}
void UserMessages::OnSendUserMessage_Post(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg)
{
OnMessageEnd_Post();
RETURN_META(MRES_IGNORED);
}
#endif
#ifdef USE_PROTOBUF_USERMESSAGES
#define UM_RETURN_META_VALUE(res, val) \
m_FakeMetaRes = res; \
return val;
#define UM_RETURN_META(res) \
m_FakeMetaRes = res; \
return;
#else
#define UM_RETURN_META_VALUE(res, val) \
RETURN_META_VALUE(res, val)
#define UM_RETURN_META(res) \
RETURN_META(res)
#endif
#if SOURCE_ENGINE == SE_CSGO
protobuf::Message *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name)
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
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)
@@ -329,7 +556,7 @@ bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_typ
|| (m_InExec && (m_CurFlags & USERMSG_BLOCKHOOKS)))
{
m_InHook = false;
RETURN_META_VALUE(MRES_IGNORED, NULL);
UM_RETURN_META_VALUE(MRES_IGNORED, NULL);
}
m_CurId = msg_type;
@@ -339,14 +566,23 @@ bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_typ
if (!is_intercept_empty)
{
#ifdef USE_PROTOBUF_USERMESSAGES
if (m_InterceptBuffer)
delete m_InterceptBuffer;
m_InterceptBuffer = g_Cstrike15UsermessageHelpers.GetPrototype(msg_type)->New();
UM_RETURN_META_VALUE(MRES_SUPERCEDE, m_InterceptBuffer);
#else
m_InterceptBuffer.Reset();
RETURN_META_VALUE(MRES_SUPERCEDE, &m_InterceptBuffer);
UM_RETURN_META_VALUE(MRES_SUPERCEDE, &m_InterceptBuffer);
#endif
}
RETURN_META_VALUE(MRES_IGNORED, NULL);
UM_RETURN_META_VALUE(MRES_IGNORED, NULL);
}
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
#if SOURCE_ENGINE == SE_CSGO
protobuf::Message *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name)
#elif 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)
@@ -354,19 +590,26 @@ bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_ty
{
if (!m_InHook)
{
RETURN_META_VALUE(MRES_IGNORED, NULL);
UM_RETURN_META_VALUE(MRES_IGNORED, NULL);
}
#ifdef USE_PROTOBUF_USERMESSAGES
if (m_FakeMetaRes == MRES_SUPERCEDE)
m_OrigBuffer = m_InterceptBuffer;
else
m_OrigBuffer = m_FakeEngineBuffer;
#else
m_OrigBuffer = META_RESULT_ORIG_RET(bf_write *);
#endif
RETURN_META_VALUE(MRES_IGNORED, NULL);
UM_RETURN_META_VALUE(MRES_IGNORED, NULL);
}
void UserMessages::OnMessageEnd_Post()
{
if (!m_InHook)
{
RETURN_META(MRES_IGNORED);
UM_RETURN_META(MRES_IGNORED);
}
MsgList *pList;
@@ -434,7 +677,7 @@ void UserMessages::OnMessageEnd_Pre()
{
if (!m_InHook)
{
RETURN_META(MRES_IGNORED);
UM_RETURN_META(MRES_IGNORED);
}
MsgList *pList;
@@ -450,7 +693,11 @@ void UserMessages::OnMessageEnd_Pre()
{
pInfo = (*iter);
pInfo->IsHooked = true;
#ifdef USE_PROTOBUF_USERMESSAGES
res = pInfo->Callback->InterceptUserMessage(m_CurId, m_InterceptBuffer, m_CurRecFilter);
#else
res = pInfo->Callback->InterceptUserMessage(m_CurId, &m_InterceptBuffer, m_CurRecFilter);
#endif
intercepted = true;
@@ -498,9 +745,11 @@ void UserMessages::OnMessageEnd_Pre()
if (!handled && intercepted)
{
#if SOURCE_ENGINE == SE_CSGO
ENGINE_CALL(SendUserMessage)(static_cast<IRecipientFilter &>(*m_CurRecFilter), m_CurId, *m_InterceptBuffer);
#else
bf_write *engine_bfw;
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
#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);
@@ -508,29 +757,46 @@ void UserMessages::OnMessageEnd_Pre()
m_ReadBuffer.StartReading(m_InterceptBuffer.GetBasePointer(), m_InterceptBuffer.GetNumBytesWritten());
engine_bfw->WriteBitsFromBuffer(&m_ReadBuffer, m_InterceptBuffer.GetNumBitsWritten());
ENGINE_CALL(MessageEnd)();
#endif // SE_CSGO
}
pList = &m_msgHooks[m_CurId];
for (iter=pList->begin(); iter!=pList->end(); )
{
pInfo = (*iter);
pInfo->IsHooked = true;
pInfo->Callback->OnUserMessage(m_CurId, m_OrigBuffer, m_CurRecFilter);
#if SOURCE_ENGINE == SE_CSGO
int size = m_OrigBuffer->ByteSize();
uint8 *data = (uint8 *)stackalloc(size);
m_OrigBuffer->SerializePartialToArray(data, size);
protobuf::Message *pTempMsg = g_Cstrike15UsermessageHelpers.GetPrototype(m_CurId)->New();
pTempMsg->ParsePartialFromArray(data, size);
#else
bf_write *pTempMsg = m_OrigBuffer;
#endif
if (pInfo->KillMe)
pList = &m_msgHooks[m_CurId];
for (iter=pList->begin(); iter!=pList->end(); )
{
iter = pList->erase(iter);
m_FreeListeners.push(pInfo);
_DecRefCounter();
continue;
pInfo = (*iter);
pInfo->IsHooked = true;
pInfo->Callback->OnUserMessage(m_CurId, pTempMsg, m_CurRecFilter);
if (pInfo->KillMe)
{
iter = pList->erase(iter);
m_FreeListeners.push(pInfo);
_DecRefCounter();
continue;
}
pInfo->IsHooked = false;
iter++;
}
pInfo->IsHooked = false;
iter++;
#if SOURCE_ENGINE == SE_CSGO
delete pTempMsg;
#endif
}
RETURN_META((intercepted) ? MRES_SUPERCEDE : MRES_IGNORED);
UM_RETURN_META((intercepted) ? MRES_SUPERCEDE : MRES_IGNORED);
supercede:
m_BlockEndPost = true;
RETURN_META(MRES_SUPERCEDE);
UM_RETURN_META(MRES_SUPERCEDE);
}
+52 -7
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -36,16 +36,35 @@
#include <IUserMessages.h>
#include "sourcemm_api.h"
#include "sm_trie.h"
#include "sm_stringutil.h"
#include "CellRecipientFilter.h"
using namespace SourceHook;
using namespace SourceMod;
#if SOURCE_ENGINE == SE_CSGO
#define USE_PROTOBUF_USERMESSAGES
#endif
#ifdef USE_PROTOBUF_USERMESSAGES
#include <google/protobuf/message.h>
#include <google/protobuf/descriptor.h>
#include <netmessages.pb.h>
using namespace google;
#else
#include <bitbuf.h>
#endif
#define INVALID_MESSAGE_ID -1
struct ListenerInfo
{
IUserMessageListener *Callback;
#ifdef USE_PROTOBUF_USERMESSAGES
IProtobufUserMessageListener *Callback;
#else
IBitBufUserMessageListener *Callback;
#endif
bool IsHooked;
bool KillMe;
bool IsNew;
@@ -70,7 +89,8 @@ public: //IUserMessages
bool GetMessageName(int msgid, char *buffer, size_t maxlength) const;
bool HookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept=false);
bool UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept=false);
bf_write *StartMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags);
bf_write *StartBitBufMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags);
google::protobuf::Message *StartProtobufMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags);
bool EndMessage();
bool HookUserMessage2(int msg_id,
IUserMessageListener *pListener,
@@ -78,8 +98,17 @@ public: //IUserMessages
bool UnhookUserMessage2(int msg_id,
IUserMessageListener *pListener,
bool intercept=false);
UserMessageType GetUserMessageType() const;
public:
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
#if SOURCE_ENGINE == SE_CSGO
void OnSendUserMessage_Pre(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg);
void OnSendUserMessage_Post(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg);
#endif
#if SOURCE_ENGINE == SE_CSGO
protobuf::Message *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name);
protobuf::Message *OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name);
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
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
@@ -89,24 +118,40 @@ public:
void OnMessageEnd_Pre();
void OnMessageEnd_Post();
private:
bool InternalHook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew);
bool InternalUnhook(int msg_id, IUserMessageListener *pListener, bool intercept, bool isNew);
#ifdef USE_PROTOBUF_USERMESSAGES
bool InternalHook(int msg_id, IProtobufUserMessageListener *pListener, bool intercept, bool isNew);
bool InternalUnhook(int msg_id, IProtobufUserMessageListener *pListener, bool intercept, bool isNew);
#else
bool InternalHook(int msg_id, IBitBufUserMessageListener *pListener, bool intercept, bool isNew);
bool InternalUnhook(int msg_id, IBitBufUserMessageListener *pListener, bool intercept, bool isNew);
#endif
void _DecRefCounter();
private:
List<ListenerInfo *> m_msgHooks[255];
List<ListenerInfo *> m_msgIntercepts[255];
CStack<ListenerInfo *> m_FreeListeners;
unsigned char m_pBase[2500];
IRecipientFilter *m_CurRecFilter;
#ifndef USE_PROTOBUF_USERMESSAGES
unsigned char m_pBase[2500];
bf_write m_InterceptBuffer;
bf_write *m_OrigBuffer;
bf_read m_ReadBuffer;
#else
// The engine used to provide this. Now we track it.
protobuf::Message *m_OrigBuffer;
protobuf::Message *m_FakeEngineBuffer;
META_RES m_FakeMetaRes;
protobuf::Message *m_InterceptBuffer;
#endif
size_t m_HookCount;
bool m_InHook;
bool m_BlockEndPost;
#ifndef USE_PROTOBUF_USERMESSAGES
bool m_FallbackSearch;
Trie *m_Names;
#endif
CellRecipientFilter m_CellRecFilter;
bool m_InExec;
int m_CurFlags;
+5 -2
View File
@@ -24,7 +24,7 @@
#ifdef _WIN32
#define FORCEINLINE_CVAR FORCEINLINE
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
#define FORCEINLINE_CVAR inline
#else
#error "implement me"
@@ -386,7 +386,7 @@ public:
virtual void SetValue( const char *value );
virtual void SetValue( float value );
virtual void SetValue( int value );
#if SOURCE_ENGINE == SE_LEFT4DEAD2
#if SOURCE_ENGINE >= SE_NUCLEARDAWN
virtual void SetValue( Color value );
#endif
@@ -404,6 +404,9 @@ private:
// For CVARs marked FCVAR_NEVER_AS_STRING
virtual void InternalSetFloatValue( float fNewValue );
virtual void InternalSetIntValue( int nValue );
#if SOURCE_ENGINE >= SE_LEFT4DEAD2
virtual void InternalSetColorValue( Color value );
#endif
virtual bool ClampValue( float& value );
virtual void ChangeStringValue( const char *tempVal, float flOldValue );
+1 -1
View File
@@ -24,7 +24,7 @@
#ifdef _WIN32
#define FORCEINLINE_CVAR FORCEINLINE
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
#define FORCEINLINE_CVAR inline
#else
#error "implement me"
File diff suppressed because it is too large Load Diff
+21 -1
View File
@@ -12,6 +12,9 @@ compiler['CDEFINES'].append('SM_LOGIC')
if AMBuild.target['platform'] == 'linux':
compiler['POSTLINKFLAGS'].append('-lpthread')
if AMBuild.target['platform'] == 'darwin':
compiler['CFLAGS'].extend(['-Wno-deprecated-declarations'])
compiler['POSTLINKFLAGS'].extend(['-framework', 'CoreServices'])
extension = AMBuild.AddJob('sourcemod.logic')
binary = Cpp.LibraryBuilder('sourcemod.logic', AMBuild, extension, compiler)
@@ -29,7 +32,23 @@ files = [
'smn_textparse.cpp',
'smn_adt_trie.cpp',
'Profiler.cpp',
'smn_functions.cpp'
'smn_functions.cpp',
'smn_timers.cpp',
'smn_players.cpp',
'MemoryUtils.cpp',
'smn_admin.cpp',
'smn_banning.cpp',
'stringutil.cpp',
'Translator.cpp',
'PhraseCollection.cpp',
'smn_lang.cpp',
'smn_string.cpp',
'smn_handles.cpp',
'smn_datapacks.cpp',
'smn_gameconfigs.cpp',
'GameConfigs.cpp',
'sm_crc32.cpp',
'smn_profiler.cpp'
]
if AMBuild.target['platform'] == 'windows':
files.append('thread/WinThreads.cpp')
@@ -37,5 +56,6 @@ else:
files.append('thread/PosixThreads.cpp')
binary.AddSourceFiles('core/logic', files)
SM.AutoVersion('core/logic', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
+92
View File
@@ -0,0 +1,92 @@
/**
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#ifndef _INCLUDE_SOURCEMOD_AUTO_HANDLE_ROOTER_H_
#define _INCLUDE_SOURCEMOD_AUTO_HANDLE_ROOTER_H_
#include "common_logic.h"
#include <IHandleSys.h>
class AutoHandleRooter
{
public:
AutoHandleRooter(Handle_t hndl)
{
if (hndl != BAD_HANDLE)
this->hndl = handlesys->FastCloneHandle(hndl);
else
this->hndl = BAD_HANDLE;
}
~AutoHandleRooter()
{
if (hndl != BAD_HANDLE)
{
HandleSecurity sec(g_pCoreIdent, g_pCoreIdent);
handlesys->FreeHandle(hndl, &sec);
}
}
Handle_t getHandle()
{
return hndl;
}
private:
Handle_t hndl;
};
class AutoHandleCloner
{
Handle_t original;
HandleSecurity sec;
AutoHandleRooter ahr;
public:
AutoHandleCloner(Handle_t original, HandleSecurity sec)
: original(original), sec(sec), ahr(original)
{
}
~AutoHandleCloner()
{
if (original != BAD_HANDLE)
{
handlesys->FreeHandle(original, &sec);
}
}
Handle_t getClone()
{
return ahr.getHandle();
}
};
#endif /* _INCLUDE_SOURCEMOD_AUTO_HANDLE_ROOTER_H_ */
File diff suppressed because it is too large Load Diff
@@ -32,13 +32,12 @@
#ifndef _INCLUDE_SOURCEMOD_CGAMECONFIGS_H_
#define _INCLUDE_SOURCEMOD_CGAMECONFIGS_H_
#include "common_logic.h"
#include <IGameConfigs.h>
#include <ITextParsers.h>
#include <sh_list.h>
#include "sm_trie.h"
#include "sm_globals.h"
#include "sm_memtable.h"
#include "sm_trie_tpl.h"
#include <sm_trie_tpl.h>
using namespace SourceMod;
using namespace SourceHook;
@@ -51,11 +50,13 @@ class CGameConfig :
{
friend class GameConfigManager;
public:
CGameConfig(const char *file);
CGameConfig(const char *file, const char *engine = NULL);
~CGameConfig();
public:
bool Reparse(char *error, size_t maxlength);
bool EnterFile(const char *file, char *error, size_t maxlength);
void SetBaseEngine(const char *engine);
void SetParseEngine(const char *engine);
public: //ITextListener_SMC
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
@@ -65,6 +66,7 @@ public: //IGameConfig
bool GetOffset(const char *key, int *value);
SendProp *GetSendProp(const char *key);
bool GetMemSig(const char *key, void **addr);
bool GetAddress(const char *key, void **addr);
public:
void IncRefCount();
unsigned int DecRefCount();
@@ -72,10 +74,10 @@ private:
BaseStringTable *m_pStrings;
char m_File[PLATFORM_MAX_PATH];
char m_CurFile[PLATFORM_MAX_PATH];
Trie *m_pOffsets;
Trie *m_pProps;
Trie *m_pKeys;
Trie *m_pSigs;
KTrie<int> m_Offsets;
KTrie<SendProp *> m_Props;
KTrie<int> m_Keys;
KTrie<void *> m_Sigs;
unsigned int m_RefCount;
/* Parse states */
int m_ParseState;
@@ -93,6 +95,26 @@ private:
/* Custom Sections */
unsigned int m_CustomLevel;
ITextListener_SMC *m_CustomHandler;
/* Support for reading Addresses */
struct AddressConf
{
char signatureName[64];
int readCount;
int read[8];
AddressConf(char *sigName, unsigned sigLength, unsigned readCount, int *read);
AddressConf() {}
};
char m_Address[64];
char m_AddressSignature[64];
int m_AddressReadCount;
int m_AddressRead[8];
KTrie<AddressConf> *m_pAddresses;
const char *m_pEngine;
const char *m_pBaseEngine;
};
class GameConfigManager :
@@ -118,7 +140,7 @@ public: //SMGlobalClass
void OnSourceModAllShutdown();
private:
List<CGameConfig *> m_cfgs;
Trie *m_pLookup;
KTrie<CGameConfig *> m_Lookup;
public:
KTrie<ITextListener_SMC *> m_customHandlers;
};
+17 -1
View File
@@ -25,7 +25,23 @@ OBJECTS = \
smn_textparse.cpp \
smn_adt_trie.cpp \
Profiler.cpp \
smn_functions.cpp
smn_functions.cpp \
sm_crc32.cpp \
smn_timers.cpp \
MemoryUtils.cpp \
smn_admin.cpp \
smn_banning.cpp \
stringutil.cpp \
Translator.cpp \
PhraseCollection.cpp \
smn_lang.cpp \
smn_string.cpp \
smn_handles.cpp \
smn_datapacks.cpp \
smn_gameconfigs.cpp \
GameConfigs.cpp \
smn_players.cpp \
smn_profiler.cpp
##############################################
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
+612
View File
@@ -0,0 +1,612 @@
/**
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2011 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*/
#include "MemoryUtils.h"
#ifdef PLATFORM_LINUX
#include <fcntl.h>
#include <link.h>
#include <sys/mman.h>
#define PAGE_SIZE 4096
#define PAGE_ALIGN_UP(x) ((x + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
#endif
#ifdef PLATFORM_APPLE
#include <AvailabilityMacros.h>
#include <mach/task.h>
#include <mach-o/dyld_images.h>
#include <mach-o/loader.h>
#include <mach-o/nlist.h>
/* Define things from 10.6 SDK for older SDKs */
#ifndef MAC_OS_X_VERSION_10_6
struct task_dyld_info
{
mach_vm_address_t all_image_info_addr;
mach_vm_size_t all_image_info_size;
};
typedef struct task_dyld_info task_dyld_info_data_t;
#define TASK_DYLD_INFO 17
#define TASK_DYLD_INFO_COUNT (sizeof(task_dyld_info_data_t) / sizeof(natural_t))
#endif // MAC_OS_X_VERSION_10_6
#endif // PLATFORM_APPLE
MemoryUtils g_MemUtils;
MemoryUtils::MemoryUtils()
{
#ifdef PLATFORM_APPLE
Gestalt(gestaltSystemVersionMajor, &m_OSXMajor);
Gestalt(gestaltSystemVersionMinor, &m_OSXMinor);
/* Get pointer to struct that describes all loaded mach-o images in process */
if ((m_OSXMajor == 10 && m_OSXMinor >= 6) || m_OSXMajor > 10)
{
task_dyld_info_data_t dyld_info;
mach_msg_type_number_t count = TASK_DYLD_INFO_COUNT;
task_info(mach_task_self(), TASK_DYLD_INFO, (task_info_t)&dyld_info, &count);
m_ImageList = (struct dyld_all_image_infos *)dyld_info.all_image_info_addr;
}
else
{
struct nlist list[2];
memset(list, 0, sizeof(list));
list[0].n_un.n_name = (char *)"_dyld_all_image_infos";
nlist("/usr/lib/dyld", list);
m_ImageList = (struct dyld_all_image_infos *)list[0].n_value;
}
#endif
}
MemoryUtils::~MemoryUtils()
{
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
for (size_t i = 0; i < m_SymTables.size(); i++)
{
delete m_SymTables[i];
}
m_SymTables.clear();
#endif
}
void MemoryUtils::OnSourceModAllInitialized()
{
sharesys->AddInterface(NULL, this);
}
void *MemoryUtils::FindPattern(const void *libPtr, const char *pattern, size_t len)
{
DynLibInfo lib;
bool found;
char *ptr, *end;
memset(&lib, 0, sizeof(DynLibInfo));
if (!GetLibraryInfo(libPtr, lib))
{
return NULL;
}
ptr = reinterpret_cast<char *>(lib.baseAddress);
end = ptr + lib.memorySize - len;
while (ptr < end)
{
found = true;
for (register size_t i = 0; i < len; i++)
{
if (pattern[i] != '\x2A' && pattern[i] != ptr[i])
{
found = false;
break;
}
}
if (found)
return ptr;
ptr++;
}
return NULL;
}
void *MemoryUtils::ResolveSymbol(void *handle, const char *symbol)
{
#ifdef PLATFORM_WINDOWS
return GetProcAddress((HMODULE)handle, symbol);
#elif defined PLATFORM_LINUX
struct link_map *dlmap;
struct stat dlstat;
int dlfile;
uintptr_t map_base;
Elf32_Ehdr *file_hdr;
Elf32_Shdr *sections, *shstrtab_hdr, *symtab_hdr, *strtab_hdr;
Elf32_Sym *symtab;
const char *shstrtab, *strtab;
uint16_t section_count;
uint32_t symbol_count;
LibSymbolTable *libtable;
SymbolTable *table;
Symbol *symbol_entry;
dlmap = (struct link_map *)handle;
symtab_hdr = NULL;
strtab_hdr = NULL;
table = NULL;
/* See if we already have a symbol table for this library */
for (size_t i = 0; i < m_SymTables.size(); i++)
{
libtable = m_SymTables[i];
if (libtable->lib_base == dlmap->l_addr)
{
table = &libtable->table;
break;
}
}
/* If we don't have a symbol table for this library, then create one */
if (table == NULL)
{
libtable = new LibSymbolTable();
libtable->table.Initialize();
libtable->lib_base = dlmap->l_addr;
libtable->last_pos = 0;
table = &libtable->table;
m_SymTables.push_back(libtable);
}
/* See if the symbol is already cached in our table */
symbol_entry = table->FindSymbol(symbol, strlen(symbol));
if (symbol_entry != NULL)
{
return symbol_entry->address;
}
/* If symbol isn't in our table, then we have open the actual library */
dlfile = open(dlmap->l_name, O_RDONLY);
if (dlfile == -1 || fstat(dlfile, &dlstat) == -1)
{
close(dlfile);
return NULL;
}
/* Map library file into memory */
file_hdr = (Elf32_Ehdr *)mmap(NULL, dlstat.st_size, PROT_READ, MAP_PRIVATE, dlfile, 0);
map_base = (uintptr_t)file_hdr;
if (file_hdr == MAP_FAILED)
{
close(dlfile);
return NULL;
}
close(dlfile);
if (file_hdr->e_shoff == 0 || file_hdr->e_shstrndx == SHN_UNDEF)
{
munmap(file_hdr, dlstat.st_size);
return NULL;
}
sections = (Elf32_Shdr *)(map_base + file_hdr->e_shoff);
section_count = file_hdr->e_shnum;
/* Get ELF section header string table */
shstrtab_hdr = &sections[file_hdr->e_shstrndx];
shstrtab = (const char *)(map_base + shstrtab_hdr->sh_offset);
/* Iterate sections while looking for ELF symbol table and string table */
for (uint16_t i = 0; i < section_count; i++)
{
Elf32_Shdr &hdr = sections[i];
const char *section_name = shstrtab + hdr.sh_name;
if (strcmp(section_name, ".symtab") == 0)
{
symtab_hdr = &hdr;
}
else if (strcmp(section_name, ".strtab") == 0)
{
strtab_hdr = &hdr;
}
}
/* Uh oh, we don't have a symbol table or a string table */
if (symtab_hdr == NULL || strtab_hdr == NULL)
{
munmap(file_hdr, dlstat.st_size);
return NULL;
}
symtab = (Elf32_Sym *)(map_base + symtab_hdr->sh_offset);
strtab = (const char *)(map_base + strtab_hdr->sh_offset);
symbol_count = symtab_hdr->sh_size / symtab_hdr->sh_entsize;
/* Iterate symbol table starting from the position we were at last time */
for (uint32_t i = libtable->last_pos; i < symbol_count; i++)
{
Elf32_Sym &sym = symtab[i];
unsigned char sym_type = ELF32_ST_TYPE(sym.st_info);
const char *sym_name = strtab + sym.st_name;
Symbol *cur_sym;
/* Skip symbols that are undefined or do not refer to functions or objects */
if (sym.st_shndx == SHN_UNDEF || (sym_type != STT_FUNC && sym_type != STT_OBJECT))
{
continue;
}
/* Caching symbols as we go along */
cur_sym = table->InternSymbol(sym_name, strlen(sym_name), (void *)(dlmap->l_addr + sym.st_value));
if (strcmp(symbol, sym_name) == 0)
{
symbol_entry = cur_sym;
libtable->last_pos = ++i;
break;
}
}
munmap(file_hdr, dlstat.st_size);
return symbol_entry ? symbol_entry->address : NULL;
#elif defined PLATFORM_APPLE
uintptr_t dlbase, linkedit_addr;
uint32_t image_count;
struct mach_header *file_hdr;
struct load_command *loadcmds;
struct segment_command *linkedit_hdr;
struct symtab_command *symtab_hdr;
struct nlist *symtab;
const char *strtab;
uint32_t loadcmd_count;
uint32_t symbol_count;
LibSymbolTable *libtable;
SymbolTable *table;
Symbol *symbol_entry;
dlbase = 0;
image_count = m_ImageList->infoArrayCount;
linkedit_hdr = NULL;
symtab_hdr = NULL;
table = NULL;
/* Loop through mach-o images in process.
* We can skip index 0 since that is just the executable.
*/
for (uint32_t i = 1; i < image_count; i++)
{
const struct dyld_image_info &info = m_ImageList->infoArray[i];
/* "Load" each one until we get a matching handle */
void *h = dlopen(info.imageFilePath, RTLD_NOLOAD);
if (h == handle)
{
dlbase = (uintptr_t)info.imageLoadAddress;
dlclose(h);
break;
}
dlclose(h);
}
if (!dlbase)
{
/* Uh oh, we couldn't find a matching handle */
return NULL;
}
/* See if we already have a symbol table for this library */
for (size_t i = 0; i < m_SymTables.size(); i++)
{
libtable = m_SymTables[i];
if (libtable->lib_base == dlbase)
{
table = &libtable->table;
break;
}
}
/* If we don't have a symbol table for this library, then create one */
if (table == NULL)
{
libtable = new LibSymbolTable();
libtable->table.Initialize();
libtable->lib_base = dlbase;
libtable->last_pos = 0;
table = &libtable->table;
m_SymTables.push_back(libtable);
}
/* See if the symbol is already cached in our table */
symbol_entry = table->FindSymbol(symbol, strlen(symbol));
if (symbol_entry != NULL)
{
return symbol_entry->address;
}
/* If symbol isn't in our table, then we have to locate it in memory */
file_hdr = (struct mach_header *)dlbase;
loadcmds = (struct load_command *)(dlbase + sizeof(struct mach_header));
loadcmd_count = file_hdr->ncmds;
/* Loop through load commands until we find the ones for the symbol table */
for (uint32_t i = 0; i < loadcmd_count; i++)
{
if (loadcmds->cmd == LC_SEGMENT && !linkedit_hdr)
{
struct segment_command *seg = (struct segment_command *)loadcmds;
if (strcmp(seg->segname, "__LINKEDIT") == 0)
{
linkedit_hdr = seg;
if (symtab_hdr)
{
break;
}
}
}
else if (loadcmds->cmd == LC_SYMTAB)
{
symtab_hdr = (struct symtab_command *)loadcmds;
if (linkedit_hdr)
{
break;
}
}
/* Load commands are not of a fixed size which is why we add the size */
loadcmds = (struct load_command *)((uintptr_t)loadcmds + loadcmds->cmdsize);
}
if (!linkedit_hdr || !symtab_hdr || !symtab_hdr->symoff || !symtab_hdr->stroff)
{
/* Uh oh, no symbol table */
return NULL;
}
linkedit_addr = dlbase + linkedit_hdr->vmaddr;
symtab = (struct nlist *)(linkedit_addr + symtab_hdr->symoff - linkedit_hdr->fileoff);
strtab = (const char *)(linkedit_addr + symtab_hdr->stroff - linkedit_hdr->fileoff);
symbol_count = symtab_hdr->nsyms;
/* Iterate symbol table starting from the position we were at last time */
for (uint32_t i = libtable->last_pos; i < symbol_count; i++)
{
struct nlist &sym = symtab[i];
/* Ignore the prepended underscore on all symbols, so +1 here */
const char *sym_name = strtab + sym.n_un.n_strx + 1;
Symbol *cur_sym;
/* Skip symbols that are undefined */
if (sym.n_sect == NO_SECT)
{
continue;
}
/* Caching symbols as we go along */
cur_sym = table->InternSymbol(sym_name, strlen(sym_name), (void *)(dlbase + sym.n_value));
if (strcmp(symbol, sym_name) == 0)
{
symbol_entry = cur_sym;
libtable->last_pos = ++i;
break;
}
}
return symbol_entry ? symbol_entry->address : NULL;
#endif
}
bool MemoryUtils::GetLibraryInfo(const void *libPtr, DynLibInfo &lib)
{
uintptr_t baseAddr;
if (libPtr == NULL)
{
return false;
}
#ifdef PLATFORM_WINDOWS
MEMORY_BASIC_INFORMATION info;
IMAGE_DOS_HEADER *dos;
IMAGE_NT_HEADERS *pe;
IMAGE_FILE_HEADER *file;
IMAGE_OPTIONAL_HEADER *opt;
if (!VirtualQuery(libPtr, &info, sizeof(MEMORY_BASIC_INFORMATION)))
{
return false;
}
baseAddr = reinterpret_cast<uintptr_t>(info.AllocationBase);
/* All this is for our insane sanity checks :o */
dos = reinterpret_cast<IMAGE_DOS_HEADER *>(baseAddr);
pe = reinterpret_cast<IMAGE_NT_HEADERS *>(baseAddr + dos->e_lfanew);
file = &pe->FileHeader;
opt = &pe->OptionalHeader;
/* Check PE magic and signature */
if (dos->e_magic != IMAGE_DOS_SIGNATURE || pe->Signature != IMAGE_NT_SIGNATURE || opt->Magic != IMAGE_NT_OPTIONAL_HDR32_MAGIC)
{
return false;
}
/* Check architecture, which is 32-bit/x86 right now
* Should change this for 64-bit if Valve gets their act together
*/
if (file->Machine != IMAGE_FILE_MACHINE_I386)
{
return false;
}
/* For our purposes, this must be a dynamic library */
if ((file->Characteristics & IMAGE_FILE_DLL) == 0)
{
return false;
}
/* Finally, we can do this */
lib.memorySize = opt->SizeOfImage;
#elif defined PLATFORM_LINUX
Dl_info info;
Elf32_Ehdr *file;
Elf32_Phdr *phdr;
uint16_t phdrCount;
if (!dladdr(libPtr, &info))
{
return false;
}
if (!info.dli_fbase || !info.dli_fname)
{
return false;
}
/* This is for our insane sanity checks :o */
baseAddr = reinterpret_cast<uintptr_t>(info.dli_fbase);
file = reinterpret_cast<Elf32_Ehdr *>(baseAddr);
/* Check ELF magic */
if (memcmp(ELFMAG, file->e_ident, SELFMAG) != 0)
{
return false;
}
/* Check ELF version */
if (file->e_ident[EI_VERSION] != EV_CURRENT)
{
return false;
}
/* Check ELF architecture, which is 32-bit/x86 right now
* Should change this for 64-bit if Valve gets their act together
*/
if (file->e_ident[EI_CLASS] != ELFCLASS32 || file->e_machine != EM_386 || file->e_ident[EI_DATA] != ELFDATA2LSB)
{
return false;
}
/* For our purposes, this must be a dynamic library/shared object */
if (file->e_type != ET_DYN)
{
return false;
}
phdrCount = file->e_phnum;
phdr = reinterpret_cast<Elf32_Phdr *>(baseAddr + file->e_phoff);
for (uint16_t i = 0; i < phdrCount; i++)
{
Elf32_Phdr &hdr = phdr[i];
/* We only really care about the segment with executable code */
if (hdr.p_type == PT_LOAD && hdr.p_flags == (PF_X|PF_R))
{
/* From glibc, elf/dl-load.c:
* c->mapend = ((ph->p_vaddr + ph->p_filesz + GLRO(dl_pagesize) - 1)
* & ~(GLRO(dl_pagesize) - 1));
*
* In glibc, the segment file size is aligned up to the nearest page size and
* added to the virtual address of the segment. We just want the size here.
*/
lib.memorySize = PAGE_ALIGN_UP(hdr.p_filesz);
break;
}
}
#elif defined PLATFORM_APPLE
Dl_info info;
struct mach_header *file;
struct segment_command *seg;
uint32_t cmd_count;
if (!dladdr(libPtr, &info))
{
return false;
}
if (!info.dli_fbase || !info.dli_fname)
{
return false;
}
/* This is for our insane sanity checks :o */
baseAddr = (uintptr_t)info.dli_fbase;
file = (struct mach_header *)baseAddr;
/* Check Mach-O magic */
if (file->magic != MH_MAGIC)
{
return false;
}
/* Check architecture (32-bit/x86) */
if (file->cputype != CPU_TYPE_I386 || file->cpusubtype != CPU_SUBTYPE_I386_ALL)
{
return false;
}
/* For our purposes, this must be a dynamic library */
if (file->filetype != MH_DYLIB)
{
return false;
}
cmd_count = file->ncmds;
seg = (struct segment_command *)(baseAddr + sizeof(struct mach_header));
/* Add up memory sizes of mapped segments */
for (uint32_t i = 0; i < cmd_count; i++)
{
if (seg->cmd == LC_SEGMENT)
{
lib.memorySize += seg->vmsize;
}
seg = (struct segment_command *)((uintptr_t)seg + seg->cmdsize);
}
#endif
lib.baseAddress = reinterpret_cast<void *>(baseAddr);
return true;
}
@@ -2,7 +2,7 @@
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2000 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2011 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -30,9 +30,9 @@
#ifndef _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
#define _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
#include "common_logic.h"
#include <IMemoryUtils.h>
#include "sm_globals.h"
#ifdef PLATFORM_LINUX
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
#include <sh_vector.h>
#include "sm_symtable.h"
@@ -41,19 +41,21 @@ using namespace SourceHook;
using namespace SourceMod;
#ifdef PLATFORM_APPLE
#include <CoreServices/CoreServices.h>
#endif
struct DynLibInfo
{
void *baseAddress;
size_t memorySize;
};
#ifdef PLATFORM_LINUX
typedef uint32_t Elf32_Addr;
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
struct LibSymbolTable
{
SymbolTable table;
Elf32_Addr lib_base;
uintptr_t lib_base;
uint32_t last_pos;
};
#endif
@@ -63,6 +65,7 @@ class MemoryUtils :
public SMGlobalClass
{
public:
MemoryUtils();
~MemoryUtils();
public: // SMGlobalClass
void OnSourceModAllInitialized();
@@ -71,9 +74,14 @@ public: // IMemoryUtils
void *ResolveSymbol(void *handle, const char *symbol);
public:
bool GetLibraryInfo(const void *libPtr, DynLibInfo &lib);
#ifdef PLATFORM_LINUX
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
private:
CVector<LibSymbolTable *> m_SymTables;
#ifdef PLATFORM_APPLE
struct dyld_all_image_infos *m_ImageList;
SInt32 m_OSXMajor;
SInt32 m_OSXMinor;
#endif
#endif
};
@@ -29,9 +29,9 @@
* Version: $Id$
*/
#include "common_logic.h"
#include "PhraseCollection.h"
#include "Translator.h"
#include "sm_stringutil.h"
CPhraseCollection::CPhraseCollection()
{
@@ -54,7 +54,7 @@ IPhraseFile *CPhraseCollection::AddPhraseFile(const char *filename)
char full_name[PLATFORM_MAX_PATH];
/* No compat shim here. The user should have read the doc. */
UTIL_Format(full_name, sizeof(full_name), "%s.txt", filename);
smcore.Format(full_name, sizeof(full_name), "%s.txt", filename);
fid = g_Translator.FindOrAddPhraseFile(full_name);
pFile = g_Translator.GetFileByIndex(fid);
@@ -113,7 +113,7 @@ bool CPhraseCollection::FormatString(char *buffer,
unsigned int arg;
arg = 0;
if (!gnprintf(buffer, maxlength, format, this, params, numparams, arg, pOutLength, pFailPhrase))
if (!smcore.gnprintf(buffer, maxlength, format, this, params, numparams, arg, pOutLength, pFailPhrase))
{
return false;
}
+35 -3
View File
@@ -36,6 +36,7 @@
#include <time.h>
#endif
#include <IPluginSys.h>
#include "stringutil.h"
ProfileEngine g_Profiler;
IProfiler *sm_profiler = &g_Profiler;
@@ -341,15 +342,46 @@ void ProfileEngine::OnRootConsoleCommand2(const char *cmdname, const ICommandArg
GenerateReport(fp);
fclose(fp);
Clear();
rootmenu->ConsolePrint("Profiler report generated as: %s\n", path);
return;
}
else if (strcmp(command->Arg(2), "report") == 0)
{
FILE *fp;
char path[256];
g_pSM->BuildPath(Path_SM, path, sizeof(path), "logs/profile_%d.xml", (int)time(NULL));
if ((fp = fopen(path, "wt")) == NULL)
{
rootmenu->ConsolePrint("Failed, could not open file for writing: %s", path);
return;
}
GenerateReport(fp);
fclose(fp);
rootmenu->ConsolePrint("Profiler report generated as: %s\n", path);
return;
}
else if (strcmp(command->Arg(2), "clear") == 0)
{
Clear();
rootmenu->ConsolePrint("Profiler statistics cleared.\n");
return;
}
}
rootmenu->ConsolePrint("Profiler commands:");
rootmenu->DrawGenericOption("flush", "Flushes statistics to disk and starts over");
rootmenu->DrawGenericOption("report", "Flushes statistics to disk");
rootmenu->DrawGenericOption("clear", "Clears statistics");
}
bool ProfileEngine::GenerateReport(FILE *fp)
@@ -386,9 +418,9 @@ void ProfileEngine::WriteReport(FILE *fp, ProfileReport *report, const char *nam
{
ar = report->GetReport(i);
smcore.strncopy(new_name, ar->atom_name, sizeof(new_name));
smcore.ReplaceAll(new_name, sizeof(new_name), "<", "&lt;", true);
smcore.ReplaceAll(new_name, sizeof(new_name), ">", "&gt;", true);
strncopy(new_name, ar->atom_name, sizeof(new_name));
UTIL_ReplaceAll(new_name, sizeof(new_name), "<", "&lt;", true);
UTIL_ReplaceAll(new_name, sizeof(new_name), ">", "&gt;", true);
fprintf(fp, " <item name=\"%s\" numcalls=\"%d\" mintime=\"%f\" maxtime=\"%f\" totaltime=\"%f\"/>\n",
new_name,
+1 -1
View File
@@ -872,7 +872,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene
ptr = save_ptr;
/* Lastly, strip ending whitespace off */
for (size_t i=len-1; i>=0 && i<len; i--)
for (size_t i=len-1; i<len; i--)
{
if (g_ws_chartable[(unsigned char)ptr[i]])
{
+109 -121
View File
@@ -29,22 +29,24 @@
* Version: $Id$
*/
#include "common_logic.h"
#include <stdarg.h>
#include <stdlib.h>
#include <ctype.h>
#include <sm_platform.h>
#include "Translator.h"
#include "Logger.h"
#include "LibrarySys.h"
#include "sm_stringutil.h"
#include "sourcemod.h"
#include "PlayerManager.h"
#include <IPlayerHelpers.h>
#include <ISourceMod.h>
#include <ILibrarySys.h>
#include "PhraseCollection.h"
#include "ShareSys.h"
#include "stringutil.h"
Translator g_Translator;
IPhraseCollection *g_pCorePhrases = NULL;
unsigned int g_pCorePhraseID = 0;
using namespace SourceMod;
struct trans_t
{
int stridx;
@@ -67,15 +69,10 @@ CPhraseFile::CPhraseFile(Translator *pTranslator, const char *file)
m_LangCount = pTranslator->GetLanguageCount();
m_File.assign(file);
m_pTranslator = pTranslator;
m_pPhraseLookup = NULL;
}
CPhraseFile::~CPhraseFile()
{
if (m_pPhraseLookup)
{
sm_trie_destroy(m_pPhraseLookup);
}
}
void CPhraseFile::ParseError(const char *message, ...)
@@ -99,20 +96,16 @@ void CPhraseFile::ParseWarning(const char *message, ...)
if (!m_FileLogged)
{
g_Logger.LogError("[SM] Warning(s) encountered in translation file \"%s\"", m_File.c_str());
smcore.LogError("[SM] Warning(s) encountered in translation file \"%s\"", m_File.c_str());
m_FileLogged = true;
}
g_Logger.LogError("[SM] %s", buffer);
smcore.LogError("[SM] %s", buffer);
}
void CPhraseFile::ReparseFile()
{
if (m_pPhraseLookup)
{
sm_trie_destroy(m_pPhraseLookup);
}
m_pPhraseLookup = sm_trie_create();
m_PhraseLookup.clear();
m_LangCount = m_pTranslator->GetLanguageCount();
@@ -123,19 +116,19 @@ void CPhraseFile::ReparseFile()
SMCError err;
char path[PLATFORM_MAX_PATH];
g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "translations/%s", m_File.c_str());
g_pSM->BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "translations/%s", m_File.c_str());
//backwards compatibility shim
/* :HACKHACK: Change .cfg/.txt and vice versa for compatibility */
if (!g_LibSys.PathExists(path))
if (!libsys->PathExists(path))
{
if (m_File.compare("common.cfg") == 0)
{
UTIL_ReplaceAll(path, sizeof(path), "common.cfg", "common.phrases.txt");
UTIL_ReplaceAll(path, sizeof(path), "common.cfg", "common.phrases.txt", true);
} else if (strstr(path, ".cfg")) {
UTIL_ReplaceAll(path, sizeof(path), ".cfg", ".txt");
UTIL_ReplaceAll(path, sizeof(path), ".cfg", ".txt", true);
} else if (strstr(path, ".txt")) {
UTIL_ReplaceAll(path, sizeof(path), ".txt", ".cfg");
UTIL_ReplaceAll(path, sizeof(path), ".txt", ".cfg", true);
}
}
@@ -149,8 +142,8 @@ void CPhraseFile::ReparseFile()
msg = m_ParseError.c_str();
}
g_Logger.LogError("[SM] Fatal error encountered parsing translation file \"%s\"", m_File.c_str());
g_Logger.LogError("[SM] Error (line %d, column %d): %s", states.line, states.col, msg);
smcore.LogError("[SM] Fatal error encountered parsing translation file \"%s\"", m_File.c_str());
smcore.LogError("[SM] Error (line %d, column %d): %s", states.line, states.col, msg);
}
const char *code;
@@ -161,7 +154,7 @@ void CPhraseFile::ReparseFile()
continue;
}
g_SourceMod.BuildPath(Path_SM,
g_pSM->BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
"translations/%s/%s",
@@ -169,7 +162,7 @@ void CPhraseFile::ReparseFile()
m_File.c_str());
/* Speculatively load these. */
if (!g_LibSys.PathExists(path))
if (!libsys->PathExists(path))
{
continue;
}
@@ -182,10 +175,10 @@ void CPhraseFile::ReparseFile()
msg = m_ParseError.c_str();
}
g_Logger.LogError("[SM] Fatal error encountered parsing translation file \"%s/%s\"",
smcore.LogError("[SM] Fatal error encountered parsing translation file \"%s/%s\"",
code,
m_File.c_str());
g_Logger.LogError("[SM] Error (line %d, column %d): %s",
smcore.LogError("[SM] Error (line %d, column %d): %s",
states.line,
states.col,
msg);
@@ -217,17 +210,17 @@ SMCResult CPhraseFile::ReadSMC_NewSection(const SMCStates *states, const char *n
m_ParseState = PPS_InPhrase;
recognized = true;
void *value;
if (sm_trie_retrieve(m_pPhraseLookup, name, &value))
int *pvalue;
if ((pvalue = m_PhraseLookup.retrieve(name)) != NULL)
{
m_CurPhrase = reinterpret_cast<int>(value);
m_CurPhrase = *pvalue;
}
else
{
phrase_t *pPhrase;
m_CurPhrase = m_pMemory->CreateMem(sizeof(phrase_t), (void **)&pPhrase);
sm_trie_insert(m_pPhraseLookup, name, reinterpret_cast<void *>(m_CurPhrase));
m_PhraseLookup.insert(name, m_CurPhrase);
/* Initialize new phrase */
trans_t *pTrans;
@@ -486,13 +479,6 @@ SMCResult CPhraseFile::ReadSMC_KeyValue(const SMCStates *states, const char *key
}
else
{
size_t len = strlen(key);
if (len < 2 || len > 3)
{
ParseWarning("Ignoring translation to invalid language \"%s\" on line %d.", key, states->line);
return SMCResult_Continue;
}
unsigned int lang;
if (!m_pTranslator->GetLanguageByCode(key, &lang))
{
@@ -505,7 +491,7 @@ SMCResult CPhraseFile::ReadSMC_KeyValue(const SMCStates *states, const char *key
/* See how many bytes we need for this string, then allocate.
* NOTE: THIS SHOULD GUARANTEE THAT WE DO NOT NEED TO NEED TO SIZE CHECK
*/
len = strlen(value) + pPhrase->fmt_bytes + 1;
size_t len = strlen(value) + pPhrase->fmt_bytes + 1;
char *out_buf;
int out_idx;
@@ -639,9 +625,7 @@ SMCResult CPhraseFile::ReadSMC_LeavingSection(const SMCStates *states)
if (m_ParseState == PPS_InPhrase)
{
if (m_CurPhrase == -1 && m_LastPhraseString.size())
{
sm_trie_delete(m_pPhraseLookup, m_LastPhraseString.c_str());
}
m_PhraseLookup.remove(m_LastPhraseString.c_str());
m_CurPhrase = -1;
m_ParseState = PPS_Phrases;
m_LastPhraseString.assign("");
@@ -658,9 +642,7 @@ void CPhraseFile::ReadSMC_ParseEnd(bool halted, bool failed)
{
/* Check to see if we have any dangling phrases that weren't completed, and scrap them */
if ((halted || failed) && m_LastPhraseString.size())
{
sm_trie_delete(m_pPhraseLookup, m_LastPhraseString.c_str());
}
m_PhraseLookup.remove(m_LastPhraseString.c_str());
}
TransError CPhraseFile::GetTranslation(const char *szPhrase, unsigned int lang_id, Translation *pTrans)
@@ -670,13 +652,11 @@ TransError CPhraseFile::GetTranslation(const char *szPhrase, unsigned int lang_i
return Trans_BadLanguage;
}
void *object;
if (!sm_trie_retrieve(m_pPhraseLookup, szPhrase, &object))
{
int *pvalue;
if ((pvalue = m_PhraseLookup.retrieve(szPhrase)) == NULL)
return Trans_BadPhrase;
}
phrase_t *pPhrase = (phrase_t *)m_pMemory->GetAddress(reinterpret_cast<int>(object));
phrase_t *pPhrase = (phrase_t *)m_pMemory->GetAddress(*pvalue);
trans_t *trans = (trans_t *)m_pMemory->GetAddress(pPhrase->trans_tbl);
trans = &trans[lang_id];
@@ -705,7 +685,6 @@ const char *CPhraseFile::GetFilename()
Translator::Translator() : m_ServerLang(SOURCEMOD_LANGUAGE_ENGLISH)
{
m_pStringTab = new BaseStringTable(2048);
m_pLCodeLookup = sm_trie_create();
strncopy(m_InitialLang, "en", sizeof(m_InitialLang));
}
@@ -721,8 +700,6 @@ Translator::~Translator()
delete m_Languages[i];
}
sm_trie_destroy(m_pLCodeLookup);
delete m_pStringTab;
}
@@ -739,13 +716,13 @@ ConfigResult Translator::OnSourceModConfigChanged(const char *key,
unsigned int index;
if (!GetLanguageByCode(value, &index))
{
UTIL_Format(error, maxlength, "Language code \"%s\" is not registered", value);
smcore.Format(error, maxlength, "Language code \"%s\" is not registered", value);
return ConfigResult_Reject;
}
m_ServerLang = index;
} else {
strncopy(m_InitialLang, value, sizeof(m_InitialLang));
smcore.strncopy(m_InitialLang, value, sizeof(m_InitialLang));
}
return ConfigResult_Accept;
@@ -758,7 +735,7 @@ void Translator::OnSourceModLevelChange(const char *mapName)
{
/* Refresh language stuff */
char path[PLATFORM_MAX_PATH];
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "configs/languages.cfg");
g_pSM->BuildPath(Path_SM, path, sizeof(path), "configs/languages.cfg");
RebuildLanguageDatabase(path);
}
@@ -766,10 +743,16 @@ void Translator::OnSourceModAllInitialized()
{
AddLanguage("en", "English");
const char* lang = smcore.GetCoreConfigValue("ServerLang");
if (lang)
{
strncpy(m_InitialLang, lang, sizeof(m_InitialLang));
}
g_pCorePhrases = CreatePhraseCollection();
g_pCorePhrases->AddPhraseFile("core.phrases");
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
}
void Translator::OnSourceModShutdown()
@@ -779,43 +762,38 @@ void Translator::OnSourceModShutdown()
bool Translator::GetLanguageByCode(const char *code, unsigned int *index)
{
void *_index;
unsigned int *pindex;
if (!sm_trie_retrieve(m_pLCodeLookup, code, &_index))
{
if ((pindex = m_LCodeLookup.retrieve(code)) == NULL)
return false;
}
if (index)
{
*index = reinterpret_cast<unsigned int>(_index);
}
*index = *pindex;
return true;
}
bool Translator::GetLanguageByName(const char *name, unsigned int *index)
{
CVector<Language *>::iterator iter;
unsigned int id = 0;
for (iter=m_Languages.begin(); iter!=m_Languages.end(); iter++, id++)
char lower[256];
size_t len = strlen(name);
if (len > 255) len = 255;
for (size_t i = 0; i < len; i++)
{
if (strcasecmp(m_pStringTab->GetString((*iter)->m_FullName), name) == 0)
{
break;
}
if (name[i] >= 'A' && name[i] <= 'Z')
lower[i] = tolower(name[i]);
else
lower[i] = name[i];
}
lower[len] = '\0';
if (iter == m_Languages.end())
{
unsigned int *pIndex;
if ((pIndex = m_LAliases.retrieve(lower)) == NULL)
return false;
}
if (index)
{
*index = id;
}
*index = *pIndex;
return true;
}
@@ -853,8 +831,8 @@ unsigned int Translator::FindOrAddPhraseFile(const char *phrase_file)
void Translator::RebuildLanguageDatabase(const char *lang_header_file)
{
/* Erase everything we have */
sm_trie_destroy(m_pLCodeLookup);
m_pLCodeLookup = sm_trie_create();
m_LCodeLookup.clear();
m_LAliases.clear();
m_pStringTab->Reset();
for (size_t i=0; i<m_Languages.size(); i++)
@@ -874,25 +852,27 @@ void Translator::RebuildLanguageDatabase(const char *lang_header_file)
str_err = m_CustomError.c_str();
}
g_Logger.LogError("[SM] Failed to parse language header file: \"%s\"", lang_header_file);
g_Logger.LogError("[SM] Parse error (line %d, column %d): %s", states.line, states.col, str_err);
smcore.LogError("[SM] Failed to parse language header file: \"%s\"", lang_header_file);
smcore.LogError("[SM] Parse error (line %d, column %d): %s", states.line, states.col, str_err);
}
void *serverLang;
unsigned int *pServerLang;
if (!sm_trie_retrieve(m_pLCodeLookup, m_InitialLang, &serverLang))
if ((pServerLang = m_LCodeLookup.retrieve(m_InitialLang)) == NULL)
{
g_Logger.LogError("Server language was set to bad language \"%s\" -- reverting to English", m_InitialLang);
smcore.LogError("Server language was set to bad language \"%s\" -- reverting to English", m_InitialLang);
strncopy(m_InitialLang, "en", sizeof(m_InitialLang));
smcore.strncopy(m_InitialLang, "en", sizeof(m_InitialLang));
m_ServerLang = SOURCEMOD_LANGUAGE_ENGLISH;
}
m_ServerLang = reinterpret_cast<unsigned int>(serverLang);
else
{
m_ServerLang = *pServerLang;
}
if (!m_Languages.size())
{
g_Logger.LogError("[SM] Fatal error, no languages found! Translation will not work.");
smcore.LogError("[SM] Fatal error, no languages found! Translation will not work.");
}
for (size_t i=0; i<m_Files.size(); i++)
@@ -919,7 +899,7 @@ SMCResult Translator::ReadSMC_NewSection(const SMCStates *states, const char *na
if (!m_InLanguageSection)
{
g_Logger.LogError("[SM] Warning: Unrecognized section \"%s\" in languages.cfg", name);
smcore.LogError("[SM] Warning: Unrecognized section \"%s\" in languages.cfg", name);
}
return SMCResult_Continue;
@@ -934,14 +914,6 @@ SMCResult Translator::ReadSMC_LeavingSection(const SMCStates *states)
SMCResult Translator::ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value)
{
size_t len = strlen(key);
if (len < 2 || len > 3)
{
g_Logger.LogError("[SM] Warning encountered parsing languages.cfg file.");
g_Logger.LogError("[SM] Invalid language code \"%s\" is being ignored.", key);
}
AddLanguage(key, value);
return SMCResult_Continue;
@@ -949,20 +921,40 @@ SMCResult Translator::ReadSMC_KeyValue(const SMCStates *states, const char *key,
bool Translator::AddLanguage(const char *langcode, const char *description)
{
if (sm_trie_retrieve(m_pLCodeLookup, langcode, NULL))
char lower[256];
size_t len = strlen(description);
if (len > 255) len = 255;
for (size_t i = 0; i < len; i++)
{
return false;
if (description[i] >= 'A' && description[i] <= 'Z')
lower[i] = tolower(description[i]);
else
lower[i] = description[i];
}
lower[len] = '\0';
Language *pLanguage = new Language;
unsigned int idx = m_Languages.size();
if (m_LAliases.retrieve(lower))
return false;
UTIL_Format(pLanguage->m_code2, sizeof(pLanguage->m_code2), "%s", langcode);
pLanguage->m_FullName = m_pStringTab->AddString(description);
unsigned int idx;
if (unsigned int *pIdx = m_LCodeLookup.retrieve(langcode))
{
idx = *pIdx;
}
else
{
Language *pLanguage = new Language;
idx = m_Languages.size();
sm_trie_insert(m_pLCodeLookup, langcode, reinterpret_cast<void *>(idx));
smcore.Format(pLanguage->m_code2, sizeof(pLanguage->m_code2), "%s", langcode);
pLanguage->m_CanonicalName = m_pStringTab->AddString(lower);
m_Languages.push_back(pLanguage);
m_LCodeLookup.insert(langcode, idx);
m_Languages.push_back(pLanguage);
}
m_LAliases.insert(lower, idx);
return true;
}
@@ -984,7 +976,7 @@ unsigned int Translator::GetServerLanguage()
unsigned int Translator::GetClientLanguage(int client)
{
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(client);
return pPlayer->GetLanguageId();
}
@@ -1002,7 +994,7 @@ bool Translator::GetLanguageInfo(unsigned int number, const char **code, const c
}
if (name)
{
*name = m_pStringTab->GetString(l->m_FullName);
*name = m_pStringTab->GetString(l->m_CanonicalName);
}
return true;
@@ -1025,20 +1017,16 @@ IPhraseCollection *Translator::CreatePhraseCollection()
int Translator::SetGlobalTarget(int index)
{
return g_SourceMod.SetGlobalTarget(index);
return g_pSM->SetGlobalTarget(index);
}
int Translator::GetGlobalTarget() const
{
return g_SourceMod.GetGlobalTarget();
return g_pSM->GetGlobalTarget();
}
bool CoreTranslate(char *buffer,
size_t maxlength,
const char *format,
unsigned int numparams,
size_t *pOutLength,
...)
bool CoreTranslate(char *buffer, size_t maxlength, const char *format, unsigned int numparams,
size_t *pOutLength, ...)
{
va_list ap;
unsigned int i;
@@ -1068,11 +1056,11 @@ bool CoreTranslate(char *buffer,
{
if (fail_phrase != NULL)
{
g_Logger.LogError("[SM] Could not find core phrase: %s", fail_phrase);
smcore.LogError("[SM] Could not find core phrase: %s", fail_phrase);
}
else
{
g_Logger.LogError("[SM] Unknown fatal error while translating a core phrase.");
smcore.LogError("[SM] Unknown fatal error while translating a core phrase.");
}
return false;
@@ -1093,7 +1081,7 @@ bool Translator::FormatString(char *buffer,
unsigned int arg;
arg = 0;
if (!gnprintf(buffer, maxlength, format, pPhrases, params, numparams, arg, pOutLength, pFailPhrase))
if (!smcore.gnprintf(buffer, maxlength, format, pPhrases, params, numparams, arg, pOutLength, pFailPhrase))
{
return false;
}
@@ -32,17 +32,14 @@
#ifndef _INCLUDE_SOURCEMOD_TRANSLATOR_H_
#define _INCLUDE_SOURCEMOD_TRANSLATOR_H_
#include "sm_trie.h"
#include "common_logic.h"
#include <sm_trie_tpl.h>
#include <sh_string.h>
#include <sh_vector.h>
#include "sm_globals.h"
#include "sm_memtable.h"
#include "ITextParsers.h"
#include <ITranslator.h>
#define MAX_TRANSLATE_PARAMS 32
#define CORELANG_ENGLISH 0
/* :TODO: write a templatized version of tries? */
using namespace SourceHook;
@@ -58,7 +55,7 @@ enum PhraseParseState
struct Language
{
char m_code2[4];
int m_FullName;
int m_CanonicalName;
};
class CPhraseFile :
@@ -82,7 +79,7 @@ private:
void ParseError(const char *message, ...);
void ParseWarning(const char *message, ...);
private:
Trie *m_pPhraseLookup;
KTrie<int> m_PhraseLookup;
String m_File;
Translator *m_pTranslator;
PhraseParseState m_ParseState;
@@ -122,7 +119,6 @@ public:
unsigned int FindOrAddPhraseFile(const char *phrase_file);
BaseStringTable *GetStringTable();
unsigned int GetLanguageCount();
bool GetLanguageInfo(unsigned int number, const char **code, const char **name);
bool GetLanguageByCode(const char *code, unsigned int *index);
bool GetLanguageByName(const char *name, unsigned int *index);
CPhraseFile *GetFileByIndex(unsigned int index);
@@ -149,13 +145,15 @@ public: //ITranslator
unsigned int numparams,
size_t *pOutLength,
const char **pFailPhrase);
bool GetLanguageInfo(unsigned int number, const char **code, const char **name);
private:
bool AddLanguage(const char *langcode, const char *description);
private:
CVector<Language *> m_Languages;
CVector<CPhraseFile *> m_Files;
BaseStringTable *m_pStringTab;
Trie *m_pLCodeLookup;
KTrie<unsigned int> m_LCodeLookup;
KTrie<unsigned int> m_LAliases;
bool m_InLanguageSection;
String m_CustomError;
unsigned int m_ServerLang;
@@ -175,3 +173,4 @@ extern unsigned int g_pCorePhraseID;
extern Translator g_Translator;
#endif //_INCLUDE_SOURCEMOD_TRANSLATOR_H_
+35 -2
View File
@@ -33,9 +33,14 @@
#include <sm_platform.h>
#include <string.h>
#include "common_logic.h"
#include "ThreadSupport.h"
#include "TextParsers.h"
#include "Profiler.h"
#include "sm_crc32.h"
#include "MemoryUtils.h"
#include "stringutil.h"
#include "ThreadSupport.h"
#include "Translator.h"
#include "GameConfigs.h"
sm_core_t smcore;
IHandleSys *handlesys;
@@ -49,12 +54,35 @@ IShareSys *sharesys;
IRootConsole *rootmenu;
IPluginManager *pluginsys;
IForwardManager *forwardsys;
ITimerSystem *timersys;
ServerGlobals serverGlobals;
IPlayerManager *playerhelpers;
IAdminSystem *adminsys;
IGameHelpers *gamehelpers;
static void AddCorePhraseFile(const char *filename)
{
g_pCorePhrases->AddPhraseFile(filename);
}
static IGameConfig *GetCoreGameConfig()
{
return g_pGameConf;
}
static sm_logic_t logic =
{
NULL,
g_pThreader,
sm_profiler
sm_profiler,
&g_Translator,
stristr,
CoreTranslate,
AddCorePhraseFile,
UTIL_ReplaceAll,
UTIL_ReplaceEx,
UTIL_DecodeHexString,
GetCoreGameConfig
};
static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
@@ -63,6 +91,7 @@ static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
memcpy(&smcore, core, sizeof(sm_core_t));
memcpy(_logic, &logic, sizeof(sm_logic_t));
memcpy(&serverGlobals, core->serverGlobals, sizeof(ServerGlobals));
handlesys = core->handlesys;
libsys = core->libsys;
@@ -73,6 +102,10 @@ static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
rootmenu = core->rootmenu;
pluginsys = core->pluginsys;
forwardsys = core->forwardsys;
timersys = core->timersys;
playerhelpers = core->playerhelpers;
adminsys = core->adminsys;
gamehelpers = core->gamehelpers;
}
PLATFORM_EXTERN_C ITextParsers *get_textparsers()
+5
View File
@@ -47,6 +47,11 @@ extern IShareSys *sharesys;
extern IRootConsole *rootmenu;
extern IPluginManager *pluginsys;
extern IForwardManager *forwardsys;
extern ITimerSystem *timersys;
extern ServerGlobals serverGlobals;
extern IPlayerManager *playerhelpers;
extern IAdminSystem *adminsys;
extern IGameHelpers *gamehelpers;
#endif /* _INCLUDE_SOURCEMOD_COMMON_LOGIC_H_ */
+58 -2
View File
@@ -42,7 +42,7 @@ using namespace SourceMod;
* Add 1 to the RHS of this expression to bump the intercom file
* This is to prevent mismatching core/logic binaries
*/
#define SM_LOGIC_MAGIC (0x0F47C0DE - 2)
#define SM_LOGIC_MAGIC (0x0F47C0DE - 18)
#if defined SM_LOGIC
class IVEngineServer
@@ -52,6 +52,21 @@ class IVEngineServer_Logic
{
public:
virtual bool IsMapValid(const char *map) = 0;
virtual void ServerCommand(const char *cmd) = 0;
};
typedef int FileFindHandle_t;
#if defined SM_LOGIC
class IFileSystem
#else
class IFileSystem_Logic
#endif
{
public:
virtual const char *FindFirstEx(const char *pWildCard, const char *pPathID, FileFindHandle_t *pHandle) = 0;
virtual const char *FindNext(FileFindHandle_t handle) = 0;
virtual void FindClose(FileFindHandle_t handle) = 0;
};
namespace SourceMod
@@ -63,11 +78,26 @@ namespace SourceMod
class IRootConsole;
class IPluginManager;
class IForwardManager;
class ITimerSystem;
class IPlayerManager;
class IAdminSystem;
class IGameHelpers;
class IPhraseCollection;
class ITranslator;
class IGameConfig;
}
class IVEngineServer;
class IFileSystem;
class ConVar;
struct ServerGlobals
{
const double *universalTime;
float *interval_per_tick;
float *frametime;
};
struct sm_core_t
{
/* Objects */
@@ -76,10 +106,15 @@ struct sm_core_t
ISourceMod *sm;
ILibrarySys *libsys;
IVEngineServer *engine;
IFileSystem *filesystem;
IShareSys *sharesys;
IRootConsole *rootmenu;
IPluginManager *pluginsys;
IForwardManager *forwardsys;
ITimerSystem *timersys;
IPlayerManager *playerhelpers;
IAdminSystem *adminsys;
IGameHelpers *gamehelpers;
/* Functions */
void (*AddNatives)(sp_nativeinfo_t* nlist);
ConVar * (*FindConVar)(const char*);
@@ -88,7 +123,20 @@ struct sm_core_t
void (*LogError)(const char*, ...);
const char * (*GetCvarString)(ConVar*);
size_t (*Format)(char*, size_t, const char*, ...);
unsigned int (*ReplaceAll)(char*, size_t, const char *, const char *, bool);
void (*GenerateError)(IPluginContext *, cell_t, int, const char *, ...);
bool (*gnprintf)(char *, size_t, const char *, IPhraseCollection *, void **,
unsigned int, unsigned int &, size_t *, const char **);
size_t (*atcprintf)(char *, size_t, const char *, IPluginContext *, const cell_t *, int *);
bool (*GetGameName)(char *buffer, size_t maxlength);
const char * (*GetGameDescription)();
const char * (*GetSourceEngineName)();
bool (*SymbolsAreHidden)();
const char * (*GetCoreConfigValue)(const char*);
/* Data */
ServerGlobals *serverGlobals;
void * serverFactory;
void * engineFactory;
void * matchmakingDSFactory;
};
struct sm_logic_t
@@ -96,6 +144,14 @@ struct sm_logic_t
SMGlobalClass *head;
IThreader *threader;
IProfiler *profiler;
ITranslator *translator;
const char *(*stristr)(const char *, const char *);
bool (*CoreTranslate)(char *, size_t, const char *, unsigned int, size_t *, ...);
void (*AddCorePhraseFile)(const char *filename);
unsigned int (*ReplaceAll)(char*, size_t, const char *, const char *, bool);
char *(*ReplaceEx)(char *, size_t, const char *, size_t, const char *, size_t, bool);
size_t (*DecodeHexString)(unsigned char *, size_t, const char *);
IGameConfig * (*GetCoreGameConfig)();
};
typedef void (*LogicInitFunction)(const sm_core_t *core, sm_logic_t *logic);
+19
View File
@@ -0,0 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "logic", "logic.vcxproj", "{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Debug|Win32.ActiveCfg = Debug|Win32
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Debug|Win32.Build.0 = Debug|Win32
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Release|Win32.ActiveCfg = Release|Win32
{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+175
View File
@@ -0,0 +1,175 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{6EF06E6E-0ED5-4E2D-A8F3-01DD1EC25BA7}</ProjectGuid>
<RootNamespace>jitx86</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">sourcemod.logic</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">sourcemod.logic</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..;$(MMSOURCE19)\core\sourcehook;..\..\..\public;..\..\..\public\sourcepawn;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;JITX86_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SM_DEFAULT_THREADER;SM_LOGIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetFileName)</OutputFile>
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\public</AdditionalIncludeDirectories>
</ResourceCompile>
<PostBuildEvent>
<Command>IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<AdditionalIncludeDirectories>..;$(MMSOURCE19)\core\sourcehook;..\..\..\public;..\..\..\public\sourcepawn;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;JITX86_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SM_LOGIC;SM_DEFAULT_THREADER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetFileName)</OutputFile>
<IgnoreSpecificDefaultLibraries>LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\public</AdditionalIncludeDirectories>
</ResourceCompile>
<PostBuildEvent>
<Command>IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\common_logic.cpp" />
<ClCompile Include="..\GameConfigs.cpp" />
<ClCompile Include="..\MemoryUtils.cpp" />
<ClCompile Include="..\PhraseCollection.cpp" />
<ClCompile Include="..\Profiler.cpp" />
<ClCompile Include="..\sm_crc32.cpp" />
<ClCompile Include="..\smn_admin.cpp" />
<ClCompile Include="..\smn_adt_array.cpp" />
<ClCompile Include="..\smn_adt_stack.cpp" />
<ClCompile Include="..\smn_adt_trie.cpp" />
<ClCompile Include="..\smn_banning.cpp" />
<ClCompile Include="..\smn_datapacks.cpp" />
<ClCompile Include="..\smn_float.cpp" />
<ClCompile Include="..\smn_functions.cpp" />
<ClCompile Include="..\smn_gameconfigs.cpp" />
<ClCompile Include="..\smn_handles.cpp" />
<ClCompile Include="..\smn_lang.cpp" />
<ClCompile Include="..\smn_maplists.cpp" />
<ClCompile Include="..\smn_players.cpp" />
<ClCompile Include="..\smn_sorting.cpp" />
<ClCompile Include="..\smn_string.cpp" />
<ClCompile Include="..\smn_textparse.cpp" />
<ClCompile Include="..\smn_timers.cpp" />
<ClCompile Include="..\stringutil.cpp" />
<ClCompile Include="..\TextParsers.cpp" />
<ClCompile Include="..\ThreadSupport.cpp" />
<ClCompile Include="..\Translator.cpp" />
<ClCompile Include="..\thread\BaseWorker.cpp" />
<ClCompile Include="..\thread\ThreadWorker.cpp" />
<ClCompile Include="..\thread\WinThreads.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\public\sm_platform.h" />
<ClInclude Include="..\..\..\public\sm_trie_tpl.h" />
<ClInclude Include="..\..\..\public\sourcemod_version.h" />
<ClInclude Include="..\AutoHandleRooter.h" />
<ClInclude Include="..\CellArray.h" />
<ClInclude Include="..\common_logic.h" />
<ClInclude Include="..\GameConfigs.h" />
<ClInclude Include="..\intercom.h" />
<ClInclude Include="..\MemoryUtils.h" />
<ClInclude Include="..\MersenneTwister.h" />
<ClInclude Include="..\PhraseCollection.h" />
<ClInclude Include="..\Profiler.h" />
<ClInclude Include="..\sm_crc32.h" />
<ClInclude Include="..\sm_memtable.h" />
<ClInclude Include="..\sm_symtable.h" />
<ClInclude Include="..\stringutil.h" />
<ClInclude Include="..\TextParsers.h" />
<ClInclude Include="..\ThreadSupport.h" />
<ClInclude Include="..\thread\BaseWorker.h" />
<ClInclude Include="..\thread\ThreadWorker.h" />
<ClInclude Include="..\thread\WinThreads.h" />
<ClInclude Include="..\Translator.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+194
View File
@@ -0,0 +1,194 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
<Filter Include="Threads">
<UniqueIdentifier>{67c1ebce-c1f8-4d2c-9ef4-33f0ef6343e9}</UniqueIdentifier>
</Filter>
<Filter Include="Threads\Header Files">
<UniqueIdentifier>{c6e2ebb3-4869-4453-9b83-e49f70cb8a05}</UniqueIdentifier>
</Filter>
<Filter Include="Threads\Source Files">
<UniqueIdentifier>{e6d8a9af-1c1b-4f0c-ae06-a9ebd5cd32e4}</UniqueIdentifier>
</Filter>
<Filter Include="Natives">
<UniqueIdentifier>{126462f2-e517-4854-8a94-759e56787536}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\common_logic.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\GameConfigs.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\MemoryUtils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\PhraseCollection.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Profiler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\sm_crc32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\stringutil.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\TextParsers.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ThreadSupport.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Translator.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\thread\BaseWorker.cpp">
<Filter>Threads\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\thread\ThreadWorker.cpp">
<Filter>Threads\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\thread\WinThreads.cpp">
<Filter>Threads\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\smn_admin.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_timers.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_adt_array.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_adt_stack.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_adt_trie.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_banning.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_datapacks.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_float.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_functions.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_gameconfigs.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_handles.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_lang.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_maplists.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_players.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_sorting.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_string.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_textparse.cpp">
<Filter>Natives</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\CellArray.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\common_logic.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\intercom.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Profiler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\TextParsers.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ThreadSupport.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\thread\BaseWorker.h">
<Filter>Threads\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\thread\ThreadWorker.h">
<Filter>Threads\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\thread\WinThreads.h">
<Filter>Threads\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\AutoHandleRooter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\GameConfigs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\MemoryUtils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\MersenneTwister.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\PhraseCollection.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sm_crc32.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sm_memtable.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sm_symtable.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\stringutil.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Translator.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\public\sm_trie_tpl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\public\sourcemod_version.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\public\sm_platform.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
+69 -13
View File
@@ -42,7 +42,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;&quot;$(MMSOURCE17)\core\sourcehook&quot;;..\..\..\public;..\..\..\public\sourcepawn"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;JITX86_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SM_DEFAULT_THREADER"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;JITX86_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SM_DEFAULT_THREADER;SM_LOGIC"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -64,7 +64,7 @@
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\sourcepawn.jit.x86.dll"
OutputFile="$(OutDir)\sourcemod.logic.dll"
LinkIncremental="2"
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
GenerateDebugInformation="true"
@@ -185,11 +185,19 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\smn_functions.cpp"
RelativePath="..\common_logic.cpp"
>
</File>
<File
RelativePath="..\smn_adt_trie.cpp"
RelativePath="..\GameConfigs.cpp"
>
</File>
<File
RelativePath="..\MemoryUtils.cpp"
>
</File>
<File
RelativePath="..\PhraseCollection.cpp"
>
</File>
<File
@@ -197,7 +205,11 @@
>
</File>
<File
RelativePath="..\common_logic.cpp"
RelativePath="..\sm_crc32.cpp"
>
</File>
<File
RelativePath="..\smn_admin.cpp"
>
</File>
<File
@@ -208,22 +220,66 @@
RelativePath="..\smn_adt_stack.cpp"
>
</File>
<File
RelativePath="..\smn_adt_trie.cpp"
>
</File>
<File
RelativePath="..\smn_banning.cpp"
>
</File>
<File
RelativePath="..\smn_datapacks.cpp"
>
</File>
<File
RelativePath="..\smn_float.cpp"
>
</File>
<File
RelativePath="..\smn_functions.cpp"
>
</File>
<File
RelativePath="..\smn_gameconfigs.cpp"
>
</File>
<File
RelativePath="..\smn_handles.cpp"
>
</File>
<File
RelativePath="..\smn_lang.cpp"
>
</File>
<File
RelativePath="..\smn_maplists.cpp"
>
</File>
<File
RelativePath="..\smn_players.cpp"
>
</File>
<File
RelativePath="..\smn_sorting.cpp"
>
</File>
<File
RelativePath="..\smn_string.cpp"
>
</File>
<File
RelativePath="..\smn_textparse.cpp"
>
</File>
<File
RelativePath="..\smn_timers.cpp"
>
</File>
<File
RelativePath="..\stringutil.cpp"
>
</File>
<File
RelativePath="..\TextParsers.cpp"
>
@@ -232,6 +288,10 @@
RelativePath="..\ThreadSupport.cpp"
>
</File>
<File
RelativePath="..\Translator.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
@@ -250,6 +310,10 @@
RelativePath="..\intercom.h"
>
</File>
<File
RelativePath="..\Profiler.h"
>
</File>
<File
RelativePath="..\svn_version.h"
>
@@ -262,10 +326,6 @@
RelativePath="..\ThreadSupport.h"
>
</File>
<File
RelativePath="..\Profiler.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
@@ -276,10 +336,6 @@
RelativePath="..\svn_version.tpl"
>
</File>
<File
RelativePath="..\version.rc"
>
</File>
</Filter>
<Filter
Name="Threads"
@@ -1,8 +1,8 @@
/**
* vim: set ts=4 :
* vim: set ts=4 sw=4 tw=99 noet:
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -25,8 +25,6 @@
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#include "sm_crc32.h"
+1 -3
View File
@@ -1,5 +1,5 @@
/**
* vim: set ts=4 :
* vim: set ts=4 sw=4 tw=99 noet:
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
@@ -25,8 +25,6 @@
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#ifndef _INCLUDE_SOURCEMOD_CRC32_H_
+163
View File
@@ -0,0 +1,163 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#ifndef _INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
#define _INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
#include <stdlib.h>
#include <string.h>
class BaseMemTable
{
public:
BaseMemTable(unsigned int init_size)
{
membase = (unsigned char *)malloc(init_size);
size = init_size;
tail = 0;
}
~BaseMemTable()
{
free(membase);
membase = NULL;
}
public:
/**
* Allocates 'size' bytes of memory.
* Optionally outputs the address through 'addr'.
* Returns an index >= 0 on success, < 0 on failure.
*/
int CreateMem(unsigned int addsize, void **addr)
{
int idx = (int)tail;
while (tail + addsize >= size) {
size *= 2;
membase = (unsigned char *)realloc(membase, size);
}
tail += addsize;
if (addr)
*addr = (void *)&membase[idx];
return idx;
}
/**
* Given an index into the memory table, returns its address.
* Returns NULL if invalid.
*/
void *GetAddress(int index)
{
if (index < 0 || (unsigned int)index >= tail)
return NULL;
return &membase[index];
}
/**
* Scraps the memory table. For caching purposes, the memory
* is not freed, however subsequent calls to CreateMem() will
* begin at the first index again.
*/
void Reset()
{
tail = 0;
}
inline unsigned int GetMemUsage()
{
return size;
}
inline unsigned int GetActualMemUsed()
{
return tail;
}
private:
unsigned char *membase;
unsigned int size;
unsigned int tail;
};
class BaseStringTable
{
public:
BaseStringTable(unsigned int init_size) : m_table(init_size)
{
}
public:
/**
* Adds a string to the string table and returns its index.
*/
int AddString(const char *string)
{
size_t len = strlen(string) + 1;
int idx;
char *addr;
idx = m_table.CreateMem(len, (void **)&addr);
strcpy(addr, string);
return idx;
}
/**
* Given an index into the string table, returns the associated string.
*/
inline const char *GetString(int str)
{
return (const char *)m_table.GetAddress(str);
}
/**
* Scraps the string table. For caching purposes, the memory
* is not freed, however subsequent calls to AddString() will
* begin at the first index again.
*/
void Reset()
{
m_table.Reset();
}
/**
* Returns the parent BaseMemTable that this string table uses.
*/
inline BaseMemTable *GetMemTable()
{
return &m_table;
}
private:
BaseMemTable m_table;
};
#endif //_INCLUDE_SOURCEMOD_CORE_STRINGTABLE_H_
+67 -48
View File
@@ -29,13 +29,15 @@
* Version: $Id$
*/
#include "sm_globals.h"
#include "AdminCache.h"
#include "ForwardSys.h"
#include "common_logic.h"
#include <IAdminSystem.h>
#include <IForwardSys.h>
using namespace SourceMod;
static cell_t DumpAdminCache(IPluginContext *pContext, const cell_t *params)
{
g_Admins.DumpAdminCache((AdminCachePart)params[1], (params[2] == 1) ? true : false);
adminsys->DumpAdminCache((AdminCachePart)params[1], (params[2] == 1) ? true : false);
return 1;
}
@@ -44,7 +46,7 @@ static cell_t AddCommandOverride(IPluginContext *pContext, const cell_t *params)
char *str;
pContext->LocalToString(params[1], &str);
g_Admins.AddCommandOverride(str, (OverrideType)params[2], (AdminFlag)params[3]);
adminsys->AddCommandOverride(str, (OverrideType)params[2], (AdminFlag)params[3]);
return 1;
}
@@ -56,7 +58,7 @@ static cell_t GetCommandOverride(IPluginContext *pContext, const cell_t *params)
pContext->LocalToString(params[1], &cmd);
if (!g_Admins.GetCommandOverride(cmd, (OverrideType)params[2], &flags))
if (!adminsys->GetCommandOverride(cmd, (OverrideType)params[2], &flags))
{
return 0;
}
@@ -75,7 +77,7 @@ static cell_t UnsetCommandOverride(IPluginContext *pContext, const cell_t *param
pContext->LocalToString(params[1], &cmd);
g_Admins.UnsetCommandOverride(cmd, (OverrideType)params[2]);
adminsys->UnsetCommandOverride(cmd, (OverrideType)params[2]);
return 1;
}
@@ -86,7 +88,7 @@ static cell_t CreateAdmGroup(IPluginContext *pContext, const cell_t *params)
pContext->LocalToString(params[1], &str);
return g_Admins.AddGroup(str);
return adminsys->AddGroup(str);
}
static cell_t FindAdmGroup(IPluginContext *pContext, const cell_t *params)
@@ -95,7 +97,7 @@ static cell_t FindAdmGroup(IPluginContext *pContext, const cell_t *params)
pContext->LocalToString(params[1], &str);
return g_Admins.FindGroupByName(str);
return adminsys->FindGroupByName(str);
}
static cell_t SetAdmGroupAddFlag(IPluginContext *pContext, const cell_t *params)
@@ -104,7 +106,7 @@ static cell_t SetAdmGroupAddFlag(IPluginContext *pContext, const cell_t *params)
AdminFlag flag = (AdminFlag)params[2];
bool enabled = params[3] ? 1 : 0;
g_Admins.SetGroupAddFlag(id, flag, enabled);
adminsys->SetGroupAddFlag(id, flag, enabled);
return 1;
}
@@ -114,7 +116,7 @@ static cell_t GetAdmGroupAddFlag(IPluginContext *pContext, const cell_t *params)
GroupId id = (GroupId)params[1];
AdminFlag flag = (AdminFlag)params[2];
return g_Admins.GetGroupAddFlag(id, flag) ? 1 : 0;
return adminsys->GetGroupAddFlag(id, flag) ? 1 : 0;
}
static cell_t SetAdmGroupImmunity(IPluginContext *pContext, const cell_t *params)
@@ -123,7 +125,7 @@ static cell_t SetAdmGroupImmunity(IPluginContext *pContext, const cell_t *params
ImmunityType type = (ImmunityType)params[2];
bool enabled = params[3] ? 1 : 0;
g_Admins.SetGroupGenericImmunity(id, type, enabled);
adminsys->SetGroupGenericImmunity(id, type, enabled);
return 1;
}
@@ -133,7 +135,7 @@ static cell_t GetAdmGroupImmunity(IPluginContext *pContext, const cell_t *params
GroupId id = (GroupId)params[1];
ImmunityType type = (ImmunityType)params[2];
return g_Admins.GetGroupGenericImmunity(id, type) ? 1 : 0;
return adminsys->GetGroupGenericImmunity(id, type) ? 1 : 0;
}
static cell_t SetAdmGroupImmuneFrom(IPluginContext *pContext, const cell_t *params)
@@ -141,7 +143,7 @@ static cell_t SetAdmGroupImmuneFrom(IPluginContext *pContext, const cell_t *para
GroupId id = (GroupId)params[1];
GroupId other_id = (GroupId)params[2];
g_Admins.AddGroupImmunity(id, other_id);
adminsys->AddGroupImmunity(id, other_id);
return 1;
}
@@ -150,14 +152,14 @@ static cell_t GetAdmGroupImmuneCount(IPluginContext *pContext, const cell_t *par
{
GroupId id = (GroupId)params[1];
return g_Admins.GetGroupImmunityCount(id);
return adminsys->GetGroupImmunityCount(id);
}
static cell_t GetAdmGroupImmuneFrom(IPluginContext *pContext, const cell_t *params)
{
GroupId id = (GroupId)params[1];
return g_Admins.GetGroupImmunity(id, params[2]);
return adminsys->GetGroupImmunity(id, params[2]);
}
static cell_t AddAdmGroupCmdOverride(IPluginContext *pContext, const cell_t *params)
@@ -169,7 +171,7 @@ static cell_t AddAdmGroupCmdOverride(IPluginContext *pContext, const cell_t *par
pContext->LocalToString(params[2], &cmd);
g_Admins.AddGroupCommandOverride(id, cmd, type, rule);
adminsys->AddGroupCommandOverride(id, cmd, type, rule);
return 1;
}
@@ -183,7 +185,7 @@ static cell_t GetAdmGroupCmdOverride(IPluginContext *pContext, const cell_t *par
pContext->LocalToString(params[2], &cmd);
if (!g_Admins.GetGroupCommandOverride(id, cmd, type, &rule))
if (!adminsys->GetGroupCommandOverride(id, cmd, type, &rule))
{
return 0;
}
@@ -198,7 +200,7 @@ static cell_t GetAdmGroupCmdOverride(IPluginContext *pContext, const cell_t *par
static cell_t GetAdmGroupAddFlags(IPluginContext *pContext, const cell_t *params)
{
GroupId id = (GroupId)params[1];
return g_Admins.GetGroupAddFlags(id);
return adminsys->GetGroupAddFlags(id);
}
static cell_t RegisterAuthIdentType(IPluginContext *pContext, const cell_t *params)
@@ -206,7 +208,7 @@ static cell_t RegisterAuthIdentType(IPluginContext *pContext, const cell_t *para
char *type;
pContext->LocalToString(params[1], &type);
g_Admins.RegisterAuthIdentType(type);
adminsys->RegisterAuthIdentType(type);
return 1;
}
@@ -221,14 +223,14 @@ static cell_t CreateAdmin(IPluginContext *pContext, const cell_t *params)
admin = NULL;
}
return g_Admins.CreateAdmin(admin);
return adminsys->CreateAdmin(admin);
}
static cell_t GetAdminUsername(IPluginContext *pContext, const cell_t *params)
{
AdminId id = params[1];
size_t written;
const char *name = g_Admins.GetAdminName(id);
const char *name = adminsys->GetAdminName(id);
if (!name)
{
@@ -248,7 +250,7 @@ static cell_t BindAdminIdentity(IPluginContext *pContext, const cell_t *params)
pContext->LocalToString(params[2], &auth);
pContext->LocalToString(params[3], &ident);
return g_Admins.BindAdminIdentity(id, auth, ident);
return adminsys->BindAdminIdentity(id, auth, ident);
}
static cell_t SetAdminFlag(IPluginContext *pContext, const cell_t *params)
@@ -257,7 +259,7 @@ static cell_t SetAdminFlag(IPluginContext *pContext, const cell_t *params)
AdminFlag flag = (AdminFlag)params[2];
bool enabled = params[3] ? true : false;
g_Admins.SetAdminFlag(id, flag, enabled);
adminsys->SetAdminFlag(id, flag, enabled);
return 1;
}
@@ -268,7 +270,7 @@ static cell_t GetAdminFlag(IPluginContext *pContext, const cell_t *params)
AdminFlag flag = (AdminFlag)params[2];
AccessMode mode = (AccessMode)params[3];
return g_Admins.GetAdminFlag(id, flag, mode);
return adminsys->GetAdminFlag(id, flag, mode);
}
static cell_t GetAdminFlags(IPluginContext *pContext, const cell_t *params)
@@ -276,7 +278,7 @@ static cell_t GetAdminFlags(IPluginContext *pContext, const cell_t *params)
AdminId id = params[1];
AccessMode mode = (AccessMode)params[2];
return g_Admins.GetAdminFlags(id, mode);
return adminsys->GetAdminFlags(id, mode);
}
static cell_t AdminInheritGroup(IPluginContext *pContext, const cell_t *params)
@@ -284,14 +286,14 @@ static cell_t AdminInheritGroup(IPluginContext *pContext, const cell_t *params)
AdminId id = params[1];
GroupId gid = params[2];
return g_Admins.AdminInheritGroup(id, gid);
return adminsys->AdminInheritGroup(id, gid);
}
static cell_t GetAdminGroupCount(IPluginContext *pContext, const cell_t *params)
{
AdminId id = params[1];
return g_Admins.GetAdminGroupCount(id);
return adminsys->GetAdminGroupCount(id);
}
static cell_t GetAdminGroup(IPluginContext *pContext, const cell_t *params)
@@ -301,7 +303,7 @@ static cell_t GetAdminGroup(IPluginContext *pContext, const cell_t *params)
const char *name;
GroupId gid;
if ((gid=g_Admins.GetAdminGroup(id, index, &name)) == INVALID_GROUP_ID)
if ((gid=adminsys->GetAdminGroup(id, index, &name)) == INVALID_GROUP_ID)
{
return gid;
}
@@ -323,7 +325,7 @@ static cell_t SetAdminPassword(IPluginContext *pContext, const cell_t *params)
pContext->LocalToString(params[2], &password);
g_Admins.SetAdminPassword(id, password);
adminsys->SetAdminPassword(id, password);
return 1;
}
@@ -331,7 +333,7 @@ static cell_t SetAdminPassword(IPluginContext *pContext, const cell_t *params)
static cell_t GetAdminPassword(IPluginContext *pContext, const cell_t *params)
{
AdminId id = params[1];
const char *password = g_Admins.GetAdminPassword(id);
const char *password = adminsys->GetAdminPassword(id);
if (!password)
{
@@ -350,14 +352,14 @@ static cell_t FindAdminByIdentity(IPluginContext *pContext, const cell_t *params
pContext->LocalToString(params[1], &auth);
pContext->LocalToString(params[2], &ident);
return g_Admins.FindAdminByIdentity(auth, ident);
return adminsys->FindAdminByIdentity(auth, ident);
}
static cell_t RemoveAdmin(IPluginContext *pContext, const cell_t *params)
{
AdminId id = params[1];
return g_Admins.InvalidateAdmin(id);
return adminsys->InvalidateAdmin(id);
}
static cell_t FlagBitsToBitArray(IPluginContext *pContext, const cell_t *params)
@@ -365,7 +367,7 @@ static cell_t FlagBitsToBitArray(IPluginContext *pContext, const cell_t *params)
FlagBits bits = (FlagBits)params[1];
bool array[AdminFlags_TOTAL];
cell_t *addr;
unsigned int numWr = g_Admins.FlagBitsToBitArray(bits, array, AdminFlags_TOTAL);
unsigned int numWr = adminsys->FlagBitsToBitArray(bits, array, AdminFlags_TOTAL);
pContext->LocalToPhysAddr(params[2], &addr);
@@ -391,7 +393,7 @@ static cell_t FlagBitArrayToBits(IPluginContext *pContext, const cell_t *params)
array[i] = addr[i] ? true : false;
}
return g_Admins.FlagBitArrayToBits(array, num);
return adminsys->FlagBitArrayToBits(array, num);
}
static cell_t FlagArrayToBits(IPluginContext *pContext, const cell_t *params)
@@ -401,7 +403,7 @@ static cell_t FlagArrayToBits(IPluginContext *pContext, const cell_t *params)
if (sizeof(AdminFlag) == sizeof(cell_t))
{
return g_Admins.FlagArrayToBits((const AdminFlag *)addr, params[2]);
return adminsys->FlagArrayToBits((const AdminFlag *)addr, params[2]);
} else {
AdminFlag flags[AdminFlags_TOTAL];
unsigned int num = ((unsigned)params[2] > AdminFlags_TOTAL ? AdminFlags_TOTAL : params[2]);
@@ -410,7 +412,7 @@ static cell_t FlagArrayToBits(IPluginContext *pContext, const cell_t *params)
{
flags[i] = (AdminFlag)addr[i];
}
return g_Admins.FlagArrayToBits(flags, num);
return adminsys->FlagArrayToBits(flags, num);
}
}
@@ -421,11 +423,11 @@ static cell_t FlagBitsToArray(IPluginContext *pContext, const cell_t *params)
if (sizeof(AdminFlag) == sizeof(cell_t))
{
return g_Admins.FlagBitsToArray(params[1], (AdminFlag *)addr, params[3]);
return adminsys->FlagBitsToArray(params[1], (AdminFlag *)addr, params[3]);
} else {
AdminFlag flags[AdminFlags_TOTAL];
unsigned int num = ((unsigned)params[2] > AdminFlags_TOTAL ? AdminFlags_TOTAL : params[2]);
num = g_Admins.FlagBitsToArray(params[1], flags, num);
num = adminsys->FlagBitsToArray(params[1], flags, num);
for (unsigned int i=0; i<num; i++)
{
@@ -438,36 +440,36 @@ static cell_t FlagBitsToArray(IPluginContext *pContext, const cell_t *params)
static cell_t CanAdminTarget(IPluginContext *pContext, const cell_t *params)
{
return g_Admins.CanAdminTarget(params[1], params[2]) ? 1 : 0;
return adminsys->CanAdminTarget(params[1], params[2]) ? 1 : 0;
}
static cell_t CreateAuthMethod(IPluginContext *pContext, const cell_t *params)
{
char *name;
pContext->LocalToString(params[1], &name);
g_Admins.RegisterAuthIdentType(name);
adminsys->RegisterAuthIdentType(name);
return 1;
}
static cell_t SetAdmGroupImmunityLevel(IPluginContext *pContext, const cell_t *params)
{
return g_Admins.SetGroupImmunityLevel(params[1], params[2]);
return adminsys->SetGroupImmunityLevel(params[1], params[2]);
}
static cell_t GetAdmGroupImmunityLevel(IPluginContext *pContext, const cell_t *params)
{
return g_Admins.GetGroupImmunityLevel(params[1]);
return adminsys->GetGroupImmunityLevel(params[1]);
}
static cell_t SetAdminImmunityLevel(IPluginContext *pContext, const cell_t *params)
{
return g_Admins.SetAdminImmunityLevel(params[1], params[2]);
return adminsys->SetAdminImmunityLevel(params[1], params[2]);
}
static cell_t GetAdminImmunityLevel(IPluginContext *pContext, const cell_t *params)
{
return g_Admins.GetAdminImmunityLevel(params[1]);
return adminsys->GetAdminImmunityLevel(params[1]);
}
static cell_t FindFlagByName(IPluginContext *pContext, const cell_t *params)
@@ -479,7 +481,7 @@ static cell_t FindFlagByName(IPluginContext *pContext, const cell_t *params)
pContext->LocalToPhysAddr(params[2], &addr);
AdminFlag admflag;
if (!g_Admins.FindFlag(flag, &admflag))
if (!adminsys->FindFlag(flag, &admflag))
{
return 0;
}
@@ -495,7 +497,7 @@ static cell_t FindFlagByChar(IPluginContext *pContext, const cell_t *params)
pContext->LocalToPhysAddr(params[2], &addr);
AdminFlag admflag;
if (!g_Admins.FindFlag((char)params[1], &admflag))
if (!adminsys->FindFlag((char)params[1], &admflag))
{
return 0;
}
@@ -505,6 +507,22 @@ static cell_t FindFlagByChar(IPluginContext *pContext, const cell_t *params)
return 1;
}
static cell_t FindFlagChar(IPluginContext *pContext, const cell_t *params)
{
cell_t *addr;
pContext->LocalToPhysAddr(params[2], &addr);
char flagchar;
if (!adminsys->FindFlagChar((AdminFlag)params[1], &flagchar))
{
return 0;
}
*addr = (cell_t)flagchar;
return 1;
}
static cell_t ReadFlagString(IPluginContext *pContext, const cell_t *params)
{
char *flag;
@@ -514,7 +532,7 @@ static cell_t ReadFlagString(IPluginContext *pContext, const cell_t *params)
pContext->LocalToPhysAddr(params[2], &addr);
const char *end = flag;
FlagBits bits = g_Admins.ReadFlagString(flag, &end);
FlagBits bits = adminsys->ReadFlagString(flag, &end);
*addr = end - flag;
@@ -561,6 +579,7 @@ REGISTER_NATIVES(adminNatives)
{"CreateAuthMethod", CreateAuthMethod},
{"FindFlagByName", FindFlagByName},
{"FindFlagByChar", FindFlagByChar},
{"FindFlagChar", FindFlagChar},
{"ReadFlagString", ReadFlagString},
{"GetAdmGroupImmunityLevel",GetAdmGroupImmunityLevel},
{"SetAdmGroupImmunityLevel",SetAdmGroupImmunityLevel},
@@ -29,11 +29,12 @@
* Version: $Id$
*/
#include "sm_globals.h"
#include "sm_stringutil.h"
#include "HalfLife2.h"
#include "PlayerManager.h"
#include "ForwardSys.h"
#include "common_logic.h"
#include <string.h>
#include <IGameHelpers.h>
#include <IPlayerHelpers.h>
#include <IForwardSys.h>
#include "stringutil.h"
#define BANFLAG_AUTO (1<<0) /**< Auto-detects whether to ban by steamid or IP */
#define BANFLAG_IP (1<<1) /**< Always ban by IP address */
@@ -50,7 +51,7 @@ class BanNativeHelpers : public SMGlobalClass
public:
void OnSourceModAllInitialized()
{
g_pOnBanClient = g_Forwards.CreateForward(
g_pOnBanClient = forwardsys->CreateForward(
"OnBanClient",
ET_Event,
7,
@@ -62,7 +63,7 @@ public:
Param_String,
Param_String,
Param_Cell);
g_pOnBanIdentity = g_Forwards.CreateForward(
g_pOnBanIdentity = forwardsys->CreateForward(
"OnBanIdentity",
ET_Event,
6,
@@ -73,7 +74,7 @@ public:
Param_String,
Param_String,
Param_Cell);
g_pOnRemoveBan = g_Forwards.CreateForward(
g_pOnRemoveBan = forwardsys->CreateForward(
"OnRemoveBan",
ET_Event,
4,
@@ -85,9 +86,9 @@ public:
}
void OnSourceModShutdown()
{
g_Forwards.ReleaseForward(g_pOnBanClient);
g_Forwards.ReleaseForward(g_pOnBanIdentity);
g_Forwards.ReleaseForward(g_pOnRemoveBan);
forwardsys->ReleaseForward(g_pOnBanClient);
forwardsys->ReleaseForward(g_pOnBanIdentity);
forwardsys->ReleaseForward(g_pOnRemoveBan);
g_pOnBanClient = NULL;
g_pOnBanIdentity = NULL;
@@ -118,7 +119,7 @@ static cell_t BanIdentity(IPluginContext *pContext, const cell_t *params)
/* Sanitize the input */
char identity[64];
strncopy(identity, r_identity, sizeof(identity));
UTIL_ReplaceAll(identity, sizeof(identity), ";", "");
UTIL_ReplaceAll(identity, sizeof(identity), ";", "", true);
cell_t handled = 0;
if (ban_cmd[0] != '\0' && g_pOnBanIdentity->GetFunctionCount() > 0)
@@ -139,7 +140,7 @@ static cell_t BanIdentity(IPluginContext *pContext, const cell_t *params)
char command[256];
if (ban_by_ip)
{
UTIL_Format(
smcore.Format(
command,
sizeof(command),
"addip %d %s\n",
@@ -152,9 +153,9 @@ static cell_t BanIdentity(IPluginContext *pContext, const cell_t *params)
engine->ServerCommand("writeip\n");
}
}
else if (!g_HL2.IsLANServer())
else if (!gamehelpers->IsLANServer())
{
UTIL_Format(
smcore.Format(
command,
sizeof(command),
"banid %d %s\n",
@@ -195,7 +196,7 @@ static cell_t RemoveBan(IPluginContext *pContext, const cell_t *params)
char identity[64];
strncopy(identity, r_identity, sizeof(identity));
UTIL_ReplaceAll(identity, sizeof(identity), ";", "");
UTIL_ReplaceAll(identity, sizeof(identity), ";", "", true);
cell_t handled = 0;
if (ban_cmd[0] != '\0' && g_pOnRemoveBan->GetFunctionCount() > 0)
@@ -212,7 +213,7 @@ static cell_t RemoveBan(IPluginContext *pContext, const cell_t *params)
{
if (!handled)
{
UTIL_Format(
smcore.Format(
command,
sizeof(command),
"removeip %s\n",
@@ -221,11 +222,11 @@ static cell_t RemoveBan(IPluginContext *pContext, const cell_t *params)
engine->ServerCommand("writeip\n");
}
}
else if (!g_HL2.IsLANServer())
else if (!gamehelpers->IsLANServer())
{
if (!handled)
{
UTIL_Format(
smcore.Format(
command,
sizeof(command),
"removeid %s\n",
@@ -248,9 +249,9 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
char *ban_reason, *ban_cmd;
int client, ban_flags, ban_source, ban_time;
client = g_HL2.ReferenceToIndex(params[1]);
client = gamehelpers->ReferenceToIndex(params[1]);
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(client);
if (!pPlayer || !pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
@@ -268,11 +269,16 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
ban_flags = params[3];
ban_source = params[7];
#if SOURCE_ENGINE != SE_DARKMESSIAH
/* Check how we should ban the player */
if ((ban_flags & BANFLAG_AUTO) == BANFLAG_AUTO)
if (!strcmp(smcore.GetSourceEngineName(), "darkmessiah"))
{
if (g_HL2.IsLANServer() || !pPlayer->IsAuthorized())
/* Dark Messiah doesn't have Steam IDs so there is only one ban method to choose */
ban_flags |= BANFLAG_IP;
ban_flags &= ~BANFLAG_AUTHID;
}
else if ((ban_flags & BANFLAG_AUTO) == BANFLAG_AUTO)
{
if (gamehelpers->IsLANServer() || !pPlayer->IsAuthorized())
{
ban_flags |= BANFLAG_IP;
ban_flags &= ~BANFLAG_AUTHID;
@@ -304,11 +310,6 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
{
return pContext->ThrowNativeError("No valid ban method flags specified");
}
#else
/* Dark Messiah doesn't have Steam IDs so there is only one ban method to choose */
ban_flags |= BANFLAG_IP;
ban_flags &= ~BANFLAG_AUTHID;
#endif
cell_t handled = 0;
if (ban_cmd[0] != '\0' && g_pOnBanClient->GetFunctionCount() > 0)
@@ -335,7 +336,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
{
/* Get the IP address and strip the port */
char ip[24], *ptr;
strncopy(ip, pPlayer->GetIPAddress(), sizeof(ip));
smcore.strncopy(ip, pPlayer->GetIPAddress(), sizeof(ip));
if ((ptr = strchr(ip, ':')) != NULL)
{
*ptr = '\0';
@@ -343,7 +344,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
/* Tell the server to ban the ip */
char command[256];
UTIL_Format(
smcore.Format(
command,
sizeof(command),
"addip %d %s\n",
@@ -367,7 +368,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
{
/* Tell the server to ban the auth string */
char command[256];
UTIL_Format(
smcore.Format(
command,
sizeof(command),
"banid %d %s\n",
@@ -377,7 +378,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
/* Kick, then ban */
if ((ban_flags & BANFLAG_NOKICK) != BANFLAG_NOKICK)
{
g_HL2.AddDelayedKick(client, pPlayer->GetUserId(), kick_message);
gamehelpers->AddDelayedKick(client, pPlayer->GetUserId(), kick_message);
}
engine->ServerCommand(command);
@@ -390,7 +391,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
}
else if ((ban_flags & BANFLAG_NOKICK) != BANFLAG_NOKICK)
{
g_HL2.AddDelayedKick(client, pPlayer->GetUserId(), kick_message);
gamehelpers->AddDelayedKick(client, pPlayer->GetUserId(), kick_message);
}
@@ -1,8 +1,8 @@
/**
* vim: set ts=4 :
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -29,9 +29,10 @@
* Version: $Id$
*/
#include "sm_globals.h"
#include "HandleSys.h"
#include "CDataPack.h"
#include "common_logic.h"
#include <IHandleSys.h>
#include <IDataPack.h>
#include <ISourceMod.h>
HandleType_t g_DataPackType;
@@ -45,35 +46,35 @@ public:
HandleAccess hacc;
TypeAccess tacc;
g_HandleSys.InitAccessDefaults(&tacc, &hacc);
handlesys->InitAccessDefaults(&tacc, &hacc);
tacc.access[HTypeAccess_Create] = true;
tacc.access[HTypeAccess_Inherit] = true;
tacc.ident = g_pCoreIdent;
hacc.access[HandleAccess_Read] = HANDLE_RESTRICT_OWNER;
g_DataPackType = g_HandleSys.CreateType("DataPack", this, 0, &tacc, &hacc, g_pCoreIdent, NULL);
g_DataPackType = handlesys->CreateType("DataPack", this, 0, &tacc, &hacc, g_pCoreIdent, NULL);
}
void OnSourceModShutdown()
{
g_HandleSys.RemoveType(g_DataPackType, g_pCoreIdent);
handlesys->RemoveType(g_DataPackType, g_pCoreIdent);
g_DataPackType = 0;
}
void OnHandleDestroy(HandleType_t type, void *object)
{
g_SourceMod.FreeDataPack(reinterpret_cast<IDataPack *>(object));
g_pSM->FreeDataPack(reinterpret_cast<IDataPack *>(object));
}
};
static cell_t smn_CreateDataPack(IPluginContext *pContext, const cell_t *params)
{
IDataPack *pDataPack = g_SourceMod.CreateDataPack();
IDataPack *pDataPack = g_pSM->CreateDataPack();
if (!pDataPack)
{
return 0;
}
return g_HandleSys.CreateHandle(g_DataPackType, pDataPack, pContext->GetIdentity(), g_pCoreIdent, NULL);
return handlesys->CreateHandle(g_DataPackType, pDataPack, pContext->GetIdentity(), g_pCoreIdent, NULL);
}
static cell_t smn_WritePackCell(IPluginContext *pContext, const cell_t *params)
@@ -86,7 +87,7 @@ static cell_t smn_WritePackCell(IPluginContext *pContext, const cell_t *params)
sec.pOwner = pContext->GetIdentity();
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
@@ -107,7 +108,7 @@ static cell_t smn_WritePackFloat(IPluginContext *pContext, const cell_t *params)
sec.pOwner = pContext->GetIdentity();
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
@@ -129,7 +130,7 @@ static cell_t smn_WritePackString(IPluginContext *pContext, const cell_t *params
sec.pOwner = pContext->GetIdentity();
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
@@ -157,7 +158,7 @@ static cell_t smn_ReadPackCell(IPluginContext *pContext, const cell_t *params)
sec.pOwner = pContext->GetIdentity();
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
@@ -181,7 +182,7 @@ static cell_t smn_ReadPackFloat(IPluginContext *pContext, const cell_t *params)
sec.pOwner = pContext->GetIdentity();
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
@@ -205,7 +206,7 @@ static cell_t smn_ReadPackString(IPluginContext *pContext, const cell_t *params)
sec.pOwner = pContext->GetIdentity();
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
@@ -232,7 +233,7 @@ static cell_t smn_ResetPack(IPluginContext *pContext, const cell_t *params)
sec.pOwner = pContext->GetIdentity();
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
@@ -257,7 +258,7 @@ static cell_t smn_GetPackPosition(IPluginContext *pContext, const cell_t *params
sec.pOwner = pContext->GetIdentity();
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
@@ -276,7 +277,7 @@ static cell_t smn_SetPackPosition(IPluginContext *pContext, const cell_t *params
sec.pOwner = pContext->GetIdentity();
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
@@ -300,7 +301,7 @@ static cell_t smn_IsPackReadable(IPluginContext *pContext, const cell_t *params)
sec.pOwner = pContext->GetIdentity();
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
if ((herr=handlesys->ReadHandle(hndl, g_DataPackType, &sec, (void **)&pDataPack))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid data pack handle %x (error %d)", hndl, herr);
@@ -29,24 +29,24 @@
* Version: $Id$
*/
#include "sourcemod.h"
#include "HandleSys.h"
#include "common_logic.h"
#include <IHandleSys.h>
#include "GameConfigs.h"
HandleType_t g_GameConfigsType;
class GameConfigsNatives :
public IHandleTypeDispatch,
public SourceModBase
public SMGlobalClass
{
public:
void OnSourceModAllInitialized()
{
g_GameConfigsType = g_HandleSys.CreateType("GameConfigs", this, 0, NULL, NULL, g_pCoreIdent, NULL);
g_GameConfigsType = handlesys->CreateType("GameConfigs", this, 0, NULL, NULL, g_pCoreIdent, NULL);
}
void OnSourceModShutdown()
{
g_HandleSys.RemoveType(g_GameConfigsType, g_pCoreIdent);
handlesys->RemoveType(g_GameConfigsType, g_pCoreIdent);
g_GameConfigsType = 0;
}
void OnHandleDestroy(HandleType_t type, void *object)
@@ -67,7 +67,7 @@ static cell_t smn_LoadGameConfigFile(IPluginContext *pCtx, const cell_t *params)
return pCtx->ThrowNativeError("Unable to open %s: %s", filename, error);
}
return g_HandleSys.CreateHandle(g_GameConfigsType, gc, pCtx->GetIdentity(), g_pCoreIdent, NULL);
return handlesys->CreateHandle(g_GameConfigsType, gc, pCtx->GetIdentity(), g_pCoreIdent, NULL);
}
static cell_t smn_GameConfGetOffset(IPluginContext *pCtx, const cell_t *params)
@@ -80,7 +80,7 @@ static cell_t smn_GameConfGetOffset(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&gc))
if ((herr=handlesys->ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&gc))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid game config handle %x (error %d)", hndl, herr);
@@ -108,7 +108,7 @@ static cell_t smn_GameConfGetKeyValue(IPluginContext *pCtx, const cell_t *params
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&gc))
if ((herr=handlesys->ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&gc))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid game config handle %x (error %d)", hndl, herr);
@@ -128,6 +128,33 @@ static cell_t smn_GameConfGetKeyValue(IPluginContext *pCtx, const cell_t *params
return 1;
}
static cell_t smn_GameConfGetAddress(IPluginContext *pCtx, const cell_t *params)
{
Handle_t hndl = static_cast<Handle_t>(params[1]);
HandleError herr;
HandleSecurity sec;
IGameConfig *gc;
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=handlesys->ReadHandle(hndl, g_GameConfigsType, &sec, (void **)&gc))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid game config handle %x (error %d)", hndl, herr);
}
char *key;
void* val;
pCtx->LocalToString(params[2], &key);
if (!gc->GetAddress(key, &val))
return 0;
return (cell_t)val;
}
static GameConfigsNatives s_GameConfigsNatives;
REGISTER_NATIVES(gameconfignatives)
@@ -135,5 +162,6 @@ REGISTER_NATIVES(gameconfignatives)
{"LoadGameConfigFile", smn_LoadGameConfigFile},
{"GameConfGetOffset", smn_GameConfGetOffset},
{"GameConfGetKeyValue", smn_GameConfGetKeyValue},
{"GameConfGetAddress", smn_GameConfGetAddress},
{NULL, NULL}
};
@@ -29,15 +29,17 @@
* Version: $Id$
*/
#include "sm_globals.h"
#include "HandleSys.h"
#include "PluginSys.h"
#include "common_logic.h"
#include <IHandleSys.h>
#include <IPluginSys.h>
using namespace SourceMod;
static cell_t sm_IsValidHandle(IPluginContext *pContext, const cell_t *params)
{
Handle_t hndl = static_cast<Handle_t>(params[1]);
HandleError err = g_HandleSys.ReadHandle(hndl, 0, NULL, NULL);
HandleError err = handlesys->ReadHandle(hndl, 0, NULL, NULL);
if (err != HandleError_Access
&& err != HandleError_None)
@@ -56,7 +58,7 @@ static cell_t sm_CloseHandle(IPluginContext *pContext, const cell_t *params)
sec.pIdentity = NULL;
sec.pOwner = pContext->GetIdentity();
HandleError err = g_HandleSys.FreeHandle(hndl, &sec);
HandleError err = handlesys->FreeHandle(hndl, &sec);
if (err == HandleError_None)
{
@@ -80,7 +82,7 @@ static cell_t sm_CloneHandle(IPluginContext *pContext, const cell_t *params)
pNewOwner = pContext->GetIdentity();
} else {
Handle_t hPlugin = static_cast<Handle_t>(params[2]);
IPlugin *pPlugin = g_PluginSys.PluginFromHandle(hPlugin, &err);
IPlugin *pPlugin = pluginsys->PluginFromHandle(hPlugin, &err);
if (!pPlugin)
{
return pContext->ThrowNativeError("Plugin handle %x is invalid (error %d)", hndl, err);
@@ -88,7 +90,7 @@ static cell_t sm_CloneHandle(IPluginContext *pContext, const cell_t *params)
pNewOwner = pPlugin->GetIdentity();
}
err = g_HandleSys.CloneHandle(hndl, &new_hndl, pNewOwner, NULL);
err = handlesys->CloneHandle(hndl, &new_hndl, pNewOwner, NULL);
if (err == HandleError_Access)
{
@@ -102,7 +104,7 @@ static cell_t sm_CloneHandle(IPluginContext *pContext, const cell_t *params)
static cell_t sm_GetMyHandle(IPluginContext *pContext, const cell_t *params)
{
CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
IPlugin *pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
return pPlugin->GetMyHandle();
}
+51 -8
View File
@@ -29,20 +29,20 @@
* Version: $Id$
*/
#include "PluginSys.h"
#include "common_logic.h"
#include "Translator.h"
#include "LibrarySys.h"
#include "sm_stringutil.h"
#include "PlayerManager.h"
#include <IPlayerHelpers.h>
#include <IPluginSys.h>
#include <ISourceMod.h>
static cell_t sm_LoadTranslations(IPluginContext *pCtx, const cell_t *params)
{
char *filename, *ext;
char buffer[PLATFORM_MAX_PATH];
CPlugin *pl = (CPlugin *)g_PluginSys.FindPluginByContext(pCtx->GetContext());
IPlugin *pl = pluginsys->FindPluginByContext(pCtx->GetContext());
pCtx->LocalToString(params[1], &filename);
UTIL_Format(buffer, sizeof(buffer), "%s", filename);
smcore.Format(buffer, sizeof(buffer), "%s", filename);
/* Make sure there is no extension */
if ((ext = strstr(buffer, ".txt")) != NULL
@@ -62,14 +62,14 @@ static cell_t sm_LoadTranslations(IPluginContext *pCtx, const cell_t *params)
static cell_t sm_SetGlobalTransTarget(IPluginContext *pContext, const cell_t *params)
{
g_SourceMod.SetGlobalTarget(params[1]);
g_pSM->SetGlobalTarget(params[1]);
return 1;
}
static cell_t sm_GetClientLanguage(IPluginContext *pContext, const cell_t *params)
{
CPlayer *player = g_Players.GetPlayerByIndex(params[1]);
IGamePlayer *player = playerhelpers->GetGamePlayer(params[1]);
if (!player || !player->IsConnected())
{
return pContext->ThrowNativeError("Invalid client index %d", params[1]);
@@ -104,6 +104,46 @@ static cell_t sm_GetLanguageInfo(IPluginContext *pContext, const cell_t *params)
return 1;
}
static cell_t sm_SetClientLanguage(IPluginContext *pContext, const cell_t *params)
{
IGamePlayer *player = playerhelpers->GetGamePlayer(params[1]);
if (!player || !player->IsConnected())
{
return pContext->ThrowNativeError("Invalid client index %d", params[1]);
}
player->SetLanguageId(params[2]);
return 1;
}
static cell_t sm_GetLanguageByCode(IPluginContext *pContext, const cell_t *params)
{
char *code;
unsigned int langid;
pContext->LocalToString(params[1], &code);
if (g_Translator.GetLanguageByCode(code, &langid))
return langid;
return -1;
}
static cell_t sm_GetLanguageByName(IPluginContext *pContext, const cell_t *params)
{
char *name;
unsigned int langid;
pContext->LocalToString(params[1], &name);
if (g_Translator.GetLanguageByName(name, &langid))
return langid;
return -1;
}
REGISTER_NATIVES(langNatives)
{
{"LoadTranslations", sm_LoadTranslations},
@@ -112,5 +152,8 @@ REGISTER_NATIVES(langNatives)
{"GetServerLanguage", sm_GetServerLanguage},
{"GetLanguageCount", sm_GetLanguageCount},
{"GetLanguageInfo", sm_GetLanguageInfo},
{"SetClientLanguage", sm_SetClientLanguage},
{"GetLanguageByCode", sm_GetLanguageByCode},
{"GetLanguageByName", sm_GetLanguageByName},
{NULL, NULL},
};
+71 -46
View File
@@ -33,9 +33,11 @@
#include <sm_trie_tpl.h>
#include "common_logic.h"
#include "CellArray.h"
#include <IGameHelpers.h>
#include <ILibrarySys.h>
#include <ITextParsers.h>
#include <ISourceMod.h>
#include "stringutil.h"
using namespace SourceHook;
@@ -78,6 +80,47 @@ public:
{
DumpCache(NULL);
}
void GetMapCycleFilePath(char *pBuffer, int maxlen)
{
const char *pEngineName = smcore.GetSourceEngineName();
const char *pMapCycleFileName = m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt";
if (strcmp(pEngineName, "tf2") == 0 || strcmp(pEngineName, "css") == 0
|| strcmp(pEngineName, "dods") == 0 || strcmp(pEngineName, "hl2dm") == 0)
{
// These four games and Source SDK 2013 do a lookup in this order; so shall we.
g_pSM->BuildPath(Path_Game,
pBuffer,
maxlen,
"cfg/%s",
pMapCycleFileName);
if (!libsys->PathExists(pBuffer))
{
g_pSM->BuildPath(Path_Game,
pBuffer,
maxlen,
"%s",
pMapCycleFileName);
if (!libsys->PathExists(pBuffer))
{
g_pSM->BuildPath(Path_Game,
pBuffer,
maxlen,
"cfg/mapcycle_default.txt");
}
}
}
else
{
g_pSM->BuildPath(Path_Game,
pBuffer,
maxlen,
"%s",
pMapCycleFileName);
}
}
void AddOrUpdateDefault(const char *name, const char *file)
{
char path[PLATFORM_MAX_PATH];
@@ -154,11 +197,9 @@ public:
pDefList->bIsPath = true;
smcore.strncopy(pDefList->name, "mapcyclefile", sizeof(pDefList->name));
g_pSM->BuildPath(Path_Game,
pDefList->path,
sizeof(pDefList->path),
"%s",
m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt");
GetMapCycleFilePath(pDefList->path, sizeof(pDefList->path));
pDefList->last_modified_time = 0;
pDefList->pArray = NULL;
pDefList->serial = 0;
@@ -348,51 +389,39 @@ public:
if ((success && pNewArray == NULL)
|| (!success && ((flags & MAPLIST_FLAG_MAPSFOLDER) == MAPLIST_FLAG_MAPSFOLDER)))
{
char path[255];
IDirectory *pDir;
pNewArray = new CellArray(64);
free_new_array = true;
g_pSM->BuildPath(Path_Game, path, sizeof(path), "maps");
if ((pDir = libsys->OpenDirectory(path)) != NULL)
cell_t *blk;
FileFindHandle_t findHandle;
const char *fileName = smcore.filesystem->FindFirstEx("maps/*.bsp", "GAME", &findHandle);
while (fileName)
{
char *ptr;
cell_t *blk;
char buffer[PLATFORM_MAX_PATH];
while (pDir->MoreFiles())
UTIL_StripExtension(fileName, buffer, sizeof(buffer));
if (!engine->IsMapValid(buffer))
{
if (!pDir->IsEntryFile()
|| strcmp(pDir->GetEntryName(), ".") == 0
|| strcmp(pDir->GetEntryName(), "..") == 0)
{
pDir->NextEntry();
continue;
}
smcore.strncopy(buffer, pDir->GetEntryName(), sizeof(buffer));
if ((ptr = strstr(buffer, ".bsp")) == NULL || ptr[4] != '\0')
{
pDir->NextEntry();
continue;
}
*ptr = '\0';
if (!engine->IsMapValid(buffer))
{
pDir->NextEntry();
continue;
}
if ((blk = pNewArray->push()) == NULL)
{
pDir->NextEntry();
continue;
}
smcore.strncopy((char *)blk, buffer, 255);
pDir->NextEntry();
fileName = smcore.filesystem->FindNext(findHandle);
continue;
}
libsys->CloseDirectory(pDir);
if ((blk = pNewArray->push()) == NULL)
{
fileName = smcore.filesystem->FindNext(findHandle);
continue;
}
smcore.strncopy((char *)blk, buffer, 255);
fileName = smcore.filesystem->FindNext(findHandle);
}
smcore.filesystem->FindClose(findHandle);
/* Remove the array if there were no items. */
if (pNewArray->size() == 0)
{
@@ -485,11 +514,7 @@ private:
if (m_pMapCycleFile != NULL && strcmp(name, "mapcyclefile") == 0)
{
char path[PLATFORM_MAX_PATH];
g_pSM->BuildPath(Path_Game,
path,
sizeof(path),
"%s",
m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt");
GetMapCycleFilePath(path, sizeof(path));
if (strcmp(path, pMapList->path) != 0)
{
@@ -524,7 +549,7 @@ private:
{
continue;
}
if (!engine->IsMapValid(ptr))
if (!gamehelpers->IsMapValid(ptr))
{
continue;
}
+235
View File
@@ -0,0 +1,235 @@
/**
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#include "common_logic.h"
#include <IPluginSys.h>
#include <IPlayerHelpers.h>
#include <sh_string.h>
#include <sh_list.h>
#include "AutoHandleRooter.h"
#include "CellArray.h"
using namespace SourceHook;
using namespace SourceMod;
class PlayerLogicHelpers :
public SMGlobalClass,
public IPluginsListener,
public ICommandTargetProcessor
{
struct SimpleMultiTargetFilter
{
IPlugin *plugin;
SourceHook::String pattern;
IPluginFunction *fun;
SourceHook::String phrase;
bool phraseIsML;
SimpleMultiTargetFilter(IPlugin *plugin, const char *pattern, IPluginFunction *fun,
const char *phrase, bool phraseIsML)
: plugin(plugin), pattern(pattern), fun(fun), phrase(phrase), phraseIsML(phraseIsML)
{
}
};
List<SimpleMultiTargetFilter *> simpleMultis;
bool filterEnabled;
public:
void AddMultiTargetFilter(IPlugin *plugin, const char *pattern, IPluginFunction *fun,
const char *phrase, bool phraseIsML)
{
SimpleMultiTargetFilter *smtf = new SimpleMultiTargetFilter(plugin, pattern, fun, phrase,
phraseIsML);
simpleMultis.push_back(smtf);
if (!filterEnabled) {
playerhelpers->RegisterCommandTargetProcessor(this);
filterEnabled = true;
}
}
void RemoveMultiTargetFilter(const char *pattern, IPluginFunction *fun)
{
List<SimpleMultiTargetFilter *>::iterator iter = simpleMultis.begin();
while (iter != simpleMultis.end()) {
if ((*iter)->fun == fun && strcmp((*iter)->pattern.c_str(), pattern) == 0) {
delete (*iter);
iter = simpleMultis.erase(iter);
break;
}
iter++;
}
}
PlayerLogicHelpers()
: filterEnabled(false)
{
}
public: //ICommandTargetProcessor
bool ProcessCommandTarget(cmd_target_info_t *info)
{
List<SimpleMultiTargetFilter *>::iterator iter;
for (iter = simpleMultis.begin(); iter != simpleMultis.end(); iter++) {
SimpleMultiTargetFilter *smtf = (*iter);
if (strcmp(smtf->pattern.c_str(), info->pattern) == 0) {
CellArray *array = new CellArray(1);
HandleSecurity sec(g_pCoreIdent, g_pCoreIdent);
Handle_t hndl = handlesys->CreateHandleEx(htCellArray, array, &sec, NULL, NULL);
AutoHandleCloner ahc(hndl, sec);
if (ahc.getClone() == BAD_HANDLE) {
smcore.LogError("[SM] Could not allocate a handle (%s, %d)", __FILE__, __LINE__);
delete array;
return false;
}
smtf->fun->PushString(info->pattern);
smtf->fun->PushCell(ahc.getClone());
cell_t result = 0;
if (smtf->fun->Execute(&result) != SP_ERROR_NONE || !result)
return false;
IGamePlayer *pAdmin = info->admin
? playerhelpers->GetGamePlayer(info->admin)
: NULL;
info->num_targets = 0;
for (size_t i = 0; i < array->size(); i++) {
cell_t client = *array->at(i);
IGamePlayer *pClient = playerhelpers->GetGamePlayer(client);
if (pClient == NULL || !pClient->IsConnected())
continue;
if (playerhelpers->FilterCommandTarget(pAdmin, pClient, info->flags) ==
COMMAND_TARGET_VALID)
{
info->targets[info->num_targets++] = client;
if (info->num_targets >= unsigned(info->max_targets))
break;
}
}
info->reason = info->num_targets > 0
? COMMAND_TARGET_VALID
: COMMAND_TARGET_EMPTY_FILTER;
if (info->num_targets) {
smcore.strncopy(info->target_name, smtf->phrase.c_str(), info->target_name_maxlength);
info->target_name_style = smtf->phraseIsML
? COMMAND_TARGETNAME_ML
: COMMAND_TARGETNAME_RAW;
}
return true;
}
}
return false;
}
public: //SMGlobalClass
void OnSourceModAllInitialized()
{
pluginsys->AddPluginsListener(this);
}
void OnSourceModShutdown()
{
pluginsys->RemovePluginsListener(this);
if (filterEnabled) {
playerhelpers->UnregisterCommandTargetProcessor(this);
filterEnabled = false;
}
}
public: //IPluginsListener
void OnPluginDestroyed(IPlugin *plugin)
{
List<SimpleMultiTargetFilter *>::iterator iter = simpleMultis.begin();
while (iter != simpleMultis.end()) {
if ((*iter)->plugin != plugin) {
iter++;
} else {
delete (*iter);
iter = simpleMultis.erase(iter);
}
}
}
} s_PlayerLogicHelpers;
static cell_t
AddMultiTargetFilter(IPluginContext *ctx, const cell_t *params)
{
IPluginFunction *fun = ctx->GetFunctionById(funcid_t(params[2]));
if (fun == NULL)
return ctx->ThrowNativeError("Invalid function id (%X)", params[2]);
char *pattern;
char *phrase;
ctx->LocalToString(params[1], &pattern);
ctx->LocalToString(params[3], &phrase);
bool phraseIsML = !!params[4];
IPlugin *plugin = pluginsys->FindPluginByContext(ctx->GetContext());
s_PlayerLogicHelpers.AddMultiTargetFilter(plugin, pattern, fun, phrase, phraseIsML);
return 1;
}
static cell_t
RemoveMultiTargetFilter(IPluginContext *ctx, const cell_t *params)
{
IPluginFunction *fun = ctx->GetFunctionById(funcid_t(params[2]));
if (fun == NULL)
return ctx->ThrowNativeError("Invalid function id (%X)", params[2]);
char *pattern;
ctx->LocalToString(params[1], &pattern);
s_PlayerLogicHelpers.RemoveMultiTargetFilter(pattern, fun);
return 1;
}
REGISTER_NATIVES(playernatives)
{
{"AddMultiTargetFilter", AddMultiTargetFilter},
{"RemoveMultiTargetFilter", RemoveMultiTargetFilter},
{NULL, NULL}
};
@@ -29,12 +29,13 @@
* Version: $Id$
*/
#include "sm_globals.h"
#include "HandleSys.h"
//Note: Do not add this to Linux yet, i haven't done the HPET timing research (if even available)
//nonetheless we need accurate counting
#if !defined PLATFORM_LINUX
#include "common_logic.h"
#include <IHandleSys.h>
#if !defined PLATFORM_WINDOWS
#include <stddef.h>
#include <stdint.h>
#include <sys/time.h>
#endif
struct Profiler
{
@@ -47,6 +48,9 @@ struct Profiler
LARGE_INTEGER start;
LARGE_INTEGER end;
double freq;
#else
struct timeval start;
struct timeval end;
#endif
bool started;
bool stopped;
@@ -61,11 +65,11 @@ class ProfilerHelpers :
public:
void OnSourceModAllInitialized()
{
g_ProfilerType = g_HandleSys.CreateType("Profiler", this, 0, NULL, NULL, g_pCoreIdent, NULL);
g_ProfilerType = handlesys->CreateType("Profiler", this, 0, NULL, NULL, g_pCoreIdent, NULL);
}
void OnSourceModShutdown()
{
g_HandleSys.RemoveType(g_ProfilerType, g_pCoreIdent);
handlesys->RemoveType(g_ProfilerType, g_pCoreIdent);
}
void OnHandleDestroy(HandleType_t type, void *object)
{
@@ -84,7 +88,7 @@ static cell_t CreateProfiler(IPluginContext *pContext, const cell_t *params)
p->freq = 1.0 / (double)(qpf.QuadPart);
#endif
Handle_t hndl = g_HandleSys.CreateHandle(g_ProfilerType, p, pContext->GetIdentity(), g_pCoreIdent, NULL);
Handle_t hndl = handlesys->CreateHandle(g_ProfilerType, p, pContext->GetIdentity(), g_pCoreIdent, NULL);
if (hndl == BAD_HANDLE)
{
delete p;
@@ -100,7 +104,7 @@ static cell_t StartProfiling(IPluginContext *pContext, const cell_t *params)
HandleError err;
Profiler *prof;
if ((err = g_HandleSys.ReadHandle(hndl, g_ProfilerType, &sec, (void **)&prof))
if ((err = handlesys->ReadHandle(hndl, g_ProfilerType, &sec, (void **)&prof))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
@@ -108,6 +112,8 @@ static cell_t StartProfiling(IPluginContext *pContext, const cell_t *params)
#if defined PLATFORM_WINDOWS
QueryPerformanceCounter(&prof->start);
#else
gettimeofday(&prof->start, NULL);
#endif
prof->started = true;
@@ -123,7 +129,7 @@ static cell_t StopProfiling(IPluginContext *pContext, const cell_t *params)
HandleError err;
Profiler *prof;
if ((err = g_HandleSys.ReadHandle(hndl, g_ProfilerType, &sec, (void **)&prof))
if ((err = handlesys->ReadHandle(hndl, g_ProfilerType, &sec, (void **)&prof))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
@@ -136,6 +142,8 @@ static cell_t StopProfiling(IPluginContext *pContext, const cell_t *params)
#if defined PLATFORM_WINDOWS
QueryPerformanceCounter(&prof->end);
#else
gettimeofday(&prof->end, NULL);
#endif
prof->started = false;
@@ -151,7 +159,7 @@ static cell_t GetProfilerTime(IPluginContext *pContext, const cell_t *params)
HandleError err;
Profiler *prof;
if ((err = g_HandleSys.ReadHandle(hndl, g_ProfilerType, &sec, (void **)&prof))
if ((err = handlesys->ReadHandle(hndl, g_ProfilerType, &sec, (void **)&prof))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", hndl, err);
@@ -168,6 +176,10 @@ static cell_t GetProfilerTime(IPluginContext *pContext, const cell_t *params)
LONGLONG diff = prof->end.QuadPart - prof->start.QuadPart;
double seconds = diff * prof->freq;
fTime = (float)seconds;
#else
int64_t start_us = int64_t(prof->start.tv_sec) * 1000000 + prof->start.tv_usec;
int64_t stop_us = int64_t(prof->end.tv_sec) * 1000000 + prof->end.tv_usec;
fTime = double(stop_us - start_us) / 1000000.0;
#endif
return sp_ftoc(fTime);
@@ -181,5 +193,4 @@ REGISTER_NATIVES(profilerNatives)
{"StopProfiling", StopProfiling},
{NULL, NULL},
};
#endif
+2 -2
View File
@@ -94,7 +94,7 @@ void sort_random(cell_t *array, cell_t size)
for (int i = size-1; i > 0; i--)
{
int n = (rand() % i) + 1;
int n = rand() % (i + 1);
if (array[i] != array[n])
{
@@ -435,7 +435,7 @@ void sort_adt_random(CellArray *cArray)
for (int i = arraysize-1; i > 0; i--)
{
int n = (rand() % i) + 1;
int n = rand() % (i + 1);
cArray->swap(i, n);
}
@@ -1,5 +1,5 @@
/**
* vim: set ts=4 :
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
@@ -29,12 +29,12 @@
* Version: $Id$
*/
#include "common_logic.h"
#include <string.h>
#include <stdlib.h>
#include "sm_globals.h"
#include "sm_stringutil.h"
#include <ITextParsers.h>
#include <ctype.h>
#include "stringutil.h"
inline const char *_strstr(const char *str, const char *substr)
{
@@ -141,7 +141,7 @@ static cell_t sm_numtostr(IPluginContext *pCtx, const cell_t *params)
{
char *str;
pCtx->LocalToString(params[2], &str);
size_t res = UTIL_Format(str, params[3], "%d", params[1]);
size_t res = smcore.Format(str, params[3], "%d", params[1]);
return static_cast<cell_t>(res);
}
@@ -174,7 +174,7 @@ static cell_t sm_floattostr(IPluginContext *pCtx, const cell_t *params)
{
char *str;
pCtx->LocalToString(params[2], &str);
size_t res = UTIL_Format(str, params[3], "%f", sp_ctof(params[1]));
size_t res = smcore.Format(str, params[3], "%f", sp_ctof(params[1]));
return static_cast<cell_t>(res);
}
@@ -187,7 +187,7 @@ static cell_t sm_formatex(IPluginContext *pCtx, const cell_t *params)
pCtx->LocalToString(params[1], &buf);
pCtx->LocalToString(params[3], &fmt);
res = atcprintf(buf, static_cast<size_t>(params[2]), fmt, pCtx, params, &arg);
res = smcore.atcprintf(buf, static_cast<size_t>(params[2]), fmt, pCtx, params, &arg);
return static_cast<cell_t>(res);
}
@@ -256,7 +256,7 @@ static cell_t sm_format(IPluginContext *pCtx, const cell_t *params)
}
buf = (copy) ? __copy_buf : destbuf;
res = atcprintf(buf, maxlen, fmt, pCtx, params, &arg);
res = smcore.atcprintf(buf, maxlen, fmt, pCtx, params, &arg);
if (copy)
{
@@ -306,7 +306,7 @@ static cell_t sm_vformat(IPluginContext *pContext, const cell_t *params)
pContext->LocalToString(params[3], &format);
size_t total = atcprintf(destination, maxlen, format, pContext, local_params, &vargPos);
size_t total = smcore.atcprintf(destination, maxlen, format, pContext, local_params, &vargPos);
/* Perform copy-on-write if we need to */
if (copy)
@@ -29,11 +29,14 @@
* Version: $Id$
*/
#include "HandleSys.h"
#include "TimerSys.h"
#include "PluginSys.h"
#include "Logger.h"
#include "DebugReporter.h"
#include "common_logic.h"
#include <string.h>
#include <IHandleSys.h>
#include <ITimerSystem.h>
#include <IPluginSys.h>
#include <sh_stack.h>
using namespace SourceHook;
#define TIMER_DATA_HNDL_CLOSE (1<<9)
#define TIMER_HNDL_CLOSE (1<<9)
@@ -86,15 +89,15 @@ void TimerNatives::OnSourceModAllInitialized()
{
HandleAccess sec;
g_HandleSys.InitAccessDefaults(NULL, &sec);
handlesys->InitAccessDefaults(NULL, &sec);
sec.access[HandleAccess_Clone] = HANDLE_RESTRICT_IDENTITY;
g_TimerType = g_HandleSys.CreateType("Timer", this, 0, NULL, &sec, g_pCoreIdent, NULL);
g_TimerType = handlesys->CreateType("Timer", this, 0, NULL, &sec, g_pCoreIdent, NULL);
}
void TimerNatives::OnSourceModShutdown()
{
g_HandleSys.RemoveType(g_TimerType, g_pCoreIdent);
handlesys->RemoveType(g_TimerType, g_pCoreIdent);
g_TimerType = 0;
}
@@ -102,7 +105,7 @@ void TimerNatives::OnHandleDestroy(HandleType_t type, void *object)
{
TimerInfo *pTimer = reinterpret_cast<TimerInfo *>(object);
g_Timers.KillTimer(pTimer->Timer);
timersys->KillTimer(pTimer->Timer);
}
TimerInfo *TimerNatives::CreateTimerInfo()
@@ -150,27 +153,23 @@ void TimerNatives::OnTimerEnd(ITimer *pTimer, void *pData)
if (pInfo->Flags & TIMER_DATA_HNDL_CLOSE)
{
if ((herr=g_HandleSys.FreeHandle(usrhndl, &sec)) != HandleError_None)
if ((herr=handlesys->FreeHandle(usrhndl, &sec)) != HandleError_None)
{
g_DbgReporter.GenerateError(pInfo->pContext,
pInfo->Hook->GetFunctionID(),
SP_ERROR_NATIVE,
"Invalid data handle %x (error %d) passed during timer end with TIMER_DATA_HNDL_CLOSE",
usrhndl,
herr);
smcore.GenerateError(pInfo->pContext, pInfo->Hook->GetFunctionID(),
SP_ERROR_NATIVE,
"Invalid data handle %x (error %d) passed during timer end with TIMER_DATA_HNDL_CLOSE",
usrhndl, herr);
}
}
if (pInfo->TimerHandle != BAD_HANDLE)
{
if ((herr=g_HandleSys.FreeHandle(pInfo->TimerHandle, &sec)) != HandleError_None)
if ((herr=handlesys->FreeHandle(pInfo->TimerHandle, &sec)) != HandleError_None)
{
g_DbgReporter.GenerateError(pInfo->pContext,
pInfo->Hook->GetFunctionID(),
smcore.GenerateError(pInfo->pContext, pInfo->Hook->GetFunctionID(),
SP_ERROR_NATIVE,
"Invalid timer handle %x (error %d) during timer end, displayed function is timer callback, not the stack trace",
pInfo->TimerHandle,
herr);
pInfo->TimerHandle, herr);
}
}
@@ -200,7 +199,7 @@ static cell_t smn_CreateTimer(IPluginContext *pCtx, const cell_t *params)
}
pInfo = s_TimerNatives.CreateTimerInfo();
pTimer = g_Timers.CreateTimer(&s_TimerNatives, sp_ctof(params[1]), pInfo, flags);
pTimer = timersys->CreateTimer(&s_TimerNatives, sp_ctof(params[1]), pInfo, flags);
if (!pTimer)
{
@@ -208,7 +207,7 @@ static cell_t smn_CreateTimer(IPluginContext *pCtx, const cell_t *params)
return 0;
}
hndl = g_HandleSys.CreateHandle(g_TimerType, pInfo, pCtx->GetIdentity(), g_pCoreIdent, NULL);
hndl = handlesys->CreateHandle(g_TimerType, pInfo, pCtx->GetIdentity(), g_pCoreIdent, NULL);
/* If we can't get a handle, the timer isn't refcounted against the plugin and
* we need to bail out to prevent a crash.
@@ -219,11 +218,11 @@ static cell_t smn_CreateTimer(IPluginContext *pCtx, const cell_t *params)
if (flags & TIMER_DATA_HNDL_CLOSE)
{
HandleSecurity sec(pCtx->GetIdentity(), g_pCoreIdent);
g_HandleSys.FreeHandle(params[3], &sec);
handlesys->FreeHandle(params[3], &sec);
}
/* Zero everything so there's no conflicts */
memset(pInfo, 0, sizeof(TimerInfo));
g_Timers.KillTimer(pTimer);
timersys->KillTimer(pTimer);
return pCtx->ThrowNativeError("Could not create timer, no more handles");
}
@@ -248,20 +247,20 @@ static cell_t smn_KillTimer(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = pCtx->GetIdentity();
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_TimerType, &sec, (void **)&pInfo))
if ((herr=handlesys->ReadHandle(hndl, g_TimerType, &sec, (void **)&pInfo))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid timer handle %x (error %d)", hndl, herr);
}
g_Timers.KillTimer(pInfo->Timer);
timersys->KillTimer(pInfo->Timer);
if (params[2] && !(pInfo->Flags & TIMER_DATA_HNDL_CLOSE))
{
sec.pOwner = pInfo->pContext->GetIdentity();
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.FreeHandle(static_cast<Handle_t>(pInfo->UserData), &sec)) != HandleError_None)
if ((herr=handlesys->FreeHandle(static_cast<Handle_t>(pInfo->UserData), &sec)) != HandleError_None)
{
return pCtx->ThrowNativeError("Invalid data handle %x (error %d) on timer kill with TIMER_DATA_HNDL_CLOSE", hndl, herr);
}
@@ -280,26 +279,26 @@ static cell_t smn_TriggerTimer(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = pCtx->GetIdentity();
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_TimerType, &sec, (void **)&pInfo))
if ((herr=handlesys->ReadHandle(hndl, g_TimerType, &sec, (void **)&pInfo))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid timer handle %x (error %d)", hndl, herr);
}
g_Timers.FireTimerOnce(pInfo->Timer, params[2] ? true : false);
timersys->FireTimerOnce(pInfo->Timer, params[2] ? true : false);
return 1;
}
static cell_t smn_GetTickedTime(IPluginContext *pContext, const cell_t *params)
{
return sp_ftoc(*g_pUniversalTime);
return sp_ftoc(*serverGlobals.universalTime);
}
static cell_t smn_GetMapTimeLeft(IPluginContext *pContext, const cell_t *params)
{
float time_left;
if (!g_Timers.GetMapTimeLeft(&time_left))
if (!timersys->GetMapTimeLeft(&time_left))
{
return 0;
}
@@ -313,7 +312,7 @@ static cell_t smn_GetMapTimeLeft(IPluginContext *pContext, const cell_t *params)
static cell_t smn_GetMapTimeLimit(IPluginContext *pContext, const cell_t *params)
{
IMapTimer *pMapTimer = g_Timers.GetMapTimer();
IMapTimer *pMapTimer = timersys->GetMapTimer();
if (!pMapTimer)
{
@@ -330,7 +329,7 @@ static cell_t smn_GetMapTimeLimit(IPluginContext *pContext, const cell_t *params
static cell_t smn_ExtendMapTimeLimit(IPluginContext *pContext, const cell_t *params)
{
IMapTimer *pMapTimer = g_Timers.GetMapTimer();
IMapTimer *pMapTimer = timersys->GetMapTimer();
if (!pMapTimer)
{
@@ -344,12 +343,12 @@ static cell_t smn_ExtendMapTimeLimit(IPluginContext *pContext, const cell_t *par
static cell_t smn_IsServerProcessing(IPluginContext *pContext, const cell_t *params)
{
return (gpGlobals->frametime > 0.0f) ? 1 : 0;
return (*serverGlobals.frametime > 0.0f) ? 1 : 0;
}
static cell_t smn_GetTickInterval(IPluginContext *pContext, const cell_t *params)
{
return sp_ftoc(gpGlobals->interval_per_tick);
return sp_ftoc(*serverGlobals.interval_per_tick);
}
REGISTER_NATIVES(timernatives)
+342
View File
@@ -0,0 +1,342 @@
/**
* vim: set ts=4 sw=4 tw=99 et :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <sm_platform.h>
#include "stringutil.h"
// We're in logic so we don't have this from the SDK.
#ifndef MIN
#define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
#endif
const char *stristr(const char *str, const char *substr)
{
if (!*substr)
{
return ((char *)str);
}
char *needle = (char *)substr;
char *prevloc = (char *)str;
char *haystack = (char *)str;
while (*haystack)
{
if (tolower(*haystack) == tolower(*needle))
{
haystack++;
if (!*++needle)
{
return prevloc;
}
}
else
{
haystack = ++prevloc;
needle = (char *)substr;
}
}
return NULL;
}
unsigned int strncopy(char *dest, const char *src, size_t count)
{
if (!count)
{
return 0;
}
char *start = dest;
while ((*src) && (--count))
{
*dest++ = *src++;
}
*dest = '\0';
return (dest - start);
}
unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive)
{
size_t searchLen = strlen(search);
size_t replaceLen = strlen(replace);
char *ptr = subject;
unsigned int total = 0;
while ((ptr = UTIL_ReplaceEx(ptr, maxlength, search, searchLen, replace, replaceLen, caseSensitive)) != NULL)
{
total++;
if (*ptr == '\0')
{
break;
}
}
return total;
}
/**
* NOTE: Do not edit this for the love of god unless you have
* read the test cases and understand the code behind each one.
* While I don't guarantee there aren't mistakes, I do guarantee
* that plugins will end up relying on tiny idiosyncrasies of this
* function, just like they did with AMX Mod X.
*
* There are explicitly more cases than the AMX Mod X version because
* we're not doing a blind copy. Each case is specifically optimized
* for what needs to be done. Even better, we don't have to error on
* bad buffer sizes. Instead, this function will smartly cut off the
* string in a way that pushes old data out.
*/
char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive)
{
char *ptr = subject;
size_t browsed = 0;
size_t textLen = strlen(subject);
/* It's not possible to search or replace */
if (searchLen > textLen)
{
return NULL;
}
/* Handle the case of one byte replacement.
* It's only valid in one case.
*/
if (maxLen == 1)
{
/* If the search matches and the replace length is 0,
* we can just terminate the string and be done.
*/
if ((caseSensitive ? strcmp(subject, search) : strcasecmp(subject, search)) == 0 && replaceLen == 0)
{
*subject = '\0';
return subject;
}
else
{
return NULL;
}
}
/* Subtract one off the maxlength so we can include the null terminator */
maxLen--;
while (*ptr != '\0' && (browsed <= textLen - searchLen))
{
/* See if we get a comparison */
if ((caseSensitive ? strncmp(ptr, search, searchLen) : strncasecmp(ptr, search, searchLen)) == 0)
{
if (replaceLen > searchLen)
{
/* First, see if we have enough space to do this operation */
if (maxLen - textLen < replaceLen - searchLen)
{
/* First, see if the replacement length goes out of bounds. */
if (browsed + replaceLen >= maxLen)
{
/* EXAMPLE CASE:
* Subject: AABBBCCC
* Buffer : 12 bytes
* Search : BBB
* Replace: DDDDDDDDDD
* OUTPUT : AADDDDDDDDD
* POSITION: ^
*/
/* If it does, we'll just bound the length and do a strcpy. */
replaceLen = maxLen - browsed;
/* Note, we add one to the final result for the null terminator */
strncopy(ptr, replace, replaceLen+1);
}
else
{
/* EXAMPLE CASE:
* Subject: AABBBCCC
* Buffer : 12 bytes
* Search : BBB
* Replace: DDDDDDD
* OUTPUT : AADDDDDDDCC
* POSITION: ^
*/
/* We're going to have some bytes left over... */
size_t origBytesToCopy = (textLen - (browsed + searchLen)) + 1;
size_t realBytesToCopy = (maxLen - (browsed + replaceLen)) + 1;
char *moveFrom = ptr + searchLen + (origBytesToCopy - realBytesToCopy);
char *moveTo = ptr + replaceLen;
/* First, move our old data out of the way. */
memmove(moveTo, moveFrom, realBytesToCopy);
/* Now, do our replacement. */
memcpy(ptr, replace, replaceLen);
}
}
else
{
/* EXAMPLE CASE:
* Subject: AABBBCCC
* Buffer : 12 bytes
* Search : BBB
* Replace: DDDD
* OUTPUT : AADDDDCCC
* POSITION: ^
*/
/* Yes, we have enough space. Do a normal move operation. */
char *moveFrom = ptr + searchLen;
char *moveTo = ptr + replaceLen;
/* First move our old data out of the way. */
size_t bytesToCopy = (textLen - (browsed + searchLen)) + 1;
memmove(moveTo, moveFrom, bytesToCopy);
/* Now do our replacement. */
memcpy(ptr, replace, replaceLen);
}
}
else if (replaceLen < searchLen)
{
/* EXAMPLE CASE:
* Subject: AABBBCCC
* Buffer : 12 bytes
* Search : BBB
* Replace: D
* OUTPUT : AADCCC
* POSITION: ^
*/
/* If the replacement does not grow the string length, we do not
* need to do any fancy checking at all. Yay!
*/
char *moveFrom = ptr + searchLen; /* Start after the search pointer */
char *moveTo = ptr + replaceLen; /* Copy to where the replacement ends */
/* Copy our replacement in, if any */
if (replaceLen)
{
memcpy(ptr, replace, replaceLen);
}
/* Figure out how many bytes to move down, including null terminator */
size_t bytesToCopy = (textLen - (browsed + searchLen)) + 1;
/* Move the rest of the string down */
memmove(moveTo, moveFrom, bytesToCopy);
}
else
{
/* EXAMPLE CASE:
* Subject: AABBBCCC
* Buffer : 12 bytes
* Search : BBB
* Replace: DDD
* OUTPUT : AADDDCCC
* POSITION: ^
*/
/* We don't have to move anything around, just do a straight copy */
memcpy(ptr, replace, replaceLen);
}
return ptr + replaceLen;
}
ptr++;
browsed++;
}
return NULL;
}
size_t UTIL_DecodeHexString(unsigned char *buffer, size_t maxlength, const char *hexstr)
{
size_t written = 0;
size_t length = strlen(hexstr);
for (size_t i = 0; i < length; i++)
{
if (written >= maxlength)
break;
buffer[written++] = hexstr[i];
if (hexstr[i] == '\\' && hexstr[i + 1] == 'x')
{
if (i + 3 >= length)
continue;
/* Get the hex part. */
char s_byte[3];
int r_byte;
s_byte[0] = hexstr[i + 2];
s_byte[1] = hexstr[i + 3];
s_byte[2] = '\0';
/* Read it as an integer */
sscanf(s_byte, "%x", &r_byte);
/* Save the value */
buffer[written - 1] = r_byte;
/* Adjust index */
i += 3;
}
}
return written;
}
#define PATHSEPARATOR(c) ((c) == '\\' || (c) == '/')
void UTIL_StripExtension(const char *in, char *out, int outSize)
{
// Find the last dot. If it's followed by a dot or a slash, then it's part of a
// directory specifier like ../../somedir/./blah.
// scan backward for '.'
int end = strlen(in) - 1;
while (end > 0 && in[end] != '.' && !PATHSEPARATOR(in[end]))
{
--end;
}
if (end > 0 && !PATHSEPARATOR(in[end]) && end < outSize)
{
int nChars = MIN(end, outSize-1);
if (out != in)
{
memcpy(out, in, nChars);
}
out[nChars] = 0;
}
else
{
// nothing found
if (out != in)
{
strncopy(out, in, outSize);
}
}
}
+46
View File
@@ -0,0 +1,46 @@
/**
* vim: set ts=4 sw=4 tw=99 et :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#ifndef _INCLUDE_SOURCEMOD_COMMON_STRINGUTIL_H_
#define _INCLUDE_SOURCEMOD_COMMON_STRINGUTIL_H_
const char *stristr(const char *str, const char *substr);
unsigned int strncopy(char *dest, const char *src, size_t count);
unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search,
const char *replace, bool caseSensitive = true);
char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen,
const char *replace, size_t replaceLen, bool caseSensitive = true);
size_t UTIL_DecodeHexString(unsigned char *buffer, size_t maxlength, const char *hexstr);
void UTIL_StripExtension(const char *in, char *out, int outSize);
#endif /* _INCLUDE_SOURCEMOD_COMMON_STRINGUTIL_H_ */
+1 -6
View File
@@ -124,11 +124,6 @@ void BaseWorker::AddThreadToQueue(SWThreadHandle *pHandle)
m_ThreadQueue.push_back(pHandle);
}
unsigned int BaseWorker::GetMaxThreadsPerFrame()
{
return m_perFrame;
}
WorkerState BaseWorker::GetStatus(unsigned int *threads)
{
if (threads)
@@ -140,7 +135,7 @@ WorkerState BaseWorker::GetStatus(unsigned int *threads)
unsigned int BaseWorker::RunFrame()
{
unsigned int done = 0;
unsigned int max = GetMaxThreadsPerFrame();
unsigned int max = m_perFrame;
SWThreadHandle *swt = NULL;
IThread *pThread = NULL;
+2 -2
View File
@@ -84,6 +84,8 @@ public: //IWorker
virtual unsigned int Flush(bool flush_cancel);
//returns status and number of threads in queue
virtual WorkerState GetStatus(unsigned int *numThreads);
virtual void SetMaxThreadsPerFrame(unsigned int threads);
virtual void SetThinkTimePerFrame(unsigned int thinktime) {}
public: //IThreadCreator
virtual void MakeThread(IThread *pThread);
virtual IThreadHandle *MakeThread(IThread *pThread, ThreadFlags flags);
@@ -92,8 +94,6 @@ public: //IThreadCreator
public: //BaseWorker
virtual void AddThreadToQueue(SWThreadHandle *pHandle);
virtual SWThreadHandle *PopThreadFromQueue();
virtual void SetMaxThreadsPerFrame(unsigned int threads);
virtual unsigned int GetMaxThreadsPerFrame();
protected:
SourceHook::List<SWThreadHandle *> m_ThreadQueue;
unsigned int m_perFrame;
+5
View File
@@ -209,6 +209,11 @@ WorkerState ThreadWorker::GetStatus(unsigned int *threads)
return state;
}
void ThreadWorker::SetThinkTimePerFrame(unsigned int thinktime)
{
m_think_time = thinktime;
}
bool ThreadWorker::Start()
{
if (m_state == Worker_Invalid)
+3 -1
View File
@@ -34,7 +34,7 @@
#include "BaseWorker.h"
#define DEFAULT_THINK_TIME_MS 50
#define DEFAULT_THINK_TIME_MS 20
class ThreadWorker : public BaseWorker, public IThread
{
@@ -53,6 +53,8 @@ public: //IWorker
virtual bool Stop(bool flush_cancel);
//returns status and number of threads in queue
virtual WorkerState GetStatus(unsigned int *numThreads);
//virtual void SetMaxThreadsPerFrame(unsigned int threads);
virtual void SetThinkTimePerFrame(unsigned int thinktime);
public: //BaseWorker
virtual void AddThreadToQueue(SWThreadHandle *pHandle);
virtual SWThreadHandle *PopThreadFromQueue();
+4 -4
View File
@@ -29,8 +29,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION SM_FILE_VERSION
PRODUCTVERSION SM_FILE_VERSION
FILEVERSION SM_VERSION_FILE
PRODUCTVERSION SM_VERSION_FILE
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -47,12 +47,12 @@ BEGIN
BEGIN
VALUE "Comments", "SourceMod"
VALUE "FileDescription", "SourceMod Core Logic"
VALUE "FileVersion", SM_FULL_VERSION
VALUE "FileVersion", SM_VERSION_STRING
VALUE "InternalName", "sourcemod"
VALUE "LegalCopyright", "Copyright (c) 2004-2009, AlliedModders LLC"
VALUE "OriginalFilename", "sourcemod.logic.dll"
VALUE "ProductName", "SourceMod"
VALUE "ProductVersion", SM_FULL_VERSION
VALUE "ProductVersion", SM_VERSION_STRING
END
END
BLOCK "VarFileInfo"
+169 -7
View File
@@ -2,7 +2,7 @@
* vim: set ts=4 sw=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
@@ -43,12 +43,36 @@
#include "ShareSys.h"
#include "sm_srvcmds.h"
#include "ForwardSys.h"
#include "TimerSys.h"
#include "logic_bridge.h"
#include "DebugReporter.h"
#include "PlayerManager.h"
#include "AdminCache.h"
#include "HalfLife2.h"
#include "CoreConfig.h"
#if defined _WIN32
#define MATCHMAKINGDS_SUFFIX ""
#define MATCHMAKINGDS_EXT "dll"
#elif defined __APPLE__
#define MATCHMAKINGDS_SUFFIX ""
#define MATCHMAKINGDS_EXT "dylib"
#elif defined __linux__
#if SOURCE_ENGINE < SE_LEFT4DEAD2
#define MATCHMAKINGDS_SUFFIX "_i486"
#else
#define MATCHMAKINGDS_SUFFIX ""
#endif
#define MATCHMAKINGDS_EXT "so"
#endif
static ILibrary *g_pLogic = NULL;
static LogicInitFunction logic_init_fn;
IThreader *g_pThreader;
ITextParsers *textparsers;
sm_logic_t logicore;
ITranslator *translator;
class VEngineServer_Logic : public IVEngineServer_Logic
{
@@ -57,10 +81,34 @@ public:
{
return engine->IsMapValid(map);
}
virtual void ServerCommand(const char *cmd)
{
engine->ServerCommand(cmd);
}
};
static VEngineServer_Logic logic_engine;
class VFileSystem_Logic : public IFileSystem_Logic
{
public:
const char *FindFirstEx(const char *pWildCard, const char *pPathID, FileFindHandle_t *pHandle)
{
return filesystem->FindFirstEx(pWildCard, pPathID, pHandle);
}
const char *FindNext(FileFindHandle_t handle)
{
return filesystem->FindNext(handle);
}
void FindClose(FileFindHandle_t handle)
{
filesystem->FindClose(handle);
}
};
static VFileSystem_Logic logic_filesystem;
static void add_natives(sp_nativeinfo_t *natives)
{
g_pCoreNatives->AddNatives(natives);
@@ -80,11 +128,95 @@ static void log_error(const char *fmt, ...)
va_end(ap);
}
static void generate_error(IPluginContext *ctx, cell_t func_idx, int err, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
g_DbgReporter.GenerateErrorVA(ctx, func_idx, err, fmt, ap);
va_end(ap);
}
static const char *get_cvar_string(ConVar* cvar)
{
return cvar->GetString();
}
static bool get_game_name(char *buffer, size_t maxlength)
{
KeyValues *pGameInfo = new KeyValues("GameInfo");
if (g_HL2.KVLoadFromFile(pGameInfo, basefilesystem, "gameinfo.txt"))
{
const char *str;
if ((str = pGameInfo->GetString("game", NULL)) != NULL)
{
strncopy(buffer, str, maxlength);
return true;
}
}
pGameInfo->deleteThis();
return false;
}
static const char *get_game_description()
{
return SERVER_CALL(GetGameDescription)();
}
static const char *get_source_engine_name()
{
#if !defined SOURCE_ENGINE
# error "Unknown engine type"
#endif
#if SOURCE_ENGINE == SE_EPISODEONE
return "original";
#elif SOURCE_ENGINE == SE_DARKMESSIAH
return "darkmessiah";
#elif SOURCE_ENGINE == SE_ORANGEBOX
return "orangebox";
#elif SOURCE_ENGINE == SE_BLOODYGOODTIME
return "bloodygoodtime";
#elif SOURCE_ENGINE == SE_EYE
return "eye";
#elif SOURCE_ENGINE == SE_CSS
return "css";
#elif SOURCE_ENGINE == SE_HL2DM
return "hl2dm";
#elif SOURCE_ENGINE == SE_DODS
return "dods";
#elif SOURCE_ENGINE == SE_TF2
return "tf2";
#elif SOURCE_ENGINE == SE_LEFT4DEAD
return "left4dead";
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
return "nucleardawn";
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
return "left4dead2";
#elif SOURCE_ENGINE == SE_ALIENSWARM
return "alienswarm";
#elif SOURCE_ENGINE == SE_PORTAL2
return "portal2";
#elif SOURCE_ENGINE == SE_CSGO
return "csgo";
#endif
}
static bool symbols_are_hidden()
{
#if (SOURCE_ENGINE == SE_CSS) || (SOURCE_ENGINE == SE_HL2DM) || (SOURCE_ENGINE == SE_DODS) || (SOURCE_ENGINE == SE_TF2) || (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_NUCLEARDAWN) || (SOURCE_ENGINE == SE_LEFT4DEAD2) || (SOURCE_ENGINE == SE_CSGO)
return true;
#else
return false;
#endif
}
static const char* get_core_config_value(const char* key)
{
return g_CoreConfig.GetCoreConfigValue(key);
}
static ServerGlobals serverGlobals;
static sm_core_t core_bridge =
{
/* Objects */
@@ -93,10 +225,15 @@ static sm_core_t core_bridge =
&g_SourceMod,
&g_LibSys,
reinterpret_cast<IVEngineServer*>(&logic_engine),
reinterpret_cast<IFileSystem*>(&logic_filesystem),
&g_ShareSys,
&g_RootMenu,
&g_PluginSys,
&g_Forwards,
&g_Timers,
&g_Players,
&g_Admins,
&g_HL2,
/* Functions */
add_natives,
find_convar,
@@ -105,15 +242,39 @@ static sm_core_t core_bridge =
log_error,
get_cvar_string,
UTIL_Format,
UTIL_ReplaceAll
generate_error,
gnprintf,
atcprintf,
get_game_name,
get_game_description,
get_source_engine_name,
symbols_are_hidden,
get_core_config_value,
&serverGlobals
};
void InitLogicBridge()
{
sm_logic_t logic;
serverGlobals.universalTime = g_pUniversalTime;
serverGlobals.frametime = &gpGlobals->frametime;
serverGlobals.interval_per_tick = &gpGlobals->interval_per_tick;
core_bridge.core_ident = g_pCoreIdent;
logic_init_fn(&core_bridge, &logic);
core_bridge.engineFactory = (void *)g_SMAPI->GetEngineFactory(false);
core_bridge.serverFactory = (void *)g_SMAPI->GetServerFactory(false);
ILibrary *mmlib;
char path[PLATFORM_MAX_PATH];
g_LibSys.PathFormat(path, sizeof(path), "%s/bin/matchmaking_ds%s.%s", g_SMAPI->GetBaseDir(), MATCHMAKINGDS_SUFFIX, MATCHMAKINGDS_EXT);
if ((mmlib = g_LibSys.OpenLibrary(path, NULL, 0)))
{
core_bridge.matchmakingDSFactory = mmlib->GetSymbolAddress("CreateInterface");
mmlib->CloseLibrary();
}
logic_init_fn(&core_bridge, &logicore);
/* Add SMGlobalClass instances */
SMGlobalClass* glob = SMGlobalClass::head;
@@ -122,10 +283,11 @@ void InitLogicBridge()
glob = glob->m_pGlobalClassNext;
}
assert(glob->m_pGlobalClassNext == NULL);
glob->m_pGlobalClassNext = logic.head;
glob->m_pGlobalClassNext = logicore.head;
g_pThreader = logic.threader;
g_pSourcePawn2->SetProfiler(logic.profiler);
g_pThreader = logicore.threader;
g_pSourcePawn2->SetProfiler(logicore.profiler);
translator = logicore.translator;
}
bool StartLogicBridge(char *error, size_t maxlength)
+8
View File
@@ -31,9 +31,17 @@
#ifndef _INCLUDE_SOURCEMOD_LOGIC_BRIDGE_H_
#define _INCLUDE_SOURCEMOD_LOGIC_BRIDGE_H_
#include "logic/intercom.h"
void InitLogicBridge();
bool StartLogicBridge(char *error, size_t maxlength);
void ShutdownLogicBridge();
struct sm_logic_t;
extern sm_logic_t logicore;
extern ITranslator *translator;
extern IGameConfig *g_pGameConf;
#endif /* _INCLUDE_SOURCEMOD_LOGIC_BRIDGE_H_ */
+95
View File
@@ -0,0 +1,95 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sourcemod_mm", "sourcemod_mm.vcxproj", "{E39527CD-7CAB-4420-97CC-DA1B93B260BC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CrazyDebug - Alien Swarm|Win32 = CrazyDebug - Alien Swarm|Win32
CrazyDebug - CS GO|Win32 = CrazyDebug - CS GO|Win32
CrazyDebug - Dark Messiah|Win32 = CrazyDebug - Dark Messiah|Win32
CrazyDebug - Episode 1|Win32 = CrazyDebug - Episode 1|Win32
CrazyDebug - Left 4 Dead 2|Win32 = CrazyDebug - Left 4 Dead 2|Win32
CrazyDebug - Left 4 Dead|Win32 = CrazyDebug - Left 4 Dead|Win32
CrazyDebug - Old Metamod|Win32 = CrazyDebug - Old Metamod|Win32
CrazyDebug - Orange Box Valve|Win32 = CrazyDebug - Orange Box Valve|Win32
CrazyDebug - Orange Box|Win32 = CrazyDebug - Orange Box|Win32
Debug - Alien Swarm|Win32 = Debug - Alien Swarm|Win32
Debug - CS GO|Win32 = Debug - CS GO|Win32
Debug - Dark Messiah|Win32 = Debug - Dark Messiah|Win32
Debug - Episode 1|Win32 = Debug - Episode 1|Win32
Debug - Left 4 Dead 2|Win32 = Debug - Left 4 Dead 2|Win32
Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32
Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
Debug - Orange Box Valve|Win32 = Debug - Orange Box Valve|Win32
Debug - Orange Box|Win32 = Debug - Orange Box|Win32
Release - Alien Swarm|Win32 = Release - Alien Swarm|Win32
Release - CS GO|Win32 = Release - CS GO|Win32
Release - Dark Messiah|Win32 = Release - Dark Messiah|Win32
Release - Episode 1|Win32 = Release - Episode 1|Win32
Release - Left 4 Dead 2|Win32 = Release - Left 4 Dead 2|Win32
Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32
Release - Old Metamod|Win32 = Release - Old Metamod|Win32
Release - Orange Box Valve|Win32 = Release - Orange Box Valve|Win32
Release - Orange Box|Win32 = Release - Orange Box|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Alien Swarm|Win32.ActiveCfg = CrazyDebug - Alien Swarm|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Alien Swarm|Win32.Build.0 = CrazyDebug - Alien Swarm|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - CS GO|Win32.ActiveCfg = CrazyDebug - CS GO|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - CS GO|Win32.Build.0 = CrazyDebug - CS GO|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Dark Messiah|Win32.ActiveCfg = CrazyDebug - Dark Messiah|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Dark Messiah|Win32.Build.0 = CrazyDebug - Dark Messiah|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.ActiveCfg = CrazyDebug - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.Build.0 = CrazyDebug - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead 2|Win32.ActiveCfg = CrazyDebug - Left 4 Dead 2|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead 2|Win32.Build.0 = CrazyDebug - Left 4 Dead 2|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead|Win32.ActiveCfg = CrazyDebug - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead|Win32.Build.0 = CrazyDebug - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.ActiveCfg = CrazyDebug - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.Build.0 = CrazyDebug - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box Valve|Win32.ActiveCfg = CrazyDebug - Orange Box Valve|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box Valve|Win32.Build.0 = CrazyDebug - Orange Box Valve|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box|Win32.ActiveCfg = CrazyDebug - Orange Box|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box|Win32.Build.0 = CrazyDebug - Orange Box|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Alien Swarm|Win32.ActiveCfg = Debug - Alien Swarm|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Alien Swarm|Win32.Build.0 = Debug - Alien Swarm|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - CS GO|Win32.ActiveCfg = Debug - CS GO|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - CS GO|Win32.Build.0 = Debug - CS GO|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Dark Messiah|Win32.ActiveCfg = Debug - Dark Messiah|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Dark Messiah|Win32.Build.0 = Debug - Dark Messiah|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.ActiveCfg = Debug - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.Build.0 = Debug - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead 2|Win32.ActiveCfg = Debug - Left 4 Dead 2|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead 2|Win32.Build.0 = Debug - Left 4 Dead 2|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead|Win32.ActiveCfg = Debug - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead|Win32.Build.0 = Debug - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.Build.0 = Debug - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box Valve|Win32.ActiveCfg = Debug - Orange Box Valve|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box Valve|Win32.Build.0 = Debug - Orange Box Valve|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box|Win32.ActiveCfg = Debug - Orange Box|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box|Win32.Build.0 = Debug - Orange Box|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Alien Swarm|Win32.ActiveCfg = Release - Alien Swarm|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Alien Swarm|Win32.Build.0 = Release - Alien Swarm|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - CS GO|Win32.ActiveCfg = Release - CS GO|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - CS GO|Win32.Build.0 = Release - CS GO|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Dark Messiah|Win32.ActiveCfg = Release - Dark Messiah|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Dark Messiah|Win32.Build.0 = Release - Dark Messiah|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.ActiveCfg = Release - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.Build.0 = Release - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead 2|Win32.ActiveCfg = Release - Left 4 Dead 2|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead 2|Win32.Build.0 = Release - Left 4 Dead 2|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead|Win32.ActiveCfg = Release - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead|Win32.Build.0 = Release - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Old Metamod|Win32.ActiveCfg = Release - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Old Metamod|Win32.Build.0 = Release - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box Valve|Win32.ActiveCfg = Release - Orange Box Valve|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box Valve|Win32.Build.0 = Release - Orange Box Valve|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box|Win32.ActiveCfg = Release - Orange Box|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box|Win32.Build.0 = Release - Orange Box|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
File diff suppressed because it is too large Load Diff
+493
View File
@@ -0,0 +1,493 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Interfaces">
<UniqueIdentifier>{10C69360-9E8E-4a43-BCEF-E9373B3641BC}</UniqueIdentifier>
</Filter>
<Filter Include="SourcePawn">
<UniqueIdentifier>{C3C3DC6E-E392-4916-B893-7ACB92192DE0}</UniqueIdentifier>
</Filter>
<Filter Include="HL2SDK">
<UniqueIdentifier>{80B56842-7A9F-4d5d-8149-767C285D0EB4}</UniqueIdentifier>
</Filter>
<Filter Include="Natives">
<UniqueIdentifier>{052D6D9B-7B50-4c3c-9B82-32CA908DEF24}</UniqueIdentifier>
</Filter>
<Filter Include="Resources">
<UniqueIdentifier>{2A750240-7C10-455f-A900-B9A9D362356C}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
<Filter Include="HL2SDK\Protobuf">
<UniqueIdentifier>{28cf0347-3553-4d24-b9ad-476ba5197680}</UniqueIdentifier>
</Filter>
<Filter Include="HL2SDK\Protobuf\CSGO">
<UniqueIdentifier>{0e62c72e-57b1-40d2-9a94-059f535ce719}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\AdminCache.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ADTFactory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\CDataPack.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ChatTriggers.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\concmd_cleaner.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ConCmdManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ConsoleDetours.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ConVarManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\CoreConfig.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\CrazyDebugger.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Database.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\DebugReporter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\EventManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ExtensionSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ForwardSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\frame_hooks.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\HalfLife2.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\HandleSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\LibrarySys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Logger.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\logic_bridge.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\MenuManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\MenuStyle_Base.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\MenuStyle_Radio.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\MenuStyle_Valve.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\MenuVoting.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\NativeInvoker.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\NativeOwner.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\NextMap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\PlayerManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\PluginInfoDatabase.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\PluginSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ShareSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\sm_autonatives.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\sm_srvcmds.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\sm_stringutil.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\sm_trie.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\sourcemm_api.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\sourcemod.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\TimerSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\UserMessages.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\smn_bitbuffer.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_console.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_core.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_database.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_entities.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_events.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_fakenatives.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_filesystem.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_halflife.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_hudtext.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_keyvalues.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_menus.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_nextmap.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_player.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_usermsgs.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_vector.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\..\..\hl2sdks\hl2sdk-csgo\public\game\shared\csgo\protobuf\cstrike15_usermessage_helpers.cpp">
<Filter>HL2SDK\Protobuf\CSGO</Filter>
</ClCompile>
<ClCompile Include="..\..\..\hl2sdks\hl2sdk-csgo\public\game\shared\csgo\protobuf\cstrike15_usermessages.pb.cc">
<Filter>HL2SDK\Protobuf\CSGO</Filter>
</ClCompile>
<ClCompile Include="..\..\..\hl2sdks\hl2sdk-csgo\public\engine\protobuf\netmessages.pb.cc">
<Filter>HL2SDK\Protobuf</Filter>
</ClCompile>
<ClCompile Include="..\smn_protobuf.cpp">
<Filter>Natives</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\AdminCache.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ADTFactory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\CDataPack.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\CellRecipientFilter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ChatTriggers.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\public\compat_wrappers.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\concmd_cleaner.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ConCmdManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ConCommandBaseIterator.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ConsoleDetours.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ConVarManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\CoreConfig.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Database.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\DebugReporter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\EventManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ExtensionSys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ForwardSys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\frame_hooks.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\HalfLife2.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\HandleSys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\LibrarySys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Logger.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\logic_bridge.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\MenuManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\MenuStyle_Base.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\MenuStyle_Radio.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\MenuStyle_Valve.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\MenuVoting.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\NativeInvoker.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\NativeOwner.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\NextMap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\PlayerManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\PluginInfoDatabase.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\PluginSys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ShareSys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sm_autonatives.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sm_fastlink.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sm_globals.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sm_memtable.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sm_queue.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sm_simple_prioqueue.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sm_srvcmds.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sm_stringutil.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sm_trie.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\public\sm_trie_tpl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\smn_usermsgs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sourcemm_api.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sourcemod.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\TimerSys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\UserMessages.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IAdminSystem.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IADTFactory.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IDataPack.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IDBDriver.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IExtensionSys.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IForwardSys.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IGameConfigs.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IGameHelpers.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IHandleSys.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\ILibrarySys.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IMemoryUtils.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IMenuManager.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\INativeInvoker.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IPlayerHelpers.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IPluginSys.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IRootConsoleMenu.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IShareSys.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\ISourceMod.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\ITextParsers.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\ITimerSystem.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\ITranslator.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\IUserMessages.h">
<Filter>Interfaces</Filter>
</ClInclude>
<ClInclude Include="..\..\public\sourcepawn\sp_file_headers.h">
<Filter>SourcePawn</Filter>
</ClInclude>
<ClInclude Include="..\..\public\sourcepawn\sp_typeutil.h">
<Filter>SourcePawn</Filter>
</ClInclude>
<ClInclude Include="..\..\public\sourcepawn\sp_vm_api.h">
<Filter>SourcePawn</Filter>
</ClInclude>
<ClInclude Include="..\..\public\sourcepawn\sp_vm_base.h">
<Filter>SourcePawn</Filter>
</ClInclude>
<ClInclude Include="..\..\public\sourcepawn\sp_vm_types.h">
<Filter>SourcePawn</Filter>
</ClInclude>
<ClInclude Include="..\convar_sm.h">
<Filter>HL2SDK</Filter>
</ClInclude>
<ClInclude Include="..\..\public\sm_platform.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\public\sourcemod_version.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\convar_sm_l4d.h">
<Filter>HL2SDK</Filter>
</ClInclude>
<ClInclude Include="..\convar_sm_ob.h">
<Filter>HL2SDK</Filter>
</ClInclude>
<ClInclude Include="..\convar_sm_swarm.h">
<Filter>HL2SDK</Filter>
</ClInclude>
<ClInclude Include="..\..\..\hl2sdks\hl2sdk-csgo\public\game\shared\csgo\protobuf\cstrike15_usermessage_helpers.h">
<Filter>HL2SDK\Protobuf\CSGO</Filter>
</ClInclude>
<ClInclude Include="..\..\..\hl2sdks\hl2sdk-csgo\public\game\shared\csgo\protobuf\cstrike15_usermessages.pb.h">
<Filter>HL2SDK\Protobuf\CSGO</Filter>
</ClInclude>
<ClInclude Include="..\..\..\hl2sdks\hl2sdk-csgo\public\engine\protobuf\netmessages.pb.h">
<Filter>HL2SDK\Protobuf</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resources</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Library Include="..\..\..\hl2sdks\hl2sdk-csgo\lib\win32\release\vs2010\libprotobuf.lib">
<Filter>HL2SDK\Protobuf</Filter>
</Library>
<Library Include="..\..\..\hl2sdks\hl2sdk-csgo\lib\win32\debug\vs2010\libprotobuf.lib">
<Filter>HL2SDK\Protobuf</Filter>
</Library>
</ItemGroup>
</Project>

Some files were not shown because too many files have changed in this diff Show More