fixed bug am50501
This commit is contained in:
parent
b324e8ed9d
commit
7f3c2d00ac
|
@ -34,19 +34,25 @@ void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
||||||
g_pFunctionTable->pfn##tcall =0; \
|
g_pFunctionTable->pfn##tcall =0; \
|
||||||
g_pFunctionTable_Post->pfn##tcall =NULL; \
|
g_pFunctionTable_Post->pfn##tcall =NULL; \
|
||||||
Engine[FM_##tcall].clear(); \
|
Engine[FM_##tcall].clear(); \
|
||||||
EnginePost[FM_##tcall].clear()
|
EnginePost[FM_##tcall].clear(); \
|
||||||
|
EngineAddrs[FM_##tcall] = NULL; \
|
||||||
|
EngineAddrsPost[FM_##tcall] = NULL;
|
||||||
|
|
||||||
#define RESETE(call) \
|
#define RESETE(call) \
|
||||||
g_pengfuncsTable->pfn##call = NULL; \
|
g_pengfuncsTable->pfn##call = NULL; \
|
||||||
g_pengfuncsTable_Post->pfn##call = NULL; \
|
g_pengfuncsTable_Post->pfn##call = NULL; \
|
||||||
Engine[FM_##call].clear(); \
|
Engine[FM_##call].clear(); \
|
||||||
EnginePost[FM_##call].clear()
|
EnginePost[FM_##call].clear(); \
|
||||||
|
EngineAddrs[FM_##call] = NULL; \
|
||||||
|
EngineAddrsPost[FM_##call] = NULL;
|
||||||
|
|
||||||
#define RESETN(call) \
|
#define RESETN(call) \
|
||||||
g_pNewFunctionsTable->pfn##call = NULL; \
|
g_pNewFunctionsTable->pfn##call = NULL; \
|
||||||
g_pNewFunctionsTable_Post->pfn##call = NULL; \
|
g_pNewFunctionsTable_Post->pfn##call = NULL; \
|
||||||
Engine[FM_##call].clear(); \
|
Engine[FM_##call].clear(); \
|
||||||
EnginePost[FM_##call].clear();
|
EnginePost[FM_##call].clear(); \
|
||||||
|
EngineAddrs[FM_##call] = NULL; \
|
||||||
|
EngineAddrsPost[FM_##call] = NULL;
|
||||||
|
|
||||||
void FMH_ServerDeactivate_Post()
|
void FMH_ServerDeactivate_Post()
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
CVector<int> Engine[ENGFUNC_NUM+10];
|
CVector<int> Engine[ENGFUNC_NUM+10];
|
||||||
CVector<int> EnginePost[ENGFUNC_NUM+10];
|
CVector<int> EnginePost[ENGFUNC_NUM+10];
|
||||||
|
void *EngineAddrs[ENGFUNC_NUM+10];
|
||||||
|
void *EngineAddrsPost[ENGFUNC_NUM+10];
|
||||||
cell mCellResult;
|
cell mCellResult;
|
||||||
cell mlCellResult;
|
cell mlCellResult;
|
||||||
float mFloatResult;
|
float mFloatResult;
|
||||||
|
@ -819,11 +821,17 @@ static cell AMX_NATIVE_CALL unregister_forward(AMX *amx, cell *params)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *patchAddr = NULL;
|
||||||
|
|
||||||
CVector<int> *peng = NULL;
|
CVector<int> *peng = NULL;
|
||||||
if (post)
|
if (post)
|
||||||
|
{
|
||||||
peng = &(EnginePost[func]);
|
peng = &(EnginePost[func]);
|
||||||
else
|
patchAddr = EngineAddrsPost[func];
|
||||||
|
} else {
|
||||||
peng = &(Engine[func]);
|
peng = &(Engine[func]);
|
||||||
|
patchAddr = EngineAddrs[func];
|
||||||
|
}
|
||||||
|
|
||||||
CVector<int>::iterator begin, end=peng->end();
|
CVector<int>::iterator begin, end=peng->end();
|
||||||
|
|
||||||
|
@ -832,10 +840,12 @@ static cell AMX_NATIVE_CALL unregister_forward(AMX *amx, cell *params)
|
||||||
if ((*begin) == func_id)
|
if ((*begin) == func_id)
|
||||||
{
|
{
|
||||||
peng->erase(begin);
|
peng->erase(begin);
|
||||||
if (!peng->size())
|
if (!peng->size()
|
||||||
|
&& patchAddr != NULL
|
||||||
|
&& func != FM_ServerDeactivate)
|
||||||
{
|
{
|
||||||
//:TODO: we should probably clear this here!
|
/* Clear out this forward if we no longer need it */
|
||||||
//but, we have no reverse lookup possible.
|
*(void **)patchAddr = NULL;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,6 +169,8 @@ enum {
|
||||||
|
|
||||||
extern CVector<int> Engine[];
|
extern CVector<int> Engine[];
|
||||||
extern CVector<int> EnginePost[];
|
extern CVector<int> EnginePost[];
|
||||||
|
extern void *EngineAddrs[ENGFUNC_NUM+10];
|
||||||
|
extern void *EngineAddrsPost[ENGFUNC_NUM+10];
|
||||||
extern cell mCellResult;
|
extern cell mCellResult;
|
||||||
extern float mFloatResult;
|
extern float mFloatResult;
|
||||||
extern const char *mStringResult;
|
extern const char *mStringResult;
|
||||||
|
|
|
@ -810,11 +810,13 @@
|
||||||
#define ENGHOOK(pfnCall) \
|
#define ENGHOOK(pfnCall) \
|
||||||
if (post) \
|
if (post) \
|
||||||
{ \
|
{ \
|
||||||
|
EngineAddrsPost[FM_##pfnCall] = &engtable->pfn##pfnCall; \
|
||||||
if (engtable->pfn##pfnCall == NULL) \
|
if (engtable->pfn##pfnCall == NULL) \
|
||||||
engtable->pfn##pfnCall = pfnCall##_post; \
|
engtable->pfn##pfnCall = pfnCall##_post; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
|
EngineAddrs[FM_##pfnCall] = &engtable->pfn##pfnCall; \
|
||||||
if (engtable->pfn##pfnCall == NULL) \
|
if (engtable->pfn##pfnCall == NULL) \
|
||||||
engtable->pfn##pfnCall = pfnCall; \
|
engtable->pfn##pfnCall = pfnCall; \
|
||||||
}
|
}
|
||||||
|
@ -822,11 +824,13 @@
|
||||||
#define DLLHOOK(pfnCall) \
|
#define DLLHOOK(pfnCall) \
|
||||||
if (post) \
|
if (post) \
|
||||||
{ \
|
{ \
|
||||||
|
EngineAddrsPost[FM_##pfnCall] = &dlltable->pfn##pfnCall; \
|
||||||
if (dlltable->pfn##pfnCall == NULL) \
|
if (dlltable->pfn##pfnCall == NULL) \
|
||||||
dlltable->pfn##pfnCall = pfnCall##_post; \
|
dlltable->pfn##pfnCall = pfnCall##_post; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
|
EngineAddrs[FM_##pfnCall] = &dlltable->pfn##pfnCall; \
|
||||||
if (dlltable->pfn##pfnCall == NULL) \
|
if (dlltable->pfn##pfnCall == NULL) \
|
||||||
dlltable->pfn##pfnCall = pfnCall; \
|
dlltable->pfn##pfnCall = pfnCall; \
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user