Commit Graph

1368 Commits

Author SHA1 Message Date
Vincent Herbet
feba821306 Fix a typo in equali, strcmp and strncmp natives (#459) 2017-09-12 21:00:26 +02:00
Vincent Herbet
ba58cb045f Adjust 'amxx cvars' command output (#453) 2017-08-07 23:42:41 +02:00
Vincent Herbet
ab854ec035 Improve UTF-8 support in some natives (bug 6475) (#407)
* Compile as static library, update AMBuildScript and link to core

* Update VS project files to include the library

* Add UTF-8 Rewind library (v1.5.1) to third_party directory

* Update ACKNOWLEDGEMENTS.txt

* Move AMXX buffer in its own function

* Move constants from string.inc to string_const.inc and update project files

* Move stocks from string.inc to string_stocks.inc and update project files

* Improve UTF-8 support in containi() and update documentation

* Improve UTF-8 support in strcmp() and update documentation

* Improve UTF-8 support in strfind() and update documentation

Worth to be noted that this native with ignorecase set was not working properly. So broken that no one reported the issue.
This adds also a safety check for "pos" parameter to not go < 0.

* Improve UTF-8 support in strncmp() and update documentation

* Improve UTF-8 support in equali() and update documentation

* Add an option to some UTF-8 Rewind functions for avoiding invalid data to be replaced

By default it replaces any invalid byte or sequence of bytes by 0xFFFD (3 bytes). It can be problematic when the input buffer is not changed (from a plugin) and that some natives need to calculate a position from the converted string. With such replacement, the position is displaced due the final string length being larger.

This compiles the library as C++, because I added some silly param with a default default value which is not supported by C.

* Improve UTF-8 support in replace_string/ex() and update documentation

* Add is_string_category() and update documentation

* Update a little testsuite plugin (and fix linux compilation)

* Add mb_strotolower/upper() and update documentation

* Add mb_ucfirst() and update documentation

* Add mb_strtotile() and update documentation

* Improve UTF-8 support in get_players() and find_player() with name/case insenstive flags set

* Fix KliPPy's complain
2017-08-05 10:32:16 +02:00
PartialCloning
24e56d0476 Add elog_message native (#451)
* elog_message

Like "log_message". Logs a message to the current server log file, however the messages sent are also sent to all plugins and can be hooked using "register_logevent".

* Update amxmodx.cpp

* Update Editor.sci

* Update UnitfrmMain.dfm
2017-08-01 15:14:53 +02:00
Vincent Herbet
1dc1f1b9c4 Introduce Trie Iterators (#413)
* TrieIter: Add possibility to obtain a new'd HashTable iterator

* TrieIter: Add CellTrieIter and storage

* TrieIter: Implement TrieIterCreate

* TrieIter: Implement TrieIterEnded

* TrieIter: Implement TrieIterMore

* TrieIter: Implement TrieIterGetKey

* TrieIter: Implement TrieIterGetSize

* TrieIter: Implement TrieIterGetCell

* TrieIter: Implement TrieIterGetString

* TrieIter: Implement TrieIterGetArray

* TrieIter: Implement TrieIterDestroy

* TrieIter: Invalidate any mutating change that is key addition or key removal

* TrieIter: Clean up the handles at map change

* TrieITer; Add iter tests to trietest.sma

* TrieIter: Fix linux compilation

* TrieIter: Rename TrieIterMore to TrieIterNext

* TrieIter: Adjust documentation

* TrieITer; Adjust trietest.sma

* TrieIter: Create a custom StringHashMap class instead

+ used a copy of |iterator| instead of dynamic allocation
+ initialized vars directly in constructor
+ added a nested iteration test
2017-08-01 15:05:27 +02:00
Vincent Herbet
6bd2f1feec Fix a engclient_cmd and amxclient_cmd buffer issue (#438) 2017-07-21 23:44:05 +02:00
Artem Golubikhin
aa9ec3f872 Fix client_disconnected isn't called on mapchange when ReHLDS API enabled (#446) 2017-07-03 21:52:38 +02:00
In-line
f7f86fb040 Rename suki to key_index (#445) 2017-06-28 18:31:59 +02:00
IgnacioFDM
66cc8dcdaf Minor flagman cleanups (#442)
* Document disableflagman

* Add disabled check, random cleanups
2017-05-28 22:39:44 +02:00
In-line
df4e4949c8 Fix #427, AMTL Code porting (#436)
* Fix crash in CTaskMngr::startFrame()

* Fix crash in EventsMngr::executeEvents()

* Fix loops

* Fix loop iterators signess
2017-05-11 09:35:38 +02:00
In-line
e9f501c250 Allow value be empty in lang files (#431)
* Allow value be empty in lang files

* Refactor solution.
2017-04-29 20:55:34 +02:00
Karol Szuster
123246cc84 Port code to AMTL (#427)
* Remove CQueue

* Remove duplicated files

* Move sh_tinyhash to public/

* Remove sm_queue

Make NVault use of ke::Deque

* Remove sh_string (unused)

* Remove CList dependency from CTask

* Remove CList dependency from CEvent

* Remove CList dependency from modules' functions

* Remove CList dependency ForceObject

* Remove CList dependency Player Auth

* Remove left CList dependencies

* Fix msvc project files

* Update AMTL

* Use InlineList for CScript

* Use InlineList for CModule

* Use Vector for Player Auth
2017-04-14 19:36:59 +02:00
IgnacioFDM
2d049b7ff3 Fix signed/unsigned mismatch warning (#428)
* Fix signed/unsigned mismatch warning

* Fix GCC type warnings
2017-04-04 10:32:04 +02:00
KliPPy
2863455185 Add menu pagination callback (#420)
* Add menu pagination callback

* Update test plugin
2017-04-04 10:29:18 +02:00
Karol Szuster
9551c70c59 Rework build pathname functions (#422)
* Rework build_pathname* functions

* Replace old platform defines with the new ones

* Correct usage of build_pathname_r()

* Fix inconsistencies (white spaces)

* Remove useless defines
2017-03-11 19:26:25 +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
Vincent Herbet
7a7d0442aa Fix VS project file (#416) 2017-02-26 21:15:53 +01:00
Vincent Herbet
3568fb8747 Add client_remove() forward and fix a bug with client not internally disconnected (#414)
* Rename client_disconnected to client_disconnecting

* Add client_disconnected as post forward

* Fix client not properly disconnected internally

Introduced in #264.
Edict is reset once SV_DropClient is called, so that second check would be always false.

* Reflect changes on the concerned plugins

* Revert renaming, let's add only client_remove as post forward
2017-02-25 11:50:52 +01:00
Vincent Herbet
074af44ead Fix a potential crash in ArrayClone for too large arrays (#408) 2017-02-23 13:27:16 +01:00
KliPPy
828e74e6c3 Add RequestFrame() native (#412)
* Add RequestFrame() native

* Change underlying container from CQueue to ke::Deque

* CFrameAction: Fix PackageScript and MSVC project, wrap CFrameAction in AutoPtr
2017-02-23 12:55:53 +01:00
Vincent Herbet
38b8dc338d Fix missing backward compatibility check in TrieGetString() and TrieGetArray() (#406) 2017-02-05 11:52:04 +01:00
souvikdas95
a7c3e34fbe Fix Warning from MSVC: 'Double to Float precision loss' (#402) 2017-01-21 20:58:33 +01:00
souvikdas95
a30172f8a6 Fix UTF-8 character parsing due to improper casting (#401)
Upcasting of -ve signed characters (char) to signed integers (cell) results in -ve signed integers which don't represent valid printable characters.
eg. UTF-8 Character '中' (0xE4 0xB8 0xAD) when casted results in 0xFFFFFFE4 0xFFFFFFB8 0xFFFFFFAD which are not valid printable characters.
2017-01-17 15:50:00 +01:00
Karol Szuster
79d9fc530d Update AMTL (#390) 2016-12-31 23:49:46 +01:00
Karol Szuster
e3ae451c09 Add missing format param (#391) 2016-11-25 11:26:58 +01:00
IgnacioFDM
732a05dde0 Back out changes in #366 and introduce read_argv_int/float()
* Revert "Extend "read_argv" native"

This reverts commit aaa2934595.

This broke binary compatibility with either older, already compiled
plugins, or newly compiled plugins if you forgot to update .inc headers.

This happened because read_argv used to receive maxlen by value, and
after
this commit it receives it by reference. This causes read_argv either
to fail, or worse, to buffer overflow, resulting in a security vulnerability.

Newly introduced functionality for read_argv should be added with a new,
separate native.

* Add "read_argv_int" & "read_argv_float" natives
2016-08-31 20:34:02 +02:00
Alexander Petrov
a9557fe53d Use exponentiation by squaring instead of n-times multiplications in power() (#385) 2016-08-27 10:12:02 +02:00
IgnacioFDM
b9997eb628 Fix a floatround bug (#376)
* Fix floatround overflow

floatround would overflow for floats greater than 2^30 because internally
it would double the number (therefore anything greater than 2^30 results
in something greater than 2^31 which would cause overflow of course)

floatround behaviour is left exactly identical otherwise (although I find
it very weird and wrong to deliberately avoid banker's rounding, it would
be a bad idea to change this behaviour due to compatibility)

Remember to reassemble amxexecn and amxjitsn

* Update the compiled object files
2016-06-27 12:23:08 +02:00
KliPPy
a53e7905db Extend amxx list command (#377) 2016-06-26 14:04:33 +02:00
Arkshine
2099a88ddf Fix UTIL_ReplaceAll not properly tracking length. 2016-06-06 12:09:42 +02:00
Vincent Herbet
f3c58b7cd6 Merge pull request #369 from Ni3znajomy/forwards/value-by-reference
Values by reference in forwards
2016-06-05 19:50:40 +02:00
Vincent Herbet
2628ce8664 Merge pull request #349 from Arkshine/feature/command-ml
Add a param to register_*cmd() and get_*cmd() to indiquate info is a multilingual key + modify plugin
2016-04-16 13:12:21 +02:00
Arkshine
9054643fe8 Add a param to register_*cmd() and get_*cmd() to indiquate info is a multilingual key + modify plugin 2016-04-16 11:56:49 +02:00
Karol Szuster
53f9144fc3 Values by reference in forwards 2016-04-05 18:51:18 +02:00
Karol Szuster
aaa2934595 Extend "read_argv" native 2016-03-28 20:05:56 +02:00
Vincent Herbet
7522403da8 Merge pull request #344 from Arkshine/fix/iniparser-inline-comment
Remove inline comment support in multilingual INI parser (bug 6476)
2016-03-16 23:57:28 +01:00
Arkshine
ae4368a3ca Remove inline comment support in multilingual INI parser 2016-03-16 19:50:46 +01:00
Arkshine
be06e2448b Add fmt() native to format and return inline a string 2016-02-23 19:56:02 +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
2a90fc0fe8 Merge pull request #336 from Arkshine/update/gameconfigs
Update GameConfig
2016-02-09 11:27:10 +01:00
Arkshine
696d842b07 Add info message when loading custom gamedata 2016-02-09 11:19:35 +01:00
Arkshine
78619d3710 Fix LookupLangKey retrieving invalid index 2016-02-01 14:48:32 +01:00
Vincent Herbet
06290483da Merge pull request #337 from Ni3znajomy/cvar_directset
Move Cvar_DirectSet to gamedata
2016-01-22 01:25:21 +01:00
Karol Szuster
0e8d876c5d Move Cvar_DirectSet to gamedata 2016-01-21 23:50:07 +01:00
Vincent Herbet
60ebc444ab Merge pull request #338 from Arkshine/fix/client_print_color
Improve client_print_color by inserting default color code at the start of string
2016-01-16 14:13:22 +01:00
Vincent Herbet
307dab47c8 Merge pull request #326 from Arkshine/feature/enable-disable-logevent
Add enable/disable_logevent() natives
2016-01-16 12:18:59 +01:00
Vincent Herbet
a64dbe0268 Merge pull request #331 from Arkshine/fix/buffer-oob
Fix an out of bound buffer index
2016-01-16 12:17:29 +01:00
Arkshine
240c81e626 Improve client_print_color by inserting default color code at the start of string 2016-01-16 12:09:13 +01:00
Arkshine
33768740fa Fix LoadGameConfigFile returning valid handle on invalid path 2016-01-15 17:35:21 +01:00
Arkshine
f1a2a00d38 Allow gameconfig without master for convenience 2016-01-15 17:33:42 +01:00
Arkshine
e634e512c8 Fix recursion issue with show_menu and newmenus 2016-01-15 12:56:16 +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
Arkshine
4662109980 Fix an out of bound buffer index 2016-01-07 19:42:47 +01:00
WPMGPRoSToTeMa
48d7a04c73 SELinux compatibility: memalign -> mmap 2016-01-03 21:38:31 +03:00
Arkshine
b0e5e8d331 Fix typo in replace_stringex native 2015-12-24 19:12:55 +01:00
Arkshine
17a31b75d7 Add enable/disable_logevent() natives 2015-12-24 19:08:00 +01:00
Vincent Herbet
ac37f8053b Merge pull request #320 from Arkshine/fix/l-translation-specifier
Fix incorrect translation language for %l format identifier
2015-12-24 15:54:28 +01:00
Karol Szuster
62a5c54a18 Add client_connectex & extend client_authorized forward 2015-12-22 16:36:51 +01:00
Arkshine
6a18f8007d Fix incorrect translation language for %l format identifier 2015-12-13 20:02:13 +01:00
Arkshine
cc9f679a85 Enable hook detour on cvar with bounds regardless current value 2015-12-11 10:33:54 +01:00
Th3-822
578a2f9852 Fix strncmp case sensitivity
strncmp was using case insensitive call when ignorecase == false
2015-12-02 19:08:10 -04:30
Arkshine
02ac6fa2d7 Update to the latest AMTL - Rename Ref to RefPtr. 2015-11-23 14:45:07 +01:00
Arkshine
ffe8b7761e Cstrike: Move CSW_* constants from amxconst.inc to cstrike_const.inc 2015-11-03 10:45:49 +01:00
IgnacioFDM
b78c239395 Remove extra semicolon 2015-10-20 05:34:18 -03:00
Arkshine
42fb860077 Fix a potential crash if SV_DropClient address could not be found 2015-10-15 12:50:58 +02:00
Arkshine
9bee1f7edf Consistency: Replace GETEDICT with HLTypeConversion in core 2015-10-08 19:36:42 +02:00
Arkshine
9980b7ac62 Fix some natives relying on a known engine bug related to last player's edict being invalid 2015-10-06 17:19:01 +02:00
Arkshine
c29eabec50 Fix max length inconsistencies + typo 2015-10-05 19:12:30 +02:00
Arkshine
138b9e1510 Remove UTIL_Format() and UTIL_VarArgs() 2015-10-05 19:12:08 +02:00
Arkshine
f22dc769f4 Replace some LibraySys usage with AMTL primitives 2015-10-02 23:22:22 +02:00
Arkshine
f976861e21 Fix AMBuild and VS projects files 2015-10-02 23:22:22 +02:00
Arkshine
2d910838a2 Fix AMTL internal paths 2015-10-02 23:22:21 +02:00
Vincent Herbet
ac2bcb2d19 Merge pull request #282 from Arkshine/gamedata-type-desc
Modify game config parser to support more offset data and reflect changes
2015-09-07 09:10:28 +02:00
Vincent Herbet
b63e63cfcd Fix crash when dynamic native is executed with the max number of params
This fixes a buffer overflow with `g_Params`, which has a size of 16 but params index starts to 1. As consequence when 16 params are passed, `g_Params[16]` is indexed and likely overwrites something important which leads to a crash at some point.

It doesn't happen in 1.8.2. Possible reasons why it happens in dev version is this uses newer compiler and compiling optimization are better , resulting crash is triggered now. 

Reported here https://forums.alliedmods.net/showthread.php?t=271103.
2015-09-05 17:49:37 +02:00
Vincent Herbet
57a5004f4e Fix typo
Related to #266. Looks like I've changed the prefix afterward at some point for some reason, but engine is retarded and with `plugin.something.cfg` it will understand extension is `something` instead  of `cfg` ; and will fail to execute as it's an invalid extension (only `cfg` and `rc` are allowed).
2015-09-05 08:42:31 +02:00
Arkshine
0005d1a6b5 Update AMTL submodule from upstream and reflect changes 2015-08-26 11:15:07 +02:00
Arkshine
5b8bbddbc1 AutoExecConfig: Adjust few things 2015-08-26 10:38:31 +02:00
Arkshine
78b1154b8d AutoExecConfig: Do not traumatize Travis and Nextra 2015-08-14 16:38:29 +02:00
Arkshine
9a1dc5d179 AutoExecConfig: Add AutoExecConfig native 2015-08-14 16:38:27 +02:00
Arkshine
f22185d646 AutoExecConfig: Enable the configs 2015-08-14 16:38:27 +02:00
Arkshine
517a08e134 AutoExecConfig: Add CoreConfig class + OnAutoConfigsBuffered / OnConfigsExecuted forwards 2015-08-14 16:37:48 +02:00
Arkshine
ed4faf7c11 Fix player not being internally disconnected in some situation + add client_disconnected forward 2015-08-14 00:08:50 +02:00
Vincent Herbet
83a72a6e3a Fix MPROP_NOCOLORS menu property not working 2015-08-13 12:04:31 +02:00
Arkshine
5f0b92f7c3 Fix typos 2015-08-12 10:43:59 +02:00
Arkshine
f4f4d966f3 Reflect changes where game config functions are used 2015-08-10 18:05:59 +02:00
Arkshine
7423ac6824 Modify game config parser to support more offset datas (type, size, etc.) 2015-08-10 18:05:59 +02:00
Vincent Herbet
4563f56e77 Merge pull request #277 from Arkshine/fix/potential-issues
Fix some potential issues
2015-08-10 15:28:32 +02:00
Arkshine
4d3e31cf6c Fix an SortADTArray() issue where strings are not properly sorted 2015-08-04 17:08:40 +02:00
Arkshine
5987f389c6 Fix some potiental issues 2015-07-31 15:46:16 +02:00
Vincent Herbet
8c0534a055 Fix typo 2015-07-30 19:54:40 +02:00
Pavel Djundik
79bb453bb6 Return an error on Err_OldFile instead of falling through to default case 2015-07-30 15:59:01 +03:00
Vincent Herbet
8c16331b69 Merge pull request #272 from Arkshine/feature/textparser-data-param
Add a data argument in INI/SMC_ParseFile() to pass through to callbacks (bug 6228)
2015-07-30 10:43:44 +02:00
Vincent Herbet
fc4455d837 Merge pull request #273 from Arkshine/fix/newmenu-typo
Fix typo in newmenus (bug 6394)
2015-07-30 10:43:36 +02:00
Arkshine
5f83f77b2e Fix typo in newmenus 2015-07-30 00:28:18 +02:00
Arkshine
6d6a1c1ab0 Add a data argument in INI/SMC_ParseFile() to pass through to callbacks (bug 6228) 2015-07-29 22:23:13 +02:00
Arkshine
2d583aa83a Fix a ML parser crash on key with an associated empty value 2015-07-28 15:41:16 +02:00
Arkshine
6b3b351c9a Rename Handle class to avoid name collision in mac 2015-07-21 00:18:54 +02:00
Arkshine
df5d935194 Add enable/disable_event() native 2015-07-20 23:06:32 +02:00
Arkshine
109b3481a7 Retrieve log type in MetaAttach to allow log to be written earlier 2015-07-18 09:55:13 +02:00
Vincent Herbet
717735311b Fix typo 2015-07-17 17:53:52 +02:00