Compare commits

..
Author SHA1 Message Date
Nicholas Hastings 255e2ef6f0 Merge branch '1.7-dev' of https://github.com/alliedmodders/sourcemod into 1.7-dev. 2015-05-30 08:06:56 -04:00
Nicholas Hastings 18f8d10f10 Update versioning for 1.7.2 release. 2015-05-30 08:06:23 -04:00
Nicholas Hastings a626005cc6 Update changelog for version 1.7.2. 2015-05-30 08:05:13 -04:00
Nicholas Hastings bf9c96b48f Fix sm_trigger_show default in shipped sourcemod.cfg match default in basetriggers. 2015-05-30 07:56:06 -04:00
Ruben Gonzalez dca2596788 Update more CS:GO gamedata. 2015-05-28 13:29:35 -04:00
David Anderson b491345d78 Fix continue in a loop body leaking heap-allocated variables. (bug 6370, r=fyren) 2015-05-27 10:33:07 -04:00
Ruben Gonzalez 8cb2fcdf65 Update CS:GO gamedata for latest update. 2015-05-26 21:53:44 -04:00
Nicholas Hastings f86c5e9940 Fix regression in admin-sql-threaded when porting to transitional syntax. 2015-05-18 13:22:34 -04:00
Ruben Gonzalez fd9dbded8b Trigger build. 2015-05-15 20:53:31 -04:00
Ruben Gonzalez 404cd28423 Trigger Build. 2015-05-15 18:30:35 -04:00
Ruben Gonzalez afaddda8cf Trigger Build 2015-05-15 15:51:46 -04:00
Asher Baker 6c7a6c72aa Correct NameHashSet::add() return type. 2015-05-09 11:56:15 +01:00
Asher Baker 97605a500c Remove check_thunks reliance on Tier0. 2015-05-07 21:56:31 +01:00
Kyle Sanderson 16b7c576d4 Merge pull request #330 from yedpodtrzitko/1.7-dev
Add IsFree check to FindEntityByNetClass in SDKTools.
2015-05-04 18:08:51 -07:00
yed_ f504188854 add IsFree check 2015-05-05 01:06:40 +01:00
Nicholas Hastings 8b2d7a1e49 Trigger build for hl2sdk-dota changes. 2015-05-03 15:08:03 -04:00
Nicholas Hastings b429c37ab3 Trigger build for hl2sdk-dota changes. 2015-05-03 10:05:53 -04:00
Nicholas Hastings 13cf293f1c Merge pull request #250 from alliedmodders/sdkhooks-newdecls
Convert remainder of sdkhooks.inc to newdecls (r=dvander).
2015-04-20 10:19:23 -07:00
Nicholas Hastings a2b9c91423 Roll version number. 2015-04-18 15:48:19 -04:00
Nicholas Hastings cf9aa05a0c Update versioning for 1.7.1 release. 2015-04-18 15:13:41 -04:00
Nicholas Hastings 824b0f9a3c Update changelog for version 1.7.1. 2015-04-18 09:58:37 -04:00
David Anderson f74e357e91 Merge pull request #288 from klausenbusk/patch-1
Updated KillTimer documentation to reflect "Invalid handles" = runtime error.
2015-04-18 09:41:30 -04:00
David Anderson 15b65468ac Fix bug where the compiler could crash trying to dereference a decayed accessor expression used as |this|. 2015-04-18 08:53:13 -04:00
David Anderson d64bcc763a Fix bug where complex |this| values could be corrupted while evaluating function arguments. (bug 6329) 2015-04-18 08:51:02 -04:00
Nicholas Hastings f4ff0e574c Fix CoreConfig init to happen after SMGlobalClasses from logic bin are added.
This fixes OnSourceModConfigChanged not being called for logic classes when
config is first read, matching behavior for core classes. The function is still called
before each class's OnSourceModStartup func.
2015-04-18 08:35:10 -04:00
Nicholas Hastings 4ffe11a235 Enable the "name %s" command blocking on CS:GO as well. 2015-04-17 04:51:24 -07:00
Nicholas Hastings fc2addf11e Merge pull request #313 from alliedmodders/set-client-name
Add SetClientName native.
2015-04-07 04:39:52 -07:00
Peace-Maker 491d24a028 Add missing debug info for multidimensional strings
new String:INVISIBLE[2][8];

Multidimensional arrays like this wouldn't get their debug info added to
the debug symbols table.
Bug: https://bugs.alliedmods.net/show_bug.cgi?id=6324

See Fyren's comment in the bug report.
This patch recursively checks the parent symbol of array dimensions
until it finds the top symbol and uses that to check for the compound
level.
This still allows for early exiting the loop when going out of scope.
2015-04-04 11:05:36 -04:00
Peace-Maker 9a26ae0526 Fix declaring variable on same line after array
int a[5], b;
b would get a size of |0| on the stack instead of a sizeof(cell_t).
Bug: https://bugs.alliedmods.net/show_bug.cgi?id=6335
2015-04-04 11:03:27 -04:00
Ryan Stecker 8f0067b3b4 Improve the diagnostic given when a function prototype doesn't match an existing definition. 2015-04-04 10:51:10 -04:00
Nicholas Hastings d68829d301 Fix build. 2015-04-04 10:26:11 -04:00
Nicholas Hastings a48d5bfe1f Add missing impl for File.ReadUint16. 2015-04-04 10:22:41 -04:00
Nicholas Hastings e54850e1f9 Add explicit return types to forwards missing them. 2015-04-04 10:21:34 -04:00
InstantMuffin fd4ac6312c Update functions.inc 2015-04-04 10:17:02 -04:00
Alexander Corn 3c95f191c4 Moved note about releasing resources from OnPluginStart to OnPluginEnd 2015-04-04 10:10:51 -04:00
Nicholas Hastings a523948ebb Make OpenDirectory error for empty path match error in DirExists. 2015-04-04 10:10:13 -04:00
Nicholas Hastings fc5149a1c7 Throw an error if DirExists called with empty path. 2015-04-04 10:10:07 -04:00
Nicholas Hastings 50399f25f4 Update TF2 gamedata. 2015-03-31 17:39:50 -04:00
Ruben Gonzalez 1552464465 Fix not being able to block CS_OnCSWeaponDrop and clarify include file. (bug 6334) 2015-03-29 18:39:38 -04:00
Dr!fter dd401e760c Fix more Freak Fortress gamedata. 2015-03-27 21:59:02 -04:00
Ruben Gonzalez 0c976cd1f0 Fix Fortress Forever gamedata. 2015-03-27 21:47:32 -04:00
Nicholas Hastings e5fb8984f4 Merge pull request #286 from peace-maker/noradiomenu_regression
Fix crash regression in games that don't support radio style menus (r=psychonic).
2015-03-21 18:46:56 -04:00
Ruben Gonzalez 57c993e17e Merge pull request #303 from alliedmodders/tf2_vstk_fix
Fix some TF2 natives not having the correct vstk size.
2015-03-14 09:51:08 -04:00
Ruben Gonzalez ec32f3cf2d Update TF2's MakeBleed native for the latest update. 2015-03-12 18:07:12 -04:00
Nicholas Hastings 3764881daa Trigger build for hl2sdk-dota changes. 2015-03-06 11:26:26 -05:00
Ryan Stecker 2754be4066 Fix tag mismatch warning when using SQLite_UseDatabase. (bug 6310) 2015-03-03 23:04:23 -05:00
Peace-Maker b52054de1e Fix crash in games that don't support radio style menus
Fix regression in ad7d920ce0
GetMenuStyleHandle(MenuStyle_Radio) crashes games, which don't support
the radio menu style. The style is never added to the menu manager, if
it's not supported, so GetMenuStyleHandle tries to call IsSupported on a
nullptr.
2015-03-01 18:48:30 +01:00
Nicholas Hastings 94c982f8cf Merge pull request #267 from 50Wliu/tf2_setclientteam
Add TF2_SetClientTeam to provide symmetry to TF2_GetClientTeam (r=psychonic).
2015-02-26 17:42:32 -05:00
Asher Baker 66b00d4ae7 Updated plugin blacklist. 2015-02-25 01:17:42 +00:00
Asher Baker 784f9f4993 Merge pull request #213 from splewis/find-array-nonzero-blocks
Add block parameter to FindValueInArray native.
2015-02-25 01:16:06 +00:00
Nicholas Hastings 6fb9e1b30e Fix Insurgency s_pTempEntities offset on Windows. 2015-02-22 20:09:03 -05:00
Nicholas Hastings 51c1e17717 Use new IVEngineServer::GetIServer to get IServer* on Insurgency. 2015-02-22 15:16:39 -05:00
Nicholas Hastings c911af4109 Update Insurgency Windows SDKTools gamedata. 2015-02-22 10:18:45 -05:00
Kyle Sanderson a67c54f0c0 Root Menu Handles during Display. 2015-02-21 17:36:08 -08:00
Nicholas Hastings a989a2b791 Trigger build for hl2sdk-dota changes. 2015-02-20 09:17:01 -05:00
Nicholas Hastings 68a1e89c24 Trigger build for hl2sdk-csgo changes. 2015-02-17 15:50:38 -05:00
Nicholas Hastings 289455d538 Trigger build (bug 6308). 2015-02-14 12:03:55 -05:00
Nicholas Hastings 4919e4a002 Roll version number. 2015-02-04 18:25:02 -05:00
Nicholas Hastings fd0aaf9da9 Update versioning for 1.7.0 release. 2015-02-04 17:33:14 -05:00
Nicholas Hastings 325e95e9be Update changelog for version 1.7.0. 2015-02-04 17:29:10 -05:00
Nicholas Hastings c2e31deb78 Sync changelog from 1.6-dev branch. 2015-02-04 17:24:56 -05:00
David Anderson c944ef18b3 Remove sizeof() as a special-case default argument value. 2015-02-04 17:18:11 -05:00
Nicholas Hastings 14af0bae82 Fix crash when creating and destroying a TopMenu without map change (bug 6303). 2015-02-04 17:15:03 -05:00
Nicholas Hastings efba7bd82a Expose Message_DetermineMulticastRecipients as GetClientsInRange native. 2015-02-03 14:40:15 -05:00
Nicholas Hastings 6da2f6c8ed Fix FindFlagChar not finding char for AdminFlag_Custom6. 2015-02-03 12:42:08 -05:00
Nicholas Hastings 9e6f7a9e89 Fix g_ReverseFlags array size. 2015-02-03 12:41:43 -05:00
Nicholas Hastings d0ab3e7bd6 Rename g_FlagSet to g_FlagCharSet to avoid some confusion. 2015-02-03 12:41:14 -05:00
Ruben Gonzalez a6d5212ee9 Initial CSGO GetWeaponPrice fixes 2015-02-01 12:12:31 -05:00
David Anderson 79bb037b66 Don't special case hierarchy-free enumeration constants when used as array indices. (bug 6302) 2015-01-31 22:12:59 -08:00
David Anderson ea3f491a8e Fix chained field expressions losing lvalue-ness. (bug 6298) 2015-01-31 22:12:58 -08:00
Thordin aa27b10232 Increased handles to 32k 2015-01-31 22:12:57 -08:00
David Anderson 1ebf70b450 Fix wrong value in transitional DBI callback. (bug 6292) 2015-01-31 22:12:57 -08:00
Nicholas Hastings 3a499036ac Fix incorrect error line show for incorrect return value on forwards (bug 6226). 2015-01-28 14:46:56 -05:00
Nicholas Hastings 6b92f18a86 Don't allow plugins to block LevelInit (wtf). 2015-01-28 14:46:46 -05:00
Kyle Sanderson 60757dde1c Establish a default timeout for MySQL connectivity. 2015-01-23 22:58:06 -08:00
Nicholas Hastings d5fc57316e Update protobuf include path for Dota build. 2015-01-21 11:11:56 -05:00
Ryan Stecker 1b47398e38 Prevent null auth string comparisons. 2015-01-19 07:49:27 -05:00
Nicholas Hastings 70f42dee65 Fix regression causing "BOT" to no longer be valid in adminsys for Steam identities. 2015-01-17 16:17:43 -05:00
Simone 08db476476 Add missing semicolon. 2015-01-17 16:17:33 -05:00
Ryan Stecker b1353e2ca4 Use BfRead or Protobuf tags in umsg hook callbacks, rather than a generic Handle. 2015-01-17 16:17:22 -05:00
Nicholas Hastings 6be9c770fe Add PlayerRunCommand gamedata for Dark Messiah. 2015-01-11 11:45:49 -05:00
Nicholas Hastings 83a77bca08 Fix ICommandLine not being found in Dark Messiah. 2015-01-11 11:45:43 -05:00
Nicholas Hastings 1ff913c38f Trigger build for hl2sdk-dota update. 2015-01-09 09:07:46 -05:00
Nicholas Hastings 5383a0596a Update TF2 gamedata. 2015-01-07 14:09:59 -05:00
Asher Baker a81776f92c Fix threads leaking if they're not joined. (bug 3460, r=dvander) 2015-01-06 20:30:17 +00:00
David Anderson bcef7365b0 Fix uninitialized variable in decl_enum(). 2015-01-04 12:17:13 -08:00
David Anderson 9e882783f9 Allow "stock static" in addition to "static stock". 2015-01-04 12:17:00 -08:00
David Anderson 00a663c1a3 Remove some heinous preprocessor directives.
Gone:
 - #emit (bah-roken!)
 - #pragma compress (useless)
 - #pragma library (useless)
2015-01-04 12:16:47 -08:00
Nicholas Hastings 5c047ad04b Fix ArrayList.Clear func name. 2015-01-04 12:29:48 -05:00
Nicholas Hastings 5e64de198a Fix typo on ArrayList.Erase native. 2015-01-04 11:59:07 -05:00
David Anderson b92e4ff688 Fix typos in dbi.inc transitional syntax. 2015-01-03 15:01:44 -05:00
Peace-Maker 224d54aadd Fix missing params in OnTakeDamagePost typedef
Looks like the |weapon| parameter went missing during the switch to the
transitional syntax.

There was no -Post typedef including the |damagecustom| bit at all too.
2015-01-03 15:01:27 -05:00
Nicholas Hastings bcc6581c1c Don't looks for IServerTools on ep1 games.
(We don't use it and it doesn't exist on most.)
2015-01-01 16:45:54 -05:00
Nicholas Hastings 68c752bf6d Fix SDKHooks causing crash on plugin load/unload or player connect/disconnect if missing gamedata. 2014-12-30 21:09:32 -05:00
Nicholas Hastings a0bfda89d8 Make EntInfo offset in SDK2013 gamedata apply to all SDK2013 games. 2014-12-30 17:16:27 -05:00
Nicholas Hastings 55cadc7738 Change sm_trigger_show default value to 0 / disabled. 2014-12-29 08:56:58 -08:00
Nicholas Hastings 4d9e94373f Revert "Disable FireOutput detour on Windows for Dota for now."
This reverts commit 516c140810.
2014-12-24 11:01:45 -05:00
Nicholas Hastings 516c140810 Disable FireOutput detour on Windows for Dota for now. 2014-12-24 10:38:16 -05:00
Peace-Maker 6cfced238c Don't unpack mysql verbosely
I doubt we're interested in the filename of every single file
contained in the mysql archive when it's decompressed.

It bloats up the travis build log.
2014-12-23 09:03:22 -05:00
FlaminSarge 27c73d4e3e Denote TFCond multiples of 32 consistently 2014-12-23 09:00:53 -05:00
FlaminSarge 4818aee7b9 Update TFCond enum for Mannpower 2014-12-23 09:00:47 -05:00
Nicholas Hastings 65f52a3cad Update TF2 gamedata. 2014-12-22 17:31:10 -05:00
Nicholas Hastings 49a568bd59 Disable nextmap on Insurgency. 2014-12-20 23:00:48 -05:00
Nicholas Hastings 1575ddb3f3 Move bot auth to after connect to fix old too-early-authid bug now causing crash (r=VoiDeD). 2014-12-19 18:28:08 -05:00
Nicholas Hastings f9cdc421c3 Trigger build. 2014-12-18 05:10:03 -08:00
Nicholas Hastings 7304747f79 Merge pull request #222 from alliedmodders/auth-ogrekill
Don't recalculate Steam ID every frame when waiting for validated auth.
2014-12-17 20:41:22 -05:00
Nicholas Hastings 17fcd5a37f Merge pull request #223 from alliedmodders/zo
Change /d2Zi+ flag on msvc builds to /Zo.
2014-12-17 19:35:14 -05:00
David Anderson d413a6bd2f Merge pull request #227 from VoiDeD/newdecls-retag-warning
Old style retagging should emit a compiler warning when newdecls are required.
2014-12-17 15:30:08 -08:00
Ryan Stecker 154d84668b Old style retagging should emit a compiler warning when newdecls are required. 2014-12-17 16:37:39 -06:00
David Anderson 58194c5d99 Merge pull request #225 from powerlord/votecallback-fix
Add new-style API compatibility for VoteHandler.
2014-12-16 13:29:09 -08:00
Ross Bemrose 844fad263a Add new-style API compatibility for VoteHandler. 2014-12-16 16:06:20 -05:00
David Anderson e250eb66d1 Merge pull request #224 from VoiDeD/umsg-fix
Fix UserMessageToBfWrite and UserMessageToBfRead
2014-12-15 22:23:47 -08:00
Ryan Stecker 20ed5c338c Fix UserMessageToBfWrite and UserMessageToBfRead not working correctly for non-protobuf usermessages. 2014-12-15 23:07:53 -06:00
David Anderson b4199e5aa3 Merge pull request #221 from alliedmodders/tr-db
Transitional syntax support for DBI.
2014-12-14 18:37:53 -08:00
David Anderson b60ef1669c Update SQL plugins for transitional syntax. 2014-12-14 18:37:32 -08:00
Nicholas Hastings 7e8473b61a Remove /Zo on debug builds and add on release builds. 2014-12-14 16:03:42 -05:00
Nicholas Hastings ed87e048b4 Merge pull request #220 from alliedmodders/gamerules-no-gamedata
Fixup SDKTools to not require byte sig or symbol to get g_pGameRules (r=VoiDeD).
2014-12-14 15:29:14 -05:00
Nicholas Hastings 0d67bcc5ba Add null-check on serverclass in gamerules lookup. 2014-12-14 15:21:54 -05:00
Nicholas Hastings 03abafce3d Change /d2Zi+ flag on msvc builds to /Zo.
http://msdn.microsoft.com/en-us/library/dn785163.aspx
2014-12-14 14:59:16 -05:00
Nicholas Hastings 67fcd9e2c6 Populate auth ids (if available) when initializing CPlayer instance. 2014-12-14 14:56:19 -05:00
David Anderson bab1110bc0 Disallow coercion to/from char[] and any[]. 2014-12-14 02:00:58 -08:00
Nicholas Hastings d51a57cc34 In UpdatePlayerAuth, don't update SteamIDs if AuthID hasn't changed. 2014-12-13 19:40:22 -05:00
Nicholas Hastings de12f64c14 Convert CPlayer::m_AuthID to ke::AString. 2014-12-13 19:39:44 -05:00
David Anderson b1cb06c5ce Update DBI for transitional syntax. 2014-12-13 16:34:58 -08:00
Nicholas Hastings 88cb74213c Add support for getting g_pGameRules without a byte signature / symbol. 2014-12-13 16:35:32 -05:00
David Anderson 5a814c40b3 Merge pull request #207 from alliedmodders/tr-menus
Update menu transitional syntax.
2014-12-13 13:29:52 -08:00
David Anderson 1328984e0b Update plugins for transitional methods. 2014-12-13 13:29:15 -08:00
David Anderson 722a23c818 Redo menu methodmaps. 2014-12-13 12:53:30 -08:00
David Anderson 5959d6ed54 Merge pull request #198 from alliedmodders/tr-events
Port events to transitional syntax.
2014-12-13 12:51:58 -08:00
David Anderson 28eb663f9b Port events to transitional syntax. 2014-12-13 12:51:16 -08:00
Nicholas Hastings 939b10bd8e Refactor SDKTools to not expose gamerules ptr ptr outside of vglobals.cpp. 2014-12-13 15:48:51 -05:00
David Anderson b607bfeca9 Reserve 'builtin' as a keyword. 2014-12-12 21:29:28 -08:00
David Anderson f9d92b0eba Merge pull request #219 from alliedmodders/static-methods
Add support for static methods on methodmaps.
2014-12-12 12:24:28 -08:00
David Anderson 61bf7de101 Revert adminmenu API changes. 2014-12-12 10:10:46 -08:00
David Anderson 5b69efe5d4 Add static method support to methodmaps. 2014-12-12 10:10:46 -08:00
David Anderson afeae84340 Replace symbol proxies with type symbols.
Proxies were rather hacky and complicated, and only existed as a
workaround for oddities with constructors. This patch replaces them with
actual type symbols, a very tiny step to semantically getting rid of tags.

This greatly simplifies how we implement constructors, and paves the way
for using methodmap symbols in field expressions.

Since non-value symbols are new to spcomp1, we place a rather
pigeonholed check into primary() to make sure non-value symbols don't
escape into expressions.
2014-12-12 10:10:43 -08:00
Nicholas Hastings 46d620cb6a Merge pull request #217 from alliedmodders/tf2-holidayvars
Convert TFHoliday values to pubvars.
2014-12-10 08:31:15 -05:00
David Anderson 0295f817b8 Allow int: and void: tags, but warn. 2014-12-10 02:36:30 -08:00
David Anderson 18cc1b414b Fix some compile errors in new-style includes. 2014-12-10 02:12:53 -08:00
David Anderson a9e252314d Use typeset in sdkhooks.inc. 2014-12-10 01:13:08 -08:00
Kyle Sanderson bc4081718b Merge pull request #218 from KyleSanderson/damageeeee
Return the 'e' to OnTakeDamagAlive comment.
2014-12-09 23:20:20 -08:00
David Anderson 1ee3067575 Gracefully error on newly reserved keywords. 2014-12-09 23:18:11 -08:00
David Anderson 94bed806fe Reserve many keywords. 2014-12-09 23:04:13 -08:00
David Anderson 9c98edd104 Rename "union" semantics to "typeset". 2014-12-09 22:36:42 -08:00
Kyle Sanderson 0375aedd47 Return the 'e' to OnTakeDamagAlive comment. 2014-12-09 22:21:46 -08:00
Nicholas Hastings 09060c265f Convert TFHoliday values to pubvars. 2014-12-09 20:21:24 -05:00
Ruben Gonzalez 8a8917ba2e Update TF2 gamedata. 2014-12-08 20:26:14 -05:00
Nicholas Hastings 25859e29ca Merge pull request #211 from Bara20/patch-1
Fix warning in files.inc (r=psychonic).
2014-12-02 08:20:02 -05:00
Bara a91d5bf754 Fix warning in files.inc 2014-12-02 03:35:56 +01:00
David Anderson 68e0645813 Add a view_as operator. 2014-11-30 19:08:25 -08:00
David Anderson cb4fdf1aa9 Update plugins for new syntax. 2014-11-30 18:57:38 -08:00
David Anderson 157549e119 Fix a bug where aliased constructors of nullable methodmaps could not be used. 2014-11-30 18:56:37 -08:00
David Anderson 9f5c8b60ae Add a "new" keyword for constructing nullable methodmaps. 2014-11-30 18:38:26 -08:00
Nicholas Hastings e7e43e38a5 Merge pull request #210 from alliedmodders/more-clientprefs-newauth
Fix clientprefs IsAuthIdConnected (again) (r=asherkin).
2014-11-26 18:55:57 -05:00
Nicholas Hastings 19f2f46655 Update PVKII gamedata. 2014-11-25 10:13:37 -05:00
Asher Baker 50898d7a4f Merge pull request #208 from asherkin/long-lang-codes
Support long key names for languages (bug 6282)
2014-11-24 19:07:18 +00:00
Asher Baker ced026cecc Support long key names for languages. (bug 6282) 2014-11-22 22:18:49 +00:00
David Anderson 62c243f0a5 Fix reading the wrong symbol name when throw argument errors. 2014-11-22 12:23:57 -08:00
Nicholas Hastings b0ceac9d74 Fix clientprefs IsAuthIdConnected (again). 2014-11-22 10:00:40 -08:00
David Anderson 673ff572c5 Disallow retagging enums or using implicit-int as an enum tag. 2014-11-20 19:30:22 -08:00
Nicholas Hastings f573bdf784 Merge pull request #209 from splewis/master
Add missing convars.inc to buildbot package script (r=psychonic).
2014-11-20 06:33:02 -05:00
Sean Lewis b7036de9e9 Add missing convars.inc to buildbot package script. 2014-11-20 03:01:46 -06:00
David Anderson 08388de7dd Merge pull request #199 from alliedmodders/tr-convars
Port ConVars to transitional syntax.
2014-11-19 22:38:56 -08:00
David Anderson be6da2f810 Merge pull request #173 from alliedmodders/tr-smc
Port SMC parsing API to transitional syntax.
2014-11-19 22:38:19 -08:00
Nicholas Hastings f38fd6a550 Merge pull request #205 from alliedmodders/tf2condex3
Add support for TF2 player conditions above >= 96 (r=asherkin).
2014-11-19 17:15:56 -05:00
David Anderson 0511543c76 Merge pull request #206 from alliedmodders/tr-files
Port files.inc to transitional syntax.
2014-11-18 18:56:07 -08:00
Nicholas Hastings db434acd27 Fix typo in CPlayer::GetSteam3Id doing length check on wrong var. 2014-11-16 10:07:08 -05:00
Nicholas Hastings 50400cf029 Remove unused variables. 2014-11-15 19:35:47 -05:00
Nicholas Hastings b85f4d776e Merge pull request #204 from alliedmodders/more-clientprefs-newauth
Fix SetAuthIdCookie's IsAuthIdConnect function's issues with mixed authid types (r=asherkin).
2014-11-15 19:35:13 -05:00
David Anderson 79143d8b6e Port files.inc to transitional syntax. 2014-11-15 13:42:28 -08:00
David Anderson f25953bb6c Merge pull request #187 from alliedmodders/tr-arrays
Update ArrayList for transitional syntax.
2014-11-15 13:04:29 -08:00
David Anderson 461dc3af3d Merge pull request #189 from alliedmodders/tr-tries
Port string maps to transitional syntax.
2014-11-15 12:52:37 -08:00
David Anderson 5e362ec169 Merge branch 'tr-bitbuf' 2014-11-15 12:49:39 -08:00
David Anderson e46d5d211d Merge pull request #196 from alliedmodders/tr-protobuf
Add transitional syntax support for Protobuf natives.
2014-11-15 12:47:46 -08:00
David Anderson 758a7c955c Merge pull request #188 from alliedmodders/tr-stack
Port adt_stack to transitional syntax.
2014-11-15 12:47:21 -08:00
David Anderson 4cb29eb054 Port adt_stack to transitional syntax. 2014-11-15 12:46:17 -08:00
Nicholas Hastings d3a4c972e2 Add static_assert on ConBitVecAndNot hack so it gets updated on next cond count change. 2014-11-15 11:31:18 -05:00
Nicholas Hastings 1cf43b4ec2 Fix off-by-one error with FindNextSetBit in cond checks. 2014-11-15 11:22:43 -05:00
Nicholas Hastings a369d51f23 Merge pull request #183 from powerlord/tf2-halloween-2014
New Halloween 2014 conditions (r=psychonic).
2014-11-15 10:12:48 -05:00
Nicholas Hastings 849df7895b Update TF2 extension for new m_nPlayerCondEx3 player conditions field. 2014-11-15 10:08:07 -05:00
Nicholas Hastings ea86eee74e Fix SetAuthIdCookie's IsAuthIdConnect function's issues with mixed auth id types. 2014-11-15 09:34:49 -05:00
Nicholas Hastings f42a1fe0e4 Merge pull request #201 from DoctorMcKay/tf2-getclientteam
Added TF2_GetClientTeam stock (r=psychonic).
2014-11-15 08:06:27 -05:00
Nicholas Hastings 5a9b5e5e21 Update CS:GO gamedata. 2014-11-12 04:36:18 -08:00
Alexander Corn 1562530cdd Added TF2_GetClientTeam stock
Also fixed some weird spacing and language in doc comments
2014-11-11 02:23:44 -05:00
Asher Baker 93470fbdc6 Merge pull request #190 from asherkin/emscripten-asm-fix
Use GCC builtins for bsr/bsf where available.
2014-11-11 00:15:17 +00:00
Ross Bemrose f55bc6719d Add condition 87 back. 2014-11-10 14:44:26 -05:00
Nicholas Hastings d6533e3219 Merge pull request #192 from alliedmodders/no-random-iface
Use directly-exported random functions on vstdlib rather than IUniformRandomStream (r=dvander).
2014-11-10 13:26:12 -05:00
David Anderson cfa0d9341e Remove handling of class pseudokeyword since there is no C++ API to use it. 2014-11-09 18:12:30 -08:00
David Anderson 2cfe54f34b Port BitBuffers to transitional syntax. 2014-11-09 16:56:50 -08:00
David Anderson 4a66b67d81 Port remaining .sp files. 2014-11-09 16:52:06 -08:00
David Anderson 110440988d Port gag.sp. 2014-11-09 16:37:07 -08:00
David Anderson 4a14b776db Port basecomm.sp. 2014-11-09 16:35:52 -08:00
David Anderson fb5b552f86 Port basecommands.sp. 2014-11-09 16:35:45 -08:00
David Anderson 614fa86311 Port basechat.sp. 2014-11-09 16:31:17 -08:00
David Anderson 9980930dff Port antiflood. 2014-11-09 16:30:41 -08:00
David Anderson e68c228a36 Port basevotes.sp. 2014-11-09 16:29:44 -08:00
David Anderson 8fd0cbecf7 Port funvotes.sp. 2014-11-09 16:28:03 -08:00
David Anderson c425305cde Port mapchooser. 2014-11-09 16:25:52 -08:00
David Anderson 59fbeb4f2c Port nominations. 2014-11-09 16:11:36 -08:00
David Anderson d68eea6dea Port randomcycle. 2014-11-09 16:10:31 -08:00
David Anderson 86d4cdc0c4 Port rockthevote. 2014-11-09 16:10:25 -08:00
David Anderson 16330d1c4c Port reservedslots. 2014-11-09 16:10:13 -08:00
David Anderson 65dfd3cdd1 Add C++ definitions. 2014-11-09 15:39:13 -08:00
David Anderson 9886eea487 Use new-style. 2014-11-09 15:09:46 -08:00
David Anderson affff9eeb7 Move ConVar API into its own include. 2014-11-09 15:02:42 -08:00
David Anderson 6b714dafe3 Add transitional syntax support for Protobuf natives. 2014-11-09 14:19:16 -08:00
David Anderson 801b7ec9e2 Merge pull request #194 from alliedmodders/keyword-this
Define 'this' as a keyword.
2014-11-09 13:09:22 -08:00
David Anderson 4bc7b9243a Define 'this' as a keyword. 2014-11-09 13:01:35 -08:00
David Anderson 8479c2f067 Port SMC parsing API to transitional syntax. 2014-11-09 12:33:07 -08:00
David Anderson 53a1dbdafd Merge pull request #193 from alliedmodders/rm-assert-macro
Remove use of macros in mapchooser.
2014-11-09 12:14:35 -08:00
David Anderson 4802d4bae2 Remove use of macros in mapchooser. 2014-11-09 12:13:52 -08:00
David Anderson 6e045ef43c Merge pull request #191 from alliedmodders/inc-fixups
Fix some syntax errors in include files.
2014-11-09 11:25:59 -08:00
Nicholas Hastings f3fcdeda9d Use directly-exported random functions on vstdlib rather than IUniformRandomStream. 2014-11-09 10:59:10 -05:00
David Anderson c37174cb97 Fix some syntax errors in include files. 2014-11-09 02:03:09 -08:00
David Anderson 22df518ab5 Fix a bug where local dynamic array declarations could be mistakenly parsed as old decls (bug 6280). 2014-11-09 00:15:09 -08:00
David Anderson c228be83d6 Revert "Fix a bug where local dynamic array declarations could be mistakenly parsed as old decls."
This reverts commit 046f167b6e.
2014-11-09 00:15:00 -08:00
David Anderson 046f167b6e Fix a bug where local dynamic array declarations could be mistakenly parsed as old decls (bug 6279). 2014-11-09 00:12:44 -08:00
David Anderson 099f299113 Fix trailing commas in array literals changing the result of sizeof(). 2014-11-08 23:15:23 -08:00
David Anderson 4c377f21f9 Mark symbols as read when using sizeof(). 2014-11-08 20:45:43 -08:00
David Anderson 704e9579f7 Fix comparisons of derived tags (bug 6239). 2014-11-08 20:27:39 -08:00
Asher Baker 686cf9c5ba Use GCC builtins for bsr/bsf where available. 2014-11-09 04:15:49 +00:00
David Anderson 7609d19e32 Fix bug where bad carriage returns mess up line endings. 2014-11-08 18:04:45 -08:00
David Anderson 6ba4bcb955 Port string maps to transitional syntax. 2014-11-08 17:43:28 -08:00
David Anderson 3cc5c198b4 Allow dynamic char arrays. 2014-11-08 17:39:43 -08:00
David Anderson 919a31df57 Update ArrayList for transitional syntax. 2014-11-08 16:31:33 -08:00
David Anderson cd0ac3ae37 Merge pull request #185 from powerlord/tr-event
Update events.inc to Transitional syntax.
2014-11-08 15:56:20 -08:00
David Anderson 17b9ee91e6 Merge pull request #177 from alliedmodders/tr-keyvalues
Port KeyValues to the transitional syntax.
2014-11-08 15:54:58 -08:00
David Anderson f020b5682e Port KeyValues to the transitional syntax. 2014-11-08 15:54:40 -08:00
David Anderson 78687080b1 Merge pull request #178 from alliedmodders/fs-redux
Simplify filesystem natives.
2014-11-08 15:46:10 -08:00
David Anderson f16501d34a Simplify filesystem native implementation. 2014-11-08 15:44:35 -08:00
David Anderson 3c13c87f1c Merge pull request #186 from alliedmodders/fix-arrays
Define post-fix arrays as determinate and pre-fix arrays as indeterminate.
2014-11-08 12:08:56 -08:00
Nicholas Hastings b7c4faf063 Merge pull request #169 from alliedmodders/vfsdir-fixes
Fixes for OpenDirectory with use_valve_fs (r=asherkin).
2014-11-08 13:19:54 -05:00
Nicholas Hastings 0d24804839 Merge pull request #174 from alliedmodders/eliminate-more-gamedata
Eliminate the need for more gamedata on some games (r=asherkin).
2014-11-08 12:52:53 -05:00
David Anderson dbee1bcd08 Add an error check after calling doexpr2(). 2014-11-08 03:07:34 -08:00
David Anderson 512cbc73a0 Fix a loophole with static local variables. 2014-11-08 02:54:29 -08:00
David Anderson 039572060e Add new dynamic array syntax. 2014-11-08 02:48:13 -08:00
David Anderson f08e53f5d2 Make sizeof on indeterminate arrays an error. 2014-11-08 02:07:43 -08:00
David Anderson 6d507ceb27 Add a special case for assigning a string literal to a char array. 2014-11-08 02:04:11 -08:00
David Anderson 70e095f320 Define post-fix arrays as determinate and pre-fix arrays as indeterminate. 2014-11-07 22:39:00 -08:00
David Anderson a8796543af Use symbols for fatal errors and bump them by 20 slots. 2014-11-07 17:41:33 -08:00
David Anderson 2c31b99ce3 Move is_new and has_postdims bits out of declinfo and into typeinfo. 2014-11-07 17:05:27 -08:00
Ross Bemrose 9175c081ee Changed all the char something[] to char[] something as per dvander's comments. 2014-11-07 19:13:46 -05:00
David Anderson b89bd36335 Merge pull request #184 from powerlord/sminc-pragma-newdecls-forward-fix
Add return types to OnPluginEnd, OnPluginPauseChange, and OnGameFrame.
2014-11-07 14:27:21 -08:00
Ross Bemrose 3579977b28 Added missing SetBroadcast to Event methodmap. 2014-11-07 16:47:20 -05:00
Ross Bemrose 21ea3c03b5 Something was throwing fits when those were Event earlier. 2014-11-07 16:30:29 -05:00
Ross Bemrose e7ec41e872 Fix timers.inc's OnMapTimeLeftChanged forward while I'm at it. 2014-11-07 16:01:50 -05:00
Ross Bemrose b76c948c95 Update condition names. Remove condition 87 for now. 2014-11-07 15:44:03 -05:00
Ross Bemrose 159f2c8335 Add return types to OnPluginEnd, OnPluginPauseChange, and OnGameFrame 2014-11-07 15:22:49 -05:00
Ross Bemrose 66bfd126b2 Initial pass for converting events.inc. 2014-11-07 14:35:45 -05:00
Ross Bemrose e7f6a99087 New Halloween 2014 conditions. 2014-11-07 11:16:26 -05:00
Nicholas Hastings 89e7d1c45c Merge pull request #181 from powerlord/tf2-holiday-spyvengy
New Holiday as per Halloween update (r=psychonic).
2014-11-06 06:48:05 -05:00
David Anderson b2e957db83 Merge pull request #182 from powerlord/tr-convar
Transitional syntax support for ConVars.
2014-11-05 23:12:41 -08:00
Ross Bemrose 67f9069382 Updated the named with the ones bailopan suggested. 2014-11-05 16:34:04 -05:00
Ross Bemrose 3fff07b33d Changed ConVarChanged to take a ConVar variable. Backwards compatible with Handle variables (I tested this to make sure). 2014-11-05 15:50:03 -05:00
Ross Bemrose 87a21c7ff8 Add HookChange and UnhookChange to ConVar. 2014-11-05 15:26:03 -05:00
Asher Baker a463ed5cf2 Updated IDA scripts for 6.5. 2014-11-05 16:37:12 +00:00
Ross Bemrose 0f9d2203a4 New Holiday as per Halloween update. 2014-11-05 11:01:04 -05:00
Ross Bemrose 89f6e4736f Merge branch 'master' of https://github.com/alliedmodders/sourcemod into tr-convar 2014-11-05 10:43:28 -05:00
Nicholas Hastings 04578dfee9 Merge pull request #180 from VoiDeD/tf2-gd-nov4-2014
Update MakeBleed signature.
2014-11-04 20:25:50 -05:00
Ryan Stecker 7f36ef65a9 Update MakeBleed signature. 2014-11-04 19:09:10 -06:00
Ross Bemrose 286d484207 Rearrange order of methods in methodmap. Add missing Reset method to methodmap. 2014-10-31 17:21:37 -04:00
Ross Bemrose cdc2b11a09 Add a ConVar class. 2014-10-31 17:06:42 -04:00
Nicholas Hastings c7109ca651 Merge pull request #170 from alliedmodders/tr-datapack
Add transitional syntax support for datapack.inc (r=dvander).
2014-10-31 08:49:12 -04:00
David Anderson 8c8d9b072a Fix more line-endings. 2014-10-30 21:30:12 -07:00
David Anderson 9c6c0f37ed Fix line-endings. 2014-10-30 21:25:23 -07:00
David Anderson 613b06f6c0 Improve error messages when we can't find a typeexpr on a method. 2014-10-30 21:15:48 -07:00
David Anderson 97c3a2bc6e Fix a crash when we fail to parse a typexpr in a global declaration. 2014-10-30 21:09:10 -07:00
David Anderson 91a863c20c Merge pull request #171 from alliedmodders/ts-topmenus
Port TopMenus to transitional syntax.
2014-10-30 19:21:35 -07:00
David Anderson b97335ccb0 Port TopMenus to transitional syntax. 2014-10-30 19:20:33 -07:00
Nicholas Hastings 67d839e568 Merge pull request #176 from VoiDeD/tf2-gd-oct30-2014
Update TF2 gamedata.
2014-10-30 22:10:11 -04:00
Ryan Stecker 5484f35dfb Update CTFPlayerShared::Burn signature. 2014-10-30 21:08:30 -05:00
Ryan Stecker 749bf80bcb Update TF2 vfunc gamedata. 2014-10-30 21:07:21 -05:00
David Anderson 0a545b12a4 Merge pull request #175 from alliedmodders/allow-any
Allow any in new-style natives.
2014-10-30 17:50:45 -07:00
David Anderson eaff5c9364 Allow any in new-style natives. 2014-10-30 17:19:01 -07:00
Nicholas Hastings f0dd129344 Eliminate need for FindEntityByClassname gamedata on sdk2013 and soon css/dods/hl2dm (already on tf2). 2014-10-30 19:25:26 -04:00
Nicholas Hastings 749701014d Eliminate need for sv gamedata on sdk2013 and soon css/dods/hl2dm (already on tf2). 2014-10-30 19:25:13 -04:00
Nicholas Hastings 10cee734dc Eliminate need for s_pTempEnts gamedata on sdk2013 and soon css/dods/hl2dm (already on tf2). 2014-10-30 19:24:53 -04:00
Nicholas Hastings 72c18cc3d9 Missing changes from last commit 2014-10-30 19:24:00 -04:00
Nicholas Hastings 350dd2ebc7 Eliminate need for gEntList gamedata on tf2/sdk2013 and soon dods/css/hl2dm. 2014-10-30 19:23:27 -04:00
Nicholas Hastings 5d78a5ff93 Fix Fistful of Frags Weapon_GetSlot offset. 2014-10-30 17:31:52 -04:00
Nicholas Hastings c15470b583 Update more Insurgency gamedata. 2014-10-30 17:31:23 -04:00
Nicholas Hastings e5eb291b67 Update Insurgency gamedata. 2014-10-30 04:34:36 -07:00
Nicholas Hastings 7ddced67cb Update NMRiH gamedata. 2014-10-30 06:54:09 -04:00
David Anderson a7303568d6 Merge pull request #172 from alliedmodders/fix-setters
Fix a crash when properties have setters but not getters.
2014-10-29 23:09:23 -07:00
David Anderson e7fc06910b Fix a crash when properties have setters but not getters. 2014-10-29 20:51:03 -07:00
Nicholas Hastings 86ddf1fea0 Revert accidental reverting of tf-regex merge. 2014-10-29 20:51:34 -04:00
Nicholas Hastings c9696ca230 Merge branch 'master' of https://github.com/alliedmodders/sourcemod 2014-10-29 20:23:41 -04:00
Nicholas Hastings 4dcc1590bb Update TF2 gamedata. 2014-10-29 20:21:20 -04:00
Nicholas Hastings 585786b465 Fix inconsistent spacing in methodmap decl. 2014-10-28 14:20:34 -04:00
David Anderson 3ec1b3a271 Merge pull request #168 from alliedmodders/tr-regex
Add transitional syntax support for regex.inc.
2014-10-28 11:19:02 -07:00
Nicholas Hastings de045b5ab6 Add transitional syntax support for datapack.inc. 2014-10-28 14:06:11 -04:00
Nicholas Hastings 9021b23bc2 Fix crash on OpenDirectory with use_valve_fs if path not found.
Also fixes minor memory leak on bad path.
2014-10-28 13:57:40 -04:00
Nicholas Hastings dca15ebabf Fix OpenDirectory with use_valve_fs requirement of trailing slash. 2014-10-28 13:53:27 -04:00
David Anderson 5874709407 Add transitional syntax support for regex.inc. 2014-10-27 22:05:37 -07:00
Nicholas Hastings ba0d41a69d Update Fistful of Frags gamedata. 2014-10-24 17:17:07 -04:00
David Anderson 76d26044f6 Fix build. 2014-10-21 21:51:15 -07:00
David Anderson 75335dbef3 Merge pull request #156 from Bara20/patch-2
Fix undefined symbol: clock_gettime.
2014-10-21 12:42:18 -07:00
David Anderson 6bd1285d66 Merge pull request #164 from VoiDeD/sp-commandline
Expose ICommandLine to plugins.
2014-10-21 12:25:51 -07:00
Nicholas Hastings f8ffe23c6e Merge pull request #162 from alliedmodders/steam3-bans
Allow Steam IDs in Steam3 format for sm_addban (r=asherkin).
2014-10-20 21:14:54 -04:00
Nicholas Hastings 77dc5ac7ed Fix build. 2014-10-14 17:47:44 -04:00
Nicholas Hastings 37c29775d4 Fix OnTakeDamage_Alive gamedata lookup in SDKHooks. 2014-10-14 17:36:55 -04:00
Ruben Gonzalez 5ce46e1537 Update windows CS:GO CheckWinLimit signature 2014-10-10 19:24:20 -04:00
Ryan Stecker a580f8c270 Whoops, forgot my hat. 2014-10-09 18:19:40 -05:00
Ryan Stecker d702371b15 Number -> Int, per recommendation. 2014-10-08 21:47:15 -05:00
Nicholas Hastings a3336b1dcf Fix typo causing compile error strcmp -> strncmp 2014-10-08 18:02:05 -07:00
Nicholas Hastings bba2a714a6 Merge pull request #163 from alliedmodders/admdump-crash
Fix crash on Windows when dumping admin cache to file (r=asherkin).
2014-10-08 20:53:11 -04:00
Nicholas Hastings 512fae4c25 Fix crash on Windows when dumping admin cache to file. 2014-10-08 17:31:02 -07:00
Nicholas Hastings d76f62b863 Allow Steam IDs in Steam3 format for sm_addban 2014-10-08 17:29:56 -07:00
Ryan Stecker 2aba6d9d42 Fix linux build. 2014-10-07 17:19:16 -05:00
Ryan Stecker f2a80e33fd Expose some of ICommandLine to plugins. 2014-10-07 16:16:02 -05:00
Nicholas Hastings ac96bb177a Merge pull request #157 from VoiDeD/getevent-defaults
Expose optional default values for the GetEvent* SP functions (r=psychonic)..
2014-10-05 09:14:30 -04:00
Nicholas Hastings 909d523da0 Trigger build for hl2sdk-tf2 changes. 2014-10-01 19:06:36 -04:00
Nicholas Hastings 02aad65d21 Trigger build for hl2sdk-tf2 changes. 2014-10-01 18:53:42 -04:00
Nicholas Hastings 0a9cabdecd Trigger build for hl2sdk-tf2 changes (bug 6259). 2014-09-26 08:31:15 -04:00
Nicholas Hastings 9eb1b3e73e Merge pull request #158 from VoiDeD/te-const-clients
Clients array in TE_Send should be const (r=psychonic).
2014-09-19 18:29:48 -04:00
Nicholas Hastings 0f6063af60 Re-add DBI query throttling (r=dvander). 2014-09-18 22:02:32 -04:00
David Anderson d4fb74ef9a Fix regression where duplicate function names were not an error. 2014-09-16 22:32:46 -07:00
Asher Baker 55a5c745d4 Updated plugin blacklist. 2014-09-16 10:47:21 +01:00
Ryan Stecker a80e049352 Clients array in TE_Send should be const. 2014-09-14 19:08:54 -05:00
Ryan Stecker 981ffdfc82 Fix linux build. 2014-09-13 03:13:33 -05:00
Ryan Stecker 3ffd4cd835 Expose optional default values for the GetEvent* SP functions. 2014-09-12 16:39:21 -05:00
Nicholas Hastings 570570f7a0 Fix regression causing inconsistencies in clientprefs auth id handling (r=VoiDeD). 2014-09-12 13:04:37 -07:00
Nicholas Hastings e72ff963f5 Fix regression in auth causing crash on L4D and newer (r=VoiDeD). 2014-09-12 12:02:45 -07:00
Ruben Gonzalez af273e8e66 Update linux CSGO gamedata 2014-09-12 12:26:27 -04:00
Nicholas Hastings a82dd5e0c3 Update CS:GO linux ClanTagOffset. 2014-09-12 06:50:36 -04:00
Nicholas Hastings e4569cb2b9 Disable RTTI for more game-agnostic extensions. 2014-09-11 17:41:25 -07:00
Nicholas Hastings 47450bb98c Disable RTTI for game-agnostic extensions 2014-09-11 17:28:24 -07:00
Nicholas Hastings c62e7458f9 Disable RTTI for Loader, Logic, and JIT bins 2014-09-11 17:15:59 -07:00
Bara d493bc701d Fix undefined symbol: clock_gettime
[SM] Extension dbi.mysql.ext.so failed to load: /home/csgo/csgo/addons/sourcemod/extensions/dbi.mysql.ext.so: undefined symbol: clock_gettime
2014-09-12 01:52:20 +02:00
Nicholas Hastings f0fe427fee Link libstdc++ on linux for CS:GO. 2014-09-11 19:23:10 -04:00
Nicholas Hastings 7f0b163b31 Merge pull request #155 from alliedmodders/onclientauth-steam2
Make OnClientAuthorized use Steam2 ids where available (r=asherkin).
2014-09-11 13:02:28 -04:00
Nicholas Hastings 49c22a404d Trigger build for hl2sdk-tf2 changes. 2014-09-10 20:59:13 -04:00
Nicholas Hastings e6fd19fb8c Fix crash regression from typo in 892edd9650 2014-09-09 22:05:59 -04:00
Nicholas Hastings 96f8d635c3 Re-enable -Wformat and -Wformat-security in builds 2014-09-09 22:05:07 -04:00
Nicholas Hastings 9a9446400d Nuke spurious NULL checks in spcomp to appease Clang 3.5 2014-09-09 22:04:24 -04:00
Nicholas Hastings 8a1c6bd833 Fix client listener OnClientAuthorized to match new doc 2014-09-09 18:20:52 -07:00
Nicholas Hastings e0c25cfe08 Fix typo, fix build 2014-09-09 18:12:34 -07:00
Nicholas Hastings 6d7115d62f Update the missed steamid nullcheck in clientprefs 2014-09-09 18:04:39 -07:00
Nicholas Hastings 96fbb7ecda Unify Player::GetSteamXId returns, clarify doc, and fix checks 2014-09-09 17:57:54 -07:00
Nicholas Hastings 775a35c5ab Update OnClientAuthorized function doc 2014-09-09 17:56:29 -07:00
Nicholas Hastings 9e6fcc7673 Make OnClientAuthorized use Steam2 ids where available 2014-09-09 17:43:01 -07:00
Nicholas Hastings acdd9e12ea Merge pull request #152 from alliedmodders/error-sp-warnings
Treat SourcePawn warnings as errors when building (r=dvander).
2014-09-09 17:01:44 -04:00
Nicholas Hastings a597277a64 Merge pull request #153 from alliedmodders/auth-fixups
More auth fixups for Steam auth (bug 6243, r=asherkin).
2014-09-09 16:24:57 -04:00
Nicholas Hastings b3dada65fa Fix build. 2014-09-09 13:21:01 -07:00
Nicholas Hastings 8a9a793453 Merge pull request #151 from alliedmodders/menu-natives-logic
Move menu natives from core to logic (r=asherkin).
2014-09-09 15:51:11 -04:00
David Anderson d1aa9a3513 Merge branch 'calli-7' 2014-09-07 15:08:51 -07:00
David Anderson 06f52aa7ce Merge pull request #141 from alliedmodders/calli-5
Rewrite the assembly pipeline.
2014-09-07 15:04:00 -07:00
David Anderson 60eb8ca4bd Merge branch 'master' into calli-5
Conflicts:
	public/amtl/am-utility.h
2014-09-07 15:03:28 -07:00
David Anderson 5b85f41fec Use the correct string table for tag names. 2014-09-07 15:02:09 -07:00
Kyle Sanderson cd4978d60e Merge pull request #154 from VoiDeD/sdkhooks-inc-fix
Fix sdkhooks.inc compile error
2014-09-06 22:10:22 -07:00
Ryan Stecker 07acec6550 Fix sdkhooks.inc compile error 2014-09-06 20:19:55 -05:00
Nicholas Hastings 66ab609000 Make admins_simple.ini bind Steam3 ids as steam auth 2014-09-05 13:16:55 -07:00
Nicholas Hastings 29d428adc2 Add support for auto-converting '_' to ':' with Steam3 Id targetting 2014-09-05 13:08:51 -07:00
Nicholas Hastings 5b1caec738 Treat sp warnings as errors when building 2014-09-05 08:26:23 -07:00
Nicholas Hastings ad7d920ce0 Move menu natives from core to logic 2014-09-05 08:24:40 -07:00
Nicholas Hastings 7fff73ad64 Fix syntax error in sdkhooks.inc. 2014-09-05 08:18:04 -04:00
Nicholas Hastings 215bbb8324 Make SteamID targetting explicit to Steam IDs...
rather than NetworkIDs which could be any form and similar to names.
Also make explicit support for both Steam2 and Steam3 formats
2014-09-04 16:25:12 -07:00
Nicholas Hastings 1bf4eb80bd Cache Steam ID and rendered forms when caching networkID 2014-09-04 16:14:34 -07:00
Nicholas Hastings f1dc24c089 Move Steam2/3 id rendering logic to CPlayer 2014-09-04 15:27:44 -07:00
Nicholas Hastings 892edd9650 Allow BindIdentity and FindAdminByIdentity to take more SteamID formats for steam auth type 2014-09-04 15:26:12 -07:00
Nicholas Hastings ec46e12c50 Replace usages of GetClientAuthString with GetClientAuthId 2014-09-04 12:49:06 -07:00
David Anderson 37638ba6fd Remove support for multiple tags on an argument. 2014-09-04 09:59:43 -07:00
David Anderson 8da4179c64 Merge pull request #150 from alliedmodders/fix-dbi
Fix DBI after AMTL changes.
2014-09-04 09:51:30 -07:00
David Anderson a1dc1101f7 Fix build. 2014-09-03 22:33:05 -07:00
David Anderson a00adaf9fb Sync with AMTL one last time. 2014-09-03 22:05:10 -07:00
David Anderson 8686957dee Final sync of AMTL. 2014-09-03 21:48:48 -07:00
David Anderson e6e90fb8b8 Sync am-string. 2014-09-03 21:45:44 -07:00
David Anderson 6068d341c8 Sync am-hashmap. 2014-09-03 21:44:51 -07:00
David Anderson 105cd27d19 Sync am-utility.h from upstream. 2014-09-03 21:40:03 -07:00
David Anderson e608057304 Sync a change from AMTL. 2014-09-03 21:31:06 -07:00
David Anderson 448c55c0f2 Fix DBI after AMTL changes. 2014-09-03 21:11:17 -07:00
Nicholas Hastings a7cdf17d90 Merge pull request #147 from alliedmodders/new-auth
Expose explicit client auth id formats (r=asherkin).
2014-09-03 18:50:24 -04:00
Nicholas Hastings b2b82f4a86 Add gamedata for SDKHooks Blocked and OnTakeDamage_Alive for many games. 2014-09-03 18:49:14 -04:00
Nicholas Hastings 6da7219f9f Merge pull request #149 from alliedmodders/ontakedamage_alive
Add OnTakeDamage_Alive hook support to SDKHooks (bug 6249, r=asherkin).
2014-09-03 18:35:06 -04:00
Nicholas Hastings 7f3656215b Consistency Fixes (ID->Id, AuthString->AuthId) 2014-09-03 15:13:30 -07:00
Nicholas Hastings be55587d70 Add OnTakeDamage_Alive hook support to SDKHooks (bug=6249). 2014-09-03 17:45:34 -04:00
David Anderson 40b1067ef7 Merge pull request #148 from alliedmodders/warnings-as-errors
Add a flag for warnings-as-errors.
2014-09-03 11:10:56 -07:00
David Anderson 01d1c0c806 Add a flag for warnings-as-errors. 2014-09-03 11:04:25 -07:00
Nicholas Hastings 3fba1d2817 Fix some nits 2014-09-03 10:50:11 -07:00
Nicholas Hastings e6ff9c36ed Merge pull request #119 from VoiDeD/sdkhooks-blocked
Implement SDKHook_Blocked and SDKHook_BlockedPost (r=psychonic).
2014-09-03 10:50:38 -04:00
Nicholas Hastings e11fec9ba1 Rename GetClientAuthString2 to GetClientAuthId 2014-09-02 18:11:36 -07:00
Nicholas Hastings d0c701793c Document possibly-unexpected yet valid auth strings 2014-09-02 17:47:33 -07:00
Nicholas Hastings eafd6626ec Fix true return when validation wanted and steam id pending 2014-09-02 17:44:11 -07:00
Nicholas Hastings e3b87a5ca4 Spin new logic into GetClientAuthString2...
and mark GetClientAuthString as deprecated, using 1.6.x GetClientAuthString behavior
2014-09-02 17:43:10 -07:00
Nicholas Hastings 8c89b72fbc Expose explicit client auth string formats 2014-09-02 14:40:39 -07:00
Ryan Stecker cae1d0dec1 Don't override hook result in BlockedPost. 2014-09-02 13:01:18 -05:00
Ryan Stecker 88c6d3d9a7 Merge remote-tracking branch 'upstream/master' into sdkhooks-blocked 2014-09-02 00:04:54 -05:00
Nicholas Hastings e9e35979a4 Update core AMBuild script for hl2sdk-csgo and hl2sdk-dota protobuf changes. 2014-09-01 11:25:55 -04:00
David Anderson 9d337dd1a9 Merge pull request #146 from alliedmodders/unions
Add a "union" keyword to replace funcenum.
2014-08-31 16:02:59 -04:00
Nicholas Hastings e093c7f72a Merge pull request #120 from alliedmodders/wip-valve-fs2
Add support for Valve FS to natives that use file handles (r=asherkin).
2014-08-30 14:25:53 -04:00
Nicholas Hastings ac121ec4d2 Merge branch 'master' of https://github.com/alliedmodders/sourcemod 2014-08-29 09:54:13 -07:00
Nicholas Hastings b81c44cf49 Update for hl2sdk-dota changes 2014-08-29 09:53:43 -07:00
David Anderson a136049392 Merge pull request #142 from VoiDeD/array-commas
Allow trailing commas in string array declarations. (bug 6239)
2014-08-29 11:21:14 -04:00
David Anderson a1b7c32b29 Add a "union" keyword to replace funcenum. 2014-08-28 14:02:08 -07:00
Ryan Stecker 302dc1cb8a Add test. 2014-08-26 14:58:58 -05:00
David Anderson 6db4f31a10 Remove weird tag flags. 2014-08-24 20:47:07 -07:00
David Anderson 63e5ab18ff Remove support for multiple tags on an argument. 2014-08-24 18:59:51 -07:00
David Anderson d230711e4d Bump SourcePawn version to 1.7 to match SourceMod. 2014-08-23 19:26:51 -07:00
Ryan Stecker 74908098f4 Allow trailing commas in string array declarations. (bug 6239) 2014-08-23 18:15:08 -05:00
David Anderson 078ee76491 Re-add .dbg.natives. 2014-08-23 13:40:50 -07:00
David Anderson 98ec07a419 Add debug info tables to smxbuilder. 2014-08-23 13:26:03 -07:00
David Anderson c4056aea5d Rewrite the assembly pipeline.
This patch uses SmxBuilder from spcomp2 to replace the old assemble()
pipeline. Instead of generating into an old AMX structure, and then
decoding that into SMX, we now directly generate into SMX. This greatly
simplifies code generation and smx building.
2014-08-23 13:25:58 -07:00
David Anderson 7a51d5d549 Remove unused variables. 2014-08-23 13:25:48 -07:00
Nicholas Hastings 89f5d6ecfb Merge pull request #140 from FlaminSarge/tf_enums_2014jun
Update TF2 enums for Love & War (r=psychonic).
2014-08-23 09:32:35 -04:00
David Anderson 9267d0c803 Eliminate Newborn/NoAddRef (bug 5907, r=ds). 2014-08-22 22:50:25 -07:00
David Anderson 0cf8eb2854 Fix Windows build more. 2014-08-22 21:07:49 -07:00
David Anderson d20ba38d6b Fix Windows build. 2014-08-22 20:47:18 -07:00
David Anderson 4d42fa0305 Fix Windows build. 2014-08-22 20:41:24 -07:00
David Anderson 860a5db5ea Merge pull request #139 from alliedmodders/fix-mac-build
Fix Mac build on apple-clang 5.0.
2014-08-22 20:34:38 -07:00
David Anderson 666b6b97ee Fix Mac build on apple-clang 5.0. 2014-08-22 20:30:35 -07:00
David Anderson d562593d31 Fix build. 2014-08-22 18:27:46 -07:00
David Anderson 27c3866b90 Merge branch 'calli-4' 2014-08-22 10:10:48 -07:00
David Anderson 50f3ec8da2 Merge branch 'calli-3' 2014-08-22 09:59:11 -07:00
David Anderson f42651a813 Merge branch 'calli-2' 2014-08-22 09:58:14 -07:00
David Anderson 91f0f1001b Merge pull request #134 from alliedmodders/calli
Simplify how functags work.
2014-08-22 09:54:48 -07:00
Nicholas Hastings 51d32bca77 Clarify return value commit on RemoveFile 2014-08-22 07:21:12 -07:00
Nicholas Hastings 9d6fea857b Fix another syntax error in files.inc 2014-08-22 06:55:45 -07:00
Nicholas Hastings 8d60fecb96 Fix syntax errors in files.inc 2014-08-22 06:30:25 -07:00
Nicholas Hastings 73115f7afa Add support for specifying gameinfo search path when using valveFS in file natives 2014-08-22 06:00:43 -07:00
Nicholas Hastings b95e7ff145 Add missing use_valve_fs param to CreateDirectory native def 2014-08-22 05:59:41 -07:00
Nicholas Hastings e1158889e5 Fix backwards use_valve_fs logic for OpenDirectory 2014-08-22 05:56:23 -07:00
David Anderson a09735a4c7 Remove SC_FUNC and SC_VDEFINE. 2014-08-22 00:53:47 -07:00
David Anderson 6291374b35 Move rtti hacks. 2014-08-22 00:41:32 -07:00
David Anderson dcd246c7ef Port scvars to C++. 2014-08-22 00:39:03 -07:00
David Anderson 29fbbade69 Port sc1 to C++. 2014-08-22 00:38:04 -07:00
David Anderson 48d228e2b1 Port sc2 to C++. 2014-08-22 00:23:02 -07:00
David Anderson 4608050bd2 Port sc3 to C++. 2014-08-22 00:17:00 -07:00
David Anderson 234b4907ed Port sc4 to C++. 2014-08-22 00:12:16 -07:00
David Anderson 9c005d93ed Port sc5 to C++. 2014-08-22 00:09:28 -07:00
David Anderson 3eb1faa470 Port sc6 to C++. 2014-08-22 00:07:40 -07:00
David Anderson 142fbaafdd Port sc7 to C++. 2014-08-22 00:04:48 -07:00
David Anderson afd6009fda Port scexpand and sci18n to C++. 2014-08-22 00:00:31 -07:00
David Anderson 3e8157c6bc Port lstring and sclist to C++. 2014-08-21 23:58:19 -07:00
David Anderson 2ba4fb180e Move scstate.c to C++. 2014-08-21 23:54:10 -07:00
David Anderson 261188fd1b Port a bunch of legwork files to C++. 2014-08-21 23:53:11 -07:00
David Anderson 5a4c50ce55 Port sp_symhash to C++. 2014-08-21 23:36:26 -07:00
FlaminSarge c70543839f Update TF2 enums for Love & War 2014-08-21 23:14:14 -07:00
David Anderson f5efdbf6f5 Remove hardtabs and fix style issues. 2014-08-21 22:42:22 -07:00
David Anderson 25241fa278 Remove file. 2014-08-21 22:19:25 -07:00
David Anderson 225954a27c Modernize the smx headers. 2014-08-21 22:16:07 -07:00
Ruben Gonzalez 3e1495d692 Update NMRIH gamedata. 2014-08-21 09:33:25 -04:00
Nicholas Hastings 5716927cbf Fix compile error on with MSVC. 2014-08-20 21:37:47 -04:00
Nicholas Hastings 09250f89cc Merge pull request #133 from alliedmodders/logger-logic
Move Logger and core natives from core to logic (r=dvander).
2014-08-20 06:43:31 -04:00
David Anderson 233aa5d2df Merge pull request #135 from alliedmodders/typedef-fix
Fix typedefs not fixing string sizes (bug 6220).
2014-08-20 00:30:08 -07:00
David Anderson 1f51393e26 Fix typedefs not fixing string sizes (bug 6220). 2014-08-20 00:26:09 -07:00
David Anderson d91d69f72e Remove newline. 2014-08-20 00:06:33 -07:00
David Anderson 96a73eb86f Deleting CONTRIBUTOR.md (until an up-to-date link is available). 2014-08-20 00:02:01 -07:00
David Anderson e5e2c1fa3d Simplify functag handling. 2014-08-20 00:00:24 -07:00
David Anderson 942a3cd155 Another dedent. 2014-08-19 22:32:02 -07:00
David Anderson 8dc4fcc728 Remove allowproccall code, dedent a block. 2014-08-19 22:29:13 -07:00
David Anderson 385d3708a3 Fix style issues in sctracker.c. 2014-08-19 22:17:10 -07:00
David Anderson 5cf2475e2e Merge pull request #132 from alliedmodders/fix-variadic-args
Fix returning strings from functions with variadic arguments.
2014-08-19 21:36:31 -07:00
Ruben Gonzalez 9f2a0f6748 Update FoF gamedata. 2014-08-18 08:56:39 -04:00
Nicholas Hastings e9ba251c1c Fix link errors. 2014-08-17 11:11:55 -04:00
Nicholas Hastings e4645332aa Convert missed files in logic to use logger from logic. 2014-08-17 11:06:43 -04:00
David Anderson 56cf6e723e Remove unnecessary changes. 2014-08-17 01:21:35 -07:00
David Anderson cef9d9d162 Fix returning strings from functions with variadic arguments. 2014-08-17 01:17:10 -07:00
Nicholas Hastings 1ca837ea2c Merge pull request #131 from VoiDeD/removewearable-optional
Mark TF2_RemoveWearable as optional (r=psychonic).
2014-08-16 13:23:01 -04:00
Ryan Stecker 2037cfc36d Mark TF2_RemoveWearable as optional. 2014-08-16 12:10:31 -05:00
Nicholas Hastings 8ffdfb6a0c Merge pull request #43 from hlstriker/master
Added a new function SetFilePermissions to set permissions of a file (r=psychonic).
2014-08-16 10:02:09 -04:00
Kyle Sanderson 766b6e1770 Merge pull request #127 from alliedmodders/coremapend
Add OnCoreMapEnd to extension's interface.
2014-08-15 20:48:59 -07:00
Ruben Gonzalez 31087dcb57 Merge pull request #130 from VoiDeD/regex-errors
Fix typo related to invalid regex handle errors.
2014-08-14 14:13:42 -04:00
Ryan Stecker d873b20573 Fix typo related to invalid regex handle errors. 2014-08-14 12:24:51 -05:00
Nicholas Hastings 486910a9a1 Add missing files 2014-08-13 14:26:18 -07:00
Nicholas Hastings 17d5af0e2f Move Logger and Core natives to Logic 2014-08-13 14:24:35 -07:00
Asher Baker f570fa414b Reformatted compiler output a little. (r=dvander) 2014-08-12 18:35:43 +00:00
David Anderson 4b8e26463a Merge pull request #122 from peace-maker/datapack_funcpointer
Add WritePackFunction and ReadPackFunction natives
2014-08-12 10:33:27 -07:00
David Anderson b92efc1df1 Merge pull request #128 from VoiDeD/profile-dump
Add a command to dump profiling output.
2014-08-12 10:31:30 -07:00
Nicholas Hastings 25f8570279 Merge pull request #124 from alliedmodders/csgo-cl-language
Fix automatic language detection on CS:GO (bug 6163) (r=asherkin).
2014-08-11 07:37:11 -04:00
Ryan Stecker 0bde28cc17 Add a command to dump profiling output. 2014-08-09 13:32:05 -05:00
Ruben Gonzalez 2ba0b794ea Added note to know what version OnCoreMapEnd was added to. 2014-08-08 10:57:38 -04:00
Ruben Gonzalez 7a88386568 Add OnCoreMapEnd to extension's interface. 2014-08-08 01:01:47 -04:00
Nicholas Hastings 4e5b1a58ce Add ValveFS support to more filesystem functions: OpenDirectory (CloseHandle on directory) ReadDirEntry DirExists CreateDirectory RenameFile 2014-08-06 13:15:24 -07:00
Nicholas Hastings 3edd1ce658 Remove inaccurate note on GetClientLanguage function doc. 2014-08-05 10:40:14 -04:00
Asher Baker 84e5e20362 Merge pull request #125 from WildCard65/wearablesfix
Actually remove extra wearables.
2014-08-05 15:02:14 +01:00
WildCard65 dfba8757f7 Remove un-needed whitespace 2014-08-05 09:15:55 -04:00
WildCard65 15304a0059 Actually remove extra wearables.
Old logic was to try to get extra wearables on a non-existent entity.
2014-08-05 09:14:02 -04:00
Nicholas Hastings ccc818d06e Fix automatic language detection on CS:GO (bug 6163). 2014-08-05 01:41:44 -04:00
David Anderson 000cb2b4dd Merge pull request #123 from alliedmodders/sp2-compat
Introduce a typedef keyword.
2014-08-03 22:27:27 -07:00
David Anderson ad376ff0b8 Introduce a typedef keyword. 2014-08-03 21:51:34 -07:00
David Anderson 09edda93ad Fix style atrocities in sc1.c. 2014-08-03 18:53:58 -07:00
Peace-Maker bfcfbbe107 Add WritePackFunction and ReadPackFunction natives
Adds type safety to CDataPack. Cells can't be read as Float anymore. Now
you're able to store a function pointer in a datapack and be sure the
pointer can't be read as a cell and a cell can't be read as a function
pointer.
2014-08-04 02:05:25 +02:00
Nicholas Hastings f2b19e6c87 Add more accurate return value for DeleteFile when using Valve FS. 2014-08-03 09:10:02 -04:00
Nicholas Hastings 836cde4e21 Merge pull request #121 from VoiDeD/bug-6206
Remove the extra wearables of weapons in TF2_RemoveWeaponSlot (r=psychonic).
2014-08-02 22:02:14 -04:00
Ryan Stecker 14823723bd Remove the extra wearables of weapons in TF2_RemoveWeaponSlot. 2014-08-02 20:57:55 -05:00
Ryan Stecker 601aac440e Implement SDKHook_Blocked and SDKHook_BlockedPost. 2014-08-01 21:35:41 -05:00
Nicholas Hastings 573aea20fb More progress:
Abstracted many fs funcs with helper class.
Removed much duplicated code.
Fixed ReadFile assuming FS errors for ValveFS.
Added ValveFS support for ReadFileString, WriteFile, WriteFileString, DeleteFile.
Added missing param in doc for OpenFile.
2014-08-01 12:38:51 -07:00
Nicholas Hastings 5e7e7ce551 Improved FPrint(f) passthrough 2014-08-01 06:09:09 -07:00
Ruben Gonzalez c116353285 WiP addition of support for ValveFS to many more filesystem natives. 2014-07-31 20:56:07 -04:00
Kyle Sanderson 678e743819 Merge pull request #116 from VoiDeD/funcommands-gravity
Fix PerformGravity's logging format.
2014-07-30 17:59:52 -07:00
Ryan Stecker ff5ec0ea28 Fix PerformGravity's logging format. 2014-07-30 18:22:12 -05:00
Nicholas Hastings 8d5fe316e0 Merge pull request #114 from VoiDeD/tf2-removewearable
Implement TF2_RemoveWearable native (r=psychonic).
2014-07-30 18:43:34 -04:00
Kyle Sanderson c4a1e3c819 Merge pull request #107 from alliedmodders/sdkhackfix
Copy SDKHooks vector instead of taking a reference.
2014-07-30 15:42:49 -07:00
Kyle Sanderson ab72841704 Rename SDKHooks function and variable to be friendlier. 2014-07-30 15:34:51 -07:00
Ryan Stecker 75d5b0c972 Add more TF2_RemoveWearable documentation. 2014-07-30 17:28:51 -05:00
Asher Baker dd7a1764e4 Merge pull request #115 from asherkin/basebans-load
Improved error reporting in basebans custom reasons loading.
2014-07-30 20:52:51 +01:00
Asher Baker eab6ac748f Improved error reporting in basebans custom reasons loading. 2014-07-30 16:30:01 +01:00
Nicholas Hastings b979d707db Update Fistful of Frags gamedata. 2014-07-30 06:35:45 -04:00
Ryan Stecker 4a400d9569 Implement TF2_RemoveWearable native. 2014-07-29 20:31:27 -05:00
Kyle Sanderson ba0406930d Pre-allocate 8 elements to skip trivial reallocations near the beginning of the vectors life. 2014-07-29 02:48:13 -07:00
Kyle Sanderson be79dee6e0 Store only the callback as per VoiDeD, re-eval if HookList changes. 2014-07-29 02:46:49 -07:00
Kyle Sanderson 97610edda4 HackFix: Mimic forwardsys style of pawn calling. 2014-07-28 15:51:34 -07:00
Asher Baker 803a54b773 Merge pull request #113 from VoiDeD/spcomp-include-path
Fix not adding the "include" directory to the spcomp search path.
2014-07-24 22:23:43 +01:00
Ryan Stecker fad5c590b6 Fix not adding the "include" directory to the spcomp search path. 2014-07-24 15:35:44 -05:00
David Anderson 2553d02698 Fix build. 2014-07-24 10:40:51 -04:00
David Anderson da71cfed5a Merge pull request #112 from alliedmodders/dynamic-scp
Generate .scp files as part of the build process.
2014-07-24 09:01:49 -04:00
David Anderson 34e57b77b1 Fix spacing. 2014-07-24 08:54:52 -04:00
David Anderson fa446f74a1 Generate .scp files as part of the build process. 2014-07-24 07:58:03 -04:00
David Anderson 94b64cd6fc Regen sc5.scp. 2014-07-24 06:55:57 -04:00
David Anderson abcd106273 Merge pull request #111 from alliedmodders/bug6199
Improve error messaging for reserved keywords (bug 6199).
2014-07-24 06:53:51 -04:00
David Anderson 97e821dd6f Improve error messaging for reserved keywords (bug 6199). 2014-07-24 06:51:03 -04:00
David Anderson 6e48ded1a6 Merge pull request #109 from alliedmodders/binreloc
Enable binreloc for OS X.
2014-07-24 03:24:52 -07:00
David Anderson 1cc6120741 Merge pull request #110 from alliedmodders/bug6200
Add GetNativeFunction (bug 6200).
2014-07-24 03:24:37 -07:00
David Anderson 2a46f8f881 Add GetNativeFunction (bug 6200). 2014-07-23 23:36:11 -07:00
David Anderson 3fc05056b0 Rename <unknown> to __unknown__ to quell sc7 asserts. 2014-07-23 23:25:12 -07:00
David Anderson f41b3a2b06 Enable binreloc for OS X. 2014-07-23 23:21:03 -07:00
David Anderson 654dcd8ff0 Merge pull request #108 from VoiDeD/bug-6187
Fix message string for error 102.
2014-07-23 17:11:09 -07:00
Ryan Stecker 6a2ec15041 Fix error message 102 to include the spectype that's missing.
Additionally this fixes invalid usage of error 102 in grow_stgbuffer.
2014-07-23 18:52:22 -05:00
David Anderson 59efdafbaf Merge pull request #106 from VoiDeD/spcomp-file-handles
Close file handle on success in pc_opensrc.
2014-07-22 15:43:29 -07:00
Ryan Stecker f3671e55db Close file handle on success in pc_opensrc. 2014-07-22 17:33:26 -05:00
David Anderson b6d8cb9fcf Merge pull request #105 from alliedmodders/fix-varargs
Fix bug in variadic argument parsing. (bug 6195)
2014-07-21 23:12:26 -07:00
David Anderson 2a99eecdb6 Fix bug in variadic argument parsing. 2014-07-21 23:01:35 -07:00
David Anderson 57303f4310 Merge pull request #103 from alliedmodders/fix-incdec
Fix postinc/dec operations on accessors.
2014-07-20 21:24:57 -07:00
David Anderson 88c614c1ba Merge pull request #104 from alliedmodders/fix-structs
Clean up the struct syntax and force it to use newdecls.
2014-07-20 21:19:15 -07:00
David Anderson b1c400190a Merge pull request #101 from alliedmodders/sp2-incs
Block off operators for post-transitional compiler.
2014-07-20 21:19:07 -07:00
David Anderson 686890ec10 Clean up the struct syntax and force it to use newdecls. 2014-07-20 12:16:23 -07:00
David Anderson 8aa28e2c8d More indentation, spacing, and style fixes in sc1.c. 2014-07-20 11:50:57 -07:00
David Anderson 16177e9ecc Fix indentation, spacing, and style in declstruct(). 2014-07-20 11:46:02 -07:00
David Anderson 2b74f1bd61 Remove unused function. 2014-07-20 11:19:48 -07:00
David Anderson 5daa420aed Fix inc/dec operations on accessors. 2014-07-20 11:18:38 -07:00
David Anderson d2c7064e2b Merge pull request #102 from alliedmodders/fix-map-check
Check for null map in matchtag().
2014-07-20 10:36:34 -07:00
David Anderson 4051756576 Check for null map in matchtag(). 2014-07-20 10:15:49 -07:00
David Anderson 51f97d1298 Block off operators for post-transitional compiler. 2014-07-20 01:02:44 -07:00
David Anderson 8436a3ea6c Merge pull request #100 from alliedmodders/delete-crash
Mark usage correctly when invoking special natives.
2014-07-17 22:38:25 -07:00
David Anderson b0e98b16ec Mark usage correctly when invoking special natives. 2014-07-17 22:30:13 -07:00
David Anderson 7948755b3b Merge pull request #99 from alliedmodders/any-newdecls
Allow the any type in non-native newdecls.
2014-07-17 21:49:25 -07:00
David Anderson f79f5df5ab Allow the any type in non-native newdecls. 2014-07-17 21:43:59 -07:00
David Anderson b84b70d0f1 Merge pull request #98 from alliedmodders/fix-nullable
Fix nullable comparisons.
2014-07-17 21:29:07 -07:00
David Anderson beeb848724 Rename. 2014-07-17 21:19:31 -07:00
David Anderson 805b66e539 Fix null not working with comparisons. 2014-07-17 21:18:49 -07:00
David Anderson 8125faeb70 Merge pull request #97 from alliedmodders/bug-6179
Fix const with newdecls and a varargs bug. (bug 6179)
2014-07-17 20:55:23 -07:00
David Anderson 84344c1592 Fix const with newdecls and a varargs bug. (bug 6179) 2014-07-17 20:44:54 -07:00
Nicholas Hastings ac371aa639 Merge pull request #96 from peace-maker/reloadpost_hook
Fix regression. SDKHook_ReloadPost never firing (r=psychonic).
2014-07-16 15:09:44 -04:00
Peace-Maker 1181144e57 Fix regression. SDKHook_ReloadPost never firing
The switch to vtable hooks typo'd the ReloadPost hooks.
2014-07-16 20:40:52 +02:00
David Anderson 3a2f2e621d Remove references to the DisableJIT option. r=psychonic 2014-07-15 09:42:49 -07:00
David Anderson 9c6b82f3a5 Merge pull request #89 from alliedmodders/bug-6176
Fix crash with malformed arguments (bug 6176).
2014-07-13 11:26:57 -07:00
David Anderson 2ea9ec50b5 Merge pull request #91 from alliedmodders/bug-6183
Show errors for methods that are unused. (bug 6183)
2014-07-13 11:24:51 -07:00
David Anderson 58a3cb4a06 Merge pull request #90 from alliedmodders/bug-6178
Allow chaining off method calls. (bug 6178)
2014-07-13 11:24:22 -07:00
Nicholas Hastings a8a64cabee Update some Contagion gamedata. 2014-07-13 10:15:18 -04:00
David Anderson 71fb0d1d18 Address review comment. 2014-07-12 21:21:07 -07:00
David Anderson cd6997cd0b Merge pull request #88 from alliedmodders/bug-6175
Fix and formalize newline and semicolon behavior in methodmaps. (bug 6175)
2014-07-12 20:45:35 -07:00
David Anderson 5dd5b5131b Show errors for methods that are unused. (bug 6183) 2014-07-12 10:28:29 -07:00
David Anderson 1a83ca57fc Allow chaining off method calls. (bug 6178) 2014-07-12 10:05:43 -07:00
David Anderson 21d3a7f93e Fix crash with malformed arguments (bug 6176). 2014-07-12 09:31:51 -07:00
David Anderson 294fdee1e6 Clarify lexpop(). 2014-07-12 00:09:05 -07:00
David Anderson 3d3e5c40c2 Fix and formalize newline and semicolon behavior in methodmaps. (bug 6175) 2014-07-12 00:07:34 -07:00
Ruben Gonzalez 9e1fef9775 Update TerminateRound code and gamedata for update. 2014-07-11 09:18:47 -04:00
David Anderson b0bfec0f8f Merge pull request #87 from alliedmodders/bug-6174
Fix "static stock" not working (bug 6174).
2014-07-10 23:41:59 -07:00
David Anderson 919e859a6d Fix "static stock" not working (bug 6174). 2014-07-10 23:18:07 -07:00
David Anderson c47cfa6fa8 Merge pull request #86 from VoiDeD/transitional-functags
Give functags their correct types for transitional syntax.
2014-07-10 15:27:03 -07:00
Ryan Stecker c38b4a4d1d Give functags their correct types for transitional syntax. 2014-07-10 16:55:22 -05:00
Nicholas Hastings 44b2b02a1e Merge pull request #85 from alliedmodders/more-prop-data-types
Fix regression stopping -1 from being a valid value in SetEntPropEnt (r=VoiDeD).
2014-07-09 22:47:54 -04:00
Nicholas Hastings 31a79231f8 Fix regression stopping -1 from being a valid value in SetEntPropEnt. 2014-07-09 22:23:20 -04:00
Nicholas Hastings d4c676aed2 Merge pull request #83 from alliedmodders/more-prop-data-types
Add support to Get/SetEntPropEnt for FIELD_CLASSPTR and FIELD_EDICT datadesc fields (r=KyleS).
2014-07-09 21:00:49 -04:00
Nicholas Hastings 0b5e587db9 Remove unnecessary null check. 2014-07-09 20:33:38 -04:00
Nicholas Hastings f7a64167fc Fix Dota 2 build. 2014-07-09 19:25:45 -04:00
Nicholas Hastings 3a94bd4fef Add support to Get/SetEntPropEnt for FIELD_CLASSPTR and FIELD_CLASSPTR datadesc fields. 2014-07-09 17:32:32 -04:00
David Anderson d9420cab49 Merge pull request #82 from VoiDeD/fix-version
Update version for manual builds of the 1.7 branch.
2014-07-09 09:53:40 -07:00
Ryan Stecker 226c0a456d Update version for manual builds of the 1.7 branch. 2014-07-09 11:03:02 -05:00
David Anderson 1e0155ad17 Merge pull request #81 from alliedmodders/unkeyword-class
Unkeyword "class", make it contextual.
2014-07-08 09:24:11 -07:00
David Anderson aa299d187b Merge pull request #80 from alliedmodders/lockdown-funcs
Begin locking down function types.
2014-07-08 09:23:55 -07:00
David Anderson 02b7f42811 Unkeyword "class", make it contextual. 2014-07-08 00:44:34 -07:00
David Anderson e76f553957 Begin locking down function types. 2014-07-08 00:26:37 -07:00
David Anderson d2b7126e1d Merge pull request #79 from alliedmodders/fix-null-func
Add a nullfunc_t type for INVALID_FUNCTION.
2014-07-08 00:17:47 -07:00
David Anderson 3fe22687e9 Revert. 2014-07-08 00:06:52 -07:00
David Anderson 2ade122cd2 Merge branch 'master' into fix-null-func
Conflicts:
	sourcepawn/compiler/sc5.scp
2014-07-08 00:06:04 -07:00
David Anderson e57a323dc8 WIP. 2014-07-07 23:31:31 -07:00
Asher Baker af791a30df Merge pull request #72 from VoiDeD/keyvalue-from-string
Implement StringToKeyValues.
2014-07-07 13:49:24 +01:00
David Anderson ff31d8df49 Update nominations.sp and improve compiler error messaging. 2014-07-06 23:59:15 -07:00
David Anderson 8e5992685a Merge branch 'master' into redo-noms 2014-07-06 23:49:18 -07:00
David Anderson af557fdd5e Use setters. 2014-07-06 23:46:45 -07:00
David Anderson 27d5ce45f5 Merge branch 'master' into noms 2014-07-06 23:42:41 -07:00
David Anderson 44316d63cc Add setters and fix some methodmap bugs. 2014-07-06 23:37:43 -07:00
David Anderson 97e0c84e6d Merge pull request #73 from alliedmodders/nullable
Add nullable types and tighten up some new type system semantics.
2014-07-06 11:45:09 -07:00
David Anderson 76edcb16ac Merge pull request #78 from VoiDeD/class-keyword
Fix usage of `class` keyword in some includes.
2014-07-06 10:46:07 -07:00
Nicholas Hastings 63aeeb8672 Merge pull request #70 from VoiDeD/classname-no-world-entity
GetEntityClassname should handle the case where the world entity has not been created yet (r=psychonic).
2014-07-06 11:26:01 -04:00
Ryan Stecker 312f003031 Fix usage of class keyword in some includes. 2014-07-06 07:15:22 -05:00
David Anderson dbedd6712a Remove VoteInProgress from Menu map. 2014-07-05 14:36:14 -07:00
David Anderson f18a83e03e Fix some menu API oddities. 2014-07-05 14:34:32 -07:00
David Anderson 1277bbd50e Mark the expression before flushing the staging buffer. 2014-07-05 14:15:44 -07:00
David Anderson a7de88dd42 Port nominations.sp to the transitional syntax and API. 2014-07-05 14:00:52 -07:00
David Anderson e5b1b630bb Port some includes to transitional API. 2014-07-05 13:58:07 -07:00
David Anderson db9ee5326a Allow CloseHandle() on nulls. 2014-07-05 13:52:44 -07:00
David Anderson 9ae3256bc0 Rename the null tag to null_t. 2014-07-05 13:31:10 -07:00
David Anderson a7342f3fa2 Fix AMBuildScript compatibility issue with older objdirs. 2014-07-05 13:28:55 -07:00
David Anderson 49380620e0 Merge branch 'master' into nullable 2014-07-05 13:24:45 -07:00
David Anderson 9ff38bcf80 Add nulls, and more newdecl and type system features.
New null_t type has a constant "null", which can be assigned to objects.
Methodmaps can now be "nullable", accepting null_t types.
The delete keyword now zaps non-const lvalue inputs.
Fixed some newdecl arguments not accepting references.
Allow functag matching to coerce arguments and return values.
Allow functags to accept new-style types as a return value.
2014-07-05 13:20:06 -07:00
Ryan Stecker fc54903fd0 Add test. 2014-07-05 12:01:17 -05:00
David Anderson 68ab7f0a12 Merge pull request #61 from VoiDeD/ambuild-disable-auto-versioning
Add an ambuild configure option to disable auto versioning.
2014-07-05 09:39:35 -07:00
David Anderson fece28935e Merge pull request #71 from VoiDeD/jit-spew
Only spew JIT compilation and opcodes when built with JIT_SPEW defined.
2014-07-05 09:38:45 -07:00
Ryan Stecker 6864bf0068 Only spew JIT compilation and opcodes when built with JIT_SPEW defined. 2014-07-05 10:57:08 -05:00
Ryan Stecker 3c079bcca0 GetEntityClassname should handle the case where the world entity has not been created yet. 2014-07-05 10:37:16 -05:00
David Anderson 3f220bca0d Merge pull request #69 from alliedmodders/pragma-newdecls
Add #pragma newdecls required|optional.
2014-07-05 01:21:18 -07:00
David Anderson 96bbd4d7e0 Fix potential bugs in restoring newdecl state. 2014-07-05 01:13:45 -07:00
David Anderson da33c79d8b Add #pragma newdecls required|optional. 2014-07-05 01:08:14 -07:00
David Anderson bfc65b086a Fix bug in newdecls in for loop initializers. 2014-07-05 00:48:32 -07:00
David Anderson 680a8e0283 Fix tests. 2014-07-05 00:44:46 -07:00
David Anderson 0e4b913312 Merge pull request #68 from alliedmodders/declloc
Add support for new-style declarations in local variables.
2014-07-05 00:00:20 -07:00
David Anderson f62769108c Fix some local declarations not working. 2014-07-04 23:53:16 -07:00
David Anderson 9a2bdd3792 Add -Wno-sometimes-uninitialized. 2014-07-04 23:10:23 -07:00
David Anderson 386b178ef3 Fix uninitialized variable warning. 2014-07-04 23:00:00 -07:00
David Anderson 79d9a49d28 Fix compiler bug. 2014-07-04 22:46:55 -07:00
David Anderson 376eb9725e Add support for new-style declarations in local variables. 2014-07-04 21:16:39 -07:00
David Anderson 5d753c2697 Merge pull request #67 from alliedmodders/glbdecls
Add support for new-style declarations in globals.
2014-07-04 17:21:26 -07:00
David Anderson 1c41f905f9 Add some tests and errors for bad void usage. 2014-07-04 17:14:40 -07:00
David Anderson dfa9a8f134 Add tests. 2014-07-04 17:01:12 -07:00
David Anderson 49eee8c04e Fix regression in methodmap tagging. 2014-07-04 16:55:33 -07:00
David Anderson 58b9fd57b2 Remove unused "no-postdims" flag. 2014-07-04 16:41:38 -07:00
David Anderson 7e770908fb Add support for decl lists. 2014-07-04 16:37:52 -07:00
David Anderson 3cf9e56a19 Fix various bugs in global newdecl support. 2014-07-04 14:31:56 -07:00
Nicholas Hastings ffa1887c48 Merge pull request #65 from powerlord/master
New functions for SDKTools to get information from game_sound files (r=psychonic).
2014-07-04 17:17:00 -04:00
Ryan Stecker 878a82a6e5 Implement StringToKeyValues. 2014-07-04 12:04:38 -05:00
David Anderson 19815d42c3 Add new-style declaration support for global declarations. 2014-07-04 00:37:39 -07:00
Ross Bemrose 966841afbd Make sure the edict isn't free.
return GetParametersForSoundEx's return value instead of always true.
2014-07-03 14:13:36 -04:00
Ross Bemrose e1d4ed0e34 Fixed overwriting the same copy/pasted line twice instead of once per new native. 2014-07-03 13:19:19 -04:00
Nicholas Hastings cde927112a Merge pull request #66 from alliedmodders/tf2-iserver
Switch TF2 to use IVEngineServer::GetIServer in SDKTools to find IServer ptr (r=voided).
2014-07-03 12:45:18 -04:00
Nicholas Hastings 3254f6f362 Switch TF2 to use IVEngineServer::GetIServer in SDKTools to find IServer ptr. 2014-07-03 12:26:52 -04:00
David Anderson 932a8028ca Merge pull request #60 from VoiDeD/ambuild-remove-tp-flag
Remove the /TP (compile as C++) msvc flag from projects that should be compiling as C.
2014-07-03 09:24:51 -07:00
David Anderson bdb5ef506b Merge pull request #64 from alliedmodders/newdecl
New declaration syntax: arguments.
2014-07-03 09:18:25 -07:00
Ross Bemrose d25ab6349c Commit new version of bug 5942: New functions for SDKTools to get information from game_sound files. 2014-07-03 10:20:53 -04:00
David Anderson 438fade64f Bug fixes. 2014-07-03 00:34:11 -07:00
David Anderson a15153e9b8 Improve error messaging. 2014-07-03 00:21:18 -07:00
David Anderson ed4cca0225 Bug fixes. 2014-07-03 00:14:12 -07:00
David Anderson 86cd906371 Remove typeinfo_t::type. 2014-07-02 23:17:30 -07:00
David Anderson cb46de97e1 Merge pull request #63 from alliedmodders/memsrc
Use in-memory buffers for reading files, and handle newlines better.
2014-07-02 23:07:46 -07:00
David Anderson 153bbba641 WIP. 2014-07-02 23:01:00 -07:00
David Anderson e46c49abe0 Fix bug. 2014-07-02 21:59:04 -07:00
David Anderson 10c8b78a16 Use in-memory buffers for reading files, and handle newlines better. 2014-07-02 21:52:17 -07:00
Ryan Stecker db98c98a1a Remove the /TP (compile as C++) msvc flag from projects that should be compiling as C. 2014-07-02 13:46:39 -05:00
Ryan Stecker d4f4a7eed0 Add an ambuild configure option to disable auto versioning. 2014-07-02 13:29:59 -05:00
Nicholas Hastings e6f6e6df70 Merge pull request #59 from alliedmodders/csgo-weapon-drop
Update CStrike extension CSWeaponDrop to use Vector overload on CS:GO (r=asherkin).
2014-07-02 10:44:04 -04:00
Nicholas Hastings eeba5b93c5 Update CStrike extension CSWeaponDrop to use Vector overload on CS:GO. 2014-07-02 10:08:56 -04:00
David Anderson 84f9b2bf35 Remove accidental files. 2014-07-01 22:06:33 -07:00
Scott Ehlert b1da6958ff Merge pull request #58 from alliedmodders/bug6164
Use -Wno-deprecated-register on clang 3.4+ or Apple clang 5.1+ only (bug 6164, r=psychonic).
2014-07-01 20:30:08 -05:00
Nicholas Hastings 5e596819c5 Update CS:GO CSWeaponDrop gamedata. 2014-07-01 21:06:39 -04:00
Scott Ehlert 415b6ea174 Use -Wno-deprecated-register on clang 3.4+ or Apple clang 5.1+ only (bug 6164). 2014-07-01 16:13:22 -05:00
Nicholas Hastings 0e015027fc Merge pull request #57 from VoiDeD/reservedslots-override-fix
sm_reskick_immunity access check should not check for commands (r=psychonic).
2014-07-01 10:18:04 -04:00
Ryan Stecker 9c1dd0565f sm_reskick_immunity access check should not check for commands. 2014-07-01 09:07:40 -05:00
David Anderson beb557aa56 Add unstaged changes. 2014-06-30 20:11:18 -07:00
David Anderson 6f3b08bbae Initial import of new decl parsing structure. 2014-06-30 20:10:15 -07:00
Scott Ehlert 553b07b722 Merge pull request #56 from peace-maker/gitignorefix
Fix .gitignore typo (r=ds).
2014-06-30 21:23:51 -05:00
Peace-Maker c2c7f090ba Fix .gitignore typo
VS build directories weren't excluded correctly
2014-06-30 15:06:22 +02:00
Peace-Maker 909c6ec594 Refresh sorting of topmenu after (re)LoadTopMenuConfig (bug 6032, r=psychonic). 2014-06-29 21:07:55 -04:00
Nicholas Hastings aedd1eb49c Add HudText gamedata support for Synergy (bug 6161). 2014-06-29 20:23:07 -04:00
Nicholas Hastings 6e34a530b4 Update Dota Linux EntityFactoryDictionary gamedata. 2014-06-28 17:04:43 -04:00
Nicholas Hastings 367c557a77 Update Synergy gamedata and switch NMRiH gamedata on linux to use symbols. 2014-06-28 09:52:03 -04:00
Andrew 3022b665dd Initialized the mask variable.
Moved the FPERM_ defines into the .cpp and removed the header file.
2014-06-27 16:43:51 -04:00
David Anderson 5cf0c08165 Merge pull request #55 from alliedmodders/nts
New type system.
2014-06-26 23:04:54 -07:00
David Anderson b8bd7c517e Add parsing functions. 2014-06-26 21:05:19 -07:00
David Anderson 6a5da160ad Fix build. 2014-06-25 01:06:48 -07:00
David Anderson 99f4cdb3e4 New type system. 2014-06-24 23:37:14 -07:00
David Anderson 2ae04ee1df Merge pull request #54 from alliedmodders/profiling
Add a general profiling abstraction layer.
2014-06-24 20:56:05 -07:00
David Anderson b26552d74c Improve usability of start/stop. 2014-06-24 20:55:53 -07:00
David Anderson f9defa7b37 Remove JIT registration API; this needs more time. 2014-06-24 20:44:30 -07:00
David Anderson fac52a2897 Fill out API more. 2014-06-24 01:18:16 -07:00
David Anderson ec61d4d188 Add a general profiling abstraction layer. 2014-06-24 01:04:13 -07:00
David Anderson 99c0879086 Fix build. 2014-06-23 20:17:40 -07:00
David Anderson b064556081 Merge pull request #50 from alliedmodders/map-api
Add transitional API for maps (aka tries).
2014-06-23 20:06:42 -07:00
David Anderson 2724659be8 Rename to StringMap. 2014-06-23 20:06:13 -07:00
Nicholas Hastings 3983dc10ed Update non-auto version for 1.7.0 for compiled plugins. 2014-06-23 19:46:26 -04:00
Nicholas Hastings c5e2d49b8f Merge pull request #52 from alliedmodders/bug-6137
Update TF2_IsHolidayActive native to virtually call gamerules IsHolidayActive (bug 6137, r=VoiDeD).
2014-06-23 19:39:14 -04:00
Nicholas Hastings bbdf40160c Add missing thisptr to call. 2014-06-23 19:24:27 -04:00
Nicholas Hastings de0f49248d Update TF2_IsHolidayActive native to virtually call gamerules IsHolidayActive. 2014-06-23 16:23:49 -04:00
David Anderson 92ace5497f More MSVC fixes. 2014-06-22 22:47:17 -07:00
David Anderson 8005009420 Workaround buggy C99 support in MSVC. 2014-06-22 22:44:16 -07:00
David Anderson 4ee04b8a7b Add transitional API for maps (aka tries). 2014-06-22 22:32:08 -07:00
David Anderson d7b66c2515 Merge pull request #49 from alliedmodders/methodmaps-inline-3
Add property accessors to methodmaps.
2014-06-22 22:16:57 -07:00
David Anderson 123c7f6b06 Fix METHOD_NAMEMAX. 2014-06-22 22:16:41 -07:00
David Anderson a17ad1c5a5 Add property accessors to methodmaps. 2014-06-22 22:02:02 -07:00
Nicholas Hastings dbcfbdb21a Merge pull request #42 from alliedmodders/bug-6137
Switch TF2 extension to hook CTFGameRules::IsHolidayActive for holiday forward (bug 6137, r=VoiDeD).
2014-06-22 21:23:27 -04:00
David Anderson 50b0019302 Merge pull request #48 from alliedmodders/methodmaps-inline-3
Add support for fully inline functions in methodmaps.
2014-06-22 14:20:15 -07:00
David Anderson b6eb3b041b Fix bug in requiring braces for new methods. 2014-06-22 13:28:35 -07:00
David Anderson 354022888f Add support for fully inline functions in methodmaps. 2014-06-22 13:21:46 -07:00
David Anderson 3ba47a71fd Merge pull request #47 from alliedmodders/fix-dbi-leak
Fix a Handle leak when reporting transaction errors.
2014-06-22 12:26:45 -07:00
David Anderson b64551e984 Fix a Handle leak when reporting transaction errors. 2014-06-22 11:05:20 -07:00
David Anderson 90e8607586 Merge pull request #46 from alliedmodders/methodmaps-inline-2
Add support for inline native methods on methodmaps.
2014-06-22 01:58:22 -07:00
David Anderson ffd97a1fd0 Fix typeexpr unknown token not reporting an error message. 2014-06-22 01:46:43 -07:00
David Anderson 5b12f456ac Add support for inline native methods. 2014-06-22 01:44:23 -07:00
David Anderson c4f2b8348e Merge pull request #45 from alliedmodders/methodmaps-inline
Introduce 4-token lookahead buffer.
2014-06-21 23:56:58 -07:00
David Anderson 8f6c13b220 Merge pull request #44 from alliedmodders/methodmaps-dtor-fix
Allow base destructors to run and fix some error reporting.
2014-06-21 23:37:12 -07:00
David Anderson 10a511a35e Introduce 4-token lookahead buffer. 2014-06-21 23:35:55 -07:00
David Anderson 861953d736 Allow base destructors to run and fix some error reporting. 2014-06-21 12:27:04 -07:00
David Anderson 63ad5eff18 Introduce basic methodmaps (PR #38).
commit 1e5213d43fdd170bb0c30af914a4e40610014b2b
Author: David Anderson <[email protected]>
Date:   Sat Jun 21 04:09:27 2014 -0700

    Quell MSVC C99 bugs.

commit f2e166c5925fda49b5abeadc0aa0f9156b99cf11
Author: David Anderson <[email protected]>
Date:   Sat Jun 21 03:59:23 2014 -0700

    Fix varying levels of stupid memory errors.

commit b0773d7be45345351ab1c1738681d5215a97f3f3
Author: David Anderson <[email protected]>
Date:   Sat Jun 21 03:36:39 2014 -0700

    Fix memory leak in parsing some control flow structures.

commit 5aca55713cfc2dd09c5900132fc4a6be51e3e309
Author: David Anderson <[email protected]>
Date:   Sat Jun 21 03:35:17 2014 -0700

    Fix memory leak in struct parsing.

commit b46ec5cd281b46177e83c4f0a4acac9cc1065c53
Author: David Anderson <[email protected]>
Date:   Sat Jun 21 03:32:03 2014 -0700

    Fix build.

commit 17bbbb9a46bfc00862adca7d3e15369a48e9ac0f
Merge: c083409 2107599
Author: David Anderson <[email protected]>
Date:   Sat Jun 21 01:26:27 2014 -0700

    Merge branch 'master' into methodmaps

commit c083409b569abff13f24d3b8c47f8ff199036840
Author: David Anderson <[email protected]>
Date:   Fri Jun 20 23:49:36 2014 -0700

    Add VS2k13 support.

commit b7993778494d538cb1c1965116030142a7f7765b
Author: David Anderson <[email protected]>
Date:   Fri Jun 20 01:28:08 2014 -0700

    Implement destructors.

commit 1a340dec260d079ed1b79351ed7b50b58a997cea
Author: David Anderson <[email protected]>
Date:   Fri Jun 20 00:08:04 2014 -0700

    Add some tests.

commit 12db52ee64eb009ead9294495e9034c63ab75b09
Author: David Anderson <[email protected]>
Date:   Fri Jun 20 00:05:49 2014 -0700

    Initial implementation of constructors.

commit 074669a658caa2822aa864164b615a244c00a0bc
Author: David Anderson <[email protected]>
Date:   Thu Jun 19 22:42:35 2014 -0700

    Add simple test harness.

commit 27c1e3cf14e1e6c5cf35c80c792cce2744b804d7
Author: David Anderson <[email protected]>
Date:   Thu Jun 19 22:15:42 2014 -0700

    Big refactoring for new syntax.

commit f3c37fdc919e76ee0815e2394cbe8d221f9fc0ca
Author: David Anderson <[email protected]>
Date:   Thu Jun 19 22:12:54 2014 -0700

    Refactor tests for the new syntax.

commit 6211f392f8e722b907474cf380cfac4347e46b8e
Author: David Anderson <[email protected]>
Date:   Wed Jun 18 22:25:48 2014 -0700

    Make lexer tokens an enum.

commit 5210b013756b0b00de3a61c6490685c768ff8cbd
Author: David Anderson <[email protected]>
Date:   Tue Jun 17 06:48:15 2014 -0700

    Add comment.

commit 06688ff4aced14077dd21a9cc1db4c26c7420ff3
Author: David Anderson <[email protected]>
Date:   Tue Jun 17 06:46:10 2014 -0700

    Allow |this| to be a base type of the methodmap.

commit 05cf3682020e0e6d9f47b1a0a6727b9edbfe7622
Author: David Anderson <[email protected]>
Date:   Mon Jun 16 22:11:58 2014 -0700

    Unify duplicate typesymbol checking.

commit 09161bf2691c8c1ed25b9b70fda01c336f21aa0b
Author: David Anderson <[email protected]>
Date:   Mon Jun 16 19:53:36 2014 -0700

    Close loophole that allowed methodmaps for enums.

commit 5bb4aeba89fec47a4de7a7532d27830999d1fcb4
Author: David Anderson <[email protected]>
Date:   Mon Jun 16 01:50:42 2014 -0700

    Add tests and dbi/handle changes.

commit b9203e2491daec2a8073874d6375949483778d14
Author: David Anderson <[email protected]>
Date:   Mon Jun 16 01:38:29 2014 -0700

    Ensure methodmap tags are fixed.

commit 878b80fd87a2ea500d3a28ce2d53f616d1efe5e8
Author: David Anderson <[email protected]>
Date:   Mon Jun 16 01:36:04 2014 -0700

    Implement inheritance.

commit 6ba9e004fbae18ad68056368ddd0affdc78659f1
Author: David Anderson <[email protected]>
Date:   Mon Jun 16 01:31:00 2014 -0700

    Refactor matchtag() to not be insane.

commit 4ede6343b0682c6df98fa869153828e92f891bcc
Author: David Anderson <[email protected]>
Date:   Mon Jun 16 01:20:50 2014 -0700

    Fix indenting.

commit e3ddef8916e3dd5f4ff0fe571d6e1c3acd163352
Author: David Anderson <[email protected]>
Date:   Mon Jun 16 01:20:27 2014 -0700

    Initial prototype.
2014-06-21 04:10:15 -07:00
Andrew f3299b2c8c Added a new function SetFilePermissions to set permissions of a file. I'm not sure about the Windows implementation. See this feature request: https://bugs.alliedmods.net/show_bug.cgi?id=6152 2014-06-21 00:45:07 -04:00
Nicholas Hastings fe485836f1 Remove redundant code. 2014-06-19 23:48:15 -04:00
Nicholas Hastings 1daf629a42 Remove dead variable. 2014-06-19 23:34:35 -04:00
Nicholas Hastings 151c6d246e Switch TF2 extension to hook CTFGameRules::IsHolidayActive for holiday forward (bug 6137). 2014-06-19 23:22:47 -04:00
Nicholas Hastings 210759907d Merge pull request #41 from alliedmodders/c++11
Enable C++11 on posix (r=dvander).
2014-06-19 21:20:13 -04:00
Nicholas Hastings 8b7ce5eed2 Enable C++ support on "like" gcc builds. 2014-06-19 20:59:15 -04:00
Nicholas Hastings 4a75be1c92 Fix KE_OVERRIDE typo in amtl (already fixed upstream). 2014-06-19 20:58:26 -04:00
Nicholas Hastings 3d114e5506 Update linux platform check in KePlatform.h to be consistent with others. 2014-06-19 20:57:54 -04:00
Nicholas Hastings 58158ce607 Merge pull request #40 from alliedmodders/fix-invalid-string-index
Fix FindStringIndex native not returning INVALID_STRING_INDEX when string not found (bug 6144, r=DS).
2014-06-19 14:40:16 -04:00
Nicholas Hastings 0f39825699 Merge pull request #39 from alliedmodders/outputs-getentclassname
Update SDKTools entity output functions to use core's GetEntityClassname instead of own (r=DS).
2014-06-19 14:39:49 -04:00
Nicholas Hastings 291ef6fdc4 Fix FindStringIndex native not returning INVALID_STRING_INDEX when string not found (bug 6144). 2014-06-19 11:40:01 -04:00
Nicholas Hastings 75254bbf25 Update SDKTools entity output functions to use core's GetEntityClassname instead of own. 2014-06-19 11:27:26 -04:00
Nicholas Hastings b0e466edae Revert "Disable FireOutput gamedata on TF2 until proper fix is found."
This reverts commit 9af7eefe07.
2014-06-19 00:34:41 -04:00
Nicholas Hastings e95309a603 Add early-exit in entity output detour if entity has no classname. 2014-06-19 00:33:54 -04:00
Nicholas Hastings 9af7eefe07 Disable FireOutput gamedata on TF2 until proper fix is found. 2014-06-18 23:16:20 -04:00
Nicholas Hastings b5c5aba588 Revert "Update TF2 FireOutput gamedata."
This reverts commit 633f219cf7.
2014-06-18 23:15:38 -04:00
Ryan Stecker 633f219cf7 Update TF2 FireOutput gamedata. 2014-06-18 22:01:59 -04:00
Nicholas Hastings 13f27821ad Bump version for master branch. 2014-06-18 19:24:06 -04:00
Nicholas Hastings 7553106eee Merge pull request #34 from WildCard65/Spacing
Added spacing to compile.sh (r=psychonic).
2014-06-17 21:44:05 -04:00
Nicholas Hastings 5cf73385c5 Merge pull request #37 from FlaminSarge/tf_weapon_enum_2014jun11
Update TF_WEAPON enum and tf2_stocks.inc (r=psychonic).
2014-06-17 16:52:11 -04:00
FlaminSarge 7a96467045 Update TF_WEAPON enum for June 11, 2014 TF2 Patch. 2014-06-15 00:30:53 -07:00
FlaminSarge 86c1660ee9 Fix line endings in tf2_stocks include. 2014-06-15 00:29:41 -07:00
WildCard65 8e4836f83a Added spacing to compile.sh
And made it exit out on compile error.
2014-06-14 08:32:24 -04:00
Nicholas Hastings 00c09584c7 Update Fistful of Frags gamedata. 2014-06-13 13:40:06 -04:00
Nicholas Hastings 7677e8af79 Merge pull request #27 from VoiDeD/convar-cache
Utilize convar cache for FindConVar (r=KyleS, r=psychonic)..
2014-06-12 19:47:33 -04:00
Kyle Sanderson 69cb941fa4 Merge pull request #25 from KyleSanderson/kylepreds
Replace SourceHook list usages in clientprefs with AMTL.
2014-06-12 15:42:30 -07:00
Nicholas Hastings 17a7d4802d Update TF2 SDKHooks Reload gamedata. 2014-06-12 10:00:49 -04:00
Nicholas Hastings 0b2610e3b3 Update CSGO Windows SetClanTag gamedata (bug 6150). 2014-06-12 09:56:50 -04:00
Nicholas Hastings 51a02652d8 Merge pull request #33 from alliedmodders/tf2-iservertools
Use updated IServerTools iface on TF2 for getting tempent list and FindEntityByClassname (PR #33, r=KyleS).
2014-06-11 23:43:48 -04:00
Nicholas Hastings e7870da5ff Add ifdef section notes on endifs. 2014-06-11 23:37:02 -04:00
Nicholas Hastings a697e81427 Use updated IServerTools iface on TF2 for getting tempent list and FindEntityByClassname. 2014-06-11 22:44:42 -04:00
Nicholas Hastings 5f8288dc70 Update TF2 CalcIsAttackCritical gamedata. 2014-06-11 17:48:51 -04:00
Nicholas Hastings feb5050df1 Merge pull request #5 from peace-maker/pawn_stringconcat
Add string literal concatenation using ellipses "..." (bug 4261, PR #5, r=dvander).
2014-06-11 08:16:04 -04:00
peace-maker 0d79b7a542 Merge pull request #2 from psychonic/pawn_stringconcat2
Fix build.
2014-06-11 08:48:41 +02:00
Nicholas Hastings e4328f9211 Fix build. 2014-06-10 12:30:04 -04:00
Kyle Sanderson 70518a8e49 Revert "Add better spacing to compile.sh"
This reverts commit cd106a7eb6.
2014-06-08 00:42:27 -07:00
David Anderson 6ac897f9f3 Merge pull request #26 from alliedmodders/sql-txn
Add an API for off-thread SQL transactions. (bug 3775, r=kyle)
2014-06-06 20:51:30 -07:00
Kyle Sanderson ec9791b183 Merge pull request #24 from 50Wliu/compile
Compile.sh spacing improvements
2014-06-06 19:52:56 -07:00
Ryan Stecker d5c267b291 Utilize convar cache for FindConVar. 2014-06-05 14:06:37 -05:00
David Anderson 3de533a73e Ignore .swp files. 2014-06-05 10:28:19 -07:00
David Anderson f1f135adb6 Add CloneHandle() test. 2014-06-05 10:27:59 -07:00
David Anderson 91077fdc91 Fix tab/space mix. 2014-06-05 10:16:47 -07:00
David Anderson f250461648 Fix typo. 2014-06-05 01:28:53 -07:00
David Anderson 6a98e40643 Fix typo. 2014-06-05 01:25:32 -07:00
David Anderson 36c342fc7b Add comment. 2014-06-05 01:22:44 -07:00
David Anderson 39ff3f9993 Add a rollback test. 2014-06-05 01:05:23 -07:00
David Anderson 7026e68b06 Add tests for SQL transactions. 2014-06-05 01:00:54 -07:00
David Anderson 25ea80890d Add testing.inc to packages. 2014-06-05 01:00:36 -07:00
David Anderson 2379c76b03 Add a new testing API for the testsuite. 2014-06-05 01:00:17 -07:00
David Anderson e6d8416f0e Fix typo. 2014-06-05 00:59:46 -07:00
David Anderson cb16a78681 Fix memory bugs. 2014-06-05 00:38:09 -07:00
David Anderson 2930fb1963 Change indentation. 2014-06-04 22:46:40 -07:00
David Anderson d7b49f7706 Initial implementation. 2014-06-04 22:45:26 -07:00
Kyle Sanderson 695fc802a9 Replace SourceHook list usages in clientprefs with AMTL. 2014-06-04 21:49:48 -07:00
Kyle Sanderson c37dbe131e Merge pull request #23 from KyleSanderson/gameextusage
Replace SH List usages in game extensions with AMTL variants.
2014-06-04 20:03:23 -07:00
Ruben Gonzalez 88af898285 Update CS:GO Gamedata 2014-06-04 22:40:21 -04:00
Wliu cd106a7eb6 Add better spacing to compile.sh 2014-06-04 22:00:10 -04:00
Kyle Sanderson 975fc93e1f Replace SourceHook list usages in tf with AMTL. 2014-06-04 17:36:53 -07:00
Kyle Sanderson 6c37a5d9f3 Replace SourceHook list usages in cstrike with AMTL. 2014-06-04 17:36:28 -07:00
SystematicMania 7b59b7f384 Fix "sm version" command reporting incorrect compile time in many cases (bug 6078, r=asherkin). 2014-06-03 15:55:25 -04:00
Nicholas Hastings 0ca218931a Trigger build again for hl2sdk-l4d and hl2sdk-dota changes. 2014-06-02 09:57:02 -04:00
Nicholas Hastings 1d9f769a42 Trigger build for hl2sdk-dota changes. 2014-06-02 09:30:25 -04:00
Scott Ehlert 083edcedc7 Merge pull request #22 from alliedmodders/css-clan-teamscore-mac
Update clan tag and team score offsets for cstrike ext on OS X.
2014-06-01 17:02:12 -05:00
Scott Ehlert fb5c3c86da Add clan tag and team score commands to cstrike test plugin. 2014-06-01 16:52:03 -05:00
Scott Ehlert 3c89f2b1c2 Update clan tag and team score offsets for cstrike ext on OS X. 2014-06-01 16:47:49 -05:00
Nicholas Hastings 4c7cf6ce06 Trigger build for hl2sdk-l4d changes. 2014-06-01 16:27:52 -04:00
David Anderson 195104487e Merge pull request #21 from alliedmodders/components
Convert build scripts to the new project-based API.
2014-05-31 21:02:33 -07:00
Nicholas Hastings 39993c7019 Merge pull request #20 from psychonic/bot-hibernation-disconnect
Fix case where bots leave server without disconnect notice (hibernation) (r=KyleS).
2014-05-31 23:00:03 -04:00
David Anderson 897aa42135 Remove tag(). 2014-05-31 19:59:02 -07:00
David Anderson abdf7d5b07 Port build scripts to the new project API. 2014-05-31 19:56:42 -07:00
David Anderson 9f8f879590 Fix typo. 2014-05-31 18:12:49 -07:00
David Anderson db14d2d00a Factor out versioning. 2014-05-31 17:57:53 -07:00
Nicholas Hastings a0f3410f3b Fix a case where bots can leave server without disconnect notice (hibernation), triggering other issues. 2014-05-31 15:18:17 -04:00
David Anderson 4159e1a177 Merge pull request #19 from alliedmodders/update-build-scrpt
Update the build script to the latest AMBuild API.
2014-05-30 22:55:49 -07:00
David Anderson 4f7b0ff487 Update the build script to the latest AMBuild API. 2014-05-30 22:50:35 -07:00
Asher Baker 891ebe4480 Merge pull request #18 from asherkin/version-count
Revert to using revision count for full version strings (r=dvander).
2014-05-31 04:44:51 +01:00
David Anderson 859be35b34 Fix build. 2014-05-30 19:49:54 -07:00
Asher Baker 88c452581b Revert to using revision count for full version strings. 2014-05-31 03:28:09 +01:00
David Anderson b0ccc87638 Merge pull request #17 from alliedmodders/vsgen
Add support for the preliminary IDE project file generator.
2014-05-30 19:18:40 -07:00
David Anderson 1e6843f8db Add support for the preliminary IDE project file generator. 2014-05-30 19:07:56 -07:00
Nicholas Hastings 76a589f689 Merge pull request #16 from psychonic/client-disconnect-quirks
Fix inconsistencies with OnClientDisconnected calls (bug 5988, r=kyles)
2014-05-30 19:09:50 -04:00
Nicholas Hastings e7621ad8a7 Fix inconsistencies with OnClientDisconnected calls (bug 5988) 2014-05-30 17:45:49 -04:00
Nicholas Hastings c4232510a1 Merge pull request #15 from 50Wliu/contributing
Create CONTRIBUTING.md (r=psychonic).
2014-05-29 23:27:12 -04:00
Wliu e2878d3df8 Create CONTRIBUTING.md
As discussed in #11.
2014-05-29 17:49:18 -04:00
Nicholas Hastings 5cb10441d7 Merge pull request #7 from Bara20/patch-1
Add CS_DMG_HEADSHOT define (r=psychonic).
2014-05-29 15:39:33 -04:00
Nicholas Hastings 6ee42dc7fe Really fix Mac build. 2014-05-29 15:09:38 -04:00
Nicholas Hastings e0f6544c86 Fix Mac build. 2014-05-29 14:16:11 -04:00
Asher Baker ab68e70998 Merge pull request #14 from psychonic/rip-magic
Replace magic numbers for sm_show_activity with named constants (r=asherkin).
2014-05-29 19:06:22 +01:00
Asher Baker 8be1feadc1 Merge pull request #13 from psychonic/adminsys2logic
Move adminsys and more natives from core to logic (r=asherkin).
2014-05-29 19:04:40 +01:00
Nicholas Hastings beb3f8c1d4 Replace magic numbers for sm_show_activity with named constants. 2014-05-29 13:54:51 -04:00
Nicholas Hastings 35784c018d Move adminsys and more natives from core to logic. 2014-05-29 13:31:12 -04:00
Ruben Gonzalez dc4c3f2f1a Update CS:GO Gamedata 2014-05-29 09:31:07 -04:00
Nicholas Hastings 9ff6cdef8c Merge pull request #12 from psychonic/more2logic
Move many player natives from core to logic.
2014-05-29 00:51:29 -04:00
Nicholas Hastings dbc881143b Move many player natives from core to logic. 2014-05-28 23:20:41 -04:00
Kyle Sanderson 556d5e0949 Merge pull request #9 from KyleSanderson/amtlutilloudness
Quell isNaN MSVC performance warning.
2014-05-28 18:12:32 -07:00
Nicholas Hastings 6456b937be Fix build. 2014-05-28 21:10:40 -04:00
Kyle Sanderson 05d8622ea9 Quell isNaN MSVC performance warning. 2014-05-28 18:05:55 -07:00
Nicholas Hastings f1387c892e Merge pull request #10 from psychonic/platform-defs
Fix up PLATFORM defs to match same-name ones in some SDK versions.
2014-05-28 21:01:17 -04:00
Nicholas Hastings cae5d48d31 Merge pull request #8 from psychonic/travis-ci
Add support for Travis-CI
2014-05-28 20:56:14 -04:00
Nicholas Hastings d83d72fd88 Give define value (of 1) to PLATFORM defs to match the same-name defs in some SDKs. 2014-05-28 20:36:52 -04:00
Nicholas Hastings ff42e854bb Add Travis-CI config file. 2014-05-28 14:38:55 -04:00
Nicholas Hastings a462feee61 Fix version script failing when HEAD directly contains hash instead of ref to it. 2014-05-28 14:38:17 -04:00
Bara 5eef4bccd3 Add CS_DMG_HEADSHOT define
but i don't know if it works in other games.

( I'm using this already in my only headshot plugin - https://forums.alliedmods.net/showthread.php?t=234169 and works fine in CSS/CSGO )
2014-05-28 15:32:58 +02:00
David Anderson 609fa50763 Revert "Add string literal concatenation using ellipses "..." (bug 4261, PR #5)"
This reverts commit 7868767dde.
2014-05-27 19:45:26 -07:00
Peace-Maker 7868767dde Add string literal concatenation using ellipses "..." (bug 4261, PR #5)
commit cd0d31805c
Author: Peace-Maker <[email protected]>
Date:   Wed May 28 03:07:25 2014 +0200

    Ignore \ ctrlchar in lexing

commit cf617a4d20
Author: Peace-Maker <[email protected]>
Date:   Tue May 27 13:32:59 2014 +0200

    Add string literal concatenation using ellipses "..." (bug 4261)

    Backported the changes CompuPhase did to the compiler to support string
    literal concatenation including all fixes in later commits from r30 on.
    http://code.google.com/p/pawnscript/source/detail?r=30

    Pawn uses ellipses "..." to concatenate so it looks like this:

    #define PROJECT_AUTHOR "Greyscale"
    #define PROJECT_COPYRIGHT "Copyright (C) 2010  " ... PROJECT_AUTHOR

    This would result in PROJECT_COPYRIGHT being defined as
    "Copyright (C) 2010  Greyscale"

    While i've been at it, that stringizing a macro parameter feature was
    ported too.
    From the changelog for version 3.3.4026
    (http://www.compuphase.com/pawn/pawnhistory.htm):

    The macro substition processor now recognizes the "#" character for
    "stringizing" a parameter. For example, if you have the definition
    #define log(%1) #%1
    Then the expression log(test) will result in "test".
    Note that concatenation of literal strings requires an ellipsis in pawn
    (which is different than C/C++). So to combine the parameter with
    literal strings, use a syntax like:
    #define log(%1) "logging: " ... #%1 ... "\n"
    The stringize operator is only available in the replacement text of a
    macro.

    Doing
    PrintToServer(log(hello));
    would print
    logging: hello\n
2014-05-27 19:30:13 -07:00
Peace-Maker 6ac013376f Call OnLibraryAdded for all available libraries (bug 5925, PR #4)
commit c1b064c9232553045f6f5bfaf7df0feb6ceb4571
Author: Peace-Maker <[email protected]>
Date:   Wed May 28 03:16:22 2014 +0200

    Coding style adjustments

commit 37a16dbba24cc2035fb8838be8729067cb9bc13a
Author: Peace-Maker <[email protected]>
Date:   Wed May 28 03:03:25 2014 +0200

    Load core.phrases before calling OnLibraryAdded

commit 676ac951111c7e8f565debbd4316850a4c4a8d00
Author: Peace-Maker <[email protected]>
Date:   Tue May 27 13:18:48 2014 +0200

    Call OnLibraryAdded for all available librarys (bug 5925)

    When loading multiple plugins at once (on server start or mapchange)
    OnLibraryAdded is only called for libraries which are loaded after the
    current plugin. The plugin isn't informed about the libraries that were
    added before its OnPluginStart forward was called.

    This patch calls OnLibraryAdded for all already registered libraries the
    current plugin has missed.
2014-05-27 19:26:58 -07:00
David Anderson cfde247ef7 Revert "Call OnLibraryAdded for all available librarys (bug 5925, pull request #4)"
This reverts commit ac11eb8910.
2014-05-27 19:25:52 -07:00
David Anderson ac11eb8910 Call OnLibraryAdded for all available librarys (bug 5925, pull request #4)
commit c1b064c9232553045f6f5bfaf7df0feb6ceb4571
Author: Peace-Maker <[email protected]>
Date:   Wed May 28 03:16:22 2014 +0200

    Coding style adjustments

commit 37a16dbba24cc2035fb8838be8729067cb9bc13a
Author: Peace-Maker <[email protected]>
Date:   Wed May 28 03:03:25 2014 +0200

    Load core.phrases before calling OnLibraryAdded

commit 676ac951111c7e8f565debbd4316850a4c4a8d00
Author: Peace-Maker <[email protected]>
Date:   Tue May 27 13:18:48 2014 +0200

    Call OnLibraryAdded for all available librarys (bug 5925)

    When loading multiple plugins at once (on server start or mapchange)
    OnLibraryAdded is only called for libraries which are loaded after the
    current plugin. The plugin isn't informed about the libraries that were
    added before its OnPluginStart forward was called.

    This patch calls OnLibraryAdded for all already registered libraries the
    current plugin has missed.
2014-05-27 19:24:33 -07:00
Peace-Maker cd0d31805c Ignore \ ctrlchar in lexing 2014-05-28 03:07:25 +02:00
Peace-Maker cf617a4d20 Add string literal concatenation using ellipses "..." (bug 4261)
Backported the changes CompuPhase did to the compiler to support string
literal concatenation including all fixes in later commits from r30 on.
http://code.google.com/p/pawnscript/source/detail?r=30

Pawn uses ellipses "..." to concatenate so it looks like this:

#define PROJECT_AUTHOR "Greyscale"
#define PROJECT_COPYRIGHT "Copyright (C) 2010  " ... PROJECT_AUTHOR

This would result in PROJECT_COPYRIGHT being defined as
"Copyright (C) 2010  Greyscale"

While i've been at it, that stringizing a macro parameter feature was
ported too.
From the changelog for version 3.3.4026
(http://www.compuphase.com/pawn/pawnhistory.htm):

The macro substition processor now recognizes the "#" character for
"stringizing" a parameter. For example, if you have the definition
#define log(%1) #%1
Then the expression log(test) will result in "test".
Note that concatenation of literal strings requires an ellipsis in pawn
(which is different than C/C++). So to combine the parameter with
literal strings, use a syntax like:
#define log(%1) "logging: " ... #%1 ... "\n"
The stringize operator is only available in the replacement text of a
macro.

Doing
PrintToServer(log(hello));
would print
logging: hello\n
2014-05-27 13:32:59 +02:00
Fyren 84de0f6b85 and maybe also a hyphen 2014-05-27 01:09:12 -06:00
Fyren 914a0a7fc1 FYREN SMASH CAPITALS 2014-05-27 01:08:47 -06:00
Fyren f82420b601 bets on if I do any better than Kyle? 2014-05-27 01:08:15 -06:00
Kyle Sanderson 5193b70ada Update README.md with community hyper links. 2014-05-26 23:23:39 -07:00
David Anderson 4b2b50a3df Fix spacing. 2014-05-26 22:21:27 -07:00
David Anderson 9ed3a55ade Fix build. 2014-05-26 22:17:58 -07:00
David Anderson 53a8d5ac30 Merge pull request #3 from alliedmodders/search-paths
Add search path configuration options.
2014-05-26 21:39:22 -07:00
David Anderson b4144d2cff Find metamod-source over mmsource-central. 2014-05-26 21:38:08 -07:00
David Anderson 5bbcc7322c Add path configuration options. 2014-05-26 21:30:43 -07:00
David Anderson 3f81397a84 Delete master.cfg 2014-05-26 10:06:27 -07:00
David Anderson c744b39c6d Merge pull request #2 from alliedmodders/git-buildbot
Switch packaging scripts to Git.
2014-05-25 12:11:01 -07:00
David Anderson 1a97d37215 Fix spacing. 2014-05-25 12:10:25 -07:00
David Anderson 2bc7e4736f Switch packaging scripts to Git. 2014-05-25 12:05:24 -07:00
David Anderson 5681b99fd8 Merge pull request #1 from alliedmodders/git-mv
Switch build infrastructure to Git.
2014-05-25 11:03:23 -07:00
David Anderson 9a5efc2de2 Fix. 2014-05-25 03:41:44 -07:00
David Anderson 692af52ea7 Fix typo. 2014-05-25 03:25:52 -07:00
David Anderson ee51295d22 Simplify formatting. 2014-05-25 03:20:50 -07:00
David Anderson 3c7a08afc2 Change version display. 2014-05-25 03:18:05 -07:00
David Anderson ed9ca9e943 Add rev-list --count back into the build "unique" id. 2014-05-25 03:03:22 -07:00
David Anderson fbaa3a804f Make SDK keys consistent. 2014-05-25 02:14:05 -07:00
David Anderson 9f0308530c Remove reference to SM_BUILD_REV. 2014-05-25 01:57:42 -07:00
David Anderson 2e89d91a86 Switch build infrastructure to Git. 2014-05-25 01:53:58 -07:00
Scott Ehlert e20e4677df Replace .hgignore with .gitignore. 2014-05-24 23:55:24 -05:00
David Anderson 97c581f72c Delete .hgtags 2014-05-24 20:09:17 -07:00
David Anderson c079a3b58a Delete NOTICE.txt 2014-05-24 20:09:04 -07:00
David Anderson c6de58aa05 Create README.md 2014-05-24 20:08:46 -07:00
Ruben Gonzalez 4fd0e3acd8 Update CS:GO team score gamedata. 2014-05-22 09:49:27 -04:00
Nicholas Hastings 3145daa46a Trigger build for hl2sdk-l4d changes. 2014-05-21 17:25:30 -04:00
Nicholas Hastings 3c52840dd8 Add CS_SLOT_KNIFE define (bug 6131, r=drifter). 2014-05-21 09:08:53 -04:00
Ruben Gonzalez 8ed66980c0 Update for hl2sdk-l4d changes. 2014-05-21 00:09:53 -04:00
Kyle Sanderson 365da7fef6 GCC build fix. 2014-05-20 20:33:50 -07:00
Ruben Gonzalez 9af5023a8f Update CStrike ext Windows Terrorist team score offset (bug 6129). 2014-05-18 21:45:08 -04:00
Scott Ehlert 878201c631 Add obj-*/ build directories to hgignore. 2014-05-17 15:25:45 -05:00
Scott Ehlert e65d11f4de Remove --package-debug configure option.
It is no longer needed since debugging symbols should be present in binaries by default now.
2014-05-17 15:11:11 -05:00
Scott Ehlert 1a89edec47 Add --symbol-files option to AMBuild configure. 2014-05-17 15:05:58 -05:00
Ryan Stecker 1143b3f56f Updated IServer gamedata. (r=asherkin)
--HG--
extra : amend_source : e907eac94dcfeac43a91ee317688a1a9bf9b8e75
2014-05-16 07:01:04 +01:00
Ruben Gonzalez 1b4017c6b7 Fix HandleCommand_BuyInternal sig for CS:S 2014-05-16 00:31:07 -04:00
Ruben Gonzalez 15224c6df5 Update windows CS:S gamedata 2014-05-16 00:23:26 -04:00
Ruben Gonzalez e831757313 Update windows CS:S gamedata 2014-05-16 00:13:23 -04:00
Ryan Stecker a47388ff76 Actually update Windows RemoveCondition for TF update. 2014-05-15 20:10:40 -07:00
Ryan Stecker 71f4f36f8c Further update Windows gamedata for TF conditions. 2014-05-15 19:44:19 -07:00
Ryan Stecker a4e387331a Update Windows gamedata for TF update. 2014-05-15 18:58:24 -07:00
Ruben Gonzalez defdc617b3 Update gamedata for CS:S update. 2014-05-15 21:22:24 -04:00
Nicholas Hastings 61b6a32631 Fix crash in ReconnectClient and Inactivate client when IServer ptr is null (bug 6122, r=asherkin).
--HG--
extra : amend_source : a38ac59091e43118d61b9c3eda30dece4190992e
2014-05-15 10:49:32 -04:00
Nicholas Hastings 1fdf1c0264 Update CS:GO IServer Windows gamedata (bug 6122).
--HG--
extra : rebase_source : 6d074a4d607fbc2c3e3e1ce752a8060ca934808b
2014-05-15 10:45:43 -04:00
Peace-Maker 32f019c70c Fix Mapchooser dying on single map rotation servers (bug 5179, r=kyles). 2014-05-13 13:44:14 -07:00
Kyle Sanderson 9c62e94239 Optimize native call if statically bound (bug 5842, r=ds,fyren f=dvander).
Original patch written by David Anderson (original r from Fyren).
- Updated to function with the current JIT compiler.
- Took in clean-ups from later-dated patches.
2014-05-11 14:36:32 -07:00
Nicholas Hastings b4ff034ac2 Fix passing invalid ent to OnEntity forwards (bug 6119, r=KyleS).
--HG--
extra : rebase_source : f5477d7d36ef579c40b0547389e8eccaf129f69e
2014-05-10 22:21:42 -04:00
Nicholas Hastings 6b27a7fe46 Consolidate duplicate OnEntityCreated logic (bug 6119, r=KyleS).
--HG--
extra : rebase_source : b0f563081c5d98c3fbc2769ee89e3ce0ec093624
2014-05-10 22:21:42 -04:00
Nicholas Hastings adc9569e23 Fix clients being invalid when passed to OnEntityDestroyed (bug 6119, r=KyleS).
--HG--
extra : rebase_source : 546168635b7e7cd8f8c4302858aa258025444dfd
2014-05-10 22:21:38 -04:00
Peace-Maker 4cd6c37ab5 Remove LogMessageEx definition from logging.inc (bug 5897, r=kyles). 2014-05-10 05:42:33 -07:00
Kyle Sanderson f15234e4f8 Changed EventHook name storage to use AString (bug 6188, r=psychonic). 2014-05-10 02:40:08 -07:00
David Anderson 29ff05bd62 Fix compiler bug with multidimensional array variable release (bug 6100, r=fyren).
--HG--
extra : rebase_source : 3f3c366fd8c47268ecd0df5907b68d3c879a5e60
2014-05-09 23:17:14 -04:00
Peace-Maker e9b4a6e96c Add DisplayTopMenuCategory native (bug 6033, r=dvander). 2014-05-09 12:32:49 -07:00
Peace-Maker 530078b3ae Add ability to disable TopMenu Title Caching (bug 6034, r=dvander). 2014-05-09 12:30:52 -07:00
Peace-Maker 5149205109 Clear default driver reference if unloaded (bug 5934, r=dvander). 2014-05-09 10:36:58 -07:00
Kyle Sanderson 55b77a1925 Return the 'd' to ClientPrefs::AreClientCookiesPening (r=asherkin). 2014-05-09 09:34:29 -07:00
Ruben Gonzalez bc5691c4b6 Update CS:GO gamedata 2014-05-08 08:33:13 -04:00
Nicholas Hastings 0513f93f9d Add PrepSDKCall_SetAddress and Address support to PrepSDKCall_SetFromConf (bug 5261, r=asherkin). 2014-05-07 12:58:16 -04:00
Kyle Sanderson b5decd8a50 Build Fix. 2014-05-06 18:48:53 -07:00
Kyle Sanderson b1901da79f Unify Maximum supported clients, raised SDKTools limit (bug 5964, r=psychonic). 2014-05-06 18:40:35 -07:00
Nicholas Hastings 6f47b1a89d Update GroundEntChanged offset for some games. 2014-05-05 11:54:12 -04:00
Peace-Maker cec703a059 Change hook prototype of GroundEntChanged to include void* parameter (bug 6050, r=psychonic). 2014-05-05 11:40:42 -04:00
Nicholas Hastings 217eb68455 Fix Dota SDKHooks EntityListenersFinder signature. 2014-05-05 10:32:21 -04:00
Nicholas Hastings f0d6fd1912 Fix usage of replace param in SetTrieArray (bug 6113, r=asherkin). 2014-05-04 21:38:32 -04:00
Nicholas Hastings b0061ece62 Trigger build for Dota INetChannelInfo changes. 2014-05-04 10:42:12 -04:00
Nicholas Hastings 0b6603ab2b Update Fistful of Frags gamedata. 2014-05-01 11:11:46 -04:00
Nicholas Hastings 09546b0d2a Update Dota 2 gamedata. 2014-04-30 13:18:46 -04:00
Nicholas Hastings 799ee7b9c6 Trigger build again for hl2sdk-csgo changes. 2014-04-24 10:04:24 -04:00
Scott Ehlert b0b28b7a6e Fix Linux and Windows builds. 2014-04-23 21:53:58 -05:00
Nicholas Hastings bbe7a9dd6a Trigger build for hl2sdk-csgo changes. 2014-04-23 22:28:41 -04:00
Scott Ehlert ecec7dbef3 Deduplicate a number of files used by extensions by moving them to the public directory (bug 5341, r=psychonic).
These files include smsdk_ext.cpp, smsdk_ext.h, sm_memtable.h, CDetour/*, and asm/*.
The smsdk_config.h file for each extension has also been moved out of the 'sdk' directory into its parent.

--HG--
rename : extensions/bintools/sdk/smsdk_config.h => extensions/bintools/smsdk_config.h
rename : extensions/clientprefs/sdk/smsdk_config.h => extensions/clientprefs/smsdk_config.h
rename : extensions/cstrike/sdk/smsdk_config.h => extensions/cstrike/smsdk_config.h
rename : extensions/curl/sdk/smsdk_config.h => extensions/curl/smsdk_config.h
rename : extensions/geoip/sdk/smsdk_config.h => extensions/geoip/smsdk_config.h
rename : extensions/mysql/sdk/smsdk_config.h => extensions/mysql/smsdk_config.h
rename : extensions/regex/sdk/smsdk_config.h => extensions/regex/smsdk_config.h
rename : extensions/sdkhooks/sdk/smsdk_config.h => extensions/sdkhooks/smsdk_config.h
rename : extensions/sdktools/sdk/smsdk_config.h => extensions/sdktools/smsdk_config.h
rename : extensions/sqlite/sdk/smsdk_config.h => extensions/sqlite/smsdk_config.h
rename : extensions/structs/sdk/smsdk_config.h => extensions/structs/smsdk_config.h
rename : extensions/tf2/sdk/smsdk_config.h => extensions/tf2/smsdk_config.h
rename : extensions/topmenus/sdk/smsdk_config.h => extensions/topmenus/smsdk_config.h
rename : extensions/updater/sdk/smsdk_config.h => extensions/updater/smsdk_config.h
rename : extensions/sdktools/CDetour/detourhelpers.h => public/CDetour/detourhelpers.h
rename : extensions/sdktools/CDetour/detours.cpp => public/CDetour/detours.cpp
rename : extensions/sdktools/CDetour/detours.h => public/CDetour/detours.h
rename : extensions/sdktools/asm/asm.c => public/asm/asm.c
rename : extensions/sdktools/asm/asm.h => public/asm/asm.h
rename : public/sample_ext/sdk/smsdk_config.h => public/sample_ext/smsdk_config.h
rename : core/logic/sm_memtable.h => public/sm_memtable.h
rename : public/sample_ext/sdk/smsdk_ext.cpp => public/smsdk_ext.cpp
rename : public/sample_ext/sdk/smsdk_ext.h => public/smsdk_ext.h
2014-04-23 21:19:28 -05:00
Nicholas Hastings d66a7b0ee0 Update CS:GO gamedata. 2014-04-23 21:40:50 -04:00
David Anderson 61c4d2b805 Fix typo pointed out by Nephrite (bug 6107, comment #7).
--HG--
extra : rebase_source : 9e62da715c2560dd102644b04b5d46413d100890
2014-04-23 10:18:56 -07:00
Peace-Maker 73d8072693 Mark CS:S as supporting HudMsg (bug 6108, r=psychonic).
--HG--
extra : rebase_source : 90340b31b76cc855e1a74c3012ba568786084086
2014-04-23 08:55:09 -04:00
David Anderson c64edf31fc Fix Windows build, again. 2014-04-22 20:04:12 -07:00
David Anderson cb32e3d8f9 Fix Windows build. 2014-04-22 19:46:55 -07:00
David Anderson e69e9eddc7 Change float comparison operators to return false for NaN (bug 6107, r=ds).
--HG--
extra : rebase_source : a11c56fb23d6617545def3591ec6100dd143eb3e
2014-04-22 19:40:45 -07:00
Scott Ehlert aa85a1866e Update checkout-deps script for Contagion on Windows (NPOTB). 2014-04-20 00:37:20 -05:00
Scott Ehlert 623925a1cf Fix downloading of ambuild using the checkout-deps script (NPOTB). 2014-04-20 00:37:19 -05:00
David Anderson b6792a2c8c Sync am-vector.h with AMTL (fix bug 6090).
--HG--
extra : rebase_source : f27515a516db9bc14779da3721f6378d573584b5
2014-04-19 19:21:40 -07:00
Nicholas Hastings 7248ad9aba Update Nuclear Dawn gamedata. 2014-04-20 21:38:40 -04:00
Nicholas Hastings d44b8aa853 Fix uninit'd GetCommandLine ptr in event that tier0 is not found. 2014-04-20 21:07:28 -04:00
Nicholas Hastings f8d6ecbc02 Fix Nuclear Dawn ICommandLine lookup on Linux. 2014-04-20 21:06:45 -04:00
Nicholas Hastings bd76558b94 Add missing GAMEFIX define for Nuclear Dawn. 2014-04-20 15:59:23 -04:00
Nicholas Hastings 63451b7b6b Update for hl2sdk-nd changes. 2014-04-20 12:00:04 -04:00
Nicholas Hastings edc42800ba Update CS:S gamedata. 2014-04-20 08:18:39 -04:00
Nicholas Hastings 0608d47219 Update for Dota IClient changes. 2014-04-09 13:17:18 -04:00
Powerlord 5efb5068cd Add new TF2_IsHolidayActive native to TF2 Ext (bug 6095, r=psychonic). 2014-04-07 23:17:11 -04:00
Powerlord 14f31006c1 Update TF2 Ext IsHolidayActive detour to use TF_IsHolidayActive (bug 6094, r=psychonic). 2014-04-07 23:16:17 -04:00
Powerlord 90c8440f17 Add TFHoliday_AprilFools to TFHoliday enum (bug 6092, r=psychonic). 2014-04-07 23:15:13 -04:00
Ondrej Hošek c3e9d7de41 Add support for single-file gamedata custom overrides (bug 5386, r=psychonic). 2014-04-07 12:14:26 -04:00
Nicholas Hastings 9badb14c3a Update for Dota IServerGameClient changes. 2014-04-06 17:03:29 -04:00
Nicholas Hastings 655994cd09 Fix doc style on two native comments to fix detection in our api parser. 2014-04-06 17:03:14 -04:00
Nicholas Hastings 217ca928d5 Move funcommands material and sound defs to gamedata (bug 6085, r=asherkin). 2014-03-29 15:07:07 -04:00
Nicholas Hastings fdae6cf1b0 Backed out changeset: fe0e55c4d544 2014-03-30 14:07:14 -04:00
Nicholas Hastings e708cdf28c Fix FindFlagChar giving '?' for Admin_Custom6 (nobug, r=asherkin). 2014-03-30 12:41:07 -04:00
Nicholas Hastings 2d616a5995 Add curl ext build dirs to .hgignore (NPOTB). 2014-03-30 12:19:26 -04:00
Nicholas Hastings 563dd617af Add sm_reload_translations command (bug 5750, r=asherkin). 2014-03-30 12:08:11 -04:00
Nicholas Hastings 2c399ec441 Move funcommands material and sound defs to gamedata. 2014-03-29 15:07:07 -04:00
Nicholas Hastings 57067d38fe Print SendProp flags in netprop dump (bug 6082, r=asherkin). 2014-03-29 14:23:16 -04:00
Nicholas Hastings 2f6b64e92e Make IGameConfig::GetMemSig return value clearer (bug 6081, r=asherkin). 2014-03-29 14:22:53 -04:00
Nicholas Hastings 00b06313c9 Add gamedata for Contagion (bug 6007, r=asherkin). 2014-03-29 14:14:00 -04:00
Nicholas Hastings 2b015a1d5b Add support for Contagion (bug 6007, r=asherkin). 2014-03-29 14:14:00 -04:00
SystematicMania 010220ea25 No longer require clients to be ingame for INetChannelInfo natives (bug 5775, r=psychonic). 2014-03-27 22:52:16 -04:00
Nicholas Hastings 95a56972a1 Update Empires Mod gamedata. 2014-03-27 22:23:22 -04:00
SystematicMania a8ff00bc34 Switch more base plugins to OnClientSayCommand from say hooks (bug 5986, r=psychonic).
--HG--
extra : rebase_source : 7ff7d92f9d060ac69d0652d643f08e7d81946e49
2014-03-25 11:57:00 -04:00
Kyle Sanderson 9abac06e85 Change SDKHooks to VTable Hooks (bug 6070, r=psychonic). 2014-03-23 22:11:06 -06:00
Nicholas Hastings ee595978f8 Fix StoreFromAddress and LoadFromAddress continuing with bad values after error (bug 6080, r=asherkin). 2014-03-23 17:07:51 -04:00
Nicholas Hastings 49d769282b Fix compile error in DisplayAskConnectBox stock (bug 5984). 2014-03-22 17:06:37 -04:00
Nicholas Hastings 451c90b932 Improve logical entity support in SDKHooks natives (bug 6069, r=asherkin). 2014-03-21 22:09:15 -04:00
Nicholas Hastings 9215ddcf8a Add PbRemoveRepeatedFieldValue native (bug 6066, r=asherkin). 2014-03-21 13:23:48 -04:00
Nicholas Hastings fb0fd0c6d2 Fix Alien Swarm EntityListeners gamedata for SDKHooks (bug 6059). 2014-03-21 13:10:44 -04:00
Nicholas Hastings 9c1902b0e3 Fix missing compile.exe and unecessary compile.sh in Windows package (bug 6047, r=asherkin). 2014-03-21 12:30:47 -04:00
FlaminSarge cf8d05ae98 Add support for passwords to DisplayAskConnectBox stock (bug 5984, r=psychonic). 2014-03-21 12:14:08 -04:00
Nicholas Hastings 8c513faad5 Fix non-msvc build. 2014-03-21 12:08:17 -04:00
Nicholas Hastings 6e8d9ff788 Record inline function debug info in PDB files (r=asherkin). 2014-03-21 12:04:41 -04:00
Nicholas Hastings 0e6cbf989e Add default infinite value for TF2_AddCondition duration (nobug, r=asherkin). 2014-03-21 12:03:49 -04:00
Nicholas Hastings d6bbb765c1 Add hack to not throw error on FEBC not found if not attempted to be found (nobug, r=asherkin). 2014-03-21 12:03:19 -04:00
Peace-Maker b411b60ed7 Update GoldenEye: Source gamedata.
--HG--
extra : rebase_source : ea8e83bb0a1dbf73d8f573fb8746a71315ca4ee4
2014-03-17 10:01:17 -04:00
Scott Ehlert 692cafa784 Update checkout-deps script for Dota 2 on Linux and Mac OS X. 2014-03-14 05:21:12 -05:00
Nicholas Hastings 6600a8c60b Use https for checkout-deps clones of AM repos (npotb). 2014-03-13 20:40:51 -04:00
Ruben Gonzalez cebede3a79 Update CS:GO gamedata 2014-03-10 18:56:34 -04:00
Nicholas Hastings db756f482b Fix SDKHooks TraceAttack hook crashing on SDK 2013 mods. 2014-03-08 22:06:29 -05:00
Kyle Sanderson cd349946e8 Fix FakeClientCommandEx always leaking memory (bug 5678, r=psychonic). 2014-03-08 19:50:55 -07:00
Nicholas Hastings b4156a19c3 Fix TE_* natives operating on incorrect data for some tempents (bug 6072, r=fyren). 2014-03-08 19:46:49 -05:00
Nicholas Hastings b3e2647dc4 Fix IgniteEntity crash on NMRiH. 2014-03-08 01:04:49 -05:00
Nicholas Hastings e9f0d1f513 Update CPlayer::Kick for hl2sdk-csgo IClient changes. 2014-03-06 21:33:18 -05:00
Nicholas Hastings 21cae97820 Trigger build for hl2sdk-csgo IClient change. 2014-03-06 21:25:30 -05:00
Nicholas Hastings 74989d925e Fix Dota 2 gEntList gamedata on Linux and Mac.
--HG--
extra : rebase_source : abbc60d623f55b3465e821a177df6af534eda2b4
2014-03-05 20:42:54 -05:00
Scott Ehlert b402d77ff9 Trigger build for ILoggingListener update for Dota 2. 2014-03-05 18:43:51 -06:00
Scott Ehlert 8431925577 Fix upload set for builds. 2014-03-03 05:21:50 -06:00
Scott Ehlert 22e8b53029 Add gamedata for EntityFactoryDictionary and IServer for Dota 2 on Linux (bug 6068, r=psychonic). 2014-03-03 05:20:40 -06:00
Nicholas Hastings aa75fd24d8 Add Linux and Mac gamedata for Dota 2 and update Windows gamedata (bug 6068). 2014-03-03 05:20:40 -06:00
Scott Ehlert f8f4cebe9e Add support for Dota 2 on Linux and Mac OS X (bug 6068, r=psychonic). 2014-03-03 05:20:38 -06:00
Scott Ehlert 7d7db6d5bb Trigger build. 2014-03-01 20:12:48 -06:00
Kyle Sanderson 38bbb8580f Move PlayerRunCmd to a global VTable Hook (bug 6051, r=psychonic). 2014-03-01 14:25:35 -07:00
Nicholas Hastings 8a7af5ba0d Trigger full rebuild. 2014-03-01 11:00:52 -05:00
Nicholas Hastings a98d277cf3 Remove unused variables (nobug, r=askerin). 2014-02-28 20:45:03 -05:00
Nicholas Hastings 3c6dd2cb79 Choose correct libprotobuf build for current msvc version on Windows. 2014-02-28 20:44:10 -05:00
Nicholas Hastings 5b96047ce8 Enable SDK "COMPILER_*" defines for all builds (nobug, r=asherkin). 2014-02-28 20:43:07 -05:00
Nicholas Hastings 692f597808 Update SDKHooks CTakeDamageInfoHack for SDK updates. 2014-02-28 15:03:53 -05:00
SystematicMania 10f878d8c7 Fix regressions in b2f7d97b1ea7 and update plugins for OnClientSayCommand changes (bug 5986, r=psychonic). 2014-02-28 10:38:36 -05:00
Nicholas Hastings 8987a34078 Fix ep1 and darkm builds (bug 5986).
--HG--
extra : amend_source : 719c0f37249744104d670c56addc112d704a1fad
2014-02-27 23:46:51 -05:00
SystematicMania ba99d0154b Strip quotes from chat forwards (bug 5986, r=psychonic). 2014-02-27 23:06:02 -05:00
Kyle Sanderson 977bf4d583 Fix Anti-Flood resolution of gametime (bug 5394, r=psychonic). 2014-02-27 20:49:19 -07:00
Ruben Gonzalez 06efa7c52b Update gamedata for CS:GO 2014-02-27 22:17:32 -05:00
Kyle Sanderson 84d58ff421 Remove unfinished ConVar queries on client disconnect (bug 6003, r=psychonic). 2014-02-27 19:55:13 -07:00
SystematicMania c679b97e5f Allow non-silent chat triggers to go through OnClientSayCommand (bug 5926, r=psychonic). 2014-02-27 20:22:01 -05:00
Nicholas Hastings b99ab3d1d2 Remove TextMsg params padding on Dota. 2014-02-27 09:53:57 -05:00
Scott Ehlert ce6b993954 Use Linux game data for offsets and signatures/symbols on OS X if Mac-specific data is not available (bug 6056, r=dvander).
Although unlikely, OS X game data can also be used on Linux if Linux-specfic data is missing.
2014-02-15 23:23:53 -06:00
David Anderson e95c2ba0b9 Improvements to checkout-deps.sh (bug 6054, r=ds). 2014-02-15 17:13:13 -08:00
Ruben Gonzalez ab6971656b Fix not returning a valid weaponID for cz75a (irc, r=KyleS) 2014-02-13 13:19:59 -05:00
Ruben Gonzalez 01fc010719 Update CSSDM gdc patch bytes (NPOTB) 2014-02-13 12:12:36 -05:00
Peace-Maker 37c84448a9 Fix CS:S GroundEntChanged SDKHooks Windows gamedata. 2014-02-13 11:37:06 -05:00
Scott Ehlert d259be7b1f Make symstore.pl die if it fails to open a symbol directory (no bug, r=dvander). 2014-02-13 01:40:02 -06:00
Scott Ehlert 9be71eea2f Fix ___strlcat_chk symbol error on OS X 10.8 and earlier (bug 6046, r=dvander). 2014-02-13 01:28:13 -06:00
Dr!fter a4d841655b Fix possible crash when unloading cstrike extension. (irc, r=KyleS) 2014-02-13 00:02:35 -05:00
Ruben Gonzalez 162c69bfda Fix CS_GetWeaponPrice returning incorrect value for M4A1 in CS:GO
--HG--
extra : amend_source : b4fa218795b59a82f98c0c8142e3bf36161f88d6
2014-02-12 19:03:14 -05:00
Nicholas Hastings c5f496670d Define NETWORK_VARS_ENABLED for SDKs that require it. 2014-02-10 21:04:01 -05:00
Nicholas Hastings 53a0acc2e3 Add GiveAmmo gamedata for more games.
--HG--
extra : amend_source : fd278ab2ac6f0afe7a47b0ba24d8c751755e1970
2014-02-10 11:46:10 -05:00
Peace-Maker 75d950e4b0 Add GiveAmmo native to SDKTools (bug 6039, r=psychonic). 2014-02-10 10:49:19 -05:00
Nicholas Hastings 5abd9edf62 Remove over-aggressive error handling of Addresses gamedata (bug 6044, r=asherkin).
--HG--
extra : rebase_source : 704dcfdf285286814411f3dd5be2dd6e02872085
2014-02-10 09:43:10 -05:00
Scott Ehlert e00e879af5 Use == instead of is operator for checking string equality in AMBuild scripts (bug 6043, r=dvander). 2014-02-09 22:50:20 -06:00
Peace-Maker 8476832dc2 Fix param order in AddToTopMenu function doc (irc, r=psychonic). 2014-02-09 19:38:41 -05:00
Scott Ehlert 0ab8f4a1bd Remove GLIBC 2.7 depedency from Webternet extension (no bug, r=dvander). 2014-02-09 15:19:17 -06:00
Ruben Gonzalez 79f825cc44 Fix typo in sdktools error. 2014-02-08 22:12:31 -05:00
Ruben Gonzalez f351e20de3 Update CStrike extension and gamedata on windows for latest CS:GO update (irc, r= psychonic) 2014-02-08 20:04:12 -05:00
Ruben Gonzalez 925d514224 Increase max sig length (irc, r=psychonic)
--HG--
extra : amend_source : 24f20bd01d0277e255f47e0c4392396ec1871104
2014-02-08 20:00:52 -05:00
Kyle Sanderson 36cc7610a1 Fix bad handle Forward handling in RequstFrame (irc, r=psychonic). 2014-02-08 15:10:35 -07:00
Kyle Sanderson 06d2017a95 Remove unmanaged forwards from lookup list on Release (bug 6025, r=psychonic). 2014-02-08 14:51:44 -07:00
Nicholas Hastings 0da68844a5 Remove MarkNativeAsOptional calls for old PbReadRepeated natives. (irc, r=KyleS). 2014-02-08 14:13:40 -05:00
Nicholas Hastings 1f6733562d Fix CS:GO EntInfosFinder gamedata. 2014-02-08 12:22:02 -05:00
Nicholas Hastings 4093fa0588 Fix SDKHooks load issue and reliance on gEntList ptr on CS:GO and Dota 2 on Windows. 2014-02-07 22:11:31 -05:00
Nicholas Hastings 39c82d6ea0 Fix logical entity support for Dota 2 and CS:GO on Windows. 2014-02-07 20:44:52 -05:00
Nicholas Hastings 03c7a9d5f3 Update CS:GO SDKTools gamedata. 2014-02-07 13:07:30 -05:00
Scott Ehlert 65b32b8ced Update dependency script to support getting Windows deps (no bug, r=dvander). 2014-02-06 19:45:35 -06:00
Scott Ehlert 41f74d1a5c Update Linux dependency script to support getting Mac deps (no bug, r=dvander).
--HG--
rename : tools/checkout-linux-deps.sh => tools/checkout-deps.sh
2014-02-06 00:28:29 -06:00
Nicholas Hastings 13e65a73a4 Update Insurgency gamedata. 2014-02-03 09:34:37 -05:00
Nicholas Hastings dc1234ddfb Update CS:GO SDKHooks gamedata.
--HG--
extra : rebase_source : cace974aa8e534dcb28d0759b034599d3cea81cc
2014-02-03 08:56:33 -05:00
Kyle Sanderson 5d8f5c890d Triggering build. 2014-02-02 21:35:02 -07:00
Kyle Sanderson e2eabc7a96 Force a reconfigure to happen everytime. 2014-02-02 21:26:04 -07:00
Kyle Sanderson a33977c71c Force rebuild for b0fa678a69ef (bug 6029, r=dvander). 2014-02-02 15:54:24 -07:00
Kyle Sanderson 9de1a1ddfa Add configuration option to package debug files with amb2. 2014-02-02 15:33:33 -07:00
David Anderson 7dcdaf0319 Disable amb2 color when configuring. 2014-02-02 01:39:24 -08:00
Scott Ehlert b3d64d1121 Fix freeing non-heap object warning from GCC (r=ann). 2014-02-01 04:16:26 -06:00
Michael McKoy 52ff6fd5f8 Fix overoptimization of nomination counts in Mapchooser (bug 5359, r=kyles). 2014-01-30 14:29:53 -07:00
Kyle Sanderson af7b8cd9a3 Wrap ClientPrintf into IGamePlayer (bug 6021, r=asherkin). 2014-01-29 21:41:41 -07:00
Nicholas Hastings b0ee5ce485 Updated Dota 2 gamedata. 2014-01-29 13:07:50 -05:00
FlaminSarge 4a65e38d54 Update TFCond and customkill enum values (bug 6012, r=psychonic). 2014-01-27 10:15:17 -05:00
Nicholas Hastings 097d2d902c Add missing meta results to some pre-hooks in SDKHooks (nobug, r=me). 2014-01-27 10:09:47 -05:00
Peace-Maker 9d15512f3b Fix crash in SDKHooks Reload post-hook (irc, r=psychonic). 2014-01-27 10:09:03 -05:00
Kyle Sanderson 3bbb48ce9e Fix GetPlayerUserId uninitialized return in Dota 2 (irc, r=psychonic). 2014-01-25 16:58:12 -07:00
Peace-Maker a709307fab Rename SortFunc2D parameters to match documentation (bug 6014, r=kyles). 2014-01-22 20:14:55 -07:00
Scott Ehlert 06c73813ca Triggering build for OS X 10.9 VM. 2014-01-22 00:38:49 -06:00
Kyle Sanderson 5acc7209b2 Add client checks to EmitSound SoundsHooks (bug 5873, r=psychonic) 2014-01-17 23:25:23 -05:00
Kyle Sanderson 9fe11f9c36 Fix being able to nominate same map multiple times (bug 5109, r=psychonic) 2014-01-17 23:21:16 -05:00
Kyle Sanderson fb734e4124 Add any tag to WritePackCell and ReadPackCell natives (bug 6001, r=asherkin) 2014-01-17 23:14:40 -05:00
Scott Ehlert 7c1fb6e5b9 Triggering build for clang 3.4. 2014-01-11 13:25:32 -06:00
Scott Ehlert 40d03f78cf Hopefully fixed clang build on Linux. 2014-01-08 17:37:55 -06:00
Scott Ehlert 7f8c6a9fd6 Triggering build. 2014-01-08 17:29:04 -06:00
Scott Ehlert 832187be31 Triggering build. 2014-01-08 17:21:01 -06:00
Scott Ehlert a2f8f1e70d Triggering build. 2014-01-08 17:10:04 -06:00
Scott Ehlert 3f3343e945 Changes to pushbuild.txt now trigger a reconfigure. 2014-01-08 17:09:50 -06:00
Scott Ehlert 4e077402e5 Triggering build. 2014-01-08 16:50:21 -06:00
Nicholas Hastings ad5740f8a7 Add support for Valve search paths to GetFileSize native (bug 5931, r=asherkin). 2014-01-07 14:24:53 -05:00
Nicholas Hastings 310f77d96a Consolidate FileExists usage in logic bin (bug 5931, r=asherkin). 2014-01-07 14:24:41 -05:00
Nicholas Hastings 121c3973d6 Add support for Insurgency mapcycle format (bug 5966, r=asherkin).
--HG--
extra : rebase_source : 3ae48e176177b1816351cc0cdd5c8dd35e630ea3
2014-01-07 10:24:44 -05:00
Nicholas Hastings 17212616d7 Support all file search paths when finding mapcycle file (bug 5839, r=asherkin).
--HG--
extra : rebase_source : 997dedcbac4a9249111c7424723f5b386baee77d
2014-01-07 10:24:05 -05:00
Nicholas Hastings 876ba3bef5 Don't hardcode paths to tier0/vstdlib in ICommandLine lookup (nobug).
--HG--
extra : rebase_source : 43d9d34a73ad9f89806507a521aed3f30d351586
2014-01-07 10:21:53 -05:00
David Anderson 9a0918a354 Fix typo that caused dump_syms to execute out of order with respect to linking. 2013-12-30 20:21:33 -05:00
David Anderson cfad3b26ca Port breakpad symbol uploading to AMBuild 2 (bug 5997 part 16, r=ds). 2013-12-30 17:51:02 -05:00
David Anderson a55b000273 Switch buildbot scripts to AMBuild 2 (bug 5997 part 15, r=ds). 2013-12-30 17:51:01 -05:00
David Anderson b69b0de234 Various build fixes (bug 5997 part 14, r=ds). 2013-12-30 17:51:01 -05:00
David Anderson 6d320163a1 Various Windows build fixes (bug 5997 part 13, r=ds).
--HG--
rename : sourcepawn/compiler/libpawnc.rc => sourcepawn/compiler/version.rc
2013-12-30 17:51:00 -05:00
David Anderson ae21f29ad9 Port the PDB log to AMBuild 2 (bug 5997 part 11, r=ds). 2013-12-30 17:51:00 -05:00
David Anderson f82224eba0 Move versioning to a static library to improve trivial build speed (bug 5997 part 9, r=ds). 2013-12-30 17:51:00 -05:00
David Anderson c2cfe60102 Port versioning to AMBuild 2 (bug 5997 part 8, r=ds). 2013-12-30 17:50:59 -05:00
David Anderson 75e622e879 Port packaging to AMBuild 2 (bug 5997 part 6, r=ds). 2013-12-30 17:50:59 -05:00
David Anderson 9c19f6efb7 Port plugin build scripts to AMBuild 2 (bug 5997 part 5, r=ds). 2013-12-30 17:50:58 -05:00
David Anderson 58995fc829 Add an spcomp option to print #included files (bug 5997 part 4, r=ds). 2013-12-30 17:50:58 -05:00
David Anderson 54ed1807c0 Port webternet/curl to AMBuild 2 (bug 5997 part 2, r=ds). 2013-12-30 17:50:57 -05:00
David Anderson e1a820dcf9 Port simple C++ build scripts to AMBuild 2 (bug 5997 part 1, r=ds). 2013-12-30 17:50:56 -05:00
Ryan Stecker b749bbf42b Remove 'state' keyword from compiler (bug 4572, r=dvander). 2013-12-28 08:42:50 -05:00
Nicholas Hastings bdbc3c3b58 Fix SDKHooks Spawn hook crashing in Dota.
--HG--
extra : rebase_source : dfe1eb22256268b321b8c24be718fbc7c770e74e
2013-12-28 08:19:34 -05:00
Scott Ehlert b83810b986 Triggering build. 2013-12-20 17:27:58 -06:00
Nicholas Hastings 462b543816 Trigger build for hl2sdk-dota changes. 2013-12-20 15:19:01 -05:00
Asher Baker 29ddb9f4d9 Fix spcomp compilation on OS X 10.9
Summary:
10.9's SDK changed strlcat and strlcmp to macros, which has broken lots of code. As they will always be available from the system (being BSD functions), just use the system ones there.

tempnam has also been deprecated, refactoring spcomp to use it safely is quite a bit of work, and it's not critical, so just hacking around it with mkstemp.

Test Plan: Compiled spcomp.

Reviewers: dvander

Differential Revision: https://phabricator.alliedmods.net/D3

--HG--
extra : rebase_source : 535b88f815727b186fa6a141036599651a60e334
2013-12-02 13:08:27 +00:00
Kyle Sanderson 398b05afed Fix uninit'd memory issues in AMTL AString and Vector (bug 5921, r=psychonic).
--HG--
extra : rebase_source : 17a57dcf815cb3798eaa13af5f4af44fb1930f86
2013-11-30 10:59:05 -05:00
David Anderson f0e4fe66ba AMTL updates and changes to adapt for them to fix menu crashes (bug 5921, r=psychonic).
AMTL:
Removes isVoid from AString.
Fixes support inserting to Vector at length.

--HG--
extra : rebase_source : 02805fad60c2b759a0e2e91c081144854a8e0b54
2013-11-30 10:51:28 -05:00
Dr!fter fa057e76f3 Update CS:GO CSWeaponDrop signature 2013-11-21 19:26:10 -05:00
Nicholas Hastings 47906fbcb7 Updaee CS:GO gamedata. 2013-11-16 10:19:20 -05:00
Nicholas Hastings 5df8c9290f Fix incorrect return and inability to block in TF2 OnCrit forward (r=FlaminSarge, VoiDeD). 2013-11-09 19:33:06 -05:00
Nicholas Hastings 1938be9e28 Updated NMRiH gamedata. 2013-11-08 10:42:30 -05:00
Nicholas Hastings 839e292819 Updated CS:GO gamedata. 2013-11-06 22:48:07 -05:00
Nicholas Hastings 056f64ad40 Consolidate SDKTools ent factory lookup (r=asherkin). 2013-11-05 20:32:37 -05:00
Nicholas Hastings c13a0a2e7a Trigger build. 2013-11-03 09:39:49 -05:00
Nicholas Hastings 1cf12085fc Trigger build. 2013-11-02 09:40:44 -04:00
Nicholas Hastings d9946b49c4 Trigger build. 2013-11-01 19:20:32 -04:00
Nicholas Hastings c5ca58a95b Trigger build. 2013-11-01 18:15:54 -04:00
Nicholas Hastings 591255c793 Fix typo in No More Room In Hell SDKHooks gamedata. 2013-10-30 16:10:02 -04:00
Nicholas Hastings 2ea5e6d090 Updated No More Room In Hell gamedata. 2013-10-30 16:03:09 -04:00
Kyle Sanderson e01fc5e697 Add RequestFrame native for one-off frame actions (bug 5965, r=dvander). 2013-10-29 22:10:40 -04:00
Nicholas Hastings 0775976165 Updated TF2 enums. 2013-10-29 20:08:18 -04:00
Nicholas Hastings d2f719171d 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 c9c147a814 Have SDKTools use IServerTools to get ent facts where available (bug 5968, r=asherkin). 2013-10-29 18:59:36 -04:00
Nicholas Hastings 31aa230cba Updated TF2 ext Burn call with new parameter. 2013-10-29 18:59:12 -04:00
Nicholas Hastings 880be015ae Updated TF2 gamedata. 2013-10-29 18:59:00 -04:00
David Anderson 96d6cf8def Fix some memory errors (bug 5904, r=ds). 2013-10-29 18:58:34 -04:00
Nicholas Hastings 66dd3f08b1 Updated Synergy gamedata. 2013-10-28 11:13:48 -04:00
Nicholas Hastings 2175e561cc Flipped on ShowMenu support for Insurgency (present in next game update). 2013-10-25 14:32:56 -04:00
Kyle Sanderson 35191745ca Fix regression in SDKTools SetClientListening hook refcounting (bug 5956, r=fyren). 2013-10-24 13:20:42 -04:00
Scott Ehlert 661af1c5e2 Trigger build. 2013-10-24 00:53:27 -05:00
Dr!fter bd1ee1f805 Update CS:GO sdktools gamedata 2013-10-23 22:28:53 -04:00
Scott Ehlert 9e926bdb1d Trigger build. 2013-10-21 04:08:40 -05:00
Asher Baker edab49c4ef Support HUGE files in spcomp (bug 5959, r=dvander)
Summary: When there are more than 32768 SLOC in a file, spcomp underflows when storing debug info. These are safe to change as the file-backed struct uses uint32_t already.

Test Plan: Compiled the test plugin from bug 5959. I didn't load it, but it compiled without error and the SMX file is valid.

Reviewers: BAILOPAN

Differential Revision: https://phabricator.alliedmods.net/D2

--HG--
extra : rebase_source : fa907333b8c0dcab6e78c69ad4a92cdfb048083f
extra : amend_source : c7d2ec7d8b880459a57e4b2df5c1e8bbab5585bb
2013-10-15 23:36:16 +01:00
Asher Baker bbbbc8b311 Add a .arcconfig file so that arc works
Test Plan: Used arc to send this diff.

Reviewers: BAILOPAN, psychonic

Differential Revision: https://phabricator.alliedmods.net/D1

--HG--
extra : amend_source : 6aff9a42b440fe57ac096a93e843916c8a64b26d
2013-10-15 22:57:59 +01:00
David Anderson d5c1111fda Update linux dep script (no bug, r=NPOTB). 2013-10-14 11:56:43 -07:00
Nicholas Hastings 26a76365f4 Trigger build. 2013-10-13 15:17:20 -04:00
Nicholas Hastings 3a20ae16e1 Added gamedata for Insurgency (bug 5951, r=asherkin). 2013-10-13 14:16:12 -04:00
Nicholas Hastings e0746e1ab8 Added engine support for Insurgency (bug 5951, r=asherkin). 2013-10-13 14:16:08 -04:00
Nicholas Hastings 24c623c2fa Added gamedata for Blade Symphony (bug 5949, r=asherkin). 2013-10-13 14:15:33 -04:00
Nicholas Hastings 5e1d207eae Added engine support for Blade Symphony (bug 5949, r=asherkin). 2013-10-13 14:15:29 -04:00
Nicholas Hastings 3e15966c3e Add support for Source SDK Base 2013 (bug 5917, r=asherkin). 2013-10-13 14:14:51 -04:00
Nicholas Hastings ff54fb431f Fix ep1 build. 2013-10-09 09:12:46 -04:00
Nicholas Hastings 1ba6b2653a Move ForwardSys from core to logic (bug 5953, r=fyren).
--HG--
rename : core/ForwardSys.cpp => core/logic/ForwardSys.cpp
rename : core/ForwardSys.h => core/logic/ForwardSys.h
2013-10-09 08:43:08 -04:00
Nicholas Hastings 1d1b5d1c6d Move DBManager and DB natives from core to logic (bug 5953, r=fyren).
--HG--
rename : core/Database.cpp => core/logic/Database.cpp
rename : core/Database.h => core/logic/Database.h
rename : core/sm_simple_prioqueue.h => core/logic/sm_simple_prioqueue.h
rename : core/smn_database.cpp => core/logic/smn_database.cpp
rename : core/sm_queue.h => public/sm_queue.h
2013-10-09 08:43:08 -04:00
Nicholas Hastings 9027d15211 Move ADTFactory from core to logic (bug 5953, r=fyren).
--HG--
rename : core/ADTFactory.cpp => core/logic/ADTFactory.cpp
rename : core/ADTFactory.h => core/logic/ADTFactory.h
2013-10-09 08:43:08 -04:00
Nicholas Hastings 5bde264c43 Rename some register defines to avoid conflict with sys headers (bug 5917, r=hamdinger). 2013-10-08 21:01:21 -04:00
Asher Baker 67a2fe3751 Speculative fix for bot issues with SteamAuthstringValidation (r=psychonic). 2013-10-08 11:27:26 -04:00
Kyle Sanderson e3cb33bbda Switch StringToInt(Ex) from strtol to strtoul (bug 5939, r=psychonic). 2013-10-06 15:40:03 -04:00
Nicholas Hastings 3174fb7d19 Update CTakeDamageInfo var names from sdk update. 2013-10-06 10:57:38 -04:00
Nicholas Hastings 1836f69cf0 Updated gamedata for CS:GO Get/SetClientContribution score. 2013-10-03 10:43:20 -04:00
Peace-Maker 985b7831cf Fix typo stopping plugins from reaching ext dep lists (bug 5851, r=fyren). 2013-09-30 12:26:45 -04:00
Dr!fter fbc851ceae Fix Team Score Offset's for linux on CS:GO 2013-09-26 21:04:51 -04:00
Nicholas Hastings 55bf8ec095 Fix watchdog timer hanging on exit (r=dvander). 2013-09-23 22:29:28 -04:00
Nicholas Hastings 39e955c412 Updated HL2DM gamedata. 2013-09-18 21:49:36 -04:00
Kyle Sanderson f8c065c182 Update CS:S gamedata 2013-09-16 21:22:49 -04:00
Kyle Sanderson ed6fe7519a Detech dispatch after Handles are freed (bug 5853, r=asherkin). 2013-09-14 12:23:04 -04:00
Nicholas Hastings d808d6d8a5 Fix some format string misuse with map names. 2013-09-13 13:47:55 -04:00
Nicholas Hastings b471109c08 Increase mapname buffer size in nextmap to accomodate longer map names. 2013-09-13 13:47:55 -04:00
Dr!fter 9978b07956 Update gamedata for CS:GO update 2013-09-12 21:56:33 -04:00
Asher Baker 1b3ff094fa Updated plugin blacklist. 2013-09-11 06:16:48 +01:00
Drifter 75ce4c395a Add CS_UpdateClientModel native to cstrike extension (bug 5905, r=psychonic). 2013-09-10 13:08:14 -04:00
Nicholas Hastings 427e93c573 Fix attempted triggers from gagged users displaying in chat (bug 5918, r=asherkin). 2013-09-10 09:52:37 -04:00
Nicholas Hastings 46327563f2 Initialize DamageCustom var in SDKHooks CTakeDamageInfoHack (nobug, r=asherkin). 2013-09-09 18:41:54 -04:00
Kyle Sanderson 3308f0644c Fix incorrect assignment in SDKHook_TakeDamage + cleanup (bug 5911, r=psychonic). 2013-09-06 18:37:13 -04:00
Peace-Maker cb128162e6 Added missing DispatchKeyValues and SDKHooks gamedata for HL2CTF (bug 5114, r=psychonic).
--HG--
extra : amend_source : d84f37e83a223a5fbc1b71f70c8ba0076c7c1cf4
2013-09-05 22:31:44 -04:00
David Anderson f9f4c7dcd6 Add an interpreter because. (bug 5902, r=ds). 2013-09-01 00:23:44 -07:00
David Anderson 2dae228f10 Remove memtables from HandleSys (bug 5899 part 5, r=fyren). 2013-08-31 19:50:36 -07:00
David Anderson b917c540aa Remove memtables from GameConfigs (bug 5899 part 4, r=fyren). 2013-08-31 19:50:26 -07:00
David Anderson 67ce8aff61 Remove memtables from ConCmdManager (bug 5899 part 3, r=fyren). 2013-08-31 19:50:15 -07:00
David Anderson ba927964c8 Clean up ConCmdManager (bug 5900, r=fyren). 2013-08-31 11:51:23 -07:00
David Anderson 435f2b8e39 Remove MenuManager use of memtables (bug 5899 part 2, r=fyren). 2013-08-31 11:50:28 -07:00
David Anderson a25f9010cc Remove CoreConfig use of memtables (bug 5899 part 1, r=fyren). 2013-08-31 11:50:11 -07:00
David Anderson 4500964394 Use Refcounted to manage to NativeEntry (bug 5852 part 4, r=ds).
--HG--
extra : rebase_source : 2e08816db6819c9d9957a0e0ade9cd1aa420fd54
2013-08-30 10:16:28 -07:00
David Anderson 3da646f913 Simplify NativeEntry state (bug 5852 part 3, r=ds).
--HG--
extra : rebase_source : e80ed1c3b3af0b48fff6632eb131ca534a2c2885
2013-08-30 10:14:18 -07:00
David Anderson 140436c2cb Store C++ native lists more optimally in ShareSys (bug 5852 part 2, r=ds).
--HG--
extra : rebase_source : 75b786b4c839ec48bf32982486fbbafa1050ad55
2013-08-30 10:12:44 -07:00
David Anderson 0e677fb3a2 Remove native override API (bug 5852 part 1, r=ds).
--HG--
extra : rebase_source : 9df0399c88721b63667a9b0b5dca0eb20168117a
2013-08-30 10:10:57 -07:00
David Anderson 4dc5d0e12f Fix -Wno order in AMBuildScript. 2013-08-30 12:50:47 -07:00
David Anderson a260e92266 Add a script to checkout/update linux dependencies. 2013-08-30 12:24:40 -07:00
David Anderson 9a86be24a7 Remove experimental decompiler from the tree; superceded by Lysis. 2013-08-30 11:39:47 -07:00
Nicholas Hastings e620d973f4 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 7ad43a5b11 Make sm_mapvote_runoffpercent cvar work as advertised (bug 5890, r=asherkin). 2013-08-30 14:14:59 -04:00
Nicholas Hastings 124ede82b3 Fix build. 2013-08-29 15:05:34 -04:00
David Anderson da9debda67 Sync AMTL. 2013-08-29 11:45:28 -07:00
Nicholas Hastings 1c40d77b14 Fix build. 2013-08-29 14:16:18 -04:00
David Anderson f1b0c29815 Sync AMTL. 2013-08-29 10:11:59 -07:00
David Anderson b261dde858 Refactor Trie natives to use HashMap instead of KTrie; add iteration API (bug 5892, r=ds).
--HG--
extra : rebase_source : a5bcf64a45d6734a97d78b4f4ea9aea48d17bb8b
2013-08-29 10:09:02 -07:00
Matthias Kollek 88fdec6dd5 Added banreasons.txt missing from changeset a4e4207da173 (bug 5762). 2013-08-29 11:11:41 -04:00
Nicholas Hastings e8ce238eb7 Another fix for build on non-windows. 2013-08-29 10:12:44 -04:00
Nicholas Hastings 404b1c5ed0 Fix build on non-windows. 2013-08-29 09:47:20 -04:00
Nicholas Hastings dde1deb6bc Clean up TF2 ext CalcCritical code (bug 5894, r=voided). 2013-08-29 09:27:35 -04:00
David Anderson c80e0a964f Fix uninitialized var causing trouble in _FindServerClass (bug 5893, irc r=psychonic). 2013-08-28 13:46:34 -04:00
Nicholas Hastings d9f23a8af2 Fix translator system not loading languages with long identifier (bug 5888, r=dvander). 2013-08-28 13:18:55 -04:00
Matthias Kollek fd9e657196 Add support for customizing ban reasons in basebans.sp (bug 5762, r=psychonic). 2013-08-28 13:17:17 -04:00
Nicholas Hastings 693c4024d6 Updated TF2 Regenerate signature. 2013-08-27 23:32:04 -04:00
Nicholas Hastings d7eee4191f Updated TF2 AddCond signature. 2013-08-27 21:08:37 -04:00
Peace-Maker b8c61f89fa Re-rig global forwards when plugin pause state changes (bug 5582, r=psychonic). 2013-08-27 19:06:18 -04:00
Kyle Sanderson d05feabcd6 Suppress SpewOpcode if not a debug build (bug 5859, r=dvander). 2013-08-27 08:39:15 -04:00
David Anderson c30b7c111f Fix hashmap not being initialized (no bug, irc r=kyles). 2013-08-26 23:38:55 -07:00
Nicholas Hastings f6255c72d1 Compile with clang by default on linux. 2013-08-26 23:07:45 -04:00
Nicholas Hastings cd68567ce3 Updated plugin blacklist. 2013-08-26 10:31:25 -04:00
David Anderson e6f39eb9b6 Switch AdminCache off KTrie (bug 5886, r=ds). 2013-08-25 21:39:07 -07:00
David Anderson 2c1a398292 Fix build. 2013-08-25 14:04:01 -07:00
David Anderson 0f52f6931b Switch ADTFactory/IBasicTrie off KTrie (bug 5884 part 17, r=ds). 2013-08-25 12:21:15 -07:00
David Anderson 51dc097266 Switch TopMenus off KTrie (bug 5884 part 16, r=ds). 2013-08-25 12:20:38 -07:00
David Anderson 8e99b342a4 Switch ClientPrefs off KTrie (bug 5884 part 15, r=ds). 2013-08-25 12:19:10 -07:00
David Anderson bc51c3e5b1 Switch ConCmdManager off KTrie (bug 5884 part 14, r=ds). 2013-08-25 12:18:25 -07:00
David Anderson d5177fdc74 Switch EventManager off KTrie (bug 5884 part 13, r=ds). 2013-08-25 12:17:26 -07:00
David Anderson 80eba57e6b Switch sm_srvcmds off KTrie (bug 5884 part 12, r=ds). 2013-08-25 12:17:25 -07:00
David Anderson 3985dd639a Switch UserMessages off KTrie (bug 5884 part 11, r=ds). 2013-08-25 12:16:07 -07:00
David Anderson 3000445af9 Switch smn_console off KTrie (bug 5884 part 10, r=ds). 2013-08-25 12:15:27 -07:00
David Anderson 0235d57625 Switch ConsoleDetours off KTrie (bug 5884 part 9, r=ds). 2013-08-25 12:15:26 -07:00
David Anderson 77c7b312ea Switch ConVar, CoreConfig off KTrie (bug 5884 part 8, r=ds). 2013-08-25 12:13:30 -07:00
David Anderson 3850765759 Switch HalfLife2 off KTrie (bug 5884 part 7, r=ds). 2013-08-25 11:59:48 -07:00
David Anderson 0b8e2fd5c9 Switch Profiler off KTrie (bug 5884 part 6, r=ds). 2013-08-25 11:59:48 -07:00
David Anderson ebe9ee8114 Switch ShareSys off KTrie (bug 5884 part 5, r=ds). 2013-08-25 11:59:47 -07:00
David Anderson a8ab617ee9 Switch smn_maplists off KTrie (bug 5884 part 4, r=ds). 2013-08-25 11:59:47 -07:00
David Anderson 414440589e Switch PluginSys off KTrie (bug 5884 part 3, r=ds). 2013-08-25 11:59:46 -07:00
David Anderson 544b6d94aa Switch HandleSys off KTrie (bug 5884 part 2, r=ds). 2013-08-25 11:59:45 -07:00
David Anderson 0144062126 Introduce NameHashSet (bug 5884 part 1, r=ds). 2013-08-25 11:59:44 -07:00
David Anderson db1b7a8067 Fix build. 2013-08-25 11:26:37 -07:00
Nicholas Hastings a9905ec95e Add missing MarkNativeAsOptional calls for cstrike.inc (r=me). 2013-08-25 11:01:55 -04:00
Kyle Sanderson 7e2afacf34 Fix broken translating in some plugins and natives (bug 5612, r=psychonic). 2013-08-25 10:15:35 -04:00
Kyle Sanderson 2b6257e94e Fixed potential deadlock in HandleSystem::TryAndFreeSomeHandles (bug 5665, r=dvander). 2013-08-25 09:59:13 -04:00
David Anderson d14b5fe00b Switch GameConfigs to hash tables (bug 5878 part 3, r=ds). 2013-08-25 01:42:16 -07:00
David Anderson 04bb2d1066 Switch Translator to hash tables (bug 5878 part 2, r=ds). 2013-08-25 01:42:15 -07:00
David Anderson 3b9037397a Add new StringHashMap container (bug 5878 part 1, r=ds). 2013-08-25 01:42:14 -07:00
Nicholas Hastings ea3e602835 Fix cmd listener callback return behavior to match func doc (bug 5882, r=asherkin). 2013-08-24 23:56:39 -04:00
Nicholas Hastings 96e971084a Fix SDKHooks hook ent validation missing first datatable name (bug 5881, r=asherkin). 2013-08-24 21:59:52 -04:00
Nicholas Hastings 9bf78a96cc Replace hardcoded "/ff" check in basetriggers (bug 5863, r=drifter). 2013-08-24 21:59:52 -04:00
Nicholas Hastings ba55ef0b2e Don't call SayCommand forwards for chat triggers (bug 5863, r=asherkin). 2013-08-24 21:59:52 -04:00
Nicholas Hastings 0c00f7393c Fixed regression causing public triggers to no longer display (bug 5863, r=drifter). 2013-08-24 21:59:52 -04:00
Nicholas Hastings 1824826474 Removed unused var m_bTriggerWasSilent from core ChatTriggers (bug 5863, r=asherkin). 2013-08-24 21:59:52 -04:00
David Anderson 57e1c7d55f Fix build problems when using HashMap. 2013-08-24 01:29:43 -07:00
David Anderson e489b4a570 Fix build problems when using HashTable. 2013-08-24 01:29:26 -07:00
David Anderson 83dc7f0855 Fix performance problems in AString. 2013-08-24 01:29:03 -07:00
David Anderson 90a2d1bb39 Update AMTL with a number of changes.
- Introduce HashMap, a key-value map based on HashTable.
 - Introduce LinkedList, to port from SourceHook::List.
 - Introduce AString, to port from SourceHook::String.
 - Introduce KE_OVERRIDE and KE_DELETE helpers for C++11.
 - HashTable now constructs/destructs only live items.
 - Fix insert-on-removed-item bug in HashTable.
 - Fix Vector keeping a new maxsize if allocation fails.
 - Renamed am-inline-list.h to am-inlinelist.h.

--HG--
rename : public/amtl/am-inline-list.h => public/amtl/am-inlinelist.h
2013-08-23 22:29:44 -07:00
systematicmania da650606e3 Fixed optional dependencies logging errors (again) (bug 5739, r=dvander).
Regression from changeset 4c93f74cae51 and changeset 7dae5b0b8e28 in bug 5860.
2013-08-24 00:12:21 -04:00
Nicholas Hastings bc789d7c1a Add missing GetFunctionCount check in ChatTriggers::OnSayCommand_Pre (bug 5864, r=kyles).
--HG--
extra : rebase_source : afa6969f8319c80b027c4ae81e6b8db6b8d5c14f
2013-08-23 18:48:06 -04:00
David Anderson 5999b50e10 Fix Windows build errors. 2013-08-23 15:45:07 -07:00
Peace-Maker e5428a3c27 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 cf39bc97a5 Backed out changeset: 4af1c2ab3816 (bug 5864).
--HG--
extra : rebase_source : 7a3f03aaa4bb80d4b01c59cdb4dc12b0f5e020da
2013-08-23 07:28:07 -04:00
David Anderson 4d43374fde Add atomic reference counting and port DBI (bug 5876 part 3, r=ds).
--HG--
extra : rebase_source : a6defaf477e7a856ce91f92d5f3143f12c141da3
2013-08-23 00:18:13 -07:00
David Anderson dac42ee272 Add reference counting to IDatabase (bug 5876 part 2, r=ds).
--HG--
extra : rebase_source : 9fef982c3923a2f5cb842b3b8a5cca235ef9c6b9
2013-08-23 00:18:12 -07:00
David Anderson f7991185ba Add reference counting and use it for CGameConfig (bug 5876 part 1, r=ds).
--HG--
extra : rebase_source : 42b033d005ae3118b6505c530227c84e0e8a7553
2013-08-23 00:18:11 -07:00
Nicholas Hastings 5954f15989 Fixed crash in OnSayCommand_Post with console chat, pass console chat (bug 5864, r=voided);
--HG--
extra : rebase_source : 4a1a1945efc119f40e7d55d4fdfcc250bdc0febc
2013-08-22 21:45:42 -04:00
Nicholas Hastings 4d2eb7af30 Changed from RemoveEdict to using the Kill input for TF2_RemoveWeapon (r=voided).
--HG--
extra : rebase_source : cb9bd8d35bddfb5feb3bead7284398eb8bd7d6b4
2013-08-22 21:45:40 -04:00
Nicholas Hastings 50083048f6 Fixed SDKHooks thinking a hook type was supported when gamedata missing (r=voided).
--HG--
extra : rebase_source : 88a08b03ecbbbaa3bf1c91db30c2e08ceb106e95
2013-08-22 21:45:19 -04:00
David Anderson dab2932550 Fix Linux build. 2013-08-22 18:03:00 -07:00
David Anderson a8cebbe3fd Fix windows build. 2013-08-22 17:55:49 -07:00
David Anderson d6a6194e68 Make amtl headers BSD-licensed and clean up outstanding style issues. 2013-08-22 17:11:17 -07:00
David Anderson c373527851 Rename ke_* headers to am-*
--HG--
rename : public/amtl/ke_allocator_policies.h => public/amtl/am-allocator-policies.h
rename : public/amtl/ke_inline_list.h => public/amtl/am-inline-list.h
rename : public/amtl/ke_thread_posix.h => public/amtl/am-thread-posix.h
rename : public/amtl/ke_thread_utils.h => public/amtl/am-thread-utils.h
rename : public/amtl/ke_thread_windows.h => public/amtl/am-thread-windows.h
rename : public/amtl/ke_utility.h => public/amtl/am-utility.h
rename : public/amtl/ke_vector.h => public/amtl/am-vector.h
2013-08-22 17:10:59 -07:00
David Anderson de8726ab73 Move ke_ headers to new public/amtl folder.
--HG--
rename : public/sourcepawn/ke_allocator_policies.h => public/amtl/ke_allocator_policies.h
rename : public/sourcepawn/ke_inline_list.h => public/amtl/ke_inline_list.h
rename : public/sourcepawn/ke_thread_posix.h => public/amtl/ke_thread_posix.h
rename : public/sourcepawn/ke_thread_utils.h => public/amtl/ke_thread_utils.h
rename : public/sourcepawn/ke_thread_windows.h => public/amtl/ke_thread_windows.h
rename : public/sourcepawn/ke_utility.h => public/amtl/ke_utility.h
rename : public/sourcepawn/ke_vector.h => public/amtl/ke_vector.h
2013-08-22 16:30:44 -07:00
David Anderson 94d33a4ef1 Fix various problems with unloading ClientPrefs and SourceMod (bug 5874, r=ds).
--HG--
extra : rebase_source : 0a35f8380d651ca65fac9dd402c5cd3625e3105c
2013-08-22 14:05:44 -07:00
Kyle Sanderson d79b41e4a7 Fix weapon ID checks (bug 5872, r=Dr!fter) 2013-08-21 10:55:12 -04:00
David Anderson 754a6e1177 Rewrite DBManager to use the new synchronization primitives (bug 5870, r=fyren). 2013-08-21 00:01:28 -07:00
David Anderson b972ea4781 Fix stack alignment when lazily compiling scripted calls (bug 5871, r=ds). 2013-08-20 23:59:11 -07:00
David Anderson 45856816c1 Rewrite IThreader implementation around new synchronization primitives (bug 5862, r=fyren). 2013-08-19 20:58:02 -07:00
David Anderson 582162460f Fix OP_MOVS to not clobber random memory (bug 5868, r=psychonic). 2013-08-19 12:59:10 -07:00
Nicholas Hastings e970c36419 Fixed GuessSDKVersion return value when using MM:S versions < 1.10 (r=me). 2013-08-16 11:47:35 -04:00
David Anderson c48cc0afdc Fix OS X build. 2013-08-15 16:26:16 -07:00
Nicholas Hastings 3d6d4f5464 typo 2013-08-15 18:53:02 -04:00
Nicholas Hastings 61bc6ec825 snaaaaaaaaaaaaaaaaakes 2013-08-15 18:49:55 -04:00
Nicholas Hastings 6f0f6676db Fixed char * constant conversion warning in cstrike ext. 2013-08-15 18:43:14 -04:00
Nicholas Hastings fc240d4dfa Only add -Wno-narrowing if GCC >= 4.6 or Clang(?). 2013-08-15 18:34:51 -04:00
Dr!fter 6dc0861740 Update some more CS:GO gamedata 2013-08-15 17:22:30 -04:00
Drifter 45cabd756c Fix CS:GO GetWeaponPrice and OnGetWeaponPrice using outdated method (r=psychonic). 2013-08-15 14:40:30 -04:00
Nicholas Hastings 5fc854ab4f Fixed chat trigger crash regression on ep1 (bug 5394, r=asherkin).
--HG--
extra : rebase_source : 39f0eff210b785b266422157c48b538921e16cc8
2013-08-15 10:18:27 -04:00
David Anderson caa3343dea Added missing core.cfg entry. 2013-08-14 23:59:31 -07:00
David Anderson 3ac43497b9 Implement a watchdog timer for scripts that take too long to execute (bug 5837, r=fyren).
--HG--
extra : rebase_source : ffacb38457eca581660ce8f15c444ad828b7fedd
2013-08-14 23:54:25 -07:00
Dr!fter 74f1b800c2 Update gdc keys for CS:GO update 2013-08-14 17:18:02 -04:00
Nicholas Hastings 7d431e55df Update BuyCommand detour in CStrike extension with new param on CS:GO. 2013-08-14 17:08:02 -04:00
Nicholas Hastings 575962569f Update GivePlayerItem for new params in CS:GO. 2013-08-14 17:07:27 -04:00
Dr!fter 01ef0e93aa Update some more CS:GO gamedata 2013-08-14 16:42:40 -04:00
Nicholas Hastings 439f4f6f0e Updated some CS:GO gamedata. 2013-08-14 14:20:57 -04:00
Nicholas Hastings 00b1f33725 Fixed typo in Nuclear Dawn gamedata backcompat fix. 2013-08-14 13:14:59 -04:00
Nicholas Hastings 1204eec8ac 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 f3ac8f6649 Added gamedata and extension loading compat shims for Nuclear Dawn (bug 5813, r=asherkin). 2013-08-14 11:56:34 -04:00
FlaminSarge 7db280a666 Add GetPlayerJingleFile native. (bug 5690, r=asherkin) 2013-08-12 02:08:34 +01:00
David Anderson a4b7ad0d42 Fixed memory corruption when parsing natives. (bug 5840, r=fyren) 2013-08-12 01:33:04 +01:00
Asher Baker 2b88905b40 Fixed build. 2013-08-12 01:32:44 +01:00
FlaminSarge ef5263ef9e Add support for more CalcIsAttackCritical helpers. (bug 5576, r=asherkin) 2013-08-12 01:18:01 +01:00
FlaminSarge 9206512c38 Add support for tracking player conditions >= 64. (bug 5565, r=asherkin) 2013-08-12 01:11:11 +01:00
Peace-Maker 82e16db275 Fixed sm_cancelvote not resetting rtv state. (bug 5808, r=asherkin) 2013-08-12 00:58:43 +01:00
Peace-Maker 97fc093eef Fix crash creating a timer when there are no handles available. (bug 5317, r=asherkin) 2013-08-12 00:57:26 +01:00
Kyle Sanderson b9cd424186 Add support for nested datatables. (bug 5446, r=asherkin) 2013-08-12 00:54:21 +01:00
Kyle Sanderson 6af85409f1 Dump handle information when a plugin is forcefully unloaded. (bug 5666, r=asherkin) 2013-08-12 00:45:29 +01:00
Kyle Sanderson 86c699dd36 Fixed various memory issues. (bug 5766, r=asherkin) 2013-08-12 00:44:22 +01:00
Kyle Sanderson 3d4e1ffd64 Added helper stock to check if a command exists. (bug 5510, r=asherkin) 2013-08-12 00:42:56 +01:00
David Anderson b39fcebe65 Remove InfoVars, reassign DAT from EBP to ESI to preserve C++ stacktraces in JIT code (bug 5844 part 10, r=ds). 2013-08-12 00:24:02 +01:00
David Anderson 04129a0841 Remove InfoVars::frm (bug 5844 part 9, r=ds). 2013-08-12 00:23:54 +01:00
David Anderson a7658f013e Eliminate InfoVars::hp (bug 5844 part 8, r=ds). 2013-08-12 00:23:00 +01:00
David Anderson 2822bf7a65 Eliminate InfoVars::cip (bug 5844 part 7, r=ds). 2013-08-12 00:22:54 +01:00
David Anderson 87ccd272ee Eliminate InfoVars::rval (bug 5844 part 6, r=ds). 2013-08-12 00:22:41 +01:00
David Anderson 18275ce2c9 Remove InfoVars::ctx (bug 5844 part 5, r=fyren). 2013-08-11 11:33:47 -07:00
David Anderson 5935070dfa Remove InfoVars::memory (bug 5844 part 4, r=ds). 2013-08-11 11:33:29 -07:00
David Anderson 8391c83121 Remove InfoVars::stp (bug 5844 part 3, r=fyren). 2013-08-11 11:31:55 -07:00
David Anderson 4255ee105f Remove InfoVars::data_size (bug 5844 part 2, r=ds). 2013-08-11 11:31:24 -07:00
David Anderson e3c45bd1f7 Clean up INFO register structure (bug 5844 part 1, r=ds). 2013-08-11 11:30:27 -07:00
David Anderson 449617474b Statically align the stack at function boundaries (bug 5842, r=ds). 2013-08-11 11:27:19 -07:00
David Anderson ce542ac5f6 Move tracker related opcodes entirely to C++.
The tracker related opcodes:
  GENARRAY
  GENARRAY_Z
  TRACKER_POP_SETHEAP
  TRACKER_PUSH_C

All contain some vastly overcomplicated assembly containing logic that could
be implemented much easier in C++. If it were a performance concern, these
opcodes would be entirely in C++, but most of them call out to one or more
routines to do additional work. This patch just moves most of the logic out
to C++ to reduce complexity and fix reported bugs.

--HG--
extra : rebase_source : 1397056ac3ca3efb969e66ec577e2b33ca725e1a
2013-08-10 21:23:02 -07:00
Nicholas Hastings d0e18ed0ba Debug build fixes.
--HG--
extra : rebase_source : 772710f29b5aca5e0e4b7276fcb19b3702450e3f
2013-08-10 12:22:09 -04:00
David Anderson 70952282f0 More Windows build fix. 2013-08-08 22:02:42 -07:00
David Anderson bf325b72f1 Use SSE when available for floating-point operations (bug 5841, r=her). 2013-08-08 20:26:36 -07:00
David Anderson f031ad23f6 Fix Windows build (require stdint.h i.e. MSVC 2010+). 2013-08-08 20:21:37 -07:00
David Anderson 9e56725406 Refactor the JIT to use a newer, simpler macro assembler. (bug 5827, r=ann) 2013-08-08 09:41:24 -07:00
David Anderson ad543c909c Add -Wno-narrowing to support building on GCC-4.7 (no bug, r=me). 2013-08-08 09:40:23 -07:00
Nicholas Hastings 36b8b81914 Ep1 compile fixes. 2013-08-05 12:06:04 -04:00
Kyle Sanderson 5d76ffef88 Added global pre and post forwards for client chat (bug 5394, r=psychonic). 2013-08-05 11:46:29 -04:00
Nicholas Hastings 37316fed84 Fixed a path not using updated mapcycle file detection (bug 5719). 2013-08-05 11:36:59 -04:00
Nicholas Hastings ecd568510d Triggering build. 2013-08-05 08:36:25 -04:00
GoD-Tony 5ec9cf7089 Added ISDKHooks interface with entity listeners (bug 5602, r=psychonic). 2013-08-04 10:03:40 -04:00
Kyle Sanderson aad1b5dc9f Fixed regression in CellFilter GetRecipientIndex reading oob (bug 5826, r=psychonic). 2013-08-03 19:20:03 -04:00
Nicholas Hastings 1b13f0a2ec Triggering build.
--HG--
extra : amend_source : 2a8f0c1879b366883b96eeebf304e5aa8b19153f
2013-08-03 19:03:12 -04:00
Asher Baker 29108ea8ad Change wording for SteamAuthstringValidation config option to mark feature as experimental (bug 5791, r=psychonic). 2013-08-01 14:31:03 +01:00
Erik Minekus 0e167ee85b Numerous code documentation fixups (bug 5720, r=psychonic). 2013-08-01 09:26:34 -04:00
Nicholas Hastings 8fe6d09613 Check all possible mapcycle paths on newer orangebox games (bug 5719, r=asherkin). 2013-07-31 22:57:50 -04:00
Drifter fa0df413f4 Added CS_IsValidWeaponID native and validity checks to other natives (bug 5566, r=psychonic). 2013-07-31 22:11:15 -04:00
Drifter 1a8be6344a Fixed incorrect return for some weapons in CS_GetWeaponPrice (bug 5562, r=psychonic). 2013-07-31 22:08:23 -04:00
Kyle Sanderson fff8455903 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 80d94e1aa3 Build against MM:S 1.10. 2013-07-31 18:42:15 -04:00
Nicholas Hastings a36c266e7d Split TF2, DoD:S, HL2:DM, and ND to separate binaries (bug 5813, r=asherkin). 2013-07-21 11:53:56 -04:00
Nicholas Hastings 636c100b6b Updated for latest hl2sdk-dota changes.
--HG--
extra : amend_source : 503e712bb88b2da051c9ea3d6d51b7294ba83230
2013-07-29 10:03:18 -04:00
Dr!fter 28f85aae7f Update WeaponIDToAlias Sig for CS:GO 2013-07-26 14:42:03 -04:00
Kyle Sanderson dfa11f64ef Fixed handle misuse in clientprefs plugin (bug 5805, r=psychonic).
--HG--
extra : amend_source : a63c384e65feb0238bfc4e8ab618bc637a015962
2013-07-20 15:17:43 -04:00
Nicholas Hastings 3f92d2f300 Synced gdc-psyfork symbols.txt with live version (NPOTB).
--HG--
extra : amend_source : 5d889731940a87f676145713d79ae563a176b0fb
2013-07-18 21:07:14 -04:00
Dr!fter cc0bf88a5f Fix gdc-psyfork when checking linux offset (NPOTB) 2013-07-18 21:04:03 -04:00
Kyle Sanderson b3c0b964b5 Added many missing handle security checks (bug 5595, r=psychonic).
--HG--
extra : rebase_source : cc5bf3057bbce89fc14bff9c673821c3146c588b
2013-07-18 20:34:43 -04:00
Dr!fter 4661e5a10b Add signature offset byte check support for gdc-psyfork (NPOTB). 2013-07-18 20:34:11 -04:00
Kyle Sanderson 220a35b492 Make compile.sh set working dir to own dir (bug 5710, r=psychonic). 2013-07-18 19:40:42 -04:00
Asher Baker 351142f93f Fixed inaccurate compiler error when ternary operator is involved (bug 5711, r=dvander). 2013-07-18 17:59:24 -04:00
Kyle Sanderson 29bc273e58 Removed -Wno-parentheses from posix build and fixed warnings (bug 5745, r=psychonic). 2013-07-18 15:50:57 -04:00
Kyle Sanderson b96e0c8713 Fixed accidental assignment in each of SDKTools and sp compiler (bug 5745, r=psychonic). 2013-07-18 15:50:50 -04:00
systematicmania 7e0c0d79bc 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 1f88f1f3f6 Throw error instead of crash when calling SetTeamScore between maps (bug 5718, r=psychonic). 2013-07-18 11:38:04 -04:00
Peace-Maker 69d8b1c30d Added SQL_SetCharset native to (re)set charset even after reconnect (bug 5786, r=psychonic). 2013-07-18 10:27:12 -04:00
Peace-Maker 5a5d8d2d07 Fixed typo in too-many-params native error message (r=psychonic). 2013-07-17 08:05:42 -04:00
Nicholas Hastings 0e25540a89 Updated DoD:S gamedata. 2013-07-16 20:45:02 -04:00
Nicholas Hastings 21169f4e9a Updated for latest hl2sdk-dota changes. 2013-07-13 13:58:47 -04:00
Nicholas Hastings 1fbed9f7d0 Don't load nextmap on Dota 2. 2013-07-13 13:58:47 -04:00
Nicholas Hastings c230cf5aab Updated for latest hl2sdk-dota changes. 2013-07-12 02:31:41 -04:00
Dr!fter 2d65ed352e Fix SDKHooks gamedata for Half-Life 2 and DOD:S 2013-07-10 20:46:00 -04:00
Dr!fter 5fa81d4273 Update TF2 Reload Offset 2013-07-10 20:33:21 -04:00
Dr!fter 5ec32bdd2f Update GroundEndChanged for CS:S and CS:GO 2013-07-10 19:56:51 -04:00
Dr!fter d39aa10da1 Update TF2 ForceRespawn offset 2013-07-10 19:14:10 -04:00
Dr!fter 0d763052fb Update TF2 Gamedata 2013-07-10 18:53:12 -04:00
Nicholas Hastings ee62e33dd0 Updated L4D2 IServer gamedata for Windows. 2013-07-08 16:10:55 -04:00
Nicholas Hastings a22de48e40 Fix tier0/vstdlib lookup in core for recent L4D2 changes. 2013-07-06 11:54:37 -04:00
Nicholas Hastings 7b5708a8b4 Define POSIX when compiling for any build on linux/mac. 2013-07-06 11:53:58 -04:00
Nicholas Hastings 71c1767790 Updated L4D2 gamedata. 2013-07-05 14:29:12 -04:00
Nicholas Hastings 5fb0115d06 Triggering build for L4D2 sdk update. 2013-07-04 16:45:00 -04:00
Nicholas Hastings c8e6128720 Fixed build for real. 2013-07-04 11:28:32 -04:00
Nicholas Hastings 55583540a8 Fix posix builds. 2013-07-03 23:27:04 -04:00
Ryan Stecker 9b5d0228be Fixed ReadMapList not seeing maps in all valveFS paths (bug 5715, r=asherkin). 2013-07-03 23:14:55 -04:00
Nicholas Hastings 325d05b59c Triggering build for bug 5613. 2013-06-30 22:04:04 -04:00
Nicholas Hastings d1500dc99b Updated ambuild script for new l4d2 library names. 2013-06-30 10:45:19 -04:00
Matheus Valadares 157c8d5e54 Fixed error log filename date sometimes being incorrect (bug 5761, r=fyren). 2013-06-22 12:21:36 -04:00
Nicholas Hastings 0533b5cefc Fixed Dota build. 2013-06-18 12:16:48 -04:00
Ryan Stecker 7816085868 Updated TF2 CalcCriticalMelee Windows byte signature. 2013-06-13 21:37:05 -04:00
Matheus28 178a5f0645 Updated Dota 2 gamerules gamedata. 2013-06-04 21:37:48 -04:00
Scott Ehlert dfb8527e50 Triggering build to test buildbot. 2013-05-26 01:06:10 -05:00
Asher Baker 0a581154d1 Force rebuild. 2013-05-17 21:46:43 +01:00
Asher Baker efabf18162 Fixed copy-paste error in 116256b519b5. 2013-05-16 14:58:14 +01:00
Asher Baker 56737ac523 File upload support for webternet (r=psychonic). 2013-05-16 14:49:03 +01:00
Nicholas Hastings 702885ebb2 Fixed SDKTools dota build. 2013-05-14 11:27:06 -04:00
Nicholas Hastings a12b83de59 Typo fix. 2013-05-14 10:24:47 -04:00
Nicholas Hastings 3b83356825 Updated for latest hl2sdk-dota changes.
--HG--
extra : rebase_source : 0365a2c057523822481dee0880f8a5d525a8050a
2013-05-14 10:19:29 -04:00
Dr!fter c2aad7a71d Update Remove Disguise sig 2013-05-13 19:07:28 -04:00
Nicholas Hastings ef4edc6ff1 One more dota build fix. 2013-05-13 15:33:55 -04:00
Nicholas Hastings 614967ccc1 Updated for latest hl2sdk-dota changes. 2013-05-13 15:18:12 -04:00
Nicholas Hastings e8dc1480eb Don't omit frame pointer on msvc builds. 2013-05-13 14:19:17 -04:00
Nicholas Hastings 8fb87df0f0 Updated for hl2sdk-dota changes. 2013-05-08 09:21:40 -04:00
Kyle Sanderson bb7cfd2493 Fixed dereferencing potential null pointer in CPlugin::GetProperty (bug 5725, r=dvander). 2013-05-06 12:12:00 -04:00
Nicholas Hastings 1b19622ab8 Fixed CS:S CommitSuicide offset.
--HG--
extra : rebase_source : fc01c099f2af0de819a327262e6e8ffe6f79c658
2013-05-03 15:29:20 -04:00
Asher Baker 68ab7e2e3e Fixed unaligned memory access in spcomp (r=dvander). 2013-05-02 20:47:35 +00:00
Nicholas Hastings 157a286d1b Backed out changeset: f2f13520e8a1. 2013-05-02 15:31:01 -04:00
Nicholas Hastings 0eb199a9a8 Backed out changeset: 2c69e71dc4df. 2013-05-02 15:30:38 -04:00
Nicholas Hastings 77a928cef9 Backed out changeset: cf4356fd3524. 2013-05-02 15:30:16 -04:00
Nicholas Hastings 290388159a Backed out changeset: 7d07b4f23cd0. 2013-04-30 15:38:15 -04:00
Nicholas Hastings d0551a3ede Updated TF2 gamedata. 2013-04-29 21:20:11 -04:00
Nicholas Hastings 1e0d0429d0 Synced gdc-psyfork (NPOTB). 2013-04-29 20:51:54 -04:00
Nicholas Hastings 37ad913086 Triggering build. 2013-04-25 11:41:49 -04:00
Nicholas Hastings 3755ad7515 Triggering build. 2013-04-23 11:44:52 -04:00
Nicholas Hastings 369e141ea8 Build fixes for recent hl2sdk-dota updates. 2013-04-23 07:11:49 -04:00
Nicholas Hastings 39c9e69d8a Remove deprecated PbReadRepeated natives. 2013-04-23 07:11:49 -04:00
Nicholas Hastings 30be1ea16e Updated CS:S gamedata. 2013-04-16 12:19:45 -04:00
Nicholas Hastings a450361956 Added support for getting/setting protobuf enum values with Pb*Int natives (nobug, r=asherkin). 2013-04-16 11:33:36 -04:00
Nicholas Hastings df48ad6b61 Fixed build. 2013-04-15 07:22:23 -04:00
Nicholas Hastings 264de34c31 Merge. 2013-04-15 07:13:23 -04:00
Nicholas Hastings 70444b46b9 Fixed regression in cset 68d82718dc99 causing missing protobuf natives (bug 5712). 2013-04-15 07:12:52 -04:00
Brian Simon a79e552ab4 Added more alternative names for TFClass_Heavy (bug 5338, r=asherkin). 2013-04-11 03:07:50 +01:00
Kyle Sanderson 1b5faef097 Remove debug printout from PerformGravity (bug 5679, r=asherkin). 2013-04-11 03:03:29 +01:00
Asher Baker fe61f583e6 Only split DWARF data out for non-explicit-debug builds (bug 5683, r=dvander). 2013-04-11 00:34:52 +01:00
Asher Baker 4031ad354b Fixed JIT conflicts with SELinux (bug 5581, r=dvander). 2013-04-11 00:33:12 +01:00
Nicholas Hastings 46b9ae4174 Merge. 2013-04-08 08:00:50 -04:00
Nicholas Hastings c0d1aaa8a0 Allow localizaton of more base plugin strings (bug 5120, r=asherkin). 2013-04-08 08:00:13 -04:00
Nicholas Hastings a963427967 Allow localization of name-reserved kick message (bug 5146, r=asherkin). 2013-04-08 08:00:13 -04:00
Asher Baker d5ec523584 Support emscripten for compiling spcomp (r=dvander). 2013-04-05 07:03:43 +01:00
Nicholas Hastings c0c3fceaad Updated HL2DM gamedata. 2013-04-03 12:26:08 -04:00
Nicholas Hastings c52d7c9126 Fixed AllPluginsLoaded activities happening before SM is loaded (r=dvander`hom). 2013-04-03 12:25:54 -04:00
David Anderson 6cb67a19e7 Checkin missing chunks from bug 5680 (ref bug 5691). 2013-03-31 22:03:57 -07:00
David Anderson 9b5ca124ab Don't allocate/delete across static CRTs (no bug, irc r=fyren+psychonic). 2013-03-31 13:30:22 -07:00
David Anderson 4a0a509dd8 Fix typo in ExtensionSys::LoadAutoExtension (no bug, r=me). 2013-03-31 09:50:46 -07:00
David Anderson 6f2184901d Fix Mac build. 2013-03-29 13:10:51 -07:00
David Anderson 201e5e59da Fix build, again.
--HG--
extra : rebase_source : 8b1fb4f11f51c6b3bc63eb2e3e20467619d93a9a
2013-03-29 13:06:12 -07:00
Nicholas Hastings 2cb5778cfa Merge. 2013-03-29 15:45:55 -04:00
Nicholas Hastings 006016322b Updated DoD:S gamedata. 2013-03-29 15:45:16 -04:00
David Anderson 4191856034 Fix protobuf builds. 2013-03-29 12:35:56 -07:00
David Anderson 97f7b4f59f Fix build. 2013-03-29 12:19:41 -07:00
David Anderson ea441b3d70 Fix build. 2013-03-29 11:47:40 -07:00
David Anderson 045ee262a8 Move scared guts of core into logic (bug 5680, r=fyren).
--HG--
rename : core/ExtensionSys.cpp => core/logic/ExtensionSys.cpp
rename : core/ExtensionSys.h => core/logic/ExtensionSys.h
rename : core/HandleSys.cpp => core/logic/HandleSys.cpp
rename : core/HandleSys.h => core/logic/HandleSys.h
rename : core/NativeInvoker.cpp => core/logic/NativeInvoker.cpp
rename : core/NativeInvoker.h => core/logic/NativeInvoker.h
rename : core/NativeOwner.cpp => core/logic/NativeOwner.cpp
rename : core/NativeOwner.h => core/logic/NativeOwner.h
rename : core/PluginSys.cpp => core/logic/PluginSys.cpp
rename : core/PluginSys.h => core/logic/PluginSys.h
rename : core/ShareSys.cpp => core/logic/ShareSys.cpp
rename : core/ShareSys.h => core/logic/ShareSys.h
rename : core/smn_fakenatives.cpp => core/logic/smn_fakenatives.cpp
rename : core/logic/AutoHandleRooter.h => public/AutoHandleRooter.h
2013-03-29 11:37:29 -07:00
Nicholas Hastings 502c6f0dae Triggering build. 2013-03-29 12:28:02 -04:00
Nicholas Hastings bc31dfbbd1 Triggering build. 2013-03-29 11:58:47 -04:00
Nicholas Hastings a1319f4231 Triggering build. 2013-03-29 11:06:55 -04:00
Nicholas Hastings ce365abab6 Added Dota 2 gamedata for SDKHooks. 2013-03-22 23:07:17 -04:00
Nicholas Hastings 48a623f062 Merge. 2013-03-22 14:31:30 -04:00
Nicholas Hastings a727dfb3b0 Updated Dota 2 gamedata. 2013-03-22 14:30:29 -04:00
Drifter 52ba76fcb2 Update gamedata for CS:GO update 2013-03-21 20:00:29 -04:00
Nicholas Hastings 70e29d4f20 Fixed IsMapValid passing blank string to engine's IsMapValid which crashes some games. 2013-03-21 01:22:08 -04:00
Nicholas Hastings 08d83eb8da Backed out changeset: 40e1814dd3d6 (bug 5484). 2013-03-19 22:08:19 -04:00
Nicholas Hastings eacff1f0b4 Another build fix. 2013-03-19 12:15:24 -04:00
Nicholas Hastings 4806d71ca2 Fixed build. 2013-03-19 11:46:02 -04:00
Nicholas Hastings 085b87dd02 Triggering build. 2013-03-19 11:36:04 -04:00
Peace-Maker 35cd7eb2be Add alternative lookup method for EntityFactoryDictionary (bug 5658, r=asherkin). 2013-03-19 11:25:04 -04:00
Nicholas Hastings ec716f0c58 Cache m_iEFlags offset for datamaps dump instead of getting for each ent (bug 5657, r=asherkin). 2013-03-19 11:24:01 -04:00
Nicholas Hastings 0d97198f88 Initial commit of Dota 2 gamedata (bug 5656, r=asherkin). 2013-03-19 11:22:52 -04:00
Nicholas Hastings 2c7537b4cd Dota 2 support in Ambuild scripts (bug 5656, r=asherkin). 2013-03-19 11:22:31 -04:00
Nicholas Hastings e364937353 Updated protobuf and usermessage support for Dota 2 (bug 5656, r=asherkin). 2013-03-19 11:19:38 -04:00
Nicholas Hastings 877ef76540 Tweaked Dota 2 support to account for lack of IPluginHelpers (bug 5656, r=asherkin). 2013-03-19 11:19:19 -04:00
Nicholas Hastings 519e8c5fcd Added basic support for Dota 2 (bug 5656, r=asherkin). 2013-03-19 11:18:44 -04:00
Peace-Maker 305d53f094 Fixed possible rte in basetriggers for !ingame clients (bug 5191, r=psychonic). 2013-03-18 20:11:50 -04:00
Michael McKoy 5625ad76b9 Fixed mapchooser interaction with CS:GO winlimits (bug 5484, r=psychonic). 2013-03-18 20:10:31 -04:00
Kyle Sanderson 4c722bf623 Fixed check against uninitialized string in extension loader (bug 5546, r=psychonic). 2013-03-18 20:03:17 -04:00
Peace-Maker 8fe22c33bf Fixed double print when sending psay to self (bug 5649, r=psychonic). 2013-03-18 19:58:18 -04:00
GoD-Tony d866c061a3 Added logged error when PlayerRunCommand offset lookup fails (bug 5535, r=psychonic). 2013-03-18 19:53:30 -04:00
Nicholas Hastings f8fed31918 Changed MM:S inclusion in sqlite vcproj to use MMSOURCE19 env var (NPOTB) (bug 5468). 2013-03-18 19:06:48 -04:00
Nicholas Hastings e487007960 Fixed errors with SendConVarValue on CS:GO (bug 5638, r=asherkin). 2013-03-18 11:47:55 -04:00
Nicholas Hastings b46f2d1527 Triggering build. 2013-03-18 10:39:22 -04:00
Nicholas Hastings e162fb0e80 Triggering build. 2013-03-18 09:06:28 -04:00
Asher Baker 91ea3ba090 Force build. 2013-03-18 01:37:59 +00:00
Asher Baker e84f6e4afd Backed out updated libcurl. 2013-03-18 00:55:59 +00:00
Asher Baker 9b65900df0 Fix libcurl compile error. 2013-03-18 00:14:55 +00:00
Kyle Sanderson 9659340d7f Force rebuild of libcurl. 2013-03-17 23:56:15 +00:00
Asher Baker 63175aa3cb Updated cURL version. 2013-03-17 22:23:20 +00:00
Kyle Sanderson 986aa2a477 Fix a number of issues with cloned handles (bug 5240, r=asherkin). 2013-03-17 22:05:33 +00:00
Kyle Sanderson 07d7a8eeff Check for cloned handles when dumping (bug 5245, r=asherkin). 2013-03-17 21:58:56 +00:00
Asher Baker 3c9e84d380 Whoops. Snakes. 2013-03-17 21:07:28 +00:00
Asher Baker 0f62a8ec2f Generate debugging information during compilation (bug 5227, r=ds). 2013-03-17 21:00:28 +00:00
Nicholas Hastings 4e7a9cf30b Updated regex.inc with more flags and error codes (bug 5593). 2013-03-17 11:39:04 -04:00
Nicholas Hastings 5077703400 Moved PCRE_STATIC def in Regex ext to extension instead of modifying pcre header (bug 5593). 2013-03-17 11:39:04 -04:00
Nicholas Hastings 77fef18590 Recompiled Regex extension libpcre against v8.32, enabling utf8, unicode props, and jit (bug 5593). 2013-03-17 11:39:04 -04:00
Nicholas Hastings 6ce00034a2 Updated PCRE source to version 8.32 (bug 5593). 2013-03-17 11:32:03 -04:00
Nicholas Hastings ed6d8521e6 Added msvc10 proj file for Regex extension and hooked up to meta sln (NPOTB). 2013-03-17 11:29:55 -04:00
Kyle Sanderson d24c751eef Fixed crash regression in cset 90159516acd3 when player auth is invalid (bug 5538, r=asherkin). 2013-03-17 09:49:31 -04:00
Scott Ehlert 54012523bc Added --no-mysql option to configure script to make MySQL optional (bug 5661, r=dvander). 2013-03-17 02:40:04 -05:00
Nicholas Hastings 5286f43133 Fixed Windows build. 2013-03-17 00:26:53 -04:00
Peace-Maker ca1e9a2976 Increased map name buffer sizes in mapchooser (bug 5609, r=psychonic). 2013-03-16 23:17:22 -04:00
Kyle Sanderson 5951cbf7b9 Added GetSteamAccountID function to IPlayerHelpers and native for sp (bug 5548, r=asherkin). 2013-03-16 23:12:40 -04:00
Kyle Sanderson e2b519a21e Fixed build error in mms_sample_ext from cset d17aed3d46bf (r=psychonic). 2013-03-16 23:02:36 -04:00
Nicholas Hastings cf0401fea7 Add DPT_Int64 type to netprop dumps (bug 5655, r=asherkin). 2013-03-16 22:57:57 -04:00
Nicholas Hastings 14a8f4a728 Get GetEntityClassname m_iClassname offset from worldspawn (bug 5654, r=asherkin). 2013-03-16 22:57:33 -04:00
Scott Ehlert 3e41d9b794 Made BreakpadSymbols script compatbile with Python 2.6 and above (bug 5660, r=asherkin). 2013-03-16 22:55:59 -04:00
Nicholas Hastings 148867bf47 Fixed build. 2013-03-16 22:50:51 -04:00
Kyle Sanderson ef6c454137 Replace usages of deprecated Sourcehook Add/Remove macros (bug 5631, r=dvander). 2013-03-16 22:15:25 -04:00
FlaminSarge 093f8cb89b Exposed third parameter of TF2's AddCond in TF2_AddCondition (bug 5641, r=psychonic). 2013-03-16 18:05:22 -04:00
Nicholas Hastings 707e820af6 Fixed some engine builds failing. 2013-03-16 14:11:56 -04:00
Nicholas Hastings 0c7696da65 Add GetPlayerResourceEntity to SDKTools; deprecate old, broken TF2-specific impl (bug 5491, r=asherkin). 2013-03-16 13:50:36 -04:00
Nicholas Hastings 9e540eb1c4 Move UserMessages::m_pBase to only engines without protobuf msgs (r=asherkin). 2013-03-16 13:42:11 -04:00
Nicholas Hastings 306828480f Added repeated field handing to PbSet* natives (bug 5633, r=asherkin). 2013-03-16 13:31:56 -04:00
Nicholas Hastings 42b415952b Added repeated field handling to PbRead* natives. Deprecate PbReadRepeated* (bug 5633, r=asherkin). 2013-03-16 13:31:35 -04:00
FlaminSarge e155e258cb Updated TF2 TFCond defines (bug 5642, r=psychonic). 2013-03-16 13:30:00 -04:00
Kyle Sanderson 6f45794574 Fixed mismatched delete [] on thunks in JIT CompData dtor (bug 5639, r=dvander). 2013-03-16 13:08:35 -04:00
Scott Ehlert 1d30f00806 Added --sdks option to configure script to specify which SDKs to build againt (bug 5630, r=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 20:26:08 -05:00
Asher Baker 52e9ec10bf Fixed issues with COMMAND_FILTER_NO_BOTS and @bots multi-target. (r=fennec) 2013-03-10 03:20:31 +00:00
Asher Baker 8da56ff98c Allow access to unvalidated authstrings (bug 5587, r=psychonic). 2013-03-07 00:58:17 +00:00
Nicholas Hastings d44e334524 Fixed SDKHooks GetMaxHealth callback being passed incorrect parameters. 2013-03-02 13:42:07 -05:00
Asher Baker e814e65fcb Error on access to nested datamap props (bug 5446, r=psychonic). 2012-09-03 20:26:39 +01:00
Kyle Sanderson c2f7d600aa Change extension unload order to avoid exposing finalisation window (bug 5556, r=asherkin). 2013-02-28 22:04:28 +00:00
Kyle Sanderson 5d942265f9 Overhaul of ClientPrefs extension (bug 5538, r=asherkin). 2013-02-28 21:51:49 +00:00
Scott Ehlert 6b07625192 Added L4D and L4D2 gamedata for SDK Hooks on Mac OS X. 2013-02-25 20:44:16 -06:00
Scott Ehlert 19b56361b9 Triggerin' a build. 2013-02-25 17:02:00 -06:00
Kyle Sanderson 7d93eba321 Removed call to getchar() in debug build of compiler (bug 5626, r=ds). 2013-02-25 16:30:19 -06:00
Nicholas Hastings 7b42aba5ea Fixed startup crash regression (bug 5607, r=dvander). 2013-02-18 20:13:08 -05:00
GoD-Tony be4ac7ca61 Rolled version to 1.6.0 for manual builds (r=psychonic). 2013-02-17 22:13:51 -05:00
GoD-Tony 28e25ea718 Added missing rootconsole extern to sample extension (bug 5402, r=psychonic). 2013-02-17 21:47:19 -05:00
Nicholas Hastings b2e6e6155f Updated core and logic msvc10 project files (NPOTB). 2013-02-16 22:21:41 -05:00
David Anderson f5e1ff3f1f Fix more build bustage. 2013-02-16 17:28:17 -08:00
David Anderson 3fda82b5f8 Fix build bustage. 2013-02-16 17:01:53 -08:00
David Anderson 822a4896da Fix build bustage. 2013-02-16 16:50:47 -08:00
David Anderson 7f2bf03d7e Trigger an build. 2013-02-16 16:45:54 -08:00
David Anderson 1e8a6e878d Move DebugReporter from core to logic (bug 5607, r=psychonic).
--HG--
rename : core/DebugReporter.cpp => core/logic/DebugReporter.cpp
rename : core/DebugReporter.h => core/logic/DebugReporter.h
2013-02-16 15:57:00 -08:00
David Anderson 5f0a55057e Move filesystem natives from Core to Logic (bug 5606, r=psychonic).
--HG--
rename : core/smn_filesystem.cpp => core/logic/smn_filesystem.cpp
2013-02-16 15:52:11 -08:00
David Anderson 7814acb9f8 Remove plugin_settings.cfg and supporting code (bug 5605, r=psychonic).
--HG--
extra : rebase_source : 66d0ba0ddb5c649e7f72d96bdf3629e563522ae9
2013-02-16 15:15:22 -08:00
Nicholas Hastings b296af6fe4 Added support for "fuzzy" map names in L4D and later (bug 5599, r=asherkin). 2013-02-14 19:28:12 -05:00
Nicholas Hastings 14b9902f6d Updated CS:GO gamedata. 2013-02-13 22:25:15 -05:00
Kyle Sanderson f2d54b7728 Fixed SM ambuild config failure at TF2 ext if ep2v sdk is missing (bug 5608, r=psychonic). 2013-02-12 12:26:10 -05:00
Nicholas Hastings 8950a693db More, hopefully final CS:GO/protobuf usermessage fixups (bug 5588). 2013-02-11 15:11:04 -05:00
Ruben Gonzalez fd3b9095ba Fix CS_WeaponIDToAlias param missing CSWeaponID tag (bug 5460) 2013-02-11 11:17:31 -05:00
Nicholas Hastings 030e1b9130 Added missing smn_protobuf.cpp to core msvc10 project (NPOTB). 2013-02-11 09:39:23 -05:00
Nicholas Hastings a040c237bc Removed intentional invalid steamid crash in SDK Hooks. 2013-02-11 09:39:23 -05:00
Nicholas Hastings a62fafd4ed Fixed typo in Fortress Forever gamedat.a 2013-02-11 09:39:23 -05:00
David Anderson 666703e8cf Trigger build. 2013-02-10 21:43:07 -08:00
David Anderson 52cd52ca54 Bump version to 1.6.0. 2013-02-10 21:10:25 -08: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
1428 changed files with 388485 additions and 200422 deletions
+5
View File
@@ -0,0 +1,5 @@
{
"project_id" : "sourcemod",
"conduit_uri" : "https://phabricator.alliedmods.net/",
"history.immutable" : false
}
+37
View File
@@ -0,0 +1,37 @@
# Binaries
*.dll
*.dylib
*.exe
*.so
# Files generated by Visual Studio
*.aps
*.ipch
*.ncb
*.opensdf
*.sdf
*.suo
*.user
# Build directories
CrazyDebug*/
Debug*/
Release*/
LIB-Release/
LIB-Debug/
# Files generated by Mac OS X Finder
.DS_Store
# Files generated by Windows Explorer
[Dd]esktop.ini
[Tt]humbs.db
# AMBuild build directories
build/
obj-*/
*~
*.rej
*.orig
*.smx
*.swp
-26
View File
@@ -1,26 +0,0 @@
# Binaries
\.dll$
\.dylib$
\.exe$
\.so$
# Files generated by Visual Studio
\.aps$
\.ipch$
\.ncb$
\.opensdf$
\.sdf$
\.suo$
\.user$
# Build directories
/CrazyDebug.*
/Debug.*
/Release.*
# Files generated by Mac OS X Finder
(^|/)\.DS_Store$
# Files generated by Windows Explorer
(^|/)[dD]esktop\.ini$
(^|/)[tT]humbs\.db$
-7
View File
@@ -1,7 +0,0 @@
54539fa4e51f98d7841c853c1370dff6ccd3cdf2 sourcemod-1.0.0
e6ef5ecdf8d75740ca2685a709bf321f8873bc3b sourcemod-1.1.0
e877885fac80be71822641f7a9122cebc9812521 sourcemod-1.1.1
b3ffa8a4511c4eadaf533fc790aa6b14f7f0c6ea sourcemod-1.1.2
3a73bbf60f34befa9b66be03fa5974b394bb3411 sourcemod-1.2.0
ddd707c3454c382db5db9d28148cd19227f44759 sourcemod-1.4.0
f74e1dea2ef2c5a12b5238badc0e877106804191 sourcemod-1.4.1
+11
View File
@@ -0,0 +1,11 @@
language: cpp
compiler:
- clang
before_script:
- sudo apt-get update -qq
- sudo apt-get install -y g++-multilib libc6-dev-i386 lib32stdc++6 lib32z1-dev
- CHECKOUT_DIR=$PWD && cd .. && $CHECKOUT_DIR/tools/checkout-deps.sh && cd $CHECKOUT_DIR
script:
- mkdir build && cd build
- python ../configure.py --enable-optimize --sdks=episode1,tf2,l4d2,csgo,dota
- ambuild
+518 -392
View File
@@ -1,400 +1,526 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os
import sys
from ambuild.command import SymlinkCommand
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os, sys
class SM:
def __init__(self):
self.compiler = Cpp.Compiler()
class SDK(object):
def __init__(self, sdk, ext, aDef, name, platform, dir):
self.folder = 'hl2sdk-' + dir
self.envvar = sdk
self.ext = ext
self.code = aDef
self.define = name
self.platform = platform
self.name = dir
self.path = None # Actual path
#Build SDK info
self.possibleSdks = { }
self.possibleSdks['ep1'] = {'sdk': 'HL2SDK', 'ext': '1.ep1', 'def': '1',
'name': 'EPISODEONE', 'platform': ['windows', 'linux']}
self.possibleSdks['ep2'] = {'sdk': 'HL2SDKOB', 'ext': '2.ep2', 'def': '3',
'name': 'ORANGEBOX', 'platform': ['windows', 'linux']}
self.possibleSdks['ep2v'] = {'sdk': 'HL2SDKOBVALVE', 'ext': '2.ep2v', 'def': '6',
'name': 'ORANGEBOXVALVE', 'platform': ['windows', 'linux', 'darwin']}
self.possibleSdks['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '7',
'name': 'LEFT4DEAD', 'platform': ['windows', 'linux', 'darwin']}
self.possibleSdks['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '8',
'name': 'LEFT4DEAD2', 'platform': ['windows', 'linux', 'darwin']}
self.possibleSdks['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
'name': 'DARKMESSIAH', 'platform': ['windows']}
self.possibleSdks['swarm'] = {'sdk': 'HL2SDK-SWARM', 'ext': '2.swarm', 'def': '9',
'name': 'ALIENSWARM', 'platform': ['windows']}
self.possibleSdks['bgt'] = {'sdk': 'HL2SDK-BGT', 'ext': '2.bgt', 'def': '4',
'name': 'BLOODYGOODTIME', 'platform': ['windows']}
self.possibleSdks['eye'] = {'sdk': 'HL2SDK-EYE', 'ext': '2.eye', 'def': '5',
'name': 'EYE', 'platform': ['windows']}
self.sdkInfo = { }
WinOnly = ['windows']
WinLinux = ['windows', 'linux']
WinLinuxMac = ['windows', 'linux', 'mac']
if AMBuild.mode == 'config':
#Detect compilers
self.compiler.DetectAll(AMBuild)
#Detect variables
envvars = { 'MMSOURCE18': 'mmsource-1.8',
'HL2SDKOBVALVE': 'hl2sdk-ob-valve',
'HL2SDKL4D': 'hl2sdk-l4d',
'HL2SDKL4D2': 'hl2sdk-l4d2',
'MYSQL5': 'mysql-5.0'
}
if AMBuild.target['platform'] != 'darwin':
envvars['HL2SDK'] = 'hl2sdk'
envvars['HL2SDKOB'] = 'hl2sdk-ob'
#Dark Messiah is Windows-only
if AMBuild.target['platform'] == 'windows':
envvars['HL2SDK-DARKM'] = 'hl2sdk-darkm'
envvars['HL2SDK-SWARM'] = 'hl2sdk-swarm'
envvars['HL2SDK-BGT'] = 'hl2sdk-bgt'
envvars['HL2SDK-EYE'] = 'hl2sdk-eye'
# Finds if a dict with `key` set to `value` is present on the dict of dicts `dictionary`
def findDictByKey(dictionary, key, value):
for index in dictionary:
elem = dictionary[index]
if elem[key] == value:
return (elem, index)
return None
for i in envvars:
if i in os.environ:
path = os.environ[i]
if not os.path.isdir(path):
raise Exception('Path for {0} was not found: {1}'.format(i, path))
elif i.startswith('HL2SDK'):
(info, sdk) = findDictByKey(self.possibleSdks, 'sdk', i)
self.sdkInfo[sdk] = info
else:
head = os.getcwd()
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 i.startswith('HL2SDK'):
if head != None and head != oldhead:
(info, sdk) = findDictByKey(self.possibleSdks, 'sdk', i)
self.sdkInfo[sdk] = info
elif head == None or head == oldhead:
raise Exception('Could not find a valid path for {0}'.format(i))
AMBuild.cache.CacheVariable(i, path)
if len(self.sdkInfo) < 1:
raise Exception('At least one SDK must be available.')
AMBuild.cache.CacheVariable('sdkInfo', self.sdkInfo)
#Set up defines
cxx = self.compiler.cxx
if isinstance(cxx, Cpp.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 (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')
self.compiler.AddToListVar('CFLAGS', '-Werror')
self.compiler.AddToListVar('CFLAGS', '-Wno-uninitialized')
self.compiler.AddToListVar('CFLAGS', '-Wno-unused')
self.compiler.AddToListVar('CFLAGS', '-Wno-switch')
self.compiler.AddToListVar('CFLAGS', '-msse')
self.compiler.AddToListVar('CFLAGS', '-m32')
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 >= 3) 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')
self.compiler.AddToListVar('CDEFINES', '_CRT_SECURE_NO_WARNINGS')
self.compiler.AddToListVar('CDEFINES', '_CRT_NONSTDC_NO_DEPRECATE')
self.compiler.AddToListVar('CXXFLAGS', '/EHsc')
self.compiler.AddToListVar('CXXFLAGS', '/GR-')
self.compiler.AddToListVar('CFLAGS', '/W3')
self.compiler.AddToListVar('CFLAGS', '/nologo')
self.compiler.AddToListVar('CFLAGS', '/Zi')
self.compiler.AddToListVar('CXXFLAGS', '/TP')
self.compiler.AddToListVar('POSTLINKFLAGS', '/DEBUG')
self.compiler.AddToListVar('POSTLINKFLAGS', '/MACHINE:X86')
self.compiler.AddToListVar('POSTLINKFLAGS', '/SUBSYSTEM:WINDOWS')
self.compiler.AddToListVar('POSTLINKFLAGS', 'kernel32.lib')
self.compiler.AddToListVar('POSTLINKFLAGS', 'user32.lib')
self.compiler.AddToListVar('POSTLINKFLAGS', 'gdi32.lib')
self.compiler.AddToListVar('POSTLINKFLAGS', 'winspool.lib')
self.compiler.AddToListVar('POSTLINKFLAGS', 'comdlg32.lib')
self.compiler.AddToListVar('POSTLINKFLAGS', 'advapi32.lib')
self.compiler.AddToListVar('POSTLINKFLAGS', 'shell32.lib')
self.compiler.AddToListVar('POSTLINKFLAGS', 'ole32.lib')
self.compiler.AddToListVar('POSTLINKFLAGS', 'oleaut32.lib')
self.compiler.AddToListVar('POSTLINKFLAGS', 'uuid.lib')
self.compiler.AddToListVar('POSTLINKFLAGS', 'odbc32.lib')
self.compiler.AddToListVar('POSTLINKFLAGS', 'odbccp32.lib')
#Optimization
if AMBuild.options.opt == '1':
self.compiler.AddToListVar('CDEFINES', 'NDEBUG')
if self.vendor == 'gcc' or self.vendor == 'clang':
self.compiler.AddToListVar('CFLAGS', '-O3')
elif self.vendor == 'msvc':
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' or self.vendor == 'clang':
self.compiler.AddToListVar('CFLAGS', '-g3')
elif self.vendor == 'msvc':
self.compiler.AddToListVar('CFLAGS', '/Od')
self.compiler.AddToListVar('CFLAGS', '/RTC1')
#Platform-specifics
if AMBuild.target['platform'] == 'linux':
self.compiler.AddToListVar('CDEFINES', '_LINUX')
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('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')
#Finish up
self.compiler.AddToListVar('CDEFINES', 'SOURCEMOD_BUILD')
self.compiler.AddToListVar('CDEFINES', 'SM_GENERATED_BUILD')
self.compiler.AddToListVar('CINCLUDES',
os.path.join(AMBuild.outputFolder, 'includes'))
self.compiler.ToConfig(AMBuild, 'compiler')
AMBuild.cache.CacheVariable('vendor', self.vendor)
self.targetMap = { }
AMBuild.cache.CacheVariable('targetMap', self.targetMap)
else:
self.sdkInfo = AMBuild.cache['sdkInfo']
self.compiler.FromConfig(AMBuild, 'compiler')
self.targetMap = AMBuild.cache['targetMap']
if AMBuild.target['platform'] == 'windows':
self.compiler.AddToListVar('RCINCLUDES', os.path.join(AMBuild.sourceFolder, 'public'))
self.compiler.AddToListVar('RCINCLUDES',
os.path.join(AMBuild.outputFolder, 'includes'))
self.mmsPath = AMBuild.cache['MMSOURCE18']
def DefaultCompiler(self):
return self.compiler.Clone()
def JobMatters(self, jobname):
file = sys._getframe().f_code.co_filename
if AMBuild.mode == 'config':
self.targetMap[jobname] = file
return True
if len(AMBuild.args) == 0:
return True
if not jobname in AMBuild.args:
return False
def DefaultExtCompiler(self, path):
compiler = self.DefaultCompiler()
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, path))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, path, 'sdk'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'extensions'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'sourcepawn'))
return compiler
def AutoVersion(self, folder, binary):
if AMBuild.target['platform'] == 'windows':
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
def PreSetupHL2Job(self, job, builder, sdk):
info = self.sdkInfo[sdk]
sdkPath = AMBuild.cache[info['sdk']]
if AMBuild.target['platform'] == 'linux':
if sdk == 'ep1':
staticLibs = os.path.join(sdkPath, 'linux_sdk')
else:
staticLibs = os.path.join(sdkPath, 'lib', 'linux')
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
if sdk in ['ep2v', 'l4d', 'l4d2']:
for i in ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.so', 'libtier0.so']:
link = os.path.join(workFolder, i)
target = os.path.join(staticLibs, i)
try:
os.lstat(link)
except:
job.AddCommand(SymlinkCommand(link, target))
else:
for i in ['tier1_i486.a', 'mathlib_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']:
link = os.path.join(workFolder, i)
target = os.path.join(staticLibs, i)
try:
os.lstat(link)
except:
job.AddCommand(SymlinkCommand(link, target))
elif AMBuild.target['platform'] == 'darwin':
staticLibs = os.path.join(sdkPath, 'lib', 'mac')
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
for i in ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.dylib', 'libtier0.dylib']:
link = os.path.join(workFolder, i)
target = os.path.join(staticLibs, i)
try:
os.lstat(link)
except:
job.AddCommand(SymlinkCommand(link, target))
elif AMBuild.target['platform'] == 'windows':
libs = ['tier0', 'tier1', 'vstdlib', 'mathlib']
if sdk == 'swarm':
libs.append('interfaces')
for lib in libs:
libPath = os.path.join(sdkPath, 'lib', 'public', lib) + '.lib'
builder.RebuildIfNewer(libPath)
builder['POSTLINKFLAGS'].append(libPath)
def PostSetupHL2Job(self, job, builder, sdk):
if AMBuild.target['platform'] in ['linux', 'darwin']:
builder.AddObjectFiles(['tier1_i486.a', 'mathlib_i486.a'])
def DefaultHL2Compiler(self, path, sdk, noLink = False, oldMms = '-legacy'):
compiler = self.DefaultExtCompiler(path)
mms = 'core'
if sdk == 'ep1':
mms += oldMms
compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms))
compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms, 'sourcehook'))
info = self.possibleSdks
compiler['CDEFINES'].extend(['SE_' + info[i]['name'] + '=' + info[i]['def'] for i in info])
paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'],
['public', 'tier0'], ['public', 'tier1']]
if sdk == 'ep1' or sdk == 'darkm':
paths.append(['public', 'dlls'])
paths.append(['game_shared'])
else:
paths.append(['public', 'game', 'server'])
paths.append(['public', 'toolframework'])
paths.append(['game', 'shared'])
paths.append(['common'])
info = self.sdkInfo[sdk]
sdkPath = AMBuild.cache[info['sdk']]
compiler['CDEFINES'].append('SOURCE_ENGINE=' + info['def'])
if sdk == 'swarm' and AMBuild.target['platform'] == 'windows':
compiler['CDEFINES'].extend(['COMPILER_MSVC', 'COMPILER_MSVC32'])
if sdk == 'ep1':
if AMBuild.target['platform'] == 'linux':
staticLibs = os.path.join(sdkPath, 'linux_sdk')
else:
if AMBuild.target['platform'] == 'linux':
staticLibs = os.path.join(sdkPath, 'lib', 'linux')
elif AMBuild.target['platform'] == 'darwin':
staticLibs = os.path.join(sdkPath, 'lib', 'mac')
for i in paths:
compiler['CXXINCLUDES'].append(os.path.join(sdkPath, *i))
if not noLink:
if AMBuild.target['platform'] == 'linux':
compiler['POSTLINKFLAGS'][0:0] = ['-lm']
if sdk in ['ep2v', 'l4d', 'l4d2']:
compiler['POSTLINKFLAGS'][0:0] = ['libtier0.so']
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.so']
else:
compiler['POSTLINKFLAGS'][0:0] = ['tier0_i486.so']
compiler['POSTLINKFLAGS'][0:0] = ['vstdlib_i486.so']
elif AMBuild.target['platform'] == 'darwin':
compiler['POSTLINKFLAGS'][0:0] = ['libtier0.dylib']
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.dylib']
return compiler
sm = SM()
globals = {
'SM': sm
PossibleSDKs = {
'episode1': SDK('HL2SDK', '1.ep1', '1', 'EPISODEONE', WinLinux, 'episode1'),
'ep2': SDK('HL2SDKOB', '2.ep2', '3', 'ORANGEBOX', WinLinux, 'orangebox'),
'css': SDK('HL2SDKCSS', '2.css', '6', 'CSS', WinLinuxMac, 'css'),
'hl2dm': SDK('HL2SDKHL2DM', '2.hl2dm', '7', 'HL2DM', WinLinuxMac, 'hl2dm'),
'dods': SDK('HL2SDKDODS', '2.dods', '8', 'DODS', WinLinuxMac, 'dods'),
'sdk2013': SDK('HL2SDK2013', '2.sdk2013', '9', 'SDK2013', WinLinuxMac, 'sdk2013'),
'tf2': SDK('HL2SDKTF2', '2.tf2', '10', 'TF2', WinLinuxMac, 'tf2'),
'l4d': SDK('HL2SDKL4D', '2.l4d', '11', 'LEFT4DEAD', WinLinuxMac, 'l4d'),
'nucleardawn': SDK('HL2SDKND', '2.nd', '12', 'NUCLEARDAWN', WinLinuxMac, 'nucleardawn'),
'l4d2': SDK('HL2SDKL4D2', '2.l4d2', '14', 'LEFT4DEAD2', WinLinuxMac, 'l4d2'),
'darkm': SDK('HL2SDK-DARKM', '2.darkm', '2', 'DARKMESSIAH', WinOnly, 'darkm'),
'swarm': SDK('HL2SDK-SWARM', '2.swarm', '15', 'ALIENSWARM', WinOnly, 'swarm'),
'bgt': SDK('HL2SDK-BGT', '2.bgt', '4', 'BLOODYGOODTIME', WinOnly, 'bgt'),
'eye': SDK('HL2SDK-EYE', '2.eye', '5', 'EYE', WinOnly, 'eye'),
'csgo': SDK('HL2SDKCSGO', '2.csgo', '19', 'CSGO', WinLinuxMac, 'csgo'),
'dota': SDK('HL2SDKDOTA', '2.dota', '20', 'DOTA', WinLinuxMac, 'dota'),
'portal2': SDK('HL2SDKPORTAL2', '2.portal2', '16', 'PORTAL2', [], 'portal2'),
'blade': SDK('HL2SDKBLADE', '2.blade', '17', 'BLADE', WinLinux, 'blade'),
'insurgency': SDK('HL2SDKINSURGENCY', '2.insurgency', '18', 'INSURGENCY', WinLinuxMac, 'insurgency'),
'contagion': SDK('HL2SDKCONTAGION', '2.contagion', '13', 'CONTAGION', WinOnly, 'contagion'),
}
AMBuild.Include(os.path.join('tools', 'buildbot', 'Versioning'), globals)
def ResolveEnvPath(env, folder):
if env in os.environ:
path = os.environ[env]
if os.path.isdir(path):
return path
return None
FileList = [
['loader', 'AMBuilder'],
['core', 'AMBuilder'],
['core', 'logic', 'AMBuilder'],
['extensions', 'bintools', 'AMBuilder'],
['extensions', 'clientprefs', 'AMBuilder'],
['extensions', 'cstrike', 'AMBuilder'],
['extensions', 'curl', 'AMBuilder'],
['extensions', 'geoip', 'AMBuilder'],
['extensions', 'mysql', 'AMBuilder'],
['extensions', 'sdktools', 'AMBuilder'],
['extensions', 'topmenus', 'AMBuilder'],
['extensions', 'updater', 'AMBuilder'],
['extensions', 'sqlite', 'AMBuilder'],
['extensions', 'regex', 'AMBuilder'],
['extensions', 'tf2', 'AMBuilder'],
['sourcepawn', 'jit', 'AMBuilder'],
['sourcepawn', 'compiler', 'AMBuilder'],
['plugins', 'AMBuilder'],
['tools', 'buildbot', 'PackageScript']
]
head = os.getcwd()
oldhead = None
while head != None and head != oldhead:
path = os.path.join(head, folder)
if os.path.isdir(path):
return path
oldhead = head
head, tail = os.path.split(head)
for parts in FileList:
AMBuild.Include(os.path.join(*parts), globals)
return None
def Normalize(path):
return os.path.abspath(os.path.normpath(path))
class SMConfig(object):
def __init__(self):
self.sdks = {}
self.binaries = []
self.extensions = []
self.generated_headers = None
self.mms_root = None
self.mysql_root = None
self.spcomp = None
self.smx_files = {}
self.versionlib = None
def use_auto_versioning(self):
if builder.backend != 'amb2':
return False
return not getattr(builder.options, 'disable_auto_versioning', False)
@property
def tag(self):
if builder.options.debug == '1':
return 'Debug'
return 'Release'
def detectProductVersion(self):
builder.AddConfigureFile('product.version')
# For OS X dylib versioning
import re
with open(os.path.join(builder.sourcePath, 'product.version'), 'r') as fp:
productContents = fp.read()
m = re.match('(\d+)\.(\d+)\.(\d+).*', productContents)
if m == None:
self.productVersion = '1.0.0'
else:
major, minor, release = m.groups()
self.productVersion = '{0}.{1}.{2}'.format(major, minor, release)
def detectSDKs(self):
sdk_list = builder.options.sdks.split(',')
use_all = sdk_list[0] == 'all'
use_present = sdk_list[0] == 'present'
for sdk_name in PossibleSDKs:
sdk = PossibleSDKs[sdk_name]
if builder.target_platform in sdk.platform:
if builder.options.hl2sdk_root:
sdk_path = os.path.join(builder.options.hl2sdk_root, sdk.folder)
else:
sdk_path = ResolveEnvPath(sdk.envvar, sdk.folder)
if sdk_path is None or not os.path.isdir(sdk_path):
if use_all or sdk_name in sdk_list:
raise Exception('Could not find a valid path for {0}'.format(sdk.envvar))
continue
if use_all or use_present or sdk_name in sdk_list:
sdk.path = Normalize(sdk_path)
self.sdks[sdk_name] = sdk
if len(self.sdks) < 1:
raise Exception('At least one SDK must be available.')
if builder.options.mms_path:
self.mms_root = builder.options.mms_path
else:
self.mms_root = ResolveEnvPath('MMSOURCE110', 'mmsource-1.10')
if not self.mms_root:
self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'metamod-source')
if not self.mms_root:
self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'mmsource-central')
if not self.mms_root or not os.path.isdir(self.mms_root):
raise Exception('Could not find a source copy of Metamod:Source')
self.mms_root = Normalize(self.mms_root)
if builder.options.hasMySql:
if builder.options.mysql_path:
self.mysql_root = builder.options.mysql_path
else:
for i in range(7):
self.mysql_root = ResolveEnvPath('MYSQL5', 'mysql-5.' + str(i))
if self.mysql_root:
break
if not self.mysql_root or not os.path.isdir(self.mysql_root):
raise Exception('Could not find a path to MySQL!')
self.mysql_root = Normalize(self.mysql_root)
def configure(self):
builder.AddConfigureFile('pushbuild.txt')
cxx = builder.DetectCompilers()
if cxx.like('gcc'):
cxx.defines += [
'stricmp=strcasecmp',
'_stricmp=strcasecmp',
'_snprintf=snprintf',
'_vsnprintf=vsnprintf',
'HAVE_STDINT_H',
'GNUC',
]
cxx.cflags += [
'-pipe',
'-fno-strict-aliasing',
'-Wall',
'-Werror',
'-Wno-unused',
'-Wno-switch',
'-Wno-array-bounds',
'-msse',
'-m32',
]
cxx.cxxflags += [
'-std=c++11',
]
have_gcc = cxx.vendor == 'gcc'
have_clang = cxx.vendor == 'clang'
if have_clang or (have_gcc and cxx.version >= '4'):
cxx.cflags += ['-fvisibility=hidden']
cxx.cxxflags += ['-fvisibility-inlines-hidden']
if have_clang or (have_gcc and cxx.version >= '4.6'):
cxx.cflags += ['-Wno-narrowing']
if (have_gcc and cxx.version >= '4.7') or (have_clang and cxx.version >= '3'):
cxx.cxxflags += ['-Wno-delete-non-virtual-dtor']
if have_gcc and cxx.version >= '4.8':
cxx.cflags += ['-Wno-unused-result']
if have_clang:
cxx.cxxflags += ['-Wno-implicit-exception-spec-mismatch']
if cxx.version >= 'apple-clang-5.1' or cxx.version >= 'clang-3.4':
cxx.cxxflags += ['-Wno-deprecated-register']
else:
cxx.cxxflags += ['-Wno-deprecated']
cxx.cflags += ['-Wno-sometimes-uninitialized']
cxx.linkflags += ['-m32']
cxx.cxxflags += [
'-fno-exceptions',
'-fno-threadsafe-statics',
'-Wno-non-virtual-dtor',
'-Wno-overloaded-virtual',
]
if have_gcc:
cxx.cflags += ['-mfpmath=sse']
elif cxx.vendor == 'msvc':
if builder.options.debug == '1':
cxx.cflags += ['/MTd']
cxx.linkflags += ['/NODEFAULTLIB:libcmt']
else:
cxx.cflags += ['/MT']
cxx.defines += [
'_CRT_SECURE_NO_DEPRECATE',
'_CRT_SECURE_NO_WARNINGS',
'_CRT_NONSTDC_NO_DEPRECATE',
'_ITERATOR_DEBUG_LEVEL=0',
]
if cxx.version < 1800:
cxx.defines += 'strtoull=_strtoui64'
cxx.cflags += [
'/W3',
]
cxx.cxxflags += [
'/EHsc',
'/GR-',
'/TP',
]
cxx.linkflags += [
'/MACHINE:X86',
'/SUBSYSTEM:WINDOWS',
'kernel32.lib',
'user32.lib',
'gdi32.lib',
'winspool.lib',
'comdlg32.lib',
'advapi32.lib',
'shell32.lib',
'ole32.lib',
'oleaut32.lib',
'uuid.lib',
'odbc32.lib',
'odbccp32.lib',
]
# Optimization
if builder.options.opt == '1':
cxx.defines += ['NDEBUG']
if cxx.like('gcc'):
cxx.cflags += ['-O3']
elif cxx.like('msvc'):
cxx.cflags += ['/Ox', '/Zo']
cxx.linkflags += ['/OPT:ICF', '/OPT:REF']
# Debugging
if builder.options.debug == '1':
cxx.defines += ['DEBUG', '_DEBUG']
if cxx.like('msvc'):
cxx.cflags += ['/Od', '/RTC1']
# This needs to be after our optimization flags which could otherwise disable it.
if cxx.vendor == 'msvc':
# Don't omit the frame pointer.
cxx.cflags += ['/Oy-']
# Platform-specifics
if builder.target_platform == 'linux':
cxx.defines += ['_LINUX', 'POSIX']
if cxx.vendor == 'gcc':
cxx.linkflags += ['-static-libgcc']
elif cxx.vendor == 'clang':
cxx.linkflags += ['-lgcc_eh']
elif builder.target_platform == 'mac':
cxx.defines += ['OSX', '_OSX', 'POSIX']
cxx.cflags += ['-mmacosx-version-min=10.5']
cxx.linkflags += [
'-mmacosx-version-min=10.5',
'-arch', 'i386',
'-lstdc++',
'-stdlib=libstdc++',
]
cxx.cxxflags += ['-stdlib=libstdc++']
elif builder.target_platform == 'windows':
cxx.defines += ['WIN32', '_WINDOWS']
# Finish up.
cxx.defines += [
'SOURCEMOD_BUILD',
'SM_USE_VERSIONLIB',
]
if self.use_auto_versioning():
cxx.defines += ['SM_GENERATED_BUILD']
cxx.includes += [os.path.join(builder.buildPath, 'includes')]
cxx.includes += [os.path.join(builder.sourcePath, 'versionlib')]
def AddVersioning(self, binary):
if builder.target_platform == 'windows':
binary.sources += ['version.rc']
binary.compiler.rcdefines += [
'BINARY_NAME="{0}"'.format(binary.outputFile),
'RC_COMPILE',
]
if self.use_auto_versioning():
binary.compiler.rcdefines += ['SM_GENERATED_BUILD']
elif builder.target_platform == 'mac':
if binary.type == 'library':
binary.compiler.postlink += [
'-compatibility_version', '1.0.0',
'-current_version', self.productVersion
]
if self.use_auto_versioning():
binary.compiler.linkflags += [self.versionlib]
binary.compiler.sourcedeps += SM.generated_headers
return binary
def Library(self, context, name):
binary = context.compiler.Library(name)
return self.AddVersioning(binary)
def Program(self, context, name):
binary = context.compiler.Program(name)
return self.AddVersioning(binary)
def ConfigureForExtension(self, context, compiler):
compiler.cxxincludes += [
os.path.join(context.currentSourcePath),
os.path.join(context.currentSourcePath, 'sdk'),
os.path.join(builder.sourcePath, 'public'),
os.path.join(builder.sourcePath, 'public', 'extensions'),
os.path.join(builder.sourcePath, 'public', 'sourcepawn'),
os.path.join(builder.sourcePath, 'public', 'amtl'),
]
return compiler
def ExtLibrary(self, context, name):
binary = context.compiler.Library(name)
self.ConfigureForExtension(context, binary.compiler)
return self.AddVersioning(binary)
def ConfigureForHL2(self, binary, sdk):
compiler = binary.compiler
if sdk.name == 'episode1':
mms_path = os.path.join(self.mms_root, 'core-legacy')
else:
mms_path = os.path.join(self.mms_root, 'core')
compiler.cxxincludes += [
os.path.join(mms_path),
os.path.join(mms_path, 'sourcehook'),
]
defines = ['SE_' + PossibleSDKs[i].define + '=' + PossibleSDKs[i].code for i in PossibleSDKs]
compiler.defines += defines
paths = [
['public'],
['public', 'engine'],
['public', 'mathlib'],
['public', 'vstdlib'],
['public', 'tier0'],
['public', 'tier1']
]
if sdk.name == 'episode1' or sdk.name == 'darkm':
paths.append(['public', 'dlls'])
paths.append(['game_shared'])
else:
paths.append(['public', 'game', 'server'])
paths.append(['public', 'toolframework'])
paths.append(['game', 'shared'])
paths.append(['common'])
compiler.defines += ['SOURCE_ENGINE=' + sdk.code]
if sdk.name == 'sdk2013' and compiler.like('gcc'):
# The 2013 SDK already has these in public/tier0/basetypes.h
compiler.defines.remove('stricmp=strcasecmp')
compiler.defines.remove('_stricmp=strcasecmp')
compiler.defines.remove('_snprintf=snprintf')
compiler.defines.remove('_vsnprintf=vsnprintf')
if compiler.like('msvc'):
compiler.defines += ['COMPILER_MSVC', 'COMPILER_MSVC32']
else:
compiler.defines += ['COMPILER_GCC']
# For everything after Swarm, this needs to be defined for entity networking
# to work properly with sendprop value changes.
if sdk.name in ['blade', 'insurgency', 'csgo', 'dota']:
compiler.defines += ['NETWORK_VARS_ENABLED']
if sdk.name in ['css', 'hl2dm', 'dods', 'sdk2013', 'tf2', 'l4d', 'nucleardawn', 'l4d2', 'dota']:
if builder.target_platform in ['linux', 'mac']:
compiler.defines += ['NO_HOOK_MALLOC', 'NO_MALLOC_OVERRIDE']
if sdk.name == 'csgo' and builder.target_platform == 'linux':
compiler.linkflags += ['-lstdc++']
for path in paths:
compiler.cxxincludes += [os.path.join(sdk.path, *path)]
if builder.target_platform == 'linux':
if sdk.name == 'episode1':
lib_folder = os.path.join(sdk.path, 'linux_sdk')
elif sdk.name == 'sdk2013':
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux32')
else:
lib_folder = os.path.join(sdk.path, 'lib', 'linux')
elif builder.target_platform == 'mac':
if sdk.name == 'sdk2013':
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'osx32')
else:
lib_folder = os.path.join(sdk.path, 'lib', 'mac')
if builder.target_platform in ['linux', 'mac']:
if sdk.name == 'sdk2013':
compiler.postlink += [
compiler.Dep(os.path.join(lib_folder, 'tier1.a')),
compiler.Dep(os.path.join(lib_folder, 'mathlib.a'))
]
else:
compiler.postlink += [
compiler.Dep(os.path.join(lib_folder, 'tier1_i486.a')),
compiler.Dep(os.path.join(lib_folder, 'mathlib_i486.a'))
]
if sdk.name in ['blade', 'insurgency', 'csgo', 'dota']:
compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'interfaces_i486.a'))]
self.AddVersioning(binary)
dynamic_libs = []
if builder.target_platform == 'linux':
compiler.linkflags[0:0] = ['-lm']
if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'nucleardawn', 'l4d2']:
dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so']
elif sdk.name in ['l4d', 'blade', 'insurgency', 'csgo', 'dota']:
dynamic_libs = ['libtier0.so', 'libvstdlib.so']
else:
dynamic_libs = ['tier0_i486.so', 'vstdlib_i486.so']
elif builder.target_platform == 'mac':
compiler.linkflags.append('-liconv')
dynamic_libs = ['libtier0.dylib', 'libvstdlib.dylib']
elif builder.target_platform == 'windows':
libs = ['tier0', 'tier1', 'vstdlib', 'mathlib']
if sdk.name in ['swarm', 'blade', 'insurgency', 'csgo', 'dota']:
libs.append('interfaces')
for lib in libs:
lib_path = os.path.join(sdk.path, 'lib', 'public', lib) + '.lib'
compiler.linkflags.append(compiler.Dep(lib_path))
for library in dynamic_libs:
source_path = os.path.join(lib_folder, library)
output_path = os.path.join(binary.localFolder, library)
def make_linker(source_path, output_path):
def link(context, binary):
cmd_node, (output,) = context.AddSymlink(source_path, output_path)
return output
return link
linker = make_linker(source_path, output_path)
compiler.linkflags[0:0] = [compiler.Dep(library, linker)]
return binary
def HL2Library(self, context, name, sdk):
binary = context.compiler.Library(name)
self.ConfigureForExtension(context, binary.compiler)
return self.ConfigureForHL2(binary, sdk)
def HL2Project(self, context, name):
project = context.compiler.LibraryProject(name)
self.ConfigureForExtension(context, project.compiler)
return project
def HL2Config(self, project, name, sdk):
binary = project.Configure(name, '{0} - {1}'.format(self.tag, sdk.name))
return self.ConfigureForHL2(binary, sdk)
SM = SMConfig()
SM.detectProductVersion()
SM.detectSDKs()
SM.configure()
if SM.use_auto_versioning():
SM.generated_headers = builder.RunScript(
'tools/buildbot/Versioning',
{ 'SM': SM }
)
SM.versionlib = builder.RunScript(
'versionlib/AMBuilder',
{ 'SM': SM }
)
BuildScripts = [
'loader/AMBuilder',
'core/AMBuilder',
'core/logic/AMBuilder',
'extensions/bintools/AMBuilder',
'extensions/clientprefs/AMBuilder',
'extensions/curl/AMBuilder',
'extensions/cstrike/AMBuilder',
'extensions/geoip/AMBuilder',
'extensions/mysql/AMBuilder',
'extensions/regex/AMBuilder',
'extensions/sdkhooks/AMBuilder',
'extensions/sdktools/AMBuilder',
'extensions/sqlite/AMBuilder',
'extensions/tf2/AMBuilder',
'extensions/topmenus/AMBuilder',
'extensions/updater/AMBuilder',
'sourcepawn/compiler/AMBuilder',
'sourcepawn/jit/AMBuilder',
]
if builder.backend == 'amb2':
BuildScripts += [
'plugins/AMBuilder',
'tools/buildbot/PackageScript',
]
builder.RunBuildScripts(BuildScripts, { 'SM': SM })
if builder.options.breakpad_dump:
builder.RunScript('tools/buildbot/BreakpadSymbols', { 'SM': SM })
-5
View File
@@ -1,5 +0,0 @@
CONFIGURE YOUR IDENTITY FOR MERCURIAL!
IF YOU ARE A DEVELOPER WITH PUSH ACCESS, DO IT NOW KPLZTHX.
http://wiki.alliedmods.net/Mercurial_Tutorial#Identity
+17
View File
@@ -0,0 +1,17 @@
SourceMod
=========
General
-------
- [SourceMod website](http://www.sourcemod.net): Source Engine scripting and server administration
- [Forum](https://forums.alliedmods.net/forumdisplay.php?f=52): Discussion forum including plugin/extension development
- [General documentation](https://wiki.alliedmods.net/Category:SourceMod_Documentation): Miscellaneous information about SourceMod
- [Latest release](http://www.sourcemod.net/downloads.php): The latest stable SourceMod release
- [Build snapshots](http://www.sourcemod.net/snapshots.php): Builds of recent development versions
Development
-----------
- [Issue tracker](https://bugs.alliedmods.net): Issues that require back and forth communication
- [Building SourceMod](https://wiki.alliedmods.net/Building_SourceMod): Instructions on how to build SourceMod itself using [AMBuild](https://github.com/alliedmodders/ambuild)
- [SourcePawn scripting](https://wiki.alliedmods.net/Category:SourceMod_Scripting): SourcePawn examples and introduction to the language
- [SourceMod extension development](https://wiki.alliedmods.net/Category:SourceMod_Development): C++ examples and introduction to various extension interfaces
+530
View File
@@ -1,5 +1,535 @@
SourceMod Changelog
SourceMod 1.7.2 [2015-05-30]
URL: http://wiki.alliedmods.net/SourceMod_1.7.2_Release_Notes
User Changes:
- Updated game compatibility for the latest CS:GO updates.
- Fixed potential crash when using SDKTools GameRules_* natives. (PR 330) (yed).
- Fixed regression in v1.7.0 causing admin-sql-threaded plugin to not properly load admins. (bug 6365) (PR 342).
- Fixed leak in plugin heap memory that could lead to "Not enough space on the heap" error. (bug 6370).
----------------------------------------------------------
SourceMod 1.7.1 [2015-04-18]
URL: http://wiki.alliedmods.net/SourceMod_1.7.1_Release_Notes
User Changes:
- Updated game compatibility for CS:GO, TF2, Dota 2, Insurgency, and Fortress Forever.
- Fixed regression causing crash in games that do not support radio menus (PR 286) (Peace-Maker).
- Fixed sm_rename not working on some games, including CS:S and CS:GO (PR 313).
- Fixed some core.cfg values being ignored on start (PR 322).
- Fixed crash when plugins close a menu handle during menu draw (PR 268)
Developer Changes:
- Added tagged TF2_SetClientTeam to provide symmetry to TF2_GetClientTeam (PR 267) (Wliu).
- Added block parameter to FindValueInArray native (PR 213) (splewis).
- Added explicit return types to forwards missing them to avoid future compatibility issues (PR 294).
- Added new SetClientName native to reliably change a player's name on any game (PR 313).
- Fixed tag mismatch warning when using SQLite_UseDatabase (bug 6310) (PR 262) (VoiDeD).
- Fixed not actually being able to block CS_OnCSWeaponDrop (bug 6334) (PR 316).
- Fixed DirExists to throw an error when passed empty string (PR 315).
- Fixed ReadUint16 on File methodmap throwing "not bound" error (PR 265).
- Fixed various include docs (PR 288) (PR 290) (PR 295).
- Fixed issues with declaring variable on same line after array (SP PR 7) (Peace-Maker).
- Fixed debug info for multidimensional strings not being written to smx (SP PR 8) (Peace-Maker).
- Fixed issues with nesting methodmap calls (bug 6329) (SP PR 11) (SP PR 13).
- Improved diagnostic given when function prototype doesn't match an existing definition (PR 291) (VoiDeD).
----------------------------------------------------------
SourceMod 1.7.0 [2015-02-04]
URL: http://wiki.alliedmods.net/SourceMod_1.7.0_Release_Notes
User Changes:
- Updated game compatibility for TF2, CS:GO, and Dota 2.
- Fixed regression in SM 1.6.3 causing load failure on games older than Orangebox. (PR 237)
- Rewrote internal Steam auth ID handling (PR 147, PR 153, PR 155, PR 162, PR 204, PR 210, PR 222, PR 246).
--- admins.cfg now supports Steam2, Steam3, and SteamID 64 formats for the Steam auth provider.
--- admins-simple.ini now supports Steam3 auth IDs in addition to Steam2 IDs.
--- Command targeting now supports both Steam3 auth IDs in addition to Steam2 IDs.
- Added default timeout for MySQL connections to avoid hangs. (PR 248).
- SDKTools' gamerules gamedata is now far less likely to break on updates (PR 220).
- Fixed crash with sm_dump_admcache on Windows (PR 163).
- Fixed SDKHooks causing crash on player join/leave or plugin load/unload if gamedata missing (PR 236).
- Changed default sm_trigger_show ConVar value to 0 / disabled.
Developer Changes:
- Added new SourcePawn Transitional Syntax!
--- New methodmap-based APIs have been added for many existing functions and handle types.
--- New work-in-progress API doc page.
- Added Blocked hook type to SDKHooks (PR 119) (VoiDeD).
- Added OnTakeDamage_Alive hook type to SDKHooks (PR 149).
- Many more File natives now support Valve FS (PR 120, PR 169, PR 178).
- Added SetFilePermissions native (PR 43) (hlstriker).
- Added API for iterating StringMaps (formerly "tries").
- Added natives for accessing command line parameters (PR 164) (VoiDeD).
- Exposed engine Message_DetermineMulticastRecipients as GetClientsInRange native. (PR 234).
- CloseHandle (or delete) on INVALID_HANDLE is now a no-op, instead of an error (PR 74).
- GetClientAuthString is now deprecated. Use GetClientAuthId instead.
- Added OnCoreMapEnd to extension interface (PR 127).
- Fixed IThreader threads leaking if they're not joined. (bug 3460, PR 241).
- TFHoliday updates no longer require a plugin recompile (PR 217).
- Fixed FindFlagChar returning false when passing AdminFlag_Custom6 (bug 6248, PR 203).
- Added support for (entity) CLASSPTR and EDICT Prop_Data fields with GetEntPropEnt and SetEntPropEnt (PR 83).
- Doubled maximum handle count per plugin to 32,768 (PR 215), (Thordin).
- Added support for custom default values with GetEvent* natives, rather than using ""/0 for unset fields (PR 157) (VoiDeD).
- Removed old profiler, and added new, pluggable profiler (with hooks to VProf) (PR 54).
- Added command to dump profiler output (PR 128) (VoiDeD).
- Fixed ICommandLine and related features being reported as unavailable on Dark Messiah.
- Fixed OnPlayerRunCommand forward in SDKTools being unavailable on Dark Messiah.
- SourceMod now uses some C++11 and has newer compiler requirements.
- Added --disable-auto-versioning option to ambuild configure script.
----------------------------------------------------------
SourceMod 1.6.3 [2014-11-25]
URL: http://wiki.alliedmods.net/SourceMod_1.6.3_Release_Notes
User Changes:
- Updated game support for TF2, CS:GO, No More Room in Hell, Insurgency, PVK2 and Fistful of Frags.
- Made changes to make TF2, CSS, DoDS, HL2DM, and SDK 2013 mods less likely to break on game update (PR 174, PR 192).
- Added support for longer key names in languages.cfg (to fix Portuguese) (bug 6282, PR 208).
Developer Changes:
- Updated TF2 player condition and holiday enums (Ross "Powerlord" Bemrose) (PR 183, PR 181).
- Add support for TF2 player conditions >= 96 for condition functions/forwards (PR 205).
----------------------------------------------------------
SourceMod 1.6.2 [2014-09-20]
URL: http://wiki.alliedmods.net/SourceMod_1.6.2_Release_Notes
User Changes:
- Updated game support for TF2, CS:GO, No More Room in Hell and Fistful of Frags.
- Added compatibility shim to force Steam player auth strings to be in "Steam2" rendered format (PR 136).
- Fixed possible performance regression in DBI handling.
Developer Changes:
- Added new GetClientAuthId native to retrieve player auth strings in desired format (PR 159).
- Updated TF2 weapon and player condition enums (FlaminSarge).
----------------------------------------------------------
SourceMod 1.6.1 [2014-08-17]
URL: http://wiki.alliedmods.net/SourceMod_1.6.1_Release_Notes
User Changes:
- Updated game support for CS:GO and Fistful of Frags.
- Added support for Romanian language.
- Re-added languages.cfg, missing from 1.6.0, causing all clients to use server language.
- Fixed a regression in version 1.6.0 that caused certain SDKHooks usage patterns to cause a server crash (PR 107).
- Improved error reporting in basebans plugin when banreasons.txt is missing (PR 115).
- Fixed incorrect logged gravity value for sm_gravity command (Ryan "VoiDeD" Stecker) (PR 116).
- Fixed a regression in version 1.6.0 causing SDKHook_ReloadPost hooks to not fire in plugins (Peace-Maker) (PR 96).
- Added workaround for game bug in TF2_RemoveWeaponSlot to avoid wearable entities left on map (Ryan "VoiDeD" Stecker) (bug 6206, PR 121).
- Removed DisableJIT option from core.cfg. (It was never meant for normal use.)
Developer Changes:
- Added new TF2_RemoveWearable native (Ryan "VoiDeD" Stecker, WildCard65) (PR 114).
- Added new functions for interacting with and playing scripted game sounds (Ross "Powerlord" Bemrose) (bug 5942, PR 65).
- Added new StringToKeyValues natives (Ryan "VoiDeD" Stecker) (PR 74).
----------------------------------------------------------
SourceMod 1.6.0 [2014-07-03]
URL: http://wiki.alliedmods.net/SourceMod_1.6.0_Release_Notes
User Changes:
- Added support for Dota 2 (bug 5656, bug 6068).
- Added support for Source SDK 2013 mods (bug 5917).
- Added support for Insurgency (bug 5951).
- Added support for Contagion (bug 6007).
- Added support for Blade Symphony (bug 5949).
- Updated support for some mods that moved to SDK 2013 - No More Room In Hell, Fistful of Frags, Empires, Synergy.
- Updated gamedata and other support for TF2, DoD:S, HL2:DM, CS:S, CS:GO, Left 4 Dead, and Nuclear Dawn.
- Added support for customizing ban reasons in basebans.sp (bug 5762) (Matthias "House" Kollek).
- Added support for searching all gameinfo search paths when seeking mapcycle file (bug 5839).
- Added sm_reload_translations command (bug 5750).
- Added support for single-file gamedata custom overrides (bug 5386) (Ondrej "RavuAlHemio" Hošek).
- Re-enabled SteamAuthstringValidation config option by default (bug 5791, PR 20).
- Fixed plugins not reaching ext dep lists, making dependent plugin not unload on ext unload (bug 5851) (Peace-Maker).
- Added printing of SendProp flags to netprop dumps (bug 6082).
- Removed support for obsolete plugin_settings.cfg (bug 5605).
- Fixed topmenu sorting not getting refreshed after reloading sorting config (bug 6032) (Peace-Maker).
- Fixed error log filename date sometimes being incorrect (bug 5761) (Matheus "M28" Valadares).
- Dump handle information when a plugin is forcefully unloaded. (bug 5666).
- Fixed sm_cancelvote not resetting rtv state. (bug 5808) (Peace-Maker).
- Fixed Mapchooser dying on single map rotation servers (bug 5179).
- Fixed various problems with unloading ClientPrefs and SourceMod (bug 5874).
- Fixed "sm version" command reporting incorrect compile time in many cases (bug 6078) (SystematicMania).
- Clear default database driver reference if backing extension is unloaded (bug 5934) (Peace-Maker).
- Moved funcommands material and sound definitions to gamedata for easier cross-game support (bug 6085).
- Implement a watchdog timer for scripts that take too long to execute (bug 5837).
- Use Linux game data for offsets and signatures/symbols on OS X if Mac-specific data is not available (bug 6056).
Developer Changes:
- Added an API for off-thread SQL transactions. (bug 3775, PR 26).
- Added string literal concatenation using ellipses "..." (bug 4261, PR 5) (Peace-Maker).
- Added support for nested datatables. (bug 5446).
- Added PbRemoveRepeatedFieldValue native (bug 6066).
- Added support for getting/setting protobuf enum values with PbGetInt, PbSetInt, and PbAddInt natives.
- Removed deprecated PbReadRepeated natives that existed briefly in 1.5.0-dev prerelease versions.
- Added RequestFrame native for one-off next-frame actions (bug 5965).
- Added CS_DMG_HEADSHOT define for CS:S and CS:GO (PR 7) (Bara20).
- Added CS_SLOT_KNIFE define for CS:S and CS:GO (bug 6131).
- Updated TF_WEAPON enum (PR 37) (FlaminSarge).
- Added TFHoliday_AprilFools to TFHoliday enum (bug 6092) (Ross "Powerlord" Bemrose).
- Added new TF2_IsHolidayActive native to TF2 Ext (bug 6095) (Ross "Powerlord" Bemrose).
- Switch TF2 extension to hook CTFGameRules::IsHolidayActive for holiday forward (bug 6137, PR 42).
- Added GetPlayerJingleFile native. (bug 5690) (FlaminSarge).
- Added PrepSDKCall_SetAddress and Address support to PrepSDKCall_SetFromConf (bug 5261).
- Added ability to disable TopMenu Title Caching (bug 6034) (Peace-Maker).
- Added DisplayTopMenuCategory native (bug 6033) (Peace-Maker).
- Added support for Valve search paths to GetFileSize native (bug 5931).
- Fixed invalid entities sometimes passed to OnEntityCreated and OnEntityDestroyed (bug 6119).
- Fixed inconsistencies with OnClientDisconnected foward calls (bug 5988, PR 16).
- Changed OnClientSayCommand to now pass non-silent chat triggers onward (bug 5926) (SystematicMania).
- Changed OnClientSayCommand forwards to strip quotes from chat (bug 5986) (SystematicMania).
- Fixed FindStringIndex native not returning INVALID_STRING_INDEX when string not found (bug 6144, PR 40).
- Fixed GroundEntChanged hooks not being called (bug 6050) (Peace-Maker).
- Fixed INetChannelInfo natives to no longer require clients to be ingame (bug 5775) (SystematicMania).
- Fixed replace param being respected inconsistently in SetTrieArray (bug 6113).
- Fixed crash creating a timer when there are no handles available. (bug 5317) (Peace-Maker).
- Fixed crash in ReconnectClient and InactivateClient natives when IServer ptr is null (bug 6122).
- Fixed StoreFromAddress and LoadFromAddress continuing with bad values, usually crashing after error (bug 6080).
- Fixed compiler bug with multidimensional array variable release (bug 6100).
- Changed float comparison operators to return false for NaN (bug 6107).
- Added support in spcomp for sp/inc files > 32767 lines (bug 5959).
- Fixed FindFlagChar returning '?' for Admin_Custom6.
- Fixed AllPluginsLoaded activities happening before SM is loaded.
- Deduplicated a number of files used by extensions by moving them to the public directory (bug 5341).
- Removed 'state' keyword from compiler (bug 4572) (Ryan "VoiDeD" Stecker).
- Removed LogMessageEx definition from logging.inc because it never existed (bug 5897) (Peace-Maker).
- Removed native override API (bug 5852).
- Call OnLibraryAdded for all available libraries (bug 5925, PR 4).
- Made IGameConfig::GetMemSig return value clearer (bug 6081).
- Switched StringToInt(Ex) from using strtol to strtoul internally (bug 5939).
- Added an spcomp option to print #included files (bug 5997).
- Recompiled Regex extension libpcre against v8.32, enabling utf8, unicode props, and jit (bug 5593).
- Optimized native calls if statically bound (bug 5842).
Internal Changes:
- Now using new AlliedModders Template Library (AMTL) in many places, https://github.com/alliedmodders/amtl
- Ported buildscripts to new AMBuild2 platform, https://github.com/alliedmodders/ambuild
- Moved much logic from core to logic binary to reduce file sizes and compile times (bug 5606, bug 5607, bug 5680, bug 5953, PR 12, PR 13).
- Refactored the JIT to use a newer, simpler macro assembler. (bug 5827).
- Added sourcepawn interpreter (bug 5902).
- Added support for compiling spcomp with emscripten.
- Rewrite IThreader implementation around new synchronization primitives (bug 5862).
- Rewrite DBManager to use the new synchronization primitives (bug 5870).
- Overhauled internals of ClientPrefs extension for improved stability (bug 5538).
- Changed ShareSys to store C++ native lists more optimally (bug 5852).
- Simplified NativeEntry state (bug 5852).
- Changed NativeEntry to use Refcounted to manage (bug 5852).
- Switched Translator and GameConfigs to hash tables (bug 5878).
- Switched numerous subsystems from KTrie to AMTL NameHashSet (bug 5884).
- Refactored Trie natives to use AMTL HashMap instead of KTrie (bug 5892).
- Removed usages of memtables from many subsystems (bug 5899).
- Changed EventHook name storage to use AMTL AString (bug 6188).
- Replaced SH List usages in game extensions with AMTL variants (PR 23).
- Replaced SourceHook list usages in clientprefs with AMTL (PR 25).
- Changed floating-point operations to use SSE when available (bug 5841).
- Moved tracker related opcodes entirely to C++.
- Statically align the stack at function boundaries (bug 5842).
- Removed InfoVars, reassigned DAT from EBP to ESI to preserve C++ stacktraces in JIT code (5844).
- Fixed dereferencing potential null pointer in CPlugin::GetProperty (bug 5725).
- Fixed memory corruption when parsing natives. (bug 5840).
- Fixed some memory errors (bug 5904).
- Fixed unaligned memory access in spcomp.
- Move versioning to a static library to improve trivial build speed (bug 5997).
- Added many missing handle security checks (bug 5595).
- Made GetEntityClassname get and cache m_iClassname offset from worldspawn for ents not having it in datadesc (bug 5654).
- Cache m_iEFlags offset for datamaps dump instead of getting for each ent (bug 5657).
- Fixed mismatched delete [] on thunks in JIT CompData dtor (bug 5639).
- Fixed various memory issues. (bug 5766).
- Added reference counting and use it for CGameConfig and IDatabase (bug 5876).
- Added atomic reference counting and port DBI (bug 5876).
- Replaced usages of deprecated Sourcehook Add/Remove macros (bug 5631).
- Fixed SDKHooks hook ent validation missing first datatable name (bug 5881).
- Fixed case where bots leave server without disconnect notice (hibernation) (PR 20).
- Changed FindConVar to utilize convar cache for improved performance (PR 27) (VoiDeD).
- Gave define value (of 1) to PLATFORM defs to match the same-name defs in some SDKs (PR 10).
- Wrapped ClientPrintf into IGamePlayer (bug 6021).
- Consolidated FileExists usage in logic bin (bug 5931).
- Removed hardcoded paths to tier0/vstdlib in ICommandLine lookup.
- Use updated IServerTools iface on TF2 for getting tempent list and FindEntityByClassname (PR 33).
- Added early exit in entity output detour if entity has no classname to prevent crash.
- Updated SDKTools entity output functions to use core's GetEntityClassname instead of own (PR 39).
- Consolidated SDKTools entity factory lookups.
- Changed SDKTools PlayerRunCmd to a global vtable hook to improve performance (bug 6051).
- Changed SDKHooks to use global vtable hooks to improve performance (bug 6070).
- Added client validation checks to EmitSound SoundsHooks (bug 5873).
- Added missing meta results to some pre-hooks in SDKHooks.
- Replaced magic numbers for sm_show_activity with named constants (PR 14).
----------------------------------------------------------
SourceMod 1.5.3 [2014-03-22]
URL: http://wiki.alliedmods.net/SourceMod_1.5.3_Release_Notes
User Changes:
- Updated support for CS:GO after multiple breaking game updates.
- Updated gamedata support for GoldenEye: Source (Peace-Maker).
- Fixed crash on SDKHooks extension load in Alien Swarm (bug 6059).
- Fixed memory leak from unmanaged forwards never being freed (bug 6025).
- Fixed possible crash when unloading the CStrike extension.
- Fixed crash in SDKHooks Reload post-hook (Peace-Maker).
- Fixed FakeClientCommandEx always leaking memory (bug 5678).
- Fixed extra entity networking occuring with SetEntProp natives on some games.
- Fixed being able to nominate same map multiple times (bug 5109).
- Fixed spurious FindEntityByClassname error being logged on some games and platforms.
- Fixed an Anti-Flood bypass exploit (bug 5394).
- Removed part of Addresses gamedata error handling which could cause false errors to be logged (bug 6044).
- Fixed mapchooser not resetting nominations count when clearing nominations list (bug 5359).
- Improved performances of client convar query handling (bug 6003).
Developer Changes:
- Added GiveAmmo native to SDKTools (bug 6039) (Peace-Maker).
- Added SQL_SetCharset native to (re)set charset even after reconnect (bug 5786) (Peace-Maker).
- Added support for entity references in SDKHooks natives (bug 6069).
- Added support for server passwords to DisplayAskConnectBox stock (bug 5984) (FlaminSarge).
- Renamed SortFunc2D parameters to match documentation (bug 6014) (Peace-Maker).
- Fixed param order in AddToTopMenu function doc (bug 6035) (Peace-Maker).
- Added |any| tag to WritePackCell and ReadPackCell native param/return values (bug 6001).
- Updated SDKHook_TakeDamage native for game updates.
- Added default infinite value for TF2_AddCondition duration.
- Added support for conditions >= 64 in TF2_OnConditionAdded/Removed (bug 5565, bug 5976) (FlaminSarge).
- Updated TFCond and TF customkill enum values (bug 6012) (FlaminSarge).
- Fixed regression causing incorrect return and inability to block in TF2_OnCalcIsAttackCritical forward.
- Fixed TE_* natives operating on incorrect data for some tempents (bug 6072).
- Fixed CS_AliasToWeaponID not returning a valid weaponID for cz75a.
- Fixed CS_GetWeaponPrice returning incorrect value for M4A1 in CS:GO (bug 6045).
- Increased max gamedata byte signature length.
- Ported SM build scripts to AMBuild2 (bug 5997).
----------------------------------------------------------
SourceMod 1.5.2 [2013-10-29]
URL: http://wiki.alliedmods.net/SourceMod_1.5.2_Release_Notes
User Changes:
- Updated gamedata support for TF2, CS:S, CS:GO, and HL2:DM.
- Fixed crash from regression in SDKTools SetClientListening hook refcounting (bug 5956) (KyleS).
- Fixed potential crash when having maps with format characters in name.
- Fixed some nextmap issues with long map names.
- SDKTools no longer requires gamedata for sm_dump_datamaps on TF2, CS:S, HL2:DM, and DoD:S (bug 5968).
Developer Changes:
- Updated TFCond and TF custom dmg enums.
- Updated TF2 critical hit detection logic in TF2_OnCalcIsAttackCritical to handle more cases, including when criticals are disabled (bug 5894).
- Fixed GetEngineVersion native returning a bad value when running on MM:S 1.9.x or earlier (bug 5697).
----------------------------------------------------------
SourceMod 1.5.1 [2013-09-10]
URL: http://wiki.alliedmods.net/SourceMod_1.5.1_Release_Notes
User Changes:
- Updated gamedata support for TF2.
- Added missing DispatchKeyValue gamedata for HL2 CTF (bug 5114) (peace-maker).
- Fixed translations not being loaded if identifier was not two or three characters (fixes Portuguese) (bug 5888).
- Fixed runoff voting occurring when receiving the exact number of required votes (bug 5890).
- Fixed reserve slot plugin hiding too many slots on Orangebox gamesif SourceTV and/or Replay are present (bug 5499).
- Fixed some crashes in TF2 and unexpected behavior in all games with SDKHook_TakeDamage due to uninitialized var.
- Fixed attempted triggers from gagged users displaying in chat (bug 5918).
- Fixed errors in Italian translation (Oktober).
- Added Norwegian translation (checkster).
Developer Changes:
- Added CS_UpdateClientModel native to CStrike extension for CS:S and CS:GO (bug 5905) (Drifter).
- Fixed setting weapon param in SDKHook_TakeDamage overwriting attacker instead of setting weapon (bug 5911) (KyleS)
----------------------------------------------------------
SourceMod 1.5.0 [2013-08-25]
URL: http://wiki.alliedmods.net/SourceMod_1.5.0_Release_Notes
User Changes:
- Added support for Counter-Strike: Global Offensive (bug 5299, bug 5579).
- Split CS:S, TF2, DoD:S, HL2:DM, and ND to separate binaries (bug 5370, bug 5813).
- Added support for runoff voting in mapchooser (bug 4218).
- Added option to require Steam validation before granting admin access (bug 4837) (VoiDeD).
- Added localization support for many more core and base plugin messages (bug 5120, bug 5146).
- Added the ability to override RegConsoleCommand-created commands (bug 5199).
- Added support for "fuzzy" (partial) map names in map-related natives and cmds for L4D and later (bug 5599).
- Updated Reserved Slots to use max humans as max count (bug 5444).
- Added support for custom maxitems on radio menus (bug 5371).
- Improved console config editing (bug 5470).
- Increased map name buffer sizes in mapchooser to better account for nested maps (bug 5609) (Peace-Maker).
- Fixed JIT conflicts with SELinux (bug 5581).
- Added logged error when PlayerRunCommand offset lookup fails (bug 5535) (GoD-Tony).
- Fixed double print when sending psay to self (bug 5649) (Peace-Maker).
- Fixed check against uninitialized string in extension loader (bug 5546) (KyleS).
- Fixed possible runtime errors in basetriggers for not-ingame clients (bug 5191) (Peace-Maker).
- Check all possible mapcycle paths on newer orangebox games (bug 5719).
- Fixed ReadMapList not seeing maps in all valve search paths (bug 5715) (VoiDeD).
- Fixed typo in too-many-params native error message (Peace-Maker).
- Fixed various issues in clientprefs (bug 5538) (KyleS).
- Removed debug printout from PerformGravity (bug 5679) (KyleS).
- Fixed broken translating in some plugins and natives (bug 5612) (KyleS).
- Fixed issues with COMMAND_FILTER_NO_BOTS and @bots multi-target.
- Fixed crash in SDKHooks when throwing bad ent type error on logical ent (KyleS).
Developer Changes:
- Added support for CS:GO to the CStrike extension (bug 5299) (Drifter).
- Added support for new protobuf usermessages used in newer games (bug 5579, bug 5588, bug 5590, bug 5633).
- Added latest SDKHooks version as first-party extension.
- Updated SQLite to version 3.7.15.1 (bug 5235).
- Added natives for changing team score and mvp stars on CSS/CSGO (bug 5295) (Drifter).
- Added global pre and post forwards for client chat (bug 5394) (KyleS).
- Added TF2_CanPlayerTeleport forward to the TF2 game extension (bug 5283) (VoiDeD).
- Added GetEntityAddress native (bug 5269) (ProdigySim).
- Added more parameters to PlayerRunCommand forward (bug 5346) (GoD-Tony).
- Added forwards to basecomm plugin (bug 5466) (Drifter).
- Added symbol lookup support to gamedata on Windows (bug 5511) (GoD-Tony).
- Exposed GetLanguageInfo in ITranslator interface (bug 5249) (VoiDeD).
- Increase maximum .sp line length to 4095 characters. (bug 5347) (theY4Kman).
- Improved netprop dump output (bug 5471).
- Added int64 typename to netprop dumps (bug 5655).
- Added GetMaxHumanPlayers native exposing IServerGameClients func (bug 5551).
- Added WeaponIDToAlias native to CStrike extension (bug 5460) (KyleS).
- Fixed OnLibraryAdded/Removed not being called in all plugins (bug 5431).
- Made thread worker processing limits configurable at runtime (bug 5326).
- Added support in TF2 ext for detection of player conds >= 64 (bug 5565).
- Updated button defines in entity_prop_stocks (bug 5564).
- Added GetPlayerResourceEntity to SDKTools to replace old, semi-broken TF2-only version (bug 5491).
- Exposed third parameter of TF2's AddCond in TF2_AddCondition (bug 5641) (FlaminSarge).
- Added GetSteamAccountID function to IPlayerHelpers and native for sp (bug 5548) (KyleS).
- Added ISDKHooks interface with entity listeners (bug 5602) (GoD-Tony).
- Added file upload support to webternet extension.
- Added more alternative names for TFClass_Heavy (bug 5338) (Afronanny).
- Throw error instead of crash when calling SetTeamScore between maps (bug 5718) (KyleS).
- Fixed clients not being marked as in kick queue in some cases (bug 5746) (SystematicMania).
- Made compile.sh set working dir to own dir (bug 5710) (KyleS).
- Added CS_IsValidWeaponID native and validity checks to other natives (bug 5566) (Drifter).
- Numerous code documentation fixups (bug 5720) (Tsunami).
- Fixed cmd listener callback return behavior to match func doc (bug 5882).
Internal Changes:
- Fixed handle misuse in clientprefs plugin (bug 5805) (KyleS).
- Removed call to getchar() in debug build of compiler (bug 5626) (KyleS).
- Fixed instability issues with cloned handles (bug 5245, bug 5240) (KyleS).
- Changed extension unload order to avoid exposing finalization window (bug 5556) (KyleS).
- Call OnPluginEnd before finalizer hooks have run (bug 4519).
- Fixed potential for reading out of library bounds in MemoryUtils::FindPattern.
- Fixed typo in TF2 ext asm.c causing accidental assignment instead of compare.
- Overhauled versioning information (bug 5453).
- Changed from RemoveEdict to using the Kill input for TF2_RemoveWeapon.
- Fixed accidental assignment in each of SDKTools and sp compiler (bug 5745) (KyleS).
- Fixed potential deadlock in HandleSystem::TryAndFreeSomeHandles (bug 5665) (KyleS).
----------------------------------------------------------
SourceMod 1.4.7 [2013-02-06]
URL: http://wiki.alliedmods.net/SourceMod_1.4.7_Release_Notes
User Changes:
- Updated support for latest Source 2009 engine changes (CS:S, DoD:S, TF2, HL2DM).
- Updated gamedata for Left 4 Dead 2, Nuclear Dawn, No More Room in Hell, Zombie Panic Source, CSPromod, GoldenEye Source, Synergy, The Hidden, and PVKII.
- Added system to block malware or illegal plugins (bug 5289).
- Fixed a potential crash when a bad entity index is passed to certain functions (bug 5539) (KyleS).
- Added an error message for when auto plugin configs fail to be created due to write error (bug 5465) (Drifter).
- Fixed an issue where a malformed plugin could cause crashes (bug 5478).
Developer Changes:
- Added new values to the TFCond TF2 conditions enum (bug 5537) (FlaminSarge).
- Updated TFHoliday TF2 holidays enum (bug 5526) (Powerlord).
- Fixed regression in SourceMod 1.3.0 causing GetEntPropEnt, GetEntDataEnt2, and GameRules_GetPropEnt to possibly return stale (incorrect) entity indexes in place of -1.
- Added support for < 32-bit unsigned sign extension to GameRules_GetProp lookup (already in GetEntProp since SM 1.4.0).
- Fixed < 32-bit unsigned sign extension in GetEntProp not being applied for array prop elements (bug 5591).
- Fixed value size auto-detection in GetEntProp and GameRules_GetProp for ep2v's new SPROP_VARINT sendprops.
- Fixed Sort_Random sort type not including first value in array sorting functions (bug 4292) (Peace-Maker).
- Fixed GameRules_SetPropVector writing data to unexpected addresses instead of to the gamerules proxy entity (bug 5592) (ProdigySim).
- Fixed VoteMenuToAll stock adding bots to list (bug 5253 (VoiDeD).
----------------------------------------------------------
SourceMod 1.4.6 [2012-09-04]
URL: http://wiki.alliedmods.net/SourceMod_1.4.6_Release_Notes
User Changes:
- Fixed extraneous errors resulting from a bug in 1.4.5.
----------------------------------------------------------
SourceMod 1.4.5 [2012-09-03]
URL: http://wiki.alliedmods.net/SourceMod_1.4.5_Release_Notes
User Changes:
- Updated support for latest Source 2009 engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
- Updated Nuclear Dawn, Dino D-Day, and Zombie Panic gamedata.
- Added compatibility for running on Metamod:Source 1.9.0.
- Fixed very minor memory leaks in CStrike extension (bug 5456) (KyleS).
- Fixed crash from plugins accessing netprops too early (bug 5297) (KyleS).
- Fixed crash from plugins trying to access nested datadesc members (bug 5446).
Developer Changes:
- Added new TF2 weapon and custom dmg defines.
- Added new TF2 TFHoliday value (bug 5436) (Powerlord).
- Fixed IClientListener::InterceptClientConnect not being able to properly block connections (bug 5461) (PimpinJuice).
- Fixed PrepSDKCall_SetSignature native not working with symbol names on L4D2 linux (bug 5440).
- Fixed resolution of GetProfilerTime native on non-Windows platforms.
-----------------------------
SourceMod 1.4.4 [2012-07-03]
URL: http://wiki.alliedmods.net/SourceMod_1.4.4_Release_Notes
User Changes:
- Updated support for latest Source 2009 engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
- Updated Nuclear Dawn gamedata.
- Fixed a crash that could occur when selecting an option on a clientprefs prefab menu (bug 5374).
Developer Changes:
- Added new TF2 weapon and custom dmg defines.
- Added new TF2 TFHoliday value (bug 5364) (Powerlord).
- Updated sample extension to properly fill ninvoke with INativeInvoker ptr (bug 5340) (Afronanny).
-----------------------------
SourceMod 1.4.3 [2012-06-09]
URL: http://wiki.alliedmods.net/SourceMod_1.4.3_Release_Notes
User Changes:
- Updated support for latest OrangeBox engine changes (CS:S, DoD:S, TF2, HL2DM, GMod).
- Made clientprefs attempt to reconnect to the database on map change (bug 4745).
- Log functions now respect sv_logecho (bug 5135).
- Fixed client console vote output (bug 5290, bug 5205) (FlaminSarge).
- Fixed error when reloading dependant plugins using aliased natives (bug 5302).
- Fixed intermittent crash when looking for an invalid signature (bug 5301).
- Fixed possible crash when reloading a plugin with an invalid binary (bug 5288).
- Exposed extensions list to clients (bug 5221) (VoiDeD).
- Fixed intermittent crashes in clientprefs (bug 4660).
- Fixed crash when passing an invalid entity reference to ReferenceToEntity (bug 5330).
- Fixed cstrike extension crash on shutdown (bug 5328).
- Lowered threading API think time to 20ms, making threaded MySQL queries complete faster (bug 4733).
Developer Changes:
- Fixed client serials not being unique on Windows (bug 5285).
- Fixed broken SourceTV detection on L4D1 (bug 5216).
- Fixed Float negation operator (bug 5292).
- Updated TF2 condition defines (bug 5259) (FlaminSarge).
- Adding missing SetMenuNoVoteButton native declaration (bug 4522) (GoD-Tony).
- Fixed erroneous const-qualification of name param of GetAdminUsername (bug 5267).
- Added GetGameTickCount native (bug 5209) (GoD-Tony).
-----------------------------
SourceMod 1.4.2 [2011-04-13]
+16
View File
@@ -0,0 +1,16 @@
"banreasons"
{
"Abusive" "Abusive"
"Racism" "Racism"
"General cheating/exploits" "General cheating/exploits"
"Wallhack" "Wallhack"
"Aimbot" "Aimbot"
"Speedhacking" "Speedhacking"
"Mic spamming" "Mic spamming"
"Admin disrespect" "Admin disrespect"
"Camping" "Camping"
"Team killing" "Team killing"
"Unacceptable Spray" "Unacceptable Spray"
"Breaking Server Rules" "Breaking Server Rules"
"Other" "Other"
}
+2 -2
View File
@@ -105,8 +105,8 @@ sm_timeleft_interval 0
// 1 (Enabled)
// --
// Requires: basetriggers.smx
// Default: 1
sm_trigger_show 1
// Default: 0
sm_trigger_show 0
// Specifies whether or not to display vote progress to clients in the
// "hint" box (near the bottom of the screen in most games).
+26
View File
@@ -107,4 +107,30 @@
* 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" "yes"
/**
* 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"
/**
* If a plugin takes too long to execute, hanging or freezing the game server in the process,
* SourceMod will attempt to terminate that plugin after the specified timeout length has
* passed. You can disable this feature by setting the value to "0".
*/
"SlowScriptTimeout" "8"
}
-36
View File
@@ -1,36 +0,0 @@
/**
* Each sub-section of "Plugins" should have a title which specifies a plugin filename.
* Filenames have a wildcard of *. Appending .smx is not required.
* If the filename has no explicit path, it will be patched to any sub-path in the plugins folder.
*
* Available properties for plugins are:
* "pause" - Whether or not the plugin should load paused - "yes" or "no" (default)
* "lifetime" - Lifetime of the plugin. Options:
* "mapsync" - Plugins should be reloaded on mapchange if changed (default)
* "global" - Plugin will never be unloaded or updated
* "blockload" - Plugin will always be blocked from loading. Implicit (automatic) loads
* produce no error, but explicit (manual) loads will show an error message.
* (Options are one of "yes" or "no")
*
* You can also have an "Options" section declaring options to pass onto the JIT:
* "profile" - Bit flags for profiling level. Add flags together to reach a value.
* WARNING: Profiler is _ALPHA_ software! Use it at your own risk for
* development cycles only (not production setups).
* See the wiki article "SourceMod Profiler" for more information.
* 1 - Profile natives
* 2 - Profile callbacks
* 4 - Profile internal plugin function calls
*/
"Plugins"
{
"*"
{
"pause" "no"
"lifetime" "mapsync"
"Options"
{
}
}
}
+29 -3
View File
@@ -1,10 +1,36 @@
# vim: set ts=2 sw=2 tw=99 noet:
import sys
import ambuild.runner as runner
try:
from ambuild2 import run
except:
try:
import ambuild
sys.stderr.write('It looks like you have AMBuild 1 installed, but this project uses AMBuild 2.\n')
sys.stderr.write('Upgrade to the latest version of AMBuild to continue.\n')
except:
sys.stderr.write('AMBuild must be installed to build this project.\n')
sys.stderr.write('http://www.alliedmods.net/ambuild\n')
sys.exit(1)
run = runner.Runner()
run = run.PrepareBuild(sourcePath=sys.path[0])
run.default_build_folder = 'obj-' + run.target_platform
run.options.add_option('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None,
help='Root search folder for HL2SDKs')
run.options.add_option('--mysql-path', type=str, dest='mysql_path', default=None,
help='Path to MySQL 5')
run.options.add_option('--mms-path', type=str, dest='mms_path', default=None,
help='Path to Metamod:Source')
run.options.add_option('--enable-debug', action='store_const', const='1', dest='debug',
help='Enable debugging symbols')
run.options.add_option('--enable-optimize', action='store_const', const='1', dest='opt',
help='Enable optimization')
run.Configure(sys.path[0])
run.options.add_option('--no-mysql', action='store_false', default=True, dest='hasMySql',
help='Disable building MySQL extension')
run.options.add_option('-s', '--sdks', default='all', dest='sdks',
help='Build against specified SDKs; valid args are "all", "present", or '
'comma-delimited list of engine names (default: %default)')
run.options.add_option('--breakpad-dump', action='store_true', dest='breakpad_dump',
default=False, help='Dump and upload breakpad symbols')
run.options.add_option('--disable-auto-versioning', action='store_true', dest='disable_auto_versioning',
default=False, help='Disable the auto versioning script')
run.Configure()
+112 -72
View File
@@ -1,78 +1,118 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
for i in SM.sdkInfo:
sdk = SM.sdkInfo[i]
if AMBuild.target['platform'] not in sdk['platform']:
continue
project = SM.HL2Project(builder, 'sourcemod')
project.sources += [
'MenuStyle_Valve.cpp',
'logic_bridge.cpp',
'smn_entities.cpp',
'sm_stringutil.cpp',
'MenuVoting.cpp',
'smn_events.cpp',
'CDataPack.cpp',
'frame_hooks.cpp',
'smn_nextmap.cpp',
'sourcemm_api.cpp',
'ChatTriggers.cpp',
'smn_player.cpp',
'sourcemod.cpp',
'concmd_cleaner.cpp',
'HalfLife2.cpp',
'NextMap.cpp',
'ConCmdManager.cpp',
'ConVarManager.cpp',
'LibrarySys.cpp',
'PlayerManager.cpp',
'TimerSys.cpp',
'CoreConfig.cpp',
'Logger.cpp',
'smn_halflife.cpp',
'smn_console.cpp',
'UserMessages.cpp',
'MenuManager.cpp',
'smn_hudtext.cpp',
'smn_usermsgs.cpp',
'MenuStyle_Base.cpp',
'smn_keyvalues.cpp',
'smn_vector.cpp',
'EventManager.cpp',
'MenuStyle_Radio.cpp',
'sm_autonatives.cpp',
'sm_srvcmds.cpp',
'ConsoleDetours.cpp',
'vprof_tool.cpp',
'smn_commandline.cpp',
]
name = 'sourcemod.' + sdk['ext']
for sdk_name in SM.sdks:
sdk = SM.sdks[sdk_name]
binary_name = 'sourcemod.' + sdk.ext
compiler = SM.DefaultHL2Compiler('core', i)
binary = SM.HL2Config(project, binary_name, sdk)
compiler = binary.compiler
extension = AMBuild.AddJob(name)
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
SM.PreSetupHL2Job(extension, binary, i)
files = [
'AdminCache.cpp',
'ExtensionSys.cpp',
'MenuStyle_Valve.cpp',
'logic_bridge.cpp',
'smn_entities.cpp',
'sm_stringutil.cpp',
'ADTFactory.cpp',
'ForwardSys.cpp',
'MenuVoting.cpp',
'smn_events.cpp',
'smn_menus.cpp',
'sm_trie.cpp',
'CDataPack.cpp',
'frame_hooks.cpp',
'NativeInvoker.cpp',
'smn_fakenatives.cpp',
'smn_nextmap.cpp',
'sourcemm_api.cpp',
'ChatTriggers.cpp',
'NativeOwner.cpp',
'smn_filesystem.cpp',
'smn_player.cpp',
'sourcemod.cpp',
'concmd_cleaner.cpp',
'HalfLife2.cpp',
'NextMap.cpp',
'ConCmdManager.cpp',
'HandleSys.cpp',
'ConVarManager.cpp',
'LibrarySys.cpp',
'PlayerManager.cpp',
'TimerSys.cpp',
'CoreConfig.cpp',
'Logger.cpp',
'PluginInfoDatabase.cpp',
'smn_bitbuffer.cpp',
'smn_halflife.cpp',
'PluginSys.cpp',
'smn_console.cpp',
'UserMessages.cpp',
'Database.cpp',
'MenuManager.cpp',
'smn_core.cpp',
'smn_hudtext.cpp',
'smn_usermsgs.cpp',
'DebugReporter.cpp',
'MenuStyle_Base.cpp',
'ShareSys.cpp',
'smn_database.cpp',
'smn_keyvalues.cpp',
'smn_vector.cpp',
'EventManager.cpp',
'MenuStyle_Radio.cpp',
'sm_autonatives.cpp',
'sm_srvcmds.cpp',
'ConsoleDetours.cpp'
]
binary.AddSourceFiles('core', files)
SM.PostSetupHL2Job(extension, binary, i)
SM.AutoVersion('core', binary)
binary.SendToJob()
if sdk.name == 'csgo':
compiler.cxxincludes += [
os.path.join(sdk.path, 'common', 'protobuf-2.5.0', 'src'),
os.path.join(sdk.path, 'public', 'engine', 'protobuf'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf')
]
elif sdk.name == 'dota':
compiler.cxxincludes += [
os.path.join(sdk.path, 'common', 'protobuf-2.6.1', 'src'),
os.path.join(sdk.path, 'public', 'engine', 'protobuf'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'protobuf'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf')
]
if builder.target_platform == 'linux':
compiler.postlink += ['-lpthread', '-lrt']
if sdk.name == 'csgo' or sdk.name == 'dota':
if builder.target_platform == 'linux':
lib_path = os.path.join(sdk.path, 'lib', 'linux32', 'release', 'libprotobuf.a')
elif builder.target_platform == 'mac':
lib_path = os.path.join(sdk.path, 'lib', 'osx32', 'release', 'libprotobuf.a')
elif builder.target_platform == 'windows':
msvc_ver = compiler.version
vs_year = ''
if msvc_ver == 1800:
vs_year = '2013'
elif msvc_ver == 1700:
vs_year = '2012'
elif msvc_ver == 1600:
vs_year = '2010'
else:
raise Exception('Cannot find libprotobuf for MSVC version "' + compiler.version + '"')
if 'DEBUG' in compiler.defines:
lib_path = os.path.join(sdk.path, 'lib', 'win32', 'debug', 'vs' + vs_year, 'libprotobuf.lib')
else:
lib_path = os.path.join(sdk.path, 'lib', 'win32', 'release', 'vs' + vs_year, 'libprotobuf.lib')
compiler.linkflags.insert(0, binary.Dep(lib_path))
if sdk.name in ['csgo', 'dota']:
binary.sources += ['smn_protobuf.cpp']
else:
binary.sources += ['smn_bitbuffer.cpp']
if sdk.name == 'csgo':
binary.sources += [
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessages.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessage_helpers.cpp'),
]
elif sdk.name == 'dota':
binary.sources += [
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'networkbasetypes.pb.cc'),
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'network_connection.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'protobuf', 'ai_activity.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'protobuf', 'usermessages.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf', 'dota_commonmessages.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf', 'dota_usermessages.pb.cc'),
os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf', 'dota_usermessage_helpers.cpp'),
]
SM.binaries += builder.Add(project)
+84 -10
View File
@@ -76,9 +76,12 @@ void CDataPack::ResetSize()
size_t CDataPack::CreateMemory(size_t size, void **addr)
{
CheckSize(sizeof(size_t) + size);
CheckSize(sizeof(char) + sizeof(size_t) + size);
size_t pos = m_curptr - m_pBase;
*(char *)m_curptr = Raw;
m_curptr += sizeof(char);
*(size_t *)m_curptr = size;
m_curptr += sizeof(size_t);
@@ -88,14 +91,17 @@ size_t CDataPack::CreateMemory(size_t size, void **addr)
}
m_curptr += size;
m_size += sizeof(size_t) + size;
m_size += sizeof(char) + sizeof(size_t) + size;
return pos;
}
void CDataPack::PackCell(cell_t cell)
{
CheckSize(sizeof(size_t) + sizeof(cell_t));
CheckSize(sizeof(char) + sizeof(size_t) + sizeof(cell_t));
*(char *)m_curptr = Cell;
m_curptr += sizeof(char);
*(size_t *)m_curptr = sizeof(cell_t);
m_curptr += sizeof(size_t);
@@ -103,12 +109,15 @@ void CDataPack::PackCell(cell_t cell)
*(cell_t *)m_curptr = cell;
m_curptr += sizeof(cell_t);
m_size += sizeof(size_t) + sizeof(cell_t);
m_size += sizeof(char) + sizeof(size_t) + sizeof(cell_t);
}
void CDataPack::PackFloat(float val)
{
CheckSize(sizeof(size_t) + sizeof(float));
CheckSize(sizeof(char) + sizeof(size_t) + sizeof(float));
*(char *)m_curptr = Float;
m_curptr += sizeof(char);
*(size_t *)m_curptr = sizeof(float);
m_curptr += sizeof(size_t);
@@ -116,15 +125,18 @@ void CDataPack::PackFloat(float val)
*(float *)m_curptr = val;
m_curptr += sizeof(float);
m_size += sizeof(size_t) + sizeof(float);
m_size += sizeof(char) + sizeof(size_t) + sizeof(float);
}
void CDataPack::PackString(const char *string)
{
size_t len = strlen(string);
size_t maxsize = sizeof(size_t) + len + 1;
size_t maxsize = sizeof(char) + sizeof(size_t) + len + 1;
CheckSize(maxsize);
*(char *)m_curptr = String;
m_curptr += sizeof(char);
// Pack the string length first for buffer overrun checking.
*(size_t *)m_curptr = len;
m_curptr += sizeof(size_t);
@@ -160,10 +172,16 @@ bool CDataPack::SetPosition(size_t pos) const
cell_t CDataPack::ReadCell() const
{
if (!IsReadable(sizeof(size_t) + sizeof(cell_t)))
if (!IsReadable(sizeof(char) + sizeof(size_t) + sizeof(cell_t)))
{
return 0;
}
if (*reinterpret_cast<char *>(m_curptr) != Cell)
{
return 0;
}
m_curptr += sizeof(char);
if (*reinterpret_cast<size_t *>(m_curptr) != sizeof(cell_t))
{
return 0;
@@ -178,10 +196,16 @@ cell_t CDataPack::ReadCell() const
float CDataPack::ReadFloat() const
{
if (!IsReadable(sizeof(size_t) + sizeof(float)))
if (!IsReadable(sizeof(char) + sizeof(size_t) + sizeof(float)))
{
return 0;
}
if (*reinterpret_cast<char *>(m_curptr) != Float)
{
return 0;
}
m_curptr += sizeof(char);
if (*reinterpret_cast<size_t *>(m_curptr) != sizeof(float))
{
return 0;
@@ -201,10 +225,15 @@ bool CDataPack::IsReadable(size_t bytes) const
const char *CDataPack::ReadString(size_t *len) const
{
if (!IsReadable(sizeof(size_t)))
if (!IsReadable(sizeof(char) + sizeof(size_t)))
{
return NULL;
}
if (*reinterpret_cast<char *>(m_curptr) != String)
{
return NULL;
}
m_curptr += sizeof(char);
size_t real_len = *(size_t *)m_curptr;
@@ -237,6 +266,11 @@ void *CDataPack::ReadMemory(size_t *size) const
{
return NULL;
}
if (*reinterpret_cast<char *>(m_curptr) != Raw)
{
return NULL;
}
m_curptr += sizeof(char);
size_t bytecount = *(size_t *)m_curptr;
m_curptr += sizeof(size_t);
@@ -257,3 +291,43 @@ void *CDataPack::ReadMemory(size_t *size) const
return ptr;
}
void CDataPack::PackFunction(cell_t function)
{
CheckSize(sizeof(char) + sizeof(size_t) + sizeof(cell_t));
*(char *)m_curptr = Function;
m_curptr += sizeof(char);
*(size_t *)m_curptr = sizeof(cell_t);
m_curptr += sizeof(size_t);
*(cell_t *)m_curptr = function;
m_curptr += sizeof(cell_t);
m_size += sizeof(char) + sizeof(size_t) + sizeof(cell_t);
}
cell_t CDataPack::ReadFunction() const
{
if (!IsReadable(sizeof(char) + sizeof(size_t) + sizeof(cell_t)))
{
return 0;
}
if (*reinterpret_cast<char *>(m_curptr) != Function)
{
return 0;
}
m_curptr += sizeof(char);
if (*reinterpret_cast<size_t *>(m_curptr) != sizeof(cell_t))
{
return 0;
}
m_curptr += sizeof(size_t);
cell_t val = *reinterpret_cast<cell_t *>(m_curptr);
m_curptr += sizeof(cell_t);
return val;
}
+10
View File
@@ -51,12 +51,14 @@ public: //IDataReader
const char *ReadString(size_t *len) const;
void *GetMemory() const;
void *ReadMemory(size_t *size) const;
cell_t ReadFunction() const;
public: //IDataPack
void ResetSize();
void PackCell(cell_t cell);
void PackFloat(float val);
void PackString(const char *string);
size_t CreateMemory(size_t size, void **addr);
void PackFunction(cell_t function);
public:
void Initialize();
private:
@@ -66,6 +68,14 @@ private:
mutable char *m_curptr;
size_t m_capacity;
size_t m_size;
enum DataPackType {
Raw,
Cell,
Float,
String,
Function
};
};
#endif //_INCLUDE_SOURCEMOD_CDATAPACK_H_
+20 -2
View File
@@ -44,7 +44,11 @@ public: //IRecipientFilter
bool IsReliable() const;
bool IsInitMessage() const;
int GetRecipientCount() const;
#if SOURCE_ENGINE == SE_DOTA
CEntityIndex GetRecipientIndex(int slot) const;
#else
int GetRecipientIndex(int slot) const;
#endif
public:
void Initialize(const cell_t *ptr, size_t count);
void SetToReliable(bool isreliable);
@@ -79,13 +83,27 @@ inline int CellRecipientFilter::GetRecipientCount() const
return m_Size;
}
#if SOURCE_ENGINE == SE_DOTA
inline CEntityIndex CellRecipientFilter::GetRecipientIndex(int slot) const
#else
inline int CellRecipientFilter::GetRecipientIndex(int slot) const
#endif
{
int ret;
if ((slot < 0) || (slot >= GetRecipientCount()))
{
return -1;
ret = -1;
}
return static_cast<int>(m_Players[slot]);
else
{
ret = static_cast<int>(m_Players[slot]);
}
#if SOURCE_ENGINE == SE_DOTA
return CEntityIndex(ret);
#else
return ret;
#endif
}
inline void CellRecipientFilter::SetToInit(bool isinitmsg)
+221 -104
View File
@@ -36,36 +36,38 @@
#include "PlayerManager.h"
#include "HalfLife2.h"
#include "logic_bridge.h"
#include "sourcemod.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
* can technically be compiled against any MM:S version after 1.4.2.
*/
#if SOURCE_ENGINE >= SE_ORANGEBOX
extern bool __SourceHook_FHRemoveConCommandDispatch(void *, bool, class fastdelegate::FastDelegate1<const CCommand &, void>);
extern int __SourceHook_FHAddConCommandDispatch(void *, ISourceHook::AddHookMode, bool, class fastdelegate::FastDelegate1<const CCommand &, void>);
#if SOURCE_ENGINE == SE_DOTA
SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
#elif SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
#elif SOURCE_ENGINE == SE_DARKMESSIAH
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
#else
extern bool __SourceHook_FHRemoveConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
#if SH_IMPL_VERSION >= 5
extern int __SourceHook_FHAddConCommandDispatch(void *, ISourceHook::AddHookMode, bool, class fastdelegate::FastDelegate0<void>);
#elif SH_IMPL_VERSION == 4
extern int __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
#elif SH_IMPL_VERSION == 3
extern bool __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
#endif //SH_IMPL_VERSION
#endif //SE_ORANGEBOX
# if SH_IMPL_VERSION >= 4
extern int __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
# else
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
# endif
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
#endif
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_ArgSBackup(NULL)
{
m_PubTrigger = sm_strdup("!");
m_PrivTrigger = sm_strdup("/");
m_PubTriggerSize = 1;
m_PrivTriggerSize = 1;
m_bIsChatTrigger = false;
m_bPluginIgnored = true;
#if SOURCE_ENGINE == SE_EPISODEONE
m_bIsINS = false;
#endif
}
ChatTriggers::~ChatTriggers()
@@ -74,6 +76,8 @@ ChatTriggers::~ChatTriggers()
m_PubTrigger = NULL;
delete [] m_PrivTrigger;
m_PrivTrigger = NULL;
delete [] m_ArgSBackup;
m_ArgSBackup = NULL;
}
ConfigResult ChatTriggers::OnSourceModConfigChanged(const char *key,
@@ -107,8 +111,10 @@ ConfigResult ChatTriggers::OnSourceModConfigChanged(const char *key,
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_pShouldFloodBlock = forwardsys->CreateForward("OnClientFloodCheck", ET_Event, 1, NULL, Param_Cell);
m_pDidFloodBlock = forwardsys->CreateForward("OnClientFloodResult", ET_Event, 2, NULL, Param_Cell, Param_Cell);
m_pOnClientSayCmd = forwardsys->CreateForward("OnClientSayCommand", ET_Event, 3, NULL, Param_Cell, Param_String, Param_String);
m_pOnClientSayCmd_Post = forwardsys->CreateForward("OnClientSayCommand_Post", ET_Ignore, 3, NULL, Param_Cell, Param_String, Param_String);
}
void ChatTriggers::OnSourceModAllInitialized_Post()
@@ -123,34 +129,76 @@ void ChatTriggers::OnSourceModGameInitialized()
if (m_pSayCmd)
{
SH_ADD_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayCmd, this, &ChatTriggers::OnSayCommand_Pre, false);
SH_ADD_HOOK_MEMFUNC(ConCommand, Dispatch, m_pSayCmd, this, &ChatTriggers::OnSayCommand_Post, true);
SH_ADD_HOOK(ConCommand, Dispatch, m_pSayCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
SH_ADD_HOOK(ConCommand, Dispatch, m_pSayCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
}
if (m_pSayTeamCmd)
{
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);
SH_ADD_HOOK(ConCommand, Dispatch, m_pSayTeamCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
SH_ADD_HOOK(ConCommand, Dispatch, m_pSayTeamCmd, SH_MEMBER(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);
SH_REMOVE_HOOK(ConCommand, Dispatch, m_pSayCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Post), true);
SH_REMOVE_HOOK(ConCommand, Dispatch, m_pSayCmd, SH_MEMBER(this, &ChatTriggers::OnSayCommand_Pre), false);
}
g_Forwards.ReleaseForward(m_pShouldFloodBlock);
g_Forwards.ReleaseForward(m_pDidFloodBlock);
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
forwardsys->ReleaseForward(m_pShouldFloodBlock);
forwardsys->ReleaseForward(m_pDidFloodBlock);
forwardsys->ReleaseForward(m_pOnClientSayCmd);
forwardsys->ReleaseForward(m_pOnClientSayCmd_Post);
}
#if SOURCE_ENGINE >= SE_ORANGEBOX
#if SOURCE_ENGINE == SE_DOTA
void ChatTriggers::OnSayCommand_Pre(const CCommandContext &context, const CCommand &command)
{
#elif SOURCE_ENGINE >= SE_ORANGEBOX
void ChatTriggers::OnSayCommand_Pre(const CCommand &command)
{
#else
@@ -158,32 +206,99 @@ 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 = true;
const char *args = command.ArgS();
if (!args)
{
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);
size_t len = strlen(args);
#if SOURCE_ENGINE == SE_EPISODEONE
if (m_bIsINS)
{
if (strcmp(m_Arg0Backup, "say2") == 0 && len >= 4)
{
args += 4;
len -= 4;
}
if (len == 0)
{
RETURN_META(MRES_SUPERCEDE);
}
}
#endif
/* The first pair of quotes are stripped from client say commands, but not console ones.
* We do not want the forwards to differ from what is displayed.
* So only strip the first pair of quotes from client say commands. */
bool is_quoted = false;
if (
#if SOURCE_ENGINE == SE_EPISODEONE
!m_bIsINS &&
#endif
client != 0 && args[0] == '"' && args[len-1] == '"')
{
/* The server normally won't display empty say commands, but in this case it does.
* I don't think it's desired so let's block it. */
if (len <= 2)
{
RETURN_META(MRES_SUPERCEDE);
}
args++;
len--;
is_quoted = true;
}
/* Some? engines strip the last quote when printing the string to chat.
* This results in having a double-quoted message passed to the OnClientSayCommand ("message") forward,
* but losing the last quote in the OnClientSayCommand_Post ("message) forward.
* To compensate this, we copy the args into our own buffer where the engine won't mess with
* and strip the quotes. */
delete [] m_ArgSBackup;
m_ArgSBackup = new char[CCommand::MaxCommandLength()+1];
memcpy(m_ArgSBackup, args, len+1);
/* Strip the quotes from the argument */
if (is_quoted)
{
if (m_ArgSBackup[len-1] == '"')
{
m_ArgSBackup[--len] = '\0';
}
}
/* The server console cannot do this */
if (client == 0)
{
if (CallOnClientSayCommand(client) >= Pl_Handled)
{
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))
{
@@ -203,62 +318,41 @@ void ChatTriggers::OnSayCommand_Pre()
RETURN_META(MRES_SUPERCEDE);
}
/* Handle quoted string sets */
bool is_quoted = false;
if (args[0] == '"')
{
args++;
is_quoted = true;
}
bool is_trigger = false;
bool is_silent = false;
/* Check for either trigger */
if (m_PubTriggerSize && strncmp(args, m_PubTrigger, m_PubTriggerSize) == 0)
if (m_PubTriggerSize && strncmp(m_ArgSBackup, m_PubTrigger, m_PubTriggerSize) == 0)
{
is_trigger = true;
args = &args[m_PubTriggerSize];
args = &m_ArgSBackup[m_PubTriggerSize];
}
else if (m_PrivTriggerSize && strncmp(args, m_PrivTrigger, m_PrivTriggerSize) == 0)
else if (m_PrivTriggerSize && strncmp(m_ArgSBackup, m_PrivTrigger, m_PrivTriggerSize) == 0)
{
is_trigger = true;
is_silent = true;
args = &args[m_PrivTriggerSize];
}
if (!is_trigger)
{
RETURN_META(MRES_IGNORED);
args = &m_ArgSBackup[m_PrivTriggerSize];
}
/**
* Test if this is actually a command!
*/
if (!PreProcessTrigger(PEntityOfEntIndex(client), args, is_quoted))
if (is_trigger && PreProcessTrigger(PEntityOfEntIndex(client), args))
{
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;
if (is_silent && (m_bIsChatTrigger || (g_bSupressSilentFails && pPlayer->GetAdminId() != INVALID_ADMIN_ID)))
{
RETURN_META(MRES_SUPERCEDE);
}
/**
* We'll execute it in post.
*/
m_bWillProcessInPost = true;
m_bTriggerWasSilent = is_silent;
/* If we're silent, block */
if (is_silent)
if (CallOnClientSayCommand(client) >= Pl_Handled)
{
RETURN_META(MRES_SUPERCEDE);
}
@@ -267,28 +361,44 @@ void ChatTriggers::OnSayCommand_Pre()
RETURN_META(MRES_IGNORED);
}
#if SOURCE_ENGINE >= SE_ORANGEBOX
#if SOURCE_ENGINE == SE_DOTA
void ChatTriggers::OnSayCommand_Post(const CCommandContext &context, const CCommand &command)
#elif SOURCE_ENGINE >= SE_ORANGEBOX
void ChatTriggers::OnSayCommand_Post(const CCommand &command)
#else
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);
#if SOURCE_ENGINE == SE_DOTA
engine->ClientCommand(client, "%s", m_ToExecute);
#else
serverpluginhelpers->ClientCommand(PEntityOfEntIndex(client), m_ToExecute);
#endif
SetReplyTo(old);
}
if (!m_bPluginIgnored && 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)
bool ChatTriggers::PreProcessTrigger(edict_t *pEdict, const char *args)
{
/* Extract a command. This is kind of sloppy. */
char cmd_buf[64];
@@ -330,12 +440,12 @@ bool ChatTriggers::PreProcessTrigger(edict_t *pEdict, const char *args, bool is_
{
return false;
}
prepended = true;
}
/* See if we need to do extra string manipulation */
if (is_quoted || prepended)
if (prepended)
{
size_t len;
@@ -346,15 +456,6 @@ bool ChatTriggers::PreProcessTrigger(edict_t *pEdict, const char *args, bool is_
} else {
len = strncopy(m_ToExecute, args, sizeof(m_ToExecute));
}
/* Check if we need to strip a quote */
if (is_quoted)
{
if (m_ToExecute[len-1] == '"')
{
m_ToExecute[--len] = '\0';
}
}
} else {
strncopy(m_ToExecute, args, sizeof(m_ToExecute));
}
@@ -362,6 +463,22 @@ 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_pOnClientSayCmd->GetFunctionCount() != 0)
{
m_pOnClientSayCmd->PushCell(client);
m_pOnClientSayCmd->PushString(m_Arg0Backup);
m_pOnClientSayCmd->PushString(m_ArgSBackup);
m_pOnClientSayCmd->Execute(&res);
}
m_bPluginIgnored = (res >= Pl_Stop);
return res;
}
unsigned int ChatTriggers::SetReplyTo(unsigned int reply)
{
unsigned int old = m_ReplyTo;
+19 -3
View File
@@ -54,7 +54,10 @@ public: //SMGlobalClass
char *error,
size_t maxlength);
private: //ConCommand
#if SOURCE_ENGINE >= SE_ORANGEBOX
#if SOURCE_ENGINE == SE_DOTA
void OnSayCommand_Pre(const CCommandContext &, const CCommand &command);
void OnSayCommand_Post(const CCommandContext &, const CCommand &command);
#elif SOURCE_ENGINE >= SE_ORANGEBOX
void OnSayCommand_Pre(const CCommand &command);
void OnSayCommand_Post(const CCommand &command);
#else
@@ -67,23 +70,36 @@ public:
bool IsChatTrigger();
bool WasFloodedMessage();
private:
bool PreProcessTrigger(edict_t *pEdict, const char *args, bool is_quoted);
bool PreProcessTrigger(edict_t *pEdict, const char *args);
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;
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;
+191 -523
View File
File diff suppressed because it is too large Load Diff
+46 -33
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.
@@ -34,62 +34,77 @@
#include "sm_globals.h"
#include "sourcemm_api.h"
#include "ForwardSys.h"
#include "sm_trie.h"
#include "sm_memtable.h"
#include <IForwardSys.h>
#include <sh_list.h>
#include <sh_string.h>
#include <IRootConsoleMenu.h>
#include <IAdminSystem.h>
#include "concmd_cleaner.h"
#include <sm_stringhashmap.h>
#include <am-utility.h>
#include <am-inlinelist.h>
#include <am-linkedlist.h>
#include <am-refcounting.h>
using namespace SourceHook;
enum CmdType
struct CmdHook;
struct ConCmdInfo;
struct CommandGroup : public ke::Refcounted<CommandGroup>
{
Cmd_Server,
Cmd_Console,
Cmd_Admin,
ke::LinkedList<CmdHook *> hooks;
};
struct AdminCmdInfo
{
AdminCmdInfo()
AdminCmdInfo(const ke::Ref<CommandGroup> &group, FlagBits flags)
: group(group),
flags(flags),
eflags(0)
{
cmdGrpId = -1;
flags = 0;
eflags = 0;
}
int cmdGrpId; /* index into cmdgroup string table */
ke::Ref<CommandGroup> group;
FlagBits flags; /* default flags */
FlagBits eflags; /* effective flags */
};
struct CmdHook
struct CmdHook : public ke::InlineListNode<CmdHook>
{
CmdHook()
enum Type {
Server,
Client
};
CmdHook(Type type, ConCmdInfo *cmd, IPluginFunction *fun, const char *description)
: type(type),
info(cmd),
pf(fun),
helptext(description)
{
pf = NULL;
pAdmin = NULL;
}
IPluginFunction *pf; /* function hook */
String helptext; /* help text */
AdminCmdInfo *pAdmin; /* admin requirements, if any */
Type type;
ConCmdInfo *info;
IPluginFunction *pf; /* function hook */
ke::AString helptext; /* help text */
ke::AutoPtr<AdminCmdInfo> admin; /* admin requirements, if any */
};
typedef ke::InlineList<CmdHook> CmdHookList;
struct ConCmdInfo
{
ConCmdInfo()
{
sourceMod = false;
pCmd = NULL;
eflags = 0;
}
bool sourceMod; /**< Determines whether or not concmd was created by a SourceMod plugin */
ConCommand *pCmd; /**< Pointer to the command itself */
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 */
CmdHookList hooks; /**< Hook list */
FlagBits eflags; /**< Effective admin flags */
};
typedef List<ConCmdInfo *> ConCmdList;
@@ -100,7 +115,9 @@ class ConCmdManager :
public IPluginsListener,
public IConCommandTracker
{
#if SOURCE_ENGINE >= SE_ORANGEBOX
#if SOURCE_ENGINE == SE_DOTA
friend void CommandCallback(const CCommandContext &context, const CCommand &command);
#elif SOURCE_ENGINE >= SE_ORANGEBOX
friend void CommandCallback(const CCommand &command);
#else
friend void CommandCallback();
@@ -119,7 +136,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,
@@ -130,8 +146,6 @@ public:
void UpdateAdminCmdFlags(const char *cmd, OverrideType type, FlagBits bits, bool remove);
bool LookForSourceModCommand(const char *cmd);
bool LookForCommandAdminFlags(const char *cmd, FlagBits *pFlags);
bool CheckClientCommandAccess(int client, const char *cmd, FlagBits flags);
bool CheckAdminCommandAccess(AdminId adm, const char *cmd, FlagBits flags);
private:
void InternalDispatch(const CCommand &command);
ResultType RunAdminCommand(ConCmdInfo *pInfo, int client, int args);
@@ -139,8 +153,6 @@ private:
void SetCommandClient(int client);
void AddToCmdList(ConCmdInfo *info);
void RemoveConCmd(ConCmdInfo *info, const char *cmd, bool is_read_safe, bool untrack);
void RemoveConCmds(List<CmdHook *> &cmdlist);
void RemoveConCmds(List<CmdHook *> &cmdlist, IPluginContext *pContext);
bool CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmin);
// Case insensitive
@@ -158,11 +170,12 @@ public:
return m_CmdList;
}
private:
Trie *m_pCmds; /* command lookup */
Trie *m_pCmdGrps; /* command group lookup */
typedef StringHashMap<ke::Ref<CommandGroup> > GroupMap;
StringHashMap<ConCmdInfo *> m_Cmds; /* command lookup */
GroupMap m_CmdGrps; /* command group map */
ConCmdList m_CmdList; /* command list */
int m_CmdClient; /* current client */
BaseStringTable m_Strings; /* string table */
};
extern ConCmdManager g_ConCmds;
+103 -56
View File
@@ -29,34 +29,31 @@
#include "ConVarManager.h"
#include "HalfLife2.h"
#include "PluginSys.h"
#include "ForwardSys.h"
#include "HandleSys.h"
#include "sm_srvcmds.h"
#include "sm_stringutil.h"
#include <sh_vector.h>
#include <sm_trie_tpl.h>
#include <sm_namehashset.h>
#include "logic_bridge.h"
ConVarManager g_ConVarManager;
#if SOURCE_ENGINE <= SE_DARKMESSIAH
#define CallGlobalChangeCallbacks CallGlobalChangeCallback
#endif
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_HOOK3_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar *, const char *, float);
#else
SH_DECL_HOOK2_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar *, const char *);
SH_DECL_HOOK2_void(ICvar, CallGlobalChangeCallback, SH_NOATTRIB, false, ConVar *, const char *);
#endif
#if SOURCE_ENGINE != SE_DARKMESSIAH
#if SOURCE_ENGINE == SE_DOTA
SH_DECL_HOOK5_void(IServerGameDLL, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, CEntityIndex, EQueryCvarValueStatus, const char *, const char *);
SH_DECL_HOOK5_void(IServerPluginCallbacks, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, CEntityIndex, EQueryCvarValueStatus, const char *, const char *);
#elif SOURCE_ENGINE != SE_DARKMESSIAH
SH_DECL_HOOK5_void(IServerGameDLL, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *);
SH_DECL_HOOK5_void(IServerPluginCallbacks, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *);
#endif
const ParamType CONVARCHANGE_PARAMS[] = {Param_Cell, Param_String, Param_String};
typedef List<const ConVar *> ConVarList;
KTrie<ConVarInfo *> convar_cache;
NameHashSet<ConVarInfo *> convar_cache;
class ConVarReentrancyGuard
{
@@ -110,7 +107,7 @@ void ConVarManager::OnSourceModStartup(bool late)
sec.access[HandleAccess_Clone] = HANDLE_RESTRICT_IDENTITY | HANDLE_RESTRICT_OWNER;
/* Create the 'ConVar' handle type */
m_ConVarType = g_HandleSys.CreateType("ConVar", this, 0, NULL, &sec, g_pCoreIdent, NULL);
m_ConVarType = handlesys->CreateType("ConVar", this, 0, NULL, &sec, g_pCoreIdent, NULL);
}
void ConVarManager::OnSourceModAllInitialized()
@@ -121,14 +118,20 @@ void ConVarManager::OnSourceModAllInitialized()
#if SOURCE_ENGINE == SE_EPISODEONE
if (g_SMAPI->GetGameDLLVersion() >= 6)
{
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, OnQueryCvarValueFinished, gamedll, this, &ConVarManager::OnQueryCvarValueFinished, false);
SH_ADD_HOOK(IServerGameDLL, OnQueryCvarValueFinished, gamedll, SH_MEMBER(this, &ConVarManager::OnQueryCvarValueFinished), false);
m_bIsDLLQueryHooked = true;
}
#endif
SH_ADD_HOOK_STATICFUNC(ICvar, CallGlobalChangeCallbacks, icvar, OnConVarChanged, false);
g_Players.AddClientListener(this);
g_PluginSys.AddPluginsListener(this);
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_ADD_HOOK(ICvar, CallGlobalChangeCallbacks, icvar, SH_STATIC(OnConVarChanged), false);
#else
SH_ADD_HOOK(ICvar, CallGlobalChangeCallback, icvar, SH_STATIC(OnConVarChanged), false);
#endif
scripts->AddPluginsListener(this);
/* Add the 'convars' option to the 'sm' console command */
g_RootMenu.AddRootConsoleCommand("cvars", "View convars created by a plugin", this);
@@ -146,10 +149,10 @@ void ConVarManager::OnSourceModShutdown()
iter = m_ConVars.erase(iter);
g_HandleSys.FreeHandle(pInfo->handle, &sec);
handlesys->FreeHandle(pInfo->handle, &sec);
if (pInfo->pChangeForward != NULL)
{
g_Forwards.ReleaseForward(pInfo->pChangeForward);
forwardsys->ReleaseForward(pInfo->pChangeForward);
}
if (pInfo->sourceMod)
{
@@ -181,25 +184,33 @@ void ConVarManager::OnSourceModShutdown()
/* Unhook things */
if (m_bIsDLLQueryHooked)
{
SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, OnQueryCvarValueFinished, gamedll, this, &ConVarManager::OnQueryCvarValueFinished, false);
SH_REMOVE_HOOK(IServerGameDLL, OnQueryCvarValueFinished, gamedll, SH_MEMBER(this, &ConVarManager::OnQueryCvarValueFinished), false);
m_bIsDLLQueryHooked = false;
}
else if (m_bIsVSPQueryHooked)
{
SH_REMOVE_HOOK_MEMFUNC(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, this, &ConVarManager::OnQueryCvarValueFinished, false);
#if SOURCE_ENGINE != SE_DOTA
SH_REMOVE_HOOK(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, SH_MEMBER(this, &ConVarManager::OnQueryCvarValueFinished), false);
#endif
m_bIsVSPQueryHooked = false;
}
#endif
SH_REMOVE_HOOK_STATICFUNC(ICvar, CallGlobalChangeCallbacks, icvar, OnConVarChanged, false);
g_Players.RemoveClientListener(this);
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_REMOVE_HOOK(ICvar, CallGlobalChangeCallbacks, icvar, SH_STATIC(OnConVarChanged), false);
#else
SH_REMOVE_HOOK(ICvar, CallGlobalChangeCallback, icvar, SH_STATIC(OnConVarChanged), false);
#endif
/* Remove the 'convars' option from the 'sm' console command */
g_RootMenu.RemoveRootConsoleCommand("cvars", this);
g_PluginSys.RemovePluginsListener(this);
scripts->RemovePluginsListener(this);
/* Remove the 'ConVar' handle type */
g_HandleSys.RemoveType(m_ConVarType, g_pCoreIdent);
handlesys->RemoveType(m_ConVarType, g_pCoreIdent);
}
/**
@@ -229,24 +240,15 @@ void ConVarManager::OnSourceModVSPReceived()
}
#endif
#if SOURCE_ENGINE != SE_DARKMESSIAH
SH_ADD_HOOK_MEMFUNC(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, this, &ConVarManager::OnQueryCvarValueFinished, false);
#if SOURCE_ENGINE != SE_DARKMESSIAH && SOURCE_ENGINE != SE_DOTA
SH_ADD_HOOK(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, SH_MEMBER(this, &ConVarManager::OnQueryCvarValueFinished), false);
m_bIsVSPQueryHooked = true;
#endif
}
bool convar_cache_lookup(const char *name, ConVarInfo **pVar)
{
ConVarInfo **pLookup = convar_cache.retrieve(name);
if (pLookup != NULL)
{
*pVar = *pLookup;
return true;
}
else
{
return false;
}
return convar_cache.retrieve(name, pVar);
}
void ConVarManager::OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name, bool is_read_safe)
@@ -265,7 +267,7 @@ void ConVarManager::OnUnlinkConCommandBase(ConCommandBase *pBase, const char *na
convar_cache.remove(name);
/* Now make sure no plugins are referring to this pointer */
IPluginIterator *pl_iter = g_PluginSys.GetPluginIterator();
IPluginIterator *pl_iter = scripts->GetPluginIterator();
while (pl_iter->MorePlugins())
{
IPlugin *pl = pl_iter->GetPlugin();
@@ -281,7 +283,7 @@ void ConVarManager::OnUnlinkConCommandBase(ConCommandBase *pBase, const char *na
}
/* Free resources */
g_HandleSys.FreeHandle(pInfo->handle, &sec);
handlesys->FreeHandle(pInfo->handle, &sec);
delete pInfo;
}
@@ -296,14 +298,35 @@ void ConVarManager::OnPluginUnloaded(IPlugin *plugin)
delete pConVarList;
}
const IPluginRuntime * pRuntime = plugin->GetRuntime();
/* Remove convar queries for this plugin that haven't returned results yet */
for (iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end(); iter++)
for (iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end();)
{
ConVarQuery &query = (*iter);
if (query.pCallback->GetParentRuntime() == plugin->GetRuntime())
if (query.pCallback->GetParentRuntime() == pRuntime)
{
m_ConVarQueries.erase(iter);
iter = m_ConVarQueries.erase(iter);
continue;
}
++iter;
}
}
void ConVarManager::OnClientDisconnected(int client)
{
/* Remove convar queries for this client that haven't returned results yet */
for (List<ConVarQuery>::iterator iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end();)
{
ConVarQuery &query = (*iter);
if (query.client == client)
{
iter = m_ConVarQueries.erase(iter);
continue;
}
++iter;
}
}
@@ -333,7 +356,7 @@ void ConVarManager::OnRootConsoleCommand(const char *cmdname, const CCommand &co
}
/* Get plugin object */
CPlugin *plugin = g_PluginSys.FindPluginByConsoleArg(arg);
IPlugin *plugin = scripts->FindPluginByConsoleArg(arg);
if (!plugin)
{
@@ -414,7 +437,7 @@ Handle_t ConVarManager::CreateConVar(IPluginContext *pContext, const char *name,
pInfo->pVar = pConVar;
/* If we don't, then create a new handle from the convar */
hndl = g_HandleSys.CreateHandle(m_ConVarType, pInfo, NULL, g_pCoreIdent, NULL);
hndl = handlesys->CreateHandle(m_ConVarType, pInfo, NULL, g_pCoreIdent, NULL);
if (hndl == BAD_HANDLE)
{
delete pInfo;
@@ -445,7 +468,7 @@ Handle_t ConVarManager::CreateConVar(IPluginContext *pContext, const char *name,
pInfo->pChangeForward = NULL;
/* Create a handle from the new convar */
hndl = g_HandleSys.CreateHandle(m_ConVarType, pInfo, NULL, g_pCoreIdent, NULL);
hndl = handlesys->CreateHandle(m_ConVarType, pInfo, NULL, g_pCoreIdent, NULL);
if (hndl == BAD_HANDLE)
{
delete pInfo;
@@ -474,7 +497,13 @@ Handle_t ConVarManager::FindConVar(const char *name)
ConVarInfo *pInfo;
Handle_t hndl;
/* Search for convar */
/* Check convar cache to find out if we already have a handle */
if (convar_cache_lookup(name, &pInfo))
{
return pInfo->handle;
}
/* Couldn't find it in cache, so search for it */
pConVar = icvar->FindVar(name);
/* If it doesn't exist, then return an invalid handle */
@@ -483,12 +512,6 @@ Handle_t ConVarManager::FindConVar(const char *name)
return BAD_HANDLE;
}
/* At this point, the convar exists. So, find out if we already have a handle */
if (convar_cache_lookup(name, &pInfo))
{
return pInfo->handle;
}
/* Create and initialize ConVarInfo structure */
pInfo = new ConVarInfo();
pInfo->sourceMod = false;
@@ -496,7 +519,7 @@ Handle_t ConVarManager::FindConVar(const char *name)
pInfo->pVar = pConVar;
/* If we don't have a handle, then create a new one */
hndl = g_HandleSys.CreateHandle(m_ConVarType, pInfo, NULL, g_pCoreIdent, NULL);
hndl = handlesys->CreateHandle(m_ConVarType, pInfo, NULL, g_pCoreIdent, NULL);
if (hndl == BAD_HANDLE)
{
delete pInfo;
@@ -554,7 +577,7 @@ void ConVarManager::HookConVarChange(ConVar *pConVar, IPluginFunction *pFunction
/* If forward does not exist, create it */
if (!pForward)
{
pForward = g_Forwards.CreateForwardEx(NULL, ET_Ignore, 3, CONVARCHANGE_PARAMS);
pForward = forwardsys->CreateForwardEx(NULL, ET_Ignore, 3, CONVARCHANGE_PARAMS);
pInfo->pChangeForward = pForward;
}
@@ -594,7 +617,7 @@ void ConVarManager::UnhookConVarChange(ConVar *pConVar, IPluginFunction *pFuncti
!ConVarReentrancyGuard::IsCvarInChain(pConVar))
{
/* Free this forward */
g_Forwards.ReleaseForward(pForward);
forwardsys->ReleaseForward(pForward);
pInfo->pChangeForward = NULL;
}
}
@@ -608,19 +631,28 @@ QueryCvarCookie_t ConVarManager::QueryClientConVar(edict_t *pPlayer, const char
/* Call StartQueryCvarValue() in either the IVEngineServer or IServerPluginHelpers depending on situation */
if (m_bIsDLLQueryHooked)
{
#if SOURCE_ENGINE == SE_DOTA
cookie = engine->StartQueryCvarValue(CEntityIndex(IndexOfEdict(pPlayer)), name);
#else
cookie = engine->StartQueryCvarValue(pPlayer, name);
#endif
}
#if SOURCE_ENGINE != SE_DOTA
else if (m_bIsVSPQueryHooked)
{
cookie = serverpluginhelpers->StartQueryCvarValue(pPlayer, name);
}
#endif
else
{
return InvalidQueryCvarCookie;
}
ConVarQuery query = {cookie, pCallback, hndl};
m_ConVarQueries.push_back(query);
if (pCallback != NULL)
{
ConVarQuery query = { cookie, pCallback, (cell_t) hndl, IndexOfEdict(pPlayer) };
m_ConVarQueries.push_back(query);
}
#endif
return cookie;
@@ -633,7 +665,7 @@ void ConVarManager::AddConVarToPluginList(IPluginContext *pContext, const ConVar
bool inserted = false;
const char *orig = pConVar->GetName();
IPlugin *plugin = g_PluginSys.FindPluginByContext(pContext->GetContext());
IPlugin *plugin = scripts->FindPluginByContext(pContext->GetContext());
/* Check plugin for an existing convar list */
if (!plugin->GetProperty("ConVarList", (void **)&pConVarList))
@@ -718,8 +750,19 @@ bool ConVarManager::IsQueryingSupported()
}
#if SOURCE_ENGINE != SE_DARKMESSIAH
#if SOURCE_ENGINE == SE_DOTA
void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, CEntityIndex player, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue)
#else
void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue)
#endif // SE_DOTA
{
#if SOURCE_ENGINE == SE_CSGO
if (g_Players.HandleConVarQuery(cookie, pPlayer, result, cvarName, cvarValue))
{
return;
}
#endif
IPluginFunction *pCallback = NULL;
cell_t value = 0;
List<ConVarQuery>::iterator iter;
@@ -740,7 +783,11 @@ void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *
cell_t ret;
pCallback->PushCell(cookie);
#if SOURCE_ENGINE == SE_DOTA
pCallback->PushCell(player.Get());
#else
pCallback->PushCell(IndexOfEdict(pPlayer));
#endif
pCallback->PushCell(result);
pCallback->PushString(cvarName);
@@ -766,7 +813,7 @@ HandleError ConVarManager::ReadConVarHandle(Handle_t hndl, ConVar **pVar)
ConVarInfo *pInfo;
HandleError error;
if ((error = g_HandleSys.ReadHandle(hndl, m_ConVarType, NULL, (void **)&pInfo)) != HandleError_None)
if ((error = handlesys->ReadHandle(hndl, m_ConVarType, NULL, (void **)&pInfo)) != HandleError_None)
{
return error;
}
+17 -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.
@@ -39,8 +39,10 @@
#include <IForwardSys.h>
#include <IHandleSys.h>
#include <IRootConsoleMenu.h>
#include <IPlayerHelpers.h>
#include <compat_wrappers.h>
#include "concmd_cleaner.h"
#include "PlayerManager.h"
#if SOURCE_ENGINE == SE_DARKMESSIAH
class EQueryCvarValueStatus;
@@ -65,6 +67,11 @@ struct ConVarInfo
IChangeableForward *pChangeForward; /**< Forward associated with convar */
ConVar *pVar; /**< The actual convar */
List<IConVarChangeListener *> changeListeners;
static inline bool matches(const char *name, const ConVarInfo *info)
{
return strcmp(name, info->pVar->GetName()) == 0;
}
};
/**
@@ -75,6 +82,7 @@ struct ConVarQuery
QueryCvarCookie_t cookie; /**< Cookie that identifies query */
IPluginFunction *pCallback; /**< Function that will be called when query is finished */
cell_t value; /**< Optional value passed to query function */
cell_t client; /**< Only used for cleaning up on client disconnection */
};
class ConVarManager :
@@ -82,7 +90,8 @@ class ConVarManager :
public IHandleTypeDispatch,
public IPluginsListener,
public IRootConsoleCommand,
public IConCommandTracker
public IConCommandTracker,
public IClientListener
{
public:
ConVarManager();
@@ -101,6 +110,8 @@ public: //IRootConsoleCommand
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
public: //IConCommandTracker
void OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name, bool is_read_safe);
public: //IClientListener
void OnClientDisconnected(int client);
public:
/**
* Create a convar and return a handle to it.
@@ -154,7 +165,10 @@ private:
/**
* Callback for when StartQueryCvarValue() has finished.
*/
#if SOURCE_ENGINE != SE_DARKMESSIAH
#if SOURCE_ENGINE == SE_DOTA
void OnQueryCvarValueFinished(QueryCvarCookie_t cookie, CEntityIndex player, EQueryCvarValueStatus result,
const char *cvarName, const char *cvarValue);
#elif SOURCE_ENGINE != SE_DARKMESSIAH
void OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result,
const char *cvarName, const char *cvarValue);
#endif
+39 -47
View File
@@ -49,7 +49,8 @@
#include "ConCmdManager.h"
#include "HalfLife2.h"
#include "ConCommandBaseIterator.h"
#include "ShareSys.h"
#include "logic_bridge.h"
#include <am-utility.h>
#if defined PLATFORM_POSIX
# include <dlfcn.h>
@@ -59,7 +60,9 @@
#endif
#if SH_IMPL_VERSION >= 5
# if SOURCE_ENGINE >= SE_ORANGEBOX
# if SOURCE_ENGINE == SE_DOTA
SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
# elif SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
# else
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
@@ -131,7 +134,9 @@ class GenericCommandHooker : public IConCommandLinkListener
}
}
# if SOURCE_ENGINE >= SE_ORANGEBOX
# if SOURCE_ENGINE == SE_DOTA
void Dispatch(const CCommandContext &context, const CCommand& args)
# elif SOURCE_ENGINE >= SE_ORANGEBOX
void Dispatch(const CCommand& args)
# else
void Dispatch()
@@ -190,7 +195,7 @@ class GenericCommandHooker : public IConCommandLinkListener
size_t index;
if (!FindVtable(vtable, index))
{
g_Logger.LogError("Console detour tried to unhook command \"%s\" but it wasn't found", pBase->GetName());
logger->LogError("Console detour tried to unhook command \"%s\" but it wasn't found", pBase->GetName());
return;
}
@@ -214,7 +219,7 @@ public:
if (dispatch.thisptroffs < 0)
{
g_Logger.LogError("Command filter could not determine ConCommand layout");
logger->LogError("Command filter could not determine ConCommand layout");
return false;
}
@@ -223,7 +228,7 @@ public:
if (!vtables.size())
{
g_Logger.LogError("Command filter could not find any cvars!");
logger->LogError("Command filter could not find any cvars!");
return false;
}
@@ -574,23 +579,21 @@ ConsoleDetours::ConsoleDetours() : status(FeatureStatus_Unknown)
void ConsoleDetours::OnSourceModAllInitialized()
{
m_pForward = g_Forwards.CreateForwardEx("OnAnyCommand", ET_Hook, 3, NULL, Param_Cell,
m_pForward = forwardsys->CreateForwardEx("OnAnyCommand", ET_Hook, 3, NULL, Param_Cell,
Param_String, Param_Cell);
g_ShareSys.AddCapabilityProvider(NULL, this, FEATURECAP_COMMANDLISTENER);
sharesys->AddCapabilityProvider(NULL, this, FEATURECAP_COMMANDLISTENER);
}
void ConsoleDetours::OnSourceModShutdown()
{
List<Listener*>::iterator iter = m_Listeners.begin();
while (iter != m_Listeners.end())
for (StringHashMap<IChangeableForward *>::iterator iter = m_Listeners.iter();
!iter.empty();
iter.next())
{
Listener *listener = (*iter);
g_Forwards.ReleaseForward(listener->forward);
delete listener;
iter = m_Listeners.erase(iter);
forwardsys->ReleaseForward(iter->value);
}
g_Forwards.ReleaseForward(m_pForward);
forwardsys->ReleaseForward(m_pForward);
s_GenericHooker.Disable();
}
@@ -619,22 +622,15 @@ bool ConsoleDetours::AddListener(IPluginFunction *fun, const char *command)
}
else
{
const char *str = UTIL_ToLowerCase(command);
Listener *listener;
Listener **plistener = m_CmdLookup.retrieve(str);
if (plistener == NULL)
ke::AutoArray<char> str(UTIL_ToLowerCase(command));
IChangeableForward *forward;
if (!m_Listeners.retrieve(str, &forward))
{
listener = new Listener;
listener->forward = g_Forwards.CreateForwardEx(NULL, ET_Hook, 3, NULL, Param_Cell,
Param_String, Param_Cell);
m_CmdLookup.insert(str, listener);
forward = forwardsys->CreateForwardEx(NULL, ET_Hook, 3, NULL, Param_Cell,
Param_String, Param_Cell);
m_Listeners.insert(str, forward);
}
else
{
listener = *plistener;
}
listener->forward->AddFunction(fun);
delete [] str;
forward->AddFunction(fun);
}
return true;
@@ -648,14 +644,11 @@ bool ConsoleDetours::RemoveListener(IPluginFunction *fun, const char *command)
}
else
{
const char *str = UTIL_ToLowerCase(command);
Listener *listener;
Listener **plistener = m_CmdLookup.retrieve(str);
delete [] str;
if (plistener == NULL)
ke::AutoArray<char> str(UTIL_ToLowerCase(command));
IChangeableForward *forward;
if (!m_Listeners.retrieve(str, &forward))
return false;
listener = *plistener;
return listener->forward->RemoveFunction(fun);
return forward->RemoveFunction(fun);
}
}
@@ -688,21 +681,20 @@ 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);
if (plistener == NULL)
IChangeableForward *forward;
if (!m_Listeners.retrieve(name, &forward))
return result;
Listener *listener = *plistener;
if (listener->forward->GetFunctionCount() == 0)
if (forward->GetFunctionCount() == 0)
return result;
cell_t result2 = Pl_Continue;
listener->forward->PushCell(client);
listener->forward->PushString(name);
listener->forward->PushCell(args.ArgC() - 1);
listener->forward->Execute(&result2, NULL);
forward->PushCell(client);
forward->PushString(name);
forward->PushCell(args.ArgC() - 1);
forward->Execute(&result2, NULL);
if (result2 > result)
result = result2;
@@ -731,10 +723,10 @@ cell_t ConsoleDetours::Dispatch(ConCommand *pBase)
/* See bug 4020 - we can't optimize this because looking at the vtable
* is probably more expensive, since there's no SH_GET_ORIG_VFNPTR_ENTRY.
*/
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pBase, DummyHook, false);
SH_ADD_HOOK(ConCommand, Dispatch, pBase, SH_STATIC(DummyHook), false);
dummy_hook_set = true;
pBase->Dispatch();
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, pBase, DummyHook, false);
SH_REMOVE_HOOK(ConCommand, Dispatch, pBase, SH_STATIC(DummyHook), false);
}
else
{
+3 -8
View File
@@ -33,8 +33,8 @@
#include "sm_globals.h"
#include "sourcemm_api.h"
#include "ForwardSys.h"
#include <sm_trie_tpl.h>
#include <IForwardSys.h>
#include <sm_stringhashmap.h>
class ConsoleDetours :
public SMGlobalClass,
@@ -43,10 +43,6 @@ class ConsoleDetours :
friend class PlayerManager;
friend class GenericCommandHooker;
struct Listener
{
IChangeableForward *forward;
};
public:
ConsoleDetours();
public: //SMGlobalClass
@@ -73,8 +69,7 @@ public:
private:
FeatureStatus status;
IChangeableForward *m_pForward;
KTrie<Listener*> m_CmdLookup;
List<Listener*> m_Listeners;
StringHashMap<IChangeableForward *> m_Listeners;
};
extern ConsoleDetours g_ConsoleDetours;
+57 -39
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.
@@ -34,13 +34,12 @@
#include "sourcemod.h"
#include "sourcemm_api.h"
#include "sm_srvcmds.h"
#include <sourcemod_version.h>
#include "sm_stringutil.h"
#include "LibrarySys.h"
#include "Logger.h"
#include "PluginSys.h"
#include "ForwardSys.h"
#include "frame_hooks.h"
#include "logic_bridge.h"
#include <sourcemod_version.h>
#ifdef PLATFORM_WINDOWS
ConVar sm_corecfgfile("sm_corecfgfile", "addons\\sourcemod\\configs\\core.cfg", 0, "SourceMod core configuration file");
@@ -61,7 +60,10 @@ ConVar *g_ServerCfgFile = NULL;
void CheckAndFinalizeConfigs();
#if SOURCE_ENGINE >= SE_ORANGEBOX
#if SOURCE_ENGINE == SE_DOTA
SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
void Hook_ExecDispatchPre(const CCommandContext &context, const CCommand &cmd)
#elif SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
void Hook_ExecDispatchPre(const CCommand &cmd)
#elif SOURCE_ENGINE == SE_DARKMESSIAH
@@ -89,7 +91,9 @@ void Hook_ExecDispatchPre()
}
}
#if SOURCE_ENGINE >= SE_ORANGEBOX
#if SOURCE_ENGINE == SE_DOTA
void Hook_ExecDispatchPost(const CCommandContext &context, const CCommand &cmd)
#elif SOURCE_ENGINE >= SE_ORANGEBOX
void Hook_ExecDispatchPost(const CCommand &cmd)
#else
void Hook_ExecDispatchPost()
@@ -114,12 +118,12 @@ void CheckAndFinalizeConfigs()
void CoreConfig::OnSourceModAllInitialized()
{
g_RootMenu.AddRootConsoleCommand("config", "Set core configuration options", this);
g_pOnServerCfg = g_Forwards.CreateForward("OnServerCfg", ET_Ignore, 0, NULL);
g_pOnConfigsExecuted = g_Forwards.CreateForward("OnConfigsExecuted", ET_Ignore, 0, NULL);
g_pOnAutoConfigsBuffered = g_Forwards.CreateForward("OnAutoConfigsBuffered", ET_Ignore, 0, NULL);
g_pOnServerCfg = forwardsys->CreateForward("OnServerCfg", ET_Ignore, 0, NULL);
g_pOnConfigsExecuted = forwardsys->CreateForward("OnConfigsExecuted", ET_Ignore, 0, NULL);
g_pOnAutoConfigsBuffered = forwardsys->CreateForward("OnAutoConfigsBuffered", ET_Ignore, 0, NULL);
}
CoreConfig::CoreConfig() : m_Strings(512)
CoreConfig::CoreConfig()
{
}
@@ -130,14 +134,14 @@ CoreConfig::~CoreConfig()
void CoreConfig::OnSourceModShutdown()
{
g_RootMenu.RemoveRootConsoleCommand("config", this);
g_Forwards.ReleaseForward(g_pOnServerCfg);
g_Forwards.ReleaseForward(g_pOnConfigsExecuted);
g_Forwards.ReleaseForward(g_pOnAutoConfigsBuffered);
forwardsys->ReleaseForward(g_pOnServerCfg);
forwardsys->ReleaseForward(g_pOnConfigsExecuted);
forwardsys->ReleaseForward(g_pOnAutoConfigsBuffered);
if (g_pExecPtr != NULL)
{
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, g_pExecPtr, Hook_ExecDispatchPre, false);
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, g_pExecPtr, Hook_ExecDispatchPost, true);
SH_REMOVE_HOOK(ConCommand, Dispatch, g_pExecPtr, SH_STATIC(Hook_ExecDispatchPre), false);
SH_REMOVE_HOOK(ConCommand, Dispatch, g_pExecPtr, SH_STATIC(Hook_ExecDispatchPost), true);
g_pExecPtr = NULL;
}
}
@@ -162,8 +166,8 @@ void CoreConfig::OnSourceModLevelChange(const char *mapName)
g_pExecPtr = FindCommand("exec");
if (g_pExecPtr != NULL)
{
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, g_pExecPtr, Hook_ExecDispatchPre, false);
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, g_pExecPtr, Hook_ExecDispatchPost, true);
SH_ADD_HOOK(ConCommand, Dispatch, g_pExecPtr, SH_STATIC(Hook_ExecDispatchPre), false);
SH_ADD_HOOK(ConCommand, Dispatch, g_pExecPtr, SH_STATIC(Hook_ExecDispatchPost), true);
}
else
{
@@ -193,17 +197,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()
@@ -239,14 +256,13 @@ void CoreConfig::Initialize()
/* Reset cached key values */
m_KeyValues.clear();
m_Strings.Reset();
/* Parse config file */
if ((err=textparsers->ParseFile_SMC(filePath, this, NULL)) != SMCError_Okay)
{
/* :TODO: This won't actually log or print anything :( - So fix that somehow */
const char *error = textparsers->GetSMCErrorString(err);
g_Logger.LogFatal("[SM] Error encountered parsing core config file: %s", error ? error : "");
logger->LogFatal("[SM] Error encountered parsing core config file: %s", error ? error : "");
}
}
@@ -258,7 +274,7 @@ SMCResult CoreConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key,
if (err == ConfigResult_Reject)
{
/* This is a fatal error */
g_Logger.LogFatal("Config error (key: %s) (value: %s) %s", key, value, error);
logger->LogFatal("Config error (key: %s) (value: %s) %s", key, value, error);
}
return SMCResult_Continue;
@@ -279,19 +295,18 @@ ConfigResult CoreConfig::SetConfigOption(const char *option, const char *value,
pBase = pBase->m_pGlobalClassNext;
}
m_KeyValues.replace(option, m_Strings.AddString(value));
ke::AString vstr(value);
m_KeyValues.replace(option, ke::Move(vstr));
return ConfigResult_Ignore;
}
const char *CoreConfig::GetCoreConfigValue(const char *key)
{
int *pKey = m_KeyValues.retrieve(key);
if (pKey == NULL)
{
StringHashMap<ke::AString>::Result r = m_KeyValues.find(key);
if (!r.found())
return NULL;
}
return m_Strings.GetString(*pKey);
return r->value.chars();
}
bool SM_AreConfigsExecuted()
@@ -308,7 +323,7 @@ inline bool IsPathSepChar(char c)
#endif
}
bool SM_ExecuteConfig(CPlugin *pl, AutoConfig *cfg, bool can_create)
bool SM_ExecuteConfig(IPlugin *pl, AutoConfig *cfg, bool can_create)
{
bool will_create = false;
@@ -395,7 +410,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", SOURCEMOD_VERSION);
fprintf(fp, "// ConVars for plugin \"%s\"\n", pl->GetFilename());
fprintf(fp, "\n\n");
@@ -452,6 +467,11 @@ bool SM_ExecuteConfig(CPlugin *pl, AutoConfig *cfg, bool can_create)
can_create = false;
fclose(fp);
}
else
{
logger->LogError("Failed to auto generate config for %s, make sure the directory has write permission.", pl->GetFilename());
return can_create;
}
}
}
@@ -482,10 +502,10 @@ void SM_DoSingleExecFwds(IPluginContext *ctx)
void SM_ConfigsExecuted_Plugin(unsigned int serial)
{
IPluginIterator *iter = g_PluginSys.GetPluginIterator();
IPluginIterator *iter = scripts->GetPluginIterator();
while (iter->MorePlugins())
{
CPlugin *plugin = (CPlugin *)(iter->GetPlugin());
IPlugin *plugin = iter->GetPlugin();
if (plugin->GetSerial() == serial)
{
SM_DoSingleExecFwds(plugin->GetBaseContext());
@@ -498,7 +518,7 @@ void SM_ConfigsExecuted_Plugin(unsigned int serial)
void SM_ExecuteForPlugin(IPluginContext *ctx)
{
CPlugin *plugin = (CPlugin *)g_PluginSys.GetPluginByCtx(ctx->GetContext());
SMPlugin *plugin = scripts->FindPluginByContext(ctx->GetContext());
unsigned int num = plugin->GetConfigCount();
if (!num)
@@ -527,19 +547,17 @@ void SM_ExecuteAllConfigs()
engine->ServerCommand("exec sourcemod/sourcemod.cfg\n");
IPluginIterator *iter = g_PluginSys.GetPluginIterator();
while (iter->MorePlugins())
AutoPluginList plugins(scripts);
for (size_t i = 0; i < plugins->size(); i++)
{
CPlugin *plugin = (CPlugin *)(iter->GetPlugin());
SMPlugin *plugin = plugins->at(i);
unsigned int num = plugin->GetConfigCount();
bool can_create = true;
for (unsigned int i=0; i<num; i++)
{
can_create = SM_ExecuteConfig(plugin, plugin->GetConfig(i), can_create);
}
iter->NextPlugin();
}
iter->Release();
g_bGotServerStart = true;
CheckAndFinalizeConfigs();
+4 -5
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.
@@ -35,8 +35,8 @@
#include "sm_globals.h"
#include <ITextParsers.h>
#include <IRootConsoleMenu.h>
#include <sm_trie_tpl.h>
#include "sm_memtable.h"
#include <am-string.h>
#include <sm_stringhashmap.h>
using namespace SourceMod;
@@ -68,8 +68,7 @@ private:
*/
ConfigResult SetConfigOption(const char *option, const char *value, ConfigSource, char *Error, size_t maxlength);
private:
BaseStringTable m_Strings;
KTrie<int> m_KeyValues;
StringHashMap<ke::AString> m_KeyValues;
};
extern bool SM_AreConfigsExecuted();
+29 -39
View File
@@ -30,10 +30,8 @@
*/
#include "EventManager.h"
#include "ForwardSys.h"
#include "HandleSys.h"
#include "PluginSys.h"
#include "sm_stringutil.h"
#include "logic_bridge.h"
EventManager g_EventManager;
@@ -58,14 +56,10 @@ public:
EventManager::EventManager() : m_EventType(0)
{
/* Create an event lookup trie */
m_EventHooks = sm_trie_create();
}
EventManager::~EventManager()
{
sm_trie_destroy(m_EventHooks);
/* Free memory used by EventInfo structs if any */
CStack<EventInfo *>::iterator iter;
for (iter = m_FreeEvents.begin(); iter != m_FreeEvents.end(); iter++)
@@ -79,8 +73,8 @@ EventManager::~EventManager()
void EventManager::OnSourceModAllInitialized()
{
/* Add a hook for IGameEventManager2::FireEvent() */
SH_ADD_HOOK_MEMFUNC(IGameEventManager2, FireEvent, gameevents, this, &EventManager::OnFireEvent, false);
SH_ADD_HOOK_MEMFUNC(IGameEventManager2, FireEvent, gameevents, this, &EventManager::OnFireEvent_Post, true);
SH_ADD_HOOK(IGameEventManager2, FireEvent, gameevents, SH_MEMBER(this, &EventManager::OnFireEvent), false);
SH_ADD_HOOK(IGameEventManager2, FireEvent, gameevents, SH_MEMBER(this, &EventManager::OnFireEvent_Post), true);
HandleAccess sec;
@@ -90,17 +84,17 @@ void EventManager::OnSourceModAllInitialized()
sec.access[HandleAccess_Clone] = HANDLE_RESTRICT_IDENTITY | HANDLE_RESTRICT_OWNER;
/* Create the 'GameEvent' handle type */
m_EventType = g_HandleSys.CreateType("GameEvent", this, 0, NULL, &sec, g_pCoreIdent, NULL);
m_EventType = handlesys->CreateType("GameEvent", this, 0, NULL, &sec, g_pCoreIdent, NULL);
}
void EventManager::OnSourceModShutdown()
{
/* Remove hook for IGameEventManager2::FireEvent() */
SH_REMOVE_HOOK_MEMFUNC(IGameEventManager2, FireEvent, gameevents, this, &EventManager::OnFireEvent, false);
SH_REMOVE_HOOK_MEMFUNC(IGameEventManager2, FireEvent, gameevents, this, &EventManager::OnFireEvent_Post, true);
SH_REMOVE_HOOK(IGameEventManager2, FireEvent, gameevents, SH_MEMBER(this, &EventManager::OnFireEvent), false);
SH_REMOVE_HOOK(IGameEventManager2, FireEvent, gameevents, SH_MEMBER(this, &EventManager::OnFireEvent_Post), true);
/* Remove the 'GameEvent' handle type */
g_HandleSys.RemoveType(m_EventType, g_pCoreIdent);
handlesys->RemoveType(m_EventType, g_pCoreIdent);
/* Remove ourselves as listener for events */
gameevents->RemoveListener(this);
@@ -138,12 +132,12 @@ void EventManager::OnPluginUnloaded(IPlugin *plugin)
{
if (pHook->pPreHook)
{
g_Forwards.ReleaseForward(pHook->pPreHook);
forwardsys->ReleaseForward(pHook->pPreHook);
}
if (pHook->pPostHook)
{
g_Forwards.ReleaseForward(pHook->pPostHook);
forwardsys->ReleaseForward(pHook->pPostHook);
}
delete pHook;
@@ -161,7 +155,7 @@ 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
#if SOURCE_ENGINE >= SE_LEFT4DEAD && SOURCE_ENGINE != SE_DOTA
int EventManager::GetEventDebugID()
{
return EVENT_DEBUG_ID_INIT;
@@ -184,10 +178,10 @@ EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunct
}
/* If a hook structure does not exist... */
if (!sm_trie_retrieve(m_EventHooks, name, (void **)&pHook))
if (!m_EventHooks.retrieve(name, &pHook))
{
EventHookList *pHookList;
IPlugin *plugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
IPlugin *plugin = scripts->FindPluginByContext(pFunction->GetParentContext()->GetContext());
/* Check plugin for an existing EventHook list */
if (!plugin->GetProperty("EventHooks", (void **)&pHookList))
@@ -202,12 +196,12 @@ EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunct
if (mode == EventHookMode_Pre)
{
/* Create forward for a pre hook */
pHook->pPreHook = g_Forwards.CreateForwardEx(NULL, ET_Hook, 3, GAMEEVENT_PARAMS);
pHook->pPreHook = forwardsys->CreateForwardEx(NULL, ET_Hook, 3, GAMEEVENT_PARAMS);
/* Add to forward list */
pHook->pPreHook->AddFunction(pFunction);
} else {
/* Create forward for a post hook */
pHook->pPostHook = g_Forwards.CreateForwardEx(NULL, ET_Ignore, 3, GAMEEVENT_PARAMS);
pHook->pPostHook = forwardsys->CreateForwardEx(NULL, ET_Ignore, 3, GAMEEVENT_PARAMS);
/* Should we copy data from a pre hook to the post hook? */
pHook->postCopy = (mode == EventHookMode_Post);
/* Add to forward list */
@@ -215,14 +209,14 @@ EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunct
}
/* Cache the name for post hooks */
pHook->name = sm_strdup(name);
pHook->name = name;
/* Increase reference count */
pHook->refCount++;
/* Add hook structure to hook lists */
pHookList->push_back(pHook);
sm_trie_insert(m_EventHooks, name, pHook);
m_EventHooks.insert(name, pHook);
return EventHookErr_Okay;
}
@@ -234,7 +228,7 @@ EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunct
/* Create pre hook forward if necessary */
if (!pHook->pPreHook)
{
pHook->pPreHook = g_Forwards.CreateForwardEx(NULL, ET_Event, 3, GAMEEVENT_PARAMS);
pHook->pPreHook = forwardsys->CreateForwardEx(NULL, ET_Event, 3, GAMEEVENT_PARAMS);
}
/* Add plugin function to forward list */
@@ -243,7 +237,7 @@ EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunct
/* Create post hook forward if necessary */
if (!pHook->pPostHook)
{
pHook->pPostHook = g_Forwards.CreateForwardEx(NULL, ET_Ignore, 3, GAMEEVENT_PARAMS);
pHook->pPostHook = forwardsys->CreateForwardEx(NULL, ET_Ignore, 3, GAMEEVENT_PARAMS);
}
/* If postCopy is false, then we may want to set it to true */
@@ -268,7 +262,7 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun
IChangeableForward **pEventForward;
/* If hook does not exist at all */
if (!sm_trie_retrieve(m_EventHooks, name, (void **)&pHook))
if (!m_EventHooks.retrieve(name, &pHook))
{
return EventHookErr_NotActive;
}
@@ -290,7 +284,7 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun
/* If forward's list contains 0 functions now, free it */
if ((*pEventForward)->GetFunctionCount() == 0)
{
g_Forwards.ReleaseForward(*pEventForward);
forwardsys->ReleaseForward(*pEventForward);
*pEventForward = NULL;
}
@@ -300,7 +294,7 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun
/* If reference count is now 0, free hook structure */
EventHookList *pHookList;
IPlugin *plugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
IPlugin *plugin = scripts->FindPluginByContext(pFunction->GetParentContext()->GetContext());
/* Get plugin's event hook list */
if (!plugin->GetProperty("EventHooks", (void**)&pHookList))
@@ -318,10 +312,7 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun
pHookList->remove(pHook);
/* Delete entry in trie */
sm_trie_delete(m_EventHooks, name);
/* Free the cached name */
delete pHook->name;
m_EventHooks.remove(name);
/* And finally free structure memory */
delete pHook;
@@ -397,7 +388,7 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
name = pEvent->GetName();
if (sm_trie_retrieve(m_EventHooks, name, reinterpret_cast<void **>(&pHook)))
if (m_EventHooks.retrieve(name, &pHook))
{
/* Push the event onto the event stack. The reference count is increased to make sure
* the structure is not garbage collected in between now and the post hook.
@@ -411,7 +402,7 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
{
EventInfo info(pEvent, NULL);
HandleSecurity sec(NULL, g_pCoreIdent);
Handle_t hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
Handle_t hndl = handlesys->CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
info.bDontBroadcast = bDontBroadcast;
@@ -424,7 +415,7 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
broadcast = info.bDontBroadcast;
g_HandleSys.FreeHandle(hndl, &sec);
handlesys->FreeHandle(hndl, &sec);
}
if (pHook->postCopy)
@@ -476,14 +467,14 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
info.bDontBroadcast = bDontBroadcast;
info.pEvent = m_EventCopies.front();
info.pOwner = NULL;
hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
hndl = handlesys->CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
pForward->PushCell(hndl);
} else {
pForward->PushCell(BAD_HANDLE);
}
pForward->PushString(pHook->name);
pForward->PushString(pHook->name.chars());
pForward->PushCell(bDontBroadcast);
pForward->Execute(NULL);
@@ -491,7 +482,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
{
/* Free handle */
HandleSecurity sec(NULL, g_pCoreIdent);
g_HandleSys.FreeHandle(hndl, &sec);
handlesys->FreeHandle(hndl, &sec);
/* Free event structure */
gameevents->FreeEvent(info.pEvent);
@@ -504,8 +495,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
{
assert(pHook->pPostHook == NULL);
assert(pHook->pPreHook == NULL);
sm_trie_delete(m_EventHooks, pHook->name);
delete pHook->name;
m_EventHooks.remove(pHook->name.chars());
delete pHook;
}
}
+10 -5
View File
@@ -1,5 +1,5 @@
/**
* vim: set ts=4 :
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
@@ -34,7 +34,7 @@
#include "sm_globals.h"
#include "sourcemm_api.h"
#include "sm_trie.h"
#include <sm_namehashset.h>
#include <sh_list.h>
#include <sh_stack.h>
#include <IHandleSys.h>
@@ -69,7 +69,12 @@ struct EventHook
IChangeableForward *pPostHook;
bool postCopy;
unsigned int refCount;
char *name;
ke::AString name;
static inline bool matches(const char *name, const EventHook *hook)
{
return strcmp(name, hook->name.chars()) == 0;
}
};
enum EventHookMode
@@ -105,7 +110,7 @@ public: // IPluginsListener
void OnPluginUnloaded(IPlugin *plugin);
public: // IGameEventListener2
void FireGameEvent(IGameEvent *pEvent);
#if SOURCE_ENGINE >= SE_LEFT4DEAD
#if SOURCE_ENGINE >= SE_LEFT4DEAD && SOURCE_ENGINE != SE_DOTA
int GetEventDebugID();
#endif
public:
@@ -127,7 +132,7 @@ private: // IGameEventManager2 hooks
bool OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast);
private:
HandleType_t m_EventType;
Trie *m_EventHooks;
NameHashSet<EventHook *> m_EventHooks;
CStack<EventInfo *> m_FreeEvents;
CStack<EventHook *> m_EventStack;
CStack<IGameEvent *> m_EventCopies;
+398 -153
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.
@@ -40,6 +40,13 @@
#include <Logger.h>
#include "LibrarySys.h"
#include "logic_bridge.h"
#include <tier0/mem.h>
#if SOURCE_ENGINE == SE_DOTA
#include <game/shared/protobuf/usermessages.pb.h>
#elif SOURCE_ENGINE == SE_CSGO
#include <cstrike15_usermessages.pb.h>
#endif
typedef ICommandLine *(*FakeGetCommandLine)();
@@ -51,12 +58,16 @@ typedef ICommandLine *(*FakeGetCommandLine)();
#define TIER0_NAME "libtier0.dylib"
#define VSTDLIB_NAME "libvstdlib.dylib"
#elif defined __linux__
#if SOURCE_ENGINE == SE_EPISODEONE || SOURCE_ENGINE == ORANGEBOX || SOURCE_ENGINE == SE_LEFT4DEAD
#define TIER0_NAME "tier0_i486.so"
#define VSTDLIB_NAME "vstdlib_i486.so"
#else
#if SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_TF2 \
|| SOURCE_ENGINE == SE_SDK2013 || SOURCE_ENGINE == SE_LEFT4DEAD2 || SOURCE_ENGINE == SE_NUCLEARDAWN
#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
@@ -64,53 +75,37 @@ CHalfLife2 g_HL2;
ConVar *sv_lan = NULL;
static void *g_EntList = NULL;
static void **g_pEntInfoList = NULL;
static int entInfoOffset = -1;
namespace SourceHook
static CEntInfo *EntInfoArray()
{
template<>
int HashFunction<datamap_t *>(datamap_t * const &k)
if (g_EntList != NULL)
{
return reinterpret_cast<int>(k);
return (CEntInfo *)((intp)g_EntList + entInfoOffset);
}
template<>
int Compare<datamap_t *>(datamap_t * const &k1, datamap_t * const &k2)
else if (g_pEntInfoList)
{
return (k1-k2);
return *(CEntInfo **)g_pEntInfoList;
}
return NULL;
}
CHalfLife2::CHalfLife2()
{
m_pClasses = sm_trie_create();
m_Maps.init();
m_pGetCommandLine = NULL;
}
CHalfLife2::~CHalfLife2()
{
sm_trie_destroy(m_pClasses);
for (NameHashSet<DataTableInfo *>::iterator iter = m_Classes.iter(); !iter.empty(); iter.next())
delete *iter;
List<DataTableInfo *>::iterator iter;
DataTableInfo *pInfo;
for (iter=m_Tables.begin(); iter!=m_Tables.end(); iter++)
{
pInfo = (*iter);
delete pInfo;
}
m_Tables.clear();
THash<datamap_t *, DataMapTrie>::iterator h_iter;
for (h_iter=m_Maps.begin(); h_iter!=m_Maps.end(); h_iter++)
{
if (h_iter->val.trie)
{
sm_trie_destroy(h_iter->val.trie);
h_iter->val.trie = NULL;
}
}
m_Maps.clear();
for (DataTableMap::iterator iter = m_Maps.iter(); !iter.empty(); iter.next())
delete iter->value;
}
#if SOURCE_ENGINE != SE_DARKMESSIAH
@@ -147,7 +142,7 @@ void CHalfLife2::OnSourceModAllInitialized()
m_HinTextMsg = g_UserMsgs.GetMessageIndex("HintText");
m_SayTextMsg = g_UserMsgs.GetMessageIndex("SayText");
m_VGUIMenu = g_UserMsgs.GetMessageIndex("VGUIMenu");
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
}
void CHalfLife2::OnSourceModAllInitialized_Post()
@@ -158,6 +153,18 @@ void CHalfLife2::OnSourceModAllInitialized_Post()
void CHalfLife2::InitLogicalEntData()
{
#if SOURCE_ENGINE == SE_TF2 \
|| SOURCE_ENGINE == SE_DODS \
|| SOURCE_ENGINE == SE_HL2DM \
|| SOURCE_ENGINE == SE_CSS \
|| SOURCE_ENGINE == SE_SDK2013
if (g_SMAPI->GetServerFactory(false)("VSERVERTOOLS003", nullptr))
{
g_EntList = servertools->GetEntityList();
}
#endif
char *addr = NULL;
/*
@@ -167,108 +174,100 @@ void CHalfLife2::InitLogicalEntData()
* If symbols aren't present (Windows or stripped Linux/Mac),
* attempt find via LevelShutdown + offset
*/
if (g_pGameConf->GetMemSig("gEntList", (void **)&addr))
if (!g_EntList)
{
#if !defined PLATFORM_WINDOWS
if (!addr)
if (g_pGameConf->GetMemSig("gEntList", (void **) &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
}
if (!addr)
{
// Key exists so notify if lookup fails, but try other method.
logger->LogError("Failed lookup of gEntList directly - Reverting to lookup via LevelShutdown");
}
else
{
#endif
g_EntList = reinterpret_cast<void *>(addr);
#if !defined PLATFORM_WINDOWS
}
#endif
}
}
if (!g_EntList)
{
if (!g_pGameConf->GetMemSig("LevelShutdown", (void **)&addr))
if (g_pGameConf->GetMemSig("LevelShutdown", (void **) &addr) && addr)
{
g_Logger.LogError("Logical Entities not supported by this mod (LevelShutdown) - Reverting to networkable entities only");
return;
}
int offset;
if (!g_pGameConf->GetOffset("gEntList", &offset))
{
logger->LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
return;
}
if (!addr)
{
g_Logger.LogError("Failed lookup of LevelShutdown - Reverting to networkable entities only");
return;
}
g_EntList = *reinterpret_cast<void **>(addr + offset);
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_EntList)
// If we have g_EntList from either of the above methods, make sure we can get the offset from it to EntInfo as well
if (g_EntList && !g_pGameConf->GetOffset("EntInfo", &entInfoOffset))
{
g_Logger.LogError("Failed lookup of gEntList - Reverting to networkable entities only");
logger->LogError("Logical Entities not supported by this mod (EntInfo) - Reverting to networkable entities only");
g_EntList = NULL;
return;
}
if (!g_pGameConf->GetOffset("EntInfo", &entInfoOffset))
// If we don't have g_EntList or have it but don't know where EntInfo is on it, use fallback.
if (!g_EntList || entInfoOffset == -1)
{
g_Logger.LogError("Logical Entities not supported by this mod (EntInfo) - Reverting to networkable entities only");
g_pGameConf->GetAddress("EntInfosPtr", (void **)&g_pEntInfoList);
}
if (!g_EntList && !g_pEntInfoList)
{
logger->LogError("Failed lookup of gEntList - Reverting to networkable entities only");
return;
}
}
void CHalfLife2::InitCommandLine()
{
char path[PLATFORM_MAX_PATH];
char error[256];
g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "../bin/" TIER0_NAME);
if (!g_LibSys.IsPathFile(path))
#if SOURCE_ENGINE != SE_DARKMESSIAH
if (!is_original_engine)
{
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))
ke::AutoPtr<ILibrary> lib(g_LibSys.OpenLibrary(TIER0_NAME, error, sizeof(error)));
if (lib == NULL)
{
g_Logger.LogError("Could not find path for: " VSTDLIB_NAME);
logger->LogError("Could not load %s: %s", TIER0_NAME, error);
return;
}
m_pGetCommandLine = lib->GetSymbolAddress("CommandLine_Tier0");
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");
/* '_Tier0' dropped on Alien Swarm version */
if (m_pGetCommandLine == NULL)
{
g_Logger.LogError("Could not locate any command line functionality");
m_pGetCommandLine = lib->GetSymbolAddress("CommandLine");
}
}
else
#endif
{
ke::AutoPtr<ILibrary> lib(g_LibSys.OpenLibrary(VSTDLIB_NAME, error, sizeof(error)));
if (lib == NULL)
{
logger->LogError("Could not load %s: %s", VSTDLIB_NAME, error);
return;
}
lib->CloseLibrary();
m_pGetCommandLine = lib->GetSymbolAddress("CommandLine");
}
if (m_pGetCommandLine == NULL)
{
logger->LogError("Could not locate any command line functionality");
}
}
@@ -290,7 +289,11 @@ bool CHalfLife2::IsOriginalEngine()
#if SOURCE_ENGINE != SE_DARKMESSIAH
IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
{
#if SOURCE_ENGINE == SE_DOTA
return engine->GetChangeAccessor( IndexOfEdict((const edict_t *)this) );
#else
return engine->GetChangeAccessor( (const edict_t *)this );
#endif
}
#endif
@@ -329,11 +332,11 @@ bool UTIL_FindInSendTable(SendTable *pTable,
return false;
}
typedescription_t *UTIL_FindInDataMap(datamap_t *pMap, const char *name)
bool UTIL_FindDataMapInfo(datamap_t *pMap, const char *name, sm_datatable_info_t *pDataTable)
{
while (pMap)
{
for (int i=0; i<pMap->dataNumFields; i++)
for (int i = 0; i < pMap->dataNumFields; ++i)
{
if (pMap->dataDesc[i].fieldName == NULL)
{
@@ -341,21 +344,23 @@ typedescription_t *UTIL_FindInDataMap(datamap_t *pMap, const char *name)
}
if (strcmp(name, pMap->dataDesc[i].fieldName) == 0)
{
return &(pMap->dataDesc[i]);
pDataTable->prop = &(pMap->dataDesc[i]);
pDataTable->actual_offset = GetTypeDescOffs(pDataTable->prop);
return true;
}
if (pMap->dataDesc[i].td)
if (pMap->dataDesc[i].td == NULL || !UTIL_FindDataMapInfo(pMap->dataDesc[i].td, name, pDataTable))
{
typedescription_t *_td;
if ((_td=UTIL_FindInDataMap(pMap->dataDesc[i].td, name)) != NULL)
{
return _td;
}
continue;
}
pDataTable->actual_offset += GetTypeDescOffs(&(pMap->dataDesc[i]));
return true;
}
pMap = pMap->baseMap;
}
return NULL;
return false;
}
ServerClass *CHalfLife2::FindServerClass(const char *classname)
@@ -363,9 +368,7 @@ ServerClass *CHalfLife2::FindServerClass(const char *classname)
DataTableInfo *pInfo = _FindServerClass(classname);
if (!pInfo)
{
return NULL;
}
return pInfo->sc;
}
@@ -373,26 +376,21 @@ ServerClass *CHalfLife2::FindServerClass(const char *classname)
DataTableInfo *CHalfLife2::_FindServerClass(const char *classname)
{
DataTableInfo *pInfo = NULL;
if (!sm_trie_retrieve(m_pClasses, classname, (void **)&pInfo))
if (!m_Classes.retrieve(classname, &pInfo))
{
ServerClass *sc = gamedll->GetAllServerClasses();
while (sc)
{
if (strcmp(classname, sc->GetName()) == 0)
{
pInfo = new DataTableInfo;
pInfo->sc = sc;
sm_trie_insert(m_pClasses, classname, pInfo);
m_Tables.push_back(pInfo);
pInfo = new DataTableInfo(sc);
m_Classes.insert(classname, pInfo);
break;
}
sc = sc->m_pNext;
}
if (!pInfo)
{
return NULL;
}
}
return pInfo;
@@ -401,14 +399,13 @@ DataTableInfo *CHalfLife2::_FindServerClass(const char *classname)
bool CHalfLife2::FindSendPropInfo(const char *classname, const char *offset, sm_sendprop_info_t *info)
{
DataTableInfo *pInfo;
sm_sendprop_info_t *prop;
if ((pInfo = _FindServerClass(classname)) == NULL)
{
return false;
}
if ((prop = pInfo->lookup.retrieve(offset)) == NULL)
if (!pInfo->lookup.retrieve(offset, info))
{
sm_sendprop_info_t temp_info;
@@ -420,10 +417,6 @@ bool CHalfLife2::FindSendPropInfo(const char *classname, const char *offset, sm_
pInfo->lookup.insert(offset, temp_info);
*info = temp_info;
}
else
{
*info = *prop;
}
return true;
}
@@ -442,22 +435,32 @@ SendProp *CHalfLife2::FindInSendTable(const char *classname, const char *offset)
typedescription_t *CHalfLife2::FindInDataMap(datamap_t *pMap, const char *offset)
{
typedescription_t *td = NULL;
DataMapTrie &val = m_Maps[pMap];
if (!val.trie)
sm_datatable_info_t dt_info;
if (!(this->FindDataMapInfo(pMap, offset, &dt_info)))
{
val.trie = sm_trie_create();
return NULL;
}
if (!sm_trie_retrieve(val.trie, offset, (void **)&td))
return dt_info.prop;
}
bool CHalfLife2::FindDataMapInfo(datamap_t *pMap, const char *offset, sm_datatable_info_t *pDataTable)
{
DataTableMap::Insert i = m_Maps.findForAdd(pMap);
if (!i.found())
m_Maps.add(i, pMap, new DataMapCache());
DataMapCache *cache = i->value;
if (!cache->retrieve(offset, pDataTable))
{
if ((td = UTIL_FindInDataMap(pMap, offset)) != NULL)
{
sm_trie_insert(val.trie, offset, td);
}
if (!UTIL_FindDataMapInfo(pMap, offset, pDataTable))
return false;
cache->insert(offset, *pDataTable);
}
return td;
return true;
}
void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
@@ -483,7 +486,9 @@ void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
{
#ifndef USE_PROTOBUF_USERMESSAGES
bf_write *pBitBuf = NULL;
#endif
cell_t players[] = {client};
if (dest == HUD_PRINTTALK)
@@ -496,7 +501,28 @@ 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_DOTA
CUserMsg_SayText *pMsg;
if ((pMsg = (CUserMsg_SayText *)g_UserMsgs.StartProtobufMessage(m_SayTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
{
return false;
}
pMsg->set_client(0);
pMsg->set_text(buffer);
pMsg->set_chat(false);
#elif 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;
}
@@ -504,6 +530,7 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
pBitBuf->WriteByte(0);
pBitBuf->WriteString(buffer);
pBitBuf->WriteByte(1);
#endif
g_UserMsgs.EndMessage();
@@ -511,13 +538,38 @@ 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_DOTA
CUserMsg_TextMsg *pMsg;
if ((pMsg = (CUserMsg_TextMsg *)g_UserMsgs.StartProtobufMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
{
return false;
}
pMsg->set_dest(dest);
pMsg->add_param(msg);
#elif 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();
@@ -526,10 +578,28 @@ 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_DOTA
CUserMsg_HintText *pMsg;
if ((pMsg = (CUserMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
{
return false;
}
pMsg->set_message(msg);
#elif 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;
}
@@ -540,6 +610,7 @@ bool CHalfLife2::HintTextMsg(int client, const char *msg)
pBitBuf->WriteByte(1);
}
pBitBuf->WriteString(msg);
#endif
g_UserMsgs.EndMessage();
return true;
@@ -547,9 +618,26 @@ bool CHalfLife2::HintTextMsg(int client, const char *msg)
bool CHalfLife2::HintTextMsg(cell_t *players, int count, const char *msg)
{
#if SOURCE_ENGINE == SE_DOTA
CUserMsg_HintText *pMsg;
if ((pMsg = (CUserMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, count, USERMSG_RELIABLE)) == NULL)
{
return false;
}
pMsg->set_message(msg);
#elif 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;
}
@@ -560,6 +648,8 @@ bool CHalfLife2::HintTextMsg(cell_t *players, int count, const char *msg)
pBitBuf->WriteByte(1);
}
pBitBuf->WriteString(msg);
#endif
g_UserMsgs.EndMessage();
return true;
@@ -567,15 +657,29 @@ 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_DOTA
CUserMsg_VGUIMenu *pMsg;
if ((pMsg = (CUserMsg_VGUIMenu *)g_UserMsgs.StartProtobufMessage(m_VGUIMenu, players, 1, USERMSG_RELIABLE)) == NULL)
{
return false;
}
#elif 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)
{
@@ -588,6 +692,29 @@ bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, boo
SubKey = data->GetFirstSubKey();
}
#if SOURCE_ENGINE == SE_DOTA
pMsg->set_name(name);
pMsg->set_show(show);
while (SubKey)
{
CUserMsg_VGUIMenu_Keys *key = pMsg->add_keys();
key->set_name(SubKey->GetName());
key->set_value(SubKey->GetString());
SubKey = SubKey->GetNextKey();
}
#elif 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);
@@ -597,6 +724,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;
@@ -630,10 +759,15 @@ void CHalfLife2::ProcessFakeCliCmdQueue()
if (g_Players.GetClientOfUserId(pFake->userid) == pFake->client)
{
CPlayer *pPlayer = g_Players.GetPlayerByIndex(pFake->client);
#if SOURCE_ENGINE == SE_DOTA
engine->ClientCommand(pPlayer->GetIndex(), "%s", pFake->cmd.c_str());
#else
serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), pFake->cmd.c_str());
#endif
}
m_CmdQueue.pop();
m_FreeCmds.push(pFake);
}
}
@@ -728,6 +862,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;
@@ -832,6 +974,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))
@@ -841,7 +988,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;
}
@@ -877,7 +1024,9 @@ CEntInfo *CHalfLife2::LookupEntity(int entIndex)
return NULL;
}
if (!g_EntList || entInfoOffset == -1)
CEntInfo *entInfos = EntInfoArray();
if (!entInfos)
{
/* Attempt to use engine interface instead */
static CEntInfo tempInfo;
@@ -904,8 +1053,7 @@ CEntInfo *CHalfLife2::LookupEntity(int entIndex)
return &tempInfo;
}
CEntInfo *pArray = (CEntInfo *)(((unsigned char *)g_EntList) + entInfoOffset);
return &pArray[entIndex];
return &entInfos[entIndex];
}
/**
@@ -966,6 +1114,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));
@@ -1004,3 +1157,95 @@ 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)
{
CBaseEntity *pGetterEnt = ReferenceToEntity(0);
if (pGetterEnt == NULL)
{
// If we don't have a world entity yet, we'll have to rely on the given entity
pGetterEnt = pEntity;
}
datamap_t *pMap = GetDataMap(pGetterEnt);
sm_datatable_info_t info;
if (!FindDataMapInfo(pMap, "m_iClassname", &info))
{
return NULL;
}
offset = info.actual_offset;
}
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;
}
+47 -10
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.
@@ -35,8 +35,10 @@
#include <sh_list.h>
#include <sh_string.h>
#include <sh_tinyhash.h>
#include <sm_trie_tpl.h>
#include "sm_trie.h"
#include <am-utility.h>
#include <am-hashmap.h>
#include <sm_stringhashmap.h>
#include <sm_namehashset.h>
#include "sm_globals.h"
#include "sm_queue.h"
#include <IGameHelpers.h>
@@ -45,6 +47,9 @@
#include <datamap.h>
#include <ihandleentity.h>
#include <tier0/icommandline.h>
#if SOURCE_ENGINE >= SE_PORTAL2
#include <string_t.h>
#endif
class CCommand;
@@ -56,16 +61,38 @@ using namespace SourceMod;
struct DataTableInfo
{
struct SendPropPolicy
{
static inline bool matches(const char *name, const sm_sendprop_info_t &info)
{
return strcmp(name, info.prop->GetName()) == 0;
}
};
static inline bool matches(const char *name, const DataTableInfo *info)
{
return strcmp(name, info->sc->GetName()) == 0;
}
DataTableInfo(ServerClass *sc)
: sc(sc)
{
}
ServerClass *sc;
KTrie<sm_sendprop_info_t> lookup;
NameHashSet<sm_sendprop_info_t, SendPropPolicy> lookup;
};
struct DataMapTrie
struct DataMapCachePolicy
{
DataMapTrie() : trie(NULL) {}
Trie *trie;
static inline bool matches(const char *name, const sm_datatable_info_t &info)
{
return strcmp(name, info.prop->fieldName) == 0;
}
};
typedef NameHashSet<sm_datatable_info_t, DataMapCachePolicy> DataMapCache;
struct DelayedFakeCliCmd
{
String cmd;
@@ -88,6 +115,7 @@ struct DelayedKickInfo
char buffer[384];
};
// copy from game/shared/entitylist_base.h
class CEntInfo
{
public:
@@ -95,6 +123,10 @@ public:
int m_SerialNumber;
CEntInfo *m_pPrev;
CEntInfo *m_pNext;
#if (SOURCE_ENGINE >= SE_PORTAL2) && (SOURCE_ENGINE != SE_DOTA)
string_t m_iName;
string_t m_iClassName;
#endif
};
class CHalfLife2 :
@@ -115,6 +147,7 @@ public: //IGameHelpers
datamap_t *GetDataMap(CBaseEntity *pEntity);
ServerClass *FindServerClass(const char *classname);
typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset);
bool FindDataMapInfo(datamap_t *pMap, const char *offset, sm_datatable_info_t *pDataTable);
void SetEdictStateChanged(edict_t *pEdict, unsigned short offset);
bool TextMsg(int client, int dest, const char *msg);
bool HintTextMsg(int client, const char *msg);
@@ -138,6 +171,9 @@ public: //IGameHelpers
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();
@@ -157,9 +193,10 @@ private:
void InitLogicalEntData();
void InitCommandLine();
private:
Trie *m_pClasses;
List<DataTableInfo *> m_Tables;
THash<datamap_t *, DataMapTrie> m_Maps;
typedef ke::HashMap<datamap_t *, DataMapCache *, ke::PointerPolicy<datamap_t> > DataTableMap;
NameHashSet<DataTableInfo *> m_Classes;
DataTableMap m_Maps;
int m_MsgTextMsg;
int m_HinTextMsg;
int m_SayTextMsg;
+25 -505
View File
@@ -36,515 +36,35 @@
#include "Logger.h"
#include "LibrarySys.h"
#include "TimerSys.h"
#include "logic_bridge.h"
#include <sourcemod_version.h>
Logger g_Logger;
/**
* :TODO: This should be creating the log folder if it doesn't exist
*/
ConfigResult Logger::OnSourceModConfigChanged(const char *key,
const char *value,
ConfigSource source,
char *error,
size_t maxlength)
{
if (strcasecmp(key, "Logging") == 0)
{
bool state;
if (strcasecmp(value, "on") == 0)
{
state = true;
} else if (strcasecmp(value, "off") == 0) {
state = false;
} else {
UTIL_Format(error, maxlength, "Invalid value: must be \"on\" or \"off\"");
return ConfigResult_Reject;
}
if (source == ConfigSource_Console)
{
state ? EnableLogging() : DisableLogging();
} else {
m_InitialState = state;
}
return ConfigResult_Accept;
} else if (strcasecmp(key, "LogMode") == 0) {
if (strcasecmp(value, "daily") == 0)
{
m_Mode = LoggingMode_Daily;
} else if (strcasecmp(value, "map") == 0) {
m_Mode = LoggingMode_PerMap;
} else if (strcasecmp(value, "game") == 0) {
m_Mode = LoggingMode_Game;
} else {
UTIL_Format(error, maxlength, "Invalid value: must be [daily|map|game]");
return ConfigResult_Reject;
}
return ConfigResult_Accept;
}
return ConfigResult_Ignore;
}
void Logger::OnSourceModStartup(bool late)
{
InitLogger(m_Mode);
}
void Logger::OnSourceModAllShutdown()
{
CloseLogger();
}
void Logger::OnSourceModLevelChange(const char *mapName)
{
MapChange(mapName);
}
void Logger::_NewMapFile()
{
if (!m_Active)
{
return;
}
/* Append "Log file closed" to previous log file */
_CloseFile();
char _filename[256];
int i = 0;
time_t t;
GetAdjustedTime(&t);
tm *curtime = localtime(&t);
while (true)
{
g_SourceMod.BuildPath(Path_SM, _filename, sizeof(_filename), "logs/L%02d%02d%03d.log", curtime->tm_mon + 1, curtime->tm_mday, i);
FILE *fp = fopen(_filename, "r");
if (!fp)
{
break;
}
fclose(fp);
i++;
}
m_NrmFileName.assign(_filename);
FILE *fp = fopen(m_NrmFileName.c_str(), "w");
if (!fp)
{
char error[255];
g_LibSys.GetPlatformError(error, sizeof(error));
LogFatal("[SM] Unexpected fatal logging error (file \"%s\")", m_NrmFileName.c_str());
LogFatal("[SM] Platform returned error: \"%s\"", error);
LogFatal("[SM] Logging has been disabled.");
m_Active = false;
return;
} 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);
fclose(fp);
}
}
void Logger::_CloseFile()
{
if (!m_Active)
{
return;
}
FILE *fp = NULL;
if (!m_NrmFileName.empty())
{
fp = fopen(m_NrmFileName.c_str(), "r+");
if (fp)
{
fseek(fp, 0, SEEK_END);
LogMessage("Log file closed.");
fclose(fp);
}
m_NrmFileName.clear();
}
if (!m_ErrMapStart)
{
return;
}
fp = fopen(m_ErrFileName.c_str(), "r+");
if (fp)
{
fseek(fp, 0, SEEK_END);
LogError("Error log file session closed.");
fclose(fp);
}
m_ErrFileName.clear();
}
void Logger::InitLogger(LoggingMode mode)
{
m_Mode = mode;
m_Active = m_InitialState;
time_t t;
GetAdjustedTime(&t);
tm *curtime = localtime(&t);
m_CurDay = curtime->tm_mday;
char _filename[256];
g_SourceMod.BuildPath(Path_SM, _filename, sizeof(_filename), "logs/errors_%04d%02d%02d.log", curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday);
m_ErrFileName.assign(_filename);
switch (m_Mode)
{
case LoggingMode_PerMap:
{
if (!m_Active)
{
m_DelayedStart = true;
}
break;
}
case LoggingMode_Daily:
{
g_SourceMod.BuildPath(Path_SM, _filename, sizeof(_filename), "logs/L%04d%02d%02d.log", curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday);
m_NrmFileName.assign(_filename);
m_DailyPrintHdr = true;
break;
}
default:
{
/* do nothing... */
break;
}
}
}
void Logger::CloseLogger()
{
_CloseFile();
}
void Logger::LogToOpenFile(FILE *fp, const char *msg, ...)
{
if (!m_Active)
{
return;
}
va_list ap;
va_start(ap, msg);
LogToOpenFileEx(fp, msg, ap);
va_end(ap);
}
void Logger::LogToFileOnly(FILE *fp, const char *msg, ...)
{
if (!m_Active)
{
return;
}
va_list ap;
va_start(ap, msg);
LogToFileOnlyEx(fp, msg, ap);
va_end(ap);
}
void Logger::LogToOpenFileEx(FILE *fp, const char *msg, va_list ap)
{
if (!m_Active)
{
return;
}
char buffer[3072];
UTIL_FormatArgs(buffer, sizeof(buffer), msg, ap);
char date[32];
time_t t;
GetAdjustedTime(&t);
tm *curtime = localtime(&t);
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
fprintf(fp, "L %s: %s\n", date, buffer);
g_SMAPI->ConPrintf("L %s: %s\n", date, buffer);
}
void Logger::LogToFileOnlyEx(FILE *fp, const char *msg, va_list ap)
{
if (!m_Active)
{
return;
}
char buffer[3072];
UTIL_FormatArgs(buffer, sizeof(buffer), msg, ap);
char date[32];
time_t t;
GetAdjustedTime(&t);
tm *curtime = localtime(&t);
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
fprintf(fp, "L %s: %s\n", date, buffer);
fflush(fp);
}
void Logger::LogMessage(const char *vafmt, ...)
{
if (!m_Active)
{
return;
}
if (m_Mode == LoggingMode_Game)
{
va_list ap;
va_start(ap, vafmt);
_PrintToGameLog(vafmt, ap);
va_end(ap);
return;
}
if (m_DelayedStart)
{
m_DelayedStart = false;
_NewMapFile();
}
time_t t;
GetAdjustedTime(&t);
tm *curtime = localtime(&t);
FILE *fp = NULL;
if (m_Mode == LoggingMode_PerMap)
{
fp = fopen(m_NrmFileName.c_str(), "a+");
if (!fp)
{
_NewMapFile();
fp = fopen(m_NrmFileName.c_str(), "a+");
if (!fp)
{
goto print_error;
}
}
} else {
if (m_CurDay != curtime->tm_mday)
{
char _filename[256];
g_SourceMod.BuildPath(Path_SM, _filename, sizeof(_filename), "logs/L%04d%02d%02d.log", curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday);
m_NrmFileName.assign(_filename);
m_CurDay = curtime->tm_mday;
m_DailyPrintHdr = true;
}
fp = fopen(m_NrmFileName.c_str(), "a+");
}
if (fp)
{
if (m_DailyPrintHdr)
{
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);
}
va_list ap;
va_start(ap, vafmt);
LogToOpenFileEx(fp, vafmt, ap);
va_end(ap);
fclose(fp);
} else {
goto print_error;
}
return;
print_error:
char error[255];
g_LibSys.GetPlatformError(error, sizeof(error));
LogFatal("[SM] Unexpected fatal logging error (file \"%s\")", m_NrmFileName.c_str());
LogFatal("[SM] Platform returned error: \"%s\"", error);
LogFatal("[SM] Logging has been disabled.");
m_Active = false;
}
void Logger::LogError(const char *vafmt, ...)
{
va_list ap;
va_start(ap, vafmt);
LogErrorEx(vafmt, ap);
va_end(ap);
}
void Logger::LogErrorEx(const char *vafmt, va_list ap)
{
if (!m_Active)
{
return;
}
time_t t;
GetAdjustedTime(&t);
tm *curtime = localtime(&t);
if (curtime->tm_mday != m_CurDay)
{
char _filename[256];
g_SourceMod.BuildPath(Path_SM, _filename, sizeof(_filename), "logs/errors_%04d%02d%02d.log", curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday);
m_ErrFileName.assign(_filename);
m_CurDay = curtime->tm_mday;
m_ErrMapStart = false;
}
FILE *fp = fopen(m_ErrFileName.c_str(), "a+");
if (fp)
{
if (!m_ErrMapStart)
{
char date[32];
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
fprintf(fp, "L %s: SourceMod error session started\n", date);
fprintf(fp, "L %s: Info (map \"%s\") (file \"errors_%04d%02d%02d.log\")\n", date, m_CurMapName.c_str(), curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday);
m_ErrMapStart = true;
}
LogToOpenFileEx(fp, vafmt, ap);
fclose(fp);
}
else
{
char error[255];
g_LibSys.GetPlatformError(error, sizeof(error));
LogFatal("[SM] Unexpected fatal logging error (file \"%s\")", m_NrmFileName.c_str());
LogFatal("[SM] Platform returned error: \"%s\"", error);
LogFatal("[SM] Logging has been disabled.");
m_Active = false;
return;
}
}
void Logger::MapChange(const char *mapname)
{
m_CurMapName.assign(mapname);
switch (m_Mode)
{
case LoggingMode_Daily:
{
LogMessage("-------- Mapchange to %s --------", mapname);
break;
}
case LoggingMode_PerMap:
{
_NewMapFile();
break;
}
default:
{
/* Do nothing... */
break;
}
}
if (m_ErrMapStart)
{
LogError("Error log file session closed.");
}
m_ErrMapStart = false;
}
void Logger::_PrintToGameLog(const char *fmt, va_list ap)
{
char msg[3072];
size_t len;
len = vsnprintf(msg, sizeof(msg)-2, fmt, ap);
len = (len >= sizeof(msg)) ? (sizeof(msg) - 2) : len;
msg[len++] = '\n';
msg[len] = '\0';
Engine_LogPrintWrapper(msg);
}
const char *Logger::GetLogFileName(LogType type) const
{
switch (type)
{
case LogType_Normal:
{
return m_NrmFileName.c_str();
}
case LogType_Error:
{
return m_ErrFileName.c_str();
}
default:
{
return "";
}
}
}
LoggingMode Logger::GetLoggingMode() const
{
return m_Mode;
}
void Logger::EnableLogging()
{
if (m_Active)
{
return;
}
m_Active = true;
LogMessage("[SM] Logging enabled manually by user.");
}
void Logger::DisableLogging()
{
if (!m_Active)
{
return;
}
LogMessage("[SM] Logging disabled manually by user.");
m_Active = false;
}
void Logger::LogFatal(const char *msg, ...)
{
/* :TODO: make this print all pretty-like
* In fact, the pretty log printing function should be abstracted.
* It's already implemented twice which is bad.
*/
va_list ap;
char path[PLATFORM_MAX_PATH];
g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "sourcemod_fatal.log");
FILE *fp = fopen(path, "at");
if (fp)
{
m_Active = true;
va_start(ap, msg);
LogToOpenFileEx(fp, msg, ap);
va_end(ap);
m_Active = false;
fclose(fp);
}
}
bool g_in_game_log_hook = false;
static LoggerCore g_LoggerCore;
SH_DECL_HOOK1_void(IVEngineServer, LogPrint, SH_NOATTRIB, false, const char *);
static void HookLogPrint(const char *message)
{
g_in_game_log_hook = true;
bool stopped = logicore.OnLogPrint(message);
g_in_game_log_hook = false;
if (stopped)
RETURN_META(MRES_SUPERCEDE);
}
void LoggerCore::OnSourceModStartup(bool late)
{
SH_ADD_HOOK(IVEngineServer, LogPrint, engine, SH_STATIC(HookLogPrint), false);
}
void LoggerCore::OnSourceModAllShutdown()
{
SH_REMOVE_HOOK(IVEngineServer, LogPrint, engine, SH_STATIC(HookLogPrint), false);
}
void Engine_LogPrintWrapper(const char *msg)
{
if (g_in_game_log_hook)
+1 -61
View File
@@ -38,73 +38,13 @@
using namespace SourceHook;
enum LogType
class LoggerCore : public SMGlobalClass
{
LogType_Normal,
LogType_Error
};
enum LoggingMode
{
LoggingMode_Daily,
LoggingMode_PerMap,
LoggingMode_Game
};
class Logger : public SMGlobalClass
{
public:
Logger() : m_Mode(LoggingMode_Daily), m_ErrMapStart(false),
m_Active(false), m_DelayedStart(false), m_DailyPrintHdr(false),
m_InitialState(true)
{
}
public: //SMGlobalClass
ConfigResult OnSourceModConfigChanged(const char *key,
const char *value,
ConfigSource source,
char *error,
size_t maxlength);
void OnSourceModStartup(bool late);
void OnSourceModAllShutdown();
void OnSourceModLevelChange(const char *mapName);
public:
void InitLogger(LoggingMode mode);
void CloseLogger();
void EnableLogging();
void DisableLogging();
void LogMessage(const char *msg, ...);
void LogError(const char *msg, ...);
void LogErrorEx(const char *msg, va_list ap);
void LogFatal(const char *msg, ...);
void LogToOpenFile(FILE *fp, const char *msg, ...);
void LogToOpenFileEx(FILE *fp, const char *msg, va_list ap);
/* This version does not print to console, and is thus thread-safe */
void LogToFileOnly(FILE *fp, const char *msg, ...);
void LogToFileOnlyEx(FILE *fp, const char *msg, va_list ap);
void MapChange(const char *mapname);
const char *GetLogFileName(LogType type) const;
LoggingMode GetLoggingMode() const;
private:
void _CloseFile();
void _NewMapFile();
void _PrintToGameLog(const char *fmt, va_list ap);
private:
String m_NrmFileName;
String m_ErrFileName;
String m_CurMapName;
LoggingMode m_Mode;
int m_CurDay;
bool m_ErrMapStart;
bool m_Active;
bool m_DelayedStart;
bool m_DailyPrintHdr;
bool m_InitialState;
};
void Engine_LogPrintWrapper(const char *msg);
extern bool g_in_game_log_hook;
extern Logger g_Logger;
#endif // _INCLUDE_SOURCEMOD_CLOGGER_H_
+45 -14
View File
@@ -4,9 +4,11 @@
SMSDK = ..
HL2SDK_ORIG = ../../hl2sdk
HL2SDK_OB = ../../hl2sdk-ob
HL2SDK_CSS = ../../hl2sdk-css
HL2SDK_OB_VALVE = ../../hl2sdk-ob-valve
HL2SDK_L4D = ../../hl2sdk-l4d
HL2SDK_L4D2 = ../../hl2sdk-l4d2
HL2SDK_CSGO = ../../hl2sdk-csgo
MMSOURCE = ../../mmsource-central
#####################################
@@ -22,8 +24,8 @@ OBJECTS = AdminCache.cpp CDataPack.cpp ConCmdManager.cpp ConVarManager.cpp CoreC
frame_hooks.cpp concmd_cleaner.cpp NextMap.cpp \
NativeOwner.cpp logic_bridge.cpp ConsoleDetours.cpp
OBJECTS += smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
smn_entities.cpp smn_events.cpp smn_fakenatives.cpp \
smn_filesystem.cpp smn_halflife.cpp \
smn_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
@@ -48,7 +50,7 @@ CPP = gcc
override ENGSET = false
ifneq (,$(filter original orangebox orangeboxvalve left4dead left4dead2,$(ENGINE)))
ifneq (,$(filter original orangebox css orangeboxvalve left4dead left4dead2 csgo,$(ENGINE)))
override ENGSET = true
endif
@@ -68,19 +70,26 @@ ifeq "$(ENGINE)" "orangebox"
INCLUDE += -I$(HL2SDK)/public/game/server
BINARY = sourcemod.2.ep2.so
endif
ifeq "$(ENGINE)" "orangeboxvalve"
HL2SDK = $(HL2SDK_OB_VALVE)
ifeq "$(ENGINE)" "css"
HL2SDK = $(HL2SDK_CSS)
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=6
METAMOD = $(MMSOURCE)/core
INCLUDE += -I$(HL2SDK)/public/game/server
#-I$(HL2SDK)/common
BINARY = sourcemod.2.css.so
endif
ifeq "$(ENGINE)" "orangeboxvalve"
HL2SDK = $(HL2SDK_OB_VALVE)
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=7
METAMOD = $(MMSOURCE)/core
INCLUDE += -I$(HL2SDK)/public/game/server
BINARY = sourcemod.2.ep2v.so
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=7
CFLAGS += -DSOURCE_ENGINE=8
METAMOD = $(MMSOURCE)/core
INCLUDE += -I$(HL2SDK)/public/game/server
BINARY = sourcemod.2.l4d.so
@@ -88,11 +97,19 @@ endif
ifeq "$(ENGINE)" "left4dead2"
HL2SDK = $(HL2SDK_L4D2)
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=8
CFLAGS += -DSOURCE_ENGINE=9
METAMOD = $(MMSOURCE)/core
INCLUDE += -I$(HL2SDK)/public/game/server
BINARY = sourcemod.2.l4d2.so
endif
ifeq "$(ENGINE)" "csgo"
HL2SDK = $(HL2SDK_CSGO)
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=12
METAMOD = $(MMSOURCE)/core
INCLUDE += -I$(HL2SDK)/public/game/server
BINARY = sourcemod.2.csgo.so
endif
HL2PUB = $(HL2SDK)/public
@@ -114,23 +131,37 @@ ifneq (,$(filter original orangebox left4dead,$(ENGINE)))
LIB_SUFFIX = _i486.$(LIB_EXT)
else
LIB_PREFIX = lib
LIB_SUFFIX = .$(LIB_EXT)
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_ORANGEBOXVALVE=6 -DSE_LEFT4DEAD=7 -DSE_LEFT4DEAD2=8 -DSE_ALIENSWARM=9
-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 ###
@@ -168,7 +199,7 @@ all: check
check:
if [ "$(ENGSET)" = "false" ]; then \
echo "You must supply one of the following values for ENGINE:"; \
echo "left4dead2, left4dead, orangeboxvalve, orangebox, or original"; \
echo "csgo, left4dead2, left4dead, orangeboxvalve, css, orangebox, or original"; \
exit 1; \
fi
+10 -12
View File
@@ -38,8 +38,6 @@
#include "sourcemm_api.h"
#include "PlayerManager.h"
#include "MenuStyle_Valve.h"
#include "ShareSys.h"
#include "HandleSys.h"
#include "sourcemm_api.h"
#include "logic_bridge.h"
@@ -56,24 +54,24 @@ MenuManager::MenuManager()
void MenuManager::OnSourceModAllInitialized()
{
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
HandleAccess access;
g_HandleSys.InitAccessDefaults(NULL, &access);
handlesys->InitAccessDefaults(NULL, &access);
/* Deny cloning to menus */
access.access[HandleAccess_Clone] = HANDLE_RESTRICT_OWNER|HANDLE_RESTRICT_IDENTITY;
m_MenuType = g_HandleSys.CreateType("IBaseMenu", this, 0, NULL, &access, g_pCoreIdent, NULL);
m_MenuType = handlesys->CreateType("IBaseMenu", this, 0, NULL, &access, g_pCoreIdent, NULL);
/* Also deny deletion to styles */
access.access[HandleAccess_Delete] = HANDLE_RESTRICT_OWNER|HANDLE_RESTRICT_IDENTITY;
m_StyleType = g_HandleSys.CreateType("IMenuStyle", this, 0, NULL, &access, g_pCoreIdent, NULL);
m_StyleType = handlesys->CreateType("IMenuStyle", this, 0, NULL, &access, g_pCoreIdent, NULL);
}
void MenuManager::OnSourceModAllShutdown()
{
g_HandleSys.RemoveType(m_MenuType, g_pCoreIdent);
g_HandleSys.RemoveType(m_StyleType, g_pCoreIdent);
handlesys->RemoveType(m_MenuType, g_pCoreIdent);
handlesys->RemoveType(m_StyleType, g_pCoreIdent);
}
void MenuManager::OnHandleDestroy(HandleType_t type, void *object)
@@ -112,7 +110,7 @@ Handle_t MenuManager::CreateMenuHandle(IBaseMenu *menu, IdentityToken_t *pOwner)
return BAD_HANDLE;
}
return g_HandleSys.CreateHandle(m_MenuType, menu, pOwner, g_pCoreIdent, NULL);
return handlesys->CreateHandle(m_MenuType, menu, pOwner, g_pCoreIdent, NULL);
}
Handle_t MenuManager::CreateStyleHandle(IMenuStyle *style)
@@ -122,7 +120,7 @@ Handle_t MenuManager::CreateStyleHandle(IMenuStyle *style)
return BAD_HANDLE;
}
return g_HandleSys.CreateHandle(m_StyleType, style, g_pCoreIdent, g_pCoreIdent, NULL);
return handlesys->CreateHandle(m_StyleType, style, g_pCoreIdent, g_pCoreIdent, NULL);
}
HandleError MenuManager::ReadMenuHandle(Handle_t handle, IBaseMenu **menu)
@@ -132,7 +130,7 @@ HandleError MenuManager::ReadMenuHandle(Handle_t handle, IBaseMenu **menu)
sec.pIdentity = g_pCoreIdent;
sec.pOwner = NULL;
return g_HandleSys.ReadHandle(handle, m_MenuType, &sec, (void **)menu);
return handlesys->ReadHandle(handle, m_MenuType, &sec, (void **)menu);
}
HandleError MenuManager::ReadStyleHandle(Handle_t handle, IMenuStyle **style)
@@ -142,7 +140,7 @@ HandleError MenuManager::ReadStyleHandle(Handle_t handle, IMenuStyle **style)
sec.pIdentity = g_pCoreIdent;
sec.pOwner = g_pCoreIdent;
return g_HandleSys.ReadHandle(handle, m_StyleType, &sec, (void **)style);
return handlesys->ReadHandle(handle, m_StyleType, &sec, (void **)style);
}
bool MenuManager::SetDefaultStyle(IMenuStyle *style)
-1
View File
@@ -37,7 +37,6 @@
#include <sh_stack.h>
#include <sh_list.h>
#include <sh_string.h>
#include "sm_memtable.h"
#include "sm_globals.h"
using namespace SourceMod;
+34 -46
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.
@@ -34,11 +34,12 @@
#include "MenuStyle_Base.h"
#include "PlayerManager.h"
#include "MenuManager.h"
#include "HandleSys.h"
#include "CellRecipientFilter.h"
#if defined MENU_DEBUG
#include "Logger.h"
#endif
#include "logic_bridge.h"
#include "AutoHandleRooter.h"
BaseMenuStyle::BaseMenuStyle() : m_WatchList(256), m_hHandle(BAD_HANDLE)
{
@@ -322,15 +323,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_SDK2013 || SOURCE_ENGINE == SE_TF2
0,
#endif
&pos);
}
}
@@ -594,7 +604,7 @@ bool BaseMenuStyle::RedoClientMenu(int client, ItemOrder order)
}
CBaseMenu::CBaseMenu(IMenuHandler *pHandler, IMenuStyle *pStyle, IdentityToken_t *pOwner) :
m_pStyle(pStyle), m_Strings(512), m_Pagination(7), m_bShouldDelete(false), m_bCancelling(false),
m_pStyle(pStyle), m_Pagination(7), m_bShouldDelete(false), m_bCancelling(false),
m_pOwner(pOwner ? pOwner : g_pCoreIdent), m_bDeleting(false), m_bWillFreeHandle(false),
m_hHandle(BAD_HANDLE), m_pHandler(pHandler), m_nFlags(MENUFLAG_BUTTON_EXIT)
{
@@ -617,94 +627,74 @@ Handle_t CBaseMenu::GetHandle()
bool CBaseMenu::AppendItem(const char *info, const ItemDrawInfo &draw)
{
if (m_Pagination == (unsigned)MENU_NO_PAGINATION
&& m_items.size() >= m_pStyle->GetMaxPageItems())
&& m_items.length() >= m_pStyle->GetMaxPageItems())
{
return false;
}
CItem item;
item.infoString = m_Strings.AddString(info);
item.info = info;
if (draw.display)
{
item.displayString = m_Strings.AddString(draw.display);
}
item.display = new ke::AString(draw.display);
item.style = draw.style;
m_items.push_back(item);
m_items.append(ke::Move(item));
return true;
}
bool CBaseMenu::InsertItem(unsigned int position, const char *info, const ItemDrawInfo &draw)
{
if (m_Pagination == (unsigned)MENU_NO_PAGINATION
&& m_items.size() >= m_pStyle->GetMaxPageItems())
if (m_Pagination == (unsigned)MENU_NO_PAGINATION &&
m_items.length() >= m_pStyle->GetMaxPageItems())
{
return false;
}
if (position >= m_items.size())
{
if (position >= m_items.length())
return false;
}
CItem item;
item.infoString = m_Strings.AddString(info);
item.info = info;
if (draw.display)
{
item.displayString = m_Strings.AddString(draw.display);
}
item.display = new ke::AString(draw.display);
item.style = draw.style;
CVector<CItem>::iterator iter = m_items.iterAt(position);
m_items.insert(iter, item);
m_items.insert(position, ke::Move(item));
return true;
}
bool CBaseMenu::RemoveItem(unsigned int position)
{
if (position >= m_items.size())
{
if (position >= m_items.length())
return false;
}
m_items.erase(m_items.iterAt(position));
if (m_items.size() == 0)
{
m_Strings.Reset();
}
m_items.remove(position);
return true;
}
void CBaseMenu::RemoveAllItems()
{
m_items.clear();
m_Strings.Reset();
}
const char *CBaseMenu::GetItemInfo(unsigned int position, ItemDrawInfo *draw/* =NULL */)
{
if (position >= m_items.size())
{
if (position >= m_items.length())
return NULL;
}
if (draw)
{
draw->display = m_Strings.GetString(m_items[position].displayString);
draw->display = m_items[position].display->chars();
draw->style = m_items[position].style;
}
return m_Strings.GetString(m_items[position].infoString);
return m_items[position].info.chars();
}
unsigned int CBaseMenu::GetItemCount()
{
return m_items.size();
return m_items.length();
}
bool CBaseMenu::SetPagination(unsigned int itemsPerPage)
@@ -737,12 +727,12 @@ IMenuStyle *CBaseMenu::GetDrawStyle()
void CBaseMenu::SetDefaultTitle(const char *message)
{
m_Title.assign(message);
m_Title = message;
}
const char *CBaseMenu::GetDefaultTitle()
{
return m_Title.c_str();
return m_Title.chars();
}
void CBaseMenu::Cancel()
@@ -809,7 +799,7 @@ void CBaseMenu::InternalDelete()
m_hHandle = BAD_HANDLE;
m_bDeleting = true;
g_HandleSys.FreeHandle(hndl, &sec);
handlesys->FreeHandle(hndl, &sec);
}
m_pHandler->OnMenuDestroy(this);
@@ -834,7 +824,5 @@ IMenuHandler *CBaseMenu::GetHandler()
unsigned int CBaseMenu::GetBaseMemUsage()
{
return m_Title.size()
+ m_Strings.GetMemTable()->GetMemUsage()
+ (m_items.size() * sizeof(CItem));
return m_Title.length() + (m_items.length() * sizeof(CItem));
}
+27 -12
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.
@@ -34,29 +34,45 @@
#include <IMenuManager.h>
#include <IPlayerHelpers.h>
#include <sh_string.h>
#include <sh_vector.h>
#include "sm_memtable.h"
#include <am-string.h>
#include <am-vector.h>
#include "sm_fastlink.h"
using namespace SourceMod;
using namespace SourceHook;
class CItem
{
public:
CItem()
{
infoString = -1;
displayString = -1;
style = 0;
access = 0;
}
CItem(ke::Moveable<CItem> other)
: info(ke::Move(other->info)),
display(ke::Move(other->display))
{
style = other->style;
access = other->access;
}
CItem & operator =(ke::Moveable<CItem> other)
{
info = ke::Move(other->info);
display = ke::Move(other->display);
style = other->style;
access = other->access;
return *this;
}
public:
int infoString;
int displayString;
ke::AString info;
ke::AutoPtr<ke::AString> display;
unsigned int style;
unsigned int access;
private:
CItem(const CItem &other) KE_DELETE;
CItem &operator =(const CItem &other) KE_DELETE;
};
class CBaseMenuPlayer
@@ -139,11 +155,10 @@ public:
private:
void InternalDelete();
protected:
String m_Title;
ke::AString m_Title;
IMenuStyle *m_pStyle;
BaseStringTable m_Strings;
unsigned int m_Pagination;
CVector<CItem> m_items;
ke::Vector<CItem> m_items;
bool m_bShouldDelete;
bool m_bCancelling;
IdentityToken_t *m_pOwner;
+81 -17
View File
@@ -39,12 +39,28 @@
#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;
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];
@@ -67,6 +83,10 @@ void CRadioStyle::OnSourceModLevelChange(const char *mapName)
}
g_bRadioInit = true;
// Always register the style. Use IsSupported() to check for validity before use.
g_Menus.AddStyle(this);
const char *msg = g_pGameConf->GetKeyValue("HudRadioMenuMsg");
if (!msg || msg[0] == '\0')
{
@@ -90,7 +110,18 @@ void CRadioStyle::OnSourceModLevelChange(const char *mapName)
g_RadioMenuTimeout = 0;
}
g_Menus.AddStyle(this);
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.SetDefaultStyle(this);
g_UserMsgs.HookUserMessage(g_ShowMenuId, this, false);
@@ -110,7 +141,11 @@ void CRadioStyle::OnSourceModShutdown()
bool CRadioStyle::IsSupported()
{
#if SOURCE_ENGINE == SE_DOTA
return false;
#else
return (g_ShowMenuId != -1);
#endif
}
bool CRadioStyle::OnClientCommand(int client, const char *cmdname, const CCommand &cmd)
@@ -135,13 +170,23 @@ 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
{
#if SOURCE_ENGINE != SE_DOTA
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;
@@ -149,6 +194,7 @@ void CRadioStyle::OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFil
{
g_last_clients[g_last_client_count++] = pFilter->GetRecipientIndex(i);
}
#endif
}
void CRadioStyle::OnUserMessageSent(int msg_id)
@@ -189,7 +235,7 @@ IBaseMenu *CRadioStyle::CreateMenu(IMenuHandler *pHandler, IdentityToken_t *pOwn
unsigned int CRadioStyle::GetMaxPageItems()
{
return 10;
return s_RadioMaxPageItems;
}
const char *CRadioStyle::GetStyleName()
@@ -218,15 +264,6 @@ CRadioDisplay *CRadioStyle::MakeRadioDisplay(CRadioMenu *menu)
return display;
}
IMenuPanel *CRadioStyle::MakeRadioDisplay(const char *str, int keys)
{
CRadioDisplay *pPanel = MakeRadioDisplay(NULL);
pPanel->DirectSet(str, keys);
return pPanel;
}
void CRadioStyle::FreeRadioDisplay(CRadioDisplay *display)
{
m_FreeDisplays.push(display);
@@ -293,11 +330,12 @@ void CRadioDisplay::Reset()
keys = 0;
}
void CRadioDisplay::DirectSet(const char *str, int keymap)
bool CRadioDisplay::DirectSet(const char *str)
{
m_Title.clear();
m_BufferText.assign(str);
keys = keymap;
return true;
}
unsigned int CRadioDisplay::GetCurrentKey()
@@ -307,7 +345,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;
}
@@ -343,7 +381,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;
}
@@ -436,7 +474,8 @@ void CRadioMenuPlayer::Radio_Init(int keys, const char *title, const char *text)
void CRadioMenuPlayer::Radio_Refresh()
{
cell_t players[1] = {m_index};
#if SOURCE_ENGINE != SE_DOTA
cell_t players[1] = { (cell_t)m_index };
char *ptr = display_pkt;
char save = 0;
size_t len = display_len;
@@ -452,6 +491,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)
@@ -459,7 +507,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 );
@@ -476,8 +525,10 @@ void CRadioMenuPlayer::Radio_Refresh()
break;
}
}
#endif
display_last_refresh = gpGlobals->curtime;
#endif // !DOTA
}
int CRadioDisplay::GetAmountRemaining()
@@ -511,6 +562,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)
@@ -544,6 +596,7 @@ bool CRadioMenu::DisplayAtItem(int client,
return false;
}
AutoHandleRooter ahr(this->GetHandle());
return g_RadioMenuStyle.DoClientMenu(client,
this,
start_item,
@@ -551,6 +604,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);
+14 -5
View File
@@ -37,10 +37,12 @@
#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>
#include "logic/common_logic.h"
#include "AutoHandleRooter.h"
using namespace SourceMod;
@@ -65,7 +67,11 @@ private:
class CRadioStyle :
public BaseMenuStyle,
public SMGlobalClass,
public IUserMessageListener
#ifdef USE_PROTOBUF_USERMESSAGES
public IProtobufUserMessageListener
#else
public IBitBufUserMessageListener
#endif
{
public:
CRadioStyle();
@@ -84,7 +90,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();
@@ -93,7 +103,6 @@ public:
CRadioDisplay *MakeRadioDisplay(CRadioMenu *menu=NULL);
void FreeRadioDisplay(CRadioDisplay *display);
CRadioMenuPlayer *GetRadioMenuPlayer(int client);
IMenuPanel *MakeRadioDisplay(const char *str, int keys);
private:
CRadioMenuPlayer *m_players;
CStack<CRadioDisplay *> m_FreeDisplays;
@@ -121,8 +130,7 @@ public: //IMenuPanel
bool SetCurrentKey(unsigned int key);
int GetAmountRemaining();
unsigned int GetApproxMemUsage();
public:
void DirectSet(const char *str, int keymap);
bool DirectSet(const char *str);
private:
String m_BufferText;
String m_Title;
@@ -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();
};
+7 -2
View File
@@ -65,16 +65,20 @@ bool ValveMenuStyle::OnClientCommand(int client, const char *cmdname, const CCom
void ValveMenuStyle::OnSourceModAllInitialized()
{
#if SOURCE_ENGINE != SE_DOTA
g_Players.AddClientListener(this);
SH_ADD_HOOK_MEMFUNC(IServerPluginHelpers, CreateMessage, serverpluginhelpers, this, &ValveMenuStyle::HookCreateMessage, false);
SH_ADD_HOOK(IServerPluginHelpers, CreateMessage, serverpluginhelpers, SH_MEMBER(this, &ValveMenuStyle::HookCreateMessage), false);
g_pSPHCC = SH_GET_CALLCLASS(serverpluginhelpers);
#endif
}
void ValveMenuStyle::OnSourceModShutdown()
{
#if SOURCE_ENGINE != SE_DOTA
SH_RELEASE_CALLCLASS(g_pSPHCC);
SH_REMOVE_HOOK_MEMFUNC(IServerPluginHelpers, CreateMessage, serverpluginhelpers, this, &ValveMenuStyle::HookCreateMessage, false);
SH_REMOVE_HOOK(IServerPluginHelpers, CreateMessage, serverpluginhelpers, SH_MEMBER(this, &ValveMenuStyle::HookCreateMessage), false);
g_Players.RemoveClientListener(this);
#endif
}
void ValveMenuStyle::HookCreateMessage(edict_t *pEdict,
@@ -404,6 +408,7 @@ bool CValveMenu::DisplayAtItem(int client,
return false;
}
AutoHandleRooter ahr(this->GetHandle());
return g_ValveMenuStyle.DoClientMenu(client, this, start_item, alt_handler ? alt_handler : m_pHandler, time);
}
+4
View File
@@ -39,6 +39,8 @@
#include "KeyValues.h"
#include "sm_fastlink.h"
#include <compat_wrappers.h>
#include "logic/common_logic.h"
#include "AutoHandleRooter.h"
using namespace SourceMod;
@@ -75,6 +77,7 @@ public: //IMenuStyle
IBaseMenu *CreateMenu(IMenuHandler *pHandler, IdentityToken_t *pOwner);
unsigned int GetMaxPageItems();
unsigned int GetApproxMemUsage();
bool IsSupported() { return true; }
private:
void HookCreateMessage(edict_t *pEdict, DIALOG_TYPE type, KeyValues *kv, IServerPluginCallbacks *plugin);
private:
@@ -105,6 +108,7 @@ public:
bool SetCurrentKey(unsigned int key);
int GetAmountRemaining();
unsigned int GetApproxMemUsage();
bool DirectSet(const char *str) { return false; }
private:
KeyValues *m_pKv;
unsigned int m_NextPos;
+2 -2
View File
@@ -518,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;
@@ -560,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);
}
}
}
-144
View File
@@ -1,144 +0,0 @@
#include "NativeOwner.h"
#include "ShareSys.h"
#include "PluginSys.h"
CNativeOwner::CNativeOwner() : m_nMarkSerial(0)
{
}
void CNativeOwner::SetMarkSerial(unsigned int serial)
{
m_nMarkSerial = serial;
}
unsigned int CNativeOwner::GetMarkSerial()
{
return m_nMarkSerial;
}
void CNativeOwner::AddDependent(CPlugin *pPlugin)
{
m_Dependents.push_back(pPlugin);
}
void CNativeOwner::AddWeakRef(const WeakNative & ref)
{
m_WeakRefs.push_back(ref);
}
void CNativeOwner::AddNatives(const sp_nativeinfo_t *natives)
{
NativeEntry *pEntry;
for (unsigned int i = 0; natives[i].func != NULL && natives[i].name != NULL; i++)
{
if ((pEntry = g_ShareSys.AddNativeToCache(this, &natives[i])) == NULL)
{
continue;
}
m_Natives.push_back(pEntry);
}
}
void CNativeOwner::PropogateMarkSerial(unsigned int serial)
{
CNativeOwner *pOwner;
List<CPlugin *>::iterator iter;
for (iter = m_Dependents.begin();
iter != m_Dependents.end();
iter++)
{
pOwner = (*iter);
pOwner->SetMarkSerial(serial);
}
}
void CNativeOwner::UnbindWeakRef(const WeakNative & ref)
{
sp_native_t *native;
IPluginContext *pContext;
pContext = ref.pl->GetBaseContext();
if ((pContext->GetNativeByIndex(ref.idx, &native)) == SP_ERROR_NONE)
{
/* If there is no reference, the native must be unbound */
if (ref.entry == NULL)
{
native->status = SP_NATIVE_UNBOUND;
native->pfn = NULL;
}
/* If we've cached a reference, it's a core native we can
* rebind back to its original (this was a replacement).
*/
else
{
native->pfn = ref.entry->func;
}
}
}
void CNativeOwner::DropEverything()
{
NativeEntry *pEntry;
List<WeakNative>::iterator iter;
List<NativeEntry *>::iterator ntv_iter;
/* Unbind and remove all weak references to us */
iter = m_WeakRefs.begin();
while (iter != m_WeakRefs.end())
{
UnbindWeakRef((*iter));
iter = m_WeakRefs.erase(iter);
}
/* Unmark our replacement natives */
ntv_iter = m_ReplacedNatives.begin();
while (ntv_iter != m_ReplacedNatives.end())
{
pEntry = (*ntv_iter);
pEntry->replacement.func = NULL;
pEntry->replacement.owner = NULL;
ntv_iter = m_ReplacedNatives.erase(ntv_iter);
}
/* Strip all of our natives from the cache */
ntv_iter = m_Natives.begin();
while (ntv_iter != m_Natives.end())
{
g_ShareSys.ClearNativeFromCache(this, (*ntv_iter)->name);
ntv_iter = m_Natives.erase(ntv_iter);
}
}
void CNativeOwner::DropWeakRefsTo(CPlugin *pPlugin)
{
List<WeakNative>::iterator iter;
iter = m_WeakRefs.begin();
while (iter != m_WeakRefs.end())
{
WeakNative & ref = (*iter);
if (ref.pl == pPlugin)
{
iter = m_WeakRefs.erase(iter);
}
else
{
iter++;
}
}
}
void CNativeOwner::DropRefsTo(CPlugin *pPlugin)
{
m_Dependents.remove(pPlugin);
DropWeakRefsTo(pPlugin);
}
void CNativeOwner::AddReplacedNative(NativeEntry *pEntry)
{
m_ReplacedNatives.push_back(pEntry);
}
-59
View File
@@ -1,59 +0,0 @@
#ifndef _INCLUDE_SOURCEMOD_NATIVE_OWNER_H_
#define _INCLUDE_SOURCEMOD_NATIVE_OWNER_H_
#include <sp_vm_types.h>
#include <sh_list.h>
class CPlugin;
struct NativeEntry;
struct WeakNative
{
WeakNative(CPlugin *plugin, uint32_t index) :
pl(plugin), idx(index), entry(NULL)
{
pl = plugin;
idx = index;
}
WeakNative(CPlugin *plugin, uint32_t index, NativeEntry *pEntry) :
pl(plugin), idx(index), entry(pEntry)
{
pl = plugin;
idx = index;
}
CPlugin *pl;
uint32_t idx;
NativeEntry *entry;
};
using namespace SourceHook;
class CNativeOwner
{
public:
CNativeOwner();
public:
virtual void DropEverything();
public:
void AddNatives(const sp_nativeinfo_t *info);
public:
void SetMarkSerial(unsigned int serial);
unsigned int GetMarkSerial();
void PropogateMarkSerial(unsigned int serial);
public:
void AddDependent(CPlugin *pPlugin);
void AddWeakRef(const WeakNative & ref);
void DropRefsTo(CPlugin *pPlugin);
void AddReplacedNative(NativeEntry *pEntry);
private:
void DropWeakRefsTo(CPlugin *pPlugin);
void UnbindWeakRef(const WeakNative & ref);
protected:
List<CPlugin *> m_Dependents;
unsigned int m_nMarkSerial;
List<WeakNative> m_WeakRefs;
List<NativeEntry *> m_Natives;
List<NativeEntry *> m_ReplacedNatives;
};
#endif //_INCLUDE_SOURCEMOD_NATIVE_OWNER_H_
+20 -13
View File
@@ -31,10 +31,12 @@
#include "NextMap.h"
#include "Logger.h"
#include "HalfLife2.h"
#include "sourcemm_api.h"
#include "sm_stringutil.h"
#include "sourcehook.h"
#include "sm_srvcmds.h"
#include "logic_bridge.h"
NextMapManager g_NextMap;
@@ -44,7 +46,9 @@ SH_DECL_HOOK2_void(IVEngineServer, ChangeLevel, SH_NOATTRIB, 0, const char *, co
SH_DECL_HOOK4_void(IVEngineServer, ChangeLevel, SH_NOATTRIB, 0, const char *, const char *, const char *, bool);
#endif
#if SOURCE_ENGINE >= SE_ORANGEBOX
#if SOURCE_ENGINE == SE_DOTA
SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
#elif SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
#elif SOURCE_ENGINE == SE_DARKMESSIAH
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
@@ -68,13 +72,13 @@ void NextMapManager::OnSourceModAllInitialized_Post()
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_ADD_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
#else
SH_ADD_HOOK_MEMFUNC(IVEngineServer, ChangeLevel, engine, this, &NextMapManager::HookChangeLevel, false);
SH_ADD_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
#endif
ConCommand *pCmd = FindCommand("changelevel");
if (pCmd != NULL)
{
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pCmd, CmdChangeLevelCallback, false);
SH_ADD_HOOK(ConCommand, Dispatch, pCmd, SH_STATIC(CmdChangeLevelCallback), false);
changeLevelCmd = pCmd;
}
}
@@ -84,12 +88,12 @@ void NextMapManager::OnSourceModShutdown()
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_REMOVE_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
#else
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, ChangeLevel, engine, this, &NextMapManager::HookChangeLevel, false);
SH_REMOVE_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
#endif
if (changeLevelCmd != NULL)
{
SH_REMOVE_HOOK_STATICFUNC(ConCommand, Dispatch, changeLevelCmd, CmdChangeLevelCallback, false);
SH_REMOVE_HOOK(ConCommand, Dispatch, changeLevelCmd, SH_STATIC(CmdChangeLevelCallback), false);
}
SourceHook::List<MapChangeData *>::iterator iter;
@@ -109,7 +113,7 @@ const char *NextMapManager::GetNextMap()
bool NextMapManager::SetNextMap(const char *map)
{
if (!engine->IsMapValid(map))
if (!g_HL2.IsMapValid(map))
{
return false;
}
@@ -127,18 +131,18 @@ void NextMapManager::HookChangeLevel(const char *map, const char *unknown, const
{
if (g_forcedChange)
{
g_Logger.LogMessage("[SM] Changed map to \"%s\"", map);
logger->LogMessage("[SM] Changed map to \"%s\"", map);
RETURN_META(MRES_IGNORED);
}
const char *newmap = sm_nextmap.GetString();
if (newmap[0] == 0 || !engine->IsMapValid(newmap))
if (newmap[0] == 0 || !g_HL2.IsMapValid(newmap))
{
RETURN_META(MRES_IGNORED);
}
g_Logger.LogMessage("[SM] Changed map to \"%s\"", newmap);
logger->LogMessage("[SM] Changed map to \"%s\"", newmap);
UTIL_Format(m_tempChangeInfo.m_mapName, sizeof(m_tempChangeInfo.m_mapName), newmap);
UTIL_Format(m_tempChangeInfo.m_changeReason, sizeof(m_tempChangeInfo.m_changeReason), "Normal level change");
@@ -183,14 +187,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;
@@ -204,7 +208,10 @@ NextMapManager::NextMapManager()
m_mapHistory = SourceHook::List<MapChangeData *>();
}
#if SOURCE_ENGINE >= SE_ORANGEBOX
#if SOURCE_ENGINE == SE_DOTA
void CmdChangeLevelCallback(const CCommandContext &context, const CCommand &command)
{
#elif SOURCE_ENGINE >= SE_ORANGEBOX
void CmdChangeLevelCallback(const CCommand &command)
{
#else
+7 -3
View File
@@ -53,12 +53,14 @@ struct MapChangeData
startTime = 0;
}
char m_mapName[32];
char m_mapName[PLATFORM_MAX_PATH];
char m_changeReason[100];
time_t startTime;
};
#if SOURCE_ENGINE >= SE_ORANGEBOX
#if SOURCE_ENGINE == SE_DOTA
void CmdChangeLevelCallback(const CCommandContext &context, const CCommand &command);
#elif SOURCE_ENGINE >= SE_ORANGEBOX
void CmdChangeLevelCallback(const CCommand &command);
#else
void CmdChangeLevelCallback();
@@ -69,7 +71,9 @@ class NextMapManager : public SMGlobalClass
public:
NextMapManager();
#if SOURCE_ENGINE >= SE_ORANGEBOX
#if SOURCE_ENGINE == SE_DOTA
friend void CmdChangeLevelCallback(const CCommandContext &context, const CCommand &command);
#elif SOURCE_ENGINE >= SE_ORANGEBOX
friend void CmdChangeLevelCallback(const CCommand &command);
#else
friend void CmdChangeLevelCallback();
+784 -134
View File
File diff suppressed because it is too large Load Diff
+48 -8
View File
@@ -41,8 +41,11 @@
#include <sh_string.h>
#include <sh_list.h>
#include <sh_vector.h>
#include <am-string.h>
#include "ConVarManager.h"
#include <steam/steamclientpublic.h>
using namespace SourceHook;
#define PLAYER_LIFE_UNKNOWN 0
@@ -56,7 +59,7 @@ union serial_t
uint32_t value;
struct
{
uint8_t index;
uint32_t index : 8;
uint32_t serial : 24;
} bits;
};
@@ -69,7 +72,12 @@ public:
public:
const char *GetName();
const char *GetIPAddress();
const char *GetAuthString();
const char *GetAuthString(bool validated = true);
unsigned int GetSteamAccountID(bool validated = true);
const CSteamID &GetSteamId(bool validated = true);
uint64_t GetSteamId64(bool validated = true) { return GetSteamId(validated).ConvertToUint64(); }
const char *GetSteam2Id(bool validated = true);
const char *GetSteam3Id(bool validated = true);
edict_t *GetEdict();
bool IsInGame();
bool WasCountedAsInGame();
@@ -89,6 +97,9 @@ public:
bool RunAdminCacheChecks();
void NotifyPostAdminChecks();
unsigned int GetSerial();
int GetIndex() const;
void PrintToConsole(const char *pMsg);
void ClearAdmin();
public:
void DoBasicAdminChecks();
void MarkAsBeingKicked();
@@ -99,9 +110,11 @@ private:
void Disconnect();
void SetName(const char *name);
void DumpAdmin(bool deleting);
void Authorize(const char *auth);
void UpdateAuthIds();
void Authorize();
void Authorize_Post();
void DoPostConnectAuthorization();
bool IsAuthStringValidated();
private:
bool m_IsConnected;
bool m_IsInGame;
@@ -110,7 +123,9 @@ private:
String m_Name;
String m_Ip;
String m_IpNoPort;
String m_AuthID;
ke::AString m_AuthID;
ke::AString m_Steam2Id;
ke::AString m_Steam3Id;
AdminId m_Admin;
bool m_TempAdmin;
edict_t *m_pEdict;
@@ -124,6 +139,10 @@ private:
bool m_bIsSourceTV;
bool m_bIsReplay;
serial_t m_Serial;
CSteamID m_SteamId;
#if SOURCE_ENGINE == SE_CSGO
QueryCvarCookie_t m_LanguageCookie;
#endif
};
class PlayerManager :
@@ -143,9 +162,17 @@ public: //SMGlobalClass
public:
CPlayer *GetPlayerByIndex(int client) const;
void RunAuthChecks();
void ClearAdminId(AdminId id);
void ClearAllAdmins();
public:
#if SOURCE_ENGINE == SE_DOTA
bool OnClientConnect(CEntityIndex index, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
bool OnClientConnect_Post(CEntityIndex index, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
void OnClientPutInServer(CEntityIndex index, char const *playername);
void OnClientDisconnect(CEntityIndex index, int reason);
void OnClientDisconnect_Post(CEntityIndex index, int reason);
void OnClientCommand(CEntityIndex index, const CCommand &args);
void OnClientSettingsChanged(CEntityIndex index);
//void OnClientSettingsChanged_Pre(CEntityIndex client);
#else
bool OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
bool OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
void OnClientPutInServer(edict_t *pEntity, char const *playername);
@@ -158,6 +185,8 @@ public:
#endif
void OnClientSettingsChanged(edict_t *pEntity);
//void OnClientSettingsChanged_Pre(edict_t *pEntity);
#endif
void OnServerHibernationUpdate(bool bHibernating);
public: //IPlayerManager
void AddClientListener(IClientListener *listener);
void RemoveClientListener(IClientListener *listener);
@@ -173,6 +202,8 @@ public: //IPlayerManager
void UnregisterCommandTargetProcessor(ICommandTargetProcessor *pHandler);
void ProcessCommandTarget(cmd_target_info_t *info);
int GetClientFromSerial(unsigned int serial);
void ClearAdminId(AdminId id);
void RecheckAnyAdmins();
public:
inline int MaxClients()
{
@@ -189,12 +220,18 @@ public:
bool CheckSetAdmin(int index, CPlayer *pPlayer, AdminId id);
bool CheckSetAdminName(int index, CPlayer *pPlayer, AdminId id);
const char *GetPassInfoVar();
void RecheckAnyAdmins();
unsigned int GetReplyTo();
unsigned int SetReplyTo(unsigned int reply);
void MaxPlayersChanged(int newvalue = -1);
#if SOURCE_ENGINE == SE_CSGO
bool HandleConVarQuery(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue);
#endif
private:
#if SOURCE_ENGINE == SE_DOTA
void OnServerActivate();
#else
void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
#endif
void InvalidatePlayer(CPlayer *pPlayer);
private:
List<IClientListener *> m_hooks;
@@ -217,6 +254,7 @@ private:
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;
@@ -225,7 +263,9 @@ private:
int m_ReplayUserId;
};
#if SOURCE_ENGINE >= SE_ORANGEBOX
#if SOURCE_ENGINE == SE_DOTA
void CmdMaxplayersCallback(const CCommandContext &context, const CCommand &command);
#elif SOURCE_ENGINE >= SE_ORANGEBOX
void CmdMaxplayersCallback(const CCommand &command);
#else
void CmdMaxplayersCallback();
-349
View File
@@ -1,349 +0,0 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#include <stdarg.h>
#include <string.h>
#include "PluginInfoDatabase.h"
#include "PluginSys.h"
void PluginSettings::Init()
{
name = -1;
pause_val = false;
type_val = PluginType_MapUpdated;
optarray = -1;
opts_num = 0;
opts_size = 0;
blockload_val = false;
}
/**
* :TODO: write the logger, make these errors log instead of being static
* NOTE: once we do that, we will have to change some code to ignore sections
*/
CPluginInfoDatabase::CPluginInfoDatabase()
{
m_strtab = NULL;
m_infodb_count = 0;
m_infodb_size = 0;
m_infodb = -1;
}
CPluginInfoDatabase::~CPluginInfoDatabase()
{
delete m_strtab;
}
void CPluginInfoDatabase::ReadSMC_ParseStart()
{
/* Create or reset our string table */
if (m_strtab)
{
m_strtab->Reset();
} else {
m_strtab = new BaseStringTable(1024);
}
/* Set our internal states to the beginning */
in_plugins = false;
cur_plugin = -1;
in_options = false;
m_infodb_size = 0;
m_infodb_count = 0;
m_infodb = -1;
}
SMCResult CPluginInfoDatabase::MakeError(const char *fmt, ...)
{
char buffer[512];
va_list ap;
va_start(ap, fmt);
vsnprintf(buffer, sizeof(buffer), fmt, ap);
va_end(ap);
m_errmsg = m_strtab->AddString(buffer);
return SMCResult_HaltFail;
}
unsigned int CPluginInfoDatabase::GetSettingsNum()
{
return m_infodb_count;
}
PluginSettings *CPluginInfoDatabase::GetSettingsIfMatch(unsigned int index, const char *filename)
{
BaseMemTable *memtab = m_strtab->GetMemTable();
int *table = (int *)memtab->GetAddress(m_infodb);
if (!table || index >= m_infodb_count)
{
return NULL;
}
PluginSettings *plugin = (PluginSettings *)memtab->GetAddress(table[index]);
const char *name = m_strtab->GetString(plugin->name);
if (!name)
{
return NULL;
}
if (!g_PluginSys.TestAliasMatch(name, filename))
{
return NULL;
}
return plugin;
}
void CPluginInfoDatabase::GetOptionsForPlugin(PluginSettings *settings, unsigned int opt_num, const char **key, const char **val)
{
PluginOpts *table = (PluginOpts *)m_strtab->GetMemTable()->GetAddress(settings->optarray);
if (!table)
{
*key = NULL;
*val = NULL;
return;
}
if (opt_num >= settings->opts_num)
{
*key = NULL;
*val = NULL;
return;
}
*key = m_strtab->GetString(table[opt_num].key);
*val = m_strtab->GetString(table[opt_num].val);
}
SMCResult CPluginInfoDatabase::ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value)
{
if (cur_plugin != -1)
{
PluginSettings *plugin = (PluginSettings *)m_strtab->GetMemTable()->GetAddress(cur_plugin);
if (!in_options)
{
if (strcmp(key, "pause") == 0)
{
if (strcasecmp(value, "yes") == 0)
{
plugin->pause_val = true;
}
else
{
plugin->pause_val = false;
}
}
else if (strcmp(key, "lifetime") == 0)
{
if (strcasecmp(value, "private") == 0)
{
plugin->type_val = PluginType_Private;
}
else if (strcasecmp(value, "mapsync") == 0)
{
plugin->type_val = PluginType_MapUpdated;
}
else if (strcasecmp(value, "maponly") == 0)
{
plugin->type_val = PluginType_MapOnly;
}
else if (strcasecmp(value, "global") == 0)
{
plugin->type_val = PluginType_Global;
}
else
{
return MakeError("Unknown value for key \"lifetime\": \"%s\"", value);
}
}
else if (strcmp(key, "blockload") == 0)
{
plugin->blockload_val = true;
}
else
{
return MakeError("Unknown property key: \"%s\"", key);
}
}
else
{
/* Cache every option, valid or not */
int keyidx = m_strtab->AddString(key);
int validx = m_strtab->AddString(value);
PluginOpts *table;
BaseMemTable *memtab = m_strtab->GetMemTable();
plugin = (PluginSettings *)memtab->GetAddress(cur_plugin);
if (plugin->opts_num + 1 > plugin->opts_size)
{
unsigned int oldsize = plugin->opts_size;
if (oldsize == 0)
{
//right now we don't have many
plugin->opts_size = 2;
}
else
{
plugin->opts_size *= 2;
}
int newidx = memtab->CreateMem(plugin->opts_size * sizeof(PluginOpts), (void **)&table);
/* in case it resized */
plugin = (PluginSettings *)memtab->GetAddress(cur_plugin);
if (plugin->optarray != -1)
{
void *oldtable = memtab->GetAddress(plugin->optarray);
memcpy(table, oldtable, oldsize * sizeof(PluginOpts));
}
plugin->optarray = newidx;
}
else
{
table = (PluginOpts *)memtab->GetAddress(plugin->optarray);
}
PluginOpts *opt = &table[plugin->opts_num++];
opt->key = keyidx;
opt->val = validx;
}
}
else if (in_plugins)
{
return MakeError("Unknown property key: \"%s\"", key);
}
else
{
/* Ignore anything we don't know about! */
}
return SMCResult_Continue;
}
SMCResult CPluginInfoDatabase::ReadSMC_LeavingSection(const SMCStates *states)
{
if (in_plugins)
{
if (cur_plugin != -1)
{
if (in_options)
{
in_options = false;
}
else
{
/* If the plugin is ending, add it to the table */
BaseMemTable *memtab = m_strtab->GetMemTable();
int *table;
if (m_infodb_count + 1 > m_infodb_size)
{
unsigned int oldsize = m_infodb_size;
if (!m_infodb_size)
{
m_infodb_size = 8;
}
else
{
m_infodb_size *= 2;
}
int newidx = memtab->CreateMem(m_infodb_size * sizeof(int), (void **)&table);
if (m_infodb != -1)
{
void *oldtable = (int *)memtab->GetAddress(m_infodb);
memcpy(table, oldtable, oldsize * sizeof(int));
}
m_infodb = newidx;
}
else
{
table = (int *)memtab->GetAddress(m_infodb);
}
/* Assign to table and scrap the current plugin */
table[m_infodb_count++] = cur_plugin;
cur_plugin = -1;
}
}
else
{
in_plugins = false;
}
}
return SMCResult_Continue;
}
SMCResult CPluginInfoDatabase::ReadSMC_NewSection(const SMCStates *states, const char *name)
{
if (!in_plugins)
{
/* If we're not in the main Plugins section, and we don't get it for the name, error out */
if (strcmp(name, "Plugins") != 0)
{
return MakeError("Unknown root section: \"%s\"", name);
}
else
{
/* Otherwise set our states */
in_plugins = true;
cur_plugin = -1;
in_options = false;
}
}
else
{
if (cur_plugin == -1)
{
/* If we get a plugin node and we don't have a current plugin, create a new one */
PluginSettings *plugin;
int i_name = m_strtab->AddString(name);
cur_plugin = m_strtab->GetMemTable()->CreateMem(sizeof(PluginSettings), (void **)&plugin);
plugin->Init();
plugin->name = i_name;
in_options = false;
}
else
{
if (!in_options && strcmp(name, "Options") == 0)
{
in_options = true;
}
else
{
return MakeError("Unknown plugin sub-section: \"%s\"", name);
}
}
}
return SMCResult_Continue;
}
-106
View File
@@ -1,106 +0,0 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#ifndef _INCLUDE_SOURCEMOD_CORE_SYSTEM_PLUGININFODATABASE_H_
#define _INCLUDE_SOURCEMOD_CORE_SYSTEM_PLUGININFODATABASE_H_
/**
* This file parses plugin_settings.cfg and stores the information in cached memory.
* It provides simplistic abstraction to retrieving the info.
* :TODO: currently untested
*/
#include "sm_memtable.h"
#include "ITextParsers.h"
#include "IPluginSys.h"
#include "sm_globals.h"
struct PluginOpts
{
int key;
int val;
};
struct PluginSettings
{
void Init();
int name;
bool pause_val;
PluginType type_val;
int optarray;
size_t opts_num;
size_t opts_size;
bool blockload_val;
};
class CPluginInfoDatabase : public ITextListener_SMC
{
public:
CPluginInfoDatabase();
~CPluginInfoDatabase();
public: //ITextListener_SMC
void ReadSMC_ParseStart();
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
SMCResult ReadSMC_LeavingSection(const SMCStates *states);
public:
/**
* Returns the number of plugin settings available.
*/
unsigned int GetSettingsNum();
/**
* Given an index, returns the plugin settings block if the filename matches.
* Otherwise, returns NULL.
*/
PluginSettings *GetSettingsIfMatch(unsigned int index, const char *filename);
/**
* Given a plugin settings struct and an index,
* returns the given JIT key/value option pair at that index.
* If the input is invalid, key and val will be set to NULL.
*/
void GetOptionsForPlugin(PluginSettings *settings, unsigned int opt_num, const char **key, const char **val);
private:
SMCResult MakeError(const char *fmt, ...);
private:
BaseStringTable *m_strtab;
int m_errmsg;
bool in_plugins;
bool in_options;
int m_infodb;
size_t m_infodb_count;
size_t m_infodb_size;
int cur_plugin;
};
#endif //_INCLUDE_SOURCEMOD_CORE_SYSTEM_PLUGININFODATABASE_H_
+6 -6
View File
@@ -31,10 +31,10 @@
#include <time.h>
#include "TimerSys.h"
#include "ForwardSys.h"
#include "sourcemm_api.h"
#include "frame_hooks.h"
#include "ConVarManager.h"
#include "logic_bridge.h"
#define TIMER_MIN_ACCURACY 0.1
@@ -180,9 +180,9 @@ TimerSystem::~TimerSystem()
void TimerSystem::OnSourceModAllInitialized()
{
g_ShareSys.AddInterface(NULL, this);
m_pOnGameFrame = g_Forwards.CreateForward("OnGameFrame", ET_Ignore, 0, NULL);
m_pOnMapTimeLeftChanged = g_Forwards.CreateForward("OnMapTimeLeftChanged", ET_Ignore, 0, NULL);
sharesys->AddInterface(NULL, this);
m_pOnGameFrame = forwardsys->CreateForward("OnGameFrame", ET_Ignore, 0, NULL);
m_pOnMapTimeLeftChanged = forwardsys->CreateForward("OnMapTimeLeftChanged", ET_Ignore, 0, NULL);
}
void TimerSystem::OnSourceModGameInitialized()
@@ -198,8 +198,8 @@ void TimerSystem::OnSourceModGameInitialized()
void TimerSystem::OnSourceModShutdown()
{
SetMapTimer(NULL);
g_Forwards.ReleaseForward(m_pOnGameFrame);
g_Forwards.ReleaseForward(m_pOnMapTimeLeftChanged);
forwardsys->ReleaseForward(m_pOnGameFrame);
forwardsys->ReleaseForward(m_pOnMapTimeLeftChanged);
}
void TimerSystem::OnSourceModLevelEnd()
+1 -1
View File
@@ -32,11 +32,11 @@
#ifndef _INCLUDE_SOURCEMOD_CTIMERSYS_H_
#define _INCLUDE_SOURCEMOD_CTIMERSYS_H_
#include "ShareSys.h"
#include <ITimerSystem.h>
#include <sh_stack.h>
#include <sh_list.h>
#include "sourcemm_api.h"
#include "sm_globals.h"
using namespace SourceHook;
using namespace SourceMod;
File diff suppressed because it is too large Load Diff
+345 -55
View File
@@ -1,5 +1,5 @@
/**
* vim: set ts=4 :
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
@@ -31,19 +31,35 @@
#include "UserMessages.h"
#include "sm_stringutil.h"
#include "logic_bridge.h"
#if SOURCE_ENGINE == SE_DOTA
#include <dota_usermessage_helpers.h>
#elif SOURCE_ENGINE == SE_CSGO
#include <cstrike15_usermessage_helpers.h>
#endif
UserMessages g_UserMsgs;
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
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,8 +69,6 @@ UserMessages::UserMessages() : m_InterceptBuffer(m_pBase, 2500)
UserMessages::~UserMessages()
{
sm_trie_destroy(m_Names);
CStack<ListenerInfo *>::iterator iter;
for (iter=m_FreeListeners.begin(); iter!=m_FreeListeners.end(); iter++)
{
@@ -65,32 +79,46 @@ 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()
{
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
}
void UserMessages::OnSourceModAllShutdown()
{
if (m_HookCount)
{
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);
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
SH_REMOVE_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Pre), false);
SH_REMOVE_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Post), true);
#else
SH_REMOVE_HOOK(IVEngineServer, UserMessageBegin, engine, SH_MEMBER(this, &UserMessages::OnStartMessage_Pre), false);
SH_REMOVE_HOOK(IVEngineServer, UserMessageBegin, engine, SH_MEMBER(this, &UserMessages::OnStartMessage_Post), true);
SH_REMOVE_HOOK(IVEngineServer, MessageEnd, engine, SH_MEMBER(this, &UserMessages::OnMessageEnd_Pre), false);
SH_REMOVE_HOOK(IVEngineServer, MessageEnd, engine, SH_MEMBER(this, &UserMessages::OnMessageEnd_Post), true);
#endif
}
m_HookCount = 0;
}
int UserMessages::GetMessageIndex(const char *msg)
{
int msgid;
#if SOURCE_ENGINE == SE_DOTA
// Can split this per engine and/or game later
return g_DotaUsermessageHelpers.GetIndex(msg);
#elif SOURCE_ENGINE == SE_CSGO
// Can split this per engine and/or game later
return g_Cstrike15UsermessageHelpers.GetIndex(msg);
#else
if (!sm_trie_retrieve(m_Names, msg, reinterpret_cast<void **>(&msgid)))
int msgid;
if (!m_Names.retrieve(msg, &msgid))
{
if (m_FallbackSearch)
{
@@ -102,7 +130,7 @@ int UserMessages::GetMessageIndex(const char *msg)
{
if (strcmp(msgbuf, msg) == 0)
{
sm_trie_insert(m_Names, msg, reinterpret_cast<void *>(msgid));
m_Names.insert(msg, msgid);
return msgid;
}
msgid++;
@@ -112,16 +140,27 @@ int UserMessages::GetMessageIndex(const char *msg)
msgid = g_SMAPI->FindUserMessage(msg);
if (msgid != INVALID_MESSAGE_ID)
{
sm_trie_insert(m_Names, msg, reinterpret_cast<void *>(msgid));
}
m_Names.insert(msg, msgid);
}
return msgid;
#endif
}
bool UserMessages::GetMessageName(int msgid, char *buffer, size_t maxlength) const
{
#ifdef USE_PROTOBUF_USERMESSAGES
#if SOURCE_ENGINE == SE_DOTA
const char *pszName = g_DotaUsermessageHelpers.GetName(msgid);
#elif SOURCE_ENGINE == SE_CSGO
const char *pszName = g_Cstrike15UsermessageHelpers.GetName(msgid);
#endif
if (!pszName)
return false;
strncopy(buffer, pszName, maxlength);
return true;
#else
if (m_FallbackSearch)
{
int size;
@@ -137,10 +176,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)
@@ -182,6 +225,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 = GetMessagePrototype(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 = GetMessagePrototype(msg_id)->New();
buffer = m_FakeEngineBuffer;
break;
case MRES_OVERRIDE:
m_FakeEngineBuffer = GetMessagePrototype(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 +303,37 @@ bool UserMessages::EndMessage()
return false;
}
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
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 || SE_DOTA
m_InExec = false;
m_CurFlags = 0;
@@ -205,31 +342,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 +418,15 @@ bool UserMessages::InternalHook(int msg_id, IUserMessageListener *pListener, boo
if (!m_HookCount++)
{
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);
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
SH_ADD_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Pre), false);
SH_ADD_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Post), true);
#else
SH_ADD_HOOK(IVEngineServer, UserMessageBegin, engine, SH_MEMBER(this, &UserMessages::OnStartMessage_Pre), false);
SH_ADD_HOOK(IVEngineServer, UserMessageBegin, engine, SH_MEMBER(this, &UserMessages::OnStartMessage_Post), true);
SH_ADD_HOOK(IVEngineServer, MessageEnd, engine, SH_MEMBER(this, &UserMessages::OnMessageEnd_Pre), false);
SH_ADD_HOOK(IVEngineServer, MessageEnd, engine, SH_MEMBER(this, &UserMessages::OnMessageEnd_Post), true);
#endif
}
if (intercept)
@@ -268,7 +439,22 @@ 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
const protobuf::Message *UserMessages::GetMessagePrototype(int msg_type)
{
#if SOURCE_ENGINE == SE_DOTA
return g_DotaUsermessageHelpers.GetPrototype(msg_type);
#elif SOURCE_ENGINE == SE_CSGO
return g_Cstrike15UsermessageHelpers.GetPrototype(msg_type);
#endif
}
#endif
#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 +495,77 @@ void UserMessages::_DecRefCounter()
{
if (--m_HookCount == 0)
{
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);
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
SH_REMOVE_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Pre), false);
SH_REMOVE_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Post), true);
#else
SH_REMOVE_HOOK(IVEngineServer, UserMessageBegin, engine, SH_MEMBER(this, &UserMessages::OnStartMessage_Pre), false);
SH_REMOVE_HOOK(IVEngineServer, UserMessageBegin, engine, SH_MEMBER(this, &UserMessages::OnStartMessage_Post), true);
SH_REMOVE_HOOK(IVEngineServer, MessageEnd, engine, SH_MEMBER(this, &UserMessages::OnMessageEnd_Pre), false);
SH_REMOVE_HOOK(IVEngineServer, MessageEnd, engine, SH_MEMBER(this, &UserMessages::OnMessageEnd_Post), true);
#endif
}
}
#if SOURCE_ENGINE >= SE_LEFT4DEAD
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
void UserMessages::OnSendUserMessage_Pre(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg)
{
#if SOURCE_ENGINE == SE_DOTA
OnStartMessage_Pre(&filter, msg_type, g_DotaUsermessageHelpers.GetName(msg_type));
#elif SOURCE_ENGINE == SE_CSGO
OnStartMessage_Pre(&filter, msg_type, g_Cstrike15UsermessageHelpers.GetName(msg_type));
#endif
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);
}
#if SOURCE_ENGINE == SE_DOTA
OnStartMessage_Post(&filter, msg_type, g_DotaUsermessageHelpers.GetName(msg_type));
#elif SOURCE_ENGINE == SE_CSGO
OnStartMessage_Post(&filter, msg_type, g_Cstrike15UsermessageHelpers.GetName(msg_type));
#endif
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 || SOURCE_ENGINE == SE_DOTA
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 +578,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 +588,24 @@ 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 = GetMessagePrototype(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
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
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 +613,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 +700,7 @@ void UserMessages::OnMessageEnd_Pre()
{
if (!m_InHook)
{
RETURN_META(MRES_IGNORED);
UM_RETURN_META(MRES_IGNORED);
}
MsgList *pList;
@@ -450,7 +716,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,8 +768,10 @@ void UserMessages::OnMessageEnd_Pre()
if (!handled && intercepted)
{
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
ENGINE_CALL(SendUserMessage)(static_cast<IRecipientFilter &>(*m_CurRecFilter), m_CurId, *m_InterceptBuffer);
#else
bf_write *engine_bfw;
#if SOURCE_ENGINE >= SE_LEFT4DEAD
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId, g_SMAPI->GetUserMessage(m_CurId));
#else
@@ -508,29 +780,47 @@ 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 || SE_DOTA
}
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 || SOURCE_ENGINE == SE_DOTA
int size = m_OrigBuffer->ByteSize();
uint8 *data = (uint8 *)stackalloc(size);
m_OrigBuffer->SerializePartialToArray(data, size);
if (pInfo->KillMe)
protobuf::Message *pTempMsg = GetMessagePrototype(m_CurId)->New();
pTempMsg->ParsePartialFromArray(data, size);
#else
bf_write *pTempMsg = m_OrigBuffer;
#endif
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 || SOURCE_ENGINE == SE_DOTA
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);
}
+58 -10
View File
@@ -1,5 +1,5 @@
/**
* vim: set ts=4 :
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
@@ -32,20 +32,41 @@
#ifndef _INCLUDE_SOURCEMOD_CUSERMESSAGES_H_
#define _INCLUDE_SOURCEMOD_CUSERMESSAGES_H_
#include "ShareSys.h"
#include <IUserMessages.h>
#include "sourcemm_api.h"
#include "sm_trie.h"
#include <sm_stringhashmap.h>
#include "sm_stringutil.h"
#include "CellRecipientFilter.h"
#include "sm_globals.h"
#include <sh_list.h>
#include <sh_stack.h>
using namespace SourceHook;
using namespace SourceMod;
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
#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 +91,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 +100,17 @@ public: //IUserMessages
bool UnhookUserMessage2(int msg_id,
IUserMessageListener *pListener,
bool intercept=false);
UserMessageType GetUserMessageType() const;
public:
#if SOURCE_ENGINE >= SE_LEFT4DEAD
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
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 || SOURCE_ENGINE == SE_DOTA
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 +120,41 @@ 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
const protobuf::Message *GetMessagePrototype(int msg_type);
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;
StringHashMap<int> m_Names;
#endif
CellRecipientFilter m_CellRecFilter;
bool m_InExec;
int m_CurFlags;
+6 -6
View File
@@ -64,20 +64,20 @@ public:
void OnSourceModAllInitialized()
{
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_ADD_HOOK_MEMFUNC(ICvar, UnregisterConCommand, icvar, this, &ConCommandCleaner::UnlinkConCommandBase, false);
SH_ADD_HOOK_MEMFUNC(ICvar, RegisterConCommand, icvar, this, &ConCommandCleaner::LinkConCommandBase, false);
SH_ADD_HOOK(ICvar, UnregisterConCommand, icvar, SH_MEMBER(this, &ConCommandCleaner::UnlinkConCommandBase), false);
SH_ADD_HOOK(ICvar, RegisterConCommand, icvar, SH_MEMBER(this, &ConCommandCleaner::LinkConCommandBase), false);
#else
SH_ADD_HOOK_MEMFUNC(ICvar, RegisterConCommandBase, icvar, this, &ConCommandCleaner::LinkConCommandBase, false);
SH_ADD_HOOK(ICvar, RegisterConCommandBase, icvar, SH_MEMBER(this, &ConCommandCleaner::LinkConCommandBase), false);
#endif
}
void OnSourceModShutdown()
{
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_REMOVE_HOOK_MEMFUNC(ICvar, UnregisterConCommand, icvar, this, &ConCommandCleaner::UnlinkConCommandBase, false);
SH_REMOVE_HOOK_MEMFUNC(ICvar, RegisterConCommand, icvar, this, &ConCommandCleaner::LinkConCommandBase, false);
SH_REMOVE_HOOK(ICvar, UnregisterConCommand, icvar, SH_MEMBER(this, &ConCommandCleaner::UnlinkConCommandBase), false);
SH_REMOVE_HOOK(ICvar, RegisterConCommand, icvar, SH_MEMBER(this, &ConCommandCleaner::LinkConCommandBase), false);
#else
SH_REMOVE_HOOK_MEMFUNC(ICvar, RegisterConCommandBase, icvar, this, &ConCommandCleaner::LinkConCommandBase, false);
SH_REMOVE_HOOK(ICvar, RegisterConCommandBase, icvar, SH_MEMBER(this, &ConCommandCleaner::LinkConCommandBase), false);
#endif
}
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -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
+11 -1
View File
@@ -20,7 +20,7 @@
#include "tier1/iconvar.h"
#include "tier1/utlvector.h"
#include "tier1/utlstring.h"
#include "color.h"
#include "Color.h"
#include "icvar.h"
#ifdef _WIN32
@@ -381,8 +381,14 @@ public:
FnChangeCallback_t GetChangeCallback( int slot ) const { return m_pParent->m_fnChangeCallbacks[ slot ]; }
// Retrieve value
#if SOURCE_ENGINE >= SE_INSURGENCY
virtual float GetFloat( void ) const;
virtual int GetInt( void ) const;
#else
FORCEINLINE_CVAR float GetFloat( void ) const;
FORCEINLINE_CVAR int GetInt( void ) const;
#endif
FORCEINLINE_CVAR Color GetColor( void ) const;
FORCEINLINE_CVAR bool GetBool() const { return !!GetInt(); }
FORCEINLINE_CVAR char const *GetString( void ) const;
@@ -895,7 +901,9 @@ void ConVar_PrintDescription( const ConCommandBase *pVar );
//-----------------------------------------------------------------------------
// Purpose: Utility class to quickly allow ConCommands to call member methods
//-----------------------------------------------------------------------------
#ifdef _WIN32
#pragma warning (disable : 4355 )
#endif
template< class T >
class CConCommandMemberAccessor : public ConCommand, public ICommandCallback, public ICommandCompletionCallback
@@ -942,7 +950,9 @@ private:
FnMemberCommandCompletionCallback_t m_CompletionFunc;
};
#ifdef _WIN32
#pragma warning ( default : 4355 )
#endif
//-----------------------------------------------------------------------------
+1 -2
View File
@@ -30,7 +30,6 @@
*/
#include "frame_hooks.h"
#include "TimerSys.h"
#include "Database.h"
#include "HalfLife2.h"
#include "MenuStyle_Valve.h"
#include "MenuStyle_Radio.h"
@@ -38,6 +37,7 @@
#include "CoreConfig.h"
#include <sm_queue.h>
#include <IThreader.h>
#include "sourcemod.h"
static IMutex *frame_mutex;
static Queue<FrameAction> *frame_queue;
@@ -95,7 +95,6 @@ void RunFrameHooks(bool simulating)
}
/* Frame based hooks */
g_DBMan.RunFrame();
g_HL2.ProcessFakeCliCmdQueue();
g_HL2.ProcessDelayedKicks();
@@ -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.
@@ -30,7 +30,6 @@
*/
#include "ADTFactory.h"
#include "sm_globals.h"
#include "ShareSys.h"
ADTFactory g_AdtFactory;
@@ -57,32 +56,30 @@ IBasicTrie *ADTFactory::CreateBasicTrie()
BaseTrie::BaseTrie()
{
m_pTrie = sm_trie_create();
}
BaseTrie::~BaseTrie()
{
sm_trie_destroy(m_pTrie);
}
bool BaseTrie::Insert(const char *key, void *value)
{
return sm_trie_insert(m_pTrie, key, value);
return map_.insert(key, value);
}
bool BaseTrie::Retrieve(const char *key, void **value)
{
return sm_trie_retrieve(m_pTrie, key, value);
return map_.retrieve(key, value);
}
bool BaseTrie::Delete(const char *key)
{
return sm_trie_delete(m_pTrie, key);
return map_.remove(key);
}
void BaseTrie::Clear()
{
sm_trie_clear(m_pTrie);
map_.clear();
}
void BaseTrie::Destroy()
@@ -92,5 +89,5 @@ void BaseTrie::Destroy()
bool BaseTrie::Replace(const char *key, void *value)
{
return sm_trie_replace(m_pTrie, key, value);
return map_.replace(key, value);
}
@@ -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.
@@ -33,8 +33,8 @@
#define _INCLUDE_SOURCEMOD_ADTFACTORY_H_
#include <IADTFactory.h>
#include "sm_globals.h"
#include "sm_trie.h"
#include "common_logic.h"
#include <sm_stringhashmap.h>
using namespace SourceMod;
@@ -50,7 +50,7 @@ public:
virtual void Clear();
virtual void Destroy();
private:
Trie *m_pTrie;
StringHashMap<void *> map_;
};
class ADTFactory :
+78 -53
View File
@@ -1,59 +1,84 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
compiler = SM.DefaultCompiler()
base = AMBuild.sourceFolder
compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'core', 'logic'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'public'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'sourcepawn'))
compiler['CDEFINES'].append('SM_DEFAULT_THREADER')
compiler['CDEFINES'].append('SM_LOGIC')
binary = SM.Library(builder, 'sourcemod.logic')
binary.compiler.cxxincludes += [
os.path.join(builder.sourcePath, 'core', 'logic'),
os.path.join(builder.sourcePath, 'public'),
os.path.join(builder.sourcePath, 'public', 'sourcepawn'),
os.path.join(builder.sourcePath, 'public', 'amtl'),
os.path.join(SM.mms_root, 'core', 'sourcehook')
]
binary.compiler.defines += [
'SM_DEFAULT_THREADER',
'SM_LOGIC'
]
if builder.target_platform == 'linux':
binary.compiler.postlink += ['-lpthread', '-lrt']
elif builder.target_platform == 'mac':
binary.compiler.cflags += ['-Wno-deprecated-declarations']
binary.compiler.postlink += ['-framework', 'CoreServices']
if AMBuild.target['platform'] == 'linux':
compiler['POSTLINKFLAGS'].append('-lpthread')
if AMBuild.target['platform'] == 'darwin':
compiler['POSTLINKFLAGS'].extend(['-framework', 'CoreServices'])
if binary.compiler.vendor == 'gcc' or binary.compiler.vendor == 'clang':
binary.compiler.cxxflags += ['-fno-rtti']
elif binary.compiler.vendor == 'msvc':
binary.compiler.cxxflags += ['/GR-']
extension = AMBuild.AddJob('sourcemod.logic')
binary = Cpp.LibraryBuilder('sourcemod.logic', AMBuild, extension, compiler)
files = [
'common_logic.cpp',
'smn_adt_array.cpp',
'smn_sorting.cpp',
'smn_maplists.cpp',
'smn_adt_stack.cpp',
'thread/ThreadWorker.cpp',
'thread/BaseWorker.cpp',
'ThreadSupport.cpp',
'smn_float.cpp',
'TextParsers.cpp',
'smn_textparse.cpp',
'smn_adt_trie.cpp',
'Profiler.cpp',
'smn_functions.cpp',
'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')
binary.sources += [
'common_logic.cpp',
'smn_adt_array.cpp',
'smn_sorting.cpp',
'smn_maplists.cpp',
'ADTFactory.cpp',
'smn_adt_stack.cpp',
'thread/ThreadWorker.cpp',
'thread/BaseWorker.cpp',
'ThreadSupport.cpp',
'smn_float.cpp',
'TextParsers.cpp',
'smn_textparse.cpp',
'smn_adt_trie.cpp',
'smn_functions.cpp',
'smn_timers.cpp',
'smn_players.cpp',
'MemoryUtils.cpp',
'smn_admin.cpp',
'smn_banning.cpp',
'smn_filesystem.cpp',
'stringutil.cpp',
'Translator.cpp',
'PhraseCollection.cpp',
'smn_lang.cpp',
'smn_string.cpp',
'smn_handles.cpp',
'smn_datapacks.cpp',
'smn_gameconfigs.cpp',
'smn_fakenatives.cpp',
'GameConfigs.cpp',
'sm_crc32.cpp',
'smn_profiler.cpp',
'ShareSys.cpp',
'PluginSys.cpp',
'HandleSys.cpp',
'NativeOwner.cpp',
'NativeInvoker.cpp',
'ExtensionSys.cpp',
'DebugReporter.cpp',
'Database.cpp',
'smn_database.cpp',
'ForwardSys.cpp',
'AdminCache.cpp',
'sm_trie.cpp',
'smn_console.cpp',
'ProfileTools.cpp',
'Logger.cpp',
'smn_core.cpp',
'smn_menus.cpp',
]
if builder.target_platform == 'windows':
binary.sources += ['thread/WinThreads.cpp']
else:
files.append('thread/PosixThreads.cpp')
binary.AddSourceFiles('core/logic', files)
SM.AutoVersion('core/logic', binary)
binary.SendToJob()
binary.sources += ['thread/PosixThreads.cpp']
SM.binaries += [builder.Add(binary)]
File diff suppressed because it is too large Load Diff
+227 -208
View File
@@ -1,208 +1,227 @@
/**
* 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_ADMINCACHE_H_
#define _INCLUDE_SOURCEMOD_ADMINCACHE_H_
#include "sm_memtable.h"
#include <sm_trie.h>
#include <sh_list.h>
#include <sh_string.h>
#include <IAdminSystem.h>
#include "sm_globals.h"
#include <IForwardSys.h>
using namespace SourceHook;
#define GRP_MAGIC_SET 0xDEADFADE
#define GRP_MAGIC_UNSET 0xFACEFACE
#define USR_MAGIC_SET 0xDEADFACE
#define USR_MAGIC_UNSET 0xFADEDEAD
struct AdminGroup
{
uint32_t magic; /* Magic flag, for memory validation (ugh) */
unsigned int immunity_level; /* Immunity level */
/* Immune from target table (-1 = nonexistent)
* [0] = number of entries
* [1...N] = immune targets
*/
int immune_table;
Trie *pCmdTable; /* Command override table (can be NULL) */
Trie *pCmdGrpTable; /* Command group override table (can be NULL) */
int next_grp; /* Next group in the chain */
int prev_grp; /* Previous group in the chain */
int nameidx; /* Name */
FlagBits addflags; /* Additive flags */
};
struct AuthMethod
{
String name;
Trie *table;
};
struct UserAuth
{
unsigned int index; /* Index into auth table */
int identidx; /* Index into the string table */
};
struct AdminUser
{
uint32_t magic; /* Magic flag, for memory validation */
FlagBits flags; /* Flags */
FlagBits eflags; /* Effective flags */
int nameidx; /* Name index */
int password; /* Password index */
unsigned int grp_count; /* Number of groups */
unsigned int grp_size; /* Size of groups table */
int grp_table; /* Group table itself */
int next_user; /* Next user in the list */
int prev_user; /* Previous user in the list */
UserAuth auth; /* Auth method for this user */
unsigned int immunity_level; /* Immunity level */
unsigned int serialchange; /* Serial # for changes */
};
class AdminCache :
public IAdminSystem,
public SMGlobalClass
{
public:
AdminCache();
~AdminCache();
public: //SMGlobalClass
void OnSourceModStartup(bool late);
void OnSourceModAllInitialized();
void OnSourceModLevelChange(const char *mapName);
void OnSourceModShutdown();
void OnSourceModPluginsLoaded();
public: //IAdminSystem
/** Command cache stuff */
void AddCommandOverride(const char *cmd, OverrideType type, FlagBits flags);
bool GetCommandOverride(const char *cmd, OverrideType type, FlagBits *flags);
void UnsetCommandOverride(const char *cmd, OverrideType type);
/** Group cache stuff */
GroupId AddGroup(const char *group_name);
GroupId FindGroupByName(const char *group_name);
void SetGroupAddFlag(GroupId id, AdminFlag flag, bool enabled);
bool GetGroupAddFlag(GroupId id, AdminFlag flag);
FlagBits GetGroupAddFlags(GroupId id);
void SetGroupGenericImmunity(GroupId id, ImmunityType type, bool enabled);
bool GetGroupGenericImmunity(GroupId id, ImmunityType type);
void InvalidateGroup(GroupId id);
void AddGroupImmunity(GroupId id, GroupId other_id);
unsigned int GetGroupImmunityCount(GroupId id);
GroupId GetGroupImmunity(GroupId id, unsigned int number);
void AddGroupCommandOverride(GroupId id, const char *name, OverrideType type, OverrideRule rule);
bool GetGroupCommandOverride(GroupId id, const char *name, OverrideType type, OverrideRule *pRule);
void DumpAdminCache(AdminCachePart part, bool rebuild);
void AddAdminListener(IAdminListener *pListener);
void RemoveAdminListener(IAdminListener *pListener);
/** User stuff */
void RegisterAuthIdentType(const char *name);
AdminId CreateAdmin(const char *name);
const char *GetAdminName(AdminId id);
bool BindAdminIdentity(AdminId id, const char *auth, const char *ident);
virtual void SetAdminFlag(AdminId id, AdminFlag flag, bool enabled);
bool GetAdminFlag(AdminId id, AdminFlag flag, AccessMode mode);
FlagBits GetAdminFlags(AdminId id, AccessMode mode);
bool AdminInheritGroup(AdminId id, GroupId gid);
unsigned int GetAdminGroupCount(AdminId id);
GroupId GetAdminGroup(AdminId id, unsigned int index, const char **name);
void SetAdminPassword(AdminId id, const char *password);
const char *GetAdminPassword(AdminId id);
AdminId FindAdminByIdentity(const char *auth, const char *identity);
bool InvalidateAdmin(AdminId id);
unsigned int FlagBitsToBitArray(FlagBits bits, bool array[], unsigned int maxSize);
FlagBits FlagBitArrayToBits(const bool array[], unsigned int maxSize);
FlagBits FlagArrayToBits(const AdminFlag array[], unsigned int numFlags);
unsigned int FlagBitsToArray(FlagBits bits, AdminFlag array[], unsigned int maxSize);
bool CheckAdminFlags(AdminId id, FlagBits bits);
bool CanAdminTarget(AdminId id, AdminId target);
void SetAdminFlags(AdminId id, AccessMode mode, FlagBits bits);
bool FindFlag(const char *str, AdminFlag *pFlag);
bool FindFlag(char c, AdminFlag *pAdmFlag);
FlagBits ReadFlagString(const char *flags, const char **end);
size_t FillFlagString(FlagBits bits, char *buffer, size_t maxlen);
unsigned int GetAdminSerialChange(AdminId id);
bool CanAdminUseCommand(int client, const char *cmd);
const char *GetGroupName(GroupId gid);
unsigned int SetGroupImmunityLevel(GroupId gid, unsigned int level);
unsigned int GetGroupImmunityLevel(GroupId gid);
unsigned int SetAdminImmunityLevel(AdminId id, unsigned int level);
unsigned int GetAdminImmunityLevel(AdminId id);
bool CheckAccess(int client,
const char *cmd,
FlagBits flags,
bool override_only);
bool FindFlagChar(AdminFlag flag, char *c);
public:
bool IsValidAdmin(AdminId id);
void DumpCache(FILE *fp);
AdminGroup *GetGroup(GroupId gid);
AdminUser *GetUser(AdminId id);
const char *GetString(int idx);
private:
void _UnsetCommandOverride(const char *cmd);
void _UnsetCommandGroupOverride(const char *group);
void InvalidateGroupCache();
void InvalidateAdminCache(bool unlink_admins);
void DumpCommandOverrideCache(OverrideType type);
Trie *GetMethodByIndex(unsigned int index);
bool GetMethodIndex(const char *name, unsigned int *_index);
const char *GetMethodName(unsigned int index);
void NameFlag(const char *str, AdminFlag flag);
public:
BaseStringTable *m_pStrings;
BaseMemTable *m_pMemory;
Trie *m_pCmdOverrides;
Trie *m_pCmdGrpOverrides;
int m_FirstGroup;
int m_LastGroup;
int m_FreeGroupList;
Trie *m_pGroups;
List<IAdminListener *> m_hooks;
List<AuthMethod> m_AuthMethods;
Trie *m_pAuthTables;
IForward *m_pCacheFwd;
int m_FirstUser;
int m_LastUser;
int m_FreeUserList;
bool m_InvalidatingAdmins;
bool m_destroying;
Trie *m_pLevelNames;
};
extern AdminCache g_Admins;
#endif //_INCLUDE_SOURCEMOD_ADMINCACHE_H_
/**
* 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$
*/
#ifndef _INCLUDE_SOURCEMOD_ADMINCACHE_H_
#define _INCLUDE_SOURCEMOD_ADMINCACHE_H_
#include "common_logic.h"
#include <IAdminSystem.h>
#include "sm_memtable.h"
#include <sm_trie.h>
#include <sh_list.h>
#include <sh_string.h>
#include <IForwardSys.h>
#include <sm_stringhashmap.h>
#include <sm_namehashset.h>
using namespace SourceHook;
#define GRP_MAGIC_SET 0xDEADFADE
#define GRP_MAGIC_UNSET 0xFACEFACE
#define USR_MAGIC_SET 0xDEADFACE
#define USR_MAGIC_UNSET 0xFADEDEAD
typedef StringHashMap<OverrideRule> OverrideMap;
struct AdminGroup
{
uint32_t magic; /* Magic flag, for memory validation (ugh) */
unsigned int immunity_level; /* Immunity level */
/* Immune from target table (-1 = nonexistent)
* [0] = number of entries
* [1...N] = immune targets
*/
int immune_table;
OverrideMap *pCmdTable; /* Command override table (can be NULL) */
OverrideMap *pCmdGrpTable; /* Command group override table (can be NULL) */
int next_grp; /* Next group in the chain */
int prev_grp; /* Previous group in the chain */
int nameidx; /* Name */
FlagBits addflags; /* Additive flags */
};
struct AuthMethod
{
String name;
StringHashMap<AdminId> identities;
AuthMethod(const char *name)
: name(name)
{
}
static inline bool matches(const char *name, const AuthMethod *method)
{
return strcmp(name, method->name.c_str()) == 0;
}
};
struct UserAuth
{
unsigned int index; /* Index into auth table */
int identidx; /* Index into the string table */
};
struct AdminUser
{
uint32_t magic; /* Magic flag, for memory validation */
FlagBits flags; /* Flags */
FlagBits eflags; /* Effective flags */
int nameidx; /* Name index */
int password; /* Password index */
unsigned int grp_count; /* Number of groups */
unsigned int grp_size; /* Size of groups table */
int grp_table; /* Group table itself */
int next_user; /* Next user in the list */
int prev_user; /* Previous user in the list */
UserAuth auth; /* Auth method for this user */
unsigned int immunity_level; /* Immunity level */
unsigned int serialchange; /* Serial # for changes */
};
class AdminCache :
public IAdminSystem,
public SMGlobalClass
{
public:
AdminCache();
~AdminCache();
public: //SMGlobalClass
void OnSourceModStartup(bool late);
void OnSourceModAllInitialized();
void OnSourceModLevelChange(const char *mapName);
void OnSourceModShutdown();
void OnSourceModPluginsLoaded();
public: //IAdminSystem
/** Command cache stuff */
void AddCommandOverride(const char *cmd, OverrideType type, FlagBits flags);
bool GetCommandOverride(const char *cmd, OverrideType type, FlagBits *flags);
void UnsetCommandOverride(const char *cmd, OverrideType type);
/** Group cache stuff */
GroupId AddGroup(const char *group_name);
GroupId FindGroupByName(const char *group_name);
void SetGroupAddFlag(GroupId id, AdminFlag flag, bool enabled);
bool GetGroupAddFlag(GroupId id, AdminFlag flag);
FlagBits GetGroupAddFlags(GroupId id);
void SetGroupGenericImmunity(GroupId id, ImmunityType type, bool enabled);
bool GetGroupGenericImmunity(GroupId id, ImmunityType type);
void InvalidateGroup(GroupId id);
void AddGroupImmunity(GroupId id, GroupId other_id);
unsigned int GetGroupImmunityCount(GroupId id);
GroupId GetGroupImmunity(GroupId id, unsigned int number);
void AddGroupCommandOverride(GroupId id, const char *name, OverrideType type, OverrideRule rule);
bool GetGroupCommandOverride(GroupId id, const char *name, OverrideType type, OverrideRule *pRule);
void DumpAdminCache(AdminCachePart part, bool rebuild);
void AddAdminListener(IAdminListener *pListener);
void RemoveAdminListener(IAdminListener *pListener);
/** User stuff */
void RegisterAuthIdentType(const char *name);
AdminId CreateAdmin(const char *name);
const char *GetAdminName(AdminId id);
bool BindAdminIdentity(AdminId id, const char *auth, const char *ident);
virtual void SetAdminFlag(AdminId id, AdminFlag flag, bool enabled);
bool GetAdminFlag(AdminId id, AdminFlag flag, AccessMode mode);
FlagBits GetAdminFlags(AdminId id, AccessMode mode);
bool AdminInheritGroup(AdminId id, GroupId gid);
unsigned int GetAdminGroupCount(AdminId id);
GroupId GetAdminGroup(AdminId id, unsigned int index, const char **name);
void SetAdminPassword(AdminId id, const char *password);
const char *GetAdminPassword(AdminId id);
AdminId FindAdminByIdentity(const char *auth, const char *identity);
bool InvalidateAdmin(AdminId id);
unsigned int FlagBitsToBitArray(FlagBits bits, bool array[], unsigned int maxSize);
FlagBits FlagBitArrayToBits(const bool array[], unsigned int maxSize);
FlagBits FlagArrayToBits(const AdminFlag array[], unsigned int numFlags);
unsigned int FlagBitsToArray(FlagBits bits, AdminFlag array[], unsigned int maxSize);
bool CheckAdminFlags(AdminId id, FlagBits bits);
bool CanAdminTarget(AdminId id, AdminId target);
void SetAdminFlags(AdminId id, AccessMode mode, FlagBits bits);
bool FindFlag(const char *str, AdminFlag *pFlag);
bool FindFlag(char c, AdminFlag *pAdmFlag);
FlagBits ReadFlagString(const char *flags, const char **end);
size_t FillFlagString(FlagBits bits, char *buffer, size_t maxlen);
unsigned int GetAdminSerialChange(AdminId id);
bool CanAdminUseCommand(int client, const char *cmd);
const char *GetGroupName(GroupId gid);
unsigned int SetGroupImmunityLevel(GroupId gid, unsigned int level);
unsigned int GetGroupImmunityLevel(GroupId gid);
unsigned int SetAdminImmunityLevel(AdminId id, unsigned int level);
unsigned int GetAdminImmunityLevel(AdminId id);
bool CheckAccess(int client,
const char *cmd,
FlagBits flags,
bool override_only);
bool FindFlagChar(AdminFlag flag, char *c);
bool IsValidAdmin(AdminId id);
bool CheckClientCommandAccess(int client, const char *cmd, FlagBits cmdflags);
public:
bool DumpCache(const char *filename);
AdminGroup *GetGroup(GroupId gid);
AdminUser *GetUser(AdminId id);
const char *GetString(int idx);
bool CheckAdminCommandAccess(AdminId adm, const char *cmd, FlagBits flags);
private:
void _UnsetCommandOverride(const char *cmd);
void _UnsetCommandGroupOverride(const char *group);
void InvalidateGroupCache();
void InvalidateAdminCache(bool unlink_admins);
void DumpCommandOverrideCache(OverrideType type);
AuthMethod *GetMethodByIndex(unsigned int index);
bool GetMethodIndex(const char *name, unsigned int *_index);
const char *GetMethodName(unsigned int index);
void NameFlag(const char *str, AdminFlag flag);
bool GetUnifiedSteamIdentity(const char *ident, char *out, size_t maxlen);
public:
typedef StringHashMap<FlagBits> FlagMap;
BaseStringTable *m_pStrings;
BaseMemTable *m_pMemory;
FlagMap m_CmdOverrides;
FlagMap m_CmdGrpOverrides;
int m_FirstGroup;
int m_LastGroup;
int m_FreeGroupList;
StringHashMap<GroupId> m_Groups;
List<IAdminListener *> m_hooks;
List<AuthMethod *> m_AuthMethods;
NameHashSet<AuthMethod *> m_AuthTables;
IForward *m_pCacheFwd;
int m_FirstUser;
int m_LastUser;
int m_FreeUserList;
bool m_InvalidatingAdmins;
bool m_destroying;
StringHashMap<AdminFlag> m_LevelNames;
};
extern AdminCache g_Admins;
#endif //_INCLUDE_SOURCEMOD_ADMINCACHE_H_
+105 -89
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.
@@ -30,12 +30,10 @@
*/
#include "Database.h"
#include "ISourceMod.h"
#include "HandleSys.h"
#include "ShareSys.h"
#include "sourcemod.h"
#include "sm_stringutil.h"
#include "Logger.h"
#include "ExtensionSys.h"
#include "PluginSys.h"
#include <stdlib.h>
#include <IThreader.h>
@@ -47,10 +45,18 @@ DBManager g_DBMan;
static bool s_OneTimeThreaderErrorMsg = false;
DBManager::DBManager()
: m_ParseLevel(0), m_ParseState(0), m_pDefault(NULL)
: m_Terminate(false),
m_ParseLevel(0),
m_ParseState(0),
m_pDefault(NULL)
{
}
static void FrameHook(bool simulating)
{
g_DBMan.RunFrame();
}
void DBManager::OnSourceModAllInitialized()
{
HandleAccess sec;
@@ -64,13 +70,11 @@ void DBManager::OnSourceModAllInitialized()
g_ShareSys.AddInterface(NULL, this);
g_SourceMod.BuildPath(Path_SM, m_Filename, sizeof(m_Filename), "configs/databases.cfg");
m_pConfigLock = g_pThreader->MakeMutex();
m_pThinkLock = g_pThreader->MakeMutex();
m_pQueueLock = g_pThreader->MakeMutex();
g_pSM->BuildPath(Path_SM, m_Filename, sizeof(m_Filename), "configs/databases.cfg");
g_PluginSys.AddPluginsListener(this);
g_pSM->AddGameFrameHook(&FrameHook);
}
void DBManager::OnSourceModLevelChange(const char *mapName)
@@ -82,26 +86,23 @@ void DBManager::OnSourceModLevelChange(const char *mapName)
* This way the thread's search won't be searching through a
* potentially empty/corrupt list, which would be very bad.
*/
m_pConfigLock->Lock();
ke::AutoLock lock(&m_ConfigLock);
if ((err = textparsers->ParseFile_SMC(m_Filename, this, &states)) != SMCError_Okay)
{
g_Logger.LogError("[SM] Detected parse error(s) in file \"%s\"", m_Filename);
logger->LogError("[SM] Detected parse error(s) in file \"%s\"", m_Filename);
if (err != SMCError_Custom)
{
const char *txt = textparsers->GetSMCErrorString(err);
g_Logger.LogError("[SM] Line %d: %s", states.line, txt);
logger->LogError("[SM] Line %d: %s", states.line, txt);
}
}
m_pConfigLock->Unlock();
}
void DBManager::OnSourceModShutdown()
{
g_pSM->RemoveGameFrameHook(&FrameHook);
KillWorkerThread();
g_PluginSys.RemovePluginsListener(this);
m_pConfigLock->DestroyThis();
m_pThinkLock->DestroyThis();
m_pQueueLock->DestroyThis();
g_HandleSys.RemoveType(m_DatabaseType, g_pCoreIdent);
g_HandleSys.RemoveType(m_DriverType, g_pCoreIdent);
ClearConfigs();
@@ -270,7 +271,7 @@ bool DBManager::Connect(const char *name, IDBDriver **pdr, IDatabase **pdb, bool
*pdr = NULL;
}
*pdb = NULL;
UTIL_Format(error, maxlength, "Configuration \"%s\" not found", name);
g_pSM->Format(error, maxlength, "Configuration \"%s\" not found", name);
return false;
}
@@ -307,7 +308,7 @@ bool DBManager::Connect(const char *name, IDBDriver **pdr, IDatabase **pdb, bool
}
*pdb = NULL;
UTIL_Format(error, maxlength, "Driver \"%s\" not found", dname);
g_pSM->Format(error, maxlength, "Driver \"%s\" not found", dname);
return false;
}
@@ -352,6 +353,12 @@ void DBManager::RemoveDriver(IDBDriver *pDriver)
}
}
/* Someone unloaded the default driver? Silly.. */
if (pDriver == m_pDefault)
{
m_pDefault = NULL;
}
/* Now that the driver is gone, we have to test the think queue.
* Whatever happens therein is up to the db op!
*/
@@ -483,7 +490,7 @@ IDBDriver *DBManager::FindOrLoadDriver(const char *name)
}
char filename[PLATFORM_MAX_PATH];
UTIL_Format(filename, sizeof(filename), "dbi.%s.ext", name);
g_pSM->Format(filename, sizeof(filename), "dbi.%s.ext", name);
IExtension *pExt = g_Extensions.LoadAutoExtension(filename);
if (!pExt || !pExt->IsLoaded() || m_drivers.size() <= last_size)
@@ -504,12 +511,17 @@ IDBDriver *DBManager::FindOrLoadDriver(const char *name)
void DBManager::KillWorkerThread()
{
if (m_pWorker)
if (m_Worker)
{
m_pWorker->Stop(false);
g_pThreader->DestroyWorker(m_pWorker);
m_pWorker = NULL;
{
ke::AutoLock lock(&m_QueueEvent);
m_Terminate = true;
m_QueueEvent.Notify();
}
m_Worker->Join();
m_Worker = NULL;
s_OneTimeThreaderErrorMsg = false;
m_Terminate = false;
}
}
@@ -522,99 +534,106 @@ bool DBManager::AddToThreadQueue(IDBThreadOperation *op, PrioQueueLevel prio)
return false;
}
if (!m_pWorker)
if (!m_Worker)
{
m_pWorker = g_pThreader->MakeWorker(this, true);
if (!m_pWorker)
m_Worker = new ke::Thread(this, "SM SQL Worker");
if (!m_Worker->Succeeded())
{
if (!s_OneTimeThreaderErrorMsg)
{
g_Logger.LogError("[SM] Unable to create db threader (error unknown)");
logger->LogError("[SM] Unable to create db threader (error unknown)");
s_OneTimeThreaderErrorMsg = true;
}
return false;
}
if (!m_pWorker->Start())
{
if (!s_OneTimeThreaderErrorMsg)
{
g_Logger.LogError("[SM] Unable to start db threader (error unknown)");
s_OneTimeThreaderErrorMsg = true;
}
g_pThreader->DestroyWorker(m_pWorker);
m_pWorker = NULL;
m_Worker = NULL;
return false;
}
}
/* Add to the queue */
{
m_pQueueLock->Lock();
ke::AutoLock lock(&m_QueueEvent);
Queue<IDBThreadOperation *> &queue = m_OpQueue.GetQueue(prio);
queue.push(op);
m_pQueueLock->Unlock();
m_QueueEvent.Notify();
}
/* Make the thread */
m_pWorker->MakeThread(this);
return true;
}
void DBManager::OnWorkerStart(IThreadWorker *pWorker)
void DBManager::Run()
{
m_drSafety.clear();
for (size_t i=0; i<m_drivers.size(); i++)
// Initialize DB threadsafety.
for (size_t i=0; i < m_drivers.size(); i++)
{
if (m_drivers[i]->IsThreadSafe())
{
m_drSafety.push_back(m_drivers[i]->InitializeThreadSafety());
} else {
else
m_drSafety.push_back(false);
}
}
}
void DBManager::OnWorkerStop(IThreadWorker *pWorker)
{
// Run actual worker thread logic.
ThreadMain();
// Shutdown DB threadsafety.
for (size_t i=0; i<m_drivers.size(); i++)
{
if (m_drSafety[i])
{
m_drivers[i]->ShutdownThreadSafety();
}
}
m_drSafety.clear();
}
void DBManager::RunThread(IThreadHandle *pThread)
void DBManager::ThreadMain()
{
IDBThreadOperation *op = NULL;
ke::AutoLock lock(&m_QueueEvent);
/* Get something from the queue */
{
m_pQueueLock->Lock();
Queue<IDBThreadOperation *> &queue = m_OpQueue.GetLikelyQueue();
if (!queue.empty())
while (true) {
// The lock has been acquired. Grab everything we can out of the
// queue. Since we want to flush the queue even if we're terminated,
// we process all operations we can before checking to terminate.
// There's no risk of starvation since the main thread blocks on us
// terminating.
while (true)
{
op = queue.first();
Queue<IDBThreadOperation *> &queue = m_OpQueue.GetLikelyQueue();
if (queue.empty())
break;
IDBThreadOperation *op = queue.first();
queue.pop();
// Unlock the queue when we run the query, so the main thread can
// keep pumping events. We re-acquire the lock to check for more
// items. It's okay if we terminate while unlocked; the main
// thread would be blocked and we'd need to flush the queue
// anyway, so after we've depleted the queue here, we'll just
// reach the terminate at the top of the loop.
{
ke::AutoUnlock unlock(&m_QueueEvent);
op->RunThreadPart();
ke::AutoLock lock(&m_ThinkLock);
m_ThinkQueue.push(op);
}
if (!m_Terminate)
{
ke::AutoUnlock unlock(&m_QueueEvent);
#ifdef _WIN32
Sleep(20);
#else
usleep(20000);
#endif
}
}
m_pQueueLock->Unlock();
if (m_Terminate)
return;
// Release the lock and wait for a signal.
m_QueueEvent.Wait();
}
/* whoa. hi. did we get something? we should have. */
if (!op)
{
/* wtf? */
return;
}
op->RunThreadPart();
m_pThinkLock->Lock();
m_ThinkQueue.push(op);
m_pThinkLock->Unlock();
}
void DBManager::RunFrame()
@@ -626,19 +645,16 @@ void DBManager::RunFrame()
}
/* Dump one thing per-frame so the server stays sane. */
m_pThinkLock->Lock();
IDBThreadOperation *op = m_ThinkQueue.first();
m_ThinkQueue.pop();
m_pThinkLock->Unlock();
IDBThreadOperation *op;
{
ke::AutoLock lock(&m_ThinkLock);
op = m_ThinkQueue.first();
m_ThinkQueue.pop();
}
op->RunThinkPart();
op->Destroy();
}
void DBManager::OnTerminate(IThreadHandle *pThread, bool cancel)
{
/* Do nothing */
}
void DBManager::OnSourceModIdentityDropped(IdentityToken_t *pToken)
{
s_pAddBlock = pToken;
@@ -714,12 +730,12 @@ void DBManager::OnPluginUnloaded(IPlugin *plugin)
void DBManager::LockConfig()
{
m_pConfigLock->Lock();
m_ConfigLock.Lock();
}
void DBManager::UnlockConfig()
{
m_pConfigLock->Unlock();
m_ConfigLock.Unlock();
}
const char *DBManager::GetDefaultDriverName()
+14 -17
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.
@@ -33,15 +33,15 @@
#define _INCLUDE_DATABASE_MANAGER_H_
#include <IDBDriver.h>
#include "sm_globals.h"
#include "common_logic.h"
#include <sh_vector.h>
#include <sh_string.h>
#include <sh_list.h>
#include <ITextParsers.h>
#include "sm_memtable.h"
#include <IThreader.h>
#include <IPluginSys.h>
#include <am-thread-utils.h>
#include "sm_simple_prioqueue.h"
#include "PluginSys.h"
using namespace SourceHook;
@@ -65,9 +65,8 @@ class DBManager :
public SMGlobalClass,
public IHandleTypeDispatch,
public ITextListener_SMC,
public IThread,
public IThreadWorkerCallbacks,
public IPluginsListener
public IPluginsListener,
public ke::IRunnable
{
public:
DBManager();
@@ -98,12 +97,9 @@ public: //ITextListener_SMC
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
SMCResult ReadSMC_LeavingSection(const SMCStates *states);
void ReadSMC_ParseEnd(bool halted, bool failed);
public: //IThread
void RunThread(IThreadHandle *pThread);
void OnTerminate(IThreadHandle *pThread, bool cancel);
public: //IThreadWorkerCallbacks
void OnWorkerStart(IThreadWorker *pWorker);
void OnWorkerStop(IThreadWorker *pWorker);
public: //ke::IRunnable
void Run();
void ThreadMain();
public: //IPluginsListener
void OnPluginUnloaded(IPlugin *plugin);
public:
@@ -129,10 +125,11 @@ private:
PrioQueue<IDBThreadOperation *> m_OpQueue;
Queue<IDBThreadOperation *> m_ThinkQueue;
CVector<bool> m_drSafety; /* which drivers are safe? */
IThreadWorker *m_pWorker; /* Worker thread object */
IMutex *m_pConfigLock; /* Configuration lock */
IMutex *m_pQueueLock; /* Queue safety lock */
IMutex *m_pThinkLock; /* Think-queue lock */
ke::AutoPtr<ke::Thread> m_Worker;
ke::ConditionVariable m_QueueEvent;
ke::Mutex m_ConfigLock;
ke::Mutex m_ThinkLock;
bool m_Terminate;
List<ConfDbInfo *> m_confs;
HandleType_t m_DriverType;
@@ -29,10 +29,10 @@
* Version: $Id$
*/
#include <IPluginSys.h>
#include <stdarg.h>
#include "DebugReporter.h"
#include "Logger.h"
#include "PluginSys.h"
#include "sm_stringutil.h"
DebugReport g_DbgReporter;
@@ -47,7 +47,7 @@ void DebugReport::OnDebugSpew(const char *msg, ...)
char buffer[512];
va_start(ap, msg);
UTIL_FormatArgs(buffer, sizeof(buffer), msg, ap);
smcore.FormatArgs(buffer, sizeof(buffer), msg, ap);
va_end(ap);
g_Logger.LogMessage("[SM] %s", buffer);
@@ -65,9 +65,9 @@ void DebugReport::GenerateError(IPluginContext *ctx, cell_t func_idx, int err, c
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);
smcore.FormatArgs(buffer, sizeof(buffer), message, ap);
const char *plname = g_PluginSys.FindPluginByContext(ctx->GetContext())->GetFilename();
const char *plname = pluginsys->FindPluginByContext(ctx->GetContext())->GetFilename();
const char *error = g_pSourcePawn2->GetErrorString(err);
if (error)
@@ -99,10 +99,10 @@ void DebugReport::GenerateCodeError(IPluginContext *pContext, uint32_t code_addr
char buffer[512];
va_start(ap, message);
UTIL_FormatArgs(buffer, sizeof(buffer), message, ap);
smcore.FormatArgs(buffer, sizeof(buffer), message, ap);
va_end(ap);
const char *plname = g_PluginSys.FindPluginByContext(pContext->GetContext())->GetFilename();
const char *plname = pluginsys->FindPluginByContext(pContext->GetContext())->GetFilename();
const char *error = g_pSourcePawn2->GetErrorString(err);
if (error)
@@ -135,7 +135,7 @@ void DebugReport::GenerateCodeError(IPluginContext *pContext, uint32_t code_addr
void DebugReport::OnContextExecuteError(IPluginContext *ctx, IContextTrace *error)
{
const char *lastname;
const char *plname = g_PluginSys.FindPluginByContext(ctx->GetContext())->GetFilename();
const char *plname = pluginsys->FindPluginByContext(ctx->GetContext())->GetFilename();
int n_err = error->GetErrorCode();
if (n_err != SP_ERROR_NATIVE)
@@ -180,7 +180,7 @@ void DebugReport::OnContextExecuteError(IPluginContext *ctx, IContextTrace *erro
int DebugReport::_GetPluginIndex(IPluginContext *ctx)
{
int id = 1;
IPluginIterator *iter = g_PluginSys.GetPluginIterator();
IPluginIterator *iter = pluginsys->GetPluginIterator();
for (; iter->MorePlugins(); iter->NextPlugin(), id++)
{
@@ -196,6 +196,6 @@ int DebugReport::_GetPluginIndex(IPluginContext *ctx)
/* If we don't know which plugin this is, it's one being loaded. Fake its index for now. */
return g_PluginSys.GetPluginCount() + 1;
return pluginsys->GetPluginCount() + 1;
}
@@ -33,7 +33,7 @@
#define _INCLUDE_SOURCEMOD_CDBGREPORTER_H_
#include "sp_vm_api.h"
#include "sm_globals.h"
#include "common_logic.h"
class DebugReport :
public SMGlobalClass,
@@ -31,12 +31,11 @@
#include <stdlib.h>
#include "ExtensionSys.h"
#include "LibrarySys.h"
#include "ShareSys.h"
#include "Logger.h"
#include "sourcemm_api.h"
#include "sm_srvcmds.h"
#include "sm_stringutil.h"
#include <ILibrarySys.h>
#include <ISourceMod.h>
#include "common_logic.h"
#include "PluginSys.h"
#include <am-utility.h>
CExtensionManager g_Extensions;
IdentityType_t g_ExtType;
@@ -50,7 +49,7 @@ void CExtension::Initialize(const char *filename, const char *path)
m_File.assign(filename);
m_Path.assign(path);
char real_name[PLATFORM_MAX_PATH];
g_LibSys.GetFileFromPath(real_name, sizeof(real_name), m_Path.c_str());
libsys->GetFileFromPath(real_name, sizeof(real_name), m_Path.c_str());
m_RealFile.assign(real_name);
}
@@ -60,30 +59,6 @@ CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filena
m_pAPI = pAPI;
}
#if defined METAMOD_PLAPI_VERSION
#if SOURCE_ENGINE == SE_LEFT4DEAD
#define GAMEFIX "2.l4d"
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
#define GAMEFIX "2.l4d2"
#elif SOURCE_ENGINE == SE_ALIENSWARM
#define GAMEFIX "2.swarm"
#elif SOURCE_ENGINE == SE_ORANGEBOX
#define GAMEFIX "2.ep2"
#elif SOURCE_ENGINE == SE_BLOODYGOODTIME
#define GAMEFIX "2.bgt"
#elif SOURCE_ENGINE == SE_EYE
#define GAMEFIX "2.eye"
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE
#define GAMEFIX "2.ep2v"
#elif SOURCE_ENGINE == SE_DARKMESSIAH
#define GAMEFIX "2.darkm"
#else
#define GAMEFIX "2.ep1"
#endif //(SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
#else //METAMOD_PLAPI_VERSION
#define GAMEFIX "1.ep1"
#endif //METAMOD_PLAPI_VERSION
CLocalExtension::CLocalExtension(const char *filename)
{
m_PlId = 0;
@@ -98,29 +73,62 @@ CLocalExtension::CLocalExtension(const char *filename)
}
/* Zeroth, see if there is an engine specific build in the new place. */
g_SourceMod.BuildPath(Path_SM,
g_pSM->BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
"extensions/%s." GAMEFIX "." PLATFORM_LIB_EXT,
filename);
"extensions/%s.%s." PLATFORM_LIB_EXT,
filename,
smcore.gamesuffix);
if (g_LibSys.IsPathFile(path))
if (libsys->IsPathFile(path))
{
goto found;
}
/* COMPAT HACK: One-halfth, if ep2v, see if there is an engine specific build in the new place with old naming */
if (strcmp(smcore.gamesuffix, "2.tf2") == 0
|| strcmp(smcore.gamesuffix, "2.dods") == 0
|| strcmp(smcore.gamesuffix, "2.hl2dm") == 0
)
{
g_pSM->BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
"extensions/%s.2.ep2v." PLATFORM_LIB_EXT,
filename);
if (libsys->IsPathFile(path))
{
goto found;
}
}
else if (strcmp(smcore.gamesuffix, "2.nd") == 0)
{
g_pSM->BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
"extensions/%s.2.l4d2." PLATFORM_LIB_EXT,
filename);
if (libsys->IsPathFile(path))
{
goto found;
}
}
/* First see if there is an engine specific build! */
g_SourceMod.BuildPath(Path_SM,
g_pSM->BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
"extensions/auto." GAMEFIX "/%s." PLATFORM_LIB_EXT,
filename);
"extensions/auto.%s/%s." PLATFORM_LIB_EXT,
filename,
smcore.gamesuffix);
normal:
/* Try the "normal" version */
if (!g_LibSys.IsPathFile(path))
if (!libsys->IsPathFile(path))
{
g_SourceMod.BuildPath(Path_SM,
normal:
g_pSM->BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
"extensions/%s." PLATFORM_LIB_EXT,
@@ -150,7 +158,7 @@ bool CRemoteExtension::Load(char *error, size_t maxlength)
bool CLocalExtension::Load(char *error, size_t maxlength)
{
m_pLib = g_LibSys.OpenLibrary(m_Path.c_str(), error, maxlength);
m_pLib = libsys->OpenLibrary(m_Path.c_str(), error, maxlength);
if (m_pLib == NULL)
{
@@ -182,24 +190,10 @@ bool CLocalExtension::Load(char *error, size_t maxlength)
/* Load as MM:S */
if (m_pAPI->IsMetamodExtension())
{
bool already;
m_PlId = g_pMMPlugins->Load(m_Path.c_str(), g_PLID, already, error, maxlength);
bool ok;
m_PlId = smcore.LoadMMSPlugin(m_Path.c_str(), &ok, 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))
if (!m_PlId || !ok)
{
m_pLib->CloseLibrary();
m_pLib = NULL;
@@ -214,8 +208,7 @@ bool CLocalExtension::Load(char *error, size_t maxlength)
{
if (m_PlId)
{
char dummy[255];
g_pMMPlugins->Unload(m_PlId, true, dummy, sizeof(dummy));
smcore.UnloadMMSPlugin(m_PlId);
m_PlId = 0;
}
}
@@ -236,8 +229,7 @@ void CLocalExtension::Unload()
{
if (m_pAPI != NULL && m_PlId)
{
char temp_buffer[255];
g_pMMPlugins->Unload(m_PlId, true, temp_buffer, sizeof(temp_buffer));
smcore.UnloadMMSPlugin(m_PlId);
m_PlId = 0;
}
@@ -300,7 +292,7 @@ bool CExtension::PerformAPICheck(char *error, size_t maxlength)
bool CExtension::Load(char *error, size_t maxlength)
{
CreateIdentity();
if (!m_pAPI->OnExtensionLoad(this, &g_ShareSys, error, maxlength, !g_SourceMod.IsMapLoading()))
if (!m_pAPI->OnExtensionLoad(this, &g_ShareSys, error, maxlength, !smcore.IsMapLoading()))
{
DestroyIdentity();
return false;
@@ -308,7 +300,7 @@ bool CExtension::Load(char *error, size_t maxlength)
else
{
/* Check if we're past load time */
if (!g_SourceMod.IsMapLoading())
if (!smcore.IsMapLoading())
{
m_pAPI->OnExtensionsAllLoaded();
}
@@ -351,7 +343,7 @@ void CExtension::MarkAllLoaded()
void CExtension::AddPlugin(CPlugin *pPlugin)
{
/* Unfortunately we have to do this :( */
if (m_Dependents.find(pPlugin) != m_Dependents.end())
if (m_Dependents.find(pPlugin) == m_Dependents.end())
{
m_Dependents.push_back(pPlugin);
}
@@ -518,14 +510,15 @@ void CExtension::AddLibrary(const char *library)
void CExtensionManager::OnSourceModAllInitialized()
{
g_ExtType = g_ShareSys.CreateIdentType("EXTENSION");
g_PluginSys.AddPluginsListener(this);
g_RootMenu.AddRootConsoleCommand("exts", "Manage extensions", this);
pluginsys->AddPluginsListener(this);
rootmenu->AddRootConsoleCommand("exts", "Manage extensions", this);
g_ShareSys.AddInterface(NULL, this);
}
void CExtensionManager::OnSourceModShutdown()
{
g_RootMenu.RemoveRootConsoleCommand("exts", this);
rootmenu->RemoveRootConsoleCommand("exts", this);
pluginsys->RemovePluginsListener(this);
g_ShareSys.DestroyIdentType(g_ExtType);
}
@@ -543,13 +536,11 @@ void CExtensionManager::TryAutoload()
{
char path[PLATFORM_MAX_PATH];
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "extensions");
g_pSM->BuildPath(Path_SM, path, sizeof(path), "extensions");
IDirectory *pDir = g_LibSys.OpenDirectory(path);
ke::AutoPtr<IDirectory> pDir(libsys->OpenDirectory(path));
if (!pDir)
{
return;
}
const char *lfile;
size_t len;
@@ -576,7 +567,7 @@ void CExtensionManager::TryAutoload()
}
char file[PLATFORM_MAX_PATH];
len = UTIL_Format(file, sizeof(file), "%s", lfile);
len = smcore.Format(file, sizeof(file), "%s", lfile);
strcpy(&file[len - 9], ".ext");
LoadAutoExtension(file);
@@ -588,11 +579,11 @@ void CExtensionManager::TryAutoload()
IExtension *CExtensionManager::LoadAutoExtension(const char *path, bool bErrorOnMissing)
{
/* Remove platform extension if it's there. Compat hack. */
const char *ext = g_LibSys.GetFileExtension(path);
const char *ext = libsys->GetFileExtension(path);
if (strcmp(ext, PLATFORM_LIB_EXT) == 0)
{
char path2[PLATFORM_MAX_PATH];
UTIL_Format(path2, sizeof(path2), "%s", path);
smcore.Format(path2, sizeof(path2), "%s", path);
path2[strlen(path) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
return LoadAutoExtension(path2, bErrorOnMissing);
}
@@ -613,11 +604,11 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path, bool bErrorOn
if (!p->Load(error, sizeof(error)) || !p->IsLoaded())
{
if (bErrorOnMissing || g_LibSys.IsPathFile(p->GetPath()))
if (bErrorOnMissing || libsys->IsPathFile(p->GetPath()))
{
g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
logger->LogError("[SM] Unable to load extension \"%s\": %s", path, error);
}
p->SetError(error);
}
@@ -631,7 +622,7 @@ IExtension *CExtensionManager::FindExtensionByFile(const char *file)
/* Chomp off the path */
char lookup[PLATFORM_MAX_PATH];
g_LibSys.GetFileFromPath(lookup, sizeof(lookup), file);
libsys->GetFileFromPath(lookup, sizeof(lookup), file);
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
@@ -680,11 +671,11 @@ IExtension *CExtensionManager::FindExtensionByName(const char *ext)
IExtension *CExtensionManager::LoadExtension(const char *file, char *error, size_t maxlength)
{
/* Remove platform extension if it's there. Compat hack. */
const char *ext = g_LibSys.GetFileExtension(file);
const char *ext = libsys->GetFileExtension(file);
if (strcmp(ext, PLATFORM_LIB_EXT) == 0)
{
char path2[PLATFORM_MAX_PATH];
UTIL_Format(path2, sizeof(path2), "%s", file);
smcore.Format(path2, sizeof(path2), "%s", file);
path2[strlen(file) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
return LoadExtension(path2, error, maxlength);
}
@@ -746,11 +737,11 @@ void CExtensionManager::AddInterface(IExtension *pOwner, SMInterface *pInterface
pExt->AddInterface(pInterface);
}
void CExtensionManager::BindChildPlugin( IExtension *pParent, CPlugin *pPlugin )
void CExtensionManager::BindChildPlugin(IExtension *pParent, SMPlugin *pPlugin)
{
CExtension *pExt = (CExtension *)pParent;
pExt->AddPlugin(pPlugin);
pExt->AddPlugin(static_cast<CPlugin *>(pPlugin));
}
void CExtensionManager::OnPluginDestroyed(IPlugin *plugin)
@@ -759,7 +750,7 @@ void CExtensionManager::OnPluginDestroyed(IPlugin *plugin)
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
(*iter)->DropRefsTo((CPlugin *)plugin);
(*iter)->DropRefsTo(static_cast<CPlugin *>(plugin));
}
}
@@ -787,18 +778,21 @@ CExtension *CExtensionManager::FindByOrder(unsigned int num)
bool CExtensionManager::UnloadExtension(IExtension *_pExt)
{
if (!_pExt)
{
return false;
}
CExtension *pExt = (CExtension *)_pExt;
if (m_Libs.find(pExt) == m_Libs.end())
{
return false;
}
/* First remove us from internal lists */
/* Tell it to unload */
if (pExt->IsLoaded())
pExt->GetAPI()->OnExtensionUnload();
// Remove us from internal lists. Note that because we do this, it's
// possible that our extension could be added back if another plugin
// tries to load during this process. If we ever find this to happen,
// we can just block plugin loading.
g_ShareSys.RemoveInterfaces(_pExt);
m_Libs.remove(pExt);
@@ -812,7 +806,7 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
while (p_iter != pExt->m_Dependents.end())
{
/* We have to manually unlink ourselves here, since we're no longer being managed */
g_PluginSys.UnloadPlugin((*p_iter));
scripts->UnloadPlugin((*p_iter));
p_iter = pExt->m_Dependents.erase(p_iter);
}
@@ -821,7 +815,7 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
s_iter != pExt->m_Libraries.end();
s_iter++)
{
g_PluginSys.OnLibraryAction((*s_iter).c_str(), false, true);
scripts->OnLibraryAction((*s_iter).c_str(), LibraryAction_Removed);
}
/* Notify and/or unload all dependencies */
@@ -832,13 +826,9 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
{
pDep = (*c_iter);
if ((pAPI=pDep->GetAPI()) == NULL)
{
continue;
}
if (pDep == pExt)
{
continue;
}
/* Now, get its dependency list */
bool dropped = false;
List<IfaceInfo>::iterator i_iter = pDep->m_Deps.begin();
@@ -867,13 +857,9 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
while (i_iter != pDep->m_ChildDeps.end())
{
if ((*i_iter).owner == pExt)
{
i_iter = pDep->m_ChildDeps.erase(i_iter);
}
else
{
i_iter++;
}
}
}
@@ -892,12 +878,10 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
}
}
/* Tell it to unload */
if (pExt->IsLoaded())
{
IExtensionInterface *pAPI = pExt->GetAPI();
pAPI->OnExtensionUnload();
}
// Everything has been informed that we're unloading, so give the
// extension one last notification.
if (pExt->IsLoaded() && pExt->GetAPI()->GetExtensionVersion() >= 7)
pExt->GetAPI()->OnDependenciesDropped();
pExt->Unload();
delete pExt;
@@ -946,10 +930,10 @@ void CExtensionManager::AddDependency(IExtension *pSource, const char *file, boo
void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand &command)
{
int argcount = command.ArgC();
int argcount = smcore.Argc(command);
if (argcount >= 3)
{
const char *cmd = command.Arg(2);
const char *cmd = smcore.Arg(command, 2);
if (strcmp(cmd, "list") == 0)
{
List<CExtension *>::iterator iter;
@@ -959,17 +943,17 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
{
case 1:
{
g_RootMenu.ConsolePrint("[SM] Displaying 1 extension:");
rootmenu->ConsolePrint("[SM] Displaying 1 extension:");
break;
}
case 0:
{
g_RootMenu.ConsolePrint("[SM] No extensions are loaded.");
rootmenu->ConsolePrint("[SM] No extensions are loaded.");
break;
}
default:
{
g_RootMenu.ConsolePrint("[SM] Displaying %d extensions:", m_Libs.size());
rootmenu->ConsolePrint("[SM] Displaying %d extensions:", m_Libs.size());
break;
}
}
@@ -981,7 +965,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
char error[255];
if (!pExt->IsRunning(error, sizeof(error)))
{
g_RootMenu.ConsolePrint("[%02d] <FAILED> file \"%s\": %s", num, pExt->GetFilename(), error);
rootmenu->ConsolePrint("[%02d] <FAILED> file \"%s\": %s", num, pExt->GetFilename(), error);
}
else
{
@@ -989,10 +973,10 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
const char *name = pAPI->GetExtensionName();
const char *version = pAPI->GetExtensionVerString();
const char *descr = pAPI->GetExtensionDescription();
g_RootMenu.ConsolePrint("[%02d] %s (%s): %s", num, name, version, descr);
rootmenu->ConsolePrint("[%02d] %s (%s): %s", num, name, version, descr);
}
} else {
g_RootMenu.ConsolePrint("[%02d] <FAILED> file \"%s\": %s", num, pExt->GetFilename(), pExt->m_Error.c_str());
rootmenu->ConsolePrint("[%02d] <FAILED> file \"%s\": %s", num, pExt->GetFilename(), pExt->m_Error.c_str());
}
}
return;
@@ -1001,29 +985,29 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
{
if (argcount < 4)
{
g_RootMenu.ConsolePrint("[SM] Usage: sm exts load <file>");
rootmenu->ConsolePrint("[SM] Usage: sm exts load <file>");
return;
}
const char *filename = command.Arg(3);
const char *filename = smcore.Arg(command, 3);
char path[PLATFORM_MAX_PATH];
char error[256];
UTIL_Format(path, sizeof(path), "%s%s%s", filename, !strstr(filename, ".ext") ? ".ext" : "",
smcore.Format(path, sizeof(path), "%s%s%s", filename, !strstr(filename, ".ext") ? ".ext" : "",
!strstr(filename, "." PLATFORM_LIB_EXT) ? "." PLATFORM_LIB_EXT : "");
if (FindExtensionByFile(path) != NULL)
{
g_RootMenu.ConsolePrint("[SM] Extension %s is already loaded.", path);
rootmenu->ConsolePrint("[SM] Extension %s is already loaded.", path);
return;
}
if (LoadExtension(path, error, sizeof(error)))
{
g_RootMenu.ConsolePrint("[SM] Loaded extension %s successfully.", path);
rootmenu->ConsolePrint("[SM] Loaded extension %s successfully.", path);
} else
{
g_RootMenu.ConsolePrint("[SM] Extension %s failed to load: %s", path, error);
rootmenu->ConsolePrint("[SM] Extension %s failed to load: %s", path, error);
}
return;
@@ -1032,27 +1016,27 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
{
if (argcount < 4)
{
g_RootMenu.ConsolePrint("[SM] Usage: sm exts info <#>");
rootmenu->ConsolePrint("[SM] Usage: sm exts info <#>");
return;
}
const char *sId = command.Arg(3);
const char *sId = smcore.Arg(command, 3);
unsigned int id = atoi(sId);
if (id <= 0)
{
g_RootMenu.ConsolePrint("[SM] Usage: sm exts info <#>");
rootmenu->ConsolePrint("[SM] Usage: sm exts info <#>");
return;
}
if (m_Libs.size() == 0)
{
g_RootMenu.ConsolePrint("[SM] No extensions are loaded.");
rootmenu->ConsolePrint("[SM] No extensions are loaded.");
return;
}
if (id > m_Libs.size())
{
g_RootMenu.ConsolePrint("[SM] No extension was found with id %d.", id);
rootmenu->ConsolePrint("[SM] No extension was found with id %d.", id);
return;
}
@@ -1070,44 +1054,44 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
/* This should never happen */
if (!pExt)
{
g_RootMenu.ConsolePrint("[SM] No extension was found with id %d.", id);
rootmenu->ConsolePrint("[SM] No extension was found with id %d.", id);
return;
}
if (!pExt->IsLoaded())
{
g_RootMenu.ConsolePrint(" File: %s", pExt->GetFilename());
g_RootMenu.ConsolePrint(" Loaded: No (%s)", pExt->m_Error.c_str());
rootmenu->ConsolePrint(" File: %s", pExt->GetFilename());
rootmenu->ConsolePrint(" Loaded: No (%s)", pExt->m_Error.c_str());
}
else
{
char error[255];
if (!pExt->IsRunning(error, sizeof(error)))
{
g_RootMenu.ConsolePrint(" File: %s", pExt->GetFilename());
g_RootMenu.ConsolePrint(" Loaded: Yes");
g_RootMenu.ConsolePrint(" Running: No (%s)", error);
rootmenu->ConsolePrint(" File: %s", pExt->GetFilename());
rootmenu->ConsolePrint(" Loaded: Yes");
rootmenu->ConsolePrint(" Running: No (%s)", error);
}
else
{
IExtensionInterface *pAPI = pExt->GetAPI();
g_RootMenu.ConsolePrint(" File: %s", pExt->GetFilename());
g_RootMenu.ConsolePrint(" Loaded: Yes (version %s)", pAPI->GetExtensionVerString());
g_RootMenu.ConsolePrint(" Name: %s (%s)", pAPI->GetExtensionName(), pAPI->GetExtensionDescription());
g_RootMenu.ConsolePrint(" Author: %s (%s)", pAPI->GetExtensionAuthor(), pAPI->GetExtensionURL());
g_RootMenu.ConsolePrint(" Binary info: API version %d (compiled %s)", pAPI->GetExtensionVersion(), pAPI->GetExtensionDateString());
rootmenu->ConsolePrint(" File: %s", pExt->GetFilename());
rootmenu->ConsolePrint(" Loaded: Yes (version %s)", pAPI->GetExtensionVerString());
rootmenu->ConsolePrint(" Name: %s (%s)", pAPI->GetExtensionName(), pAPI->GetExtensionDescription());
rootmenu->ConsolePrint(" Author: %s (%s)", pAPI->GetExtensionAuthor(), pAPI->GetExtensionURL());
rootmenu->ConsolePrint(" Binary info: API version %d (compiled %s)", pAPI->GetExtensionVersion(), pAPI->GetExtensionDateString());
if (pExt->IsExternal())
{
g_RootMenu.ConsolePrint(" Method: Loaded by Metamod:Source, attached to SourceMod");
rootmenu->ConsolePrint(" Method: Loaded by Metamod:Source, attached to SourceMod");
}
else if (pAPI->IsMetamodExtension())
{
g_RootMenu.ConsolePrint(" Method: Loaded by SourceMod, attached to Metamod:Source");
rootmenu->ConsolePrint(" Method: Loaded by SourceMod, attached to Metamod:Source");
}
else
{
g_RootMenu.ConsolePrint(" Method: Loaded by SourceMod");
rootmenu->ConsolePrint(" Method: Loaded by SourceMod");
}
}
}
@@ -1117,33 +1101,33 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
{
if (argcount < 4)
{
g_RootMenu.ConsolePrint("[SM] Usage: sm exts unload <#> [code]");
rootmenu->ConsolePrint("[SM] Usage: sm exts unload <#> [code]");
return;
}
const char *arg = command.Arg(3);
const char *arg = smcore.Arg(command, 3);
unsigned int num = atoi(arg);
CExtension *pExt = FindByOrder(num);
if (!pExt)
{
g_RootMenu.ConsolePrint("[SM] Extension number %d was not found.", num);
rootmenu->ConsolePrint("[SM] Extension number %d was not found.", num);
return;
}
if (argcount > 4 && pExt->unload_code)
{
const char *unload = command.Arg(4);
const char *unload = smcore.Arg(command, 4);
if (pExt->unload_code == (unsigned)atoi(unload))
{
char filename[PLATFORM_MAX_PATH];
snprintf(filename, PLATFORM_MAX_PATH, "%s", pExt->GetFilename());
UnloadExtension(pExt);
g_RootMenu.ConsolePrint("[SM] Extension %s is now unloaded.", filename);
rootmenu->ConsolePrint("[SM] Extension %s is now unloaded.", filename);
}
else
{
g_RootMenu.ConsolePrint("[SM] Please try again, the correct unload code is \"%d\"", pExt->unload_code);
rootmenu->ConsolePrint("[SM] Please try again, the correct unload code is \"%d\"", pExt->unload_code);
}
return;
}
@@ -1154,7 +1138,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
char filename[PLATFORM_MAX_PATH];
snprintf(filename, PLATFORM_MAX_PATH, "%s", pExt->GetFilename());
UnloadExtension(pExt);
g_RootMenu.ConsolePrint("[SM] Extension %s is now unloaded.", filename);
rootmenu->ConsolePrint("[SM] Extension %s is now unloaded.", filename);
return;
}
else
@@ -1162,7 +1146,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
List<CPlugin *> plugins;
if (pExt->m_ChildDeps.size())
{
g_RootMenu.ConsolePrint("[SM] Unloading %s will unload the following extensions: ", pExt->GetFilename());
rootmenu->ConsolePrint("[SM] Unloading %s will unload the following extensions: ", pExt->GetFilename());
List<CExtension *>::iterator iter;
CExtension *pOther;
/* Get list of all extensions */
@@ -1187,7 +1171,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
/* Will our dependent care? */
if (!pExt->GetAPI()->QueryInterfaceDrop((*i_iter).iface))
{
g_RootMenu.ConsolePrint(" -> %s", pExt->GetFilename());
rootmenu->ConsolePrint(" -> %s", pExt->GetFilename());
/* Add to plugin unload list */
List<CPlugin *>::iterator p_iter;
for (p_iter=pOther->m_Dependents.begin();
@@ -1205,7 +1189,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
}
if (pExt->m_Dependents.size())
{
g_RootMenu.ConsolePrint("[SM] Unloading %s will unload the following plugins: ", pExt->GetFilename());
rootmenu->ConsolePrint("[SM] Unloading %s will unload the following plugins: ", pExt->GetFilename());
List<CPlugin *>::iterator iter;
CPlugin *pPlugin;
for (iter = pExt->m_Dependents.begin(); iter != pExt->m_Dependents.end(); iter++)
@@ -1219,13 +1203,13 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
for (iter = plugins.begin(); iter != plugins.end(); iter++)
{
pPlugin = (*iter);
g_RootMenu.ConsolePrint(" -> %s", pPlugin->GetFilename());
rootmenu->ConsolePrint(" -> %s", pPlugin->GetFilename());
}
}
srand(static_cast<int>(time(NULL)));
pExt->unload_code = (rand() % 877) + 123; //123 to 999
g_RootMenu.ConsolePrint("[SM] To verify unloading %s, please use the following: ", pExt->GetFilename());
g_RootMenu.ConsolePrint("[SM] sm exts unload %d %d", num, pExt->unload_code);
rootmenu->ConsolePrint("[SM] To verify unloading %s, please use the following: ", pExt->GetFilename());
rootmenu->ConsolePrint("[SM] sm exts unload %d %d", num, pExt->unload_code);
return;
}
@@ -1234,17 +1218,17 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
{
if (argcount < 4)
{
g_RootMenu.ConsolePrint("[SM] Usage: sm exts reload <#>");
rootmenu->ConsolePrint("[SM] Usage: sm exts reload <#>");
return;
}
const char *arg = command.Arg(3);
const char *arg = smcore.Arg(command, 3);
unsigned int num = atoi(arg);
CExtension *pExt = FindByOrder(num);
if (!pExt)
{
g_RootMenu.ConsolePrint("[SM] Extension number %d was not found.", num);
rootmenu->ConsolePrint("[SM] Extension number %d was not found.", num);
return;
}
@@ -1257,18 +1241,18 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
if (pExt->Reload(error, sizeof(error)))
{
g_RootMenu.ConsolePrint("[SM] Extension %s is now reloaded.", filename);
rootmenu->ConsolePrint("[SM] Extension %s is now reloaded.", filename);
}
else
{
g_RootMenu.ConsolePrint("[SM] Extension %s failed to reload: %s", filename, error);
rootmenu->ConsolePrint("[SM] Extension %s failed to reload: %s", filename, error);
}
return;
}
else
{
g_RootMenu.ConsolePrint("[SM] Extension %s is not loaded.", pExt->GetFilename());
rootmenu->ConsolePrint("[SM] Extension %s is not loaded.", pExt->GetFilename());
return;
}
@@ -1276,12 +1260,12 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
}
}
g_RootMenu.ConsolePrint("SourceMod Extensions Menu:");
g_RootMenu.DrawGenericOption("info", "Extra extension information");
g_RootMenu.DrawGenericOption("list", "List extensions");
g_RootMenu.DrawGenericOption("load", "Load an extension");
g_RootMenu.DrawGenericOption("reload", "Reload an extension");
g_RootMenu.DrawGenericOption("unload", "Unload an extension");
rootmenu->ConsolePrint("SourceMod Extensions Menu:");
rootmenu->DrawGenericOption("info", "Extra extension information");
rootmenu->DrawGenericOption("list", "List extensions");
rootmenu->DrawGenericOption("load", "Load an extension");
rootmenu->DrawGenericOption("reload", "Reload an extension");
rootmenu->DrawGenericOption("unload", "Unload an extension");
}
CExtension *CExtensionManager::GetExtensionFromIdent(IdentityToken_t *ptr)
@@ -1306,7 +1290,7 @@ void CExtensionManager::AddLibrary(IExtension *pSource, const char *library)
{
CExtension *pExt = (CExtension *)pSource;
pExt->AddLibrary(library);
g_PluginSys.OnLibraryAction(library, false, false);
scripts->OnLibraryAction(library, LibraryAction_Added);
}
bool CExtensionManager::LibraryExists(const char *library)
@@ -1376,6 +1360,37 @@ void CExtensionManager::CallOnCoreMapStart(edict_t *pEdictList, int edictCount,
}
}
void CExtensionManager::CallOnCoreMapEnd()
{
IExtensionInterface *pAPI;
List<CExtension *>::iterator iter;
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
if ((pAPI = (*iter)->GetAPI()) == NULL)
{
continue;
}
if (pAPI->GetExtensionVersion() > 7)
{
pAPI->OnCoreMapEnd();
}
}
}
const CVector<IExtension *> *CExtensionManager::ListExtensions()
{
CVector<IExtension *> *list = new CVector<IExtension *>();
for (List<CExtension *>::iterator iter = m_Libs.begin(); iter != m_Libs.end(); iter++)
list->push_back(*iter);
return list;
}
void CExtensionManager::FreeExtensionList(const CVector<IExtension *> *list)
{
delete const_cast<CVector<IExtension *> *>(list);
}
bool CLocalExtension::IsSameFile(const char *file)
{
/* Only care about the shortened name. */
@@ -36,14 +36,13 @@
#include <ILibrarySys.h>
#include <sh_list.h>
#include <sh_string.h>
#include <sm_trie_tpl.h>
#include "sm_globals.h"
#include "ShareSys.h"
#include <ISmmAPI.h>
#include "common_logic.h"
#include <IPluginSys.h>
#include <IRootConsoleMenu.h>
#include "PluginSys.h"
#include "NativeOwner.h"
#include "ShareSys.h"
class CPlayer;
using namespace SourceMod;
using namespace SourceHook;
@@ -118,7 +117,7 @@ public:
bool IsExternal();
bool IsSameFile(const char *file);
private:
PluginId m_PlId;
int m_PlId;
ILibrary *m_pLib;
};
@@ -136,7 +135,7 @@ public:
};
class CExtensionManager :
public IExtensionManager,
public IExtensionSys,
public SMGlobalClass,
public IPluginsListener,
public IRootConsoleCommand
@@ -167,14 +166,17 @@ public:
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);
void BindChildPlugin(IExtension *pParent, SMPlugin *pPlugin);
void MarkAllLoaded();
void AddDependency(IExtension *pSource, const char *file, bool required, bool autoload);
void TryAutoload();
void AddLibrary(IExtension *pSource, const char *library);
bool LibraryExists(const char *library);
void CallOnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax);
void CallOnCoreMapEnd();
void AddRawDependency(IExtension *ext, IdentityToken_t *other, void *iface);
const CVector<IExtension *> *ListExtensions();
void FreeExtensionList(const CVector<IExtension *> *list);
public:
CExtension *GetExtensionFromIdent(IdentityToken_t *ptr);
void Shutdown();
@@ -33,9 +33,8 @@
#include <stdarg.h>
#include <string.h>
#include "ForwardSys.h"
#include "PluginSys.h"
#include "ShareSys.h"
#include "DebugReporter.h"
#include "common_logic.h"
CForwardManager g_Forwards;
@@ -63,8 +62,8 @@ CForwardManager::~CForwardManager()
void CForwardManager::OnSourceModAllInitialized()
{
g_PluginSys.AddPluginsListener(this);
g_ShareSys.AddInterface(NULL, this);
scripts->AddPluginsListener(this);
sharesys->AddInterface(NULL, this);
}
IForward *CForwardManager::CreateForward(const char *name, ExecType et, unsigned int num_params, const ParamType *types, ...)
@@ -79,7 +78,7 @@ IForward *CForwardManager::CreateForward(const char *name, ExecType et, unsigned
if (fwd)
{
g_PluginSys.AddFunctionsToForward(name, fwd);
scripts->AddFunctionsToForward(name, fwd);
m_managed.push_back(fwd);
}
@@ -193,6 +192,7 @@ void CForwardManager::ForwardFree(CForward *fwd)
m_FreeForwards.push(fwd);
m_managed.remove(fwd);
m_unmanaged.remove(fwd);
}
CForward *CForwardManager::ForwardMake()
@@ -210,7 +210,23 @@ CForward *CForwardManager::ForwardMake()
void CForwardManager::OnPluginPauseChange(IPlugin *plugin, bool paused)
{
/* No longer used */
if(paused)
return;
/* Attach any globally managed forwards */
List<CForward *>::iterator iter;
CForward *fwd;
for (iter=m_managed.begin(); iter!=m_managed.end(); iter++)
{
fwd = (*iter);
IPluginFunction *pFunc = plugin->GetBaseContext()->GetFunctionByName(fwd->GetForwardName());
// Only add functions, if they aren't registered yet!
if (pFunc && !fwd->IsFunctionRegistered(pFunc))
{
fwd->AddFunction(pFunc);
}
}
}
/*************************************
@@ -683,7 +699,7 @@ bool CForward::RemoveFunction(IPluginFunction *func)
lst = &m_paused;
}
for (iter=m_functions.begin(); iter!=m_functions.end(); iter++)
for (iter=lst->begin(); iter!=lst->end(); iter++)
{
if ((*iter) == func)
{
@@ -741,6 +757,28 @@ bool CForward::AddFunction(IPluginFunction *func)
return true;
}
bool CForward::IsFunctionRegistered(IPluginFunction *func)
{
FuncIter iter;
List<IPluginFunction *> *lst;
if (func->IsRunnable())
{
lst = &m_functions;
} else {
lst = &m_paused;
}
for (iter=m_functions.begin(); iter!=m_functions.end(); iter++)
{
if ((*iter) == func)
{
return true;
}
}
return false;
}
const char *CForward::GetForwardName()
{
return m_name;
+3 -25
View File
@@ -34,10 +34,10 @@
#include <IForwardSys.h>
#include <IPluginSys.h>
#include "sm_globals.h"
#include "common_logic.h"
#include <sh_list.h>
#include <sh_stack.h>
#include "sourcemod.h"
#include "ISourceMod.h"
using namespace SourceHook;
@@ -46,29 +46,6 @@ typedef List<IPluginFunction *>::iterator FuncIter;
/* :TODO: a global name max define for sourcepawn, should mirror compiler's sNAMEMAX */
#define FORWARDS_NAME_MAX 64
struct ByrefInfo
{
unsigned int cells;
cell_t *orig_addr;
int flags;
int sz_flags;
};
struct FwdParamInfo
{
cell_t val;
ByrefInfo byref;
ParamType pushedas;
};
class SourceMod::IForwardFilter
{
public:
virtual void Preprocess(IPluginFunction *fun, FwdParamInfo *params)
{
}
};
class FuncIteratorGuard
{
bool triggered;
@@ -141,6 +118,7 @@ public:
unsigned int num_params,
const ParamType *types,
va_list ap);
bool IsFunctionRegistered(IPluginFunction *func);
private:
void _Int_PushArray(cell_t *inarray, unsigned int cells, int flags);
void _Int_PushString(cell_t *inarray, unsigned int cells, int sz_flags, int cp_flags);
+196 -156
View File
@@ -54,6 +54,7 @@ IGameConfig *g_pGameConf = NULL;
static char g_Game[256];
static char g_GameDesc[256] = {'!', '\0'};
static char g_GameName[256] = {'$', '\0'};
static const char *g_pParseEngine = NULL;
#define PSTATE_NONE 0
#define PSTATE_GAMES 1
@@ -76,10 +77,12 @@ static char g_GameName[256] = {'$', '\0'};
#define PLATFORM_SERVER_BINARY "server.dll"
#elif defined PLATFORM_LINUX
#define PLATFORM_NAME "linux"
#define PLATFORM_COMPAT_ALT "mac" /* Alternate platform name if game data is missing for primary one */
#define PLATFORM_SERVER_BINARY "server_i486.so"
#elif defined PLATFORM_APPLE
#define PLATFORM_NAME "mac"
#define PLATFORM_SERVER_BINARY "server.dylib"
#define PLATFORM_NAME "mac"
#define PLATFORM_COMPAT_ALT "linux"
#define PLATFORM_SERVER_BINARY "server.dylib"
#endif
struct TempSigInfo
@@ -89,7 +92,7 @@ struct TempSigInfo
library[0] = '\0';
sig[0] = '\0';
}
char sig[512];
char sig[1024];
char library[64];
} s_TempSig;
unsigned int s_ServerBinCRC;
@@ -112,24 +115,56 @@ static bool DoesGameMatch(const char *value)
static bool DoesEngineMatch(const char *value)
{
return strcmp(value, smcore.GetSourceEngineName()) == 0;
return strcmp(value, g_pParseEngine) == 0;
}
CGameConfig::CGameConfig(const char *file)
static inline bool DoesPlatformMatch(const char *platform)
{
return strcmp(platform, PLATFORM_NAME) == 0;
}
static inline bool IsPlatformCompatible(const char *platform, bool *hadPrimaryMatch)
{
if (DoesPlatformMatch(platform))
{
#if defined PLATFORM_COMPAT_ALT
*hadPrimaryMatch = true;
#endif
return true;
}
#if defined PLATFORM_COMPAT_ALT
/* If entry hasn't been found for the primary platform name, check for compatible alternate */
if (!*hadPrimaryMatch)
return strcmp(platform, PLATFORM_COMPAT_ALT) == 0;
#endif
return false;
}
CGameConfig::CGameConfig(const char *file, const char *engine)
{
strncopy(m_File, file, sizeof(m_File));
m_pAddresses = new KTrie<AddressConf>();
m_pStrings = new BaseStringTable(512);
m_RefCount = 0;
m_CustomLevel = 0;
m_CustomHandler = NULL;
if (!engine)
m_pEngine = smcore.GetSourceEngineName();
else
m_pEngine = engine;
if (strcmp(m_pEngine, "css") == 0 || strcmp(m_pEngine, "dods") == 0 || strcmp(m_pEngine, "hl2dm") == 0 || strcmp(m_pEngine, "tf2") == 0)
this->SetBaseEngine("orangebox_valve");
else if (strcmp(m_pEngine, "nucleardawn") == 0)
this->SetBaseEngine("left4dead2");
else
this->SetBaseEngine(NULL);
}
CGameConfig::~CGameConfig()
{
delete m_pAddresses;
delete m_pStrings;
g_GameConfigs.RemoveCachedConfig(this);
}
SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *name)
@@ -201,13 +236,10 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
}
else
{
ITextListener_SMC **pListen = g_GameConfigs.m_customHandlers.retrieve(name);
if (pListen != NULL)
if (g_GameConfigs.m_customHandlers.retrieve(name, &m_CustomHandler))
{
m_CustomLevel = 0;
m_ParseState = PSTATE_GAMEDEFS_CUSTOM;
m_CustomHandler = *pListen;
m_CustomHandler->ReadSMC_ParseStart();
break;
}
@@ -222,6 +254,7 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
m_Class[0] = '\0';
strncopy(m_offset, name, sizeof(m_offset));
m_ParseState = PSTATE_GAMEDEFS_OFFSETS_OFFSET;
matched_platform = false;
break;
}
case PSTATE_GAMEDEFS_SIGNATURES:
@@ -229,6 +262,7 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
strncopy(m_offset, name, sizeof(m_offset));
s_TempSig.Reset();
m_ParseState = PSTATE_GAMEDEFS_SIGNATURES_SIG;
matched_platform = false;
break;
}
case PSTATE_GAMEDEFS_CRC:
@@ -267,8 +301,8 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
if (error[0] != '\0')
{
m_IgnoreLevel = 1;
smcore.LogError("[SM] Error while parsing CRC section for \"%s\" (%s):", m_Game, m_CurFile);
smcore.LogError("[SM] %s", error);
logger->LogError("[SM] Error while parsing CRC section for \"%s\" (%s):", m_Game, m_CurFile);
logger->LogError("[SM] %s", error);
} else {
m_ParseState = PSTATE_GAMEDEFS_CRC_BINARY;
}
@@ -293,7 +327,7 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
}
case PSTATE_GAMEDEFS_ADDRESSES_ADDRESS:
{
if (strcmp(name, PLATFORM_NAME) == 0)
if (DoesPlatformMatch(name))
{
m_ParseState = PSTATE_GAMEDEFS_ADDRESSES_ADDRESS_READ;
}
@@ -301,8 +335,8 @@ SMCResult CGameConfig::ReadSMC_NewSection(const SMCStates *states, const char *n
{
if (strcmp(name, "linux") != 0 && strcmp(name, "windows") != 0 && strcmp(name, "mac") != 0)
{
smcore.LogError("[SM] Error while parsing Address section for \"%s\" (%s):", m_Address, m_CurFile);
smcore.LogError("[SM] Unrecognized platform \"%s\"", name);
logger->LogError("[SM] Error while parsing Address section for \"%s\" (%s):", m_Address, m_CurFile);
logger->LogError("[SM] Unrecognized platform \"%s\"", name);
}
m_IgnoreLevel = 1;
}
@@ -341,11 +375,12 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
strncopy(m_Class, value, sizeof(m_Class));
} else if (strcmp(key, "prop") == 0) {
strncopy(m_Prop, value, sizeof(m_Prop));
} else if (strcmp(key, PLATFORM_NAME) == 0) {
} else if (IsPlatformCompatible(key, &matched_platform)) {
m_Offsets.replace(m_offset, atoi(value));
}
} else if (m_ParseState == PSTATE_GAMEDEFS_KEYS) {
m_Keys.replace(key, m_pStrings->AddString(value));
ke::AString vstr(value);
m_Keys.replace(key, ke::Move(vstr));
} else if (m_ParseState == PSTATE_GAMEDEFS_SUPPORTED) {
if (strcmp(key, "game") == 0)
{
@@ -372,14 +407,14 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
}
}
} else if (m_ParseState == PSTATE_GAMEDEFS_SIGNATURES_SIG) {
if (strcmp(key, PLATFORM_NAME) == 0)
if (IsPlatformCompatible(key, &matched_platform))
{
strncopy(s_TempSig.sig, value, sizeof(s_TempSig.sig));
} else if (strcmp(key, "library") == 0) {
strncopy(s_TempSig.library, value, sizeof(s_TempSig.library));
}
} else if (m_ParseState == PSTATE_GAMEDEFS_CRC_BINARY) {
if (strcmp(key, PLATFORM_NAME) == 0
if (DoesPlatformMatch(key)
&& s_ServerBinCRC_Ok
&& !bShouldBeReadingDefault)
{
@@ -400,7 +435,7 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
}
else
{
smcore.LogError("[SM] Error parsing Address \"%s\", does not support more than %d read offsets (gameconf \"%s\")", m_Address, limit, m_CurFile);
logger->LogError("[SM] Error parsing Address \"%s\", does not support more than %d read offsets (gameconf \"%s\")", m_Address, limit, m_CurFile);
}
} else if (strcmp(key, "signature") == 0) {
strncopy(m_AddressSignature, value, sizeof(m_AddressSignature));
@@ -468,7 +503,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
if (((strcmp(m_Game, "*") != 0) && strcmp(m_Game, "#default") != 0)
&& (!m_Offsets.retrieve(m_offset)))
{
smcore.LogError("[SM] Unable to find property %s.%s (file \"%s\") (mod \"%s\")",
logger->LogError("[SM] Unable to find property %s.%s (file \"%s\") (mod \"%s\")",
m_Class,
m_Prop,
m_CurFile,
@@ -521,13 +556,22 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
void *final_addr = NULL;
if (addrInBase == NULL)
{
smcore.LogError("[SM] Unrecognized library \"%s\" (gameconf \"%s\")",
logger->LogError("[SM] Unrecognized library \"%s\" (gameconf \"%s\")",
s_TempSig.library,
m_CurFile);
} else {
#if defined PLATFORM_POSIX
}
else if (s_TempSig.sig[0])
{
if (s_TempSig.sig[0] == '@')
{
#if defined PLATFORM_WINDOWS
MEMORY_BASIC_INFORMATION mem;
if (VirtualQuery(addrInBase, &mem, sizeof(mem)))
final_addr = g_MemUtils.ResolveSymbol(mem.AllocationBase, &s_TempSig.sig[1]);
else
logger->LogError("[SM] Unable to find library \"%s\" in memory (gameconf \"%s\")", s_TempSig.library, m_File);
#elif defined PLATFORM_POSIX
Dl_info info;
/* GNU only: returns 0 on error, inconsistent! >:[ */
if (dladdr(addrInBase, &info) != 0)
@@ -541,41 +585,39 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
final_addr = dlsym(handle, &s_TempSig.sig[1]);
dlclose(handle);
} else {
smcore.LogError("[SM] Unable to load library \"%s\" (gameconf \"%s\")",
logger->LogError("[SM] Unable to load library \"%s\" (gameconf \"%s\")",
s_TempSig.library,
m_File);
}
} else {
smcore.LogError("[SM] Unable to find library \"%s\" in memory (gameconf \"%s\")",
logger->LogError("[SM] Unable to find library \"%s\" in memory (gameconf \"%s\")",
s_TempSig.library,
m_File);
}
}
if (final_addr)
{
goto skip_find;
}
#endif
/* First, preprocess the signature */
unsigned char real_sig[511];
size_t real_bytes;
size_t length;
real_bytes = 0;
length = strlen(s_TempSig.sig);
real_bytes = UTIL_DecodeHexString(real_sig, sizeof(real_sig), s_TempSig.sig);
if (real_bytes >= 1)
{
final_addr = g_MemUtils.FindPattern(addrInBase, (char*)real_sig, real_bytes);
}
if (!final_addr)
{
/* First, preprocess the signature */
unsigned char real_sig[511];
size_t real_bytes;
size_t length;
real_bytes = 0;
length = strlen(s_TempSig.sig);
real_bytes = UTIL_DecodeHexString(real_sig, sizeof(real_sig), s_TempSig.sig);
if (real_bytes >= 1)
{
final_addr = g_MemUtils.FindPattern(addrInBase, (char*) real_sig, real_bytes);
}
}
m_Sigs.replace(m_offset, final_addr);
}
#if defined PLATFORM_POSIX
skip_find:
#endif
m_Sigs.replace(m_offset, final_addr);
m_ParseState = PSTATE_GAMEDEFS_SIGNATURES;
break;
@@ -589,19 +631,11 @@ skip_find:
{
m_ParseState = PSTATE_GAMEDEFS_ADDRESSES;
if (m_Address[0] == '\0')
if (m_Address[0] != '\0' && m_AddressSignature[0] != '\0')
{
smcore.LogError("[SM] Address sections must have names (gameconf \"%s\")", m_CurFile);
break;
AddressConf addrConf(m_AddressSignature, sizeof(m_AddressSignature), m_AddressReadCount, m_AddressRead);
m_Addresses.replace(m_Address, addrConf);
}
if (m_AddressSignature[0] == '\0')
{
smcore.LogError("[SM] Address section for \"%s\" did not specify a signature (gameconf \"%s\")", m_Address, m_CurFile);
break;
}
AddressConf addrConf(m_AddressSignature, sizeof(m_AddressSignature), m_AddressReadCount, m_AddressRead);
m_pAddresses->replace(m_Address, addrConf);
break;
}
@@ -745,11 +779,10 @@ static MasterReader master_reader;
bool CGameConfig::Reparse(char *error, size_t maxlength)
{
/* Reset cached data */
m_pStrings->Reset();
m_Offsets.clear();
m_Props.clear();
m_Keys.clear();
m_pAddresses->clear();
m_Addresses.clear();
char path[PLATFORM_MAX_PATH];
@@ -759,7 +792,19 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
{
/* Nope, use the old mechanism. */
smcore.Format(path, sizeof(path), "%s.txt", m_File);
return EnterFile(path, error, maxlength);
if (!EnterFile(path, error, maxlength))
{
return false;
}
/* Allow customization. */
g_pSM->BuildPath(Path_SM, path, sizeof(path), "gamedata/custom/%s.txt", m_File);
if (libsys->PathExists(path))
{
smcore.Format(path, sizeof(path), "custom/%s.txt", m_File);
return EnterFile(path, error, maxlength);
}
return true;
}
/* Otherwise, it's time to parse the master. */
@@ -767,19 +812,29 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
SMCStates state = {0, 0};
List<String> fileList;
master_reader.fileList = &fileList;
const char *pEngine[2] = { m_pBaseEngine, m_pEngine };
err = textparsers->ParseSMCFile(path, &master_reader, &state, error, maxlength);
if (err != SMCError_Okay)
for (unsigned char iter = 0; iter < SM_ARRAYSIZE(pEngine); ++iter)
{
const char *msg = textparsers->GetSMCErrorString(err);
if (pEngine[iter] == NULL)
{
continue;
}
smcore.LogError("[SM] Error parsing master gameconf file \"%s\":", path);
smcore.LogError("[SM] Error %d on line %d, col %d: %s",
err,
state.line,
state.col,
msg ? msg : "Unknown error");
return false;
this->SetParseEngine(pEngine[iter]);
err = textparsers->ParseSMCFile(path, &master_reader, &state, error, maxlength);
if (err != SMCError_Okay)
{
const char *msg = textparsers->GetSMCErrorString(err);
logger->LogError("[SM] Error parsing master gameconf file \"%s\":", path);
logger->LogError("[SM] Error %d on line %d, col %d: %s",
err,
state.line,
state.col,
msg ? msg : "Unknown error");
return false;
}
}
/* Go through each file we found and parse it. */
@@ -845,51 +900,64 @@ bool CGameConfig::EnterFile(const char *file, char *error, size_t maxlength)
m_IgnoreLevel = 0;
bShouldBeReadingDefault = true;
m_ParseState = PSTATE_NONE;
const char *pEngine[2] = { m_pBaseEngine, m_pEngine };
if ((err=textparsers->ParseSMCFile(m_CurFile, this, &state, error, maxlength))
!= SMCError_Okay)
for (unsigned char iter = 0; iter < SM_ARRAYSIZE(pEngine); ++iter)
{
const char *msg;
msg = textparsers->GetSMCErrorString(err);
smcore.LogError("[SM] Error parsing gameconfig file \"%s\":", m_CurFile);
smcore.LogError("[SM] Error %d on line %d, col %d: %s",
err,
state.line,
state.col,
msg ? msg : "Unknown error");
if (m_ParseState == PSTATE_GAMEDEFS_CUSTOM)
if (pEngine[iter] == NULL)
{
//error occurred while parsing a custom section
m_CustomHandler->ReadSMC_ParseEnd(true, true);
m_CustomHandler = NULL;
m_CustomLevel = 0;
continue;
}
return false;
this->SetParseEngine(pEngine[iter]);
if ((err=textparsers->ParseSMCFile(m_CurFile, this, &state, error, maxlength))
!= SMCError_Okay)
{
const char *msg = textparsers->GetSMCErrorString(err);
logger->LogError("[SM] Error parsing gameconfig file \"%s\":", m_CurFile);
logger->LogError("[SM] Error %d on line %d, col %d: %s",
err,
state.line,
state.col,
msg ? msg : "Unknown error");
if (m_ParseState == PSTATE_GAMEDEFS_CUSTOM)
{
//error occurred while parsing a custom section
m_CustomHandler->ReadSMC_ParseEnd(true, true);
m_CustomHandler = NULL;
m_CustomLevel = 0;
}
return false;
}
}
return true;
}
void CGameConfig::SetBaseEngine(const char *engine)
{
m_pBaseEngine = engine;
}
void CGameConfig::SetParseEngine(const char *engine)
{
g_pParseEngine = engine;
}
bool CGameConfig::GetOffset(const char *key, int *value)
{
int *pvalue;
if ((pvalue = m_Offsets.retrieve(key)) == NULL)
return false;
*value = *pvalue;
return true;
return m_Offsets.retrieve(key, value);
}
const char *CGameConfig::GetKeyValue(const char *key)
{
int *pkey;
if ((pkey = m_Keys.retrieve(key)) == NULL)
StringHashMap<ke::AString>::Result r = m_Keys.find(key);
if (!r.found())
return NULL;
return m_pStrings->GetString(*pkey);
return r->value.chars();
}
//memory addresses below 0x10000 are automatically considered invalid for dereferencing
@@ -897,25 +965,25 @@ const char *CGameConfig::GetKeyValue(const char *key)
bool CGameConfig::GetAddress(const char *key, void **retaddr)
{
AddressConf *addrConf;
addrConf = m_pAddresses->retrieve(key);
if (!addrConf)
StringHashMap<AddressConf>::Result r = m_Addresses.find(key);
if (!r.found())
{
*retaddr = NULL;
return false;
}
AddressConf &addrConf = r->value;
void *addr;
if (!GetMemSig(addrConf->signatureName, &addr))
if (!GetMemSig(addrConf.signatureName, &addr))
{
*retaddr = NULL;
return false;
}
for (int i = 0; i < addrConf->readCount; ++i)
for (int i = 0; i < addrConf.readCount; ++i)
{
int offset = addrConf->read[i];
int offset = addrConf.read[i];
//NULLs in the middle of an indirection chain are bad, end NULL is ok
if (addr == NULL || reinterpret_cast<uintptr_t>(addr) < VALID_MINIMUM_MEMORY_ADDRESS)
@@ -946,32 +1014,15 @@ CGameConfig::AddressConf::AddressConf(char *sigName, unsigned sigLength, unsigne
SendProp *CGameConfig::GetSendProp(const char *key)
{
SendProp **pProp;
if ((pProp = m_Props.retrieve(key)) == NULL)
SendProp *prop;
if (!m_Props.retrieve(key, &prop))
return NULL;
return *pProp;
return prop;
}
bool CGameConfig::GetMemSig(const char *key, void **addr)
{
void **paddr;
if ((paddr = m_Sigs.retrieve(key)) == NULL)
return false;
*addr = *paddr;
return true;
}
void CGameConfig::IncRefCount()
{
m_RefCount++;
}
unsigned int CGameConfig::DecRefCount()
{
m_RefCount--;
return m_RefCount;
return m_Sigs.retrieve(key, addr);
}
GameConfigManager::GameConfigManager()
@@ -1022,17 +1073,16 @@ bool GameConfigManager::LoadGameConfigFile(const char *file, IGameConfig **_pCon
#endif
CGameConfig *pConfig;
CGameConfig **ppConfig;
if ((ppConfig = m_Lookup.retrieve(file)) != NULL)
if (m_Lookup.retrieve(file, &pConfig))
{
pConfig = *ppConfig;
pConfig->IncRefCount();
pConfig->AddRef();
*_pConfig = pConfig;
return true;
}
pConfig = new CGameConfig(file);
pConfig->AddRef();
/* :HACKHACK: Don't parse the main config file */
bool retval = true;
@@ -1041,25 +1091,16 @@ bool GameConfigManager::LoadGameConfigFile(const char *file, IGameConfig **_pCon
retval = pConfig->Reparse(error, maxlength);
}
m_cfgs.push_back(pConfig);
m_Lookup.insert(file, pConfig);
pConfig->IncRefCount();
*_pConfig = pConfig;
return retval;
}
void GameConfigManager::CloseGameConfigFile(IGameConfig *cfg)
{
CGameConfig *pConfig = (CGameConfig *)cfg;
if (pConfig->DecRefCount() == 0)
{
m_Lookup.remove(pConfig->m_File);
delete pConfig;
}
pConfig->Release();
}
extern Handle_t g_GameConfigsType;
@@ -1083,22 +1124,16 @@ void GameConfigManager::AddUserConfigHook(const char *sectionname, ITextListener
m_customHandlers.insert(sectionname, listener);
}
void GameConfigManager::RemoveUserConfigHook(const char *sectionname, ITextListener_SMC *listener)
void GameConfigManager::RemoveUserConfigHook(const char *sectionname, ITextListener_SMC *aListener)
{
ITextListener_SMC **pListener = m_customHandlers.retrieve(sectionname);
if (pListener == NULL)
{
ITextListener_SMC *listener;
if (!m_customHandlers.retrieve(sectionname, &listener))
return;
}
if (*pListener != listener)
{
if (listener != aListener)
return;
}
m_customHandlers.remove(sectionname);
return;
}
@@ -1109,3 +1144,8 @@ void GameConfigManager::AcquireLock()
void GameConfigManager::ReleaseLock()
{
}
void GameConfigManager::RemoveCachedConfig(CGameConfig *config)
{
m_Lookup.remove(config->m_File);
}
+27 -20
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.
@@ -35,9 +35,9 @@
#include "common_logic.h"
#include <IGameConfigs.h>
#include <ITextParsers.h>
#include <sh_list.h>
#include "sm_memtable.h"
#include <sm_trie_tpl.h>
#include <am-refcounting.h>
#include <sm_stringhashmap.h>
#include <sm_namehashset.h>
using namespace SourceMod;
using namespace SourceHook;
@@ -46,15 +46,18 @@ class SendProp;
class CGameConfig :
public ITextListener_SMC,
public IGameConfig
public IGameConfig,
public ke::Refcounted<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,18 +68,18 @@ public: //IGameConfig
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();
public: //NameHashSet
static inline bool matches(const char *key, const CGameConfig *value)
{
return strcmp(key, value->m_File) == 0;
}
private:
BaseStringTable *m_pStrings;
char m_File[PLATFORM_MAX_PATH];
char m_CurFile[PLATFORM_MAX_PATH];
KTrie<int> m_Offsets;
KTrie<SendProp *> m_Props;
KTrie<int> m_Keys;
KTrie<void *> m_Sigs;
unsigned int m_RefCount;
StringHashMap<int> m_Offsets;
StringHashMap<SendProp *> m_Props;
StringHashMap<ke::AString> m_Keys;
StringHashMap<void *> m_Sigs;
/* Parse states */
int m_ParseState;
unsigned int m_IgnoreLevel;
@@ -89,6 +92,7 @@ private:
bool matched_game;
bool had_engine;
bool matched_engine;
bool matched_platform;
/* Custom Sections */
unsigned int m_CustomLevel;
@@ -110,7 +114,9 @@ private:
char m_AddressSignature[64];
int m_AddressReadCount;
int m_AddressRead[8];
KTrie<AddressConf> *m_pAddresses;
StringHashMap<AddressConf> m_Addresses;
const char *m_pEngine;
const char *m_pBaseEngine;
};
class GameConfigManager :
@@ -134,11 +140,12 @@ public: //SMGlobalClass
void OnSourceModStartup(bool late);
void OnSourceModAllInitialized();
void OnSourceModAllShutdown();
private:
List<CGameConfig *> m_cfgs;
KTrie<CGameConfig *> m_Lookup;
public:
KTrie<ITextListener_SMC *> m_customHandlers;
void RemoveCachedConfig(CGameConfig *config);
private:
NameHashSet<CGameConfig *> m_Lookup;
public:
StringHashMap<ITextListener_SMC *> m_customHandlers;
};
extern GameConfigManager g_GameConfigs;
+125 -88
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.
@@ -30,13 +30,12 @@
*/
#include "HandleSys.h"
#include "ShareSys.h"
#include "PluginSys.h"
#include "ExtensionSys.h"
#include "Logger.h"
#include <assert.h>
#include <string.h>
#include "sm_stringutil.h"
#include "common_logic.h"
#include "ShareSys.h"
#include "ExtensionSys.h"
#include "PluginSys.h"
HandleSystem g_HandleSys;
@@ -60,9 +59,6 @@ HandleSystem::HandleSystem()
m_Types = new QHandleType[HANDLESYS_TYPEARRAY_SIZE];
memset(m_Types, 0, sizeof(QHandleType) * HANDLESYS_TYPEARRAY_SIZE);
m_TypeLookup = sm_trie_create();
m_strtab = new BaseStringTable(512);
m_TypeTail = 0;
}
@@ -70,8 +66,6 @@ HandleSystem::~HandleSystem()
{
delete [] m_Handles;
delete [] m_Types;
sm_trie_destroy(m_TypeLookup);
delete m_strtab;
}
@@ -145,12 +139,10 @@ HandleType_t HandleSystem::CreateType(const char *name,
if (name && name[0] != '\0')
{
if (sm_trie_retrieve(m_TypeLookup, name, NULL))
if (m_TypeLookup.contains(name))
{
if (err)
{
*err = HandleError_Parameter;
}
return 0;
}
}
@@ -212,10 +204,8 @@ HandleType_t HandleSystem::CreateType(const char *name,
pType->dispatch = dispatch;
if (name && name[0] != '\0')
{
pType->nameIdx = m_strtab->AddString(name);
sm_trie_insert(m_TypeLookup, name, (void *)pType);
} else {
pType->nameIdx = -1;
pType->name = new ke::AString(name);
m_TypeLookup.insert(name, pType);
}
pType->opened = 0;
@@ -243,21 +233,14 @@ HandleType_t HandleSystem::CreateType(const char *name,
return index;
}
bool HandleSystem::FindHandleType(const char *name, HandleType_t *type)
bool HandleSystem::FindHandleType(const char *name, HandleType_t *aResult)
{
QHandleType *_type;
if (!sm_trie_retrieve(m_TypeLookup, name, (void **)&_type))
{
QHandleType *type;
if (!m_TypeLookup.retrieve(name, &type))
return false;
}
unsigned int offset = _type - m_Types;
if (type)
{
*type = offset;
}
if (aResult)
*aResult = type - m_Types;
return true;
}
@@ -579,6 +562,7 @@ HandleError HandleSystem::CloneHandle(QHandle *pHandle, unsigned int index, Hand
}
pNewHandle->clone = index;
pNewHandle->object = NULL;
pHandle->refcount++;
*newhandle = new_handle;
@@ -659,6 +643,14 @@ void HandleSystem::GetHandleUnchecked(Handle_t hndl, QHandle *& pHandle, unsigne
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)
@@ -673,6 +665,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 */
@@ -681,20 +674,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 */
@@ -727,14 +727,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);
}
@@ -793,6 +785,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.
*/
@@ -902,10 +897,6 @@ bool HandleSystem::RemoveType(HandleType_t type, IdentityToken_t *ident)
m_Types[++m_FreeTypes].freeID = type;
}
/* Invalidate the type now */
IHandleTypeDispatch *dispatch = pType->dispatch;
pType->dispatch = NULL;
/* Make sure nothing is using this type. */
if (pType->opened)
{
@@ -917,29 +908,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;
@@ -947,14 +918,12 @@ bool HandleSystem::RemoveType(HandleType_t type, IdentityToken_t *ident)
}
}
/* Remove it from the type cache. */
if (pType->nameIdx != -1)
{
const char *typeName;
/* Invalidate the type now */
pType->dispatch = NULL;
typeName = m_strtab->GetString(pType->nameIdx);
sm_trie_delete(m_TypeLookup, typeName);
}
/* Remove it from the type cache. */
if (pType->name)
m_TypeLookup.remove(pType->name->chars());
return true;
}
@@ -988,17 +957,16 @@ bool HandleSystem::InitAccessDefaults(TypeAccess *pTypeAccess, HandleAccess *pHa
}
#define HANDLE_LOG_VERY_BAD(message, ...) \
g_Logger.LogFatal(message, ##__VA_ARGS__); \
g_Logger.LogError(message, ##__VA_ARGS__);
logger->LogFatal(message, ##__VA_ARGS__); \
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();
@@ -1027,8 +995,6 @@ bool HandleSystem::TryAndFreeSomeHandles()
highest_owner = plugin;
highest_handle_count = handle_count;
}
pl_iter->NextPlugin();
}
if (highest_owner == NULL || highest_handle_count == 0)
@@ -1039,10 +1005,63 @@ bool HandleSystem::TryAndFreeSomeHandles()
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);
HANDLE_LOG_VERY_BAD("--------------------------------------------------------------------------");
const IdentityToken_t *pIdentity = highest_owner->GetIdentity();
unsigned int total = 0, highest_index = 0, total_size = 0, size;
unsigned int * pCount = new unsigned int[HANDLESYS_TYPEARRAY_SIZE+1];
memset(pCount, 0, ((HANDLESYS_TYPEARRAY_SIZE + 1) * sizeof(unsigned int)));
for (unsigned int i = 1; i <= m_HandleTail; ++i)
{
const QHandle &Handle = m_Handles[i];
if (Handle.set != HandleSet_Used || Handle.owner != pIdentity)
{
continue;
}
++pCount[Handle.type];
++total;
if (Handle.type >= highest_index)
{
highest_index = ((Handle.type) + 1);
}
if (Handle.clone != 0)
{
continue;
}
if (m_Types[Handle.type].dispatch->GetHandleApproxSize(Handle.type, Handle.object, &size))
{
total_size += size;
}
}
const char * pTypeName = NULL;
for (unsigned int i = 0; i < highest_index; ++i)
{
if (pCount[i] == 0)
{
continue; /* We may have gaps, it's fine. */
}
if (m_Types[i].name)
pTypeName = m_Types[i].name->chars();
else
pTypeName = "ANON";
HANDLE_LOG_VERY_BAD("Type\t%-20.20s|\tCount\t%u", pTypeName, pCount[i]);
}
HANDLE_LOG_VERY_BAD("-- Approximately %d bytes of memory are in use by (%u) Handles.\n", total_size, total);
delete [] pCount;
highest_owner->GetBaseContext()->ThrowNativeErrorEx(SP_ERROR_MEMACCESS, "Memory leak");
return g_PluginSys.UnloadPlugin(highest_owner);
return scripts->UnloadPlugin(highest_owner);
}
void HandleSystem::Dump(HANDLE_REPORTER rep)
@@ -1067,20 +1086,20 @@ void HandleSystem::Dump(HANDLE_REPORTER rep)
{
owner = "CORE";
}
else if (pOwner == g_PluginSys.GetIdentity())
else if (pOwner == scripts->GetIdentity())
{
owner = "PLUGINSYS";
}
else
{
CExtension *ext = g_Extensions.GetExtensionFromIdent(pOwner);
IExtension *ext = g_Extensions.GetExtensionFromIdent(pOwner);
if (ext)
{
owner = ext->GetFilename();
}
else
{
CPlugin *pPlugin = g_PluginSys.GetPluginFromIdentity(pOwner);
SMPlugin *pPlugin = scripts->FindPluginByIdentity(pOwner);
if (pPlugin)
{
owner = pPlugin->GetFilename();
@@ -1095,19 +1114,37 @@ void HandleSystem::Dump(HANDLE_REPORTER rep)
const char *type = "ANON";
QHandleType *pType = &m_Types[m_Handles[i].type];
unsigned int size = 0;
if (pType->nameIdx != -1)
unsigned int parentIdx;
bool bresult;
if (pType->name)
type = pType->name->chars();
if ((parentIdx = m_Handles[i].clone) != 0)
{
type = m_strtab->GetString(pType->nameIdx);
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");
}
else
{
char buffer[32];
UTIL_Format(buffer, sizeof(buffer), "%d", size);
smcore.Format(buffer, sizeof(buffer), "%d", size);
rep("0x%08x\t%-20.20s\t%-20.20s\t%-10.10s", index, owner, type, buffer);
total_size += size;
}
+12 -9
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.
@@ -34,12 +34,11 @@
#include <IHandleSys.h>
#include <stdio.h>
#include "sm_globals.h"
#include "sm_trie.h"
#include "sourcemod.h"
#include "sm_memtable.h"
#include <sm_namehashset.h>
#include <am-string.h>
#include "common_logic.h"
#define HANDLESYS_MAX_HANDLES (1<<14)
#define HANDLESYS_MAX_HANDLES (1<<15)
#define HANDLESYS_MAX_TYPES (1<<9)
#define HANDLESYS_MAX_SUBTYPES 0xF
#define HANDLESYS_SUBTYPE_MASK 0xF
@@ -104,7 +103,12 @@ struct QHandleType
TypeAccess typeSec;
HandleAccess hndlSec;
unsigned int opened;
int nameIdx;
ke::AutoPtr<ke::AString> name;
static inline bool matches(const char *key, const QHandleType *type)
{
return type->name && type->name->compare(key) == 0;
}
};
typedef void (HANDLE_REPORTER)(const char *str, ...);
@@ -217,13 +221,12 @@ protected:
private:
QHandle *m_Handles;
QHandleType *m_Types;
Trie *m_TypeLookup;
NameHashSet<QHandleType *> m_TypeLookup;
unsigned int m_TypeTail;
unsigned int m_FreeTypes;
unsigned int m_HandleTail;
unsigned int m_FreeHandles;
unsigned int m_HSerial;
BaseStringTable *m_strtab;
};
extern HandleSystem g_HandleSys;
+551
View File
@@ -0,0 +1,551 @@
/**
* vim: set ts=4 sw=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#include <time.h>
#include <cstdarg>
#include "Logger.h"
#include <sourcemod_version.h>
#include <ISourceMod.h>
Logger g_Logger;
/**
* :TODO: This should be creating the log folder if it doesn't exist
*/
ConfigResult Logger::OnSourceModConfigChanged(const char *key,
const char *value,
ConfigSource source,
char *error,
size_t maxlength)
{
if (strcasecmp(key, "Logging") == 0)
{
bool state;
if (strcasecmp(value, "on") == 0)
{
state = true;
} else if (strcasecmp(value, "off") == 0) {
state = false;
} else {
smcore.Format(error, maxlength, "Invalid value: must be \"on\" or \"off\"");
return ConfigResult_Reject;
}
if (source == ConfigSource_Console)
{
state ? EnableLogging() : DisableLogging();
} else {
m_InitialState = state;
}
return ConfigResult_Accept;
} else if (strcasecmp(key, "LogMode") == 0) {
if (strcasecmp(value, "daily") == 0)
{
m_Mode = LoggingMode_Daily;
} else if (strcasecmp(value, "map") == 0) {
m_Mode = LoggingMode_PerMap;
} else if (strcasecmp(value, "game") == 0) {
m_Mode = LoggingMode_Game;
} else {
smcore.Format(error, maxlength, "Invalid value: must be [daily|map|game]");
return ConfigResult_Reject;
}
return ConfigResult_Accept;
}
return ConfigResult_Ignore;
}
void Logger::OnSourceModStartup(bool late)
{
InitLogger(m_Mode);
}
void Logger::OnSourceModAllShutdown()
{
CloseLogger();
}
void Logger::OnSourceModLevelChange(const char *mapName)
{
MapChange(mapName);
}
void Logger::_NewMapFile()
{
if (!m_Active)
{
return;
}
/* Append "Log file closed" to previous log file */
_CloseFile();
char _filename[256];
int i = 0;
time_t t = g_pSM->GetAdjustedTime();
tm *curtime = localtime(&t);
while (true)
{
g_pSM->BuildPath(Path_SM, _filename, sizeof(_filename), "logs/L%02d%02d%03d.log", curtime->tm_mon + 1, curtime->tm_mday, i);
FILE *fp = fopen(_filename, "r");
if (!fp)
{
break;
}
fclose(fp);
i++;
}
m_NrmFileName.assign(_filename);
FILE *fp = fopen(m_NrmFileName.c_str(), "w");
if (!fp)
{
char error[255];
libsys->GetPlatformError(error, sizeof(error));
LogFatal("[SM] Unexpected fatal logging error (file \"%s\")", m_NrmFileName.c_str());
LogFatal("[SM] Platform returned error: \"%s\"", error);
LogFatal("[SM] Logging has been disabled.");
m_Active = false;
return;
} else {
char date[32];
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
fprintf(fp, "L %s: SourceMod log file started (file \"L%02d%02d%03d.log\") (Version \"%s\")\n", date, curtime->tm_mon + 1, curtime->tm_mday, i, SOURCEMOD_VERSION);
fclose(fp);
}
}
void Logger::_CloseFile()
{
if (!m_Active)
{
return;
}
FILE *fp = NULL;
if (!m_NrmFileName.empty())
{
fp = fopen(m_NrmFileName.c_str(), "r+");
if (fp)
{
fseek(fp, 0, SEEK_END);
LogMessage("Log file closed.");
fclose(fp);
}
m_NrmFileName.clear();
}
if (!m_ErrMapStart)
{
return;
}
fp = fopen(m_ErrFileName.c_str(), "r+");
if (fp)
{
fseek(fp, 0, SEEK_END);
LogError("Error log file session closed.");
fclose(fp);
}
m_ErrFileName.clear();
}
void Logger::InitLogger(LoggingMode mode)
{
m_Mode = mode;
m_Active = m_InitialState;
time_t t = g_pSM->GetAdjustedTime();
tm *curtime = localtime(&t);
m_NrmCurDay = curtime->tm_mday;
m_ErrCurDay = curtime->tm_mday;
char _filename[256];
g_pSM->BuildPath(Path_SM, _filename, sizeof(_filename), "logs/errors_%04d%02d%02d.log", curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday);
m_ErrFileName.assign(_filename);
switch (m_Mode)
{
case LoggingMode_PerMap:
{
if (!m_Active)
{
m_DelayedStart = true;
}
break;
}
case LoggingMode_Daily:
{
g_pSM->BuildPath(Path_SM, _filename, sizeof(_filename), "logs/L%04d%02d%02d.log", curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday);
m_NrmFileName.assign(_filename);
m_DailyPrintHdr = true;
break;
}
default:
{
/* do nothing... */
break;
}
}
}
void Logger::CloseLogger()
{
_CloseFile();
}
void Logger::LogToOpenFile(FILE *fp, const char *msg, ...)
{
if (!m_Active)
{
return;
}
va_list ap;
va_start(ap, msg);
LogToOpenFileEx(fp, msg, ap);
va_end(ap);
}
void Logger::LogToFileOnly(FILE *fp, const char *msg, ...)
{
if (!m_Active)
{
return;
}
va_list ap;
va_start(ap, msg);
LogToFileOnlyEx(fp, msg, ap);
va_end(ap);
}
void Logger::LogToOpenFileEx(FILE *fp, const char *msg, va_list ap)
{
if (!m_Active)
{
return;
}
static ConVar *sv_logecho = smcore.FindConVar("sv_logecho");
char buffer[3072];
smcore.FormatArgs(buffer, sizeof(buffer), msg, ap);
char date[32];
time_t t = g_pSM->GetAdjustedTime();
tm *curtime = localtime(&t);
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
fprintf(fp, "L %s: %s\n", date, buffer);
if (!sv_logecho || smcore.GetCvarBool(sv_logecho))
{
static char conBuffer[4096];
smcore.Format(conBuffer, sizeof(conBuffer), "L %s: %s\n", date, buffer);
smcore.ConPrint(conBuffer);
}
}
void Logger::LogToFileOnlyEx(FILE *fp, const char *msg, va_list ap)
{
if (!m_Active)
{
return;
}
char buffer[3072];
smcore.FormatArgs(buffer, sizeof(buffer), msg, ap);
char date[32];
time_t t = g_pSM->GetAdjustedTime();
tm *curtime = localtime(&t);
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
fprintf(fp, "L %s: %s\n", date, buffer);
fflush(fp);
}
void Logger::LogMessage(const char *vafmt, ...)
{
va_list ap;
va_start(ap, vafmt);
LogMessageEx(vafmt, ap);
va_end(ap);
}
void Logger::LogMessageEx(const char *vafmt, va_list ap)
{
if (!m_Active)
{
return;
}
if (m_Mode == LoggingMode_Game)
{
_PrintToGameLog(vafmt, ap);
return;
}
if (m_DelayedStart)
{
m_DelayedStart = false;
_NewMapFile();
}
time_t t = g_pSM->GetAdjustedTime();
tm *curtime = localtime(&t);
FILE *fp = NULL;
if (m_Mode == LoggingMode_PerMap)
{
fp = fopen(m_NrmFileName.c_str(), "a+");
if (!fp)
{
_NewMapFile();
fp = fopen(m_NrmFileName.c_str(), "a+");
if (!fp)
{
goto print_error;
}
}
} else {
if (m_NrmCurDay != curtime->tm_mday)
{
char _filename[256];
g_pSM->BuildPath(Path_SM, _filename, sizeof(_filename), "logs/L%04d%02d%02d.log", curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday);
m_NrmFileName.assign(_filename);
m_NrmCurDay = curtime->tm_mday;
m_DailyPrintHdr = true;
}
fp = fopen(m_NrmFileName.c_str(), "a+");
}
if (fp)
{
if (m_DailyPrintHdr)
{
char date[32];
m_DailyPrintHdr = false;
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
fprintf(fp, "L %s: SourceMod log file session started (file \"L%04d%02d%02d.log\") (Version \"%s\")\n", date, curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday, SOURCEMOD_VERSION);
}
LogToOpenFileEx(fp, vafmt, ap);
fclose(fp);
} else {
goto print_error;
}
return;
print_error:
char error[255];
libsys->GetPlatformError(error, sizeof(error));
LogFatal("[SM] Unexpected fatal logging error (file \"%s\")", m_NrmFileName.c_str());
LogFatal("[SM] Platform returned error: \"%s\"", error);
LogFatal("[SM] Logging has been disabled.");
m_Active = false;
}
void Logger::LogError(const char *vafmt, ...)
{
va_list ap;
va_start(ap, vafmt);
LogErrorEx(vafmt, ap);
va_end(ap);
}
void Logger::LogErrorEx(const char *vafmt, va_list ap)
{
if (!m_Active)
{
return;
}
time_t t = g_pSM->GetAdjustedTime();
tm *curtime = localtime(&t);
if (curtime->tm_mday != m_ErrCurDay)
{
char _filename[256];
g_pSM->BuildPath(Path_SM, _filename, sizeof(_filename), "logs/errors_%04d%02d%02d.log", curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday);
m_ErrFileName.assign(_filename);
m_ErrCurDay = curtime->tm_mday;
m_ErrMapStart = false;
}
FILE *fp = fopen(m_ErrFileName.c_str(), "a+");
if (fp)
{
if (!m_ErrMapStart)
{
char date[32];
strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
fprintf(fp, "L %s: SourceMod error session started\n", date);
fprintf(fp, "L %s: Info (map \"%s\") (file \"errors_%04d%02d%02d.log\")\n", date, m_CurMapName.c_str(), curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday);
m_ErrMapStart = true;
}
LogToOpenFileEx(fp, vafmt, ap);
fclose(fp);
}
else
{
char error[255];
libsys->GetPlatformError(error, sizeof(error));
LogFatal("[SM] Unexpected fatal logging error (file \"%s\")", m_NrmFileName.c_str());
LogFatal("[SM] Platform returned error: \"%s\"", error);
LogFatal("[SM] Logging has been disabled.");
m_Active = false;
return;
}
}
void Logger::MapChange(const char *mapname)
{
m_CurMapName.assign(mapname);
switch (m_Mode)
{
case LoggingMode_Daily:
{
LogMessage("-------- Mapchange to %s --------", mapname);
break;
}
case LoggingMode_PerMap:
{
_NewMapFile();
break;
}
default:
{
/* Do nothing... */
break;
}
}
if (m_ErrMapStart)
{
LogError("Error log file session closed.");
}
m_ErrMapStart = false;
}
void Logger::_PrintToGameLog(const char *fmt, va_list ap)
{
char msg[3072];
size_t len;
len = vsnprintf(msg, sizeof(msg)-2, fmt, ap);
len = (len >= sizeof(msg)) ? (sizeof(msg) - 2) : len;
msg[len++] = '\n';
msg[len] = '\0';
smcore.LogToGame(msg);
}
const char *Logger::GetLogFileName(LogType type) const
{
switch (type)
{
case LogType_Normal:
{
return m_NrmFileName.c_str();
}
case LogType_Error:
{
return m_ErrFileName.c_str();
}
default:
{
return "";
}
}
}
LoggingMode Logger::GetLoggingMode() const
{
return m_Mode;
}
void Logger::EnableLogging()
{
if (m_Active)
{
return;
}
m_Active = true;
LogMessage("[SM] Logging enabled manually by user.");
}
void Logger::DisableLogging()
{
if (!m_Active)
{
return;
}
LogMessage("[SM] Logging disabled manually by user.");
m_Active = false;
}
void Logger::LogFatal(const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
LogFatalEx(msg, ap);
va_end(ap);
}
void Logger::LogFatalEx(const char *msg, va_list ap)
{
/* :TODO: make this print all pretty-like
* In fact, the pretty log printing function should be abstracted.
* It's already implemented twice which is bad.
*/
char path[PLATFORM_MAX_PATH];
g_pSM->BuildPath(Path_Game, path, sizeof(path), "sourcemod_fatal.log");
FILE *fp = fopen(path, "at");
if (fp)
{
m_Active = true;
LogToOpenFileEx(fp, msg, ap);
m_Active = false;
fclose(fp);
}
}
+111
View File
@@ -0,0 +1,111 @@
/**
* 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_CLOGGER_H_
#define _INCLUDE_SOURCEMOD_CLOGGER_H_
#include <stdio.h>
#include <sh_string.h>
#include "common_logic.h"
using namespace SourceHook;
enum LogType
{
LogType_Normal,
LogType_Error
};
enum LoggingMode
{
LoggingMode_Daily,
LoggingMode_PerMap,
LoggingMode_Game
};
class Logger : public SMGlobalClass, public ILogger
{
public:
Logger() : m_Mode(LoggingMode_Daily), m_ErrMapStart(false),
m_Active(false), m_DelayedStart(false), m_DailyPrintHdr(false),
m_InitialState(true)
{
}
public: //SMGlobalClass
ConfigResult OnSourceModConfigChanged(const char *key,
const char *value,
ConfigSource source,
char *error,
size_t maxlength);
void OnSourceModStartup(bool late);
void OnSourceModAllShutdown();
void OnSourceModLevelChange(const char *mapName);
public:
void InitLogger(LoggingMode mode);
void CloseLogger();
void EnableLogging();
void DisableLogging();
void LogMessage(const char *msg, ...);
void LogMessageEx(const char *msg, va_list ap);
void LogError(const char *msg, ...);
void LogErrorEx(const char *msg, va_list ap);
void LogFatal(const char *msg, ...);
void LogFatalEx(const char *msg, va_list ap);
void LogToOpenFile(FILE *fp, const char *msg, ...);
void LogToOpenFileEx(FILE *fp, const char *msg, va_list ap);
/* This version does not print to console, and is thus thread-safe */
void LogToFileOnly(FILE *fp, const char *msg, ...);
void LogToFileOnlyEx(FILE *fp, const char *msg, va_list ap);
void MapChange(const char *mapname);
const char *GetLogFileName(LogType type) const;
LoggingMode GetLoggingMode() const;
private:
void _CloseFile();
void _NewMapFile();
void _PrintToGameLog(const char *fmt, va_list ap);
private:
String m_NrmFileName;
String m_ErrFileName;
String m_CurMapName;
LoggingMode m_Mode;
int m_NrmCurDay;
int m_ErrCurDay;
bool m_ErrMapStart;
bool m_Active;
bool m_DelayedStart;
bool m_DailyPrintHdr;
bool m_InitialState;
};
extern Logger g_Logger;
#endif // _INCLUDE_SOURCEMOD_CLOGGER_H_
+2 -1
View File
@@ -40,7 +40,8 @@ OBJECTS = \
smn_datapacks.cpp \
smn_gameconfigs.cpp \
GameConfigs.cpp \
smn_players.cpp
smn_players.cpp \
smn_profiler.cpp
##############################################
### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
+1 -1
View File
@@ -116,7 +116,7 @@ void *MemoryUtils::FindPattern(const void *libPtr, const char *pattern, size_t l
}
ptr = reinterpret_cast<char *>(lib.baseAddress);
end = ptr + lib.memorySize;
end = ptr + lib.memorySize - len;
while (ptr < end)
{
@@ -1,112 +1,98 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#include <string.h>
#include <stdlib.h>
#include "sm_memtable.h"
BaseMemTable::BaseMemTable(unsigned int init_size)
{
membase = (unsigned char *)malloc(init_size);
size = init_size;
tail = 0;
}
BaseMemTable::~BaseMemTable()
{
free(membase);
membase = NULL;
}
int BaseMemTable::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;
}
void *BaseMemTable::GetAddress(int index)
{
if (index < 0 || (unsigned int)index >= tail)
{
return NULL;
}
return &membase[index];
}
void BaseMemTable::Reset()
{
tail = 0;
}
BaseStringTable::BaseStringTable(unsigned int init_size) : m_table(init_size)
{
}
BaseStringTable::~BaseStringTable()
{
}
int BaseStringTable::AddString(const char *string)
{
size_t len = strlen(string) + 1;
int idx;
char *addr;
idx = m_table.CreateMem(len, (void **)&addr);
strcpy(addr, string);
return idx;
}
/*const char *BaseStringTable::GetString(int str)
{
return (const char *)m_table.GetAddress(str);
}*/
void BaseStringTable::Reset()
{
m_table.Reset();
}
/**
* 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$
*/
#ifndef _include_sourcemod_native_h_
#define _include_sourcemod_native_h_
#include <IShareSys.h>
#include <IHandleSys.h>
#include <am-string.h>
#include <am-utility.h>
#include <am-refcounting.h>
#include "common_logic.h"
struct FakeNative
{
FakeNative(const char *name, IPluginFunction *fun)
: name(name),
ctx(fun->GetParentContext()),
call(fun),
gate(NULL)
{
}
~FakeNative();
ke::AString name;
IPluginContext *ctx;
IPluginFunction *call;
SPVM_NATIVE_FUNC gate;
};
struct Native : public ke::Refcounted<Native>
{
Native(CNativeOwner *owner, const sp_nativeinfo_t *native)
: owner(owner),
native(native),
fake(NULL)
{
}
Native(CNativeOwner *owner, FakeNative *fake)
: owner(owner),
native(NULL),
fake(fake)
{
}
CNativeOwner *owner;
const sp_nativeinfo_t *native;
ke::AutoPtr<FakeNative> fake;
SPVM_NATIVE_FUNC func() const
{
if (native)
return native->func;
return fake->gate;
}
const char *name() const
{
if (native)
return native->name;
return fake->name.chars();
}
static inline bool matches(const char *name, const ke::Ref<Native> &entry)
{
return strcmp(name, entry->name()) == 0;
}
};
#endif // _include_sourcemod_native_h_
@@ -1,5 +1,5 @@
/**
* vim: set ts=4 :
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourcePawn
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
@@ -54,7 +54,7 @@ unsigned int NativeInterface::GetInterfaceVersion()
void NativeInterface::OnSourceModAllInitialized()
{
g_ShareSys.AddInterface(NULL, &g_NInvoke);
sharesys->AddInterface(NULL, &g_NInvoke);
}
IPluginRuntime *NativeInterface::CreateRuntime(const char *name, size_t bytes)
@@ -69,30 +69,15 @@ INativeInvoker *NativeInterface::CreateInvoker()
bool NativeInvoker::Start(IPluginContext *pContext, const char *name)
{
NativeEntry *entry;
entry = g_ShareSys.FindNative(name);
if (entry == NULL)
{
ke::Ref<Native> entry = g_ShareSys.FindNative(name);
if (!entry)
return false;
}
native = NULL;
if (entry->replacement.owner != NULL)
{
native = entry->replacement.func;
}
else if (entry->owner != NULL)
{
native = entry->func;
}
if (native == NULL)
{
if (!entry->owner)
return false;
}
this->pContext = pContext;
native_ = entry->func();
context_ = pContext;
m_curparam = 0;
m_errorstate = SP_ERROR_NONE;
@@ -184,15 +169,13 @@ int NativeInvoker::_PushString(const char *string, int sz_flags, int cp_flags, s
void NativeInvoker::Cancel()
{
if (pContext == NULL)
{
if (context_ == NULL)
return;
}
m_errorstate = SP_ERROR_NONE;
m_curparam = 0;
pContext = NULL;
native = NULL;
context_ = NULL;
native_ = NULL;
}
int NativeInvoker::SetError(int err)
@@ -205,10 +188,8 @@ int NativeInvoker::Invoke(cell_t *result)
{
int err = SP_ERROR_NONE;
if (pContext == NULL)
{
if (context_ == NULL)
return SP_ERROR_INVALID_NATIVE;
}
if (m_errorstate != SP_ERROR_NONE)
{
@@ -225,7 +206,7 @@ int NativeInvoker::Invoke(cell_t *result)
}
//This is for re-entrancy!
IPluginContext *ctx = pContext;
IPluginContext *ctx = context_;
cell_t _temp_params[SP_MAX_EXEC_PARAMS + 1];
cell_t *temp_params = &_temp_params[1];
ParamInfo temp_info[SP_MAX_EXEC_PARAMS];
@@ -239,7 +220,7 @@ int NativeInvoker::Invoke(cell_t *result)
memcpy(temp_info, m_info, numparams * sizeof(ParamInfo));
}
m_curparam = 0;
pContext = NULL;
context_ = NULL;
/* Initialize 0th parameter */
_temp_params[0] = numparams;
@@ -324,7 +305,7 @@ int NativeInvoker::Invoke(cell_t *result)
/* Make the call if we can */
if (err == SP_ERROR_NONE)
{
*result = native(ctx, _temp_params);
*result = native_(ctx, _temp_params);
if (ctx->GetLastNativeError() != SP_ERROR_NONE)
{
docopies = false;
@@ -32,8 +32,12 @@
#ifndef _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_
#define _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_
#include "sm_globals.h"
#include <sp_vm_api.h>
#include <INativeInvoker.h>
#include "common_logic.h"
using namespace SourceMod;
using namespace SourcePawn;
struct ParamInfo
{
@@ -71,8 +75,8 @@ private:
int _PushString(const char *string, int sz_flags, int cp_flags, size_t len);
int SetError(int err);
private:
IPluginContext *pContext;
SPVM_NATIVE_FUNC native;
IPluginContext *context_;
SPVM_NATIVE_FUNC native_;
cell_t m_params[SP_MAX_EXEC_PARAMS];
ParamInfo m_info[SP_MAX_EXEC_PARAMS];
unsigned int m_curparam;
+143
View File
@@ -0,0 +1,143 @@
/**
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourcePawn
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#include "NativeOwner.h"
#include "ShareSys.h"
#include "PluginSys.h"
CNativeOwner::CNativeOwner() : m_nMarkSerial(0)
{
}
void CNativeOwner::SetMarkSerial(unsigned int serial)
{
m_nMarkSerial = serial;
}
unsigned int CNativeOwner::GetMarkSerial()
{
return m_nMarkSerial;
}
void CNativeOwner::AddDependent(CPlugin *pPlugin)
{
m_Dependents.push_back(pPlugin);
}
void CNativeOwner::AddWeakRef(const WeakNative & ref)
{
m_WeakRefs.push_back(ref);
}
void CNativeOwner::AddNatives(const sp_nativeinfo_t *natives)
{
for (const sp_nativeinfo_t *native = natives; native->func && native->name; native++)
g_ShareSys.AddNativeToCache(this, native);
m_natives.append(natives);
}
void CNativeOwner::PropagateMarkSerial(unsigned int serial)
{
CNativeOwner *pOwner;
List<CPlugin *>::iterator iter;
for (iter = m_Dependents.begin();
iter != m_Dependents.end();
iter++)
{
pOwner = (*iter);
pOwner->SetMarkSerial(serial);
}
}
void CNativeOwner::UnbindWeakRef(const WeakNative &ref)
{
sp_native_t *native;
IPluginContext *pContext;
pContext = ref.pl->GetBaseContext();
if ((pContext->GetNativeByIndex(ref.idx, &native)) == SP_ERROR_NONE)
{
native->status = SP_NATIVE_UNBOUND;
native->pfn = NULL;
}
}
void CNativeOwner::DropEverything()
{
List<WeakNative>::iterator iter;
/* Unbind and remove all weak references to us */
iter = m_WeakRefs.begin();
while (iter != m_WeakRefs.end())
{
UnbindWeakRef((*iter));
iter = m_WeakRefs.erase(iter);
}
/* Strip all of our natives from the cache */
for (size_t i = 0; i < m_natives.length(); i++) {
const sp_nativeinfo_t *natives = m_natives[i];
for (const sp_nativeinfo_t *native = natives; native->func && native->name; native++)
g_ShareSys.ClearNativeFromCache(this, native->name);
}
m_natives.clear();
for (size_t i = 0; i < m_fakes.length(); i++)
g_ShareSys.ClearNativeFromCache(this, m_fakes[i]->name());
m_fakes.clear();
}
void CNativeOwner::DropWeakRefsTo(CPlugin *pPlugin)
{
List<WeakNative>::iterator iter;
iter = m_WeakRefs.begin();
while (iter != m_WeakRefs.end())
{
WeakNative & ref = (*iter);
if (ref.pl == pPlugin)
{
iter = m_WeakRefs.erase(iter);
}
else
{
iter++;
}
}
}
void CNativeOwner::DropRefsTo(CPlugin *pPlugin)
{
m_Dependents.remove(pPlugin);
DropWeakRefsTo(pPlugin);
}
+89
View File
@@ -0,0 +1,89 @@
/**
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourcePawn
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#ifndef _INCLUDE_SOURCEMOD_NATIVE_OWNER_H_
#define _INCLUDE_SOURCEMOD_NATIVE_OWNER_H_
#include <sp_vm_types.h>
#include <sh_list.h>
#include <am-linkedlist.h>
#include <am-vector.h>
#include "common_logic.h"
#include "Native.h"
struct Native;
class CPlugin;
using namespace SourceMod;
struct WeakNative
{
WeakNative(IPlugin *plugin, uint32_t index) :
pl(plugin), idx(index)
{
pl = plugin;
idx = index;
}
IPlugin *pl;
uint32_t idx;
};
using namespace SourceHook;
class CNativeOwner
{
public:
CNativeOwner();
public:
virtual void DropEverything();
public:
void AddNatives(const sp_nativeinfo_t *info);
public:
void SetMarkSerial(unsigned int serial);
unsigned int GetMarkSerial();
void PropagateMarkSerial(unsigned int serial);
public:
void AddDependent(CPlugin *pPlugin);
void AddWeakRef(const WeakNative & ref);
void DropRefsTo(CPlugin *pPlugin);
private:
void DropWeakRefsTo(CPlugin *pPlugin);
void UnbindWeakRef(const WeakNative & ref);
protected:
List<CPlugin *> m_Dependents;
unsigned int m_nMarkSerial;
List<WeakNative> m_WeakRefs;
ke::Vector<const sp_nativeinfo_t *> m_natives;
ke::Vector<ke::Ref<Native> > m_fakes;
};
extern CNativeOwner g_CoreNatives;
#endif //_INCLUDE_SOURCEMOD_NATIVE_OWNER_H_
File diff suppressed because it is too large Load Diff
+56 -40
View File
@@ -1,5 +1,5 @@
/**
* vim: set ts=4 :
* vim: set ts=4 sw=4 tw=99 noet :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
@@ -42,21 +42,12 @@
#include <sh_stack.h>
#include <sh_vector.h>
#include <sh_string.h>
#include "sm_globals.h"
#include "PluginInfoDatabase.h"
#include "sm_trie.h"
#include "sourcemod.h"
#include "common_logic.h"
#include <IRootConsoleMenu.h>
#if SOURCE_ENGINE == SE_ALIENSWARM
#include "convar_sm_swarm.h"
#elif (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
#include "convar_sm_l4d.h"
#elif (SOURCE_ENGINE == SE_ORANGEBOX) || (SOURCE_ENGINE == SE_BLOODYGOODTIME) || (SOURCE_ENGINE == SE_EYE) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE)
#include "convar_sm_ob.h"
#else
#include "convar_sm.h"
#endif
#include <sm_stringhashmap.h>
#include <sm_namehashset.h>
#include "ITranslator.h"
#include "IGameConfigs.h"
#include "NativeOwner.h"
#include "ShareSys.h"
@@ -130,17 +121,8 @@ enum APLRes
APLRes_SilentFailure
};
struct AutoConfig
{
String autocfg;
String folder;
bool create;
};
class CPlugin;
class CPlugin :
public IPlugin,
public SMPlugin,
public CNativeOwner
{
friend class CPluginManager;
@@ -167,6 +149,9 @@ public:
bool GetProperty(const char *prop, void **ptr, bool remove=false);
void DropEverything();
SourcePawn::IPluginRuntime *GetRuntime();
CNativeOwner *ToNativeOwner() {
return this;
}
public:
/**
* Creates a plugin object with default values.
@@ -176,6 +161,11 @@ public:
* a valid (but error-stated) CPlugin will be returned.
*/
static CPlugin *CreatePlugin(const char *file, char *error, size_t maxlength);
static inline bool matches(const char *file, const CPlugin *plugin)
{
return strcmp(plugin->m_filename, file) == 0;
}
public:
/**
@@ -214,6 +204,11 @@ public:
*/
void Call_OnAllPluginsLoaded();
/**
* Calls the OnLibraryAdded function.
*/
void Call_OnLibraryAdded(const char *lib);
/**
* Returns true if a plugin is usable.
*/
@@ -243,13 +238,13 @@ public:
bool AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func);
void AddConfig(bool autoCreate, const char *cfg, const char *folder);
unsigned int GetConfigCount();
AutoConfig *GetConfig(unsigned int i);
size_t GetConfigCount();
AutoConfig *GetConfig(size_t i);
inline void AddLibrary(const char *name)
{
m_Libraries.push_back(name);
}
void LibraryActions(bool dropping);
void LibraryActions(LibraryAction action);
void SyncMaxClients(int max_clients);
protected:
bool UpdateInfo();
@@ -270,7 +265,7 @@ private:
IPhraseCollection *m_pPhrases;
List<String> m_RequiredLibs;
List<String> m_Libraries;
Trie *m_pProps;
StringHashMap<void *> m_Props;
bool m_FakeNativesMissing;
bool m_LibraryMissing;
CVector<AutoConfig *> m_configs;
@@ -283,7 +278,7 @@ private:
};
class CPluginManager :
public IPluginManager,
public IScriptManager,
public SMGlobalClass,
public IHandleTypeDispatch,
public IRootConsoleCommand
@@ -310,7 +305,7 @@ public:
List<CPlugin *>::iterator current;
};
friend class CPluginManager::CPluginIterator;
public: //IPluginManager
public: //IScriptManager
IPlugin *LoadPlugin(const char *path,
bool debug,
PluginType type,
@@ -323,9 +318,30 @@ public: //IPluginManager
IPluginIterator *GetPluginIterator();
void AddPluginsListener(IPluginsListener *listener);
void RemovePluginsListener(IPluginsListener *listener);
void LoadAll(const char *config_path, const char *plugins_path);
void RefreshAll();
SMPlugin *FindPluginByOrder(unsigned num) {
return GetPluginByOrder(num);
}
SMPlugin *FindPluginByIdentity(IdentityToken_t *ident) {
return GetPluginFromIdentity(ident);
}
SMPlugin *FindPluginByContext(IPluginContext *ctx) {
return GetPluginByCtx(ctx->GetContext());
}
SMPlugin *FindPluginByContext(sp_context_t *ctx) {
return GetPluginByCtx(ctx);
}
SMPlugin *FindPluginByConsoleArg(const char *text);
SMPlugin *FindPluginByHandle(Handle_t hndl, HandleError *errp) {
return static_cast<SMPlugin *>(PluginFromHandle(hndl, errp));
}
const CVector<SMPlugin *> *ListPlugins();
void FreePluginList(const CVector<SMPlugin *> *plugins);
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);
@@ -381,11 +397,6 @@ public:
*/
const char *GetStatusText(PluginStatus status);
/**
* Reload or update plugins on level shutdown.
*/
void ReloadOrUnloadPlugins();
/**
* Add public functions from all running or paused
* plugins to the specified forward if the names match.
@@ -401,7 +412,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);
@@ -409,8 +420,6 @@ public:
void UnloadAll();
CPlugin *FindPluginByConsoleArg(const char *arg);
void SyncMaxClients(int max_clients);
void ListPluginsToClient(CPlayer *player, const CCommand &args);
@@ -455,14 +464,14 @@ public:
{
return m_MyIdent;
}
IPluginManager *GetOldAPI();
private:
void TryRefreshDependencies(CPlugin *pOther);
private:
List<IPluginsListener *> m_listeners;
List<CPlugin *> m_plugins;
CStack<CPluginManager::CPluginIterator *> m_iters;
CPluginInfoDatabase m_PluginInfo;
Trie *m_LoadLookup;
NameHashSet<CPlugin *> m_LoadLookup;
bool m_AllPluginsLoaded;
IdentityToken_t *m_MyIdent;
@@ -470,6 +479,13 @@ private:
List<FakeNative *> m_Natives;
bool m_LoadingLocked;
// Config
bool m_bBlockBadPlugins;
// Forwards
IForward *m_pOnLibraryAdded;
IForward *m_pOnLibraryRemoved;
};
extern CPluginManager g_PluginSys;
+190
View File
@@ -0,0 +1,190 @@
// vim: set ts=4 sw=4 tw=99 noet :
// =============================================================================
// SourceMod
// Copyright (C) 2004-2014 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 "ProfileTools.h"
#include <stdarg.h>
ProfileToolManager g_ProfileToolManager;
ProfileToolManager::ProfileToolManager()
: active_(nullptr),
default_(nullptr)
{
}
void
ProfileToolManager::OnSourceModAllInitialized()
{
rootmenu->AddRootConsoleCommand2("prof", "Profiling", this);
}
void
ProfileToolManager::OnSourceModShutdown()
{
rootmenu->RemoveRootConsoleCommand("prof", this);
}
IProfilingTool *
ProfileToolManager::FindToolByName(const char *name)
{
for (size_t i = 0; i < tools_.length(); i++) {
if (strcmp(tools_[i]->Name(), name) == 0)
return tools_[i];
}
return nullptr;
}
static void
render_help(const char *fmt, ...)
{
char buffer[2048];
va_list ap;
va_start(ap, fmt);
smcore.FormatArgs(buffer, sizeof(buffer), fmt, ap);
va_end(ap);
rootmenu->ConsolePrint("%s", buffer);
}
void
ProfileToolManager::StartFromConsole(IProfilingTool *tool)
{
if (active_) {
rootmenu->ConsolePrint("A profile is already active using %s.", active_->Name());
return;
}
active_ = tool;
if (!active_->Start()) {
rootmenu->ConsolePrint("Failed to attach to or start %s.", active_->Name());
active_ = nullptr;
return;
}
g_pSourcePawn2->SetProfilingTool(active_);
g_pSourcePawn2->EnableProfiling();
rootmenu->ConsolePrint("Started profiling with %s.", active_->Name());
default_ = active_;
}
void
ProfileToolManager::OnRootConsoleCommand2(const char *cmdname, const ICommandArgs *args)
{
if (tools_.length() == 0) {
rootmenu->ConsolePrint("No profiling tools are enabled.");
return;
}
if (args->ArgC() >= 3) {
cmdname = args->Arg(2);
if (strcmp(cmdname, "list") == 0) {
rootmenu->ConsolePrint("Profiling tools:");
for (size_t i = 0; i < tools_.length(); i++) {
rootmenu->DrawGenericOption(tools_[i]->Name(), tools_[i]->Description());
}
return;
}
if (strcmp(cmdname, "stop") == 0) {
if (!active_) {
rootmenu->ConsolePrint("No profiler is active.");
return;
}
g_pSourcePawn2->DisableProfiling();
g_pSourcePawn2->SetProfilingTool(nullptr);
active_->Stop(render_help);
active_ = nullptr;
return;
}
if (strcmp(cmdname, "dump") == 0) {
if (active_) {
// if we have an active profiler, dump it
active_->Dump();
return;
}
}
if (args->ArgC() < 4) {
if (strcmp(cmdname, "start") == 0) {
if (!default_) {
default_ = FindToolByName("vprof");
if (!default_ && tools_.length() > 0)
default_ = tools_[0];
if (!default_) {
rootmenu->ConsolePrint("Could not find any profiler to use.");
return;
}
}
StartFromConsole(default_);
return;
}
}
if (args->ArgC() < 4) {
rootmenu->ConsolePrint("You must specify a profiling tool name.");
return;
}
const char *toolname = args->Arg(3);
if (strcmp(cmdname, "start") == 0) {
IProfilingTool *tool = FindToolByName(toolname);
if (!tool) {
rootmenu->ConsolePrint("No tool with the name \"%s\" was found.", toolname);
return;
}
StartFromConsole(tool);
return;
}
if (strcmp(cmdname, "dump") == 0) {
IProfilingTool *tool = FindToolByName(toolname);
if (!tool) {
rootmenu->ConsolePrint("No tool with the name \"%s\" was found.", toolname);
return;
}
tool->Dump();
return;
}
if (strcmp(cmdname, "help") == 0) {
IProfilingTool *tool = FindToolByName(toolname);
if (!tool) {
rootmenu->ConsolePrint("No tool with the name \"%s\" was found.", toolname);
return;
}
tool->RenderHelp(render_help);
return;
}
}
rootmenu->ConsolePrint("Profiling commands:");
rootmenu->DrawGenericOption("list", "List all available profiling tools.");
rootmenu->DrawGenericOption("start", "Start a profile with a given tool.");
rootmenu->DrawGenericOption("stop", "Stop the current profile session.");
rootmenu->DrawGenericOption("dump", "Dumps output from the current profile session.");
rootmenu->DrawGenericOption("help", "Display help text for a profiler.");
}
+87
View File
@@ -0,0 +1,87 @@
// vim: set ts=4 sw=4 tw=99 noet :
// =============================================================================
// SourceMod
// Copyright (C) 2004-2014 AlliedModders LLC. All rights reserved.
// =============================================================================
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License, version 3.0, as published by the
// Free Software Foundation.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License along with
// this program. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, AlliedModders LLC gives you permission to link the
// code of this program (as well as its derivative works) to "Half-Life 2," the
// "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
// by the Valve Corporation. You must obey the GNU General Public License in
// all respects for all other code used. Additionally, AlliedModders LLC grants
// this exception to all derivative works. AlliedModders LLC defines further
// exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
// or <http://www.sourcemod.net/license.php>.
#ifndef _include_sourcemod_logic_profile_tool_manager_h_
#define _include_sourcemod_logic_profile_tool_manager_h_
#include <sp_vm_api.h>
#include <am-vector.h>
#include <IShareSys.h>
#include <IRootConsoleMenu.h>
#include "common_logic.h"
using namespace SourcePawn;
class ProfileToolManager
: public SMGlobalClass,
public IRootConsoleCommand
{
public:
ProfileToolManager();
// SMGlobalClass
void OnSourceModAllInitialized() KE_OVERRIDE;
void OnSourceModShutdown() KE_OVERRIDE;
// IRootConsoleCommand
void OnRootConsoleCommand2(const char *cmdname, const ICommandArgs *args) KE_OVERRIDE;
void RegisterTool(IProfilingTool *tool) {
tools_.append(tool);
}
bool IsActive() const {
return !!active_;
}
// If we get problems with plugins not being able to balance the profile
// scopes, we should add a safety net that automatically clears any pending
// scopes.
void EnterScope(const char *group, const char *name) {
if (active_)
active_->EnterScope(group, name);
}
void LeaveScope() {
if (active_)
active_->LeaveScope();
}
IProfilingTool *FindToolByName(const char *name);
private:
void StartFromConsole(IProfilingTool *tool);
private:
ke::Vector<IProfilingTool *> tools_;
IProfilingTool *active_;
IProfilingTool *default_;
bool enabled_;
};
extern ProfileToolManager g_ProfileToolManager;
#endif // _include_sourcemod_logic_profile_tool_manager_h_
-518
View File
@@ -1,518 +0,0 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#include "Profiler.h"
#include <ISourceMod.h>
#if defined PLATFORM_POSIX
#include <sys/time.h>
#include <time.h>
#endif
#include <IPluginSys.h>
#include "stringutil.h"
ProfileEngine g_Profiler;
IProfiler *sm_profiler = &g_Profiler;
#if defined PLATFORM_WINDOWS
double WINDOWS_PERFORMANCE_FREQUENCY;
#endif
class EmptyProfiler : public IProfiler
{
public:
void OnNativeBegin(IPluginContext *pContext, sp_native_t *native)
{
}
void OnNativeEnd()
{
}
void OnFunctionBegin(IPluginContext *pContext, const char *name)
{
}
void OnFunctionEnd()
{
}
int OnCallbackBegin(IPluginContext *pContext, sp_public_t *pubfunc)
{
return 0;
}
void OnCallbackEnd(int serial)
{
}
} s_EmptyProfiler;
inline void InitProfPoint(prof_point_t &pt)
{
#if defined PLATFORM_WINDOWS
QueryPerformanceCounter(&pt.value);
#elif defined PLATFORM_POSIX
gettimeofday(&pt.value, NULL);
#endif
pt.is_set = true;
}
ProfileEngine::ProfileEngine()
{
m_serial = 0;
#if defined PLATFORM_WINDOWS
LARGE_INTEGER pf;
if (QueryPerformanceFrequency(&pf))
{
WINDOWS_PERFORMANCE_FREQUENCY = 1.0 / (double)(pf.QuadPart);
}
else
{
WINDOWS_PERFORMANCE_FREQUENCY = -1.0;
}
#endif
if (IsEnabled())
{
InitProfPoint(m_ProfStart);
}
else
{
sm_profiler = &s_EmptyProfiler;
}
}
bool ProfileEngine::IsEnabled()
{
#if defined PLATFORM_WINDOWS
return (WINDOWS_PERFORMANCE_FREQUENCY > 0.0);
#elif defined PLATFORM_POSIX
return true;
#endif
}
inline double DiffProfPoints(const prof_point_t &start, const prof_point_t &end)
{
double seconds;
#if defined PLATFORM_WINDOWS
LONGLONG diff;
diff = end.value.QuadPart - start.value.QuadPart;
seconds = diff * WINDOWS_PERFORMANCE_FREQUENCY;
#elif defined PLATFORM_POSIX
seconds = (double)(end.value.tv_sec - start.value.tv_sec);
if (start.value.tv_usec > end.value.tv_usec)
{
seconds -= 1.0;
seconds += (double)(1000000 - (start.value.tv_usec - end.value.tv_usec)) / 1000000.0;
}
else
{
seconds += (double)(end.value.tv_usec - start.value.tv_usec) / 1000000.0;
}
#endif
return seconds;
}
inline double CalcAtomTime(const prof_atom_t &atom)
{
if (!atom.end.is_set)
{
return atom.base_time;
}
return atom.base_time + DiffProfPoints(atom.start, atom.end);
}
void ProfileEngine::OnNativeBegin(IPluginContext *pContext, sp_native_t *native)
{
PushProfileStack(pContext, SP_PROF_NATIVES, native->name);
}
void ProfileEngine::OnNativeEnd()
{
assert(!m_AtomStack.empty());
assert(m_AtomStack.front().atom_type == SP_PROF_NATIVES);
PopProfileStack(&m_Natives);
}
void ProfileEngine::OnFunctionBegin(IPluginContext *pContext, const char *name)
{
PushProfileStack(pContext, SP_PROF_FUNCTIONS, name);
}
void ProfileEngine::OnFunctionEnd()
{
assert(!m_AtomStack.empty());
assert(m_AtomStack.front().atom_type == SP_PROF_FUNCTIONS);
PopProfileStack(&m_Functions);
}
int ProfileEngine::OnCallbackBegin(IPluginContext *pContext, sp_public_t *pubfunc)
{
PushProfileStack(pContext, SP_PROF_CALLBACKS, pubfunc->name);
return m_serial;
}
void ProfileEngine::OnCallbackEnd(int serial)
{
assert(!m_AtomStack.empty());
/**
* Account for the situation where the JIT discards the
* stack because there was an RTE of sorts.
*/
if (m_AtomStack.front().atom_type != SP_PROF_CALLBACKS
&& m_AtomStack.front().atom_serial != serial)
{
prof_atom_t atom;
double total_time;
/* There was an error, and we need to discard things. */
total_time = 0.0;
while (!m_AtomStack.empty()
&& m_AtomStack.front().atom_type != SP_PROF_CALLBACKS
&& m_AtomStack.front().atom_serial != serial)
{
total_time += CalcAtomTime(m_AtomStack.front());
m_AtomStack.pop();
}
/**
* Now we can end and discard ourselves, without saving the data.
* Since this data is all erroneous anyway, we don't care if it's
* not totally accurate.
*/
assert(!m_AtomStack.empty());
atom = m_AtomStack.front();
m_AtomStack.pop();
/* Note: We don't need to resume ourselves because end is set by Pause(). */
total_time += CalcAtomTime(atom);
ResumeParent(total_time);
return;
}
PopProfileStack(&m_Callbacks);
}
void ProfileEngine::PushProfileStack(IPluginContext *ctx, int type, const char *name)
{
prof_atom_t atom;
PauseParent();
atom.atom_type = type;
atom.base_time = 0.0;
atom.ctx = ctx->GetContext();
atom.name = name;
atom.end.is_set = false;
if (type == SP_PROF_CALLBACKS)
{
atom.atom_serial = ++m_serial;
}
else
{
atom.atom_serial = 0;
}
m_AtomStack.push(atom);
/* Note: We do this after because the stack could grow and skew results */
InitProfPoint(m_AtomStack.front().start);
}
void ProfileEngine::PopProfileStack(ProfileReport *reporter)
{
double total_time;
prof_atom_t &atom = m_AtomStack.front();
/* We're okay to cache our used time. */
InitProfPoint(atom.end);
total_time = CalcAtomTime(atom);
/* Now it's time to save this! This may do a lot of computations which
* is why we've cached the time beforehand.
*/
reporter->SaveAtom(atom);
m_AtomStack.pop();
/* Finally, tell our parent how much time we used. */
ResumeParent(total_time);
}
void ProfileEngine::PauseParent()
{
if (m_AtomStack.empty())
{
return;
}
InitProfPoint(m_AtomStack.front().end);
}
void ProfileEngine::ResumeParent(double addTime)
{
if (m_AtomStack.empty())
{
return;
}
prof_atom_t &atom = m_AtomStack.front();
/* Move its "paused time" to its base (known) time,
* then reset the start/end. Note that since CalcAtomTime()
* reads the base time, we SHOULD NOT use += to add.
*/
atom.base_time = CalcAtomTime(atom);
atom.base_time += addTime;
InitProfPoint(atom.start);
atom.end.is_set = false;
}
void ProfileEngine::Clear()
{
m_Natives.Clear();
m_Callbacks.Clear();
m_Functions.Clear();
InitProfPoint(m_ProfStart);
}
void ProfileEngine::OnSourceModAllInitialized()
{
rootmenu->AddRootConsoleCommand2("profiler", "Profiler commands", this);
}
void ProfileEngine::OnSourceModShutdown()
{
rootmenu->RemoveRootConsoleCommand("profiler", this);
}
void ProfileEngine::OnRootConsoleCommand2(const char *cmdname, const ICommandArgs *command)
{
if (command->ArgC() >= 3)
{
if (strcmp(command->Arg(2), "flush") == 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);
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)
{
time_t t;
double total_time;
prof_point_t end_time;
InitProfPoint(end_time);
total_time = DiffProfPoints(m_ProfStart, end_time);
t = time(NULL);
fprintf(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n");
fprintf(fp, "<profile time=\"%d\" uptime=\"%f\">\n", (int)t, total_time);
WriteReport(fp, &m_Natives, "natives");
WriteReport(fp, &m_Callbacks, "callbacks");
WriteReport(fp, &m_Functions, "functions");
fprintf(fp, "</profile>\n");
return true;
}
void ProfileEngine::WriteReport(FILE *fp, ProfileReport *report, const char *name)
{
size_t i, num;
prof_atom_report_t *ar;
char new_name[512];
fprintf(fp, " <report name=\"%s\">\n", name);
num = report->GetNumReports();
for (i = 0; i < num; i++)
{
ar = report->GetReport(i);
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,
ar->num_calls,
ar->min_time,
ar->max_time,
ar->total_time);
}
fprintf(fp, " </report>\n");
}
ProfileReport::~ProfileReport()
{
for (size_t i = 0; i < m_Reports.size(); i++)
{
delete m_Reports[i];
}
}
void ProfileReport::Clear()
{
m_ReportLookup.clear();
for (size_t i = 0; i < m_Reports.size(); i++)
{
delete m_Reports[i];
}
m_Reports.clear();
}
size_t ProfileReport::GetNumReports()
{
return m_Reports.size();
}
prof_atom_report_t *ProfileReport::GetReport(size_t i)
{
return m_Reports[i];
}
void ProfileReport::SaveAtom(const prof_atom_t &atom)
{
double atom_time;
char full_name[256];
prof_atom_report_t **pReport, *report;
if (atom.atom_type == SP_PROF_NATIVES)
{
smcore.strncopy(full_name, atom.name, sizeof(full_name));
}
else
{
IPlugin *pl;
const char *file;
file = "unknown";
if ((pl = pluginsys->FindPluginByContext(atom.ctx)) != NULL)
{
file = pl->GetFilename();
}
smcore.Format(full_name, sizeof(full_name), "%s!%s", file, atom.name);
}
atom_time = CalcAtomTime(atom);
if ((pReport = m_ReportLookup.retrieve(full_name)) == NULL)
{
report = new prof_atom_report_t;
smcore.strncopy(report->atom_name, full_name, sizeof(report->atom_name));
report->max_time = atom_time;
report->min_time = atom_time;
report->num_calls = 1;
report->total_time = atom_time;
m_ReportLookup.insert(full_name, report);
m_Reports.push_back(report);
}
else
{
report = *pReport;
if (atom_time > report->max_time)
{
report->max_time = atom_time;
}
if (atom_time < report->min_time)
{
report->min_time = atom_time;
}
report->num_calls++;
report->total_time += atom_time;
}
}
-131
View File
@@ -1,131 +0,0 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#ifndef _INCLUDE_SOURCEMOD_PLUGIN_PROFILER_H_
#define _INCLUDE_SOURCEMOD_PLUGIN_PROFILER_H_
#include <sp_vm_api.h>
#include <sm_platform.h>
#include <sm_trie_tpl.h>
#include <sh_vector.h>
#include <sh_stack.h>
#include <stdio.h>
#include "common_logic.h"
#include <IRootConsoleMenu.h>
using namespace SourcePawn;
using namespace SourceHook;
struct prof_point_t
{
#if defined PLATFORM_WINDOWS
LARGE_INTEGER value;
#elif defined PLATFORM_POSIX
struct timeval value;
#endif
bool is_set;
};
struct prof_atom_t
{
int atom_type; /* Type of object we're profiling */
int atom_serial; /* Serial number, if appropriate */
sp_context_t *ctx; /* Plugin context. */
const char *name; /* Name of the function */
prof_point_t start; /* Start time */
prof_point_t end; /* End time */
double base_time; /* Known time from children or pausing. */
};
struct prof_atom_report_t
{
char atom_name[256]; /* Full name to shove to logs */
double total_time; /* Total time spent executing, in s */
unsigned int num_calls; /* Number of invocations */
double min_time; /* Min time spent in one call, in s */
double max_time; /* Max time spent in one call, in s */
};
class ProfileReport
{
public:
~ProfileReport();
public:
void SaveAtom(const prof_atom_t &atom);
size_t GetNumReports();
prof_atom_report_t *GetReport(size_t i);
void Clear();
private:
KTrie<prof_atom_report_t *> m_ReportLookup;
CVector<prof_atom_report_t *> m_Reports;
};
class ProfileEngine :
public SMGlobalClass,
public IRootConsoleCommand,
public IProfiler
{
public:
ProfileEngine();
public:
bool IsEnabled();
bool GenerateReport(FILE *fp);
void Clear();
public: //SMGlobalClass
void OnSourceModAllInitialized();
void OnSourceModShutdown();
public: //IRootConsoleCommand
void OnRootConsoleCommand2(const char *cmdname, const ICommandArgs *command);
public: //IProfiler
void OnNativeBegin(IPluginContext *pContext, sp_native_t *native);
void OnNativeEnd() ;
void OnFunctionBegin(IPluginContext *pContext, const char *name);
void OnFunctionEnd();
int OnCallbackBegin(IPluginContext *pContext, sp_public_t *pubfunc);
void OnCallbackEnd(int serial);
private:
void PushProfileStack(IPluginContext *ctx, int type, const char *name);
void PopProfileStack(ProfileReport *reporter);
void PauseParent();
void ResumeParent(double addTime);
void WriteReport(FILE *fp, ProfileReport *report, const char *name);
private:
CStack<prof_atom_t> m_AtomStack;
ProfileReport m_Callbacks;
ProfileReport m_Functions;
ProfileReport m_Natives;
int m_serial;
prof_point_t m_ProfStart;
};
extern IProfiler *sm_profiler;
#endif //_INCLUDE_SOURCEMOD_PLUGIN_PROFILER_H_
+112 -228
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.
@@ -30,11 +30,14 @@
*/
#include "ShareSys.h"
#include "HandleSys.h"
#include "ExtensionSys.h"
#include "LibrarySys.h"
#include <ILibrarySys.h>
#include "common_logic.h"
#include "PluginSys.h"
#include "sm_stringutil.h"
#include "HandleSys.h"
#include <assert.h>
using namespace ke;
ShareSystem g_ShareSys;
static unsigned int g_mark_serial = 0;
@@ -61,36 +64,36 @@ void ShareSystem::Initialize()
{
TypeAccess sec;
g_HandleSys.InitAccessDefaults(&sec, NULL);
handlesys->InitAccessDefaults(&sec, NULL);
sec.ident = GetIdentRoot();
m_TypeRoot = g_HandleSys.CreateType("Identity", this, 0, &sec, NULL, NULL, NULL);
m_IfaceType = g_HandleSys.CreateType("Interface", this, 0, NULL, NULL, GetIdentRoot(), NULL);
m_TypeRoot = handlesys->CreateType("Identity", this, 0, &sec, NULL, NULL, NULL);
m_IfaceType = handlesys->CreateType("Interface", this, 0, NULL, NULL, GetIdentRoot(), NULL);
/* Initialize our static identity handle */
m_IdentRoot.ident = g_HandleSys.CreateHandle(m_TypeRoot, NULL, NULL, GetIdentRoot(), NULL);
m_IdentRoot.ident = handlesys->CreateHandle(m_TypeRoot, NULL, NULL, GetIdentRoot(), NULL);
/* Add the Handle System and others... they are too innocent and pure to do it themselves */
AddInterface(NULL, &g_HandleSys);
AddInterface(NULL, &g_LibSys);
AddInterface(NULL, handlesys);
AddInterface(NULL, libsys);
}
void ShareSystem::OnSourceModShutdown()
{
if (m_CoreType)
{
g_HandleSys.RemoveType(m_CoreType, GetIdentRoot());
handlesys->RemoveType(m_CoreType, GetIdentRoot());
}
g_HandleSys.RemoveType(m_IfaceType, GetIdentRoot());
g_HandleSys.RemoveType(m_TypeRoot, GetIdentRoot());
handlesys->RemoveType(m_IfaceType, GetIdentRoot());
handlesys->RemoveType(m_TypeRoot, GetIdentRoot());
}
IdentityType_t ShareSystem::FindIdentType(const char *name)
{
HandleType_t type;
if (g_HandleSys.FindHandleType(name, &type))
if (handlesys->FindHandleType(name, &type))
{
if (g_HandleSys.TypeCheck(type, m_TypeRoot))
{
@@ -108,7 +111,7 @@ IdentityType_t ShareSystem::CreateIdentType(const char *name)
return 0;
}
return g_HandleSys.CreateType(name, this, m_TypeRoot, NULL, NULL, GetIdentRoot(), NULL);
return handlesys->CreateType(name, this, m_TypeRoot, NULL, NULL, GetIdentRoot(), NULL);
}
void ShareSystem::OnHandleDestroy(HandleType_t type, void *object)
@@ -217,13 +220,13 @@ void ShareSystem::DestroyIdentity(IdentityToken_t *identity)
sec.pOwner = GetIdentRoot();
sec.pIdentity = GetIdentRoot();
g_HandleSys.FreeHandle(identity->ident, &sec);
handlesys->FreeHandle(identity->ident, &sec);
delete identity;
}
void ShareSystem::DestroyIdentType(IdentityType_t type)
{
g_HandleSys.RemoveType(type, GetIdentRoot());
handlesys->RemoveType(type, GetIdentRoot());
}
void ShareSystem::RemoveInterfaces(IExtension *pExtension)
@@ -255,51 +258,19 @@ void ShareSystem::RegisterLibrary(IExtension *myself, const char *name)
void ShareSystem::OverrideNatives(IExtension *myself, const sp_nativeinfo_t *natives)
{
unsigned int i;
NativeEntry *pEntry;
CNativeOwner *pOwner;
pOwner = g_Extensions.GetNativeOwner(myself);
for (i = 0; natives[i].func != NULL && natives[i].name != NULL; i++)
{
if ((pEntry = FindNative(natives[i].name)) == NULL)
{
continue;
}
if (pEntry->owner != g_pCoreNatives)
{
continue;
}
if (pEntry->replacement.owner != NULL)
{
continue;
}
/* Now it's safe to add the override */
pEntry->replacement.func = natives[i].func;
pEntry->replacement.owner = pOwner;
pOwner->AddReplacedNative(pEntry);
}
assert(false);
}
NativeEntry *ShareSystem::FindNative(const char *name)
PassRef<Native> ShareSystem::FindNative(const char *name)
{
NativeEntry **ppEntry;
if ((ppEntry = m_NtvCache.retrieve(name)) == NULL)
{
NativeCache::Result r = m_NtvCache.find(name);
if (!r.found())
return NULL;
}
return *ppEntry;
return *r;
}
void ShareSystem::BindNativesToPlugin(CPlugin *pPlugin, bool bCoreOnly)
{
NativeEntry *pEntry;
sp_native_t *native;
uint32_t i, native_count;
IPluginContext *pContext;
@@ -308,230 +279,152 @@ void ShareSystem::BindNativesToPlugin(CPlugin *pPlugin, bool bCoreOnly)
/* Generate a new serial ID, mark our dependencies with it. */
g_mark_serial++;
pPlugin->PropogateMarkSerial(g_mark_serial);
pPlugin->PropagateMarkSerial(g_mark_serial);
native_count = pContext->GetNativesNum();
for (i = 0; i < native_count; i++)
{
if (pContext->GetNativeByIndex(i, &native) != SP_ERROR_NONE)
{
continue;
}
/* If we're bound, check if there is a replacement available.
* If not, this native is totally finalized.
*/
// If we're already bound, no need to do anything else.
if (native->status == SP_NATIVE_BOUND)
{
pEntry = (NativeEntry *)native->user;
assert(pEntry != NULL);
if (pEntry->replacement.owner == NULL
|| (pEntry->replacement.owner != NULL
&& pEntry->replacement.func == native->pfn))
{
continue;
}
}
/* Otherwise, the native must be in our cache. */
else if ((pEntry = FindNative(native->name)) == NULL)
{
continue;
}
if (bCoreOnly && pEntry->owner != g_pCoreNatives)
{
/* Otherwise, the native must be in our cache. */
Ref<Native> pEntry = FindNative(native->name);
if (!pEntry)
continue;
if (bCoreOnly && pEntry->owner != &g_CoreNatives)
continue;
}
BindNativeToPlugin(pPlugin, native, i, pEntry);
}
}
void ShareSystem::BindNativeToPlugin(CPlugin *pPlugin, NativeEntry *pEntry)
void ShareSystem::BindNativeToPlugin(CPlugin *pPlugin, const Ref<Native> &entry)
{
if (!entry->owner)
return;
IPluginContext *pContext = pPlugin->GetBaseContext();
uint32_t i;
if (pContext->FindNativeByName(entry->name(), &i) != SP_ERROR_NONE)
return;
sp_native_t *native;
IPluginContext *pContext;
pContext = pPlugin->GetBaseContext();
if (pContext->FindNativeByName(pEntry->name, &i) != SP_ERROR_NONE)
{
return;
}
if (pContext->GetNativeByIndex(i, &native) != SP_ERROR_NONE)
{
return;
}
if (native->status == SP_NATIVE_BOUND)
{
return;
}
BindNativeToPlugin(pPlugin, native, i, pEntry);
BindNativeToPlugin(pPlugin, native, i, entry);
}
void ShareSystem::BindNativeToPlugin(CPlugin *pPlugin,
sp_native_t *native,
uint32_t index,
NativeEntry *pEntry)
void ShareSystem::BindNativeToPlugin(CPlugin *pPlugin, sp_native_t *native, uint32_t index,
const Ref<Native> &pEntry)
{
/* Mark as bound... we do the rest next. */
native->status = SP_NATIVE_BOUND;
native->user = pEntry;
native->pfn = pEntry->func();
/* See if a replacement is available. */
if (pEntry->replacement.owner != NULL)
if (pEntry->fake)
{
/* Perform a replacement bind. */
native->pfn = pEntry->replacement.func;
pEntry->replacement.owner->AddWeakRef(WeakNative(pPlugin, index, pEntry));
/* This native is not necessarily optional, but we don't guarantee
* that its address is long-lived. */
native->flags |= SP_NTVFLAG_EPHEMERAL;
}
else
{
/* Perform a normal bind. */
native->pfn = pEntry->func;
/* We don't bother with dependency crap if the owner is Core. */
if (pEntry->owner != g_pCoreNatives)
/* We don't bother with dependency crap if the owner is Core. */
if (pEntry->owner != &g_CoreNatives)
{
/* The native is optional, this is a special case */
if ((native->flags & SP_NTVFLAG_OPTIONAL) == SP_NTVFLAG_OPTIONAL)
{
/* The native is optional, this is a special case */
if ((native->flags & SP_NTVFLAG_OPTIONAL) == SP_NTVFLAG_OPTIONAL)
{
/* Only add if there is a valid owner. */
if (pEntry->owner != NULL)
{
pEntry->owner->AddWeakRef(WeakNative(pPlugin, index));
}
else
{
native->status = SP_NATIVE_UNBOUND;
}
}
/* Otherwise, we're a strong dependent and not a weak one */
/* Only add if there is a valid owner. */
if (pEntry->owner)
pEntry->owner->AddWeakRef(WeakNative(pPlugin, index));
else
native->status = SP_NATIVE_UNBOUND;
}
/* Otherwise, we're a strong dependent and not a weak one */
else
{
/* See if this has already been marked as a dependent.
* If it has, it means this relationship has already occurred,
* and there is no reason to do it again.
*/
if (pEntry->owner != pPlugin->ToNativeOwner()
&& pEntry->owner->GetMarkSerial() != g_mark_serial)
{
/* See if this has already been marked as a dependent.
* If it has, it means this relationship has already occurred,
* and there is no reason to do it again.
*/
if (pEntry->owner != pPlugin
&& pEntry->owner->GetMarkSerial() != g_mark_serial)
{
/* This has not been marked as a dependency yet */
//pPlugin->AddDependency(pEntry->owner);
pEntry->owner->AddDependent(pPlugin);
pEntry->owner->SetMarkSerial(g_mark_serial);
}
/* This has not been marked as a dependency yet */
//pPlugin->AddDependency(pEntry->owner);
pEntry->owner->AddDependent(pPlugin);
pEntry->owner->SetMarkSerial(g_mark_serial);
}
}
}
}
NativeEntry *ShareSystem::AddNativeToCache(CNativeOwner *pOwner, const sp_nativeinfo_t *ntv)
PassRef<Native> ShareSystem::AddNativeToCache(CNativeOwner *pOwner, const sp_nativeinfo_t *ntv)
{
NativeEntry *pEntry;
if ((pEntry = FindNative(ntv->name)) == NULL)
{
pEntry = new NativeEntry;
pEntry->owner = pOwner;
pEntry->name = ntv->name;
pEntry->func = ntv->func;
pEntry->replacement.func = NULL;
pEntry->replacement.owner = NULL;
pEntry->fake = NULL;
m_NtvCache.insert(ntv->name, pEntry);
return pEntry;
}
if (pEntry->owner != NULL)
{
NativeCache::Insert i = m_NtvCache.findForAdd(ntv->name);
if (i.found())
return NULL;
}
pEntry->owner = pOwner;
pEntry->func = ntv->func;
pEntry->name = ntv->name;
Ref<Native> entry = new Native(pOwner, ntv);
m_NtvCache.insert(ntv->name, entry);
return entry;
}
return pEntry;
FakeNative::~FakeNative()
{
g_pSourcePawn2->DestroyFakeNative(gate);
}
void ShareSystem::ClearNativeFromCache(CNativeOwner *pOwner, const char *name)
{
NativeEntry *pEntry;
if ((pEntry = FindNative(name)) == NULL)
{
NativeCache::Result r = m_NtvCache.find(name);
if (!r.found())
return;
}
if (pEntry->owner != pOwner)
{
Ref<Native> entry(*r);
if (entry->owner != pOwner)
return;
}
if (pEntry->fake != NULL)
{
g_pSourcePawn2->DestroyFakeNative(pEntry->func);
delete pEntry->fake;
pEntry->fake = NULL;
}
// Clear out the owner bit as a sanity measure.
entry->owner = NULL;
pEntry->func = NULL;
pEntry->name = NULL;
pEntry->owner = NULL;
pEntry->replacement.func = NULL;
pEntry->replacement.owner = NULL;
m_NtvCache.remove(r);
}
NativeEntry *ShareSystem::AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func)
PassRef<Native> ShareSystem::AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func)
{
FakeNative *pFake;
NativeEntry *pEntry;
SPVM_NATIVE_FUNC gate;
if ((pEntry = FindNative(name)) != NULL && pEntry->owner != NULL)
{
Ref<Native> entry(FindNative(name));
if (entry)
return NULL;
}
pFake = new FakeNative;
AutoPtr<FakeNative> fake(new FakeNative(name, pFunc));
if ((gate = g_pSourcePawn2->CreateFakeNative(func, pFake)) == NULL)
{
delete pFake;
fake->gate = g_pSourcePawn2->CreateFakeNative(func, fake);
if (!fake->gate)
return NULL;
}
if (pEntry == NULL)
{
pEntry = new NativeEntry;
m_NtvCache.insert(name, pEntry);
}
CNativeOwner *owner = g_PluginSys.GetPluginByCtx(fake->ctx->GetContext());
pFake->call = pFunc;
pFake->ctx = pFunc->GetParentContext();
strncopy(pFake->name, name, sizeof(pFake->name));
pEntry->fake = pFake;
pEntry->func = gate;
pEntry->name = pFake->name;
pEntry->owner = g_PluginSys.GetPluginByCtx(pFake->ctx->GetContext());
pEntry->replacement.func = NULL;
pEntry->replacement.owner = NULL;
entry = new Native(owner, fake.take());
m_NtvCache.insert(name, entry);
return pEntry;
return entry;
}
void ShareSystem::AddCapabilityProvider(IExtension *myself, IFeatureProvider *provider,
const char *name)
{
if (m_caps.retrieve(name) != NULL)
if (m_caps.contains(name))
return;
Capability cap;
@@ -544,14 +437,13 @@ void ShareSystem::AddCapabilityProvider(IExtension *myself, IFeatureProvider *pr
void ShareSystem::DropCapabilityProvider(IExtension *myself, IFeatureProvider *provider,
const char *name)
{
Capability *pCap = m_caps.retrieve(name);
if (pCap == NULL)
StringHashMap<Capability>::Result r = m_caps.find(name);
if (!r.found())
return;
if (r->value.ext != myself || r->value.provider != provider)
return;
if (pCap->ext != myself || pCap->provider != provider)
return;
m_caps.remove(name);
m_caps.remove(r);
}
FeatureStatus ShareSystem::TestFeature(IPluginRuntime *pRuntime, FeatureType feature,
@@ -586,26 +478,18 @@ FeatureStatus ShareSystem::TestNative(IPluginRuntime *pRuntime, const char *name
}
}
NativeEntry *entry = FindNative(name);
if (entry == NULL)
Ref<Native> entry = FindNative(name);
if (!entry)
return FeatureStatus_Unknown;
if ((entry->replacement.owner != NULL || entry->owner != NULL) &&
(entry->replacement.func != NULL || entry->func != NULL))
{
return FeatureStatus_Available;
}
else
{
return FeatureStatus_Unavailable;
}
return FeatureStatus_Unavailable;
}
FeatureStatus ShareSystem::TestCap(const char *name)
{
Capability *cap = m_caps.retrieve(name);
if (cap == NULL)
StringHashMap<Capability>::Result r = m_caps.find(name);
if (!r.found())
return FeatureStatus_Unknown;
return cap->provider->GetFeatureStatus(FeatureType_Capability, name);
return r->value.provider->GetFeatureStatus(FeatureType_Capability, name);
}
+17 -37
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.
@@ -34,10 +34,14 @@
#include <IShareSys.h>
#include <IHandleSys.h>
#include <am-string.h>
#include <am-utility.h>
#include <am-refcounting.h>
#include <sh_list.h>
#include <sm_trie_tpl.h>
#include "sm_globals.h"
#include "sourcemod.h"
#include <sm_stringhashmap.h>
#include <sm_namehashset.h>
#include "common_logic.h"
#include "Native.h"
using namespace SourceHook;
@@ -63,29 +67,6 @@ struct IfaceInfo
class CNativeOwner;
class CPlugin;
struct NativeEntry;
struct ReplaceNative
{
CNativeOwner *owner;
SPVM_NATIVE_FUNC func;
};
struct FakeNative
{
char name[64];
IPluginContext *ctx;
IPluginFunction *call;
};
struct NativeEntry
{
CNativeOwner *owner;
SPVM_NATIVE_FUNC func;
const char *name;
ReplaceNative replacement;
FakeNative *fake;
};
struct Capability
{
@@ -139,24 +120,23 @@ public:
}
public:
void BindNativesToPlugin(CPlugin *pPlugin, bool bCoreOnly);
void BindNativeToPlugin(CPlugin *pPlugin, NativeEntry *pEntry);
NativeEntry *AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func);
NativeEntry *FindNative(const char *name);
void BindNativeToPlugin(CPlugin *pPlugin, const ke::Ref<Native> &pEntry);
ke::PassRef<Native> AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func);
ke::PassRef<Native> FindNative(const char *name);
private:
NativeEntry *AddNativeToCache(CNativeOwner *pOwner, const sp_nativeinfo_t *ntv);
ke::PassRef<Native> AddNativeToCache(CNativeOwner *pOwner, const sp_nativeinfo_t *ntv);
void ClearNativeFromCache(CNativeOwner *pOwner, const char *name);
void BindNativeToPlugin(CPlugin *pPlugin,
sp_native_t *ntv,
uint32_t index,
NativeEntry *pEntry);
void BindNativeToPlugin(CPlugin *pPlugin, sp_native_t *ntv, uint32_t index, const ke::Ref<Native> &pEntry);
private:
typedef NameHashSet<ke::Ref<Native>, Native> NativeCache;
List<IfaceInfo> m_Interfaces;
HandleType_t m_TypeRoot;
IdentityToken_t m_IdentRoot;
HandleType_t m_IfaceType;
IdentityType_t m_CoreType;
KTrie<NativeEntry *> m_NtvCache;
KTrie<Capability> m_caps;
NativeCache m_NtvCache;
StringHashMap<Capability> m_caps;
};
extern ShareSystem g_ShareSys;
+1 -1
View File
@@ -1077,7 +1077,7 @@ const char *TextParsers::GetSMCErrorString(SMCError err)
NULL,
"Stream failed to open",
"Stream returned read error",
NULL,
"Callback error",
"Un-quoted section has invalid tokens",
"Section declared without header",
"Section declared with unknown tokens",
+39
View File
@@ -33,9 +33,48 @@
#define _INCLUDE_SOURCEMOD_THREAD_SUPPORT_H
#include <IThreader.h>
#include <am-thread-utils.h>
#include <am-utility.h>
using namespace SourceMod;
class CompatMutex : public IMutex
{
public:
bool TryLock() {
return mutex_.TryLock();
}
void Lock() {
mutex_.Lock();
}
void Unlock() {
mutex_.Unlock();
}
void DestroyThis() {
delete this;
}
private:
ke::Mutex mutex_;
};
class CompatCondVar : public IEventSignal
{
public:
void Wait() {
ke::AutoLock lock(&cv_);
cv_.Wait();
}
void Signal() {
ke::AutoLock lock(&cv_);
cv_.Notify();
}
void DestroyThis() {
delete this;
}
private:
ke::ConditionVariable cv_;
};
extern IThreader *g_pThreader;
#endif //_INCLUDE_SOURCEMOD_THREAD_SUPPORT_H
+33 -71
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.
@@ -96,11 +96,11 @@ void CPhraseFile::ParseWarning(const char *message, ...)
if (!m_FileLogged)
{
smcore.LogError("[SM] Warning(s) encountered in translation file \"%s\"", m_File.c_str());
logger->LogError("[SM] Warning(s) encountered in translation file \"%s\"", m_File.c_str());
m_FileLogged = true;
}
smcore.LogError("[SM] %s", buffer);
logger->LogError("[SM] %s", buffer);
}
void CPhraseFile::ReparseFile()
@@ -142,8 +142,8 @@ void CPhraseFile::ReparseFile()
msg = m_ParseError.c_str();
}
smcore.LogError("[SM] Fatal error encountered parsing translation file \"%s\"", m_File.c_str());
smcore.LogError("[SM] Error (line %d, column %d): %s", states.line, states.col, msg);
logger->LogError("[SM] Fatal error encountered parsing translation file \"%s\"", m_File.c_str());
logger->LogError("[SM] Error (line %d, column %d): %s", states.line, states.col, msg);
}
const char *code;
@@ -175,10 +175,10 @@ void CPhraseFile::ReparseFile()
msg = m_ParseError.c_str();
}
smcore.LogError("[SM] Fatal error encountered parsing translation file \"%s/%s\"",
logger->LogError("[SM] Fatal error encountered parsing translation file \"%s/%s\"",
code,
m_File.c_str());
smcore.LogError("[SM] Error (line %d, column %d): %s",
logger->LogError("[SM] Error (line %d, column %d): %s",
states.line,
states.col,
msg);
@@ -210,12 +210,7 @@ SMCResult CPhraseFile::ReadSMC_NewSection(const SMCStates *states, const char *n
m_ParseState = PPS_InPhrase;
recognized = true;
int *pvalue;
if ((pvalue = m_PhraseLookup.retrieve(name)) != NULL)
{
m_CurPhrase = *pvalue;
}
else
if (!m_PhraseLookup.retrieve(name, &m_CurPhrase))
{
phrase_t *pPhrase;
@@ -479,13 +474,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))
{
@@ -498,7 +486,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;
@@ -659,11 +647,11 @@ TransError CPhraseFile::GetTranslation(const char *szPhrase, unsigned int lang_i
return Trans_BadLanguage;
}
int *pvalue;
if ((pvalue = m_PhraseLookup.retrieve(szPhrase)) == NULL)
int address;
if (!m_PhraseLookup.retrieve(szPhrase, &address))
return Trans_BadPhrase;
phrase_t *pPhrase = (phrase_t *)m_pMemory->GetAddress(*pvalue);
phrase_t *pPhrase = (phrase_t *)m_pMemory->GetAddress(address);
trans_t *trans = (trans_t *)m_pMemory->GetAddress(pPhrase->trans_tbl);
trans = &trans[lang_id];
@@ -740,10 +728,7 @@ ConfigResult Translator::OnSourceModConfigChanged(const char *key,
void Translator::OnSourceModLevelChange(const char *mapName)
{
/* Refresh language stuff */
char path[PLATFORM_MAX_PATH];
g_pSM->BuildPath(Path_SM, path, sizeof(path), "configs/languages.cfg");
RebuildLanguageDatabase(path);
RebuildLanguageDatabase();
}
void Translator::OnSourceModAllInitialized()
@@ -769,15 +754,7 @@ void Translator::OnSourceModShutdown()
bool Translator::GetLanguageByCode(const char *code, unsigned int *index)
{
unsigned int *pindex;
if ((pindex = m_LCodeLookup.retrieve(code)) == NULL)
return false;
if (index)
*index = *pindex;
return true;
return m_LCodeLookup.retrieve(code, index);
}
bool Translator::GetLanguageByName(const char *name, unsigned int *index)
@@ -794,15 +771,7 @@ bool Translator::GetLanguageByName(const char *name, unsigned int *index)
}
lower[len] = '\0';
unsigned int *pIndex;
if ((pIndex = m_LAliases.retrieve(lower)) == NULL)
return false;
if (index)
*index = *pIndex;
return true;
return m_LAliases.retrieve(lower, index);
}
unsigned int Translator::GetLanguageCount()
@@ -835,7 +804,7 @@ unsigned int Translator::FindOrAddPhraseFile(const char *phrase_file)
return idx;
}
void Translator::RebuildLanguageDatabase(const char *lang_header_file)
void Translator::RebuildLanguageDatabase()
{
/* Erase everything we have */
m_LCodeLookup.clear();
@@ -849,9 +818,12 @@ void Translator::RebuildLanguageDatabase(const char *lang_header_file)
m_Languages.clear();
/* Start anew */
char path[PLATFORM_MAX_PATH];
g_pSM->BuildPath(Path_SM, path, sizeof(path), "configs/languages.cfg");
SMCError err;
SMCStates states;
if ((err=textparsers->ParseFile_SMC(lang_header_file, this, &states)) != SMCError_Okay)
if ((err=textparsers->ParseFile_SMC(path, this, &states)) != SMCError_Okay)
{
const char *str_err = textparsers->GetSMCErrorString(err);
if (!str_err)
@@ -859,27 +831,21 @@ void Translator::RebuildLanguageDatabase(const char *lang_header_file)
str_err = m_CustomError.c_str();
}
smcore.LogError("[SM] Failed to parse language header file: \"%s\"", lang_header_file);
smcore.LogError("[SM] Parse error (line %d, column %d): %s", states.line, states.col, str_err);
logger->LogError("[SM] Failed to parse language header file: \"%s\"", path);
logger->LogError("[SM] Parse error (line %d, column %d): %s", states.line, states.col, str_err);
}
unsigned int *pServerLang;
if ((pServerLang = m_LCodeLookup.retrieve(m_InitialLang)) == NULL)
if (!m_LCodeLookup.retrieve(m_InitialLang, &m_ServerLang))
{
smcore.LogError("Server language was set to bad language \"%s\" -- reverting to English", m_InitialLang);
logger->LogError("Server language was set to bad language \"%s\" -- reverting to English", m_InitialLang);
smcore.strncopy(m_InitialLang, "en", sizeof(m_InitialLang));
m_ServerLang = SOURCEMOD_LANGUAGE_ENGLISH;
}
else
{
m_ServerLang = *pServerLang;
}
if (!m_Languages.size())
{
smcore.LogError("[SM] Fatal error, no languages found! Translation will not work.");
logger->LogError("[SM] Fatal error, no languages found! Translation will not work.");
}
for (size_t i=0; i<m_Files.size(); i++)
@@ -906,7 +872,7 @@ SMCResult Translator::ReadSMC_NewSection(const SMCStates *states, const char *na
if (!m_InLanguageSection)
{
smcore.LogError("[SM] Warning: Unrecognized section \"%s\" in languages.cfg", name);
logger->LogError("[SM] Warning: Unrecognized section \"%s\" in languages.cfg", name);
}
return SMCResult_Continue;
@@ -923,10 +889,10 @@ SMCResult Translator::ReadSMC_KeyValue(const SMCStates *states, const char *key,
{
size_t len = strlen(key);
if (len < 2 || len > 3)
if (len >= sizeof(((Language *)0)->m_code2))
{
smcore.LogError("[SM] Warning encountered parsing languages.cfg file.");
smcore.LogError("[SM] Invalid language code \"%s\" is being ignored.", key);
logger->LogError("[SM] Warning encountered parsing languages.cfg file.");
logger->LogError("[SM] Invalid language code \"%s\" is too long.", key);
}
AddLanguage(key, value);
@@ -948,15 +914,11 @@ bool Translator::AddLanguage(const char *langcode, const char *description)
}
lower[len] = '\0';
if (m_LAliases.retrieve(lower))
if (m_LAliases.contains(lower))
return false;
unsigned int idx;
if (unsigned int *pIdx = m_LCodeLookup.retrieve(langcode))
{
idx = *pIdx;
}
else
if (!m_LCodeLookup.retrieve(langcode, &idx))
{
Language *pLanguage = new Language;
idx = m_Languages.size();
@@ -1071,11 +1033,11 @@ bool CoreTranslate(char *buffer, size_t maxlength, const char *format, unsigned
{
if (fail_phrase != NULL)
{
smcore.LogError("[SM] Could not find core phrase: %s", fail_phrase);
logger->LogError("[SM] Could not find core phrase: %s", fail_phrase);
}
else
{
smcore.LogError("[SM] Unknown fatal error while translating a core phrase.");
logger->LogError("[SM] Unknown fatal error while translating a core phrase.");
}
return false;
+7 -7
View File
@@ -33,7 +33,7 @@
#define _INCLUDE_SOURCEMOD_TRANSLATOR_H_
#include "common_logic.h"
#include <sm_trie_tpl.h>
#include <sm_stringhashmap.h>
#include <sh_string.h>
#include <sh_vector.h>
#include "sm_memtable.h"
@@ -54,7 +54,7 @@ enum PhraseParseState
struct Language
{
char m_code2[4];
char m_code2[32];
int m_CanonicalName;
};
@@ -79,7 +79,7 @@ private:
void ParseError(const char *message, ...);
void ParseWarning(const char *message, ...);
private:
KTrie<int> m_PhraseLookup;
StringHashMap<int> m_PhraseLookup;
String m_File;
Translator *m_pTranslator;
PhraseParseState m_ParseState;
@@ -115,11 +115,9 @@ public: // ITextListener_SMC
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
SMCResult ReadSMC_LeavingSection(const SMCStates *states);
public:
void RebuildLanguageDatabase(const char *lang_header_file);
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);
@@ -146,14 +144,16 @@ public: //ITranslator
unsigned int numparams,
size_t *pOutLength,
const char **pFailPhrase);
bool GetLanguageInfo(unsigned int number, const char **code, const char **name);
void RebuildLanguageDatabase();
private:
bool AddLanguage(const char *langcode, const char *description);
private:
CVector<Language *> m_Languages;
CVector<CPhraseFile *> m_Files;
BaseStringTable *m_pStringTab;
KTrie<unsigned int> m_LCodeLookup;
KTrie<unsigned int> m_LAliases;
StringHashMap<unsigned int> m_LCodeLookup;
StringHashMap<unsigned int> m_LAliases;
bool m_InLanguageSection;
String m_CustomError;
unsigned int m_ServerLang;

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