From 8d8a2cdd0b085b4f9637255af3c103eb3c6a3f2e Mon Sep 17 00:00:00 2001 From: rei-2 <174158077+rei-2@users.noreply.github.com> Date: Mon, 2 Jun 2025 20:10:33 -0400 Subject: [PATCH] fixes 0 lerp toggle clearchat command --- .../Aimbot/AimbotGlobal/AimbotGlobal.cpp | 4 +- .../Aimbot/AimbotGlobal/AimbotGlobal.h | 2 +- .../AimbotProjectile/AimbotProjectile.cpp | 8 +++ .../src/Features/Aimbot/AutoHeal/AutoHeal.cpp | 53 +++++++++++++------ .../src/Features/Aimbot/AutoHeal/AutoHeal.h | 10 +++- Amalgam/src/Features/Commands/Commands.cpp | 5 ++ Amalgam/src/Features/ImGui/Menu/Menu.cpp | 13 ++--- .../Features/PacketManip/FakeLag/FakeLag.cpp | 5 +- Amalgam/src/Features/Players/PlayerUtils.cpp | 14 +++-- Amalgam/src/Features/Ticks/Ticks.cpp | 2 +- Amalgam/src/Hooks/GetClientInterpAmount.cpp | 3 ++ Amalgam/src/Hooks/IEngineVGui_Paint.cpp | 6 ++- .../Interfaces/CClientModeShared.h | 6 +++ Amalgam/src/SDK/Globals.h | 2 +- Amalgam/src/SDK/SDK.cpp | 46 ++++++++++------ Amalgam/src/SDK/Vars.h | 9 ++-- Amalgam/src/Utils/CrashLog/CrashLog.cpp | 16 +++--- Amalgam/src/Utils/Memory/Memory.cpp | 14 +++++ Amalgam/src/Utils/Memory/Memory.h | 2 + 19 files changed, 151 insertions(+), 69 deletions(-) diff --git a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp index e4c8ea69..f0e01bcc 100644 --- a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.cpp @@ -259,9 +259,9 @@ bool CAimbotGlobal::ShouldIgnore(CBaseEntity* pEntity, CTFPlayer* pLocal, CTFWea return true; } -int CAimbotGlobal::GetPriority(int targetIdx) +int CAimbotGlobal::GetPriority(int iIndex) { - return F::PlayerUtils.GetPriority(targetIdx); + return F::PlayerUtils.GetPriority(iIndex); } bool CAimbotGlobal::ShouldAim() diff --git a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h index 96ad5edb..b729c188 100644 --- a/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h +++ b/Amalgam/src/Features/Aimbot/AimbotGlobal/AimbotGlobal.h @@ -29,7 +29,7 @@ public: bool IsHitboxValid(uint32_t uHash, int nHitbox, int iHitboxes = Vars::Aimbot::Hitscan::HitboxesEnum::Head | Vars::Aimbot::Hitscan::HitboxesEnum::Body | Vars::Aimbot::Hitscan::HitboxesEnum::Pelvis | Vars::Aimbot::Hitscan::HitboxesEnum::Arms | Vars::Aimbot::Hitscan::HitboxesEnum::Legs); bool ShouldIgnore(CBaseEntity* pTarget, CTFPlayer* pLocal, CTFWeaponBase* pWeapon); - int GetPriority(int targetIdx); + int GetPriority(int iIndex); bool ShouldAim(); bool ShouldHoldAttack(CTFWeaponBase* pWeapon); diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp index abda5bb0..2d43fc4f 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp @@ -1883,6 +1883,14 @@ bool CAimbotProjectile::RunMain(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUser } } + switch (nWeaponID) + { + case TF_WEAPON_BAT_WOOD: + case TF_WEAPON_BAT_GIFTWRAP: + case TF_WEAPON_LUNCHBOX: + if (iRealAimType && G::Throwing == 1) + G::Attacking = 1; + } Aim(pCmd, tTarget.m_vAngleTo); if (G::PSilentAngles) { diff --git a/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp b/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp index 2cf4896d..9d22e81c 100644 --- a/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp +++ b/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.cpp @@ -32,7 +32,9 @@ static inline Vec3 PredictOrigin(Vec3& vOrigin, Vec3 vVelocity, float flLatency, CTraceFilterWorldAndPropsOnly filter = {}; SDK::TraceHull(vOrigin, vTo, vMins, vMaxs, nMask, &filter, &trace); - //G::SweptStorage.emplace_back(std::pair(trace.startpos, trace.endpos), vMins, vMaxs, Vec3(), I::GlobalVars->curtime + 60.f, Color_t(255, 255, 255, 10), true); +#ifdef DEBUG_VACCINATOR + G::SweptStorage.emplace_back(std::pair(trace.startpos, trace.endpos), vMins, vMaxs, Vec3(), I::GlobalVars->curtime + 60.f, Color_t(255, 255, 255, 10), true); +#endif Vec3 vOrigin2 = vOrigin + (vTo - vOrigin) * trace.fraction; if (trace.DidHit() && flNormal) vOrigin2 += trace.plane.normal * flNormal; @@ -65,8 +67,10 @@ static inline bool TraceToEntity(CTFPlayer* pPlayer, CBaseEntity* pEntity, Vec3& for (auto& vPoint : vPoints) { SDK::Trace(vPlayerOrigin + vPoint, vEntityOrigin, nMask, &filter, &trace); - //if (trace.fraction == 1.f) - // G::LineStorage.emplace_back(std::pair(trace.startpos, trace.endpos), I::GlobalVars->curtime + 60.f, Color_t(0, 255, 0, 25), true); +#ifdef DEBUG_VACCINATOR + if (trace.fraction == 1.f) + G::LineStorage.emplace_back(std::pair(trace.startpos, trace.endpos), I::GlobalVars->curtime + 60.f, Color_t(0, 255, 0, 25), true); +#endif if (trace.fraction == 1.f) return true; } @@ -74,8 +78,10 @@ static inline bool TraceToEntity(CTFPlayer* pPlayer, CBaseEntity* pEntity, Vec3& else { SDK::Trace(vPlayerOrigin, vEntityOrigin, nMask, &filter, &trace); - //if (trace.fraction == 1.f) - // G::LineStorage.emplace_back(std::pair(trace.startpos, trace.endpos), I::GlobalVars->curtime + 60.f, Color_t(0, 255, 0, 25), true); +#ifdef DEBUG_VACCINATOR + if (trace.fraction == 1.f) + G::LineStorage.emplace_back(std::pair(trace.startpos, trace.endpos), I::GlobalVars->curtime + 60.f, Color_t(0, 255, 0, 25), true); +#endif return trace.fraction == 1.f; } @@ -207,7 +213,9 @@ void CAutoHeal::GetDangers(CTFPlayer* pTarget, bool bVaccinator, float& flBullet if (bCheater) // may use seed pred +/ crits flDistanceDanger = std::max(flDistanceDanger, bCrits ? 1.f : 0.34f); +#ifdef DEBUG_VACCINATOR //SDK::Output("Hitscan", std::format("{}, {}, {}, {}, {}", flDamage, flSpread, flDamageInLatency, flDamageDanger, flDistanceDanger).c_str(), { 255, 200, 200 }, Vars::Debug::Logging.Value); +#endif flBulletDanger += flDamageDanger * flDistanceDanger; break; } @@ -242,7 +250,9 @@ void CAutoHeal::GetDangers(CTFPlayer* pTarget, bool bVaccinator, float& flBullet float flDamageDanger = flDamageInLatency / iPlayerHealth; float flDistanceDanger = Math::RemapVal(flDistance, flRadius, flRadius, 1.f, 0.001f); - //SDK::Output("Projectile", std::format("{}, {}, {}, {}", flDamage, flDamageInLatency, flDamageDanger, flDistanceDanger).c_str(), { 255, 200, 200 }, Vars::Debug::Logging.Value); +#ifdef DEBUG_VACCINATOR + SDK::Output("Projectile", std::format("{}, {}, {}, {}", flDamage, flDamageInLatency, flDamageDanger, flDistanceDanger).c_str(), { 255, 200, 200 }, Vars::Debug::Logging.Value); +#endif switch (iType) { case MEDIGUN_BULLET_RESIST: flBulletDanger += flDamageDanger * flDistanceDanger; break; @@ -285,7 +295,9 @@ void CAutoHeal::GetDangers(CTFPlayer* pTarget, bool bVaccinator, float& flBullet float flDamageDanger = flDamageInLatency / iPlayerHealth; float flDistanceDanger = Math::RemapVal(flDistance, 1100.f, 3200.f, 1.f, 0.001f); - //SDK::Output("Sentry", std::format("{}, {}, {}, {}", flDamage, flDamageInLatency, flDamageDanger, flDistanceDanger).c_str(), { 255, 200, 200 }, Vars::Debug::Logging.Value); +#ifdef DEBUG_VACCINATOR + SDK::Output("Sentry", std::format("{}, {}, {}, {}", flDamage, flDamageInLatency, flDamageDanger, flDistanceDanger).c_str(), { 255, 200, 200 }, Vars::Debug::Logging.Value); +#endif flBulletDanger += flDamageDanger * flDistanceDanger; } @@ -462,8 +474,10 @@ void CAutoHeal::GetDangers(CTFPlayer* pTarget, bool bVaccinator, float& flBullet float flDamageDanger = flDamage / iPlayerHealth; float flDistanceDanger = Math::RemapVal(pTarget->m_vecOrigin().DistTo(vProjectileOrigin), flRadius, flRadius, 1.f, 0.001f); - //G::SphereStorage.emplace_back(vProjectileOrigin, flRadius, 36, 36, I::GlobalVars->curtime + 60.f, Color_t(255, 255, 255, 1), Color_t(0, 0, 0, 0), true); - //SDK::Output(std::format("Projectile {}", iType).c_str(), std::format("{}, {}, {}", flDamage, flDamageDanger, flDistanceDanger).c_str(), { 255, 200, 200 }, Vars::Debug::Logging.Value); +#ifdef DEBUG_VACCINATOR + G::SphereStorage.emplace_back(vProjectileOrigin, flRadius, 36, 36, I::GlobalVars->curtime + 60.f, Color_t(255, 255, 255, 1), Color_t(0, 0, 0, 0), true); + SDK::Output(std::format("Projectile {}", iType).c_str(), std::format("{}, {}, {}", flDamage, flDamageDanger, flDistanceDanger).c_str(), { 255, 200, 200 }, Vars::Debug::Logging.Value); +#endif switch (iType) { case MEDIGUN_BULLET_RESIST: @@ -537,13 +551,18 @@ void CAutoHeal::AutoVaccinator(CTFPlayer* pLocal, CWeaponMedigun* pWeapon, CUser if (!Vars::Aimbot::Healing::AutoVaccinator.Value || pWeapon->GetMedigunType() != MEDIGUN_RESIST) return; - //G::LineStorage.clear(); - //G::SweptStorage.clear(); - //G::SphereStorage.clear(); +#ifdef DEBUG_VACCINATOR + G::LineStorage.clear(); + G::SweptStorage.clear(); + G::SphereStorage.clear(); +#endif if (m_iResistType == -1) m_iResistType = pWeapon->GetResistType(); - +#ifdef DEBUG_VACCINATOR + vResistDangers = { +#else std::vector> vResistDangers = { +#endif { 0.f, MEDIGUN_BULLET_RESIST }, { 0.f, MEDIGUN_BLAST_RESIST }, { 0.f, MEDIGUN_FIRE_RESIST } @@ -676,7 +695,9 @@ void CAutoHeal::Event(IGameEvent* pEvent, uint32_t uHash) } m_flDamagedTime = 1.f; - //SDK::Output("Hurt", std::format("{}, {}", m_iDamagedType, m_flDamagedDPS).c_str(), { 255, 100, 100 }); +#ifdef DEBUG_VACCINATOR + SDK::Output("Hurt", std::format("{}, {}", m_iDamagedType, m_flDamagedDPS).c_str(), { 255, 100, 100 }); +#endif break; } case FNV1A::Hash32Const("player_spawn"): @@ -684,7 +705,7 @@ void CAutoHeal::Event(IGameEvent* pEvent, uint32_t uHash) } } -/* +#ifdef DEBUG_VACCINATOR void CAutoHeal::Draw(CTFPlayer* pLocal) { auto pWeapon = H::Entities.GetWeapon()->As(); @@ -700,4 +721,4 @@ void CAutoHeal::Draw(CTFPlayer* pLocal) for (auto& [flDanger, iResist] : vResistDangers) H::Draw.StringOutlined(fFont, x, y += nTall, Vars::Menu::Theme::Active.Value, Vars::Menu::Theme::Background.Value, ALIGN_TOP, std::format("{}: {:.3f}", iResist == MEDIGUN_BULLET_RESIST ? "Bullet" : iResist == MEDIGUN_BLAST_RESIST ? "Blast" : "Fire", flDanger).c_str()); } -*/ \ No newline at end of file +#endif \ No newline at end of file diff --git a/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.h b/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.h index c76069c1..7765f7cd 100644 --- a/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.h +++ b/Amalgam/src/Features/Aimbot/AutoHeal/AutoHeal.h @@ -1,6 +1,8 @@ #pragma once #include "../../../SDK/SDK.h" +#define DEBUG_VACCINATOR + class CAutoHeal { void ActivateOnVoice(CTFPlayer* pLocal, CWeaponMedigun* pWeapon, CUserCmd* pCmd); @@ -19,12 +21,16 @@ class CAutoHeal float m_flDamagedDPS = -1; float m_flDamagedTime = 0.f; - //std::vector> vResistDangers = {}; +#ifdef DEBUG_VACCINATOR + std::vector> vResistDangers = {}; +#endif public: void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); void Event(IGameEvent* pEvent, uint32_t uHash); - //void Draw(CTFPlayer* pLocal); +#ifdef DEBUG_VACCINATOR + void Draw(CTFPlayer* pLocal); +#endif std::unordered_map m_mMedicCallers = {}; }; diff --git a/Amalgam/src/Features/Commands/Commands.cpp b/Amalgam/src/Features/Commands/Commands.cpp index 44d22f66..6546d164 100644 --- a/Amalgam/src/Features/Commands/Commands.cpp +++ b/Amalgam/src/Features/Commands/Commands.cpp @@ -76,6 +76,11 @@ void CCommands::Initialize() SDK::Output(std::format("Value of {} is {}", sCVar, pCVar->GetString()).c_str()); }); + Register("clearchat", [](const std::deque& vArgs) + { + I::ClientModeShared->m_pChatElement->SetText(""); + }); + Register("menu", [](const std::deque& vArgs) { I::MatSystemSurface->SetCursorAlwaysVisible(F::Menu.m_bIsOpen = !F::Menu.m_bIsOpen); diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.cpp b/Amalgam/src/Features/ImGui/Menu/Menu.cpp index 76b3eeb1..baa03cbb 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.cpp +++ b/Amalgam/src/Features/ImGui/Menu/Menu.cpp @@ -1205,18 +1205,19 @@ void CMenu::MenuVisuals(int iTab) { if (Section("Removals", 8)) { - FToggle(Vars::Visuals::Removals::Scope, FToggleEnum::Left); - FToggle(Vars::Visuals::Removals::Interpolation, FToggleEnum::Right); + FToggle(Vars::Visuals::Removals::Interpolation, FToggleEnum::Left); + FToggle(Vars::Visuals::Removals::NoLerp, FToggleEnum::Right); FToggle(Vars::Visuals::Removals::Disguises, FToggleEnum::Left); - FToggle(Vars::Visuals::Removals::ScreenOverlays, FToggleEnum::Right); - FToggle(Vars::Visuals::Removals::Taunts, FToggleEnum::Left); + FToggle(Vars::Visuals::Removals::Taunts, FToggleEnum::Right); + FToggle(Vars::Visuals::Removals::Scope, FToggleEnum::Left); + FToggle(Vars::Visuals::Removals::PostProcessing, FToggleEnum::Right); + FToggle(Vars::Visuals::Removals::ScreenOverlays, FToggleEnum::Left); FToggle(Vars::Visuals::Removals::ScreenEffects, FToggleEnum::Right); FToggle(Vars::Visuals::Removals::ViewPunch, FToggleEnum::Left); FToggle(Vars::Visuals::Removals::AngleForcing, FToggleEnum::Right); - FToggle(Vars::Visuals::Removals::PostProcessing, FToggleEnum::Left); - FToggle(Vars::Visuals::Removals::MOTD, FToggleEnum::Right); FToggle(Vars::Visuals::Removals::Ragdolls, FToggleEnum::Left); FToggle(Vars::Visuals::Removals::Gibs, FToggleEnum::Right); + FToggle(Vars::Visuals::Removals::MOTD, FToggleEnum::Left); } EndSection(); if (Section("UI")) { diff --git a/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp b/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp index 2ef04bdb..18a6ce84 100644 --- a/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp +++ b/Amalgam/src/Features/PacketManip/FakeLag/FakeLag.cpp @@ -36,8 +36,9 @@ bool CFakeLag::IsAllowed(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pC return I::ClientState->chokedcommands < m_iGoal; case Vars::Fakelag::FakelagEnum::Adaptive: { - const Vec3 vDelta = m_vLastPosition - pLocal->m_vecOrigin(); - return vDelta.Length2DSqr() < 4096.f; + static auto sv_lagcompensation_teleport_dist = U::ConVars.FindVar("sv_lagcompensation_teleport_dist"); + const float flDist = powf(sv_lagcompensation_teleport_dist->GetFloat(), 2.f); + return (m_vLastPosition - pLocal->m_vecOrigin()).Length2DSqr() < flDist; } } diff --git a/Amalgam/src/Features/Players/PlayerUtils.cpp b/Amalgam/src/Features/Players/PlayerUtils.cpp index 6c4f78fa..cfc28f23 100644 --- a/Amalgam/src/Features/Players/PlayerUtils.cpp +++ b/Amalgam/src/Features/Players/PlayerUtils.cpp @@ -185,13 +185,11 @@ int CPlayerlistUtils::GetPriority(uint32_t uFriendsID, bool bCache) if (!tTag.m_bLabel) vPriorities.push_back(tTag.m_iPriority); } + if (vPriorities.empty()) + return iDefault; - if (vPriorities.size()) - { - std::sort(vPriorities.begin(), vPriorities.end(), std::greater()); - return *vPriorities.begin(); - } - return iDefault; + std::sort(vPriorities.begin(), vPriorities.end(), std::greater()); + return vPriorities.front(); } int CPlayerlistUtils::GetPriority(int iIndex, bool bCache) { @@ -266,10 +264,10 @@ PriorityLabel_t* CPlayerlistUtils::GetSignificantTag(uint32_t uFriendsID, int iM vTags.push_back(_pTag); } } - if (!vTags.size()) + if (vTags.empty()) return nullptr; - std::sort(vTags.begin(), vTags.end(), [&](const auto a, const auto b) -> bool + std::sort(vTags.begin(), vTags.end(), [&](const PriorityLabel_t* a, const PriorityLabel_t* b) -> bool { // sort by priority if unequal if (a->m_iPriority != b->m_iPriority) diff --git a/Amalgam/src/Features/Ticks/Ticks.cpp b/Amalgam/src/Features/Ticks/Ticks.cpp index a742d99a..04c4b5d1 100644 --- a/Amalgam/src/Features/Ticks/Ticks.cpp +++ b/Amalgam/src/Features/Ticks/Ticks.cpp @@ -103,7 +103,7 @@ void CTickshiftHandler::SaveShootAngle(CUserCmd* pCmd, bool bSendPacket) if (bSendPacket) m_bShootAngle = false; - if (!m_bShootAngle && G::Attacking == 1 && sv_maxusrcmdprocessticks_holdaim->GetBool()) + else if (!m_bShootAngle && G::Attacking == 1 && sv_maxusrcmdprocessticks_holdaim->GetBool()) m_vShootAngle = pCmd->viewangles, m_bShootAngle = true; } Vec3* CTickshiftHandler::GetShootAngle() diff --git a/Amalgam/src/Hooks/GetClientInterpAmount.cpp b/Amalgam/src/Hooks/GetClientInterpAmount.cpp index 04421893..aa7f944f 100644 --- a/Amalgam/src/Hooks/GetClientInterpAmount.cpp +++ b/Amalgam/src/Hooks/GetClientInterpAmount.cpp @@ -12,6 +12,9 @@ MAKE_HOOK(GetClientInterpAmount, S::GetClientInterpAmount(), float, return CALL_ORIGINAL(); #endif + if (Vars::Visuals::Removals::NoLerp.Value) + return CALL_ORIGINAL(); + static const auto dwDesired1 = S::CNetGraphPanel_DrawTextFields_GetClientInterpAmount_Call1(); static const auto dwDesired2 = S::CNetGraphPanel_DrawTextFields_GetClientInterpAmount_Call2(); const auto dwRetAddr = uintptr_t(_ReturnAddress()); diff --git a/Amalgam/src/Hooks/IEngineVGui_Paint.cpp b/Amalgam/src/Hooks/IEngineVGui_Paint.cpp index 775bfa9a..83eb020f 100644 --- a/Amalgam/src/Hooks/IEngineVGui_Paint.cpp +++ b/Amalgam/src/Hooks/IEngineVGui_Paint.cpp @@ -13,7 +13,7 @@ #include "../Features/Visuals/ESP/ESP.h" #include "../Features/Visuals/CameraWindow/CameraWindow.h" #include "../Features/Visuals/Notifications/Notifications.h" -//#include "../Features/Aimbot/AutoHeal/AutoHeal.h" +#include "../Features/Aimbot/AutoHeal/AutoHeal.h" MAKE_HOOK(IEngineVGui_Paint, U::Memory.GetVirtual(I::EngineVGui, 14), void, void* rcx, int iMode) @@ -43,7 +43,9 @@ MAKE_HOOK(IEngineVGui_Paint, U::Memory.GetVirtual(I::EngineVGui, 14), void, F::Aimbot.Draw(pLocal); F::Radar.Run(pLocal); - //F::AutoHeal.Draw(pLocal); +#ifdef DEBUG_VACCINATOR + F::AutoHeal.Draw(pLocal); +#endif F::NoSpreadHitscan.Draw(pLocal); F::PlayerConditions.Draw(pLocal); F::Backtrack.Draw(pLocal); diff --git a/Amalgam/src/SDK/Definitions/Interfaces/CClientModeShared.h b/Amalgam/src/SDK/Definitions/Interfaces/CClientModeShared.h index d5997c8c..cec8d688 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces/CClientModeShared.h +++ b/Amalgam/src/SDK/Definitions/Interfaces/CClientModeShared.h @@ -14,6 +14,12 @@ class CBaseHudChat public: VIRTUAL_ARGS(ChatPrintf, void, 19, (int pIndex, const char* fmt, ...), this, pIndex, 0, fmt); VIRTUAL_ARGS(StartMessageMode, void, 20, (int iMessageModeType), this, iMessageModeType); + + inline void SetText(const char* text) + { + if (auto pChatHistory = *reinterpret_cast(uintptr_t(this) + 688)) + U::Memory.CallVirtual<239, void>(pChatHistory, text); + } }; class CClientModeShared : public IClientMode, public CGameEventListener diff --git a/Amalgam/src/SDK/Globals.h b/Amalgam/src/SDK/Globals.h index 843b8a88..716c6f7e 100644 --- a/Amalgam/src/SDK/Globals.h +++ b/Amalgam/src/SDK/Globals.h @@ -88,7 +88,7 @@ namespace G inline bool CanPrimaryAttack = false; inline bool CanSecondaryAttack = false; inline bool CanHeadshot = false; - inline bool Throwing = false; + inline int Throwing = false; inline float Lerp = 0.015f; inline EWeaponType PrimaryWeaponType = {}, SecondaryWeaponType = {}; diff --git a/Amalgam/src/SDK/SDK.cpp b/Amalgam/src/SDK/SDK.cpp index e668ce8a..885b8506 100644 --- a/Amalgam/src/SDK/SDK.cpp +++ b/Amalgam/src/SDK/SDK.cpp @@ -474,14 +474,21 @@ int SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* case TF_WEAPON_BAT_WOOD: case TF_WEAPON_BAT_GIFTWRAP: { - static int iThrowTick = 0; - if (iThrowTick + 5 < iTickBase) - iThrowTick = 0; - if (G::CanPrimaryAttack && pWeapon->HasPrimaryAmmoForShot() && pCmd->buttons & IN_ATTACK2 && !iThrowTick) - iThrowTick = iTickBase + 11; - if (iThrowTick >= iTickBase) - G::CanSecondaryAttack = G::Throwing = true; - if (iThrowTick && iThrowTick <= iTickBase) + static int iThrowTick = -5; + { + static int iLastTickBase = iTickBase; + if (iTickBase != iLastTickBase) + iThrowTick = std::max(iThrowTick - 1, -5); + iLastTickBase = iTickBase; + } + + if (G::CanPrimaryAttack && pWeapon->HasPrimaryAmmoForShot() && pCmd->buttons & IN_ATTACK2 && iThrowTick == -5) + iThrowTick = 12; + if (iThrowTick > -5) + G::Throwing = G::CanSecondaryAttack = true; + if (iThrowTick > 1) + G::Throwing = 2; + if (iThrowTick == 1) return true; } } @@ -529,15 +536,22 @@ int SDK::IsAttacking(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, const CUserCmd* case TF_WEAPON_JAR_MILK: case TF_WEAPON_JAR_GAS: { + static int iThrowTick = -5; + { + static int iLastTickBase = iTickBase; + if (iTickBase != iLastTickBase) + iThrowTick = std::max(iThrowTick - 1, -5); + iLastTickBase = iTickBase; + } + const int iAttack = pWeapon->GetWeaponID() == TF_WEAPON_CLEAVER ? IN_ATTACK | IN_ATTACK2 : IN_ATTACK; - static int iThrowTick = 0; - if (iThrowTick < iTickBase) - iThrowTick = 0; - if (G::CanPrimaryAttack && pWeapon->HasPrimaryAmmoForShot() && pCmd->buttons & iAttack && !iThrowTick) - iThrowTick = iTickBase + 11; - if (iThrowTick >= iTickBase) - G::CanPrimaryAttack = G::Throwing = true; - return iThrowTick && iThrowTick <= iTickBase; + if (G::CanPrimaryAttack && pWeapon->HasPrimaryAmmoForShot() && pCmd->buttons & iAttack && iThrowTick == -5) + iThrowTick = 12; + if (iThrowTick > -5) + G::Throwing = G::CanSecondaryAttack = true; + if (iThrowTick > 1) + G::Throwing = 2; + return iThrowTick == 1; } case TF_WEAPON_GRAPPLINGHOOK: { diff --git a/Amalgam/src/SDK/Vars.h b/Amalgam/src/SDK/Vars.h index 791a2687..b5e324b1 100644 --- a/Amalgam/src/SDK/Vars.h +++ b/Amalgam/src/SDK/Vars.h @@ -713,18 +713,19 @@ namespace Vars SUBNAMESPACE_END(ThirdPerson); SUBNAMESPACE_BEGIN(Removals) - CVar(Scope, VA_LIST("Scope", "Scope removal"), false, VISUAL); CVar(Interpolation, VA_LIST("Interpolation", "Interpolation removal"), false); + CVar(NoLerp, VA_LIST("0 lerp", "0 lerp removal"), false); CVar(Disguises, VA_LIST("Disguises", "Disguises removal"), false, VISUAL); - CVar(ScreenOverlays, VA_LIST("Screen overlays", "Screen overlays removal"), false, VISUAL); CVar(Taunts, VA_LIST("Taunts", "Taunts removal"), false, VISUAL); + CVar(Scope, VA_LIST("Scope", "Scope removal"), false, VISUAL); + CVar(PostProcessing, VA_LIST("Post processing", "Post processing removal"), false, VISUAL); + CVar(ScreenOverlays, VA_LIST("Screen overlays", "Screen overlays removal"), false, VISUAL); CVar(ScreenEffects, VA_LIST("Screen effects", "Screen effects removal"), false, VISUAL); CVar(ViewPunch, VA_LIST("View punch", "View punch removal"), false, VISUAL); CVar(AngleForcing, VA_LIST("Angle forcing", "Angle forcing removal"), false, VISUAL); - CVar(PostProcessing, VA_LIST("Post processing", "Post processing removal"), false, VISUAL); - CVar(MOTD, VA_LIST("MOTD", "MOTD removal"), false, VISUAL); CVar(Ragdolls, VA_LIST("Ragdolls", "Ragdoll removal"), false, VISUAL); CVar(Gibs, VA_LIST("Gibs", "Gib removal"), false, VISUAL); + CVar(MOTD, VA_LIST("MOTD", "MOTD removal"), false, VISUAL); SUBNAMESPACE_END(Removals); SUBNAMESPACE_BEGIN(Effects) diff --git a/Amalgam/src/Utils/CrashLog/CrashLog.cpp b/Amalgam/src/Utils/CrashLog/CrashLog.cpp index 33babe73..7932d7f9 100644 --- a/Amalgam/src/Utils/CrashLog/CrashLog.cpp +++ b/Amalgam/src/Utils/CrashLog/CrashLog.cpp @@ -13,8 +13,8 @@ struct Frame { std::string m_sModule = ""; - uintptr_t m_pBase = 0; - uintptr_t m_pAddress = 0; + uintptr_t m_uBase = 0; + uintptr_t m_uAddress = 0; std::string m_sFile = ""; unsigned int m_uLine = 0; std::string m_sName = ""; @@ -43,17 +43,17 @@ static std::deque StackTrace(PCONTEXT context) { Frame tFrame = {}; - tFrame.m_pAddress = frame.AddrPC.Offset; + tFrame.m_uAddress = frame.AddrPC.Offset; if (auto hBase = HINSTANCE(SymGetModuleBase64(hProcess, frame.AddrPC.Offset))) { - tFrame.m_pBase = uintptr_t(hBase); + tFrame.m_uBase = uintptr_t(hBase); char buffer[MAX_PATH]; if (GetModuleBaseName(hProcess, hBase, buffer, sizeof(buffer) / sizeof(char))) tFrame.m_sModule = buffer; else - tFrame.m_sModule = std::format("{:#x}", tFrame.m_pBase); + tFrame.m_sModule = std::format("{:#x}", tFrame.m_uBase); } { @@ -121,10 +121,10 @@ static LONG APIENTRY ExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo) { for (auto& tFrame : vTrace) { - if (tFrame.m_pBase) - ssErrorStream << std::format("{}+{:#x}", tFrame.m_sModule, tFrame.m_pAddress - tFrame.m_pBase); + if (tFrame.m_uBase) + ssErrorStream << std::format("{}+{:#x}", tFrame.m_sModule, tFrame.m_uAddress - tFrame.m_uBase); else - ssErrorStream << std::format("{:#x}", tFrame.m_pAddress); + ssErrorStream << std::format("{:#x}", tFrame.m_uAddress); if (!tFrame.m_sFile.empty()) ssErrorStream << std::format(" ({} L{})", tFrame.m_sFile, tFrame.m_uLine); if (!tFrame.m_sName.empty()) diff --git a/Amalgam/src/Utils/Memory/Memory.cpp b/Amalgam/src/Utils/Memory/Memory.cpp index 3c5a130e..18ff33ce 100644 --- a/Amalgam/src/Utils/Memory/Memory.cpp +++ b/Amalgam/src/Utils/Memory/Memory.cpp @@ -104,4 +104,18 @@ PVOID CMemory::FindInterface(const char* szModule, const char* szObject) return nullptr; return fnCreateInterface(szObject, nullptr); +} + +std::string CMemory::GetModuleOffset(uintptr_t uAddress) +{ + HMODULE hModule; + if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, LPCSTR(uAddress), &hModule)) + return std::format("{:#x}", uAddress); + + uintptr_t uBase = uintptr_t(hModule); + char buffer[MAX_PATH]; + if (!GetModuleBaseName(GetCurrentProcess(), hModule, buffer, sizeof(buffer) / sizeof(char))) + return std::format("{:#x}+{:#x}", uBase, uAddress - uBase); + + return std::format("{}+{:#x}", buffer, uAddress - uBase); } \ No newline at end of file diff --git a/Amalgam/src/Utils/Memory/Memory.h b/Amalgam/src/Utils/Memory/Memory.h index fc08a81e..32aa0603 100644 --- a/Amalgam/src/Utils/Memory/Memory.h +++ b/Amalgam/src/Utils/Memory/Memory.h @@ -3,6 +3,7 @@ #include #include #include +#include class CMemory { @@ -11,6 +12,7 @@ public: std::vector PatternToInt(const char* szPattern); uintptr_t FindSignature(const char* szModule, const char* szPattern); PVOID FindInterface(const char* szModule, const char* szObject); + std::string GetModuleOffset(uintptr_t uAddress); inline void* GetVirtual(void* p, size_t i) {