Commit Graph
1233 Commits
Author SHA1 Message Date
Eric Zhang c98574c426 Make nominations map selection menu title translatable (#2597)
* Make nominations map selection menu title translatable

* Add the new Select Title to Chinese translations
2026-11-01 18:02:35 +00:00
Nicholas Hastings 3240285ed2 Add outbreak build 2026-11-01 11:38:36 -05:00
Adrian-Stefan MaresandClaude Opus 5.5 e7ac9b013d Add int64 support to forwards (#2594)
* Fix forwards accepting arguments of the wrong type

CForward::ProcessArguments returns whether the arguments are valid, but
its error paths return !!SetError(...), which is true for any error
code. Mismatched arguments were therefore accepted and the forward ran
anyway, while m_errstate stayed set and made the next Execute() on that
forward fail with a stale error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BxFXSTjEk7Dub57XRmVfqU

* Add Call_PushInt64 and Param_Int64

Since Address became an int64, plugins can no longer pass one through a
forward or Call_StartFunction: an int64 parameter is passed as a
reference to its value, so Call_PushCell hands the callee an invalid
reference and crashes the server, and Call_PushArray hands it the heap
array instead of the value.

Add Call_PushInt64, which pushes the value with CallArgs::PushInt64 the
way DHooks does, and Param_Int64, so forwards can declare and check
64-bit integer parameters.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BxFXSTjEk7Dub57XRmVfqU

* Move the Call_PushInt64 test to the mock testsuite

Run it in CI with the other hl2sdk-mock tests, on x86 and x86_64,
instead of as a manual test plugin.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BxFXSTjEk7Dub57XRmVfqU

* Pass int64 arguments to legacy plugins as cells

Plugins compiled before Address became an int64, or with oldspcomp, take
an Address as a single cell and crash when handed an int64 argument.
Like DHooks, check the callee's plugin for __Int64_Address__ and pass
those plugins the low 32 bits instead, so a forward can have both kinds
of listeners.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BxFXSTjEk7Dub57XRmVfqU

* Document how legacy plugins receive Call_PushInt64 values

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BxFXSTjEk7Dub57XRmVfqU

* Don't downgrade int64 arguments for legacy plugins

The forward system shouldn't know about the Address convention. Code
that declares a forward parameter as an Address can handle plugins that
take it as a cell.

This reverts commits 345b0dcb4 and 78b7bc14b.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BxFXSTjEk7Dub57XRmVfqU

* Add Param_SMAddress and Call_PushAddress

Plugins compiled before Address became an int64 take an Address as one
cell. Arguments declared as Param_SMAddress in a forward, or pushed with
Call_PushAddress to a function, are passed to those plugins as the low 32
bits, like DHooks does. Param_Int64 arguments are always passed as int64.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BxFXSTjEk7Dub57XRmVfqU

* Refuse non-Address int64 arguments for plugins compiled before 1.13

Plugins compiled before SourceMod 1.13 have no int64 type, so an int64
argument can only reach them in a parameter they declared as a cell.
Only an Address has a sane value there, its low 32 bits; any other int64
does not. Report an error naming the plugin and skip it instead of
passing it a reference it reads as a cell.

oldspcomp with the 1.13 includes also declares Address as an int64 and
__Int64_Address__, so describe these plugins as compiled before 1.13.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BxFXSTjEk7Dub57XRmVfqU

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-10-27 00:44:33 +00:00
Nicholas Hastings 97801196df Revert garbage 2026-09-14 19:12:16 -04:00
Nicholas Hastings 7b013d5097 Fix x86 float formatting precision (fixes #2562) (#2573) 2026-09-14 22:38:52 +00:00
peace-maker 42237ddc03 CI: Fix hl2sdk-mock test error detection (#2558)
* Build sdktools for hl2sdk-mock

The test_format script requires it.

* Fix test_format %T translation test

%T expects a client index and translation phrase as arguments, the test was passing a language id and a phrase.
It never ran due to sdktools missing on the mock srcds before.

* mocktest: Check for passing tests or exceptions too

When sourcemod wouldn't even load the tests were still green since there was no "FAIL" in the output :D

* Test 32bit x86 srcds too

* Build against MMS 1.12-dev
2026-09-14 21:55:15 +00:00
F1F88 65d0d1380e GetFunctionByName: return the runtime's funcid instead of deriving it from the public index (#2566)
* fix: use the runtime's funcid in GetFunctionByName

* test: update testsuit
2026-09-06 18:17:48 +02:00
sappho d75d410100 Add TIMER_FLAG_TICK_PRECISE - a new method for tick-precise timer intervals 2026-09-06 01:19:05 -07:00
F1F88 bea10f0fb1 Add native StringToI64 (#2449)
* Add native StringToInt64Ex

* Delete useless test code

* Rename native StringToInt64Ex to StringToI64

* Add documentation for out-of-bounds situations.
2026-09-03 21:42:52 -07:00
Peace-Maker e078b2b542 Add VFormat macro for backwards compatibility
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.
2026-09-03 08:58:20 -07:00
David Anderson b1ac6f9a80 Fix unsafe casts in test_sorting.sp. 2026-09-01 18:58:42 -07:00
David Anderson 65ce00763a Hide VFormat() for SourcePawn 2 plugins.
VFormat() does not work in the v2 VM. Instead, there is a new "spread"
operator, so regular Format or FormatEx will work instead.
2026-09-01 18:58:42 -07:00
David Anderson 02c56a6a42 Update pinned commit for SourceMod, and adjust for API changes. 2026-09-01 18:58:42 -07:00
Eric ZhangandNicholas Hastings f63ee4d937 Fix alltalk vote for CSGO (#2544)
* Fix alltalk vote for CSGO

* Avoid toggling sv_deadtalk

---------

Co-authored-by: Nicholas Hastings <[email protected]>
2026-08-15 17:48:31 +00:00
SCP-076 84c633c4da add zero-param ConVarChanged typeset signature (#2531) 2026-08-02 14:36:40 +00:00
Nicholas Hastings 8bc615f29b Add async file op natives (#1674) (#2524) 2026-07-30 06:53:45 -04:00
Nicholas Hastings bc69fc9f8e Add CopyFile native (#1683) 2026-07-26 13:45:46 -04:00
Nicholas Hastings 1a59e55723 Implement KeyValues.FromAddress (#1467) 2026-07-23 19:25:29 -04:00
Nicholas Hastings c7fb295eab Slightly speed up OnClientAuthorized where possible (#2504) 2026-07-16 13:29:22 -04:00
Nicholas Hastings d9128d874b Switch from FloatCompare to < operator in vote plugins 2026-07-12 10:49:59 -04:00
SCP-076 0002aa228c clarify late load callbacks 2026-05-25 15:28:08 -04:00
David Anderson e87291362b Remove PushNull API from forwards/calls.
This appears to have no users, as it was not really possible to take
advantage of due to language constraints.
2026-05-24 13:25:34 -07:00
David Anderson 468760c902 Switch ForwardSys to use ICallable.
This removes a ton of tech debt and will improve Forward performance.
2026-05-17 15:22:58 -07:00
David Anderson 6739b0c280 Update SourcePawn. (#2454)
This modifies smn_sorting to use the new 2D array access API.
2026-05-03 09:52:31 -07:00
F1F88 707a6f5a00 Add format specifier "%lb" & "%lX" & "%lx" (#2448)
* Add format specifier "%lb" & "%lX" & "%lx"

* adjust brace style to match the rest of the file
2026-04-28 02:54:12 +00:00
c11164c4d9 Add KeyValues.Merge (#2184)
* Add KeyValues.Merge

* Disable for ep1

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Nicholas Hastings <[email protected]>
Co-authored-by: Copilot <[email protected]>
2026-04-28 01:58:49 +00:00
BerkeandNicholas Hastings 5d28ea6162 Fix the funcommands plugin resetting all players' color and transparency on round end (#2446)
* 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]>
2026-04-26 16:34:37 +00:00
SCP-076 94adc98ef5 Fix out-of-bounds crash in PluginIterator_Next (#2445)
* 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.
2026-04-25 17:11:28 +00:00
F1F88 817696358b Fixed an extra padding character in the negative integer formatting (#2443)
* Fixed an extra padding character in the negative integer formatting

* Add test script

* Add more test cases
2026-04-25 13:30:09 +00:00
David Anderson 80ca6f8cd4 Fix return value of AdminId.GetUsername. (#2438) 2026-04-10 08:31:15 -07:00
David Anderson feaeb6a0ea Fix return values of some natives. (#2437)
These are listed as returning void, but actually have non-void returns
in their implementation and pre-methodmap signatures.
2026-04-09 21:02:26 -07:00
Ayrton09 a3fb4dfe5e Add %lu & %li as format for int64 (#2421) 2026-04-09 15:58:35 +02:00
ambaca 337b755f34 Added a command to refresh mapchooser map list (#2431) 2026-04-09 15:55:55 +02:00
Benoist d5cc622227 Bump sp module + address fix (#2430) 2026-04-02 21:33:38 +02:00
Nicholas Hastings 0c9a476851 Remove the long-deprecated IsValidHandle from API 2026-03-24 20:49:43 -04:00
Benoist 155cdc318c Re-introduce Address as int64 and remove the opt-in (#2414) 2026-03-15 00:43:25 +01:00
Nicholas Hastings b492426a79 Revert "Make Address a int64 if <virtual_address> is included (#2407)"
This reverts commit 2b5554a21d.
2026-03-12 20:01:31 -04:00
Benoist 2b5554a21d Make Address a int64 if <virtual_address> is included (#2407) 2026-03-12 21:02:12 +01:00
David Anderson 617ee1c98e Update float.inc to work with the latest spcomp. (#2405) 2026-02-27 15:26:59 -08:00
Benoist 8907569dd8 Correct OpenFile filemode check (#2390) 2026-01-21 15:58:24 +01:00
Lukáš Č. 733e33e82a Fix a bug where ban reason is used as ban duration (#2383)
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.
2026-01-01 13:01:24 +01:00
Benoist 6439769d50 Introduce Virtual Address (#2226)
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.
2025-11-13 13:23:13 +01:00
Alienmario 84f67fcd2d Add new options to ArrayList FindString, FindValue (#2216) 2025-11-08 17:03:42 +00:00
A1m` 98831a8667 Add the ability to work with the |this| parameter under dhooks callback (#2219) 2025-11-06 16:33:41 +01:00
Mikusch 351917be35 Add new TF_CUSTOM_* values (#2360) 2025-10-02 10:43:37 +02:00
FlaminSarge 512e7c37c1 Add TFHoliday_Summer (#2350)
Valve has updated this holiday this year to use 2025 dates (2025-07-16 to 2025-09-16) so semi-relevant to add
2025-08-22 13:14:41 +00:00
Nicholas Hastings 64a8c20243 Add missing in-game check in adminmenu 2025-06-01 13:54:41 -04:00
Mart 3b9d03e015 Update adt_stack.inc (#2313) 2025-04-27 18:03:49 -04:00
Nicholas Hastings 4d1e265a5c Fix entity output tests failing with server-only entities (#2276) 2025-04-27 11:20:30 -04:00
Nicholas Hastings ed2bb90ca5 Fix incorrect param order and docs on ArcTangent2 (fixes #2312) 2025-04-27 11:12:57 -04:00