Commit Graph
1426 Commits
Author SHA1 Message Date
Ayrton09 a3fb4dfe5e Add %lu & %li as format for int64 (#2421) 2026-04-09 15:58:35 +02:00
Benoist d5cc622227 Bump sp module + address fix (#2430) 2026-04-02 21:33:38 +02:00
Benoist 59ecab555b Bump SourcePawn submodule (#2428) 2026-03-31 23:28:34 +02:00
bottiger1 a327a80fcd Fix HookConVarChange giving stale convar pointers when a plugin made the convar longer, triggering realloc (#2423) 2026-03-29 20:11:12 +02: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
Benoist a5a8e03d2d Revert "Guard IClient Netchan Path by GamedData (#2397)" (#2404) 2026-02-26 08:02:04 -05:00
Mykola 0d299402b9 Guard IClient Netchan Path by GamedData (#2397)
* Guard IClient Netchan Path by Gamedir

Prevent crash on Source 2007 forks where GetPlayerNetInfo()->GetMsgHandler() is not compatible with IClient.

Only attempt the netchan/IClient path for known-safe game folders; otherwise leave m_pIClient null.

* Update PlayerManager.cpp

* Update PlayerManager.cpp

* Update PlayerManager.cpp

* Update PlayerManager.cpp

* Guard IClient Netchan Path by GameData

* Update common.games.txt

* Update PlayerManager.cpp

* Update common.games.txt
2026-01-31 17:23:54 +00:00
BenoistandFyren 29386a72f6 Another OpenFile fix (#2395)
Co-authored-by: Fyren <[email protected]>
2026-01-26 15:13:20 +01:00
Benoist 8907569dd8 Correct OpenFile filemode check (#2390) 2026-01-21 15:58:24 +01:00
Benoist 22d740ef61 Fix running out of virtual address with the heap on linux (#2391) 2026-01-20 22:39:23 +01:00
Bradasparky 6baf01ac3b Fixed KvDeleteKey and KvGetNameSymbol not working from the root node (#2388) 2026-01-15 19:31:01 -05:00
Benoist c310db4b95 Throw error if using invalid open mode with OpenFile native (#2387) 2026-01-14 02:02:27 +00: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
F1F88 bc8d02c998 Add format specifier "%E" (#2099) (#2330)
* Add format specifier "%E" (#2099)

* style: Remove extra blank lines
2025-11-08 17:09:57 +00:00
caxanga334andNicholas Hastings 1fc841713e Allow the time format used by SM log files to be configured by server ops. (#2372)
* Log Time Format Config

* Remove extra space

* Fix formatting inconsistency

---------

Co-authored-by: Nicholas Hastings <[email protected]>
2025-11-08 17:08:32 +00:00
Alienmario 84f67fcd2d Add new options to ArrayList FindString, FindValue (#2216) 2025-11-08 17:03:42 +00:00
BenoistandNicholas Hastings eb3b4d9822 Build tier1 & mathlib (#2368)
* Build tier1 & mathlib instead of statically linking

* update hl2sdk-manifests

* update hl2sdk-manifests

* update hl2sdk-manifests

* update hl2sdk-manifests

* Update hl2sdk-manifests

* Fix sdkhooks compilation

---------

Co-authored-by: Nicholas Hastings <[email protected]>
2025-11-08 16:47:35 +00:00
F1F88 74e9cdd709 Fixed "%s" always being left justify (#2331) (#2332) 2025-11-08 16:36:01 +00:00
F1F88 2ae0d05a23 Fixed when the int value of "%0[width]d" is negative, the minus sign should be formatted before the padding '0' (#2329) 2025-11-08 16:33:30 +00:00
F1F88 22cc68808c Supports "%f" formatting value as inf float (#2324)
* Fixed when the float value of "%f" is inf, it should be formatted as "Inf" instead of "0.0"

* Replace std::isinf with ke::IsInfinite
2025-11-08 16:32:09 +00:00
Nicholas Hastings 9952f62a33 Fix up GetGameBinArchSubdirectory 2025-11-08 11:26:03 -05:00
Nicholas Hastings f382c3fb5b Fix gamedata gamebin paths for x64, CS:GO-based games (#2370) (#2374) 2025-11-07 15:30:46 +00:00
MalifoxandMalifox ec7aadc431 Fix crash when selecting a vote item that contains a format specifier (#2323)
Co-authored-by: Malifox <[email protected]>
2025-05-30 00:10:51 -07:00
caxanga334 f7e51b6110 Fix NULL Crash on ReferenceToIndex (#2311) 2025-04-25 17:52:44 +00:00
Corey D a35e22c76e Add extension methods for clearing netprop & datamaps cache (#1943) 2025-04-07 15:26:09 +02:00
Nicholas Hastings 30da01763d Fix ClientPrefs pointer string formatting (#2307)
* Fix pointer to string marshaling in ClientPrefs for x64

* Fix other cases where pointers were formatted with %x

* Fix warnings in ClientPrefs IsAuthIdConnected
2025-03-31 21:21:54 +00:00
2382453d50 Manifest updates and compilation fixes for css, tf2, dods, hl2dm (#2268)
* Initial attempt at compiling against tf2_sdk2013

* compilation fix for css

* Switch to AMTL platform arch defines

* Add CBasePlayer forward decl for dods and hl2dm as well

* Update hl2sdk-manifests

* Add dods to CI

* Actually include am-platform.h

---------

Co-authored-by: Kenzzer <[email protected]>
Co-authored-by: Nicholas Hastings <[email protected]>
2025-02-20 00:51:38 +00:00
Nicholas Hastings 6cd5bf87d8 Fix regression in DescribePlayer (%N / %L) for players not yet having entities (#2260)
* Define a constant for ENTREF_MASK

* Fix regression in DescribePlayer for players that don't yet have entities
2025-02-13 23:04:38 +00:00
MalifoxandMalifox 25faf18760 Make finding the sv_lan ConVar a static operation (#2258)
Co-authored-by: Malifox <[email protected]>
2025-02-10 15:47:11 +00:00
F1F88 b5e077c6f7 Fix formatting error when left-aligned and width is less than the number of characters (#2221) (#2255) 2025-02-04 01:37:31 +00:00
Headline 9a03d1227f Attempt reparse on stat failures and return BAD_HANDLE on error (#2253) 2025-01-30 21:10:31 -08:00
Nicholas Hastings 24679be81a fix: Allow entity references for clients with L and N format specifiers (#2244) 2025-01-16 00:57:46 +00:00
peace-maker a8c91db585 Add "EnableLineDebugging" core.cfg option (#2240)
Allow extensions to register a debug break handler in the SourcePawn VM.

Enable line debugging support in the VM before any plugin is loaded through a core.cfg option.
2025-01-07 00:38:55 +01:00
A1m` a44cfe134a Allow sending panels to SourceTV client via settings (#2239)
* Allow sending panels to SourceTV client via settings

* Revert "Allow sending panels to SourceTV client via settings"

This reverts commit 93bb5ebda013e580d59cf9e27d2d6b09c38a0e22.

* Allow menu to be sent to sourcetv client

* Remove IsFakeClient check

Let the plugin decide who to send the menu to
2024-12-30 20:16:25 +00:00
34e9605519 Add IntMap methodmap (#2018)
* 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]>
2024-10-31 23:35:41 +00:00
Nick Hastings 80dfa1cc77 Add Clone to Handle methodmap 2024-10-19 13:20:20 -04:00
Nick Hastings 4cc214e1a6 Revert "Merge branch '👺'"
This reverts commit b7feeef350, reversing
changes made to b18c8cbfd6.
2024-07-27 10:17:57 -04:00
Nick Hastings b7feeef350 Merge branch '👺' 2024-07-27 01:01:49 -04:00
bottiger1 b6d98c762c fix parsing crash (#2173) 2024-06-09 17:13:32 +00:00
BenoistandKenzzer 11d3cf94f7 Add GetFilePermissions (#2177)
Co-authored-by: Kenzzer <[email protected]>
2024-06-08 14:17:50 +00:00
BenoistandKenzzer 7df2f8e045 Reconcile the concept of Edict & Networkable across the codebase (#1903)
* Reconcile the concept of Edict & Networkable across the codebase

* There's no need to check this, it's done elsewhere. Also could be null (segfault)

* This was never needed

* Pseudo review changes

Re-added removed null checks, and added new ones.

Changed the error messages in Get/SetProp natives to better reflect reality.

* Don't change the behaviour of GetEntityNetClass

* Overload IGameHelpers::FindServerClass

* Make error messages more accurate

* Fix a dev comment

* Rename FindServerClass

---------

Co-authored-by: Kenzzer <[email protected]>
2024-06-01 14:07:55 +00:00
BenoistandKenzzer 4e73713fab Fix rare crash with logs (#2161)
* Fix rare crash with logs

* Nullcheck instead

* Update smn_filesystem.cpp

---------

Co-authored-by: Kenzzer <[email protected]>
2024-05-24 13:10:24 +02:00
e07c120cab CDetour safetyhook (#2162)
* Add safetyhook, remove libudis86

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

* Add modified CDetour

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

* Add CDetour [Safetyhook] to build script

* Re-enable loader/core/corelogic, and fix new C++20 error

* Reenable all extensions (except dhooks)

* Make cstrike compile against new CDetour

* Remove unused variable in sdktools output?

* Make sdktools compile against new cdetour

* Downgrade to C++17

* remove auto

* fix compilation on linux

* Re-enable dhooks

* Re-authorise old compilers

* Fix invalid downgrade of std::optional

* readd libudis86 for dhooks only

---------

Co-authored-by: Kenzzer <[email protected]>
Co-authored-by: bottiger1 <[email protected]>
2024-05-21 01:53:44 +00:00
ojlandersandOdin Landers e60c672485 Add OnServerHibernationUpdate forward (closes #1483) (#2151)
* Add OnServerHibernationUpdate forward (closes #1483)

* Clarify hibernation state

* make it 2 forwards instead of 1

---------

Co-authored-by: Odin Landers <[email protected]>
2024-05-07 01:44:56 +00:00
rtldg 908ffdb523 make RenameFile() on Windows also replace the file (#2060)
* make RenameFile() on Windows also replace the file

* Add MOVEFILE_COPY_ALLOWED to MoveFileExA
2024-05-05 22:20:46 +00:00
Adrian-Stefan Mares 343f64f6b7 Fix IsClientSourceTV in L4D2 with a custom tv_name (#2143) 2024-04-29 00:17:10 +01:00
Oliver John HitchcockandKyle Sanderson f9ad35badf Stop EntRefToEntIndex returning garbage if a bad parameter is passed (#1323)
* Stop EntRefToEntIndex returning garbage if a bad parameter is passed

Seen multiple bad usage of this function that works only because whatever was passed in was returned as it wasnt an entity reference.
This code should have worked and would be expected to have returned something invalid but instead the the input was returned which allowed the code to work when really it is bad code.
See for one such case https://discordapp.com/channels/335290997317697536/335290997317697536/736518488314871868

* Update documentation of EntRefToEntIndex

Added the error text saying what shall be returned when a invalid parameter is passed.

* Validate entity index instead of just returning INVALID_EHANDLE_INDEX

Not sure if it needs this much validation but this just mirrors how IsValidEntity works, so the entity index returned should be valid else INVALID_EHANDLE_INDEX is returned.

* EntRefToEntIndex improve doc comments to better represent functionality

---------

Co-authored-by: Kyle Sanderson <[email protected]>
2024-04-25 23:19:04 +00:00
Adrian-Stefan Mares af93d819c6 Handle INVALID_FUNCTION mismatches at plugin boundaries, redux (#2136) 2024-04-19 21:56:48 -04:00