* Start using Github Actions
Build on windows and linux. Cannot build for macos,
since the builders only support xcode 10+ which dropped
x86 support.
* Build sourcepawn tooling as separate package
Upload build artifacts containing only spcomp and the includes.
This adds a new `--scripting-only` flag to configure.py which skips
everything and goes straight to building spcomp and packaging the
include folder with it.
* Only run the workflows for the master branch
* Split common operations into PackageHelpers file
Don't duplicate the code for packaging releases for the tooling-only packages. Instead use a common `PackageHelpers` class which provides the functionality common to both packages.
This replaces the explicit list of files to package with a directory scan, so we don't have to list them all.
The pgsql sql-init-scripts were missing from the release package before, so they were added here as well. Three scripts from the testsuite were missing from the explicit list (mapdisplayname, floats, findmap), so they're now included.
* Fix Python 2 compatibility
os.scandir is Python 3 only.
* Execute ConVarQueryFinished if client disconnects
So people passing handles to the extra data can close them, adds a new return value to check if this happened
* Update based on suggestion
Co-authored-by: Asher Baker <asherkin@limetech.io>
* Update based on notes
* Normalize
* Pass along cookie handle instead of invalid
Co-authored-by: Asher Baker <asherkin@limetech.io>
* Harden plugin loading path requirements
Restrict loading of plugins to the `sourcemod/plugins` folder and require the `.smx` file extension.
Symlinks inside the `plugins` folder are fine.
This behavior was abused as part of justCTF 2020 in the PainterHell challenge by cypis. Thank you!
* Restrict extension loading to extensions folder
* Add NULL file extension check in LoadExtension
hi @KyleS
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.
* Add basic Insurgency support on Windows x64
This allows SourceMod to load on x64 Insurgency. There are still a lot of variable truncation warnings that have to be dealt with.
* Fix 32bit builds
* Compile MySQL extension as well
The hack for __iob_func being removed from the core runtime, but required by the old mysql we're building against can be simplified a lot due to the `_ReturnAddress` intrinsic available since MSVC 2015.
* Don't include the offset we want to extract in the signature
When creating our own "owned and local" protobuf message in `StartProtobufMessage`, `m_FakeEngineBuffer` is used to track that message. In `EndMessage` the message is optionally converted to a "private" one with the right abi on osx and passed to the engine's `SendUserMessage`. On linux and windows the same message as in the `m_FakeEngineBuffer` is passed though without conversion. `engine->SendUserMessage` has a vtable hook which sets `m_FakeEngineBuffer` to the passed argument.
`m_FakeEngineBuffer` frees the message it previously held, since it's "owned" from `StartProtobufMessage`, but that's the same one that's passed in as argument so a use-after-free in the engine happens when the now-freed message pointer is forwarded to the real `SendUserMessage` in the engine.
The message created in `StartProtobufMessage` wasn't free'd at all when hooks are blocked too. This fix moves the message buffer into a local variable which is destroyed at the end of the function.
Fixes#1286 and #1296
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.
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.
* Fix timelimit not correct for Black Mesa
Black Mesa is particular and use timelimit in seconds instead of minutes
* Update TimerSys.cpp
* Update TimerSys.cpp
* Update TimerSys.cpp
* Update TimerSys.cpp
The allocation size was still updated to the bigger size even if memory allocation failed. Trying to write to the supposedly available new space would overflow the heap and crash. Fixes#1233
* Fixed memory leak
When a pack was cleared or destroyed the String and Raw types could cause memory leaks. This happens when "position" is sitting at the end of the vector and can never get past the "if (pos >= elements.length())" statement. This means there is a memory leak in any plugin that clears/destroys a pack with strings and doesn't set the position to length-1 or less beforehand.
* datapack: Fix delete op on CDataPackType::Raw.
Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>
* DarkM: build-fix for engine msg caching
* style + promote ptr casting to uintptr_t.
* sync type to uintptr_t in pm.h
* return of the uint32_t
* update header.
* oh, right, unsigned int...
* Avoid losing console messages.
Buffers up to 16k bytes of SVC_Print if buffer would overflow, then sends chunks every frame.
Sends up to 2048 bytes per frame and does not split messages.
* UNTESTED! Switch to ke::LinkedList<ke::AString> for PrintfBuffer.
Switch from OnGameFrame to FramAction.
Fix compiling on Episode1 by essentially disabling the feature.
* UNTESTED! Cleanup on disconnect, passthrough for >= 2048 msgs
* try reference for CPlayer.
* fix
* remove m_PrintfStop
* remove m_PrintfStop
* ensure empty queue when netchan drops
* flip to serials.
* serials
* style
* Update PlayerManager.cpp
* lift consts to header.
* remove local const references
* ep1 static const
* flip to queue - fix serial on resched.
* Update PlayerManager.h
* Update PlayerManager.cpp
* Update PlayerManager.h
* am-deque.h
Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>
* Add natives to work with 64 bit Protobuf values
* Fix linux build
* FIX alignment requirements
* FIX alignment requirements V2
* Remove legacy API
* Inattention
When lookup of a more specialized entry in the maplists.cfg failed, it wouldn't fallback to the "default" section, but just try to parse the same section again.
* Change lookup strategy for SQL_CheckConfig
* Ensure db conf lookup failures default to ..default
* Revert "Ensure db conf lookup failures default to ..default"
This reverts commit 03dc703daeeeadaa134e2160bf2c7cd812402758.
This simplifies non-sdk build scripts by removing their loops over SM.archs. Instead the top-level
build script will re-evaluate them for each architecture.
This doesn't break any extensions NOT using IDataPack, and we do not know of any that are.
* The extension storage utility of this interface has been broken for the last 9 months, with ISourceMod::CreateDataPack being disabled.
* The plugin interop utility of this interface (its stated purpose) has been broken for the last 11+ years, with ISourceMod::GetDataPackHandleType being disabled.
I imagine it only survived the first cleanup 11 years ago because CSS:DM was using it internally, which it has now been migrated away from.
Compiled all the included extensions without changes (API compat), and loaded extensions build pre-change without issue (ABI compat).
* Match old DataPack behavior when overwriting data
* Make RemoveItem more flexible
* Ditch implied RemoveItem behavior & asher fixes
* KyleS nits - but fixed before he says them
* Add back implicit behavior
* Update CDataPack.cpp
Committing to the spec.
* Update CDataPack.h
* fixup removing last item if explicitly requested
* Fix logic for accepting pack pos, rather than index
* Fixup IsReadable
* headache is over now