From 978fa6b25285b2c380547042e185773b62d83316 Mon Sep 17 00:00:00 2001 From: komashchenko Date: Fri, 18 Dec 2020 14:10:10 +0200 Subject: [PATCH] Fix detour HandleCommand_Buy_Internal (#1406) --- extensions/cstrike/forwards.cpp | 8 ++++---- gamedata/sm-cstrike.games/game.csgo.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/cstrike/forwards.cpp b/extensions/cstrike/forwards.cpp index faaba09e..4b67a052 100644 --- a/extensions/cstrike/forwards.cpp +++ b/extensions/cstrike/forwards.cpp @@ -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(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; diff --git a/gamedata/sm-cstrike.games/game.csgo.txt b/gamedata/sm-cstrike.games/game.csgo.txt index 689d2b6f..3424ecad 100644 --- a/gamedata/sm-cstrike.games/game.csgo.txt +++ b/gamedata/sm-cstrike.games/game.csgo.txt @@ -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"