Compare commits
97 Commits
amxmodx-1.
...
amxmodx-1.
Author | SHA1 | Date | |
---|---|---|---|
0579070159 | |||
8bb01423b9 | |||
401a23a298 | |||
7ac9ed4b80 | |||
6fdcd8ffae | |||
d50a6302e0 | |||
5fd891bc32 | |||
864f7c268e | |||
4770f28a18 | |||
51a4e2bf4e | |||
c213c771d2 | |||
0176d3a2ae | |||
92653ceebc | |||
c9051ad364 | |||
94d350118d | |||
2e22dde409 | |||
4dad81af30 | |||
b271b01b13 | |||
a17b879380 | |||
ea05af9fe8 | |||
d661196429 | |||
1114443a43 | |||
d802a3c961 | |||
e2226ae809 | |||
fd8a27013b | |||
b12224eabd | |||
c30c3cf35c | |||
f828cde999 | |||
d05c381789 | |||
245054cf48 | |||
da82ce757f | |||
4d74743138 | |||
c1db39d086 | |||
d516824936 | |||
10328f5f81 | |||
d4f09aac74 | |||
8f97ed7934 | |||
1fcf7628a3 | |||
bdd740f8ab | |||
82fed37247 | |||
5b208eb9f5 | |||
9be88ffa42 | |||
f54d112bbb | |||
96c4d33da4 | |||
bad4c02647 | |||
70140ffc8f | |||
53e6bb6b50 | |||
4cb7986426 | |||
18ba13be84 | |||
dd371c4dbe | |||
7ea47c5a96 | |||
5693d2629e | |||
24d9e3266e | |||
b3b3ce4c2d | |||
5882802a3e | |||
94e19aae0c | |||
7d51404aeb | |||
1cdb12c4e4 | |||
e9993cce25 | |||
80bd845182 | |||
f986202b06 | |||
a4168a2096 | |||
3e85589930 | |||
b5a57da29c | |||
58fec512e5 | |||
a6ca045086 | |||
e401231d25 | |||
9ddc24898f | |||
f5350c0e0e | |||
fa64bef511 | |||
29bfd81b36 | |||
2d2506f1c4 | |||
f334fec0a3 | |||
03b6d3e77d | |||
661f6c9851 | |||
593e013572 | |||
b04498cddb | |||
8648bf32a3 | |||
1768ae4b23 | |||
80e6d31998 | |||
381e331dda | |||
13c65f006b | |||
4e8eff3e04 | |||
572ad38366 | |||
b2ade117ec | |||
9eb36bd2bb | |||
85b7ac740b | |||
98d3fb79d7 | |||
bf092b4f95 | |||
a4a9613f5b | |||
ad86bf636f | |||
d0b5886d7d | |||
aa75a143fc | |||
7144f5c794 | |||
befb651268 | |||
c8fdea6216 | |||
4a6a16c627 |
@ -273,4 +273,5 @@ void CmdMngr::clearBufforedInfo() {
|
||||
buf_cmdaccess = 0;
|
||||
}
|
||||
|
||||
int CmdMngr::Command::uniqueid = 0;
|
||||
int CmdMngr::Command::uniqueid = 0;
|
||||
|
||||
|
@ -244,18 +244,12 @@ void CPluginMngr::CPlugin::Finalize()
|
||||
}
|
||||
}
|
||||
|
||||
void CPluginMngr::CPlugin::pauseFunction( int id ) {
|
||||
if (isValid()){
|
||||
paused_fun |= (1<<id);
|
||||
g_commands.clearBufforedInfo();
|
||||
}
|
||||
void CPluginMngr::CPlugin::pauseFunction( int id )
|
||||
{
|
||||
}
|
||||
|
||||
void CPluginMngr::CPlugin::unpauseFunction( int id ) {
|
||||
if (isValid()) {
|
||||
paused_fun &= ~(1<<id);
|
||||
g_commands.clearBufforedInfo();
|
||||
}
|
||||
void CPluginMngr::CPlugin::unpauseFunction( int id )
|
||||
{
|
||||
}
|
||||
|
||||
void CPluginMngr::CPlugin::setStatus( int a ) {
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
inline void setAuthor( const char* n ) { author.assign(n); }
|
||||
inline void setVersion( const char* n ) { version.assign(n); }
|
||||
inline void setError( const char* n ) { errorMsg.assign(n); }
|
||||
inline bool isValid() const { return ((status == ps_running) && (status != ps_locked)); }
|
||||
inline bool isValid() const { return ((status == ps_running || status == ps_paused)); }
|
||||
inline bool isPaused() const { return ( (status == ps_paused) ); }
|
||||
//inline bool isFunctionPaused( int id ) const { return (paused_fun & (1<<id)) ? true : false; }
|
||||
inline bool isExecutable(int id) const { return (isValid() && !isPaused()); }
|
||||
|
@ -53,8 +53,14 @@ void CTaskMngr::CTask::set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags,
|
||||
m_iId = iId;
|
||||
m_fBase = fBase;
|
||||
|
||||
m_iRepeat = (iFlags & 1) ? iRepeat : 0;
|
||||
m_bLoop = (iFlags & 2) ? true : false;
|
||||
if (iFlags & 2)
|
||||
{
|
||||
m_bLoop = true;
|
||||
m_iRepeat = -1;
|
||||
} else if (iFlags & 1) {
|
||||
m_bLoop = true;
|
||||
m_iRepeat = iRepeat;
|
||||
}
|
||||
m_bAfterStart = (iFlags & 4) ? true : false;
|
||||
m_bBeforeEnd = (iFlags & 8) ? true : false;
|
||||
|
||||
@ -118,6 +124,7 @@ void CTaskMngr::CTask::resetNextExecTime(float fCurrentTime)
|
||||
void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, float fTimeLeft)
|
||||
{
|
||||
bool execute=false;
|
||||
bool done=false;
|
||||
if (m_bAfterStart)
|
||||
{
|
||||
if (fCurrentTime - fTimeLeft + 1.0f >= m_fBase)
|
||||
@ -127,31 +134,41 @@ void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, f
|
||||
{
|
||||
if (fTimeLimit != 0.0f && (fTimeLeft + fTimeLimit * 60.0f) - fCurrentTime - 1.0f <= m_fBase)
|
||||
execute = true;
|
||||
}
|
||||
else if (m_fNextExecTime <= fCurrentTime)
|
||||
} else if (m_fNextExecTime <= fCurrentTime) {
|
||||
execute = true;
|
||||
}
|
||||
|
||||
if (execute)
|
||||
{
|
||||
if (m_iParamLen) // call with parameters
|
||||
//only bother calling if we have something to call
|
||||
if ( !(m_bLoop && !m_iRepeat) )
|
||||
{
|
||||
cell arr = prepareCellArray(m_pParams, m_iParamLen);
|
||||
executeForwards(m_iFunc, arr, m_iId);
|
||||
} else {
|
||||
executeForwards(m_iFunc, m_iId);
|
||||
if (m_iParamLen) // call with parameters
|
||||
{
|
||||
cell arr = prepareCellArray(m_pParams, m_iParamLen);
|
||||
executeForwards(m_iFunc, arr, m_iId);
|
||||
} else {
|
||||
executeForwards(m_iFunc, m_iId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isFree())
|
||||
return;
|
||||
|
||||
// set new exec time OR remove the task if needed
|
||||
if (m_bLoop || (m_iRepeat-- > 0))
|
||||
if (m_bLoop)
|
||||
{
|
||||
m_fNextExecTime += m_fBase;
|
||||
if (m_iRepeat != -1 && --m_iRepeat <= 0)
|
||||
done = true;
|
||||
} else {
|
||||
done = true;
|
||||
}
|
||||
else
|
||||
|
||||
if (done)
|
||||
{
|
||||
clear(); // hamster
|
||||
clear();
|
||||
} else {
|
||||
m_fNextExecTime += m_fBase;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,7 +6,7 @@ MM_ROOT = ../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc
|
||||
NAME = amxmodx_mm
|
||||
@ -15,7 +15,7 @@ OBJECTS = meta_api.cpp CFile.cpp CVault.cpp vault.cpp float.cpp file.cpp modules
|
||||
CMisc.cpp CTask.cpp string.cpp amxmodx.cpp CEvent.cpp CCmd.cpp CLogEvent.cpp \
|
||||
srvcmd.cpp strptime.cpp amxcore.cpp amxtime.cpp power.cpp amxxlog.cpp fakemeta.cpp \
|
||||
amxxfile.cpp CLang.cpp md5.cpp emsg.cpp CForward.cpp CPlugin.cpp CModule.cpp \
|
||||
CMenu.cpp util.cpp amx.cpp amxdbg.cpp natives.cpp newmenus.cpp \
|
||||
CMenu.cpp util.cpp amx.cpp amxdbg.cpp natives.cpp newmenus.cpp
|
||||
|
||||
LINK = -lz
|
||||
|
||||
@ -31,16 +31,16 @@ else
|
||||
endif
|
||||
|
||||
ifeq "$(MMGR)" "true"
|
||||
OBJECTS += MMGR/MMGR.CPP
|
||||
OBJECTS += mmgr/mmgr.cpp
|
||||
CFLAGS += -DMEMORY_TEST
|
||||
endif
|
||||
|
||||
CFLAGS += -DLINUX -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
|
||||
CFLAGS += -DLINUX -DNDEBUG -fPIC -Wno-deprecated -DHAVE_STDINT_H -static-libgcc -fno-rtti -fno-exceptions
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_amd64.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
OBJECTS += JIT/natives-amd64.o
|
||||
LINK += -lstdc++
|
||||
else
|
||||
BINARY = $(NAME)_i386.so
|
||||
OBJECTS += JIT/amxexecn.o JIT/amxjitsn.o JIT/natives-x86.o
|
||||
|
@ -10,7 +10,7 @@
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* 1. The origin of this software must not be misreprfesented; you must not
|
||||
* claim that you wrote the original software. If you use this software in
|
||||
* a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
@ -1081,7 +1081,9 @@ int AMXAPI amx_InitJIT(AMX *amx, void *reloc_table, void *native_code)
|
||||
|
||||
/* JIT rulz! (TM) */
|
||||
/* MP: added check for correct compilation */
|
||||
if ((res = asm_runJIT(amx->base, reloc_table, native_code)) != 0) {
|
||||
//Fixed bug (thanks T(+)rget)
|
||||
if ((res = asm_runJIT(amx->base, reloc_table, native_code)) == 0)
|
||||
{
|
||||
/* update the required memory size (the previous value was a
|
||||
* conservative estimate, now we know the exact size)
|
||||
*/
|
||||
|
@ -21,17 +21,26 @@
|
||||
; step.
|
||||
|
||||
; NOTE 3:
|
||||
; During execution of the compiled code with amx_exec_jit() the x86 processor's
|
||||
; stack is switched into the data section of the abstract machine. This means
|
||||
; that there should always be enough memory left between HEA and STK to provide
|
||||
; stack space for occurring interrupts! (see the STACKRESERVE variable)
|
||||
|
||||
; NOTE 4:
|
||||
; Although the Pawn compiler doesn't generate the LCTRL, SCTRL and CALL.I
|
||||
; instructions, I have to tell that they don't work as expected in a JIT
|
||||
; compiled program, because there is no easy way of transforming AMX code
|
||||
; addresses and JIT translated ones. This might be fixed in a future version.
|
||||
|
||||
; NOTE 4:
|
||||
; Stack Pointer issues (by David Anderson)
|
||||
; The JIT was changed recently so it no longer uses ESP as a general purpose
|
||||
; register (GRP), because it can conflict with threading/signal systems which
|
||||
; rely on the stack pointer being in-tact to find thread-ids. My fix for this
|
||||
; was to keep esp safe, but save the stack pointer in 'ecx'. As such, ecx is no
|
||||
; longer the CIP or scratch register, it is the save point for pieces of the AMX
|
||||
; structure on the x86 stack.
|
||||
; This means that the optimization of the JIT has changed, as every amx stack
|
||||
; push call now takes two operations instead of one (same for pop), and pushing
|
||||
; addresses is 4 instructions instead of 1.
|
||||
; As of this moment I don't see a better way around it, but the sacrifice for
|
||||
; having pthread-safe code was deemed to be necessary.
|
||||
|
||||
; NOTE 5:
|
||||
; NX ("No eXecute") and XD (eXecution Denied) bits
|
||||
; (by Thiadmer Riemersma)
|
||||
;
|
||||
@ -65,7 +74,8 @@
|
||||
; segment: the JIT-compiler patches P-code parameters into its own code segment
|
||||
; during compilation. This is handled in the support code for amx_InitJIT.
|
||||
;
|
||||
;
|
||||
|
||||
; NOTE 6:
|
||||
; CALLING CONVENTIONS
|
||||
; (by Thiadmer Riemersma)
|
||||
;
|
||||
@ -77,9 +87,16 @@
|
||||
; a reserved word on the assembler, I had to choose a different name for the
|
||||
; macro, hence STDECL.)
|
||||
|
||||
|
||||
; Revision History
|
||||
; ----------------
|
||||
; 26 july 2005 by David "BAILOPAN" Anderson
|
||||
; 16 august 2005 by David "BAILOPAN" Anderson (DA)
|
||||
; Changed JIT to not swap stack pointer during execution. This
|
||||
; is playing with fire, especially with pthreads and signals on linux,
|
||||
; where the stack pointer is used to find the current thread id. If
|
||||
; the stack pointer is altered during a thread/signal switch/interrupt
|
||||
; unexpected behaviour can occur (crashes).
|
||||
; 26 july 2005 by David "BAILOPAN" Anderson (DA)
|
||||
; Fixed a bug where zero casetbl entries would crash the JIT.
|
||||
; 17 february 2005 by Thiadmer Riemersms
|
||||
; Addition of the BREAK opcode, removal of the older debugging opcode
|
||||
@ -165,15 +182,6 @@
|
||||
;
|
||||
%define FORCERELOCATABLE
|
||||
|
||||
;
|
||||
; Determines how much memory should be reserved for occurring interrupts.
|
||||
; (If my memory serves me right, DOS4/G(W) provides a stack of 512 bytes
|
||||
; for interrupts that occur in real mode and are promoted to protected mode.)
|
||||
; This value _MUST_ be greater than 64 (for AMX needs) and should be at least
|
||||
; 128 (to serve interrupts).
|
||||
;
|
||||
%define STACKRESERVE 256
|
||||
|
||||
;
|
||||
; This variable controls the generation of memory range checks at run-time.
|
||||
; You should set this to 0, only when you are sure that there are no range
|
||||
@ -186,32 +194,49 @@
|
||||
%define JIT 1
|
||||
%include "amxdefn.asm"
|
||||
|
||||
; GWMV:
|
||||
; Nasm can't do the next as equivalence statements, since the value of
|
||||
; esi is not determined at compile time
|
||||
%define stk [esi+32] ; define some aliases to registers that will
|
||||
%define alt [esi+28] ; be stored on the stack when the code is
|
||||
%define pri [esi+24] ; actually beeing executed
|
||||
%define code [esi+20]
|
||||
%define amx [esi+16]
|
||||
%define retval [esi+12]
|
||||
%define stp [esi+8]
|
||||
%define hea [esi+4]
|
||||
%define frm [esi] ; FRM is NOT stored in ebp, FRM+DAT is being held
|
||||
;Registers used for JIT during execution:
|
||||
; eax - pri
|
||||
; ebx - reloc frame
|
||||
; ecx - info params
|
||||
; edx - alt
|
||||
; esi - AMX stack
|
||||
; edi - DAT
|
||||
; ebp - scratch
|
||||
|
||||
;DA:
|
||||
; These are still stored in the stack, but the stack pointer
|
||||
; holding them is now kept in ecx.
|
||||
%define stk [ecx+32] ; define some aliases to registers that will
|
||||
%define alt [ecx+28] ; be stored on the stack when the code is
|
||||
%define pri [ecx+24] ; actually beeing executed
|
||||
%define code [ecx+20]
|
||||
%define amx [ecx+16]
|
||||
%define retval [ecx+12]
|
||||
%define stp [ecx+8]
|
||||
%define hea [ecx+4]
|
||||
%define frm [ecx] ; FRM is NOT stored in ebp, FRM+DAT is being held
|
||||
; in ebx instead.
|
||||
|
||||
;
|
||||
; #define PUSH(v) ( stk-=sizeof(cell), *(cell *)(data+(int)stk)=v )
|
||||
;
|
||||
%macro _PUSH 1
|
||||
push dword %1
|
||||
lea esi,[esi-4]
|
||||
mov dword [esi], %1
|
||||
%endmacro
|
||||
|
||||
%macro _PUSHMEM 1
|
||||
lea esi,[esi-4]
|
||||
mov ebp, dword %1
|
||||
mov dword [esi], ebp
|
||||
%endmacro
|
||||
|
||||
;
|
||||
; #define POP(v) ( v=*(cell *)(data+(int)stk), stk+=sizeof(cell) )
|
||||
;
|
||||
%macro _POP 1
|
||||
pop dword %1
|
||||
mov %1, dword [esi]
|
||||
lea esi,[esi+4]
|
||||
%endmacro
|
||||
|
||||
|
||||
@ -790,7 +815,7 @@ OP_LCTRL:
|
||||
jne lctrl_5
|
||||
GO_ON j_lctrl_4, lctrl_5, 8
|
||||
j_lctrl_4:
|
||||
mov eax,esp ; 4=STK
|
||||
mov eax,esi ; 4=STK
|
||||
sub eax,edi
|
||||
CHECKCODESIZE j_lctrl_4
|
||||
lctrl_5:
|
||||
@ -824,7 +849,7 @@ OP_SCTRL:
|
||||
j_sctrl_4:
|
||||
;mov esp,eax ; 4=STK
|
||||
;add esp,edi ; relocate stack
|
||||
lea esp,[eax+edi]
|
||||
lea esi,[eax+edi]
|
||||
CHECKCODESIZE j_sctrl_4
|
||||
sctrl_5:
|
||||
cmp eax,5
|
||||
@ -885,14 +910,16 @@ OP_PUSH_ALT:
|
||||
|
||||
OP_PUSH_R_PRI:
|
||||
;nop;
|
||||
putval j_push_r_pri+1
|
||||
putval j_push_r_pri+2
|
||||
GO_ON j_push_r_pri, OP_PUSH_C, 8
|
||||
|
||||
j_push_r_pri:
|
||||
push ecx
|
||||
mov ecx,12345678h
|
||||
j_push_loop:
|
||||
_PUSH eax
|
||||
loop j_push_loop
|
||||
pop ecx
|
||||
;dec ecx
|
||||
;jnz j_push_loop
|
||||
CHECKCODESIZE j_push_r_pri
|
||||
@ -900,30 +927,33 @@ OP_PUSH_R_PRI:
|
||||
;good
|
||||
OP_PUSH_C:
|
||||
;nop;
|
||||
putval j_push_c+1
|
||||
putval j_push_c_end-4
|
||||
GO_ON j_push_c, OP_PUSH, 8
|
||||
|
||||
j_push_c:
|
||||
_PUSH 12345678h
|
||||
j_push_c_end:
|
||||
CHECKCODESIZE j_push_c
|
||||
|
||||
OP_PUSH:
|
||||
;nop;
|
||||
putval j_push+2
|
||||
putval j_push_end-6
|
||||
GO_ON j_push, OP_PUSH_S, 8
|
||||
|
||||
j_push:
|
||||
_PUSH [edi+12345678h]
|
||||
_PUSHMEM [edi+12345678h]
|
||||
j_push_end:
|
||||
CHECKCODESIZE j_push
|
||||
|
||||
;good
|
||||
OP_PUSH_S:
|
||||
;nop;
|
||||
putval j_push_s+2
|
||||
putval j_push_s_end-6
|
||||
GO_ON j_push_s, OP_POP_PRI, 8
|
||||
|
||||
j_push_s:
|
||||
_PUSH [ebx+12345678h]
|
||||
_PUSHMEM [ebx+12345678h]
|
||||
j_push_s_end:
|
||||
CHECKCODESIZE j_push_s
|
||||
|
||||
OP_POP_PRI:
|
||||
@ -950,8 +980,8 @@ OP_STACK:
|
||||
GO_ON j_stack, OP_HEAP, 8
|
||||
|
||||
j_stack:
|
||||
mov edx,esp
|
||||
add esp,12345678h
|
||||
mov edx,esi
|
||||
add esi,12345678h
|
||||
sub edx,edi
|
||||
%ifdef DORUNTIMECHECKS
|
||||
call [chk_marginstack]
|
||||
@ -979,9 +1009,9 @@ OP_PROC:
|
||||
GO_ON j_proc, OP_RET
|
||||
|
||||
j_proc: ;[STK] = FRM, STK = STK - cell size, FRM = STK
|
||||
_PUSH frm ; push old frame (for RET/RETN)
|
||||
mov frm,esp ; get new frame
|
||||
mov ebx,esp ; already relocated
|
||||
_PUSHMEM frm ; push old frame (for RET/RETN)
|
||||
mov frm,esi ; get new frame
|
||||
mov ebx,esi ; already relocated
|
||||
sub frm,edi ; relocate frame
|
||||
CHECKCODESIZE j_proc
|
||||
|
||||
@ -991,6 +1021,7 @@ OP_RET:
|
||||
|
||||
j_ret:
|
||||
_POP ebx ; pop frame
|
||||
lea esi,[esi+4]
|
||||
mov frm,ebx
|
||||
add ebx,edi
|
||||
ret
|
||||
@ -1009,11 +1040,13 @@ OP_RETN:
|
||||
;good
|
||||
OP_CALL:
|
||||
;nop;
|
||||
RELOC 1
|
||||
RELOC j_call_e8-j_call+1
|
||||
GO_ON j_call, OP_CALL_I, 8
|
||||
|
||||
j_call:
|
||||
;call 12345678h ; tasm chokes on this out of a sudden
|
||||
_PUSH 0
|
||||
j_call_e8
|
||||
db 0e8h, 0, 0, 0, 0
|
||||
CHECKCODESIZE j_call
|
||||
|
||||
@ -1022,6 +1055,7 @@ OP_CALL_I:
|
||||
GO_ON j_call_i, OP_JUMP
|
||||
|
||||
j_call_i:
|
||||
_PUSH 0
|
||||
call eax
|
||||
CHECKCODESIZE j_call_i
|
||||
|
||||
@ -1172,24 +1206,30 @@ OP_SHL:
|
||||
;nop;
|
||||
GO_ON j_shl, OP_SHR
|
||||
j_shl:
|
||||
mov ecx,edx ; TODO: save ECX if used as special register
|
||||
push ecx
|
||||
mov ecx,edx
|
||||
shl eax,cl
|
||||
pop ecx
|
||||
CHECKCODESIZE j_shl
|
||||
|
||||
OP_SHR:
|
||||
;nop;
|
||||
GO_ON j_shr, OP_SSHR
|
||||
j_shr:
|
||||
mov ecx,edx ; TODO: save ECX if used as special register
|
||||
push ecx
|
||||
mov ecx,edx
|
||||
shr eax,cl
|
||||
pop ecx
|
||||
CHECKCODESIZE j_shr
|
||||
|
||||
OP_SSHR:
|
||||
;nop;
|
||||
GO_ON j_sshr, OP_SHL_C_PRI
|
||||
j_sshr:
|
||||
mov ecx,edx ; TODO: save ECX if used as special register
|
||||
push ecx
|
||||
mov ecx,edx
|
||||
sar eax,cl
|
||||
pop ecx
|
||||
CHECKCODESIZE j_sshr
|
||||
|
||||
OP_SHL_C_PRI:
|
||||
@ -1608,29 +1648,35 @@ OP_DEC_I:
|
||||
|
||||
OP_MOVS:
|
||||
;nop;
|
||||
putval j_movs+1
|
||||
putval j_movs+2
|
||||
GO_ON j_movs, OP_CMPS, 8
|
||||
j_movs:
|
||||
mov ecx,12345678h ;TODO: save ECX if used as special register
|
||||
push ecx
|
||||
mov ecx,12345678h
|
||||
call [jit_movs]
|
||||
pop ecx
|
||||
CHECKCODESIZE j_movs
|
||||
|
||||
OP_CMPS:
|
||||
;nop;
|
||||
putval j_cmps+1
|
||||
putval j_cmps+2
|
||||
GO_ON j_cmps, OP_FILL, 8
|
||||
j_cmps:
|
||||
mov ecx,12345678h ;TODO: save ECX if used as special register
|
||||
push ecx
|
||||
mov ecx,12345678h
|
||||
call [jit_cmps]
|
||||
pop ecx
|
||||
CHECKCODESIZE j_cmps
|
||||
|
||||
OP_FILL:
|
||||
;nop;
|
||||
putval j_fill+1
|
||||
putval j_fill+2
|
||||
GO_ON j_fill, OP_HALT, 8
|
||||
j_fill:
|
||||
push ecx
|
||||
mov ecx,12345678h ;TODO: save ECX if used as special register
|
||||
call [jit_fill]
|
||||
pop ecx
|
||||
CHECKCODESIZE j_fill
|
||||
|
||||
;good
|
||||
@ -1879,7 +1925,7 @@ _amx_exec_jit:
|
||||
push dword [eax+20]; store FRM
|
||||
|
||||
mov edx,[eax+4] ; get ALT
|
||||
mov ecx,[eax+8] ; get CIP
|
||||
mov ebp,[eax+8] ; get CIP
|
||||
mov edi,[eax+12] ; get pointer to data segment
|
||||
mov esi,[eax+16] ; get STK !!changed, now ECX free as counter!!
|
||||
mov ebx,[eax+20] ; get FRM
|
||||
@ -1887,13 +1933,14 @@ _amx_exec_jit:
|
||||
add ebx,edi ; relocate frame
|
||||
|
||||
add esi,edi ; ESP will contain DAT+STK
|
||||
xchg esp,esi ; switch to AMX stack
|
||||
|
||||
add stp,edi ; make STP absolute address for run-time checks
|
||||
add [esp+8],edi ; make STP absolute address for run-time checks
|
||||
|
||||
_POP ebp ; AMX pseudo-return address, ignored
|
||||
mov dword [esi], 0 ; zero this out, but we need to keep it so
|
||||
; the stack frame is in tact
|
||||
mov ecx,esp ; copy stack pointer
|
||||
; Call compiled code via CALL NEAR <address>
|
||||
call ecx
|
||||
call ebp
|
||||
|
||||
return_to_caller:
|
||||
cmp dword retval,0
|
||||
@ -1906,15 +1953,17 @@ return_to_caller:
|
||||
jmp _return
|
||||
|
||||
_return_popstack:
|
||||
add esp,4 ; Correct ESP, because we just come from a
|
||||
; runtime error checking routine.
|
||||
mov esp,ecx ; get our old stack pointer
|
||||
_return:
|
||||
; store machine state
|
||||
mov ecx,esp ; get STK into ECX
|
||||
push ecx
|
||||
push ecx
|
||||
mov ebp,amx ; get amx into EBP
|
||||
mov ecx,esi ; get STK into ECX
|
||||
|
||||
sub ecx,edi ; correct STK
|
||||
mov [ebp+_stk],ecx ; store values in AMX structure: STK, ...
|
||||
pop ecx ; get orig value
|
||||
mov ecx,hea ; ... HEA, ...
|
||||
mov [ebp+_hea],ecx
|
||||
mov ecx,ebx ; ... and FRM
|
||||
@ -1924,8 +1973,8 @@ _return:
|
||||
mov [ebp+_alt],edx ; ... and ALT
|
||||
|
||||
; return
|
||||
pop ecx
|
||||
sub stp,edi ; make STP relative to DAT again
|
||||
xchg esp,esi ; switch back to caller's stack
|
||||
|
||||
add esp,4*9 ; remove temporary data
|
||||
|
||||
@ -1946,12 +1995,8 @@ err_stacklow:
|
||||
jmp _return_popstack
|
||||
|
||||
_CHKMARGIN_STACK: ; some run-time check routines
|
||||
cmp esp,stp
|
||||
lea ebp,[esp-STACKRESERVE]
|
||||
cmp esi,stp
|
||||
jg err_stacklow
|
||||
sub ebp,edi
|
||||
cmp hea,ebp
|
||||
jg err_stack
|
||||
ret
|
||||
|
||||
err_heaplow:
|
||||
@ -1959,7 +2004,7 @@ err_heaplow:
|
||||
jmp _return_popstack
|
||||
|
||||
_CHKMARGIN_HEAP:
|
||||
cmp esp,stp
|
||||
cmp esi,stp
|
||||
jg err_stacklow
|
||||
cmp dword hea,0
|
||||
jl err_heaplow
|
||||
@ -1975,7 +2020,7 @@ _VERIFYADDRESS_eax: ; used in load.i, store.i & lidx
|
||||
cmp eax,hea
|
||||
jb veax1
|
||||
lea ebp,[eax+edi]
|
||||
cmp ebp,esp
|
||||
cmp ebp,esi
|
||||
jb err_memaccess
|
||||
veax1:
|
||||
ret
|
||||
@ -1986,7 +2031,7 @@ _VERIFYADDRESS_edx: ; used in load.i, store.i & lidx
|
||||
cmp edx,hea
|
||||
jb vedx1
|
||||
lea ebp,[edx+edi]
|
||||
cmp ebp,esp
|
||||
cmp ebp,esi
|
||||
jb err_memaccess
|
||||
vedx1:
|
||||
ret
|
||||
@ -2018,15 +2063,15 @@ JIT_OP_SDIV:
|
||||
|
||||
JIT_OP_RETN:
|
||||
_POP ebx ; pop frame
|
||||
_POP ecx ; get return address
|
||||
add esi,4 ; get rid of the extra parameter from call
|
||||
|
||||
mov frm,ebx
|
||||
_POP ebp
|
||||
|
||||
add ebx,edi
|
||||
add esp,ebp ; remove data from stack
|
||||
add esi,ebp ; remove data from stack
|
||||
|
||||
jmp ecx
|
||||
ret
|
||||
|
||||
|
||||
JIT_OP_MOVS: ;length of block to copy is already in ECX
|
||||
@ -2092,34 +2137,33 @@ err_divide:
|
||||
jmp _return_popstack
|
||||
|
||||
JIT_OP_SYSREQ:
|
||||
mov ecx,esp ; get STK into ECX
|
||||
push ecx
|
||||
push esi
|
||||
mov ebp,amx ; get amx into EBP
|
||||
|
||||
sub ecx,edi ; correct STK
|
||||
sub esi,edi ; correct STK
|
||||
mov alt,edx ; save ALT
|
||||
|
||||
mov [ebp+_stk],ecx ; store values in AMX structure: STK,
|
||||
mov ecx,hea ; HEA,
|
||||
mov [ebp+_stk],esi ; store values in AMX structure: STK,
|
||||
mov esi,hea ; HEA,
|
||||
mov ebx,frm ; and FRM
|
||||
mov [ebp+_hea],ecx
|
||||
mov [ebp+_hea],esi
|
||||
mov [ebp+_frm],ebx
|
||||
|
||||
lea ebx,pri ; 3rd param: addr. of retval
|
||||
lea ecx,[esp+4] ; 4th param: parameter array
|
||||
|
||||
xchg esp,esi ; switch to caller stack
|
||||
|
||||
push ecx
|
||||
;Our original esi is still pushed!
|
||||
push ebx
|
||||
push eax ; 2nd param: function number
|
||||
push ebp ; 1st param: amx
|
||||
call [ebp+_callback]
|
||||
_DROPARGS 16 ; remove args from stack
|
||||
|
||||
xchg esp,esi ; switch back to AMX stack
|
||||
_DROPARGS 12 ; remove args from stack
|
||||
|
||||
pop esi
|
||||
pop ecx
|
||||
cmp eax,AMX_ERR_NONE
|
||||
jne _return_popstack; return error code, if any
|
||||
|
||||
jne _return_popstack
|
||||
.continue:
|
||||
mov eax,pri ; get retval into eax (PRI)
|
||||
mov edx,alt ; restore ALT
|
||||
mov ebx,frm ; restore FRM
|
||||
@ -2128,25 +2172,25 @@ JIT_OP_SYSREQ:
|
||||
|
||||
|
||||
JIT_OP_SYSREQ_D: ; (TR)
|
||||
mov ecx,esp ; get STK into ECX
|
||||
push ecx
|
||||
push esi
|
||||
mov ebp,amx ; get amx into EBP
|
||||
|
||||
sub ecx,edi ; correct STK
|
||||
sub esi,edi ; correct STK
|
||||
mov alt,edx ; save ALT
|
||||
|
||||
mov [ebp+_stk],ecx ; store values in AMX structure: STK,
|
||||
mov ecx,hea ; HEA,
|
||||
mov [ebp+_stk],esi ; store values in AMX structure: STK,
|
||||
mov esi,hea ; HEA,
|
||||
mov eax,frm ; and FRM
|
||||
mov [ebp+_hea],ecx
|
||||
mov [ebp+_hea],esi
|
||||
mov [ebp+_frm],eax ; eax & ecx are invalid by now
|
||||
|
||||
lea edx,[esp+4] ; 2nd param: parameter array
|
||||
xchg esp,esi ; switch to caller stack
|
||||
push edx
|
||||
;esi is still pushed!
|
||||
push ebp ; 1st param: amx
|
||||
call ebx ; direct call
|
||||
_DROPARGS 8 ; remove args from stack
|
||||
xchg esp,esi ; switch back to AMX stack
|
||||
|
||||
pop ecx
|
||||
mov ebp,amx ; get amx into EBP
|
||||
cmp dword [ebp+_error],AMX_ERR_NONE
|
||||
jne _return_popstack; return error code, if any
|
||||
@ -2160,25 +2204,27 @@ JIT_OP_SYSREQ_D: ; (TR)
|
||||
|
||||
JIT_OP_BREAK:
|
||||
%ifdef DEBUGSUPPORT
|
||||
mov ecx,esp ; get STK into ECX
|
||||
push ecx
|
||||
push esi
|
||||
mov ebp,amx ; get amx into EBP
|
||||
|
||||
sub ecx,edi ; correct STK
|
||||
sub esi,edi ; correct STK
|
||||
|
||||
mov [ebp+_pri],eax ; store values in AMX structure: PRI,
|
||||
mov [ebp+_alt],edx ; ALT,
|
||||
mov [ebp+_stk],ecx ; STK,
|
||||
mov ecx,hea ; HEA,
|
||||
mov [ebp+_stk],esi ; STK,
|
||||
mov esi,hea ; HEA,
|
||||
mov ebx,frm ; and FRM
|
||||
mov [ebp+_hea],ecx
|
||||
mov [ebp+_hea],esi
|
||||
mov [ebp+_frm],ebx ; EBX & ECX are invalid by now
|
||||
;??? storing CIP is not very useful, because the code changed (during JIT compile)
|
||||
|
||||
xchg esp,esi ; switch to caller stack
|
||||
push ebp ; 1st param: amx
|
||||
call [ebp+_debug]
|
||||
_DROPARGS 4 ; remove args from stack
|
||||
xchg esp,esi ; switch back to AMX stack
|
||||
|
||||
pop esi
|
||||
pop ecx
|
||||
cmp eax,AMX_ERR_NONE
|
||||
jne _return_popstack; return error code, if any
|
||||
|
||||
@ -2194,6 +2240,7 @@ JIT_OP_BREAK:
|
||||
|
||||
JIT_OP_SWITCH:
|
||||
pop ebp ; pop return address = table address
|
||||
push ecx
|
||||
mov ecx,[ebp] ; ECX = number of records
|
||||
lea ebp,[ebp+ecx*8+8] ; set pointer _after_ LAST case
|
||||
;if there are zero cases we should just skip this -- bail
|
||||
@ -2205,6 +2252,7 @@ JIT_OP_SWITCH:
|
||||
sub ebp,8 ; position to preceding case
|
||||
loop op_switch_loop ; check next case, or fall through
|
||||
op_switch_jump:
|
||||
pop ecx
|
||||
%ifndef FORCERELOCATABLE
|
||||
jmp [ebp-4] ; jump to the case instructions
|
||||
%else
|
||||
|
@ -128,7 +128,7 @@ static cell AMX_NATIVE_CALL engclient_print(AMX *amx, cell *params) /* 3 param
|
||||
{
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -214,7 +214,7 @@ static cell AMX_NATIVE_CALL client_print(AMX *amx, cell *params) /* 3 param */
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients)
|
||||
{
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -251,7 +251,7 @@ static cell AMX_NATIVE_CALL show_motd(AMX *amx, cell *params) /* 3 param */
|
||||
else {
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
if (iFile) FREE_FILE(sToShow);
|
||||
return 0;
|
||||
}
|
||||
@ -307,7 +307,7 @@ static cell AMX_NATIVE_CALL show_hudmessage(AMX *amx, cell *params) /* 2 param
|
||||
message = UTIL_SplitHudMessage(format_amxstring(amx,params,2,len));
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -496,7 +496,7 @@ static cell AMX_NATIVE_CALL get_weaponname(AMX *amx, cell *params) /* 3 param */
|
||||
{
|
||||
int index = params[1];
|
||||
if (index < 1 || index >= MAX_WEAPONS ){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
return set_amxstring(amx,params[2],g_weaponsData[index].fullName.c_str(),params[3]);
|
||||
@ -506,7 +506,7 @@ static cell AMX_NATIVE_CALL get_user_weapons(AMX *amx, cell *params) /* 3 param
|
||||
{
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -515,8 +515,10 @@ static cell AMX_NATIVE_CALL get_user_weapons(AMX *amx, cell *params) /* 3 param
|
||||
cell *cpIds = get_amxaddr(amx,params[2]);
|
||||
*cpIds = 0;
|
||||
int weapons = pPlayer->pEdict->v.weapons & ~(1<<31); // don't count last element
|
||||
for(int i = 1; i < MAX_WEAPONS; ++i){
|
||||
if (weapons & (1<<i)) {
|
||||
for(int i = 1; i < MAX_WEAPONS; ++i)
|
||||
{
|
||||
if (weapons & (1<<i))
|
||||
{
|
||||
*(cpIds+(*cpNum)) = i;
|
||||
(*cpNum)++;
|
||||
}
|
||||
@ -530,7 +532,7 @@ static cell AMX_NATIVE_CALL get_user_origin(AMX *amx, cell *params) /* 3 param *
|
||||
{
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -592,7 +594,7 @@ static cell AMX_NATIVE_CALL get_user_attacker(AMX *amx, cell *params) /* 2 param
|
||||
{
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -625,7 +627,7 @@ static cell AMX_NATIVE_CALL user_has_weapon(AMX *amx,cell *params)
|
||||
{
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -664,13 +666,20 @@ static cell AMX_NATIVE_CALL user_has_weapon(AMX *amx,cell *params)
|
||||
static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params) /* 3 param */
|
||||
{
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
if (index < 1 || index > gpGlobals->maxClients)
|
||||
{
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
if (pPlayer->ingame){
|
||||
int wpn = pPlayer->current;
|
||||
if (pPlayer->ingame)
|
||||
{
|
||||
int wpn = pPlayer->current;
|
||||
if ( !(pPlayer->pEdict->v.weapons & (1<<wpn)) )
|
||||
{
|
||||
pPlayer->current = 0;
|
||||
return 0;
|
||||
}
|
||||
cell *cpTemp = get_amxaddr(amx,params[2]);
|
||||
*cpTemp = pPlayer->weapons[wpn].clip;
|
||||
cpTemp = get_amxaddr(amx,params[3]);
|
||||
@ -684,14 +693,14 @@ static cell AMX_NATIVE_CALL get_user_ammo(AMX *amx, cell *params) /* 4 param */
|
||||
{
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
if (pPlayer->ingame){
|
||||
int wpn = params[2];
|
||||
if (wpn < 1 || wpn >= MAX_WEAPONS ){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", wpn);
|
||||
return 0;
|
||||
}
|
||||
cell *cpTemp = get_amxaddr(amx,params[3]);
|
||||
@ -765,7 +774,7 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
|
||||
else {
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -1161,7 +1170,7 @@ static cell AMX_NATIVE_CALL client_cmd(AMX *amx, cell *params) /* 2 param */
|
||||
else {
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -1646,7 +1655,7 @@ static cell AMX_NATIVE_CALL get_user_info(AMX *amx, cell *params) /* 4 param */
|
||||
{
|
||||
int index = params[1];
|
||||
if (index<1||index>gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -1665,7 +1674,7 @@ static cell AMX_NATIVE_CALL set_user_info(AMX *amx, cell *params) /* 3 param */
|
||||
{
|
||||
int index = params[1];
|
||||
if (index<1||index>gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -1856,7 +1865,7 @@ static cell AMX_NATIVE_CALL engclient_cmd(AMX *amx, cell *params) /* 4 param */
|
||||
else {
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -1914,7 +1923,8 @@ static cell AMX_NATIVE_CALL unpause(AMX *amx, cell *params) /* 3 param */
|
||||
}
|
||||
else
|
||||
plugin = g_plugins.findPluginFast( amx);
|
||||
if (plugin && plugin->isValid()) {
|
||||
if (plugin && plugin->isValid() && plugin->isPaused() )
|
||||
{
|
||||
plugin->unpausePlugin();
|
||||
return 1;
|
||||
}
|
||||
@ -1941,7 +1951,7 @@ static cell AMX_NATIVE_CALL get_user_flags(AMX *amx, cell *params) /* 2 param */
|
||||
{
|
||||
int index = params[1];
|
||||
if (index<0||index>gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
int id = params[2];
|
||||
@ -1954,7 +1964,7 @@ static cell AMX_NATIVE_CALL set_user_flags(AMX *amx, cell *params) /* 3 param */
|
||||
{
|
||||
int index = params[1];
|
||||
if (index < 0 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -1970,7 +1980,7 @@ static cell AMX_NATIVE_CALL remove_user_flags(AMX *amx, cell *params) /* 3 param
|
||||
{
|
||||
int index = params[1];
|
||||
if (index < 0 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -1994,7 +2004,7 @@ static cell AMX_NATIVE_CALL get_user_menu(AMX *amx, cell *params) /* 3 param */
|
||||
{
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
cell *cpMenu = get_amxaddr(amx,params[2]);
|
||||
@ -2095,7 +2105,7 @@ static cell AMX_NATIVE_CALL get_user_aiming(AMX *amx, cell *params) /* 4 param *
|
||||
{
|
||||
int index = params[1];
|
||||
if (index < 1 || index > gpGlobals->maxClients){
|
||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
|
||||
return 0;
|
||||
}
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
@ -2765,7 +2775,7 @@ static cell AMX_NATIVE_CALL callfunc_push_str(AMX *amx, cell *params)
|
||||
// copy it to the allocated memory
|
||||
// we assume it's unpacked
|
||||
// :NOTE: 4th parameter use_wchar since Small Abstract Machine 2.5.0
|
||||
amx_SetString(phys_addr, str, 0, 0, 0);
|
||||
amx_SetStringOld(phys_addr, str, 0, 0);
|
||||
|
||||
// push the address and set the reference flag so that memory is released after function call.
|
||||
g_CallFunc_ParamInfo[g_CallFunc_CurParam].flags = CALLFUNC_FLAG_BYREF;
|
||||
@ -2895,6 +2905,22 @@ static cell AMX_NATIVE_CALL find_plugin_byfile(AMX *amx, cell *params)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL int3(AMX *amx, cell *params)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#if defined WIN32
|
||||
__asm
|
||||
{
|
||||
int 3;
|
||||
};
|
||||
#else
|
||||
asm("int $3");
|
||||
#endif //WIN32
|
||||
#endif //DEBUG
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO amxmod_Natives[] = {
|
||||
{ "client_cmd", client_cmd },
|
||||
{ "client_print", client_print },
|
||||
@ -3062,5 +3088,6 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
|
||||
{ "plugin_flags", plugin_flags},
|
||||
{ "lang_phrase", lang_phrase},
|
||||
{ "mkdir", amx_mkdir},
|
||||
{ "int3", int3},
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
@ -69,7 +69,7 @@
|
||||
#include "amxxlog.h"
|
||||
|
||||
#define AMXXLOG_Log g_log.Log
|
||||
#define AMX_VERSION "1.50"
|
||||
#define AMX_VERSION "1.55"
|
||||
|
||||
extern AMX_NATIVE_INFO core_Natives[];
|
||||
extern AMX_NATIVE_INFO time_Natives[];
|
||||
|
@ -220,7 +220,7 @@ CAmxxReader::~CAmxxReader()
|
||||
}
|
||||
if (m_Bh.plugins)
|
||||
{
|
||||
delete m_Bh.plugins;
|
||||
delete [] m_Bh.plugins;
|
||||
m_Bh.plugins = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -153,17 +153,6 @@ void Client_WeaponList(void* mValue)
|
||||
break;
|
||||
case 7:
|
||||
int iId = *(int*)mValue;
|
||||
/*int* blocker;
|
||||
|
||||
int iwpn = iId;
|
||||
|
||||
if (iId > 31) {
|
||||
iwpn -= 31;
|
||||
blocker = &wpnList2;
|
||||
}
|
||||
else
|
||||
blocker = &wpnList;*/
|
||||
|
||||
if ( (iId < 0 || iId >= MAX_WEAPONS ) || (wpnList & (1<<iId)) )
|
||||
break;
|
||||
wpnList |= (1<<iId);
|
||||
@ -323,4 +312,5 @@ void Client_ResetHUD(void* mValue)
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
|
@ -30,6 +30,9 @@
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
#if defined WIN32
|
||||
#include <direct.h>
|
||||
#endif
|
||||
#include "amxmodx.h"
|
||||
#include "fakemeta.h"
|
||||
#include "newmenus.h"
|
||||
@ -93,6 +96,7 @@ bool g_initialized = false;
|
||||
bool g_IsNewMM = false;
|
||||
bool g_NeedsP = false;
|
||||
bool g_coloredmenus;
|
||||
bool g_activated = false;
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
float g_next_memreport_time;
|
||||
@ -196,9 +200,12 @@ const char* get_localinfo( const char* name , const char* def )
|
||||
// Load AMX modules for new native functions
|
||||
// Initialize AMX stuff and load it's plugins from plugins.ini list
|
||||
// Call precache forward function from plugins
|
||||
int C_Spawn( edict_t *pent ) {
|
||||
int C_Spawn( edict_t *pent )
|
||||
{
|
||||
if (g_initialized)
|
||||
RETURN_META_VALUE(MRES_IGNORED, 0);
|
||||
|
||||
g_activated = false;
|
||||
g_initialized = true;
|
||||
g_forcedmodules = false;
|
||||
g_forcedsounds = false;
|
||||
@ -360,8 +367,8 @@ Much more later after precache. All is precached, server
|
||||
will be flaged as ready to use so call
|
||||
plugin_init forward function from plugins
|
||||
*/
|
||||
void C_ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ){
|
||||
|
||||
void C_ServerActivate( edict_t *pEdictList, int edictCount, int clientMax )
|
||||
{
|
||||
int id;
|
||||
for (int i = 0; g_user_msg[ i ].name; ++i )
|
||||
{
|
||||
@ -383,9 +390,10 @@ void C_ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ){
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void C_ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ){
|
||||
|
||||
// g_edict_point = (int)pEdictList;
|
||||
void C_ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax )
|
||||
{
|
||||
if (g_activated)
|
||||
RETURN_META(MRES_IGNORED);
|
||||
|
||||
for(int i = 1; i <= gpGlobals->maxClients; ++i) {
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
|
||||
@ -412,12 +420,16 @@ void C_ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax )
|
||||
g_memreport_enabled = true;
|
||||
#endif
|
||||
|
||||
g_activated = true;
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
// Call plugin_end forward function from plugins.
|
||||
void C_ServerDeactivate() {
|
||||
|
||||
void C_ServerDeactivate()
|
||||
{
|
||||
if (!g_activated)
|
||||
RETURN_META(MRES_IGNORED);
|
||||
for(int i = 1; i <= gpGlobals->maxClients; ++i){
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
|
||||
if (pPlayer->initialized)
|
||||
@ -438,8 +450,10 @@ void C_ServerDeactivate() {
|
||||
|
||||
// After all clear whole AMX configuration
|
||||
// However leave AMX modules which are loaded only once
|
||||
void C_ServerDeactivate_Post() {
|
||||
|
||||
void C_ServerDeactivate_Post()
|
||||
{
|
||||
if (!g_initialized)
|
||||
RETURN_META(MRES_IGNORED);
|
||||
detachReloadModules();
|
||||
g_auth.clear();
|
||||
g_commands.clear();
|
||||
@ -519,7 +533,8 @@ void C_ServerDeactivate_Post() {
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
BOOL C_ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ){
|
||||
BOOL C_ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] )
|
||||
{
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER(pEntity);
|
||||
if (!pPlayer->bot) {
|
||||
|
||||
@ -541,7 +556,8 @@ BOOL C_ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *ps
|
||||
RETURN_META_VALUE(MRES_IGNORED, TRUE);
|
||||
}
|
||||
|
||||
void C_ClientDisconnect( edict_t *pEntity ) {
|
||||
void C_ClientDisconnect( edict_t *pEntity )
|
||||
{
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
|
||||
if (pPlayer->initialized)
|
||||
executeForwards(FF_ClientDisconnect, pPlayer->index);
|
||||
@ -553,7 +569,8 @@ void C_ClientDisconnect( edict_t *pEntity ) {
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void C_ClientPutInServer_Post( edict_t *pEntity ) {
|
||||
void C_ClientPutInServer_Post( edict_t *pEntity )
|
||||
{
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
|
||||
if (!pPlayer->bot) {
|
||||
pPlayer->PutInServer();
|
||||
@ -565,7 +582,8 @@ void C_ClientPutInServer_Post( edict_t *pEntity ) {
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void C_ClientUserInfoChanged_Post( edict_t *pEntity, char *infobuffer ) {
|
||||
void C_ClientUserInfoChanged_Post( edict_t *pEntity, char *infobuffer )
|
||||
{
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
|
||||
|
||||
executeForwards(FF_ClientInfoChanged, pPlayer->index);
|
||||
@ -596,7 +614,8 @@ void C_ClientUserInfoChanged_Post( edict_t *pEntity, char *infobuffer ) {
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void C_ClientCommand( edict_t *pEntity ) {
|
||||
void C_ClientCommand( edict_t *pEntity )
|
||||
{
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
|
||||
META_RES result = MRES_IGNORED;
|
||||
cell ret = 0;
|
||||
@ -708,8 +727,8 @@ void C_ClientCommand( edict_t *pEntity ) {
|
||||
RETURN_META( result );
|
||||
}
|
||||
|
||||
void C_StartFrame_Post( void ) {
|
||||
|
||||
void C_StartFrame_Post( void )
|
||||
{
|
||||
if (g_auth_time < gpGlobals->time )
|
||||
{
|
||||
g_auth_time = gpGlobals->time + 0.7;
|
||||
@ -802,7 +821,8 @@ void C_StartFrame_Post( void ) {
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void C_MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed) {
|
||||
void C_MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
|
||||
{
|
||||
if (ed)
|
||||
{
|
||||
|
||||
@ -836,47 +856,56 @@ void C_MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict
|
||||
g_events.parserInit(msg_type, &gpGlobals->time, mPlayer ,mPlayerIndex);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
void C_WriteByte_Post(int iValue) {
|
||||
void C_WriteByte_Post(int iValue)
|
||||
{
|
||||
g_events.parseValue(iValue);
|
||||
if (function) (*function)((void *)&iValue);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
void C_WriteChar_Post(int iValue) {
|
||||
void C_WriteChar_Post(int iValue)
|
||||
{
|
||||
g_events.parseValue(iValue);
|
||||
if (function) (*function)((void *)&iValue);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
void C_WriteShort_Post(int iValue) {
|
||||
void C_WriteShort_Post(int iValue)
|
||||
{
|
||||
g_events.parseValue(iValue);
|
||||
if (function) (*function)((void *)&iValue);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
void C_WriteLong_Post(int iValue) {
|
||||
void C_WriteLong_Post(int iValue)
|
||||
{
|
||||
g_events.parseValue(iValue);
|
||||
if (function) (*function)((void *)&iValue);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
void C_WriteAngle_Post(float flValue) {
|
||||
void C_WriteAngle_Post(float flValue)
|
||||
{
|
||||
g_events.parseValue(flValue);
|
||||
if (function) (*function)((void *)&flValue);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
void C_WriteCoord_Post(float flValue) {
|
||||
void C_WriteCoord_Post(float flValue)
|
||||
{
|
||||
g_events.parseValue(flValue);
|
||||
if (function) (*function)((void *)&flValue);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
void C_WriteString_Post(const char *sz) {
|
||||
void C_WriteString_Post(const char *sz)
|
||||
{
|
||||
g_events.parseValue(sz);
|
||||
if (function) (*function)((void *)sz);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
void C_WriteEntity_Post(int iValue) {
|
||||
void C_WriteEntity_Post(int iValue)
|
||||
{
|
||||
g_events.parseValue(iValue);
|
||||
if (function) (*function)((void *)&iValue);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
void C_MessageEnd_Post(void) {
|
||||
void C_MessageEnd_Post(void)
|
||||
{
|
||||
g_events.executeEvents();
|
||||
if (endfunction) (*endfunction)(NULL);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
@ -923,14 +952,16 @@ int C_Cmd_Argc( void )
|
||||
|
||||
// Grenade has been thrown.
|
||||
// Only here we may find out who is an owner.
|
||||
void C_SetModel(edict_t *e, const char *m){
|
||||
void C_SetModel(edict_t *e, const char *m)
|
||||
{
|
||||
if(e->v.owner&&m[7]=='w'&&m[8]=='_'&&m[9]=='h')
|
||||
g_grenades.put( e , 1.75, 4, GET_PLAYER_POINTER(e->v.owner) );
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
// Save at what part of body a player is aiming
|
||||
void C_TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *e, TraceResult *ptr) {
|
||||
void C_TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *e, TraceResult *ptr)
|
||||
{
|
||||
if ( e && ( e->v.flags & (FL_CLIENT | FL_FAKECLIENT) ) ) {
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER(e);
|
||||
if (ptr->pHit&&(ptr->pHit->v.flags& (FL_CLIENT | FL_FAKECLIENT) ))
|
||||
@ -1006,7 +1037,7 @@ C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_
|
||||
g_NeedsP = true;
|
||||
|
||||
#endif
|
||||
} else if (mminor == 11) {
|
||||
} else if (mminor >= 11) {
|
||||
g_IsNewMM = true;
|
||||
} else if (pminor > mminor) {
|
||||
LOG_ERROR(PLID, "metamod version is incompatible with this plugin; please find a newer version of this plugin");
|
||||
|
@ -406,7 +406,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
|
||||
{
|
||||
//amx->base = (unsigned char FAR *)realloc( np, amx->code_size );
|
||||
#ifndef __linux__
|
||||
amx->base = new unsigned char[ amx->code_size ];
|
||||
amx->base = (unsigned char *)VirtualAlloc(NULL, amx->code_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
#else
|
||||
//posix_memalign((void **)&(amx->base), sysconf(_SC_PAGESIZE), amx->code_size);
|
||||
amx->base = (unsigned char *)memalign(sysconf(_SC_PAGESIZE), amx->code_size);
|
||||
@ -593,11 +593,36 @@ int set_amxnatives(AMX* amx,char error[128])
|
||||
|
||||
int unload_amxscript(AMX* amx, void** program)
|
||||
{
|
||||
int flags = amx->flags;
|
||||
amxx_FreeDebug(amx);
|
||||
CList<CScript,AMX*>::iterator a = g_loadedscripts.find( amx );
|
||||
if ( a ) a.remove();
|
||||
char *prg = (char *)*program;
|
||||
if (!prg)
|
||||
return AMX_ERR_NONE;
|
||||
#if defined JIT
|
||||
#if defined __linux__ && defined MEMORY_TEST
|
||||
#undef free
|
||||
if (flags & AMX_FLAG_DEBUG)
|
||||
{
|
||||
delete [] prg;
|
||||
} else {
|
||||
free(prg);
|
||||
}
|
||||
#define free(ptr) m_deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||
#elif defined WIN32
|
||||
if (flags & AMX_FLAG_DEBUG)
|
||||
{
|
||||
delete [] prg;
|
||||
} else if (!VirtualFree((LPVOID)prg, 0, MEM_RELEASE)) {
|
||||
AMXXLOG_Log("[AMXX] Could not free plugin memory, failure %d.", GetLastError());
|
||||
return AMX_ERR_PARAMS;
|
||||
}
|
||||
#endif //OS support
|
||||
#else
|
||||
//delete normally
|
||||
delete[] prg;
|
||||
#endif
|
||||
*program = 0;
|
||||
return AMX_ERR_NONE;
|
||||
}
|
||||
@ -1750,3 +1775,24 @@ void *Module_ReqFnptr(const char *funcName)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if !defined MEMORY_TEST && !defined WIN32
|
||||
void * ::operator new(size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void * ::operator new[](size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void ::operator delete(void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void ::operator delete[](void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -112,11 +112,12 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib ..\JIT\natives-x86.obj"
|
||||
OutputFile="release/amxmodx_mm.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\extra\lib_win32"
|
||||
IgnoreDefaultLibraryNames="LIBC"
|
||||
ModuleDefinitionFile=""
|
||||
ProgramDatabaseFile=".\release/amxx_mm.pdb"
|
||||
ImportLibrary=".\release/amxx_mm.lib"/>
|
||||
@ -179,12 +180,13 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib ..\JIT\natives-x86.obj"
|
||||
OutputFile="memtestdebug/amxmodx_mm.dll"
|
||||
Version="0.1"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\extra\lib_win32"
|
||||
IgnoreDefaultLibraryNames="MSVCRT"
|
||||
ModuleDefinitionFile=""
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\memtestdebug/amxx_mm.pdb"
|
||||
@ -249,11 +251,12 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib ..\JIT\natives-x86.obj"
|
||||
OutputFile="memtestrelease/amxmodx_mm.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\extra\lib_win32"
|
||||
IgnoreDefaultLibraryNames="LIBC"
|
||||
ModuleDefinitionFile=""
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\memtestrelease/amxx_mm.pdb"
|
||||
@ -371,6 +374,7 @@
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="1"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
AdditionalIncludeDirectories="..\..\metamod\metamod,..\..\hlsdk\sourcecode\common,..\..\hlsdk\sourcecode\engine,..\..\hlsdk\sourcecode\dlls,..\..\hlsdk\sourcecode\pm_shared,..\extra\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;JIT;ASM32;PAWN_CELL_SIZE=32"
|
||||
IgnoreStandardIncludePath="FALSE"
|
||||
@ -462,11 +466,12 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
AdditionalDependencies="..\zlib\zlib.lib ..\JIT\amxjitsn.obj ..\JIT\amxexecn.obj"
|
||||
AdditionalDependencies="..\zlib\zlib.lib ..\JIT\amxjitsn.obj ..\JIT\amxexecn.obj ..\JIT\natives-x86.obj"
|
||||
OutputFile="jitmemtestrelease/amxmodx_mm.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\extra\lib_win32"
|
||||
IgnoreDefaultLibraryNames="MSVCRT"
|
||||
ModuleDefinitionFile=""
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\jitmemtestrelease/amxx_mm.pdb"
|
||||
@ -837,6 +842,25 @@
|
||||
RelativePath="..\version.rc">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Assembly"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="..\amxdefn.asm">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\amxexecn.asm">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\amxjitsn.asm">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\natives-amd64.asm">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\natives-x86.asm">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
@ -95,4 +95,6 @@ _amxx_DynaCodesize:
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
section .data
|
||||
|
||||
GLOBAL_GATE DD 0
|
||||
|
@ -29,13 +29,14 @@
|
||||
*/
|
||||
|
||||
#include "amxmodx.h"
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include "CStack.h"
|
||||
#include "natives.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/mman.h>
|
||||
#include "sclinux.h"
|
||||
#endif
|
||||
|
||||
//Written by David "BAILOPAN" Anderson
|
||||
@ -408,7 +409,7 @@ void ClearPluginLibraries()
|
||||
|
||||
for (size_t i=0; i<g_RegNatives.size(); i++)
|
||||
{
|
||||
delete g_RegNatives[i]->pfn;
|
||||
delete [] g_RegNatives[i]->pfn;
|
||||
delete g_RegNatives[i];
|
||||
}
|
||||
g_RegNatives.clear();
|
||||
|
@ -363,6 +363,58 @@ static cell AMX_NATIVE_CALL menu_makecallback(AMX *amx, cell *params)
|
||||
return id;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL menu_item_setname(AMX *amx, cell *params)
|
||||
{
|
||||
GETMENU(params[1]);
|
||||
|
||||
menuitem *pItem = pMenu->GetMenuItem(static_cast<item_t>(params[2]));
|
||||
|
||||
if (!pItem)
|
||||
return 0;
|
||||
|
||||
int len;
|
||||
char *name;
|
||||
|
||||
name = get_amxstring(amx, params[3], 0, len);
|
||||
|
||||
pItem->name.assign(name);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL menu_item_setcmd(AMX *amx, cell *params)
|
||||
{
|
||||
GETMENU(params[1]);
|
||||
|
||||
menuitem *pItem = pMenu->GetMenuItem(static_cast<item_t>(params[2]));
|
||||
|
||||
if (!pItem)
|
||||
return 0;
|
||||
|
||||
int len;
|
||||
char *cmd;
|
||||
|
||||
cmd = get_amxstring(amx, params[3], 0, len);
|
||||
|
||||
pItem->cmd.assign(cmd);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL menu_item_setcall(AMX *amx, cell *params)
|
||||
{
|
||||
GETMENU(params[1]);
|
||||
|
||||
menuitem *pItem = pMenu->GetMenuItem(static_cast<item_t>(params[2]));
|
||||
|
||||
if (!pItem)
|
||||
return 0;
|
||||
|
||||
pItem->handler = params[3];
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO g_NewMenuNatives[] =
|
||||
{
|
||||
{"menu_create", menu_create},
|
||||
@ -373,5 +425,8 @@ AMX_NATIVE_INFO g_NewMenuNatives[] =
|
||||
{"menu_find_id", menu_find_id},
|
||||
{"menu_item_getinfo", menu_item_getinfo},
|
||||
{"menu_makecallback", menu_makecallback},
|
||||
{"menu_item_setcall", menu_item_setcall},
|
||||
{"menu_item_setcmd", menu_item_setcmd},
|
||||
{"menu_item_setname", menu_item_setname},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
@ -45,8 +45,6 @@
|
||||
enginefuncs_t g_engfuncs;
|
||||
globalvars_t *gpGlobals;
|
||||
|
||||
|
||||
|
||||
DLL_FUNCTIONS *g_pFunctionTable;
|
||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
enginefuncs_t *g_pengfuncsTable;
|
||||
@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||
|
||||
|
||||
// GetEntityAPI2 functions
|
||||
static DLL_FUNCTIONS g_EntityAPI_Table =
|
||||
{
|
||||
@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
|
||||
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
#ifdef MEMORY_TEST
|
||||
PFN_ALLOCATOR g_fn_Allocator;
|
||||
PFN_REALLOCATOR g_fn_Reallocator;
|
||||
PFN_DEALLOCATOR g_fn_Deallocator;
|
||||
#endif
|
||||
PFN_AMX_EXEC g_fn_AmxExec;
|
||||
PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
@ -2613,10 +2612,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
// Memory
|
||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
|
||||
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
|
||||
#endif
|
||||
|
||||
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
|
||||
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
|
||||
@ -2735,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
|
||||
/************* MEMORY *************/
|
||||
// undef all defined macros
|
||||
#undef new
|
||||
@ -2906,6 +2909,30 @@ void operator delete[](void *reportedAddress)
|
||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined NO_ALLOC_OVERRIDES && !defined MEMORY_TEST && !defined WIN32
|
||||
void * ::operator new(size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void * ::operator new[](size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void ::operator delete(void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void ::operator delete[](void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
/************* stuff from dlls/util.cpp *************/
|
||||
// must come here because cbase.h declares it's own operator new
|
||||
|
||||
|
@ -46,8 +46,6 @@ struct amxx_module_info_s
|
||||
const char *logtag; // added in version 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
// return values from functions called by amxx
|
||||
#define AMXX_OK 0 /* no error */
|
||||
#define AMXX_IFVERS 1 /* interface version */
|
||||
@ -1981,12 +1979,14 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/);
|
||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
|
||||
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const void* /*addr*/ );
|
||||
#endif
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
@ -2048,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
extern PFN_AMX_EXEC g_fn_AmxExec;
|
||||
extern PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
extern PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
|
||||
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
|
||||
@ -2193,6 +2192,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||
#define MF_RequestFunction g_fn_RequestFunction;
|
||||
#define MF_AmxPush g_fn_AmxPush
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
/*** Memory ***/
|
||||
void *operator new(size_t reportedSize);
|
||||
void *operator new[](size_t reportedSize);
|
||||
@ -2236,4 +2236,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
#endif // #ifndef __AMXXMODULE_H__
|
||||
|
@ -21,13 +21,23 @@
|
||||
// metamod plugin?
|
||||
// #define USE_METAMOD
|
||||
|
||||
// use memory manager/tester?
|
||||
// note that if you use this, you cannot construct/allocate
|
||||
// anything before the module attached (OnAmxxAttach).
|
||||
// be careful of default constructors using new/malloc!
|
||||
// #define MEMORY_TEST
|
||||
|
||||
// Unless you use STL or exceptions, keep this commented.
|
||||
// It allows you to compile without libstdc++.so as a dependency
|
||||
// #define NO_ALLOC_OVERRIDES
|
||||
|
||||
// - 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
|
||||
//#define FN_AMXX_ATTACH OnAmxxAttach
|
||||
// AMXX detach
|
||||
//#define FN_AMXX_DETACH OnAmxxDetach
|
||||
// All plugins loaded
|
||||
@ -459,4 +469,4 @@
|
||||
|
||||
#endif // USE_METAMOD
|
||||
|
||||
#endif // __MODULECONFIG_H__
|
||||
#endif // __MODULECONFIG_H__
|
||||
|
@ -97,12 +97,15 @@ void amx_command(){
|
||||
|
||||
CPluginMngr::CPlugin *plugin = g_plugins.findPlugin(sPlugin);
|
||||
|
||||
if ( plugin && plugin->isValid() )
|
||||
if ( plugin && plugin->isValid() && plugin->isPaused() )
|
||||
{
|
||||
plugin->unpausePlugin();
|
||||
print_srvconsole("Unpaused plugin \"%s\"\n",plugin->getName() );
|
||||
} else if (!plugin) {
|
||||
print_srvconsole("Couldn't find plugin matching \"%s\"\n",sPlugin);
|
||||
} else {
|
||||
print_srvconsole("Plugin %s can't be unpaused right now.", sPlugin);
|
||||
}
|
||||
else print_srvconsole("Couldn't find plugin matching \"%s\"\n",sPlugin);
|
||||
|
||||
}
|
||||
else if (!strcmp(cmd,"cvars"))
|
||||
|
@ -27,8 +27,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,5,0,1
|
||||
PRODUCTVERSION 1,5,0,1
|
||||
FILEVERSION 1,5,5,0
|
||||
PRODUCTVERSION 1,5,5,0
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -45,12 +45,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "Comments", "AMX Mod X"
|
||||
VALUE "FileDescription", "AMX Mod X"
|
||||
VALUE "FileVersion", "1.50"
|
||||
VALUE "FileVersion", "1.55"
|
||||
VALUE "InternalName", "amxmodx"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2004-2005, AMX Mod X Dev Team"
|
||||
VALUE "OriginalFilename", "amxmodx_mm.dll"
|
||||
VALUE "ProductName", "AMX Mod X"
|
||||
VALUE "ProductVersion", "1.50-RC1"
|
||||
VALUE "ProductVersion", "1.55"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -3,14 +3,14 @@
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = g++
|
||||
CPP = gcc
|
||||
BINARY = amxxpc
|
||||
|
||||
OBJECTS = amx.cpp amxxpc.cpp Binary.cpp
|
||||
|
||||
LINK = -lz
|
||||
LINK = -lz /lib/libstdc++.a
|
||||
|
||||
INCLUDE = -I. -L.
|
||||
|
||||
@ -22,7 +22,7 @@ else
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -DLINUX -DNDEBUG -Wno-deprecated -fexceptions -DHAVE_STDINT_H -DAMX_ANSIONLY
|
||||
CFLAGS += -DLINUX -DNDEBUG -Wno-deprecated -fexceptions -DHAVE_STDINT_H -DAMX_ANSIONLY -fno-rtti -static-libgcc
|
||||
|
||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
|
||||
|
@ -99,7 +99,6 @@ int main(int argc, char **argv)
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
dlclose(lib);
|
||||
unlink(file);
|
||||
|
||||
HINSTANCE lib64 = 0;
|
||||
@ -108,8 +107,7 @@ int main(int argc, char **argv)
|
||||
#else
|
||||
lib64 = dlmount("amxxpc64.dll");
|
||||
#endif
|
||||
pc_printf = (PRINTF)dlsym(lib64, "pc_printf");
|
||||
if (!lib64 || !pc_printf)
|
||||
if (!lib64)
|
||||
{
|
||||
pc_printf("64bit compiler failed to instantiate.\n");
|
||||
exit(0);
|
||||
@ -129,6 +127,8 @@ int main(int argc, char **argv)
|
||||
|
||||
sc64(argc, argv);
|
||||
|
||||
dlclose(lib64);
|
||||
|
||||
if (file == NULL)
|
||||
{
|
||||
pc_printf("Could not locate the output file on second pass.\n");
|
||||
@ -207,7 +207,7 @@ int main(int argc, char **argv)
|
||||
|
||||
pc_printf("Done.\n");
|
||||
|
||||
dlclose(lib64);
|
||||
dlclose(lib);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc
|
||||
NAME = amxxpc
|
||||
@ -25,7 +25,7 @@ else
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32
|
||||
endif
|
||||
|
||||
CFLAGS += -DLINUX -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -DENABLE_BINRELOC -DNO_MAIN -DPAWNC_DLL
|
||||
CFLAGS += -DLINUX -DNDEBUG -fPIC -DHAVE_STDINT_H -DENABLE_BINRELOC -DNO_MAIN -DPAWNC_DLL -static-libgcc
|
||||
|
||||
CFLAGS += $(OPT_FLAGS)
|
||||
OBJ_LINUX := $(OBJECTS:%.c=$(BIN_DIR)/%.o)
|
||||
@ -42,9 +42,6 @@ all:
|
||||
pawn_make: $(OBJ_LINUX)
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
||||
|
||||
pawn64:
|
||||
$(MAKE) pawn_make PAWN64=true
|
||||
|
||||
debug:
|
||||
$(MAKE) all DEBUG=true
|
||||
|
||||
|
@ -247,6 +247,9 @@
|
||||
<File
|
||||
RelativePath=".\scstate.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\scstub.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\scvars.c">
|
||||
</File>
|
||||
|
@ -629,11 +629,7 @@ SC_FUNC void jmp_eq0(int number);
|
||||
SC_FUNC void outval(cell val,int newline);
|
||||
|
||||
/* function prototypes in SC5.C */
|
||||
#ifdef __linux__
|
||||
SC_FUNC int error(int number,...) __attribute__((visibility("internal")));
|
||||
#else
|
||||
SC_FUNC int error(int number,...)
|
||||
#endif
|
||||
SC_FUNC int error(int number,...) __attribute__((visibility("protected")));
|
||||
SC_FUNC void errorset(int code);
|
||||
|
||||
/* function prototypes in SC6.C */
|
||||
|
@ -654,7 +654,6 @@ cleanup:
|
||||
int flag_exceed=0;
|
||||
if (sc_amxlimit > 0 && (long)(hdrsize+code_idx+glb_declared*sizeof(cell)+sc_stksize*sizeof(cell)) >= sc_amxlimit)
|
||||
flag_exceed=1;
|
||||
#if PAWN_CELL_SIZE==32
|
||||
if ((sc_debug & sSYMBOLIC)!=0 || verbosity>=2 || stacksize+32>=(long)sc_stksize || flag_exceed) {
|
||||
pc_printf("Header size: %8ld bytes\n", (long)hdrsize);
|
||||
pc_printf("Code size: %8ld bytes\n", (long)code_idx);
|
||||
@ -666,7 +665,6 @@ cleanup:
|
||||
pc_printf("estimated max. usage=%ld cells (%ld bytes)\n",stacksize,stacksize*sizeof(cell));
|
||||
pc_printf("Total requirements:%8ld bytes\n", (long)hdrsize+(long)code_idx+(long)glb_declared*sizeof(cell)+(long)sc_stksize*sizeof(cell));
|
||||
} /* if */
|
||||
#endif
|
||||
if (flag_exceed)
|
||||
error(106,sc_amxlimit); /* this causes a jump back to label "cleanup" */
|
||||
} /* if */
|
||||
@ -1921,8 +1919,8 @@ static int declloc(int fstatic)
|
||||
* of a global variable or to that of a local variable at a lower
|
||||
* level might indicate a bug.
|
||||
*/
|
||||
if ((sym=findloc(name))!=NULL && sym->compound!=nestlevel || findglb(name)!=NULL);
|
||||
//error(219,name); /* variable shadows another symbol */
|
||||
if ((sym=findloc(name))!=NULL && sym->compound!=nestlevel || findglb(name)!=NULL)
|
||||
error(219,name); /* variable shadows another symbol */
|
||||
while (matchtoken('[')){
|
||||
ident=iARRAY;
|
||||
if (numdim == sDIMEN_MAX) {
|
||||
@ -3645,8 +3643,8 @@ static void doarg(char *name,int ident,int offset,int tags[],int numtags,
|
||||
if (argsym!=NULL) {
|
||||
error(21,name); /* symbol already defined */
|
||||
} else {
|
||||
if ((argsym=findglb(name))!=NULL && argsym->ident!=iFUNCTN) ;
|
||||
//error(219,name); /* variable shadows another symbol */
|
||||
if ((argsym=findglb(name))!=NULL && argsym->ident!=iFUNCTN)
|
||||
error(219,name); /* variable shadows another symbol */
|
||||
/* add details of type and address */
|
||||
assert(numtags>0);
|
||||
argsym=addvariable(name,offset,ident,sLOCAL,tags[0],
|
||||
|
@ -35,7 +35,7 @@ statscfg.amxx ; allows to manage stats plugins via menu and commands
|
||||
|
||||
; Counter-Strike
|
||||
;restmenu.amxx ; restrict weapons menu
|
||||
;statsx.amxx ; stats on death or round end (CSX Module required!)
|
||||
statsx.amxx ; stats on death or round end (CSX Module required!)
|
||||
;miscstats.amxx ; bunch of events announcement for Counter-Strike
|
||||
;stats_logging.amxx ; weapons stats logging (CSX Module required!)
|
||||
|
||||
|
@ -12,16 +12,16 @@ fun_amxx_amd64.so
|
||||
; ----------------------------------------------------
|
||||
; Engine - provides engine functions core to Half-Life
|
||||
; ----------------------------------------------------
|
||||
;engine_amxx_i386.so
|
||||
;engine_amxx.dll
|
||||
;engine_amxx_amd64.so
|
||||
engine_amxx_i386.so
|
||||
engine_amxx.dll
|
||||
engine_amxx_amd64.so
|
||||
|
||||
; ----------------------------------------------------------
|
||||
; Fakemeta - provides a massive interface into the HL engine
|
||||
; ----------------------------------------------------------
|
||||
;fakemeta_amxx_i386.so
|
||||
;fakemeta_amxx.dll
|
||||
;fakemeta_amxx_amd64.so
|
||||
fakemeta_amxx_i386.so
|
||||
fakemeta_amxx.dll
|
||||
fakemeta_amxx_amd64.so
|
||||
|
||||
; -------------------------------------------
|
||||
; Database Access - only enable one of these
|
||||
@ -66,11 +66,4 @@ fun_amxx_amd64.so
|
||||
; --------------------
|
||||
;nvault_amxx_i386.so
|
||||
;nvault_amxx.dll
|
||||
;nvault_amxx_amd64.so
|
||||
|
||||
; --------------------------------------------
|
||||
; Adds ESF miscellanious and hacking functions
|
||||
; --------------------------------------------
|
||||
esfmod_amxx_i386.so
|
||||
esfmod_amxx.dll
|
||||
esfmod_amxx_amd64.so
|
||||
;nvault_amxx_amd64.so
|
39
configs/esf/plugins.ini
Executable file
39
configs/esf/plugins.ini
Executable file
@ -0,0 +1,39 @@
|
||||
; AMX Mod X plugins
|
||||
|
||||
; Admin Base - Always one has to be activated
|
||||
admin.amxx ; admin base (required for any admin-related)
|
||||
;admin_sql.amxx ; admin base - SQL version (comment admin.amxx)
|
||||
|
||||
; Basic
|
||||
admincmd.amxx ; basic admin console commands
|
||||
adminhelp.amxx ; help command for admin console commands
|
||||
adminslots.amxx ; slot reservation
|
||||
multilingual.amxx ; Multi-Lingual management
|
||||
|
||||
; Menus
|
||||
menufront.amxx ; front-end for admin menus
|
||||
cmdmenu.amxx ; command menu (speech, settings)
|
||||
plmenu.amxx ; players menu (kick, ban, client cmds.)
|
||||
;telemenu.amxx ; teleport menu (Fun Module required!)
|
||||
mapsmenu.amxx ; maps menu (vote, changelevel)
|
||||
|
||||
; Chat / Messages
|
||||
adminchat.amxx ; console chat commands
|
||||
antiflood.amxx ; prevent clients from chat-flooding the server
|
||||
scrollmsg.amxx ; displays a scrolling message
|
||||
imessage.amxx ; displays information messages
|
||||
adminvote.amxx ; vote commands
|
||||
|
||||
; Map related
|
||||
nextmap.amxx ; displays next map in mapcycle
|
||||
mapchooser.amxx ; allows to vote for next map
|
||||
timeleft.amxx ; displays time left on map
|
||||
|
||||
; Configuration
|
||||
pausecfg.amxx ; allows to pause and unpause some plugins
|
||||
statscfg.amxx ; allows to manage stats plugins via menu and commands
|
||||
|
||||
|
||||
; Custom - Add 3rd party plugins here
|
||||
EvolutionX.Core.amxx ; Adds extra plugin functions for Earth's Special Forces
|
||||
; (made by the Corona Bytes team of EVM)
|
@ -6,7 +6,7 @@ MM_ROOT = ../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fomit-frame-pointer
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc
|
||||
NAME = cstrike_amxx
|
||||
@ -26,12 +26,11 @@ else
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_amd64.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
LINK += -lstdc++
|
||||
else
|
||||
BINARY = $(NAME)_i386.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
|
@ -45,8 +45,6 @@
|
||||
enginefuncs_t g_engfuncs;
|
||||
globalvars_t *gpGlobals;
|
||||
|
||||
|
||||
|
||||
DLL_FUNCTIONS *g_pFunctionTable;
|
||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
enginefuncs_t *g_pengfuncsTable;
|
||||
@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||
|
||||
|
||||
// GetEntityAPI2 functions
|
||||
static DLL_FUNCTIONS g_EntityAPI_Table =
|
||||
{
|
||||
@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
|
||||
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
#ifdef MEMORY_TEST
|
||||
PFN_ALLOCATOR g_fn_Allocator;
|
||||
PFN_REALLOCATOR g_fn_Reallocator;
|
||||
PFN_DEALLOCATOR g_fn_Deallocator;
|
||||
#endif
|
||||
PFN_AMX_EXEC g_fn_AmxExec;
|
||||
PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||
PFN_FORMAT g_fn_Format;
|
||||
PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
// *** Exports ***
|
||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||
@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
// Memory
|
||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
|
||||
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
|
||||
#endif
|
||||
|
||||
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
|
||||
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
|
||||
@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
MF_IsPlayerHLTV(0);
|
||||
MF_GetPlayerArmor(0);
|
||||
MF_GetPlayerHealth(0);
|
||||
MF_AmxExec(0, 0, 0, 0);
|
||||
MF_AmxExec(0, 0, 0);
|
||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||
MF_AmxFindPublic(0, 0, 0);
|
||||
MF_AmxAllot(0, 0, 0, 0);
|
||||
@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
|
||||
/************* MEMORY *************/
|
||||
// undef all defined macros
|
||||
#undef new
|
||||
@ -2904,6 +2909,30 @@ void operator delete[](void *reportedAddress)
|
||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined NO_ALLOC_OVERRIDES && !defined MEMORY_TEST && !defined WIN32
|
||||
void * ::operator new(size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void * ::operator new[](size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void ::operator delete(void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void ::operator delete[](void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
/************* stuff from dlls/util.cpp *************/
|
||||
// must come here because cbase.h declares it's own operator new
|
||||
|
||||
|
@ -46,8 +46,6 @@ struct amxx_module_info_s
|
||||
const char *logtag; // added in version 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
// return values from functions called by amxx
|
||||
#define AMXX_OK 0 /* no error */
|
||||
#define AMXX_IFVERS 1 /* interface version */
|
||||
@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/);
|
||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
|
||||
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const void* /*addr*/ );
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
|
||||
#endif
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/);
|
||||
typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/);
|
||||
|
||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||
@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
extern PFN_AMX_EXEC g_fn_AmxExec;
|
||||
extern PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
extern PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
|
||||
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
|
||||
@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format;
|
||||
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
|
||||
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
extern PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
extern PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
#ifdef MAY_NEVER_BE_DEFINED
|
||||
// Function prototypes for intellisense and similar systems
|
||||
@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { }
|
||||
const char * MF_Format (const char *fmt, ...) { }
|
||||
void MF_RegisterFunction (void *pfn, const char *description) { }
|
||||
void * MF_RequestFunction (const char *description) { }
|
||||
int MF_AmxPush (AMX *amx, cell *params) { }
|
||||
int MF_AmxExec (AMX *amx, cell *retval, int idx) { }
|
||||
#endif // MAY_NEVER_BE_DEFINED
|
||||
|
||||
#define MF_AddNatives g_fn_AddNatives
|
||||
@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||
#define MF_Format g_fn_Format
|
||||
#define MF_RegisterFunction g_fn_RegisterFunction
|
||||
#define MF_RequestFunction g_fn_RequestFunction;
|
||||
#define MF_AmxPush g_fn_AmxPush
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
/*** Memory ***/
|
||||
void *operator new(size_t reportedSize);
|
||||
void *operator new[](size_t reportedSize);
|
||||
@ -2231,4 +2236,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
#endif // #ifndef __AMXXMODULE_H__
|
||||
|
@ -175,7 +175,7 @@ static cell AMX_NATIVE_CALL cs_get_weapon_silenced(AMX *amx, cell *params) // cs
|
||||
// Make into edict pointer
|
||||
edict_t *pWeapon = INDEXENT(params[1]);
|
||||
|
||||
int weapontype = (int)*((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
|
||||
int weapontype = *((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
|
||||
int *silencemode = ((int *)pWeapon->pvPrivateData + OFFSET_SILENCER_FIREMODE);
|
||||
switch (weapontype) {
|
||||
case CSW_M4A1:
|
||||
@ -357,10 +357,12 @@ static cell AMX_NATIVE_CALL cs_get_user_armor(AMX *amx, cell *params) // cs_get_
|
||||
// Make into edict pointer
|
||||
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||
|
||||
#if 0
|
||||
cell *armorTypeByRef = MF_GetAmxAddr(amx, params[2]);
|
||||
*armorTypeByRef = *((int *)pPlayer->pvPrivateData + OFFSET_ARMORTYPE);
|
||||
#endif
|
||||
|
||||
return pPlayer->v.armorvalue;
|
||||
return (cell)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
|
||||
@ -1232,6 +1234,118 @@ static cell AMX_NATIVE_CALL cs_user_spawn(AMX *amx, cell *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL cs_get_armoury_type(AMX *amx, cell *params)
|
||||
{
|
||||
// Return CSW_* constants of specified armoury_entity.
|
||||
// params[1] = entity
|
||||
|
||||
// Valid entity should be within range.
|
||||
CHECK_NONPLAYER(params[1]);
|
||||
|
||||
// Make into edict pointer.
|
||||
edict_t *pArmoury = INDEXENT(params[1]);
|
||||
|
||||
// Make sure this is an armoury_entity.
|
||||
if (strcmp(STRING(pArmoury->v.classname), "armoury_entity")) {
|
||||
// Error out here.
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Not an armoury_entity! (%d)", params[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if PAWN_CELL_SIZE == 32
|
||||
int weapontype = *((int *)pArmoury->pvPrivateData + OFFSET_ARMOURY_TYPE);
|
||||
|
||||
// We do a switch instead of a mapped array because this way we can nicely catch unexpected values, and we don't get array out of bounds thingies.
|
||||
int weapontype_out;
|
||||
switch (weapontype) {
|
||||
case CSA_MP5NAVY: weapontype_out = CSW_MP5NAVY; break;
|
||||
case CSA_TMP: weapontype_out = CSW_TMP; break;
|
||||
case CSA_P90: weapontype_out = CSW_P90; break;
|
||||
case CSA_MAC10: weapontype_out = CSW_MAC10; break;
|
||||
case CSA_AK47: weapontype_out = CSW_AK47; break;
|
||||
case CSA_SG552: weapontype_out = CSW_SG552; break;
|
||||
case CSA_M4A1: weapontype_out = CSW_M4A1; break;
|
||||
case CSA_AUG: weapontype_out = CSW_AUG; break;
|
||||
case CSA_SCOUT: weapontype_out = CSW_SCOUT; break;
|
||||
case CSA_G3SG1: weapontype_out = CSW_G3SG1; break;
|
||||
case CSA_AWP: weapontype_out = CSW_AWP; break;
|
||||
case CSA_M3: weapontype_out = CSW_M3; break;
|
||||
case CSA_XM1014: weapontype_out = CSW_XM1014; break;
|
||||
case CSA_M249: weapontype_out = CSW_M249; break;
|
||||
case CSA_FLASHBANG: weapontype_out = CSW_FLASHBANG; break;
|
||||
case CSA_HEGRENADE: weapontype_out = CSW_HEGRENADE; break;
|
||||
case CSA_VEST: weapontype_out = CSW_VEST; break;
|
||||
case CSA_VESTHELM: weapontype_out = CSW_VESTHELM; break;
|
||||
case CSA_SMOKEGRENADE: weapontype_out = CSW_SMOKEGRENADE; break;
|
||||
default:
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Unexpected weapon type of %d!", params[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return weapontype_out;
|
||||
#else
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "This function not implemented on AMD64.");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL cs_set_armoury_type(AMX *amx, cell *params)
|
||||
{
|
||||
// Set CSW->CSA mapped weapon type to entity.
|
||||
// params[1] = entity
|
||||
// params[2] = CSW_* constant
|
||||
|
||||
// Valid entity should be within range.
|
||||
CHECK_NONPLAYER(params[1]);
|
||||
|
||||
// Make into edict pointer.
|
||||
edict_t *pArmoury = INDEXENT(params[1]);
|
||||
|
||||
// Make sure this is an armoury_entity.
|
||||
if (strcmp(STRING(pArmoury->v.classname), "armoury_entity")) {
|
||||
// Error out here.
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Not an armoury_entity! (%d)", params[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if PAWN_CELL_SIZE == 32
|
||||
|
||||
// We do a switch instead of a mapped array because this way we can nicely catch unexpected values, and we don't get array out of bounds thingies.
|
||||
int weapontype;
|
||||
switch (params[2]) {
|
||||
case CSW_MP5NAVY: weapontype = CSA_MP5NAVY; break;
|
||||
case CSW_TMP: weapontype = CSA_TMP; break;
|
||||
case CSW_P90: weapontype = CSA_P90; break;
|
||||
case CSW_MAC10: weapontype = CSA_MAC10; break;
|
||||
case CSW_AK47: weapontype = CSA_AK47; break;
|
||||
case CSW_SG552: weapontype = CSA_SG552; break;
|
||||
case CSW_M4A1: weapontype = CSA_M4A1; break;
|
||||
case CSW_AUG: weapontype = CSA_AUG; break;
|
||||
case CSW_SCOUT: weapontype = CSA_SCOUT; break;
|
||||
case CSW_G3SG1: weapontype = CSA_G3SG1; break;
|
||||
case CSW_AWP: weapontype = CSA_AWP; break;
|
||||
case CSW_M3: weapontype = CSA_M3; break;
|
||||
case CSW_XM1014: weapontype = CSA_XM1014; break;
|
||||
case CSW_M249: weapontype = CSA_M249; break;
|
||||
case CSW_FLASHBANG: weapontype = CSA_FLASHBANG; break;
|
||||
case CSW_HEGRENADE: weapontype = CSA_HEGRENADE; break;
|
||||
case CSW_VEST: weapontype = CSA_VEST; break;
|
||||
case CSW_VESTHELM: weapontype = CSA_VESTHELM; break;
|
||||
case CSW_SMOKEGRENADE: weapontype = CSA_SMOKEGRENADE; break;
|
||||
default:
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Unsupported weapon type! (%d)", params[2]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*((int *)pArmoury->pvPrivateData + OFFSET_ARMOURY_TYPE) = weapontype;
|
||||
|
||||
return 1;
|
||||
#else
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "This function not implemented on AMD64.");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO cstrike_Exports[] = {
|
||||
{"cs_set_user_money", cs_set_user_money},
|
||||
{"cs_get_user_money", cs_get_user_money},
|
||||
@ -1274,6 +1388,8 @@ AMX_NATIVE_INFO cstrike_Exports[] = {
|
||||
{"cs_set_user_armor", cs_set_user_armor},
|
||||
{"cs_get_user_shield", cs_get_user_shield},
|
||||
{"cs_user_spawn", cs_user_spawn},
|
||||
{"cs_get_armoury_type", cs_get_armoury_type},
|
||||
{"cs_set_armoury_type", cs_set_armoury_type},
|
||||
//------------------- <-- max 19 characters!
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
@ -102,6 +102,8 @@
|
||||
// "hostage_entity" entities
|
||||
#define OFFSET_HOSTAGEFOLLOW 86 + EXTRAOFFSET
|
||||
#define OFFSET_HOSTAGEID 487 + EXTRAOFFSET
|
||||
// "armoury_entity"
|
||||
#define OFFSET_ARMOURY_TYPE 34 + EXTRAOFFSET
|
||||
#else
|
||||
// Amd64 offsets here
|
||||
#define OFFSET_ARMORTYPE 137 + EXTRAOFFSET
|
||||
@ -174,6 +176,29 @@
|
||||
#define CSW_AK47 28
|
||||
//#define CSW_KNIFE 29
|
||||
#define CSW_P90 30
|
||||
#define CSW_VEST 31 // Brand new invention!
|
||||
#define CSW_VESTHELM 32 // Brand new invention!
|
||||
|
||||
// These are used with armoury_entity:s.
|
||||
#define CSA_MP5NAVY 0
|
||||
#define CSA_TMP 1
|
||||
#define CSA_P90 2
|
||||
#define CSA_MAC10 3
|
||||
#define CSA_AK47 4
|
||||
#define CSA_SG552 5
|
||||
#define CSA_M4A1 6
|
||||
#define CSA_AUG 7
|
||||
#define CSA_SCOUT 8
|
||||
#define CSA_G3SG1 9
|
||||
#define CSA_AWP 10
|
||||
#define CSA_M3 11
|
||||
#define CSA_XM1014 12
|
||||
#define CSA_M249 13
|
||||
#define CSA_FLASHBANG 14
|
||||
#define CSA_HEGRENADE 15
|
||||
#define CSA_VEST 16
|
||||
#define CSA_VESTHELM 17
|
||||
#define CSA_SMOKEGRENADE 18
|
||||
|
||||
#define M4A1_SILENCED (1<<2)
|
||||
#define M4A1_ATTACHSILENCEANIM 6
|
||||
@ -275,4 +300,5 @@ bool g_noknives = false;
|
||||
}
|
||||
|
||||
#define GETEDICT(n) \
|
||||
((n >= 1 && n <= gpGlobals->maxClients) ? MF_GetPlayerEdict(n) : INDEXENT(n))
|
||||
((n >= 1 && n <= gpGlobals->maxClients) ? MF_GetPlayerEdict(n) : INDEXENT(n))
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "CStrike"
|
||||
#define MODULE_VERSION "1.50"
|
||||
#define MODULE_VERSION "1.55"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org"
|
||||
#define MODULE_LOGTAG "CSTRIKE"
|
||||
@ -460,3 +460,4 @@
|
||||
#endif // USE_METAMOD
|
||||
|
||||
#endif // __MODULECONFIG_H__
|
||||
|
||||
|
@ -307,4 +307,5 @@ void RankSystem::saveRank( const char* filename )
|
||||
fwrite( &i , 1, sizeof(short int), bfp); // null terminator
|
||||
|
||||
fclose(bfp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,4 +119,5 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -6,7 +6,7 @@ MM_ROOT = ../../../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fomit-frame-pointer
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc
|
||||
NAME = csx_amxx
|
||||
@ -26,12 +26,11 @@ else
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_amd64.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
LINK += -lstdc++
|
||||
else
|
||||
BINARY = $(NAME)_i386.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
|
@ -45,8 +45,6 @@
|
||||
enginefuncs_t g_engfuncs;
|
||||
globalvars_t *gpGlobals;
|
||||
|
||||
|
||||
|
||||
DLL_FUNCTIONS *g_pFunctionTable;
|
||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
enginefuncs_t *g_pengfuncsTable;
|
||||
@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||
|
||||
|
||||
// GetEntityAPI2 functions
|
||||
static DLL_FUNCTIONS g_EntityAPI_Table =
|
||||
{
|
||||
@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
|
||||
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
#ifdef MEMORY_TEST
|
||||
PFN_ALLOCATOR g_fn_Allocator;
|
||||
PFN_REALLOCATOR g_fn_Reallocator;
|
||||
PFN_DEALLOCATOR g_fn_Deallocator;
|
||||
#endif
|
||||
PFN_AMX_EXEC g_fn_AmxExec;
|
||||
PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
@ -2613,10 +2612,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
// Memory
|
||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
|
||||
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
|
||||
#endif
|
||||
|
||||
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
|
||||
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
|
||||
@ -2735,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
|
||||
/************* MEMORY *************/
|
||||
// undef all defined macros
|
||||
#undef new
|
||||
@ -2906,6 +2909,30 @@ void operator delete[](void *reportedAddress)
|
||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined NO_ALLOC_OVERRIDES && !defined MEMORY_TEST && !defined WIN32
|
||||
void * ::operator new(size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void * ::operator new[](size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void ::operator delete(void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void ::operator delete[](void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
/************* stuff from dlls/util.cpp *************/
|
||||
// must come here because cbase.h declares it's own operator new
|
||||
|
||||
|
@ -46,8 +46,6 @@ struct amxx_module_info_s
|
||||
const char *logtag; // added in version 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
// return values from functions called by amxx
|
||||
#define AMXX_OK 0 /* no error */
|
||||
#define AMXX_IFVERS 1 /* interface version */
|
||||
@ -1981,12 +1979,14 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/);
|
||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
|
||||
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const void* /*addr*/ );
|
||||
#endif
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
@ -2048,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
extern PFN_AMX_EXEC g_fn_AmxExec;
|
||||
extern PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
extern PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
|
||||
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
|
||||
@ -2193,6 +2192,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||
#define MF_RequestFunction g_fn_RequestFunction;
|
||||
#define MF_AmxPush g_fn_AmxPush
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
/*** Memory ***/
|
||||
void *operator new(size_t reportedSize);
|
||||
void *operator new[](size_t reportedSize);
|
||||
@ -2236,4 +2236,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
#endif // #ifndef __AMXXMODULE_H__
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "CSX"
|
||||
#define MODULE_VERSION "1.50"
|
||||
#define MODULE_VERSION "1.55"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org/"
|
||||
#define MODULE_LOGTAG "CSX"
|
||||
@ -460,3 +460,4 @@
|
||||
#endif // USE_METAMOD
|
||||
|
||||
#endif // __MODULECONFIG_H__
|
||||
|
||||
|
@ -26,9 +26,9 @@
|
||||
AdditionalIncludeDirectories="..\..\metamod,..\..\sdk\common,..\..\sdk\engine,..\..\sdk\dlls"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;csx_EXPORTS;JIT"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
StructMemberAlignment="3"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
RuntimeLibrary="4"
|
||||
StructMemberAlignment="0"
|
||||
EnableFunctionLevelLinking="FALSE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\release/csx.pch"
|
||||
AssemblerListingLocation=".\release/"
|
||||
@ -91,7 +91,7 @@
|
||||
AdditionalIncludeDirectories="..\..\metamod,..\..\sdk\common,..\..\sdk\engine,..\..\sdk\dlls,..\..\hlsdk\sourcecode\pm_shared"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;csx_EXPORTS"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\debug/csx.pch"
|
||||
AssemblerListingLocation=".\debug/"
|
||||
|
@ -6,7 +6,7 @@ MM_ROOT = ../../../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc
|
||||
NAME = dodfun_amxx
|
||||
@ -26,12 +26,11 @@ else
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_amd64.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
LINK += -lstdc++
|
||||
else
|
||||
BINARY = $(NAME)_i386.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
|
@ -45,8 +45,6 @@
|
||||
enginefuncs_t g_engfuncs;
|
||||
globalvars_t *gpGlobals;
|
||||
|
||||
|
||||
|
||||
DLL_FUNCTIONS *g_pFunctionTable;
|
||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
enginefuncs_t *g_pengfuncsTable;
|
||||
@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||
|
||||
|
||||
// GetEntityAPI2 functions
|
||||
static DLL_FUNCTIONS g_EntityAPI_Table =
|
||||
{
|
||||
@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
|
||||
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
#ifdef MEMORY_TEST
|
||||
PFN_ALLOCATOR g_fn_Allocator;
|
||||
PFN_REALLOCATOR g_fn_Reallocator;
|
||||
PFN_DEALLOCATOR g_fn_Deallocator;
|
||||
#endif
|
||||
PFN_AMX_EXEC g_fn_AmxExec;
|
||||
PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||
PFN_FORMAT g_fn_Format;
|
||||
PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
// *** Exports ***
|
||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||
@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
// Memory
|
||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
|
||||
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
|
||||
#endif
|
||||
|
||||
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
|
||||
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
|
||||
@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
MF_IsPlayerHLTV(0);
|
||||
MF_GetPlayerArmor(0);
|
||||
MF_GetPlayerHealth(0);
|
||||
MF_AmxExec(0, 0, 0, 0);
|
||||
MF_AmxExec(0, 0, 0);
|
||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||
MF_AmxFindPublic(0, 0, 0);
|
||||
MF_AmxAllot(0, 0, 0, 0);
|
||||
@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
|
||||
/************* MEMORY *************/
|
||||
// undef all defined macros
|
||||
#undef new
|
||||
@ -2904,6 +2909,30 @@ void operator delete[](void *reportedAddress)
|
||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined NO_ALLOC_OVERRIDES && !defined MEMORY_TEST && !defined WIN32
|
||||
void * ::operator new(size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void * ::operator new[](size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void ::operator delete(void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void ::operator delete[](void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
/************* stuff from dlls/util.cpp *************/
|
||||
// must come here because cbase.h declares it's own operator new
|
||||
|
||||
|
@ -46,8 +46,6 @@ struct amxx_module_info_s
|
||||
const char *logtag; // added in version 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
// return values from functions called by amxx
|
||||
#define AMXX_OK 0 /* no error */
|
||||
#define AMXX_IFVERS 1 /* interface version */
|
||||
@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/);
|
||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
|
||||
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const void* /*addr*/ );
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
|
||||
#endif
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/);
|
||||
typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/);
|
||||
|
||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||
@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
extern PFN_AMX_EXEC g_fn_AmxExec;
|
||||
extern PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
extern PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
|
||||
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
|
||||
@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format;
|
||||
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
|
||||
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
extern PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
extern PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
#ifdef MAY_NEVER_BE_DEFINED
|
||||
// Function prototypes for intellisense and similar systems
|
||||
@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { }
|
||||
const char * MF_Format (const char *fmt, ...) { }
|
||||
void MF_RegisterFunction (void *pfn, const char *description) { }
|
||||
void * MF_RequestFunction (const char *description) { }
|
||||
int MF_AmxPush (AMX *amx, cell *params) { }
|
||||
int MF_AmxExec (AMX *amx, cell *retval, int idx) { }
|
||||
#endif // MAY_NEVER_BE_DEFINED
|
||||
|
||||
#define MF_AddNatives g_fn_AddNatives
|
||||
@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||
#define MF_Format g_fn_Format
|
||||
#define MF_RegisterFunction g_fn_RegisterFunction
|
||||
#define MF_RequestFunction g_fn_RequestFunction;
|
||||
#define MF_AmxPush g_fn_AmxPush
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
/*** Memory ***/
|
||||
void *operator new(size_t reportedSize);
|
||||
void *operator new[](size_t reportedSize);
|
||||
@ -2231,4 +2236,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
#endif // #ifndef __AMXXMODULE_H__
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "DoD Fun"
|
||||
#define MODULE_VERSION "1.50"
|
||||
#define MODULE_VERSION "1.55"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org"
|
||||
#define MODULE_LOGTAG "DODFUN"
|
||||
|
@ -6,7 +6,7 @@ MM_ROOT = ../../../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc
|
||||
NAME = dodx_amxx
|
||||
@ -26,12 +26,11 @@ else
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_amd64.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
LINK += -lstdc++
|
||||
else
|
||||
BINARY = $(NAME)_i386.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
|
@ -45,8 +45,6 @@
|
||||
enginefuncs_t g_engfuncs;
|
||||
globalvars_t *gpGlobals;
|
||||
|
||||
|
||||
|
||||
DLL_FUNCTIONS *g_pFunctionTable;
|
||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
enginefuncs_t *g_pengfuncsTable;
|
||||
@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||
|
||||
|
||||
// GetEntityAPI2 functions
|
||||
static DLL_FUNCTIONS g_EntityAPI_Table =
|
||||
{
|
||||
@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
|
||||
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
#ifdef MEMORY_TEST
|
||||
PFN_ALLOCATOR g_fn_Allocator;
|
||||
PFN_REALLOCATOR g_fn_Reallocator;
|
||||
PFN_DEALLOCATOR g_fn_Deallocator;
|
||||
#endif
|
||||
PFN_AMX_EXEC g_fn_AmxExec;
|
||||
PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
@ -2613,10 +2612,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
// Memory
|
||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
|
||||
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
|
||||
#endif
|
||||
|
||||
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
|
||||
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
|
||||
@ -2735,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
|
||||
/************* MEMORY *************/
|
||||
// undef all defined macros
|
||||
#undef new
|
||||
@ -2906,6 +2909,30 @@ void operator delete[](void *reportedAddress)
|
||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined NO_ALLOC_OVERRIDES && !defined MEMORY_TEST && !defined WIN32
|
||||
void * ::operator new(size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void * ::operator new[](size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void ::operator delete(void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void ::operator delete[](void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
/************* stuff from dlls/util.cpp *************/
|
||||
// must come here because cbase.h declares it's own operator new
|
||||
|
||||
|
@ -46,8 +46,6 @@ struct amxx_module_info_s
|
||||
const char *logtag; // added in version 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
// return values from functions called by amxx
|
||||
#define AMXX_OK 0 /* no error */
|
||||
#define AMXX_IFVERS 1 /* interface version */
|
||||
@ -1981,12 +1979,14 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/);
|
||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
|
||||
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const void* /*addr*/ );
|
||||
#endif
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
@ -2048,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
extern PFN_AMX_EXEC g_fn_AmxExec;
|
||||
extern PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
extern PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
|
||||
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
|
||||
@ -2193,6 +2192,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||
#define MF_RequestFunction g_fn_RequestFunction;
|
||||
#define MF_AmxPush g_fn_AmxPush
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
/*** Memory ***/
|
||||
void *operator new(size_t reportedSize);
|
||||
void *operator new[](size_t reportedSize);
|
||||
@ -2236,4 +2236,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
#endif // #ifndef __AMXXMODULE_H__
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "DoDX"
|
||||
#define MODULE_VERSION "1.50"
|
||||
#define MODULE_VERSION "1.55"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org"
|
||||
#define MODULE_LOGTAG "DODX"
|
||||
|
@ -6,7 +6,7 @@ MM_ROOT = ../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fomit-frame-pointer
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc
|
||||
NAME = engine_amxx
|
||||
@ -26,12 +26,11 @@ else
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_amd64.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
LINK += -lstdc++
|
||||
else
|
||||
BINARY = $(NAME)_i386.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
|
@ -45,8 +45,6 @@
|
||||
enginefuncs_t g_engfuncs;
|
||||
globalvars_t *gpGlobals;
|
||||
|
||||
|
||||
|
||||
DLL_FUNCTIONS *g_pFunctionTable;
|
||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
enginefuncs_t *g_pengfuncsTable;
|
||||
@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||
|
||||
|
||||
// GetEntityAPI2 functions
|
||||
static DLL_FUNCTIONS g_EntityAPI_Table =
|
||||
{
|
||||
@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
|
||||
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
#ifdef MEMORY_TEST
|
||||
PFN_ALLOCATOR g_fn_Allocator;
|
||||
PFN_REALLOCATOR g_fn_Reallocator;
|
||||
PFN_DEALLOCATOR g_fn_Deallocator;
|
||||
#endif
|
||||
PFN_AMX_EXEC g_fn_AmxExec;
|
||||
PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||
PFN_FORMAT g_fn_Format;
|
||||
PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
// *** Exports ***
|
||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||
@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
// Memory
|
||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
|
||||
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
|
||||
#endif
|
||||
|
||||
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
|
||||
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
|
||||
@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
MF_IsPlayerHLTV(0);
|
||||
MF_GetPlayerArmor(0);
|
||||
MF_GetPlayerHealth(0);
|
||||
MF_AmxExec(0, 0, 0, 0);
|
||||
MF_AmxExec(0, 0, 0);
|
||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||
MF_AmxFindPublic(0, 0, 0);
|
||||
MF_AmxAllot(0, 0, 0, 0);
|
||||
@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
|
||||
/************* MEMORY *************/
|
||||
// undef all defined macros
|
||||
#undef new
|
||||
@ -2904,6 +2909,30 @@ void operator delete[](void *reportedAddress)
|
||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined NO_ALLOC_OVERRIDES && !defined MEMORY_TEST && !defined WIN32
|
||||
void * ::operator new(size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void * ::operator new[](size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void ::operator delete(void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void ::operator delete[](void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
/************* stuff from dlls/util.cpp *************/
|
||||
// must come here because cbase.h declares it's own operator new
|
||||
|
||||
|
@ -46,8 +46,6 @@ struct amxx_module_info_s
|
||||
const char *logtag; // added in version 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
// return values from functions called by amxx
|
||||
#define AMXX_OK 0 /* no error */
|
||||
#define AMXX_IFVERS 1 /* interface version */
|
||||
@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/);
|
||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
|
||||
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const void* /*addr*/ );
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
|
||||
#endif
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/);
|
||||
typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/);
|
||||
|
||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||
@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
extern PFN_AMX_EXEC g_fn_AmxExec;
|
||||
extern PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
extern PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
|
||||
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
|
||||
@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format;
|
||||
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
|
||||
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
extern PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
extern PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
#ifdef MAY_NEVER_BE_DEFINED
|
||||
// Function prototypes for intellisense and similar systems
|
||||
@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { }
|
||||
const char * MF_Format (const char *fmt, ...) { }
|
||||
void MF_RegisterFunction (void *pfn, const char *description) { }
|
||||
void * MF_RequestFunction (const char *description) { }
|
||||
int MF_AmxPush (AMX *amx, cell *params) { }
|
||||
int MF_AmxExec (AMX *amx, cell *retval, int idx) { }
|
||||
#endif // MAY_NEVER_BE_DEFINED
|
||||
|
||||
#define MF_AddNatives g_fn_AddNatives
|
||||
@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||
#define MF_Format g_fn_Format
|
||||
#define MF_RegisterFunction g_fn_RegisterFunction
|
||||
#define MF_RequestFunction g_fn_RequestFunction;
|
||||
#define MF_AmxPush g_fn_AmxPush
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
/*** Memory ***/
|
||||
void *operator new(size_t reportedSize);
|
||||
void *operator new[](size_t reportedSize);
|
||||
@ -2231,4 +2236,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
#endif // #ifndef __AMXXMODULE_H__
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "Engine"
|
||||
#define MODULE_VERSION "1.50"
|
||||
#define MODULE_VERSION "1.55"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org"
|
||||
#define MODULE_LOGTAG "ENGINE"
|
||||
|
@ -6,15 +6,15 @@ MM_ROOT = ../../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc
|
||||
NAME = fakemeta_amxx
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp dllfunc.cpp engfunc.cpp fakemeta_amxx.cpp pdata.cpp forward.cpp \
|
||||
fm_tr.cpp pev.cpp
|
||||
fm_tr.cpp pev.cpp
|
||||
|
||||
LINK =
|
||||
LINK =
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
|
||||
-I$(MM_ROOT) -Lzlib -I$(HLSDK)/common
|
||||
@ -27,12 +27,11 @@ else
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_amd64.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
LINK += -lstdc++
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
else
|
||||
BINARY = $(NAME)_i386.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
@ -55,7 +54,7 @@ amd64:
|
||||
fakemeta: $(OBJ_LINUX)
|
||||
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
||||
|
||||
debug:
|
||||
debug:
|
||||
$(MAKE) all DEBUG=true
|
||||
|
||||
default: all
|
||||
|
@ -89,7 +89,7 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
iparam1 = MDLL_ClientConnect(INDEXENT2(index),STRING(ALLOC_STRING(temp)),STRING(ALLOC_STRING(temp2)),temp3);
|
||||
cRet = MF_GetAmxAddr(amx,params[6]);
|
||||
MF_SetAmxString(amx,params[5],temp3,cRet[0]);
|
||||
return 1;
|
||||
return iparam1;
|
||||
|
||||
case DLLFunc_ClientDisconnect: // void ) ( edict_t *pEntity );
|
||||
cRet = MF_GetAmxAddr(amx,params[2]);
|
||||
@ -228,4 +228,5 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
||||
AMX_NATIVE_INFO dllfunc_natives[] = {
|
||||
{"dllfunc", dllfunc},
|
||||
{NULL, NULL},
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -971,4 +971,5 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
||||
AMX_NATIVE_INFO engfunc_natives[] = {
|
||||
{"engfunc", engfunc},
|
||||
{NULL, NULL},
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -167,18 +167,11 @@
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\pev.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="TRUE">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\pev.h">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="TRUE">
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
</FileConfiguration>
|
||||
@ -201,6 +194,19 @@
|
||||
Name="hlsdk"
|
||||
Filter="">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Pawn includes"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="..\..\plugins\include\fakemeta.inc">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\plugins\include\fakemeta_const.inc">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\plugins\include\fakemeta_stocks.inc">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
@ -42,7 +42,6 @@ inline edict_t* INDEXENT2( int iEdictNum )
|
||||
#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(INDEXENT2(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; }
|
||||
extern AMX_NATIVE_INFO engfunc_natives[];
|
||||
extern AMX_NATIVE_INFO dllfunc_natives[];
|
||||
//extern AMX_NATIVE_INFO pev_natives[];
|
||||
extern AMX_NATIVE_INFO forward_natives[];
|
||||
extern AMX_NATIVE_INFO pdata_natives[];
|
||||
extern AMX_NATIVE_INFO tr_Natives[];
|
||||
@ -58,7 +57,8 @@ extern DLL_FUNCTIONS *g_pFunctionTable;
|
||||
extern DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
extern enginefuncs_t *g_pengfuncsTable;
|
||||
extern enginefuncs_t *g_pengfuncsTable_Post;
|
||||
|
||||
extern NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||
extern NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||
|
||||
#endif //_FAKEMETA_INCLUDE_H
|
||||
|
||||
|
@ -248,4 +248,5 @@ AMX_NATIVE_INFO tr_Natives[] = {
|
||||
{"get_kv", get_kv},
|
||||
{"set_kv", set_kv},
|
||||
{NULL, NULL},
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -27,4 +27,5 @@ enum KeyValue
|
||||
|
||||
extern AMX_NATIVE_INFO tr_Natives[];
|
||||
|
||||
#endif //_INCLUDE_TR_H
|
||||
#endif //_INCLUDE_TR_H
|
||||
|
||||
|
@ -479,7 +479,15 @@ SIMPLE_VOID_HOOK_VOID(CreateInstancedBaselines);
|
||||
SIMPLE_INT_HOOK_VOID(AllowLagCompensation);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* NEW_DLL_FUNCTIONS
|
||||
*/
|
||||
// pfnOnFreeEntPrivateData
|
||||
SIMPLE_VOID_HOOK_EDICT(OnFreeEntPrivateData);
|
||||
// pfnGameShutdown
|
||||
SIMPLE_VOID_HOOK_VOID(GameShutdown);
|
||||
// pfnShouldCollide
|
||||
SIMPLE_INT_HOOK_EDICT_EDICT(ShouldCollide);
|
||||
|
||||
|
||||
|
||||
@ -503,15 +511,19 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
|
||||
|
||||
DLL_FUNCTIONS *dlltable;
|
||||
|
||||
NEW_DLL_FUNCTIONS *newdlltable;
|
||||
|
||||
if (post)
|
||||
{
|
||||
engtable = g_pengfuncsTable_Post;
|
||||
dlltable = g_pFunctionTable_Post;
|
||||
newdlltable = g_pNewFunctionsTable_Post;
|
||||
}
|
||||
else
|
||||
{
|
||||
engtable = g_pengfuncsTable;
|
||||
dlltable = g_pFunctionTable;
|
||||
newdlltable = g_pNewFunctionsTable;
|
||||
}
|
||||
|
||||
switch (func)
|
||||
@ -1061,6 +1073,20 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
|
||||
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
|
||||
DLLHOOK(AllowLagCompensation);
|
||||
break;
|
||||
// NEW_DLL_FUNCTIONS:
|
||||
case FM_OnFreeEntPrivateData:
|
||||
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_DONE);
|
||||
NEWDLLHOOK(OnFreeEntPrivateData);
|
||||
break;
|
||||
// Maybe it's not possible to hook this forward? O_o
|
||||
case FM_GameShutdown:
|
||||
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
|
||||
NEWDLLHOOK(GameShutdown);
|
||||
break;
|
||||
case FM_ShouldCollide:
|
||||
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_DONE);
|
||||
NEWDLLHOOK(ShouldCollide);
|
||||
break;
|
||||
#if 0
|
||||
|
||||
// I know this does not fit with DLLFUNC(), but I dont want another native just for it.
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef _INCLUDE_FORWARD_H
|
||||
#define _INCLUDE_FORWARD_H
|
||||
|
||||
#define ENGFUNC_NUM 118
|
||||
#define ENGFUNC_NUM FM_LAST_DONT_USE_ME // 118
|
||||
|
||||
#define FMV_STRING 1
|
||||
#define FMV_FLOAT 2
|
||||
@ -150,6 +150,12 @@ enum {
|
||||
FM_CreateInstancedBaselines, // done
|
||||
FM_AllowLagCompensation, // done
|
||||
FM_AlertMessage,
|
||||
|
||||
// NEW_DLL_FUNCTIONS
|
||||
FM_OnFreeEntPrivateData,
|
||||
FM_GameShutdown,
|
||||
FM_ShouldCollide,
|
||||
// FM_CvarValue
|
||||
FM_LAST_DONT_USE_ME,
|
||||
};
|
||||
|
||||
|
@ -742,12 +742,31 @@
|
||||
RETURN_META(MRES_IGNORED); \
|
||||
}
|
||||
|
||||
/*
|
||||
#define SIMPLE_INT_HOOK_EDICT(call) \
|
||||
int call (edict_t *pent) \
|
||||
{ \
|
||||
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX(pent))); \
|
||||
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
|
||||
} \
|
||||
int call##_post (edict_t *pent) \
|
||||
{ \
|
||||
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(pent))); \
|
||||
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define SIMPLE_INT_HOOK_EDICT_EDICT(call) \
|
||||
int call (edict_t *pent,edict_t *pentb) \
|
||||
{ \
|
||||
FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i), ENTINDEX(pent), ENTINDEX(pentb))); \
|
||||
RETURN_META_VALUE(mswi(lastFmRes), (int)mlCellResult); \
|
||||
} \
|
||||
int call##_post (edict_t *pent,edict_t *pentb) \
|
||||
{ \
|
||||
FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i), ENTINDEX(pent), ENTINDEX(pentb))); \
|
||||
RETURN_META_VALUE(MRES_IGNORED, (int)mlCellResult); \
|
||||
}
|
||||
|
||||
#define ENGHOOK(pfnCall) \
|
||||
if (post) \
|
||||
@ -772,6 +791,17 @@
|
||||
if (dlltable->pfn##pfnCall == NULL) \
|
||||
dlltable->pfn##pfnCall = pfnCall; \
|
||||
}
|
||||
#define NEWDLLHOOK(pfnCall) \
|
||||
if (post) \
|
||||
{ \
|
||||
if (newdlltable->pfn##pfnCall == NULL) \
|
||||
newdlltable->pfn##pfnCall = pfnCall##_post; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (newdlltable->pfn##pfnCall == NULL) \
|
||||
newdlltable->pfn##pfnCall = pfnCall; \
|
||||
}
|
||||
|
||||
#define PREPARE_VECTOR(vector_name) \
|
||||
cell vector_name##_cell[3] = {amx_ftoc(vector_name[0]), amx_ftoc(vector_name[1]), amx_ftoc(vector_name[2])}; \
|
||||
|
@ -53,10 +53,77 @@ static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params)
|
||||
#endif
|
||||
return amx_ftoc(*((float *)INDEXENT2(index)->pvPrivateData + iOffset));
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params)
|
||||
{
|
||||
int index=params[1];
|
||||
CHECK_ENTITY(index);
|
||||
|
||||
int iOffset=params[2];
|
||||
if (iOffset <0)
|
||||
return 1;
|
||||
#ifdef __linux__
|
||||
iOffset += params[6];
|
||||
#endif
|
||||
|
||||
edict_t *pEdict = INDEXENT2(index);
|
||||
|
||||
char *szData;
|
||||
if (params[5])
|
||||
{
|
||||
szData = *((char **)pEdict->pvPrivateData + iOffset);
|
||||
} else {
|
||||
szData = (char *)pEdict->pvPrivateData + iOffset;
|
||||
}
|
||||
|
||||
return MF_SetAmxString(amx, params[3], szData, params[4]);
|
||||
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL set_pdata_string(AMX *amx, cell *params)
|
||||
{
|
||||
int index=params[1];
|
||||
CHECK_ENTITY(index);
|
||||
|
||||
int iOffset=params[2];
|
||||
if (iOffset <0)
|
||||
return 1;
|
||||
#ifdef __linux__
|
||||
iOffset += params[5];
|
||||
#endif
|
||||
|
||||
edict_t *pEdict = INDEXENT2(index);
|
||||
|
||||
char *szData;
|
||||
int len;
|
||||
char *data = MF_GetAmxString(amx, params[3], 0, &len);
|
||||
if (params[4] == -1)
|
||||
{
|
||||
szData = (char *)pEdict->pvPrivateData + iOffset;
|
||||
strcpy(szData, data);
|
||||
} else {
|
||||
szData = *((char **)pEdict->pvPrivateData + iOffset);
|
||||
if (params[4] == 1)
|
||||
{
|
||||
free(szData);
|
||||
szData = (char *)malloc(len + 1);
|
||||
} else if (params[4] == 2) {
|
||||
delete [] szData;
|
||||
szData = new char[len + 1];
|
||||
}
|
||||
strcpy(szData, data);
|
||||
*((char **)pEdict->pvPrivateData + iOffset) = szData;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO pdata_natives[] = {
|
||||
{ "get_pdata_int", get_pdata_int },
|
||||
{ "set_pdata_int", set_pdata_int },
|
||||
{ "get_pdata_float", get_pdata_float },
|
||||
{ "set_pdata_float", set_pdata_float },
|
||||
{ "set_pdata_string", set_pdata_string },
|
||||
{ "get_pdata_string", get_pdata_string },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
@ -45,8 +45,6 @@
|
||||
enginefuncs_t g_engfuncs;
|
||||
globalvars_t *gpGlobals;
|
||||
|
||||
|
||||
|
||||
DLL_FUNCTIONS *g_pFunctionTable;
|
||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
enginefuncs_t *g_pengfuncsTable;
|
||||
@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||
|
||||
|
||||
// GetEntityAPI2 functions
|
||||
static DLL_FUNCTIONS g_EntityAPI_Table =
|
||||
{
|
||||
@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
|
||||
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
#ifdef MEMORY_TEST
|
||||
PFN_ALLOCATOR g_fn_Allocator;
|
||||
PFN_REALLOCATOR g_fn_Reallocator;
|
||||
PFN_DEALLOCATOR g_fn_Deallocator;
|
||||
#endif
|
||||
PFN_AMX_EXEC g_fn_AmxExec;
|
||||
PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||
PFN_FORMAT g_fn_Format;
|
||||
PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
// *** Exports ***
|
||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||
@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
// Memory
|
||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
|
||||
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
|
||||
#endif
|
||||
|
||||
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
|
||||
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
|
||||
@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
MF_IsPlayerHLTV(0);
|
||||
MF_GetPlayerArmor(0);
|
||||
MF_GetPlayerHealth(0);
|
||||
MF_AmxExec(0, 0, 0, 0);
|
||||
MF_AmxExec(0, 0, 0);
|
||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||
MF_AmxFindPublic(0, 0, 0);
|
||||
MF_AmxAllot(0, 0, 0, 0);
|
||||
@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
|
||||
/************* MEMORY *************/
|
||||
// undef all defined macros
|
||||
#undef new
|
||||
@ -2904,6 +2909,30 @@ void operator delete[](void *reportedAddress)
|
||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined NO_ALLOC_OVERRIDES && !defined MEMORY_TEST && !defined WIN32
|
||||
void * ::operator new(size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void * ::operator new[](size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void ::operator delete(void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void ::operator delete[](void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
/************* stuff from dlls/util.cpp *************/
|
||||
// must come here because cbase.h declares it's own operator new
|
||||
|
||||
|
@ -46,8 +46,6 @@ struct amxx_module_info_s
|
||||
const char *logtag; // added in version 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
// return values from functions called by amxx
|
||||
#define AMXX_OK 0 /* no error */
|
||||
#define AMXX_IFVERS 1 /* interface version */
|
||||
@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/);
|
||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
|
||||
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const void* /*addr*/ );
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
|
||||
#endif
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/);
|
||||
typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/);
|
||||
|
||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||
@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
extern PFN_AMX_EXEC g_fn_AmxExec;
|
||||
extern PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
extern PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
|
||||
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
|
||||
@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format;
|
||||
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
|
||||
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
extern PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
extern PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
#ifdef MAY_NEVER_BE_DEFINED
|
||||
// Function prototypes for intellisense and similar systems
|
||||
@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { }
|
||||
const char * MF_Format (const char *fmt, ...) { }
|
||||
void MF_RegisterFunction (void *pfn, const char *description) { }
|
||||
void * MF_RequestFunction (const char *description) { }
|
||||
int MF_AmxPush (AMX *amx, cell *params) { }
|
||||
int MF_AmxExec (AMX *amx, cell *retval, int idx) { }
|
||||
#endif // MAY_NEVER_BE_DEFINED
|
||||
|
||||
#define MF_AddNatives g_fn_AddNatives
|
||||
@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||
#define MF_Format g_fn_Format
|
||||
#define MF_RegisterFunction g_fn_RegisterFunction
|
||||
#define MF_RequestFunction g_fn_RequestFunction;
|
||||
#define MF_AmxPush g_fn_AmxPush
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
/*** Memory ***/
|
||||
void *operator new(size_t reportedSize);
|
||||
void *operator new[](size_t reportedSize);
|
||||
@ -2231,4 +2236,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
#endif // #ifndef __AMXXMODULE_H__
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "FakeMeta"
|
||||
#define MODULE_VERSION "1.50"
|
||||
#define MODULE_VERSION "1.55"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org"
|
||||
#define MODULE_LOGTAG "FAKEMETA"
|
||||
|
@ -6,7 +6,7 @@ MM_ROOT = ../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fomit-frame-pointer
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc
|
||||
NAME = fun_amxx
|
||||
@ -26,12 +26,11 @@ else
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_amd64.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
LINK += -lstdc++
|
||||
else
|
||||
BINARY = $(NAME)_i386.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
|
@ -45,8 +45,6 @@
|
||||
enginefuncs_t g_engfuncs;
|
||||
globalvars_t *gpGlobals;
|
||||
|
||||
|
||||
|
||||
DLL_FUNCTIONS *g_pFunctionTable;
|
||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
enginefuncs_t *g_pengfuncsTable;
|
||||
@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||
|
||||
|
||||
// GetEntityAPI2 functions
|
||||
static DLL_FUNCTIONS g_EntityAPI_Table =
|
||||
{
|
||||
@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
|
||||
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
#ifdef MEMORY_TEST
|
||||
PFN_ALLOCATOR g_fn_Allocator;
|
||||
PFN_REALLOCATOR g_fn_Reallocator;
|
||||
PFN_DEALLOCATOR g_fn_Deallocator;
|
||||
#endif
|
||||
PFN_AMX_EXEC g_fn_AmxExec;
|
||||
PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||
PFN_FORMAT g_fn_Format;
|
||||
PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
// *** Exports ***
|
||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||
@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
// Memory
|
||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
|
||||
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
|
||||
#endif
|
||||
|
||||
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
|
||||
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
|
||||
@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
MF_IsPlayerHLTV(0);
|
||||
MF_GetPlayerArmor(0);
|
||||
MF_GetPlayerHealth(0);
|
||||
MF_AmxExec(0, 0, 0, 0);
|
||||
MF_AmxExec(0, 0, 0);
|
||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||
MF_AmxFindPublic(0, 0, 0);
|
||||
MF_AmxAllot(0, 0, 0, 0);
|
||||
@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
|
||||
/************* MEMORY *************/
|
||||
// undef all defined macros
|
||||
#undef new
|
||||
@ -2904,6 +2909,30 @@ void operator delete[](void *reportedAddress)
|
||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined NO_ALLOC_OVERRIDES && !defined MEMORY_TEST && !defined WIN32
|
||||
void * ::operator new(size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void * ::operator new[](size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void ::operator delete(void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void ::operator delete[](void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
/************* stuff from dlls/util.cpp *************/
|
||||
// must come here because cbase.h declares it's own operator new
|
||||
|
||||
|
@ -46,8 +46,6 @@ struct amxx_module_info_s
|
||||
const char *logtag; // added in version 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
// return values from functions called by amxx
|
||||
#define AMXX_OK 0 /* no error */
|
||||
#define AMXX_IFVERS 1 /* interface version */
|
||||
@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/);
|
||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
|
||||
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const void* /*addr*/ );
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
|
||||
#endif
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/);
|
||||
typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/);
|
||||
|
||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||
@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
extern PFN_AMX_EXEC g_fn_AmxExec;
|
||||
extern PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
extern PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
|
||||
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
|
||||
@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format;
|
||||
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
|
||||
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
extern PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
extern PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
#ifdef MAY_NEVER_BE_DEFINED
|
||||
// Function prototypes for intellisense and similar systems
|
||||
@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { }
|
||||
const char * MF_Format (const char *fmt, ...) { }
|
||||
void MF_RegisterFunction (void *pfn, const char *description) { }
|
||||
void * MF_RequestFunction (const char *description) { }
|
||||
int MF_AmxPush (AMX *amx, cell *params) { }
|
||||
int MF_AmxExec (AMX *amx, cell *retval, int idx) { }
|
||||
#endif // MAY_NEVER_BE_DEFINED
|
||||
|
||||
#define MF_AddNatives g_fn_AddNatives
|
||||
@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||
#define MF_Format g_fn_Format
|
||||
#define MF_RegisterFunction g_fn_RegisterFunction
|
||||
#define MF_RequestFunction g_fn_RequestFunction;
|
||||
#define MF_AmxPush g_fn_AmxPush
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
/*** Memory ***/
|
||||
void *operator new(size_t reportedSize);
|
||||
void *operator new[](size_t reportedSize);
|
||||
@ -2231,4 +2236,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
#endif // #ifndef __AMXXMODULE_H__
|
||||
|
@ -61,6 +61,7 @@
|
||||
// ######## Utils:
|
||||
void FUNUTIL_ResetPlayer(int index)
|
||||
{
|
||||
//MF_PrintSrvConsole("Resetting player index %d! maxclients: %d\n", index, gpGlobals->maxClients);
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++) {
|
||||
g_bodyhits[index][i] = (1<<HITGROUP_GENERIC) |
|
||||
(1<<HITGROUP_HEAD) |
|
||||
@ -654,14 +655,17 @@ void TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *shoot
|
||||
void OnAmxxAttach()
|
||||
{
|
||||
MF_AddNatives(fun_Exports);
|
||||
}
|
||||
|
||||
// The content of OnPluginsLoaded() was moved from OnAmxxAttach with AMXx 1.5 because for some reason gpGlobals->maxClients wasn't
|
||||
// initialized to its proper value until some time after OnAmxxAttach(). In OnAmxxAttach() it always showed 0. /JGHG
|
||||
void OnPluginsLoaded() {
|
||||
// Reset stuff - hopefully this should
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++) {
|
||||
// Reset all hitzones
|
||||
FUNUTIL_ResetPlayer(i);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void ClientConnectFakeBot(int index)
|
||||
{
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "Fun"
|
||||
#define MODULE_VERSION "1.50"
|
||||
#define MODULE_VERSION "1.55"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org"
|
||||
#define MODULE_LOGTAG "FUN"
|
||||
@ -32,7 +32,7 @@
|
||||
//#define FN_AMXX_DETTACH OnAmxxDettach
|
||||
// All plugins loaded
|
||||
// Do forward functions init here (MF_RegisterForward)
|
||||
// #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded
|
||||
#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded
|
||||
|
||||
/**** METAMOD ****/
|
||||
// If your module doesn't use metamod, you may close the file now :)
|
||||
@ -460,3 +460,4 @@
|
||||
#endif // USE_METAMOD
|
||||
|
||||
#endif // __MODULECONFIG_H__
|
||||
|
||||
|
Binary file not shown.
@ -6,7 +6,7 @@ MM_ROOT = ../../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc
|
||||
NAME = geoip_amxx
|
||||
@ -26,12 +26,11 @@ else
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_amd64.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
LINK += -lstdc++
|
||||
else
|
||||
BINARY = $(NAME)_i386.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
|
@ -45,8 +45,6 @@
|
||||
enginefuncs_t g_engfuncs;
|
||||
globalvars_t *gpGlobals;
|
||||
|
||||
|
||||
|
||||
DLL_FUNCTIONS *g_pFunctionTable;
|
||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
enginefuncs_t *g_pengfuncsTable;
|
||||
@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||
|
||||
|
||||
// GetEntityAPI2 functions
|
||||
static DLL_FUNCTIONS g_EntityAPI_Table =
|
||||
{
|
||||
@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
|
||||
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
#ifdef MEMORY_TEST
|
||||
PFN_ALLOCATOR g_fn_Allocator;
|
||||
PFN_REALLOCATOR g_fn_Reallocator;
|
||||
PFN_DEALLOCATOR g_fn_Deallocator;
|
||||
#endif
|
||||
PFN_AMX_EXEC g_fn_AmxExec;
|
||||
PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||
PFN_FORMAT g_fn_Format;
|
||||
PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
// *** Exports ***
|
||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||
@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
// Memory
|
||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
|
||||
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
|
||||
#endif
|
||||
|
||||
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
|
||||
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
|
||||
@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
MF_IsPlayerHLTV(0);
|
||||
MF_GetPlayerArmor(0);
|
||||
MF_GetPlayerHealth(0);
|
||||
MF_AmxExec(0, 0, 0, 0);
|
||||
MF_AmxExec(0, 0, 0);
|
||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||
MF_AmxFindPublic(0, 0, 0);
|
||||
MF_AmxAllot(0, 0, 0, 0);
|
||||
@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
|
||||
/************* MEMORY *************/
|
||||
// undef all defined macros
|
||||
#undef new
|
||||
@ -2904,6 +2909,30 @@ void operator delete[](void *reportedAddress)
|
||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined NO_ALLOC_OVERRIDES && !defined MEMORY_TEST && !defined WIN32
|
||||
void * ::operator new(size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void * ::operator new[](size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void ::operator delete(void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void ::operator delete[](void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
/************* stuff from dlls/util.cpp *************/
|
||||
// must come here because cbase.h declares it's own operator new
|
||||
|
||||
|
@ -46,8 +46,6 @@ struct amxx_module_info_s
|
||||
const char *logtag; // added in version 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
// return values from functions called by amxx
|
||||
#define AMXX_OK 0 /* no error */
|
||||
#define AMXX_IFVERS 1 /* interface version */
|
||||
@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/);
|
||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
|
||||
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const void* /*addr*/ );
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
|
||||
#endif
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/);
|
||||
typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/);
|
||||
|
||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||
@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
extern PFN_AMX_EXEC g_fn_AmxExec;
|
||||
extern PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
extern PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
|
||||
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
|
||||
@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format;
|
||||
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
|
||||
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
extern PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
extern PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
#ifdef MAY_NEVER_BE_DEFINED
|
||||
// Function prototypes for intellisense and similar systems
|
||||
@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { }
|
||||
const char * MF_Format (const char *fmt, ...) { }
|
||||
void MF_RegisterFunction (void *pfn, const char *description) { }
|
||||
void * MF_RequestFunction (const char *description) { }
|
||||
int MF_AmxPush (AMX *amx, cell *params) { }
|
||||
int MF_AmxExec (AMX *amx, cell *retval, int idx) { }
|
||||
#endif // MAY_NEVER_BE_DEFINED
|
||||
|
||||
#define MF_AddNatives g_fn_AddNatives
|
||||
@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||
#define MF_Format g_fn_Format
|
||||
#define MF_RegisterFunction g_fn_RegisterFunction
|
||||
#define MF_RequestFunction g_fn_RequestFunction;
|
||||
#define MF_AmxPush g_fn_AmxPush
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
/*** Memory ***/
|
||||
void *operator new(size_t reportedSize);
|
||||
void *operator new[](size_t reportedSize);
|
||||
@ -2231,4 +2236,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
#endif // #ifndef __AMXXMODULE_H__
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "GeoIP"
|
||||
#define MODULE_VERSION "1.50"
|
||||
#define MODULE_VERSION "1.55"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org/"
|
||||
#define MODULE_LOGTAG "GEOIP"
|
||||
|
@ -45,8 +45,6 @@
|
||||
enginefuncs_t g_engfuncs;
|
||||
globalvars_t *gpGlobals;
|
||||
|
||||
|
||||
|
||||
DLL_FUNCTIONS *g_pFunctionTable;
|
||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
enginefuncs_t *g_pengfuncsTable;
|
||||
@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||
|
||||
|
||||
// GetEntityAPI2 functions
|
||||
static DLL_FUNCTIONS g_EntityAPI_Table =
|
||||
{
|
||||
@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
|
||||
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
#ifdef MEMORY_TEST
|
||||
PFN_ALLOCATOR g_fn_Allocator;
|
||||
PFN_REALLOCATOR g_fn_Reallocator;
|
||||
PFN_DEALLOCATOR g_fn_Deallocator;
|
||||
#endif
|
||||
PFN_AMX_EXEC g_fn_AmxExec;
|
||||
PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||
PFN_FORMAT g_fn_Format;
|
||||
PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
// *** Exports ***
|
||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||
@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
// Memory
|
||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
|
||||
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
|
||||
#endif
|
||||
|
||||
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
|
||||
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
|
||||
@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
MF_IsPlayerHLTV(0);
|
||||
MF_GetPlayerArmor(0);
|
||||
MF_GetPlayerHealth(0);
|
||||
MF_AmxExec(0, 0, 0, 0);
|
||||
MF_AmxExec(0, 0, 0);
|
||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||
MF_AmxFindPublic(0, 0, 0);
|
||||
MF_AmxAllot(0, 0, 0, 0);
|
||||
@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
|
||||
/************* MEMORY *************/
|
||||
// undef all defined macros
|
||||
#undef new
|
||||
@ -2904,6 +2909,30 @@ void operator delete[](void *reportedAddress)
|
||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined NO_ALLOC_OVERRIDES && !defined MEMORY_TEST && !defined WIN32
|
||||
void * ::operator new(size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void * ::operator new[](size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void ::operator delete(void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void ::operator delete[](void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
/************* stuff from dlls/util.cpp *************/
|
||||
// must come here because cbase.h declares it's own operator new
|
||||
|
||||
|
@ -46,8 +46,6 @@ struct amxx_module_info_s
|
||||
const char *logtag; // added in version 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
// return values from functions called by amxx
|
||||
#define AMXX_OK 0 /* no error */
|
||||
#define AMXX_IFVERS 1 /* interface version */
|
||||
@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/);
|
||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
|
||||
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const void* /*addr*/ );
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
|
||||
#endif
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/);
|
||||
typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/);
|
||||
|
||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||
@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
extern PFN_AMX_EXEC g_fn_AmxExec;
|
||||
extern PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
extern PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
|
||||
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
|
||||
@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format;
|
||||
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
|
||||
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
extern PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
extern PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
#ifdef MAY_NEVER_BE_DEFINED
|
||||
// Function prototypes for intellisense and similar systems
|
||||
@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { }
|
||||
const char * MF_Format (const char *fmt, ...) { }
|
||||
void MF_RegisterFunction (void *pfn, const char *description) { }
|
||||
void * MF_RequestFunction (const char *description) { }
|
||||
int MF_AmxPush (AMX *amx, cell *params) { }
|
||||
int MF_AmxExec (AMX *amx, cell *retval, int idx) { }
|
||||
#endif // MAY_NEVER_BE_DEFINED
|
||||
|
||||
#define MF_AddNatives g_fn_AddNatives
|
||||
@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||
#define MF_Format g_fn_Format
|
||||
#define MF_RegisterFunction g_fn_RegisterFunction
|
||||
#define MF_RequestFunction g_fn_RequestFunction;
|
||||
#define MF_AmxPush g_fn_AmxPush
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
/*** Memory ***/
|
||||
void *operator new(size_t reportedSize);
|
||||
void *operator new[](size_t reportedSize);
|
||||
@ -2231,4 +2236,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
#endif // #ifndef __AMXXMODULE_H__
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "MSSQL"
|
||||
#define MODULE_VERSION "1.50"
|
||||
#define MODULE_VERSION "1.55"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org/"
|
||||
#define MODULE_LOGTAG "MSSQL"
|
||||
|
@ -6,7 +6,7 @@ MM_ROOT = ../../../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc
|
||||
NAME = ns_amxx
|
||||
@ -26,12 +26,11 @@ else
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_amd64.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
LINK += -lstdc++
|
||||
else
|
||||
BINARY = $(NAME)_i386.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
|
@ -45,8 +45,6 @@
|
||||
enginefuncs_t g_engfuncs;
|
||||
globalvars_t *gpGlobals;
|
||||
|
||||
|
||||
|
||||
DLL_FUNCTIONS *g_pFunctionTable;
|
||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
enginefuncs_t *g_pengfuncsTable;
|
||||
@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||
|
||||
|
||||
// GetEntityAPI2 functions
|
||||
static DLL_FUNCTIONS g_EntityAPI_Table =
|
||||
{
|
||||
@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
|
||||
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
#ifdef MEMORY_TEST
|
||||
PFN_ALLOCATOR g_fn_Allocator;
|
||||
PFN_REALLOCATOR g_fn_Reallocator;
|
||||
PFN_DEALLOCATOR g_fn_Deallocator;
|
||||
#endif
|
||||
PFN_AMX_EXEC g_fn_AmxExec;
|
||||
PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||
PFN_FORMAT g_fn_Format;
|
||||
PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
// *** Exports ***
|
||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||
@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
// Memory
|
||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
|
||||
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
|
||||
#endif
|
||||
|
||||
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
|
||||
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
|
||||
@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
MF_IsPlayerHLTV(0);
|
||||
MF_GetPlayerArmor(0);
|
||||
MF_GetPlayerHealth(0);
|
||||
MF_AmxExec(0, 0, 0, 0);
|
||||
MF_AmxExec(0, 0, 0);
|
||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||
MF_AmxFindPublic(0, 0, 0);
|
||||
MF_AmxAllot(0, 0, 0, 0);
|
||||
@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
|
||||
/************* MEMORY *************/
|
||||
// undef all defined macros
|
||||
#undef new
|
||||
@ -2904,6 +2909,30 @@ void operator delete[](void *reportedAddress)
|
||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined NO_ALLOC_OVERRIDES && !defined MEMORY_TEST && !defined WIN32
|
||||
void * ::operator new(size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void * ::operator new[](size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void ::operator delete(void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void ::operator delete[](void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
/************* stuff from dlls/util.cpp *************/
|
||||
// must come here because cbase.h declares it's own operator new
|
||||
|
||||
|
@ -46,8 +46,6 @@ struct amxx_module_info_s
|
||||
const char *logtag; // added in version 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
// return values from functions called by amxx
|
||||
#define AMXX_OK 0 /* no error */
|
||||
#define AMXX_IFVERS 1 /* interface version */
|
||||
@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/);
|
||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
|
||||
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const void* /*addr*/ );
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
|
||||
#endif
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/);
|
||||
typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/);
|
||||
|
||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||
@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
extern PFN_AMX_EXEC g_fn_AmxExec;
|
||||
extern PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
extern PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
|
||||
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
|
||||
@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format;
|
||||
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
|
||||
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
extern PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
extern PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
#ifdef MAY_NEVER_BE_DEFINED
|
||||
// Function prototypes for intellisense and similar systems
|
||||
@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { }
|
||||
const char * MF_Format (const char *fmt, ...) { }
|
||||
void MF_RegisterFunction (void *pfn, const char *description) { }
|
||||
void * MF_RequestFunction (const char *description) { }
|
||||
int MF_AmxPush (AMX *amx, cell *params) { }
|
||||
int MF_AmxExec (AMX *amx, cell *retval, int idx) { }
|
||||
#endif // MAY_NEVER_BE_DEFINED
|
||||
|
||||
#define MF_AddNatives g_fn_AddNatives
|
||||
@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||
#define MF_Format g_fn_Format
|
||||
#define MF_RegisterFunction g_fn_RegisterFunction
|
||||
#define MF_RequestFunction g_fn_RequestFunction;
|
||||
#define MF_AmxPush g_fn_AmxPush
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
/*** Memory ***/
|
||||
void *operator new(size_t reportedSize);
|
||||
void *operator new[](size_t reportedSize);
|
||||
@ -2231,4 +2236,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
#endif // #ifndef __AMXXMODULE_H__
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "NS"
|
||||
#define MODULE_VERSION "1.50"
|
||||
#define MODULE_VERSION "1.55"
|
||||
#define MODULE_AUTHOR "Steve Dudenhoeffer"
|
||||
#define MODULE_URL "http://www.amxmodx.org/"
|
||||
#define MODULE_LOGTAG "NS"
|
||||
|
@ -6,7 +6,7 @@ MM_ROOT = ../../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc
|
||||
NAME = nvault_amxx
|
||||
@ -26,16 +26,17 @@ else
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fexceptions -DHAVE_STDINT_H
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fexceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_amd64.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
LINK += -lstdc++
|
||||
LINK += /lib/libgcc_eh.a /lib/libstdc++.a
|
||||
else
|
||||
BINARY = $(NAME)_i386.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
OPT_FLAGS += -march=i686
|
||||
LINK += /lib/libgcc_eh.a /lib/libstdc++.a
|
||||
endif
|
||||
|
||||
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
|
||||
|
@ -45,8 +45,6 @@
|
||||
enginefuncs_t g_engfuncs;
|
||||
globalvars_t *gpGlobals;
|
||||
|
||||
|
||||
|
||||
DLL_FUNCTIONS *g_pFunctionTable;
|
||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
enginefuncs_t *g_pengfuncsTable;
|
||||
@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||
|
||||
|
||||
// GetEntityAPI2 functions
|
||||
static DLL_FUNCTIONS g_EntityAPI_Table =
|
||||
{
|
||||
@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
|
||||
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
#ifdef MEMORY_TEST
|
||||
PFN_ALLOCATOR g_fn_Allocator;
|
||||
PFN_REALLOCATOR g_fn_Reallocator;
|
||||
PFN_DEALLOCATOR g_fn_Deallocator;
|
||||
#endif
|
||||
PFN_AMX_EXEC g_fn_AmxExec;
|
||||
PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
@ -2613,10 +2612,12 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
// Memory
|
||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
|
||||
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
|
||||
#endif
|
||||
|
||||
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
|
||||
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
|
||||
@ -2735,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
|
||||
/************* MEMORY *************/
|
||||
// undef all defined macros
|
||||
#undef new
|
||||
@ -2906,6 +2909,30 @@ void operator delete[](void *reportedAddress)
|
||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined NO_ALLOC_OVERRIDES && !defined MEMORY_TEST && !defined WIN32
|
||||
void * ::operator new(size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void * ::operator new[](size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void ::operator delete(void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void ::operator delete[](void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
/************* stuff from dlls/util.cpp *************/
|
||||
// must come here because cbase.h declares it's own operator new
|
||||
|
||||
|
@ -46,8 +46,6 @@ struct amxx_module_info_s
|
||||
const char *logtag; // added in version 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
// return values from functions called by amxx
|
||||
#define AMXX_OK 0 /* no error */
|
||||
#define AMXX_IFVERS 1 /* interface version */
|
||||
@ -1981,12 +1979,14 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/);
|
||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
|
||||
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const void* /*addr*/ );
|
||||
#endif
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
@ -2048,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
extern PFN_AMX_EXEC g_fn_AmxExec;
|
||||
extern PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
extern PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
|
||||
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
|
||||
@ -2193,6 +2192,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||
#define MF_RequestFunction g_fn_RequestFunction;
|
||||
#define MF_AmxPush g_fn_AmxPush
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
/*** Memory ***/
|
||||
void *operator new(size_t reportedSize);
|
||||
void *operator new[](size_t reportedSize);
|
||||
@ -2236,4 +2236,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
#endif // #ifndef __AMXXMODULE_H__
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "nVault"
|
||||
#define MODULE_VERSION "1.50"
|
||||
#define MODULE_VERSION "1.55"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org/"
|
||||
#define MODULE_LOGTAG "nVault"
|
||||
|
@ -6,7 +6,7 @@ MM_ROOT = ../../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc
|
||||
NAME = regex_amxx
|
||||
@ -26,12 +26,11 @@ else
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_amd64.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
LINK += -lstdc++
|
||||
INCLUDE += -Llib_linux64
|
||||
else
|
||||
BINARY = $(NAME)_i386.so
|
||||
|
@ -45,8 +45,6 @@
|
||||
enginefuncs_t g_engfuncs;
|
||||
globalvars_t *gpGlobals;
|
||||
|
||||
|
||||
|
||||
DLL_FUNCTIONS *g_pFunctionTable;
|
||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||
enginefuncs_t *g_pengfuncsTable;
|
||||
@ -54,7 +52,6 @@ enginefuncs_t *g_pengfuncsTable_Post;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||
|
||||
|
||||
// GetEntityAPI2 functions
|
||||
static DLL_FUNCTIONS g_EntityAPI_Table =
|
||||
{
|
||||
@ -2481,9 +2478,11 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
|
||||
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
#ifdef MEMORY_TEST
|
||||
PFN_ALLOCATOR g_fn_Allocator;
|
||||
PFN_REALLOCATOR g_fn_Reallocator;
|
||||
PFN_DEALLOCATOR g_fn_Deallocator;
|
||||
#endif
|
||||
PFN_AMX_EXEC g_fn_AmxExec;
|
||||
PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
@ -2502,6 +2501,7 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||
PFN_FORMAT g_fn_Format;
|
||||
PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
// *** Exports ***
|
||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||
@ -2610,11 +2610,14 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
// Memory
|
||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
|
||||
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
|
||||
#endif
|
||||
|
||||
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
|
||||
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
|
||||
@ -2717,7 +2720,7 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
MF_IsPlayerHLTV(0);
|
||||
MF_GetPlayerArmor(0);
|
||||
MF_GetPlayerHealth(0);
|
||||
MF_AmxExec(0, 0, 0, 0);
|
||||
MF_AmxExec(0, 0, 0);
|
||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||
MF_AmxFindPublic(0, 0, 0);
|
||||
MF_AmxAllot(0, 0, 0, 0);
|
||||
@ -2733,6 +2736,8 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
|
||||
/************* MEMORY *************/
|
||||
// undef all defined macros
|
||||
#undef new
|
||||
@ -2904,6 +2909,30 @@ void operator delete[](void *reportedAddress)
|
||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined NO_ALLOC_OVERRIDES && !defined MEMORY_TEST && !defined WIN32
|
||||
void * ::operator new(size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void * ::operator new[](size_t size) {
|
||||
return(calloc(1, size));
|
||||
}
|
||||
|
||||
void ::operator delete(void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void ::operator delete[](void * ptr) {
|
||||
if(ptr)
|
||||
free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
/************* stuff from dlls/util.cpp *************/
|
||||
// must come here because cbase.h declares it's own operator new
|
||||
|
||||
|
@ -46,8 +46,6 @@ struct amxx_module_info_s
|
||||
const char *logtag; // added in version 2
|
||||
};
|
||||
|
||||
|
||||
|
||||
// return values from functions called by amxx
|
||||
#define AMXX_OK 0 /* no error */
|
||||
#define AMXX_IFVERS 1 /* interface version */
|
||||
@ -1981,13 +1979,15 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||
#endif
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/);
|
||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
|
||||
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||
const unsigned int /*type*/, const void* /*addr*/ );
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
|
||||
#endif
|
||||
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/);
|
||||
typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
|
||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||
@ -2002,6 +2002,7 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/);
|
||||
typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/);
|
||||
|
||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||
@ -2047,7 +2048,6 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
|
||||
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
|
||||
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
|
||||
extern PFN_AMX_EXEC g_fn_AmxExec;
|
||||
extern PFN_AMX_EXECV g_fn_AmxExecv;
|
||||
extern PFN_AMX_ALLOT g_fn_AmxAllot;
|
||||
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
|
||||
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
|
||||
@ -2065,6 +2065,7 @@ extern PFN_FORMAT g_fn_Format;
|
||||
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
|
||||
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
||||
extern PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||
extern PFN_AMX_PUSH g_fn_AmxPush;
|
||||
|
||||
#ifdef MAY_NEVER_BE_DEFINED
|
||||
// Function prototypes for intellisense and similar systems
|
||||
@ -2123,6 +2124,8 @@ edict_t* MF_GetPlayerEdict (int id) { }
|
||||
const char * MF_Format (const char *fmt, ...) { }
|
||||
void MF_RegisterFunction (void *pfn, const char *description) { }
|
||||
void * MF_RequestFunction (const char *description) { }
|
||||
int MF_AmxPush (AMX *amx, cell *params) { }
|
||||
int MF_AmxExec (AMX *amx, cell *retval, int idx) { }
|
||||
#endif // MAY_NEVER_BE_DEFINED
|
||||
|
||||
#define MF_AddNatives g_fn_AddNatives
|
||||
@ -2187,7 +2190,9 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||
#define MF_Format g_fn_Format
|
||||
#define MF_RegisterFunction g_fn_RegisterFunction
|
||||
#define MF_RequestFunction g_fn_RequestFunction;
|
||||
#define MF_AmxPush g_fn_AmxPush
|
||||
|
||||
#ifdef MEMORY_TEST
|
||||
/*** Memory ***/
|
||||
void *operator new(size_t reportedSize);
|
||||
void *operator new[](size_t reportedSize);
|
||||
@ -2231,4 +2236,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||
|
||||
#endif //MEMORY_TEST
|
||||
|
||||
#endif // #ifndef __AMXXMODULE_H__
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "RegEx"
|
||||
#define MODULE_VERSION "1.50"
|
||||
#define MODULE_VERSION "1.55"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org/"
|
||||
#define MODULE_LOGTAG "REGEX"
|
||||
|
@ -6,7 +6,7 @@ MM_ROOT = ../../metamod/metamod
|
||||
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
|
||||
OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
|
||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe
|
||||
DEBUG_FLAGS = -g -ggdb3
|
||||
CPP = gcc
|
||||
NAME = sockets_amxx
|
||||
@ -26,12 +26,11 @@ else
|
||||
CFLAGS = $(OPT_FLAGS)
|
||||
endif
|
||||
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
|
||||
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
|
||||
|
||||
ifeq "$(AMD64)" "true"
|
||||
BINARY = $(NAME)_amd64.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
|
||||
LINK += -lstdc++
|
||||
else
|
||||
BINARY = $(NAME)_i386.so
|
||||
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user