4168 Commits

Author SHA1 Message Date
ba37f2f428 Merge branch 'patch-4' of https://github.com/luxxxoor/amxmodx 2022-07-11 13:37:39 +00:00
0de7beb351 Merge branch 'patch-5' of https://github.com/WPMGPRoSToTeMa/amxmodx 2022-07-11 13:34:36 +00:00
4d38b9c73b https://github.com/alliedmodders/amxmodx/pull/567 2022-07-11 13:24:13 +00:00
03cdb55266 https://github.com/alliedmodders/amxmodx/pull/575 2022-07-11 13:22:45 +00:00
950e63d62f https://github.com/alliedmodders/amxmodx/pull/576 2022-07-11 13:20:30 +00:00
0a0a8bc13d https://github.com/alliedmodders/amxmodx/pull/579 2022-07-11 13:18:27 +00:00
63c18bba6c https://github.com/alliedmodders/amxmodx/pull/993 2022-07-11 13:10:17 +00:00
338e8307f8 https://github.com/alliedmodders/amxmodx/pull/1049 2022-07-11 13:01:02 +00:00
475b1cdc29 fix gcc 12.1 compilation 2022-07-10 15:25:45 +00:00
e5c519cf07 update sqlite to version 3.39.0 2022-07-10 15:24:46 +00:00
df6b589ba1 nextmap.sma - Fix mp_chattime getting increased on quick map change (#1044) 2022-06-30 23:16:05 -07:00
fde732f66d Update trie_natives.cpp (#1052)
"Invalid map handle provided (%d)" error is very unclear when it appears in complex code.
2022-06-16 18:47:08 -07:00
49a8b959b3 Update newmenus.inc (#1043) 2022-04-05 00:32:55 -07:00
ec82e3f34c now amxmodx can use std (#1026) 2021-12-06 10:38:46 -08:00
8ee3da24cb Added new debug feature: Performance Monitor. (#1019)
* Performance Monitor.

Search big performance issues for any plugin that in debug mode. No server slow down.
Output is plugin and function name, and server execution lag in ms. Output target: current amxlog file.

* Adding cvar to enable perflog. Force for all plugin if amx_debug is 2.

* Update cvar name

* Use another clock from chrono

* Fix debug check

* Skip internal amxx exec

* Move includes

* Fix debug check in amx_ExecPerf

* Tried to compile without min/max undefined
2021-12-05 18:38:49 -08:00
6e8554d1d2 Fix ConfigsExecutedForward (my mistake) (#1024)
* Fix one big issue what broken all plugins!

If found any config from servercmd, m_ConfigsExecutedForward not called !!!!!!!
If m_ConfigsExecutedForward  not called, this is broke all plugins where used m_ConfigsExecutedForward (example restmenu)

Revert "Fix one big issue what broken all plugins!"

This reverts commit 6ce36f22e1c278f0831ebbddbc1dbbceb91dacb9.

* Fix m_ConfigsExecutedForward after my missprint from previous pr

Fix my missprint from previous pull request 275be8b0a8
2021-12-04 12:04:08 -08:00
275be8b0a8 Fix one big issue what broken all plugins! (#1022)
If found any config from servercmd, m_ConfigsExecutedForward not called !!!!!!!
If m_ConfigsExecutedForward  not called, this is broke all plugins where used m_ConfigsExecutedForward (example restmenu)
2021-12-03 15:07:59 -08:00
f8ac58c839 Fix some misprints and mistakes in code, part 2 (#1021)
* Fix compiler warnings about broken syntax

Revert "Fix compiler warnings about broken syntax"

This reverts commit cd0649806feaab064e93a0fbcd1f4488747f9b79.

Unbreak code

* Unbreak code

* Stop breaking code, please

* Small real unused check

* Fix "breaked" code and fix MAX_WEAPONS misprints

* Compiler break in debug mode if passing upper case strings
2021-12-02 21:24:15 -08:00
e8909c1583 Fixed value check in json_object_set_value (#1015)
Regression from #983
2021-12-02 19:32:04 -08:00
3cda059669 Fix some errors (#1020)
Fix some critical errors
2021-12-02 13:47:57 -08:00
5dcda02b65 [Build] Implement CI for MacOS via appveyor (#1013) 2021-10-24 17:22:56 -07:00
e6d9d9b71c Update stats.sma (#1001)
Triggered the "Invalid weapon id" at another location in the source code, so patched all cases where the argument could be 0.
2021-10-07 17:12:37 -07:00
2563bf6c26 Updated get_user_flags documentation (#1007) 2021-10-07 17:12:04 -07:00
c61735130d [Build] Fix latest MSVC and CLang compiler errors (#1008)
* Explicit cast specification

* Explicit cast specification

* Suppress -Wno-tautological-compare in Clang 10 and above

https://reviews.llvm.org/rG8b0d14a8f0cc085afa2a9c86c237da81c74517fc

* Explicit cast specification

* Add HAVE_STDINT_H compiler flag

* Explicit casting mechanism type specification

* typo
2021-10-07 17:11:49 -07:00
cac80584a0 Setup Github Actions (#1003) 2021-10-05 23:39:38 -07:00
3eefe5562e [Build] Migrate to Python3 (#1000)
* Configure Travis build env for Py3

Using default available version of 3.6.3 in `xenial` dist

* Migrate to py3

* Fix documentation
2021-09-28 11:41:04 -07:00
c317dc55c7 Update stats.sma (#997)
Fix runtime error when a player "killed self with teledeath". Happens when a map hasn't enough spawn points.
2021-09-28 09:56:21 -07:00
8fefd48af2 Create FUNDING.yml and add a ❤️Sponser button (#994) 2021-09-23 10:12:43 -07:00
f37f9d1c66 Fix gcc 9.2 compilation. (#835)
Fix gcc 9.2 compilation.
2021-09-22 17:01:35 -07:00
8413946ace Minor German Language Update (#926)
* Update admincmd.txt

* Update statsx.txt

* Update miscstats.txt

* Update menufront.txt

* Update menufront.txt

* Update admincmd.txt

* Update adminvote.txt

* Update restmenu.txt

* Update mapsmenu.txt

* Update nextmap.txt

* Update stats_dod.txt

* Update statscfg.txt

* Update stats_dod.txt

* Update adminvote.txt
2021-09-17 13:22:30 +02:00
be9ccc42eb European Portuguese Language translation fixes (#902)
* European Portuguese translation fix: admin.txt

* European Portuguese translation fix: admincmd.txt

* Added European Portuguese translation: adminslots.txt

Added new translations

* European Portuguese translation fix: common.txt

* European Portuguese translation fix: menufront.txt

* European Portuguese translation fix: miscstats.txt

* European Portuguese translation fix: pausecfg.txt

* European Portuguese translation fix: restmenu.txt

* European Portuguese translation fix: statscfg.txt
2021-09-17 13:12:46 +02:00
fb7ab6d08d Add missing kRenderFx constant (#928)
* Add missing kRenderFx constant

* Change constant name to match SDK
2021-09-17 13:11:17 +02:00
01e60834fa Use precache_generic() for sounds that are played client-side (#934) 2021-09-17 13:10:46 +02:00
3289b3c63c Update parson and fix json_object_set_value (#983)
* Remove parson folder

* add submodule parson

* FIX amxx_json_object_set_value generate a crash if invalid value is passed

* restore parson folder status
2021-09-17 13:06:54 +02:00
e17d37abe3 [FEATURE REQUEST] set_hudmessage add missing parameters (#992)
Same as https://github.com/alliedmodders/amxmodx/pull/981

Co-Authored-By: Franco Romaniello <romax.cs@gmail.com>

Co-authored-by: Franco Romaniello <romax.cs@gmail.com>
2021-09-17 13:05:28 +02:00
51c3f1b195 Fix typo in message_const.inc TE_FIZZ comment (#990) 2021-09-17 13:03:37 +02:00
2c8be75057 [TFCX] Fix Medic infection Crash on Linux (#991)
* [TFCX] Fix Medic infection Crash on Linux

Issue: #988

* [TFCX] Removed redundant code

- Added `_DEBUG_TFCX` preprocessor directive
- Deleted redundant code (which fetches pdata)
2021-09-17 12:59:54 +02:00
10db2e5c85 Revert "Update CMisc.h (#984)" (#986)
Turned out both test servers still had an old "tfc_i386.so" file which took precedence over the newer "tfc.so" library, so both servers were misconfigured and that's why the offsets didn't work.
2021-09-02 11:51:50 -07:00
05f86f05c0 Update CMisc.h (#984)
LINUXOFFSET is back at 3 since HLDS Linux build 8308 (dated July 24, 2019).
2021-08-26 22:28:01 -07:00
36d5aa97b1 Add missing set_task_* callback info (#952) 2021-08-07 17:31:18 +02:00
b8c490b5e6 Fix newmenus.inc documentation (#942) 2021-08-07 17:30:07 +02:00
301701b1da Fix typo in admincmd.txt (#951)
slaped => slapped

Let's just ignore the fact that the key is misspelled too.
2021-08-07 17:29:11 +02:00
5b1b844184 Fix incorrect uses of feof() (#957)
Using feof() as the while loop condition for detecting the end of the file is incorrect.
2021-08-07 17:28:35 +02:00
6c9c37eb45 Fixed Romanian translation, and added diacritics (#974) 2021-08-07 17:20:50 +02:00
d88b7e3c98 Change default chat time to 0.0 (#977) 2021-08-07 17:19:38 +02:00
6b9d82fa60 Add TIME_ELEMENT_* Romanian language keys in time.txt (#971) 2021-07-26 10:45:55 +02:00
08494d0d66 macOS build fix. 2021-07-11 22:14:16 -07:00
97b03ea567 Another macOS build fix. 2021-07-11 22:10:02 -07:00
344fb3d410 Fix mac build. 2021-07-11 22:08:37 -07:00
37cbccef6a Quell warning on macOS. 2021-07-11 22:08:36 -07:00
7fb6440ce9 Update minimum macOS to 10.7. 2021-07-11 20:55:09 -07:00
1a1b16614a Switch to libc++ on mac. 2021-07-11 20:51:19 -07:00
af32a9790b Switch to Python3 for bootstrapping. 2021-07-11 17:30:38 -07:00
2e5e3ce060 Add month and year support to get_time_length() (#969)
* Add RU

* Add EN

* Add DE

* Add SR

* Add BP

* Add HU

* Add SECONDS_IN_MONTH & timeunit_months

* Add months for API description

* Add SECONDS_IN_YEAR & timeunit_years

* fix typo

* Add FR
2021-07-01 10:51:24 +02:00
c58daeafca Fix stock "SQL_QueryAndIgnore" documentation (#965) 2021-06-19 10:38:25 +02:00
7fef58c374 Fix for loop index out of bounds error (#966)
Fixes an index out of bounds error when refreshMenus() and subsequently findAdminsWithMenu() is called when there is 32 players in the server. Indexing the playersList array in the for loop condition causes it to try to index with a value of 32 on the very last condition check which is not valid for this array.
2021-06-19 10:36:56 +02:00
3c1856f7af Add ignore for amxx binaries (#960) 2021-05-06 20:40:48 -07:00
9fbf91ded0 Fixed a typo in open_dir native (#955)
dir[] parameter is not const, but it never changes.
2021-03-25 10:04:00 -07:00
3d517d69e2 Revert "Update meta_api.cpp (#883)" (#950)
This reverts commit 7cb045c688.
2021-03-12 18:36:40 +01:00
70d1aff519 Revert "Resolve old bot's connection state issues (#917)" (#949)
This reverts commit bee4b47b07.
2021-03-12 18:31:01 +01:00
bee4b47b07 Resolve old bot's connection state issues (#917)
* final bot's fixes

Fixes: #916
Fixes: #883
Fixes: #875

* suggestions

* suggestions

Co-authored-by: shel <2@shelru.ru>
2021-03-09 23:10:59 +01:00
8c6b0f84bb Fix Windows build. 2021-02-10 13:32:02 -08:00
a4e929eedc Possible memory leaks on deattach (#912)
Co-authored-by: shel <2@shelru.ru>
2020-12-06 12:09:57 -08:00
c81f68aac3 Update cvars.inc (#919) 2020-12-06 12:01:52 -08:00
03f4c7dd2c Update checkout-deps.sh (#915) 2020-12-06 11:59:11 -08:00
7cb045c688 Update meta_api.cpp (#883)
Fixes: #875
2020-11-22 18:02:53 -08:00
73f3afa95f push (#911)
Co-authored-by: shel <2@shelru.ru>
2020-11-22 15:43:17 -08:00
2fadf887e6 Return max heap size note (#910)
Co-authored-by: shel <2@shelru.ru>
2020-11-22 15:12:54 -08:00
1027df054a Updated 'checkout-deps' to check for 'pip'/'pip3' prior to installing 'AMBuild' (#897) 2020-07-31 14:33:28 -07:00
2e3c105c7d Pass menu ID in MPROP_PAGE_CALLBACK function (#885)
Co-authored-by: shel <2@shelru.ru>
2020-07-17 11:05:13 +02:00
ff2fc19b08 Update newmenus.cpp (#884)
Fixes: #881

Co-authored-by: shel <2@shelru.ru>
2020-07-17 01:57:29 +02:00
f4fefd0bb4 Fix uninitialized member unexpected results (#896)
Co-authored-by: shel <2@shelru.ru>
2020-07-16 16:40:31 -07:00
b26118006a Revert "Do not allow admins to change cvars with FCVAR_SPONLY flag when not in singleplayer via amx_cvar"
adbc3e0c53

Behavior change. For now reverting it to give time and decide how it should be handled properly.
2020-06-24 22:49:19 +02:00
ed1ab00faf Fix internal player's team id returning -1 in a specific but valid situation (#772)
* Fix internal player's team id returning -1 in a specific but valid situation

* Use a local variable

* Fix spaces
2020-06-03 23:53:26 +02:00
6d6a41b894 Improve AdminSlot plugin (#631)
* Adminslot: Trim spaces

* Adminslot: Use semicolon everywhere

* Adminslot: Use brackets everywhere

* Adminslot: Hook cvars change and make sure max visible players is set right away

* Adminslot: Rename g_sv_visiblemaxplayers

* Adminslot: Move free slot calculation in its own function

* Adminslot: Use create_cvar and define appropriate bounds

* Adminslot: Use get_playersnum_ex with flag for clarity

* Adminslot: Move all the logic inside setVisibleSlots

Looks like the commit should have been split for clarity.

The initial purpose is to avoid code duplication and regroup checks.
The logic is the same with a little improvement to handle situations where a cvar is changed on-the-fly and sv_visiblemaxplayers needs to be reset.

Ultimately, the logic is the following:

 - At player's connection:
 -- Do nothing if amx_reservation == 0 and sv_visiblemaxplayers <= 0. If sv_visiblemaxplayers is set, we reset it directly.
 -- Check if player needs to be kicked. If not, and amx_hideslots == 0, then do nothing.
 -- Otherwise we update sv_visiblemaxplayers

 - Others events:
 -- Do nothing if either amx_reservation == 0 or amx_hideslots == 0, and if sv_visiblemaxplayers <= 0. If sv_visiblemaxplayers is set, we reset it directly.
 -- Otherwise we update sv_visiblemaxplayers

* Adminslot: Rename variables and adjust constantness

* Adminslot: Add a description to the cvars

* Adjust CVAR_HIDESLOTS english sentence

* Add the Deutsch translations
2020-06-03 23:52:47 +02:00
b9b4001bf9 Add menu_item_setaccess native (#826)
* Add set access.

* Update newmenus.inc

* typo

* Update newmenus.inc
2020-05-29 21:40:35 +02:00
1bc342a692 Public vars for plugin data (#714)
* Add public vars for plugin data and small refactoring get_xvar_id native

* Add new command to display info about the plugin and add url to amxx plugins command

* Add optional args to register_plugin native (url, description)

* Add enum of args for register_plugin native

* Creating a variable inside an if statement (C++17)

* Displaying the URL of the plugin if it is present

* Getting an ID only with more than three arguments

* Creating a variable inside an if statement (C++17)

* Fix typo

* Revert "Creating a variable inside an if statement (C++17)"

This reverts commit 835e0bc6c413f11b1bbf964daea87b57f653f5d7.

* Revert "Creating a variable inside an if statement (C++17)"

This reverts commit b2c1e7c77576c02a00c8c3f103457000d3298ceb.

* Revert "Displaying the URL of the plugin if it is present"

This reverts commit 9e31230368449966d16635c696d97c04adadeaa9.

* Binary compatibility for previously compiled plugins

* Displaying the URL of the plugin if it is present

* Quotation marks replaced by square brackets and change arg name to id

* Fix getting url

* The 'atoi' function replaced to 'stoi'

* Add likely/unlikely defines for using built-in function provided by GCC

* Small fixes with auto and inconsistent var name

* Replace stoi to strtol function

* Removed explicit buffer id

* Revert "Add likely/unlikely defines for using built-in function provided by GCC"

This reverts commit 94cee479ed245b98195501466850d01a3f08fd13.

* Add url and description params to get_plugin function
2020-05-29 12:37:40 +02:00
368bde1d07 Yet another Hungarian langugage revise (#816)
Revised by Norbee. @ ebateam.eu

He was just lazy to do a PR :P
2020-05-29 01:13:38 +02:00
51ede1097d admincmd.sma exploits fix (#822)
* [admincmd.sma] Fix typo in isCommandArgSafe

'

* [admincmd.sma] Update amx_cvar command handler

- Fix exploiting of "mapchangecfgfile" cvar to execute potentially dangerous console commands
- Add newline delimiter check and restrict for ****cfgfile cvars values

* Restrict having ".." character sequence in amx_map command argument

Fixes exploit on Windows servers that allows executing potentially dangerous console commands

* Do not allow admins to change cvars with FCVAR_SPONLY flag when not in singleplayer via amx_cvar

1. Make amx_cvar command obey FCVAR_SPONLY flag.
2. Fix exploiting of amx_nextmap cvar value which is used in nextmap plugin.
2020-05-29 01:10:38 +02:00
a5f2b5539f adminvote.sma exploit fix (#823)
* Restrict having ".." character sequence in amx_votemap command arguments

Fixes exploit on Windows servers that allows executing potentially dangerous console commands

* Fix typo

containi -> contain
2020-05-29 01:04:16 +02:00
307e71455a Fix broken DoD Fun module natives (#851)
* Update hardcorded offsets

* Fixed using incorrect parameter for setting string
2020-05-29 00:54:36 +02:00
b60f58ac34 Turkish Translation Fixes/Addings (#862)
* Update admin.txt

Fixed translation [tr]

* Update adminchat.txt

* Update admincmd.txt

* Update adminhelp.txt

* Update adminslots.txt

* Update adminvote.txt

* Update antiflood.txt

* Update cmdmenu.txt

* Update common.txt

* Update imessage.txt

* Update mapchooser.txt

* Update menufront.txt

* Update mapsmenu.txt

* Update miscstats.txt

* Update multilingual.txt

* Update nextmap.txt

* Update pausecfg.txt

* Update plmenu.txt

* Update restmenu.txt

* Update scrollmsg.txt

* Update stats_dod.txt

* Update statscfg.txt

* Update telemenu.txt

* Update time.txt

* Update timeleft.txt

* Update statsx.txt

* Update adminhelp.txt

* Update admincmd.txt
2020-05-29 00:51:14 +02:00
6ef40779e7 Add missing is_user_authorized() native (#840)
* Add missing is_user_authorized() native

It is implemented in core, but missing in amxmodx.inc

* Fix typo
2020-03-05 14:52:14 +01:00
18a5f6f5ea Fix MySQL connector link (#844) 2020-03-04 21:10:41 +01:00
d3ef881f31 Fix unreachable code warning in constraint_offset() (#784) 2019-12-20 11:17:08 +01:00
0eba9b3708 Close cmdaccess.ini file if fopen found the file... (#815)
Close file if fopen found the file...
2019-12-20 11:12:46 +01:00
0ccba67006 Fix compilation with GCC 8.2+ (#617)
* GCC 8.2 support

* Add GCC version check

* -Werror=class-memaccess fix in code

* Use assignment for Stats
2019-10-29 21:48:31 +01:00
c86813697a Fix new lines with TextMsg and SayText (side-effect of #763) (#778)
* Fix newlines for TextMsg

* Fix newlines for SayText

* Adjust comments

* Replace hardcoded detination value with HUD_* constants

* Make sure only official mods can use format string

* Fix typos

* Split condition for readability

* CS only: Fix newlines in TextMsg and with print_center
2019-10-28 00:21:09 +01:00
4f6b779bf4 Adjust TextMsg/SayText maximum buffer length from 190 to 187 due to "%s" parameter added in #763 2019-10-23 16:27:26 +02:00
d819df80f9 Fix issues with amxclient_cmd and read_args/read_argv* natives (#761)
* Fixes to read_args and read_argv* natives

* Fixed crash with read_argv* natives and commands sent with amxclient_cmd native
* Fixed read_args returning argv[0] instead of empty string when both amxclient_cmd's arguments were not specified

* Fix spaces
2019-10-22 10:28:40 +02:00
5120deaf74 Update gamedata for all supported mods (#771)
* Update CS gamedata

* Update TFC gamedata

* Update DoD gamedata

* Update Valve gamedata

* Update Gearbox gamedata
2019-10-21 11:49:30 +02:00
d01aa5762f Fix behavior change about endianness check in maxmind/libmaxminddb#123 (#770) 2019-10-20 23:21:57 +02:00
8930ecf7c5 Add new plugin defines regarding the AMX Mod X version (#723)
* Add AMXX_VERSION_LOCAL define

* Add new defines regarding version of AMX Mod X

Added new defines: AMXX_VERSION_MAJOR_NUM and AMXX_VERSION_MINOR_NUM

* Rename AMXX_VERSION_LOCAL define

Define AMXX_VERSION_LOCAL was renamed to AMXX_VERSION_LOCAL_REV_NUM
2019-10-17 18:55:05 +02:00
aa06e5ab93 European Portuguese Language translation support (#750)
* Added European Portuguese translation: admin.txt

* Added European Portuguese translation: adminchat.txt

* Added European Portuguese translation: admincmd.txt

* Added European Portuguese translation: adminhelp.txt

* Added European Portuguese translation: adminslots.txt

* Added European Portuguese translation: adminvote.txt

* Added European Portuguese translation: antiflood.txt

* Added European Portuguese translation: cmdmenu.txt

* Added European Portuguese translation: common.txt

* Added European Portuguese translation: imessage.txt

* Added European Portuguese translation: languages.txt

* Added European Portuguese translation: mapchooser.txt

* Added European Portuguese translation: mapsmenu.txt

* Added European Portuguese translation: menufront.txt

* Added European Portuguese translation: miscstats.txt

* Added European Portuguese translation: multilingual.txt

* Added European Portuguese translation: nextmap.txt

* Added European Portuguese translation: pausecfg.txt

* Added European Portuguese translation: plmenu.txt

* Added European Portuguese translation: restmenu.txt

* Added European Portuguese translation: scrollmsg.txt

* Added European Portuguese translation: stats_dod.txt

* Added European Portuguese translation: statscfg.txt

* Added European Portuguese translation: statsx.txt

* Added European Portuguese translation: telemenu.txt

* Added European Portuguese translation: time.txt

* Added European Portuguese translation: timeleft.txt
2019-10-17 15:46:04 +02:00
8309a1e06b Send pre-formatted string in SayText and TextMSg as a parameter instead of as the format string (#763) 2019-10-17 15:42:46 +02:00
7a44e6ec66 Fix GeoIP2 database file extraction (#764) 2019-10-17 15:42:27 +02:00
0bd69445f9 CSPForward::execute: Fix uninitialized retVal (#747) 2019-08-02 09:47:38 +02:00
5a257a7a42 Merge pull request #664 from IgnacioFDM/add-sqdistance
Add square distance functions to xs.inc
2019-06-19 22:37:56 +02:00
136cc23463 Merge pull request #698 from CrXane/master
Albanian Language translation support
2019-06-19 22:36:06 +02:00
024003d6f0 Fix MPROP_SHOWPAGE option not working as expected (#726)
Typo from #473.
2019-06-19 22:26:03 +02:00
abba8f1a7c Fix typo on engine.inc documentation (#730)
`register_think` first parameter is `Classname[]`, but, it's written `Touched` on its description.
2019-06-19 22:25:41 +02:00
16c5e4b34b Merge pull request #15 from lspublic/patch-46
Update miscstats.txt
2019-06-11 15:04:04 +02:00
132277bfdc Merge pull request #16 from lspublic/patch-47
Update multilingual.txt
2019-06-11 15:03:56 +02:00
f1332bb4af Merge pull request #17 from lspublic/patch-48
Update nextmap.txt
2019-06-11 15:03:46 +02:00
d659761195 Merge pull request #18 from lspublic/patch-49
Update pausecfg.txt
2019-06-11 15:03:37 +02:00
8a57a94480 Merge pull request #19 from lspublic/patch-50
Update plmenu.txt
2019-06-11 15:03:27 +02:00
0409910e1f Merge pull request #20 from lspublic/patch-51
Update restmenu.txt
2019-06-11 15:03:18 +02:00
c392d358a7 Merge pull request #21 from lspublic/patch-52
Update scrollmsg.txt
2019-06-11 15:03:10 +02:00
a901a127eb Merge pull request #22 from lspublic/patch-53
Update stats_dod.txt
2019-06-11 15:02:46 +02:00
2f90940c3f Merge pull request #23 from lspublic/patch-54
Update statscfg.txt
2019-06-11 15:02:38 +02:00
e66b466745 Merge pull request #24 from lspublic/patch-55
Update statsx.txt
2019-06-11 15:02:29 +02:00
9068f3c95a Merge pull request #25 from lspublic/patch-56
Update telemenu.txt
2019-06-11 15:02:18 +02:00
d2e71dd1f2 Merge pull request #26 from lspublic/patch-57
Update time.txt
2019-06-11 15:02:06 +02:00
58e552ceff Merge pull request #27 from lspublic/patch-58
Update timeleft.txt
2019-06-11 15:01:55 +02:00
8a19774edd Merge pull request #14 from lspublic/patch-45
Update menufront.txt
2019-06-11 15:01:30 +02:00
66876f89cd Merge pull request #13 from lspublic/patch-44
Update mapsmenu.txt
2019-06-11 15:01:17 +02:00
d18cc72510 Merge pull request #12 from lspublic/patch-43
Update mapchooser.txt
2019-06-11 15:00:45 +02:00
179b802c7b Merge pull request #11 from lspublic/patch-42
Update languages.txt
2019-06-11 15:00:15 +02:00
aba5897818 Merge pull request #10 from lspublic/patch-41
Update imessage.txt
2019-06-11 14:59:46 +02:00
ee2d846e0d Merge pull request #9 from lspublic/patch-40
Update common.txt
2019-06-11 14:59:20 +02:00
a6897ec39b Update common.txt 2019-06-11 14:58:19 +02:00
8aabf09067 Merge pull request #8 from lspublic/patch-39
Update cmdmenu.txt
2019-06-11 14:57:23 +02:00
b5fb4611cd Merge pull request #7 from lspublic/patch-38
Update antiflood.txt
2019-06-11 14:57:03 +02:00
f41aeef8b0 Merge pull request #4 from lspublic/patch-35
Update adminhelp.txt
2019-06-11 14:56:25 +02:00
7561426bd4 Merge pull request #5 from lspublic/patch-36
Update adminslots.txt
2019-06-11 14:56:06 +02:00
1bac8319c4 Merge pull request #6 from lspublic/patch-37
Update adminvote.txt
2019-06-11 14:55:36 +02:00
c6eb8a11d8 Merge pull request #3 from lspublic/patch-34
Update admincmd.txt
2019-06-11 14:54:31 +02:00
6aa012f062 Merge pull request #2 from lspublic/patch-33
Update adminchat.txt
2019-06-11 14:52:26 +02:00
887dd5b6d1 Update admincmd.txt 2019-06-11 14:47:44 +02:00
703a6872bc Update admincmd.txt 2019-06-11 14:44:41 +02:00
71eb9fe0d8 Update adminchat.txt 2019-06-11 14:42:04 +02:00
096dae9095 Fix MPROP_SHOWPAGE option not working as expected
Typo from #473.
2019-05-29 11:47:57 +02:00
1eb8a7f8c2 Update timeleft.txt
Some file change
2019-05-23 19:30:14 +02:00
8cbbf71f0c Update time.txt
Some file change
2019-05-23 19:29:24 +02:00
6923c1b209 Update telemenu.txt
Some file change
2019-05-23 19:28:37 +02:00
de93fa0824 Update statsx.txt
Some file change
2019-05-23 19:27:52 +02:00
118f33a83e Update statscfg.txt
Some file change
2019-05-23 19:27:02 +02:00
bc0d83bc92 Update stats_dod.txt
Some file change
2019-05-23 19:26:03 +02:00
bc36bb23df Update scrollmsg.txt
Some file change
2019-05-23 19:24:53 +02:00
00967632d5 Update restmenu.txt
Some file change
2019-05-23 19:24:35 +02:00
74171687f7 Update plmenu.txt
Some file change
2019-05-23 19:22:57 +02:00
88d9145524 Update pausecfg.txt
Some file change
2019-05-23 19:22:06 +02:00
50971fd9d0 Update nextmap.txt
Some file change
2019-05-23 19:21:06 +02:00
45c2e90a3f Update multilingual.txt
Update some file change
2019-05-23 19:20:19 +02:00
a6ccf82419 Update miscstats.txt
Some file change
2019-05-23 19:19:04 +02:00
3c3ac7a36c Update menufront.txt
Some file changes
2019-05-23 19:18:00 +02:00
41abeb3322 Update mapsmenu.txt
Some file changes
2019-05-23 19:17:13 +02:00
1e89e4c685 Update mapchooser.txt
Some file changes
2019-05-23 19:16:17 +02:00
653c5edcf4 Update languages.txt
Some files change in text
2019-05-23 19:15:28 +02:00
302d127f6f Update imessage.txt
Some file changes in text
2019-05-23 19:14:34 +02:00
0eeda72922 Update common.txt
Some file changes in text
2019-05-23 19:12:51 +02:00
cb1941c99a Update cmdmenu.txt
Some file changes in text
2019-05-23 19:11:47 +02:00
51adc75e96 Update antiflood.txt
Some changes in text
2019-05-23 19:10:37 +02:00
8882bd5ca0 Update adminvote.txt
Some changes in text
2019-05-23 19:09:13 +02:00
0928d7a6fe Update adminslots.txt
Some changes in file
2019-05-23 19:07:45 +02:00
e502c61f2c Update adminhelp.txt
Some changes in text
2019-05-23 19:06:18 +02:00
38848ff636 Update admincmd.txt
Some changes in text
2019-05-23 19:05:07 +02:00
59ce7064c7 Update adminchat.txt
Some changes in text
2019-05-23 19:01:09 +02:00
8cee128e50 Added Albanian translation: timeleft.txt 2019-05-16 22:26:59 +04:00
7ddc462135 Added Albanian translation: time.txt 2019-05-16 22:26:05 +04:00
cd76998995 Added Albanian translation: time.txt 2019-05-16 22:25:46 +04:00
48c0ae1711 Added Albanian translation: statsx.txt 2019-05-16 22:24:36 +04:00
85124d3417 Added Albanian translation: statscfg.txt 2019-05-16 22:20:46 +04:00
8b1a83f085 Added Albanian translation: stats_dod.txt 2019-05-16 22:11:15 +04:00
3fb981f6be Added Albanian translation: miscstats.txt 2019-05-16 22:03:59 +04:00
388a68e694 Added Albanian translation: scrollmsg.txt 2019-05-16 21:55:16 +04:00
60e2109b4f Added Albanian translation: restmenu.txt 2019-05-16 21:53:48 +04:00
ca7e289273 Added Albanian translation: plmenu.txt 2019-05-16 21:36:18 +04:00
437ad0f8ec Added Albanian translation: pausecfg.txt 2019-05-16 21:33:25 +04:00
32ff785d85 Added Albanian translation: nextmap.txt 2019-05-16 21:17:47 +04:00
2d607b6d68 Added Albanian translation: multilingual.txt 2019-05-16 21:16:02 +04:00
9c21bcd18b Added Albanian translation: miscstats.txt 2019-05-16 21:13:14 +04:00
dcdd5a1442 Added Albanian translation: menufront.txt 2019-05-16 21:00:55 +04:00
072095445e Added Albanian translation: mapsmenu.txt 2019-05-16 20:56:34 +04:00
486da2f44b Hungarian language update (#719)
Thanks for the help to Norbee. @ ebateam
2019-05-16 15:11:10 +02:00
681acffee9 Bump ReHLDS API version to 3.6 (#721) 2019-05-16 14:55:41 +02:00
dfd835eba5 String changes for missing path exception messages (#718)
Resolves #652
2019-05-14 00:37:49 +02:00
ecbff2e8f1 Added Albanian translation: mapchooser.txt 2019-05-12 14:55:46 +04:00
55f01c9488 Added Albanian translation: imessage.txt 2019-05-12 14:50:43 +04:00
49c219e6a2 Added Albanian translation: common.txt 2019-05-12 14:48:39 +04:00
cccb8c84af Added Albanian translation: cmdmenu.txt 2019-05-12 14:43:46 +04:00
3dc5ec0331 Added Albanian translation: antiflood.txt 2019-05-12 14:42:24 +04:00
12664d9427 Added Albanian translation: adminvote.txt 2019-05-12 14:41:25 +04:00
365a0559b3 Added Albanian translation: adminhelp.txt 2019-05-12 14:33:37 +04:00
62052ee590 Added Albanian language: adminslots.txt 2019-05-12 14:29:29 +04:00
0aa97dee3f Added Albanian language: adminhelp.txt 2019-05-12 14:27:33 +04:00
4c55da4de9 Added Albanian translation: admincmd.txt 2019-05-12 14:19:20 +04:00
0f667692b1 Added Albanian translation: adminchat.txt 2019-05-12 13:22:40 +04:00
6addd9c074 Added Albanian translation: admin.txt 2019-05-12 13:20:57 +04:00
295d09df8b Fix string incorrectly formatted in CS Misc Stats plugin (#704)
Recently, I got those below errors on logs:
```
String formatted incorrectly - parameter 12 (total 12)
L 04/29/2019 - 23:24:40: [AMXX] Displaying debug trace (plugin "miscstats.amxx", version "1.8.3-dev+5154")
L 04/29/2019 - 23:24:40: [AMXX] Run time error 25: parameter error 
L 04/29/2019 - 23:24:40: [AMXX]    [0] miscstats.sma::checkKills (line 922)
```

It just looks like `"RAMPAGE!!! %s^n%L %d %L (%d hs)"` misses last format rule, which should be `"%L"` pointing to `HS` lang key.
2019-04-30 09:59:15 +02:00
1cc7786a4c Add new public var with mapname and new constant (#687)
* Add new public var with current map name

* Add a constant to define max map's name length

* Reducing the maximum buffer size to store a map's name

* The PLATFORM_MAX_PATH constant replaced to MAX_MAPNAME_LENGTH
2019-04-27 01:01:54 +02:00
f301fbaf08 Accidentally deleted 2019-04-14 12:02:24 +02:00
05cd0af3a5 Delete restmenu.txt 2019-04-14 11:52:49 +02:00
97fc80dd03 Merge branch 'master' into master 2019-04-14 10:12:59 +02:00
d3ca82411a Added Albanian translation 2019-04-14 10:04:22 +02:00
3e91def7f0 Added Albanian translation 2019-04-14 10:03:46 +02:00
96a74ec654 Added Albanian translation 2019-04-14 10:03:09 +02:00
4f3b9e7a60 Added Albanian translation 2019-04-14 10:02:37 +02:00
df819beab5 Added Albanian translation 2019-04-14 10:01:56 +02:00
7ecc62aaef Added Albanian translation 2019-04-14 10:01:19 +02:00
ef570a987a Added Albanian translation 2019-04-14 10:00:20 +02:00
09548bfd2c Added Albanian translation 2019-04-14 09:59:16 +02:00
2e0c240573 Added Albanian translation 2019-04-14 09:47:12 +02:00
dc59d826a3 Added Albanian translation 2019-04-14 09:46:38 +02:00
35788efa07 Added Albanian translation 2019-04-14 09:46:05 +02:00
ac6364bfdc Added Albanian translation 2019-04-14 09:45:39 +02:00
6655fe7c28 Added Albanian translation 2019-04-14 09:45:06 +02:00
bb31835dea Added Albanian translation 2019-04-14 09:44:34 +02:00
bd67978c3a Added Albanian translation 2019-04-14 09:44:05 +02:00
ede7b69b25 Added Albanian translation 2019-04-14 09:43:10 +02:00
7b2ef405a3 Added Albanian translation 2019-04-14 09:42:35 +02:00
8264328235 Added Albanian translation 2019-04-14 09:42:02 +02:00
113c50b1fa Added Albanian translation 2019-04-14 09:41:30 +02:00
340e2b9df2 Added Albanian translation 2019-04-14 09:40:46 +02:00
3486a7d7fc Added Albanian translation 2019-04-14 09:40:18 +02:00
e1d1004cd6 Added Albanian translation 2019-04-14 09:39:46 +02:00
8940de5956 Added Albanian translation 2019-04-14 09:38:58 +02:00
304af5055e Added Albanian translation 2019-04-14 09:38:06 +02:00
7c07ae6099 Added Albanian translation 2019-04-14 09:32:25 +02:00
1c39c85929 Added Albanian translation 2019-04-14 09:29:46 +02:00
5b07b25d62 Added Albanian translation 2019-04-14 09:28:49 +02:00
6bed09db57 Fix TE_DLIGHT documentation (#685)
There's no "brightness" parameter in TE_DLIGHT. Probably will cause server crash if it be passed.
2019-04-07 17:08:47 +02:00
ca69c36c1e Updated Portuguese Brazilian translation in miscstats.txt with latest additions (#674)
Updated Portuguese Brazilian translation in miscstats.txt with latest additions
2019-04-07 17:08:21 +02:00
f623126fe1 Improve documentation in engine_const.inc (#665) 2019-02-11 12:15:45 +01:00
f392c90729 Fix documentation (#678)
* Lack register_event() on event_enable/disable

Lack register_event() on enable_event and disable_event descriptions

* It shoud be m_iJoiningState not m_iJointState

It shoud be m_iJoiningState not m_iJointState
2019-02-11 12:13:19 +01:00
fd64327313 Revert RETURN_META(MRES_HANDLED); (#662)
#554 (Revert "Fun: Make TraceLine a post forward") did not fully revert back TraceLine. RETURN_META(MRES_HANDLED); was added by #421 (Update Fun module) but still remains there.
2019-01-30 16:04:11 +01:00
38cd5ab1cd Fix back/next/exit buttons not translated in plugin's cvar/command menus (#667)
* Menu buttons stayed english in Plugin's cvar/command menus

That worked, but if there is any better solution to get it working feel free to edit :D

* Changed language parsing to %L
2019-01-30 15:57:54 +01:00
5947926a09 Add player validation for menu_display (#671)
Invalid player triggered crash because get/set_pdata is unsafe
2019-01-30 15:19:30 +01:00
ea7ffafd88 Add square distance functions to xs.inc 2019-01-26 09:41:45 -03:00
ba083deb1e Removed garbage generated by VS (#658) 2019-01-24 21:13:48 +01:00
f365c943b7 Updated Hungarian translation in miscstats.txt with latest additions (#661) 2019-01-24 21:12:32 +01:00
9417ec188d Fix typo in json_parse documentation (#663)
Just a small fix on json_parse return description. I'm sure it was supposed to be `Invalid_JSON` instead of `Invalid_JSONValue`.
Thank you, guys, that's one of my favorites features.
2019-01-24 21:09:15 +01:00
af56d964c1 Bump ReHLDS version to 3.5 (#647) 2018-12-18 10:16:33 +01:00
7c7ad3d3c0 Fix again a menu regression (behavior change) due to typos in #471 (#636) 2018-11-02 14:16:57 +01:00
bb84a43a7b Fix a navigation bug in Plugin Cvars menu (#637) 2018-11-02 14:16:36 +01:00
20d917a307 Port bugfix for incorrect heap deallocation on conditional operator (#627)
* Revert 4f8917ec (experimental bugfix for heap in conditional)

* Port bugfix for incorrect heap deallocation on conditional operator (ported from compuphase upstream)

* Fix the upstream bugfix

Fixed the wrong order of heaplist nodes and the incorrect calculation of the max. heap usage.

* Add an additional pass for functions that return array if they are used before definition (inside definition (recursion) is a "before definition" situation too)
2018-11-02 14:15:31 +01:00
77eb33d5f2 Compiler: Fix undefined symbol: pow10 (#615)
* Compiler: Fix undefined symbol: pow10

* Add version check

* Remove deprecated pow10
2018-10-14 17:44:59 +02:00
75cf5f55f9 Make UTF-8 safe others strings natives (#610) 2018-10-14 17:44:15 +02:00
fb615aaef1 Compiler: Increase the maximum number of array dimension (#584)
* Compiler: Increase the maximum number of array dimension to 4

* Compiler: Fix array initialization
2018-10-13 15:05:04 +02:00
7f7d01fb8d Major Update to german translation (#620)
* Update miscstats.txt

#618

* Update statsx.txt

#618

* Update and rename mapchooser.txt to admincmd

* Rename admincmd to mapchooser.txt

* Update admincmd.txt

* Update common.txt

* Update multilingual.txt

* Update multilingual.txt

* Update scrollmsg.txt

* Update statscfg.txt

* Update adminchat.txt

* Update adminhelp.txt

* Update adminvote.txt

* Update cmdmenu.txt

* Update common.txt

* Update mapchooser.txt

* Update mapsmenu.txt

* Update menufront.txt

* Update miscstats.txt

* Update multilingual.txt

* Update nextmap.txt

* Update pausecfg.txt

* Update plmenu.txt

plmenu.txt adresses only the behaviour in the "Menü", not the text in the chat!

* Update restmenu.txt

* Update scrollmsg.txt

* Update stats_dod.txt

* Update statscfg.txt

* Update statsx.txt

* Update telemenu.txt

* Update timeleft.txt

* Update admincmd.txt

* Update plmenu.txt

* Update adminchat.txt

* Update admincmd.txt

* Update mapsmenu.txt

* Update miscstats.txt

added changes due to PR #611 !

* Update miscstats.txt

* Update pausecfg.txt

* Update admincmd.txt

* Update statscfg.txt
2018-10-12 21:04:14 +02:00
87b6f274a0 CS Miscstats: Fix enemy remaining option displaying the message to the wrong team (#611) 2018-10-11 11:12:06 +02:00
0b5584a334 Fix missing files in PackageScript from previous commit 2018-09-28 18:31:48 +02:00
f82455dd84 Move hamdata.ini to gamedata (#597)
* Replace atoi by strtol in the config parser

* Move hamdata.ini data to gamedata files

* Reference the new files in master file

* Remove all the parsing code and use config manager to get the offsets

* Remove any hamdata.ini references
2018-09-28 16:51:54 +02:00
8717ffe07c Implement menu_create "ml" param to allow menu title/item to be looked up as multilingual key (#593)
* Clean up menu_create() internal code

No code changes. Just modernizing code a little and tidying up things.

* Implement menu_create() "ml" param

* Include newmenu.inc to VS project files

* Adjust documentation

* Put back the quote in the log error message.
2018-09-28 16:46:52 +02:00
b4768a3d1d Add a bunch of constants to define max lengths (#566)
* Add constants for max IP and SteamID length

* Change max authid length to 64

* Fix port typo

* Add more defines

* Remove max query length
2018-09-28 16:43:41 +02:00
f1f95425b6 Fix a crash with set_tr/2 when -1 is passed in TR_pHit + allow worldspawn (0) in set_tr/2 (#601)
* Fix a crash with set_ptr2 when -1 is passed in TR_pHit

* Allow wordspawn in set_tr|2(TR_pHit, ...)
2018-09-28 16:39:03 +02:00
49430082f5 Fixed a typo in get_user_flags description (#605)
* Fixed a typo in get_user_flags description

* Remove
2018-09-28 16:36:19 +02:00
22fd09efea Add constants for get_user_origin() (#604) 2018-09-28 16:22:21 +02:00
e8c8111178 Put back <time.h> from previous commit 2018-09-23 23:14:33 +02:00
08213d8ead GeoIP: Add "reload" command (#588)
* Add reload option

* Adjust logic

* Modernize the code a little
2018-09-23 23:01:49 +02:00
c3225afda1 Additions to hlsdk_const and cstrike_const (#573)
* Additions to hlsdk_const

Added values to hlsdk_const using regamedll_cs and reapi as reference.

* Update cstrike_const.inc

* Prefix constants with CS_ to avoid name collision and for consistency
2018-09-23 22:59:18 +02:00
dfbeec069c Fix invalid handle passed in the SMC/INI parser callbacks (#592) 2018-09-20 23:32:41 +02:00
a54b9f05a7 Compiler: Fix broken UTF8 support (#329) 2018-09-20 20:27:15 +02:00
1f0dc33875 Fix typo in json_object_get_value_at documentation (#587) 2018-09-16 20:03:39 +02:00
8d1f924248 Upload amxmodx-latest-<package>-<os> text file when packaging. (#585) 2018-09-14 20:21:47 +02:00
5694acf482 Compiler: Fix an issue related to passing arrays based on an enumeration to a function (#582) 2018-09-14 15:47:11 +02:00
8f88dc5ac8 Fix admin chat displaying the wrong language (#559)
* Fix admin chat displaying the wrong language

* Switch %L to %l

* Improve loop

* %L to %l again

* Change git add . to != 0
2018-09-11 20:19:28 +02:00
b1b053c205 Bump version 2018-09-11 00:48:15 +02:00
c9e9ef905e Promote git revision number to 4th version string component 2018-09-11 00:46:07 +02:00
8a720a7d6a Another stab at Windows build fix. 2018-09-09 07:40:58 -04:00
d2d121619f Another attempt to fix windows compilation (#556) 2018-09-08 21:12:57 +02:00
9a2c586720 Attempt to fix windows compilation (#555)
* Attempt to fix windows compilation

* Testing mysql-c-connector
2018-09-08 20:21:53 +02:00
579a83c2a4 Fix vault.inc documentation (#550)
* Fix vault.inc documentation

* Add missing *

* Fix typos
2018-09-08 09:42:17 +02:00
b4927bfb1f Revert 1e3832a942ade577d39463979441651b13a5eee4 (#554) 2018-09-08 09:41:29 +02:00
9a95fd9886 Add cs_get_weaponbox_item native (#548)
* Add cs_get_wpnbox_weapon native

* Rename native + fix strcmp check
2018-09-07 09:01:47 +02:00
99ebd62653 Update Hamsandwich for Sven Coop 5.17 (#452)
* Remove dropped functions

* Update existing offsets

* Add some logic to prevent the use of removed functions.

* Add Ham_SC_AddPoints and Ham_SC_AddPointsToTeam

* Add Ham_SC_GiveAmmo

* Add Ham_SC_FVisibleFromPos

* Fix an old typos with CanPlaySentence for all mods

* Add Ham_SC_CanPlaySequence

* Add Ham_SC_PlayScriptSentence

* Add Ham_SC_StartPlayerFollowing

* Fix CanPlaySequence hamdata.ini (SC)

* Add Ham_SC_StopPlayerFollowing

* Fix handlers from previous commits

* Add Ham_SC_PreSpawn

* Add Ham_SC_PostSpawn

* Add Ham_SC_OnKeyValueUpdate

* Add Ham_SC_SetClassification

* Add Ham_SC_MyCustomPointer and Ham_SC_MyItemPointer

* Add Ham_SC_IsSneaking

* Add Ham_SC_IsAlive

* Add Ham_SC_IsBSPModel

* Add Ham_SC_ReflectGauss

* Add Ham_SC_HasTarget

* Add Ham_SC_IsInWorld

* Add Ham_SC_IsPlayer

* Add Ham_SC_IsNetClient

* Add Ham_SC_IsBreakable

* Fix Ham_SC_IsMonster, Ham_SC_IsPointEntity, Ham_SC_IsMachine and Ham_SC_CriticakRemove handlers

* Add Ham_SC_OnControls

* Fix Ham_SC_TakeHealth and Ham_SC_TakeArmor handlers

* Add Ham_SC_IsTriggered

* Add Ham_SC_RemovePlayerItem

* Fix typo

* Fix Ham_SC_IsMoving handler

* Add Ham_SC_SUB_UseTargets

* Ham_SC_IsLockedByMaster

* Add Ham_SC_FBecomeProne

* Fix Ham_SC_FVisible handler

* Add Ham_SC_FVecVisible

* Fix Ham_SC_FVisibleFromPos handler

* Fix Ham_SC_IsFacing handler

* Add Ham_SC_SetPlayerAlly

* Add Ham_SC_OnSetOriginByMap

* Add Ham_SC_IsRevivable

* Add Ham_SC_BeginRevive and Ham_SC_EndRevive

* Update offsets based on SvenCoop v5.17

* Add Ham_SC_Item_CanCollect and Ham_SC_Item_Collect

* Add Ham_SC_Item_AddToPlayer

* Add Ham_SC_Item_AddDuplicate

* Add Ham_SC_Item_AddAmmoFromItem

* Add Ham_SC_Item_GetItemInfo

* Add Ham_SC_Item_CanDeploy, Ham_SC_Item_Deploy and Ham_SC_Item_CanHolster

* Add Ham_SC_Item_UpdateClientData

* Add Ham_SC_Item_GetRespawnTime

* Add Ham_SC_Item_CanHaveDuplicates

* Add Ham_SC_Weapon_ExtractAmmoFromItem

* Add Ham_SC_Weapon_GetAmmo1Drop and Ham_SC_Weapon_GetAmmo2Drop

* Add Ham_SC_Weapon_FinishReload and Ham_SC_Weapon_ShouldReload

* Fix Ham_SC_IsMultiplayer, Ham_SC_FRunfuncs and Ham_SC_FCanRun handlers

* Add Ham_SC_Weapon_AddWeapon, _PlayEmptySound, _IsUsable, _ShouldWeaponIdle and _UseDecrement

* Add Ham_SC_Item_GetPickupSound

* Add Ham_SC_Item_InactiveItemPreFrame and Ham_SC_Item_InactiveItemPostFrame

* Add Ham_SC_Item_DetachFromPlayer

* Fix Ham_SC_Player_IsConnected handler

* Add Ham_SC_Player_EnteredObserver, Ham_SC_Player_LeftObserver and Ham_SC_Player_IsObserver

* Fix sc_postpawn typo (should be sc_postspawn)

* Add few more assert
2018-09-06 17:09:10 +02:00
0894027cb5 Updated readme (#539)
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Fixes after review

* New snapshots link

* Le perfectionnisme
2018-09-04 19:31:23 +02:00
582df637ce Compiler: Add __FILE__, remove __BINARY_PATH__ and rename __BINARY_NAME__ to __BINARY__ (#546)
* Compiler: Add __FILE__ and remove __BINARY_PATH__ constants

* Compiler: Rename __BINARY_NAME__ to __BINARY__
2018-09-03 21:28:28 +02:00
c16bd47b30 Remove GetModelCollisionBox, SetModelCollisionBox and SetModelBoundingBox natives (#536) 2018-09-03 18:49:49 +02:00
c6c4e79b96 Don't reset m_iMenu if player is not fully joined (#537) 2018-09-03 18:39:08 +02:00
76e92ae3a1 Add CONTRIBUTING and ISSUE_TEMPLATE (#534) 2018-09-02 20:35:42 +02:00
80cf45d234 Adjust version for manual build and update VS projects (#543) 2018-09-02 20:34:40 +02:00
736efdb370 Adjust version 2018-09-02 13:12:59 +02:00
8c0f97d6bb Fix typo in fun include (#541) 2018-09-01 18:51:14 +02:00
e0ca2c967c Fix a windows compilation warning in socket module (#538) 2018-09-01 12:30:12 +02:00
879b061bc8 Make the "body" param in get_user_aiming() optional (#532)
* Make the body param optional

* Add HIT_ constant note
2018-08-30 20:26:39 +02:00
1a2dd9e7ea Update Fun module (#421)
* Fun: Replace ENTINDEX with TypeConversion for consistency

* Fun: Add a class wrapping player's data

* Fun: Make TraceLine a post forward

Reason: as it is it breaks plugins hooking TraceLine because of the original game call is being superceded and other modules can't catch it. It looks like it's this way from the very start fun module has been introduced 13 years ago before. Fakemeta module comes a little later.

* Fun: Clean up code

* Fun: Toggle PlayerPreThink forward on demand

* Fun: Toggle TraceLine forward on demand

* Fun: Add HITZONE* constants for use with set/get_user_hitzone()

* Fun: Refactor a litte the player class

* Fun: Clean up a little more

* Fun: Fix typo in set_user_hitzones from previous commit
2018-08-30 19:16:19 +02:00
6e9947b64f Sanitize load_amxscript() and add load_amxscript_ex/MF_LoadAmxScriptEx() requiring error max length (#530)
* Add a saner version of load_amxscript and use SafeStrcpy/Sprintf

* Reflect the change in core

* Add LoadAmxScriptEx API function

* Reflect the change in CSX

* Reflect the change in DodX

* Reflect the change in TFCX

* Reflect the change in TSX

* Add few comments
2018-08-30 18:49:42 +02:00
76378fd5d0 Add get_playersnum_ex (#517)
* Allow get_players to get the players num only

* used empty brackets instead of zero

* Add get_playersnum_ex stock to amxmisc.inc

* Added missing empty brackets

* Remove brackets from get_players

* Fixed a typo in function description

* Change letters to flags in get_playersnum_ex description
2018-08-30 18:43:05 +02:00
189f16fcc4 Add stat constants in plugins (#522)
* Add stat constants in plugins

* Add missing include in dodstats.sma

* Fix misplaced HIT_RIGHTLEG constant
2018-08-30 18:41:49 +02:00
56e8dcf3d5 Update Zlib to v1.2.11 (#527)
* Update Zlib to v1.2.10

* Adjust config for linux/mac
2018-08-27 21:35:24 +02:00
8762b578ff Update SQLite library to v3.24.0. (#525) 2018-08-27 18:21:57 +02:00
9e2c76abdc Update libmaxminddb to v1.3.2 (#526)
* Update libmaxminddb to v1.3.2

* Move PACKAGE_VERSION declaration
2018-08-27 15:42:35 +02:00
c820db4dc7 Add GeoIP data update to the automatic build system (#524)
* Add GeoIP data update to the automatic build system

* Apply few fixes
2018-08-27 15:06:59 +02:00
1ddf199e71 Fix AppVeyor (#528) 2018-08-27 14:36:38 +02:00
46d1ef68bd Build assembly files with AMBuild. (#481)
* Remove prebuilt nasm-generated object files from the tree, and use AMBuild to compile them.

* Add commands in VS project to build the object files

* Rename elf to elf32 for consistency
2018-08-26 20:28:25 +02:00
9bcabfeb1f Add or adjust a bunch of safety checks (#433) 2018-08-26 17:18:39 +02:00
8aeefc3fca Add constants for stats functions (#509)
* Add constants for stats functions

* Changed STATS_ to STATSX_ and added 2 more defines

* Added constants for all games

* Add csstats_const.inc and add _MAX_ constats to enum

* Change bodyhits
2018-08-25 20:52:48 +02:00
197db8c82b Update AMTL from upstream (#521) 2018-08-25 11:29:54 +02:00
f822cc610f Update ReSDK API to latest version (#520) 2018-08-25 09:20:06 +02:00
ce14df0c77 CStrike: Fix a missing RemoveEntityHashValue function address check (#519) 2018-08-25 09:18:51 +02:00
605d1a5b1e Fix callback from amx_clientcmd not working properly (#518) 2018-08-25 09:18:39 +02:00
ac57ed5b44 Add get_user_rendering (#514)
* Add get_user_rendering

* Added & in arguments

* Changed zeroes to kRender constants

* Changed zeros to kRender constants
2018-08-25 09:18:25 +02:00
6528677dcc Add @note in get_user_msgid() (#506)
* Update lang.inc

* Update lang.inc

* Update amxmodx.inc

* Improve @note phrasing
2018-08-20 19:50:43 +02:00
0765dc8a0d Improve messages.inc and message_stocks.inc documentation (#510)
* Improve messages.inc and message_stocks.inc documentation

* Fix typos

* Fixed typos, added a bunch of @notes and better register_message callback function explanation

* Removed extra argument in set_msg_arg_string

* Creates => Sends
2018-08-20 19:49:47 +02:00
eff74fe862 Execute amxx.cfg before plugin_init to keep compatibility (#512) 2018-08-20 19:46:26 +02:00
05b74111d3 Allow arrayset to accept any type (#516) 2018-08-20 19:46:00 +02:00
0bfc65c635 Add default values for menu_item_getinfo (#511) 2018-08-09 15:38:58 +02:00
a784a34561 Fix documentation (#513) 2018-08-09 15:37:24 +02:00
faf7da4c2c Fix a buffer issue in EngFunc_LightStyle (#508) 2018-07-28 21:35:34 +02:00
9700caefae Fix client_print_color where the color is ignored if string starts with an unicode character (#504) 2018-07-24 15:45:50 +02:00
4ae31f6f26 nvault.inc documentation fix (#501)
* Update lang.inc

* Update lang.inc

* Update nvault.inc

* Update nvault.inc
2018-07-24 15:36:31 +02:00
57abc4a1c5 Fix a compilation regression in LookupLangKey (introduced with #222) (#499) 2018-07-24 10:37:56 +02:00
7062d210a7 fix hlsdk_const.inc identation (#502)
a copy past from reapi hlsdk_const.inc file
2018-07-24 10:37:19 +02:00
a9ce39dee0 Fix a buffer issue in server_changelevel forward caused by engine_changelevel native (#503) 2018-07-24 10:37:05 +02:00
98ab26671c Add MPROP_SHOWPAGE (#473) 2018-07-18 17:10:37 +02:00
fba3d706fc Normalize EOL of few files changed in #489 2018-07-18 14:39:53 +02:00
5f5d6f1d5d Fix a buffer issue in RegisterHam (#495)
* Fix a buffer issue in RegisterHam

* AString classname as well
2018-07-13 16:23:03 +02:00
975d877800 Fix typos in few localinfo identifiers for the AMXX config directory retrieval (#496) 2018-07-13 12:18:16 +02:00
afbb3b88d7 Further Hungarian translation update (#494)
* Hungarian language update

The important parts have been updated* and the missing parts added according to my best knowledge.

*admincmd.txr was UTF8 instead of UTF8 without BOM, I'm not sure it was a mistake or not.

* Further Hungarian translation update

Further grammar and typo fixes in Hungarian translation.

SERVER_PROC - Unused in admincmd.sma and .txt too.
2018-07-12 14:40:48 +02:00
92ebb6ef05 Add link to API reference in README (#493)
* Add link to API reference

* Update README.md

* Update README.md
2018-07-12 10:17:49 +02:00
a87eb50441 Fix missing register_event() reference on event_enable/disable descriptions (#491)
Lack register_event() on enable_event and disable_event descriptions
2018-07-12 00:09:23 +02:00
cec42bdcae API documentation fix for some .inc files (#489)
* Fixed param information

* Removed whitespace that prevented the API to generate client_disconnected information

* Fixed documentation.

* Update lang.inc

* Documentation fix

(g/s)et_user_hitzones() functions weren't generating properly in the API due to a whitespace in front of the comment blocks. @return for give item() was missing.

* Whitespace prevented API documentation from generating

* Update lang.inc
2018-07-10 14:42:45 +02:00
651745b1d4 Updated compiler exitcodes (#486) 2018-07-10 12:27:27 +02:00
fc337d12a4 Hungarian language update (#474)
The important parts have been updated* and the missing parts added according to my best knowledge.

*admincmd.txr was UTF8 instead of UTF8 without BOM, I'm not sure it was a mistake or not.
2018-07-10 12:10:25 +02:00
387dc6a188 Fix a menu recursion issue (#471)
* Factorize menu close logic in show_menu()

* Use CS-specific player's m_iMenu offset instead of menuselect command
2018-07-10 12:09:20 +02:00
528fec1a29 Macedonian & Bulgarian translation fix (#477)
* Macedonian & Bulgarian translations fix

* Macedonian & Bulgarian translations fix
2018-07-10 12:02:47 +02:00
339a27579d Improved mprop description (#478) 2018-07-10 11:59:53 +02:00
66e3fa6db2 Fix typo (#488) 2018-07-10 11:57:37 +02:00
42b351127d Fix for precache_event (#490) 2018-07-10 11:50:31 +02:00
2559fcf00a Fix: fakemeta hook not being unregistered (#483) 2018-03-09 19:39:14 +01:00
7c4688f557 Comment MODULE_RELOAD_ON_MAP_CHANGE on modules that use USE_METAMOD (#484)
Currently amxmodx doesn't reload modules that use metamod, so MODULE_RELOAD_ON_MAP_CHANGE being defined or not doesn't make any difference.
Even though this commit currently doesn't change any behavior, amxmodx might in the future support reloading modules that use metamod, and all these modules in their current state either fail completely because of erroneous cleanup, or are untested (and most likely leak stuff).
Furthermore, these changes make it clear that these modules are in fact not being reloaded.
2018-03-09 19:37:46 +01:00
65df386d66 Fix OnPluginsUnloaded not being called for reloadable modules. (#485)
Modules are loaded before plugins, and can hook OnPluginsLoaded. Therefore, they should be unloaded AFTER plugins, and be able to hook OnPluginsUnloaded. This was not the case for reloadable modules.
This affects nvault module, whose OnPluginsUnloaded function wasn't being called.
2018-03-09 19:32:30 +01:00
7b3646a012 Update include files documentation (#360)
* Update include files documentation

* Fix inconcistencies with spaces/tabs, some changes

* Update fun, nvault, vector

* Update sqlx.inc
2017-12-09 00:22:43 +01:00
5632420827 Add wrappers for natives with string flags (#389)
* Add wrappers for natives with string flags

* Add default/none constants, update docs
2017-12-08 00:06:37 +01:00
d6e71c8f4f Little cleanup (#461)
* Remove FAKEMETA leftovers

* Move "require_module" native to where it belongs

* Remove broken AMX module support

* Remove useless natives

* Remove "alloc_amxmemory" and "free_amxmemory" functions

* Remove "strip_name" function

* Clean engine a bit

* Export "GiveFnptrsToDll" (Windows) (Core)

* memcpy -> ke::SafeStrcpy

* Export GiveFnptrsToDll in modules

* Update msvc project files
2017-12-07 18:45:16 +01:00
d2e736b10a Strip whitespace when reading product.version (#470) 2017-12-06 15:29:06 +01:00
a69a015189 Fix open_dir not working properly when called recursively (#467) 2017-11-27 12:08:51 +01:00
ac3e2f48d1 Fix mac build 2017-11-26 20:43:20 +01:00
6d8975f9fc Add -ltr flag to mysql in order to lower glibc requirement (#468) 2017-11-26 20:34:40 +01:00
175d49293c Bump MySQL version to 5.5 (#466)
* Bump MySQL version to 5.5

* Let's see how Travis-CI goes

* Let's see how AppVeyor goes

* Adjust windows library path
2017-10-31 23:06:30 +01:00
7fe7cd746f Fix unreachable code (#465) 2017-10-28 16:27:39 +02:00
5a2d940631 Fix utf8rewind compilation with GCC 2017-10-14 14:25:21 +02:00
0689c664d7 Fixed passing a temporary string to LIGHT_STYLE (#464) 2017-10-08 21:57:12 +02:00
779a4d9e59 Fix #395 backward compatibility issue by adding SetParamEntity2 native (#463) 2017-10-05 11:46:05 +02:00
97df408d51 Fix a crash on the same newmenu overlapping (#462) 2017-10-03 20:43:30 +02:00
361a6cc9e0 Introduce a JSON module (#379)
* Add JSON module

* Merge upstream changes

Fix memory leaks

* Add json include to PackageScript

* Merge upstream changes

Fix memory leaks and increase max nesting

* Fix documentation

* Use AutoPtr in managing JSON handles

* Merge upstream changes

Order of items in an array is preserved after removing an item.

* Merge upstream

* Fix crash

* Add VS projects files and fix mixed tab/spaces

* Remove erroring on "json_free"

* Add comments to "json.inc" file

* Remove overloaded operators

* Use of "override" keyword where needed

* Fix parameter's name
2017-09-30 20:23:12 +02:00
f96cb9a3b6 Use smart pointers in NativeHandle class (#457)
* Use AutoPtr in natives handles

* Use size_t type instead of int in natives handles

* Use pre decrement operator in destroy method
2017-09-25 16:52:12 +02:00
604ecbd31e Fix build clang 3.9+ (#458)
* clang 4.0: fix ordered comparison between pointer and zero

* clang 4.0: fix taking address of packed member

Maybe someday someone will properly fix it

* clang 3.9: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior

Someday proper fix?
2017-09-25 15:22:53 +02:00
feba821306 Fix a typo in equali, strcmp and strncmp natives (#459) 2017-09-12 21:00:26 +02:00
4fc58e6afd Minor fixes in configs files. (#455)
* Missing amx_help_display_msg_time var in amxx.cfg

* Missing vars in CS DOD TFC and TS core.ini

* Standardization to others file location comments in clcmds.ini

* Missing account flag comments + typo errors in NS users.ini
2017-09-01 15:23:49 +02:00
38008a8e03 Fix amx_plugins throwing errors (#456) 2017-09-01 15:18:23 +02:00
ba58cb045f Adjust 'amxx cvars' command output (#453) 2017-08-07 23:42:41 +02:00
8e7eb94e50 Overhaul Restrict Weapons plugin - part 1 (#347)
* Restmenu: Use CS_OnBuyAttempt forward to detect any buy attempt - part 1

- Removed any useless code which won't be needed anymore with forward. A lot!

* Restmenu: Use CS_OnBuyAttempt forward to detect any buy attempt - part 2

- Added the actual forward
- Because of forward passing a CSI_* constant, it's needed to refactor how is saved a blocked item. Not fully implemented everywhere because menu is going to be refactored later as well.

* Restmenu: Replace findAliasId() by cs_get_item_id()

* Restmenu: Use cvar pointers

* Restmenu: Refactor menu - part 1

Purpose:
  - Convert old menus to new menus.
  - Instead of having one menu with several pages, having one main menu (item types) and sub-menus (items list). More readable, more easy to naviguate and no pagination.
  - Move hardcoded strings to ML

* Restmenu: Refactor menu - part 2

Purpose:
  - Convert old menus to new menus.
  - Instead of having one menu with several pages, having one main menu (item types) and sub-menus (items list). More readable, more easy to naviguate and no pagination.
  - Move hardcoded strings to ML
  - Minor visual improvements

* Restmenu: Refactor podbot stuff

- Factorized code
- Used a more direct way to set restrictions

* Restmenu: Refactor load/save config file

- Used new file natives
- Moved harcoded message header to ML
- QoL: saved restricted items will be grouped per type
- Cleaned up few things

* Restmenu: Refactor amx_restrict command

- Minor improvements on how are retrieved/handled arguments from command.
- Same as menu, it displays first classes list, then it lists associated items. No more pagination.
- Minor visual changes.

* Restmenu: Remove unused stuffs

* Restmenu: Move more harcoded messages to ML

* Restmenu: Move MAPSETTINGS define to cvar

- Don't forget me in changelog
- There is room for improvements but for now keep the same behavior

* Restmenu: Add some consistency, no code change

- Renamed some variables
- Changed functions order
- Removed extra spaces
- Fixed leading tabs

* Restmenu: Use inline formatting at various places

* Restmenu: Make command descriptions multilingual for player

* Restmenu: Refresh opened menus if the command is used to save/load/set.

Also, I've removed the renaming of "exit" item because it was misleading as it returns MENU_EXIT when it's named with "back" and handling the action wiht that doesn't make much sense.

* Restmenu: Adjust minor things (consistency, readability, safety)

* Restmenu: Show the current category when items are listed through the command

* Restmenu: Display admin activity on loading/saving

+ load: reset blocked items only if file has been loaded
+ load: ignored if no arguments
+ save: added a silly fix because of the cvars
2017-08-05 10:45:29 +02:00
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
07c3d49cfa Add amx_searchcmd command in adminhelp plugin and do some clean up (#415)
* AdminHelp: Use semicolon everywhere

* AdminHelp: Translate amx_help description

* AdminHelp: Use the available ADMIN_ALL define in register_concmd

* AdminHelp: Bind the cvars

* AdminHelp: Replace %L by %l

* AdminHelp: Remove task only when necessary

* AdminHelp: Reorder some lines to prepare next commit

* AdminHelp: Use read_arg_int() on the first argument and clamp the value

* AdminHelp: Use read_arg_int() on the second argument and clamp the value

* AdminHelp: Rename few variables and callback

* AdminHelp: Use constants for buffers max length

* AdminHelp: Add amx_searchcmd command, and update the multilingual file

* AdminHelp: Adjust spacing a little for readability

* AdminHelp: Add amx_help_display_msg_time cvar

* AdminHelp: Add the new command in the help message (and fix missing return)

* AdminHelp: Add a check if provided entry no. goes above the total found entries

* AdminHelp: Don't show the help message for begin if all commands are already displayed

* AdminHelp: Make sure the server command use amx_help_amount_per_page value
2017-08-01 22:56:21 +02:00
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
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
304e992942 Fix broken cs_set_user_model update_index parameter for the default engine (#450) 2017-07-29 17:01:34 +02:00
4fcfc913d3 Fix Ham_Item_GetItemInfo incorrect associated handler (#449) 2017-07-26 20:36:17 +02:00
c6eb62ccbc Make module loading more safe 2017-07-22 14:36:13 +03:00
6bd2f1feec Fix a engclient_cmd and amxclient_cmd buffer issue (#438) 2017-07-21 23:44:05 +02:00
aa9ec3f872 Fix client_disconnected isn't called on mapchange when ReHLDS API enabled (#446) 2017-07-03 21:52:38 +02:00
f7f86fb040 Rename suki to key_index (#445) 2017-06-28 18:31:59 +02:00
5ad72374cd Cstrike: Get offset for m_bMapHasBombTarget (#443)
* Cstrike: Get offset for m_bMapHasBombTarget

* Add mising entities to common.games/master.games.txt
2017-06-21 10:07:26 +02:00
b7cb555cee Fix a comment typo in core.ini 2017-05-28 22:48:56 +02:00
66cc8dcdaf Minor flagman cleanups (#442)
* Document disableflagman

* Add disabled check, random cleanups
2017-05-28 22:39:44 +02:00
c0011891e6 Fix temporary ban flags, add lang keys (#440) 2017-05-27 21:47:24 +02:00
ac7de68ac7 Fix amx_addban and amx_unban, make them safe (#441) 2017-05-27 16:28:15 +02:00
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
7794f27dc2 Fixed bug in cmd_access with usage printing (#434) 2017-05-02 12:54:07 +02:00
1a56577f7a Fix inc/dec operators not returning an iEXPRESSION (#429)
* Fix inc/dec operators not returning an iEXPRESSION

* Fix inc/dec operators in return statement
2017-04-29 23:33:09 +02:00
be3ae83c44 Update get_func_id description (#430)
Return id 0 on success too
2017-04-29 21:13:29 +02:00
398983fc49 Update amxmodx.inc (#432) 2017-04-29 20:56:20 +02:00
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
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
2d049b7ff3 Fix signed/unsigned mismatch warning (#428)
* Fix signed/unsigned mismatch warning

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

* Update test plugin
2017-04-04 10:29:18 +02:00
ff488dd81f Add new xs stocks (#426)
xs_vec_len_2d returns the length of a 2D vector

xs_vec_distance returns the distance between two vectors
xs_vec_distance_2d returns the distance between two 2D vectors

xs_vec_add_scaled and xs_vec_sub_scaled do two operations
in one for convenience and performance. They add/subtract a vector
scaled by a scalar to another vector. Very useful when working with
unit vectors.
2017-04-03 18:41:46 +02:00
da80667fb0 Ignore ReHLDS initialization on listenserver (#425)
* Remove duplicated files

* Ignore ReHLDS initialization if not a dedicated server
2017-03-19 14:12:07 +01:00
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
fa3d28872e Replace s/get_pdata* with s/get_ent_data* in plmenu.sma (#424) 2017-03-11 14:58:10 +01:00
d23d9b1ba8 Fix missing ReGameDLL check in GetItemPrice() (#423) 2017-03-11 10:49:37 +01:00
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
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
1c3e8de57a Introduce a datapack position tag (#419) 2017-03-06 21:08:16 +01:00
b7773ba11f Fix sockets crash (#418) 2017-03-04 14:14:08 +01:00
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
7a7d0442aa Fix VS project file (#416) 2017-02-26 21:15:53 +01:00
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
b973d24081 Add missing buffer size check to SQLite QuoteString implementation (#411) 2017-02-23 13:56:58 +01:00
074af44ead Fix a potential crash in ArrayClone for too large arrays (#408) 2017-02-23 13:27:16 +01:00
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
3a73e12550 Update to the latest AMTL (#410) 2017-02-19 15:01:58 +01:00
c27bfcd7fe Fix client_death forward called on kill command if sent by a spectator (#404) 2017-02-18 19:53:58 +01:00
38b8dc338d Fix missing backward compatibility check in TrieGetString() and TrieGetArray() (#406) 2017-02-05 11:52:04 +01:00
7bb1849968 Sanitize servercfgfile and lservercfgfile values with amx_cvar (bug 6578). 2017-01-22 08:01:08 -05:00
ed672847f3 Remove support for %name% replacement in plmenu (bug 6578). 2017-01-21 22:58:03 -05:00
56210f3e96 Quote custom vote winning value (bug 6578). 2017-01-21 22:57:37 -05:00
5519dd0a14 Do case-insensitive compare when filtering password vars in votes (bug 6578). 2017-01-21 22:38:38 -05:00
7589c6c578 Quote args in amx_addban, amx_unban, & amx_exec (bug 6578). 2017-01-21 22:36:57 -05:00
a7c3e34fbe Fix Warning from MSVC: 'Double to Float precision loss' (#402) 2017-01-21 20:58:33 +01:00
f5e734f636 Fixed is_visible native (#392) 2017-01-17 15:52:49 +01:00
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
9b3839de70 Fix missing CS_NORESET constant (#400) 2017-01-10 18:51:41 +01:00
faa9f6ea9f Fix returning strings from variadic functions (lost changes) (#399) 2017-01-09 20:40:28 +01:00
3e660011b2 Fix typo in TE_STREAK_SPLASH description (#398) 2017-01-06 21:05:36 +01:00
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
6473118b24 Fixed entity param changing in hamsandwich (#395) 2017-01-02 09:38:43 +01:00
615ecdf7f3 Fixed grammar for Start Voting mapsmenu.txt lang (#393)
This is bad, what it currently means `Votacao Iniciada` (Votação Iniciada) in english is `The voting has been started`, instead of `Start voting`.

The translator translate it back as `Voting Started`.
Translator link: https://translate.google.com.br/#pt/en/Vota%C3%A7%C3%A3o%20Iniciada
2017-01-01 11:28:11 +01:00
79d9fc530d Update AMTL (#390) 2016-12-31 23:49:46 +01:00
e3ae451c09 Add missing format param (#391) 2016-11-25 11:26:58 +01:00
4c8ef63383 Fix: leak memory from unregister_forward (#388) 2016-10-12 23:26:21 +02:00
e95099817b Allow execute forwards without need to create variable for returned value (#382)
We don't need to create variable to store value returned by forward when we ignore it.
2016-09-01 10:37:14 +02:00
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
a9557fe53d Use exponentiation by squaring instead of n-times multiplications in power() (#385) 2016-08-27 10:12:02 +02:00
ea43a61094 Update hashing library (#384) 2016-08-22 11:21:46 +02:00
e24b9548d4 Update to the latest AMTL (#381)
* Update to latest AMTL.

* Update .gitignore for VS2015
2016-08-12 15:30:06 +02:00
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
a53e7905db Extend amxx list command (#377) 2016-06-26 14:04:33 +02:00
861011fa24 Merge pull request #375 from voed/patch-1
Fixed some natives descriptions
2016-06-14 08:52:36 +02:00
575d215c77 Fixed some natives descriptions 2016-06-14 04:49:46 +03:00
294066ca61 Merge pull request #374 from Arkshine/fix/util_replaceall
Fix UTIL_ReplaceAll not properly tracking length.
2016-06-10 15:29:33 +02:00
2099a88ddf Fix UTIL_ReplaceAll not properly tracking length. 2016-06-06 12:09:42 +02:00
1662b47f7e Merge pull request #372 from Ni3znajomy/gcc6-fix-compilation
Fix compilation error for GCC 6
2016-06-05 19:51:27 +02:00
f3c58b7cd6 Merge pull request #369 from Ni3znajomy/forwards/value-by-reference
Values by reference in forwards
2016-06-05 19:50:40 +02:00
ce59a62f72 Update mapsmenu.txt 2016-05-11 16:27:50 +03:00
8658f722dd Update mapsmenu.sma
Essentially:

- Old Menus were replaced with New Menus.
- Most of old natives like 'format' were replaced with more specific natives like 'formatex'/'add'.
- Added 'Search' feature for both menus but it will reduce the number of items per page to 6 (mapmenu) or 5 (votemapmenu).
- Added 'Unselect' feature for votemapmenu, item will be now colored in red, not disabled like before (that was needed, it was very annoying when you would select a map, but you selected another because you could not unselect and you were forced to reopen the menu)


Hope you like it, this plugin is a core amxx plugin and because of inexistent feature of 'unselect' for votemapmenus is needing a rework.
Plugin was tested, in my opinion is fully functionally.
Just test it and enjoy the new features.
2016-05-11 16:20:32 +03:00
446a1a5108 Fix compilation error for GCC 6.1
Fix compilation error due -Wmisleading-indentation
2016-05-04 15:01:29 +02:00
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
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
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
af0afabfa0 Merge pull request #366 from Ni3znajomy/read_argv2
Extend "read_argv" native
2016-04-15 20:29:44 +02:00
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
ccf8026761 Merge pull request #367 from Arkshine/fix/engine-typos
Fix typos in entity_intersects() and get_global_edict2() natives
2016-04-11 11:28:19 +02:00
253dec94d1 Fix a crash after cs_set_user_model is used with model_index set. 2016-04-07 20:27:27 +02:00
53f9144fc3 Values by reference in forwards 2016-04-05 18:51:18 +02:00
d91144a10d Fix typos in entity_intersects() and get_global_edict2() natives 2016-03-31 19:37:12 +02:00
aaa2934595 Extend "read_argv" native 2016-03-28 20:05:56 +02:00
21c4886f90 Merge pull request #365 from Ni3znajomy/fix-docs
Fix description of "set_user_info" native
2016-03-23 17:43:56 +01:00
5ad1efd698 Fix description of "set_user_info" native 2016-03-23 17:27:15 +01:00
0bb5d86c20 Merge pull request #363 from Arkshine/update/clang-travis
Update TravisCI build to use Clang 3.7
2016-03-20 23:08:22 +01:00
94599e9b4e Update TravisCI build to use Clang 3.7 2016-03-20 23:02:15 +01:00
fdebeab612 Merge pull request #361 from alliedmodders/compile-fixups
Compile fixups for Clang 3.8
2016-03-20 22:36:56 +01:00
e6a2bc545c Merge pull request #362 from Ni3znajomy/update-message-stocks
message_stocks.inc: Cache messages id
2016-03-20 13:13:58 +01:00
5a3f4be04e message_stocks.inc: Cache messages id 2016-03-20 13:04:48 +01:00
79a6dc9501 Fix shift-negative-value warning on newer compiler versions.
error: shifting a negative signed value is undefined
2016-03-17 15:12:26 -04:00
19dd940b22 Fix pointer-bool-conversion warning on newer compiler versions.
error: address of array 'lval->sym->name' will always evaluate to 'true'
2016-03-17 15:10:55 -04:00
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
aa2caacf4c Replace INDEXENT and ENTINDEX by TypeConversion for consistency 2016-03-16 21:40:43 +01:00
ae4368a3ca Remove inline comment support in multilingual INI parser 2016-03-16 19:50:46 +01:00
4c7375555a Fix typo in cs_get_translated_item_alias() 2016-03-16 16:29:56 +01:00
28a0b0626b Fix incomplete sanity check in cs_get_weapon_info() 2016-03-16 16:29:56 +01:00
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
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
c3a52b366e Add cs_get_item_alias() native & cleanup alias datas 2016-03-16 12:29:33 +01:00
d4691bb799 Merge pull request #358 from Arkshine/fix/allow-null-invoker-playbackevent
Allow null invoker to be passed in EngFunc_PlayBackEvent (bug 6467)
2016-03-16 09:57:48 +01:00
494444a433 Allow null invoker to be passed in EngFunc_PlayBackEvent 2016-03-02 14:55:23 +01:00
f981aa34dc Merge pull request #355 from Arkshine/fix/typo-find_ent_in_sphere
Fix typo in find_ent_in_sphere()
2016-02-24 23:58:16 +01:00
c6024b93ce Fix typo in find_ent_in_sphere 2016-02-24 23:47:17 +01:00
8d89104241 Merge pull request #350 from Arkshine/feature/inline_fmt
Add fmt() native to format and return a string inline
2016-02-23 20:09:41 +01:00
be06e2448b Add fmt() native to format and return inline a string 2016-02-23 19:56:02 +01:00
f2272ab4cb Merge pull request #351 from Arkshine/fix/native-array-compilation
Fix issue where native functions returning an array would not compile
2016-02-23 19:41:43 +01:00
2c73268668 Fix issue where native functions returning an array would not compile 2016-02-22 23:37:09 +01:00
f8dd3c0efd Merge pull request #354 from Arkshine/update/tfc-vtable-linux
Fix TFC virtual functions offsets under linux
2016-02-19 18:30:50 +01:00
141f5effa3 Fix TFC virtual functions indexes under linux 2016-02-19 17:29:21 +01:00
721cc0ec5e Merge pull request #353 from Ni3znajomy/cstrike/cs_get_user_weapon
Add extra parameters to cs_get_user_weapon native
2016-02-17 21:21:34 +01:00
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
c11d8f033e Merge pull request #348 from Arkshine/update/ambuildscript
Refactor and cleanup the AMBuildScript a bit
2016-02-12 02:10:53 +01:00
23080b7455 Refactor and cleanup the AMBuildScript a bit 2016-02-12 02:05:17 +01:00
1d5fb4b9d1 Merge pull request #346 from Arkshine/featire/entindex-cleanup
Engine: Replace ENTINDEX with TypeConversion
2016-02-11 22:20:08 +01:00
1234528521 Engine: Replace ENTINDEX with TypeConversion 2016-02-11 22:07:01 +01:00
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
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
2a90fc0fe8 Merge pull request #336 from Arkshine/update/gameconfigs
Update GameConfig
2016-02-09 11:27:10 +01:00
2928c622f9 Add cs_set_ent_class native 2016-02-09 11:27:02 +01:00
696d842b07 Add info message when loading custom gamedata 2016-02-09 11:19:35 +01:00
b00ca9bb7a Merge pull request #345 from Arkshine/fix/engine-bcomp
Engine: Fix more bcompat for CHECK_ENTITY
2016-02-09 10:48:39 +01:00
6b5d26c9ce Merge pull request #352 from Ni3znajomy/fix-gamedata
Fix linux/mac GiveNamedItem and GiveDefaultItems symbols
2016-02-08 13:39:19 +01:00
f3ebe71dd1 Fix gamedata 2016-02-08 13:24:51 +01:00
07f87990ef Remove use of Vendor.behavior in AMBuild scripts 2016-02-03 22:53:40 +01:00
86d34e9bc5 Engine: Fix more bcompat for CHECK_ENTITY 2016-02-03 13:34:03 +01:00
664c25bdac Merge pull request #343 from Arkshine/fix/typo-lookuplangkey
Fix LookupLangKey retrieving invalid index
2016-02-01 21:32:23 +01:00
78619d3710 Fix LookupLangKey retrieving invalid index 2016-02-01 14:48:32 +01:00
cba4c74f94 Merge pull request #341 from WPMGPRoSToTeMa/master
Fakemeta: fixed bug with recursive pre hooks (one returned supercede …
2016-01-26 17:32:11 +01:00
3c74e72242 Fakemeta: fixed bug with recursive pre hooks (one returned supercede can supercede several hooks) 2016-01-26 01:34:45 +03:00
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
209ff4d527 Merge pull request #339 from IgnacioFDM/fix-whitespace
Normalize line endings and whitespace
2016-01-23 22:56:46 +01:00
fa7391e814 Merge pull request #330 from WPMGPRoSToTeMa/csgetuserweapon
Add cs_get_user_weapon_entity() and cs_get_user_weapon() natives
2016-01-23 17:53:54 +01:00
fafa1f11f0 Fix CS_OnBuy* not triggered from alias containing uppercase letters 2016-01-23 00:09:04 +01:00
06290483da Merge pull request #337 from Ni3znajomy/cvar_directset
Move Cvar_DirectSet to gamedata
2016-01-22 01:25:21 +01:00
0e8d876c5d Move Cvar_DirectSet to gamedata 2016-01-21 23:50:07 +01:00
e502e12e07 Normalize line endings and whitespace 2016-01-16 21:15:52 -03:00
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
307dab47c8 Merge pull request #326 from Arkshine/feature/enable-disable-logevent
Add enable/disable_logevent() natives
2016-01-16 12:18:59 +01:00
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
89dda4879b Merge pull request #335 from Arkshine/fix/closing-newmenus
Fix recursion issue with show_menu and newmenus
2016-01-16 12:17:02 +01:00
240c81e626 Improve client_print_color by inserting default color code at the start of string 2016-01-16 12:09:13 +01:00
33768740fa Fix LoadGameConfigFile returning valid handle on invalid path 2016-01-15 17:35:21 +01:00
f1a2a00d38 Allow gameconfig without master for convenience 2016-01-15 17:33:42 +01:00
e634e512c8 Fix recursion issue with show_menu and newmenus 2016-01-15 12:56:16 +01:00
98fb03dd30 Enable detours in ServerActivate to avoid sig conflict with third-party AMXX modules 2016-01-11 23:25:02 +01:00
af0042b71d Merge pull request #333 from Arkshine/update-gitignore
Ignore .opendb extension introduced with VS 2015 Update 1
2016-01-11 20:00:36 +01:00
9df5bd708e Ignore .opendb extension introduced with VS 2015 Update 1 2016-01-11 19:58:35 +01:00
5b54a24b4e Merge pull request #325 from flaviommedeiros/master
Avoiding directives that split up parts of statements.
2016-01-11 19:38:13 +01:00
4662109980 Fix an out of bound buffer index 2016-01-07 19:42:47 +01:00
b85b37192e New natives: cs_get_user_weapon_entity and cs_get_user_weapon 2016-01-06 23:10:31 +03:00
0af2c0e4c1 Merge pull request #328 from WPMGPRoSToTeMa/selinuxcompatibility
SELinux compatibility: memalign -> mmap
2016-01-04 17:27:09 +01:00
48d7a04c73 SELinux compatibility: memalign -> mmap 2016-01-03 21:38:31 +03:00
866339eff6 Merge pull request #327 from Arkshine/fix/replace_stringex
Fix typo in replace_stringex native
2015-12-24 23:13:04 +01:00
b0e5e8d331 Fix typo in replace_stringex native 2015-12-24 19:12:55 +01:00
17a31b75d7 Add enable/disable_logevent() natives 2015-12-24 19:08:00 +01:00
f796df783c Avoiding directives that split up parts of statements. 2015-12-24 12:42:34 -03:00
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
01d703cdbb Merge pull request #323 from luxxxoor/patch-1
Adding flag parameter to user_silentkill.
2015-12-24 14:45:45 +01:00
20959d1444 Merge pull request #322 from Ni3znajomy/feature/client-connecting
New client_connectex forward & extend client_authorized
2015-12-24 14:41:06 +01:00
62a5c54a18 Add client_connectex & extend client_authorized forward 2015-12-22 16:36:51 +01:00
892f0519ad Adding flag parameter to user_silentkill.
The api says that the user_silentkill() "Kills a user without a message.",  that means it is just user_kill() without sending deathmsg.
But user_silentkill() automatically kills player without affecting the client's score (and that is not mentioned in api), so i'll add a second parameter to user_silnetkill() to let user to decide if he want to kill a player without or not affecting the table.
New parameter has the default value 1, so it won't break the compatibility.
2015-12-20 01:02:39 +02:00
6a18f8007d Fix incorrect translation language for %l format identifier 2015-12-13 20:02:13 +01:00
8bb8aaa0db Merge pull request #318 from Arkshine/fix-cvar-bounds-and-hook
Enable hook detour on cvar with bounds regardless current value
2015-12-11 14:45:59 +01:00
cc9f679a85 Enable hook detour on cvar with bounds regardless current value 2015-12-11 10:33:54 +01:00
7cdc72f936 Merge pull request #317 from WPMGPRoSToTeMa/hamposthookretval
Hamsandwich: fix HAM_OVERRIDE in post hooks (bug 6443)
2015-12-10 19:25:14 +01:00
5c8c925e8a Hamsandwich: fix HAM_OVERRIDE in post hooks (bug 6443) 2015-12-09 21:38:08 +03:00
8ec6136a7c Merge pull request #315 from Arkshine/cstrike-sanity-check
Make sure client is alive before checking buying commands
2015-12-08 01:06:16 +01:00
5b0191f691 Make sure client is alive before checking buying commands 2015-12-07 19:20:48 +01:00
0df3715894 Merge pull request #316 from Arkshine/fix/missing-master.games.txt
Fix missing master.games.txt reference in PackageScript
2015-12-05 18:49:58 +01:00
6190582f16 Fix missing master.games.txt reference in PackageScript 2015-12-05 18:43:33 +01:00
4cea082303 Merge pull request #314 from Th3-822/fix-strncmp-case-sensitivity
Fix strncmp case sensitivity
2015-12-03 00:55:20 +01:00
578a2f9852 Fix strncmp case sensitivity
strncmp was using case insensitive call when ignorecase == false
2015-12-02 19:08:10 -04:30
47f66a3d13 Merge pull request #310 from Arkshine/update-latest-amtl-refptr
Update to the latest AMTL - Rename Ref to RefPtr.
2015-11-23 20:17:27 +01:00
02ac6fa2d7 Update to the latest AMTL - Rename Ref to RefPtr. 2015-11-23 14:45:07 +01:00
2971bb65fd Merge pull request #309 from Arkshine/refactor-gamerules-retrieval
Refactor gamerules address retrieval
2015-11-23 00:58:37 +01:00
91f02b145b Merge pull request #308 from Arkshine/fix/cstrike-meta-return
Fix missing meta return in ServerActivate
2015-11-23 00:47:21 +01:00
42a09f8593 Fix missing meta return in ServerActivate 2015-11-23 00:35:44 +01:00
87b1833f73 Refactor gamerules address retrieval 2015-11-23 00:29:43 +01:00
664c85106f Merge pull request #278 from Arkshine/feature/cstrike-update-2
Update cstrike module - 2
2015-11-21 00:19:01 +01:00
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
1ad01f4989 Merge pull request #307 from Arkshine/fix/comma-compiler
Fix shifted warning messages from pawn compiler due to missing comma in array
2015-11-12 21:05:37 +01:00
6d9fe60608 Fix shifted warning messages from compiler due to missing comma in array 2015-11-12 20:13:54 +01:00
4abeac1231 Merge pull request #306 from IgnacioFDM/patch-1
Allow wordspawn in edict/entvars->index type conversion  (bug 6429)
2015-11-06 12:52:42 +01:00
72d3f21816 Allow wordspawn in edict/entvars->index type conversion and EHANDLE edict get/set 2015-11-06 07:44:14 -03:00
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
eb0222455a Cstrike: Fix spaces/tabulations/typo 2015-11-03 10:45:51 +01:00
b6910667a8 Cstrike: Remove parsing error and update native error message 2015-11-03 10:45:50 +01:00
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
ffe8b7761e Cstrike: Move CSW_* constants from amxconst.inc to cstrike_const.inc 2015-11-03 10:45:49 +01:00
2c5cc4289e Cstrike: Add cs_is_valid_itemid() stock 2015-11-03 10:45:49 +01:00
75853dae60 Cstrike: Add cs_find_ent_by_owner() native 2015-11-03 10:45:48 +01:00
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
600a15a57b Cstrike: Add cs_get_weapon_info() native 2015-11-03 10:45:47 +01:00
60cdbeb219 Cstrike: Add CS_OnGetItemPrice forward to get/alter an item price on purchase 2015-11-03 10:45:46 +01:00
cf2f753660 Cstrike: Fix CS_OnBuy called only on the first buying of primary/secondary ammos and not when game loops to give until max amount
When game gives ammos, it loops until the max amount is reached, but it sill calls GiveNamedItem and AddAcount, so forward should be called for each of these ones.

Code logic is simplified and more understandable.
2015-11-03 10:45:46 +01:00
e6a2434887 Cstrike: Add cs_get_item_id() and cs_get_translated_item_alias() natives 2015-11-03 10:45:45 +01:00
c6628f22ee Cstrike: Add more known constants from game 2015-11-03 10:45:44 +01:00
d3e5957215 Cstrike: Add cstrike_const.inc and move existing constants there 2015-11-03 10:45:44 +01:00
eb9405bd97 Merge pull request #298 from Arkshine/feature/gamerules-natives
Introduce get/set_gamerules_*() natives to read/write on the gamerules object
2015-11-03 10:42:35 +01:00
49184c86a3 Refactor 5 - Rename original file/var for gamerules 2015-11-02 20:10:40 +01:00
4333255571 Refactor 4 - Move entities natives to its own file and reflect changes 2015-11-02 20:10:39 +01:00
1032fbdbd0 Refactor 3 - Simplify macros and move them to shared file as well 2015-11-02 20:10:39 +01:00
dc6f171f20 Refactor 2 - Duplicate get_member_* for each set of natives for consistency 2015-11-02 20:10:38 +01:00
c07b269c94 Refactor 1 - Move shared code to its own file and reflect changes 2015-11-02 20:10:38 +01:00
02c1b20ed7 Rename get_ent_data_size/info/basetype to be more generic 2015-11-02 20:10:37 +01:00
68f99bc2d5 Add get/Set_gamerules_* natives 2015-11-02 20:10:37 +01:00
df507a675b Reflect changes on get/set_data* natives 2015-11-02 20:10:36 +01:00
d9c7e72d4b Update macros to support gamerules configs 2015-11-02 20:10:36 +01:00
234b537ad9 Factorize gamerules data code 2015-11-02 20:10:35 +01:00
483ef98af3 Load gamerules address and offsets 2015-11-02 20:10:34 +01:00
f31e0e405f Add gamerules offsets for supported mods 2015-11-02 20:10:34 +01:00
7db6e9355d Merge pull request #305 from IgnacioFDM/master
Remove extra semicolon
2015-10-20 10:47:50 +02:00
b78c239395 Remove extra semicolon 2015-10-20 05:34:18 -03:00
b7be35618d Merge pull request #304 from Arkshine/fix/crash-invalid-address
Fix a potential crash if SV_DropClient address could not be found
2015-10-15 13:03:48 +02:00
42fb860077 Fix a potential crash if SV_DropClient address could not be found 2015-10-15 12:50:58 +02:00
e2e57d8347 Merge pull request #302 from Arkshine/fix/compilation-gcc
Fix linux compilation with gcc-4.8 and higher.
2015-10-13 20:39:09 +02:00
85f03c4a06 Fix linux compilation with gcc-4.8 and higher. 2015-10-13 20:25:09 +02:00
915da57d32 Merge pull request #300 from Arkshine/fix/cstrike-sv
Fix retrieval of sv address not working under linux
2015-10-11 13:46:10 +02:00
b3e5e10473 Fix retrieval of sv address not working under linux 2015-10-11 13:25:31 +02:00
2eeeb2997d Merge pull request #299 from Arkshine/fix/typos-in-fakemeta
Fix (get/set)_pdata_(int/float) using the wrong offset value (typo from #297)
2015-10-09 20:36:36 +02:00
9997c31703 Fix (get/set)_pdata_(int/float) using the wrong offset value (typo from #297) 2015-10-09 20:30:45 +02:00
cae7281def Merge pull request #297 from Arkshine/fix/invalid-edict-on-last-player
Fix some natives relying on a known engine bug related to last player's edict being invalid
2015-10-08 19:52:27 +02:00
9bee1f7edf Consistency: Replace GETEDICT with HLTypeConversion in core 2015-10-08 19:36:42 +02:00
b65a0600ee Consistency: Replace GETEDICT and variants with HLTypeConversion in cstrike module 2015-10-08 19:25:00 +02:00
6f301b5cea Consistency: Replace GETEDICT, INDEXENT2 and others things with HLTypeConversion in hamsandwich module 2015-10-08 19:24:49 +02:00
bf5fdc2b5c Consistency: Replace GetPlayerEdict with HLTypeConversion in fun module 2015-10-07 23:27:58 +02:00
e52fc14114 Consistency: Replace INDEXENT2 with HLTypeConversion in engine module 2015-10-07 23:27:57 +02:00
429a4596c1 Consistency: Replace INDEXENT2 and others things with HLTypeConversion in fakemeta module 2015-10-07 23:27:56 +02:00
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
fd0f6cc429 Merge pull request #296 from Arkshine/feature/update-to-latest-amtl
Update to latest AMTL
2015-10-05 19:49:10 +02:00
c29eabec50 Fix max length inconsistencies + typo 2015-10-05 19:12:30 +02:00
138b9e1510 Remove UTIL_Format() and UTIL_VarArgs() 2015-10-05 19:12:08 +02:00
f22dc769f4 Replace some LibraySys usage with AMTL primitives 2015-10-02 23:22:22 +02:00
f976861e21 Fix AMBuild and VS projects files 2015-10-02 23:22:22 +02:00
2d910838a2 Fix AMTL internal paths 2015-10-02 23:22:21 +02:00
f811bab608 Update AMTL to latest revision 2015-10-02 23:22:20 +02:00
9a4731dd14 Merge pull request #284 from Arkshine/feature/new-pdata-natives
Introduce new natives to read/write on entity's private data based off class/member name using gamedata files
2015-09-19 20:56:31 +02:00
16f65663dc Add new natives to read/write on entity's private data based off class/member name available from gamedata files 2015-09-19 20:07:48 +02:00
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
eaa330d745 Merge pull request #291 from alliedmodders/fix/native-overflow
Fix crash when dynamic native is executed with the max number of params
2015-09-05 18:24:51 +02:00
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
5b3a5a0153 Merge pull request #289 from alliedmodders/fix/typo-autoexeconfig
Fix typo in AutoExecConfig native
2015-09-05 08:49:04 +02:00
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
190304f601 Merge pull request #288 from Arkshine/sync-amtl
Update AMTL submodule from upstream and reflect changes
2015-08-26 11:19:19 +02:00
0005d1a6b5 Update AMTL submodule from upstream and reflect changes 2015-08-26 11:15:07 +02:00
224239f5a1 Merge pull request #266 from Arkshine/feature/autoexeccfg
Introduce automatic config file for plugins and two forwards
2015-08-26 10:42:59 +02:00
5b8bbddbc1 AutoExecConfig: Adjust few things 2015-08-26 10:38:31 +02:00
c5d4eb49d4 Merge pull request #287 from Sylvert0/Fix-cs_set_user_team
Add a CS_NORESET constant for use with cs_set_user_team for skipping the model reset
2015-08-23 19:44:47 +02:00
e4b635f5be Update CstrikeNatives.cpp 2015-08-22 17:54:00 -03:00
f95f2032fc Update cstrike.inc 2015-08-22 17:51:48 -03:00
78b1154b8d AutoExecConfig: Do not traumatize Travis and Nextra 2015-08-14 16:38:29 +02:00
1f3ba35140 AutoExecConfig: Remove config code in admin.sma 2015-08-14 16:38:28 +02:00
1f3c7cf272 AutoExecConfig: Update documentation 2015-08-14 16:38:28 +02:00
9a1dc5d179 AutoExecConfig: Add AutoExecConfig native 2015-08-14 16:38:27 +02:00
f22185d646 AutoExecConfig: Enable the configs 2015-08-14 16:38:27 +02:00
517a08e134 AutoExecConfig: Add CoreConfig class + OnAutoConfigsBuffered / OnConfigsExecuted forwards 2015-08-14 16:37:48 +02:00
a9b183612b Merge pull request #264 from Arkshine/fix/dropclient
Fix player not being internally disconnected in some situation and add client_disconnected forward
2015-08-14 00:22:57 +02:00
ed4faf7c11 Fix player not being internally disconnected in some situation + add client_disconnected forward 2015-08-14 00:08:50 +02:00
a9015d1d84 Merge pull request #283 from alliedmodders/fix/newmenu-propnocolor
Fix MPROP_NOCOLORS menu property not working
2015-08-13 12:19:12 +02:00
83a72a6e3a Fix MPROP_NOCOLORS menu property not working 2015-08-13 12:04:31 +02:00
5f0b92f7c3 Fix typos 2015-08-12 10:43:59 +02:00
c270243b56 Replace "time" type name by a more generic one "float" 2015-08-10 18:06:06 +02:00
a6e587f0f0 Update Opfor offsets 2015-08-10 18:06:04 +02:00
a50b1e17d8 Update TFC offsets 2015-08-10 18:06:03 +02:00
9a83db66f5 Update HLDM offsets 2015-08-10 18:06:02 +02:00
2fa53badd9 Update DoD offsets 2015-08-10 18:06:01 +02:00
db14b0eae8 Update CS offsets 2015-08-10 18:06:00 +02:00
f4f4d966f3 Reflect changes where game config functions are used 2015-08-10 18:05:59 +02:00
7423ac6824 Modify game config parser to support more offset datas (type, size, etc.) 2015-08-10 18:05:59 +02:00
20201290e3 Merge pull request #271 from Arkshine/fix/ns_remove_upgrade
Fix ns_remove_upgrade() native (bug 3394)
2015-08-10 15:28:44 +02:00
4563f56e77 Merge pull request #277 from Arkshine/fix/potential-issues
Fix some potential issues
2015-08-10 15:28:32 +02:00
c46e666907 Merge pull request #279 from Arkshine/fix/sortadtarray-string
Fix an SortADTArray() issue where strings are not properly sorted
2015-08-10 15:28:23 +02:00
10eb6b370a Merge pull request #280 from Arkshine/improve-offsets-list
Cleanup/Fix CS gamedata of entities offsets and add support for HLDM, DoD, TFC and OpFor
2015-08-09 19:26:05 +02:00
8f90f30b07 Gamedata: keep "class" comment for unknown type 2015-08-09 16:33:21 +02:00
222b1c651b Gamedata: Add HLDM entities classes 2015-08-09 16:25:18 +02:00
e0d80639b3 Gamedata: Remove any static members 2015-08-07 20:41:38 +02:00
0baa7d47b6 Gamedata: Add Opfor entites offsets 2015-08-07 20:36:55 +02:00
c80d6e5284 Gamedata: Add TFC entites offsets 2015-08-07 20:20:55 +02:00
ad63658f9e Gamedata: Add DoD entities offsets 2015-08-07 20:13:54 +02:00
ffb9bc92d6 Gamedata: Fix Master and PackageScript to reflect changes 2015-08-07 20:01:11 +02:00
672c519378 Gamedata: Move more CS classes not linked an entity to /others.games 2015-08-07 18:06:32 +02:00
cfd8526961 Gamedata: Move CS hostage-related classes not linked to an entity to /hostages.games 2015-08-07 18:02:54 +02:00
00de99b839 Gamedata: Add missing CS classes associated to an entity 2015-08-07 17:38:18 +02:00
fb1189fd31 Gamedata: Add CS class hierarchy as comment for convenience 2015-08-07 17:35:29 +02:00
7dff2749ec Gamedata: Remove CS classes with no members 2015-08-07 17:30:49 +02:00
4d3e31cf6c Fix an SortADTArray() issue where strings are not properly sorted 2015-08-04 17:08:40 +02:00
5987f389c6 Fix some potiental issues 2015-07-31 15:46:16 +02:00
6d7daf787d Merge pull request #276 from Arkshine/fix/ham-command
Fix "ham hooks" command not displaying all current hooks of a plugin
2015-07-31 15:43:29 +02:00
73e84e9963 Fix "ham hooks" command not displaying all current hooks of a plugin 2015-07-31 14:25:19 +02:00
8c0534a055 Fix typo 2015-07-30 19:54:40 +02:00
5c17b1c767 Merge pull request #275 from xPaw/patch-2
Return an error on Err_OldFile instead of falling through to default case
2015-07-30 16:47:23 +02:00
79bb453bb6 Return an error on Err_OldFile instead of falling through to default case 2015-07-30 15:59:01 +03:00
6b1650ae4f Merge pull request #274 from xPaw/patch-1
Fix resource leak when reading hamdata.ini
2015-07-30 13:23:03 +02:00
378d89af2f Fix resource leak when reading hamdata.ini 2015-07-30 14:02:46 +03:00
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
fc4455d837 Merge pull request #273 from Arkshine/fix/newmenu-typo
Fix typo in newmenus (bug 6394)
2015-07-30 10:43:36 +02:00
5f83f77b2e Fix typo in newmenus 2015-07-30 00:28:18 +02:00
6d6a1c1ab0 Add a data argument in INI/SMC_ParseFile() to pass through to callbacks (bug 6228) 2015-07-29 22:23:13 +02:00
aa5c340029 NS: Fix ns_remove_upgrade() native 2015-07-29 20:49:14 +02:00
a35af02494 NS: Refactor some bits 2015-07-29 20:21:09 +02:00
decde43371 Merge pull request #270 from Arkshine/fix/ml-parser-with-empty_value
Fix a ML parser crash on key with an associated empty value
2015-07-29 09:45:14 +02:00
2d583aa83a Fix a ML parser crash on key with an associated empty value 2015-07-28 15:41:16 +02:00
57037740fd Merge pull request #269 from Arkshine/update-libmaxminddb
Update libmaxminddb to v1.1.0
2015-07-22 12:57:46 +02:00
8efa1ba067 Update libmaxminddb to v1.1.0 2015-07-22 00:21:44 +02:00
2162059352 Merge pull request #268 from Arkshine/fix/handle-name-conflict
Rename Handle class to avoid name collision in mac
2015-07-21 00:23:13 +02:00
6b3b351c9a Rename Handle class to avoid name collision in mac 2015-07-21 00:18:54 +02:00
c6a3290c4f Merge pull request #267 from Arkshine/feature/unregister_event
Add enable/disable_event() native (bug 6360)
2015-07-21 00:00:28 +02:00
df5d935194 Add enable/disable_event() native 2015-07-20 23:06:32 +02:00
075ed7b7b4 Merge pull request #265 from Arkshine/fix/set-log-type
Retrieve log type in MetaAttach to allow log to be written earlier
2015-07-18 10:21:09 +02:00
109b3481a7 Retrieve log type in MetaAttach to allow log to be written earlier 2015-07-18 09:55:13 +02:00
83bc3f518b Fix wrong buffer length 2015-07-17 19:12:02 +02:00
717735311b Fix typo 2015-07-17 17:53:52 +02:00
e3489be0c0 Merge pull request #260 from Arkshine/feature/more-amtl-conversion
More AMTL conversion - 🔥 CString and CVector
2015-07-16 12:24:06 +02:00
9223989a01 Fix consistency 2015-07-16 08:11:19 +02:00
4ed80b88de Merge pull request #255 from Arkshine/feature/cstrike-gamedata
Update cstrike module - 1
2015-07-15 22:21:08 +02:00
662fa61fc7 Cstrike: Fix typos and improve things 2015-07-15 16:40:07 +02:00
dcc2d91b14 Cstrike: cs_get_user_driving - Add the associated constants from HLSDK 2015-07-14 19:44:10 +02:00
86e33d0cb1 Cstrike: cs_set_user_model - Add a param to choose whether modelindex should be updated 2015-07-14 19:44:10 +02:00
5d6f829624 Cstrike: Rename file for consistency 2015-07-14 19:44:09 +02:00
1ed354890b Cstrike: Add CSI_SHIELD for convenience and fix typos 2015-07-14 19:44:08 +02:00
939aad5cb9 Cstrike: cs_set_user_team - Add a param to choose whether TeamInfo message should be sent 2015-07-14 19:44:08 +02:00
8be119aa6a Cstrike: cs_set/reset_user_model/team - Stagger user's info updates across multiple frames (bug 3134) 2015-07-14 19:44:08 +02:00
aedde87f42 Cstrike: cs_set_user_zoom - Use a more event-based approach when mode is 0 2015-07-14 19:44:07 +02:00
63a0910f5b Cstrike: cs_get/set_armoury_type - Add a param to get/set the number of weapons inside an armoury 2015-07-14 19:44:06 +02:00
81f9a23d16 Cstrike: cs_get_user_armor - Make optional armortype param 2015-07-14 19:44:06 +02:00
7842d0160b Cstrike: cs_set_weapon_silen - Add a new value for draw_animation to follow game behavior
- Player's model sequence will be properly played
- Disallow firing while animation is playing
2015-07-14 19:44:06 +02:00
87d740b92a Cstrike: Add CZ support for some hostage natives 2015-07-14 19:44:05 +02:00
d9a9b7a74e Cstrike: Add support for monster_scientist entity (alias of hostage_entity) 2015-07-14 19:44:05 +02:00
27d6a0cc08 Cstrike: cs_get_hostage_id - Fix error check, an hostage can't be a player 2015-07-14 19:44:04 +02:00
b82588f081 Cstrike: cs_set_user_deaths - Add a param to choose whether scoreboard should be updated 2015-07-14 19:44:04 +02:00
71c6ac8c2e Cstrike: cs_set_no_knives - pfnCreateNamedEntity is now hooked only when needed 2015-07-14 19:44:03 +02:00
2de1f9a33b Cstrike: Do some more cleanup 2015-07-14 19:44:03 +02:00
f13461caee Cstrike: Cache GET_USER_MSG_ID calls 2015-07-14 19:44:02 +02:00
84c320d539 Cstrike: Do some cleanup for the sake of consistency and readability 2015-07-14 19:44:02 +02:00
864e0b88eb Cstrike: Move all hardcoded datas to its own gamedata files 2015-07-14 19:44:01 +02:00
6555ecf6b8 Merge pull request #263 from Sylvert0/master
Fix CS_OnBuyAttempt
2015-07-14 15:55:07 +02:00
f3df286985 Fix CS_OnBuyAttempt
If i dont have CS_OnBuy on my plugin, CS_OnBuyAttempt doen't work
2015-07-14 10:40:16 -03:00
b8dd9d19dd Merge pull request #261 from Arkshine/feature/datapack-memory
Improve DataPack memory allocation
2015-07-14 00:40:15 +02:00
fab9dbf294 Merge pull request #262 from Arkshine/remove-makefile
Remove MakeFile
2015-07-14 00:40:02 +02:00
c0b9b91a06 Remove MakeFile 2015-07-14 00:13:24 +02:00
f7c4ed050f Improve DataPack memory allocation 2015-07-13 23:49:51 +02:00
c775cfca73 More AMTL conversion - 🔥 CString and CVector 2015-07-13 23:37:20 +02:00
b145b4c651 Merge pull request #259 from Nextra/engine-fix
Engine: Fix bcompat and consistency for CHECK_ENTITY
2015-07-13 15:45:10 +02:00
a68df8de7f Engine: Fix bcompat and consistency for CHECK_ENTITY 2015-07-13 15:38:37 +02:00
de71cf469c Merge pull request #258 from Ni3znajomy/fix-mistake-gconfigparser
Fix mistake
2015-07-11 20:40:09 +02:00
cc12f0a0a4 Fix mistake 2015-07-11 20:18:43 +02:00
3132e20fad Merge pull request #257 from Arkshine/feature/remove-duplicated-handle-code
Remove duplicated code of native handles
2015-07-11 19:58:02 +02:00
dbc9c7e0da Remove duplicated code of native handles 2015-07-11 18:14:16 +02:00
883c852897 Synchronize AMTL submodule 2015-07-11 14:57:06 +02:00
989034bd41 Attempt to fix mac build 2015-07-11 13:33:30 +02:00
139a2a082c Merge pull request #254 from Arkshine/feature/gameconfig
Implement a game config parser and expose functionnalities to the module/plugin API
2015-07-11 13:19:09 +02:00
f38c726faf Gameconfig: Add game configs natives 2015-07-11 13:16:45 +02:00
b8cc1ac79d Merge pull request #256 from DmitriyS/master
Plugins: Close Array/Trie handles on map end
2015-07-11 00:12:51 +02:00
e98ab37806 fix memory leaks 2015-07-11 00:39:34 +03:00
846238fe99 Merge pull request #250 from Nextra/enginew
Engine Update
2015-07-02 18:43:35 +02:00
14513e6f70 Gameconfig: Export game config manager to AMXX API 2015-06-29 13:38:34 +02:00
4b2ba10300 Gameconfig: Add game configs parser 2015-06-29 13:38:34 +02:00
f46fc6c4e8 Merge pull request #253 from Arkshine/fix/set_amxstring_utf8-inconsistency
Fix set_amxstring_utf8 insconsistency
2015-06-29 13:23:02 +02:00
8633337bbd Fix set_amxstring_utf8 insconsistency 2015-06-29 12:42:57 +02:00
f68a53e46a Fix mac compilation 2015-06-27 16:26:39 +02:00
30a97db735 Merge pull request #249 from Arkshine/fix/override-error-clang56
Fix a clang-3.6 compilation issue
2015-06-27 15:46:46 +02:00
28448c0fe1 Merge pull request #251 from WPMGPRoSToTeMa/authconsoleprintfixes
Replace console_print by engclient_print to support connecting players (bug 6372)
2015-06-15 20:03:23 +02:00
391991bfce https://bugs.alliedmods.net/show_bug.cgi?id=6372 bugfix 2015-06-15 18:54:29 +03:00
7059f5b3b9 Engine: Detour LightStyle to catch all calls, restores set_lights() functionality 2015-06-11 20:49:00 +02:00
3792e7dc20 Merge pull request #248 from Arkshine/fix/update-compiler3
Update compiler - 3
2015-06-01 21:45:04 +02:00
934e0208bf Fix a clang-3.6 compilation issue 2015-06-01 20:19:10 +02:00
26d0f3f2de Merge pull request #247 from ShootingKing-AM/master
Correcting years in MSVS project solutions.
2015-05-19 17:31:58 +02:00
4a58365b2c Correcting SolutionFileFormat version as well 2015-05-19 18:31:19 +05:30
41dfdc7f59 Compiler: Prevent declaring arrays that the compiler is too buggy to handle
AM Bug 7977: https://bugs.alliedmods.net/show_bug.cgi?id=4977
2015-05-19 00:01:29 +02:00
f710188c86 Compiler: Ability to directly reference another address in a default argument (for arrays only)
SM patch: d8d13f1920
2015-05-19 00:01:29 +02:00
ad23638913 Correcting years in MSVS project solutions. 2015-05-18 21:54:06 +05:30
b364506cbc Merge pull request #241 from luxxxoor/patch-2
Update cmdmenu.sma
2015-05-17 20:10:22 +02:00
b77c8e253b Update cmdmenu.sma
Changed format with formatex where needed, removed many hardcoded contents in plugin and added semicolons.
2015-05-17 19:50:42 +03:00
ffa12bfe54 Merge pull request #244 from Arkshine/fix/fakemeta-changelevel
Fix EngFunc_ChangeLevel
2015-05-15 21:29:25 +02:00
e305009e9a Fix EngFunc_ChangeLevel 2015-05-15 19:14:34 +02:00
af7a6e3c87 Merge pull request #243 from Arkshine/fix/namehashset-add-return
Correct NameHashSet::add() return type
2015-05-15 13:27:54 +02:00
6620aa97a8 Correct NameHashSet::add() return type 2015-05-15 10:45:08 +02:00
8b6d85eb78 Engine: Add a bunch of missing CHECK_ENTITY() and CHECK_ENTITY_SIMPLE() 2015-05-11 16:15:44 +02:00
dc73473394 Engine: Fix CHECK_ENTITY() logic error (0 is not a player) 2015-05-11 16:15:44 +02:00
7bf47f90d9 Engine: Use UTF-8 functions where KeyValueData is touched 2015-05-11 16:15:43 +02:00
c24fbda302 Engine: Add error path to DispatchKeyValue() based on g_inKeyValue
This was unsafe as g_pkvd is pointed to a stack variable that is only valid while inside of pfn_keyvalue()
2015-05-11 16:15:43 +02:00
702f784e44 Engine: Fix get_info_keybuffer() not being able to retrieve local keybuffer 2015-05-11 16:15:43 +02:00
679714c8be Engine: Add error path for remove_entity() and unsafe entity ids 2015-05-11 16:15:43 +02:00
ff0ca9ba67 Engine: Remove inconsistent error path from entity_get_int() 2015-05-11 16:15:42 +02:00
ee0bcc39f1 Engine: Clarify difference between the engine module trace handle and the "real" global trace 2015-05-11 16:15:42 +02:00
ebdd015aae Restore traceresult() functionality by writing to g_tr in trace functions 2015-05-11 16:15:42 +02:00
3c1022af99 Engine: Add a destination parameter to trace_hull() to make it more useful 2015-05-11 16:15:42 +02:00
add4867d21 Engine: Add safe get_global_edict2() and entity_get_edict2() 2015-05-10 23:56:06 +02:00
d69fddf8b4 Engine/Core: Move precache_event() to core 2015-05-10 23:45:01 +02:00
218fb9c794 Engine: Add unregister_[touch|think|impulse]() 2015-05-10 23:40:22 +02:00
c531ad756d Engine: Dynamically hook StartFrame for set_lights() 2015-05-10 23:21:12 +02:00
c5f6e26802 Merge pull request #239 from Nextra/inc-doc3
Update include documentation #3 (mostly engine.inc)
2015-05-10 17:12:50 +02:00
fbcbbd8421 hlsdk_const: Add MoveToOrigin move type constants 2015-05-10 14:37:40 +02:00
00f9b62ffb cstrike: Add create_entity() note from engine, rewording 2015-05-10 14:37:39 +02:00
59d8d2807f engine_const: Add sections and comments 2015-05-10 14:37:36 +02:00
d9f792b712 engine: Add documentation, group similar natives 2015-05-10 14:37:16 +02:00
42d80a666a Merge pull request #242 from Nextra/nullvec
Add NULL_VECTOR and expose null functions to AMXX API
2015-05-06 14:34:01 +02:00
abf7f1a41b Expose get_amxstring_null and get_amxvector_null to modules 2015-05-06 12:01:15 +02:00
fdb180e062 Add NULL_VECTOR 2015-05-06 11:28:54 +02:00
39cc240a4e Merge pull request #240 from Nextra/kvd
Improve handling of KeyValueData
2015-05-05 12:01:29 +02:00
79189c86ab Add basic kvd doc to fakemeta.inc and fix ham_const.inc lies 2015-05-05 11:16:26 +02:00
9fd0f1c231 Sync AMTL submodule 2015-04-22 00:55:23 +02:00
8172519389 Improve handling of KeyValueData in FM and make it compatible with Ham
- KVD_Wrapper compatibility with Ham by making |&kvdw == &kvdw.kvd|
- Replaces g_kvd_hook with a generic g_kvd_ext to support raw KVD from Ham
- Adds create_kvd() and free_kvd() so plugins have something to feed Ham with
2015-04-21 00:18:21 +02:00
cc11191e57 Merge pull request #236 from Arkshine/fix/missing-sqlite-charset
Fix missing SQL_SetCharset native in SQLite
2015-04-20 22:47:16 +02:00
81e091e005 Merge pull request #237 from Arkshine/fix/ke-string-null
Fix potential crash using ke::AString and a valid given null string (bug 6351)
2015-04-19 21:05:50 +02:00
08d684a90f Merge pull request #238 from Arkshine/feature/container-build
Use the new Travis-CI Container environment
2015-04-19 21:05:42 +02:00
54223e9a99 Use the new Travis-CI Container environment 2015-04-19 20:10:04 +02:00
871e14178b Fix a tag typo in datapack.inc 2015-04-19 19:58:57 +02:00
1c1b949648 Fix potential crash using ke::AString and given null string 2015-04-19 19:52:53 +02:00
b88841c6ef Fix missing SQL_SetCharset native in SQLite 2015-04-12 21:08:03 +02:00
0bfc04bb14 Merge pull request #235 from Arkshine/fix/file-fgets
Fix fgets native not setting always the plugin buffer
2015-04-12 20:52:51 +02:00
10c0204b16 Fix fgets native not setting the plugin buffer on null result 2015-04-12 20:20:21 +02:00
a35bc43cab datapack.inc: Fix copy-pasted error description 2015-04-06 13:33:55 +02:00
044e6b22b2 Merge pull request #233 from Ni3znajomy/update-copyright-year
Update copyright year
2015-03-30 13:44:55 +02:00
0b2c33bcd2 Merge pull request #231 from Nextra/datapack-update
Datapack update
2015-03-30 13:43:50 +02:00
081b683e03 Update datapack test plugin 2015-03-30 04:14:55 +02:00
2166c32047 Make datapack natives error consistently, stop using IsPackReadable 2015-03-30 04:14:55 +02:00
1d57677426 Add CanRead[Cell|Float|String|Memory] to CDataPack 2015-03-30 04:14:54 +02:00
9abe6cd8f6 Add IsPackEnded native (IsPackReadable replacement) 2015-03-30 04:14:54 +02:00
9d4c02f7ca Nuke IsPackReadable
This native exposes/requires knowledge about implementation details of the
internal DataPack structure. Plugins can not properly deal with this, and
abusing this functionality results in a chance of future breakage.
2015-03-30 03:48:52 +02:00
92c2c84617 Update copyright year 2015-03-29 20:01:25 +02:00
d4bfebec22 Merge pull request #232 from Arkshine/fix/tfc-crash-medic
Fix crash in TFCX module when Infection weapon is used (bug 6333)
2015-03-28 17:29:47 +01:00
db9421d0be Fix crash in TFCX module when Infection weapon is used 2015-03-28 16:47:07 +01:00
a59b72f96a Merge pull request #229 from Arkshine/feature/trans-format-and-native
Add %l format specifier and SetTranslationTarget() native (bug 6331)
2015-03-26 22:54:11 +01:00
8831166705 Add %l format specifier and SetTranslationTarget() native 2015-03-26 22:42:55 +01:00
bebe9f8e2e Merge pull request #230 from Ni3znajomy/fix-checking-cvar-bounds
Fix checking cvar's bounds
2015-03-26 21:49:33 +01:00
69d41b65d4 Merge pull request #227 from Freeman-AM/plmenu-update
Plmenu: improve readability, more compliance to amxmodx style, small improvements
2015-03-26 21:32:39 +01:00
4d3c49f93b Fix checking cvar's bounds 2015-03-26 21:31:16 +01:00
f44ec00133 Plmenu: rollback macros 2015-03-26 21:17:46 +01:00
b4b86113e4 Merge pull request #217 from Arkshine/feature/valve-fs-support
Add support for Valve FS to natives that use file handles
2015-03-26 11:45:33 +01:00
52c73126e1 VFS: Fix various things
- The "ALL" fake pathID is replaced by what does SM, having a public var NULL_STRING which will acts as NULL when needed.
  To make compiler accepting public array, this patch was needed: https://hg.alliedmods.net/sourcemod-central/rev/b12f329def09
- The offset thing in read_dir: considering that's something very specific to this native and that implementation in CDirectory doesn't make sense because of the offset compatibility for windows, all code is now in the native.
2015-03-25 13:50:07 +01:00
4d97a24dd8 Merge pull request #228 from Arkshine/fix/crash-ham
Fix crash under linux in Hamsandwich module (bug 6323)
2015-03-24 02:40:27 +01:00
b6febae2fa Fix crash under linux in Hamsandwich module
Fix crash under linux in Hamsandwich module
2015-03-24 02:18:11 +01:00
8f6b8588c1 VFS: Do not traumatize Nextra 2015-03-23 18:30:22 +01:00
ba11085ddc VFS: Add constant in pawn include to define max path 2015-03-22 11:14:13 +01:00
71ab8d560e VFS: Add more sane FileRead/Write* natives to read/write a single value 2015-03-22 11:14:12 +01:00
a580c8c5e5 VFS: Add SetFilePermissions native 2015-03-22 11:13:36 +01:00
0eeb5942a1 VFS: Reflect changes in natives and documentation 2015-03-22 11:12:21 +01:00
6434c4db77 VFS: Update AMbuild and VS project files 2015-03-22 11:08:22 +01:00
4f4e322ad4 VFS: Add helpers to wrap default and valve system file 2015-03-22 11:00:33 +01:00
553963295f VFS: Add Valve file system interface 2015-03-22 11:00:33 +01:00
d69ddc7234 VFS: Add LibrarySys class helper 2015-03-22 11:00:32 +01:00
c156c220c4 Replace some arrays by bitfield macros 2015-03-21 16:14:14 +01:00
a182ca62c8 Merge pull request #226 from Arkshine/fix/compiler
Fix compiler output
2015-03-21 15:38:25 +01:00
d397619939 Fix compiler output 2015-03-21 15:29:55 +01:00
5413c59bc7 plmenu: improve readability, more compliance to amxmodx style 2015-03-21 13:54:39 +01:00
4fbf4ee03d Merge datapack updates from SoureMod 2015-03-15 22:38:49 +01:00
32e1908859 Add submodule support in checkout-deps.sh 2015-03-14 13:23:47 +01:00
dd6ef4811c Update compiler VS projects to reflect changes from #221 2015-03-14 12:53:43 +01:00
3d5a0c5a29 Normalize more line endings 2015-03-14 12:45:33 +01:00
dbe79790dc Merge pull request #225 from xPaw/modules-folder
Move dlls/ to modules/
2015-03-13 14:38:42 +01:00
fddebce313 Update modules paths 2015-03-13 15:23:05 +02:00
e09f434ed8 Move dlls/ to modules/ 2015-03-13 15:18:47 +02:00
54c978addb Merge pull request #224 from Arkshine/feature/third-party-libs-part2
Move SQLite and GeoIP2 libs to /third_party
2015-03-13 11:27:32 +01:00
2204a83ec0 Update AMBuilder, VS and MakeFile files 2015-03-13 11:13:42 +01:00
aa629a76e7 Move SQLite and GeoIP2 libs to /third_party 2015-03-13 11:12:53 +01:00
f83e7f0071 Merge pull request #223 from 9iky6/patch-14
Add missing SVC Messages
2015-03-12 19:57:52 +01:00
463de74865 Update message_const.inc 2015-03-12 22:50:49 +05:00
c2a21bcaee Add_SVC_Messages
add svc messages id to use hardcode (dont relize, only for alliedmodders dev team view)
2015-03-12 20:54:03 +05:00
24480a3782 Merge pull request #222 from xPaw/spcomp2-compat
Make include files a little more spcomp2 compatible
2015-03-11 14:48:59 +01:00
0ccb99137a Make spcomp2 cry less 2015-03-11 15:19:27 +02:00
a25090de4b Merge pull request #221 from xPaw/burn-scpack
Remove scpack
2015-03-10 19:52:29 +01:00
8b06e5bdcd Remove strexpand 2015-03-10 20:37:57 +02:00
a134a75572 Remove scpack 2015-03-10 20:03:57 +02:00
446029e7cf Merge pull request #220 from Arkshine/feature/third-party-libs
Move third party libraries in own directory and fix/cleanup VS projects files
2015-03-10 18:25:40 +01:00
48d6a3354a Normalize all the line endings 2015-03-10 16:51:45 +01:00
afc3cac54d Merge pull request #219 from xPaw/gitattributes
Add gitattributes
2015-03-10 16:50:10 +01:00
acf910b64b Fix and clean up VS projects files
+ removed unused variable :P
2015-03-10 16:20:21 +01:00
aaafe0f3f2 Compile Hashing lib as static and link to AMXX 2015-03-10 12:15:46 +01:00
c03bb3693e Move Zlib and Hashing libs to third_party directory 2015-03-10 12:08:26 +01:00
910c921d5d Add gitattributes 2015-03-10 11:11:49 +02:00
014120e73e Merge pull request #215 from xPaw/no-version-check
Remove version checks from all include files
2015-03-10 01:02:05 +01:00
73cf46ff45 Merge pull request #216 from luxxxoor/patch-1
Some missing charsmax and more readability.
2015-03-10 00:27:35 +01:00
f49c9c87d4 Merge pull request #195 from Arkshine/feature/zlib-static-lib
Unifiy zlib linkage by compiling it as static library and linking it to concerned projects
2015-03-10 00:25:47 +01:00
9542fce9c5 Zlib: Update AMBuilder 2015-03-10 00:12:56 +01:00
5f6756cb4d Zlib: Remove unrelated changes 2015-03-10 00:06:30 +01:00
e60a2e9fcc Zlib: Fix compilation (implicit-function-declaration error) 2015-03-10 00:06:30 +01:00
a565e4a7b1 Zlib: Update library to 1.2.8 2015-03-10 00:06:29 +01:00
265e15116b Zlib: Adjust VS project files 2015-03-10 00:06:29 +01:00
85b7c26bb0 Zlib: Use the generated static library with MySQL module 2015-03-09 23:59:57 +01:00
9bbeb1f578 Zlib: Use the generated static library with AMXXPC 2015-03-09 23:59:12 +01:00
47cd091879 Zlib: Use the generated static library with AMXX 2015-03-09 23:59:11 +01:00
6ac5211062 Zlib: Compile as static library 2015-03-09 23:59:11 +01:00
25b1fa6fe0 Zlib: Add latest library version in /public directory 2015-03-09 23:59:10 +01:00
dcae6a8a20 Merge pull request #218 from Arkshine/feature/amtl-upstream
Use upstream AMTL as a submodule
2015-03-09 23:25:15 +01:00
1ebd9044ca Fix AppVeyor 2015-03-09 23:12:27 +01:00
181cbae74c Use upstream AMTL as a submodule 2015-03-09 22:53:58 +01:00
205a0eb2da admincmd.sma: Missing charsmax and more readability.
Fix charsmax and more readability
2015-03-09 23:35:04 +02:00
22c3d62dec Merge pull request #208 from Nextra/inc-doc2
Update include documentation #2
2015-03-09 19:45:47 +01:00
a82f521633 amxmodx.inc: missing commas, typo errors... 2015-03-09 19:41:21 +01:00
bc9710e8f2 inc-doc2 nits/finishing touches 2015-03-09 19:41:21 +01:00
902cecb0c3 amxconst: Minor improvements on client_print natives 2015-03-09 19:41:20 +01:00
950f3f97c1 datapack: Tabs->spaces, consistency, nuke IsPackReadable 2015-03-09 19:41:19 +01:00
828d9971a4 cvars: Style touchups, add missing stuff, update notes about named access 2015-03-09 19:41:18 +01:00
50fea6be75 cstrike/csx/csstats: Added documentation, consistency updates, typo fixes 2015-03-09 19:41:18 +01:00
a1c5c20d7e amxmodx: Consistency updates, typo fixes, missing return/error added 2015-03-09 19:41:17 +01:00
ae86152282 cellarray/celltrie/cellstack: Documentation fixes and consistency updates 2015-03-09 19:41:16 +01:00
9eb0eaf6a6 core: Add documentation 2015-03-09 19:41:15 +01:00
5f278eee7b amxmisc: Documentation updates and additions 2015-03-09 19:41:15 +01:00
362a7e61f9 Merge pull request #214 from 9iky6/patch-13
Update menufront.sma
2015-03-09 14:47:08 +01:00
379d9121b4 Remove version checks from all include files 2015-02-25 00:56:17 +02:00
09ed8eb2b1 Update menufront.sma 2015-02-23 02:21:20 +05:00
45b63c4394 Update menufront.sma
Just a minor update the plugin and change work in lang-key: you can now add the file through the menu items with the lang-key.
2015-02-20 23:46:26 +05:00
c4497ff17d Merge pull request #211 from Arkshine/fix/cvar-mapchange
Fix issue where at mapchange a cvar current value is overwritten by defined bounds where it should not
2015-02-20 15:50:49 +01:00
62413f6277 Merge pull request #213 from ClaudiuHKS/CLang_mTime
Replace CLang file hashing with .st_mtime
2015-02-19 21:11:10 +01:00
530d0bf570 Replace CLang file hashing with .st_mtime
Replace CLang file hashing with .st_mtime for performance.
Also, fix a problem in CLangMngr::MergeDefinitionFile.
2015-02-19 21:28:45 +02:00
80b01d3505 Fix issue where at mapchange a cvar current value is overwritten by defined bounds where it should not 2015-02-19 16:05:49 +01:00
2b9e9c79b9 Merge pull request #207 from ClaudiuHKS/MySQLThreadingFix
Fix SQL Modules Threading
2015-02-18 19:34:18 +01:00
3fc438ffd1 Fix SQL modules threading system. 2015-02-18 10:32:45 +02:00
3b16c6be92 Merge pull request #210 from Nextra/destroy-invalid
Fix ArrayDestroy/DestroyStack erroring on invalid handle
2015-02-18 00:44:26 +01:00
78f577686a Fix ArrayDestroy/DestroyStack erroring on null handle 2015-02-17 23:24:17 +01:00
af6c6850ec Merge pull request #206 from ClaudiuHKS/master
Add new hashers and new natives
2015-02-17 14:34:38 +01:00
38db4d3ae0 Updating hahsers INC files and Acknowledgements
INC files have been updated changing the information, adding new
details.
Acknowledgements file includes now Hashing Librarying license.
Spacing consistency has been fixed in CPP Hashing files.
Testsuite plug-in has been rewritten, now using Server Commands.
2015-02-16 16:30:45 +02:00
c071f53f2c Add new hashers and new natives
Replace the only hasher called MD5 with the ones listed below.

(+) CRC32, MD5, SHA1, SHA256, SHA3 224 BIT, SHA3 256 BIT, SHA3 384 BIT,
SHA3 512 BIT, Keccak 224 BIT, Keccak 256 BIT, Keccak 384 BIT and Keccak
512 BIT.

Add the natives listed below.

(+) hash_string(const string[], hashType:type, output[], const
outputSize)
(+) hash_file(const fileName, hashType:type, output[], const outputSize)
(+) is_arkshine_a_doctor() :  Hidden native, but a sign of recompense
for him being very active since 1.8.3 version of AMX Mod X
(+) get_system_endianness() :  Checks if the system is currently Big
Endian or Little Endian.

Add the following Enum.

(+) hashType {}
(+) sysEndianness {}

Deprecate the following natives.

(-) amx_md5()
(-) amx_md5_file()

It has been tested on Windows and Linux. The sanity checks seems to be
properly working, so no worries about them.

These are useful if people are using Sockets, cURLs or MySQLs in order
to compare hashes of different files On-line for further investigation.
You are not able to check if the files are older or newer, but you can
see if the content is different (Hash Checksum mismatch).

I'm glad I did this. Thanks to
2015-02-16 14:39:45 +02:00
5a7752a22e Merge pull request #205 from ClaudiuHKS/patch-1
Fix missing "queuetime" FP_ param in SQL_ThreadQuery (sqlite) callback
2015-02-13 10:38:41 +01:00
ddb1af89e9 Added new FP_CELL to SQLite Forward
Added new FP_CELL to SQLite Forward.
2015-02-13 09:08:27 +02:00
7452317c10 Merge pull request #203 from Arkshine/fix/crash-on-shutdown
Fix crash by freeing memory the right way
2015-02-12 14:46:53 +01:00
120e5b94f9 Fix crash by freeing memory the right way 2015-02-12 14:37:46 +01:00
4ec11496e6 Fix missing new lines in "amxx version" command 2015-02-12 10:46:20 +01:00
c556bf9f68 Merge pull request #202 from Arkshine/fix/crash-null-detour
Fix crash when cvar hook detour is not created
2015-02-11 00:19:08 +01:00
fb28b2d416 Fix missing parenthesis. 2015-02-11 00:18:22 +01:00
e99a1c8b09 Fix crash when cvar hook detour is not created 2015-02-10 23:19:03 +01:00
0b80c4367d Merge pull request #201 from Arkshine/cleanup-geoip-code
Cleanup some code from previous commits
2015-02-08 11:24:37 +01:00
e95d5ed43c Cleanup some code from previous commits 2015-02-08 11:23:54 +01:00
553663c952 Merge pull request #200 from ClaudiuHKS/master
Set length to 0 on failed lookup in lookupString()
2015-02-08 11:01:43 +01:00
780ce669d0 >> RENAMED maxminddb.cpp (FILTERS)
RENAMED maxminddb.cpp TO maxminddb.c (FILTERS)
2015-02-07 18:42:01 -08:00
47b5ff9a93 >> FIXED lookupString() LENGTH ISSUE
In (const char *) lookupString() :
For (const char *) NULL result :

Length must be ZERO, if defined.
2015-02-07 18:40:52 -08:00
2bc6ced671 >> RENAMED maxminddb.cpp (MAKEFILE)
RENAMED maxminddb.cpp TO maxminddb.c (MAKEFILE)
2015-02-07 18:39:21 -08:00
f4738600b4 Merge pull request #1 from ClaudiuHKS/ClaudiuHKS-patch-1
>> RENAMED maxminddb.cpp (VCXPROJ)
2015-02-07 18:37:00 -08:00
83c0789246 >> RENAMED maxminddb.cpp (VCXPROJ)
>> RENAMED maxminddb.cpp TO maxminddb.c (VCXPROJ)
2015-02-07 18:34:46 -08:00
0424aa7c19 Merge pull request #148 from Arkshine/update-sqllite
Update sqlite
2015-02-07 18:23:03 +01:00
3e6d806ce2 Merge pull request #198 from Arkshine/fix/geoip_country-return-on-fail-lookup
Fix various compatibility issue with geoip module
2015-02-07 17:51:49 +01:00
77762b9c2c Fix typo in documentation 2015-02-07 17:51:30 +01:00
34de3964e6 More cleanup 2015-02-07 16:33:48 +01:00
5241fdf673 Add geoip_country_ex, mark geoip_country as deprecated, and do some cleanup 2015-02-07 16:26:40 +01:00
51adb7385c Fix a compatibility issue with geoip_country native 2015-02-06 23:25:26 +01:00
21edabf07f Merge pull request #197 from Arkshine/fix/osx-compilation-free
Fix OSX compilation
2015-02-06 22:10:43 +01:00
7d6705345d Fix OSX compilation 2015-02-06 22:08:32 +01:00
2dc1982e11 Merge pull request #196 from Arkshine/fix/floorf-dependency-linux
Fix missing libm linkage under linux (math functions like floor, etc.)
2015-02-06 21:51:42 +01:00
041113dbc4 Merge pull request #194 from Freeman-AM/amxmisc-smallupdate
amxmisc.inc: Missing charsmax, more readability, more compliance to amxmodx style.
2015-02-06 21:51:26 +01:00
c93995a827 Fix missing libm linkage (math functions like floor, etc.) 2015-02-06 21:37:14 +01:00
35eeb6036d missing alignment 2015-02-06 01:36:32 +01:00
9e5810e615 amxmisc.inc: Missing charsmax, more readability, more compliance to amxmodx style 2015-02-06 01:32:33 +01:00
a51904b13f Merge pull request #192 from Arkshine/fix/max_players
Change MAX_PLAYERS value to 32
2015-02-03 10:58:39 +01:00
c4ec65bd5a Merge pull request #193 from Arkshine/fix/cstrike-crash-on-start
Cstrike: Fix crash at server start
2015-02-02 12:50:56 +01:00
604f227751 Sqlite: Update broken VS project files 2015-02-02 11:22:45 +01:00
61063a54ef Sqlite: Update library to 3.8.8.2 2015-02-02 11:06:07 +01:00
162171618c Sqlite: Update library to 3.8.7.
Sqlite: Update project files.
2015-02-02 11:06:05 +01:00
14f06ca1bb MAX_PLAYERS: Fix moar 2015-02-01 21:45:16 +01:00
c47896232c CStrike: Fix crash 2015-02-01 20:43:06 +01:00
91c4b5d708 MAX_¨PLAYERS: Fix more. 2015-02-01 20:34:35 +01:00
e441908230 MAX_PLAYERS: Fix plugins 2015-02-01 19:25:36 +01:00
1b350b627b MAX_PLAYERS: Change value in includes 2015-02-01 18:40:20 +01:00
dd38ee103b Merge pull request #189 from Arkshine/feature/add-cs_create_entity
Add cs_create_entity and cs_find_ent_by_class natives
2015-01-31 16:39:43 +01:00
53829a1270 Merge pull request #191 from Arkshine/fix/compiler-tagof
Fix tagof operator used as a default value for function arguments
2015-01-31 16:39:33 +01:00
14b072dd47 Merge pull request #190 from Freeman-AM/small-plmenu-update
Plmenu: small update: formatex, semicolon, missing things, remove useless TABs
2015-01-31 16:39:18 +01:00
30ee4df0fa Fix typo 2015-01-31 15:38:35 +01:00
4ceb767022 Add error messages and fix documentation 2015-01-31 14:45:37 +01:00
b0543a111d Fix tagof operator used as a default value for function arguments 2015-01-30 23:34:04 +01:00
7a3ee17093 Remove #pragma semicolon 1
It could disturb non initiated people who want to modify base plugins.
2015-01-30 22:57:31 +01:00
e0426f10b2 Fix typo 2015-01-30 16:01:26 +01:00
6319331a33 Merge pull request #188 from Arkshine/feature/mysql-rw-and-default-timeout
Establish a default timeout for MySQL connectivity
2015-01-30 15:56:40 +01:00
c87d46ad5b Add cs_find_ent_by_class and fix documentation 2015-01-30 15:53:25 +01:00
7d084ee0bf Merge pull request #185 from Arkshine/feature/hooking-cvars
Introduce new features for cvars
2015-01-30 14:20:11 +01:00
cfc92ca3db Plmenu: small update: formatex, semicolon, missing things, remove useless TABs 2015-01-30 00:57:45 +01:00
1488b9747f Cvars: De-frenchify by Nextra 2015-01-29 21:44:53 +01:00
2446ff49f2 Add cs_create_entity native 2015-01-29 20:43:01 +01:00
98d4031b5c Add a new line at the end to not traumatize Nextra 2015-01-29 17:55:24 +01:00
7e1911b13b Merge pull request #187 from Arkshine/fix/nvault-formatting-issue
Fix potential formatting issue with nvault_[p]set
2015-01-29 17:26:49 +01:00
1f304d55c4 Merge pull request #186 from Freeman-AM/product-version
Wrong product version for amxmodx-installer.nsi
2015-01-29 17:20:51 +01:00
9f93ff5168 Fix potential formatting issue with nvault_[p]set 2015-01-29 16:52:47 +01:00
839bb086b1 Wrong product version for amxmodx-installer.nsi 2015-01-29 14:58:07 +01:00
a5b5c7e9cd Cvars: Fix code to avoid Nextra be confused 2015-01-29 14:01:58 +01:00
f8ec7f94a4 Mysql: Establish a default timeout 2015-01-29 13:50:13 +01:00
f8baef15ca Cvars: Adjust more things
- Moved some functions in CvarManager
- Fixed detour enabled all the time
- Fixed bounds not properly handled
- Refreshed data of regisetered cvars at map change
2015-01-28 23:51:43 +01:00
187b187ef2 Cvars: To not traumatize Nextra 2015-01-28 00:58:07 +01:00
ac50f3ff34 Cvars: Check lower/upper bounds in create_cvar as well 2015-01-28 00:47:01 +01:00
e4a7e67783 Cvars: Adjust few things
- Hook is not as post, because allowing blocking change is not really that useful and this makes a context more simpler.
- Setting a min bound > max bound and reversely throw an error
- set_pcvar_bounds set cvar value on new min/max bound.
- Remove error "A cvar can't be binded with several variables", it's okay to no error such situation.
2015-01-28 00:26:24 +01:00
1a5e1928ec Cvars: Fix field orders and linux compilation 2015-01-27 16:27:26 +01:00
d75b14d4af Cvars: Extend "amxx cvars" command output 2015-01-27 15:07:17 +01:00
0bed55701f Merge pull request #184 from Arkshine/fix/rename-change_level
Rename change_level to engine_changelevel
2015-01-27 00:21:50 +01:00
356a981164 Cvars: Add get/set_pcvar_bool natives 2015-01-26 14:26:48 +01:00
8a241ed0fd Cvars: Add new description param in get_plugins_cvar 2015-01-25 11:38:01 +01:00
cb0b9da51f Cvars: Add bind_pcvar_num/float/string 2015-01-24 21:31:00 +01:00
8ebb7be36d Cvars: Add get|set_pcvar_bounds natives 2015-01-24 15:04:49 +01:00
a05d0df50e Cvars: Add create_cvar native with more options (description, bounds) 2015-01-23 19:05:34 +01:00
15ad1d2247 Cvars: Moving cvars stuffs in its own files
cvars.cpp renamed to CvarManager.cpp
all cvars natives moved to a new cvars.cpp file
Pawn include is updated as wall.
2015-01-23 19:05:34 +01:00
768fa2c3bc Cvars: Add hook_cvar_change, [enable|disable]_cvar_hook natives 2015-01-23 19:05:33 +01:00
0db5963641 Cvars: Remove global forward 2015-01-23 19:05:33 +01:00
cdc7d550eb Cvars: Rearrange a bit some code
Changed class CCVar -> struct CvarInfo
Added CvarManager class and moved some code there
Code of registering a cvar is rewritten
Cvars datas are stored in a hashtable for fast lookup
For natives compatibility, an inline list is kept (though CList -> ke::InlineList)
Replace some CVAR_GET/SEt_ by FindVar
2015-01-23 19:05:32 +01:00
f973f5beb7 Cvars: Convert CString to ke::AString in CCVar class 2015-01-23 19:05:32 +01:00
6619176a76 Cvars: Move CCVar class to cvars.h 2015-01-23 19:05:31 +01:00
faeaf9259e Cvars: Add OnCvarChanged global forward
I really tried to use "cvar_changed" as name, but it bothered me so much to look that weird I could not keep it.
2015-01-23 19:05:31 +01:00
34d91789c4 Cvars: Hook Cvar_DirectSet from engine library 2015-01-23 19:05:30 +01:00
cdfd789f56 Rename change_level to engine_changelevel 2015-01-23 16:55:16 +01:00
5ca0e5617d Merge pull request #173 from Arkshine/feature/compiler-concatenation
Add string literal concatenation and stringizing operator
2015-01-22 20:00:32 +01:00
c197b58734 Merge pull request #183 from Arkshine/fix/cstrike-remove-stringtolower
Remove use of UTIL_StringToLowwer
2015-01-20 12:04:06 +01:00
8072f90536 Remove use of UTIL_StringToLowwer 2015-01-20 11:53:46 +01:00
252f1919c2 Merge pull request #182 from Arkshine/fix/mysql-crash-amtl
Fix a mysql crash after CString -> ke::AString conversion
2015-01-18 19:27:35 +01:00
2e64e9fd52 Merge pull request #181 from Arkshine/feature/add-new-fcvar
Add FCVAR_NOEXTRAWHITEPACE in amxconst.inc
2015-01-18 18:54:39 +01:00
c3e0753455 Fix a mysql crash after CString -> ke::AString conversion 2015-01-18 18:13:39 +01:00
03e426fc28 Add FCVAR_NOEXTRAWHITEPACE in amxconst.inc 2015-01-16 23:21:01 +01:00
7f9d677f89 Merge pull request #178 from Arkshine/feature/update-libmaxminddb-1.0.4
Geoip: Update libmaxminddb to 1.0.4
2015-01-14 12:48:44 +01:00
314f2ec568 Geoip: Fix linux compilation 2015-01-14 12:37:43 +01:00
f09f4a4c6c Geoip: Remove previous C99 compatibility changes with v100
Since we're compiling against v120_xp now, C99 is supported, which makes the previous compatibility changes pointless.
This reverts to the state of the original content.
For maintainability reason, it's welcomed.

For reference, the only change now is the moving of PACKAGE_VERSION define to be available for linux too (since we don't use configure.ac)
2015-01-14 12:35:04 +01:00
6703841c35 Merge pull request #179 from Arkshine/fix/update-vs-projects
Update VS projects
2015-01-14 10:50:08 +01:00
dd9975cd67 Rename msvc10 directories to msvc12 2015-01-14 10:31:33 +01:00
97369c5d6c Upgrade VS projetcs to use v120_xp toolset and fix missing include paths 2015-01-14 10:25:46 +01:00
328c3d7b8b Merge pull request #177 from Arkshine/fix/clang-3.5-compiler-warning
Compiler: Fix tautological warning with clang-3.5
2015-01-12 00:52:29 +01:00
16874378f1 Geoip: Update libmaxminddb to 1.0.4 2015-01-12 00:00:31 +01:00
a0cfa59e56 Compiler: Fix tautological warning with clang-3.5 2015-01-11 23:09:53 +01:00
b4399f42da Geoip: Move C99 headers in its own directory 2015-01-11 16:08:52 +01:00
dfbc74dc5f Merge pull request #176 from Arkshine/fix/keep-geop_country-bcompat
Keep geoip_country backward compatible after #99
2015-01-10 14:55:49 +01:00
539823f565 Keep geoip_country backward compatible after #99 2015-01-10 14:07:51 +01:00
4a3fcdb937 Merge pull request #171 from Arkshine/fix/geoip-invalid-memory
Geoip: Fix possible crash
2015-01-08 10:37:36 +01:00
0bc20edb5b Merge pull request #174 from Arkshine/fix/mac-compilation
Attempt to fix OSX compilation
2015-01-07 19:22:23 +01:00
bab760897b Attempt to fix OSX compilation 2015-01-07 19:23:23 +01:00
7f71cfaee7 Merge pull request #165 from Arkshine/feature/add-version-lib-and-missing-rc
Update versioning system and add missing module RC file (bug 6222)
2015-01-07 18:59:51 +01:00
2ffd4cb9fa Fix with parsing literal strings ending with character '\\'
From Pawn rev32: https://code.google.com/p/pawnscript/source/detail?r=32
E.g.: #define EGG "Gaben^^" (control character + something)

This fixes also compilation under linux.
2015-01-07 00:35:20 +01:00
de2796508f Add string literal concatenation and stringizing operator 2015-01-06 23:39:46 +01:00
aa8170ecfd Merge pull request #172 from Arkshine/fix/osx-compilation
Fix OSX compilation
2015-01-06 23:26:22 +01:00
4fc2b4ed64 Fix OSX compilation 2015-01-06 23:27:51 +01:00
604200e905 Merge pull request #162 from Arkshine/feature/update-amtl-c++11
Add C++11 support
2015-01-06 22:38:19 +01:00
a543db5dc6 Geoip: Fix possible crash 2015-01-06 22:36:14 +01:00
9552049524 Merge pull request #170 from Freeman-AM/cstrike-initvalue
meta_api.cpp: modify csstats_rank value to match amxx.cfg default value
2015-01-05 18:03:00 +01:00
0c85f03f05 meta_api.cpp modify csstats_rank value to match amxx.cfg default value 2015-01-05 17:43:14 +01:00
b883486308 Merge pull request #168 from Ni3znajomy/master
Updated dictionary plmenu.txt
2014-12-28 21:19:05 +01:00
e7e9994b73 Updated PL translations
Updated PL translations
2014-12-28 20:56:52 +01:00
47d6f849f2 Added missing dictionary's key to PL translation.
Added TRANSF_SILENT key to PL translation.
2014-12-28 20:55:54 +01:00
59b7379db4 Merge pull request #167 from Freeman-AM/typo-errors
Users.ini: fix 2 typo errors
2014-12-23 19:31:53 +01:00
e042550ba4 Users.ini: fix 2 typo errors 2014-12-23 19:00:33 +01:00
15528c9583 Merge pull request #166 from rsKliPPy/set_task
Set task
2014-12-17 14:33:28 +01:00
f3dfc6e4c6 Add any: tag to set_task parameter[] 2014-12-14 19:00:15 +01:00
1df58d6231 Merge pull request #164 from Arkshine/fix/regression-member-tag-of-enum
FIx regression with member tag of enum not being checked on assigment
2014-12-13 11:23:10 +01:00
c068eed19d Simplify code. 2014-12-13 11:15:06 +01:00
ab4294f3ca Fix linux compilation 2014-12-10 15:41:52 +01:00
f4a3d07b0e Fix missing binary suffix 2014-12-10 15:05:47 +01:00
4b11a54345 Make sure overriden tag is done with _: 2014-12-09 22:59:57 +01:00
78940b46a4 Untabify code 2014-12-09 22:29:43 +01:00
45bf43d76e FIx regression with member tag of an enum not being checked on assigment 2014-12-09 22:26:59 +01:00
6ba614d425 Merge pull request #163 from Arkshine/fix/sizeof-issue-with-trailing-comma-in-array
Fix trailing commas in array literals changing the result of sizeof()
2014-12-09 00:06:32 +01:00
5e622aa69f Remove static on 'disable' variable 2014-12-08 23:55:30 +01:00
a50f104fd3 Fix trailing commas in array literals changing the result of sizeof() 2014-12-08 20:45:33 +01:00
8443a836aa Add the actual version.rc file for all modules 2014-12-08 01:44:51 +01:00
f5e23903a2 Add version.rc in AMBuilder for all modules 2014-12-08 01:44:27 +01:00
291a33ce65 Update moduleconfig.h for all modules 2014-12-08 01:43:33 +01:00
7c96c30be8 Replace old SVN_* defines by the new ones 2014-12-08 01:42:42 +01:00
3594c11238 Update versioning 2014-12-08 01:39:10 +01:00
1977bf4d29 C++11: Update AMBuildScript 2014-12-06 14:33:22 +01:00
1146bcad2c C++11: Fix some code 2014-12-06 14:02:55 +01:00
1199863e47 C++11: Update StringHashMap 2014-12-06 14:01:17 +01:00
590e6b1258 C++11: Sync AMTL libraries from upstream 2014-12-06 14:00:15 +01:00
2bba5ce69a Merge pull request #161 from 9iky6/patch-12
Fix spectators not being killed if silent switch is on
2014-12-05 17:23:37 +01:00
015e4f2f33 fix_alive_spectator
Fix invisible living the spectators
2014-11-21 20:56:06 +06:00
8951f80748 Merge pull request #159 from Arkshine/fix-get_user_name
Fix typo in get_user_name() where hostname was returned as blank string
2014-11-13 21:20:40 +01:00
4ffd847b7a Fix typo in get_user_name() where hostname was returned as blank string 2014-11-13 19:01:26 +01:00
0dd638d0fd Merge pull request #158 from Arkshine/fix-sizeof-fix
Improve more sizeof return on array without specifiying the dimensions
2014-11-11 21:09:44 +01:00
1a97b2cbe1 Improve more sizeof return on array without specifiying the dimension 2014-11-11 12:34:16 +01:00
9b662bb0ca Merge pull request #157 from Chuvi-w/master
Revert "Done" text due to AMXX-Studio compatibility.
2014-11-10 19:33:14 +01:00
3775ac40ad Revert "Done" text due to AMXX-Studio compatibility. 2014-11-09 04:04:33 +03:00
666aaf013a Merge pull request #156 from 9iky6/patch-11
Fix stock regex_match_simple
2014-11-07 14:57:12 +01:00
63aff82dc8 Update regex.inc 2014-11-07 18:11:55 +05:00
21ae30b985 Fix stock regex_match_simple
Fix regex_match_simple.

Where regex_match_ex referred to in this file?
2014-11-07 18:09:10 +05:00
d5086f6a54 Merge pull request #154 from ClaudiuHKS/master
Add MySQL Reconnect Feature
2014-10-28 10:15:30 +01:00
005b50de92 Added MySQL Reconnect Feature
If the connection times out or gets lost, this will prevent "MySQL server has gone away" error.
2014-10-27 17:55:23 -07:00
6e60b596d7 Merge pull request #152 from Arkshine/improve-find_ent_by_owner
Allow find_ent_by_owner native to work in client_disconnect forward
2014-10-26 13:06:55 +01:00
929d6255fc Merge pull request #153 from Arkshine/fix-ham-specialbot
Fix specialbot not working with [Enable/Disable]HamForward natives
2014-10-26 13:06:38 +01:00
b451fbd1c8 Fix specialbot not working with [Enable/Disable]HamForward natives 2014-10-25 20:44:17 +02:00
419bdecc20 Merge pull request #149 from Arkshine/improve-get_map_objectives
Improve get_map_objectives native
2014-10-25 12:10:32 +02:00
5f824d64da Merge pull request #150 from Arkshine/add-reset_menu
Allow show_menu native to send empty text + add reset_menu stock (bug 6244)
2014-10-25 12:00:08 +02:00
79479e40c6 Merge pull request #151 from Arkshine/add-msg_init-support
Add MSG_INIT support in message_begin native (bug 6254)
2014-10-25 11:45:02 +02:00
cfcd6e9ac9 Allow find_ent_by_owner native to work in client_disconnect forward 2014-10-25 11:08:31 +02:00
1bd022305f Add MSG_INIT support in messsage_begin native (bug 6254) 2014-10-24 21:04:42 +02:00
d0ab27092c Allow show_menu native to send empty text and add reset_menu stock (bug 6244) 2014-10-24 20:36:38 +02:00
850ae540a9 Improve get_map_objectives native. 2014-10-24 12:58:24 +02:00
b2aa84ddbd Merge pull request #147 from Arkshine/fix-linux-warning
Fix linux warning in previous commit
2014-10-24 11:43:04 +02:00
9cf4564057 Fix linux warning in previous commit 2014-10-24 11:25:52 +02:00
d8fc093fd8 Merge pull request #143 from ClaudiuHKS/master
Colored Menus and GeoIP Bug Fix
2014-10-18 20:18:29 +02:00
3953db97cd Improving Code 2014-10-18 11:11:10 -07:00
d1c0b8fea6 Improving Code 2014-10-18 11:09:49 -07:00
7ced590cbc Improving Code 2014-10-18 11:04:10 -07:00
82cbc94f27 Improving Code 2014-10-18 10:58:26 -07:00
5d2b738ec1 Improving Code 2014-10-18 10:36:07 -07:00
59a1b018ed Improving Code 2014-10-18 10:34:03 -07:00
3615e717ca Adding New Game Modifications Due Colored Menus
Adding New Game Modifications Due Colored Menus.
2014-10-18 10:10:58 -07:00
e08e140c3c Fixed Switch Statement
Fixed Switch Statement.
2014-10-18 10:10:09 -07:00
aa963603ed Adding New Game Modifications Due Colored Menus
Adding New Game Modifications Due Colored Menus.
2014-10-18 10:09:11 -07:00
3894e53cf6 Merge pull request #141 from Freeman-AM/master
Removal of many hardcoded contents (part 1)
2014-10-13 10:18:32 +02:00
94a4be95fe Nextmap: replace len hardcoded content by charsmax and sizeof 2014-10-12 02:11:07 +02:00
2db8156326 Plmenu: replace len hardcoded content by charsmax 2014-10-12 01:41:58 +02:00
6bb9052261 Mapchooser: missing MAX_NAME_LENGTH 2014-10-12 00:59:08 +02:00
c440929700 Stats: Replace len hardcoded contents by charsmax and sizeof 2014-10-11 23:17:20 +02:00
c2ee729380 Stats_logging: Replace len hardcoded contents by charsmax 2014-10-11 22:41:18 +02:00
4e343f65bd Stats_logging: Replace len hardcoded contents by charsmax 2014-10-11 22:31:11 +02:00
15b160e51a Stats: Replace len hardcoded contents by charsmax and sizeof 2014-10-11 21:29:10 +02:00
2a5fae43b8 Plmenu: replace len hardcoded content by charsmax 2014-10-11 20:55:24 +02:00
59cb65f47a Timeleft: replace len hardcoded content by charsmax and sizeof 2014-10-11 19:51:57 +02:00
93d37a6366 Plmenu: replace len hardcoded content by charsmax 2014-10-11 19:07:24 +02:00
6e183f3e64 Plmenu: fix typos errors from previous commit 2014-10-11 19:05:25 +02:00
3776650a38 Nscommands: remove an hardcoded value 2014-10-11 18:13:08 +02:00
7e9e2b7b58 Stats: more use of sizeof 2014-10-11 17:55:42 +02:00
6e525ea8fe Statsx: more use of sizeof 2014-10-11 17:46:29 +02:00
8d4a1ca359 Restmenu: more use of sizeof 2014-10-11 17:04:12 +02:00
ea23bdb579 Nscommands: replace len hardcoded content by charsmax 2014-10-11 16:20:49 +02:00
cff3ab867a Nextmap: replace len hardcoded content by charsmax and sizeof 2014-10-11 16:00:11 +02:00
8071b895d2 Idlekicker: replace len hardcoded content by sizeof 2014-10-11 14:39:34 +02:00
8b9c107a03 Stats: Replace len hardcoded contents by sizeof + fix typo error in previous commit 2014-10-11 14:31:56 +02:00
ee6285c79d Statsx: Replace len hardcoded contents by sizeof 2014-10-11 14:10:36 +02:00
54ab06493a Restmenu: fix a typo error induced by previous commit 2014-10-11 14:07:38 +02:00
97aac34dc9 Miscstats: replace len hardcoded content by sizeof 2014-10-11 14:02:15 +02:00
2e1a7b56d8 Merge pull request #140 from Nextra/menu-recursion
Fix recursion issues with show_menu and newmenus
2014-10-11 10:58:00 +02:00
41d7554efd Fix recursion issues with show_menu and newmenus 2014-10-11 00:35:05 +02:00
d7911d8f3f Mapchooser: replace len hardcoded content by charsmax 2014-10-08 23:47:51 +02:00
7ba6f72825 Idlekicker: replace len hardcoded content by charsmax 2014-10-08 23:31:00 +02:00
9a9dd7a4ad Stats_logging: replace len hardcoded content by charsmax 2014-10-08 23:24:48 +02:00
2cc771371a Stats: Replace len hardcoded contents by charsmax
Note: TOPX is over 8 char len in some languages.
2014-10-08 22:52:57 +02:00
0a4cd13622 Plmenu: replace len hardcoded content by charsmax 2014-10-08 21:49:00 +02:00
91dfec4ef7 Statsx: Replace len hardcoded contents by charsmax 2014-10-08 15:03:51 +02:00
0237153ddd Stats_logging: Replace len hardcoded contents by charsmax 2014-10-08 14:32:03 +02:00
71f011c70d Restmenu: replace len hardcoded content by charsmax and sizeof 2014-10-08 14:21:53 +02:00
581f734099 Merge pull request #139 from 9iky6/patch-10
Update engine_stocks.inc
2014-10-05 15:42:21 +02:00
8ea62d22cb Update engine_stocks.inc
When compiling was varningov , and the function itself was crooked written
2014-10-05 16:19:47 +06:00
f8b2d26a00 Merge pull request #137 from Arkshine/update-compiler-2
Update compiler - 2
2014-09-29 20:42:17 +02:00
3b3e78d65b Compiler: Remove commented code in previous commit 2014-09-29 20:36:14 +02:00
a8efe40293 Merge pull request #138 from Arkshine/sync-amtl
Sync AMTL from upstream
2014-09-29 19:05:58 +02:00
35e661fdf9 Sync AMTL from upstream 2014-09-29 18:36:37 +02:00
e1206eb310 Merge pull request #136 from Freeman-AM/master
Missing stuff in cstrike and ns amxx.cfg
2014-09-29 17:39:18 +02:00
199b41af0a Compiler: Treat pawn warnings as errors when building 2014-09-29 15:55:16 +02:00
e7c7313f77 Compiler: Add a flag for warnings-as-errors 2014-09-29 15:54:39 +02:00
ae2699ca98 Compiler: Disable estimated memory usage 2014-09-29 15:12:56 +02:00
2bae36e8eb Replace hardcoded defines in adminhelp with cvars 2014-09-28 18:02:16 +02:00
12c08ddcdb Update core to use amx_language cvar instead of vault 2014-09-28 17:59:01 +02:00
f1f2d9f98a Replace hardcoded defines in adminhelp with cvars 2014-09-28 17:48:16 +02:00
47d2da259b Update core to use amx_language cvar instead of vault 2014-09-28 17:41:48 +02:00
e7452e00ce Merge pull request #135 from Freeman-AM/master
CS Statx and DOD stats: add missing utf-8 symbols support in motd
2014-09-21 13:01:43 +02:00
83873aa7f7 Stats: Add full UTF-8 symbols support 2014-09-21 02:39:09 +02:00
9a1b7b0a63 Statsx: Add full UTF-8 symbols support 2014-09-21 00:42:03 +02:00
a350be335b Merge pull request #134 from WildCard65/master
Fix typo in modules.cpp
2014-09-20 02:51:05 +02:00
a676d9ea52 Fix typo in modules.cpp
Ya...
2014-09-19 20:45:44 -04:00
598936be46 Merge pull request #133 from Arkshine/sync-amtl
Sync AMTL
2014-09-18 19:41:51 +02:00
d0623e5ef7 Merge pull request #132 from Arkshine/geoip-fix-typo
Fix typo in #99 (reported by Hattrick)
2014-09-18 19:41:40 +02:00
bc5924a780 Merge pull request #131 from Arkshine/fix-plugin-warning
Fix unreachable code warning (reported by kwpd)
2014-09-18 19:41:31 +02:00
c1dca680f2 Don't remove this return 2014-09-18 19:35:29 +02:00
d4b0444d7a Sync AMTL 2014-09-18 19:29:58 +02:00
d9efe61030 Fix typo in #99 (reported by Hattrick) 2014-09-18 19:24:37 +02:00
a93886fb65 Fix unreachable code warning (reported by kwpd) 2014-09-18 19:17:00 +02:00
87774ae21f Merge pull request #130 from Arkshine/fix-regression
Fix a crash regression in #112
2014-09-15 13:27:49 +02:00
19e06100b2 Fix a crash regression in #112 2014-09-15 09:57:38 +02:00
e8acb93b99 Merge pull request #75 from LittleKu/patch-1
Add chinese language
2014-09-04 23:25:11 +02:00
4d0d865700 Update stats_dod.txt 2014-09-04 13:57:10 +08:00
8bd81ee883 Update restmenu.txt 2014-09-04 12:33:53 +08:00
8b0a8737b8 Update plmenu.txt 2014-09-04 12:19:59 +08:00
c111f59825 Update pausecfg.txt 2014-09-04 12:14:27 +08:00
f2ba295668 Update nextmap.txt 2014-09-04 11:59:54 +08:00
01dbd4093b Update statscfg.txt 2014-09-04 11:58:05 +08:00
152c984176 Merge pull request #128 from Arkshine/Fix-missing-compiler-message
Fix compiler crash due to missing recursion message warning (bug 6251)
2014-08-31 14:59:08 +02:00
de85f2735e Fix compiler crash due to missing recursion message warning. 2014-08-31 14:52:24 +02:00
39cf32879d Merge pull request #127 from Ni3znajomy/master
Fix a typo in the documentation.
2014-08-29 22:04:14 +02:00
47413928c8 Fix a typo in documentation. 2014-08-29 16:48:30 +02:00
1463103cd7 Merge pull request #116 from Arkshine/update-compiler-safe-fix-feature
Update compiler
2014-08-26 09:07:45 +02:00
f30c7a63b1 Compiler: Fix linux compilation and close file handle on success in pc_opensrc. 2014-08-26 09:06:02 +02:00
e46785a434 Compiler: Improve/fix recursion detection.
Imported from Pawn 3.2.3664 and 3.3.3875.
2014-08-26 09:05:23 +02:00
a873066466 Compiler: Fix enum field size was not taken into account when implicitly passed to a function.
Imported from Pawn 3.3.3930.

Example:

---

enum tag
{
  member[32]
}

new var[tag];

foo(const string[], size = sizeof(string))
{
    // size returns 1 before fix, 32, after.
}

public plugin_init()
{
    foo(var[member]);
}

---
2014-08-26 09:05:22 +02:00
f60b00ee71 Compiler: Use hash table for global name lookups.
Imported from SM: https://bugs.alliedmods.net/show_bug.cgi?id=4496.
2014-08-26 09:05:20 +02:00
a876962405 Compiler: Use in-memory buffers for reading files, and handle newlines better.
Imported from https://github.com/alliedmodders/sourcemod/pull/63.
2014-08-26 09:05:18 +02:00
c2ca5d857d Compiler: Change __line to __LINE__. 2014-08-26 09:05:17 +02:00
27825963f6 Compiler: Fix indentation. 2014-08-26 09:05:15 +02:00
ca7b0ceadd Compiler: Revert "Add #warning directive."
Probably not that useful.
2014-08-26 09:05:13 +02:00
32b546df69 Compiler: Revert "Fix runtime error in variadic functions that return strings."
Better fix by dvander will be provided later.
2014-08-26 09:05:11 +02:00
cea2f598b2 Compiler: Fix a regression in handling multi-dimensional arrays (introduced in 744d67b)
Fix imported from Pawn 3.3.4058.
2014-08-26 09:05:10 +02:00
d44eb7bf8d Compiler: Update VERSION_INT.
Some people may want to check compiler version with __Pawn, and it would be a good idea to bump the version.
Since we have a special version, and to avoid to use digit which may be used by official version, I propose using letters, so: 0x30A.
This should be resonneable.
2014-08-26 09:05:08 +02:00
e1445316aa Compiler: Fix moar. 2014-08-26 09:05:07 +02:00
238e3707c8 Compiler: Fix linux compilation. 2014-08-26 09:05:05 +02:00
16e5f54507 Compiler: Improve the reported line number accuracy on warning 203/4 (symbol never used).
Imported from Pawn 3.1.3541+.
https://code.google.com/p/pawnscript/source/detail?r=25
2014-08-26 09:05:03 +02:00
65c29cafa0 Compiler: Fix #elseif handling not working as expected.
Improted from Pawn 3.1.3636.

-- Example

#define VAR 1

#if VAR == 1
  // code
#elseif VAR == 2
  // code
#endif

--
Returns error(38).
2014-08-26 09:05:01 +02:00
c4b233d094 Compiler: Improve sizeof return on array without specifiying the dimensions.
Imported from Pawn 3.1.3636.

"When making an array without specifiying the dimensions, but where the element
count at the lowest dimension is the same for all, the compiler now "counts"
this size, rather than setting the lowest dimension as "variable length".

An example for this situation is the declaration:
    new my_array[][] = { {1,0}, {2,1}, {3,1} }
No dimensions are given, but the new compiler determines that the minor
dimension is 2 (and the major dimension is 3). Previous compilers set the
minor dimension to 0 --meaning "variable"."
2014-08-26 09:05:00 +02:00
cd189320e5 Compiler: Fix the "@" character was not allowed in macro definitions (while the documentation stated that they were).
Imported from Pawn 3.1.3599.
2014-08-26 09:04:58 +02:00
17114347d1 Compiler: Fix runtime error in variadic functions that return strings.
Imported from SM-AM: 1d1244c2f0.

"This fixes a bug where returning a string from a variadic function caused
an invalid memory access error during runtime. It seems like they forgot
to update existing string return code for variadic functions."
2014-08-26 09:04:56 +02:00
1866afd80b Compiler: Add __line
Imported from SA-MP: 605ae7f4d3
This is a backport from Pawn 4.0. It sets to the current line number during compile time.
Documention for 3.x actually mention this.
2014-08-26 09:04:55 +02:00
fcdeea683b Compiler: Add #warning directive.
Basically same as error but as warning.
Imported from SA-MP: 1bd6be93e0

Example:

  #warning don't eat egg.

Result:

  warning.sma(1) : warning 234: user warning: don't eat egg.
2014-08-26 09:04:53 +02:00
92255bcdc3 Compiler: Fix crash when using tagof(tagname:)
Imported from SA-MP: 53ef10ffc7
2014-08-26 09:04:52 +02:00
b2442a2268 Compiler: Ignore #pragma tabsize with non-positive argument.
Imported from SA-MP: 7f30a03f94.
2014-08-26 09:04:50 +02:00
1b3b07d4d8 Compiler: Add __BINARY_PATH__ and __BINARY_FILE__.
Imported from SM: https://hg.alliedmods.net/sourcemod-central/rev/bd38ac67afe1 and https://hg.alliedmods.net/sourcemod-central/rev/eb4c45360aaf.
2014-08-26 09:04:48 +02:00
95f3b0d354 Compiler: Fix return omission with else-after-return.
Imported from SM: https://bugs.alliedmods.net/show_bug.cgi?id=4852.
2014-08-26 09:04:47 +02:00
9b5c6bfff0 Compiler: Fix asserting when returning a string literal.
Imported from SM: https://bugs.alliedmods.net/show_bug.cgi?id=3836.
2014-08-26 09:04:45 +02:00
57b172072a Compiler: Fix bogus assert about name lengths.
Imported from SM: https://bugs.alliedmods.net/show_bug.cgi?id=4486.
2014-08-26 09:04:44 +02:00
3b2618f63b Compiler: Fix improper handling of constant chained relational operators.
Imported from SM: https://bugs.alliedmods.net/show_bug.cgi?id=3838.
2014-08-26 09:04:42 +02:00
4f525b9150 Compiler: Fix memory corruption when parsing natives.
Imported from SM: https://bugs.alliedmods.net/show_bug.cgi?id=5840
2014-08-26 09:04:40 +02:00
325a746d90 Compiler: Fix issue with multidimensional array variable release.
Imported from SM: https://bugs.alliedmods.net/show_bug.cgi?id=6100.
2014-08-26 09:04:39 +02:00
6978e2dc4c Compiler: Fix in recursion detection.
Original fix imported from pawn 3.1.3522.
This fixes where for some plugins you would have:

   Stack/heap size:      16384 bytes; usage is unknown, due to recursion

Now, you get:

   Stack/heap size:      16384 bytes; estimated max. usage=782 cells (3128 bytes)
2014-08-26 09:04:37 +02:00
520493fab1 Compiler: Add #pragma deprecated.
This is based on SM, including patch to support macros/constants (https://hg.alliedmods.net/sourcemod-central/rev/ef8dd1cddc35).
Updated also some pawn includes to use this new pragma.
2014-08-26 09:04:36 +02:00
09303625fb Compiler: Generate .scp files as part of the build process.
Stolen from SM (https://github.com/alliedmodders/sourcemod/pull/112).
2014-08-26 09:02:38 +02:00
02b6d0a288 Compiler: Increase input line length.
1023 can be achieved really fastly, e.g. with some SQL definitions.
This is the same value as SM.
2014-08-26 09:02:36 +02:00
4d454b474c Attempt to fix build 2014-08-23 10:17:47 +02:00
204004b90e Merge pull request #112 from Arkshine/deduplicate-files
Deduplicate a number of files used by modules by moving them to the public directory
2014-08-23 10:00:13 +02:00
ccf919c58c Fix typo in previous commit (r=dvander) 2014-08-21 20:57:08 +02:00
567fbcd517 Fix build. 2014-08-19 21:38:44 -07:00
7f25e28d01 Merge pull request #121 from alliedmodders/fix-variadic
Fix returning strings from variadic functions.
2014-08-19 13:48:50 -07:00
9e0f946696 Merge pull request #124 from Arkshine/fix-sound-onbuy
Block weapon pickup sound if shield is disallowed in CS_OnBuy forward.
2014-08-19 19:27:36 +02:00
bd08cc5126 Merge pull request #126 from Arkshine/feature-find-player-engclient_print
Allow some natives to be used on connecting players (bug 6229).
2014-08-19 18:35:52 +02:00
bf23890a34 Reverse condition for clarity and to make Nextra happy! 2014-08-19 18:25:00 +02:00
9eedca0a98 Merge pull request #125 from Arkshine/fix-abort
Don't show blank line in abort() with AMX_ERR_NONE (bug 6233).
2014-08-19 18:15:24 +02:00
68aec7eec0 Use new flags in get_players/find_player instead to avoid breakage. 2014-08-19 15:39:06 +02:00
76811b7b84 Allow get_players() as well. 2014-08-19 10:08:25 +02:00
38d43e8fc9 Merge pull request #122 from xPaw/lastmanhp
Add an option to disable showing last man's health (bug 5847)
2014-08-19 09:56:07 +02:00
9cd90838e1 Remove safety checks as it's not really necessary. 2014-08-19 09:04:09 +02:00
e7d7de870a Block weapon pickup sound if shield is disallowed in CS_OnBuy forward. 2014-08-18 22:02:08 +02:00
bcbf454255 Merge pull request #123 from yamikaitou/master
Fix compile error
2014-08-18 14:36:49 +02:00
4dd53b333f moving comment 2014-08-18 06:34:18 -05:00
b1b47a6d4c fix compile error 2014-08-18 05:36:37 -05:00
518944c41e Add an option to disable showing last man's health (bug 5847) 2014-08-18 12:36:13 +03:00
481e1528d6 Don't show blank line in abort() with AMX_ERR_NONE (bug 6233). 2014-08-17 23:33:00 +02:00
33c0a676fd Allow find_player() and engclient_print() (in console) to be used on connecting players (bug 6229). 2014-08-17 23:31:46 +02:00
6bbc4c8dbd Fix returning strings from variadic functions. 2014-08-17 10:00:51 -07:00
19f1c1a9ec Merge pull request #119 from reuben/metamod-path
Look for Metamod in ../metamod-hl1 as well since that's the name of the new git repo
2014-08-17 15:45:00 +02:00
5d9428f014 Look for Metamod in ../metamod-hl1 as well since that's the name of the new git repo. 2014-08-16 18:16:03 -03:00
63774d75f3 Remove "Done." text from compiler. 2014-08-16 18:03:34 +01:00
f185eaa232 Update TRANS_SILENT Serbian translaton. 2014-08-16 17:41:27 +02:00
d49064b43e Merge pull request #113 from kiapwnz/silentswitch
Added Silent Transfer Option in Team Menu.
2014-08-16 15:13:18 +02:00
e6b8188480 Merge pull request #118 from Arkshine/zlib-update-vs-project
Update VS projects in #117.
2014-08-16 14:46:49 +02:00
ab81658471 Update VS projects in #117. 2014-08-16 14:19:09 +02:00
8883624b2e Merge pull request #117 from alliedmodders/compile-zlib
Remove pre-compiled zlib from the tree
2014-08-16 13:07:30 +01:00
62f6b25b63 Remove pre-compiled zlib from the tree. 2014-08-16 00:33:33 +01:00
e6c3d42eb8 Merge pull request #115 from alliedmodders/emscripten
Add support for Emscripten to the compiler.
2014-08-15 23:49:03 +01:00
3a43a41141 Added back estimated stack usage. 2014-08-15 23:46:16 +01:00
f886e69dfb Fixed linux build. 2014-08-15 23:23:11 +01:00
46123d359f Add support for Emscripten to the compiler. 2014-08-15 16:32:00 +00:00
8f2aeed9da Fix missing TE_BEAMENTPOINT define. 2014-08-15 14:20:51 +02:00
Kia
8890b2fd27 Added languages, languages available now :
[en]
[de]
[fr]
[sv]
[ru]
[pl]
[es]
[sk]
[sr]
[tr]
[da]
[nl]
[bp]
[cz]
[fi]
[bg]
[ro]
[hu]
2014-08-13 14:20:29 +02:00
Kia
5ee794f9f4 Fixed another Typo. 2014-08-11 16:41:35 +02:00
Kia
2ab4a8a44a Added Silent Transfer Option in Team Menu. 2014-08-11 16:38:16 +02:00
Kia
5ba0e3ec2a Added Silent Transfer Option in Team Menu.
Players will be transferred without getting killed if admin chooses to enable this function.
2014-08-11 14:46:30 +02:00
0fed80968b Fix OSX compilation #1. 2014-08-10 22:58:38 +02:00
41f6932b68 Remove some SourceMod namespace. 2014-08-10 22:25:14 +02:00
1ae40316a8 Fix nvault issues.
This includes an original one leading to a crash at mapchange if empty key or value are saved.
2014-08-10 22:11:40 +02:00
3dace577fe Remove svn_version.h reference from project files. 2014-08-10 19:08:50 +02:00
1395b42692 Update wincsx project files. 2014-08-10 19:06:21 +02:00
c0a132e039 Update tsx module project files. 2014-08-10 18:53:13 +02:00
9b6110edc6 Update tsfun module projects files. 2014-08-10 18:47:02 +02:00
2b64ee21b3 Update tfcx module project files. 2014-08-10 18:42:04 +02:00
a290f7d299 Update sockets module project files. 2014-08-10 18:38:24 +02:00
a8e6cfe5cf Update regex module project files. 2014-08-10 18:29:55 +02:00
9d53d48552 Update ns module project files and use AMTL. 2014-08-10 18:29:55 +02:00
3f6ad29f55 Update sqlite module project files and use AMTL. 2014-08-10 18:29:38 +02:00
ab16be08f5 Update nvault module project files and use AMTL. 2014-08-10 18:29:19 +02:00
3ba84fb283 Update mysql module project files and use AMTL. 2014-08-10 18:29:10 +02:00
4f3d335ab4 Update hamsandwich module project files and use AMTL. 2014-08-10 18:28:56 +02:00
4f776ee56b Update geoip module project files. 2014-08-09 20:59:21 +02:00
40313929eb Update fun module project files. 2014-08-09 20:54:20 +02:00
c76509fe41 Update fakemeta module project files and use AMTL. 2014-08-09 20:50:45 +02:00
889ad7c3eb Update engine module project files and use AMTL. 2014-08-09 20:32:10 +02:00
d59f4cf199 Update dodx module project files. 2014-08-09 19:56:34 +02:00
dc9c2897fd Update dodfunc module project files. 2014-08-09 19:53:37 +02:00
b17c624c81 Update csx module project files. 2014-08-09 19:47:31 +02:00
9dee60934f Update cstrike module project files. 2014-08-09 19:33:04 +02:00
bc856740f2 Update AMBuildScript and renamed the generic moduleconfig.h file to avoid conflict. 2014-08-09 18:27:55 +02:00
c497d478ce Move out base sdk folder into public directory. 2014-08-09 17:35:08 +02:00
17683249fd Merge pull request #111 from Arkshine/fix-array-bcomp
Fix missing backward compatibility for some Array natives.
2014-08-09 15:31:03 +02:00
2c146f564e Fix missing backward compatibility for some Array natives. 2014-08-09 15:22:18 +02:00
fc1732e758 Fix possible compatibility issue,
Unfortunately some plugin doesn't explicit max length, resulting a compilation error with AMXX 1.8.3 compiler.
2014-08-09 13:09:53 +02:00
486fa99602 Trigger a build. 2014-08-08 21:26:44 +02:00
570c9cfc6b Merge pull request #110 from Arkshine/replace-more-snprintf
Replace more snprintf by UTIL_Format.
2014-08-08 20:38:38 +02:00
02bed88835 Merge pull request #109 from Arkshine/update-project-files
Update project files.
2014-08-08 20:38:17 +02:00
62eac5d91c Replace _snprintf too. 2014-08-08 13:23:38 +02:00
b47aa6871d Replace more snprintf by UTIL_Format. 2014-08-08 12:47:15 +02:00
eeb4ecd109 Update project files. 2014-08-08 11:27:40 +02:00
c22bb12c1e Merge pull request #108 from Nextra/inc-doc
Update include documentation (mainly amxmodx.inc)
2014-08-08 01:25:56 +02:00
b096f94ca4 amxconst: Purge tabs 2014-08-07 23:13:03 +02:00
a63042d961 amxmodx/cellarray: Assorted consistency updates and typo fixes 2014-08-07 23:02:39 +02:00
8b42767b19 amxmodx: Precaching documentation is the bane of my existence 2014-08-07 22:01:21 +02:00
20a173d8a3 amxmodx: Improve precache comments 2014-08-07 21:49:56 +02:00
08315a4329 message_const: Move TE_USERTRACER example into the comment block 2014-08-07 21:42:18 +02:00
a7d94a4859 Merge pull request #107 from Arkshine/Fix-array-compatibility-issue
Fix a compatibility issue with the "reserved" parameter.
2014-08-07 21:38:51 +02:00
72b514cdde Make sure reserved parameter is a not a negative value. 2014-08-07 21:31:53 +02:00
4231c5a6ae amxmodx: Sixth and final batch of documentation updates 2014-08-07 21:26:37 +02:00
bbffcbf739 cellarray: Update lying ArrayCreate doc 2014-08-07 21:17:45 +02:00
aa4e60ae27 Fix a compatibility issue with the "reserved" parameter. 2014-08-07 20:40:07 +02:00
6a24935777 Merge pull request #106 from Arkshine/fix-fallback-language
Use server language as fallback if client's "lang" key is not defined.
2014-08-07 19:42:52 +02:00
c03271c856 Use server language as fallback if client's "lang" key is not defined. 2014-08-07 14:20:29 +02:00
8c591bf065 Merge pull request #105 from Arkshine/kill-snprintf
Replace all snprintf with UTIL_Format.
2014-08-07 08:38:21 +02:00
88b69ea8a1 amxmodx: Update change_level doc for consistency 2014-08-07 01:46:11 +02:00
1fb91dc02e Merge branch 'master' of ssh://github.com/alliedmodders/amxmodx into inc-doc
Conflicts:
	plugins/include/amxmodx.inc
	plugins/include/message_const.inc
	plugins/include/sockets.inc
2014-08-07 01:44:04 +02:00
69c46aff80 Replace all snprintf with UTIL_Format. 2014-08-07 01:42:58 +02:00
d3bc58d80b Merge pull request #101 from Arkshine/textparsers
Introduce TextParser API
2014-08-07 01:24:51 +02:00
c72d130fde Merge pull request #104 from Arkshine/add-change_level
Add change_level() native.
2014-08-07 01:24:36 +02:00
58b6f9f353 fix the documentation. How it's possible to not see a double comma! 2014-08-07 01:26:05 +02:00
e9eaae4dd1 Fix documentation. 2014-08-07 01:21:22 +02:00
29eb4e4647 Fix documentation. 2014-08-07 01:18:45 +02:00
6b5387f428 Fix documentation. 2014-08-07 01:16:44 +02:00
a0852adf18 Fix wrong log error message. 2014-08-07 00:53:15 +02:00
c1ed795196 sockets: Convert file to UTF-8 2014-08-07 00:51:17 +02:00
6da2078067 Replace snprintf by UTIL_Format. 2014-08-07 00:51:01 +02:00
9a0a52b7b2 amxmodx: Fix typos, touch up some descriptions, remove/merge lonely comments 2014-08-07 00:46:16 +02:00
8d2770f2f2 Put back original SM headers. 2014-08-07 00:43:29 +02:00
37e22dc22f amxmodx: Fifth batch of documentation updates 2014-08-07 00:19:24 +02:00
fb4d05fd60 Fix documentation. 2014-08-06 19:39:19 +02:00
3369f6d115 Update license in pawn includes and add them in project files. 2014-08-06 09:24:09 +02:00
4b652198f0 Fix compilation. 2014-08-06 09:17:54 +02:00
2d07189e38 Fix few issues. 2014-08-06 09:17:53 +02:00
b97093a778 Add more debug in plugin. 2014-08-06 09:17:51 +02:00
287cc1a0e8 Update MakeFile. 2014-08-06 09:17:50 +02:00
7317f1d233 Update PackageScript. 2014-08-06 09:17:48 +02:00
037af0aec2 Split INI/SMC API. 2014-08-06 09:17:47 +02:00
0cf5a2e12f Expose ParseFile_INI to API.
Some minor changes have been made in parser:

- Added ReadINI_ParseStart and ReadINI_ParseEnd call.
- Function returns SMCResult instead of bool. To avoid unecessary complexity and duplicating natives, this feels more appropriate to let these functions to share some SMCResult and SMCParse constants. Since properly documented, this should be ok.
- Made sure curtok is set to 0 when ptr_val is null, otherwise unexpected value would be passed into the forward.
2014-08-06 09:17:45 +02:00
9af7931a79 Introduce TextParser API. 2014-08-06 09:17:43 +02:00
5fbc5c074d Merge pull request #99 from Arkshine/geoip-update-bis
Update Geoip module.
2014-08-05 23:26:27 +02:00
023c1e3baf Geoip: Fix missing continent id and fix indentation. 2014-08-05 23:00:00 +02:00
3a232f1576 message_const: Add placeholder titles for TE_* messages missing a description 2014-08-05 20:18:16 +02:00
adde73123f Geoip: Update license headers.
Hope this won't break merging.
2014-08-05 20:14:22 +02:00
178608c5f8 Geoip: Make some natives UTF-8 safe. 2014-08-05 20:12:26 +02:00
6babcafbec Geoip: Add a fallback to default language (en) in case of unsuccessful lookup with user's language. 2014-08-05 20:12:24 +02:00
ec3ff1deb9 Geoip: Add command to get database metadata and to dump all data of an IP address for debugging purposes.
And for some reason some project files were not pushed.
2014-08-05 20:12:23 +02:00
67bfe6bb36 Geoip: Fix possible buffer overflow. 2014-08-05 20:12:21 +02:00
17e0ab99e6 Geoip: Update documentation. 2014-08-05 20:12:20 +02:00
674600bab2 Geoip: Reorganize and update project files. 2014-08-05 20:11:31 +02:00
9885c926e9 message_const: Fix up all headings and move notes into the new headings 2014-08-05 20:09:57 +02:00
52543481dd Geoip: Increase buffer and fix potential overflow crash. 2014-08-05 20:09:18 +02:00
d2ed9e70cd Geoip: Add an optional parameter in some natves to get a result in player's language.
This is new with Geoip2 database where some entries, like country, city, etc, are translated in several languages.
So far: de, en, es, fr, ru, pt-BR, zh-CN.
2014-08-05 20:09:16 +02:00
210cba53b9 Geoip: Fix stripPort typo. 2014-08-05 20:08:31 +02:00
abaee9f4a3 Geoip: Add geoip_continent_name() native. 2014-08-05 20:08:30 +02:00
fc19f53ea9 Geoip: Add geoip_continent_code() native. 2014-08-05 20:08:28 +02:00
81d56dfdc0 Geoip: Add geoip_distance() native. 2014-08-05 20:08:27 +02:00
6941e406f4 Geoip: Add geoip_latitude() and geoip_longitude() natives. 2014-08-05 20:08:25 +02:00
b439753ac5 Geoip: Add geoip_timezone() native. 2014-08-05 20:08:24 +02:00
c11f721ad4 Geoip: Add geoip_region_name() native. 2014-08-05 20:08:22 +02:00
b61ed9fa3e Geoip: Add geoip_region_code() native. 2014-08-05 20:08:20 +02:00
95bc1703a6 Geoip: Add geoip_city() native. 2014-08-05 20:08:19 +02:00
0d59209e4c Geoip: Replace GeoIP.dat by GeoLite2-Country.mmdb. 2014-08-05 20:08:17 +02:00
7dd1ea3719 Geoip: Convert code to libmaxminddb API. 2014-08-05 20:08:16 +02:00
9d59de41a2 Geoip: Fix compilation #4. 2014-08-05 20:07:10 +02:00
6916eb8613 Geoip: Module should clear memory at mapchange. 2014-08-05 20:07:08 +02:00
94552e5503 Geoip: Fix compilation #3
Update project files.
2014-08-05 20:04:55 +02:00
936d4f4f6d Geoip: Fix compilation #2
A trick to bypass issue where variable creaton was required at the top of function.
2014-08-05 20:04:54 +02:00
526a70a6d7 Geoip: Fix compilation #1
MSVC doesn't fully implement C99, ssize_t, stdbool.h, etc have to be provided manually.
Most of fixes are casting type and unpacking structure.
2014-08-05 20:04:52 +02:00
58a64597e8 Geoip: Import libmaxminddb library which supports Geoip2 databases. 2014-08-05 20:04:50 +02:00
209f46a235 Geoip: Remove GeoIP library. 2014-08-05 20:04:49 +02:00
2659e63483 amxconst: Add some more structure 2014-08-05 18:59:08 +02:00
d9b20d7896 amxconst: Move SND_* constants where they belong 2014-08-05 18:48:37 +02:00
566596f7b4 cellarray: Touch up documentation to make the parser happy and make it consistent 2014-08-05 16:05:19 +02:00
c9ea68d1d3 Fix typo in documentation. 2014-08-05 11:41:55 +02:00
10d5c8e9ad Add change_level() native. 2014-08-05 09:49:32 +02:00
d60c94cbb1 amxmodx: Fourth batch of documentation updates 2014-08-05 01:39:16 +02:00
9e9e3a9abd hlsdk_const: Fix up section heading to make docgen happy, purge tabs 2014-08-04 23:54:07 +02:00
b2dd2661d0 Merge pull request #103 from alliedmodders/gpl3-deux
Update amxx gpl command and ship license files.
2014-08-04 14:49:29 -05:00
d1122b982c Ship license files with builds. 2014-08-04 14:40:01 -05:00
9c08b11a75 Update 'amxx gpl' server command with new license text. 2014-08-04 14:31:28 -05:00
4733155583 Merge pull request #102 from alliedmodders/gpl3
Add license files for GPL2+/GPL3+ and update headers.
2014-08-04 13:43:21 -05:00
2a18a264d4 Update date for license and GPLv2 exception. 2014-08-04 13:18:42 -05:00
f787db1be5 Update license headers for plugins and includes. 2014-08-04 13:18:41 -05:00
d113b1b646 Update license headers for ts modules. 2014-08-04 13:18:40 -05:00
8be13a4ecc Update license headers for tfcx module. 2014-08-04 13:18:40 -05:00
12775d0627 Update license headers for sqlite module. 2014-08-04 13:18:39 -05:00
5ec6cc0d5e Update license headers for socket module. 2014-08-04 13:18:38 -05:00
edeb44b0b8 Update license headers for regex module. 2014-08-04 13:18:37 -05:00
bf30d1d3ce Update license headers for nvault module. 2014-08-04 13:18:36 -05:00
1fc2e8cc6f Update license headers for ns module. 2014-08-04 13:18:35 -05:00
4be6ca834a Update license headers for mysql module. 2014-08-04 13:18:35 -05:00
7274beebed Update license headers for hamsandwich module. 2014-08-04 13:18:34 -05:00
b7c205baf0 Update license headers for geoip module. 2014-08-04 13:18:33 -05:00
c41219ae79 Update license headers for fun module. 2014-08-04 13:18:32 -05:00
96a8fc5700 Update license headers for fakemeta module. 2014-08-04 13:18:31 -05:00
caf0dbb341 Update license headers for engine module. 2014-08-04 13:18:31 -05:00
82784a6169 Update license headers for dod modules. 2014-08-04 13:18:30 -05:00
b6103a1916 Update license headers for cstrike modules. 2014-08-04 13:18:29 -05:00
1cff91ced5 Update license headers for compiler. 2014-08-04 13:18:28 -05:00
1bb54f839e Update license headers for AMXX core. 2014-08-04 13:18:19 -05:00
63cf35b904 hlsdk_const: Fix up headings for proper display in api reference 2014-08-04 19:55:45 +02:00
bc3808cb3f ham_const: Fix up headings for proper display in api reference 2014-08-04 19:39:40 +02:00
b5aef1856d amxmodx: Third batch of documentation updates 2014-08-04 19:24:36 +02:00
f134ff9fdf amxmodx: Second batch of documentation updates 2014-08-04 16:29:01 +02:00
c9316542be amxconst: Grant @xPaw his beloved tabs 2014-08-04 02:32:12 +02:00
8ba288cfb1 amxmodx: First batch of documentation updates 2014-08-04 00:48:37 +02:00
9544364116 amxconst: Purge tabs 2014-08-04 00:35:52 +02:00
79f15d5621 amxconst: Fix up the headings some more and move long descriptions to @note 2014-08-04 00:30:49 +02:00
45ea164270 Add licenses for GPLv2 and GPLv3. 2014-08-03 17:25:18 -05:00
82371fea3b Add new GPLv3 license text and acknowledgements. 2014-08-03 17:24:27 -05:00
69fc7eeabe Merge pull request #100 from xPaw/xs
Remove XS__LIBRELEASE and tabs so docgen can catch the stocks
2014-08-03 22:25:42 +02:00
c219878ac2 Remove XS__LIBRELEASE and tabs so docgen can catch the stocks 2014-08-03 22:26:54 +03:00
5aef27a3ab amxconst: Add proper headings for all constant types 2014-08-03 16:33:08 +02:00
26d1449ac3 Merge pull request #98 from alliedmodders/vsgen
Tweak build scripts so the vs build frontend will work.
2014-08-02 22:15:24 +02:00
6bf21c5687 Tweak build scripts so the vs build frontend will work. 2014-08-02 12:29:53 -07:00
5ddd37eb77 Merge pull request #97 from Arkshine/expose-set_amxstring_utf8
Expose set_amxstring_utf8 to AMXX API
2014-08-02 21:11:23 +02:00
30b0585447 Fix missing cellstack.inc file. 2014-08-02 18:42:18 +02:00
fc48579776 Update AMXX SDK in all modules. 2014-08-02 18:30:53 +02:00
69371d6d6d Merge pull request #96 from xPaw/inc
Fix some comments
2014-08-02 18:18:27 +02:00
c068c0d0f4 Fix some comments 2014-08-02 19:12:32 +03:00
102f88674b Merge pull request #95 from Arkshine/update-project-files
Update project files.
2014-08-02 13:53:18 +02:00
3b6726e0c7 Update project files. 2014-08-02 13:51:17 +02:00
f43570c964 Fix typo and remove unecessary line. 2014-08-02 13:45:31 +02:00
b5fe5d29c9 Add MF_SetAmxStringUTF8Char and MF_SetAmxStringUTF8Cell. 2014-08-02 13:42:14 +02:00
3ac76914bd Merge pull request #94 from Arkshine/adt-stack
Introduce API to create Stack structures
2014-08-01 23:49:56 +02:00
c3c5149fa0 Add new line at the end of file. 2014-08-01 23:20:29 +02:00
e7b7506efa Introduce API to create Stack structures 2014-08-01 23:14:44 +02:00
0bfcaa85b6 Merge pull request #93 from Arkshine/atcprintf-new-parameters
Add new special format specifiers.
2014-08-01 22:34:57 +02:00
4ab559ceef Fix various issues. 2014-08-01 22:08:45 +02:00
5689be448c Merge pull request #35 from Freeman-AM/master
hlsdk_const.inc : Add iuser1 constants
2014-08-01 19:12:16 +02:00
7aa895089a hlsdk_const.inc : modification of constants description. 2014-08-01 19:09:47 +02:00
bbc83291ef Add new format parameters. 2014-08-01 18:55:07 +02:00
5ef5f4b41f hlsdk_const.inc : modification of constants description. 2014-08-01 18:53:19 +02:00
600e5dce97 hlsdk_const.inc : modification of constants description. 2014-08-01 18:18:56 +02:00
47dc226393 Merge pull request #76 from Arkshine/improve-cellarray
Update dynamic Array.
2014-08-01 18:03:53 +02:00
eabafd4eed Fix typo, documention and others issues. 2014-08-01 09:21:26 +02:00
f5164a9c02 Update statsx.txt 2014-08-01 12:25:36 +08:00
fc560a79d9 Add the SourceMod API doc generator. 2014-07-31 10:22:04 -07:00
c255191a2a Merge pull request #91 from skyrim/bug/possible-buffer-overflow
Fix of a possible buffer overflow
2014-07-31 08:27:43 +02:00
f1b2c802e6 Fix of a possible buffer overflow 2014-07-30 22:43:26 +02:00
8f6f49c9f3 Update scrollmsg.txt 2014-07-31 00:55:54 +08:00
a397dfffb7 Update telemenu.txt 2014-07-31 00:50:09 +08:00
dc9237c1d8 Update time.txt 2014-07-31 00:49:06 +08:00
7248c5e731 Update timeleft.txt 2014-07-31 00:41:38 +08:00
4970aaf02d Update multilingual.txt 2014-07-31 00:36:12 +08:00
6da929dc95 Update miscstats.txt 2014-07-31 00:24:18 +08:00
2b1b400e37 Merge pull request #90 from Arkshine/fix-compilation
Fix compilation.
2014-07-30 10:20:28 +02:00
6040dbfbb9 Fix compilation. 2014-07-30 10:19:41 +02:00
2b93228076 Merge pull request #89 from skyrim/code/charsmax-magic-nums
Replaced sizeof(str)-1 and magic nums with charsmax
2014-07-30 10:07:07 +02:00
0de8ee48d0 Replaced sizeof(str)-1 and magic nums with charsmax 2014-07-29 16:32:32 +02:00
f1e07caca4 Fix compilation. 2014-07-29 12:22:32 +02:00
0365676262 Merge pull request #88 from xPaw/client-cmd-be-g
Remove some client_cmd
2014-07-29 12:15:20 +02:00
c084965cf1 Remove some client_cmd 2014-07-29 13:13:39 +03:00
b4365e3fb9 Merge pull request #87 from xPaw/what-is-this
Instead of assigning FCVAR_PROTECTED to cvars after startup, register cv...
2014-07-28 23:41:40 +02:00
0e0d7ec9d5 Instead of assigning FCVAR_PROTECTED to cvars after startup, register cvars with said flag 2014-07-29 00:33:08 +03:00
4c1dac3cd5 Merge pull request #86 from xPaw/amx-ban
Trim target in amx_ban to prevent bypassing equali checks
2014-07-28 23:02:25 +02:00
ab46adc91c Trim target in amx_ban to prevent bypassing equali checks 2014-07-29 00:00:07 +03:00
919af60ca9 Merge pull request #85 from xPaw/missing-tr
Add missing [tr] translations
2014-07-28 21:45:14 +02:00
437ce48f42 Add missing [tr] translations 2014-07-28 22:40:38 +03:00
16d19097c5 Merge pull request #84 from xPaw/amx-help
Replace hardcoded defines in adminhelp with cvars
2014-07-27 15:05:44 +02:00
fea209fa7f Replace hardcoded defines in adminhelp with cvars 2014-07-27 15:59:09 +03:00
580eb24546 Fix compilation warning. 2014-07-27 13:48:05 +02:00
8d719e1191 Merge pull request #83 from xPaw/leet-speek-can-go-to-hell
Remove leet speak
2014-07-27 13:09:44 +02:00
d2595b8b92 Merge pull request #31 from xPaw/burn-baby-burn
Remove compatibility stuff from the core
2014-07-27 12:07:58 +02:00
fecf24ebfd Add missing [tr] translation in time.txt 2014-07-27 13:05:06 +03:00
d65cedf8c7 Remove leet speak 2014-07-27 13:03:23 +03:00
88042ce5a9 Merge pull request #82 from xPaw/ml-plugin-update
Multilingual plugin update
2014-07-27 11:57:51 +02:00
dff6dc53f4 Use formatex and charsmax 2014-07-27 12:51:36 +03:00
87c0be470b Merge pull request #80 from xPaw/package-script
Package script fixes
2014-07-27 11:44:56 +02:00
3241e91e84 Merge pull request #81 from xPaw/messing-with-copyrights
Update copyright year
2014-07-27 11:42:08 +02:00
499b5a1ac8 Use MAX_PLAYERS 2014-07-27 12:37:58 +03:00
f2b1d26da3 Add --no-mysql to checkout-deps.sh 2014-07-27 12:31:19 +03:00
fae6c52082 Don't build mysql module with travis because every time it runs, it downloads full mysql sourcecode 2014-07-27 12:17:07 +03:00
a6f10efd03 splitext didn't work 2014-07-27 12:11:44 +03:00
5d85c0a965 Update VS references to amxmodx_version.inc 2014-07-27 11:59:49 +03:00
60b1ec222e Add extern amxmodx_language 2014-07-27 11:52:30 +03:00
c5ba642630 Change zeroes to manual in predefined version.inc 2014-07-27 11:43:50 +03:00
b4d006438c Update core to use amx_language cvar instead of vault 2014-07-27 11:42:34 +03:00
ef1e1edea5 Update copyright year 2014-07-27 11:22:40 +03:00
868be37007 Remove svn_version.inc from package script 2014-07-27 11:09:15 +03:00
57a1004c15 Replace svn_version with default amxmodx_version which should get replaced by AMBuild regardless 2014-07-27 11:07:13 +03:00
9d0ea883ff Ignore compiled plugins 2014-07-27 11:04:17 +03:00
1c32e7284b Fix package script copying wrong amxmodx_version file to include folder 2014-07-27 11:02:06 +03:00
1d17835e9a Update multilingual plugin
- User pcvars
- Remove vault usage
- Remove amx_setlang (not very useful, it's covered by the cvar now)
- Remove server language from the menu (covered by the cvar now)
- Add a cvar for previously hardcoded DISPLAY_MSG
2014-07-27 10:54:46 +03:00
c97312ba41 Merge pull request #79 from Arkshine/remove-debug
Remove old debug lines.
2014-07-26 23:19:06 +02:00
e440663ea3 Remove old debug lines. 2014-07-26 23:19:28 +02:00
a77b946ce2 Merge pull request #78 from 9iky6/patch-9
Update statsx.sma
2014-07-26 18:39:23 +02:00
aa37e7f4e8 Update statsx.sma 2014-07-26 21:30:45 +06:00
795131cd9f Update statsx.sma 2014-07-26 21:18:40 +06:00
d4cdec6f11 Update statsx.sma 2014-07-26 21:13:49 +06:00
6fbf08869c Update statsx.sma 2014-07-26 21:03:05 +06:00
279a053dbe Update statsx.sma 2014-07-26 21:01:07 +06:00
cfaf862249 Update statsx.sma 2014-07-26 20:58:30 +06:00
dae467032b Update statsx.sma 2014-07-26 20:57:23 +06:00
6ae11ed755 Update statsx.sma 2014-07-26 20:56:42 +06:00
fec17e2bf5 Update statsx.sma
Fix MAX_PLAYERS -> MaxClients
2014-07-26 20:33:07 +06:00
42fa547cb4 Improve CellArray. 2014-07-25 21:28:23 +02:00
0b7bc23a30 Merge pull request #73 from Arkshine/maxclients
Add some generic constants - part 2
2014-07-25 09:56:08 +02:00
cf93ad50fa Update menufront.txt 2014-07-21 22:28:46 +08:00
46c9535087 Update mapsmenu.txt 2014-07-21 22:24:49 +08:00
57d621ac14 Update mapsmenu.txt 2014-07-21 22:24:19 +08:00
59219d3825 Update mapchooser.txt 2014-07-21 21:41:18 +08:00
8a6f6d7e36 Update languages.txt 2014-07-21 21:37:46 +08:00
477b61c5aa Update imessage.txt 2014-07-21 21:34:02 +08:00
2930654c7d Update common.txt 2014-07-21 21:32:10 +08:00
1f98a77ba0 Update cmdmenu.txt 2014-07-21 21:26:40 +08:00
9f513a755b Update antiflood.txt 2014-07-21 21:25:13 +08:00
8c46046fdb Update adminvote.txt 2014-07-21 21:23:09 +08:00
178516ac17 Update adminslots.txt 2014-07-21 20:59:41 +08:00
6b6a7bdc2b Update adminhelp.txt 2014-07-21 20:56:19 +08:00
4346a59035 Update admincmd.txt 2014-07-21 20:50:50 +08:00
da90ed748b Update adminchat.txt 2014-07-21 02:25:38 +08:00
2fccafb3ca update admin.txt
add a chinese language
2014-07-21 01:00:25 +08:00
a2b564eaaa Fix another potantial bug. 2014-07-20 17:48:05 +02:00
0347571ee9 Fix some typos and possible bugs. 2014-07-20 17:31:43 +02:00
da63bcb24b Fix redefinition of constant. 2014-07-20 17:14:05 +02:00
1fe80667a2 Fix definitively unused variable warning. 2014-07-20 15:25:37 +02:00
ee2ae84d7a Remove MAX_PLAYERS define assocaited to get_players. 2014-07-20 15:15:45 +02:00
7b96b4df22 Remove unecessary variable. 2014-07-20 12:56:59 +02:00
07534edfcd Use the new constants in various place. 2014-07-20 12:27:02 +02:00
e84653571c Fix stupid compiler warning on unused wariable. 2014-07-20 10:27:58 +02:00
19c8b007b2 Merge pull request #72 from Arkshine/add-constants
Add some generic constants
2014-07-19 21:02:59 +02:00
ee99ee93e4 Add 👍 to MAX_PLAYERS for the sake of convenience. 2014-07-19 19:58:22 +02:00
8cef1af95d Move check out the loop. 2014-07-19 19:54:57 +02:00
2c4e99fe8d Add some generic constants to amxconst.inc file. 2014-07-19 19:46:40 +02:00
1a633ec925 🔥 Remove old file check 2014-07-19 18:19:01 +03:00
d7a74ebb94 🔥 Remove amxmod compat hack from the compiler 2014-07-19 18:12:15 +03:00
3a5cb29e67 Merge pull request #69 from Arkshine/update-regex
Update regex module
2014-07-18 18:14:56 +02:00
5aba776da5 Regex: Recompile libpcre.a with -mmacosx-version-min=10.5. 2014-07-18 18:02:13 +02:00
1c9febfd22 Regex: Fix documention. 2014-07-18 18:02:12 +02:00
b4359d0f53 Merge pull request #71 from Arkshine/fix-set_ent_rendering
Fix typo in set_ent_rendering native.
2014-07-18 17:04:54 +02:00
a078064497 Merge pull request #70 from Arkshine/bug-6171
Add entity_intersects native (bug 6171)
2014-07-18 17:04:35 +02:00
14f2a95205 Fix typo in set_ent_rendering native. 2014-07-18 16:49:39 +02:00
dbe95c849b Engine: Add entity_intersects native. 2014-07-18 16:37:32 +02:00
752f95e913 Regex: Fix plugin title. 2014-07-18 13:50:41 +02:00
ce92ef745c Regex: Fix compilation under OSX
Lib has been recompiled to target i386.
2014-07-18 13:45:29 +02:00
0ec65bef5b Regex: Fix compilation. 2014-07-18 12:42:13 +02:00
7d69a78d06 Merge pull request #68 from Arkshine/feature-improve-client-buy
Improve client buy forward
2014-07-18 10:00:10 +02:00
5eaeaa8dc1 Cstrike: Fix compilation. 2014-07-17 20:28:40 +02:00
b2bb919c83 Merge pull request #67 from Arkshine/Fix-lang
Fix some translations.
2014-07-17 16:53:24 +02:00
1262c197c4 Fix some translations. 2014-07-17 16:53:20 +02:00
face80aa3f Merge pull request #66 from patrig/patch-26
Update statscfg.txt
2014-07-17 15:35:41 +02:00
4cbb9b0e64 Merge pull request #64 from 9iky6/patch-8
Update statsx.txt
2014-07-17 15:35:16 +02:00
7a46222758 Merge pull request #58 from patrig/patch-23
Update restmenu.txt
2014-07-17 15:31:22 +02:00
8111eee1b2 Update statscfg.txt
Add Russian language ...
2014-07-17 19:27:47 +06:00
9413eba2f6 Merge pull request #61 from 9iky6/patch-5
Update adminchat.txt
2014-07-17 15:25:28 +02:00
17553c844a Merge pull request #63 from 9iky6/patch-7
Update pausecfg.txt
2014-07-17 15:24:33 +02:00
092535d653 Merge pull request #62 from 9iky6/patch-6
Update cmdmenu.txt
2014-07-17 15:23:56 +02:00
82d7d23b86 Merge pull request #60 from 9iky6/patch-4
Update admin.txt
2014-07-17 15:23:38 +02:00
62e4eb29eb Regex: Update documentation. 2014-07-17 14:58:57 +02:00
a98df451cf Update restmenu.txt
fix [ru].
2014-07-17 18:33:27 +06:00
9c84c17d5e Regex: Update regex_subtr (Increase buffer and make it UTF-8 safe) 2014-07-17 14:02:21 +02:00
939a724b1a Regex: Add regex_replace native. 2014-07-17 11:21:06 +02:00
ffb179c991 Update statsx.txt 2014-07-16 01:54:50 +06:00
d53ce41a20 Update pausecfg.txt 2014-07-16 01:52:17 +06:00
c0201a52a5 Update cmdmenu.txt 2014-07-16 01:46:31 +06:00
baef33c12d Update adminchat.txt 2014-07-16 01:37:17 +06:00
7d49398186 Update admin.txt 2014-07-16 01:35:28 +06:00
1dba9eaeb9 Merge pull request #59 from patrig/patch-24
Update pausecfg.txt
2014-07-15 18:56:43 +02:00
718e5efaf3 Merge pull request #57 from patrig/patch-22
Update admincmd.txt
2014-07-15 18:55:08 +02:00
84404ec311 Merge pull request #56 from patrig/patch-21
Update telemenu.txt
2014-07-15 18:54:40 +02:00
6d6d492c51 Merge pull request #55 from patrig/patch-20
Update time.txt
2014-07-15 18:54:33 +02:00
d0501a8314 Merge pull request #54 from patrig/patch-19
Update timeleft.txt
2014-07-15 18:54:21 +02:00
ff39293537 Merge pull request #53 from patrig/patch-18
Update scrollmsg.txt
2014-07-15 18:54:12 +02:00
e03b2f7183 Merge pull request #52 from patrig/patch-17
Update plmenu.txt
2014-07-15 18:54:01 +02:00
b1ac1453e1 Merge pull request #51 from patrig/patch-16
Update nextmap.txt
2014-07-15 18:53:52 +02:00
e71b20359c Merge pull request #50 from patrig/patch-15
Update multilingual.txt
2014-07-15 18:53:44 +02:00
42fb23d6c3 Merge pull request #49 from patrig/patch-14
Update miscstats.txt
2014-07-15 18:53:33 +02:00
9682abb095 Merge pull request #48 from patrig/patch-13
Update menufront.txt
2014-07-15 18:52:58 +02:00
d32457f9cf Merge pull request #47 from patrig/patch-12
Update mapsmenu.txt
2014-07-15 18:52:46 +02:00
69651e6ebf Merge pull request #46 from patrig/patch-11
Update mapchooser.txt
2014-07-15 18:52:29 +02:00
132a7fd0fc Merge pull request #36 from patrig/patch-1
Update admin.txt
2014-07-15 18:52:14 +02:00
14600c0980 Merge pull request #45 from patrig/patch-10
Update languages.txt
2014-07-15 18:51:59 +02:00
965f479bad Merge pull request #44 from patrig/patch-9
Update imessage.txt
2014-07-15 18:51:46 +02:00
ab12ed6275 Merge pull request #43 from patrig/patch-8
Update common.txt
2014-07-15 18:51:28 +02:00
8e0609e3ad Merge pull request #41 from patrig/patch-6
Update antiflood.txt
2014-07-15 18:51:07 +02:00
2d0479bb07 Merge pull request #42 from patrig/patch-7
Update cmdmenu.txt
2014-07-15 18:50:47 +02:00
320eede0a4 Merge pull request #40 from patrig/patch-5
Update adminvote.txt
2014-07-15 18:50:29 +02:00
f496dc5bff Merge pull request #39 from patrig/patch-4
Update adminslot.txt … …
2014-07-15 18:50:10 +02:00
f0ce4e9a67 Merge pull request #38 from patrig/patch-3
Update adminhelp.txt …
2014-07-15 18:49:55 +02:00
d31cc7adbb Update pausecfg.txt
Update restmenu.txt …

Just do later completed yet. need to run
2014-07-15 16:55:19 +06:00
091a685d75 Update restmenu.txt
Add Russian language ...
2014-07-15 16:26:39 +06:00
357258c46e Update admincmd.txt
Add Russian language ...
2014-07-15 16:14:25 +06:00
c3eef5df05 Update telemenu.txt
Add Russian language ...
2014-07-15 16:00:24 +06:00
e46b5fc132 Update time.txt
Add Russian language ... Thanks NiHiLaNTh
2014-07-15 15:57:04 +06:00
982c3ae3bd Update timeleft.txt
Add Russian language ...
2014-07-15 15:53:20 +06:00
b06baffb06 Update scrollmsg.txt
Add Russian language ...
2014-07-15 15:50:50 +06:00
9be1e63080 Update plmenu.txt
Add Russian language ...
2014-07-15 15:48:34 +06:00
e190309f4e Update nextmap.txt
Add Russian language ...
2014-07-15 15:34:39 +06:00
bf210cd080 Update multilingual.txt
Add Russian language ...
2014-07-15 15:33:37 +06:00
08968e2130 Update miscstats.txt
Add Russian language ...
2014-07-15 15:31:32 +06:00
7e29c62e18 Update menufront.txt
Add Russian language ...
2014-07-15 15:15:41 +06:00
3ffd04b12d Update mapsmenu.txt
Add Russian language ...
2014-07-15 15:11:50 +06:00
76d30f2e5b Update mapchooser.txt
Add Russian language ...
2014-07-15 15:06:09 +06:00
d196fcf32c Update languages.txt
Add Russian language ...
2014-07-15 15:01:00 +06:00
41175ce3e9 Update imessage.txt
Add Russian language ...
2014-07-15 14:56:59 +06:00
d6acb22582 Update common.txt
Add Russian language ...
2014-07-15 14:55:04 +06:00
4a7c0bb9ea Update cmdmenu.txt
Add Russian language ...
2014-07-15 14:44:20 +06:00
bb222d1f33 Update antiflood.txt
Add Russian language ...
2014-07-15 14:42:14 +06:00
ba5a0fccbf Update adminvote.txt
Add Russian language ...
2014-07-15 14:40:15 +06:00
9197fd38b1 Update adminslot.txt … …
Add Russian language ...
2014-07-15 14:16:43 +06:00
34a8576eca Update adminhelp.txt …
Add Russian language ...
2014-07-15 14:14:07 +06:00
699f324716 Update admin.txt
Add Russian language ...
2014-07-15 13:20:46 +06:00
e53c30bacf hlsdk_const.inc : Add iuser1 constants 2014-07-08 12:58:12 +02:00
287f471ac4 Regex: Remove regex_match_ex and RegexError tag, change regex_match_all to use flags and update documentation.
- regex_match_ex was kind of duplicated.
- regex_match_all uses now integer flags (header like regex_compiler_ex)
- Removed RegexError tag to allow old natives to use these constants without mismatch tag error.
- Made all error params optional
2014-07-08 00:08:35 +02:00
a44d20b26b Regex: Add regex_match_all_c and regex_match_all natives (by Nextra) 2014-07-07 20:49:38 +02:00
ee4f6b8a89 Regex: Use AMTL. 2014-07-06 12:23:22 +02:00
08475bb0cc Regex: Update documentation + add regex_match_simple stock. 2014-07-06 12:23:22 +02:00
0714354f52 Regex: Update compiled libraries and pcre.h to v8.35. 2014-07-06 12:23:22 +02:00
d4de0e6f1e Regex: Update PCRE to v8.35.
I was über lazy at first, so took libs from SM.
But actually it's quite easy to compile, so let's update to latest version \o/.
2014-07-06 12:23:21 +02:00
d1153b8049 Regex: Update pcre.h. 2014-07-05 13:51:08 +02:00
f9503cb98a Regex: Add regex_compile_ex and regex_match_ex natives.
Purpose is to use the PCRE flags and error num directly.
Harcoding flags letters is really not readable and friendly.
Also this makes error params optionnal.
2014-07-05 12:21:36 +02:00
201a3003d9 Regex: Update compiled libraries. 2014-07-05 00:32:40 +02:00
7a6e793813 Regex: Add PCRE 8.32 in tools directory. 2014-07-05 00:28:24 +02:00
c2c78f6724 Cstrike: Random cleanup. 2014-07-05 00:04:20 +02:00
7cb004c728 Cstrike: Fix forwards [un]loading at map change. 2014-07-04 23:52:47 +02:00
58774361bb Cstrike: Make sure to execute forwards on alive players. 2014-07-04 16:57:40 +02:00
6c4cb27d3e Cstrike: Implement CS_OnBuyAttempt forward. 2014-07-04 10:41:13 +02:00
0728fee706 Cstrike: Make CS_OnBuy forward more reliable - part 4
Added support for shield , which is a special case.
Moved hashmap creation to OnPluginsLoaded.
2014-07-04 00:17:55 +02:00
17f2006f38 Merge pull request #17 from Freeman-AM/master
Telemenu: Some bug fixes and small improvements
2014-07-03 23:11:21 +02:00
18b91278db Telemenu: Remove ducking feature for Natural Selection because of incompatibilities
The main reason to remove this feature and let it behave like normal in Natural Selection is the fact that, in this game, there is different classes. Humans can crouch when some (small) aliens can't and normally never get the FL_DUCKING flag.
There is a small chance to create a teleportion point ducking as human and teleport an alien who will get an unsual flag for an alien.

So to don't mess with the game, this feature is disabled.
2014-07-03 22:19:20 +02:00
884c5e9643 Cstrike: Make CS_OnBuy forward more reliable - part 3
Remove unused hooks.
2014-07-03 21:14:11 +02:00
0cf39307e0 Cstrike: Make CS_OnBuy forward more reliable - part 2
Purpose is to have the forward be called only on actual buying.
This has been requested on the forum.
2014-07-03 21:10:53 +02:00
6e50a0effd Cstrike: Make CS_OnBuy forward more reliable - part 1
Purpose is to have the forward be called only on actual buying.
This has been requested on the forum.
2014-07-03 13:40:05 +02:00
fe8e32155d Merge pull request #34 from Arkshine/move-sm_libs
Move sm_memtable.h and sm_stringhashmap.h to public directory.
2014-07-03 12:08:16 +02:00
ce75bcbf61 Move sm_memtable.h and sm_stringhashmap.h to public directory. 2014-07-03 11:51:30 +02:00
6d283a1599 Merge pull request #33 from Arkshine/sync-amtl
Sync AMTL.
2014-07-03 11:33:30 +02:00
de73007922 Sync AMTL. 2014-07-03 11:26:50 +02:00
006e6e967a Fix array size typo in timeleft.sma plugin
Reported by CryWolf through private message (thanks!).
As note, typo was inserted in last commit (3abd842).
2014-06-24 23:31:16 +02:00
63322c9f2f Merge pull request #32 from 9iky6/patch-3
Update plmenu.sma
2014-06-22 12:20:19 +02:00
c7bdddfda3 Update plmenu.sma 2014-06-22 15:59:21 +06:00
e166c37d22 Merge pull request #27 from xPaw/patch-lang
Fix some languages
2014-06-17 13:50:41 +02:00
8764321c8d Fix typos in cstrike.inc (related to #25) 2014-06-08 19:58:18 +02:00
fd144a6b5b Add missing [sr] translations, thanks Gasa 2014-06-07 22:54:43 +03:00
363f1be4a5 Add missing [ro] translations, thanks knif3vitalii 2014-06-06 18:25:21 +03:00
55cb6d4b94 Remove verbose untar from checkout-deps. 2014-06-05 13:40:04 -07:00
2e6dc308a8 🔥 Remove backwards compatible CreateMultiForwardEx 2014-06-05 23:33:45 +03:00
9b1f4e01c7 🔥 Remove backwards compatible RadiusDamage 2014-06-05 23:20:06 +03:00
2696f0af0e 🔥 Remove compatibility stuff from the core 2014-06-05 23:00:47 +03:00
9558861cb7 Merge pull request #30 from Arkshine/add-travis-ci
Add Travis CI
2014-06-05 19:45:40 +02:00
bfdf734ac1 Add Travis CI 2014-06-05 19:45:03 +02:00
d3e8b9066c Revert "Merge pull request #29 from xPaw/travis-ci"
This reverts commit 17b8858408, reversing
changes made to 0375d6469a.
2014-06-05 10:11:38 -07:00
4c473451c9 Merge pull request #28 from xPaw/remove-amxmod-compat
Remove amxmod compatability
2014-06-05 19:00:27 +02:00
e3e3d8a255 🔥 Remove NS2AMX utility backwards compatibility 2014-06-05 17:18:25 +03:00
0be46af0c6 🔥 Remove references to compat includes 2014-06-05 17:04:37 +03:00
66281d81b3 Add missing [cz] translations, thanks Backstabnoob 2014-06-05 15:43:18 +03:00
0de8abc342 Add missing [de] translation in multilingual, thanks Mordekay 2014-06-05 15:40:42 +03:00
17b8858408 Merge pull request #29 from xPaw/travis-ci
Add Travis CI
2014-06-05 12:43:26 +01:00
563e4fcdf4 Update versioning script to match SourceMod changes 2014-06-05 14:37:37 +03:00
bbd6cc7dcb Add Travis-CI 2014-06-05 14:36:27 +03:00
ae9315ad48 🔥 Remove amxmod compatability
This doesn't remove anything from the engine
2014-06-05 13:48:56 +03:00
a58c2b0f94 💄 Remove invalid token from statscfg 2014-06-05 13:22:42 +03:00
7167663160 💄 Fixed translation tokens in stats_dod
Blame whoever copypasted all strings from miscstats
2014-06-05 13:20:22 +03:00
95c2e82543 Fix some languages 2014-06-05 12:02:29 +03:00
0375d6469a Merge pull request #26 from xPaw/patch-1
Add more links to Readme
2014-06-03 11:31:25 +02:00
7b97896221 💇 2014-06-03 12:19:43 +03:00
6ea15d1765 Add more links to readme
Conveniently stolen from SM repository
2014-06-03 12:18:23 +03:00
08378eed4b Merge pull request #25 from Arkshine/feature-client_buy-forward
Implement CS_OnBuy forward + Do some clean up (bug 5906)
2014-06-03 10:20:13 +02:00
2595fbe764 Cstrike: Remove unused defines and fix typo. 2014-06-03 10:05:56 +02:00
d2f2748e9e Cstrike: Enable/Disable detours whether CS_OnBuy and CS_InternalCommand are used in plugins + Add more check for safety. 2014-06-01 22:24:52 +02:00
f1e206fde6 Cstrike: Refactor code to seperate detours for readability/maintainability + Fix OSX symbols. 2014-06-01 19:00:37 +02:00
0c1be7ca7b Merge pull request #24 from alliedmodders/hamsandwich-stkalign16
Align stack on 16 byte boundary in hamsandwich trampolines.
2014-05-31 17:19:47 -05:00
c96456503c Cstrike: Fix ResolveSymbol misuse under linux/osx. 2014-05-31 20:06:26 +02:00
423eb0499b Align stack on 16 byte boundary in hamsandwich trampolines. 2014-05-31 06:34:52 -05:00
3987085572 Combine prologue and epilogue code for void and non-void functions in hamsandwich trampolines. 2014-05-31 04:00:25 -05:00
fe52f1eeac Don't bother saving and restoring eax in hamsandwich trampolines. 2014-05-31 03:09:17 -05:00
f08a4f5a66 Cstrike: Fix typo under OSX. 2014-05-31 09:14:00 +02:00
a984c85ffc Cstrike: Define "UseBotArgs" and "BotArgs" symbols in game data file. 2014-05-30 22:53:27 +02:00
9d99863c7e Cstrike: Add CSW_SHIELDGUN constant (valid CS value) 2014-05-30 16:56:26 +02:00
f130a8ea89 Cstrike: Implement CS_OnBuy forward. 2014-05-30 16:54:36 +02:00
38e2e3e393 Cstrike: Move utility stuff in its own file. 2014-05-29 01:19:52 +02:00
e4ff6853dd Cstrike: Convert code to use CDetour and MemoryUtils. 2014-05-29 00:40:37 +02:00
d7b3b47aa4 Cstrike: Import some memory tools from SourceMod 2014-05-28 22:51:14 +02:00
1b514d6f23 Merge pull request #23 from Arkshine/fix-unicode-issuee
Fix an unicode issue with amx_SetStringOld.
2014-05-27 15:48:19 +02:00
f5a5d8f8e7 Undo last change and change cell cast to unsigned char. 2014-05-27 15:15:56 +02:00
83c2b3ef62 Merge pull request #22 from Arkshine/fix-unicode-issuee
Fix an unicode issue with amx_SetStringOld.
2014-05-27 14:38:27 +02:00
90c4fc1db1 Fix an unicode issue with amx_SetStringOld. 2014-05-27 13:49:59 +02:00
a828ee8fda Merge pull request #21 from Nextra/newmenus
Newmenus: Add menu timeouts (+ extra bugfix)
2014-05-27 12:31:30 +02:00
dc3e68c507 Newmenus: Fix typo in error message 2014-05-27 10:38:25 +02:00
a6ffae72f5 Newmenus: Add get_menu_by_id and use it everywhere 2014-05-27 10:33:53 +02:00
c91d67912b Newmenus: Update MENU_TIMEOUT doc 2014-05-27 10:32:28 +02:00
9b51137767 Update checkout-deps.sh. 2014-05-26 16:21:20 -07:00
62cf10f0c3 Cstrike: Move game datas in its own file. 2014-05-26 21:19:18 +02:00
f08e22db95 Cstrike: Rename cstrike.cpp to CstrikeNatives.cpp 2014-05-26 18:50:39 +02:00
88c489d393 Cstrike: Move AMXX API in a new file. 2014-05-26 18:08:41 +02:00
94e0021e78 Telemenu: Fix a typo error 2014-05-25 11:50:11 +02:00
1b4d0c7965 Telemenu: Remove some TAB before comments for readability 2014-05-24 18:35:06 +02:00
2ca61e2de2 Telemenu: Fix bad array usage 2014-05-24 18:30:02 +02:00
aa67fae7b9 Telemenu: Fix some bugs and add some improvements
Bugfixes
- a typo error induced by me, id instead of player
- The second teleportation way of this plugin can only be done when the menuactor is not alive.
There is no crouch in death mod or spectator mod, so i remove this useless call. (Line 134 - 139)
Improvements :
- Check mod VEC_DUCK_VIEW only one time.
- Removal of code duplication
2014-05-24 15:53:30 +02:00
4d3e219d84 Merge pull request #20 from Nextra/mexit
Newmenus: Add MEXIT_FORCE and fix possible crash
2014-05-23 13:45:23 +02:00
50fbf29b3b Newmenus: Fix unsigned underflow on "end" variable 2014-05-22 00:07:37 +02:00
ff18b03250 Newmenus: Add MEXIT_FORCE for proper exit button on non-paginated menus 2014-05-21 22:18:48 +02:00
3b87c428dc Newmenus: Add necessary API changes for newmenu timeouts 2014-05-21 19:17:04 +02:00
c8b7a09028 Newmenus: get_user_menu should also handle newmenu timeouts properly 2014-05-21 19:01:27 +02:00
fa5336cade Newmenus: Use Menu::Close everywhere 2014-05-21 18:58:51 +02:00
34337fb959 Newmenus: Add Menu::Close to remove a bunch of redundant code 2014-05-21 18:51:55 +02:00
6a4c55de7d Newmenus: Fire MENU_TIMEOUT on menuselect client command 2014-05-21 18:47:20 +02:00
2e8ce87c23 Newmenus: Add MENU_TIMEOUT status code and pass it where necessary 2014-05-21 18:45:40 +02:00
cd7cb8c1a8 Newmenus: Execute menu callback when old-style menu overwrites new menu
show_menu simply resets CPlayer::newmenu. The menu callback is never fired and the plugin never informed that the menu has been closed. This can result in leaking menu handles. Using "menuselect 10" on the client is not an appropriate solution because it is possible to construct newmenus that contain 10 valid items.
2014-05-21 18:17:09 +02:00
44b4ff6f05 Telemenu: Fix view_ofs not correctly set at teleportation 2014-05-21 00:59:48 +02:00
d3bae33c64 Telemenu: Plugin style compliancy 2014-05-19 14:03:31 +02:00
914ae9e0d1 Telemenu: Improve ducking feature
Apply ducking state on teleported player only when the teleportation point is saved by a ducking player.
This feature fix possibles errors that could happen with games that don't use crouch, like ESF, NNK...
And for game like Counter-Strike 1.6, this is more logic.
2014-05-19 13:52:21 +02:00
7ae802d736 Fix compile.sh script for OS X. 2014-05-18 20:37:44 -05:00
d83ec1810a Merge pull request #18 from alliedmodders/static-libstdcxx
Link amxxpc with static libstdc++ on Linux.
2014-05-18 19:04:43 -05:00
b3d1b49fab Telemenu: Switch format to formatex 2014-05-18 16:20:40 +02:00
a6e3b57848 Telemenu: Add charsmax in place of hardcoded buffer lengths 2014-05-18 16:11:13 +02:00
7007105150 Telemenu: Add the ability to save the view and use it during teleportation 2014-05-18 15:58:53 +02:00
9c93cd1283 Telemenu: Add the ability to teleport in crouched areas 2014-05-18 15:32:45 +02:00
d2f909981a Telemenu: Use of float version of origin natives instead of integer version 2014-05-18 15:23:40 +02:00
aa00fc6f63 Trigger build. 2014-05-17 19:22:10 -05:00
db001a6eb5 Sync changes from SourceMod's bootstrap script. 2014-05-17 16:37:12 -05:00
f69a8e66c6 Don't copy debug files into package directory.
Debugging symbols should be present in the binaries by default now.
2014-05-17 14:57:57 -05:00
072747b741 Add --symbol-files option to AMBuild configure. 2014-05-17 14:54:38 -05:00
4fa8a90787 Add build directories to gitignore. 2014-05-17 14:37:15 -05:00
c0e3509e65 Merge pull request #15 from Arkshine/fix-cs-spectator-issue
CS: Fix spectator team index not being set in specific situation
2014-05-15 16:09:09 +02:00
0edb16150a CS: Manually set SPECTATOR team index. 2014-05-15 00:01:28 +02:00
7e6812f64a Merge pull request #10 from Arkshine/client_printex
Add client_printex Stock (bug 5828)
2014-05-13 14:33:23 +02:00
1c13d0dd6b Use a more standard if conditionnal way. 2014-05-13 14:09:45 +02:00
f58faf5f2c Merge pull request #13 from Arkshine/fix-cs_set_user_team
Fix cs_set_user_team issue on spectator
2014-05-13 13:27:03 +02:00
207b9aef96 Merge pull request #14 from Arkshine/fix-missing-float-tag
Fix missing Float tag in some DoD forwards headers (bug 6121)
2014-05-13 13:26:34 +02:00
c5c2721e60 Fix missing Float tag in some DoD forwards headers. 2014-05-12 16:40:19 +02:00
db76fc7b66 Fix cs_set_user_team issue on spectator 2014-05-12 14:41:08 +02:00
c1cf9d8e67 Update .gitignore 2014-05-12 14:14:26 +02:00
5f210d3404 Append a note about usage of the new buffer size (related to ce4ef6e272) 2014-05-08 16:18:50 +02:00
24328568ed Fix typo with TrieGetArray return value in #8. 2014-05-07 10:41:55 +02:00
f5921a3535 Refactor code
It would seem I was wrong (was I drunk?). It doesn't support custom
message using formating (%s).
This simplifies things, as this stock is now meant to be used only on
predefined message.

* If not a predefined message, we redirect to client_print, as there is
more checks and can deal with ML.
* If length goes above known limits, we redirect to client_print to be
cut properly.
* Changed MSG_ONE to MSG_UNRELIABLE and MSG_ALL to MSG_BROADCAST.
* Updated documention.
2014-05-05 20:42:51 +02:00
f691d2ed79 Fix english 2014-05-05 00:59:36 +02:00
60f54ee691 Merge pull request #9 from Nextra/statsx-lang
StatsX Language/Translation Update (bug 3040)
2014-05-04 20:15:22 +02:00
db3933d150 Merge pull request #8 from Arkshine/trie-update
Trie Update
2014-05-04 20:14:10 +02:00
d0b335dc6e Add missing 'stock' keyword. 2014-05-04 18:32:15 +02:00
25f507c5e3 StatsX: Add is_user_alive check to eventSpawn 2014-05-04 17:04:01 +02:00
2fb232ee68 StatsX: Use replace_string and set task timer to 0.1 (AMXX minimum) 2014-05-04 17:03:59 +02:00
90c4eed92e StatsX: More charsmax in place of hardcoded buffer lengths 2014-05-04 17:03:58 +02:00
bf4ba091e4 StatsX: cmdReport has to use LANG_SERVER 2014-05-04 17:03:57 +02:00
c19b9d9d5d StatsX: Switch spawn detection from ResetHUD to Ham_Spawn 2014-05-04 17:03:56 +02:00
5143cada8e StatsX: Don't format roundend hudstats if we don't show them 2014-05-04 17:03:55 +02:00
f630a8afc8 StatsX: Format team score (g_sScore) on demand 2014-05-04 17:03:54 +02:00
ccd0adb84d StatsX: Actually use cached player id in end_game_stats 2014-05-04 17:03:53 +02:00
4afefa25d1 StatsX: Format roundend stats for each player individually 2014-05-04 17:03:52 +02:00
4de2bf21a3 StatsX: Remove implicit usages of global buffers for formatting 2014-05-04 17:03:51 +02:00
136309ae6f StatsX: Move hudstats formatting to own function 2014-05-04 17:03:50 +02:00
12d2e49adf StatsX: Rip out LANG_SERVER where possible (still pass 0 as id) 2014-05-04 17:03:48 +02:00
85bb592eeb StatsX: Switch cvar access to pcvars 2014-05-04 17:03:47 +02:00
164285b221 StatsX: Switch from using defines to charsmax 2014-05-04 17:03:46 +02:00
297ced77b9 StatsX: Switch format to formatex 2014-05-04 17:03:45 +02:00
3e1de6b014 Add .gitignore. 2014-05-03 17:51:07 -07:00
2a2e2e2868 Replace .hgignore with .gitignore. 2014-05-03 17:50:29 -07:00
0c1931284e Clean up include file. 2014-05-03 23:50:43 +02:00
9ac3763267 Add iterators natives 2014-05-03 23:21:56 +02:00
b6cd247d12 Add new 'replace' and 'size' paramaters in some natives.
Fix some typos
Update the test plugin
2014-05-03 22:36:40 +02:00
f3bce9ecfd Add TrieGetSize native. 2014-05-03 16:09:31 +02:00
55456eaf17 Fix format_time (returned length doesn't include null terminator, related to a86ca1491) 2014-05-03 15:41:05 +02:00
12a8864532 Remove refcounting 2014-05-03 14:28:12 +02:00
d933783629 Switch trie_natives off KTrie 2014-05-03 13:22:48 +02:00
f3aee6d766 Add AMTL files 2014-05-03 13:00:21 +02:00
3b0ce189ea Add print_radio constant (counter-strike only) 2014-05-02 19:13:38 +02:00
9a2bce66fd Add client_printex stock 2014-05-02 19:13:15 +02:00
9c191949d8 Add amxclient_cmd native (bug 5887, r=Nextra) 2014-05-02 09:16:16 +02:00
d3f22d2089 Add support for bot without "player" classname in Hamsandwich (bug 6111, r=ds) 2014-05-01 10:21:46 +02:00
6eb10a5f5a Missing modification on a86ca1491 2014-04-30 16:11:27 +02:00
Lev
75822ec227 Reset the status variable on success (bug 5994, r=arkshine) 2014-04-30 15:42:03 +02:00
ce4ef6e272 Increase get_amxstring buffer size (bug 5901, r=ds) 2014-04-30 15:22:55 +02:00
a86ca1491f Add new string natives/stocks, make some UTF-8 safe (bug 6110, r=ds) 2014-04-30 09:33:03 +02:00
0519111528 Remove debug spew. 2014-04-20 14:56:45 -05:00
2d4e3a6d25 Link amxxpc with static libstdc++ on Linux. 2014-04-20 14:52:50 -05:00
c99a518ba4 Oh come one. 2014-04-18 22:31:14 +02:00
512e3ff61c Fix some typo and fix mac. 2014-04-18 22:22:09 +02:00
3d732bbbb6 Added SQL_SetCharset native to (re)set character set (bug 5999, r=ds). 2014-04-18 22:04:32 +02:00
Lev
19e160117f Directly kick players rather than use a loopback command (bug 5946, r=arkshine) 2014-04-16 17:27:20 +02:00
f78fda6d9c Add new CellArray natives: Clone/Resize/FindString/FindValue (bug 6104, r=ds) 2014-04-15 10:34:48 +02:00
d6d4badbda Fix crash in Hamsandwich with hooked function without return (hopefully last time) 2014-04-14 13:37:09 +02:00
0f890ce7f1 Fix crash in Hamsandwich with hooked function without return. 2014-04-14 11:39:08 +02:00
e81e7bee13 Fix missing DataPacks plugin test and include file in PackageScript (thanks GuskiS) 2014-04-12 20:33:55 +02:00
b3609a23fa Add missing magic tag in include file (previous patch). For some reason my change was ignored. 2014-04-11 23:02:46 +02:00
8a1464ac41 Introduce DataPacks (bug 5885, r=ds) 2014-04-11 22:57:42 +02:00
5468e9745c Add set/show_dhudmessage (bug 5979, r=ds) 2014-04-11 21:54:24 +02:00
4cd9d1df46 Fix issue by not including port when an admin is added by IP address (bug 5978, r=arkshine) 2014-04-11 21:47:43 +02:00
f097e01c3f Fix typo in previous commit. 2014-04-10 12:55:58 +02:00
ec101fc52b Trigger a build 2014-04-09 18:33:49 +02:00
1a7daad657 Update globally Hamsandwich module (bug 5611, r=sawce) 2014-04-09 16:44:02 +02:00
9815050287 Increase var/func and input line maximum length (bug 5924, r=dvander) 2014-03-24 01:04:17 +01:00
1503a6571f Fix TFC_PC_CIVILIAN value (bug 6042, r=arkshine) 2014-03-22 16:59:15 +01:00
3501e8fa46 Fix conflict with unicode string and bcompat translation layer (bug 5944, r=dvander) 2014-03-22 15:23:55 +01:00
46fb7b310e Add amx_xvar command (bug 5896, r=arkshine) 2014-03-20 23:41:10 +01:00
64327b8ddb Fix nextmap plugin failing in game where mp_chattime cvar doesn't exist (bug 5922, r=arkshine) 2014-03-20 19:05:41 +01:00
33cdfa644e Add check for empty string in amx_chat command (bug 6017, r=arkshine) 2014-03-20 18:49:59 +01:00
5dc96ddf47 Add strtof native (bug 5909, r=Nextra) 2014-03-20 18:21:38 +01:00
f520a39c89 Add DMG_GRENADE constant (bug 6030, r=arkshine) 2014-03-20 18:14:31 +01:00
bc97cc0bfb Add missing Pawn includes in VC project file 2014-03-20 18:11:49 +01:00
79af43b861 Testing commit 2014-03-17 08:50:44 +01:00
f1883fd773 Trigger a build. 2014-03-11 22:29:30 -07:00
d77e4a1470 Fix package.pl. 2014-03-11 19:54:37 -07:00
4c2f4095d2 Update README.md 2014-02-23 13:17:57 -08:00
4a79099115 Merge pull request #6 from alliedmodders/fix-winres-rc
Change winres.h to winresrc.h.
2014-02-15 21:26:42 -08:00
11d0b204f5 Change winres.h to winresrc.h. 2014-02-15 21:13:12 -08:00
db466c56fa Update README.md 2014-02-14 09:20:46 -08:00
8a55f1db35 Update README.md 2014-02-13 23:07:04 -08:00
31654d2908 Create README.md 2014-02-13 23:06:43 -08:00
d61abc5a18 Fix Windows build. 2014-02-13 00:13:43 -08:00
4df96b097d Add env var support to AMBuildScript. 2014-02-13 00:04:52 -08:00
ea051bddfb Import the package needed for rmtree(). 2014-02-12 23:30:03 -08:00
3b2a005a92 Merge pull request #5 from alliedmodders/depscript
Add a checkout-deps.sh script.
2014-02-12 20:58:54 -08:00
fb186b6fab Add a checkout-deps.sh script. 2014-02-12 20:46:19 -08:00
f453bca1c3 Merge pull request #4 from alliedmodders/macmin_cflags
Add -mmacosx-version-min=10.5 to compiler flags on OS X (no bug, r=dvander).
2014-02-12 19:58:19 -06:00
be4d91c105 Add -mmacosx-version-min=10.5 to compiler flags on OS X. 2014-02-12 19:40:05 -06:00
60bea040d0 Merge pull request #3 from alliedmodders/egg
Fix whitespaces.
2014-02-10 23:40:09 -08:00
0f303eb999 Fix whitespaces. 2014-02-10 23:38:55 -08:00
94c864390d Quell GCC madness. 2014-02-10 00:20:00 -08:00
3772645fca Merge pull request #2 from alliedmodders/strbreak
Add new variants of strbreak, which is too broken to use (bug 6041, r=ds).
2014-02-10 00:06:06 -08:00
e2855dee7d Undo vim modelines. 2014-02-09 23:49:19 -08:00
aa46469878 Add new variants of strbreak, which is too broken to use. 2014-02-09 23:40:45 -08:00
4125796569 Remove the debug clamp. 2014-02-09 10:37:02 -08:00
44ebe2f09a Remove deps.zip since GitHub doesn't like large files.
Former-commit-id: 2536a500acb86417c73ec65249c881d8e3e695ff
2014-02-08 23:48:30 -08:00
d46d657190 Merge pull request #1 from alliedmodders/ambuild
Port AMX Mod X to AMBuild 2.

Former-commit-id: caa26e5133dc97557b7d7e111de73c1dcac7fe94
2014-02-08 22:16:32 -08:00
e56cd58d70 Update the rest of the buildbot scripts for AMBuild.
Former-commit-id: ef3e192105c8c7f3905a2ceb82df4751d51cc013
2014-02-08 21:45:40 -08:00
426771deda Switch bootstrap.pl and startbuild.pl to AMBuild.
Former-commit-id: 462765c926139c44a1c2922e0281b4653fad783a
2014-02-08 21:23:02 -08:00
f0f319a418 Add WinCSX to AMBuild scripts.
Former-commit-id: eca50829ae45c9d7bad2f0c79a95ba7a1e35c63e
2014-02-08 21:16:41 -08:00
779e064a17 Add .rc files.
Former-commit-id: 3d9c34eff669112a54d181ca3f970e2c77d31409
2014-02-08 20:53:01 -08:00
1f15fdd6cb Update versioning for AMBuild and git.
Former-commit-id: ea473061ef1f3b52716decfb4dafcfd66167730d
2014-02-08 20:37:33 -08:00
a07cf853d7 Fix a cxxflag being in cflags.
Former-commit-id: 4358bad902adba3595c856aa37b3faa6c4e1dba2
2014-02-08 16:27:02 -08:00
59c3e271db Remove all files related to SVN versioning.
Former-commit-id: 57a320bfe97fcf87cf2adc6a5ee3ae07814f798d
2014-02-08 16:26:40 -08:00
922b4802f1 Port AMBuild scripts to Windows.
Former-commit-id: 9af9b5f205cfd588a16e1164bd033c22ce2107fc
2014-02-08 16:09:29 -08:00
bd586d37e6 Add OS X support to AMBuild and 10.9 support to amxxpc.
Former-commit-id: 91779cb9414e0ade9c170752cfc313c0425c8d14
2014-02-08 15:25:57 -08:00
90b2860fd2 Get parity with makefile flags.
Former-commit-id: d1ee3b078001fc2bd5f0454cf457897cd0a0a817
2014-02-08 14:49:03 -08:00
0748a05bf0 Remove the C# builder - the last vestige of the Old Republic.
Former-commit-id: ff7277048f52b8ee658583ed7c7801204bed9493
2014-02-08 14:35:11 -08:00
8f51d87826 Get PackageScript release-equivalent on Linux.
Former-commit-id: 15cfb571fbfb37281e1465a013305ff6267b7dce
2014-02-08 14:29:15 -08:00
e57845dd50 Add the PackageScript.
Former-commit-id: 8fe47f62d5ac5426fd1b718f4339c9add70e9fa5
2014-02-08 13:46:34 -08:00
fdc804b7df Remove precompiled binaries from the plugins folder.
Former-commit-id: 4821df4aaf289b1f7d9fed0b2dfee40179d9e542
2014-02-08 12:44:35 -08:00
ad36859607 Port plugin building to AMBuild.
Former-commit-id: 9ac73de5b247da341b0b4cdf00ec3c7e0472be82
2014-02-08 12:42:00 -08:00
c4e90ce865 Initial import of AMBuild infrastructure for C++ projects.
Former-commit-id: 53baa4f8c25525674f5e71f8f6ff2663928500ab
2014-02-08 01:14:15 -08:00
bc57a4e74f Triggering a build.
Former-commit-id: 45b67bd4fcacf483065d7447a2c12e6c45806b24
2014-01-22 20:03:52 -06:00
878d68bb21 Backed out changeset: 2bc36c43b15f
Former-commit-id: 0f14674ff19adc5bd1461bc622a01c3064281026
2013-09-10 09:04:52 +02:00
dc607846a3 Trigger build to hopefully fix Linux build.
Former-commit-id: ac1a72323631568561ae192190764b0015d42ba5
2013-09-05 21:05:35 -05:00
568bec17fc Fixed building with newly updated SDK.
Former-commit-id: bf0455aea7c54493b2b921a2fef52120163e0959
2013-09-05 19:51:52 -05:00
2a458530b7 Fixed cstrike module crash on OS X (r=dvander).
Valve now compiles OS X binaries with -fvisibility=hidden, so dlsym no longer works with non-exported symbols.


Former-commit-id: f77f6430a288cbe1200bae05c64494f6a0030bc6
2013-09-03 17:56:27 -05:00
87d2a54638 Rebuilt amxjitsn object with older version of nasm to fix JIT crash on OS X (r=dvander).
Former-commit-id: 011b69169c6abe324c0c27415de5e6f174909f64
2013-09-03 17:53:42 -05:00
9971541d78 Fix linux warning to make GCC compiler happy
Former-commit-id: f23bda76a3bb25333a619e82703605ac1cc92308
2013-08-24 23:42:18 +02:00
3b6c207ea8 Move slay as last option instead of first in Slay/Slap Menu (bug 5861, r=arkshine)
Former-commit-id: 31f5fdfa9788d5ea8552e2dc101c582e7959ecc0
2013-08-24 01:14:54 +02:00
af0a1200ab Add client_print_color native (CS only) (bug 5823, r=Nextra)
Former-commit-id: 9e37c60bc543676cbd659621a129bd953fc71473
2013-08-24 01:03:13 +02:00
ab6644c874 Add client command in Misc. Stats plugin to enable/disable sounds (bug 5846, r=arkshine)
Former-commit-id: b2de28b5f32d7d2c9dc52aacc4d95a7e4b029db1
2013-08-24 00:59:57 +02:00
7f0c820566 Fix missing new line on client console message which is not truncated server-side if its length exceeds buffer size (bug 3140, r=arkshine)
Former-commit-id: 6373b0238ddda08ce1d7f9c137650120522d08ef
2013-08-24 00:58:23 +02:00
de818ab5ec Update tfcx LINUXOFFSET value (bug 5845, r=arkshine)
Former-commit-id: 0f1908fa746e11d7915c43053e628d2a29cc7be4
2013-08-24 00:56:26 +02:00
73b365e952 Fix two player transfer issues in Players Menu plugin (bug 5850, r=arkshine)
Former-commit-id: 16f9e669369e6d2b5be6a39ba56b3c8f07b5a5f2
2013-08-24 00:55:21 +02:00
Lev
d9fb9bac09 Add assign operator for floats to allow implicit int-to-float conversion (bug 3997, r=dvander)
Former-commit-id: 04b6a21f239bb9332a1410d22c8c3c45510a28b2
2013-08-24 00:42:16 +02:00
6139d52a39 Fix dictionary text files parser failing on BOM marking (bug 5858, r=Nextra)
Former-commit-id: 096464e3d5852cde0d91fe407598c970c5495dce
2013-08-16 18:50:56 +02:00
784f91e441 Add a new access level flag 'v' for temporary bans (bug 3218, r=arkshine)
Former-commit-id: d09b92cf6c3ffa6ea82b4c4b005056e7875ee80f
2013-08-16 18:49:55 +02:00
da30315556 Fix Wno-delete-non-virtual-dtor flag to be passed only for .cpp files.
Former-commit-id: 4f8b31483ddf784589bc2bd53f736772147c631d
2013-08-10 19:29:28 +02:00
419c8f6ee6 Fix client_death/damage forwards passing alive victims on ClientKill (bug 5812, r=Nextra)
Former-commit-id: 39fadf43027ccfaff20a7c671aec4f22fdf432ca
2013-08-10 19:10:54 +02:00
ddacdb0ab2 Add set_ent_rendering native (bug 5773, r=Nextra)
Former-commit-id: d322cd2e79497eae463e941973db952079219c80
2013-08-10 14:16:26 +02:00
ec644cf1a4 Fix unused but set variable compilation error under linux.
Former-commit-id: 1aa4373e3dce07d1a8331a74a557f56eca574520
2013-08-10 13:01:23 +02:00
b5572520c2 Fix uninitialized variables.
Former-commit-id: 21f39612a8f877c204c93540f0d9037047cc4da9
2013-08-10 12:26:32 +02:00
54cac3b051 Check map objectives in d4d32d912299 using the new get_map_objectives native.
Former-commit-id: 25fe31aa3450099529a955532090347f85485336
2013-08-10 12:03:08 +02:00
9e4fe0d514 Add missing stats sounds, sounds precaching and fix few bugs in miscstats plugin (bug 5810, r=arkshine)
Former-commit-id: beca0030e4636dffce77d34e18c981adef34b065
2013-08-10 11:46:02 +02:00
917c52ec96 Add ewrite_[coord_f/angle_f], write_[coord_f/angle_f] and [e]message_begin_f natives (bug 5829, r=arkshine)
Former-commit-id: 34ab529d53729009fce913582838b609077b5f37
2013-08-10 10:22:38 +02:00
86f5c9f031 Make registered server commands case-insensitive (bug 5625, r=Nextra)
Former-commit-id: 44e5f42691a0deabd3ba612d9587a1dc139f6763
2013-08-09 01:27:02 +02:00
0afe87be0a Add get_map_objectives native for CS (bug 5820, r=Nextra)
Former-commit-id: 47487a4aa7b32a5767c2a23df5ddc7e9643c3428
2013-08-08 19:11:12 +02:00
225494b559 Fix tfcstats_pause imcomplete implementation (bug 5836, r=Nextra)
Former-commit-id: ea7b0f56fd2ea2f8d59d5b30172d8d9bfe4079f9
2013-08-07 16:46:40 +02:00
dca0bbcbb1 Fix tfcstats_rankbots not working as expected when disabled (bug 3192, r=Nextra)
Former-commit-id: 2ed695c8bbb1d69dc9241af18fb0477b1f19cce8
2013-08-07 16:44:25 +02:00
7e11cb5cc1 Add has_map_ent_class native (bug 5814, r=Nextra)
Former-commit-id: bfa749105feb49cf9f9b3878dededa33ae7d699c
2013-08-07 16:40:37 +02:00
5557124f05 Add an additionnal note to reflect change in 436d02c3ec30
Former-commit-id: 3ceb00dfdd2528eb9ab544b77d629938a916e386
2013-08-05 19:12:16 +02:00
a459f578fa Set set_user_rendering default color/amount to 0 to follow game behavior (bug 5772, r=arkshine)
Former-commit-id: b9d6327829da6da96ea32a1a8bb428cb816c23f4
2013-08-05 19:00:51 +02:00
98f8602c59 Set set_hudmessage default channel to -1 to reflect auto-channeling support (bug 5771, r=arkshine)
Former-commit-id: 418023ed916ff68e77a75ea729ac456d72b97cf5
2013-08-05 18:54:19 +02:00
f3f29e4769 Fix broken admin chat access consistency and apply general optimizations in adminchat plugin (bug 5822, r=arkshine)
Former-commit-id: 99caf22f48f0da39f5cbfe04b847dfa576366f5c
2013-08-05 18:44:23 +02:00
16b2721c2a Apply general optimizations in adminslots plugin (bug 5831, r=arkshine)
Former-commit-id: 1ea1766188a73cb80a50396fb2b88e11c88bc1e1
2013-08-05 18:26:57 +02:00
2385dd3972 Remove slowhack in amx_nick command and apply general optimizations in admincmd plugin (bug 5832, r=me)
Former-commit-id: 9d85ff7b1f4c5ee9c7b13a3bc362095c002add94
2013-08-05 18:18:58 +02:00
fd47b6e0c6 Apply general optimizations in adminhelp plugin (bug 5833, r=me)
Former-commit-id: 100fff803ff2796fe0772d83d0cfb15d9b02ee3a
2013-08-05 17:44:15 +02:00
1bf18472c1 Add cellarray.inc/celltrie.inc in project Pawn Includes filter
Former-commit-id: 0122820d6f401abc6acedaa4de80d518d6c68674
2013-08-05 17:11:51 +02:00
5a6d3fde61 Add ArraySortEx/SortADTArray natives and new sort method Sort_Random (bug 5494, r=Nextra)
Former-commit-id: 1ff337d9801e2fbd9ad210bc1285d31679b3029e
2013-08-05 16:56:59 +02:00
71ac17464a Add UTF-8 support in /top15 MOTD (bug 5825, r=me)
Former-commit-id: ae91c6f5ade72b2c851eb1289423444e4a7d42e4
2013-08-03 20:35:05 +02:00
735160157c Move datastructs.cpp in Source Files filter
Former-commit-id: 84f7f744b3a4a996f766f7ecf7e14dee4624b8e0
2013-08-01 13:44:59 +02:00
4b717322d3 Fix possible out of bound error and apply general optimizations in timeleft plugin (bug 5818, r=arkshine)
Former-commit-id: 3abd8429022833f93f18d1f08abaff8204f53306
2013-08-01 00:55:44 +02:00
eb43b69e4d Add strtok2 which fixes a trim issue with strtok (bug 3993, r=arkshine)
Former-commit-id: ad9e3ad972b6f7a2e34c61d615e25de07c9acdfa
2013-07-31 23:40:49 +02:00
da6d417d5d Fix last mapcycle issue and apply general optimizations in nextmap plugin (bug 5817, r=arkshine)
Former-commit-id: 9b5c7afc0048f6fc8830bc5475cbe60d4230f7ef
2013-07-31 20:18:55 +02:00
3e1c70a887 Allow [g|s]et_pdata_cbase usage at map end whereas player's private datas are still valid (following fakemeta behavior) (bug 5787, r=me)
Former-commit-id: 30394243ff3f1cf08e1a8ebfcbf05dbea3a215b2
2013-07-31 17:54:46 +02:00
bde7b8dd7f Implement cooldown on say_team @ to prevent admin's client get overflowed if executed a couple of times (bug 5815, r=arkshine)
Former-commit-id: 7db35f0d9764430d34d53844e8f5eb0933527e16
2013-07-31 17:01:55 +02:00
096c5e7509 Comment declared modules in modules.ini as they are autoloaded as needed (bug 5816, r=arkshine)
Former-commit-id: 4b54b099454273815ff490830c72ae72940ec425
2013-07-31 16:23:25 +02:00
2854e70c94 Fix DOD grenade_throw incorrect calling behavior and wrong returned weapon IDs (bug 5785, r=arkshine)
Former-commit-id: 79252c33fb03c37a4e7ce3c7b49cd3e1618ae559
2013-07-27 23:08:33 +02:00
e4d74f199f Fix re-entrancy issue when a [generated] message is sent during register_event forward (bug 3664, r=joropito)
Former-commit-id: 163098892c0f0315ece9d89667782fd0ad53f3ca
2013-07-27 20:49:19 +02:00
2f964928ff Fix pfn_spawn metamod return to follow engine behavior (bug 5807, r=me)
Former-commit-id: efe3bda51be78618cfc758a5d75a9a4bcc49a353
2013-07-27 20:36:33 +02:00
0dd14eed43 Add ability to text formatting to set_fail_state (bug 5800, r=me)
Former-commit-id: 2af8a27164f9332e4a6178691fe11b41d2bef7d1
2013-07-27 20:33:17 +02:00
f9954e5831 Missing amxx.cfg update for CS/NS mod in 449793c3c1de
Former-commit-id: d96a6389b83a22cc2922ee3f3eb44a89e1a97a02
2013-07-20 11:39:51 +02:00
7498f84261 Fix uninitialized variable warning.
Former-commit-id: 65acac2b4fc16e1383d629b77200babe88b0556a
2013-07-04 20:36:31 +02:00
389eee472f Update Portuguese translations (bug 3236, r=me)
Former-commit-id: 1e36ba07dcb16118c461d12bbc7038e87ae229dc
2013-07-04 20:16:25 +02:00
93339d9be4 Add client_cmdStart forward (bug 5779, r=me)
Former-commit-id: 785ce1ea81567e30a729954a74ded7fdfef1ef7c
2013-07-03 01:00:52 +02:00
90e7aa65a1 Fix incorrect behavior of impulse forwards (bug 3243, r=Arkshine)
Former-commit-id: 1aae4c3ec57c61ba3f32579e236b07da54ae14bf
2013-07-03 00:19:12 +02:00
6c2655c841 Comply to AMXX style for more consistency in a4e667e91410
Former-commit-id: 6a989a1857bd8a768b1701f842840c4d16351eb1
2013-07-02 23:32:22 +02:00
1e7a4d2727 Comply to AMXX style for more consistency in 47c47df488e8
Former-commit-id: f9deb552af855345c8bd11d5eea17b0c5e9439f6
2013-07-02 23:31:27 +02:00
0ddc00727d Comply to AMXX style for more consistency in 7319646e4d61
Former-commit-id: 1722d0cb4f480be6dec4dc7355cdc580efa3ac6f
2013-07-02 23:15:55 +02:00
6912199ae0 Comply to AMXX style for more consistency in 8f3605ea03d5
Former-commit-id: 3075e0b375fcede21f2055442305d1ffdb9b64fd
2013-07-02 23:13:26 +02:00
83e70d7dd7 Add [Get|Set]ModelCollisionBox and [Get|Set]ModelBoundingBox (bug 3527, r=joropito)
Former-commit-id: 4d174007b14a9b6b8589f96a9259f3249db23799
2013-07-02 20:48:18 +02:00
c0fcf06c96 Add [get|set]_pdata_[bool|byte|short|vector|ehandle] and set_pdata_ent (bug 5770, r=joropito)
Former-commit-id: da3d13a9c027f764d0506273fca2ac71a75719c7
2013-07-02 16:05:39 +02:00
21a00e00a2 Add menu_addblank2 and menu_addtext2 to fix unexpected behavior with the original ones when slot=1 (bug 3096, r=Arkshine)
Former-commit-id: b4f84a5cee58d4a8fad716af82bca5b8aa0f5ff2
2013-07-02 14:54:07 +02:00
1026edec6c Add new register_event flags to filter humans and bots (bug 5768, r=me)
Former-commit-id: 15b0fba122d8c2ba7024b74aa07b78a877cc9d8c
2013-07-02 11:22:43 +02:00
15572e2d61 Fix server crash when nvault is writting to journal file without write permission (bug 3231, r=Arkshine)
Former-commit-id: 6ad9e6bc8cf748bb06d5618cb21741d6e79b0110
2013-07-02 10:20:21 +02:00
bf395c8ac1 Fix definitevely time drift on repeating tasks (bug 3302, r=dvander)
Former-commit-id: 28aa4dfbf7cb03a2d929423ef3c607f92a96aa75
2013-07-01 22:58:56 +02:00
e409a6cf23 Fix typo in 3bcba0ef360b
Former-commit-id: 4fcf93afb9a154cf92163cecdb3e8b7493d0aa71
2013-06-29 12:31:08 +02:00
14d986c87a Update amx_show_activity documentation in amxx.cfg (bug 5774, r=me)
Former-commit-id: 1983f452260e88fb8d5e6f201017651a4c968cf8
2013-06-28 23:46:10 +02:00
873fb6924f Add strtol native (bug 3233, r=joropito)
Former-commit-id: 9508f9f86db99e93de1819f585c741396d8e4c30
2013-06-27 18:55:19 +02:00
1000fdc902 Update Polish translations (bug 5570, r=me)
Former-commit-id: 1ded7ef6695be1f1e0f810d7ab35a46ed071e7cb
2013-06-27 18:16:20 +02:00
e3a380bbe4 Fix linux warnings (and build?)
Former-commit-id: 21906adfdf35e5deecb10eb286a5b09b706f20a4
2013-06-25 19:06:11 +02:00
89b28d5a4a Add missing Bosnian/Croatian translations in 0f878ec60a69
Former-commit-id: c343ecbe7888365fd4d6f69122c7e7336640cf8b
2013-06-25 12:08:47 +02:00
17a8e7f56e Fix user_slap/amx_slap unexpected behavior using large negative damage (bug 4975, r=joropito)
Former-commit-id: 1e4d0e216eef3d556c68eeca7362562c663e2dd1
2013-06-25 11:45:00 +02:00
38fb271c83 Fix an overflow issue with ArrayInsert[Before|After] (bug 4330, r=joropito)
Former-commit-id: ba56af8a7132de17e42412bd33c1958353711e60
2013-06-22 12:34:38 +02:00
e5864c5abf Add GetFileTime returning a file timestamp as a unix timestamp (bug 4543, r=joropito)
Former-commit-id: cf7b8645fa6a14e5be71336df4543901b2c53e0b
2013-06-21 23:09:41 +02:00
139d68700b Add Bosnian language (bug 4528, r=me)
Former-commit-id: df7c045089fdc6d73fe85728d1ea15c9e23488f9
2013-06-21 00:30:34 +02:00
57dd24a2e0 Fix incomplete implementation of csstats_pause cvar (bug 5755, r=joropito)
Former-commit-id: 4766f848641edeab86fca1d6637fc0ae09af3744
2013-06-20 17:53:59 +02:00
4cfa4fa1ca Add Croatian language (bug 4772, r=me)
Former-commit-id: 9624a8022d31d81041d9ceec920a9c34d39b7089
2013-06-20 01:58:44 +02:00
525c45e9f5 Add plugin version to debug trace information (bug 3649, r=joropito)
Former-commit-id: 9bfdce37387378597a5fe73a78dbb495d70add19
2013-06-17 17:49:20 +02:00
a1306b8d96 Fix duplicated native call (bug 5255, r=me)
Former-commit-id: ac896547f98657c240f1b44a446df26941e58f86
2013-06-17 13:39:12 +02:00
f2fd18d803 Fix incorrect spanish translation
Former-commit-id: 8a483130a52f7351808f3cfdcb4c2a0b59046004
2013-06-17 12:57:12 +02:00
6b6fe3c5d9 Add new command : amx_extendmap (bug 3068, r=sawce)
Former-commit-id: 064f10034400fe162072676f4fa362c68c8e8938
2013-06-17 12:18:11 +02:00
5cb07b900a Fix unexpected behaviors when a game menu is overlapped with custom one (bug 3199, r=me)
Former-commit-id: 96390761d3b26dd5e6329fa0e836de935b4263c4
2013-06-16 22:33:48 +02:00
d5ce84a9f5 Fix pev_blending not working with set_pev (bug 5758, r=me)
Former-commit-id: 4c3fc7eb970c57814daa6fcc1c26cabc8a02608f
2013-06-16 22:15:19 +02:00
f6ff4796b2 Fixed Linux and Mac builds.
Former-commit-id: 6f39588049f51abf92164ec7a79b0b9c0688f3c5
2013-06-16 12:55:22 -05:00
f606adfa69 Fix cs_user_spawn to properly respawn players (bug 3752, r=dvander)
Former-commit-id: 3bae515741f59ca9679cbacc1f81dce6734fa67b
2013-06-15 23:08:00 +02:00
4e81779adb Fix native_filter documentation (bug 5692, r=me)
Former-commit-id: b44616576fd47ac6742428759b73ef50d5d68f89
2013-06-15 22:37:52 +02:00
de8257d7aa Fix set_view altering pev properties instead of entity_state for rendering players (bug 5382, r=arkshine)
Former-commit-id: 89a65c6a7fc4e257580c0fcc1a759c0f5b488ae6
2013-06-15 22:02:24 +02:00
f608ae76ed Fix crash using [get|set]_usercmd (bug 5744, r=me)
Former-commit-id: 676952c02f7df7d3595a6f36bc3efbead3a40eee
2013-06-15 20:59:11 +02:00
950ef59319 Fixed crash regression in JIT compiler (r=dvander).
This regression was caused by the 16-byte stack alignment chageset: 5cb8a336b05c


Former-commit-id: 1c7d8ab157e562368d1c4e16cecd0da6f90df468
2013-05-27 03:24:15 -05:00
d010b126cd Testing commit.
Former-commit-id: 4f768ad326156840b8a6de1a610c4dd33e9a6311
2013-05-26 22:29:20 +02:00
369ed2adb7 Hopefully last build trigger.
Former-commit-id: 51f47cd70dc0d71e4dbdd4eed020fc1247ff0e69
2013-05-25 23:12:32 -05:00
2d74ae8f53 Trigger a build.
Former-commit-id: dbd5bd3f50ce453b8c0d29c30538bddb383ddecd
2013-05-25 20:42:26 -05:00
1f69ffd2bc Trigger a build.
Former-commit-id: c2c2521e59addcf1264bf1cabdca380d4bd7ada8
2013-05-25 20:35:12 -05:00
f53ab14afc Trigger a build.
Former-commit-id: f8741164c7c201f9501a6a62001d1c575a822687
2013-05-25 20:41:28 -05:00
5f4524e385 Trigger a build.
Former-commit-id: 6c1d55d357f3bc85759e9295dbdf2d7256e03923
2013-05-25 20:19:48 -05:00
5f132b0f1c Trigger a build.
Former-commit-id: 870b548ae7ccb49acd6ab9d61196b3d592927e0a
2013-05-25 20:06:24 -05:00
6d1d20cbcb Trigger a build.
Former-commit-id: 39fe66a68d3c9d734140de80f6ae46b75efa52f0
2013-05-25 19:15:55 -05:00
ba4c28ca41 Trigger a build.
Former-commit-id: 661b176f46a4f9304be43d92b147ea4a23ad7269
2013-05-25 19:10:23 -05:00
d64fa7cb7b Trigger a build.
Former-commit-id: 7e2b688c6e65a8dd9513a1c77312b2fbf34dd812
2013-05-25 18:56:59 -05:00
f6bbb15e75 Trigger a build.
Former-commit-id: 9d468c4a0b4bcd1fc41d8f407c68c8fe443d40e9
2013-05-25 18:12:32 -05:00
ec9ae29be8 Trigger a build.
Former-commit-id: 2b65f8f4b611cfca7bbb196694c12cd12f6bdc7a
2013-05-25 17:47:36 -05:00
3a65722bff Changed my handle for amxx client command.
Former-commit-id: 51b3160068ef6cbe3dd6ba6acaeacf35c333b7b6
2013-05-25 00:05:34 -05:00
c8ae274845 Hopefully triggering a build.
Former-commit-id: 57a6a70c0902685c2b5bf94ac50585e6b8dea00e
2013-05-24 23:15:30 -05:00
e54e1af413 Hopefully triggering a build.
Former-commit-id: c0064dfe38808f7c35bee013eb1099ab121ab38e
2013-05-24 23:11:23 -05:00
73ef98ca60 Hopefully triggering a build.
Former-commit-id: bb9724c4abfdf2898d3ef638ac185065638459e7
2013-05-24 22:37:45 -05:00
360477f209 Hopefully triggering a build.
Former-commit-id: f1d808cb8fd40643f58e42ba7de18fad559fbf8c
2013-05-24 22:40:31 -05:00
7e64cbf543 Updated ham sandwich offsets for TFC.
Former-commit-id: 561e9d87dfe374662c189bc76ea65bf4b40f07e7
2013-05-24 22:28:06 -05:00
2c2de2169f Updated hamsandwich offsets for DOD.
Former-commit-id: e65de8d409bbfde88cb96a8a33e658ee77a321ea
2013-03-17 04:05:41 -05:00
52178abe4d Disable Next button if license agreement is not accepted.
Former-commit-id: 05edd66a34866e57b6966f9a2591da9e83df9268
2013-02-26 02:18:48 -06:00
ad46732e12 Fixed version number.
Former-commit-id: fef9682efc6e96913d44dcc0d2c1400877907347
2013-02-24 01:31:35 -06:00
7718aac519 Re-built Pawn assembly interpreter and JIT object files.
Former-commit-id: ac5b6b15f2cb304847d39d3080ffb8a2a8926074
2013-02-24 01:04:09 -06:00
ed1d061aa4 Re-enable JIT on Mac OS X (bug 5601, r=dvander).
Former-commit-id: b220d90bb4dff8b777dbafe39b871e50b74e1d59
2013-02-24 01:03:56 -06:00
2a6486b78f Align stack on 16-byte boundary for native calls in the JIT compiler (bug 5601, r=dvander).
This alignment is needed if a native calls a library function on OS X or uses SSE instructions.


Former-commit-id: fc08daf58b480f0909b453cd3aeafc96f1304bcc
2013-02-24 01:03:55 -06:00
e5c92a2c30 Align address of asm_runJIT down to nearest page boundary instead of up for mprotect on Linux and OS X (bug 5601, r=dvander).
Former-commit-id: af6ba72b0ba1f2ac1316337a6c67f5f39996182a
2013-02-24 01:03:54 -06:00
d8ddbb0687 Align stack on 16-byte boundary for native calls in the assembly interpreter (bug 5601, r=dvander).
This alignment is needed if a native calls a library function on OS X or uses SSE instructions.


Former-commit-id: 895c8561967efe2b456ae73684431b9469e6cd37
2013-02-24 01:03:53 -06:00
e414ede098 Fixed clang warnings when neither the assembly interpreter nor JIT are enabled (bug 5601, r=dvander).
Former-commit-id: fd100b2fa78412c4698a16280dacf0bf4005b9d8
2013-02-24 00:45:53 -06:00
e3d750597a Fixed module loading on OS X (bug 5601, r=dvander).
Former-commit-id: 3d0277c1f01b71fa8401a7f815e09bebfb0f73cf
2013-02-24 00:45:53 -06:00
fe2e9dbfc2 Removed patch file that was accidentally added in a previous changeset.
Former-commit-id: e3cb306a72f6adcb57a536ac66f3ad7ebaa27443
2013-02-24 00:45:53 -06:00
13db8fdf70 Filled out the license pane.
Former-commit-id: 8368f5728b457ca3e62ad5f2d27d717e1b56c505
2013-02-23 21:54:49 -08:00
bd65a373ec Fix back button.
Former-commit-id: 3a0937a2f75c279de7c113121c098b04a59fe9d1
2013-02-19 00:30:33 -08:00
14b1716be8 Fix build.
Former-commit-id: 489c275d88f775824b39d27ee24b7ae1d168b37a
2013-02-19 00:28:48 -08:00
a73ae02b7e Switch to WPF.
Former-commit-id: e75aa871e3fecbe716c8dc49a348148d1bedf7f3
2013-02-19 00:27:10 -08:00
0ffd9caaed Initial import of C# installtool.
Former-commit-id: 072e30433709380ffcb8e9ea1d658c1ebcb99f7d
2013-02-17 01:34:05 -08:00
5c380e2310 Add AMXXStudio configs to the tree.
Former-commit-id: 2c9749232234c1b8b07c50a2359a8fd8f3842c8c
2013-02-14 23:31:42 -08:00
7e7209d29a Bump version to 1.8.3-dev.
Former-commit-id: 3dd030c4e3f53c8baf4f30e22beaba15c852804d
2013-02-14 23:30:38 -08:00
afd0acd4a7 Fix build bustage (TM).
Former-commit-id: 58d6835c1794423101e92664a8f4e36b40826638
2013-02-14 02:00:29 -08:00
07aaf3713c Fix build bustage.
Former-commit-id: 553dea80f22f664b24ca89908dca2e8c42cf37af
2013-02-14 01:57:09 -08:00
1b908eeb9e Disable JIT on Mac OS X due to crash.
Former-commit-id: bac92ddbc7c262e4a1c31cc3dfbf4763e10f3440
2013-02-14 01:52:29 -08:00
3db718799f Bump version for release.
Former-commit-id: 4e0f69d8421b4d0a421f5960ce8ff77497acfa63
2013-02-14 00:51:48 -08:00
146d77f819 Fixed Windows tsx build.
Former-commit-id: 9ffe0365415ba5cd9fdaa12782c9677f8f1ca951
2013-02-13 03:32:25 -06:00
06a9241bcf Changed my handle.
Former-commit-id: 9b29f183153a23dbf0f830cb4580dc4dd2853143
2013-02-13 03:23:27 -06:00
ce4b23b41a Fixed metamod paths in MSVC projects.
Former-commit-id: c99a90817fb726ee28783d9b1139e4d540daa9fa
2013-02-13 03:22:59 -06:00
3184d1466e Backout changeset aa745bf0c347 (bug 3302) for regression reported in bug 5552.
Former-commit-id: 0d2385b0045e46fdefee4ca2b5f6442397cfbe60
2013-02-13 01:13:18 -08:00
8793d8f8d5 Fix strfind ignoring its last parameter (bug 4070, r=dvander).
Former-commit-id: a31621dd0c08c7bbede41a06d0ebf8abab1b66a5
2013-02-13 00:54:26 -08:00
a26a98cb98 Fix incorrect result for replace_all (bug 5064, r=dvander).
Former-commit-id: e3824c4c87c43734e6c5d4831f2ca7cece0a5147
2013-02-13 00:40:57 -08:00
5e69db511c Made amxxpc_osx executable.
Former-commit-id: ea2a4889fe69274051fa71b1d94308935cdc34e4
2013-02-13 02:32:01 -06:00
468aaba79e Fix last map being duplicated for each blank line in maps file (bug 5005, r=dvander).
Former-commit-id: e0bcbaeac750a494eb700dea78dd7210783d7623
2013-02-13 00:29:54 -08:00
a3aa086375 Fix crash in EngFunc_TraceTexture (bug 4576, r=dvander).
Former-commit-id: c439946a3451dbdfafa2f542e08bc7f83d586165
2013-02-13 00:27:53 -08:00
82ad133d91 Add hamsandwich support for Adrenaile Gamer (bug 4445, r=dvander).
Former-commit-id: e08f1dfccf3b5bfb65687aee06c5d8fdbff94540
2013-02-13 00:25:48 -08:00
250cb89479 Really fixed HLSDK paths in MSVC project files.
Former-commit-id: e04d44c85196034f5deebbf3c46ecc9fc710aeed
2013-02-13 02:08:29 -06:00
121dc75451 Directly kick players rather than use a loopback command (bug 3884, r=dvander).
Former-commit-id: dfe1903ecf4faa49b83b85213aa0fbc083fbb0c2
2013-02-13 00:15:40 -08:00
69c06545ce bug 3553 follow-up fix.
Former-commit-id: 65d97fe5f5bca0c3a3ba8574f7c924d8ba7dc1cd
2013-02-13 00:09:34 -08:00
9e5b5683af Increase the capacity of speech.ini (bug 3553, r=dvander).
Former-commit-id: d10ef5e49419251d3c841148093fb3210bc6d028
2013-02-13 00:08:32 -08:00
f01357aa7a Fixed HLSDK paths in VS 2010 projects files.
Former-commit-id: 32516f18ee3b87c2030ba5fad91f0b3e7a1ec741
2013-02-13 01:22:50 -06:00
7f13ae3e4f Fixed buildbot Perl scripts for Mac OS X build (bug 5601, r=dvander).
Former-commit-id: 375e91c1d22c5cc2a9107bbc804cbc17794421d4
2013-02-13 01:22:40 -06:00
e5b990b8e0 Removed dlsym from Linux package.
Only dlsym64 is completely gone. The dlsym binary must remain to be used by the builder. It just won't appear in the Linux download pacakages anymore.


Former-commit-id: c387cdeff8270d4e2f1dab7e66173f1be76cc71f
2013-02-13 01:22:15 -06:00
99411af951 Updated installer to support new Linux metamod filename and Mac OS X binaries (bug 5601, r=dvander).
Former-commit-id: 0be36403602c16adaddc84881c9613b3f0f9c1ff
2013-02-13 01:20:11 -06:00
b318509687 Added dependencies for the Installer Delphi project.
Former-commit-id: 88173f089cfe2d6b72e987f763ff25c7038528bc
2013-02-13 01:19:36 -06:00
37f7975416 Rebuilt compiler binaries and built new binaries for OS X. 2013-02-13 01:16:41 -06:00
40c1fee55a Added support for Mac OS X and building with clang (bug 5601, r=dvander). 2013-02-13 01:14:37 -06:00
b0fe6c83e2 Fix get_team() sometimes being wrong for dead players (bug 4656, r=dvander). 2013-02-12 23:17:24 -08:00
59fc122986 Triggering build. 2013-02-12 03:38:26 -06:00
3ec6bbc2ce Triggering build. 2013-02-12 03:30:51 -06:00
a431cb420b Triggering build. 2013-02-08 04:07:52 -06:00
5a6c4ea408 Removed amxxpc64 and rebuilt amxxpc binaries. 2013-02-08 03:44:40 -06:00
7d9376a64b Remove SCASM, which was pointless and buggy bloat. 2013-02-08 00:38:35 -08:00
6e4f09366e Ditch amxxpc64. AMXX files will now only contain 32-bit code. 2013-02-08 00:35:59 -08:00
6c22cb171d Synced hamdata.ini. 2013-02-04 18:40:04 -06:00
77e900585a Backed out changeset 41ca53ad9bff 2013-02-04 18:37:37 -06:00
86bfeec554 Synced hamdata.ini 2013-02-04 18:36:18 -06:00
45343e6e27 Updated hamsandwich offsets for HL1 and CS 1.6 beta. 2013-02-04 07:31:33 -06:00
944f608f09 Fixed hamsandwich vtable patching on Linux for newer GCC binaries. 2013-02-04 07:31:32 -06:00
ad960a64e2 Fixed Linux ClientCommand detour crash in cstrike module for beta. 2013-02-02 23:41:45 -06:00
e2a687d96d removed pushbuild.txt test file 2012-07-27 14:56:48 -03:00
53e43b8f31 testing push 2012-07-27 14:45:35 -03:00
da2eb8ea66 Hopefully fixed Windows build. 2011-07-01 21:51:27 -05:00
088f109a64 Added .hgignore file. 2011-06-29 00:59:58 -05:00
9d65198786 Upgraded MSVC project files for VS 2010 and modified build tool to use them. 2011-06-29 00:50:14 -05:00
49e3b748c3 Fix time drift on repeating tasks (bug 3302, r=dvander). 2010-12-12 18:36:59 -08:00
5324c7c620 Fix TrieSetArray reading the wrong parameter (bug 3816, r=dvander). 2010-09-11 23:02:43 -05:00
26d2a4f877 Add documentation to set_view (bug 4065, r=dvander). 2010-12-12 18:24:30 -08:00
76d407b45a Fix menu_create() documentation (bug 4426, r=dvander). 2010-09-11 22:33:57 -05:00
e783c4bfcb Fixed fopen leak in mapsmenu (bug 3957, r=dvander, a=blocking). 2010-04-27 00:40:38 -07:00
afc663a51a Lowered wait time in between threaded queries (bug 3740, r=dvander). 2010-04-27 00:24:50 -07:00
cb500636cc Fixed amx_ban (bug 4159, r=dvander, a=blocking). 2010-04-27 00:21:49 -07:00
e6f4dfbfe2 Added packager. 2010-04-04 18:10:35 -07:00
1bfdda7e71 Fixed more Makefile paths. 2010-04-04 18:00:36 -07:00
330fd1c2ae Fixed Makefile paths for Metamod. 2010-04-04 17:55:37 -07:00
56b676eafb Fixed core build. 2010-04-04 17:37:05 -07:00
73e3e52057 Updated version files for HG. 2010-04-04 17:22:45 -07:00
56b53584d1 Reversed test condition for build failure. 2010-04-04 17:11:11 -07:00
f43fcd6670 Invoke builder.exe correctly. 2010-04-04 17:02:16 -07:00
5984f0d442 Turns out mono eats exit codes. AWESOME. 2010-04-04 16:58:24 -07:00
1b75b0ba92 Fixed exit code from failed builds. 2010-04-04 16:49:12 -07:00
52f5723f4e Another windows bootstrap fix. 2010-04-04 16:42:24 -07:00
eb6ab857fc Fixed bootstrapping on Windows (I hope). 2010-04-04 16:37:28 -07:00
24bfff9cf1 See if a build will run! 2010-04-04 16:32:15 -07:00
1d3f91be43 bootstrap script now builds builder tool. 2010-04-04 16:24:42 -07:00
824d9953d9 Initial import of bootstrapig for buildbot. 2010-04-04 16:07:37 -07:00
b706108ed6 Squashed commit of the following:
commit 011d9b6b07d904ad1e81ef7c747269903e2d47c4
Author: David Anderson <dvander@alliedmods.net>
Date:   Mon Jan 11 00:17:08 2010 -0600

    Initial import from Subversion (amxmodx/trunk rev 3757).
2014-02-06 23:06:54 -08:00
adab9c93a0 Removed filtering on admin vote questions (bug 3356, r=sawce). 2009-02-07 23:44:23 +00:00
0f8c61c1e1 Re-added fflush function (bug 3355, r=sawce). 2009-02-07 23:43:07 +00:00
0b4f28fecf SQL_QuoteString can now be used without a DB handle (bug 3427, r=sawce). 2009-01-08 20:02:09 +00:00
d97ab913cf Fixed zero precision bug in atcprintf (bug 3242, r=sawce). 2009-01-08 20:00:38 +00:00
2249f1e70c Gah 2008-08-20 06:08:27 +00:00
0f4ee9d91d Added some missing testsuite plugins to nsi installer file. This should hopefully be all that's missing. 2008-08-19 18:30:32 +00:00
5cc5ea4006 Added missing fakemeta_util.inc to nsi installer file 2008-08-19 18:12:05 +00:00
2145823971 Updated nsi installer file list; it was missing celltrie.inc 2008-08-19 14:34:12 +00:00
cdf3807955 Bumped version numbers. 2008-08-17 00:50:57 +00:00
10ff8c11fd Fixed another build tool regression. 2008-08-17 00:18:59 +00:00
81af863496 New compiler builds. 2008-08-17 00:14:45 +00:00
3e8c921b9f Updated compiler builds after all. 2008-08-16 23:40:53 +00:00
f201592ddb Fixed regression. I'm not making new builds though. 2008-08-16 23:32:58 +00:00
72bebf9af8 Reverted all amxxpc binaries. There was some build regression somewhere on Linux, so this had to be rolled back for now. 2008-08-16 23:29:51 +00:00
73ea754640 Fixed not building because sdk stuff was moved around. 2008-08-16 23:24:25 +00:00
ce9728af93 Fixed GeoIP not compiling on gcc 2008-08-16 23:20:07 +00:00
6486c56a15 Bumped versions. 2008-08-16 22:47:59 +00:00
1d95fb3dcd Updated build tool for compat regression in Mono. 2008-08-16 22:45:59 +00:00
c07d8f3d93 Final VS 2005 + Linux tomfoolery 2008-08-16 20:13:12 +00:00
adaf207b58 Forgot about this in my VS 2005 tirade 2008-08-16 10:19:42 +00:00
0dc6a4a5dd Whoa, amb1941: All of AMX Mod X is now officially moved over to Visual Studio 2005 (MSVC 8)
Also did the following:
* Removed -fPIC from all Linux makefiles
* AMXX build tool now also moved over to VS 2005
* AMXX build tool binary renamed from "AMXXRelease" to "builder"
* MSVC project files now can use environment variables to point to the paths of the Metamod headers and HL SDK: $(METAMOD) and $(HLSDK) respectively
2008-08-16 09:48:39 +00:00
626bfe5240 Updated GeoIP code 2008-08-16 08:24:19 +00:00
e4a3647b88 Updated GeoIP database to August 2008 2008-08-16 07:59:05 +00:00
f942a857d0 Moved sven module of out trunk for now 2008-08-16 07:46:30 +00:00
633a81f864 Fixed amb1564: amx_chat sundry details did not obey cmdaccess.ini (patch from Teyut). 2008-08-16 07:07:09 +00:00
1b5dc0d567 Added corrections in bug 1762. 2008-08-16 06:53:07 +00:00
21b8f905ae Added amb1762: Macedonian translation (thanks z3r0Lev3L). 2008-08-16 06:51:07 +00:00
36a15919ca Added amb1365: Slovak translation (thanks Centaury). 2008-08-16 06:40:49 +00:00
24ff7c3a01 Fixed amb1288: amx_banip did not show time (patch from "James") 2008-08-16 06:16:29 +00:00
7beef260f2 Fixed amb1175: new module and plugin did not get added to addon packages. 2008-08-16 05:01:32 +00:00
36db059672 Fixed amb1163: float printing broke on large values. 2008-08-16 04:56:50 +00:00
01f3d729de probable fix for RTE in tfc stats.sma: amb1642 2008-05-07 17:36:53 +00:00
0a38ef831f Fix for amb1647: brush origin retrieval was wrong 2008-05-07 05:17:21 +00:00
55d18da46c Fix for amb1648: typo in validate_menu_text 2008-05-07 04:58:32 +00:00
a7d6352a22 Fix for amb1643: TFC's stats.amxx added an option it did not support to the stats config menu 2008-05-07 04:54:08 +00:00
240c92e20f Updated all module SDKs to stop the most annoying issue ever: amxxmodule.h required size_t but did not include stddef.h
Also stopped dodfun, dodx, tfcx and tsx from loading on games other than the ones they are designed for.
2008-04-29 06:53:55 +00:00
f410ea743d Added part of amb1604: unregister_message - OH GOD I HOPE I DIDNT BREAK IT 2008-04-29 02:18:39 +00:00
9100ec753c Added amb1167: menu_addtext(menu, const text[], slot=1) 2008-04-27 19:19:53 +00:00
1d7cbd4203 Added check for mod game when a module loads: If the module has the optional function, and reports that it is not an expected game, the module will not load.
This should fix how some people seem to think the counter strike modules will work on games other than counter strike.
2008-04-27 00:07:06 +00:00
4049a0c3be Initial addition of ns_remove_upgrade (amb1635): oh god I hope this will suffice 2008-04-26 21:40:56 +00:00
86ea50dfdd amb1624: revision 3234 was accidentally undone 2008-04-26 08:18:34 +00:00
6a4318f4d1 Work around for amb1632 - can't completely fix due to float rounding issues that don't work too well with pawn's floatround 2008-04-26 07:52:59 +00:00
6d03b29963 forgot 32-on-64 support for this 2008-04-15 23:36:13 +00:00
44e078c7c0 added support for building 32-bit on 64-bit machines 2008-04-15 23:26:54 +00:00
e1dd514f15 msvc project files updated for trie_natives 2008-04-15 05:40:31 +00:00
c52943b03c oops, forgot a file i hope this broke the nightlies 2008-04-15 05:36:50 +00:00
b33d2f559b Fixed the debug builds having NDEBUG defined, causing stuff like asserts not working properly 2008-04-14 19:56:31 +00:00
53ed817183 Added amb1600: trie natives 2008-04-14 19:52:11 +00:00
683f453b6f Fixed building a 32bit binary on a 64bit machine
Added a super cool new native
2008-04-13 22:54:47 +00:00
145ff45876 Wrong language key in vote kick/ban (amb1456) 2008-04-10 06:12:35 +00:00
e3e64233ec Fix for amb1596 ; csx was allocating a buffer to small for csstats.amxx's stats[] array 2008-04-10 05:48:36 +00:00
313044fe89 Fix for amb1565 CCmdManager's gotAccess check was retardedly checking to make sure a user has all access flags instead of one of the access flags; this is inconsistent with how access is checked elsewhere 2008-04-10 05:42:06 +00:00
074fd60f3c plmenu now ignores immunity if a command is executed on self 2008-03-30 21:26:31 +00:00
b608305c79 cs and ns did not have plmenu bantimes and slapdamage amounts in their amxx.cfg
also added "0" slap damage to the default values as it was mistakingly left out
2008-03-30 21:23:01 +00:00
bbf7593e43 fix for amb1139: Menufront now follows cmdaccess.ini changes for its additions (also, pluginmenu does now too) 2008-03-30 20:51:48 +00:00
e373ee1165 Small change to previous commit, g_CaseSensitiveName[id] is cleared at the start of getAccess lookup 2008-03-30 19:38:01 +00:00
375d6aa0da Added amb1263: A new flag in users.ini, 'k' implies name/tags are case sensitive 2008-03-30 19:28:36 +00:00
4c4fde8bf3 Sort of fix for amb1293: It's a bug with HLDS's parsing of localinfo keys 2008-03-30 10:55:13 +00:00
5e9e119c76 Fix for amb1545: show_activity was ignoring the last client 2008-03-30 07:36:10 +00:00
2a383feef6 added amb1290: Invalid_Array handle in cellarray.inc 2008-03-30 07:26:59 +00:00
a726b796db cellarray test had old ArrayGetCell syntax, oops 2008-03-30 07:25:35 +00:00
9348f9931e amb1096 affected DoD, TS and TFC modules, fixed. 2008-03-23 03:45:21 +00:00
4c79232f17 Fix for amb1199 - incorrect comment for Ham_DOD_RoundRespawnEnt 2008-03-04 19:21:09 +00:00
16720a2f70 Fix for amb1343 - show_activity() had a messed up vformat() call 2008-03-04 19:18:17 +00:00
69a8a86ff6 Fix for nvault not loading on some Linux servers - nvault no longer uses exceptions, so libstdc++ is no longer needed 2008-03-04 19:06:39 +00:00
b0286c9c4d Half-fix for amb1218 - typo in ns.inc 2008-03-04 18:55:54 +00:00
660e97c764 Fix for amb1313 - @section svencoop windows should have been @section SvenCoop windows 2008-03-04 18:51:35 +00:00
df522ebe6f Woops!
Fix for amb1096 - csstats_rank mode 2 caused a server lockup.
2008-03-04 18:40:15 +00:00
be35cc9912 Fixed amb1267 - FlagManager caused a crash if the cmdaccess.ini was not writable 2008-03-04 18:02:16 +00:00
9801c4166f Fix for amb1389 - client_changeteam had a reversed syntax 2008-03-04 17:22:40 +00:00
80db0ed0b3 Fix for amb1452 - ns_give_item was giving wrong items 2008-03-04 17:19:15 +00:00
b9d98ede39 fixed amxx build 2008-01-07 18:18:52 +00:00
Zor
e6c8afa5de Removed the olddeadflag from CPlayer and moved the spawn forward into the PStatus Client Message 2007-12-28 19:13:24 +00:00
60b3f30ab3 fixed fs1315 (fread_blocks broken due to typo) 2007-12-26 15:46:06 +00:00
cfd2011e80 added two FindCloses 2007-12-16 10:00:08 +00:00
5ed4c27732 fixed amb1089 - amx_banip message printed twice 2007-11-15 18:12:25 +00:00
afd1072583 fixed amb1049 - sloppy TraceResult namings 2007-11-15 18:08:15 +00:00
64ad54aa51 fixed amb1134 - unused cvar 2007-11-15 18:06:16 +00:00
3df060cad6 fixed amb1143 - typo in SetClientKeyValue() 2007-11-15 18:05:16 +00:00
1497d58e41 removed -fno-threadsafe-statics, didn't do anything 2007-11-13 16:46:59 +00:00
fd028ca1e7 fix for amb1077 - PT_TLS bugs in glibc 2007-11-13 16:45:55 +00:00
a1d812398b fixed amb1130 2007-11-13 02:28:09 +00:00
df96a81a75 fixed code that was clearly never tested (amb1126) 2007-11-13 02:25:20 +00:00
656d30be83 fixed amb1096 2007-11-13 01:44:17 +00:00
6e8a164e67 bumped version to 1.8.1 2007-11-12 23:50:41 +00:00
521288dae0 added dlopen() failure logging to linux 2007-11-12 23:48:26 +00:00
4c464390ac fixed amb1080 - german translation typo 2007-10-30 01:59:51 +00:00
408e69c41c fixed amb1079 - threaded queries with results would crash 2007-10-30 00:09:18 +00:00
cc99d6d1fb finalized build numbers and all that other release crap 2007-10-26 02:23:21 +00:00
3030302952 updated installer file list 2007-10-26 01:58:59 +00:00
f281a24274 added pluginmenu to build 2007-10-26 01:47:40 +00:00
efbba0a909 small change to the version changer for release builds 2007-10-26 01:42:35 +00:00
3750788893 fixed amxmodx makefile 2007-10-26 01:42:12 +00:00
993b6e6c74 added 3 more spaces to version output so our version numbers look nice 2007-10-26 01:41:45 +00:00
7f51048438 fixed ns makefile 2007-10-26 01:31:28 +00:00
212697b950 whoops, that was one terrible commit. the bug is really fixed now. 2007-10-26 01:09:08 +00:00
6a567f3c77 fixed a memory corruption bug in CVector 2007-10-26 01:03:23 +00:00
36241e2905 updated revision numbers 2007-10-26 00:28:17 +00:00
b630ffe28f added amb1063 - sven coop offsets from ts2do 2007-10-26 00:16:04 +00:00
f6276db4d0 fixed amb1067 - SQL_SetAffinity crashed when targeting sqlite 2007-10-26 00:10:09 +00:00
a2e3f8682f fixed amb1069 - map prefixes still didn't work 2007-10-25 23:54:51 +00:00
dbf6143747 fixed linux build 2007-10-23 11:24:51 +00:00
4aafcc50a0 lowered thread think time from 500ms to 200ms 2007-10-22 22:21:20 +00:00
a86b1c5097 added amb281 - multiple result sets for MySQL 2007-10-22 21:31:02 +00:00
2d737970d0 small fix for amb1024 - weird plugin dir choice 2007-10-22 20:06:28 +00:00
b7f8503655 added amb844 - get_pdata_ent 2007-10-22 19:52:06 +00:00
ca3d15c27e fixed amb816 - stats comments were wrong 2007-10-22 19:40:35 +00:00
468e6fb9dd added amb909 - LoadFileForMe() 2007-10-22 19:26:45 +00:00
50bbefa3ba fixed amb1023 - register_library had an outdated comment 2007-10-22 19:00:25 +00:00
c635638fd1 implemented amb773 - now precaches sounds from speech.ini, can be disabled via compiler switch 2007-10-16 20:59:57 +00:00
b2b2c1d961 fixed a very nasty bug where the runtime stack/heap values appeared to simply be corrupted by the JIT initialization function. this probably never manifested in thiadmer's builds because the routine was broken at a higher level 2007-10-03 06:35:20 +00:00
748d000c02 fixed the other native relying on this offset as well 2007-10-03 00:54:19 +00:00
c1791361da now for the one byte fix... 2007-10-03 00:51:25 +00:00
6a483cfcae fixed amb291 issue 2007-10-03 00:50:30 +00:00
fcdd17480c fix for amb253 - database now spinlocks instead of failing to lock 2007-10-02 23:38:31 +00:00
21ad8ba71b Extension of amb29 - forgot to change the retarded pause menu 2007-09-09 03:34:52 +00:00
dd55716f15 Fix for bail breaking is_user_bot - amb914
This still doesn't cache since that proved to be buggy; this will check the flag first, and then auth second.
2007-09-06 16:37:57 +00:00
bd3b7fc70c Fix for amb895 - amx_plugins now displays properly over RCON 2007-09-03 16:39:32 +00:00
26f1c8dec7 clarified menu_create and its handler 2007-09-02 18:52:24 +00:00
a749aad1b4 - inserted a nasty backwards compatibility shim specifically for war3ft 3.0-rc. this may be extended globally if i can find a way to generalize it without breaking menu_create().
- updated comment about player_menu_info() as it was wrong.
2007-09-02 18:35:53 +00:00
58c7239b48 Fix for amb817 - dod stats heading was mislabeled 2007-09-01 16:39:01 +00:00
e616bd523e changed version number to 1.8.0 2007-08-16 21:18:56 +00:00
d163ead2ac it helps, just a bit, to actually commit the file 2007-08-16 19:09:49 +00:00
00838065ae fixed a format bug in statscfg.sma 2007-08-16 19:08:17 +00:00
8298158f08 newmenu stuff is now in its own nice callback. yay 2007-08-16 19:07:59 +00:00
824ed30872 Fix for amb790 - users.ini with spaces / tabs before a comment line were being read as an admin entry.
admin.sma now trims each line it reads.
2007-08-16 17:58:34 +00:00
2b15c30ad1 committed a bunch of phrases for statscfg, fixed a few languages missing some phrases 2007-08-16 17:47:00 +00:00
643ddc18be Removed erroneous default values for pdata string natives. 2007-08-16 17:13:07 +00:00
639db5846e workaround for msvc optimizing away stack usage on detour 2007-08-16 16:30:16 +00:00
0bb430b3eb Reverted amb149 2007-08-16 15:16:41 +00:00
550dbae0c7 fixed typos and added FindClose to search function 2007-08-12 21:24:27 +00:00
f0ee52f892 now returns error message instead of bug report when trying to install 0 files 2007-08-12 20:28:21 +00:00
84b146d74a added another check to prevent users from running it in an invalid directory 2007-08-11 14:06:03 +00:00
3f1226e504 Fixed +/- cmds not being set in the flag manager. 2007-08-11 13:38:19 +00:00
186519dc92 Fix for amb774 - is_user_bot() checked on killer twice, when one check should have been victim. 2007-08-10 14:59:05 +00:00
51ce96ac3c Fix for amb775 - clcmdmenu used a buffer that was too small to generate the command (from 64 to 512) 2007-08-10 14:55:44 +00:00
16f6048d74 updated comment so future bail doesn't ask "which one is right" 2007-08-10 07:17:40 +00:00
e2c1bad224 fixed a serious bug in the ClientCommand detour for cstrike, crashing on cl_autobuy 2007-08-10 07:12:04 +00:00
e6663991a7 All include files should be semicolon-correct now 2007-08-10 04:52:12 +00:00
62c41fbd03 Removed semi colon pragma 2007-08-10 03:41:59 +00:00
0b581b1506 fixed mysql makefile 2007-08-09 16:03:41 +00:00
76a7cafe50 Changed the new %S format option to %a to hopefully prevent some confusion. 2007-08-08 02:40:40 +00:00
12ab387be5 Implemented amb743 - plmenu for cstrike now has a to spectator option. (Requires cstrike module) 2007-08-08 02:32:53 +00:00
cfc9c1dd02 bumped installer version to 1.8 2007-08-07 21:09:30 +00:00
544d2dedef moved mkdir from amxmodx.inc to file.inc 2007-08-07 00:54:22 +00:00
1721383237 Fix for amb736 - find_entity defined twice 2007-08-05 11:23:02 +00:00
68961a91e2 Fixed amb735 - adminslots cvar comments in config files were misleading 2007-08-05 10:41:10 +00:00
435766b2ef reverted a bad change in fakenatives 2007-08-04 14:18:56 +00:00
750247e8a6 fixed a bug that broke creative natives from the last change 2007-08-04 14:17:19 +00:00
a81d6f3271 Added hamdata.ini to core config 2007-08-04 04:10:29 +00:00
cb62613501 synced language files 2007-08-04 04:10:14 +00:00
2efc82ea59 Included fakemeta_util for convenience. 2007-08-04 03:59:56 +00:00
a95658bd2d Added hamsandwich include files to back include directory 2007-08-04 03:55:42 +00:00
5f10cc1ebc added ns plmenu to build 2007-08-04 03:43:49 +00:00
226d188d19 Fix for amb257 - get_user_origin mode 4 false positives.
Most should be filtered out.
2007-08-04 03:34:34 +00:00
9e0f3f01a7 fixed ns win32 build 2007-08-04 00:02:35 +00:00
06b461acd7 fixed msvc7 project files for ns 2007-08-03 23:51:10 +00:00
ffb8fc683b Implemented amb291 - cs_{set,get}_c4_defusing() 2007-08-03 19:11:47 +00:00
aa2cac0f0c added fastdelegates, sheesh 2007-08-03 17:41:34 +00:00
2bc6d965f6 Fix for amb437
dod_set_user_kills & dod_set_user_score no longer have the dead scoreboard class side effect.

dod_set_pl_deaths comment has been updated to reflect the side effect.
2007-08-03 17:35:12 +00:00
c5e36a4e3c fixed a possible bad bug in linux builder 2007-08-03 17:31:42 +00:00
bbc6af247b fixed linux being broken 2007-08-03 17:29:59 +00:00
164780363b failed builds block again
added some redirection to windows builder
2007-08-03 17:26:57 +00:00
807e6a0f9a compression is now optional 2007-08-03 17:17:54 +00:00
605bef0482 ham sammich is now versioned properly 2007-08-03 17:01:31 +00:00
2e3c652996 added hamsammich support to build tool
added /useenv support to buildtool for win32
2007-08-03 16:48:04 +00:00
a8652dd91b updated amxxrelease build 2007-08-03 16:37:56 +00:00
2379aa3108 fixed msvc7 project files 2007-08-03 16:36:04 +00:00
ed3f5dfd4b Fixed the admins list not flushing when amx_reloadadmins is executed. 2007-08-03 16:29:53 +00:00
747d326ed5 Implemented amb216 - SQL_MakeStdTuple now has an optional timeout parameter. 2007-08-03 15:52:35 +00:00
b4ff754e29 Implemented amb340 - amx_ban / amx_banip now display reason in the show_activity blurb.
Language files need synced.
2007-08-03 15:46:50 +00:00
67ac030c56 Expanded on the info message when a admin_ban user tries to ban someone not in the cache. 2007-08-03 15:29:29 +00:00
15b62648c9 Implemented amb307 - admincmd now caches a few of the last connections.
amx_addban changed back to ADMIN_BAN.  Users without RCON access will only be able to ban those in the old connection cache.  Users with RCON access still have unrestricted access to amx_addban.

The old connection cache can be viewed with amx_last (ADMIN_BAN access required by default).
2007-08-03 15:26:22 +00:00
b09bf4c532 Work around for amb228 - amxmod_compat caused set_user_hitzones to stop functioning.
Any plugins being emulated by amxmod_compat that still use the traceline forward will still cause the issue, but if no plugins use that forward it won't interfere.

(also, plugin_flags() can now specify a plid)
2007-08-03 06:48:08 +00:00
e045e2fdb6 Fix for amb196 - amx_modules did not handle invalid modules properly. 2007-08-03 05:27:36 +00:00
36dc8da47c Removed native/module filters, oops. 2007-08-03 03:01:22 +00:00
25d95f1115 Fix for amb183 - plmenu's team menu is not compatible with natural selection. 2007-08-03 02:59:46 +00:00
e254ef6b15 Added ns_get_user_team for a replacement for get_user_team. 2007-08-03 02:57:59 +00:00
7038305812 Merged ns plugins / include files to trunk.
(ns/unstuck doesn't require engine any more)
2007-08-02 16:37:57 +00:00
c77176a4ce Re-added svn versioning to module 2007-08-02 16:33:34 +00:00
c604eefde0 Merge of rewritten NS module into trunk 2007-08-02 16:20:32 +00:00
48022d3c5c Implemented amb673 - pre-compiled regular expression support.
Also commented in the include file a bit better.
2007-08-01 17:36:10 +00:00
cf36abf7e6 Implemented amb31 - plmenu default options (for ban menu and slap menu) are configurable in a config file.
Need to include this in the mod - dependent plmenus when they are reviewed later.
2007-08-01 06:03:51 +00:00
ed84900ab6 amb467 - conmotd.txt is removed 2007-08-01 04:19:23 +00:00
83c82387e3 Changed ArrayGetCell() to return the cell value instead of byreferencing the value. 2007-07-26 16:22:29 +00:00
9ce9b142e7 Implemented amb397 - amx_add{client}menuitem now accepts filenames as well as registered plugin names
(is_plugin_loaded() now has an optional second parameter to search for filenames)
2007-07-25 18:54:32 +00:00
ced56c79b6 what the hell how did this change 2007-07-25 18:13:38 +00:00
d836aeb716 Added some defines for cmd_target's filter system (for less cryptic code)
Changed all immunity obeying commands to allow for self execution - amb633
2007-07-25 18:10:08 +00:00
7c642fbf6e final fix for amb29 - ml issues with pause/stop saving in menu.
Need to sync ml changes before can test; should be good.
2007-07-25 17:28:26 +00:00
a28a80e45f Few additions to fakemeta:
Implemented amb632 - lookup_sequence, also added set_controller (since it dealt with models).

Implemented set_pev_string, for setting with an already allocated string handle.  Also added pev_serial, to get the entity serial number.
2007-07-24 06:05:43 +00:00
2cbf7fca08 Forgot to update SVN with TS3.0 and RegisterHamFromEntity changes 2007-07-19 18:43:27 +00:00
4b02ffa920 Fix for amb519: geoip_code2 and geoip_code3 will overflow the result buffer on an unsuccessful lookup.
Added two replacement natives for those two: geoip_code2_ex and geoip_code3_ex, could not modify the old natives without breaking backwards compatibility.
2007-07-19 18:37:13 +00:00
8316318c31 Fix for amb343 - tfc_clearmodel didn't function as advertised. 2007-07-17 02:18:04 +00:00
7b6d4ce699 Fix for amb503 - csx module not setting meta result when paused. 2007-06-30 05:11:13 +00:00
6f590c85f6 fixed bug where fwrite_blocks crashed the server 2007-06-29 21:46:24 +00:00
f86dad801f compiled against latest components, updated link of mxFlatPack in .dpr, bumped version to 1.77 2007-06-28 12:23:50 +00:00
ee5dccfc0f - added ability for statscfg to use translations (amb28)
- added ML translations for new statscfg lines (amb28, from kwo)
- added miscstats/statsx support for new statscfg lines (amb28, patches from kwo)
2007-06-28 04:25:04 +00:00
16c17cff63 Undid portions of revision 3261: get_{pcvar,cvar}_num discrepancies, the added overhead just wasn't worth how stupidly rare the occurrences were. 2007-06-25 03:23:19 +00:00
ce526ac432 Fixed amb109 - mapsmenu now checks mapcyclefile cvar before reverting to mapcycle.txt 2007-06-22 18:37:38 +00:00
a3342213b5 Added amb427: Additional weapons to dod_{get,set}_user_ammo 2007-06-22 18:25:16 +00:00
ef41393bc3 Fixed amb130 - various menus did not take ADMIN_ALL / ADMIN_ADMIN into account. 2007-06-22 17:47:32 +00:00
a45d98efea Fix for amb421: get_user_weapons omitting a weapon in Day of Defeat. 2007-06-22 17:10:21 +00:00
e23f3747ba Possible fix for amb149 - register_event with "e" triggers false positives for dead players not fully in game. 2007-06-22 16:51:16 +00:00
3f268e5f2e Fixed amb69 - metamod trying to reload amxmodx on systems with poorly configured clocks. 2007-06-22 16:02:17 +00:00
b3e61b1d75 Fix for amb108 - statsx keeping port when saving stats by ip - this should still allow for old stats files to work, but there is a small chance for idiosyncrasies if there are multiple users with the same ip (but different port) saved. 2007-06-22 15:35:46 +00:00
6865b984e0 Fixed accidental reversal of think and touch virtual index under Day of Defeat. 2007-06-22 05:06:49 +00:00
7c4dccac8c Added amb30 - csstats_rankbots will stop bots from showing in /top15 2007-06-21 19:37:58 +00:00
6c0300801f Added amb32 - amxx {cvars,cmds} now takes an optional parameter to filter plugins by plugin filename 2007-06-21 15:26:02 +00:00
069c293aba Fixed amb350 - typo in traceline_set_float 2007-06-21 03:44:36 +00:00
7690f1a099 Fixed the mirror system not working. 2007-06-12 15:59:10 +00:00
add02dc55e Fixed amb365 - EF_SetSize() stock had incorrect params 2007-06-05 02:38:48 +00:00
961114c260 Fix for amb305 - tasks cause a crash on mods that do not have the standard mp_timelimit cvar. 2007-05-28 14:49:34 +00:00
ff3def3d00 Forgot to remove the MAX_MAPS define :o 2007-05-24 18:19:45 +00:00
39f759368f Added show_activity changes to mapsmenu
Made mapsmenu use cellarray natives instead of MAX_MAPS
2007-05-24 18:15:41 +00:00
4cdd43b29b Fixed accidental commit of a language file 2007-05-24 17:16:36 +00:00
0c82e09df1 Added amb42 - different amx_show_activity values. 2007-05-24 17:11:11 +00:00
1129f09660 Added the any tag fix for functions returning any: 2007-05-22 01:29:18 +00:00
079606c143 Added amb311 - mapcycle file now ignores .bsp extension 2007-05-20 15:03:26 +00:00
66feed1d2b Added charsmax() define, as a less typo-prone utility for sizeof(array)-1.
Added any: syntax to all variable args that need it, added proper {Float,_}: tags to some that didn't have it but should have.
2007-05-18 15:20:34 +00:00
65748001f0 Added FCAP_* constants 2007-05-16 16:28:44 +00:00
4504875df9 Fixed Makefile
Fixed a few forwards not having FP_DONE at the end (doh!)
2007-05-16 15:24:14 +00:00
cd023c30d9 Added GPL header to all files.
Item_CanDrop -> {CS,DOD}_Item_CanDrop

Added Ham_CS_Item_GetMaxSpeed

Reversed classname and callback parameters for RegisterHam.

Finished commenting ham_const.inc.
2007-05-16 03:57:18 +00:00
7bb562182f Changed _array_included to _cellarray_included 2007-05-14 22:11:28 +00:00
77ca104a8d Renamed array.inc to cellarray.inc so that rukia doesn't start hagging about it. 2007-05-14 22:10:13 +00:00
b660df8df6 Added {get,set}_pdata_cbase{_safe} - compliments Fakemeta's get_pdata functions, but this will set/get an offset that is a CBaseEntity.
Split constants from hamsandwich.inc into ham_const.inc.

Finished commenting native calls, need to finish the constant comments.
2007-05-13 14:01:13 +00:00
b1a086ee93 Added {get,set}_pdata_cbase{_safe} - compliments Fakemeta's get_pdata functions, but this will set/get an offset that is a CBaseEntity.
Split constants from hamsandwich.inc into ham_const.inc.

Finished commenting native calls, need to finish the constant comments.
2007-05-13 13:59:54 +00:00
504ddb4c2f Expanded ESF entries (they had the Linux binary in a retarded location).
Added vanilla HLDM support.

Fixed a weird crash when compiled in release build for Linux.

Expanded HamFilter error messages a tad.
2007-05-12 17:33:58 +00:00
d38d2f56e1 Fixed large return values (Vectors) in MSVC. 2007-05-12 13:16:05 +00:00
9b0ed67c9c Fixed vtable for TFC and NS 2007-05-11 16:54:26 +00:00
1081e84981 Disassembled the rest of the mods, all but cs are untested currently. 2007-05-11 15:02:25 +00:00
ee64440fef Removed TFC_DBGetItemName because I can't figure out the return value syntax (it doesn't sound like a useful function anyway).
Disassembled DoD for the new virtual functions.

Fixed cs weapon virtual functions.  Oops :o
2007-05-10 17:17:33 +00:00
0c56e2803e Added more virtual functions to the table, only have counter-strike disassembled currently. 2007-05-10 16:08:02 +00:00
5fc89085d6 Added the ability to change parameters on the fly.
Added GetHamReturnStatus()
2007-05-09 14:58:55 +00:00
f747acdc7c Added return type modification / retrieval.
Added HAM_{IGNORED,HANDLED,OVERRIDE,SUPERCEDE} to include file.

Added the ability to disable and re-enable hooks.
2007-05-08 17:26:51 +00:00
4e2493759e Hopefully fixed up HamExecuteB for the last time.
Fixed a small memory leak because I wasn't deleting post forwards at map change.

Hopefully fixed an erroneous display of 'stray' keys.
2007-05-07 13:51:40 +00:00
1f1ecfa590 Added module auto load to hamsammich.
Started the stupid comment crap.
2007-05-05 12:36:12 +00:00
bd2ad31f5e Fixed HamExecuteB and made its system a bit more logical. 2007-05-04 15:42:02 +00:00
fb5e7dbfdb Added unhooking of virtual tables at map change.
Removed some more debugging output.
2007-05-04 14:56:57 +00:00
0ac5ce46a7 Removed legacy code from my search to find the mystical link errors.
Removed some debug output from Trampolines.
2007-05-04 13:07:02 +00:00
1073a42409 Fixed silly link errors in MSVC 2007-05-04 13:05:09 +00:00
66d7d39bee First commit of the rewrite
Doesn't build on windows for some retarded reason
2007-05-04 12:51:13 +00:00
46bd9127fb Removing files for a r3wr1t3 2007-05-04 12:39:53 +00:00
5309189602 Implemented amb245 - precache_sound() now returns whatever the engine function returns instead of just returning 1 2007-05-04 01:38:30 +00:00
006396bc92 Apparently this was a bad idea 2007-05-04 01:17:13 +00:00
dc4c9f0258 Fixed this up or something strange like that... 2007-05-04 01:11:01 +00:00
3b737ab87b added request amb122 2007-05-03 13:27:51 +00:00
6170cbc95a implemented amb92 2007-05-02 23:11:49 +00:00
78f18de61a Fixed bug amb244 2007-05-02 02:06:07 +00:00
e34120803d Implemented request amb242: added cs_get/set_user_hostagekills() natives 2007-05-01 21:38:39 +00:00
fdb094045e Wow, nice typo DS 2007-05-01 21:27:52 +00:00
8c45216cfd Oh, forgot to reset ServerPrint 2007-04-30 18:32:40 +00:00
897ed0cb10 Implemented request amb237 - added ServerPrint to Fakemeta 2007-04-30 18:29:33 +00:00
fd8489d088 Fixed amb116 - DispatchKeyValue didn't work with worldspawn (entity 0) 2007-04-28 16:19:04 +00:00
710cd548a9 added linux support to CS_InternalCmd 2007-04-26 20:07:31 +00:00
525eb65e1c updated linux compiler builds 2007-04-26 20:04:38 +00:00
580e52bd2c CZ Bots will now follow restrictions
Fixed amb222 (rebuy could get around restrictions)
2007-04-26 19:22:23 +00:00
2f6bfca68e added CS hook to catch internal bot commands and rebuy commands for players 2007-04-26 19:21:11 +00:00
0377715cdc added CS hook to catch internal bot commands and rebuy commands for players 2007-04-26 19:18:55 +00:00
e3240214a3 Fixed some typos 2007-04-26 14:20:19 +00:00
fc2b220c38 Fixed amb230 - radius_damage didn't completely kill players on some mods 2007-04-25 18:13:16 +00:00
74c6290dc0 imessage and admin plugins compile again 2007-04-25 17:24:02 +00:00
a93ef02efa Base package builds completely again - DS can't do anything right :| 2007-04-25 16:37:13 +00:00
68d2b03e48 Added amb37, amb38, amb39 and amb205: various cstrike natives.
(Still need to test)
2007-04-25 15:40:15 +00:00
d682375d7d rewrote how new menus are detected -- menucmds are no longer used since they're idiotic anyway 2007-04-25 14:44:37 +00:00
3b80342a02 fixed windows build part 2 2007-04-25 14:15:35 +00:00
8f49cddd7d fixed windows build 2007-04-25 14:15:00 +00:00
d679885985 fixed a memory leak in SortCustom1D() 2007-04-25 14:10:47 +00:00
82c3807bd5 implemented SQL_QuoteString and SQL_QuoteStringFmt
fixed sqlx test script not working on first load
2007-04-25 13:55:56 +00:00
58ad23186b updated compiler builds 2007-04-25 13:48:31 +00:00
c957a9db0f Added SQL_QuoteString to include/tests 2007-04-25 13:45:15 +00:00
359b7e25dd added sql_rewind 2007-04-25 13:19:42 +00:00
5d6d0282b0 Fixed amb110 - socket_change() returned 1 if select() syscall returned -1 (KoST) 2007-04-24 19:17:30 +00:00
33e01af955 Fixed Windows builds of all modules - they were broken as a result of all the moves of svn_version.h *sigh* 2007-04-24 18:50:16 +00:00
0d5531a090 IMessage now supports unlimited messages and uses pcvars 2007-04-24 18:18:45 +00:00
2659c906fb Changed map list to use dynamic arrays 2007-04-24 17:41:56 +00:00
d563ecb060 Added pseudo dynamic array natives.
Changed some of the "..." tags to "any".
2007-04-24 16:38:36 +00:00
bfe1ff6e15 implemented amb27 (SQL_Rewind)
fixed builds
2007-04-24 15:46:33 +00:00
adfc2ab451 fixed mysql msvc7 build 2007-04-24 15:26:08 +00:00
ea912f794c Stole the magical any: tag from sourcemod 2007-04-24 13:36:36 +00:00
8e1f54465d Fixed amb226 - missing return after pfnClientPrintf 2007-04-20 19:02:35 +00:00
2c2259ea15 Fixed possible issue that could arise with the new newmenu last page handler :O 2007-04-20 15:47:55 +00:00
be4fdb1776 Fixed the completely börked handling of the last page with newmenus. 2007-04-20 15:27:04 +00:00
76158b031d Forgot to actually register LookupLangKey :o 2007-04-20 03:02:41 +00:00
599029b68e Fixed an issue where "exit" wasn't working properly on pages with valid next and more selections. 2007-04-20 02:59:35 +00:00
201d65749e Added LookupLangKey for the upcoming show_activity changes. 2007-04-20 02:55:59 +00:00
17d8197e72 Added amb#34 - Plugin cvar/command menus.
Still need to add ML support.
2007-04-18 15:52:03 +00:00
1ed1d0005c Added menu property to change number color 2007-04-18 04:20:48 +00:00
51f8d7f84e Added a more intuitive method for rcon-protecting cvars.
Added SQL cvars to the protected list
2007-04-17 19:03:25 +00:00
1ec4d9cc7d fixed amb18 and various associated menu re-entrancy bugs 2007-04-16 18:00:54 +00:00
b90bc3a3e4 fixed bug amb46 2007-04-16 17:11:40 +00:00
de530e2ca3 fixed amb200, added native test suite 2007-04-16 17:08:15 +00:00
5d4669d52e implemented amb17
expanded menu tests
deprecated MEXIT_NORMAL, MPROP_ORDER, MPROP_PADMENU
fixed various bugs in PagekeyToItem
2007-04-16 06:58:28 +00:00
Zor
8dc310f1bb Fixed error on compile that svn_version.h could not be found in moduleconfig.h 2007-04-15 10:26:55 +00:00
Zor
9cca961024 Fixed error with the dod_client_spawn not being called when the player spawns after a map cap and not being dead 2007-04-15 10:24:45 +00:00
7b4283bf4a Fixed amb207: Last item displayed as "10" instead of "0" on new menus. 2007-04-13 23:59:52 +00:00
1f423dc39f Fixed amb208: new menu state not being reset when item has no state callback. 2007-04-13 23:57:14 +00:00
ab6fea5767 Added amb202: csstats_rankbots in amxx.cfg
Organized comments a bit in all config files.

Added default value comments to all cvars.
2007-04-13 20:21:51 +00:00
3328b570d4 Removed accidental server debug output. 2007-04-13 18:44:39 +00:00
63427b2ad0 Added amb51 - 4 options in amx_vote
Also fixed a potential formatting issue with the vote display.
2007-04-13 18:43:36 +00:00
61052c41a1 added amb64 - amx_voteban auto detects if it should ip ban. 2007-04-13 18:17:24 +00:00
5c68df7ac7 Fixed the damn comments 2007-04-02 18:39:38 +00:00
8872d98dd6 Possible fix for amb86: "USER" key should have been "PLAYER" 2007-03-30 14:33:52 +00:00
03bae80ed2 Addendum to revision 3434; fixed for other mods, although they're not multilingual, just in-case. 2007-03-30 13:35:08 +00:00
1161b5ee7e Fix for amb91: miststats buffer was too small for some language translations.
Not sure if this affects other mods, need to look through their stats stuff.
2007-03-30 13:22:12 +00:00
b49bf1b13c Fix for amb78: get_concmdsnum result caching causing discrepencies 2007-03-30 02:13:49 +00:00
81994ecf58 Fix for access() with ADMIN_ALL
Very minor optimization for is_user_admin

(amb81)
2007-03-30 02:04:30 +00:00
4682cec1cb Documentation fix for amb120 2007-03-30 01:59:57 +00:00
b9a0ffacc4 Fix for amb118: amx_help would not output ADMIN_ADMIN commands 2007-03-30 01:52:10 +00:00
ae46e3f6ab Moved svn_version.h and svn_version.tpl out of SDK directories... 2007-03-27 16:07:28 +00:00
68beb4b1a3 Fixed some minor annoyances with dlsym
- Added missing newline character to "File not found" message
 - Now properly handles relative file paths
2007-03-21 20:24:01 +00:00
118b002ee8 Synced Module SDK files with most recent fixes
- Fixed potential issue with Meta_Query
 - Removed debug message from GiveFnptrsToDll that has been present for a long long time

Again I ask why?
2007-03-21 20:22:20 +00:00
a004e906dd Updated SQLite to 3.3.13 - why? I have no idea 2007-03-21 20:19:37 +00:00
eaa4122c5a Fixed amb107: socket_open doesn't return error by reference 2007-03-19 09:45:45 +00:00
e326ab1593 Fixed amb94 - Name length in amx_psay
I'm never trusting Brad again.
2007-03-18 12:10:36 +00:00
5252e06c2a fixed amb90 (not working in 0th slot, related to commit 2491) 2007-03-16 04:17:47 +00:00
e61809496d Updated modules.versions 2007-03-16 04:16:30 +00:00
edaf960407 Added request amb76 - hex format specifier (%x and %X) 2007-03-14 02:16:09 +00:00
e3217964c4 Fixed core MSVC8 compile :\ 2007-03-14 02:12:51 +00:00
397479cd77 Fixed amb85 - tag mismatch warning on ShowSyncHudMsg 2007-03-13 22:51:12 +00:00
d151ee0b58 Added svn:ignore property to a bunch of stuff 2007-03-13 21:26:04 +00:00
ce88004900 Tiny bit of reorganizing done to WinCSX 2007-03-13 21:10:28 +00:00
1e8d0e10e6 Fixed unused symbol warning 2007-03-13 20:34:38 +00:00
bb641688ee Oops, guess I forgot to fix this path 2007-03-13 20:22:47 +00:00
ab53914351 Massive reorganization attempt - part 2
Moved old/defunct/unofficial modules out of trunk
2007-03-13 19:45:19 +00:00
54186736c8 Massive reorganization attempt - part 1.8 2007-03-13 19:28:24 +00:00
b66fea0fbc Massive reorganization attempt - part 1.77 2007-03-13 19:22:44 +00:00
bf2c9620f3 Massive reorganization attempt - part 1.76 2007-03-13 19:19:33 +00:00
af96229d5d Massive reorganization attempt - part 1.75 2007-03-13 18:44:23 +00:00
be323039d1 Massive reorganization attempt - part 1.5 2007-03-13 11:48:53 +00:00
c71be87a3a Massive reorganization attempt - part 1
Oh dear, what has DS done now?
2007-03-13 11:46:03 +00:00
e4b01bc066 fixed various linux compiling issues... 2007-03-13 04:16:20 +00:00
3ac076e098 Hello, I might have added some SLN files for the MSVC8 projects 2007-03-13 03:11:28 +00:00
e6120fdcd6 fixed a small bug where loading under dlsym crashed
fixed line endings in vim
2007-03-13 00:42:16 +00:00
4dc4616933 added "makeopts" to win32 devenv 2007-03-13 00:29:10 +00:00
46a3929365 excluded svn_version.tpl
if a mod fails to build, it's no longer fatal
2007-03-13 00:21:35 +00:00
4597868d30 wow i forgot core's template 2007-03-12 22:45:57 +00:00
cf716c4049 added tsfun and added a --modules option to the versionchanger script 2007-03-12 22:33:43 +00:00
cc6b9d3d81 added dynamic versioning
committed .sln files to a few wayward projects
2007-03-12 22:27:27 +00:00
a34279b971 fixed a bug in the installer packager 2007-03-12 20:44:29 +00:00
5cac87c99f *sigh* This compiles again 2007-03-11 05:19:54 +00:00
309bc2dcaa Added a special comment inside in_view_cone 2007-03-11 04:55:38 +00:00
7124f8bd2c MSVC didn't like my cdecl placement :( 2007-03-10 18:16:21 +00:00
c9b19c76a5 Added a whole lot more functions that nobody will use 2007-03-10 18:05:30 +00:00
8939c3076a Continued making adding new entries easier
{hs_}register_function->ham_register(HamHook:function,...)

Added a few more hooks

Fixed a few directory errors

Updated config file
2007-03-09 18:15:09 +00:00
71065a65dd attempted merge at 1.77 back into trunk... Oh MY GOD 2007-03-09 03:04:40 +00:00
7adc49c541 changed start page back to original first page 2007-03-08 17:23:36 +00:00
baba221dd9 made my life 1,000 times easier for creating these release builds 2007-03-08 06:20:11 +00:00
829485ef2a bumped version one last time
fixed makefile for nongpl changes
2007-03-08 04:54:03 +00:00
b793b80360 fixed several FTP bugs (thanks bail!) 2007-03-07 20:38:42 +00:00
ea34c2c78a fixed a bug reported by peanut where amx_fwrite() had the wrong sizeof() type 2007-03-07 02:29:54 +00:00
722e97fef2 (hopefully) fixed bug where 0 files+dirs were detected 2007-03-05 21:37:48 +00:00
bd412d7204 Fixed bug amb70 - include files not semicolon-correct
Also, removed OLOcode from amxmisc.inc
2007-03-05 19:30:40 +00:00
39e6d958bf bumped installer version 2007-03-04 06:06:44 +00:00
bb54b37399 removed allow_nongpl, it wasn't really viable 2007-03-04 04:37:42 +00:00
88dd3b021e removed this option 2007-03-04 04:33:29 +00:00
ef4d19378d bumped more versions 2007-03-04 03:43:57 +00:00
7f1ea1490d bumped necessary module versions 2007-03-04 03:42:11 +00:00
041fb4e37f updated compiler builds 2007-03-04 01:46:38 +00:00
193e59df90 updated compiler builds 2007-03-04 01:40:40 +00:00
d4703f045d fixed a bug where '%c' did not correctly count toward the writable string length 2007-03-04 00:02:23 +00:00
109b1e45b5 added non-gpl plugin blocking (wow i can't believe it came to this) 2007-03-03 23:14:24 +00:00
1f1edef98d Merged in NS 3.2 Final offsets 2007-03-01 22:39:57 +00:00
83631e95aa fixed bug amb41 2007-02-24 21:08:00 +00:00
6eb1242600 fixed tags (amb36) 2007-02-24 20:07:21 +00:00
77e7ea161b Fixed half of amb29 - Debug plugins could not be paused/stopped
Waiting on language keys to fix the rest
2007-02-21 21:03:48 +00:00
09f271e5d0 Fixed amb35, multiple plugins loading 2007-02-21 18:42:14 +00:00
e35a8326d5 Fixed an issue where backwards amx mod compatibility layer wasn't transparent. 2007-02-20 22:25:17 +00:00
09d46aa025 Fixed native get_num_ents 2007-02-20 20:57:21 +00:00
615e097c68 Fixed am49892 - Plugin load fails going to error logs instead of normal logs 2007-02-19 08:46:43 +00:00
ade56b62e9 Fixed am50089 - unary - float operator 2007-02-19 08:11:00 +00:00
b3d7f04b5e Fixed am50530 - amx_psay output format fix 2007-02-19 07:34:38 +00:00
4f81c50a3e Fixed am50731 - compiler crash when amxmisc is included before amxmodx 2007-02-19 07:03:26 +00:00
d45c3aeb96 Fixed am51050 - "amxx {pause,unpause" had misleading output 2007-02-19 06:57:26 +00:00
fff603635a Fixed am51051 - unpause() returning true on stopped plugins 2007-02-19 06:43:52 +00:00
06f01ea7dc Wow I deleted the comment too! 2007-02-19 06:38:08 +00:00
2395abcf7e Fixed retarded typo 2007-02-19 06:37:03 +00:00
d33f9ba2d4 Fixed am51083 - Comments in amxmodx.inc 2007-02-19 06:29:02 +00:00
aec28542ac Fixed am51276 - typod "return" 2007-02-19 06:23:34 +00:00
73219c45dd Fixed bug am51368 - Unused variable 2007-02-19 06:16:56 +00:00
39d6cb7840 Fixed #error ignoring #if blocks 2007-02-16 18:49:21 +00:00
bfd4e345dd corrected a typo 2007-02-14 18:55:42 +00:00
aded0f9c1c Added request am49339 - exploding chainsaw gun 2007-02-14 05:17:57 +00:00
811265e28b made it a little safer 2007-02-12 19:35:01 +00:00
0caffa2b82 fixed bug where directories in / couldn't be detected unless your home directory was / 2007-02-12 19:32:32 +00:00
4dfb01bb1d finished ftp browser in the settings dialog (rewrote it, looks pretty nice now imo), various other changes 2007-02-12 18:21:40 +00:00
862ed243be Fixed typo (am51042) 2007-02-10 21:10:55 +00:00
39f1fa6045 Fixed unnecessary call to accessUser() (am51009) 2007-02-09 08:34:33 +00:00
f26939e2cc Fixed bug am50907 - Name and Tag admins were case sensitive 2007-02-09 07:26:37 +00:00
9d53451933 bumped version to 1.76d 2007-02-05 21:21:50 +00:00
4ae54eeb2a fixed am50849 2007-02-05 21:13:15 +00:00
d62ae07b75 Merged in changes from revision 3276 in 1.77: ES_Body was not a valid parameter for get/set_es() 2007-02-01 22:25:18 +00:00
0f22a7fa06 Added missing natives:
- take_damage
- entity_use
- get_num_ents
2007-01-31 20:20:49 +00:00
7f3c2d00ac fixed bug am50501 2007-01-28 05:01:38 +00:00
b324e8ed9d Merged revision 3260 from 1.77; Stats would not display on awkward mp_roundtime settings 2007-01-26 06:15:49 +00:00
8420823713 Merged revision 3251 from 1.77; debug commands not counted as running in amx_plugins 2007-01-26 06:12:25 +00:00
1d1b50ce0c Merged revision 3250 from 1.77; amx_addban is now ADMIN_RCON access by default 2007-01-26 06:11:00 +00:00
35fcca8a66 Merged revision 3258 from 1.77; forward_return with non-string values 2007-01-26 06:08:29 +00:00
7a01503478 Merged revision 3249 from 1.77; fixed typo in tfcconst.in (am50097) 2007-01-26 06:04:11 +00:00
dd8f138892 Back ported revision 3242 - Every include file now is const correct (am49281) 2007-01-26 05:56:10 +00:00
8341e41f04 Fixed TE_GLOWSPRITE (vittu) & TE_PLAYERSPRITES examples 2007-01-18 00:18:31 +00:00
a682ec6b7a Fixed TE_DLIGHT example Valve mistake! (P34nut) 2007-01-17 18:16:17 +00:00
451b648c7f Fixed TR_InOpen missing with *et_tr native (XxAvalanchexX) 2007-01-17 14:52:09 +00:00
2d1c43c937 Merged in changes to report 49977 2007-01-17 06:56:52 +00:00
17adb214f2 Fixed bug am49982 (wrote parameter counts) 2007-01-17 05:32:45 +00:00
3a2839c6c9 bugfix for 49698 2007-01-15 15:56:48 +00:00
f96f95c4ff translated shortcuts into english :x 2007-01-15 15:53:14 +00:00
609fdae508 Fixed native get_user_origin mode 4 2007-01-09 15:01:08 +00:00
580305ce92 fixed am49041 (hopefully) 2007-01-02 13:23:23 +00:00
cbfd12e0f1 fixed am49040 2007-01-02 13:17:33 +00:00
c5ccf7d2c8 fixed am48881 2007-01-02 13:04:56 +00:00
Zor
d1c42751cd - Fix in need of testing in regards to the TK / TA bug detected
- Created a temp pointer as the first thing to do in the CurWpn function.  This way if another message gets thrown while still in the middle of this function the global pointer to messaged player is not affected.
2006-12-29 19:25:16 +00:00
68f1ce7a52 fixed an initialization bug 2006-12-23 22:05:51 +00:00
e5b0ed3af1 fixed bug am48866 part 2 2006-12-23 19:01:11 +00:00
49e70063fa fixed bug am48866 2006-12-23 18:59:30 +00:00
7aa4cf70be removed amd64 support from installer (and yep, installer's version is already up-to-date ;] ) 2006-12-19 19:50:20 +00:00
b661873426 removed amd64 crap 2006-12-19 14:34:41 +00:00
8e290cdf31 final build info 2006-12-19 14:26:31 +00:00
42f23a832a bumped version number for plugins 2006-12-19 14:24:01 +00:00
13e619bf97 bumped versions 2006-12-19 14:18:05 +00:00
4332d6c271 fixed bug am47617 2006-12-19 14:03:02 +00:00
627b3f0f98 Fixed bug 48522 2006-12-19 12:24:36 +00:00
b7b55d060a sawce's sdk fixes 2006-12-19 11:19:45 +00:00
b110021f4f fixed bug am48308 2006-12-19 11:12:12 +00:00
96c49f4ff9 defaulted value back to 0 for backwards compat 2006-12-19 11:03:00 +00:00
f53c877670 fixed bug am27152 2006-12-19 10:57:43 +00:00
b237317e50 Fixed bug am48018 2006-12-19 10:36:26 +00:00
73b2ceb855 fixed bug am47988 2006-12-19 03:32:58 +00:00
b64fb4678d fixed issue 48202 2006-12-19 02:35:16 +00:00
d6ed1a8d8a Fixed bug am48234 2006-12-19 02:24:09 +00:00
b762174c30 fixed bug am48275 2006-12-19 02:02:49 +00:00
86838bead1 Fixed bug am48294 2006-12-19 01:58:46 +00:00
e6c15d9f05 Fixed bug am48580 2006-12-19 01:57:18 +00:00
266ed797c5 Fixed bug at48523 2006-12-18 14:33:06 +00:00
93cb2060dd fixed typo 2006-12-11 04:07:55 +00:00
0cd1782d01 fixed bug at48369 once and for all 2006-12-10 22:58:28 +00:00
75a5dadd4d small bug fix, compressed exe again :x 2006-12-10 22:37:01 +00:00
f03449acbd fixed 3rd bug at48369 2006-12-10 22:32:49 +00:00
34f127b9aa fixed 2nd bug at48369 2006-12-10 22:25:09 +00:00
0c345ceebc fixed bug at48201 2006-12-09 18:23:52 +00:00
c5dc780635 correction since commit 3164 was accidental 2006-12-06 08:46:44 +00:00
fe0e461c76 checks if the none option is the majority vote 2006-12-06 07:41:38 +00:00
935da9f0de version bump? >:o 2006-12-05 19:31:22 +00:00
36e9f29d55 2006-12-03 02:20:32 +00:00
c66c076a03 fixed bug at47865 2006-11-28 20:04:04 +00:00
4eaea443e1 who would have thought that iterators change?! 2006-11-22 07:33:54 +00:00
299f1b5f62 Fixed bug am46960 (cannot unpause through menu) 2006-11-22 06:14:10 +00:00
4e7bf7e348 ! 2006-11-22 05:39:08 +00:00
d048996b50 fixed bug am47194 (journal crash) 2006-11-22 05:30:58 +00:00
a34c8daf34 again... oops 2006-11-22 04:17:08 +00:00
6cd5a51c8e fixed issue am47452 2006-11-22 04:14:56 +00:00
5cabf748ca fixed issue am47474 2006-11-22 04:13:39 +00:00
1905ea7295 added info about console commands 2006-11-22 02:47:15 +00:00
89158f9342 Added request am47144 (register_*cmd return id) 2006-11-22 02:45:12 +00:00
db7dc509e0 Fixed another serious bug where deleting menus and not returning PLUGIN_HANDLED would cause the iterator to fail and crash 2006-11-21 23:59:21 +00:00
c15a23a2a7 fixed a serious bug where deleted forwards could be placed in the re-use cache too soon 2006-11-21 23:06:50 +00:00
3e0866e57a fixed bug am47134 2006-11-11 19:05:46 +00:00
551e5298cc fixed bug am46924 2006-11-05 18:38:09 +00:00
dfea3e8a13 corrected typo (at46807) 2006-11-03 13:27:17 +00:00
e8a30e7187 bumped version 2006-11-01 00:33:30 +00:00
8a93673276 2006-10-31 22:53:29 +00:00
ece4db4f43 oh no, new version number 2006-10-31 20:37:43 +00:00
8b8cc3dd6b Fixed bug am46630: rename_file did not have a relative location version 2006-10-31 20:18:44 +00:00
b33e76d9c4 Fixed bug am46559 2006-10-31 19:48:47 +00:00
6fb6d7d399 Fixed bug am46699 - dod stats.sma did not show multi-lingual menus correctly 2006-10-31 19:42:34 +00:00
5649a17502 fixed silly translation bug 2006-10-31 19:38:30 +00:00
5cfc2df359 fixed potential in-game bug 2006-10-31 19:36:47 +00:00
1ac390b54c Fixed version # 2006-10-31 19:31:54 +00:00
102c2b219f Fixed bug am46336 - could not compile TraceLn 2006-10-27 05:53:09 +00:00
4e1d420495 added AMX_ERR_GENERAL to the error list 2006-10-27 05:49:34 +00:00
e93e75fa39 Bumped version numbers 2006-10-27 05:47:38 +00:00
90c213bc6d fixed querying invalid players 2006-10-27 05:41:04 +00:00
6c3e7e7ee0 removed another get_players("ae") 2006-10-27 05:40:09 +00:00
8a2528108d Fixed bug am46378 2006-10-25 16:54:37 +00:00
a65d65bee4 fix for bug am46266: TFC team names not picking up 2006-10-24 22:57:19 +00:00
483403aa3a Fixed bug am46335 - text spacing not aligned in adminchat 2006-10-24 22:30:15 +00:00
2a1dbf5247 Fixed bug am46350 2006-10-24 17:13:02 +00:00
7aa687eb69 Attempted a patch for am46340 2006-10-24 17:09:28 +00:00
699cb2a6d6 fixed bug at45677 2006-10-22 19:15:36 +00:00
7b82bc7b76 several bug fixes in the auto-update system, bumped version to 1.4.3 final and improved code snippets feature (can now append or insert snippet into new line) 2006-10-22 18:56:39 +00:00
ed43b8a5ac Changed to use CreateMultiForwardEx() instead 2006-10-22 03:52:02 +00:00
d2ebca38a1 Experimental addition to CreateMultiForward() for bcompat 2006-10-22 03:49:23 +00:00
d542015214 Fixed bug am46112 2006-10-22 00:45:33 +00:00
d84c3a3798 Fixed bug am46058, unpausing stopped plugins 2006-10-21 21:48:24 +00:00
405d9ff48e bumped trunk version 2006-10-21 21:27:07 +00:00
a63c728471 added two new tests to the menu test suite 2006-10-21 21:13:57 +00:00
a60e9d205b fixed bug where blanks misaligned the item selection process 2006-10-21 21:13:39 +00:00
553a950b98 added comment :( yes we broke backwards compat 2006-10-21 20:20:44 +00:00
955e827b19 Fixed bug am45492 (stats always resetting) 2006-10-21 19:23:16 +00:00
00380cfe4c fixed a bug in get_func_id (thanks P34CH_34732) 2006-10-02 06:12:02 +00:00
12ecf026db hack for backwards compat layer (thanks suicid3) 2006-10-02 06:07:38 +00:00
3fa6cd3227 added a timeout test which does not work, thanks MySQL 2006-10-01 19:59:27 +00:00
fe1ebfe7bb fix for 45337 and some other little things 2006-10-01 19:46:56 +00:00
f3057efd7d updated the test suite 2006-10-01 18:36:15 +00:00
39d5ea94fb Added extra param to is_in_viewcone to switch between a 2D and 3D calculation
Neither is still as accurate as I want them to be though :\
2006-10-01 06:08:39 +00:00
90f11b52bc Fixed am45318 - Some wrong constants from TraceResult enum 2006-10-01 02:39:59 +00:00
9740f6469d this feature is just for sawce (updated go to line dialog) 2006-09-30 19:03:49 +00:00
461e7de151 fixed bug at45362 2006-09-30 18:49:28 +00:00
c2695a8cd8 updated version # 2006-09-26 00:25:01 +00:00
5ded9eef2a Bumped version numbers to 1.76a 2006-09-25 23:48:07 +00:00
44617778c7 Fixed bug am40911 (round kill stats persisting for spectators) 2006-09-25 23:04:33 +00:00
647d226764 synchronized more hud messages as per am45020 2006-09-25 17:34:33 +00:00
f086273d2b Attempt at accuracy improvement for is_in_viewcone with 3D calculation (am44838) 2006-09-22 15:11:51 +00:00
afde57b27e fixed bug am45088 (studio icon left on desktop after uninstall) 2006-09-22 14:49:04 +00:00
c4453a9593 fixed tense error in English 2006-09-22 14:46:38 +00:00
020b3a5963 test fix for bug am44973 (knife headshots) 2006-09-22 03:47:04 +00:00
3720810b61 fixed bug am44694 (is_user_alive() on TFC connect failing) 2006-09-21 23:33:05 +00:00
98e20e0fc7 Fixed translation errors from am45015 2006-09-21 17:43:16 +00:00
e72aff5c14 Fixed bug am44956 (extra plugin file lists not working) 2006-09-21 17:18:04 +00:00
63bc8885c9 committed fix for bug am45017 (phrase not translated) 2006-09-21 17:01:21 +00:00
ff8fd747c5 Fixed bug am44964 (thread crash on bad database) 2006-09-21 16:54:14 +00:00
98278b7bb5 small bug fix, bumped version to 1.76a 2006-09-20 15:12:49 +00:00
09df281556 Fixed am44998 2006-09-20 02:50:58 +00:00
4cc460cfbe component update, fixed small bug 2006-09-17 10:57:30 +00:00
947cb5f79d component update, fixed metamod plugins.ini bug once and for all 2006-09-16 23:26:24 +00:00
73386b12c5 added silent backwards compatibility for a broken plugin 2006-09-16 00:16:13 +00:00
57160763af Fixed threaded queries not having an IQuery assignment 2006-09-15 23:11:35 +00:00
1f0778b14e Fixed threader not checking the state on looping 2006-09-15 21:39:20 +00:00
3c923170a9 whoa, forgot a SEMICOLON 2006-09-14 08:06:08 +00:00
09beb4b81e Fixed bug am44776 2006-09-14 08:00:55 +00:00
f48aea7a72 Merged in rebuilds of compiler for latest changes 2006-09-14 07:45:54 +00:00
63ad5727ef this SHOULD fix the ftp bug 2006-09-13 21:11:53 +00:00
61525e9638 fix for getFuncsNum() on invalid forward 2006-09-13 19:46:32 +00:00
918e1c3195 Better, but still not perfect. :( 2006-09-13 13:44:37 +00:00
6e56aed778 More tiny bcompat stuff. admincmd is now source compatible at least 2006-09-13 10:58:47 +00:00
87c3e1dc82 attempt for bug am44778 - plugin_log() did not function in logevents properly 2006-09-13 06:36:59 +00:00
d925dc6e41 bugfix: correct string length computation in replace_all 2006-09-12 13:26:40 +00:00
651c5d9f01 added more api to help with amxmod compat layer
cleaned up some more bcompat stuff
2006-09-12 07:59:56 +00:00
4f8917ec44 experimental hack fix for code generation bug 2006-09-12 07:42:15 +00:00
1c265733e1 small fix 2006-09-11 16:56:25 +00:00
14a068532f this should fix the bug where metamod's plugins.ini is being overwritten even if it already contains an entry of amxx's mm dll 2006-09-11 16:53:26 +00:00
3c379469d5 added get_cmdaccess() 2006-09-10 22:16:04 +00:00
2df8b4269e fixed bcompat trans + optimized it a bit
added bcompat trans support to format() and copy()
2006-09-10 22:08:52 +00:00
3d74b7cf09 this should have been disabled by default 2006-09-10 18:20:51 +00:00
47e2214f09 Synced MSVC8 project for engine 2006-09-10 16:47:49 +00:00
4413e54058 LogType checking is not necessary, LogError is always type 1 2006-09-10 12:07:01 +00:00
14aff9b19b added simple access level wrappers (Obbin) 2006-09-10 10:14:58 +00:00
38cb94050e updated for latest source tree 2006-09-10 09:25:27 +00:00
c294b91ca4 fixed up module support 2006-09-10 09:21:09 +00:00
d95f794844 rewrote replace_all()
added replace_all() tests
2006-09-10 08:15:00 +00:00
3754604686 Fixed a serious bug in replace_all() that could make replaces fail or corrupt random data 2006-09-10 07:23:08 +00:00
4bd356079c testsuite now included 2006-09-10 06:46:06 +00:00
c67e19a62f updated credits + look for 1.76 2006-09-10 06:35:54 +00:00
96c29d5376 merged linux build of latest compiler 2006-09-10 06:35:19 +00:00
65eb0279b2 merged in compiler change for amxmod_compat 2006-09-10 06:33:55 +00:00
c287985a66 fixed up build process 2006-09-10 06:29:22 +00:00
1b9ef4d268 2006-09-10 05:16:26 +00:00
02fb807a0b Added request am44517 (jRaven, spectator team) 2006-09-10 05:13:03 +00:00
f880fc6ee9 added request am44229 - more error log info 2006-09-10 04:52:43 +00:00
f6f6bcc356 added a note to hostage natives for CZ 2006-09-10 04:36:44 +00:00
4f95899d2e Added request am44580 (simple query w/ formatting) 2006-09-10 03:46:35 +00:00
adf12bf348 potential fix for am44179 (array is too small) 2006-09-10 03:32:46 +00:00
c7febb4447 fix for issue am44593 2006-09-10 03:01:21 +00:00
77e4d85002 fixed up a callfunc issue and added copyback parameter 2006-09-10 02:30:10 +00:00
418efa4088 fixed bug am44544 (log forward broken) 2006-09-10 01:08:29 +00:00
4599b59834 corrected issue am44595 2006-09-10 00:51:35 +00:00
751e8e6299 Might as well update this too while I'm at it (Kugatsu, Septiembre, September!) 2006-09-09 20:27:09 +00:00
4eb8c4e295 Synced this or something... 2006-09-09 20:21:29 +00:00
5a4b1d2f03 Fixed some GCC warnings for Werror 2006-09-09 20:12:50 +00:00
b5498818a3 updated the GEOIP API 2006-09-09 11:41:48 +00:00
5286672268 finalizing rc3 builds 2006-09-09 03:29:13 +00:00
8df33abd70 initial import of the bcompat plugins (userland layer) 2006-09-08 14:49:54 +00:00
38e7b9ff58 unbroke the build 2006-09-08 14:46:34 +00:00
621c120b71 finished merging in the glorious bcompat changes 2006-09-08 14:11:29 +00:00
c9c2943c05 MySQL and SQLite can actually use 4.1 here... Also libstdc++ == ugh 2006-09-04 08:28:08 +00:00
ed5395a54a AMD64 building fixes and such 2006-09-03 03:48:54 +00:00
557958b408 Removed some amxmod compat stuff for now so this can actually compile and link properly again 2006-09-03 02:39:13 +00:00
2905217607 Fixed this o_O 2006-09-02 08:08:05 +00:00
78956f3d89 merged bcompat changed into trunk
removed amxmod compat files for now
2006-09-01 03:29:27 +00:00
95537e4840 fix for issues where bots might not 'cache' properly? 2006-09-01 02:22:47 +00:00
35a96176fa Fixed bug am43881: hideslots not working on first map 2006-09-01 01:40:37 +00:00
6a28bc602a Request am43716 - moved IVecFVec and FVecIVec around 2006-09-01 01:34:43 +00:00
72f59422d5 turns out this isn't even needed 2006-08-28 22:08:20 +00:00
cba554d193 fixed this up for gcc-3.4 and no lstdc++.a 2006-08-28 21:21:06 +00:00
76a4d84dbb Fixed this up to work, eh. no more libstdc++.a for you 2006-08-28 21:03:27 +00:00
ec83efbdf3 These did not sync to trunk properly (SDK fix and some updates) 2006-08-28 19:29:20 +00:00
9bd22661ff Added SQL_GetInsertId() 2006-08-28 19:17:26 +00:00
baf406cb6a Fixed bug with floatatan() returning wrong values when trying to get angle in degrees or grades 2006-08-28 17:37:15 +00:00
388711e969 Synced bcompat tree additions and fixes found so far 2006-08-28 11:08:18 +00:00
cb01ff1dc3 Fixed two minor annoyances
1) Paths in config file are now checked before building is attempted (prevents some potential crashes)
2) The compression routines can now handle spaces in the 'output' path
2006-08-28 03:27:16 +00:00
5c23cf416e Fixed makefiles (yes, again) for hlsdk move 2006-08-27 05:29:04 +00:00
b8b3107210 Moved hlsdk out of trunk 2006-08-27 05:14:59 +00:00
2cd1449f88 Ugh, part 2 2006-08-27 05:01:32 +00:00
3691e98814 Ugh, should not have removed that 2006-08-27 04:56:27 +00:00
709b3705ab Fixed warnings that only appeared when compiling amd64 binaries 2006-08-27 04:50:20 +00:00
22bef17660 Changed makefiles to point to trunk's modified version of the HL SDK 2006-08-27 03:13:11 +00:00
b4767cb99e fixed amxxpc builds 2006-08-27 02:34:03 +00:00
30235e05e5 Moved modified HL SDK to trunk 2006-08-27 02:22:59 +00:00
28c4ea4fec Removed odd debug message 2006-08-27 02:21:27 +00:00
58e1254876 oops 2006-08-27 02:18:08 +00:00
81ac41037b GCC Wallification 2006-08-27 02:17:18 +00:00
6786b0e356 Fixed bug am43875 2006-08-27 01:38:47 +00:00
af5a7f5434 fixed am43858 (beta report) 2006-08-25 22:06:59 +00:00
cd6f3dfd71 Updated SDK for GCC-4.1 2006-08-25 00:53:37 +00:00
a7fcf76244 fixed up for gcc-4.1 2006-08-25 00:28:36 +00:00
3878c7492a fixed these for gcc-4.1 2006-08-25 00:26:51 +00:00
4981f46c41 Forgot to sync this 2006-08-24 22:58:48 +00:00
ee4f064073 Initial bump to GCC-4.1 2006-08-24 22:44:57 +00:00
a42a5f1a0e updated for latest build tree 2006-08-24 21:42:25 +00:00
bab5bb5a72 Attempt to fix up am41036 2006-08-24 21:13:52 +00:00
58abc3a655 Request am28110 - Added tfc_get_user_goalitem native to determine if player is carrying a goal item (such as a flag or keycard) 2006-08-22 21:50:27 +00:00
0cb316c764 Removed amd64 stuff from makefiles for projects that don't need it 2006-08-21 15:32:07 +00:00
74d3d23f13 Added tfc_get/setweaponammo to set ammo in weapon's clip (not backpack ammo) 2006-08-21 13:50:51 +00:00
5b47da7cee Finalized binlogging update by removing another unnecessary opcode and updating the reader 2006-08-21 04:18:13 +00:00
45b67b6e2c more tweaks to binlogs 2006-08-21 03:46:20 +00:00
44a17fe646 documented new file format
increased file version
2006-08-21 03:11:19 +00:00
d21a352167 expanded comment for get_players() 2006-08-21 03:07:25 +00:00
4fc2c9cebb fixed bug am41259 2006-08-21 02:08:01 +00:00
4692335abb bumped version 2006-08-21 02:01:57 +00:00
4e639d09de Added sorting.inc to the installer package 2006-08-21 01:55:34 +00:00
deefc504e1 Added request am29544 (nvault_touch) 2006-08-20 21:23:38 +00:00
ea262171db fixed bug am42321 2006-08-20 21:19:50 +00:00
e49af85119 Fixed bugizzle am43566 2006-08-20 21:01:35 +00:00
dec169562b missed the FP_DONE's 2006-08-20 17:57:00 +00:00
0acaf1b476 MSVC8 sync 2006-08-20 11:18:31 +00:00
2cf396be3e weird typo 2006-08-20 08:00:55 +00:00
df7ee94b83 Committed sorting natives as per request am23838 2006-08-20 04:46:34 +00:00
afe7df87d2 Added request am40169 2006-08-20 00:20:47 +00:00
c80b7fd422 updated this 2006-08-19 23:23:30 +00:00
adad1384ff now it compiles 2006-08-19 23:18:11 +00:00
fb0d728720 optimized a stock and created message_stocks.inc (am29627) 2006-08-19 23:02:01 +00:00
a1e8701236 added request at40243 2006-08-19 22:33:02 +00:00
df5c6ccb95 added format test 2006-08-19 22:23:45 +00:00
8a58dd8806 this is a bit more standards compliant 2006-08-19 22:21:42 +00:00
67f53505ce Added request am41635 and fixed a bug with passing (1<<31) 2006-08-19 22:15:34 +00:00
e7cc87a610 now yes 2006-08-19 20:21:00 +00:00
b572cdff2f Updated SQLX test suite for plugin_end() bug 2006-08-19 19:39:57 +00:00
446d4b8a5d Synced threading changes between MySQLX and Sqlite 2006-08-19 19:37:45 +00:00
db5c9c114e Queries in plugin_end() now resolve correctly. 2006-08-19 19:29:33 +00:00
408f61c6d6 Added request am42871:file names in binlogs 2006-08-19 18:44:12 +00:00
042b9f7f4b Fixed bug am42307 (nvault_open did not return -1 on failure) 2006-08-18 22:46:07 +00:00
a8b4ebbe70 Fixed bug am42097 (FM disabling hooks too early) 2006-08-18 22:17:51 +00:00
ed0312567d Fixed bug am42213 2006-08-18 20:53:31 +00:00
e80679afd0 Fixed bug am42213 2006-08-18 20:52:49 +00:00
9093a178f1 Fixed bug am41900 (command name too long) 2006-08-18 20:31:23 +00:00
4fe8c71d62 Added request am41375 (animation toggling on silenced weapons) 2006-08-18 20:12:20 +00:00
f5414ff8de Fixed issues with stats.dat files loading (bug am41030) 2006-08-18 19:49:32 +00:00
f3a833dd1b more warning fixes 2006-08-18 19:08:51 +00:00
e2932fb61a Request am40967 (logging set_fail_state) 2006-08-18 19:02:37 +00:00
43bd5fc732 removed unused stuff 2006-08-18 14:02:07 +00:00
377c01eac7 just a little detail 2006-08-18 13:23:02 +00:00
7af82f0d4f n0thing 2006-08-18 13:05:09 +00:00
010ef526c5 added amxx_setpl_curweap to export table 2006-08-18 06:05:57 +00:00
659448ce29 clarified the API 2006-08-18 06:00:26 +00:00
d7d0d72ceb fixed a serious bug with byref values and callfunc_push*() where the heap was used incorrectly, causing passed data to be easily corrupted.
added callfunc_push_array() (am42810)
2006-08-18 05:52:21 +00:00
79f8525c4a bumped version number 2006-08-18 03:34:03 +00:00
2869c8f4f6 Fixed bug at43313 2006-08-18 03:33:46 +00:00
b7076fc572 Committed implementation of request am42697 2006-08-18 02:19:38 +00:00
f7691a51c6 Added request am43012: per-map plugin files 2006-08-17 19:34:34 +00:00
5524d5dca1 Added the ability to mark plugins as "disabled." This blocks the plugin from loading in other files.
Fixed a bug where the PCALM cache was invalidated on file read, rather than plugin finalization.
2006-08-17 18:25:23 +00:00
e015df58c8 More GCC compatibility fixes 2006-08-17 16:43:47 +00:00
db175082ad Fixed some bugs/warnings that GCC caught 2006-08-17 16:41:41 +00:00
8b055fd1d0 Added GCC-4.1 support
Disabled potentially bad optimization
2006-08-17 01:39:47 +00:00
6295813723 Work-around for a code generation bug in GCC 2006-08-17 00:23:03 +00:00
a03cd1385d clarified this 2006-08-15 20:21:25 +00:00
1b065c6f36 bug fixes, bumped version to 1.4.3 and advanced auto-indenter a bit 2006-08-02 08:43:24 +00:00
e0115ba2dc final version (I hope) 2006-08-01 17:26:14 +00:00
4306c4f5b6 Fixed am42013
TFC plmenu - team menu didn't allow changing from blue team
All plmenu - Team change message was always in language of the admin that changed the player
2006-07-26 00:53:45 +00:00
3b62b91fb7 Fixed bug am41961 (Orangutanz)
GetPlayerAuthId, GetPlayerWONId, and IsMapValid were not being reset on mapchange
2006-07-24 16:15:09 +00:00
32b1149716 bumped version number to 1.76, zomg! 2006-07-23 01:04:39 +00:00
f92017516f few changes, little bug fix for ESF (again) 2006-07-22 11:46:43 +00:00
8837c52d81 fixed case-sensitivity bug and another typo that prevented the installer from asking for the ESF add-on when installing amxx on the listen server
tiny optimization, fixed bug at41769
2006-07-22 01:11:38 +00:00
6ab3c50813 tiny optimization, fixed bug at41769 2006-07-22 01:08:36 +00:00
0c06cdca36 fixed case-sensitivity bug and another typo that prevented the installer from asking for the ESF add-on when installing amxx on the listen server 2006-07-22 01:06:32 +00:00
ce59ee0362 Partially fixed am41769 (some missing ESF files) 2006-07-21 07:20:52 +00:00
c2d2e8aef5 Fixed issue am41768 (wrong plugin name) 2006-07-21 06:45:37 +00:00
9780a6c36f Fixed issue am41777 (missing time.txt) 2006-07-21 06:43:45 +00:00
1a6f4e08b2 Added request am41585 (Orangutanz) 2006-07-19 04:23:00 +00:00
49f46a5f4c Fixed wrong team names in TFC plmenu am41563 2006-07-18 20:18:23 +00:00
51ee2e4846 this line doesn't look necessary 2006-07-18 09:59:36 +00:00
928091864f Added request am41367 (devcones) 2006-07-18 09:20:57 +00:00
fab4a43915 Fix for am41317, forward re-entrancy problem 2006-07-18 04:39:54 +00:00
b44951295d I forgot to remove you didn't I am41542 2006-07-17 23:11:57 +00:00
db3beb9b98 Various pev issues fixed am41542 2006-07-17 20:01:11 +00:00
2dc3f2bec9 fixed bug at41483 2006-07-17 12:42:59 +00:00
6ac889f6e2 fixed bug at40963 2006-07-16 13:23:56 +00:00
87ac42cd98 fixed makefile for changes 2006-07-16 07:24:35 +00:00
f64d2366e9 added 2 memfile files 2006-07-16 02:27:51 +00:00
34d71eb4dc built latest compiler 2006-07-16 02:26:58 +00:00
fb2e0c5f6c compiler is fast now 2006-07-16 02:25:32 +00:00
65513c6037 bumped version 2006-07-16 02:22:38 +00:00
b859001feb Fixed path to Pawn include file in MSVC projects (Fun module) 2006-07-13 03:22:30 +00:00
895039308f Added CZ models to CsInternalModel enum (request at41295) 2006-07-13 03:07:24 +00:00
43b8ea4657 deleted outdated or unneeded dirs in dlls 2006-07-12 18:25:41 +00:00
0eca298c2a Fixed makefile paths (I think) 2006-07-12 06:05:06 +00:00
8d4f28ac62 a typo_O 2006-07-09 19:10:08 +00:00
57ccee89f2 bump3d v3rsion 2006-07-04 17:37:49 +00:00
4b649469b0 underlined "FTP" in FTP install page
bumped version number to 1.75a
2006-07-04 17:36:41 +00:00
f1d3274f0e fixed bug at40706 (angle_vector) 2006-07-02 15:24:00 +00:00
0c668753fb fixed bug where indenter unindented the entire code
menu generator: now checks for bad menu keys (simple menu, old style)
2006-06-30 21:25:26 +00:00
2edbf72391 fixed bug where indenter unindented the entire code 2006-06-30 21:23:26 +00:00
e1caa575e7 now checks for bad menu keys (simple menu, old style) 2006-06-30 21:22:46 +00:00
9dcdba439a added fix for binlog bug with failed plugins
added experimental emsg natives
fixed target's velbyaim bug find
added native for setting player curweapon
2006-06-28 10:07:20 +00:00
d3af14c957 experimental emsg natives 2006-06-28 10:01:55 +00:00
f08bbbc45f dep recompile 2006-06-28 02:31:07 +00:00
99a2b54530 fixed small bug in the documents bar 2006-06-15 00:43:09 +00:00
6f20664140 Wow 2006-06-12 21:08:29 +00:00
06fbff7042 fixed floattocell bug, omg 2006-06-12 17:37:09 +00:00
bb609123fb Fixed comment next to zoom type enum 2006-06-12 10:08:54 +00:00
d832eb8fef fixed this up 2006-06-12 08:20:35 +00:00
fd67b07530 whoa, changes from twisty-san 2006-06-12 06:14:35 +00:00
c0396bf140 updated for another test 2006-06-12 06:12:46 +00:00
d55542aa8d fourth time's a charm 2006-06-11 22:04:10 +00:00
2e86f51cfe fixed this 2006-06-11 21:50:19 +00:00
Zor
84ec8ef007 - Added new forwards as well as new stocks 2006-06-11 21:47:11 +00:00
07e55f3b71 whoa 2006-06-11 09:01:30 +00:00
50311d14fb fixed bug at31100 (belsebub) 2006-06-11 08:58:15 +00:00
1088b209d9 added belsebub's test 2006-06-11 08:57:39 +00:00
63ec26f8c0 committed menu tester 2006-06-11 07:59:07 +00:00
07b5a819bf fixed more amx_ftoc errors that wouldn't occur in modules 2006-06-11 07:32:18 +00:00
8e03e67a8f fixed a menu exit calculation bug in newmenus (omg) 2006-06-10 22:12:46 +00:00
66d04f8def fixed another possible amx_ftoc() misusage 2006-06-10 21:00:33 +00:00
bce69e7116 fixed pcvar bug (thanks niluje) 2006-06-10 20:57:52 +00:00
d4bfddc034 added 2 new natives 2006-06-10 20:46:12 +00:00
373d25b0ce Removed some unnecessary code at31046 2006-06-10 14:38:04 +00:00
deb1b00416 synced fix 2006-06-10 01:34:27 +00:00
6b80e9e8d2 fixed a silly row bug 2006-06-09 08:47:52 +00:00
a19b00fd2f moved some hud messages to avoid more overlapping 2006-06-07 23:22:43 +00:00
8f2c9e9452 moved up imessage a bit 2006-06-07 23:11:45 +00:00
5463a84c12 fixed another stupid path bug
fixed more module loading bugs
2006-06-07 19:09:48 +00:00
68e1937a5c got rid of debug msg 2006-06-07 06:28:32 +00:00
d05c34b73c fixed a bug causing failed modules to register as successes. this also blocked handlers from being called. 2006-06-07 05:21:03 +00:00
c69777d8cc fixed stupid path bugs! 2006-06-07 04:44:03 +00:00
b3b9e72b01 fixed another newmenu calc bug 2006-06-06 17:59:38 +00:00
7f57e8377a oh, compiles now 2006-06-06 10:49:33 +00:00
036ab78828 added plugin semi-auto-loading shut it 2006-06-06 09:03:07 +00:00
e0f1a93d6e fixed a bug where an empty modules file would crash
fixed a bug where newmenu with default exit and a single page would not return MENU_EXIT on exit
2006-06-06 07:00:27 +00:00
eba189e2b9 fixed erroneous error message 2006-06-06 00:29:05 +00:00
5748ed84a2 oh, updated 2006-06-05 23:28:28 +00:00
9eb0d50f4c yams 2006-06-05 23:22:57 +00:00
24c5c10a31 oh, hello 2006-06-05 23:22:45 +00:00
c91f712363 some bugfixes and changes for the ftp panel 2006-06-05 23:20:59 +00:00
f6c9263940 Argh, did it again didn't I 2006-06-05 22:33:22 +00:00
ba87258a3d Added admin indentifier (red asterisk) to all menus that contain a user list at30358 2006-06-05 22:32:00 +00:00
011c9fa45c fixed "ghost module" problem 2006-06-05 19:19:43 +00:00
2c7ca33bf1 fixed a bug where HandleModule() took the mangled name instead of the demangled 2006-06-05 19:08:01 +00:00
2ece53fa38 fixed a bug where plmenu autoloaded cstrike 2006-06-05 19:07:19 +00:00
36ec7bc818 fixed a very minor parsing bug in plugins.ini 2006-06-05 18:48:01 +00:00
b4450bbee5 synced this change 2006-06-05 18:43:01 +00:00
c92145ee88 backwards compat fixes -
dbi_close() must return 0 on failure (not that it matters)
dbi_nextrow() must return 0 on RESULT_NONE
2006-06-05 08:21:28 +00:00
3fbf65103a fixed a crash bug 2006-06-05 08:06:57 +00:00
e7858b4cd7 Oops, guess I forgot this one 2006-06-05 07:52:21 +00:00
ad495cef13 Updated for vector.inc 2006-06-05 07:50:42 +00:00
17fb06f7bb Moved vector natives from engine to core at29896
Moved precache_generic from engine to core at30469
2006-06-05 07:48:54 +00:00
7d3ddf502c Synced MSVC8 project file 2006-06-05 05:29:26 +00:00
5940b4a6ca MSVC8 warning fix 2006-06-05 05:24:59 +00:00
9edf20866b Synced MSVC8 project file 2006-06-05 05:18:27 +00:00
30495aa34e Linking to zlib isn't necessary 2006-06-05 05:07:52 +00:00
45b8383eb9 lang sync (added bulgarian and l33t) 2006-06-04 23:49:47 +00:00
56e97a2b60 updated this t00 2006-06-04 19:42:08 +00:00
9857731dff removed x from sql names 2006-06-04 19:41:37 +00:00
915c3d244c merged in mysqlx fixes 2006-06-04 19:40:34 +00:00
24cdcde968 fixed heap corruption
improved memory usage
removed useless stringpooler
2006-06-04 19:26:43 +00:00
cef005317b wow I'm tired 2006-06-04 09:28:45 +00:00
1035c35c03 *** empty log message *** 2006-06-04 08:57:52 +00:00
2210c54d68 fixed 64bit bugz 2006-06-04 08:57:20 +00:00
e546c69041 fixed linux bug 2006-06-04 08:40:27 +00:00
36268f04d9 latest compiler builds 2006-06-04 08:10:14 +00:00
3fe24d8793 fixed some build problems 2006-06-04 07:49:07 +00:00
b3a91bc496 fixed a build error on gcc 2006-06-04 07:44:55 +00:00
8a529b100c or this 2006-06-04 07:42:46 +00:00
f1f683dca7 gcc didn't like this 2006-06-04 07:42:10 +00:00
afb8fb0019 fixed linux build 2006-06-04 07:37:44 +00:00
fb904f6e40 Linux build works now 2006-06-04 07:35:33 +00:00
73858b0fcd removed packing stuff 2006-06-04 06:43:48 +00:00
a5bd69ac4a MSVC8 project file fixed and updated 2006-06-04 04:35:53 +00:00
c6e17539ca zomg fixed warnings again o_O 2006-06-04 04:29:46 +00:00
e0b05c0b83 Yeah another possible warning fix perhaps 2006-06-04 03:59:14 +00:00
a44eb16360 MSVC8 fixes again, what the heck did I do before? o_O 2006-06-04 03:57:45 +00:00
fc429213d3 whoabug 2006-06-04 02:10:04 +00:00
80cbaa8217 updated these, reorg'd a tad 2006-06-04 01:55:47 +00:00
170dbcaaa9 whoa 2006-06-04 01:54:07 +00:00
7c1da54412 omgcommitted 2006-06-04 01:46:24 +00:00
c508f17bfe added sqlite3 db binary 2006-06-04 01:43:58 +00:00
1cdbfb50ad my test sql file 2006-06-04 01:40:42 +00:00
579cc83d54 this was broken too. make sure it builds next time ;) 2006-06-04 01:36:18 +00:00
be7bf671af sooomeooone broke the geoip build. 2006-06-04 01:31:31 +00:00
e1b9543d10 added these k 2006-06-04 01:22:10 +00:00
af8dea753e removed this SUCKA 2006-06-04 01:14:33 +00:00
d0d08800ef what 2006-06-04 01:05:20 +00:00
dafc10d878 added some more sqlx stocks
upgraded admin.sma to sqlx
fixed various amx_Addadmin bugs
2006-06-04 00:58:17 +00:00
ad0eafe66a fix for memory leak[?] 2006-06-04 00:29:27 +00:00
5ffb38b5bc fixed invalid pathnames passed to CacheAndLoadModules causing auto load not to work 2006-06-04 00:22:59 +00:00
b363b16d61 Added test suite, included sqlxtests 2006-06-03 23:51:11 +00:00
5522778aed fixed registerfuncex never actually registering
fixed requestfunc returning null when not querying
2006-06-03 23:14:09 +00:00
3a7d291513 fixed wrong aff ret val
updated sdk
2006-06-03 23:13:22 +00:00
fe603c29f0 fixed wrong aff return val 2006-06-03 23:13:02 +00:00
27ba10c8a0 fixed a reporting bug 2006-06-03 23:02:18 +00:00
34f5b3257d attempted some thread improvements[?]
fixed moduleconf bug
what
2006-06-03 22:26:43 +00:00
7367f29cb4 fixed a bug where defclasslib would search for lib instead of class 2006-06-03 21:44:35 +00:00
fc5e049e4a expanded MF_OverrideNatives API function a bit, to exclude named module(s) 2006-06-03 21:34:43 +00:00
1c2749fdf6 removed old sdk 2006-06-03 19:52:49 +00:00
aa1308e32e initial import of sqlitex 2006-06-03 19:52:21 +00:00
3cde89bc74 Don't look please 2006-06-03 19:45:03 +00:00
75b6aa192d Wowzers, fixed :\ 2006-06-03 19:41:36 +00:00
43ecf97f99 fixed spelling mistake 2006-06-03 19:29:29 +00:00
4ca564540e bumped version number to 1.75 2006-06-03 13:17:48 +00:00
c8d543929a Updated to June 2006-06-03 08:33:30 +00:00
e7e87ff040 updated to sqlite-3.3.5 2006-06-02 21:29:25 +00:00
ab40f426c6 Added missing colon at30601 2006-06-02 02:18:15 +00:00
7ecdf75d0d fixed typo 2006-05-26 22:08:52 +00:00
e6064af9fb added request at30290 (VEN)
fixed cs_get_user_buyzone returning true when user was in bombtarget zone or other specific areas
2006-05-26 18:26:59 +00:00
44a7b62963 possible fix at29931 2006-05-23 19:35:40 +00:00
ac1e3a9001 Added ClientPrintf engine function (request at30137) 2006-05-23 03:26:26 +00:00
7e36a19590 committed fix for bug atDIVINE (kami no buggu) 2006-05-22 00:00:11 +00:00
6af5516005 added request at26380 (KWo) 2006-05-21 22:02:22 +00:00
444e2caa68 fixed yet another bug 2006-05-19 22:09:43 +00:00
3d932c8a36 Removed take_damage at29909 2006-05-19 19:00:35 +00:00
2e63e1316c fixed bug at29945 2006-05-19 18:40:17 +00:00
b4a77512ae Fixed bug that didn't allow users to use "non-email accounts" for listen+dedicated server installations 2006-05-19 18:37:03 +00:00
b40f5e6637 request at29928
New callable engine function: AlertMessage
2006-05-19 06:01:55 +00:00
e0bed163ac added affinity stuff 2006-05-19 02:04:09 +00:00
bce3bce586 Added amx_ReRegister() and MNF_RegisterFunctionEx() 2006-05-19 01:54:51 +00:00
f9c9088303 added affinity implementation 2006-05-19 01:54:28 +00:00
9bbb0df492 fixed bug at29731 2006-05-18 16:18:14 +00:00
eafd402ead fixed *slaps himself* 2006-05-18 15:55:21 +00:00
cf9cdaa3d6 zomg, I guess I should move these too 2006-05-17 20:23:36 +00:00
a993ba159a Updated for message_const.inc 2006-05-17 20:14:36 +00:00
2d75dfe865 Even more include file changes...
1) Moved message_begin, message_end, and write_ natives to messages.inc
2) Moved MSG constants to message_const.inc
All completely backwards compatible with compiling older plugins of course :)
2006-05-17 20:08:04 +00:00
635b681825 Gah, nothing to say about this one 2006-05-17 19:37:34 +00:00
ef1347cb6c Oh, hello, one more constant 2006-05-17 19:36:42 +00:00
c0334deae1 Added a whole bunch of constants at29843
Some minor changes to some other inc files that aren't even worth mentioning
2006-05-17 19:33:45 +00:00
39a22813cb updated comment 2006-05-17 14:03:59 +00:00
d01d6b06fa little fix 2006-05-17 13:44:58 +00:00
6cb6ef9c84 updated for hlsdk_const 2006-05-16 21:45:33 +00:00
b953f285d0 Tended to request at29593 2006-05-16 21:42:06 +00:00
dc785a4369 Fixed bug at29628 2006-05-16 21:20:14 +00:00
a7de50a4bb fixed problem at29669 2006-05-16 21:15:41 +00:00
00fd007e7a fixed bug at29654 2006-05-16 21:08:19 +00:00
b6007e8223 Modified get_brush_entity_origin and ViewContents as per at29759 (Orangutanz) 2006-05-15 13:52:38 +00:00
25a2b11198 oh hello PM, here is another optimization 2006-05-14 15:59:28 +00:00
a0923e21ed improved using pm's magic (patent pending) 2006-05-14 15:20:25 +00:00
f51620c2d7 fixed worst bug ever 2006-05-13 20:49:37 +00:00
1370305fb0 Exactly why was all that old stuff there? o_O
(Hope I did the right thing, as I usually do the wrong thing here, err)
2006-05-13 15:57:33 +00:00
f7805623b0 added request at29591 2006-05-13 14:59:24 +00:00
9a34c7931a fixed bug at29636 2006-05-13 12:15:16 +00:00
b67e6c5269 Hello MSVC8 project. I'm just removing some files from you this time. Won't hurt one bit. 2006-05-12 04:55:54 +00:00
5e4d5a2c8f Hello MSVC8 project, may I update you? 2006-05-12 04:52:36 +00:00
567044c381 fixed indenter bug (I swear I fixed this bug years ago!) 2006-05-11 16:03:18 +00:00
b2b001c9e4 added M_ in front to match HLSDK and other things 2006-05-11 13:12:41 +00:00
793de6d8d2 added PI define (at29548) 2006-05-11 13:10:29 +00:00
d862f23929 Attempt for fix of bug at28381 2006-05-11 13:04:37 +00:00
f8809e2663 Fixed a backwards compatibility issue with free result 2006-05-11 12:11:42 +00:00
19f2be0c96 updated 2006-05-11 10:22:18 +00:00
6995b182c1 failsafe autoloading of libraries for 1.71- plugins 2006-05-11 10:19:09 +00:00
79f86bfabd updated comment 2006-05-11 10:07:32 +00:00
035c54350e module filter is expanded a tiny bit 2006-05-11 10:05:42 +00:00
d0a61ef581 Added request at28865 2006-05-11 08:55:29 +00:00
123215a53c removed these, no longer needed 2006-05-11 08:47:53 +00:00
9b68c0678a merged register_message into core
request at29428
2006-05-11 08:45:06 +00:00
e0fa5227d6 merged register_message into core 2006-05-11 08:36:20 +00:00
441ab14d3b moved register_message into core, yay 2006-05-11 08:35:21 +00:00
ed6e28c1d4 removed message functions from engine [!] 2006-05-11 07:49:45 +00:00
77f0e526bf Whoa. SetClientKeyValue fixed :\ 2006-05-11 03:34:13 +00:00
30ce0d9f1b Another pointless typo fix 2006-05-11 02:29:08 +00:00
8920a05bba mov gah, [newline_fix] 2006-05-10 14:38:11 +00:00
061da07af8 Yet another wondeful typo fix 2006-05-10 13:26:36 +00:00
da757b6c62 Um, ignore me please. Nothing to see here. Move along. 2006-05-10 13:25:29 +00:00
880b83a10b Typo fix! :o 2006-05-10 13:24:31 +00:00
76c1c78b5b up up and awayyy 2006-05-10 13:02:37 +00:00
afe19411b2 oh I forgot to commit this, basic-master-san 2006-05-10 12:40:44 +00:00
b2aff10e46 Added some comments to benefit all mankind :o 2006-05-10 12:35:21 +00:00
4e1123730c fixed lib class 2006-05-10 12:29:37 +00:00
8e3a5e6d58 sdk v4 2006-05-10 12:00:22 +00:00
beb975bdbf ohmygod like the modules are synced and updated for sdk v4 2006-05-10 11:53:22 +00:00
302b759fc8 oops :( 2006-05-10 11:31:17 +00:00
c6e8a356ee Added request at29487
1) New hookable Engine func: GetInfoKeyBuffer
2) New GameDLL func that can be called via engfunc: GetInfoKeyBuffer
3) New native: copy_infokey_buffer that copies data out of the specified info key buffer
4) EngFunc_InfoKeyValue, EngFunc_SetKeyValue, and EngFunc_SetClientKeyValue have been reworked
    so that they expect pointers to an info key buffer in order to work properly o_O
2006-05-10 11:28:00 +00:00
b12025093b added ability to override natives (someone shoot me) 2006-05-10 11:23:08 +00:00
de1f1eef8d Added request at29487
1) New hookable Engine func: GetInfoKeyBuffer
2) New GameDLL func that can be called via engfunc: GetInfoKeyBuffer
3) New native: copy_infokey_buffer that copies data out of the specified info key buffer
4) EngFunc_InfoKeyValue, EngFunc_SetKeyValue, and EngFunc_SetClientKeyValue have been reworked
    so that they expect pointers to an info key buffer in order to work properly o_O
5) Added some error messages to get_tr
2006-05-10 11:19:24 +00:00
25d4b6aea3 added these include files k 2006-05-10 10:42:49 +00:00
f9fd83b42e test commit of new sdk 2006-05-10 07:49:05 +00:00
1e6ba05ec9 corrected some changes for inclusion into base 2006-05-10 07:42:35 +00:00
dd7529b42c Fixed a bug where three of the new pragmas parsed spaces wrong 2006-05-10 04:51:07 +00:00
cfb36025b5 builds of latest compiler sources, and version bumped 2006-05-10 04:48:19 +00:00
f5cabb4bea fixed infinite loop (oops) 2006-05-10 04:44:07 +00:00
58209dfb37 Added fix for __DATE__, added __TIME__
Added tag table crap for new autoloading feature
Version bump
2006-05-10 03:44:35 +00:00
a29f8d0651 Cleaned up error reporting a bit 2006-05-10 03:43:53 +00:00
f600a96657 Initial massive import of the new code module auto-loading code
Important difference - pubtags table is used instead of library table!
2006-05-10 02:32:34 +00:00
d8c8e72745 Committed fix for bug at29456 2006-05-09 23:43:06 +00:00
9a34213992 Committed rebuild of ASM stuff for bug at29456 2006-05-09 23:43:05 +00:00
67d4c5ccad bumped version 2006-05-09 22:47:16 +00:00
6b794d4a9d Version bump 2006-05-08 04:37:15 +00:00
ca3e8582e3 Added missing files to MSVC8 project (libraries.h and libraries.cpp)
Fixed some MSVC8 errors with new files
Bumped version
2006-05-08 04:13:37 +00:00
7669ab02f6 fixed prototype error 2006-05-08 00:26:32 +00:00
c6f8749242 real fix for memleak 2006-05-07 22:21:06 +00:00
6ee7930a46 experimental fix for memleak 2006-05-07 21:59:57 +00:00
f2c5a2b85b updated to new module API 2006-05-07 21:40:12 +00:00
37151d361f added layout for "plugin cache"
dynamic natives that are paused now pause parent plugin with an error
added catch for a potentially serious bug?
2006-05-07 21:16:00 +00:00
974e8882b9 detach zOMG 2006-05-07 20:07:57 +00:00
9b9f0d0e27 fixed small typo 2006-05-07 17:27:24 +00:00
0a4a209f94 corrected commit 2006-05-07 17:11:17 +00:00
603be35426 test of new module API, should work though 2006-05-07 10:10:44 +00:00
92645db291 Synced in new modules.ini format 2006-05-07 10:09:04 +00:00
00e32aca97 added a little more flexibility to modules.ini
fixed bug where unloading was never called
2006-05-07 10:05:04 +00:00
dad00a2eb6 Initial import of replacement Library system - Backwards compat tested!
Updated new SDK (bumped vers number, kept backwards compat)
Improved module path resolving
2006-05-07 09:56:06 +00:00
576680eaf9 Added vformat() native 2006-05-07 00:25:43 +00:00
7a533c7be5 Added vformat() 2006-05-07 00:25:30 +00:00
4e5ada6ad1 added request at28200 2006-05-06 22:49:38 +00:00
a9f300bca9 Version bumpage for every module except MySQL/MySQLX (as I'm unsure of the status of those at the moment) 2006-05-06 04:57:10 +00:00
8fec829c63 Version bump in AMX_VERSION define (since version.rc was bumped) 2006-05-06 04:49:36 +00:00
f3fe58809d changes so forward ids can be mapped back to names 2006-05-06 02:03:25 +00:00
c6d16eac7a version bump 2006-05-05 18:31:27 +00:00
d7e53d7a81 Err, more descriptive param names? 2006-05-05 08:30:16 +00:00
26ee3955b6 Another one of my stupid clarifications that shouldn't break anything (I hope...) 2006-05-05 08:27:58 +00:00
21ffd88bdd More bugs?
1) FM_CreateInstancedBaselines has been renamed to FM_CreateInstBaselines
2) DLLFunc_CreateInstancedBaseline has been renamed to DLLFunc_CreateInstBaselines
(I'd be extremely surprised if someone complained about the above 2 changes)
3) New hookable GameDLL func: FM_CreateBaseline
4) New hookable Engine func: FM_CreateInstBaseline
5) New GameDLL func that can be called via dllfunc: CreateBaseline
6) New GameDLL func that can be called via engfunc: CreateInstancedBaseline
7) Added some comments to each member of various enums that correspond to special structs in the engine and/or game dll
2006-05-05 08:07:31 +00:00
ed19c53552 More bugs?
1) New hookable GameDLL func: CreateBaseline
2) New hookable Engine func: CreateInstancedBaseline
3) New GameDLL func that can be called via dllfunc: CreateBaseline
4) New GameDLL func that can be called via engfunc: CreateInstancedBaseline
2006-05-05 08:04:19 +00:00
133c7d6815 Fixed possible crash bug in get_tr2 at29250 (Orangutanz) 2006-05-05 05:11:17 +00:00
7cd10e4796 Another param change that I seemed to have missed... should be no problem 2006-05-04 22:39:23 +00:00
ecd2d913e4 Err, gah... native one being changed didn't really matter 2006-05-04 22:12:16 +00:00
53e84a13be gah 2006-05-04 22:10:23 +00:00
eb55e1f4aa i prefix changed to ent because it looks nicer indeed 2006-05-04 19:59:05 +00:00
dc063594de Not sure why I decided to potentially crash the server with cs_set_user_vip o_O
Stayed tuned for another episode of "What Was DS Thinking?"
2006-05-04 05:32:45 +00:00
f26d208c38 Updated to May 2006-05-03 07:12:01 +00:00
6cc239c66f Two extra params in cs_set_user_vip for determining whether or not model and scoreboard are updated at28699
Version bumpage
2006-05-02 21:49:17 +00:00
6733ef9a79 Two extra params in cs_set_user_vip for determining whether or not model and scoreboard are updated at28699 2006-05-02 21:48:26 +00:00
7dc4beae63 Removed set_user_deaths from inc file at29080
(Doesn't seem to be any easy general way to implement it)
2006-05-01 05:25:28 +00:00
de33bb6a1d Oh goodness, let the bugs begin...
1) New hookable GameDLL funcs: UpdateClientData, AddToFullPack, CmdStart, CmdEnd (at28754)
2) New GameDLL funcs that can be called via dllfunc: UpdateClientData, AddToFullPack, CmdStart, CmdEnd
3) New natives to read/write special data structures associated with the above GameDLL funcs:
   get/set_cd (ClientData), get/set_es (EntityState), get/set_uc (UserCmd)
2006-04-30 07:37:31 +00:00
7883710bf6 Added pm_shared to include directories so this can compile on Linux again 2006-04-30 07:28:39 +00:00
0071d73e25 Oh goodness, let the bugs begin...
1) Fixed getting incorrect value of the entity index when using ClientUserInfoChanged via dllfunc
2) New hookable GameDLL funcs: UpdateClientData, AddToFullPack, CmdStart, CmdEnd (at28754)
3) New GameDLL funcs that can be called via dllfunc: UpdateClientData, AddToFullPack, CmdStart, CmdEnd
4) New natives to read/write special data structures associated with the above GameDLL funcs
2006-04-30 07:27:14 +00:00
0555e7aa63 fixed MM warning 2006-04-29 13:51:52 +00:00
ddda9c9118 Fixed weird close bug 2006-04-29 10:20:41 +00:00
d2b57d29fb untested fix for issue where hooks were not released on server deactivate - only on plugin load 2006-04-29 07:23:23 +00:00
d78ec24679 fixed bug when registering plugin_(un)pause forward 2006-04-28 22:51:40 +00:00
e5057d7191 cell upcasting (second revision) 2006-04-28 21:30:17 +00:00
f10ecbb239 Small bug fix and tiny optimizations in xs_get_maxmessages and xs_is_msg_valid
Added xs_vec_maked2d (at28754)
2006-04-28 21:10:29 +00:00
229b149247 cell upcasting (second revision) 2006-04-28 20:14:08 +00:00
1f8b9a8cd9 Renamed FM_ClientInfoChanged to FM_ClientUserInfoChanged for consistency with DLLFunc_ClientUserInfoChanged
(Also goes along with fix made in FakeMeta module itself, sort of :|)
2006-04-28 20:10:42 +00:00
6000fe43d1 Fixed ClientUserInfoChanged forward not being reset on mapchange 2006-04-28 20:07:53 +00:00
5a2e35c1bf Fixed is_in_viewcone always returning 0
Fixed is_visible causing a crash when a non-player entity was passed and also made it quite a bit more accurate
(at28936)
2006-04-28 19:19:24 +00:00
62c096d7d3 updated comment as per at28188 2006-04-27 17:41:41 +00:00
f6cb8ab3bb fixed typo (at28930) 2006-04-27 17:31:55 +00:00
8da4987895 implemented request at28875 2006-04-27 17:31:38 +00:00
38cb60c60b Eh hem. This shouldn't have been bumped quite yet :( 2006-04-27 03:57:33 +00:00
a87966cde3 Oops (again) 2006-04-27 00:07:36 +00:00
9b252fa919 Oops :( 2006-04-27 00:04:52 +00:00
760514a1fe Makefile now in sync with the others (I think)
(This is mostly for cleaning fixes. Please give me a better idea)
2006-04-27 00:02:54 +00:00
2ca42b7b21 MSVC8 Project File + SDK Update 2006-04-26 23:54:12 +00:00
b65b8a1cf0 request at28581 2006-04-26 05:21:29 +00:00
e96eaa6174 Fixed small error 2006-04-26 05:18:26 +00:00
2a74d2229f commit for fix to a deadlock which would occur when stopping a live, queue'd thread worker 2006-04-25 20:41:18 +00:00
3f5bae615b added request at28199 2006-04-25 17:19:58 +00:00
96854aefa7 now allows you to teleport yourself (request by jpt10181) 2006-04-25 15:14:54 +00:00
697f63f2e9 fixed small modified bug
fixed another tiny bug (default author+default name weren't equal if you created a new plugin if the settings.ini wasn't found)
2006-04-25 14:51:13 +00:00
98a1d2b3da added fast read+write
fixed modified bug for the notes
2006-04-25 14:24:21 +00:00
2c541f338c Now shows if a document has been modified in the documents tab bar 2006-04-25 13:16:43 +00:00
9dccde4567 Fixed bug with ClientUserInfoChanged forward at28782
Also bumped version
2006-04-25 09:08:11 +00:00
47408443f7 Fixed bug with ClientUserInfoChanged forward at28782 (Orangutanz)
Also bumped version
2006-04-25 09:08:11 +00:00
f673e641f3 Fixed issue where hostname could be retrieved too early if it was set in server.cfg;
thereby having an incorrect hostname if %hostname% was used in the message

Also, if the hostname cvar changes at any time before a map change occurs, then %hostname% should be replaced with the new value
2006-04-25 07:35:02 +00:00
1f44f5f481 fixed some return stuff 2006-04-24 15:14:34 +00:00
94d4380f39 renamed logtag to deal with stupid system 2006-04-24 11:59:22 +00:00
5adc7021e4 fixed project for release builds 2006-04-24 11:22:24 +00:00
14db579540 added more tests 2006-04-24 11:13:17 +00:00
3aebbd7173 Restored linux compat 2006-04-24 10:31:37 +00:00
1c5b8670d9 added backwards compat layer to old mysql module 2006-04-24 10:27:25 +00:00
768880fa92 leprechaun ! 2006-04-24 07:33:09 +00:00
114a6fe19d added linux support [untested] 2006-04-24 07:19:15 +00:00
0d3e657e1a added pragma library 2006-04-24 07:08:05 +00:00
880ec0572f fixed some bugs in result stuff 2006-04-24 02:09:27 +00:00
eba3f39d88 fixed some corruption bugs, hopefully improved memory management 2006-04-23 23:17:20 +00:00
58ed3067ed Fixed search bug
Fixed print bug
Bumped version number to 1.4.2
2006-04-23 20:46:52 +00:00
fce58de726 *** empty log message *** 2006-04-23 04:24:46 +00:00
3677bc15ad *** empty log message *** 2006-04-23 01:36:33 +00:00
27d8cde394 initial import 2006-04-23 01:10:06 +00:00
3ba923e4c0 Works on t3h linux 2006-04-22 19:50:51 +00:00
07b1f0ea87 Added to allow Linux compilations. 2006-04-22 19:44:37 +00:00
769485ce29 fixed 2 memory leaks in the debugger 2006-04-21 02:45:57 +00:00
1d6becf3b5 hi, dont look 2006-04-21 02:18:34 +00:00
761e1f6fe1 Reverted a CreateInstancedBaselines change due to a 31 character limit to enum symbols that causes a compiler warning
(Real function that FM uses is called CreateInstancedBaselines and is different from CreateInstancedBaseline...
So something should be done, but I'm not sure what yet)
2006-04-20 08:49:49 +00:00
b34557b839 fixed bug at27878 2006-04-19 02:52:39 +00:00
a265189efa Modified param names for touch native and forward to correct values... makes it more clear to someone looking at it 2006-04-17 22:29:18 +00:00
4101eea5e8 Oh dear, lots of changes:
1) Added get_orig_retval for retrieving the original return value of an engine function
2) Fixed engfunc being called with EngFunc_CheckVisibility so that it now works as intended
3) Hooks should now also work with FM_WalkMove, FM_TraceToss, FM_TraceMonsterHull, FM_TraceHull,
   FM_TraceModel, FM_TraceTexture, FM_TraceSphere, FM_GetBonePosition, FM_GetAttachment, FM_RunPlayerMove,
   FM_StaticDecal, FM_BuildSoundMsg and FM_CheckVisibility
4) Reformatted comments in some header files so they look a bit neater
2006-04-17 17:02:57 +00:00
b57c752b1c Added get_orig_retval for retrieving the original return value of an engine function
Reformatted comments in fakemeta include files so they look a bit neater
2006-04-17 16:59:37 +00:00
82a739a95e register_plugin returns id 2006-04-17 12:57:52 +00:00
0a66780727 bugfix for HLDM (listen server) 2006-04-16 00:54:16 +00:00
cb92e45712 Small design changes
Added multi-account support to the local install functions (experimental!)
2006-04-16 00:25:49 +00:00
28b04878ce Added visual style support :o 2006-04-14 15:55:25 +00:00
a5df31570e added request at28068 (split log files)
fixed all native debug errors in core
2006-04-13 16:29:01 +00:00
ed1b2914be Oops, forgot some directories for clean 2006-04-12 17:05:05 +00:00
41214cc461 Makefile changes to fix the clean option 2006-04-12 16:55:09 +00:00
c371684e5e Makefile changes to fix the clean option
Changed arch from 686 to 586
2006-04-12 16:54:17 +00:00
c1866f8156 Makefile changes to fix the clean option
Removed unnecessary geoip files from CVS :o
2006-04-12 16:52:28 +00:00
0939c54048 Makefile changes to fix the clean option
Changed arch from 686 to 586
2006-04-12 16:48:47 +00:00
d9e2166e97 bumped version number to 1.72 2006-04-12 16:18:46 +00:00
17d5e7f0ca Renamed SUFFIX_x to BIN_SUFFIX_x because it more clearly shows the meaning of the variable :\ 2006-04-12 16:00:12 +00:00
564a5484f7 Some changes to the makefile:
1) Fixed clean not removing amd64 binaries
2) Removed seemingly broken mmgr builds (just like MSVC now)
3) Added binlog options for creating BinLog binaries
4) Fixed amd64 build from dynamically linking to zlib
2006-04-12 15:42:18 +00:00
8a732c7e14 For some reason libz64.a was not recognized as a binary file in CVS. Hopefully fixed now. 2006-04-12 15:37:00 +00:00
998208ef20 *** empty log message *** 2006-04-12 15:36:07 +00:00
a2082bac93 Don't include unnecessary headers when BINLOG_ENABLED isn't defined - whoa 2006-04-12 13:01:15 +00:00
3dacc60073 Minor MSVC Project Changes:
1) Automatically add "bl" to binary name on BinLog builds
2) Exclude binlog.cpp from non-BinLog builds
2006-04-12 12:56:58 +00:00
a5dc3fe777 changed a few captions 2006-04-12 12:08:52 +00:00
5c55eae9a6 fixed a bug for metamod's plugins.ini
simplified the install method page a bit
2006-04-12 10:26:19 +00:00
63aef3bcee added debug msgs 2006-04-12 02:25:31 +00:00
deeb2f3cf9 added some debug msgs 2006-04-12 02:12:03 +00:00
59098d703e added debug msgs 2006-04-12 02:00:08 +00:00
662289eb28 added some debug msgs 2006-04-12 01:51:23 +00:00
392b7d9fdf Removed tclsqlite.c from MSVC project files (it's really not needed, I swear) 2006-04-11 16:11:42 +00:00
db9fcc28d6 fixed bug at27729 (HS and announcements overlapping) 2006-04-11 13:26:50 +00:00
63d4d6591b fixed typo at28092 2006-04-11 12:41:29 +00:00
9ef9e3755a Fixed bug at28087 2006-04-11 06:34:17 +00:00
b8ddd281aa hack fix for at28078 2006-04-11 06:30:59 +00:00
363d95f68c fixed bug at27832(jtp10181) 2006-04-10 22:14:42 +00:00
da6b71a677 Changed default caption of the documents tabbar
Changed default theme to Xito
2006-04-10 18:25:54 +00:00
c9765e50c8 Replaced Documents tabbar (means two bugs are fixed now)
Removed Projects tabbar and added a new item to the statusbar
2006-04-10 18:05:08 +00:00
cd7f15f112 Reverted one of my "fixes." Apparently this is intended functionality. Sorry :( 2006-04-10 16:13:02 +00:00
4fb001ce50 Whoa, whoa, whoa. Three "bugs"
1) Fixed tag mismatches with fprintf when not using Float, Sql, or Result (comma was missing :o)
2) Fixed unlink from taking more than one argument o_O
3) Fixed filesize from taking more than one argument o_O
2006-04-10 14:02:37 +00:00
e49365755d MSVC8 Project File + SDK Update + Some Newline Fixes 2006-04-07 12:05:08 +00:00
9baab16682 MSVC8 Project File + SDK Update 2006-04-07 11:56:28 +00:00
dfcd83ffa3 Redefined some missing preprocessor macros that should have been present in the release build configs 2006-04-07 11:42:50 +00:00
8238741f39 MSVC8 Project File + SDK Update + Some Newline Fixes 2006-04-07 11:32:45 +00:00
a595557e2d MSVC8 Project File + SDK Update
Update to SQLite 3.3.5
2006-04-07 11:18:17 +00:00
070d8177c5 MSVC8 Project File + SDK Update 2006-04-07 11:04:28 +00:00
9eb3cd1793 Readded libpcre 6.4 binary for x86 Linux module 2006-04-07 10:52:39 +00:00
2f6fe9fac4 MSVC8 Project Files + SDK Update
Also updated to pcre 6.4
Added lib_linux64/pcrelib - should fix issue with module requiring libpcre as external dependency on AMD64
2006-04-07 10:51:09 +00:00
3bf5fb612f Oops, disable RTTI. 2006-04-07 10:27:49 +00:00
62b28e7033 MSVC8 Project File + SDK Update 2006-04-07 10:25:45 +00:00
860a4ca50e MSVC8 Project File + SDK Update + Some Newline Fixes 2006-04-07 10:12:56 +00:00
26a0767737 MSVC8 Warning Fixes 2006-04-07 10:02:13 +00:00
4eccad2c27 MSVC8 Project File + SDK Update 2006-04-07 10:00:04 +00:00
3966f79324 MSVC8 Project File + SDK Update 2006-04-07 09:41:31 +00:00
38305fdd4f MSVC8 Project File + SDK Update + Some Newline Fixes 2006-04-07 09:24:27 +00:00
9c2f98e1eb MSVC8 Project File + SDK Update + Some Newline Fixes 2006-04-07 09:09:48 +00:00
971c5ffbb5 Oops. Put no RTTI on debug build as well. 2006-04-07 08:58:37 +00:00
c1edaa83bd MSVC8 Project Files + SDK Update 2006-04-07 08:48:01 +00:00
795e23dd09 natives-amd64.o fixed? 2006-04-07 07:18:52 +00:00
93ff6d5c67 *** empty log message *** 2006-04-07 07:18:23 +00:00
0dc594f5e1 Weirdness in libz.a hopefully fixed? 2006-04-07 07:14:56 +00:00
fad03b546a *** empty log message *** 2006-04-07 07:14:15 +00:00
39f4a2bc13 fixed bug at27770 2006-04-06 23:36:22 +00:00
3cb91fec58 MSVC8 Project File + SDK Update 2006-04-06 14:33:15 +00:00
8276223e68 Compile with no RTTI 2006-04-06 14:27:50 +00:00
2da45cfd1c MSVC8 Project File + SDK Update 2006-04-06 14:17:39 +00:00
82b0128308 MSVC8 Project File + SDK Update 2006-04-06 13:58:06 +00:00
550c505813 Removed no longer supported DB modules from modules.ini :o 2006-04-06 13:14:45 +00:00
d50d6b0334 For some strange reason natives-amd64.o and libz.a were not valid files before and core would not compile on Linux. Now they should work. 2006-04-06 13:06:48 +00:00
f2d21c410b MSVC8/VS2005 Compiling Fixes - 0 errors, 0 warnings. Hurray! 2006-04-06 12:56:45 +00:00
ec51566abe Remove cruft from MSVC 7.1 project files so that JITDebug, JITDebugBinLog, JITRelease, and JITReleaseBinLog are the only build configs 2006-04-06 12:14:59 +00:00
8a2d750970 removed some amd64 files :o 2006-04-03 02:42:20 +00:00
46b70bdfba updated to April 2006-04-02 19:27:18 +00:00
15e137e266 time test 2006-04-02 18:50:35 +00:00
93c8bd0253 fixed potential exploit (thanks twisted) 2006-04-01 05:50:33 +00:00
10a935790c a clean yam is a happy yam. 2006-03-31 21:59:52 +00:00
68208d73d7 made sure vars are reset 2006-03-30 20:45:22 +00:00
b57367dd30 abort() now cancels a callfunc 2006-03-30 20:42:11 +00:00
9eb9839a46 bumped version numbers 2006-03-30 04:25:57 +00:00
deccf7816c added rmdir() 2006-03-30 00:48:58 +00:00
fe971497cc synced to dll 2006-03-30 00:31:45 +00:00
8c2be55233 added ClientUserInfoChanged forward 2006-03-30 00:31:33 +00:00
ab443e8254 fixed a few buffer overflow errors 2006-03-30 00:13:38 +00:00
16e53eded8 synced to dll 2006-03-29 23:57:54 +00:00
a7acf05bfc added more strings 2006-03-29 23:57:42 +00:00
5e22cd5f0a Fixed bug at27323 (AndraX2000) 2006-03-29 23:33:38 +00:00
92be7f6791 synced to core 2006-03-29 22:58:11 +00:00
94c449936d added getc,ungetc,putc 2006-03-29 22:56:18 +00:00
89c58265aa page numbering does not appear with no pages 2006-03-29 22:48:45 +00:00
3783e34a70 Fixed a bug where handlers wouldn't work if they were in the 0th slot 2006-03-29 22:42:03 +00:00
414ecdfffa fixed crash when creating a new binlog file 2006-03-24 19:29:49 +00:00
76afa40270 fixed bug 2006-03-23 15:01:15 +00:00
17bbc37638 fixed binlog max size name 2006-03-23 10:11:09 +00:00
4b0b3c0c7c bumped version 2006-03-20 22:58:27 +00:00
006b4bd49a added syncpoints to all stats scripts 2006-03-20 19:40:58 +00:00
5395fc1280 updated constants 2006-03-20 19:36:57 +00:00
a293e23fe2 renamed time to gl_time
updated makefile
2006-03-20 18:45:53 +00:00
68e729721d ~(, ,)o <-- wtf another turtle?! 2006-03-20 18:38:29 +00:00
4f5c16c278 added support for new tr and kvd hooking/calling 2006-03-20 18:23:03 +00:00
c15a86b454 added new TR/KVD stuffs 2006-03-20 18:08:51 +00:00
51c8724cff added more hud syncpoints 2006-03-20 01:43:44 +00:00
ccb3b4fbb3 experimental fix for improving hud sync 2006-03-20 01:03:30 +00:00
83bf0d7b2a ~(, ,)o <-- turtle 2006-03-19 21:52:25 +00:00
f55a8c54cc binlog reader no longer logs plugin database in a separate file 2006-03-19 21:41:11 +00:00
dc9350fcc5 committed changes for new file format 2006-03-19 21:40:24 +00:00
ef5437fec3 a working adminslots 2006-03-19 21:25:18 +00:00
0999db0203 fixed bug at26073 2006-03-19 20:48:37 +00:00
d84ef62e6c little optimization from PM 2006-03-19 20:39:25 +00:00
b5e8bc9ec1 fixed bug at26868 2006-03-19 20:14:24 +00:00
ccaa4434ad committed new language code 2006-03-19 19:26:29 +00:00
555ac1c7f3 fixed corrupt file loads smashing the stack
added compile of support code
2006-03-18 22:10:05 +00:00
b9788b7e1b *** empty log message *** 2006-03-18 21:38:28 +00:00
c6e332a0f5 linux+amd64 compat 2006-03-18 20:59:38 +00:00
007d41b5af Bumped version number to 1.71
Added a hint concerning binary logging to metamod's plugins.ini
2006-03-18 20:03:34 +00:00
a1956bc83b added cpuid helper func 2006-03-18 08:56:58 +00:00
ff61158491 fix for binary db not being created on maxsize overflow 2006-03-17 23:29:33 +00:00
2c5520cad0 added optimization tweaker
added binary log maxsize support
2006-03-17 22:50:13 +00:00
4bcb0fcb13 new localinfo crap 2006-03-17 22:10:16 +00:00
6ef670878d committed binary 2006-03-17 18:26:21 +00:00
89e13334ae uses stringbuilder instead of alloc+concat for speed now 2006-03-16 19:29:46 +00:00
82fe1e10d9 Fleshed out log and database readers, began basics of GUI 2006-03-16 06:40:18 +00:00
e067a980be implemented a lot more binary opcodes
bumped versions
2006-03-16 06:36:01 +00:00
e98fbc47e8 added new binary logging option 2006-03-16 04:36:55 +00:00
b6fa60b0bd Modified to fix memory leaks and improve speed 2006-03-16 02:11:48 +00:00
7e97156fc4 added arrayset native 2006-03-16 00:13:13 +00:00
7190d933b4 fixed bug at26204 2006-03-15 16:14:32 +00:00
3699796bc6 finalized file format
added register op (working)
added msvc8 stuff (4better || 4worse)
2006-03-15 13:43:06 +00:00
e208ff0664 quick import of file structure 2006-03-15 13:42:25 +00:00
adc2a7d169 initial import of binary logger support code 2006-03-14 19:36:18 +00:00
dc8e162e26 added menu_cancel 2006-03-14 17:50:38 +00:00
522511d059 implemented menu_cancel 2006-03-14 17:49:29 +00:00
d5152fedc4 added glb.cpp 2006-03-14 17:21:35 +00:00
d7bef2ae4b added get_global() 2006-03-14 17:15:52 +00:00
9283cbe1c2 added request at26450 2006-03-14 16:55:06 +00:00
7dae023a98 fixed bug at26580 2006-03-14 10:01:35 +00:00
9c88ce1394 fixed bug at26581 2006-03-14 09:59:28 +00:00
4cb8d4adc7 *** empty log message *** 2006-03-14 02:54:54 +00:00
5c88803942 New update! 3.1 is liiiive!
Error handling:
Array now has sufficiently advanced error handling to remove most, if not all, disable_checks.

Extention:
With the metaprogramming techniques, new types can be added easily.

Speed:
With the new changes I've made to Judy, the Array module has far exceeded the speed of any traditional datatype
2006-03-14 02:54:24 +00:00
4457b0d879 Obsolete due to update 2006-03-14 02:50:30 +00:00
58415dcfb9 Obsolete due to new updates 2006-03-14 02:49:02 +00:00
76c216d07e added request at26533 (Brad) 2006-03-13 22:43:55 +00:00
aa3582a2f3 removed patch for autochanneler (bug at26176) 2006-03-13 14:37:23 +00:00
d80b59e639 vers bump 2006-03-13 14:35:46 +00:00
880cb401fb fixed bug at26340 (NiLuJe) 2006-03-13 14:35:26 +00:00
2e0dcb860a fixed dynamic ExecuteForward not returning a valid result and patching the forward id 2006-03-10 19:04:04 +00:00
a9684fb81d fixed bug at26189 2006-03-07 12:58:39 +00:00
f2b8b82515 Component update (whoa I hate delphi reinstallations)
Added another feature for the Code-Explorer
2006-03-06 19:47:22 +00:00
eb7a49f6d4 fixed awful cvar bug, amx_reservedslots (which wasn't registered by the plugin) was used in the code instead of amx_reservation 2006-03-06 15:27:30 +00:00
982b22ab20 fixed bug in split() 2006-03-06 14:54:12 +00:00
38acf132c8 new installer for added files, removed files, that stuff... yams 2006-03-04 11:12:17 +00:00
f25824a1aa added in two old natives again
fixed a native spelling mistake
2006-03-04 11:06:19 +00:00
446c5523f8 added back in two more old natives 2006-03-04 11:05:59 +00:00
7bcdc4be44 new info files for vers bump 2006-03-04 09:46:32 +00:00
6c6389ba65 oh, last credits bit. wee <-- gaben? 2006-03-04 08:52:08 +00:00
0898418cf3 what... oh 2006-03-04 08:40:27 +00:00
943b902e23 fixed the cursed bug of throwing knives 2006-03-04 08:16:00 +00:00
74cd310504 bumped version 2006-03-04 06:53:06 +00:00
44979f2b07 bumped versions 2006-03-04 06:51:59 +00:00
a3142a520f bumped versSIIOOON 2006-03-04 06:48:44 +00:00
372a01e6da committed fakemeta optimizations 2006-03-04 06:34:28 +00:00
3b4cd21835 NL and SV fixes (Lt Llama) 2006-03-03 22:31:55 +00:00
2d6c06b82f fixed fclose bug (NiLuJe) 2006-03-01 20:59:08 +00:00
a9cdb2b48e new binary 2006-03-01 02:50:28 +00:00
60b411757d latest compiler build 2006-03-01 02:48:40 +00:00
19b5835ae4 added ClearSyncHud() 2006-03-01 02:20:44 +00:00
48377168b2 Added ClearSyncHud() 2006-03-01 02:17:20 +00:00
d89f216682 added more syncing 2006-03-01 00:10:35 +00:00
62489d05cc fixed hud message syncing 2006-03-01 00:10:23 +00:00
84b09301e6 fixed display bug 2006-02-28 23:43:22 +00:00
3c1b564956 wrapped a few more things around HudSyncObjs 2006-02-28 10:46:22 +00:00
f7d4c6fe34 fixed the final bug in this I think 2006-02-28 10:42:52 +00:00
d2cc14fa18 crraaaaap 2006-02-28 10:10:44 +00:00
51b2cf120e fixed valve_id_lan bug 2006-02-28 10:03:13 +00:00
dc5506efe3 added experimental callback for modules to get authorization 2006-02-28 09:59:03 +00:00
628d38df7a experimental fix for new stats sync code 2006-02-28 09:43:20 +00:00
d4c2bf154f experimental fix for hud sync issue 2006-02-28 09:42:56 +00:00
a504caac62 resync 2006-02-28 05:15:40 +00:00
2653f88b73 bumped vers on this early 2006-02-28 05:15:29 +00:00
f853f8f8cd added amxx to vers string 2006-02-28 05:14:36 +00:00
b2437451e3 implemented __DATE__ 2006-02-28 05:14:20 +00:00
c49bff54b1 fixed bug at25751 (zor) 2006-02-27 20:31:50 +00:00
b9ed05f38b fixed bug at25751 (zor) 2006-02-27 20:30:07 +00:00
4aaa2f8e0f fixed memory leak 2006-02-27 10:10:52 +00:00
85c37c6a39 merged in marticus's changes 2006-02-27 09:22:03 +00:00
ed4d8f9e26 added missing flags (NiLuJe) 2006-02-26 20:38:36 +00:00
1a03391347 omg updated these for sure. 2006-02-26 08:15:12 +00:00
0999ad32e3 makefile 2006-02-26 08:13:56 +00:00
f62933efd4 makeile 2006-02-26 08:13:15 +00:00
b968f437ca phew... updated to include old tsfun stuffs 2006-02-26 08:11:25 +00:00
d9f9c5256a more revert to 1.00-era code 2006-02-26 06:54:23 +00:00
0da49cfc45 reduced this module to a wrapper 2006-02-26 06:45:44 +00:00
8735bf3df3 initial revert to 1.00-era code 2006-02-26 06:42:48 +00:00
4db61f243a what 2006-02-26 06:40:47 +00:00
a43a3b0803 committed patch for correct typecasting 2006-02-26 05:03:05 +00:00
bf8cf574e0 updated to 3.3.4 2006-02-25 01:37:50 +00:00
4fed42b5c7 gah >_< recompiled with -O1 -DWIN32 2006-02-24 15:47:40 +00:00
1f2d9c8a92 typos, made language harsher 2006-02-24 10:12:55 +00:00
8502fb51b3 fixed bug where deleting oldmenus would make the next key non-unique 2006-02-24 08:34:37 +00:00
1d30d0831b i have a hat 2006-02-24 07:49:08 +00:00
0520c606ec fixed possible overrun bug 2006-02-24 00:11:37 +00:00
6997c780d9 fixed bug where format() on copy-back would not null terminate 2006-02-24 00:09:33 +00:00
631e709471 fixed bug where the string lenght wasnt decreased on some cases 2006-02-23 22:55:43 +00:00
1d508c0e04 Updated version to 1.70 2006-02-23 10:54:15 +00:00
28ca230a53 Fixed another bug, installer didn't register the right mm version in the liblist.gam for AMD64 servers 2006-02-23 10:51:35 +00:00
01b58a4635 Fixed dictionary parsing not obeying the carat backtick
Fixed failed translations crashing
Added formatex()
Fixed buffer copyback problems in old usages
2006-02-23 00:02:33 +00:00
0852dfa112 added missing pcvar natives 2006-02-22 20:32:59 +00:00
7362cd0621 sup twisty 2006-02-22 01:41:28 +00:00
635d18de92 tiny optimizations from evilspy 2006-02-22 01:36:29 +00:00
484014e2db fixed translate concat bug 2006-02-22 01:05:09 +00:00
2ba0b079ab initial import of new format zomg 2006-02-22 00:33:19 +00:00
2843c333aa Fixed bug at25472 2006-02-20 03:24:45 +00:00
4369023394 Added a few edit functions to the notes richedit 2006-02-17 20:25:25 +00:00
dc97e18955 fixes for % stuff in statsx and its lang file 2006-02-15 19:44:34 +00:00
c31e2be46f added backward compatibility for % mistakes 2006-02-15 17:31:30 +00:00
7539751fc6 added pcvar funcs 2006-02-15 16:05:20 +00:00
8a8b91998a fixed typo 2006-02-15 10:45:05 +00:00
c7fbc7f55e more gaben 2006-02-14 23:59:24 +00:00
ea5c9f0af4 gaben 2006-02-14 23:56:55 +00:00
76609e2a4a fixed bug with translator cvar not being registered by core 2006-02-14 22:14:12 +00:00
1923d42c5f fixed old fmt bug 2006-02-14 20:28:52 +00:00
13360bec73 reformatted file a bit 2006-02-14 16:57:44 +00:00
f1a4cfee61 compilable now o_O 2006-02-14 15:13:26 +00:00
ac5d87b2c2 commited binaries + project file 2006-02-14 13:42:25 +00:00
bf0c1990dd committed new format() code 2006-02-14 12:01:22 +00:00
a8c01e4865 fixed forwards passing floats as cells to the core
fixed pfn_playbackevent missing a parameter
2006-02-13 20:03:39 +00:00
472613d973 Fixed engine and dll bases screwing up. 2006-02-13 19:31:46 +00:00
323341f67a added request at22274 2006-02-13 14:23:43 +00:00
71c023f485 added CS_TEAM_UNASSIGNED at vittu's request 2006-02-11 22:57:34 +00:00
48d3b6e952 bad ptr checks for strings 2006-02-11 22:56:55 +00:00
2c8808aaff fixed formatter bug on bad control code 2006-02-11 22:48:29 +00:00
82693ccae6 fixed serious OP_FLOAT_CMP bug (boy I was tired) 2006-02-11 21:51:28 +00:00
e74ff6a5a4 committed OP_FLOAT_CMP 2006-02-11 07:06:35 +00:00
eba5b1a920 Fixed 2006-02-11 03:04:45 +00:00
a93001a68b Fixed Null Error 2006-02-11 00:41:28 +00:00
d548457c30 Fixed stupid NULL error 2006-02-11 00:41:11 +00:00
be1bc6f75c removed debug log for float testings 2006-02-10 19:47:09 +00:00
76358f4289 updated makefile 2006-02-10 15:53:13 +00:00
652f8b9f74 commited builds of latest asm stuff 2006-02-10 15:51:37 +00:00
dcaf3066bf experimental optimizer for float ops 2006-02-10 15:43:27 +00:00
b527efde41 fixed bug where showmenus didn't properly clear newmenu bit 2006-02-10 14:16:00 +00:00
a195a0af30 fixed a re-entrancy bug 2006-02-09 12:04:35 +00:00
52aa992a2f fixed recursion problem
fixed handle leak
fixed player defaults
2006-02-09 11:53:22 +00:00
c602308acb fixed bug where exit wasn't guaranteed
fixed menu destroy bug at25132
2006-02-09 11:19:57 +00:00
5a0b3b0f9f added a memcpy for MM 2006-02-09 11:17:22 +00:00
750b098e02 sigh... 2006-02-08 22:59:58 +00:00
2a13d923fa committed menu padding and title setting 2006-02-08 22:09:31 +00:00
3507155189 removed MM-1.18 compat 2006-02-08 21:59:02 +00:00
1e4c71e8e3 fixed blank items destroying menus 2006-02-08 05:39:03 +00:00
8d0a3ac9ae another sync 2006-02-08 04:11:14 +00:00
fb0febb50e Updated to remove unnessasary stocks 2006-02-08 02:17:45 +00:00
60586fdda4 Working at time of commission 2006-02-08 02:14:15 +00:00
b381fc9141 Working at time of commision. 2006-02-08 02:13:58 +00:00
33da5f3737 quick patch for dynamic native issues 2006-02-07 14:23:09 +00:00
3dcaa5742d bumped vers 2006-02-07 13:06:19 +00:00
e59d7c2f01 bumped version 2006-02-07 13:04:01 +00:00
9946a6892c wtfversion 2006-02-07 13:03:06 +00:00
9a5b855e2d fixed bug at25040 2006-02-07 12:43:40 +00:00
a43f62615b stupid typo 2006-02-07 12:19:37 +00:00
459f91af24 optimized this further 2006-02-07 09:02:08 +00:00
29f46a56d9 got rid of stupid "buffor" 2006-02-07 08:57:34 +00:00
a2bd08cf64 fixed bug at16664 2006-02-07 08:56:36 +00:00
208a57eaf8 added menu padding 2006-02-06 15:27:02 +00:00
2879c86d79 added more exit props 2006-02-06 13:24:26 +00:00
506a6e0465 added never display exit option to newmenus 2006-02-06 13:22:33 +00:00
53c029471f removed usage of CVAR_GET_STRING 2006-02-06 13:10:23 +00:00
cc32f33815 lang debugger uses now make_string for THash 2006-02-06 12:57:14 +00:00
e2c1b8c178 Fixed bug where invalid keys were saved as blank translations
Fixed bug where dictionary caches were invalidated before being used
Loads with MM 5:11 now
2006-02-06 11:13:27 +00:00
458f2acfe7 fixed bug at25056 2006-02-06 04:29:50 +00:00
e929dc55bd synced CString.h 2006-02-05 19:16:16 +00:00
b5b42c675d updated to February 2006-02-05 19:14:19 +00:00
278e267690 Fixed potential crash bug in the plugins unit 2006-02-05 13:59:41 +00:00
93ad26fb2a oops, forgot there was a sep. def for this 2006-02-05 08:25:45 +00:00
f8d0e4b90d fixed bug at25028 (teame06) 2006-02-05 08:06:50 +00:00
35e8a67a48 *** empty log message *** 2006-02-05 04:20:30 +00:00
0df187edcd merged lang stuff 2006-02-05 03:41:30 +00:00
2cfebb0234 fixed typo 2006-02-05 02:26:00 +00:00
8edd843f4b removed CDataBuffer reliance 2006-02-05 02:20:45 +00:00
6324161b98 what 2006-02-05 01:00:28 +00:00
f0f8b78df9 added server_changelevel back
fixed bug where NULL FP_STRING could crash forwards
2006-02-05 00:32:20 +00:00
e0d4ad0a06 merged in random changes from twilight 2006-02-04 23:21:03 +00:00
815afdcd11 what 2006-02-03 05:48:55 +00:00
88d2b393d8 cvar queries actually run now
removed old fakemeta code
2006-02-03 04:19:18 +00:00
07affb56f2 works with post now 2006-02-03 03:28:43 +00:00
2ad9a320de added unregister_forward() 2006-02-03 03:27:03 +00:00
df082de817 committed newmenu api, take two 2006-02-03 03:00:48 +00:00
3027b732a5 added player_menu_info 2006-02-03 03:00:27 +00:00
af939f4e8d new menu API 2006-02-03 02:55:27 +00:00
2ab9fce457 Added an information to the welcome page 2006-02-02 10:07:00 +00:00
63b10cfaf5 Fixed DEP bug 2006-02-02 09:34:06 +00:00
dcae78a389 final fixes for strip weapons 2006-02-02 00:45:56 +00:00
ea34df433a patched cvar change exploit (target) 2006-02-01 13:07:36 +00:00
0e3727573e added get_user_footsteps 2006-02-01 13:04:24 +00:00
f40ae48849 removed server_changelevel (at24675 - oneyed) 2006-02-01 12:33:31 +00:00
7070273616 patch at24690 (karlos) 2006-02-01 12:23:30 +00:00
923ecaa0e5 added pev_valid 2006-02-01 12:17:40 +00:00
53d9274b45 added pev_valid() 2006-02-01 12:16:33 +00:00
4426910b9a made find plugin fast inline for speed 2006-02-01 12:10:52 +00:00
eb010688af optimized + fixed parsing in strbreak() 2006-02-01 12:10:26 +00:00
314392bffe removed old cvarquery stuff, added support for queryclientcvarvalue2 2006-02-01 12:09:43 +00:00
28ede82f91 added cell list registering 2006-02-01 12:09:19 +00:00
a5819d8cf8 added create forward natives 2006-02-01 12:08:42 +00:00
2d0e12363f added include defs for new forward creation 2006-02-01 11:54:57 +00:00
cb291dbdd5 sync 2006-01-30 21:40:10 +00:00
44db80bc75 Added madExcept
Updated some captions
Improved the "Cancel" button
2006-01-29 17:24:49 +00:00
bc5445d255 Added madExcept settings 2006-01-29 17:23:19 +00:00
55613eb882 fixed bug at24752 2006-01-27 22:43:51 +00:00
04c54128af fixed case 2006-01-27 09:07:37 +00:00
82cb94ab56 removed old fakemeta #defines
added better mm version handling
2006-01-27 09:07:04 +00:00
82653094fb another synce with SH 2006-01-24 22:51:29 +00:00
7c7422a553 added language debug 2006-01-24 18:47:08 +00:00
018b4645e8 *** empty log message *** 2006-01-24 15:43:49 +00:00
6cec38a329 committed latest compiler 2006-01-24 15:09:27 +00:00
8cc73227c7 removed changelevel forward 2006-01-24 15:02:11 +00:00
93ce1ac470 fixed a forward bug causing client_death to pass weapindex as the damage 2006-01-23 07:27:58 +00:00
bd1999cdfb added amx_mldebug cvar 2006-01-23 00:21:35 +00:00
8d9ad2ce06 fixed bug for checking colored menus in TFC and other mods 2006-01-20 23:24:36 +00:00
8ee50cee1b Commited to show new natives 2006-01-14 03:16:25 +00:00
7183954b08 Fixed a bug in the Code-Inspector
Added madExcept again
2006-01-12 19:14:56 +00:00
564dfbf329 Part of the madExcept component 2006-01-12 19:12:33 +00:00
ab5c11f876 Finally done!!! I finished what DS started:
AMXx Mods may now patch/retreive memory of several varieties directly from the game .dll, mod .dll, or can go free and patch/retreive any peice of memory.

I salute you DS.
2006-01-12 03:55:49 +00:00
73ba5d1644 Updated some captions
Updated the Autocomplete-Check function
Prepared AMXX-Studio for release
2006-01-11 18:02:42 +00:00
fd7f4441fb final version I hope 2006-01-07 06:17:16 +00:00
636f1141e4 removed test code 2006-01-07 06:16:52 +00:00
2eac69e9b4 *** empty log message *** 2006-01-07 05:40:57 +00:00
3b79a063b6 finally, a correct fix 2006-01-07 05:39:40 +00:00
69b6ed5f56 *** empty log message *** 2006-01-07 04:48:02 +00:00
07b9bb9987 okay, works 2006-01-07 04:47:49 +00:00
9578e8ac3d *** empty log message *** 2006-01-07 04:44:36 +00:00
39fd00c5be real fix this time 2006-01-07 04:43:01 +00:00
a3572f7206 Added and working! Array module 1.65 is a go for release! 2006-01-07 04:36:12 +00:00
e8a4b46cc5 removed 4 cmds from statsx, and implemented currentmap and FF status in nextmap (at22858) 2006-01-07 03:26:50 +00:00
6a59d8cd07 patch of compiler binaries 2006-01-07 02:24:58 +00:00
a4db0d927a Fixed bug at22981 2006-01-07 02:20:54 +00:00
bec98dcddd added new cvar for adminslots plugin 2006-01-07 01:04:07 +00:00
e27c0b205f (Marticus)
-Added documentation and cleaned up the code
-Created amx_hideslots cvar to replace #define HIDE_RESERVED_SLOTS
-Removed ackSignal *sigh* and the horribly coded setVisibleSlots function
-Removed client disconnect
-Created global variable gPlayerLimit to be used in both functions
-Moved set cvar sv_visiblemaxplayers to plugin_init
2006-01-07 00:54:40 +00:00
85f14422cb re-added file natives 2006-01-06 22:49:42 +00:00
66c278c64b wrong handle, oops 2006-01-06 21:05:48 +00:00
04113f8a02 merged changes from SH:TinyHash 2006-01-06 18:52:12 +00:00
86c033a922 gab gab 2006-01-06 14:47:59 +00:00
91c082878c wa 2006-01-06 14:44:32 +00:00
3d00b8c545 Merged changes from SH:List
Fixed bug where natives did not use the debugger (experimental)
Removed array size detection :(
2006-01-06 14:37:58 +00:00
0c745590ec Added functions for smashing the stack and memory :) 2006-01-06 14:22:12 +00:00
b46ee941d4 reverted tasks to v1.60 2006-01-06 05:10:17 +00:00
0d3055e505 partial fix for dynamic natives when running on debug mode 2006-01-06 04:59:39 +00:00
4b51565e3b hello my name is pm and i just fixed the bug described in 23888 2006-01-04 23:23:52 +00:00
c9e84c563d Updated to include additional protection for PDATA. 2006-01-03 21:48:59 +00:00
60716cd346 *** empty log message *** 2006-01-03 21:19:11 +00:00
531cc5f2c1 Added some returns in engfunc() and in dllfunc() 2005-12-31 15:09:14 +00:00
d1b290c7a4 Fixed bug at23454 (DeciusMagnus) 2005-12-26 14:38:14 +00:00
8aaa2d859f Modified something in the About dialog 2005-12-24 02:20:08 +00:00
0c6d606fea Added an Auto-Setup feature 2005-12-23 13:19:21 +00:00
8a5806cd25 Added a small hint to the compiler page in the settings dialog 2005-12-18 19:31:50 +00:00
40ca5f8002 *** empty log message *** 2005-12-17 02:16:01 +00:00
e50151343b *** empty log message *** 2005-12-11 18:42:19 +00:00
6aaf11f2a3 updated version number to 1.65 2005-12-11 18:30:52 +00:00
9d480b05af updated a few things in the plugin system 2005-12-11 17:55:35 +00:00
3f36b51f6c Added the plugins directory to CVS and updated the files 2005-12-11 17:31:06 +00:00
7cc586bd0c removed old forward class 2005-12-11 17:11:21 +00:00
b6d6be3c27 Changed a few captions in the about dialog 2005-12-11 16:45:02 +00:00
0b834a3f9b communicate core when setting a new team or deaths 2005-12-08 20:00:43 +00:00
5d5d1e1a7c added request at19456 2005-12-07 00:13:13 +00:00
d55bffede6 *** empty log message *** 2005-12-06 22:47:02 +00:00
806895ebd8 fixed bug when voting multiple maps voting would always fail 2005-12-06 19:06:05 +00:00
914b53933b nothing 2005-12-05 02:28:24 +00:00
402236e51e fixed bug at22532 2005-12-05 02:07:22 +00:00
2ebf822dea added new socket send native 2005-12-05 01:49:16 +00:00
389f470662 format fixes^2 2005-12-03 16:24:27 +00:00
522dccef76 hello 2005-12-03 00:54:26 +00:00
186728053a added autohud
format fixes
2005-12-02 23:34:11 +00:00
507a901a9e Changed a few language strings (again) to English
Fixed bug in the replace system
Fixed bug in the Autcomplete Check
Changed version number to 1.4
2005-12-01 16:30:26 +00:00
83d2e1a510 *** empty log message *** 2005-12-01 13:45:30 +00:00
f336585d4f Fixed GCC compatibility for now.
Removed ps_locked and replaced with ps_error.
Added set_fail_state.
Fixed md5_file.
2005-12-01 13:42:28 +00:00
80fdb2cdb2 Removed ps_locked flag 2005-11-29 21:59:21 +00:00
8251ffd25f Fixed bug at22273 (karlos) 2005-11-29 21:54:43 +00:00
5ad341edd7 EXPERIMENTAL BTree+DL ADT for Tasks (USE AT RISK) 2005-11-29 00:52:35 +00:00
2f8939967e fixed but at22303 (VEN) 2005-11-28 16:22:12 +00:00
6d84dff2b0 tiny optimization 2005-11-26 20:59:47 +00:00
8112fbe161 fixed bug at21983 2005-11-26 20:38:58 +00:00
e9db0c8c76 again bugfixes 2005-11-25 21:44:18 +00:00
cbcc91cc09 BETA optimizations 2005-11-22 04:14:07 +00:00
7ed757dc0d added autohud support
format fixes
2005-11-21 22:30:32 +00:00
8196ddd0b3 added replace_all stock (by jtp10181) 2005-11-21 21:47:54 +00:00
1a48ebb345 format fixes 2005-11-21 20:31:18 +00:00
c6fc34a64d Rewrote format() parser to be re-entrant and easier to read
Added various optimizations
Fixed memory leak in sh_tinyhash
2005-11-21 10:04:43 +00:00
f13599177f Rewrote language backend for integrity checking and optimization
Replaced CRC32 system with real hash-map
2005-11-21 01:35:37 +00:00
bb292d13ad added remove_filepath stock 2005-11-20 23:45:53 +00:00
6f2121cd4d Fixed bug in prune()
Synced changes from SourceHook
2005-11-20 20:54:20 +00:00
3324d65f3f fixed amx_restrict off and related cmds not working as they should (jtp10181) 2005-11-20 20:44:12 +00:00
5c5ca9251e New offsets from karlos 2005-11-20 20:01:03 +00:00
30f7f6d51f Fixed typo in SDK 2005-11-20 20:00:31 +00:00
922a2f6006 bumped version numbers 2005-11-20 19:47:49 +00:00
54f3bba89d Bump of versions+SDKs 2005-11-20 19:45:59 +00:00
5d8150637b Bump of version+SDK 2005-11-20 19:42:14 +00:00
3938933384 added new time include file
added get_time_length stock (Brad)
2005-11-20 19:27:07 +00:00
0482883a8a Resync of compiler build 2005-11-20 19:18:40 +00:00
9e4b1661e3 Fixed bug at21914 (faluco) 2005-11-20 19:10:13 +00:00
4040410c97 first attempt on lang error logging 2005-11-20 03:47:47 +00:00
8edf4d674f removed a native 2005-11-20 03:10:02 +00:00
847158f400 what 2005-11-20 02:36:52 +00:00
6ca3edad0c added GetFilename function 2005-11-20 00:00:33 +00:00
0551b46c8b gcc4 compatibility (Nijule) 2005-11-19 22:44:17 +00:00
e5a798357c Patch at21699 (Nijule) 2005-11-19 21:52:56 +00:00
c051c7f5b7 *** empty log message *** 2005-11-19 21:48:27 +00:00
322ad6fd68 New versions of compiler for at21691 2005-11-19 21:43:55 +00:00
a5bd8463e8 Fixed bug at21691 (Podunk) 2005-11-19 21:38:50 +00:00
71926e6d03 get_user_attacker fixes
version bump
2005-11-19 21:24:49 +00:00
803852ee0c small bug fix 2005-11-19 20:37:44 +00:00
fc6a193765 new hudchanneler 2005-11-19 20:31:11 +00:00
db0dd03128 Added new function to calltips: opens include file on click
Fixed some bugs in the menu generator
2005-11-19 19:46:29 +00:00
429798ae35 *** empty log message *** 2005-11-19 18:57:05 +00:00
4cc1218391 channels should clear again 2005-11-19 18:55:29 +00:00
83ea8b82b9 Fixed issue at19616 2005-11-19 09:26:30 +00:00
32cd6be7f5 Fix for issue at19616 2005-11-19 09:26:06 +00:00
4d9f2ded74 Fix for issue at19199 2005-11-19 09:16:27 +00:00
6163e25d7d *** empty log message *** 2005-11-19 09:07:28 +00:00
a3d0767b22 potential fix for bugs related to TSFUN 2005-11-19 01:36:58 +00:00
62e7e22a93 Added functionality for the auto-channeler 2005-11-19 01:25:34 +00:00
694d7c118c Merged in karlos's code, fixed potential get_user_weapon problem 2005-11-19 00:34:25 +00:00
a8bb28caa4 Committed new SDK function for player property mappings 2005-11-19 00:33:51 +00:00
23fb93a3cc - Updated Calltips
- Fixed bugs in register plugin function
- Added "Autocomplete Check", allows you to customize autocomplete items
- Added a new dialog (the parameter info dialog) to the loadinfo record/struct
- Added a new unit called UnitACCheck.pas
2005-11-18 23:35:58 +00:00
778c2080b0 zomg fix for oldmenus^2 2005-11-17 23:04:43 +00:00
94308b208a fixed bug at19374 2005-11-17 21:12:50 +00:00
b00d313ee8 fixed but at21777 2005-11-17 18:52:35 +00:00
4e497d9737 fix for autobuy cmd being used if the restrictions where set after cl_setautobuy (thanks jtp10181) 2005-11-17 18:23:48 +00:00
8cc10bdb3d patch for old showmenus 2005-11-15 21:58:47 +00:00
e816c86d7a synced with sh_sting.h 2005-11-15 20:48:11 +00:00
db77e12615 synced with sh_string.h 2005-11-15 20:21:29 +00:00
79c4d0ca5c added linux compat 2005-11-13 22:34:32 +00:00
34f12e76c4 added request at20855 2005-11-13 22:21:15 +00:00
2ac00713a7 fixed a menu bug at19364 2005-11-13 20:33:30 +00:00
c5761610b8 Small bugfixes 2005-11-13 10:40:59 +00:00
d09a8e1aac added checks for the executeforwards 2005-11-13 00:52:49 +00:00
16f402ae49 fixed a forward bug that made this module a surprise box 2005-11-13 00:45:45 +00:00
1e5c9b5ed7 added a new stock by Suicid3 (at20399) 2005-11-12 22:43:55 +00:00
3125630b21 Partial fix for bug at19662 2005-11-12 18:55:37 +00:00
32fd0f9e93 Fixed small bug in the indent function 2005-11-12 15:11:14 +00:00
4165548661 fixed bug at21142 2005-11-12 01:22:01 +00:00
31b71760e4 strip_user_weapons should reset now the weapon status 2005-11-12 00:47:34 +00:00
18bf26efb6 fixed but at20584 2005-11-12 00:46:26 +00:00
d190b207b4 linux fix 2005-11-09 22:36:52 +00:00
c4d120082b just another bug fix (or two) 2005-11-09 16:48:21 +00:00
38178ea9fa Important bug fix and updated the MOTD generator 2005-11-09 14:32:07 +00:00
0dd88dccbd fixed and improved function at20081 2005-11-07 16:37:47 +00:00
78b35d80ee Fixed some bugs in the menu generator
Fixed bug in the AutoUpdate function
2005-11-06 14:52:50 +00:00
a66f13fc91 Small bugfix, added another feature (saves now the last keywords) 2005-11-05 17:39:12 +00:00
1cb99082e2 Fixed a small output bug 2005-11-05 11:20:52 +00:00
6ea52a9a08 Added new feature: Auto Disable (disable auto-update if plugin has more than xxx lines, should prevent lags) 2005-11-02 15:36:24 +00:00
efe4b674e2 Fixed another bug (I had fixed it once but removed the fix accidentally) 2005-11-02 14:17:00 +00:00
8016d02319 Fixed addon bug 2005-11-02 13:42:05 +00:00
67c0230a62 Fixed bugs 2005-11-01 03:07:47 +00:00
d5c75fd6a5 What... 2005-10-30 14:17:32 +00:00
fc9e39a021 Updated components, added 2 new units 2005-10-30 10:33:16 +00:00
be1475b732 fixed bug at20181 ( why was an #if 0 in the function :o ) 2005-10-29 18:27:24 +00:00
2931247559 fixed bug at19476 2005-10-29 18:19:23 +00:00
9657430ef7 fixed bug at20423 2005-10-29 02:13:29 +00:00
d5cfb53cf8 added request at20845 (azrael) 2005-10-28 12:30:11 +00:00
10a64737b5 Added optimizations to the task system
Added optimizations to the forward system
Fixed some debugger errors
2005-10-25 20:38:00 +00:00
0be7540637 added a space :o 2005-10-25 16:55:16 +00:00
3ced207dd3 Fixed forward bugs 2005-10-18 21:29:51 +00:00
d2fb486e70 Upcasting args to cell before passing to MF_ExecuteForward 2005-10-18 21:17:12 +00:00
c8d69c41bc Hello quickfix 64bit negative values to executeForwards -> now upcasting everything 32bit to cell before passing to executeForwards 2005-10-18 21:05:52 +00:00
3d59eabdc5 Graaght. Typing. 2005-10-18 21:05:15 +00:00
e8a6126473 fixed but at20342 (jtp10181) 2005-10-16 00:28:20 +00:00
62e1856229 Added 3 more plugin messages (SCM_PAWN_FILECOUNT, SCM_CPP_FILECOUNT, SCM_OTHER_FILECOUNT)
Fixed load bug (if you loaded a textfile and the tab "Other projects" wasn't active you got an error message)
2005-10-13 14:49:40 +00:00
21caa9a0de Really fixed callfunc this time (debugger invocation error) 2005-10-13 05:27:13 +00:00
a46ec5357e Am I wrong or should this be this way to prevent security bugs? 2005-10-09 15:39:20 +00:00
ca70678155 fixed bug at19895 2005-10-08 01:35:11 +00:00
c3450df360 - Upgraded Code-Inspector
- Now checks language strings
  - New design
  - Better parsing
  - Displays actions
- Added function: can't load files twice
- Updated Code-Explorer
  - now faster
  - fixed a few small bugs
  - now keeps selection
- Updated Settings-Dialog
- Fixed output bug (showed sometimes huge numbers as line numbers)
- Fixed design bug (displayed wrong plugin data on start)
- Fixed small bug in the color dialog
- Fixed small start bug (didn't show real plugin data on startup)
- Added restore function
- Fixed code-explorer bug (didn't recognize @-functions)
- Fixed highlight bug (had problems with ^" and ^ in strings)
- Fixed potential crash bug
- Fixed another highlight bug
- Fixed aother code-explorer bug...
- Added 2 settings (for auto-complete and calltips)
- Added SCM_SETTINGS_REMOVEPAGE-message
- Fixed SCM_SETTINGS_CREATEPAGE bug
2005-10-07 21:52:48 +00:00
76b6510a27 686->586 2005-10-02 20:15:52 +00:00
a75feafc4f Downgraded compile time flags to 586 2005-10-02 20:12:48 +00:00
86c2c2db02 Fixed bug where core isn't notified of a team change 2005-10-02 09:57:25 +00:00
21d13507b1 fixed an error output msg 2005-09-28 22:10:11 +00:00
adfe7de08e callfunc_begin_i should not take -1 2005-09-27 19:51:23 +00:00
116536fe36 Fix for bug 19453 (karlos) 2005-09-26 22:11:44 +00:00
f7dbc25461 fixed a small typo 2005-09-23 13:01:33 +00:00
30736ebb53 Updated SciLexer 2005-09-22 11:51:01 +00:00
dc5e458d9e Updated installer script to 1.60 2005-09-22 07:06:28 +00:00
4feaa1449f Fixed bug in Makefile 2005-09-22 06:34:58 +00:00
25002f559a Fixed bad compiler build (oh my god, linux sucks) 2005-09-22 06:16:45 +00:00
41f38424ee Fix for linux 64bit filenames 2005-09-22 05:12:23 +00:00
862ee2029a Bumped version 2005-09-22 03:42:43 +00:00
cd30fb0c1c Bumped version numbers 2005-09-22 02:23:13 +00:00
59ad6c49e3 Bumped version 2005-09-22 02:14:21 +00:00
2d255829a6 bumped version 2005-09-22 02:13:45 +00:00
be762580b7 Bumped versions 2005-09-22 02:13:23 +00:00
ae8bf10746 Fixed bug at18021 (hondaman)
Fixed bug at18924 (Arnold)
2005-09-18 03:26:26 +00:00
324f4c58a8 cleaned revision for cstrike plugins 2005-09-18 03:19:34 +00:00
a816767abb Fixed bug at18919 2005-09-18 02:59:36 +00:00
164a47bde4 Import of windows version 2005-09-18 01:25:22 +00:00
545769e241 Bumped version number 2005-09-18 01:15:03 +00:00
dcf39196d5 Ugly hack to get around ELF garbage 2005-09-18 01:14:44 +00:00
58dd553d00 Loads from non-cwd now 2005-09-18 01:14:23 +00:00
f64ca6a827 Stupid ugly hack to get around ELF's garbage
Import of newer compiler
2005-09-18 01:13:18 +00:00
ebd4974c75 final cleaned revision (I hope) 2005-09-16 23:48:51 +00:00
4b1769f457 Added feature request at18988 2005-09-15 17:53:02 +00:00
f58c0f4508 added request for EKS at18961 2005-09-15 00:51:27 +00:00
4d7bdcde47 Fixed configs not being copied on Linux 2005-09-14 03:41:20 +00:00
c7a620424e *** empty log message *** 2005-09-14 02:38:19 +00:00
24260137ec hope to have fixed the spacings finally 2005-09-14 01:40:48 +00:00
315e69797d more fixes 2005-09-14 00:42:56 +00:00
dddc693369 Fixed spacing 2005-09-14 00:38:48 +00:00
13e654aafe small format changes 2005-09-13 16:05:57 +00:00
f02c73f94c Correct spacing! 2005-09-13 07:37:50 +00:00
92f79ffe88 left debug stuff in 2005-09-13 07:36:01 +00:00
db33e50f92 Fixed a bug where stocks using native names crashed 2005-09-13 07:32:07 +00:00
2ad557024e more cleanups 2005-09-13 01:00:19 +00:00
ddf3b6df32 new cleaned-up version of the plugins (no more OLOcode :D) 2005-09-12 21:06:24 +00:00
12bf140931 Fixed a small save bug 2005-09-12 16:08:45 +00:00
0d65bb64f9 Updated for latest version 2005-09-11 20:54:03 +00:00
c6e265b414 little changes 2005-09-11 20:35:35 +00:00
9ba597b5c1 Fixed bug at18791 (Maddo) 2005-09-11 19:15:49 +00:00
b6a4514bd0 Fixed bug at18763 (karlos) 2005-09-11 18:57:33 +00:00
a6daebe7d4 Made SQL changes by Lazarus Long 2005-09-11 18:37:55 +00:00
471ba0adbf Updated FTP function (now handles misunderstood SITE CHMOD commands) 2005-09-11 15:45:42 +00:00
7225aa3cc0 Fixed font bug 2005-09-11 14:32:16 +00:00
88b833f879 Updated version to 1.60 2005-09-11 11:52:19 +00:00
6f8816c13f Fixed another shortcut bug
Released 1.2
2005-09-11 11:15:22 +00:00
95ccd6078c Fixed bug at18607 (lantz69) 2005-09-11 07:19:06 +00:00
2e5c71f771 Fixed bug at18607 (lantz69) 2005-09-11 07:17:31 +00:00
eeb77395cd Fixed bug at18615 (Lazarus Long) 2005-09-11 07:13:44 +00:00
e3afe22a48 Fixed initialization bug in native filters
Fixed bug where address boundaries were not checked on arrays
2005-09-11 05:43:17 +00:00
73d70aff29 added module_exists 2005-09-11 04:43:40 +00:00
120c849e4b Added native filter 2005-09-11 04:32:40 +00:00
138b732e75 New plmenu 2005-09-11 04:31:13 +00:00
760e29e531 Finalized new debugging system 2005-09-11 03:58:38 +00:00
401ee3c97f Added another function or something 2005-09-11 03:55:48 +00:00
6e52ce7678 New natives 2005-09-11 03:13:45 +00:00
89aab62549 Removed them from AMXX-Studio 2005-09-10 21:58:40 +00:00
468d99ff70 Updated about dialog
Updated a few plugin commands
Removed splashscreen
Added some themes
Updated some captions
2005-09-10 21:55:22 +00:00
2d787f43de updated version of CString.h 2005-09-10 21:04:05 +00:00
f0c5e44985 fixed plugin location comments on stat plugins
replaced 0.20 with AMXX_VERSION_STR
removed all require_modules
2005-09-10 20:51:49 +00:00
76760b221d more cleaned-up code 2005-09-10 20:09:14 +00:00
612a86dbef Added new debugging functions 2005-09-10 18:26:13 +00:00
369ece2d56 ----------------------------------------------------------------------
Linux compatibility problem in debugger.cpp, made Makefile also compile
debugger.cpp
2005-09-10 18:19:02 +00:00
cc37f479aa Added Phase 3 of the debugger (debug tracing from plugins) 2005-09-10 07:24:26 +00:00
deaaf20713 Fixed preproc bugs 2005-09-10 05:30:24 +00:00
e566413224 Fixed MORE lines 2005-09-10 05:23:30 +00:00
368856f122 Fixed lines 2005-09-10 05:22:06 +00:00
52cc204787 Fixed numerous bugs in preprocessor (string literals being parsed, mismatched args being wiped) 2005-09-10 05:04:23 +00:00
52b1d67ca2 latest cleaned files for today (i cant read more :o ) 2005-09-10 03:39:23 +00:00
16ad8739e7 started the clean-up of cpp files 2005-09-10 00:59:24 +00:00
e67457440d cleaned-up versions of header files 2005-09-10 00:38:42 +00:00
fc955009da cleaned-up version of ccmd.h 2005-09-09 23:54:15 +00:00
0dc2ba85e8 Added set_error_filter() 2005-09-09 23:13:34 +00:00
de65e65854 added set_error_filter 2005-09-09 23:03:26 +00:00
d95f2cba37 Fixed another small shortcut bug
Updated "Select color" dialog
Removed "Do not restore caret" property, not useful
2005-09-09 23:01:09 +00:00
e2a521583a Fixed shortcut bugs
Fixed include bug
Changed a few small things in the core
2005-09-09 16:49:41 +00:00
f8aac5e88d Reworked code to support error handling, LogError() is separate from DisplayTrace() implementation 2005-09-09 16:04:44 +00:00
4738c92b8e Committed new debugger with AMX fixes 2005-09-09 03:23:31 +00:00
7ce59966fc Replaced with faluco's cleaned-up version of meta_api.cpp 2005-09-08 22:20:27 +00:00
afa1337e62 because gabe doesn't rollover, he just expands 2005-09-08 15:29:31 +00:00
cc34f468f0 Added a new math stock function. 2005-09-08 15:24:28 +00:00
3f9598fcbb Changed .amx in examples for pause() and callfunc_begin() to .amxx (as requested by XxAvalanchexX on the forums) 2005-09-08 13:05:44 +00:00
97b5391118 Logs the map name on mapchange (as requested by lantz69 on forums) 2005-09-08 13:03:38 +00:00
227c13d12c Added abs(x) stock 2005-09-08 12:58:17 +00:00
729932476b Fixed memory leak
Updated Modified-Event (now only one parameter [the modified text])
2005-09-07 22:31:31 +00:00
7c21deb0f2 Fixed memory leak
Updated Modified-Event (now only one parameter [the modified text])
2005-09-07 22:20:28 +00:00
80048eba61 Fixed memory leak
Updated Modified-Event (now only one parameter [the modified text])
2005-09-07 22:10:21 +00:00
0552e5ef58 Deprecated jghg2 include 2005-09-07 15:40:46 +00:00
ce881a7d30 Fixed bug at18558 (Nijule) 2005-09-07 00:11:10 +00:00
80dd7f034d version bump 2005-09-06 22:28:47 +00:00
5fac746feb compiler fix merge 2005-09-06 22:28:32 +00:00
67f012b74a Fixed bug where static declarations would crash 2005-09-06 21:34:33 +00:00
5705e69abb Fixed bug where level>1 arrays were walked incorrectly 2005-09-06 20:36:02 +00:00
bece1e6d0c Added float_to_str and str_to_float natives 2005-09-06 16:34:17 +00:00
f2527ecc86 The query_client_cvar native now checks for a non-zero g_engfuncs.pfnQueryClientCvarValue before proceeding 2005-09-06 16:31:54 +00:00
66b95f64a5 Now checks whether there is a non-zero g_engfuncs.pfnQueryClientCvarValue before setting newdll's pfnCvarValue function pointer 2005-09-06 16:31:07 +00:00
af79fe8e20 Added natives str_to_float and float_to_str; indents are now tabs 2005-09-06 16:29:27 +00:00
d3e2bad4e7 Added query_client_cvar native 2005-09-06 10:14:32 +00:00
6bebf37f1a An optional array parameter (LIKE TEH TASKS ONE) can be now passed to cvar query handlers 2005-09-06 10:12:02 +00:00
2f27b7da8d zomg! updated teh vectorz codeses a bit! Hopefully didn't break anything 2005-09-06 09:34:13 +00:00
824caab2c5 Fixed bug p1123143748 (Twilight Suzuka) 2005-09-06 03:00:01 +00:00
a105bc7402 Fixed bug at18003 (Geesu)
Fixed bug p1123149221 (Twilight Suzuka)
2005-09-06 01:55:41 +00:00
81ab33d794 Fixed shortcut bug in the settings dialog (couldn't set hotkeys to BkSp etc.)
Added "Reset" button to shortcuts page
2005-09-05 22:33:45 +00:00
e90364c17b Fixed bug at18525 (twistedeuphoria). 2005-09-05 22:05:23 +00:00
ac4014ff5a Fixed bug at18473 (Greenberet). 2005-09-05 21:59:44 +00:00
ad634924fa Fixed two bugs from at18519 (Lord of Destruction) 2005-09-05 21:43:05 +00:00
2d5f9ba181 Using the (*g_engfuncs.pfnQueryClientCvarValue) directlty instead of the macro so that it compiles on both metamod and metamod-p 2005-09-05 20:51:24 +00:00
aa0e4e121e Now properly cleaning up pending client cvar queries in the queue on client disconnect 2005-09-05 19:56:40 +00:00
f8227a09b4 updated to September 2005-09-04 22:40:43 +00:00
46130a6754 *** empty log message *** 2005-09-04 13:25:24 +00:00
58c006a9c8 Ready for release (1.1) 2005-09-04 13:03:34 +00:00
ea1d72401c Fixed switch bug, now even (much) faster
Updated aboutbox
2005-09-03 23:47:40 +00:00
fdbe0e2064 Upgraded plugin-system (other command call and now 93 commands)
Customizable IRC Paster
Updated version number from 1.01 to 1.1
2005-09-03 20:00:46 +00:00
e239801671 fixed get_map_info function 2005-09-03 13:59:33 +00:00
4be88a5015 version bump 2005-09-02 07:10:56 +00:00
ee02d0b13d this must be off! 2005-09-02 04:07:49 +00:00
2ec084ffa3 Patch for bug at18251 2005-09-02 04:06:47 +00:00
6636c20336 Fixed bug at18250 2005-09-02 03:44:15 +00:00
27c80b00f8 Fix for bug at18293. 2005-09-02 03:28:44 +00:00
6bcb72952c Applied patch for bug at18341 (jtp10181) 2005-09-02 02:46:42 +00:00
8c17be27dd Updated AMXx version 1.56 2005-09-01 17:11:48 +00:00
0232b0abee Bumped versions 2005-08-31 20:36:41 +00:00
12fd7a9f0d Added new DBI functions
Fixed bugs in field getting
2005-08-31 20:32:29 +00:00
71c6e70706 Updated for new API 2005-08-31 20:08:12 +00:00
c5cc94ba98 Added new natives 2005-08-31 04:36:25 +00:00
8220cc4c01 is_in_viewcone from in_view_cone 2005-08-30 23:22:27 +00:00
57ce74c4c7 Bumped version, lowered -O flag 2005-08-30 18:43:11 +00:00
5d6c72bf42 Patch for pausing issues 2005-08-30 07:18:47 +00:00
63b2bbc67e Made more de-allocation safety precautions 2005-08-30 07:15:27 +00:00
12f628e3d7 Fixed bug at18162 (vittu) 2005-08-30 07:00:49 +00:00
cd8d800eb7 Fixed bug at17920 (Grasshoper) 2005-08-30 06:59:50 +00:00
160ab3572b Fixed typo at18108 (FireStorm) 2005-08-30 06:57:41 +00:00
dc57ef1e0c Simple implementation for cvar queries 2005-08-27 23:00:44 +00:00
ca1544564c Upped to 3.2.5. 2005-08-27 21:27:35 +00:00
462916d00f Got rid of many annoying warnings MSVC7.1 was reporting 2005-08-27 09:55:32 +00:00
e15761b79a Updated plugin system 2005-08-27 01:47:15 +00:00
270d898f82 Fixed shortcut bug 2005-08-26 23:22:30 +00:00
2a2d5697b8 Fixed some bugs
Upgraded exception handler, now using madCollection
2005-08-26 22:59:25 +00:00
b17f277a1b Added AMXX-Studio to CVS 2005-08-26 19:07:54 +00:00
c15ed5741a Added AMXX-Studio to CVS 2005-08-26 18:53:19 +00:00
9e035dc744 Added AMXX-Studio to CVS 2005-08-26 18:29:39 +00:00
ac279b37e4 Removed old Makefile 2005-08-26 15:57:50 +00:00
974fdc950e Added new standard makefile 2005-08-26 15:54:42 +00:00
8bb01423b9 Updated api 2005-08-25 09:40:29 +00:00
401a23a298 Updated install script 2005-08-25 09:34:31 +00:00
7ac9ed4b80 *** empty log message *** 2005-08-25 09:27:32 +00:00
6fdcd8ffae Fixed NS build 2005-08-25 09:20:10 +00:00
d50a6302e0 ugh 2005-08-25 09:09:35 +00:00
5fd891bc32 Fixed version # 2005-08-25 08:34:26 +00:00
864f7c268e Fixed module for AMD64 2005-08-25 08:34:09 +00:00
4770f28a18 *** empty log message *** 2005-08-25 08:26:28 +00:00
51a4e2bf4e *** empty log message *** 2005-08-25 08:21:07 +00:00
c213c771d2 Fixed compression on Linux 2005-08-25 08:20:11 +00:00
0176d3a2ae Actual fix for compression! 2005-08-25 08:02:48 +00:00
92653ceebc Fixes for compression 2005-08-25 07:50:21 +00:00
c9051ad364 Fixed includes 2005-08-25 07:34:47 +00:00
94d350118d *** empty log message *** 2005-08-25 07:30:34 +00:00
2e22dde409 Removed extra forwards 2005-08-25 07:16:17 +00:00
4dad81af30 Merged in new ts includes 2005-08-25 07:13:48 +00:00
b271b01b13 Synced to Twilight's stuff 2005-08-25 07:12:52 +00:00
a17b879380 Merged in original TSFun 2005-08-25 07:09:16 +00:00
ea05af9fe8 updated to August 2005-08-25 01:15:30 +00:00
d661196429 Fixed bug at17860 2005-08-25 00:19:39 +00:00
1114443a43 Fixed for AMD64 compatibility 2005-08-24 18:13:40 +00:00
d802a3c961 gcc-3. compat 2005-08-24 07:32:01 +00:00
e2226ae809 Fixed linux compiling 2005-08-24 07:16:45 +00:00
fd8a27013b CVS Cleanup 2005-08-24 07:07:34 +00:00
b12224eabd CVS Cleanup 2005-08-24 07:01:02 +00:00
c30c3cf35c CVS cleanup 2005-08-24 06:57:32 +00:00
f828cde999 Updated ESF and CS 2005-08-24 06:56:02 +00:00
d05c381789 Added cstrike specific switch 2005-08-24 06:39:52 +00:00
245054cf48 Fixed bug at17739 (mysticssjgoku4) 2005-08-24 06:29:12 +00:00
da82ce757f Defaulted engine+fm on 2005-08-24 06:19:41 +00:00
4d74743138 Removed esf module 2005-08-24 06:15:41 +00:00
c1db39d086 Added Corona Byte's EvolutionX core 2005-08-24 06:13:55 +00:00
d516824936 Add copy exclusion filters
Repaired windows builder
Fixed /build to be /rebuild
2005-08-24 05:19:23 +00:00
10328f5f81 fixes 2005-08-24 05:08:05 +00:00
d4f09aac74 Wrong, look at the distro. And in the future change for all mod config sets if you do 2005-08-24 03:20:09 +00:00
8f97ed7934 Deleted bad file 2005-08-24 03:14:13 +00:00
1fcf7628a3 Added in real file 2005-08-24 03:13:57 +00:00
bdd740f8ab Added makefile 2005-08-24 02:54:39 +00:00
82fed37247 Updated to work on Linux, redesigned core 2005-08-24 02:53:38 +00:00
5b208eb9f5 gcc-3 compat 2005-08-24 02:36:05 +00:00
9be88ffa42 Linux compat, cleaned up newdll 2005-08-23 23:54:54 +00:00
f54d112bbb Language sync 2005-08-23 01:24:42 +00:00
96c4d33da4 - Updated to Sqlite 3.2.3. See sqlite.org for details about new stuff.
- Base dir for db files is now changed to the game mod dir. Update your config files!
2005-08-22 10:12:22 +00:00
bad4c02647 This file copied from mysql module... I assume this was forgotten during the last commit of amxxmodule.cpp... 2005-08-22 09:18:55 +00:00
70140ffc8f Fixed team menu. Should now work 100% to switch players between teams. However when client uses VGUI menus I haven't been able to close the class selecting window. It is (should be) only a cosmetic flaw though. 2005-08-22 08:01:01 +00:00
53e6bb6b50 No default sql 2005-08-22 01:04:41 +00:00
4cb7986426 admin.sma was "slightly" incompatible for people using sqlite. This version is courtesy of Lazarus Long who fixed this. Thanks. 2005-08-22 00:26:18 +00:00
18ba13be84 Removed the admin_sql.amxx line. It's all in admin.sma now, isn't it??? 2005-08-22 00:21:49 +00:00
dd371c4dbe no idea, I changed something though 2005-08-21 22:48:22 +00:00
7ea47c5a96 Fixed a deallocation mismatch with debug plugins in linux 2005-08-21 21:54:14 +00:00
5693d2629e Attempted fix at DEP 2005-08-21 19:30:27 +00:00
24d9e3266e wrong include, added pdata 2005-08-21 16:38:45 +00:00
b3b3ce4c2d added more pdata funcs 2005-08-21 16:36:40 +00:00
5882802a3e Added set/get pdata string 2005-08-21 16:33:38 +00:00
94e19aae0c Removed newdllfunc() and related NEWDLLFunc_* stuff. :-P (yes I finally read Alfred's post through) 2005-08-18 20:51:41 +00:00
7d51404aeb What!!! 2005-08-18 15:47:28 +00:00
1cdb12c4e4 Added NEW_DLL_FUNCTIONS to FM_* and a newdllfunc() native to call these... Although I'm not sure there is a reason to call those?
Anyway it will be needed later when client cvar query function is implemented.
2005-08-18 09:33:51 +00:00
e9993cce25 amd64 == no more libstdc++ 2005-08-18 08:44:01 +00:00
80bd845182 *** empty log message *** 2005-08-18 08:36:48 +00:00
f986202b06 AMD64 no stdc++ support 2005-08-18 08:33:21 +00:00
a4168a2096 version bump 2005-08-18 07:53:14 +00:00
3e85589930 Fix for bug at16876 (TheRising) 2005-08-18 07:05:33 +00:00
b5a57da29c Fixed linux build (I think) 2005-08-18 07:03:43 +00:00
58fec512e5 Now requires GCC-3 to compile, fixes retarded linking problem 2005-08-18 07:01:47 +00:00
a6ca045086 More SDK syncs 2005-08-18 06:41:59 +00:00
e401231d25 *** empty log message *** 2005-08-18 06:40:24 +00:00
9ddc24898f same win32 fix 2005-08-18 06:37:50 +00:00
f5350c0e0e fix for win32 2005-08-18 06:37:05 +00:00
fa64bef511 New SDK for gcc-3 compilations 2005-08-18 06:34:34 +00:00
29bfd81b36 New SDK for gcc-3 compilation 2005-08-18 06:32:59 +00:00
2d2506f1c4 Added memalign include 2005-08-18 01:04:52 +00:00
f334fec0a3 Added linux compile of altered JIT 2005-08-18 00:32:08 +00:00
03b6d3e77d Fixed alloc/dealloc mismatches 2005-08-18 00:29:43 +00:00
661f6c9851 Fixed bug at17357 (FireStorm) 2005-08-17 18:16:26 +00:00
593e013572 fixed typo 2005-08-17 17:53:11 +00:00
b04498cddb Experimental fix for bug at16815 (karlos) 2005-08-17 17:32:51 +00:00
8648bf32a3 Improved error reporting a bit 2005-08-17 17:21:57 +00:00
1768ae4b23 Fixed bug at17117 (Twilight Suzuka) 2005-08-17 17:07:41 +00:00
80e6d31998 updated sdks 2005-08-17 16:52:12 +00:00
381e331dda updated sdk 2005-08-17 16:50:01 +00:00
13c65f006b SDK no longer manages memory by default 2005-08-17 16:48:31 +00:00
4e8eff3e04 Fixed bug at17021. 2005-08-17 16:41:38 +00:00
572ad38366 Quick fix for bug at16854 (twistedeuphoria) 2005-08-17 16:16:56 +00:00
b2ade117ec Added bug fix at17218 (Freecode) 2005-08-17 16:12:45 +00:00
9eb36bd2bb Fixed bug where first call had wrong stack alignment
Tiny optimizations
2005-08-17 15:57:11 +00:00
85b7ac740b Experimental JIT fixes for linux crashing (no more xchg of esp) 2005-08-16 23:09:55 +00:00
98d3fb79d7 Fixed some mmgr bugs 2005-08-15 21:38:03 +00:00
bf092b4f95 Updated to Sqlite 3.2.2. 2005-08-11 19:06:54 +00:00
a4a9613f5b *** empty log message *** 2005-08-11 02:49:58 +00:00
ad86bf636f enabled statsx by default 2005-08-10 18:37:02 +00:00
d0b5886d7d Added cs_get_armoury_type and cs_set_armoury_type 2005-08-07 20:43:29 +00:00
aa75a143fc This should fix the problem where bots can't hit players using weapons other than the knife. 2005-08-07 13:38:34 +00:00
7144f5c794 updated error handler 2005-08-04 23:46:22 +00:00
befb651268 fixed design bug (adds now Skipped when file is skipped)
fixed ESF install bug (didn't install, invalid pathes)
2005-08-03 18:45:16 +00:00
c8fdea6216 Fixed bug found by T(+)rget 2005-08-03 16:33:52 +00:00
4a6a16c627 NADE_CATCHED changed to NADE_CAUGHT 2005-08-03 15:01:54 +00:00
6256687272 bumped 2005-08-03 01:54:16 +00:00
5be9ba4a68 Fixed esf 2005-08-03 01:17:27 +00:00
8f61073f43 Updated installer script 2005-08-03 01:14:17 +00:00
a973adb4f2 added library 2005-08-02 20:00:29 +00:00
96c9fc8bc8 Changes for linux compatibility 2005-08-02 19:05:51 +00:00
d472d5d309 Slightly buggy but acceptable for linux >:\ 2005-08-02 19:05:38 +00:00
a819a494b8 ugh, amd64-32 compat 2005-08-02 18:37:59 +00:00
f2c3dfa874 added AMXX_VERSION_NUM 2005-08-02 14:06:17 +00:00
fe3645d809 More gcc-3 whining 2005-08-02 11:51:31 +00:00
b9ff24171f AMD64+gcc-3 complains otherwise 2005-08-02 11:43:26 +00:00
59fb0a39b2 added desc box 2005-08-02 11:40:46 +00:00
94202eec34 tl sync 2005-08-02 11:38:57 +00:00
ef8715892b More hax 2005-08-02 11:19:56 +00:00
e5ce86d61a gaben 2005-08-02 11:19:08 +00:00
7825364e06 hax 2005-08-02 11:15:15 +00:00
5cba645e49 latest sdk 2005-08-02 11:13:23 +00:00
ef4d04a7e1 *** empty log message *** 2005-08-02 11:12:42 +00:00
0302803f38 rebuild jic 2005-08-02 10:37:23 +00:00
d57004c91f *** empty log message *** 2005-08-02 10:26:51 +00:00
f5fe076ec1 oops that was win32 2005-08-02 10:18:09 +00:00
7eaa8a1a39 Added makefiles, fixed template bug in nvault 2005-08-02 09:48:06 +00:00
de5abef49a New makefiles 2005-08-02 09:30:50 +00:00
edd9fa2879 New makefiles. 2005-08-02 09:29:14 +00:00
0686da47a6 Fixed crash bug 2005-08-02 08:39:17 +00:00
4f9f548a58 yasm -f elf -m amd64 -g stabs 2005-08-02 08:29:02 +00:00
2d79c6e634 *** empty log message *** 2005-08-02 08:23:36 +00:00
ad6c7d412a *** empty log message *** 2005-08-02 08:15:01 +00:00
686dadc9c5 New makefile 2005-08-02 08:12:47 +00:00
70bff9c430 Fixed AGAIN! 2005-08-02 08:10:04 +00:00
cefad23b72 new makefile 2005-08-02 08:06:28 +00:00
0447c39a97 forgot this 2005-08-02 07:53:59 +00:00
688c12ac8b fixed two bugs 2005-08-02 07:46:41 +00:00
5cbcd34bec update 2005-08-02 07:17:12 +00:00
f9563b5103 *** empty log message *** 2005-08-02 07:07:35 +00:00
38da105ac1 Few changes 2005-08-02 07:01:25 +00:00
cc393d0e8d committed C# releaser 2005-08-02 06:28:41 +00:00
25cbe60bf8 fixed metamod plugins.ini bug 2005-08-02 02:56:09 +00:00
6be3805841 ready for release 2005-08-01 23:25:02 +00:00
6e3de2c53a *** empty log message *** 2005-08-01 22:34:33 +00:00
cf274f7f50 changed project name 2005-08-01 22:33:28 +00:00
17cca4587c Fixed small bug 2005-08-01 22:29:19 +00:00
3014e60bdb Added TSFUN include 2005-08-01 22:21:47 +00:00
e5b4b5a53d Initial import of twilight's module 2005-08-01 22:14:14 +00:00
bc66a93fcf the editor unindents now on pressing }. have fun!
- fixed bugs... lalala
- updated debug-list
- fixed comment-bug
- now final edition...
- updated captions
- fixed configs-bug (configs weren't uploaded during FTP installations)
2005-08-01 21:54:28 +00:00
8f06e36d04 fixed a few bugs 2005-08-01 20:54:41 +00:00
e38b64ff82 yams 2005-08-01 20:22:01 +00:00
4687ecd99b Committed hopefully final version 2005-08-01 19:56:54 +00:00
b1718bc334 added cs_user_spawn 2005-08-01 19:25:25 +00:00
d7063435f4 added cs_user_spawn (thanks T(+)rget) 2005-08-01 19:24:48 +00:00
a7133501d5 Fixed comments 2005-08-01 19:05:10 +00:00
5078ed9d0f changed on advice from target 2005-08-01 19:01:25 +00:00
424a8c17b3 *** empty log message *** 2005-08-01 18:56:03 +00:00
90c0e32cb3 oops killed changes 2005-08-01 18:31:06 +00:00
d3acbcc319 (c) 2005-08-01 10:24:20 +00:00
a776e832dd New plugin file format, new zlib libraries 2005-08-01 09:02:52 +00:00
65bd10c47b Committed linux build of new compiler 2005-08-01 09:00:01 +00:00
9bdd0ba0a4 Windows build of new compiler 2005-08-01 08:51:26 +00:00
ff48a9076b *** empty log message *** 2005-08-01 08:50:14 +00:00
3f99ce7af5 New plugin file format 2005-08-01 08:47:54 +00:00
4451691aa2 Removed warning 219 2005-08-01 05:56:06 +00:00
bc64ae2712 name change 2005-08-01 05:15:57 +00:00
7f55873bfb Fixed name clash 2005-08-01 05:14:55 +00:00
d94016384a from the "check your changes to see if they compile" dept 2005-08-01 05:10:55 +00:00
eb87344a16 Fixed bug at16702, jtp10181 2005-08-01 05:06:40 +00:00
43c06b0e36 what 2005-08-01 05:03:50 +00:00
a35b96fb7e Finished correcting your stuff SidLuke 2005-08-01 04:55:55 +00:00
562633c040 SDK to update MF_AmxExec and add MF_AmxPush 2005-08-01 03:23:56 +00:00
71eac5c544 omg sidluke why was this using amxmod api still?!?! 2005-08-01 03:19:46 +00:00
4fe39dd5cc okay removed old forward stuff why was this defaulted?! 2005-08-01 03:05:53 +00:00
7605abc929 Updated for new API 2005-08-01 02:58:57 +00:00
0a4133b4d0 Added register_native 2005-08-01 02:36:09 +00:00
0086b58f39 Completed AMD64 compatibility 2005-08-01 02:23:42 +00:00
583b67dbb1 the editor unindents now on pressing }. have fun!
- fixed bugs... lalala
- updated debug-list
- fixed comment-bug
- now final edition...
- updated captions
- fixed configs-bug (configs weren't uploaded during FTP installations)
2005-08-01 00:28:07 +00:00
a81f356835 *** empty log message *** 2005-08-01 00:25:47 +00:00
b2218661f8 the editor unindents now on pressing }. have fun!
- fixed bugs... lalala
- updated debug-list
- fixed comment-bug
- now final edition...
- updated captions
- fixed configs-bug (configs weren't uploaded during FTP installations)
2005-08-01 00:24:40 +00:00
8234977fa9 the editor unindents now on pressing }. have fun!
- fixed bugs... lalala
- updated debug-list
- fixed comment-bug
- now final edition...
- updated captions
- fixed configs-bug (configs weren't uploaded during FTP installations)
2005-08-01 00:19:25 +00:00
13ed6ed2d6 Touching up new system for linux support 2005-07-31 22:16:54 +00:00
a7fb4e85c9 Fixed bug where 64bit code was not browsed properly 2005-07-31 22:16:44 +00:00
abfca025d5 Committed new register_native system 2005-07-31 20:11:58 +00:00
34acc54cc9 Initial import of native hack for x86 2005-07-31 06:48:08 +00:00
b27eaab57f Initial import of new version :] 2005-07-31 06:07:48 +00:00
dd6c169994 Fixed c_str() 2005-07-31 06:04:42 +00:00
5751d381af Deleted old version 2005-07-31 06:03:54 +00:00
28998b5c14 initial import 2005-07-30 17:36:40 +00:00
a939cd0e2a added esf 2005-07-30 17:35:53 +00:00
d9d5446e86 updated 2005-07-30 17:34:07 +00:00
b91cc24d32 Finished 2005-07-30 17:33:49 +00:00
faae071ee8 version bump 2005-07-30 16:52:51 +00:00
cdbfa38391 some of the string functions twilight wanted 2005-07-30 16:47:48 +00:00
5d92972aad one more 2005-07-30 16:46:40 +00:00
ba17c8a75f version bump 2005-07-30 16:42:01 +00:00
389a593f9e ugh 2005-07-30 16:41:34 +00:00
b35e5dbd55 SDK sync, version bumps 2005-07-30 13:03:18 +00:00
0591c38d45 Updated SDK 2005-07-30 12:58:24 +00:00
041e73dc7e Updated notices 2005-07-30 01:52:50 +00:00
431eb72518 Updated twisty's code 2005-07-30 01:51:12 +00:00
75b63da66f Fixed output 2005-07-30 00:38:08 +00:00
51d54a96ff Added pc_printf to exports 2005-07-30 00:35:47 +00:00
df982ceb79 Fixed error output on compiler 2005-07-30 00:31:42 +00:00
ee978890b8 What? 2005-07-29 23:47:11 +00:00
fa46d2e1b5 Patched engine with non-constructing string 2005-07-29 21:30:52 +00:00
559d8bc7eb Quick patch for possible bug at15468 2005-07-29 20:23:08 +00:00
0d90a958ae Added request at16475
Fixed crash bug from bad allocation in construction
2005-07-29 20:15:08 +00:00
cb7bfbf642 Added request at16475 2005-07-29 19:37:07 +00:00
6cf6edb5b6 Fixed bug at16581, devicenull 2005-07-29 19:25:24 +00:00
b9ee99a3dc New plugin flags 2005-07-29 19:24:28 +00:00
a86302beea Changed function meaning 2005-07-29 19:20:59 +00:00
f6d647f614 Requested change at16639 2005-07-29 19:18:45 +00:00
32a42886dd Finished new menu system (for now)
Fixed bug where client_print did not add newlines properly
2005-07-29 19:13:55 +00:00
5b1d0dd2b9 removed old project file 2005-07-29 06:41:33 +00:00
166b5ca650 omg new menu system 2005-07-29 06:33:57 +00:00
044fa19470 Fixed bug where callfunc crashes 2005-07-29 06:12:23 +00:00
1d6b173e87 Fixed a bug where bad plugins could crash 2005-07-28 18:00:40 +00:00
eaf102d78f Fixed bug where JIT did not work on linux (memory alignment issues) 2005-07-27 19:43:54 +00:00
31436e3ecf Added linux compatibility 2005-07-27 17:28:06 +00:00
62cdaf5e10 Initial import of linux compiler builds 2005-07-27 17:27:20 +00:00
0de08a9452 Removed unused files 2005-07-27 17:00:57 +00:00
0de288139d Added linux support 2005-07-27 16:58:18 +00:00
94d3b31f40 Language sync for faluco :) 2005-07-27 16:32:39 +00:00
6d7442fb4f Fix for bug at8190 by faluco 2005-07-27 16:32:22 +00:00
68ad9c2b9a Ok makefile works on i386 now 2005-07-27 16:27:01 +00:00
191acd8e42 New Makefile, linux compatibility 2005-07-27 16:24:14 +00:00
ce043d0633 >:o 2005-07-27 00:51:35 +00:00
f18354807e Updated module SDK 2005-07-26 23:33:52 +00:00
6a97d73167 Committed brand new debugger system 2005-07-26 21:31:21 +00:00
586d09e533 I don't think I changed anything... 2005-07-26 21:30:35 +00:00
ba24020857 fixed amx_BrowseRelocate overwriting the flag state 2005-07-26 21:29:49 +00:00
4b9425cf3b Initial import of edited debug reader 2005-07-26 21:28:19 +00:00
ef2a9a2b34 Fixed switch case bug in JIT where no cases would crash 2005-07-26 21:28:04 +00:00
1a3a5331d1 *** empty log message *** 2005-07-26 18:47:11 +00:00
363e7e2270 updated to use amxxpc.exe 2005-07-26 18:45:37 +00:00
fdbee670c5 Uh, forgot... 2005-07-25 21:02:26 +00:00
a47ccb2a2a I'm high 2005-07-25 20:45:02 +00:00
9e46d2da47 WOW. 2005-07-25 20:39:58 +00:00
451a6d8464 PM STRIKES AGAIN (untested) 2005-07-25 19:09:49 +00:00
4abd7b4706 Now reads debug info correctly (cleaned some code up too) 2005-07-25 18:26:42 +00:00
09a08fd2f6 quick fixes before adding debugger again 2005-07-25 06:48:54 +00:00
4609cb409b Whoa! Merged in Pawn! (Small 3.0)
Removed debug handling (will add back in soon)
Ported all amx_Exec()s to forward systems
Deprecated AMX Mod module support (incompatible with Pawn anyway!)
Deprecated many file natives (unused)
Deprecated some functionality of pause/unpause
Fixed some memory deallocation bugs (thanks fysh)
Bumped module API version to 3 (no new M/SDK yet!)
Bumped AMX Mod X version to 1.5!
Merged in CVector changes
2005-07-25 06:03:43 +00:00
955aa04b41 Removed packed strings 2005-07-25 05:54:33 +00:00
69a5b5f410 Initial import of Pawn 3.0 compiler (win32) 2005-07-25 05:34:13 +00:00
b94fbb519a *** empty log message *** 2005-07-25 05:31:12 +00:00
832de07128 Removed Small compiler 2005-07-25 05:30:28 +00:00
f6b91f9258 Initial import of amxxpc 2005-07-25 00:01:54 +00:00
f9ca86cee6 *** empty log message *** 2005-07-25 00:01:50 +00:00
0ef9b80430 the editor unindents now on pressing }. have fun!
- fixed bugs... lalala
- updated debug-list
- fixed comment-bug
- now final edition...

hrm bail decided this will be AMX Mod X 1.5 so updated captions..
-> Basic-Master is now crazy o_><_O
2005-07-24 23:47:45 +00:00
057929e2f6 Fixed bug with sprintf widths 2005-07-24 22:42:34 +00:00
25d629083f Initial import of Pawn (Small 3.0) 2005-07-24 20:00:55 +00:00
c2502626e6 the editor unindents now on pressing }. have fun!
- fixed bugs... lalala
- updated debug-list
- fixed comment-bug
- now final edition...
2005-07-24 19:27:36 +00:00
76505f172a fixed problems with wrong weapon id ( enfield & fg42 ) 2005-07-24 11:07:49 +00:00
79268c5316 ---------------------------------------------------------------------------
Fixed memory bug found by fysh
2005-07-24 07:06:25 +00:00
0c36613352 Deprecated file read natives until they can be rewritten 2005-07-24 03:23:35 +00:00
37a80e6ef6 Fixed bugs at8190, at16430 2005-07-24 02:52:15 +00:00
7fc97524e2 the editor unindents now on pressing }. have fun!
- fixed bugs... lalala
- updated debug-list
- fixed comment-bug
- now final edition...
2005-07-23 21:25:25 +00:00
842813dcbb Fixed a few potential bugs, and set_msg_arg* no longer accepts type changes 2005-07-23 20:16:29 +00:00
9e194394c3 CVector fix - corrupt memory on size change 2005-07-23 16:58:10 +00:00
e188bf087a CVector fix - corrupt memory on size change
Version bumps
2005-07-23 16:57:21 +00:00
c5aae0d8aa little bug fix 2005-07-23 07:07:41 +00:00
25f1870020 the editor unindents now on pressing }. have fun!
- fixed bugs... lalala
- updated debug-list
- fixed comment-bug
- now final edition...
2005-07-22 22:21:16 +00:00
911e2ecefe New menu natives 2005-07-22 21:15:48 +00:00
b9131293c5 entity_set_owner accepts anything now 2005-07-22 20:47:13 +00:00
536a4f8472 Err, fixed these 2005-07-22 20:41:32 +00:00
29e1a5edc8 FAKEMETA IS GONE! SO LONG AND THANKS FOR THE FISH 2005-07-22 19:32:16 +00:00
34e5872881 *** empty log message *** 2005-07-22 17:37:27 +00:00
1d853b5fee because of bail I the editor unindents now on pressing }. have fun!
fixed bugs... lalala

updated debug-list
2005-07-22 17:36:51 +00:00
191824d72a new message system and string class 2005-07-22 09:26:37 +00:00
99f65175ff *** empty log message *** 2005-07-21 23:08:23 +00:00
2f8e311140 because of bail I the editor unindents now on pressing }. have fun!
fixed bugs... lalala
2005-07-21 22:29:08 +00:00
21551a6ea8 Fixed it for real <_< 2005-07-20 03:19:53 +00:00
c4f097bb36 Updated to PCRE 6.1 2005-07-19 16:48:16 +00:00
ffbf9fdca6 Saved a whole four bytes of memory 2005-07-19 16:14:52 +00:00
3863bd3ccc Fixed bug where not-found natives were still valid 2005-07-19 16:12:48 +00:00
a89e1ac536 Oops! Forgot to MF_Add pev 2005-07-19 16:08:00 +00:00
2f64226c6b Fixed bug at11988 reported by twilight suzuka 2005-07-15 20:50:23 +00:00
91da6f1631 Added is_in_viewcone, is_visible 2005-07-15 20:29:59 +00:00
e8c87f8d89 added is_visible, is_in_viewcone 2005-07-15 20:28:22 +00:00
3cba7811bd Committed new auto-module registering system
require_module is now DEPRECATED
2005-07-15 19:15:58 +00:00
70396a2fc1 new sdk version (bumped interface!!!!) 2005-07-15 19:13:50 +00:00
1a53b7bba7 Committed new SDK version 2005-07-15 19:05:44 +00:00
74ec2e75b8 New auto-module system 2005-07-15 19:05:31 +00:00
b312da8c63 Fixed bugs GCC caught 2005-07-15 16:28:41 +00:00
fe2d28f711 Ported the new dir commands to linux 2005-07-15 16:14:00 +00:00
1b09be51e1 Reverting JGHG's changes (forgot to commit this) 2005-07-15 07:59:26 +00:00
e1d1802cb9 Fixed bug at16027 2005-07-14 13:36:22 +00:00
db293cc451 Fixed memory leaks
Optimized message handling a bit
2005-07-14 04:50:46 +00:00
116984afed New dir reading natives, new memory outputs 2005-07-13 23:31:02 +00:00
a9d4e4e711 New natives for reading dirs 2005-07-13 23:30:28 +00:00
ef908ff4f5 Added get_distance_f, at15992 2005-07-13 22:16:30 +00:00
4631311905 Reverted pev changes 2005-07-13 18:05:52 +00:00
1106113f2b Recommitted pev - don't do this again without telling someone! 2005-07-13 17:35:47 +00:00
35ed810775 Patch for ifvers 5:11 (new MM API), eliminates fakemeta like mm-pext 2005-07-13 02:37:32 +00:00
e1a1153018 updated to July 2005-07-10 09:01:24 +00:00
e91cd0862e Added include files for new ESFMod module 2005-07-10 00:47:56 +00:00
5ac71db62d Tiny fixes 2005-07-10 00:45:42 +00:00
d270feb15f sawce forgot to add the shotgun to the list for retreiving reserve ammo. fixed. 2005-07-09 22:42:29 +00:00
1c8aca42eb Updated offsets for 3.0.5. With a couple of linux changes. 2005-07-09 22:26:38 +00:00
e0dbc031cc Committed initial import of the Earth's Special Forces module 2005-07-09 21:51:35 +00:00
39eba4134e Updated offsets for 3.0.5. Only windows offsets have been tested. I may update this again after testing linux. 2005-07-09 21:44:33 +00:00
9f77c8a4a2 oops 2005-07-09 15:38:07 +00:00
9b6fb64aba Bumped version # 2005-07-09 07:18:41 +00:00
82d6cb9de0 *** empty log message *** 2005-07-09 07:09:25 +00:00
8ae1d4ce27 New offsets from karlos (at15812) 2005-07-09 07:09:08 +00:00
21541fcc7f Decided to discontinue this module 2005-07-09 06:48:04 +00:00
e9e4ab69e6 Addressed report at15008 (twistedeuphoria) 2005-07-08 05:42:10 +00:00
35ecd40228 Fixed bug at15479 (karlos)
Fixed bug at11812 (Kamikaze)
Added new build_pathname implementation for reentracy.
build_pathname_r added to module API
2005-07-08 05:05:06 +00:00
e8d30a11d7 Patch for is_user_hltv (at14918 by Wallslide)
Fixed a few potential crash bugs
2005-07-08 02:01:01 +00:00
36d19dfe04 Fixed bug at15006 reported by EKS 2005-07-08 01:43:44 +00:00
5d90ccf088 Fix for bug at15759, from devicenull 2005-07-08 01:22:57 +00:00
de5eb6924a Added request at13457 from harbu. 2005-07-08 01:15:54 +00:00
0600e3357c Another resync :) 2005-07-08 00:44:09 +00:00
40f28a543e Resync 2005-07-07 20:08:35 +00:00
13b6c0764c Added request at15060 by twistedeuphoria 2005-07-07 19:53:02 +00:00
950d1b4a5f Fixed bug at13314 from XxAvalanchexX 2005-07-07 18:49:14 +00:00
85ed8468f8 Fix ap22177.2 from faluco 2005-07-07 18:46:04 +00:00
756a6a2b65 Fix ap22177.4 from faluco 2005-07-07 18:41:29 +00:00
e63ed1e3e0 Fix ap22177 from faluco 2005-07-07 18:40:59 +00:00
27c2978617 Synced language translation files 2005-07-07 18:38:29 +00:00
b0c9b868cd Fixed bug a13718 report by faluco 2005-07-07 18:37:33 +00:00
101c590f32 Removed mysql backwards compatibility
Removed stray character
2005-07-06 21:20:53 +00:00
943a75d7e1 Added requestfunction 2005-07-06 03:59:02 +00:00
611ad2be94 Malformat bug fixes, RC version bump 2005-07-06 03:20:00 +00:00
64b7c7b600 Malformat bug fixes 2005-07-06 03:19:27 +00:00
cc899d298d Modules can now intercommunicate through RegisterFunction() - UNTESTED
Registering a function will make it available through ReqFunc,
2005-07-05 22:01:29 +00:00
3f2c117039 because of bail I the editor unindents now on pressing }. have fun! 2005-06-26 02:10:33 +00:00
0d21377035 because of bail I the editor unindents now on pressing }. have fun! 2005-06-26 02:07:03 +00:00
48749382fb amx_addadmin added 2005-06-21 22:04:44 +00:00
996f461157 Fixed a memory leak on plugun unload 2005-06-16 20:20:24 +00:00
8d898ae459 fixed /stats command 2005-06-13 10:52:33 +00:00
b609eead1b fixed get area function 2005-06-01 13:49:49 +00:00
567ab19fe5 added cap_message to CP_ enum 2005-05-31 21:08:56 +00:00
1cc60fc9ad added new functions 2005-05-31 13:56:15 +00:00
959a5b9225 *** empty log message *** 2005-05-31 12:44:14 +00:00
9b8658606b fixed EndRound Stats 2005-05-31 12:35:13 +00:00
51ff0a2c49 Added stock file_copy to file.inc.
Also fixed fopen to return 0 on files that can't be opened.
Fixed native fopen to take const filename.
2005-05-29 16:36:35 +00:00
c1552aacd6 * May 18th, 2005: Starting to develop AMXX-Edit v2 as a kind of open source
* May 19th, 2005: Added debug dialog (only for developing)
2005-05-19 11:03:42 +00:00
ba245458de * May 18th, 2005: Starting to develop AMXX-Edit v2 as a kind of open source 2005-05-18 21:23:15 +00:00
c32e747dc1 *** empty log message *** 2005-05-18 21:04:34 +00:00
7ad84abb09 *** empty log message *** 2005-05-18 20:54:43 +00:00
dd6abc5487 * May 18th, 2005: Starting to develop AMXX-Edit v2 as a kind of open source 2005-05-18 20:53:06 +00:00
3642cedd2b delete it 2005-05-18 20:14:34 +00:00
df87bc06c2 fixed "dod_set_stamina" native 2005-05-12 10:28:40 +00:00
9d200888ff Initial import 2005-04-29 22:47:00 +00:00
ebf0945c6e Added numtostr and strtonum mappings... not adding this to string.inc ... but it's there now. :-P 2005-04-19 15:40:21 +00:00
7c6d869cb4 Moved
/* Sets player frags. */
native set_user_frags(index, frags);

from amxmodx.inc to fun.inc...
2005-04-19 14:49:16 +00:00
6de8178c30 Fixed a typo 2005-04-11 02:20:11 +00:00
1b80dd5584 updated to April 2005-04-10 15:47:14 +00:00
7ceaa4801d fixed wrong formatting when using non-english languages (thanks n-o-l-o) 2005-04-05 15:10:20 +00:00
15bd719cf5 FireStorm's fix 2005-04-05 14:48:06 +00:00
acb2b27852 Began AMXx bindings 2005-04-03 03:26:35 +00:00
abbb2f2cc2 Implementation of journaling 2005-04-03 02:01:42 +00:00
aa8beace98 added headers 2005-04-02 16:04:08 +00:00
d17d9103de Initial commit of hashtable stuff 2005-04-02 07:33:25 +00:00
85f5604d43 *** empty log message *** 2005-03-30 18:43:43 +00:00
fa42dbf011 Added stock admin_print(access, const DESTINATION, const MSG[]); 2005-03-30 11:37:41 +00:00
d1c27a7534 Goodbye pev. You've been great. Miss you. 2005-03-27 00:42:00 +00:00
8675d6a4a8 Pev -> Engine wrapper for backwards compatibility 2005-03-26 15:59:58 +00:00
1d770fd400 Removed pev 2005-03-25 22:05:41 +00:00
d6b704e74c Updated from http://www.amxmodx.org/forums/viewtopic.php?p=99878
To ban LAN:ers by IP and not authid.
2005-03-25 09:40:04 +00:00
eeee302722 Removed pev.cpp from build. These are excluded in vcproj from Windows builds. 2005-03-25 09:33:40 +00:00
81f4a505c1 Added FM_KeyValue and get_kv/set_kv natives.
Removed pev natives.

Probably fixed something in DLLFunc_ClientUserInfoChanged.
2005-03-25 09:30:45 +00:00
560f50eda7 *** empty log message *** 2005-03-24 11:37:00 +00:00
73f1e4d77e *** empty log message *** 2005-03-24 11:03:09 +00:00
87fd5e2b4e Added in-game cmd "amx_addadmin <playername> <flags> [password] - automatically add specified player as an admin to users.ini" 2005-03-24 10:59:46 +00:00
01cc4a1bad Fixed cs_set_user_armor() 2005-03-20 15:44:32 +00:00
ad732d7286 *** empty log message *** 2005-03-16 21:00:16 +00:00
448da8bd9e One more core skipping thingy 2005-03-11 19:16:00 +00:00
a4be1ac635 evilspy's fix 2005-03-11 16:31:49 +00:00
5e46f64d75 Updated hitzones.
Now allows setting individual hitzones between player A <-> player B.
2005-03-11 09:21:03 +00:00
f9281fe309 Removed last bug "fix" which did nothing except break a perfectly working plugin. Doh! 2005-03-10 10:47:09 +00:00
d3a49d1d41 Updated installer 2005-03-10 01:25:18 +00:00
8736214678 Added SQLite module to configuration 2005-03-09 23:13:47 +00:00
b2aa069cd4 update 2005-03-09 22:21:26 +00:00
01bacc3275 As sawce would say. Bug go squish. :D 2005-03-07 23:55:18 +00:00
53b7516449 Made combat countdown work over multiple games on the same map. Sound now stops when a team has won and everything resets. 2005-03-07 23:48:10 +00:00
916325d3db Apparently this votemap crash bug is fixed in a server patch being released tonight/tomorrow. 2005-03-07 14:36:48 +00:00
054f046807 Fix for votemap server/client crash in NS v3.0 final release. 2005-03-07 13:41:08 +00:00
a4e57797f5 NS v3.0 final release changes: Removes ns_agora, ns_mineshaft Added: ns_eon, co_niveus 2005-03-06 23:36:11 +00:00
afef83ae66 Updated for addition of Jetpack player class to ScoreInfo Message in NS v3.0 final release. 2005-03-06 21:55:15 +00:00
730857a23b updated to March 2005-03-06 13:41:33 +00:00
7fd9fff987 Offsets updated for NS v3.0 final release. 2005-03-05 05:25:32 +00:00
3074ca0756 Removed some... odd thing. 2005-02-25 18:05:50 +00:00
7b8165fe6f Removing task waiting to call dispInfo if client disconnects before the task is executed. This fixes run time errors. 2005-02-21 00:31:52 +00:00
3774575160 Fixed a bug in dispInfo: if client disconnected fast enough we got a native error in client_print :-D 2005-02-21 00:23:16 +00:00
57eec2b88e evilspy's support for mm-p ext 2005-02-16 20:36:04 +00:00
b2eb9df894 Updated dbi_type() (added "sqlite") and added stock sqlite_table_exists(). 2005-02-15 20:50:15 +00:00
00e9f2bbea Removed some mysql stuff 2005-02-15 20:46:58 +00:00
adf12ab745 Fixed makefiles 2005-02-15 17:27:00 +00:00
9d4e5b18ee Makefiles for Linux. Not tested. 2005-02-15 14:39:36 +00:00
8a40ed8cd6 Stupid Tortoise. 2005-02-15 14:19:07 +00:00
c79909eb80 Initial import of Sqlite 2005-02-15 14:11:01 +00:00
26e8b0dbb6 client_disconnect forwards now get called for every client which is initialized (ie. client_connect was called for him) instead of clients which are ingame only (ie. client_putinserver was called) 2005-02-07 10:28:22 +00:00
a2c2dc88fc Yes! 2005-02-06 11:59:41 +00:00
99f47224ee updated to February 2005-02-05 15:15:13 +00:00
a085cef0d6 Updated to allow compiling with unmodified statsx.sma, and other plugins using the old csx api... hopefully. :-9 2005-02-05 11:06:34 +00:00
2980fb1d82 Merged with ns2amx header 2005-02-03 20:49:44 +00:00
3ed92695be Reverse 2005-02-01 01:12:51 +00:00
9d797f8664 Revert 2005-02-01 00:59:55 +00:00
d7dbf60c8f New versions fixing compaction bug 2005-01-31 23:11:36 +00:00
06923d0f6d Updated versions 2005-01-31 19:39:50 +00:00
948be015a7 new version number 2005-01-31 19:35:06 +00:00
1a339b2f77 New version number 2005-01-31 19:34:15 +00:00
39479f2403 new verison number 2005-01-31 19:33:36 +00:00
e4beb3828a Increased version number 2005-01-31 19:33:17 +00:00
84caa10733 Updated to 2.7.2 compiler 2005-01-31 08:24:24 +00:00
a8ff2abab5 sdk syncs 2005-01-31 07:59:44 +00:00
b4d2f83d6f sdk sync 2005-01-31 07:54:17 +00:00
be28d95b8d Fixed DS's notice 2005-01-31 07:52:32 +00:00
2401d1833e Updated to 2.7.2 compiler 2005-01-31 07:41:47 +00:00
a189c0bda7 Added amx_mkdir for twistedeuphoria 2005-01-30 05:32:10 +00:00
cc462c9ccb Added cs_user_has_shield from Ronkkrop 2005-01-30 05:10:42 +00:00
3d7987e8d8 Fixed is_amd_64 include (Damaged Soul) 2005-01-30 05:03:46 +00:00
1c544f55ca Fixed typo (furax44) 2005-01-30 05:00:25 +00:00
5c231919b6 Fixed typo (FireStorm) 2005-01-30 04:54:04 +00:00
4b48be3e93 Synced language files 2005-01-30 04:53:11 +00:00
ca07e53293 Fixed typo (XxAvalanchexX) 2005-01-30 04:52:10 +00:00
3f2a8ccfc5 0.4 = added delete button 2005-01-27 08:58:01 +00:00
e097932ac9 0.2 file not found -> exits 2005-01-22 13:27:57 +00:00
27e4174be6 0.2: Edit stats, clear stats features added 2005-01-22 13:24:26 +00:00
7f47d2de56 My god... 2005-01-21 16:27:44 +00:00
6200ee6977 Fixed about box :-P 2005-01-21 16:23:55 +00:00
e98fb7d6e4 Included WinCSX project 2005-01-21 16:09:25 +00:00
4e6233b898 WinCSX 0.2 initial commitment 2005-01-21 16:08:36 +00:00
544b74f839 Crashes after hitzones "fix".
This should fix that. Hopefully.
2005-01-17 07:45:20 +00:00
4a823a0894 Updated for amx_menu... 2005-01-16 22:24:36 +00:00
53188ab941 New natives: cs_set_user_armor(), cs_get_user_armor()
cs_set_user_armor() should be used instead of fun's set_user_armor().
2005-01-16 16:30:18 +00:00
5f7dabf9b6 *cough* 2005-01-15 12:24:14 +00:00
e343d224ce amx_menu: A new menu also reachable by non-admin clients. Scripters can add their plugin menus as an item in this menu (Wc3 menu, Superhero info, etc...) so that a client don't have to bind/know a million different menu commands. This could become a one-stop-shop for all of the clients menu needs. Let's hope it catches on. :-)
For this menufront.sma adds: "amx_addclientmenuitem" where server admins can add menu items from plugins that don't support this yet.
amxmisc.inc is also updated to support this.
2005-01-15 09:58:51 +00:00
188023b5ac Fixed get_stats in csx and get_stats2 in csx_sql
csx and csx_sql now have exact same functionality, apart from csx_sql can also export stats to sql database if activated with cvar...
2005-01-14 12:21:12 +00:00
f18adbf9d6 Updated get_stats and get_stats2 to also retrieve authid 2005-01-14 12:14:34 +00:00
9959ef52b3 Possibly fix the hitzones problem. 2005-01-13 11:02:14 +00:00
8e58484fc5 get_stats now looks like this:
native get_stats(index,stats[8],bodyhits[8],name[],len,authid[],authidlen=0);
(authid + authidlen are new)
+ fixes
2005-01-12 01:24:40 +00:00
a58ab24b0c Added cvar csx_sqlstats_exportstats 2005-01-11 15:31:47 +00:00
a67085217f Fixes 2005-01-11 13:02:06 +00:00
f08f16c20d Adds cvars:
cvar_t *csx_sqlstats_host;
cvar_t *csx_sqlstats_username;
cvar_t *csx_sqlstats_password;
cvar_t *csx_sqlstats_db;
cvar_t *csx_sqlstats_table;

Exports players' statistics at map change to SQL db right after it saved those to the dat file.
2005-01-11 12:23:57 +00:00
ec9d4a52fe Updated library to 7.4.6 2005-01-10 16:42:46 +00:00
01b955d2d4 Finally added callfunc_begin_i and get_func_id into amxmodx.inc 2004-12-25 21:28:50 +00:00
a384a78544 Silly me! 2004-12-25 21:24:50 +00:00
b4ad89e6ef Reverted last changes 2004-12-22 18:19:51 +00:00
2b4ed9cc27 Test: Hopefully fixed "bot bug" 2004-12-22 16:29:40 +00:00
e986848faf Removed bot member variable from CPlayer; instead, everything now calls the inline IsBot() function.
Hopefully that will fix the "bot bug"
2004-12-22 13:01:55 +00:00
21ceae3c9e Replaced in files: /amxx/ with /amxmodx/
This fixes lines looking like
; File location: $moddir/addons/amxx/configs/cmds.ini

to look like

; File location: $moddir/addons/amxmodx/configs/cmds.ini

.
2004-12-22 10:27:30 +00:00
51b9fae4bc fixed strbreak 2004-12-10 23:37:43 +00:00
4e7d24f64b Fix for unban by PiTaGoRaS 2004-12-10 07:51:07 +00:00
40640c92d4 *** empty log message *** 2004-12-09 18:25:46 +00:00
c5b3919122 fixed custom weapons system 2004-12-08 23:40:42 +00:00
29a22bb5fd more changes in Damage MSG 2004-12-03 00:57:16 +00:00
2baf9c4c20 damage message changes 2004-12-02 02:11:09 +00:00
c4727c1dc3 fixed grenade problems ( returning wrong (older) owner ) 2004-11-30 15:46:09 +00:00
4901dee86d corrected fakemeta misspelling 2004-11-24 15:12:35 +00:00
c1f2a499f8 fixed compiling error (by FireStorm) 2004-11-20 21:34:22 +00:00
7aa31c764d Fixed some mistakes and typos. 2004-11-17 07:33:29 +00:00
08fea0eea1 Removed some unneeded stuff from class. 2004-11-15 00:20:28 +00:00
add716276b Synced language files (added Dutch, thanks Devilion) 2004-11-14 14:23:15 +00:00
e688addd98 Added new natives 2004-11-14 14:21:20 +00:00
199131b2b8 Added PM OnoTo's XS library include 2004-11-14 14:17:32 +00:00
fb29cbff16 Added some description for require_module etc 2004-11-13 19:55:11 +00:00
11fa330f10 Renamed to CStrike :-D gyar!! 2004-11-13 19:49:25 +00:00
ca720c8c83 XS Library 2004-11-13 10:20:12 +00:00
456d7b69a2 fixed returning float parameters in read_data():s second parameter (by ref) 2004-11-13 08:56:11 +00:00
a86cb11fd7 Umm... 2004-11-13 08:47:12 +00:00
96c65dcfc4 corrected OriginalFilename 2004-11-12 22:04:12 +00:00
86451da9a9 yes 2004-11-11 12:22:23 +00:00
57607f1a28 *** empty log message *** 2004-11-11 11:49:38 +00:00
eb4fdf53fa added fakemeta_stocks 2004-11-11 11:14:01 +00:00
6251521102 *** empty log message *** 2004-11-11 11:07:37 +00:00
c940a0b621 Umm... 2004-11-11 10:57:50 +00:00
719af5c72c *** empty log message *** 2004-11-11 10:55:22 +00:00
128d19c69e added pgsql for windows 2004-11-11 10:46:10 +00:00
46861ff5b4 Added dllfuncs 2004-11-11 10:39:37 +00:00
ee464539de Fixed authors and version numbers 2004-11-11 09:08:12 +00:00
f69ff642df *** empty log message *** 2004-11-11 09:06:50 +00:00
db77c245e6 Fixed copyrights and version numbers 2004-11-11 08:58:54 +00:00
d5caf3e2ac renamed 2004-11-11 07:43:31 +00:00
148b365e43 version/author fix 2004-11-11 07:40:21 +00:00
8c215e5d6f removed 2004-11-10 05:41:18 +00:00
0513dae63e Added better credits ^^ 2004-11-10 05:38:23 +00:00
f73a8356f6 do not touch my modules ! ;P 2004-11-10 00:45:21 +00:00
77c5198009 fixed modules problems when declared also in metamod's plugins.ini 2004-11-10 00:25:53 +00:00
820fedca22 First version 2004-11-09 20:30:17 +00:00
28a1182cd2 Updated EngFunc_SetKeyValue :-) 2004-11-09 16:47:33 +00:00
16444a713a Updated EngFunc_SetKeyValue 2004-11-09 16:47:06 +00:00
6457fc45c7 On dedicated servers, the command "amxx" now prints the AMX Mod X version 2004-11-08 19:51:20 +00:00
cb94cccf22 Added Dutch language 2004-11-08 12:35:52 +00:00
c0ee97b437 changed default formula 2004-11-08 12:17:40 +00:00
f950d384b6 Fixed crash in FM_MessageBegin 2004-11-07 20:36:49 +00:00
426a71e7f2 fixed bug reported by JC_Denton when SQL times out 2004-11-07 17:47:36 +00:00
d49b2453bb little error checking 2004-11-07 17:24:55 +00:00
74a1db4417 Upped buffer in write_file (1024->2048) 2004-11-06 21:56:24 +00:00
dc7e1e2494 updated to November 2004-11-06 13:13:02 +00:00
5dfbcf2a23 Minor fixes to stop crashing in Zombie Panic
(Don't send SVC_INTERMISSION if running zp)
2004-11-06 00:24:55 +00:00
09c1471c3a normal (not SP) forwards now report runtime errors properly 2004-11-04 21:55:14 +00:00
50a882cf4c message_begin now reports an error instead of letting th server abort when the id is invalid 2004-11-04 21:54:46 +00:00
850557df5a Updated get_user_hitzones 2004-11-02 16:51:42 +00:00
4c43eccbb5 *** empty log message *** 2004-11-01 17:15:53 +00:00
380db7c884 *** empty log message *** 2004-11-01 17:15:13 +00:00
1994917044 this may have caused problem 2004-11-01 09:18:46 +00:00
449f31d78c *** empty log message *** 2004-10-31 02:14:53 +00:00
bc2386fe47 Fixed typo in RadiusDamage (reported by apophis) 2004-10-30 13:40:23 +00:00
ec02883f6e Added stocks:
find_plugin_byfile
find_plugin_bydesc
2004-10-30 13:27:22 +00:00
abd372447a Added AMD64 2004-10-30 09:57:55 +00:00
fef70c0386 fix 2004-10-30 09:48:29 +00:00
719b32d71f Changed to memalign, stupid debian is obsolete 2004-10-30 09:42:54 +00:00
4e385fec50 Added server_exec() to make plugin_cfg a bit better 2004-10-29 21:05:40 +00:00
c9b2f2f060 took out this 2004-10-29 20:40:06 +00:00
d038e926fd *** empty log message *** 2004-10-29 20:35:44 +00:00
712859eb20 Fixed JIT crashing on some kernel configs (like FC2 >= 2.6.6) 2004-10-29 20:35:23 +00:00
826893d8d2 Fixed JIT crashing on some kernel config options (like FC2 >= 2.6.6) 2004-10-29 20:34:58 +00:00
47d1881c29 Added declarations for:
callfunc_begin_i
get_func_id
2004-10-29 19:54:56 +00:00
741666b742 Added two natives:
-callfunc_begin_i
 -get_function_id
2004-10-29 19:50:38 +00:00
ee8e30417c Confirmed all offsets for all platforms. (fixed backpack ammo offsets for players which was off, and also fixed offsets for 32 bit linux concerning weapons and the cs_?et_weapon_* natives should now work) 2004-10-29 14:44:48 +00:00
cc4bbadfa2 Added special cases for %% and % at end of phrase for formatting of phrases defined in language definition files. 2004-10-29 13:11:12 +00:00
8761791473 language file sync 2004-10-29 04:40:21 +00:00
6697b7b1d3 new amxxsc compiles 2004-10-29 04:29:02 +00:00
3c9a47aae3 New compilation of libsc251 2004-10-29 04:22:45 +00:00
d1675c82b5 fixed a language format error 2004-10-29 02:17:58 +00:00
b40643950d added some runtime checks 2004-10-29 02:15:01 +00:00
ff5b1dd7cc Changed error output format 2004-10-29 01:49:00 +00:00
3587483fa6 LogError() now can log native function names. 2004-10-29 00:21:44 +00:00
c9c26b869c added more checks 2004-10-28 20:48:00 +00:00
8f18856e91 Fixed SetView (by always hooking Spawn and precaching the needed dummy model rpgrocket.mdl) 2004-10-27 19:06:43 +00:00
ddfba00791 Fixed 2004-10-25 23:08:06 +00:00
c6eaa97391 oops :( 2004-10-25 23:01:28 +00:00
5eb095b514 Added native get_user_msgname(msgid, name[], len); 2004-10-25 23:00:16 +00:00
4e0bfe161e fixing SAWCE'S error 2004-10-25 17:06:24 +00:00
0e681d9bd4 replaced get_weaponname with xmod_get_wpnname 2004-10-25 11:16:02 +00:00
3d1162ecd9 client_ forwards will now work with kill command 2004-10-25 11:05:59 +00:00
3414cd7ce7 fixed pev bug.. 2004-10-24 21:03:12 +00:00
66386cca59 Fixed entity_set_byte 2004-10-24 15:41:25 +00:00
75396c753c Fixed sounds playing while connecting 2004-10-24 01:32:59 +00:00
4edd77faee Crash bug fix from Damaged Soul 2004-10-24 01:11:41 +00:00
91db6c7398 More pointless fixes from karlos 2004-10-24 01:09:07 +00:00
46390b83ac minor fix.. 2004-10-20 15:55:59 +00:00
89eda75b1f Touch it and die, bail. 2004-10-20 14:24:54 +00:00
f14808e009 Updated SDK
Fixed client_built forward...
2004-10-20 14:24:03 +00:00
b569ea3c3f Fixed bug where message_begin could not send MSG_PAS_R and MSG_PVS_R (reliable versions) messages. Reported by Damaged Soul 2004-10-20 14:16:46 +00:00
f595be47dc Fixed errors reportde by karlos 2004-10-18 21:00:25 +00:00
ee3404fea0 removed "is_alive" check from ResetHUD function 2004-10-16 22:22:54 +00:00
61fc7da654 fixed last hit bug and problems with c4 damage 2004-10-16 17:03:53 +00:00
14c3930b3d Damnit, bail 2004-10-16 14:26:11 +00:00
3efa25a5fb Fixed entity_set_edict 2004-10-14 08:15:41 +00:00
c29a7d34e5 Renamed cs_get_weapon_type -> cs_get_weapon_id 2004-10-14 06:09:01 +00:00
daa873d8ed Damaged Soul's map cycle file fix 2004-10-12 21:34:57 +00:00
c09de969eb Sawces icons 2004-10-12 21:23:38 +00:00
b0dd18580c fixed native prepend 2004-10-11 17:20:19 +00:00
32deaa261f fixed weapon name bug in player status 2004-10-09 21:06:11 +00:00
3a8e103faf Added custommenuitems.cfg to standard cfg files.
menufront.sma executes this file on plugin loa, adding the specified menu items to amxmodmenu.
2004-10-09 10:13:16 +00:00
f4b1c9f78a Added server command "amx_addmenuitem <menu text> <menu command> <access flags> <plugin name>":
Server admins can add menu items to amxmodmenu from plugins that do not (yet) do this on their own.
2004-10-09 09:50:33 +00:00
618759f390 Menu items boundary checking... 2004-10-09 09:32:56 +00:00
ced5d6ff57 added lang_phrase 2004-10-08 19:45:38 +00:00
db4041114f Fixed a bug in amx_client_languages
Added lang_phrase
2004-10-08 19:26:26 +00:00
b52d77e8bf Fixed big bug in executeForwards where float parameters were skipped and the stack might be messed up
(thanks to BAILOPAN)
2004-10-08 19:18:41 +00:00
940b0be4b9 Don't ask 2 2004-10-08 08:59:04 +00:00
75f49e78b0 Don't ask 2004-10-08 08:53:27 +00:00
f06359e38f Reworked to add AddMenuItem() 2004-10-08 08:37:27 +00:00
2733adbb49 Added AddMenuItem 2004-10-08 08:36:54 +00:00
fc4d8f183b const parameter in callfunc_push_str 2004-10-08 08:29:53 +00:00
ea70c77dd8 enabled emitsound_post function (knife shot fix, Damaged Soul ) 2004-10-07 08:58:01 +00:00
301a69aacb Synced translation files 2004-10-07 08:31:48 +00:00
92eda7c214 *** empty log message *** 2004-10-06 18:43:26 +00:00
4800ab292c Added stupid forwards 2004-10-06 17:57:57 +00:00
34cfce33a1 fixed /stats menu bug ( Damaged Soul ) and added selfkill check in miscstats 2004-10-06 15:47:04 +00:00
fec17424fb updated to October 2004-10-05 20:16:50 +00:00
264dd7a10d Fixed error outputs for CLang 2004-10-05 19:29:35 +00:00
6cef4eab4f *** empty log message *** 2004-10-05 19:02:15 +00:00
f4ada32ec2 Changed module comments (Damaged Soul) 2004-10-05 18:59:23 +00:00
bff8c3cdcf updated to csx 2004-10-05 16:20:03 +00:00
3b670333de Fixed result always refused even if admin accepted vote result. 2004-10-05 11:16:27 +00:00
eb36757ef1 Fixed menu not displaying on/off status for scout, mp5, ak47. 2004-10-05 10:01:04 +00:00
054b1f8868 *** empty log message *** 2004-10-05 09:22:14 +00:00
23234fad0b Added regex module 2004-10-05 08:53:51 +00:00
74dca8b6ef Fixed some bugs 2004-10-05 08:51:57 +00:00
2a187988f6 fixed project 2004-10-05 08:35:05 +00:00
d1ee9ee9ba *** empty log message *** 2004-10-05 08:33:31 +00:00
380f560fa4 Finalized (not tested!) 2004-10-05 08:32:23 +00:00
d9b6fa1f93 Initial import of regex stuff 2004-10-05 08:31:42 +00:00
8a57648b87 AMD64 support 2004-10-05 08:13:55 +00:00
80b8591295 Fixed a few bugs, added makefile 2004-10-05 08:04:13 +00:00
f94aa52974 Switched includes (bigballer) 2004-10-05 07:41:14 +00:00
ef8ad4a894 *** empty log message *** 2004-10-05 07:18:09 +00:00
41b6f6bd4a Initial import (untested!) 2004-10-05 07:17:49 +00:00
9e8f380121 changed is_valid_ent 2004-10-05 00:45:15 +00:00
39070081d1 fixed empty log message on debug trace 2004-10-04 22:56:36 +00:00
00d8ffe503 Fixed a debug trace output 2004-10-04 20:36:21 +00:00
4ef8530bba removed 2004-10-04 20:34:43 +00:00
77aa0f4f8e Fixed bad error checking routine 2004-10-04 20:32:26 +00:00
766246648d Fixed runtime error bugs 2004-10-04 20:10:27 +00:00
7963eb1cde added ms.net projs 2004-10-04 12:39:03 +00:00
02d8b2c523 Added makefile 2004-10-04 08:15:06 +00:00
227fb0411e Moved to other dirs 2004-10-04 08:11:28 +00:00
027ae6dc7e *** empty log message *** 2004-10-04 08:09:52 +00:00
334905e16e new configuration files for CSX 2004-10-04 08:08:18 +00:00
e3fad723b8 New CSX 2004-10-04 08:04:50 +00:00
5e52c45968 New SDK + debugging engine 2004-10-04 08:00:32 +00:00
e3a2a2bc17 Merged CSX versions 2004-10-04 07:30:39 +00:00
18b75cb07c Updated a bunch of SDKs and moved the rest to the new debugging system. 2004-10-04 06:14:30 +00:00
4e1c5a3e02 *** empty log message *** 2004-10-04 05:51:48 +00:00
5db290890f Fixed debugging stuff 2004-10-04 05:51:27 +00:00
b9c83aa4a2 Reworked SDK LogError() to include module names
improved debugging output
2004-10-04 05:50:28 +00:00
bb12f71137 made worldspawn a valid ent 2004-10-03 23:21:54 +00:00
0a3911231b made worldspawn a valid ent 2004-10-03 22:49:29 +00:00
846ef95c58 Added debugging engine 2004-10-03 22:33:55 +00:00
601bb30b7e Added debugging engine 2004-10-03 21:54:27 +00:00
9728b79c33 Fixed configuration error 2004-10-03 21:44:48 +00:00
90baf98057 Added debugging engine 2004-10-03 21:43:03 +00:00
8ad6437dd8 Added debugging engine 2004-10-03 21:33:09 +00:00
02bf904467 Added debugging support 2004-10-03 21:10:10 +00:00
62e4bbcfe9 Added new debug mode to fun module, also cleaned up error checking code 2004-10-03 20:19:47 +00:00
fc15ac1f41 Added debugging engine 2004-10-03 20:00:23 +00:00
01770f0e5b Fixed possible problem where a file handle could stay open on memory allocation failure 2004-10-03 17:04:29 +00:00
87ff81a499 Added important comment 2004-10-03 17:03:14 +00:00
981f41aee0 Fixed problem where file handles could possible stay open 2004-10-03 16:55:12 +00:00
605ca152c2 Fixed 2 possible crashbugs 2004-10-03 16:49:09 +00:00
0fc8f0b489 fixed bug in create pwup function 2004-10-03 11:07:49 +00:00
c511d80da7 Added delay to map changes 2004-10-03 07:33:49 +00:00
8304fc143c Increased a format buffer 2004-10-03 07:19:35 +00:00
f3cfd31668 Added AlertMessage to fakemeta 2004-10-03 07:04:08 +00:00
ef90960121 Fixed ADMIN_ALL bug 2004-10-03 06:23:25 +00:00
3700b8b39f Fixed bomb count bug 2004-10-03 06:08:09 +00:00
b83f2f5257 - Fixed bug where metamod was reporting "Could not find memloc for cvar xx" when modules registered cvars (fix by ghost_of_evilspy) 2004-10-02 08:18:54 +00:00
06f61cf92a Added more debugging info to case where CForwardMngr::m_PreparedArrays is >= (max params num) 2004-10-02 08:11:33 +00:00
5a5ff6d8ea Fixed parameter type in FN_PvAllocEntPrivateData (from long to int32) 2004-10-01 08:52:25 +00:00
bbe2626fd1 :gyar: a couple minor improvements :attack:
Global pointer for function tables
Better support for compiling under Cygwin gcc

:avast:
2004-09-30 06:18:23 +00:00
d5646ae238 update .. 2004-09-29 17:43:25 +00:00
df43d897df Fioxed call_think:
if (!is_ent_valid(iEnt)) {
		EngineError(amx, "Invalid Entity %d", iEnt);
		return 0;
	}

was

	if (is_ent_valid(iEnt)) {
		EngineError(amx, "Invalid Entity %d", iEnt);
		return 0;
	}
2004-09-29 06:17:44 +00:00
687a0f23da Added MSG_ONE_UNRELIABLE 2004-09-28 17:29:22 +00:00
aa0dc4dbaf Fixed a few issues (Damaged Soul) 2004-09-28 07:29:48 +00:00
de399c54c6 Fixed ML_NOTFOUND(LANG) 2004-09-28 07:18:51 +00:00
58d522e4c3 Fixed typo 2004-09-28 04:59:21 +00:00
3b90cca5bd Fixed user_slap for NS 2004-09-28 02:44:26 +00:00
b7c9cfeea4 Changed touch paramters on give item 2004-09-27 21:52:41 +00:00
4fcad51d25 updated to use amx_show_activity in hud messages 2004-09-27 17:43:40 +00:00
c2a2fc7dbe Added forward parameters overrun check in prepareArray 2004-09-27 14:33:50 +00:00
3f0d3c257a Increased maximal number of forward parameters 2004-09-27 14:33:20 +00:00
ecc07d4b45 Fixed some small mistakes. 2004-09-27 13:45:13 +00:00
8da965552b TK offset for AMD64 added. 2004-09-27 13:28:51 +00:00
cfe36dea52 Added 2 of 3 new offsets for amd64 2004-09-27 10:54:41 +00:00
c16eab09ec Fixed a typo 2004-09-27 09:53:56 +00:00
d07cc0424d Fixed a typo 2004-09-27 06:09:59 +00:00
c669efd609 New stuff in cstrike module:
cs_get_user_driving()
cs_set_user_tked()
cs_get_user_tked

Also cs_?et_user_deaths() offset updated.

Thanks to Damaged Soul for these.
2004-09-26 13:02:22 +00:00
c3151b312a Fixed (and slightly tweaked) make_deathmsg (jtp10181) 2004-09-26 00:43:43 +00:00
3fc3ece5b0 Added cs_get_weapon_type(index) 2004-09-25 23:24:34 +00:00
6887dfef16 CS: buyzone offset update to 235 2004-09-24 21:13:07 +00:00
867e7615ae stupid bug go squish 2004-09-24 19:36:24 +00:00
5157be6e3d Updated offset for VIP: to 209 2004-09-24 05:21:39 +00:00
82ca25b231 wow... =/ 2004-09-23 21:00:43 +00:00
a555f9b3f0 Fixed message blocks (jtp10181) 2004-09-23 20:59:26 +00:00
c1a6ce2565 Fixed typo (ktrain) 2004-09-22 23:27:55 +00:00
8874666109 removed extraneous functions (jtp10181) 2004-09-21 23:33:29 +00:00
5233be593f added dod_set_user_kills 2004-09-21 21:25:30 +00:00
0f38a24555 added dod classes 2004-09-21 20:51:29 +00:00
8d06f80eeb fixed some bugs in weapon stats functions 2004-09-21 18:04:22 +00:00
0983698d2e fixed motd 2004-09-21 17:48:48 +00:00
dde43b6e0d Fixed CVARs not registering properly (hullu) 2004-09-21 15:49:36 +00:00
4382158b88 *** empty log message *** 2004-09-21 15:45:08 +00:00
ba69d73785 Fixed alphanumeric bug (theprog) 2004-09-21 05:20:18 +00:00
be3d078d5a added is_amd64_server 2004-09-21 02:40:30 +00:00
b8ca4586ad fix from fsfod 2004-09-20 22:17:14 +00:00
25750d2f05 Changes incorporated into base package 2004-09-20 17:58:48 +00:00
423a467a70 Added new maps in beta5 2004-09-20 10:23:47 +00:00
d6e18a3e97 Better comments for unstuck 2004-09-20 09:57:48 +00:00
a6d5d89209 Commented out unstuck plugin 2004-09-20 09:56:05 +00:00
16b35006bd Removed "id" from amx_ban for new format. 2004-09-20 09:36:28 +00:00
2559 changed files with 944486 additions and 162803 deletions

24
.gitattributes vendored Normal file
View File

@ -0,0 +1,24 @@
# Auto detect text files and perform LF normalization
* text=auto
# Tell GitHub that these files are SourcePawn
*.inc text linguist-language=sourcepawn
*.sma text linguist-language=sourcepawn
# Custom for Visual Studio
*.cs diff=csharp
# Sources
*.C text
*.cc text
*.cxx text
*.cpp text
*.c++ text
*.hpp text
*.h text
*.h++ text
*.hh text
# Compiled Object files
*.o binary
*.obj binary

74
.github/CONTRIBUTING.md vendored Normal file
View File

@ -0,0 +1,74 @@
# Contributing to AMX Mod X
## Issue reports
Please consider the following guidelines when reporting an issue.
#### Not for general support
This is not the right place to get help with using or installing AMX Mod X, or for issues with specific, third-party AMX Mod X plugins or extensions.
For help with AMX Mod X, please consult the [AlliedModders forums](https://forums.alliedmods.net/forumdisplay.php?f=3). Similarly, for assistance with, or to report issues with, third-party AMX Mod X plugins or extensions, you should post in the existing thread for that plugin or extension on the [AlliedModders forums](https://forums.alliedmods.net/forumdisplay.php?f=3).
#### Details, details, details
Provide as much detail as possible when reporting an issue.
For bugs or other undesired behavior, answers to the following questions are a great start:
* What is the issue?
* What behavior are you expecting instead?
* On what operating system is the game server running?
* What game is the game server running?
* What exact versions (full x.y.z.a version number) of Metamod and AMX Mod X are installed on the game server?
* What is the specific, shortest path to reproducing this issue? If this issue can be reproduced with plugin code, please try to shorten it to the minimum required to trigger the problem.
If this is a feature request, the following are helpful. Generally, not all will apply, but whatever you can answer ahead of time will shorten back and forth conversation.
* What is your end goal, or what are you trying to accomplish?
* Why is this necessary, or what benefit do you see with it?
* Will this be useful to others?
#### Issues with security implications
Please report any security bugs to [security@alliedmods.net](mailto:security@alliedmods.net) rather than to this public issue tracker.
#### We're only human
Please keep in mind that we maintain this project in our spare time, at no cost. There is no SLA, and you are not owed a response or a fix.
#### Conduct
Please refer to the [AlliedModders forum rules.](https://forums.alliedmods.net/misc.php?do=showrules)
## Pull Requests
Firstly, thank you for considering contributing changes to the project!
However, if this is anything more than a small fix such as a gamedata update, a glaring code flaw, or a simple typo in a file like this one, please file an issue first so that it can be discussed, unless you have already spoken to multiple members of the development team about it on IRC or the AlliedModders forums.
We don't like to have to reject pull requests, so we want to avoid those scenarios. We wouldn't want you to feel like you wasted your time writing something only for us to shoot it down.
#### Rejection
*Copied from Phabricator's [Contributing Code guidelines](https://secure.phabricator.com/book/phabcontrib/article/contributing_code/#rejecting-patches), as we largely feel the same way about this.*
> If you send us a patch without coordinating it with us first, it will probably be immediately rejected, or sit in limbo for a long time and eventually be rejected. The reasons we do this vary from patch to patch, but some of the most common reasons are:
>
> **Unjustifiable Costs**: We support code in the upstream forever. Support is enormously expensive and takes up a huge amount of our time. The cost to support a change over its lifetime is often 10x or 100x or 1000x greater than the cost to write the first version of it. Many uncoordinated patches we receive are "white elephants", which would cost much more to maintain than the value they provide.
>
> As an author, it may look like you're giving us free work and we're rejecting it as too expensive, but this viewpoint doesn't align with the reality of a large project which is actively supported by a small, experienced team. Writing code is cheap; maintaining it is expensive.
>
> By coordinating with us first, you can make sure the patch is something we consider valuable enough to put long-term support resources behind, and that you're building it in a way that we're comfortable taking over.
>
> **Not a Good Fit**: Many patches aren't good fits for the upstream: they implement features we simply don't want. You can find more information in Contributing Feature Requests. Coordinating with us first helps make sure we're on the same page and interested in a feature.
>
> The most common type of patch along these lines is a patch which adds new configuration options. We consider additional configuration options to have an exceptionally high lifetime support cost and are very unlikely to accept them. Coordinate with us first.
>
> **Not a Priority**: If you send us a patch against something which isn't a priority, we probably won't have time to look at it. We don't give special treatment to low-priority issues just because there's code written: we'd still be spending time on something lower-priority when we could be spending it on something higher-priority instead.
>
> If you coordinate with us first, you can make sure your patch is in an area of the codebase that we can prioritize.
>
> **Overly Ambitious Patches**: Sometimes we'll get huge patches from new contributors. These can have a lot of fundamental problems and require a huge amount of our time to review and correct. If you're interested in contributing, you'll have more success if you start small and learn as you go.
>
> We can help you break a large change into smaller pieces and learn how the codebase works as you proceed through the implementation, but only if you coordinate with us first.
>
> **Generality**: We often receive several feature requests which ask for similar features, and can come up with a general approach which covers all of the use cases. If you send us a patch for your use case only, the approach may be too specific. When a cleaner and more general approach is available, we usually prefer to pursue it.
>
> By coordinating with us first, we can make you aware of similar use cases and opportunities to generalize an approach. These changes are often small, but can have a big impact on how useful a piece of code is.
>
> **Infrastructure and Sequencing**: Sometimes patches are written against a piece of infrastructure with major planned changes. We don't want to accept these because they'll make the infrastructure changes more difficult to implement.
>
> Coordinate with us first to make sure a change doesn't need to wait on other pieces of infrastructure. We can help you identify technical blockers and possibly guide you through resolving them if you're interested.

12
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://www.sourcemod.net/donate.php

25
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,25 @@
# Help us help you
- [ ] I have checked that my issue [doesn't exist yet](https://github.com/alliedmodders/amxmodx/issues).
- [ ] I have tried my absolute best to reduce the problem-space and have provided the absolute smallest test-case possible.
- [ ] I can always reproduce the issue with the provided description below.
# Environment
* Operating System version:
* Game/AppID (with version if applicable):
* Current AMX Mod X version:
* Current Metamod version:
- [ ] I have updated AMX Mod X to the [latest version](https://www.amxmodx.org/downloads.php) and it still happens.
- [ ] I have updated AMX Mod X to the [latest snapshot](https://www.amxmodx.org/snapshots.php) and it still happens.
- [ ] I have updated Metamod to the [latest version](https://www.amxmodx.org/downloads.php) and it still happens.
# Description
# Problematic Code (or Steps to Reproduce)
```PAWN
// TODO(you): code here to reproduce the problem
```
# Logs
* Please attach in separate files: game output, library logs, kernel logs, and any other supporting information.
* In case of a crash, please attach minidump or dump analyze output.

137
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,137 @@
name: Continuous Integration
on:
workflow_dispatch:
push:
branches:
- master
- 1.9-dev
pull_request:
branches:
- master
- 1.9-dev
jobs:
test:
strategy:
matrix:
include:
- os: ubuntu-latest
os_short: linux
compiler_cc: gcc
compiler_cxx: g++
- os: ubuntu-latest
os_short: linux
compiler_cc: clang
compiler_cxx: clang++
- os: ubuntu-18.04
os_short: linux
compiler_cc: clang-3.9
compiler_cxx: clang++-3.9
- os: ubuntu-18.04
os_short: linux
compiler_cc: gcc-6
compiler_cxx: g++-6
compiler_install: 'g++6 g++-6-multilib'
- os: windows-latest
os_short: windows
compiler_cc: msvc
- os: windows-2016
os_short: windows
compiler_cc: msvc++14.16-vs2017-cl
# MacOS 32 Bins seem not supported
# - os: macos-latest
# os_short: mac
# compiler_cc: clang
# compiler_cxx: clang++
fail-fast: false
runs-on: ${{ matrix.os }}
name: ${{ matrix.os_short }}-${{ matrix.os }}-${{ matrix.compiler_cc }}
env:
DEPENDENCIES_FOLDER: dependencies
DEPENDENCIES_ROOT: ${{ github.workspace }}/dependencies
DEPENDENCIES_ROOT_WIN: ${{ github.workspace }}\dependencies
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
path: amxmodx
# Setup Python for AMBuild
- uses: actions/setup-python@v2
name: Setup Python 3.8
with:
python-version: 3.8
- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip setuptools wheel
python3 --version
- name: Install AMXModX dependencies (Linux)
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
shell: bash
run: |
mkdir -p ${{ env.DEPENDENCIES_FOLDER }}
cd ${{ env.DEPENDENCIES_FOLDER }}
# Satisfy checkout-deps requirement for a "amxmodx" folder.
mkdir -p amxmodx
../amxmodx/support/checkout-deps.sh
- name: Install AMXModX dependencies (Windows)
if: startsWith(runner.os, 'Windows')
shell: cmd
run: |
mkdir %DEPENDENCIES_ROOT_WIN%\nasm
curl -L -o "%DEPENDENCIES_ROOT_WIN%\nasm\nasm.zip" https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/win32/nasm-2.13.03-win32.zip
chdir %DEPENDENCIES_ROOT_WIN%\nasm
7z x nasm.zip
chdir %DEPENDENCIES_ROOT_WIN%
git clone https://github.com/alliedmodders/ambuild
git clone https://github.com/alliedmodders/metamod-hl1 metamod-am
git clone https://github.com/alliedmodders/hlsdk
curl -L -o "mysql-connector-c-6.1.1-win32.zip" https://downloads.mysql.com/archives/get/p/19/file/mysql-connector-c-6.1.1-win32.zip
7z x mysql-connector-c-6.1.1-win32.zip -o"mysql"
cd mysql
dir
ren mysql-connector-c-6.1.1-win32 mysql-5.5
move /Y mysql-5.5 ..\
cd ..\ambuild
python3 setup.py install
- name: Install Linux dependencies
if: startsWith(runner.os, 'Linux')
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
gcc-multilib g++-multilib libstdc++6 lib32stdc++6 \
libc6-dev libc6-dev-i386 linux-libc-dev \
linux-libc-dev:i386 lib32z1-dev nasm ${{ matrix.compiler_cc }} ${{ matrix.compiler_install }}
- name: Select compiler
if: startsWith(runner.os, 'Linux')
run: |
echo "CC=${{ matrix.compiler_cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.compiler_cxx }}" >> $GITHUB_ENV
${{ matrix.compiler_cc }} --version
${{ matrix.compiler_cxx }} --version
- uses: ilammy/setup-nasm@v1
- name: Build Linux/macOS
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
working-directory: amxmodx
run: |
mkdir build
cd build
python3 ../configure.py --enable-optimize --metamod=${{ env.DEPENDENCIES_ROOT }}/metamod-am --hlsdk=${{ env.DEPENDENCIES_ROOT }}/hlsdk --mysql=${{ env.DEPENDENCIES_ROOT }}/mysql-5.5
ambuild
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86
- name: Build Windows
if: startsWith(runner.os, 'Windows')
working-directory: amxmodx
shell: cmd
run: |
cl.exe
mkdir build
cd build
python3 ../configure.py --enable-optimize --metamod=${{ env.DEPENDENCIES_ROOT_WIN }}\metamod-am --hlsdk=${{ env.DEPENDENCIES_ROOT_WIN }}\hlsdk --mysql=${{ env.DEPENDENCIES_ROOT_WIN }}\mysql-5.5
ambuild

90
.gitignore vendored Normal file
View File

@ -0,0 +1,90 @@
# Binaries
*.dll
*.exe
*.so
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
JITDebug/
JITRelease/
JITDebugBinLog/
JITReleaseBinLog/
x64/
build/
[Bb]in/
[Oo]bj/
build/
obj-*/
# Visual Studio 2015 cache/options directory
.vs/
.vscode/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# Files generated by Mac OS X Finder
.DS_Store
# Files generated by Windows Explorer
Desktop.ini
Thumbs.db
# AMXX plugin build related files
plugins/compile.dat
plugins/compiled/
*.amx
*.amxx
build_deps/

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "public/amtl"]
path = public/amtl
url = https://github.com/alliedmodders/amtl

30
.travis.yml Normal file
View File

@ -0,0 +1,30 @@
addons:
apt:
packages:
- clang-3.7
- lib32stdc++6
- lib32z1-dev
- libc6-dev-i386
- linux-libc-dev
- gcc-multilib
- g++-multilib
- nasm
sources:
- llvm-toolchain-precise-3.7
- ubuntu-toolchain-r-test
language: cpp
sudo: false
compiler:
- clang
install:
- pyenv install 3.6.3
- pyenv global 3.6.3
before_script:
- CHECKOUT_DIR=$PWD && cd ..
- chmod a+x $CHECKOUT_DIR/support/checkout-deps.sh
- $CHECKOUT_DIR/support/checkout-deps.sh && cd $CHECKOUT_DIR
script:
- mkdir build && cd build
- PATH="~/.local/bin:$PATH"
- CC=clang-3.7 CXX=clang-3.7 python3 ../configure.py --enable-optimize
- ambuild

514
AMBuildScript Normal file
View File

@ -0,0 +1,514 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python :
import os
import subprocess
import locale
class AMXXConfig(object):
def __init__(self):
self.binaries = []
self.modules = []
self.plugins = {}
self.libpc300 = None
self.amxxpc = None
self.metamod_path = None
self.hlsdk_path = None
self.mysql_path = None
self.generated_headers = []
self.versionlib = None
self.zlib = None
self.hashing = None
self.utf8rewind = None
self.csx_app = None
self.stdcxx_path = None
self.nasm_path = None
def use_auto_versioning(self):
if builder.backend != 'amb2':
return False
return not getattr(builder.options, 'disable_auto_versioning', False)
def detectProductVersion(self):
builder.AddConfigureFile('product.version')
# For OS X dylib versioning
import re
with open(os.path.join(builder.sourcePath, 'product.version'), 'r') as fp:
productContents = fp.read()
m = re.match('(\d+)\.(\d+)\.(\d+).*', productContents)
if m == None:
self.productVersion = '1.0.0'
else:
major, minor, release = m.groups()
self.productVersion = '{0}.{1}.{2}'.format(major, minor, release)
def detectMetamod(self):
metamod_path = builder.options.metamod_path
if not len(metamod_path):
metamod_path = os.getenv('METAMOD', '')
if len(metamod_path):
self.metamod_path = os.path.join(builder.originalCwd, metamod_path)
if not os.path.exists(os.path.join(self.metamod_path, 'metamod')):
raise Exception('Metamod path does not exist: {0}'.format(metamod_path))
else:
try_paths = [
os.path.join(builder.sourcePath, '..', 'metamod'),
os.path.join(builder.sourcePath, '..', 'metamod-am'),
os.path.join(builder.sourcePath, '..', 'metamod-hl1'),
]
for try_path in try_paths:
if os.path.exists(os.path.join(try_path, 'metamod')):
self.metamod_path = os.path.normpath(try_path)
break
if not self.metamod_path:
raise Exception('Could not find the source code to Metamod! Try passing --metamod to configure.py.')
def detectHlsdk(self):
hlsdk_path = builder.options.hlsdk_path
if not len(hlsdk_path):
hlsdk_path = os.getenv('HLSDK', '')
if len(hlsdk_path):
self.hlsdk_path = os.path.join(builder.originalCwd, hlsdk_path)
if not os.path.exists(self.hlsdk_path):
raise Exception('HLSDK path does not exist: {0}'.format(hlsdk_path))
else:
try_paths = [
os.path.join(builder.sourcePath, '..', 'hlsdk'),
]
for try_path in try_paths:
if os.path.exists(try_path):
self.hlsdk_path = os.path.normpath(try_path)
break
if not self.hlsdk_path:
raise Exception('Could not find the HLSDK! Try passing --hlsdk to configure.py.')
def detectMysql(self):
if builder.options.disable_mysql:
return
mysql_path = builder.options.mysql_path
if not len(mysql_path):
mysql_path = os.getenv('MYSQL55', '')
if len(mysql_path):
self.mysql_path = os.path.join(builder.originalCwd, mysql_path)
if not os.path.exists(self.mysql_path):
raise Exception('MySQL path does not exist: {0}'.format(mysql_path))
else:
try_paths = [
os.path.join(builder.sourcePath, '..', 'mysql-5.5'),
]
for try_path in try_paths:
if os.path.exists(try_path):
self.mysql_path = os.path.normpath(try_path)
break
if not self.mysql_path:
raise Exception('Could not find MySQL! Try passing --mysql to configure.py.')
def detectNASM(self):
import subprocess
nasm_paths = [
getattr(builder.options, 'nasm_path', 'nasm'),
]
if builder.target_platform == 'windows':
nasm_paths += [os.path.join(
builder.sourcePath,
'build_deps',
'nasm',
'nasm.exe')
]
for nasm_path in nasm_paths:
try:
subprocess.check_output([nasm_path, '-v'])
self.nasm_path = nasm_path
break
except:
pass
if self.nasm_path is None:
raise Exception('Could not find a suitable path for nasm')
# Returns list of lines of output from the compiler
@staticmethod
def invokeCompiler(args):
if builder.compiler:
p = subprocess.Popen(builder.compiler.argv + args, stdout=subprocess.PIPE)
output = p.communicate()[0]
if hasattr(output,'encoding') and output.encoding is not None:
encoding = output.encoding
else:
encoding = locale.getpreferredencoding()
return output.decode(encoding, 'replace').split('\n')
return None
def configure(self):
builder.AddConfigureFile('pushbuild.txt')
cxx = builder.DetectCompilers()
if cxx.like('gcc'):
self.configure_gcc(cxx)
elif cxx.like('msvc'):
self.configure_msvc(cxx)
# Optimization
if builder.options.opt == '1':
cxx.defines += ['NDEBUG']
# Debugging
if builder.options.debug == '1':
cxx.defines += ['DEBUG', '_DEBUG']
# Platform-specifics
if builder.target_platform == 'linux':
self.configure_linux(cxx)
elif builder.target_platform == 'mac':
self.configure_mac(cxx)
elif builder.target_platform == 'windows':
self.configure_windows(cxx)
# Finish up.
cxx.defines += [
'AMX_NOPROPLIST',
'PAWN_CELL_SIZE=32',
'AMXMODX_BUILD',
'AMXX_USE_VERSIONLIB',
]
if self.use_auto_versioning():
cxx.defines += ['AMXX_GENERATED_BUILD']
cxx.includes += [os.path.join(builder.buildPath, 'includes')]
cxx.includes += [os.path.join(builder.sourcePath, 'support', 'versionlib')]
cxx.includes += [os.path.join(builder.sourcePath, 'public')]
cxx.includes += [os.path.join(builder.sourcePath, 'public', 'sdk')]
cxx.includes += [os.path.join(builder.sourcePath, 'public', 'amtl')]
cxx.includes += [os.path.join(builder.sourcePath, 'public', 'amtl', 'amtl')]
cxx.includes += [os.path.join(builder.sourcePath, 'public', 'memtools')]
cxx.includes += [os.path.join(builder.sourcePath, 'third_party')]
cxx.includes += [os.path.join(builder.sourcePath, 'third_party', 'hashing')]
cxx.includes += [os.path.join(builder.sourcePath, 'third_party', 'zlib')]
cxx.includes += [os.path.join(builder.sourcePath, 'third_party', 'utf8rewind')]
def configure_gcc(self, cxx):
cxx.cflags += [
'-pipe',
'-fno-strict-aliasing',
'-Wall',
'-Werror',
'-Wno-uninitialized',
'-Wno-unused',
'-Wno-switch',
'-Wno-format',
'-Wno-format-security',
'-m32',
]
cxx.cxxflags += [
'-Wno-invalid-offsetof',
'-std=c++11',
]
cxx.linkflags += ['-m32']
have_gcc = cxx.vendor == 'gcc'
have_clang = cxx.vendor == 'clang'
if have_clang or (have_gcc and cxx.version >= '4'):
cxx.cflags += ['-fvisibility=hidden']
cxx.cxxflags += ['-fvisibility-inlines-hidden']
if have_clang or (have_gcc and cxx.version >= '4.6'):
cxx.cflags += ['-Wno-narrowing']
if (have_gcc and cxx.version >= '4.7') or (have_clang and cxx.version >= '3'):
cxx.cxxflags += ['-Wno-delete-non-virtual-dtor']
if have_gcc and cxx.version >= '4.8':
cxx.cflags += ['-Wno-unused-result', '-Wno-error=sign-compare']
if have_gcc and cxx.version >= '8.0':
cxx.cflags += ['-Wno-stringop-truncation']
if have_gcc and cxx.version >= '9.0':
cxx.cflags += ['-Wno-address-of-packed-member']
if have_clang:
cxx.cxxflags += ['-Wno-implicit-exception-spec-mismatch']
if cxx.version >= '10.0':
cxx.cxxflags += ['-Wno-tautological-compare']
if cxx.version >= 'apple-clang-10.0':
cxx.cxxflags += [
'-Wno-inconsistent-missing-override',
'-Wno-varargs',
]
if cxx.version >= 'apple-clang-5.1' or cxx.version >= 'clang-3.4':
cxx.cxxflags += ['-Wno-deprecated-register']
else:
cxx.cxxflags += ['-Wno-deprecated']
cxx.cflags += ['-Wno-sometimes-uninitialized']
if builder.target_platform == 'linux' and cxx.version >= '3.6':
cxx.cxxflags += ['-Wno-inconsistent-missing-override']
if builder.target_platform == 'linux' and cxx.version >= '3.9':
cxx.cxxflags += ['-Wno-varargs']
if builder.target_platform == 'linux' and cxx.version >= '4.0':
cxx.cxxflags += ['-Wno-address-of-packed-member']
if have_gcc:
cxx.cflags += ['-Wno-parentheses']
cxx.c_only_flags += ['-std=c99']
elif have_clang:
cxx.cflags += ['-Wno-logical-op-parentheses']
cxx.cxxflags += [
'-fno-exceptions',
'-fno-rtti',
]
if builder.options.opt == '1':
cxx.cflags += ['-O2']
def configure_msvc(self, cxx):
if builder.options.debug == '1':
cxx.cflags += ['/MTd']
cxx.linkflags += ['/NODEFAULTLIB:libcmt']
else:
cxx.cflags += ['/MT']
cxx.defines += [
'_CRT_SECURE_NO_DEPRECATE',
'_CRT_SECURE_NO_WARNINGS',
'_CRT_NONSTDC_NO_DEPRECATE',
'_ITERATOR_DEBUG_LEVEL=0',
]
cxx.cflags += [
'/W3',
]
cxx.cxxflags += [
'/EHsc',
'/GR-',
'/TP',
]
cxx.linkflags += [
'/MACHINE:X86',
'/SUBSYSTEM:WINDOWS',
'kernel32.lib',
'user32.lib',
'gdi32.lib',
'winspool.lib',
'comdlg32.lib',
'advapi32.lib',
'shell32.lib',
'ole32.lib',
'oleaut32.lib',
'uuid.lib',
'odbc32.lib',
'odbccp32.lib',
]
if cxx.version >= 1900:
cxx.linkflags += ['legacy_stdio_definitions.lib', 'legacy_stdio_wide_specifiers.lib']
if builder.options.opt == '1':
cxx.cflags += ['/Ox']
cxx.linkflags += ['/OPT:ICF', '/OPT:REF']
if builder.options.debug == '1':
cxx.cflags += ['/Od', '/RTC1']
# This needs to be after our optimization flags which could otherwise disable it.
# Don't omit the frame pointer.
cxx.cflags += ['/Oy-']
def configure_linux(self, cxx):
cxx.defines += ['_LINUX', 'POSIX', 'LINUX']
cxx.linkflags += ['-ldl', '-lm']
if cxx.vendor == 'gcc':
cxx.linkflags += ['-static-libgcc']
elif cxx.vendor == 'clang':
cxx.linkflags += ['-lgcc_eh']
if cxx.like('gcc'):
self.stdcxx_path = self.invokeCompiler(['-m32', '-print-file-name=' + 'libstdc++.a'])[0]
def configure_mac(self, cxx):
cxx.defines += ['OSX', '_OSX', 'POSIX']
cxx.cflags += [
'-mmacosx-version-min=10.7',
'-Wno-address-of-packed-member',
]
cxx.linkflags += [
'-mmacosx-version-min=10.7',
'-arch', 'i386',
'-lstdc++',
'-stdlib=libc++',
'-framework', 'CoreServices',
]
cxx.cxxflags += ['-stdlib=libc++']
def configure_windows(self, cxx):
cxx.defines += ['WIN32', '_WINDOWS']
#
# Low-level compiler and binary construction.
#
def ConfigureForModule(self, context, compiler):
compiler.cxxincludes += [
os.path.join(context.currentSourcePath),
os.path.join(context.currentSourcePath, 'sdk'),
os.path.join(self.metamod_path, 'metamod'),
os.path.join(self.hlsdk_path, 'common'),
os.path.join(self.hlsdk_path, 'dlls'),
os.path.join(self.hlsdk_path, 'engine'),
os.path.join(self.hlsdk_path, 'game_shared'),
os.path.join(self.hlsdk_path, 'public'),
os.path.join(self.hlsdk_path, 'pm_shared'),
]
return compiler
def AddVersioning(self, binary):
if builder.target_platform == 'windows':
binary.compiler.rcdefines += [
'BINARY_NAME="{0}"'.format(binary.outputFile),
'RC_COMPILE',
]
if self.use_auto_versioning():
binary.compiler.rcdefines += ['AMXX_GENERATED_BUILD']
elif builder.target_platform == 'mac':
if binary.type == 'library':
binary.compiler.postlink += [
'-compatibility_version', '1.0.0',
'-current_version', self.productVersion
]
if self.use_auto_versioning():
binary.compiler.linkflags += [self.versionlib]
binary.compiler.sourcedeps += AMXX.generated_headers
return binary
#
# High level job construction for libraries, metamod plugins, modules, and
# executables.
#
def Library(self, context, name):
binary = context.compiler.Library(name)
return self.AddVersioning(binary)
def MetaPlugin(self, context, name):
if builder.target_platform == 'mac' or builder.target_platform == 'windows':
name = name + '_mm'
elif builder.target_platform == 'linux':
name = name + '_mm_i386'
binary = context.compiler.Library(name)
self.ConfigureForModule(context, binary.compiler)
return self.AddVersioning(binary)
def MetaModule(self, context, name):
if builder.target_platform == 'mac' or builder.target_platform == 'windows':
name = name + '_amxx'
elif builder.target_platform == 'linux':
name = name + '_amxx_i386'
binary = context.compiler.Library(name)
self.ConfigureForModule(context, binary.compiler)
return self.AddVersioning(binary)
def Program(self, context, name):
binary = context.compiler.Program(name)
return self.AddVersioning(binary)
def AddAssembly(self, context, binary, input_file, output_file, includes=[], extra_argv=[]):
if builder.target_platform == 'windows':
obj_type = 'win32'
elif builder.target_platform == 'linux':
obj_type = 'elf32'
elif builder.target_platform == 'mac':
obj_type = 'macho32'
input_path = os.path.join(context.currentSourcePath, input_file)
output_path = output_file
argv = [
self.nasm_path,
'-I{0}{1}'.format(context.currentSourcePath, os.sep),
input_path,
'-f', obj_type,
'-o', output_path,
] + extra_argv
extra_includes = []
for include_file in includes:
extra_includes.append(os.path.join(context.currentSourcePath, include_file))
cmd_node, output_nodes = context.AddCommand(
inputs = [input_path] + extra_includes,
argv = argv,
outputs = [output_path])
binary.compiler.linkflags += [output_nodes[0]]
AMXX = AMXXConfig()
AMXX.detectProductVersion()
AMXX.detectMetamod()
AMXX.detectHlsdk()
AMXX.detectMysql()
AMXX.detectNASM()
AMXX.configure()
if AMXX.use_auto_versioning():
AMXX.generated_headers = builder.RunScript(
'support/Versioning',
{ 'AMXX': AMXX }
)
AMXX.versionlib = builder.RunScript(
'support/versionlib/AMBuilder',
{ 'AMXX': AMXX }
)
AMXX.zlib = builder.RunScript(
'third_party/zlib/AMBuilder'
)
AMXX.hashing = builder.RunScript(
'third_party/hashing/AMBuilder'
)
AMXX.utf8rewind = builder.RunScript(
'third_party/utf8rewind/AMBuilder'
)
builder.RunBuildScripts(
[
'amxmodx/AMBuilder',
'compiler/amxxpc/AMBuilder',
'compiler/libpc300/AMBuilder',
'modules/cstrike/cstrike/AMBuilder',
'modules/cstrike/csx/AMBuilder',
'modules/dod/dodfun/AMBuilder',
'modules/dod/dodx/AMBuilder',
'modules/engine/AMBuilder',
'modules/fakemeta/AMBuilder',
'modules/fun/AMBuilder',
'modules/geoip/AMBuilder',
'modules/hamsandwich/AMBuilder',
'modules/json/AMBuilder',
'modules/mysqlx/AMBuilder',
'modules/ns/AMBuilder',
'modules/nvault/AMBuilder',
'modules/regex/AMBuilder',
'modules/sockets/AMBuilder',
'modules/sqlite/AMBuilder',
'modules/tfcx/AMBuilder',
'modules/ts/tsfun/AMBuilder',
'modules/ts/tsx/AMBuilder',
],
{ 'AMXX': AMXX }
)
# The csstats.dat reader is Windows-only.
if builder.target_platform == 'windows':
builder.RunScript('modules/cstrike/csx/WinCSX/AMBuilder', { 'AMXX': AMXX })
if builder.backend == 'amb2':
builder.RunBuildScripts([
'plugins/AMBuilder',
'support/PackageScript',
],
{ 'AMXX': AMXX }
)

22
README.md Normal file
View File

@ -0,0 +1,22 @@
<p align="center">
<img src="https://github.com/alliedmodders/amxmodx/blob/master/editor/studio/AMXXLarge.bmp"/>
</p>
**AMX Mod X** is a [Metamod](https://github.com/jkivilin/metamod-p) plugin for [Half-Life 1](https://github.com/ValveSoftware/halflife). It provides comprehensive scripting for the game engine and its mods. Scripts can intercept network messages, log events, commands, client commands, set cvars, modify entities, and more. AMX Mod X also has a system for extending native scripting through modules, leading to outside support for things like MySQL and Sockets.
General
-------
- [AMXX website](https://amxmodx.org/)
- [Forum](https://forums.alliedmods.net/forumdisplay.php?f=3): Discussion forum including plugin/extension development
- [General documentation](https://wiki.alliedmods.net/Category:Documentation_%28AMX_Mod_X%29): Miscellaneous information about AMXX
- [Latest release](https://amxmodx.org/downloads.php): The latest stable AMXX release
- [Build snapshots](https://www.amxmodx.org/downloads-new.php): Builds of recent development versions
Development
-----------
- [Issue tracker](https://github.com/alliedmodders/amxmodx/issues): Issues that require back and forth communication
- [Issue archive](https://bugs.alliedmods.net/describecomponents.cgi?product=AMX%20Mod%20X): Old issue tracker (read-only)
- [Building AMXX](https://wiki.alliedmods.net/Building_AMX_Mod_X): Instructions on how to build AMXX itself using [AMBuild](https://github.com/alliedmodders/ambuild)
- [AMX Mod X API](https://amxmodx.org/api/): AMX Mod X API reference generated from include files
- [AMXX scripting](https://wiki.alliedmods.net/Category:Scripting_(AMX_Mod_X)): Pawn examples and introduction to the language

101
amxmodx/AMBuilder Normal file
View File

@ -0,0 +1,101 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os.path
binary = AMXX.MetaPlugin(builder, 'amxmodx')
binary.compiler.defines += [
'JIT',
'ASM32',
'HAVE_STDINT_H',
]
AMXX.AddAssembly(builder, binary, 'helpers-x86.asm', 'helpers-asm.obj')
AMXX.AddAssembly(builder, binary, 'natives-x86.asm', 'natives-asm.obj')
AMXX.AddAssembly(builder, binary, 'amxexecn.asm', 'amxexecn-asm.obj',
includes=['amxdefn.asm'])
AMXX.AddAssembly(builder, binary, 'amxjitsn.asm', 'amxjitsn-asm.obj',
includes=['amxdefn.asm'],
# Opcode sizes must be maximum width for patching to work.
extra_argv=['-O0'])
if builder.target_platform == 'mac':
binary.compiler.postlink += [
'-Wl,-read_only_relocs,suppress'
]
elif builder.target_platform == 'windows':
binary.compiler.linkflags += [
'/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1',
'/SECTION:.data,RW',
]
elif builder.target_platform == 'linux':
binary.compiler.postlink += [
binary.Dep(AMXX.stdcxx_path),
]
binary.compiler.linkflags += [AMXX.zlib.binary, AMXX.hashing.binary, AMXX.utf8rewind.binary]
binary.sources = [
'meta_api.cpp',
'CVault.cpp',
'vault.cpp',
'float.cpp',
'file.cpp',
'modules.cpp',
'CMisc.cpp',
'CTask.cpp',
'string.cpp',
'amxmodx.cpp',
'CEvent.cpp',
'CCmd.cpp',
'CLogEvent.cpp',
'srvcmd.cpp',
'strptime.cpp',
'amxcore.cpp',
'amxtime.cpp',
'power.cpp',
'amxxlog.cpp',
'fakemeta.cpp',
'amxxfile.cpp',
'CLang.cpp',
'emsg.cpp',
'CForward.cpp',
'CPlugin.cpp',
'CModule.cpp',
'CMenu.cpp',
'util.cpp',
'amx.cpp',
'amxdbg.cpp',
'natives.cpp',
'newmenus.cpp',
'debugger.cpp',
'optimizer.cpp',
'format.cpp',
'messages.cpp',
'libraries.cpp',
'vector.cpp',
'sorting.cpp',
'nongpl_matches.cpp',
'CFlagManager.cpp',
'datastructs.cpp',
'trie_natives.cpp',
'CDataPack.cpp',
'datapacks.cpp',
'stackstructs.cpp',
'CTextParsers.cpp',
'textparse.cpp',
'CvarManager.cpp',
'cvars.cpp',
'../public/memtools/MemoryUtils.cpp',
'../public/memtools/CDetour/detours.cpp',
'../public/memtools/CDetour/asm/asm.c',
'../public/resdk/mod_rehlds_api.cpp',
'CLibrarySys.cpp',
'CGameConfigs.cpp',
'gameconfigs.cpp',
'CoreConfig.cpp',
]
if builder.target_platform == 'windows':
binary.sources += ['version.rc']
AMXX.binaries += [builder.Add(binary)]

View File

@ -1,33 +1,11 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "CCmd.h"
@ -35,8 +13,10 @@
// *****************************************************
// class CmdMngr
// *****************************************************
CmdMngr::CmdMngr() {
memset(sortedlists,0,sizeof(sortedlists));
CmdMngr::CmdMngr()
{
memset(sortedlists, 0, sizeof(sortedlists));
srvcmdlist = 0;
clcmdlist = 0;
prefixHead = 0;
@ -49,21 +29,21 @@ CmdMngr::CmdMngr() {
}
CmdMngr::Command::Command( CPluginMngr::CPlugin* pplugin,const char* pcmd,
const char* pinfo , int pflags , int pfunc,
bool pviewable, CmdMngr* pparent ) : commandline(pcmd) , info(pinfo) {
CmdMngr::Command::Command(CPluginMngr::CPlugin* pplugin, const char* pcmd, const char* pinfo, int pflags,
int pfunc, bool pviewable, bool pinfo_ml, CmdMngr* pparent) : commandline(pcmd), info(pinfo)
{
char szCmd[64], szArg[64];
*szCmd = 0; *szArg=0;
sscanf(pcmd,"%s %s",szCmd,szArg);
command.assign(szCmd);
argument.assign(szArg);
*szCmd = 0; *szArg = 0;
sscanf(pcmd, "%s %s", szCmd, szArg);
command = szCmd;
argument = szArg;
plugin = pplugin;
flags = pflags;
cmdtype = 0;
prefix = 0;
function = pfunc;
listable = pviewable;
info_ml = pinfo_ml;
parent = pparent;
id = --uniqueid;
}
@ -73,180 +53,188 @@ CmdMngr::Command::~Command()
++uniqueid;
}
CmdMngr::Command* CmdMngr::registerCommand( CPluginMngr::CPlugin* plugin , int func , char* cmd , char* info , int level , bool listable )
CmdMngr::Command* CmdMngr::registerCommand(CPluginMngr::CPlugin* plugin, int func, const char* cmd, const char* info, int level, bool listable, bool info_ml)
{
Command* b = new Command( plugin , cmd , info , level , func , listable, this );
if ( b == 0 ) return 0;
setCmdLink( &sortedlists[0] , b );
return b;
Command* b = new Command(plugin, cmd, info, level, func, listable, info_ml, this);
if (b == 0) return 0;
setCmdLink(&sortedlists[0], b);
return b;
}
CmdMngr::Command* CmdMngr::getCmd( long int id ,int type, int access )
CmdMngr::Command* CmdMngr::getCmd(long int id, int type, int access)
{
//if ( id >= 1024 || id < 0 ) return (Command*)id;
if ( id < 0 ){
for (CmdMngr::iterator a = begin( type ); a ; ++a){
if ( (*a).id == id )
//if (id >= 1024 || id < 0) return (Command*)id;
if (id < 0)
{
for (CmdMngr::iterator a = begin(type); a ; ++a)
{
if ((*a).id == id)
return &(*a);
}
return 0;
}
if ( (id < buf_cmdid) || (access != buf_cmdaccess) || (type != buf_cmdtype) )
if ((id < buf_cmdid) || (access != buf_cmdaccess) || (type != buf_cmdtype))
{
buf_cmdptr = begin( type );
buf_cmdptr = begin(type);
buf_cmdaccess = access;
buf_cmdtype = type;
buf_cmdid = id;
}
else
{
} else {
int a = id;
id -= buf_cmdid;
buf_cmdid = a;
}
while ( buf_cmdptr )
while (buf_cmdptr)
{
if ( (*buf_cmdptr).gotAccess( access ) &&
(*buf_cmdptr).getPlugin()->isExecutable( (*buf_cmdptr).getFunction() )
&& (*buf_cmdptr).isViewable() )
if ((*buf_cmdptr).gotAccess(access) && (*buf_cmdptr).getPlugin()->isExecutable((*buf_cmdptr).getFunction()) && (*buf_cmdptr).isViewable())
{
if ( id-- == 0 )
if (id-- == 0)
return &(*buf_cmdptr);
}
++buf_cmdptr;
}
return 0;
}
int CmdMngr::getCmdNum( int type, int access )
int CmdMngr::getCmdNum(int type, int access)
{
if ( (access == buf_access) && (type == buf_type) )
return buf_num; // once calculated don't have to be done again
buf_access = access;
buf_type = type;
buf_num = 0;
CmdMngr::iterator a = begin( type );
CmdMngr::iterator a = begin(type);
while ( a )
while (a)
{
if ( (*a).gotAccess( access ) &&
(*a).getPlugin()->isExecutable( (*a).getFunction() )
&& (*a).isViewable() )
++buf_num;
if ((*a).gotAccess(access) && (*a).getPlugin()->isExecutable((*a).getFunction()) && (*a).isViewable())
++buf_num;
++a;
}
return buf_num;
}
void CmdMngr::setCmdLink( CmdLink** a , Command* c, bool sorted )
void CmdMngr::setCmdLink(CmdLink** a, Command* c, bool sorted)
{
CmdLink* np = new CmdLink( c );
CmdLink* np = new CmdLink(c);
if ( np == 0 ) return;
if (np == 0) return;
if ( sorted )
if (sorted)
{
while( *a )
while (*a)
{
int i = strcmp(c->getCommand(),(*a)->cmd->getCommand() );
int i = strcmp(c->getCommand(), (*a)->cmd->getCommand());
if ( (i<0) || (i==0) && ( strcmp( c->getArgument() , (*a)->cmd->getArgument() ) < 0 ) )
if ((i < 0) || ((i == 0) && (strcmp(c->getArgument(), (*a)->cmd->getArgument()) < 0)))
break;
a = &(*a)->next;
}
np->next = *a;
*a = np;
}
else
{
while ( *a ) a = &(*a)->next;
} else {
while (*a) a = &(*a)->next;
*a = np;
}
}
void CmdMngr::clearCmdLink( CmdLink** phead, bool pclear )
void CmdMngr::clearCmdLink(CmdLink** phead, bool pclear)
{
while( *phead ){
while (*phead)
{
CmdLink* pp = (*phead)->next;
if ( pclear ) delete (*phead)->cmd;
if (pclear) delete (*phead)->cmd;
delete *phead;
*phead = pp;
}
}
void CmdMngr::Command::setCmdType( int a )
void CmdMngr::Command::setCmdType(int a)
{
switch(a){
case CMD_ConsoleCommand: cmdtype |= 3; break;
case CMD_ClientCommand: cmdtype |= 1; break;
case CMD_ServerCommand: cmdtype |= 2; break;
switch (a)
{
case CMD_ConsoleCommand: cmdtype |= 3; break;
case CMD_ClientCommand: cmdtype |= 1; break;
case CMD_ServerCommand: cmdtype |= 2; break;
}
if ( cmdtype & 1 ) { // ClientCommand
parent->setCmdLink( &parent->sortedlists[1] , this );
if ( !parent->registerCmdPrefix( this ) )
parent->setCmdLink( &parent->clcmdlist , this , false );
if (cmdtype & 1) // ClientCommand
{
parent->setCmdLink(&parent->sortedlists[1], this);
if (!parent->registerCmdPrefix(this))
parent->setCmdLink(&parent->clcmdlist, this, false);
}
if ( cmdtype & 2 ) { // ServerCommand
parent->setCmdLink( &parent->sortedlists[2] , this );
parent->setCmdLink( &parent->srvcmdlist , this , false );
if (cmdtype & 2) // ServerCommand
{
parent->setCmdLink(&parent->sortedlists[2], this);
parent->setCmdLink(&parent->srvcmdlist, this, false);
}
}
const char* CmdMngr::Command::getCmdType() const {
switch( cmdtype ){
case 1: return"client";
case 2: return "server";
case 3: return "console";
const char* CmdMngr::Command::getCmdType() const
{
switch (cmdtype)
{
case 1: return "client";
case 2: return "server";
case 3: return "console";
}
return "unknown";
}
bool CmdMngr::registerCmdPrefix( Command* cc )
bool CmdMngr::registerCmdPrefix(Command* cc)
{
CmdPrefix** b = findPrefix( cc->getCommand() );
if (*b){
setCmdLink( &(*b)->list , cc , false );
cc->prefix = (*b)->name.size();
CmdPrefix** b = findPrefix(cc->getCommand());
if (*b)
{
setCmdLink(&(*b)->list, cc, false);
cc->prefix = (*b)->name.length();
return true;
}
return false;
}
void CmdMngr::registerPrefix( const char* nn )
void CmdMngr::registerPrefix(const char* nn)
{
if ( *nn == 0 ) return;
CmdPrefix** b = findPrefix( nn );
if (*nn == 0) return;
CmdPrefix** b = findPrefix(nn);
if (*b) return;
*b = new CmdPrefix( nn , this );
*b = new CmdPrefix(nn, this);
}
CmdMngr::CmdPrefix** CmdMngr::findPrefix( const char* nn ){
CmdMngr::CmdPrefix** CmdMngr::findPrefix(const char* nn)
{
CmdPrefix** aa = &prefixHead;
while(*aa){
if ( !strncmp( (*aa)->name.c_str(), nn, (*aa)->name.size() ) )
while (*aa)
{
if (!strncmp((*aa)->name.chars(), nn, (*aa)->name.length()))
break;
aa=&(*aa)->next;
aa = &(*aa)->next;
}
return aa;
}
void CmdMngr::clearPrefix(){
while(prefixHead){
void CmdMngr::clearPrefix()
{
while (prefixHead)
{
CmdPrefix* a = prefixHead->next;
delete prefixHead;
prefixHead = a;
@ -264,7 +252,8 @@ void CmdMngr::clear()
clearBufforedInfo();
}
void CmdMngr::clearBufforedInfo() {
void CmdMngr::clearBufforedInfo()
{
buf_type = -1;
buf_access = 0;
buf_id = -1;
@ -273,4 +262,4 @@ void CmdMngr::clearBufforedInfo() {
buf_cmdaccess = 0;
}
int CmdMngr::Command::uniqueid = 0;
int CmdMngr::Command::uniqueid = 0;

View File

@ -1,33 +1,11 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef COMMANDS_H
#define COMMANDS_H
@ -36,7 +14,8 @@
// class CmdMngr
// *****************************************************
enum {
enum
{
CMD_ConsoleCommand,
CMD_ClientCommand,
CMD_ServerCommand
@ -48,14 +27,18 @@ public:
class Command;
friend class Command;
class Command {
class Command
{
friend class CmdMngr;
CPluginMngr::CPlugin* plugin;
CmdMngr* parent;
String command;
String argument;
String commandline;
String info;
ke::AString command;
ke::AString argument;
ke::AString commandline;
ke::AString info;
bool info_ml;
bool listable;
int function;
int flags;
@ -63,33 +46,34 @@ public:
int cmdtype;
int prefix;
static int uniqueid;
Command( CPluginMngr::CPlugin* pplugin,const char* pcmd, const char* pinfo , int pflags , int pfunc, bool pviewable, CmdMngr* pparent );
Command(CPluginMngr::CPlugin* pplugin, const char* pcmd, const char* pinfo, int pflags, int pfunc, bool pviewable, bool pinfo_ml, CmdMngr* pparent);
~Command();
public:
inline const char* getCommand() { return command.c_str(); }
inline const char* getArgument() { return argument.c_str(); }
inline const char* getCmdInfo() { return info.c_str(); }
inline const char* getCmdLine() { return commandline.c_str(); }
inline bool matchCommandLine(const char* cmd, const char* arg) { return (!stricmp(command.c_str()+prefix, cmd+prefix ) && (argument.empty() || !stricmp(argument.c_str() , arg ))); }
inline bool matchCommand(const char* cmd) { return (!strcmp(command.c_str(), cmd )); }
inline const char* getCommand() { return command.chars(); }
inline const char* getArgument() { return argument.chars(); }
inline const char* getCmdInfo() { return info.chars(); }
inline const char* getCmdLine() { return commandline.chars(); }
inline bool matchCommandLine(const char* cmd, const char* arg) {return (!stricmp(command.chars() + prefix, cmd + prefix) && (!argument.length() || !stricmp(argument.chars(), arg)));}
inline bool matchCommand(const char* cmd) { return (!stricmp(command.chars(), cmd)); }
inline int getFunction() const { return function; }
inline bool gotAccess(int f) const { return (!flags||((flags & f)==flags)); }
inline bool gotAccess(int f) const { return (!flags || ((flags & f) != 0)); }
inline CPluginMngr::CPlugin* getPlugin() { return plugin; }
inline bool isViewable() const { return listable; }
inline bool isInfoML() const { return info_ml; }
inline int getFlags() const { return flags; }
inline long int getId() const { return (long int)id; }
const char* getCmdType() const;
void setCmdType( int a );
void setCmdType(int a);
};
private:
struct CmdPrefix;
friend struct CmdPrefix;
struct CmdLink {
struct CmdLink
{
Command* cmd;
CmdLink* next;
CmdLink(Command* c): cmd(c), next(0) {}
@ -99,36 +83,40 @@ private:
CmdLink* srvcmdlist;
CmdLink* clcmdlist;
struct CmdPrefix {
String name;
struct CmdPrefix
{
ke::AString name;
CmdMngr* parent;
CmdLink* list;
CmdPrefix* next;
CmdPrefix( const char* nn , CmdMngr* pp) : name(nn),parent(pp),list(0),next(0){}
~CmdPrefix(){ parent->clearCmdLink(&list); }
CmdPrefix(const char* nn, CmdMngr* pp): name(nn), parent(pp), list(0), next(0) {}
~CmdPrefix() { parent->clearCmdLink(&list); }
} *prefixHead;
bool registerCmdPrefix( Command* cc );
CmdPrefix** findPrefix( const char* nn );
bool registerCmdPrefix(Command* cc);
CmdPrefix** findPrefix(const char* nn);
void clearPrefix();
void setCmdLink( CmdLink** a , Command* c, bool sorted = true );
void clearCmdLink( CmdLink** phead, bool pclear = false );
void setCmdLink(CmdLink** a, Command* c, bool sorted = true);
void clearCmdLink(CmdLink** phead, bool pclear = false);
public:
CmdMngr();
~CmdMngr() {clear();}
~CmdMngr() { clear(); }
// Interface
void registerPrefix( const char* nn );
Command* registerCommand( CPluginMngr::CPlugin* plugin , int func , char* cmd , char* info , int level , bool listable );
Command* getCmd( long int id ,int type, int access);
int getCmdNum( int type, int access );
void registerPrefix(const char* nn);
Command* registerCommand(CPluginMngr::CPlugin* plugin, int func, const char* cmd, const char* info, int level, bool listable, bool info_ml);
Command* getCmd(long int id, int type, int access);
int getCmdNum(int type, int access);
void clearBufforedInfo();
void clear();
class iterator {
class iterator
{
CmdLink *a;
public:
iterator(CmdLink*aa = 0) : a(aa) {}
@ -138,28 +126,30 @@ public:
operator bool () const { return a ? true : false; }
Command& operator*() { return *a->cmd; }
};
inline iterator clcmdprefixbegin(const char* nn){
inline iterator clcmdprefixbegin(const char* nn)
{
CmdPrefix* a = *findPrefix(nn);
return iterator( a ? a->list : 0 );
return iterator(a ? a->list : 0);
}
inline iterator clcmdbegin() const {return iterator(clcmdlist);}
inline iterator srvcmdbegin() const {return iterator(srvcmdlist);}
inline iterator begin( int type ) const { return iterator(sortedlists[type]); }
inline iterator clcmdbegin() const { return iterator(clcmdlist); }
inline iterator srvcmdbegin() const { return iterator(srvcmdlist); }
inline iterator begin(int type) const { return iterator(sortedlists[type]); }
inline iterator end() const { return iterator(0); }
private:
int buf_cmdid;
int buf_cmdtype;
int buf_cmdaccess;
iterator buf_cmdptr;
int buf_id;
int buf_type;
int buf_access;
int buf_num;
};
#endif
#endif //COMMANDS_H

340
amxmodx/CDataPack.cpp Normal file
View File

@ -0,0 +1,340 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*/
#include "CDataPack.h"
#define DATAPACK_INITIAL_SIZE 64
CDataPack::CDataPack()
{
m_pBase = (char *)malloc(DATAPACK_INITIAL_SIZE);
m_capacity = DATAPACK_INITIAL_SIZE;
Initialize();
}
CDataPack::~CDataPack()
{
free(m_pBase);
}
void CDataPack::Initialize()
{
m_curptr = m_pBase;
m_size = 0;
}
void CDataPack::CheckSize(size_t typesize)
{
if (m_curptr - m_pBase + typesize <= m_capacity)
{
return;
}
size_t pos = m_curptr - m_pBase;
do
{
m_capacity *= 2;
} while (pos + typesize > m_capacity);
m_pBase = (char *)realloc(m_pBase, m_capacity);
m_curptr = m_pBase + pos;
}
void CDataPack::ResetSize()
{
m_size = 0;
}
size_t CDataPack::CreateMemory(size_t size, void **addr)
{
CheckSize(sizeof(char) + sizeof(size_t) + size);
size_t pos = m_curptr - m_pBase;
*(char *)m_curptr = Raw;
m_curptr += sizeof(char);
*(size_t *)m_curptr = size;
m_curptr += sizeof(size_t);
if (addr)
{
*addr = m_curptr;
}
m_curptr += size;
m_size += sizeof(char) + sizeof(size_t) + size;
return pos;
}
void CDataPack::PackCell(cell cells)
{
CheckSize(sizeof(char) + sizeof(size_t) + sizeof(cell));
*(char *)m_curptr = DataPackType::Cell;
m_curptr += sizeof(char);
*(size_t *)m_curptr = sizeof(cell);
m_curptr += sizeof(size_t);
*(cell *)m_curptr = cells;
m_curptr += sizeof(cell);
m_size += sizeof(char) + sizeof(size_t) + sizeof(cell);
}
void CDataPack::PackFloat(float val)
{
CheckSize(sizeof(char) + sizeof(size_t) + sizeof(float));
*(char *)m_curptr = DataPackType::Float;
m_curptr += sizeof(char);
*(size_t *)m_curptr = sizeof(float);
m_curptr += sizeof(size_t);
*(float *)m_curptr = val;
m_curptr += sizeof(float);
m_size += sizeof(char) + sizeof(size_t) + sizeof(float);
}
void CDataPack::PackString(const char *string)
{
size_t len = strlen(string);
size_t maxsize = sizeof(char) + sizeof(size_t) + len + 1;
CheckSize(maxsize);
*(char *)m_curptr = DataPackType::String;
m_curptr += sizeof(char);
// Pack the string length first for buffer overrun checking.
*(size_t *)m_curptr = len;
m_curptr += sizeof(size_t);
// Now pack the string.
memcpy(m_curptr, string, len);
m_curptr[len] = '\0';
m_curptr += len + 1;
m_size += maxsize;
}
void CDataPack::Reset() const
{
m_curptr = m_pBase;
}
size_t CDataPack::GetPosition() const
{
return static_cast<size_t>(m_curptr - m_pBase);
}
bool CDataPack::SetPosition(size_t pos) const
{
if (pos > m_size-1)
{
return false;
}
m_curptr = m_pBase + pos;
return true;
}
bool CDataPack::CanReadCell() const
{
if (!IsReadable(sizeof(char) + sizeof(size_t) + sizeof(cell)))
{
return false;
}
if (*reinterpret_cast<char *>(m_curptr) != DataPackType::Cell)
{
return false;
}
if (*reinterpret_cast<size_t *>(m_curptr + sizeof(char)) != sizeof(cell))
{
return false;
}
return true;
}
cell CDataPack::ReadCell() const
{
if (!CanReadCell())
{
return 0;
}
m_curptr += sizeof(char);
m_curptr += sizeof(size_t);
cell val = *reinterpret_cast<cell *>(m_curptr);
m_curptr += sizeof(cell);
return val;
}
bool CDataPack::CanReadFloat() const
{
if (!IsReadable(sizeof(char) + sizeof(size_t) + sizeof(float)))
{
return false;
}
if (*reinterpret_cast<char *>(m_curptr) != DataPackType::Float)
{
return false;
}
if (*reinterpret_cast<size_t *>(m_curptr + sizeof(char)) != sizeof(float))
{
return false;
}
return true;
}
float CDataPack::ReadFloat() const
{
if (!CanReadFloat())
{
return 0;
}
m_curptr += sizeof(char);
m_curptr += sizeof(size_t);
float val = *reinterpret_cast<float *>(m_curptr);
m_curptr += sizeof(float);
return val;
}
bool CDataPack::IsReadable(size_t bytes) const
{
return (bytes + (m_curptr - m_pBase) > m_size) ? false : true;
}
bool CDataPack::CanReadString(size_t *len) const
{
if (!IsReadable(sizeof(char) + sizeof(size_t)))
{
return false;
}
if (*reinterpret_cast<char *>(m_curptr) != DataPackType::String)
{
return false;
}
size_t real_len = *(size_t *)(m_curptr + sizeof(char));
char *str = (char *)(m_curptr + sizeof(char) + sizeof(size_t));
if ((strlen(str) != real_len) || !(IsReadable(sizeof(char) + sizeof(size_t) + real_len + 1)))
{
return false;
}
if (len)
{
*len = real_len;
}
return true;
}
const char *CDataPack::ReadString(size_t *len) const
{
size_t real_len;
if (!CanReadString(&real_len))
{
return NULL;
}
m_curptr += sizeof(char);
m_curptr += sizeof(size_t);
char *str = (char *)m_curptr;
m_curptr += real_len + 1;
if (len)
{
*len = real_len;
}
return str;
}
void *CDataPack::GetMemory() const
{
return m_curptr;
}
bool CDataPack::CanReadMemory(size_t *size) const
{
if (!IsReadable(sizeof(char) + sizeof(size_t)))
{
return false;
}
if (*reinterpret_cast<char *>(m_curptr) != DataPackType::Raw)
{
return false;
}
size_t bytecount = *(size_t *)(m_curptr + sizeof(char));
if (!IsReadable(sizeof(char) + sizeof(size_t) + bytecount))
{
return false;
}
if (size)
{
*size = bytecount;
}
return true;
}
void *CDataPack::ReadMemory(size_t *size) const
{
size_t bytecount;
if (!CanReadMemory(&bytecount))
{
return NULL;
}
m_curptr += sizeof(char);
m_curptr += sizeof(size_t);
void *ptr = m_curptr;
m_curptr += bytecount;
if (size)
{
*size = bytecount;
}
return ptr;
}

181
amxmodx/CDataPack.h Normal file
View File

@ -0,0 +1,181 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*/
#ifndef _INCLUDE_SOURCEMOD_CDATAPACK_H_
#define _INCLUDE_SOURCEMOD_CDATAPACK_H_
#include "amxmodx.h"
#include "natives_handles.h"
/**
* @brief Contains functions for packing data abstractly to/from plugins.
*/
class CDataPack
{
public:
CDataPack();
~CDataPack();
public:
/**
* @brief Resets the position in the data stream to the beginning.
*/
void Reset() const;
/**
* @brief Retrieves the current stream position.
*
* @return Index into the stream.
*/
size_t GetPosition() const;
/**
* @brief Sets the current stream position.
*
* @param pos Index to set the stream at.
* @return True if succeeded, false if out of bounds.
*/
bool SetPosition(size_t pos) const;
/**
* @brief Reads one cell from the data stream.
*
* @return A cell read from the current position.
*/
cell ReadCell() const;
/**
* @brief Reads one float from the data stream.
*
* @return A float read from the current position.
*/
float ReadFloat() const;
/**
* @brief Returns whether or not a specified number of bytes from the current stream
* position to the end can be read.
*
* @param bytes Number of bytes to simulate reading.
* @return True if can be read, false otherwise.
*/
bool IsReadable(size_t bytes) const;
/**
* @brief Reads a string from the data stream.
*
* @param len Optional pointer to store the string length.
* @return Pointer to the string, or NULL if out of bounds.
*/
const char *ReadString(size_t *len) const;
/**
* @brief Reads the current position as a generic address.
*
* @return Pointer to the memory.
*/
void *GetMemory() const;
/**
* @brief Reads the current position as a generic data type.
*
* @param size Optional pointer to store the size of the data type.
* @return Pointer to the data, or NULL if out of bounds.
*/
void *ReadMemory(size_t *size) const;
bool CanReadCell() const;
bool CanReadFloat() const;
bool CanReadString(size_t *len) const;
bool CanReadMemory(size_t *size) const;
public:
/**
* @brief Resets the used size of the stream back to zero.
*/
void ResetSize();
/**
* @brief Packs one cell into the data stream.
*
* @param cell Cell value to write.
*/
void PackCell(cell cells);
/**
* @brief Packs one float into the data stream.
*
* @param val Float value to write.
*/
void PackFloat(float val);
/**
* @brief Packs one string into the data stream.
* The length is recorded as well for buffer overrun protection.
*
* @param string String to write.
*/
void PackString(const char *string);
/**
* @brief Creates a generic block of memory in the stream.
*
* Note that the pointer it returns can be invalidated on further
* writing, since the stream size may grow. You may need to double back
* and fetch the pointer again.
*
* @param size Size of the memory to create in the stream.
* @param addr Optional pointer to store the relocated memory address.
* @return Current position of the stream beforehand.
*/
size_t CreateMemory(size_t size, void **addr);
public:
void Initialize();
private:
void CheckSize(size_t sizetype);
private:
char *m_pBase;
mutable char *m_curptr;
size_t m_capacity;
size_t m_size;
enum DataPackType {
Raw,
Cell,
Float,
String,
};
};
extern NativeHandle<CDataPack> DataPackHandles;
extern AMX_NATIVE_INFO g_DatapackNatives[];
#endif //_INCLUDE_SOURCEMOD_CDATAPACK_H_

View File

@ -1,33 +1,11 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "CEvent.h"
@ -36,7 +14,9 @@
// class ClEvent
// *****************************************************
EventsMngr::ClEvent::ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags)
NativeHandle<EventHook> EventHandles;
EventsMngr::ClEvent::ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags)
{
m_Plugin = plugin;
m_Func = func;
@ -45,17 +25,31 @@ EventsMngr::ClEvent::ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags)
m_FlagAlive = true;
m_FlagDead = true;
m_FlagWorld = (flags & 1) ? true : false; // flag a
m_FlagPlayer = (flags & 2) ? true : false; // flag b
m_FlagOnce = (flags & 4) ? true : false; // flag c
m_FlagWorld = (flags & 1) ? true : false; // flag a
m_FlagClient = (flags & 2) ? true : false; // flag b
m_FlagOnce = (flags & 4) ? true : false; // flag c
if (flags & 24)
{
m_FlagAlive = (flags & 16) ? true : false; // flag e
m_FlagDead = (flags & 8) ? true : false; // flag d
m_FlagAlive = (flags & 16) ? true : false; // flag e
m_FlagDead = (flags & 8) ? true : false; // flag d
}
if (m_FlagClient)
{
m_FlagPlayer = true;
m_FlagBot = true;
if (flags & 96)
{
m_FlagPlayer = (flags & 32) ? true : false; // flag f
m_FlagBot = (flags & 64) ? true : false; // flag g
}
}
m_Stamp = 0.0f;
m_Done = false;
m_State = FSTATE_ACTIVE;
m_Conditions = NULL;
}
@ -64,12 +58,14 @@ EventsMngr::ClEvent::~ClEvent()
{
cond_t *tmp1 = m_Conditions;
cond_t *tmp2 = NULL;
while (tmp1)
{
tmp2 = tmp1->next;
delete tmp1;
tmp1 = tmp2;
}
m_Conditions = NULL;
}
@ -82,14 +78,17 @@ void EventsMngr::NextParam()
MsgDataEntry *tmp = NULL;
int tmpSize = 0;
if (m_ParseVault)
{
// copy to tmp
tmp = new MsgDataEntry[m_ParseVaultSize];
if (!tmp)
{
return; // :TODO: Error report !!
}
memcpy(tmp, m_ParseVault, m_ParseVaultSize * sizeof(MsgDataEntry));
tmpSize = m_ParseVaultSize;
delete [] m_ParseVault;
@ -102,6 +101,7 @@ void EventsMngr::NextParam()
m_ParseVaultSize = INITIAL_PARSEVAULT_SIZE;
m_ParseVault = new MsgDataEntry[m_ParseVaultSize];
if (tmp)
{
memcpy(m_ParseVault, tmp, tmpSize * sizeof(MsgDataEntry));
@ -119,7 +119,11 @@ EventsMngr::EventsMngr()
{
m_ParseVault = NULL;
m_ParseVaultSize = 0;
m_CurrentMsgType = -1;
m_ParseMsgType = -1;
m_ReadVault = NULL;
m_ReadVaultSize = 0;
m_ReadPos = -1;
m_ReadMsgType = -1;
clearEvents();
}
@ -128,7 +132,6 @@ EventsMngr::~EventsMngr()
clearEvents();
}
CPluginMngr::CPlugin * EventsMngr::ClEvent::getPlugin()
{
return m_Plugin;
@ -169,8 +172,8 @@ void EventsMngr::ClEvent::registerFilter(char *filter)
tmpCond->paramId = atoi(filter);
// rest of line
tmpCond->sValue.assign(value);
tmpCond->fValue = atof(value);
tmpCond->sValue = value;
tmpCond->fValue = static_cast<float>(atof(value));
tmpCond->iValue = atoi(value);
tmpCond->next = NULL;
@ -178,28 +181,41 @@ void EventsMngr::ClEvent::registerFilter(char *filter)
if (m_Conditions)
{
cond_t *tmp = m_Conditions;
while (tmp->next)
tmp = tmp->next;
tmp->next = tmpCond;
}
else
m_Conditions = tmpCond;
}
EventsMngr::ClEvent* EventsMngr::registerEvent(CPluginMngr::CPlugin* plugin, int func, int flags, int msgid)
void EventsMngr::ClEvent::setForwardState(ForwardState state)
{
m_State = state;
}
int EventsMngr::registerEvent(CPluginMngr::CPlugin* plugin, int func, int flags, int msgid)
{
// validate parameter
if (msgid < 0 || msgid >= MAX_AMX_REG_MSG)
return NULL;
{
return 0;
}
ClEvent *event = new ClEvent(plugin, func, flags);
if (!event)
return NULL;
auto event = ke::AutoPtr<ClEvent>(new ClEvent(plugin, func, flags));
m_Events[msgid].put(event);
int handle = EventHandles.create(event.get());
if (!handle)
{
return 0;
}
return event;
m_Events[msgid].append(ke::Move(event));
return handle;
}
void EventsMngr::parserInit(int msg_type, float* timer, CPlayer* pPlayer, int index)
@ -207,46 +223,46 @@ void EventsMngr::parserInit(int msg_type, float* timer, CPlayer* pPlayer, int in
if (msg_type < 0 || msg_type > MAX_AMX_REG_MSG)
return;
m_CurrentMsgType = msg_type;
m_ParseNotDone = false;
m_Timer = timer;
// don't parse if nothing to do
if (!m_Events[msg_type].size())
if (!m_Events[msg_type].length())
return;
for(ClEventVecIter iter = m_Events[msg_type].begin(); iter; ++iter)
m_ParseMsgType = msg_type;
m_Timer = timer;
for (auto &event : m_Events[msg_type])
{
if ((*iter).m_Done)
if (event->m_Done)
continue;
if (!(*iter).m_Plugin->isExecutable((*iter).m_Func))
if (!event->m_Plugin->isExecutable(event->m_Func))
{
(*iter).m_Done = true;
event->m_Done = true;
continue;
}
if (pPlayer)
{
if (!(*iter).m_FlagPlayer || (pPlayer->IsAlive() ? !(*iter).m_FlagAlive : !(*iter).m_FlagDead ) )
if (!event->m_FlagClient || (pPlayer->IsBot() ? !event->m_FlagBot : !event->m_FlagPlayer) || (pPlayer->IsAlive() ? !event->m_FlagAlive : !event->m_FlagDead))
{
(*iter).m_Done = true;
event->m_Done = true;
continue;
}
}
else if (!(*iter).m_FlagWorld)
else if (!event->m_FlagWorld)
{
(*iter).m_Done = true;
event->m_Done = true;
continue;
}
if ((*iter).m_FlagOnce && (*iter).m_Stamp == (float)(*timer))
if (event->m_FlagOnce && event->m_Stamp == *timer)
{
(*iter).m_Done = true;
event->m_Done = true;
continue;
}
m_ParseNotDone = true;
}
@ -257,6 +273,7 @@ void EventsMngr::parserInit(int msg_type, float* timer, CPlayer* pPlayer, int in
m_ParseVault[0].type = MSG_INTEGER;
m_ParseVault[0].iValue = index;
}
m_ParseFun = &m_Events[msg_type];
}
@ -266,7 +283,6 @@ void EventsMngr::parseValue(int iValue)
if (!m_ParseNotDone || !m_ParseFun)
return;
// grow if needed
++m_ParsePos;
NextParam();
@ -276,33 +292,35 @@ void EventsMngr::parseValue(int iValue)
// loop through the registered funcs, and decide whether they have to be called or not
// if they shouldnt, their m_Done is set to true
for (ClEventVecIter iter = m_ParseFun->begin(); iter; ++iter)
for (auto &event : *m_ParseFun)
{
if ((*iter).m_Done)
if (event->m_Done)
continue; // already skipped; don't bother with parsing
// loop through conditions
bool execute = false;
bool anyConditions = false;
for (ClEvent::cond_t *condIter = (*iter).m_Conditions; condIter; condIter = condIter->next)
for (auto condIter = event->m_Conditions; condIter; condIter = condIter->next)
{
if (condIter->paramId == m_ParsePos)
{
anyConditions = true;
switch(condIter->type)
switch (condIter->type)
{
case '=': if (condIter->iValue == iValue) execute=true; break;
case '!': if (condIter->iValue != iValue) execute=true; break;
case '&': if (iValue & condIter->iValue) execute=true; break;
case '<': if (iValue < condIter->iValue) execute=true; break;
case '>': if (iValue > condIter->iValue) execute=true; break;
case '=': if (condIter->iValue == iValue) execute = true; break;
case '!': if (condIter->iValue != iValue) execute = true; break;
case '&': if (iValue & condIter->iValue) execute = true; break;
case '<': if (iValue < condIter->iValue) execute = true; break;
case '>': if (iValue > condIter->iValue) execute = true; break;
}
if (execute)
break;
}
}
if (anyConditions && !execute)
(*iter).m_Done = true; // don't execute
event->m_Done = true; // don't execute
}
}
@ -312,7 +330,6 @@ void EventsMngr::parseValue(float fValue)
if (!m_ParseNotDone || !m_ParseFun)
return;
// grow if needed
++m_ParsePos;
NextParam();
@ -322,32 +339,35 @@ void EventsMngr::parseValue(float fValue)
// loop through the registered funcs, and decide whether they have to be called or not
// if they shouldnt, their m_Done is set to true
for (ClEventVecIter iter = m_ParseFun->begin(); iter; ++iter)
for (auto &event : *m_ParseFun)
{
if ((*iter).m_Done)
if (event->m_Done)
continue; // already skipped; don't bother with parsing
// loop through conditions
bool execute = false;
bool anyConditions = false;
for (ClEvent::cond_t *condIter = (*iter).m_Conditions; condIter; condIter = condIter->next)
for (auto condIter = event->m_Conditions; condIter; condIter = condIter->next)
{
if (condIter->paramId == m_ParsePos)
{
anyConditions = true;
switch(condIter->type)
switch (condIter->type)
{
case '=': if (condIter->fValue == fValue) execute=true; break;
case '!': if (condIter->fValue != fValue) execute=true; break;
case '<': if (fValue < condIter->fValue) execute=true; break;
case '>': if (fValue > condIter->fValue) execute=true; break;
case '=': if (condIter->fValue == fValue) execute = true; break;
case '!': if (condIter->fValue != fValue) execute = true; break;
case '<': if (fValue < condIter->fValue) execute = true; break;
case '>': if (fValue > condIter->fValue) execute = true; break;
}
if (execute)
break;
}
}
if (anyConditions && !execute)
(*iter).m_Done = true; // don't execute
event->m_Done = true; // don't execute
}
}
@ -366,129 +386,161 @@ void EventsMngr::parseValue(const char *sz)
// loop through the registered funcs, and decide whether they have to be called or not
// if they shouldnt, their m_Done is set to true
for (ClEventVecIter iter = m_ParseFun->begin(); iter; ++iter)
for (auto &event : *m_ParseFun)
{
if ((*iter).m_Done)
if (event->m_Done)
continue; // already skipped; don't bother with parsing
// loop through conditions
bool execute = false;
bool anyConditions = false;
for (ClEvent::cond_t *condIter = (*iter).m_Conditions; condIter; condIter = condIter->next)
for (auto condIter = event->m_Conditions; condIter; condIter = condIter->next)
{
if (condIter->paramId == m_ParsePos)
{
anyConditions = true;
switch(condIter->type)
switch (condIter->type)
{
case '=': if (!strcmp(sz, condIter->sValue.c_str())) execute=true; break;
case '!': if (strcmp(sz, condIter->sValue.c_str())) execute=true; break;
case '&': if (strstr(sz, condIter->sValue.c_str())) execute=true; break;
case '=': if (!strcmp(sz, condIter->sValue.chars())) execute = true; break;
case '!': if (strcmp(sz, condIter->sValue.chars())) execute = true; break;
case '&': if (strstr(sz, condIter->sValue.chars())) execute = true; break;
}
if (execute)
break;
}
}
if (anyConditions && !execute)
(*iter).m_Done = true; // don't execute
event->m_Done = true; // don't execute
}
}
void EventsMngr::executeEvents()
{
int err;
static unsigned int reentrant = 0;
if (!m_ParseFun)
{
return;
}
#ifdef ENABLEEXEPTIONS
try
// Store old read data, which are either default values or previous event data
int oldMsgType = m_ReadMsgType, oldReadPos = m_ReadPos;
MsgDataEntry *oldReadVault = m_ReadVault, *readVault = NULL;
// We have a re-entrant call
if (reentrant++)
{
#endif // #ifdef ENABLEEXEPTIONS
for (ClEventVecIter iter = m_ParseFun->begin(); iter; ++iter)
// Create temporary read vault
readVault = new MsgDataEntry[m_ParsePos + 1];
m_ReadVault = readVault;
} else if (m_ReadVaultSize != m_ParseVaultSize) {
// Extend read vault size if necessary
delete [] m_ReadVault;
m_ReadVault = new MsgDataEntry[m_ParseVaultSize];
m_ReadVaultSize = m_ParseVaultSize;
// Update old read vault so we don't restore to a wrong pointer
oldReadVault = m_ReadVault;
}
// Copy data over to readvault
m_ReadPos = m_ParsePos;
m_ReadMsgType = m_ParseMsgType;
if (m_ParseVault)
{
memcpy(m_ReadVault, m_ParseVault, (m_ParsePos + 1) * sizeof(MsgDataEntry));
}
// Reset this here so we don't trigger re-entrancy for unregistered messages
auto parseFun = m_ParseFun;
m_ParseFun = nullptr;
auto lastSize = parseFun->length();
for(auto i = 0u; i < lastSize; i++)
{
auto &event = parseFun->at(i);
if (event->m_Done)
{
if ( (*iter).m_Done )
{
(*iter).m_Done = false;
continue;
}
(*iter).m_Stamp = (float)*m_Timer;
if ((err = amx_Exec((*iter).m_Plugin->getAMX(), NULL, (*iter).m_Func, 1, m_ParseVault ? m_ParseVault[0].iValue : 0)) != AMX_ERR_NONE)
{
LogError((*iter).m_Plugin->getAMX(), err, "");
}
event->m_Done = false;
continue;
}
event->m_Stamp = *m_Timer;
#ifdef ENABLEEXEPTIONS
if (event->m_State == FSTATE_ACTIVE)
{
executeForwards(event->m_Func, static_cast<cell>(m_ReadVault ? m_ReadVault[0].iValue : 0));
}
}
catch( ... )
{
AMXXLOG_Log( "[AMXX] fatal error at event execution");
}
#endif // #ifdef ENABLEEXEPTIONS
// Restore old read data, either resetting to default or to previous event data
m_ReadMsgType = oldMsgType;
m_ReadPos = oldReadPos;
m_ReadVault = oldReadVault;
delete [] readVault;
m_CurrentMsgType = -1;
m_ParseFun = NULL;
--reentrant;
}
int EventsMngr::getArgNum() const
{
return m_ParsePos + 1;
return m_ReadPos + 1;
}
const char* EventsMngr::getArgString(int a) const
{
if ( a < 0 || a > m_ParsePos )
if (a < 0 || a > m_ReadPos)
return "";
static char var[32];
switch(m_ParseVault[a].type)
switch (m_ReadVault[a].type)
{
case MSG_INTEGER:
sprintf( var, "%d", m_ParseVault[a].iValue );
return var;
case MSG_STRING:
return m_ParseVault[a].sValue;
default:
sprintf( var, "%g", m_ParseVault[a].fValue );
return var;
case MSG_INTEGER:
sprintf(var, "%d", m_ReadVault[a].iValue);
return var;
case MSG_STRING:
return m_ReadVault[a].sValue;
default:
sprintf(var, "%g", m_ReadVault[a].fValue);
return var;
}
}
int EventsMngr::getArgInteger(int a) const
{
if ( a < 0 || a > m_ParsePos )
if (a < 0 || a > m_ReadPos)
return 0;
switch(m_ParseVault[a].type)
switch (m_ReadVault[a].type)
{
case MSG_INTEGER:
return m_ParseVault[a].iValue;
case MSG_STRING:
return atoi(m_ParseVault[a].sValue);
default:
return (int)m_ParseVault[a].fValue;
case MSG_INTEGER:
return m_ReadVault[a].iValue;
case MSG_STRING:
return atoi(m_ReadVault[a].sValue);
default:
return (int)m_ReadVault[a].fValue;
}
}
float EventsMngr::getArgFloat(int a) const
{
if ( a < 0 || a > m_ParsePos )
if (a < 0 || a > m_ReadPos)
return 0.0f;
switch(m_ParseVault[a].type)
switch (m_ReadVault[a].type)
{
case MSG_INTEGER:
return m_ParseVault[a].iValue;
case MSG_STRING:
return atof(m_ParseVault[a].sValue);
default:
return m_ParseVault[a].fValue;
case MSG_INTEGER:
return static_cast<float>(m_ReadVault[a].iValue);
case MSG_STRING:
return static_cast<float>(atof(m_ReadVault[a].sValue));
default:
return m_ReadVault[a].fValue;
}
}
@ -498,6 +550,9 @@ void EventsMngr::clearEvents(void)
{
m_Events[i].clear();
}
EventHandles.clear();
// delete parsevault
if (m_ParseVault)
{
@ -505,6 +560,14 @@ void EventsMngr::clearEvents(void)
m_ParseVault = NULL;
m_ParseVaultSize = 0;
}
if (m_ReadVault)
{
delete [] m_ReadVault;
m_ReadVault = NULL;
m_ReadVaultSize = 0;
m_ReadPos = -1;
}
}
int EventsMngr::getEventId(const char* msg)
@ -516,28 +579,29 @@ int EventsMngr::getEventId(const char* msg)
CS_EventsIds id;
} table[] =
{
{ "CS_DeathMsg" , CS_DeathMsg },
// { "CS_RoundEnd" , CS_RoundEnd },
// { "CS_RoundStart" , CS_RoundStart },
// { "CS_Restart" , CS_Restart },
{ "" , CS_Null }
{"CS_DeathMsg", CS_DeathMsg},
// {"CS_RoundEnd", CS_RoundEnd},
// {"CS_RoundStart", CS_RoundStart},
// {"CS_Restart", CS_Restart},
{"", CS_Null}
};
// if msg is a number, return it
int pos = atoi(msg);
if (pos != 0)
return pos;
// try to find in table first
for (pos = 0; table[ pos ].id != CS_Null; ++pos )
if ( !strcmp( table[ pos ].name , msg ) )
return table[ pos ].id;
for (pos = 0; table[pos].id != CS_Null; ++pos)
if (!strcmp(table[pos].name, msg))
return table[pos].id;
// find the id of the message
return pos = GET_USER_MSG_ID(PLID, msg , 0 );
return pos = GET_USER_MSG_ID(PLID, msg, 0);
}
int EventsMngr::getCurrentMsgType()
{
return m_CurrentMsgType;
return m_ReadMsgType;
}

View File

@ -1,40 +1,21 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef __CEVENTS_H__
#define __CEVENTS_H__
#define MAX_AMX_REG_MSG MAX_REG_MSGS+16
#include "natives_handles.h"
#define MAX_AMX_REG_MSG MAX_REG_MSGS + 16
enum {
enum
{
CS_DEATHMSG = MAX_REG_MSGS,
// CS_ROUNDEND,
// CS_ROUNDSTART,
@ -67,28 +48,31 @@ public:
class ClEvent
{
friend class EventsMngr; // events manager may access our private members
friend class EventsMngr; // events manager may access our private members
int m_Func; // function to be executed
CPluginMngr::CPlugin *m_Plugin; // the plugin this ClEvent class is assigned to
// flags
bool m_FlagPlayer;
bool m_FlagClient;
bool m_FlagWorld;
bool m_FlagOnce;
bool m_FlagDead;
bool m_FlagAlive;
bool m_FlagPlayer;
bool m_FlagBot;
float m_Stamp; // for 'once' flag
bool m_Done;
ForwardState m_State;
// conditions
struct cond_t
{
int paramId; // the message parameter id
String sValue; // value (string)
ke::AString sValue; // value (string)
float fValue; // value (float)
int iValue; // value (int)
int type; // type (can be int, float, string)
@ -100,12 +84,13 @@ public:
public:
// constructors & destructors
ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags);
ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags);
~ClEvent();
inline CPluginMngr::CPlugin* getPlugin();
inline int getFunction();
void registerFilter(char* filter); // add a condition
void setForwardState(ForwardState value);
};
private:
@ -116,44 +101,54 @@ private:
const char* sValue;
MsgParamType type;
};
MsgDataEntry *m_ParseVault;
MsgDataEntry *m_ReadVault;
int m_ParseVaultSize;
void NextParam(); // make sure a new parameter can be added
int m_ReadVaultSize;
void NextParam(); // make sure a new parameter can be added
typedef CList<ClEvent> ClEventVec;
typedef ClEventVec::iterator ClEventVecIter;
ClEventVec m_Events[MAX_AMX_REG_MSG];
ClEventVec *m_ParseFun; // current Event vector
ke::Vector<ke::AutoPtr<ClEvent>> m_Events[MAX_AMX_REG_MSG];
ke::Vector<ke::AutoPtr<ClEvent>> *m_ParseFun; // current Event vector
bool m_ParseNotDone;
int m_ParsePos; // is args. num. - 1
int m_ReadPos;
float* m_Timer;
ClEvent* getValidEvent(ClEvent* a );
ClEvent* getValidEvent(ClEvent* a);
int m_CurrentMsgType;
int m_ParseMsgType;
int m_ReadMsgType;
public:
EventsMngr();
~EventsMngr();
// Interface
ClEvent* registerEvent(CPluginMngr::CPlugin* plugin, int func, int flags, int msgid);
int registerEvent(CPluginMngr::CPlugin* plugin, int func, int flags, int msgid);
void parserInit(int msg_type, float* timer, CPlayer* pPlayer, int index);
void parseValue(int iValue);
void parseValue(float fValue);
void parseValue(const char *sz);
void executeEvents();
int getArgNum() const; //{ return (parsePos+1); }
int getArgNum() const; //{ return (parsePos + 1); }
const char* getArgString(int a) const;
int getArgInteger(int a) const;
float getArgFloat(int a) const;
void clearEvents(void);
static int getEventId( const char* msg );
static int getEventId(const char* msg);
int getCurrentMsgType();
};
#endif // #ifdef __CEVENTS_H__
struct EventHook
{
explicit EventHook(EventsMngr::ClEvent *event) : m_event(event) {}
EventsMngr::ClEvent *m_event;
};
extern NativeHandle<EventHook> EventHandles;
#endif //__CEVENTS_H__

View File

@ -1,126 +0,0 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
#include <ctype.h>
#include "amxmodx.h"
#include "CFile.h"
// *****************************************************
// class File
// *****************************************************
File::File( const char* n, const char* m )
{
fp = fopen( n , m );
}
File::~File( )
{
if ( fp )
fclose( fp );
}
File::operator bool ( ) const
{
return fp && !feof(fp);
}
File& operator<<( File& f, const String& n )
{
if ( f ) fputs( n.c_str() , f.fp ) ;
return f;
}
File& operator<<( File& f, const char* n )
{
if ( f ) fputs( n , f.fp ) ;
return f;
}
File& operator<<( File& f, int n )
{
if ( f ) fprintf( f.fp , "%d" , n ) ;
return f;
}
File& operator<<( File& f, const char& c )
{
if ( f ) fputc( c , f.fp ) ;
return f;
}
File& operator>>( File& f, String& n )
{
if ( !f ) return f;
char temp[1024];
fscanf( f.fp , "%s", temp );
n.assign(temp);
return f;
}
File& operator>>( File& f, char* n )
{
if ( f ) fscanf( f.fp , "%s", n );
return f;
}
int File::getline( char* buf, int sz )
{
int a = sz;
char *origBuf = buf;
if ( *this )
{
int c;
while ( sz-- && (c = getc( (*this).fp)) && c != EOF && c != '\n' )
*buf++ = c;
*buf = 0;
}
// trim 0x0a and 0x0d characters at the end
while (buf != origBuf)
{
if (*buf == 0x0a || *buf == 0x0d)
*buf = 0;
--buf;
}
return a - sz;
}
File& File::skipWs( )
{
if ( !*this ) return *this;
int c;
while( isspace( c = getc( fp ) ) ){};
ungetc( c , fp );
return *this;
}

View File

@ -1,58 +0,0 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
#include <stdio.h>
#include "CString.h"
// *****************************************************
// class File
// *****************************************************
class File
{
FILE* fp;
public:
File( const char* n, const char* m );
~File( );
operator bool ( ) const;
friend File& operator<<( File& f, const String& n );
friend File& operator<<( File& f, const char* n );
friend File& operator<<( File& f, const char& c );
friend File& operator<<( File& f, int n );
friend File& operator>>( File& f, String& n );
friend File& operator>>( File& f, char* n );
int getline( char* buf, int sz );
File& skipWs( );
};

255
amxmodx/CFileSystem.h Normal file
View File

@ -0,0 +1,255 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef _INCLUDE_CFILESYSTEM_H_
#define _INCLUDE_CFILESYSTEM_H_
#include <FileSystem.h> // IFileSystem, FileSystemSeek_t, FileHandle_t (HLSDK)
#include <stdio.h> // FILE*
extern IFileSystem* g_FileSystem;
class ValveFile;
class SystemFile;
class FileObject
{
public:
virtual ~FileObject() {};
virtual size_t Read(void* pOut, size_t size) = 0;
virtual char* ReadLine(char* pOut, size_t size) = 0;
virtual size_t Write(const void* pData, size_t size) = 0;
virtual bool Seek(int pos, int seek_type) = 0;
virtual int Tell() = 0;
virtual int Flush() = 0;
virtual bool HasError() = 0;
virtual bool EndOfFile() = 0;
virtual void Close() = 0;
virtual ValveFile *AsValveFile()
{
return nullptr;
}
virtual SystemFile *AsSystemFile()
{
return nullptr;
}
};
class ValveFile : public FileObject
{
public:
ValveFile(FileHandle_t handle) : handle_(handle) {}
~ValveFile()
{
Close();
}
static bool Exists(const char* file)
{
return g_FileSystem->FileExists(file);
}
static ValveFile* Open(const char* filename, const char* mode, const char* pathID)
{
FileHandle_t handle = g_FileSystem->OpenFromCacheForRead(filename, mode, pathID);
if (!handle)
{
return nullptr;
}
return new ValveFile(handle);
}
static bool Delete(const char* filename, const char* pathID)
{
if (!Exists(filename))
{
return false;
}
g_FileSystem->RemoveFile(filename, pathID);
if (Exists(filename))
{
return false;
}
return true;
}
size_t Read(void* pOut, size_t size) override
{
return static_cast<size_t>(g_FileSystem->Read(pOut, size, handle_));
}
char* ReadLine(char* pOut, size_t size) override
{
return g_FileSystem->ReadLine(pOut, size, handle_);
}
size_t Write(const void* pData, size_t size) override
{
return static_cast<size_t>(g_FileSystem->Write(pData, size, handle_));
}
bool Seek(int pos, int seek_type) override
{
g_FileSystem->Seek(handle_, pos, static_cast<FileSystemSeek_t>(seek_type));
return !HasError();
}
int Tell() override
{
return g_FileSystem->Tell(handle_);
}
bool HasError() override
{
return !handle_ || !g_FileSystem->IsOk(handle_);
}
int Flush() override
{
g_FileSystem->Flush(handle_);
return 0;
}
bool EndOfFile() override
{
return g_FileSystem->EndOfFile(handle_);
}
void Close() override
{
if (handle_)
{
g_FileSystem->Close(handle_);
handle_ = nullptr;;
}
}
virtual ValveFile* AsValveFile()
{
return this;
}
FileHandle_t handle() const
{
return handle_;
}
private:
FileHandle_t handle_;
};
class SystemFile : public FileObject
{
public:
SystemFile(FILE* fp) : fp_(fp) {}
~SystemFile()
{
Close();
}
static SystemFile* Open(const char* path, const char* mode)
{
FILE* fp = fopen(path, mode);
if (!fp)
{
return nullptr;
}
return new SystemFile(fp);
}
static bool Delete(const char* path)
{
return unlink(path) == 0;
}
size_t Read(void* pOut, size_t size) override
{
return fread(pOut, 1, size, fp_);
}
char* ReadLine(char* pOut, size_t size) override
{
return fgets(pOut, size, fp_);
}
size_t Write(const void* pData, size_t size) override
{
return fwrite(pData, 1, size, fp_);
}
bool Seek(int pos, int seek_type) override
{
return fseek(fp_, pos, seek_type) == 0;
}
int Tell() override
{
return ftell(fp_);
}
bool HasError() override
{
return ferror(fp_) != 0;
}
int Flush() override
{
return fflush(fp_);
}
bool EndOfFile() override
{
return feof(fp_) != 0;
}
void Close() override
{
if (fp_)
{
fclose(fp_);
fp_ = nullptr;
}
}
virtual SystemFile* AsSystemFile()
{
return this;
}
FILE* handle() const
{
return fp_;
}
private:
FILE* fp_;
};
#endif // _INCLUDE_CFILESYSTEM_H_

410
amxmodx/CFlagManager.cpp Normal file
View File

@ -0,0 +1,410 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "sh_list.h"
#include "amxmodx.h"
#include "CFlagManager.h"
void CFlagManager::SetFile(const char *Filename)
{
m_strConfigFile = build_pathname("%s/%s", get_localinfo("amxx_configsdir", "addons/amxmodx/configs"), Filename);
CreateIfNotExist();
}
const int CFlagManager::LoadFile(const int force)
{
CheckIfDisabled();
// If we're disabled get the hell out. now.
if (m_iDisabled)
{
return 0;
}
// if we're not forcing this, and NeedToLoad says we dont have to
// then just stop
if (!force && !NeedToLoad())
{
return 0;
}
this->Clear();
// We need to load the file
FILE *File;
File=fopen(GetFile(),"r");
if (!File)
{
AMXXLOG_Log("[AMXX] FlagManager: Cannot open file \"%s\" (FILE pointer null!)", GetFile());
return -1;
}
// Trying to copy this almost exactly as other configs are read...
char Line[512];
char TempLine[512];
char Command[256];
char Flags[256];
while (!feof(File) && fgets(Line, sizeof(Line), File))
{
char *nonconst= Line;
// Strip out comments
while (*nonconst)
{
if (*nonconst==';') // End the line at comments
{
*nonconst='\0';
}
else
{
nonconst++;
}
}
Command[0]='\0';
Flags[0]='\0';
// Extract the command
strncopy(TempLine, Line, sizeof(TempLine));
nonconst = TempLine;
char *start=NULL;
char *end=NULL;
// move up line until the first ", mark this down as the start
// then find the second " and mark it down as the end
while (*nonconst!='\0')
{
if (*nonconst=='"')
{
if (start==NULL)
{
start=nonconst+1;
}
else
{
end=nonconst;
goto done_with_command;
}
}
nonconst++;
}
done_with_command:
// invalid line?
if (start==NULL || end==NULL)
{
// TODO: maybe warn for an invalid non-commented line?
continue;
}
*end='\0';
strncpy(Command,start,sizeof(Command)-1);
// Now do the same thing for the flags
nonconst=++end;
start=NULL;
end=NULL;
// move up line until the first ", mark this down as the start
// then find the second " and mark it down as the end
while (*nonconst!='\0')
{
if (*nonconst=='"')
{
if (start==NULL)
{
start=nonconst+1;
}
else
{
end=nonconst;
goto done_with_flags;
}
}
nonconst++;
}
done_with_flags:
// invalid line?
if (start==NULL || end==NULL)
{
// TODO: maybe warn for an invalid non-commented line?
continue;
}
*end='\0';
strncpy(Flags,start,sizeof(Flags)-1);
//if (!isalnum(*Command))
if (*Command == '"' || *Command == '\0')
{
continue;
}
// Done sucking the command and flags out of the line
// now insert this command into the linked list
AddFromFile(const_cast<const char*>(&Command[0]),&Flags[0]);
nonconst = Line;
*nonconst = '\0';
}
fclose(File);
return 1;
}
/**
* This gets called from LoadFile
* Do NOT flag the entries as NeedToWrite
* No comment is passed from the file because
* this should never get written
*/
void CFlagManager::AddFromFile(const char *Command, const char *Flags)
{
CFlagEntry *Entry=new CFlagEntry;
Entry->SetName(Command);
Entry->SetFlags(Flags);
// Link it
m_FlagList.push_back(Entry);
}
void CFlagManager::LookupOrAdd(const char *Command, int &Flags, AMX *Plugin)
{
if (m_iDisabled) // if disabled in core.ini stop
{
return;
}
int TempFlags=Flags;
if (TempFlags==-1)
{
TempFlags=0;
}
List<CFlagEntry *>::iterator iter;
List<CFlagEntry *>::iterator end;
iter=m_FlagList.begin();
end=m_FlagList.end();
while (iter!=end)
{
if (strcmp((*iter)->GetName()->chars(),Command)==0)
{
CFlagEntry *Entry=(*iter);
if (Entry->IsHidden()) // "!" flag, exclude this function
{
return;
}
// Found, byref the new flags
Flags=Entry->Flags();
// Move it to the back of the list for faster lookup for the rest
m_FlagList.erase(iter);
m_FlagList.push_back(Entry);
return;
}
iter++;
}
// was not found, add it
CFlagEntry *Entry=new CFlagEntry;
Entry->SetName(Command);
Entry->SetFlags(TempFlags);
if (Plugin)
{
CPluginMngr::CPlugin* a = g_plugins.findPluginFast(Plugin);
if (a)
{
Entry->SetComment(a->getName());
}
}
// This entry was added from a register_* native
// it needs to be written during map change
Entry->SetNeedWritten(1);
// Link it
m_FlagList.push_back(Entry);
}
void CFlagManager::WriteCommands(void)
{
if (m_iDisabled)
{
return;
}
List<CFlagEntry *>::iterator iter;
List<CFlagEntry *>::iterator end;
FILE *File;
int NeedToRead=0;
// First off check the modified time of this file
// if it matches the stored modified time, then update
// after we write so we do not re-read next map
struct stat TempStat;
stat(GetFile(), &TempStat);
if (TempStat.st_mtime != m_Stat.st_mtime)
{
NeedToRead=1;
};
File = fopen(GetFile(), "a");
if (!File)
{
return;
}
iter=m_FlagList.begin();
end=m_FlagList.end();
while (iter!=end)
{
if ((*iter)->NeedWritten())
{
if ((*iter)->GetComment()->length())
{
fprintf(File,"\"%s\" \t\"%s\" ; %s\n",(*iter)->GetName()->chars(),(*iter)->GetFlags()->chars(),(*iter)->GetComment()->chars());
}
else
{
fprintf(File,"\"%s\" \t\"%s\"\n",(*iter)->GetName()->chars(),(*iter)->GetFlags()->chars());
}
(*iter)->SetNeedWritten(0);
}
++iter;
}
fclose(File);
// If NeedToRead was 0, then update the timestamp
// that was saved so we do not re-read this file
// next map
if (!NeedToRead)
{
stat(GetFile(), &TempStat);
m_Stat.st_mtime=TempStat.st_mtime;
}
}
int CFlagManager::ShouldIAddThisCommand(const AMX *amx, const cell *params, const char *cmdname) const
{
// If flagmanager is disabled then ignore this
if (m_iDisabled)
{
return 0;
}
// If 5th param exists it was compiled after this change was made
// if it does not exist, try our logic at the end of this function
// 5th param being > 0 means explicit yes
// < 0 means auto detect (default is -1), treat it like there was no 5th param
// 0 means explicit no
if ((params[0] / sizeof(cell)) >= 5)
{
if (params[5]>0) // This command was explicitly told to be included
{
return 1;
}
else if (params[5]==0) // this command was explicitly told to NOT be used
{
return 0;
}
}
// auto detect if we should use this command
// if command access is -1 (default, not set to ADMIN_ALL or any other access), then no
if (params[3]==-1)
{
return 0;
}
// if command is (or starts with) "say", then no
if (strncmp(cmdname,"say",3)==0)
{
return 0;
}
// else use it
return 1;
}
void CFlagManager::Clear(void)
{
List<CFlagEntry *>::iterator iter;
List<CFlagEntry *>::iterator end;
iter=m_FlagList.begin();
end=m_FlagList.end();
while (iter!=end)
{
delete (*iter);
++iter;
}
m_FlagList.clear();
}
void CFlagManager::CheckIfDisabled(void)
{
if (atoi(get_localinfo("disableflagman","0"))==0)
{
m_iDisabled=0;
}
else
{
m_iDisabled=1;
}
}

231
amxmodx/CFlagManager.h Normal file
View File

@ -0,0 +1,231 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef CFLAGMANAGER_H
#define CFLAGMANAGER_H
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "sh_list.h"
#include "amxmodx.h"
#include "CLibrarySys.h"
class CFlagEntry
{
private:
ke::AString m_strName; // command name ("amx_slap")
ke::AString m_strFlags; // string flags ("a","b")
ke::AString m_strComment; // comment to write ("; admincmd.amxx")
int m_iFlags; // bitmask flags
int m_iNeedWritten; // write this command on map change?
int m_iHidden; // set to 1 when the command is set to "!" access in
// the .ini file: this means do not process this command
public:
CFlagEntry()
{
m_iNeedWritten=0;
m_iFlags=0;
m_iHidden=0;
};
const int NeedWritten(void) const
{
return m_iNeedWritten;
};
void SetNeedWritten(const int i=1)
{
m_iNeedWritten=i;
};
const ke::AString *GetName(void) const
{
return &m_strName;
};
const ke::AString *GetFlags(void) const
{
return &m_strFlags;
};
const ke::AString *GetComment(void) const
{
return &m_strComment;
};
const int Flags(void) const
{
return m_iFlags;
};
void SetName(const char *data)
{
m_strName = data;
};
void SetFlags(const char *flags)
{
// If this is a "!" entry then stop
if (flags && flags[0]=='!')
{
SetHidden(1);
return;
}
m_strFlags = flags;
m_iFlags=UTIL_ReadFlags(flags);
};
void SetFlags(const int flags)
{
m_iFlags=flags;
char FlagsString[32];
UTIL_GetFlags(FlagsString, flags);
m_strFlags = FlagsString;
};
void SetComment(const char *comment)
{
m_strComment = comment;
};
void SetHidden(int i=1)
{
m_iHidden=i;
};
int IsHidden(void) const
{
return m_iHidden;
};
};
class CFlagManager
{
private:
List<CFlagEntry *> m_FlagList;
ke::AString m_strConfigFile;
struct stat m_Stat;
int m_iForceRead;
int m_iDisabled;
void CreateIfNotExist(void) const
{
FILE *fp;
fp = fopen(GetFile(), "r");
if (!fp)
{
// File does not exist, create the header
fp = fopen(GetFile(), "a");
if (fp)
{
fprintf(fp,"; This file will store the commands used by plugins, and their access level\n");
fprintf(fp,"; To change the access of a command, edit the flags beside it and then\n");
fprintf(fp,"; change the server's map.\n;\n");
fprintf(fp,"; Example: If I wanted to change the amx_slap access to require\n");
fprintf(fp,"; RCON access (flag \"l\") I would change this:\n");
fprintf(fp,"; \"amx_slap\" \"e\" ; admincmd.amxx\n");
fprintf(fp,"; To this:\n");
fprintf(fp,"; \"amx_slap\" \"l\" ; admincmd.amxx\n;\n");
fprintf(fp,"; To disable a specific command from being used with the command manager\n");
fprintf(fp,"; and to only use the plugin-specified access set the flag to \"!\"\n;\n");
fprintf(fp,"; NOTE: The plugin name at the end is just for reference to what plugin\n");
fprintf(fp,"; uses what commands. It is ignored.\n\n");
fclose(fp);
};
}
else
{
fclose(fp);
}
};
/**
* Returns 1 if the timestamp for the file is different than the one we have loaded
* 0 otherwise
*/
inline int NeedToLoad(void)
{
struct stat TempStat;
stat(GetFile(), &TempStat);
// If the modified timestamp does not match the stored
// timestamp than we need to re-read this file.
// Otherwise, ignore the file.
if (TempStat.st_mtime != m_Stat.st_mtime)
{
// Save down the modified timestamp
m_Stat.st_mtime=TempStat.st_mtime;
return 1;
};
return 0;
};
public:
CFlagManager()
{
memset(&m_Stat,0x0,sizeof(struct stat));
m_iDisabled=0;
m_iForceRead=0;
};
~CFlagManager()
{
};
/**
* Sets the filename in relation to amxmodx/configs
*/
void SetFile(const char *Filename="cmdaccess.ini");
const char *GetFile(void) const { return m_strConfigFile.chars(); };
/**
* Parse the file, and load all entries
* Returns 1 on success, 0 on refusal (no need to), and -1 on error
*/
const int LoadFile(const int force=0);
/**
* Checks if the command exists in the list
* If it does, it byrefs the flags for it
* If it does not, it adds it to the list
* These are added from register_*cmd calls
*/
void LookupOrAdd(const char *Command, int &Flags, AMX *Plugin);
/**
* Write the commands back to the file
*/
void WriteCommands(void);
/**
* Add this straight from the cmdaccess.ini file
*/
void AddFromFile(const char *Command, const char *Flags);
/**
* Checks if this command should be added to flagman or not
* This is only checked when adding commands from the register_* natives
* If an admin manually adds a command to cmdaccess.ini it will be used
* regardless of whatever this function would say should be done with it
*/
int ShouldIAddThisCommand(const AMX *amx, const cell *params, const char *cmdname) const;
void Clear(void);
void CheckIfDisabled(void);
};
#endif // CFLAGMANAGER_H

View File

@ -1,46 +1,28 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "debugger.h"
#include "binlog.h"
CForward::CForward(const char *name, ForwardExecType et, int numParams, const ForwardParam *paramTypes)
{
m_FuncName = name;
m_ExecType = et;
m_NumParams = numParams;
memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam));
// find funcs
int func;
AMXForward *tmp = NULL;
m_Funcs.clear();
for (CPluginMngr::iterator iter = g_plugins.begin(); iter; ++iter)
{
if ((*iter).isValid() && amx_FindPublic((*iter).getAMX(), name, &func) == AMX_ERR_NONE)
@ -48,9 +30,11 @@ CForward::CForward(const char *name, ForwardExecType et, int numParams, const Fo
AMXForward tmp;
tmp.pPlugin = &(*iter);
tmp.func = func;
m_Funcs.push_back(tmp);
m_Funcs.append(tmp);
}
}
m_Name = name;
}
cell CForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
@ -62,42 +46,63 @@ cell CForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
cell globRetVal = 0;
unsigned int id = 0;
AMXForwardList::iterator iter;
for (iter = m_Funcs.begin(); iter != m_Funcs.end(); iter++)
for (size_t i = 0; i < m_Funcs.length(); ++i)
{
auto iter = &m_Funcs[i];
if (iter->pPlugin->isExecutable(iter->func))
{
// handle strings & arrays
// Get debug info
AMX *amx = iter->pPlugin->getAMX();
Debugger *pDebugger = (Debugger *)amx->userdata[UD_DEBUGGER];
if (pDebugger)
pDebugger->BeginExec();
// handle strings & arrays & values by reference
int i;
for (i = 0; i < m_NumParams; ++i)
{
if (m_ParamTypes[i] == FP_STRING || m_ParamTypes[i] == FP_STRINGEX)
{
const char *str = reinterpret_cast<const char*>(params[i]);
cell *tmp;
amx_Allot(iter->pPlugin->getAMX(),
(m_ParamTypes[i] == FP_STRING) ? strlen(reinterpret_cast<const char*>(params[i]))+1 : STRINGEX_MAXLENGTH,
&realParams[i], &tmp);
amx_SetString(tmp, (const char *)(params[i]), 0, 0);
if (!str)
str = "";
amx_Allot(amx, (m_ParamTypes[i] == FP_STRING) ? strlen(str) + 1 : STRINGEX_MAXLENGTH, &realParams[i], &tmp);
amx_SetStringOld(tmp, str, 0, 0);
physAddrs[i] = tmp;
}
else if (m_ParamTypes[i] == FP_ARRAY)
{
cell *tmp;
amx_Allot(iter->pPlugin->getAMX(), preparedArrays[params[i]].size,
&realParams[i], &tmp);
amx_Allot(amx, preparedArrays[params[i]].size, &realParams[i], &tmp);
physAddrs[i] = tmp;
if (preparedArrays[params[i]].type == Type_Cell)
{
memcpy(tmp, preparedArrays[params[i]].ptr, preparedArrays[params[i]].size * sizeof(cell));
} else {
char *data = (char*)preparedArrays[params[i]].ptr;
for (unsigned int j = 0; j < preparedArrays[params[i]].size; ++j)
*tmp++ = (static_cast<cell>(*data++)) & 0xFF;
}
}
else if (m_ParamTypes[i] == FP_CELL_BYREF || m_ParamTypes[i] == FP_FLOAT_BYREF)
{
cell *tmp;
amx_Allot(amx, 1, &realParams[i], &tmp);
physAddrs[i] = tmp;
if (m_ParamTypes[i] == FP_CELL_BYREF)
{
memcpy(tmp, reinterpret_cast<cell *>(params[i]), sizeof(cell));
}
else
{
char *data = (char*)preparedArrays[params[i]].ptr;
for (unsigned int j = 0; j < preparedArrays[params[i]].size; ++j)
*tmp++ = (static_cast<cell>(*data++)) & 0xFF;
memcpy(tmp, reinterpret_cast<REAL *>(params[i]), sizeof(REAL));
}
}
else
@ -105,25 +110,52 @@ cell CForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
realParams[i] = params[i];
}
}
//Push the parameters in reverse order. Weird, unfriendly part of Small 3.0!
for (i = m_NumParams-1; i >= 0; i--)
{
amx_Push(amx, realParams[i]);
}
// exec
cell retVal;
int err = amx_Execv(iter->pPlugin->getAMX(), &retVal, iter->func, m_NumParams, realParams);
cell retVal = 0;
#if defined BINLOG_ENABLED
g_BinLog.WriteOp(BinLog_CallPubFunc, iter->pPlugin->getId(), iter->func);
#endif
int err = amx_ExecPerf(amx, &retVal, iter->func);
// log runtime error, if any
if (err != AMX_ERR_NONE)
LogError(iter->pPlugin->getAMX(), err, "");
{
//Did something else set an error?
if (pDebugger && pDebugger->ErrorExists())
{
//we don't care, something else logged the error.
}
else if (err != -1)
{
//nothing logged the error so spit it out anyway
LogError(amx, err, NULL);
}
}
amx->error = AMX_ERR_NONE;
if (pDebugger)
pDebugger->EndExec();
// cleanup strings & arrays
// cleanup strings & arrays & values by reference
for (i = 0; i < m_NumParams; ++i)
{
if (m_ParamTypes[i] == FP_STRING)
{
amx_Release(iter->pPlugin->getAMX(), realParams[i]);
amx_Release(amx, realParams[i]);
}
else if (m_ParamTypes[i] == FP_STRINGEX)
{
// copy back
amx_GetString(reinterpret_cast<char*>(params[i]), physAddrs[i], 0);
amx_Release(iter->pPlugin->getAMX(), realParams[i]);
amx_GetStringOld(reinterpret_cast<char*>(params[i]), physAddrs[i], 0);
amx_Release(amx, realParams[i]);
}
else if (m_ParamTypes[i] == FP_ARRAY)
{
@ -134,50 +166,70 @@ cell CForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
if (preparedArrays[params[i]].type == Type_Cell)
{
memcpy(preparedArrays[params[i]].ptr, tmp, preparedArrays[params[i]].size * sizeof(cell));
}
else
{
} else {
char *data = (char*)preparedArrays[params[i]].ptr;
for (unsigned int j = 0; j < preparedArrays[params[i]].size; ++j)
*data++ = static_cast<char>(*tmp++ & 0xFF);
}
}
amx_Release(iter->pPlugin->getAMX(), realParams[i]);
amx_Release(amx, realParams[i]);
}
else if (m_ParamTypes[i] == FP_CELL_BYREF || m_ParamTypes[i] == FP_FLOAT_BYREF)
{
//copy back
cell *tmp = physAddrs[i];
if (m_ParamTypes[i] == FP_CELL_BYREF)
{
memcpy(reinterpret_cast<cell *>(params[i]), tmp, sizeof(cell));
}
else
{
memcpy(reinterpret_cast<REAL *>(params[i]), tmp, sizeof(REAL));
}
amx_Release(amx, realParams[i]);
}
}
// decide what to do (based on exectype and retval)
switch (m_ExecType)
{
case ET_IGNORE:
break;
case ET_STOP:
if (retVal > 0)
return retVal;
case ET_STOP2:
if (retVal == 1)
return 1;
else if (retVal > globRetVal)
globRetVal = retVal;
break;
case ET_CONTINUE:
if (retVal > globRetVal)
globRetVal = retVal;
break;
case ET_IGNORE:
break;
case ET_STOP:
if (retVal > 0)
return retVal;
case ET_STOP2:
if (retVal == 1)
return 1;
else if (retVal > globRetVal)
globRetVal = retVal;
break;
case ET_CONTINUE:
if (retVal > globRetVal)
globRetVal = retVal;
break;
}
}
}
return globRetVal;
}
void CSPForward::Set(int func, AMX *amx, int numParams, const ForwardParam *paramTypes)
{
char name[sNAMEMAX];
m_Func = func;
m_Amx = amx;
m_NumParams = numParams;
memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam));
m_HasFunc = true;
isFree = false;
name[0] = '\0';
amx_GetPublic(amx, func, name);
m_Name = name;
m_ToDelete = false;
m_InExec = false;
}
void CSPForward::Set(const char *funcName, AMX *amx, int numParams, const ForwardParam *paramTypes)
@ -187,6 +239,9 @@ void CSPForward::Set(const char *funcName, AMX *amx, int numParams, const Forwar
memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam));
m_HasFunc = (amx_FindPublic(amx, funcName, &m_Func) == AMX_ERR_NONE);
isFree = false;
m_Name = funcName;
m_ToDelete = false;
m_InExec = false;
}
cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
@ -199,41 +254,63 @@ cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
cell realParams[FORWARD_MAX_PARAMS];
cell *physAddrs[FORWARD_MAX_PARAMS];
if (!m_HasFunc)
if (!m_HasFunc || m_ToDelete)
return 0;
CPluginMngr::CPlugin *pPlugin = g_plugins.findPluginFast(m_Amx);
if (!pPlugin->isExecutable(m_Func))
return 0;
// handle strings & arrays
m_InExec = true;
Debugger *pDebugger = (Debugger *)m_Amx->userdata[UD_DEBUGGER];
if (pDebugger)
pDebugger->BeginExec();
// handle strings & arrays & values by reference
int i;
for (i = 0; i < m_NumParams; ++i)
{
if (m_ParamTypes[i] == FP_STRING || m_ParamTypes[i] == FP_STRINGEX)
{
const char *str = reinterpret_cast<const char*>(params[i]);
if (!str)
str = "";
cell *tmp;
amx_Allot(m_Amx,
(m_ParamTypes[i] == FP_STRING) ? strlen(reinterpret_cast<const char*>(params[i]))+1 : STRINGEX_MAXLENGTH,
&realParams[i], &tmp);
amx_SetString(tmp, (const char *)(params[i]), 0, 0);
amx_Allot(m_Amx, (m_ParamTypes[i] == FP_STRING) ? strlen(str) + 1 : STRINGEX_MAXLENGTH, &realParams[i], &tmp);
amx_SetStringOld(tmp, str, 0, 0);
physAddrs[i] = tmp;
}
else if (m_ParamTypes[i] == FP_ARRAY)
{
cell *tmp;
amx_Allot(m_Amx, preparedArrays[params[i]].size,
&realParams[i], &tmp);
amx_Allot(m_Amx, preparedArrays[params[i]].size, &realParams[i], &tmp);
physAddrs[i] = tmp;
if (preparedArrays[params[i]].type == Type_Cell)
{
memcpy(tmp, preparedArrays[params[i]].ptr, preparedArrays[params[i]].size * sizeof(cell));
} else {
char *data = (char*)preparedArrays[params[i]].ptr;
for (unsigned int j = 0; j < preparedArrays[params[i]].size; ++j)
*tmp++ = (static_cast<cell>(*data++)) & 0xFF;
}
}
else if (m_ParamTypes[i] == FP_CELL_BYREF || m_ParamTypes[i] == FP_FLOAT_BYREF)
{
cell *tmp;
amx_Allot(m_Amx, 1, &realParams[i], &tmp);
physAddrs[i] = tmp;
if (m_ParamTypes[i] == FP_CELL_BYREF)
{
memcpy(tmp, reinterpret_cast<cell *>(params[i]), sizeof(cell));
}
else
{
char *data = (char*)preparedArrays[params[i]].ptr;
for (unsigned int j = 0; j < preparedArrays[params[i]].size; ++j)
*tmp++ = (static_cast<cell>(*data++)) & 0xFF;
memcpy(tmp, reinterpret_cast<REAL *>(params[i]), sizeof(REAL));
}
}
else
@ -241,12 +318,36 @@ cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
realParams[i] = params[i];
}
}
for (i = m_NumParams - 1; i >= 0; i--)
amx_Push(m_Amx, realParams[i]);
// exec
cell retVal;
amx_Execv(m_Amx, &retVal, m_Func, m_NumParams, realParams);
cell retVal = 0;
#if defined BINLOG_ENABLED
g_BinLog.WriteOp(BinLog_CallPubFunc, pPlugin->getId(), m_Func);
#endif
int err = amx_ExecPerf(m_Amx, &retVal, m_Func);
if (err != AMX_ERR_NONE)
{
//Did something else set an error?
if (pDebugger && pDebugger->ErrorExists())
{
//we don't care, something else logged the error.
}
else if (err != -1)
{
//nothing logged the error so spit it out anyway
LogError(m_Amx, err, NULL);
}
}
if (pDebugger)
pDebugger->EndExec();
m_Amx->error = AMX_ERR_NONE;
// cleanup strings & arrays
// cleanup strings & arrays & values by reference
for (i = 0; i < m_NumParams; ++i)
{
if (m_ParamTypes[i] == FP_STRING)
@ -256,7 +357,7 @@ cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
else if (m_ParamTypes[i] == FP_STRINGEX)
{
// copy back
amx_GetString(reinterpret_cast<char*>(params[i]), physAddrs[i], 0);
amx_GetStringOld(reinterpret_cast<char*>(params[i]), physAddrs[i], 0);
amx_Release(m_Amx, realParams[i]);
}
else if (m_ParamTypes[i] == FP_ARRAY)
@ -268,28 +369,48 @@ cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
if (preparedArrays[params[i]].type == Type_Cell)
{
memcpy(preparedArrays[params[i]].ptr, tmp, preparedArrays[params[i]].size * sizeof(cell));
}
else
{
} else {
char *data = (char*)preparedArrays[params[i]].ptr;
for (unsigned int j = 0; j < preparedArrays[params[i]].size; ++j)
*data++ = static_cast<char>(*tmp++ & 0xFF);
}
}
amx_Release(m_Amx, realParams[i]);
}
else if (m_ParamTypes[i] == FP_CELL_BYREF || m_ParamTypes[i] == FP_FLOAT_BYREF)
{
//copy back
cell *tmp = physAddrs[i];
if (m_ParamTypes[i] == FP_CELL_BYREF)
{
memcpy(reinterpret_cast<cell *>(params[i]), tmp, sizeof(cell));
}
else
{
memcpy(reinterpret_cast<REAL *>(params[i]), tmp, sizeof(REAL));
}
amx_Release(m_Amx, realParams[i]);
}
}
m_InExec = false;
return retVal;
}
int CForwardMngr::registerForward(const char *funcName, ForwardExecType et, int numParams, const ForwardParam * paramTypes)
{
int retVal = m_Forwards.size() << 1;
int retVal = m_Forwards.length() << 1;
CForward *tmp = new CForward(funcName, et, numParams, paramTypes);
if (!tmp)
{
return -1; // should be invalid
m_Forwards.push_back(tmp);
}
m_Forwards.append(tmp);
return retVal;
}
@ -297,105 +418,153 @@ int CForwardMngr::registerSPForward(int func, AMX *amx, int numParams, const For
{
int retVal = -1;
CSPForward *pForward;
if (!m_FreeSPForwards.empty())
{
retVal = m_FreeSPForwards.front();
pForward = m_SPForwards[retVal >> 1];
pForward->Set(func, amx, numParams, paramTypes);
if (pForward->getFuncsNum() == 0)
return -1;
m_FreeSPForwards.pop();
}
else
{
retVal = (m_SPForwards.size() << 1) | 1;
} else {
retVal = (m_SPForwards.length() << 1) | 1;
pForward = new CSPForward();
if (!pForward)
return -1;
pForward->Set(func, amx, numParams, paramTypes);
if (pForward->getFuncsNum() == 0)
{
return -1;
delete pForward;
return -1;
}
m_SPForwards.push_back(pForward);
m_SPForwards.append(pForward);
}
return retVal;
}
int CForwardMngr::registerSPForward(const char *funcName, AMX *amx, int numParams, const ForwardParam *paramTypes)
{
int retVal = (m_SPForwards.size() << 1) | 1;
int retVal = (m_SPForwards.length() << 1) | 1;
CSPForward *pForward;
if (!m_FreeSPForwards.empty())
{
retVal = m_FreeSPForwards.front();
pForward = m_SPForwards[retVal>>1]; // >>1 because unregisterSPForward pushes the id which contains the sp flag
pForward = m_SPForwards[retVal>>1]; // >>1 because unregisterSPForward pushes the id which contains the sp flag
pForward->Set(funcName, amx, numParams, paramTypes);
if (pForward->getFuncsNum() == 0)
return -1;
m_FreeSPForwards.pop();
}
else
{
} else {
pForward = new CSPForward();
if (!pForward)
return -1;
pForward->Set(funcName, amx, numParams, paramTypes);
if (pForward->getFuncsNum() == 0)
{
delete pForward;
return -1;
}
m_SPForwards.push_back(pForward);
m_SPForwards.append(pForward);
}
return retVal;
}
bool CForwardMngr::isIdValid(int id) const
{
return (id >= 0) && ((id & 1) ?
(static_cast<size_t>(id >> 1) < m_SPForwards.size()) :
(static_cast<size_t>(id >> 1) < m_Forwards.size()));
return (id >= 0) && ((id & 1) ? (static_cast<size_t>(id >> 1) < m_SPForwards.length()) : (static_cast<size_t>(id >> 1) < m_Forwards.length()));
}
cell CForwardMngr::executeForwards(int id, cell *params)
{
int retVal = (id & 1) ? m_SPForwards[id >> 1]->execute(params, m_TmpArrays) :
m_Forwards[id >> 1]->execute(params, m_TmpArrays);
int retVal;
if (id & 1)
{
CSPForward *fwd = m_SPForwards[id >> 1];
retVal = fwd->execute(params, m_TmpArrays);
if (fwd->m_ToDelete)
{
fwd->m_ToDelete = false;
unregisterSPForward(id);
}
} else {
retVal = m_Forwards[id >> 1]->execute(params, m_TmpArrays);
}
m_TmpArraysNum = 0;
return retVal;
}
const char *CForwardMngr::getFuncName(int id) const
{
if (!isIdValid(id))
{
return "";
}
return (id & 1) ? m_SPForwards[id >> 1]->getFuncName() : m_Forwards[id >> 1]->getFuncName();
}
int CForwardMngr::getFuncsNum(int id) const
{
if (!isIdValid(id))
{
return 0;
}
return (id & 1) ? m_SPForwards[id >> 1]->getFuncsNum() : m_Forwards[id >> 1]->getFuncsNum();
}
int CForwardMngr::getParamsNum(int id) const
{
return (id & 1) ? m_SPForwards[id >> 1]->getParamsNum() :
m_Forwards[id >> 1]->getParamsNum();
return (id & 1) ? m_SPForwards[id >> 1]->getParamsNum() : m_Forwards[id >> 1]->getParamsNum();
}
ForwardParam CForwardMngr::getParamType(int id, int paramNum) const
{
return (id & 1) ? m_SPForwards[id >> 1]->getParamType(paramNum) :
m_Forwards[id >> 1]->getParamType(paramNum);
if (!isIdValid(id))
{
return FP_DONE;
}
return (id & 1) ? m_SPForwards[id >> 1]->getParamType(paramNum) : m_Forwards[id >> 1]->getParamType(paramNum);
}
void CForwardMngr::clear()
{
for (ForwardVec::iterator iter = m_Forwards.begin(); iter != m_Forwards.end(); ++iter)
size_t i;
for (i = 0; i < m_Forwards.length(); ++i)
{
delete *iter;
delete m_Forwards[i];
}
SPForwardVec::iterator spIter;
for (spIter = m_SPForwards.begin(); spIter != m_SPForwards.end(); ++spIter)
for (i = 0; i < m_SPForwards.length(); ++i)
{
delete (*spIter);
delete m_SPForwards[i];
}
m_Forwards.clear();
m_SPForwards.clear();
while (!m_FreeSPForwards.empty())
{
m_FreeSPForwards.pop();
}
m_TmpArraysNum = 0;
}
@ -407,74 +576,160 @@ bool CForwardMngr::isSPForward(int id) const
void CForwardMngr::unregisterSPForward(int id)
{
//make sure the id is valid
if ( !isIdValid(id) || m_SPForwards.at(id >> 1)->isFree )
if (!isIdValid(id) || m_SPForwards.at(id >> 1)->isFree)
{
return;
}
m_SPForwards.at(id >> 1)->isFree = true;
CSPForward *fwd = m_SPForwards.at(id >> 1);
m_FreeSPForwards.push(id);
if (fwd->m_InExec)
{
fwd->m_ToDelete = true;
} else {
fwd->isFree = true;
m_FreeSPForwards.push(id);
}
}
int CForwardMngr::duplicateSPForward(int id)
{
if (!isIdValid(id) || m_SPForwards.at(id >> 1)->isFree)
{
return -1;
}
CSPForward *fwd = m_SPForwards.at(id >> 1);
return registerSPForward(fwd->m_Func, fwd->m_Amx, fwd->m_NumParams, fwd->m_ParamTypes);
}
int CForwardMngr::isSameSPForward(int id1, int id2)
{
if (!isIdValid(id1) || !isIdValid(id2))
{
return false;
}
CSPForward *fwd1 = m_SPForwards.at(id1 >> 1);
CSPForward *fwd2 = m_SPForwards.at(id2 >> 1);
if (fwd1->isFree || fwd2->isFree)
{
return false;
}
return ((fwd1->m_Amx == fwd2->m_Amx)
&& (fwd1->m_Func == fwd2->m_Func)
&& (fwd1->m_NumParams == fwd2->m_NumParams));
}
int registerForwardC(const char *funcName, ForwardExecType et, cell *list, size_t num)
{
ForwardParam params[FORWARD_MAX_PARAMS];
for (size_t i=0; i<num; i++)
{
params[i] = static_cast<ForwardParam>(list[i]);
}
return g_forwards.registerForward(funcName, et, num, params);
}
int registerForward(const char *funcName, ForwardExecType et, ...)
{
int curParam = 0;
va_list argptr;
va_start(argptr, et);
ForwardParam params[FORWARD_MAX_PARAMS];
ForwardParam tmp;
while (true)
{
if (curParam == FORWARD_MAX_PARAMS)
break;
tmp = (ForwardParam)va_arg(argptr, int);
if (tmp == FP_DONE)
break;
params[curParam] = tmp;
++curParam;
}
va_end(argptr);
return g_forwards.registerForward(funcName, et, curParam, params);
}
int registerSPForwardByNameC(AMX *amx, const char *funcName, cell *list, size_t num)
{
ForwardParam params[FORWARD_MAX_PARAMS];
for (size_t i=0; i<num; i++)
params[i] = static_cast<ForwardParam>(list[i]);
return g_forwards.registerSPForward(funcName, amx, num, params);
}
int registerSPForwardByName(AMX *amx, const char *funcName, ...)
{
int curParam = 0;
va_list argptr;
va_start(argptr, funcName);
ForwardParam params[FORWARD_MAX_PARAMS];
ForwardParam tmp;
while (true)
{
if (curParam == FORWARD_MAX_PARAMS)
break;
tmp = (ForwardParam)va_arg(argptr, int);
if (tmp == FP_DONE)
break;
params[curParam] = tmp;
++curParam;
}
va_end(argptr);
return g_forwards.registerSPForward(funcName, amx, curParam, params);
}
int registerSPForward(AMX *amx, int func, ...)
{
int curParam = 0;
va_list argptr;
va_start(argptr, func);
ForwardParam params[FORWARD_MAX_PARAMS];
ForwardParam tmp;
while (true)
{
if (curParam == FORWARD_MAX_PARAMS)
break;
tmp = (ForwardParam)va_arg(argptr, int);
if (tmp == FP_DONE)
break;
params[curParam] = tmp;
++curParam;
}
va_end(argptr);
return g_forwards.registerSPForward(func, amx, curParam, params);
}
@ -484,28 +739,60 @@ cell executeForwards(int id, ...)
return -1;
cell params[FORWARD_MAX_PARAMS];
int paramsNum = g_forwards.getParamsNum(id);
va_list argptr;
va_start(argptr, id);
ForwardParam param_type;
for (int i = 0; i < paramsNum && i < FORWARD_MAX_PARAMS; ++i)
{
if (g_forwards.getParamType(id, i) == FP_FLOAT)
param_type = g_forwards.getParamType(id, i);
if (param_type == FP_FLOAT)
{
REAL tmp = (REAL)va_arg(argptr, double); // floats get converted to doubles
params[i] = *(cell*)&tmp;
params[i] = amx_ftoc(tmp);
}
params[i] = (cell)va_arg(argptr, cell);
else if(param_type == FP_FLOAT_BYREF)
{
REAL *tmp = reinterpret_cast<REAL *>(va_arg(argptr, double*));
params[i] = reinterpret_cast<cell>(tmp);
}
else if(param_type == FP_CELL_BYREF)
{
cell *tmp = reinterpret_cast<cell *>(va_arg(argptr, cell*));
params[i] = reinterpret_cast<cell>(tmp);
}
else
params[i] = (cell)va_arg(argptr, cell);
}
va_end(argptr);
return g_forwards.executeForwards(id, params);
}
cell CForwardMngr::prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type, bool copyBack)
{
if (m_TmpArraysNum >= FORWARD_MAX_PARAMS)
{
#ifdef MEMORY_TEST
m_validateAllAllocUnits();
#endif // MEMORY_TEST
AMXXLOG_Log("[AMXX] Forwards with more than 32 parameters are not supported (tried to prepare array # %d).", m_TmpArraysNum + 1);
m_TmpArraysNum = 0;
return -1;
}
m_TmpArrays[m_TmpArraysNum].ptr = ptr;
m_TmpArrays[m_TmpArraysNum].size = size;
m_TmpArrays[m_TmpArraysNum].type = type;
m_TmpArrays[m_TmpArraysNum].copyBack = copyBack;
return m_TmpArraysNum++;
}

View File

@ -1,33 +1,11 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
/*
CForward.h
@ -46,7 +24,10 @@
#ifndef FORWARD_H
#define FORWARD_H
const int FORWARD_MAX_PARAMS = 16;
#include <stdarg.h>
#include "sh_stack.h"
const int FORWARD_MAX_PARAMS = 32;
enum ForwardExecType
{
@ -65,6 +46,8 @@ enum ForwardParam
FP_STRING, // string
FP_STRINGEX, // string; will be updated to the last function's value
FP_ARRAY, // array; use the return value of prepareArray.
FP_CELL_BYREF, // cell; pass by reference
FP_FLOAT_BYREF, // float; pass by reference
};
// for prepareArray
@ -77,7 +60,9 @@ enum ForwardArrayElemType
struct ForwardPreparedArray
{
void *ptr;
ForwardArrayElemType type;
unsigned int size;
bool copyBack;
};
@ -88,31 +73,45 @@ class CForward
const char *m_FuncName;
ForwardExecType m_ExecType;
int m_NumParams;
ke::AString m_Name;
struct AMXForward
{
CPluginMngr::CPlugin *pPlugin;
int func;
};
typedef CVector<AMXForward> AMXForwardList;
typedef ke::Vector<AMXForward> AMXForwardList;
AMXForwardList m_Funcs;
ForwardParam m_ParamTypes[FORWARD_MAX_PARAMS];
public:
CForward(const char *name, ForwardExecType et, int numParams, const ForwardParam * paramTypes);
CForward()
{ } // leaves everything unitialized'
CForward() {} // leaves everything unitialized'
cell execute(cell *params, ForwardPreparedArray *preparedArrays);
int getParamsNum() const
{
return m_NumParams;
}
int getFuncsNum() const
{
return m_Funcs.size();
return m_Funcs.length();
}
const char *getFuncName() const
{
return m_Name.chars();
}
ForwardParam getParamType(int paramId) const
{
if (paramId < 0 || paramId >= m_NumParams)
return FP_DONE;
return m_ParamTypes[paramId];
}
};
@ -120,12 +119,18 @@ public:
// Single plugin forward
class CSPForward
{
const char *m_FuncName;
friend class CForwardMngr;
int m_NumParams;
ForwardParam m_ParamTypes[FORWARD_MAX_PARAMS];
AMX *m_Amx;
int m_Func;
bool m_HasFunc;
ke::AString m_Name;
bool m_InExec;
bool m_ToDelete;
public:
bool isFree;
public:
@ -134,41 +139,49 @@ public:
void Set(int func, AMX *amx, int numParams, const ForwardParam * paramTypes);
cell execute(cell *params, ForwardPreparedArray *preparedArrays);
int getParamsNum() const
{
return m_NumParams;
}
int getFuncsNum() const
{
return (m_HasFunc) ? 1 : 0;
}
const char *getFuncName() const
{
return m_Name.chars();
}
ForwardParam getParamType(int paramId) const
{
if (paramId < 0 || paramId >= m_NumParams)
return FP_DONE;
return m_ParamTypes[paramId];
}
};
class CForwardMngr
{
typedef CVector<CForward*> ForwardVec;
typedef CVector<CSPForward*> SPForwardVec;
typedef CQueue<int> FreeSPVec; // Free SP Forwards
typedef ke::Vector<CForward*> ForwardVec;
typedef ke::Vector<CSPForward*> SPForwardVec;
typedef CStack<int> FreeSPVec; // Free SP Forwards
ForwardVec m_Forwards;
SPForwardVec m_SPForwards;
FreeSPVec m_FreeSPForwards; // so we don't have to free memory
ForwardPreparedArray m_TmpArrays[FORWARD_MAX_PARAMS]; // used by prepareArray
ForwardPreparedArray m_TmpArrays[FORWARD_MAX_PARAMS]; // used by prepareArray
int m_TmpArraysNum;
public:
CForwardMngr()
{ m_TmpArraysNum = 0; }
~CForwardMngr()
{ }
~CForwardMngr() {}
// Interface
// Register normal forward
@ -176,23 +189,31 @@ public:
// Register single plugin forward
int registerSPForward(const char *funcName, AMX *amx, int numParams, const ForwardParam * paramTypes);
int registerSPForward(int func, AMX *amx, int numParams, const ForwardParam * paramTypes);
// Unregister single plugin forward
void unregisterSPForward(int id);
int duplicateSPForward(int id);
int isSameSPForward(int id1, int id2);
// execute forward
cell executeForwards(int id, cell *params);
void clear(); // delete all forwards
void clear(); // delete all forwards
bool isIdValid(int id) const; // check whether forward id is valid
bool isSPForward(int id) const; // check whether forward is single plugin
int getParamsNum(int id) const; // get num of params of a forward
int getFuncsNum(int id) const; // get num of found functions of a forward
const char *getFuncName(int id) const; // get the function name
ForwardParam getParamType(int id, int paramId) const;
cell prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type,
bool copyBack); // prepare array
cell prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type, bool copyBack); // prepare array
};
// (un)register forward
int registerForward(const char *funcName, ForwardExecType et, ...);
int registerForwardC(const char *funcName, ForwardExecType et, cell *list, size_t num);
int registerSPForwardByName(AMX *amx, const char *funcName, ...);
int registerSPForwardByNameC(AMX *amx, const char *funcName, cell *list, size_t num);
int registerSPForward(AMX *amx, int func, ...);
void unregisterSPForward(int id);
@ -202,5 +223,4 @@ cell executeForwards(int id, ...);
cell prepareCellArray(cell *ptr, unsigned int size, bool copyBack = false);
cell prepareCharArray(char *ptr, unsigned int size, bool copyBack = false);
#endif
#endif //FORWARD_H

61
amxmodx/CFrameAction.h Normal file
View File

@ -0,0 +1,61 @@
#ifndef FRAMEACTION_H
#define FRAMEACTION_H
#include "amxmodx.h"
#include <amtl/am-deque.h>
#include <amtl/am-autoptr.h>
class CFrameActionMngr
{
public:
class CFrameAction
{
public:
CFrameAction(int callbackForward, cell callbackData) :
m_callbackForward(callbackForward),
m_callbackData(callbackData)
{
}
~CFrameAction()
{
unregisterSPForward(m_callbackForward);
}
void Execute()
{
executeForwards(m_callbackForward, m_callbackData);
}
public:
int m_callbackForward;
cell m_callbackData;
};
public:
void AddFrameAction(int callbackForward, cell callbackData)
{
m_requestedFrames.append(new CFrameAction(callbackForward, callbackData));
}
void ExecuteFrameCallbacks()
{
// In case a frame callback requests another frame, newly added frames won't be executed this way
int callbacksToRun = m_requestedFrames.length();
while (callbacksToRun--)
{
ke::AutoPtr<CFrameAction> action = ke::Move(m_requestedFrames.front());
m_requestedFrames.popFront();
action->Execute();
}
}
private:
ke::Deque<ke::AutoPtr<CFrameAction>> m_requestedFrames;
};
#endif // FRAMEACTION_H

1050
amxmodx/CGameConfigs.cpp Normal file

File diff suppressed because it is too large Load Diff

198
amxmodx/CGameConfigs.h Normal file
View File

@ -0,0 +1,198 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef _INCLUDE_GAMECONFIG_H_
#define _INCLUDE_GAMECONFIG_H_
#include <IGameConfigs.h>
#include "CLibrarySys.h"
#include <amtl/am-autoptr.h>
#include <amtl/am-vector.h>
#include <amtl/am-string.h>
#include <amtl/am-refcounting.h>
#include <sm_stringhashmap.h>
#include <sm_namehashset.h>
class CGameConfig
:
public ITextListener_SMC,
public IGameConfig,
public ke::Refcounted <CGameConfig>
{
friend class CGameConfigManager;
public:
CGameConfig(const char *file);
~CGameConfig();
public:
bool Reparse(char *error, size_t maxlength);
bool EnterFile(const char *file, char *error, size_t maxlength);
public: // ITextListener_SMC
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
SMCResult ReadSMC_LeavingSection(const SMCStates *states);
public: // IGameConfig
const char* GetKeyValue(const char *key);
bool GetOffset(const char *key, TypeDescription *value);
bool GetOffsetByClass(const char *classname, const char *key, TypeDescription *value);
bool GetMemSig(const char *key, void **addr);
bool GetAddress(const char *key, void **addr);
public: // NameHashSet
static inline bool matches(const char *key, const CGameConfig *value)
{
return strcmp(key, value->m_File) == 0;
}
private:
struct OffsetClass
{
StringHashMap<TypeDescription> list;
};
typedef StringHashMap<ke::AutoPtr<OffsetClass>> OffsetClassMap;
typedef StringHashMap<TypeDescription> OffsetMap;
char m_File[PLATFORM_MAX_PATH];
char m_CurrentPath[PLATFORM_MAX_PATH];
OffsetMap m_Offsets;
OffsetClassMap m_OffsetsByClass;
StringHashMap<ke::AString> m_Keys;
StringHashMap<void*> m_Sigs;
int m_ParseState;
unsigned int m_IgnoreLevel;
char m_Class[64];
char m_Offset[64];
char m_Game[256];
bool m_FoundOffset;
bool m_MatchedClasses;
bool m_ShouldBeReadingDefault;
bool m_HadGame;
bool m_MatchedGame;
bool m_HadEngine;
bool m_MatchedEngine;
bool m_MatchedPlatform;
unsigned int m_CustomLevel;
ITextListener_SMC* m_CustomHandler;
struct AddressConf
{
char m_SignatureName[64];
size_t m_ReadCount;
int m_ReadBytes[8];
AddressConf(const char *sigName, size_t sigLength, size_t readCount, int *read);
AddressConf() {}
};
char m_Address[64];
char m_AddressSignature[64];
int m_AddressReadCount;
int m_AddressRead[8];
StringHashMap<AddressConf> m_Addresses;
char m_pEngine[64];
};
class CGameMasterReader : public ITextListener_SMC
{
public:
void ReadSMC_ParseStart();
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
SMCResult ReadSMC_LeavingSection(const SMCStates *states);
public:
ke::Vector<ke::AString>* m_FileList;
unsigned int m_State;
unsigned int m_IgnoreLevel;
char m_CurrentPath[PLATFORM_MAX_PATH];
bool m_HadEngine;
bool m_MatchedEngine;
bool m_HadGame;
bool m_MatchedGame;
};
class CGameConfigManager : public IGameConfigManager
{
public:
CGameConfigManager();
~CGameConfigManager();
public: // IGameConfigManager
bool LoadGameConfigFile(const char *file, IGameConfig **pConfig, char *error, size_t maxlength);
void CloseGameConfigFile(IGameConfig *cfg);
void AddUserConfigHook(const char *sectionname, ITextListener_SMC *listener);
void RemoveUserConfigHook(const char *sectionname, ITextListener_SMC *listener);
public:
void OnAmxxStartup();
void RemoveCachedConfig(CGameConfig *config);
private:
NameHashSet<CGameConfig*> m_Lookup;
public:
StringHashMap<ITextListener_SMC*> m_customHandlers;
};
#define GET_OFFSET(classname, member) \
static int member = -1; \
if (member == -1) \
{ \
TypeDescription type; \
if (!CommonConfig->GetOffsetByClass(classname, #member, &type) || type.fieldOffset < 0)\
{ \
LogError(amx, AMX_ERR_NATIVE, "Invalid %s offset. Native %s is disabled", #member, __FUNCTION__);\
return 0; \
} \
member = type.fieldOffset; \
}
#define GET_OFFSET_NO_ERROR(classname, member) \
static int member = -1; \
if (member == -1) \
{ \
TypeDescription type; \
if (!CommonConfig->GetOffsetByClass(classname, #member, &type) || type.fieldOffset < 0)\
{ \
return; \
} \
member = type.fieldOffset; \
}
extern CGameConfigManager ConfigManager;
extern IGameConfig *CommonConfig;
#endif // _INCLUDE_GAMECONFIG_H_

File diff suppressed because it is too large Load Diff

View File

@ -1,61 +1,64 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef _INCLUDE_CLANG_H
#define _INCLUDE_CLANG_H
#include "sh_tinyhash.h"
#include "sm_stringhashmap.h"
#include <ITextParsers.h>
#define LANG_SERVER 0
#define LANG_PLAYER -1
struct md5Pair
{
String file;
String val;
};
struct keyEntry
{
String key;
uint32_t hash;
};
#define ERR_BADKEY 1 // Lang key not found
#define ERR_BADLANG 2 // Invalid lang
struct sKeyDef
{
sKeyDef() { key = -1; def = 0; }
~sKeyDef() { if (def) delete def; }
ke::AutoString* definition;
int key;
String *def;
};
class CLangMngr
struct lang_err
{
lang_err() : last(0.0f)
{
};
float last;
};
class defentry
{
public:
defentry() : definition(NULL)
{
};
defentry(const defentry &src)
{
definition = src.definition;
}
~defentry()
{
}
ke::AString *definition;
};
struct keytbl_val
{
keytbl_val() : index(-1)
{
};
int index;
};
class CLangMngr : public ITextListener_INI
{
class CLang
{
@ -68,92 +71,57 @@ class CLangMngr
~CLang();
// Get the definition
const char *GetDef(const char *key);
const char *GetDef(int key, int &status);
// Add definitions to this language
void MergeDefinitions(CQueue <sKeyDef*> & vec);
void MergeDefinitions(ke::Vector <sKeyDef> & vec);
// Reset this language
void Clear();
// compare this language to a language name
friend bool operator == (const CLang &left, const char *right)
{
return strcmp(left.m_LanguageName, right)==0 ? true : false;
return strcmp(left.m_LanguageName, right) == 0 ? true : false;
}
// Get language name
const char *GetName() { return m_LanguageName; }
// Save to file
bool Save(FILE *fp, int &defOffset, uint32_t &curOffset);
bool SaveDefinitions(FILE *fp, uint32_t &curOffset);
// Load
bool Load(FILE *fp);
void SetMngr(CLangMngr *l) { m_LMan = l; }
// Get number of entries
int Entries() { return m_LookUpTable.size(); }
// Make a hash from a string; convert to lowercase first if needed
static uint32_t MakeHash(const char *src, bool makeLower = false);
int Entries();
protected:
// An entry in the language
class LangEntry
{
// the definition hash
uint32_t m_DefHash;
// index into the lookup table?
int key;
// the definition
String m_pDef;
// is this from the cache or not?
bool m_isCache;
public:
// Set
void SetKey(int key);
void SetDef(const char *pDef);
void SetCache(bool c);
// Get
uint32_t GetDefHash();
int GetKey();
const char *GetDef();
int GetDefLength();
bool GetCache();
// Constructors / destructors
LangEntry();
LangEntry(int key);
LangEntry(int key, const char *pDef);
LangEntry(const LangEntry &other);
LangEntry(int pKey, uint32_t defHash, const char *pDef);
// Reset
void Clear();
};
// Get (construct if needed) an entry
LangEntry * GetEntry(int key);
typedef CVector<LangEntry*> LookUpVec;
typedef LookUpVec::iterator LookUpVecIter;
typedef THash<int, defentry> LookUpVec;
typedef LookUpVec::iterator LookUpVecIter;
char m_LanguageName[3];
// our lookup table
LookUpVec m_LookUpTable;
int m_entries;
CLangMngr *m_LMan;
public:
LangEntry *AddEntry(int pKey, uint32_t defHash, const char *def, bool cache);
void AddEntry(int key, const char *definition);
};
public:
// Merge definitions into a language
void MergeDefinitions(const char *lang, CQueue <sKeyDef*> &tmpVec);
// strip lowercase; make lower if needed
static size_t strip(char *str, char *newstr, bool makelower=false);
void MergeDefinitions(const char *lang, ke::Vector <sKeyDef> &tmpVec);
typedef CVector<CLang*> LangVec;
typedef CVector<CLang*>::iterator LangVecIter;
public: // ITextListener_INI
void ReadINI_ParseStart();
void ReadINI_ParseEnd(bool halted);
bool ReadINI_NewSection(const char *section, bool invalid_tokens, bool close_bracket, bool extra_tokens, unsigned int *curtok);
bool ReadINI_KeyValue(const char *key, const char *value, bool invalid_tokens, bool equal_token, bool quotes, unsigned int *curtok);
private:
// strip lowercase; make lower if needed
static size_t strip(char *str, char *newstr, bool makelower = false);
typedef ke::Vector<CLang*> LangVec;
LangVec m_Languages;
CVector<md5Pair *> FileList;
CVector<keyEntry*> KeyList;
StringHashMap<time_t> FileList;
ke::Vector<ke::AString *> KeyList;
THash<ke::AString, keytbl_val> KeyTable;
// Get a lang object (construct if needed)
CLang * GetLang(const char *name);
@ -165,30 +133,19 @@ class CLangMngr
public:
// Merge a definitions file
int MergeDefinitionFile(const char *file);
// Get a definition from a lang name and a kyer
const char *GetDef(const char *langName, const char *key);
// Format a string
const char *Format(const char *src, ...);
// Get a definition from a lang name and a key
const char *GetDef(const char *langName, const char *key, int &status);
// Format a string for an AMX plugin
char *FormatAmxString(AMX *amx, cell *params, int parm, int &len);
char *FormatString(const char *fmt, va_list &ap);
// Save
bool Save(const char *filename);
// Load
bool Load(const char *filename);
// Cache
bool LoadCache(const char *filename);
bool SaveCache(const char *filename);
void InvalidateCache();
// Get index
int GetKeyEntry(String &key);
int GetKeyEntry(ke::AString &key);
int GetKeyEntry(const char *key);
int GetKeyHash(int key);
// Get key from index
const char *GetKey(int key);
// Add key
int AddKeyEntry(String &key);
// Make a hash from a string; convert to lowercase first if needed
uint32_t MakeHash(const char *src, bool makeLower);
int AddKeyEntry(ke::AString &key);
int AddKeyEntry(const char *key);
// Get the number of languages
int GetLangsNum();
@ -200,6 +157,8 @@ public:
// When a language id in a format string in FormatAmxString is LANG_PLAYER, the glob id decides which language to take.
void SetDefLang(int id);
inline int GetDefLang() const { return m_CurGlobId; }
// Reset
void Clear();

388
amxmodx/CLibrarySys.cpp Normal file
View File

@ -0,0 +1,388 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "CLibrarySys.h"
#include <amxmodx.h>
#include <amtl/os/am-fsutil.h>
#include <amtl/os/am-path.h>
#include <amtl/os/am-system-errors.h>
LibrarySystem g_LibSys;
/******************/
/* Directory Code */
/******************/
CDirectory::CDirectory(const char *path)
{
#if defined PLATFORM_WINDOWS
char newpath[PLATFORM_MAX_PATH];
ke::SafeSprintf(newpath, sizeof(newpath), "%s\\*.*", path);
m_dir = FindFirstFile(newpath, &m_fd);
if (!IsValid())
{
m_fd.cFileName[0] = '\0';
}
#elif defined PLATFORM_POSIX
m_dir = opendir(path);
if (IsValid())
{
m_ep = readdir(m_dir); // TODO: we need to read past "." and ".."!
ke::SafeSprintf(m_origpath, sizeof(m_origpath), "%s", path);
}
else
{
m_ep = nullptr;
}
#endif
}
CDirectory::~CDirectory()
{
if (IsValid())
{
#if defined PLATFORM_WINDOWS
FindClose(m_dir);
#elif defined PLATFORM_POSIX
closedir(m_dir);
#endif
}
}
DirHandle CDirectory::GetHandle()
{
return m_dir;
}
void CDirectory::NextEntry()
{
#if defined PLATFORM_WINDOWS
if (FindNextFile(m_dir, &m_fd) == 0)
{
FindClose(m_dir);
m_dir = INVALID_HANDLE_VALUE;
}
#elif defined PLATFORM_POSIX
if (!(m_ep = readdir(m_dir)))
{
closedir(m_dir);
m_dir = nullptr;
}
#endif
}
bool CDirectory::IsEntryValid()
{
return IsValid();
}
bool CDirectory::IsEntryDirectory()
{
#if defined PLATFORM_WINDOWS
return ((m_fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY);
#elif defined PLATFORM_POSIX
char temppath[PLATFORM_MAX_PATH];
ke::SafeSprintf(temppath, sizeof(temppath), "%s/%s", m_origpath, GetEntryName());
return ke::file::IsDirectory(temppath);
#endif
}
bool CDirectory::IsEntryFile()
{
#if defined PLATFORM_WINDOWS
return !(m_fd.dwFileAttributes & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE));
#elif defined PLATFORM_POSIX
char temppath[PLATFORM_MAX_PATH];
ke::SafeSprintf(temppath, sizeof(temppath), "%s/%s", m_origpath, GetEntryName());
return ke::file::IsFile(temppath);
#endif
}
const char* CDirectory::GetEntryName()
{
#if defined PLATFORM_WINDOWS
return m_fd.cFileName;
#elif defined PLATFORM_POSIX
return m_ep ? m_ep->d_name : "";
#endif
}
bool CDirectory::MoreFiles()
{
return IsValid();
}
bool CDirectory::IsValid()
{
#if defined PLATFORM_WINDOWS
return (m_dir != INVALID_HANDLE_VALUE);
#elif defined PLATFORM_POSIX
return (m_dir != nullptr);
#endif
}
/****************/
/* Library Code */
/****************/
CLibrary::CLibrary(ke::RefPtr<ke::SharedLib> lib) : lib_(lib)
{}
void CLibrary::CloseLibrary()
{
delete this;
}
void *CLibrary::GetSymbolAddress(const char* symname)
{
return lib_->lookup(symname);
}
/***********************/
/* Library System Code */
/***********************/
bool LibrarySystem::PathExists(const char *path)
{
return ke::file::PathExists(path);
}
bool LibrarySystem::IsPathFile(const char* path)
{
return ke::file::IsFile(path);
}
bool LibrarySystem::IsPathDirectory(const char* path)
{
return ke::file::IsDirectory(path);
}
CDirectory *LibrarySystem::OpenDirectory(const char* path)
{
CDirectory* dir = new CDirectory(path);
if (!dir->IsValid())
{
delete dir;
return nullptr;
}
return dir;
}
CLibrary* LibrarySystem::OpenLibrary(const char* path, char* error, size_t maxlength)
{
ke::RefPtr<ke::SharedLib> lib = ke::SharedLib::Open(path, error, maxlength);
if (!lib)
{
return nullptr;
}
return new CLibrary(lib);
}
void LibrarySystem::GetPlatformError(char* error, size_t maxlength)
{
#if defined PLATFORM_WINDOWS
return GetPlatformErrorEx(GetLastError(), error, maxlength);
#elif defined PLATFORM_POSIX
return GetPlatformErrorEx(errno, error, maxlength);
#endif
}
void LibrarySystem::GetPlatformErrorEx(int code, char* error, size_t maxlength)
{
if (error && maxlength)
{
ke::FormatSystemErrorCode(code, error, maxlength);
}
}
void LibrarySystem::GetLoaderError(char* buffer, size_t maxlength)
{
ke::FormatSystemError(buffer, maxlength);
}
void LibrarySystem::CloseDirectory(CDirectory *dir)
{
delete dir;
}
size_t LibrarySystem::PathFormat(char* buffer, size_t len, const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
size_t mylen = ke::path::FormatVa(buffer, len, fmt, ap);
va_end(ap);
return mylen;
}
char* LibrarySystem::PathFormat(const char* fmt, ...)
{
static char buffer[PLATFORM_MAX_PATH];
va_list ap;
va_start(ap, fmt);
ke::path::FormatVa(buffer, sizeof(buffer), fmt, ap);
va_end(ap);
return buffer;
}
const char* LibrarySystem::GetFileExtension(const char* filename)
{
size_t len, end;
len = strlen(filename);
/* Minimum string length for filename with ext would be 3; example: a.a */
if (len < 3)
{
return nullptr;
}
end = len - 1;
for (size_t i = end; i <= end; i--)
{
if (filename[i] == PLATFORM_SEP_CHAR || filename[i] == PLATFORM_SEP_ALTCHAR)
{
break;
}
if (filename[i] == '.' && i != end && i != 0)
{
return &filename[++i];
}
}
return nullptr;
}
bool LibrarySystem::CreateFolder(const char* path)
{
return ke::file::CreateDirectory(path, 0775);
}
size_t LibrarySystem::GetFileFromPath(char* buffer, size_t maxlength, const char* path)
{
size_t length = strlen(path);
for (size_t i = length - 1; i <= length - 1; i--)
{
if (path[i] == '/'
#if defined PLATFORM_WINDOWS
|| path[i] == '\\'
#endif
)
{
return ke::SafeSprintf(buffer, maxlength, "%s", &path[i + 1]);
}
}
/* We scanned and found no path separator */
return ke::SafeSprintf(buffer, maxlength, "%s", path);
}
bool LibrarySystem::FileTime(const char* path, FileTimeType type, time_t* pTime)
{
struct stat s;
if (stat(path, &s) != 0)
{
return false;
}
switch (type)
{
case FileTime_LastAccess:
{
*pTime = s.st_atime;
break;
}
case FileTime_Created:
{
*pTime = s.st_ctime;
break;
}
case FileTime_LastChange:
{
*pTime = s.st_mtime;
break;
}
default:
{
return false;
}
}
return true;
}
bool LibrarySystem::DoesPlatformMatch(const char *platform)
{
return strcmp(platform, PLATFORM_NAME) == 0;
}
bool LibrarySystem::IsPlatformCompatible(const char *platform, bool *hadPrimaryMatch)
{
if (DoesPlatformMatch(platform))
{
#if defined PLATFORM_COMPAT_ALT
*hadPrimaryMatch = true;
#endif
return true;
}
#if defined PLATFORM_COMPAT_ALT
/* If entry hasn't been found for the primary platform name, check for compatible alternate */
if (!*hadPrimaryMatch)
{
return strcmp(platform, PLATFORM_COMPAT_ALT) == 0;
}
#endif
return false;
}

107
amxmodx/CLibrarySys.h Normal file
View File

@ -0,0 +1,107 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef _INCLUDE_LIBRARY_SYS_H_
#define _INCLUDE_LIBRARY_SYS_H_
#include "amx.h" // cell
#include <platform_helpers.h>
#include <amtl/os/am-shared-library.h>
enum FileTimeType
{
FileTime_LastAccess = 0, /* Last access (not available on FAT) */
FileTime_Created = 1, /* Creation (not available on FAT) */
FileTime_LastChange = 2, /* Last modification */
};
class CDirectory
{
public:
CDirectory(const char* path);
~CDirectory();
public:
bool MoreFiles();
void NextEntry();
const char* GetEntryName();
bool IsEntryDirectory();
bool IsEntryFile();
bool IsEntryValid();
public:
bool IsValid();
DirHandle GetHandle();
private:
#if defined PLATFORM_WINDOWS
HANDLE m_dir;
WIN32_FIND_DATAA m_fd;
#elif defined PLATFORM_POSIX
DIR* m_dir;
struct dirent* m_ep;
char m_origpath[PLATFORM_MAX_PATH];
#endif
};
class CLibrary
{
public:
CLibrary(ke::RefPtr<ke::SharedLib> lib);
public:
void CloseLibrary();
void *GetSymbolAddress(const char* symname);
private:
ke::RefPtr<ke::SharedLib> lib_;
};
class LibrarySystem
{
public:
CLibrary* OpenLibrary(const char* path, char* error = nullptr, size_t maxlength = 0);
CDirectory* OpenDirectory(const char* path);
void CloseDirectory(CDirectory *dir);
bool PathExists(const char* path);
bool IsPathFile(const char* path);
bool IsPathDirectory(const char* path);
void GetPlatformError(char* error, size_t maxlength);
void GetPlatformErrorEx(int code, char* error, size_t maxlength);
size_t PathFormat(char* buffer, size_t len, const char* fmt, ...);
char* PathFormat(const char* fmt, ...);
const char* GetFileExtension(const char* filename);
bool CreateFolder(const char* path);
size_t GetFileFromPath(char* buffer, size_t maxlength, const char* path);
bool FileTime(const char* path, FileTimeType type, time_t* pTime);
void GetLoaderError(char* buffer, size_t maxlength);
bool DoesPlatformMatch(const char* platform);
bool IsPlatformCompatible(const char *platform, bool *hadPrimaryMatch);
};
extern LibrarySystem g_LibSys;
#endif // _INCLUDE_LIBRARY_SYS_H_

View File

@ -1,313 +0,0 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
#ifndef CLIST_H
#define CLIST_H
// *****************************************************
// class CList
// *****************************************************
// Linked list
template <typename T, typename F = char* >
class CList
{
private:
// One list element
class CElement
{
T *m_pObject; // pointer to the object
CElement *m_pNext; // pointer to the next element
CElement *m_pPrev; // pointer to the previous element
public:
// dereference operator
T& operator* ()
{
return *m_pObject;
}
// constructor
CElement(T *pObj)
{
m_pObject = pObj;
m_pNext = NULL;
m_pPrev = NULL;
}
// destructor
~CElement()
{
delete m_pObject;
if (m_pNext)
m_pNext->m_pPrev = m_pPrev;
if (m_pPrev)
m_pPrev->m_pNext = m_pNext;
}
// returns object pointer
T *GetObj()
{
return m_pObject;
}
// returns next element pointer
CElement *GetNext()
{
return m_pNext;
}
// sets next element
void SetNext(CElement *newNext)
{
m_pNext = newNext;
}
// returns previous element pointer
CElement *GetPrev()
{
return m_pPrev;
}
// sets previous element
void SetPrev(CElement *newPrev)
{
m_pPrev = newPrev;
}
};
// CList<T,F> class
CElement *m_pHead; // head of the linked list
CElement *m_pTail; // tail of the linked list
public:
// iterator class
class iterator
{
friend class CList<T,F>;
CList<T,F> *m_pList; // The list that created this iterator
CElement *m_CurPos; // Current position in the list
public:
iterator()
{
m_pList = NULL;
m_CurPos = NULL;
}
// constructor based on list, element
iterator(CList<T,F> *pList, CElement *startPos)
{
m_pList = pList;
m_CurPos = startPos;
}
// constructor based on other iterator
iterator(const iterator &other)
{
m_pList = other.m_pList;
m_CurPos = other.m_CurPos;
}
// dereference operator
T & operator* () const
{
return *m_CurPos->GetObj();
}
T * operator-> () const
{
return m_CurPos->GetObj();
}
// validity check operator
inline operator bool () const
{
return m_pList!=NULL && m_CurPos!=NULL && m_CurPos->GetObj()!=NULL;
}
// pre increment operator
inline iterator& operator ++ ()
{
m_CurPos = m_CurPos->GetNext();
return *this;
}
// post increment operator
inline iterator operator++(int)
{
iterator tmp(*this);
m_CurPos = m_CurPos->next;
return tmp;
}
// returns iterator that points to next element
iterator GetNext()
{
iterator tmp(*this);
return ++tmp;
}
iterator remove()
{
return m_pList->remove(*this);
}
iterator put(T *obj)
{
return m_pList->put(obj, *this);
}
};
CList<T,F>()
{
m_pHead = NULL;
m_pTail = NULL;
}
~CList<T,F>()
{
clear();
}
// removes the object referenced by where
// sets where to the next object
// returns an iterator pointing to the next object
iterator remove(iterator &where)
{
iterator tmp(where.GetNext());
if (where.m_CurPos == m_pHead)
m_pHead = where.m_CurPos->GetNext();
if (where.m_CurPos == m_pTail)
m_pTail = where.m_CurPos->GetPrev();
delete where.m_CurPos;
where = tmp;
return tmp;
}
// puts an element to the end of the list
// returns an iterator pointing to it
iterator put_back(T *pObj)
{
CElement *pTmp = new CElement(pObj);
if (!m_pHead)
{
m_pHead = pTmp;
m_pTail = pTmp;
}
else
{
pTmp->SetNext(NULL);
pTmp->SetPrev(m_pTail);
m_pTail->SetNext(pTmp);
m_pTail = pTmp;
}
return iterator(this, pTmp);
}
iterator put_front(T *pObj)
{
CElement *pTmp = new CElement(pObj);
if (!m_pHead)
{
m_pHead = pTmp;
m_pTail = pTmp;
}
else
{
pTmp->SetNext(m_pHead);
pTmp->SetPrev(NULL);
m_pHead->SetPrev(pTmp);
m_pHead = pTmp;
}
return iterator(this, pTmp);
}
// alias for put_back
iterator put(T *pObj)
{
return put_back(pObj);
}
// puts an element after where
// alters where to point to the new element
// returns an iterator pointing to the new element
iterator put(T *pObj, iterator &where)
{
CElement *pTmp = new CElement(pObj);
if (where.m_CurPos->GetNext())
where.m_CurPos->GetNext()->SetPrev(pTmp);
else // where = tail
m_pTail = pTmp;
pTmp->SetPrev(where.m_CurPos);
pTmp->SetNext(where.m_CurPos->GetNext());
where.m_CurPos->SetNext(pTmp);
return ++where;
}
iterator begin()
{
return iterator(this, m_pHead);
}
void clear()
{
iterator iter = begin();
while (iter) iter.remove();
}
iterator find(iterator startOn, const F &desc)
{
iterator iter = startOn;
while(iter)
{
if (*iter == desc)
break;
++iter;
}
return iter;
}
iterator find(const F &desc)
{
return find(begin(), desc);
}
int size()
{
iterator iter = begin();
int i=0;
while (iter)
{
++i;
++iter;
}
return i;
}
};
#endif

View File

@ -1,250 +1,324 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "CLogEvent.h"
NativeHandle<LogEventHook> LogEventHandles;
// *****************************************************
// class LogEventsMngr
// *****************************************************
LogEventsMngr::LogEventsMngr() {
logCurrent = logCounter = 0;
logcmplist = 0;
arelogevents = false;
memset( logevents, 0, sizeof(logevents) );
LogEventsMngr::LogEventsMngr()
{
logCurrent = logCounter = 0;
logcmplist = 0;
arelogevents = false;
memset(logevents, 0, sizeof(logevents));
}
LogEventsMngr::~LogEventsMngr() {
clearLogEvents();
LogEventsMngr::~LogEventsMngr()
{
clearLogEvents();
}
int LogEventsMngr::CLogCmp::compareCondition(const char* string){
if ( logid == parent->logCounter )
return result;
logid = parent->logCounter;
if ( in ) return result = strstr( string , text.c_str() ) ? 0 : 1;
return result = strcmp(string,text.c_str());
int LogEventsMngr::CLogCmp::compareCondition(const char* string)
{
if (logid == parent->logCounter)
return result;
logid = parent->logCounter;
if (in)
return result = strstr(string, text.chars()) ? 0 : 1;
return result = strcmp(string,text.chars());
}
LogEventsMngr::CLogCmp* LogEventsMngr::registerCondition(char* filter){
LogEventsMngr::CLogCmp* LogEventsMngr::registerCondition(char* filter)
{
char* temp = filter;
// expand "1=message"
while ( isdigit(*filter) )
while (isdigit(*filter))
++filter;
bool in = (*filter=='&');
*filter++ = 0;
int pos = atoi(temp);
if ( pos < 0 || pos >= MAX_LOGARGS) pos = 0;
bool in = (*filter=='&');
*filter++ = 0;
int pos = atoi(temp);
if (pos < 0 || pos >= MAX_LOGARGS)
pos = 0;
CLogCmp* c = logcmplist;
while( c ) {
if ( (c->pos==pos) && (c->in==in) && !strcmp(c->text.c_str(), filter))
while (c)
{
if ((c->pos == pos) && (c->in == in) && !strcmp(c->text.chars(), filter))
return c;
c = c->next;
}
return logcmplist = new CLogCmp( filter , in , pos , logcmplist,this );
return logcmplist = new CLogCmp(filter, in, pos, logcmplist, this);
}
void LogEventsMngr::CLogEvent::registerFilter( char* filter ){
CLogCmp *cmp = parent->registerCondition( filter );
if ( cmp == 0 ) return;
for(LogCond* c = filters; c ; c = c->next){
if ( c->argnum == cmp->pos ){
c->list = new LogCondEle( cmp , c->list );
void LogEventsMngr::CLogEvent::registerFilter(char* filter)
{
CLogCmp *cmp = parent->registerCondition(filter);
if (cmp == 0) return;
for (LogCond* c = filters; c; c = c->next)
{
if (c->argnum == cmp->pos)
{
c->list = new LogCondEle(cmp, c->list);
return;
}
}
LogCondEle* aa = new LogCondEle( cmp , 0 );
if ( aa == 0 ) return;
filters = new LogCond( cmp->pos , aa , filters );
LogCondEle* aa = new LogCondEle(cmp, 0);
if (aa == 0)
return;
filters = new LogCond(cmp->pos, aa, filters);
}
void LogEventsMngr::setLogString( char* frmt, va_list& vaptr ) {
void LogEventsMngr::setLogString(const char* frmt, va_list& vaptr)
{
++logCounter;
int len = vsnprintf (logString, 255 , frmt, vaptr );
if ( len == - 1) {
int len = vsnprintf(logString, 255, frmt, vaptr);
if (len == - 1)
{
len = 255;
logString[len] = 0;
}
if ( len ) logString[--len] = 0;
if (len)
logString[--len] = 0;
logArgc = 0;
}
void LogEventsMngr::setLogString( char* frmt, ... ) {
void LogEventsMngr::setLogString(const char* frmt, ...)
{
++logCounter;
va_list logArgPtr;
va_start ( logArgPtr , frmt );
int len = vsnprintf(logString, 255 , frmt, logArgPtr );
if ( len == - 1) {
va_start(logArgPtr, frmt);
int len = vsnprintf(logString, 255, frmt, logArgPtr);
if (len == - 1)
{
len = 255;
logString[len] = 0;
}
va_end ( logArgPtr );
if ( len ) logString[--len] = 0;
va_end(logArgPtr);
if (len)
logString[--len] = 0;
logArgc = 0;
}
void LogEventsMngr::parseLogString( ) {
register const char* b = logString;
register int a;
while( *b && logArgc < MAX_LOGARGS ){
a = 0;
if ( *b == '"' ) {
++b;
while ( *b && *b != '"' && a < 127 )
logArgs[logArgc][a++] = *b++;
logArgs[logArgc++][a] = 0;
if ( *b) b+=2; // thanks to double terminator
}
else if ( *b == '(' ) {
++b;
while ( *b && *b != ')' && a < 127 )
logArgs[logArgc][a++] = *b++;
logArgs[logArgc++][a] = 0;
if ( *b) b+=2;
}
else {
while ( *b && *b != '(' && *b != '"' && a < 127 )
logArgs[logArgc][a++] = *b++;
if ( *b ) --a;
logArgs[logArgc++][a] = 0;
}
}
void LogEventsMngr::parseLogString()
{
register const char* b = logString;
register int a;
while (*b && logArgc < MAX_LOGARGS)
{
a = 0;
if (*b == '"')
{
++b;
while (*b && *b != '"' && a < 127)
logArgs[logArgc][a++] = *b++;
logArgs[logArgc++][a] = 0;
if (*b) b+=2; // thanks to double terminator
}
else if (*b == '(')
{
++b;
while (*b && *b != ')' && a < 127)
logArgs[logArgc][a++] = *b++;
logArgs[logArgc++][a] = 0;
if (*b) b+=2;
} else {
while (*b && *b != '(' && *b != '"' && a < 127)
logArgs[logArgc][a++] = *b++;
if (*b) --a;
logArgs[logArgc++][a] = 0;
}
}
}
LogEventsMngr::CLogEvent* LogEventsMngr::registerLogEvent( CPluginMngr::CPlugin* plugin, int func, int pos )
void LogEventsMngr::CLogEvent::setForwardState(ForwardState state)
{
if ( pos < 1 || pos > MAX_LOGARGS)
return 0;
arelogevents = true;
CLogEvent** d = &logevents[pos];
while(*d) d = &(*d)->next;
return *d = new CLogEvent( plugin , func, this );
m_State = state;
}
int LogEventsMngr::registerLogEvent(CPluginMngr::CPlugin* plugin, int func, int pos)
{
if (pos < 1 || pos > MAX_LOGARGS)
{
return 0;
}
arelogevents = true;
auto d = &logevents[pos];
while (*d)
{
d = &(*d)->next;
}
auto logevent = new CLogEvent(plugin, func, this);
auto handle = LogEventHandles.create(logevent);
if (!handle)
{
return 0;
}
*d = logevent;
return handle;
}
void LogEventsMngr::executeLogEvents()
{
int err;
bool valid;
for(CLogEvent* a = logevents[ logArgc ]; a ; a = a->next){
bool valid;
for (CLogEvent* a = logevents[logArgc]; a; a = a->next)
{
if (a->m_State != FSTATE_ACTIVE)
{
continue;
}
valid = true;
for( CLogEvent::LogCond* b = a->filters; b ; b = b->next){
for (CLogEvent::LogCond* b = a->filters; b; b = b->next)
{
valid = false;
for( CLogEvent::LogCondEle* c = b->list; c ; c = c->next) {
if ( c->cmp->compareCondition( logArgs[b->argnum] ) == 0 ){
for (CLogEvent::LogCondEle* c = b->list; c; c = c->next)
{
if (c->cmp->compareCondition(logArgs[b->argnum]) == 0)
{
valid = true;
break;
}
}
if (!valid) break;
if (!valid)
break;
}
#ifdef ENABLEEXEPTIONS
try
if (valid)
{
#endif
if (valid){
if ((err = amx_Exec(a->plugin->getAMX(), NULL , a->func , 0)) != AMX_ERR_NONE)
LogError(a->plugin->getAMX(), err, "");
}
#ifdef ENABLEEXEPTIONS
executeForwards(a->func);
}
catch( ... )
}
}
void LogEventsMngr::clearLogEvents()
{
logCurrent = logCounter = 0;
arelogevents = false;
for (int i = 0; i < MAX_LOGARGS + 1; ++i)
{
CLogEvent **a = &logevents[i];
while (*a)
{
AMXXLOG_Log( "[AMXX] fatal error at log forward function execution");
CLogEvent* bb = (*a)->next;
delete *a;
*a = bb;
}
#endif
}
}
clearConditions();
LogEventHandles.clear();
}
void LogEventsMngr::clearLogEvents(){
logCurrent = logCounter = 0;
arelogevents = false;
for(int i = 0; i < MAX_LOGARGS + 1; ++i){
CLogEvent **a = &logevents[i];
while(*a){
CLogEvent* bb = (*a)->next;
delete *a;
*a = bb;
}
}
clearConditions();
void LogEventsMngr::clearConditions()
{
while (logcmplist)
{
CLogCmp* a = logcmplist->next;
delete logcmplist;
logcmplist = a;
}
}
void LogEventsMngr::clearConditions() {
while (logcmplist){
CLogCmp* a = logcmplist->next;
delete logcmplist;
logcmplist = a;
}
}
LogEventsMngr::CLogEvent::LogCond::~LogCond() {
while( list ) {
LogEventsMngr::CLogEvent::LogCond::~LogCond()
{
while (list)
{
LogCondEle* cc = list->next;
delete list;
list = cc;
}
}
LogEventsMngr::CLogEvent::~CLogEvent() {
while( filters ) {
LogEventsMngr::CLogEvent::~CLogEvent()
{
while (filters)
{
LogCond* cc = filters->next;
delete filters;
filters = cc;
}
}
LogEventsMngr::CLogEvent *LogEventsMngr::getValidLogEvent( CLogEvent * a )
LogEventsMngr::CLogEvent *LogEventsMngr::getValidLogEvent(CLogEvent * a)
{
bool valid;
while(a){
while (a)
{
valid = true;
for( CLogEvent::LogCond* b = a->filters; b ; b = b->next){
for (CLogEvent::LogCond* b = a->filters; b; b = b->next)
{
valid = false;
for( CLogEvent::LogCondEle* c = b->list; c ; c = c->next) {
if ( c->cmp->compareCondition( logArgs[b->argnum] ) == 0 ){
for (CLogEvent::LogCondEle* c = b->list; c; c = c->next)
{
if (c->cmp->compareCondition(logArgs[b->argnum]) == 0)
{
valid = true;
break;
}
}
if (!valid) break;
}
if (!valid){
if (!valid)
{
a = a->next;
continue;
}
return a;
}
return 0;
}

View File

@ -1,33 +1,11 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef LOGEVENTS_H
#define LOGEVENTS_H
@ -35,131 +13,156 @@
#define MAX_LOGARGS 12
#include <stdarg.h>
#include "natives_handles.h"
// *****************************************************
// class LogEventsMngr
// *****************************************************
class LogEventsMngr {
char logString[256];
char logArgs[MAX_LOGARGS][128];
int logArgc;
int logCounter;
int logCurrent;
bool arelogevents;
class LogEventsMngr
{
char logString[256];
char logArgs[MAX_LOGARGS][128];
int logArgc;
int logCounter;
int logCurrent;
bool arelogevents;
public:
class CLogCmp;
class iterator;
class CLogEvent;
friend class CLogEvent;
friend class CLogCmp;
friend class iterator;
class CLogCmp
{
friend class LogEventsMngr;
class CLogCmp;
class iterator;
class CLogEvent;
friend class CLogEvent;
LogEventsMngr* parent;
String text;
int logid;
int pos;
int result;
bool in;
CLogCmp *next;
CLogCmp( const char* s, bool r, int p, CLogCmp *n, LogEventsMngr* mg ) : text(s) {
logid = result = 0;
pos = p;
parent = mg;
in = r;
next = n;
}
public:
int compareCondition(const char* string);
};
private:
CLogCmp *logcmplist;
public:
class CLogEvent {
friend class LogEventsMngr;
friend class CLogCmp;
friend class iterator;
struct LogCondEle {
CLogCmp *cmp;
LogCondEle *next;
LogCondEle(CLogCmp *c, LogCondEle *n): cmp(c) , next(n) { }
class CLogCmp
{
friend class LogEventsMngr;
friend class CLogEvent;
LogEventsMngr* parent;
ke::AString text;
int logid;
int pos;
int result;
bool in;
CLogCmp *next;
CLogCmp(const char* s, bool r, int p, CLogCmp *n, LogEventsMngr* mg) : text(s)
{
logid = result = 0;
pos = p;
parent = mg;
in = r;
next = n;
}
public:
int compareCondition(const char* string);
};
struct LogCond {
int argnum;
LogCondEle *list;
LogCond *next;
LogCond( int a , LogCondEle* ee , LogCond* n ) : argnum(a) , list(ee), next(n) {}
~LogCond();
};
CPluginMngr::CPlugin *plugin;
int func;
LogCond *filters;
LogEventsMngr* parent;
CLogEvent *next;
CLogEvent(CPluginMngr::CPlugin *p,int f, LogEventsMngr* ppp) : plugin(p),func(f), filters(0),parent(ppp) ,next(0) { }
~CLogEvent();
public:
inline CPluginMngr::CPlugin *getPlugin() { return plugin; }
void registerFilter( char* filter );
inline int getFunction() { return func; }
};
private:
CLogEvent *logevents[MAX_LOGARGS+1];
CLogEvent *getValidLogEvent( CLogEvent * a );
CLogCmp* registerCondition(char* filter);
void clearConditions();
CLogCmp *logcmplist;
public:
LogEventsMngr();
~LogEventsMngr();
class CLogEvent
{
friend class LogEventsMngr;
friend class iterator;
struct LogCondEle
{
CLogCmp *cmp;
LogCondEle *next;
LogCondEle(CLogCmp *c, LogCondEle *n): cmp(c), next(n) {}
};
struct LogCond
{
int argnum;
LogCondEle *list;
LogCond *next;
LogCond(int a, LogCondEle* ee, LogCond* n) : argnum(a), list(ee), next(n) {}
~LogCond();
};
CPluginMngr::CPlugin *plugin;
int func;
LogCond *filters;
LogEventsMngr* parent;
ForwardState m_State;
CLogEvent *next;
CLogEvent(CPluginMngr::CPlugin *p, int f, LogEventsMngr* ppp) : plugin(p), func(f), filters(nullptr), parent(ppp), m_State(FSTATE_ACTIVE), next(nullptr) {}
~CLogEvent();
public:
inline CPluginMngr::CPlugin *getPlugin() { return plugin; }
void registerFilter(char* filter);
void setForwardState(ForwardState value);
inline int getFunction() { return func; }
};
private:
CLogEvent *logevents[MAX_LOGARGS + 1];
CLogEvent *getValidLogEvent(CLogEvent * a);
CLogCmp* registerCondition(char* filter);
void clearConditions();
public:
LogEventsMngr();
~LogEventsMngr();
// Interface
int registerLogEvent(CPluginMngr::CPlugin* plugin, int func, int pos);
inline bool logEventsExist() { return arelogevents; }
void setLogString(const char* frmt, va_list& vaptr);
void setLogString(const char* frmt, ...);
void parseLogString();
void executeLogEvents();
inline const char* getLogString() { return logString; }
inline int getLogArgNum() { return logArgc; }
inline const char* getLogArg(int i) { return (i < 0 || i >= logArgc) ? "" : logArgs[i]; }
void clearLogEvents();
class iterator
{
CLogEvent* a;
LogEventsMngr* b;
public:
inline iterator(CLogEvent*aa, LogEventsMngr* bb) : a(aa), b(bb) {}
inline iterator& operator++()
{
a = b->getValidLogEvent(a->next);
return *this;
}
CLogEvent* registerLogEvent( CPluginMngr::CPlugin* plugin, int func, int pos );
inline bool logEventsExist() { return arelogevents; }
void setLogString( char* frmt, va_list& vaptr );
void setLogString( char* frmt , ... );
void parseLogString( );
void executeLogEvents();
inline const char* getLogString() { return logString; }
inline int getLogArgNum() { return logArgc; }
inline const char* getLogArg( int i ) { return ( i < 0 || i >= logArgc ) ? "" : logArgs[ i ]; }
void clearLogEvents();
class iterator {
CLogEvent* a;
LogEventsMngr* b;
public:
inline iterator(CLogEvent*aa,LogEventsMngr* bb) : a(aa), b(bb) {}
inline iterator& operator++() {
a = b->getValidLogEvent( a->next );
return *this;
}
inline bool operator==(const iterator& c) const { return a == c.a; }
inline bool operator!=(const iterator& c) const { return !operator==(c); }
CLogEvent& operator*() { return *a; }
operator bool ( ) const { return a ? true : false; }
};
inline iterator begin() { return iterator(getValidLogEvent(logevents[ logArgc ]),this); }
inline iterator end() { return iterator(0,this); }
inline bool operator==(const iterator& c) const { return a == c.a; }
inline bool operator!=(const iterator& c) const { return !operator == (c); }
CLogEvent& operator*() { return *a; }
operator bool () const { return a ? true : false; }
};
inline iterator begin() { return iterator(getValidLogEvent(logevents[logArgc]), this); }
inline iterator end() { return iterator(0, this); }
};
#endif
struct LogEventHook
{
explicit LogEventHook(LogEventsMngr::CLogEvent *logevent) : m_logevent(logevent) {}
LogEventsMngr::CLogEvent *m_logevent;
};
extern NativeHandle<LogEventHook> LogEventHandles;
#endif //LOGEVENTS_H

View File

@ -1,33 +1,11 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "CMenu.h"
@ -35,60 +13,101 @@
// *****************************************************
// class MenuMngr
// *****************************************************
MenuMngr::MenuCommand::MenuCommand( CPluginMngr::CPlugin *a, int mi, int k, int f ) {
MenuMngr::MenuCommand::MenuCommand(CPluginMngr::CPlugin *a, int mi, int k, int f, bool new_menu)
{
plugin = a;
keys = k;
menuid = mi;
function = f;
next = 0;
is_new_menu = new_menu;
function = f;
}
MenuMngr::~MenuMngr()
{
clear();
MenuMngr::MenuIdEle::uniqueid = 0;
}
int MenuMngr::findMenuId(const char* name, AMX* amx)
{
for( MenuIdEle* b = headid; b ; b = b->next) {
if ( (!b->amx || amx == b->amx) && strstr(name,b->name.c_str()) )
return b->id;
}
return 0;
for (MenuIdEle* b = headid; b; b = b->next)
{
if ((!amx || !b->amx || amx == b->amx) && strstr(name,b->name.chars()))
return b->id;
}
return 0;
}
int MenuMngr::registerMenuId(const char* n, AMX* a )
int MenuMngr::registerMenuId(const char* n, AMX* a)
{
int id = findMenuId( n, a );
if (id) return id;
headid = new MenuIdEle( n, a , headid );
if (!headid)
return 0; // :TODO: Better error report
return headid->id;
int id = findMenuId(n, a);
if (id)
{
return id;
}
headid = new MenuIdEle(n, a, headid);
return headid->id;
}
void MenuMngr::registerMenuCmd( CPluginMngr::CPlugin *a,int mi, int k , int f )
void MenuMngr::registerMenuCmd(CPluginMngr::CPlugin *a, int mi, int k, int f, bool from_new_menu)
{
MenuCommand** temp = &headcmd;
while(*temp) temp = &(*temp)->next;
*temp = new MenuCommand(a,mi, k,f);
MenuCommand **temp = &headcmd;
if (from_new_menu)
{
MenuCommand *ptr;
while (*temp)
{
ptr = *temp;
if (ptr->is_new_menu
&& ptr->plugin == a
&& ptr->menuid == mi)
{
if (g_forwards.isSameSPForward(ptr->function, f))
{
return;
}
}
temp = &(*temp)->next;
}
} else {
while (*temp)
{
temp = &(*temp)->next;
}
}
*temp = new MenuCommand(a, mi, k, f, from_new_menu);
}
void MenuMngr::clear()
void MenuMngr::clear()
{
while (headid)
{
MenuIdEle* a = headid->next;
delete headid;
headid = a;
}
while (headid)
{
MenuIdEle* a = headid->next;
delete headid;
headid = a;
}
while (headcmd)
{
MenuCommand* a = headcmd->next;
delete headcmd;
headcmd = a;
}
while (headcmd)
{
MenuCommand* a = headcmd->next;
delete headcmd;
headcmd = a;
}
}
int MenuMngr::MenuIdEle::uniqueid = 0;
MenuMngr::iterator MenuMngr::SetWatchIter(MenuMngr::iterator iter)
{
MenuMngr::iterator old = m_watch_iter;
m_watch_iter = iter;
return old;
}
int MenuMngr::MenuIdEle::uniqueid = 0;

View File

@ -1,33 +1,11 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef MENUS_H
#define MENUS_H
@ -38,55 +16,62 @@
class MenuMngr
{
struct MenuIdEle
{
String name;
AMX* amx;
MenuIdEle* next;
int id;
static int uniqueid;
MenuIdEle( const char* n, AMX* a, MenuIdEle* m ) : name( n ) , amx(a) , next( m ) {
id = ++uniqueid;
}
~MenuIdEle() { --uniqueid; }
} *headid;
struct MenuIdEle
{
ke::AString name;
AMX* amx;
MenuIdEle* next;
int id;
static int uniqueid;
MenuIdEle(const char* n, AMX* a, MenuIdEle* m) : name(n), amx(a), next(m)
{
id = ++uniqueid;
}
} *headid;
public:
class iterator;
class iterator;
private:
class MenuCommand
{
friend class iterator;
friend class MenuMngr;
CPluginMngr::CPlugin *plugin;
int menuid;
int keys;
int function;
MenuCommand* next;
MenuCommand( CPluginMngr::CPlugin *a, int mi, int k, int f );
public:
inline int getFunction() { return function; }
inline CPluginMngr::CPlugin* getPlugin() { return plugin; }
inline bool matchCommand( int m, int k ) { return ((m == menuid) && (keys & k)); }
} *headcmd;
class MenuCommand
{
friend class iterator;
friend class MenuMngr;
CPluginMngr::CPlugin *plugin;
int menuid;
int keys;
int function;
int is_new_menu;
MenuCommand* next;
MenuCommand(CPluginMngr::CPlugin *a, int mi, int k, int f, bool new_menu=false);
public:
inline int getFunction() { return function; }
inline CPluginMngr::CPlugin* getPlugin() { return plugin; }
inline bool matchCommand(int m, int k)
{
return ((m == menuid) && (keys & k));
}
} *headcmd;
public:
MenuMngr() { headid = 0; headcmd = 0; }
MenuMngr() : m_watch_iter(end())
{ headid = NULL; headcmd = NULL; }
~MenuMngr();
// Interface
int findMenuId(const char* name, AMX* a = 0);
int registerMenuId(const char* n, AMX* a );
void registerMenuCmd( CPluginMngr::CPlugin *a,int mi, int k , int f );
int registerMenuId(const char* n, AMX* a);
void registerMenuCmd(CPluginMngr::CPlugin *a, int mi, int k, int f, bool from_new_menu=false);
void clear();
class iterator {
class iterator
{
friend class MenuMngr;
MenuCommand* a;
public:
iterator(MenuCommand*aa) : a(aa) {}
@ -96,12 +81,16 @@ public:
operator bool () const { return a ? true : false; }
MenuCommand& operator*() { return *a; }
};
inline iterator begin() const { return iterator(headcmd); }
inline iterator end() const { return iterator(0); }
MenuMngr::iterator SetWatchIter(MenuMngr::iterator iter);
inline MenuMngr::iterator GetWatchIter() { return m_watch_iter; }
private:
MenuMngr::iterator m_watch_iter;
};
#endif
extern MenuMngr g_menucmds;
#endif //MENUS_H

View File

@ -1,46 +1,27 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "newmenus.h"
// *****************************************************
// class CPlayer
// *****************************************************
void CPlayer::Init( edict_t* e , int i )
void CPlayer::Init(edict_t* e, int i)
{
index = i;
pEdict = e;
initialized = false;
ingame = false;
bot = false;
authorized = false;
disconnecting = false;
teamIdsInitialized = false;
current = 0;
teamId = -1;
@ -48,185 +29,265 @@ void CPlayer::Init( edict_t* e , int i )
aiming = 0;
menu = 0;
keys = 0;
menuexpire = 0.0;
newmenu = -1;
death_weapon = nullptr;
name = nullptr;
ip = nullptr;
team = nullptr;
}
void CPlayer::Disconnect()
{
ingame = false;
initialized = false;
authorized = false;
disconnecting = false;
teamIdsInitialized = false;
if (Menu *pMenu = get_menu_by_id(newmenu))
pMenu->Close(index);
List<ClientCvarQuery_Info *>::iterator iter, end=queries.end();
for (iter=queries.begin(); iter!=end; iter++)
{
unregisterSPForward((*iter)->resultFwd);
delete [] (*iter)->params;
delete (*iter);
}
queries.clear();
menu = 0;
newmenu = -1;
}
void CPlayer::PutInServer()
{
playtime = gpGlobals->time;
ingame = true;
}
int CPlayer::NextHUDChannel()
{
int ilow = 1;
for (int i=ilow+1; i<=4; i++)
{
if (channels[i] < channels[ilow])
ilow = i;
}
return ilow;
}
bool CPlayer::Connect(const char* connectname, const char* ipaddress)
{
name = connectname;
ip = ipaddress;
time = gpGlobals->time;
death_killer = 0;
menu = 0;
newmenu = -1;
death_weapon.clear();
name.clear();
ip.clear();
team.clear();
memset(flags, 0, sizeof(flags));
memset(weapons, 0, sizeof(weapons));
initialized = true;
authorized = false;
for (int i=0; i<=4; i++)
{
channels[i] = 0.0f;
hudmap[i] = 0;
}
List<ClientCvarQuery_Info *>::iterator iter, end=queries.end();
for (iter=queries.begin(); iter!=end; iter++)
{
unregisterSPForward((*iter)->resultFwd);
delete [] (*iter)->params;
delete (*iter);
}
queries.clear();
const char* authid = GETPLAYERAUTHID(pEdict);
if ((authid == 0) || (*authid == 0) || (strcmp(authid, "STEAM_ID_PENDING") == 0))
return true;
return false;
}
void CPlayer::Disconnect() {
ingame = false;
initialized = false;
authorized = false;
bot = 0;
}
void CPlayer::PutInServer() {
playtime = gpGlobals->time;
ingame = true;
}
bool CPlayer::Connect(const char* connectname,const char* ipaddress) {
name.assign(connectname);
ip.assign(ipaddress);
time = gpGlobals->time;
bot = IsBot();
death_killer = 0;
memset(flags,0,sizeof(flags));
memset(weapons,0,sizeof(weapons));
initialized = true;
authorized = false;
const char* authid = GETPLAYERAUTHID( pEdict );
if ( (authid == 0) || (*authid == 0)
|| (strcmp( authid , "STEAM_ID_PENDING") == 0) )
return true;
return false;
}
// *****************************************************
// class Grenades
// *****************************************************
void Grenades::put( edict_t* grenade, float time, int type, CPlayer* player )
void Grenades::put(edict_t* grenade, float time, int type, CPlayer* player)
{
Obj* a = new Obj;
if ( a == 0 ) return;
a->player = player;
a->grenade = grenade;
a->time = gpGlobals->time + time;
a->type = type;
a->next = head;
head = a;
Obj* a = new Obj;
if (a == 0) return;
a->player = player;
a->grenade = grenade;
a->time = gpGlobals->time + time;
a->type = type;
a->next = head;
head = a;
}
bool Grenades::find( edict_t* enemy, CPlayer** p, int& type )
bool Grenades::find(edict_t* enemy, CPlayer** p, int& type)
{
bool found = false;
Obj** a = &head;
while ( *a ){
if ( (*a)->time > gpGlobals->time ) {
if ( (*a)->grenade == enemy ) {
found = true;
(*p) = (*a)->player;
type = (*a)->type;
}
}
else {
Obj* b = (*a)->next;
delete *a;
*a = b;
continue;
}
a = &(*a)->next;
}
return found;
bool found = false;
Obj** a = &head;
while (*a)
{
if ((*a)->time > gpGlobals->time)
{
if ((*a)->grenade == enemy)
{
found = true;
(*p) = (*a)->player;
type = (*a)->type;
}
} else {
Obj* b = (*a)->next;
delete *a;
*a = b;
continue;
}
a = &(*a)->next;
}
return found;
}
void Grenades::clear()
{
while(head){
Obj* a = head->next;
delete head;
head = a;
}
while (head)
{
Obj* a = head->next;
delete head;
head = a;
}
}
// *****************************************************
// class XVars
// *****************************************************
void XVars::clear() {
void XVars::clear()
{
delete[] head;
head = 0;
num = 0;
size = 0;
}
int XVars::put( AMX* p, cell* v )
int XVars::put(AMX* p, cell* v)
{
for(int a = 0; a < num; ++a) {
if ( (head[a].amx == p) && (head[a].value == v) )
return a;
}
for (int a = 0; a < num; ++a)
{
if ((head[a].amx == p) && (head[a].value == v))
return a;
}
if ( (num >= size) && realloc_array( size ? (size * 2) : 8 ) )
return -1;
if ((num >= size) && realloc_array(size ? (size * 2) : 8))
return -1;
head[num].value = v;
head[num].amx = p;
return num++;
head[num].value = v;
head[num].amx = p;
return num++;
}
int XVars::realloc_array( int nsize )
int XVars::realloc_array(int nsize)
{
XVarEle* me = new XVarEle[nsize];
if ( me ){
for(int a = 0 ; a < num; ++a)
if (me)
{
for (int a = 0 ; a < num; ++a)
me[a] = head[a];
delete[] head;
head = me;
size = nsize;
return 0;
}
return 1;
}
// *****************************************************
// class TeamIds
// *****************************************************
TeamIds::TeamIds() { head = 0; newTeam = 0; }
TeamIds::~TeamIds() {
while( head ) {
TeamIds::~TeamIds()
{
while (head)
{
TeamEle* a = head->next;
delete head;
head = a;
}
}
}
void TeamIds::registerTeam( const char* n ,int s )
void TeamIds::registerTeam(const char* n, int s)
{
TeamEle** a = &head;
while( *a ){
if ( strcmp((*a)->name.c_str(),n) == 0 ){
if (s != -1){
TeamEle** a = &head;
while (*a)
{
if (strcmp((*a)->name.chars(),n) == 0)
{
if (s != -1)
{
(*a)->id = s;
newTeam &= ~(1<<(*a)->tid);
}
return;
}
a = &(*a)->next;
}
*a = new TeamEle( n , s );
if ( *a == 0 ) return;
newTeam |= (1<<(*a)->tid);
}
*a = new TeamEle(n, s);
if (*a == 0)
return;
newTeam |= (1<<(*a)->tid);
}
int TeamIds::findTeamId( const char* n )
int TeamIds::findTeamId(const char* n)
{
TeamEle* a = head;
while( a ){
if ( !strcmpi(a->name.c_str(),n) )
while (a)
{
if (!stricmp(a->name.chars(), n))
return a->id;
a = a->next;
}
}
return -1;
}
int TeamIds::findTeamIdCase( const char* n)
int TeamIds::findTeamIdCase(const char* n)
{
TeamEle* a = head;
while( a ){
if ( !strcmp(a->name.c_str(), n) )
while (a)
{
if (!strcmp(a->name.chars(), n))
return a->id;
a = a->next;
}
}
return -1;
}
char TeamIds::TeamEle::uid = 0;

View File

@ -1,86 +1,51 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef CMISC_H
#define CMISC_H
#include "CList.h"
// *****************************************************
// class CCVar
// *****************************************************
class CCVar
{
cvar_t cvar;
String name;
String plugin;
public:
CCVar( const char* pname, const char* pplugin,
int pflags, float pvalue ) : name(pname) , plugin(pplugin ) {
cvar.name = (char*)name.c_str();
cvar.flags = pflags;
cvar.string = "";
cvar.value = pvalue;
}
inline cvar_t* getCvar() { return &cvar; }
inline const char* getPluginName() { return plugin.c_str(); }
inline const char* getName() { return name.c_str(); }
inline bool operator == ( const char* string ) { return (strcmp(name.c_str(),string)==0); }
};
#include "sh_list.h"
// *****************************************************
// class CPlayer
// *****************************************************
struct ClientCvarQuery_Info
{
int resultFwd;
int requestId;
int paramLen;
cell *params;
};
class CPlayer
{
public:
edict_t* pEdict;
String name;
String ip;
String team;
ke::AString name;
ke::AString ip;
ke::AString team;
bool initialized;
bool ingame;
bool bot;
bool authorized;
bool disconnecting;
bool vgui;
bool teamIdsInitialized;
float time;
float playtime;
float menuexpire;
struct {
struct
{
int ammo;
int clip;
} weapons[MAX_WEAPONS];
@ -98,27 +63,39 @@ public:
int death_killer;
int death_victim;
bool death_tk;
String death_weapon;
ke::AString death_weapon;
int newmenu;
int page;
float channels[5];
cell hudmap[5];
Vector lastTrace;
Vector thisTrace;
Vector lastHit;
void Init( edict_t* e , int i );
List<ClientCvarQuery_Info *> queries;
void Init(edict_t* e, int i);
void Disconnect();
void PutInServer();
bool Connect(const char* connectname,const char* ipaddress);
bool Connect(const char* connectname, const char* ipaddress);
inline bool IsBot(){
return ((pEdict->v.flags & FL_FAKECLIENT)?true:false);
inline bool IsBot()
{
const char *auth = GETPLAYERAUTHID(pEdict);
return auth && !strcmp(auth, "BOT");
}
inline bool IsAlive(){
return ((pEdict->v.deadflag==DEAD_NO)&&(pEdict->v.health>0));
inline bool IsAlive()
{
return ((pEdict->v.deadflag == DEAD_NO) && (pEdict->v.health > 0));
}
inline void Authorize() { authorized = true; }
int NextHUDChannel();
};
// *****************************************************
@ -127,40 +104,44 @@ public:
class Grenades
{
struct Obj
{
CPlayer* player;
edict_t* grenade;
float time;
int type;
Obj* next;
} *head;
struct Obj
{
CPlayer* player;
edict_t* grenade;
float time;
int type;
Obj* next;
} *head;
public:
Grenades() { head = 0; }
~Grenades() { clear(); }
void put( edict_t* grenade, float time, int type, CPlayer* player );
bool find( edict_t* enemy, CPlayer** p, int& type );
void clear();
Grenades() { head = 0; }
~Grenades() { clear(); }
void put(edict_t* grenade, float time, int type, CPlayer* player);
bool find(edict_t* enemy, CPlayer** p, int& type);
void clear();
};
// *****************************************************
// class ForceObject
// *****************************************************
class ForceObject {
String filename;
FORCE_TYPE type;
Vector mins;
Vector maxs;
AMX* amx;
class ForceObject
{
ke::AString filename;
FORCE_TYPE type;
Vector mins;
Vector maxs;
AMX* amx;
public:
ForceObject(const char* n, FORCE_TYPE c,Vector& mi, Vector& ma, AMX* a) :
filename(n) , type(c), mins(mi), maxs(ma), amx(a) {}
inline const char* getFilename() { return filename.c_str(); }
ForceObject(const char* n, FORCE_TYPE c, Vector& mi, Vector& ma, AMX* a) : filename(n), type(c), mins(mi), maxs(ma), amx(a) {}
inline const char* getFilename() { return filename.chars(); }
inline AMX* getAMX() { return amx; }
Vector& getMin() { return mins; }
Vector& getMax() { return maxs; }
inline FORCE_TYPE getForceType() { return type; }
};
@ -170,81 +151,174 @@ public:
class XVars
{
struct XVarEle {
AMX* amx;
cell* value;
};
XVarEle* head;
int size;
int num;
struct XVarEle
{
AMX* amx;
cell* value;
};
int realloc_array( int nsize );
XVarEle* head;
int size;
int num;
int realloc_array(int nsize);
public:
XVars() { num = 0; size = 0; head = 0; }
~XVars() { clear(); }
void clear();
int put( AMX* a, cell* v );
inline cell getValue( int a ) {
return ( a >= 0 && a < num ) ? *(head[a].value) : 0;
}
inline int setValue( int a, cell v ) {
if ( a >= 0 && a < num ){
*(head[a].value) = v;
return 0;
}
return 1;
}
XVars() { num = 0; size = 0; head = 0; }
~XVars() { clear(); }
void clear();
int put(AMX* a, cell* v);
inline cell getValue(int a)
{
return (a >= 0 && a < num) ? *(head[a].value) : 0;
}
inline int setValue(int a, cell v)
{
if (a >= 0 && a < num)
{
*(head[a].value) = v;
return 0;
}
return 1;
}
};
// *****************************************************
// class CScript
// *****************************************************
class CScript
class CScript : public ke::InlineListNode<CScript>
{
String filename;
ke::AString filename;
AMX* amx;
void* code;
public:
CScript(AMX* aa, void* cc,const char* ff):filename(ff),amx(aa),code(cc){}
CScript(AMX* aa, void* cc, const char* ff) : filename(ff), amx(aa), code(cc) {}
inline AMX* getAMX() { return amx; }
inline const char* getName() { return filename.c_str(); }
inline bool operator==( void* a ) { return (amx == (AMX*)a); }
inline const char* getName() { return filename.chars(); }
inline void* getCode() { return code; }
};
// *****************************************************
// class TeamIds
// *****************************************************
class TeamIds
{
struct TeamEle {
String name;
int id;
char tid;
static char uid;
TeamEle* next;
TeamEle(const char* n, int& i) : name(n) , id(i) , next(0) {
tid = uid++;
};
~TeamEle(){ --uid; }
} *head;
struct TeamEle
{
ke::AString name;
int id;
char tid;
static char uid;
TeamEle* next;
TeamEle(const char* n, int& i) : name(n), id(i), next(0)
{
tid = uid++;
}
~TeamEle() { --uid; }
} *head;
int newTeam;
int newTeam;
public:
TeamIds();
~TeamIds();
void registerTeam( const char* n ,int s );
int findTeamId( const char* n);
int findTeamIdCase( const char* n);
inline bool isNewTeam() { return newTeam ? true : false; }
TeamIds();
~TeamIds();
void registerTeam(const char* n, int s);
int findTeamId(const char* n);
int findTeamIdCase(const char* n);
inline bool isNewTeam() { return newTeam ? true : false; }
};
class CAdminData
{
private:
cell m_AuthData[44];
cell m_Password[32];
cell m_Flags;
cell m_Access;
public:
CAdminData()
{
m_AuthData[0]=0;
m_Password[0]=0;
m_Flags=0;
m_Access=0;
};
#endif
void SetAccess(cell Access)
{
m_Access=Access;
};
cell GetAccess(void) const
{
return m_Access;
};
void SetFlags(cell Flags)
{
m_Flags=Flags;
};
cell GetFlags(void) const
{
return m_Flags;
};
void SetAuthID(const cell *Input)
{
unsigned int i=0;
while (i<sizeof(m_AuthData)-1)
{
if ((m_AuthData[i++]=*Input++)==0)
{
return;
}
}
m_AuthData[arraysize(m_AuthData)-1]=0;
};
const cell *GetAuthID(void) const
{
return &m_AuthData[0];
};
void SetPass(const cell *Input)
{
unsigned int i=0;
while (i<sizeof(m_Password)-1)
{
if ((m_Password[i++]=*Input++)==0)
{
return;
}
}
m_Password[arraysize(m_Password)-1]=0;
};
const cell *GetPass(void) const
{
return &m_Password[0];
};
CAdminData & operator = (const CAdminData &src)
{
this->SetAccess(src.GetAccess());
this->SetFlags(src.GetFlags());
this->SetAuthID(src.GetAuthID());
this->SetPass(src.GetPass());
return *this;
}
};
#endif //CMISC_H

View File

@ -1,126 +1,28 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "libraries.h"
#ifndef FAR
#define FAR
#define FAR
#endif
// Old
typedef int (FAR *QUERYMOD)(module_info_s**);
typedef int (FAR *ATTACHMOD)(pfnamx_engine_g*,pfnmodule_engine_g*);
typedef int (FAR *DETACHMOD)(void);
// New
typedef void* (*PFN_REQ_FNPTR)(const char * /*name*/);
typedef int (FAR *QUERYMOD_NEW)(int * /*ifvers*/, amxx_module_info_s * /*modInfo*/);
typedef int (FAR *CHECKGAME_NEW)(const char *);
typedef int (FAR *ATTACHMOD_NEW)(PFN_REQ_FNPTR /*reqFnptrFunc*/);
typedef int (FAR *DETACHMOD_NEW)(void);
typedef void (FAR *PLUGINSLOADED_NEW)(void);
// Old
// These functions are needed since Small Abstract Machine 2.5.0
int wamx_FindPublic(AMX *amx, char *name, int *index)
{ return amx_FindPublic(amx, name, index); }
int wamx_FindPubVar(AMX *amx, char *varname, cell *amx_addr)
{ return amx_FindPubVar(amx, varname, amx_addr); }
int wamx_GetString(char *dest, cell *source)
{ return amx_GetString(dest, source, 0); }
AMX_NATIVE_INFO *wamx_NativeInfo(char *name, AMX_NATIVE func)
{ return amx_NativeInfo(name, func); }
int wamx_SetString(cell *dest, char *source, int pack)
{ return amx_SetString(dest, source, pack, 0); }
pfnamx_engine_g engAmxFunc = {
amx_Align16,
amx_Align32,
amx_Allot,
amx_Callback,
amx_Clone,
amx_Debug,
amx_Exec,
amx_Execv,
wamx_FindPublic,
wamx_FindPubVar,
amx_FindTagId,
amx_Flags,
amx_GetAddr,
amx_GetPublic,
amx_GetPubVar,
wamx_GetString,
amx_GetTag,
amx_GetUserData,
amx_Init,
amx_InitJIT,
amx_MemInfo,
amx_NameLength,
wamx_NativeInfo,
amx_NumPublics,
amx_NumPubVars,
amx_NumTags,
amx_RaiseError,
amx_Register,
amx_Release,
amx_SetCallback,
amx_SetDebugHook,
wamx_SetString,
amx_SetUserData,
amx_StrLen,
};
pfnmodule_engine_g engModuleFunc = {
add_amxnatives,
build_pathname,
copy_amxmemory,
format_amxstring,
get_amxaddr,
get_amxscript,
get_amxscriptname,
get_amxstring,
get_modname,
load_amxscript,
print_srvconsole,
report_error,
set_amxnatives,
set_amxstring,
amxstring_len,
unload_amxscript,
alloc_amxmemory,
free_amxmemory,
};
typedef void (*PLUGINSUNLOADED_NEW)(void);
typedef void (*PLUGINSUNLOADING_NEW)(void);
// *****************************************************
// class CModule
@ -128,14 +30,14 @@ pfnmodule_engine_g engModuleFunc = {
CModule::CModule(const char* fname)
{
m_Filename.assign(fname);
m_Filename = fname;
clear(false);
}
CModule::~CModule()
{
// old & new
if ( m_Handle )
if (m_Handle)
DLFREE(m_Handle);
clear();
@ -147,20 +49,94 @@ void CModule::clear(bool clearFilename)
m_Metamod = false;
m_Handle = NULL;
m_Status = MODULE_NONE;
if (clearFilename)
m_Filename.assign("unknown");
// old
m_InfoOld = NULL;
if (clearFilename)
{
m_Filename = "unknown";
}
// new
m_Amxx = false;
m_InfoNew.author = "unknown";
m_InfoNew.name = "unknown";
m_InfoNew.version = "unknown";
m_InfoNew.reload = 0;
m_MissingFunc = NULL;
for (size_t i=0; i<m_DestroyableIndexes.length(); i++)
{
delete [] m_Natives[m_DestroyableIndexes[i]];
}
m_DestroyableIndexes.clear();
m_Natives.clear();
m_NewNatives.clear();
}
bool CModule::attachMetamod(const char *mmfile, PLUG_LOADTIME now)
{
void **handle;
void *dummy = NULL;
if (!m_Handle)
handle = &dummy;
else
handle = (void **)&m_Handle;
int res = LoadMetamodPlugin(mmfile, handle, now);
if (!res)
{
m_Metamod = false;
}
return true;
}
//this ugly function is ultimately something like O(n^4).
//sigh. it shouldn't be needed.
void CModule::rewriteNativeLists(AMX_NATIVE_INFO *list)
{
AMX_NATIVE_INFO *curlist;
for (size_t i=0; i<m_Natives.length(); i++)
{
curlist = m_Natives[i];
bool changed = false;
bool found = false;
ke::Vector<size_t> newlist;
for (size_t j=0; curlist[j].func != NULL; j++)
{
found = false;
for (size_t k=0; list[k].func != NULL; k++)
{
if (strcmp(curlist[j].name, list[k].name) == 0)
{
found = true;
break;
}
}
if (found)
{
changed = true;
//don't break, we have to search it all
} else {
newlist.append(j);
}
}
if (changed)
{
//now build the new list
AMX_NATIVE_INFO *rlist = new AMX_NATIVE_INFO[newlist.length()+1];
for (size_t j=0; j<newlist.length(); j++)
{
rlist[j].func = curlist[newlist[j]].func;
rlist[j].name = curlist[newlist[j]].name;
}
rlist[newlist.length()].func = NULL;
rlist[newlist.length()].name = NULL;
m_Natives[i] = rlist;
m_DestroyableIndexes.append(i);
}
}
}
bool CModule::attachModule()
@ -169,26 +145,24 @@ bool CModule::attachModule()
if (m_Status != MODULE_QUERY || !m_Handle)
return false;
if (m_Amxx)
ATTACHMOD_NEW AttachFunc_New = (ATTACHMOD_NEW)DLPROC(m_Handle, "AMXX_Attach");
if (!AttachFunc_New)
return false;
g_ModuleCallReason = ModuleCall_Attach;
g_CurrentlyCalledModule = this;
int retVal = (*AttachFunc_New)(Module_ReqFnptr);
g_CurrentlyCalledModule = NULL;
g_ModuleCallReason = ModuleCall_NotCalled;
switch (retVal)
{
// new
ATTACHMOD_NEW AttachFunc_New = (ATTACHMOD_NEW)DLPROC(m_Handle, "AMXX_Attach");
if (!AttachFunc_New)
return false;
g_ModuleCallReason = ModuleCall_Attach;
g_CurrentlyCalledModule = this;
int retVal = (*AttachFunc_New)(Module_ReqFnptr);
g_CurrentlyCalledModule = NULL;
g_ModuleCallReason = ModuleCall_NotCalled;
switch (retVal)
{
case AMXX_OK:
m_Status = MODULE_LOADED;
return true;
break;
case AMXX_PARAM:
AMXXLOG_Log("[AMXX] Internal Error: Module \"%s\" (version \"%s\") retured \"Invalid parameter\" from Attach func.", m_Filename.c_str(), getVersion());
AMXXLOG_Log("[AMXX] Internal Error: Module \"%s\" (version \"%s\") returned \"Invalid parameter\" from Attach func.", m_Filename.chars(), getVersion());
m_Status = MODULE_INTERROR;
return false;
case AMXX_FUNC_NOT_PRESENT:
@ -196,31 +170,32 @@ bool CModule::attachModule()
m_MissingFunc = g_LastRequestedFunc;
return false;
default:
AMXXLOG_Log("[AMXX] Module \"%s\" (version \"%s\") returned an invalid code.", m_Filename.c_str(), getVersion());
AMXXLOG_Log("[AMXX] Module \"%s\" (version \"%s\") returned an invalid code.", m_Filename.chars(), getVersion());
m_Status = MODULE_BADLOAD;
return false;
}
}
else
{
// old
ATTACHMOD AttachFunc = (ATTACHMOD)DLPROC(m_Handle, "AMX_Attach");
if (AttachFunc)
(*AttachFunc)(&engAmxFunc,&engModuleFunc);
m_Status = MODULE_LOADED;
if (m_Status == MODULE_LOADED)
{
AddLibrariesFromString(m_InfoNew.library, LibType_Library, LibSource_Module, this);
AddLibrariesFromString(m_InfoNew.libclass, LibType_Class, LibSource_Module, this);
return true;
}
return false;
}
bool CModule::queryModule()
{
if (m_Status != MODULE_NONE) // don't check if already queried
if (m_Status != MODULE_NONE) // don't check if already queried
return false;
m_Handle = DLLOAD(m_Filename.c_str()); // load file
m_Handle = DLLOAD(m_Filename.chars()); // load file
if (!m_Handle)
{
#if defined(__linux__) || defined(__APPLE__)
AMXXLOG_Log("[AMXX] Module \"%s\" failed to load (%s)", m_Filename.chars(), dlerror());
#endif
m_Status = MODULE_BADLOAD;
return false;
}
@ -231,33 +206,60 @@ bool CModule::queryModule()
// Try new interface first
QUERYMOD_NEW queryFunc_New = (QUERYMOD_NEW)DLPROC(m_Handle, "AMXX_Query");
if (queryFunc_New)
{
m_Amxx = true;
int ifVers = AMXX_INTERFACE_VERSION;
g_ModuleCallReason = ModuleCall_Query;
g_CurrentlyCalledModule = this;
int retVal = (*queryFunc_New)(&ifVers, &m_InfoNew);
g_CurrentlyCalledModule = NULL;
g_ModuleCallReason = ModuleCall_NotCalled;
switch (retVal)
{
case AMXX_PARAM:
AMXXLOG_Log("[AMXX] Internal Error: Module \"%s\" (version \"%s\") retured \"Invalid parameter\" from Attach func.", m_Filename.c_str(), getVersion());
m_Status = MODULE_INTERROR;
return false;
case AMXX_IFVERS:
if (ifVers < AMXX_INTERFACE_VERSION)
m_Status = MODULE_OLD;
else
m_Status = MODULE_NEWER;
return false;
case AMXX_OK:
break;
default:
AMXXLOG_Log("[AMXX] Module \"%s\" (version \"%s\") returned an invalid code.", m_Filename.c_str(), getVersion());
m_Status = MODULE_BADLOAD;
return false;
case AMXX_PARAM:
AMXXLOG_Log("[AMXX] Internal Error: Module \"%s\" (version \"%s\") returned \"Invalid parameter\" from Attach func.", m_Filename.chars(), getVersion());
m_Status = MODULE_INTERROR;
return false;
case AMXX_IFVERS:
if (ifVers < AMXX_INTERFACE_VERSION)
{
//backwards compat for new defs
if (ifVers == 3)
{
g_ModuleCallReason = ModuleCall_Query;
g_CurrentlyCalledModule = this;
retVal = (*queryFunc_New)(&ifVers, &m_InfoNew);
g_CurrentlyCalledModule = NULL;
g_ModuleCallReason = ModuleCall_NotCalled;
if (retVal == AMXX_OK)
{
m_InfoNew.library = m_InfoNew.logtag;
if (StrCaseStr(m_InfoNew.library, "sql")
|| StrCaseStr(m_InfoNew.library, "dbi"))
{
m_InfoNew.libclass = "DBI";
} else {
m_InfoNew.libclass = "";
}
break;
}
return false;
} else {
m_Status = MODULE_OLD;
return false;
}
} else {
m_Status = MODULE_NEWER;
return false;
}
case AMXX_OK:
break;
default:
AMXXLOG_Log("[AMXX] Module \"%s\" (version \"%s\") returned an invalid code.", m_Filename.chars(), getVersion());
m_Status = MODULE_BADLOAD;
return false;
}
// Check for attach
@ -267,49 +269,38 @@ bool CModule::queryModule()
return false;
}
// Lastly, check to see if this module is able to load on this game mod
CHECKGAME_NEW checkGame_New = (CHECKGAME_NEW)DLPROC(m_Handle, "AMXX_CheckGame");
if (checkGame_New)
{
// This is an optional check; do not fail modules that do not have it
int ret = checkGame_New(g_mod_name.chars());
if (ret != AMXX_GAME_OK)
{
switch (ret)
{
case AMXX_GAME_BAD:
AMXXLOG_Log("[AMXX] Module \"%s\" (version \"%s\") reported that it cannot load on game \"%s\"", m_Filename.chars(), getVersion(), g_mod_name.chars());
m_Status = MODULE_BADGAME;
break;
default:
AMXXLOG_Log("[AMXX] Module \"%s\" (version \"%s\") returned an unknown CheckGame code (value: %d)", m_Filename.chars(), getVersion(), ret);
m_Status = MODULE_BADLOAD;
break;
}
return false;
}
}
m_Status = MODULE_QUERY;
return true;
}
else
{
// old interface not 64 bit compatible
#if SMALL_CELL_SIZE == 64
m_Status = MODULE_NOT64BIT;
} else {
m_Status = MODULE_NOQUERY;
return false;
#else
// Try old interface
QUERYMOD queryFunc_Old = (QUERYMOD)DLPROC(m_Handle,"AMX_Query"); // check what version
if (!queryFunc_Old)
{
m_Status = MODULE_NOQUERY;
return false;
}
(*queryFunc_Old)(&m_InfoOld);
if (!m_InfoOld)
{
m_Status = MODULE_NOINFO;
return false;
}
if (m_InfoOld->ivers != AMX_INTERFACE_VERSION)
{
m_Status = MODULE_OLD;
return false;
}
// Check for attach
if (!DLPROC(m_Handle, "AMX_Attach"))
{
m_Status = MODULE_NOATTACH;
return false;
}
m_InfoOld->serial = (long int)this;
m_Status = MODULE_QUERY;
return true;
#endif
}
}
@ -318,29 +309,62 @@ bool CModule::detachModule()
if (m_Status != MODULE_LOADED)
return false;
if (m_Amxx)
RemoveLibraries(this);
DETACHMOD_NEW detachFunc_New = (DETACHMOD_NEW)DLPROC(m_Handle, "AMXX_Detach");
if (detachFunc_New)
{
DETACHMOD_NEW detachFunc_New = (DETACHMOD_NEW)DLPROC(m_Handle, "AMXX_Detach");
if (detachFunc_New)
{
g_ModuleCallReason = ModuleCall_Detach;
g_CurrentlyCalledModule = this;
(*detachFunc_New)();
g_CurrentlyCalledModule = NULL;
g_ModuleCallReason = ModuleCall_NotCalled;
}
g_ModuleCallReason = ModuleCall_Detach;
g_CurrentlyCalledModule = this;
(*detachFunc_New)();
g_CurrentlyCalledModule = NULL;
g_ModuleCallReason = ModuleCall_NotCalled;
}
else
if (IsMetamod())
{
DETACHMOD detachFunc_Old = (DETACHMOD)DLPROC(m_Handle, "AMX_Detach");
if (detachFunc_Old)
(*detachFunc_Old)();
UnloadMetamodPlugin(m_Handle);
}
DLFREE(m_Handle);
clear();
return true;
}
void CModule::CallPluginsUnloaded()
{
if (m_Status != MODULE_LOADED)
return;
if (!m_Handle)
return;
PLUGINSUNLOADED_NEW func = (PLUGINSUNLOADED_NEW)DLPROC(m_Handle, "AMXX_PluginsUnloaded");
if (!func)
return;
func();
}
void CModule::CallPluginsUnloading()
{
if (m_Status != MODULE_LOADED)
return;
if (!m_Handle)
return;
PLUGINSUNLOADING_NEW func = (PLUGINSUNLOADING_NEW)DLPROC(m_Handle, "AMXX_PluginsUnloading");
if (!func)
return;
func();
}
void CModule::CallPluginsLoaded()
{
if (m_Status != MODULE_LOADED)
@ -350,28 +374,32 @@ void CModule::CallPluginsLoaded()
return;
PLUGINSLOADED_NEW func = (PLUGINSLOADED_NEW)DLPROC(m_Handle, "AMXX_PluginsLoaded");
if (!func)
return;
func();
}
const char* CModule::getStatus() const
{
switch(m_Status)
switch (m_Status)
{
case MODULE_NONE: return "error";
case MODULE_QUERY: return "pending";
case MODULE_BADLOAD: return "bad load";
case MODULE_LOADED: return "running";
case MODULE_NOINFO: return "no info";
case MODULE_NOQUERY: return "no query";
case MODULE_NOATTACH: return "no attach";
case MODULE_OLD: return "old";
case MODULE_FUNCNOTPRESENT:
case MODULE_NEWER: return "newer";
case MODULE_INTERROR: return "internal err";
case MODULE_NOT64BIT: return "not 64bit";
default: break;
case MODULE_NONE: return "error";
case MODULE_QUERY: return "pending";
case MODULE_BADLOAD: return "bad load";
case MODULE_LOADED: return "running";
case MODULE_NOINFO: return "no info";
case MODULE_NOQUERY: return "no query";
case MODULE_NOATTACH: return "no attach";
case MODULE_OLD: return "old";
case MODULE_FUNCNOTPRESENT:
case MODULE_NEWER: return "newer";
case MODULE_INTERROR: return "internal err";
case MODULE_NOT64BIT: return "not 64bit";
case MODULE_BADGAME: return "bad game";
default: break;
}
return "unknown";
}

View File

@ -1,33 +1,11 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
// *****************************************************
// class CModule
@ -36,19 +14,21 @@
#ifndef CMODULE_H
#define CMODULE_H
enum MODULE_STATUS {
MODULE_NONE, // No module loaded
MODULE_QUERY, // Query failed
MODULE_BADLOAD, // Bad file or the module writer messed something up ;]
MODULE_LOADED, // Loaded
MODULE_NOINFO, // No info
MODULE_NOQUERY, // No query function present
MODULE_NOATTACH, // No attach function present
MODULE_OLD, // Old interface
MODULE_NEWER, // newer interface
MODULE_INTERROR, // Internal error
MODULE_FUNCNOTPRESENT, // Function not present
MODULE_NOT64BIT // Not 64 bit compatible
enum MODULE_STATUS
{
MODULE_NONE, // No module loaded
MODULE_QUERY, // Query failed
MODULE_BADLOAD, // Bad file or the module writer messed something up ;]
MODULE_LOADED, // Loaded
MODULE_NOINFO, // No info
MODULE_NOQUERY, // No query function present
MODULE_NOATTACH, // No attach function present
MODULE_OLD, // Old interface
MODULE_NEWER, // newer interface
MODULE_INTERROR, // Internal error
MODULE_FUNCNOTPRESENT, // Function not present
MODULE_NOT64BIT, // Not 64 bit compatible
MODULE_BADGAME, // Module cannot load on the current game mod
};
struct amxx_module_info_s
@ -57,22 +37,27 @@ struct amxx_module_info_s
const char *author;
const char *version;
int reload; // reload on mapchange when nonzero
const char *logtag; //added in version 2
const char *library; // added in version 4
const char *libclass; // added in version 4
};
#define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */
#define AMXX_PARAM 2 /* Invalid parameter */
#define AMXX_FUNC_NOT_PRESENT 3 /* Function not present */
#define AMXX_INTERFACE_VERSION 1
#define AMXX_GAME_OK 0 /* Module can load on this game. */
#define AMXX_GAME_BAD 1 /* Module cannot load on this game. */
class CModule
#define AMXX_INTERFACE_VERSION 4
class CModule : public ke::InlineListNode<CModule>
{
String m_Filename; // Filename
ke::AString m_Filename; // Filename
bool m_Metamod; // Using metamod?
bool m_Amxx; // Using new module interface?
module_info_s* m_InfoOld; // module info (old module interface)
amxx_module_info_s m_InfoNew; // module info (new module interface)
DLHANDLE m_Handle; // handle
MODULE_STATUS m_Status; // status
@ -84,30 +69,33 @@ public:
~CModule();
// Interface
bool attachModule();
bool queryModule();
bool detachModule();
void rewriteNativeLists(AMX_NATIVE_INFO *list);
bool attachMetamod(const char *mmfile, PLUG_LOADTIME now);
const char* getStatus() const;
inline const char* getType() const { return m_Amxx ? "amxx" : (m_Metamod ? "amx&mm" : "amx"); }
inline const char* getAuthor() const { return m_Amxx ? (m_InfoNew.author) : (m_InfoOld ? m_InfoOld->author : "unknown"); }
inline const char* getVersion() const { return m_Amxx ? (m_InfoNew.version) : (m_InfoOld ? m_InfoOld->version : "unknown"); }
inline const char* getName() const { return m_Amxx ? (m_InfoNew.name) : (m_InfoOld ? m_InfoOld->name : "unknown"); }
inline module_info_s* getInfo() const { return m_InfoOld; } // old
inline const char* getType() const { return m_Metamod ? "amxx&mm" : "amxx"; }
inline const char* getAuthor() const { return m_InfoNew.author; }
inline const char* getVersion() const { return m_InfoNew.version; }
inline const char* getName() const { return m_InfoNew.name; }
inline const amxx_module_info_s* getInfoNew() const { return &m_InfoNew; } // new
inline int getStatusValue() { return m_Status; }
inline bool operator==( const char* fname ) { return !strcmp( m_Filename.c_str() , fname ); }
inline bool isReloadable() { return m_Amxx ? ((m_Status == MODULE_LOADED) && (m_InfoNew.reload != 0)) : ( (m_Status==MODULE_LOADED) && (m_InfoOld->type==RELOAD_MODULE)); }
inline bool isAmxx() const { return m_Amxx; }
inline bool isReloadable() { return ((m_Status == MODULE_LOADED) && (m_InfoNew.reload != 0)); }
inline const char *getMissingFunc() const { return m_MissingFunc; }
inline const char *getFilename() { return m_Filename.c_str(); }
void CModule::CallPluginsLoaded();
inline const char *getFilename() { return m_Filename.chars(); }
inline bool IsMetamod() { return m_Metamod; }
CList<AMX_NATIVE_INFO*> m_Natives;
void CallPluginsLoaded();
void CallPluginsUnloaded();
void CallPluginsUnloading();
ke::Vector<AMX_NATIVE_INFO*> m_Natives;
ke::Vector<AMX_NATIVE_INFO*> m_NewNatives; // Natives for new (AMXX, not AMX) plugins only
ke::Vector<size_t> m_DestroyableIndexes;
};
#endif
#endif //CMODULE_H

View File

@ -1,93 +1,200 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "CPlugin.h"
#include "CForward.h"
#include "CFile.h"
#include "amx.h"
#include "natives.h"
#include "debugger.h"
#include "libraries.h"
#include <amxmodx_version.h>
#include "engine_strucs.h"
CPluginMngr::CPlugin* CPluginMngr::loadPlugin(const char* path, const char* name, char* error, int debug) {
extern const char *no_function;
CPluginMngr::CPlugin* CPluginMngr::loadPlugin(const char* path, const char* name, char* error, size_t maxLength, int debug)
{
CPlugin** a = &head;
while( *a ) a = &(*a)->next;
*a = new CPlugin( pCounter++ ,path,name,error, debug);
while (*a)
a = &(*a)->next;
*a = new CPlugin(pCounter++, path, name, error, maxLength, debug);
return (*a);
}
void CPluginMngr::unloadPlugin( CPlugin** a ) {
void CPluginMngr::unloadPlugin(CPlugin** a)
{
CPlugin* next = (*a)->next;
delete *a;
*a = next;
--pCounter;
}
int CPluginMngr::loadPluginsFromFile( const char* filename )
void CPluginMngr::Finalize()
{
FILE *fp = fopen(build_pathname("%s",filename) , "rt");
if (m_Finalized)
return;
if ( !fp )
pNatives = BuildNativeTable();
CPlugin *a = head;
while (a)
{
AMXXLOG_Log( "[AMXX] Plugins list not found (file \"%s\")",filename);
if (a->getStatusCode() == ps_running)
{
amx_Register(a->getAMX(), pNatives, -1);
a->Finalize();
}
a = a->next;
}
m_Finalized = true;
}
int CPluginMngr::loadPluginsFromFile(const char* filename, bool warn)
{
char file[PLATFORM_MAX_PATH];
FILE *fp = fopen(build_pathname_r(file, sizeof(file), "%s", filename), "rt");
if (!fp)
{
if (warn)
{
AMXXLOG_Error("[AMXX] Plugins list not found (file \"%s\")", filename);
}
return 1;
}
// Find now folder
char pluginName[256], error[256], debug[256];
int debugFlag = 0;
const char *pluginsDir = get_localinfo("amxx_pluginsdir", "addons/amxmodx/plugins");
String line;
while ( !feof(fp) )
char line[512];
List<ke::AString *>::iterator block_iter;
while (!feof(fp))
{
*pluginName = 0;
*debug = 0;
debugFlag = 0;
line.clear();
line._fread(fp);
sscanf(line.c_str(),"%s %s",pluginName, debug);
if (!isalnum(*pluginName)) continue;
pluginName[0] = '\0';
if (isalnum(*debug) && strcmp(debug, "debug") == 0)
debug[0] = '\0';
debugFlag = 0;
line[0] = '\0';
fgets(line, sizeof(line), fp);
/** quick hack */
char *ptr = line;
while (*ptr)
{
if (*ptr == ';')
{
*ptr = '\0';
} else {
ptr++;
}
}
sscanf(line, "%s %s", pluginName, debug);
if (!isalnum(*pluginName))
{
continue;
}
if (isalnum(*debug) && !strcmp(debug, "debug"))
{
debugFlag = 1;
}
CPlugin* plugin = loadPlugin( pluginsDir , pluginName , error, debugFlag);
bool skip = false;
for (block_iter = m_BlockList.begin();
block_iter != m_BlockList.end();
block_iter++)
{
if ((*block_iter)->compare(pluginName) == 0)
{
skip = true;
break;
}
}
if (skip || !strcmp(debug, "disabled"))
{
continue;
}
if (findPlugin(pluginName) != NULL)
{
continue;
}
CPlugin* plugin = loadPlugin(pluginsDir, pluginName, error, sizeof(error), debugFlag);
if (plugin->getStatusCode() == ps_bad_load)
{
char errorMsg[255];
sprintf(errorMsg, "%s (plugin \"%s\")", error, pluginName);
plugin->setError(errorMsg);
AMXXLOG_Log("[AMXX] %s", plugin->getError());
AMXXLOG_Error("[AMXX] %s", plugin->getError());
}
else
{
cell addr;
if (amx_FindPubVar(plugin->getAMX(), "MaxClients", &addr) != AMX_ERR_NOTFOUND)
{
*get_amxaddr(plugin->getAMX(), addr) = gpGlobals->maxClients;
}
if (amx_FindPubVar(plugin->getAMX(), "MapName", &addr) != AMX_ERR_NOTFOUND)
{
set_amxstring(plugin->getAMX(), addr, STRING(gpGlobals->mapname), MAX_MAPNAME_LENGTH - 1);
}
auto length = 0;
if (amx_FindPubVar(plugin->getAMX(), "PluginName", &addr) != AMX_ERR_NOTFOUND)
{
plugin->setTitle(get_amxstring(plugin->getAMX(), addr, 0, length));
}
if (amx_FindPubVar(plugin->getAMX(), "PluginVersion", &addr) != AMX_ERR_NOTFOUND)
{
plugin->setVersion(get_amxstring(plugin->getAMX(), addr, 0, length));
}
if (amx_FindPubVar(plugin->getAMX(), "PluginAuthor", &addr) != AMX_ERR_NOTFOUND)
{
plugin->setAuthor(get_amxstring(plugin->getAMX(), addr, 0, length));
}
if (amx_FindPubVar(plugin->getAMX(), "PluginURL", &addr) != AMX_ERR_NOTFOUND)
{
plugin->setUrl(get_amxstring(plugin->getAMX(), addr, 0, length));
}
if (amx_FindPubVar(plugin->getAMX(), "PluginDescription", &addr) != AMX_ERR_NOTFOUND)
{
plugin->setDescription(get_amxstring(plugin->getAMX(), addr, 0, length));
}
if (amx_FindPubVar(plugin->getAMX(), "NULL_STRING", &addr) != AMX_ERR_NOTFOUND)
{
plugin->m_pNullStringOfs = get_amxaddr(plugin->getAMX(), addr);
}
if (amx_FindPubVar(plugin->getAMX(), "NULL_VECTOR", &addr) != AMX_ERR_NOTFOUND)
{
plugin->m_pNullVectorOfs = get_amxaddr(plugin->getAMX(), addr);
}
}
}
@ -96,100 +203,248 @@ int CPluginMngr::loadPluginsFromFile( const char* filename )
return pCounter;
}
void CPluginMngr::clear() {
CPlugin**a = &head;
while ( *a )
void CPluginMngr::clear()
{
CPlugin**a = &head;
while (*a)
unloadPlugin(a);
}
CPluginMngr::CPlugin* CPluginMngr::findPluginFast(AMX *amx)
{
return (CPlugin*)(amx->userdata[3]);
}
m_Finalized = false;
CPluginMngr::CPlugin* CPluginMngr::findPlugin(AMX *amx) {
CPlugin*a = head;
while ( a && &a->amx != amx )
a=a->next;
return a;
}
CPluginMngr::CPlugin* CPluginMngr::findPlugin(int index){
CPlugin*a = head;
while ( a && index--)
a=a->next;
return a;
}
CPluginMngr::CPlugin* CPluginMngr::findPlugin(const char* name) {
if (!name) return 0;
int len = strlen(name);
if (!len) return 0;
CPlugin*a = head;
while( a && strncmp(a->name.c_str(), name,len) )
a=a->next;
return a;
}
const char* CPluginMngr::CPlugin::getStatus() const {
switch(status){
case ps_running:
{
if (getAMX()->flags & AMX_FLAG_DEBUG)
{
return "debug";
} else {
return "running";
}
break;
}
case ps_paused: return "paused";
case ps_bad_load: return "bad load";
case ps_stopped: return "stopped";
case ps_locked: return "locked";
if (pNatives)
{
delete [] pNatives;
pNatives = NULL;
}
List<ke::AString *>::iterator iter = m_BlockList.begin();
while (iter != m_BlockList.end())
{
delete (*iter);
iter = m_BlockList.erase(iter);
}
m_BlockList.clear();
}
CPluginMngr::CPlugin* CPluginMngr::findPlugin(AMX *amx)
{
CPlugin*a = head;
while (a && &a->amx != amx)
a = a->next;
return a;
}
CPluginMngr::CPlugin* CPluginMngr::findPlugin(int index)
{
CPlugin*a = head;
while (a && index--)
a = a->next;
return a;
}
CPluginMngr::CPlugin* CPluginMngr::findPlugin(const char* name)
{
if (!name)
return 0;
int len = strlen(name);
if (!len)
return 0;
CPlugin*a = head;
while (a && strncmp(a->name.chars(), name, len))
a = a->next;
return a;
}
void CPluginMngr::CPlugin::AddToFailCounter(unsigned int i)
{
failcounter += i;
if ((failcounter >= 3)
&& (status ))
{
errorMsg = "This plugin is non-GPL which violates AMX Mod X's license.";
status = ps_bad_load;
}
}
const char* CPluginMngr::CPlugin::getStatus() const
{
switch (status)
{
case ps_running:
{
if (m_Debug)
{
return "debug";
} else {
return "running";
}
break;
}
case ps_paused: return "paused";
case ps_bad_load: return "bad load";
case ps_stopped: return "stopped";
case ps_locked: return "locked";
}
return "error";
}
CPluginMngr::CPlugin::CPlugin(int i, const char* p,const char* n, char* e, int d) : name(n), title(n) {
CPluginMngr::CPlugin::CPlugin(int i, const char* p, const char* n, char* e, size_t m, int d) : name(n), title(n), m_pNullStringOfs(nullptr), m_pNullVectorOfs(nullptr)
{
const char* unk = "unknown";
title.assign(unk);
author.assign(unk);
version.assign(unk);
char* path = build_pathname("%s/%s",p,n);
failcounter = 0;
title = unk;
author = unk;
version = unk;
url = unk;
char file[PLATFORM_MAX_PATH];
char* path = build_pathname_r(file, sizeof(file), "%s/%s", p, n);
code = 0;
int err = load_amxscript(&amx,&code,path,e, d);
if ( err == AMX_ERR_NONE )
memset(&amx, 0, sizeof(AMX));
int err = load_amxscript_ex(&amx, &code, path, e, m, d);
if (err == AMX_ERR_NONE)
{
status = ps_running;
} else {
status = ps_bad_load;
}
amx.userdata[3] = this;
amx.userdata[UD_FINDPLUGIN] = this;
paused_fun = 0;
next = 0;
id = i;
}
CPluginMngr::CPlugin::~CPlugin( ){
unload_amxscript( &amx, &code );
}
void CPluginMngr::CPlugin::pauseFunction( int id ) {
if (isValid()){
paused_fun |= (1<<id);
g_commands.clearBufforedInfo();
if (status == ps_running)
{
m_PauseFwd = registerSPForwardByName(&amx, "plugin_pause", FP_DONE);
m_UnpauseFwd = registerSPForwardByName(&amx, "plugin_unpause", FP_DONE);
if (amx.flags & AMX_FLAG_DEBUG)
{
m_Debug = true;
} else {
m_Debug = false;
}
}
}
void CPluginMngr::CPlugin::unpauseFunction( int id ) {
if (isValid()) {
paused_fun &= ~(1<<id);
g_commands.clearBufforedInfo();
CPluginMngr::CPlugin::~CPlugin()
{
unload_amxscript(&amx, &code);
}
int AMXAPI native_handler(AMX *amx, int index)
{
Handler *pHandler = (Handler *)amx->userdata[UD_HANDLER];
char name[sNAMEMAX + 1];
amx_GetNative(amx, index, name);
return pHandler->HandleNative(name, index, 0);
}
static cell AMX_NATIVE_CALL invalid_native(AMX *amx, cell *params)
{
//A script has accidentally called an invalid native! give them a
// first chance to block the resulting error.
Handler *pHandler = (Handler *)amx->userdata[UD_HANDLER];
//this should never happen
if (!pHandler)
{
LogError(amx, AMX_ERR_INVNATIVE, "Invalid native attempt");
return 0;
}
//this should never happen because this native won't be called
// if the plugin isn't filtering.
if (!pHandler->IsNativeFiltering())
{
LogError(amx, AMX_ERR_INVNATIVE, "Invalid native attempt");
return 0;
}
char name[sNAMEMAX + 1];
int native = (int)(_INT_PTR)(amx->usertags[UT_NATIVE]);
int err = amx_GetNative(amx, native, name);
if (err != AMX_ERR_NONE)
name[0] = '\0';
//1 - because we're trapping usage
if (!pHandler->HandleNative(name, native, 1))
{
amx->usertags[UT_NATIVE] = (void *)native;
LogError(amx, AMX_ERR_INVNATIVE, NULL);
return 0;
}
//Someday maybe allow native filters to write their own return value?
return 0;
}
void CPluginMngr::CPlugin::Finalize()
{
char buffer[128];
int old_status = status;
if (CheckModules(&amx, buffer))
{
if (amx_Register(&amx, core_Natives, -1) != AMX_ERR_NONE)
{
Handler *pHandler = (Handler *)amx.userdata[UD_HANDLER];
int res = 0;
if (pHandler->IsNativeFiltering())
res = amx_CheckNatives(&amx, native_handler);
if (!res)
{
status = ps_bad_load;
sprintf(buffer, "Plugin uses an unknown function (name \"%s\") - check your modules.ini.", no_function);
errorMsg = buffer;
amx.error = AMX_ERR_NOTFOUND;
} else {
amx_RegisterToAny(&amx, invalid_native);
}
}
} else {
status = ps_bad_load;
errorMsg = buffer;
amx.error = AMX_ERR_NOTFOUND;
}
if (old_status != status)
{
AMXXLOG_Log("[AMXX] Plugin \"%s\" failed to load: %s", name.chars(), errorMsg.chars());
}
}
void CPluginMngr::CPlugin::setStatus( int a ) {
status = a;
void CPluginMngr::CPlugin::pauseFunction(int id)
{
}
void CPluginMngr::CPlugin::unpauseFunction(int id)
{
}
void CPluginMngr::CPlugin::setStatus(int a)
{
status = a;
g_commands.clearBufforedInfo(); // ugly way
}
@ -199,17 +454,9 @@ void CPluginMngr::CPlugin::pausePlugin()
if (isValid())
{
// call plugin_pause if provided
int func;
cell retval;
if (amx_FindPublic(&amx, "plugin_pause", &func) == AMX_ERR_NONE)
{
if (isExecutable(func))
{
if (m_PauseFwd != -1)
executeForwards(m_PauseFwd);
amx_Exec(&amx, &retval, func, 0);
}
}
setStatus(ps_paused);
}
}
@ -217,20 +464,330 @@ void CPluginMngr::CPlugin::pausePlugin()
// Unpause a plugin
void CPluginMngr::CPlugin::unpausePlugin()
{
if (isValid())
if (isValid() && (getStatusCode() != ps_stopped))
{
// set status first so the function will be marked executable
setStatus(ps_running);
// call plugin_unpause if provided
int func;
cell retval;
if (amx_FindPublic(&amx, "plugin_unpause", &func) == AMX_ERR_NONE)
if (m_UnpauseFwd != -1)
{
if (isExecutable(func))
{
amx_Exec(&amx, &retval, func, 0);
}
executeForwards(m_UnpauseFwd);
}
}
}
void CPluginMngr::CPlugin::AddConfig(bool create, const char *name, const char *folder)
{
// Do a check for duplicates to prevent double-execution
for (size_t i = 0; i < m_configs.length(); ++i)
{
AutoConfig *config = m_configs[i];
if (config->autocfg.compare(name) == 0 && config->folder.compare(folder) == 0)
{
if (!config->create)
{
config->create = create;
}
return;
}
}
auto c = new AutoConfig;
c->autocfg = name;
c->folder = folder;
c->create = create;
m_configs.append(c);
}
size_t CPluginMngr::CPlugin::GetConfigCount()
{
return m_configs.length();
}
AutoConfig *CPluginMngr::CPlugin::GetConfig(size_t i)
{
if (i >= GetConfigCount())
{
return nullptr;
}
return m_configs[i];
}
char *CPluginMngr::ReadIntoOrFromCache(const char *file, size_t &bufsize)
{
List<plcache_entry *>::iterator iter;
plcache_entry *pl;
for (iter=m_plcache.begin(); iter!=m_plcache.end(); iter++)
{
pl = (*iter);
if (pl->path.compare(file) == 0)
{
bufsize = pl->bufsize;
return pl->buffer;
}
}
pl = new plcache_entry;
pl->file = new CAmxxReader(file, sizeof(cell));
pl->buffer = NULL;
if (pl->file->GetStatus() != CAmxxReader::Err_None)
{
delete pl->file;
delete pl;
return NULL;
}
pl->bufsize = pl->file->GetBufferSize();
if (pl->bufsize)
{
pl->buffer = new char[pl->bufsize];
pl->file->GetSection(pl->buffer);
}
if (!pl->buffer || pl->file->GetStatus() != CAmxxReader::Err_None)
{
delete [] pl->buffer;
delete pl->file;
delete pl;
return NULL;
}
pl->path = file;
bufsize = pl->bufsize;
m_plcache.push_back(pl);
return pl->buffer;
}
void CPluginMngr::InvalidateCache()
{
List<plcache_entry *>::iterator iter;
plcache_entry *pl;
for (iter=m_plcache.begin(); iter!=m_plcache.end(); iter++)
{
pl = (*iter);
delete [] pl->buffer;
delete pl->file;
delete pl;
}
m_plcache.clear();
}
void CPluginMngr::InvalidateFileInCache(const char *file, bool freebuf)
{
List<plcache_entry *>::iterator iter;
plcache_entry *pl;
for (iter=m_plcache.begin(); iter!=m_plcache.end(); iter++)
{
pl = (*iter);
if (pl->path.compare(file) == 0)
{
if (freebuf)
delete [] pl->buffer;
delete pl->file;
delete pl;
m_plcache.erase(iter);
return;
}
}
}
void CPluginMngr::CacheAndLoadModules(const char *plugin)
{
size_t progsize;
char *prog = ReadIntoOrFromCache(plugin, progsize);
if (!prog)
return;
AMX_HEADER hdr;
memcpy(&hdr, prog, sizeof(AMX_HEADER));
uint16_t magic = hdr.magic;
amx_Align16(&magic);
if (magic != AMX_MAGIC)
{
return;
}
if (hdr.file_version < MIN_FILE_VERSION ||
hdr.file_version > CUR_FILE_VERSION)
{
return;
}
if ((hdr.defsize != sizeof(AMX_FUNCSTUB)) &&
(hdr.defsize != sizeof(AMX_FUNCSTUBNT)))
{
return;
}
amx_Align32((uint32_t*)&hdr.nametable);
uint16_t *namelength=(uint16_t*)((unsigned char*)prog + (unsigned)hdr.nametable);
amx_Align16(namelength);
if (*namelength>sNAMEMAX)
{
return;
}
if (hdr.stp <= 0)
{
return;
}
AMX amx;
memset(&amx, 0, sizeof(AMX));
amx.base = (unsigned char *)prog;
int num;
char name[sNAMEMAX+1];
num = amx_GetLibraries(&amx);
for (int i=0; i<num; i++)
{
amx_GetLibrary(&amx, i, name, sNAMEMAX);
if (stricmp(name, "Float")==0)
continue;
//awful backwards compat hack
if (stricmp(name, "socket")==0)
strcpy(name, "sockets");
//we don't want to report failed modules here...
LoadModule(name, PT_ANYTIME, true, true);
}
cell tag_id;
amx_NumTags(&amx, &num);
ke::Vector<LibDecoder *> expects;
ke::Vector<LibDecoder *> defaults;
CStack<LibDecoder *> delstack;
for (int i=0; i<num; i++)
{
amx_GetTag(&amx, i, name, &tag_id);
if (name[0] == '?')
{
LibDecoder *dc = new LibDecoder;
delstack.push(dc);
if (DecodeLibCmdString(name, dc))
{
if (dc->cmd == LibCmd_ForceLib)
{
RunLibCommand(dc);
} else if ( (dc->cmd == LibCmd_ExpectClass) ||
(dc->cmd == LibCmd_ExpectLib) )
{
expects.append(dc);
} else if (dc->cmd == LibCmd_DefaultLib) {
defaults.append(dc);
}
}
}
}
for (size_t i=0; i<expects.length(); i++)
{
RunLibCommand(expects[i]);
}
for (size_t i=0; i<defaults.length(); i++)
{
RunLibCommand(defaults[i]);
}
expects.clear();
defaults.clear();
while (!delstack.empty())
{
delete delstack.front();
delstack.pop();
}
return;
}
void CPluginMngr::CALMFromFile(const char *file)
{
char filename[PLATFORM_MAX_PATH];
FILE *fp = fopen(build_pathname_r(filename, sizeof(filename), "%s", file), "rt");
if (!fp)
{
return;
}
// Find now folder
char pluginName[256];
char line[256];
char rline[256];
while (!feof(fp))
{
fgets(line, sizeof(line)-1, fp);
if (line[0] == ';' || line[0] == '\n' || line[0] == '\0')
{
continue;
}
/** quick hack */
char *ptr = line;
while (*ptr)
{
if (*ptr == ';')
{
*ptr = '\0';
} else {
ptr++;
}
}
strncopy(rline, line, sizeof(rline));
UTIL_TrimLeft(rline);
UTIL_TrimRight(rline);
pluginName[0] = '\0';
sscanf(rline, "%s", pluginName);
/* HACK: see if there's a 'disabled' coming up
* new block for scopying flexibility
*/
if (1)
{
const char *_ptr = rline + strlen(pluginName);
while (*_ptr != '\0' && isspace(*_ptr))
{
_ptr++;
}
if ((*_ptr != '\0') && !strcmp(_ptr, "disabled"))
{
ke::AString *pString = new ke::AString(pluginName);
m_BlockList.push_back(pString);
continue;
}
}
if (!isalnum(*pluginName))
{
continue;
}
build_pathname_r(filename, sizeof(filename), "%s/%s", get_localinfo("amxx_pluginsdir", "addons/amxmodx/plugins"), pluginName);
CacheAndLoadModules(filename);
}
fclose(fp);
}

View File

@ -1,53 +1,45 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef PLUGIN_H
#define PLUGIN_H
#include "sh_list.h"
#include "amx.h"
#include "amxxfile.h"
#include <amtl/am-string.h>
#include <amtl/am-vector.h>
#include <amtl/am-autoptr.h>
// *****************************************************
// class CPluginMngr
// *****************************************************
enum {
ps_bad_load,
ps_error,
ps_paused,
ps_running,
ps_stopped,
ps_locked
enum
{
ps_bad_load, //Load failed
ps_error, //Erroneous state
ps_locked, //UNUSED
ps_paused, //Plugin is temporarily paused
ps_stopped, //Plugin is ... more temporarily paused
ps_running, //Plugin is running
};
struct AutoConfig
{
ke::AString autocfg;
ke::AString folder;
bool create;
};
class CPluginMngr
{
public:
class iterator;
@ -59,67 +51,98 @@ public:
AMX amx;
void* code;
String name;
String version;
String title;
String author;
String errorMsg;
ke::AString name;
ke::AString version;
ke::AString title;
ke::AString author;
ke::AString url;
ke::AString description;
ke::AString errorMsg;
unsigned int failcounter;
int m_PauseFwd;
int m_UnpauseFwd;
int paused_fun;
int status;
CPlugin* next;
int id;
CPlugin(int i , const char* p,const char* n, char* e, int d);
~CPlugin( );
CPlugin(int i, const char* p, const char* n, char* e, size_t m, int d);
~CPlugin();
bool m_Debug;
cell* m_pNullStringOfs;
cell* m_pNullVectorOfs;
ke::Vector<ke::AutoPtr<AutoConfig>> m_configs;
public:
inline const char* getName() { return name.c_str();}
inline const char* getVersion() { return version.c_str();}
inline const char* getTitle() { return title.c_str();}
inline const char* getAuthor() { return author.c_str();}
inline const char* getError() { return errorMsg.c_str();}
inline const char* getName() { return name.chars();}
inline const char* getVersion() { return version.chars();}
inline const char* getTitle() { return title.chars();}
inline const char* getAuthor() { return author.chars();}
inline const char* getUrl() { return url.chars(); }
inline const char* getDescription() { return description.chars(); }
inline const char* getError() { return errorMsg.chars();}
inline int getStatusCode() { return status; }
inline int getId() const { return id; }
inline AMX* getAMX() { return &amx; }
inline const AMX* getAMX() const { return &amx; }
inline void setTitle( const char* n ) { title.assign(n); }
inline void setAuthor( const char* n ) { author.assign(n); }
inline void setVersion( const char* n ) { version.assign(n); }
inline void setError( const char* n ) { errorMsg.assign(n); }
inline bool isValid() const { return ((status != ps_bad_load) && (status != ps_locked)); }
inline bool isPaused() const { return ( (status == ps_paused) || (status == ps_stopped)); }
inline bool isFunctionPaused( int id ) const { return (paused_fun & (1<<id)) ? true : false; }
inline bool isExecutable(int id) const { return (isValid() && !isPaused() && !isFunctionPaused(id)); }
inline void setTitle(const char* n) { title = n; }
inline void setAuthor(const char* n) { author =n; }
inline void setVersion(const char* n) { version = n; }
inline void setUrl(const char* n) { url = n; }
inline void setDescription(const char* n) { description = n; }
inline void setError(const char* n) { errorMsg = n; }
inline bool isValid() const { return (status >= ps_paused); }
inline bool isPaused() const { return ((status == ps_paused) || (status == ps_stopped)); }
inline bool isStopped() const { return (status == ps_stopped); }
inline bool isExecutable(int id) const { return (isValid() && !isPaused()); }
void Finalize();
void AddToFailCounter(unsigned int i);
void pausePlugin();
void unpausePlugin();
void pauseFunction( int id );
void unpauseFunction( int id );
void setStatus( int a );
void pauseFunction(int id);
void unpauseFunction(int id);
void setStatus(int a);
const char* getStatus() const;
inline bool isDebug() const { return m_Debug; }
inline cell* getNullStringOfs() const { return m_pNullStringOfs; }
inline cell* getNullVectorOfs() const { return m_pNullVectorOfs; }
public:
void AddConfig(bool create, const char *name, const char *folder);
size_t GetConfigCount();
AutoConfig *GetConfig(size_t index);
};
private:
CPlugin *head;
int pCounter;
public:
CPluginMngr() { head = 0; pCounter = 0; }
~CPluginMngr() { clear(); }
CPluginMngr() { head = 0; pCounter = 0; pNatives = NULL; m_Finalized=false;}
~CPluginMngr() { clear(); InvalidateCache(); }
bool m_Finalized;
AMX_NATIVE_INFO *pNatives;
// Interface
CPlugin* loadPlugin(const char* path, const char* name, char* error, int debug);
void unloadPlugin( CPlugin** a );
int loadPluginsFromFile( const char* filename );
CPlugin* findPluginFast(AMX *amx);
CPlugin* loadPlugin(const char* path, const char* name, char* error, size_t maxLength, int debug);
void unloadPlugin(CPlugin** a);
int loadPluginsFromFile(const char* filename, bool warn=true);
inline CPlugin* findPluginFast(AMX *amx) { return (CPlugin*)(amx->userdata[UD_FINDPLUGIN]); }
CPlugin* findPlugin(AMX *amx);
CPlugin* findPlugin(int index);
CPlugin* findPlugin(const char* name);
inline int getPluginsNum() const { return pCounter; }
void Finalize();
void clear();
class iterator {
class iterator
{
CPlugin *a;
public:
iterator(CPlugin*aa) : a(aa) {}
@ -129,10 +152,25 @@ public:
operator bool () const { return a ? true : false; }
CPlugin& operator*() { return *a; }
};
inline iterator begin() const { return iterator(head); }
inline iterator end() const { return iterator(0); }
public:
struct plcache_entry
{
CAmxxReader *file;
size_t bufsize;
char *buffer;
ke::AString path;
};
char *ReadIntoOrFromCache(const char *file, size_t &bufsize);
void InvalidateCache();
void InvalidateFileInCache(const char *file, bool freebuf);
void CacheAndLoadModules(const char *plugin);
void CALMFromFile(const char *file);
private:
List<plcache_entry *> m_plcache;
List<ke::AString *> m_BlockList;
};
#endif
#endif //PLUGIN_H

View File

@ -1,126 +0,0 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
//by David "BAILOPAN" Anderson
#ifndef _INCLUDE_CQUEUE_H
#define _INCLUDE_CQUEUE_H
template <class T>
class CQueue
{
public:
class CQueueItem
{
public:
CQueueItem(const T &i, CQueueItem *n)
{
item = i;
next = n;
}
CQueueItem *GetNext()
{
return next;
}
T & GetItem()
{
return item;
}
void SetNext(CQueueItem *n)
{
next = n;
}
private:
T item;
CQueueItem *next;
};
public:
CQueue()
{
mSize = 0;
mFirst = NULL;
mLast = NULL;
}
bool empty()
{
return ((mSize==0)?true:false);
}
void push(const T &v)
{
CQueueItem *p = new CQueueItem(v, NULL);
if (empty())
{
mFirst = p;
} else {
mLast->SetNext(p);
}
mLast = p;
mSize++;
}
void pop()
{
if (mFirst == mLast)
{
delete mFirst;
mFirst = NULL;
mLast = NULL;
} else {
CQueueItem *p = mFirst->GetNext();
delete mFirst;
mFirst = p;
}
mSize--;
}
T & front()
{
return mFirst->GetItem();
}
T & back()
{
return mLast->GetItem();
}
unsigned int size()
{
return mSize;
}
private:
CQueueItem *mFirst;
CQueueItem *mLast;
unsigned int mSize;
};
#endif //_INCLUDE_CQUEUE_H

View File

@ -1,404 +0,0 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
#ifndef _INCLUDE_CSTRING_H
#define _INCLUDE_CSTRING_H
//by David "BAILOPAN" Anderson
class String
{
public:
String()
{
v = NULL;
mSize = 0;
cSize = 0;
Grow(2);
assign("");
}
~String()
{
if (v)
delete [] v;
}
String(const char *src)
{
v = NULL;
mSize = 0;
cSize = 0; assign(src);
}
String(String &src)
{
v = NULL;
mSize = 0;
cSize = 0;
assign(src.c_str());
}
const char *c_str() { return v?v:""; }
const char *c_str() const { return v?v:""; }
void append(const char *t)
{
Grow(cSize + strlen(t) + 1);
strcat(v, t);
cSize = strlen(v);
}
void append(const char c)
{
Grow(cSize + 2);
v[cSize] = c;
v[++cSize] = 0;
}
void append(String &d)
{
const char *t = d.c_str();
Grow(cSize + strlen(t));
strcat(v, t);
cSize = strlen(v);
}
void assign(const String &src)
{
assign(src.c_str());
}
void assign(const char *d)
{
if (!d)
{
Grow(1);
cSize = 0;
strcpy(v, "");
return;
}
Grow(strlen(d));
if (v)
{
strcpy(v, d);
cSize = strlen(v);
} else {
cSize = 0;
}
}
void clear()
{
if (v)
{
v[0] = 0;
cSize = 0;
}
}
int compare (const char *d)
{
if (v) {
if (d) {
return strcmp(v, d);
} else {
return strlen(v);
}
} else {
if (d) {
return strlen(d);
} else {
return 0;
}
}
}
//Added this for amxx inclusion
bool empty()
{
if (!v || !cSize)
return true;
return false;
}
int size()
{
if (!v)
return 0;
return cSize;
}
const char * _fread(FILE *fp)
{
Grow(512);
char * ret = fgets(v, 511, fp);
cSize = strlen(v);
return ret;
}
int find(const char c, int index = 0)
{
if (!v)
return npos;
if (index >= (int)cSize || index < 0)
return npos;
unsigned int i = 0;
for (i=index; i<cSize; i++)
{
if (v[i] == c)
{
return i;
}
}
return npos;
}
bool is_space(int c)
{
if (c == '\f' || c == '\n' ||
c == '\t' || c == '\r' ||
c == '\v' || c == ' ')
{
return true;
}
return false;
}
void trim()
{
if (!v)
return;
unsigned int i = 0;
unsigned int j = 0;
if (cSize == 1)
{
if (is_space(v[i]))
{
clear();
return;
}
}
unsigned char c0 = v[0];
if (is_space(c0))
{
for (i=0; i<cSize; i++)
{
if (!is_space(v[i]) || (is_space(v[i]) && ((unsigned char)i==cSize-1)))
{
erase(0, i);
break;
}
}
}
cSize = strlen(v);
if (cSize < 1)
{
return;
}
if (is_space(v[cSize-1]))
{
for (i=cSize-1; i>=0; i--)
{
if (!is_space(v[i])
|| (is_space(v[i]) && i==0))
{
erase(i+1, j);
break;
}
j++;
}
}
if (cSize == 1)
{
if (is_space(v[0]))
{
clear();
return;
}
}
}
String & erase(unsigned int start, int num = npos)
{
if (!v)
return (*this);
unsigned int i = 0;
//check for bounds
if (num == npos || start+num > cSize-num+1)
num = cSize - start;
//do the erasing
bool copyflag = false;
for (i=0; i<cSize; i++)
{
if (i>=start && i<start+num)
{
if (i+num < cSize)
{
v[i] = v[i+num];
} else {
v[i] = 0;
}
copyflag = true;
} else if (copyflag) {
if (i+num < cSize)
{
v[i] = v[i+num];
} else {
v[i] = 0;
}
}
}
cSize -= num;
v[cSize] = 0;
return (*this);
}
String substr(unsigned int index, int num = npos)
{
String ns;
if (index >= cSize || !v)
return ns;
if (num == npos)
{
num = cSize - index;
} else if (index+num >= cSize) {
num = cSize - index;
}
unsigned int i = 0, j=0;
char *s = new char[cSize+1];
for (i=index; i<index+num; i++)
{
s[j++] = v[i];
}
s[j] = 0;
ns.assign(s);
delete [] s;
return ns;
}
void toLower()
{
if (!v)
return;
unsigned int i = 0;
for (i=0; i<cSize; i++)
{
if (v[i] >= 65 && v[i] <= 90)
v[i] |= 32;
}
}
String & operator = (const String &src)
{
assign(src);
return *this;
}
String & operator = (const char *src)
{
assign(src);
return *this;
}
char operator [] (unsigned int index)
{
if (index > cSize)
{
return -1;
} else {
return v[index];
}
}
int at(int a)
{
if (a < 0 || a >= (int)cSize)
return -1;
return v[a];
}
bool at(int at, char c)
{
if (at < 0 || at >= (int)cSize)
return false;
v[at] = c;
return true;
}
private:
void Grow(unsigned int d)
{
if (d<1)
return;
if (d > mSize)
{
mSize = d + 16; // allocate a buffer
char *t = new char[d+1];
if (v) {
strcpy(t, v);
t[cSize] = 0;
delete [] v;
}
v = t;
mSize = d;
}
}
char *v;
unsigned int mSize;
unsigned int cSize;
public:
static const int npos = -1;
};
#endif //_INCLUDE_CSTRING_H

View File

@ -1,61 +1,41 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "CTask.h"
/*********************** CTask ***********************/
int CTaskMngr::CTask::getTaskId() const
{
return m_iId;
}
CPluginMngr::CPlugin *CTaskMngr::CTask::getPlugin() const
{
return m_pPlugin;
}
void CTaskMngr::CTask::set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime)
void CTaskMngr::CTask::set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, cell iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime)
{
clear();
m_bFree = false;
m_pPlugin = pPlugin;
m_iFunc = iFunc;
m_iId = iId;
m_fBase = fBase;
m_bInExecute = false;
m_iRepeat = (iFlags & 1) ? iRepeat : 0;
m_bLoop = (iFlags & 2) ? true : false;
m_bAfterStart = (iFlags & 4) ? true : false;
m_bBeforeEnd = (iFlags & 8) ? true : false;
if (iFlags & 2)
{
m_bLoop = true;
m_iRepeat = -1;
}
else if (iFlags & 1)
{
m_bLoop = true;
m_iRepeat = iRepeat;
}
m_bAfterStart = (iFlags & 4) ? true : false;
m_bBeforeEnd = (iFlags & 8) ? true : false;
m_fNextExecTime = fCurrentTime + m_fBase;
@ -73,17 +53,30 @@ void CTaskMngr::CTask::set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags,
void CTaskMngr::CTask::clear()
{
m_bFree = true;
if (m_iFunc >= 0)
{
unregisterSPForward(m_iFunc);
m_iFunc = -1;
}
m_bFree = true;
if (m_pParams)
{
delete [] m_pParams;
m_pParams = NULL;
}
m_pPlugin = NULL;
m_iId = 0;
m_fBase = 0.0f;
m_iRepeat = 0;
m_bLoop = false;
m_bAfterStart = false;
m_bBeforeEnd = false;
m_fNextExecTime = 0.0f;
}
bool CTaskMngr::CTask::isFree() const
@ -98,12 +91,16 @@ void CTaskMngr::CTask::changeBase(float fNewBase)
void CTaskMngr::CTask::resetNextExecTime(float fCurrentTime)
{
m_fNextExecTime = fCurrentTime + m_fBase;
// If we're here while we're executing we would add m_fBase twice
if (!m_bInExecute)
m_fNextExecTime = fCurrentTime + m_fBase;
}
void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, float fTimeLeft)
{
bool execute=false;
bool execute = false;
bool done = false;
if (m_bAfterStart)
{
if (fCurrentTime - fTimeLeft + 1.0f >= m_fBase)
@ -115,31 +112,43 @@ void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, f
execute = true;
}
else if (m_fNextExecTime <= fCurrentTime)
{
execute = true;
}
if (execute)
{
if (m_iParamLen) // call with parameters
//only bother calling if we have something to call
if (!(m_bLoop && !m_iRepeat))
{
cell arr = prepareCellArray(m_pParams, m_iParamLen);
executeForwards(m_iFunc, arr, m_iId);
} else {
executeForwards(m_iFunc, m_iId);
m_bInExecute = true;
if (m_iParamLen) // call with parameters
{
cell arr = prepareCellArray(m_pParams, m_iParamLen);
executeForwards(m_iFunc, arr, m_iId);
} else {
executeForwards(m_iFunc, m_iId);
}
m_bInExecute = false;
}
if (isFree())
return;
// set new exec time OR remove the task if needed
if (m_bLoop || (--m_iRepeat > 0))
if (m_bLoop)
{
m_fNextExecTime += m_fBase;
if (m_iRepeat != -1 && --m_iRepeat <= 0)
done = true;
} else {
done = true;
}
else
if (done)
{
unregisterSPForward(m_iFunc);
m_iFunc = -1;
m_bFree = true;
clear();
} else {
m_fNextExecTime += m_fBase;
}
}
}
@ -147,6 +156,22 @@ void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, f
CTaskMngr::CTask::CTask()
{
m_bFree = true;
m_pPlugin = NULL;
m_iFunc = -1;
m_iId = 0;
m_fBase = 0.0f;
m_iRepeat = 0;
m_bLoop = false;
m_bAfterStart = false;
m_bBeforeEnd = false;
m_bInExecute = false;
m_fNextExecTime = 0.0f;
m_iParamLen = 0;
m_pParams = NULL;
}
CTaskMngr::CTask::~CTask()
@ -155,6 +180,7 @@ CTaskMngr::CTask::~CTask()
}
/*********************** CTaskMngr ***********************/
CTaskMngr::CTaskMngr()
{
m_pTmr_CurrentTime = NULL;
@ -162,6 +188,11 @@ CTaskMngr::CTaskMngr()
m_pTmr_TimeLeft = NULL;
}
CTaskMngr::~CTaskMngr()
{
clear();
}
void CTaskMngr::registerTimers(float *pCurrentTime, float *pTimeLimit, float *pTimeLeft)
{
m_pTmr_CurrentTime = pCurrentTime;
@ -169,67 +200,83 @@ void CTaskMngr::registerTimers(float *pCurrentTime, float *pTimeLimit, float *pT
m_pTmr_TimeLeft = pTimeLeft;
}
void CTaskMngr::registerTask(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat)
void CTaskMngr::registerTask(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, cell iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat)
{
// first, search for free tasks
TaskListIter iter = m_Tasks.find(CTaskDescriptor(0, NULL, true));
if (iter)
for (auto &task : m_Tasks)
{
// found: reuse it
iter->set(pPlugin, iFunc, iFlags, iId, fBase, iParamsLen, pParams, iRepeat, *m_pTmr_CurrentTime);
}
else
{
// not found: make a new one
CTask *pTmp = new CTask;
if (!pTmp)
if (task->isFree() && !task->inExecute())
{
// found: reuse it
task->set(pPlugin, iFunc, iFlags, iId, fBase, iParamsLen, pParams, iRepeat, *m_pTmr_CurrentTime);
return;
pTmp->set(pPlugin, iFunc, iFlags, iId, fBase, iParamsLen, pParams, iRepeat, *m_pTmr_CurrentTime);
m_Tasks.put(pTmp);
}
}
// not found: make a new one
auto task = ke::AutoPtr<CTask>(new CTask);
if (!task)
return;
task->set(pPlugin, iFunc, iFlags, iId, fBase, iParamsLen, pParams, iRepeat, *m_pTmr_CurrentTime);
m_Tasks.append(ke::Move(task));
}
int CTaskMngr::removeTasks(int iId, AMX *pAmx)
{
CTaskDescriptor descriptor(iId, pAmx);
TaskListIter iter = m_Tasks.find(descriptor);
int i=0;
while (iter)
int i = 0;
for (auto &task : m_Tasks)
{
iter->clear();
if (task->match(iId, pAmx))
{
task->clear();
++i;
iter = m_Tasks.find(++iter, descriptor);
}
}
return i;
}
int CTaskMngr::changeTasks(int iId, AMX *pAmx, float fNewBase)
{
CTaskDescriptor descriptor(iId, pAmx);
TaskListIter iter = m_Tasks.find(descriptor);
int i=0;
while (iter)
int i = 0;
for (auto &task : m_Tasks)
{
iter->changeBase(fNewBase);
iter->resetNextExecTime(*m_pTmr_CurrentTime);
if (task->match(iId, pAmx))
{
task->changeBase(fNewBase);
task->resetNextExecTime(*m_pTmr_CurrentTime);
++i;
iter = m_Tasks.find(++iter, descriptor);
}
}
return i;
}
bool CTaskMngr::taskExists(int iId, AMX *pAmx)
{
return m_Tasks.find(CTaskDescriptor(iId, pAmx));
for (auto &task : m_Tasks)
{
if (task->match(iId, pAmx))
{
return true;
}
}
return false;
}
void CTaskMngr::startFrame()
{
for (TaskListIter iter = m_Tasks.begin(); iter; ++iter)
auto lastSize = m_Tasks.length();
for(auto i = 0u; i < lastSize; i++)
{
if (iter->isFree())
auto &task = m_Tasks[i];
if (task->isFree())
continue;
iter->executeIfRequired(*m_pTmr_CurrentTime, *m_pTmr_TimeLimit, *m_pTmr_TimeLeft);
task->executeIfRequired(*m_pTmr_CurrentTime, *m_pTmr_TimeLimit, *m_pTmr_TimeLeft);
}
}

View File

@ -1,33 +1,11 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef CTASK_H
#define CTASK_H
@ -39,83 +17,69 @@ private:
class CTask
{
// task settings
CPluginMngr::CPlugin *m_pPlugin;
int m_iId;
cell m_iId;
int m_iFunc;
int m_iRepeat;
bool m_bInExecute;
bool m_bLoop;
bool m_bAfterStart;
bool m_bBeforeEnd;
float m_fBase; // for normal tasks, stores the interval, for the others, stores the amount of time before start / after end
int m_iParamLen;
cell *m_pParams;
bool m_bFree;
// execution
float m_fNextExecTime;
public:
void set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime);
void clear();
bool isFree() const;
void set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, cell iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime);
void clear();
bool isFree() const;
CPluginMngr::CPlugin *getPlugin() const;
int getTaskId() const;
inline CPluginMngr::CPlugin *getPlugin() const { return m_pPlugin; }
inline AMX *getAMX() const { return m_pPlugin->getAMX(); }
inline int getTaskId() const { return m_iId; }
void executeIfRequired(float fCurrentTime, float fTimeLimit, float fTimeLeft); // also removes the task if needed
void executeIfRequired(float fCurrentTime, float fTimeLimit, float fTimeLeft); // also removes the task if needed
void changeBase(float fNewBase);
void resetNextExecTime(float fCurrentTime);
void changeBase(float fNewBase);
void resetNextExecTime(float fCurrentTime);
inline bool inExecute() const { return m_bInExecute; }
bool shouldRepeat();
bool shouldRepeat();
inline bool match(int id, AMX *amx)
{
return (!m_bFree) && (amx ? getAMX() == amx : true) && (m_iId == id);
}
CTask();
~CTask();
};
class CTaskDescriptor
{
public:
int m_iId;
AMX *m_pAmx;
bool m_bFree;
CTaskDescriptor(int iId, AMX *pAmx, bool bFree = false)
{
m_iId = iId;
m_pAmx = pAmx;
m_bFree = bFree;
}
friend bool operator == (const CTask &left, const CTaskDescriptor &right)
{
if (right.m_bFree)
return left.isFree();
return !left.isFree() &&
(right.m_pAmx ? left.getPlugin()->getAMX() == right.m_pAmx : true) &&
left.getTaskId() == right.m_iId;
}
};
/*** CTaskMngr priv members ***/
typedef CList<CTask, CTaskDescriptor> TaskList;
typedef TaskList::iterator TaskListIter;
TaskList m_Tasks;
ke::Vector<ke::AutoPtr<CTask>> m_Tasks;
float *m_pTmr_CurrentTime;
float *m_pTmr_TimeLimit;
float *m_pTmr_TimeLeft;
public:
CTaskMngr();
~CTaskMngr();
void registerTimers(float *pCurrentTime, float *pTimeLimit, float *pTimeLeft); // The timers will always point to the right value
void registerTask(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat);
int removeTasks(int iId, AMX *pAmx); // remove all tasks that match the id and amx
int changeTasks(int iId, AMX *pAmx, float fNewBase); // change all tasks that match the id and amx
void registerTask(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, cell iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat);
int removeTasks(int iId, AMX *pAmx); // remove all tasks that match the id and amx
int changeTasks(int iId, AMX *pAmx, float fNewBase); // change all tasks that match the id and amx
bool taskExists(int iId, AMX *pAmx);
void startFrame();
void clear();
};
#endif
#endif //CTASK_H

1133
amxmodx/CTextParsers.cpp Normal file

File diff suppressed because it is too large Load Diff

89
amxmodx/CTextParsers.h Normal file
View File

@ -0,0 +1,89 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#ifndef _INCLUDE_SOURCEMOD_TEXTPARSERS_H_
#define _INCLUDE_SOURCEMOD_TEXTPARSERS_H_
#include <ITextParsers.h>
#include <amtl/am-vector.h>
/**
* @param void * IN: Stream pointer
* @param char * IN/OUT: Stream buffer
* @param size_t IN: Maximum size of buffer
* @param unsigned int * OUT: Number of bytes read (0 = end of stream)
* @return True on success, false on failure
*/
typedef bool(*STREAMREADER)(void *, char *, size_t, unsigned int *);
class TextParsers : public ITextParsers
{
public:
TextParsers();
public:
bool ParseFile_INI(const char *file,
ITextListener_INI *ini_listener,
unsigned int *line,
unsigned int *col,
bool inline_comment);
SMCError ParseFile_SMC(const char *file,
ITextListener_SMC *smc_listener,
SMCStates *states);
SMCError ParseSMCFile(const char *file,
ITextListener_SMC *smc_listener,
SMCStates *states,
char *buffer,
size_t maxsize);
SMCError ParseSMCStream(const char *stream,
size_t length,
ITextListener_SMC *smc_listener,
SMCStates *states,
char *buffer,
size_t maxsize);
unsigned int GetUTF8CharBytes(const char *stream);
const char *GetSMCErrorString(SMCError err);
bool IsWhitespace(const char *stream);
private:
SMCError ParseStream_SMC(void *stream,
STREAMREADER srdr,
ITextListener_SMC *smc,
SMCStates *states);
};
extern TextParsers g_TextParser;
#endif //_INCLUDE_SOURCEMOD_TEXTPARSERS_H_

View File

@ -1,84 +1,63 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "amxmodx.h"
#include "CVault.h"
#include "CFile.h"
#include "CFileSystem.h"
// *****************************************************
// class Vault
// *****************************************************
bool Vault::exists( const char* k )
{
if ( *k == 0 ) return false;
return *find( k ) != 0;
bool Vault::exists(const char* k)
{
if (*k == 0) return false;
return *find(k) != 0;
}
void Vault::put( const char* k, const char* v )
void Vault::put(const char* k, const char* v)
{
if ( *k == 0 ) return;
if (*k == 0) return;
if ( *v == 0 )
if (*v == 0)
{
remove( k );
remove(k);
return;
}
Obj** a = find( k );
Obj** a = find(k);
if ( *a )
if (*a)
{
(*a)->value.assign(v);
(*a)->number = atoi( v );
(*a)->value = v;
(*a)->number = atoi(v);
}
else
*a = new Obj( k , v );
*a = new Obj(k, v);
}
Vault::Obj::Obj( const char* k, const char* v): key(k) , value(v) , next(0) {
Vault::Obj::Obj(const char* k, const char* v): key(k), value(v), next(0)
{
number = atoi(v);
}
Vault::Obj** Vault::find( const char* n )
Vault::Obj** Vault::find(const char* n)
{
Obj** a = &head;
while( *a )
while (*a)
{
if ( strcmp((*a)->key.c_str(), n) == 0 )
if (strcmp((*a)->key.chars(), n) == 0)
return a;
a = &(*a)->next;
@ -88,91 +67,119 @@ Vault::Obj** Vault::find( const char* n )
}
int Vault::get_number( const char* n )
int Vault::get_number(const char* n)
{
if ( *n == 0 ) return 0;
if (*n == 0) return 0;
Obj* b = *find( n );
Obj* b = *find(n);
if ( b == 0 ) return 0;
if (b == 0) return 0;
return b->number;
}
const char* Vault::get( const char* n )
const char* Vault::get(const char* n)
{
if ( *n == 0 ) return "";
if (*n == 0) return "";
Obj* b = *find( n );
Obj* b = *find(n);
if ( b == 0 ) return "";
if (b == 0) return "";
return b->value.c_str();
return b->value.chars();
}
void Vault::clear()
{
while ( head )
while (head)
{
Obj* a = head->next;
delete head;
head = a;
head = a;
}
}
void Vault::remove( const char* n )
void Vault::remove(const char* n)
{
Obj** b = find( n );
Obj** b = find(n);
if ( *b == 0 ) return;
if (*b == 0) return;
Obj* a = (*b)->next;
delete *b;
*b = a;
}
void Vault::setSource( const char* n )
void Vault::setSource(const char* n)
{
path.assign(n);
path = n;
}
bool Vault::loadVault( )
bool Vault::loadVault()
{
if ( path.empty() ) return false;
if (!path.length())
{
return false;
}
clear();
File a( path.c_str() , "r" );
FILE *fp = fopen(path.chars(), "r");
if ( !a ) return false;
const int sz = 512;
char value[sz+1];
char key[sz+1];
while ( a >> key && a.skipWs() && a.getline( value , sz ) )
if (!fp)
{
if ( isalpha ( *key ) )
put( key, value );
return false;
}
char lineRead[512];
char key[sizeof(lineRead) + 1];
char value[sizeof(lineRead) + 1];
while (fgets(lineRead, sizeof(lineRead), fp))
{
UTIL_TrimLeft(lineRead);
if (!*lineRead || *lineRead == ';')
{
continue;
}
sscanf(lineRead, "%s%*[ \t]%[^\n]", key, value);
if (isalpha(*key))
{
put(key, value);
}
}
fclose(fp);
return true;
}
bool Vault::saveVault( )
bool Vault::saveVault()
{
if ( path.empty() ) return false;
if (!path.length())
{
return false;
}
File a( path.c_str() , "w" );
FILE *fp = fopen(path.chars(), "w");
if ( !a ) return false;
if (!fp)
{
return false;
}
a << "; Don't modify!" << '\n';
fputs("; Don't modify!\n", fp);
for (Obj* b = head; b ;b = b->next)
a << b->key << '\t' << b->value << '\n';
for (Obj* b = head; b; b = b->next)
{
fprintf(fp, "%s\t%s\n", b->key.chars(), b->value.chars());
}
fclose(fp);
return true;
}

View File

@ -1,93 +1,70 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef VAULT_CUSTOM_H
#define VAULT_CUSTOM_H
#include "CString.h"
#include "CList.h"
// *****************************************************
// class Vault
// *****************************************************
class Vault
{
struct Obj
{
String key;
String value;
int number;
Obj *next;
Obj( const char* k, const char* v);
} *head;
struct Obj
{
ke::AString key;
ke::AString value;
String path;
int number;
Obj *next;
Obj(const char* k, const char* v);
} *head;
Obj** find( const char* n );
ke::AString path;
Obj** find(const char* n);
public:
Vault() {head=0;}
~Vault() { clear();}
Vault() { head = 0; }
~Vault() { clear(); }
// Interface
bool exists( const char* k );
void put(const char* k, const char* v);
void remove( const char* k );
const char* get( const char* n );
int get_number( const char* n );
void setSource( const char* n );
bool loadVault( );
bool saveVault( );
void clear();
bool exists(const char* k);
void put(const char* k, const char* v);
void remove(const char* k);
const char* get(const char* n);
int get_number(const char* n);
void setSource(const char* n);
bool loadVault();
bool saveVault();
void clear();
class iterator
{
Obj * a;
public:
iterator(Obj* aa) : a(aa) {}
iterator& operator++() { if (a) a = a->next; return *this; }
bool operator==(const iterator& b) const { return a == b.a; }
bool operator!=(const iterator& b) const { return !operator==(b); }
ke::AString& key() const { return a->key; }
ke::AString& value() const { return a->value; }
};
class iterator {
Obj * a;
public:
iterator(Obj*aa) : a(aa) {}
iterator& operator++() { if ( a ) a = a->next; return *this; }
bool operator==(const iterator& b) const { return a == b.a; }
bool operator!=(const iterator& b) const { return !operator==(b); }
String& key() const { return a->key; }
String& value() const { return a->value; }
};
inline iterator begin() const { return iterator(head); }
inline iterator end() const { return iterator(0); }
inline iterator begin() const { return iterator(head); }
inline iterator end() const { return iterator(0); }
};
#endif
#endif //VAULT_CUSTOM_H

View File

@ -1,444 +0,0 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
#ifndef __CVECTOR_H__
#define __CVECTOR_H__
#include <assert.h>
// Vector
template <class T> class CVector
{
bool Grow()
{
// automatic grow
size_t newSize = m_Size * 2;
if (newSize == 0)
newSize = 8; // a good init value
T *newData = new T[newSize];
if (!newData)
return false;
if (m_Data)
{
memcpy(newData, m_Data, m_Size * sizeof(T));
delete [] m_Data;
}
m_Data = newData;
m_Size = newSize;
return true;
}
bool GrowIfNeeded()
{
if (m_CurrentUsedSize >= m_Size)
return Grow();
else
return true;
}
bool ChangeSize(size_t size)
{
// change size
if (size == m_Size)
return true;
T *newData = new T[size];
if (!newData)
return false;
if (m_Data)
{
memcpy(newData, m_Data, (m_Size < size) ? (m_Size * sizeof(T)) : (size * sizeof(T)));
delete [] m_Data;
}
if (m_Size < size)
m_CurrentSize = size;
m_Data = newData;
m_Size = size;
return true;
}
void FreeMemIfPossible()
{
}
protected:
T *m_Data;
size_t m_Size;
size_t m_CurrentUsedSize;
size_t m_CurrentSize;
public:
class iterator
{
protected:
T *m_Ptr;
public:
// constructors / destructors
iterator()
{
m_Ptr = NULL;
}
iterator(T * ptr)
{
m_Ptr = ptr;
}
// member functions
T * base()
{
return m_Ptr;
}
const T * base() const
{
return m_Ptr;
}
// operators
T & operator*()
{
return *m_Ptr;
}
T * operator->()
{
return m_Ptr;
}
iterator & operator++() // preincrement
{
++m_Ptr;
return (*this);
}
iterator operator++(int) // postincrement
{
iterator tmp = *this;
++m_Ptr;
return tmp;
}
iterator & operator--() // predecrement
{
--m_Ptr;
return (*this);
}
iterator operator--(int) // postdecrememnt
{
iterator tmp = *this;
--m_Ptr;
return tmp;
}
bool operator==(T * right) const
{
return (m_Ptr == right);
}
bool operator==(const iterator & right) const
{
return (m_Ptr == right.m_Ptr);
}
bool operator!=(T * right) const
{
return (m_Ptr != right);
}
bool operator!=(const iterator & right) const
{
return (m_Ptr != right.m_Ptr);
}
iterator & operator+=(size_t offset)
{
m_Ptr += offset;
return (*this);
}
iterator & operator-=(size_t offset)
{
m_Ptr += offset;
return (*this);
}
iterator operator+(size_t offset) const
{
iterator tmp(*this);
tmp.m_Ptr += offset;
return tmp;
}
iterator operator-(size_t offset) const
{
iterator tmp(*this);
tmp.m_Ptr += offset;
return tmp;
}
T & operator[](size_t offset)
{
return (*(*this + offset));
}
const T & operator[](size_t offset) const
{
return (*(*this + offset));
}
bool operator<(const iterator & right) const
{
return m_Ptr < right.m_Ptr;
}
bool operator>(const iterator & right) const
{
return m_Ptr > right.m_Ptr;
}
bool operator<=(const iterator & right) const
{
return m_Ptr <= right.m_Ptr;
}
bool operator>=(const iterator & right) const
{
return m_Ptr >= right.m_Ptr;
}
size_t operator-(const iterator & right) const
{
return m_Ptr - right.m_Ptr;
}
};
// constructors / destructors
CVector<T>()
{
m_Size = 0;
m_CurrentUsedSize = 0;
m_Data = NULL;
}
CVector<T>(const CVector<T> & other)
{
// copy data
m_Data = new T [other.m_Size];
m_Size = other.m_Size;
m_CurrentUsedSize = other.m_CurrentUsedSize;
memcpy(m_Data, other.m_Data, m_CurrentUsedSize * sizeof(T));
}
~CVector<T>()
{
clear();
}
// interface
size_t size() const
{
return m_CurrentUsedSize;
}
size_t capacity() const
{
return m_Size;
}
iterator begin()
{
return iterator(m_Data);
}
iterator end()
{
return iterator(m_Data + m_CurrentUsedSize);
}
iterator iterAt(size_t pos)
{
if (pos > m_CurrentUsedSize)
assert(0);
return iterator(m_Data + pos);
}
bool reserve(size_t newSize)
{
return ChangeSize(newSize);
}
bool push_back(const T & elem)
{
++m_CurrentUsedSize;
if (!GrowIfNeeded())
{
--m_CurrentUsedSize;
return false;
}
m_Data[m_CurrentUsedSize - 1] = elem;
return true;
}
void pop_back()
{
--m_CurrentUsedSize;
if (m_CurrentUsedSize < 0)
m_CurrentUsedSize = 0;
// :TODO: free memory sometimes
}
bool resize(size_t newSize)
{
if (!ChangeSize(newSize))
return false;
FreeMemIfPossible();
return true;
}
bool empty() const
{
return (m_CurrentUsedSize == 0);
}
T & at(size_t pos)
{
if (pos > m_CurrentUsedSize)
{
assert(0);
}
return m_Data[pos];
}
const T & at(size_t pos) const
{
if (pos > m_CurrentUsedSize)
{
assert(0);
}
return m_Data[pos];
}
T & operator[](size_t pos)
{
return at(pos);
}
const T & operator[](size_t pos) const
{
return at(pos);
}
T & front()
{
if (m_CurrentUsedSize < 1)
{
assert(0);
}
return m_Data[0];
}
const T & front() const
{
if (m_CurrentUsedSize < 1)
{
assert(0);
}
return m_Data[0];
}
T & back()
{
if (m_CurrentUsedSize < 1)
{
assert(0);
}
return m_Data[m_CurrentUsedSize - 1];
}
const T & back() const
{
if (m_CurrentUsedSize < 1)
{
assert(0);
}
return m_Data[m_CurrentUsedSize - 1];
}
bool insert(iterator where, const T & value)
{
// we have to insert before
// if it is begin, don't decrement
if (where != m_Data)
--where;
// validate iter
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
return false;
++m_CurrentUsedSize;
if (!GrowIfNeeded())
{
--m_CurrentUsedSize;
return false;
}
memmove(where.base() + 1, where.base(), m_CurrentUsedSize - (where - m_Data));
memcpy(where.base(), &value, sizeof(T));
return true;
}
void erase(iterator where)
{
// validate iter
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
return false;
if (m_CurrentUsedSize > 1)
{
// move
memmove(where.base(), where.base() + 1, m_CurrentUsedSize - 1);
}
--m_CurrentUsedSize;
// :TODO: free memory sometimes
}
void clear()
{
m_Size = 0;
m_CurrentUsedSize = 0;
delete [] m_Data;
m_Data = NULL;
}
};
#endif // __CVECTOR_H__

340
amxmodx/CoreConfig.cpp Normal file
View File

@ -0,0 +1,340 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "CoreConfig.h"
#include "CLibrarySys.h"
#include <amxmodx_version.h>
CoreConfig CoreCfg;
const char *MainConfigFile = "amxx.cfg";
const char *AutoConfigDir = "/plugins";
const char *MapConfigDir = "/maps";
const char *CommandFormat = "exec %s\n";
CoreConfig::CoreConfig()
{
Clear();
}
CoreConfig::~CoreConfig()
{
}
void CoreConfig::OnAmxxInitialized()
{
m_ConfigsBufferedForward = registerForward("OnAutoConfigsBuffered", ET_IGNORE, FP_DONE);
m_ConfigsExecutedForward = registerForward("OnConfigsExecuted", ET_IGNORE, FP_DONE);
}
void CoreConfig::Clear()
{
m_ConfigsExecuted = false;
m_PendingForwardPush = false;
m_LegacyMainConfigExecuted = false;
m_LegacyMapConfigsExecuted = false,
m_legacyMapConfigNextTime = 0.0f;
}
void CoreConfig::ExecuteMainConfig()
{
if (m_LegacyMainConfigExecuted)
{
return;
}
char path[PLATFORM_MAX_PATH];
char command[PLATFORM_MAX_PATH + sizeof(CommandFormat)];
ke::SafeSprintf(path, sizeof(path), "%s/%s/%s", g_mod_name.chars(), get_localinfo("amxx_configsdir", "addons/amxmodx/configs"), MainConfigFile);
ke::SafeSprintf(command, sizeof(command), CommandFormat, path);
SERVER_COMMAND(command);
}
void CoreConfig::ExecuteAutoConfigs()
{
for (size_t i = 0; i < static_cast<size_t>(g_plugins.getPluginsNum()); ++i)
{
auto plugin = g_plugins.findPlugin(i);
bool can_create = true;
for (size_t j = 0; j < plugin->GetConfigCount(); ++j)
{
can_create = ExecuteAutoConfig(plugin, plugin->GetConfig(j), can_create);
}
}
executeForwards(m_ConfigsBufferedForward);
}
bool CoreConfig::ExecuteAutoConfig(CPluginMngr::CPlugin *plugin, AutoConfig *config, bool can_create)
{
bool will_create = false;
const char *configsDir = get_localinfo("amxx_configsdir", "addons/amxmodx/configs");
if (can_create && config->create)
{
will_create = true;
const char *folder = config->folder.chars();
char path[PLATFORM_MAX_PATH];
char build[PLATFORM_MAX_PATH];
build_pathname_r(path, sizeof(path), "%s%s/%s", configsDir, AutoConfigDir, folder);
if (!g_LibSys.IsPathDirectory(path))
{
char *cur_ptr = path;
g_LibSys.PathFormat(path, sizeof(path), "%s", folder);
build_pathname_r(build, sizeof(build), "%s%s", configsDir, AutoConfigDir);
size_t length = strlen(build);
do
{
char *next_ptr = cur_ptr;
while (*next_ptr != '\0')
{
if (*next_ptr == PLATFORM_SEP_CHAR)
{
*next_ptr = '\0';
next_ptr++;
break;
}
next_ptr++;
}
if (*next_ptr == '\0')
{
next_ptr = nullptr;
}
length += g_LibSys.PathFormat(&build[length], sizeof(build) - length, "/%s", cur_ptr);
if (!g_LibSys.CreateFolder(build))
{
break;
}
cur_ptr = next_ptr;
} while (cur_ptr);
}
}
char file[PLATFORM_MAX_PATH];
if (config->folder.length())
{
ke::SafeSprintf(file, sizeof(file), "%s/%s%s/%s/%s.cfg", g_mod_name.chars(), configsDir, AutoConfigDir, config->folder.chars(), config->autocfg.chars());
}
else
{
ke::SafeSprintf(file, sizeof(file), "%s/%s%s/%s.cfg", g_mod_name.chars(), configsDir, AutoConfigDir, config->autocfg.chars());
}
bool file_exists = g_LibSys.IsPathFile(file);
if (!file_exists && will_create)
{
auto list = g_CvarManager.GetCvarsList();
if (list->empty())
{
return can_create;
}
FILE *fp = fopen(file, "wt");
if (fp)
{
fprintf(fp, "// This file was auto-generated by AMX Mod X (v%s)\n", AMXX_VERSION);
if (*plugin->getTitle() && *plugin->getAuthor() && *plugin->getVersion())
{
fprintf(fp, "// Cvars for plugin \"%s\" by \"%s\" (%s, v%s)\n", plugin->getTitle(), plugin->getAuthor(), plugin->getName(), plugin->getVersion());
}
else
{
fprintf(fp, "// Cvars for plugin \"%s\"\n", plugin->getName());
}
fprintf(fp, "\n\n");
for (auto iter = list->begin(); iter != list->end(); iter++)
{
auto info = (*iter);
if (info->pluginId == plugin->getId())
{
char description[255];
char *ptr = description;
// Print comments until there is no more
strncopy(description, info->description.chars(), sizeof(description));
while (*ptr != '\0')
{
// Find the next line
char *next_ptr = ptr;
while (*next_ptr != '\0')
{
if (*next_ptr == '\n')
{
*next_ptr = '\0';
next_ptr++;
break;
}
next_ptr++;
}
fprintf(fp, "// %s\n", ptr);
ptr = next_ptr;
}
fprintf(fp, "// -\n");
fprintf(fp, "// Default: \"%s\"\n", info->defaultval.chars());
if (info->bound.hasMin)
{
fprintf(fp, "// Minimum: \"%02f\"\n", info->bound.minVal);
}
if (info->bound.hasMax)
{
fprintf(fp, "// Maximum: \"%02f\"\n", info->bound.maxVal);
}
fprintf(fp, "%s \"%s\"\n", info->var->name, info->defaultval.chars());
fprintf(fp, "\n");
}
}
fprintf(fp, "\n");
file_exists = true;
can_create = false;
fclose(fp);
}
else
{
AMXXLOG_Error("Failed to auto generate config for %s, make sure the directory has write permission.", plugin->getName());
return can_create;
}
}
if (file_exists)
{
char command[PLATFORM_MAX_PATH + sizeof(CommandFormat)];
ke::SafeSprintf(command, sizeof(command), CommandFormat, file);
SERVER_COMMAND(command);
}
return can_create;
}
void CoreConfig::ExecuteMapConfig()
{
const char *configsDir = get_localinfo("amxx_configsdir", "addons/amxmodx/configs");
char cfgPath[PLATFORM_MAX_PATH];
char mapName[PLATFORM_MAX_PATH];
char command[PLATFORM_MAX_PATH + sizeof(CommandFormat)];
strncopy(mapName, STRING(gpGlobals->mapname), sizeof(mapName));
char *mapPrefix;
if ((mapPrefix = strtok(mapName, "_")))
{
ke::SafeSprintf(cfgPath, sizeof(cfgPath), "%s/%s%s/prefix_%s.cfg", g_mod_name.chars(), configsDir, MapConfigDir, mapPrefix);
if (g_LibSys.IsPathFile(cfgPath))
{
ke::SafeSprintf(command, sizeof(command), CommandFormat, cfgPath);
SERVER_COMMAND(command);
}
}
strncopy(mapName, STRING(gpGlobals->mapname), sizeof(mapName));
ke::SafeSprintf(cfgPath, sizeof(cfgPath), "%s/%s%s/%s.cfg", g_mod_name.chars(), configsDir, MapConfigDir, mapName);
if (g_LibSys.IsPathFile(cfgPath))
{
ke::SafeSprintf(command, sizeof(command), CommandFormat, cfgPath);
SERVER_COMMAND(command);
}
// Consider all configs be executed to the next frame.
m_PendingForwardPush = true;
}
void CoreConfig::OnMapConfigTimer()
{
if (m_ConfigsExecuted)
{
return;
}
if (m_legacyMapConfigNextTime <= gpGlobals->time)
{
if (m_PendingForwardPush)
{
m_PendingForwardPush = false;
m_ConfigsExecuted = true;
executeForwards(m_ConfigsExecutedForward);
}
else if (!m_LegacyMapConfigsExecuted)
{
ExecuteMapConfig();
}
}
}
void CoreConfig::CheckLegacyBufferedCommand(char *command)
{
if (m_ConfigsExecuted)
{
return;
}
if (!m_LegacyMainConfigExecuted && strstr(command, MainConfigFile))
{
m_LegacyMainConfigExecuted = true;
}
if (!m_LegacyMapConfigsExecuted && strstr(command, MapConfigDir))
{
m_LegacyMapConfigsExecuted = true;
// Consider all configs be executed to m_legacyMapConfigNextTime time.
m_PendingForwardPush = true;
}
}
void CoreConfig::SetMapConfigTimer(float time)
{
m_legacyMapConfigNextTime = gpGlobals->time + time;
}

51
amxmodx/CoreConfig.h Normal file
View File

@ -0,0 +1,51 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef _CORE_CONFIG_H_
#define _CORE_CONFIG_H_
#include "CPlugin.h"
class CoreConfig
{
public:
CoreConfig();
~CoreConfig();
public:
void Clear();
void ExecuteMainConfig();
void ExecuteAutoConfigs();
bool ExecuteAutoConfig(CPluginMngr::CPlugin *plugin, AutoConfig *config, bool can_create);
void ExecuteMapConfig();
void OnAmxxInitialized();
void OnMapConfigTimer();
void CheckLegacyBufferedCommand(char *command);
void SetMapConfigTimer(float time);
private:
bool m_ConfigsExecuted; // Whether all configs have been executed
bool m_PendingForwardPush; // Whether OnConfigsExecuted forward should be triggered to the next frame
bool m_LegacyMainConfigExecuted; // Whether the old admin.sma is used and amxx.cfg was executed from there
bool m_LegacyMapConfigsExecuted; // Whether the old admin.sma is used and per-map config was executed from there
float m_legacyMapConfigNextTime; // Sets the next time that per-map configs should be executed
int m_ConfigsBufferedForward;
int m_ConfigsExecutedForward;
};
extern CoreConfig CoreCfg;
#endif // _CORE_CONFIG_H_

669
amxmodx/CvarManager.cpp Normal file
View File

@ -0,0 +1,669 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "CvarManager.h"
#include "amxmodx.h"
#include <CDetour/detours.h>
#include <auto-string.h>
#include <resdk/mod_rehlds_api.h>
CvarManager g_CvarManager;
void (*Cvar_DirectSet_Actual)(struct cvar_s* var, const char *value) = nullptr;
void Cvar_DirectSet_Custom(struct cvar_s *var, const char *value, IRehldsHook_Cvar_DirectSet *chain = nullptr)
{
CvarInfo* info = nullptr;
if (!var || !value // Sanity checks against bogus pointers.
|| strcmp(var->string, value) == 0 // Make sure old and new values are different to not trigger callbacks.
|| !g_CvarManager.CacheLookup(var->name, &info)) // No data in cache, nothing to do.
{
chain ? chain->callNext(var, value) : Cvar_DirectSet_Actual(var, value);
return;
}
if (info->bound.hasMin || info->bound.hasMax) // cvar_s doesn't have min/max mechanism, so we check things here.
{
float fvalue = atof(value);
bool oob = false;
if (info->bound.hasMin && fvalue < info->bound.minVal)
{
oob = true;
fvalue = info->bound.minVal;
}
else if (info->bound.hasMax && fvalue > info->bound.maxVal)
{
oob = true;
fvalue = info->bound.maxVal;
}
if (oob) // Found value out of bound, set new value and block original call.
{
CVAR_SET_FLOAT(var->name, fvalue);
return;
}
}
ke::AString oldValue; // We save old value since it will be likely changed after original function called.
if (!info->hooks.empty())
{
oldValue = var->string;
}
chain ? chain->callNext(var, value) : Cvar_DirectSet_Actual(var, value);
if (!info->binds.empty())
{
for (size_t i = 0; i < info->binds.length(); ++i)
{
CvarBind* bind = info->binds[i];
switch (bind->type)
{
case CvarBind::CvarType_Int:
{
*bind->varAddress = atoi(var->string);
break;
}
case CvarBind::CvarType_Float:
{
float fvalue = atof(var->string);
*bind->varAddress = amx_ftoc(fvalue);
break;
}
case CvarBind::CvarType_String:
{
set_amxstring_simple(bind->varAddress, var->string, bind->varLength);
break;
}
}
}
}
if (!info->hooks.empty())
{
for (size_t i = 0; i < info->hooks.length(); ++i)
{
CvarHook* hook = info->hooks[i];
if (hook->forward->state == AutoForward::FSTATE_OK) // Our callback can be enable/disabled by natives.
{
executeForwards(hook->forward->id, reinterpret_cast<cvar_t*>(var), oldValue.chars(), var->string);
}
}
}
}
void Cvar_DirectSet(struct cvar_s *var, const char *value)
{
Cvar_DirectSet_Custom(var, value);
}
void Cvar_DirectSet_RH(IRehldsHook_Cvar_DirectSet *chain, cvar_t *var, const char *value)
{
Cvar_DirectSet_Custom(var, value, chain);
}
CvarManager::CvarManager() : m_AmxmodxCvars(0), m_HookDetour(nullptr), m_ReHookEnabled(false)
{
}
CvarManager::~CvarManager()
{
OnAmxxShutdown();
}
void CvarManager::CreateCvarHook(void)
{
// void PF_Cvar_DirectSet(struct cvar_s *var, const char *value) // = pfnCvar_DirectSet
// {
// Cvar_DirectSet(var, value); // <- We want to hook this.
// }
if (!RehldsHookchains)
{
void *functionAddress = nullptr;
if (CommonConfig && CommonConfig->GetMemSig("Cvar_DirectSet", &functionAddress) && functionAddress)
{
// Disabled by default.
m_HookDetour = DETOUR_CREATE_STATIC_FIXED(Cvar_DirectSet, functionAddress);
}
else
{
AMXXLOG_Log("Binding/Hooking cvars have been disabled - %s.", RehldsApi ? "update ReHLDS" : "check your gamedata files");
}
}
}
void CvarManager::EnableHook()
{
if (RehldsHookchains)
{
if (!m_ReHookEnabled)
{
RehldsHookchains->Cvar_DirectSet()->registerHook(Cvar_DirectSet_RH);
m_ReHookEnabled = true;
}
}
else if (m_HookDetour)
{
m_HookDetour->EnableDetour();
}
}
void CvarManager::DisableHook()
{
if (RehldsHookchains)
{
if (m_ReHookEnabled)
{
RehldsHookchains->Cvar_DirectSet()->unregisterHook(Cvar_DirectSet_RH);
m_ReHookEnabled = false;
}
}
else if (m_HookDetour)
{
m_HookDetour->DisableDetour();
}
}
void CvarManager::DestroyHook()
{
DisableHook();
if (m_HookDetour)
{
m_HookDetour->Destroy();
}
}
CvarInfo* CvarManager::CreateCvar(const char* name, const char* value, const char* plugin, int pluginId, int flags,
const char* helpText)
{
cvar_t* var = nullptr;
CvarInfo* info = nullptr;
if (!CacheLookup(name, &info))
{
// Not cached - Is cvar already exist?
var = CVAR_GET_POINTER(name);
// Whether it exists, we need to prepare a new entry.
info = new CvarInfo(name, helpText, plugin, pluginId);
if (var)
{
// Cvar already exists. Just copy.
// "string" will be set after. "value" and "next" are automatically set.
info->var = var;
info->defaultval = var->string;
info->amxmodx = false;
}
else
{
// Registers a new cvar.
static cvar_t cvar_reg_helper;
// "string" will be set after. "value" and "next" are automatically set.
cvar_reg_helper.name = info->name.chars();
cvar_reg_helper.string = "";
cvar_reg_helper.flags = flags;
// Adds cvar to global list.
CVAR_REGISTER(&cvar_reg_helper);
// Registering can fail if name is already a registered command.
var = CVAR_GET_POINTER(name);
// If so, we can't go further.
if (!var)
{
delete info;
return nullptr;
}
// If ok, we got a valid pointer, we can copy.
info->var = var;
info->defaultval = value;
info->amxmodx = true;
// Keeps track count of cvars registered by AMXX.
++m_AmxmodxCvars;
}
// Add a new entry in the caches.
m_Cvars.append(info);
m_Cache.insert(name, info);
// Make sure that whether an existing or new cvar is set to the given value.
CVAR_DIRECTSET(var, value);
}
else if (info->pluginId == -1)
{
// In situation where a plugin has been modified/recompiled
// or new added plugins, and a change map occurs. We want to keep data up to date.
info->bound.hasMin = false;
info->bound.minVal = 0;
info->bound.hasMax = false;
info->bound.maxVal = 0;
info->defaultval = value;
info->description = helpText;
info->pluginId = pluginId;
}
// Detour is disabled on map change.
// Don't enable it unless there are things to do.
if ((info->bound.hasMin || info->bound.hasMax))
{
EnableHook();
}
return info;
}
CvarInfo* CvarManager::FindCvar(const char* name)
{
cvar_t* var = nullptr;
CvarInfo* info = nullptr;
// Do we have already cvar in cache?
if (CacheLookup(name, &info))
{
return info;
}
// Cvar doesn't exist.
if (!(var = CVAR_GET_POINTER(name)))
{
return nullptr;
}
// Create a new entry.
info = new CvarInfo(name);
info->var = var;
// Add entry in the caches.
m_Cvars.append(info);
m_Cache.insert(name, info);
return info;
}
CvarInfo* CvarManager::FindCvar(size_t index)
{
// Used by get_plugins_cvar native.
// For compatibility, only cvars registered by AMXX are concerned.
size_t iter_id = 0;
for (CvarsList::iterator iter = m_Cvars.begin(); iter != m_Cvars.end(); iter++)
{
if (iter->amxmodx && iter_id++ == index)
{
return *(iter);
}
}
return nullptr;
}
bool CvarManager::CacheLookup(const char* name, CvarInfo** info)
{
return m_Cache.retrieve(name, info);
}
AutoForward* CvarManager::HookCvarChange(cvar_t* var, AMX* amx, cell param, const char** callback)
{
CvarInfo* info = nullptr;
// A cvar is guaranteed to be in cache if pointer is got from
// get_cvar_pointer and register_cvar natives. Though it might be
// provided by another way. If by any chance we run in such
// situation, we create a new entry right now.
if (!CacheLookup(var->name, &info))
{
// Create a new entry.
info = new CvarInfo(var->name);
info->var = var;
// Add entry in the caches.
m_Cvars.append(info);
m_Cache.insert(info->name.chars(), info);
}
int length;
*callback = get_amxstring(amx, param, 0, length);
int forwardId = registerSPForwardByName(amx, *callback, FP_CELL, FP_STRING, FP_STRING, FP_DONE);
// Invalid callback, it could be: not a public function, wrongly named, or simply missing.
if (forwardId == -1)
{
return nullptr;
}
// Hook is disabled on map change.
EnableHook();
AutoForward* forward = new AutoForward(forwardId, *callback);
info->hooks.append(new CvarHook(g_plugins.findPlugin(amx)->getId(), forward));
return forward;
}
bool CvarManager::BindCvar(CvarInfo* info, CvarBind::CvarType type, AMX* amx, cell varofs, size_t varlen)
{
if (varofs > amx->hlw) // If variable address is not inside global area, we can't bind it.
{
LogError(amx, AMX_ERR_NATIVE, "Cvars can only be bound to global variables");
return false;
}
int pluginId = g_plugins.findPluginFast(amx)->getId();
cell* address = get_amxaddr(amx, varofs);
// To avoid unexpected behavior, probably better to error such situations.
for (size_t i = 0; i < info->binds.length(); ++i)
{
CvarBind* bind = info->binds[i];
if (bind->pluginId == pluginId)
{
if (bind->varAddress == address)
{
LogError(amx, AMX_ERR_NATIVE, "A global variable can not be bound to multiple Cvars");
return false;
}
}
}
CvarBind* bind = new CvarBind(pluginId, type, get_amxaddr(amx, varofs), varlen);
info->binds.append(bind);
// Update right away variable with current cvar value.
switch (type)
{
case CvarBind::CvarType_Int:
*bind->varAddress = atoi(info->var->string);
break;
case CvarBind::CvarType_Float:
*bind->varAddress = amx_ftoc(info->var->value);
break;
case CvarBind::CvarType_String:
set_amxstring_simple(bind->varAddress, info->var->string, bind->varLength);
break;
}
// Hook is disabled on map change.
EnableHook();
return true;
}
void CvarManager::SetCvarMin(CvarInfo* info, bool set, float value, int pluginId)
{
info->bound.hasMin = set;
info->bound.minPluginId = pluginId;
if (set)
{
// Hook is disabled on map change.
EnableHook();
info->bound.minVal = value;
// Current value is already in the allowed range.
if (info->var->value >= value)
{
return;
}
// Update if needed.
CVAR_SET_FLOAT(info->var->name, value);
}
}
void CvarManager::SetCvarMax(CvarInfo* info, bool set, float value, int pluginId)
{
info->bound.hasMax = set;
info->bound.maxPluginId = pluginId;
if (set)
{
// Hook is disabled on map change.
EnableHook();
info->bound.maxVal = value;
// Current value is already in the allowed range.
if (info->var->value <= value)
{
return;
}
// Update if needed.
CVAR_SET_FLOAT(info->var->name, value);
}
}
size_t CvarManager::GetRegCvarsCount()
{
return m_AmxmodxCvars;
}
CvarsList* CvarManager::GetCvarsList()
{
return &m_Cvars;
}
ke::AutoString convertFlagsToString(int flags)
{
ke::AutoString flagsName;
if (flags > 0)
{
if (flags & FCVAR_ARCHIVE) flagsName = flagsName + "FCVAR_ARCHIVE ";
if (flags & FCVAR_USERINFO) flagsName = flagsName + "FCVAR_USERINFO ";
if (flags & FCVAR_SERVER) flagsName = flagsName + "FCVAR_SERVER ";
if (flags & FCVAR_EXTDLL) flagsName = flagsName + "FCVAR_EXTDLL ";
if (flags & FCVAR_CLIENTDLL) flagsName = flagsName + "FCVAR_CLIENTDLL ";
if (flags & FCVAR_PROTECTED) flagsName = flagsName + "FCVAR_PROTECTED ";
if (flags & FCVAR_SPONLY) flagsName = flagsName + "FCVAR_SPONLY ";
if (flags & FCVAR_PRINTABLEONLY) flagsName = flagsName + "FCVAR_PRINTABLEONLY ";
if (flags & FCVAR_UNLOGGED) flagsName = flagsName + "FCVAR_UNLOGGED ";
if (flags & FCVAR_NOEXTRAWHITEPACE) flagsName = flagsName + "FCVAR_NOEXTRAWHITEPACE ";
}
if (!flagsName.length())
{
flagsName = "-";
}
return flagsName;
}
void CvarManager::OnConsoleCommand()
{
size_t index = 0;
size_t indexToSearch = 0;
ke::AString partialName;
int argcount = CMD_ARGC();
// amxx cvars [partial plugin name] [index from listing]
// E.g.:
// amxx cvars test <- list all cvars from plugin name starting by "test"
// amxx cvars 2 <- show informations about cvar in position 2 from "amxx cvars" list
// amxx cvars test 2 <- show informations about cvar in position 2 from "amxx cvars test" list
if (argcount > 2)
{
const char* argument = CMD_ARGV(2);
indexToSearch = atoi(argument); // amxx cvars 2
if (!indexToSearch)
{
partialName = argument; // amxx cvars test
if (argcount > 3) // amxx cvars test 2
{
indexToSearch = atoi(CMD_ARGV(3));
}
}
}
if (!indexToSearch)
{
print_srvconsole("\nManaged cvars:\n");
print_srvconsole(" %-24.23s %-24.23s %-18.17s %-8.7s %-8.7s %-8.7s\n", "NAME", "VALUE", "PLUGIN", "HOOKED", "MIN", "MAX");
print_srvconsole(" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
}
for (CvarsList::iterator iter = m_Cvars.begin(); iter != m_Cvars.end(); iter++)
{
CvarInfo* ci = (*iter);
// List any cvars having a status either created, hooked or bound by a plugin.
bool in_list = ci->amxmodx || !ci->binds.empty() || !ci->hooks.empty() || ci->bound.hasMin || ci->bound.hasMax;
if (in_list && (!partialName.length() || strncmp(ci->plugin.chars(), partialName.chars(), partialName.length()) == 0))
{
if (!indexToSearch)
{
print_srvconsole(" [%3d] %-24.23s %-24.23s %-18.17s %-8.7s ", ++index, ci->name.chars(), ci->var->string,
ci->plugin.length() ? ci->plugin.chars() : "-",
ci->hooks.empty() ? "no" : "yes");
(ci->bound.hasMin) ? print_srvconsole("%-8.2f ", ci->bound.minVal) : print_srvconsole("%-8.7s ", "-");
(ci->bound.hasMax) ? print_srvconsole("%-8.2f ", ci->bound.maxVal) : print_srvconsole("%-8.7s ", "-");
print_srvconsole("\n");
}
else
{
if (++index != indexToSearch)
{
continue;
}
print_srvconsole("\nCvar details :\n\n");
print_srvconsole(" Cvar name : %s\n", ci->var->name);
print_srvconsole(" Value : %s\n", ci->var->string);
print_srvconsole(" Def. value : %s\n", ci->defaultval.chars());
print_srvconsole(" Description : %s\n", ci->description.chars());
print_srvconsole(" Flags : %s\n\n", convertFlagsToString(ci->var->flags).ptr());
print_srvconsole(" %-12s %-26.25s %s\n", "STATUS", "PLUGIN", "INFOS");
print_srvconsole(" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n");
if (ci->amxmodx)
{
print_srvconsole(" Registered %-26.25s %s\n", ci->plugin.chars(), "-");
}
if (ci->bound.hasMin)
{
print_srvconsole(" Min value %-26.25s %f\n", g_plugins.findPlugin(ci->bound.minPluginId)->getName(), ci->bound.minVal);
}
if (ci->bound.hasMax)
{
print_srvconsole(" Max value %-26.25s %f\n", g_plugins.findPlugin(ci->bound.maxPluginId)->getName(), ci->bound.maxVal);
}
if (!ci->binds.empty())
{
for (size_t i = 0; i < ci->binds.length(); ++i)
{
print_srvconsole(" Bound %-26.25s %s\n", g_plugins.findPlugin(ci->binds[i]->pluginId)->getName(), "-");
}
}
if (!ci->hooks.empty())
{
for (size_t i = 0; i < ci->hooks.length(); ++i)
{
CvarHook* hook = ci->hooks[i];
print_srvconsole(" Hooked %-26.25s %s (%s)\n", g_plugins.findPlugin(hook->pluginId)->getName(),
hook->forward->callback.chars(),
hook->forward->state == AutoForward::FSTATE_OK ? "active" : "inactive");
}
}
break;
}
}
}
}
void CvarManager::OnPluginUnloaded()
{
// Clear only plugin hooks list.
for (CvarsList::iterator cvar = m_Cvars.begin(); cvar != m_Cvars.end(); cvar++)
{
for (size_t i = 0; i < (*cvar)->binds.length(); ++i)
{
delete (*cvar)->binds[i];
}
for (size_t i = 0; i < (*cvar)->hooks.length(); ++i)
{
delete (*cvar)->hooks[i];
}
if ((*cvar)->amxmodx) // Mark registered cvars so we can refresh default datas at next map.
{
(*cvar)->pluginId = -1;
}
(*cvar)->binds.clear();
(*cvar)->hooks.clear();
}
// There is no point to enable hook if at next map change
// no plugins hook cvars.
DisableHook();
}
void CvarManager::OnAmxxShutdown()
{
// Free everything.
CvarsList::iterator iter = m_Cvars.begin();
while (iter != m_Cvars.end())
{
CvarInfo* cvar = (*iter);
for (size_t i = 0; i < cvar->binds.length(); ++i)
{
delete cvar->binds[i];
}
for (size_t i = 0; i < cvar->hooks.length(); ++i)
{
delete cvar->hooks[i];
}
iter = m_Cvars.erase(iter);
delete cvar;
}
m_Cache.clear();
DestroyHook();
}

177
amxmodx/CvarManager.h Normal file
View File

@ -0,0 +1,177 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef CVARS_H
#define CVARS_H
#include "amxmodx.h"
#include <amtl/am-vector.h>
#include <amtl/am-inlinelist.h>
#include <sm_namehashset.h>
#include "CGameConfigs.h"
class CDetour;
enum CvarBounds
{
CvarBound_Upper = 0,
CvarBound_Lower
};
struct AutoForward
{
enum fwdstate
{
FSTATE_INVALID = 0,
FSTATE_OK,
FSTATE_STOP,
};
AutoForward(int id_, const char* handler) : id(id_), state(FSTATE_OK), callback(handler) {};
AutoForward() : id(-1) , state(FSTATE_INVALID) {};
~AutoForward()
{
unregisterSPForward(id);
}
int id;
fwdstate state;
ke::AString callback;
};
struct CvarHook
{
CvarHook(int id, AutoForward* fwd) : pluginId(id), forward(fwd) {};
CvarHook(int id) : pluginId(id), forward(new AutoForward()) {};
int pluginId;
ke::AutoPtr<AutoForward> forward;
};
struct CvarBind
{
enum CvarType
{
CvarType_Int,
CvarType_Float,
CvarType_String,
};
CvarBind(int id_, CvarType type_, cell* varAddress_, size_t varLength_)
:
pluginId(id_),
type(type_),
varAddress(varAddress_),
varLength(varLength_) {};
int pluginId;
CvarType type;
cell* varAddress;
size_t varLength;
};
struct CvarBound
{
CvarBound()
:
hasMin(false), minVal(0),
hasMax(false), maxVal(0),
minPluginId(-1),
maxPluginId(-1) {};
bool hasMin;
float minVal;
bool hasMax;
float maxVal;
int minPluginId;
int maxPluginId;
};
typedef ke::Vector<CvarHook*> CvarsHook;
typedef ke::Vector<CvarBind*> CvarsBind;
struct CvarInfo : public ke::InlineListNode<CvarInfo>
{
CvarInfo(const char* name_, const char* helpText, const char* plugin_, int pluginId_)
:
name(name_), description(helpText),
plugin(plugin_), pluginId(pluginId_), bound() {};
CvarInfo(const char* name_)
:
name(name_), defaultval(""), description(""),
plugin(""), pluginId(-1), bound(), amxmodx(false) {};
cvar_t* var;
ke::AString name;
ke::AString defaultval;
ke::AString description;
ke::AString plugin;
int pluginId;
CvarBound bound;
CvarsBind binds;
CvarsHook hooks;
bool amxmodx;
static inline bool matches(const char *name, const CvarInfo* info)
{
return strcmp(name, info->var->name) == 0;
}
};
typedef NameHashSet<CvarInfo*> CvarsCache;
typedef ke::InlineList<CvarInfo> CvarsList;
class CvarManager
{
public:
CvarManager();
~CvarManager();
public:
void CreateCvarHook();
void EnableHook();
void DisableHook();
void DestroyHook();
CvarInfo* CreateCvar(const char* name, const char* value, const char* plugin, int pluginId, int flags = 0, const char* helpText = "");
CvarInfo* FindCvar(const char* name);
CvarInfo* FindCvar(size_t index);
bool CacheLookup(const char* name, CvarInfo** info);
AutoForward* HookCvarChange(cvar_t* var, AMX* amx, cell param, const char** callback);
bool BindCvar(CvarInfo* info, CvarBind::CvarType type, AMX* amx, cell varofs, size_t varlen = 0);
void SetCvarMin(CvarInfo* info, bool set, float value, int pluginId);
void SetCvarMax(CvarInfo* info, bool set, float value, int pluginId);
size_t GetRegCvarsCount();
CvarsList* GetCvarsList();
void OnConsoleCommand();
void OnPluginUnloaded();
void OnAmxxShutdown();
private:
CvarsCache m_Cache;
CvarsList m_Cvars;
size_t m_AmxmodxCvars;
CDetour* m_HookDetour;
bool m_ReHookEnabled;
};
extern CvarManager g_CvarManager;
#endif // CVARS_H

Binary file not shown.

Binary file not shown.

View File

@ -1,123 +0,0 @@
MODNAME = amxx_mm
SRCFILES = meta_api.cpp CFile.cpp CString.cpp CVault.cpp vault.cpp\
float.cpp file.cpp modules.cpp CMisc.cpp CTask.cpp string.cpp\
amxmodx.cpp CEvent.cpp CCmd.cpp CLogEvent.cpp srvcmd.cpp strptime.cpp\
CForward.cpp CPlugin.cpp CModule.cpp CMenu.cpp emsg.cpp util.cpp \
amxcore.cpp amxtime.cpp power.cpp amxxlog.cpp fakemeta.cpp mmgr/mmgr.cpp \
amxxfile.cpp CLang.cpp md5.cpp amx.cpp
#use this for amd64, remove the above amx.cpp, and rename amx.cpp to amx.c
#CSRCFILES = amx.c minilzo/minilzo.c
CSRCFILES = minilzo/minilzo.c
EXTRA_LIBS_LINUX =
EXTRA_LIBS_WIN32 =
EXTRA_LIBDIRS_LINUX = -Lextra/lib_linux
EXTRA_LIBDIRS_WIN32 = -Lextra/lib_win32
EXTRA_INCLUDEDIRS = -Iextra/include
EXTRA_FLAGS = -Dstrcmpi=strcasecmp
SDKTOP=../hlsdk
METADIR=../metamod/metamod
SDKSRC=$(SDKTOP)/SourceCode
OBJDIR_LINUX=obj.linux
OBJDIR_WIN32=obj.win32
SRCDIR=.
ifdef windir
OS=WIN32
else
OS=LINUX
endif
CC_LINUX=gcc
ifeq "$(OS)" "WIN32"
CC_WIN32=gcc
LD_WINDLL=dllwrap
DEFAULT=win32
CLEAN=clean_win32
else
CC_WIN32=/usr/local/cross-tools/i386-mingw32msvc/bin/gcc
LD_WINDLL=/usr/local/cross-tools/bin/i386-mingw32msvc-dllwrap
DEFAULT=linux win32
CLEAN=clean_both
endif
#use this for AMD64
#LIBFILE_LINUX = $(MODNAME)_amd64.so
LIBFILE_LINUX = $(MODNAME)_i386.so
LIBFILE_WIN32 = $(MODNAME).dll
TARGET_LINUX = $(OBJDIR_LINUX)/$(LIBFILE_LINUX)
TARGET_WIN32 = $(OBJDIR_WIN32)/$(LIBFILE_WIN32)
FILES_ALL = *.cpp *.h [A-Z]* *.rc
ifeq "$(OS)" "LINUX"
ASRCFILES := $(shell ls -t $(SRCFILES))
else
ASRCFILES := $(shell dir /b)
endif
OBJ_LINUX := $(SRCFILES:%.cpp=$(OBJDIR_LINUX)/%.o)
OBJC_LINUX := $(CSRCFILES:%.c=$(OBJDIR_LINUX)/%.o)
OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o)
OBJC_WIN32 := $(CSRCFILES:%.c=$(OBJDIR_WIN32)/%.o)
#use this for amd64
#CCOPT = -m64 -g -ggdb3 -DHAVE_I64 -DSMALL_CELL_SIZE=64
CCOPT = -march=i386 -s -DNDEBUG -O2 -fomit-frame-pointer -fno-exceptions -fno-rtti -ffast math
INCLUDEDIRS=-I../curl/include -I$(SRCDIR) -I$(METADIR) -I$(SDKSRC)/engine -I$(SDKSRC)/common -I$(SDKSRC)/pm_shared -I$(SDKSRC)/dlls -I$(SDKSRC) $(EXTRA_INCLUDEDIRS)
CFLAGS=-Wall -Wno-unknown-pragmas
ODEF = -DOPT_TYPE=\"optimized\"
CFLAGS:=$(CCOPT) $(CFLAGS) $(ODEF) $(EXTRA_FLAGS)
DO_CC_LINUX=$(CC_LINUX) $(CFLAGS) -fPIC $(INCLUDEDIRS) -o $@ -c $<
DO_CC_WIN32=$(CC_WIN32) $(CFLAGS) $(INCLUDEDIRS) -o $@ -c $<
LINK_LINUX=$(CC_LINUX) $(CFLAGS) -shared -ldl -lm $(OBJ_LINUX) $(OBJC_LINUX) $(EXTRA_LIBDIRS_LINUX) $(EXTRA_LIBS_LINUX) -o $@
LINK_WIN32=$(LD_WINDLL) -mwindows --def $(MODNAME).def --add-stdcall-alias $(OBJ_WIN32) $(OBJC_WIN32) $(EXTRA_LIBDIRS_WIN32) $(EXTRA_LIBS_WIN32) -o $@
$(OBJDIR_LINUX)/%.o: $(SRCDIR)/%.c
$(DO_CC_LINUX)
$(OBJDIR_LINUX)/%.o: $(SRCDIR)/%.cpp
$(DO_CC_LINUX)
$(OBJDIR_WIN32)/%.o: $(SRCDIR)/%.c
$(DO_CC_WIN32)
$(OBJDIR_WIN32)/%.o: $(SRCDIR)/%.cpp
$(DO_CC_WIN32)
default: $(DEFAULT)
$(TARGET_LINUX): $(OBJDIR_LINUX) $(OBJ_LINUX) $(OBJC_LINUX)
$(LINK_LINUX)
$(TARGET_WIN32): $(OBJDIR_WIN32) $(OBJ_WIN32) $(OBJC_WIN32)
$(LINK_WIN32)
$(OBJDIR_LINUX):
mkdir $@
mkdir $@/mmgr
$(OBJDIR_WIN32):
mkdir $@
mkdir $@/mmgr
win32: $(TARGET_WIN32)
linux: $(TARGET_LINUX)
clean: $(CLEAN)
clean_both:
-rm -f $(OBJDIR_LINUX)/*
-rm -f $(OBJDIR_WIN32)/*
clean_win32:
del /q $(OBJDIR_WIN32)

View File

@ -1,256 +0,0 @@
#!/usr/bin/perl
#(C)2004 AMX Mod X Development Team
# by David "BAILOPAN" Anderson
# output will occur in bin.x.proc
# where x is debug or opt and proc is ix86 or amd64
# You must use this script from the amxmodx src dir
#options =
# jit - use the JIT
# debug - enable gdb debugging
# amd64 - compile for AMD64 (impiles no jit)
# proc=ix86 - assumed not amd64
# clean - clean the specifications above
# asm - for ASM implementation
# !! TODO - add memory mananger support
# lineop - for JIT only, uses slow version
$PROJECT = "amxmodx_mm";
$sdk = "../hlsdk/SourceCode";
$mm = "../metamod/metamod";
$gccf = "gcc";
$ccf = "cc";
$amd64_lstdc = "-lstdc++";
@CPP_SOURCE_FILES = ("meta_api.cpp", "CFile.cpp", "CVault.cpp", "vault.cpp", "float.cpp", "file.cpp", "modules.cpp", "CMisc.cpp", "CTask.cpp", "string.cpp", "amxmodx.cpp", "CEvent.cpp", "CCmd.cpp", "CLogEvent.cpp", "srvcmd.cpp", "strptime.cpp", "amxcore.cpp", "amxtime.cpp", "power.cpp", "amxxlog.cpp", "fakemeta.cpp", "amxxfile.cpp", "CLang.cpp", "md5.cpp", "emsg.cpp", "CForward.cpp", "CPlugin.cpp", "CModule.cpp", "CMenu.cpp", "util.cpp");
@C_SOURCE_FILES = ();
my %OPTIONS, %OPT;
$OPT{"debug"} = "-g -ggdb";
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\" -fno-exceptions -fno-rtti";
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
while ($cmd = shift)
{
if ($cmd =~ /asm/)
{
if ($OPTIONS{"amd64"})
{
die "You cannot compile the ASM core with AMD64 yet.\n";
} else {
$OPTIONS{"asm"} = 1;
}
}
if ($cmd =~ /jit/)
{
if ($OPTIONS{"amd64"})
{
die "You cannot compile the JIT and AMD64 yet.\n";
} else {
$OPTIONS{"jit"} = 1;
}
} elsif ($cmd =~ /amd64/) {
if ($OPTIONS{"jit"} || $OPTIONS{"asm"})
{
die "You cannot compile the JIT or ASM and AMD64 yet.\n";
} else {
$OPTIONS{"amd64"} = 1;
}
} elsif ($cmd =~ /debug/) {
$OPTIONS{"debug"} = 1;
} elsif ($cmd =~ /proc=i(\d)86/) {
$proc = $1;
if ($OPTIONS{"amd64"})
{
die "You cannot compile for i".$proc."86 and AMD64.\n";
} else {
$OPTIONS{"proc"} = "i".$proc."86";
}
} elsif ($cmd =~ /clean/) {
$OPTIONS{"clean"} = 1;
} elsif ($cmd =~ /lineop/) {
$OPTIONS{"lineop"} = 1;
}
}
$gcc = `$gccf --version`;
if ($gcc =~ /2\.9/)
{
#if ($OPTIONS{"jit"})
#{
# push(@CPP_SOURCE_FILES, "amx.cpp");
# $OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
# } else {
`ln -s amx.cpp amx.c`;
push(@C_SOURCE_FILES, "amx.c");
# }
} else {
if ($OPTIONS{"amd64"})
{
`ln -s amx.cpp amx.c`;
push(@C_SOURCE_FILES, "amx.c");
} else {
push(@CPP_SOURCE_FILES, "amx.cpp");
}
$OPT{"opt"} .= " -falign-loops=2 -falign-jumps=2 -falign-functions=2";
}
if ($OPTIONS{"debug"})
{
$cflags = $OPT{"debug"};
} else {
if (!$OPTIONS{"amd64"})
{
$proc = $OPTIONS{"proc"};
if (!$proc)
{
$proc = 3;
}
$cflags = "-march=i".$proc."86 ".$OPT{"opt"};
} else {
$cflags = $OPT{"opt"};
}
}
if ($OPTIONS{"amd64"})
{
$cflags = " -m64 -DSMALL_CELL_SIZE=64 -DHAVE_I64 $cflags";
}
if ($OPTIONS{"jit"})
{
$cflags .= " -DJIT";
}
if ($OPTIONS{"asm"})
{
$cflags .= " -DASM32";
}
if ($OPTIONS{"debug"})
{
$outdir = "bin.debug";
} else {
$outdir = "bin.opt";
}
if ($OPTIONS{"amd64"})
{
$outdir .= ".amd64";
$bin = $PROJECT."_amd64.so";
} else {
$proc = $OPTIONS{"proc"};
if ($proc)
{
$outdir .= ".i".$proc."86";
$bin = $PROJECT."_i".$proc."86.so";
} else {
$outdir .= ".i386";
$bin = $PROJECT."_i386.so";
}
}
if ($OPTIONS{"clean"})
{
`rm $outdir/*.o`;
`rm $outdir/$bin`;
die("Project cleaned.\n");
}
#create the dirs
#build link list
my @LINK;
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
{
$file = $CPP_SOURCE_FILES[$i];
$file =~ s/\.cpp/\.o/;
push(@LINK, $outdir."/".$file);
}
for ($i=0; $i<=$#C_SOURCE_FILES; $i++)
{
$file = $C_SOURCE_FILES[$i];
$file =~ s/\.c/\.o/;
push(@LINK, $outdir."/".$file);
}
if ($OPTIONS{"jit"})
{
if ($OPTIONS{"lineop"}) {
push(@LINK, "JIT/jits-lineop.o");
} else {
push(@LINK, "JIT/jits.o");
}
}
if ($OPTIONS{"amd64"})
{
push(@LINK, "zlib/libz64.a");
push(@LINK, $amd64_lstdc);
} else {
push(@LINK, "zlib/libz.a");
}
if ($OPTIONS{"asm"})
{
push(@LINK, "amxexecn.o");
}
if (!(-d $outdir))
{
mkdir($outdir);
}
if (!(-d "$outdir/JIT"))
{
mkdir("$outdir/JIT");
}
$inc = $OPTIONS{"include"};
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
{
$file = $CPP_SOURCE_FILES[$i];
$ofile = $file;
$ofile =~ s/\.cpp/\.o/;
$ofile = "$outdir/$ofile";
$gcc = "$gccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
if (-e $ofile)
{
$file_time = (stat($file))[9];
$ofile_time = (stat($ofile))[9];
if ($file_time > $ofile_time)
{
`rm $ofile`;
print "$gcc\n";
`$gcc`;
}
} else {
print "$gcc\n";
`$gcc`;
}
}
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
{
$file = $C_SOURCE_FILES[$i];
$ofile = $file;
$ofile =~ s/\.c/\.o/;
$ofile = "$outdir/$ofile";
$gcc = "$ccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
if (-e $ofile)
{
$file_time = (stat($file))[9];
$ofile_time = (stat($ofile))[9];
if ($file_time > $ofile_time)
{
print "$gcc\n";
`$gcc`;
}
} else {
print "$gcc\n";
`$gcc`;
}
}
$gcc = "$gccf $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
print "$gcc\n";
`$gcc`;

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/* Abstract Machine for the Small compiler
/* Pawn Abstract Machine (for the Pawn language)
*
* Copyright (c) ITB CompuPhase, 1997-2004
* Copyright (c) ITB CompuPhase, 1997-2005
*
* This software is provided "as-is", without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
@ -17,57 +17,83 @@
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
* Version: $Id$
*/
#if defined __linux__
#if defined FREEBSD && !defined __FreeBSD__
#define __FreeBSD__
#endif
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined __APPLE__
#include <sclinux.h>
#endif
#ifndef AMX_H_INCLUDED
#define AMX_H_INCLUDED
#if defined __LCC__ || defined __DMC__ || defined __linux__
#if defined HAVE_STDINT_H
#include <stdint.h>
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
/* The ISO C99 defines the int16_t and int_32t types. If the compiler got
* here, these types are probably undefined.
*/
#if defined __FreeBSD__
#include <inttypes.h>
#else
typedef short int int16_t;
typedef unsigned short int uint16_t;
#if defined SN_TARGET_PS2
typedef int int32_t;
typedef unsigned int uint32_t;
#else
#if defined __LCC__ || defined __DMC__ || defined LINUX || defined __APPLE__
#if defined HAVE_INTTYPES_H
#include <inttypes.h>
#else
typedef long int int32_t;
typedef unsigned long int uint32_t;
#include <stdint.h>
#endif
#if defined __WIN32__ || defined _WIN32 || defined WIN32
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#define HAVE_I64
#elif defined __GNUC__
typedef long long int64_t;
typedef unsigned long long uint64_t;
#define HAVE_I64
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
/* The ISO C99 defines the int16_t and int_32t types. If the compiler got
* here, these types are probably undefined.
*/
#if defined __MACH__
#include <ppc/types.h>
typedef unsigned short int uint16_t;
typedef unsigned long int uint32_t;
#elif defined __FreeBSD__
#include <inttypes.h>
#else
typedef short int int16_t;
typedef unsigned short int uint16_t;
#if defined SN_TARGET_PS2
typedef int int32_t;
typedef unsigned int uint32_t;
#else
typedef long int int32_t;
typedef unsigned long int uint32_t;
#endif
#if defined __WIN32__ || defined _WIN32 || defined WIN32
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#define HAVE_I64
#elif defined __GNUC__
typedef long long int64_t;
typedef unsigned long long uint64_t;
#define HAVE_I64
#endif
#endif
#endif
#define HAVE_STDINT_H
#endif
#if defined _LP64 || defined WIN64 || defined _WIN64
#if !defined __64BIT__
#define __64BIT__
#endif
#endif
#if defined __WIN32__ || defined _WIN32 || defined WIN32 /* || defined __MSDOS__ */
#if !defined alloca
#define alloca(n) _alloca(n)
#endif
#if !defined arraysize
#define arraysize(array) (sizeof(array) / sizeof((array)[0]))
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if defined PAWN_DLL
#if !defined AMX_NATIVE_CALL
#define AMX_NATIVE_CALL __stdcall
#endif
#if !defined AMXAPI
#define AMXAPI __stdcall
#endif
#endif
/* calling convention for native functions */
#if !defined AMX_NATIVE_CALL
#define AMX_NATIVE_CALL
@ -78,6 +104,8 @@ extern "C" {
#define AMXAPI __stdcall
#elif defined CDECL
#define AMXAPI __cdecl
#elif defined GCC_HASCLASSVISIBILITY
#define AMXAPI __attribute__ ((visibility("default")))
#else
#define AMXAPI
#endif
@ -95,46 +123,39 @@ extern "C" {
* 5 (tagnames table) 4
* 6 (reformatted header) 6
* 7 (name table, opcodes SYMTAG & SYSREQ.D) 7
* 8 (opcode STMT, renewed debug interface) 8
*/
#define CUR_FILE_VERSION 7 /* current file version; also the current AMX version */
#define CUR_FILE_VERSION 8 /* current file version; also the current AMX version */
#define MIN_FILE_VERSION 6 /* lowest supported file format version for the current AMX version */
#define MIN_AMX_VERSION 7 /* minimum AMX version needed to support the current file format */
#define MIN_AMX_VERSION 8 /* minimum AMX version needed to support the current file format */
#if defined BIT16
#define SMALL_CELL_SIZE 16 /* for backward compatibility */
#if !defined PAWN_CELL_SIZE
#define PAWN_CELL_SIZE 32 /* by default, use 32-bit cells */
#endif
#if !defined SMALL_CELL_SIZE
#define SMALL_CELL_SIZE 32 /* by default, use 32-bit cells */
#endif
#if SMALL_CELL_SIZE==16
#if PAWN_CELL_SIZE==16
typedef uint16_t ucell;
typedef int16_t cell;
#elif SMALL_CELL_SIZE==32
#elif PAWN_CELL_SIZE==32
typedef uint32_t ucell;
typedef int32_t cell;
#elif SMALL_CELL_SIZE==64
#define REAL float
#elif PAWN_CELL_SIZE==64
typedef uint64_t ucell;
typedef int64_t cell;
#define REAL double
#else
#error Unsupported cell size (SMALL_CELL_SIZE)
#error Unsupported cell size (PAWN_CELL_SIZE)
#endif
#if SMALL_CELL_SIZE==32
#define REAL float
#elif SMALL_CELL_SIZE==64
#define REAL double
#else
#error Unsupported cell size
#endif
#define UNPACKEDMAX ((1 << (sizeof(cell)-1)*8) - 1)
#define UNPACKEDMAX ((1L << (sizeof(cell)-1)*8) - 1)
#define UNLIMITED (~1u >> 1)
struct tagAMX;
typedef cell (AMX_NATIVE_CALL *AMX_NATIVE)(struct tagAMX *amx, cell *params);
typedef int (AMXAPI *AMX_CALLBACK)(struct tagAMX *amx, cell index,
cell *result, cell *params);
typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
typedef int (AMXAPI *AMX_DEBUGCALL)(struct tagAMX *amx, int mode);
typedef int (AMXAPI *AMX_NATIVE_FILTER)(struct tagAMX *amx, int index);
#if !defined _FAR
#define _FAR
#endif
@ -143,12 +164,20 @@ typedef int (AMXAPI *AMX_DEBUGCALL)(struct tagAMX *amx, int mode);
#pragma warning(disable:4103) /* disable warning message 4103 that complains
* about pragma pack in a header file */
#pragma warning(disable:4100) /* "'%$S' : unreferenced formal parameter" */
#if _MSC_VER >= 1400
// MSVC8 - Replace POSIX stricmp with ISO C++ conformant one as it is deprecated
#define stricmp _stricmp
// Need this because of some stupid bug
#pragma warning (disable : 4996)
#endif
#endif
/* Some compilers do not support the #pragma align, which should be fine. Some
* compilers give a warning on unknown #pragmas, which is not so fine...
*/
#if defined SN_TARGET_PS2 || defined __GNUC__
#if (defined SN_TARGET_PS2 || defined __GNUC__) && !defined AMX_NO_ALIGN
#define AMX_NO_ALIGN
#endif
@ -159,8 +188,10 @@ typedef int (AMXAPI *AMX_DEBUGCALL)(struct tagAMX *amx, int mode);
#endif
#if !defined AMX_NO_ALIGN
#if defined __linux__
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
#pragma pack(1) /* structures must be packed (byte-aligned) */
#elif defined MACOS && defined __MWERKS__
#pragma options align=mac68k
#else
#pragma pack(push)
#pragma pack(1) /* structures must be packed (byte-aligned) */
@ -170,25 +201,30 @@ typedef int (AMXAPI *AMX_DEBUGCALL)(struct tagAMX *amx, int mode);
#endif
#endif
typedef struct {
typedef struct tagAMX_NATIVE_INFO {
const char _FAR *name PACKED;
AMX_NATIVE func PACKED;
} AMX_NATIVE_INFO;
} PACKED AMX_NATIVE_INFO;
#define AMX_USERNUM 4
#define sEXPMAX 19 /* maximum name length for file version <= 6 */
#define sNAMEMAX 31 /* maximum name length of symbol name */
#define sNAMEMAX 63 /* maximum name length of symbol name */
typedef struct tagAMX_FUNCSTUB {
ucell address PACKED;
const char name[sEXPMAX+1] PACKED;
} AMX_FUNCSTUB;
ucell address PACKED;
char name[sEXPMAX+1];
} PACKED AMX_FUNCSTUB;
typedef struct tagFUNCSTUBNT {
ucell address PACKED;
ucell nameofs PACKED; //we need this for amxx to be backwards comaptible
} PACKED AMX_FUNCSTUBNT;
/* The AMX structure is the internal structure for many functions. Not all
* fields are valid at all times; many fields are cached in local variables.
*/
typedef struct tagAMX {
unsigned char _FAR *base PACKED; /* points to the AMX header ("amxhdr") plus the code, optionally also the data */
unsigned char _FAR *base PACKED; /* points to the AMX header plus the code, optionally also the data */
unsigned char _FAR *data PACKED; /* points to separate data+stack+heap, may be NULL */
AMX_CALLBACK callback PACKED;
AMX_DEBUG debug PACKED; /* debug callback */
@ -200,28 +236,26 @@ typedef struct tagAMX {
cell stk PACKED; /* stack pointer: relative to base + amxhdr->dat */
cell stp PACKED; /* top of the stack: relative to base + amxhdr->dat */
int flags PACKED; /* current status, see amx_Flags() */
/* for assertions and debug hook */
cell curline PACKED;
cell curfile PACKED;
int dbgcode PACKED;
cell dbgaddr PACKED;
cell dbgparam PACKED;
char _FAR *dbgname PACKED;
/* user data */
long usertags[AMX_USERNUM] PACKED;
void _FAR *usertags[AMX_USERNUM] PACKED;
//okay userdata[3] in AMX Mod X is for the CPlugin * pointer
//we're also gonna set userdata[2] to a special debug structure
//lastly, userdata[1] is for opcode_list from amx_BrowseRelocate
void _FAR *userdata[AMX_USERNUM] PACKED;
/* native functions can raise an error */
int error PACKED;
/* passing parameters requires a "count" field */
int paramcount;
/* the sleep opcode needs to store the full AMX status */
cell pri PACKED;
cell alt PACKED;
cell reset_stk PACKED;
cell reset_hea PACKED;
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
/* support variables for the JIT */
/* support variables for the JIT */
int reloc_size PACKED; /* required temporary buffer for relocations */
long code_size PACKED; /* estimated memory footprint of the native code */
} AMX;
} PACKED AMX;
/* The AMX_HEADER structure is both the memory format as the file format. The
* structure is used internaly.
@ -229,8 +263,8 @@ typedef struct tagAMX {
typedef struct tagAMX_HEADER {
int32_t size PACKED; /* size of the "file" */
uint16_t magic PACKED; /* signature */
char file_version PACKED; /* file format version */
char amx_version PACKED; /* required version of the AMX */
char file_version; /* file format version */
char amx_version; /* required version of the AMX */
int16_t flags PACKED;
int16_t defsize PACKED; /* size of a definition record */
int32_t cod PACKED; /* initial value of COD - code block */
@ -243,26 +277,11 @@ typedef struct tagAMX_HEADER {
int32_t libraries PACKED; /* offset to the table of libraries */
int32_t pubvars PACKED; /* the "public variables" table */
int32_t tags PACKED; /* the "public tagnames" table */
int32_t nametable PACKED; /* name table, file version 7 only */
} AMX_HEADER PACKED;
#define AMX_MAGIC 0xf1e0
int32_t nametable PACKED; /* name table */
} PACKED AMX_HEADER;
//double linked list for stack
typedef struct tagAMX_TRACE
{
cell line PACKED;
cell file PACKED;
struct tagAMX_TRACE *next PACKED;
struct tagAMX_TRACE *prev PACKED;
} AMX_TRACE PACKED;
typedef struct tagAMX_DBG
{
int32_t numFiles PACKED; /* number of chars in array */
char **files PACKED; /* array of files */
AMX_TRACE *head PACKED; /* begin of link list */
AMX_TRACE *tail PACKED; /* end of link list */
} AMX_DBG PACKED;
//This is always the same for us
#define AMX_MAGIC 0xf1e0
enum {
AMX_ERR_NONE,
@ -279,6 +298,8 @@ enum {
AMX_ERR_NATIVE, /* native function failed */
AMX_ERR_DIVIDE, /* divide by zero */
AMX_ERR_SLEEP, /* go into sleepmode - code can be restarted */
AMX_ERR_INVSTATE, /* invalid state for this access */
AMX_ERR_INVNATIVE, /* invalid native was used */
AMX_ERR_MEMORY = 16, /* out of memory */
AMX_ERR_FORMAT, /* invalid file format */
@ -291,29 +312,19 @@ enum {
AMX_ERR_INIT_JIT, /* cannot initialize the JIT */
AMX_ERR_PARAMS, /* parameter error */
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
};
enum {
DBG_INIT, /* query/initialize */
DBG_FILE, /* file number in curfile, filename in name */
DBG_LINE, /* line number in curline, file number in curfile */
DBG_SYMBOL, /* address in dbgaddr, class/type in dbgparam */
DBG_CLRSYM, /* stack address below which locals should be removed. stack address in stk */
DBG_CALL, /* function call, address jumped to in dbgaddr */
DBG_RETURN, /* function returns */
DBG_TERMINATE, /* program ends, code address in dbgaddr, reason in dbgparam */
DBG_SRANGE, /* symbol size and dimensions (arrays); level in dbgaddr (!); length in dbgparam */
DBG_SYMTAG, /* tag of the most recent symbol (if non-zero), tag in dbgparam */
AMX_ERR_GENERAL, /* general error (unknown or unspecific error) */
};
/* AMX_FLAG_CHAR16 0x01 no longer used */
#define AMX_FLAG_DEBUG 0x02 /* symbolic info. available */
#define AMX_FLAG_COMPACT 0x04 /* compact encoding */
#define AMX_FLAG_BIGENDIAN 0x08 /* big endian encoding */
#define AMX_FLAG_NOCHECKS 0x10 /* no array bounds checking */
#define AMX_FLAG_LINEOPS 0x20 /* line ops are parsed by the JIT [loadtime only flag] */
#define AMX_FLAG_TRACED 0x40 /* the file has already been traced */
#define AMX_FLAG_BROWSE 0x4000 /* browsing/relocating or executing */
#define AMX_FLAG_BYTEOPC 0x08 /* opcode is a byte (not a cell) */
#define AMX_FLAG_NOCHECKS 0x10 /* no array bounds checking; no STMT opcode */
/* AMX_FLAG_OLDFILE 0x20 Old AMX Mod plugin */
#define AMX_FLAG_PRENIT 0x100 /* pre-initialized, do not check natives */
#define AMX_FLAG_NTVREG 0x1000 /* all native functions are registered */
#define AMX_FLAG_JITC 0x2000 /* abstract machine is JIT compiled */
#define AMX_FLAG_BROWSE 0x4000 /* busy browsing */
#define AMX_FLAG_RELOC 0x8000 /* jump/call addresses relocated */
#define AMX_EXEC_MAIN -1 /* start at program entry point */
@ -321,16 +332,29 @@ enum {
#define AMX_USERTAG(a,b,c,d) ((a) | ((b)<<8) | ((long)(c)<<16) | ((long)(d)<<24))
#define AMX_EXPANDMARGIN 64
#if !defined AMX_COMPACTMARGIN
#define AMX_COMPACTMARGIN 64
#endif
#define UD_FINDPLUGIN 3
#define UD_DEBUGGER 2
#define UD_OPCODELIST 1
#define UD_HANDLER 0
#define UT_NATIVE 3
#define UT_OPTIMIZER 2
#define UT_BROWSEHOOK 1
#define UT_BINLOGS 0
typedef void (*BROWSEHOOK)(AMX *amx, cell *oplist, cell *cip);
/* for native functions that use floating point parameters, the following
* two macros are convenient for casting a "cell" into a "float" type _without_
* changing the bit pattern
*/
#if SMALL_CELL_SIZE==32
#if PAWN_CELL_SIZE==32
#define amx_ftoc(f) ( * ((cell*)&f) ) /* float to cell */
#define amx_ctof(c) ( * ((float*)&c) ) /* cell to float */
#elif SMALL_CELL_SIZE==64
#elif PAWN_CELL_SIZE==64
#define amx_ftoc(f) ( * ((cell*)&f) ) /* float to cell */
#define amx_ctof(c) ( * ((double*)&c) ) /* cell to float */
#else
@ -344,7 +368,7 @@ enum {
amx_StrLen(amx_cstr_, &amx_length_); \
if (amx_length_ > 0 && \
((result) = (void*)alloca((amx_length_ + 1) * sizeof(*(result)))) != NULL) \
amx_GetString((char*)(result), amx_cstr_, sizeof(*(result))>1); \
amx_GetString((char*)(result), amx_cstr_, sizeof(*(result))>1, amx_length_); \
else (result) = NULL; \
} while (0)
@ -353,23 +377,13 @@ uint32_t * AMXAPI amx_Align32(uint32_t *v);
#if defined _I64_MAX || defined HAVE_I64
uint64_t * AMXAPI amx_Align64(uint64_t *v);
#endif
#if SMALL_CELL_SIZE==32
#define amx_AlignCell amx_Align32
#elif SMALL_CELL_SIZE==64
#define amx_AlignCell amx_Align64
#else
#error Unsupported cell size
#endif
int AMXAPI amx_Allot(AMX *amx, int cells, cell *amx_addr, cell **phys_addr);
int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params);
int AMXAPI amx_CheckNatives(AMX *amx, AMX_NATIVE_FILTER nf);
int AMXAPI amx_Cleanup(AMX *amx);
int AMXAPI amx_Clone(AMX *amxClone, AMX *amxSource, void *data);
int AMXAPI amx_Debug(AMX *amx); /* default debug procedure, does nothing */
int AMXAPI amx_DebugCall(AMX *amx, int mode);
int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...);
int AMXAPI amx_Execv(AMX *amx, cell *retval, int index, int numparams, cell params[]);
int AMXAPI amx_ExecPerf(AMX* amx, cell* retval, int index);
int AMXAPI amx_Exec(AMX *amx, cell *retval, int index);
int AMXAPI amx_FindNative(AMX *amx, const char *name, int *index);
int AMXAPI amx_FindPublic(AMX *amx, const char *funcname, int *index);
int AMXAPI amx_FindPubVar(AMX *amx, const char *varname, cell *amx_addr);
@ -379,39 +393,72 @@ int AMXAPI amx_GetAddr(AMX *amx,cell amx_addr,cell **phys_addr);
int AMXAPI amx_GetNative(AMX *amx, int index, char *funcname);
int AMXAPI amx_GetPublic(AMX *amx, int index, char *funcname);
int AMXAPI amx_GetPubVar(AMX *amx, int index, char *varname, cell *amx_addr);
int AMXAPI amx_GetString(char *dest,const cell *source, int use_wchar);
int AMXAPI amx_GetString(char *dest,const cell *source, int use_wchar, size_t size);
int AMXAPI amx_GetTag(AMX *amx, int index, char *tagname, cell *tag_id);
int AMXAPI amx_GetUserData(AMX *amx, long tag, void **ptr);
int AMXAPI amx_Init(AMX *amx, void *program);
int AMXAPI amx_InitJIT(AMX *amx, void *reloc_table, void *native_code);
int AMXAPI amx_MemInfo(AMX *amx, long *codesize, long *datasize, long *stackheap);
int AMXAPI amx_NameLength(AMX *amx, int *length);
AMX_NATIVE_INFO * AMXAPI amx_NativeInfo(const char *name,AMX_NATIVE func);
AMX_NATIVE_INFO * AMXAPI amx_NativeInfo(const char *name, AMX_NATIVE func);
int AMXAPI amx_NumNatives(AMX *amx, int *number);
int AMXAPI amx_NumPublics(AMX *amx, int *number);
int AMXAPI amx_NumPubVars(AMX *amx, int *number);
int AMXAPI amx_NumTags(AMX *amx, int *number);
int AMXAPI amx_Push(AMX *amx, cell value);
int AMXAPI amx_PushArray(AMX *amx, cell *amx_addr, cell **phys_addr, const cell array[], int numcells);
int AMXAPI amx_PushString(AMX *amx, cell *amx_addr, cell **phys_addr, const char *string, int pack, int use_wchar);
int AMXAPI amx_RaiseError(AMX *amx, int error);
int AMXAPI amx_Register(AMX *amx, AMX_NATIVE_INFO *nativelist, int number);
int AMXAPI amx_Register(AMX *amx, const AMX_NATIVE_INFO *nativelist, int number);
int AMXAPI amx_Reregister(AMX *amx, const AMX_NATIVE_INFO *nativelist, int number);
int AMXAPI amx_RegisterToAny(AMX *amx, AMX_NATIVE f);
int AMXAPI amx_Release(AMX *amx, cell amx_addr);
int AMXAPI amx_SetCallback(AMX *amx, AMX_CALLBACK callback);
int AMXAPI amx_SetDebugHook(AMX *amx, AMX_DEBUG debug);
int AMXAPI amx_SetString(cell *dest, const char *source, int pack, int use_wchar);
int AMXAPI amx_SetString(cell *dest, const char *source, int pack, int use_wchar, size_t size);
int AMXAPI amx_SetUserData(AMX *amx, long tag, void *ptr);
int AMXAPI amx_StrLen(cell *cstring, int *length);
int AMXAPI amx_StrLen(const cell *cstring, int *length);
int AMXAPI amx_UTF8Check(const char *string, int *length);
int AMXAPI amx_UTF8Get(const char *string, const char **endptr, cell *value);
int AMXAPI amx_UTF8Len(const cell *cstr, int *length);
int AMXAPI amx_UTF8Put(char *string, char **endptr, int maxchars, cell value);
int AMXAPI amx_UTF8Check(const char *string);
void amx_NullNativeTable(AMX *amx);
int AMXAPI amx_GetLibraries(AMX *amx);
const char *AMXAPI amx_GetLibrary(AMX *amx, int index, char *buffer, int len);
int AMXAPI amx_SetStringOld(cell *dest,const char *source,int pack,int use_wchar);
int AMXAPI amx_GetStringOld(char *dest,const cell *source,int use_wchar);
#if PAWN_CELL_SIZE==16
#define amx_AlignCell(v) amx_Align16(v)
#elif PAWN_CELL_SIZE==32
#define amx_AlignCell(v) amx_Align32(v)
#elif PAWN_CELL_SIZE==64 && (defined _I64_MAX || defined HAVE_I64)
#define amx_AlignCell(v) amx_Align64(v)
#else
#error Unsupported cell size
#endif
#define amx_RegisterFunc(amx, name, func) \
amx_Register((amx), amx_NativeInfo((name),(func)), 1);
#if !defined AMX_NO_ALIGN
#if defined __linux__
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
#pragma pack() /* reset default packing */
#elif defined MACOS && defined __MWERKS__
#pragma options align=reset
#else
#pragma pack(pop) /* reset previous packing */
#endif
#endif
#if defined BINLOG_ENABLED
typedef struct tagBINLOG
{
void (*pfnLogNative)(AMX *amx, int native, int params);
void (*pfnLogReturn)(AMX *amx, cell retval);
void (*pfnLogParams)(AMX *amx, cell *params);
} binlogfuncs_t;
#endif
#ifdef __cplusplus
}
#endif

View File

@ -1,11 +0,0 @@
; /usr/local/cross-tools/bin/i386-mingw32msvc-dlltool --base-file /tmp/cc4kB6s0.base --output-exp amx_mm.exp --dllname amx_mm.dll --output-def amx_mm.def --add-stdcall-alias --exclude-symbol=DllMainCRTStartup@12 --def /tmp/ccyI7I7K.def
EXPORTS
GetEngineFunctions @ 1 ;
GetEngineFunctions_Post @ 2 ;
GetEntityAPI2 @ 3 ;
GetEntityAPI2_Post @ 4 ;
GiveFnptrsToDll = GiveFnptrsToDll@8 @ 5 ;
GiveFnptrsToDll@8 @ 6 ;
Meta_Attach @ 7 ;
Meta_Detach @ 8 ;
Meta_Query @ 9 ;

View File

@ -1,6 +1,6 @@
/* Core module for the Small AMX
/* Core module for the Pawn AMX
*
* Copyright (c) ITB CompuPhase, 1997-2004
* Copyright (c) ITB CompuPhase, 1997-2005
*
* This software is provided "as-is", without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
@ -17,9 +17,8 @@
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
* Version: $Id$
*/
#if defined _UNICODE || defined __UNICODE__ || defined UNICODE
# if !defined UNICODE /* for Windows */
# define UNICODE
@ -34,14 +33,7 @@
#include <string.h>
#include <limits.h>
#include <assert.h>
// this file does not include amxmodx.h, so we have to include the memory manager here
#ifdef MEMORY_TEST
#include "mmgr/mmgr.h"
#endif // MEMORY_TEST
#include "amx.h"
#if defined __WIN32__ || defined _WIN32 || defined WIN32 || defined _Windows
#include <windows.h>
#endif
@ -60,14 +52,13 @@
# define _tcscpy strcpy
# define _tcsdup strdup
# define _tcslen strlen
# define _stprintf sprintf
#endif
#define CHARBITS (8*sizeof(char))
typedef unsigned char uchar;
#if !defined NOPROPLIST
#if !defined AMX_NOPROPLIST
typedef struct _property_list {
struct _property_list *next;
cell id;
@ -76,7 +67,7 @@ typedef struct _property_list {
//??? safe AMX (owner of the property)
} proplist;
static proplist proproot = { NULL };
static proplist proproot = { NULL, 0, NULL, 0 };
static proplist *list_additem(proplist *root)
{
@ -142,15 +133,13 @@ static proplist *list_finditem(proplist *root,cell id,char *name,cell value,
}
#endif
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
static cell AMX_NATIVE_CALL numargs(AMX *amx, cell *params)
{
AMX_HEADER *hdr;
uchar *data;
cell bytes;
(void)params;
hdr=(AMX_HEADER *)amx->base;
data=amx->data ? amx->data : amx->base+(int)hdr->dat;
/* the number of bytes is on the stack, at "frm + 2*cell" */
@ -197,11 +186,9 @@ static cell AMX_NATIVE_CALL setarg(AMX *amx, cell *params)
return 1;
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
static cell AMX_NATIVE_CALL heapspace(AMX *amx,cell *params)
{
(void)params;
return amx->stk - amx->hea;
}
@ -220,142 +207,22 @@ static cell AMX_NATIVE_CALL funcidx(AMX *amx,cell *params)
return 0;
} /* if */
amx_GetString(name,cstr,0);
amx_GetString(name,cstr,0,UNLIMITED);
err=amx_FindPublic(amx,name,&index);
if (err!=AMX_ERR_NONE)
index=-1; /* this is not considered a fatal error */
return index;
}
int amx_StrPack(cell *dest,cell *source)
{
int len;
amx_StrLen(source,&len);
if ((ucell)*source>UNPACKEDMAX) {
/* source string is already packed */
while (len >= 0) {
*dest++ = *source++;
len-=sizeof(cell);
} /* while */
} else {
/* pack string, from bottom up */
cell c;
int i;
for (c=0,i=0; i<len; i++) {
assert((*source & ~0xffL)==0);
c=(c<<CHARBITS) | *source++;
if (i%sizeof(cell) == sizeof(cell)-1) {
*dest++=c;
c=0;
} /* if */
} /* for */
if (i%sizeof(cell) != 0) /* store remaining packed characters */
*dest=c << (sizeof(cell)-i%sizeof(cell))*CHARBITS;
else
*dest=0; /* store full cell of zeros */
} /* if */
return AMX_ERR_NONE;
}
int amx_StrUnpack(cell *dest,cell *source)
{
if ((ucell)*source>UNPACKEDMAX) {
/* unpack string, from top down (so string can be unpacked in place) */
cell c;
int i,len;
amx_StrLen(source,&len);
dest[len]=0;
for (i=len-1; i>=0; i--) {
c=source[i/sizeof(cell)] >> (sizeof(cell)-i%sizeof(cell)-1)*CHARBITS;
dest[i]=c & UCHAR_MAX;
} /* for */
} else {
/* source string is already unpacked */
while ((*dest++ = *source++) != 0)
/* nothing */;
} /* if */
return AMX_ERR_NONE;
}
static int verify_addr(AMX *amx,cell addr)
{
int err;
cell *cdest;
err=amx_GetAddr(amx,addr,&cdest);
if (err!=AMX_ERR_NONE)
amx_RaiseError(amx,err);
return err;
}
static cell AMX_NATIVE_CALL core_strlen(AMX *amx,cell *params)
{
cell *cptr;
int len = 0;
if (amx_GetAddr(amx,params[1],&cptr)==AMX_ERR_NONE)
amx_StrLen(cptr,&len);
return len;
}
static cell AMX_NATIVE_CALL strpack(AMX *amx,cell *params)
{
cell *cdest,*csrc;
int len,needed,err;
size_t lastaddr;
/* calculate number of cells needed for (packed) destination */
amx_GetAddr(amx,params[2],&csrc);
amx_StrLen(csrc,&len);
needed=(len+sizeof(cell))/sizeof(cell); /* # of cells needed */
assert(needed>0);
lastaddr=(size_t)(params[1]+sizeof(cell)*needed-1);
if (verify_addr(amx,(cell)lastaddr)!=AMX_ERR_NONE)
return 0;
amx_GetAddr(amx,params[1],&cdest);
err=amx_StrPack(cdest,csrc);
if (err!=AMX_ERR_NONE)
return amx_RaiseError(amx,err);
return len;
}
static cell AMX_NATIVE_CALL strunpack(AMX *amx,cell *params)
{
cell *cdest,*csrc;
int len,err;
size_t lastaddr;
/* calculate number of cells needed for (packed) destination */
amx_GetAddr(amx,params[2],&csrc);
amx_StrLen(csrc,&len);
assert(len>=0);
lastaddr=(size_t)(params[1]+sizeof(cell)*(len+1)-1);
if (verify_addr(amx,(cell)lastaddr)!=AMX_ERR_NONE)
return 0;
amx_GetAddr(amx,params[1],&cdest);
err=amx_StrUnpack(cdest,csrc);
if (err!=AMX_ERR_NONE)
return amx_RaiseError(amx,err);
return len;
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
static cell AMX_NATIVE_CALL swapchars(AMX *amx,cell *params)
{
union {
cell c;
#if SMALL_CELL_SIZE==16
#if PAWN_CELL_SIZE==16
uchar b[2];
#elif SMALL_CELL_SIZE==32
#elif PAWN_CELL_SIZE==32
uchar b[4];
#elif SMALL_CELL_SIZE==64
#elif PAWN_CELL_SIZE==64
uchar b[8];
#else
#error Unsupported cell size
@ -363,20 +230,21 @@ static cell AMX_NATIVE_CALL swapchars(AMX *amx,cell *params)
} value;
uchar t;
(void)amx;
assert((size_t)params[0]==sizeof(cell));
value.c = params[1];
#if SMALL_CELL_SIZE==16
#if PAWN_CELL_SIZE==16
t = value.b[0];
value.b[0] = value.b[1];
value.b[1] = t;
#elif SMALL_CELL_SIZE==32
#elif PAWN_CELL_SIZE==32
t = value.b[0];
value.b[0] = value.b[3];
value.b[3] = t;
t = value.b[1];
value.b[1] = value.b[2];
value.b[2] = t;
#elif SMALL_CELL_SIZE==64
#elif PAWN_CELL_SIZE==64
t = value.b[0];
value.b[0] = value.b[7];
value.b[7] = t;
@ -395,11 +263,9 @@ static cell AMX_NATIVE_CALL swapchars(AMX *amx,cell *params)
return value.c;
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
static cell AMX_NATIVE_CALL core_tolower(AMX *amx,cell *params)
{
(void)amx;
#if defined __WIN32__ || defined _WIN32 || defined WIN32
return (cell)CharLower((LPTSTR)params[1]);
#elif defined _Windows
@ -409,11 +275,9 @@ static cell AMX_NATIVE_CALL core_tolower(AMX *amx,cell *params)
#endif
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
static cell AMX_NATIVE_CALL core_toupper(AMX *amx,cell *params)
{
(void)amx;
#if defined __WIN32__ || defined _WIN32 || defined WIN32
return (cell)CharUpper((LPTSTR)params[1]);
#elif defined _Windows
@ -423,19 +287,15 @@ static cell AMX_NATIVE_CALL core_toupper(AMX *amx,cell *params)
#endif
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
static cell AMX_NATIVE_CALL core_min(AMX *amx,cell *params)
{
(void)amx;
return params[1] <= params[2] ? params[1] : params[2];
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
static cell AMX_NATIVE_CALL core_max(AMX *amx,cell *params)
{
(void)amx;
return params[1] >= params[2] ? params[1] : params[2];
}
@ -451,7 +311,7 @@ static cell AMX_NATIVE_CALL core_clamp(AMX *amx,cell *params)
return value;
}
#if !defined NOPROPLIST
#if !defined AMX_NOPROPLIST
static char *MakePackedString(cell *cptr)
{
int len;
@ -459,10 +319,21 @@ static char *MakePackedString(cell *cptr)
amx_StrLen(cptr,&len);
dest=(char *)malloc(len+sizeof(cell));
amx_GetString(dest,cptr,0);
amx_GetString(dest,cptr,0,UNLIMITED);
return dest;
}
static int verify_addr(AMX *amx,cell addr)
{
int err;
cell *cdest;
err=amx_GetAddr(amx,addr,&cdest);
if (err!=AMX_ERR_NONE)
amx_RaiseError(amx,err);
return err;
}
static cell AMX_NATIVE_CALL getproperty(AMX *amx,cell *params)
{
cell *cstr;
@ -480,7 +351,7 @@ static cell AMX_NATIVE_CALL getproperty(AMX *amx,cell *params)
return 0;
} /* if */
amx_GetAddr(amx,params[4],&cstr);
amx_SetString(cstr,item->name,1,0);
amx_SetString(cstr,item->name,1,0,UNLIMITED);
} /* if */
free(name);
return (item!=NULL) ? item->value : 0;
@ -545,12 +416,14 @@ static cell AMX_NATIVE_CALL existproperty(AMX *amx,cell *params)
}
#endif
#if !defined AMX_NORANDOM
/* This routine comes from the book "Inner Loops" by Rick Booth, Addison-Wesley
* (ISBN 0-201-47960-5). This is a "multiplicative congruential random number
* generator" that has been extended to 31-bits (the standard C version returns
* only 15-bits).
*/
static unsigned long IL_StandardRandom_seed = 0L;
#define INITIAL_SEED 0xcaa938dbL
static unsigned long IL_StandardRandom_seed = INITIAL_SEED; /* always use a non-zero seed */
#define IL_RMULT 1103515245L
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
@ -562,7 +435,7 @@ static cell AMX_NATIVE_CALL core_random(AMX *amx,cell *params)
/* one-time initialization (or, mostly one-time) */
#if !defined SN_TARGET_PS2 && !defined _WIN32_WCE
if (IL_StandardRandom_seed == 0L)
if (IL_StandardRandom_seed == INITIAL_SEED)
IL_StandardRandom_seed=(unsigned long)time(NULL);
#endif
@ -579,6 +452,7 @@ static cell AMX_NATIVE_CALL core_random(AMX *amx,cell *params)
result %= params[1];
return (cell)result;
}
#endif
AMX_NATIVE_INFO core_Natives[] = {
@ -587,22 +461,13 @@ AMX_NATIVE_INFO core_Natives[] = {
{ "setarg", setarg },
{ "heapspace", heapspace },
{ "funcidx", funcidx },
{ "strlen", core_strlen },
{ "strpack", strpack },
{ "strunpack", strunpack },
{ "swapchars", swapchars },
{ "tolower", core_tolower },
{ "toupper", core_toupper },
{ "random", core_random },
{ "min", core_min },
{ "max", core_max },
{ "clamp", core_clamp },
#if !defined NOPROPLIST
{ "getproperty", getproperty },
{ "setproperty", setproperty },
{ "deleteproperty",delproperty },
{ "existproperty", existproperty },
#endif
{ "random", core_random },
{ NULL, NULL } /* terminator */
};
@ -611,12 +476,10 @@ int AMXEXPORT amx_CoreInit(AMX *amx)
return amx_Register(amx, core_Natives, -1);
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
int AMXEXPORT amx_CoreCleanup(AMX *amx)
{
#if !defined NOPROPLIST
(void)amx;
#if !defined AMX_NOPROPLIST
//??? delete only the properties owned by the AMX
while (proproot.next!=NULL)
list_delete(&proproot,proproot.next);

497
amxmodx/amxdbg.cpp Executable file
View File

@ -0,0 +1,497 @@
/* Pawn debugger interface
*
* Support functions for debugger applications
*
* Copyright (c) ITB CompuPhase, 2005
*
* This software is provided "as-is", without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software in
* a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "osdefs.h" /* for _MAX_PATH */
#include "amx.h"
#include "amxdbg.h"
// this file does not include amxmodx.h, so we have to include the memory manager here
#ifdef MEMORY_TEST
#include "mmgr/mmgr.h"
#endif // MEMORY_TEST
int AMXAPI dbg_FreeInfo(AMX_DBG *amxdbg)
{
assert(amxdbg != NULL);
if (amxdbg->hdr != NULL)
free(amxdbg->hdr);
if (amxdbg->filetbl != NULL)
free(amxdbg->filetbl);
if (amxdbg->symboltbl != NULL)
free(amxdbg->symboltbl);
if (amxdbg->tagtbl != NULL)
free(amxdbg->tagtbl);
if (amxdbg->automatontbl != NULL)
free(amxdbg->automatontbl);
if (amxdbg->statetbl != NULL)
free(amxdbg->statetbl);
memset(amxdbg, 0, sizeof(AMX_DBG));
return AMX_ERR_NONE;
}
void memread(void *dest, char **src, size_t size)
{
void *ptr = *src;
memcpy(dest, ptr, size);
*src += size;
}
const char *ClipFileName(const char *inp)
{
static char buffer[256];
size_t len = strlen(inp);
const char *ptr = inp;
for (size_t i=0; i<len; i++)
{
if ((inp[i] == '\\' || inp[i] == '/') && (i != len-1))
ptr = inp + i + 1;
}
strcpy(buffer, ptr);
return buffer;
}
//Note - I changed this function to read from memory instead.
// -- BAILOPAN
int AMXAPI dbg_LoadInfo(AMX_DBG *amxdbg, void *dbg_addr)
{
AMX_DBG_HDR dbghdr;
unsigned char *ptr;
int index, dim;
AMX_DBG_SYMDIM *symdim;
assert(amxdbg != NULL);
char *addr = (char *)(dbg_addr);
memset(&dbghdr, 0, sizeof(AMX_DBG_HDR));
memread(&dbghdr, &addr, sizeof(AMX_DBG_HDR));
//brabbby graa gragghty graaahhhh
#if BYTE_ORDER==BIG_ENDIAN
amx_Align32((uint32_t*)&dbghdr.size);
amx_Align16(&dbghdr.magic);
amx_Align16(&dbghdr.flags);
amx_Align16(&dbghdr.files);
amx_Align16(&dbghdr.lines);
amx_Align16(&dbghdr.symbols);
amx_Align16(&dbghdr.tags);
amx_Align16(&dbghdr.automatons);
amx_Align16(&dbghdr.states);
#endif
if (dbghdr.magic != AMX_DBG_MAGIC)
return AMX_ERR_FORMAT;
/* allocate all memory */
memset(amxdbg, 0, sizeof(AMX_DBG));
amxdbg->hdr = (AMX_DBG_HDR *)malloc((size_t)dbghdr.size);
if (dbghdr.files > 0)
amxdbg->filetbl = (AMX_DBG_FILE **)malloc(dbghdr.files * sizeof(AMX_DBG_FILE *));
if (dbghdr.symbols > 0)
amxdbg->symboltbl = (AMX_DBG_SYMBOL **)malloc(dbghdr.symbols * sizeof(AMX_DBG_SYMBOL *));
if (dbghdr.tags > 0)
amxdbg->tagtbl = (AMX_DBG_TAG **)malloc(dbghdr.tags * sizeof(AMX_DBG_TAG *));
if (dbghdr.automatons > 0)
amxdbg->automatontbl = (AMX_DBG_MACHINE **)malloc(dbghdr.automatons * sizeof(AMX_DBG_MACHINE *));
if (dbghdr.states > 0)
amxdbg->statetbl = (AMX_DBG_STATE **)malloc(dbghdr.states * sizeof(AMX_DBG_STATE *));
if (amxdbg->hdr == NULL
|| (dbghdr.files > 0 && amxdbg->filetbl == NULL)
|| (dbghdr.symbols > 0 && amxdbg->symboltbl == NULL)
|| (dbghdr.tags > 0 && amxdbg->tagtbl == NULL)
|| (dbghdr.states > 0 && amxdbg->statetbl == NULL)
|| (dbghdr.automatons > 0 && amxdbg->automatontbl == NULL))
{
dbg_FreeInfo(amxdbg);
return AMX_ERR_MEMORY;
} /* if */
/* load the entire symbolic information block into memory */
memcpy(amxdbg->hdr, &dbghdr, sizeof dbghdr);
ptr = (unsigned char *)(amxdbg->hdr + 1);
memread(ptr, &addr, (size_t)(dbghdr.size-sizeof(dbghdr)));
/* file table */
for (index = 0; index < dbghdr.files; index++) {
assert(amxdbg->filetbl != NULL);
amxdbg->filetbl[index] = (AMX_DBG_FILE *)ptr;
#if BYTE_ORDER==BIG_ENDIAN
amx_AlignCell(&amxdbg->filetbl[index]->address);
#endif
for (ptr = ptr + sizeof(AMX_DBG_FILE); *ptr != '\0'; ptr++)
/* nothing */;
ptr++; /* skip '\0' too */
} /* for */
//debug("Files: %d\n", amxdbg->hdr->files);
for (index=0;index<amxdbg->hdr->files; index++)
{
strcpy((char *)amxdbg->filetbl[index]->name, ClipFileName(amxdbg->filetbl[index]->name));
//debug(" [%d] %s\n", index, amxdbg->filetbl[index]->name);
}
/* line table */
amxdbg->linetbl = (AMX_DBG_LINE*)ptr;
#if BYTE_ORDER==BIG_ENDIAN
for (index = 0; index < dbghdr.lines; index++) {
amx_AlignCell(&amxdbg->linetbl[index].address);
amx_Align32((uint32_t*)&amxdbg->linetbl[index].line);
} /* for */
#endif
ptr += dbghdr.lines * sizeof(AMX_DBG_LINE);
/* symbol table (plus index tags) */
for (index = 0; index < dbghdr.symbols; index++) {
assert(amxdbg->symboltbl != NULL);
amxdbg->symboltbl[index] = (AMX_DBG_SYMBOL *)ptr;
#if BYTE_ORDER==BIG_ENDIAN
amx_AlignCell(&amxdbg->symboltbl[index]->address);
amx_Align16((uint16_t*)&amxdbg->symboltbl[index]->tag);
amx_AlignCell(&amxdbg->symboltbl[index]->codestart);
amx_AlignCell(&amxdbg->symboltbl[index]->codeend);
amx_Align16((uint16_t*)&amxdbg->symboltbl[index]->dim);
#endif
for (ptr = ptr + sizeof(AMX_DBG_SYMBOL); *ptr != '\0'; ptr++)
/* nothing */;
ptr++; /* skip '\0' too */
for (dim = 0; dim < amxdbg->symboltbl[index]->dim; dim++) {
symdim = (AMX_DBG_SYMDIM *)ptr;
amx_Align16((uint16_t*)&symdim->tag);
amx_AlignCell(&symdim->size);
ptr += sizeof(AMX_DBG_SYMDIM);
} /* for */
} /* for */
/* tag name table */
for (index = 0; index < dbghdr.tags; index++) {
assert(amxdbg->tagtbl != NULL);
amxdbg->tagtbl[index] = (AMX_DBG_TAG *)ptr;
#if BYTE_ORDER==BIG_ENDIAN
amx_Align16(&amxdbg->tagtbl[index]->tag);
#endif
for (ptr = ptr + sizeof(AMX_DBG_TAG) - 1; *ptr != '\0'; ptr++)
/* nothing */;
ptr++; /* skip '\0' too */
} /* for */
/* automaton name table */
for (index = 0; index < dbghdr.automatons; index++) {
assert(amxdbg->automatontbl != NULL);
amxdbg->automatontbl[index] = (AMX_DBG_MACHINE *)ptr;
#if BYTE_ORDER==BIG_ENDIAN
amx_Align16(&amxdbg->automatontbl[index]->automaton);
amx_AlignCell(&amxdbg->automatontbl[index]->address);
#endif
for (ptr = ptr + sizeof(AMX_DBG_MACHINE) - 1; *ptr != '\0'; ptr++)
/* nothing */;
ptr++; /* skip '\0' too */
} /* for */
/* state name table */
for (index = 0; index < dbghdr.states; index++) {
assert(amxdbg->statetbl != NULL);
amxdbg->statetbl[index] = (AMX_DBG_STATE *)ptr;
#if BYTE_ORDER==BIG_ENDIAN
amx_Align16(&amxdbg->statetbl[index]->state);
amx_Align16(&amxdbg->automatontbl[index]->automaton);
#endif
for (ptr = ptr + sizeof(AMX_DBG_STATE) - 1; *ptr != '\0'; ptr++)
/* nothing */;
ptr++; /* skip '\0' too */
} /* for */
return AMX_ERR_NONE;
}
int AMXAPI dbg_LookupFile(AMX_DBG *amxdbg, ucell address, const char **filename)
{
int index;
assert(amxdbg != NULL);
assert(filename != NULL);
*filename = NULL;
/* this is a simple linear look-up; a binary search would be possible too */
for (index = 0; index < amxdbg->hdr->files && amxdbg->filetbl[index]->address <= address; index++)
/* nothing */;
/* reset for overrun */
if (--index < 0)
return AMX_ERR_NOTFOUND;
*filename = amxdbg->filetbl[index]->name;
return AMX_ERR_NONE;
}
int AMXAPI dbg_LookupLine(AMX_DBG *amxdbg, ucell address, long *line)
{
int index;
assert(amxdbg != NULL);
assert(line != NULL);
*line = 0;
/* this is a simple linear look-up; a binary search would be possible too */
for (index = 0; index < amxdbg->hdr->lines && amxdbg->linetbl[index].address <= address; index++)
/* nothing */;
/* reset for overrun */
if (--index < 0)
return AMX_ERR_NOTFOUND;
*line = (long)amxdbg->linetbl[index].line;
return AMX_ERR_NONE;
}
int AMXAPI dbg_LookupFunction(AMX_DBG *amxdbg, ucell address, const char **funcname)
{
/* dbg_LookupFunction() finds the function a code address is in. It can be
* used for stack walking, and for stepping through a function while stepping
* over sub-functions
*/
int index;
assert(amxdbg != NULL);
assert(funcname != NULL);
*funcname = NULL;
for (index = 0; index < amxdbg->hdr->symbols; index++) {
if (amxdbg->symboltbl[index]->ident == iFUNCTN
&& amxdbg->symboltbl[index]->codestart <= address
&& amxdbg->symboltbl[index]->codeend > address)
break;
} /* for */
if (index >= amxdbg->hdr->symbols)
return AMX_ERR_NOTFOUND;
*funcname = amxdbg->symboltbl[index]->name;
return AMX_ERR_NONE;
}
int AMXAPI dbg_GetTagName(AMX_DBG *amxdbg, int tag, const char **name)
{
int index;
assert(amxdbg != NULL);
assert(name != NULL);
*name = NULL;
for (index = 0; index < amxdbg->hdr->tags && amxdbg->tagtbl[index]->tag != tag; index++)
/* nothing */;
if (index >= amxdbg->hdr->tags)
return AMX_ERR_NOTFOUND;
*name = amxdbg->tagtbl[index]->name;
return AMX_ERR_NONE;
}
int AMXAPI dbg_GetAutomatonName(AMX_DBG *amxdbg, int automaton, const char **name)
{
int index;
assert(amxdbg != NULL);
assert(name != NULL);
*name = NULL;
for (index = 0; index < amxdbg->hdr->automatons && amxdbg->automatontbl[index]->automaton != automaton; index++)
/* nothing */;
if (index >= amxdbg->hdr->automatons)
return AMX_ERR_NOTFOUND;
*name = amxdbg->automatontbl[index]->name;
return AMX_ERR_NONE;
}
int AMXAPI dbg_GetStateName(AMX_DBG *amxdbg, int state, const char **name)
{
int index;
assert(amxdbg != NULL);
assert(name != NULL);
*name = NULL;
for (index = 0; index < amxdbg->hdr->states && amxdbg->statetbl[index]->state != state; index++)
/* nothing */;
if (index >= amxdbg->hdr->states)
return AMX_ERR_NOTFOUND;
*name = amxdbg->statetbl[index]->name;
return AMX_ERR_NONE;
}
int AMXAPI dbg_GetLineAddress(AMX_DBG *amxdbg, long line, const char *filename, ucell *address)
{
/* Find a suitable "breakpoint address" close to the indicated line (and in
* the specified file). The address is moved up to the next "breakable" line
* if no "breakpoint" is available on the specified line. You can use function
* dbg_LookupLine() to find out at which precise line the breakpoint was set.
*
* The filename comparison is strict (case sensitive and path sensitive); the
* "filename" parameter should point into the "filetbl" of the AMX_DBG
* structure.
*/
int file, index;
ucell bottomaddr,topaddr;
assert(amxdbg != NULL);
assert(filename != NULL);
assert(address != NULL);
*address = 0;
index = 0;
for (file = 0; file < amxdbg->hdr->files; file++) {
/* find the (next) mathing instance of the file */
if (strcmp(amxdbg->filetbl[file]->name, filename) != 0)
continue;
/* get address range for the current file */
bottomaddr = amxdbg->filetbl[file]->address;
topaddr = (file + 1 < amxdbg->hdr->files) ? amxdbg->filetbl[file+1]->address : (ucell)(cell)-1;
/* go to the starting address in the line table */
while (index < amxdbg->hdr->lines && amxdbg->linetbl[index].address < bottomaddr)
index++;
/* browse until the line is found or until the top address is exceeded */
while (index < amxdbg->hdr->lines
&& amxdbg->linetbl[index].line < line
&& amxdbg->linetbl[index].address < topaddr)
index++;
if (index >= amxdbg->hdr->lines)
return AMX_ERR_NOTFOUND;
if (amxdbg->linetbl[index].line >= line)
break;
/* if not found (and the line table is not yet exceeded) try the next
* instance of the same file (a file may appear twice in the file table)
*/
} /* for */
if (strcmp(amxdbg->filetbl[file]->name, filename) != 0)
return AMX_ERR_NOTFOUND;
assert(index < amxdbg->hdr->lines);
*address = amxdbg->linetbl[index].address;
return AMX_ERR_NONE;
}
int AMXAPI dbg_GetFunctionAddress(AMX_DBG *amxdbg, const char *funcname, const char *filename, ucell *address)
{
/* Find a suitable "breakpoint address" close to the indicated line (and in
* the specified file). The address is moved up to the first "breakable" line
* in the function. You can use function dbg_LookupLine() to find out at which
* precise line the breakpoint was set.
*
* The filename comparison is strict (case sensitive and path sensitive); the
* "filename" parameter should point into the "filetbl" of the AMX_DBG
* structure. The function name comparison is case sensitive too.
*/
int index, err;
const char *tgtfile;
ucell funcaddr;
assert(amxdbg != NULL);
assert(funcname != NULL);
assert(filename != NULL);
assert(address != NULL);
*address = 0;
index = 0;
for ( ;; ) {
/* find (next) matching function */
while (index < amxdbg->hdr->symbols
&& (amxdbg->symboltbl[index]->ident != iFUNCTN || strcmp(amxdbg->symboltbl[index]->name, funcname) != 0))
index++;
if (index >= amxdbg->hdr->symbols)
return AMX_ERR_NOTFOUND;
/* verify that this line falls in the appropriate file */
err = dbg_LookupFile(amxdbg, amxdbg->symboltbl[index]->address, &tgtfile);
if (err == AMX_ERR_NONE || strcmp(filename, tgtfile) == 0)
break;
index++; /* line is the wrong file, search further */
} /* for */
/* now find the first line in the function where we can "break" on */
assert(index < amxdbg->hdr->symbols);
funcaddr = amxdbg->symboltbl[index]->address;
for (index = 0; index < amxdbg->hdr->lines && amxdbg->linetbl[index].address < funcaddr; index++)
/* nothing */;
if (index >= amxdbg->hdr->lines)
return AMX_ERR_NOTFOUND;
*address = amxdbg->linetbl[index].address;
return AMX_ERR_NONE;
}
int AMXAPI dbg_GetVariable(AMX_DBG *amxdbg, const char *symname, ucell scopeaddr, const AMX_DBG_SYMBOL **sym)
{
ucell codestart,codeend;
int index;
assert(amxdbg != NULL);
assert(symname != NULL);
assert(sym != NULL);
*sym = NULL;
codestart = codeend = 0;
index = 0;
for ( ;; ) {
/* find (next) matching variable */
while (index < amxdbg->hdr->symbols
&& (amxdbg->symboltbl[index]->ident == iFUNCTN || strcmp(amxdbg->symboltbl[index]->name, symname) != 0)
&& (amxdbg->symboltbl[index]->codestart > scopeaddr || amxdbg->symboltbl[index]->codeend < scopeaddr))
index++;
if (index >= amxdbg->hdr->symbols)
break;
/* check the range, keep a pointer to the symbol with the smallest range */
if (strcmp(amxdbg->symboltbl[index]->name, symname) == 0
&& ((codestart == 0 && codeend == 0)
|| (amxdbg->symboltbl[index]->codestart >= codestart && amxdbg->symboltbl[index]->codeend <= codeend)))
{
*sym = amxdbg->symboltbl[index];
codestart = amxdbg->symboltbl[index]->codestart;
codeend = amxdbg->symboltbl[index]->codeend;
} /* if */
index++;
} /* for */
return (*sym == NULL) ? AMX_ERR_NOTFOUND : AMX_ERR_NONE;
}
int AMXAPI dbg_GetArrayDim(AMX_DBG *amxdbg, const AMX_DBG_SYMBOL *sym, const AMX_DBG_SYMDIM **symdim)
{
/* retrieves a pointer to the array dimensions structures of an array symbol */
const char *ptr;
assert(amxdbg != NULL);
assert(sym != NULL);
assert(symdim != NULL);
*symdim = NULL;
if (sym->ident != iARRAY && sym->ident != iREFARRAY)
return AMX_ERR_PARAMS;
assert(sym->dim > 0); /* array must have at least one dimension */
/* find the end of the symbol name */
for (ptr = sym->name; *ptr != '\0'; ptr++)
/* nothing */;
*symdim = (AMX_DBG_SYMDIM *)(ptr + 1);/* skip '\0' too */
return AMX_ERR_NONE;
}

170
amxmodx/amxdbg.h Executable file
View File

@ -0,0 +1,170 @@
/* Abstract Machine for the Pawn compiler, debugger support
*
* This file contains extra definitions that are convenient for debugger
* support.
*
* Copyright (c) ITB CompuPhase, 2005
*
* This software is provided "as-is", without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software in
* a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef AMXDBG_H_INCLUDED
#define AMXDBG_H_INCLUDED
#ifndef AMX_H_INCLUDED
#include "amx.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Some compilers do not support the #pragma align, which should be fine. Some
* compilers give a warning on unknown #pragmas, which is not so fine...
*/
#if defined SN_TARGET_PS2 || defined __GNUC__
#define AMX_NO_ALIGN
#endif
#if defined __GNUC__
#define PACKED __attribute__((packed))
#else
#define PACKED
#endif
#if !defined AMX_NO_ALIGN
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
#pragma pack(1) /* structures must be packed (byte-aligned) */
#elif defined MACOS && defined __MWERKS__
#pragma options align=mac68k
#else
#pragma pack(push)
#pragma pack(1) /* structures must be packed (byte-aligned) */
#if defined __TURBOC__
#pragma option -a- /* "pack" pragma for older Borland compilers */
#endif
#endif
#endif
typedef struct tagAMX_DBG_HDR {
int32_t size PACKED; /* size of the debug information chunk */
uint16_t magic PACKED; /* signature, must be 0xf1ef */
char file_version; /* file format version */
char amx_version; /* required version of the AMX */
int16_t flags PACKED; /* currently unused */
int16_t files PACKED; /* number of entries in the "file" table */
int16_t lines PACKED; /* number of entries in the "line" table */
int16_t symbols PACKED; /* number of entries in the "symbol" table */
int16_t tags PACKED; /* number of entries in the "tag" table */
int16_t automatons PACKED; /* number of entries in the "automaton" table */
int16_t states PACKED; /* number of entries in the "state" table */
} PACKED AMX_DBG_HDR;
#define AMX_DBG_MAGIC 0xf1ef
typedef struct tagAMX_DBG_FILE {
ucell address PACKED; /* address in the code segment where generated code (for this file) starts */
const char name[1]; /* ASCII string, zero-terminated */
} PACKED AMX_DBG_FILE;
typedef struct tagAMX_DBG_LINE {
ucell address PACKED; /* address in the code segment where generated code (for this line) starts */
int32_t line PACKED; /* line number */
} PACKED AMX_DBG_LINE;
typedef struct tagAMX_DBG_SYMBOL {
ucell address PACKED; /* address in the data segment or relative to the frame */
int16_t tag PACKED; /* tag for the symbol */
ucell codestart PACKED; /* address in the code segment from which this symbol is valid (in scope) */
ucell codeend PACKED; /* address in the code segment until which this symbol is valid (in scope) */
char ident; /* kind of symbol (function/variable) */
char vclass; /* class of symbol (global/local) */
int16_t dim PACKED; /* number of dimensions */
const char name[1]; /* ASCII string, zero-terminated */
} PACKED AMX_DBG_SYMBOL;
typedef struct tagAMX_DBG_SYMDIM {
int16_t tag PACKED; /* tag for the array dimension */
ucell size PACKED; /* size of the array dimension */
} PACKED AMX_DBG_SYMDIM;
typedef struct tagAMX_DBG_TAG {
int16_t tag PACKED; /* tag id */
const char name[1]; /* ASCII string, zero-terminated */
} PACKED AMX_DBG_TAG;
typedef struct tagAMX_DBG_MACHINE {
int16_t automaton PACKED; /* automaton id */
ucell address PACKED; /* address of state variable */
const char name[1]; /* ASCII string, zero-terminated */
} PACKED AMX_DBG_MACHINE;
typedef struct tagAMX_DBG_STATE {
int16_t state PACKED; /* state id */
int16_t automaton PACKED; /* automaton id */
const char name[1]; /* ASCII string, zero-terminated */
} PACKED AMX_DBG_STATE;
typedef struct tagAMX_DBG {
AMX_DBG_HDR _FAR *hdr PACKED; /* points to the AMX_DBG header */
AMX_DBG_FILE _FAR **filetbl PACKED;
AMX_DBG_LINE _FAR *linetbl PACKED;
AMX_DBG_SYMBOL _FAR **symboltbl PACKED;
AMX_DBG_TAG _FAR **tagtbl PACKED;
AMX_DBG_MACHINE _FAR **automatontbl PACKED;
AMX_DBG_STATE _FAR **statetbl PACKED;
} PACKED AMX_DBG;
#if !defined iVARIABLE
#define iVARIABLE 1 /* cell that has an address and that can be fetched directly (lvalue) */
#define iREFERENCE 2 /* iVARIABLE, but must be dereferenced */
#define iARRAY 3
#define iREFARRAY 4 /* an array passed by reference (i.e. a pointer) */
#define iFUNCTN 9
#endif
int AMXAPI dbg_FreeInfo(AMX_DBG *amxdbg);
int AMXAPI dbg_LoadInfo(AMX_DBG *amxdbg, void *dbg_addr);
int AMXAPI dbg_LookupFile(AMX_DBG *amxdbg, ucell address, const char **filename);
int AMXAPI dbg_LookupFunction(AMX_DBG *amxdbg, ucell address, const char **funcname);
int AMXAPI dbg_LookupLine(AMX_DBG *amxdbg, ucell address, long *line);
int AMXAPI dbg_GetFunctionAddress(AMX_DBG *amxdbg, const char *funcname, const char *filename, ucell *address);
int AMXAPI dbg_GetLineAddress(AMX_DBG *amxdbg, long line, const char *filename, ucell *address);
int AMXAPI dbg_GetAutomatonName(AMX_DBG *amxdbg, int automaton, const char **name);
int AMXAPI dbg_GetStateName(AMX_DBG *amxdbg, int state, const char **name);
int AMXAPI dbg_GetTagName(AMX_DBG *amxdbg, int tag, const char **name);
int AMXAPI dbg_GetVariable(AMX_DBG *amxdbg, const char *symname, ucell scopeaddr, const AMX_DBG_SYMBOL **sym);
int AMXAPI dbg_GetArrayDim(AMX_DBG *amxdbg, const AMX_DBG_SYMBOL *sym, const AMX_DBG_SYMDIM **symdim);
#if !defined AMX_NO_ALIGN
#if defined LINUX || defined __FreeBSD__ || defined __APPLE__
#pragma pack() /* reset default packing */
#elif defined MACOS && defined __MWERKS__
#pragma options align=reset
#else
#pragma pack(pop) /* reset previous packing */
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* AMXDBG_H_INCLUDED */

86
amxmodx/amxdefn.asm Executable file
View File

@ -0,0 +1,86 @@
; Definition of the AMX structure for assembler syntax (NASM)
struc amx_s
_base: resd 1
_dataseg: resd 1
_callback: resd 1
_debug: resd 1
_cip: resd 1
_frm: resd 1
_hea: resd 1
_hlw: resd 1
_stk: resd 1
_stp: resd 1
_flags: resd 1
_usertags: resd 4 ; 4 = AMX_USERNUM (#define'd in amx.h)
_userdata: resd 4 ; 4 = AMX_USERNUM (#define'd in amx.h)
_error: resd 1
_paramcount: resd 1
_pri: resd 1
_alt: resd 1
_reset_stk: resd 1
_reset_hea: resd 1
_syscall_d: resd 1
%ifdef JIT
; the two fields below are for the JIT; they do not exist in
; the non-JIT version of the abstract machine
_reloc_size: resd 1 ; memory block for relocations
_code_size: resd 1 ; memory size of the native code
%endif
endstruc
struc amxhead_s
_size: resd 1 ; size of the "file"
_magic: resw 1 ; signature
_file_version: resb 1; file format version
_amx_version: resb 1 ; required version of the AMX
_h_flags: resw 1
_defsize: resw 1 ; size of one public/native function entry
_cod: resd 1 ; initial value of COD - code block
_dat: resd 1 ; initial value of DAT - data block
_h_hea: resd 1 ; initial value of HEA - start of the heap
_h_stp: resd 1 ; initial value of STP - stack top
_h_cip: resd 1 ; initial value of CIP - the instruction pointer
_publics: resd 1 ; offset to the "public functions" table
_natives: resd 1 ; offset to the "native functions" table
_libraries: resd 1 ; offset to the "library" table
_pubvars: resd 1 ; offset to the "public variables" table
_tags: resd 1 ; offset to the "public tagnames" table
_nametable: resd 1 ; offset to the name table, file version 7 only
endstruc
AMX_ERR_NONE EQU 0
AMX_ERR_EXIT EQU 1
AMX_ERR_ASSERT EQU 2
AMX_ERR_STACKERR EQU 3
AMX_ERR_BOUNDS EQU 4
AMX_ERR_MEMACCESS EQU 5
AMX_ERR_INVINSTR EQU 6
AMX_ERR_STACKLOW EQU 7
AMX_ERR_HEAPLOW EQU 8
AMX_ERR_CALLBACK EQU 9
AMX_ERR_NATIVE EQU 10
AMX_ERR_DIVIDE EQU 11 ; for catching divide errors
AMX_ERR_SLEEP EQU 12
AMX_ERR_MEMORY EQU 16
AMX_ERR_FORMAT EQU 17
AMX_ERR_VERSION EQU 18
AMX_ERR_NOTFOUND EQU 19
AMX_ERR_INDEX EQU 20
AMX_ERR_DEBUG EQU 21
AMX_ERR_INIT EQU 22
AMX_ERR_USERDATA EQU 23
AMX_ERR_INIT_JIT EQU 24
AMX_ERR_PARAMS EQU 25
AMX_ERR_DOMAIN EQU 26
AMX_ERR_GENERAL EQU 27
AMX_FLAG_DEBUG EQU 0002h ; symbolic info. available
AMX_FLAG_COMPACT EQU 0004h
AMX_FLAG_BYTEOPC EQU 0008h
AMX_FLAG_NOCHECKS EQU 0010h
AMX_FLAG_BROWSE EQU 4000h
AMX_FLAG_RELOC EQU 8000h ; jump/call addresses relocated

View File

@ -1,4 +1,4 @@
; AMXEXECN.ASM Abstract Machine for the "Small" language
; AMXEXECN.ASM Abstract Machine for the "Pawn" language
;
;Some notes:
@ -25,7 +25,7 @@
;
;Copyright and license of use, please read
;-----------------------------------------
;The assembler implementation of the abstract machine for the Small language,
;The assembler implementation of the abstract machine for the Pawn language,
;specifically the file AMXEXEC.ASM, is copyright (c) 1998-2000 by Marc Peter.
;
;Permission is hereby granted, without written agreement and without paid
@ -56,6 +56,13 @@
;
;History (list of changes)
;-------------------------
; 24 february 2013 by Scott Ehlert
; Aligned stack to 16-byte boundary for native calls in case they make library
; calls on Mac OS X or use SSE instructions.
; 10 february 2006 by David Anderson
; Addition of float opcodes
; 17 february 2005 by Thiadmer Riemersms
; Addition of the BREAK opcode, removal of the older debugging opcode table.
; 6 march 2004 by Thiadmer Riemersma
; Corrected a bug in OP_FILL, where a cell preceding the array would
; be overwritten (zero'ed out). This bug was brought to my attention
@ -95,92 +102,7 @@
%endif
%endmacro
; I could not get NASM's structure definition to work (it appears to confuse
; ENDSTRUC with "end segment"). So the definition below uses constants for
; the field offsets.
;amx_s STRUC
_base EQU 00h ;DD ?
_dataseg EQU 04h ;DD ?
_callback EQU 08h ;DD ?
_debug EQU 0ch ;DD ?
_cip EQU 10h ;DD ?
_frm EQU 14h ;DD ?
_hea EQU 18h ;DD ?
_hlw EQU 1ch ;DD ?
_stk EQU 20h ;DD ?
_stp EQU 24h ;DD ?
_flags EQU 28h ;DD ?
_curline EQU 2ch ;DD ?
_curfile EQU 30h ;DD ?
_dbgcode EQU 34h ;DD ?
_dbgaddr EQU 38h ;DD ?
_dbgparam EQU 3ch ;DD ?
_dbgname EQU 40h ;DD ?
_usertags1 EQU 44h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
_usertags2 EQU 44h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
_usertags3 EQU 44h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
_usertags4 EQU 44h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
_userdata1 EQU 54h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
_userdata2 EQU 54h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
_userdata3 EQU 54h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
_userdata4 EQU 54h ;DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h)
_error EQU 64h ;DD ?
_pri EQU 68h ;DD ?
_alt EQU 6ch ;DD ?
_reset_stk EQU 70h ;DD ?
_reset_hea EQU 74h ;DD ?
_syscall_d EQU 78h ;DD ?
; the two fields below are for the JIT; they do not exist in
; the non-JIT version of the abstract machine
; _reloc_size EQU 7ch ;DD ? ; memory block for relocations
; _code_size EQU 80h ;DD ? ; memory size of the native code
;amx_s ENDS
AMX_ERR_NONE EQU 0
AMX_ERR_EXIT EQU 1
AMX_ERR_ASSERT EQU 2
AMX_ERR_STACKERR EQU 3
AMX_ERR_BOUNDS EQU 4
AMX_ERR_MEMACCESS EQU 5
AMX_ERR_INVINSTR EQU 6
AMX_ERR_STACKLOW EQU 7
AMX_ERR_HEAPLOW EQU 8
AMX_ERR_CALLBACK EQU 9
AMX_ERR_NATIVE EQU 10
AMX_ERR_DIVIDE EQU 11 ; MP: added for catching divide errors
AMX_ERR_SLEEP EQU 12 ; (TR)
AMX_ERR_MEMORY EQU 16
AMX_ERR_FORMAT EQU 17
AMX_ERR_VERSION EQU 18
AMX_ERR_NOTFOUND EQU 19
AMX_ERR_INDEX EQU 20
AMX_ERR_DEBUG EQU 21
AMX_ERR_INIT EQU 22
AMX_ERR_USERDATA EQU 23
AMX_ERR_INIT_JIT EQU 24
AMX_ERR_PARAMS EQU 25
AMX_ERR_DOMAIN EQU 26
DBG_INIT EQU 0
DBG_FILE EQU 1
DBG_LINE EQU 2
DBG_SYMBOL EQU 3
DBG_CLRSYM EQU 4
DBG_CALL EQU 5
DBG_RETURN EQU 6
DBG_TERMINATE EQU 7
DBG_SRANGE EQU 8 ; (TR)
DBG_SYMTAG EQU 9 ; (TR)
AMX_FLAG_CHAR16 EQU 0001h ; characters are 16-bit
AMX_FLAG_DEBUG EQU 0002h ; symbolic info. available
AMX_FLAG_LINEOPS EQU 0020h ; line op information
AMX_FLAG_TRACED EQU 0040h ;
AMX_FLAG_BROWSE EQU 4000h
AMX_FLAG_RELOC EQU 8000h ; jump/call addresses relocated
%include "amxdefn.asm"
;#define PUSH(v) ( stk-=sizeof(cell), *(cell *)(data+(int)stk)=v )
%macro _PUSH 1
@ -212,6 +134,28 @@
jg near err_stack
%endmacro
;Normal abort, saves pri/alt
%macro _ABORT 1
mov ebp,amx
mov [ebp+_pri], dword eax ; store values in AMX structure (PRI, ALT)
mov [ebp+_alt], dword edx ; store values in AMX structure (PRI, ALT)
mov [ebp+_error], dword %1
jmp _return
%endmacro
;Checked abort, saves nothing and uses a conditional
%macro _CHKABORT 1
mov ebp,amx
mov [ebp+_error], %1
cmp %1, AMX_ERR_NONE
jne _return
%endmacro
;Fast abort, only aborts, nothing else
%macro _FASTABORT 0
jmp _return
%endmacro
%macro _CHKHEAP 0
mov ebp,amx
mov ebp,[ebp+_hlw]
@ -248,6 +192,21 @@
%endif
%endmacro
%macro _STK_ALIGN 1 ; align stack to 16-byte boundary and
; allocate %1 bytes of stack space
%if %1 % 16 != 0
%error "expected 16-byte aligned value"
%endif
push edi
mov edi, esp
and esp, 0xFFFFFFF0
sub esp, %1
%endmacro
%macro _STK_RESTORE 0 ; restore stack pointer after 16-byte alignment
mov esp, edi
pop edi
%endmacro
Start_CODE
@ -659,29 +618,6 @@ OP_POP_ALT:
;good
OP_STACK:
mov edx,ecx
add ecx,[esi+4]
_CHKMARGIN
_CHKSTACK
mov ebp,amx
test DWORD [ebp+_flags],AMX_FLAG_DEBUG
jz short op_stk_goon
; update several structure fields and call the debug hook
mov DWORD [ebp+_dbgcode],DBG_CLRSYM
mov [ebp+_stk],ecx
push eax
mov eax,ebp ; 1st parm: amx
_SAVEREGS
push eax ; pass parameter via the stack
call [ebp+_debug] ; call debug function
_DROPARGS 4 ; remove arguments from stack
_RESTOREREGS
pop eax
op_stk_goon:
add esi,8
GO_ON
OP_STACK_nodebug:
mov edx,ecx
add ecx,[esi+4]
_CHKMARGIN
@ -711,35 +647,6 @@ OP_PROC:
GO_ON
OP_RET:
_POP ebx
_POP esi
cmp esi,code ; verify ESI>=code
jb err_memaccess
cmp esi,codesiz ; verify ESI<codesiz ("end-of-code" pointer)
jae err_memaccess
mov frm,ebx
add ebx,edi
mov ebp,amx
test DWORD [ebp+_flags], AMX_FLAG_DEBUG
jz short op_ret_goon
; update several structure fields and call the debug hook
mov DWORD [ebp+_dbgcode],DBG_RETURN
mov [ebp+_dbgparam],eax
push eax
mov [ebp+_stk],ecx ; store STK
mov eax,hea
mov [ebp+_hea],eax ; store HEA
mov eax,ebp ; 1st parm: amx
_SAVEREGS
push eax
call [ebp+_debug] ; call debug function
_DROPARGS 4 ; remove arguments from stack
_RESTOREREGS
pop eax
op_ret_goon:
GO_ON
OP_RET_nodebug:
_POP ebx
_POP esi
cmp esi,code ; verify ESI>=code
@ -760,107 +667,17 @@ OP_RETN:
jae err_memaccess
mov frm,ebx
add ebx,edi
mov ebp,amx
test DWORD [ebp+_flags], AMX_FLAG_DEBUG
jz short op_retn_goon
; update several structure fields and call the debug hook
mov DWORD [ebp+_dbgcode],DBG_RETURN
mov [ebp+_dbgparam],eax
push eax
mov [ebp+_stk],ecx ; store STK
mov eax,hea
mov [ebp+_hea],eax ; store HEA
mov eax,ebp ; parm: amx
_SAVEREGS
push eax
call [ebp+_debug] ; call debug function
_DROPARGS 4 ; remove arguments from stack
_RESTOREREGS
; also send the DBG_CLRSYM code
mov eax,[edi+ecx]
lea ecx,[ecx+eax+4]
mov DWORD [ebp+_dbgcode],DBG_CLRSYM
mov [ebp+_stk],ecx
mov eax,ebp ; parm: amx
_SAVEREGS
push eax
call [ebp+_debug] ; call debug function
_DROPARGS 4 ; remove arguments from stack
_RESTOREREGS
pop eax
; ECX already adjusted
GO_ON
op_retn_goon:
mov ebp,[edi+ecx]
lea ecx,[ecx+ebp+4]
GO_ON
OP_RETN_nodebug:
_POP ebx
_POP esi
cmp esi,code ; verify ESI>=code
jb err_memaccess
cmp esi,codesiz ; verify ESI<codesiz ("end-of-code" pointer)
jae err_memaccess
mov frm,ebx
mov ebp,[edi+ecx]
add ebx,edi
lea ecx,[ecx+ebp+4]
GO_ON
;good
OP_CALL:
lea ebp,[esi+8]
mov esi,[esi+4]
_PUSH ebp
mov ebp,amx
test DWORD [ebp+_flags], AMX_FLAG_DEBUG
jz short op_call_goon
; update several structure fields and call the debug hook
push eax
mov eax,[esp+24] ; this is "code", but ESP moved
mov [ebp+_dbgaddr],esi
sub [ebp+_dbgaddr],eax ; dbgaddr = cip - code
mov DWORD [ebp+_dbgcode],DBG_CALL
mov eax,ebp ; 1st parm: amx
_SAVEREGS
push eax
call [ebp+_debug] ; call debug function
_DROPARGS 4 ; remove arguments from stack
_RESTOREREGS
pop eax
op_call_goon:
GO_ON
OP_CALL_nodebug:
lea ebp,[esi+8]
mov esi,[esi+4]
_PUSH ebp
GO_ON
OP_CALL_PRI:
lea ebp,[esi+4]
mov esi,eax
add esi,code ; cip = PRI + code
_PUSH ebp
mov ebp,amx
test DWORD [ebp+_flags], AMX_FLAG_DEBUG
jz short op_calli_goon
; update several structure fields and call the debug hook
mov [ebp+_dbgaddr],eax ; dbgaddr = PRI (== cip - code)
mov DWORD [ebp+_dbgcode],DBG_CALL
push eax
mov eax,ebp ; 1st parm: amx
_SAVEREGS
push eax
call [ebp+_debug] ; call debug function
_DROPARGS 4 ; remove arguments from stack
_RESTOREREGS
pop eax
op_calli_goon:
GO_ON
OP_CALL_PRI_nodebug:
lea ebp,[esi+4]
mov esi,eax
add esi,code ; cip = PRI + code
@ -928,7 +745,7 @@ OP_JGRTR:
OP_JGEQ:
cmp eax,edx
jae short jump_taken ; unsigned comparison
jae short jump_taken ; unsigned comparison
add esi,8
GO_ON
@ -941,19 +758,19 @@ OP_JSLESS:
;good
OP_JSLEQ:
cmp eax,edx
jle short jump_taken
jle near jump_taken
add esi,8
GO_ON
OP_JSGRTR:
cmp eax,edx
jg short jump_taken
jg near jump_taken
add esi,8
GO_ON
OP_JSGEQ:
cmp eax,edx
jge near jump_taken ; signed comparison
jge near jump_taken ; signed comparison
add esi,8
GO_ON
@ -1350,12 +1167,11 @@ OP_CMPS:
_VERIFYADDRESS eax ; PRI
_VERIFYADDRESS edx ; ALT
mov ebp,eax
add ebp,[esi+4]
dec ebp
add ebp,[esi+4] ; size in bytes
dec ebp ; EBP = PRI + size - 1
_VERIFYADDRESS ebp ; PRI + size - 1
mov ebp,edx
add ebp,[esi+4]
dec ebp
sub ebp,eax ; EBP = size - 1
add ebp,edx ; EBP = ALT + size - 1
_VERIFYADDRESS ebp ; ALT + size - 1
push ecx
@ -1422,21 +1238,7 @@ OP_HALT:
mov eax,esi ; EAX=CIP
sub eax,code
mov [ebp+_cip],eax
; optionally call the debug hook
test DWORD [ebp+_flags], AMX_FLAG_DEBUG
jz short halt_goon
mov DWORD [ebp+_dbgcode],DBG_TERMINATE
mov [ebp+_dbgaddr],eax
mov [ebp+_dbgparam],ebx
mov eax,ebp ; 1st parm: amx
_SAVEREGS
push eax
call [ebp+_debug] ; call debug function
_DROPARGS 4 ; remove arguments from stack
_RESTOREREGS
halt_goon:
mov eax,ebx ; return the parameter of the HALT opcode
jmp _return
_ABORT ebx
OP_BOUNDS:
@ -1460,6 +1262,7 @@ OP_SYSREQ_PRI:
mov alt,edx ; save ALT
mov [ebp+_stk],ecx ; store values in AMX structure (STK, HEA, FRM)
;we don't save regs since they're useless after this
mov ecx,hea
mov ebx,frm
mov [ebp+_hea],ecx
@ -1480,18 +1283,19 @@ OP_SYSREQ_PRI:
push ebp
push esi
push edi
_STK_ALIGN 16 ; align stack to 16-byte boundary and
; allocate 16 bytes of stack space
; push the parameters
push ecx
push ebx
push edx
push eax
mov [esp+12], ecx
mov [esp+08], ebx
mov [esp+04], edx
mov [esp], eax
call [ebp+_callback]
_DROPARGS 10h ; remove arguments from stack
_STK_RESTORE ; restore stack pointer
pop edi ; restore saved registers
pop esi
pop ebp
cmp eax,AMX_ERR_NONE
jne near _return ; return error code, if any
_CHKABORT eax ; if result was invalid, leave
mov eax,pri ; get retval into eax (PRI)
mov edx,alt ; restore ALT
@ -1524,16 +1328,18 @@ OP_SYSREQ_D: ; (TR)
push ebp
push esi
push edi
_STK_ALIGN 16 ; align stack to 16-byte boundary and
; allocate 16 bytes of stack space
; push the parameters
push edx
push eax
mov [esp+04], edx
mov [esp], eax
call ebx ; direct call
_DROPARGS 8 ; remove arguments from stack
_STK_RESTORE ; restore stack pointer
pop edi ; restore saved registers
pop esi
pop ebp
cmp DWORD [ebp+_error],AMX_ERR_NONE
jne near _return ; return error code, if any
mov eax,[ebp+_error]
_CHKABORT eax
; function result is in eax (PRI)
mov edx,alt ; restore ALT
@ -1549,159 +1355,21 @@ OP_FILE:
OP_LINE:
add esi,12
mov ebp,amx
push eax
push edx
mov eax,[esi-8] ; get curline
mov edx,[esi-4] ; get curfile
mov [ebp+_curline],eax
mov [ebp+_curfile],edx
pop edx
pop eax
test DWORD [ebp+_flags], AMX_FLAG_DEBUG
jz short line_goon
; update several structure fields
mov [ebp+_pri],eax
mov [ebp+_alt],edx ; EAX and EDX are now free to use
mov eax,frm
mov edx,hea
mov [ebp+_frm],eax ; store values in AMX structure (STK, FRM & HEA)
mov [ebp+_hea],edx
mov [ebp+_stk],ecx
mov eax,esi
sub eax,code ; EAX = CIP (relative to start of code segment)
mov [ebp+_cip],eax
; call the debugger hook
mov eax,ebp ; 1st parm: amx
_SAVEREGS
push eax
call [ebp+_debug] ; call debug function
_DROPARGS 4 ; remove arguments from stack
cmp eax,AMX_ERR_NONE
je short line_noabort ; continue running
mov [ebp+_dbgcode],eax ; save EAX (error code) before restoring all regs
_RESTOREREGS ; abort run, but restore stack first
mov eax,[ebp+_dbgcode] ; get error code in EAX back again
jmp _return ; return error code
line_noabort:
_RESTOREREGS
mov eax,[ebp+_pri] ; restore PRI and ALT
mov edx,[ebp+_alt]
line_goon:
GO_ON
OP_LINE_nodebug:
add esi,12
mov ebp,amx
push eax
push edx
mov eax,[esi-8] ; get curline
mov edx,[esi-4] ; get curfile
mov [ebp+_curline],eax
mov [ebp+_curfile],edx
pop edx
pop eax
GO_ON
OP_SYMBOL:
mov ebp,amx
test DWORD [ebp+_flags],AMX_FLAG_DEBUG
jz short op_symbol_goon
push eax
push edx
mov eax,[esi+8] ; address
mov edx,[esi+12] ; flags
mov [ebp+_dbgaddr],eax
mov [ebp+_dbgparam],edx
mov DWORD [ebp+_dbgcode],DBG_SYMBOL
mov eax,esi
add eax,16 ; start of symbol name
mov [ebp+_dbgname],eax
mov edx,[esp+8] ; this is FRM, but offset by two PUSH'es
mov [ebp+_frm],edx
mov eax,ebp ; parameter of the debugger hook
_SAVEREGS
push eax
call [ebp+_debug] ; call debugger hook
_DROPARGS 4 ; remove arguments from stack
_RESTOREREGS
pop edx
pop eax
op_symbol_goon:
add esi,[esi+4]
add esi,8 ; skip "fixed" part
GO_ON
OP_SYMBOL_nodebug:
add esi,[esi+4]
add esi,8 ; skip "fixed" part
GO_ON
OP_SRANGE:
mov ebp,amx
add esi,12
test DWORD [ebp+_flags], AMX_FLAG_DEBUG
jz short op_srange_goon
push eax
push edx
mov eax,[esi-8] ; get dimensions
mov edx,[esi-4] ; get size
mov [ebp+_dbgaddr],eax
mov [ebp+_dbgparam],edx
mov DWORD [ebp+_dbgcode],DBG_SRANGE
mov edx,frm
mov [ebp+_frm],edx
mov [ebp+_stk],ecx ; store values in AMX structure (STK & FRM)
; call the debugger hook
mov eax,ebp ; 1st parm: amx
_SAVEREGS
push eax
call [ebp+_debug] ; call debug function
_DROPARGS 4 ; remove arguments from stack
_RESTOREREGS
pop edx
pop eax
op_srange_goon:
GO_ON
OP_SRANGE_nodebug:
add esi,12
GO_ON
OP_SYMTAG:
mov ebp,amx
add esi,8
test DWORD [ebp+_flags], AMX_FLAG_DEBUG
jz short op_symtag_goon
mov ebp,amx
push eax
push edx
mov eax,[esi-4] ; get tag
mov edx,frm
mov DWORD [ebp+_dbgcode],DBG_SRANGE
mov [ebp+_dbgparam],eax
mov [ebp+_frm],edx
mov [ebp+_stk],ecx ; store values in AMX structure (STK & FRM)
; call the debugger hook
mov eax,ebp ; 1st parm: amx
_SAVEREGS
push eax
call [ebp+_debug] ; call debug function
_DROPARGS 4 ; remove arguments from stack
_RESTOREREGS
pop edx
pop eax
op_symtag_goon:
GO_ON
OP_SYMTAG_nodebug: ; (TR)
add esi,8
GO_ON
@ -1759,47 +1427,179 @@ OP_PUSHADDR:
OP_NOP:
add esi,4
GO_ON
OP_FLOAT_MUL:
add esi,4
fld dword [edi+ecx+4]
fmul dword [edi+ecx+8]
sub esp,4
fstp dword [esp]
pop eax
GO_ON
OP_FLOAT_DIV:
add esi,4
fld dword [edi+ecx+4]
fdiv dword [edi+ecx+8]
sub esp,4
fstp dword [esp]
pop eax
GO_ON
OP_FLOAT_ADD:
add esi,4
fld dword [edi+ecx+4]
fadd dword [edi+ecx+8]
sub esp,4
fstp dword [esp]
pop eax
GO_ON
OP_FLOAT_SUB:
add esi,4
fld dword [edi+ecx+4]
fsub dword [edi+ecx+8]
sub esp, 4
fstp dword [esp]
pop eax
GO_ON
OP_FLOAT_TO:
add esi,4
fild dword [edi+ecx+4]
sub esp,4
fstp dword [esp]
pop eax
GO_ON
OP_FLOAT_ROUND:
add esi,4
;get the float control word
push 0
mov ebp,esp
fstcw [ebp]
mov eax,[ebp]
push eax
;clear the top bits
xor ah,ah
;get the control method
push edx
mov edx,[edi+ecx+8]
and edx,3 ;sanity check
shl edx,2 ;shift it to right position
;set the bits
or ah,dl ;set bits 15,14 of FCW to rounding method
or ah,3 ;set precision to 64bit
;calculate
sub esp,4
fld dword [edi+ecx+4]
test edx,edx
jnz .skip_correct
;nearest mode
;correct so as to AVOID bankers rounding
or ah, 4 ;set rounding mode to floor
fadd dword [g_round_nearest]
.skip_correct:
mov [ebp], eax
fldcw [ebp]
frndint
fistp dword [esp]
pop eax
.done:
pop edx
;restore bits
pop ebp
mov [esp], ebp
fldcw [esp]
pop ebp
GO_ON
OP_FLOAT_CMP:
add esi, 4
fld dword [edi+ecx+8]
fld dword [edi+ecx+4]
fucompp
fnstsw ax
fwait
sahf
cmovz eax, [g_flags+4]
cmova eax, [g_flags+8]
cmovb eax, [g_flags+0]
GO_ON
OP_BREAK:
mov ebp,amx ; get amx into ebp
add esi,4
cmp DWORD [ebp+_debug], 0
jnz break_calldebug
GO_ON ; debug hook not active, ignore
break_calldebug:
; store the status in the AMX (FRM, STK, HEA, CIP, and PRI + ALT)
mov [ebp+_pri],eax
mov [ebp+_alt],edx ; EAX and EDX are now free to use
mov eax,frm
mov edx,hea
mov [ebp+_frm],eax ; store values in AMX structure (STK, FRM & HEA)
mov [ebp+_hea],edx
mov [ebp+_stk],ecx
mov eax,esi
sub eax,code ; EAX = CIP (relative to start of code segment)
mov [ebp+_cip],eax
; call the debug hook
mov eax,ebp ; 1st parm: amx
_SAVEREGS
_STK_ALIGN 16 ; align stack to 16-byte boundary and
; allocate 16 bytes of stack space
mov [esp], eax
call [ebp+_debug] ; call debug function
_STK_RESTORE ; restore stack pointer
cmp eax,AMX_ERR_NONE
je short break_noabort; continue running
mov [ebp+_error],eax ; save EAX (error code) before restoring all regs
_RESTOREREGS ; abort run, but restore stack first
mov eax,[ebp+_error] ; get error code in EAX back again
_FASTABORT
break_noabort:
_RESTOREREGS
mov eax,[ebp+_pri] ; restore PRI and ALT
mov edx,[ebp+_alt]
GO_ON
OP_INVALID:
mov eax,AMX_ERR_INVINSTR
jmp _return
_ABORT AMX_ERR_INVINSTR
err_call:
mov eax,AMX_ERR_CALLBACK
jmp _return
_ABORT AMX_ERR_CALLBACK
err_stack:
mov eax,AMX_ERR_STACKERR
jmp _return
_ABORT AMX_ERR_STACKERR
err_stacklow:
mov eax,AMX_ERR_STACKLOW
jmp _return
_ABORT AMX_ERR_STACKLOW
err_memaccess:
mov eax,AMX_ERR_MEMACCESS
jmp _return
_ABORT AMX_ERR_MEMACCESS
err_bounds:
mov eax,AMX_ERR_BOUNDS
jmp _return
_ABORT AMX_ERR_BOUNDS
err_heaplow:
mov eax,AMX_ERR_HEAPLOW
jmp _return
_ABORT AMX_ERR_HEAPLOW
err_divide:
mov eax,AMX_ERR_DIVIDE
jmp _return
_ABORT AMX_ERR_DIVIDE
_return:
; save a few paraneters, mostly for the "sleep"function
; save a few parameters, mostly for the "sleep"function
mov ebp,amx ; get amx into ebp
mov [ebp+_pri],eax ; store values in AMX structure (PRI, ALT)
mov [ebp+_alt],edx ; store values in AMX structure (PRI, ALT)
mov [ebp+_cip],esi ; get corrected cip for amxmodx
mov eax,[ebp+_error]; get error code
pop esi ; remove FRM from stack
@ -1827,6 +1627,14 @@ Start_DATA
lodb_and DD 0ffh, 0ffffh, 0, 0ffffffffh
g_round_nearest DD 0.5
GLOBAL g_flags
g_flags:
DD -1
DD 0
DD 1
GLOBAL amx_opcodelist
GLOBAL _amx_opcodelist
amx_opcodelist:
@ -1967,144 +1775,11 @@ _amx_opcodelist DD OP_INVALID
DD OP_NOP
DD OP_SYSREQ_D
DD OP_SYMTAG
GLOBAL amx_opcodelist_nodebug
GLOBAL _amx_opcodelist_nodebug
amx_opcodelist_nodebug:
_amx_opcodelist_nodebug DD OP_INVALID
DD OP_LOAD_PRI
DD OP_LOAD_ALT
DD OP_LOAD_S_PRI
DD OP_LOAD_S_ALT
DD OP_LREF_PRI
DD OP_LREF_ALT
DD OP_LREF_S_PRI
DD OP_LREF_S_ALT
DD OP_LOAD_I
DD OP_LODB_I
DD OP_CONST_PRI
DD OP_CONST_ALT
DD OP_ADDR_PRI
DD OP_ADDR_ALT
DD OP_STOR_PRI
DD OP_STOR_ALT
DD OP_STOR_S_PRI
DD OP_STOR_S_ALT
DD OP_SREF_PRI
DD OP_SREF_ALT
DD OP_SREF_S_PRI
DD OP_SREF_S_ALT
DD OP_STOR_I
DD OP_STRB_I
DD OP_LIDX
DD OP_LIDX_B
DD OP_IDXADDR
DD OP_IDXADDR_B
DD OP_ALIGN_PRI
DD OP_ALIGN_ALT
DD OP_LCTRL
DD OP_SCTRL
DD OP_MOVE_PRI
DD OP_MOVE_ALT
DD OP_XCHG
DD OP_PUSH_PRI
DD OP_PUSH_ALT
DD OP_PUSH_R_PRI
DD OP_PUSH_C
DD OP_PUSH
DD OP_PUSH_S
DD OP_POP_PRI
DD OP_POP_ALT
DD OP_STACK_nodebug
DD OP_HEAP
DD OP_PROC
DD OP_RET_nodebug
DD OP_RETN_nodebug
DD OP_CALL_nodebug
DD OP_CALL_PRI_nodebug
DD OP_JUMP
DD OP_JREL
DD OP_JZER
DD OP_JNZ
DD OP_JEQ
DD OP_JNEQ
DD OP_JLESS
DD OP_JLEQ
DD OP_JGRTR
DD OP_JGEQ
DD OP_JSLESS
DD OP_JSLEQ
DD OP_JSGRTR
DD OP_JSGEQ
DD OP_SHL
DD OP_SHR
DD OP_SSHR
DD OP_SHL_C_PRI
DD OP_SHL_C_ALT
DD OP_SHR_C_PRI
DD OP_SHR_C_ALT
DD OP_SMUL
DD OP_SDIV
DD OP_SDIV_ALT
DD OP_UMUL
DD OP_UDIV
DD OP_UDIV_ALT
DD OP_ADD
DD OP_SUB
DD OP_SUB_ALT
DD OP_AND
DD OP_OR
DD OP_XOR
DD OP_NOT
DD OP_NEG
DD OP_INVERT
DD OP_ADD_C
DD OP_SMUL_C
DD OP_ZERO_PRI
DD OP_ZERO_ALT
DD OP_ZERO
DD OP_ZERO_S
DD OP_SIGN_PRI
DD OP_SIGN_ALT
DD OP_EQ
DD OP_NEQ
DD OP_LESS
DD OP_LEQ
DD OP_GRTR
DD OP_GEQ
DD OP_SLESS
DD OP_SLEQ
DD OP_SGRTR
DD OP_SGEQ
DD OP_EQ_C_PRI
DD OP_EQ_C_ALT
DD OP_INC_PRI
DD OP_INC_ALT
DD OP_INC
DD OP_INC_S
DD OP_INC_I
DD OP_DEC_PRI
DD OP_DEC_ALT
DD OP_DEC
DD OP_DEC_S
DD OP_DEC_I
DD OP_MOVS
DD OP_CMPS
DD OP_FILL
DD OP_HALT
DD OP_BOUNDS
DD OP_SYSREQ_PRI
DD OP_SYSREQ_C
DD OP_FILE
DD OP_LINE_nodebug
DD OP_SYMBOL_nodebug
DD OP_SRANGE_nodebug
DD OP_JUMP_PRI
DD OP_SWITCH
DD OP_CASETBL
DD OP_SWAP_PRI
DD OP_SWAP_ALT
DD OP_PUSHADDR
DD OP_NOP
DD OP_SYSREQ_D
DD OP_SYMTAG_nodebug
DD OP_BREAK
DD OP_FLOAT_MUL
DD OP_FLOAT_DIV
DD OP_FLOAT_ADD
DD OP_FLOAT_SUB
DD OP_FLOAT_TO
DD OP_FLOAT_ROUND
DD OP_FLOAT_CMP

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,53 +1,42 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef AMXMODX_H
#define AMXMODX_H
#if defined PLATFORM_POSIX
#include <unistd.h>
#include <stdlib.h>
#include "sclinux.h"
#endif
#include <ctype.h> //tolower, etc
#include "string.h"
#include <extdll.h>
#include <meta_api.h>
#ifdef MEMORY_TEST
#include "mmgr/mmgr.h"
#ifdef _MSC_VER
// MSVC8 - replace POSIX functions with ISO C++ conformant ones as they are deprecated
#if _MSC_VER >= 1400
#define unlink _unlink
#define mkdir _mkdir
#define strdup _strdup
#endif
#endif
#include "md5.h"
#include "CVector.h"
#include "CList.h"
#include "CQueue.h"
#include "hashing.h"
#include "modules.h"
#include "CString.h"
#include "CPlugin.h"
#include "CLibrarySys.h"
#include <auto-string.h>
#include <amtl/am-string.h>
#include <amtl/am-vector.h>
#include <amtl/am-inlinelist.h>
#include "CMisc.h"
#include "CVault.h"
#include "CModule.h"
@ -55,39 +44,62 @@
#include "CLogEvent.h"
#include "CForward.h"
#include "CCmd.h"
#include "CMenu.h"
#include "CEvent.h"
#include "CLang.h"
#include "fakemeta.h"
#include "amxxlog.h"
#include "CvarManager.h"
#include "CoreConfig.h"
#include "CFrameAction.h"
#include <amxmodx_version.h>
#include <HLTypeConversion.h>
#define AMXXLOG_Log g_log.Log
#define AMX_VERSION "0.2"
#define AMXXLOG_Error g_log.LogError
extern AMX_NATIVE_INFO core_Natives[];
extern AMX_NATIVE_INFO time_Natives[];
extern AMX_NATIVE_INFO power_Natives[];
extern AMX_NATIVE_INFO amxmod_Natives[];
extern AMX_NATIVE_INFO file_Natives[];
extern AMX_NATIVE_INFO float_Natives[];
extern AMX_NATIVE_INFO string_Natives[];
extern AMX_NATIVE_INFO vault_Natives[];
extern AMX_NATIVE_INFO core_Natives[];
extern AMX_NATIVE_INFO time_Natives[];
extern AMX_NATIVE_INFO power_Natives[];
extern AMX_NATIVE_INFO amxmodx_Natives[];
extern AMX_NATIVE_INFO file_Natives[];
extern AMX_NATIVE_INFO float_Natives[];
extern AMX_NATIVE_INFO string_Natives[];
extern AMX_NATIVE_INFO vault_Natives[];
extern AMX_NATIVE_INFO msg_Natives[];
extern AMX_NATIVE_INFO vector_Natives[];
extern AMX_NATIVE_INFO g_SortNatives[];
extern AMX_NATIVE_INFO g_DataStructNatives[];
extern AMX_NATIVE_INFO g_StackNatives[];
extern AMX_NATIVE_INFO g_TextParserNatives[];
extern AMX_NATIVE_INFO g_CvarNatives[];
extern AMX_NATIVE_INFO g_GameConfigNatives[];
#ifndef __linux__
#if defined PLATFORM_WINDOWS
#define DLLOAD(path) (DLHANDLE)LoadLibrary(path)
#define DLPROC(m,func) GetProcAddress(m,func)
#define DLPROC(m, func) GetProcAddress(m, func)
#define DLFREE(m) FreeLibrary(m)
#else
#define DLLOAD(path) (DLHANDLE)dlopen(path, RTLD_NOW)
#define DLPROC(m,func) dlsym(m,func)
#define DLLOAD(path) (DLHANDLE)dlopen(path, RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND)
#define DLPROC(m, func) dlsym(m, func)
#define DLFREE(m) dlclose(m)
#endif
#ifndef __linux__
typedef HINSTANCE DLHANDLE;
#if defined __GNUC__
#include <stdint.h>
typedef intptr_t _INT_PTR;
#else
typedef void* DLHANDLE;
#if defined AMD64
typedef __int64 _INT_PTR;
#else
typedef __int32 _INT_PTR;
#endif
#endif
#if defined PLATFORM_WINDOWS
typedef HINSTANCE DLHANDLE;
#else
typedef void* DLHANDLE;
#define INFINITE 0xFFFFFFFF
#endif
#ifndef GETPLAYERAUTHID
@ -101,64 +113,92 @@ typedef void* DLHANDLE;
#define SETCLIENTLISTENING (*g_engfuncs.pfnVoice_SetClientListening)
#define SETCLIENTMAXSPEED (*g_engfuncs.pfnSetClientMaxspeed)
#define MAX_BUFFER_LENGTH 16384
char* UTIL_SplitHudMessage(register const char *src);
int UTIL_ReadFlags(const char* c);
void UTIL_ClientPrint( edict_t *pEntity, int msg_dest, char *msg );
void UTIL_FakeClientCommand(edict_t *pEdict, const char *cmd, const char *arg1 = NULL, const char *arg2 = NULL);
void UTIL_GetFlags(char* flags,int flag);
void UTIL_HudMessage(edict_t *pEntity, const hudtextparms_t &textparms, char *pMessage);
void UTIL_IntToString(int value, char *output);
void UTIL_ShowMOTD( edict_t *client , char *motd, int mlen, const char *name);
void UTIL_ShowMenu( edict_t* pEntity, int slots, int time, char *menu, int mlen );
void UTIL_ClientPrint(edict_t *pEntity, int msg_dest, char *msg);
void UTIL_FakeClientCommand(edict_t *pEdict, const char *cmd, const char *arg1 = NULL, const char *arg2 = NULL, bool fwd = false);
void UTIL_GetFlags(char* flags, int flag);
void UTIL_HudMessage(edict_t *pEntity, const hudtextparms_t &textparms, const char *pMessage);
void UTIL_DHudMessage(edict_t *pEntity, const hudtextparms_t &textparms, const char *pMessage, unsigned int length);
void UTIL_IntToString(int value, char *output);
void UTIL_ShowMOTD(edict_t *client, char *motd, int mlen, const char *name);
void UTIL_ShowMenu(edict_t* pEntity, int slots, int time, char *menu, int mlen);
void UTIL_ClientSayText(edict_t *pEntity, int sender, char *msg);
void UTIL_TeamInfo(edict_t *pEntity, int playerIndex, const char *pszTeamName);
template <typename D> int UTIL_CheckValidChar(D *c);
template <typename D, typename S> unsigned int strncopy(D *dest, const S *src, size_t count);
unsigned int UTIL_GetUTF8CharBytes(const char *stream);
size_t UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive);
size_t UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive);
char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive);
void UTIL_TrimLeft(char *buffer);
void UTIL_TrimRight(char *buffer);
char* utf8stristr(const char *string1, const char *string2);
int utf8strncasecmp(const char *string1, const char *string2, size_t n);
int utf8strcasecmp(const char *string1, const char *string2);
#define GET_PLAYER_POINTER(e) (&g_players[ENTINDEX(e)])
//#define GET_PLAYER_POINTER(e) (&g_players[(((int)e-g_edict_point)/sizeof(edict_t ))])
//#define GET_PLAYER_POINTER(e) (&g_players[(((int)e-g_edict_point)/sizeof(edict_t))])
#define GET_PLAYER_POINTER_I(i) (&g_players[i])
struct WeaponsVault {
String fullName;
short int iId;
short int ammoSlot;
struct WeaponsVault
{
ke::AString fullName;
short int iId;
short int ammoSlot;
};
struct fakecmd_t {
char args[256];
const char *argv[3];
//char argv[3][128];
int argc;
bool fake;
struct fakecmd_t
{
char args[256];
const char *argv[3];
int argc;
bool fake;
bool notify; // notify to plugins.
};
extern CLog g_log;
extern CPluginMngr g_plugins;
extern CTaskMngr g_tasksMngr;
extern CFrameActionMngr g_frameActionMngr;
extern CPlayer g_players[33];
extern CPlayer* mPlayer;
extern CmdMngr g_commands;
extern CList<CCVar> g_cvars;
extern CList<ForceObject> g_forcemodels;
extern CList<ForceObject> g_forcesounds;
extern CList<ForceObject> g_forcegeneric;
extern CList<CModule,const char *> g_modules;
extern CList<CPlayer*> g_auth;
extern ke::Vector<ke::AutoPtr<ForceObject>> g_forcemodels;
extern ke::Vector<ke::AutoPtr<ForceObject>> g_forcesounds;
extern ke::Vector<ke::AutoPtr<ForceObject>> g_forcegeneric;
extern ke::Vector<ke::AutoPtr<CPlayer *>> g_auth;
extern ke::InlineList<CModule> g_modules;
extern ke::InlineList<CScript> g_loadedscripts;
extern EventsMngr g_events;
extern Grenades g_grenades;
extern LogEventsMngr g_logevents;
extern MenuMngr g_menucmds;
extern CLangMngr g_langMngr;
extern String g_log_dir;
extern String g_mod_name;
extern ke::AString g_log_dir;
extern ke::AString g_mod_name;
extern TeamIds g_teamsIds;
extern Vault g_vault;
extern CForwardMngr g_forwards;
extern CForwardMngr g_forwards;
extern WeaponsVault g_weaponsData[MAX_WEAPONS];
extern XVars g_xvars;
extern bool g_bmod_cstrike;
extern bool g_bmod_dod;
extern bool g_bmod_dmc;
extern bool g_bmod_ricochet;
extern bool g_bmod_valve;
extern bool g_bmod_gearbox;
extern bool g_official_mod;
extern bool g_dontprecache;
extern int g_srvindex;
extern cvar_t* amxmodx_version;
extern cvar_t* amxmodx_debug;
extern cvar_t* amxmodx_language;
extern cvar_t* amxmodx_perflog;
extern cvar_t* hostname;
extern cvar_t* mp_timelimit;
extern fakecmd_t g_fakecmd;
@ -166,6 +206,7 @@ extern float g_game_restarting;
extern float g_game_timeleft;
extern float g_task_time;
extern float g_auth_time;
extern bool g_NewDLL_Available;
extern hudtextparms_t g_hudset;
//extern int g_edict_point;
extern int g_players_num;
@ -198,6 +239,8 @@ extern int gmsgWeaponList;
extern int gmsgintermission;
extern int gmsgResetHUD;
extern int gmsgRoundTime;
extern int gmsgSayText;
extern int gmsgInitHUD;
void Client_AmmoPickup(void*);
void Client_AmmoX(void*);
@ -210,18 +253,17 @@ void Client_VGUIMenu(void*);
void Client_WeaponList(void*);
void Client_DamageEnd(void*);
void Client_DeathMsg(void*);
void Client_InitHUDEnd(void*);
void amx_command();
void plugin_srvcmd();
const char* stristr(const char* a,const char* b);
const char* stristr(const char* a, const char* b);
char *strptime(const char *buf, const char *fmt, struct tm *tm, short addthem);
int loadModules(const char* filename);
int loadModules(const char* filename, PLUG_LOADTIME now);
void detachModules();
void detachReloadModules();
void attachModules();
void attachMetaModModules(PLUG_LOADTIME now, const char* filename);
// Count modules
enum CountModulesMode
@ -233,42 +275,53 @@ enum CountModulesMode
int countModules(CountModulesMode mode);
void modules_callPluginsLoaded();
void modules_callPluginsUnloaded();
void modules_callPluginsUnloading();
int add_amxnatives(module_info_s* info,AMX_NATIVE_INFO*natives);
cell* get_amxaddr(AMX *amx,cell amx_addr);
char* build_pathname(char *fmt, ... );
char* format_amxstring(AMX *amx, cell *params, int parm,int& len);
AMX* get_amxscript(int, void**,const char**);
cell* get_amxaddr(AMX *amx, cell amx_addr);
char* build_pathname(const char *fmt, ...);
char* build_pathname_r(char *buffer, size_t maxlen, const char *fmt, ...);
char* format_amxstring(AMX *amx, cell *params, int parm, int& len);
AMX* get_amxscript(int, void**, const char**);
const char* get_amxscriptname(AMX* amx);
char* get_amxstring(AMX *amx,cell amx_addr,int id,int& len);
char* get_amxstring(AMX *amx, cell amx_addr, int id, int& len);
char* get_amxstring_null(AMX *amx, cell amx_addr, int id, int& len);
cell* get_amxvector_null(AMX *amx, cell amx_addr);
extern "C" size_t get_amxstring_r(AMX *amx, cell amx_addr, char *destination, int maxlen);
int amxstring_len(cell* cstr);
int load_amxscript(AMX* amx, void** program, const char* path, char error[64], int debug);
int set_amxnatives(AMX* amx,char error[64]);
int set_amxstring(AMX *amx,cell amx_addr,const char *source,int max);
int unload_amxscript(AMX* amx,void** program);
void copy_amxmemory(cell* dest,cell* src,int len);
int load_amxscript_ex(AMX* amx, void** program, const char* path, char *error, size_t maxLength, int debug);
int set_amxnatives(AMX* amx, char error[64]);
int set_amxstring(AMX *amx, cell amx_addr, const char *source, int max);
int set_amxstring_simple(cell *dest, const char *source, int max);
template <typename T> int set_amxstring_utf8(AMX *amx, cell amx_addr, const T *source, size_t sourcelen, size_t maxlen);
int set_amxstring_utf8_char(AMX *amx, cell amx_addr, const char *source, size_t sourcelen, size_t maxlen);
int set_amxstring_utf8_cell(AMX *amx, cell amx_addr, const cell *source, size_t sourcelen, size_t maxlen);
int unload_amxscript(AMX* amx, void** program);
void copy_amxmemory(cell* dest, cell* src, int len);
void get_modname(char*);
void print_srvconsole( char *fmt, ... );
void report_error( int code, char* fmt, ... );
void* alloc_amxmemory(void**, int size);
void free_amxmemory(void **ptr);
void print_srvconsole(const char *fmt, ...);
void report_error(int code, const char* fmt, ...);
// get_localinfo
const char* get_localinfo( const char* name , const char* def );
cell AMX_NATIVE_CALL require_module(AMX *amx, cell *params);
void LogError(AMX *amx, int err, const char *fmt, ...);
const char* get_localinfo(const char* name, const char* def);
extern "C" void LogError(AMX *amx, int err, const char *fmt, ...);
enum ModuleCallReason
{
ModuleCall_NotCalled = 0, // nothing
ModuleCall_Query, // in Query func
ModuleCall_Attach, // in Attach func
ModuleCall_Detach, // in Detach func
ModuleCall_NotCalled = 0, // nothing
ModuleCall_Query, // in Query func
ModuleCall_Attach, // in Attach func
ModuleCall_Detach, // in Detach func
};
extern ModuleCallReason g_ModuleCallReason; // modules.cpp
extern CModule *g_CurrentlyCalledModule; // modules.cpp
extern const char *g_LastRequestedFunc; // modules.cpp
extern CQueue<String> CurModuleList;
void Module_CacheFunctions();
void Module_UncacheFunctions();
void *Module_ReqFnptr(const char *funcName); // modules.cpp
@ -286,7 +339,38 @@ extern int FF_PluginLog;
extern int FF_PluginEnd;
extern int FF_InconsistentFile;
extern int FF_ClientAuthorized;
extern int FF_ChangeLevel;
extern int FF_ClientConnectEx;
extern bool g_coloredmenus;
typedef void (*AUTHORIZEFUNC)(int player, const char *authstring);
#define MM_CVAR2_VERS 13
struct func_s
{
void *pfn;
const char *desc;
};
enum AdminProperty
{
Admin_Auth = 0,
Admin_Password,
Admin_Access,
Admin_Flags
};
enum PrintColor
{
print_team_default = 0,
print_team_grey =-1,
print_team_red = -2,
print_team_blue = -3,
};
extern enginefuncs_t *g_pEngTable;
extern HLTypeConversion TypeConversion;
extern CFakeMeta g_FakeMeta;
#endif // AMXMODX_H

View File

@ -2,8 +2,6 @@
*
* Copyright (c) ITB CompuPhase, 2001-2002
* This file may be freely used. No warranties of any kind.
*
* Version: $Id$
*/
#include <time.h>
#include <assert.h>
@ -18,6 +16,8 @@
# endif
#endif
#include <stdlib.h>
// this file does not include amxmodx.h, so we have to include the memory manager here
#ifdef MEMORY_TEST
#include "mmgr/mmgr.h"
@ -52,7 +52,7 @@ static cell AMX_NATIVE_CALL _time(AMX *amx, cell *params)
/* the time() function returns the number of seconds since January 1 1970
* in Universal Coordinated Time (the successor to Greenwich Mean Time)
*/
return sec1970;
return (cell)sec1970;
}
#if defined __BORLANDC__ || defined __WATCOMC__

View File

@ -1,11 +0,0 @@
; /usr/local/cross-tools/bin/i386-mingw32msvc-dlltool --base-file /tmp/cc4kB6s0.base --output-exp amx_mm.exp --dllname amx_mm.dll --output-def amx_mm.def --add-stdcall-alias --exclude-symbol=DllMainCRTStartup@12 --def /tmp/ccyI7I7K.def
EXPORTS
GetEngineFunctions @ 1 ;
GetEngineFunctions_Post @ 2 ;
GetEntityAPI2 @ 3 ;
GetEntityAPI2_Post @ 4 ;
GiveFnptrsToDll = GiveFnptrsToDll@8 @ 5 ;
GiveFnptrsToDll@8 @ 6 ;
Meta_Attach @ 7 ;
Meta_Detach @ 8 ;
Meta_Query @ 9 ;

View File

@ -1,33 +1,11 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "amxxfile.h"
@ -36,28 +14,25 @@
/**********************
****** AMXXFILE ******
**********************/
#if defined __GNUC__
#define PACKED __attribute__((packed))
#define PACKED __attribute__((packed))
#else
#define PACKED
#define PACKED
#endif
#if defined __linux__
#pragma pack(1) /* structures must be packed (byte-aligned) */
#if defined(__linux__) || defined(__APPLE__)
#pragma pack(1) /* structures must be packed (byte-aligned) */
#else
#pragma pack(1) /* structures must be packed (byte-aligned) */
#if defined __TURBOC__
#pragma option -a- /* "pack" pragma for older Borland compilers */
#endif
#pragma pack(1) /* structures must be packed (byte-aligned) */
#if defined __TURBOC__
#pragma option -a- /* "pack" pragma for older Borland compilers */
#endif
#endif
typedef char mint8_t;
typedef int16_t mint16_t;
typedef int32_t mint32_t;
struct TableEntry
{
mint8_t cellSize PACKED;
mint8_t cellSize;
mint32_t origSize PACKED; // contains AMX_HEADER->stp
mint32_t offset PACKED;
};
@ -76,6 +51,9 @@ struct TableEntry
CAmxxReader::CAmxxReader(const char *filename, int cellsize)
{
m_Bh.plugins = NULL;
m_AmxxFile = false;
if (!filename)
{
m_Status = Err_InvalidParam;
@ -84,8 +62,8 @@ CAmxxReader::CAmxxReader(const char *filename, int cellsize)
m_Status = Err_None;
m_CellSize = cellsize;
m_pFile = fopen(filename, "rb");
if (!m_pFile)
{
m_Status = Err_FileOpen;
@ -96,42 +74,71 @@ CAmxxReader::CAmxxReader(const char *filename, int cellsize)
DATAREAD(&magic, sizeof(magic), 1);
m_OldFile = false;
if (magic != 0x414D5842)
if (magic == 0x524C4542)
{
// check for old file
AMX_HEADER hdr;
rewind(m_pFile);
fread(&hdr, sizeof(hdr), 1, m_pFile);
amx_Align16(&hdr.magic);
if (hdr.magic == AMX_MAGIC)
{
if (cellsize != 4)
{
m_Status = Err_SectionNotFound;
fclose(m_pFile);
m_pFile = NULL;
return;
}
m_OldFile = true;
return;
}
else
{
// no known file format
m_Status = Err_FileInvalid;
fclose(m_pFile);
m_pFile = NULL;
return;
}
} else if ( magic == 0x524C4542 ) {
//we have an invalid, old, RLEB file
m_Status = Err_OldFile;
fclose(m_pFile);
m_pFile = NULL;
return;
} else {
}
else if (magic == MAGIC_HEADER2)
{
DATAREAD(&m_Bh.version, sizeof(int16_t), 1);
if (m_Bh.version > MAGIC_VERSION)
{
m_Status = Err_OldFile;
fclose(m_pFile);
m_pFile = NULL;
return;
}
m_AmxxFile = true;
DATAREAD(&m_Bh.numPlugins, sizeof(mint8_t), 1);
m_Bh.plugins = new PluginEntry[m_Bh.numPlugins];
PluginEntry *pe;
m_SectionHdrOffset = 0;
m_Entry = -1;
for (mint8_t i = 0; i < m_Bh.numPlugins; i++)
{
pe = &(m_Bh.plugins[(unsigned)i]);
DATAREAD(&pe->cellsize, sizeof(mint8_t), 1);
DATAREAD(&pe->disksize, sizeof(int32_t), 1);
DATAREAD(&pe->imagesize, sizeof(int32_t), 1);
DATAREAD(&pe->memsize, sizeof(int32_t), 1);
DATAREAD(&pe->offs, sizeof(int32_t), 1);
}
for (mint8_t i = 0; i < m_Bh.numPlugins; i++)
{
pe = &(m_Bh.plugins[(unsigned)i]);
if (pe->cellsize == m_CellSize)
{
m_Entry = i;
break;
}
}
if (m_Entry == -1)
{
m_Status = Err_SectionNotFound;
fclose(m_pFile);
m_pFile = NULL;
return;
}
pe = &(m_Bh.plugins[m_Entry]);
m_SectionLength = pe->disksize;
}
else if (magic == MAGIC_HEADER)
{
// try to find the section
mint8_t numOfPlugins;
DATAREAD(&numOfPlugins, sizeof(numOfPlugins), 1);
@ -140,6 +147,7 @@ CAmxxReader::CAmxxReader(const char *filename, int cellsize)
m_SectionHdrOffset = 0;
int i = 0;
for (i = 0; i < static_cast<int>(numOfPlugins); ++i)
{
DATAREAD(&entry, sizeof(entry), 1);
@ -149,6 +157,7 @@ CAmxxReader::CAmxxReader(const char *filename, int cellsize)
break;
}
}
if (!m_SectionHdrOffset)
{
m_Status = Err_SectionNotFound;
@ -158,19 +167,46 @@ CAmxxReader::CAmxxReader(const char *filename, int cellsize)
}
// compute section length
if ((i+1) < static_cast<int>(numOfPlugins))
if ((i + 1) < static_cast<int>(numOfPlugins))
{
// there is a next section
TableEntry nextEntry;
DATAREAD(&nextEntry, sizeof(nextEntry), 1);
m_SectionLength = nextEntry.offset - entry.offset;
}
else
{
} else {
fseek(m_pFile, 0, SEEK_END);
m_SectionLength = ftell(m_pFile) - (long)entry.offset;
}
}
} else {
// check for old file
AMX_HEADER hdr;
rewind(m_pFile);
fread(&hdr, sizeof(hdr), 1, m_pFile);
amx_Align16(&hdr.magic);
if (hdr.magic == AMX_MAGIC)
{
if (cellsize != 4)
{
m_Status = Err_SectionNotFound;
fclose(m_pFile);
m_pFile = NULL;
return;
}
m_OldFile = true;
return;
} else {
// no known file format
m_Status = Err_FileInvalid;
fclose(m_pFile);
m_pFile = NULL;
return;
}
}
}
CAmxxReader::~CAmxxReader()
@ -180,6 +216,12 @@ CAmxxReader::~CAmxxReader()
fclose(m_pFile);
m_pFile = NULL;
}
if (m_Bh.plugins)
{
delete [] m_Bh.plugins;
m_Bh.plugins = NULL;
}
}
CAmxxReader::Error CAmxxReader::GetStatus()
@ -205,7 +247,6 @@ size_t CAmxxReader::GetBufferSize()
if (!m_pFile)
return 0;
long save = ftell(m_pFile);
if (m_OldFile)
@ -214,20 +255,31 @@ size_t CAmxxReader::GetBufferSize()
AMX_HEADER hdr;
DATAREAD(&hdr, sizeof(hdr), 1);
fseek(m_pFile, save, SEEK_SET);
return hdr.stp;
}
else if (m_AmxxFile)
{
PluginEntry *pe = &(m_Bh.plugins[m_Entry]);
if (pe->imagesize > pe->memsize)
return pe->imagesize + 1;
return pe->memsize + 1;
}
fseek(m_pFile, m_SectionHdrOffset, SEEK_SET);
TableEntry entry;
DATAREAD(&entry, sizeof(entry), 1);
fseek(m_pFile, save, SEEK_SET);
return entry.origSize + 1; // +1 : safe
}
#undef DATAREAD
#define DATAREAD(addr, itemsize, itemcount) \
if (fread(addr, itemsize, itemcount, m_pFile) != itemcount) \
if (fread(addr, itemsize, itemcount, m_pFile) != static_cast<size_t>(itemcount)) \
{ \
if (feof(m_pFile)) \
m_Status = Err_FileInvalid; \
@ -237,7 +289,18 @@ size_t CAmxxReader::GetBufferSize()
m_pFile = NULL; \
return m_Status; \
}
#define DATAREAD_RELEASE(addr, itemsize, itemcount) \
if (fread(addr, itemsize, itemcount, m_pFile) != static_cast<size_t>(itemcount)) \
{ \
if (feof(m_pFile)) \
m_Status = Err_FileInvalid; \
else \
m_Status = Err_FileRead; \
fclose(m_pFile); \
m_pFile = NULL; \
delete[] tempBuffer;\
return m_Status; \
}
CAmxxReader::Error CAmxxReader::GetSection(void *buffer)
{
if (!m_pFile)
@ -251,31 +314,51 @@ CAmxxReader::Error CAmxxReader::GetSection(void *buffer)
rewind(m_pFile);
DATAREAD(buffer, 1, filesize);
m_Status = Err_None;
return m_Status;
}
// new file type: go to the section table entry
fseek(m_pFile, m_SectionHdrOffset, SEEK_SET);
// go to the offset
TableEntry entry;
DATAREAD(&entry, sizeof(entry), 1);
fseek(m_pFile, entry.offset, SEEK_SET);
// AMXXLOG_Log("|||| Offset needed: %d At: %d", entry.offset, ftell(m_pFile));
uLongf destLen = GetBufferSize();
// read the data to a temporary buffer
char *tempBuffer = new char[m_SectionLength + 1];
//fread(tempBuffer, sizeof(char), m_SectionLength, m_pFile);
DATAREAD((void*)tempBuffer, 1, m_SectionLength);
// decompress
// AMXXLOG_Log("|||| First Bytes: %d %d %d %d", tempBuffer[0], tempBuffer[1], tempBuffer[2], tempBuffer[3]);
int result = uncompress((Bytef *)buffer, &destLen,
(Bytef *)tempBuffer, m_SectionLength);
delete [] tempBuffer;
// AMXXLOG_Log("|||| Result: %d, m_SectionLength=%d, destLen=%d", result, m_SectionLength, destLen);
if (result != Z_OK)
else if (m_AmxxFile)
{
m_Status = Err_Decompress;
return Err_Decompress;
PluginEntry *pe = &(m_Bh.plugins[m_Entry]);
char *tempBuffer = new char[m_SectionLength + 1];
fseek(m_pFile, pe->offs, SEEK_SET);
DATAREAD_RELEASE((void *)tempBuffer, 1, m_SectionLength);
uLongf destLen = GetBufferSize();
int result = uncompress((Bytef *)buffer, &destLen, (Bytef *)tempBuffer, m_SectionLength);
delete [] tempBuffer;
if (result != Z_OK)
{
AMXXLOG_Log("[AMXX] Zlib error encountered: %d(%d)", result, m_SectionLength);
m_Status = Err_Decompress;
return Err_Decompress;
}
return Err_None;
} else {
// new file type: go to the section table entry
fseek(m_pFile, m_SectionHdrOffset, SEEK_SET);
// go to the offset
TableEntry entry;
DATAREAD(&entry, sizeof(entry), 1);
fseek(m_pFile, entry.offset, SEEK_SET);
uLongf destLen = GetBufferSize();
// read the data to a temporary buffer
char *tempBuffer = new char[m_SectionLength + 1];
//fread(tempBuffer, sizeof(char), m_SectionLength, m_pFile);
DATAREAD_RELEASE((void*)tempBuffer, 1, m_SectionLength);
// decompress
int result = uncompress((Bytef *)buffer, &destLen, (Bytef *)tempBuffer, m_SectionLength);
delete [] tempBuffer;
if (result != Z_OK)
{
AMXXLOG_Log("[AMXX] Zlib error encountered: %d(%d)", result, m_SectionLength);
m_Status = Err_Decompress;
return Err_Decompress;
}
return Err_None;
}
return Err_None;
}

View File

@ -1,37 +1,40 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef __AMXXFILE_H__
#define __AMXXFILE_H__
#define MAGIC_HEADER 0x414D5842
#define MAGIC_HEADER2 0x414D5858
#define MAGIC_VERSION 0x0300
typedef char mint8_t;
typedef int16_t mint16_t;
typedef int32_t mint32_t;
struct PluginEntry
{
mint8_t cellsize; //cell size
int32_t imagesize; //uncompressed image size
int32_t disksize; //compressed image size
int32_t memsize; //memory image size
int32_t offs; //file offset
};
struct BinHeader
{
int32_t magic;
mint16_t version;
mint8_t numPlugins;
PluginEntry *plugins;
};
class CAmxxReader
{
public:
@ -53,6 +56,9 @@ private:
FILE *m_pFile;
bool m_OldFile; // old .amx file
bool m_AmxxFile; // new 'AMXX' header format
BinHeader m_Bh; // binary header
int m_Entry; // entry #
int m_CellSize;
int m_SectionHdrOffset; // offset to the table in the header that describes the required section
@ -64,8 +70,7 @@ public:
Error GetStatus(); // Get the current status
size_t GetBufferSize(); // Get the size for the buffer
Error GetSection(void *buffer); // Copy the currently selected section to the buffer
inline bool IsOldFile() const { return m_OldFile; }
};
#endif // __AMXXFILE_H__

View File

@ -1,32 +1,11 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
// amxx_logging localinfo:
// 0 = no logging
@ -35,19 +14,23 @@
// 3 = HL Logs
#include <time.h>
#ifndef __linux__
#include <io.h>
#if defined(_WIN32)
#include <io.h>
#endif
#include "amxmodx.h"
#ifndef __linux__
#define vsnprintf _vsnprintf
#if defined(_WIN32WIN32)
#define vsnprintf _vsnprintf
#endif
#include <amxmodx_version.h>
CLog::CLog()
{
m_LogType = 0;
m_LogFile.clear();
m_LogFile = nullptr;
m_FoundError = false;
m_LoggedErrMap = false;
}
CLog::~CLog()
@ -58,13 +41,14 @@ CLog::~CLog()
void CLog::CloseFile()
{
// log "log file closed" to old file, if any
if (!m_LogFile.empty())
if (m_LogFile.length())
{
FILE *fp = fopen(m_LogFile.c_str(), "r");
FILE *fp = fopen(m_LogFile.chars(), "r");
if (fp)
{
fclose(fp);
fopen(m_LogFile.c_str(), "a+");
fp = fopen(m_LogFile.chars(), "a+");
// get time
time_t td;
@ -77,76 +61,99 @@ void CLog::CloseFile()
fprintf(fp, "L %s: %s\n", date, "Log file closed.");
fclose(fp);
}
m_LogFile.clear();
m_LogFile = nullptr;
}
}
void CLog::CreateNewFile()
{
CloseFile();
// build filename
time_t td;
time(&td);
tm *curTime = localtime(&td);
char file[PLATFORM_MAX_PATH];
char name[256];
int i = 0;
while (true)
{
m_LogFile.assign(build_pathname("%s/L%02d%02d%03d.log", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday, i));
FILE *pTmpFile = fopen(m_LogFile.c_str(), "r"); // open for reading to check whether the file exists
ke::SafeSprintf(name, sizeof(name), "%s/L%02d%02d%03d.log", g_log_dir.chars(), curTime->tm_mon + 1, curTime->tm_mday, i);
build_pathname_r(file, sizeof(file), "%s", name);
FILE *pTmpFile = fopen(file, "r"); // open for reading to check whether the file exists
if (!pTmpFile)
break;
fclose(pTmpFile);
++i;
}
m_LogFile = file;
// Log logfile start
FILE *fp = fopen(m_LogFile.c_str(), "w");
FILE *fp = fopen(m_LogFile.chars(), "w");
if (!fp)
{
ALERT(at_logged, "[AMXX] Unexpected fatal logging error. AMXX Logging disabled.\n");
SET_LOCALINFO("amxx_logging", "0");
} else {
fprintf(fp, "AMX Mod X log file started (file \"%s\") (version \"%s\")\n", name, AMXX_VERSION);
fclose(fp);
}
fprintf(fp, "AMX Mod X log file started (file \"%s/L%02d%02d%03d.log\") (version \"%s\")\n", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday, i, AMX_VERSION);
fclose(fp);
}
void CLog::UseFile(const String &fileName)
void CLog::UseFile(const ke::AString &fileName)
{
m_LogFile.assign(build_pathname("%s/%s", g_log_dir.c_str(), fileName.c_str()));
static char file[PLATFORM_MAX_PATH];
m_LogFile = build_pathname_r(file, sizeof(file), "%s/%s", g_log_dir.chars(), fileName.chars());
}
void CLog::SetLogType(const char* localInfo)
{
m_LogType = atoi(get_localinfo(localInfo, "1"));
if (m_LogType < 0 || m_LogType > 3)
{
SET_LOCALINFO(localInfo, "1");
m_LogType = 1;
print_srvconsole("[AMXX] Invalid amxx_logging value; setting back to 1...");
}
}
void CLog::MapChange()
{
// create dir if not existing
#ifdef __linux
mkdir(build_pathname("%s", g_log_dir.c_str()), 0700);
char file[PLATFORM_MAX_PATH];
#if defined(__linux__) || defined(__APPLE__)
mkdir(build_pathname_r(file, sizeof(file), "%s", g_log_dir.chars()), 0700);
#else
mkdir(build_pathname("%s", g_log_dir.c_str()));
mkdir(build_pathname_r(file, sizeof(file), "%s", g_log_dir.chars()));
#endif
m_LogType = atoi(get_localinfo("amxx_logging", "1"));
if (m_LogType < 0 || m_LogType > 3)
{
SET_LOCALINFO("amxx_logging", "1");
m_LogType = 1;
print_srvconsole("[AMXX] Invalid amxx_logging value; setting back to 1...");
}
SetLogType("amxx_logging");
m_LoggedErrMap = false;
if (m_LogType == 2)
{
// create new logfile
CreateNewFile();
}
else if (m_LogType == 1)
{
Log("-------- Mapchange --------");
}
else
} else if (m_LogType == 1) {
Log("-------- Mapchange to %s --------", STRING(gpGlobals->mapname));
} else {
return;
}
}
void CLog::Log(const char *fmt, ...)
{
static char file[PLATFORM_MAX_PATH];
if (m_LogType == 1 || m_LogType == 2)
{
// get time
@ -158,57 +165,104 @@ void CLog::Log(const char *fmt, ...)
strftime(date, 31, "%m/%d/%Y - %H:%M:%S", curTime);
// msg
char msg[3072];
static char msg[3072];
va_list arglst;
va_start(arglst, fmt);
vsnprintf(msg, 3071, fmt, arglst);
va_end(arglst);
FILE *pF;
FILE *pF = NULL;
if (m_LogType == 2)
{
pF = fopen(m_LogFile.c_str(), "a+");
pF = fopen(m_LogFile.chars(), "a+");
if (!pF)
{
CreateNewFile();
pF = fopen(m_LogFile.c_str(), "a+");
pF = fopen(m_LogFile.chars(), "a+");
if (!pF)
{
ALERT(at_logged, "[AMXX] Unexpected fatal logging error (couldn't open %s for a+). AMXX Logging disabled for this map.\n", m_LogFile.c_str());
ALERT(at_logged, "[AMXX] Unexpected fatal logging error (couldn't open %s for a+). AMXX Logging disabled for this map.\n", m_LogFile.chars());
m_LogType = 0;
return;
}
}
} else {
build_pathname_r(file, sizeof(file), "%s/L%04d%02d%02d.log", g_log_dir.chars(), (curTime->tm_year + 1900), curTime->tm_mon + 1, curTime->tm_mday);
pF = fopen(file, "a+");
}
else
{
pF = fopen(build_pathname("%s/L%02d%02d.log", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday), "a+");
}
if (pF)
{
fprintf(pF, "L %s: %s\n", date, msg);
fclose(pF);
}
else
{
ALERT(at_logged, "[AMXX] Unexpected fatal logging error (couldn't open %s for a+). AMXX Logging disabled for this map.\n", m_LogFile.c_str());
} else {
ALERT(at_logged, "[AMXX] Unexpected fatal logging error (couldn't open %s for a+). AMXX Logging disabled for this map.\n", file);
m_LogType = 0;
return;
}
// print on server console
print_srvconsole("L %s: %s\n", date, msg);
}
else if (m_LogType == 3)
{
} else if (m_LogType == 3) {
// build message
// :TODO: Overflow possible here
char msg[3072];
static char msg_[3072];
va_list arglst;
va_start(arglst, fmt);
vsnprintf(msg, 3071, fmt, arglst);
vsnprintf(msg_, 3071, fmt, arglst);
va_end(arglst);
ALERT(at_logged, "%s\n", msg);
ALERT(at_logged, "%s\n", msg_);
}
}
void CLog::LogError(const char *fmt, ...)
{
static char file[PLATFORM_MAX_PATH];
static char name[256];
if (m_FoundError)
{
return;
}
// get time
time_t td;
time(&td);
tm *curTime = localtime(&td);
char date[32];
strftime(date, 31, "%m/%d/%Y - %H:%M:%S", curTime);
// msg
static char msg[3072];
va_list arglst;
va_start(arglst, fmt);
vsnprintf(msg, sizeof(msg)-1, fmt, arglst);
va_end(arglst);
FILE *pF = NULL;
ke::SafeSprintf(name, sizeof(name), "%s/error_%04d%02d%02d.log", g_log_dir.chars(), curTime->tm_year + 1900, curTime->tm_mon + 1, curTime->tm_mday);
build_pathname_r(file, sizeof(file), "%s", name);
pF = fopen(file, "a+");
if (pF)
{
if (!m_LoggedErrMap)
{
fprintf(pF, "L %s: Start of error session.\n", date);
fprintf(pF, "L %s: Info (map \"%s\") (file \"%s\")\n", date, STRING(gpGlobals->mapname), name);
m_LoggedErrMap = true;
}
fprintf(pF, "L %s: %s\n", date, msg);
fclose(pF);
} else {
ALERT(at_logged, "[AMXX] Unexpected fatal logging error (couldn't open %s for a+). AMXX Error Logging disabled for this map.\n", file);
m_FoundError = true;
return;
}
// print on server console
print_srvconsole("L %s: %s\n", date, msg);
}

View File

@ -1,32 +1,11 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef __AMXXLOG_H__
#define __AMXXLOG_H__
@ -34,19 +13,23 @@
class CLog
{
private:
String m_LogFile;
ke::AString m_LogFile;
int m_LogType;
bool m_FoundError;
bool m_LoggedErrMap;
void GetLastFile(int &outMonth, int &outDay, String &outFilename);
void UseFile(const String &fileName);
void GetLastFile(int &outMonth, int &outDay, ke::AString &outFilename);
void UseFile(const ke::AString &fileName);
public:
CLog();
~CLog();
void CreateNewFile();
void CloseFile();
void SetLogType(const char* localInfo);
void MapChange();
void Log(const char *fmt, ...);
void LogError(const char *fmt, ...);
};
#endif // __AMXXLOG_H__

371
amxmodx/binlog.cpp Normal file
View File

@ -0,0 +1,371 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#if defined BINLOG_ENABLED
#include <time.h>
#include "amxmodx.h"
#include "binlog.h"
#include "debugger.h"
BinLog g_BinLog;
int g_binlog_level = 0;
int g_binlog_maxsize = 0;
// Helper function to get a filename index
#define USHR(x) ((unsigned int)(x)>>1)
int LookupFile(AMX_DBG *amxdbg, ucell address)
{
int high, low, mid;
high = amxdbg->hdr->files;
low = -1;
while (high - low > 1)
{
mid = USHR(low + high);
if (amxdbg->filetbl[mid]->address <= address)
{
low = mid;
} else {
high = mid;
}
}
if (low == -1)
{
return -1;
}
return low;
}
bool BinLog::Open()
{
const char *data = get_localinfo("amxmodx_datadir", "addons/amxmodx/data");
char path[PLATFORM_MAX_PATH];
build_pathname_r(path, sizeof(path), "%s/binlogs", data);
if (!DirExists(path))
{
mkdir(path
#if defined(__linux__) || defined(__APPLE__)
, 0755
#endif
);
if (!DirExists(path))
return false;
}
char file[PLATFORM_MAX_PATH];
build_pathname_r(file, sizeof(file), "%s/binlogs/lastlog", data);
unsigned int lastcntr = 0;
FILE *lastlog = fopen(file, "rb");
if (lastlog)
{
if (fread(&lastcntr, sizeof(int), 1, lastlog) != 1)
lastcntr = 0;
fclose(lastlog);
}
lastlog = fopen(file, "wb");
if (lastlog)
{
lastcntr++;
fwrite(&lastcntr, sizeof(int), 1, lastlog);
fclose(lastlog);
}
build_pathname_r(file, sizeof(file), "%s/binlogs/binlog%04d.blg", data, lastcntr);
m_logfile = file;
/**
* it's now safe to create the binary log
*/
FILE *fp = fopen(m_logfile.chars(), "wb");
if (!fp)
return false;
int magic = BINLOG_MAGIC;
short vers = BINLOG_VERSION;
char c = sizeof(time_t);
fwrite(&magic, sizeof(int), 1, fp);
fwrite(&vers, sizeof(short), 1, fp);
fwrite(&c, sizeof(char), 1, fp);
WritePluginDB(fp);
fclose(fp);
m_state = true;
WriteOp(BinLog_Start, -1);
return true;
}
void BinLog::Close()
{
WriteOp(BinLog_End, -1);
m_state = false;
}
void BinLog::WriteOp(BinLogOp op, int plug, ...)
{
if (!m_state)
return;
FILE *fp = fopen(m_logfile.chars(), "ab");
if (!fp)
return;
if (g_binlog_maxsize && op != BinLog_End)
{
fseek(fp, 0, SEEK_END);
if (ftell(fp) > (g_binlog_maxsize * (1024 * 1024)))
{
fclose(fp);
Close();
Open();
fp = fopen(m_logfile.chars(), "ab");
if (!fp)
return;
}
}
unsigned char c = static_cast<char>(op);
time_t t = time(NULL);
float gt = gpGlobals->time;
fwrite(&c, sizeof(char), 1, fp);
fwrite(&t, sizeof(time_t), 1, fp);
fwrite(&gt, sizeof(float), 1, fp);
fwrite(&plug, sizeof(int), 1, fp);
va_list ap;
va_start(ap, plug);
AMX *amx = NULL;
bool debug = false;
AMX_DBG *dbg = NULL;
CPluginMngr::CPlugin *pl = NULL;
if (plug != -1)
{
pl = g_plugins.findPlugin(plug);
if ((debug = pl->isDebug()))
{
amx = pl->getAMX();
dbg = static_cast<Debugger *>(amx->userdata[UD_DEBUGGER])->m_pAmxDbg;
}
}
switch (c)
{
case BinLog_Registered:
{
const char *title = va_arg(ap, const char *);
const char *vers = va_arg(ap, const char *);
c = (char)strlen(title);
fwrite(&c, sizeof(char), 1, fp);
fwrite(title, sizeof(char), c+1, fp);
c = (char)strlen(vers);
fwrite(&c, sizeof(char), 1 ,fp);
fwrite(vers, sizeof(char), c+1, fp);
break;
}
case BinLog_NativeCall:
{
int file;
int native = va_arg(ap, int);
int params = va_arg(ap, int);
fwrite(&native, sizeof(int), 1, fp);
fwrite(&params, sizeof(int), 1, fp);
if (debug)
{
file = LookupFile(dbg, amx->cip);
fwrite(&file, sizeof(int), 1, fp);
} else {
file = 0;
fwrite(&file, sizeof(int), 1, fp);
}
break;
}
case BinLog_NativeRet:
{
cell retval = va_arg(ap, cell);
fwrite(&retval, sizeof(cell), 1, fp);
break;
}
case BinLog_NativeError:
{
int err = va_arg(ap, int);
const char *msg = va_arg(ap, const char *);
short len = (short)strlen(msg);
fwrite(&err, sizeof(int), 1, fp);
fwrite(&len, sizeof(short), 1, fp);
fwrite(msg, sizeof(char), len+1, fp);
break;
}
case BinLog_CallPubFunc:
{
int file;
int num = va_arg(ap, int);
fwrite(&num, sizeof(int), 1, fp);
if (debug)
{
file = LookupFile(dbg, amx->cip);
fwrite(&file, sizeof(int), 1, fp);
} else {
file = 0;
fwrite(&file, sizeof(int), 1, fp);
}
break;
}
case BinLog_SetLine:
{
int file;
int line = va_arg(ap, int);
fwrite(&line, sizeof(int), 1, fp);
if (debug)
{
file = LookupFile(dbg, amx->cip);
fwrite(&file, sizeof(int), 1, fp);
} else {
file = 0;
fwrite(&file, sizeof(int), 1, fp);
}
break;
}
case BinLog_FormatString:
{
int param = va_arg(ap, int);
int maxlen = va_arg(ap, int);
const char *str = va_arg(ap, const char *);
short len = (short)strlen(str);
fwrite(&param, sizeof(int), 1, fp);
fwrite(&maxlen, sizeof(int), 1, fp);
fwrite(&len, sizeof(short), 1, fp);
fwrite(str, sizeof(char), len+1, fp);
break;
}
case BinLog_NativeParams:
{
cell *params = va_arg(ap, cell *);
cell num = params[0] / sizeof(cell);
fwrite(&num, sizeof(cell), 1, fp);
for (cell i=1; i<=num; i++)
fwrite(&(params[i]), sizeof(cell), 1, fp);
break;
}
case BinLog_GetString:
{
cell addr = va_arg(ap, cell);
const char *str = va_arg(ap, const char *);
short len = (short)strlen(str);
fwrite(&addr, sizeof(cell), 1, fp);
fwrite(&len, sizeof(short), 1, fp);
fwrite(str, sizeof(char), len+1, fp);
break;
}
case BinLog_SetString:
{
cell addr = va_arg(ap, cell);
int maxlen = va_arg(ap, int);
const char *str = va_arg(ap, const char *);
short len = (short)strlen(str);
fwrite(&addr, sizeof(cell), 1, fp);
fwrite(&maxlen, sizeof(int), 1, fp);
fwrite(&len, sizeof(short), 1, fp);
fwrite(str, sizeof(char), len+1, fp);
break;
}
};
va_end(ap);
fclose(fp);
}
void BinLog::WritePluginDB(FILE *fp)
{
int num = g_plugins.getPluginsNum();
fwrite(&num, sizeof(int), 1, fp);
CPluginMngr::CPlugin *pl;
char c;
unsigned char len;
for (CPluginMngr::iterator iter = g_plugins.begin(); iter; ++iter)
{
pl = &(*iter);
if (pl->isValid())
c = 1;
else
c = 0;
if (c && pl->isDebug())
c = 2;
fwrite(&c, sizeof(char), 1, fp);
if (c)
{
Debugger *pd = NULL;
len = (char)strlen(pl->getName());
fwrite(&len, sizeof(char), 1, fp);
len++;
fwrite(pl->getName(), sizeof(char), len, fp);
int natives, publics, files;
AMX *amx = pl->getAMX();
// Write the number of Filenames
if (c == 2)
{
pd = static_cast<Debugger *>(amx->userdata[UD_DEBUGGER]);
files = pd->m_pAmxDbg->hdr->files;
fwrite(&files, sizeof(int), 1, fp);
}
amx_NumNatives(amx, &natives);
amx_NumPublics(amx, &publics);
fwrite(&natives, sizeof(int), 1, fp);
fwrite(&publics, sizeof(int), 1, fp);
char name[34];
// Write the Filenames to the binfile
if (c == 2)
{
AMX_DBG_FILE **ftable = pd->m_pAmxDbg->filetbl;
for (int i=0; i<files; i++)
{
len = (char)strlen(ftable[i]->name);
fwrite(&len, sizeof(char), 1, fp);
len++;
fwrite(ftable[i]->name, sizeof(char), len, fp);
}
}
for (int i=0; i<natives; i++)
{
amx_GetNative(amx, i, name);
len = (char)strlen(name);
fwrite(&len, sizeof(char), 1, fp);
len++;
fwrite(name, sizeof(char), len, fp);
}
for (int i=0; i<publics; i++)
{
amx_GetPublic(amx, i, name);
len = (char)strlen(name);
fwrite(&len, sizeof(char), 1, fp);
len++;
fwrite(name, sizeof(char), len, fp);
}
} else {
char empty[] = " ";
len = 1;
fwrite(&len, sizeof(char), 1, fp);
fwrite(empty, sizeof(char), len, fp);
int no = 0;
fwrite(&no, sizeof(int), 1, fp);
fwrite(&no, sizeof(int), 1, fp);
}
}
}
#endif //BINLOG_ENABLED

93
amxmodx/binlog.h Normal file
View File

@ -0,0 +1,93 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef _INCLUDE_BINLOG_H
#define _INCLUDE_BINLOG_H
#if defined BINLOG_ENABLED
#include <amtl/am-string.h>
#define BINLOG_MAGIC 0x414D424C
#define BINLOG_VERSION 0x0300
/**
* Format of binlog:
* uint32 magic
* uint16 version
* uint8 sizeof(time_t)
* uint32 num plugins
* [
* uint8 status codes
* str[int8] filename
* if(status==2)
* uint32 num filenames
* uint32 num natives
* uint32 num publics
* if (status==2)
* [
* str[uint8] file name
* ]
* [
* str[uint8] native name
* ]
* [
* str[uint8] public name
* ]
* ]
* [
* uint8 operation code
* time_t realtime
* float gametime
* int32 plugin id
* <extra info>
* ]
* If filename id is 0 skip as plugin was not in debug mode, if -1 there was an error.
*/
enum BinLogOp
{
BinLog_Start=1,
BinLog_End,
BinLog_NativeCall, //<int32 native id> <int32_t num_params> <int32_t filename id>
BinLog_NativeError, //<int32 errornum> <str[int16] string>
BinLog_NativeRet, //<cell value>
BinLog_CallPubFunc, //<int32 public id> <int32_t filename id>
BinLog_SetLine, //<int32 line no#> <int32_t filename id>
BinLog_Registered, //<string title> <string version>
BinLog_FormatString, //<int32 param#> <int32 maxlen> <str[int16] string>
BinLog_NativeParams, //<int32 num> <cell ...>
BinLog_GetString, //<cell addr> <string[int16]>
BinLog_SetString, //<cell addr> <int maxlen> <string[int16]>
};
class BinLog
{
public:
BinLog() : m_state(false)
{
};
public:
bool Open();
void Close();
void WriteOp(BinLogOp op, int plug, ...);
private:
void WritePluginDB(FILE *fp);
private:
ke::AString m_logfile;
bool m_state;
};
extern BinLog g_BinLog;
extern int g_binlog_level;
extern int g_binlog_maxsize;
#endif //BINLOG_ENABLED
#endif //_INCLUDE_BINLOG_H

729
amxmodx/cvars.cpp Normal file
View File

@ -0,0 +1,729 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "CvarManager.h"
#include "amxmodx.h"
#include "nongpl_matches.h"
char CVarTempBuffer[64];
const char *invis_cvar_list[5] ={ "amxmodx_version", "amxmodx_modules", "amx_debug", "amx_mldebug", "amx_client_languages" };
// create_cvar(const name[], const default_value[], flags = 0, const description[] = "", bool:has_min = false, Float:min_val = 0.0, bool:has_max = false, Float:max_val = 0.0)
static cell AMX_NATIVE_CALL create_cvar(AMX *amx, cell *params)
{
int length;
const char* name = get_amxstring(amx, params[1], 0, length);
const char* value = get_amxstring(amx, params[2], 1, length);
const char* helpText = get_amxstring(amx, params[4], 2, length);
int flags = params[3];
CPluginMngr::CPlugin *plugin = g_plugins.findPluginFast(amx);
if (CheckBadConList(name, 0))
{
plugin->AddToFailCounter(1);
}
CvarInfo* info = g_CvarManager.CreateCvar(name, value, plugin->getName(), plugin->getId(), flags, helpText);
if (info)
{
bool hasMin = params[5] != 0;
bool hasMax = params[7] != 0;
float minVal = amx_ctof(params[6]);
float maxVal = amx_ctof(params[8]);
if (hasMin && hasMax)
{
if (minVal > maxVal)
{
LogError(amx, AMX_ERR_NATIVE, "The minimum value can not be above the maximum value");
return 0;
}
else if (maxVal < minVal)
{
LogError(amx, AMX_ERR_NATIVE, "The maximum value can not be below the minimum value");
return 0;
}
}
g_CvarManager.SetCvarMin(info, hasMin, minVal, plugin->getId());
g_CvarManager.SetCvarMax(info, hasMax, maxVal, plugin->getId());
return reinterpret_cast<cell>(info->var);
}
return 0;
}
// register_cvar(const name[], const string[], flags=0, Float:fvalue=0.0)
static cell AMX_NATIVE_CALL register_cvar(AMX *amx, cell *params)
{
int length;
const char* name = get_amxstring(amx, params[1], 0, length);
const char* value = get_amxstring(amx, params[2], 1, length);
int flags = params[3];
float fvalue = amx_ctof(params[4]);
CPluginMngr::CPlugin *plugin = g_plugins.findPluginFast(amx);
if (CheckBadConList(name, 0))
{
plugin->AddToFailCounter(1);
}
CvarInfo* info = g_CvarManager.CreateCvar(name, value, plugin->getName(), plugin->getId(), flags);
if (info)
{
return reinterpret_cast<cell>(info->var);
}
return 0;
}
// cvar_exists(const cvar[])
static cell AMX_NATIVE_CALL cvar_exists(AMX *amx, cell *params)
{
int ilen;
return (g_CvarManager.FindCvar(get_amxstring(amx, params[1], 0, ilen)) ? 1 : 0);
}
// get_cvar_pointer(const cvar[])
static cell AMX_NATIVE_CALL get_cvar_pointer(AMX *amx, cell *params)
{
int len;
const char *name = get_amxstring(amx, params[1], 0, len);
CvarInfo* info = g_CvarManager.FindCvar(name);
return reinterpret_cast<cell>(info ? info->var : 0);
}
// hook_cvar_change(cvarHandle, const callback[])
static cell AMX_NATIVE_CALL hook_cvar_change(AMX *amx, cell *params)
{
cvar_t* var = reinterpret_cast<cvar_t*>(params[1]);
if (!var)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid cvar handle: %p", var);
return 0;
}
const char* callback;
AutoForward* forward = g_CvarManager.HookCvarChange(var, amx, params[2], &callback);
if (!forward)
{
LogError(amx, AMX_ERR_NATIVE, "Function \"%s\" is not present", callback);
return 0;
}
return reinterpret_cast<cell>(forward);
}
// enable_cvar_hook(cvarhook:handle);
static cell AMX_NATIVE_CALL enable_cvar_hook(AMX *amx, cell *params)
{
AutoForward* forward = reinterpret_cast<AutoForward*>(params[1]);
if (!forward)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid cvar hook handle: %p", forward);
return 0;
}
forward->state = AutoForward::FSTATE_OK;
return 1;
}
// disable_cvar_hook(cvarhook:handle);
static cell AMX_NATIVE_CALL disable_cvar_hook(AMX *amx, cell *params)
{
AutoForward* forward = reinterpret_cast<AutoForward*>(params[1]);
if (!forward)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid cvar hook handle: %p", forward);
return 0;
}
forward->state = AutoForward::FSTATE_STOP;
return 1;
}
// get_cvar_flags(const cvar[])
static cell AMX_NATIVE_CALL get_cvar_flags(AMX *amx, cell *params)
{
int ilen;
char* sCvar = get_amxstring(amx, params[1], 0, ilen);
CvarInfo* info = g_CvarManager.FindCvar(sCvar);
return info ? info->var->flags : 0;
}
// get_cvar_float(const cvarname[])
static cell AMX_NATIVE_CALL get_cvar_float(AMX *amx, cell *params)
{
int length;
const char* name = get_amxstring(amx, params[1], 0, length);
CvarInfo* info = g_CvarManager.FindCvar(name);
return info ? amx_ftoc(info->var->value) : 0;
}
// get_cvar_num(const cvarname[])
static cell AMX_NATIVE_CALL get_cvar_num(AMX *amx, cell *params)
{
int length;
const char* name = get_amxstring(amx, params[1], 0, length);
CvarInfo* info = g_CvarManager.FindCvar(name);
return info ? (int)info->var->value : 0;
}
// get_cvar_string(const cvarname[], output[], iLen)
static cell AMX_NATIVE_CALL get_cvar_string(AMX *amx, cell *params)
{
int length;
const char* name = get_amxstring(amx, params[1], 0, length);
CvarInfo* info = g_CvarManager.FindCvar(name);
const char *value = info ? info->var->string : "";
length = info ? strlen(value) : 0;
return set_amxstring_utf8(amx, params[2], value, length, params[3]);
}
// set_cvar_flags(const cvar[], flags)
static cell AMX_NATIVE_CALL set_cvar_flags(AMX *amx, cell *params)
{
int ilen;
const char* sCvar = get_amxstring(amx, params[1], 0, ilen);
if (!strcmp(sCvar, "amx_version") || !strcmp(sCvar, "amxmodx_version") || !strcmp(sCvar, "fun_version") || !strcmp(sCvar, "sv_cheats"))
return 0;
CvarInfo* info = g_CvarManager.FindCvar(sCvar);
if (info)
{
info->var->flags |= (int)(params[2]);
return 1;
}
return 0;
}
// set_cvar_float(const cvar[], Float:value)
static cell AMX_NATIVE_CALL set_cvar_float(AMX *amx, cell *params)
{
int length;
const char* name = get_amxstring(amx, params[1], 0, length);
CvarInfo* info = g_CvarManager.FindCvar(name);
if (info)
{
ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer), "%f", amx_ctof(params[2]));
CVAR_DIRECTSET(info->var, &CVarTempBuffer[0]);
}
return 1;
}
// set_cvar_num(const cvarname[], value)
static cell AMX_NATIVE_CALL set_cvar_num(AMX *amx, cell *params)
{
int length;
const char* name = get_amxstring(amx, params[1], 0, length);
int value = params[2];
CvarInfo* info = g_CvarManager.FindCvar(name);
if (info)
{
ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer), "%d", value);
CVAR_DIRECTSET(info->var, &CVarTempBuffer[0]);
}
return 1;
}
// set_cvar_string(const cvar[], const value[])
static cell AMX_NATIVE_CALL set_cvar_string(AMX *amx, cell *params)
{
int length;
const char* name = get_amxstring(amx, params[1], 0, length);
CvarInfo* info = g_CvarManager.FindCvar(name);
if (info)
{
CVAR_DIRECTSET(info->var, get_amxstring(amx, params[2], 1, length));
}
return 1;
}
// get_pcvar_flags(pcvar)
static cell AMX_NATIVE_CALL get_pcvar_flags(AMX *amx, cell *params)
{
cvar_t *ptr = reinterpret_cast<cvar_t *>(params[1]);
if (!ptr)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer");
return 0;
}
return ptr->flags;
}
// Float:get_pcvar_float(pcvar)
static cell AMX_NATIVE_CALL get_pcvar_float(AMX *amx, cell *params)
{
cvar_t *ptr = reinterpret_cast<cvar_t *>(params[1]);
if (!ptr)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer");
return 0;
}
return amx_ftoc(ptr->value);
}
// get_pcvar_num(pcvar)
static cell AMX_NATIVE_CALL get_pcvar_num(AMX *amx, cell *params)
{
cvar_t *ptr = reinterpret_cast<cvar_t *>(params[1]);
if (!ptr)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer");
return 0;
}
return (int)ptr->value;
}
// bool:get_pcvar_bool(pcvar)
static cell AMX_NATIVE_CALL get_pcvar_bool(AMX *amx, cell *params)
{
return !!get_pcvar_num(amx, params);
}
// get_pcvar_string(pcvar, string[], maxlen)
static cell AMX_NATIVE_CALL get_pcvar_string(AMX *amx, cell *params)
{
cvar_t *ptr = reinterpret_cast<cvar_t *>(params[1]);
if (!ptr)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer");
return 0;
}
return set_amxstring_utf8(amx, params[2], ptr->string ? ptr->string : "", ptr->string ? strlen(ptr->string) : 0, params[3]);
}
// get_pcvar_bounds(pcvar, CvarBounds:type, &Float:value)
static cell AMX_NATIVE_CALL get_pcvar_bounds(AMX *amx, cell *params)
{
cvar_t *ptr = reinterpret_cast<cvar_t *>(params[1]);
CvarInfo* info = nullptr;
if (!ptr || !(info = g_CvarManager.FindCvar(ptr->name)))
{
LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer");
return 0;
}
bool hasBound = false;
float bound;
switch (params[2])
{
case CvarBound_Lower:
hasBound = info->bound.hasMin;
bound = info->bound.minVal;
break;
case CvarBound_Upper:
hasBound = info->bound.hasMax;
bound = info->bound.maxVal;
break;
default:
LogError(amx, AMX_ERR_NATIVE, "Invalid CvarBounds value: %d", params[2]);
return 0;
}
*get_amxaddr(amx, params[3]) = amx_ftoc(bound);
return hasBound;
}
// bind_pcvar_float(pcvar, &Float:var)
static cell AMX_NATIVE_CALL bind_pcvar_float(AMX *amx, cell *params)
{
cvar_t *ptr = reinterpret_cast<cvar_t *>(params[1]);
CvarInfo* info = nullptr;
if (!ptr || !(info = g_CvarManager.FindCvar(ptr->name)))
{
LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer");
return 0;
}
return g_CvarManager.BindCvar(info, CvarBind::CvarType_Float, amx, params[2]);
}
// bind_pcvar_num(pcvar, &any:var)
static cell AMX_NATIVE_CALL bind_pcvar_num(AMX *amx, cell *params)
{
cvar_t *ptr = reinterpret_cast<cvar_t *>(params[1]);
CvarInfo* info = nullptr;
if (!ptr || !(info = g_CvarManager.FindCvar(ptr->name)))
{
LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer");
return 0;
}
return g_CvarManager.BindCvar(info, CvarBind::CvarType_Int, amx, params[2]);
}
// bind_pcvar_string(pcvar, any:var[], varlen)
static cell AMX_NATIVE_CALL bind_pcvar_string(AMX *amx, cell *params)
{
cvar_t *ptr = reinterpret_cast<cvar_t *>(params[1]);
CvarInfo* info = nullptr;
if (!ptr || !(info = g_CvarManager.FindCvar(ptr->name)))
{
LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer");
return 0;
}
return g_CvarManager.BindCvar(info, CvarBind::CvarType_String, amx, params[2], params[3]);
}
// set_pcvar_flags(pcvar, flags)
static cell AMX_NATIVE_CALL set_pcvar_flags(AMX *amx, cell *params)
{
cvar_t *ptr = reinterpret_cast<cvar_t *>(params[1]);
if (!ptr)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer");
return 0;
}
ptr->flags = static_cast<int>(params[2]);
return 1;
}
// set_pcvar_float(pcvar, Float:num)
static cell AMX_NATIVE_CALL set_pcvar_float(AMX *amx, cell *params)
{
cvar_t *ptr = reinterpret_cast<cvar_t *>(params[1]);
if (!ptr)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer");
return 0;
}
ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer), "%f", amx_ctof(params[2]));
CVAR_DIRECTSET(ptr, &CVarTempBuffer[0]);
return 1;
}
// set_pcvar_num(pcvar, num)
static cell AMX_NATIVE_CALL set_pcvar_num(AMX *amx, cell *params)
{
cvar_t *ptr = reinterpret_cast<cvar_t *>(params[1]);
if (!ptr)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer");
return 0;
}
ke::SafeSprintf(CVarTempBuffer, sizeof(CVarTempBuffer), "%d", params[2]);
CVAR_DIRECTSET(ptr, &CVarTempBuffer[0]);
return 1;
}
// set_pcvar_string(pcvar, const string[])
static cell AMX_NATIVE_CALL set_pcvar_string(AMX *amx, cell *params)
{
cvar_t *ptr = reinterpret_cast<cvar_t *>(params[1]);
if (!ptr)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer");
return 0;
}
int len;
CVAR_DIRECTSET(ptr, get_amxstring(amx, params[2], 0, len));
return 1;
}
// set_pcvar_bounds(pcvar, CvarBounds:type, bool:set, Float:value = 0.0)
static cell AMX_NATIVE_CALL set_pcvar_bounds(AMX *amx, cell *params)
{
cvar_t *ptr = reinterpret_cast<cvar_t *>(params[1]);
CvarInfo* info = nullptr;
if (!ptr || !(info = g_CvarManager.FindCvar(ptr->name)))
{
LogError(amx, AMX_ERR_NATIVE, "Invalid CVAR pointer");
return 0;
}
bool set = params[3] != 0;
int pluginId = g_plugins.findPluginFast(amx)->getId();
float value = amx_ctof(params[4]);
switch (params[2])
{
case CvarBound_Lower:
{
if (set && info->bound.hasMax && value > info->bound.maxVal)
{
LogError(amx, AMX_ERR_NATIVE, "The minimum value can not be above the maximum value");
return 0;
}
g_CvarManager.SetCvarMin(info, set, value, pluginId);
break;
}
case CvarBound_Upper:
{
if (set && info->bound.hasMin && value < info->bound.minVal)
{
LogError(amx, AMX_ERR_NATIVE, "The maximum value can not be below the minimum value");
return 0;
}
g_CvarManager.SetCvarMax(info, set, value, pluginId);
break;
}
default:
{
LogError(amx, AMX_ERR_NATIVE, "Invalid CvarBounds value: %d", params[2]);
return 0;
}
}
return 1;
}
// remove_cvar_flags(const cvar[], flags=-1)
static cell AMX_NATIVE_CALL remove_cvar_flags(AMX *amx, cell *params)
{
int ilen;
char* sCvar = get_amxstring(amx, params[1], 0, ilen);
if (!strcmp(sCvar, "amx_version") || !strcmp(sCvar, "amxmodx_version") || !strcmp(sCvar, "fun_version") || !strcmp(sCvar, "sv_cheats"))
return 0;
CvarInfo* info = g_CvarManager.FindCvar(sCvar);
if (info)
{
info->var->flags &= ~((int)(params[2]));
return 1;
}
return 0;
}
// get_plugins_cvar(id, name[], namelen, &flags=0, &plugin_id=0, &pcvar_handle=0, description[]="", desc_len=0)
static cell AMX_NATIVE_CALL get_plugins_cvar(AMX *amx, cell *params)
{
CvarInfo* info = g_CvarManager.FindCvar(params[1]);
if (info)
{
set_amxstring(amx, params[2], info->name.chars(), params[3]);
*get_amxaddr(amx, params[4]) = info->var->flags;
*get_amxaddr(amx, params[5]) = info->pluginId;
*get_amxaddr(amx, params[6]) = reinterpret_cast<cell>(info->var);
if (*params / sizeof(cell) >= 7)
{
set_amxstring(amx, params[7], info->description.chars(), params[8]);
}
return 1;
}
return 0;
}
// get_plugins_cvarsnum()
static cell AMX_NATIVE_CALL get_plugins_cvarsnum(AMX *amx, cell *params)
{
return g_CvarManager.GetRegCvarsCount();
}
#if defined AMD64
static bool g_warned_ccqv = false;
#endif
// query_client_cvar(id, const cvar[], const resultfunc[])
static cell AMX_NATIVE_CALL query_client_cvar(AMX *amx, cell *params)
{
int numParams = params[0] / sizeof(cell);
if (numParams != 3 && numParams != 5)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid number of parameters passed!");
return 0;
}
#if defined AMD64
if (!g_warned_ccqv)
{
LogError(amx, AMX_ERR_NATIVE, "[AMXX] Client CVAR Querying is not available on AMD64 (one time warn)");
g_warned_ccqv = true;
}
return 0;
#endif
if (!g_NewDLL_Available)
{
LogError(amx, AMX_ERR_NATIVE, "Client CVAR querying is not enabled - check MM version!");
return 0;
}
int id = params[1];
if (id < 1 || id > gpGlobals->maxClients)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", id);
return 0;
}
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
if (!pPlayer->initialized || pPlayer->IsBot())
{
LogError(amx, AMX_ERR_NATIVE, "Player %d is either not connected or a bot", id);
return 0;
}
int dummy;
const char *cvarname = get_amxstring(amx, params[2], 0, dummy);
const char *resultfuncname = get_amxstring(amx, params[3], 1, dummy);
// public clientcvarquery_result(id, const cvar[], const result[], [const param[]])
int iFunc;
if (numParams == 5 && params[4] != 0)
iFunc = registerSPForwardByName(amx, resultfuncname, FP_CELL, FP_STRING, FP_STRING, FP_ARRAY, FP_DONE);
else
iFunc = registerSPForwardByName(amx, resultfuncname, FP_CELL, FP_STRING, FP_STRING, FP_DONE);
if (iFunc == -1)
{
LogError(amx, AMX_ERR_NATIVE, "Function \"%s\" is not present", resultfuncname);
return 0;
}
ClientCvarQuery_Info *queryObject = new ClientCvarQuery_Info;
queryObject->resultFwd = iFunc;
queryObject->requestId = MAKE_REQUESTID(PLID);
if (numParams == 5 && params[4] != 0)
{
queryObject->paramLen = params[4] + 1;
queryObject->params = new cell[queryObject->paramLen];
if (!queryObject->params)
{
delete queryObject;
unregisterSPForward(iFunc);
LogError(amx, AMX_ERR_MEMORY, "Hmm. Out of memory?");
return 0;
}
memcpy(reinterpret_cast<void*>(queryObject->params), reinterpret_cast<const void *>(get_amxaddr(amx, params[5])), queryObject->paramLen * sizeof(cell));
queryObject->params[queryObject->paramLen - 1] = 0;
}
else {
queryObject->params = NULL;
queryObject->paramLen = 0;
}
pPlayer->queries.push_back(queryObject);
QUERY_CLIENT_CVAR_VALUE2(pPlayer->pEdict, cvarname, queryObject->requestId);
return 1;
}
AMX_NATIVE_INFO g_CvarNatives[] =
{
{"create_cvar", create_cvar},
{"register_cvar", register_cvar},
{"cvar_exists", cvar_exists},
{"get_cvar_pointer", get_cvar_pointer},
{"hook_cvar_change", hook_cvar_change},
{"enable_cvar_hook", enable_cvar_hook},
{"disable_cvar_hook", disable_cvar_hook},
{"get_cvar_flags", get_cvar_flags},
{"get_cvar_float", get_cvar_float},
{"get_cvar_num", get_cvar_num},
{"get_cvar_string", get_cvar_string},
{"set_cvar_flags", set_cvar_flags},
{"set_cvar_float", set_cvar_float},
{"set_cvar_num", set_cvar_num},
{"set_cvar_string", set_cvar_string},
{"get_pcvar_flags", get_pcvar_flags},
{"get_pcvar_float", get_pcvar_float},
{"get_pcvar_num", get_pcvar_num},
{"get_pcvar_bool", get_pcvar_bool},
{"get_pcvar_string", get_pcvar_string},
{"get_pcvar_bounds", get_pcvar_bounds},
{"set_pcvar_flags", set_pcvar_flags},
{"set_pcvar_float", set_pcvar_float},
{"set_pcvar_num", set_pcvar_num},
{"set_pcvar_bool", set_pcvar_num},
{"set_pcvar_string", set_pcvar_string},
{"set_pcvar_bounds", set_pcvar_bounds},
{"remove_cvar_flags", remove_cvar_flags},
{"bind_pcvar_float", bind_pcvar_float},
{"bind_pcvar_num", bind_pcvar_num},
{"bind_pcvar_string", bind_pcvar_string},
{"get_plugins_cvar", get_plugins_cvar},
{"get_plugins_cvarsnum", get_plugins_cvarsnum},
{"query_client_cvar", query_client_cvar},
{NULL, NULL}
};

250
amxmodx/datapacks.cpp Normal file
View File

@ -0,0 +1,250 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*/
#include "CDataPack.h"
NativeHandle<CDataPack> DataPackHandles;
static cell AMX_NATIVE_CALL CreateDataPack(AMX* amx, cell* params)
{
return static_cast<cell>(DataPackHandles.create());
}
static cell AMX_NATIVE_CALL WritePackCell(AMX* amx, cell* params)
{
CDataPack *d = DataPackHandles.lookup(params[1]);
if (!d)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid datapack handle provided (%d)", params[1]);
return 0;
}
d->PackCell(params[2]);
return 1;
}
static cell AMX_NATIVE_CALL WritePackFloat(AMX* amx, cell* params)
{
CDataPack *d = DataPackHandles.lookup(params[1]);
if (!d)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid datapack handle provided (%d)", params[1]);
return 0;
}
d->PackFloat(amx_ctof(params[2]));
return 1;
}
static cell AMX_NATIVE_CALL WritePackString(AMX* amx, cell* params)
{
CDataPack *d = DataPackHandles.lookup(params[1]);
if (!d)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid datapack handle provided (%d)", params[1]);
return 0;
}
int len;
const char *str = get_amxstring(amx, params[2], 0, len);
d->PackString(str);
return len;
}
static cell AMX_NATIVE_CALL ReadPackCell(AMX* amx, cell* params)
{
CDataPack *d = DataPackHandles.lookup(params[1]);
if (!d)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid datapack handle provided (%d)", params[1]);
return 0;
}
if (!d->CanReadCell())
{
LogError(amx, AMX_ERR_NATIVE, "Datapack operation is invalid.");
return 0;
}
return d->ReadCell();
}
static cell AMX_NATIVE_CALL ReadPackFloat(AMX* amx, cell* params)
{
CDataPack *d = DataPackHandles.lookup(params[1]);
if (!d)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid datapack handle provided (%d)", params[1]);
return 0;
}
if (!d->CanReadFloat())
{
LogError(amx, AMX_ERR_NATIVE, "Datapack operation is invalid.");
return 0;
}
float value = d->ReadFloat();
return amx_ftoc(value);
}
static cell AMX_NATIVE_CALL ReadPackString(AMX* amx, cell* params)
{
CDataPack *d = DataPackHandles.lookup(params[1]);
if (!d)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid datapack handle provided (%d)", params[1]);
return 0;
}
if (!d->CanReadString(NULL))
{
LogError(amx, AMX_ERR_NATIVE, "Datapack operation is invalid.");
return 0;
}
size_t len;
const char *str = d->ReadString(&len);
return set_amxstring_utf8(amx, params[2], str, len, params[3]);
}
static cell AMX_NATIVE_CALL ResetPack(AMX* amx, cell* params)
{
CDataPack *d = DataPackHandles.lookup(params[1]);
if (!d)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid datapack handle provided (%d)", params[1]);
return 0;
}
d->Reset();
if (params[2])
{
d->ResetSize();
}
return 1;
}
static cell AMX_NATIVE_CALL GetPackPosition(AMX* amx, cell* params)
{
CDataPack *d = DataPackHandles.lookup(params[1]);
if (!d)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid datapack handle provided (%d)", params[1]);
return 0;
}
return static_cast<cell>(d->GetPosition());
}
static cell AMX_NATIVE_CALL SetPackPosition(AMX* amx, cell* params)
{
CDataPack *d = DataPackHandles.lookup(params[1]);
if (!d)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid datapack handle provided (%d)", params[1]);
return 0;
}
if (!d->SetPosition(params[2]))
{
LogError(amx, AMX_ERR_NATIVE, "Invalid DataPack position, %d is out of bounds", params[2]);
return 0;
}
return 1;
}
static cell AMX_NATIVE_CALL IsPackEnded(AMX* amx, cell* params)
{
CDataPack *d = DataPackHandles.lookup(params[1]);
if (!d)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid datapack handle provided (%d)", params[1]);
return 0;
}
return d->IsReadable(1) ? false : true;
}
static cell AMX_NATIVE_CALL DestroyDataPack(AMX* amx, cell* params)
{
cell *ptr = get_amxaddr(amx, params[1]);
CDataPack *d = DataPackHandles.lookup(*ptr);
if (!d)
{
return 0;
}
if (DataPackHandles.destroy(*ptr))
{
*ptr = 0;
return 1;
}
return 0;
}
AMX_NATIVE_INFO g_DatapackNatives[] =
{
{ "CreateDataPack" , CreateDataPack },
{ "WritePackCell" , WritePackCell },
{ "WritePackFloat" , WritePackFloat },
{ "WritePackString", WritePackString },
{ "ReadPackCell" , ReadPackCell },
{ "ReadPackFloat" , ReadPackFloat },
{ "ReadPackString" , ReadPackString },
{ "ResetPack" , ResetPack },
{ "GetPackPosition", GetPackPosition },
{ "SetPackPosition", SetPackPosition },
{ "IsPackEnded" , IsPackEnded },
{ "DestroyDataPack", DestroyDataPack },
{ nullptr , nullptr}
};

935
amxmodx/datastructs.cpp Normal file
View File

@ -0,0 +1,935 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "datastructs.h"
#include <amtl/am-utility.h>
NativeHandle<CellArray> ArrayHandles;
// Array:ArrayCreate(cellsize=1, reserved=32);
static cell AMX_NATIVE_CALL ArrayCreate(AMX* amx, cell* params)
{
// params[1] (cellsize) is how big in cells each element is.
// this MUST be greater than 0!
int cellsize = params[1];
// params[2] (reserved) is how many elements to allocate
// immediately when the list is created.
int reserved = params[2];
if (cellsize <= 0)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array size (%d)", cellsize);
return -1;
}
if (reserved < 0)
{
reserved = 0;
}
return ArrayHandles.create(cellsize, reserved);
}
// native ArrayClear(Array:which);
static cell AMX_NATIVE_CALL ArrayClear(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
vec->clear();
return 1;
}
// native ArraySize(Array:which);
static cell AMX_NATIVE_CALL ArraySize(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
return vec->size();
}
// native bool:ArrayResize(Array:which, newsize);
static cell AMX_NATIVE_CALL ArrayResize(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
if (!vec->resize(params[2]))
{
LogError(amx, AMX_ERR_NATIVE, "Unable to resize array to \"%u\"", params[2]);
return 0;
}
return 1;
}
// native Array:ArrayClone(Array:which);
static cell AMX_NATIVE_CALL ArrayClone(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
auto data = vec->clone();
if (!data)
{
LogError(amx, AMX_ERR_NATIVE, "Failed to clone array. Out of memory.");
return 0;
}
return ArrayHandles.clone(data);
}
// native ArrayGetArray(Array:which, item, any:output[], size = -1);
static cell AMX_NATIVE_CALL ArrayGetArray(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx = (size_t)params[2];
if (idx >= vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid index %d (count: %d)", idx, vec->size());
return 0;
}
cell *blk = vec->at(idx);
size_t indexes = vec->blocksize();
if (*params / sizeof(cell) == 4)
{
if (params[4] != -1 && (size_t)params[4] <= vec->blocksize())
{
indexes = params[4];
}
}
cell *addr = get_amxaddr(amx, params[3]);
memcpy(addr, blk, sizeof(cell) * indexes);
return indexes;
}
// native any:ArrayGetCell(Array:which, item, block = 0, bool:asChar = false);
static cell AMX_NATIVE_CALL ArrayGetCell(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx = (size_t)params[2];
if (idx >= vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid index %d (count: %d)", idx, vec->size());
return 0;
}
cell *blk = vec->at(idx);
if (*params / sizeof(cell) <= 2)
{
return *blk;
}
idx = (size_t)params[3];
if (!params[4])
{
if (idx >= vec->blocksize())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid block %d (blocksize: %d)", idx, vec->blocksize());
return 0;
}
return blk[idx];
}
else
{
if (idx >= vec->blocksize() * 4)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid byte %d (blocksize: %d bytes)", idx, vec->blocksize() * 4);
return 0;
}
return (cell)*((char *)blk + idx);
}
return 0;
}
// native ArrayGetString(Array:which, item, output[], size);
static cell AMX_NATIVE_CALL ArrayGetString(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx = (size_t)params[2];
if (idx >= vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid index %d (count: %d)", idx, vec->size());
return 0;
}
cell *blk = vec->at(idx);
return set_amxstring_utf8(amx, params[3], blk, amxstring_len(blk), params[4]);
}
// native ArraySetArray(Array:which, item, const any:input[], size =-1);
static cell AMX_NATIVE_CALL ArraySetArray(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx = (size_t)params[2];
if (idx >= vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid index %d (count: %d)", idx, vec->size());
return 0;
}
cell *blk = vec->at(idx);
size_t indexes = vec->blocksize();
if (*params / sizeof(cell) == 4)
{
if (params[4] != -1 && (size_t)params[4] <= vec->blocksize())
{
indexes = params[4];
}
}
cell *addr = get_amxaddr(amx, params[3]);
memcpy(blk, addr, sizeof(cell) * indexes);
return indexes;
}
// native ArraySetCell(Array:which, item, any:input, block = 0, bool:asChar = false);
static cell AMX_NATIVE_CALL ArraySetCell(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx = (size_t)params[2];
if (idx >= vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid index %d (count: %d)", idx, vec->size());
return 0;
}
cell *blk = vec->at(idx);
idx = (size_t)params[4];
if (*params / sizeof(cell) <= 3)
{
*blk = params[3];
return 1;
}
if (params[5] == 0)
{
if (idx >= vec->blocksize())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid block %d (blocksize: %d)", idx, vec->blocksize());
return 0;
}
blk[idx] = params[3];
}
else
{
if (idx >= vec->blocksize() * 4)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid byte %d (blocksize: %d bytes)", idx, vec->blocksize() * 4);
return 0;
}
*((char *)blk + idx) = (char)params[3];
}
return 1;
}
// native ArraySetString(Array:which, item, const input[]);
static cell AMX_NATIVE_CALL ArraySetString(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx = (size_t)params[2];
if (idx >= vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid index %d (count: %d)", idx, vec->size());
return 0;
}
cell *blk = vec->at(idx);
int len;
char *str = get_amxstring(amx, params[3], 0, len);
return strncopy(blk, str, ke::Min((size_t)len + 1, vec->blocksize()));
}
// native ArrayPushArray(Array:which, const any:input[], size = -1);
static cell AMX_NATIVE_CALL ArrayPushArray(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
cell *blk = vec->push();
if (!blk)
{
LogError(amx, AMX_ERR_NATIVE, "Failed to grow array");
return 0;
}
cell *addr = get_amxaddr(amx, params[2]);
size_t indexes = vec->blocksize();
if (*params / sizeof(cell) == 3)
{
if (params[3] != -1 && (size_t)params[3] <= vec->blocksize())
{
indexes = params[3];
}
}
memcpy(blk, addr, sizeof(cell) * indexes);
return static_cast<cell>((vec->size() - 1));
}
// native ArrayPushCell(Array:which, any:input);
static cell AMX_NATIVE_CALL ArrayPushCell(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
cell *blk = vec->push();
if (!blk)
{
LogError(amx, AMX_ERR_NATIVE, "Failed to grow array");
return 0;
}
*blk = params[2];
return static_cast<cell>((vec->size() - 1));
}
// native ArrayPushString(Array:which, const input[]);
static cell AMX_NATIVE_CALL ArrayPushString(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
cell *blk = vec->push();
if (!blk)
{
LogError(amx, AMX_ERR_NATIVE, "Failed to grow array");
return 0;
}
strncopy(blk, get_amxaddr(amx, params[2]), vec->blocksize());
return static_cast<cell>((vec->size() - 1));
}
// native DoNotUse : ArrayGetStringHandle(Array : which, item);
static cell AMX_NATIVE_CALL ArrayGetStringHandle(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx = (size_t)params[2];
if (idx >= vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid index %d (count: %d)", idx, vec->size());
return 0;
}
cell* ptr = vec->at(idx);
if (ptr == NULL)
{
return 0;
}
return reinterpret_cast<cell>(ptr);
}
// native ArrayInsertArrayAfter(Array:which, item, const any:input[]);
static cell AMX_NATIVE_CALL ArrayInsertArrayAfter(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx = params[2] + 1;
if (idx > vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid item specified in ArrayInsertArrayAfter (%d:%d)", idx, vec->size());
return 0;
}
cell *addr = get_amxaddr(amx, params[3]);
memcpy(vec->insert_at(idx), addr, sizeof(cell) * vec->blocksize());
return 1;
}
// native ArrayInsertCellAfter(Array:which, item, any:input);
static cell AMX_NATIVE_CALL ArrayInsertCellAfter(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx = params[2] + 1;
if (idx > vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid item specified in ArrayInsertCellAfter (%d:%d)", idx, vec->size());
return 0;
}
*vec->insert_at(idx) = params[3];
return 1;
}
// native ArrayInsertStringAfter(Array:which, item, const input[]);
static cell AMX_NATIVE_CALL ArrayInsertStringAfter(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx = params[2] + 1;
if (idx > vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid item specified in ArrayInsertStringAfter (%d:%d)", idx, vec->size());
return 0;
}
int len;
const char *str = get_amxstring(amx, params[3], 0, len);
return strncopy(vec->insert_at(idx), str, ke::Min((size_t)len + 1, vec->blocksize()));
}
// native ArrayInsertArrayBefore(Array:which, item, const any:input[]);
static cell AMX_NATIVE_CALL ArrayInsertArrayBefore(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx = params[2];
if (idx >= vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid item specified in ArrayInsertArrayBefore (%d:%d)", idx, vec->size());
return 0;
}
cell *addr = get_amxaddr(amx, params[3]);
memcpy(vec->insert_at(idx), addr, vec->blocksize() * sizeof(cell));
return 1;
}
// native ArrayInsertCellBefore(Array:which, item, const any:input);
static cell AMX_NATIVE_CALL ArrayInsertCellBefore(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx = params[2];
if (idx >= vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid item specified in ArrayInsertCellBefore (%d:%d)", idx, vec->size());
return 0;
}
*vec->insert_at(idx) = params[3];
return 1;
}
// native ArrayInsertStringBefore(Array:which, item, const input[]);
static cell AMX_NATIVE_CALL ArrayInsertStringBefore(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx = params[2];
if (idx >= vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid item specified in ArrayInsertStringBefore (%d:%d)", idx, vec->size());
return 0;
}
int len;
const char *str = get_amxstring(amx, params[3], 0, len);
return strncopy(vec->insert_at(idx), str, ke::Min((size_t)len + 1, vec->blocksize()));
}
// native ArraySwap(Array:which, item1, item2);
static cell AMX_NATIVE_CALL ArraySwap(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx1 = (size_t)params[2];
size_t idx2 = (size_t)params[3];
if (idx1 >= vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid index %d (count: %d)", idx1, vec->size());
return 0;
}
if (idx2 >= vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid index %d (count: %d)", idx2, vec->size());
return 0;
}
vec->swap(idx1, idx2);
return 1;
}
// native ArrayDeleteItem(Array:which, item);
static cell AMX_NATIVE_CALL ArrayDeleteItem(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
size_t idx = (size_t)params[2];
if (idx >= vec->size())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid index %d (count: %d)", idx, vec->size());
return 0;
}
vec->remove(idx);
return 1;
}
// native ArrayDestroy(&Array:which);
static cell AMX_NATIVE_CALL ArrayDestroy(AMX* amx, cell* params)
{
cell *handle = get_amxaddr(amx, params[1]);
CellArray* vec = ArrayHandles.lookup(*handle);
if (!vec)
{
return 0;
}
if (ArrayHandles.destroy(*handle))
{
*handle = 0;
return 1;
}
return 1;
}
struct ArraySort_s
{
int func;
cell array_hndl;
cell* array_base;
cell array_bsize;
cell data;
cell size;
cell addr1;
cell addr2;
AMX *amx;
};
ArraySort_s SortInfo;
int SortArrayList(const void *elem1, const void *elem2)
{
return executeForwards(
SortInfo.func,
SortInfo.array_hndl,
((cell)((cell *)elem1 - SortInfo.array_base)) / SortInfo.array_bsize,
((cell)((cell *)elem2 - SortInfo.array_base)) / SortInfo.array_bsize,
SortInfo.data,
SortInfo.size
);
}
// native ArraySort(Array:array, const comparefunc[], data[]="", data_size=0);
static cell AMX_NATIVE_CALL ArraySort(AMX* amx, cell* params)
{
cell handle = params[1];
CellArray* vec = ArrayHandles.lookup(handle);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", handle);
return 0;
}
int len;
char* funcName = get_amxstring(amx, params[2], 0, len);
// MySortFunc(Array:array, item1, item2, const data[], data_size)
int func = registerSPForwardByName(amx, funcName, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
if (func < 0)
{
LogError(amx, AMX_ERR_NATIVE, "The public function \"%s\" was not found.", funcName);
return 0;
}
size_t arraysize = vec->size();
size_t blocksize = vec->blocksize();
cell *array = vec->base();
ArraySort_s oldinfo = SortInfo;
SortInfo.func = func;
SortInfo.array_base = array;
SortInfo.array_bsize = static_cast<cell>(blocksize);
SortInfo.array_hndl = handle;
SortInfo.data = params[3];
SortInfo.size = params[4];
qsort(array, arraysize, blocksize * sizeof(cell), SortArrayList);
SortInfo = oldinfo;
unregisterSPForward(func);
return 1;
}
int SortArrayListExCell(const void *elem1, const void *elem2)
{
size_t index1 = ((cell)((cell *)elem1 - SortInfo.array_base)) / SortInfo.array_bsize;
size_t index2 = ((cell)((cell *)elem2 - SortInfo.array_base)) / SortInfo.array_bsize;
return executeForwards(
SortInfo.func,
SortInfo.array_hndl,
*&SortInfo.array_base[index1 * SortInfo.array_bsize],
*&SortInfo.array_base[index2 * SortInfo.array_bsize],
SortInfo.data,
SortInfo.size
);
}
int SortArrayListExArray(const void *elem1, const void *elem2)
{
size_t index1 = ((cell)((cell *)elem1 - SortInfo.array_base)) / SortInfo.array_bsize;
size_t index2 = ((cell)((cell *)elem2 - SortInfo.array_base)) / SortInfo.array_bsize;
cell *addr1 = get_amxaddr(SortInfo.amx, SortInfo.addr1);
cell *addr2 = get_amxaddr(SortInfo.amx, SortInfo.addr2);
memcpy(addr1, &SortInfo.array_base[index1 * SortInfo.array_bsize], SortInfo.array_bsize * sizeof(cell));
memcpy(addr2, &SortInfo.array_base[index2 * SortInfo.array_bsize], SortInfo.array_bsize * sizeof(cell));
return executeForwards(
SortInfo.func,
SortInfo.array_hndl,
SortInfo.addr1,
SortInfo.addr2,
SortInfo.data,
SortInfo.size
);
}
// native ArraySortEx(Array:array, const comparefunc[], data[]="", data_size=0);
static cell AMX_NATIVE_CALL ArraySortEx(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return 0;
}
int len;
char* funcName = get_amxstring(amx, params[2], 0, len);
int func = registerSPForwardByName(amx, funcName, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
if (!func)
{
LogError(amx, AMX_ERR_NATIVE, "The public function \"%s\" was not found.", funcName);
return 0;
}
size_t arraysize = vec->size();
size_t blocksize = vec->blocksize();
cell *array = vec->base();
cell amx_addr1 = 0, amx_addr2 = 0, *phys_addr = NULL;
if (blocksize > 1)
{
int err;
if ((err = amx_Allot(amx, blocksize, &amx_addr1, &phys_addr)) != AMX_ERR_NONE
|| ( err = amx_Allot(amx, blocksize, &amx_addr2, &phys_addr)) != AMX_ERR_NONE)
{
LogError(amx, err, "Ran out of memory");
return 0;
}
}
ArraySort_s oldinfo = SortInfo;
SortInfo.func = func;
SortInfo.array_base = array;
SortInfo.array_bsize = static_cast<cell>(blocksize);
SortInfo.array_hndl = params[1];
SortInfo.data = params[3];
SortInfo.size = params[4];
SortInfo.amx = amx;
SortInfo.addr1 = amx_addr1;
SortInfo.addr2 = amx_addr2;
qsort(array, arraysize, blocksize * sizeof(cell), blocksize > 1 ? SortArrayListExArray : SortArrayListExCell);
SortInfo = oldinfo;
if (blocksize > 1)
{
amx_Release(amx, amx_addr1);
amx_Release(amx, amx_addr2);
}
unregisterSPForward(func);
return 1;
}
extern bool fastcellcmp(cell *a, cell *b, cell len);
extern int amxstring_len(cell* a);
// native ArrayFindString(Array:which, const item[]);
static cell AMX_NATIVE_CALL ArrayFindString(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return -1;
}
cell *b, *a = get_amxaddr(amx, params[2]);
size_t cellcount = vec->blocksize();
size_t a_len = ke::Max(1, amxstring_len(a));
size_t len = a_len > cellcount ? cellcount : a_len;
for (size_t i = 0; i < vec->size(); i++)
{
b = vec->at(i);
if (fastcellcmp(a, b, len))
{
return static_cast<cell>(i);
}
}
return -1;
}
// native ArrayFindValue(Array:which, any:item);
static cell AMX_NATIVE_CALL ArrayFindValue(AMX* amx, cell* params)
{
CellArray* vec = ArrayHandles.lookup(params[1]);
if (!vec)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", params[1]);
return -1;
}
for (size_t i = 0; i < vec->size(); i++)
{
if (params[2] == *vec->at(i))
{
return static_cast<cell>(i);
}
}
return -1;
}
AMX_NATIVE_INFO g_DataStructNatives[] =
{
{ "ArrayCreate" , ArrayCreate },
{ "ArrayClear" , ArrayClear },
{ "ArrayClone" , ArrayClone },
{ "ArraySize" , ArraySize },
{ "ArrayResize" , ArrayResize },
{ "ArrayGetArray" , ArrayGetArray },
{ "ArrayGetCell" , ArrayGetCell },
{ "ArrayGetString" , ArrayGetString },
{ "ArraySetArray" , ArraySetArray },
{ "ArraySetCell" , ArraySetCell },
{ "ArraySetString" , ArraySetString },
{ "ArrayPushArray" , ArrayPushArray },
{ "ArrayPushCell" , ArrayPushCell },
{ "ArrayPushString" , ArrayPushString },
{ "ArrayInsertArrayAfter" , ArrayInsertArrayAfter },
{ "ArrayInsertCellAfter" , ArrayInsertCellAfter },
{ "ArrayInsertStringAfter" , ArrayInsertStringAfter },
{ "ArrayInsertArrayBefore" , ArrayInsertArrayBefore },
{ "ArrayInsertCellBefore" , ArrayInsertCellBefore },
{ "ArrayInsertStringBefore", ArrayInsertStringBefore },
{ "ArraySwap" , ArraySwap },
{ "ArrayDeleteItem" , ArrayDeleteItem },
{ "ArrayGetStringHandle" , ArrayGetStringHandle },
{ "ArrayDestroy" , ArrayDestroy },
{ "ArraySort" , ArraySort },
{ "ArraySortEx" , ArraySortEx },
{ "ArrayFindString" , ArrayFindString },
{ "ArrayFindValue" , ArrayFindValue },
{ nullptr , nullptr }
};

197
amxmodx/datastructs.h Normal file
View File

@ -0,0 +1,197 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef DATASTRUCTS_H
#define DATASTRUCTS_H
#include "natives_handles.h"
class CellArray
{
public:
CellArray(size_t blocksize, size_t basesize = 0) : m_Data(nullptr), m_BlockSize(blocksize), m_AllocSize(0), m_BaseSize(basesize > 0 ? basesize : 8), m_Size(0)
{
}
~CellArray()
{
free(m_Data);
}
size_t size() const
{
return m_Size;
}
cell *push()
{
if (!GrowIfNeeded(1))
{
return NULL;
}
cell *arr = &m_Data[m_Size * m_BlockSize];
m_Size++;
return arr;
}
cell *at(size_t b) const
{
return &m_Data[b * m_BlockSize];
}
size_t blocksize() const
{
return m_BlockSize;
}
void clear()
{
m_Size = 0;
}
bool swap(size_t item1, size_t item2)
{
/* Make sure there is extra space available */
if (!GrowIfNeeded(1))
{
return false;
}
cell *pri = at(item1);
cell *alt = at(item2);
/* Get our temporary array 1 after the limit */
cell *temp = &m_Data[m_Size * m_BlockSize];
memcpy(temp, pri, sizeof(cell)* m_BlockSize);
memcpy(pri, alt, sizeof(cell)* m_BlockSize);
memcpy(alt, temp, sizeof(cell)* m_BlockSize);
return true;
}
void remove(size_t index)
{
/* If we're at the end, take the easy way out */
if (index == m_Size - 1)
{
m_Size--;
return;
}
/* Otherwise, it's time to move stuff! */
size_t remaining_indexes = (m_Size - 1) - index;
cell *src = at(index + 1);
cell *dest = at(index);
memmove(dest, src, sizeof(cell)* m_BlockSize * remaining_indexes);
m_Size--;
}
cell *insert_at(size_t index)
{
/* Make sure it'll fit */
if (!GrowIfNeeded(1))
{
return nullptr;
}
/* move everything up */
cell *src = at(index);
cell *dst = at(index + 1);
memmove(dst, src, sizeof(cell)* m_BlockSize * (m_Size - index));
m_Size++;
return src;
}
bool resize(size_t count)
{
if (count <= m_Size)
{
m_Size = count;
return true;
}
if (!GrowIfNeeded(count - m_Size))
{
return false;
}
m_Size = count;
return true;
}
CellArray *clone()
{
CellArray *array = new CellArray(m_BlockSize);
array->m_AllocSize = m_AllocSize;
array->m_Size = m_Size;
array->m_Data = (cell *)malloc(sizeof(cell)* m_BlockSize * m_AllocSize);
if (!array->m_Data)
{
delete array;
return nullptr;
}
memcpy(array->m_Data, m_Data, sizeof(cell)* m_BlockSize * m_Size);
return array;
}
cell *base()
{
return m_Data;
}
size_t mem_usage()
{
return m_AllocSize * m_BlockSize * sizeof(cell);
}
private:
bool GrowIfNeeded(size_t count)
{
/* Shortcut out if we can store this */
if (m_Size + count <= m_AllocSize)
{
return true;
}
/* Set a base allocation size of 8 items */
if (!m_AllocSize)
{
m_AllocSize = m_BaseSize;
}
/* If it's not enough, keep doubling */
while (m_Size + count > m_AllocSize)
{
m_AllocSize *= 2;
}
/* finally, allocate the new block */
if (m_Data)
{
m_Data = (cell *)realloc(m_Data, sizeof(cell)* m_BlockSize * m_AllocSize);
}
else {
m_Data = (cell *)malloc(sizeof(cell)* m_BlockSize * m_AllocSize);
}
return (m_Data != NULL);
}
private:
cell *m_Data;
size_t m_BlockSize;
size_t m_AllocSize;
size_t m_BaseSize;
size_t m_Size;
};
extern NativeHandle<CellArray> ArrayHandles;
#endif

1025
amxmodx/debugger.cpp Executable file

File diff suppressed because it is too large Load Diff

180
amxmodx/debugger.h Executable file
View File

@ -0,0 +1,180 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef _INCLUDE_DEBUGGER_H_
#define _INCLUDE_DEBUGGER_H_
#include "amxdbg.h"
/**
* Third revision of the AMX Mod X Plugin Debugger.
* This final, object oriented version is safe for multiple calls and lets you
* fine-tune error handling.
* -BAILOPAN
*/
class Debugger
{
public:
class Tracer
{
public:
struct trace_info
{
trace_info() : cip(0), frm(0), next(NULL), prev(NULL), used(false) {};
cell cip;
cell frm;
trace_info *next;
trace_info *prev;
bool used;
};
public:
Tracer() : m_Error(0), m_pStart(NULL), m_pEnd(NULL), m_Reset(true) {};
~Tracer();
public:
void StepI(cell frm, cell cip);
void Reset();
void Clear();
Debugger::Tracer::trace_info *GetStart() const;
Debugger::Tracer::trace_info *GetEnd() const;
public:
int m_Error;
private:
trace_info *m_pStart;
trace_info *m_pEnd;
bool m_Reset;
};
public:
Debugger(AMX *pAmx, AMX_DBG *pAmxDbg) : m_pAmx(pAmx), m_pAmxDbg(pAmxDbg), m_Top(-1)
{
_CacheAmxOpcodeList();
};
~Debugger();
public:
//Begin a trace for a function
void BeginExec();
//Step through one instruction
void StepI();
//Get/set the last traced error
int GetTracedError();
void SetTracedError(int error);
//Get the first trace info of the call stack
Debugger::Tracer::trace_info *GetTraceStart() const;
//Get extra info about the call stack
bool GetTraceInfo(Debugger::Tracer::trace_info *pTraceInfo, long &line, const char *&function, const char *&file);
//Get the next trace in the call stack, NULL if none
Debugger::Tracer::trace_info *GetNextTrace(Debugger::Tracer::trace_info *pTraceInfo);
//Returns true if an error exists
bool ErrorExists();
//Formats the error message into a buffer.
//returns length of data copied, or -1 if there is no error.
int FormatError(char *buffer, size_t maxLength);
//End a trace
void EndExec();
//Reset the internal states as if the debugger was inactive
void Reset();
//Destroy internal states for shutdown
void Clear();
void DisplayTrace(const char *message);
AMX *GetAMX() const { return m_pAmx; }
public:
//generic static opcode breaker
static int AMXAPI DebugHook(AMX *amx);
static void FmtGenericMsg(AMX *amx, int error, char buffer[], size_t maxLength);
static void GenericMessage(AMX *amx, int error);
private:
void _CacheAmxOpcodeList();
int _GetOpcodeFromCip(cell cip, cell *&addr);
cell _CipAsVa(cell cip);
const char *_GetFilename();
const char *_GetVersion();
public:
AMX *m_pAmx;
AMX_DBG *m_pAmxDbg;
int m_Top;
cell *m_pOpcodeList;
ke::AString m_FileName;
ke::AString m_Version;
ke::Vector<Tracer *> m_pCalls;
};
typedef Debugger::Tracer::trace_info trace_info_t;
/**
* Error handler for plugins
*/
class Handler
{
public:
Handler(AMX *pAmx) : m_pAmx(pAmx), m_iErrFunc(-1), m_iModFunc(-1), m_iNatFunc(-1), m_Handling(false), m_InNativeFilter(false) {};
~Handler() {};
public:
int SetErrorHandler(const char *function);
int SetNativeFilter(const char *function);
int SetModuleFilter(const char *function);
public:
int HandleError(const char *msg);
int HandleNative(const char *native, int index, int trap);
int HandleModule(const char *module, bool isClass=false);
public:
bool IsHandling() const { return m_Handling; }
void SetErrorMsg(const char *msg);
const char *GetLastMsg();
trace_info_t *GetTrace() const { return m_pTrace; }
const char *GetFmtCache() { return m_FmtCache.chars(); }
bool IsNativeFiltering() { return (m_iNatFunc > -1); }
bool InNativeFilter() { return m_InNativeFilter; }
private:
AMX *m_pAmx;
int m_iErrFunc;
int m_iModFunc;
int m_iNatFunc;
bool m_Handling;
//in the future, make this a stack!
bool m_InNativeFilter;
ke::AString m_MsgCache;
ke::AString m_FmtCache;
trace_info_t *m_pTrace;
};
extern AMX_NATIVE_INFO g_DebugNatives[];
#endif //_INCLUDE_DEBUGGER_H_

View File

@ -1,35 +1,14 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "CMenu.h"
int gmsgAmmoPickup;
int gmsgAmmoX;
@ -51,214 +30,288 @@ int gmsgWeaponList;
int gmsgintermission;
int gmsgResetHUD;
int gmsgRoundTime;
int gmsgSayText;
int gmsgInitHUD;
TeamIds g_teamsIds;
WeaponsVault g_weaponsData[MAX_WEAPONS];
void Client_VGUIMenu(void* mValue)
{
if (!mPlayer) return;
switch (mState++){
case 0:
mPlayer->menu = -(*(int*)mValue);
break;
case 1:
mPlayer->keys = *(int*)mValue;
}
if (!mPlayer) return;
mPlayer->vgui = true;
switch (mState++)
{
case 0:
mPlayer->menu = -(*(int*)mValue);
mPlayer->newmenu = -1;
break;
case 1:
mPlayer->keys = *(int*)mValue;
}
}
void Client_ShowMenu(void* mValue)
{
if (!mPlayer) return;
switch (mState++){
case 0:
mPlayer->keys = *(int*)mValue;
break;
case 3:
mPlayer->menu = g_menucmds.findMenuId( (char*)mValue );
}
if (!mPlayer) return;
mPlayer->vgui = true;
switch (mState++)
{
case 0:
mPlayer->keys = *(int*)mValue;
break;
case 3:
{
mPlayer->menu = g_menucmds.findMenuId((char*)mValue);
mPlayer->newmenu = -1;
break;
}
}
}
extern bool g_bmod_tfc;
void Client_TeamInfo(void* mValue)
{
if (mPlayer) return;
static int index;
switch (mState++) {
case 0:
index = *(int*)mValue;
break;
case 1:
if ( index < 1 || index > gpGlobals->maxClients ) break;
char* msg = (char*)mValue;
g_players[ index ].team.assign( msg );
g_teamsIds.registerTeam( msg , -1 );
}
if (mPlayer && !g_bmod_tfc) return;
static int index;
switch (mState++)
{
case 0:
index = *(int*)mValue;
break;
case 1:
if (index < 1 || index > gpGlobals->maxClients) break;
char* msg = (char*)mValue;
if (!msg) break;
auto pPlayer = GET_PLAYER_POINTER_I(index);
pPlayer->team = msg;
g_teamsIds.registerTeam(msg, -1);
pPlayer->teamId = g_teamsIds.findTeamId(msg);
if (pPlayer->teamId == -1)
{
/**
* CS fix for SPECTATOR team.
* -
* When a player chooses spectator, ScoreInfo is sent before TeamInfo and with 0 as index.
* This means for the first round of first spectator, SPECTATOR name is not associated with its index.
* The following fix manually sets the team index when we hit SPECTATOR team.
*/
if (g_bmod_cstrike && !strcmp(msg, "SPECTATOR"))
{
pPlayer->teamId = 3;
g_teamsIds.registerTeam(msg, 3);
}
/**
* Fixes in-between situation where the team name is not yet associated with a valid index
* and ScoreInfo is executed later (used to retrieve the index). E.g. a player is dead,
* then changes team. Index will return -1 until ScoreInfo is sent, usually at the next spawn.
*/
else if ((g_bmod_cstrike || g_bmod_dod || g_bmod_tfc || g_bmod_gearbox || g_bmod_valve)
&& pPlayer->pEdict->pvPrivateData
&& !pPlayer->IsAlive())
{
GET_OFFSET_NO_ERROR("CBasePlayer", m_iTeam);
const auto teamId = get_pdata<int>(pPlayer->pEdict, m_iTeam);
pPlayer->teamId = teamId;
g_teamsIds.registerTeam(msg, teamId);
}
}
break;
}
}
void Client_TextMsg(void* mValue)
{
if ( mPlayer ) return;
switch (mState++) {
case 1:{
char * msg = (char*)mValue;
if (!msg) break;
if ( !strncmp("#Game_C", msg , 7) ) {
g_game_timeleft = g_game_restarting = gpGlobals->time + 3;
// g_endround_time = gpGlobals->time;
// g_newround_time = gpGlobals->time + CVAR_GET_FLOAT("mp_freezetime") + 3;
}
else if (!strncmp("#Game_w", msg , 7) ) {
g_game_timeleft = -2;
}
else if ( !strncmp("#game_clan_s", msg , 12) ){
g_game_timeleft = -3;
}
break;
}
case 2:{
char * msg = (char*)mValue;
if (!msg) break;
if (g_game_timeleft == -2 ){
g_game_timeleft = g_game_restarting = gpGlobals->time + atoi( msg );
// g_newround_time = g_game_timeleft + CVAR_GET_FLOAT("mp_freezetime");
}
else if ( g_game_timeleft == -3 )
g_game_restarting = atoi( msg ) * 60;
break;
}
case 3:{
char * msg = (char*)mValue;
if (!msg) break;
if ( g_game_timeleft != -3 ) break;
g_game_restarting += atoi( msg );
g_game_timeleft = g_game_restarting = gpGlobals->time + g_game_restarting;
break;
}
}
if (mPlayer) return;
switch (mState++)
{
case 1:
{
char * msg = (char*)mValue;
if (!msg) break;
if (!strncmp("#Game_C", msg, 7))
{
g_game_timeleft = g_game_restarting = gpGlobals->time + 3;
//g_endround_time = gpGlobals->time;
//g_newround_time = gpGlobals->time + CVAR_GET_FLOAT("mp_freezetime") + 3;
}
else if (!strncmp("#Game_w", msg, 7))
{
g_game_timeleft = -2;
}
else if (!strncmp("#game_clan_s", msg, 12))
{
g_game_timeleft = -3;
}
break;
}
case 2:
{
char * msg = (char*)mValue;
if (!msg) break;
if (g_game_timeleft == -2)
{
g_game_timeleft = g_game_restarting = gpGlobals->time + atoi(msg);
//g_newround_time = g_game_timeleft + CVAR_GET_FLOAT("mp_freezetime");
}
else if (g_game_timeleft == -3)
g_game_restarting = atoi(msg) * 60.0f;
break;
}
case 3:
{
char * msg = (char*)mValue;
if (!msg) break;
if (g_game_timeleft != -3) break;
g_game_restarting += atoi(msg);
g_game_timeleft = g_game_restarting = gpGlobals->time + g_game_restarting;
break;
}
}
}
void Client_WeaponList(void* mValue)
{
static int wpnList = 0;
//static int wpnList2;
static int iSlot;
static const char* wpnName;
switch (mState++) {
case 0:
wpnName = (char*)mValue;
break;
case 1:
iSlot = *(int*)mValue;
break;
case 7:
int iId = *(int*)mValue;
/*int* blocker;
int iwpn = iId;
static int wpnList = 0;
//static int wpnList2;
static int iSlot;
static const char* wpnName;
if (iId > 31) {
iwpn -= 31;
blocker = &wpnList2;
switch (mState++)
{
case 0:
wpnName = (char*)mValue;
break;
case 1:
iSlot = *(int*)mValue;
break;
case 7:
int iId = *(int*)mValue;
if ((iId < 0 || iId >= MAX_WEAPONS) || (wpnList & (1<<iId)))
break;
wpnList |= (1<<iId);
g_weaponsData[iId].iId = iId;
g_weaponsData[iId].ammoSlot = iSlot;
g_weaponsData[iId].fullName = wpnName;
}
else
blocker = &wpnList;*/
if ( (iId < 0 || iId >= MAX_WEAPONS ) || (wpnList & (1<<iId)) )
break;
wpnList |= (1<<iId);
g_weaponsData[iId].iId = iId;
g_weaponsData[iId].ammoSlot = iSlot;
g_weaponsData[iId].fullName.assign(wpnName);
}
}
void Client_CurWeapon(void* mValue)
{
static int iState;
static int iId;
switch (mState++){
case 0:
iState = *(int*)mValue;
break;
case 1:
if (!iState) break;
iId = *(int*)mValue;
break;
case 2:
if (!mPlayer) return;
if (!iState || (iId < 1 || iId >= MAX_WEAPONS ) ) break;
mPlayer->weapons[iId].clip = *(int*)mValue;
mPlayer->current = iId;
mPlayer->lastHit = mPlayer->lastTrace;
}
static int iState;
static int iId;
switch (mState++)
{
case 0:
iState = *(int*)mValue;
break;
case 1:
if (!iState) break;
iId = *(int*)mValue;
break;
case 2:
if (!mPlayer) return;
if (!iState || (iId < 1 || iId >= MAX_WEAPONS)) break;
mPlayer->current = iId;
if (*(int*)mValue < mPlayer->weapons[iId].clip && // Only update the lastHit vector if the clip size is decreasing
*(int*)mValue != -1) // But not if it's a melee weapon
{
mPlayer->lastHit = mPlayer->lastTrace;
}
mPlayer->weapons[iId].clip = *(int*)mValue;
}
}
void Client_AmmoX(void* mValue)
{
static int iAmmo;
switch (mState++){
case 0:
iAmmo = *(int*)mValue;
break;
case 1:
if (!mPlayer) return;
for(int i=1;i<MAX_WEAPONS;++i)
if (iAmmo == g_weaponsData[i].ammoSlot)
mPlayer->weapons[i].ammo = *(int*)mValue;
}
static int iAmmo;
switch (mState++)
{
case 0:
iAmmo = *(int*)mValue;
break;
case 1:
if (!mPlayer) return;
for (int i = 1; i < MAX_WEAPONS; ++i)
if (iAmmo == g_weaponsData[i].ammoSlot)
mPlayer->weapons[i].ammo = *(int*)mValue;
}
}
void Client_AmmoPickup(void* mValue)
{
static int iSlot;
switch (mState++){
case 0:
iSlot = *(int*)mValue;
break;
case 1:
if (!mPlayer) return;
for(int i=1;i<MAX_WEAPONS;++i)
if (g_weaponsData[i].ammoSlot==iSlot)
mPlayer->weapons[i].ammo += *(int*)mValue;
}
static int iSlot;
switch (mState++)
{
case 0:
iSlot = *(int*)mValue;
break;
case 1:
if (!mPlayer) return;
for (int i = 1; i < MAX_WEAPONS; ++i)
if (g_weaponsData[i].ammoSlot==iSlot)
mPlayer->weapons[i].ammo += *(int*)mValue;
}
}
void Client_ScoreInfo(void* mValue)
{
static int index;
static int deaths;
switch (mState++){
case 0:
index = *(int*)mValue;
break;
case 2:
deaths = *(int*)mValue;
break;
case 4:
if ( index < 1 || index > gpGlobals->maxClients ) break;
CPlayer*pPlayer = GET_PLAYER_POINTER_I( index );
pPlayer->deaths = deaths;
pPlayer->teamId = *(int*)mValue;
if ( g_teamsIds.isNewTeam() )
g_teamsIds.registerTeam( pPlayer->team.c_str() , pPlayer->teamId );
}
static int index;
static int deaths;
switch (mState++)
{
case 0:
index = *(int*)mValue;
break;
case 2:
deaths = *(int*)mValue;
break;
case 4:
if (index < 1 || index > gpGlobals->maxClients) break;
CPlayer*pPlayer = GET_PLAYER_POINTER_I(index);
pPlayer->deaths = deaths;
pPlayer->teamId = *(int*)mValue;
if (g_teamsIds.isNewTeam())
g_teamsIds.registerTeam(pPlayer->team.chars(), pPlayer->teamId);
}
}
void Client_DamageEnd(void* mValue)
{
CPlayer* dead = mPlayer;
if ( dead && dead->death_killer )
if (dead && dead->death_killer)
{
g_events.parserInit( CS_DEATHMSG , &gpGlobals->time , mPlayer = 0, mPlayerIndex = 0 );
g_events.parseValue( dead->death_killer );
g_events.parseValue( dead->index );
g_events.parseValue( dead->death_headshot );
g_events.parseValue( dead->death_weapon.c_str() );
g_events.parseValue( dead->death_tk ? 1 : 0 );
g_events.parserInit(CS_DEATHMSG, &gpGlobals->time, mPlayer = 0, mPlayerIndex = 0);
g_events.parseValue(dead->death_killer);
g_events.parseValue(dead->index);
g_events.parseValue(dead->death_headshot);
g_events.parseValue(dead->death_weapon.chars());
g_events.parseValue(dead->death_tk ? 1 : 0);
g_events.executeEvents();
dead->death_killer = 0;
}
@ -272,30 +325,47 @@ void Client_DeathMsg(void* mValue)
static int victim_id;
static int hs;
switch (mState++){
case 0:
killer_id = *(int*)mValue;
killer = (killer_id > 0 && killer_id < 33) ?
GET_PLAYER_POINTER_I(killer_id) : 0;
break;
case 1:
victim_id = *(int*)mValue;
victim = (victim_id > 0 && victim_id < 33) ?
GET_PLAYER_POINTER_I(victim_id) : 0;
break;
case 2:
hs = *(int*)mValue;
break;
case 3:
if ( !killer || !victim ) break;
victim->death_killer = killer_id;
victim->death_weapon.assign((char*)mValue);
victim->death_headshot = hs;
victim->death_tk = (killer->teamId == victim->teamId);
switch (mState++)
{
case 0:
killer_id = *(int*)mValue;
killer = (killer_id > 0 && killer_id < 33) ? GET_PLAYER_POINTER_I(killer_id) : 0;
break;
case 1:
victim_id = *(int*)mValue;
victim = (victim_id > 0 && victim_id < 33) ? GET_PLAYER_POINTER_I(victim_id) : 0;
break;
case 2:
hs = *(int*)mValue;
break;
case 3:
if (!killer || !victim) break;
victim->death_killer = killer_id;
victim->death_weapon = (char*)mValue;
victim->death_headshot = hs;
victim->death_tk = (killer->teamId == victim->teamId);
}
}
void Client_InitHUDEnd(void* mValue)
{
if (!g_bmod_cstrike)
return;
CPlayer *pPlayer = mPlayer;
if (!pPlayer->teamIdsInitialized && !pPlayer->IsBot())
{
// This creates specific indexes (> maxplayers) for print_chat_color().
// 33 : print_team_grey / spectator
// 34 : print_team_red / terrorist
// 35 : print_team_blue / ct
UTIL_TeamInfo(pPlayer->pEdict, 33 + 1, "TERRORIST"); // print_team_red
UTIL_TeamInfo(pPlayer->pEdict, 33 + 2, "CT"); // print_team_blue
pPlayer->teamIdsInitialized = true;
}
}
/*
void Client_SendAudio(void* mValue)
{
@ -323,4 +393,4 @@ void Client_ResetHUD(void* mValue)
{
}
*/
*/

File diff suppressed because it is too large Load Diff

View File

@ -1,229 +1,16 @@
/* AMX Mod X
*
* by the AMX Mod X Development Team
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*/
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef __FAKEMETA_H__
#define __FAKEMETA_H__
// Fake metamod api for modules
#include "CList.h"
// from mplugin.h (metamod)
// Flags to indicate current "load" state of plugin.
// NOTE: order is important, as greater/less comparisons are made.
typedef enum {
PL_EMPTY = 0, // empty slot
PL_VALID, // has valid info in it
PL_BADFILE, // nonexistent file (open failed),
// or not a valid plugin file (query failed)
PL_OPENED, // dlopened and queried
PL_FAILED, // opened, but failed to attach or unattach
PL_RUNNING, // attached and running
PL_PAUSED, // attached but paused
} PLUG_STATUS;
// from h_export.h (metamod)
// Our GiveFnptrsToDll, called by engine.
typedef void (WINAPI *GIVE_ENGINE_FUNCTIONS_FN) (enginefuncs_t
*pengfuncsFromEngine, globalvars_t *pGlobals);
// *** CFakeMeta
class CFakeMeta
{
private:
// Core tables
/* DLL_FUNCTIONS m_CoreDllFuncTable;
enginefuncs_t m_CoreEngineFuncTable;
NEW_DLL_FUNCTIONS m_CoreNewDllFuncTable;
DLL_FUNCTIONS m_CoreDllFuncTable_Post;
enginefuncs_t m_CoreEngineFuncTable_Post;
NEW_DLL_FUNCTIONS m_CoreNewDllFuncTable_Post; */
bool AddCorePlugin(); // Adds the core plugin if needed
public:
class CFakeMetaPlugin
{
private:
// plugin info
String m_Path;
PLUG_STATUS m_Status;
plugin_info_t *m_Info;
// Function tables
META_FUNCTIONS m_MetaFuncTable;
DLL_FUNCTIONS m_DllFuncTable;
enginefuncs_t m_EngineFuncTable;
NEW_DLL_FUNCTIONS m_NewDllFuncTable;
DLL_FUNCTIONS m_DllFuncTable_Post;
enginefuncs_t m_EngineFuncTable_Post;
NEW_DLL_FUNCTIONS m_NewDllFuncTable_Post;
// OS dep handle
DLHANDLE m_Handle;
public:
inline PLUG_STATUS GetStatus() const
{ return m_Status; }
inline void SetStatus(PLUG_STATUS newStatus)
{ m_Status = newStatus; }
inline plugin_info_t * GetInfo()
{ return m_Info; }
inline const plugin_info_t * GetInfo() const
{ return m_Info; }
inline void SetInfo(plugin_info_t *newInfo)
{ m_Info = newInfo; }
inline const char * GetPath()
{ return m_Path.c_str(); }
inline const META_FUNCTIONS &GetMetaFunctions() const
{ return m_MetaFuncTable; }
// Get
inline DLL_FUNCTIONS &GetDllFuncTable()
{ return m_DllFuncTable; }
inline enginefuncs_t &GetEngineFuncTable()
{ return m_EngineFuncTable; }
inline NEW_DLL_FUNCTIONS &GetNewDllFuncTable()
{ return m_NewDllFuncTable; }
// Get const
inline const DLL_FUNCTIONS &GetDllFuncTable() const
{ return m_DllFuncTable; }
inline const enginefuncs_t &GetEngineFuncTable() const
{ return m_EngineFuncTable; }
inline const NEW_DLL_FUNCTIONS &GetNewDllFuncTable() const
{ return m_NewDllFuncTable; }
// Get post
inline DLL_FUNCTIONS &GetDllFuncTable_Post()
{ return m_DllFuncTable_Post; }
inline enginefuncs_t &GetEngineFuncTable_Post()
{ return m_EngineFuncTable_Post; }
inline NEW_DLL_FUNCTIONS &GetNewDllFuncTable_Post()
{ return m_NewDllFuncTable_Post; }
// Get post const
inline const DLL_FUNCTIONS &GetDllFuncTable_Post() const
{ return m_DllFuncTable_Post; }
inline const enginefuncs_t &GetEngineFuncTable_Post() const
{ return m_EngineFuncTable_Post; }
inline const NEW_DLL_FUNCTIONS &GetNewDllFuncTable_Post() const
{ return m_NewDllFuncTable_Post; }
int Query(mutil_funcs_t *pMetaUtilFuncs); // Also calls GiveFnPtrsToDll
int Attach(PLUG_LOADTIME now, meta_globals_t *pMGlobals, gamedll_funcs_t *pGameDllFuncs);
int Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
int GetEntityAPI2(int interfaceVersion);
int GetEntityAPI2_Post(int interfaceVersion);
int GetEngineFunctions(int interfaceVersion);
int GetEngineFunctions_Post(int interfaceVersion);
int GetNewDLLFunctions(int interfaceVersion);
int GetNewDLLFunctions_Post(int interfaceVersion);
CFakeMetaPlugin(const char *path);
~CFakeMetaPlugin();
}; // CFakeMetaPlugin
CFakeMeta();
~CFakeMeta();
bool AddPlugin(const char *path /*path relative to moddir*/);
void ReleasePlugins();
// This is public because i don't want to declare all the functions as friends :)
// :NOTE: The core is now a special, first plugin!
CList<CFakeMetaPlugin> m_Plugins;
// ****** Meta functions ******
// Query all added plugins
void Meta_Query(mutil_funcs_t *pMetaUtilFuncs);
// Attach all added plugins
void Meta_Attach(PLUG_LOADTIME now, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs);
// Detach all added plugins
void Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
// :NOTE: Meta_Init currently not supported
int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable /*from metamod*/, int *interfaceVersion /*from metamod*/,
DLL_FUNCTIONS *pAMXXFunctionTable /*Functions amxx needs*/);
int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable /*from metamod*/, int *interfaceVersion /*from metamod*/,
DLL_FUNCTIONS *pAMXXFunctionTable /*Functions amxx needs*/);
int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion,
enginefuncs_t *pAMXXFunctionTable /*Fucntions amxx needs*/);
int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion,
enginefuncs_t *pAMXXFunctionTable /*Fucntions amxx needs*/);
int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion,
NEW_DLL_FUNCTIONS *pAMXXFunctionTable);
int GetNewDLLFunctions_Post(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion,
NEW_DLL_FUNCTIONS *pAMXXFunctionTable);
// Get
/*inline DLL_FUNCTIONS &GetDllFuncTable()
{ return m_CoreDllFuncTable; }
inline enginefuncs_t &GetEngineFuncTable()
{ return m_CoreEngineFuncTable; }
inline NEW_DLL_FUNCTIONS &GetNewDllFuncTable()
{ return m_CoreNewDllFuncTable; }
// Get const
inline const DLL_FUNCTIONS &GetDllFuncTable() const
{ return m_CoreDllFuncTable; }
inline const enginefuncs_t &GetEngineFuncTable() const
{ return m_CoreEngineFuncTable; }
inline const NEW_DLL_FUNCTIONS &GetNewDllFuncTable() const
{ return m_CoreNewDllFuncTable; }
// Get post
inline DLL_FUNCTIONS &GetDllFuncTable_Post()
{ return m_CoreDllFuncTable_Post; }
inline enginefuncs_t &GetEngineFuncTable_Post()
{ return m_CoreEngineFuncTable_Post; }
inline NEW_DLL_FUNCTIONS &GetNewDllFuncTable_Post()
{ return m_CoreNewDllFuncTable_Post; }
// Get post const
inline const DLL_FUNCTIONS &GetDllFuncTable_Post() const
{ return m_CoreDllFuncTable_Post; }
inline const enginefuncs_t &GetEngineFuncTable_Post() const
{ return m_CoreEngineFuncTable_Post; }
inline const NEW_DLL_FUNCTIONS &GetNewDllFuncTable_Post() const
{ return m_CoreNewDllFuncTable_Post; } */
}; // CFakeMeta
// Fake Metamod
// defined in meta_api.cpp
extern CFakeMeta g_FakeMeta;
int UnloadMetamodPlugin(void *handle);
int LoadMetamodPlugin(const char *path, void **handle, PLUG_LOADTIME now);
#endif // #ifndef __FAKEMETA_H__

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@
#include <stdlib.h> /* for atof() */
#include <stdio.h> /* for NULL */
#include <assert.h>
#include <math.h>
#include <cmath>
// this file does not include amxmodx.h, so we have to include the memory manager here
#ifdef MEMORY_TEST
@ -96,7 +96,7 @@ static cell AMX_NATIVE_CALL n_floatstr(AMX *amx,cell *params)
return 0;
/* Now convert the Small String into a C type null terminated string */
amx_GetString(szSource, pString, 0);
amx_GetStringOld(szSource, pString, 0);
/* Now convert this to a float. */
fNum = (REAL)atof(szSource);
@ -368,7 +368,6 @@ static cell AMX_NATIVE_CALL n_floatatan(AMX *amx, cell *params)
* params[2] = radix
*/
REAL fA = amx_ctof(params[1]);
fA = ToRadians(fA, params[2]);
fA = atan(fA);
fA = FromRadians(fA, params[2]);
return amx_ftoc(fA);
@ -425,6 +424,54 @@ static cell AMX_NATIVE_CALL n_floatatan2(AMX *amx, cell *params)
return amx_ftoc(fC);
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
/* Added by DS */
static cell AMX_NATIVE_CALL n_floatsinh(AMX *amx, cell *params)
{
/*
* params[1] = angle
* params[2] = radix
*/
REAL fA = amx_ctof(params[1]);
fA = ToRadians(fA, params[2]);
fA = sinh(fA);
return amx_ftoc(fA);
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
/* Added by DS */
static cell AMX_NATIVE_CALL n_floatcosh(AMX *amx, cell *params)
{
/*
* params[1] = angle
* params[2] = radix
*/
REAL fA = amx_ctof(params[1]);
fA = ToRadians(fA, params[2]);
fA = cosh(fA);
return amx_ftoc(fA);
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
/* Added by DS */
static cell AMX_NATIVE_CALL n_floattanh(AMX *amx, cell *params)
{
/*
* params[1] = angle
* params[2] = radix
*/
REAL fA = amx_ctof(params[1]);
fA = ToRadians(fA, params[2]);
fA = tanh(fA);
return amx_ftoc(fA);
}
#if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused
#endif
@ -457,6 +504,9 @@ AMX_NATIVE_INFO float_Natives[] = {
{ "floatacos", n_floatacos },
{ "floatatan", n_floatatan },
{ "floatatan2", n_floatatan2 },
{ "floatsinh", n_floatsinh },
{ "floatcosh", n_floatcosh },
{ "floattanh", n_floattanh },
{ NULL, NULL } /* terminator */
};

828
amxmodx/format.cpp Normal file
View File

@ -0,0 +1,828 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "format.h"
#include "datastructs.h"
//Adapted from Quake3's vsprintf
// thanks to cybermind for linking me to this :)
//I made the following changes:
// - Fixed spacing to be AMX Mod X standard
// - Added 'n' support, no buffer overflows
// - Templatized input/output buffers
#define ALT 0x00000001 /* alternate form */
#define HEXPREFIX 0x00000002 /* add 0x or 0X prefix */
#define LADJUST 0x00000004 /* left adjustment */
#define LONGDBL 0x00000008 /* long double */
#define LONGINT 0x00000010 /* long integer */
#define QUADINT 0x00000020 /* quad integer */
#define SHORTINT 0x00000040 /* short integer */
#define ZEROPAD 0x00000080 /* zero (as opposed to blank) pad */
#define FPT 0x00000100 /* floating point number */
#define UPPERDIGITS 0x00000200 /* make alpha digits uppercase */
#define to_digit(c) ((c) - '0')
#define is_digit(c) ((unsigned)to_digit(c) <= 9)
#define to_char(n) ((n) + '0')
#define CHECK_ARGS(n) \
if ((arg+n) > args) { \
LogError(amx, AMX_ERR_PARAMS, "String formatted incorrectly - parameter %d (total %d)", arg, args); \
return 0; \
}
template size_t atcprintf<cell, cell>(cell *, size_t, const cell *, AMX *, cell *, int *);
template size_t atcprintf<char, cell>(char *, size_t, const cell *, AMX *, cell *, int *);
template size_t atcprintf<cell, char>(cell *, size_t, const char *, AMX *, cell *, int *);
template size_t atcprintf<char, char>(char *, size_t, const char *, AMX *, cell *, int *);
THash<ke::AString, lang_err> BadLang_Table;
static cvar_t *amx_mldebug = nullptr;
static cvar_t *amx_cl_langs = nullptr;
const char *playerlang(const cell index)
{
const char *pLangName = nullptr;
if (index == LANG_PLAYER)
{
if (!amx_cl_langs)
{
amx_cl_langs = CVAR_GET_POINTER("amx_client_languages");
}
if (static_cast<int>(amx_cl_langs->value) == 0)
{
pLangName = amxmodx_language->string;
}
else
{
pLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(g_langMngr.GetDefLang())->pEdict, "lang");
}
}
else if (index == LANG_SERVER)
{
pLangName = amxmodx_language->string;
}
else if (index >= 1 && index <= gpGlobals->maxClients)
{
if (!amx_cl_langs)
{
amx_cl_langs = CVAR_GET_POINTER("amx_client_languages");
}
if (static_cast<int>(amx_cl_langs->value) == 0)
{
pLangName = amxmodx_language->string;
}
else
{
pLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(index)->pEdict, "lang");
}
}
return pLangName;
}
const char *translate(AMX *amx, const char *lang, const char *key)
{
auto pLangName = lang;
int status;
if (!pLangName || !isalpha(pLangName[0]))
{
pLangName = amxmodx_language->string;
}
auto def = g_langMngr.GetDef(pLangName, key, status);
if (!amx_mldebug)
{
amx_mldebug = CVAR_GET_POINTER("amx_mldebug");
}
auto debug = (amx_mldebug && amx_mldebug->string && (amx_mldebug->string[0] != '\0'));
if (debug)
{
int debug_status;
auto validlang = true;
auto testlang = amx_mldebug->string;
if (!g_langMngr.LangExists(testlang))
{
AMXXLOG_Error("[AMXX] \"%s\" is an invalid debug language", testlang);
validlang = false;
}
g_langMngr.GetDef(testlang, key, debug_status);
if (validlang && debug_status == ERR_BADKEY)
{
AMXXLOG_Error("[AMXX] Language key \"%s\" not found for language \"%s\", check \"%s\"", key, testlang, GetFileName(amx));
}
}
if (!def)
{
if (debug && status == ERR_BADLANG)
{
ke::AString langName(pLangName);
auto &err = BadLang_Table.AltFindOrInsert(ke::Move(langName));
if (err.last + 120.0f < gpGlobals->time)
{
AMXXLOG_Error("[AMXX] Language \"%s\" not found", pLangName);
err.last = gpGlobals->time;
}
}
if (strcmp(pLangName, amxmodx_language->string) != 0)
{
def = g_langMngr.GetDef(amxmodx_language->string, key, status);
}
if (!def && (strcmp(pLangName, "en") != 0 && strcmp(amxmodx_language->string, "en") != 0))
{
def = g_langMngr.GetDef("en", key, status);
}
}
return def;
}
template <typename U, typename S>
void AddString(U **buf_p, size_t &maxlen, const S *string, int width, int prec)
{
int size = 0;
U *buf;
static S nlstr[] = {'(','n','u','l','l',')','\0'};
buf = *buf_p;
if (string == NULL)
{
string = nlstr;
prec = -1;
}
if (prec >= 0)
{
for (size = 0; size < prec; size++)
{
if (string[size] == '\0')
break;
}
} else {
while (string[size++]) ;
size--;
}
if (size > (int)maxlen)
size = maxlen;
/* If precision is provided, make sure we don't truncate a multi-byte character */
if (prec >= size && (string[size - 1] & 1 << 7))
{
size -= UTIL_CheckValidChar((cell *)string + size - 1);
}
maxlen -= size;
width -= size;
while (size--)
*buf++ = static_cast<U>(*string++);
while (width-- > 0 && maxlen)
{
*buf++ = ' ';
maxlen--;
}
*buf_p = buf;
}
template <typename U>
void AddFloat(U **buf_p, size_t &maxlen, double fval, int width, int prec, int flags)
{
int digits; // non-fraction part digits
double tmp; // temporary
U *buf = *buf_p; // output buffer pointer
int val; // temporary
int sign = 0; // 0: positive, 1: negative
int fieldlength; // for padding
int significant_digits = 0; // number of significant digits written
const int MAX_SIGNIFICANT_DIGITS = 16;
// default precision
if (prec < 0)
{
prec = 6;
}
// get the sign
if (fval < 0)
{
fval = -fval;
sign = 1;
}
// compute whole-part digits count
digits = (int)log10(fval) + 1;
// Only print 0.something if 0 < fval < 1
if (digits < 1)
{
digits = 1;
}
// compute the field length
fieldlength = digits + prec + ((prec > 0) ? 1 : 0) + sign;
// minus sign BEFORE left padding if padding with zeros
if (sign && maxlen && (flags & ZEROPAD))
{
*buf++ = '-';
maxlen--;
}
// right justify if required
if ((flags & LADJUST) == 0)
{
while ((fieldlength < width) && maxlen)
{
*buf++ = (flags & ZEROPAD) ? '0' : ' ';
width--;
maxlen--;
}
}
// minus sign AFTER left padding if padding with spaces
if (sign && maxlen && !(flags & ZEROPAD))
{
*buf++ = '-';
maxlen--;
}
// write the whole part
tmp = pow(10.0, digits-1);
while ((digits--) && maxlen)
{
if (++significant_digits > MAX_SIGNIFICANT_DIGITS)
{
*buf++ = '0';
}
else
{
val = (int)(fval / tmp);
*buf++ = '0' + val;
fval -= val * tmp;
tmp *= 0.1;
}
maxlen--;
}
// write the fraction part
if (maxlen && prec)
{
*buf++ = '.';
maxlen--;
}
tmp = pow(10.0, prec);
fval *= tmp;
while (prec-- && maxlen)
{
if (++significant_digits > MAX_SIGNIFICANT_DIGITS)
{
*buf++ = '0';
}
else
{
tmp *= 0.1;
val = (int)(fval / tmp);
*buf++ = '0' + val;
fval -= val * tmp;
}
maxlen--;
}
// left justify if required
if (flags & LADJUST)
{
while ((fieldlength < width) && maxlen)
{
// right-padding only with spaces, ZEROPAD is ignored
*buf++ = ' ';
width--;
maxlen--;
}
}
// update parent's buffer pointer
*buf_p = buf;
}
template <typename U>
void AddBinary(U **buf_p, size_t &maxlen, unsigned int val, int width, int flags)
{
char text[32];
int digits;
U *buf;
digits = 0;
do
{
if (val & 1)
{
text[digits++] = '1';
}
else
{
text[digits++] = '0';
}
val >>= 1;
} while (val);
buf = *buf_p;
if (!(flags & LADJUST))
{
while (digits < width && maxlen)
{
*buf++ = (flags & ZEROPAD) ? '0' : ' ';
width--;
maxlen--;
}
}
while (digits-- && maxlen)
{
*buf++ = text[digits];
width--;
maxlen--;
}
if (flags & LADJUST)
{
while (width-- && maxlen)
{
*buf++ = (flags & ZEROPAD) ? '0' : ' ';
maxlen--;
}
}
*buf_p = buf;
}
template <typename U>
void AddUInt(U **buf_p, size_t &maxlen, unsigned int val, int width, int flags)
{
U text[32];
int digits;
U *buf;
digits = 0;
do {
text[digits++] = '0' + val % 10;
val /= 10;
} while (val);
buf = *buf_p;
if( !(flags & LADJUST) )
{
while (digits < width && maxlen)
{
*buf++ = (flags & ZEROPAD) ? '0' : ' ';
width--;
maxlen--;
}
}
while (digits-- && maxlen)
{
*buf++ = text[digits];
width--;
maxlen--;
}
if (flags & LADJUST)
{
while (width-- && maxlen)
{
*buf++ = (flags & ZEROPAD) ? '0' : ' ';
maxlen--;
}
}
*buf_p = buf;
}
template <typename U>
void AddInt(U **buf_p, size_t &maxlen, int val, int width, int flags)
{
U text[32];
int digits;
int signedVal;
U *buf;
unsigned int unsignedVal;
digits = 0;
signedVal = val;
if (val < 0)
{
/* we want the unsigned version */
unsignedVal = abs(val);
} else {
unsignedVal = val;
}
do {
text[digits++] = '0' + unsignedVal % 10;
unsignedVal /= 10;
} while (unsignedVal);
if (signedVal < 0)
text[digits++] = '-';
buf = *buf_p;
if( !(flags & LADJUST) )
{
while (digits < width && maxlen)
{
*buf++ = (flags & ZEROPAD) ? '0' : ' ';
width--;
maxlen--;
}
}
while (digits-- && maxlen)
{
*buf++ = text[digits];
width--;
maxlen--;
}
if (flags & LADJUST)
{
while (width-- && maxlen)
{
*buf++ = (flags & ZEROPAD) ? '0' : ' ';
maxlen--;
}
}
*buf_p = buf;
}
template <typename U>
void AddHex(U **buf_p, size_t &maxlen, unsigned int val, int width, int flags)
{
U text[32];
int digits;
U *buf;
U digit;
int hexadjust;
if (flags & UPPERDIGITS)
{
hexadjust = 'A' - '9' - 1;
} else {
hexadjust = 'a' - '9' - 1;
}
digits = 0;
do
{
digit = ('0' + val % 16);
if (digit > '9')
{
digit += hexadjust;
}
text[digits++] = digit;
val /= 16;
} while (val);
buf = *buf_p;
if( !(flags & LADJUST) )
{
while (digits < width && maxlen)
{
*buf++ = (flags & ZEROPAD) ? '0' : ' ';
width--;
maxlen--;
}
}
while (digits-- && maxlen)
{
*buf++ = text[digits];
width--;
maxlen--;
}
if (flags & LADJUST)
{
while (width-- && maxlen)
{
*buf++ = (flags & ZEROPAD) ? '0' : ' ';
maxlen--;
}
}
*buf_p = buf;
}
template <typename D, typename S>
size_t atcprintf(D *buffer, size_t maxlen, const S *format, AMX *amx, cell *params, int *param)
{
int arg;
int args = params[0] / sizeof(cell);
D *buf_p;
D ch;
int flags;
int width;
int prec;
int n;
//char sign;
const S *fmt;
size_t llen = maxlen;
buf_p = buffer;
arg = *param;
fmt = format;
while (true)
{
// run through the format string until we hit a '%' or '\0'
for (ch = static_cast<D>(*fmt);
llen && ((ch = static_cast<D>(*fmt)) != '\0' && ch != '%');
fmt++)
{
*buf_p++ = static_cast<D>(ch);
llen--;
}
if (ch == '\0' || llen <= 0)
goto done;
// skip over the '%'
fmt++;
// reset formatting state
flags = 0;
width = 0;
prec = -1;
//sign = '\0';
rflag:
ch = static_cast<D>(*fmt++);
reswitch:
switch(ch)
{
case '-':
flags |= LADJUST;
goto rflag;
case '.':
n = 0;
while( is_digit( ( ch = static_cast<D>(*fmt++)) ) )
n = 10 * n + ( ch - '0' );
prec = n < 0 ? -1 : n;
goto reswitch;
case '0':
flags |= ZEROPAD;
goto rflag;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
n = 0;
do {
n = 10 * n + ( ch - '0' );
ch = static_cast<D>(*fmt++);
} while( is_digit( ch ) );
width = n;
goto reswitch;
case 'c':
CHECK_ARGS(0);
*buf_p++ = static_cast<D>(*get_amxaddr(amx, params[arg]));
llen--;
arg++;
break;
case 'b':
CHECK_ARGS(0);
AddBinary(&buf_p, llen, *get_amxaddr(amx, params[arg]), width, flags);
arg++;
break;
case 'd':
case 'i':
CHECK_ARGS(0);
AddInt(&buf_p, llen, *get_amxaddr(amx, params[arg]), width, flags);
arg++;
break;
case 'u':
CHECK_ARGS(0);
AddUInt(&buf_p, llen, static_cast<unsigned int>(*get_amxaddr(amx, params[arg])), width, flags);
arg++;
break;
case 'f':
CHECK_ARGS(0);
AddFloat(&buf_p, llen, amx_ctof(*get_amxaddr(amx, params[arg])), width, prec, flags);
arg++;
break;
case 'X':
CHECK_ARGS(0);
flags |= UPPERDIGITS;
AddHex(&buf_p, llen, static_cast<unsigned int>(*get_amxaddr(amx, params[arg])), width, flags);
arg++;
break;
case 'x':
CHECK_ARGS(0);
AddHex(&buf_p, llen, static_cast<unsigned int>(*get_amxaddr(amx, params[arg])), width, flags);
arg++;
break;
case 'a':
{
CHECK_ARGS(0);
// %a is passed a pointer directly to a cell string.
cell* ptr=reinterpret_cast<cell*>(*get_amxaddr(amx, params[arg]));
if (!ptr)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid vector string handle provided (%d)", *get_amxaddr(amx, params[arg]));
return 0;
}
AddString(&buf_p, llen, ptr, width, prec);
arg++;
break;
}
case 's':
CHECK_ARGS(0);
AddString(&buf_p, llen, get_amxaddr(amx, params[arg]), width, prec);
arg++;
break;
case 'L':
case 'l':
{
const char *lang;
int len;
if (ch == 'L')
{
CHECK_ARGS(1);
auto currParam = params[arg++];
lang = playerlang(*get_amxaddr(amx, currParam));
if (!lang)
lang = get_amxstring(amx, currParam, 2, len);
}
else
{
CHECK_ARGS(0);
lang = playerlang(g_langMngr.GetDefLang());
}
const char *key = get_amxstring(amx, params[arg++], 3, len);
const char *def = translate(amx, lang, key);
if (!def)
{
static char buf[255];
ke::SafeSprintf(buf, sizeof(buf), "ML_NOTFOUND: %s", key);
def = buf;
}
size_t written = atcprintf(buf_p, llen, def, amx, params, &arg);
buf_p += written;
llen -= written;
break;
}
case 'N':
{
CHECK_ARGS(0);
cell *addr = get_amxaddr(amx, params[arg]);
char buffer[255];
if (*addr)
{
CPlayer *player = NULL;
if (*addr >= 1 && *addr <= gpGlobals->maxClients)
{
player = GET_PLAYER_POINTER_I(*addr);
}
if (!player || !player->initialized)
{
LogError(amx, AMX_ERR_NATIVE, "Client index %d is invalid", *addr);
return 0;
}
const char *auth = GETPLAYERAUTHID(player->pEdict);
if (!auth || auth[0] == '\0')
{
auth = "STEAM_ID_PENDING";
}
int userid = GETPLAYERUSERID(player->pEdict);
ke::SafeSprintf(buffer, sizeof(buffer), "%s<%d><%s><%s>", player->name.chars(), userid, auth, player->team.chars());
}
else
{
ke::SafeSprintf(buffer, sizeof(buffer), "Console<0><Console><Console>");
}
AddString(&buf_p, llen, buffer, width, prec);
arg++;
break;
}
case 'n':
{
CHECK_ARGS(0);
cell *addr = get_amxaddr(amx, params[arg]);
const char *name = "Console";
if (*addr)
{
CPlayer *player = NULL;
if (*addr >= 1 && *addr <= gpGlobals->maxClients)
{
player = GET_PLAYER_POINTER_I(*addr);
}
if (!player || !player->initialized)
{
LogError(amx, AMX_ERR_NATIVE, "Client index %d is invalid", *addr);
return 0;
}
name = player->name.chars();
}
AddString(&buf_p, llen, name, width, prec);
arg++;
break;
}
case '%':
*buf_p++ = static_cast<D>(ch);
if (!llen)
goto done;
llen--;
break;
case '\0':
*buf_p++ = static_cast<D>('%');
if (!llen)
goto done;
llen--;
goto done;
break;
default:
*buf_p++ = static_cast<D>(ch);
if (!llen)
goto done;
llen--;
break;
}
}
done:
*buf_p = static_cast<D>(0);
*param = arg;
/* if max buffer length consumed, make sure we don't truncate a multi-byte character */
if (llen <= 0 && *(buf_p - 1) & 1 << 7)
{
llen += UTIL_CheckValidChar(buf_p - 1);
*(buf_p - llen) = static_cast<D>(0);
}
return maxlen-llen;
}
/**
* HACKHACK: The compiler will generate code for each case we need.
* Don't remove this, otherwise files that use certain code generations
* will have extern problems. For each case you need, add dummy code
* here.
*/
void __WHOA_DONT_CALL_ME_PLZ_K_lol_o_O()
{
//acsprintf
atcprintf((cell *)NULL, 0, (const char *)NULL, NULL, NULL, NULL);
//accprintf
atcprintf((cell *)NULL, 0, (cell *)NULL, NULL, NULL, NULL);
//ascprintf
atcprintf((char *)NULL, 0, (cell *)NULL, NULL, NULL, NULL);
}

20
amxmodx/format.h Normal file
View File

@ -0,0 +1,20 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef _INCLUDE_FORMATTING_H
#define _INCLUDE_FORMATTING_H
//Amx Templatized Cell Printf
template <typename D, typename S>
size_t atcprintf(D *buffer, size_t maxlen, const S *format, AMX *amx, cell *params, int *param);
const char *playerlang(const cell index);
const char *translate(AMX *amx, const char *lang, const char *key);
#endif //_INCLUDE_FORMATTING_H

175
amxmodx/gameconfigs.cpp Normal file
View File

@ -0,0 +1,175 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "gameconfigs.h"
#include "amxmodx.h"
#include "CGameConfigs.h"
NativeHandle<GameConfigNative> GameConfigHandle;
// native GameConfig:LoadGameConfigFile(const file[]);
static cell AMX_NATIVE_CALL LoadGameConfigFile(AMX *amx, cell *params)
{
int length;
const char *filename = get_amxstring(amx, params[1], 0, length);
IGameConfig *config = nullptr;
char error[128];
if (!ConfigManager.LoadGameConfigFile(filename, &config, error, sizeof(error)))
{
ConfigManager.CloseGameConfigFile(config);
LogError(amx, AMX_ERR_NATIVE, "Unable to open %s: %s", filename, error);
return 0;
}
int handle = GameConfigHandle.create();
auto configHandle = GameConfigHandle.lookup(handle);
if (!configHandle)
{
return 0;
}
configHandle->m_config = config;
return handle;
}
// native GameConfGetOffset(GameConfig:handle, const key[]);
static cell AMX_NATIVE_CALL GameConfGetOffset(AMX *amx, cell *params)
{
GameConfigNative *handle = GameConfigHandle.lookup(params[1]);
if (!handle)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid game config handle %d", params[1]);
return 0;
}
int length;
TypeDescription value;
const char *key = get_amxstring(amx, params[2], 0, length);
if (!handle->m_config->GetOffset(key, &value))
{
return -1;
}
return value.fieldOffset;
}
// native GameConfGetClassOffset(GameConfig:handle, const classname[], const key[]);
static cell AMX_NATIVE_CALL GameConfGetClassOffset(AMX *amx, cell *params)
{
GameConfigNative *handle = GameConfigHandle.lookup(params[1]);
if (!handle)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid game config handle %d", params[1]);
return 0;
}
int length;
TypeDescription value;
const char *classname = get_amxstring(amx, params[2], 0, length);
const char *key = get_amxstring(amx, params[3], 1, length);
if (!handle->m_config->GetOffsetByClass(classname, key, &value))
{
return -1;
}
return value.fieldOffset;
}
// native bool:GameConfGetKeyValue(GameConfig:handle, const key[], buffer[], maxlen);
static cell AMX_NATIVE_CALL GameConfGetKeyValue(AMX *amx, cell *params)
{
GameConfigNative *handle = GameConfigHandle.lookup(params[1]);
if (!handle)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid game config handle %d", params[1]);
return 0;
}
int length;
const char *value;
const char *key = get_amxstring(amx, params[2], 0, length);
if (!(value = handle->m_config->GetKeyValue(key)))
{
return 0;
}
set_amxstring_utf8(amx, params[3], value, strlen(value), params[4]);
return 1;
}
// native GameConfGetAddress(GameConfig:handle, const name[]);
static cell AMX_NATIVE_CALL GameConfGetAddress(AMX *amx, cell *params)
{
GameConfigNative *handle = GameConfigHandle.lookup(params[1]);
if (!handle)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid game config handle %d", params[1]);
return 0;
}
int length;
void *value;
const char *key = get_amxstring(amx, params[2], 0, length);
if (!handle->m_config->GetAddress(key, &value))
{
return 0;
}
return reinterpret_cast<cell>(value);
}
// native CloseGameConfigFile(&GameConfig:handle);
static cell AMX_NATIVE_CALL CloseGameConfigFile(AMX *amx, cell *params)
{
cell *address = get_amxaddr(amx, params[1]);
GameConfigNative *handle = GameConfigHandle.lookup(*address);
if (!handle)
{
return 0;
}
if (GameConfigHandle.destroy(*address))
{
*address = 0;
return 1;
}
return 0;
}
AMX_NATIVE_INFO g_GameConfigNatives[] =
{
{ "LoadGameConfigFile" , LoadGameConfigFile },
{ "GameConfGetOffset" , GameConfGetOffset },
{ "GameConfGetClassOffset", GameConfGetClassOffset },
{ "GameConfGetKeyValue" , GameConfGetKeyValue },
{ "GameConfGetAddress" , GameConfGetAddress },
{ "CloseGameConfigFile" , CloseGameConfigFile },
{ nullptr , nullptr }
};

18
amxmodx/gameconfigs.h Normal file
View File

@ -0,0 +1,18 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "IGameConfigs.h"
#include "natives_handles.h"
struct GameConfigNative
{
IGameConfig *m_config;
};
extern NativeHandle<GameConfigNative> GameConfigHandle;

52
amxmodx/helpers-x86.asm Normal file
View File

@ -0,0 +1,52 @@
; vim: set ts=4 sw=4 tw=99 noet ft=nasm:
;
; AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
; Copyright (C) The AMX Mod X Development Team.
;
; This software is licensed under the GNU General Public License, version 3 or higher.
; Additional exceptions apply. For full license details, see LICENSE.txt or visit:
; https://alliedmods.net/amxmodx-license
section .text
global amxx_CpuSupport, _amxx_CpuSupport
amxx_CpuSupport:
_amxx_CpuSupport:
push ebp
mov ebp, esp
push ebx
mov eax, 0
cpuid
cmp eax, 1
jl .fail
mov eax, 1
cpuid
;check if family == 5 or 4
and eax, 0780h ;family mask
shr eax, 7 ;family shift
cmp eax, 5
je .fail
cmp eax, 4
je .fail
;check if CMOV exists
shr edx, 15
and edx, 1
cmp edx, 0
je .fail
mov eax, 1
jmp .end
.fail:
xor eax, eax
.end:
pop ebx
pop ebp
ret

252
amxmodx/libraries.cpp Normal file
View File

@ -0,0 +1,252 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "libraries.h"
#include "sh_list.h"
List<Library *> g_libraries;
bool AddLibrary(const char *name, LibType type, LibSource src, void *parent)
{
if (FindLibrary(name, type))
return false;
Library *lib = new Library;
lib->name = name;
lib->type = type;
lib->src = src;
lib->parent = parent;
g_libraries.push_back(lib);
return true;
}
bool DecodeLibCmdString(const char *str, LibDecoder *dec)
{
if (dec->buffer)
{
free(dec->buffer);
dec->buffer = NULL;
}
if (str[0] != '?')
{
return false;
} else {
str++;
if (*str == 'r')
{
str++;
if (*str == 'c')
dec->cmd = LibCmd_ReqClass;
else if (*str == 'l')
dec->cmd = LibCmd_ReqLib;
else
return false;
str++;
} else if (*str == 'f') {
str++;
dec->cmd = LibCmd_ForceLib;
} else if (*str == 'e') {
str++;
if (*str == 'c')
dec->cmd = LibCmd_ExpectClass;
else if (*str == 'l')
dec->cmd = LibCmd_ExpectLib;
else
return false;
str++;
} else if (*str == 'd') {
str++;
dec->cmd = LibCmd_DefaultLib;
}
if (*str != '_')
return false;
str++;
if (dec->cmd < LibCmd_ExpectLib)
{
dec->buffer = strdup(str);
dec->param1 = dec->buffer;
dec->param2 = NULL;
} else {
dec->buffer = strdup(str);
char *p = strchr(dec->buffer, '_');
while (p && (*(p+1) == '_'))
p = strchr(p+2, '_');
if (!p || !*(p+1))
return false;
*p = '\0';
dec->param1 = dec->buffer;
dec->param2 = p+1;
}
}
return true;
}
size_t AddLibrariesFromString(const char *name, LibType type, LibSource src, void *parent)
{
char buffer[255];
char *ptr, *p, s;
size_t count = 0;
ke::SafeSprintf(buffer, sizeof(buffer), "%s", name);
ptr = buffer;
p = buffer;
while (*p)
{
while (*p && (*p != ','))
p++;
s = *p;
*p = '\0';
if (AddLibrary(ptr, type, src, parent))
count++;
if (!s)
break;
p++;
while (*p && (*p == ','))
p++;
ptr = p;
}
return count;
}
size_t ClearLibraries(LibSource src)
{
List<Library *>::iterator iter;
size_t count = 0;
iter = g_libraries.begin();
while (iter != g_libraries.end())
{
if ( (*iter)->src == src )
{
delete (*iter);
iter = g_libraries.erase(iter);
count++;
} else {
iter++;
}
}
return count;
}
size_t RemoveLibraries(void *parent)
{
List<Library *>::iterator iter;
Library *lib;
size_t count = 0;
iter = g_libraries.begin();
while (iter != g_libraries.end())
{
lib = (*iter);
if (lib->parent == parent)
{
delete (*iter);
iter = g_libraries.erase(iter);
count++;
} else {
iter++;
}
}
return count;
}
bool FindLibrary(const char *name, LibType type)
{
List<Library *>::iterator iter;
Library *lib;
for (iter = g_libraries.begin(); iter != g_libraries.end(); iter++)
{
lib = (*iter);
if (lib->type != type)
continue;
if (strcasecmp(lib->name.chars(), name) == 0)
{
return true;
}
}
return false;
}
LibError RunLibCommand(const LibDecoder *enc)
{
List<Library *>::iterator iter,end;
Library *lib;
iter = g_libraries.begin();
end = g_libraries.end();
if ( (enc->cmd == LibCmd_ReqLib) || (enc->cmd == LibCmd_ReqClass) )
{
LibType expect = LibType_Library;
if (enc->cmd == LibCmd_ReqLib)
expect = LibType_Library;
else if (enc->cmd == LibCmd_ReqClass)
expect = LibType_Class;
/** see if it exists */
for (; iter != end; iter++)
{
lib = (*iter);
if (lib->type != expect)
continue;
if (strcasecmp(lib->name.chars(), enc->param1) == 0)
return LibErr_None;
}
if (expect == LibType_Library)
return LibErr_NoLibrary;
else if (expect == LibType_Class)
return LibErr_NoClass;
return LibErr_NoLibrary;
} else if (enc->cmd == LibCmd_ForceLib) {
if (!LoadModule(enc->param1, PT_ANYTIME, true, true))
{
return LibErr_NoLibrary;
}
} else if ( (enc->cmd == LibCmd_DefaultLib) ||
((enc->cmd == LibCmd_ExpectLib) || (enc->cmd == LibCmd_ExpectClass)) )
{
LibType expect;
if (enc->cmd == LibCmd_ExpectLib)
expect = LibType_Library;
else
expect = LibType_Class;
/** see if it exists */
for (; iter != end; iter++)
{
lib = (*iter);
if (lib->type != expect)
continue;
if (strcasecmp(lib->name.chars(), enc->param1) == 0)
return LibErr_None;
}
if (!LoadModule(enc->param2, PT_ANYTIME, true, true))
{
return LibErr_NoLibrary;
}
return LibErr_None;
}
return LibErr_None;
}

81
amxmodx/libraries.h Normal file
View File

@ -0,0 +1,81 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef _INCLUDE_LIBRARIES_H
#define _INCLUDE_LIBRARIES_H
#include <string.h>
#include "amxmodx.h"
enum LibSource
{
LibSource_Plugin,
LibSource_Module
};
enum LibType
{
LibType_Library,
LibType_Class
};
struct Library
{
ke::AString name;
LibSource src;
LibType type;
void *parent;
};
enum LibCmd
{
LibCmd_ReqLib,
LibCmd_ReqClass,
LibCmd_ForceLib,
LibCmd_ExpectLib,
LibCmd_ExpectClass,
LibCmd_DefaultLib,
};
enum LibError
{
LibErr_None = 0,
LibErr_NoLibrary,
LibErr_NoClass,
};
class LibDecoder
{
public:
LibDecoder() : buffer(NULL)
{
}
~LibDecoder()
{
free(buffer);
buffer = NULL;
param1 = NULL;
param2 = NULL;
}
char *buffer;
char *param1;
char *param2;
LibCmd cmd;
};
bool AddLibrary(const char *name, LibType type, LibSource src, void *parent=NULL);
bool DecodeLibCmdString(const char *str, LibDecoder *cmd);
size_t AddLibrariesFromString(const char *name, LibType type, LibSource src, void *parent=NULL);
size_t ClearLibraries(LibSource src);
LibError RunLibCommand(const LibDecoder *enc);
size_t RemoveLibraries(void *parent);
bool FindLibrary(const char *name, LibType type);
#endif //_INCLUDE_LIBRARIES_H

View File

@ -1,474 +0,0 @@
// MD5.CC - source code for the C++/object oriented translation and
// modification of MD5.
// Translation and modification (c) 1995 by Mordechai T. Abzug
// This translation/ modification is provided "as is," without express or
// implied warranty of any kind.
// The translator/ modifier does not claim (1) that MD5 will do what you think
// it does; (2) that this translation/ modification is accurate; or (3) that
// this software is "merchantible." (Language for this disclaimer partially
// copied from the disclaimer below).
/* based on:
MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
MDDRIVER.C - test driver for MD2, MD4 and MD5
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
#include "md5.h"
#include <assert.h>
#include <string.h>
// MD5 simple initialization method
MD5::MD5(){
init();
}
// MD5 block update operation. Continues an MD5 message-digest
// operation, processing another message block, and updating the
// context.
void MD5::update (uint1 *input, uint4 input_length) {
uint4 input_index, buffer_index;
uint4 buffer_space; // how much space is left in buffer
if (finalized){ // so we can't update!
/*cerr << "MD5::update: Can't update a finalized digest!" << endl;*/
return;
}
// Compute number of bytes mod 64
buffer_index = (unsigned int)((count[0] >> 3) & 0x3F);
// Update number of bits
if ( (count[0] += ((uint4) input_length << 3))<((uint4) input_length << 3) )
count[1]++;
count[1] += ((uint4)input_length >> 29);
buffer_space = 64 - buffer_index; // how much space is left in buffer
// Transform as many times as possible.
if (input_length >= buffer_space) { // ie. we have enough to fill the buffer
// fill the rest of the buffer and transform
memcpy (buffer + buffer_index, input, buffer_space);
transform (buffer);
// now, transform each 64-byte piece of the input, bypassing the buffer
for (input_index = buffer_space; input_index + 63 < input_length;
input_index += 64)
transform (input+input_index);
buffer_index = 0; // so we can buffer remaining
}
else
input_index=0; // so we can buffer the whole input
// and here we do the buffering:
memcpy(buffer+buffer_index, input+input_index, input_length-input_index);
}
// MD5 update for files.
// Like above, except that it works on files (and uses above as a primitive.)
void MD5::update(FILE *file){
unsigned char buffer[1024];
int len;
while (len=fread(buffer, 1, 1024, file))
update(buffer, len);
fclose (file);
}
// MD5 finalization. Ends an MD5 message-digest operation, writing the
// the message digest and zeroizing the context.
void MD5::finalize (){
unsigned char bits[8];
unsigned int index, padLen;
static uint1 PADDING[64]={
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
if (finalized){
/* cerr << "MD5::finalize: Already finalized this digest!" << endl;*/
return;
}
// Save number of bits
encode (bits, count, 8);
// Pad out to 56 mod 64.
index = (uint4) ((count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
update (PADDING, padLen);
// Append length (before padding)
update (bits, 8);
// Store state in digest
encode (digest, state, 16);
// Zeroize sensitive information
memset (buffer, 0, sizeof(*buffer));
finalized=1;
}
MD5::MD5(FILE *file){
init(); // must be called be all constructors
update(file);
finalize ();
}
unsigned char *MD5::raw_digest(){
uint1 *s = new uint1[16];
if (!finalized){
/* cerr << "MD5::raw_digest: Can't get digest if you haven't "<<
"finalized the digest!" <<endl;*/
return ( (unsigned char*) "");
}
memcpy(s, digest, 16);
return s;
}
char *MD5::hex_digest(){
int i;
char *s= new char[33];
if (!finalized){
/* cerr << "MD5::hex_digest: Can't get digest if you haven't "<<
"finalized the digest!" <<endl;*/
return "";
}
for (i=0; i<16; i++)
sprintf(s+i*2, "%02x", digest[i]);
s[32]='\0';
return s;
}
char *MD5::hex_digest(char buffer[33]){
int i;
if (!finalized)
{
/* cerr << "MD5::hex_digest: Can't get digest if you haven't "<<
"finalized the digest!" <<endl;*/
return "";
}
for (i=0; i<16; i++)
sprintf(buffer+i*2, "%02x", digest[i]);
buffer[32]='\0';
return buffer;
}
// PRIVATE METHODS:
void MD5::init(){
finalized=0; // we just started!
// Nothing counted, so count=0
count[0] = 0;
count[1] = 0;
// Load magic initialization constants.
state[0] = 0x67452301;
state[1] = 0xefcdab89;
state[2] = 0x98badcfe;
state[3] = 0x10325476;
}
// Constants for MD5Transform routine.
// Although we could use C++ style constants, defines are actually better,
// since they let us easily evade scope clashes.
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21
// MD5 basic transformation. Transforms state based on block.
void MD5::transform (uint1 block[64]){
uint4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
decode (x, block, 64);
assert(!finalized); // not just a user error, since the method is private
/* Round 1 */
FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
/* Round 2 */
GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
/* Round 3 */
HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
/* Round 4 */
II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
// Zeroize sensitive information.
memset ( (uint1 *) x, 0, sizeof(x));
}
// Encodes input (UINT4) into output (unsigned char). Assumes len is
// a multiple of 4.
void MD5::encode (uint1 *output, uint4 *input, uint4 len) {
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (uint1) (input[i] & 0xff);
output[j+1] = (uint1) ((input[i] >> 8) & 0xff);
output[j+2] = (uint1) ((input[i] >> 16) & 0xff);
output[j+3] = (uint1) ((input[i] >> 24) & 0xff);
}
}
// Decodes input (unsigned char) into output (UINT4). Assumes len is
// a multiple of 4.
void MD5::decode (uint4 *output, uint1 *input, uint4 len){
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((uint4)input[j]) | (((uint4)input[j+1]) << 8) |
(((uint4)input[j+2]) << 16) | (((uint4)input[j+3]) << 24);
}
// Note: Replace "for loop" with standard memcpy if possible.
void MD5::memcpy (uint1 *output, uint1 *input, uint4 len){
unsigned int i;
for (i = 0; i < len; i++)
output[i] = input[i];
}
// Note: Replace "for loop" with standard memset if possible.
void MD5::memset (uint1 *output, uint1 value, uint4 len){
unsigned int i;
for (i = 0; i < len; i++)
output[i] = value;
}
// ROTATE_LEFT rotates x left n bits.
inline unsigned int MD5::rotate_left (uint4 x, uint4 n){
return (x << n) | (x >> (32-n)) ;
}
// F, G, H and I are basic MD5 functions.
inline unsigned int MD5::F (uint4 x, uint4 y, uint4 z){
return (x & y) | (~x & z);
}
inline unsigned int MD5::G (uint4 x, uint4 y, uint4 z){
return (x & z) | (y & ~z);
}
inline unsigned int MD5::H (uint4 x, uint4 y, uint4 z){
return x ^ y ^ z;
}
inline unsigned int MD5::I (uint4 x, uint4 y, uint4 z){
return y ^ (x | ~z);
}
// FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
// Rotation is separate from addition to prevent recomputation.
inline void MD5::FF(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
uint4 s, uint4 ac){
a += F(b, c, d) + x + ac;
a = rotate_left (a, s) +b;
}
inline void MD5::GG(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
uint4 s, uint4 ac){
a += G(b, c, d) + x + ac;
a = rotate_left (a, s) +b;
}
inline void MD5::HH(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
uint4 s, uint4 ac){
a += H(b, c, d) + x + ac;
a = rotate_left (a, s) +b;
}
inline void MD5::II(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
uint4 s, uint4 ac){
a += I(b, c, d) + x + ac;
a = rotate_left (a, s) +b;
}

View File

@ -1,105 +0,0 @@
// MD5.CC - source code for the C++/object oriented translation and
// modification of MD5.
// Translation and modification (c) 1995 by Mordechai T. Abzug
// This translation/ modification is provided "as is," without express or
// implied warranty of any kind.
// The translator/ modifier does not claim (1) that MD5 will do what you think
// it does; (2) that this translation/ modification is accurate; or (3) that
// this software is "merchantible." (Language for this disclaimer partially
// copied from the disclaimer below).
/* based on:
MD5.H - header file for MD5C.C
MDDRIVER.C - test driver for MD2, MD4 and MD5
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
#include <stdio.h>
//#include <fstream.h>
//#include <iostream.h>
class MD5 {
public:
// methods for controlled operation:
MD5 (); // simple initializer
void update (unsigned char *input, unsigned int input_length);
void update (FILE *file);
void finalize ();
// constructors for special circumstances. All these constructors finalize
// the MD5 context.
MD5 (unsigned char *string); // digest string, finalize
MD5 (FILE *file); // digest file, close, finalize
// methods to acquire finalized result
unsigned char *raw_digest (); // digest as a 16-byte binary array
char * hex_digest (); // digest as a 33-byte ascii-hex string
char * hex_digest (char buffer[33]); //same as above, passing buffer
private:
// first, some types:
typedef unsigned int uint4; // assumes integer is 4 words long
typedef unsigned short int uint2; // assumes short integer is 2 words long
typedef unsigned char uint1; // assumes char is 1 word long
// next, the private data:
uint4 state[4];
uint4 count[2]; // number of *bits*, mod 2^64
uint1 buffer[64]; // input buffer
uint1 digest[16];
uint1 finalized;
// last, the private methods, mostly static:
void init (); // called by all constructors
void transform (uint1 *buffer); // does the real update work. Note
// that length is implied to be 64.
static void encode (uint1 *dest, uint4 *src, uint4 length);
static void decode (uint4 *dest, uint1 *src, uint4 length);
static void memcpy (uint1 *dest, uint1 *src, uint4 length);
static void memset (uint1 *start, uint1 val, uint4 length);
static inline uint4 rotate_left (uint4 x, uint4 n);
static inline uint4 F (uint4 x, uint4 y, uint4 z);
static inline uint4 G (uint4 x, uint4 y, uint4 z);
static inline uint4 H (uint4 x, uint4 y, uint4 z);
static inline uint4 I (uint4 x, uint4 y, uint4 z);
static inline void FF (uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
uint4 s, uint4 ac);
static inline void GG (uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
uint4 s, uint4 ac);
static inline void HH (uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
uint4 s, uint4 ac);
static inline void II (uint4& a, uint4 b, uint4 c, uint4 d, uint4 x,
uint4 s, uint4 ac);
};

908
amxmodx/messages.cpp Executable file
View File

@ -0,0 +1,908 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#include "amxmodx.h"
#include "messages.h"
Message Msg;
RegisteredMessage msgHooks[256];
int msgBlocks[256] = {BLOCK_NOT};
int msgDest;
int msgType;
float *msgOrigin;
edict_t *msgpEntity;
bool inhook = false;
bool inblock = false;
enginefuncs_t *g_pEngTable = NULL;
void ClearMessages()
{
for (size_t i=0; i<MAX_MESSAGES; i++)
{
msgHooks[i].Clear();
msgBlocks[i] = BLOCK_NOT;
}
}
Message::Message()
{
m_CurParam = 0;
}
bool Message::Ready()
{
if (!m_Params.length())
return false;
return true;
}
void Message::Init()
{
if (!Ready())
{
msgparam *p = new msgparam;
m_Params.append(p);
}
m_CurParam = 0;
}
Message::~Message()
{
for (size_t i=0; i<m_Params.length(); i++)
delete m_Params[i];
m_Params.clear();
}
msgparam *Message::AdvPtr()
{
msgparam *pParam = NULL;
if (++m_CurParam >= m_Params.length())
{
pParam = new msgparam;
m_Params.append(pParam);
} else {
pParam = m_Params[m_CurParam];
}
return pParam;
}
void Message::AddParam(const char *data, msgtype type)
{
msgparam *pParam = AdvPtr();
pParam->szData = data;
pParam->type = type;
}
void Message::AddParam(int data, msgtype type)
{
msgparam *pParam = AdvPtr();
pParam->v.iData = data;
pParam->type = type;
}
void Message::AddParam(float data, msgtype type)
{
msgparam *pParam = AdvPtr();
pParam->v.fData = data;
pParam->type = type;
}
msgtype Message::GetParamType(size_t index)
{
if (index < 1 || index > m_CurParam)
return static_cast<msgtype>(0);
return m_Params[index]->type;
}
float Message::GetParamFloat(size_t index)
{
if (index < 1 || index > m_CurParam)
return 0;
return m_Params[index]->v.fData;
}
const char *Message::GetParamString(size_t index)
{
if (index < 1 || index > m_CurParam)
return 0;
return m_Params[index]->szData.chars();
}
int Message::GetParamInt(size_t index)
{
if (index < 1 || index > m_CurParam)
return 0;
return m_Params[index]->v.iData;
}
void Message::SetParam(size_t index, float data)
{
if (index < 1 || index > m_CurParam)
return;
m_Params[index]->v.fData = data;
}
void Message::SetParam(size_t index, int data)
{
if (index < 1 || index > m_CurParam)
return;
m_Params[index]->v.iData = data;
}
void Message::SetParam(size_t index, const char *data)
{
if (index < 1 || index > m_CurParam)
return;
m_Params[index]->szData = data;
}
void Message::Reset()
{
m_CurParam = 0;
}
size_t Message::Params()
{
return m_CurParam;
}
void Message::Send()
{
msgparam *pParam = NULL;
for (size_t i=1; i<=m_CurParam; i++)
{
pParam = m_Params[i];
switch (pParam->type)
{
case arg_byte:
WRITE_BYTE(pParam->v.iData);
break;
case arg_char:
WRITE_CHAR(pParam->v.iData);
break;
case arg_short:
WRITE_SHORT(pParam->v.iData);
break;
case arg_long:
WRITE_LONG(pParam->v.iData);
break;
case arg_angle:
WRITE_ANGLE(pParam->v.fData);
break;
case arg_coord:
WRITE_COORD(pParam->v.fData);
break;
case arg_string:
WRITE_STRING(pParam->szData.chars());
break;
case arg_entity:
WRITE_ENTITY(pParam->v.iData);
break;
}
}
}
void C_MessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
{
if (msgBlocks[msg_type])
{
inblock = true;
msgType = msg_type;
RETURN_META(MRES_SUPERCEDE);
} else if (msgHooks[msg_type].Hooked()) {
inhook = true;
msgDest = msg_dest;
msgType = msg_type;
msgOrigin = (float *)pOrigin;
msgpEntity = ed;
RETURN_META(MRES_SUPERCEDE);
}
RETURN_META(MRES_IGNORED);
}
void C_WriteByte(int iValue)
{
if (inblock)
{
RETURN_META(MRES_SUPERCEDE);
} else if (inhook) {
Msg.AddParam(iValue, arg_byte);
RETURN_META(MRES_SUPERCEDE);
}
RETURN_META(MRES_IGNORED);
}
void C_WriteChar(int iValue)
{
if (inblock)
{
RETURN_META(MRES_SUPERCEDE);
} else if (inhook) {
Msg.AddParam(iValue, arg_char);
RETURN_META(MRES_SUPERCEDE);
}
RETURN_META(MRES_IGNORED);
}
void C_WriteShort(int iValue)
{
if (inblock)
{
RETURN_META(MRES_SUPERCEDE);
} else if (inhook) {
Msg.AddParam(iValue, arg_short);
RETURN_META(MRES_SUPERCEDE);
}
RETURN_META(MRES_IGNORED);
}
void C_WriteLong(int iValue)
{
if (inblock)
{
RETURN_META(MRES_SUPERCEDE);
} else if (inhook) {
Msg.AddParam(iValue, arg_long);
RETURN_META(MRES_SUPERCEDE);
}
RETURN_META(MRES_IGNORED);
}
void C_WriteAngle(float flValue)
{
if (inblock)
{
RETURN_META(MRES_SUPERCEDE);
} else if (inhook) {
Msg.AddParam(flValue, arg_angle);
RETURN_META(MRES_SUPERCEDE);
}
RETURN_META(MRES_IGNORED);
}
void C_WriteCoord(float flValue)
{
if (inblock)
{
RETURN_META(MRES_SUPERCEDE);
} else if (inhook) {
Msg.AddParam(flValue, arg_coord);
RETURN_META(MRES_SUPERCEDE);
}
RETURN_META(MRES_IGNORED);
}
void C_WriteString(const char *sz)
{
if (inblock)
{
RETURN_META(MRES_SUPERCEDE);
} else if (inhook) {
Msg.AddParam(sz, arg_string);
RETURN_META(MRES_SUPERCEDE);
}
RETURN_META(MRES_IGNORED);
}
void C_WriteEntity(int iValue)
{
if (inblock)
{
RETURN_META(MRES_SUPERCEDE);
} else if (inhook) {
Msg.AddParam(iValue, arg_entity);
RETURN_META(MRES_SUPERCEDE);
}
RETURN_META(MRES_IGNORED);
}
void C_MessageEnd(void)
{
int mres = 0;
if (inblock)
{
inblock = false;
if (msgBlocks[msgType] == BLOCK_ONCE)
{
msgBlocks[msgType] = BLOCK_NOT;
}
RETURN_META(MRES_SUPERCEDE);
} else if (inhook) {
mres = msgHooks[msgType].Execute((cell)msgType, (cell)msgDest, (cell)ENTINDEX(msgpEntity));
/*
for (i=0; i<msgHooks[msgType].size(); i++)
{
mresB = executeForwards(msgHooks[msgType].at(i), (cell)msgType, (cell)msgDest, (cell)ENTINDEX(msgpEntity));
if (mresB > mres)
mres = mresB;
}
*/
inhook = false;
if (mres & 1)
{
Msg.Reset();
RETURN_META(MRES_SUPERCEDE);
}
/* send the real message */
MESSAGE_BEGIN(msgDest, msgType, msgOrigin, msgpEntity);
Msg.Send();
MESSAGE_END();
/* reset */
Msg.Reset();
RETURN_META(MRES_SUPERCEDE);
}
RETURN_META(MRES_IGNORED);
}
static cell _message_begin(AMX *amx, cell *params, bool useFloat) /* 4 param */
{
int numparam = *params / sizeof(cell);
float vecOrigin[3];
cell *cpOrigin;
if (params[2] < 1 || ((params[2] > 63) // maximal number of engine messages
&& !GET_USER_MSG_NAME(PLID, params[2], NULL)))
{
LogError(amx, AMX_ERR_NATIVE, "Plugin called message_begin with an invalid message id (%d).", params[2]);
return 0;
}
switch (params[1])
{
case MSG_BROADCAST:
case MSG_ALL:
case MSG_SPEC:
case MSG_INIT:
MESSAGE_BEGIN(params[1], params[2], NULL);
break;
case MSG_PVS: case MSG_PAS:
case MSG_PVS_R: case MSG_PAS_R:
if (numparam < 3)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid number of parameters passed");
return 0;
}
cpOrigin = get_amxaddr(amx, params[3]);
if (!useFloat)
{
vecOrigin[0] = static_cast<float>(*cpOrigin);
vecOrigin[1] = static_cast<float>(*(cpOrigin + 1));
vecOrigin[2] = static_cast<float>(*(cpOrigin + 2));
} else {
vecOrigin[0] = amx_ctof(*cpOrigin);
vecOrigin[1] = amx_ctof(*(cpOrigin + 1));
vecOrigin[2] = amx_ctof(*(cpOrigin + 2));
}
MESSAGE_BEGIN(params[1], params[2], vecOrigin);
break;
case MSG_ONE_UNRELIABLE:
case MSG_ONE:
if (numparam < 4)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid number of parameters passed");
return 0;
}
MESSAGE_BEGIN(params[1], params[2], NULL, TypeConversion.id_to_edict(params[4]));
break;
}
return 1;
}
static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */
{
return _message_begin(amx, params, false);
}
static cell AMX_NATIVE_CALL message_begin_f(AMX *amx, cell *params) /* 4 param */
{
return _message_begin(amx, params, true);
}
static cell AMX_NATIVE_CALL message_end(AMX *amx, cell *params)
{
MESSAGE_END();
return 1;
}
static cell AMX_NATIVE_CALL write_byte(AMX *amx, cell *params) /* 1 param */
{
WRITE_BYTE(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_char(AMX *amx, cell *params) /* 1 param */
{
WRITE_CHAR(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_short(AMX *amx, cell *params) /* 1 param */
{
WRITE_SHORT(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_long(AMX *amx, cell *params) /* 1 param */
{
WRITE_LONG(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_entity(AMX *amx, cell *params) /* 1 param */
{
WRITE_ENTITY(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL write_angle(AMX *amx, cell *params) /* 1 param */
{
WRITE_ANGLE(static_cast<float>(params[1]));
return 1;
}
static cell AMX_NATIVE_CALL write_angle_f(AMX *amx, cell *params) /* 1 param */
{
WRITE_ANGLE(amx_ctof(params[1]));
return 1;
}
static cell AMX_NATIVE_CALL write_coord(AMX *amx, cell *params) /* 1 param */
{
WRITE_COORD(static_cast<float>(params[1]));
return 1;
}
static cell AMX_NATIVE_CALL write_coord_f(AMX *amx, cell *params) /* 1 param */
{
WRITE_COORD(amx_ctof(params[1]));
return 1;
}
static cell AMX_NATIVE_CALL write_string(AMX *amx, cell *params) /* 1 param */
{
int a;
WRITE_STRING(get_amxstring(amx, params[1], 3, a));
return 1;
}
static cell AMX_NATIVE_CALL register_message(AMX *amx, cell *params)
{
int len;
char *name = get_amxstring(amx, params[2], 0, len);
if (!Msg.Ready())
Msg.Init();
if (params[1]>0 && params[1] < 256)
{
int id = registerSPForwardByName(amx, name, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
if (id != -1)
{
msgHooks[params[1]].AddHook(id);
return id;
} else {
LogError(amx, AMX_ERR_NOTFOUND, "Could not find function \"%s\"", name);
return -1;
}
}
return 0;
}
// unregister_message(msgid, msghandle)
static cell AMX_NATIVE_CALL unregister_message(AMX *amx, cell *params)
{
if (!Msg.Ready())
Msg.Init();
if (params[1]>0 && params[1] < 256)
{
int id = params[2];
if (id != -1)
{
msgHooks[params[1]].RemoveHook(id);
return id;
} else {
LogError(amx, AMX_ERR_NOTFOUND, "Invalid registered message handle");
return -1;
}
}
return 0;
}
static cell AMX_NATIVE_CALL set_msg_block(AMX *amx, cell *params)
{
int msgid = params[1];
int block = params[2];
if (msgid < 1 || msgid > 255)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid message id");
return 0;
}
msgBlocks[msgid] = block;
return 1;
}
static cell AMX_NATIVE_CALL get_msg_block(AMX *amx, cell *params)
{
int msgid = params[1];
if (msgid < 1 || msgid > 255)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid message id");
return 0;
}
return msgBlocks[msgid];
}
static cell AMX_NATIVE_CALL get_msg_args(AMX *amx, cell *params)
{
return Msg.Params();
}
static cell AMX_NATIVE_CALL get_msg_argtype(AMX *amx, cell *params)
{
size_t argn = static_cast<size_t>(params[1]);
if (!inhook || argn > Msg.Params())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid message argument %d", argn);
return 0;
}
return Msg.GetParamType(argn);
}
static cell AMX_NATIVE_CALL get_msg_arg_int(AMX *amx, cell *params)
{
size_t argn = static_cast<size_t>(params[1]);
if (!inhook || argn > Msg.Params())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid message argument %d", argn);
return 0;
}
return Msg.GetParamInt(argn);
}
static cell AMX_NATIVE_CALL set_msg_arg_int(AMX *amx, cell *params)
{
size_t argn = static_cast<size_t>(params[1]);
if (!inhook || argn > Msg.Params())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid message argument %d", argn);
return 0;
}
Msg.SetParam(argn, (int)params[3]);
return 1;
}
static cell AMX_NATIVE_CALL get_msg_arg_float(AMX *amx, cell *params)
{
size_t argn = static_cast<size_t>(params[1]);
if (!inhook || argn > Msg.Params())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid message argument %d", argn);
return 0;
}
REAL f = (REAL)Msg.GetParamFloat(argn);
return amx_ftoc(f);
}
static cell AMX_NATIVE_CALL set_msg_arg_float(AMX *amx, cell *params)
{
size_t argn = static_cast<size_t>(params[1]);
if (!inhook || argn > Msg.Params())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid message argument %d", argn);
return 0;
}
REAL fVal = amx_ctof(params[3]);
Msg.SetParam(argn, (float)fVal);
return 1;
}
static cell AMX_NATIVE_CALL get_msg_arg_string(AMX *amx, cell *params)
{
size_t argn = static_cast<size_t>(params[1]);
if (!inhook || argn > Msg.Params())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid message argument %d", argn);
return 0;
}
const char *szVal = Msg.GetParamString(argn);
return set_amxstring(amx, params[2], szVal, params[3]);
}
static cell AMX_NATIVE_CALL set_msg_arg_string(AMX *amx, cell *params)
{
size_t argn = static_cast<size_t>(params[1]);
int iLen;
if (!inhook || argn > Msg.Params())
{
LogError(amx, AMX_ERR_NATIVE, "Invalid message argument %d", argn);
return 0;
}
char *szVal = get_amxstring(amx, params[2], 0, iLen);
Msg.SetParam(argn, szVal);
return 1;
}
static cell AMX_NATIVE_CALL get_msg_origin(AMX *amx, cell *params)
{
if (!inhook)
{
LogError(amx, AMX_ERR_NATIVE, "Not in a message hook");
return 0;
}
cell *cAddr = get_amxaddr(amx, params[1]);
if (msgDest >= MSG_PVS && msgDest <= MSG_PAS_R)
{
vec3_t vRet = (Vector)msgOrigin;
cAddr[0] = FloatToCell(vRet.x);
cAddr[1] = FloatToCell(vRet.y);
cAddr[2] = FloatToCell(vRet.z);
} else {
cAddr[0] = 0;
cAddr[1] = 0;
cAddr[2] = 0;
}
return 1;
}
static cell _emessage_begin(AMX *amx, cell *params, bool useFloat)
{
int numparam = *params / sizeof(cell);
float vecOrigin[3];
cell *cpOrigin;
if (params[2] < 1 || ((params[2] > 63) // maximal number of engine messages
&& !GET_USER_MSG_NAME(PLID, params[2], NULL)))
{
LogError(amx, AMX_ERR_NATIVE, "Plugin called message_begin with an invalid message id (%d).", params[2]);
return 0;
}
switch (params[1])
{
case MSG_BROADCAST:
case MSG_ALL:
case MSG_SPEC:
g_pEngTable->pfnMessageBegin(params[1], params[2], NULL, NULL);
break;
case MSG_PVS: case MSG_PAS:
case MSG_PVS_R: case MSG_PAS_R:
if (numparam < 3)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid number of parameters passed");
return 0;
}
cpOrigin = get_amxaddr(amx, params[3]);
if (!useFloat)
{
vecOrigin[0] = static_cast<float>(*cpOrigin);
vecOrigin[1] = static_cast<float>(*(cpOrigin + 1));
vecOrigin[2] = static_cast<float>(*(cpOrigin + 2));
} else {
vecOrigin[0] = amx_ctof(*cpOrigin);
vecOrigin[1] = amx_ctof(*(cpOrigin + 1));
vecOrigin[2] = amx_ctof(*(cpOrigin + 2));
}
g_pEngTable->pfnMessageBegin(params[1], params[2], vecOrigin, NULL);
break;
case MSG_ONE_UNRELIABLE:
case MSG_ONE:
if (numparam < 4)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid number of parameters passed");
return 0;
}
g_pEngTable->pfnMessageBegin(params[1], params[2], NULL, TypeConversion.id_to_edict(params[4]));
break;
}
return 1;
}
static cell AMX_NATIVE_CALL emessage_begin(AMX *amx, cell *params) /* 4 param */
{
return _emessage_begin(amx, params, false);
}
static cell AMX_NATIVE_CALL emessage_begin_f(AMX *amx, cell *params) /* 4 param */
{
return _emessage_begin(amx, params, true);
}
static cell AMX_NATIVE_CALL emessage_end(AMX *amx, cell *params)
{
g_pEngTable->pfnMessageEnd();
return 1;
}
static cell AMX_NATIVE_CALL ewrite_byte(AMX *amx, cell *params) /* 1 param */
{
g_pEngTable->pfnWriteByte(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL ewrite_char(AMX *amx, cell *params) /* 1 param */
{
g_pEngTable->pfnWriteChar(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL ewrite_short(AMX *amx, cell *params) /* 1 param */
{
g_pEngTable->pfnWriteShort(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL ewrite_long(AMX *amx, cell *params) /* 1 param */
{
g_pEngTable->pfnWriteLong(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL ewrite_entity(AMX *amx, cell *params) /* 1 param */
{
g_pEngTable->pfnWriteEntity(params[1]);
return 1;
}
static cell AMX_NATIVE_CALL ewrite_angle(AMX *amx, cell *params) /* 1 param */
{
g_pEngTable->pfnWriteAngle(static_cast<float>(params[1]));
return 1;
}
static cell AMX_NATIVE_CALL ewrite_angle_f(AMX *amx, cell *params) /* 1 param */
{
g_pEngTable->pfnWriteAngle(amx_ctof(params[1]));
return 1;
}
static cell AMX_NATIVE_CALL ewrite_coord(AMX *amx, cell *params) /* 1 param */
{
g_pEngTable->pfnWriteCoord(static_cast<float>(params[1]));
return 1;
}
static cell AMX_NATIVE_CALL ewrite_coord_f(AMX *amx, cell *params) /* 1 param */
{
g_pEngTable->pfnWriteCoord(amx_ctof(params[1]));
return 1;
}
static cell AMX_NATIVE_CALL ewrite_string(AMX *amx, cell *params) /* 1 param */
{
int a;
g_pEngTable->pfnWriteString(get_amxstring(amx, params[1], 3, a));
return 1;
}
AMX_NATIVE_INFO msg_Natives[] =
{
{"message_begin", message_begin},
{"message_begin_f", message_begin_f},
{"message_end", message_end},
{"write_angle", write_angle},
{"write_angle_f", write_angle_f},
{"write_byte", write_byte},
{"write_char", write_char},
{"write_coord", write_coord},
{"write_coord_f", write_coord_f},
{"write_entity", write_entity},
{"write_long", write_long},
{"write_short", write_short},
{"write_string", write_string},
{"register_message", register_message},
{"unregister_message", unregister_message},
{"set_msg_block", set_msg_block},
{"get_msg_block", get_msg_block},
{"get_msg_args", get_msg_args},
{"get_msg_argtype", get_msg_argtype},
{"get_msg_arg_int", get_msg_arg_int},
{"set_msg_arg_int", set_msg_arg_int},
{"get_msg_arg_float", get_msg_arg_float},
{"set_msg_arg_float", set_msg_arg_float},
{"get_msg_arg_string", get_msg_arg_string},
{"set_msg_arg_string", set_msg_arg_string},
{"get_msg_origin", get_msg_origin},
{"emessage_begin", emessage_begin},
{"emessage_begin_f", emessage_begin_f},
{"emessage_end", emessage_end},
{"ewrite_angle", ewrite_angle},
{"ewrite_angle_f", ewrite_angle_f},
{"ewrite_byte", ewrite_byte},
{"ewrite_char", ewrite_char},
{"ewrite_coord", ewrite_coord},
{"ewrite_coord_f", ewrite_coord_f},
{"ewrite_entity", ewrite_entity},
{"ewrite_long", ewrite_long},
{"ewrite_short", ewrite_short},
{"ewrite_string", ewrite_string},
{NULL, NULL},
};

216
amxmodx/messages.h Executable file
View File

@ -0,0 +1,216 @@
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
#ifndef _MSGS_INCLUDE_H
#define _MSGS_INCLUDE_H
#include <extdll.h>
#include <meta_api.h>
#include "amx.h"
#include "sh_stack.h"
#define MAX_MESSAGES 255
#define MSGBLOCK_SET 0
#define MSGBLOCK_GET 1
#define BLOCK_NOT 0
#define BLOCK_ONCE 1
#define BLOCK_SET 2
class RegisteredMessage
{
private:
ke::Vector<int> m_Forwards;
CStack<int> m_InExecution;
bool m_Cleanup;
public:
RegisteredMessage() : m_Cleanup(false) { }
~RegisteredMessage() { this->Clear(); }
void AddHook(int fwd)
{
m_Forwards.append(fwd);
}
bool RemoveHook(int fwd)
{
// Don't erase a forward if we're in the middle of execution; this
// could throw off the iterator that is going through the forwards
// and executing them. Instead, unregister the forward and set it
// to -1 from within the vector.
if (m_InExecution.size())
{
this->m_Cleanup = true;
for (size_t i = 0; i < m_Forwards.length(); ++i)
{
int& forward = m_Forwards[i];
if (forward == fwd)
{
if (forward != -1)
{
unregisterSPForward(forward);
}
forward = -1;
return true;
}
}
}
else
{
for (size_t i = 0; i < m_Forwards.length(); ++i)
{
int forward = m_Forwards[i];
if (forward == fwd)
{
if (forward != -1)
{
unregisterSPForward(forward);
m_Forwards.remove(forward);
return true;
}
else
{
// -1 could be in here more than once
m_Forwards.remove(forward);
}
}
}
}
return false;
}
void Clear()
{
while (m_InExecution.size())
{
m_InExecution.pop();
}
for (size_t i = 0; i < m_Forwards.length(); i++)
{
int fwd = m_Forwards[i];
if (fwd != -1)
{
unregisterSPForward(m_Forwards[i]);
}
}
m_Forwards.clear();
}
cell Execute(cell type, cell dest, cell entity)
{
m_InExecution.push(1);
cell res = 0;
cell thisres = 0;
for (size_t i = 0; i < m_Forwards.length(); i++)
{
int fwd = m_Forwards[i];
if (fwd != -1)
{
thisres = executeForwards(fwd, type, dest, entity);
if (thisres > res)
{
res = thisres;
}
}
}
m_InExecution.pop();
if (m_InExecution.size() == 0 && m_Cleanup)
{
this->RemoveHook(-1);
}
return res;
}
bool Hooked() const
{
return m_Forwards.length() != 0;
}
};
enum msgtype
{
arg_byte = 1,
arg_char,
arg_short,
arg_long,
arg_angle,
arg_coord,
arg_string,
arg_entity,
};
struct msgparam
{
msgtype type;
union
{
REAL fData;
int iData;
} v;
ke::AString szData;
};
class Message
{
public:
Message();
~Message();
void AddParam(float data, msgtype type);
void AddParam(int data, msgtype type);
void AddParam(const char *data, msgtype type);
void SetParam(size_t index, float data);
void SetParam(size_t index, int data);
void SetParam(size_t index, const char *data);
const char *GetParamString(size_t index);
float GetParamFloat(size_t index);
bool Ready();
void Init();
int GetParamInt(size_t index);
msgtype GetParamType(size_t index);
void Reset();
void Send();
size_t Params();
private:
msgparam *AdvPtr();
private:
ke::Vector<msgparam *> m_Params;
size_t m_CurParam;
};
void C_MessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
void C_WriteByte(int iValue);
void C_WriteChar(int iValue);
void C_WriteShort(int iValue);
void C_WriteLong(int iValue);
void C_WriteAngle(float flValue);
void C_WriteCoord(float flValue);
void C_WriteString(const char *sz);
void C_WriteEntity(int iValue);
void C_MessageEnd(void);
extern RegisteredMessage msgHooks[256];
extern int msgBlocks[256];
void ClearMessages();
#endif //_MSGS_INCLUDE_H

Some files were not shown because too many files have changed in this diff Show More