SourcePawn 2 supports passing the variable arguments through to another function natively.
Instead of using `VFormat` you can just call `Format(buf, sizeof(buf), fmt, ...)` directly with the ellipsis `...`.
This broke plugins using VFormat. Add a macro to transparently replace `VFormat` with `Format` calls when compiling with the SourcePawn 2 compiler to keep the plugins from complaining about a missing `VFormat`.
Preprocessor macros are not affected by `#pragma deprecated` so we cannot warn about this yet.
* Add check for client status before resetting
* Get rid of unnecessary color reset on beacon remove
* Fix firebomb/timebomb resetting color when effect was not active
* Fix firebomb toggling wrong client's active status
---------
Co-authored-by: Nicholas Hastings <[email protected]>
* Fix OOB dereference in PluginIterator methodmap (#1880)
This prevents the native from returning true when the iterator has already reached the end() of the list, which previously led to a crash when accessing the Plugin property.
* Add defense-in-depth safeguards to CMMPluginIterator
* Update PluginIterator.Next() @error documentation
Reflect the new NativeError thrown when calling Next() on an exhausted iterator.
In basebans there are 3 commands for banning: banip,addban,ban
They have required arguments for ban duration and optional arguments for ban reason. However the functions that process the arguments do not properly validate the duration and if reason is provided instead of duration, the functions just convert that string into an integer and use it as the ban duration. This usually results in a permaban with an empty reason. This commit adds a loop for checking duration chars to be numeric before converting them to an int.
In the current ongoing effort for sourcemod to fully support 64 bits, we are introducing "virtual address".
# Explanation
Because SourcePawn does not yet support a 64 bits-wide type it's been impossible for any plugins to hold addresses in regular 32-bits wide variable.
A first attempt at solving this issue was made in commit ce1a4dcac0 therein dubbed "PseudoAddress", however this turned out to be an unsatisfactory solution, as any 'high' address if offsetted could turn invalid (or outright be impossible to map).
This leaves us with three alternatives :
- New type
- Convert Address into a handle
- Virtual Address
A new type is the most destructive solution, as it entails breaking every single Address related method. While that solution is still not off the table, we're reserving it as the last attempt should this commit fail.
Converting into a handle type is a good compromise between a brand new type whilst also preserving the Address methods. However, this comes with two issues: the first being that you can no longer offset Address, the second is that we would require authors to free the handle type which will be very confusing. This will likely not be implemented.
# Virtual address
Under a reasonable assumption, we've noted that the average plugin is unlikely to play with more than 4 GB of memory; this shouldn't be too surprising as all valve games were once 32bits and therefore limited to 4GB. Assuming this stays mostly true and a plugin isn't interested with the mapped memory of lesser known modules (like soundlib or matlib), it is fair to assume plugins are unlikely to access more than 4GB of mapped memory. Working with this in mind, we map the memory the plugins are likely to access to our custom virtual address ranges (from 0 to 4Gb, the values of which can fit on 32bits variable). If any memory was missed and plugins were to try an access it later those ranges will be late-mapped to our virtual address ranges until we run out of them.
In order to use virtual addressing, whether on 32 bits or 64 bits. Plugins must now "#include <virtual_address>", as well as use the new SDKCall_VirtualAddress, SDKType_VirtualAddress, LoadAddressFromAddress & StoreAddressToAddress where it's appropriate to.
* Added columns from the SELECT clause that were missing from the GROUP BY clause on line 529 that was causing the query to fail.
* Increased query buffer size on line 513 from 512 to 544 to accomodate the extra characters needed.
* Add new IntHashMap and IntMap natives
This is a continuation of #579.
[HashMap] Adds new IntHashMap and IntMap natives.
This patch makes the following changes
* Refactors StringHashMap to a generic HashMap template
* Adds the IntHashMap class
* Adds new IntMap natives
* Adds IntMap tests to the tries test suite
[HashMap] Reverted rename of CharsAndLength
[HashMap] Use more descriptive template names
[HashMap] Removed old-style natives
[HashMap] Removed IntHash class
[HashMap] Reverted some search & replace errors
Co-authored-by: Geoffrey McRae <[email protected]>
* Fix spelling mistake + include
* Fix tries test
* Update tests with clone + ContainsKey
---------
Co-authored-by: Geoffrey McRae <[email protected]>
Co-authored-by: Nicholas Hastings <[email protected]>