143 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
260 changed files with 39862 additions and 482 deletions

View File

@ -244,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)

View File

@ -584,55 +584,64 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
if (*def == '%') if (*def == '%')
{ {
++def; ++def;
static char format[32]; if (*def == '%' || *def == 0)
format[0] = '%';
char *ptr = format+1;
while (ptr-format<sizeof(format) && !isalpha(*ptr++ = *def++))
/*nothing*/;
ZEROTERM(format);
*ptr = 0;
switch ( *(ptr-1) )
{ {
case 's': *outptr++ = '%';
{ ++def;
static char tmpString[4096]; }
char *tmpPtr = tmpString; else
NEXT_PARAM(); {
cell *tmpCell = get_amxaddr(amx, params[parm++]); static char format[32];
while (tmpPtr-tmpString < sizeof(tmpString) && *tmpCell) format[0] = '%';
*tmpPtr++ = *tmpCell++; char *ptr = format+1;
*tmpPtr = 0; while (ptr-format<sizeof(format) && !isalpha(*ptr++ = *def++))
sprintf(outptr, format, tmpString); /*nothing*/;
ZEROTERM(outbuf); ZEROTERM(format);
break;
} *ptr = 0;
case 'g': switch ( *(ptr-1) )
case 'f': {
{ case 's':
NEXT_PARAM(); {
sprintf(outptr, format, *(REAL*)get_amxaddr(amx, params[parm++])); static char tmpString[4096];
ZEROTERM(outbuf); char *tmpPtr = tmpString;
break; NEXT_PARAM();
} cell *tmpCell = get_amxaddr(amx, params[parm++]);
case 'i': while (tmpPtr-tmpString < sizeof(tmpString) && *tmpCell)
case 'd': *tmpPtr++ = *tmpCell++;
case 'c':
{ *tmpPtr = 0;
NEXT_PARAM(); sprintf(outptr, format, tmpString);
sprintf(outptr, format, (int)*get_amxaddr(amx, params[parm++])); ZEROTERM(outbuf);
ZEROTERM(outbuf); break;
break; }
} case 'g':
default: case 'f':
{ {
CHECK_OUTPTR(strlen(format)+1); NEXT_PARAM();
strcpy(outptr, format); sprintf(outptr, format, *(REAL*)get_amxaddr(amx, params[parm++]));
break; 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);
} }
outptr += strlen(outptr);
} }
else if (*def == '^') else if (*def == '^')
{ {

Binary file not shown.

View File

@ -1114,12 +1114,18 @@ int AMXAPI amx_Init(AMX *amx,void *program)
#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 __ */
@ -1128,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 */
@ -3408,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 */

View File

@ -46,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

View File

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

View File

@ -1205,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:
@ -1439,17 +1447,17 @@ static cell AMX_NATIVE_CALL read_data(AMX *amx, cell *params) /* 3 param */
{ {
return g_events.getCurrentMsgType(); return g_events.getCurrentMsgType();
} }
switch( *params/sizeof(cell) ) { switch( *params/sizeof(cell) ) {
case 1: case 1:
return g_events.getArgInteger( params[1] ); return g_events.getArgInteger( params[1] );
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;
} }
} }
static cell AMX_NATIVE_CALL get_playersnum(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_playersnum(AMX *amx, cell *params)
@ -2433,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)
{ {
@ -2720,6 +2771,18 @@ static cell AMX_NATIVE_CALL lang_phrase(AMX *amx, cell *params)
return 1; 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 },
@ -2856,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 },
@ -2881,5 +2946,6 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
{ "md5_file", amx_md5_file }, { "md5_file", amx_md5_file },
{ "plugin_flags", plugin_flags}, { "plugin_flags", plugin_flags},
{ "lang_phrase", lang_phrase}, { "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;

View File

@ -2354,6 +2354,14 @@ void FakeMeta_New_CVarRegister(cvar_t *pCVar)
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()));
@ -2419,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");
@ -2443,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)
{ {
@ -2533,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;
@ -2596,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
@ -2625,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
@ -2654,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
@ -2682,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
@ -2717,6 +2787,14 @@ int CFakeMeta::GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *int
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION; *interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
return(FALSE); return(FALSE);
} }
// evilspy:
//using metamod p-extensions?
if(gpMetaPExtFuncs) {
memcpy( pNewFunctionTable, pAMXXFunctionTable, sizeof( NEW_DLL_FUNCTIONS ) );
return TRUE;
}
memcpy( pNewFunctionTable, &g_NewDllFunctionTable, sizeof( NEW_DLL_FUNCTIONS ) ); memcpy( pNewFunctionTable, &g_NewDllFunctionTable, sizeof( NEW_DLL_FUNCTIONS ) );
// Make sure there is a core plugin // Make sure there is a core plugin
@ -2752,6 +2830,14 @@ int CFakeMeta::GetNewDLLFunctions_Post(NEW_DLL_FUNCTIONS *pNewFunctionTable, int
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION; *interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
return(FALSE); return(FALSE);
} }
// 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 ) ); memcpy( pNewFunctionTable, &g_NewDllFunctionTable_Post, sizeof( NEW_DLL_FUNCTIONS ) );
// Make sure there is a core plugin // Make sure there is a core plugin

View File

@ -185,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);
@ -194,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 ) {
@ -216,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);

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];
@ -300,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);
} }
@ -423,9 +423,10 @@ 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;
@ -547,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->initialized)
executeForwards(FF_ClientDisconnect, pPlayer->index);
if (pPlayer->ingame) { if (pPlayer->ingame) {
executeForwards(FF_ClientDisconnect, pPlayer->index);
--g_players_num; --g_players_num;
} }
pPlayer->Disconnect(); pPlayer->Disconnect();
@ -603,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
@ -619,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{
@ -1014,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) {
@ -1050,7 +1093,7 @@ 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");

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,6 +29,11 @@
* 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"
@ -174,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;
@ -193,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);
} }

View File

@ -780,6 +780,9 @@
<File <File
RelativePath="..\modules.h"> RelativePath="..\modules.h">
</File> </File>
<File
RelativePath="..\resource.h">
</File>
<Filter <Filter
Name="mmgr" Name="mmgr"
Filter=""> Filter="">

View File

@ -2648,7 +2648,7 @@ 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, ...) void MF_LogError(AMX *amx, int err, const char *fmt, ...)
@ -2660,7 +2660,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...)
vsprintf(msg, fmt, arglst); vsprintf(msg, fmt, arglst);
va_end(arglst); va_end(arglst);
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg); g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_LOGTAG, msg);
} }

View File

@ -148,8 +148,8 @@ 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 #ifdef JIT
print_srvconsole( "Core mode: JIT\n"); print_srvconsole( "Core mode: JIT\n");
#else #else

View File

@ -527,7 +527,7 @@ static cell AMX_NATIVE_CALL strbreak(AMX *amx, cell *params) /* 5 param */
} 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++;
} }

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
@ -13,22 +39,64 @@ VS_VERSION_INFO VERSIONINFO
FILETYPE 0x2L FILETYPE 0x2L
FILESUBTYPE 0x0L FILESUBTYPE 0x0L
BEGIN BEGIN
BLOCK "StringFileInfo" BLOCK "StringFileInfo"
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"
BEGIN 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

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".

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,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,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,44 +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 ; Regular Expression support
; -------------------------- ; --------------------------
;regex_amxx_i386.so ;regex_amxx_i386.so
;regex_amxx.dll ;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
; ----------------------------------------------------- ; -----------------------------------------------------
; CSX - adds functionality for CS statistics and events ; CSX - adds functionality for CS statistics and events
; ----------------------------------------------------- ; -----------------------------------------------------
;csx_amxx_i386.so csx_amxx_i386.so
;csx_amxx.dll csx_amxx.dll
csx_amxx_amd64.so

View File

@ -1,7 +1,12 @@
// Here you can add menu items from any plugin to Menus Front-End plugin, aka "amxmodmenu". // 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>" // 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 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. // <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.) // <access flags>: Specify what access flags admins must have to use this menu item. (Check users.ini for access flags.)
@ -10,4 +15,5 @@
// Example: (be sure to use quotes around parameters with spaces!) // Example: (be sure to use quotes around parameters with spaces!)
// //
// amx_addmenuitem "Weapon Arena" "weaponarena_menu" "hu" "Weapon Arena" // 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,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,44 +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 ; Regular Expression support
; -------------------------- ; --------------------------
;regex_amxx_i386.so ;regex_amxx_i386.so
;regex_amxx.dll ;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

@ -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,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 ; Regular Expression support
; -------------------------- ; --------------------------
;regex_amxx_i386.so ;regex_amxx_i386.so
;regex_amxx.dll ;regex_amxx.dll
;regex_amxx_amd64.so

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,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
@ -11,8 +11,8 @@ co_angst
ns_hera 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_bast
ns_origin ns_origin
@ -25,5 +25,5 @@ co_ulysses
ns_eclipse ns_eclipse
co_pulse co_pulse
ns_ayumi ns_ayumi
ns_agora
ns_altair ns_altair
ns_eon

View File

@ -5,20 +5,23 @@
; ------------------------------ ; ------------------------------
; Fun - provides extra functions ; Fun - provides extra functions
; ------------------------------ ; ------------------------------
;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,47 @@
; 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 ; Regular Expression support
; -------------------------- ; --------------------------
;regex_amxx_i386.so ;regex_amxx_i386.so
;regex_amxx.dll ;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

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 @@
; 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

@ -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,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,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 ; Regular Expression support
; -------------------------- ; --------------------------
;regex_amxx_i386.so ;regex_amxx_i386.so
;regex_amxx.dll ;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

@ -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,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 ; Regular Expression support
; -------------------------- ; --------------------------
;regex_amxx_i386.so ;regex_amxx_i386.so
;regex_amxx.dll ;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

@ -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

@ -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;
@ -2525,6 +2544,7 @@ 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); REQFUNC("Format", g_fn_Format, PFN_FORMAT);
@ -2560,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);
@ -2572,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);
@ -2626,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);
} }
@ -2649,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);
@ -2664,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);

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
@ -929,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
@ -1919,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*/);
@ -1932,8 +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_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*/);
@ -1986,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;
@ -2026,6 +2033,7 @@ extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags; extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict; extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
extern PFN_FORMAT g_fn_Format; 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
@ -2045,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) { }
@ -2059,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) { }
@ -2094,11 +2106,14 @@ const char * MF_Format (const char *fmt, ...) { }
#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
@ -2108,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
@ -2133,7 +2149,7 @@ void MF_Log(const char *fmt, ...);
#define MF_UnregisterSPForward g_fn_UnregisterSPForward #define MF_UnregisterSPForward g_fn_UnregisterSPForward
#define MF_GetPlayerFlags g_fn_GetPlayerFlags #define MF_GetPlayerFlags g_fn_GetPlayerFlags
#define MF_GetPlayerEdict g_fn_GetPlayerEdict #define MF_GetPlayerEdict g_fn_GetPlayerEdict
#define MF_Format g_fn_Format; #define MF_Format g_fn_Format
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);

View File

@ -13,7 +13,6 @@ CCstrikePlayer::CCstrikePlayer()
{ {
modelled = false; modelled = false;
inspectModel = false; inspectModel = false;
online = false;
} }
bool CCstrikePlayer::GetModelled() bool CCstrikePlayer::GetModelled()
@ -48,20 +47,3 @@ void CCstrikePlayer::SetInspectModel(bool inspectModelIn)
{ {
inspectModel = inspectModelIn; inspectModel = inspectModelIn;
} }
bool CCstrikePlayer::GetOnline()
{
return online;
}
void CCstrikePlayer::SetOnline(bool onlineIn)
{
online = onlineIn;
}
void CCstrikePlayer::Initialize()
{
SetModelled(false);
SetInspectModel(false);
SetOnline(false);
}

View File

@ -10,8 +10,6 @@ class CCstrikePlayer
public: public:
CCstrikePlayer(); CCstrikePlayer();
void Initialize();
bool GetModelled(); bool GetModelled();
bool SetModelled(bool modelledIn); bool SetModelled(bool modelledIn);
const char* GetModel(); const char* GetModel();
@ -20,13 +18,10 @@ public:
bool GetInspectModel(); bool GetInspectModel();
void SetInspectModel(bool inspectModelIn); void SetInspectModel(bool inspectModelIn);
bool GetOnline();
void SetOnline(bool onlineIn);
private: private:
bool inspectModel; bool inspectModel;
bool modelled; bool modelled;
bool online;
char model[32]; char model[32];
}; };

View File

@ -2648,7 +2648,7 @@ 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, ...) void MF_LogError(AMX *amx, int err, const char *fmt, ...)
@ -2660,7 +2660,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...)
vsprintf(msg, fmt, arglst); vsprintf(msg, fmt, arglst);
va_end(arglst); va_end(arglst);
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg); g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_LOGTAG, msg);
} }

View File

@ -346,6 +346,51 @@ static cell AMX_NATIVE_CALL cs_set_weapon_burstmode(AMX *amx, cell *params) // c
return 1; return 1;
} }
static cell AMX_NATIVE_CALL cs_get_user_armor(AMX *amx, cell *params) // cs_get_user_armor(index, CsArmorType:&armortype); = 2 params
{
// Return how much armor and set reference of what type...
// params[1] = user index
// params[2] = byref, set armor type here (no armor/vest/vest+helmet)
CHECK_PLAYER(params[1]);
// Make into edict pointer
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
cell *armorTypeByRef = MF_GetAmxAddr(amx, params[2]);
*armorTypeByRef = *((int *)pPlayer->pvPrivateData + OFFSET_ARMORTYPE);
return pPlayer->v.armorvalue;
}
static cell AMX_NATIVE_CALL cs_set_user_armor(AMX *amx, cell *params) // cs_set_user_armor(index, armorvalue, CsArmorType:armortype); = 3 params
{
// Set armor and set what type and send a message to client...
// params[1] = user index
// params[2] = armor value
// params[3] = armor type (no armor/vest/vest+helmet)
CHECK_PLAYER(params[1]);
// Make into edict pointer
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
// Set armor value
pPlayer->v.armorvalue = params[2];
// Set armor type
*((int *)pPlayer->pvPrivateData + OFFSET_ARMORTYPE) = params[3];
if (params[3] == CS_ARMOR_KEVLAR || params[3] == CS_ARMOR_ASSAULTSUIT) {
// And send appropriate message
MESSAGE_BEGIN(params[1], GET_USER_MSG_ID(PLID, "ItemPickup", NULL), NULL, pPlayer);
WRITE_STRING(params[3] == CS_ARMOR_KEVLAR ? "item_kevlar" : "item_assaultsuit");
MESSAGE_END();
}
return 1;
}
static cell AMX_NATIVE_CALL cs_get_user_vip(AMX *amx, cell *params) // cs_get_user_vip(index); = 1 param static cell AMX_NATIVE_CALL cs_get_user_vip(AMX *amx, cell *params) // cs_get_user_vip(index); = 1 param
{ {
// Is user vip? // Is user vip?
@ -1193,6 +1238,8 @@ AMX_NATIVE_INFO cstrike_Exports[] = {
{"cs_set_user_tked", cs_set_user_tked}, {"cs_set_user_tked", cs_set_user_tked},
{"cs_get_user_driving", cs_get_user_driving}, {"cs_get_user_driving", cs_get_user_driving},
{"cs_get_user_stationary", cs_get_user_stationary}, {"cs_get_user_stationary", cs_get_user_stationary},
{"cs_get_user_armor", cs_get_user_armor},
{"cs_set_user_armor", cs_set_user_armor},
//------------------- <-- max 19 characters! //------------------- <-- max 19 characters!
{NULL, NULL} {NULL, NULL}
}; };
@ -1261,6 +1308,23 @@ void PlayerPostThink(edict_t* pPlayer) {
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
static cell AMX_NATIVE_CALL cs_user_has_shield(AMX *amx, cell *params)
{
//Return 1 if user has a shield.
//params[1] = user id
//Check player
CHECK_PLAYER(params[1]);
// Make into edict pointer
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
if ((int)*((int *)pPlayer->pvPrivateData + OFFSET_SHIELD) & HAS_SHIELD)
return 1;
return 0;
}
void OnAmxxAttach() void OnAmxxAttach()
{ {
MF_AddNatives(cstrike_Exports); MF_AddNatives(cstrike_Exports);

View File

@ -46,13 +46,26 @@
#if defined __linux__ #if defined __linux__
#define EXTRAOFFSET 5 // offsets 5 higher in Linux builds #define EXTRAOFFSET 5 // offsets 5 higher in Linux builds
#define EXTRAOFFSET_WEAPONS 4 // weapon offsets are obviously only 4 steps higher on Linux!
#else #else
#define EXTRAOFFSET 0 // no change in Windows builds #define EXTRAOFFSET 0 // no change in Windows builds
#define EXTRAOFFSET_WEAPONS 0
#endif // defined __linux__ #endif // defined __linux__
/*
Offset history:
041029:
Confirmed (pretty much) ALL offsets for 32 bit Windows, 32 bit Linux and amd64 (yes that's all of them).
Found out that weapon offsets are only +4 higher on Linux.
Also backpack ammo offsets were all obviously 5 steps too high since unknown time...
*/
#define HAS_SHIELD (1<<24) //16777216
// "player" entities // "player" entities
#if !defined __amd64__ #if !defined __amd64__
// 32 bit offsets here // 32 bit offsets here
#define OFFSET_ARMORTYPE 112 + EXTRAOFFSET
#define OFFSET_TEAM 114 + EXTRAOFFSET #define OFFSET_TEAM 114 + EXTRAOFFSET
#define OFFSET_CSMONEY 115 + EXTRAOFFSET #define OFFSET_CSMONEY 115 + EXTRAOFFSET
#define OFFSET_PRIMARYWEAPON 116 + EXTRAOFFSET #define OFFSET_PRIMARYWEAPON 116 + EXTRAOFFSET
@ -65,31 +78,33 @@
#define OFFSET_ISDRIVING 350 + EXTRAOFFSET // 040926 #define OFFSET_ISDRIVING 350 + EXTRAOFFSET // 040926
#define OFFSET_STATIONARY 362 + EXTRAOFFSET // 040927 (363 works also!) #define OFFSET_STATIONARY 362 + EXTRAOFFSET // 040927 (363 works also!)
#define OFFSET_AWM_AMMO 382 + EXTRAOFFSET #define OFFSET_AWM_AMMO 377 + EXTRAOFFSET // 041029: All of these *_AMMO:s were changed -5
#define OFFSET_SCOUT_AMMO 383 + EXTRAOFFSET #define OFFSET_SCOUT_AMMO 378 + EXTRAOFFSET
#define OFFSET_PARA_AMMO 384 + EXTRAOFFSET #define OFFSET_PARA_AMMO 379 + EXTRAOFFSET
#define OFFSET_FAMAS_AMMO 385 + EXTRAOFFSET #define OFFSET_FAMAS_AMMO 380 + EXTRAOFFSET
#define OFFSET_M3_AMMO 386 + EXTRAOFFSET #define OFFSET_M3_AMMO 381 + EXTRAOFFSET
#define OFFSET_USP_AMMO 387 + EXTRAOFFSET #define OFFSET_USP_AMMO 382 + EXTRAOFFSET
#define OFFSET_FIVESEVEN_AMMO 388 + EXTRAOFFSET #define OFFSET_FIVESEVEN_AMMO 383 + EXTRAOFFSET
#define OFFSET_DEAGLE_AMMO 389 + EXTRAOFFSET #define OFFSET_DEAGLE_AMMO 384 + EXTRAOFFSET
#define OFFSET_P228_AMMO 390 + EXTRAOFFSET #define OFFSET_P228_AMMO 385 + EXTRAOFFSET
#define OFFSET_GLOCK_AMMO 391 + EXTRAOFFSET #define OFFSET_GLOCK_AMMO 386 + EXTRAOFFSET
#define OFFSET_FLASH_AMMO 392 + EXTRAOFFSET #define OFFSET_FLASH_AMMO 387 + EXTRAOFFSET
#define OFFSET_HE_AMMO 393 + EXTRAOFFSET #define OFFSET_HE_AMMO 388 + EXTRAOFFSET
#define OFFSET_SMOKE_AMMO 394 + EXTRAOFFSET #define OFFSET_SMOKE_AMMO 389 + EXTRAOFFSET
#define OFFSET_C4_AMMO 395 + EXTRAOFFSET #define OFFSET_C4_AMMO 390 + EXTRAOFFSET
#define OFFSET_CSDEATHS 444 + EXTRAOFFSET // 040926 #define OFFSET_CSDEATHS 444 + EXTRAOFFSET // 040926
#define OFFSET_SHIELD 510 + EXTRAOFFSET
// "weapon_*" entities // "weapon_*" entities
#define OFFSET_WEAPONTYPE 43 + EXTRAOFFSET #define OFFSET_WEAPONTYPE 43 + EXTRAOFFSET_WEAPONS
#define OFFSET_CLIPAMMO 51 + EXTRAOFFSET #define OFFSET_CLIPAMMO 51 + EXTRAOFFSET_WEAPONS
#define OFFSET_SILENCER_FIREMODE 74 + EXTRAOFFSET #define OFFSET_SILENCER_FIREMODE 74 + EXTRAOFFSET_WEAPONS
// "hostage_entity" entities // "hostage_entity" entities
#define OFFSET_HOSTAGEFOLLOW 86 + EXTRAOFFSET #define OFFSET_HOSTAGEFOLLOW 86 + EXTRAOFFSET
#define OFFSET_HOSTAGEID 487 + EXTRAOFFSET #define OFFSET_HOSTAGEID 487 + EXTRAOFFSET
#else #else
// Amd64 offsets here // Amd64 offsets here
#define OFFSET_ARMORTYPE 137 + EXTRAOFFSET
#define OFFSET_TEAM 139 + EXTRAOFFSET // +25 #define OFFSET_TEAM 139 + EXTRAOFFSET // +25
#define OFFSET_CSMONEY 140 + EXTRAOFFSET // +25 #define OFFSET_CSMONEY 140 + EXTRAOFFSET // +25
#define OFFSET_PRIMARYWEAPON 141 + EXTRAOFFSET // +25 #define OFFSET_PRIMARYWEAPON 141 + EXTRAOFFSET // +25
@ -118,6 +133,7 @@
#define OFFSET_C4_AMMO 439 + EXTRAOFFSET // +44 #define OFFSET_C4_AMMO 439 + EXTRAOFFSET // +44
#define OFFSET_CSDEATHS 493 + EXTRAOFFSET // +49 #define OFFSET_CSDEATHS 493 + EXTRAOFFSET // +49
#define OFFSET_SHIELD 559 + EXTRAOFFSET
// "weapon_*" entities // "weapon_*" entities
#define OFFSET_WEAPONTYPE 57 + EXTRAOFFSET // +14 #define OFFSET_WEAPONTYPE 57 + EXTRAOFFSET // +14
#define OFFSET_CLIPAMMO 65 + EXTRAOFFSET // +14 #define OFFSET_CLIPAMMO 65 + EXTRAOFFSET // +14
@ -195,6 +211,10 @@
#define AMD64_STATIONARY_NO 2 #define AMD64_STATIONARY_NO 2
#define AMD64_STATIONARY_YES 3 #define AMD64_STATIONARY_YES 3
#define CS_ARMOR_NONE 0
#define CS_ARMOR_KEVLAR 1
#define CS_ARMOR_ASSAULTSUIT 2
enum CS_Internal_Models { enum CS_Internal_Models {
CS_DONTCHANGE = 0, CS_DONTCHANGE = 0,
CS_CT_URBAN = 1, CS_CT_URBAN = 1,

View File

@ -4,8 +4,8 @@
#define __MODULECONFIG_H__ #define __MODULECONFIG_H__
// Module info // Module info
#define MODULE_NAME "Counter-Strike" #define MODULE_NAME "CStrike"
#define MODULE_VERSION "0.20" #define MODULE_VERSION "1.01"
#define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org" #define MODULE_URL "http://www.amxmodx.org"
#define MODULE_LOGTAG "CSTRIKE" #define MODULE_LOGTAG "CSTRIKE"
@ -459,4 +459,4 @@
#endif // USE_METAMOD #endif // USE_METAMOD
#endif // __MODULECONFIG_H__ #endif // __MODULECONFIG_H__

View File

@ -25,7 +25,7 @@ bool Grenades::find( edict_t* enemy, CPlayer** p, int* type )
bool found = false; bool found = false;
Obj* a = head; Obj* a = head;
while ( a ){ while ( a ){
if ( a->time > gpGlobals->time ) { if ( a->time > gpGlobals->time && !found ) {
if ( a->grenade == enemy ) { if ( a->grenade == enemy ) {
found = true; found = true;
*p = a->player; *p = a->player;
@ -296,4 +296,5 @@ bool isModuleActive(){
if ( !(int)CVAR_GET_FLOAT("csstats_pause") ) if ( !(int)CVAR_GET_FLOAT("csstats_pause") )
return true; return true;
return false; return false;
} }

345
dlls/csx/source/WinCSX/CRank.cpp Executable file
View File

@ -0,0 +1,345 @@
#include "stdafx.h"
//#include "amxxmodule.h"
#include "CRank.h"
#include <stdio.h>
//#include "rank.h"
// *****************************************************
// class Stats
// *****************************************************
Stats::Stats(){
hits = shots = damage = hs = tks = kills = deaths = bDefusions = bDefused = bPlants = bExplosions = 0;
memset( bodyHits , 0 ,sizeof( bodyHits ) );
}
void Stats::commit(Stats* a){
hits += a->hits;
shots += a->shots;
damage += a->damage;
hs += a->hs;
tks += a->tks;
kills += a->kills;
deaths += a->deaths;
bDefusions += a->bDefusions;
bDefused += a->bDefused;
bPlants += a->bPlants;
bExplosions += a->bExplosions;
for(int i = 1; i < 8; ++i)
bodyHits[i] += a->bodyHits[i];
}
// *****************************************************
// class RankSystem
// *****************************************************
RankSystem::RankStats::RankStats( const char* uu, const char* nn, RankSystem* pp ) {
name = 0;
namelen = 0;
unique = 0;
uniquelen = 0;
score = 0;
parent = pp;
id = ++parent->rankNum;
next = prev = 0;
setName( nn );
setUnique( uu );
}
RankSystem::RankStats::~RankStats() {
delete[] name;
delete[] unique;
--parent->rankNum;
}
void RankSystem::RankStats::setName( const char* nn ) {
delete[] name;
namelen = strlen(nn) + 1;
name = new char[namelen];
if ( name )
strcpy( name , nn );
else
namelen = 0;
}
void RankSystem::RankStats::setUnique( const char* nn ) {
delete[] unique;
uniquelen = strlen(nn) + 1;
unique = new char[uniquelen];
if ( unique )
strcpy( unique , nn );
else
uniquelen = 0;
}
RankSystem::RankSystem() {
head = 0;
tail = 0;
rankNum = 0;
calc.code = 0;
}
RankSystem::~RankSystem() {
clear();
}
void RankSystem::put_before( RankStats* a, RankStats* ptr ){
a->next = ptr;
if ( ptr ){
a->prev = ptr->prev;
ptr->prev = a;
}
else{
a->prev = head;
head = a;
}
if ( a->prev ) a->prev->next = a;
else tail = a;
}
void RankSystem::put_after( RankStats* a, RankStats* ptr ) {
a->prev = ptr;
if ( ptr ){
a->next = ptr->next;
ptr->next = a;
}
else{
a->next = tail;
tail = a;
}
if ( a->next ) a->next->prev = a;
else head = a;
}
void RankSystem::unlink( RankStats* ptr ){
if (ptr->prev) ptr->prev->next = ptr->next;
else tail = ptr->next;
if (ptr->next) ptr->next->prev = ptr->prev;
else head = ptr->prev;
}
void RankSystem::clear(){
while( tail ){
head = tail->next;
delete tail;
tail = head;
}
}
/*
bool RankSystem::loadCalc(const char* filename, char* error)
{
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.amxAddr2, &calc.physAddr2)!=AMX_ERR_NONE)||
(MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){
//LOG_CONSOLE( PLID, "Couldn't load plugin (file \"%s\")",filename);
MF_UnloadAmxScript(&calc.amx, &calc.code);
return false;
}
return true;
}
void RankSystem::unloadCalc()
{
MF_UnloadAmxScript(&calc.amx , &calc.code);
}
*/
RankSystem::RankStats* RankSystem::findEntryInRank(const char* unique, const char* name )
{
RankStats* a = head;
while ( a )
{
if ( strcmp( a->getUnique(), unique ) == 0 )
return a;
a = a->prev;
}
a = new RankStats( unique ,name,this );
if ( a == 0 ) return 0;
put_after( a , 0 );
return a;
}
RankSystem::RankStats* RankSystem::findEntryInRankByUnique(const char* unique)
{
RankStats* a = head;
while ( a )
{
if ( strcmp( a->getUnique(), unique ) == 0 )
return a;
a = a->prev;
}
return NULL; // none found
}
RankSystem::RankStats* RankSystem::findEntryInRankByPos(int position)
{
RankStats* a = head;
while ( a )
{
if (a->getPosition() == position)
return a;
a = a->prev;
}
return NULL;
}
int RankSystem::updatePos( RankStats* rr , Stats* s )
{
RankStats* rrFirst = rr;
if (s != NULL)
rr->addStats( s );
if ( calc.code ) {
calc.physAddr1[0] = rr->kills;
calc.physAddr1[1] = rr->deaths;
calc.physAddr1[2] = rr->hs;
calc.physAddr1[3] = rr->tks;
calc.physAddr1[4] = rr->shots;
calc.physAddr1[5] = rr->hits;
calc.physAddr1[6] = rr->damage;
calc.physAddr1[7] = rr->bDefusions;
calc.physAddr1[8] = rr->bDefused;
calc.physAddr1[9] = rr->bPlants;
calc.physAddr1[10] = rr->bExplosions;
for(int i = 1; i < 8; ++i)
calc.physAddr2[i] = rr->bodyHits[i];
cell result = 0;
//int err;
//if ((err = MF_AmxExec(&calc.amx,&result, calc.func ,2,calc.amxAddr1,calc.amxAddr2 )) != AMX_ERR_NONE)
//LOG_CONSOLE( PLID, "Run time error %d on line %ld (plugin \"%s\")", err,calc.amx.curline,LOCALINFO("csstats_score"));
rr->score = result;
}
else rr->score = rr->kills - rr->deaths;
RankStats* aa = rr->next;
while ( aa && (aa->score <= rr->score) ) { // try to nominate
rr->goUp();
aa->goDown();
aa = aa->next; // go to next rank
}
if ( aa != rr->next )
{
unlink( rr );
put_before( rr, aa );
}
else
{
aa = rr->prev;
while ( aa && (aa->score > rr->score) ) { // go down
rr->goDown();
aa->goUp();
aa = aa->prev; // go to prev rank
}
if ( aa != rr->prev ){
unlink( rr );
put_after( rr, aa );
}
}
return rrFirst->getPosition();
}
bool RankSystem::loadRank( const char* filename )
{
FILE *bfp = fopen( filename , "rb" );
if ( !bfp ) {
return false;
}
short int i = 0;
fread(&i, 1 , sizeof(short int) , bfp);
if (i == RANK_VERSION)
{
Stats d;
char unique[64], name[64];
fread(&i , 1, sizeof(short int), bfp);
while( i )
{
fread(name , i,sizeof(char) , bfp);
fread(&i , 1, sizeof(short int), bfp);
fread(unique , i,sizeof(char) , bfp);
fread(&d.tks, 1,sizeof(int), bfp);
fread(&d.damage, 1,sizeof(int), bfp);
fread(&d.deaths, 1,sizeof(int), bfp);
fread(&d.kills, 1,sizeof(int), bfp);
fread(&d.shots, 1,sizeof(int), bfp);
fread(&d.hits, 1,sizeof(int), bfp);
fread(&d.hs, 1,sizeof(int), bfp);
fread(&d.bDefusions, 1,sizeof(int), bfp);
fread(&d.bDefused, 1,sizeof(int), bfp);
fread(&d.bPlants, 1,sizeof(int), bfp);
fread(&d.bExplosions, 1,sizeof(int), bfp);
fread(d.bodyHits, 1,sizeof(d.bodyHits), bfp);
fread(&i , 1, sizeof(short int), bfp);
RankSystem::RankStats* a = findEntryInRank( unique , name );
if ( a ) a->updatePosition( &d );
}
}
fclose(bfp);
return true;
}
void RankSystem::saveRank( const char* filename )
{
FILE *bfp = fopen(filename, "wb");
if ( !bfp ) return;
short int i = RANK_VERSION;
fwrite(&i, 1, sizeof(short int) , bfp);
RankSystem::iterator a = front();
while ( a )
{
if ( (*a).score != (1<<31) ) // score must be different than mincell
{
fwrite( &(*a).namelen , 1, sizeof(short int), bfp);
fwrite( (*a).name , (*a).namelen , sizeof(char) , bfp);
fwrite( &(*a).uniquelen , 1, sizeof(short int), bfp);
fwrite( (*a).unique , (*a).uniquelen , sizeof(char) , bfp);
fwrite( &(*a).tks, 1, sizeof(int), bfp);
fwrite( &(*a).damage, 1, sizeof(int), bfp);
fwrite( &(*a).deaths, 1, sizeof(int), bfp);
fwrite( &(*a).kills, 1, sizeof(int), bfp);
fwrite( &(*a).shots, 1, sizeof(int), bfp);
fwrite( &(*a).hits, 1, sizeof(int), bfp);
fwrite( &(*a).hs, 1, sizeof(int), bfp);
fwrite( &(*a).bDefusions, 1, sizeof(int), bfp);
fwrite( &(*a).bDefused, 1, sizeof(int), bfp);
fwrite( &(*a).bPlants, 1, sizeof(int), bfp);
fwrite( &(*a).bExplosions, 1, sizeof(int), bfp);
fwrite( (*a).bodyHits, 1, sizeof((*a).bodyHits), bfp);
}
--a;
}
i = 0;
fwrite( &i , 1, sizeof(short int), bfp); // null terminator
fclose(bfp);
}

128
dlls/csx/source/WinCSX/CRank.h Executable file
View File

@ -0,0 +1,128 @@
#ifndef CRANK_H
#define CRANK_H
#define RANK_VERSION 11
#include "stdafx.h"
#include "amxxmodule.h"
// *****************************************************
// class Stats
// *****************************************************
struct Stats {
int hits;
int shots;
int damage;
int hs;
int tks;
int kills;
int deaths;
int bodyHits[9]; ////////////////////
// SiDLuke start
int bPlants;
int bExplosions;
int bDefusions;
int bDefused;
// SiDLuke end :D
Stats();
void commit(Stats* a);
};
// *****************************************************
// class RankSystem
// *****************************************************
class RankSystem
{
public:
class RankStats;
friend class RankStats;
class iterator;
class RankStats : public Stats {
friend class RankSystem;
friend class iterator;
RankSystem* parent;
RankStats* next;
RankStats* prev;
char* unique;
short int uniquelen;
char* name;
short int namelen;
int score;
int id;
RankStats( const char* uu, const char* nn, RankSystem* pp );
~RankStats();
void setUnique( const char* nn );
inline void goDown() {++id;}
inline void goUp() {--id;}
inline void addStats(Stats* a) { commit( a ); }
public:
void setName( const char* nn );
inline const char* getName() const { return name ? name : ""; }
inline const char* getUnique() const { return unique ? unique : ""; }
inline int getPosition() const { return id; }
inline int updatePosition( Stats* points ) {
return parent->updatePos( this , points );
}
inline void MarkToDelete() {
this->score = (1<<31);
}
};
private:
RankStats* head;
RankStats* tail;
int rankNum;
struct scoreCalc{
AMX amx;
void* code;
int func;
cell amxAddr1;
cell amxAddr2;
cell *physAddr1;
cell *physAddr2;
} calc;
void put_before( RankStats* a, RankStats* ptr );
void put_after( RankStats* a, RankStats* ptr );
void unlink( RankStats* ptr );
int updatePos( RankStats* r , Stats* s );
public:
RankSystem();
~RankSystem();
void saveRank( const char* filename );
bool loadRank( const char* filename );
RankStats* findEntryInRank(const char* unique, const char* name );
RankStats* findEntryInRankByUnique(const char* unique);
RankStats* findEntryInRankByPos(int position);
//bool loadCalc(const char* filename, char* error);
inline int getRankNum( ) const { return rankNum; }
void clear();
//void unloadCalc();
class iterator {
RankStats* ptr;
public:
iterator(RankStats* a): ptr(a){}
inline iterator& operator--() { ptr = ptr->prev; return *this;}
inline iterator& operator++() { ptr = ptr->next; return *this; }
inline RankStats& operator*() { return *ptr;}
operator bool () { return (ptr != 0); }
};
inline iterator front() { return iterator(head); }
inline iterator begin() { return iterator(tail); }
};
#endif

View File

@ -0,0 +1,53 @@
========================================================================
WIN32 APPLICATION : WinCSX Project Overview
========================================================================
AppWizard has created this WinCSX application for you.
This file contains a summary of what you will find in each of the files that
make up your WinCSX application.
WinCSX.vcproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
WinCSX.cpp
This is the main application source file.
/////////////////////////////////////////////////////////////////////////////
AppWizard has created the following resources:
WinCSX.rc
This is a listing of all of the Microsoft Windows resources that the
program uses. It includes the icons, bitmaps, and cursors that are stored
in the RES subdirectory. This file can be directly edited in Microsoft
Visual C++.
Resource.h
This is the standard header file, which defines new resource IDs.
Microsoft Visual C++ reads and updates this file.
WinCSX.ico
This is an icon file, which is used as the application's icon (32x32).
This icon is included by the main resource file WinCSX.rc.
small.ico
This is an icon file, which contains a smaller version (16x16)
of the application's icon. This icon is included by the main resource
file WinCSX.rc.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named WinCSX.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,52 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by WinCSX.rc
//
#define IDC_MYICON 2
#define IDD_WINCSX_DIALOG 102
#define IDS_APP_TITLE 103
#define IDD_WINCSXBOX 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define IDI_WINCSX 107
#define IDI_SMALL 108
#define IDC_WINCSX 109
#define IDR_MAINFRAME 128
#define IDD_ABOUTBOX 129
#define IDC_LIST 1010
#define IDC_BUTTON_ABOUT 1029
#define IDC_ABOUT 1029
#define IDC_BUTTON_SAVECHANGES 1030
#define IDC_BUTTON_CLEARSTATS 1031
#define IDC_BUTTON_DELETE 1032
#define IDC_EDIT_NAME 1100
#define IDC_EDIT_POSITION 1101
#define IDC_EDIT_AUTHID 1102
#define IDC_EDIT_DAMAGE 1103
#define IDC_EDIT_FRAGS 1104
#define IDC_EDIT_DEATHS 1105
#define IDC_EDIT_TKS 1106
#define IDC_EDIT_SHOTS 1107
#define IDC_EDIT_HITS 1108
#define IDC_EDIT_HS 1109
#define IDC_EDIT_PLANTS 1110
#define IDC_EDIT_EXPLOSIONS 1111
#define IDC_EDIT_DEFUSIONS 1112
#define IDC_EDIT_DEFUSED 1113
#define IDC_AUTHOR 1114
#define ID_HELP_DIALOG 32771
#define IDM_FILE_DIALOG 32773
#define IDM_WINCSX 32774
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 32775
#define _APS_NEXT_CONTROL_VALUE 1033
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif

460
dlls/csx/source/WinCSX/WinCSX.cpp Executable file
View File

@ -0,0 +1,460 @@
// WinCSX.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "WinCSX.h"
#include <stdio.h>
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, g_szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_WINCSX, g_szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_WINCSX);
// Show the dialog box now.
DialogBox(hInst, (LPCTSTR)IDD_WINCSXBOX, g_hWnd, (DLGPROC)WinCSXBox);
// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;
}
//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
// COMMENTS:
//
// This function and its usage are only necessary if you want this code
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
// function that was added to Windows 95. It is important to call this function
// so that the application will get 'well formed' small icons associated
// with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = 0; // CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_WINCSX);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = (LPCTSTR)IDC_WINCSX;
wcex.lpszClassName = g_szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
return RegisterClassEx(&wcex);
}
//
// FUNCTION: InitInstance(HANDLE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
hInst = hInstance; // Store instance handle in our global variable
g_hWnd = CreateWindow(g_szWindowClass, g_szTitle, WS_DLGFRAME, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, hInstance, NULL); // WS_OVERLAPPED WS_MINIMIZE
if (!g_hWnd)
{
MessageBox(g_hWnd, "Failed to create main window!", "A caption", MB_OK);
return FALSE;
}
ShowWindow(g_hWnd, SW_SHOWMINNOACTIVE); // nCmdShow SW_SHOWNORMAL were rubbish. SW_SHOWMINNOACTIVE looks ok.
UpdateWindow(g_hWnd);
return TRUE;
}
bool LoadRankFromFile(HWND hDlg) {
if ( !g_rank.begin() )
{
if (!g_rank.loadRank(STATS_FILENAME)) {
MessageBox(hDlg, "File load failed! Make sure you have csstats.dat in the same directory as this executable. Exiting...", "Where IS that file of yours?", MB_OK);
PostQuitMessage(0);
return false;
}
}
return true;
}
//
// FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
// PURPOSE: Processes messages for the main window.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
//int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
void UpdateListBox(HWND hDlg) {
HWND listbox = GetDlgItem(hDlg, IDC_LIST);
// Clear first if there's anything in here already
SendMessage(listbox, LB_RESETCONTENT, NULL, NULL);
if (g_rank.front() == NULL) {
MessageBox(hDlg, "The stats file is empty", "Emptiness...", MB_OK);
return;
}
// This part copies the occurring authids into the lefthand listbox.
int index = 10, len = 0;
char tempbuffer[1024];
for (RankSystem::iterator b = g_rank.front(); b; --b) {
//if ((*b).getPosition() < 1) // umm... naaah!
//continue;
_snprintf(tempbuffer, 1023, "%s", (*b).getName());
SendMessage( // returns LRESULT in lResult
listbox, // handle to destination control
LB_ADDSTRING, // message ID
0, // = (WPARAM) () wParam;
(LPARAM) tempbuffer // = (LPARAM) () lParam;
);
}
}
LRESULT InitWinCSXBox(HWND hDlg) {
// Load the stats
if (!LoadRankFromFile(hDlg))
return TRUE;
UpdateListBox(hDlg);
return TRUE;
}
void ClearStatsfields(HWND hDlg) {
SetDlgItemText(hDlg, IDC_EDIT_POSITION, "");
SetDlgItemText(hDlg, IDC_EDIT_NAME, "");
SetDlgItemText(hDlg, IDC_EDIT_AUTHID, "");
SetDlgItemText(hDlg, IDC_EDIT_FRAGS, "");
SetDlgItemText(hDlg, IDC_EDIT_DEATHS, "");
SetDlgItemText(hDlg, IDC_EDIT_HS, "");
SetDlgItemText(hDlg, IDC_EDIT_TKS, "");
SetDlgItemText(hDlg, IDC_EDIT_SHOTS, "");
SetDlgItemText(hDlg, IDC_EDIT_HITS, "");
SetDlgItemText(hDlg, IDC_EDIT_DAMAGE, "");
SetDlgItemText(hDlg, IDC_EDIT_PLANTS, "");
SetDlgItemText(hDlg, IDC_EDIT_EXPLOSIONS, "");
SetDlgItemText(hDlg, IDC_EDIT_DEFUSIONS, "");
SetDlgItemText(hDlg, IDC_EDIT_DEFUSED, "");
}
void ListboxItemSelected(HWND hDlg) {
HWND hwndList = GetDlgItem(hDlg, IDC_LIST); // Get the handle of the listbox
LRESULT nItem = SendMessage(hwndList, LB_GETCURSEL, 0, 0); // Get the item # that's selected. First item is prolly 0...
if (nItem == LB_ERR) {
// Error, reset the form items...
//MessageBox(hDlg, "Error: Couldn't find the selected record in the listbox!", "Oh fiddlesticks!", MB_OK);
ClearStatsfields(hDlg);
return;
}
// Retrieve complete stats record of this position. Position in listbox should be same as rank in our records!
RankSystem::RankStats* stats = g_rank.findEntryInRankByPos((int)nItem + 1);
if (stats == NULL) {
char msg[] = "Error: Couldn't find the record by position! (nItem = %d)";
sprintf(msg, msg, nItem);
MessageBox(hDlg, msg, "Oh fiddlesticks!", MB_OK);
ClearStatsfields(hDlg);
return;
}
// Copy data into form
SetDlgItemInt(hDlg, IDC_EDIT_POSITION, stats->getPosition(), 0);
SetDlgItemText(hDlg, IDC_EDIT_NAME, stats->getName());
SetDlgItemText(hDlg, IDC_EDIT_AUTHID, stats->getUnique());
SetDlgItemInt(hDlg, IDC_EDIT_FRAGS, stats->kills, 0);
SetDlgItemInt(hDlg, IDC_EDIT_DEATHS, stats->deaths, 0);
SetDlgItemInt(hDlg, IDC_EDIT_HS, stats->hs, 0);
SetDlgItemInt(hDlg, IDC_EDIT_TKS, stats->tks, 0);
SetDlgItemInt(hDlg, IDC_EDIT_SHOTS, stats->shots, 0);
SetDlgItemInt(hDlg, IDC_EDIT_HITS, stats->hits, 0);
SetDlgItemInt(hDlg, IDC_EDIT_DAMAGE, stats->damage, 0);
SetDlgItemInt(hDlg, IDC_EDIT_PLANTS, stats->bPlants, 0);
SetDlgItemInt(hDlg, IDC_EDIT_EXPLOSIONS, stats->bExplosions, 0);
SetDlgItemInt(hDlg, IDC_EDIT_DEFUSIONS, stats->bDefusions, 0);
SetDlgItemInt(hDlg, IDC_EDIT_DEFUSED, stats->bDefused, 0);
}
void SaveChanges(HWND hDlg) {
BOOL success;
int position = GetDlgItemInt(hDlg, IDC_EDIT_POSITION, &success, false);
if (!success)
goto BadEnd;
char authid[32]; // "primary key"
GetDlgItemText(hDlg, IDC_EDIT_AUTHID, authid, sizeof(authid));
RankSystem::RankStats* entry = g_rank.findEntryInRankByUnique(authid);
if (!entry) {
char buffer[256];
sprintf(buffer, "Authid %s not found!", authid);
MessageBox(hDlg, buffer, "Update failed", MB_OK);
return;
}
char name[32];
GetDlgItemText(hDlg, IDC_EDIT_NAME, name, sizeof(name));
int frags = GetDlgItemInt(hDlg, IDC_EDIT_FRAGS, &success, false);
if (!success)
goto BadEnd;
int deaths = GetDlgItemInt(hDlg, IDC_EDIT_DEATHS, &success, false);
if (!success)
goto BadEnd;
int hs = GetDlgItemInt(hDlg, IDC_EDIT_HS, &success, false);
if (!success)
goto BadEnd;
int tks = GetDlgItemInt(hDlg, IDC_EDIT_TKS, &success, false);
if (!success)
goto BadEnd;
int shots = GetDlgItemInt(hDlg, IDC_EDIT_SHOTS, &success, false);
if (!success)
goto BadEnd;
int hits = GetDlgItemInt(hDlg, IDC_EDIT_HITS, &success, false);
if (!success)
goto BadEnd;
int damage = GetDlgItemInt(hDlg, IDC_EDIT_DAMAGE, &success, false);
if (!success)
goto BadEnd;
int plants = GetDlgItemInt(hDlg, IDC_EDIT_PLANTS, &success, false);
if (!success)
goto BadEnd;
int explosions = GetDlgItemInt(hDlg, IDC_EDIT_EXPLOSIONS, &success, false);
if (!success)
goto BadEnd;
int defusions = GetDlgItemInt(hDlg, IDC_EDIT_DEFUSIONS, &success, false);
if (!success)
goto BadEnd;
int defused = GetDlgItemInt(hDlg, IDC_EDIT_DEFUSED, &success, false);
if (!success)
goto BadEnd;
// Update stats in memory
entry->setName(name);
entry->kills = frags;
entry->deaths = deaths;
entry->hs = hs;
entry->tks = tks;
entry->shots = shots;
entry->hits = hits;
entry->damage = damage;
entry->bPlants = plants;
entry->bExplosions = explosions;
entry->bDefusions = defusions;
entry->bDefused = defused;
int newPosition = entry->updatePosition(NULL); // Updates rank (prolly just calculates "frags - deaths" and moves up/down in rank)
g_rank.saveRank(STATS_FILENAME); // Save changes to file
// Now update our listbox
UpdateListBox(hDlg);
char buffer[256];
_snprintf(buffer, 255, "New rank of %s: %d", name, newPosition);
MessageBox(hDlg, buffer, "Update succeeded", MB_OK);
// In the listbox, we need to reselect the item we just updated. Use the new name.
HWND listbox = GetDlgItem(hDlg, IDC_LIST);
if (SendMessage(listbox, LB_SELECTSTRING, newPosition - 1, (LPARAM)name) == LB_ERR)
MessageBox(hDlg, "Error selecting item!", "Oh fiddlesticks!", MB_OK);
else {
// Update
ListboxItemSelected(hDlg);
}
return;
BadEnd:
MessageBox(hDlg, "Update failed", "Oh fiddlesticks!", MB_OK);
}
void ClearStats(HWND hDlg) {
if (MessageBox(hDlg, "Are you sure? If you continue the whole csstats.dat will be wiped out!", "Omg!", MB_OKCANCEL | MB_DEFBUTTON2 | MB_ICONWARNING) != IDOK)
return;
g_rank.clear();
g_rank.saveRank(STATS_FILENAME);
// Now update our listbox
UpdateListBox(hDlg);
// Update
ListboxItemSelected(hDlg);
}
void DeleteRecord(HWND hDlg) {
if (MessageBox(hDlg, "Are you sure?", "Omg!", MB_OKCANCEL | MB_DEFBUTTON2 | MB_ICONWARNING) != IDOK)
return;
BOOL success;
int position = GetDlgItemInt(hDlg, IDC_EDIT_POSITION, &success, false);
if (!success)
goto BadEnd;
char authid[32]; // "primary key"
GetDlgItemText(hDlg, IDC_EDIT_AUTHID, authid, sizeof(authid));
RankSystem::RankStats* entry = g_rank.findEntryInRankByUnique(authid);
if (!entry) {
char buffer[256];
sprintf(buffer, "Authid %s not found!", authid);
MessageBox(hDlg, buffer, "Update failed", MB_OK);
return;
}
// Mark this record to delete it.
entry->MarkToDelete();
// Save ranks from memory to disk.
g_rank.saveRank(STATS_FILENAME); // Save changes to file
// Clear memory.
g_rank.clear();
// Reload from disk into memory.
LoadRankFromFile(hDlg);
// Update list box.
UpdateListBox(hDlg);
MessageBox(hDlg, "Deleted record", "Delete succeeded", MB_OK);
return;
BadEnd:
MessageBox(hDlg, "Delete failed", "Oh fiddlesticks!", MB_OK);
return;
}
// Message handler for WinCSXBox.
LRESULT CALLBACK WinCSXBox(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
return InitWinCSXBox(hDlg); // load all data from file and fill the listbox with the shit
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
case IDCANCEL:
EndDialog(hDlg, LOWORD(wParam));
PostQuitMessage(0);
return TRUE;
case IDC_LIST:
switch (HIWORD(wParam))
{
case LBN_SELCHANGE:
// Omg omg, a line in linebox was selected.
ListboxItemSelected(hDlg);
return TRUE;
}
break;
case IDC_ABOUT:
DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hDlg, (DLGPROC)AboutBox);
break;
case IDC_BUTTON_SAVECHANGES:
SaveChanges(hDlg);
break;
case IDC_BUTTON_CLEARSTATS:
ClearStats(hDlg);
break;
case IDC_BUTTON_DELETE:
DeleteRecord(hDlg);
//DialogBox(hInst, (LPCTSTR)IDD_DELETEBOX, hDlg, (DLGPROC)DeleteBox);
break;
}
break;
}
return FALSE;
}
// Message handler for AboutBox.
LRESULT CALLBACK AboutBox(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
case IDCANCEL:
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}

25
dlls/csx/source/WinCSX/WinCSX.h Executable file
View File

@ -0,0 +1,25 @@
#pragma once
#include "resource.h"
#include "CRank.h"
// Constants
#define MAX_LOADSTRING 100
#define VERSION "0.2"
#define STATS_FILENAME "csstats.dat"
// Global Variables:
HINSTANCE hInst; // current instance
TCHAR g_szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR g_szWindowClass[MAX_LOADSTRING]; // the main window class name
RankSystem g_rank;
HWND g_hWnd;
// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK WinCSXBox(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK AboutBox(HWND, UINT, WPARAM, LPARAM);
bool LoadRankFromFile(HWND hDlg);

BIN
dlls/csx/source/WinCSX/WinCSX.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

216
dlls/csx/source/WinCSX/WinCSX.rc Executable file
View File

@ -0,0 +1,216 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Swedish resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SVE)
#ifdef _WIN32
LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_WINCSX ICON "WinCSX.ico"
IDI_SMALL ICON "small.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDC_WINCSX MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "WinCSX", IDM_WINCSX
MENUITEM "E&xit", IDM_EXIT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDC_WINCSX ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT
"/", IDM_ABOUT, ASCII, ALT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_WINCSXBOX DIALOGEX 22, 17, 253, 204
STYLE DS_ABSALIGN | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "WinCSX"
FONT 8, "System", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "Close",IDOK,206,168,39,27,WS_GROUP
LISTBOX IDC_LIST,4,5,94,190,LBS_HASSTRINGS |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_EDIT_NAME,109,18,87,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_POSITION,206,18,39,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_AUTHID,109,48,87,12,ES_AUTOHSCROLL |
ES_READONLY
EDITTEXT IDC_EDIT_DAMAGE,206,48,39,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_FRAGS,109,78,40,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_DEATHS,157,78,40,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_TKS,206,78,39,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_SHOTS,109,108,40,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_HITS,157,108,40,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_HS,206,108,39,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_PLANTS,109,138,40,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_EXPLOSIONS,157,137,40,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_DEFUSIONS,206,137,39,12,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_DEFUSED,109,168,40,12,ES_AUTOHSCROLL
LTEXT "Name (last used)",IDC_STATIC,109,5,56,8
LTEXT "Damage",IDC_STATIC,206,35,28,8
LTEXT "Frags",IDC_STATIC,109,65,20,8
LTEXT "Headshots",IDC_STATIC,206,95,36,8
LTEXT "Team kills",IDC_STATIC,206,65,35,8
LTEXT "Hits",IDC_STATIC,157,95,14,8
LTEXT "Shots",IDC_STATIC,109,95,20,8
LTEXT "Deaths",IDC_STATIC,157,65,24,8
LTEXT "Authid",IDC_STATIC,109,35,21,8
LTEXT "Position",IDC_STATIC,206,5,28,8
LTEXT "Plants",IDC_STATIC,109,125,22,8
LTEXT "Explosions",IDC_STATIC,157,125,38,8
LTEXT "Defused",IDC_STATIC,109,155,28,8
LTEXT "Defusions",IDC_STATIC,206,125,34,8
PUSHBUTTON "About",IDC_ABOUT,109,185,40,10
PUSHBUTTON "Save",IDC_BUTTON_SAVECHANGES,157,155,39,8
PUSHBUTTON "Clear stats",IDC_BUTTON_CLEARSTATS,157,168,39,27
PUSHBUTTON "Delete",IDC_BUTTON_DELETE,206,155,39,8
END
IDD_ABOUTBOX DIALOGEX 0, 0, 186, 95
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "About"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,109,68,50,14
LTEXT "WinCSX 0.3",IDC_STATIC,18,20,66,8
LTEXT "By JGHG",IDC_STATIC,18,28,66,8
LTEXT "2005",IDC_STATIC,18,36,66,8
LTEXT "http://www.amxmodx.org/",IDC_STATIC,18,44,88,8
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_WINCSXBOX, DIALOG
BEGIN
LEFTMARGIN, 4
RIGHTMARGIN, 248
VERTGUIDE, 98
VERTGUIDE, 109
VERTGUIDE, 157
VERTGUIDE, 196
VERTGUIDE, 206
VERTGUIDE, 245
TOPMARGIN, 5
BOTTOMMARGIN, 195
HORZGUIDE, 18
HORZGUIDE, 35
HORZGUIDE, 48
HORZGUIDE, 65
HORZGUIDE, 78
HORZGUIDE, 95
HORZGUIDE, 108
HORZGUIDE, 125
HORZGUIDE, 137
HORZGUIDE, 155
HORZGUIDE, 163
HORZGUIDE, 168
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_APP_TITLE "WinCSX"
IDC_WINCSX "WINCSX"
END
#endif // Swedish resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,187 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="WinCSX"
ProjectGUID="{39A1E5DD-81A1-441D-B99A-E50A01DB05D7}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="3"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/WinCSX.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/WinCSX.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<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="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="4"
UsePrecompiledHeader="3"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/WinCSX.exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<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;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\stdafx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
<File
RelativePath=".\WinCSX.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\Resource.h">
</File>
<File
RelativePath=".\stdafx.h">
</File>
<File
RelativePath=".\WinCSX.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
<File
RelativePath=".\small.ico">
</File>
<File
RelativePath=".\WinCSX.ico">
</File>
<File
RelativePath=".\WinCSX.rc">
</File>
</Filter>
<Filter
Name="Dependencies"
Filter="">
<File
RelativePath=".\amxxmodule.cpp">
</File>
<File
RelativePath=".\amxxmodule.h">
</File>
<File
RelativePath=".\CRank.cpp">
</File>
<File
RelativePath=".\CRank.h">
</File>
<File
RelativePath=".\moduleconfig.h">
</File>
</Filter>
<File
RelativePath=".\ReadMe.txt">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,462 @@
// Configuration
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
// Module info
#define MODULE_NAME "CSX"
#define MODULE_VERSION "1.00"
#define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org/"
#define MODULE_LOGTAG "CSX"
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
#define MODULE_RELOAD_ON_MAPCHANGE
#ifdef __DATE__
#define MODULE_DATE __DATE__
#else // __DATE__
#define MODULE_DATE "Unknown"
#endif // __DATE__
// metamod plugin?
//#define USE_METAMOD
// - AMXX Init functions
// Also consider using FN_META_*
// AMXX query
//#define FN_AMXX_QUERY OnAmxxQuery
// AMXX attach
// Do native functions init here (MF_AddNatives)
//#define FN_AMXX_ATTACH OnAmxxAttach
// AMXX detach
//#define FN_AMXX_DETACH OnAmxxDetach
// All plugins loaded
// Do forward functions init here (MF_RegisterForward)
//#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded
/**** METAMOD ****/
// If your module doesn't use metamod, you may close the file now :)
#ifdef USE_METAMOD
// ----
// Hook Functions
// Uncomment these to be called
// You can also change the function name
// - Metamod init functions
// Also consider using FN_AMXX_*
// Meta query
//#define FN_META_QUERY OnMetaQuery
// Meta attach
//#define FN_META_ATTACH OnMetaAttach
// Meta detach
//#define FN_META_DETACH OnMetaDetach
// (wd) are Will Day's notes
// - GetEntityAPI2 functions
// #define FN_GameDLLInit GameDLLInit /* pfnGameInit() */
// #define FN_DispatchSpawn DispatchSpawn /* pfnSpawn() */
// #define FN_DispatchThink DispatchThink /* pfnThink() */
// #define FN_DispatchUse DispatchUse /* pfnUse() */
// #define FN_DispatchTouch DispatchTouch /* pfnTouch() */
// #define FN_DispatchBlocked DispatchBlocked /* pfnBlocked() */
// #define FN_DispatchKeyValue DispatchKeyValue /* pfnKeyValue() */
// #define FN_DispatchSave DispatchSave /* pfnSave() */
// #define FN_DispatchRestore DispatchRestore /* pfnRestore() */
// #define FN_DispatchObjectCollsionBox DispatchObjectCollsionBox /* pfnSetAbsBox() */
// #define FN_SaveWriteFields SaveWriteFields /* pfnSaveWriteFields() */
// #define FN_SaveReadFields SaveReadFields /* pfnSaveReadFields() */
// #define FN_SaveGlobalState SaveGlobalState /* pfnSaveGlobalState() */
// #define FN_RestoreGlobalState RestoreGlobalState /* pfnRestoreGlobalState() */
// #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */
// #define FN_ClientConnect ClientConnect /* pfnClientConnect() (wd) Client has connected */
//#define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */
//#define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */
// #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
// #define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */
//#define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
// #define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */
// #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */
// #define FN_StartFrame StartFrame /* pfnStartFrame() */
// #define FN_ParmsNewLevel ParmsNewLevel /* pfnParmsNewLevel() */
// #define FN_ParmsChangeLevel ParmsChangeLevel /* pfnParmsChangeLevel() */
// #define FN_GetGameDescription GetGameDescription /* pfnGetGameDescription() Returns string describing current .dll. E.g. "TeamFotrress 2" "Half-Life" */
// #define FN_PlayerCustomization PlayerCustomization /* pfnPlayerCustomization() Notifies .dll of new customization for player. */
// #define FN_SpectatorConnect SpectatorConnect /* pfnSpectatorConnect() Called when spectator joins server */
// #define FN_SpectatorDisconnect SpectatorDisconnect /* pfnSpectatorDisconnect() Called when spectator leaves the server */
// #define FN_SpectatorThink SpectatorThink /* pfnSpectatorThink() Called when spectator sends a command packet (usercmd_t) */
// #define FN_Sys_Error Sys_Error /* pfnSys_Error() Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint. SDK2 */
// #define FN_PM_Move PM_Move /* pfnPM_Move() (wd) SDK2 */
// #define FN_PM_Init PM_Init /* pfnPM_Init() Server version of player movement initialization; (wd) SDK2 */
// #define FN_PM_FindTextureType PM_FindTextureType /* pfnPM_FindTextureType() (wd) SDK2 */
// #define FN_SetupVisibility SetupVisibility /* pfnSetupVisibility() Set up PVS and PAS for networking for this client; (wd) SDK2 */
// #define FN_UpdateClientData UpdateClientData /* pfnUpdateClientData() Set up data sent only to specific client; (wd) SDK2 */
// #define FN_AddToFullPack AddToFullPack /* pfnAddToFullPack() (wd) SDK2 */
// #define FN_CreateBaseline CreateBaseline /* pfnCreateBaseline() Tweak entity baseline for network encoding allows setup of player baselines too.; (wd) SDK2 */
// #define FN_RegisterEncoders RegisterEncoders /* pfnRegisterEncoders() Callbacks for network encoding; (wd) SDK2 */
// #define FN_GetWeaponData GetWeaponData /* pfnGetWeaponData() (wd) SDK2 */
// #define FN_CmdStart CmdStart /* pfnCmdStart() (wd) SDK2 */
// #define FN_CmdEnd CmdEnd /* pfnCmdEnd() (wd) SDK2 */
// #define FN_ConnectionlessPacket ConnectionlessPacket /* pfnConnectionlessPacket() (wd) SDK2 */
// #define FN_GetHullBounds GetHullBounds /* pfnGetHullBounds() (wd) SDK2 */
// #define FN_CreateInstancedBaselines CreateInstancedBaselines /* pfnCreateInstancedBaselines() (wd) SDK2 */
// #define FN_InconsistentFile InconsistentFile /* pfnInconsistentFile() (wd) SDK2 */
// #define FN_AllowLagCompensation AllowLagCompensation /* pfnAllowLagCompensation() (wd) SDK2 */
// - GetEntityAPI2_Post functions
// #define FN_GameDLLInit_Post GameDLLInit_Post
// #define FN_DispatchSpawn_Post DispatchSpawn_Post
// #define FN_DispatchThink_Post DispatchThink_Post
// #define FN_DispatchUse_Post DispatchUse_Post
// #define FN_DispatchTouch_Post DispatchTouch_Post
// #define FN_DispatchBlocked_Post DispatchBlocked_Post
// #define FN_DispatchKeyValue_Post DispatchKeyValue_Post
// #define FN_DispatchSave_Post DispatchSave_Post
// #define FN_DispatchRestore_Post DispatchRestore_Post
// #define FN_DispatchObjectCollsionBox_Post DispatchObjectCollsionBox_Post
// #define FN_SaveWriteFields_Post SaveWriteFields_Post
// #define FN_SaveReadFields_Post SaveReadFields_Post
// #define FN_SaveGlobalState_Post SaveGlobalState_Post
// #define FN_RestoreGlobalState_Post RestoreGlobalState_Post
// #define FN_ResetGlobalState_Post ResetGlobalState_Post
//#define FN_ClientConnect_Post ClientConnect_Post
// #define FN_ClientDisconnect_Post ClientDisconnect_Post
// #define FN_ClientKill_Post ClientKill_Post
//#define FN_ClientPutInServer_Post ClientPutInServer_Post
// #define FN_ClientCommand_Post ClientCommand_Post
//#define FN_ClientUserInfoChanged_Post ClientUserInfoChanged_Post
//#define FN_ServerActivate_Post ServerActivate_Post
// #define FN_ServerDeactivate_Post ServerDeactivate_Post
//#define FN_PlayerPreThink_Post PlayerPreThink_Post
// #define FN_PlayerPostThink_Post PlayerPostThink_Post
//#define FN_StartFrame_Post StartFrame_Post
// #define FN_ParmsNewLevel_Post ParmsNewLevel_Post
// #define FN_ParmsChangeLevel_Post ParmsChangeLevel_Post
// #define FN_GetGameDescription_Post GetGameDescription_Post
// #define FN_PlayerCustomization_Post PlayerCustomization_Post
// #define FN_SpectatorConnect_Post SpectatorConnect_Post
// #define FN_SpectatorDisconnect_Post SpectatorDisconnect_Post
// #define FN_SpectatorThink_Post SpectatorThink_Post
// #define FN_Sys_Error_Post Sys_Error_Post
// #define FN_PM_Move_Post PM_Move_Post
// #define FN_PM_Init_Post PM_Init_Post
// #define FN_PM_FindTextureType_Post PM_FindTextureType_Post
// #define FN_SetupVisibility_Post SetupVisibility_Post
// #define FN_UpdateClientData_Post UpdateClientData_Post
// #define FN_AddToFullPack_Post AddToFullPack_Post
// #define FN_CreateBaseline_Post CreateBaseline_Post
// #define FN_RegisterEncoders_Post RegisterEncoders_Post
// #define FN_GetWeaponData_Post GetWeaponData_Post
// #define FN_CmdStart_Post CmdStart_Post
// #define FN_CmdEnd_Post CmdEnd_Post
// #define FN_ConnectionlessPacket_Post ConnectionlessPacket_Post
// #define FN_GetHullBounds_Post GetHullBounds_Post
// #define FN_CreateInstancedBaselines_Post CreateInstancedBaselines_Post
// #define FN_InconsistentFile_Post InconsistentFile_Post
// #define FN_AllowLagCompensation_Post AllowLagCompensation_Post
// - GetEngineAPI functions
// #define FN_PrecacheModel PrecacheModel
// #define FN_PrecacheSound PrecacheSound
// #define FN_SetModel SetModel
// #define FN_ModelIndex ModelIndex
// #define FN_ModelFrames ModelFrames
// #define FN_SetSize SetSize
// #define FN_ChangeLevel ChangeLevel
// #define FN_GetSpawnParms GetSpawnParms
// #define FN_SaveSpawnParms SaveSpawnParms
// #define FN_VecToYaw VecToYaw
// #define FN_VecToAngles VecToAngles
// #define FN_MoveToOrigin MoveToOrigin
// #define FN_ChangeYaw ChangeYaw
// #define FN_ChangePitch ChangePitch
// #define FN_FindEntityByString FindEntityByString
// #define FN_GetEntityIllum GetEntityIllum
// #define FN_FindEntityInSphere FindEntityInSphere
// #define FN_FindClientInPVS FindClientInPVS
// #define FN_EntitiesInPVS EntitiesInPVS
// #define FN_MakeVectors MakeVectors
// #define FN_AngleVectors AngleVectors
// #define FN_CreateEntity CreateEntity
// #define FN_RemoveEntity RemoveEntity
// #define FN_CreateNamedEntity CreateNamedEntity
// #define FN_MakeStatic MakeStatic
// #define FN_EntIsOnFloor EntIsOnFloor
// #define FN_DropToFloor DropToFloor
// #define FN_WalkMove WalkMove
// #define FN_SetOrigin SetOrigin
// #define FN_EmitSound EmitSound
// #define FN_EmitAmbientSound EmitAmbientSound
// #define FN_TraceLine TraceLine
// #define FN_TraceToss TraceToss
// #define FN_TraceMonsterHull TraceMonsterHull
// #define FN_TraceHull TraceHull
// #define FN_TraceModel TraceModel
// #define FN_TraceTexture TraceTexture
// #define FN_TraceSphere TraceSphere
// #define FN_GetAimVector GetAimVector
// #define FN_ServerCommand ServerCommand
// #define FN_ServerExecute ServerExecute
// #define FN_engClientCommand engClientCommand
// #define FN_ParticleEffect ParticleEffect
// #define FN_LightStyle LightStyle
// #define FN_DecalIndex DecalIndex
// #define FN_PointContents PointContents
// #define FN_MessageBegin MessageBegin
// #define FN_MessageEnd MessageEnd
// #define FN_WriteByte WriteByte
// #define FN_WriteChar WriteChar
// #define FN_WriteShort WriteShort
// #define FN_WriteLong WriteLong
// #define FN_WriteAngle WriteAngle
// #define FN_WriteCoord WriteCoord
// #define FN_WriteString WriteString
// #define FN_WriteEntity WriteEntity
// #define FN_CVarRegister CVarRegister
// #define FN_CVarGetFloat CVarGetFloat
// #define FN_CVarGetString CVarGetString
// #define FN_CVarSetFloat CVarSetFloat
// #define FN_CVarSetString CVarSetString
// #define FN_AlertMessage AlertMessage
// #define FN_EngineFprintf EngineFprintf
// #define FN_PvAllocEntPrivateData PvAllocEntPrivateData
// #define FN_PvEntPrivateData PvEntPrivateData
// #define FN_FreeEntPrivateData FreeEntPrivateData
// #define FN_SzFromIndex SzFromIndex
// #define FN_AllocString AllocString
// #define FN_GetVarsOfEnt GetVarsOfEnt
// #define FN_PEntityOfEntOffset PEntityOfEntOffset
// #define FN_EntOffsetOfPEntity EntOffsetOfPEntity
// #define FN_IndexOfEdict IndexOfEdict
// #define FN_PEntityOfEntIndex PEntityOfEntIndex
// #define FN_FindEntityByVars FindEntityByVars
// #define FN_GetModelPtr GetModelPtr
// #define FN_RegUserMsg RegUserMsg
// #define FN_AnimationAutomove AnimationAutomove
// #define FN_GetBonePosition GetBonePosition
// #define FN_FunctionFromName FunctionFromName
// #define FN_NameForFunction NameForFunction
// #define FN_ClientPrintf ClientPrintf
// #define FN_ServerPrint ServerPrint
// #define FN_Cmd_Args Cmd_Args
// #define FN_Cmd_Argv Cmd_Argv
// #define FN_Cmd_Argc Cmd_Argc
// #define FN_GetAttachment GetAttachment
// #define FN_CRC32_Init CRC32_Init
// #define FN_CRC32_ProcessBuffer CRC32_ProcessBuffer
// #define FN_CRC32_ProcessByte CRC32_ProcessByte
// #define FN_CRC32_Final CRC32_Final
// #define FN_RandomLong RandomLong
// #define FN_RandomFloat RandomFloat
// #define FN_SetView SetView
// #define FN_Time Time
// #define FN_CrosshairAngle CrosshairAngle
// #define FN_LoadFileForMe LoadFileForMe
// #define FN_FreeFile FreeFile
// #define FN_EndSection EndSection
// #define FN_CompareFileTime CompareFileTime
// #define FN_GetGameDir GetGameDir
// #define FN_Cvar_RegisterVariable Cvar_RegisterVariable
// #define FN_FadeClientVolume FadeClientVolume
// #define FN_SetClientMaxspeed SetClientMaxspeed
// #define FN_CreateFakeClient CreateFakeClient
// #define FN_RunPlayerMove RunPlayerMove
// #define FN_NumberOfEntities NumberOfEntities
// #define FN_GetInfoKeyBuffer GetInfoKeyBuffer
// #define FN_InfoKeyValue InfoKeyValue
// #define FN_SetKeyValue SetKeyValue
// #define FN_SetClientKeyValue SetClientKeyValue
// #define FN_IsMapValid IsMapValid
// #define FN_StaticDecal StaticDecal
// #define FN_PrecacheGeneric PrecacheGeneric
// #define FN_GetPlayerUserId GetPlayerUserId
// #define FN_BuildSoundMsg BuildSoundMsg
// #define FN_IsDedicatedServer IsDedicatedServer
// #define FN_CVarGetPointer CVarGetPointer
// #define FN_GetPlayerWONId GetPlayerWONId
// #define FN_Info_RemoveKey Info_RemoveKey
// #define FN_GetPhysicsKeyValue GetPhysicsKeyValue
// #define FN_SetPhysicsKeyValue SetPhysicsKeyValue
// #define FN_GetPhysicsInfoString GetPhysicsInfoString
// #define FN_PrecacheEvent PrecacheEvent
// #define FN_PlaybackEvent PlaybackEvent
// #define FN_SetFatPVS SetFatPVS
// #define FN_SetFatPAS SetFatPAS
// #define FN_CheckVisibility CheckVisibility
// #define FN_DeltaSetField DeltaSetField
// #define FN_DeltaUnsetField DeltaUnsetField
// #define FN_DeltaAddEncoder DeltaAddEncoder
// #define FN_GetCurrentPlayer GetCurrentPlayer
// #define FN_CanSkipPlayer CanSkipPlayer
// #define FN_DeltaFindField DeltaFindField
// #define FN_DeltaSetFieldByIndex DeltaSetFieldByIndex
// #define FN_DeltaUnsetFieldByIndex DeltaUnsetFieldByIndex
// #define FN_SetGroupMask SetGroupMask
// #define FN_engCreateInstancedBaseline engCreateInstancedBaseline
// #define FN_Cvar_DirectSet Cvar_DirectSet
// #define FN_ForceUnmodified ForceUnmodified
// #define FN_GetPlayerStats GetPlayerStats
// #define FN_AddServerCommand AddServerCommand
// #define FN_Voice_GetClientListening Voice_GetClientListening
// #define FN_Voice_SetClientListening Voice_SetClientListening
// #define FN_GetPlayerAuthId GetPlayerAuthId
// - GetEngineAPI_Post functions
// #define FN_PrecacheModel_Post PrecacheModel_Post
// #define FN_PrecacheSound_Post PrecacheSound_Post
//#define FN_SetModel_Post SetModel_Post
// #define FN_ModelIndex_Post ModelIndex_Post
// #define FN_ModelFrames_Post ModelFrames_Post
// #define FN_SetSize_Post SetSize_Post
// #define FN_ChangeLevel_Post ChangeLevel_Post
// #define FN_GetSpawnParms_Post GetSpawnParms_Post
// #define FN_SaveSpawnParms_Post SaveSpawnParms_Post
// #define FN_VecToYaw_Post VecToYaw_Post
// #define FN_VecToAngles_Post VecToAngles_Post
// #define FN_MoveToOrigin_Post MoveToOrigin_Post
// #define FN_ChangeYaw_Post ChangeYaw_Post
// #define FN_ChangePitch_Post ChangePitch_Post
// #define FN_FindEntityByString_Post FindEntityByString_Post
// #define FN_GetEntityIllum_Post GetEntityIllum_Post
// #define FN_FindEntityInSphere_Post FindEntityInSphere_Post
// #define FN_FindClientInPVS_Post FindClientInPVS_Post
// #define FN_EntitiesInPVS_Post EntitiesInPVS_Post
// #define FN_MakeVectors_Post MakeVectors_Post
// #define FN_AngleVectors_Post AngleVectors_Post
// #define FN_CreateEntity_Post CreateEntity_Post
// #define FN_RemoveEntity_Post RemoveEntity_Post
// #define FN_CreateNamedEntity_Post CreateNamedEntity_Post
// #define FN_MakeStatic_Post MakeStatic_Post
// #define FN_EntIsOnFloor_Post EntIsOnFloor_Post
// #define FN_DropToFloor_Post DropToFloor_Post
// #define FN_WalkMove_Post WalkMove_Post
// #define FN_SetOrigin_Post SetOrigin_Post
//#define FN_EmitSound_Post EmitSound_Post
// #define FN_EmitAmbientSound_Post EmitAmbientSound_Post
//#define FN_TraceLine_Post TraceLine_Post
// #define FN_TraceToss_Post TraceToss_Post
// #define FN_TraceMonsterHull_Post TraceMonsterHull_Post
// #define FN_TraceHull_Post TraceHull_Post
// #define FN_TraceModel_Post TraceModel_Post
// #define FN_TraceTexture_Post TraceTexture_Post
// #define FN_TraceSphere_Post TraceSphere_Post
// #define FN_GetAimVector_Post GetAimVector_Post
// #define FN_ServerCommand_Post ServerCommand_Post
// #define FN_ServerExecute_Post ServerExecute_Post
// #define FN_engClientCommand_Post engClientCommand_Post
// #define FN_ParticleEffect_Post ParticleEffect_Post
// #define FN_LightStyle_Post LightStyle_Post
// #define FN_DecalIndex_Post DecalIndex_Post
// #define FN_PointContents_Post PointContents_Post
//#define FN_MessageBegin_Post MessageBegin_Post
//#define FN_MessageEnd_Post MessageEnd_Post
//#define FN_WriteByte_Post WriteByte_Post
//#define FN_WriteChar_Post WriteChar_Post
//#define FN_WriteShort_Post WriteShort_Post
//#define FN_WriteLong_Post WriteLong_Post
//#define FN_WriteAngle_Post WriteAngle_Post
//#define FN_WriteCoord_Post WriteCoord_Post
//#define FN_WriteString_Post WriteString_Post
//#define FN_WriteEntity_Post WriteEntity_Post
// #define FN_CVarRegister_Post CVarRegister_Post
// #define FN_CVarGetFloat_Post CVarGetFloat_Post
// #define FN_CVarGetString_Post CVarGetString_Post
// #define FN_CVarSetFloat_Post CVarSetFloat_Post
// #define FN_CVarSetString_Post CVarSetString_Post
// #define FN_AlertMessage_Post AlertMessage_Post
// #define FN_EngineFprintf_Post EngineFprintf_Post
// #define FN_PvAllocEntPrivateData_Post PvAllocEntPrivateData_Post
// #define FN_PvEntPrivateData_Post PvEntPrivateData_Post
// #define FN_FreeEntPrivateData_Post FreeEntPrivateData_Post
// #define FN_SzFromIndex_Post SzFromIndex_Post
// #define FN_AllocString_Post AllocString_Post
// #define FN_GetVarsOfEnt_Post GetVarsOfEnt_Post
// #define FN_PEntityOfEntOffset_Post PEntityOfEntOffset_Post
// #define FN_EntOffsetOfPEntity_Post EntOffsetOfPEntity_Post
// #define FN_IndexOfEdict_Post IndexOfEdict_Post
// #define FN_PEntityOfEntIndex_Post PEntityOfEntIndex_Post
// #define FN_FindEntityByVars_Post FindEntityByVars_Post
// #define FN_GetModelPtr_Post GetModelPtr_Post
//#define FN_RegUserMsg_Post RegUserMsg_Post
// #define FN_AnimationAutomove_Post AnimationAutomove_Post
// #define FN_GetBonePosition_Post GetBonePosition_Post
// #define FN_FunctionFromName_Post FunctionFromName_Post
// #define FN_NameForFunction_Post NameForFunction_Post
// #define FN_ClientPrintf_Post ClientPrintf_Post
// #define FN_ServerPrint_Post ServerPrint_Post
// #define FN_Cmd_Args_Post Cmd_Args_Post
// #define FN_Cmd_Argv_Post Cmd_Argv_Post
// #define FN_Cmd_Argc_Post Cmd_Argc_Post
// #define FN_GetAttachment_Post GetAttachment_Post
// #define FN_CRC32_Init_Post CRC32_Init_Post
// #define FN_CRC32_ProcessBuffer_Post CRC32_ProcessBuffer_Post
// #define FN_CRC32_ProcessByte_Post CRC32_ProcessByte_Post
// #define FN_CRC32_Final_Post CRC32_Final_Post
// #define FN_RandomLong_Post RandomLong_Post
// #define FN_RandomFloat_Post RandomFloat_Post
// #define FN_SetView_Post SetView_Post
// #define FN_Time_Post Time_Post
// #define FN_CrosshairAngle_Post CrosshairAngle_Post
// #define FN_LoadFileForMe_Post LoadFileForMe_Post
// #define FN_FreeFile_Post FreeFile_Post
// #define FN_EndSection_Post EndSection_Post
// #define FN_CompareFileTime_Post CompareFileTime_Post
// #define FN_GetGameDir_Post GetGameDir_Post
// #define FN_Cvar_RegisterVariable_Post Cvar_RegisterVariable_Post
// #define FN_FadeClientVolume_Post FadeClientVolume_Post
// #define FN_SetClientMaxspeed_Post SetClientMaxspeed_Post
// #define FN_CreateFakeClient_Post CreateFakeClient_Post
// #define FN_RunPlayerMove_Post RunPlayerMove_Post
// #define FN_NumberOfEntities_Post NumberOfEntities_Post
// #define FN_GetInfoKeyBuffer_Post GetInfoKeyBuffer_Post
// #define FN_InfoKeyValue_Post InfoKeyValue_Post
// #define FN_SetKeyValue_Post SetKeyValue_Post
// #define FN_SetClientKeyValue_Post SetClientKeyValue_Post
// #define FN_IsMapValid_Post IsMapValid_Post
// #define FN_StaticDecal_Post StaticDecal_Post
// #define FN_PrecacheGeneric_Post PrecacheGeneric_Post
// #define FN_GetPlayerUserId_Post GetPlayerUserId_Post
// #define FN_BuildSoundMsg_Post BuildSoundMsg_Post
// #define FN_IsDedicatedServer_Post IsDedicatedServer_Post
// #define FN_CVarGetPointer_Post CVarGetPointer_Post
// #define FN_GetPlayerWONId_Post GetPlayerWONId_Post
// #define FN_Info_RemoveKey_Post Info_RemoveKey_Post
// #define FN_GetPhysicsKeyValue_Post GetPhysicsKeyValue_Post
// #define FN_SetPhysicsKeyValue_Post SetPhysicsKeyValue_Post
// #define FN_GetPhysicsInfoString_Post GetPhysicsInfoString_Post
// #define FN_PrecacheEvent_Post PrecacheEvent_Post
// #define FN_PlaybackEvent_Post PlaybackEvent_Post
// #define FN_SetFatPVS_Post SetFatPVS_Post
// #define FN_SetFatPAS_Post SetFatPAS_Post
// #define FN_CheckVisibility_Post CheckVisibility_Post
// #define FN_DeltaSetField_Post DeltaSetField_Post
// #define FN_DeltaUnsetField_Post DeltaUnsetField_Post
// #define FN_DeltaAddEncoder_Post DeltaAddEncoder_Post
// #define FN_GetCurrentPlayer_Post GetCurrentPlayer_Post
// #define FN_CanSkipPlayer_Post CanSkipPlayer_Post
// #define FN_DeltaFindField_Post DeltaFindField_Post
// #define FN_DeltaSetFieldByIndex_Post DeltaSetFieldByIndex_Post
// #define FN_DeltaUnsetFieldByIndex_Post DeltaUnsetFieldByIndex_Post
// #define FN_SetGroupMask_Post SetGroupMask_Post
// #define FN_engCreateInstancedBaseline_Post engCreateInstancedBaseline_Post
// #define FN_Cvar_DirectSet_Post Cvar_DirectSet_Post
// #define FN_ForceUnmodified_Post ForceUnmodified_Post
// #define FN_GetPlayerStats_Post GetPlayerStats_Post
// #define FN_AddServerCommand_Post AddServerCommand_Post
// #define FN_Voice_GetClientListening_Post Voice_GetClientListening_Post
// #define FN_Voice_SetClientListening_Post Voice_SetClientListening_Post
// #define FN_GetPlayerAuthId_Post GetPlayerAuthId_Post
// #define FN_OnFreeEntPrivateData OnFreeEntPrivateData
// #define FN_GameShutdown GameShutdown
// #define FN_ShouldCollide ShouldCollide
// #define FN_OnFreeEntPrivateData_Post OnFreeEntPrivateData_Post
// #define FN_GameShutdown_Post GameShutdown_Post
// #define FN_ShouldCollide_Post ShouldCollide_Post
#endif // USE_METAMOD
#endif // __MODULECONFIG_H__

BIN
dlls/csx/source/WinCSX/small.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// WinCSX.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

20
dlls/csx/source/WinCSX/stdafx.h Executable file
View File

@ -0,0 +1,20 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here
//#include "CRank.h"
//#include "amx.h"

View File

@ -2648,7 +2648,7 @@ 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, ...) void MF_LogError(AMX *amx, int err, const char *fmt, ...)
@ -2660,7 +2660,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...)
vsprintf(msg, fmt, arglst); vsprintf(msg, fmt, arglst);
va_end(arglst); va_end(arglst);
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg); g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_LOGTAG, msg);
} }

View File

@ -48,6 +48,8 @@ int gmsgSendAudio;
int gmsgTextMsg; int gmsgTextMsg;
int gmsgBarTime; int gmsgBarTime;
int g_CurrentMsg;
cvar_t init_csstats_maxsize ={"csstats_maxsize","3500", 0 , 3500.0 }; cvar_t init_csstats_maxsize ={"csstats_maxsize","3500", 0 , 3500.0 };
cvar_t init_csstats_reset ={"csstats_reset","0"}; cvar_t init_csstats_reset ={"csstats_reset","0"};
cvar_t init_csstats_rank ={"csstats_rank","0"}; cvar_t init_csstats_rank ={"csstats_rank","0"};
@ -162,7 +164,7 @@ void ServerDeactivate() {
// clear custom weapons info // clear custom weapons info
for ( i=MAX_WEAPONS;i<MAX_WEAPONS+MAX_CWEAPONS;i++) for ( i=MAX_WEAPONS;i<MAX_WEAPONS+MAX_CWEAPONS;i++)
weaponData[i].ammoSlot = 0; weaponData[i].used = false;
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
@ -211,11 +213,12 @@ void MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict_t
mPlayerIndex = 0; mPlayerIndex = 0;
mPlayer = 0; mPlayer = 0;
} }
mState = 0; mState = 0;
if ( msg_type < 0 || msg_type >= MAX_REG_MSGS ) g_CurrentMsg = msg_type;
msg_type = 0; if ( g_CurrentMsg < 0 || g_CurrentMsg >= MAX_REG_MSGS )
function=modMsgs[msg_type]; g_CurrentMsg = 0;
endfunction=modMsgsEnd[msg_type]; function=modMsgs[g_CurrentMsg];
endfunction=modMsgsEnd[g_CurrentMsg];
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
@ -332,7 +335,6 @@ void TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *
} }
void OnMetaAttach() { void OnMetaAttach() {
CVAR_REGISTER (&init_csstats_maxsize); CVAR_REGISTER (&init_csstats_maxsize);
CVAR_REGISTER (&init_csstats_reset); CVAR_REGISTER (&init_csstats_reset);
CVAR_REGISTER (&init_csstats_rank); CVAR_REGISTER (&init_csstats_rank);

View File

@ -5,7 +5,7 @@
// Module info // Module info
#define MODULE_NAME "CSX" #define MODULE_NAME "CSX"
#define MODULE_VERSION "0.20" #define MODULE_VERSION "1.01"
#define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org/" #define MODULE_URL "http://www.amxmodx.org/"
#define MODULE_LOGTAG "CSX" #define MODULE_LOGTAG "CSX"
@ -459,4 +459,4 @@
#endif // USE_METAMOD #endif // USE_METAMOD
#endif // __MODULECONFIG_H__ #endif // __MODULECONFIG_H__

View File

@ -3,6 +3,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "csx", "csx.vcproj", "{1DC4A
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinCSX", "..\WinCSX\WinCSX.vcproj", "{39A1E5DD-81A1-441D-B99A-E50A01DB05D7}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfiguration) = preSolution GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug Debug = Debug
@ -13,6 +17,10 @@ Global
{1DC4A99A-F23F-4AAE-881C-79D157C91155}.Debug.Build.0 = Debug|Win32 {1DC4A99A-F23F-4AAE-881C-79D157C91155}.Debug.Build.0 = Debug|Win32
{1DC4A99A-F23F-4AAE-881C-79D157C91155}.Release.ActiveCfg = Release|Win32 {1DC4A99A-F23F-4AAE-881C-79D157C91155}.Release.ActiveCfg = Release|Win32
{1DC4A99A-F23F-4AAE-881C-79D157C91155}.Release.Build.0 = Release|Win32 {1DC4A99A-F23F-4AAE-881C-79D157C91155}.Release.Build.0 = Release|Win32
{39A1E5DD-81A1-441D-B99A-E50A01DB05D7}.Debug.ActiveCfg = Debug|Win32
{39A1E5DD-81A1-441D-B99A-E50A01DB05D7}.Debug.Build.0 = Debug|Win32
{39A1E5DD-81A1-441D-B99A-E50A01DB05D7}.Release.ActiveCfg = Release|Win32
{39A1E5DD-81A1-441D-B99A-E50A01DB05D7}.Release.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection EndGlobalSection

View File

@ -188,7 +188,7 @@ static cell AMX_NATIVE_CALL get_user_stats2(AMX *amx, cell *params) /* 3 param *
return 0; return 0;
} }
static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 3 param */ static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 7 param */
{ {
int index = params[1] + 1; int index = params[1] + 1;
@ -208,6 +208,8 @@ static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 3 param */
cpStats[7] = (*a).getPosition(); cpStats[7] = (*a).getPosition();
MF_SetAmxString(amx,params[4],(*a).getName(),params[5]); MF_SetAmxString(amx,params[4],(*a).getName(),params[5]);
if (params[6] > 0)
MF_SetAmxString(amx, params[6], (*a).getUnique(), params[7]);
for(int i = 1; i < 8; ++i) for(int i = 1; i < 8; ++i)
cpBodyHits[i] = (*a).bodyHits[i]; cpBodyHits[i] = (*a).bodyHits[i];
return --a ? index : 0; return --a ? index : 0;
@ -217,7 +219,7 @@ static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 3 param */
return 0; return 0;
} }
static cell AMX_NATIVE_CALL get_stats2(AMX *amx, cell *params) /* 3 param */ static cell AMX_NATIVE_CALL get_stats2(AMX *amx, cell *params) /* 4 param */
{ {
int index = params[1] + 1; int index = params[1] + 1;
@ -225,6 +227,8 @@ static cell AMX_NATIVE_CALL get_stats2(AMX *amx, cell *params) /* 3 param */
for(RankSystem::iterator a = g_rank.front(); a ;--a){ for(RankSystem::iterator a = g_rank.front(); a ;--a){
if ((*a).getPosition() == index) { if ((*a).getPosition() == index) {
cell *cpStats = MF_GetAmxAddr(amx,params[2]); cell *cpStats = MF_GetAmxAddr(amx,params[2]);
if (params[4] > 0)
MF_SetAmxString(amx, params[3], (*a).getUnique(), params[4]);
cpStats[0] = (*a).bDefusions; cpStats[0] = (*a).bDefusions;
cpStats[1] = (*a).bDefused; cpStats[1] = (*a).bDefused;

View File

@ -7,12 +7,14 @@ int damage;
int TA; int TA;
int weapon; int weapon;
int aim; int aim;
bool ignore;
CPlayer *pAttacker; CPlayer *pAttacker;
void Client_ResetHUD(void* mValue){ void Client_ResetHUD(void* mValue){
if ( mPlayer ) if ( mPlayer ){
mPlayer->clearStats = gpGlobals->time + 0.25f; mPlayer->clearStats = gpGlobals->time + 0.25f;
}
} }
void Client_WeaponList(void* mValue){ void Client_WeaponList(void* mValue){
@ -50,22 +52,30 @@ void Client_Damage(void* mValue){
static int bits; static int bits;
switch (mState++) { switch (mState++) {
case 1: case 1:
ignore = false;
damage = *(int*)mValue; damage = *(int*)mValue;
break; break;
case 2: case 2:
bits = *(int*)mValue; bits = *(int*)mValue;
break; break;
case 3: case 3:
if (!mPlayer || !damage || !*(float*)mValue || bits) break; if (!mPlayer || !damage || bits){
ignore = true;
break;
}
edict_t *enemy; edict_t *enemy;
enemy = mPlayer->pEdict->v.dmg_inflictor; enemy = mPlayer->pEdict->v.dmg_inflictor;
if ( FNullEnt( enemy ) ) if ( FNullEnt( enemy ) ){
ignore = true;
break; break;
}
aim = 0; aim = 0;
weapon = 0; weapon = 0;
pAttacker = NULL; pAttacker = NULL;
if (enemy->v.flags & (FL_CLIENT | FL_FAKECLIENT) ) { if (enemy->v.flags & (FL_CLIENT | FL_FAKECLIENT) ) {
pAttacker = GET_PLAYER_POINTER(enemy); pAttacker = GET_PLAYER_POINTER(enemy);
aim = pAttacker->aiming; aim = pAttacker->aiming;
@ -81,7 +91,7 @@ void Client_Damage(void* mValue){
} }
void Client_Damage_End(void* mValue){ void Client_Damage_End(void* mValue){
if ( !mPlayer || !damage ) if ( ignore )
return; return;
if ( !pAttacker ) pAttacker = mPlayer; if ( !pAttacker ) pAttacker = mPlayer;
@ -203,4 +213,5 @@ void Client_BarTime(void* mValue){
g_Defuser = mPlayerIndex; g_Defuser = mPlayerIndex;
g_bombAnnounce = BOMB_DEFUSING; g_bombAnnounce = BOMB_DEFUSING;
} }
} }

300
dlls/csx_sql/CMisc.cpp Executable file
View File

@ -0,0 +1,300 @@
#include "CMisc.h"
#include "rank.h"
// *****************************************************
// class Grenades
// *****************************************************
void Grenades::put( edict_t* grenade, float time, int type, CPlayer* player )
{
Obj* a = new Obj;
if ( a == 0 ) return;
a->player = player;
a->grenade = grenade;
a->time = gpGlobals->time + time;
a->type = type;
a->prev = 0;
a->next = head;
if ( head ) head->prev = a;
head = a;
}
bool Grenades::find( edict_t* enemy, CPlayer** p, int* type )
{
bool found = false;
Obj* a = head;
while ( a ){
if ( a->time > gpGlobals->time && !found ) {
if ( a->grenade == enemy ) {
found = true;
*p = a->player;
*type = a->type;
}
}
else {
Obj* next = a->next;
if (a->prev) a->prev->next = next;
else head = next;
if (next) next->prev = a->prev;
delete a;
a = next;
continue;
}
a = a->next;
}
return found;
}
void Grenades::clear()
{
while(head){
Obj* a = head->next;
delete head;
head = a;
}
}
// *****************************************************
// class CPlayer
// *****************************************************
void CPlayer::Disconnect(){
if ( ignoreBots(pEdict) || !isModuleActive() ) // ignore if he is bot and bots rank is disabled or module is paused
return;
rank->updatePosition( &life );
rank = 0;
}
void CPlayer::PutInServer(){
if ( ignoreBots(pEdict) )
return;
restartStats();
const char* name = STRING(pEdict->v.netname);
const char* unique = name;
switch((int)csstats_rank->value) {
case 1:
if ( (unique = GETPLAYERAUTHID(pEdict)) == 0 )
unique = name; // failed to get authid
break;
case 2:
unique = ip;
}
rank = g_rank.findEntryInRank( unique , name );
}
void CPlayer::Connect(const char* address ){
bot = IsBot();
strcpy(ip,address);
rank = 0;
clearStats = 0.0f;
}
void CPlayer::restartStats(bool all)
{
if ( all ) memset(weapons,0,sizeof(weapons));
memset(weaponsRnd,0,sizeof(weaponsRnd)); //DEC-Weapon (Round) stats
memset(attackers,0,sizeof(attackers));
memset(victims,0,sizeof(victims));
memset(&life,0,sizeof(life));
}
void CPlayer::Init( int pi, edict_t* pe )
{
pEdict = pe;
index = pi;
current = 0;
clearStats = 0.0f;
rank = 0;
}
void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){
if ( ignoreBots(pEdict,pVictim->pEdict) )
return;
if ( pVictim->index == index ){ // killed self
pVictim->weapons[0].deaths++;
pVictim->life.deaths++;
pVictim->weaponsRnd[0].deaths++; // DEC-Weapon (round) stats
return;
}
pVictim->attackers[index].name = weaponData[wweapon].name;
pVictim->attackers[index].kills++;
pVictim->attackers[index].hs += hhs;
pVictim->attackers[index].tks += ttk;
pVictim->attackers[0].kills++;
pVictim->attackers[0].hs += hhs;
pVictim->attackers[0].tks += ttk;
pVictim->weapons[pVictim->current].deaths++;
pVictim->weapons[0].deaths++;
pVictim->life.deaths++;
pVictim->weaponsRnd[pVictim->current].deaths++; // DEC-Weapon (round) stats
pVictim->weaponsRnd[0].deaths++; // DEC-Weapon (round) stats
int vi = pVictim->index;
victims[vi].name = weaponData[wweapon].name;
victims[vi].deaths++;
victims[vi].hs += hhs;
victims[vi].tks += ttk;
victims[0].deaths++;
victims[0].hs += hhs;
victims[0].tks += ttk;
weaponsRnd[wweapon].kills++; // DEC-Weapon (round) stats
weaponsRnd[wweapon].hs += hhs; // DEC-Weapon (round) stats
weaponsRnd[wweapon].tks += ttk; // DEC-Weapon (round) stats
weaponsRnd[0].kills++; // DEC-Weapon (round) stats
weaponsRnd[0].hs += hhs; // DEC-Weapon (round) stats
weaponsRnd[0].tks += ttk; // DEC-Weapon (round) stats
weapons[wweapon].kills++;
weapons[wweapon].hs += hhs;
weapons[wweapon].tks += ttk;
weapons[0].kills++;
weapons[0].hs += hhs;
weapons[0].tks += ttk;
life.kills++;
life.hs += hhs;
life.tks += ttk;
}
void CPlayer::saveHit(CPlayer* pVictim, int wweapon, int ddamage, int bbody){
if ( ignoreBots(pEdict,pVictim->pEdict) )
return;
if ( index == pVictim->index ) return;
pVictim->attackers[index].hits++;
pVictim->attackers[index].damage += ddamage;
pVictim->attackers[index].bodyHits[bbody]++;
pVictim->attackers[0].hits++;
pVictim->attackers[0].damage += ddamage;
pVictim->attackers[0].bodyHits[bbody]++;
int vi = pVictim->index;
victims[vi].hits++;
victims[vi].damage += ddamage;
victims[vi].bodyHits[bbody]++;
victims[0].hits++;
victims[0].damage += ddamage;
victims[0].bodyHits[bbody]++;
weaponsRnd[wweapon].hits++; // DEC-Weapon (round) stats
weaponsRnd[wweapon].damage += ddamage; // DEC-Weapon (round) stats
weaponsRnd[wweapon].bodyHits[bbody]++; // DEC-Weapon (round) stats
weaponsRnd[0].hits++; // DEC-Weapon (round) stats
weaponsRnd[0].damage += ddamage; // DEC-Weapon (round) stats
weaponsRnd[0].bodyHits[bbody]++; // DEC-Weapon (round) stats
weapons[wweapon].hits++;
weapons[wweapon].damage += ddamage;
weapons[wweapon].bodyHits[bbody]++;
weapons[0].hits++;
weapons[0].damage += ddamage;
weapons[0].bodyHits[bbody]++;
life.hits++;
life.damage += ddamage;
life.bodyHits[bbody]++;
}
void CPlayer::saveShot(int weapon){
if ( ignoreBots(pEdict) )
return;
victims[0].shots++;
weapons[weapon].shots++;
weapons[0].shots++;
life.shots++;
weaponsRnd[weapon].shots++; // DEC-Weapon (round) stats
weaponsRnd[0].shots++; // DEC-Weapon (round) stats
}
void CPlayer::saveBPlant(){
life.bPlants++;
}
void CPlayer::saveBExplode(){
life.bExplosions++;
}
void CPlayer::saveBDefusing(){
life.bDefusions++;
}
void CPlayer::saveBDefused(){
life.bDefused++;
}
// *****************************************************
// class Forward
// *****************************************************
void Forward::put( AMX *a , int i ){
head = new AmxCall( a, i , head );
}
void Forward::clear(){
while ( head ) {
AmxCall* a = head->next;
delete head;
head = a;
}
}
void Forward::exec(int p1,int p2,int p3,int p4,int p5,int p6){
AmxCall* a = head;
while ( a ){
MF_AmxExec(a->amx, NULL, a->iFunctionIdx, 6,p1, p2, p3, p4, p5, p6);
a = a->next;
}
}
void Forward::exec(int p1,int p2,int p3,int p4,int p5){
AmxCall* a = head;
while ( a ){
MF_AmxExec(a->amx, NULL, a->iFunctionIdx, 5,p1, p2, p3, p4, p5);
a = a->next;
}
}
void Forward::exec(int p1,int p2){
AmxCall* a = head;
while ( a ){
MF_AmxExec(a->amx, NULL, a->iFunctionIdx, 2,p1, p2);
a = a->next;
}
}
// *****************************************************
bool ignoreBots (edict_t *pEnt, edict_t *pOther){
if ( !rankBots && ( pEnt->v.flags & FL_FAKECLIENT || ( pOther && pOther->v.flags & FL_FAKECLIENT ) ) )
return true;
return false;
}
bool isModuleActive(){
if ( !(int)CVAR_GET_FLOAT("csstats_pause") )
return true;
return false;
}

116
dlls/csx_sql/CMisc.h Executable file
View File

@ -0,0 +1,116 @@
#ifndef CMISC_H
#define CMISC_H
#include "amxxmodule.h"
#include "CRank.h"
#define MAX_CWEAPONS 6
#define CSW_HEGRENADE 4
#define CSW_C4 6
#define CSW_SMOKEGRENADE 9
#define CSW_FLASHBANG 25
// *****************************************************
// class CPlayer
// *****************************************************
struct CPlayer {
edict_t* pEdict;
char ip[32];
int index;
int aiming;
int current;
bool bot;
float clearStats;
RankSystem::RankStats* rank;
struct PlayerWeapon : Stats {
const char* name;
int ammo;
int clip;
};
PlayerWeapon weapons[MAX_WEAPONS+MAX_CWEAPONS];
PlayerWeapon attackers[33];
PlayerWeapon victims[33];
Stats weaponsRnd[MAX_WEAPONS+MAX_CWEAPONS]; // DEC-Weapon (Round) stats
Stats life;
int teamId;
void Init( int pi, edict_t* pe );
void Connect(const char* ip );
void PutInServer();
void Disconnect();
void saveKill(CPlayer* pVictim, int weapon, int hs, int tk);
void saveHit(CPlayer* pVictim, int weapon, int damage, int aiming);
void saveShot(int weapon);
void saveBPlant();
void saveBExplode();
void saveBDefusing();
void saveBDefused();
void restartStats(bool all = true);
inline bool IsBot(){
const char* auth= (*g_engfuncs.pfnGetPlayerAuthId)(pEdict);
return ( auth && !strcmp( auth , "BOT" ) );
}
inline bool IsAlive(){
return ((pEdict->v.deadflag==DEAD_NO)&&(pEdict->v.health>0));
}
};
// *****************************************************
// class Grenades
// *****************************************************
class Grenades
{
struct Obj
{
CPlayer* player;
edict_t* grenade;
float time;
int type;
Obj* next;
Obj* prev;
} *head;
public:
Grenades() { head = 0; }
~Grenades() { clear(); }
void put( edict_t* grenade, float time, int type, CPlayer* player );
bool find( edict_t* enemy, CPlayer** p, int* type );
void clear();
};
// *****************************************************
// class Forward
// *****************************************************
class Forward
{
struct AmxCall {
AMX *amx;
int iFunctionIdx;
AmxCall* next;
AmxCall( AMX *a , int i, AmxCall* n ): amx(a), iFunctionIdx(i), next(n) {}
} *head;
public:
Forward() { head = 0; }
~Forward() { clear(); }
void clear();
void put( AMX *a , int i );
void exec(int p1,int p2,int p3,int p4,int p5,int p6);
void exec(int p1,int p2,int p3,int p4,int p5);
void exec(int p1,int p2);
};
#endif // CMISC_H

306
dlls/csx_sql/CRank.cpp Executable file
View File

@ -0,0 +1,306 @@
#include "amxxmodule.h"
#include "CRank.h"
#include "rank.h"
// *****************************************************
// class Stats
// *****************************************************
Stats::Stats(){
hits = shots = damage = hs = tks = kills = deaths = bDefusions = bDefused = bPlants = bExplosions = 0;
memset( bodyHits , 0 ,sizeof( bodyHits ) );
}
void Stats::commit(Stats* a){
hits += a->hits;
shots += a->shots;
damage += a->damage;
hs += a->hs;
tks += a->tks;
kills += a->kills;
deaths += a->deaths;
bDefusions += a->bDefusions;
bDefused += a->bDefused;
bPlants += a->bPlants;
bExplosions += a->bExplosions;
for(int i = 1; i < 8; ++i)
bodyHits[i] += a->bodyHits[i];
}
// *****************************************************
// class RankSystem
// *****************************************************
RankSystem::RankStats::RankStats( const char* uu, const char* nn, RankSystem* pp ) {
name = 0;
namelen = 0;
unique = 0;
uniquelen = 0;
score = 0;
parent = pp;
id = ++parent->rankNum;
next = prev = 0;
setName( nn );
setUnique( uu );
}
RankSystem::RankStats::~RankStats() {
delete[] name;
delete[] unique;
--parent->rankNum;
}
void RankSystem::RankStats::setName( const char* nn ) {
delete[] name;
namelen = strlen(nn) + 1;
name = new char[namelen];
if ( name )
strcpy( name , nn );
else
namelen = 0;
}
void RankSystem::RankStats::setUnique( const char* nn ) {
delete[] unique;
uniquelen = strlen(nn) + 1;
unique = new char[uniquelen];
if ( unique )
strcpy( unique , nn );
else
uniquelen = 0;
}
RankSystem::RankSystem() {
head = 0;
tail = 0;
rankNum = 0;
calc.code = 0;
}
RankSystem::~RankSystem() {
clear();
}
void RankSystem::put_before( RankStats* a, RankStats* ptr ){
a->next = ptr;
if ( ptr ){
a->prev = ptr->prev;
ptr->prev = a;
}
else{
a->prev = head;
head = a;
}
if ( a->prev ) a->prev->next = a;
else tail = a;
}
void RankSystem::put_after( RankStats* a, RankStats* ptr ) {
a->prev = ptr;
if ( ptr ){
a->next = ptr->next;
ptr->next = a;
}
else{
a->next = tail;
tail = a;
}
if ( a->next ) a->next->prev = a;
else head = a;
}
void RankSystem::unlink( RankStats* ptr ){
if (ptr->prev) ptr->prev->next = ptr->next;
else tail = ptr->next;
if (ptr->next) ptr->next->prev = ptr->prev;
else head = ptr->prev;
}
void RankSystem::clear(){
while( tail ){
head = tail->next;
delete tail;
tail = head;
}
}
bool RankSystem::loadCalc(const char* filename, char* error)
{
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.amxAddr2, &calc.physAddr2)!=AMX_ERR_NONE)||
(MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){
LOG_CONSOLE( PLID, "Couldn't load plugin (file \"%s\")",filename);
MF_UnloadAmxScript(&calc.amx, &calc.code);
return false;
}
return true;
}
void RankSystem::unloadCalc()
{
MF_UnloadAmxScript(&calc.amx , &calc.code);
}
RankSystem::RankStats* RankSystem::findEntryInRank(const char* unique, const char* name )
{
RankStats* a = head;
while ( a )
{
if ( strcmp( a->getUnique() ,unique ) == 0 )
return a;
a = a->prev;
}
a = new RankStats( unique ,name,this );
if ( a == 0 ) return 0;
put_after( a , 0 );
return a;
}
void RankSystem::updatePos( RankStats* rr , Stats* s )
{
rr->addStats( s );
if ( calc.code ) {
calc.physAddr1[0] = rr->kills;
calc.physAddr1[1] = rr->deaths;
calc.physAddr1[2] = rr->hs;
calc.physAddr1[3] = rr->tks;
calc.physAddr1[4] = rr->shots;
calc.physAddr1[5] = rr->hits;
calc.physAddr1[6] = rr->damage;
calc.physAddr1[7] = rr->bDefusions;
calc.physAddr1[8] = rr->bDefused;
calc.physAddr1[9] = rr->bPlants;
calc.physAddr1[10] = rr->bExplosions;
for(int i = 1; i < 8; ++i)
calc.physAddr2[i] = rr->bodyHits[i];
cell result = 0;
int err;
if ((err = MF_AmxExec(&calc.amx,&result, calc.func ,2,calc.amxAddr1,calc.amxAddr2 )) != AMX_ERR_NONE)
LOG_CONSOLE( PLID, "Run time error %d on line %ld (plugin \"%s\")", err,calc.amx.curline,LOCALINFO("csstats_score"));
rr->score = result;
}
else rr->score = rr->kills - rr->deaths;
RankStats* aa = rr->next;
while ( aa && (aa->score <= rr->score) ) { // try to nominate
rr->goUp();
aa->goDown();
aa = aa->next; // go to next rank
}
if ( aa != rr->next )
{
unlink( rr );
put_before( rr, aa );
}
else
{
aa = rr->prev;
while ( aa && (aa->score > rr->score) ) { // go down
rr->goDown();
aa->goUp();
aa = aa->prev; // go to prev rank
}
if ( aa != rr->prev ){
unlink( rr );
put_after( rr, aa );
}
}
}
void RankSystem::loadRank( const char* filename )
{
FILE *bfp = fopen( filename , "rb" );
if ( !bfp ) return;
short int i = 0;
fread(&i, 1 , sizeof(short int) , bfp);
if (i == RANK_VERSION)
{
Stats d;
char unique[64], name[64];
fread(&i , 1, sizeof(short int), bfp);
while( i )
{
fread(name , i,sizeof(char) , bfp);
fread(&i , 1, sizeof(short int), bfp);
fread(unique , i,sizeof(char) , bfp);
fread(&d.tks, 1,sizeof(int), bfp);
fread(&d.damage, 1,sizeof(int), bfp);
fread(&d.deaths, 1,sizeof(int), bfp);
fread(&d.kills, 1,sizeof(int), bfp);
fread(&d.shots, 1,sizeof(int), bfp);
fread(&d.hits, 1,sizeof(int), bfp);
fread(&d.hs, 1,sizeof(int), bfp);
fread(&d.bDefusions, 1,sizeof(int), bfp);
fread(&d.bDefused, 1,sizeof(int), bfp);
fread(&d.bPlants, 1,sizeof(int), bfp);
fread(&d.bExplosions, 1,sizeof(int), bfp);
fread(d.bodyHits, 1,sizeof(d.bodyHits), bfp);
fread(&i , 1, sizeof(short int), bfp);
RankSystem::RankStats* a = findEntryInRank( unique , name );
if ( a ) a->updatePosition( &d );
}
}
fclose(bfp);
}
void RankSystem::saveRank( const char* filename )
{
FILE *bfp = fopen(filename, "wb");
if ( !bfp ) return;
short int i = RANK_VERSION;
fwrite(&i, 1, sizeof(short int) , bfp);
RankSystem::iterator a = front();
while ( a )
{
if ( (*a).score != (1<<31) ) // score must be different than mincell
{
fwrite( &(*a).namelen , 1, sizeof(short int), bfp);
fwrite( (*a).name , (*a).namelen , sizeof(char) , bfp);
fwrite( &(*a).uniquelen , 1, sizeof(short int), bfp);
fwrite( (*a).unique , (*a).uniquelen , sizeof(char) , bfp);
fwrite( &(*a).tks, 1, sizeof(int), bfp);
fwrite( &(*a).damage, 1, sizeof(int), bfp);
fwrite( &(*a).deaths, 1, sizeof(int), bfp);
fwrite( &(*a).kills, 1, sizeof(int), bfp);
fwrite( &(*a).shots, 1, sizeof(int), bfp);
fwrite( &(*a).hits, 1, sizeof(int), bfp);
fwrite( &(*a).hs, 1, sizeof(int), bfp);
fwrite( &(*a).bDefusions, 1, sizeof(int), bfp);
fwrite( &(*a).bDefused, 1, sizeof(int), bfp);
fwrite( &(*a).bPlants, 1, sizeof(int), bfp);
fwrite( &(*a).bExplosions, 1, sizeof(int), bfp);
fwrite( (*a).bodyHits, 1, sizeof((*a).bodyHits), bfp);
}
--a;
}
i = 0;
fwrite( &i , 1, sizeof(short int), bfp); // null terminator
fclose(bfp);
}

123
dlls/csx_sql/CRank.h Executable file
View File

@ -0,0 +1,123 @@
#ifndef CRANK_H
#define CRANK_H
#define RANK_VERSION 11
#include "amxxmodule.h"
// *****************************************************
// class Stats
// *****************************************************
struct Stats {
int hits;
int shots;
int damage;
int hs;
int tks;
int kills;
int deaths;
int bodyHits[9]; ////////////////////
// SiDLuke start
int bPlants;
int bExplosions;
int bDefusions;
int bDefused;
// SiDLuke end :D
Stats();
void commit(Stats* a);
};
// *****************************************************
// class RankSystem
// *****************************************************
class RankSystem
{
public:
class RankStats;
friend class RankStats;
class iterator;
class RankStats : public Stats {
friend class RankSystem;
friend class iterator;
RankSystem* parent;
RankStats* next;
RankStats* prev;
char* unique;
short int uniquelen;
char* name;
short int namelen;
int score;
int id;
RankStats( const char* uu, const char* nn, RankSystem* pp );
~RankStats();
void setUnique( const char* nn );
inline void goDown() {++id;}
inline void goUp() {--id;}
inline void addStats(Stats* a) { commit( a ); }
public:
void setName( const char* nn );
inline const char* getName() const { return name ? name : ""; }
inline const char* getUnique() const { return unique ? unique : ""; }
inline int getPosition() const { return id; }
inline void updatePosition( Stats* points ) {
parent->updatePos( this , points );
}
};
private:
RankStats* head;
RankStats* tail;
int rankNum;
struct scoreCalc{
AMX amx;
void* code;
int func;
cell amxAddr1;
cell amxAddr2;
cell *physAddr1;
cell *physAddr2;
} calc;
void put_before( RankStats* a, RankStats* ptr );
void put_after( RankStats* a, RankStats* ptr );
void unlink( RankStats* ptr );
void updatePos( RankStats* r , Stats* s );
public:
RankSystem();
~RankSystem();
void saveRank( const char* filename );
void saveRankSql(); // JGHG added this one
void loadRank( const char* filename );
RankStats* findEntryInRank(const char* unique, const char* name );
bool loadCalc(const char* filename, char* error);
inline int getRankNum( ) const { return rankNum; }
void clear();
void unloadCalc();
class iterator {
RankStats* ptr;
public:
iterator(RankStats* a): ptr(a){}
inline iterator& operator--() { ptr = ptr->prev; return *this;}
inline iterator& operator++() { ptr = ptr->next; return *this; }
inline RankStats& operator*() { return *ptr;}
operator bool () { return (ptr != 0); }
};
inline iterator front() { return iterator(head); }
inline iterator begin() { return iterator(tail); }
};
#endif

234
dlls/csx_sql/CRank_sql.cpp Executable file
View File

@ -0,0 +1,234 @@
// The good stuff: http://dev.mysql.com/doc/mysql/en/mysql_query.html
#include "amxxmodule.h"
#include "CRank.h"
#include "rank.h"
#ifndef __linux__
#define WINDOWS_LEAN_AND_MEAN
#include <winsock.h>
#endif
#include <mysql/mysql.h>
#include <mysql/errmsg.h>
#include <time.h>
#define MYSQL_QUERY_IS_A_OKAY 0
cvar_t init_csx_sqlstats_host = {"csx_sqlstats_host", "127.0.0.1", FCVAR_SPONLY | FCVAR_PROTECTED};
cvar_t init_csx_sqlstats_username = {"csx_sqlstats_username", "", FCVAR_SPONLY | FCVAR_PROTECTED};
cvar_t init_csx_sqlstats_password = {"csx_sqlstats_password", "", FCVAR_SPONLY | FCVAR_PROTECTED};
cvar_t init_csx_sqlstats_db = {"csx_sqlstats_db", "amxmodx_stats_cs", FCVAR_SPONLY | FCVAR_PROTECTED};
cvar_t init_csx_sqlstats_table = {"csx_sqlstats_table", "cs", FCVAR_SPONLY | FCVAR_PROTECTED};
cvar_t init_csx_sqlstats_exportstats = {"csx_sqlstats_exportstats", "0", FCVAR_SPONLY | FCVAR_PROTECTED};
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;
cvar_t *csx_sqlstats_exportstats;
void OnMetaAttach_sql() {
CVAR_REGISTER(&init_csx_sqlstats_host);
CVAR_REGISTER(&init_csx_sqlstats_username);
CVAR_REGISTER(&init_csx_sqlstats_password);
CVAR_REGISTER(&init_csx_sqlstats_db);
CVAR_REGISTER(&init_csx_sqlstats_table);
CVAR_REGISTER(&init_csx_sqlstats_exportstats);
csx_sqlstats_host = CVAR_GET_POINTER(init_csx_sqlstats_host.name);
csx_sqlstats_username = CVAR_GET_POINTER(init_csx_sqlstats_username.name);
csx_sqlstats_password = CVAR_GET_POINTER(init_csx_sqlstats_password.name);
csx_sqlstats_db = CVAR_GET_POINTER(init_csx_sqlstats_db.name);
csx_sqlstats_table = CVAR_GET_POINTER(init_csx_sqlstats_table.name);
csx_sqlstats_exportstats = CVAR_GET_POINTER(init_csx_sqlstats_exportstats.name);
}
int Error(MYSQL *mysql)
{
if (mysql == NULL)
return 0;
return mysql_errno(mysql);
}
void RankSystem::saveRankSql()
{
// Don't do anything if cvar says so.
if (csx_sqlstats_exportstats->value == 0.0)
return;
MF_PrintSrvConsole("[CSX Sql] Exporting players' statistics to SQL db...");
clock_t startTime = clock();
MYSQL *mysql = NULL;
mysql = mysql_init(NULL);
/* Attempt to get a port */
int port = 0;
char *p = strchr(csx_sqlstats_host->string, ':');
if (p)
port = atoi(p+1);
/*************************/
//MF_PrintSrvConsole("Host: %s (%d) Port: %d", host, strcspn(csx_sqlstats_host->string, ":"), port);
int error = 0;
if (!mysql_real_connect(mysql, csx_sqlstats_host->string, csx_sqlstats_username->string, csx_sqlstats_password->string, NULL, port, NULL, 0)) {
error = Error(mysql);
if (error) {
MF_Log("DB Connection failed (%d): %s", error, mysql_error(mysql));
mysql_close(mysql);
return;
}
}
if (mysql_select_db(mysql, csx_sqlstats_db->string) != 0) {
error = Error(mysql);
if (error) {
MF_Log("DB Select DB failed (%d): %s", error, mysql_error(mysql));
mysql_close(mysql);
return;
}
}
// Query
char query[2048];
snprintf(query, 2047, "CREATE TABLE IF NOT EXISTS `%s` (`timestamp` int(11) NOT NULL default '0', `stats_authid` varchar(100) NOT NULL default '', `stats_name` varchar(100) NOT NULL default '', `stats_tks` int(11) NOT NULL default '0', `stats_damage` int(11) NOT NULL default '0', `stats_deaths` int(11) NOT NULL default '0', `stats_frags` int(11) NOT NULL default '0', `stats_shots` int(11) NOT NULL default '0', `stats_hits` int(11) NOT NULL default '0', `stats_hs` int(11) NOT NULL default '0', `stats_defusions` int(11) NOT NULL default '0', `stats_defused` int(11) NOT NULL default '0', `stats_plants` int(11) NOT NULL default '0', `stats_explosions` int(11) NOT NULL default '0', `stats_bodyhits0` int(11) NOT NULL default '0', `stats_bodyhits1` int(11) NOT NULL default '0', `stats_bodyhits2` int(11) NOT NULL default '0', `stats_bodyhits3` int(11) NOT NULL default '0', `stats_bodyhits4` int(11) NOT NULL default '0', `stats_bodyhits5` int(11) NOT NULL default '0', `stats_bodyhits6` int(11) NOT NULL default '0', `stats_bodyhits7` int(11) NOT NULL default '0', `stats_bodyhits8` int(11) NOT NULL default '0', `stats_score` int(11) NOT NULL default '0') TYPE=MyISAM",
csx_sqlstats_table->string);
int queryResult = mysql_query(mysql, query);
if (queryResult != MYSQL_QUERY_IS_A_OKAY)
{
error = Error(mysql);
MF_Log("DB Query Create Table If Not Exists failed (%d): %s", error, mysql_error(mysql));
mysql_close(mysql);
return;
}
int exportedRecords = 0;
RankSystem::iterator a = front();
char *authid, *name;
int tks, damage, deaths, kills, shots, hits, hs, defusions, defused, plants, explosions, *bodyHits, score;
time_t now = time(NULL);
while ( a )
{
if ( (*a).score != (1<<31) ) // score must be different than mincell
{
authid = (*a).unique;
if (strcmp(authid, "BOT") == 0 || strcmp(authid, "STEAM_ID_PENDING") == 0) {
--a;
continue;
}
exportedRecords++;
name = (*a).name;
tks = (*a).tks;
damage = (*a).damage;
deaths = (*a).deaths;
kills = (*a).kills;
shots = (*a).shots;
hits = (*a).hits;
hs = (*a).hs;
defusions = (*a).bDefusions;
defused = (*a).bDefused;
plants = (*a).bPlants;
explosions = (*a).bExplosions;
bodyHits = ((*a).bodyHits);
score = (*a).score;
snprintf(query, 2047, "UPDATE `%s` SET `timestamp` = %d, `stats_name` = \"%s\", `stats_tks` = \"%d\", `stats_damage` = \"%d\", `stats_deaths` = \"%d\", `stats_frags` = \"%d\", `stats_shots` = \"%d\", `stats_hits` = \"%d\", `stats_hs` = \"%d\", `stats_defusions` = \"%d\", `stats_defused` = \"%d\", `stats_plants` = \"%d\", `stats_explosions` = \"%d\", `stats_bodyhits0` = \"%d\", `stats_bodyhits1` = \"%d\", `stats_bodyhits2` = \"%d\", `stats_bodyhits3` = \"%d\", `stats_bodyhits4` = \"%d\", `stats_bodyhits5` = \"%d\", `stats_bodyhits6` = \"%d\", `stats_bodyhits7` = \"%d\", `stats_bodyhits8` = \"%d\", `stats_score` = \"%d\" WHERE `stats_authid` = \"%s\" LIMIT 1",
csx_sqlstats_table->string,
now,
name,
tks,
damage,
deaths,
kills,
shots,
hits,
hs,
defusions,
defused,
plants,
explosions,
bodyHits[0],
bodyHits[1],
bodyHits[2],
bodyHits[3],
bodyHits[4],
bodyHits[5],
bodyHits[6],
bodyHits[7],
bodyHits[8],
score,
authid);
//
int queryResult = mysql_query(mysql, query);
if (queryResult != MYSQL_QUERY_IS_A_OKAY)
{
error = Error(mysql);
MF_Log("DB Query Update failed (%d): %s", error, mysql_error(mysql));
mysql_close(mysql);
return;
}
if (mysql_affected_rows(mysql) == 0) {
// New player, do insert
snprintf(query, 2047, "INSERT INTO `%s` (`timestamp`, `stats_authid`, `stats_name`, `stats_tks`, `stats_damage`, `stats_deaths`, `stats_frags`, `stats_shots`, `stats_hits`, `stats_hs`, `stats_defusions`, `stats_defused`, `stats_plants`, `stats_explosions`, `stats_bodyhits0`, `stats_bodyhits1`, `stats_bodyhits2`, `stats_bodyhits3`, `stats_bodyhits4`, `stats_bodyhits5`, `stats_bodyhits6`, `stats_bodyhits7`, `stats_bodyhits8`, `stats_score`) VALUES (\"%d\", \"%s\", \"%s\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\")",
csx_sqlstats_table->string,
now,
authid,
name,
tks,
damage,
deaths,
kills,
shots,
hits,
hs,
defusions,
defused,
plants,
explosions,
bodyHits[0],
bodyHits[1],
bodyHits[2],
bodyHits[3],
bodyHits[4],
bodyHits[5],
bodyHits[6],
bodyHits[7],
bodyHits[8],
score
);
int queryResult = mysql_query(mysql, query);
if (queryResult != MYSQL_QUERY_IS_A_OKAY)
{
error = Error(mysql);
MF_Log("DB Query Insert failed (%d): %s", error, mysql_error(mysql));
mysql_close(mysql);
return;
}
}
}
--a;
}
// Disconnect
mysql_close(mysql);
clock_t stopTime = clock();
MF_PrintSrvConsole("...done! (exported %d records in %.2f seconds)\n", exportedRecords, (double)(stopTime - startTime) / (double)CLOCKS_PER_SEC);
}

404
dlls/csx_sql/CString.h Executable file
View File

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

444
dlls/csx_sql/CVector.h Executable file
View File

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

102
dlls/csx_sql/Makefile Executable file
View File

@ -0,0 +1,102 @@
MODNAME = csx_amxx
SRCFILES = amxxmodule.cpp CMisc.cpp CRank.cpp meta_api.cpp rank.cpp usermsg.cpp
EXTRA_LIBS_LINUX =
EXTRA_LIBS_WIN32 =
EXTRA_LIBDIRS_LINUX = -Lextra/lib_linux
EXTRA_LIBDIRS_WIN32 = -Lextra/lib_win32
EXTRA_INCLUDEDIRS = -Iextra/include -I../amx
EXTRA_FLAGS = -Dstrcmpi=strcasecmp
AMXDIR=../amx
SDKSRC=../sdk
METADIR=../metamod
OBJDIR_LINUX=obj.linux
OBJDIR_WIN32=obj.win32
SRCDIR=.
ifdef windir
OS=WIN32
else
OS=LINUX
endif
CC_LINUX=gcc
ifeq "$(OS)" "WIN32"
CC_WIN32=gcc
LD_WINDLL=dllwrap
DEFAULT=win32
CLEAN=clean_win32
else
CC_WIN32=/usr/local/cross-tools/i386-mingw32msvc/bin/gcc
LD_WINDLL=/usr/local/cross-tools/bin/i386-mingw32msvc-dllwrap
DEFAULT=linux win32
CLEAN=clean_both
endif
LIBFILE_LINUX = $(MODNAME)_i386.so
LIBFILE_WIN32 = $(MODNAME).dll
TARGET_LINUX = $(OBJDIR_LINUX)/$(LIBFILE_LINUX)
TARGET_WIN32 = $(OBJDIR_WIN32)/$(LIBFILE_WIN32)
FILES_ALL = *.cpp *.h [A-Z]* *.rc
ifeq "$(OS)" "LINUX"
ASRCFILES := $(shell ls -t $(SRCFILES))
else
ASRCFILES := $(shell dir /b)
endif
OBJ_LINUX := $(SRCFILES:%.cpp=$(OBJDIR_LINUX)/%.o)
OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o)
CCOPT = -march=i586 -O6 -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
-malign-jumps=2 -malign-functions=2 -s -DNDEBUG
INCLUDEDIRS=-I../curl/include -I$(SRCDIR) -I$(AMXDIR) -I$(METADIR) -I$(SDKSRC)/engine -I$(SDKSRC)/common -I$(SDKSRC)/dlls -I$(SDKSRC) $(EXTRA_INCLUDEDIRS)
CFLAGS=-Wall -Wno-unknown-pragmas
ODEF = -DOPT_TYPE=\"optimized\"
CFLAGS:=$(CCOPT) $(CFLAGS) $(ODEF) $(EXTRA_FLAGS)
DO_CC_LINUX=$(CC_LINUX) $(CFLAGS) -fPIC $(INCLUDEDIRS) -o $@ -c $<
DO_CC_WIN32=$(CC_WIN32) $(CFLAGS) $(INCLUDEDIRS) -o $@ -c $<
LINK_LINUX=$(CC_LINUX) $(CFLAGS) -shared -ldl -lm $(OBJ_LINUX) $(EXTRA_LIBDIRS_LINUX) $(EXTRA_LIBS_LINUX) -o $@
LINK_WIN32=$(LD_WINDLL) -mwindows --add-stdcall-alias $(OBJ_WIN32) $(EXTRA_LIBDIRS_WIN32) $(EXTRA_LIBS_WIN32) -o $@
$(OBJDIR_LINUX)/%.o: $(SRCDIR)/%.cpp
$(DO_CC_LINUX)
$(OBJDIR_WIN32)/%.o: $(SRCDIR)/%.cpp
$(DO_CC_WIN32)
default: $(DEFAULT)
$(TARGET_LINUX): $(OBJDIR_LINUX) $(OBJ_LINUX)
$(LINK_LINUX)
$(TARGET_WIN32): $(OBJDIR_WIN32) $(OBJ_WIN32)
$(LINK_WIN32)
$(OBJDIR_LINUX):
mkdir $@
$(OBJDIR_WIN32):
mkdir $@
win32: $(TARGET_WIN32)
linux: $(TARGET_LINUX)
clean: $(CLEAN)
clean_both:
-rm -f $(OBJDIR_LINUX)/*
-rm -f $(OBJDIR_WIN32)/*
clean_win32:
del /q $(OBJDIR_WIN32)

178
dlls/csx_sql/Makefile.pl Executable file
View File

@ -0,0 +1,178 @@
#!/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 = "csx_amxx";
$sdk = "../../../hlsdk/SourceCode";
$mm = "../../../metamod/metamod";
$gccf = "gcc";
@CPP_SOURCE_FILES = ("amxxmodule.cpp", "CMisc.cpp", "usermsg.cpp", "meta_api.cpp", "rank.cpp", "CRank.cpp");
@C_SOURCE_FILES = ();
my %OPTIONS, %OPT;
$OPT{"debug"} = "-g -ggdb";
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\" -fno-exceptions -fno-rtti";
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
while ($cmd = shift)
{
if ($cmd =~ /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($ofile))[9];
if ($file_time > $ofile_time)
{
print "$gcc\n";
`$gcc`;
}
} else {
print "$gcc\n";
`$gcc`;
}
}
$gcc = "$gccf $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
print "$gcc\n";
`$gcc`;

3042
dlls/csx_sql/amxxmodule.cpp Executable file

File diff suppressed because it is too large Load Diff

2197
dlls/csx_sql/amxxmodule.h Executable file

File diff suppressed because it is too large Load Diff

6
dlls/csx_sql/compile.bat Executable file
View File

@ -0,0 +1,6 @@
@echo off
PATH=D:\gcc\bin;%PATH%
make
pause

View File

@ -0,0 +1,85 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Defines for netware compatible with MySQL */
/* required headers */
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <screen.h>
#include <limits.h>
#include <signal.h>
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/types.h>
#include <time.h>
#include <sys/time.h>
#include <pthread.h>
#include <termios.h>
/* required adjustments */
#undef HAVE_READDIR_R
#undef HAVE_RWLOCK_INIT
#undef HAVE_SCHED_H
#undef HAVE_SYS_MMAN_H
#undef HAVE_SYNCH_H
#undef HAVE_CRYPT
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
#define HAVE_PTHREAD_SIGMASK 1
#define HAVE_PTHREAD_YIELD_ZERO_ARG 1
#define HAVE_BROKEN_REALPATH 1
/* include the old function apis */
#define USE_OLD_FUNCTIONS 1
/* no case sensitivity */
#define FN_NO_CASE_SENCE 1
/* the thread alarm is not used */
#define DONT_USE_THR_ALARM 1
/* signals do not interrupt sockets */
#define SIGNALS_DONT_BREAK_READ 1
/* signal by closing the sockets */
#define SIGNAL_WITH_VIO_CLOSE 1
/* default directory information */
#define DEFAULT_MYSQL_HOME "sys:/mysql"
#define PACKAGE "mysql"
#define DEFAULT_BASEDIR "sys:/"
#define SHAREDIR "share/"
#define DEFAULT_CHARSET_HOME "sys:/mysql/"
#define DATADIR "data/"
/* 64-bit file system calls */
#define SIZEOF_OFF_T 8
#define off_t off64_t
#define chsize chsize64
#define ftruncate ftruncate64
#define lseek lseek64
#define pread pread64
#define pwrite pwrite64
#define tell tell64
/* do not use the extended time in LibC sys\stat.h */
#define _POSIX_SOURCE
/* Some macros for portability */
#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=(SEC); (ABSTIME).tv_nsec=0; }

View File

@ -0,0 +1,832 @@
/* Copyright (C) 2000 MySQL AB & Yuri Dario
All the above parties has a full, independent copyright to
the following code, including the right to use the code in
any manner without any demands from the other parties.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
/* Defines for OS2 to make it compatible for MySQL */
#ifndef __CONFIG_OS2_H__
#define __CONFIG_OS2_H__
#include <os2.h>
#include <math.h>
#include <io.h>
#include <types.h>
/* Define to name of system eg solaris*/
#define SYSTEM_TYPE "IBM OS/2 Warp"
/* Define to machine type name eg sun10 */
#define MACHINE_TYPE "i686"
/* Name of package */
#define PACKAGE "mysql"
/* Version number of package */
#define VERSION MYSQL_SERVER_VERSION
/* Default socket */
#define MYSQL_UNIX_ADDR "\\socket\\MySQL"
#define FN_LIBCHAR '\\'
#define FN_ROOTDIR "\\"
#define MY_NFILE 1024 /* This is only used to save filenames */
#define HAVE_ACCESS
#define DEFAULT_MYSQL_HOME "c:\\mysql"
#define DEFAULT_BASEDIR "C:\\"
#define SHAREDIR "share"
#define DEFAULT_CHARSET_HOME "C:/mysql/"
#define _POSIX_PATH_MAX 255
#define DWORD ULONG
#define O_SHARE 0x1000 /* Open file in sharing mode */
#define FILE_BINARY O_BINARY /* my_fopen in binary mode */
#define S_IROTH S_IREAD /* for my_lib */
#define CANT_DELETE_OPEN_FILES /* saves open files in a list, for delayed delete */
#define O_NONBLOCK 0x10
#define NO_OPEN_3 /* For my_create() */
#define SIGQUIT SIGTERM /* No SIGQUIT */
#define SIGALRM 14 /* Alarm */
#define NO_FCNTL_NONBLOCK
#define EFBIG E2BIG
/*#define ENFILE EMFILE */
/*#define ENAMETOOLONG (EOS2ERR+2) */
/*#define ETIMEDOUT 145 */
/*#define EPIPE 146 */
#define EROFS 147
#define sleep(A) DosSleep((A)*1000)
#define closesocket(A) soclose(A)
#define F_OK 0
#define W_OK 2
#define bzero(x,y) memset((x),'\0',(y))
#define bcopy(x,y,z) memcpy((y),(x),(z))
#define bcmp(x,y,z) memcmp((y),(x),(z))
#define F_RDLCK 4 /* Read lock. */
#define F_WRLCK 2 /* Write lock. */
#define F_UNLCK 0 /* Remove lock. */
#define S_IFMT 0x17000 /* Mask for file type */
#define F_TO_EOF 0L /* Param to lockf() to lock rest of file */
#define HUGE_PTR
#ifdef __cplusplus
extern "C"
#endif
double _cdecl rint( double nr);
DWORD TlsAlloc( void);
BOOL TlsFree( DWORD);
PVOID TlsGetValue( DWORD);
BOOL TlsSetValue( DWORD, PVOID);
/* support for > 2GB file size */
#define SIZEOF_OFF_T 8
#define lseek(A,B,C) _lseek64( A, B, C)
#define tell(A) _lseek64( A, 0, SEEK_CUR)
void* dlopen( char* path, int flag);
char* dlerror( void);
void* dlsym( void* hmod, char* fn);
void dlclose( void* hmod);
/* Some typedefs */
typedef unsigned long long os_off_t;
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if using alloca.c. */
/* #undef C_ALLOCA */
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
/* #undef CRAY_STACKSEG_END */
/* Define if you have alloca, as a function or macro. */
#define HAVE_ALLOCA 1
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
/* #define HAVE_ALLOCA_H 1 */
/* Define if you don't have vprintf but do have _doprnt. */
/* #undef HAVE_DOPRNT */
/* Define if you have a working `mmap' system call. */
/* #undef HAVE_MMAP */
/* Define if system calls automatically restart after interruption
by a signal. */
/* #undef HAVE_RESTARTABLE_SYSCALLS */
/* Define if your struct stat has st_rdev. */
#define HAVE_ST_RDEV 1
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
/* #define HAVE_SYS_WAIT_H 1 */
/* Define if you don't have tm_zone but do have the external array
tzname. */
#define HAVE_TZNAME 1
/* Define if utime(file, NULL) sets file's timestamp to the present. */
#define HAVE_UTIME_NULL 1
/* Define if you have the vprintf function. */
#define HAVE_VPRINTF 1
/* Define as __inline if that's what the C compiler calls it. */
/* #undef inline */
/* Define to `long' if <sys/types.h> doesn't define. */
/* #undef off_t */
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define to `unsigned' if <sys/types.h> doesn't define. */
/* #undef size_t */
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#define STACK_DIRECTION -1
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
/* #undef STAT_MACROS_BROKEN */
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define if your <sys/time.h> declares struct tm. */
/* #undef TM_IN_SYS_TIME */
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
/* Version of .frm files */
#define DOT_FRM_VERSION 6
/* READLINE: */
#define FIONREAD_IN_SYS_IOCTL 1
/* READLINE: Define if your system defines TIOCGWINSZ in sys/ioctl.h. */
/* #undef GWINSZ_IN_SYS_IOCTL */
/* Do we have FIONREAD */
#define FIONREAD_IN_SYS_IOCTL 1
/* atomic_add() from <asm/atomic.h> (Linux only) */
/* #undef HAVE_ATOMIC_ADD */
/* atomic_sub() from <asm/atomic.h> (Linux only) */
/* #undef HAVE_ATOMIC_SUB */
/* bool is not defined by all C++ compilators */
#define HAVE_BOOL 1
/* Have berkeley db installed */
/* #define HAVE_BERKELEY_DB 1 */
/* DSB style signals ? */
/* #undef HAVE_BSD_SIGNALS */
/* Can netinet be included */
/* #undef HAVE_BROKEN_NETINET_INCLUDES */
/* READLINE: */
/* #undef HAVE_BSD_SIGNALS */
/* ZLIB and compress: */
#define HAVE_COMPRESS 1
/* Define if we are using OSF1 DEC threads */
/* #undef HAVE_DEC_THREADS */
/* Define if we are using OSF1 DEC threads on 3.2 */
/* #undef HAVE_DEC_3_2_THREADS */
/* fp_except from ieeefp.h */
/* #undef HAVE_FP_EXCEPT */
/* READLINE: */
/* #undef HAVE_GETPW_DECLS */
/* Solaris define gethostbyname_r with 5 arguments. glibc2 defines
this with 6 arguments */
/* #undef HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE */
/* In OSF 4.0f the 3'd argument to gethostname_r is hostent_data * */
/* #undef HAVE_GETHOSTBYNAME_R_RETURN_INT */
/* Define if int8, int16 and int32 types exist */
/* #undef HAVE_INT_8_16_32 */
/* Define if have -lwrap */
/* #undef HAVE_LIBWRAP */
/* Define if we are using Xavier Leroy's LinuxThreads */
/* #undef HAVE_LINUXTHREADS */
/* Do we use user level threads */
/* #undef HAVE_mit_thread */
/* For some non posix threads */
/* #undef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC */
/* For some non posix threads */
/* #undef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */
/* READLINE: */
#define HAVE_POSIX_SIGNALS 0
/* sigwait with one argument */
/* #undef HAVE_NONPOSIX_SIGWAIT */
/* pthread_attr_setscope */
#define HAVE_PTHREAD_ATTR_SETSCOPE 1
/* POSIX readdir_r */
/* #undef HAVE_READDIR_R */
/* POSIX sigwait */
/* #undef HAVE_SIGWAIT */
/* crypt */
#define HAVE_CRYPT 1
/* Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines
this with 8 arguments */
/* #undef HAVE_SOLARIS_STYLE_GETHOST */
/* Timespec has a ts_sec instead of tv_sev */
#define HAVE_TIMESPEC_TS_SEC 1
/* Have the tzname variable */
#define HAVE_TZNAME 1
/* Define if the system files define uchar */
/* #undef HAVE_UCHAR */
/* Define if the system files define uint */
/* #undef HAVE_UINT */
/* Define if the system files define ulong */
/* #undef HAVE_ULONG */
/* UNIXWARE7 threads are not posix */
/* #undef HAVE_UNIXWARE7_THREADS */
/* new UNIXWARE7 threads that are not yet posix */
/* #undef HAVE_UNIXWARE7_POSIX */
/* READLINE: */
/* #undef HAVE_USG_SIGHOLD */
/* Define if want -lwrap */
/* #undef LIBWRAP */
/* mysql client protocoll version */
#define PROTOCOL_VERSION 10
/* Define if qsort returns void */
#define QSORT_TYPE_IS_VOID 1
/* Define as the return type of qsort (int or void). */
#define RETQSORTTYPE void
/* Define as the base type of the last arg to accept */
#define SOCKET_SIZE_TYPE int
/* Last argument to get/setsockopt */
/* #undef SOCKOPT_OPTLEN_TYPE */
/* #undef SPEED_T_IN_SYS_TYPES */
/* #undef SPRINTF_RETURNS_PTR */
#define SPRINTF_RETURNS_INT 1
/* #undef SPRINTF_RETURNS_GARBAGE */
/* #undef STRUCT_DIRENT_HAS_D_FILENO */
#define STRUCT_DIRENT_HAS_D_INO 1
/* Define if you want to have threaded code. This may be undef on client code */
#define THREAD 1
/* Should be client be thread safe */
/* #undef THREAD_SAFE_CLIENT */
/* READLINE: */
/* #undef TIOCSTAT_IN_SYS_IOCTL */
/* Use multi-byte character routines */
/* #undef USE_MB */
/* #undef USE_MB_IDENT */
/* Use MySQL RAID */
/* #undef USE_RAID */
/* Use strcoll() functions when comparing and sorting. */
/* #undef USE_STRCOLL */
/* READLINE: */
#define VOID_SIGHANDLER 1
/* The number of bytes in a char. */
#define SIZEOF_CHAR 1
/* The number of bytes in a int. */
#define SIZEOF_INT 4
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
/* The number of bytes in a long long. */
#define SIZEOF_LONG_LONG 8
/* Define if you have the alarm function. */
#define HAVE_ALARM 1
/* Define if you have the atod function. */
/* #undef HAVE_ATOD */
/* Define if you have the bcmp function. */
#define HAVE_BCMP 1
/* Define if you have the bfill function. */
/* #undef HAVE_BFILL */
/* Define if you have the bmove function. */
/* #undef HAVE_BMOVE */
/* Define if you have the bzero function. */
#define HAVE_BZERO 1
/* Define if you have the chsize function. */
#define HAVE_CHSIZE 1
/* Define if you have the cuserid function. */
/* #define HAVE_CUSERID 1 */
/* Define if you have the dlerror function. */
#define HAVE_DLERROR 1
/* Define if you have the dlopen function. */
#define HAVE_DLOPEN 1
/* Define if you have the fchmod function. */
/* #undef HAVE_FCHMOD */
/* Define if you have the fcntl function. */
/* #define HAVE_FCNTL 1 */
/* Define if you have the fconvert function. */
/* #undef HAVE_FCONVERT */
/* Define if you have the finite function. */
/* #undef HAVE_FINITE */
/* Define if you have the fpresetsticky function. */
/* #undef HAVE_FPRESETSTICKY */
/* Define if you have the fpsetmask function. */
/* #undef HAVE_FPSETMASK */
/* Define if you have the fseeko function. */
/* #undef HAVE_FSEEKO */
/* Define if you have the ftruncate function. */
/* #define HAVE_FTRUNCATE 1 */
/* Define if you have the getcwd function. */
#define HAVE_GETCWD 1
/* Define if you have the gethostbyaddr_r function. */
/* #undef HAVE_GETHOSTBYADDR_R */
/* Define if you have the gethostbyname_r function. */
/* #undef HAVE_GETHOSTBYNAME_R */
/* Define if you have the getpagesize function. */
#define HAVE_GETPAGESIZE 1
/* Define if you have the getpass function. */
/*#define HAVE_GETPASS 1 */
/* Define if you have the getpassphrase function. */
/* #undef HAVE_GETPASSPHRASE */
/* Define if you have the getpwnam function. */
/* #define HAVE_GETPWNAM 1 */
/* Define if you have the getpwuid function. */
/* #define HAVE_GETPWUID 1 */
/* Define if you have the getrlimit function. */
/* #undef HAVE_GETRLIMIT */
/* Define if you have the getrusage function. */
/* #undef HAVE_GETRUSAGE */
/* Define if you have the getwd function. */
#define HAVE_GETWD 1
/* Define if you have the index function. */
#define HAVE_INDEX 1
/* Define if you have the initgroups function. */
/* #undef HAVE_INITGROUPS */
/* Define if you have the localtime_r function. */
#define HAVE_LOCALTIME_R 1
/* Define if you have the locking function. */
/* #undef HAVE_LOCKING */
/* Define if you have the longjmp function. */
#define HAVE_LONGJMP 1
/* Define if you have the lrand48 function. */
/* #undef HAVE_LRAND48 */
/* Define if you have the lstat function. */
/* #undef HAVE_LSTAT */
/* Define if you have the madvise function. */
/* #undef HAVE_MADVISE */
/* Define if you have the memcpy function. */
#define HAVE_MEMCPY 1
/* Define if you have the memmove function. */
#define HAVE_MEMMOVE 1
/* Define if you have the mkstemp function. */
/* #define HAVE_MKSTEMP 1 */
/* Define if you have the mlockall function. */
/* #undef HAVE_MLOCKALL */
/* Define if you have the perror function. */
#define HAVE_PERROR 1
/* Define if you have the poll function. */
/* #undef HAVE_POLL */
/* Define if you have the pread function. */
/* #undef HAVE_PREAD */
/* Define if you have the pthread_attr_create function. */
/* #undef HAVE_PTHREAD_ATTR_CREATE */
/* Define if you have the pthread_attr_setprio function. */
#define HAVE_PTHREAD_ATTR_SETPRIO 1
/* Define if you have the pthread_attr_setschedparam function. */
/* #undef HAVE_PTHREAD_ATTR_SETSCHEDPARAM */
/* Define if you have the pthread_attr_setstacksize function. */
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
/* Define if you have the pthread_condattr_create function. */
/* #undef HAVE_PTHREAD_CONDATTR_CREATE */
/* Define if you have the pthread_getsequence_np function. */
/* #undef HAVE_PTHREAD_GETSEQUENCE_NP */
/* Define if you have the pthread_init function. */
/* #undef HAVE_PTHREAD_INIT */
/* Define if you have the pthread_rwlock_rdlock function. */
/* #undef HAVE_PTHREAD_RWLOCK_RDLOCK */
/* Define if you have the pthread_setprio function. */
#define HAVE_PTHREAD_SETPRIO 1
/* Define if you have the pthread_setprio_np function. */
/* #undef HAVE_PTHREAD_SETPRIO_NP */
/* Define if you have the pthread_setschedparam function. */
/* #undef HAVE_PTHREAD_SETSCHEDPARAM */
/* Define if you have the pthread_sigmask function. */
#define HAVE_PTHREAD_SIGMASK 1
/* Define if you have the putenv function. */
#define HAVE_PUTENV 1
/* Define if you have the readlink function. */
/* #undef HAVE_READLINK */
/* Define if you have the realpath function. */
/* #undef HAVE_REALPATH */
/* Define if you have the rename function. */
#define HAVE_RENAME 1
/* Define if you have the rint function. */
#define HAVE_RINT 1
/* Define if you have the rwlock_init function. */
/* #undef HAVE_RWLOCK_INIT */
/* Define if you have the select function. */
#define HAVE_SELECT 1
/* Define if you have the setenv function. */
/* #undef HAVE_SETENV */
/* Define if you have the setlocale function. */
#define HAVE_SETLOCALE 1
/* Define if you have the setupterm function. */
/* #undef HAVE_SETUPTERM */
/* Define if you have the sighold function. */
/* #undef HAVE_SIGHOLD */
/* Define if you have the sigset function. */
/* #undef HAVE_SIGSET */
/* Define if you have the sigthreadmask function. */
/* #undef HAVE_SIGTHREADMASK */
/* Define if you have the snprintf function. */
/* #define HAVE_SNPRINTF 1 */
/* Define if you have the socket function. */
#define HAVE_SOCKET 1
/* Define if you have the stpcpy function. */
/* #undef HAVE_STPCPY */
/* Define if you have the strcasecmp function. */
/* #undef HAVE_STRCASECMP */
/* Define if you have the strcoll function. */
#define HAVE_STRCOLL 1
/* Define if you have the strerror function. */
#define HAVE_STRERROR 1
/* Define if you have the strnlen function. */
/* #undef HAVE_STRNLEN */
/* Define if you have the strpbrk function. */
#define HAVE_STRPBRK 1
/* Define if you have the strstr function. */
#define HAVE_STRSTR 1
/* Define if you have the strtok_r function. */
/* #undef HAVE_STRTOK_R */
/* Define if you have the strtol function. */
#define HAVE_STRTOL 1
/* Define if you have the strtoul function. */
#define HAVE_STRTOUL 1
/* Define if you have the strtoull function. */
/* #undef HAVE_STRTOULL */
/* Define if you have the tcgetattr function. */
#define HAVE_TCGETATTR 1
/* Define if you have the tell function. */
#define HAVE_TELL 1
/* Define if you have the tempnam function. */
#define HAVE_TEMPNAM 1
/* Define if you have the thr_setconcurrency function. */
/* #undef HAVE_THR_SETCONCURRENCY */
/* Define if you have the vidattr function. */
/* #undef HAVE_VIDATTR */
/* Define if you have the <alloca.h> header file. */
/* #define HAVE_ALLOCA_H 1 */
/* Define if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define if you have the <asm/termbits.h> header file. */
/* #undef HAVE_ASM_TERMBITS_H */
/* Define if you have the <crypt.h> header file. */
#define HAVE_CRYPT_H 1
/* Define if you have the <curses.h> header file. */
/* #define HAVE_CURSES_H 1 */
/* Define if you have the <dirent.h> header file. */
/* #define HAVE_DIRENT_H 1 */
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <float.h> header file. */
#define HAVE_FLOAT_H 1
/* Define if you have the <floatingpoint.h> header file. */
/* #undef HAVE_FLOATINGPOINT_H */
/* Define if you have the <grp.h> header file. */
/* #define HAVE_GRP_H 1 */
/* Define if you have the <ieeefp.h> header file. */
/* #undef HAVE_IEEEFP_H */
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define if you have the <ndir.h> header file. */
/* #undef HAVE_NDIR_H */
/* Define if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define if you have the <paths.h> header file. */
/* #undef HAVE_PATHS_H */
/* Define if you have the <pwd.h> header file. */
/* #define HAVE_PWD_H 1 */
/* Define if you have the <sched.h> header file. */
/* #undef HAVE_SCHED_H */
/* Define if you have the <select.h> header file. */
/* #undef HAVE_SELECT_H */
/* Define if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
/* Define if you have the <stddef.h> header file. */
#define HAVE_STDDEF_H 1
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define if you have the <strings.h> header file. */
/* #define HAVE_STRINGS_H 1 */
/* Define if you have the <synch.h> header file. */
/* #undef HAVE_SYNCH_H */
/* Define if you have the <sys/dir.h> header file. */
/* #define HAVE_SYS_DIR_H 1 */
/* Define if you have the <sys/file.h> header file. */
/* #define HAVE_SYS_FILE_H 1 */
/* Define if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define if you have the <sys/mman.h> header file. */
/* #undef HAVE_SYS_MMAN_H */
/* Define if you have the <sys/ndir.h> header file. */
/* #undef HAVE_SYS_NDIR_H */
/* Define if you have the <sys/pte.h> header file. */
/* #undef HAVE_SYS_PTE_H */
/* Define if you have the <sys/ptem.h> header file. */
/* #undef HAVE_SYS_PTEM_H */
/* Define if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define if you have the <sys/stream.h> header file. */
/* #undef HAVE_SYS_STREAM_H */
/* Define if you have the <sys/timeb.h> header file. */
#define HAVE_SYS_TIMEB_H 1
/* Define if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define if you have the <sys/un.h> header file. */
#define HAVE_SYS_UN_H 1
/* Define if you have the <sys/utime.h> header file. */
#define HAVE_SYS_UTIME_H 1
/* Define if you have the <sys/vadvise.h> header file. */
/* #undef HAVE_SYS_VADVISE_H */
/* Define if you have the <sys/wait.h> header file. */
/* #define HAVE_SYS_WAIT_H 1 */
/* Define if you have the <term.h> header file. */
/* #undef HAVE_TERM_H */
/* Define if you have the <termbits.h> header file. */
/* #undef HAVE_TERMBITS_H */
/* Define if you have the <termcap.h> header file. */
/* #define HAVE_TERMCAP_H 1 */
/* Define if you have the <termio.h> header file. */
/* /#define HAVE_TERMIO_H 1 */
/* Define if you have the <termios.h> header file. */
/* #define HAVE_TERMIOS_H 1 */
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
/* Define if you have the <varargs.h> header file. */
#define HAVE_VARARGS_H 1
/* Define if you have the bind library (-lbind). */
/* #undef HAVE_LIBBIND */
/* Define if you have the c_r library (-lc_r). */
/* #undef HAVE_LIBC_R */
/* Define if you have the compat library (-lcompat). */
/* #undef HAVE_LIBCOMPAT */
/* Define if you have the crypt library (-lcrypt). */
#define HAVE_LIBCRYPT 1
/* Define if you have the dl library (-ldl). */
#define HAVE_LIBDL 1
/* Define if you have the gen library (-lgen). */
/* #undef HAVE_LIBGEN */
/* Define if you have the m library (-lm). */
#define HAVE_LIBM 1
/* Define if you have the nsl library (-lnsl). */
/* #undef HAVE_LIBNSL */
/* Define if you have the nsl_r library (-lnsl_r). */
/* #undef HAVE_LIBNSL_R */
/* Define if you have the pthread library (-lpthread). */
/* #undef HAVE_LIBPTHREAD */
/* Define if you have the socket library (-lsocket). */
/* #undef HAVE_LIBSOCKET */
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define to make fseeko etc. visible, on some hosts. */
/* #undef _LARGEFILE_SOURCE */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
#endif /* __CONFIG_OS2_H__ */

View File

@ -0,0 +1,335 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Defines for Win32 to make it compatible for MySQL */
#include <sys/locking.h>
#include <windows.h>
#include <math.h> /* Because of rint() */
#include <fcntl.h>
#include <io.h>
#include <malloc.h>
#if defined(__NT__)
#define SYSTEM_TYPE "NT"
#elif defined(__WIN2000__)
#define SYSTEM_TYPE "WIN2000"
#else
#define SYSTEM_TYPE "Win95/Win98"
#endif
#if defined(_WIN64) || defined(WIN64)
#define MACHINE_TYPE "ia64" /* Define to machine type name */
#else
#define MACHINE_TYPE "i32" /* Define to machine type name */
#ifndef _WIN32
#define _WIN32 /* Compatible with old source */
#endif
#ifndef __WIN32__
#define __WIN32__
#endif
#endif /* _WIN64 */
#ifndef __WIN__
#define __WIN__ /* To make it easier in VC++ */
#endif
/* File and lock constants */
#define O_SHARE 0x1000 /* Open file in sharing mode */
#ifdef __BORLANDC__
#define F_RDLCK LK_NBLCK /* read lock */
#define F_WRLCK LK_NBRLCK /* write lock */
#define F_UNLCK LK_UNLCK /* remove lock(s) */
#else
#define F_RDLCK _LK_NBLCK /* read lock */
#define F_WRLCK _LK_NBRLCK /* write lock */
#define F_UNLCK _LK_UNLCK /* remove lock(s) */
#endif
#define F_EXCLUSIVE 1 /* We have only exclusive locking */
#define F_TO_EOF (INT_MAX32/2) /* size for lock of all file */
#define F_OK 0 /* parameter to access() */
#define S_IROTH S_IREAD /* for my_lib */
#ifdef __BORLANDC__
#define FILE_BINARY O_BINARY /* my_fopen in binary mode */
#define O_TEMPORARY 0
#define O_SHORT_LIVED 0
#define SH_DENYNO _SH_DENYNO
#else
#define O_BINARY _O_BINARY /* compability with MSDOS */
#define FILE_BINARY _O_BINARY /* my_fopen in binary mode */
#define O_TEMPORARY _O_TEMPORARY
#define O_SHORT_LIVED _O_SHORT_LIVED
#define SH_DENYNO _SH_DENYNO
#endif
#define NO_OPEN_3 /* For my_create() */
#define SIGQUIT SIGTERM /* No SIGQUIT */
#undef _REENTRANT /* Crashes something for win32 */
#undef SAFE_MUTEX /* Can't be used on windows */
#define LONGLONG_MIN ((__int64) 0x8000000000000000)
#define LONGLONG_MAX ((__int64) 0x7FFFFFFFFFFFFFFF)
#define ULONGLONG_MAX ((unsigned __int64) 0xFFFFFFFFFFFFFFFF)
#define LL(A) ((__int64) A)
/* Type information */
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
typedef __int64 longlong;
typedef int sigset_t;
#define longlong_defined
/* off_t should not be __int64 because of conflicts in header files;
Use my_off_t or os_off_t instead */
typedef long off_t;
typedef __int64 os_off_t;
#ifdef _WIN64
typedef UINT_PTR rf_SetTimer;
#else
typedef unsigned int size_t;
typedef uint rf_SetTimer;
#endif
#define Socket_defined
#define my_socket SOCKET
#define bool BOOL
#define SIGPIPE SIGINT
#define RETQSORTTYPE void
#define QSORT_TYPE_IS_VOID
#define RETSIGTYPE void
#define SOCKET_SIZE_TYPE int
#define my_socket_defined
#define bool_defined
#define byte_defined
#define HUGE_PTR
#define STDCALL __stdcall /* Used by libmysql.dll */
#define isnan(X) _isnan(X)
#define finite(X) _finite(X)
#ifndef UNDEF_THREAD_HACK
#define THREAD
#endif
#define VOID_SIGHANDLER
#define SIZEOF_CHAR 1
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_OFF_T 8
#ifdef _WIN64
#define SIZEOF_CHARP 8
#else
#define SIZEOF_CHARP 4
#endif
#define HAVE_BROKEN_NETINET_INCLUDES
#ifdef __NT__
#define HAVE_NAMED_PIPE /* We can only create pipes on NT */
#endif
/* We need to close files to break connections on shutdown */
#ifndef SIGNAL_WITH_VIO_CLOSE
#define SIGNAL_WITH_VIO_CLOSE
#endif
/* Use all character sets in MySQL */
#define USE_MB 1
#define USE_MB_IDENT 1
#define USE_STRCOLL 1
/* All windows servers should support .sym files */
#undef USE_SYMDIR
#define USE_SYMDIR
/* If LOAD DATA LOCAL INFILE should be enabled by default */
#define ENABLED_LOCAL_INFILE 1
/* Convert some simple functions to Posix */
#define sigset(A,B) signal((A),(B))
#define finite(A) _finite(A)
#define sleep(A) Sleep((A)*1000)
#ifndef __BORLANDC__
#define access(A,B) _access(A,B)
#endif
#if defined(__cplusplus)
inline double rint(double nr)
{
double f = floor(nr);
double c = ceil(nr);
return (((c-nr) >= (nr-f)) ? f :c);
}
#ifdef _WIN64
#define ulonglong2double(A) ((double) (ulonglong) (A))
#define my_off_t2double(A) ((double) (my_off_t) (A))
#else
inline double ulonglong2double(ulonglong value)
{
longlong nr=(longlong) value;
if (nr >= 0)
return (double) nr;
return (18446744073709551616.0 + (double) nr);
}
#define my_off_t2double(A) ulonglong2double(A)
#endif /* _WIN64 */
#else
#define inline __inline
#endif /* __cplusplus */
#if SIZEOF_OFF_T > 4
#define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C))
#define tell(A) _telli64(A)
#endif
#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time((time_t*)0) + (time_t) (SEC); (ABSTIME).tv_nsec=0; }
#define STACK_DIRECTION -1
/* Optimized store functions for Intel x86 */
#ifndef _WIN64
#define sint2korr(A) (*((int16 *) (A)))
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
(((uint32) 255L << 24) | \
(((uint32) (uchar) (A)[2]) << 16) |\
(((uint32) (uchar) (A)[1]) << 8) | \
((uint32) (uchar) (A)[0])) : \
(((uint32) (uchar) (A)[2]) << 16) |\
(((uint32) (uchar) (A)[1]) << 8) | \
((uint32) (uchar) (A)[0])))
#define sint4korr(A) (*((long *) (A)))
#define uint2korr(A) (*((uint16 *) (A)))
#define uint3korr(A) (long) (*((unsigned long *) (A)) & 0xFFFFFF)
#define uint4korr(A) (*((unsigned long *) (A)))
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16) +\
(((uint32) ((uchar) (A)[3])) << 24)) +\
(((ulonglong) ((uchar) (A)[4])) << 32))
#define uint8korr(A) (*((ulonglong *) (A)))
#define sint8korr(A) (*((longlong *) (A)))
#define int2store(T,A) *((uint16*) (T))= (uint16) (A)
#define int3store(T,A) { *(T)= (uchar) ((A));\
*(T+1)=(uchar) (((uint) (A) >> 8));\
*(T+2)=(uchar) (((A) >> 16)); }
#define int4store(T,A) *((long *) (T))= (long) (A)
#define int5store(T,A) { *(T)= (uchar)((A));\
*((T)+1)=(uchar) (((A) >> 8));\
*((T)+2)=(uchar) (((A) >> 16));\
*((T)+3)=(uchar) (((A) >> 24)); \
*((T)+4)=(uchar) (((A) >> 32)); }
#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
#define doubleget(V,M) { *((long *) &V) = *((long*) M); \
*(((long *) &V)+1) = *(((long*) M)+1); }
#define doublestore(T,V) { *((long *) T) = *((long*) &V); \
*(((long *) T)+1) = *(((long*) &V)+1); }
#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
#define float8get(V,M) doubleget((V),(M))
#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
#define float8store(V,M) doublestore((V),(M))
#endif /* _WIN64 */
#define HAVE_PERROR
#define HAVE_VFPRINT
#define HAVE_RENAME /* Have rename() as function */
#define HAVE_BINARY_STREAMS /* Have "b" flag in streams */
#define HAVE_LONG_JMP /* Have long jump function */
#define HAVE_LOCKING /* have locking() call */
#define HAVE_ERRNO_AS_DEFINE /* errno is a define */
#define HAVE_STDLIB /* everything is include in this file */
#define HAVE_MEMCPY
#define HAVE_MEMMOVE
#define HAVE_GETCWD
#define HAVE_TELL
#define HAVE_TZNAME
#define HAVE_PUTENV
#define HAVE_SELECT
#define HAVE_SETLOCALE
#define HAVE_SOCKET /* Giangi */
#define HAVE_FLOAT_H
#define HAVE_LIMITS_H
#define HAVE_STDDEF_H
#define HAVE_RINT /* defined in this file */
#define NO_FCNTL_NONBLOCK /* No FCNTL */
#define HAVE_ALLOCA
#define HAVE_STRPBRK
#define HAVE_STRSTR
#define HAVE_COMPRESS
#define HAVE_CREATESEMAPHORE
#define HAVE_ISNAN
#define HAVE_FINITE
#define HAVE_ISAM /* We want to have support for ISAM in 4.0 */
#define HAVE_QUERY_CACHE
#define SPRINTF_RETURNS_INT
#define HAVE_SETFILEPOINTER
#ifdef NOT_USED
#define HAVE_SNPRINTF /* Gave link error */
#define _snprintf snprintf
#endif
#ifdef _MSC_VER
#define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */
#define HAVE_ANSI_INCLUDE
#define HAVE_SYS_UTIME_H
#define HAVE_STRTOUL
#endif
#define my_reinterpret_cast(A) reinterpret_cast <A>
#define my_const_cast(A) const_cast<A>
/* MYSQL OPTIONS */
#ifdef _CUSTOMCONFIG_
#include <custom_conf.h>
#else
#define DEFAULT_MYSQL_HOME "c:\\mysql"
#define PACKAGE "mysql"
#define DEFAULT_BASEDIR "C:\\"
#define SHAREDIR "share"
#define DEFAULT_CHARSET_HOME "C:/mysql/"
#endif
/* File name handling */
#define FN_LIBCHAR '\\'
#define FN_ROOTDIR "\\"
#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
#define FN_NO_CASE_SENCE /* Files are not case-sensitive */
#define MY_NFILE 1024
#define DO_NOT_REMOVE_THREAD_WRAPPERS
#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
/* The following is only used for statistics, so it should be good enough */
#ifdef __NT__ /* This should also work on Win98 but .. */
#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
#define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C))
#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
#else
#define thread_safe_add(V,C,L) \
pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
#define thread_safe_sub(V,C,L) \
pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
#define statistic_add(V,C,L) (V)+=(C)
#endif
#define statistic_increment(V,L) thread_safe_increment((V),(L))

View File

@ -0,0 +1,93 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _dbug_h
#define _dbug_h
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(DBUG_OFF) && !defined(_lint)
extern int _db_on_,_no_db_;
extern FILE *_db_fp_;
extern char *_db_process_;
extern int _db_keyword_(const char *keyword);
extern void _db_setjmp_(void);
extern void _db_longjmp_(void);
extern void _db_push_(const char *control);
extern void _db_pop_(void);
extern void _db_enter_(const char *_func_,const char *_file_,uint _line_,
const char **_sfunc_,const char **_sfile_,
uint *_slevel_, char ***);
extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_,
uint *_slevel_);
extern void _db_pargs_(uint _line_,const char *keyword);
extern void _db_doprnt_ _VARARGS((const char *format,...));
extern void _db_dump_(uint _line_,const char *keyword,const char *memory,
uint length);
extern void _db_lock_file();
extern void _db_unlock_file();
#define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \
char **_db_framep_; \
_db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \
&_db_framep_)
#define DBUG_LEAVE \
(_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_))
#define DBUG_RETURN(a1) {DBUG_LEAVE; return(a1);}
#define DBUG_VOID_RETURN {DBUG_LEAVE; return;}
#define DBUG_EXECUTE(keyword,a1) \
{if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}}
#define DBUG_PRINT(keyword,arglist) \
{if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}}
#define DBUG_PUSH(a1) _db_push_ (a1)
#define DBUG_POP() _db_pop_ ()
#define DBUG_PROCESS(a1) (_db_process_ = a1)
#define DBUG_FILE (_db_fp_)
#define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1))
#define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2))
#define DBUG_DUMP(keyword,a1,a2)\
{if (_db_on_) {_db_dump_(__LINE__,keyword,a1,a2);}}
#define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr)
#define DEBUGGER_OFF _no_db_=1;_db_on_=0;
#define DEBUGGER_ON _no_db_=0
#define DBUG_LOCK_FILE { _db_lock_file(); }
#define DBUG_UNLOCK_FILE { _db_unlock_file(); }
#define DBUG_ASSERT(A) assert(A)
#else /* No debugger */
#define DBUG_ENTER(a1)
#define DBUG_RETURN(a1) return(a1)
#define DBUG_VOID_RETURN return
#define DBUG_EXECUTE(keyword,a1) {}
#define DBUG_PRINT(keyword,arglist) {}
#define DBUG_PUSH(a1) {}
#define DBUG_POP() {}
#define DBUG_PROCESS(a1) {}
#define DBUG_FILE (stderr)
#define DBUG_SETJMP setjmp
#define DBUG_LONGJMP longjmp
#define DBUG_DUMP(keyword,a1,a2) {}
#define DBUG_IN_USE 0
#define DEBUGGER_OFF
#define DEBUGGER_ON
#define DBUG_LOCK_FILE
#define DBUG_UNLOCK_FILE
#define DBUG_ASSERT(A) {}
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,66 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Error messages for mysql clients */
/* error messages for the demon is in share/language/errmsg.sys */
#ifdef __cplusplus
extern "C" {
#endif
void init_client_errs(void);
extern const char *client_errors[]; /* Error messages */
#ifdef __cplusplus
}
#endif
#define CR_MIN_ERROR 2000 /* For easier client code */
#define CR_MAX_ERROR 2999
#if defined(OS2) && defined(MYSQL_SERVER)
#define CER(X) client_errors[(X)-CR_MIN_ERROR]
#else
#define ER(X) client_errors[(X)-CR_MIN_ERROR]
#endif
#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
#define CR_UNKNOWN_ERROR 2000
#define CR_SOCKET_CREATE_ERROR 2001
#define CR_CONNECTION_ERROR 2002
#define CR_CONN_HOST_ERROR 2003
#define CR_IPSOCK_ERROR 2004
#define CR_UNKNOWN_HOST 2005
#define CR_SERVER_GONE_ERROR 2006
#define CR_VERSION_ERROR 2007
#define CR_OUT_OF_MEMORY 2008
#define CR_WRONG_HOST_INFO 2009
#define CR_LOCALHOST_CONNECTION 2010
#define CR_TCP_CONNECTION 2011
#define CR_SERVER_HANDSHAKE_ERR 2012
#define CR_SERVER_LOST 2013
#define CR_COMMANDS_OUT_OF_SYNC 2014
#define CR_NAMEDPIPE_CONNECTION 2015
#define CR_NAMEDPIPEWAIT_ERROR 2016
#define CR_NAMEDPIPEOPEN_ERROR 2017
#define CR_NAMEDPIPESETSTATE_ERROR 2018
#define CR_CANT_READ_CHARSET 2019
#define CR_NET_PACKET_TOO_LARGE 2020
#define CR_EMBEDDED_CONNECTION 2021
#define CR_PROBE_SLAVE_STATUS 2022
#define CR_PROBE_SLAVE_HOSTS 2023
#define CR_PROBE_SLAVE_CONNECT 2024
#define CR_PROBE_MASTER_CONNECT 2025
#define CR_SSL_CONNECTION_ERROR 2026
#define CR_MALFORMED_PACKET 2027

View File

@ -0,0 +1,67 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
/* some definitions for full-text indices */
/* #include "myisam.h" */
#ifndef _ft_global_h
#define _ft_global_h
#ifdef __cplusplus
extern "C" {
#endif
#define FT_QUERY_MAXLEN 1024
#define HA_FT_MAXLEN 254
typedef struct st_ft_info FT_INFO;
struct _ft_vft
{
int (*read_next)(FT_INFO *, char *);
float (*find_relevance)(FT_INFO *, byte *, uint);
void (*close_search)(FT_INFO *);
float (*get_relevance)(FT_INFO *);
void (*reinit_search)(FT_INFO *);
};
#ifndef FT_CORE
struct st_ft_info
{
struct _ft_vft *please; /* INTERCAL style :-) */
};
#endif
extern const char *ft_stopword_file;
extern const char *ft_precompiled_stopwords[];
extern ulong ft_min_word_len;
extern ulong ft_max_word_len;
extern ulong ft_max_word_len_for_sort;
extern const char *ft_boolean_syntax;
int ft_init_stopwords(void);
void ft_free_stopwords(void);
#define FT_NL 0
#define FT_BOOL 1
FT_INFO *ft_init_search(uint,void *, uint, byte *, uint, my_bool);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,66 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Dynamic hashing of record with different key-length */
#ifndef _hash_h
#define _hash_h
#ifdef __cplusplus
extern "C" {
#endif
typedef byte *(*hash_get_key)(const byte *,uint*,my_bool);
typedef void (*hash_free_key)(void *);
/* flags for hash_init */
#define HASH_CASE_INSENSITIVE 1
typedef struct st_hash_info {
uint next; /* index to next key */
byte *data; /* data for current entry */
} HASH_LINK;
typedef struct st_hash {
uint key_offset,key_length; /* Length of key if const length */
uint records,blength,current_record;
uint flags;
DYNAMIC_ARRAY array; /* Place for hash_keys */
hash_get_key get_key;
void (*free)(void *);
uint (*calc_hashnr)(const byte *key,uint length);
} HASH;
#define hash_init(A,B,C,D,E,F,G) _hash_init(A,B,C,D,E,F,G CALLER_INFO)
my_bool _hash_init(HASH *hash,uint default_array_elements, uint key_offset,
uint key_length, hash_get_key get_key,
void (*free_element)(void*), uint flags CALLER_INFO_PROTO);
void hash_free(HASH *tree);
byte *hash_element(HASH *hash,uint idx);
gptr hash_search(HASH *info,const byte *key,uint length);
gptr hash_next(HASH *info,const byte *key,uint length);
my_bool hash_insert(HASH *info,const byte *data);
my_bool hash_delete(HASH *hash,byte *record);
my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length);
void hash_replace(HASH *hash, uint idx, byte *new_row);
my_bool hash_check(HASH *hash); /* Only in debug library */
#define hash_clear(H) bzero((char*) (H),sizeof(*(H)))
#define hash_inited(H) ((H)->array.buffer != 0)
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,185 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* This file should be included when using heap_database_funktions */
/* Author: Michael Widenius */
#ifndef _heap_h
#define _heap_h
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _my_base_h
#include <my_base.h>
#endif
#ifdef THREAD
#include <my_pthread.h>
#include <thr_lock.h>
#endif
/* defines used by heap-funktions */
#define HP_MAX_LEVELS 4 /* 128^5 records is enough */
#define HP_PTRS_IN_NOD 128
/* struct used with heap_funktions */
typedef struct st_heapinfo /* Struct from heap_info */
{
ulong records; /* Records in database */
ulong deleted; /* Deleted records in database */
ulong max_records;
ulong data_length;
ulong index_length;
uint reclength; /* Length of one record */
int errkey;
my_bool implicit_emptied;
} HEAPINFO;
/* Structs used by heap-database-handler */
typedef struct st_heap_ptrs
{
byte *blocks[HP_PTRS_IN_NOD]; /* pointers to HP_PTRS or records */
} HP_PTRS;
struct st_level_info
{
uint free_ptrs_in_block,records_under_level;
HP_PTRS *last_blocks; /* pointers to HP_PTRS or records */
};
typedef struct st_heap_block /* The data is saved in blocks */
{
HP_PTRS *root;
struct st_level_info level_info[HP_MAX_LEVELS+1];
uint levels;
uint records_in_block; /* Records in a heap-block */
uint recbuffer; /* Length of one saved record */
ulong last_allocated; /* Blocks allocated, used by keys */
} HP_BLOCK;
typedef struct st_hp_keyseg /* Key-portion */
{
uint start; /* Start of key in record (from 0) */
uint length; /* Keylength */
uint type;
uint null_bit; /* bit set in row+null_pos */
uint null_pos;
} HP_KEYSEG;
typedef struct st_hp_keydef /* Key definition with open */
{
uint flag; /* HA_NOSAME |<7C>HA_NULL_PART_KEY */
uint keysegs; /* Number of key-segment */
uint length; /* Length of key (automatic) */
HP_KEYSEG *seg;
HP_BLOCK block; /* Where keys are saved */
} HP_KEYDEF;
typedef struct st_heap_share
{
HP_BLOCK block;
HP_KEYDEF *keydef;
ulong min_records,max_records; /* Params to open */
ulong data_length,index_length;
uint records; /* records */
uint blength;
uint deleted; /* Deleted records in database */
uint reclength; /* Length of one record */
uint changed;
uint keys,max_key_length;
uint open_count;
byte *del_link; /* Link to next block with del. rec */
my_string name; /* Name of "memory-file" */
#ifdef THREAD
THR_LOCK lock;
pthread_mutex_t intern_lock; /* Locking for use with _locking */
#endif
my_bool delete_on_close;
LIST open_list;
} HP_SHARE;
struct st_hp_hash_info;
typedef struct st_heap_info
{
HP_SHARE *s;
byte *current_ptr;
struct st_hp_hash_info *current_hash_ptr;
ulong current_record,next_block;
int lastinx,errkey;
int mode; /* Mode of file (READONLY..) */
uint opt_flag,update;
byte *lastkey; /* Last used key with rkey */
my_bool implicit_emptied;
#ifdef THREAD
THR_LOCK_DATA lock;
#endif
LIST open_list;
} HP_INFO;
/* Prototypes for heap-functions */
extern HP_INFO* heap_open(const char *name,int mode,uint keys,
HP_KEYDEF *keydef,uint reclength,
ulong max_records,ulong min_reloc);
extern int heap_close(HP_INFO *info);
extern int heap_write(HP_INFO *info,const byte *buff);
extern int heap_update(HP_INFO *info,const byte *old,const byte *newdata);
extern int heap_rrnd(HP_INFO *info,byte *buf,byte *pos);
extern int heap_scan_init(HP_INFO *info);
extern int heap_scan(register HP_INFO *info, byte *record);
extern int heap_delete(HP_INFO *info,const byte *buff);
extern int heap_info(HP_INFO *info,HEAPINFO *x,int flag);
extern int heap_create(const char *name);
extern int heap_delete_table(const char *name);
extern int heap_extra(HP_INFO *info,enum ha_extra_function function);
extern int heap_rename(const char *old_name,const char *new_name);
extern int heap_panic(enum ha_panic_function flag);
extern int heap_rsame(HP_INFO *info,byte *record,int inx);
extern int heap_rnext(HP_INFO *info,byte *record);
extern int heap_rprev(HP_INFO *info,byte *record);
extern int heap_rfirst(HP_INFO *info,byte *record);
extern int heap_rlast(HP_INFO *info,byte *record);
extern void heap_clear(HP_INFO *info);
extern int heap_rkey(HP_INFO *info,byte *record,int inx,const byte *key);
extern gptr heap_find(HP_INFO *info,int inx,const byte *key);
extern int heap_check_heap(HP_INFO *info, my_bool print_status);
extern byte *heap_position(HP_INFO *info);
/* The following is for programs that uses the old HEAP interface where
pointer to rows where a long instead of a (byte*).
*/
#if defined(WANT_OLD_HEAP_VERSION) || defined(OLD_HEAP_VERSION)
extern int heap_rrnd_old(HP_INFO *info,byte *buf,ulong pos);
extern ulong heap_position_old(HP_INFO *info);
#endif
#ifdef OLD_HEAP_VERSION
typedef ulong HEAP_PTR;
#define heap_position(A) heap_position_old(A)
#define heap_rrnd(A,B,C) heap_rrnd_old(A,B,C)
#else
typedef byte *HEAP_PTR;
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,172 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
A better inplementation of the UNIX ctype(3) library.
Notes: my_global.h should be included before ctype.h
*/
#ifndef _m_ctype_h
#define _m_ctype_h
#ifdef __cplusplus
extern "C" {
#endif
#define CHARSET_DIR "charsets/"
typedef struct charset_info_st
{
uint number;
const char *name;
uchar *ctype;
uchar *to_lower;
uchar *to_upper;
uchar *sort_order;
uint strxfrm_multiply;
int (*strcoll)(const uchar *, const uchar *);
int (*strxfrm)(uchar *, const uchar *, int);
int (*strnncoll)(const uchar *, int, const uchar *, int);
int (*strnxfrm)(uchar *, const uchar *, int, int);
my_bool (*like_range)(const char *, uint, pchar, uint,
char *, char *, uint *, uint *);
uint mbmaxlen;
int (*ismbchar)(const char *, const char *);
my_bool (*ismbhead)(uint);
int (*mbcharlen)(uint);
} CHARSET_INFO;
/* strings/ctype.c */
extern CHARSET_INFO *default_charset_info;
extern CHARSET_INFO *find_compiled_charset(uint cs_number);
extern CHARSET_INFO *find_compiled_charset_by_name(const char *name);
extern CHARSET_INFO compiled_charsets[];
extern uint compiled_charset_number(const char *name);
extern const char *compiled_charset_name(uint charset_number);
#define MY_CHARSET_UNDEFINED 0
#define MY_CHARSET_CURRENT (default_charset_info->number)
/* Don't include std ctype.h when this is included */
#define _CTYPE_H
#define _CTYPE_H_
#define _CTYPE_INCLUDED
#define __CTYPE_INCLUDED
#define _CTYPE_USING /* Don't put names in global namespace. */
/* Fix things, if ctype.h would have been included before */
#undef toupper
#undef _toupper
#undef _tolower
#undef toupper
#undef tolower
#undef isalpha
#undef isupper
#undef islower
#undef isdigit
#undef isxdigit
#undef isalnum
#undef isspace
#undef ispunct
#undef isprint
#undef isgraph
#undef iscntrl
#undef isascii
#undef toascii
#define _U 01 /* Upper case */
#define _L 02 /* Lower case */
#define _NMR 04 /* Numeral (digit) */
#define _SPC 010 /* Spacing character */
#define _PNT 020 /* Punctuation */
#define _CTR 040 /* Control character */
#define _B 0100 /* Blank */
#define _X 0200 /* heXadecimal digit */
#define my_ctype (default_charset_info->ctype)
#define my_to_upper (default_charset_info->to_upper)
#define my_to_lower (default_charset_info->to_lower)
#define my_sort_order (default_charset_info->sort_order)
#define _toupper(c) (char) my_to_upper[(uchar) (c)]
#define _tolower(c) (char) my_to_lower[(uchar) (c)]
#define toupper(c) (char) my_to_upper[(uchar) (c)]
#define tolower(c) (char) my_to_lower[(uchar) (c)]
#define isalpha(c) ((my_ctype+1)[(uchar) (c)] & (_U | _L))
#define isupper(c) ((my_ctype+1)[(uchar) (c)] & _U)
#define islower(c) ((my_ctype+1)[(uchar) (c)] & _L)
#define isdigit(c) ((my_ctype+1)[(uchar) (c)] & _NMR)
#define isxdigit(c) ((my_ctype+1)[(uchar) (c)] & _X)
#define isalnum(c) ((my_ctype+1)[(uchar) (c)] & (_U | _L | _NMR))
#define isspace(c) ((my_ctype+1)[(uchar) (c)] & _SPC)
#define ispunct(c) ((my_ctype+1)[(uchar) (c)] & _PNT)
#define isprint(c) ((my_ctype+1)[(uchar) (c)] & (_PNT | _U | _L | _NMR | _B))
#define isgraph(c) ((my_ctype+1)[(uchar) (c)] & (_PNT | _U | _L | _NMR))
#define iscntrl(c) ((my_ctype+1)[(uchar) (c)] & _CTR)
#define isascii(c) (!((c) & ~0177))
#define toascii(c) ((c) & 0177)
#ifdef ctype
#undef ctype
#endif /* ctype */
#define my_isalpha(s, c) (((s)->ctype+1)[(uchar) (c)] & (_U | _L))
#define my_isupper(s, c) (((s)->ctype+1)[(uchar) (c)] & _U)
#define my_islower(s, c) (((s)->ctype+1)[(uchar) (c)] & _L)
#define my_isdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _NMR)
#define my_isxdigit(s, c) (((s)->ctype+1)[(uchar) (c)] & _X)
#define my_isalnum(s, c) (((s)->ctype+1)[(uchar) (c)] & (_U | _L | _NMR))
#define my_isspace(s, c) (((s)->ctype+1)[(uchar) (c)] & _SPC)
#define my_ispunct(s, c) (((s)->ctype+1)[(uchar) (c)] & _PNT)
#define my_isprint(s, c) (((s)->ctype+1)[(uchar) (c)] & (_PNT | _U | _L | _NMR | _B))
#define my_isgraph(s, c) (((s)->ctype+1)[(uchar) (c)] & (_PNT | _U | _L | _NMR))
#define my_iscntrl(s, c) (((s)->ctype+1)[(uchar) (c)] & _CTR)
#define use_strcoll(s) ((s)->strcoll != NULL)
#define MY_STRXFRM_MULTIPLY (default_charset_info->strxfrm_multiply)
#define my_strnxfrm(s, a, b, c, d) ((s)->strnxfrm((a), (b), (c), (d)))
#define my_strnncoll(s, a, b, c, d) ((s)->strnncoll((a), (b), (c), (d)))
#define my_strcoll(s, a, b) ((s)->strcoll((a), (b)))
#define my_like_range(s, a, b, c, d, e, f, g, h) \
((s)->like_range((a), (b), (c), (d), (e), (f), (g), (h)))
#define use_mb(s) ((s)->ismbchar != NULL)
#define MBMAXLEN (default_charset_info->mbmaxlen)
#define my_ismbchar(s, a, b) ((s)->ismbchar((a), (b)))
#define my_ismbhead(s, a) ((s)->ismbhead((a)))
#define my_mbcharlen(s, a) ((s)->mbcharlen((a)))
/* Some macros that should be cleaned up a little */
#define isvar(c) (isalnum(c) || (c) == '_')
#define isvar_start(c) (isalpha(c) || (c) == '_')
#define tocntrl(c) ((c) & 31)
#define toprint(c) ((c) | 64)
/* XXX: still need to take care of this one */
#ifdef MY_CHARSET_TIS620
#error The TIS620 charset is broken at the moment. Tell tim to fix it.
#define USE_TIS620
#include "t_ctype.h"
#endif
#ifdef __cplusplus
}
#endif
#endif /* _m_ctype_h */

View File

@ -0,0 +1,254 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* There may be prolems include all of theese. Try to test in
configure with ones are needed? */
/* This is needed for the definitions of strchr... on solaris */
#ifndef _m_string_h
#define _m_string_h
#ifndef __USE_GNU
#define __USE_GNU /* We want to use stpcpy */
#endif
#if defined(HAVE_STRINGS_H)
#include <strings.h>
#endif
#if defined(HAVE_STRING_H)
#include <string.h>
#endif
/* Correct some things for UNIXWARE7 */
#ifdef HAVE_UNIXWARE7_THREADS
#undef HAVE_STRINGS_H
#undef HAVE_MEMORY_H
#define HAVE_MEMCPY
#ifndef HAVE_MEMMOVE
#define HAVE_MEMMOVE
#endif
#undef HAVE_BCMP
#undef bcopy
#undef bcmp
#undef bzero
#endif /* HAVE_UNIXWARE7_THREADS */
#ifdef _AIX
#undef HAVE_BCMP
#endif
/* This is needed for the definitions of bzero... on solaris */
#if defined(HAVE_STRINGS_H) && !defined(HAVE_mit_thread)
#include <strings.h>
#endif
/* This is needed for the definitions of memcpy... on solaris */
#if defined(HAVE_MEMORY_H) && !defined(__cplusplus)
#include <memory.h>
#endif
#if !defined(HAVE_MEMCPY) && !defined(HAVE_MEMMOVE)
# define memcpy(d, s, n) bcopy ((s), (d), (n))
# define memset(A,C,B) bfill((A),(B),(C))
# define memmove(d, s, n) bmove ((d), (s), (n))
#elif defined(HAVE_MEMMOVE)
# define bmove(d, s, n) memmove((d), (s), (n))
#else
# define memmove(d, s, n) bmove((d), (s), (n)) /* our bmove */
#endif
/* Unixware 7 */
#if !defined(HAVE_BFILL)
# define bfill(A,B,C) memset((A),(C),(B))
# define bmove_allign(A,B,C) memcpy((A),(B),(C))
#endif
#if !defined(HAVE_BCMP)
# define bcopy(s, d, n) memcpy((d), (s), (n))
# define bcmp(A,B,C) memcmp((A),(B),(C))
# define bzero(A,B) memset((A),0,(B))
# define bmove_allign(A,B,C) memcpy((A),(B),(C))
#endif
#if defined(__cplusplus) && !defined(OS2)
extern "C" {
#endif
#if defined(HAVE_STPCPY) && !defined(HAVE_mit_thread)
#define strmov(A,B) stpcpy((A),(B))
#ifndef stpcpy
extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
#endif
#endif
extern char NEAR _dig_vec[]; /* Declared in int2str() */
#ifdef BAD_STRING_COMPILER
#define strmov(A,B) (memccpy(A,B,0,INT_MAX)-1)
#else
#define strmov_overlapp(A,B) strmov(A,B)
#define strmake_overlapp(A,B,C) strmake(A,B,C)
#endif
#ifdef BAD_MEMCPY /* Problem with gcc on Alpha */
#define memcpy_fixed(A,B,C) bmove((A),(B),(C))
#else
#define memcpy_fixed(A,B,C) memcpy((A),(B),(C))
#endif
#ifdef MSDOS
#undef bmove_allign
#define bmove512(A,B,C) bmove_allign(A,B,C)
#define my_itoa(A,B,C) itoa(A,B,C)
#define my_ltoa(A,B,C) ltoa(A,B,C)
extern void bmove_allign(gptr dst,const gptr src,uint len);
#endif
#if (!defined(USE_BMOVE512) || defined(HAVE_purify)) && !defined(bmove512)
#define bmove512(A,B,C) memcpy(A,B,C)
#endif
#ifdef HAVE_purify
#include <assert.h>
#define memcpy_overlap(A,B,C) \
DBUG_ASSERT((A) == (B) || ((A)+(C)) <= (B) || ((B)+(C)) <= (A)); \
bmove((byte*) key,(byte*) from,(size_t) length);
#else
#define memcpy_overlap(A,B,C) memcpy((A), (B), (C))
#endif /* HAVE_purify */
/* Prototypes for string functions */
#if !defined(bfill) && !defined(HAVE_BFILL)
extern void bfill(gptr dst,uint len,pchar fill);
#endif
#if !defined(bzero) && !defined(HAVE_BZERO)
extern void bzero(gptr dst,uint len);
#endif
#if !defined(bcmp) && !defined(HAVE_BCMP)
extern int bcmp(const char *s1,const char *s2,uint len);
#endif
#ifdef HAVE_purify
extern int my_bcmp(const char *s1,const char *s2,uint len);
#undef bcmp
#define bcmp(A,B,C) my_bcmp((A),(B),(C))
#endif
#ifndef bmove512
extern void bmove512(gptr dst,const gptr src,uint len);
#endif
#if !defined(HAVE_BMOVE) && !defined(bmove)
extern void bmove(char *dst, const char *src,uint len);
#endif
extern void bmove_upp(char *dst,const char *src,uint len);
extern void bchange(char *dst,uint old_len,const char *src,
uint new_len,uint tot_len);
extern void strappend(char *s,uint len,pchar fill);
extern char *strend(const char *s);
extern char *strcend(const char *, pchar);
extern char *strfield(char *src,int fields,int chars,int blanks,
int tabch);
extern char *strfill(my_string s,uint len,pchar fill);
extern uint strinstr(const char *str,const char *search);
extern uint r_strinstr(reg1 my_string str,int from, reg4 my_string search);
extern char *strkey(char *dst,char *head,char *tail,char *flags);
extern char *strmake(char *dst,const char *src,uint length);
#ifndef strmake_overlapp
extern char *strmake_overlapp(char *dst,const char *src, uint length);
#endif
#ifndef strmov
extern char *strmov(char *dst,const char *src);
#endif
extern char *strnmov(char *dst,const char *src,uint n);
extern char *strsuff(const char *src,const char *suffix);
extern char *strcont(const char *src,const char *set);
extern char *strxcat _VARARGS((char *dst,const char *src, ...));
extern char *strxmov _VARARGS((char *dst,const char *src, ...));
extern char *strxcpy _VARARGS((char *dst,const char *src, ...));
extern char *strxncat _VARARGS((char *dst,uint len, const char *src, ...));
extern char *strxnmov _VARARGS((char *dst,uint len, const char *src, ...));
extern char *strxncpy _VARARGS((char *dst,uint len, const char *src, ...));
/* Prototypes of normal stringfunctions (with may ours) */
#ifdef WANT_STRING_PROTOTYPES
extern char *strcat(char *, const char *);
extern char *strchr(const char *, pchar);
extern char *strrchr(const char *, pchar);
extern char *strcpy(char *, const char *);
extern int strcmp(const char *, const char *);
#ifndef __GNUC__
extern size_t strlen(const char *);
#endif
#endif
#ifndef HAVE_STRNLEN
extern uint strnlen(const char *s, uint n);
#endif
#if !defined(__cplusplus)
#ifndef HAVE_STRPBRK
extern char *strpbrk(const char *, const char *);
#endif
#ifndef HAVE_STRSTR
extern char *strstr(const char *, const char *);
#endif
#endif
extern int is_prefix(const char *, const char *);
/* Conversion rutins */
#ifdef USE_MY_ITOA
extern char *my_itoa(int val,char *dst,int radix);
extern char *my_ltoa(long val,char *dst,int radix);
#endif
extern char *llstr(longlong value,char *buff);
#ifndef HAVE_STRTOUL
extern long strtol(const char *str, char **ptr, int base);
extern ulong strtoul(const char *str, char **ptr, int base);
#endif
extern char *int2str(long val,char *dst,int radix);
extern char *int10_to_str(long val,char *dst,int radix);
extern char *str2int(const char *src,int radix,long lower,long upper,
long *val);
#if SIZEOF_LONG == SIZEOF_LONG_LONG
#define longlong2str(A,B,C) int2str((A),(B),(C))
#define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C))
#define strtoll(A,B,C) strtol((A),(B),(C))
#define strtoull(A,B,C) strtoul((A),(B),(C))
#ifndef HAVE_STRTOULL
#define HAVE_STRTOULL
#endif
#else
#ifdef HAVE_LONG_LONG
extern char *longlong2str(longlong val,char *dst,int radix);
extern char *longlong10_to_str(longlong val,char *dst,int radix);
#if (!defined(HAVE_STRTOULL) || defined(HAVE_mit_thread)) || defined(NO_STRTOLL_PROTO)
extern longlong strtoll(const char *str, char **ptr, int base);
extern ulonglong strtoull(const char *str, char **ptr, int base);
#endif
#endif
#endif
#if defined(__cplusplus) && !defined(OS2)
}
#endif
#endif

View File

@ -0,0 +1,93 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* MD5.H - header file for MD5C.C
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
/* GLOBAL.H - RSAREF types and constants
*/
/* PROTOTYPES should be set to one if and only if the compiler supports
function argument prototyping.
The following makes PROTOTYPES default to 0 if it has not already
been defined with C compiler flags.
*/
/* egcs 1.1.2 under linux didn't defined it.... :( */
#ifndef PROTOTYPES
#define PROTOTYPES 1 /* Assume prototypes */
#endif
/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;
/* UINT2 defines a two byte word */
typedef uint16 UINT2; /* Fix for MySQL / Alpha */
/* UINT4 defines a four byte word */
typedef uint32 UINT4; /* Fix for MySQL / Alpha */
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
returns an empty list.
*/
#if PROTOTYPES
#define PROTO_LIST(list) list
#else
#define PROTO_LIST(list) ()
#endif
/* MD5 context. */
typedef struct {
UINT4 state[4]; /* state (ABCD) */
UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} my_MD5_CTX;
#ifdef __cplusplus
extern "C" {
#endif
void my_MD5Init PROTO_LIST ((my_MD5_CTX *));
void my_MD5Update PROTO_LIST
((my_MD5_CTX *, unsigned char *, unsigned int));
void my_MD5Final PROTO_LIST ((unsigned char [16], my_MD5_CTX *));
#ifdef __cplusplus
}
#endif

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