mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-28 22:48:02 +03:00
Fix crash on hook(detour) ClientCommand from the cstrike module amxx
This commit is contained in:
parent
d586d65993
commit
14fb7f7756
@ -8465,7 +8465,29 @@ void CBasePlayer::ClientCommand(const char *cmd, const char *arg1, const char *a
|
|||||||
BotArgs[3] = arg3;
|
BotArgs[3] = arg3;
|
||||||
|
|
||||||
UseBotArgs = true;
|
UseBotArgs = true;
|
||||||
::ClientCommand(ENT(pev));
|
|
||||||
|
auto pEntity = ENT(pev);
|
||||||
|
auto addr = &::ClientCommand;
|
||||||
|
|
||||||
|
// NOTE: force __cdecl to allow cstrike amxx module to hook ClientCommand
|
||||||
|
#if defined _MSC_VER || defined __INTEL_COMPILER
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push pEntity;
|
||||||
|
call addr;
|
||||||
|
add esp, 4;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
asm volatile (
|
||||||
|
"pushl %0\n\t"
|
||||||
|
"call %1\n\t"
|
||||||
|
"addl %%esp, $4\n\t"
|
||||||
|
::
|
||||||
|
"g" (pEntity),
|
||||||
|
"g" (addr),
|
||||||
|
);
|
||||||
|
#endif // _MSC_VER || defined __INTEL_COMPILER
|
||||||
|
|
||||||
UseBotArgs = false;
|
UseBotArgs = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user