1 Commits

Author SHA1 Message Date
7b527c9c25 Tagged 1.50 2006-07-20 04:02:53 +00:00
207 changed files with 1520 additions and 4450 deletions

View File

@ -273,5 +273,4 @@ void CmdMngr::clearBufforedInfo() {
buf_cmdaccess = 0; buf_cmdaccess = 0;
} }
int CmdMngr::Command::uniqueid = 0; int CmdMngr::Command::uniqueid = 0;

View File

@ -244,12 +244,18 @@ void CPluginMngr::CPlugin::Finalize()
} }
} }
void CPluginMngr::CPlugin::pauseFunction( int id ) void CPluginMngr::CPlugin::pauseFunction( int id ) {
{ if (isValid()){
paused_fun |= (1<<id);
g_commands.clearBufforedInfo();
}
} }
void CPluginMngr::CPlugin::unpauseFunction( int id ) void CPluginMngr::CPlugin::unpauseFunction( int id ) {
{ if (isValid()) {
paused_fun &= ~(1<<id);
g_commands.clearBufforedInfo();
}
} }
void CPluginMngr::CPlugin::setStatus( int a ) { void CPluginMngr::CPlugin::setStatus( int a ) {

View File

@ -89,7 +89,7 @@ public:
inline void setAuthor( const char* n ) { author.assign(n); } inline void setAuthor( const char* n ) { author.assign(n); }
inline void setVersion( const char* n ) { version.assign(n); } inline void setVersion( const char* n ) { version.assign(n); }
inline void setError( const char* n ) { errorMsg.assign(n); } inline void setError( const char* n ) { errorMsg.assign(n); }
inline bool isValid() const { return ((status == ps_running || status == ps_paused)); } inline bool isValid() const { return ((status == ps_running) && (status != ps_locked)); }
inline bool isPaused() const { return ( (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 isFunctionPaused( int id ) const { return (paused_fun & (1<<id)) ? true : false; }
inline bool isExecutable(int id) const { return (isValid() && !isPaused()); } inline bool isExecutable(int id) const { return (isValid() && !isPaused()); }

View File

@ -53,14 +53,8 @@ void CTaskMngr::CTask::set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags,
m_iId = iId; m_iId = iId;
m_fBase = fBase; m_fBase = fBase;
if (iFlags & 2) m_iRepeat = (iFlags & 1) ? iRepeat : 0;
{ m_bLoop = (iFlags & 2) ? true : false;
m_bLoop = true;
m_iRepeat = -1;
} else if (iFlags & 1) {
m_bLoop = true;
m_iRepeat = iRepeat;
}
m_bAfterStart = (iFlags & 4) ? true : false; m_bAfterStart = (iFlags & 4) ? true : false;
m_bBeforeEnd = (iFlags & 8) ? true : false; m_bBeforeEnd = (iFlags & 8) ? true : false;
@ -124,7 +118,6 @@ void CTaskMngr::CTask::resetNextExecTime(float fCurrentTime)
void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, float fTimeLeft) void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, float fTimeLeft)
{ {
bool execute=false; bool execute=false;
bool done=false;
if (m_bAfterStart) if (m_bAfterStart)
{ {
if (fCurrentTime - fTimeLeft + 1.0f >= m_fBase) if (fCurrentTime - fTimeLeft + 1.0f >= m_fBase)
@ -134,42 +127,32 @@ void CTaskMngr::CTask::executeIfRequired(float fCurrentTime, float fTimeLimit, f
{ {
if (fTimeLimit != 0.0f && (fTimeLeft + fTimeLimit * 60.0f) - fCurrentTime - 1.0f <= m_fBase) if (fTimeLimit != 0.0f && (fTimeLeft + fTimeLimit * 60.0f) - fCurrentTime - 1.0f <= m_fBase)
execute = true; execute = true;
} else if (m_fNextExecTime <= fCurrentTime) {
execute = true;
} }
else if (m_fNextExecTime <= fCurrentTime)
execute = true;
if (execute) if (execute)
{ {
//only bother calling if we have something to call if (m_iParamLen) // call with parameters
if ( !(m_bLoop && !m_iRepeat) )
{ {
if (m_iParamLen) // call with parameters cell arr = prepareCellArray(m_pParams, m_iParamLen);
{ executeForwards(m_iFunc, arr, m_iId);
cell arr = prepareCellArray(m_pParams, m_iParamLen); } else {
executeForwards(m_iFunc, arr, m_iId); executeForwards(m_iFunc, m_iId);
} else {
executeForwards(m_iFunc, m_iId);
}
} }
if (isFree()) if (isFree())
return; return;
// set new exec time OR remove the task if needed // set new exec time OR remove the task if needed
if (m_bLoop) if (m_bLoop || (m_iRepeat-- > 0))
{ {
if (m_iRepeat != -1 && --m_iRepeat <= 0)
done = true;
} else {
done = true;
}
if (done)
{
clear();
} else {
m_fNextExecTime += m_fBase; m_fNextExecTime += m_fBase;
} }
else
{
clear(); // hamster
}
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,7 @@ MM_ROOT = ../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = gcc
NAME = amxmodx_mm 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 \ 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 \ 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 \ 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 LINK = -lz
@ -31,16 +31,16 @@ else
endif endif
ifeq "$(MMGR)" "true" ifeq "$(MMGR)" "true"
OBJECTS += mmgr/mmgr.cpp OBJECTS += MMGR/MMGR.CPP
CFLAGS += -DMEMORY_TEST
endif endif
CFLAGS += -DLINUX -DNDEBUG -fPIC -Wno-deprecated -DHAVE_STDINT_H -static-libgcc -fno-rtti -fno-exceptions CFLAGS += -DLINUX -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
ifeq "$(AMD64)" "true" ifeq "$(AMD64)" "true"
BINARY = $(NAME)_amd64.so BINARY = $(NAME)_amd64.so
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
OBJECTS += JIT/natives-amd64.o OBJECTS += JIT/natives-amd64.o
LINK += -lstdc++
else else
BINARY = $(NAME)_i386.so BINARY = $(NAME)_i386.so
OBJECTS += JIT/amxexecn.o JIT/amxjitsn.o JIT/natives-x86.o OBJECTS += JIT/amxexecn.o JIT/amxjitsn.o JIT/natives-x86.o

View File

@ -10,7 +10,7 @@
* including commercial applications, and to alter it and redistribute it * including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions: * freely, subject to the following restrictions:
* *
* 1. The origin of this software must not be misreprfesented; you must not * 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software in * claim that you wrote the original software. If you use this software in
* a product, an acknowledgment in the product documentation would be * a product, an acknowledgment in the product documentation would be
* appreciated but is not required. * appreciated but is not required.
@ -1081,9 +1081,7 @@ int AMXAPI amx_InitJIT(AMX *amx, void *reloc_table, void *native_code)
/* JIT rulz! (TM) */ /* JIT rulz! (TM) */
/* MP: added check for correct compilation */ /* MP: added check for correct compilation */
//Fixed bug (thanks T(+)rget) if ((res = asm_runJIT(amx->base, reloc_table, native_code)) != 0) {
if ((res = asm_runJIT(amx->base, reloc_table, native_code)) == 0)
{
/* update the required memory size (the previous value was a /* update the required memory size (the previous value was a
* conservative estimate, now we know the exact size) * conservative estimate, now we know the exact size)
*/ */

View File

@ -21,26 +21,17 @@
; step. ; step.
; NOTE 3: ; 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 ; 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 ; 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 ; 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. ; 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 ; NX ("No eXecute") and XD (eXecution Denied) bits
; (by Thiadmer Riemersma) ; (by Thiadmer Riemersma)
; ;
@ -74,8 +65,7 @@
; segment: the JIT-compiler patches P-code parameters into its own code segment ; 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. ; during compilation. This is handled in the support code for amx_InitJIT.
; ;
;
; NOTE 6:
; CALLING CONVENTIONS ; CALLING CONVENTIONS
; (by Thiadmer Riemersma) ; (by Thiadmer Riemersma)
; ;
@ -87,16 +77,9 @@
; a reserved word on the assembler, I had to choose a different name for the ; a reserved word on the assembler, I had to choose a different name for the
; macro, hence STDECL.) ; macro, hence STDECL.)
; Revision History ; Revision History
; ---------------- ; ----------------
; 16 august 2005 by David "BAILOPAN" Anderson (DA) ; 26 july 2005 by David "BAILOPAN" Anderson
; 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. ; Fixed a bug where zero casetbl entries would crash the JIT.
; 17 february 2005 by Thiadmer Riemersms ; 17 february 2005 by Thiadmer Riemersms
; Addition of the BREAK opcode, removal of the older debugging opcode ; Addition of the BREAK opcode, removal of the older debugging opcode
@ -182,6 +165,15 @@
; ;
%define FORCERELOCATABLE %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. ; 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 ; You should set this to 0, only when you are sure that there are no range
@ -194,49 +186,32 @@
%define JIT 1 %define JIT 1
%include "amxdefn.asm" %include "amxdefn.asm"
;Registers used for JIT during execution: ; GWMV:
; eax - pri ; Nasm can't do the next as equivalence statements, since the value of
; ebx - reloc frame ; esi is not determined at compile time
; ecx - info params %define stk [esi+32] ; define some aliases to registers that will
; edx - alt %define alt [esi+28] ; be stored on the stack when the code is
; esi - AMX stack %define pri [esi+24] ; actually beeing executed
; edi - DAT %define code [esi+20]
; ebp - scratch %define amx [esi+16]
%define retval [esi+12]
;DA: %define stp [esi+8]
; These are still stored in the stack, but the stack pointer %define hea [esi+4]
; holding them is now kept in ecx. %define frm [esi] ; FRM is NOT stored in ebp, FRM+DAT is being held
%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. ; in ebx instead.
; ;
; #define PUSH(v) ( stk-=sizeof(cell), *(cell *)(data+(int)stk)=v ) ; #define PUSH(v) ( stk-=sizeof(cell), *(cell *)(data+(int)stk)=v )
; ;
%macro _PUSH 1 %macro _PUSH 1
lea esi,[esi-4] push dword %1
mov dword [esi], %1
%endmacro
%macro _PUSHMEM 1
lea esi,[esi-4]
mov ebp, dword %1
mov dword [esi], ebp
%endmacro %endmacro
; ;
; #define POP(v) ( v=*(cell *)(data+(int)stk), stk+=sizeof(cell) ) ; #define POP(v) ( v=*(cell *)(data+(int)stk), stk+=sizeof(cell) )
; ;
%macro _POP 1 %macro _POP 1
mov %1, dword [esi] pop dword %1
lea esi,[esi+4]
%endmacro %endmacro
@ -815,7 +790,7 @@ OP_LCTRL:
jne lctrl_5 jne lctrl_5
GO_ON j_lctrl_4, lctrl_5, 8 GO_ON j_lctrl_4, lctrl_5, 8
j_lctrl_4: j_lctrl_4:
mov eax,esi ; 4=STK mov eax,esp ; 4=STK
sub eax,edi sub eax,edi
CHECKCODESIZE j_lctrl_4 CHECKCODESIZE j_lctrl_4
lctrl_5: lctrl_5:
@ -849,7 +824,7 @@ OP_SCTRL:
j_sctrl_4: j_sctrl_4:
;mov esp,eax ; 4=STK ;mov esp,eax ; 4=STK
;add esp,edi ; relocate stack ;add esp,edi ; relocate stack
lea esi,[eax+edi] lea esp,[eax+edi]
CHECKCODESIZE j_sctrl_4 CHECKCODESIZE j_sctrl_4
sctrl_5: sctrl_5:
cmp eax,5 cmp eax,5
@ -910,16 +885,14 @@ OP_PUSH_ALT:
OP_PUSH_R_PRI: OP_PUSH_R_PRI:
;nop; ;nop;
putval j_push_r_pri+2 putval j_push_r_pri+1
GO_ON j_push_r_pri, OP_PUSH_C, 8 GO_ON j_push_r_pri, OP_PUSH_C, 8
j_push_r_pri: j_push_r_pri:
push ecx
mov ecx,12345678h mov ecx,12345678h
j_push_loop: j_push_loop:
_PUSH eax _PUSH eax
loop j_push_loop loop j_push_loop
pop ecx
;dec ecx ;dec ecx
;jnz j_push_loop ;jnz j_push_loop
CHECKCODESIZE j_push_r_pri CHECKCODESIZE j_push_r_pri
@ -927,33 +900,30 @@ OP_PUSH_R_PRI:
;good ;good
OP_PUSH_C: OP_PUSH_C:
;nop; ;nop;
putval j_push_c_end-4 putval j_push_c+1
GO_ON j_push_c, OP_PUSH, 8 GO_ON j_push_c, OP_PUSH, 8
j_push_c: j_push_c:
_PUSH 12345678h _PUSH 12345678h
j_push_c_end:
CHECKCODESIZE j_push_c CHECKCODESIZE j_push_c
OP_PUSH: OP_PUSH:
;nop; ;nop;
putval j_push_end-6 putval j_push+2
GO_ON j_push, OP_PUSH_S, 8 GO_ON j_push, OP_PUSH_S, 8
j_push: j_push:
_PUSHMEM [edi+12345678h] _PUSH [edi+12345678h]
j_push_end:
CHECKCODESIZE j_push CHECKCODESIZE j_push
;good ;good
OP_PUSH_S: OP_PUSH_S:
;nop; ;nop;
putval j_push_s_end-6 putval j_push_s+2
GO_ON j_push_s, OP_POP_PRI, 8 GO_ON j_push_s, OP_POP_PRI, 8
j_push_s: j_push_s:
_PUSHMEM [ebx+12345678h] _PUSH [ebx+12345678h]
j_push_s_end:
CHECKCODESIZE j_push_s CHECKCODESIZE j_push_s
OP_POP_PRI: OP_POP_PRI:
@ -980,8 +950,8 @@ OP_STACK:
GO_ON j_stack, OP_HEAP, 8 GO_ON j_stack, OP_HEAP, 8
j_stack: j_stack:
mov edx,esi mov edx,esp
add esi,12345678h add esp,12345678h
sub edx,edi sub edx,edi
%ifdef DORUNTIMECHECKS %ifdef DORUNTIMECHECKS
call [chk_marginstack] call [chk_marginstack]
@ -1009,9 +979,9 @@ OP_PROC:
GO_ON j_proc, OP_RET GO_ON j_proc, OP_RET
j_proc: ;[STK] = FRM, STK = STK - cell size, FRM = STK j_proc: ;[STK] = FRM, STK = STK - cell size, FRM = STK
_PUSHMEM frm ; push old frame (for RET/RETN) _PUSH frm ; push old frame (for RET/RETN)
mov frm,esi ; get new frame mov frm,esp ; get new frame
mov ebx,esi ; already relocated mov ebx,esp ; already relocated
sub frm,edi ; relocate frame sub frm,edi ; relocate frame
CHECKCODESIZE j_proc CHECKCODESIZE j_proc
@ -1021,7 +991,6 @@ OP_RET:
j_ret: j_ret:
_POP ebx ; pop frame _POP ebx ; pop frame
lea esi,[esi+4]
mov frm,ebx mov frm,ebx
add ebx,edi add ebx,edi
ret ret
@ -1040,13 +1009,11 @@ OP_RETN:
;good ;good
OP_CALL: OP_CALL:
;nop; ;nop;
RELOC j_call_e8-j_call+1 RELOC 1
GO_ON j_call, OP_CALL_I, 8 GO_ON j_call, OP_CALL_I, 8
j_call: j_call:
;call 12345678h ; tasm chokes on this out of a sudden ;call 12345678h ; tasm chokes on this out of a sudden
_PUSH 0
j_call_e8
db 0e8h, 0, 0, 0, 0 db 0e8h, 0, 0, 0, 0
CHECKCODESIZE j_call CHECKCODESIZE j_call
@ -1055,7 +1022,6 @@ OP_CALL_I:
GO_ON j_call_i, OP_JUMP GO_ON j_call_i, OP_JUMP
j_call_i: j_call_i:
_PUSH 0
call eax call eax
CHECKCODESIZE j_call_i CHECKCODESIZE j_call_i
@ -1206,30 +1172,24 @@ OP_SHL:
;nop; ;nop;
GO_ON j_shl, OP_SHR GO_ON j_shl, OP_SHR
j_shl: j_shl:
push ecx mov ecx,edx ; TODO: save ECX if used as special register
mov ecx,edx
shl eax,cl shl eax,cl
pop ecx
CHECKCODESIZE j_shl CHECKCODESIZE j_shl
OP_SHR: OP_SHR:
;nop; ;nop;
GO_ON j_shr, OP_SSHR GO_ON j_shr, OP_SSHR
j_shr: j_shr:
push ecx mov ecx,edx ; TODO: save ECX if used as special register
mov ecx,edx
shr eax,cl shr eax,cl
pop ecx
CHECKCODESIZE j_shr CHECKCODESIZE j_shr
OP_SSHR: OP_SSHR:
;nop; ;nop;
GO_ON j_sshr, OP_SHL_C_PRI GO_ON j_sshr, OP_SHL_C_PRI
j_sshr: j_sshr:
push ecx mov ecx,edx ; TODO: save ECX if used as special register
mov ecx,edx
sar eax,cl sar eax,cl
pop ecx
CHECKCODESIZE j_sshr CHECKCODESIZE j_sshr
OP_SHL_C_PRI: OP_SHL_C_PRI:
@ -1648,35 +1608,29 @@ OP_DEC_I:
OP_MOVS: OP_MOVS:
;nop; ;nop;
putval j_movs+2 putval j_movs+1
GO_ON j_movs, OP_CMPS, 8 GO_ON j_movs, OP_CMPS, 8
j_movs: j_movs:
push ecx mov ecx,12345678h ;TODO: save ECX if used as special register
mov ecx,12345678h
call [jit_movs] call [jit_movs]
pop ecx
CHECKCODESIZE j_movs CHECKCODESIZE j_movs
OP_CMPS: OP_CMPS:
;nop; ;nop;
putval j_cmps+2 putval j_cmps+1
GO_ON j_cmps, OP_FILL, 8 GO_ON j_cmps, OP_FILL, 8
j_cmps: j_cmps:
push ecx mov ecx,12345678h ;TODO: save ECX if used as special register
mov ecx,12345678h
call [jit_cmps] call [jit_cmps]
pop ecx
CHECKCODESIZE j_cmps CHECKCODESIZE j_cmps
OP_FILL: OP_FILL:
;nop; ;nop;
putval j_fill+2 putval j_fill+1
GO_ON j_fill, OP_HALT, 8 GO_ON j_fill, OP_HALT, 8
j_fill: j_fill:
push ecx
mov ecx,12345678h ;TODO: save ECX if used as special register mov ecx,12345678h ;TODO: save ECX if used as special register
call [jit_fill] call [jit_fill]
pop ecx
CHECKCODESIZE j_fill CHECKCODESIZE j_fill
;good ;good
@ -1925,7 +1879,7 @@ _amx_exec_jit:
push dword [eax+20]; store FRM push dword [eax+20]; store FRM
mov edx,[eax+4] ; get ALT mov edx,[eax+4] ; get ALT
mov ebp,[eax+8] ; get CIP mov ecx,[eax+8] ; get CIP
mov edi,[eax+12] ; get pointer to data segment mov edi,[eax+12] ; get pointer to data segment
mov esi,[eax+16] ; get STK !!changed, now ECX free as counter!! mov esi,[eax+16] ; get STK !!changed, now ECX free as counter!!
mov ebx,[eax+20] ; get FRM mov ebx,[eax+20] ; get FRM
@ -1933,14 +1887,13 @@ _amx_exec_jit:
add ebx,edi ; relocate frame add ebx,edi ; relocate frame
add esi,edi ; ESP will contain DAT+STK add esi,edi ; ESP will contain DAT+STK
xchg esp,esi ; switch to AMX stack
add [esp+8],edi ; make STP absolute address for run-time checks add stp,edi ; make STP absolute address for run-time checks
mov dword [esi], 0 ; zero this out, but we need to keep it so _POP ebp ; AMX pseudo-return address, ignored
; the stack frame is in tact
mov ecx,esp ; copy stack pointer
; Call compiled code via CALL NEAR <address> ; Call compiled code via CALL NEAR <address>
call ebp call ecx
return_to_caller: return_to_caller:
cmp dword retval,0 cmp dword retval,0
@ -1953,17 +1906,15 @@ return_to_caller:
jmp _return jmp _return
_return_popstack: _return_popstack:
mov esp,ecx ; get our old stack pointer add esp,4 ; Correct ESP, because we just come from a
; runtime error checking routine.
_return: _return:
; store machine state ; store machine state
push ecx mov ecx,esp ; get STK into ECX
push ecx
mov ebp,amx ; get amx into EBP mov ebp,amx ; get amx into EBP
mov ecx,esi ; get STK into ECX
sub ecx,edi ; correct STK sub ecx,edi ; correct STK
mov [ebp+_stk],ecx ; store values in AMX structure: STK, ... mov [ebp+_stk],ecx ; store values in AMX structure: STK, ...
pop ecx ; get orig value
mov ecx,hea ; ... HEA, ... mov ecx,hea ; ... HEA, ...
mov [ebp+_hea],ecx mov [ebp+_hea],ecx
mov ecx,ebx ; ... and FRM mov ecx,ebx ; ... and FRM
@ -1973,8 +1924,8 @@ _return:
mov [ebp+_alt],edx ; ... and ALT mov [ebp+_alt],edx ; ... and ALT
; return ; return
pop ecx
sub stp,edi ; make STP relative to DAT again 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 add esp,4*9 ; remove temporary data
@ -1995,8 +1946,12 @@ err_stacklow:
jmp _return_popstack jmp _return_popstack
_CHKMARGIN_STACK: ; some run-time check routines _CHKMARGIN_STACK: ; some run-time check routines
cmp esi,stp cmp esp,stp
lea ebp,[esp-STACKRESERVE]
jg err_stacklow jg err_stacklow
sub ebp,edi
cmp hea,ebp
jg err_stack
ret ret
err_heaplow: err_heaplow:
@ -2004,7 +1959,7 @@ err_heaplow:
jmp _return_popstack jmp _return_popstack
_CHKMARGIN_HEAP: _CHKMARGIN_HEAP:
cmp esi,stp cmp esp,stp
jg err_stacklow jg err_stacklow
cmp dword hea,0 cmp dword hea,0
jl err_heaplow jl err_heaplow
@ -2020,7 +1975,7 @@ _VERIFYADDRESS_eax: ; used in load.i, store.i & lidx
cmp eax,hea cmp eax,hea
jb veax1 jb veax1
lea ebp,[eax+edi] lea ebp,[eax+edi]
cmp ebp,esi cmp ebp,esp
jb err_memaccess jb err_memaccess
veax1: veax1:
ret ret
@ -2031,7 +1986,7 @@ _VERIFYADDRESS_edx: ; used in load.i, store.i & lidx
cmp edx,hea cmp edx,hea
jb vedx1 jb vedx1
lea ebp,[edx+edi] lea ebp,[edx+edi]
cmp ebp,esi cmp ebp,esp
jb err_memaccess jb err_memaccess
vedx1: vedx1:
ret ret
@ -2063,15 +2018,15 @@ JIT_OP_SDIV:
JIT_OP_RETN: JIT_OP_RETN:
_POP ebx ; pop frame _POP ebx ; pop frame
add esi,4 ; get rid of the extra parameter from call _POP ecx ; get return address
mov frm,ebx mov frm,ebx
_POP ebp _POP ebp
add ebx,edi add ebx,edi
add esi,ebp ; remove data from stack add esp,ebp ; remove data from stack
ret jmp ecx
JIT_OP_MOVS: ;length of block to copy is already in ECX JIT_OP_MOVS: ;length of block to copy is already in ECX
@ -2137,33 +2092,34 @@ err_divide:
jmp _return_popstack jmp _return_popstack
JIT_OP_SYSREQ: JIT_OP_SYSREQ:
push ecx mov ecx,esp ; get STK into ECX
push esi
mov ebp,amx ; get amx into EBP mov ebp,amx ; get amx into EBP
sub esi,edi ; correct STK sub ecx,edi ; correct STK
mov alt,edx ; save ALT mov alt,edx ; save ALT
mov [ebp+_stk],esi ; store values in AMX structure: STK, mov [ebp+_stk],ecx ; store values in AMX structure: STK,
mov esi,hea ; HEA, mov ecx,hea ; HEA,
mov ebx,frm ; and FRM mov ebx,frm ; and FRM
mov [ebp+_hea],esi mov [ebp+_hea],ecx
mov [ebp+_frm],ebx mov [ebp+_frm],ebx
lea ebx,pri ; 3rd param: addr. of retval lea ebx,pri ; 3rd param: addr. of retval
lea ecx,[esp+4] ; 4th param: parameter array
;Our original esi is still pushed! xchg esp,esi ; switch to caller stack
push ecx
push ebx push ebx
push eax ; 2nd param: function number push eax ; 2nd param: function number
push ebp ; 1st param: amx push ebp ; 1st param: amx
call [ebp+_callback] call [ebp+_callback]
_DROPARGS 12 ; remove args from stack _DROPARGS 16 ; remove args from stack
pop esi xchg esp,esi ; switch back to AMX stack
pop ecx
cmp eax,AMX_ERR_NONE cmp eax,AMX_ERR_NONE
jne _return_popstack jne _return_popstack; return error code, if any
.continue:
mov eax,pri ; get retval into eax (PRI) mov eax,pri ; get retval into eax (PRI)
mov edx,alt ; restore ALT mov edx,alt ; restore ALT
mov ebx,frm ; restore FRM mov ebx,frm ; restore FRM
@ -2172,25 +2128,25 @@ JIT_OP_SYSREQ:
JIT_OP_SYSREQ_D: ; (TR) JIT_OP_SYSREQ_D: ; (TR)
push ecx mov ecx,esp ; get STK into ECX
push esi
mov ebp,amx ; get amx into EBP mov ebp,amx ; get amx into EBP
sub esi,edi ; correct STK sub ecx,edi ; correct STK
mov alt,edx ; save ALT mov alt,edx ; save ALT
mov [ebp+_stk],esi ; store values in AMX structure: STK, mov [ebp+_stk],ecx ; store values in AMX structure: STK,
mov esi,hea ; HEA, mov ecx,hea ; HEA,
mov eax,frm ; and FRM mov eax,frm ; and FRM
mov [ebp+_hea],esi mov [ebp+_hea],ecx
mov [ebp+_frm],eax ; eax & ecx are invalid by now mov [ebp+_frm],eax ; eax & ecx are invalid by now
;esi is still pushed! lea edx,[esp+4] ; 2nd param: parameter array
xchg esp,esi ; switch to caller stack
push edx
push ebp ; 1st param: amx push ebp ; 1st param: amx
call ebx ; direct call call ebx ; direct call
_DROPARGS 8 ; remove args from stack _DROPARGS 8 ; remove args from stack
xchg esp,esi ; switch back to AMX stack
pop ecx
mov ebp,amx ; get amx into EBP mov ebp,amx ; get amx into EBP
cmp dword [ebp+_error],AMX_ERR_NONE cmp dword [ebp+_error],AMX_ERR_NONE
jne _return_popstack; return error code, if any jne _return_popstack; return error code, if any
@ -2204,27 +2160,25 @@ JIT_OP_SYSREQ_D: ; (TR)
JIT_OP_BREAK: JIT_OP_BREAK:
%ifdef DEBUGSUPPORT %ifdef DEBUGSUPPORT
push ecx mov ecx,esp ; get STK into ECX
push esi
mov ebp,amx ; get amx into EBP mov ebp,amx ; get amx into EBP
sub esi,edi ; correct STK sub ecx,edi ; correct STK
mov [ebp+_pri],eax ; store values in AMX structure: PRI, mov [ebp+_pri],eax ; store values in AMX structure: PRI,
mov [ebp+_alt],edx ; ALT, mov [ebp+_alt],edx ; ALT,
mov [ebp+_stk],esi ; STK, mov [ebp+_stk],ecx ; STK,
mov esi,hea ; HEA, mov ecx,hea ; HEA,
mov ebx,frm ; and FRM mov ebx,frm ; and FRM
mov [ebp+_hea],esi mov [ebp+_hea],ecx
mov [ebp+_frm],ebx ; EBX & ECX are invalid by now mov [ebp+_frm],ebx ; EBX & ECX are invalid by now
;??? storing CIP is not very useful, because the code changed (during JIT compile) ;??? 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 push ebp ; 1st param: amx
call [ebp+_debug] call [ebp+_debug]
_DROPARGS 4 ; remove args from stack _DROPARGS 4 ; remove args from stack
xchg esp,esi ; switch back to AMX stack
pop esi
pop ecx
cmp eax,AMX_ERR_NONE cmp eax,AMX_ERR_NONE
jne _return_popstack; return error code, if any jne _return_popstack; return error code, if any
@ -2240,7 +2194,6 @@ JIT_OP_BREAK:
JIT_OP_SWITCH: JIT_OP_SWITCH:
pop ebp ; pop return address = table address pop ebp ; pop return address = table address
push ecx
mov ecx,[ebp] ; ECX = number of records mov ecx,[ebp] ; ECX = number of records
lea ebp,[ebp+ecx*8+8] ; set pointer _after_ LAST case lea ebp,[ebp+ecx*8+8] ; set pointer _after_ LAST case
;if there are zero cases we should just skip this -- bail ;if there are zero cases we should just skip this -- bail
@ -2252,7 +2205,6 @@ JIT_OP_SWITCH:
sub ebp,8 ; position to preceding case sub ebp,8 ; position to preceding case
loop op_switch_loop ; check next case, or fall through loop op_switch_loop ; check next case, or fall through
op_switch_jump: op_switch_jump:
pop ecx
%ifndef FORCERELOCATABLE %ifndef FORCERELOCATABLE
jmp [ebp-4] ; jump to the case instructions jmp [ebp-4] ; jump to the case instructions
%else %else

View File

@ -128,7 +128,7 @@ static cell AMX_NATIVE_CALL engclient_print(AMX *amx, cell *params) /* 3 param
{ {
int index = params[1]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients){ if (index < 1 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); 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]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients) if (index < 1 || index > gpGlobals->maxClients)
{ {
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); 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 { else {
int index = params[1]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients){ if (index < 1 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
if (iFile) FREE_FILE(sToShow); if (iFile) FREE_FILE(sToShow);
return 0; 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)); message = UTIL_SplitHudMessage(format_amxstring(amx,params,2,len));
int index = params[1]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients){ if (index < 1 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); 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]; int index = params[1];
if (index < 1 || index >= MAX_WEAPONS ){ if (index < 1 || index >= MAX_WEAPONS ){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
return set_amxstring(amx,params[2],g_weaponsData[index].fullName.c_str(),params[3]); 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]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients){ if (index < 1 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
@ -515,10 +515,8 @@ static cell AMX_NATIVE_CALL get_user_weapons(AMX *amx, cell *params) /* 3 param
cell *cpIds = get_amxaddr(amx,params[2]); cell *cpIds = get_amxaddr(amx,params[2]);
*cpIds = 0; *cpIds = 0;
int weapons = pPlayer->pEdict->v.weapons & ~(1<<31); // don't count last element int weapons = pPlayer->pEdict->v.weapons & ~(1<<31); // don't count last element
for(int i = 1; i < MAX_WEAPONS; ++i) for(int i = 1; i < MAX_WEAPONS; ++i){
{ if (weapons & (1<<i)) {
if (weapons & (1<<i))
{
*(cpIds+(*cpNum)) = i; *(cpIds+(*cpNum)) = i;
(*cpNum)++; (*cpNum)++;
} }
@ -532,7 +530,7 @@ static cell AMX_NATIVE_CALL get_user_origin(AMX *amx, cell *params) /* 3 param *
{ {
int index = params[1]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients){ if (index < 1 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
@ -594,7 +592,7 @@ static cell AMX_NATIVE_CALL get_user_attacker(AMX *amx, cell *params) /* 2 param
{ {
int index = params[1]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients){ if (index < 1 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
@ -627,7 +625,7 @@ static cell AMX_NATIVE_CALL user_has_weapon(AMX *amx,cell *params)
{ {
int index = params[1]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients){ if (index < 1 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
@ -666,20 +664,13 @@ 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 */ static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params) /* 3 param */
{ {
int index = params[1]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients) if (index < 1 || index > gpGlobals->maxClients){
{ amx_RaiseError(amx,AMX_ERR_NATIVE);
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->ingame) if (pPlayer->ingame){
{ int wpn = pPlayer->current;
int wpn = pPlayer->current;
if ( !(pPlayer->pEdict->v.weapons & (1<<wpn)) )
{
pPlayer->current = 0;
return 0;
}
cell *cpTemp = get_amxaddr(amx,params[2]); cell *cpTemp = get_amxaddr(amx,params[2]);
*cpTemp = pPlayer->weapons[wpn].clip; *cpTemp = pPlayer->weapons[wpn].clip;
cpTemp = get_amxaddr(amx,params[3]); cpTemp = get_amxaddr(amx,params[3]);
@ -693,14 +684,14 @@ static cell AMX_NATIVE_CALL get_user_ammo(AMX *amx, cell *params) /* 4 param */
{ {
int index = params[1]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients){ if (index < 1 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (pPlayer->ingame){ if (pPlayer->ingame){
int wpn = params[2]; int wpn = params[2];
if (wpn < 1 || wpn >= MAX_WEAPONS ){ if (wpn < 1 || wpn >= MAX_WEAPONS ){
LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", wpn); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
cell *cpTemp = get_amxaddr(amx,params[3]); cell *cpTemp = get_amxaddr(amx,params[3]);
@ -774,7 +765,7 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
else { else {
int index = params[1]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients){ if (index < 1 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
@ -1170,7 +1161,7 @@ static cell AMX_NATIVE_CALL client_cmd(AMX *amx, cell *params) /* 2 param */
else { else {
int index = params[1]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients){ if (index < 1 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
@ -1655,7 +1646,7 @@ static cell AMX_NATIVE_CALL get_user_info(AMX *amx, cell *params) /* 4 param */
{ {
int index = params[1]; int index = params[1];
if (index<1||index>gpGlobals->maxClients){ if (index<1||index>gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
@ -1674,7 +1665,7 @@ static cell AMX_NATIVE_CALL set_user_info(AMX *amx, cell *params) /* 3 param */
{ {
int index = params[1]; int index = params[1];
if (index<1||index>gpGlobals->maxClients){ if (index<1||index>gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
@ -1865,7 +1856,7 @@ static cell AMX_NATIVE_CALL engclient_cmd(AMX *amx, cell *params) /* 4 param */
else { else {
int index = params[1]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients){ if (index < 1 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
@ -1923,8 +1914,7 @@ static cell AMX_NATIVE_CALL unpause(AMX *amx, cell *params) /* 3 param */
} }
else else
plugin = g_plugins.findPluginFast( amx); plugin = g_plugins.findPluginFast( amx);
if (plugin && plugin->isValid() && plugin->isPaused() ) if (plugin && plugin->isValid()) {
{
plugin->unpausePlugin(); plugin->unpausePlugin();
return 1; return 1;
} }
@ -1951,7 +1941,7 @@ static cell AMX_NATIVE_CALL get_user_flags(AMX *amx, cell *params) /* 2 param */
{ {
int index = params[1]; int index = params[1];
if (index<0||index>gpGlobals->maxClients){ if (index<0||index>gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
int id = params[2]; int id = params[2];
@ -1964,7 +1954,7 @@ static cell AMX_NATIVE_CALL set_user_flags(AMX *amx, cell *params) /* 3 param */
{ {
int index = params[1]; int index = params[1];
if (index < 0 || index > gpGlobals->maxClients){ if (index < 0 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
@ -1980,7 +1970,7 @@ static cell AMX_NATIVE_CALL remove_user_flags(AMX *amx, cell *params) /* 3 param
{ {
int index = params[1]; int index = params[1];
if (index < 0 || index > gpGlobals->maxClients){ if (index < 0 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
@ -2004,7 +1994,7 @@ static cell AMX_NATIVE_CALL get_user_menu(AMX *amx, cell *params) /* 3 param */
{ {
int index = params[1]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients){ if (index < 1 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
cell *cpMenu = get_amxaddr(amx,params[2]); cell *cpMenu = get_amxaddr(amx,params[2]);
@ -2105,7 +2095,7 @@ static cell AMX_NATIVE_CALL get_user_aiming(AMX *amx, cell *params) /* 4 param *
{ {
int index = params[1]; int index = params[1];
if (index < 1 || index > gpGlobals->maxClients){ if (index < 1 || index > gpGlobals->maxClients){
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index); amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0; return 0;
} }
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
@ -2775,7 +2765,7 @@ static cell AMX_NATIVE_CALL callfunc_push_str(AMX *amx, cell *params)
// copy it to the allocated memory // copy it to the allocated memory
// we assume it's unpacked // we assume it's unpacked
// :NOTE: 4th parameter use_wchar since Small Abstract Machine 2.5.0 // :NOTE: 4th parameter use_wchar since Small Abstract Machine 2.5.0
amx_SetStringOld(phys_addr, str, 0, 0); amx_SetString(phys_addr, str, 0, 0, 0);
// push the address and set the reference flag so that memory is released after function call. // 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; g_CallFunc_ParamInfo[g_CallFunc_CurParam].flags = CALLFUNC_FLAG_BYREF;
@ -2905,22 +2895,6 @@ static cell AMX_NATIVE_CALL find_plugin_byfile(AMX *amx, cell *params)
return -1; 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[] = { AMX_NATIVE_INFO amxmod_Natives[] = {
{ "client_cmd", client_cmd }, { "client_cmd", client_cmd },
{ "client_print", client_print }, { "client_print", client_print },
@ -3088,6 +3062,5 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
{ "plugin_flags", plugin_flags}, { "plugin_flags", plugin_flags},
{ "lang_phrase", lang_phrase}, { "lang_phrase", lang_phrase},
{ "mkdir", amx_mkdir}, { "mkdir", amx_mkdir},
{ "int3", int3},
{ NULL, NULL } { NULL, NULL }
}; };

View File

@ -69,7 +69,7 @@
#include "amxxlog.h" #include "amxxlog.h"
#define AMXXLOG_Log g_log.Log #define AMXXLOG_Log g_log.Log
#define AMX_VERSION "1.55" #define AMX_VERSION "1.50"
extern AMX_NATIVE_INFO core_Natives[]; extern AMX_NATIVE_INFO core_Natives[];
extern AMX_NATIVE_INFO time_Natives[]; extern AMX_NATIVE_INFO time_Natives[];

View File

@ -220,7 +220,7 @@ CAmxxReader::~CAmxxReader()
} }
if (m_Bh.plugins) if (m_Bh.plugins)
{ {
delete [] m_Bh.plugins; delete m_Bh.plugins;
m_Bh.plugins = NULL; m_Bh.plugins = NULL;
} }
} }

View File

@ -153,6 +153,17 @@ void Client_WeaponList(void* mValue)
break; break;
case 7: case 7:
int iId = *(int*)mValue; 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)) ) if ( (iId < 0 || iId >= MAX_WEAPONS ) || (wpnList & (1<<iId)) )
break; break;
wpnList |= (1<<iId); wpnList |= (1<<iId);
@ -312,5 +323,4 @@ void Client_ResetHUD(void* mValue)
{ {
} }
*/ */

View File

@ -30,9 +30,6 @@
*/ */
#include <time.h> #include <time.h>
#if defined WIN32
#include <direct.h>
#endif
#include "amxmodx.h" #include "amxmodx.h"
#include "fakemeta.h" #include "fakemeta.h"
#include "newmenus.h" #include "newmenus.h"
@ -96,7 +93,6 @@ bool g_initialized = false;
bool g_IsNewMM = false; bool g_IsNewMM = false;
bool g_NeedsP = false; bool g_NeedsP = false;
bool g_coloredmenus; bool g_coloredmenus;
bool g_activated = false;
#ifdef MEMORY_TEST #ifdef MEMORY_TEST
float g_next_memreport_time; float g_next_memreport_time;
@ -200,12 +196,9 @@ const char* get_localinfo( const char* name , const char* def )
// Load AMX modules for new native functions // Load AMX modules for new native functions
// Initialize AMX stuff and load it's plugins from plugins.ini list // Initialize AMX stuff and load it's plugins from plugins.ini list
// Call precache forward function from plugins // Call precache forward function from plugins
int C_Spawn( edict_t *pent ) int C_Spawn( edict_t *pent ) {
{
if (g_initialized) if (g_initialized)
RETURN_META_VALUE(MRES_IGNORED, 0); RETURN_META_VALUE(MRES_IGNORED, 0);
g_activated = false;
g_initialized = true; g_initialized = true;
g_forcedmodules = false; g_forcedmodules = false;
g_forcedsounds = false; g_forcedsounds = false;
@ -367,8 +360,8 @@ Much more later after precache. All is precached, server
will be flaged as ready to use so call will be flaged as ready to use so call
plugin_init forward function from plugins 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; int id;
for (int i = 0; g_user_msg[ i ].name; ++i ) for (int i = 0; g_user_msg[ i ].name; ++i )
{ {
@ -390,10 +383,9 @@ void C_ServerActivate( edict_t *pEdictList, int edictCount, int clientMax )
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void C_ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ) void C_ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ){
{
if (g_activated) // g_edict_point = (int)pEdictList;
RETURN_META(MRES_IGNORED);
for(int i = 1; i <= gpGlobals->maxClients; ++i) { for(int i = 1; i <= gpGlobals->maxClients; ++i) {
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i); CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
@ -420,16 +412,12 @@ void C_ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax )
g_memreport_enabled = true; g_memreport_enabled = true;
#endif #endif
g_activated = true;
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
// Call plugin_end forward function from plugins. // 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){ for(int i = 1; i <= gpGlobals->maxClients; ++i){
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i); CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
if (pPlayer->initialized) if (pPlayer->initialized)
@ -450,10 +438,8 @@ void C_ServerDeactivate()
// After all clear whole AMX configuration // After all clear whole AMX configuration
// However leave AMX modules which are loaded only once // However leave AMX modules which are loaded only once
void C_ServerDeactivate_Post() void C_ServerDeactivate_Post() {
{
if (!g_initialized)
RETURN_META(MRES_IGNORED);
detachReloadModules(); detachReloadModules();
g_auth.clear(); g_auth.clear();
g_commands.clear(); g_commands.clear();
@ -533,8 +519,7 @@ void C_ServerDeactivate_Post()
RETURN_META(MRES_IGNORED); 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); CPlayer* pPlayer = GET_PLAYER_POINTER(pEntity);
if (!pPlayer->bot) { if (!pPlayer->bot) {
@ -556,8 +541,7 @@ BOOL C_ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *ps
RETURN_META_VALUE(MRES_IGNORED, TRUE); RETURN_META_VALUE(MRES_IGNORED, TRUE);
} }
void C_ClientDisconnect( edict_t *pEntity ) void C_ClientDisconnect( edict_t *pEntity ) {
{
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
if (pPlayer->initialized) if (pPlayer->initialized)
executeForwards(FF_ClientDisconnect, pPlayer->index); executeForwards(FF_ClientDisconnect, pPlayer->index);
@ -569,8 +553,7 @@ void C_ClientDisconnect( edict_t *pEntity )
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void C_ClientPutInServer_Post( edict_t *pEntity ) void C_ClientPutInServer_Post( edict_t *pEntity ) {
{
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
if (!pPlayer->bot) { if (!pPlayer->bot) {
pPlayer->PutInServer(); pPlayer->PutInServer();
@ -582,8 +565,7 @@ void C_ClientPutInServer_Post( edict_t *pEntity )
RETURN_META(MRES_IGNORED); 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); CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
executeForwards(FF_ClientInfoChanged, pPlayer->index); executeForwards(FF_ClientInfoChanged, pPlayer->index);
@ -614,8 +596,7 @@ void C_ClientUserInfoChanged_Post( edict_t *pEntity, char *infobuffer )
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void C_ClientCommand( edict_t *pEntity ) void C_ClientCommand( edict_t *pEntity ) {
{
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
META_RES result = MRES_IGNORED; META_RES result = MRES_IGNORED;
cell ret = 0; cell ret = 0;
@ -727,8 +708,8 @@ void C_ClientCommand( edict_t *pEntity )
RETURN_META( result ); RETURN_META( result );
} }
void C_StartFrame_Post( void ) void C_StartFrame_Post( void ) {
{
if (g_auth_time < gpGlobals->time ) if (g_auth_time < gpGlobals->time )
{ {
g_auth_time = gpGlobals->time + 0.7; g_auth_time = gpGlobals->time + 0.7;
@ -821,8 +802,7 @@ void C_StartFrame_Post( void )
RETURN_META(MRES_IGNORED); 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) if (ed)
{ {
@ -856,56 +836,47 @@ void C_MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict
g_events.parserInit(msg_type, &gpGlobals->time, mPlayer ,mPlayerIndex); g_events.parserInit(msg_type, &gpGlobals->time, mPlayer ,mPlayerIndex);
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void C_WriteByte_Post(int iValue) void C_WriteByte_Post(int iValue) {
{
g_events.parseValue(iValue); g_events.parseValue(iValue);
if (function) (*function)((void *)&iValue); if (function) (*function)((void *)&iValue);
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void C_WriteChar_Post(int iValue) void C_WriteChar_Post(int iValue) {
{
g_events.parseValue(iValue); g_events.parseValue(iValue);
if (function) (*function)((void *)&iValue); if (function) (*function)((void *)&iValue);
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void C_WriteShort_Post(int iValue) void C_WriteShort_Post(int iValue) {
{
g_events.parseValue(iValue); g_events.parseValue(iValue);
if (function) (*function)((void *)&iValue); if (function) (*function)((void *)&iValue);
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void C_WriteLong_Post(int iValue) void C_WriteLong_Post(int iValue) {
{
g_events.parseValue(iValue); g_events.parseValue(iValue);
if (function) (*function)((void *)&iValue); if (function) (*function)((void *)&iValue);
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void C_WriteAngle_Post(float flValue) void C_WriteAngle_Post(float flValue) {
{
g_events.parseValue(flValue); g_events.parseValue(flValue);
if (function) (*function)((void *)&flValue); if (function) (*function)((void *)&flValue);
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void C_WriteCoord_Post(float flValue) void C_WriteCoord_Post(float flValue) {
{
g_events.parseValue(flValue); g_events.parseValue(flValue);
if (function) (*function)((void *)&flValue); if (function) (*function)((void *)&flValue);
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void C_WriteString_Post(const char *sz) void C_WriteString_Post(const char *sz) {
{
g_events.parseValue(sz); g_events.parseValue(sz);
if (function) (*function)((void *)sz); if (function) (*function)((void *)sz);
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void C_WriteEntity_Post(int iValue) void C_WriteEntity_Post(int iValue) {
{
g_events.parseValue(iValue); g_events.parseValue(iValue);
if (function) (*function)((void *)&iValue); if (function) (*function)((void *)&iValue);
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
void C_MessageEnd_Post(void) void C_MessageEnd_Post(void) {
{
g_events.executeEvents(); g_events.executeEvents();
if (endfunction) (*endfunction)(NULL); if (endfunction) (*endfunction)(NULL);
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
@ -952,16 +923,14 @@ int C_Cmd_Argc( void )
// Grenade has been thrown. // Grenade has been thrown.
// Only here we may find out who is an owner. // 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') 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) ); g_grenades.put( e , 1.75, 4, GET_PLAYER_POINTER(e->v.owner) );
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
// Save at what part of body a player is aiming // 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) ) ) { if ( e && ( e->v.flags & (FL_CLIENT | FL_FAKECLIENT) ) ) {
CPlayer* pPlayer = GET_PLAYER_POINTER(e); CPlayer* pPlayer = GET_PLAYER_POINTER(e);
if (ptr->pHit&&(ptr->pHit->v.flags& (FL_CLIENT | FL_FAKECLIENT) )) if (ptr->pHit&&(ptr->pHit->v.flags& (FL_CLIENT | FL_FAKECLIENT) ))
@ -1037,7 +1006,7 @@ C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_
g_NeedsP = true; g_NeedsP = true;
#endif #endif
} else if (mminor >= 11) { } else if (mminor == 11) {
g_IsNewMM = true; g_IsNewMM = true;
} else if (pminor > mminor) { } else if (pminor > mminor) {
LOG_ERROR(PLID, "metamod version is incompatible with this plugin; please find a newer version of this plugin"); LOG_ERROR(PLID, "metamod version is incompatible with this plugin; please find a newer version of this plugin");

View File

@ -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 ); //amx->base = (unsigned char FAR *)realloc( np, amx->code_size );
#ifndef __linux__ #ifndef __linux__
amx->base = (unsigned char *)VirtualAlloc(NULL, amx->code_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); amx->base = new unsigned char[ amx->code_size ];
#else #else
//posix_memalign((void **)&(amx->base), sysconf(_SC_PAGESIZE), amx->code_size); //posix_memalign((void **)&(amx->base), sysconf(_SC_PAGESIZE), amx->code_size);
amx->base = (unsigned char *)memalign(sysconf(_SC_PAGESIZE), amx->code_size); amx->base = (unsigned char *)memalign(sysconf(_SC_PAGESIZE), amx->code_size);
@ -593,36 +593,11 @@ int set_amxnatives(AMX* amx,char error[128])
int unload_amxscript(AMX* amx, void** program) int unload_amxscript(AMX* amx, void** program)
{ {
int flags = amx->flags;
amxx_FreeDebug(amx); amxx_FreeDebug(amx);
CList<CScript,AMX*>::iterator a = g_loadedscripts.find( amx ); CList<CScript,AMX*>::iterator a = g_loadedscripts.find( amx );
if ( a ) a.remove(); if ( a ) a.remove();
char *prg = (char *)*program; 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; delete[] prg;
#endif
*program = 0; *program = 0;
return AMX_ERR_NONE; return AMX_ERR_NONE;
} }
@ -1775,24 +1750,3 @@ void *Module_ReqFnptr(const char *funcName)
return NULL; 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

View File

@ -112,12 +112,11 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib ..\JIT\natives-x86.obj" AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
OutputFile="release/amxmodx_mm.dll" OutputFile="release/amxmodx_mm.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32" AdditionalLibraryDirectories="..\extra\lib_win32"
IgnoreDefaultLibraryNames="LIBC"
ModuleDefinitionFile="" ModuleDefinitionFile=""
ProgramDatabaseFile=".\release/amxx_mm.pdb" ProgramDatabaseFile=".\release/amxx_mm.pdb"
ImportLibrary=".\release/amxx_mm.lib"/> ImportLibrary=".\release/amxx_mm.lib"/>
@ -180,13 +179,12 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib ..\JIT\natives-x86.obj" AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
OutputFile="memtestdebug/amxmodx_mm.dll" OutputFile="memtestdebug/amxmodx_mm.dll"
Version="0.1" Version="0.1"
LinkIncremental="2" LinkIncremental="2"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32" AdditionalLibraryDirectories="..\extra\lib_win32"
IgnoreDefaultLibraryNames="MSVCRT"
ModuleDefinitionFile="" ModuleDefinitionFile=""
GenerateDebugInformation="TRUE" GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\memtestdebug/amxx_mm.pdb" ProgramDatabaseFile=".\memtestdebug/amxx_mm.pdb"
@ -251,12 +249,11 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib ..\JIT\natives-x86.obj" AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
OutputFile="memtestrelease/amxmodx_mm.dll" OutputFile="memtestrelease/amxmodx_mm.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32" AdditionalLibraryDirectories="..\extra\lib_win32"
IgnoreDefaultLibraryNames="LIBC"
ModuleDefinitionFile="" ModuleDefinitionFile=""
GenerateDebugInformation="TRUE" GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\memtestrelease/amxx_mm.pdb" ProgramDatabaseFile=".\memtestrelease/amxx_mm.pdb"
@ -374,7 +371,6 @@
GlobalOptimizations="TRUE" GlobalOptimizations="TRUE"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="..\..\metamod\metamod,..\..\hlsdk\sourcecode\common,..\..\hlsdk\sourcecode\engine,..\..\hlsdk\sourcecode\dlls,..\..\hlsdk\sourcecode\pm_shared,..\extra\include" 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" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;JIT;ASM32;PAWN_CELL_SIZE=32"
IgnoreStandardIncludePath="FALSE" IgnoreStandardIncludePath="FALSE"
@ -466,12 +462,11 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="..\zlib\zlib.lib ..\JIT\amxjitsn.obj ..\JIT\amxexecn.obj ..\JIT\natives-x86.obj" AdditionalDependencies="..\zlib\zlib.lib ..\JIT\amxjitsn.obj ..\JIT\amxexecn.obj"
OutputFile="jitmemtestrelease/amxmodx_mm.dll" OutputFile="jitmemtestrelease/amxmodx_mm.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32" AdditionalLibraryDirectories="..\extra\lib_win32"
IgnoreDefaultLibraryNames="MSVCRT"
ModuleDefinitionFile="" ModuleDefinitionFile=""
GenerateDebugInformation="TRUE" GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\jitmemtestrelease/amxx_mm.pdb" ProgramDatabaseFile=".\jitmemtestrelease/amxx_mm.pdb"
@ -842,25 +837,6 @@
RelativePath="..\version.rc"> RelativePath="..\version.rc">
</File> </File>
</Filter> </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> </Files>
<Globals> <Globals>
</Globals> </Globals>

View File

@ -95,6 +95,4 @@ _amxx_DynaCodesize:
pop ebp pop ebp
ret ret
section .data
GLOBAL_GATE DD 0 GLOBAL_GATE DD 0

View File

@ -29,14 +29,13 @@
*/ */
#include "amxmodx.h" #include "amxmodx.h"
#include <malloc.h>
#include <stdlib.h>
#include "CStack.h" #include "CStack.h"
#include "natives.h" #include "natives.h"
#ifdef __linux__ #ifdef __linux__
#include <malloc.h>
#include <stdlib.h>
#include <sys/mman.h> #include <sys/mman.h>
#include "sclinux.h"
#endif #endif
//Written by David "BAILOPAN" Anderson //Written by David "BAILOPAN" Anderson
@ -409,7 +408,7 @@ void ClearPluginLibraries()
for (size_t i=0; i<g_RegNatives.size(); i++) for (size_t i=0; i<g_RegNatives.size(); i++)
{ {
delete [] g_RegNatives[i]->pfn; delete g_RegNatives[i]->pfn;
delete g_RegNatives[i]; delete g_RegNatives[i];
} }
g_RegNatives.clear(); g_RegNatives.clear();

View File

@ -363,58 +363,6 @@ static cell AMX_NATIVE_CALL menu_makecallback(AMX *amx, cell *params)
return id; 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[] = AMX_NATIVE_INFO g_NewMenuNatives[] =
{ {
{"menu_create", menu_create}, {"menu_create", menu_create},
@ -425,8 +373,5 @@ AMX_NATIVE_INFO g_NewMenuNatives[] =
{"menu_find_id", menu_find_id}, {"menu_find_id", menu_find_id},
{"menu_item_getinfo", menu_item_getinfo}, {"menu_item_getinfo", menu_item_getinfo},
{"menu_makecallback", menu_makecallback}, {"menu_makecallback", menu_makecallback},
{"menu_item_setcall", menu_item_setcall},
{"menu_item_setcmd", menu_item_setcmd},
{"menu_item_setname", menu_item_setname},
{NULL, NULL}, {NULL, NULL},
}; };

View File

@ -45,6 +45,8 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post; DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable; enginefuncs_t *g_pengfuncsTable;
@ -52,6 +54,7 @@ enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions // GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table = static DLL_FUNCTIONS g_EntityAPI_Table =
{ {
@ -2478,11 +2481,9 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
#ifdef MEMORY_TEST
PFN_ALLOCATOR g_fn_Allocator; PFN_ALLOCATOR g_fn_Allocator;
PFN_REALLOCATOR g_fn_Reallocator; PFN_REALLOCATOR g_fn_Reallocator;
PFN_DEALLOCATOR g_fn_Deallocator; PFN_DEALLOCATOR g_fn_Deallocator;
#endif
PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXEC g_fn_AmxExec;
PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_EXECV g_fn_AmxExecv;
PFN_AMX_ALLOT g_fn_AmxAllot; PFN_AMX_ALLOT g_fn_AmxAllot;
@ -2612,12 +2613,10 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
#ifdef MEMORY_TEST
// Memory // Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
#endif
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
@ -2736,8 +2735,6 @@ void ValidateMacros_DontCallThis_Smiley()
} }
#endif #endif
#ifdef MEMORY_TEST
/************* MEMORY *************/ /************* MEMORY *************/
// undef all defined macros // undef all defined macros
#undef new #undef new
@ -2909,30 +2906,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, 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 *************/ /************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new // must come here because cbase.h declares it's own operator new

View File

@ -46,6 +46,8 @@ struct amxx_module_info_s
const char *logtag; // added in version 2 const char *logtag; // added in version 2
}; };
// return values from functions called by amxx // return values from functions called by amxx
#define AMXX_OK 0 /* no error */ #define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */ #define AMXX_IFVERS 1 /* interface version */
@ -1979,14 +1981,12 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif #endif
#ifdef MEMORY_TEST
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/); const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const void* /*addr*/ ); const unsigned int /*type*/, const void* /*addr*/ );
#endif
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); 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_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
@ -2048,6 +2048,7 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
extern PFN_AMX_EXEC g_fn_AmxExec; extern PFN_AMX_EXEC g_fn_AmxExec;
extern PFN_AMX_EXECV g_fn_AmxExecv;
extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_ALLOT g_fn_AmxAllot;
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
@ -2192,7 +2193,6 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_RequestFunction g_fn_RequestFunction; #define MF_RequestFunction g_fn_RequestFunction;
#define MF_AmxPush g_fn_AmxPush #define MF_AmxPush g_fn_AmxPush
#ifdef MEMORY_TEST
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);
void *operator new[](size_t reportedSize); void *operator new[](size_t reportedSize);
@ -2236,6 +2236,4 @@ 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 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) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__ #endif // #ifndef __AMXXMODULE_H__

View File

@ -21,23 +21,13 @@
// metamod plugin? // metamod plugin?
// #define USE_METAMOD // #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 // - AMXX Init functions
// Also consider using FN_META_* // Also consider using FN_META_*
// AMXX query // AMXX query
//#define FN_AMXX_QUERY OnAmxxQuery //#define FN_AMXX_QUERY OnAmxxQuery
// AMXX attach // AMXX attach
// Do native functions init here (MF_AddNatives) // Do native functions init here (MF_AddNatives)
//#define FN_AMXX_ATTACH OnAmxxAttach // #define FN_AMXX_ATTACH OnAmxxAttach
// AMXX detach // AMXX detach
//#define FN_AMXX_DETACH OnAmxxDetach //#define FN_AMXX_DETACH OnAmxxDetach
// All plugins loaded // All plugins loaded
@ -469,4 +459,4 @@
#endif // USE_METAMOD #endif // USE_METAMOD
#endif // __MODULECONFIG_H__ #endif // __MODULECONFIG_H__

View File

@ -97,15 +97,12 @@ void amx_command(){
CPluginMngr::CPlugin *plugin = g_plugins.findPlugin(sPlugin); CPluginMngr::CPlugin *plugin = g_plugins.findPlugin(sPlugin);
if ( plugin && plugin->isValid() && plugin->isPaused() ) if ( plugin && plugin->isValid() )
{ {
plugin->unpausePlugin(); plugin->unpausePlugin();
print_srvconsole("Unpaused plugin \"%s\"\n",plugin->getName() ); 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")) else if (!strcmp(cmd,"cvars"))

View File

@ -27,8 +27,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,5,5,0 FILEVERSION 1,5,0,1
PRODUCTVERSION 1,5,5,0 PRODUCTVERSION 1,5,0,1
FILEFLAGSMASK 0x17L FILEFLAGSMASK 0x17L
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -45,12 +45,12 @@ BEGIN
BEGIN BEGIN
VALUE "Comments", "AMX Mod X" VALUE "Comments", "AMX Mod X"
VALUE "FileDescription", "AMX Mod X" VALUE "FileDescription", "AMX Mod X"
VALUE "FileVersion", "1.55" VALUE "FileVersion", "1.50"
VALUE "InternalName", "amxmodx" VALUE "InternalName", "amxmodx"
VALUE "LegalCopyright", "Copyright (c) 2004-2005, AMX Mod X Dev Team" VALUE "LegalCopyright", "Copyright (c) 2004-2005, AMX Mod X Dev Team"
VALUE "OriginalFilename", "amxmodx_mm.dll" VALUE "OriginalFilename", "amxmodx_mm.dll"
VALUE "ProductName", "AMX Mod X" VALUE "ProductName", "AMX Mod X"
VALUE "ProductVersion", "1.55" VALUE "ProductVersion", "1.50-RC1"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -3,14 +3,14 @@
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = g++
BINARY = amxxpc BINARY = amxxpc
OBJECTS = amx.cpp amxxpc.cpp Binary.cpp OBJECTS = amx.cpp amxxpc.cpp Binary.cpp
LINK = -lz /lib/libstdc++.a LINK = -lz
INCLUDE = -I. -L. INCLUDE = -I. -L.
@ -22,7 +22,7 @@ else
CFLAGS = $(OPT_FLAGS) CFLAGS = $(OPT_FLAGS)
endif endif
CFLAGS += -DLINUX -DNDEBUG -Wno-deprecated -fexceptions -DHAVE_STDINT_H -DAMX_ANSIONLY -fno-rtti -static-libgcc CFLAGS += -DLINUX -DNDEBUG -Wno-deprecated -fexceptions -DHAVE_STDINT_H -DAMX_ANSIONLY
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o) OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)

View File

@ -99,6 +99,7 @@ int main(int argc, char **argv)
fclose(fp); fclose(fp);
} }
dlclose(lib);
unlink(file); unlink(file);
HINSTANCE lib64 = 0; HINSTANCE lib64 = 0;
@ -107,7 +108,8 @@ int main(int argc, char **argv)
#else #else
lib64 = dlmount("amxxpc64.dll"); lib64 = dlmount("amxxpc64.dll");
#endif #endif
if (!lib64) pc_printf = (PRINTF)dlsym(lib64, "pc_printf");
if (!lib64 || !pc_printf)
{ {
pc_printf("64bit compiler failed to instantiate.\n"); pc_printf("64bit compiler failed to instantiate.\n");
exit(0); exit(0);
@ -127,8 +129,6 @@ int main(int argc, char **argv)
sc64(argc, argv); sc64(argc, argv);
dlclose(lib64);
if (file == NULL) if (file == NULL)
{ {
pc_printf("Could not locate the output file on second pass.\n"); 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"); pc_printf("Done.\n");
dlclose(lib); dlclose(lib64);
exit(0); exit(0);
} }

View File

@ -3,7 +3,7 @@
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = gcc
NAME = amxxpc NAME = amxxpc
@ -25,7 +25,7 @@ else
CFLAGS += -DPAWN_CELL_SIZE=32 CFLAGS += -DPAWN_CELL_SIZE=32
endif endif
CFLAGS += -DLINUX -DNDEBUG -fPIC -DHAVE_STDINT_H -DENABLE_BINRELOC -DNO_MAIN -DPAWNC_DLL -static-libgcc CFLAGS += -DLINUX -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -DENABLE_BINRELOC -DNO_MAIN -DPAWNC_DLL
CFLAGS += $(OPT_FLAGS) CFLAGS += $(OPT_FLAGS)
OBJ_LINUX := $(OBJECTS:%.c=$(BIN_DIR)/%.o) OBJ_LINUX := $(OBJECTS:%.c=$(BIN_DIR)/%.o)
@ -42,6 +42,9 @@ all:
pawn_make: $(OBJ_LINUX) pawn_make: $(OBJ_LINUX)
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY) $(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
pawn64:
$(MAKE) pawn_make PAWN64=true
debug: debug:
$(MAKE) all DEBUG=true $(MAKE) all DEBUG=true

View File

@ -247,9 +247,6 @@
<File <File
RelativePath=".\scstate.c"> RelativePath=".\scstate.c">
</File> </File>
<File
RelativePath=".\scstub.c">
</File>
<File <File
RelativePath=".\scvars.c"> RelativePath=".\scvars.c">
</File> </File>

View File

@ -629,7 +629,11 @@ SC_FUNC void jmp_eq0(int number);
SC_FUNC void outval(cell val,int newline); SC_FUNC void outval(cell val,int newline);
/* function prototypes in SC5.C */ /* function prototypes in SC5.C */
SC_FUNC int error(int number,...) __attribute__((visibility("protected"))); #ifdef __linux__
SC_FUNC int error(int number,...) __attribute__((visibility("internal")));
#else
SC_FUNC int error(int number,...)
#endif
SC_FUNC void errorset(int code); SC_FUNC void errorset(int code);
/* function prototypes in SC6.C */ /* function prototypes in SC6.C */

View File

@ -654,6 +654,7 @@ cleanup:
int flag_exceed=0; int flag_exceed=0;
if (sc_amxlimit > 0 && (long)(hdrsize+code_idx+glb_declared*sizeof(cell)+sc_stksize*sizeof(cell)) >= sc_amxlimit) if (sc_amxlimit > 0 && (long)(hdrsize+code_idx+glb_declared*sizeof(cell)+sc_stksize*sizeof(cell)) >= sc_amxlimit)
flag_exceed=1; flag_exceed=1;
#if PAWN_CELL_SIZE==32
if ((sc_debug & sSYMBOLIC)!=0 || verbosity>=2 || stacksize+32>=(long)sc_stksize || flag_exceed) { 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("Header size: %8ld bytes\n", (long)hdrsize);
pc_printf("Code size: %8ld bytes\n", (long)code_idx); pc_printf("Code size: %8ld bytes\n", (long)code_idx);
@ -665,6 +666,7 @@ cleanup:
pc_printf("estimated max. usage=%ld cells (%ld bytes)\n",stacksize,stacksize*sizeof(cell)); 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)); pc_printf("Total requirements:%8ld bytes\n", (long)hdrsize+(long)code_idx+(long)glb_declared*sizeof(cell)+(long)sc_stksize*sizeof(cell));
} /* if */ } /* if */
#endif
if (flag_exceed) if (flag_exceed)
error(106,sc_amxlimit); /* this causes a jump back to label "cleanup" */ error(106,sc_amxlimit); /* this causes a jump back to label "cleanup" */
} /* if */ } /* if */
@ -1919,8 +1921,8 @@ static int declloc(int fstatic)
* of a global variable or to that of a local variable at a lower * of a global variable or to that of a local variable at a lower
* level might indicate a bug. * level might indicate a bug.
*/ */
if ((sym=findloc(name))!=NULL && sym->compound!=nestlevel || findglb(name)!=NULL) if ((sym=findloc(name))!=NULL && sym->compound!=nestlevel || findglb(name)!=NULL);
error(219,name); /* variable shadows another symbol */ //error(219,name); /* variable shadows another symbol */
while (matchtoken('[')){ while (matchtoken('[')){
ident=iARRAY; ident=iARRAY;
if (numdim == sDIMEN_MAX) { if (numdim == sDIMEN_MAX) {
@ -3643,8 +3645,8 @@ static void doarg(char *name,int ident,int offset,int tags[],int numtags,
if (argsym!=NULL) { if (argsym!=NULL) {
error(21,name); /* symbol already defined */ error(21,name); /* symbol already defined */
} else { } else {
if ((argsym=findglb(name))!=NULL && argsym->ident!=iFUNCTN) if ((argsym=findglb(name))!=NULL && argsym->ident!=iFUNCTN) ;
error(219,name); /* variable shadows another symbol */ //error(219,name); /* variable shadows another symbol */
/* add details of type and address */ /* add details of type and address */
assert(numtags>0); assert(numtags>0);
argsym=addvariable(name,offset,ident,sLOCAL,tags[0], argsym=addvariable(name,offset,ident,sLOCAL,tags[0],

View File

@ -35,7 +35,7 @@ statscfg.amxx ; allows to manage stats plugins via menu and commands
; Counter-Strike ; Counter-Strike
;restmenu.amxx ; restrict weapons menu ;restmenu.amxx ; restrict weapons menu
statsx.amxx ; stats on death or round end (CSX Module required!) ;statsx.amxx ; stats on death or round end (CSX Module required!)
;miscstats.amxx ; bunch of events announcement for Counter-Strike ;miscstats.amxx ; bunch of events announcement for Counter-Strike
;stats_logging.amxx ; weapons stats logging (CSX Module required!) ;stats_logging.amxx ; weapons stats logging (CSX Module required!)

View File

@ -12,16 +12,16 @@ fun_amxx_amd64.so
; ---------------------------------------------------- ; ----------------------------------------------------
; Engine - provides engine functions core to Half-Life ; Engine - provides engine functions core to Half-Life
; ---------------------------------------------------- ; ----------------------------------------------------
engine_amxx_i386.so ;engine_amxx_i386.so
engine_amxx.dll ;engine_amxx.dll
engine_amxx_amd64.so ;engine_amxx_amd64.so
; ---------------------------------------------------------- ; ----------------------------------------------------------
; Fakemeta - provides a massive interface into the HL engine ; Fakemeta - provides a massive interface into the HL engine
; ---------------------------------------------------------- ; ----------------------------------------------------------
fakemeta_amxx_i386.so ;fakemeta_amxx_i386.so
fakemeta_amxx.dll ;fakemeta_amxx.dll
fakemeta_amxx_amd64.so ;fakemeta_amxx_amd64.so
; ------------------------------------------- ; -------------------------------------------
; Database Access - only enable one of these ; Database Access - only enable one of these
@ -66,4 +66,11 @@ fakemeta_amxx_amd64.so
; -------------------- ; --------------------
;nvault_amxx_i386.so ;nvault_amxx_i386.so
;nvault_amxx.dll ;nvault_amxx.dll
;nvault_amxx_amd64.so ;nvault_amxx_amd64.so
; --------------------------------------------
; Adds ESF miscellanious and hacking functions
; --------------------------------------------
esfmod_amxx_i386.so
esfmod_amxx.dll
esfmod_amxx_amd64.so

View File

@ -1,39 +0,0 @@
; 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)

View File

@ -6,7 +6,7 @@ MM_ROOT = ../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fomit-frame-pointer OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = gcc
NAME = cstrike_amxx NAME = cstrike_amxx
@ -26,11 +26,12 @@ else
CFLAGS = $(OPT_FLAGS) CFLAGS = $(OPT_FLAGS)
endif endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
ifeq "$(AMD64)" "true" ifeq "$(AMD64)" "true"
BINARY = $(NAME)_amd64.so BINARY = $(NAME)_amd64.so
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
LINK += -lstdc++
else else
BINARY = $(NAME)_i386.so BINARY = $(NAME)_i386.so
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32

View File

@ -45,6 +45,8 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post; DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable; enginefuncs_t *g_pengfuncsTable;
@ -52,6 +54,7 @@ enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions // GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table = static DLL_FUNCTIONS g_EntityAPI_Table =
{ {
@ -2478,11 +2481,9 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
#ifdef MEMORY_TEST
PFN_ALLOCATOR g_fn_Allocator; PFN_ALLOCATOR g_fn_Allocator;
PFN_REALLOCATOR g_fn_Reallocator; PFN_REALLOCATOR g_fn_Reallocator;
PFN_DEALLOCATOR g_fn_Deallocator; PFN_DEALLOCATOR g_fn_Deallocator;
#endif
PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXEC g_fn_AmxExec;
PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_EXECV g_fn_AmxExecv;
PFN_AMX_ALLOT g_fn_AmxAllot; PFN_AMX_ALLOT g_fn_AmxAllot;
@ -2501,7 +2502,6 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
PFN_FORMAT g_fn_Format; PFN_FORMAT g_fn_Format;
PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REGISTERFUNCTION g_fn_RegisterFunction;
PFN_REQ_FNPTR g_fn_RequestFunction; PFN_REQ_FNPTR g_fn_RequestFunction;
PFN_AMX_PUSH g_fn_AmxPush;
// *** Exports *** // *** Exports ***
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
@ -2610,14 +2610,11 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
#ifdef MEMORY_TEST
// Memory // Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
#endif
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
@ -2720,7 +2717,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_IsPlayerHLTV(0); MF_IsPlayerHLTV(0);
MF_GetPlayerArmor(0); MF_GetPlayerArmor(0);
MF_GetPlayerHealth(0); MF_GetPlayerHealth(0);
MF_AmxExec(0, 0, 0); MF_AmxExec(0, 0, 0, 0);
MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0);
MF_AmxFindPublic(0, 0, 0); MF_AmxFindPublic(0, 0, 0);
MF_AmxAllot(0, 0, 0, 0); MF_AmxAllot(0, 0, 0, 0);
@ -2736,8 +2733,6 @@ void ValidateMacros_DontCallThis_Smiley()
} }
#endif #endif
#ifdef MEMORY_TEST
/************* MEMORY *************/ /************* MEMORY *************/
// undef all defined macros // undef all defined macros
#undef new #undef new
@ -2909,30 +2904,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, 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 *************/ /************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new // must come here because cbase.h declares it's own operator new

View File

@ -46,6 +46,8 @@ struct amxx_module_info_s
const char *logtag; // added in version 2 const char *logtag; // added in version 2
}; };
// return values from functions called by amxx // return values from functions called by amxx
#define AMXX_OK 0 /* no error */ #define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */ #define AMXX_IFVERS 1 /* interface version */
@ -1979,15 +1981,13 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif #endif
#ifdef MEMORY_TEST
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/); const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const void* /*addr*/ ); const unsigned int /*type*/, const void* /*addr*/ );
#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
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_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
@ -2002,7 +2002,6 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); 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_ADD_NATIVES g_fn_AddNatives;
extern PFN_BUILD_PATHNAME g_fn_BuildPathname; extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
@ -2048,6 +2047,7 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
extern PFN_AMX_EXEC g_fn_AmxExec; extern PFN_AMX_EXEC g_fn_AmxExec;
extern PFN_AMX_EXECV g_fn_AmxExecv;
extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_ALLOT g_fn_AmxAllot;
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
@ -2065,7 +2065,6 @@ extern PFN_FORMAT g_fn_Format;
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
extern PFN_REQ_FNPTR g_fn_RequestFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction;
extern PFN_AMX_PUSH g_fn_AmxPush;
#ifdef MAY_NEVER_BE_DEFINED #ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems // Function prototypes for intellisense and similar systems
@ -2124,8 +2123,6 @@ edict_t* MF_GetPlayerEdict (int id) { }
const char * MF_Format (const char *fmt, ...) { } const char * MF_Format (const char *fmt, ...) { }
void MF_RegisterFunction (void *pfn, const char *description) { } void MF_RegisterFunction (void *pfn, const char *description) { }
void * MF_RequestFunction (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 #endif // MAY_NEVER_BE_DEFINED
#define MF_AddNatives g_fn_AddNatives #define MF_AddNatives g_fn_AddNatives
@ -2190,9 +2187,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_Format g_fn_Format #define MF_Format g_fn_Format
#define MF_RegisterFunction g_fn_RegisterFunction #define MF_RegisterFunction g_fn_RegisterFunction
#define MF_RequestFunction g_fn_RequestFunction; #define MF_RequestFunction g_fn_RequestFunction;
#define MF_AmxPush g_fn_AmxPush
#ifdef MEMORY_TEST
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);
void *operator new[](size_t reportedSize); void *operator new[](size_t reportedSize);
@ -2236,6 +2231,4 @@ 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 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) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__ #endif // #ifndef __AMXXMODULE_H__

View File

@ -175,7 +175,7 @@ static cell AMX_NATIVE_CALL cs_get_weapon_silenced(AMX *amx, cell *params) // cs
// Make into edict pointer // Make into edict pointer
edict_t *pWeapon = INDEXENT(params[1]); edict_t *pWeapon = INDEXENT(params[1]);
int weapontype = *((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE); int weapontype = (int)*((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
int *silencemode = ((int *)pWeapon->pvPrivateData + OFFSET_SILENCER_FIREMODE); int *silencemode = ((int *)pWeapon->pvPrivateData + OFFSET_SILENCER_FIREMODE);
switch (weapontype) { switch (weapontype) {
case CSW_M4A1: case CSW_M4A1:
@ -357,12 +357,10 @@ static cell AMX_NATIVE_CALL cs_get_user_armor(AMX *amx, cell *params) // cs_get_
// Make into edict pointer // Make into edict pointer
edict_t *pPlayer = MF_GetPlayerEdict(params[1]); edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
#if 0
cell *armorTypeByRef = MF_GetAmxAddr(amx, params[2]); cell *armorTypeByRef = MF_GetAmxAddr(amx, params[2]);
*armorTypeByRef = *((int *)pPlayer->pvPrivateData + OFFSET_ARMORTYPE); *armorTypeByRef = *((int *)pPlayer->pvPrivateData + OFFSET_ARMORTYPE);
#endif
return (cell)pPlayer->v.armorvalue; return pPlayer->v.armorvalue;
} }
static cell AMX_NATIVE_CALL cs_set_user_armor(AMX *amx, cell *params) // cs_set_user_armor(index, armorvalue, CsArmorType:armortype); = 3 params static cell AMX_NATIVE_CALL cs_set_user_armor(AMX *amx, cell *params) // cs_set_user_armor(index, armorvalue, CsArmorType:armortype); = 3 params
@ -1234,118 +1232,6 @@ static cell AMX_NATIVE_CALL cs_user_spawn(AMX *amx, cell *params)
return 1; 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[] = { AMX_NATIVE_INFO cstrike_Exports[] = {
{"cs_set_user_money", cs_set_user_money}, {"cs_set_user_money", cs_set_user_money},
{"cs_get_user_money", cs_get_user_money}, {"cs_get_user_money", cs_get_user_money},
@ -1388,8 +1274,6 @@ AMX_NATIVE_INFO cstrike_Exports[] = {
{"cs_set_user_armor", cs_set_user_armor}, {"cs_set_user_armor", cs_set_user_armor},
{"cs_get_user_shield", cs_get_user_shield}, {"cs_get_user_shield", cs_get_user_shield},
{"cs_user_spawn", cs_user_spawn}, {"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! //------------------- <-- max 19 characters!
{NULL, NULL} {NULL, NULL}
}; };

View File

@ -102,8 +102,6 @@
// "hostage_entity" entities // "hostage_entity" entities
#define OFFSET_HOSTAGEFOLLOW 86 + EXTRAOFFSET #define OFFSET_HOSTAGEFOLLOW 86 + EXTRAOFFSET
#define OFFSET_HOSTAGEID 487 + EXTRAOFFSET #define OFFSET_HOSTAGEID 487 + EXTRAOFFSET
// "armoury_entity"
#define OFFSET_ARMOURY_TYPE 34 + EXTRAOFFSET
#else #else
// Amd64 offsets here // Amd64 offsets here
#define OFFSET_ARMORTYPE 137 + EXTRAOFFSET #define OFFSET_ARMORTYPE 137 + EXTRAOFFSET
@ -176,29 +174,6 @@
#define CSW_AK47 28 #define CSW_AK47 28
//#define CSW_KNIFE 29 //#define CSW_KNIFE 29
#define CSW_P90 30 #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_SILENCED (1<<2)
#define M4A1_ATTACHSILENCEANIM 6 #define M4A1_ATTACHSILENCEANIM 6
@ -300,5 +275,4 @@ bool g_noknives = false;
} }
#define GETEDICT(n) \ #define GETEDICT(n) \
((n >= 1 && n <= gpGlobals->maxClients) ? MF_GetPlayerEdict(n) : INDEXENT(n)) ((n >= 1 && n <= gpGlobals->maxClients) ? MF_GetPlayerEdict(n) : INDEXENT(n))

View File

@ -5,7 +5,7 @@
// Module info // Module info
#define MODULE_NAME "CStrike" #define MODULE_NAME "CStrike"
#define MODULE_VERSION "1.55" #define MODULE_VERSION "1.50"
#define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org" #define MODULE_URL "http://www.amxmodx.org"
#define MODULE_LOGTAG "CSTRIKE" #define MODULE_LOGTAG "CSTRIKE"
@ -460,4 +460,3 @@
#endif // USE_METAMOD #endif // USE_METAMOD
#endif // __MODULECONFIG_H__ #endif // __MODULECONFIG_H__

View File

@ -307,5 +307,4 @@ void RankSystem::saveRank( const char* filename )
fwrite( &i , 1, sizeof(short int), bfp); // null terminator fwrite( &i , 1, sizeof(short int), bfp); // null terminator
fclose(bfp); fclose(bfp);
} }

View File

@ -119,5 +119,4 @@ public:
}; };
#endif #endif

View File

@ -6,7 +6,7 @@ MM_ROOT = ../../../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fomit-frame-pointer OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = gcc
NAME = csx_amxx NAME = csx_amxx
@ -26,11 +26,12 @@ else
CFLAGS = $(OPT_FLAGS) CFLAGS = $(OPT_FLAGS)
endif endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
ifeq "$(AMD64)" "true" ifeq "$(AMD64)" "true"
BINARY = $(NAME)_amd64.so BINARY = $(NAME)_amd64.so
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
LINK += -lstdc++
else else
BINARY = $(NAME)_i386.so BINARY = $(NAME)_i386.so
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32

View File

@ -45,6 +45,8 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post; DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable; enginefuncs_t *g_pengfuncsTable;
@ -52,6 +54,7 @@ enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions // GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table = static DLL_FUNCTIONS g_EntityAPI_Table =
{ {
@ -2478,11 +2481,9 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
#ifdef MEMORY_TEST
PFN_ALLOCATOR g_fn_Allocator; PFN_ALLOCATOR g_fn_Allocator;
PFN_REALLOCATOR g_fn_Reallocator; PFN_REALLOCATOR g_fn_Reallocator;
PFN_DEALLOCATOR g_fn_Deallocator; PFN_DEALLOCATOR g_fn_Deallocator;
#endif
PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXEC g_fn_AmxExec;
PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_EXECV g_fn_AmxExecv;
PFN_AMX_ALLOT g_fn_AmxAllot; PFN_AMX_ALLOT g_fn_AmxAllot;
@ -2612,12 +2613,10 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
#ifdef MEMORY_TEST
// Memory // Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
#endif
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
@ -2736,8 +2735,6 @@ void ValidateMacros_DontCallThis_Smiley()
} }
#endif #endif
#ifdef MEMORY_TEST
/************* MEMORY *************/ /************* MEMORY *************/
// undef all defined macros // undef all defined macros
#undef new #undef new
@ -2909,30 +2906,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, 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 *************/ /************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new // must come here because cbase.h declares it's own operator new

View File

@ -46,6 +46,8 @@ struct amxx_module_info_s
const char *logtag; // added in version 2 const char *logtag; // added in version 2
}; };
// return values from functions called by amxx // return values from functions called by amxx
#define AMXX_OK 0 /* no error */ #define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */ #define AMXX_IFVERS 1 /* interface version */
@ -1979,14 +1981,12 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif #endif
#ifdef MEMORY_TEST
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/); const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const void* /*addr*/ ); const unsigned int /*type*/, const void* /*addr*/ );
#endif
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); 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_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
@ -2048,6 +2048,7 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
extern PFN_AMX_EXEC g_fn_AmxExec; extern PFN_AMX_EXEC g_fn_AmxExec;
extern PFN_AMX_EXECV g_fn_AmxExecv;
extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_ALLOT g_fn_AmxAllot;
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
@ -2192,7 +2193,6 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_RequestFunction g_fn_RequestFunction; #define MF_RequestFunction g_fn_RequestFunction;
#define MF_AmxPush g_fn_AmxPush #define MF_AmxPush g_fn_AmxPush
#ifdef MEMORY_TEST
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);
void *operator new[](size_t reportedSize); void *operator new[](size_t reportedSize);
@ -2236,6 +2236,4 @@ 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 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) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__ #endif // #ifndef __AMXXMODULE_H__

View File

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

View File

@ -26,9 +26,9 @@
AdditionalIncludeDirectories="..\..\metamod,..\..\sdk\common,..\..\sdk\engine,..\..\sdk\dlls" AdditionalIncludeDirectories="..\..\metamod,..\..\sdk\common,..\..\sdk\engine,..\..\sdk\dlls"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;csx_EXPORTS;JIT" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;csx_EXPORTS;JIT"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="4" RuntimeLibrary="0"
StructMemberAlignment="0" StructMemberAlignment="3"
EnableFunctionLevelLinking="FALSE" EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2" UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\release/csx.pch" PrecompiledHeaderFile=".\release/csx.pch"
AssemblerListingLocation=".\release/" AssemblerListingLocation=".\release/"
@ -91,7 +91,7 @@
AdditionalIncludeDirectories="..\..\metamod,..\..\sdk\common,..\..\sdk\engine,..\..\sdk\dlls,..\..\hlsdk\sourcecode\pm_shared" AdditionalIncludeDirectories="..\..\metamod,..\..\sdk\common,..\..\sdk\engine,..\..\sdk\dlls,..\..\hlsdk\sourcecode\pm_shared"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;csx_EXPORTS" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;csx_EXPORTS"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="5" RuntimeLibrary="1"
UsePrecompiledHeader="2" UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\debug/csx.pch" PrecompiledHeaderFile=".\debug/csx.pch"
AssemblerListingLocation=".\debug/" AssemblerListingLocation=".\debug/"

View File

@ -6,7 +6,7 @@ MM_ROOT = ../../../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = gcc
NAME = dodfun_amxx NAME = dodfun_amxx
@ -26,11 +26,12 @@ else
CFLAGS = $(OPT_FLAGS) CFLAGS = $(OPT_FLAGS)
endif endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
ifeq "$(AMD64)" "true" ifeq "$(AMD64)" "true"
BINARY = $(NAME)_amd64.so BINARY = $(NAME)_amd64.so
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
LINK += -lstdc++
else else
BINARY = $(NAME)_i386.so BINARY = $(NAME)_i386.so
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32

View File

@ -45,6 +45,8 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post; DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable; enginefuncs_t *g_pengfuncsTable;
@ -52,6 +54,7 @@ enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions // GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table = static DLL_FUNCTIONS g_EntityAPI_Table =
{ {
@ -2478,11 +2481,9 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
#ifdef MEMORY_TEST
PFN_ALLOCATOR g_fn_Allocator; PFN_ALLOCATOR g_fn_Allocator;
PFN_REALLOCATOR g_fn_Reallocator; PFN_REALLOCATOR g_fn_Reallocator;
PFN_DEALLOCATOR g_fn_Deallocator; PFN_DEALLOCATOR g_fn_Deallocator;
#endif
PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXEC g_fn_AmxExec;
PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_EXECV g_fn_AmxExecv;
PFN_AMX_ALLOT g_fn_AmxAllot; PFN_AMX_ALLOT g_fn_AmxAllot;
@ -2501,7 +2502,6 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
PFN_FORMAT g_fn_Format; PFN_FORMAT g_fn_Format;
PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REGISTERFUNCTION g_fn_RegisterFunction;
PFN_REQ_FNPTR g_fn_RequestFunction; PFN_REQ_FNPTR g_fn_RequestFunction;
PFN_AMX_PUSH g_fn_AmxPush;
// *** Exports *** // *** Exports ***
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
@ -2610,14 +2610,11 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
#ifdef MEMORY_TEST
// Memory // Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
#endif
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
@ -2720,7 +2717,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_IsPlayerHLTV(0); MF_IsPlayerHLTV(0);
MF_GetPlayerArmor(0); MF_GetPlayerArmor(0);
MF_GetPlayerHealth(0); MF_GetPlayerHealth(0);
MF_AmxExec(0, 0, 0); MF_AmxExec(0, 0, 0, 0);
MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0);
MF_AmxFindPublic(0, 0, 0); MF_AmxFindPublic(0, 0, 0);
MF_AmxAllot(0, 0, 0, 0); MF_AmxAllot(0, 0, 0, 0);
@ -2736,8 +2733,6 @@ void ValidateMacros_DontCallThis_Smiley()
} }
#endif #endif
#ifdef MEMORY_TEST
/************* MEMORY *************/ /************* MEMORY *************/
// undef all defined macros // undef all defined macros
#undef new #undef new
@ -2909,30 +2904,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, 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 *************/ /************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new // must come here because cbase.h declares it's own operator new

View File

@ -46,6 +46,8 @@ struct amxx_module_info_s
const char *logtag; // added in version 2 const char *logtag; // added in version 2
}; };
// return values from functions called by amxx // return values from functions called by amxx
#define AMXX_OK 0 /* no error */ #define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */ #define AMXX_IFVERS 1 /* interface version */
@ -1979,15 +1981,13 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif #endif
#ifdef MEMORY_TEST
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/); const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const void* /*addr*/ ); const unsigned int /*type*/, const void* /*addr*/ );
#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
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_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
@ -2002,7 +2002,6 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); 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_ADD_NATIVES g_fn_AddNatives;
extern PFN_BUILD_PATHNAME g_fn_BuildPathname; extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
@ -2048,6 +2047,7 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
extern PFN_AMX_EXEC g_fn_AmxExec; extern PFN_AMX_EXEC g_fn_AmxExec;
extern PFN_AMX_EXECV g_fn_AmxExecv;
extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_ALLOT g_fn_AmxAllot;
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
@ -2065,7 +2065,6 @@ extern PFN_FORMAT g_fn_Format;
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
extern PFN_REQ_FNPTR g_fn_RequestFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction;
extern PFN_AMX_PUSH g_fn_AmxPush;
#ifdef MAY_NEVER_BE_DEFINED #ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems // Function prototypes for intellisense and similar systems
@ -2124,8 +2123,6 @@ edict_t* MF_GetPlayerEdict (int id) { }
const char * MF_Format (const char *fmt, ...) { } const char * MF_Format (const char *fmt, ...) { }
void MF_RegisterFunction (void *pfn, const char *description) { } void MF_RegisterFunction (void *pfn, const char *description) { }
void * MF_RequestFunction (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 #endif // MAY_NEVER_BE_DEFINED
#define MF_AddNatives g_fn_AddNatives #define MF_AddNatives g_fn_AddNatives
@ -2190,9 +2187,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_Format g_fn_Format #define MF_Format g_fn_Format
#define MF_RegisterFunction g_fn_RegisterFunction #define MF_RegisterFunction g_fn_RegisterFunction
#define MF_RequestFunction g_fn_RequestFunction; #define MF_RequestFunction g_fn_RequestFunction;
#define MF_AmxPush g_fn_AmxPush
#ifdef MEMORY_TEST
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);
void *operator new[](size_t reportedSize); void *operator new[](size_t reportedSize);
@ -2236,6 +2231,4 @@ 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 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) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__ #endif // #ifndef __AMXXMODULE_H__

View File

@ -5,7 +5,7 @@
// Module info // Module info
#define MODULE_NAME "DoD Fun" #define MODULE_NAME "DoD Fun"
#define MODULE_VERSION "1.55" #define MODULE_VERSION "1.50"
#define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org" #define MODULE_URL "http://www.amxmodx.org"
#define MODULE_LOGTAG "DODFUN" #define MODULE_LOGTAG "DODFUN"

View File

@ -6,7 +6,7 @@ MM_ROOT = ../../../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = gcc
NAME = dodx_amxx NAME = dodx_amxx
@ -26,11 +26,12 @@ else
CFLAGS = $(OPT_FLAGS) CFLAGS = $(OPT_FLAGS)
endif endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
ifeq "$(AMD64)" "true" ifeq "$(AMD64)" "true"
BINARY = $(NAME)_amd64.so BINARY = $(NAME)_amd64.so
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
LINK += -lstdc++
else else
BINARY = $(NAME)_i386.so BINARY = $(NAME)_i386.so
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32

View File

@ -45,6 +45,8 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post; DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable; enginefuncs_t *g_pengfuncsTable;
@ -52,6 +54,7 @@ enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions // GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table = static DLL_FUNCTIONS g_EntityAPI_Table =
{ {
@ -2478,11 +2481,9 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
#ifdef MEMORY_TEST
PFN_ALLOCATOR g_fn_Allocator; PFN_ALLOCATOR g_fn_Allocator;
PFN_REALLOCATOR g_fn_Reallocator; PFN_REALLOCATOR g_fn_Reallocator;
PFN_DEALLOCATOR g_fn_Deallocator; PFN_DEALLOCATOR g_fn_Deallocator;
#endif
PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXEC g_fn_AmxExec;
PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_EXECV g_fn_AmxExecv;
PFN_AMX_ALLOT g_fn_AmxAllot; PFN_AMX_ALLOT g_fn_AmxAllot;
@ -2612,12 +2613,10 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
#ifdef MEMORY_TEST
// Memory // Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
#endif
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
@ -2736,8 +2735,6 @@ void ValidateMacros_DontCallThis_Smiley()
} }
#endif #endif
#ifdef MEMORY_TEST
/************* MEMORY *************/ /************* MEMORY *************/
// undef all defined macros // undef all defined macros
#undef new #undef new
@ -2909,30 +2906,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, 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 *************/ /************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new // must come here because cbase.h declares it's own operator new

View File

@ -46,6 +46,8 @@ struct amxx_module_info_s
const char *logtag; // added in version 2 const char *logtag; // added in version 2
}; };
// return values from functions called by amxx // return values from functions called by amxx
#define AMXX_OK 0 /* no error */ #define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */ #define AMXX_IFVERS 1 /* interface version */
@ -1979,14 +1981,12 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif #endif
#ifdef MEMORY_TEST
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/); const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const void* /*addr*/ ); const unsigned int /*type*/, const void* /*addr*/ );
#endif
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); 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_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
@ -2048,6 +2048,7 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
extern PFN_AMX_EXEC g_fn_AmxExec; extern PFN_AMX_EXEC g_fn_AmxExec;
extern PFN_AMX_EXECV g_fn_AmxExecv;
extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_ALLOT g_fn_AmxAllot;
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
@ -2192,7 +2193,6 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_RequestFunction g_fn_RequestFunction; #define MF_RequestFunction g_fn_RequestFunction;
#define MF_AmxPush g_fn_AmxPush #define MF_AmxPush g_fn_AmxPush
#ifdef MEMORY_TEST
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);
void *operator new[](size_t reportedSize); void *operator new[](size_t reportedSize);
@ -2236,6 +2236,4 @@ 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 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) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__ #endif // #ifndef __AMXXMODULE_H__

View File

@ -5,7 +5,7 @@
// Module info // Module info
#define MODULE_NAME "DoDX" #define MODULE_NAME "DoDX"
#define MODULE_VERSION "1.55" #define MODULE_VERSION "1.50"
#define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org" #define MODULE_URL "http://www.amxmodx.org"
#define MODULE_LOGTAG "DODX" #define MODULE_LOGTAG "DODX"

View File

@ -6,7 +6,7 @@ MM_ROOT = ../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fomit-frame-pointer OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = gcc
NAME = engine_amxx NAME = engine_amxx
@ -26,11 +26,12 @@ else
CFLAGS = $(OPT_FLAGS) CFLAGS = $(OPT_FLAGS)
endif endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
ifeq "$(AMD64)" "true" ifeq "$(AMD64)" "true"
BINARY = $(NAME)_amd64.so BINARY = $(NAME)_amd64.so
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
LINK += -lstdc++
else else
BINARY = $(NAME)_i386.so BINARY = $(NAME)_i386.so
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32

View File

@ -45,6 +45,8 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post; DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable; enginefuncs_t *g_pengfuncsTable;
@ -52,6 +54,7 @@ enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions // GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table = static DLL_FUNCTIONS g_EntityAPI_Table =
{ {
@ -2478,11 +2481,9 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
#ifdef MEMORY_TEST
PFN_ALLOCATOR g_fn_Allocator; PFN_ALLOCATOR g_fn_Allocator;
PFN_REALLOCATOR g_fn_Reallocator; PFN_REALLOCATOR g_fn_Reallocator;
PFN_DEALLOCATOR g_fn_Deallocator; PFN_DEALLOCATOR g_fn_Deallocator;
#endif
PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXEC g_fn_AmxExec;
PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_EXECV g_fn_AmxExecv;
PFN_AMX_ALLOT g_fn_AmxAllot; PFN_AMX_ALLOT g_fn_AmxAllot;
@ -2501,7 +2502,6 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
PFN_FORMAT g_fn_Format; PFN_FORMAT g_fn_Format;
PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REGISTERFUNCTION g_fn_RegisterFunction;
PFN_REQ_FNPTR g_fn_RequestFunction; PFN_REQ_FNPTR g_fn_RequestFunction;
PFN_AMX_PUSH g_fn_AmxPush;
// *** Exports *** // *** Exports ***
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
@ -2610,14 +2610,11 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
#ifdef MEMORY_TEST
// Memory // Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
#endif
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
@ -2720,7 +2717,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_IsPlayerHLTV(0); MF_IsPlayerHLTV(0);
MF_GetPlayerArmor(0); MF_GetPlayerArmor(0);
MF_GetPlayerHealth(0); MF_GetPlayerHealth(0);
MF_AmxExec(0, 0, 0); MF_AmxExec(0, 0, 0, 0);
MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0);
MF_AmxFindPublic(0, 0, 0); MF_AmxFindPublic(0, 0, 0);
MF_AmxAllot(0, 0, 0, 0); MF_AmxAllot(0, 0, 0, 0);
@ -2736,8 +2733,6 @@ void ValidateMacros_DontCallThis_Smiley()
} }
#endif #endif
#ifdef MEMORY_TEST
/************* MEMORY *************/ /************* MEMORY *************/
// undef all defined macros // undef all defined macros
#undef new #undef new
@ -2909,30 +2904,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, 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 *************/ /************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new // must come here because cbase.h declares it's own operator new

View File

@ -46,6 +46,8 @@ struct amxx_module_info_s
const char *logtag; // added in version 2 const char *logtag; // added in version 2
}; };
// return values from functions called by amxx // return values from functions called by amxx
#define AMXX_OK 0 /* no error */ #define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */ #define AMXX_IFVERS 1 /* interface version */
@ -1979,15 +1981,13 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif #endif
#ifdef MEMORY_TEST
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/); const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const void* /*addr*/ ); const unsigned int /*type*/, const void* /*addr*/ );
#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
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_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
@ -2002,7 +2002,6 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); 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_ADD_NATIVES g_fn_AddNatives;
extern PFN_BUILD_PATHNAME g_fn_BuildPathname; extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
@ -2048,6 +2047,7 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
extern PFN_AMX_EXEC g_fn_AmxExec; extern PFN_AMX_EXEC g_fn_AmxExec;
extern PFN_AMX_EXECV g_fn_AmxExecv;
extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_ALLOT g_fn_AmxAllot;
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
@ -2065,7 +2065,6 @@ extern PFN_FORMAT g_fn_Format;
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
extern PFN_REQ_FNPTR g_fn_RequestFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction;
extern PFN_AMX_PUSH g_fn_AmxPush;
#ifdef MAY_NEVER_BE_DEFINED #ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems // Function prototypes for intellisense and similar systems
@ -2124,8 +2123,6 @@ edict_t* MF_GetPlayerEdict (int id) { }
const char * MF_Format (const char *fmt, ...) { } const char * MF_Format (const char *fmt, ...) { }
void MF_RegisterFunction (void *pfn, const char *description) { } void MF_RegisterFunction (void *pfn, const char *description) { }
void * MF_RequestFunction (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 #endif // MAY_NEVER_BE_DEFINED
#define MF_AddNatives g_fn_AddNatives #define MF_AddNatives g_fn_AddNatives
@ -2190,9 +2187,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_Format g_fn_Format #define MF_Format g_fn_Format
#define MF_RegisterFunction g_fn_RegisterFunction #define MF_RegisterFunction g_fn_RegisterFunction
#define MF_RequestFunction g_fn_RequestFunction; #define MF_RequestFunction g_fn_RequestFunction;
#define MF_AmxPush g_fn_AmxPush
#ifdef MEMORY_TEST
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);
void *operator new[](size_t reportedSize); void *operator new[](size_t reportedSize);
@ -2236,6 +2231,4 @@ 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 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) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__ #endif // #ifndef __AMXXMODULE_H__

View File

@ -5,7 +5,7 @@
// Module info // Module info
#define MODULE_NAME "Engine" #define MODULE_NAME "Engine"
#define MODULE_VERSION "1.55" #define MODULE_VERSION "1.50"
#define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org" #define MODULE_URL "http://www.amxmodx.org"
#define MODULE_LOGTAG "ENGINE" #define MODULE_LOGTAG "ENGINE"

View File

@ -6,15 +6,15 @@ MM_ROOT = ../../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = gcc
NAME = fakemeta_amxx NAME = fakemeta_amxx
OBJECTS = sdk/amxxmodule.cpp dllfunc.cpp engfunc.cpp fakemeta_amxx.cpp pdata.cpp forward.cpp \ 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 \ 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 -I$(MM_ROOT) -Lzlib -I$(HLSDK)/common
@ -27,11 +27,12 @@ else
CFLAGS = $(OPT_FLAGS) CFLAGS = $(OPT_FLAGS)
endif endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
ifeq "$(AMD64)" "true" ifeq "$(AMD64)" "true"
BINARY = $(NAME)_amd64.so BINARY = $(NAME)_amd64.so
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
LINK += -lstdc++
else else
BINARY = $(NAME)_i386.so BINARY = $(NAME)_i386.so
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
@ -54,7 +55,7 @@ amd64:
fakemeta: $(OBJ_LINUX) fakemeta: $(OBJ_LINUX)
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY) $(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
debug: debug:
$(MAKE) all DEBUG=true $(MAKE) all DEBUG=true
default: all default: all

View File

@ -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); iparam1 = MDLL_ClientConnect(INDEXENT2(index),STRING(ALLOC_STRING(temp)),STRING(ALLOC_STRING(temp2)),temp3);
cRet = MF_GetAmxAddr(amx,params[6]); cRet = MF_GetAmxAddr(amx,params[6]);
MF_SetAmxString(amx,params[5],temp3,cRet[0]); MF_SetAmxString(amx,params[5],temp3,cRet[0]);
return iparam1; return 1;
case DLLFunc_ClientDisconnect: // void ) ( edict_t *pEntity ); case DLLFunc_ClientDisconnect: // void ) ( edict_t *pEntity );
cRet = MF_GetAmxAddr(amx,params[2]); cRet = MF_GetAmxAddr(amx,params[2]);
@ -228,5 +228,4 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
AMX_NATIVE_INFO dllfunc_natives[] = { AMX_NATIVE_INFO dllfunc_natives[] = {
{"dllfunc", dllfunc}, {"dllfunc", dllfunc},
{NULL, NULL}, {NULL, NULL},
}; };

View File

@ -971,5 +971,4 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
AMX_NATIVE_INFO engfunc_natives[] = { AMX_NATIVE_INFO engfunc_natives[] = {
{"engfunc", engfunc}, {"engfunc", engfunc},
{NULL, NULL}, {NULL, NULL},
}; };

View File

@ -167,11 +167,18 @@
Filter=""> Filter="">
<File <File
RelativePath=".\pev.cpp"> RelativePath=".\pev.cpp">
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCLCompilerTool"/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath=".\pev.h"> RelativePath=".\pev.h">
<FileConfiguration <FileConfiguration
Name="Debug|Win32"> Name="Debug|Win32"
ExcludedFromBuild="TRUE">
<Tool <Tool
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
</FileConfiguration> </FileConfiguration>
@ -194,19 +201,6 @@
Name="hlsdk" Name="hlsdk"
Filter=""> Filter="">
</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> </Files>
<Globals> <Globals>
</Globals> </Globals>

View File

@ -42,6 +42,7 @@ 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; } #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 engfunc_natives[];
extern AMX_NATIVE_INFO dllfunc_natives[]; extern AMX_NATIVE_INFO dllfunc_natives[];
//extern AMX_NATIVE_INFO pev_natives[];
extern AMX_NATIVE_INFO forward_natives[]; extern AMX_NATIVE_INFO forward_natives[];
extern AMX_NATIVE_INFO pdata_natives[]; extern AMX_NATIVE_INFO pdata_natives[];
extern AMX_NATIVE_INFO tr_Natives[]; extern AMX_NATIVE_INFO tr_Natives[];
@ -57,8 +58,7 @@ extern DLL_FUNCTIONS *g_pFunctionTable;
extern DLL_FUNCTIONS *g_pFunctionTable_Post; extern DLL_FUNCTIONS *g_pFunctionTable_Post;
extern enginefuncs_t *g_pengfuncsTable; extern enginefuncs_t *g_pengfuncsTable;
extern enginefuncs_t *g_pengfuncsTable_Post; extern enginefuncs_t *g_pengfuncsTable_Post;
extern NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
extern NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
#endif //_FAKEMETA_INCLUDE_H #endif //_FAKEMETA_INCLUDE_H

View File

@ -248,5 +248,4 @@ AMX_NATIVE_INFO tr_Natives[] = {
{"get_kv", get_kv}, {"get_kv", get_kv},
{"set_kv", set_kv}, {"set_kv", set_kv},
{NULL, NULL}, {NULL, NULL},
}; };

View File

@ -27,5 +27,4 @@ enum KeyValue
extern AMX_NATIVE_INFO tr_Natives[]; extern AMX_NATIVE_INFO tr_Natives[];
#endif //_INCLUDE_TR_H #endif //_INCLUDE_TR_H

View File

@ -479,15 +479,7 @@ SIMPLE_VOID_HOOK_VOID(CreateInstancedBaselines);
SIMPLE_INT_HOOK_VOID(AllowLagCompensation); 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);
@ -511,19 +503,15 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
DLL_FUNCTIONS *dlltable; DLL_FUNCTIONS *dlltable;
NEW_DLL_FUNCTIONS *newdlltable;
if (post) if (post)
{ {
engtable = g_pengfuncsTable_Post; engtable = g_pengfuncsTable_Post;
dlltable = g_pFunctionTable_Post; dlltable = g_pFunctionTable_Post;
newdlltable = g_pNewFunctionsTable_Post;
} }
else else
{ {
engtable = g_pengfuncsTable; engtable = g_pengfuncsTable;
dlltable = g_pFunctionTable; dlltable = g_pFunctionTable;
newdlltable = g_pNewFunctionsTable;
} }
switch (func) switch (func)
@ -1073,20 +1061,6 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE); fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);
DLLHOOK(AllowLagCompensation); DLLHOOK(AllowLagCompensation);
break; 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 #if 0
// I know this does not fit with DLLFUNC(), but I dont want another native just for it. // I know this does not fit with DLLFUNC(), but I dont want another native just for it.

View File

@ -1,7 +1,7 @@
#ifndef _INCLUDE_FORWARD_H #ifndef _INCLUDE_FORWARD_H
#define _INCLUDE_FORWARD_H #define _INCLUDE_FORWARD_H
#define ENGFUNC_NUM FM_LAST_DONT_USE_ME // 118 #define ENGFUNC_NUM 118
#define FMV_STRING 1 #define FMV_STRING 1
#define FMV_FLOAT 2 #define FMV_FLOAT 2
@ -150,12 +150,6 @@ enum {
FM_CreateInstancedBaselines, // done FM_CreateInstancedBaselines, // done
FM_AllowLagCompensation, // done FM_AllowLagCompensation, // done
FM_AlertMessage, FM_AlertMessage,
// NEW_DLL_FUNCTIONS
FM_OnFreeEntPrivateData,
FM_GameShutdown,
FM_ShouldCollide,
// FM_CvarValue
FM_LAST_DONT_USE_ME, FM_LAST_DONT_USE_ME,
}; };

View File

@ -742,31 +742,12 @@
RETURN_META(MRES_IGNORED); \ 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) \ #define ENGHOOK(pfnCall) \
if (post) \ if (post) \
@ -791,17 +772,6 @@
if (dlltable->pfn##pfnCall == NULL) \ if (dlltable->pfn##pfnCall == NULL) \
dlltable->pfn##pfnCall = pfnCall; \ 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) \ #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])}; \ cell vector_name##_cell[3] = {amx_ftoc(vector_name[0]), amx_ftoc(vector_name[1]), amx_ftoc(vector_name[2])}; \

View File

@ -53,77 +53,10 @@ static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params)
#endif #endif
return amx_ftoc(*((float *)INDEXENT2(index)->pvPrivateData + iOffset)); 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[] = { AMX_NATIVE_INFO pdata_natives[] = {
{ "get_pdata_int", get_pdata_int }, { "get_pdata_int", get_pdata_int },
{ "set_pdata_int", set_pdata_int }, { "set_pdata_int", set_pdata_int },
{ "get_pdata_float", get_pdata_float }, { "get_pdata_float", get_pdata_float },
{ "set_pdata_float", set_pdata_float }, { "set_pdata_float", set_pdata_float },
{ "set_pdata_string", set_pdata_string },
{ "get_pdata_string", get_pdata_string },
{ NULL, NULL } { NULL, NULL }
}; };

View File

@ -45,6 +45,8 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post; DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable; enginefuncs_t *g_pengfuncsTable;
@ -52,6 +54,7 @@ enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions // GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table = static DLL_FUNCTIONS g_EntityAPI_Table =
{ {
@ -2478,11 +2481,9 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
#ifdef MEMORY_TEST
PFN_ALLOCATOR g_fn_Allocator; PFN_ALLOCATOR g_fn_Allocator;
PFN_REALLOCATOR g_fn_Reallocator; PFN_REALLOCATOR g_fn_Reallocator;
PFN_DEALLOCATOR g_fn_Deallocator; PFN_DEALLOCATOR g_fn_Deallocator;
#endif
PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXEC g_fn_AmxExec;
PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_EXECV g_fn_AmxExecv;
PFN_AMX_ALLOT g_fn_AmxAllot; PFN_AMX_ALLOT g_fn_AmxAllot;
@ -2501,7 +2502,6 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
PFN_FORMAT g_fn_Format; PFN_FORMAT g_fn_Format;
PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REGISTERFUNCTION g_fn_RegisterFunction;
PFN_REQ_FNPTR g_fn_RequestFunction; PFN_REQ_FNPTR g_fn_RequestFunction;
PFN_AMX_PUSH g_fn_AmxPush;
// *** Exports *** // *** Exports ***
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
@ -2610,14 +2610,11 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
#ifdef MEMORY_TEST
// Memory // Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
#endif
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
@ -2720,7 +2717,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_IsPlayerHLTV(0); MF_IsPlayerHLTV(0);
MF_GetPlayerArmor(0); MF_GetPlayerArmor(0);
MF_GetPlayerHealth(0); MF_GetPlayerHealth(0);
MF_AmxExec(0, 0, 0); MF_AmxExec(0, 0, 0, 0);
MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0);
MF_AmxFindPublic(0, 0, 0); MF_AmxFindPublic(0, 0, 0);
MF_AmxAllot(0, 0, 0, 0); MF_AmxAllot(0, 0, 0, 0);
@ -2736,8 +2733,6 @@ void ValidateMacros_DontCallThis_Smiley()
} }
#endif #endif
#ifdef MEMORY_TEST
/************* MEMORY *************/ /************* MEMORY *************/
// undef all defined macros // undef all defined macros
#undef new #undef new
@ -2909,30 +2904,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, 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 *************/ /************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new // must come here because cbase.h declares it's own operator new

View File

@ -46,6 +46,8 @@ struct amxx_module_info_s
const char *logtag; // added in version 2 const char *logtag; // added in version 2
}; };
// return values from functions called by amxx // return values from functions called by amxx
#define AMXX_OK 0 /* no error */ #define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */ #define AMXX_IFVERS 1 /* interface version */
@ -1979,15 +1981,13 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif #endif
#ifdef MEMORY_TEST
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/); const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const void* /*addr*/ ); const unsigned int /*type*/, const void* /*addr*/ );
#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
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_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
@ -2002,7 +2002,6 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); 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_ADD_NATIVES g_fn_AddNatives;
extern PFN_BUILD_PATHNAME g_fn_BuildPathname; extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
@ -2048,6 +2047,7 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
extern PFN_AMX_EXEC g_fn_AmxExec; extern PFN_AMX_EXEC g_fn_AmxExec;
extern PFN_AMX_EXECV g_fn_AmxExecv;
extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_ALLOT g_fn_AmxAllot;
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
@ -2065,7 +2065,6 @@ extern PFN_FORMAT g_fn_Format;
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
extern PFN_REQ_FNPTR g_fn_RequestFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction;
extern PFN_AMX_PUSH g_fn_AmxPush;
#ifdef MAY_NEVER_BE_DEFINED #ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems // Function prototypes for intellisense and similar systems
@ -2124,8 +2123,6 @@ edict_t* MF_GetPlayerEdict (int id) { }
const char * MF_Format (const char *fmt, ...) { } const char * MF_Format (const char *fmt, ...) { }
void MF_RegisterFunction (void *pfn, const char *description) { } void MF_RegisterFunction (void *pfn, const char *description) { }
void * MF_RequestFunction (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 #endif // MAY_NEVER_BE_DEFINED
#define MF_AddNatives g_fn_AddNatives #define MF_AddNatives g_fn_AddNatives
@ -2190,9 +2187,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_Format g_fn_Format #define MF_Format g_fn_Format
#define MF_RegisterFunction g_fn_RegisterFunction #define MF_RegisterFunction g_fn_RegisterFunction
#define MF_RequestFunction g_fn_RequestFunction; #define MF_RequestFunction g_fn_RequestFunction;
#define MF_AmxPush g_fn_AmxPush
#ifdef MEMORY_TEST
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);
void *operator new[](size_t reportedSize); void *operator new[](size_t reportedSize);
@ -2236,6 +2231,4 @@ 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 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) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__ #endif // #ifndef __AMXXMODULE_H__

View File

@ -5,7 +5,7 @@
// Module info // Module info
#define MODULE_NAME "FakeMeta" #define MODULE_NAME "FakeMeta"
#define MODULE_VERSION "1.55" #define MODULE_VERSION "1.50"
#define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org" #define MODULE_URL "http://www.amxmodx.org"
#define MODULE_LOGTAG "FAKEMETA" #define MODULE_LOGTAG "FAKEMETA"

View File

@ -6,7 +6,7 @@ MM_ROOT = ../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fomit-frame-pointer OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = gcc
NAME = fun_amxx NAME = fun_amxx
@ -26,11 +26,12 @@ else
CFLAGS = $(OPT_FLAGS) CFLAGS = $(OPT_FLAGS)
endif endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
ifeq "$(AMD64)" "true" ifeq "$(AMD64)" "true"
BINARY = $(NAME)_amd64.so BINARY = $(NAME)_amd64.so
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
LINK += -lstdc++
else else
BINARY = $(NAME)_i386.so BINARY = $(NAME)_i386.so
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32

View File

@ -45,6 +45,8 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post; DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable; enginefuncs_t *g_pengfuncsTable;
@ -52,6 +54,7 @@ enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions // GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table = static DLL_FUNCTIONS g_EntityAPI_Table =
{ {
@ -2478,11 +2481,9 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
#ifdef MEMORY_TEST
PFN_ALLOCATOR g_fn_Allocator; PFN_ALLOCATOR g_fn_Allocator;
PFN_REALLOCATOR g_fn_Reallocator; PFN_REALLOCATOR g_fn_Reallocator;
PFN_DEALLOCATOR g_fn_Deallocator; PFN_DEALLOCATOR g_fn_Deallocator;
#endif
PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXEC g_fn_AmxExec;
PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_EXECV g_fn_AmxExecv;
PFN_AMX_ALLOT g_fn_AmxAllot; PFN_AMX_ALLOT g_fn_AmxAllot;
@ -2501,7 +2502,6 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
PFN_FORMAT g_fn_Format; PFN_FORMAT g_fn_Format;
PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REGISTERFUNCTION g_fn_RegisterFunction;
PFN_REQ_FNPTR g_fn_RequestFunction; PFN_REQ_FNPTR g_fn_RequestFunction;
PFN_AMX_PUSH g_fn_AmxPush;
// *** Exports *** // *** Exports ***
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
@ -2610,14 +2610,11 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
#ifdef MEMORY_TEST
// Memory // Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
#endif
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
@ -2720,7 +2717,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_IsPlayerHLTV(0); MF_IsPlayerHLTV(0);
MF_GetPlayerArmor(0); MF_GetPlayerArmor(0);
MF_GetPlayerHealth(0); MF_GetPlayerHealth(0);
MF_AmxExec(0, 0, 0); MF_AmxExec(0, 0, 0, 0);
MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0);
MF_AmxFindPublic(0, 0, 0); MF_AmxFindPublic(0, 0, 0);
MF_AmxAllot(0, 0, 0, 0); MF_AmxAllot(0, 0, 0, 0);
@ -2736,8 +2733,6 @@ void ValidateMacros_DontCallThis_Smiley()
} }
#endif #endif
#ifdef MEMORY_TEST
/************* MEMORY *************/ /************* MEMORY *************/
// undef all defined macros // undef all defined macros
#undef new #undef new
@ -2909,30 +2904,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, 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 *************/ /************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new // must come here because cbase.h declares it's own operator new

View File

@ -46,6 +46,8 @@ struct amxx_module_info_s
const char *logtag; // added in version 2 const char *logtag; // added in version 2
}; };
// return values from functions called by amxx // return values from functions called by amxx
#define AMXX_OK 0 /* no error */ #define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */ #define AMXX_IFVERS 1 /* interface version */
@ -1979,15 +1981,13 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif #endif
#ifdef MEMORY_TEST
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/); const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const void* /*addr*/ ); const unsigned int /*type*/, const void* /*addr*/ );
#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
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_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
@ -2002,7 +2002,6 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); 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_ADD_NATIVES g_fn_AddNatives;
extern PFN_BUILD_PATHNAME g_fn_BuildPathname; extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
@ -2048,6 +2047,7 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
extern PFN_AMX_EXEC g_fn_AmxExec; extern PFN_AMX_EXEC g_fn_AmxExec;
extern PFN_AMX_EXECV g_fn_AmxExecv;
extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_ALLOT g_fn_AmxAllot;
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
@ -2065,7 +2065,6 @@ extern PFN_FORMAT g_fn_Format;
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
extern PFN_REQ_FNPTR g_fn_RequestFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction;
extern PFN_AMX_PUSH g_fn_AmxPush;
#ifdef MAY_NEVER_BE_DEFINED #ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems // Function prototypes for intellisense and similar systems
@ -2124,8 +2123,6 @@ edict_t* MF_GetPlayerEdict (int id) { }
const char * MF_Format (const char *fmt, ...) { } const char * MF_Format (const char *fmt, ...) { }
void MF_RegisterFunction (void *pfn, const char *description) { } void MF_RegisterFunction (void *pfn, const char *description) { }
void * MF_RequestFunction (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 #endif // MAY_NEVER_BE_DEFINED
#define MF_AddNatives g_fn_AddNatives #define MF_AddNatives g_fn_AddNatives
@ -2190,9 +2187,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_Format g_fn_Format #define MF_Format g_fn_Format
#define MF_RegisterFunction g_fn_RegisterFunction #define MF_RegisterFunction g_fn_RegisterFunction
#define MF_RequestFunction g_fn_RequestFunction; #define MF_RequestFunction g_fn_RequestFunction;
#define MF_AmxPush g_fn_AmxPush
#ifdef MEMORY_TEST
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);
void *operator new[](size_t reportedSize); void *operator new[](size_t reportedSize);
@ -2236,6 +2231,4 @@ 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 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) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__ #endif // #ifndef __AMXXMODULE_H__

View File

@ -61,7 +61,6 @@
// ######## Utils: // ######## Utils:
void FUNUTIL_ResetPlayer(int index) 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++) { for (int i = 1; i <= gpGlobals->maxClients; i++) {
g_bodyhits[index][i] = (1<<HITGROUP_GENERIC) | g_bodyhits[index][i] = (1<<HITGROUP_GENERIC) |
(1<<HITGROUP_HEAD) | (1<<HITGROUP_HEAD) |
@ -655,17 +654,14 @@ void TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *shoot
void OnAmxxAttach() void OnAmxxAttach()
{ {
MF_AddNatives(fun_Exports); 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 // Reset stuff - hopefully this should
for (int i = 1; i <= gpGlobals->maxClients; i++) { for (int i = 1; i <= gpGlobals->maxClients; i++) {
// Reset all hitzones // Reset all hitzones
FUNUTIL_ResetPlayer(i); FUNUTIL_ResetPlayer(i);
} }
} }
/* /*
void ClientConnectFakeBot(int index) void ClientConnectFakeBot(int index)
{ {

View File

@ -5,7 +5,7 @@
// Module info // Module info
#define MODULE_NAME "Fun" #define MODULE_NAME "Fun"
#define MODULE_VERSION "1.55" #define MODULE_VERSION "1.50"
#define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org" #define MODULE_URL "http://www.amxmodx.org"
#define MODULE_LOGTAG "FUN" #define MODULE_LOGTAG "FUN"
@ -32,7 +32,7 @@
//#define FN_AMXX_DETTACH OnAmxxDettach //#define FN_AMXX_DETTACH OnAmxxDettach
// All plugins loaded // All plugins loaded
// Do forward functions init here (MF_RegisterForward) // Do forward functions init here (MF_RegisterForward)
#define FN_AMXX_PLUGINSLOADED OnPluginsLoaded // #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded
/**** METAMOD ****/ /**** METAMOD ****/
// If your module doesn't use metamod, you may close the file now :) // If your module doesn't use metamod, you may close the file now :)
@ -460,4 +460,3 @@
#endif // USE_METAMOD #endif // USE_METAMOD
#endif // __MODULECONFIG_H__ #endif // __MODULECONFIG_H__

Binary file not shown.

View File

@ -6,7 +6,7 @@ MM_ROOT = ../../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = gcc
NAME = geoip_amxx NAME = geoip_amxx
@ -26,11 +26,12 @@ else
CFLAGS = $(OPT_FLAGS) CFLAGS = $(OPT_FLAGS)
endif endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
ifeq "$(AMD64)" "true" ifeq "$(AMD64)" "true"
BINARY = $(NAME)_amd64.so BINARY = $(NAME)_amd64.so
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
LINK += -lstdc++
else else
BINARY = $(NAME)_i386.so BINARY = $(NAME)_i386.so
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32

View File

@ -45,6 +45,8 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post; DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable; enginefuncs_t *g_pengfuncsTable;
@ -52,6 +54,7 @@ enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions // GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table = static DLL_FUNCTIONS g_EntityAPI_Table =
{ {
@ -2478,11 +2481,9 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
#ifdef MEMORY_TEST
PFN_ALLOCATOR g_fn_Allocator; PFN_ALLOCATOR g_fn_Allocator;
PFN_REALLOCATOR g_fn_Reallocator; PFN_REALLOCATOR g_fn_Reallocator;
PFN_DEALLOCATOR g_fn_Deallocator; PFN_DEALLOCATOR g_fn_Deallocator;
#endif
PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXEC g_fn_AmxExec;
PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_EXECV g_fn_AmxExecv;
PFN_AMX_ALLOT g_fn_AmxAllot; PFN_AMX_ALLOT g_fn_AmxAllot;
@ -2501,7 +2502,6 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
PFN_FORMAT g_fn_Format; PFN_FORMAT g_fn_Format;
PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REGISTERFUNCTION g_fn_RegisterFunction;
PFN_REQ_FNPTR g_fn_RequestFunction; PFN_REQ_FNPTR g_fn_RequestFunction;
PFN_AMX_PUSH g_fn_AmxPush;
// *** Exports *** // *** Exports ***
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
@ -2610,14 +2610,11 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
#ifdef MEMORY_TEST
// Memory // Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
#endif
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
@ -2720,7 +2717,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_IsPlayerHLTV(0); MF_IsPlayerHLTV(0);
MF_GetPlayerArmor(0); MF_GetPlayerArmor(0);
MF_GetPlayerHealth(0); MF_GetPlayerHealth(0);
MF_AmxExec(0, 0, 0); MF_AmxExec(0, 0, 0, 0);
MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0);
MF_AmxFindPublic(0, 0, 0); MF_AmxFindPublic(0, 0, 0);
MF_AmxAllot(0, 0, 0, 0); MF_AmxAllot(0, 0, 0, 0);
@ -2736,8 +2733,6 @@ void ValidateMacros_DontCallThis_Smiley()
} }
#endif #endif
#ifdef MEMORY_TEST
/************* MEMORY *************/ /************* MEMORY *************/
// undef all defined macros // undef all defined macros
#undef new #undef new
@ -2909,30 +2904,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, 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 *************/ /************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new // must come here because cbase.h declares it's own operator new

View File

@ -46,6 +46,8 @@ struct amxx_module_info_s
const char *logtag; // added in version 2 const char *logtag; // added in version 2
}; };
// return values from functions called by amxx // return values from functions called by amxx
#define AMXX_OK 0 /* no error */ #define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */ #define AMXX_IFVERS 1 /* interface version */
@ -1979,15 +1981,13 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif #endif
#ifdef MEMORY_TEST
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/); const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const void* /*addr*/ ); const unsigned int /*type*/, const void* /*addr*/ );
#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
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_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
@ -2002,7 +2002,6 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); 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_ADD_NATIVES g_fn_AddNatives;
extern PFN_BUILD_PATHNAME g_fn_BuildPathname; extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
@ -2048,6 +2047,7 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
extern PFN_AMX_EXEC g_fn_AmxExec; extern PFN_AMX_EXEC g_fn_AmxExec;
extern PFN_AMX_EXECV g_fn_AmxExecv;
extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_ALLOT g_fn_AmxAllot;
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
@ -2065,7 +2065,6 @@ extern PFN_FORMAT g_fn_Format;
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
extern PFN_REQ_FNPTR g_fn_RequestFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction;
extern PFN_AMX_PUSH g_fn_AmxPush;
#ifdef MAY_NEVER_BE_DEFINED #ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems // Function prototypes for intellisense and similar systems
@ -2124,8 +2123,6 @@ edict_t* MF_GetPlayerEdict (int id) { }
const char * MF_Format (const char *fmt, ...) { } const char * MF_Format (const char *fmt, ...) { }
void MF_RegisterFunction (void *pfn, const char *description) { } void MF_RegisterFunction (void *pfn, const char *description) { }
void * MF_RequestFunction (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 #endif // MAY_NEVER_BE_DEFINED
#define MF_AddNatives g_fn_AddNatives #define MF_AddNatives g_fn_AddNatives
@ -2190,9 +2187,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_Format g_fn_Format #define MF_Format g_fn_Format
#define MF_RegisterFunction g_fn_RegisterFunction #define MF_RegisterFunction g_fn_RegisterFunction
#define MF_RequestFunction g_fn_RequestFunction; #define MF_RequestFunction g_fn_RequestFunction;
#define MF_AmxPush g_fn_AmxPush
#ifdef MEMORY_TEST
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);
void *operator new[](size_t reportedSize); void *operator new[](size_t reportedSize);
@ -2236,6 +2231,4 @@ 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 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) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__ #endif // #ifndef __AMXXMODULE_H__

View File

@ -5,7 +5,7 @@
// Module info // Module info
#define MODULE_NAME "GeoIP" #define MODULE_NAME "GeoIP"
#define MODULE_VERSION "1.55" #define MODULE_VERSION "1.50"
#define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org/" #define MODULE_URL "http://www.amxmodx.org/"
#define MODULE_LOGTAG "GEOIP" #define MODULE_LOGTAG "GEOIP"

View File

@ -45,6 +45,8 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post; DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable; enginefuncs_t *g_pengfuncsTable;
@ -52,6 +54,7 @@ enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions // GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table = static DLL_FUNCTIONS g_EntityAPI_Table =
{ {
@ -2478,11 +2481,9 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
#ifdef MEMORY_TEST
PFN_ALLOCATOR g_fn_Allocator; PFN_ALLOCATOR g_fn_Allocator;
PFN_REALLOCATOR g_fn_Reallocator; PFN_REALLOCATOR g_fn_Reallocator;
PFN_DEALLOCATOR g_fn_Deallocator; PFN_DEALLOCATOR g_fn_Deallocator;
#endif
PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXEC g_fn_AmxExec;
PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_EXECV g_fn_AmxExecv;
PFN_AMX_ALLOT g_fn_AmxAllot; PFN_AMX_ALLOT g_fn_AmxAllot;
@ -2501,7 +2502,6 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
PFN_FORMAT g_fn_Format; PFN_FORMAT g_fn_Format;
PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REGISTERFUNCTION g_fn_RegisterFunction;
PFN_REQ_FNPTR g_fn_RequestFunction; PFN_REQ_FNPTR g_fn_RequestFunction;
PFN_AMX_PUSH g_fn_AmxPush;
// *** Exports *** // *** Exports ***
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
@ -2610,14 +2610,11 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
#ifdef MEMORY_TEST
// Memory // Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
#endif
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
@ -2720,7 +2717,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_IsPlayerHLTV(0); MF_IsPlayerHLTV(0);
MF_GetPlayerArmor(0); MF_GetPlayerArmor(0);
MF_GetPlayerHealth(0); MF_GetPlayerHealth(0);
MF_AmxExec(0, 0, 0); MF_AmxExec(0, 0, 0, 0);
MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0);
MF_AmxFindPublic(0, 0, 0); MF_AmxFindPublic(0, 0, 0);
MF_AmxAllot(0, 0, 0, 0); MF_AmxAllot(0, 0, 0, 0);
@ -2736,8 +2733,6 @@ void ValidateMacros_DontCallThis_Smiley()
} }
#endif #endif
#ifdef MEMORY_TEST
/************* MEMORY *************/ /************* MEMORY *************/
// undef all defined macros // undef all defined macros
#undef new #undef new
@ -2909,30 +2904,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, 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 *************/ /************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new // must come here because cbase.h declares it's own operator new

View File

@ -46,6 +46,8 @@ struct amxx_module_info_s
const char *logtag; // added in version 2 const char *logtag; // added in version 2
}; };
// return values from functions called by amxx // return values from functions called by amxx
#define AMXX_OK 0 /* no error */ #define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */ #define AMXX_IFVERS 1 /* interface version */
@ -1979,15 +1981,13 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif #endif
#ifdef MEMORY_TEST
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/); const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const void* /*addr*/ ); const unsigned int /*type*/, const void* /*addr*/ );
#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
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_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
@ -2002,7 +2002,6 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); 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_ADD_NATIVES g_fn_AddNatives;
extern PFN_BUILD_PATHNAME g_fn_BuildPathname; extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
@ -2048,6 +2047,7 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
extern PFN_AMX_EXEC g_fn_AmxExec; extern PFN_AMX_EXEC g_fn_AmxExec;
extern PFN_AMX_EXECV g_fn_AmxExecv;
extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_ALLOT g_fn_AmxAllot;
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
@ -2065,7 +2065,6 @@ extern PFN_FORMAT g_fn_Format;
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
extern PFN_REQ_FNPTR g_fn_RequestFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction;
extern PFN_AMX_PUSH g_fn_AmxPush;
#ifdef MAY_NEVER_BE_DEFINED #ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems // Function prototypes for intellisense and similar systems
@ -2124,8 +2123,6 @@ edict_t* MF_GetPlayerEdict (int id) { }
const char * MF_Format (const char *fmt, ...) { } const char * MF_Format (const char *fmt, ...) { }
void MF_RegisterFunction (void *pfn, const char *description) { } void MF_RegisterFunction (void *pfn, const char *description) { }
void * MF_RequestFunction (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 #endif // MAY_NEVER_BE_DEFINED
#define MF_AddNatives g_fn_AddNatives #define MF_AddNatives g_fn_AddNatives
@ -2190,9 +2187,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_Format g_fn_Format #define MF_Format g_fn_Format
#define MF_RegisterFunction g_fn_RegisterFunction #define MF_RegisterFunction g_fn_RegisterFunction
#define MF_RequestFunction g_fn_RequestFunction; #define MF_RequestFunction g_fn_RequestFunction;
#define MF_AmxPush g_fn_AmxPush
#ifdef MEMORY_TEST
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);
void *operator new[](size_t reportedSize); void *operator new[](size_t reportedSize);
@ -2236,6 +2231,4 @@ 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 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) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__ #endif // #ifndef __AMXXMODULE_H__

View File

@ -5,7 +5,7 @@
// Module info // Module info
#define MODULE_NAME "MSSQL" #define MODULE_NAME "MSSQL"
#define MODULE_VERSION "1.55" #define MODULE_VERSION "1.50"
#define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org/" #define MODULE_URL "http://www.amxmodx.org/"
#define MODULE_LOGTAG "MSSQL" #define MODULE_LOGTAG "MSSQL"

View File

@ -6,7 +6,7 @@ MM_ROOT = ../../../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = gcc
NAME = ns_amxx NAME = ns_amxx
@ -26,11 +26,12 @@ else
CFLAGS = $(OPT_FLAGS) CFLAGS = $(OPT_FLAGS)
endif endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
ifeq "$(AMD64)" "true" ifeq "$(AMD64)" "true"
BINARY = $(NAME)_amd64.so BINARY = $(NAME)_amd64.so
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
LINK += -lstdc++
else else
BINARY = $(NAME)_i386.so BINARY = $(NAME)_i386.so
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32

View File

@ -45,6 +45,8 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post; DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable; enginefuncs_t *g_pengfuncsTable;
@ -52,6 +54,7 @@ enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions // GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table = static DLL_FUNCTIONS g_EntityAPI_Table =
{ {
@ -2478,11 +2481,9 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
#ifdef MEMORY_TEST
PFN_ALLOCATOR g_fn_Allocator; PFN_ALLOCATOR g_fn_Allocator;
PFN_REALLOCATOR g_fn_Reallocator; PFN_REALLOCATOR g_fn_Reallocator;
PFN_DEALLOCATOR g_fn_Deallocator; PFN_DEALLOCATOR g_fn_Deallocator;
#endif
PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXEC g_fn_AmxExec;
PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_EXECV g_fn_AmxExecv;
PFN_AMX_ALLOT g_fn_AmxAllot; PFN_AMX_ALLOT g_fn_AmxAllot;
@ -2501,7 +2502,6 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
PFN_FORMAT g_fn_Format; PFN_FORMAT g_fn_Format;
PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REGISTERFUNCTION g_fn_RegisterFunction;
PFN_REQ_FNPTR g_fn_RequestFunction; PFN_REQ_FNPTR g_fn_RequestFunction;
PFN_AMX_PUSH g_fn_AmxPush;
// *** Exports *** // *** Exports ***
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
@ -2610,14 +2610,11 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
#ifdef MEMORY_TEST
// Memory // Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
#endif
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
@ -2720,7 +2717,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_IsPlayerHLTV(0); MF_IsPlayerHLTV(0);
MF_GetPlayerArmor(0); MF_GetPlayerArmor(0);
MF_GetPlayerHealth(0); MF_GetPlayerHealth(0);
MF_AmxExec(0, 0, 0); MF_AmxExec(0, 0, 0, 0);
MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0);
MF_AmxFindPublic(0, 0, 0); MF_AmxFindPublic(0, 0, 0);
MF_AmxAllot(0, 0, 0, 0); MF_AmxAllot(0, 0, 0, 0);
@ -2736,8 +2733,6 @@ void ValidateMacros_DontCallThis_Smiley()
} }
#endif #endif
#ifdef MEMORY_TEST
/************* MEMORY *************/ /************* MEMORY *************/
// undef all defined macros // undef all defined macros
#undef new #undef new
@ -2909,30 +2904,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, 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 *************/ /************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new // must come here because cbase.h declares it's own operator new

View File

@ -46,6 +46,8 @@ struct amxx_module_info_s
const char *logtag; // added in version 2 const char *logtag; // added in version 2
}; };
// return values from functions called by amxx // return values from functions called by amxx
#define AMXX_OK 0 /* no error */ #define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */ #define AMXX_IFVERS 1 /* interface version */
@ -1979,15 +1981,13 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif #endif
#ifdef MEMORY_TEST
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/); const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const void* /*addr*/ ); const unsigned int /*type*/, const void* /*addr*/ );
#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
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_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
@ -2002,7 +2002,6 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); 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_ADD_NATIVES g_fn_AddNatives;
extern PFN_BUILD_PATHNAME g_fn_BuildPathname; extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
@ -2048,6 +2047,7 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
extern PFN_AMX_EXEC g_fn_AmxExec; extern PFN_AMX_EXEC g_fn_AmxExec;
extern PFN_AMX_EXECV g_fn_AmxExecv;
extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_ALLOT g_fn_AmxAllot;
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
@ -2065,7 +2065,6 @@ extern PFN_FORMAT g_fn_Format;
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
extern PFN_REQ_FNPTR g_fn_RequestFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction;
extern PFN_AMX_PUSH g_fn_AmxPush;
#ifdef MAY_NEVER_BE_DEFINED #ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems // Function prototypes for intellisense and similar systems
@ -2124,8 +2123,6 @@ edict_t* MF_GetPlayerEdict (int id) { }
const char * MF_Format (const char *fmt, ...) { } const char * MF_Format (const char *fmt, ...) { }
void MF_RegisterFunction (void *pfn, const char *description) { } void MF_RegisterFunction (void *pfn, const char *description) { }
void * MF_RequestFunction (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 #endif // MAY_NEVER_BE_DEFINED
#define MF_AddNatives g_fn_AddNatives #define MF_AddNatives g_fn_AddNatives
@ -2190,9 +2187,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_Format g_fn_Format #define MF_Format g_fn_Format
#define MF_RegisterFunction g_fn_RegisterFunction #define MF_RegisterFunction g_fn_RegisterFunction
#define MF_RequestFunction g_fn_RequestFunction; #define MF_RequestFunction g_fn_RequestFunction;
#define MF_AmxPush g_fn_AmxPush
#ifdef MEMORY_TEST
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);
void *operator new[](size_t reportedSize); void *operator new[](size_t reportedSize);
@ -2236,6 +2231,4 @@ 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 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) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__ #endif // #ifndef __AMXXMODULE_H__

View File

@ -4,7 +4,7 @@
// Module info // Module info
#define MODULE_NAME "NS" #define MODULE_NAME "NS"
#define MODULE_VERSION "1.55" #define MODULE_VERSION "1.50"
#define MODULE_AUTHOR "Steve Dudenhoeffer" #define MODULE_AUTHOR "Steve Dudenhoeffer"
#define MODULE_URL "http://www.amxmodx.org/" #define MODULE_URL "http://www.amxmodx.org/"
#define MODULE_LOGTAG "NS" #define MODULE_LOGTAG "NS"

View File

@ -6,7 +6,7 @@ MM_ROOT = ../../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = gcc
NAME = nvault_amxx NAME = nvault_amxx
@ -26,17 +26,16 @@ else
CFLAGS = $(OPT_FLAGS) CFLAGS = $(OPT_FLAGS)
endif endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fexceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fexceptions -DHAVE_STDINT_H
ifeq "$(AMD64)" "true" ifeq "$(AMD64)" "true"
BINARY = $(NAME)_amd64.so BINARY = $(NAME)_amd64.so
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
LINK += /lib/libgcc_eh.a /lib/libstdc++.a LINK += -lstdc++
else else
BINARY = $(NAME)_i386.so BINARY = $(NAME)_i386.so
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
OPT_FLAGS += -march=i686 OPT_FLAGS += -march=i686
LINK += /lib/libgcc_eh.a /lib/libstdc++.a
endif endif
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o) OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)

View File

@ -45,6 +45,8 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post; DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable; enginefuncs_t *g_pengfuncsTable;
@ -52,6 +54,7 @@ enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions // GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table = static DLL_FUNCTIONS g_EntityAPI_Table =
{ {
@ -2478,11 +2481,9 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
#ifdef MEMORY_TEST
PFN_ALLOCATOR g_fn_Allocator; PFN_ALLOCATOR g_fn_Allocator;
PFN_REALLOCATOR g_fn_Reallocator; PFN_REALLOCATOR g_fn_Reallocator;
PFN_DEALLOCATOR g_fn_Deallocator; PFN_DEALLOCATOR g_fn_Deallocator;
#endif
PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXEC g_fn_AmxExec;
PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_EXECV g_fn_AmxExecv;
PFN_AMX_ALLOT g_fn_AmxAllot; PFN_AMX_ALLOT g_fn_AmxAllot;
@ -2612,12 +2613,10 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
#ifdef MEMORY_TEST
// Memory // Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
#endif
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
@ -2736,8 +2735,6 @@ void ValidateMacros_DontCallThis_Smiley()
} }
#endif #endif
#ifdef MEMORY_TEST
/************* MEMORY *************/ /************* MEMORY *************/
// undef all defined macros // undef all defined macros
#undef new #undef new
@ -2909,30 +2906,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, 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 *************/ /************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new // must come here because cbase.h declares it's own operator new

View File

@ -46,6 +46,8 @@ struct amxx_module_info_s
const char *logtag; // added in version 2 const char *logtag; // added in version 2
}; };
// return values from functions called by amxx // return values from functions called by amxx
#define AMXX_OK 0 /* no error */ #define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */ #define AMXX_IFVERS 1 /* interface version */
@ -1979,14 +1981,12 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif #endif
#ifdef MEMORY_TEST
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/); const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const void* /*addr*/ ); const unsigned int /*type*/, const void* /*addr*/ );
#endif
typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/); 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_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
@ -2048,6 +2048,7 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
extern PFN_AMX_EXEC g_fn_AmxExec; extern PFN_AMX_EXEC g_fn_AmxExec;
extern PFN_AMX_EXECV g_fn_AmxExecv;
extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_ALLOT g_fn_AmxAllot;
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
@ -2192,7 +2193,6 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_RequestFunction g_fn_RequestFunction; #define MF_RequestFunction g_fn_RequestFunction;
#define MF_AmxPush g_fn_AmxPush #define MF_AmxPush g_fn_AmxPush
#ifdef MEMORY_TEST
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);
void *operator new[](size_t reportedSize); void *operator new[](size_t reportedSize);
@ -2236,6 +2236,4 @@ 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 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) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__ #endif // #ifndef __AMXXMODULE_H__

View File

@ -5,7 +5,7 @@
// Module info // Module info
#define MODULE_NAME "nVault" #define MODULE_NAME "nVault"
#define MODULE_VERSION "1.55" #define MODULE_VERSION "1.50"
#define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org/" #define MODULE_URL "http://www.amxmodx.org/"
#define MODULE_LOGTAG "nVault" #define MODULE_LOGTAG "nVault"

View File

@ -6,7 +6,7 @@ MM_ROOT = ../../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = gcc
NAME = regex_amxx NAME = regex_amxx
@ -26,11 +26,12 @@ else
CFLAGS = $(OPT_FLAGS) CFLAGS = $(OPT_FLAGS)
endif endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
ifeq "$(AMD64)" "true" ifeq "$(AMD64)" "true"
BINARY = $(NAME)_amd64.so BINARY = $(NAME)_amd64.so
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
LINK += -lstdc++
INCLUDE += -Llib_linux64 INCLUDE += -Llib_linux64
else else
BINARY = $(NAME)_i386.so BINARY = $(NAME)_i386.so

View File

@ -45,6 +45,8 @@
enginefuncs_t g_engfuncs; enginefuncs_t g_engfuncs;
globalvars_t *gpGlobals; globalvars_t *gpGlobals;
DLL_FUNCTIONS *g_pFunctionTable; DLL_FUNCTIONS *g_pFunctionTable;
DLL_FUNCTIONS *g_pFunctionTable_Post; DLL_FUNCTIONS *g_pFunctionTable_Post;
enginefuncs_t *g_pengfuncsTable; enginefuncs_t *g_pengfuncsTable;
@ -52,6 +54,7 @@ enginefuncs_t *g_pengfuncsTable_Post;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post; NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
// GetEntityAPI2 functions // GetEntityAPI2 functions
static DLL_FUNCTIONS g_EntityAPI_Table = static DLL_FUNCTIONS g_EntityAPI_Table =
{ {
@ -2478,11 +2481,9 @@ PFN_IS_PLAYER_CONNECTING g_fn_IsPlayerConnecting;
PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV; PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
#ifdef MEMORY_TEST
PFN_ALLOCATOR g_fn_Allocator; PFN_ALLOCATOR g_fn_Allocator;
PFN_REALLOCATOR g_fn_Reallocator; PFN_REALLOCATOR g_fn_Reallocator;
PFN_DEALLOCATOR g_fn_Deallocator; PFN_DEALLOCATOR g_fn_Deallocator;
#endif
PFN_AMX_EXEC g_fn_AmxExec; PFN_AMX_EXEC g_fn_AmxExec;
PFN_AMX_EXECV g_fn_AmxExecv; PFN_AMX_EXECV g_fn_AmxExecv;
PFN_AMX_ALLOT g_fn_AmxAllot; PFN_AMX_ALLOT g_fn_AmxAllot;
@ -2501,7 +2502,6 @@ PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
PFN_FORMAT g_fn_Format; PFN_FORMAT g_fn_Format;
PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REGISTERFUNCTION g_fn_RegisterFunction;
PFN_REQ_FNPTR g_fn_RequestFunction; PFN_REQ_FNPTR g_fn_RequestFunction;
PFN_AMX_PUSH g_fn_AmxPush;
// *** Exports *** // *** Exports ***
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
@ -2610,14 +2610,11 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH); REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
#ifdef MEMORY_TEST
// Memory // Memory
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR); REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR); REQFUNC_OPT("Reallocator", g_fn_Reallocator, PFN_REALLOCATOR);
REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR); REQFUNC_OPT("Deallocator", g_fn_Deallocator, PFN_DEALLOCATOR);
#endif
REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL); REQFUNC("CellToReal", g_fn_CellToReal, PFN_CELL_TO_REAL);
REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL); REQFUNC("RealToCell", g_fn_RealToCell, PFN_REAL_TO_CELL);
@ -2720,7 +2717,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_IsPlayerHLTV(0); MF_IsPlayerHLTV(0);
MF_GetPlayerArmor(0); MF_GetPlayerArmor(0);
MF_GetPlayerHealth(0); MF_GetPlayerHealth(0);
MF_AmxExec(0, 0, 0); MF_AmxExec(0, 0, 0, 0);
MF_AmxExecv(0, 0, 0, 0, 0); MF_AmxExecv(0, 0, 0, 0, 0);
MF_AmxFindPublic(0, 0, 0); MF_AmxFindPublic(0, 0, 0);
MF_AmxAllot(0, 0, 0, 0); MF_AmxAllot(0, 0, 0, 0);
@ -2736,8 +2733,6 @@ void ValidateMacros_DontCallThis_Smiley()
} }
#endif #endif
#ifdef MEMORY_TEST
/************* MEMORY *************/ /************* MEMORY *************/
// undef all defined macros // undef all defined macros
#undef new #undef new
@ -2909,30 +2904,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, 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 *************/ /************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new // must come here because cbase.h declares it's own operator new

View File

@ -46,6 +46,8 @@ struct amxx_module_info_s
const char *logtag; // added in version 2 const char *logtag; // added in version 2
}; };
// return values from functions called by amxx // return values from functions called by amxx
#define AMXX_OK 0 /* no error */ #define AMXX_OK 0 /* no error */
#define AMXX_IFVERS 1 /* interface version */ #define AMXX_IFVERS 1 /* interface version */
@ -1979,15 +1981,13 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/); typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
#endif #endif
#ifdef MEMORY_TEST
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/); const unsigned int /*type*/, const size_t /*size*/);
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ ); const unsigned int /*type*/, const size_t /*size*/, void* /*addr*/ );
typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/, typedef void (*PFN_DEALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
const unsigned int /*type*/, const void* /*addr*/ ); const unsigned int /*type*/, const void* /*addr*/ );
#endif typedef int (*PFN_AMX_EXEC) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, ... /*params*/);
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_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/);
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/); typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/); typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
@ -2002,7 +2002,6 @@ typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); 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_ADD_NATIVES g_fn_AddNatives;
extern PFN_BUILD_PATHNAME g_fn_BuildPathname; extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
@ -2048,6 +2047,7 @@ extern PFN_IS_PLAYER_HLTV g_fn_IsPlayerHLTV;
extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor; extern PFN_GET_PLAYER_ARMOR g_fn_GetPlayerArmor;
extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth; extern PFN_GET_PLAYER_HEALTH g_fn_GetPlayerHealth;
extern PFN_AMX_EXEC g_fn_AmxExec; extern PFN_AMX_EXEC g_fn_AmxExec;
extern PFN_AMX_EXECV g_fn_AmxExecv;
extern PFN_AMX_ALLOT g_fn_AmxAllot; extern PFN_AMX_ALLOT g_fn_AmxAllot;
extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic; extern PFN_AMX_FINDPUBLIC g_fn_AmxFindPublic;
extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript; extern PFN_LOAD_AMXSCRIPT g_fn_LoadAmxScript;
@ -2065,7 +2065,6 @@ extern PFN_FORMAT g_fn_Format;
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
extern PFN_REQ_FNPTR g_fn_RequestFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction;
extern PFN_AMX_PUSH g_fn_AmxPush;
#ifdef MAY_NEVER_BE_DEFINED #ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems // Function prototypes for intellisense and similar systems
@ -2124,8 +2123,6 @@ edict_t* MF_GetPlayerEdict (int id) { }
const char * MF_Format (const char *fmt, ...) { } const char * MF_Format (const char *fmt, ...) { }
void MF_RegisterFunction (void *pfn, const char *description) { } void MF_RegisterFunction (void *pfn, const char *description) { }
void * MF_RequestFunction (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 #endif // MAY_NEVER_BE_DEFINED
#define MF_AddNatives g_fn_AddNatives #define MF_AddNatives g_fn_AddNatives
@ -2190,9 +2187,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_Format g_fn_Format #define MF_Format g_fn_Format
#define MF_RegisterFunction g_fn_RegisterFunction #define MF_RegisterFunction g_fn_RegisterFunction
#define MF_RequestFunction g_fn_RequestFunction; #define MF_RequestFunction g_fn_RequestFunction;
#define MF_AmxPush g_fn_AmxPush
#ifdef MEMORY_TEST
/*** Memory ***/ /*** Memory ***/
void *operator new(size_t reportedSize); void *operator new(size_t reportedSize);
void *operator new[](size_t reportedSize); void *operator new[](size_t reportedSize);
@ -2236,6 +2231,4 @@ 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 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) #define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__ #endif // #ifndef __AMXXMODULE_H__

View File

@ -5,7 +5,7 @@
// Module info // Module info
#define MODULE_NAME "RegEx" #define MODULE_NAME "RegEx"
#define MODULE_VERSION "1.55" #define MODULE_VERSION "1.50"
#define MODULE_AUTHOR "AMX Mod X Dev Team" #define MODULE_AUTHOR "AMX Mod X Dev Team"
#define MODULE_URL "http://www.amxmodx.org/" #define MODULE_URL "http://www.amxmodx.org/"
#define MODULE_LOGTAG "REGEX" #define MODULE_LOGTAG "REGEX"

View File

@ -6,7 +6,7 @@ MM_ROOT = ../../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ### ### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe OPT_FLAGS = -O3 -fno-rtti -funroll-loops -s -pipe
DEBUG_FLAGS = -g -ggdb3 DEBUG_FLAGS = -g -ggdb3
CPP = gcc CPP = gcc
NAME = sockets_amxx NAME = sockets_amxx
@ -26,11 +26,12 @@ else
CFLAGS = $(OPT_FLAGS) CFLAGS = $(OPT_FLAGS)
endif endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
ifeq "$(AMD64)" "true" ifeq "$(AMD64)" "true"
BINARY = $(NAME)_amd64.so BINARY = $(NAME)_amd64.so
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64
LINK += -lstdc++
else else
BINARY = $(NAME)_i386.so BINARY = $(NAME)_i386.so
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32 CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32

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