634 Commits

Author SHA1 Message Date
6c6f7f499c Tagged 1.01 2006-07-20 04:08:43 +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
95b638dbcd sync 2004-09-20 03:53:01 +00:00
c42fef6d48 *** empty log message *** 2004-09-20 01:26:31 +00:00
d60d19a3d7 Added amx_banip and removed id/ip to banning easier. 2004-09-19 23:58:15 +00:00
3f1c730863 changed amx_ban/amx_banip to only require 3 args 2004-09-19 23:44:48 +00:00
89f5a45e1d added amx_banip and removed id/ip from amx_ban 2004-09-19 23:41:04 +00:00
2b2149b643 Initial import from base package. (no changes) 2004-09-19 23:07:53 +00:00
f074af039b (>'.')------P(x_@<) 2004-09-19 22:01:23 +00:00
30ec1eec60 fixed meta result error in player prethink 2004-09-19 19:44:47 +00:00
0e279c5bc9 change [UnStuck] to [AMXX] 2004-09-19 18:05:13 +00:00
525dfceb1d added unstuck cvar 2004-09-19 17:34:02 +00:00
83fa1aea27 *** empty log message *** 2004-09-19 17:32:55 +00:00
6e3f2f9616 added unstuck.amxx 2004-09-19 17:31:22 +00:00
6a77edfa97 Added full HUD stats option again 2004-09-19 17:30:36 +00:00
b24f44896c New plugin to allow players to un stick themselves. 2004-09-19 17:29:08 +00:00
e23726ac54 added amx_strtok for jtp10181 2004-09-19 17:25:51 +00:00
fb2be2256f added amx_strtok for jtp10181 2004-09-19 17:20:14 +00:00
1ef7f8dd72 new defaults 2004-09-19 16:47:18 +00:00
4008743091 Fixed GetPlayerTeam 2004-09-19 16:43:55 +00:00
bff11bc18e Fixed method of illegal buying 2004-09-19 16:32:15 +00:00
6ada631aaf added commenting for ACCESS_H ns commands 2004-09-19 16:06:25 +00:00
9042efd195 Synced 2004-09-19 15:22:50 +00:00
04b88c16a9 many changes , bomb countdown fix, custom_weapon_add fix, bomb damage support in death,damage forwards, added gasnades plugin with custom weapon support so gas damage/kills will be detected by csstats. 2004-09-19 09:51:05 +00:00
1c6636b106 Fixed bug where memory allocated for FP_ARRAY parameters was not released. 2004-09-19 09:32:52 +00:00
a6a03bf51e added comments for new plugins 2004-09-19 01:31:34 +00:00
b05cf94a23 added nscommands.amxx 2004-09-19 01:29:35 +00:00
b641192e73 NS commands by sawce 2004-09-19 01:28:38 +00:00
d14c107db1 Fixed some include bugs
Fixed adminslots not showing right slots on connect
Fixed RTEs on wrong team
2004-09-19 00:52:15 +00:00
2e24077b77 Added idle kicker 2004-09-19 00:41:47 +00:00
d819c76024 Fixed formatting bugs 2004-09-19 00:37:58 +00:00
89b5496dfb New alignment (y0shi) 2004-09-19 00:33:50 +00:00
de44b4382a Added idle kicker cvars 2004-09-19 00:27:06 +00:00
c71fc25a9d New plugin, it kicks those damn idle players. 2004-09-19 00:03:23 +00:00
5527afc91e Added MF_Prepare*ArrayA functions
The MF_Prepare*ArrayA functions have a third "bool copyBack" parameter which defaults to false and specifies whether the array should be copied from plugin space to module space after function execution (=whether the original array should be updated)
The MF_Prepare*Array are equivalent to MF_Prepare*ArrayA(ptr, size, false);
2004-09-18 16:54:04 +00:00
47eb690a89 disabled fun module (only telemenu uses it) enabled ns module (required for amx_slay) 2004-09-18 14:03:35 +00:00
bb662770e0 Removed the statscfg plugin from base package. 2004-09-18 13:41:53 +00:00
4d04072672 Added MF_Prepare*ArrayA functions
The MF_Prepare*ArrayA functions have a third "bool copyBack" parameter which defaults to false and specifies whether the array should be copied from plugin space to module space after function execution (=whether the original array should be updated)
The MF_Prepare*Array are equivalent to MF_Prepare*ArrayA(ptr, size, false);
2004-09-18 13:37:46 +00:00
4c00d8b95d Changes were merged into the base package so this version is no longer required. 2004-09-18 13:35:07 +00:00
f828e1c8a0 small changes 2004-09-18 13:34:39 +00:00
34abaa1d56 The prepare*Array functions now have a third "bool copyBack" parameter which defaults to false and specifies whether the array should be copied from plugin space to core / module space after function execution (=whether the original array should be updated) 2004-09-18 13:33:21 +00:00
768ea7519f get_info_keybuffer() now works in client_authorized 2004-09-18 13:14:20 +00:00
3eed3b7f07 Removed CString references 2004-09-18 05:39:14 +00:00
3419aa4dc5 Fix for isspace 2004-09-17 19:04:44 +00:00
54a00466e8 debug mode default 2004-09-17 19:00:11 +00:00
5133915e9c Fixed crashbug in get_module: if a not-new-api or bad-file module didn't load, it crashed 2004-09-17 18:33:15 +00:00
895948ca45 fixed bug where 'v' was considered a whitespace character 2004-09-17 18:32:00 +00:00
d0c51bd637 Removed compact encoding - fixes compaction errors on OP_FILE 2004-09-17 18:21:49 +00:00
2e028ebe20 new compile script from malex 2004-09-17 06:11:14 +00:00
26349730e5 Fixed locking issue with lang files 2004-09-17 01:59:27 +00:00
c0374c5fe5 COFF fix 2004-09-17 01:26:42 +00:00
ab2794d4bd Fixed files not fclose()ing
Module no longer reloads on mapchange
2004-09-17 01:19:03 +00:00
e0af113cac Fixed bug reported by kexz 2004-09-17 00:51:20 +00:00
f9a57a83a0 Changed how plugins.ini is read 2004-09-17 00:46:33 +00:00
b7c0c47c05 New "debug" status for amxx plugins.
Correctly switches between amx_opcodelist and nodebug.
Fixed metamod and amxmodx GPL alignment.
Fixed debug mode not being set for non-JIT.
2004-09-17 00:27:28 +00:00
2d9ec5295d Synced translations 2004-09-16 22:43:51 +00:00
b3f01faf38 Message if menu is disabled 2004-09-16 22:39:07 +00:00
58578690ad Fixed server_changelevel (fsfod)
Added dod deathmsg stock (Pimp_Daddy)
2004-09-16 22:35:12 +00:00
4754ccdd1d Removed co_rebirth (Emanon) 2004-09-16 22:33:55 +00:00
f6facb5349 Removed old code 2004-09-16 22:15:07 +00:00
1728c02561 Added debug info to OP_RETN in JIT 2004-09-16 22:14:05 +00:00
c90d922443 Added some notes about how the JIT works 2004-09-16 20:31:38 +00:00
2f1de39dd3 JIT's OP_CALL now supports a debug hook 2004-09-16 20:08:11 +00:00
ec5f944c03 added csx module 2004-09-16 18:15:20 +00:00
d43807a248 Added get_string() to engine:
/* Converts a string offset into a real string. Some of the forwards in fakemeta
   uses string offsets. (FM_CreateNamedEntity) */
native get_string(_string, _returnString[], _len);
2004-09-16 11:02:51 +00:00
1980c524d3 fix 2004-09-16 02:42:40 +00:00
31604d44a8 exported debug engine 2004-09-15 21:34:06 +00:00
dba30f7ee6 Exported error logger to modules 2004-09-15 21:28:20 +00:00
1aaf540be4 converted core to new debugging engine 2004-09-15 21:27:35 +00:00
d3751054da New debugging engine 2004-09-15 21:21:46 +00:00
0c2dbdbc47 Minor check in get_tr added 2004-09-15 18:55:30 +00:00
1485014229 Fixed traceresults and trace hooks.. 2004-09-15 18:40:18 +00:00
0ea68c81dc test dlls 2004-09-15 16:09:58 +00:00
8fbbda13c6 added FNullEntity check 2004-09-15 15:17:52 +00:00
a96d26d573 *** empty log message *** 2004-09-15 08:33:39 +00:00
fb7d1c0a7d fixed wrong kills and deaths number 2004-09-15 08:25:07 +00:00
d7d8ba1398 no message 2004-09-15 07:31:53 +00:00
36c78421ae OP_FILE is now always generated 2004-09-15 05:42:33 +00:00
083fe35188 New AMX headers 2004-09-15 04:18:35 +00:00
9e4a611b7f Removed old debugging engine 2004-09-15 04:09:47 +00:00
4ed906248d Fixed traceresults (Freecode) 2004-09-14 23:39:22 +00:00
44bb871f7e amx_debug is now set correctly. 2004-09-14 19:27:55 +00:00
c1a138f370 Experimentally changed back to old g_initialized method 2004-09-14 19:01:44 +00:00
569ef4d494 fix for tracelien forward 2004-09-14 18:02:32 +00:00
26465afbf7 Fixed cs_set_hostage_follow for amd64 2004-09-14 17:57:34 +00:00
e287a2f202 fixed "BACK" : "EXIT" format bug 2004-09-14 17:04:19 +00:00
91decabfde Added MNF_GetPlayerTeam for mahnsawce 2004-09-14 16:18:52 +00:00
9a21e3e9d3 Removed some debugging output 2004-09-14 15:41:55 +00:00
60940512e2 Fixed amd64 offsets... cs_get_hostage_follow works, cs_set_hostage_follow doesn't yet :-( 2004-09-14 09:58:45 +00:00
d4e69d97e0 Added amd64 offsets. They aren't 100% tested to work (but should work...) 2004-09-14 09:35:52 +00:00
f171842cf8 added traceresult stuff 2004-09-14 06:16:52 +00:00
3d9bf8bc93 Fixed modules.ini (EKS) 2004-09-13 20:01:41 +00:00
d7325f4209 amx_logging -> amxx_logging 2004-09-13 16:42:28 +00:00
5c177aada0 fixed -o bug 2004-09-13 14:40:59 +00:00
5c6289e1f0 Fixed -o bug 2004-09-13 14:18:08 +00:00
844fbf581e for autobuilder 2004-09-13 06:58:54 +00:00
22bac3c8f4 strip user flags on reload (mrhunt) 2004-09-13 06:17:47 +00:00
35ffbf8ca6 Fixed API error 2004-09-12 22:16:56 +00:00
926f995a3a Added 64bit simulator 2004-09-12 20:58:27 +00:00
8589f0bcf5 fixed null weapon problems in get_user_astats 2004-09-12 18:00:53 +00:00
1a2ef38588 Renamed anglevector to angle_vector because that's its name in module... 2004-09-12 17:00:33 +00:00
fed8228712 Fixed small bug where the behaviour of a CTask object would be undefined if a plugin delted the task when it executes 2004-09-12 17:00:22 +00:00
09d0ba039d deleted menufront plugins .. 2004-09-12 11:05:24 +00:00
f2dcb89609 possible bad library 2004-09-12 07:24:35 +00:00
69e7cbc722 removed debug info 2004-09-12 07:18:54 +00:00
54e88bf8a8 Fixed path handling for plugins 2004-09-12 07:13:41 +00:00
b0315f5d56 Added more error reporting 2004-09-12 04:35:24 +00:00
ec55a2ab97 possible fix for dbi bug 2004-09-12 04:03:54 +00:00
1082ef31c7 Modules no longer need to have the correct extension (requested by UgLyPuNk) 2004-09-12 03:48:21 +00:00
ee28532c53 *** empty log message *** 2004-09-12 00:52:18 +00:00
e4294da5bd no more stdc++ 2004-09-12 00:48:36 +00:00
1ba9a39b3f removed iostream 2004-09-12 00:44:15 +00:00
5453b55bdc *** empty log message *** 2004-09-12 00:38:17 +00:00
16f51ea619 *** empty log message *** 2004-09-12 00:32:11 +00:00
b209d92a2a Fixed bug noted by JJKiller 2004-09-12 00:20:00 +00:00
0def8c9354 wow 2004-09-12 00:17:21 +00:00
ac59f75523 Fixed memory allocation 2004-09-12 00:14:34 +00:00
f2faf990a0 Fixed bug reported by JJKiller 2004-09-12 00:13:46 +00:00
7f6e9f5e20 *** empty log message *** 2004-09-11 22:46:28 +00:00
c12b04d302 new SDK 2004-09-11 21:58:46 +00:00
9922b5016f Fixed stdc errors 2004-09-11 21:55:33 +00:00
77fffb46b2 Added allocator / reallocator / reallocator funcs in not-memtest builds so modules can use them 2004-09-11 21:52:18 +00:00
e7cd31b1d5 *** empty log message *** 2004-09-11 21:13:02 +00:00
9006673b09 amd64 now does lstdc++ 2004-09-11 19:38:58 +00:00
96271810d8 no g++ 2004-09-11 17:42:50 +00:00
8377680989 memory test 2004-09-11 17:42:08 +00:00
00582481c6 stdc++ errors 2004-09-11 17:36:45 +00:00
c2255016d2 stdc++ errors 2004-09-11 17:32:25 +00:00
9e1c5f2808 amd64 zlib 2004-09-11 17:20:59 +00:00
897d93a892 amd64 2004-09-11 17:17:08 +00:00
04be9fb703 fixed libz linking 2004-09-11 16:47:29 +00:00
acf722e855 Hopefully fixed SDK 2004-09-11 16:35:14 +00:00
d2fe1dc043 Updated to September 2004-09-11 00:23:00 +00:00
dafc8bb678 added libz 2004-09-11 00:18:07 +00:00
d303a2e0b7 *** empty log message *** 2004-09-10 23:06:29 +00:00
7c8e9509ce fixed bug actually 2004-09-10 22:00:07 +00:00
7334f968a8 added MF_GetPlayerEdict (replacement for INDEXENT on players) and MF_Format. 2004-09-10 21:17:05 +00:00
f5a997069d Added new compiler frontend :) 2004-09-10 21:13:20 +00:00
c7f8b3f965 Added the Format function for C style strings 2004-09-10 21:00:42 +00:00
316ddad7ab Added the Format function to the module api 2004-09-10 20:58:55 +00:00
4d34270ee9 Ok, then 2004-09-10 18:43:37 +00:00
2573c9c4d2 Added pev_ideal_yaw 2004-09-10 16:28:27 +00:00
d72b8de045 DLLFunc_ClientUserInfoChanged 2004-09-10 16:09:32 +00:00
49d24f6829 oops 2004-09-10 16:06:30 +00:00
6f9ec854dc Added DLLFunc_Clientinfo something or other 2004-09-10 16:05:21 +00:00
9a3e713a69 Moved ns plugins 2004-09-10 15:57:24 +00:00
3ec4ccd9da Added new "amxx plugins" plugin fail message 2004-09-10 15:52:48 +00:00
5867e3398f Added client_spawn(id) & client_changeteam(id,newteam,oldteam) forwards 2004-09-10 13:57:10 +00:00
07ed1baee9 added ts plugins 2004-09-10 11:57:56 +00:00
1e1d479d76 added tfc plugins 2004-09-10 11:57:26 +00:00
78c191b4c9 added dod plugins 2004-09-10 11:47:43 +00:00
cf65ebf647 added DoD include files 2004-09-10 10:08:22 +00:00
7b626ab632 fixed 2004-09-10 05:38:16 +00:00
90eafe59a6 register_module -> require_module 2004-09-10 05:18:57 +00:00
a055d3d373 Upgraded CVector 2004-09-10 03:31:36 +00:00
267db7cc2b Removed include files 2004-09-10 03:16:30 +00:00
5043a40c51 Synced include files 2004-09-10 03:12:38 +00:00
0a74f09273 blah 2004-09-10 02:58:41 +00:00
767795b91e Added cstrike plugins 2004-09-10 00:33:41 +00:00
8089d42eda Cleanup, added new module forcing to plugins 2004-09-09 22:09:55 +00:00
6b9c8ac1ea Added dlsym handler 2004-09-09 21:47:32 +00:00
3c037270a6 Anti-flood is now enabled by default 2004-09-09 21:37:45 +00:00
6ac682cc5b Organized Cstrike stuff 2004-09-09 21:36:47 +00:00
e378c45be7 Fixed bug where the first registered forward would be automatically unregistered on unregisterForward too 2004-09-09 20:32:34 +00:00
66da3375ba fixed bugs in set/get user ammo natives 2004-09-09 19:51:00 +00:00
1df654c6a1 registerSPForward now returing -1 if no func found 2004-09-09 15:05:06 +00:00
388915e6f8 Fixes 2004-09-09 13:44:43 +00:00
4d8a927ff7 Fixed cells 2004-09-09 13:43:08 +00:00
b8721e0123 Fixed module correction output 2004-09-09 06:04:50 +00:00
59880371e1 Changes 2004-09-09 05:17:28 +00:00
6c73a7d8d1 New module registering ability 2004-09-09 05:16:53 +00:00
4232d68c92 New module registering ability 2004-09-09 04:53:37 +00:00
17faf3af1f woops 2004-09-08 22:05:01 +00:00
1c3a871831 Possible fix for forward unregister bug 2004-09-08 21:43:50 +00:00
a313c5b95b updated strings 2004-09-08 21:13:04 +00:00
b23eba293d fixed 64 bit bugs with float-to-bool conversion and unary - operator 2004-09-08 18:35:22 +00:00
08682ab378 SQL fallback to users.ini 2004-09-08 18:34:48 +00:00
39cb15cc56 nothing 2004-09-08 18:27:39 +00:00
c5d7417f8e added client_score forward 2004-09-08 18:09:01 +00:00
4c202dadb0 *** empty log message *** 2004-09-08 09:38:59 +00:00
78dc3ffd39 Re-added util functions 2004-09-08 09:38:05 +00:00
1d3dd15e61 Upgraded amxscript format 2004-09-08 07:48:23 +00:00
02446ac5f1 Fixed LoadAmxScript 2004-09-08 07:47:01 +00:00
2601879c0b Upgraded SDKs 2004-09-08 07:37:34 +00:00
313e0603e9 LoadAmxScript change 2004-09-08 07:35:51 +00:00
1d145d6c79 Linux port 2004-09-08 07:22:48 +00:00
213b0e65dc Added amx_debug 2004-09-08 07:11:13 +00:00
079a3e8bcd Fixed JIT line op problem 2004-09-08 07:05:16 +00:00
3010241fbd Fixed JIT line op problem 2004-09-08 06:45:32 +00:00
f3ea36c5d7 Grr, line formatting! 2004-09-08 05:31:01 +00:00
55dfbefb40 Fix for line ops parsing 2004-09-07 21:52:03 +00:00
1aee2c6f81 Fixed format tags 2004-09-07 09:26:20 +00:00
226c7300be Made memory management optional 2004-09-07 08:24:03 +00:00
f2af6ad1e6 Cleaned up float bugs 2004-09-07 06:18:20 +00:00
02d60ded5d Made memory management optional 2004-09-07 06:17:50 +00:00
3d0e25a8ef Made memory management optional 2004-09-07 06:11:17 +00:00
baef3362ed Fixed a bug that caused crashes on registering a forward after unregistering a forward 2004-09-07 05:43:55 +00:00
8903bc7f04 *** empty log message *** 2004-09-07 04:14:24 +00:00
fe2e3a1468 *** empty log message *** 2004-09-07 04:11:26 +00:00
3cbcebae56 possible bug fix 2004-09-07 02:16:05 +00:00
0fe010f4f0 fixed header 2004-09-07 01:58:18 +00:00
cd6e51271c Added more build information 2004-09-06 22:27:55 +00:00
711ad7b3dc endif bug 2004-09-06 22:25:43 +00:00
7ed66f0b38 Fixed line errors in JIT
Fixed externs in amx.cpp
2004-09-06 22:18:58 +00:00
3c67dcd326 added danish translation 2004-09-06 20:30:20 +00:00
8d0b5360c2 Fix for find_ent 2004-09-06 18:59:59 +00:00
44c5265757 SDK JIT fix 2004-09-06 09:18:23 +00:00
3297cf2e9b Added assembler implementation 2004-09-06 09:09:36 +00:00
b040f4474b Fixed sending 0 to find_ent_by_owner. 2004-09-06 08:21:13 +00:00
5094bba5e9 added MNF_GetPlayerEdict 2004-09-05 22:09:45 +00:00
e0e4f5cb34 heh oops 2004-09-05 20:06:26 +00:00
c0d73ce572 Fixed a bug where SP forwards were not unregistered
Fixed a bug where pfn_touch might not be called correctly
2004-09-05 20:03:01 +00:00
7d3d04b13d Tweaked register_impulse 2004-09-05 19:53:40 +00:00
88e199ff10 fixed registered impulses 2004-09-05 19:12:35 +00:00
ec3ade999a Added hull defines 2004-09-05 18:13:52 +00:00
57e93ef281 Added a fixed user_kill 2004-09-05 17:29:11 +00:00
6122364a24 catched -> caught 2004-09-05 17:28:48 +00:00
ff1be08b8a Updated 2004-09-05 15:54:38 +00:00
a66d04d26f Removed ns_*_icon 2004-09-05 15:53:46 +00:00
d20e9527f7 Updated all offsets for NS 3.0 beta 5 2004-09-05 13:54:09 +00:00
5c72931b94 NS b5 stuffs 2004-09-05 12:33:35 +00:00
276886022e Fixed small display bug with amx_who 2004-09-05 09:17:46 +00:00
8df987cf95 minor changes 2004-09-04 18:31:59 +00:00
de30d647d4 added the %c formatting sequence (untested) 2004-09-04 17:50:03 +00:00
7f70805e63 added [de] ([pc]Raba) and [tr] (Deagle) translations 2004-09-04 16:17:35 +00:00
1822261046 sanaell's frenchie changes 2004-09-03 08:01:28 +00:00
2a622424a0 new sdk 2004-09-03 06:59:56 +00:00
37a5a38be5 Changed amx structure for compatibility 2004-09-03 06:53:00 +00:00
580b20e720 1.02 linux build 2004-09-03 01:23:53 +00:00
9a4f15e4ad Added makefile 2004-09-02 19:50:19 +00:00
dd5c75888a Added forwardmacros.h to project 2004-09-02 18:24:48 +00:00
e8ec0ad5bf Improved error reporting 2004-09-02 10:26:00 +00:00
961b92db2c Backported mysql changes 2004-09-02 09:07:07 +00:00
af6349454d Updated for 0.20, fixed makefiles 2004-09-02 08:35:58 +00:00
32b07e4c0c Fixed JIT on Linux 2004-09-02 08:25:48 +00:00
e73b3bbbb7 New locations 2004-09-02 02:44:39 +00:00
fbb7c0bb92 Changed addons/amxx to addons/amxmodx 2004-09-02 02:16:38 +00:00
04c43f8589 Fixed a bug reported by kama - recommend not use -wait for rewrite 2004-09-02 01:31:39 +00:00
9d733d7a6b CVS terrorist strikes again! 2004-09-02 01:14:16 +00:00
30ddeda877 oops 2004-09-02 01:13:17 +00:00
72e5e9885f new makefile 2004-09-02 01:12:29 +00:00
5c6b34b1d8 Fixed some bugs in CLang 2004-09-02 00:22:56 +00:00
7a627f75cf Removed references to _snprintf() - math wrong but compatibility of snprintf() unknown 2004-09-01 22:03:44 +00:00
02cb4b94f5 Commited new SDK 2004-09-01 21:13:30 +00:00
0b5c02f678 fixed warning 2004-09-01 20:58:03 +00:00
ec5f9ec5ca Added buffer overflow (stack corruption) checking. To be tested! 2004-09-01 17:02:24 +00:00
551d51ea42 When AMXX can't open the logfile it outputs an error rather than crashing 2004-09-01 17:01:52 +00:00
560cd184cc Fixed JIT issues 2004-09-01 16:46:27 +00:00
14297c8408 Bad commit?!
New make
2004-09-01 15:56:31 +00:00
385fa07884 sql.cfg is always executed 2004-09-01 11:47:20 +00:00
35fdb8aa6e fixed compiler warning 2004-09-01 11:41:07 +00:00
34c6a1d4be stop removing my changes *evil* 2004-09-01 11:34:48 +00:00
745c595fc8 Now uses fakemeta for pdata stocks 2004-09-01 08:39:30 +00:00
e979252742 More fixes from malex 2004-08-31 22:40:30 +00:00
90b7dc2b9c updated dod stats file to ML 2004-08-31 22:00:15 +00:00
66bed5a1ab max cvars changed to 48 , DoD has too many cvars ... 2004-08-31 21:59:09 +00:00
8575c9a637 Added some description. hopefully they are right :-) 2004-08-31 16:43:58 +00:00
e73acf4fe4 Renamed is_jit_enabled from jit_enabled 2004-08-31 15:37:22 +00:00
2f37ab7ede Fixed bug where radians were not converted properly (malex) 2004-08-31 15:16:16 +00:00
b1dd324354 Fixed client_command forward 2004-08-31 15:10:12 +00:00
5f00f09314 Moved stocks 2004-08-31 15:02:51 +00:00
f06796c275 Changed so that a MOTD will also display when there is no ServerName message (as proposed by karlos on the forums). 2004-08-31 13:20:29 +00:00
e15c151167 minor fix from karlos 2004-08-31 12:45:11 +00:00
0b2eae8e0a Fixed a bug where remove_task() crashed
amxx_mm -> amxmodx_mm
2004-08-31 06:49:22 +00:00
4fff936626 amxx_mm -> amxmodx_mm 2004-08-31 06:46:44 +00:00
e2c9dbaa62 fixes 2004-08-31 06:39:08 +00:00
b2f3a52884 Attempt at reverting set_user_hitzones() 2004-08-31 06:32:38 +00:00
a720b62aaa Oh small compiler, how I hate thee
(Fixed issue where SC warned and truncated an enum entry)
2004-08-31 06:26:41 +00:00
71e6ce30a3 Fixed amx_say bug 2004-08-31 05:50:06 +00:00
4ee0573203 Changed to 2.5.1 compiler 2004-08-31 05:30:44 +00:00
68354f8964 Reverted to 2.5.1 2004-08-31 05:30:27 +00:00
d0b37726d5 Backwards compatibility bug found by karlos 2004-08-31 05:27:31 +00:00
51e8519d96 Fixed a bug fsfod made because i'm never wrong 2004-08-31 05:23:49 +00:00
c6d2516df8 fixed all registered forwards 2004-08-31 05:02:19 +00:00
813bc1a212 Removed pvPrivateData manipulation - see fakemeta_amxx 2004-08-31 02:58:28 +00:00
aa3c8fa377 sql cvars register by default 2004-08-31 02:53:06 +00:00
8cb5ad18f5 Removed some messiness 2004-08-31 02:29:31 +00:00
b34179e997 Fixed memory leak in detach 2004-08-31 02:05:27 +00:00
91aacb1036 Fixed bug where file stats were incorrect (malex) 2004-08-30 23:29:37 +00:00
2134a7e36d Messages can now be registered by multiple plugins (thanks fsfod) 2004-08-30 22:24:43 +00:00
6da1dc3e4a Fixed bug in set_msg_arg_int() reported by fsfod 2004-08-30 16:14:41 +00:00
b33a53d258 fixed bug where expressions like %02d would not be evaluated correctly 2004-08-30 15:14:50 +00:00
bec1e418e7 removed "J" from amxmodx_version cvar again 2004-08-30 15:02:07 +00:00
5c6db6d743 added missing zlib.lib 2004-08-30 14:41:32 +00:00
ac25c5fc60 %% in a format input string now produces one % in the output string correctly 2004-08-30 14:35:16 +00:00
1e36d0ca39 *** empty log message *** 2004-08-30 06:38:11 +00:00
945900605d Backported SDK changes 2004-08-30 03:34:13 +00:00
3b6d22d3bf Added amx_client_languages option 2004-08-30 03:31:00 +00:00
b254f14285 Fixed bug where MF_GetScriptName() was NULL 2004-08-30 02:00:01 +00:00
38e89f11f4 Fixed possible bug for %% 2004-08-30 01:39:15 +00:00
f4960433bc Fixed possible formatting bug 2004-08-30 01:37:25 +00:00
ebe778d0ee Fixed bug where meta tables would not be NULL'd correctly 2004-08-30 01:11:48 +00:00
36ad12b6b3 fixed bugs 2004-08-30 00:07:55 +00:00
0c022b1543 Fixed some bugs in admin_sql
Changed some things in dbi
2004-08-29 23:42:35 +00:00
4e9de62da6 Added new SDK version 2004-08-29 19:51:38 +00:00
727c798892 fixed crash bug 2004-08-29 19:49:08 +00:00
d9b768e2cf Added new SDK version 2004-08-29 19:39:18 +00:00
c1d75857f3 fixed crash bug 2004-08-29 18:51:25 +00:00
6d91af30b8 fixed memory leak 2004-08-29 18:50:38 +00:00
a1d36ff75d possible fix for the : issue 2004-08-29 18:00:16 +00:00
9a3e53478e Added better error reporting
Added new SDK version
2004-08-29 17:55:11 +00:00
7703c36a90 DoD cvars update 2004-08-29 17:37:37 +00:00
a3d048880f oops 2004-08-29 17:15:32 +00:00
53f8d12237 Switched tasks to forward system 2004-08-29 17:11:08 +00:00
54fb9fbfef registerSPForwardByName now automatically unregisters the forward again and returns -1 if the function is not found 2004-08-29 16:52:54 +00:00
5a80d24780 Fixed NewDLL heap corruption 2004-08-29 16:48:31 +00:00
b8bbe4ae8f Fixed small NewDLL issues 2004-08-29 13:32:55 +00:00
da13f4797d Reenabled NewDLL functions 2004-08-29 13:32:31 +00:00
6d35912c67 Removed debug info 2004-08-28 22:34:54 +00:00
02be09dd00 Removed inline notation. 2004-08-28 22:34:02 +00:00
93cd6dbed5 Fixed problem with pack not popped (=> hlsdk structures should be aligned correctly again) 2004-08-28 21:29:25 +00:00
8c8ccc51c4 Probably fixed problem with forwards getting garbage parameters 2004-08-28 21:25:29 +00:00
c7982c2bc3 Probably fixed problem with forwards getting garbage parameters 2004-08-28 21:25:03 +00:00
4015655141 added 4byte struct alignment (fsfod) 2004-08-28 03:57:29 +00:00
980ccfddf5 fixed building in debug mode issues 2004-08-26 21:27:39 +00:00
891be11032 register_impulse fix 2004-08-26 18:58:46 +00:00
269a0e4305 Sawce, the master of stupid mistakes strikes again!
(Fixed small bug)
2004-08-25 04:26:32 +00:00
9fb04f552c Moved includes to /plugins/include 2004-08-24 21:40:51 +00:00
19101470fd Added fakemeta includes (from dlls/fakemeta/)
Updated ns includes
2004-08-24 21:36:39 +00:00
fb8a883eec Removed old include files (now located in plugins/include) 2004-08-24 21:06:45 +00:00
8d714dd84e Added "ns_give_item"
Fixed SPForward registers
2004-08-24 21:05:01 +00:00
c6c958db2d Fixed another small error 2004-08-24 09:27:20 +00:00
185070a9ad Fixed a small error because I'm an idiot 2004-08-24 09:21:07 +00:00
a86c892af2 Fixed pointcontents stock 2004-08-24 09:04:27 +00:00
5464977fb7 New makefiles 2004-08-24 05:50:59 +00:00
f5fc9d026f newlines fixed 2004-08-24 05:44:31 +00:00
d5cb120ab4 Quick fix 2004-08-24 05:29:32 +00:00
7cbe114cf0 Fixed a message bug 2004-08-24 05:07:14 +00:00
84771f11a7 updated makefile 2004-08-24 05:00:23 +00:00
8b35ce2145 Added amx_FindNative to module API 2004-08-24 04:46:15 +00:00
9d3ea5513b Fixed a crash bug in FormatAmxString()
Added amx_FindNative to module API
Changed LZO->GZ in .amxx format
2004-08-24 04:30:13 +00:00
94219ae71a New compiler (compression changed, dependencies removed) 2004-08-23 21:57:37 +00:00
f4130105b0 fixed team menu 2004-08-23 21:17:59 +00:00
e4d11b321d Small fix for backwards compat 2004-08-23 18:25:45 +00:00
c53f54fe20 Changed from LZO to GZ compression 2004-08-23 18:21:09 +00:00
c95e1d8ae3 fixed: plmenu and get_user_team bugs 2004-08-23 18:10:50 +00:00
4ee81cd1ca New compiler 2004-08-23 17:13:12 +00:00
9a98b20d1b gcc 2004-08-23 14:25:31 +00:00
ff9bce89f2 new makefile 2004-08-23 14:22:25 +00:00
2d9e405b18 Important bug fixes 2004-08-23 14:14:58 +00:00
4a74dce0cd updated for karlos's changes 2004-08-23 13:38:09 +00:00
473699e7c8 updated for mahnsawce's changes 2004-08-23 12:35:21 +00:00
501 changed files with 77441 additions and 12654 deletions

View File

@ -419,8 +419,7 @@ void EventsMngr::executeEvents()
if ((err = amx_Exec((*iter).m_Plugin->getAMX(), NULL, (*iter).m_Func, 1, m_ParseVault ? m_ParseVault[0].iValue : 0)) != AMX_ERR_NONE) if ((err = amx_Exec((*iter).m_Plugin->getAMX(), NULL, (*iter).m_Func, 1, m_ParseVault ? m_ParseVault[0].iValue : 0)) != AMX_ERR_NONE)
{ {
AMXXLOG_Log("[AMXX] Run time error %d on line %ld (plugin \"%s\")", err, LogError((*iter).m_Plugin->getAMX(), err, "");
(*iter).m_Plugin->getAMX()->curline, (*iter).m_Plugin->getName());
} }
} }

View File

@ -110,7 +110,7 @@ cell CForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
int err = amx_Execv(iter->pPlugin->getAMX(), &retVal, iter->func, m_NumParams, realParams); int err = amx_Execv(iter->pPlugin->getAMX(), &retVal, iter->func, m_NumParams, realParams);
// log runtime error, if any // log runtime error, if any
if (err != AMX_ERR_NONE) if (err != AMX_ERR_NONE)
AMXXLOG_Log("[AMXX] Run time error %d on line %ld (plugin \"%s\")", err, iter->pPlugin->getAMX()->curline, iter->pPlugin->getName()); LogError(iter->pPlugin->getAMX(), err, "");
// cleanup strings & arrays // cleanup strings & arrays
for (i = 0; i < m_NumParams; ++i) for (i = 0; i < m_NumParams; ++i)
@ -128,6 +128,8 @@ cell CForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
else if (m_ParamTypes[i] == FP_ARRAY) else if (m_ParamTypes[i] == FP_ARRAY)
{ {
// copy back // copy back
if (preparedArrays[params[i]].copyBack)
{
cell *tmp = physAddrs[i]; cell *tmp = physAddrs[i];
if (preparedArrays[params[i]].type == Type_Cell) if (preparedArrays[params[i]].type == Type_Cell)
{ {
@ -139,6 +141,7 @@ cell CForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
for (unsigned int j = 0; j < preparedArrays[params[i]].size; ++j) for (unsigned int j = 0; j < preparedArrays[params[i]].size; ++j)
*data++ = static_cast<char>(*tmp++ & 0xFF); *data++ = static_cast<char>(*tmp++ & 0xFF);
} }
}
amx_Release(iter->pPlugin->getAMX(), realParams[i]); amx_Release(iter->pPlugin->getAMX(), realParams[i]);
} }
} }
@ -174,6 +177,7 @@ void CSPForward::Set(int func, AMX *amx, int numParams, const ForwardParam *para
m_NumParams = numParams; m_NumParams = numParams;
memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam)); memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam));
m_HasFunc = true; m_HasFunc = true;
isFree = false;
} }
void CSPForward::Set(const char *funcName, AMX *amx, int numParams, const ForwardParam *paramTypes) void CSPForward::Set(const char *funcName, AMX *amx, int numParams, const ForwardParam *paramTypes)
@ -182,10 +186,14 @@ void CSPForward::Set(const char *funcName, AMX *amx, int numParams, const Forwar
m_NumParams = numParams; m_NumParams = numParams;
memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam)); memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam));
m_HasFunc = (amx_FindPublic(amx, funcName, &m_Func) == AMX_ERR_NONE); m_HasFunc = (amx_FindPublic(amx, funcName, &m_Func) == AMX_ERR_NONE);
isFree = false;
} }
cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays) cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
{ {
if (isFree)
return 0;
const int STRINGEX_MAXLENGTH = 128; const int STRINGEX_MAXLENGTH = 128;
cell realParams[FORWARD_MAX_PARAMS]; cell realParams[FORWARD_MAX_PARAMS];
@ -236,7 +244,11 @@ cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
// exec // exec
cell retVal; cell retVal;
amx_Execv(m_Amx, &retVal, m_Func, m_NumParams, realParams); int err = amx_Execv(m_Amx, &retVal, m_Func, m_NumParams, realParams);
// log runtime error, if any
if (err != AMX_ERR_NONE)
LogError(m_Amx, err, "");
// cleanup strings & arrays // cleanup strings & arrays
for (i = 0; i < m_NumParams; ++i) for (i = 0; i < m_NumParams; ++i)
@ -254,6 +266,8 @@ cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
else if (m_ParamTypes[i] == FP_ARRAY) else if (m_ParamTypes[i] == FP_ARRAY)
{ {
// copy back // copy back
if (preparedArrays[params[i]].copyBack)
{
cell *tmp = physAddrs[i]; cell *tmp = physAddrs[i];
if (preparedArrays[params[i]].type == Type_Cell) if (preparedArrays[params[i]].type == Type_Cell)
{ {
@ -265,6 +279,7 @@ cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
for (unsigned int j = 0; j < preparedArrays[params[i]].size; ++j) for (unsigned int j = 0; j < preparedArrays[params[i]].size; ++j)
*data++ = static_cast<char>(*tmp++ & 0xFF); *data++ = static_cast<char>(*tmp++ & 0xFF);
} }
}
amx_Release(m_Amx, realParams[i]); amx_Release(m_Amx, realParams[i]);
} }
} }
@ -284,20 +299,30 @@ int CForwardMngr::registerForward(const char *funcName, ForwardExecType et, int
int CForwardMngr::registerSPForward(int func, AMX *amx, int numParams, const ForwardParam *paramTypes) int CForwardMngr::registerSPForward(int func, AMX *amx, int numParams, const ForwardParam *paramTypes)
{ {
int retVal = (m_SPForwards.size() << 1) | 1; int retVal = -1;
CSPForward *pForward; CSPForward *pForward;
if (m_FreeSPForwards.size()) if (!m_FreeSPForwards.empty())
{ {
pForward = m_SPForwards[m_FreeSPForwards.back()]; retVal = m_FreeSPForwards.front();
m_FreeSPForwards.pop_back(); pForward = m_SPForwards[retVal >> 1];
pForward->Set(func, amx, numParams, paramTypes); pForward->Set(func, amx, numParams, paramTypes);
if (pForward->getFuncsNum() == 0)
return -1;
m_FreeSPForwards.pop();
} }
else else
{ {
retVal = (m_SPForwards.size() << 1) | 1;
pForward = new CSPForward(); pForward = new CSPForward();
if (!pForward) if (!pForward)
return -1; return -1;
pForward->Set(func, amx, numParams, paramTypes); pForward->Set(func, amx, numParams, paramTypes);
if (pForward->getFuncsNum() == 0)
{
return -1;
delete pForward;
}
m_SPForwards.push_back(pForward); m_SPForwards.push_back(pForward);
} }
return retVal; return retVal;
@ -307,11 +332,14 @@ int CForwardMngr::registerSPForward(const char *funcName, AMX *amx, int numParam
{ {
int retVal = (m_SPForwards.size() << 1) | 1; int retVal = (m_SPForwards.size() << 1) | 1;
CSPForward *pForward; CSPForward *pForward;
if (m_FreeSPForwards.size()) if (!m_FreeSPForwards.empty())
{ {
pForward = m_SPForwards[m_FreeSPForwards.back()]; retVal = m_FreeSPForwards.front();
m_FreeSPForwards.pop_back(); pForward = m_SPForwards[retVal>>1]; // >>1 because unregisterSPForward pushes the id which contains the sp flag
pForward->Set(funcName, amx, numParams, paramTypes); pForward->Set(funcName, amx, numParams, paramTypes);
if (pForward->getFuncsNum() == 0)
return -1;
m_FreeSPForwards.pop();
} }
else else
{ {
@ -319,6 +347,11 @@ int CForwardMngr::registerSPForward(const char *funcName, AMX *amx, int numParam
if (!pForward) if (!pForward)
return -1; return -1;
pForward->Set(funcName, amx, numParams, paramTypes); pForward->Set(funcName, amx, numParams, paramTypes);
if (pForward->getFuncsNum() == 0)
{
delete pForward;
return -1;
}
m_SPForwards.push_back(pForward); m_SPForwards.push_back(pForward);
} }
return retVal; return retVal;
@ -345,6 +378,12 @@ int CForwardMngr::getParamsNum(int id) const
m_Forwards[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);
}
void CForwardMngr::clear() void CForwardMngr::clear()
{ {
for (ForwardVec::iterator iter = m_Forwards.begin(); iter != m_Forwards.end(); ++iter) for (ForwardVec::iterator iter = m_Forwards.begin(); iter != m_Forwards.end(); ++iter)
@ -359,7 +398,8 @@ void CForwardMngr::clear()
m_Forwards.clear(); m_Forwards.clear();
m_SPForwards.clear(); m_SPForwards.clear();
m_FreeSPForwards.clear(); while (!m_FreeSPForwards.empty())
m_FreeSPForwards.pop();
m_TmpArraysNum = 0; m_TmpArraysNum = 0;
} }
@ -370,7 +410,13 @@ bool CForwardMngr::isSPForward(int id) const
void CForwardMngr::unregisterSPForward(int id) void CForwardMngr::unregisterSPForward(int id)
{ {
m_FreeSPForwards.push_back(id); //make sure the id is valid
if ( !isIdValid(id) || m_SPForwards.at(id >> 1)->isFree )
return;
m_SPForwards.at(id >> 1)->isFree = true;
m_FreeSPForwards.push(id);
} }
int registerForward(const char *funcName, ForwardExecType et, ...) int registerForward(const char *funcName, ForwardExecType et, ...)
@ -447,33 +493,45 @@ cell executeForwards(int id, ...)
va_start(argptr, id); va_start(argptr, id);
for (int i = 0; i < paramsNum && i < FORWARD_MAX_PARAMS; ++i) for (int i = 0; i < paramsNum && i < FORWARD_MAX_PARAMS; ++i)
{ {
if (params[i] == FP_FLOAT) if (g_forwards.getParamType(id, i) == FP_FLOAT)
{ {
REAL tmp = (REAL)va_arg(argptr, double); // floats get converted to doubles REAL tmp = (REAL)va_arg(argptr, double); // floats get converted to doubles
params[i] = *(cell*)&tmp; params[i] = *(cell*)&tmp;
} }
else
params[i] = (cell)va_arg(argptr, cell); params[i] = (cell)va_arg(argptr, cell);
} }
va_end(argptr); va_end(argptr);
return g_forwards.executeForwards(id, params); return g_forwards.executeForwards(id, params);
} }
cell CForwardMngr::prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type) 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].ptr = ptr;
m_TmpArrays[m_TmpArraysNum].size = size; m_TmpArrays[m_TmpArraysNum].size = size;
m_TmpArrays[m_TmpArraysNum].type = type; m_TmpArrays[m_TmpArraysNum].type = type;
m_TmpArrays[m_TmpArraysNum].copyBack = copyBack;
return m_TmpArraysNum++; return m_TmpArraysNum++;
} }
cell prepareCellArray(cell *ptr, unsigned int size) cell prepareCellArray(cell *ptr, unsigned int size, bool copyBack)
{ {
return g_forwards.prepareArray((void*)ptr, size, Type_Cell); return g_forwards.prepareArray((void*)ptr, size, Type_Cell, copyBack);
} }
cell prepareCharArray(char *ptr, unsigned int size) cell prepareCharArray(char *ptr, unsigned int size, bool copyBack)
{ {
return g_forwards.prepareArray((void*)ptr, size, Type_Char); return g_forwards.prepareArray((void*)ptr, size, Type_Char, copyBack);
} }
void unregisterSPForward(int id) void unregisterSPForward(int id)

View File

@ -46,7 +46,7 @@
#ifndef FORWARD_H #ifndef FORWARD_H
#define FORWARD_H #define FORWARD_H
const int FORWARD_MAX_PARAMS = 16; const int FORWARD_MAX_PARAMS = 32;
enum ForwardExecType enum ForwardExecType
{ {
@ -79,6 +79,7 @@ struct ForwardPreparedArray
void *ptr; void *ptr;
ForwardArrayElemType type; ForwardArrayElemType type;
unsigned int size; unsigned int size;
bool copyBack;
}; };
// Normal forward // Normal forward
@ -108,6 +109,12 @@ public:
{ {
return m_Funcs.size(); return m_Funcs.size();
} }
ForwardParam getParamType(int paramId) const
{
if (paramId < 0 || paramId >= m_NumParams)
return FP_DONE;
return m_ParamTypes[paramId];
}
}; };
// Single plugin forward // Single plugin forward
@ -119,6 +126,8 @@ class CSPForward
AMX *m_Amx; AMX *m_Amx;
int m_Func; int m_Func;
bool m_HasFunc; bool m_HasFunc;
public:
bool isFree;
public: public:
CSPForward() { m_HasFunc = false; } CSPForward() { m_HasFunc = false; }
void Set(const char *funcName, AMX *amx, int numParams, const ForwardParam * paramTypes); void Set(const char *funcName, AMX *amx, int numParams, const ForwardParam * paramTypes);
@ -133,13 +142,19 @@ public:
{ {
return (m_HasFunc) ? 1 : 0; return (m_HasFunc) ? 1 : 0;
} }
ForwardParam getParamType(int paramId) const
{
if (paramId < 0 || paramId >= m_NumParams)
return FP_DONE;
return m_ParamTypes[paramId];
}
}; };
class CForwardMngr class CForwardMngr
{ {
typedef CVector<CForward*> ForwardVec; typedef CVector<CForward*> ForwardVec;
typedef CVector<CSPForward*> SPForwardVec; typedef CVector<CSPForward*> SPForwardVec;
typedef CVector<int> FreeSPVec; // Free SP Forwards typedef CQueue<int> FreeSPVec; // Free SP Forwards
ForwardVec m_Forwards; ForwardVec m_Forwards;
@ -170,7 +185,9 @@ public:
bool isSPForward(int id) const; // check whether forward is single plugin bool isSPForward(int id) const; // check whether forward is single plugin
int getParamsNum(int id) const; // get num of params of a forward 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 int getFuncsNum(int id) const; // get num of found functions of a forward
cell prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type); // prepare array ForwardParam getParamType(int id, int paramId) const;
cell prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type,
bool copyBack); // prepare array
}; };
// (un)register forward // (un)register forward
@ -182,8 +199,8 @@ void unregisterSPForward(int id);
// execute forwards // execute forwards
cell executeForwards(int id, ...); cell executeForwards(int id, ...);
// prepare array // prepare array
cell prepareCellArray(cell *ptr, unsigned int size); cell prepareCellArray(cell *ptr, unsigned int size, bool copyBack = false);
cell prepareCharArray(char *ptr, unsigned int size); cell prepareCharArray(char *ptr, unsigned int size, bool copyBack = false);
#endif #endif

View File

@ -341,7 +341,7 @@ void CLangMngr::CLang::MergeDefinitions(CQueue<sKeyDef*> &vec)
entry->SetKey(key); entry->SetKey(key);
entry->SetCache(false); entry->SetCache(false);
} else { } else {
AMXXLOG_Log("[AMXX] Language key %s[%s] defined twice", m_LMan->GetKey(key), m_LanguageName); //AMXXLOG_Log("[AMXX] Language key %s[%s] defined twice", m_LMan->GetKey(key), m_LanguageName);
} }
} }
delete vec.front(); delete vec.front();
@ -497,161 +497,46 @@ int CLangMngr::GetKeyEntry(String &key)
return -1; return -1;
} }
const char *CLangMngr::Format(const char *src, ...) #define CHECK_PTR(ptr, start, bufsize) if ((ptr) - (start) >= (bufsize)) { \
{ LogError(amx, AMX_ERR_STACKERR, "Buffer overflow in string formatting"); \
va_list argptr; outbuf[0] = 0; \
va_start(argptr, src); len = 0; \
static char outbuf[4096]; return outbuf; }
char *outptr = outbuf; #define CHECK_OUTPTR(offset) CHECK_PTR(outptr+offset, outbuf, sizeof(outbuf))
enum State #define ZEROTERM(buf) buf[(sizeof(buf)/sizeof(buf[0]))-1]=0;
{ #define NEXT_PARAM() \
S_Normal, if (parm > paramCount) \
S_PercentSign, { \
}; strcpy(outbuf, ""); \
len = 0; \
State curState = S_Normal; LogError(amx, AMX_ERR_PARAMS, "String formatted incorrectly - parameter %d (total %d)", parm, paramCount); \
while (*src) return outbuf; \
{
if (*src == '%' && curState == S_Normal)
curState = S_PercentSign;
else if (curState == S_PercentSign)
{
switch (*src)
{
case 's':
{
char *tmpArg = va_arg(argptr, char*);
while (*tmpArg)
*outptr++ = *tmpArg++;
break;
} }
case 'f':
case 'g':
{
char format[16];
format[0] = '%';
char *ptr = format+1;
while (!isalpha(*ptr++ = *src++))
/*nothing*/;
--src;
*ptr = 0;
sprintf(outptr, format, va_arg(argptr, double));
outptr += strlen(outptr);
break;
}
case 'L':
{
char *langName = va_arg(argptr, char*);
const char *cpLangName=NULL;
// Handle player ids (1-32) and server language
if ((int)langName == LANG_PLAYER)
{
langName = (char*)m_CurGlobId;
}
if ((int)langName == LANG_SERVER)
{
cpLangName = g_vault.get("server_language");
} else if ((int)langName >= 1 && (int)langName <= 32) {
if ((int)CVAR_GET_FLOAT("amx_client_languages"))
{
cpLangName = g_vault.get("server_language");
} else {
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I((int)langName)->pEdict, "lang");
}
} else {
cpLangName = langName;
}
if (!cpLangName || strlen(cpLangName) < 1)
cpLangName = "en";
char *key = va_arg(argptr, char*);
const char *def = GetDef(cpLangName, key);
while (*def)
{
switch (*def)
{
case INSERT_NUMBER:
{
sprintf(outptr, "%d", va_arg(argptr, int));
outptr += strlen(outptr);
break;
}
case INSERT_STRING:
{
char *tmpArg = va_arg(argptr, char*);
while (*tmpArg)
*outptr++ = *tmpArg++;
break;
}
case INSERT_FLOAT:
{
double tmpArg = va_arg(argptr, double);
sprintf(outptr, "%f", tmpArg);
outptr += strlen(outptr);
break;
}
case INSERT_NEWLINE:
*outptr++ = '\n';
break;
default:
*outptr++ = *def;
}
}
break;
}
case 'd':
{
char format[16];
format[0] = '%';
char *ptr = format+1;
while (!isalpha(*ptr++ = *src++))
/*nothing*/;
--src;
*ptr = 0;
sprintf(outptr, format, va_arg(argptr, int));
outptr += strlen(outptr);
break;
}
default:
*outptr++ = '%';
*outptr++ = *src;
}
curState = S_Normal;
}
else
*outptr++ = *src;
++src;
}
*outptr++ = 0;
return outbuf;
}
char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len) char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
{ {
cell *src = get_amxaddr(amx, params[parm++]); // number of parameters ( for NEXT_PARAM macro )
int paramCount = *params / sizeof(cell);
// the output buffer
static char outbuf[4096]; static char outbuf[4096];
char *outptr = outbuf; char *outptr = outbuf;
enum State cell *src = get_amxaddr(amx, params[parm++]);
{
S_Normal,
S_PercentSign,
};
State curState = S_Normal;
while (*src) while (*src)
{ {
if (*src == '%' && curState == S_Normal) if (*src == '%')
curState = S_PercentSign;
else if (curState == S_PercentSign)
{ {
++src;
if (*src=='L') if (*src=='L')
{ {
cell langName = params[parm]; // "en" case (langName contains the address to the string) cell langName = params[parm]; // "en" case (langName contains the address to the string)
NEXT_PARAM();
cell *pAmxLangName = get_amxaddr(amx, params[parm++]); // other cases cell *pAmxLangName = get_amxaddr(amx, params[parm++]); // other cases
const char *cpLangName=NULL; const char *cpLangName=NULL;
// Handle player ids (1-32) and server language // Handle player ids (1-32) and server language
if (*pAmxLangName == LANG_PLAYER) // LANG_PLAYER if (*pAmxLangName == LANG_PLAYER) // LANG_PLAYER
{ {
if ((int)CVAR_GET_FLOAT("amx_client_languages")) if ((int)CVAR_GET_FLOAT("amx_client_languages") == 0)
{ {
cpLangName = g_vault.get("server_language"); cpLangName = g_vault.get("server_language");
} else { } else {
@ -660,20 +545,21 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
} else if (*pAmxLangName == LANG_SERVER) { // LANG_SERVER } else if (*pAmxLangName == LANG_SERVER) { // LANG_SERVER
cpLangName = g_vault.get("server_language"); cpLangName = g_vault.get("server_language");
} else if (*pAmxLangName >= 1 && *pAmxLangName <= 32) { // Direct Client Id } else if (*pAmxLangName >= 1 && *pAmxLangName <= 32) { // Direct Client Id
if ((int)CVAR_GET_FLOAT("amx_client_languages")) if ((int)CVAR_GET_FLOAT("amx_client_languages") == 0)
{ {
cpLangName = g_vault.get("server_language"); cpLangName = g_vault.get("server_language");
} else { } else {
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(*pAmxLangName)->pEdict, "lang"); cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(*pAmxLangName)->pEdict, "lang");
} }
} else { // Language Name } else { // Language Name
int len = 0; int tmplen = 0;
cpLangName = get_amxstring(amx, langName, 2, len); cpLangName = get_amxstring(amx, langName, 2, tmplen);
} }
if (!cpLangName || strlen(cpLangName) < 1) if (!cpLangName || strlen(cpLangName) < 1)
cpLangName = "en"; cpLangName = "en";
int len = 0; int tmplen = 0;
char *key = get_amxstring(amx, params[parm++], 1, len); NEXT_PARAM();
char *key = get_amxstring(amx, params[parm++], 1, tmplen);
const char *def = GetDef(cpLangName, key); const char *def = GetDef(cpLangName, key);
if (def == NULL) if (def == NULL)
{ {
@ -687,7 +573,8 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
} }
if (!def) if (!def)
{ {
static char buf[255]; static char buf[512];
CHECK_PTR((char*)(buf+17+strlen(key)), buf, sizeof(buf));
sprintf(buf, "ML_LNOTFOUND: %s", key); sprintf(buf, "ML_LNOTFOUND: %s", key);
def = buf; def = buf;
} }
@ -697,37 +584,279 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
if (*def == '%') if (*def == '%')
{ {
++def; ++def;
char format[16]; if (*def == '%' || *def == 0)
{
*outptr++ = '%';
++def;
}
else
{
static char format[32];
format[0] = '%'; format[0] = '%';
char *ptr = format+1; char *ptr = format+1;
while (!isalpha(*ptr++ = *def++))
while (ptr-format<sizeof(format) && !isalpha(*ptr++ = *def++))
/*nothing*/; /*nothing*/;
ZEROTERM(format);
*ptr = 0; *ptr = 0;
switch ( *(ptr-1) ) switch ( *(ptr-1) )
{ {
case 's': case 's':
{ {
char tmpString[256]; static char tmpString[4096];
char *tmpPtr = tmpString; char *tmpPtr = tmpString;
NEXT_PARAM();
cell *tmpCell = get_amxaddr(amx, params[parm++]); cell *tmpCell = get_amxaddr(amx, params[parm++]);
while (*tmpCell) while (tmpPtr-tmpString < sizeof(tmpString) && *tmpCell)
*tmpPtr++ = *tmpCell++; *tmpPtr++ = *tmpCell++;
*tmpPtr = 0; *tmpPtr = 0;
sprintf(outptr, format, tmpString); sprintf(outptr, format, tmpString);
ZEROTERM(outbuf);
break; break;
} }
case 'g': case 'g':
case 'f': case 'f':
{ {
NEXT_PARAM();
sprintf(outptr, format, *(REAL*)get_amxaddr(amx, params[parm++]));
ZEROTERM(outbuf);
break;
}
case 'i':
case 'd':
case 'c':
{
NEXT_PARAM();
sprintf(outptr, format, (int)*get_amxaddr(amx, params[parm++]));
ZEROTERM(outbuf);
break;
}
default:
{
CHECK_OUTPTR(strlen(format)+1);
strcpy(outptr, format);
break;
}
}
outptr += strlen(outptr);
}
}
else if (*def == '^')
{
++def;
switch (*def)
{
case 'n':
CHECK_OUTPTR(1);
*outptr++ = '\n';
break;
case 't':
CHECK_OUTPTR(1);
*outptr++ = '\t';
break;
case '^':
CHECK_OUTPTR(1);
*outptr++ = '^';
break;
default:
CHECK_OUTPTR(2);
*outptr++ = '^';
*outptr++ = *def;
break;
}
++def;
}
else
{
CHECK_OUTPTR(1);
*outptr++ = *def++;
}
}
}
else
{
static char tmpString[4096];
char *tmpPtr = tmpString;
int tmpLen = 0;
static char format[32] = {'%'};
char *ptr = format+1;
if (*src != '%')
{
while (*src != 0 && ptr-format<sizeof(format) && !isalpha(*ptr++ = *src++))
/*nothing*/;
*ptr = 0;
ZEROTERM(format);
--src;
switch ( *(ptr-1) )
{
case 's':
{
NEXT_PARAM();
cell *tmpCell = get_amxaddr(amx, params[parm++]);
while (tmpPtr-tmpString<sizeof(tmpString) && *tmpCell)
*tmpPtr++ = *tmpCell++;
*tmpPtr = 0;
sprintf(outptr, format, tmpString);
ZEROTERM(outbuf);
break;
}
case 'g':
case 'f':
{
NEXT_PARAM();
sprintf(outptr, format, *(REAL*)get_amxaddr(amx, params[parm++])); sprintf(outptr, format, *(REAL*)get_amxaddr(amx, params[parm++]));
break; break;
} }
case 'i': case 'i':
case 'd': case 'd':
case 'c':
{ {
NEXT_PARAM();
sprintf(outptr, format, (int)*get_amxaddr(amx, params[parm++])); sprintf(outptr, format, (int)*get_amxaddr(amx, params[parm++]));
break; break;
} }
default:
{
CHECK_OUTPTR(strlen(format)+1);
strcpy(outptr, format);
break;
}
}
outptr += strlen(outptr);
} else {
CHECK_OUTPTR(1);
*outptr++ = '%';
}
}
}
else
{
CHECK_OUTPTR(1);
*outptr++ = *src;
}
++src;
}
len = outptr - outbuf;
CHECK_OUTPTR(1);
*outptr++ = 0;
return outbuf;
}
const char *CLangMngr::Format(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
const char *retVal = FormatString(fmt, ap);
va_end(ap);
return retVal;
}
#undef CHECK_PTR
#undef CHECK_OUTPR
#undef ZEROTERM
#undef NEXT_PARAM
#define CHECK_PTR(ptr, start, bufsize) if ((ptr) - (start) >= (bufsize)) { \
AMXXLOG_Log("[AMXX] Buffer overflow in formatting"); \
outbuf[0] = 0; \
return outbuf; }
#define CHECK_OUTPTR(offset) CHECK_PTR(outptr+offset, outbuf, sizeof(outbuf))
#define ZEROTERM(buf) buf[(sizeof(buf)/sizeof(buf[0]))-1]=0;
#define NEXT_PARAM()
char *CLangMngr::FormatString(const char *fmt, va_list &ap)
{
// the output buffer
static char outbuf[4096];
char *outptr = outbuf;
const char *src = fmt;
while (*src)
{
if (*src == '%')
{
++src;
if (*src=='L')
{
NEXT_PARAM();
const char *pAmxLangName = va_arg(ap, const char*);
const char *cpLangName=NULL;
// Handle player ids (1-32) and server language
if (pAmxLangName == (const char *)LANG_PLAYER) // LANG_PLAYER
{
if ((int)CVAR_GET_FLOAT("amx_client_languages"))
{
cpLangName = g_vault.get("server_language");
} else {
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(m_CurGlobId)->pEdict, "lang");
}
} else if (pAmxLangName == (const char *)LANG_SERVER) { // LANG_SERVER
cpLangName = g_vault.get("server_language");
} else if (pAmxLangName >= (const char *)1 && pAmxLangName <= (const char *)32) { // Direct Client Id
if ((int)CVAR_GET_FLOAT("amx_client_languages"))
{
cpLangName = g_vault.get("server_language");
} else {
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I((int)pAmxLangName)->pEdict, "lang");
}
} else { // Language Name
int tmplen = 0;
cpLangName = pAmxLangName;
}
if (!cpLangName || strlen(cpLangName) < 1)
cpLangName = "en";
int tmplen = 0;
const char *key = va_arg(ap, const char *);
const char *def = GetDef(cpLangName, key);
if (def == NULL)
{
if (pAmxLangName != LANG_SERVER)
{
def = GetDef(g_vault.get("server_language"), key);
}
if (strcmp(cpLangName, "en")!=0 && strcmp(g_vault.get("server_language"), "en")!=0)
{
def = GetDef("en", key);
}
if (!def)
{
static char buf[512];
CHECK_PTR((char*)(buf+17+strlen(key)), buf, sizeof(buf));
sprintf(buf, "ML_LNOTFOUND: %s", key);
def = buf;
}
}
while (*def)
{
if (*def == '%')
{
++def;
static char format[32];
format[0] = '%';
char *ptr = format+1;
while (ptr-format<sizeof(format) && !isalpha(*ptr++ = *def++))
/*nothing*/;
ZEROTERM(format);
*ptr = 0;
vsprintf(outptr, format, ap);
// vsprintf doesnt alter the ap, increment here
switch (*(ptr-1))
{
case 'f':
va_arg(ap, double);
break;
case 's':
va_arg(ap, char *);
break;
case 'c':
case 'd':
case 'i':
default: // default: assume int-like parameter
va_arg(ap, int);
break;
} }
outptr += strlen(outptr); outptr += strlen(outptr);
} }
@ -737,15 +866,19 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
switch (*def) switch (*def)
{ {
case 'n': case 'n':
CHECK_OUTPTR(1);
*outptr++ = '\n'; *outptr++ = '\n';
break; break;
case 't': case 't':
CHECK_OUTPTR(1);
*outptr++ = '\t'; *outptr++ = '\t';
break; break;
case '^': case '^':
CHECK_OUTPTR(1);
*outptr++ = '^'; *outptr++ = '^';
break; break;
default: default:
CHECK_OUTPTR(2);
*outptr++ = '^'; *outptr++ = '^';
*outptr++ = *def; *outptr++ = *def;
break; break;
@ -753,58 +886,58 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
++def; ++def;
} }
else else
{
CHECK_OUTPTR(1);
*outptr++ = *def++; *outptr++ = *def++;
} }
} }
}
else else
{ {
char tmpString[256]; static char format[32] = {'%'};
char *tmpPtr = tmpString;
int tmpLen =0;
char format[16];
format[0] = '%';
char *ptr = format+1; char *ptr = format+1;
while (!isalpha(*ptr++ = *src++)) if (*src != '%')
{
while (*src != 0 && ptr-format<sizeof(format) && !isalpha(*ptr++ = *src++))
/*nothing*/; /*nothing*/;
--src;
*ptr = 0; *ptr = 0;
switch ( *(ptr-1) ) ZEROTERM(format);
--src;
vsprintf(outptr, format, ap);
// vsprintf doesnt alter the ap, increment here
switch (*(ptr-1))
{ {
case 's':
{
cell *tmpCell = get_amxaddr(amx, params[parm++]);
while (*tmpCell)
*tmpPtr++ = *tmpCell++;
*tmpPtr = 0;
sprintf(outptr, format, tmpString);
break;
}
case 'g':
case 'f': case 'f':
{ va_arg(ap, double);
sprintf(outptr, format, *(REAL*)get_amxaddr(amx, params[parm++]));
break; break;
} case 's':
case 'i': va_arg(ap, char *);
break;
case 'c':
case 'd': case 'd':
{ case 'i':
sprintf(outptr, format, (int)*get_amxaddr(amx, params[parm++])); default: // default: assume int-like parameter
va_arg(ap, int);
break; break;
} }
}
outptr += strlen(outptr); outptr += strlen(outptr);
} else {
CHECK_OUTPTR(1);
*outptr++ = '%';
}
} }
curState = S_Normal;
} }
else else
{
CHECK_OUTPTR(1);
*outptr++ = *src; *outptr++ = *src;
}
++src; ++src;
} }
len = outptr - outbuf; CHECK_OUTPTR(1);
*outptr++ = 0; *outptr++ = 0;
return outbuf; return outbuf;
} }
void CLangMngr::MergeDefinitions(const char *lang, CQueue<sKeyDef*> &tmpVec) void CLangMngr::MergeDefinitions(const char *lang, CQueue<sKeyDef*> &tmpVec)
{ {
CLang * language = GetLang(lang); CLang * language = GetLang(lang);
@ -833,7 +966,7 @@ int CLangMngr::MergeDefinitionFile(const char *file)
return 0; return 0;
} }
MD5 md5; MD5 md5;
md5.update(fp); md5.update(fp); // closes for us
md5.finalize(); md5.finalize();
char md5buffer[33]; char md5buffer[33];
md5.hex_digest(md5buffer); md5.hex_digest(md5buffer);
@ -901,7 +1034,7 @@ int CLangMngr::MergeDefinitionFile(const char *file)
language[0] = buf[1]; language[0] = buf[1];
language[1] = buf[2]; language[1] = buf[2];
language[2] = 0; language[2] = 0;
} else if (buf.size() > 4) { } else {
if (!multiline) if (!multiline)
{ {
pos = buf.find('='); pos = buf.find('=');
@ -960,6 +1093,7 @@ int CLangMngr::MergeDefinitionFile(const char *file)
{ {
MergeDefinitions(language, Defq); MergeDefinitions(language, Defq);
} }
fclose(fp);
return 1; return 1;
} }

View File

@ -171,6 +171,7 @@ public:
const char *Format(const char *src, ...); const char *Format(const char *src, ...);
// Format a string for an AMX plugin // Format a string for an AMX plugin
char *FormatAmxString(AMX *amx, cell *params, int parm, int &len); char *FormatAmxString(AMX *amx, cell *params, int parm, int &len);
char *FormatString(const char *fmt, va_list &ap);
// Save // Save
bool Save(const char *filename); bool Save(const char *filename);
// Load // Load

View File

@ -153,9 +153,11 @@ void LogEventsMngr::executeLogEvents()
{ {
int err; int err;
bool valid; bool valid;
for(CLogEvent* a = logevents[ logArgc ]; a ; a = a->next){ for(CLogEvent* a = logevents[ logArgc ]; a ; a = a->next)
{
valid = true; valid = true;
for( CLogEvent::LogCond* b = a->filters; b ; b = b->next){ for( CLogEvent::LogCond* b = a->filters; b ; b = b->next)
{
valid = false; valid = false;
for( CLogEvent::LogCondEle* c = b->list; c ; c = c->next) { for( CLogEvent::LogCondEle* c = b->list; c ; c = c->next) {
if ( c->cmp->compareCondition( logArgs[b->argnum] ) == 0 ){ if ( c->cmp->compareCondition( logArgs[b->argnum] ) == 0 ){
@ -163,28 +165,15 @@ void LogEventsMngr::executeLogEvents()
break; break;
} }
} }
if (!valid) break; if (!valid)
break;
} }
#ifdef ENABLEEXEPTIONS if (valid)
try
{ {
#endif
if (valid){
if ((err = amx_Exec(a->plugin->getAMX(), NULL , a->func , 0)) != AMX_ERR_NONE) if ((err = amx_Exec(a->plugin->getAMX(), NULL , a->func , 0)) != AMX_ERR_NONE)
AMXXLOG_Log("[AMXX] Run time error %d on line %ld (plugin \"%s\")", LogError(a->plugin->getAMX(), err, "");
err,a->plugin->getAMX()->curline,a->plugin->getName());
} }
#ifdef ENABLEEXEPTIONS
}
catch( ... )
{
AMXXLOG_Log( "[AMXX] fatal error at log forward function execution");
}
#endif
} }
} }

View File

@ -126,8 +126,9 @@ pfnmodule_engine_g engModuleFunc = {
// class CModule // class CModule
// ***************************************************** // *****************************************************
CModule::CModule(const char* fname) : m_Filename(fname) CModule::CModule(const char* fname)
{ {
m_Filename.assign(fname);
clear(false); clear(false);
} }

View File

@ -95,7 +95,7 @@ public:
inline module_info_s* getInfo() const { return m_InfoOld; } // old inline module_info_s* getInfo() const { return m_InfoOld; } // old
inline const amxx_module_info_s* getInfoNew() const { return &m_InfoNew; } // new inline const amxx_module_info_s* getInfoNew() const { return &m_InfoNew; } // new
inline int getStatusValue() { return m_Status; } inline int getStatusValue() { return m_Status; }
inline bool operator==( void* fname ) { return !strcmp( m_Filename.c_str() , (char*)fname ); } 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 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 isAmxx() const { return m_Amxx; }
inline const char *getMissingFunc() const { return m_MissingFunc; } inline const char *getMissingFunc() const { return m_MissingFunc; }

View File

@ -34,11 +34,11 @@
#include "CForward.h" #include "CForward.h"
#include "CFile.h" #include "CFile.h"
CPluginMngr::CPlugin* CPluginMngr::loadPlugin(const char* path, const char* name, char* error) { CPluginMngr::CPlugin* CPluginMngr::loadPlugin(const char* path, const char* name, char* error, int debug) {
CPlugin** a = &head; CPlugin** a = &head;
while( *a ) a = &(*a)->next; while( *a ) a = &(*a)->next;
*a = new CPlugin( pCounter++ ,path,name,error); *a = new CPlugin( pCounter++ ,path,name,error, debug);
return *error ? 0 : *a; return (*a);
} }
void CPluginMngr::unloadPlugin( CPlugin** a ) { void CPluginMngr::unloadPlugin( CPlugin** a ) {
@ -50,7 +50,7 @@ void CPluginMngr::unloadPlugin( CPlugin** a ) {
int CPluginMngr::loadPluginsFromFile( const char* filename ) int CPluginMngr::loadPluginsFromFile( const char* filename )
{ {
File fp( build_pathname("%s",filename) , "r" ); FILE *fp = fopen(build_pathname("%s",filename) , "rt");
if ( !fp ) if ( !fp )
{ {
@ -59,22 +59,40 @@ int CPluginMngr::loadPluginsFromFile( const char* filename )
} }
// Find now folder // Find now folder
char pluginName[256], line[256], error[256]; char pluginName[256], error[256], debug[256];
const char *pluginsDir = get_localinfo("amxx_pluginsdir", "addons/amxx/plugins"); int debugFlag = 0;
const char *pluginsDir = get_localinfo("amxx_pluginsdir", "addons/amxmodx/plugins");
String line;
while ( fp.getline(line , 255 ) ) while ( !feof(fp) )
{ {
*pluginName = 0; *pluginName = 0;
sscanf(line,"%s",pluginName); *debug = 0;
debugFlag = 0;
line.clear();
line._fread(fp);
sscanf(line.c_str(),"%s %s",pluginName, debug);
if (!isalnum(*pluginName)) continue; if (!isalnum(*pluginName)) continue;
CPlugin* plugin = loadPlugin( pluginsDir , pluginName , error ); if (isalnum(*debug) && strcmp(debug, "debug") == 0)
{
if (!plugin) debugFlag = 1;
AMXXLOG_Log("[AMXX] %s (plugin \"%s\")", error, pluginName );
} }
CPlugin* plugin = loadPlugin( pluginsDir , pluginName , 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());
}
}
fclose(fp);
return pCounter; return pCounter;
} }
@ -87,10 +105,6 @@ void CPluginMngr::clear() {
CPluginMngr::CPlugin* CPluginMngr::findPluginFast(AMX *amx) CPluginMngr::CPlugin* CPluginMngr::findPluginFast(AMX *amx)
{ {
return (CPlugin*)(amx->userdata[3]); return (CPlugin*)(amx->userdata[3]);
/*CPlugin*a = head;
while ( a && &a->amx != amx )
a=a->next;
return a;*/
} }
CPluginMngr::CPlugin* CPluginMngr::findPlugin(AMX *amx) { CPluginMngr::CPlugin* CPluginMngr::findPlugin(AMX *amx) {
@ -119,7 +133,16 @@ CPluginMngr::CPlugin* CPluginMngr::findPlugin(const char* name) {
const char* CPluginMngr::CPlugin::getStatus() const { const char* CPluginMngr::CPlugin::getStatus() const {
switch(status){ switch(status){
case ps_running: return "running"; case ps_running:
{
if (getAMX()->flags & AMX_FLAG_DEBUG)
{
return "debug";
} else {
return "running";
}
break;
}
case ps_paused: return "paused"; case ps_paused: return "paused";
case ps_bad_load: return "bad load"; case ps_bad_load: return "bad load";
case ps_stopped: return "stopped"; case ps_stopped: return "stopped";
@ -128,16 +151,20 @@ const char* CPluginMngr::CPlugin::getStatus() const {
return "error"; return "error";
} }
CPluginMngr::CPlugin::CPlugin(int i, const char* p,const char* n, char* e) : name(n), title(n) { CPluginMngr::CPlugin::CPlugin(int i, const char* p,const char* n, char* e, int d) : name(n), title(n) {
const char* unk = "unknown"; const char* unk = "unknown";
title.assign(unk); title.assign(unk);
author.assign(unk); author.assign(unk);
version.assign(unk); version.assign(unk);
char* path = build_pathname("%s/%s",p,n); char* path = build_pathname("%s/%s",p,n);
code = 0; code = 0;
int err = load_amxscript(&amx,&code,path,e ); int err = load_amxscript(&amx,&code,path,e, d);
if ( err == AMX_ERR_NONE ) status = ps_running; if ( err == AMX_ERR_NONE )
else status = ps_bad_load; {
status = ps_running;
} else {
status = ps_bad_load;
}
amx.userdata[3] = this; amx.userdata[3] = this;
paused_fun = 0; paused_fun = 0;
next = 0; next = 0;

View File

@ -63,11 +63,12 @@ public:
String version; String version;
String title; String title;
String author; String author;
String errorMsg;
int paused_fun; int paused_fun;
int status; int status;
CPlugin* next; CPlugin* next;
int id; int id;
CPlugin(int i , const char* p,const char* n, char* e); CPlugin(int i , const char* p,const char* n, char* e, int d);
~CPlugin( ); ~CPlugin( );
public: public:
@ -76,11 +77,15 @@ public:
inline const char* getVersion() { return version.c_str();} inline const char* getVersion() { return version.c_str();}
inline const char* getTitle() { return title.c_str();} inline const char* getTitle() { return title.c_str();}
inline const char* getAuthor() { return author.c_str();} inline const char* getAuthor() { return author.c_str();}
inline const char* getError() { return errorMsg.c_str();}
inline int getStatusCode() { return status; }
inline int getId() const { return id; } inline int getId() const { return id; }
inline AMX* getAMX() { return &amx; } inline AMX* getAMX() { return &amx; }
inline const AMX* getAMX() const { return &amx; }
inline void setTitle( const char* n ) { title.assign(n); } inline void setTitle( const char* n ) { title.assign(n); }
inline void setAuthor( const char* n ) { author.assign(n); } inline void setAuthor( const char* n ) { author.assign(n); }
inline void setVersion( const char* n ) { version.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 isValid() const { return ((status != ps_bad_load) && (status != ps_locked)); }
inline bool isPaused() const { return ( (status == ps_paused) || (status == ps_stopped)); } 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 isFunctionPaused( int id ) const { return (paused_fun & (1<<id)) ? true : false; }
@ -104,7 +109,7 @@ public:
// Interface // Interface
CPlugin* loadPlugin(const char* path, const char* name, char* error); CPlugin* loadPlugin(const char* path, const char* name, char* error, int debug);
void unloadPlugin( CPlugin** a ); void unloadPlugin( CPlugin** a );
int loadPluginsFromFile( const char* filename ); int loadPluginsFromFile( const char* filename );
CPlugin* findPluginFast(AMX *amx); CPlugin* findPluginFast(AMX *amx);

View File

@ -71,7 +71,7 @@ public:
void append(const char *t) void append(const char *t)
{ {
Grow(cSize + strlen(t)); Grow(cSize + strlen(t) + 1);
strcat(v, t); strcat(v, t);
cSize = strlen(v); cSize = strlen(v);
} }
@ -187,7 +187,7 @@ public:
{ {
if (c == '\f' || c == '\n' || if (c == '\f' || c == '\n' ||
c == '\t' || c == '\r' || c == '\t' || c == '\r' ||
c == 'v' || c == ' ') c == '\v' || c == ' ')
{ {
return true; return true;
} }

View File

@ -61,14 +61,11 @@ void CTaskMngr::CTask::set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags,
if (iParamsLen) if (iParamsLen)
{ {
// also add a cell to the back with the value 0
m_iParamLen = iParamsLen + 1; m_iParamLen = iParamsLen + 1;
m_pParams = new cell[m_iParamLen]; m_pParams = new cell[m_iParamLen];
memcpy(m_pParams, pParams, sizeof(cell)*iParamsLen); memcpy(m_pParams, pParams, sizeof(cell)*iParamsLen);
m_pParams[iParamsLen] = 0; m_pParams[iParamsLen] = 0;
} } else {
else
{
m_iParamLen = 0; m_iParamLen = 0;
m_pParams = NULL; m_pParams = NULL;
} }
@ -76,9 +73,17 @@ void CTaskMngr::CTask::set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags,
void CTaskMngr::CTask::clear() void CTaskMngr::CTask::clear()
{ {
if (m_iFunc >= 0)
{
unregisterSPForward(m_iFunc);
m_iFunc = -1;
}
m_bFree = true; m_bFree = true;
if (m_pParams) if (m_pParams)
{
delete [] m_pParams; delete [] m_pParams;
m_pParams = NULL;
}
} }
bool CTaskMngr::CTask::isFree() const bool CTaskMngr::CTask::isFree() const
@ -114,29 +119,16 @@ void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, f
if (execute) if (execute)
{ {
if (m_pPlugin->isExecutable(m_iFunc))
{
int err;
if (m_iParamLen) // call with parameters if (m_iParamLen) // call with parameters
{ {
cell amx_addr, *phys_addr; cell arr = prepareCellArray(m_pParams, m_iParamLen);
if (amx_Allot(m_pPlugin->getAMX(), m_iParamLen, &amx_addr, &phys_addr) != AMX_ERR_NONE) executeForwards(m_iFunc, arr, m_iId);
AMXXLOG_Log("[AMXX] Failed to allocate AMX memory (task \"%d\") (plugin \"%s\")", m_iId, m_pPlugin->getName()); } else {
else executeForwards(m_iFunc, m_iId);
{ }
copy_amxmemory(phys_addr, m_pParams, m_iParamLen);
if ((err = amx_Exec(m_pPlugin->getAMX(), NULL, m_iFunc, 2, amx_addr, m_iId)) != AMX_ERR_NONE)
AMXXLOG_Log("[AMXX] Run time error %d on line %ld (task \"%d\") (plugin \"%s\")", err, m_pPlugin->getAMX()->curline, m_iId, m_pPlugin->getName());
amx_Release(m_pPlugin->getAMX(), amx_addr); if (isFree())
} return;
}
else
{
if ((err = amx_Exec(m_pPlugin->getAMX(), NULL, m_iFunc, 1, m_iId)) != AMX_ERR_NONE)
AMXXLOG_Log("[AMXX] Run time error %d on line %ld (task \"%d\") (plugin \"%s\")", err, m_pPlugin->getAMX()->curline, m_iId, m_pPlugin->getName());
}
}
// set new exec time OR remove the task if needed // set new exec time OR remove the task if needed
if (m_bLoop || (--m_iRepeat > 0)) if (m_bLoop || (--m_iRepeat > 0))
@ -145,6 +137,8 @@ void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, f
} }
else else
{ {
unregisterSPForward(m_iFunc);
m_iFunc = -1;
m_bFree = true; m_bFree = true;
} }
} }

View File

@ -54,19 +54,19 @@ private:
// execution // execution
float m_fNextExecTime; float m_fNextExecTime;
public: public:
inline void set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime); void set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime);
inline void clear(); void clear();
inline bool isFree() const; bool isFree() const;
inline CPluginMngr::CPlugin *getPlugin() const; CPluginMngr::CPlugin *getPlugin() const;
inline int getTaskId() const; int getTaskId() const;
inline 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
inline void changeBase(float fNewBase); void changeBase(float fNewBase);
inline void resetNextExecTime(float fCurrentTime); void resetNextExecTime(float fCurrentTime);
inline bool shouldRepeat(); bool shouldRepeat();
CTask(); CTask();
~CTask(); ~CTask();

View File

@ -32,6 +32,8 @@
#ifndef __CVECTOR_H__ #ifndef __CVECTOR_H__
#define __CVECTOR_H__ #define __CVECTOR_H__
#include <assert.h>
// Vector // Vector
template <class T> class CVector template <class T> class CVector
{ {
@ -284,7 +286,7 @@ public:
iterator iterAt(size_t pos) iterator iterAt(size_t pos)
{ {
if (pos > m_CurrentUsedSize) if (pos > m_CurrentUsedSize)
ASSERT(0); assert(0);
return iterator(m_Data + pos); return iterator(m_Data + pos);
} }
@ -331,7 +333,7 @@ public:
{ {
if (pos > m_CurrentUsedSize) if (pos > m_CurrentUsedSize)
{ {
ASSERT(0); assert(0);
} }
return m_Data[pos]; return m_Data[pos];
} }
@ -340,7 +342,7 @@ public:
{ {
if (pos > m_CurrentUsedSize) if (pos > m_CurrentUsedSize)
{ {
ASSERT(0); assert(0);
} }
return m_Data[pos]; return m_Data[pos];
} }
@ -359,7 +361,7 @@ public:
{ {
if (m_CurrentUsedSize < 1) if (m_CurrentUsedSize < 1)
{ {
ASSERT(0); assert(0);
} }
return m_Data[0]; return m_Data[0];
} }
@ -368,7 +370,7 @@ public:
{ {
if (m_CurrentUsedSize < 1) if (m_CurrentUsedSize < 1)
{ {
ASSERT(0); assert(0);
} }
return m_Data[0]; return m_Data[0];
} }
@ -377,7 +379,7 @@ public:
{ {
if (m_CurrentUsedSize < 1) if (m_CurrentUsedSize < 1)
{ {
ASSERT(0); assert(0);
} }
return m_Data[m_CurrentUsedSize - 1]; return m_Data[m_CurrentUsedSize - 1];
} }
@ -386,7 +388,7 @@ public:
{ {
if (m_CurrentUsedSize < 1) if (m_CurrentUsedSize < 1)
{ {
ASSERT(0); assert(0);
} }
return m_Data[m_CurrentUsedSize - 1]; return m_Data[m_CurrentUsedSize - 1];
} }

View File

@ -42,6 +42,12 @@
; Revision History ; Revision History
;------------------ ;------------------
; 16 September 2004 by David "BAILOPAN" Anderson
; Implemented a compile time toggleable debug hook on OP_CALL and OP_RET.
; NOTE: JIT has not had debug hooks since 1999.
; 8 September 2004 by David "BAILOPAN" Anderson
; Changed OP_LINE call to be compile-time toggle-able between compiling
; line ops or not.
; 29 June 2004 by G.W.M. Vissers ; 29 June 2004 by G.W.M. Vissers
; Translated the thing into NASM. The actual generation of the code is ; Translated the thing into NASM. The actual generation of the code is
; put into the data section because the code modifies itself whereas the ; put into the data section because the code modifies itself whereas the
@ -101,15 +107,6 @@
; to compute the destination address: It searches backwards now. ; to compute the destination address: It searches backwards now.
; 1999/07/08 MP - initial revision ; 1999/07/08 MP - initial revision
; Controls generation of LINE op-codes: 0 - no, all other values - yes
; Beware that, if set to 1, this makes the compiled code slower by a factor of
; up to 3!
;
; GWMV: to generate LINE opcode, %define ALLOWOPLINE
;
%undef ALLOWOPLINE
; ;
; If this is set to 1 the JIT generates relocatable code for case tables, too. ; If this is set to 1 the JIT generates relocatable code for case tables, too.
; If set to 0, a faster variant for switch (using absolute addresses) is ; If set to 0, a faster variant for switch (using absolute addresses) is
@ -156,16 +153,24 @@ _dbgcode: resd 1
_dbgaddr: resd 1 _dbgaddr: resd 1
_dbgparam: resd 1 _dbgparam: resd 1
_dbgname: resd 1 _dbgname: resd 1
_usertags: resd 4 ; 4 = AMX_USERNUM (#define'd in amx.h) ;usertags and userdata are 16 bytes on AMX Mod X
_userdata: resd 4 ; 4 = AMX_USERNUM (#define'd in amx.h) _usertags1: resd 1 ; 4 = AMX_USERNUM (#define'd in amx.h)
_usertags2: resd 1 ; 4 = AMX_USERNUM (#define'd in amx.h)
_usertags3: resd 1 ; 4 = AMX_USERNUM (#define'd in amx.h)
_usertags4: resd 1 ; 4 = AMX_USERNUM (#define'd in amx.h)
_userdata1: resd 1 ; 4 = AMX_USERNUM (#define'd in amx.h)
_userdata2: resd 1 ; 4 = AMX_USERNUM (#define'd in amx.h)
_userdata3: resd 1 ; 4 = AMX_USERNUM (#define'd in amx.h)
_userdata4: resd 1 ; 4 = AMX_USERNUM (#define'd in amx.h)
_error: resd 1 _error: resd 1
_pri: resd 1 _pri: resd 1
_alt: resd 1 _alt: resd 1
_reset_stk: resd 1 _reset_stk: resd 1
_reset_hea: resd 1 _reset_hea: resd 1
_syscall_d: resd 1 _syscall_d: resd 1
; the two fields below are for the JIT; they do not exist in ; the two fields below are for the JIT
; the non-JIT version of the abstract machine ; they are included in the non-JIT version for AMX Mod X
; this is to make sure that the structs match universally!
_reloc_size: resd 1 ; memory block for relocations _reloc_size: resd 1 ; memory block for relocations
_code_size: resd 1 ; memory size of the native code _code_size: resd 1 ; memory size of the native code
endstruc endstruc
@ -230,6 +235,7 @@ DBG_SYMTAG equ 9
AMX_FLAG_CHAR16 equ 0001h ; characters are 16-bit AMX_FLAG_CHAR16 equ 0001h ; characters are 16-bit
AMX_FLAG_DEBUG equ 0002h ; symbolic info. available AMX_FLAG_DEBUG equ 0002h ; symbolic info. available
AMX_FLAG_LINEOPS equ 0020h ; line ops should be parsed [load time only flag] - ~dvander
AMX_FLAG_BROWSE equ 4000h AMX_FLAG_BROWSE equ 4000h
AMX_FLAG_RELOC equ 8000h ; jump/call addresses relocated AMX_FLAG_RELOC equ 8000h ; jump/call addresses relocated
@ -272,6 +278,14 @@ AMX_FLAG_RELOC equ 8000h ; jump/call addresses relocated
; ;
; This is the work horse of the whole JIT: It actually copies the code. ; This is the work horse of the whole JIT: It actually copies the code.
; Notes from ~dvander (with help of dJeyL)
; This takes a source and ending address pointer in the assembled JIT code.
; Then it subtracts them and copies the code in between.
; The last parameter is the number of bytes the opcode is so it can jump
; to the next one.
; Also note that the "in between" code is NEVER executed during the compile
; phase of the JIT. It's only assembled in memory, and copied into the
; final output bytecode by this function.
%macro GO_ON 2-3 4 %macro GO_ON 2-3 4
mov esi, %1 ;get source address of JIT code mov esi, %1 ;get source address of JIT code
mov ecx,%2-%1 ;get number of bytes to copy mov ecx,%2-%1 ;get number of bytes to copy
@ -287,6 +301,8 @@ AMX_FLAG_RELOC equ 8000h ; jump/call addresses relocated
; Nasm can't handle the determination of the maximum code size as was done ; Nasm can't handle the determination of the maximum code size as was done
; in the Masm implementation, since it only does two passes. This macro is ; in the Masm implementation, since it only does two passes. This macro is
; called *after* the code for each Small instruction. ; called *after* the code for each Small instruction.
; Notes by ~dvander: This just substracts a label's ip from the current ip.
; Therefore you get an instant size check - see RELOC
%macro CHECKCODESIZE 1 %macro CHECKCODESIZE 1
%if MAXCODESIZE < $-%1 %if MAXCODESIZE < $-%1
%assign MAXCODESIZE $-%1 %assign MAXCODESIZE $-%1
@ -297,6 +313,11 @@ AMX_FLAG_RELOC equ 8000h ; jump/call addresses relocated
; Modify the argument of an x86 instruction with the Small opcode's parameter ; Modify the argument of an x86 instruction with the Small opcode's parameter
; before copying the code. ; before copying the code.
; ;
; Notes by ~dvander (thanks to dJeyL) - this will take an address and modify
; the dword at it. Since the JIT copies already assembled code, you see
; things like "call 12345678h". This is an arbitrary value as putval
; will modify it in memory and then GO_ON will add it to the program.
; It is important to get the putval address right - it's in bytes.
%macro putval 1 %macro putval 1
mov eax,[ebx+4] mov eax,[ebx+4]
mov dword [%1],eax mov dword [%1],eax
@ -305,7 +326,12 @@ AMX_FLAG_RELOC equ 8000h ; jump/call addresses relocated
; ;
; Add an entry to the table of addresses which have to be relocated after the ; Add an entry to the table of addresses which have to be relocated after the
; code compilation is done. ; code compilation is done.
; ; Notes by ~dvander: This is sort of what amx_BrowseRelocate() does, although
; relocation is actually done after code generation (this just adds to a
; table). Like putval, this takes in an address and marks it to be
; rewritten. It is a good idea to just use labels to find relocation
; offsets (see OP_CALL and OP_RETN). After code generation, this table
; is browsed and the correct threaded jumps are placed.
%macro RELOC 1-2 ; adr, dest %macro RELOC 1-2 ; adr, dest
mov ebp,[reloc_num] mov ebp,[reloc_num]
%if %0 < 2 %if %0 < 2
@ -791,7 +817,7 @@ OP_ALIGN_PRI:
CHECKCODESIZE j_align_pri CHECKCODESIZE j_align_pri
OP_ALIGN_ALT: OP_ALIGN_ALT:
;nop; ;nop
mov eax,4 mov eax,4
sub eax,[ebx+4] sub eax,[ebx+4]
mov dword [j_align_alt+1],eax mov dword [j_align_alt+1],eax
@ -1047,22 +1073,119 @@ OP_RET:
;good ;good
OP_RETN: OP_RETN:
;nop; ;nop;
GO_ON j_retn, OP_CALL ;save registers
push eax
push ebp
;get .amx flags
mov ebp,[amxhead]
mov eax,[ebp+_h_flags]
;check to see if the flag has line ops
and eax,AMX_FLAG_DEBUG
cmp eax,AMX_FLAG_DEBUG
;restore registers
pop ebp
pop eax
;if so, skip down to debug compiler
jmp _go_jit_retn_debug
_go_jit_retn_nodebug:
GO_ON j_retn_nodebug, _go_jit_retn_go
j_retn_nodebug:
jmp [jit_retn]
CHECKCODESIZE j_retn_nodebug
_go_jit_retn_go:
jmp _go_jit_retn_end
_go_jit_retn_debug:
GO_ON j_retn, OP_CALL
j_retn: j_retn:
push ebp
push eax
push edx
;get AMX
mov ebp,amx
;get debug call ptr
mov eax,[ebp+_userdata2]
;check validity
mov edx, dword 0
cmp eax, edx
je _go_jit_skip_debug
xchg esp,esi ;switch stack
push 1 ;param 2 mode 1 = pop
push ebp ;param 1 - amx
call eax ;indirect debug call
add esp, 8 ;restore stack
xchg esp,esi ;return to AMX stack
mov ebp,amx ;restore AMX [necessary?]
_go_jit_skip_debug:
pop edx
pop eax
pop ebp
jmp [jit_retn] jmp [jit_retn]
CHECKCODESIZE j_retn CHECKCODESIZE j_retn
_go_jit_retn_end:
;good ;good
OP_CALL: OP_CALL:
;nop; ;nop;
RELOC 1 ;save registers
GO_ON j_call, OP_CALL_I, 8 push eax
push ebp
;get .amx flags
mov ebp,[amxhead]
mov eax,[ebp+_h_flags]
;check to see if the flag has line ops
and eax,AMX_FLAG_DEBUG
cmp eax,AMX_FLAG_DEBUG
;restore registers
pop ebp
pop eax
;if so, skip down to debug compiler
jmp _go_jit_debug
_go_jit_nodebug:
RELOC 1
GO_ON j_call_nodebug, _j_call_go_on, 8
j_call_nodebug:
db 0e8h, 0, 0, 0, 0
CHECKCODESIZE j_call_nodebug
_j_call_go_on:
jmp _opcall_end
_go_jit_debug:
;thanks to Julien "dJeyL" Laurent for code relocation explanation
RELOC _go_jit_reloc-j_call+1
GO_ON j_call, OP_CALL_I, 8
j_call: j_call:
;call 12345678h ; tasm chokes on this out of a sudden ; save some registers
push ebp
push eax
push edx
; get AMX
mov ebp,amx
; get debug call pointer
mov eax,[ebp+_userdata2]
; check to see if it's valid
mov edx, dword 0
cmp eax,edx
je _go_jit_skip_call
xchg esp,esi ;switch to caller stack
push 2 ;param mode=2, push
push ebp ;param amx
call eax ;indirect call
add esp, 8 ;restore stack
xchg esp,esi ;return to AMX stack
mov ebp,amx ;restore AMX [necessary?]
_go_jit_skip_call:
;restore original registers
pop edx
pop eax
pop ebp
_go_jit_reloc:
db 0e8h, 0, 0, 0, 0 db 0e8h, 0, 0, 0, 0
CHECKCODESIZE j_call CHECKCODESIZE j_call
_opcall_end:
OP_CALL_I: OP_CALL_I:
;nop; ;nop;
@ -1734,13 +1857,29 @@ OP_FILE: ;opcode is simply ignored
OP_LINE: OP_LINE:
;nop; ;nop;
%ifndef ALLOWOPLINE ;~dvander - opline is now variable on compile time :]
;save registers
push eax
push ebp
;get .amx flags
mov ebp,[amxhead]
mov eax,[ebp+_h_flags]
;check to see if the flag has line ops
and eax,AMX_FLAG_LINEOPS
cmp eax,AMX_FLAG_LINEOPS
;restore registers
pop ebp
pop eax
;if so, skip down to debug compiler
je _go_debug
mov [ebx],edi ; no line number support: ignore opcode mov [ebx],edi ; no line number support: ignore opcode
add ebx,12 ; move on to next opcode add ebx,12 ; move on to next opcode
cmp ebx,[end_code] cmp ebx,[end_code]
jae code_gen_done jae code_gen_done
jmp dword [ebx] ; go on with the next opcode jmp dword [ebx] ; go on with the next opcode
%else
_go_debug:
putval j_line+6 putval j_line+6
mov eax,[ebx+8] mov eax,[ebx+8]
mov [j_line_sm],eax mov [j_line_sm],eax
@ -1750,7 +1889,6 @@ OP_LINE:
DD 0 ; space for curline DD 0 ; space for curline
j_line_sm DD 0 ; space for curfile j_line_sm DD 0 ; space for curfile
CHECKCODESIZE j_line CHECKCODESIZE j_line
%endif
OP_SYMBOL: ;ignored OP_SYMBOL: ;ignored
mov [ebx],edi mov [ebx],edi
@ -2215,7 +2353,6 @@ JIT_OP_LINE:
pop eax pop eax
jmp ecx ; jump back jmp ecx ; jump back
JIT_OP_SWITCH: JIT_OP_SWITCH:
pop ebp ; pop return address = table address pop ebp ; pop return address = table address
mov ecx,[ebp] ; ECX = number of records mov ecx,[ebp] ; ECX = number of records
@ -2233,7 +2370,6 @@ JIT_OP_SWITCH:
jmp ebp jmp ebp
%endif %endif
; The caller of asm_runJIT() can determine the maximum size of the compiled ; The caller of asm_runJIT() can determine the maximum size of the compiled
; code by multiplying the result of this function by the number of opcodes in ; code by multiplying the result of this function by the number of opcodes in
; Small module. ; Small module.

View File

@ -1,10 +0,0 @@
LIBRARY jits
DESCRIPTION "JIT for AMX Mod X"
EXPORTS
asm_runJIT @1
getMaxCodeSize @2
amx_exec_asm @3
amx_opcodelist @4
SECTIONS
.data READ WRITE
.code EXECUTE

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
amxmodx/JIT/jits.obj Executable file

Binary file not shown.

View File

@ -12,23 +12,38 @@
# amd64 - compile for AMD64 (impiles no jit) # amd64 - compile for AMD64 (impiles no jit)
# proc=ix86 - assumed not amd64 # proc=ix86 - assumed not amd64
# clean - clean the specifications above # clean - clean the specifications above
# asm - for ASM implementation
# !! TODO - add memory mananger support
# lineop - for JIT only, uses slow version
$PROJECT = "amxx_mm"; $PROJECT = "amxmodx_mm";
$sdk = "../hlsdk/SourceCode"; $sdk = "../hlsdk/SourceCode";
$mm = "../metamod/metamod"; $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", "MMGR/MMGR.cpp", "amxxfile.cpp", "CLang.cpp", "md5.cpp", "emsg.cpp", "CForward.cpp", "CPlugin.cpp", "CModule.cpp", "CMenu.cpp", "util.cpp"); @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 = ("minilzo/minilzo.c"); @C_SOURCE_FILES = ();
my %OPTIONS, %OPT; my %OPTIONS, %OPT;
$OPT{"debug"} = "-g -ggdb"; $OPT{"debug"} = "-g -ggdb";
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\""; $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"; $OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
while ($cmd = shift) 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 ($cmd =~ /jit/)
{ {
if ($OPTIONS{"amd64"}) if ($OPTIONS{"amd64"})
@ -38,9 +53,9 @@ while ($cmd = shift)
$OPTIONS{"jit"} = 1; $OPTIONS{"jit"} = 1;
} }
} elsif ($cmd =~ /amd64/) { } elsif ($cmd =~ /amd64/) {
if ($OPTIONS{"jit"}) if ($OPTIONS{"jit"} || $OPTIONS{"asm"})
{ {
die "You cannot compile the JIT and AMD64 yet.\n"; die "You cannot compile the JIT or ASM and AMD64 yet.\n";
} else { } else {
$OPTIONS{"amd64"} = 1; $OPTIONS{"amd64"} = 1;
} }
@ -56,19 +71,26 @@ while ($cmd = shift)
} }
} elsif ($cmd =~ /clean/) { } elsif ($cmd =~ /clean/) {
$OPTIONS{"clean"} = 1; $OPTIONS{"clean"} = 1;
} elsif ($cmd =~ /lineop/) {
$OPTIONS{"lineop"} = 1;
} }
} }
$gcc = `g++ --version`; $gcc = `$gccf --version`;
if ($gcc =~ /2\.9/) if ($gcc =~ /2\.9/)
{ {
`cp amx.cpp amx.c`; #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"); push(@C_SOURCE_FILES, "amx.c");
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2"; # }
} else { } else {
if ($OPTIONS{"amd64"}) if ($OPTIONS{"amd64"})
{ {
`cp amx.cpp amx.c`; `ln -s amx.cpp amx.c`;
push(@C_SOURCE_FILES, "amx.c"); push(@C_SOURCE_FILES, "amx.c");
} else { } else {
push(@CPP_SOURCE_FILES, "amx.cpp"); push(@CPP_SOURCE_FILES, "amx.cpp");
@ -95,12 +117,17 @@ if ($OPTIONS{"debug"})
if ($OPTIONS{"amd64"}) if ($OPTIONS{"amd64"})
{ {
$cflags .= " -m64 -DSMALL_CELL_SIZE=64 -DHAVE_I64 $cflags"; $cflags = " -m64 -DSMALL_CELL_SIZE=64 -DHAVE_I64 $cflags";
} }
if ($OPTIONS{"jit"}) if ($OPTIONS{"jit"})
{ {
$cflags .= "-DJIT"; $cflags .= " -DJIT";
}
if ($OPTIONS{"asm"})
{
$cflags .= " -DASM32";
} }
if ($OPTIONS{"debug"}) if ($OPTIONS{"debug"})
@ -129,8 +156,6 @@ if ($OPTIONS{"amd64"})
if ($OPTIONS{"clean"}) if ($OPTIONS{"clean"})
{ {
`rm $outdir/*.o`; `rm $outdir/*.o`;
`rm $outdir/MMGR/*.o`;
`rm $outdir/minilzo/*.o`;
`rm $outdir/$bin`; `rm $outdir/$bin`;
die("Project cleaned.\n"); die("Project cleaned.\n");
} }
@ -152,25 +177,32 @@ for ($i=0; $i<=$#C_SOURCE_FILES; $i++)
} }
if ($OPTIONS{"jit"}) if ($OPTIONS{"jit"})
{ {
if ($OPTIONS{"lineop"}) {
push(@LINK, "JIT/jits-lineop.o");
} else {
push(@LINK, "JIT/jits.o"); 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)) if (!(-d $outdir))
{ {
mkdir($outdir); mkdir($outdir);
} }
if (!(-d "$outdir/MMGR"))
{
mkdir("$outdir/MMGR");
}
if (!(-d "$outdir/JIT")) if (!(-d "$outdir/JIT"))
{ {
mkdir("$outdir/JIT"); mkdir("$outdir/JIT");
} }
if (!(-d "$outdir/minilzo"))
{
mkdir("$outdir/minilzo");
}
$inc = $OPTIONS{"include"}; $inc = $OPTIONS{"include"};
@ -180,13 +212,14 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
$ofile = $file; $ofile = $file;
$ofile =~ s/\.cpp/\.o/; $ofile =~ s/\.cpp/\.o/;
$ofile = "$outdir/$ofile"; $ofile = "$outdir/$ofile";
$gcc = "g++ $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; $gcc = "$gccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
if (-e $ofile) if (-e $ofile)
{ {
$file_time = (stat($file))[9]; $file_time = (stat($file))[9];
$ofile_time = (stat($file))[9]; $ofile_time = (stat($ofile))[9];
if ($file_time > $ofile_time) if ($file_time > $ofile_time)
{ {
`rm $ofile`;
print "$gcc\n"; print "$gcc\n";
`$gcc`; `$gcc`;
} }
@ -202,11 +235,11 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
$ofile = $file; $ofile = $file;
$ofile =~ s/\.c/\.o/; $ofile =~ s/\.c/\.o/;
$ofile = "$outdir/$ofile"; $ofile = "$outdir/$ofile";
$gcc = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile"; $gcc = "$ccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
if (-e $ofile) if (-e $ofile)
{ {
$file_time = (stat($file))[9]; $file_time = (stat($file))[9];
$ofile_time = (stat($file))[9]; $ofile_time = (stat($ofile))[9];
if ($file_time > $ofile_time) if ($file_time > $ofile_time)
{ {
print "$gcc\n"; print "$gcc\n";
@ -218,5 +251,6 @@ for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
} }
} }
$gcc = "g++ $cflags -shared -ldl -lm @LINK -o $outdir/$bin"; $gcc = "$gccf $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
print "$gcc\n";
`$gcc`; `$gcc`;

View File

@ -21,7 +21,7 @@
* Version: $Id$ * Version: $Id$
*/ */
#include <stdio.h> // not used
#define AMX_NODYNALOAD #define AMX_NODYNALOAD
// bad bad workaround but we have to prevent a compiler crash :/ // bad bad workaround but we have to prevent a compiler crash :/
@ -39,11 +39,13 @@
# endif # endif
#endif #endif
#include <stdio.h>
#include <assert.h> #include <assert.h>
#include <limits.h> #include <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include <stddef.h> /* for wchar_t */ #include <stddef.h> /* for wchar_t */
#include <string.h> #include <string.h>
#include <malloc.h>
#include "osdefs.h" #include "osdefs.h"
#if defined LINUX #if defined LINUX
#include <sclinux.h> #include <sclinux.h>
@ -51,27 +53,30 @@
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif
#endif #endif
#if defined __LCC__ || defined __linux__ #if defined __LCC__ || defined __GNUC__
#include <wchar.h> /* for wcslen() */ #include <wchar.h> /* for wcslen() */
#endif #endif
#if (defined _Windows && !defined AMX_NODYNALOAD) || (defined JIT && !defined __linux__)
#include <windows.h>
#endif
// this file does not include amxmodx.h so we have to include the mem mngr here // this file does not include amxmodx.h, so we have to include the memory manager here
#ifdef MEMORY_TEST #ifdef MEMORY_TEST
#include "mmgr/mmgr.h" #include "mmgr/mmgr.h"
#endif //MEMORY_TEST #endif // MEMORY_TEST
#include "amx.h" #include "amx.h"
#ifdef JIT #ifdef JIT
# ifdef __WIN32__ # ifdef __WIN32__
# include <windows.h> # include <windows.h> // DWORD, VirtualProtect, ...
# elif defined __linux__ # elif defined __linux__
# include <sys/mman.h> # include <sys/mman.h> // mprotect, PROT_*
# include <unistd.h> # include <unistd.h>
# else # else
// :TODO: // :TODO:
# endif # endif
#endif //JIT #endif // JIT
/* When one or more of the AMX_funcname macris are defined, we want /* When one or more of the AMX_funcname macris are defined, we want
* to compile only those functions. However, when none of these macros * to compile only those functions. However, when none of these macros
@ -423,6 +428,7 @@ int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params)
AMX_HEADER *hdr; AMX_HEADER *hdr;
AMX_FUNCSTUB *func; AMX_FUNCSTUB *func;
AMX_NATIVE f; AMX_NATIVE f;
int i =0;
assert(amx!=NULL); assert(amx!=NULL);
hdr=(AMX_HEADER *)amx->base; hdr=(AMX_HEADER *)amx->base;
@ -432,6 +438,7 @@ int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params)
assert(index>=0 && index<(cell)NUMENTRIES(hdr,natives,libraries)); assert(index>=0 && index<(cell)NUMENTRIES(hdr,natives,libraries));
func=GETENTRY(hdr,natives,index); func=GETENTRY(hdr,natives,index);
f=(AMX_NATIVE)func->address; f=(AMX_NATIVE)func->address;
amx->userdata[2] = (char *)GETENTRYNAME(hdr, func);
assert(f!=NULL); assert(f!=NULL);
/* now that we have found the function, patch the program so that any /* now that we have found the function, patch the program so that any
@ -476,9 +483,70 @@ int AMXAPI amx_Debug(AMX *amx)
return AMX_ERR_DEBUG; return AMX_ERR_DEBUG;
} }
//Here is the actual debugger that AMX Mod X uses
int AMXAPI amx_DebugCall(AMX *amx, int mode)
{
//right away, check for debugging
AMX_HEADER *hdr;
AMX_DBG *p = 0;
AMX_TRACE *t = 0;
hdr = (AMX_HEADER *)amx->base;
if ( !(amx->flags & AMX_FLAG_DEBUG) || !(amx->flags & AMX_FLAG_LINEOPS))
return AMX_ERR_NONE;
p = (AMX_DBG *)(amx->userdata[0]);
if ( !p )
return AMX_ERR_NONE;
if (mode == 2)
{
//mode - push onto the stack
t = (AMX_TRACE *)malloc(sizeof(AMX_TRACE));
memset(t, 0, sizeof(AMX_TRACE));
if (!p->head)
{
p->head = t;
t->prev = NULL;
} else {
t->prev = p->tail;
p->tail->next = t;
}
p->tail = t;
t->line = amx->curline;
t->file = amx->curfile;
} else if (mode == 1) {
//mode <0 - pop from the stack
t = p->tail;
if (t)
{
p->tail = t->prev;
free(t);
}
if (p->tail == NULL)
p->head = NULL;
} else if (mode == 0) {
AMX_TRACE *m;
//mode == 0 - clear stack
t = p->head;
while (t)
{
m = t->next;
free(t);
t = m;
}
p->head = 0;
p->tail = 0;
}
return AMX_ERR_NONE;
}
#if defined JIT #if defined JIT
#if defined WIN32 || defined __cplusplus
extern "C" int AMXAPI getMaxCodeSize(void); extern "C" int AMXAPI getMaxCodeSize(void);
extern "C" int AMXAPI asm_runJIT(void *sourceAMXbase, void *jumparray, void *compiledAMXbase); extern "C" int AMXAPI asm_runJIT(void *sourceAMXbase, void *jumparray, void *compiledAMXbase);
#else
extern int AMXAPI getMaxCodeSize(void);
extern int AMXAPI asm_runJIT(void *sourceAMXbase, void *jumparray, void *compiledAMXbase);
#endif
#endif #endif
#if SMALL_CELL_SIZE==16 #if SMALL_CELL_SIZE==16
@ -500,7 +568,6 @@ static int amx_BrowseRelocate(AMX *amx)
cell cip; cell cip;
long codesize; long codesize;
OPCODE op; OPCODE op;
int debug;
int last_sym_global = 0; int last_sym_global = 0;
#if defined __GNUC__ || defined ASM32 || defined JIT #if defined __GNUC__ || defined ASM32 || defined JIT
cell *opcode_list; cell *opcode_list;
@ -527,27 +594,33 @@ static int amx_BrowseRelocate(AMX *amx)
assert(OP_MOVS==117); assert(OP_MOVS==117);
assert(OP_SYMBOL==126); assert(OP_SYMBOL==126);
/* check the debug hook */
amx->dbgcode=DBG_INIT;
assert(amx->flags==0);
amx->flags=AMX_FLAG_BROWSE; amx->flags=AMX_FLAG_BROWSE;
debug= amx->debug(amx)==AMX_ERR_NONE;
if (debug)
amx->flags|=AMX_FLAG_DEBUG;
#if (defined __GNUC__ || defined ASM32 || defined JIT) && !defined __64BIT__ /* check the debug hook */
if ((hdr->flags & AMX_FLAG_LINEOPS) && !(hdr->flags & AMX_FLAG_TRACED))
{
amx->userdata[0] = (AMX_DBG *)malloc(sizeof(AMX_DBG));
amx->userdata[1] = (void *)amx_DebugCall;
memset(amx->userdata[0], 0, sizeof(AMX_DBG));
amx->flags |= AMX_FLAG_LINEOPS;
amx->flags |= AMX_FLAG_TRACED;
amx->flags |= AMX_FLAG_DEBUG;
} else {
amx->userdata[0] = 0;
amx->userdata[1] = 0;
amx->userdata[2] = 0;
}
#if defined __GNUC__ || defined ASM32 || defined JIT && !defined __64BIT__
amx_Exec(amx, (cell*)&opcode_list, 0, 0); amx_Exec(amx, (cell*)&opcode_list, 0, 0);
#if !defined JIT #if !defined JIT
/* to use direct system requests, a function pointer must fit in a cell; amx->sysreq_d=(sizeof(AMX_NATIVE)<=sizeof(cell)) ? opcode_list[OP_SYSREQ_D] : 0;
* because the native function's address will be stored as the parameter
* of SYSREQ.D
*/
amx->sysreq_d= (sizeof(AMX_NATIVE)<=sizeof(cell)) ? opcode_list[OP_SYSREQ_D] : 0;
#endif #endif
#else #else
/* ANSI C /* ANSI C
* to use direct system requests, a function pointer must fit in a cell; * to use direct system requests, a function pointer must fit in a cell;
* see the comment above * because the native function's address will be stored as the parameter
* of SYSREQ.D
*/ */
amx->sysreq_d= (sizeof(AMX_NATIVE)<=sizeof(cell)) ? OP_SYSREQ_D : 0; amx->sysreq_d= (sizeof(AMX_NATIVE)<=sizeof(cell)) ? OP_SYSREQ_D : 0;
#endif #endif
@ -717,21 +790,25 @@ static int amx_BrowseRelocate(AMX *amx)
DBGPARAM(amx->curfile); DBGPARAM(amx->curfile);
amx->dbgname=(char *)(code+(int)cip); amx->dbgname=(char *)(code+(int)cip);
cip+=num - sizeof(cell); cip+=num - sizeof(cell);
if (debug) { if (!(hdr->flags & AMX_FLAG_TRACED) && amx->userdata[0] != NULL)
assert(amx->flags==(AMX_FLAG_DEBUG | AMX_FLAG_BROWSE)); {
amx->dbgcode=DBG_FILE; AMX_DBG *pDbg = (AMX_DBG *)(amx->userdata[0]);
amx->debug(amx); if (pDbg->numFiles == 0)
{
pDbg->numFiles++;
pDbg->files = (char **)malloc(sizeof(char *) * 1);
} else {
pDbg->numFiles++;
pDbg->files = (char **)realloc(pDbg->files, pDbg->numFiles * sizeof(char*));
}
pDbg->files[pDbg->numFiles-1] = (char *)malloc((sizeof(char) * strlen(amx->dbgname)) + 1);
strcpy(pDbg->files[pDbg->numFiles-1], amx->dbgname);
} /* if */ } /* if */
break; break;
} /* case */ } /* case */
case OP_LINE: case OP_LINE:
DBGPARAM(amx->curline); DBGPARAM(amx->curline);
DBGPARAM(amx->curfile); DBGPARAM(amx->curfile);
if (debug) {
assert(amx->flags==(AMX_FLAG_DEBUG | AMX_FLAG_BROWSE));
amx->dbgcode=DBG_LINE;
amx->debug(amx);
} /* if */
break; break;
case OP_SYMBOL: { case OP_SYMBOL: {
cell num; cell num;
@ -741,29 +818,14 @@ static int amx_BrowseRelocate(AMX *amx)
amx->dbgname=(char *)(code+(int)cip); amx->dbgname=(char *)(code+(int)cip);
cip+=num - 2*sizeof(cell); cip+=num - 2*sizeof(cell);
last_sym_global = (amx->dbgparam >> 8)==0; last_sym_global = (amx->dbgparam >> 8)==0;
if (debug && last_sym_global) { /* do global symbols only */
assert(amx->flags==(AMX_FLAG_DEBUG | AMX_FLAG_BROWSE));
amx->dbgcode=DBG_SYMBOL;
amx->debug(amx);
} /* if */
break; break;
} /* case */ } /* case */
case OP_SRANGE: case OP_SRANGE:
DBGPARAM(amx->dbgaddr); /* dimension level */ DBGPARAM(amx->dbgaddr); /* dimension level */
DBGPARAM(amx->dbgparam); /* length */ DBGPARAM(amx->dbgparam); /* length */
if (debug && last_sym_global) { /* do global symbols only */
assert(amx->flags==(AMX_FLAG_DEBUG | AMX_FLAG_BROWSE));
amx->dbgcode=DBG_SRANGE;
amx->debug(amx);
} /* if */
break; break;
case OP_SYMTAG: case OP_SYMTAG:
DBGPARAM(amx->dbgparam); /* tag id */ DBGPARAM(amx->dbgparam); /* tag id */
if (debug && last_sym_global) { /* do global symbols only */
assert(amx->flags==(AMX_FLAG_DEBUG | AMX_FLAG_BROWSE));
amx->dbgcode=DBG_SYMTAG;
amx->debug(amx);
} /* if */
break; break;
case OP_CASETBL: { case OP_CASETBL: {
cell num; cell num;
@ -792,6 +854,7 @@ static int amx_BrowseRelocate(AMX *amx)
amx->flags &= ~AMX_FLAG_BROWSE; amx->flags &= ~AMX_FLAG_BROWSE;
amx->flags |= AMX_FLAG_RELOC; amx->flags |= AMX_FLAG_RELOC;
amx->flags |= AMX_FLAG_TRACED;
return AMX_ERR_NONE; return AMX_ERR_NONE;
} }
@ -931,8 +994,6 @@ int AMXAPI amx_Init(AMX *amx,void *program)
amx->stk=amx->stp; amx->stk=amx->stp;
if (amx->callback==NULL) if (amx->callback==NULL)
amx->callback=amx_Callback; amx->callback=amx_Callback;
if (amx->debug==NULL)
amx->debug=amx_Debug;
amx->curline=0; amx->curline=0;
amx->curfile=0; amx->curfile=0;
amx->data=NULL; amx->data=NULL;
@ -1049,19 +1110,22 @@ int AMXAPI amx_Init(AMX *amx,void *program)
} }
#else /* #if defined __WIN32 __ */ #else /* #if defined __WIN32 __ */
// TODO: Add cases for Linux, Unix, OS/2, ...
// DOS32 has no imposed limits on its segments. // DOS32 has no imposed limits on its segments.
#if defined __BORLANDC__ || defined __WATCOMC__ #if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused #pragma argsused
#endif #endif
int memoryFullAccess( void* addr, int len ) { return 1; } int memoryFullAccess( void* addr, int len )
{
return mprotect(addr, len, PROT_READ|PROT_WRITE|PROT_EXEC);
}
#if defined __BORLANDC__ || defined __WATCOMC__ #if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused #pragma argsused
#endif #endif
int memorySetAccess( void* addr, int len, int access ) { return 1; } int memorySetAccess( void* addr, int len, int access )
{
return mprotect(addr, len, PROT_READ|PROT_EXEC);
}
#endif /* #if defined __WIN32 __ */ #endif /* #if defined __WIN32 __ */
@ -1070,8 +1134,13 @@ int AMXAPI amx_InitJIT(AMX *amx, void *reloc_table, void *native_code)
int mac, res; int mac, res;
AMX_HEADER *hdr; AMX_HEADER *hdr;
mac = memoryFullAccess( (void*)asm_runJIT, 20000 ); #ifdef __linux__
if ( ! mac ) mac = memoryFullAccess( (void *)((int)((void*)asm_runJIT)-(int)((void*)asm_runJIT)%sysconf(_SC_PAGESIZE)), 20000 );
if ( mac )
#else
mac = memoryFullAccess((void *)asm_runJIT, 20000);
if ( !mac )
#endif
return AMX_ERR_INIT_JIT; return AMX_ERR_INIT_JIT;
/* copy the prefix */ /* copy the prefix */
@ -1103,7 +1172,7 @@ int AMXAPI amx_InitJIT(AMX *amx, void *reloc_table, void *native_code)
*(cell *)((char*)native_code + hdr->dat + hdr->stp - sizeof(cell)) = 0; *(cell *)((char*)native_code + hdr->dat + hdr->stp - sizeof(cell)) = 0;
amx->stk = amx->stp; amx->stk = amx->stp;
memorySetAccess( asm_runJIT, 20000, mac ); memorySetAccess( (void*)asm_runJIT, 20000, mac );
return AMX_ERR_NONE; return AMX_ERR_NONE;
} }
@ -1573,8 +1642,7 @@ static AMX_NATIVE findfunction(const char *name, AMX_NATIVE_INFO *list, int numb
return NULL; return NULL;
} }
const char *no_function; const char *no_function; // PM: Nice hack ;)
int AMXAPI amx_Register(AMX *amx, AMX_NATIVE_INFO *list, int number) int AMXAPI amx_Register(AMX *amx, AMX_NATIVE_INFO *list, int number)
{ {
AMX_FUNCSTUB *func; AMX_FUNCSTUB *func;
@ -1594,10 +1662,6 @@ int AMXAPI amx_Register(AMX *amx, AMX_NATIVE_INFO *list, int number)
if (func->address==0) { if (func->address==0) {
/* this function is not yet located */ /* this function is not yet located */
funcptr=(list!=NULL) ? findfunction(GETENTRYNAME(hdr,func),list,number) : NULL; funcptr=(list!=NULL) ? findfunction(GETENTRYNAME(hdr,func),list,number) : NULL;
/* on 64-bit architectures with, only the lower 32-bits of the address
* can be stored; hopefully, all addresses can be assumed to have the
* same value for the upper 32-bits
*/
if (funcptr!=NULL) if (funcptr!=NULL)
func->address=(ucell)funcptr; func->address=(ucell)funcptr;
else else
@ -1610,6 +1674,40 @@ int AMXAPI amx_Register(AMX *amx, AMX_NATIVE_INFO *list, int number)
} /* for */ } /* for */
return err; return err;
} }
static cell AMX_NATIVE_CALL null_native(AMX *amx, cell *params)
{
return 0;
}
void amx_NullNativeTable(AMX *amx)
{
AMX_FUNCSTUB *func;
AMX_HEADER *hdr;
int i, numnatives;
hdr=(AMX_HEADER *)amx->base;
if (hdr == NULL)
return;
if (hdr->magic!=AMX_MAGIC)
return;
numnatives = NUMENTRIES(hdr, natives, libraries);
func=GETENTRY(hdr, natives, 0);
for (i=0; i<numnatives; i++)
{
if (strcmp(GETENTRYNAME(hdr,func), "require_module")==0)
{
func->address = NULL;
} else {
func->address = (ucell)null_native;
}
func=(AMX_FUNCSTUB*)((unsigned char*)func+hdr->defsize);
}
}
#endif /* AMX_REGISTER || AMX_EXEC || AMX_INIT */ #endif /* AMX_REGISTER || AMX_EXEC || AMX_INIT */
#if defined AMX_NATIVEINFO #if defined AMX_NATIVEINFO
@ -1634,7 +1732,7 @@ AMX_NATIVE_INFO * AMXAPI amx_NativeInfo(const char *name, AMX_NATIVE func)
#define CHKSTACK() if (stk>amx->stp) return AMX_ERR_STACKLOW #define CHKSTACK() if (stk>amx->stp) return AMX_ERR_STACKLOW
#define CHKHEAP() if (hea<amx->hlw) return AMX_ERR_HEAPLOW #define CHKHEAP() if (hea<amx->hlw) return AMX_ERR_HEAPLOW
#if defined __GNUC__ && !defined ASM32 #if defined __GNUC__ && !defined ASM32 && !defined JIT
/* GNU C version uses the "labels as values" extension to create /* GNU C version uses the "labels as values" extension to create
* fast "indirect threaded" interpreter. * fast "indirect threaded" interpreter.
*/ */
@ -1724,7 +1822,8 @@ static void *amx_opcodelist_nodebug[] = {
ucell codesize; ucell codesize;
int num,i; int num,i;
va_list ap; va_list ap;
int debug; AMX_DEBUGCALL tracer = 0;
AMX_DBG *pdbg = 0;
/* HACK: return label table (for amx_BrowseRelocate) if amx structure /* HACK: return label table (for amx_BrowseRelocate) if amx structure
* has the AMX_FLAG_BROWSE flag set. * has the AMX_FLAG_BROWSE flag set.
@ -1732,7 +1831,12 @@ static void *amx_opcodelist_nodebug[] = {
if ((amx->flags & AMX_FLAG_BROWSE)==AMX_FLAG_BROWSE) { if ((amx->flags & AMX_FLAG_BROWSE)==AMX_FLAG_BROWSE) {
assert(sizeof(cell)==sizeof(void *)); assert(sizeof(cell)==sizeof(void *));
assert(retval!=NULL); assert(retval!=NULL);
*retval=(cell)((amx->flags & AMX_FLAG_DEBUG)==0 ? amx_opcodelist_nodebug : amx_opcodelist); if (amx->flags & AMX_FLAG_DEBUG)
{
*retval=(cell)(amx_opcodelist);
} else {
*retval=(cell)(amx_opcodelist_nodebug);
}
return 0; return 0;
} /* if */ } /* if */
@ -1745,7 +1849,6 @@ static void *amx_opcodelist_nodebug[] = {
if ((amx->flags & AMX_FLAG_RELOC)==0) if ((amx->flags & AMX_FLAG_RELOC)==0)
return AMX_ERR_INIT; return AMX_ERR_INIT;
assert((amx->flags & AMX_FLAG_BROWSE)==0); assert((amx->flags & AMX_FLAG_BROWSE)==0);
debug= (amx->flags & AMX_FLAG_DEBUG)!=0;
/* set up the registers */ /* set up the registers */
hdr=(AMX_HEADER *)amx->base; hdr=(AMX_HEADER *)amx->base;
@ -1787,15 +1890,6 @@ static void *amx_opcodelist_nodebug[] = {
CHKHEAP(); CHKHEAP();
init_little_endian(); init_little_endian();
if (debug && index!=AMX_EXEC_CONT) {
/* set the entry point in the debugger by marking a "call" to the
* exported function
*/
amx->dbgcode=DBG_CALL;
amx->dbgaddr=(ucell)((unsigned char*)cip-code);
amx->debug(amx);
} /* if */
/* sanity checks */ /* sanity checks */
assert(OP_PUSH_PRI==36); assert(OP_PUSH_PRI==36);
assert(OP_PROC==46); assert(OP_PROC==46);
@ -1838,6 +1932,20 @@ static void *amx_opcodelist_nodebug[] = {
/* check stack/heap before starting to run */ /* check stack/heap before starting to run */
CHKMARGIN(); CHKMARGIN();
if ((amx->flags & AMX_FLAG_DEBUG) && (amx->flags & AMX_FLAG_LINEOPS))
{
if (amx->userdata[0])
{
tracer = (AMX_DEBUGCALL)amx->userdata[1];
pdbg = (AMX_DBG *)(amx->userdata[0]);
if (tracer)
{
//as a precaution, clear the call stack
(tracer)(amx, 0);
}
}
}
/* start running */ /* start running */
NEXT(cip); NEXT(cip);
@ -2101,12 +2209,6 @@ static void *amx_opcodelist_nodebug[] = {
stk+=offs; stk+=offs;
CHKMARGIN(); CHKMARGIN();
CHKSTACK(); CHKSTACK();
if (debug && offs>0) {
amx->dbgcode=DBG_CLRSYM;
amx->stk=stk;
amx->hea=hea;
amx->debug(amx);
} /* if */
NEXT(cip); NEXT(cip);
op_stack_nodebug: op_stack_nodebug:
GETPARAM(offs); GETPARAM(offs);
@ -2128,19 +2230,16 @@ static void *amx_opcodelist_nodebug[] = {
CHKMARGIN(); CHKMARGIN();
NEXT(cip); NEXT(cip);
op_ret: op_ret:
if (tracer)
{
(tracer)(amx, 1);
}
POP(frm); POP(frm);
POP(offs); POP(offs);
/* verify the return address */ /* verify the return address */
if ((ucell)offs>=codesize) if ((ucell)offs>=codesize)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
cip=(cell *)(code+(int)offs); cip=(cell *)(code+(int)offs);
if (debug) {
amx->stk=stk;
amx->hea=hea;
amx->dbgcode=DBG_RETURN;
amx->dbgparam=pri; /* store "return value" */
amx->debug(amx);
} /* if */
NEXT(cip); NEXT(cip);
op_ret_nodebug: op_ret_nodebug:
POP(frm); POP(frm);
@ -2151,6 +2250,10 @@ static void *amx_opcodelist_nodebug[] = {
cip=(cell *)(code+(int)offs); cip=(cell *)(code+(int)offs);
NEXT(cip); NEXT(cip);
op_retn: op_retn:
if (tracer)
{
(tracer)(amx, 1);
}
POP(frm); POP(frm);
POP(offs); POP(offs);
/* verify the return address */ /* verify the return address */
@ -2158,15 +2261,6 @@ static void *amx_opcodelist_nodebug[] = {
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
cip=(cell *)(code+(int)offs); cip=(cell *)(code+(int)offs);
stk+= *(cell *)(data+(int)stk) + sizeof(cell); /* remove parameters from the stack */ stk+= *(cell *)(data+(int)stk) + sizeof(cell); /* remove parameters from the stack */
if (debug) {
amx->stk=stk;
amx->hea=hea;
amx->dbgcode=DBG_RETURN;
amx->dbgparam=pri; /* store "return value" */
amx->debug(amx);
amx->dbgcode=DBG_CLRSYM;
amx->debug(amx);
} /* if */
NEXT(cip); NEXT(cip);
op_retn_nodebug: op_retn_nodebug:
POP(frm); POP(frm);
@ -2178,26 +2272,24 @@ static void *amx_opcodelist_nodebug[] = {
stk+= *(cell *)(data+(int)stk) + sizeof(cell); /* remove parameters from the stack */ stk+= *(cell *)(data+(int)stk) + sizeof(cell); /* remove parameters from the stack */
NEXT(cip); NEXT(cip);
op_call: op_call:
if (tracer)
{
(tracer)(amx, 2);
}
PUSH(((unsigned char *)cip-code)+sizeof(cell));/* push address behind instruction */ PUSH(((unsigned char *)cip-code)+sizeof(cell));/* push address behind instruction */
cip=JUMPABS(code, cip); /* jump to the address */ cip=JUMPABS(code, cip); /* jump to the address */
if (debug) {
amx->dbgcode=DBG_CALL;
amx->dbgaddr=(ucell)((unsigned char*)cip-code);
amx->debug(amx);
} /* if */
NEXT(cip); NEXT(cip);
op_call_nodebug: op_call_nodebug:
PUSH(((unsigned char *)cip-code)+sizeof(cell));/* push address behind instruction */ PUSH(((unsigned char *)cip-code)+sizeof(cell));/* push address behind instruction */
cip=JUMPABS(code, cip); /* jump to the address */ cip=JUMPABS(code, cip); /* jump to the address */
NEXT(cip); NEXT(cip);
op_call_pri: op_call_pri:
if (tracer)
{
(tracer)(amx, 2);
}
PUSH((unsigned char *)cip-code); PUSH((unsigned char *)cip-code);
cip=(cell *)(code+(int)pri); cip=(cell *)(code+(int)pri);
if (debug) {
amx->dbgcode=DBG_CALL;
amx->dbgaddr=pri;
amx->debug(amx);
} /* if */
NEXT(cip); NEXT(cip);
op_call_pri_nodebug: op_call_pri_nodebug:
PUSH((unsigned char *)cip-code); PUSH((unsigned char *)cip-code);
@ -2529,12 +2621,6 @@ static void *amx_opcodelist_nodebug[] = {
amx->pri=pri; amx->pri=pri;
amx->alt=alt; amx->alt=alt;
amx->cip=(cell)((unsigned char*)cip-code); amx->cip=(cell)((unsigned char*)cip-code);
if (debug) {
amx->dbgcode=DBG_TERMINATE;
amx->dbgaddr=(cell)((unsigned char *)cip-code);
amx->dbgparam=offs;
amx->debug(amx);
} /* if */
if (offs==AMX_ERR_SLEEP) { if (offs==AMX_ERR_SLEEP) {
amx->reset_stk=reset_stk; amx->reset_stk=reset_stk;
amx->reset_hea=reset_hea; amx->reset_hea=reset_hea;
@ -2611,23 +2697,6 @@ static void *amx_opcodelist_nodebug[] = {
assert((amx->flags & AMX_FLAG_BROWSE)==0); assert((amx->flags & AMX_FLAG_BROWSE)==0);
GETPARAM(amx->curline); GETPARAM(amx->curline);
GETPARAM(amx->curfile); GETPARAM(amx->curfile);
if (debug) {
amx->frm=frm;
amx->stk=stk;
amx->hea=hea;
amx->dbgcode=DBG_LINE;
num=amx->debug(amx);
if (num!=AMX_ERR_NONE) {
if (num==AMX_ERR_SLEEP) {
amx->pri=pri;
amx->alt=alt;
amx->cip=(cell)((unsigned char*)cip-code);
amx->reset_stk=reset_stk;
amx->reset_hea=reset_hea;
} /* if */
ABORT(amx,num);
} /* if */
} /* if */
NEXT(cip); NEXT(cip);
op_line_nodebug: op_line_nodebug:
assert((amx->flags & AMX_FLAG_BROWSE)==0); assert((amx->flags & AMX_FLAG_BROWSE)==0);
@ -2643,10 +2712,6 @@ static void *amx_opcodelist_nodebug[] = {
cip=(cell *)((unsigned char *)cip + (int)offs - 2*sizeof(cell)); cip=(cell *)((unsigned char *)cip + (int)offs - 2*sizeof(cell));
amx->dbgcode=DBG_SYMBOL; amx->dbgcode=DBG_SYMBOL;
assert((amx->dbgparam >> 8)>0); /* local symbols only */ assert((amx->dbgparam >> 8)>0); /* local symbols only */
if (debug) {
amx->frm=frm; /* debugger needs this to relocate the symbols */
amx->debug(amx);
} /* if */
NEXT(cip); NEXT(cip);
op_symbol_nodebug: op_symbol_nodebug:
assert((amx->flags & AMX_FLAG_BROWSE)==0); assert((amx->flags & AMX_FLAG_BROWSE)==0);
@ -2658,10 +2723,6 @@ static void *amx_opcodelist_nodebug[] = {
GETPARAM(amx->dbgaddr); /* dimension level */ GETPARAM(amx->dbgaddr); /* dimension level */
GETPARAM(amx->dbgparam); /* length */ GETPARAM(amx->dbgparam); /* length */
amx->dbgcode=DBG_SRANGE; amx->dbgcode=DBG_SRANGE;
if (debug) {
amx->frm=frm; /* debugger needs this to relocate the symbols */
amx->debug(amx);
} /* if */
NEXT(cip); NEXT(cip);
op_srange_nodebug: op_srange_nodebug:
assert((amx->flags & AMX_FLAG_BROWSE)==0); assert((amx->flags & AMX_FLAG_BROWSE)==0);
@ -2671,10 +2732,6 @@ static void *amx_opcodelist_nodebug[] = {
assert((amx->flags & AMX_FLAG_BROWSE)==0); assert((amx->flags & AMX_FLAG_BROWSE)==0);
GETPARAM(amx->dbgparam); /* tag id */ GETPARAM(amx->dbgparam); /* tag id */
amx->dbgcode=DBG_SYMTAG; amx->dbgcode=DBG_SYMTAG;
if (debug) {
amx->frm=frm; /* debugger needs this to relocate the symbols */
amx->debug(amx);
} /* if */
NEXT(cip); NEXT(cip);
op_symtag_nodebug: op_symtag_nodebug:
assert((amx->flags & AMX_FLAG_BROWSE)==0); assert((amx->flags & AMX_FLAG_BROWSE)==0);
@ -2736,16 +2793,25 @@ static void *amx_opcodelist_nodebug[] = {
#endif #endif
#elif defined __GNUC__ #elif defined __GNUC__
/* force "cdecl" by adding an "attribute" to the declaration */ /* force "cdecl" by adding an "attribute" to the declaration */
#if defined __cplusplus
extern "C" cell amx_exec_asm(cell *regs,cell *retval,cell stp,cell hea) __attribute__((cdecl)); extern "C" cell amx_exec_asm(cell *regs,cell *retval,cell stp,cell hea) __attribute__((cdecl));
#else #else
extern cell amx_exec_asm(cell *regs,cell *retval,cell stp,cell hea) __attribute__((cdecl));
#endif
#else
/* force "cdecl" by specifying it as a "function class" with the "__cdecl" keyword */ /* force "cdecl" by specifying it as a "function class" with the "__cdecl" keyword */
extern "C" cell __cdecl amx_exec_asm(cell *regs,cell *retval,cell stp,cell hea); extern "C" cell __cdecl amx_exec_asm(cell *regs,cell *retval,cell stp,cell hea);
#endif #endif
#endif #endif
#if defined ASM32 || defined JIT #if defined ASM32 || defined JIT
#if defined WIN32 || defined __cplusplus
extern "C" void *amx_opcodelist[]; extern "C" void *amx_opcodelist[];
extern "C" void *amx_opcodelist_nodebug[]; extern "C" void *amx_opcodelist_nodebug[];
#else
extern void *amx_opcodelist[];
extern void *amx_opcodelist_nodebug[];
#endif
#endif #endif
int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...) int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
@ -2758,7 +2824,6 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
ucell codesize; ucell codesize;
int i; int i;
va_list ap; va_list ap;
int debug;
#if defined ASM32 || defined JIT #if defined ASM32 || defined JIT
#ifdef __WATCOMC__ #ifdef __WATCOMC__
#pragma aux amx_opcodelist "_*" #pragma aux amx_opcodelist "_*"
@ -2770,6 +2835,8 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
cell offs; cell offs;
int num; int num;
#endif #endif
AMX_DEBUGCALL tracer = 0;
AMX_DBG *pdbg = 0;
#if defined ASM32 || defined JIT #if defined ASM32 || defined JIT
/* HACK: return label table (for amx_BrowseRelocate) if amx structure /* HACK: return label table (for amx_BrowseRelocate) if amx structure
@ -2785,12 +2852,27 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
*/ */
*retval=(cell)amx_opcodelist; *retval=(cell)amx_opcodelist;
#else #else
*retval=(cell)((amx->flags & AMX_FLAG_DEBUG)==0 ? amx_opcodelist_nodebug : amx_opcodelist); if (amx->flags & AMX_FLAG_DEBUG)
{
*retval=(cell)(amx_opcodelist);
} else {
*retval=(cell)(amx_opcodelist_nodebug);
}
#endif #endif
return 0; return 0;
} /* if */ } /* if */
#endif #endif
if ((amx->flags & AMX_FLAG_DEBUG) && (amx->flags & AMX_FLAG_LINEOPS))
{
if (amx->userdata[0])
{
tracer = (AMX_DEBUGCALL)amx->userdata[1];
pdbg = (AMX_DBG *)(amx->userdata[0]);
}
}
if (amx->callback==NULL) if (amx->callback==NULL)
return AMX_ERR_CALLBACK; return AMX_ERR_CALLBACK;
i=amx_Register(amx,NULL,0); /* verify that all natives are registered */ i=amx_Register(amx,NULL,0); /* verify that all natives are registered */
@ -2800,8 +2882,6 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
if ((amx->flags & AMX_FLAG_RELOC)==0) if ((amx->flags & AMX_FLAG_RELOC)==0)
return AMX_ERR_INIT; return AMX_ERR_INIT;
assert((amx->flags & AMX_FLAG_BROWSE)==0); assert((amx->flags & AMX_FLAG_BROWSE)==0);
debug= (amx->flags & AMX_FLAG_DEBUG)!=0;
/* set up the registers */ /* set up the registers */
hdr=(AMX_HEADER *)amx->base; hdr=(AMX_HEADER *)amx->base;
assert(hdr->magic==AMX_MAGIC); assert(hdr->magic==AMX_MAGIC);
@ -2842,15 +2922,6 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
CHKHEAP(); CHKHEAP();
init_little_endian(); init_little_endian();
if (debug && index!=AMX_EXEC_CONT) {
/* set the entry point in the debugger by marking a "call" to the
* exported function
*/
amx->dbgcode=DBG_CALL;
amx->dbgaddr=(ucell)((unsigned char *)cip-code);
amx->debug(amx);
} /* if */
/* sanity checks */ /* sanity checks */
assert(OP_PUSH_PRI==36); assert(OP_PUSH_PRI==36);
assert(OP_PROC==46); assert(OP_PROC==46);
@ -3188,12 +3259,6 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
stk+=offs; stk+=offs;
CHKMARGIN(); CHKMARGIN();
CHKSTACK(); CHKSTACK();
if (debug && offs>0) {
amx->dbgcode=DBG_CLRSYM;
amx->hea=hea;
amx->stk=stk;
amx->debug(amx);
} /* if */
break; break;
case OP_HEAP: case OP_HEAP:
GETPARAM(offs); GETPARAM(offs);
@ -3214,13 +3279,6 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
if ((ucell)offs>=codesize) if ((ucell)offs>=codesize)
ABORT(amx,AMX_ERR_MEMACCESS); ABORT(amx,AMX_ERR_MEMACCESS);
cip=(cell *)(code+(int)offs); cip=(cell *)(code+(int)offs);
if (debug) {
amx->stk=stk;
amx->hea=hea;
amx->dbgcode=DBG_RETURN;
amx->dbgparam=pri; /* store "return value" */
amx->debug(amx);
} /* if */
break; break;
case OP_RETN: case OP_RETN:
POP(frm); POP(frm);
@ -3231,33 +3289,22 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
cip=(cell *)(code+(int)offs); cip=(cell *)(code+(int)offs);
stk+= *(cell *)(data+(int)stk) + sizeof(cell); /* remove parameters from the stack */ stk+= *(cell *)(data+(int)stk) + sizeof(cell); /* remove parameters from the stack */
amx->stk=stk; amx->stk=stk;
if (debug) { if (tracer)
amx->stk=stk; {
amx->hea=hea; (tracer)(amx, 1);
amx->dbgcode=DBG_RETURN; }
amx->dbgparam=pri; /* store "return value" */
amx->debug(amx);
amx->dbgcode=DBG_CLRSYM;
amx->debug(amx);
} /* if */
break; break;
case OP_CALL: case OP_CALL:
PUSH(((unsigned char *)cip-code)+sizeof(cell));/* skip address */ PUSH(((unsigned char *)cip-code)+sizeof(cell));/* skip address */
cip=JUMPABS(code, cip); /* jump to the address */ cip=JUMPABS(code, cip); /* jump to the address */
if (debug) { if (tracer)
amx->dbgcode=DBG_CALL; {
amx->dbgaddr=(ucell)((unsigned char *)cip-code); (tracer)(amx, 2);
amx->debug(amx); }
} /* if */
break; break;
case OP_CALL_PRI: case OP_CALL_PRI:
PUSH((unsigned char *)cip-code); PUSH((unsigned char *)cip-code);
cip=(cell *)(code+(int)pri); cip=(cell *)(code+(int)pri);
if (debug) {
amx->dbgcode=DBG_CALL;
amx->dbgaddr=pri;
amx->debug(amx);
} /* if */
break; break;
case OP_JUMP: case OP_JUMP:
/* since the GETPARAM() macro modifies cip, you cannot /* since the GETPARAM() macro modifies cip, you cannot
@ -3372,7 +3419,6 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
if (alt==0) if (alt==0)
ABORT(amx,AMX_ERR_DIVIDE); ABORT(amx,AMX_ERR_DIVIDE);
/* divide must always round down; this is a bit /* divide must always round down; this is a bit
* involved to do in a machine-independent way.
*/ */
offs=(pri % alt + alt) % alt; /* true modulus */ offs=(pri % alt + alt) % alt; /* true modulus */
pri=(pri - offs) / alt; /* division result */ pri=(pri - offs) / alt; /* division result */
@ -3585,12 +3631,6 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
amx->pri=pri; amx->pri=pri;
amx->alt=alt; amx->alt=alt;
amx->cip=(cell)((unsigned char*)cip-code); amx->cip=(cell)((unsigned char*)cip-code);
if (debug) {
amx->dbgcode=DBG_TERMINATE;
amx->dbgaddr=(cell)((unsigned char *)cip-code);
amx->dbgparam=offs;
amx->debug(amx);
} /* if */
if (offs==AMX_ERR_SLEEP) { if (offs==AMX_ERR_SLEEP) {
amx->reset_stk=reset_stk; amx->reset_stk=reset_stk;
amx->reset_hea=reset_hea; amx->reset_hea=reset_hea;
@ -3667,23 +3707,6 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
assert((amx->flags & AMX_FLAG_BROWSE)==0); assert((amx->flags & AMX_FLAG_BROWSE)==0);
GETPARAM(amx->curline); GETPARAM(amx->curline);
GETPARAM(amx->curfile); GETPARAM(amx->curfile);
if (debug) {
amx->frm=frm;
amx->stk=stk;
amx->hea=hea;
amx->dbgcode=DBG_LINE;
num=amx->debug(amx);
if (num!=AMX_ERR_NONE) {
if (num==AMX_ERR_SLEEP) {
amx->pri=pri;
amx->alt=alt;
amx->cip=(cell)((unsigned char*)cip-code);
amx->reset_stk=reset_stk;
amx->reset_hea=reset_hea;
} /* if */
ABORT(amx,num);
} /* if */
} /* if */
break; break;
case OP_SYMBOL: case OP_SYMBOL:
assert((amx->flags & AMX_FLAG_BROWSE)==0); assert((amx->flags & AMX_FLAG_BROWSE)==0);
@ -3693,30 +3716,15 @@ int AMXAPI amx_Exec(AMX *amx, cell *retval, int index, int numparams, ...)
amx->dbgname=(char *)cip; amx->dbgname=(char *)cip;
cip=(cell *)((unsigned char *)cip + (int)offs - 2*sizeof(cell)); cip=(cell *)((unsigned char *)cip + (int)offs - 2*sizeof(cell));
assert((amx->dbgparam >> 8)>0); /* local symbols only */ assert((amx->dbgparam >> 8)>0); /* local symbols only */
if (debug) {
amx->frm=frm; /* debugger needs this to relocate the symbols */
amx->dbgcode=DBG_SYMBOL;
amx->debug(amx);
} /* if */
break; break;
case OP_SRANGE: case OP_SRANGE:
assert((amx->flags & AMX_FLAG_BROWSE)==0); assert((amx->flags & AMX_FLAG_BROWSE)==0);
GETPARAM(amx->dbgaddr); /* dimension level */ GETPARAM(amx->dbgaddr); /* dimension level */
GETPARAM(amx->dbgparam); /* length */ GETPARAM(amx->dbgparam); /* length */
if (debug) {
amx->frm=frm; /* debugger needs this to relocate the symbols */
amx->dbgcode=DBG_SRANGE;
amx->debug(amx);
} /* if */
break; break;
case OP_SYMTAG: case OP_SYMTAG:
assert((amx->flags & AMX_FLAG_BROWSE)==0); assert((amx->flags & AMX_FLAG_BROWSE)==0);
GETPARAM(amx->dbgparam); /* tag id */ GETPARAM(amx->dbgparam); /* tag id */
if (debug) {
amx->frm=frm; /* debugger needs this to relocate the symbols */
amx->dbgcode=DBG_SYMTAG;
amx->debug(amx);
} /* if */
break; break;
case OP_JUMP_PRI: case OP_JUMP_PRI:
cip=(cell *)(code+(int)pri); cip=(cell *)(code+(int)pri);
@ -4039,7 +4047,7 @@ static long utf8_lowmark[5] = { 0x80, 0x800, 0x10000, 0x200000, 0x4000000 };
*/ */
if (result<utf8_lowmark[followup]) if (result<utf8_lowmark[followup])
goto error; goto error;
if (result>=0xd800 && result<=0xdfff || result==0xfffe || result==0xffff) if ((result>=0xd800 && result<=0xdfff) || result==0xfffe || result==0xffff)
goto error; goto error;
} /* if */ } /* if */

View File

@ -22,14 +22,12 @@
*/ */
#if defined __linux__ #if defined __linux__
#include "sclinux.h" #include <sclinux.h>
#endif #endif
#ifndef AMX_H_INCLUDED #ifndef AMX_H_INCLUDED
#define AMX_H_INCLUDED #define AMX_H_INCLUDED
//#define JIT
#if defined __LCC__ || defined __DMC__ || defined __linux__ #if defined __LCC__ || defined __DMC__ || defined __linux__
#include <stdint.h> #include <stdint.h>
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L #elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
@ -48,14 +46,15 @@
typedef long int int32_t; typedef long int int32_t;
typedef unsigned long int uint32_t; typedef unsigned long int uint32_t;
#endif #endif
#if defined __WIN32__ || defined _WIN32 || defined WIN32 // evilspy's fix for mingw
typedef __int64 int64_t; #if defined __GNUC__
typedef unsigned __int64 uint64_t;
#define HAVE_I64
#elif defined __GNUC__
typedef long long int64_t; typedef long long int64_t;
typedef unsigned long long uint64_t; typedef unsigned long long uint64_t;
#define HAVE_I64 #define HAVE_I64
#elif defined __WIN32__ || defined _WIN32 || defined WIN32
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#define HAVE_I64
#endif #endif
#endif #endif
#endif #endif
@ -136,6 +135,7 @@ typedef cell (AMX_NATIVE_CALL *AMX_NATIVE)(struct tagAMX *amx, cell *params);
typedef int (AMXAPI *AMX_CALLBACK)(struct tagAMX *amx, cell index, typedef int (AMXAPI *AMX_CALLBACK)(struct tagAMX *amx, cell index,
cell *result, cell *params); cell *result, cell *params);
typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx); typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
typedef int (AMXAPI *AMX_DEBUGCALL)(struct tagAMX *amx, int mode);
#if !defined _FAR #if !defined _FAR
#define _FAR #define _FAR
#endif #endif
@ -219,11 +219,9 @@ typedef struct tagAMX {
cell reset_stk PACKED; cell reset_stk PACKED;
cell reset_hea PACKED; cell reset_hea PACKED;
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */ cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
#if defined JIT
/* support variables for the JIT */ /* support variables for the JIT */
int reloc_size PACKED; /* required temporary buffer for relocations */ int reloc_size PACKED; /* required temporary buffer for relocations */
long code_size PACKED; /* estimated memory footprint of the native code */ long code_size PACKED; /* estimated memory footprint of the native code */
#endif
} AMX; } AMX;
/* The AMX_HEADER structure is both the memory format as the file format. The /* The AMX_HEADER structure is both the memory format as the file format. The
@ -250,6 +248,23 @@ typedef struct tagAMX_HEADER {
} AMX_HEADER PACKED; } AMX_HEADER PACKED;
#define AMX_MAGIC 0xf1e0 #define AMX_MAGIC 0xf1e0
//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;
enum { enum {
AMX_ERR_NONE, AMX_ERR_NONE,
/* reserve the first 15 error codes for exit codes of the abstract machine */ /* reserve the first 15 error codes for exit codes of the abstract machine */
@ -297,6 +312,8 @@ enum {
#define AMX_FLAG_COMPACT 0x04 /* compact encoding */ #define AMX_FLAG_COMPACT 0x04 /* compact encoding */
#define AMX_FLAG_BIGENDIAN 0x08 /* big endian encoding */ #define AMX_FLAG_BIGENDIAN 0x08 /* big endian encoding */
#define AMX_FLAG_NOCHECKS 0x10 /* no array bounds checking */ #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_BROWSE 0x4000 /* browsing/relocating or executing */
#define AMX_FLAG_RELOC 0x8000 /* jump/call addresses relocated */ #define AMX_FLAG_RELOC 0x8000 /* jump/call addresses relocated */
@ -337,6 +354,7 @@ uint32_t * AMXAPI amx_Align32(uint32_t *v);
#if defined _I64_MAX || defined HAVE_I64 #if defined _I64_MAX || defined HAVE_I64
uint64_t * AMXAPI amx_Align64(uint64_t *v); uint64_t * AMXAPI amx_Align64(uint64_t *v);
#endif #endif
#if SMALL_CELL_SIZE==32 #if SMALL_CELL_SIZE==32
#define amx_AlignCell amx_Align32 #define amx_AlignCell amx_Align32
#elif SMALL_CELL_SIZE==64 #elif SMALL_CELL_SIZE==64
@ -344,11 +362,13 @@ uint32_t * AMXAPI amx_Align32(uint32_t *v);
#else #else
#error Unsupported cell size #error Unsupported cell size
#endif #endif
int AMXAPI amx_Allot(AMX *amx, int cells, cell *amx_addr, cell **phys_addr); 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_Callback(AMX *amx, cell index, cell *result, cell *params);
int AMXAPI amx_Cleanup(AMX *amx); int AMXAPI amx_Cleanup(AMX *amx);
int AMXAPI amx_Clone(AMX *amxClone, AMX *amxSource, void *data); int AMXAPI amx_Clone(AMX *amxClone, AMX *amxSource, void *data);
int AMXAPI amx_Debug(AMX *amx); /* default debug procedure, does nothing */ 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_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_Execv(AMX *amx, cell *retval, int index, int numparams, cell params[]);
int AMXAPI amx_FindNative(AMX *amx, const char *name, int *index); int AMXAPI amx_FindNative(AMX *amx, const char *name, int *index);
@ -383,7 +403,7 @@ int AMXAPI amx_StrLen(cell *cstring, int *length);
int AMXAPI amx_UTF8Get(const char *string, const char **endptr, cell *value); int AMXAPI amx_UTF8Get(const char *string, const char **endptr, cell *value);
int AMXAPI amx_UTF8Put(char *string, char **endptr, int maxchars, cell value); int AMXAPI amx_UTF8Put(char *string, char **endptr, int maxchars, cell value);
int AMXAPI amx_UTF8Check(const char *string); int AMXAPI amx_UTF8Check(const char *string);
void amx_NullNativeTable(AMX *amx);
#if !defined AMX_NO_ALIGN #if !defined AMX_NO_ALIGN
#if defined __linux__ #if defined __linux__

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 ;

2110
amxmodx/amxexecn.asm Executable file

File diff suppressed because it is too large Load Diff

View File

@ -70,8 +70,8 @@ static cell AMX_NATIVE_CALL emit_sound(AMX *amx, cell *params) /* 7 param */
int len; int len;
char* szSample = get_amxstring(amx,params[3],0,len); char* szSample = get_amxstring(amx,params[3],0,len);
float vol = *(REAL *)((void *)&params[4]); REAL vol = amx_ctof(params[4]);
float att = *(REAL *)((void *)&params[5]); REAL att = amx_ctof(params[5]);
int channel = params[2]; int channel = params[2];
int pitch = params[7]; int pitch = params[7];
int flags = params[6]; int flags = params[6];
@ -273,13 +273,13 @@ static cell AMX_NATIVE_CALL set_hudmessage(AMX *amx, cell *params) /* 11 param
g_hudset.r1 = params[1]; g_hudset.r1 = params[1];
g_hudset.g1 = params[2]; g_hudset.g1 = params[2];
g_hudset.b1 = params[3]; g_hudset.b1 = params[3];
g_hudset.x = *(REAL *)((void *)&params[4]); g_hudset.x = amx_ctof(params[4]);
g_hudset.y = *(REAL *)((void *)&params[5]); g_hudset.y = amx_ctof(params[5]);
g_hudset.effect = params[6]; g_hudset.effect = params[6];
g_hudset.fxTime = *(REAL *)((void *)&params[7]); g_hudset.fxTime = amx_ctof(params[7]);
g_hudset.holdTime = *(REAL *)((void *)&params[8]); g_hudset.holdTime = amx_ctof(params[8]);
g_hudset.fadeinTime = *(REAL *)((void *)&params[9]); g_hudset.fadeinTime = amx_ctof(params[9]);
g_hudset.fadeoutTime = *(REAL *)((void *)&params[10]); g_hudset.fadeoutTime = amx_ctof(params[10]);
g_hudset.channel = params[11]; g_hudset.channel = params[11];
return 1; return 1;
} }
@ -351,6 +351,15 @@ static cell AMX_NATIVE_CALL is_linux_server(AMX *amx, cell *params)
#endif #endif
} }
static cell AMX_NATIVE_CALL is_amd64_server(AMX *amx, cell *params)
{
#if SMALL_CELL_SIZE==64
return 1;
#else
return 0;
#endif
}
static cell AMX_NATIVE_CALL is_jit_enabled(AMX *amx, cell *params) // PM: Useless ;P static cell AMX_NATIVE_CALL is_jit_enabled(AMX *amx, cell *params) // PM: Useless ;P
{ {
#ifdef JIT #ifdef JIT
@ -1159,13 +1168,13 @@ static cell AMX_NATIVE_CALL get_cvar_float(AMX *amx, cell *params) /* 1 param */
{ {
int ilen; int ilen;
REAL pFloat = CVAR_GET_FLOAT(get_amxstring(amx,params[1],0,ilen)); REAL pFloat = CVAR_GET_FLOAT(get_amxstring(amx,params[1],0,ilen));
return *(cell*)((void *)&pFloat); return amx_ftoc(pFloat);
} }
static cell AMX_NATIVE_CALL set_cvar_float(AMX *amx, cell *params) /* 2 param */ static cell AMX_NATIVE_CALL set_cvar_float(AMX *amx, cell *params) /* 2 param */
{ {
int ilen; int ilen;
CVAR_SET_FLOAT(get_amxstring(amx,params[1],0,ilen),*(REAL *)((void *)&params[2])); CVAR_SET_FLOAT(get_amxstring(amx,params[1],0,ilen), amx_ctof(params[2]));
return 1; return 1;
} }
@ -1196,6 +1205,14 @@ static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */
int numparam = *params/sizeof(cell); int numparam = *params/sizeof(cell);
float vecOrigin[3]; float vecOrigin[3];
cell *cpOrigin; cell *cpOrigin;
if (params[2] < 1 || ((params[2] > 63) // maximal number of engine messages
&& !GET_USER_MSG_NAME(PLID, params[2], NULL)))
{
AMXXLOG_Log("[AMXX] Plugin called message_begin with an invalid message id (%d).", params[2]);
amx_RaiseError(amx, AMX_ERR_NATIVE);
return 0;
}
switch (params[1]){ switch (params[1]){
case MSG_BROADCAST: case MSG_BROADCAST:
case MSG_ALL: case MSG_ALL:
@ -1203,6 +1220,7 @@ static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */
MESSAGE_BEGIN( params[1], params[2],NULL ); MESSAGE_BEGIN( params[1], params[2],NULL );
break; break;
case MSG_PVS: case MSG_PAS: case MSG_PVS: case MSG_PAS:
case MSG_PVS_R: case MSG_PAS_R:
if (numparam < 3) { if (numparam < 3) {
amx_RaiseError(amx,AMX_ERR_NATIVE); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
@ -1213,12 +1231,13 @@ static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */
vecOrigin[2] = *(cpOrigin+2); vecOrigin[2] = *(cpOrigin+2);
MESSAGE_BEGIN( params[1], params[2] , vecOrigin ); MESSAGE_BEGIN( params[1], params[2] , vecOrigin );
break; break;
case MSG_ONE_UNRELIABLE:
case MSG_ONE: case MSG_ONE:
if (numparam < 4) { if (numparam < 4) {
amx_RaiseError(amx,AMX_ERR_NATIVE); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
MESSAGE_BEGIN( MSG_ONE, params[2], NULL, INDEXENT(params[4]) ); MESSAGE_BEGIN( params[1], params[2], NULL, INDEXENT(params[4]) );
break; break;
} }
@ -1434,10 +1453,10 @@ static cell AMX_NATIVE_CALL read_data(AMX *amx, cell *params) /* 3 param */
case 3: case 3:
return set_amxstring(amx,params[2], g_events.getArgString( params[1] ),*get_amxaddr(amx,params[3])); return set_amxstring(amx,params[2], g_events.getArgString( params[1] ),*get_amxaddr(amx,params[3]));
default: default:
cell *fCell = get_amxaddr(amx,params[2]); cell *fCell = get_amxaddr(amx, params[2]);
REAL pFloat = amx_ctof(fCell); float fparam = g_events.getArgFloat(params[1]);
pFloat = g_events.getArgFloat( params[1] ); fCell[0] = amx_ftoc(fparam);
return (int)(pFloat); return (int)fparam;
} }
} }
@ -1584,7 +1603,7 @@ static cell AMX_NATIVE_CALL get_maxplayers(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL get_gametime(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_gametime(AMX *amx, cell *params)
{ {
REAL pFloat = gpGlobals->time; REAL pFloat = gpGlobals->time;
return *(cell*)((void *)&pFloat); return amx_ftoc(pFloat);
} }
static cell AMX_NATIVE_CALL get_mapname(AMX *amx, cell *params) /* 2 param */ static cell AMX_NATIVE_CALL get_mapname(AMX *amx, cell *params) /* 2 param */
@ -1667,6 +1686,16 @@ static cell AMX_NATIVE_CALL get_user_msgid(AMX *amx, cell *params) /* 1 param */
return GET_USER_MSG_ID(PLID, sptemp , NULL ); return GET_USER_MSG_ID(PLID, sptemp , NULL );
} }
static cell AMX_NATIVE_CALL get_user_msgname(AMX *amx, cell *params) /* get_user_msgname(msg, str[], len) = 3 params */
{
const char* STRING = GET_USER_MSG_NAME(PLID, params[1], NULL);
if (STRING)
return set_amxstring(amx, params[2], STRING, params[3]);
// Comes here if GET_USER_MSG_NAME failed (ie, invalid msg id)
return 0;
}
static cell AMX_NATIVE_CALL set_task(AMX *amx, cell *params) /* 2 param */ static cell AMX_NATIVE_CALL set_task(AMX *amx, cell *params) /* 2 param */
{ {
@ -1676,23 +1705,27 @@ static cell AMX_NATIVE_CALL set_task(AMX *amx, cell *params) /* 2 param */
char* stemp = get_amxstring(amx,params[2],1, a ); char* stemp = get_amxstring(amx,params[2],1, a );
if (amx_FindPublic(amx, stemp , &iFunc) != AMX_ERR_NONE){ if (params[5])
{
iFunc = registerSPForwardByName(amx, stemp, FP_ARRAY, FP_CELL, FP_DONE);
} else {
iFunc = registerSPForwardByName(amx, stemp, FP_CELL, FP_DONE);
}
if (iFunc == -1)
{
AMXXLOG_Log("[AMXX] Function is not present (function \"%s\") (plugin \"%s\")",stemp,plugin->getName() ); AMXXLOG_Log("[AMXX] Function is not present (function \"%s\") (plugin \"%s\")",stemp,plugin->getName() );
amx_RaiseError(amx,AMX_ERR_NATIVE); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
float base = *(REAL *)((void *)&params[1]); float base = amx_ctof(params[1]);
if ( base < 0.1 ) if ( base < 0.1 )
base = 0.1; base = 0.1;
char* temp = get_amxstring(amx,params[6],0,a); char* temp = get_amxstring(amx,params[6],0,a);
g_tasksMngr.registerTask( plugin , g_tasksMngr.registerTask( plugin , iFunc , UTIL_ReadFlags(temp), params[3], base , params[5] , get_amxaddr(amx,params[4]) , params[7] );
iFunc , UTIL_ReadFlags(temp), params[3], base ,
params[5] ,
get_amxaddr(amx,params[4]) , params[7] );
return 1; return 1;
} }
@ -1728,7 +1761,7 @@ static cell AMX_NATIVE_CALL register_cvar(AMX *amx, cell *params) /* 3 param */
{ {
CPluginMngr::CPlugin *plugin = g_plugins.findPluginFast(amx); CPluginMngr::CPlugin *plugin = g_plugins.findPluginFast(amx);
CCVar* cvar = new CCVar( temp , plugin->getName() , params[3] , CCVar* cvar = new CCVar( temp , plugin->getName() , params[3] ,
*(REAL *)((void *)&params[4]) ); amx_ctof(params[4]) );
if ( cvar == 0 ) if ( cvar == 0 )
return 0; return 0;
@ -1736,7 +1769,11 @@ static cell AMX_NATIVE_CALL register_cvar(AMX *amx, cell *params) /* 3 param */
g_cvars.put( cvar ); g_cvars.put( cvar );
if ( CVAR_GET_POINTER(temp) == 0 ) if ( CVAR_GET_POINTER(temp) == 0 )
CVAR_REGISTER( cvar->getCvar() ); {
static cvar_t cvar_reg_helper;
cvar_reg_helper = *(cvar->getCvar());
CVAR_REGISTER( &cvar_reg_helper );
}
CVAR_SET_STRING( temp ,get_amxstring(amx,params[2],1,i)); CVAR_SET_STRING( temp ,get_amxstring(amx,params[2],1,i));
return 1; return 1;
@ -2011,10 +2048,10 @@ static cell AMX_NATIVE_CALL get_distance(AMX *amx, cell *params) /* 2 param */
static cell AMX_NATIVE_CALL random_float(AMX *amx, cell *params) /* 2 param */ static cell AMX_NATIVE_CALL random_float(AMX *amx, cell *params) /* 2 param */
{ {
float one = *(REAL *)((void *)&params[1]); float one = amx_ctof(params[1]);
float two = *(REAL *)((void *)&params[2]); float two = amx_ctof(params[2]);
REAL fRnd = RANDOM_FLOAT(one,two); REAL fRnd = RANDOM_FLOAT(one,two);
return *(cell*)((void *)&fRnd); return amx_ftoc(fRnd);
} }
static cell AMX_NATIVE_CALL random_num(AMX *amx, cell *params) /* 2 param */ static cell AMX_NATIVE_CALL random_num(AMX *amx, cell *params) /* 2 param */
@ -2253,7 +2290,7 @@ static cell AMX_NATIVE_CALL is_module_loaded(AMX *amx, cell *params)
int len; int len;
char *name = get_amxstring(amx, params[1], 0, len); char *name = get_amxstring(amx, params[1], 0, len);
int id = 0; int id = 0;
for (CList<CModule>::iterator iter = g_modules.begin(); iter; ++iter) for (CList<CModule,const char *>::iterator iter = g_modules.begin(); iter; ++iter)
{ {
if (stricmp((*iter).getName(), name) == 0) if (stricmp((*iter).getName(), name) == 0)
return id; return id;
@ -2286,7 +2323,7 @@ static cell AMX_NATIVE_CALL get_modulesnum(AMX *amx, cell *params)
// native get_module(id, name[], nameLen, author[], authorLen, version[], versionLen, &status); // native get_module(id, name[], nameLen, author[], authorLen, version[], versionLen, &status);
static cell AMX_NATIVE_CALL get_module(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_module(AMX *amx, cell *params)
{ {
CList<CModule>::iterator moduleIter; CList<CModule,const char *>::iterator moduleIter;
// find the module // find the module
int i = params[1]; int i = params[1];
@ -2300,16 +2337,16 @@ static cell AMX_NATIVE_CALL get_module(AMX *amx, cell *params)
if ((*moduleIter).isAmxx()) if ((*moduleIter).isAmxx())
{ {
const amxx_module_info_s *info = (*moduleIter).getInfoNew(); const amxx_module_info_s *info = (*moduleIter).getInfoNew();
set_amxstring(amx, params[2], info->name, params[3]); set_amxstring(amx, params[2], info && info->name ? info->name : "unk", params[3]);
set_amxstring(amx, params[4], info->author, params[5]); set_amxstring(amx, params[4], info && info->author ? info->author : "unk", params[5]);
set_amxstring(amx, params[6], info->version, params[7]); set_amxstring(amx, params[6], info && info->version ? info->version : "unk", params[7]);
} }
else else
{ {
module_info_s *info = (*moduleIter).getInfo(); module_info_s *info = (*moduleIter).getInfo();
set_amxstring(amx, params[2], info->name, params[3]); set_amxstring(amx, params[2], info && info->name ? info->name : "unk", params[3]);
set_amxstring(amx, params[4], info->author, params[5]); set_amxstring(amx, params[4], info && info->author ? info->author : "unk", params[5]);
set_amxstring(amx, params[6], info->version, params[7]); set_amxstring(amx, params[6], info && info->version ? info->version : "unk", params[7]);
} }
// compatibility problem possible // compatibility problem possible
@ -2404,6 +2441,49 @@ static cell AMX_NATIVE_CALL callfunc_begin(AMX *amx, cell *params)
return 1; // success: 1 return 1; // success: 1
} }
// native callfunc_begin_i(funcId, pluginId = -1)
static cell AMX_NATIVE_CALL callfunc_begin_i(AMX *amx, cell *params)
{
CPluginMngr::CPlugin *plugin;
if (params[2] < 0)
plugin = g_plugins.findPluginFast(amx);
else
plugin = g_plugins.findPlugin(params[2]);
if (!plugin)
return -1;
if (!plugin->isExecutable(params[1]))
return -2;
g_CallFunc_Plugin = plugin;
g_CallFunc_Func = params[1];
return 1;
}
// native get_func_id(funcName[], pluginId = -1)
static cell AMX_NATIVE_CALL get_func_id(AMX *amx, cell *params)
{
CPluginMngr::CPlugin *plugin;
if (params[2] < 0)
plugin = g_plugins.findPluginFast(amx);
else
plugin = g_plugins.findPlugin(params[2]);
if (!plugin)
return -1;
int len;
const char *funcName = get_amxstring(amx, params[1], 0, len);
int index;
if (amx_FindPublic(plugin->getAMX(), funcName, &index) != AMX_ERR_NONE)
index = -1;
return index;
}
// native callfunc_end(); // native callfunc_end();
static cell AMX_NATIVE_CALL callfunc_end(AMX *amx, cell *params) static cell AMX_NATIVE_CALL callfunc_end(AMX *amx, cell *params)
{ {
@ -2438,7 +2518,7 @@ static cell AMX_NATIVE_CALL callfunc_end(AMX *amx, cell *params)
// actual call // actual call
if ((err = amx_Execv(plugin->getAMX(), &retVal, func, curParam, gparams)) != AMX_ERR_NONE) if ((err = amx_Execv(plugin->getAMX(), &retVal, func, curParam, gparams)) != AMX_ERR_NONE)
{ {
AMXXLOG_Log("[AMXX] Run time error %d on line %ld (plugin \"%s\")", err, curPlugin->getAMX()->curline, curPlugin->getName()); LogError(amx, err, "");
return 0; return 0;
} }
@ -2469,7 +2549,7 @@ static cell AMX_NATIVE_CALL callfunc_end(AMX *amx, cell *params)
// native callfunc_push_int(value); // native callfunc_push_int(value);
// native callfunc_push_float(Float: value); // native callfunc_push_float(Float: value);
static cell callfunc_push_byval(AMX *amx, cell *params) static cell AMX_NATIVE_CALL callfunc_push_byval(AMX *amx, cell *params)
{ {
CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx); CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx);
if (!g_CallFunc_Plugin) if (!g_CallFunc_Plugin)
@ -2495,7 +2575,7 @@ static cell callfunc_push_byval(AMX *amx, cell *params)
// native callfunc_push_intref(&value); // native callfunc_push_intref(&value);
// native callfunc_push_floatref(Float: &value); // native callfunc_push_floatref(Float: &value);
static cell callfunc_push_byref(AMX *amx, cell *params) static cell AMX_NATIVE_CALL callfunc_push_byref(AMX *amx, cell *params)
{ {
CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx); CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx);
if (!g_CallFunc_Plugin) if (!g_CallFunc_Plugin)
@ -2553,7 +2633,7 @@ static cell callfunc_push_byref(AMX *amx, cell *params)
} }
// native callfunc_push_str(value[]); // native callfunc_push_str(value[]);
static cell callfunc_push_str(AMX *amx, cell *params) static cell AMX_NATIVE_CALL callfunc_push_str(AMX *amx, cell *params)
{ {
CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx); CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx);
if (!g_CallFunc_Plugin) if (!g_CallFunc_Plugin)
@ -2614,34 +2694,95 @@ static cell callfunc_push_str(AMX *amx, cell *params)
} }
// get_langsnum(); // get_langsnum();
static cell get_langsnum(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_langsnum(AMX *amx, cell *params)
{ {
return g_langMngr.GetLangsNum(); return g_langMngr.GetLangsNum();
} }
// get_lang(id, name[(at least 3)]); // get_lang(id, name[(at least 3)]);
static cell get_lang(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_lang(AMX *amx, cell *params)
{ {
set_amxstring(amx, params[2], g_langMngr.GetLangName(params[1]), 2); set_amxstring(amx, params[2], g_langMngr.GetLangName(params[1]), 2);
return 0; return 0;
} }
// register_dictionary(const filename[]); // register_dictionary(const filename[]);
static cell register_dictionary(AMX *amx, cell *params) static cell AMX_NATIVE_CALL register_dictionary(AMX *amx, cell *params)
{ {
int len; int len;
int result = g_langMngr.MergeDefinitionFile(build_pathname("%s/lang/%s", int result = g_langMngr.MergeDefinitionFile(build_pathname("%s/lang/%s",
get_localinfo("amxx_datadir", "addons/amxx/data"), get_amxstring(amx, params[1], 1, len))); get_localinfo("amxx_datadir", "addons/amxmodx/data"), get_amxstring(amx, params[1], 1, len)));
return result; return result;
} }
static cell AMX_NATIVE_CALL plugin_flags(AMX *amx, cell *params)
{
AMX_HEADER *hdr;
hdr = (AMX_HEADER *)amx->base;
return hdr->flags;
}
// lang_exists(const name[]); // lang_exists(const name[]);
static cell lang_exists(AMX *amx, cell *params) static cell AMX_NATIVE_CALL lang_exists(AMX *amx, cell *params)
{ {
int len = 0; int len = 0;
return g_langMngr.LangExists(get_amxstring(amx, params[1], 1, len)) ? 1 : 0; return g_langMngr.LangExists(get_amxstring(amx, params[1], 1, len)) ? 1 : 0;
} }
cell AMX_NATIVE_CALL require_module(AMX *amx, cell *params)
{
int len = 0;
String s;
s.assign(get_amxstring(amx, params[1], 0, len));
CurModuleList.push(s);
return 1;
}
static cell AMX_NATIVE_CALL lang_phrase(AMX *amx, cell *params)
{
int len = 0;
int iLang = params[1];
const char *cpLangName=NULL;
// Handle player ids (1-32) and server language
if (iLang == LANG_SERVER) { // LANG_SERVER
cpLangName = g_vault.get("server_language");
} else if (iLang >= 1 && iLang <= 32) { // Direct Client Id
if ((int)CVAR_GET_FLOAT("amx_client_languages") == 0)
{
cpLangName = g_vault.get("server_language");
} else {
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(iLang)->pEdict, "lang");
}
}
if (!cpLangName || strlen(cpLangName) < 1)
cpLangName = "en";
const char *str = get_amxstring(amx, params[2], 0, len);
const char *dat = g_langMngr.GetDef(cpLangName, str);
set_amxstring(amx, params[3], dat?dat:"ML_LNOTFOUND", params[4]);
return 1;
}
static cell AMX_NATIVE_CALL amx_mkdir(AMX *amx, cell *params)
{
int len = 0;
char *path = get_amxstring(amx, params[1], 0, len);
#ifdef __linux__
return mkdir(path, 0700);
#else
return mkdir(path);
#endif
}
AMX_NATIVE_INFO amxmod_Natives[] = { AMX_NATIVE_INFO amxmod_Natives[] = {
{ "client_cmd", client_cmd }, { "client_cmd", client_cmd },
{ "client_print", client_print }, { "client_print", client_print },
@ -2692,6 +2833,7 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
{ "get_user_ip", get_user_ip }, { "get_user_ip", get_user_ip },
{ "get_user_menu", get_user_menu}, { "get_user_menu", get_user_menu},
{ "get_user_msgid", get_user_msgid}, { "get_user_msgid", get_user_msgid},
{ "get_user_msgname", get_user_msgname},
{ "get_user_name", get_user_name }, { "get_user_name", get_user_name },
{ "get_user_origin", get_user_origin}, { "get_user_origin", get_user_origin},
{ "get_user_ping", get_user_ping }, { "get_user_ping", get_user_ping },
@ -2707,6 +2849,7 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
{ "get_xvar_num", get_xvar_num }, { "get_xvar_num", get_xvar_num },
{ "is_dedicated_server",is_dedicated_server }, { "is_dedicated_server",is_dedicated_server },
{ "is_linux_server", is_linux_server }, { "is_linux_server", is_linux_server },
{ "is_amd64_server", is_amd64_server },
{ "is_jit_enabled", is_jit_enabled }, { "is_jit_enabled", is_jit_enabled },
{ "is_user_authorized", is_user_authorized }, { "is_user_authorized", is_user_authorized },
{ "is_map_valid", is_map_valid }, { "is_map_valid", is_map_valid },
@ -2741,6 +2884,7 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
{ "register_logevent",register_logevent}, { "register_logevent",register_logevent},
{ "register_menucmd", register_menucmd }, { "register_menucmd", register_menucmd },
{ "register_menuid", register_menuid }, { "register_menuid", register_menuid },
{ "require_module", require_module },
{ "register_plugin", register_plugin }, { "register_plugin", register_plugin },
{ "register_srvcmd", register_srvcmd }, { "register_srvcmd", register_srvcmd },
{ "remove_cvar_flags", remove_cvar_flags }, { "remove_cvar_flags", remove_cvar_flags },
@ -2775,7 +2919,9 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
{ "get_modulesnum", get_modulesnum }, { "get_modulesnum", get_modulesnum },
{ "get_module", get_module }, { "get_module", get_module },
{ "log_amx", log_amx }, { "log_amx", log_amx },
{ "get_func_id", get_func_id },
{ "callfunc_begin", callfunc_begin }, { "callfunc_begin", callfunc_begin },
{ "callfunc_begin_i", callfunc_begin_i },
{ "callfunc_end", callfunc_end }, { "callfunc_end", callfunc_end },
{ "callfunc_push_int", callfunc_push_byval }, { "callfunc_push_int", callfunc_push_byval },
{ "callfunc_push_str", callfunc_push_str }, { "callfunc_push_str", callfunc_push_str },
@ -2798,5 +2944,8 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
{ "lang_exists", lang_exists }, { "lang_exists", lang_exists },
{ "md5", amx_md5 }, { "md5", amx_md5 },
{ "md5_file", amx_md5_file }, { "md5_file", amx_md5_file },
{ "plugin_flags", plugin_flags},
{ "lang_phrase", lang_phrase},
{ "mkdir", amx_mkdir},
{ NULL, NULL } { NULL, NULL }
}; };

View File

@ -33,9 +33,15 @@
#define AMXMODX_H #define AMXMODX_H
#ifdef __linux__
#include <unistd.h>
#include <stdlib.h>
#endif
#include <ctype.h> //tolower, etc
#include "string.h" #include "string.h"
#include <extdll.h> #include <extdll.h>
#include <meta_api.h> #include <meta_api.h>
#include "mm_pextensions.h" // metamod-p extensions
#ifdef MEMORY_TEST #ifdef MEMORY_TEST
#include "mmgr/mmgr.h" #include "mmgr/mmgr.h"
@ -62,7 +68,7 @@
#include "amxxlog.h" #include "amxxlog.h"
#define AMXXLOG_Log g_log.Log #define AMXXLOG_Log g_log.Log
#define AMX_VERSION "0.2" #define AMX_VERSION "1.01"
extern AMX_NATIVE_INFO core_Natives[]; extern AMX_NATIVE_INFO core_Natives[];
extern AMX_NATIVE_INFO time_Natives[]; extern AMX_NATIVE_INFO time_Natives[];
@ -130,6 +136,7 @@ struct fakecmd_t {
bool fake; bool fake;
}; };
extern pextension_funcs_t *gpMetaPExtFuncs;
extern CLog g_log; extern CLog g_log;
extern CPluginMngr g_plugins; extern CPluginMngr g_plugins;
extern CTaskMngr g_tasksMngr; extern CTaskMngr g_tasksMngr;
@ -140,7 +147,7 @@ extern CList<CCVar> g_cvars;
extern CList<ForceObject> g_forcemodels; extern CList<ForceObject> g_forcemodels;
extern CList<ForceObject> g_forcesounds; extern CList<ForceObject> g_forcesounds;
extern CList<ForceObject> g_forcegeneric; extern CList<ForceObject> g_forcegeneric;
extern CList<CModule> g_modules; extern CList<CModule,const char *> g_modules;
extern CList<CPlayer*> g_auth; extern CList<CPlayer*> g_auth;
extern EventsMngr g_events; extern EventsMngr g_events;
extern Grenades g_grenades; extern Grenades g_grenades;
@ -157,7 +164,6 @@ extern XVars g_xvars;
extern bool g_bmod_cstrike; extern bool g_bmod_cstrike;
extern bool g_bmod_dod; extern bool g_bmod_dod;
extern bool g_dontprecache; extern bool g_dontprecache;
extern bool g_initialized;
extern int g_srvindex; extern int g_srvindex;
extern cvar_t* amxmodx_version; extern cvar_t* amxmodx_version;
extern cvar_t* hostname; extern cvar_t* hostname;
@ -243,7 +249,7 @@ AMX* get_amxscript(int, void**,const char**);
const char* get_amxscriptname(AMX* amx); 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);
int amxstring_len(cell* cstr); int amxstring_len(cell* cstr);
int load_amxscript(AMX* amx, void** program, const char* path, char error[64]); 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_amxnatives(AMX* amx,char error[64]);
int set_amxstring(AMX *amx,cell amx_addr,const char *source,int max); int set_amxstring(AMX *amx,cell amx_addr,const char *source,int max);
int unload_amxscript(AMX* amx,void** program); int unload_amxscript(AMX* amx,void** program);
@ -255,6 +261,8 @@ void* alloc_amxmemory(void**, int size);
void free_amxmemory(void **ptr); void free_amxmemory(void **ptr);
// get_localinfo // get_localinfo
const char* get_localinfo( const char* name , const char* def ); 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, ...);
enum ModuleCallReason enum ModuleCallReason
{ {
@ -267,6 +275,7 @@ enum ModuleCallReason
extern ModuleCallReason g_ModuleCallReason; // modules.cpp extern ModuleCallReason g_ModuleCallReason; // modules.cpp
extern CModule *g_CurrentlyCalledModule; // modules.cpp extern CModule *g_CurrentlyCalledModule; // modules.cpp
extern const char *g_LastRequestedFunc; // modules.cpp extern const char *g_LastRequestedFunc; // modules.cpp
extern CQueue<String> CurModuleList;
void *Module_ReqFnptr(const char *funcName); // modules.cpp void *Module_ReqFnptr(const char *funcName); // modules.cpp

View File

@ -31,7 +31,7 @@
#include "amxmodx.h" #include "amxmodx.h"
#include "amxxfile.h" #include "amxxfile.h"
#include "minilzo/minilzo.h" #include "zlib/zlib.h"
/********************** /**********************
****** AMXXFILE ****** ****** AMXXFILE ******
@ -51,7 +51,7 @@
#endif #endif
#endif #endif
typedef lzo_byte mint8_t; typedef char mint8_t;
typedef int16_t mint16_t; typedef int16_t mint16_t;
typedef int32_t mint32_t; typedef int32_t mint32_t;
@ -85,13 +85,6 @@ CAmxxReader::CAmxxReader(const char *filename, int cellsize)
m_Status = Err_None; m_Status = Err_None;
m_CellSize = cellsize; m_CellSize = cellsize;
// Make sure the decompressor runs
if (lzo_init() != LZO_E_OK)
{
m_Status = Err_DecompressorInit;
return;
}
m_pFile = fopen(filename, "rb"); m_pFile = fopen(filename, "rb");
if (!m_pFile) if (!m_pFile)
{ {
@ -103,7 +96,7 @@ CAmxxReader::CAmxxReader(const char *filename, int cellsize)
DATAREAD(&magic, sizeof(magic), 1); DATAREAD(&magic, sizeof(magic), 1);
m_OldFile = false; m_OldFile = false;
if (magic != 0x524C4542) if (magic != 0x414D5842)
{ {
// check for old file // check for old file
AMX_HEADER hdr; AMX_HEADER hdr;
@ -131,7 +124,13 @@ CAmxxReader::CAmxxReader(const char *filename, int cellsize)
m_pFile = NULL; m_pFile = NULL;
return; return;
} }
} } else if ( magic == 0x524C4542 ) {
//we have an invalid, old, RLEB file
m_Status = Err_OldFile;
fclose(m_pFile);
m_pFile = NULL;
return;
} else {
// try to find the section // try to find the section
mint8_t numOfPlugins; mint8_t numOfPlugins;
@ -171,6 +170,7 @@ CAmxxReader::CAmxxReader(const char *filename, int cellsize)
fseek(m_pFile, 0, SEEK_END); fseek(m_pFile, 0, SEEK_END);
m_SectionLength = ftell(m_pFile) - (long)entry.offset; m_SectionLength = ftell(m_pFile) - (long)entry.offset;
} }
}
} }
CAmxxReader::~CAmxxReader() CAmxxReader::~CAmxxReader()
@ -205,11 +205,15 @@ size_t CAmxxReader::GetBufferSize()
if (!m_pFile) if (!m_pFile)
return 0; return 0;
long save = ftell(m_pFile);
if (m_OldFile) if (m_OldFile)
{ {
rewind(m_pFile); rewind(m_pFile);
AMX_HEADER hdr; AMX_HEADER hdr;
DATAREAD(&hdr, sizeof(hdr), 1); DATAREAD(&hdr, sizeof(hdr), 1);
fseek(m_pFile, save, SEEK_SET);
return hdr.stp; return hdr.stp;
} }
@ -217,6 +221,7 @@ size_t CAmxxReader::GetBufferSize()
TableEntry entry; TableEntry entry;
DATAREAD(&entry, sizeof(entry), 1); DATAREAD(&entry, sizeof(entry), 1);
fseek(m_pFile, save, SEEK_SET);
return entry.origSize + 1; // +1 : safe return entry.origSize + 1; // +1 : safe
} }
@ -255,16 +260,19 @@ CAmxxReader::Error CAmxxReader::GetSection(void *buffer)
TableEntry entry; TableEntry entry;
DATAREAD(&entry, sizeof(entry), 1); DATAREAD(&entry, sizeof(entry), 1);
fseek(m_pFile, entry.offset, SEEK_SET); 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 // read the data to a temporary buffer
lzo_byte *tempBuffer = new lzo_byte[m_SectionLength + 1]; char *tempBuffer = new char[m_SectionLength + 1];
//fread(tempBuffer, sizeof(char), m_SectionLength, m_pFile);
DATAREAD((void*)tempBuffer, 1, m_SectionLength); DATAREAD((void*)tempBuffer, 1, m_SectionLength);
// decompress // decompress
lzo_uint destLen = GetBufferSize(); // AMXXLOG_Log("|||| First Bytes: %d %d %d %d", tempBuffer[0], tempBuffer[1], tempBuffer[2], tempBuffer[3]);
int result = lzo1x_decompress_safe(tempBuffer, m_SectionLength, int result = uncompress((Bytef *)buffer, &destLen,
(lzo_byte*)buffer, &destLen, (Bytef *)tempBuffer, m_SectionLength);
NULL /*unused*/ ); delete [] tempBuffer;
if (result != LZO_E_OK) // AMXXLOG_Log("|||| Result: %d, m_SectionLength=%d, destLen=%d", result, m_SectionLength, destLen);
if (result != Z_OK)
{ {
m_Status = Err_Decompress; m_Status = Err_Decompress;
return Err_Decompress; return Err_Decompress;

View File

@ -44,7 +44,8 @@ public:
Err_FileInvalid, Err_FileInvalid,
Err_SectionNotFound, Err_SectionNotFound,
Err_DecompressorInit, Err_DecompressorInit,
Err_Decompress Err_Decompress,
Err_OldFile,
}; };
private: private:

View File

@ -40,6 +40,10 @@
#endif #endif
#include "amxmodx.h" #include "amxmodx.h"
#ifndef __linux__
#define vsnprintf _vsnprintf
#endif
CLog::CLog() CLog::CLog()
{ {
m_LogType = 0; m_LogType = 0;
@ -60,7 +64,7 @@ void CLog::CloseFile()
if (fp) if (fp)
{ {
fclose(fp); fclose(fp);
fopen(m_LogFile.c_str(), "a+"); fp = fopen(m_LogFile.c_str(), "a+");
// get time // get time
time_t td; time_t td;
@ -102,8 +106,11 @@ void CLog::CreateNewFile()
ALERT(at_logged, "[AMXX] Unexpected fatal logging error. AMXX Logging disabled.\n"); ALERT(at_logged, "[AMXX] Unexpected fatal logging error. AMXX Logging disabled.\n");
SET_LOCALINFO("amxx_logging", "0"); SET_LOCALINFO("amxx_logging", "0");
} }
else
{
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); 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); fclose(fp);
}
} }
void CLog::UseFile(const String &fileName) void CLog::UseFile(const String &fileName)
@ -158,7 +165,7 @@ void CLog::Log(const char *fmt, ...)
va_list arglst; va_list arglst;
va_start(arglst, fmt); va_start(arglst, fmt);
vsprintf(msg, fmt, arglst); vsnprintf(msg, 3071, fmt, arglst);
va_end(arglst); va_end(arglst);
FILE *pF; FILE *pF;
@ -181,9 +188,18 @@ void CLog::Log(const char *fmt, ...)
{ {
pF = fopen(build_pathname("%s/L%02d%02d.log", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday), "a+"); 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); fprintf(pF, "L %s: %s\n", date, msg);
fclose(pF); 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());
m_LogType = 0;
return;
}
// print on server console // print on server console
print_srvconsole("L %s: %s\n", date, msg); print_srvconsole("L %s: %s\n", date, msg);
} }
@ -194,7 +210,7 @@ void CLog::Log(const char *fmt, ...)
char msg[3072]; char msg[3072];
va_list arglst; va_list arglst;
va_start(arglst, fmt); va_start(arglst, fmt);
vsprintf(msg, fmt, arglst); vsnprintf(msg, 3071, fmt, arglst);
va_end(arglst); va_end(arglst);
ALERT(at_logged, "%s\n", msg); ALERT(at_logged, "%s\n", msg);
} }

View File

@ -320,7 +320,7 @@
prev_mres = mres; \ prev_mres = mres; \
if (mres == MRES_UNSET) \ if (mres == MRES_UNSET) \
AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \ AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \
(*iter).GetInfo()->name, (*iter).GetPath(), #pfnArgs); \ (*iter).GetInfo()->name, (*iter).GetPath(), #pfnName); \
} \ } \
} \ } \
/* Set meta result to the highest value */ \ /* Set meta result to the highest value */ \
@ -353,7 +353,7 @@
prev_mres = mres; \ prev_mres = mres; \
if (mres == MRES_UNSET) \ if (mres == MRES_UNSET) \
AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \ AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \
(*iter).GetInfo()->name, (*iter).GetPath(), #pfnArgs); \ (*iter).GetInfo()->name, (*iter).GetPath(), #pfnName); \
} \ } \
} \ } \
/* Set meta result to the highest value */ \ /* Set meta result to the highest value */ \
@ -379,7 +379,7 @@
prev_mres = mres; \ prev_mres = mres; \
if (mres == MRES_UNSET) \ if (mres == MRES_UNSET) \
AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \ AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \
(*iter).GetInfo()->name, (*iter).GetPath(), #pfnArgs); \ (*iter).GetInfo()->name, (*iter).GetPath(), #pfnName); \
} \ } \
} \ } \
/* Set meta result to the highest value */ \ /* Set meta result to the highest value */ \
@ -412,7 +412,10 @@
prev_mres = mres; \ prev_mres = mres; \
if (mres == MRES_UNSET) \ if (mres == MRES_UNSET) \
AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \ AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has not set meta result in \"%s\"", \
(*iter).GetInfo()->name, (*iter).GetPath(), #pfnArgs); \ (*iter).GetInfo()->name, (*iter).GetPath(), #pfnName); \
if (mres == MRES_SUPERCEDE) \
AMXXLOG_Log("[AMXX] Module \"%s\" (\"%s\") has set meta result in \"%s\" to supercede", \
(*iter).GetInfo()->name, (*iter).GetPath(), #pfnName); \
} \ } \
} \ } \
/* Set meta result to the highest value */ \ /* Set meta result to the highest value */ \
@ -2341,8 +2344,24 @@ CFakeMeta::CFakeMetaPlugin::~CFakeMetaPlugin()
} }
} }
// ghost_of_evilspy's "could not find memloc for cvar" fix
void FakeMeta_New_CVarRegister(cvar_t *pCVar)
{
static cvar_t tmpvar;
tmpvar = *pCVar;
CVAR_REGISTER(&tmpvar);
}
int CFakeMeta::CFakeMetaPlugin::Query(mutil_funcs_t *pMetaUtilFuncs) int CFakeMeta::CFakeMetaPlugin::Query(mutil_funcs_t *pMetaUtilFuncs)
{ {
//using metamod p-extensions?
if(gpMetaPExtFuncs)
{
//load plugins in meta_attach
m_Status = PL_OPENED;
return 1;
}
// Load the library // Load the library
// We don't have to DLCLOSE here. // We don't have to DLCLOSE here.
m_Handle = DLOPEN(build_pathname("%s", m_Path.c_str())); m_Handle = DLOPEN(build_pathname("%s", m_Path.c_str()));
@ -2387,7 +2406,13 @@ int CFakeMeta::CFakeMetaPlugin::Query(mutil_funcs_t *pMetaUtilFuncs)
m_Status = PL_BADFILE; m_Status = PL_BADFILE;
return 0; return 0;
} }
giveEngFuncsFn(&g_engfuncs, gpGlobals);
// ghost_of_evilspy's "Could not find memloc for cvar" fix
static enginefuncs_t fakemeta_engfuncs;
memcpy(&fakemeta_engfuncs, &g_engfuncs, sizeof(enginefuncs_t));
// Override cvar register to our own function
fakemeta_engfuncs.pfnCVarRegister = FakeMeta_New_CVarRegister;
giveEngFuncsFn(&fakemeta_engfuncs, gpGlobals);
if (queryFn(META_INTERFACE_VERSION, &m_Info, pMetaUtilFuncs) != 1) if (queryFn(META_INTERFACE_VERSION, &m_Info, pMetaUtilFuncs) != 1)
{ {
@ -2402,6 +2427,18 @@ int CFakeMeta::CFakeMetaPlugin::Query(mutil_funcs_t *pMetaUtilFuncs)
int CFakeMeta::CFakeMetaPlugin::Attach(PLUG_LOADTIME now, meta_globals_t *pMGlobals, gamedll_funcs_t *pGameDllFuncs) int CFakeMeta::CFakeMetaPlugin::Attach(PLUG_LOADTIME now, meta_globals_t *pMGlobals, gamedll_funcs_t *pGameDllFuncs)
{ {
// evilspy's patch:
//using metamod p-extensions?
if(gpMetaPExtFuncs) {
if(PEXT_LOAD_PLUGIN_BY_NAME(PLID, m_Path.c_str(), now, (void**)&m_Handle) || !m_Handle) {
m_Status = PL_FAILED;
return 0;
}
m_Status = PL_RUNNING;
return 1;
}
if (!m_Handle) if (!m_Handle)
return 0; return 0;
META_ATTACH_FN attachFn = (META_ATTACH_FN)DLSYM(m_Handle, "Meta_Attach"); META_ATTACH_FN attachFn = (META_ATTACH_FN)DLSYM(m_Handle, "Meta_Attach");
@ -2426,6 +2463,19 @@ int CFakeMeta::CFakeMetaPlugin::Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reaso
{ {
if (!m_Handle) if (!m_Handle)
return 0; return 0;
// evilspy's patch:
//using metamod p-extensions?
if (gpMetaPExtFuncs) {
if(PEXT_UNLOAD_PLUGIN_BY_HANDLE(PLID, (void*)m_Handle, now, reason)) {
m_Status = PL_FAILED;
return 0;
}
m_Status = PL_OPENED;
m_Handle = NULL;
return 1;
}
META_DETACH_FN detachFn = (META_DETACH_FN)DLSYM(m_Handle, "Meta_Detach"); META_DETACH_FN detachFn = (META_DETACH_FN)DLSYM(m_Handle, "Meta_Detach");
if (!detachFn) if (!detachFn)
{ {
@ -2516,6 +2566,11 @@ void CFakeMeta::ReleasePlugins()
bool CFakeMeta::AddCorePlugin() bool CFakeMeta::AddCorePlugin()
{ {
// evilspy:
// not needed when using metamod p-extensions
if(gpMetaPExtFuncs)
return true;
// Check whether there already is a core plugin // Check whether there already is a core plugin
if (m_Plugins.begin() && strcmp((*m_Plugins.begin()).GetPath(), "[AMXX Core]") == 0) if (m_Plugins.begin() && strcmp((*m_Plugins.begin()).GetPath(), "[AMXX Core]") == 0)
return true; return true;
@ -2579,6 +2634,14 @@ int CFakeMeta::GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable /*from metamod*/, int
*interfaceVersion = INTERFACE_VERSION; *interfaceVersion = INTERFACE_VERSION;
return(FALSE); return(FALSE);
} }
// evilspy:
//using metamod p-extensions?
if(gpMetaPExtFuncs) {
memcpy( pFunctionTable, pAMXXFunctionTable, sizeof( DLL_FUNCTIONS ) );
return TRUE;
}
memcpy( pFunctionTable, &g_DllFunctionTable, sizeof( DLL_FUNCTIONS ) ); memcpy( pFunctionTable, &g_DllFunctionTable, sizeof( DLL_FUNCTIONS ) );
// Make sure there is a core plugin // Make sure there is a core plugin
@ -2608,6 +2671,14 @@ int CFakeMeta::GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable /*from metamod*/
*interfaceVersion = INTERFACE_VERSION; *interfaceVersion = INTERFACE_VERSION;
return(FALSE); return(FALSE);
} }
// evilspy
//using metamod p-extensions?
if(gpMetaPExtFuncs) {
memcpy( pFunctionTable, pAMXXFunctionTable, sizeof( DLL_FUNCTIONS ) );
return TRUE;
}
memcpy( pFunctionTable, &g_DllFunctionTable_Post, sizeof( DLL_FUNCTIONS ) ); memcpy( pFunctionTable, &g_DllFunctionTable_Post, sizeof( DLL_FUNCTIONS ) );
// Make sure there is a core plugin // Make sure there is a core plugin
@ -2637,6 +2708,14 @@ int CFakeMeta::GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *inter
*interfaceVersion = ENGINE_INTERFACE_VERSION; *interfaceVersion = ENGINE_INTERFACE_VERSION;
return FALSE; return FALSE;
} }
// evilspy:
//using metamod p-extensions?
if(gpMetaPExtFuncs) {
memcpy( pengfuncsFromEngine, pAMXXFunctionTable, sizeof( enginefuncs_t ) );
return TRUE;
}
memcpy( pengfuncsFromEngine, &g_EngineFunctionTable, sizeof( enginefuncs_t ) ); memcpy( pengfuncsFromEngine, &g_EngineFunctionTable, sizeof( enginefuncs_t ) );
// Make sure there is a core plugin // Make sure there is a core plugin
@ -2665,6 +2744,14 @@ int CFakeMeta::GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int *
*interfaceVersion = ENGINE_INTERFACE_VERSION; *interfaceVersion = ENGINE_INTERFACE_VERSION;
return FALSE; return FALSE;
} }
// evilspy:
//using metamod p-extensions?
if(gpMetaPExtFuncs) {
memcpy( pengfuncsFromEngine, pAMXXFunctionTable, sizeof( enginefuncs_t ) );
return TRUE;
}
memcpy( pengfuncsFromEngine, &g_EngineFunctionTable_Post, sizeof( enginefuncs_t ) ); memcpy( pengfuncsFromEngine, &g_EngineFunctionTable_Post, sizeof( enginefuncs_t ) );
// Make sure there is a core plugin // Make sure there is a core plugin
@ -2700,7 +2787,15 @@ int CFakeMeta::GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *int
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION; *interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
return(FALSE); return(FALSE);
} }
memcpy( pNewFunctionTable, &g_NewDllFunctionTable, sizeof( DLL_FUNCTIONS ) );
// evilspy:
//using metamod p-extensions?
if(gpMetaPExtFuncs) {
memcpy( pNewFunctionTable, pAMXXFunctionTable, sizeof( NEW_DLL_FUNCTIONS ) );
return TRUE;
}
memcpy( pNewFunctionTable, &g_NewDllFunctionTable, sizeof( NEW_DLL_FUNCTIONS ) );
// Make sure there is a core plugin // Make sure there is a core plugin
AddCorePlugin(); AddCorePlugin();
@ -2735,7 +2830,15 @@ int CFakeMeta::GetNewDLLFunctions_Post(NEW_DLL_FUNCTIONS *pNewFunctionTable, int
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION; *interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
return(FALSE); return(FALSE);
} }
memcpy( pNewFunctionTable, &g_NewDllFunctionTable_Post, sizeof( DLL_FUNCTIONS ) );
// evilspy:
//using metamod p-extensions?
if(gpMetaPExtFuncs) {
memcpy( pNewFunctionTable, pAMXXFunctionTable, sizeof( NEW_DLL_FUNCTIONS ) );
return TRUE;
}
memcpy( pNewFunctionTable, &g_NewDllFunctionTable_Post, sizeof( NEW_DLL_FUNCTIONS ) );
// Make sure there is a core plugin // Make sure there is a core plugin
AddCorePlugin(); AddCorePlugin();

View File

@ -57,6 +57,23 @@
CVector<FILE *> FileList; CVector<FILE *> FileList;
class AutoFilePtr
{
FILE *m_FP;
public:
AutoFilePtr(FILE *fp) : m_FP(fp)
{ }
~AutoFilePtr()
{
if (m_FP)
fclose(m_FP);
}
operator FILE* ()
{
return m_FP;
}
};
static cell AMX_NATIVE_CALL read_dir(AMX *amx, cell *params) static cell AMX_NATIVE_CALL read_dir(AMX *amx, cell *params)
{ {
#ifdef __GNUC__ #ifdef __GNUC__
@ -168,7 +185,7 @@ static cell AMX_NATIVE_CALL write_file(AMX *amx, cell *params) /* 3 param */
// adding a new line in a middle of already existing file // adding a new line in a middle of already existing file
FILE* pTemp; FILE* pTemp;
char buffor[1024]; char buffor[2048];
if ( (pTemp = tmpfile()) == NULL ){ if ( (pTemp = tmpfile()) == NULL ){
amx_RaiseError(amx,AMX_ERR_NATIVE); amx_RaiseError(amx,AMX_ERR_NATIVE);
@ -177,11 +194,11 @@ static cell AMX_NATIVE_CALL write_file(AMX *amx, cell *params) /* 3 param */
for(i=0;;++i){ for(i=0;;++i){
if ( i == iLine ){ if ( i == iLine ){
fgets(buffor,1023,pFile); fgets(buffor,2047,pFile);
fputs( sText , pTemp ); fputs( sText , pTemp );
fputc( '\n', pTemp ); fputc( '\n', pTemp );
} }
else if ( fgets(buffor,1023,pFile) ){ else if ( fgets(buffor,2047,pFile) ){
fputs(buffor , pTemp ); fputs(buffor , pTemp );
} }
else if ( i < iLine ) { else if ( i < iLine ) {
@ -199,7 +216,7 @@ static cell AMX_NATIVE_CALL write_file(AMX *amx, cell *params) /* 3 param */
return 0; return 0;
} }
while(fgets(buffor,1023,pTemp)) while(fgets(buffor,2047,pTemp))
fputs(buffor,pFile ); fputs(buffor,pFile );
fclose(pTemp); fclose(pTemp);
@ -230,17 +247,20 @@ static cell AMX_NATIVE_CALL file_size(AMX *amx, cell *params) /* 1 param */
{ {
int iLen; int iLen;
char* sFile = get_amxstring(amx,params[1],0,iLen); char* sFile = get_amxstring(amx,params[1],0,iLen);
FILE* fp = fopen(build_pathname("%s",sFile),"r"); AutoFilePtr fp(fopen(build_pathname("%s",sFile),"r"));
if ( fp != NULL) { if ( fp != NULL)
if ( params[0] < 2 || params[2] == 0 ){ {
if ( params[0] < 2 || params[2] == 0 )
{
fseek(fp,0,SEEK_END); fseek(fp,0,SEEK_END);
int size = ftell(fp); int size = ftell(fp);
fclose(fp);
return size; return size;
} }
else if ( params[2] == 1 ){ else if ( params[2] == 1 )
{
int a = 0,lines = 0; int a = 0,lines = 0;
while( a != EOF ){ while( a != EOF )
{
++lines; ++lines;
while ( (a = fgetc(fp)) != '\n' && a != EOF ) while ( (a = fgetc(fp)) != '\n' && a != EOF )
; ;
@ -454,7 +474,7 @@ static cell AMX_NATIVE_CALL amx_filesize(AMX *amx, cell *params)
int len; int len;
char *file = build_pathname("%s", format_amxstring(amx, params, 1, len)); char *file = build_pathname("%s", format_amxstring(amx, params, 1, len));
long size; long size;
FILE *fp = fopen(file, "rb"); AutoFilePtr fp(fopen(file, "rb"));
if (fp) { if (fp) {
fseek(fp, 0, SEEK_END); fseek(fp, 0, SEEK_END);
size = ftell(fp); size = ftell(fp);

View File

@ -37,6 +37,19 @@
#define PI 3.1415926535897932384626433832795 #define PI 3.1415926535897932384626433832795
static REAL FromRadians(REAL angle, int radix)
{
switch (radix)
{
case 1: /* degrees, sexagesimal system (technically: degrees/minutes/seconds) */
return (REAL)(angle / PI * 180.0);
case 2: /* grades, centesimal system */
return (REAL)(angle / PI * 200.0);
default: /* assume already radian */
return angle;
} /* switch */
}
#if defined __BORLANDC__ || defined __WATCOMC__ #if defined __BORLANDC__ || defined __WATCOMC__
#pragma argsused #pragma argsused
#endif #endif
@ -357,6 +370,7 @@ static cell AMX_NATIVE_CALL n_floatatan(AMX *amx, cell *params)
REAL fA = amx_ctof(params[1]); REAL fA = amx_ctof(params[1]);
fA = ToRadians(fA, params[2]); fA = ToRadians(fA, params[2]);
fA = atan(fA); fA = atan(fA);
fA = FromRadians(fA, params[2]);
return amx_ftoc(fA); return amx_ftoc(fA);
} }
@ -371,8 +385,8 @@ static cell AMX_NATIVE_CALL n_floatacos(AMX *amx, cell *params)
* params[2] = radix * params[2] = radix
*/ */
REAL fA = amx_ctof(params[1]); REAL fA = amx_ctof(params[1]);
fA = ToRadians(fA, params[2]);
fA = acos(fA); fA = acos(fA);
fA = FromRadians(fA, params[2]);
return amx_ftoc(fA); return amx_ftoc(fA);
} }
@ -387,8 +401,8 @@ static cell AMX_NATIVE_CALL n_floatasin(AMX *amx, cell *params)
* params[2] = radix * params[2] = radix
*/ */
REAL fA = amx_ctof(params[1]); REAL fA = amx_ctof(params[1]);
fA = ToRadians(fA, params[2]);
fA = asin(fA); fA = asin(fA);
fA = FromRadians(fA, params[2]);
return amx_ftoc(fA); return amx_ftoc(fA);
} }
@ -407,6 +421,7 @@ static cell AMX_NATIVE_CALL n_floatatan2(AMX *amx, cell *params)
REAL fB = amx_ctof(params[2]); REAL fB = amx_ctof(params[2]);
REAL fC; REAL fC;
fC = atan2(fA, fB); fC = atan2(fA, fB);
fC = FromRadians(fC, params[3]);
return amx_ftoc(fC); return amx_ftoc(fC);
} }

View File

@ -50,6 +50,7 @@ gamedll_funcs_t *gpGamedllFuncs;
mutil_funcs_t *gpMetaUtilFuncs; mutil_funcs_t *gpMetaUtilFuncs;
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
pextension_funcs_t *gpMetaPExtFuncs;
funEventCall modMsgsEnd[MAX_REG_MSGS]; funEventCall modMsgsEnd[MAX_REG_MSGS];
funEventCall modMsgs[MAX_REG_MSGS]; funEventCall modMsgs[MAX_REG_MSGS];
@ -57,6 +58,7 @@ void (*function)(void*);
void (*endfunction)(void*); void (*endfunction)(void*);
CLog g_log; CLog g_log;
CQueue<String> CurModuleList;
CForwardMngr g_forwards; CForwardMngr g_forwards;
CList<CPlayer*> g_auth; CList<CPlayer*> g_auth;
CList<CCVar> g_cvars; CList<CCVar> g_cvars;
@ -81,12 +83,12 @@ bool g_bmod_dod;
bool g_dontprecache; bool g_dontprecache;
bool g_forcedmodules; bool g_forcedmodules;
bool g_forcedsounds; bool g_forcedsounds;
bool g_initialized;
fakecmd_t g_fakecmd; fakecmd_t g_fakecmd;
float g_game_restarting; float g_game_restarting;
float g_game_timeleft; float g_game_timeleft;
float g_task_time; float g_task_time;
float g_auth_time; float g_auth_time;
bool g_initialized = false;
#ifdef MEMORY_TEST #ifdef MEMORY_TEST
float g_next_memreport_time; float g_next_memreport_time;
@ -105,6 +107,7 @@ int g_srvindex;
cvar_t init_amxmodx_version = {"amxmodx_version", "", FCVAR_SERVER | FCVAR_SPONLY}; cvar_t init_amxmodx_version = {"amxmodx_version", "", FCVAR_SERVER | FCVAR_SPONLY};
cvar_t init_amxmodx_modules = {"amxmodx_modules", "", FCVAR_SPONLY}; cvar_t init_amxmodx_modules = {"amxmodx_modules", "", FCVAR_SPONLY};
cvar_t init_amxmodx_debug = {"amx_debug", "1", FCVAR_SPONLY};
cvar_t* amxmodx_version = NULL; cvar_t* amxmodx_version = NULL;
cvar_t* amxmodx_modules = NULL; cvar_t* amxmodx_modules = NULL;
cvar_t* hostname = NULL; cvar_t* hostname = NULL;
@ -199,9 +202,8 @@ const char* get_localinfo( const char* name , const char* def )
// Initialize AMX stuff and load it's plugins from plugins.ini list // Initialize AMX stuff and load it's plugins from plugins.ini list
// Call precache forward function from plugins // Call precache forward function from plugins
int C_Spawn( edict_t *pent ) { int C_Spawn( edict_t *pent ) {
if (g_initialized)
if ( g_initialized ) RETURN_META_VALUE(MRES_IGNORED, 0); RETURN_META_VALUE(MRES_IGNORED, 0);
g_initialized = true; g_initialized = true;
g_forcedmodules = false; g_forcedmodules = false;
g_forcedsounds = false; g_forcedsounds = false;
@ -211,6 +213,7 @@ int C_Spawn( edict_t *pent ) {
hostname = CVAR_GET_POINTER("hostname"); hostname = CVAR_GET_POINTER("hostname");
mp_timelimit = CVAR_GET_POINTER("mp_timelimit"); mp_timelimit = CVAR_GET_POINTER("mp_timelimit");
g_forwards.clear();
g_log.MapChange(); g_log.MapChange();
@ -218,8 +221,8 @@ int C_Spawn( edict_t *pent ) {
g_tasksMngr.registerTimers( &gpGlobals->time, &mp_timelimit->value, &g_game_timeleft ); g_tasksMngr.registerTimers( &gpGlobals->time, &mp_timelimit->value, &g_game_timeleft );
// ###### Load lang // ###### Load lang
g_langMngr.LoadCache(build_pathname("%s/dictionary.cache", get_localinfo("amxx_datadir", "addons/amxx/data"))); g_langMngr.LoadCache(build_pathname("%s/dictionary.cache", get_localinfo("amxx_datadir", "addons/amxmodx/data")));
g_langMngr.Load(build_pathname("%s/languages.dat", get_localinfo("amxx_datadir", "addons/amxx/data"))); g_langMngr.Load(build_pathname("%s/languages.dat", get_localinfo("amxmodx_datadir", "addons/amxmodx/data")));
// ###### Initialize commands prefixes // ###### Initialize commands prefixes
g_commands.registerPrefix( "amx" ); g_commands.registerPrefix( "amx" );
g_commands.registerPrefix( "amxx" ); g_commands.registerPrefix( "amxx" );
@ -229,14 +232,14 @@ int C_Spawn( edict_t *pent ) {
g_commands.registerPrefix( "cm_" ); g_commands.registerPrefix( "cm_" );
// make sure localinfos are set // make sure localinfos are set
get_localinfo("amxx_basedir", "addons/amxx"); get_localinfo("amxx_basedir", "addons/amxmodx");
get_localinfo("amxx_pluginsdir", "addons/amxx/plugins"); get_localinfo("amxx_pluginsdir", "addons/amxmodx/plugins");
get_localinfo("amxx_modulesdir", "addons/amxx/modules"); get_localinfo("amxx_modulesdir", "addons/amxmodx/modules");
get_localinfo("amxx_configsdir", "addons/amxx/configs"); get_localinfo("amxx_configsdir", "addons/amxmodx/configs");
get_localinfo("amxx_customdir", "addons/amxx/custom"); get_localinfo("amxx_customdir", "addons/amxmodx/custom");
// ###### Load modules // ###### Load modules
loadModules(get_localinfo("amxx_modules", "addons/amxx/configs/modules.ini")); loadModules(get_localinfo("amxx_modules", "addons/amxmodx/configs/modules.ini"));
attachModules(); attachModules();
int loaded = countModules(CountModules_Running); // Call after attachModules so all modules don't have pending stat int loaded = countModules(CountModules_Running); // Call after attachModules so all modules don't have pending stat
// Set some info about amx version and modules // Set some info about amx version and modules
@ -246,7 +249,7 @@ int C_Spawn( edict_t *pent ) {
CVAR_SET_STRING(init_amxmodx_modules.name, buffer); CVAR_SET_STRING(init_amxmodx_modules.name, buffer);
// ###### Load Vault // ###### Load Vault
g_vault.setSource( build_pathname("%s", get_localinfo("amxx_vault", "addons/amxx/configs/vault.ini")) ); g_vault.setSource( build_pathname("%s", get_localinfo("amxx_vault", "addons/amxmodx/configs/vault.ini")) );
g_vault.loadVault( ); g_vault.loadVault( );
if (strlen(g_vault.get("server_language")) < 1) if (strlen(g_vault.get("server_language")) < 1)
{ {
@ -268,18 +271,18 @@ int C_Spawn( edict_t *pent ) {
memset(g_players[0].flags,-1,sizeof(g_players[0].flags)); memset(g_players[0].flags,-1,sizeof(g_players[0].flags));
// ###### Load AMX scripts // ###### Load AMX scripts
g_plugins.loadPluginsFromFile( get_localinfo("amxx_plugins", "addons/amxx/configs/plugins.ini") ); g_plugins.loadPluginsFromFile( get_localinfo("amxx_plugins", "addons/amxmodx/configs/plugins.ini") );
// Register forwards // Register forwards
FF_PluginInit = registerForward("plugin_init", ET_IGNORE, FP_DONE); FF_PluginInit = registerForward("plugin_init", ET_IGNORE, FP_DONE);
FF_ClientCommand = registerForward("client_command", ET_IGNORE, FP_CELL, FP_DONE); FF_ClientCommand = registerForward("client_command", ET_STOP, FP_CELL, FP_DONE);
FF_ClientConnect = registerForward("client_connect", ET_IGNORE, FP_CELL, FP_DONE); FF_ClientConnect = registerForward("client_connect", ET_IGNORE, FP_CELL, FP_DONE);
FF_ClientDisconnect = registerForward("client_disconnect", ET_IGNORE, FP_CELL, FP_DONE); FF_ClientDisconnect = registerForward("client_disconnect", ET_IGNORE, FP_CELL, FP_DONE);
FF_ClientInfoChanged = registerForward("client_infochanged", ET_IGNORE, FP_CELL, FP_DONE); FF_ClientInfoChanged = registerForward("client_infochanged", ET_IGNORE, FP_CELL, FP_DONE);
FF_ClientPutInServer = registerForward("client_putinserver", ET_IGNORE, FP_CELL, FP_DONE); FF_ClientPutInServer = registerForward("client_putinserver", ET_IGNORE, FP_CELL, FP_DONE);
FF_PluginCfg = registerForward("plugin_cfg", ET_IGNORE, FP_DONE); FF_PluginCfg = registerForward("plugin_cfg", ET_IGNORE, FP_DONE);
FF_PluginPrecache = registerForward("plugin_precache", ET_IGNORE, FP_DONE); FF_PluginPrecache = registerForward("plugin_precache", ET_IGNORE, FP_DONE);
FF_PluginLog = registerForward("plugin_log", ET_IGNORE, FP_DONE); FF_PluginLog = registerForward("plugin_log", ET_STOP, FP_DONE);
FF_PluginEnd = registerForward("plugin_end", ET_IGNORE, FP_DONE); FF_PluginEnd = registerForward("plugin_end", ET_IGNORE, FP_DONE);
FF_InconsistentFile = registerForward("inconsistent_file", ET_STOP, FP_CELL, FP_STRING, FP_STRINGEX, FP_DONE); FF_InconsistentFile = registerForward("inconsistent_file", ET_STOP, FP_CELL, FP_STRING, FP_STRINGEX, FP_DONE);
FF_ClientAuthorized = registerForward("client_authorized", ET_IGNORE, FP_CELL, FP_DONE); FF_ClientAuthorized = registerForward("client_authorized", ET_IGNORE, FP_CELL, FP_DONE);
@ -298,7 +301,6 @@ int C_Spawn( edict_t *pent ) {
(*a).getMin(),(*a).getMax(),(*a).getFilename()); (*a).getMin(),(*a).getMax(),(*a).getFilename());
} }
RETURN_META_VALUE(MRES_IGNORED, 0); RETURN_META_VALUE(MRES_IGNORED, 0);
} }
@ -398,8 +400,8 @@ void C_ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax )
executeForwards(FF_PluginCfg); executeForwards(FF_PluginCfg);
// ###### Save lang // ###### Save lang
g_langMngr.Save(build_pathname("%s/languages.dat", get_localinfo("amxx_datadir", "addons/amxx/data"))); g_langMngr.Save(build_pathname("%s/languages.dat", get_localinfo("amxx_datadir", "addons/amxmodx/data")));
g_langMngr.SaveCache(build_pathname("%s/dictionary.cache", get_localinfo("amxx_datadir", "addons/amxx/data"))); g_langMngr.SaveCache(build_pathname("%s/dictionary.cache", get_localinfo("amxx_datadir", "addons/amxmodx/data")));
// Correct time in Counter-Strike and other mods (except DOD) // Correct time in Counter-Strike and other mods (except DOD)
if ( !g_bmod_dod) g_game_timeleft = 0; if ( !g_bmod_dod) g_game_timeleft = 0;
@ -421,10 +423,11 @@ void C_ServerDeactivate() {
for(int i = 1; i <= gpGlobals->maxClients; ++i){ for(int i = 1; i <= gpGlobals->maxClients; ++i){
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i); CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
if (pPlayer->ingame){ if (pPlayer->initialized)
executeForwards(FF_ClientDisconnect, pPlayer->index); executeForwards(FF_ClientDisconnect, pPlayer->index);
if (pPlayer->ingame){
pPlayer->Disconnect(); pPlayer->Disconnect();
--g_players_num; --g_players_num;
} }
@ -440,27 +443,30 @@ void C_ServerDeactivate() {
// However leave AMX modules which are loaded only once // However leave AMX modules which are loaded only once
void C_ServerDeactivate_Post() { void C_ServerDeactivate_Post() {
g_initialized = false;
detachReloadModules(); detachReloadModules();
g_auth.clear(); g_auth.clear();
g_forwards.clear();
g_commands.clear(); g_commands.clear();
g_forcemodels.clear(); g_forcemodels.clear();
g_forcesounds.clear(); g_forcesounds.clear();
g_forcegeneric.clear(); g_forcegeneric.clear();
g_grenades.clear(); g_grenades.clear();
g_tasksMngr.clear(); g_tasksMngr.clear();
g_forwards.clear();
g_logevents.clearLogEvents(); g_logevents.clearLogEvents();
g_events.clearEvents(); g_events.clearEvents();
g_menucmds.clear(); g_menucmds.clear();
g_vault.clear(); g_vault.clear();
g_xvars.clear(); g_xvars.clear();
g_plugins.clear(); g_plugins.clear();
g_langMngr.Save(build_pathname("%s/languages.dat", get_localinfo("amxx_datadir", "addons/amxx/data"))); g_langMngr.Save(build_pathname("%s/languages.dat", get_localinfo("amxx_datadir", "addons/amxmodx/data")));
g_langMngr.SaveCache(build_pathname("%s/dictionary.cache", get_localinfo("amxx_datadir", "addons/amxx/data"))); g_langMngr.SaveCache(build_pathname("%s/dictionary.cache", get_localinfo("amxx_datadir", "addons/amxmodx/data")));
g_langMngr.Clear(); g_langMngr.Clear();
//clear module name cache
while (!CurModuleList.empty())
{
CurModuleList.pop();
}
// last memreport // last memreport
#ifdef MEMORY_TEST #ifdef MEMORY_TEST
if (g_memreport_enabled) if (g_memreport_enabled)
@ -473,14 +479,14 @@ void C_ServerDeactivate_Post() {
tm *curTime = localtime(&td); tm *curTime = localtime(&td);
int i = 0; int i = 0;
#ifdef __linux__ #ifdef __linux__
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxx")), 0700); mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxmodx")), 0700);
#else #else
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxx"))); mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxmodx")));
#endif #endif
while (true) while (true)
{ {
char buffer[256]; char buffer[256];
sprintf(buffer, "%s/memreports/D%02d%02d%03d", get_localinfo("amxx_basedir", "addons/amxx"), curTime->tm_mon + 1, curTime->tm_mday, i); sprintf(buffer, "%s/memreports/D%02d%02d%03d", get_localinfo("amxx_basedir", "addons/amxmodx"), curTime->tm_mon + 1, curTime->tm_mday, i);
#ifdef __linux__ #ifdef __linux__
mkdir(build_pathname("%s", g_log_dir.c_str()), 0700); mkdir(build_pathname("%s", g_log_dir.c_str()), 0700);
if (mkdir(build_pathname(buffer), 0700) < 0) if (mkdir(build_pathname(buffer), 0700) < 0)
@ -514,6 +520,7 @@ void C_ServerDeactivate_Post() {
} }
#endif // MEMORY_TEST #endif // MEMORY_TEST
g_initialized = false;
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
@ -541,8 +548,10 @@ BOOL C_ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *ps
void C_ClientDisconnect( edict_t *pEntity ) { void C_ClientDisconnect( edict_t *pEntity ) {
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
if (pPlayer->ingame) { if (pPlayer->initialized)
executeForwards(FF_ClientDisconnect, pPlayer->index); executeForwards(FF_ClientDisconnect, pPlayer->index);
if (pPlayer->ingame) {
--g_players_num; --g_players_num;
} }
pPlayer->Disconnect(); pPlayer->Disconnect();
@ -597,6 +606,35 @@ void C_ClientCommand( edict_t *pEntity ) {
META_RES result = MRES_IGNORED; META_RES result = MRES_IGNORED;
cell ret = 0; cell ret = 0;
int err; int err;
const char* cmd = CMD_ARGV(0);
const char* arg = CMD_ARGV(1);
// Handle "amxx" if not on listenserver
if (IS_DEDICATED_SERVER())
{
if (cmd && stricmp(cmd, "amxx")==0)
{
// Print version
static char buf[1024];
sprintf(buf, "%s %s\n", Plugin_info.name, Plugin_info.version);
CLIENT_PRINT(pEntity, print_console, buf);
sprintf(buf, "Authors: %s (%s)\n", "Felix \"SniperBeamer\" Geyer, David \"BAILOPAN\" Anderson, Pavol \"PM OnoTo\" Marko, Jonny \"Got His Gun\" Bergstrom, and Lukasz \"SidLuke\" Wlasinski.", Plugin_info.url);
CLIENT_PRINT(pEntity, print_console, buf);
sprintf(buf, "Compiled: %s\n", __DATE__ ", " __TIME__);
CLIENT_PRINT(pEntity, print_console, buf);
#ifdef JIT
sprintf(buf, "Core mode: JIT\n");
#else
#ifdef ASM32
sprintf(buf, "Core mode: ASM\n");
#else
sprintf(buf, "Core mode: Normal\n");
#endif
#endif
CLIENT_PRINT(pEntity, print_console, buf);
RETURN_META(MRES_SUPERCEDE);
}
}
#ifdef ENABLEEXEPTIONS #ifdef ENABLEEXEPTIONS
try try
@ -613,10 +651,7 @@ void C_ClientCommand( edict_t *pEntity ) {
} }
#endif #endif
/* check for command and if needed also for first argument and call proper function */ /* check for command and if needed also for first argument and call proper function */
const char* cmd = CMD_ARGV(0);
const char* arg = CMD_ARGV(1);
#ifdef ENABLEEXEPTIONS #ifdef ENABLEEXEPTIONS
try{ try{
@ -632,8 +667,7 @@ void C_ClientCommand( edict_t *pEntity ) {
{ {
if ((err =amx_Exec((*aa).getPlugin()->getAMX(), &ret , (*aa).getFunction() , 3, pPlayer->index, (*aa).getFlags(),(*aa).getId() )) != AMX_ERR_NONE) if ((err =amx_Exec((*aa).getPlugin()->getAMX(), &ret , (*aa).getFunction() , 3, pPlayer->index, (*aa).getFlags(),(*aa).getId() )) != AMX_ERR_NONE)
AMXXLOG_Log("[AMXX] Run time error %d on line %ld (plugin \"%s\")", LogError((*aa).getPlugin()->getAMX(), err, "");
err,(*aa).getPlugin()->getAMX()->curline,(*aa).getPlugin()->getName());
if ( ret & 2 ) result = MRES_SUPERCEDE; if ( ret & 2 ) result = MRES_SUPERCEDE;
if ( ret & 1 ) RETURN_META(MRES_SUPERCEDE); if ( ret & 1 ) RETURN_META(MRES_SUPERCEDE);
@ -672,8 +706,7 @@ void C_ClientCommand( edict_t *pEntity ) {
{ {
if ( ( err = amx_Exec((*a).getPlugin()->getAMX(), &ret ,(*a).getFunction() , 2, pPlayer->index,pressed_key)) != AMX_ERR_NONE) if ( ( err = amx_Exec((*a).getPlugin()->getAMX(), &ret ,(*a).getFunction() , 2, pPlayer->index,pressed_key)) != AMX_ERR_NONE)
AMXXLOG_Log("[AMXX] Run time error %d on line %ld (plugin \"%s\")", LogError((*a).getPlugin()->getAMX(), err, "");
err,(*a).getPlugin()->getAMX()->curline,(*a).getPlugin()->getName());
if ( ret & 2 ) result = MRES_SUPERCEDE; if ( ret & 2 ) result = MRES_SUPERCEDE;
if ( ret & 1 ) RETURN_META(MRES_SUPERCEDE); if ( ret & 1 ) RETURN_META(MRES_SUPERCEDE);
@ -738,14 +771,14 @@ void C_StartFrame_Post( void ) {
tm *curTime = localtime(&td); tm *curTime = localtime(&td);
int i = 0; int i = 0;
#ifdef __linux__ #ifdef __linux__
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxx")), 0700); mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxmodx")), 0700);
#else #else
mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxx"))); mkdir(build_pathname("%s/memreports", get_localinfo("amxx_basedir", "addons/amxmodx")));
#endif #endif
while (true) while (true)
{ {
char buffer[256]; char buffer[256];
sprintf(buffer, "%s/memreports/D%02d%02d%03d", get_localinfo("amxx_basedir", "addons/amxx"), curTime->tm_mon + 1, curTime->tm_mday, i); sprintf(buffer, "%s/memreports/D%02d%02d%03d", get_localinfo("amxx_basedir", "addons/amxmodx"), curTime->tm_mon + 1, curTime->tm_mday, i);
#ifdef __linux__ #ifdef __linux__
mkdir(build_pathname("%s", g_log_dir.c_str()), 0700); mkdir(build_pathname("%s", g_log_dir.c_str()), 0700);
if (mkdir(build_pathname(buffer), 0700) < 0) if (mkdir(build_pathname(buffer), 0700) < 0)
@ -878,7 +911,7 @@ void C_MessageEnd_Post(void) {
{ {
if ((err = amx_Exec((*a).getPlugin()->getAMX(), NULL , (*a).getFunction() , 1, mPlayerIndex /*g_events.getArgInteger(0)*/ )) != AMX_ERR_NONE) if ((err = amx_Exec((*a).getPlugin()->getAMX(), NULL , (*a).getFunction() , 1, mPlayerIndex /*g_events.getArgInteger(0)*/ )) != AMX_ERR_NONE)
AMXXLOG_Log("[AMXX] Run time error %d on line %ld (plugin \"%s\")",err,(*a).getPlugin()->getAMX()->curline,(*a).getPlugin()->getName()); LogError((*a).getPlugin()->getAMX(), err, "");
++a; ++a;
@ -981,7 +1014,9 @@ void C_AlertMessage_Post(ALERT_TYPE atype, char *szFmt, ...)
g_logevents.parseLogString( ); g_logevents.parseLogString( );
if (g_logevents.logEventsExist()) if (g_logevents.logEventsExist())
g_logevents.executeLogEvents( ); g_logevents.executeLogEvents( );
executeForwards(FF_PluginLog); cell retVal = executeForwards(FF_PluginLog);
if (retVal)
RETURN_META(MRES_HANDLED);
} }
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
@ -1008,10 +1043,24 @@ C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_
else else
LOG_ERROR(PLID, "unexpected version comparison; metavers=%s, mmajor=%d, mminor=%d; plugvers=%s, pmajor=%d, pminor=%d", ifvers, mmajor, mminor, META_INTERFACE_VERSION, pmajor, pminor); LOG_ERROR(PLID, "unexpected version comparison; metavers=%s, mmajor=%d, mminor=%d; plugvers=%s, pmajor=%d, pminor=%d", ifvers, mmajor, mminor, META_INTERFACE_VERSION, pmajor, pminor);
} }
// We can set this to null here because Meta_PExtGiveFnptrs is called after this
gpMetaPExtFuncs = NULL;
// :NOTE: Don't call modules query here (g_FakeMeta.Meta_Query), because we don't know modules yet. Do it in Meta_Attach // :NOTE: Don't call modules query here (g_FakeMeta.Meta_Query), because we don't know modules yet. Do it in Meta_Attach
return(TRUE); return(TRUE);
} }
// evilspy's patch for mm-p ext support
// this is called right after Meta_Query
C_DLLEXPORT int Meta_PExtGiveFnptrs(int interfaceVersion, pextension_funcs_t *pMetaPExtFuncs) {
if(interfaceVersion<META_PEXT_VERSION) {
return(META_PEXT_VERSION);
}
gpMetaPExtFuncs = pMetaPExtFuncs;
return(META_PEXT_VERSION);
}
static META_FUNCTIONS gMetaFunctionTable; static META_FUNCTIONS gMetaFunctionTable;
C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs) { C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs) {
if(now > Plugin_info.loadable) { if(now > Plugin_info.loadable) {
@ -1023,13 +1072,14 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
gMetaFunctionTable.pfnGetEntityAPI2_Post = GetEntityAPI2_Post; gMetaFunctionTable.pfnGetEntityAPI2_Post = GetEntityAPI2_Post;
gMetaFunctionTable.pfnGetEngineFunctions = GetEngineFunctions; gMetaFunctionTable.pfnGetEngineFunctions = GetEngineFunctions;
gMetaFunctionTable.pfnGetEngineFunctions_Post = GetEngineFunctions_Post; gMetaFunctionTable.pfnGetEngineFunctions_Post = GetEngineFunctions_Post;
//gMetaFunctionTable.pfnGetNewDLLFunctions = GetNewDLLFunctions; gMetaFunctionTable.pfnGetNewDLLFunctions = GetNewDLLFunctions;
//gMetaFunctionTable.pfnGetNewDLLFunctions_Post = GetNewDLLFunctions_Post; gMetaFunctionTable.pfnGetNewDLLFunctions_Post = GetNewDLLFunctions_Post;
memcpy(pFunctionTable, &gMetaFunctionTable, sizeof(META_FUNCTIONS)); memcpy(pFunctionTable, &gMetaFunctionTable, sizeof(META_FUNCTIONS));
gpGamedllFuncs=pGamedllFuncs; gpGamedllFuncs=pGamedllFuncs;
CVAR_REGISTER(&init_amxmodx_version); CVAR_REGISTER(&init_amxmodx_version);
CVAR_REGISTER(&init_amxmodx_modules); CVAR_REGISTER(&init_amxmodx_modules);
CVAR_REGISTER(&init_amxmodx_debug);
amxmodx_version = CVAR_GET_POINTER(init_amxmodx_version.name); amxmodx_version = CVAR_GET_POINTER(init_amxmodx_version.name);
REG_SVR_COMMAND("amxx",amx_command); REG_SVR_COMMAND("amxx",amx_command);
@ -1043,14 +1093,14 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
g_mod_name.assign(a); g_mod_name.assign(a);
// ###### Print short GPL // ###### Print short GPL
print_srvconsole( "\n AMX Mod X version %s Copyright (c) 2004 AMX Mod X Development Team \n" print_srvconsole( "\n AMX Mod X version %s Copyright (c) 2004-2005 AMX Mod X Development Team \n"
" AMX Mod X comes with ABSOLUTELY NO WARRANTY; for details type `amxx gpl'.\n", AMX_VERSION); " AMX Mod X comes with ABSOLUTELY NO WARRANTY; for details type `amxx gpl'.\n", AMX_VERSION);
print_srvconsole( " This is free software and you are welcome to redistribute it under \n" print_srvconsole( " This is free software and you are welcome to redistribute it under \n"
" certain conditions; type 'amxx gpl' for details.\n \n"); " certain conditions; type 'amxx gpl' for details.\n \n");
// ###### Load custom path configuration // ###### Load custom path configuration
Vault amx_config; Vault amx_config;
amx_config.setSource(build_pathname("%s", get_localinfo("amxx_cfg", "addons/amxx/configs/core.ini"))); amx_config.setSource(build_pathname("%s", get_localinfo("amxx_cfg", "addons/amxmodx/configs/core.ini")));
if ( amx_config.loadVault() ){ if ( amx_config.loadVault() ){
Vault::iterator a = amx_config.begin(); Vault::iterator a = amx_config.begin();
@ -1062,11 +1112,11 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
} }
// ###### Initialize logging here // ###### Initialize logging here
g_log_dir.assign(get_localinfo("amxx_logs", "addons/amxx/logs")); g_log_dir.assign(get_localinfo("amxx_logs", "addons/amxmodx/logs"));
// ###### Now attach metamod modules // ###### Now attach metamod modules
// This will also call modules Meta_Query and Meta_Attach functions // This will also call modules Meta_Query and Meta_Attach functions
attachMetaModModules(now, get_localinfo("amxx_modules", "addons/amxx/configs/modules.ini") ); attachMetaModModules(now, get_localinfo("amxx_modules", "addons/amxmodx/configs/modules.ini") );
return(TRUE); return(TRUE);
} }
@ -1227,15 +1277,6 @@ C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *inte
meta_engfuncs.pfnChangeLevel = C_ChangeLevel; meta_engfuncs.pfnChangeLevel = C_ChangeLevel;
return g_FakeMeta.GetEngineFunctions(pengfuncsFromEngine, interfaceVersion, &meta_engfuncs); return g_FakeMeta.GetEngineFunctions(pengfuncsFromEngine, interfaceVersion, &meta_engfuncs);
/*
if(*interfaceVersion!=ENGINE_INTERFACE_VERSION) {
LOG_ERROR(PLID, "GetEngineFunctions version mismatch; requested=%d ours=%d", *interfaceVersion, ENGINE_INTERFACE_VERSION);
*interfaceVersion = ENGINE_INTERFACE_VERSION;
return(FALSE);
}
memcpy(pengfuncsFromEngine, &meta_engfuncs, sizeof(enginefuncs_t));
return(TRUE);
*/
} }
enginefuncs_t meta_engfuncs_post; enginefuncs_t meta_engfuncs_post;
@ -1278,15 +1319,6 @@ C_DLLEXPORT int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int
++iter; ++iter;
} }
return g_FakeMeta.GetEngineFunctions_Post(pengfuncsFromEngine, interfaceVersion, &meta_engfuncs_post); return g_FakeMeta.GetEngineFunctions_Post(pengfuncsFromEngine, interfaceVersion, &meta_engfuncs_post);
/*
if(*interfaceVersion!=ENGINE_INTERFACE_VERSION) {
LOG_ERROR(PLID, "GetEngineFunctions_Post version mismatch; requested=%d ours=%d", *interfaceVersion, ENGINE_INTERFACE_VERSION);
*interfaceVersion = ENGINE_INTERFACE_VERSION;
return(FALSE);
}
memcpy(pengfuncsFromEngine, &meta_engfuncs_post, sizeof(enginefuncs_t));
return(TRUE);
*/
} }
NEW_DLL_FUNCTIONS gNewDLLFunctionTable; NEW_DLL_FUNCTIONS gNewDLLFunctionTable;

View File

@ -1,451 +0,0 @@
/* lzoconf.h -- configuration for the LZO real-time data compression library
This file is part of the LZO real-time data compression library.
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library 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.
The LZO library 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 the LZO library; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer
<markus@oberhumer.com>
http://www.oberhumer.com/opensource/lzo/
*/
#ifndef __LZOCONF_H
#define __LZOCONF_H
#define LZO_VERSION 0x1080
#define LZO_VERSION_STRING "1.08"
#define LZO_VERSION_DATE "Jul 12 2002"
/* internal Autoconf configuration file - only used when building LZO */
#if defined(LZO_HAVE_CONFIG_H)
# include <config.h>
#endif
#include <limits.h>
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************************
// LZO requires a conforming <limits.h>
************************************************************************/
#if !defined(CHAR_BIT) || (CHAR_BIT != 8)
# error "invalid CHAR_BIT"
#endif
#if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
# error "check your compiler installation"
#endif
#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
# error "your limits.h macros are broken"
#endif
/* workaround a cpp bug under hpux 10.20 */
#define LZO_0xffffffffL 4294967295ul
#if !defined(LZO_UINT32_C)
# if (UINT_MAX < LZO_0xffffffffL)
# define LZO_UINT32_C(c) c ## UL
# else
# define LZO_UINT32_C(c) c ## U
# endif
#endif
/***********************************************************************
// architecture defines
************************************************************************/
#if !defined(__LZO_WIN) && !defined(__LZO_DOS) && !defined(__LZO_OS2)
# if defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows)
# define __LZO_WIN
# elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
# define __LZO_WIN
# elif defined(__NT__) || defined(__NT_DLL__) || defined(__WINDOWS_386__)
# define __LZO_WIN
# elif defined(__DOS__) || defined(__MSDOS__) || defined(MSDOS)
# define __LZO_DOS
# elif defined(__OS2__) || defined(__OS2V2__) || defined(OS2)
# define __LZO_OS2
# elif defined(__palmos__)
# define __LZO_PALMOS
# elif defined(__TOS__) || defined(__atarist__)
# define __LZO_TOS
# endif
#endif
#if (UINT_MAX < LZO_0xffffffffL)
# if defined(__LZO_WIN)
# define __LZO_WIN16
# elif defined(__LZO_DOS)
# define __LZO_DOS16
# elif defined(__LZO_PALMOS)
# define __LZO_PALMOS16
# elif defined(__LZO_TOS)
# define __LZO_TOS16
# elif defined(__C166__)
# else
/* porting hint: for pure 16-bit architectures try compiling
* everything with -D__LZO_STRICT_16BIT */
# error "16-bit target not supported - contact me for porting hints"
# endif
#endif
#if !defined(__LZO_i386)
# if defined(__LZO_DOS) || defined(__LZO_WIN16)
# define __LZO_i386
# elif defined(__i386__) || defined(__386__) || defined(_M_IX86)
# define __LZO_i386
# endif
#endif
#if defined(__LZO_STRICT_16BIT)
# if (UINT_MAX < LZO_0xffffffffL)
# include <lzo16bit.h>
# endif
#endif
/* memory checkers */
#if !defined(__LZO_CHECKER)
# if defined(__BOUNDS_CHECKING_ON)
# define __LZO_CHECKER
# elif defined(__CHECKER__)
# define __LZO_CHECKER
# elif defined(__INSURE__)
# define __LZO_CHECKER
# elif defined(__PURIFY__)
# define __LZO_CHECKER
# endif
#endif
/***********************************************************************
// integral and pointer types
************************************************************************/
/* Integral types with 32 bits or more */
#if !defined(LZO_UINT32_MAX)
# if (UINT_MAX >= LZO_0xffffffffL)
typedef unsigned int lzo_uint32;
typedef int lzo_int32;
# define LZO_UINT32_MAX UINT_MAX
# define LZO_INT32_MAX INT_MAX
# define LZO_INT32_MIN INT_MIN
# elif (ULONG_MAX >= LZO_0xffffffffL)
typedef unsigned long lzo_uint32;
typedef long lzo_int32;
# define LZO_UINT32_MAX ULONG_MAX
# define LZO_INT32_MAX LONG_MAX
# define LZO_INT32_MIN LONG_MIN
# else
# error "lzo_uint32"
# endif
#endif
/* lzo_uint is used like size_t */
#if !defined(LZO_UINT_MAX)
# if (UINT_MAX >= LZO_0xffffffffL)
typedef unsigned int lzo_uint;
typedef int lzo_int;
# define LZO_UINT_MAX UINT_MAX
# define LZO_INT_MAX INT_MAX
# define LZO_INT_MIN INT_MIN
# elif (ULONG_MAX >= LZO_0xffffffffL)
typedef unsigned long lzo_uint;
typedef long lzo_int;
# define LZO_UINT_MAX ULONG_MAX
# define LZO_INT_MAX LONG_MAX
# define LZO_INT_MIN LONG_MIN
# else
# error "lzo_uint"
# endif
#endif
typedef int lzo_bool;
/***********************************************************************
// memory models
************************************************************************/
/* Memory model for the public code segment. */
#if !defined(__LZO_CMODEL)
# if defined(__LZO_DOS16) || defined(__LZO_WIN16)
# define __LZO_CMODEL __far
# elif defined(__LZO_i386) && defined(__WATCOMC__)
# define __LZO_CMODEL __near
# else
# define __LZO_CMODEL
# endif
#endif
/* Memory model for the public data segment. */
#if !defined(__LZO_DMODEL)
# if defined(__LZO_DOS16) || defined(__LZO_WIN16)
# define __LZO_DMODEL __far
# elif defined(__LZO_i386) && defined(__WATCOMC__)
# define __LZO_DMODEL __near
# else
# define __LZO_DMODEL
# endif
#endif
/* Memory model that allows to access memory at offsets of lzo_uint. */
#if !defined(__LZO_MMODEL)
# if (LZO_UINT_MAX <= UINT_MAX)
# define __LZO_MMODEL
# elif defined(__LZO_DOS16) || defined(__LZO_WIN16)
# define __LZO_MMODEL __huge
# define LZO_999_UNSUPPORTED
# elif defined(__LZO_PALMOS16) || defined(__LZO_TOS16)
# define __LZO_MMODEL
# else
# error "__LZO_MMODEL"
# endif
#endif
/* no typedef here because of const-pointer issues */
#define lzo_byte unsigned char __LZO_MMODEL
#define lzo_bytep unsigned char __LZO_MMODEL *
#define lzo_charp char __LZO_MMODEL *
#define lzo_voidp void __LZO_MMODEL *
#define lzo_shortp short __LZO_MMODEL *
#define lzo_ushortp unsigned short __LZO_MMODEL *
#define lzo_uint32p lzo_uint32 __LZO_MMODEL *
#define lzo_int32p lzo_int32 __LZO_MMODEL *
#define lzo_uintp lzo_uint __LZO_MMODEL *
#define lzo_intp lzo_int __LZO_MMODEL *
#define lzo_voidpp lzo_voidp __LZO_MMODEL *
#define lzo_bytepp lzo_bytep __LZO_MMODEL *
#ifndef lzo_sizeof_dict_t
# define lzo_sizeof_dict_t sizeof(lzo_bytep)
#endif
/***********************************************************************
// calling conventions and function types
************************************************************************/
/* linkage */
#if !defined(__LZO_EXTERN_C)
# ifdef __cplusplus
# define __LZO_EXTERN_C extern "C"
# else
# define __LZO_EXTERN_C extern
# endif
#endif
/* calling convention */
#if !defined(__LZO_CDECL)
# if defined(__LZO_DOS16) || defined(__LZO_WIN16)
# define __LZO_CDECL __LZO_CMODEL __cdecl
# elif defined(__LZO_i386) && defined(_MSC_VER)
# define __LZO_CDECL __LZO_CMODEL __cdecl
# elif defined(__LZO_i386) && defined(__WATCOMC__)
# define __LZO_CDECL __LZO_CMODEL __cdecl
# else
# define __LZO_CDECL __LZO_CMODEL
# endif
#endif
#if !defined(__LZO_ENTRY)
# define __LZO_ENTRY __LZO_CDECL
#endif
/* C++ exception specification for extern "C" function types */
#if !defined(__cplusplus)
# undef LZO_NOTHROW
# define LZO_NOTHROW
#elif !defined(LZO_NOTHROW)
# define LZO_NOTHROW
#endif
typedef int
(__LZO_ENTRY *lzo_compress_t) ( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem );
typedef int
(__LZO_ENTRY *lzo_decompress_t) ( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem );
typedef int
(__LZO_ENTRY *lzo_optimize_t) ( lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem );
typedef int
(__LZO_ENTRY *lzo_compress_dict_t)(const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem,
const lzo_byte *dict, lzo_uint dict_len );
typedef int
(__LZO_ENTRY *lzo_decompress_dict_t)(const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem,
const lzo_byte *dict, lzo_uint dict_len );
/* assembler versions always use __cdecl */
typedef int
(__LZO_CDECL *lzo_compress_asm_t)( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem );
typedef int
(__LZO_CDECL *lzo_decompress_asm_t)( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem );
/* a progress indicator callback function */
typedef void (__LZO_ENTRY *lzo_progress_callback_t) (lzo_uint, lzo_uint);
/***********************************************************************
// export information
************************************************************************/
/* DLL export information */
#if !defined(__LZO_EXPORT1)
# define __LZO_EXPORT1
#endif
#if !defined(__LZO_EXPORT2)
# define __LZO_EXPORT2
#endif
/* exported calling convention for C functions */
#if !defined(LZO_PUBLIC)
# define LZO_PUBLIC(_rettype) \
__LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_ENTRY
#endif
#if !defined(LZO_EXTERN)
# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
#endif
#if !defined(LZO_PRIVATE)
# define LZO_PRIVATE(_rettype) static _rettype __LZO_ENTRY
#endif
/* exported __cdecl calling convention for assembler functions */
#if !defined(LZO_PUBLIC_CDECL)
# define LZO_PUBLIC_CDECL(_rettype) \
__LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
#endif
#if !defined(LZO_EXTERN_CDECL)
# define LZO_EXTERN_CDECL(_rettype) __LZO_EXTERN_C LZO_PUBLIC_CDECL(_rettype)
#endif
/* exported global variables (LZO currently uses no static variables and
* is fully thread safe) */
#if !defined(LZO_PUBLIC_VAR)
# define LZO_PUBLIC_VAR(_type) \
__LZO_EXPORT1 _type __LZO_EXPORT2 __LZO_DMODEL
#endif
#if !defined(LZO_EXTERN_VAR)
# define LZO_EXTERN_VAR(_type) extern LZO_PUBLIC_VAR(_type)
#endif
/***********************************************************************
// error codes and prototypes
************************************************************************/
/* Error codes for the compression/decompression functions. Negative
* values are errors, positive values will be used for special but
* normal events.
*/
#define LZO_E_OK 0
#define LZO_E_ERROR (-1)
#define LZO_E_OUT_OF_MEMORY (-2) /* not used right now */
#define LZO_E_NOT_COMPRESSIBLE (-3) /* not used right now */
#define LZO_E_INPUT_OVERRUN (-4)
#define LZO_E_OUTPUT_OVERRUN (-5)
#define LZO_E_LOOKBEHIND_OVERRUN (-6)
#define LZO_E_EOF_NOT_FOUND (-7)
#define LZO_E_INPUT_NOT_CONSUMED (-8)
/* lzo_init() should be the first function you call.
* Check the return code !
*
* lzo_init() is a macro to allow checking that the library and the
* compiler's view of various types are consistent.
*/
#define lzo_init() __lzo_init2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
(int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
(int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
(int)sizeof(lzo_compress_t))
LZO_EXTERN(int) __lzo_init2(unsigned,int,int,int,int,int,int,int,int,int);
/* version functions (useful for shared libraries) */
LZO_EXTERN(unsigned) lzo_version(void);
LZO_EXTERN(const char *) lzo_version_string(void);
LZO_EXTERN(const char *) lzo_version_date(void);
LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
/* string functions */
LZO_EXTERN(int)
lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len);
LZO_EXTERN(lzo_voidp)
lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
LZO_EXTERN(lzo_voidp)
lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
LZO_EXTERN(lzo_voidp)
lzo_memset(lzo_voidp _s, int _c, lzo_uint _len);
/* checksum functions */
LZO_EXTERN(lzo_uint32)
lzo_adler32(lzo_uint32 _adler, const lzo_byte *_buf, lzo_uint _len);
LZO_EXTERN(lzo_uint32)
lzo_crc32(lzo_uint32 _c, const lzo_byte *_buf, lzo_uint _len);
/* misc. */
LZO_EXTERN(lzo_bool) lzo_assert(int _expr);
LZO_EXTERN(int) _lzo_config_check(void);
typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t;
/* align a char pointer on a boundary that is a multiple of `size' */
LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size);
#define LZO_PTR_ALIGN_UP(_ptr,_size) \
((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size)))
/* deprecated - only for backward compatibility */
#define LZO_ALIGN(_ptr,_size) LZO_PTR_ALIGN_UP(_ptr,_size)
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* already included */

File diff suppressed because it is too large Load Diff

View File

@ -1,100 +0,0 @@
/* minilzo.h -- mini subset of the LZO real-time data compression library
This file is part of the LZO real-time data compression library.
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library 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.
The LZO library 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 the LZO library; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer
<markus@oberhumer.com>
http://www.oberhumer.com/opensource/lzo/
*/
/*
* NOTE:
* the full LZO package can be found at
* http://www.oberhumer.com/opensource/lzo/
*/
#ifndef __MINILZO_H
#define __MINILZO_H
#define MINILZO_VERSION 0x1080
#ifdef __LZOCONF_H
# error "you cannot use both LZO and miniLZO"
#endif
#undef LZO_HAVE_CONFIG_H
#include "lzoconf.h"
#if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION)
# error "version mismatch in header files"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************************
//
************************************************************************/
/* Memory required for the wrkmem parameter.
* When the required size is 0, you can also pass a NULL pointer.
*/
#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS
#define LZO1X_1_MEM_COMPRESS ((lzo_uint32) (16384L * lzo_sizeof_dict_t))
#define LZO1X_MEM_DECOMPRESS (0)
/* compression */
LZO_EXTERN(int)
lzo1x_1_compress ( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem );
/* decompression */
LZO_EXTERN(int)
lzo1x_decompress ( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem /* NOT USED */ );
/* safe decompression with overrun testing */
LZO_EXTERN(int)
lzo1x_decompress_safe ( const lzo_byte *src, lzo_uint src_len,
lzo_byte *dst, lzo_uintp dst_len,
lzo_voidp wrkmem /* NOT USED */ );
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* already included */

116
amxmodx/mm_pextensions.h Executable file
View File

@ -0,0 +1,116 @@
/*
* Copyright (c) 2004 Jussi Kivilinna
*
* This file is part of "Metamod All-Mod-Support"-patch for Metamod.
*
* Metamod 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.
*
* Metamod 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 Metamod; 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 MM_PEXTENSIONS_H
#define MM_PEXTENSIONS_H
#include "plinfo.h" // plid_t
#include "meta_api.h" // PLUG_LOADTIME
/*
How to use:
1. Add new export function 'Meta_PExtGiveFnptrs' to your plugin file.
'Meta_PExtGiveFnptrs' will be called right after 'Meta_Query' call.
2. Meta_PExtGiveFnptrs is called with interface version 'META_PEXT_VERSION'
and pointer to extension function table.
3. Meta_PExtGiveFnptrs should return plugin's interface version.
4. !NOTE! Metamod will not stop loading plugin even if plugin returns
interface version greater than current. Plugin should disable itself in
this kind of situation.
Example:
#include "mm_pextensions.h"
pextension_funcs_t *gpMetaPExtFuncs;
int Meta_PExtGiveFnptrs(int interfaceVersion, pextension_funcs_t *pMetaPExtFuncs) {
if(interfaceVersion < META_PEXT_VERSION) {
LOG_DEVELOPER(PLID, "Error! Metamod is too old, please update!");
gpMetaPExtFuncs = NULL;
return(META_PEXT_VERSION);
}
gpMetaPExtFuncs = pMetaPExtFuncs;
return(META_PEXT_VERSION);
}
Callback functions:
- int PEXT_LOAD_PLUGIN_BY_NAME(PLID, const char *cmdline, PLUG_LOADTIME now, void **plugin_handle);
Parses 'cmdline' as metamod would parse 'meta load <cmdline>' and loads found
plugin. If 'plugin_handle' is set, metamod writes module handle of loaded
plugin at it.
Returns zero on success.
For error codes see 'META_ERRNO' in 'types_meta.h'.
- int PEXT_UNLOAD_PLUGIN_BY_NAME(PLID, const char *cmdline, PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
Parses 'cmdline' as metamod would parse 'meta unload <cmdline>' and
unloads found plugin.
Returns zero on success.
For error codes see 'META_ERRNO' in 'types_meta.h'.
- int PEXT_UNLOAD_PLUGIN_BY_HANDLE(PLID, void *plugin_handle, PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
Unloads plugin with 'plugin_handle'.
Returns zero on success.
For error codes see 'META_ERRNO' in 'types_meta.h'.
!NOTE! Plugin cannot unload itself!
*/
// Interface version
// 1: first version. Used in p13
// 2: Complete remake (p14):
// pfnLoadMetaPluginByName
// pfnUnloadMetaPluginByName
// pfnUnloadMetaPluginByHandle
// v2 is locked now. Don't modify old functions. If you add new functions, increase META_PEXT_VERSION.
#define META_PEXT_VERSION 2
// Meta PExtension Function table type.
typedef struct pextension_funcs_s {
int (*pfnLoadMetaPluginByName)(plid_t plid, const char *cmdline, PLUG_LOADTIME now, void **plugin_handle);
int (*pfnUnloadMetaPluginByName)(plid_t plid, const char *cmdline, PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
int (*pfnUnloadMetaPluginByHandle)(plid_t plid, void *plugin_handle, PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
} pextension_funcs_t;
// Convenience macros for MetaPExtension functions.
#define PEXT_LOAD_PLUGIN_BY_NAME (*gpMetaPExtFuncs->pfnLoadMetaPluginByName)
#define PEXT_UNLOAD_PLUGIN_BY_NAME (*gpMetaPExtFuncs->pfnUnloadMetaPluginByName)
#define PEXT_UNLOAD_PLUGIN_BY_HANDLE (*gpMetaPExtFuncs->pfnUnloadMetaPluginByHandle)
// Give plugin extension function table.
C_DLLEXPORT int Meta_PExtGiveFnptrs(int interfaceVersion,
pextension_funcs_t *pMetaPExtFuncs);
typedef int (*META_GIVE_PEXT_FUNCTIONS_FN) (int interfaceVersion,
pextension_funcs_t *pMetaPExtFuncs);
#endif /* MM_PEXTENSIONS_H */

View File

@ -29,12 +29,17 @@
* version. * version.
*/ */
#ifdef __linux__
#include <malloc.h>
#include <stdlib.h>
#include <sys/mman.h>
#endif
#include "amxmodx.h" #include "amxmodx.h"
#include "osdep.h" // sleep, etc #include "osdep.h" // sleep, etc
#include "CFile.h" #include "CFile.h"
#include "amxxfile.h" #include "amxxfile.h"
CList<CModule> g_modules; CList<CModule,const char*> g_modules;
CList<CScript,AMX*> g_loadedscripts; CList<CScript,AMX*> g_loadedscripts;
CModule *g_CurrentlyCalledModule = NULL; // The module we are in at the moment; NULL otherwise CModule *g_CurrentlyCalledModule = NULL; // The module we are in at the moment; NULL otherwise
@ -44,7 +49,6 @@ ModuleCallReason g_ModuleCallReason;
extern const char* no_function; // stupid work around extern const char* no_function; // stupid work around
void report_error( int code, char* fmt, ... ) void report_error( int code, char* fmt, ... )
{ {
va_list argptr; va_list argptr;
@ -88,7 +92,7 @@ void free_amxmemory(void **ptr)
*ptr = 0; *ptr = 0;
} }
int load_amxscript(AMX *amx, void **program, const char *filename, char error[64]) int load_amxscript(AMX *amx, void **program, const char *filename, char error[64], int debug)
{ {
*error = 0; *error = 0;
CAmxxReader reader(filename, SMALL_CELL_SIZE / 8); CAmxxReader reader(filename, SMALL_CELL_SIZE / 8);
@ -132,6 +136,8 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
case CAmxxReader::Err_Decompress: case CAmxxReader::Err_Decompress:
strcpy(error, "Internal error: Decompress"); strcpy(error, "Internal error: Decompress");
return (amx->error = AMX_ERR_NOTFOUND); return (amx->error = AMX_ERR_NOTFOUND);
case CAmxxReader::Err_OldFile:
strcpy(error, "Plugin uses deprecated format. Update compiler");
default: default:
strcpy(error, "Unknown error"); strcpy(error, "Unknown error");
return (amx->error = AMX_ERR_NOTFOUND); return (amx->error = AMX_ERR_NOTFOUND);
@ -147,6 +153,13 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
return (amx->error = AMX_ERR_FORMAT); return (amx->error = AMX_ERR_FORMAT);
} }
if ( (int)CVAR_GET_FLOAT("amx_debug") >= 2 || debug)
{
//automatic debug mode
hdr->flags |= AMX_FLAG_LINEOPS;
hdr->flags |= AMX_FLAG_DEBUG;
}
int err; int err;
memset(amx, 0, sizeof(*amx)); memset(amx, 0, sizeof(*amx));
if ((err = amx_Init( amx, *program )) != AMX_ERR_NONE) if ((err = amx_Init( amx, *program )) != AMX_ERR_NONE)
@ -155,7 +168,6 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
return (amx->error = AMX_ERR_INIT); return (amx->error = AMX_ERR_INIT);
} }
#ifdef JIT #ifdef JIT
void *np = new char[ amx->code_size ]; void *np = new char[ amx->code_size ];
void *rt = new char[ amx->reloc_size ]; void *rt = new char[ amx->reloc_size ];
@ -167,10 +179,16 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
return (amx->error = AMX_ERR_INIT); return (amx->error = AMX_ERR_INIT);
} }
if (amx_InitJIT(amx, rt, np) == AMX_ERR_NONE) if ( (err = amx_InitJIT(amx, rt, np)) == AMX_ERR_NONE )
{ {
//amx->base = (unsigned char FAR *)realloc( np, amx->code_size ); //amx->base = (unsigned char FAR *)realloc( np, amx->code_size );
#ifndef __linux__
amx->base = new unsigned char[ amx->code_size ]; amx->base = new unsigned char[ amx->code_size ];
#else
//posix_memalign((void **)&(amx->base), sysconf(_SC_PAGESIZE), amx->code_size);
amx->base = (unsigned char *)memalign(sysconf(_SC_PAGESIZE), amx->code_size);
mprotect((void *)amx->base, amx->code_size, PROT_READ|PROT_WRITE|PROT_EXEC);
#endif
if ( amx->base ) if ( amx->base )
memcpy( amx->base , np , amx->code_size ); memcpy( amx->base , np , amx->code_size );
delete[] np; delete[] np;
@ -186,7 +204,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
{ {
delete[] np; delete[] np;
delete[] rt; delete[] rt;
strcpy(error,"Failed to initialize plugin"); sprintf(error, "Failed to initialize plugin (%d)", err);
return (amx->error = AMX_ERR_INIT_JIT); return (amx->error = AMX_ERR_INIT_JIT);
} }
@ -205,9 +223,96 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
return set_amxnatives(amx,error); return set_amxnatives(amx,error);
} }
const char *StrCaseStr(const char *as, const char *bs)
{
static char a[256];
static char b[256];
unsigned int i = 0;
unsigned int len = strlen(as);
if (len > 254)
len = 254;
for (i=0; i<len; i++)
{
a[i] = tolower(as[i]);
}
a[len] = 0;
len = strlen(bs);
if (len > 254)
len = 254;
for (i=0; i<len; i++)
{
b[i] = tolower(bs[i]);
}
b[len] = 0;
return strstr(a,b);
}
//BAILOPAN
int CheckModules(AMX *amx, char error[64])
{
int idx = 0, flag = -1;
if (amx_FindPublic(amx, "plugin_modules", &idx) == AMX_ERR_NONE)
{
cell retVal = 0;
int err = 0;
if ( (err = amx_Exec(amx, &retVal, idx, 0)) == AMX_ERR_NONE )
{
unsigned int i = 0;
while (!CurModuleList.empty())
{
if (!flag)
{
CurModuleList.pop();
continue;
}
//assume module is not found
flag = 0;
for (CList<CModule,const char *>::iterator pMod = g_modules.begin(); pMod; ++pMod)
{
if (strcmpi(CurModuleList.front().c_str(), "dbi") == 0)
{
if (StrCaseStr( (*pMod).getName(), "sql") || strstr( (*pMod).getName(), "dbi" ))
{
// the module checks in
flag = 1;
break;
}
} else {
if (strcmpi( (*pMod).getName(), CurModuleList.front().c_str() ) == 0)
{
flag = 1;
break;
}
}
}
//module was not found
if (!flag)
{
sprintf(error, "Module \"%s\" required for plugin. Check modules.ini.", CurModuleList.front().c_str());
}
CurModuleList.pop();
}
} else {
AMXXLOG_Log("[AMXX] Run time error %d on line %ld during module check.", err, amx->curline);
//could not execute
return -1; //bad! very bad!
}
} else {
return -1;
}
return flag;
}
int set_amxnatives(AMX* amx,char error[64]) int set_amxnatives(AMX* amx,char error[64])
{ {
for ( CList<CModule>::iterator a = g_modules.begin(); a ; ++a ) for ( CList<CModule,const char *>::iterator a = g_modules.begin(); a ; ++a )
{ {
for( CList<AMX_NATIVE_INFO*>::iterator cc = for( CList<AMX_NATIVE_INFO*>::iterator cc =
(*a).m_Natives.begin(); cc; ++cc ) (*a).m_Natives.begin(); cc; ++cc )
@ -224,14 +329,29 @@ int set_amxnatives(AMX* amx,char error[64])
if ( amx_Register(amx, core_Natives, -1) != AMX_ERR_NONE ) if ( amx_Register(amx, core_Natives, -1) != AMX_ERR_NONE )
{ {
sprintf(error,"Function not found (name \"%s\")",no_function); //HACKHACK - if we get here, nullify the plugin's native table
//then reregister the one native we need
// - BAILOPAN
String save;
save.assign(no_function);
amx_NullNativeTable(amx);
AMX_NATIVE_INFO p[] = {
{ "require_module", require_module },
{ NULL, NULL },
};
amx_Register(amx, p, -1);
if (CheckModules(amx, error) == -1 || *error == 0)
{
sprintf(error,"Plugin uses an unknown function (name \"%s\") - check your modules.ini.",save.c_str());
}
return (amx->error = AMX_ERR_NATIVE); return (amx->error = AMX_ERR_NATIVE);
} }
CheckModules(amx, error);
return AMX_ERR_NONE; return AMX_ERR_NONE;
} }
int unload_amxscript(AMX* amx, void** program) int unload_amxscript(AMX* amx, void** program)
{ {
CList<CScript,AMX*>::iterator a = g_loadedscripts.find( amx ); CList<CScript,AMX*>::iterator a = g_loadedscripts.find( amx );
@ -330,7 +450,7 @@ char* build_pathname_addons(char *fmt, ... )
int add_amxnatives(module_info_s* info,AMX_NATIVE_INFO*natives) int add_amxnatives(module_info_s* info,AMX_NATIVE_INFO*natives)
{ {
CList<CModule>::iterator a = g_modules.begin(); CList<CModule,const char *>::iterator a = g_modules.begin();
while ( a ) while ( a )
{ {
@ -362,9 +482,109 @@ bool validFile(const char* file)
#endif #endif
} }
void ConvertModuleName(const char *pathString, String &path)
{
#if SMALL_CELL_SIZE==64
char *ptr = strstr(pathString, "i386");
if (ptr)
{
//attempt to fix the binary name
*ptr = 0;
path.assign(pathString);
path.append("amd64.so");
} else {
ptr = strstr(pathString, ".dll");
if (ptr)
{
*ptr = 0;
path.assign(pathString);
path.append("_amd64.so");
} else {
ptr = strstr(pathString, ".so");
if (ptr)
{
path.assign(pathString);
} else {
//no extension at all
path.assign(pathString);
path.append("_amd64.so");
}
}
}
#else
#ifdef __linux__
char *ptr = strstr(pathString, "amd64");
if (ptr)
{
//attempt to fix the binary name
*ptr = 0;
path.assign(pathString);
path.append("i386.so");
} else {
ptr = strstr(pathString, ".dll");
if (ptr)
{
*ptr = 0;
path.assign(pathString);
path.append("_i386.so");
} else {
//check to see if this file even has an extension
ptr = strstr(pathString, ".so");
if (ptr)
{
path.assign(pathString);
} else {
path.assign(pathString);
path.append("_i386.so");
}
}
}
#else
char *ptr = strstr(pathString, ".dll");
if (ptr)
{
path.assign(pathString);
} else {
//prevent this from loading .so too
ptr = strstr(pathString, ".so");
if (ptr)
{
int i = 0, len = strlen(pathString), c = -1;
for (i=len-1; i>=0; i--)
{
//cut off at first _
if (pathString[i] == '_')
{
//make sure this is a valid _
if (i == len-1 || strncmp(&(pathString[i+1]), "amxx", 4) == 0)
break;
c = i;
break;
}
}
*ptr = 0;
if (c == -1)
{
path.assign(pathString);
path.append(".dll");
} else {
ptr = (char *)&(pathString[c]);
*ptr = 0;
path.assign(pathString);
path.append(".dll");
}
} else {
path.assign(pathString);
path.append(".dll");
}
}
#endif //__linux__
#endif //SMALL_CELL_SIZE==64
}
int loadModules(const char* filename) int loadModules(const char* filename)
{ {
File fp( build_pathname("%s",filename), "r" ); FILE *fp = fopen(build_pathname("%s",filename), "rt");
if ( !fp ) if ( !fp )
{ {
@ -372,66 +592,90 @@ int loadModules(const char* filename)
return 0; return 0;
} }
char line[256], moduleName[256]; char moduleName[256];
char pathString[512];
String line;
int loaded = 0; int loaded = 0;
while ( fp.getline( line , 255 ) ) String path;
while (!feof(fp))
{ {
if (!line._fread(fp) || line.size() < 1)
continue;
line.trim();
*moduleName = 0; *moduleName = 0;
sscanf(line,"%s",moduleName); if (sscanf(line.c_str(),"%s",moduleName) == EOF)
if (!isalnum(*moduleName) || !validFile(moduleName) ) continue;
if (moduleName[0] == ';')
continue; continue;
char* pathname = build_pathname("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxx/modules"), line);
CList<CModule>::iterator a = g_modules.find( pathname ); char* pathname = build_pathname("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxmodx/modules"), moduleName);
strcpy(pathString, pathname);
path.assign("");
ConvertModuleName(pathString, path);
if (!validFile(path.c_str()))
continue;
CList<CModule,const char *>::iterator a = g_modules.find( path.c_str() );
if ( a ) continue; // already loaded if ( a ) continue; // already loaded
CModule* cc = new CModule( pathname ); CModule* cc = new CModule( path.c_str() );
if ( cc == 0 ) return loaded; if ( cc == 0 )
{
fclose(fp);
return loaded;
}
cc->queryModule(); cc->queryModule();
switch( cc->getStatusValue() ) { switch( cc->getStatusValue() ) {
case MODULE_BADLOAD: case MODULE_BADLOAD:
report_error( 1 , "[AMXX] Module is not a valid library (file \"%s\")",pathname ); report_error( 1 , "[AMXX] Module is not a valid library (file \"%s\")", path.c_str());
break; break;
case MODULE_NOINFO: case MODULE_NOINFO:
report_error( 1 ,"[AMXX] Couldn't find info. about module (file \"%s\")",pathname ); report_error( 1 ,"[AMXX] Couldn't find info. about module (file \"%s\")", path.c_str());
break; break;
case MODULE_NOQUERY: case MODULE_NOQUERY:
report_error( 1 , "[AMXX] Couldn't find \"AMX_Query\" or \"AMXX_Query\" (file \"%s\")", pathname ); report_error( 1 , "[AMXX] Couldn't find \"AMX_Query\" or \"AMXX_Query\" (file \"%s\")", path.c_str());
break; break;
case MODULE_NOATTACH: case MODULE_NOATTACH:
report_error( 1 , "[AMXX] Couldn't find \"%s\" (file \"%s\")", cc->isAmxx() ? "AMXX_Attach" : "AMX_Attach", pathname ); report_error( 1 , "[AMXX] Couldn't find \"%s\" (file \"%s\")", cc->isAmxx() ? "AMXX_Attach" : "AMX_Attach", path.c_str());
break; break;
case MODULE_OLD: case MODULE_OLD:
report_error( 1 , "[AMXX] Module has a different interface version (file \"%s\")",pathname ); report_error( 1 , "[AMXX] Module has a different interface version (file \"%s\")",path.c_str());
break; break;
case MODULE_NEWER: case MODULE_NEWER:
report_error(1, "[AMXX] Module has a newer interface version (file \"%s\"). Please download a new amxmodx.", pathname); report_error(1, "[AMXX] Module has a newer interface version (file \"%s\"). Please download a new amxmodx.", path.c_str());
break; break;
case MODULE_INTERROR: case MODULE_INTERROR:
report_error(1, "[AMXX] Internal error during module load (file \"%s\")", pathname); report_error(1, "[AMXX] Internal error during module load (file \"%s\")", path.c_str());
break; break;
case MODULE_NOT64BIT: case MODULE_NOT64BIT:
report_error(1, "[AMXX] Module \"%s\" is not 64 bit compatible.", pathname); report_error(1, "[AMXX] Module \"%s\" is not 64 bit compatible.", path.c_str());
break; break;
default: default:
++loaded; ++loaded;
} }
g_modules.put( cc ); g_modules.put( cc );
} }
fclose(fp);
return loaded; return loaded;
} }
void detachModules() void detachModules()
{ {
CList<CModule>::iterator a = g_modules.begin(); CList<CModule,const char *>::iterator a = g_modules.begin();
while ( a ) while ( a )
{ {
@ -442,7 +686,7 @@ void detachModules()
void detachReloadModules() void detachReloadModules()
{ {
CList<CModule>::iterator a = g_modules.begin(); CList<CModule,const char *>::iterator a = g_modules.begin();
while ( a ) while ( a )
{ {
@ -460,7 +704,7 @@ void detachReloadModules()
void attachModules() void attachModules()
{ {
CList<CModule>::iterator a = g_modules.begin(); CList<CModule,const char *>::iterator a = g_modules.begin();
while ( a ) while ( a )
{ {
@ -512,6 +756,7 @@ void attachMetaModModules(PLUG_LOADTIME now, const char* filename)
} }
char line[256], moduleName[256]; char line[256], moduleName[256];
String modPath, mmPath;
DLHANDLE module; DLHANDLE module;
while ( fp.getline( line , 255 ) ) while ( fp.getline( line , 255 ) )
@ -519,12 +764,34 @@ void attachMetaModModules(PLUG_LOADTIME now, const char* filename)
*moduleName = 0; *moduleName = 0;
sscanf(line,"%s",moduleName); sscanf(line,"%s",moduleName);
if (!isalnum(*moduleName) || !validFile(moduleName) ) if (!isalnum(*moduleName))
continue; continue;
char* pathname = build_pathname("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxx/modules"), line); char* pathname = build_pathname("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxmodx/modules"), line);
char* mmpathname = build_pathname_addons("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxx/modules"), line); char* mmpathname = build_pathname_addons("%s/%s", get_localinfo("amxx_modulesdir", "addons/amxmodx/modules"), line);
module = DLLOAD( pathname ); // link dll
ConvertModuleName(pathname, modPath);
ConvertModuleName(mmpathname, mmPath);
CList<CFakeMeta::CFakeMetaPlugin>::iterator iter = g_FakeMeta.m_Plugins.begin();
//prevent double loading
int foundFlag = 0;
while (iter)
{
if ( strcmp( (*iter).GetPath(), mmPath.c_str() ) == 0 )
{
foundFlag = 1;
break;
}
++iter;
}
if (foundFlag)
continue;
module = DLLOAD( modPath.c_str() ); // link dll
if ( module ) if ( module )
{ {
@ -533,7 +800,7 @@ void attachMetaModModules(PLUG_LOADTIME now, const char* filename)
if ( a ) if ( a )
{ {
g_FakeMeta.AddPlugin(mmpathname); g_FakeMeta.AddPlugin(mmPath.c_str());
} }
} }
} }
@ -546,7 +813,7 @@ void attachMetaModModules(PLUG_LOADTIME now, const char* filename)
// Get the number of running modules // Get the number of running modules
int countModules(CountModulesMode mode) int countModules(CountModulesMode mode)
{ {
CList<CModule>::iterator iter; CList<CModule,const char *>::iterator iter;
int num; int num;
switch (mode) switch (mode)
{ {
@ -579,7 +846,7 @@ int countModules(CountModulesMode mode)
// Call all modules' AMXX_PluginsLoaded functions // Call all modules' AMXX_PluginsLoaded functions
void modules_callPluginsLoaded() void modules_callPluginsLoaded()
{ {
CList<CModule>::iterator iter = g_modules.begin(); CList<CModule,const char *>::iterator iter = g_modules.begin();
while (iter) while (iter)
{ {
(*iter).CallPluginsLoaded(); (*iter).CallPluginsLoaded();
@ -591,7 +858,7 @@ void modules_callPluginsLoaded()
int MNF_AddNatives(AMX_NATIVE_INFO* natives) int MNF_AddNatives(AMX_NATIVE_INFO* natives)
{ {
CList<CModule>::iterator a = g_modules.begin(); CList<CModule,const char *>::iterator a = g_modules.begin();
if (!g_CurrentlyCalledModule || g_ModuleCallReason != ModuleCall_Attach) if (!g_CurrentlyCalledModule || g_ModuleCallReason != ModuleCall_Attach)
return FALSE; // may only be called from attach return FALSE; // may only be called from attach
@ -701,6 +968,14 @@ char *MNF_FormatAmxString(AMX *amx, cell *params, int startParam, int *pLen)
return retVal; return retVal;
} }
int MNF_GetPlayerFlags(int id)
{
if (id < 1 || id > gpGlobals->maxClients)
return 0;
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
return (pPlayer->flags[0]);
}
void MNF_CopyAmxMemory(cell * dest, const cell * src, int len) void MNF_CopyAmxMemory(cell * dest, const cell * src, int len)
{ {
memcpy((void*)dest, (const void *)src, (size_t)len*sizeof(cell)); memcpy((void*)dest, (const void *)src, (size_t)len*sizeof(cell));
@ -849,11 +1124,199 @@ void MNF_Log(const char *fmt, ...)
AMXXLOG_Log("%s", msg); AMXXLOG_Log("%s", msg);
} }
//by BAILOPAN
// generic error printing routine
void GenericError(AMX *amx, int err, int line, char buf[], const char *file)
{
static const char *amx_errs[] =
{
NULL,
"forced exit",
"assertion failed",
"stack error",
"index out of bounds",
"memory access",
"invalid instruction",
"stack low",
"heap low",
"callback",
"native",
"divide",
"sleep",
NULL,
NULL,
NULL,
"out of memory", //16
"bad file format",
"bad file version",
"function not found",
"invalid entry point",
"debugger cannot run",
"plugin un or re-initialized",
"userdata table full",
"JIT failed to initialize",
"parameter error",
"domain error",
};
//does this plugin have line ops?
const char *geterr = NULL;
if (err > 26 || err < 0)
geterr = NULL;
else
geterr = amx_errs[err];
if (!(amx->flags & AMX_FLAG_LINEOPS))
{
if (geterr == NULL)
{
sprintf(buf, "Run time error %d (plugin \"%s\" - debug not enabled).", err, g_plugins.findPluginFast(amx)->getName());
} else {
sprintf(buf, "Run time error %d (%s) (plugin \"%s\") - debug not enabled.", err, geterr, g_plugins.findPluginFast(amx)->getName());
}
} else {
if (geterr == NULL)
{
sprintf(buf, "Run time error %d on line %d (%s \"%s\").", err, line, (file?"file":"plugin"), (file?file:g_plugins.findPluginFast(amx)->getName()));
} else {
if (err == AMX_ERR_NATIVE && amx->userdata[2])
{
geterr = (char *)(amx->userdata[2]);
sprintf(buf, "Native error in \"%s\" on line %d (%s \"%s\").", geterr, line, (file?"file":"plugin"), (file?file:g_plugins.findPluginFast(amx)->getName()));
} else {
sprintf(buf, "Run time error %d (%s) on line %d (%s \"%s\").", err, geterr, line, (file?"file":"plugin"), (file?file:g_plugins.findPluginFast(amx)->getName()));
}
}
}
}
//by BAILOPAN
// debugger engine front end
void LogError(AMX *amx, int err, const char *fmt, ...)
{
//does this plugin have debug info?
va_list arg;
AMX_DBG *dbg = (AMX_DBG *)(amx->userdata[0]);
static char buf[1024];
static char vbuf[1024];
*buf = 0;
*vbuf = 0;
va_start(arg, fmt);
vsprintf(vbuf, fmt, arg);
va_end(arg);
if (!dbg || !(dbg->tail))
{
if (dbg && amx->curfile < dbg->numFiles && amx->curfile >= 0)
{
GenericError(amx, err, amx->curline, buf, dbg->files[amx->curfile]);
} else {
GenericError(amx, err, amx->curline, buf, NULL);
}
AMXXLOG_Log("[AMXX] %s", buf);
if (*vbuf)
{
AMXXLOG_Log("%s", vbuf);
}
if (!dbg)
{
AMXXLOG_Log("[AMXX] To enable debug mode, add \" debug\" after the plugin name in plugins.ini (without quotes).");
}
} else {
AMX_TRACE *t = dbg->tail;
AMX_DEBUGCALL tracer = (AMX_DEBUGCALL)(amx->userdata[1]);
//actuall
cell line = amx->curline;
cell file = amx->curfile;
int i = 0;
GenericError(amx, err, line, buf, NULL);
AMXXLOG_Log("[AMXX] %s", buf);
if (*vbuf)
{
AMXXLOG_Log("%s", vbuf);
}
AMXXLOG_Log("[AMXX] Debug Trace =>");
//log the error right away
if (file >= dbg->numFiles || file < 0)
{
AMXXLOG_Log("[AMXX] [%d] Line %d, File \"%s\"", i++, line, g_plugins.findPluginFast(amx)->getName());
} else {
AMXXLOG_Log("[AMXX] [%d] Line %d, File \"%s\"", i++, line, dbg->files[file]);
}
while (t != NULL)
{
line = t->line;
file = t->file;
if (file >= dbg->numFiles)
{
AMXXLOG_Log("[AMXX] [%d] Line %d, File \"%s\"", i++, line, g_plugins.findPluginFast(amx)->getName());
} else {
AMXXLOG_Log("[AMXX] [%d] Line %d, File \"%s\"", i++, line, dbg->files[file]);
}
if (tracer)
(tracer)(amx, 1); //pop
t = dbg->tail;
}
}
}
void MNF_MergeDefinitionFile(const char *file) void MNF_MergeDefinitionFile(const char *file)
{ {
g_langMngr.MergeDefinitionFile(file); g_langMngr.MergeDefinitionFile(file);
} }
edict_t* MNF_GetPlayerEdict(int id)
{
if (id < 1 || id > gpGlobals->maxClients)
return NULL;
return (GET_PLAYER_POINTER_I(id)->pEdict);
}
const char *MNF_Format(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
const char *retVal = g_langMngr.FormatString(fmt, ap);
va_end(ap);
return retVal;
}
const char *MNF_GetPlayerTeam(int id)
{
if (id < 1 || id > gpGlobals->maxClients)
return NULL;
return (GET_PLAYER_POINTER_I(id)->team.c_str());
}
#ifndef MEMORY_TEST
void *MNF_Allocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc, const unsigned int allocationType, const size_t reportedSize)
{
return malloc(reportedSize);
}
void *MNF_Reallocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc, const unsigned int reallocationType, const size_t reportedSize, void *reportedAddress)
{
return realloc(reportedAddress, reportedSize);
}
void MNF_Deallocator(const char *sourceFile, const unsigned int sourceLine, const char *sourceFunc, const unsigned int deallocationType, void *reportedAddress)
{
free(reportedAddress);
}
#endif
// 09/18/2004 : added these two funcs that default to copyBack=false so we don't break all modules
cell MNF_PrepareCellArray(cell *ptr, unsigned int size)
{
return prepareCellArray(ptr, size, false);
}
cell MNF_PrepareCharArray(char *ptr, unsigned int size)
{
return prepareCharArray(ptr, size, false);
}
// Fnptr Request function for the new interface // Fnptr Request function for the new interface
const char *g_LastRequestedFunc = NULL; const char *g_LastRequestedFunc = NULL;
#define REGISTER_FUNC(name, func) { name, (void*)func }, #define REGISTER_FUNC(name, func) { name, (void*)func },
@ -871,7 +1334,9 @@ void *Module_ReqFnptr(const char *funcName)
REGISTER_FUNC("PrintSrvConsole", print_srvconsole) REGISTER_FUNC("PrintSrvConsole", print_srvconsole)
REGISTER_FUNC("GetModname", MNF_GetModname) REGISTER_FUNC("GetModname", MNF_GetModname)
REGISTER_FUNC("Log", MNF_Log) REGISTER_FUNC("Log", MNF_Log)
REGISTER_FUNC("LogError", LogError)
REGISTER_FUNC("MergeDefinitionFile", MNF_MergeDefinitionFile) REGISTER_FUNC("MergeDefinitionFile", MNF_MergeDefinitionFile)
REGISTER_FUNC("Format", MNF_Format)
// Amx scripts loading / unloading / managing // Amx scripts loading / unloading / managing
REGISTER_FUNC("GetAmxScript", MNF_GetAmxScript) REGISTER_FUNC("GetAmxScript", MNF_GetAmxScript)
@ -894,6 +1359,7 @@ void *Module_ReqFnptr(const char *funcName)
REGISTER_FUNC("amx_Execv", amx_Execv) REGISTER_FUNC("amx_Execv", amx_Execv)
REGISTER_FUNC("amx_Allot", amx_Allot) REGISTER_FUNC("amx_Allot", amx_Allot)
REGISTER_FUNC("amx_FindPublic", amx_FindPublic) REGISTER_FUNC("amx_FindPublic", amx_FindPublic)
REGISTER_FUNC("amx_FindNative", amx_FindNative)
// Natives / Forwards // Natives / Forwards
REGISTER_FUNC("AddNatives", MNF_AddNatives) REGISTER_FUNC("AddNatives", MNF_AddNatives)
@ -903,10 +1369,13 @@ void *Module_ReqFnptr(const char *funcName)
REGISTER_FUNC("RegisterSPForwardByName", registerSPForwardByName) REGISTER_FUNC("RegisterSPForwardByName", registerSPForwardByName)
REGISTER_FUNC("UnregisterSPForward", unregisterSPForward) REGISTER_FUNC("UnregisterSPForward", unregisterSPForward)
REGISTER_FUNC("ExecuteForward", executeForwards) REGISTER_FUNC("ExecuteForward", executeForwards)
REGISTER_FUNC("PrepareCellArray", prepareCellArray) REGISTER_FUNC("PrepareCellArray", MNF_PrepareCellArray)
REGISTER_FUNC("PrepareCharArray", prepareCharArray) REGISTER_FUNC("PrepareCharArray", MNF_PrepareCharArray)
REGISTER_FUNC("PrepareCellArrayA", prepareCellArray)
REGISTER_FUNC("PrepareCharArrayA", prepareCharArray)
// Player // Player
REGISTER_FUNC("GetPlayerFlags", MNF_GetPlayerFlags)
REGISTER_FUNC("IsPlayerValid", MNF_IsPlayerValid) REGISTER_FUNC("IsPlayerValid", MNF_IsPlayerValid)
REGISTER_FUNC("GetPlayerName", MNF_GetPlayerName) REGISTER_FUNC("GetPlayerName", MNF_GetPlayerName)
REGISTER_FUNC("GetPlayerIP", MNF_GetPlayerIP) REGISTER_FUNC("GetPlayerIP", MNF_GetPlayerIP)
@ -917,6 +1386,7 @@ void *Module_ReqFnptr(const char *funcName)
REGISTER_FUNC("GetPlayerPlayTime", MNF_GetPlayerPlayTime) REGISTER_FUNC("GetPlayerPlayTime", MNF_GetPlayerPlayTime)
REGISTER_FUNC("GetPlayerCurweapon", MNF_GetPlayerCurweapon) REGISTER_FUNC("GetPlayerCurweapon", MNF_GetPlayerCurweapon)
REGISTER_FUNC("GetPlayerTeamID", MNF_GetPlayerTeamID) REGISTER_FUNC("GetPlayerTeamID", MNF_GetPlayerTeamID)
REGISTER_FUNC("GetPlayerTeam", MNF_GetPlayerTeam)
REGISTER_FUNC("GetPlayerDeaths", MNF_GetPlayerDeaths) REGISTER_FUNC("GetPlayerDeaths", MNF_GetPlayerDeaths)
REGISTER_FUNC("GetPlayerFrags", MNF_GetPlayerFrags) REGISTER_FUNC("GetPlayerFrags", MNF_GetPlayerFrags)
REGISTER_FUNC("GetPlayerMenu", MNF_GetPlayerMenu) REGISTER_FUNC("GetPlayerMenu", MNF_GetPlayerMenu)
@ -926,6 +1396,7 @@ void *Module_ReqFnptr(const char *funcName)
REGISTER_FUNC("IsPlayerHLTV", MNF_IsPlayerHLTV) REGISTER_FUNC("IsPlayerHLTV", MNF_IsPlayerHLTV)
REGISTER_FUNC("GetPlayerArmor", MNF_GetPlayerArmor) REGISTER_FUNC("GetPlayerArmor", MNF_GetPlayerArmor)
REGISTER_FUNC("GetPlayerHealth", MNF_GetPlayerHealth) REGISTER_FUNC("GetPlayerHealth", MNF_GetPlayerHealth)
REGISTER_FUNC("GetPlayerEdict", MNF_GetPlayerEdict)
REGISTER_FUNC("CellToReal", MNF_CellToReal) REGISTER_FUNC("CellToReal", MNF_CellToReal)
REGISTER_FUNC("RealToCell", MNF_RealToCell) REGISTER_FUNC("RealToCell", MNF_RealToCell)
@ -933,6 +1404,10 @@ void *Module_ReqFnptr(const char *funcName)
REGISTER_FUNC("Allocator", m_allocator) REGISTER_FUNC("Allocator", m_allocator)
REGISTER_FUNC("Deallocator", m_deallocator) REGISTER_FUNC("Deallocator", m_deallocator)
REGISTER_FUNC("Reallocator", m_reallocator) REGISTER_FUNC("Reallocator", m_reallocator)
#else
REGISTER_FUNC("Allocator", MNF_Allocator)
REGISTER_FUNC("Deallocator", MNF_Deallocator)
REGISTER_FUNC("Reallocator", MNF_Reallocator)
#endif // MEMORY_TEST #endif // MEMORY_TEST
REGISTER_FUNC("Haha_HiddenStuff", MNF_HiddenStuff) REGISTER_FUNC("Haha_HiddenStuff", MNF_HiddenStuff)

View File

@ -144,7 +144,7 @@ struct pfnmodule_engine_g {
const char* (*pfnget_amxscriptname)(AMX* amx); // amx const char* (*pfnget_amxscriptname)(AMX* amx); // amx
char* (*pfnget_amxstring)(AMX*,cell,int, int&); // amx, src, buffer (0-3), len char* (*pfnget_amxstring)(AMX*,cell,int, int&); // amx, src, buffer (0-3), len
void (*pfnget_modname)(char*); // modname void (*pfnget_modname)(char*); // modname
int (*pfnload_amxscript)(AMX*, void**, const char*, char[64]); // amx, code, path, error info int (*pfnload_amxscript)(AMX*, void**, const char*, char[64], int); // amx, code, path, error info
void (*pfnprint_console)(char*, ...); // format, .... void (*pfnprint_console)(char*, ...); // format, ....
void (*pfnreport_error)(int code, char*, ... ); void (*pfnreport_error)(int code, char*, ... );
int (*pfnset_amxnatives)(AMX*,char[64]); // amx, error info int (*pfnset_amxnatives)(AMX*,char[64]); // amx, error info

View File

@ -42,8 +42,8 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib" AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
OutputFile="debug/amxx_mm.dll" OutputFile="debug/amxmodx_mm.dll"
Version="0.1" Version="0.1"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
@ -112,8 +112,8 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib" AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
OutputFile="release/amxx_mm.dll" OutputFile="release/amxmodx_mm.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32" AdditionalLibraryDirectories="..\extra\lib_win32"
@ -179,8 +179,8 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib" AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
OutputFile="memtestdebug/amxx_mm.dll" OutputFile="memtestdebug/amxmodx_mm.dll"
Version="0.1" Version="0.1"
LinkIncremental="2" LinkIncremental="2"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
@ -249,8 +249,8 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib" AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
OutputFile="memtestrelease/amxx_mm.dll" OutputFile="memtestrelease/amxmodx_mm.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32" AdditionalLibraryDirectories="..\extra\lib_win32"
@ -316,8 +316,8 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib" AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib ..\zlib\zlib.lib"
OutputFile="jitdebug/amxx_mm.dll" OutputFile="jitdebug/amxmodx_mm.dll"
Version="0.1" Version="0.1"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
@ -386,8 +386,8 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib" AdditionalDependencies="..\jit\jits.obj ..\zlib\zlib.lib"
OutputFile="jitrelease/amxx_mm.dll" OutputFile="jitrelease/amxmodx_mm.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32" AdditionalLibraryDirectories="..\extra\lib_win32"
@ -454,8 +454,8 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib" AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib ..\zlib\zlib.lib"
OutputFile="jitmemtestrelease/amxx_mm.dll" OutputFile="jitmemtestrelease/amxmodx_mm.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32" AdditionalLibraryDirectories="..\extra\lib_win32"
@ -525,8 +525,8 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib" AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib ..\zlib\zlib.lib"
OutputFile="MaximalSpeed/amxx_mm.dll" OutputFile="MaximalSpeed/amxmodx_mm.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32" AdditionalLibraryDirectories="..\extra\lib_win32"
@ -646,9 +646,6 @@
<File <File
RelativePath="..\meta_api.cpp"> RelativePath="..\meta_api.cpp">
</File> </File>
<File
RelativePath="..\minilzo\minilzo.c">
</File>
<File <File
RelativePath="..\modules.cpp"> RelativePath="..\modules.cpp">
</File> </File>

807
amxmodx/msvc/amxmodx_mm.vcproj Executable file
View File

@ -0,0 +1,807 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="amxmodx"
ProjectGUID="{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;C:\Hry\Half-Life\SDK\Multiplayer Source\pm_shared&quot;;&quot;C:\Hry\Half-Life\SDK\Multiplayer Source\dlls&quot;;&quot;C:\Hry\Half-Life\SDK\Multiplayer Source\engine&quot;;&quot;C:\Hry\Half-Life\SDK\Multiplayer Source\common&quot;;C:\Files\Programming\metamod\metamod"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
StructMemberAlignment="3"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="amxmodx.h"
PrecompiledHeaderFile=".\debug/amxmodx.pch"
AssemblerListingLocation=".\debug/"
ObjectFile=".\debug/"
ProgramDataBaseFileName=".\debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
OutputFile="debug/amxmodx_mm.dll"
Version="0.1"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\debug/amxx_mm.pdb"
ImportLibrary=".\debug/amxx_mm.lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\debug/amxmodx.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="1"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\..\metamod\metamod,..\..\hlsdk\sourcecode\common,..\..\hlsdk\sourcecode\engine,..\..\hlsdk\sourcecode\dlls,..\..\hlsdk\sourcecode\pm_shared,..\extra\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="amxmodx.h"
PrecompiledHeaderFile=".\release/amxmodx.pch"
AssemblerListingLocation=".\release/"
ObjectFile=".\release/"
ProgramDataBaseFileName=".\release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
OutputFile="release/amxmodx_mm.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
ModuleDefinitionFile=""
ProgramDatabaseFile=".\release/amxx_mm.pdb"
ImportLibrary=".\release/amxx_mm.lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\release/amxmodx.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="MemtestDebug|Win32"
OutputDirectory="MemtestDebug"
IntermediateDirectory="MemtestDebug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;C:\Hry\Half-Life\SDK\Multiplayer Source\pm_shared&quot;;&quot;C:\Hry\Half-Life\SDK\Multiplayer Source\dlls&quot;;&quot;C:\Hry\Half-Life\SDK\Multiplayer Source\engine&quot;;&quot;C:\Hry\Half-Life\SDK\Multiplayer Source\common&quot;;C:\Files\Programming\metamod\metamod"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;MEMORY_TEST"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
StructMemberAlignment="3"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="amxmodx.h"
PrecompiledHeaderFile=".\memtestdebug/amxmodx.pch"
AssemblerListingLocation=".\memtestdebug/"
ObjectFile=".\memtestdebug/"
ProgramDataBaseFileName=".\memtestdebug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
OutputFile="memtestdebug/amxmodx_mm.dll"
Version="0.1"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\memtestdebug/amxx_mm.pdb"
ImportLibrary=".\memtestdebug/amxx_mm.lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\debug/amxmodx.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="MemtestRelease|Win32"
OutputDirectory="MemtestRelease"
IntermediateDirectory="MemtestRelease"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="1"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\..\metamod\metamod,..\..\hlsdk\sourcecode\common,..\..\hlsdk\sourcecode\engine,..\..\hlsdk\sourcecode\dlls,..\..\hlsdk\sourcecode\pm_shared,..\extra\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;MEMORY_TEST"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="amxmodx.h"
PrecompiledHeaderFile=".\memtestrelease/amxmodx.pch"
AssemblerListingLocation=".\memtestrelease/"
ObjectFile=".\memtestrelease/"
ProgramDataBaseFileName=".\memtestrelease/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
OutputFile="memtestrelease/amxmodx_mm.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
ModuleDefinitionFile=""
ProgramDatabaseFile=".\memtestrelease/amxx_mm.pdb"
ImportLibrary=".\memtestrelease/amxx_mm.lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\release/amxmodx.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="JITDebug|Win32"
OutputDirectory="JITDebug"
IntermediateDirectory="JITDebug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;C:\Hry\Half-Life\SDK\Multiplayer Source\pm_shared&quot;;&quot;C:\Hry\Half-Life\SDK\Multiplayer Source\dlls&quot;;&quot;C:\Hry\Half-Life\SDK\Multiplayer Source\engine&quot;;&quot;C:\Hry\Half-Life\SDK\Multiplayer Source\common&quot;;C:\Files\Programming\metamod\metamod"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;JIT"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
StructMemberAlignment="3"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="amxmodx.h"
PrecompiledHeaderFile=".\jitdebug/amxmodx.pch"
AssemblerListingLocation=".\jitdebug/"
ObjectFile=".\jitdebug/"
ProgramDataBaseFileName=".\jitdebug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="..\jit\jits.obj ..\zlib\zlib.lib"
OutputFile="jitdebug/amxmodx_mm.dll"
Version="0.1"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\jitdebug/amxx_mm.pdb"
ImportLibrary=".\jitdebug/amxx_mm.lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\debug/amxmodx.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="JITRelease|Win32"
OutputDirectory="JITRelease"
IntermediateDirectory="JITRelease"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="1"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\..\metamod\metamod,..\..\hlsdk\sourcecode\common,..\..\hlsdk\sourcecode\engine,..\..\hlsdk\sourcecode\dlls,..\..\hlsdk\sourcecode\pm_shared,..\extra\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;JIT"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="amxmodx.h"
PrecompiledHeaderFile=".\jitrelease/amxmodx.pch"
AssemblerListingLocation=".\jitrelease/"
ObjectFile=".\jitrelease/"
ProgramDataBaseFileName=".\jitrelease/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="..\jit\jits.obj ..\zlib\zlib.lib"
OutputFile="jitrelease/amxmodx_mm.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
ModuleDefinitionFile=""
ProgramDatabaseFile=".\jitrelease/amxx_mm.pdb"
ImportLibrary=".\jitrelease/amxx_mm.lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\release/amxmodx.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="JITMemtestRelease|Win32"
OutputDirectory="JITMemtestRelease"
IntermediateDirectory="JITMemtestRelease"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="1"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\..\metamod\metamod,..\..\hlsdk\sourcecode\common,..\..\hlsdk\sourcecode\engine,..\..\hlsdk\sourcecode\dlls,..\..\hlsdk\sourcecode\pm_shared,..\extra\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;MEMORY_TEST;JIT"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="amxmodx.h"
PrecompiledHeaderFile=".\jitmemtestrelease/amxmodx.pch"
AssemblerListingLocation=".\jitmemtestrelease/"
ObjectFile=".\jitmemtestrelease/"
ProgramDataBaseFileName=".\jitmemtestrelease/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib ..\zlib\zlib.lib"
OutputFile="jitmemtestrelease/amxmodx_mm.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
ModuleDefinitionFile=""
ProgramDatabaseFile=".\jitmemtestrelease/amxx_mm.pdb"
ImportLibrary=".\jitmemtestrelease/amxx_mm.lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\release/amxmodx.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="MaximalSpeed|Win32"
OutputDirectory="MaximalSpeed"
IntermediateDirectory="MaximalSpeed"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OptimizeForProcessor="2"
OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories="..\..\metamod\metamod,..\..\hlsdk\sourcecode\common,..\..\hlsdk\sourcecode\engine,..\..\hlsdk\sourcecode\dlls,..\..\hlsdk\sourcecode\pm_shared,..\extra\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;JIT"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="amxmodx.h"
PrecompiledHeaderFile=".\MaximalSpeed/amxmodx.pch"
AssemblerListingLocation=".\MaximalSpeed/"
ObjectFile=".\MaximalSpeed/"
ProgramDataBaseFileName=".\MaximalSpeed/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib ..\zlib\zlib.lib"
OutputFile="MaximalSpeed/amxmodx_mm.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
ModuleDefinitionFile=""
ProgramDatabaseFile=".\MaximalSpeede/amxx_mm.pdb"
ImportLibrary=".\jitrelease/amxx_mm.lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\release/amxmodx.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\amx.cpp">
</File>
<File
RelativePath="..\amxcore.cpp">
</File>
<File
RelativePath="..\amxmodx.cpp">
</File>
<File
RelativePath="..\amxtime.cpp">
</File>
<File
RelativePath="..\amxxfile.cpp">
</File>
<File
RelativePath="..\amxxlog.cpp">
</File>
<File
RelativePath="..\CCmd.cpp">
</File>
<File
RelativePath="..\CEvent.cpp">
</File>
<File
RelativePath="..\CFile.cpp">
</File>
<File
RelativePath="..\CForward.cpp">
</File>
<File
RelativePath="..\CLang.cpp">
</File>
<File
RelativePath="..\CLogEvent.cpp">
</File>
<File
RelativePath="..\CMenu.cpp">
</File>
<File
RelativePath="..\CMisc.cpp">
</File>
<File
RelativePath="..\CModule.cpp">
</File>
<File
RelativePath="..\CPlugin.cpp">
</File>
<File
RelativePath="..\CTask.cpp">
</File>
<File
RelativePath="..\CVault.cpp">
</File>
<File
RelativePath="..\emsg.cpp">
</File>
<File
RelativePath="..\fakemeta.cpp">
<FileConfiguration
Name="MemtestDebug|Win32">
<Tool
Name="VCCLCompilerTool"
GeneratePreprocessedFile="0"/>
</FileConfiguration>
</File>
<File
RelativePath="..\file.cpp">
</File>
<File
RelativePath="..\float.cpp">
</File>
<File
RelativePath="..\md5.cpp">
</File>
<File
RelativePath="..\meta_api.cpp">
</File>
<File
RelativePath="..\modules.cpp">
</File>
<File
RelativePath="..\power.cpp">
</File>
<File
RelativePath="..\srvcmd.cpp">
</File>
<File
RelativePath="..\string.cpp">
</File>
<File
RelativePath="..\strptime.cpp">
</File>
<File
RelativePath="..\util.cpp">
</File>
<File
RelativePath="..\vault.cpp">
</File>
<Filter
Name="mmgr"
Filter="">
<File
RelativePath="..\mmgr\mmgr.cpp">
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
<FileConfiguration
Name="JITDebug|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
<FileConfiguration
Name="JITRelease|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
<FileConfiguration
Name="MaximalSpeed|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="..\amx.h">
</File>
<File
RelativePath="..\amxmodx.h">
</File>
<File
RelativePath="..\amxxfile.h">
</File>
<File
RelativePath="..\amxxlog.h">
</File>
<File
RelativePath="..\CCmd.h">
</File>
<File
RelativePath="..\CEvent.h">
</File>
<File
RelativePath="..\CFile.h">
</File>
<File
RelativePath="..\CForward.h">
</File>
<File
RelativePath="..\CLang.h">
</File>
<File
RelativePath="..\CList.h">
</File>
<File
RelativePath="..\CLogEvent.h">
</File>
<File
RelativePath="..\CMenu.h">
</File>
<File
RelativePath="..\CMisc.h">
</File>
<File
RelativePath="..\CModule.h">
</File>
<File
RelativePath="..\CPlugin.h">
</File>
<File
RelativePath="..\CQueue.h">
</File>
<File
RelativePath="..\CRList.h">
</File>
<File
RelativePath="..\CString.h">
</File>
<File
RelativePath="..\CTask.h">
</File>
<File
RelativePath="..\CVault.h">
</File>
<File
RelativePath="..\CVector.h">
</File>
<File
RelativePath="..\fakemeta.h">
</File>
<File
RelativePath="..\md5.h">
</File>
<File
RelativePath="..\modules.h">
</File>
<File
RelativePath="..\resource.h">
</File>
<Filter
Name="mmgr"
Filter="">
<File
RelativePath="..\mmgr\mmgr.h">
</File>
<File
RelativePath="..\mmgr\nommgr.h">
</File>
</Filter>
</Filter>
<Filter
Name="Resource Files"
Filter="rc">
<File
RelativePath="..\version.rc">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -45,6 +45,16 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable;
enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions // GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table = static DLL_FUNCTIONS g_EntityAPI_Table =
{ {
@ -2114,6 +2124,7 @@ C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersi
return(FALSE); return(FALSE);
} }
memcpy(pFunctionTable, &g_EntityAPI_Table, sizeof(DLL_FUNCTIONS)); memcpy(pFunctionTable, &g_EntityAPI_Table, sizeof(DLL_FUNCTIONS));
g_pFunctionTable=pFunctionTable;
return(TRUE); return(TRUE);
} }
@ -2131,7 +2142,7 @@ C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interface
return(FALSE); return(FALSE);
} }
memcpy( pFunctionTable, &g_EntityAPI_Post_Table, sizeof( DLL_FUNCTIONS ) ); memcpy( pFunctionTable, &g_EntityAPI_Post_Table, sizeof( DLL_FUNCTIONS ) );
g_pFunctionTable_Post=pFunctionTable;
return(TRUE); return(TRUE);
} }
@ -2154,6 +2165,7 @@ C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *inte
return(FALSE); return(FALSE);
} }
memcpy(pengfuncsFromEngine, &g_EngineFuncs_Table, sizeof(enginefuncs_t)); memcpy(pengfuncsFromEngine, &g_EngineFuncs_Table, sizeof(enginefuncs_t));
g_pengfuncsTable=pengfuncsFromEngine;
return TRUE; return TRUE;
} }
@ -2171,6 +2183,7 @@ C_DLLEXPORT int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int
return(FALSE); return(FALSE);
} }
memcpy(pengfuncsFromEngine, &g_EngineFuncs_Post_Table, sizeof(enginefuncs_t)); memcpy(pengfuncsFromEngine, &g_EngineFuncs_Post_Table, sizeof(enginefuncs_t));
g_pengfuncsTable_Post=pengfuncsFromEngine;
return TRUE; return TRUE;
} }
@ -2195,6 +2208,7 @@ C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable,
return(FALSE); return(FALSE);
} }
memcpy(pNewFunctionTable, &g_NewFuncs_Table, sizeof(NEW_DLL_FUNCTIONS)); memcpy(pNewFunctionTable, &g_NewFuncs_Table, sizeof(NEW_DLL_FUNCTIONS));
g_pNewFunctionsTable=pNewFunctionTable;
return TRUE; return TRUE;
} }
@ -2212,6 +2226,7 @@ C_DLLEXPORT int GetNewDLLFunctions_Post( NEW_DLL_FUNCTIONS *pNewFunctionTable, i
return(FALSE); return(FALSE);
} }
memcpy(pNewFunctionTable, &g_NewFuncs_Post_Table, sizeof(NEW_DLL_FUNCTIONS)); memcpy(pNewFunctionTable, &g_NewFuncs_Post_Table, sizeof(NEW_DLL_FUNCTIONS));
g_pNewFunctionsTable_Post=pNewFunctionTable;
return TRUE; return TRUE;
} }
@ -2439,11 +2454,14 @@ PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString; PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory; PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
PFN_LOG g_fn_Log; PFN_LOG g_fn_Log;
PFN_LOG_ERROR g_fn_LogErrorFunc;
PFN_RAISE_AMXERROR g_fn_RaiseAmxError; PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
PFN_REGISTER_FORWARD g_fn_RegisterForward; PFN_REGISTER_FORWARD g_fn_RegisterForward;
PFN_EXECUTE_FORWARD g_fn_ExecuteForward; PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray; PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray;
PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray; PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray;
PFN_PREPARE_CELLARRAY_A g_fn_PrepareCellArrayA;
PFN_PREPARE_CHARARRAY_A g_fn_PrepareCharArrayA;
PFN_IS_PLAYER_VALID g_fn_IsPlayerValid; PFN_IS_PLAYER_VALID g_fn_IsPlayerValid;
PFN_GET_PLAYER_NAME g_fn_GetPlayerName; PFN_GET_PLAYER_NAME g_fn_GetPlayerName;
PFN_GET_PLAYER_IP g_fn_GetPlayerIP; PFN_GET_PLAYER_IP g_fn_GetPlayerIP;
@ -2453,6 +2471,7 @@ PFN_IS_PLAYER_AUTHORIZED g_fn_IsPlayerAuthorized;
PFN_GET_PLAYER_TIME g_fn_GetPlayerTime; PFN_GET_PLAYER_TIME g_fn_GetPlayerTime;
PFN_GET_PLAYER_PLAYTIME g_fn_GetPlayerPlayTime; PFN_GET_PLAYER_PLAYTIME g_fn_GetPlayerPlayTime;
PFN_GET_PLAYER_CURWEAPON g_fn_GetPlayerCurweapon; PFN_GET_PLAYER_CURWEAPON g_fn_GetPlayerCurweapon;
PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
PFN_GET_PLAYER_TEAMID g_fn_GetPlayerTeamID; PFN_GET_PLAYER_TEAMID g_fn_GetPlayerTeamID;
PFN_GET_PLAYER_DEATHS g_fn_GetPlayerDeaths; PFN_GET_PLAYER_DEATHS g_fn_GetPlayerDeaths;
PFN_GET_PLAYER_MENU g_fn_GetPlayerMenu; PFN_GET_PLAYER_MENU g_fn_GetPlayerMenu;
@ -2478,6 +2497,10 @@ PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
PFN_FORMAT g_fn_Format;
// *** Exports *** // *** Exports ***
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
@ -2521,7 +2544,9 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE); REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME); REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
REQFUNC("Log", g_fn_Log, PFN_LOG); REQFUNC("Log", g_fn_Log, PFN_LOG);
REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR);
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE); REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
// Amx scripts // Amx scripts
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT); REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
@ -2529,6 +2554,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME); REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT); REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT); REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
REQFUNC("GetAmxScriptName", g_fn_GetAmxScriptName, PFN_GET_AMXSCRIPTNAME);
// String / mem in amx scripts support // String / mem in amx scripts support
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING); REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
@ -2542,6 +2568,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV); REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC); REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT); REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
REQFUNC("amx_FindNative", g_fn_AmxFindNative, PFN_AMX_FINDNATIVE);
// Natives / Forwards // Natives / Forwards
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES); REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
@ -2553,7 +2580,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("ExecuteForward", g_fn_ExecuteForward, PFN_EXECUTE_FORWARD); REQFUNC("ExecuteForward", g_fn_ExecuteForward, PFN_EXECUTE_FORWARD);
REQFUNC("PrepareCellArray", g_fn_PrepareCellArray, PFN_PREPARE_CELLARRAY); REQFUNC("PrepareCellArray", g_fn_PrepareCellArray, PFN_PREPARE_CELLARRAY);
REQFUNC("PrepareCharArray", g_fn_PrepareCharArray, PFN_PREPARE_CHARARRAY); REQFUNC("PrepareCharArray", g_fn_PrepareCharArray, PFN_PREPARE_CHARARRAY);
REQFUNC("PrepareCellArrayA", g_fn_PrepareCellArrayA, PFN_PREPARE_CELLARRAY_A);
REQFUNC("PrepareCharArrayA", g_fn_PrepareCharArrayA, PFN_PREPARE_CHARARRAY_A);
// Player // Player
REQFUNC("IsPlayerValid", g_fn_IsPlayerValid, PFN_IS_PLAYER_VALID); REQFUNC("IsPlayerValid", g_fn_IsPlayerValid, PFN_IS_PLAYER_VALID);
REQFUNC("GetPlayerName", g_fn_GetPlayerName, PFN_GET_PLAYER_NAME); REQFUNC("GetPlayerName", g_fn_GetPlayerName, PFN_GET_PLAYER_NAME);
@ -2565,6 +2593,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerPlayTime", g_fn_GetPlayerPlayTime, PFN_GET_PLAYER_PLAYTIME); REQFUNC("GetPlayerPlayTime", g_fn_GetPlayerPlayTime, PFN_GET_PLAYER_PLAYTIME);
REQFUNC("GetPlayerCurweapon", g_fn_GetPlayerCurweapon, PFN_GET_PLAYER_CURWEAPON); REQFUNC("GetPlayerCurweapon", g_fn_GetPlayerCurweapon, PFN_GET_PLAYER_CURWEAPON);
REQFUNC("GetPlayerTeamID", g_fn_GetPlayerTeamID, PFN_GET_PLAYER_TEAMID); REQFUNC("GetPlayerTeamID", g_fn_GetPlayerTeamID, PFN_GET_PLAYER_TEAMID);
REQFUNC("GetPlayerTeam",g_fn_GetPlayerTeam, PFN_GET_PLAYER_TEAM);
REQFUNC("GetPlayerDeaths", g_fn_GetPlayerDeaths, PFN_GET_PLAYER_DEATHS); REQFUNC("GetPlayerDeaths", g_fn_GetPlayerDeaths, PFN_GET_PLAYER_DEATHS);
REQFUNC("GetPlayerMenu", g_fn_GetPlayerMenu, PFN_GET_PLAYER_MENU); REQFUNC("GetPlayerMenu", g_fn_GetPlayerMenu, PFN_GET_PLAYER_MENU);
REQFUNC("GetPlayerKeys", g_fn_GetPlayerKeys, PFN_GET_PLAYER_KEYS); REQFUNC("GetPlayerKeys", g_fn_GetPlayerKeys, PFN_GET_PLAYER_KEYS);
@ -2574,6 +2603,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV); REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR); REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
// Memory // Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
@ -2617,7 +2648,19 @@ void MF_Log(const char *fmt, ...)
vsprintf(msg, fmt, arglst); vsprintf(msg, fmt, arglst);
va_end(arglst); va_end(arglst);
g_fn_Log("[%s] %s", MODULE_NAME, msg); g_fn_Log("[%s] %s", MODULE_LOGTAG, msg);
}
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
{
// :TODO: Overflow possible here
char msg[3072];
va_list arglst;
va_start(arglst, fmt);
vsprintf(msg, fmt, arglst);
va_end(arglst);
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_LOGTAG, msg);
} }
@ -2640,11 +2683,14 @@ void ValidateMacros_DontCallThis_Smiley()
MF_GetAmxStringLen(NULL); MF_GetAmxStringLen(NULL);
MF_CopyAmxMemory(NULL, NULL, 0); MF_CopyAmxMemory(NULL, NULL, 0);
MF_Log("str", "str", 0); MF_Log("str", "str", 0);
MF_LogError(NULL, 0, NULL);
MF_RaiseAmxError(NULL, 0); MF_RaiseAmxError(NULL, 0);
MF_RegisterForward("str", (ForwardExecType)0, 0, 0, 0); MF_RegisterForward("str", (ForwardExecType)0, 0, 0, 0);
MF_ExecuteForward(0, 0, 0); MF_ExecuteForward(0, 0, 0);
MF_PrepareCellArray(NULL, 0); MF_PrepareCellArray(NULL, 0);
MF_PrepareCharArray(NULL, 0); MF_PrepareCharArray(NULL, 0);
MF_PrepareCellArrayA(NULL, 0, true);
MF_PrepareCharArrayA(NULL, 0, true);
MF_IsPlayerValid(0); MF_IsPlayerValid(0);
MF_GetPlayerName(0); MF_GetPlayerName(0);
MF_GetPlayerIP(0); MF_GetPlayerIP(0);
@ -2655,6 +2701,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_GetPlayerPlayTime(0); MF_GetPlayerPlayTime(0);
MF_GetPlayerCurweapon(0); MF_GetPlayerCurweapon(0);
MF_GetPlayerTeamID(0); MF_GetPlayerTeamID(0);
MF_GetPlayerTeam(0);
MF_GetPlayerDeaths(0); MF_GetPlayerDeaths(0);
MF_GetPlayerMenu(0); MF_GetPlayerMenu(0);
MF_GetPlayerKeys(0); MF_GetPlayerKeys(0);
@ -2668,11 +2715,14 @@ void ValidateMacros_DontCallThis_Smiley()
MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0);
MF_AmxFindPublic(0, 0, 0); MF_AmxFindPublic(0, 0, 0);
MF_AmxAllot(0, 0, 0, 0); MF_AmxAllot(0, 0, 0, 0);
MF_LoadAmxScript(0, 0, 0, 0); MF_LoadAmxScript(0, 0, 0, 0, 0);
MF_UnloadAmxScript(0, 0); MF_UnloadAmxScript(0, 0);
MF_RegisterSPForward(0, 0, 0, 0, 0, 0); MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0); MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
MF_UnregisterSPForward(0); MF_UnregisterSPForward(0);
MF_GetPlayerFrags(0);
MF_GetPlayerEdict(0);
MF_Format("", 4, "str");
} }
#endif #endif
@ -2789,7 +2839,7 @@ void *operator new(size_t reportedSize)
return ptr; return ptr;
// allocation failed // allocation failed
throw std::bad_alloc(); return NULL;
} }
void *operator new[](size_t reportedSize) void *operator new[](size_t reportedSize)
@ -2802,7 +2852,7 @@ void *operator new[](size_t reportedSize)
return ptr; return ptr;
// allocation failed // allocation failed
throw std::bad_alloc(); return NULL;
} }
// Microsoft memory tracking operators // Microsoft memory tracking operators
@ -2816,7 +2866,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine)
return ptr; return ptr;
// allocation failed // allocation failed
throw std::bad_alloc(); return NULL;
} }
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine) void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
{ {
@ -2828,7 +2878,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine
return ptr; return ptr;
// allocation failed // allocation failed
throw std::bad_alloc(); return NULL;
} }
void operator delete(void *reportedAddress) void operator delete(void *reportedAddress)

View File

@ -55,7 +55,7 @@ struct amxx_module_info_s
// The next section is copied from the amx.h file // The next section is copied from the amx.h file
// Copyright (c) ITB CompuPhase, 1997-2004 // Copyright (c) ITB CompuPhase, 1997-2004
#if defined __LCC__ || defined __DMC__ || defined __linux__ #if defined __LCC__ || defined __DMC__ || defined __linux__ || defined __GNUC__
#include <stdint.h> #include <stdint.h>
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L #elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
/* The ISO C99 defines the int16_t and int_32t types. If the compiler got /* The ISO C99 defines the int16_t and int_32t types. If the compiler got
@ -204,11 +204,9 @@ typedef struct tagAMX {
cell reset_stk PACKED; cell reset_stk PACKED;
cell reset_hea PACKED; cell reset_hea PACKED;
cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */ cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */
#if defined JIT
/* support variables for the JIT */ /* support variables for the JIT */
int reloc_size PACKED; /* required temporary buffer for relocations */ int reloc_size PACKED; /* required temporary buffer for relocations */
long code_size PACKED; /* estimated memory footprint of the native code */ long code_size PACKED; /* estimated memory footprint of the native code */
#endif
} AMX; } AMX;
enum { enum {
@ -240,6 +238,14 @@ enum {
AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */ AMX_ERR_DOMAIN, /* domain error, expression result does not fit in range */
}; };
#if !defined AMX_NO_ALIGN
#if defined __linux__
#pragma pack() /* reset default packing */
#else
#pragma pack(pop) /* reset previous packing */
#endif
#endif
// ***** declare functions ***** // ***** declare functions *****
@ -923,7 +929,7 @@ void FN_EngineFprintf(FILE *pfile, char *szFmt, ...);
#endif // FN_EngineFprintf #endif // FN_EngineFprintf
#ifdef FN_PvAllocEntPrivateData #ifdef FN_PvAllocEntPrivateData
void *FN_PvAllocEntPrivateData(edict_t *pEdict, long cb); void *FN_PvAllocEntPrivateData(edict_t *pEdict, int32 cb);
#endif // FN_PvAllocEntPrivateData #endif // FN_PvAllocEntPrivateData
#ifdef FN_PvEntPrivateData #ifdef FN_PvEntPrivateData
@ -1913,11 +1919,14 @@ typedef int (*PFN_GET_AMXSTRINGLEN) (const cell *ptr);
typedef char * (*PFN_FORMAT_AMXSTRING) (AMX * /*amx*/, cell * /*params*/, int /*startParam*/, int * /*pLen*/); typedef char * (*PFN_FORMAT_AMXSTRING) (AMX * /*amx*/, cell * /*params*/, int /*startParam*/, int * /*pLen*/);
typedef void (*PFN_COPY_AMXMEMORY) (cell * /*dest*/, const cell * /*src*/, int /*len*/); typedef void (*PFN_COPY_AMXMEMORY) (cell * /*dest*/, const cell * /*src*/, int /*len*/);
typedef void (*PFN_LOG) (const char * /*fmt*/, ...); typedef void (*PFN_LOG) (const char * /*fmt*/, ...);
typedef void (*PFN_LOG_ERROR) (AMX * /*amx*/, int /*err*/, const char * /*fmt*/, ...);
typedef int (*PFN_RAISE_AMXERROR) (AMX * /*amx*/, int /*error*/); typedef int (*PFN_RAISE_AMXERROR) (AMX * /*amx*/, int /*error*/);
typedef int (*PFN_REGISTER_FORWARD) (const char * /*funcname*/, ForwardExecType /*exectype*/, ... /*paramtypes terminated by PF_DONE*/); typedef int (*PFN_REGISTER_FORWARD) (const char * /*funcname*/, ForwardExecType /*exectype*/, ... /*paramtypes terminated by PF_DONE*/);
typedef int (*PFN_EXECUTE_FORWARD) (int /*id*/, ... /*params*/); typedef int (*PFN_EXECUTE_FORWARD) (int /*id*/, ... /*params*/);
typedef cell (*PFN_PREPARE_CELLARRAY) (cell * /*ptr*/, unsigned int /*size*/); typedef cell (*PFN_PREPARE_CELLARRAY) (cell * /*ptr*/, unsigned int /*size*/);
typedef cell (*PFN_PREPARE_CHARARRAY) (char * /*ptr*/, unsigned int /*size*/); typedef cell (*PFN_PREPARE_CHARARRAY) (char * /*ptr*/, unsigned int /*size*/);
typedef cell (*PFN_PREPARE_CELLARRAY_A) (cell * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/);
typedef cell (*PFN_PREPARE_CHARARRAY_A) (char * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/);
typedef int (*PFN_IS_PLAYER_VALID) (int /*id*/); typedef int (*PFN_IS_PLAYER_VALID) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_NAME) (int /*id*/); typedef const char * (*PFN_GET_PLAYER_NAME) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_IP) (int /*id*/); typedef const char * (*PFN_GET_PLAYER_IP) (int /*id*/);
@ -1926,7 +1935,9 @@ typedef int (*PFN_IS_PLAYER_BOT) (int /*id*/);
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/); typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/); typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/); typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/); typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
typedef const char * (*PFN_GET_PLAYER_TEAM) (int /*id*/);
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/); typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/); typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
typedef int (*PFN_GET_PLAYER_MENU) (int /*id*/); typedef int (*PFN_GET_PLAYER_MENU) (int /*id*/);
@ -1937,6 +1948,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/);
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/); typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/); typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/); typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
#ifdef USE_METAMOD
typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#else
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/); const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
@ -1947,7 +1964,8 @@ typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*in
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/); typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/); typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */);
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/); typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/); typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/); typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/);
@ -1955,6 +1973,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/); typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/); typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_ADD_NATIVES g_fn_AddNatives;
extern PFN_BUILD_PATHNAME g_fn_BuildPathname; extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
@ -1971,11 +1990,14 @@ extern PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString; extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory; extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
extern PFN_LOG g_fn_Log; extern PFN_LOG g_fn_Log;
extern PFN_LOG_ERROR g_fn_LogErrorFunc;
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError; extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
extern PFN_REGISTER_FORWARD g_fn_RegisterForward; extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward; extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
extern PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray; extern PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray;
extern PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray; extern PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray;
extern PFN_PREPARE_CELLARRAY_A g_fn_PrepareCellArrayA;
extern PFN_PREPARE_CHARARRAY_A g_fn_PrepareCharArrayA;
extern PFN_IS_PLAYER_VALID g_fn_IsPlayerValid; extern PFN_IS_PLAYER_VALID g_fn_IsPlayerValid;
extern PFN_GET_PLAYER_NAME g_fn_GetPlayerName; extern PFN_GET_PLAYER_NAME g_fn_GetPlayerName;
extern PFN_GET_PLAYER_IP g_fn_GetPlayerIP; extern PFN_GET_PLAYER_IP g_fn_GetPlayerIP;
@ -2007,6 +2029,11 @@ extern PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName; extern PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward; extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File; extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
extern PFN_FORMAT g_fn_Format;
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
#ifdef MAY_NEVER_BE_DEFINED #ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems // Function prototypes for intellisense and similar systems
@ -2026,11 +2053,14 @@ int MF_GetAmxStringLen (const cell *ptr) { }
char * MF_FormatAmxString (AMX * amx, cell * params, int startParam, int * pLen) { } char * MF_FormatAmxString (AMX * amx, cell * params, int startParam, int * pLen) { }
void MF_CopyAmxMemory (cell * dest, const cell * src, int len) { } void MF_CopyAmxMemory (cell * dest, const cell * src, int len) { }
void MF_Log (const char * fmt, ...) { } void MF_Log (const char * fmt, ...) { }
void MF_LogError (AMX * amx, int err, const char *fmt, ...) { }
int MF_RaiseAmxError (AMX * amx, int error) { } int MF_RaiseAmxError (AMX * amx, int error) { }
int MF_RegisterForward (const char * funcname, ForwardExecType exectype, ...) { } int MF_RegisterForward (const char * funcname, ForwardExecType exectype, ...) { }
int MF_ExecuteForward (int id, ...) { } int MF_ExecuteForward (int id, ...) { }
cell MF_PrepareCellArray (cell * ptr, unsigned int size) { } cell MF_PrepareCellArray (cell * ptr, unsigned int size) { }
cell MF_PrepareCharArray (char * ptr, unsigned int size) { } cell MF_PrepareCharArray (char * ptr, unsigned int size) { }
cell MF_PrepareCellArrayA (cell * ptr, unsigned int size, bool copyBack) { }
cell MF_PrepareCharArrayA (char * ptr, unsigned int size, bool copyBack) { }
int MF_IsPlayerValid (int id) { } int MF_IsPlayerValid (int id) { }
const char * MF_GetPlayerName (int id) { } const char * MF_GetPlayerName (int id) { }
const char * MF_GetPlayerIP (int id) { } const char * MF_GetPlayerIP (int id) { }
@ -2040,6 +2070,7 @@ int MF_IsPlayerAuthorized (int id) { }
float MF_GetPlayerTime (int id) { } float MF_GetPlayerTime (int id) { }
float MF_GetPlayerPlayTime (int id) { } float MF_GetPlayerPlayTime (int id) { }
int MF_GetPlayerCurweapon (int id) { } int MF_GetPlayerCurweapon (int id) { }
const char * MF_GetPlayerTeam (int id) { }
int MF_GetPlayerTeamID (int id) { } int MF_GetPlayerTeamID (int id) { }
int MF_GetPlayerDeaths (int id) { } int MF_GetPlayerDeaths (int id) { }
int MF_GetPlayerMenu (int id) { } int MF_GetPlayerMenu (int id) { }
@ -2055,6 +2086,9 @@ cell amx_ftoc (float x) { }
int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { } int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
int MF_RegisterSPForward (AMX * amx, int func, ...) { } int MF_RegisterSPForward (AMX * amx, int func, ...) { }
void MF_UnregisterSPForward (int id) { } void MF_UnregisterSPForward (int id) { }
int MF_GetPlayerFlags (int id) { }
edict_t* MF_GetPlayerEdict (int id) { }
const char * MF_Format (const char *fmt, ...) { }
#endif // MAY_NEVER_BE_DEFINED #endif // MAY_NEVER_BE_DEFINED
#define MF_AddNatives g_fn_AddNatives #define MF_AddNatives g_fn_AddNatives
@ -2072,11 +2106,14 @@ void MF_UnregisterSPForward (int id) { }
#define MF_GetAmxStringLen g_fn_GetAmxStringLen #define MF_GetAmxStringLen g_fn_GetAmxStringLen
#define MF_CopyAmxMemory g_fn_CopyAmxMemory #define MF_CopyAmxMemory g_fn_CopyAmxMemory
void MF_Log(const char *fmt, ...); void MF_Log(const char *fmt, ...);
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_RaiseAmxError g_fn_RaiseAmxError #define MF_RaiseAmxError g_fn_RaiseAmxError
#define MF_RegisterForward g_fn_RegisterForward #define MF_RegisterForward g_fn_RegisterForward
#define MF_ExecuteForward g_fn_ExecuteForward #define MF_ExecuteForward g_fn_ExecuteForward
#define MF_PrepareCellArray g_fn_PrepareCellArray #define MF_PrepareCellArray g_fn_PrepareCellArray
#define MF_PrepareCharArray g_fn_PrepareCharArray #define MF_PrepareCharArray g_fn_PrepareCharArray
#define MF_PrepareCellArrayA g_fn_PrepareCellArrayA
#define MF_PrepareCharArrayA g_fn_PrepareCharArrayA
#define MF_IsPlayerValid g_fn_IsPlayerValid #define MF_IsPlayerValid g_fn_IsPlayerValid
#define MF_GetPlayerName g_fn_GetPlayerName #define MF_GetPlayerName g_fn_GetPlayerName
#define MF_GetPlayerIP g_fn_GetPlayerIP #define MF_GetPlayerIP g_fn_GetPlayerIP
@ -2086,6 +2123,7 @@ void MF_Log(const char *fmt, ...);
#define MF_GetPlayerTime g_fn_GetPlayerTime #define MF_GetPlayerTime g_fn_GetPlayerTime
#define MF_GetPlayerPlayTime g_fn_GetPlayerPlayTime #define MF_GetPlayerPlayTime g_fn_GetPlayerPlayTime
#define MF_GetPlayerCurweapon g_fn_GetPlayerCurweapon #define MF_GetPlayerCurweapon g_fn_GetPlayerCurweapon
#define MF_GetPlayerTeam g_fn_GetPlayerTeam
#define MF_GetPlayerTeamID g_fn_GetPlayerTeamID #define MF_GetPlayerTeamID g_fn_GetPlayerTeamID
#define MF_GetPlayerDeaths g_fn_GetPlayerDeaths #define MF_GetPlayerDeaths g_fn_GetPlayerDeaths
#define MF_GetPlayerMenu g_fn_GetPlayerMenu #define MF_GetPlayerMenu g_fn_GetPlayerMenu
@ -2100,13 +2138,18 @@ void MF_Log(const char *fmt, ...);
#define MF_AmxExecv g_fn_AmxExecv #define MF_AmxExecv g_fn_AmxExecv
#define MF_AmxFindPublic g_fn_AmxFindPublic #define MF_AmxFindPublic g_fn_AmxFindPublic
#define MF_AmxAllot g_fn_AmxAllot #define MF_AmxAllot g_fn_AmxAllot
#define MF_AmxFindNative g_fn_AmxFindNative
#define MF_LoadAmxScript g_fn_LoadAmxScript #define MF_LoadAmxScript g_fn_LoadAmxScript
#define MF_UnloadAmxScript g_fn_UnloadAmxScript #define MF_UnloadAmxScript g_fn_UnloadAmxScript
#define MF_MergeDefinitionFile g_fn_MergeDefinition_File
#define amx_ctof g_fn_CellToReal #define amx_ctof g_fn_CellToReal
#define amx_ftoc g_fn_RealToCell #define amx_ftoc g_fn_RealToCell
#define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName #define MF_RegisterSPForwardByName g_fn_RegisterSPForwardByName
#define MF_RegisterSPForward g_fn_RegisterSPForward #define MF_RegisterSPForward g_fn_RegisterSPForward
#define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_UnregisterSPForward g_fn_UnregisterSPForward
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
#define MF_GetPlayerEdict g_fn_GetPlayerEdict
#define MF_Format g_fn_Format
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);

View File

@ -62,6 +62,18 @@ void amx_command(){
++a; ++a;
} }
a = g_plugins.begin();
while (a)
{
if ( (*a).getStatusCode() == ps_bad_load )
{
//error
print_srvconsole("Load fails: %s\n", (*a).getError());
}
++a;
}
print_srvconsole( "%d plugins, %d running\n",plugins,running ); print_srvconsole( "%d plugins, %d running\n",plugins,running );
} }
@ -136,9 +148,17 @@ void amx_command(){
{ {
print_srvconsole( "%s %s\n", Plugin_info.name, Plugin_info.version); print_srvconsole( "%s %s\n", Plugin_info.name, Plugin_info.version);
print_srvconsole( "author: %s (%s)\n", Plugin_info.author, Plugin_info.url); print_srvconsole( "Authors: %s (%s)\n", "Felix \"SniperBeamer\" Geyer, David \"BAILOPAN\" Anderson, Pavol \"PM OnoTo\" Marko, Jonny \"Got His Gun\" Bergstrom, and Lukasz \"SidLuke\" Wlasinski.", Plugin_info.url);
print_srvconsole( "compiled: %s\n", __DATE__ ", " __TIME__); print_srvconsole( "Compiled: %s\n", __DATE__ ", " __TIME__);
#ifdef JIT
print_srvconsole( "Core mode: JIT\n");
#else
#ifdef ASM32
print_srvconsole( "Core mode: ASM\n");
#else
print_srvconsole( "Core mode: Normal\n");
#endif
#endif
} }
else if (!strcmp(cmd,"modules")) else if (!strcmp(cmd,"modules"))
{ {
@ -149,7 +169,7 @@ void amx_command(){
int running = 0; int running = 0;
int modules = 0; int modules = 0;
CList<CModule>::iterator a = g_modules.begin(); CList<CModule,const char *>::iterator a = g_modules.begin();
while ( a ) while ( a )
{ {
@ -165,8 +185,7 @@ void amx_command(){
} }
print_srvconsole( "%d modules, %d correct\n",modules,running); print_srvconsole( "%d modules, %d correct\n",modules,running);
} } else if (!strcmp(cmd, "gpl"))
else if (!strcmp(cmd, "gpl"))
{ {
print_srvconsole("AMX Mod X\n"); print_srvconsole("AMX Mod X\n");
print_srvconsole("\n"); print_srvconsole("\n");
@ -264,10 +283,9 @@ void plugin_srvcmd()
if ((err = amx_Exec( (*a).getPlugin()->getAMX(), &ret , (*a).getFunction() if ((err = amx_Exec( (*a).getPlugin()->getAMX(), &ret , (*a).getFunction()
, 3 , g_srvindex , (*a).getFlags() , (*a).getId() )) != AMX_ERR_NONE) , 3 , g_srvindex , (*a).getFlags() , (*a).getId() )) != AMX_ERR_NONE)
{
AMXXLOG_Log("[AMXX] Run time error %d on line %ld (plugin \"%s\")", LogError((*a).getPlugin()->getAMX(), err, "");
err,(*a).getPlugin()->getAMX()->curline,(*a).getPlugin()->getName()); }
if ( ret ) break; if ( ret ) break;
} }

View File

@ -448,6 +448,60 @@ char* format_arguments(AMX *amx, int parm,int& len)
return *buffer; return *buffer;
} }
//added by BAILOPAN for jtp10181
//takes a string and breaks it into a 1st param and rest params
//different from strbreak because it's more crafted for control
static cell AMX_NATIVE_CALL amx_strtok(AMX *amx, cell *params)
{
int left_pos = 0;
int right_pos = 0;
unsigned int i = 0;
bool done_flag = false;
int len = 0;
//string[]
char *string = get_amxstring(amx, params[1], 0, len);
//left[]
char *left = new char[len+1];
//right[]
char *right = new char[len+1];
int leftMax = params[3];
int rightMax = params[5];
//token
char token = params[6];
//trim
int trim = params[7];
for (i=0; i<len; i++)
{
if (trim && !done_flag)
{
if (isspace(string[i]))
{
while (isspace(string[++i]));
done_flag = true;
}
}
if (!done_flag && string[i] == token)
{
done_flag = true;
i++;
}
if (done_flag)
{
right[right_pos++] = string[i];
} else {
left[left_pos++] = string[i];
}
}
right[right_pos] = 0;
left[left_pos] = 0;
set_amxstring(amx, params[2], left, leftMax);
set_amxstring(amx, params[4], right, rightMax);
delete [] left;
delete [] right;
return 1;
}
//added by BAILOPAN //added by BAILOPAN
//Takes a string and breaks it into a 1st param and rest params //Takes a string and breaks it into a 1st param and rest params
//strbreak(String[], First[], FirstLen, Rest[], RestLen) //strbreak(String[], First[], FirstLen, Rest[], RestLen)
@ -467,13 +521,13 @@ static cell AMX_NATIVE_CALL strbreak(AMX *amx, cell *params) /* 5 param */
int LeftMax = params[3]; int LeftMax = params[3];
int RightMax = params[5]; int RightMax = params[5];
for (i=0; i<strlen(string); i++) { for (i=0; i<l; i++) {
if (string[i] == '"' && !quote_flag) { if (string[i] == '"' && !quote_flag) {
quote_flag = true; quote_flag = true;
} else if (string[i] == '"' && quote_flag) { } else if (string[i] == '"' && quote_flag) {
quote_flag = false; quote_flag = false;
} }
if ((string[i] == ' ') && !quote_flag && !done_flag) { if (isspace(string[i]) && !quote_flag && !done_flag) {
done_flag = true; done_flag = true;
i++; i++;
} }
@ -611,5 +665,6 @@ AMX_NATIVE_INFO string_Natives[] = {
{ "str_to_num", strtonum }, { "str_to_num", strtonum },
{ "trim", amx_trim }, { "trim", amx_trim },
{ "ucfirst", amx_ucfirst }, { "ucfirst", amx_ucfirst },
{ "strtok", amx_strtok },
{ NULL, NULL } { NULL, NULL }
}; };

View File

@ -79,12 +79,15 @@ void UTIL_ShowMenu( edict_t* pEdict, int slots, int time, char *menu, int mlen )
/* warning - don't pass here const string */ /* warning - don't pass here const string */
void UTIL_ShowMOTD( edict_t *client , char *motd, int mlen, const char *name) void UTIL_ShowMOTD( edict_t *client , char *motd, int mlen, const char *name)
{ {
if (!gmsgServerName) if (!gmsgMOTD)
return; // :TODO: Maybe output a warning log? return; // :TODO: Maybe output a warning log?
if (gmsgServerName)
{
MESSAGE_BEGIN( MSG_ONE , gmsgServerName, NULL, client ); MESSAGE_BEGIN( MSG_ONE , gmsgServerName, NULL, client );
WRITE_STRING(name); WRITE_STRING(name);
MESSAGE_END(); MESSAGE_END();
}
char *n = motd; char *n = motd;
char c = 0; char c = 0;
@ -104,9 +107,12 @@ void UTIL_ShowMOTD( edict_t *client , char *motd, int mlen, const char *name)
motd = n; motd = n;
} }
if (gmsgServerName)
{
MESSAGE_BEGIN( MSG_ONE , gmsgServerName, NULL, client ); MESSAGE_BEGIN( MSG_ONE , gmsgServerName, NULL, client );
WRITE_STRING( hostname->string ); WRITE_STRING( hostname->string );
MESSAGE_END(); MESSAGE_END();
}
} }
void UTIL_IntToString(int value, char *output) void UTIL_IntToString(int value, char *output)

View File

@ -1,8 +1,34 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h" #include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,2,0,0 FILEVERSION 1,0,1,0
PRODUCTVERSION 0,2,0,0 PRODUCTVERSION 1,0,1,0
FILEFLAGSMASK 0x17L FILEFLAGSMASK 0x17L
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -17,14 +43,14 @@ BEGIN
BEGIN BEGIN
BLOCK "000004b0" BLOCK "000004b0"
BEGIN BEGIN
VALUE "Comments", "AMX Mod X\0" VALUE "Comments", "AMX Mod X"
VALUE "FileDescription", "AMX Mod X\0" VALUE "FileDescription", "AMX Mod X"
VALUE "FileVersion", "0.20\0" VALUE "FileVersion", "1.01"
VALUE "InternalName", "amxmodx\0" VALUE "InternalName", "amxmodx"
VALUE "LegalCopyright", "Copyright (c) 2004, AMX Mod X Dev Team\0" VALUE "LegalCopyright", "Copyright (c) 2004-2005, AMX Mod X Dev Team"
VALUE "OriginalFilename", "amxx_mm.dll\0" VALUE "OriginalFilename", "amxmodx_mm.dll"
VALUE "ProductName", "AMX Mod X\0" VALUE "ProductName", "AMX Mod X"
VALUE "ProductVersion", "0.20\0" VALUE "ProductVersion", "1.01"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
@ -32,3 +58,45 @@ BEGIN
VALUE "Translation", 0x0, 1200 VALUE "Translation", 0x0, 1200
END END
END END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

BIN
amxmodx/zlib/libz.a Executable file

Binary file not shown.

BIN
amxmodx/zlib/libz64.a Executable file

Binary file not shown.

323
amxmodx/zlib/zconf.h Executable file
View File

@ -0,0 +1,323 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2003 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
*/
#ifdef Z_PREFIX
# define deflateInit_ z_deflateInit_
# define deflate z_deflate
# define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflatePrime z_deflatePrime
# define deflateParams z_deflateParams
# define deflateBound z_deflateBound
# define inflateInit2_ z_inflateInit2_
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateCopy z_inflateCopy
# define inflateReset z_inflateReset
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# define uncompress z_uncompress
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
# define WIN32
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# define z_off_t off_t
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if defined(__OS400__)
#define NO_vsnprintf
#endif
#if defined(__MVS__)
# define NO_vsnprintf
# ifdef FAR
# undef FAR
# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
# pragma map(deflateInit_,"DEIN")
# pragma map(deflateInit2_,"DEIN2")
# pragma map(deflateEnd,"DEEND")
# pragma map(deflateBound,"DEBND")
# pragma map(inflateInit_,"ININ")
# pragma map(inflateInit2_,"ININ2")
# pragma map(inflateEnd,"INEND")
# pragma map(inflateSync,"INSY")
# pragma map(inflateSetDictionary,"INSEDI")
# pragma map(compressBound,"CMBND")
# pragma map(inflate_table,"INTABL")
# pragma map(inflate_fast,"INFA")
# pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

1200
amxmodx/zlib/zlib.h Executable file

File diff suppressed because it is too large Load Diff

BIN
amxmodx/zlib/zlib.lib Executable file

Binary file not shown.

176
compiler/scasm/Makefile.pl Executable file
View File

@ -0,0 +1,176 @@
#!/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 project src dir
#options =
# debug - enable gdb debugging
# amd64 - compile for AMD64
# proc=ix86 - assumed not amd64
# clean - clean the specifications above
$PROJECT = "sasm";
$gccf = "gcc";
@CPP_SOURCE_FILES = ("amx_compiler.cpp", "amx_data.cpp", "amx_define.cpp", "amx_error.cpp", "amx_label.cpp", "amx_macro.cpp", "amx_natives.cpp", "amx_proc.cpp", "amx_parser.cpp", "amx_symbol.cpp", "amxasm.cpp", "cexpr.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\"";
$OPTIONS{"include"} = "";
while ($cmd = shift)
{
if ($cmd =~ /amd64/) {
$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;
}
}
$gcc = `$gccf --version`;
if ($gcc =~ /2\.9/)
{
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
} else {
$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 -DHAVE_I64 -DSMALL_CELL_SIZE=64 $cflags";
}
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";
}
}
unlink("$outdir/$bin");
if ($OPTIONS{"clean"})
{
`rm $outdir/*.o`;
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 (!(-d $outdir))
{
mkdir($outdir);
}
$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)
{
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 = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
if (-e $ofile)
{
$file_time = (stat($file))[9];
$ofile_time = (stat($file))[9];
if ($file_time > $ofile_time)
{
print "$gcc\n";
`$gcc`;
}
} else {
print "$gcc\n";
`$gcc`;
}
}
$gcc = "$gccf $cflags -shared -lstdc++ -ldl -lm @LINK -o $outdir/$bin";
print "$gcc\n";
`$gcc`;

View File

@ -70,3 +70,10 @@ amx_extendmap_step 15
//If you set this to 0, clients cannot chose their language //If you set this to 0, clients cannot chose their language
amx_client_languages 1 amx_client_languages 1
// Plugin Debug mode
// 0 - No debugging (garbage line numbers)
// 1 - Plugins with "debug" option in plugins.ini are put into debug mode
// 2 - All plugins are put in debug mode
// Note - debug mode will affect JIT performance
amx_debug 1

View File

@ -1,5 +1,5 @@
; Menu configuration file ; Menu configuration file
; File location: $moddir/addons/amxx/configs/clcmds.ini ; Default File location: $moddir/addons/amxmodx/configs/clcmds.ini
; To use with Players Menu plugin ; To use with Players Menu plugin
; NOTE: By default in all settings the access level is set to "u". ; NOTE: By default in all settings the access level is set to "u".
@ -14,4 +14,4 @@
"Kick player" "amx_kick #%userid%" "b" "u" "Kick player" "amx_kick #%userid%" "b" "u"
"Slay player" "amx_slay #%userid%" "bd" "u" "Slay player" "amx_slay #%userid%" "bd" "u"
"Slap with 1 dmg." "amx_slap #%userid% 1" "bd" "u" "Slap with 1 dmg." "amx_slap #%userid% 1" "bd" "u"
"Ban for 5 minutes" "amx_ban #%userid% id 5" "b" "u" "Ban for 5 minutes" "amx_ban #%userid% 5" "b" "u"

View File

@ -1,5 +1,5 @@
; Menu configuration file ; Menu configuration file
; File location: $moddir/addons/amxx/configs/cmds.ini ; File location: $moddir/addons/amxmodx/configs/cmds.ini
; To use with Commands Menu plugin ; To use with Commands Menu plugin
; NOTE: By default in all settings the access level is set to "u". ; NOTE: By default in all settings the access level is set to "u".

View File

@ -1,5 +1,5 @@
; Menu configuration file ; Menu configuration file
; File location: $moddir/addons/amxx/configs/configs.ini ; File location: $moddir/addons/amxmodx/configs/configs.ini
; To use with Commands Menu plugin ; To use with Commands Menu plugin
; NOTE: By default in all settings the access level is set to "u". ; NOTE: By default in all settings the access level is set to "u".

View File

@ -1,16 +1,16 @@
; Configuration file for AMX Mod X ; Configuration file for AMX Mod X
amxx_logdir addons/amxx/logs amxx_logdir addons/amxmodx/logs
amxx_configsdir addons/amxx/configs amxx_configsdir addons/amxmodx/configs
amxx_datadir addons/amxx/data amxx_datadir addons/amxmodx/data
amxx_modules addons/amxx/configs/modules.ini amxx_modules addons/amxmodx/configs/modules.ini
amxx_plugins addons/amxx/configs/plugins.ini amxx_plugins addons/amxmodx/configs/plugins.ini
amxx_pluginsdir addons/amxx/plugins amxx_pluginsdir addons/amxmodx/plugins
amxx_modulesdir addons/amxx/modules amxx_modulesdir addons/amxmodx/modules
amxx_vault addons/amxx/data/vault.ini amxx_vault addons/amxmodx/data/vault.ini
; Logging mode ; Logging mode
; 0 - no logging ; 0 - no logging
; 1 - one logfile / day ; 1 - one logfile / day
; 2 - one logfile / map ; 2 - one logfile / map
; 3 - HL Logs ; 3 - HL Logs
amx_logging 1 amxx_logging 1

View File

@ -86,3 +86,10 @@ amx_statsx_freeze -2.0
//If you set this to 0, clients cannot chose their language //If you set this to 0, clients cannot chose their language
amx_client_languages 1 amx_client_languages 1
// Plugin Debug mode
// 0 - No debugging (garbage line numbers)
// 1 - Plugins with "debug" option in plugins.ini are put into debug mode
// 2 - All plugins are put in debug mode
// Note - debug mode will affect JIT performance
amx_debug 1

View File

@ -1,5 +1,5 @@
; Menu configuration file ; Menu configuration file
; File location: $moddir/addons/amxx/configs/cmds.ini ; File location: $moddir/addons/amxmodx/configs/cmds.ini
; To use with Commands Menu plugin ; To use with Commands Menu plugin
; NOTE: By default in all settings the access level is set to "u". ; NOTE: By default in all settings the access level is set to "u".

View File

@ -1,18 +1,18 @@
; Configuration file for AMX Mod X ; Configuration file for AMX Mod X
amxx_logdir addons/amxx/logs amxx_logdir addons/amxmodx/logs
amxx_configsdir addons/amxx/configs amxx_configsdir addons/amxmodx/configs
amxx_datadir addons/amxx/data amxx_datadir addons/amxmodx/data
amxx_modules addons/amxx/configs/modules.ini amxx_modules addons/amxmodx/configs/modules.ini
amxx_plugins addons/amxx/configs/plugins.ini amxx_plugins addons/amxmodx/configs/plugins.ini
amxx_pluginsdir addons/amxx/plugins amxx_pluginsdir addons/amxmodx/plugins
amxx_modulesdir addons/amxx/modules amxx_modulesdir addons/amxmodx/modules
amxx_vault addons/amxx/data/vault.ini amxx_vault addons/amxmodx/data/vault.ini
csstats_score addons/amxx/data/csstats.amxx csstats_score addons/amxmodx/data/csstats.amxx
csstats addons/amxx/data/csstats.dat csstats addons/amxmodx/data/csstats.dat
; Logging mode ; Logging mode
; 0 - no logging ; 0 - no logging
; 1 - one logfile / day ; 1 - one logfile / day
; 2 - one logfile / map ; 2 - one logfile / map
; 3 - HL Logs ; 3 - HL Logs
amx_logging 1 amxx_logging 1

View File

@ -1,5 +1,5 @@
; Menu configuration file ; Menu configuration file
; File location: $moddir/addons/amxx/configs/cvars.ini ; File location: $moddir/addons/amxmodx/configs/cvars.ini
; To use with Commands Menu plugin ; To use with Commands Menu plugin
; Cvars Menu: ; Cvars Menu:

View File

@ -1,5 +1,5 @@
; Maps configuration file ; Maps configuration file
; File location: $moddir/addons/amxx/configs/maps.ini ; File location: $moddir/addons/amxmodx/configs/maps.ini
; To use with Maps Menu plugin ; To use with Maps Menu plugin
; Add in your mod's maps here ; Add in your mod's maps here

View File

@ -7,18 +7,21 @@
; ------------------------------ ; ------------------------------
fun_amxx_i386.so fun_amxx_i386.so
fun_amxx.dll fun_amxx.dll
fun_amxx_amd64.so
; ---------------------------------------------------- ; ----------------------------------------------------
; Engine - provides engine functions core to Half-Life ; Engine - provides engine functions core to Half-Life
; ---------------------------------------------------- ; ----------------------------------------------------
;engine_amxx_i386.so ;engine_amxx_i386.so
;engine_amxx.dll ;engine_amxx.dll
;engine_amxx_amd64.so
; ---------------------------------------------------------- ; ----------------------------------------------------------
; Fakemeta - provides a massive interface into the HL engine ; Fakemeta - provides a massive interface into the HL engine
; ---------------------------------------------------------- ; ----------------------------------------------------------
;fakemeta_amxx_i386.so ;fakemeta_amxx_i386.so
;fakemeta_amxx.dll ;fakemeta_amxx.dll
;fakemeta_amxx_amd64.so
; ------------------------------------------- ; -------------------------------------------
; Database Access - only enable one of these ; Database Access - only enable one of these
@ -26,38 +29,55 @@ fun_amxx.dll
; MySQL ; MySQL
;mysql_amxx_i386.so ;mysql_amxx_i386.so
;mysql_amxx.dll ;mysql_amxx.dll
;mysql_amxx_amd64.so
; PostgreSQL ; PostgreSQL
;pgsql_amxx_i386.so ;pgsql_amxx_i386.so
;pgsql_amxx.dll ;pgsql_amxx.dll
; Microsoft SQL ; Microsoft SQL
;mssql_amxx.dll ;mssql_amxx.dll
; SQLite
;sqlite_amxx.dll
;sqlite_amxx_i386.so
;sqlite_amxx_amd64.so
; --------------------------------------------- ; ---------------------------------------------
; GeoIP - determines the country of ip adresses ; GeoIP - determines the country of ip adresses
; --------------------------------------------- ; ---------------------------------------------
;geoip_amxx_i386.so ;geoip_amxx_i386.so
;geoip_amxx.dll ;geoip_amxx.dll
;geoip_amxx_amd64.so
; ------------------------------------ ; ------------------------------------
; Array - advanced arrays in scripting ; Array - advanced arrays in scripting
; ------------------------------------ ; ------------------------------------
;array_amxx_i386.so ;array_amxx_i386.so
;array_amxx.dll ;array_amxx.dll
;array_amxx_amd64.so
; -------------------------------- ; --------------------------------
; Sockets - network socket support ; Sockets - network socket support
; -------------------------------- ; --------------------------------
;sockets_amxx_i386.so ;sockets_amxx_i386.so
;sockets_amxx.dll ;sockets_amxx.dll
;sockets_amxx_amd64.so
; --------------------------
; Regular Expression support
; --------------------------
;regex_amxx_i386.so
;regex_amxx.dll
;regex_amxx_amd64.so
; ---------------------------------------------------------- ; ----------------------------------------------------------
; Counter-Strike - adds functions specific to Counter-Strike ; Counter-Strike - adds functions specific to Counter-Strike
; ---------------------------------------------------------- ; ----------------------------------------------------------
;cstrike_amxx_i386.so cstrike_amxx_i386.so
;cstrike_amxx.dll cstrike_amxx.dll
cstrike_amxx_amd64.so
; ------------------------------------------------ ; -----------------------------------------------------
; CS Stats - adds functionality for CS statistical ; CSX - adds functionality for CS statistics and events
; ------------------------------------------------ ; -----------------------------------------------------
;csstats_amxx_i386.so csx_amxx_i386.so
;csstats_amxx.dll csx_amxx.dll
csx_amxx_amd64.so

View File

@ -19,7 +19,7 @@ mapsmenu.amxx ; maps menu (vote, changelevel)
; Chat / Messages ; Chat / Messages
adminchat.amxx ; console chat commands adminchat.amxx ; console chat commands
;antiflood.amxx ; prevent clients from chat-flooding the server antiflood.amxx ; prevent clients from chat-flooding the server
scrollmsg.amxx ; displays a scrolling message scrollmsg.amxx ; displays a scrolling message
imessage.amxx ; displays information messages imessage.amxx ; displays information messages
adminvote.amxx ; vote commands adminvote.amxx ; vote commands
@ -35,9 +35,9 @@ statscfg.amxx ; allows to manage stats plugins via menu and commands
; Counter-Strike ; Counter-Strike
;restmenu.amxx ; restrict weapons menu ;restmenu.amxx ; restrict weapons menu
;statsx.amxx ; stats on death or round end (CSStats Module required!) ;statsx.amxx ; stats on death or round end (CSX Module required!)
;miscstats.amxx ; bunch of events announcement for Counter-Strike ;miscstats.amxx ; bunch of events announcement for Counter-Strike
;stats_logging.amxx ; weapons stats logging (CSStats Module required!) ;stats_logging.amxx ; weapons stats logging (CSX Module required!)
; Custom - Add 3rd party plugins here ; Custom - Add 3rd party plugins here

9
configs/cstrike/stats.ini Executable file
View File

@ -0,0 +1,9 @@
;Generated by Stats Configuration Plugin. Do not modify!
;Variable Description
ShowAttackers ;Show Attackers
ShowVictims ;Show Victims
ShowStats ;HUD-stats default
SayRankStats ;Say /rankstats
SayRank ;Say /rank
SayTop15 ;Say /top15
ShowStats ;HUD-stats default

19
configs/custommenuitems.cfg Executable file
View File

@ -0,0 +1,19 @@
// Here you can add menu items from any plugin to Menus Front-End plugin, aka "amxmodmenu".
// You can also add menu items to the normal non-admin client menu "amx_menu".
//
// Adding to "amxmodmenu":
// Usage: "amx_addmenuitem <menu text> <menu command> <access flags> <plugin name>"
//
// Adding to "amx_menu":
// Usage: "amx_addclientmenuitem <menu text> <menu command> <access flags> <plugin name>"
//
// <menu text>: This is the text displayed in the menu itself for this item.
// <menu command>: This is the client command used to access the menu.
// <access flags>: Specify what access flags admins must have to use this menu item. (Check users.ini for access flags.)
// <plugin name>: This must be the _exact_ (though case insensitive) name of the plugin which holds the menu command. (Use "amxx plugins" in server console, plugin names are listed in Name column.)
//
// Example: (be sure to use quotes around parameters with spaces!)
//
// amx_addmenuitem "Weapon Arena" "weaponarena_menu" "hu" "Weapon Arena"
// amx_addclientmenuitem "Warcraft 3" "war3menu" "" "Warcraft 3 XP"

View File

@ -1,5 +1,5 @@
; Menu configuration file ; Menu configuration file
; File location: $moddir/addons/amxx/configs/cvars.ini ; File location: $moddir/addons/amxmodx/configs/cvars.ini
; To use with Commands Menu plugin ; To use with Commands Menu plugin
; Cvars Menu: ; Cvars Menu:

View File

@ -1,19 +1,19 @@
; Configuration file for AMX Mod X ; Configuration file for AMX Mod X
amxx_logdir addons/amxx/logs amxx_logdir addons/amxmodx/logs
amxx_configsdir addons/amxx/configs amxx_configsdir addons/amxmodx/configs
amxx_datadir addons/amxx/data amxx_datadir addons/amxmodx/data
amxx_modules addons/amxx/configs/modules.ini amxx_modules addons/amxmodx/configs/modules.ini
amxx_plugins addons/amxx/configs/plugins.ini amxx_plugins addons/amxmodx/configs/plugins.ini
amxx_pluginsdir addons/amxx/plugins amxx_pluginsdir addons/amxmodx/plugins
amxx_modulesdir addons/amxx/modules amxx_modulesdir addons/amxmodx/modules
amxx_vault addons/amxx/data/vault.ini amxx_vault addons/amxmodx/data/vault.ini
; Logging mode ; Logging mode
; 0 - no logging ; 0 - no logging
; 1 - one logfile / day ; 1 - one logfile / day
; 2 - one logfile / map ; 2 - one logfile / map
; 3 - HL Logs ; 3 - HL Logs
amx_logging 1 amxx_logging 1
dodstats_score addons/amxx/data/dodstats.amxx dodstats_score addons/amxmodx/data/dodstats.amxx
dodstats addons/amxx/data/dodstats.dat dodstats addons/amxmodx/data/dodstats.dat

View File

@ -1,5 +1,5 @@
; Menu configuration file ; Menu configuration file
; File location: $moddir/addons/amxx/configs/cvars.ini ; File location: $moddir/addons/amxmodx/configs/cvars.ini
; To use with Commands Menu plugin ; To use with Commands Menu plugin
; Cvars Menu: ; Cvars Menu:
@ -10,29 +10,38 @@
"pausable" "0" "1" "u" "pausable" "0" "1" "u"
"sv_voiceenable" "0" "1" "u" "sv_voiceenable" "0" "1" "u"
"mp_chattime" "0" "1" "3" "u" "mp_chattime" "0" "1" "3" "u"
"mp_logmessages" "0" "1" "u"
"mp_friendlyfire" "0" "1" "u" "mp_friendlyfire" "0" "1" "u"
"mp_allowspectators" "0" "1" "u" "mp_allowspectators" "0" "1" "u"
"mp_flashlight" "0" "1" "u"
"mp_deathmsg" "0" "1" "u" "mp_deathmsg" "0" "1" "u"
"mp_fadetoblack" "0" "1" "u" "mp_fadetoblack" "0" "1" "u"
"mp_tkpenalty" "-1" "3" "6" "u" "mp_tkpenalty" "0" "3" "6" "u"
"mp_limitallies30cal" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_spawnbazookas" "0" "1" "u"
"mp_limitalliesbar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitalliescarbine" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitalliesgarand" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitalliesgarand" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitalliescarbine" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitalliesthompson" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitalliesgreasegun" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitalliesgreasegun" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitalliesspring" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitalliesspring" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitalliesthompson" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitalliesbar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitaxisfg42" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitallies30cal" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitaxisfg42s" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitalliesbazooka" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitaxisk43" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitalliesmortar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitaxiskar" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitaxiskar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitaxismg34" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitaxisk43" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitaxismg42" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitaxismp40" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitaxismp40" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitaxismp44" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitaxismp44" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitaxisscopedkar" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitaxisscopedkar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitbritassault" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitaxisfg42" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitaxisfg42s" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitaxismg34" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitaxismg42" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_combinemglimits" "0" "1" "u"
"mp_limitaxispschreck" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitaxismortar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitbritlight" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitbritlight" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitbritmg" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitbritassault" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitbritsniper" "-1" "1" "2" "3" "4" "5" "6" "0" "u" "mp_limitbritsniper" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitbritmg" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitbritpiat" "-1" "1" "2" "3" "4" "5" "6" "0" "u"
"mp_limitbritmortar" "-1" "1" "2" "3" "4" "5" "6" "0" "u"

View File

@ -1,5 +1,5 @@
; Maps configuration file ; Maps configuration file
; File location: $moddir/addons/amxx/configs/maps.ini ; File location: $moddir/addons/amxmodx/configs/maps.ini
; To use with Maps Menu plugin ; To use with Maps Menu plugin
; Add in your mod's maps here ; Add in your mod's maps here

View File

@ -7,18 +7,21 @@
; ------------------------------ ; ------------------------------
fun_amxx_i386.so fun_amxx_i386.so
fun_amxx.dll fun_amxx.dll
fun_amxx_amd64.so
; ---------------------------------------------------- ; ----------------------------------------------------
; Engine - provides engine functions core to Half-Life ; Engine - provides engine functions core to Half-Life
; ---------------------------------------------------- ; ----------------------------------------------------
;engine_amxx_i386.so ;engine_amxx_i386.so
;engine_amxx.dll ;engine_amxx.dll
;engine_amxx_amd64.so
; ---------------------------------------------------------- ; ----------------------------------------------------------
; Fakemeta - provides a massive interface into the HL engine ; Fakemeta - provides a massive interface into the HL engine
; ---------------------------------------------------------- ; ----------------------------------------------------------
;fakemeta_amxx_i386.so ;fakemeta_amxx_i386.so
;fakemeta_amxx.dll ;fakemeta_amxx.dll
;fakemeta_amxx_amd64.so
; ------------------------------------------- ; -------------------------------------------
; Database Access - only enable one of these ; Database Access - only enable one of these
@ -26,38 +29,55 @@ fun_amxx.dll
; MySQL ; MySQL
;mysql_amxx_i386.so ;mysql_amxx_i386.so
;mysql_amxx.dll ;mysql_amxx.dll
;mysql_amxx_amd64.so
; PostgreSQL ; PostgreSQL
;pgsql_amxx_i386.so ;pgsql_amxx_i386.so
;pgsql_amxx.dll ;pgsql_amxx.dll
; Microsoft SQL ; Microsoft SQL
;mssql_amxx.dll ;mssql_amxx.dll
; SQLite
;sqlite_amxx.dll
;sqlite_amxx_i386.so
;sqlite_amxx_amd64.so
; --------------------------------------------- ; ---------------------------------------------
; GeoIP - determines the country of ip adresses ; GeoIP - determines the country of ip adresses
; --------------------------------------------- ; ---------------------------------------------
;geoip_amxx_i386.so ;geoip_amxx_i386.so
;geoip_amxx.dll ;geoip_amxx.dll
;geoip_amxx_amd64.so
; ------------------------------------ ; ------------------------------------
; Array - advanced arrays in scripting ; Array - advanced arrays in scripting
; ------------------------------------ ; ------------------------------------
;array_amxx_i386.so ;array_amxx_i386.so
;array_amxx.dll ;array_amxx.dll
;array_amxx_amd64.so
; -------------------------------- ; --------------------------------
; Sockets - network socket support ; Sockets - network socket support
; -------------------------------- ; --------------------------------
;sockets_amxx_i386.so ;sockets_amxx_i386.so
;sockets_amxx.dll ;sockets_amxx.dll
;sockets_amxx_amd64.so
; --------------------------
; Regular Expression support
; --------------------------
;regex_amxx_i386.so
;regex_amxx.dll
;regex_amxx_amd64.so
; -------------------------------------------------- ; --------------------------------------------------
; Day of Defeat Fun - adds functions specific to DoD ; Day of Defeat Fun - adds functions specific to DoD
; -------------------------------------------------- ; --------------------------------------------------
;dodfun_amxx_i386.so dodfun_amxx_i386.so
;dodfun_amxx.dll dodfun_amxx.dll
dodfun_amxx_amd64.so
; ------------------------------------------------------- ; -------------------------------------------------------
; Day of Defeat X - adds stats and addition DoD functions ; Day of Defeat X - adds stats and addition DoD functions
; ------------------------------------------------------- ; -------------------------------------------------------
;dodx_amxx_i386.so dodx_amxx_i386.so
;dodx_amxx.dll dodx_amxx.dll
dodx_amxx_amd64.so

View File

@ -19,7 +19,7 @@ mapsmenu.amxx ; maps menu (vote, changelevel)
; Chat / Messages ; Chat / Messages
adminchat.amxx ; console chat commands adminchat.amxx ; console chat commands
;antiflood.amxx ; prevent clients from chat-flooding the server antiflood.amxx ; prevent clients from chat-flooding the server
scrollmsg.amxx ; displays a scrolling message scrollmsg.amxx ; displays a scrolling message
imessage.amxx ; displays information messages imessage.amxx ; displays information messages
adminvote.amxx ; vote commands adminvote.amxx ; vote commands

View File

@ -1,5 +1,5 @@
; Maps configuration file ; Maps configuration file
; File location: $moddir/addons/amxx/configs/maps.ini ; File location: $moddir/addons/amxmodx/configs/maps.ini
; To use with Maps Menu plugin ; To use with Maps Menu plugin
; Add in your mod's maps here ; Add in your mod's maps here

View File

@ -7,18 +7,21 @@
; ------------------------------ ; ------------------------------
fun_amxx_i386.so fun_amxx_i386.so
fun_amxx.dll fun_amxx.dll
fun_amxx_amd64.so
; ---------------------------------------------------- ; ----------------------------------------------------
; Engine - provides engine functions core to Half-Life ; Engine - provides engine functions core to Half-Life
; ---------------------------------------------------- ; ----------------------------------------------------
;engine_amxx_i386.so ;engine_amxx_i386.so
;engine_amxx.dll ;engine_amxx.dll
;engine_amxx_amd64.so
; ---------------------------------------------------------- ; ----------------------------------------------------------
; Fakemeta - provides a massive interface into the HL engine ; Fakemeta - provides a massive interface into the HL engine
; ---------------------------------------------------------- ; ----------------------------------------------------------
;fakemeta_amxx_i386.so ;fakemeta_amxx_i386.so
;fakemeta_amxx.dll ;fakemeta_amxx.dll
;fakemeta_amxx_amd64.so
; ------------------------------------------- ; -------------------------------------------
; Database Access - only enable one of these ; Database Access - only enable one of these
@ -26,26 +29,41 @@ fun_amxx.dll
; MySQL ; MySQL
;mysql_amxx_i386.so ;mysql_amxx_i386.so
;mysql_amxx.dll ;mysql_amxx.dll
;mysql_amxx_amd64.so
; PostgreSQL ; PostgreSQL
;pgsql_amxx_i386.so ;pgsql_amxx_i386.so
;pgsql_amxx.dll ;pgsql_amxx.dll
; Microsoft SQL ; Microsoft SQL
;mssql_amxx.dll ;mssql_amxx.dll
; SQLite
;sqlite_amxx.dll
;sqlite_amxx_i386.so
;sqlite_amxx_amd64.so
; --------------------------------------------- ; ---------------------------------------------
; GeoIP - determines the country of ip adresses ; GeoIP - determines the country of ip adresses
; --------------------------------------------- ; ---------------------------------------------
;geoip_amxx_i386.so ;geoip_amxx_i386.so
;geoip_amxx.dll ;geoip_amxx.dll
;geoip_amxx_amd64.so
; ------------------------------------ ; ------------------------------------
; Array - advanced arrays in scripting ; Array - advanced arrays in scripting
; ------------------------------------ ; ------------------------------------
;array_amxx_i386.so ;array_amxx_i386.so
;array_amxx.dll ;array_amxx.dll
;array_amxx_amd64.so
; -------------------------------- ; --------------------------------
; Sockets - network socket support ; Sockets - network socket support
; -------------------------------- ; --------------------------------
;sockets_amxx_i386.so ;sockets_amxx_i386.so
;sockets_amxx.dll ;sockets_amxx.dll
;sockets_amxx_amd64.so
; --------------------------
; Regular Expression support
; --------------------------
;regex_amxx_i386.so
;regex_amxx.dll
;regex_amxx_amd64.so

View File

@ -68,8 +68,23 @@ amx_extendmap_max 90
// Step for each extending // Step for each extending
amx_extendmap_step 15 amx_extendmap_step 15
//If you set this to 0, clients cannot chose their language
amx_client_languages 1
// Plugin Debug mode
// 0 - No debugging (garbage line numbers)
// 1 - Plugins with "debug" option in plugins.ini are put into debug mode
// 2 - All plugins are put in debug mode
// Note - debug mode will affect JIT performance
amx_debug 1
// Ignore the minimum and maximum settings for maps in the mapcycle // Ignore the minimum and maximum settings for maps in the mapcycle
amx_mapnum_ignore 0 amx_mapnum_ignore 0
//If you set this to 0, clients cannot chose their language // Idle Kicker Settings:
amx_client_languages 1 amx_idle_time 120 // Time players must be idle to be kicked
amx_idle_min_players 8 // Minimum players on the server before kicking starts
amx_idle_ignore_immunity 1 // Kick idle admins with immunity?
// Change this value to alter the frequency (in seconds) players can say /stuck to free themselves.
//amx_unstuck_frequency 4

View File

@ -1,5 +1,5 @@
; Menu configuration file ; Menu configuration file
; File location: $moddir/addons/amxx/configs/clcmds.ini ; File location: $moddir/addons/amxmodx/configs/clcmds.ini
; To use with Players Menu plugin ; To use with Players Menu plugin
; NOTE: By default in all settings the access level is set to "u". ; NOTE: By default in all settings the access level is set to "u".

View File

@ -1,5 +1,5 @@
; Menu configuration file ; Menu configuration file
; File location: $moddir/addons/amxx/configs/cmds.ini ; File location: $moddir/addons/amxmodx/configs/cmds.ini
; To use with Commands Menu plugin ; To use with Commands Menu plugin
; NOTE: By default in all settings the access level is set to "u". ; NOTE: By default in all settings the access level is set to "u".

View File

@ -1,5 +1,5 @@
; Menu configuration file ; Menu configuration file
; File location: $moddir/addons/amxx/configs/cvars.ini ; File location: $moddir/addons/amxmodx/configs/cvars.ini
; To use with Commands Menu plugin ; To use with Commands Menu plugin
; Cvars Menu: ; Cvars Menu:

View File

@ -1,27 +1,29 @@
; Maps configuration file ; Maps configuration file
; File location: $moddir/addons/amxx/configs/maps.ini ; File location: $moddir/addons/amxmodx/configs/maps.ini
; To use with Maps Menu plugin ; To use with Maps Menu plugin
; Add in your mod's maps here ; Add in your mod's maps here
co_angst
ns_caged
ns_hera
ns_metal ns_metal
ns_caged
co_sava
co_angst
ns_hera
ns_lost ns_lost
ns_nothing ns_nothing
co_niveus
co_faceoff co_faceoff
ns_mineshaft
co_daimos co_daimos
ns_bast
ns_origin ns_origin
co_kestrel co_kestrel
ns_tanith ns_tanith
co_rebirth
ns_nancy ns_nancy
ns_veil ns_veil
co_core co_core
co_ulysses
ns_eclipse ns_eclipse
co_pulse co_pulse
ns_ayumi ns_ayumi
ns_agora ns_altair
co_ulysses ns_eon

View File

@ -7,18 +7,21 @@
; ------------------------------ ; ------------------------------
fun_amxx_i386.so fun_amxx_i386.so
fun_amxx.dll fun_amxx.dll
fun_amxx_amd64.so
; ---------------------------------------------------- ; ----------------------------------------------------
; Engine - provides engine functions core to Half-Life ; Engine - provides engine functions core to Half-Life
; ---------------------------------------------------- ; ----------------------------------------------------
;engine_amxx_i386.so ;engine_amxx_i386.so
;engine_amxx.dll ;engine_amxx.dll
;engine_amxx_amd64.so
; ---------------------------------------------------------- ; ----------------------------------------------------------
; Fakemeta - provides a massive interface into the HL engine ; Fakemeta - provides a massive interface into the HL engine
; ---------------------------------------------------------- ; ----------------------------------------------------------
;fakemeta_amxx_i386.so ;fakemeta_amxx_i386.so
;fakemeta_amxx.dll ;fakemeta_amxx.dll
;fakemeta_amxx_amd64.so
; ------------------------------------------- ; -------------------------------------------
; Database Access - only enable one of these ; Database Access - only enable one of these
@ -26,32 +29,47 @@ fun_amxx.dll
; MySQL ; MySQL
;mysql_amxx_i386.so ;mysql_amxx_i386.so
;mysql_amxx.dll ;mysql_amxx.dll
;mysql_amxx_amd64.so
; PostgreSQL ; PostgreSQL
;pgsql_amxx_i386.so ;pgsql_amxx_i386.so
;pgsql_amxx.dll ;pgsql_amxx.dll
; Microsoft SQL ; Microsoft SQL
;mssql_amxx.dll ;mssql_amxx.dll
; SQLite
;sqlite_amxx.dll
;sqlite_amxx_i386.so
;sqlite_amxx_amd64.so
; --------------------------------------------- ; ---------------------------------------------
; GeoIP - determines the country of ip adresses ; GeoIP - determines the country of ip adresses
; --------------------------------------------- ; ---------------------------------------------
;geoip_amxx_i386.so ;geoip_amxx_i386.so
;geoip_amxx.dll ;geoip_amxx.dll
;geoip_amxx_amd64.so
; ------------------------------------ ; ------------------------------------
; Array - advanced arrays in scripting ; Array - advanced arrays in scripting
; ------------------------------------ ; ------------------------------------
;array_amxx_i386.so ;array_amxx_i386.so
;array_amxx.dll ;array_amxx.dll
;array_amxx_amd64.so
; -------------------------------- ; --------------------------------
; Sockets - network socket support ; Sockets - network socket support
; -------------------------------- ; --------------------------------
;sockets_amxx_i386.so ;sockets_amxx_i386.so
;sockets_amxx.dll ;sockets_amxx.dll
;sockets_amxx_amd64.so
; --------------------------
; Regular Expression support
; --------------------------
;regex_amxx_i386.so
;regex_amxx.dll
;regex_amxx_amd64.so
; ----------------- ; -----------------
; Natural Selection ; Natural Selection
; ----------------- ; -----------------
;ns_amxx_i386.so ns_amxx_i386.so
;ns_amxx.dll ns_amxx.dll
ns_amxx_amd64.so

40
configs/ns/plugins.ini Executable file
View File

@ -0,0 +1,40 @@
; AMX Mod X plugins
; Admin Base - Always one has to be activated
admin.amxx ; admin base (required for any admin-related)
;admin_sql.amxx ; admin base - SQL version (comment admin.amxx)
; Basic
admincmd.amxx ; basic admin console commands
adminhelp.amxx ; help command for admin console commands
adminslots.amxx ; slot reservation
multilingual.amxx ; Multi-Lingual management
; Menus
menufront.amxx ; front-end for admin menus
cmdmenu.amxx ; command menu (speech, settings)
plmenu.amxx ; players menu (kick, ban, client cmds.)
;telemenu.amxx ; teleport menu (Fun Module required!)
mapsmenu.amxx ; maps menu (vote, changelevel)
; Chat / Messages
adminchat.amxx ; console chat commands
antiflood.amxx ; prevent clients from chat-flooding the server
scrollmsg.amxx ; displays a scrolling message
imessage.amxx ; displays information messages
adminvote.amxx ; vote commands
; Map related
nextmap.amxx ; displays next map in mapcycle
mapchooser.amxx ; allows to vote for next map
timeleft.amxx ; displays time left on map
; Configuration
pausecfg.amxx ; allows to pause and unpause some plugins
; NS Specific plugins
idlekicker.amxx ; kicks idle players
nscommands.amxx ; extra commands for Natural-Selection
;unstuck.amxx ; Free stuck players (engine & ns modules required!)
; Custom - Add 3rd party plugins here

View File

@ -1,5 +1,5 @@
; Menu configuration file ; Menu configuration file
; File location: $moddir/addons/amxx/configs/speech.ini ; File location: $moddir/addons/amxmodx/configs/speech.ini
; To use with Commands Menu plugin ; To use with Commands Menu plugin
; NOTE: By default in all settings the access level is set to "u". ; NOTE: By default in all settings the access level is set to "u".

49
configs/ns/users.ini Executable file
View File

@ -0,0 +1,49 @@
; Users configuration file
; File location: $moddir/addons/amxmodx/configs/users.ini
; Line starting with ; is a comment
; Access flags:
; a - immunity (can't be kicked/baned/slayed/slaped and affected by other commmands)
; b - reservation (can join on reserved slots)
; c - amx_kick command
; d - amx_ban and amx_unban commands
; e - amx_slay and amx_slap commands
; f - amx_map command
; g - amx_cvar command (not all cvars will be available)
; h - amx_cfg command
; i - amx_chat and other chat commands
; j - amx_vote and other vote commands
; k - access to sv_password cvar (by amx_cvar command)
; l - access to amx_rcon command and rcon_password cvar (by amx_cvar command)
; m - custom level A (for additional plugins)
; n - custom level B
; o - custom level C
; p - custom level D
; q - custom level E
; r - custom level F
; s - custom level G
; t - ns commands (amx_random, amx_readyroom, amx_uncomm, amx_alien, amx_marine)
; u - menu access
; z - user (no admin)
; Account flags:
; a - disconnect player on invalid password
; b - clan tag
; c - this is steamid/wonid
; d - this is ip
; e - password is not checked (only name/ip/steamid needed)
; Password:
; Add to your autoexec.cfg: setinfo _pw "<password>"
; Change _pw to the value of amx_password_field
; Format of admin account:
; <name|ip|steamid> <password> <access flags> <account flags>
; Examples of admin accounts:
; "STEAM_0:0:123456" "" "abcdefghijklmnopqrstu" "ce"
; "123.45.67.89" "" "abcdefghijklmnopqrstu" "de"
; "My Name" "my_password" "abcdefghijklmnopqrstu" "a"
"loopback" "" "abcdefghijklmnopqrstu" "de"

View File

@ -19,7 +19,7 @@ mapsmenu.amxx ; maps menu (vote, changelevel)
; Chat / Messages ; Chat / Messages
adminchat.amxx ; console chat commands adminchat.amxx ; console chat commands
;antiflood.amxx ; prevent clients from chat-flooding the server antiflood.amxx ; prevent clients from chat-flooding the server
scrollmsg.amxx ; displays a scrolling message scrollmsg.amxx ; displays a scrolling message
imessage.amxx ; displays information messages imessage.amxx ; displays information messages
adminvote.amxx ; vote commands adminvote.amxx ; vote commands

View File

@ -1,5 +1,5 @@
; Menu configuration file ; Menu configuration file
; File location: $moddir/addons/amxx/configs/speech.ini ; File location: $moddir/addons/amxmodx/configs/speech.ini
; To use with Commands Menu plugin ; To use with Commands Menu plugin
; NOTE: By default in all settings the access level is set to "u". ; NOTE: By default in all settings the access level is set to "u".

View File

@ -1,5 +1,5 @@
// SQL configuration file // SQL configuration file
// File location: $moddir/addons/amxx/configs/sql.cfg // File location: $moddir/addons/amxmodx/configs/sql.cfg
// *NOTE* Linux users may encounter problems if they specify "localhost" instead of "127.0.0.1" // *NOTE* Linux users may encounter problems if they specify "localhost" instead of "127.0.0.1"
// We recommend using your server IP address instead of its name // We recommend using your server IP address instead of its name

View File

@ -1,18 +1,18 @@
; Configuration file for AMX Mod X ; Configuration file for AMX Mod X
amxx_logdir addons/amxx/logs amxx_logdir addons/amxmodx/logs
amxx_configsdir addons/amxx/configs amxx_configsdir addons/amxmodx/configs
amxx_datadir addons/amxx/data amxx_datadir addons/amxmodx/data
amxx_modules addons/amxx/configs/modules.ini amxx_modules addons/amxmodx/configs/modules.ini
amxx_plugins addons/amxx/configs/plugins.ini amxx_plugins addons/amxmodx/configs/plugins.ini
amxx_pluginsdir addons/amxx/plugins amxx_pluginsdir addons/amxmodx/plugins
amxx_modulesdir addons/amxx/modules amxx_modulesdir addons/amxmodx/modules
amxx_vault addons/amxx/data/vault.ini amxx_vault addons/amxmodx/data/vault.ini
tfcstats_score addons/amxx/data/tfcstats.amxx tfcstats_score addons/amxmodx/data/tfcstats.amxx
tfcstats addons/amxx/data/tfcstats.dat tfcstats addons/amxmodx/data/tfcstats.dat
; Logging mode ; Logging mode
; 0 - no logging ; 0 - no logging
; 1 - one logfile / day ; 1 - one logfile / day
; 2 - one logfile / map ; 2 - one logfile / map
; 3 - HL Logs ; 3 - HL Logs
amx_logging 1 amxx_logging 1

View File

@ -1,5 +1,5 @@
; Menu configuration file ; Menu configuration file
; File location: $moddir/addons/amxx/configs/cvars.ini ; File location: $moddir/addons/amxmodx/configs/cvars.ini
; To use with Commands Menu plugin ; To use with Commands Menu plugin
; Cvars Menu: ; Cvars Menu:

View File

@ -1,5 +1,5 @@
; Maps configuration file ; Maps configuration file
; File location: $moddir/addons/amxx/configs/maps.ini ; File location: $moddir/addons/amxmodx/configs/maps.ini
; To use with Maps Menu plugin ; To use with Maps Menu plugin
; Add in your mod's maps here ; Add in your mod's maps here

View File

@ -7,18 +7,21 @@
; ------------------------------ ; ------------------------------
fun_amxx_i386.so fun_amxx_i386.so
fun_amxx.dll fun_amxx.dll
fun_amxx_amd64.so
; ---------------------------------------------------- ; ----------------------------------------------------
; Engine - provides engine functions core to Half-Life ; Engine - provides engine functions core to Half-Life
; ---------------------------------------------------- ; ----------------------------------------------------
;engine_amxx_i386.so ;engine_amxx_i386.so
;engine_amxx.dll ;engine_amxx.dll
;engine_amxx_amd64.so
; ---------------------------------------------------------- ; ----------------------------------------------------------
; Fakemeta - provides a massive interface into the HL engine ; Fakemeta - provides a massive interface into the HL engine
; ---------------------------------------------------------- ; ----------------------------------------------------------
;fakemeta_amxx_i386.so ;fakemeta_amxx_i386.so
;fakemeta_amxx.dll ;fakemeta_amxx.dll
;fakemeta_amxx_amd64.so
; ------------------------------------------- ; -------------------------------------------
; Database Access - only enable one of these ; Database Access - only enable one of these
@ -26,32 +29,48 @@ fun_amxx.dll
; MySQL ; MySQL
;mysql_amxx_i386.so ;mysql_amxx_i386.so
;mysql_amxx.dll ;mysql_amxx.dll
;mysql_amxx_amd64.so
; PostgreSQL ; PostgreSQL
;pgsql_amxx_i386.so ;pgsql_amxx_i386.so
;pgsql_amxx.dll ;pgsql_amxx.dll
; Microsoft SQL ; Microsoft SQL
;mssql_amxx.dll ;mssql_amxx.dll
; SQLite
;sqlite_amxx.dll
;sqlite_amxx_i386.so
;sqlite_amxx_amd64.so
; --------------------------------------------- ; ---------------------------------------------
; GeoIP - determines the country of ip adresses ; GeoIP - determines the country of ip adresses
; --------------------------------------------- ; ---------------------------------------------
;geoip_amxx_i386.so ;geoip_amxx_i386.so
;geoip_amxx.dll ;geoip_amxx.dll
;geoip_amxx_amd64.so
; ------------------------------------ ; ------------------------------------
; Array - advanced arrays in scripting ; Array - advanced arrays in scripting
; ------------------------------------ ; ------------------------------------
;array_amxx_i386.so ;array_amxx_i386.so
;array_amxx.dll ;array_amxx.dll
;array_amxx_amd64.so
; -------------------------------- ; --------------------------------
; Sockets - network socket support ; Sockets - network socket support
; -------------------------------- ; --------------------------------
;sockets_amxx_i386.so ;sockets_amxx_i386.so
;sockets_amxx.dll ;sockets_amxx.dll
;sockets_amxx_amd64.so
; --------------------------
; Regular Expression support
; --------------------------
;regex_amxx_i386.so
;regex_amxx.dll
;regex_amxx_amd64.so
; ------------------------------------------------------------------ ; ------------------------------------------------------------------
; Team Fortress Classic X - adds functions and stats specific to TFC ; Team Fortress Classic X - adds functions and stats specific to TFC
; ------------------------------------------------------------------ ; ------------------------------------------------------------------
;tfcx_amxx_i386.so tfcx_amxx_i386.so
;tfcx_amxx.dll tfcx_amxx.dll
tfx_amxx_amd64.so

View File

@ -19,7 +19,7 @@ mapsmenu.amxx ; maps menu (vote, changelevel)
; Chat / Messages ; Chat / Messages
adminchat.amxx ; console chat commands adminchat.amxx ; console chat commands
;antiflood.amxx ; prevent clients from chat-flooding the server antiflood.amxx ; prevent clients from chat-flooding the server
scrollmsg.amxx ; displays a scrolling message scrollmsg.amxx ; displays a scrolling message
imessage.amxx ; displays information messages imessage.amxx ; displays information messages
adminvote.amxx ; vote commands adminvote.amxx ; vote commands

View File

@ -1,18 +1,18 @@
; Configuration file for AMX Mod X ; Configuration file for AMX Mod X
amxx_logdir addons/amxx/logs amxx_logdir addons/amxmodx/logs
amxx_configsdir addons/amxx/configs amxx_configsdir addons/amxmodx/configs
amxx_datadir addons/amxx/data amxx_datadir addons/amxmodx/data
amxx_modules addons/amxx/configs/modules.inia amxx_modules addons/amxmodx/configs/modules.ini
mxx_plugins addons/amxx/configs/plugins.ini amxx_plugins addons/amxmodx/configs/plugins.ini
amxx_pluginsdir addons/amxx/plugins amxx_pluginsdir addons/amxmodx/plugins
amxx_modulesdir addons/amxx/modules amxx_modulesdir addons/amxmodx/modules
amxx_vault addons/amxx/data/vault.ini amxx_vault addons/amxmodx/data/vault.ini
tsstats_score addons/amxx/data/tsstats.amxx tsstats_score addons/amxmodx/data/tsstats.amxx
tsstats addons/amxx/data/tsstats.dat tsstats addons/amxmodx/data/tsstats.dat
; Logging mode ; Logging mode
; 0 - no logging ; 0 - no logging
; 1 - one logfile / day ; 1 - one logfile / day
; 2 - one logfile / map ; 2 - one logfile / map
; 3 - HL Logs ; 3 - HL Logs
amx_logging 1 amxx_logging 1

View File

@ -1,5 +1,5 @@
; Maps configuration file ; Maps configuration file
; File location: $moddir/addons/amxx/configs/maps.ini ; File location: $moddir/addons/amxmodx/configs/maps.ini
; To use with Maps Menu plugin ; To use with Maps Menu plugin
; Add in your mod's maps here ; Add in your mod's maps here

View File

@ -7,18 +7,21 @@
; ------------------------------ ; ------------------------------
fun_amxx_i386.so fun_amxx_i386.so
fun_amxx.dll fun_amxx.dll
fun_amxx_amd64.so
; ---------------------------------------------------- ; ----------------------------------------------------
; Engine - provides engine functions core to Half-Life ; Engine - provides engine functions core to Half-Life
; ---------------------------------------------------- ; ----------------------------------------------------
;engine_amxx_i386.so ;engine_amxx_i386.so
;engine_amxx.dll ;engine_amxx.dll
;engine_amxx_amd64.so
; ---------------------------------------------------------- ; ----------------------------------------------------------
; Fakemeta - provides a massive interface into the HL engine ; Fakemeta - provides a massive interface into the HL engine
; ---------------------------------------------------------- ; ----------------------------------------------------------
;fakemeta_amxx_i386.so ;fakemeta_amxx_i386.so
;fakemeta_amxx.dll ;fakemeta_amxx.dll
;fakemeta_amxx_amd64.so
; ------------------------------------------- ; -------------------------------------------
; Database Access - only enable one of these ; Database Access - only enable one of these
@ -26,32 +29,48 @@ fun_amxx.dll
; MySQL ; MySQL
;mysql_amxx_i386.so ;mysql_amxx_i386.so
;mysql_amxx.dll ;mysql_amxx.dll
;mysql_amxx_amd64.so
; PostgreSQL ; PostgreSQL
;pgsql_amxx_i386.so ;pgsql_amxx_i386.so
;pgsql_amxx.dll ;pgsql_amxx.dll
; Microsoft SQL ; Microsoft SQL
;mssql_amxx.dll ;mssql_amxx.dll
; SQLite
;sqlite_amxx.dll
;sqlite_amxx_i386.so
;sqlite_amxx_amd64.so
; --------------------------------------------- ; ---------------------------------------------
; GeoIP - determines the country of ip adresses ; GeoIP - determines the country of ip adresses
; --------------------------------------------- ; ---------------------------------------------
;geoip_amxx_i386.so ;geoip_amxx_i386.so
;geoip_amxx.dll ;geoip_amxx.dll
;geoip_amxx_amd64.so
; ------------------------------------ ; ------------------------------------
; Array - advanced arrays in scripting ; Array - advanced arrays in scripting
; ------------------------------------ ; ------------------------------------
;array_amxx_i386.so ;array_amxx_i386.so
;array_amxx.dll ;array_amxx.dll
;array_amxx_amd64.so
; -------------------------------- ; --------------------------------
; Sockets - network socket support ; Sockets - network socket support
; -------------------------------- ; --------------------------------
;sockets_amxx_i386.so ;sockets_amxx_i386.so
;sockets_amxx.dll ;sockets_amxx.dll
;sockets_amxx_amd64.so
; --------------------------
; Regular Expression support
; --------------------------
;regex_amxx_i386.so
;regex_amxx.dll
;regex_amxx_amd64.so
; ----------------------------------------------------------- ; -----------------------------------------------------------
; The Specialists X - adds functions and stats specific to TS ; The Specialists X - adds functions and stats specific to TS
; ----------------------------------------------------------- ; -----------------------------------------------------------
;tsx_amxx_i386.so tsx_amxx_i386.so
;tsx_amxx.dll tsx_amxx.dll
tsx_amxx_amd64.so

View File

@ -19,7 +19,7 @@ mapsmenu.amxx ; maps menu (vote, changelevel)
; Chat / Messages ; Chat / Messages
adminchat.amxx ; console chat commands adminchat.amxx ; console chat commands
;antiflood.amxx ; prevent clients from chat-flooding the server antiflood.amxx ; prevent clients from chat-flooding the server
scrollmsg.amxx ; displays a scrolling message scrollmsg.amxx ; displays a scrolling message
imessage.amxx ; displays information messages imessage.amxx ; displays information messages
adminvote.amxx ; vote commands adminvote.amxx ; vote commands

View File

@ -1,5 +1,5 @@
; Users configuration file ; Users configuration file
; File location: $moddir/addons/amxx/configs/users.ini ; File location: $moddir/addons/amxmodx/configs/users.ini
; Line starting with ; is a comment ; Line starting with ; is a comment

View File

@ -130,7 +130,7 @@ void RankSystem::clear(){
bool RankSystem::loadCalc(const char* filename, char* error) bool RankSystem::loadCalc(const char* filename, char* error)
{ {
if ((MF_LoadAmxScript(&calc.amx,&calc.code,filename,error)!=AMX_ERR_NONE)|| if ((MF_LoadAmxScript(&calc.amx,&calc.code,filename,error,0)!=AMX_ERR_NONE)||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)|| (MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=AMX_ERR_NONE)|| (MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=AMX_ERR_NONE)||
(MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){ (MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){
@ -306,4 +306,3 @@ void RankSystem::saveRank( const char* filename )
fclose(bfp); fclose(bfp);
} }

View File

@ -120,4 +120,3 @@ public:
#endif #endif

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