Commit Graph

917 Commits

Author SHA1 Message Date
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
hydrogen-mvm
a20eb08dc6
Fix replay workaround not triggering (#2033) 2023-07-29 20:53:17 +00:00
bottiger1
5f827089d3
Fix mismatched memory release in regex clearmatch (#2005)
subject is created with strdup which should be freed with C free and not C++ delete
2023-06-12 22:34:57 +02:00
Vauff
2e1235a585
A2S_Rules fix: Move MTU patch value to gamedata (#1829)
* A2S_Rules fix: Move MTU patch value to gamedata and increase it

* Revert MTU value back to 5k
2023-04-19 15:28:40 +00:00
Forgetest
8e0039aaec
[DHooks] Fix NaN return when superceding pre-detour (#1967)
* Update hook.cpp

* Update hook.cpp
2023-03-31 18:19:04 +02:00
Michael
a28c3cac9b
cstrike.csgo: Add native to retrieve loadout slot of weapon (#1241)
* Add native to retrieve loadout slot of weapon

* Mention the native is for CS:GO only

---------

Co-authored-by: Peace-Maker <peace-maker@wcfan.de>
2023-03-29 21:27:45 -07:00
Corey D
c5087d7a39
database: flip to recursive_mutex to allow nested locks (#1937)
* Fix crash from db locking

* Change db lock to use recursive_mutex
2023-03-29 20:03:03 -07:00
sappho
178658912e
fix mismatched delete [] in regex extension (#1941)
* fix mismatched delete []

* strdup needs to be free'd, not deleted
2023-03-27 15:50:31 +02:00
Nicholas Hastings
6bd49ff415
Protect against server crash when DHooks cannot load from SDKHooks not being loaded. (#1930) 2023-02-09 00:10:14 +00:00
Nicholas Hastings
cd6886319c
Fix crash with IgniteEntity on MCV (#1924)
* Fix crash with IgniteEntity on MCV.

* Formatting.
2023-02-04 16:09:46 +00:00
rtldg
d57d7e7401
Enable math functions in sqlite (#1886) 2023-01-29 17:30:15 +00:00
Nick Hastings
d5a26adc49 Regression fix for CS:GO GivePlayerItem.
Regressed in https://github.com/alliedmodders/sourcemod/pull/1887
2023-01-20 10:09:22 -05:00
Nicholas Hastings
8922ed0c5d
Add TE_WriteEnt and TE_ReadEnt natives to SDKTools. (#1905) 2023-01-14 14:48:05 +00:00
Rain
51bba0b894
Fix incorrect behaviour in SDKHooks_DropWeapon's "bypassHooks" parameter (#1877) 2022-12-27 19:31:02 +00:00
Nicholas Hastings
775d4f04f2
Add missing set of CBaseEntity::Teleport param on newer games (#1894)
* Add setting of missing CBaseEntity::Teleport param on newer games

* Rearrange SOURCE_ENGINE defines of games between Portal 2 and CS:GO.
2022-12-27 19:29:22 +00:00
peace-maker
4320d7b17a
Get sdktools and sdkhooks/dhooks to load on hl2sdk-mock (#1892)
* Build SDKTools for hl2sdk-mock

* Fix loading of extensions using advanced naming scheme for hl2sdk-mock

* Fix error on missing sv_visiblemaxplayers convar

* Build SDKHooks for hl2sdk-mock

* Fix x86_64 SourcePawn VM filename

* SDKHooks: Ignore missing IEntityListeners list in hl2sdk-mock
2022-12-22 18:39:12 +01:00
TrueProfesional
174bf307a2
Add weapon_bayonet to the list of blocked knives (#1758) 2022-12-20 22:17:22 +00:00
Nicholas Hastings
b77e8c50ac
Add support for Military Conflict: Vietnam (#1887) 2022-12-20 21:46:18 +00:00
peace-maker
aab8c6ac9f
Fix SDKHook_[Use|Spawn|GetMaxHealth] callback result value handling (#1872)
* Fix SDKHook_Use callback result handling

The returned result of the last callback in the list was used instead
of the highest value. This differs from the behavior of the other hooks.

* Fix SDKHook_Spawn callback result handling

The returned result of the last callback in the list was used instead
of the highest value. This differs from the behavior of the other hooks.

* Fix SDKHook_GetMaxHealth callback result handling

The returned result of the last callback in the list was used instead
of the highest value. This differs from the behavior of the other hooks.
The returned health is only changed if no other plugin wants to block the callback.
2022-12-04 12:12:42 +01:00
vanz666
8538233985
Expose custom sdktools trace types from hl2sdk (#1822)
* Update trnatives.cpp

* Update sdktools_trace.inc

* Update trnatives.cpp
2022-12-02 14:11:05 +01:00
Maxim Telezhenko
764e38a58f
Fix DHooks jit code stack memory alignment (#1849) 2022-10-26 20:41:40 +02:00
Spirrwell
e34e9b9869
Split PVKII into its own engine branch (#1847)
* Initial PVKII branch support

* Change PVKII code to 23, DOTA uses 22 in MM

* Bunch more SE_PVKII preprocessor that was missed

* Add some missing SOURCE_ENGINE_PVKII cases

* Update PVKII FireOutput signature for Linux

* Update checkout-deps with 'pvkii'

* Fix FireOutput signature for PVKII, accidentally used one from newer build

* Change PVKII code to 10, and bump others by 1

* Only check against SE_SDK2013 here, like Metamod

* More SE_PVKII preprocessor cleanup
2022-10-24 19:27:32 +00:00
Accelerator
e5ebd65176
Exposed SDKCall_Engine call type to use CVEngineServer methods (#1648)
* Update vdecoder.h

* Update vcaller.cpp

* Update sdktools.inc
2022-07-26 22:14:49 +02:00
42
625c7a98f2
Fix support for SDKCall returning non-networked entity (#1797) 2022-07-08 14:33:43 +00:00
Mikusch
278998f7d0
SDKTools: Add explode parameter to ForcePlayerSuicide native (#1782)
* Expose CommitSuicide params

* A single space

* Validate param count

* Set force param to true by default
2022-07-07 14:14:50 +02:00
peace-maker
5e3a189642
Log a notice if the geoip database gets too old (#1791)
Since we ship an ancient version of the database, help server operators keep track of the database version.
2022-06-30 08:22:51 +02:00
peace-maker
7b89f5fab3
Update SQLite library to 3.38.5 (#1792)
Bring in the changes of the last four years of SQLite development.

Fixes #1728
Fixes #1592
2022-06-30 08:22:28 +02:00
peace-maker
9121472061 DHooks: Error on argument passflags for detours (#1773)
The passflags are only supported by SourceHook for virtual hooks and are ignored for detours with DynamicDetours. This caused confusion, so throw an error when trying to set e.g. the DHookPass_ByRef flag on detour arguments.
2022-06-24 10:00:02 -04:00
peace-maker
54fd778830 DHooks: Fix changing of byref vector parameters (#1772)
We always created a new vector object instead of changing the passed in vector directly. This works for the function being called using our changed values - but the caller doesn't see the changed values if it's passing a vector by reference.

Only create a new vector if there isn't one being passed in and set the values directly in the passed in vector otherwise.
2022-06-24 10:00:01 -04:00
domino_
b057580a62
Add a OnPlayerRunCmdPre forward (#1760)
Adds an OnPlayerRunCmdPre forward in order for plugins to be able to hook OnPlayerRunCmd with the guarantee that none of the parameters have been modified by other plugins. As such, OnPlayerRunCmdPre's parameters cannot be modified and are read-only. 

Plugins that wish to use OnPlayerRunCmdPre can maintain backwards compatibility with SourceMod 1.10 by falling back to OnPlayerRunCmd if the Pre variant was never fired.
2022-04-25 14:00:53 -07:00
Mikusch
a1ad9e1acf
Fix TF2_OnIsHolidayActive forward not getting called after map change (#1752)
* Fix TF2_IsHolidayActive forward not getting called after map change

* Rename function to Unhook
2022-04-22 11:49:46 +02:00
Mikusch
a877a4475b
SDKTools: Clear gamerules pointer on level shutdown (#1755)
* Clear gamerules pointer on level shutdown

* Move LevelShutdown up
2022-04-22 11:48:21 +02:00
peace-maker
39d604ae6c
DHooks: Allow setting CBaseEntity* param to NULL #1751 (#1754)
* DHooks: Allow setting CBaseEntity* param to NULL #1751

The param had to be a valid entity and wasn't allowed to be set to NULL. Behave similar to SetReturn which maps INVALID_ENT_REFERENCE (or -1) to NULL.

* Update include documentation
2022-04-20 15:32:37 +02:00
XeroX
6b588fff61
ZPS: Add missing offsets (#1719)
* Update offsets for ZPS 3.2

Zombie Panic! Source Version 3.2 released and these are the updated offsets.

* Update offsets for 3.2

ZPS 3.2 has been release and these are the updated offsets / signatures.

* ZPS: Add missing offsets.

Adds support for OnTakeDamage_Alive, GetMaxHealth, Blocked, Reload and GroundEntChanged.
I wasn't aware these were missing entirely or I would have pushed them with the previous PR.

* ZPS Add missing offsets.

Adds support for GivePlayerAmmo.
Wasn't aware these were missing the first place.

* Fix ForcePlayerSuicide not properly working in ZPS

ZPS requires the second bool parameter to be true otherwise it won't do anything for players in the lobby or delayed for players on either team 2 or team 3.

* Fixed breaking code for other mods.

Added bForce which is set to true for zps.
2022-04-16 14:07:16 +00:00
David Anderson
01203a5a44 Update SourcePawn. 2022-03-09 18:00:54 -08:00
Asher Baker
95ab60c4eb
Stop SQLite results being used before being fetched (#1709)
The DB API requires FetchRow to be called before accessing any values
from a row, but the SQLite driver did not enforce that requirement and
alowed accessing the first row immediately. A plugin developer hit this
when developing against SQLite locally but using MySQL in production,
where the API misuse threw an error as expected.

Resolves #1691
2022-02-06 16:34:14 +00:00
komashchenko
f5f26e2dfe
Fix GetGameSoundParams in CSGO (#1631)
* Fix GetGameSoundParams CSGO

* Added preprocessor comments

* Revert InternalPrecacheScriptSound
2022-02-01 17:14:53 +01:00
Mikusch
afc9310704
Add LookupEntityAttachment & GetEntityAttachment natives (#1653)
Using the virtual `CBaseAnimating::GetAttachment(int, matrix3x4_t &)` was a deliberate choice because virtual offsets are generally easier to maintain than signatures. The `matrix3x4_t` is converted to world position and world angles internally.
Some of the other overloads are also inlined on a few games, making this the best choice.

Since this call can only be used on classes inheriting `CBaseAnimating`, we check if the `DT_BaseAnimating` SendTable exists on the entity, throwing a native error if it doesn't.
This safeguard could be greatly improved with a call to `CBaseEntity::GetBaseAnimating`, but would require more gamedata (maybe something to consider for the future?)
2022-01-03 13:13:54 +00:00
naydef
7d6eb2bd81
Fix crash in non-bypass-hooks DropWeapon implementation (#1672)
Fixes #1670
2021-12-15 10:41:55 +00:00
Nick Hastings
93cd78a6c5 Remove dead code. 2021-12-13 10:00:42 -05:00
Nick Hastings
b62f332611 Use SteamWorks C++ API in CStrike RulesFix, for better interface compatibility. 2021-12-13 09:34:00 -05:00
Benoist
329d587214
Fix ShouldCollide originalResult behaviour (#1657) 2021-11-30 09:24:56 +00:00
Benoist
b38c9824fe
sdktools: Add EntityCollisionRulesChanged & SetEntityOwner natives (#1620)
* Add EntityCollisionRulesChanged & SetEntityOwner natives

* fix win build, and unpushed changes

* Fixed bad world loop

* Requested changes + csgo offsets

* small copy paste mistake

* Strip the debug log lines

* Tiny clean up in comments

* line

* <dvander> try again

* sdktools: add default Param for owner.

Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com>
Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>
2021-11-21 23:03:35 -08:00
Peace-Maker
896e92264f Use SourceMod's version number 2021-11-17 13:17:39 +01:00
Peace-Maker
8f7ecf66a4 Use JMP patching of CDetour 2021-11-17 13:17:39 +01:00
Peace-Maker
581068c09b Add copyright headers 2021-11-17 13:17:39 +01:00
Peace-Maker
0f5f1a814e Import DHooks + Dynamic Detouring
This is the latest DHooks version from 1314f2d1b4
2021-11-17 13:17:39 +01:00
Nick Hastings
38a069b97a Throw error if unknown SDK call type specified. 2021-10-26 17:32:25 -04:00
Nick Hastings
4b58b9f673 Reorder SDKCallType enum for better compatibility with existing plugins. 2021-10-26 17:32:02 -04:00