Fixed HamExecuteB and made its system a bit more logical.

This commit is contained in:
Steve Dudenhoeffer 2007-05-04 15:42:02 +00:00
parent fb5e7dbfdb
commit bd2ad31f5e
9 changed files with 91 additions and 579 deletions

View File

@ -25,7 +25,7 @@ BIN_SUFFIX = amxx_i386.so
OBJECTS = sdk/amxxmodule.cpp amxx_api.cpp config_parser.cpp \
hook_callbacks.cpp hook_native.cpp srvcmd.cpp \
call_funcs.cpp ecall_funcs.cpp hook_create.cpp
call_funcs.cpp hook_create.cpp
LINK =

View File

@ -13,6 +13,10 @@ extern CVector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
void FailPlugin(AMX *amx, int id, int err, const char *reason);
inline void *GetFunction(void *pthis, int id)
{
return GetVTableEntry(pthis, hooklist[id].vtid, Offsets.GetBase());
}
inline void *_GetFunction(void *pthis, int id)
{
void **vtbl=GetVTable(pthis, Offsets.GetBase());
@ -30,11 +34,13 @@ inline void *GetFunction(void *pthis, int id)
// function.
if (func==(*i)->tramp)
{
printf("Func=0x%08X\n",reinterpret_cast<unsigned int>((*i)->func));
return (*i)->func;
}
}
// this is an original function
printf("Func=0x%08X\n",reinterpret_cast<unsigned int>(func));
return func;
}

View File

@ -1,479 +0,0 @@
#include "sdk/amxxmodule.h"
#include "offsets.h"
#include "ham_utils.h"
#include "hooklist.h"
#include "CVector.h"
#include "forward.h"
#include "hook.h"
extern CVector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
void FailPlugin(AMX *amx, int id, int err, const char *reason);
inline void *GetFunction(void *pthis, int id)
{
void **vtbl=GetVTable(pthis, Offsets.GetBase());
int **ivtbl=(int **)vtbl;
void *func=ivtbl[hooklist[id].vtid];
return func;
}
#define SETUP(NUMARGS) \
if (((NUMARGS + 2) * sizeof(cell)) > (unsigned)params[0]) \
{ \
MF_LogError(amx, AMX_ERR_NATIVE, "Bad arg count. Expected %d, got %d.", NUMARGS + 2, params[0] / sizeof(cell)); \
return 0; \
} \
int func=params[1]; \
int id=params[2]; \
CHECK_FUNCTION(func); \
CHECK_ENTITY(id); \
void *pv=IndexToPrivate(id);
cell eCall_Void_Void(AMX *amx, cell *params)
{
SETUP(0);
#ifdef _WIN32
reinterpret_cast<void (__fastcall *)(void*, int)>(GetFunction(pv, func))(pv, 0);
#elif defined __linux__
reinterpret_cast<void (*)(void *)>(GetFunction(pv, func))(pv);
#endif
return 1;
}
cell eCall_Int_Void(AMX *amx, cell *params)
{
SETUP(0);
#ifdef _WIN32
return reinterpret_cast<int (__fastcall *)(void*, int)>(GetFunction(pv, func))(pv, 0);
#elif defined __linux__
return reinterpret_cast<int (*)(void *)>(GetFunction(pv, func))(pv);
#endif
}
cell eCall_Void_Entvar(AMX *amx, cell *params)
{
SETUP(1);
int id3=*MF_GetAmxAddr(amx, params[3]);
CHECK_ENTITY(id3);
entvars_t *ev1=&(INDEXENT_NEW(id3)->v);
#ifdef _WIN32
reinterpret_cast<void (__fastcall *)(void*, int, entvars_t *)>(GetFunction(pv, func))(pv, 0, ev1);
#elif defined __linux__
reinterpret_cast<void (*)(void *, entvars_t *)>(GetFunction(pv, func))(pv, ev1);
#endif
return 1;
}
cell eCall_Void_Cbase(AMX *amx, cell *params)
{
SETUP(1);
int id3=*MF_GetAmxAddr(amx, params[3]);
CHECK_ENTITY(id3);
void *pv1=(INDEXENT_NEW(id3)->pvPrivateData);
#ifdef _WIN32
reinterpret_cast<void (__fastcall *)(void*, int, void *)>(GetFunction(pv, func))(pv, 0, pv1);
#elif defined __linux__
reinterpret_cast<void (*)(void *, void *)>(GetFunction(pv, func))(pv, pv1);
#endif
return 1;
}
cell eCall_Int_Float_Int(AMX *amx, cell *params)
{
SETUP(2);
float f3=amx_ftoc2(*MF_GetAmxAddr(amx, params[3]));
int i4=*MF_GetAmxAddr(amx, params[4]);
#ifdef _WIN32
return reinterpret_cast<int (__fastcall *)(void*, int, float, int)>(GetFunction(pv, func))(pv, 0, f3, i4);
#elif defined __linux__
return reinterpret_cast<int (*)(void *, float, int)>(GetFunction(pv, func))(pv, f3, i4);
#endif
}
cell eCall_Void_Entvar_Int(AMX *amx, cell *params)
{
SETUP(2);
int id3=*MF_GetAmxAddr(amx, params[3]);
int i4=*MF_GetAmxAddr(amx, params[4]);
CHECK_ENTITY(id3);
entvars_t *ev3=&(INDEXENT_NEW(id3)->v);
#ifdef _WIN32
reinterpret_cast<void (__fastcall *)(void*, int, entvars_t *, int)>(GetFunction(pv, func))(pv, 0, ev3, i4);
#elif defined __linux__
reinterpret_cast<void (*)(void *, entvars_t *, int)>(GetFunction(pv, func))(pv, ev3, i4);
#endif
return 1;
}
cell eCall_Int_Cbase(AMX *amx, cell *params)
{
SETUP(1);
int id3=*MF_GetAmxAddr(amx, params[3]);
CHECK_ENTITY(id3);
void *pv1=(INDEXENT_NEW(id3)->pvPrivateData);
#ifdef _WIN32
return reinterpret_cast<int (__fastcall *)(void*, int, void *)>(GetFunction(pv, func))(pv, 0, pv1);
#elif defined __linux__
return reinterpret_cast<int (*)(void *, void *)>(GetFunction(pv, func))(pv, pv1);
#endif
}
cell eCall_Void_Int_Int(AMX *amx, cell *params)
{
SETUP(2);
int i3=*MF_GetAmxAddr(amx, params[3]);
int i4=*MF_GetAmxAddr(amx, params[4]);
#ifdef _WIN32
reinterpret_cast<void (__fastcall *)(void*, int, int, int)>(GetFunction(pv, func))(pv, 0, i3, i4);
#elif defined __linux__
reinterpret_cast<void (*)(void *, int, int)>(GetFunction(pv, func))(pv, i3, i4);
#endif
return 1;
}
cell eCall_Int_Int_Str_Int(AMX *amx, cell *params)
{
SETUP(3);
int i3=*MF_GetAmxAddr(amx, params[3]);
char *sz4=MF_GetAmxString(amx, params[4], 0, NULL);
int i5=*MF_GetAmxAddr(amx, params[5]);
#ifdef _WIN32
return reinterpret_cast<int (__fastcall *)(void*, int, int, const char *, int)>(GetFunction(pv, func))(pv, 0, i3, sz4, i5);
#elif defined __linux__
return reinterpret_cast<int (*)(void *, int, const char *, int)>(GetFunction(pv, func))(pv, i3, sz4, i5);
#endif
}
cell eCall_Int_Int(AMX *amx, cell *params)
{
SETUP(1);
int i3=*MF_GetAmxAddr(amx, params[3]);
#ifdef _WIN32
return reinterpret_cast<int (__fastcall *)(void*, int, int)>(GetFunction(pv, func))(pv, 0, i3);
#elif defined __linux__
return reinterpret_cast<int (*)(void *, int)>(GetFunction(pv, func))(pv, i3);
#endif
}
cell eCall_Int_Entvar(AMX *amx, cell *params)
{
SETUP(1);
int id3=*MF_GetAmxAddr(amx, params[3]);
CHECK_ENTITY(id3);
entvars_t *ev3=&(INDEXENT_NEW(id3)->v);
#ifdef _WIN32
return reinterpret_cast<int (__fastcall *)(void *, int, entvars_t *)>(GetFunction(pv, func))(pv, 0, ev3);
#elif defined __linux__
return reinterpret_cast<int (*)(void *, entvars_t *)>(GetFunction(pv, func))(pv, ev3);
#endif
}
cell eCall_Int_Entvar_Entvar_Float_Int(AMX *amx, cell *params)
{
SETUP(4);
int id3=*MF_GetAmxAddr(amx, params[3]);
int id4=*MF_GetAmxAddr(amx, params[4]);
float f5=amx_ctof2(*MF_GetAmxAddr(amx, params[5]));
int i6=*MF_GetAmxAddr(amx, params[6]);
CHECK_ENTITY(id3);
CHECK_ENTITY(id4);
entvars_t *ev3=&(INDEXENT_NEW(id3)->v);
entvars_t *ev4=&(INDEXENT_NEW(id4)->v);
#ifdef _WIN32
return reinterpret_cast<int (__fastcall *)(void *, int, entvars_t *, entvars_t *, float, int)>(GetFunction(pv, func))(pv, 0, ev3, ev4, f5, i6);
#elif defined __linux__
return reinterpret_cast<int (*)(void *, entvars_t *, entvars_t *, float, int)>(GetFunction(pv, func))(pv, ev3, ev4, f5, i6);
#endif
}
cell eCall_Void_Int(AMX *amx, cell *params)
{
SETUP(1);
int i3=*MF_GetAmxAddr(amx, params[3]);
#ifdef _WIN32
reinterpret_cast<void (__fastcall *)(void *, int, int)>(GetFunction(pv, func))(pv, 0, i3);
#elif defined __linux__
reinterpret_cast<void (*)(void *, int)>(GetFunction(pv, func))(pv, i3);
#endif
return 1;
}
cell eCall_Void_Cbase_Cbase_Int_Float(AMX *amx, cell *params)
{
SETUP(4);
int id3=*MF_GetAmxAddr(amx, params[3]);
int id4=*MF_GetAmxAddr(amx, params[4]);
int i5=*MF_GetAmxAddr(amx, params[5]);
float f6=amx_ctof(*MF_GetAmxAddr(amx, params[6]));
CHECK_ENTITY(id3);
CHECK_ENTITY(id4);
void *p3=IndexToPrivate(id3);
void *p4=IndexToPrivate(id4);
#ifdef _WIN32
reinterpret_cast<void (__fastcall *)(void *, int, void *, void *, int, float)>(GetFunction(pv, func))(pv, 0, p3, p4, i5, f6);
#elif defined __linux__
reinterpret_cast<void (*)(void *, void *, void *, int, float)>(GetFunction(pv, func))(pv, p3, p4, i5, f6);
#endif
return 1;
}
cell eCall_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, cell *params)
{
SETUP(5);
int id3=*MF_GetAmxAddr(amx, params[3]);
float f4=amx_ctof2(*MF_GetAmxAddr(amx, params[4]));
Vector v5;
TraceResult *tr6=reinterpret_cast<TraceResult *>(*MF_GetAmxAddr(amx, params[6]));
int i7=*MF_GetAmxAddr(amx, params[7]);
float *fl5=(float *)MF_GetAmxAddr(amx, params[5]);
v5.x=fl5[0];
v5.y=fl5[1];
v5.z=fl5[2];
if (tr6==NULL)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Null traceresult provided.");
return 0;
}
CHECK_ENTITY(id3);
entvars_t *ev3=&(INDEXENT_NEW(id3)->v);
#ifdef _WIN32
reinterpret_cast<void (__fastcall *)(void *, int, entvars_t *, float, Vector, TraceResult *, int)>(GetFunction(pv, func))(pv, 0, ev3, f4, v5, tr6, i7);
#elif defined __linux__
reinterpret_cast<void (*)(void *, entvars_t *, float, Vector, TraceResult *, int)>(GetFunction(pv, func))(pv, ev3, f4, v5, tr6, i7);
#endif
return 1;
}
cell eCall_Void_Float_Vector_TraceResult_Int(AMX *amx, cell *params)
{
SETUP(4);
float f3=amx_ctof2(*MF_GetAmxAddr(amx, params[3]));
Vector v4;
TraceResult *tr5=reinterpret_cast<TraceResult *>(*MF_GetAmxAddr(amx, params[5]));
int i6=*MF_GetAmxAddr(amx, params[6]);
float *fl4=(float *)MF_GetAmxAddr(amx, params[4]);
v4.x=fl4[0];
v4.y=fl4[1];
v4.z=fl4[2];
if (tr5==NULL)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Null traceresult provided.");
return 0;
}
#ifdef _WIN32
reinterpret_cast<void (__fastcall *)(void *, int, float, Vector, TraceResult *, int)>(GetFunction(pv, func))(pv, 0, f3, v4, tr5, i6);
#elif defined __linux__
reinterpret_cast<void (*)(void *, float, Vector, TraceResult *, int)>(GetFunction(pv, func))(pv, f3, v4, tr5, i6);
#endif
return 1;
}
cell eCall_Str_Void(AMX *amx, cell *params)
{
SETUP(2);
#ifdef _WIN32
char *v=reinterpret_cast<char *(__fastcall *)(void *, int)>(GetFunction(pv, func))(pv, 0);
#elif defined __linux__
char *v=reinterpret_cast<char *(*)(void *)>(GetFunction(pv, func))(pv);
#endif
return MF_SetAmxString(amx, params[3], v == NULL ? "" : v, *MF_GetAmxAddr(amx, params[4]));
}
cell eCall_Cbase_Void(AMX *amx, cell *params)
{
SETUP(0);
#ifdef _WIN32
void *ret=reinterpret_cast<void *(__fastcall *)(void *, int)>(GetFunction(pv, func))(pv, 0);
#elif defined __linux__
void *ret=reinterpret_cast<void *(*)(void *)>(GetFunction(pv, func))(pv);
#endif
return PrivateToIndex(ret);
}
cell eCall_Vector_Void(AMX *amx, cell *params)
{
SETUP(1);
#ifdef _WIN32
Vector ret=reinterpret_cast<Vector (__fastcall *)(void *, int)>(GetFunction(pv, func))(pv, 0);
#elif defined __linux__
Vector ret=reinterpret_cast<Vector (*)(void *)>(GetFunction(pv, func))(pv);
#endif
float *out=(float *)MF_GetAmxAddr(amx, params[3]);
out[0]=ret.x;
out[1]=ret.y;
out[2]=ret.z;
return 1;
}
cell eCall_Vector_pVector(AMX *amx, cell *params)
{
SETUP(2);
Vector v3;
float *fl3=(float *)MF_GetAmxAddr(amx, params[3]);
v3.x=fl3[0];
v3.y=fl3[1];
v3.z=fl3[2];
#ifdef _WIN32
Vector ret=reinterpret_cast<Vector (__fastcall *)(void *, int, Vector*)>(GetFunction(pv, func))(pv, 0, &v3);
#elif defined __linux__
Vector ret=reinterpret_cast<Vector (*)(void *, Vector*)>(GetFunction(pv, func))(pv, &v3);
#endif
float *out=(float *)MF_GetAmxAddr(amx, params[4]);
out[0]=ret.x;
out[1]=ret.y;
out[2]=ret.z;
fl3[0]=v3.x;
fl3[1]=v3.y;
fl3[2]=v3.z;
return 1;
}
cell eCall_Int_pVector(AMX *amx, cell *params)
{
SETUP(1);
Vector v3;
float *fl3=(float *)MF_GetAmxAddr(amx, params[3]);
v3.x=fl3[0];
v3.y=fl3[1];
v3.z=fl3[2];
#ifdef _WIN32
int ret=reinterpret_cast<int (__fastcall *)(void *, int, Vector*)>(GetFunction(pv, func))(pv, 0, &v3);
#elif defined __linux__
int ret=reinterpret_cast<int (*)(void *, Vector*)>(GetFunction(pv, func))(pv, &v3);
#endif
fl3[0]=v3.x;
fl3[1]=v3.y;
fl3[2]=v3.z;
return ret;
}
cell eCall_Void_Entvar_Float_Float(AMX *amx, cell *params)
{
SETUP(3);
int id3=*MF_GetAmxAddr(amx, params[3]);
float f4=amx_ctof2(*MF_GetAmxAddr(amx, params[4]));
float f5=amx_ctof2(*MF_GetAmxAddr(amx, params[5]));
CHECK_ENTITY(id3);
entvars_t *ev3=&(INDEXENT_NEW(id3)->v);
#ifdef _WIN32
reinterpret_cast<void (__fastcall *)(void *, int, entvars_t *, float, float)>(GetFunction(pv, func))(pv, 0, ev3, f4, f5);
#elif defined __linux__
reinterpret_cast<void (*)(void *, entvars_t *, float, float)>(GetFunction(pv, func))(pv, ev3, f4, f5);
#endif
return 1;
}
cell eCall_Int_pFloat_pFloat(AMX *amx, cell *params)
{
SETUP(2);
float f3=amx_ctof2(*MF_GetAmxAddr(amx, params[3]));
float f4=amx_ctof2(*MF_GetAmxAddr(amx, params[4]));
#ifdef _WIN32
return reinterpret_cast<int (__fastcall *)(void *, int, float*, float*)>(GetFunction(pv, func))(pv, 0, &f3, &f4);
#elif defined __linux__
return reinterpret_cast<int (*)(void *, float*, float*)>(GetFunction(pv, func))(pv, &f3, &f4);
#endif
}
cell eCall_Void_Entvar_Float(AMX *amx, cell *params)
{
SETUP(2);
int id3=*MF_GetAmxAddr(amx, params[3]);
float f4=amx_ctof2(*MF_GetAmxAddr(amx, params[4]));
CHECK_ENTITY(id3);
entvars_t *ev3=&(INDEXENT_NEW(id3)->v);
#ifdef _WIN32
return reinterpret_cast<int (__fastcall *)(void *, int, entvars_t*, float)>(GetFunction(pv, func))(pv, 0, ev3, f4);
#elif defined __linux__
return reinterpret_cast<int (*)(void *, entvars_t*, float)>(GetFunction(pv, func))(pv, ev3, f4);
#endif
}

View File

@ -1,54 +0,0 @@
#ifndef HOOK_ECALL_H
#define HOOK_ECALL_H
cell eCall_Void_Void(AMX *amx, cell *params);
cell eCall_Int_Void(AMX *amx, cell *params);
cell eCall_Void_Entvar(AMX *amx, cell *params);
cell eCall_Void_Cbase(AMX *amx, cell *params);
cell eCall_Int_Float_Int(AMX *amx, cell *params);
cell eCall_Void_Entvar_Int(AMX *amx, cell *params);
cell eCall_Int_Cbase(AMX *amx, cell *params);
cell eCall_Void_Int_Int(AMX *amx, cell *params);
cell eCall_Int_Int_Str_Int(AMX *amx, cell *params);
cell eCall_Int_Int(AMX *amx, cell *params);
cell eCall_Int_Entvar(AMX *amx, cell *params);
cell eCall_Int_Entvar_Entvar_Float_Int(AMX *amx, cell *params);
cell eCall_Void_Int(AMX *amx, cell *params);
cell eCall_Void_Cbase_Cbase_Int_Float(AMX *amx, cell *params);
cell eCall_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, cell *params);
cell eCall_Void_Float_Vector_TraceResult_Int(AMX *amx, cell *params);
cell eCall_Str_Void(AMX *amx, cell *params);
cell eCall_Cbase_Void(AMX *amx, cell *params);
cell eCall_Vector_Void(AMX *amx, cell *params);
cell eCall_Vector_pVector(AMX *amx, cell *params);
cell eCall_Int_pVector(AMX *amx, cell *params);
cell eCall_Void_Entvar_Float_Float(AMX *amx, cell *params);
cell eCall_Int_pFloat_pFloat(AMX *amx, cell *params);
cell eCall_Void_Entvar_Float(AMX *amx, cell *params);
#endif

View File

@ -17,10 +17,17 @@
#include "ham_utils.h"
extern bool gDoForwards;
#define PRE_START() \
bool DoForwards=gDoForwards; \
gDoForwards=true; \
int result=HAM_UNSET; \
int thisresult=HAM_UNSET; \
int iThis=PrivateToIndex(pthis); \
if (DoForwards) \
{ \
CVector<Forward*>::iterator end=hook->pre.end(); \
for (CVector<Forward*>::iterator i=hook->pre.begin(); i!=end; i++) \
{ \
@ -36,13 +43,16 @@
result=thisresult; \
} \
} \
} \
if (result < HAM_SUPERCEDE) \
{
#define POST_START() \
} \
end=hook->post.end(); \
for (CVector<Forward*>::iterator i=hook->post.begin(); i!=end; i++)\
if (DoForwards) \
{ \
CVector<Forward*>::iterator end=hook->post.end(); \
for (CVector<Forward*>::iterator i=hook->post.begin(); i!=end; i++) \
{ \
if ((*i)->state == FSTATE_OK) \
{ \
@ -51,6 +61,7 @@
#define POST_END() \
); \
} \
} \
}

View File

@ -13,7 +13,6 @@
#include "forward.h"
#include "hook_callbacks.h"
#include "call_funcs.h"
#include "ecall_funcs.h"
#include "hook_create.h"
#include "offsets.h"
#include "hooklist.h"
@ -21,10 +20,12 @@
OffsetManager Offsets;
bool gDoForwards=false;
CVector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
#define V(__STUFF__) reinterpret_cast<void *>(Hook_##__STUFF__), Create_##__STUFF__, Call_##__STUFF__, eCall_##__STUFF__
#define V(__STUFF__) reinterpret_cast<void *>(Hook_##__STUFF__), Create_##__STUFF__, Call_##__STUFF__
hook_t hooklist[] =
{
@ -230,6 +231,7 @@ static cell AMX_NATIVE_CALL ExecuteHam(AMX *amx, cell *params)
CHECK_FUNCTION(func);
gDoForwards=false;
return hooklist[func].call(amx, params);
}
static cell AMX_NATIVE_CALL ExecuteHamB(AMX *amx, cell *params)
@ -238,7 +240,8 @@ static cell AMX_NATIVE_CALL ExecuteHamB(AMX *amx, cell *params)
CHECK_FUNCTION(func);
return hooklist[func].ecall(amx, params);
gDoForwards=true;
return hooklist[func].call(amx, params);
}

View File

@ -11,7 +11,6 @@ typedef struct hook_s
void *targetfunc; // the target hook
int (*makefunc)(AMX *, const char*); // function that creates forwards
cell (*call)(AMX *, cell*); // function to call the vcall
cell (*ecall)(AMX *, cell*); // function to ecall the vcall
} hook_t;
extern hook_t hooklist[];

View File

@ -2284,7 +2284,7 @@ C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_
}
#ifdef FN_META_QUERY
return FN_META_QUERY();
FN_META_QUERY();
#endif // FN_META_QUERY
return 1;
@ -2327,7 +2327,7 @@ C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
}
#ifdef FN_META_DETACH
return FN_META_DETACH();
FN_META_DETACH();
#endif // FN_META_DETACH
return TRUE;
}
@ -2374,7 +2374,7 @@ C_DLLEXPORT void __stdcall GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine,
gpGlobals = pGlobals;
// NOTE! Have to call logging function _after_ copying into g_engfuncs, so
// that g_engfuncs.pfnAlertMessage() can be resolved properly, heh. :)
UTIL_LogPrintf("[%s] dev: called: GiveFnptrsToDll\n", Plugin_info.logtag);
// UTIL_LogPrintf("[%s] dev: called: GiveFnptrsToDll\n", Plugin_info.logtag);
// --> ** Function core
#ifdef _MSC_VER
@ -2437,6 +2437,7 @@ static amxx_module_info_s g_ModuleInfo =
// Storage for the requested functions
PFN_ADD_NATIVES g_fn_AddNatives;
PFN_ADD_NEW_NATIVES g_fn_AddNewNatives;
PFN_BUILD_PATHNAME g_fn_BuildPathname;
PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR;
PFN_GET_AMXADDR g_fn_GetAmxAddr;
@ -2513,6 +2514,9 @@ PFN_ADDLIBRARIES g_fn_AddLibraries;
PFN_REMOVELIBRARIES g_fn_RemoveLibraries;
PFN_OVERRIDENATIVES g_fn_OverrideNatives;
PFN_GETLOCALINFO g_fn_GetLocalInfo;
PFN_AMX_REREGISTER g_fn_AmxReRegister;
PFN_REGISTERFUNCTIONEX g_fn_RegisterFunctionEx;
PFN_MESSAGE_BLOCK g_fn_MessageBlock;
// *** Exports ***
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
@ -2563,6 +2567,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
REQFUNC("RegisterFunction", g_fn_RegisterFunction, PFN_REGISTERFUNCTION);
REQFUNC("RegisterFunctionEx", g_fn_RegisterFunctionEx, PFN_REGISTERFUNCTIONEX);
// Amx scripts
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
@ -2588,6 +2593,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
// Natives / Forwards
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
REQFUNC("AddNewNatives", g_fn_AddNewNatives, PFN_ADD_NEW_NATIVES);
REQFUNC("RaiseAmxError", g_fn_RaiseAmxError, PFN_RAISE_AMXERROR);
REQFUNC("RegisterForward", g_fn_RegisterForward, PFN_REGISTER_FORWARD);
REQFUNC("RegisterSPForward", g_fn_RegisterSPForward, PFN_REGISTER_SPFORWARD);
@ -2627,11 +2633,15 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
REQFUNC("RegAuthFunc", g_fn_RegAuthFunc, PFN_REG_AUTH_FUNC);
REQFUNC("UnregAuthFunc", g_fn_UnregAuthFunc, PFN_UNREG_AUTH_FUNC);
//Added in 1.75
REQFUNC("FindLibrary", g_fn_FindLibrary, PFN_FINDLIBRARY);
REQFUNC("AddLibraries", g_fn_AddLibraries, PFN_ADDLIBRARIES);
REQFUNC("RemoveLibraries", g_fn_RemoveLibraries, PFN_REMOVELIBRARIES);
REQFUNC("OverrideNatives", g_fn_OverrideNatives, PFN_OVERRIDENATIVES);
REQFUNC("GetLocalInfo", g_fn_GetLocalInfo, PFN_GETLOCALINFO);
REQFUNC("AmxReregister", g_fn_AmxReRegister, PFN_AMX_REREGISTER);
REQFUNC("MessageBlock", g_fn_MessageBlock, PFN_MESSAGE_BLOCK);
#ifdef MEMORY_TEST
// Memory
@ -2766,6 +2776,7 @@ void ValidateMacros_DontCallThis_Smiley()
MF_GetPlayerEdict(0);
MF_Format("", 4, "str");
MF_RegisterFunction(NULL, "");
MF_RegisterFunctionEx(NULL, "");
MF_SetPlayerTeamInfo(0, 0, "");
MF_PlayerPropAddr(0, 0);
MF_RegAuthFunc(NULL);
@ -2773,7 +2784,8 @@ void ValidateMacros_DontCallThis_Smiley()
MF_FindLibrary(NULL, LibType_Class);
MF_AddLibraries(NULL, LibType_Class, NULL);
MF_RemoveLibraries(NULL);
MF_OverrideNatives(NULL, "");
MF_OverrideNatives(NULL, NULL);
MF_MessageBlock(0, 0, NULL);
}
#endif

View File

@ -1077,7 +1077,7 @@ void FN_AlertMessage(ALERT_TYPE atype, char *szFmt, ...);
#endif // FN_AlertMessage
#ifdef FN_EngineFprintf
void FN_EngineFprintf(FILE *pfile, char *szFmt, ...);
void FN_EngineFprintf(void *pfile, char *szFmt, ...);
#endif // FN_EngineFprintf
#ifdef FN_PvAllocEntPrivateData
@ -1141,11 +1141,11 @@ void FN_GetBonePosition(const edict_t *pEdict, int iBone, float *rgflOrigin, flo
#endif // FN_GetBonePosition
#ifdef FN_FunctionFromName
unsigned long FN_FunctionFromName(const char *pName);
uint32 FN_FunctionFromName(const char *pName);
#endif // FN_FunctionFromName
#ifdef FN_NameForFunction
const char *FN_NameForFunction(unsigned long function);
const char *FN_NameForFunction(uint32);
#endif // FN_NameForFunction
#ifdef FN_ClientPrintf
@ -1189,7 +1189,7 @@ CRC32_t FN_CRC32_Final(CRC32_t pulCRC);
#endif // FN_CRC32_Final
#ifdef FN_RandomLong
long FN_RandomLong(long lLow, long lHigh);
int32 FN_RandomLong(int32 lLow, int32 lHigh);
#endif // FN_RandomLong
#ifdef FN_RandomFloat
@ -1658,11 +1658,11 @@ void FN_AlertMessage_Post(ALERT_TYPE atype, char *szFmt, ...);
#endif // FN_AlertMessage_Post
#ifdef FN_EngineFprintf_Post
void FN_EngineFprintf_Post(FILE *pfile, char *szFmt, ...);
void FN_EngineFprintf_Post(void *pfile, char *szFmt, ...);
#endif // FN_EngineFprintf_Post
#ifdef FN_PvAllocEntPrivateData_Post
void *FN_PvAllocEntPrivateData_Post(edict_t *pEdict, long cb);
void *FN_PvAllocEntPrivateData_Post(edict_t *pEdict, int32 cb);
#endif // FN_PvAllocEntPrivateData_Post
#ifdef FN_PvEntPrivateData_Post
@ -1722,11 +1722,11 @@ void FN_GetBonePosition_Post(const edict_t *pEdict, int iBone, float *rgflOrigin
#endif // FN_GetBonePosition_Post
#ifdef FN_FunctionFromName_Post
unsigned long FN_FunctionFromName_Post(const char *pName);
uint32 FN_FunctionFromName_Post(const char *pName);
#endif // FN_FunctionFromName_Post
#ifdef FN_NameForFunction_Post
const char *FN_NameForFunction_Post(unsigned long function);
const char *FN_NameForFunction_Post(uint32);
#endif // FN_NameForFunction_Post
#ifdef FN_ClientPrintf_Post
@ -1770,7 +1770,7 @@ CRC32_t FN_CRC32_Final_Post(CRC32_t pulCRC);
#endif // FN_CRC32_Final_Post
#ifdef FN_RandomLong_Post
long FN_RandomLong_Post(long lLow, long lHigh);
int32 FN_RandomLong_Post(int32 lLow, int32 lHigh);
#endif // FN_RandomLong_Post
#ifdef FN_RandomFloat_Post
@ -2095,9 +2095,16 @@ enum LibType
LibType_Class
};
#define MSGBLOCK_SET 0
#define MSGBLOCK_GET 1
#define BLOCK_NOT 0
#define BLOCK_ONCE 1
#define BLOCK_SET 2
typedef void (*AUTHORIZEFUNC)(int player, const char *authstring);
typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/);
typedef int (*PFN_ADD_NEW_NATIVES) (const AMX_NATIVE_INFO * /*list*/);
typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...);
typedef char * (*PFN_BUILD_PATHNAME_R) (char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ...);
typedef cell * (*PFN_GET_AMXADDR) (AMX * /*amx*/, cell /*offset*/);
@ -2183,8 +2190,10 @@ typedef void (*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO * /*natives*/, const ch
typedef const char * (*PFN_GETLOCALINFO) (const char * /*name*/, const char * /*def*/);
typedef int (*PFN_AMX_REREGISTER) (AMX * /*amx*/, AMX_NATIVE_INFO * /*list*/, int /*list*/);
typedef void * (*PFN_REGISTERFUNCTIONEX) (void * /*pfn*/, const char * /*desc*/);
typedef void (*PFN_MESSAGE_BLOCK) (int /* mode */, int /* message */, int * /* opt */);
extern PFN_ADD_NATIVES g_fn_AddNatives;
extern PFN_ADD_NEW_NATIVES g_fn_AddNewNatives;
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
extern PFN_BUILD_PATHNAME_R g_fn_BuildPathnameR;
extern PFN_GET_AMXADDR g_fn_GetAmxAddr;
@ -2257,11 +2266,13 @@ extern PFN_OVERRIDENATIVES g_fn_OverrideNatives;
extern PFN_GETLOCALINFO g_fn_GetLocalInfo;
extern PFN_AMX_REREGISTER g_fn_AmxReRegister;
extern PFN_REGISTERFUNCTIONEX g_fn_RegisterFunctionEx;
extern PFN_MESSAGE_BLOCK g_fn_MessageBlock;
#ifdef MAY_NEVER_BE_DEFINED
// Function prototypes for intellisense and similar systems
// They understand #if 0 so we use #ifdef MAY_NEVER_BE_DEFINED
int MF_AddNatives (const AMX_NATIVE_INFO *list) { }
int MF_AddNewNatives (const AMX_NATIVE_INFO *list) { }
char * MF_BuildPathname (const char * format, ...) { }
char * MF_BuildPathnameR (char *buffer, size_t maxlen, const char *fmt, ...) { }
cell * MF_GetAmxAddr (AMX * amx, cell offset) { }
@ -2328,9 +2339,11 @@ void MF_OverrideNatives (AMX_NATIVE_INFO *natives, const char *myname) { }
const char * MF_GetLocalInfo (const char *name, const char *def) { }
int MF_AmxReRegister (AMX *amx, AMX_NATIVE_INFO *list, int number) { return 0; }
void * MF_RegisterFunctionEx (void *pfn, const char *description) { }
void * MF_MessageBlock (int mode, int msg, int *opt) { }
#endif // MAY_NEVER_BE_DEFINED
#define MF_AddNatives g_fn_AddNatives
#define MF_AddNewNatives g_fn_AddNewNatives
#define MF_BuildPathname g_fn_BuildPathname
#define MF_BuildPathnameR g_fn_BuildPathnameR
#define MF_FormatAmxString g_fn_FormatAmxString
@ -2404,6 +2417,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
#define MF_GetLocalInfo g_fn_GetLocalInfo
#define MF_AmxReRegister g_fn_AmxReRegister
#define MF_RegisterFunctionEx g_fn_RegisterFunctionEx
#define MF_MessageBlock g_fn_MessageBlock
#ifdef MEMORY_TEST
/*** Memory ***/