Commit Graph

870 Commits

Author SHA1 Message Date
David Anderson
eaea3c927d Update upstream AMTL as a submodule. 2015-03-08 00:24:03 -08:00
David Anderson
561004c4bf Move SourcePawn headers out of public/ into sourcepawn/include. 2015-03-07 11:13:32 -08:00
Nicholas Hastings
6f8ffd55a7 Merge pull request #263 from alliedmodders/admins-trans
Update admins.inc with methodmaps, newdecls (r=dvander, asherkin).
2015-03-05 14:32:15 -05:00
Nicholas Hastings
70390ff1f7 Purge Purge. 2015-03-05 10:56:36 -08:00
David Anderson
a1afa23bc4 Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.

The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.

Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.

Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.

These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-03-04 23:45:30 -08:00
David Anderson
04827466b0 Rewrite the .smx parser.
This removes one the last remnants of the SourceMod 1.0 VM implementation.

The new parser introduces a number of design changes in the VM. First, the VM now takes greater responsibility for validating and sanity checking the structure of the SMX container format. Previously, malformed SMX files could easily crash SourcePawn. The loader now rejects files that have out-of-bounds offsets or incomplete sections. Complex sections, like debug info or the code stream, are verified lazily.

Internally, the sp_plugin_t structure has been removed. It has been replaced by a new LegacyImage class, designed to be independent from the SPVM API. This potentially lets us load code streams from non-.smx containers. More importantly, it removes a lot of bookkeeping and pre-computed state from PluginRuntime. The LegacyImage class is now responsible for handling debug info as well.

PluginRuntime is now intended to hold only cached or immutable data, and PluginContext holds all VM state. As such PluginContext is now responsible for allocating a plugin's runtime memory, not PluginRuntime.

Finally, some aspects of the loading process have been cleaned up. The
decompression and image handoff logic should now be easier to
understand.
2015-02-25 22:28:10 -08:00
David Anderson
fcaa5361c8 Don't expose mutable sp_native_t. 2015-02-24 23:10:18 -08:00
Asher Baker
6572989993 Merge pull request #213 from splewis/find-array-nonzero-blocks
Add block parameter to FindValueInArray native.
2015-02-24 22:37:49 +00:00
David Anderson
21f5400d9c Remove ICompilationData. 2015-02-24 02:03:57 -08:00
David Anderson
499f7b3929 Refactor the public API entrypoint for SourcePawn. 2015-02-24 01:52:13 -08:00
Kyle Sanderson
4bd4d8d4a5 Merge pull request #268 from KyleSanderson/MenuCrash
Root Menu Handles during Display (Bug 5620,r=dvander).
2015-02-21 17:25:25 -08:00
Kyle Sanderson
284fab7254 Root Menu Handles during Display. 2015-02-21 17:10:26 -08:00
Nicholas Hastings
b9579a53ce Add missing impl for File.ReadUint16. 2015-02-18 04:50:20 -08:00
Nicholas Hastings
c0729ff5e2 Add methodmap for GroupId. 2015-02-17 08:21:14 -08:00
Nicholas Hastings
c2d37cdff5 Add methmodmap for AdminId. 2015-02-17 07:19:56 -08:00
Nicholas Hastings
0f00a2db08 Remove unused result value in OnRebuildAdminCache forward call. 2015-02-17 06:43:49 -08:00
Nicholas Hastings
00ad38f5b7 Actually use game path instead of SM path as base. 2015-02-07 09:25:25 -08:00
Nicholas Hastings
261e135845 Make handle dump location relative to gamedir to match other sm_dump commands. 2015-02-07 09:21:53 -08:00
Nicholas Hastings
e88039d4e0 Fix FindFlagChar not finding char for AdminFlag_Custom6. 2015-02-03 10:32:34 -05:00
Nicholas Hastings
84a59c6fb7 Fix g_ReverseFlags array size. 2015-02-03 10:27:32 -05:00
Nicholas Hastings
19be28cc2e Rename g_FlagSet to g_FlagCharSet to avoid some confusion. 2015-02-03 10:26:28 -05:00
Nicholas Hastings
52514a96bd Fix "sm plugins refresh" not refreshing changed plugins. 2015-01-31 15:28:21 -05:00
Nicholas Hastings
8705aea634 Fix signed/unsigned compare warning in smn_adt_stack. 2015-01-27 17:59:55 -08:00
David Anderson
3040708d4e Merge pull request #215 from Thordin/more_handles
Increased handles to 32k
2015-01-26 11:24:46 -08:00
David Anderson
2382902fe4 Merge pull request #244 from alliedmodders/db-fix
Fix wrong value in transitional DBI callback. (bug 6292)
2015-01-23 14:07:22 -08:00
Nicholas Hastings
aff2551942 Remove conditionals in ambuild scripts for using msvc <2013 (not supported). 2015-01-21 11:04:52 -05:00
Nicholas Hastings
18b54b9064 Update protobuf include path for Dota build. 2015-01-21 11:04:03 -05:00
Ryan Stecker
ff27484527 Prevent null auth string comparisons. 2015-01-19 07:48:45 -05:00
Nicholas Hastings
9f648879e5 Fix regression causing "BOT" to no longer be valid in adminsys for Steam identities. 2015-01-17 10:11:04 -05:00
David Anderson
49383e7391 Fix wrong value in transitional DBI callback. (bug 6292) 2015-01-16 00:33:29 -08:00
Nicholas Hastings
e0e2c00d12 Fix ICommandLine not being found in Dark Messiah. 2015-01-11 11:44:45 -05:00
Nicholas Hastings
3929ff1f27 Fix typo on ArrayList.Erase native. 2015-01-04 11:58:44 -05:00
David Anderson
bf3ff460b3 Merge pull request #93 from peace-maker/failstate_dependencies
Pause dependent plugins on SetFailState. (bug 6120, r=dvander)
2015-01-03 10:55:52 -08:00
Nicholas Hastings
3e65d308a8 Don't looks for IServerTools on ep1 games.
(We don't use it and it doesn't exist on most.)
2015-01-01 14:56:37 -05:00
Nicholas Hastings
6d1a2b0d86 Expose Message_DetermineMulticastRecipients as GetClientsInRange native. 2014-12-30 15:37:57 -05:00
Peace-Maker
9b2e77711a Plugin_Failed == "An unrecoverable error"
Change the meaning of Plugin_Failed status to indicate, that the plugin
can't recover from the error.
Make sure those previously loaded plugins are shown correctly in sm
plugins info x.
2014-12-20 11:08:30 +01:00
Peace-Maker
0b131d6864 Pause dependent plugins on SetFailState (bug 6120)
When a plugin calls SetFailState it is paused and all natives it
registered are unavailable. Other plugins, which depend on those natives
keep running and error whenever they try to call those natives.

This correctly sets the dependent plugins to an error state as if the
plugin which called SetFailState was unloaded.
2014-12-20 11:07:57 +01:00
Nicholas Hastings
abb8d8447f Move bot auth to after connect to fix old too-early-authid bug now causing crash (r=VoiDeD). 2014-12-19 18:27:18 -05: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
67fcd9e2c6 Populate auth ids (if available) when initializing CPlayer instance. 2014-12-14 14:56:19 -05: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
David Anderson
722a23c818 Redo menu methodmaps. 2014-12-13 12:53:30 -08:00
David Anderson
28eb663f9b Port events to transitional syntax. 2014-12-13 12:51:16 -08:00
Thordin
f27c33cd18 Increased handles to 32k 2014-12-07 21:50:40 -08:00
Sean Lewis
d2e01da287 Wrap 3rd parameter in FindValueInArray to check for existence. 2014-12-06 17:07:54 -06:00
Sean Lewis
3ef2bdcb8d Add block parameter to FindValueInArray native. 2014-12-06 03:21:53 -06: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