Commit Graph
100 Commits
Author SHA1 Message Date
David Anderson 4b2d8b53fa Fix macOS scripting SDK build.
This also enables universal spcomp binaries with arm64 support.
2023-11-04 23:01:44 -07:00
David Anderson 7bfd5e521e Update SourcePawn.
This updates float.inc and smn_float.cpp to compensate for alias
removal.
2023-11-03 17:46:48 -10:00
David Anderson 060c832f89 Update SourcePawn.
This brings in a few breaking changes.

One, INVALID_FUNCTION is now 0 instead of -1. This is long overdue.
Plugins should transparently work except in two cases:

  1. Third-party extensions that have a hardcoded test for -1 will no
     longer work. A new API has been provided for this,
     GetFunctionByIdOrNull.
  2. If a plugin "framework" uses INVALID_FUNCTION anywhere in its
     exported API, then all plugins using that framework need to be
     recompiled together, so they agree on the value of
     INVALID_FUNCTION.

Hopefully the damage here is minimal. The core plugin version has been
bumped to 7 to try and limit conflicts.

Second, braceless functions are no longer supported. There wasn't really
any way around this and it's better to bite the bullet now. This affects
source compatibility, but not binary compatibility.

Third, the "using" keyword is no longer implemented. SourceMod now has a
Handle methodmap again. Plugins compiled against this new methodmap will
require a "Handle.~Handle" native, which 1.12 now provides.
2023-11-02 18:38:30 -10:00
David Anderson ae4e043c3e Enable C++17. 2023-10-21 19:02:51 -04:00
David Anderson 6def79ff23 Merge pull request #2063 from alliedmodders/cxx17
Enable C++17.
2023-10-19 20:33:14 -07:00
David Anderson cb1dae5aab Fix minimal rebuilds on buildbot. 2023-10-13 21:28:33 -07:00
David Anderson c9e824632f Enable C++17. 2023-10-13 21:25:24 -07:00
David Anderson 0436fb0ab3 Fix linkage. 2023-10-13 20:59:55 -07:00
David Anderson 767c5cf468 Fix build. 2023-10-13 15:32:45 -07:00
David Anderson f01ad5317a Fix linker issues on Linux. 2023-10-13 15:26:05 -07:00
David Anderson fac3138ff5 Fix typo. 2023-10-13 14:14:47 -07:00
David Anderson ab9e86910c Switch bootstrap.pl to Python. 2023-10-13 14:04:56 -07:00
David Anderson da3e868df5 Merge pull request #1812 from alliedmodders/revert-pbproxy
Revert "Introduce a pbproxy library to solve macOS linker issues."
2022-07-31 11:50:56 -07:00
David Anderson 63e0e2bc82 Fix build. 2022-07-31 11:22:10 -07:00
David Anderson a35ecde538 Revert "Introduce a pbproxy library to solve macOS linker issues."
This reverts commit e5ddbd9886.
2022-07-31 11:17:42 -07:00
David Anderson 81ad870def Revert "Fix use-after-free when creating custom user messages"
This reverts commit 15450a6d0c.
2022-07-31 11:16:50 -07:00
David Anderson 52da989762 Update SourcePawn on master. 2022-07-09 18:32:51 -07:00
David Anderson 5c66a78763 Bump master to 1.12. 2022-07-02 17:02:08 -07:00
David Anderson 12e20eecf7 Update SourcePawn. 2022-06-24 10:00:02 -04:00
David Anderson 4276301499 Update SourcePawn. 2022-06-18 15:35:30 -07:00
David Anderson 3bafc1e2f4 Update SourcePawn. 2022-05-11 13:20:41 -07:00
David Anderson 01203a5a44 Update SourcePawn. 2022-03-09 18:00:54 -08:00
David Anderson c873e1aafb Update SourcePawn/AMTL to fix build. 2021-12-11 16:28:04 -08:00
David Anderson af3c10b173 Update AMTL. 2021-12-09 18:14:28 -08:00
David Anderson 351ac171d2 Merge branch 'fix-menu-vote-handler' 2021-12-09 18:13:30 -08:00
David Anderson 96c74651db Fix vote menu handler to work with direct arrays. 2021-12-09 18:10:35 -08:00
David Anderson 4e3df76358 Update SourcePawn.
Fix fix an hl2sdk-mock build error.
2021-11-23 00:11:48 -08:00
David Anderson 31f6c0cb18 Dedent some menu code for readability. 2021-11-17 18:19:40 -08:00
David Anderson 90fec5c6df Add support for ASAN. 2021-11-11 23:41:42 -08:00
David Anderson 257535daf2 Update SourcePawn.
This fixes a few more regressions found in the new compiler.
2021-11-07 18:16:20 -08:00
David Anderson eb0878be2b Update SourcePawn.
This fixes a recent stability regression.
2021-11-02 10:51:00 -07:00
David Anderson be60a55aa3 Update SourcePawn. 2021-10-31 12:30:51 -10:00
David Anderson 10795fbed5 Switch to clang-8.
This is the new minimum supported Clang version going forward.
2021-10-27 09:44:19 -10:00
David Anderson 7605940994 Fix build. 2021-10-26 23:33:00 -07:00
David Anderson 94ff26bdf1 Fix error return of FormatNativeString. (#1613) 2021-10-26 22:31:58 -07:00
David Anderson 2a06680252 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.
2021-10-26 17:45:48 -10:00
David Anderson cab60f7385 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.
2021-10-26 07:05:34 -10:00
David Anderson c4e33cab8c Update bootstrap.pl 2021-09-27 20:27:21 -07:00
David Anderson bf0741e48a Use master for Metamod:Source builds. 2021-09-27 20:27:21 -07:00
David Anderson 51b5bbac0d Don't require hl2sdk-mock if sdks=all 2021-09-27 17:11:33 -07:00
David Anderson a5f99c57e1 Add support for hl2sdk-mock. 2021-09-22 12:36:44 -07:00
David Anderson 1b0c7bc1b8 Add support for hl2sdk-mock. 2021-09-22 12:36:44 -07: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