Commit Graph

893 Commits

Author SHA1 Message Date
BotoX
964c9ae835 Fix @spec not targeting clients in unassigned team. 2023-08-30 22:08:46 +02:00
Maxim Telezhenko
08841227a4 Fix DHooks jit code stack memory alignment (#1849) 2023-08-30 22:08:45 +02:00
42
cf39d4b820 Fix support for SDKCall returning non-networked entity (#1797)
(cherry picked from commit 625c7a98f2)
2023-08-30 22:08:45 +02:00
peace-maker
cb218a4911 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.
2023-08-30 22:08:45 +02:00
peace-maker
344284196c Update SQLite library to 3.38.5 (#1792)
Bring in the changes of the last four years of SQLite development.

Fixes #1728
Fixes #1592
2023-08-30 22:08:45 +02:00
peace-maker
250bbf5955 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.
2023-08-30 22:08:45 +02:00
peace-maker
0478912d73 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.
2023-08-30 22:08:45 +02:00
domino_
5292721f0b 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.
2023-08-30 22:08:45 +02:00
Mikusch
4e0c47a1d5 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
2023-08-30 22:08:45 +02:00
Mikusch
65b6602a19 SDKTools: Clear gamerules pointer on level shutdown (#1755)
* Clear gamerules pointer on level shutdown

* Move LevelShutdown up
2023-08-30 22:08:45 +02:00
peace-maker
b25d25890a 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
2023-08-30 22:08:45 +02:00
XeroX
b5ed266941 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.
2023-08-30 22:08:45 +02:00
David Anderson
edc73649ff Update SourcePawn. 2023-08-30 22:08:45 +02:00
Asher Baker
19f1ffa401 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
2023-08-30 22:08:45 +02:00
komashchenko
370fa8209b Fix GetGameSoundParams in CSGO (#1631)
* Fix GetGameSoundParams CSGO

* Added preprocessor comments

* Revert InternalPrecacheScriptSound
2023-08-30 22:08:45 +02:00
Mikusch
542b7673d6 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?)
2023-08-30 22:08:45 +02:00
naydef
4fc0a85581 Fix crash in non-bypass-hooks DropWeapon implementation (#1672)
Fixes #1670
2023-08-30 22:08:45 +02:00
Nick Hastings
cdfbdcc29d Remove dead code. 2023-08-30 22:08:45 +02:00
Nick Hastings
4f94b4f900 Use SteamWorks C++ API in CStrike RulesFix, for better interface compatibility. 2023-08-30 22:08:45 +02:00
Benoist
a57573864a Fix ShouldCollide originalResult behaviour (#1657) 2023-08-30 22:08:45 +02:00
Benoist
8c001872a8 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>
2023-08-30 22:08:45 +02:00
Peace-Maker
c72736dcfa Use SourceMod's version number 2023-08-30 22:08:45 +02:00
Peace-Maker
e280d33a28 Use JMP patching of CDetour 2023-08-30 22:08:45 +02:00
Peace-Maker
fb1d501c24 Add copyright headers 2023-08-30 22:08:45 +02:00
Peace-Maker
3c0f700a6b Import DHooks + Dynamic Detouring
This is the latest DHooks version from 1314f2d1b4
2023-08-30 22:08:45 +02:00
Nick Hastings
52b8e95aae Throw error if unknown SDK call type specified. 2023-08-30 22:08:45 +02:00
Nick Hastings
bb6e6fd3b6 Reorder SDKCallType enum for better compatibility with existing plugins. 2023-08-30 22:08:45 +02:00
dragokas
0449342bb0 Exposed SDKCall_Server call type to use CBaseServer methods 2023-08-30 22:08:45 +02:00
Nick Hastings
1559b75ae7 Don't cache replay_enable value when evaling whether to use FileExists hook.
Speculative fix for #1581
2023-08-30 22:08:45 +02:00
Nick Hastings
6250db7dba Add missing parameters for CSWeaponDrop. 2023-08-30 22:08:45 +02:00
GAMMACASE
8ae3be7185 Fix CS_OnCSWeaponDrop after latest CSGO update (21/10/21) (#1602) 2023-08-30 22:08:45 +02:00
Nick Hastings
55382e0a0f Add option to not bypass hooks with TakeDamage and DropWeapon natives. 2023-08-30 22:08:45 +02:00
Nick Hastings
d8b00675d6 Remove obsolete core-legacy checks. 2023-08-30 22:08:45 +02:00
Nick Hastings
d4545a105e Fix incorrect param types in CS:GO GNI (otherwise broken for x64). 2023-08-30 22:08:45 +02:00
Nick Hastings
1c788b5c0a Remove manual ptr math in vnatives for params not mapped to cell params. 2023-08-30 22:08:45 +02:00
Nick Hastings
7ce8a80bf6 Fix Blade Symphony GiveNamedItem call on x64. 2023-08-30 22:08:45 +02:00
Nick Hastings
d0c4657b75 Add ValveType_Object type.
This is for the few cases where we have function parameters to objects that
don't fit our other predefined types (CBaseEntity, CBasePlayer, string).

Most calls currently pass those as POD (which is incorrect, but works on
x86), or one of the other pointer types (which is also incorrect, and can
lead to confusion, but works on x86 and x86-64).

This type only works when manually buffering the parameter for calls, and
is not supported for return types.
2023-08-30 22:08:45 +02:00
Nick Hastings
b909ea07ec Update multiple SDKTools calls to be x64-safe [sizeof(void*) != sizeof(int)] 2023-08-30 22:08:45 +02:00
Nick Hastings
f18c6fb9af Fix crash with IBinTools calls on x64 for functions with void return. 2023-08-30 22:08:45 +02:00
Nick Hastings
c66175d64e Use new GetIServer call and updated IServerTools calls on Blade Symphony. 2023-08-30 22:08:45 +02:00
Nick Hastings
a3fbbe41f2 Enable more CS:GO engine logic for Blade Symphony. 2023-08-30 22:08:45 +02:00
Nick Hastings
4b01feea45 Fix CS:GO transposing of GiveNamedItem last param and return. 2023-08-30 22:08:45 +02:00
A1m`
507b09c975 Fix 'GiveNamedItem' in the game left4dead2. (#1590)
* Fix 'GiveNamedItem' in the game left4dead2.

The method 'CCSPlayer::GiveNamedItem(char const*, int, CBaseEntity*)' does not work in game left4dead2, any given weapon and object immediately falls to the ground, besides, the code is missing a parameter to call this method (even with the added parameter does not give a weapon to hands). Another method 'CTerrorPlayer::GiveNamedItem(char const*, int, bool, CBaseEntity*)' works great, besides it makes it possible to give out all the items that exist in the game.

* Add x64 support

Add x64 support

* Changed argument type to bool.

Changed argument type to bool.
2023-08-30 22:08:44 +02:00
nosoop
61c634a870 TF2Tools: Prevent CalcIsAttackCriticalHelper* from being called twice (#1573)
* Ensure CalcIsAttackCriticalHelper only gets called once

* fixup: move origReturnValue up
2023-08-30 22:08:44 +02:00
David Anderson
74ad70ba30 Add support for hl2sdk-mock. 2023-08-30 22:08:44 +02:00
Asher Baker
5ea096e61e
Support reading legacy sendprop arrays (#1550)
This rounds out the work started in #1548 to complete support for
reading the older SendPropArray type array netprops, along with bringing
SDKTools' GameRule netprop code in sync with core to add string array
support.

There aren't many SendPropArray type props around but this opens up a
few interesting opportunities for plugin developers, particularly in
L4D2 with manipulation of the EMS HUD.

Tested reading the `m_vCPPositions` array in TF2, and reading/writing
the `m_szScriptedHUDStringSet` EMS HUD netprop in L4D2. Closes #1386.
2021-08-23 21:21:11 +01:00
Asher Baker
3c79701208
Catch exceptions from TraceRay filters/enumerators (#1557)
When a custom TraceRay filter / EnumerateEntities enumerator callback
throws an exception we currently continue execution and then return
execution to the calling code as if there were no problems. This
currently causes a heap tracking issue in SourcePawn, but even ignoring
that it is likely the wrong behaviour and differs from our other
synchronous callbacks.

This change causes the exception to be caught, immediately terminates
the trace / enumeration, and propagates the exception state back to the
calling plugin correctly. The implementation here is based on how
SortCustom1D handles exceptions.
2021-08-02 11:57:36 +01:00
Vladimir
f708842e09
Fix conflict with extensions using SteamWorks (#1531)
We were accidentally changing a process-wide global variable when trying to fetch a working ISteamGameServer interface.

Co-Authored-By: komashchenko <komashchenko@users.noreply.github.com>
2021-07-18 00:01:24 +01:00
Asher Baker
70c9a6528a Remove entity lump manipulation from OnLevelInit
Newer Source engine versions now use a dynamically allocated buffer for
the map entity lump, and some maps have over 16MB of entity data - far
larger than our 2MB limit.

There is no sane way we can currently handle this, so just remove the
functionality from the forward until a more comprehensive API can be
designed.

Fixes #1470
2021-07-17 20:52:51 +01:00
Vladimir
54364d213d
Fix output hooks when caller/activator are flipped (#1411)
Co-authored-by: Asher Baker <asherkin@limetech.io>
2021-07-17 15:30:09 +01:00