Fix detour HandleCommand_Buy_Internal (#1406)

This commit is contained in:
komashchenko 2020-12-18 14:10:10 +02:00 committed by GitHub
parent 24f90449ad
commit 978fa6b252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -24,7 +24,7 @@ CDetour *DCSWeaponDrop = NULL;
int weaponNameOffset = -1;
#if SOURCE_ENGINE == SE_CSGO
DETOUR_DECL_MEMBER3(DetourHandleBuy, int, int, iLoadoutSlot, void *, pWpnDataRef, bool, bRebuy)
DETOUR_DECL_MEMBER4(DetourHandleBuy, int, int, iLoadoutSlot, void *, pWpnDataRef, bool, bRebuy, bool, bDrop)
{
CBaseEntity *pEntity = reinterpret_cast<CBaseEntity *>(this);
int client = gamehelpers->EntityToBCompatRef(pEntity);
@ -33,14 +33,14 @@ DETOUR_DECL_MEMBER3(DetourHandleBuy, int, int, iLoadoutSlot, void *, pWpnDataRef
if (!pView)
{
return DETOUR_MEMBER_CALL(DetourHandleBuy)(iLoadoutSlot, pWpnDataRef, bRebuy);
return DETOUR_MEMBER_CALL(DetourHandleBuy)(iLoadoutSlot, pWpnDataRef, bRebuy, bDrop);
}
CCSWeaponData *pWpnData = GetCCSWeaponData(pView);
if (!pWpnData)
{
return DETOUR_MEMBER_CALL(DetourHandleBuy)(iLoadoutSlot, pWpnDataRef, bRebuy);
return DETOUR_MEMBER_CALL(DetourHandleBuy)(iLoadoutSlot, pWpnDataRef, bRebuy, bDrop);
}
const char *szClassname = *(const char **)((intptr_t)pWpnData + weaponNameOffset);
@ -79,7 +79,7 @@ DETOUR_DECL_MEMBER3(DetourHandleBuy, int, int, iLoadoutSlot, void *, pWpnDataRef
*(int *)((intptr_t)pWpnData + g_iPriceOffset) = changedPrice;
}
int ret = DETOUR_MEMBER_CALL(DetourHandleBuy)(iLoadoutSlot, pWpnDataRef, bRebuy);
int ret = DETOUR_MEMBER_CALL(DetourHandleBuy)(iLoadoutSlot, pWpnDataRef, bRebuy, bDrop);
if (g_iPriceOffset != -1)
*(int *)((intptr_t)pWpnData + g_iPriceOffset) = originalPrice;

View File

@ -123,7 +123,7 @@
"HandleCommand_Buy_Internal"//Wildcard first 6 bytes for getting address for weapon price.
{
"library" "server"
"windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x83\xEC\x0C\x53\x56\x57\x6A\x01"
"windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x83\xEC\x2C\x53\x56\x57\x6A\x01"
"linux" "\x2A\x2A\x2A\x2A\x2A\x2A\x0F\xB6\x55\x14\x89\x75\xF8\x8B\x75\x08"
"linux64" "\x2A\x2A\x2A\x2A\x2A\x2A\x41\x56\x41\x89\xCE\x41\x55\x49\x89\xD5\x41\x54\x41\x89\xF4"
"mac64" "\x2A\x2A\x2A\x2A\x2A\x2A\x41\x56\x41\x55\x41\x54\x53\x48\x83\xEC\x58\x41\x89\xCF\x49\x89\xD4"