Commit Graph

143 Commits

Author SHA1 Message Date
Vincent Herbet
d23d9b1ba8 Fix missing ReGameDLL check in GetItemPrice() (#423) 2017-03-11 10:49:37 +01:00
Vincent Herbet
55c9143b2b Fix a cs_set_user_model issue with model not being persistent set on a 32th player
Related to some PR fixing cs_set_user_model() crash.
2017-03-10 18:33:19 +01:00
Vincent Herbet
115916d753 Add basic ReHLDS and ReGameDLL support (#417)
* Add ReHLDS API files and its dependencies

Note: This has been stolen from ReAPI AMXX module and modified/adjusted to match AMXX existing includes and to provide as less dependencies as possible as well

* Add the necessary files to get ReHLDS interface

* Split SV_DropClient into pre/post code

* Init ReHLDS API and add SV_DropClient hook

* Add Cvar_DirectSet hook and adjust code with helpers

Note: we don't need to split code here. This is pretty much the naive and straight way, but fairly enough for our case. If it happens we got a lot more hooks, we may consider to use some class to manage better the things.

* Move platform and interface stuff in their own files in public directory

* Make sure to init cvar stuff after ReHLDS

* Add ReGameDLL API files and its dependencies in cstrike module

* Init ReHLDS in cstrike module and adjust code

Note: About cs_uset_set_model(). ReHLDS API doesn't offer a way to know directly the precached models, so instead of looping through all the ressources, the models list is saved one time at map change into a hashmap.

* Init ReGameDLL and adjust code

* Fix linux compilation

* Init ReGameDLL in fakemeta module and adjust code

* Rename /reapi directory to /resdk to avoid confusion

* Retrieve gamerules pointer through InstallGameRules in fakemeta module

* Retrieve gamerules pointer through InstallGameRules in cstrike module

Note: actually gamerules is not used if regamedll is enabled, but it could be used in future natives.

* Fix a typo when ReGameDLL is not enabled

* Fix missing interface check for ReHLDS.

I'm pretty sure I was checking at the very first since I worked first on vanilla version of engine, looks like change has been lost.
2017-03-09 19:59:38 +01:00
Karol Szuster
b7773ba11f Fix sockets crash (#418) 2017-03-04 14:14:08 +01:00
Javivi
6a553122b1 Update sockets module (#301)
* Module rewrite

- WinSock version changed from 1.1 to 2.2.
- Properly check for WinSock initialization on OnAmxxAttach/Detach.
- Now natives will not be added if we can't start up WinSock.
- socket_open() is now IP version agnostic (both IPv4 and IPv6 are
supported).
- Error reporting has been changed on socket_open(), a new parameter
called _libc_errors has been added, and, if enabled, libc errors will be
returned instead of the previous made-up errors.
- socket_close() now returns a value on success/failure.
- Added non-blocking sockets at socket_open_nb().
- Added socket_is_writable() to check if a socket is ready for write.
- Added socket_is_readable() as an alias to socket_change().
- Code rewritten to be more readable, it should be self-explaining now.

* Update docs and fix AMBuild

Updated documentation following the guidelines

* Fixs for the module

- Fixed the backwards compatibility with the return codes
- Merged socket_connect and socket_connect_nb
- Added a 5th parameter to socket_open that takes bit flags to enable
the new features (libc errors & nonblocking sockets)
- Fixed an error on socket_send2 that caused the buffet not to start
from the beginning if multiple calls were made
- Updated docs
- [docs] Prefixed error codes with SOCK_
- [docs] Added the new flags SOCK_NON_BLOCKING and SOCK_LIBC_ERRORS
- [docs] Added a new stock called SOCK_ERROR_EINPROGRESS(error) to be
used when checking if a newly created nonblocking socket is connecting

* Fixes for the docs

Fix some typos, shorten lines, document SOCK_ERROR_EINPROGRESS

* Document magic numbers

No more magic

* Revert "Document magic numbers"

This reverts commit 0f233292063400ea7fdbcd5e5d5cd6e54f8cd71c.

* More docs fixes

* Fix broken socket_send2()

* Add error checking in send2()

* Remove stock

It should not be needed because nb sockets should always be checked or
writability

* Fix some identations

* Fix return codes doc

* Fix socket_recv() regression

strncopy will stop on a null byte, that makes the function unusable to
receive binary data

* More docs typo fixes
2017-03-03 19:56:22 +01:00
Vincent Herbet
b973d24081 Add missing buffer size check to SQLite QuoteString implementation (#411) 2017-02-23 13:56:58 +01:00
Artem Golubikhin
c27bfcd7fe Fix client_death forward called on kill command if sent by a spectator (#404) 2017-02-18 19:53:58 +01:00
Artem Golubikhin
f5e734f636 Fixed is_visible native (#392) 2017-01-17 15:52:49 +01:00
Evandro Coan
e19f80cd3f Fix the modules/mysqlx/AMBuilder not building on Visual Studio 2015 (#397)
* Fix the modules/mysqlx/AMBuilder not building on Visual Studio 2015

Applied the same fix as in:

Fix building of MySQL DBI extension on VS 2015+ by psychonic:
94383d995d

* Removed the msvc15hack.c from the sources when not necessary.
2017-01-06 21:03:22 +01:00
Artem Golubikhin
6473118b24 Fixed entity param changing in hamsandwich (#395) 2017-01-02 09:38:43 +01:00
s1lentq
4c8ef63383 Fix: leak memory from unregister_forward (#388) 2016-10-12 23:26:21 +02:00
Vincent Herbet
e24b9548d4 Update to the latest AMTL (#381)
* Update to latest AMTL.

* Update .gitignore for VS2015
2016-08-12 15:30:06 +02:00
Vincent Herbet
09e49439bc Merge pull request #370 from Arkshine/fix/cs_set_user_model
Fix a crash after cs_set_user_model is used with model_index parameter set.
2016-04-16 11:45:37 +02:00
Vincent Herbet
ffa4e05708 Merge pull request #356 from Arkshine/fix/some-cstrike-natives
Fix issues with some cstrike natives
2016-04-11 11:53:35 +02:00
Arkshine
253dec94d1 Fix a crash after cs_set_user_model is used with model_index set. 2016-04-07 20:27:27 +02:00
Arkshine
d91144a10d Fix typos in entity_intersects() and get_global_edict2() natives 2016-03-31 19:37:12 +02:00
Arkshine
aa2caacf4c Replace INDEXENT and ENTINDEX by TypeConversion for consistency 2016-03-16 21:40:43 +01:00
Arkshine
4c7375555a Fix typo in cs_get_translated_item_alias() 2016-03-16 16:29:56 +01:00
Arkshine
28a0b0626b Fix incomplete sanity check in cs_get_weapon_info() 2016-03-16 16:29:56 +01:00
Arkshine
da2abb9c3b Fix a bcompat issue with cs_s/get_user_backpackammo() by not relying on m_rgpPlayerItems to get ammo index 2016-03-16 16:29:55 +01:00
Vincent Herbet
62a7fe0be5 Merge pull request #342 from Arkshine/feature/cs_get_item_alias
Add cs_get_item_alias(), improve cs_get_item_id() & cleanup alias datas
2016-03-16 15:15:00 +01:00
Arkshine
c3a52b366e Add cs_get_item_alias() native & cleanup alias datas 2016-03-16 12:29:33 +01:00
Arkshine
494444a433 Allow null invoker to be passed in EngFunc_PlayBackEvent 2016-03-02 14:55:23 +01:00
Arkshine
c6024b93ce Fix typo in find_ent_in_sphere 2016-02-24 23:47:17 +01:00
Karol Szuster
cb87fa12e1 Add extra parameters to cs_get_user_weapon native
Add clip & ammo as optional as get_user_weapon native has
2016-02-17 20:46:42 +01:00
Vincent Herbet
1d5fb4b9d1 Merge pull request #346 from Arkshine/featire/entindex-cleanup
Engine: Replace ENTINDEX with TypeConversion
2016-02-11 22:20:08 +01:00
Arkshine
1234528521 Engine: Replace ENTINDEX with TypeConversion 2016-02-11 22:07:01 +01:00
Vincent Herbet
9fb72a896d Merge pull request #334 from Arkshine/move-dropclient-detour
Enable detours in ServerActivate to avoid sig conflict with third-party AMXX modules
2016-02-10 19:06:19 +01:00
Vincent Herbet
9d68a5f4cc Merge pull request #332 from Arkshine/feature/cs_set_ent_class
Add cs_set_ent_class native
2016-02-09 11:34:40 +01:00
Arkshine
2928c622f9 Add cs_set_ent_class native 2016-02-09 11:27:02 +01:00
Arkshine
86d34e9bc5 Engine: Fix more bcompat for CHECK_ENTITY 2016-02-03 13:34:03 +01:00
WPMGPRoSToTeMa
3c74e72242 Fakemeta: fixed bug with recursive pre hooks (one returned supercede can supercede several hooks) 2016-01-26 01:34:45 +03:00
Vincent Herbet
0462ca02c8 Merge pull request #340 from Arkshine/fix/cstrike-lower-command
Fix CS_OnBuy* not triggered from alias containing uppercase letters
2016-01-25 01:03:41 +01:00
Arkshine
fafa1f11f0 Fix CS_OnBuy* not triggered from alias containing uppercase letters 2016-01-23 00:09:04 +01:00
Arkshine
98fb03dd30 Enable detours in ServerActivate to avoid sig conflict with third-party AMXX modules 2016-01-11 23:25:02 +01:00
WPMGPRoSToTeMa
b85b37192e New natives: cs_get_user_weapon_entity and cs_get_user_weapon 2016-01-06 23:10:31 +03:00
WPMGPRoSToTeMa
48d7a04c73 SELinux compatibility: memalign -> mmap 2016-01-03 21:38:31 +03:00
WPMGPRoSToTeMa
5c8c925e8a Hamsandwich: fix HAM_OVERRIDE in post hooks (bug 6443) 2015-12-09 21:38:08 +03:00
Arkshine
5b0191f691 Make sure client is alive before checking buying commands 2015-12-07 19:20:48 +01:00
Vincent Herbet
2971bb65fd Merge pull request #309 from Arkshine/refactor-gamerules-retrieval
Refactor gamerules address retrieval
2015-11-23 00:58:37 +01:00
Arkshine
42a09f8593 Fix missing meta return in ServerActivate 2015-11-23 00:35:44 +01:00
Arkshine
87b1833f73 Refactor gamerules address retrieval 2015-11-23 00:29:43 +01:00
Arkshine
a445e806ea Cstrike: Refactor - Simplify forwards logic, fix and improve few things
- The logic around CS_OnBuy forward has been simplified. Since there is no way to have a consistent way to hook/block for all items, the new logic is to have as less as possible code, especially in blocking mode where we want to avoid to do extra stuffs (e.g blocking sound, event, etc).

  * All guns + shield -> CanBuyThis()
  * Nvgs and Fefuser only -> CanPlayerBuy()
  * The others items -> GiveNamedItem() + AddAccount()
  * Ammos -> -> BuyGunAmmo() + GiveNamedItem() + AddAccount()

- Fixed missing buyzone check when alias from console are used (CS_OnBUy* were incorrectly fired).
- Fixed an infinite loop when buying of ammos are blocked. Sorted by hooking BuyGunAmmo().
- Fixed blocking mode for some items. Some game behaviors were not blocked (e.g. weapon drop).
- Fixed forwards being triggered even though errors were found. Detours are now a destroyed and associated variables resetted when necessary. Toggling forwards state is now based on detours state.
- Moved things in its own functions (game functions to execute, class members retrieval)
- Renamed CommandAliases -> ItemInfos (more generic)
2015-11-21 00:13:06 +01:00
Arkshine
d08e1357dd Cstrike: Fix defuser/nvgs not being called with CS_OnBuy and fix wrong shield CSI constants 2015-11-03 10:45:51 +01:00
Arkshine
eb0222455a Cstrike: Fix spaces/tabulations/typo 2015-11-03 10:45:51 +01:00
Arkshine
b6910667a8 Cstrike: Remove parsing error and update native error message 2015-11-03 10:45:50 +01:00
Arkshine
e87976bc09 Cstrike: Remove CS_OnGetItemPrice forward (reverted from commit 33a7d74b6da2ca4dcb621e9b306c386ba040571e)
This is actually not possible to have a proper system to allow this.
This is two majors problems:
  - The item price text can't be changed, whatever old and VGUI menu (it's either harcoded in config file or in client binary)
  - Once you open VGUI menu, to know if user has enough money to select an item, client relies on the current HUD money value, this means, since we can't directly changed price, before opening the menu, money needs to be somehow faked and restored once closed. It's awful.

Overall it can't work properly, and at the end current forward doesn't make sense.

If an author wanted to have its own prices, the only only way would to force players to use old menu, then overwriting the whole buy menu, so you would be able to display what you want exactly.
2015-11-03 10:45:50 +01:00
Arkshine
2c5cc4289e Cstrike: Add cs_is_valid_itemid() stock 2015-11-03 10:45:49 +01:00
Arkshine
75853dae60 Cstrike: Add cs_find_ent_by_owner() native 2015-11-03 10:45:48 +01:00
Arkshine
23b0450938 Cstrike: Add cs_get_weapon_class() stock (weapon id -> class id)
Note: this has been modified a bit later in cs_is_valid_itemid() commit.
2015-11-03 10:45:47 +01:00