Update CStrike extension CSWeaponDrop to use Vector overload on CS:GO.
This commit is contained in:
parent
0967035dd0
commit
594cc249ef
@ -152,12 +152,20 @@ DETOUR_DECL_MEMBER1(DetourTerminateRound, void, int, reason)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, something, bool, toss)
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, Vector, vec, bool, unknown)
|
||||||
|
#else
|
||||||
|
DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, bDropShield, bool, bThrowForward)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (g_pIgnoreCSWeaponDropDetour)
|
if (g_pIgnoreCSWeaponDropDetour)
|
||||||
{
|
{
|
||||||
g_pIgnoreCSWeaponDropDetour = false;
|
g_pIgnoreCSWeaponDropDetour = false;
|
||||||
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, something, toss);
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, vec, unknown);
|
||||||
|
#else
|
||||||
|
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bDropShield, bThrowForward);
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,8 +178,14 @@ DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, somet
|
|||||||
g_pCSWeaponDropForward->Execute(&result);
|
g_pCSWeaponDropForward->Execute(&result);
|
||||||
|
|
||||||
|
|
||||||
if (result == Pl_Continue)
|
if (result >= Pl_Continue)
|
||||||
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, something, toss);
|
{
|
||||||
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, vec, unknown);
|
||||||
|
#else
|
||||||
|
DETOUR_MEMBER_CALL(DetourCSWeaponDrop)(weapon, bDropShield, bThrowForward);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -226,6 +226,20 @@ static cell_t CS_DropWeapon(IPluginContext *pContext, const cell_t *params)
|
|||||||
static ICallWrapper *pWrapper = NULL;
|
static ICallWrapper *pWrapper = NULL;
|
||||||
if (!pWrapper)
|
if (!pWrapper)
|
||||||
{
|
{
|
||||||
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
REGISTER_NATIVE_ADDR("CSWeaponDrop",
|
||||||
|
PassInfo pass[3]; \
|
||||||
|
pass[0].flags = PASSFLAG_BYVAL; \
|
||||||
|
pass[0].type = PassType_Basic; \
|
||||||
|
pass[0].size = sizeof(CBaseEntity *); \
|
||||||
|
pass[1].flags = PASSFLAG_BYVAL; \
|
||||||
|
pass[1].type = PassType_Basic; \
|
||||||
|
pass[1].size = sizeof(Vector); \
|
||||||
|
pass[2].flags = PASSFLAG_BYVAL; \
|
||||||
|
pass[2].type = PassType_Basic; \
|
||||||
|
pass[2].size = sizeof(bool); \
|
||||||
|
pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 3))
|
||||||
|
#else
|
||||||
REGISTER_NATIVE_ADDR("CSWeaponDrop",
|
REGISTER_NATIVE_ADDR("CSWeaponDrop",
|
||||||
PassInfo pass[3]; \
|
PassInfo pass[3]; \
|
||||||
pass[0].flags = PASSFLAG_BYVAL; \
|
pass[0].flags = PASSFLAG_BYVAL; \
|
||||||
@ -238,6 +252,7 @@ static cell_t CS_DropWeapon(IPluginContext *pContext, const cell_t *params)
|
|||||||
pass[2].type = PassType_Basic; \
|
pass[2].type = PassType_Basic; \
|
||||||
pass[2].size = sizeof(bool); \
|
pass[2].size = sizeof(bool); \
|
||||||
pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 3))
|
pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 3))
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CBaseEntity *pEntity;
|
CBaseEntity *pEntity;
|
||||||
@ -270,7 +285,11 @@ static cell_t CS_DropWeapon(IPluginContext *pContext, const cell_t *params)
|
|||||||
if (params[4] == 1 && g_pCSWeaponDropDetoured)
|
if (params[4] == 1 && g_pCSWeaponDropDetoured)
|
||||||
g_pIgnoreCSWeaponDropDetour = true;
|
g_pIgnoreCSWeaponDropDetour = true;
|
||||||
|
|
||||||
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
unsigned char vstk[sizeof(CBaseEntity *) * 2 + sizeof(bool) + sizeof(Vector)];
|
||||||
|
#else
|
||||||
unsigned char vstk[sizeof(CBaseEntity *) * 2 + sizeof(bool) * 2];
|
unsigned char vstk[sizeof(CBaseEntity *) * 2 + sizeof(bool) * 2];
|
||||||
|
#endif
|
||||||
unsigned char *vptr = vstk;
|
unsigned char *vptr = vstk;
|
||||||
|
|
||||||
// <psychonic> first one is always false. second is true to toss, false to just drop
|
// <psychonic> first one is always false. second is true to toss, false to just drop
|
||||||
@ -278,9 +297,15 @@ static cell_t CS_DropWeapon(IPluginContext *pContext, const cell_t *params)
|
|||||||
vptr += sizeof(CBaseEntity *);
|
vptr += sizeof(CBaseEntity *);
|
||||||
*(CBaseEntity **)vptr = pWeapon;
|
*(CBaseEntity **)vptr = pWeapon;
|
||||||
vptr += sizeof(CBaseEntity *);
|
vptr += sizeof(CBaseEntity *);
|
||||||
|
#if SOURCE_ENGINE == SE_CSGO
|
||||||
|
*(Vector *)vptr = vec3_origin;
|
||||||
|
vptr += sizeof(Vector);
|
||||||
|
*(bool *)vptr = false;
|
||||||
|
#else
|
||||||
*(bool *)vptr = false;
|
*(bool *)vptr = false;
|
||||||
vptr += sizeof(bool);
|
vptr += sizeof(bool);
|
||||||
*(bool *)vptr = (params[3]) ? true : false;
|
*(bool *)vptr = (params[3]) ? true : false;
|
||||||
|
#endif
|
||||||
|
|
||||||
pWrapper->Execute(vstk, NULL);
|
pWrapper->Execute(vstk, NULL);
|
||||||
|
|
||||||
|
@ -89,9 +89,9 @@
|
|||||||
"CSWeaponDrop"//Wildcard first 6 bytes for CS:S DM
|
"CSWeaponDrop"//Wildcard first 6 bytes for CS:S DM
|
||||||
{
|
{
|
||||||
"library" "server"
|
"library" "server"
|
||||||
"windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x56\x8B\xF1\x8B\x06\x8B\x2A\x2A\x2A\x2A\x2A\xFF\xD0\x80\x2A\x2A\x00\xF3"
|
"windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x81\xEC\x2A\x2A\x2A\x2A\x53\x8B\x5D\x08\x56\x57\x6A\x00\x68"
|
||||||
"linux" "@_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb"
|
"linux" "@_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeapon6Vectorb"
|
||||||
"mac" "@_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb"
|
"mac" "@_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeapon6Vectorb"
|
||||||
}
|
}
|
||||||
"TerminateRound"
|
"TerminateRound"
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user