Commit Graph
100 Commits
Author SHA1 Message Date
David Anderson ad3a44427a Update SourcePawn. 2023-08-30 22:08:45 +02:00
David Anderson 737d8c3240 Fix build. 2023-08-30 22:08:45 +02:00
David Anderson 4688783baf Revert "Introduce a pbproxy library to solve macOS linker issues."
This reverts commit e5ddbd9886.
2023-08-30 22:08:45 +02:00
David Anderson ba5c6ad07c Revert "Fix use-after-free when creating custom user messages"
This reverts commit 15450a6d0c.
2023-08-30 22:08:45 +02:00
David Anderson 69045ccd52 Update SourcePawn on 1.11-dev. 2023-08-30 22:08:45 +02:00
David Anderson 8b9131f6e4 Update SourcePawn. 2023-08-30 22:08:45 +02:00
David Anderson bbbaebd32a Update SourcePawn. 2023-08-30 22:08:45 +02:00
David Anderson edc73649ff Update SourcePawn. 2023-08-30 22:08:45 +02:00
David Anderson 1d5ec7b982 Update SourcePawn/AMTL to fix build. 2023-08-30 22:08:45 +02:00
David Anderson df9b0ef1b3 Update AMTL. 2023-08-30 22:08:45 +02:00
David Anderson f81412b4fa Fix vote menu handler to work with direct arrays. 2023-08-30 22:08:45 +02:00
David Anderson bd478ebdfc Dedent some menu code for readability. 2023-08-30 22:08:45 +02:00
David Anderson 6b6436db17 Update SourcePawn.
Fix fix an hl2sdk-mock build error.
2023-08-30 22:08:45 +02:00
David Anderson f182feed9d Add support for ASAN. 2023-08-30 22:08:45 +02:00
David Anderson 02dd6a9c00 Update SourcePawn.
This fixes a few more regressions found in the new compiler.
2023-08-30 22:08:45 +02:00
David Anderson b421a0c594 Update SourcePawn.
This fixes a recent stability regression.
2023-08-30 22:08:45 +02:00
David Anderson aa98f60ca3 Update SourcePawn. 2023-08-30 22:08:45 +02:00
David Anderson d5f47a88e6 Switch to clang-8.
This is the new minimum supported Clang version going forward.
2023-08-30 22:08:45 +02:00
David Anderson e565c83494 Fix build. 2023-08-30 22:08:45 +02:00
David Anderson a68ff2a587 Fix error return of FormatNativeString. (#1613) 2023-08-30 22:08:45 +02:00
David Anderson 377888276e Update to the new SourcePawn compiler.
This imports the brand new SourcePawn compiler. The new compiler is much
faster to compile and generates significantly improved code around
array generation and array access.

There are a number of compatibility changes in the new compiler. Most of
these are due to improved type checking and error detection. The full
list of notes can be found here:

https://github.com/alliedmodders/sourcepawn/blob/master/docs/upgrading-1.11.md

Additionally, .smx files generated by the new compiler will NOT load on
earlier versions of SourceMod, including earlier versions of 1.11. Old
plugins will continue to load as normal.
2023-08-30 22:08:45 +02:00
David Anderson 3171d4fb7b Bump handle limit to 1MB.
This bumps the handle bits to 20 and reduces the serial/cookie bits to
12. A warning is emitted if a single owner creates more than 100k
handles.

Tested on mock srcds with sm_dump_handles.
2023-08-30 22:08:45 +02:00
David Anderson 907fa77381 Update bootstrap.pl 2023-08-30 22:08:44 +02:00
David Anderson c5c302dccc Use master for Metamod:Source builds. 2023-08-30 22:08:44 +02:00
David Anderson c49d51206c Don't require hl2sdk-mock if sdks=all 2023-08-30 22:08:44 +02:00
David Anderson fec978afb4 Add support for hl2sdk-mock. 2023-08-30 22:08:44 +02:00
David Anderson 74ad70ba30 Add support for hl2sdk-mock. 2023-08-30 22:08:44 +02:00
David Anderson 4fb57dc4e3 Update SourcePawn. 2021-08-07 16:46:53 -07:00
David Anderson e82f88dfa9 Update SourcePawn to 1.11-dev tip of tree. 2021-08-01 14:21:48 -07:00
David Anderson 7c3cb49dfa Fix minimal rebuild. 2021-07-20 16:39:48 -07:00
David Anderson 6928d21bcf Fix crash in FrameIterator. 2021-07-16 18:33:10 -07:00
David Anderson 38eecd5ece Switch to python3 for ambuild. 2021-07-11 22:35:01 -07:00
David Anderson d48cf93a94 Fix builder.target usage. 2020-10-22 23:41:01 -07:00
David Anderson e0d9dfb68e sourcepawn: uplift FakeNative to DynamicNative. (#1338)
This removes calls to CreateFakeNative.
2020-10-02 16:42:31 -07:00
David Anderson 6e2c5a66b3 Remove use of the Dep API.
This is going away.
2020-08-24 20:48:57 -07:00
David Anderson 0bed34e0c7 Add x64 to official Windows builds. 2020-08-20 23:17:21 -07:00
David Anderson f0d8a70b38 Fix tabs in BreakpadSymbols. 2020-08-19 00:43:12 -07:00
David Anderson 9acf2b5cda Use Python 3.8 on the Windows buildbot. 2020-08-19 00:39:54 -07:00
David Anderson d49b92603a Another BreakpadSymbols fix. 2020-08-19 00:12:40 -07:00
David Anderson aa01a22416 Fix BreakpadSymbols again. 2020-08-19 00:09:08 -07:00
David Anderson 50e43a9f98 Fix BreakpadSymbols. 2020-08-18 23:45:30 -07:00
David Anderson ed325c7208 Trigger a full rebuild. 2020-08-18 23:42:36 -07:00
David Anderson aac2c4a080 Trigger full reconfigures when requested. 2020-08-18 23:29:24 -07:00
David Anderson 785c6aa1cf Update to AMBuild 2.2.
This is a pretty big diff because SourceMod had lots of multi-arch
workarounds that can now go away. I've also changed 'x64' to 'x86_64' in
many places since this is how AMBuild normalizes it, and it's far too
late to pick the shorter string, so we might as well suck it up.

The --target-archs parameter has been replaced with --targets. It works
the same way.

The default behavior for SDK inclusion is now "present" instead of
"all" since this lowers the burden of storing many SDKs. Official builds
will still be made with --sdks=all.
2020-08-18 23:09:43 -07:00
David Anderson 7355e34946 Fix AppVeyor. 2020-07-15 20:18:55 -07:00
David AndersonandKyle Sanderson ed9f214256 appveyor: relocate in-tree and convert to MSVC2015. (#969)
* Move appveyor in-tree and move to MSVC2015.

* appveyor: sync.

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* appveyor: align SDKs with travis-ci.

* Update appveyor.yml

Co-authored-by: Kyle Sanderson <[email protected]>
2020-07-13 17:56:12 -07:00
David Anderson 3b386379dd Use more STL for vector insertion/removal. (#1284) 2020-06-13 15:57:02 -07:00
David Anderson 7b887ee9f6 Update SourcePawn.
This will fix a utf8 regression reported in issue #1286.
2020-06-02 13:33:57 -07:00
David Anderson 67f0e4be60 Update SourcePawn and AMTL. 2020-06-01 13:22:29 -07:00
David Anderson 80acff8d7d Replace ke::LinkedList with std::list. 2020-05-31 23:19:41 -07:00
David Anderson d5d4d78023 Update SourcePawn and AMTL to fix the Mac build. 2020-05-31 22:57:14 -07:00
David Anderson 5d94f0bea8 Replace ke::Vector with std::vector. 2020-05-31 11:35:51 -07:00
David Anderson e5ddbd9886 Introduce a pbproxy library to solve macOS linker issues.
On SDKs which use protobufs, the engine has objects compiled against a specific
version of protobuf. Normally this is fine, we take care on Linux to use the
same C++ ABI. On macOS however, we use libc++ to enable C++11 functionality,
whereas the protobuf library has been compiled with libstc++. These ABIs are
not compatible.

To address the problem, we introduce PbHandle. PbHandle is a wrapper around
protobuf::Message with two added pieces of state: whether or not the handle
"owns" the message (and can free it in its destructor), and whether or not
the handle was created by the engine (private) or created by SourceMod
(local).

Whenever we transfer a protobuf::Message pointer to SourceMod, we must take
care to convert it to a Local version first. Whenever we transfer a protobuf
pointer to the engine, we must convert it to a Private handle.

For platforms with no ABI differences (almost all of them), the handle is a
no-op. The private and local localities are compatible and no translation
takes place.

On macOS, CS:GO does require translation. SourceMod loads a tiny shim
library that contains a copy of the protobuf sources compiled against the
game's ABI. It then provides serialization and deserialization methods.
SourceMod must not interact with the game's protobuf objects without first
going through this proxy library.

Note that PbHandle is not quite like unique_ptr. It can be converted into a
PbHandle that does not destroy the underlying object. This is mainly because
UserMessages.cpp has rather complex state, so it is useful to track locality
without destroying an object. An unowned PbHandle must not outlive the
owning PbHandle.
2020-05-30 22:13:07 -07:00
David Anderson d525b466ec Use C++11 for macOS and CS:GO. 2020-05-30 22:13:07 -07:00
David Anderson 333227fad8 Build csgo-x64 on travis. 2020-05-30 22:13:07 -07:00
David Anderson 288a781555 Fix startup crash. 2020-05-30 19:10:23 -07:00
David Anderson 979e410efc Update AMTL, replace ke::Deque with std::deque. 2020-05-30 12:44:02 -07:00
David Anderson 49669f6585 Revert "Fix linking on Linux."
This reverts commit acf8782786.
2020-05-26 20:04:55 -07:00
David Anderson acf8782786 Fix linking on Linux. 2020-05-25 21:35:50 -07:00
David Anderson 6d2e0aa684 Fix Windows build. 2020-05-21 00:11:23 -07:00
David Anderson 032a30f676 Fix mac build, part 2. 2020-05-20 23:17:15 -07:00
David Anderson c9f574c27b Fix mac build. 2020-05-20 22:50:41 -07:00
David Anderson b725196a26 Replace AString with std::string. 2020-05-20 17:57:18 -07:00
David Anderson 301bafa3f5 Replace more Move/Forward with STL variants. 2020-05-19 12:56:28 -07:00
David Anderson 7a3e4054c7 Enable exception handling in C++ code.
It turns out this was already enabled on MSVC (due to /EHsc), but let's
enable it on other platforms as well.

Exception handling comes with a huge caveat: SourceMod and SourcePawn
are not exception safe. Not only do they predate usable STL (C++11),
they often predate C++03, and sometimes even C++ itself. There are many
places we do not use RAII, or where we accumulate state in a way that
cannot be interrupted.

By enabling exceptions, we are NOT inviting general try/catch. We are
still assuming that a `throw` anywhere within SourceMod will ultimately
result in a crash.

However, as we enable more and more STL, we are losing the ability to
gracefully handle constructor failures and malloc failures. So try-catch
is now enabled. It should only be used in the narrowest of
circumstances:

 - When an exception can be thrown by a library call, and
 - There is no way "a priori" to tell if an exception will be thrown
(for example, std::bad_alloc or std::system_error), and
 - Handling the exception is meaningful.

Generally malloc failures should not be considered meaningful. Once
memory is exhausted, the program will crash or be OOM-killed, so there's
no point in handling the failure. However, cases where the allocation
amount is variable may be meaningful to handle. A simple example would
be CDataPack, where if a plugin leaks entries, it's better to handle
this gracefully given that vector growth is geometric. Another example
might be reads of a massive file or network request into a buffer.

These cases should be rare, given that memory pressure is usually
fatal to srcds anyway. But if you've decided to handle an exception,
the try-catch block should be as narrow as possible. For example,
the following is erroneous:

    ke::Maybe<SomeGiganticThing> object;
    try {
        object.init();
    } catch (const std::bad_alloc&) {
    }

`ke::Maybe` is not threadsafe, and this can leak. Basically, do as
little as possible in try blocks, and use them sparingly, because
they're very difficult to audit.

We are also not inviting use of `throw`, as auditing it is even more
complex than try/catch. It is better to abort(), or use boolean
returns and two-stage object initialization.
2020-05-19 12:21:57 -07:00
David Anderson 7d7253c9cc Update AMTL; replace AutoPtr/UniquePtr with STL. 2020-05-18 18:19:16 -07:00
David Anderson c2df49ee33 Rename ke::Lambda to ke::Function. 2020-05-17 12:33:52 -07:00
David Anderson a253e175bb Replace all uses of AMTL threads with STL threads.
This also rewrites the work loop for threaded queries. It has been
simplified significantly.
2020-05-16 22:35:56 -07:00
David Anderson 15023777f4 Merge pull request #1266 from alliedmodders/threads-3
Pare down ThreadSupport and remove ancient thread code.
2020-05-14 10:45:50 -07:00
David Anderson ff018a9a5d Improve Travis coverage.
Our official builds use clang-3.4 (for macOS) and clang-3.8 for Linux.
Linux uses libstdc++-4.9. Make sure these two compilers are being tested
and that libstdc++-4.9 is being used for STL.

Add a macOS builder to get coverage there. This will use a newer
clang than we actually use, but as opposed to the linux builder will
test the platform-specific bits.

Finally, use the latest GCC and clang versions from a bionic image, so
we have some coverage of a popular distribution.
2020-05-13 19:09:20 -07:00
David Anderson f76cb94511 Pare down ThreadSupport and remove ancient thread code.
This patch removes almost all of the existing platform-specific
ThreadSupport code, as well as code derived from it. It is now
implemented on top of C++11 threads and is much simpler.

This is the first inclusion of STL in SourceMod. Mac and Windows are
allowed to dynamically link to their respective implementations. On
Linux, libstdc++ is statically linked, except in the cases where it was
already dynamically linked (csgo, blade).

IEventSignal has been retained because sourcemod-curl-extension relies
on it. As written, it is impossible to use as a condition variable,
because the caller does not have access to the underlying mutex. There
is no way to make this API safe or non-racy, so extensions relying on
it should switch to C++11 threads.

ThreadWorker is now pared down and does not interact or inherit from
BaseWorker in any way. Basic functionality has been tested. Since it is
not used anywhere in SourceMod, or seemingly in any repository on
GitHub, it's unclear whether it should even exist. But it has been
tested in this patch.

This change bumps the minimum macOS version to OS X 10.7, and the
minimum C++ standard level to C++14.
2020-05-13 00:35:29 -07:00
David Anderson 87cc42d348 Fix build failures with clang 10. 2020-05-12 23:04:55 -07:00
David Anderson 2b6833f65d Merge pull request #1167 from Scags/teleport-defaulted
Add default values to TeleportEntity
2020-02-26 13:17:45 -08:00
David Anderson 5efe6d0a42 Merge pull request #1151 from alliedmodders/update-sp
Update SourcePawn.
2019-12-28 12:24:19 -08:00
David Anderson e34fbcce0d Update SourcePawn.
This fixes:
 alliedmodders/sourcepawn#432
 alliedmodders/sourcepawn#435
 alliedmodders/sourcepawn#439
2019-12-28 12:07:36 -08:00
David Anderson 4328627326 Merge pull request #1144 from alliedmodders/update-sp
Update SourcePawn to tip-of-tree.
2019-12-15 20:48:27 -08:00
David Anderson fc6925fa0a Update SourcePawn to tip-of-tree. 2019-12-15 20:34:44 -08:00
David Anderson cd1a296e4f Merge pull request #1131 from alliedmodders/update-sp
Update SourcePawn.
2019-11-24 20:57:06 -08:00
David Anderson 3ddf9f8a0d Update SourcePawn. 2019-11-24 20:41:59 -08:00
David Anderson d6e518838f Merge pull request #1053 from nosoop/remote-ext-filename-check
Check short name for remote extensions
2019-11-12 11:45:02 +09:00
David Anderson 0d320b7922 Merge pull request #1115 from alliedmodders/update-sp
Update SourcePawn.
2019-11-02 12:32:35 -07:00
David Anderson b2a0d0e4da Update SourcePawn.
Bug: alliedmodders/sourcepawn#400
Bug: alliedmodders/sourcepawn#401
Bug: alliedmodders/sourcepawn#402
2019-11-02 12:16:04 -07:00
David Anderson c0686dc4f9 Merge pull request #1106 from alliedmodders/update-sp
Update SourcePawn to master.
2019-10-28 22:51:30 -07:00
David Anderson 7ab3a3cfd9 Update SourcePawn to master.
This turns on the new expression parser by default.
2019-10-28 21:19:22 -07:00
David Anderson c3102c7e9f Bump version to 1.11. 2019-10-18 21:07:36 -07:00
David Anderson f05e39afe1 Merge pull request #1090 from alliedmodders/update-sp
Update SourcePawn to 1.10-dev tip.
2019-10-01 09:50:25 -07:00
David Anderson 78511afa4c Update SourcePawn to 1.10-dev tip. 2019-09-28 18:32:47 -07:00
David Anderson c37c4f830f Merge pull request #1088 from alliedmodders/update-sp
Update SourcePawn to the tip of 1.10-dev.
2019-09-26 13:14:29 -07:00
David Anderson 4fe2ae780b Update SourcePawn to the tip of 1.10-dev. 2019-09-25 21:59:32 -07:00
David Anderson c7392aeded Fully convert dynamicmenu to transitional enum structs. (#1082) 2019-09-15 14:02:46 -07:00
David Anderson 14247af323 Merge pull request #1081 from alliedmodders/enum-structs
Update SourcePawn.
2019-09-15 11:55:56 -07:00
David Anderson 32cb00a4c6 Update SourcePawn. 2019-09-15 11:38:21 -07:00
David Anderson 94b3ca08a2 Update SourcePawn & amtl submodules (#1067) 2019-09-01 13:24:39 -07:00
David Anderson 5868ffd04e Merge pull request #1050 from alliedmodders/update-sp-093edef
Update SourcePawn to 093edef
2019-07-24 09:38:43 -07:00
David Anderson 15a7faeafd Merge pull request #1008 from alliedmodders/update-sp
Update SourcePawn to 4cba235.
2019-05-11 14:13:28 -07:00
David Anderson 626963fc49 Update SourcePawn to 4cba235. 2019-05-11 13:53:09 -07:00
David Anderson 2e11d3400e Fix MSVC2015 build. 2019-03-16 17:25:36 -07:00
David Anderson 364cd094d9 Trigger a build. 2019-03-16 16:57:22 -07:00
David Anderson 2af7600057 Switch to MSVC2015 builders. 2019-03-16 16:21:57 -07:00
David Anderson ae0a03d438 Merge pull request #964 from Bara/patch-5
Add missing semicolon
2019-02-19 21:49:07 -08:00