From c1c6bf64d739538b48a301ddc5e1a988cb9b479c Mon Sep 17 00:00:00 2001 From: rei-2 <174158077+rei-2@users.noreply.github.com> Date: Sun, 13 Jul 2025 12:16:21 -0400 Subject: [PATCH] fix backtrack window with network fix disabled update boost version --- Amalgam/Amalgam.vcxproj | 4 +- Amalgam/packages.config | 2 +- Amalgam/src/Core/Core.cpp | 12 +++--- Amalgam/src/Core/Core.h | 4 +- Amalgam/src/Features/ImGui/Menu/Menu.cpp | 6 ++- .../src/Features/NetworkFix/NetworkFix.cpp | 12 +----- .../NoSpreadHitscan/NoSpreadHitscan.cpp | 4 +- Amalgam/src/Features/Visuals/ESP/ESP.cpp | 10 ++--- Amalgam/src/Features/Visuals/Visuals.cpp | 4 +- .../Hooks/CClientModeShared_CreateMove.cpp | 12 ++++-- Amalgam/src/Hooks/CL_Move.cpp | 8 +--- Amalgam/src/Hooks/GetClientInterpAmount.cpp | 2 +- Amalgam/src/SDK/SDK.cpp | 6 +++ Amalgam/src/SDK/SDK.h | 3 +- Amalgam/src/Utils/CrashLog/CrashLog.cpp | 37 +++++++++---------- README.md | 4 +- 16 files changed, 62 insertions(+), 68 deletions(-) diff --git a/Amalgam/Amalgam.vcxproj b/Amalgam/Amalgam.vcxproj index 1f200500..906466dc 100644 --- a/Amalgam/Amalgam.vcxproj +++ b/Amalgam/Amalgam.vcxproj @@ -1480,12 +1480,12 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/Amalgam/packages.config b/Amalgam/packages.config index df5d5901..92765500 100644 --- a/Amalgam/packages.config +++ b/Amalgam/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Amalgam/src/Core/Core.cpp b/Amalgam/src/Core/Core.cpp index 6cb82811..25d83ea7 100644 --- a/Amalgam/src/Core/Core.cpp +++ b/Amalgam/src/Core/Core.cpp @@ -44,25 +44,25 @@ static inline bool CheckDXLevel() void CCore::AppendFailText(const char* sMessage) { - ssFailStream << std::format("{}\n", sMessage); + m_ssFailStream << std::format("{}\n", sMessage); OutputDebugStringA(std::format("{}\n", sMessage).c_str()); } void CCore::LogFailText() { - ssFailStream << "\nBuilt @ " __DATE__ ", " __TIME__ ", " __CONFIGURATION__ "\n"; - ssFailStream << "Ctrl + C to copy. \n"; + m_ssFailStream << "\nBuilt @ " __DATE__ ", " __TIME__ ", " __CONFIGURATION__ "\n"; + m_ssFailStream << "Ctrl + C to copy. \n"; try { std::ofstream file; file.open(F::Configs.m_sConfigPath + "fail_log.txt", std::ios_base::app); - file << ssFailStream.str() + "\n\n\n"; + file << m_ssFailStream.str() + "\n\n\n"; file.close(); - ssFailStream << "Logged to Amalgam\\fail_log.txt. "; + m_ssFailStream << "Logged to Amalgam\\fail_log.txt. "; } catch (...) {} - SDK::Output("Failed to load", ssFailStream.str().c_str(), {}, false, true, false, false, false, false, MB_OK | MB_ICONERROR); + SDK::Output("Failed to load", m_ssFailStream.str().c_str(), {}, false, true, false, false, false, false, MB_OK | MB_ICONERROR); } void CCore::Load() diff --git a/Amalgam/src/Core/Core.h b/Amalgam/src/Core/Core.h index 6d24931f..0a1d4e47 100644 --- a/Amalgam/src/Core/Core.h +++ b/Amalgam/src/Core/Core.h @@ -16,11 +16,11 @@ public: bool m_bUnload = false; -private: bool m_bFailed = false; bool m_bFailed2 = false; + std::stringstream m_ssFailStream; - std::stringstream ssFailStream; +private: }; ADD_FEATURE_CUSTOM(CCore, Core, U); \ No newline at end of file diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.cpp b/Amalgam/src/Features/ImGui/Menu/Menu.cpp index 940599f3..8427d7dc 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.cpp +++ b/Amalgam/src/Features/ImGui/Menu/Menu.cpp @@ -1202,7 +1202,11 @@ void CMenu::MenuVisuals(int iTab) if (Section("Removals", 8)) { FToggle(Vars::Visuals::Removals::Interpolation, FToggleEnum::Left); - FToggle(Vars::Visuals::Removals::NoLerp, FToggleEnum::Right); + PushTransparent(Vars::Visuals::Removals::Interpolation.Value); + { + FToggle(Vars::Visuals::Removals::NoLerp, FToggleEnum::Right); + } + PopTransparent(); FToggle(Vars::Visuals::Removals::Disguises, FToggleEnum::Left); FToggle(Vars::Visuals::Removals::Taunts, FToggleEnum::Right); FToggle(Vars::Visuals::Removals::Scope, FToggleEnum::Left); diff --git a/Amalgam/src/Features/NetworkFix/NetworkFix.cpp b/Amalgam/src/Features/NetworkFix/NetworkFix.cpp index 89595dc2..6c1b45a4 100644 --- a/Amalgam/src/Features/NetworkFix/NetworkFix.cpp +++ b/Amalgam/src/Features/NetworkFix/NetworkFix.cpp @@ -19,11 +19,7 @@ void CReadPacketState::Restore() void CNetworkFix::FixInputDelay(bool bFinalTick) { static auto CL_ReadPackets = U::Hooks.m_mHooks["CL_ReadPackets"]; - if (!I::EngineClient->IsInGame() || !Vars::Misc::Game::NetworkFix.Value || !CL_ReadPackets) - return; - - auto pNetChan = I::EngineClient->GetNetChannelInfo(); - if (pNetChan && pNetChan->IsLoopback()) + if (!Vars::Misc::Game::NetworkFix.Value || !I::EngineClient->IsInGame() || SDK::IsLoopback() || !CL_ReadPackets) return; CReadPacketState Backup = {}; @@ -37,11 +33,7 @@ void CNetworkFix::FixInputDelay(bool bFinalTick) bool CNetworkFix::ShouldReadPackets() { - if (!I::EngineClient->IsInGame() || !Vars::Misc::Game::NetworkFix.Value) - return true; - - auto pNetChan = I::EngineClient->GetNetChannelInfo(); - if (pNetChan && pNetChan->IsLoopback()) + if (!Vars::Misc::Game::NetworkFix.Value || !I::EngineClient->IsInGame() || SDK::IsLoopback()) return true; m_State.Restore(); diff --git a/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp b/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp index 01201cf3..63c6451c 100644 --- a/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp +++ b/Amalgam/src/Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.cpp @@ -93,9 +93,7 @@ bool CNoSpreadHitscan::ParsePlayerPerf(std::string sMsg) if (flNewServerTime < m_flServerTime) return true; - auto pNetChan = I::EngineClient->GetNetChannelInfo(); - bool bLoopback = pNetChan && pNetChan->IsLoopback(); - + bool bLoopback = SDK::IsLoopback(); m_flServerTime = flNewServerTime; if (bLoopback) diff --git a/Amalgam/src/Features/Visuals/ESP/ESP.cpp b/Amalgam/src/Features/Visuals/ESP/ESP.cpp index b1ce49ae..180b9089 100644 --- a/Amalgam/src/Features/Visuals/ESP/ESP.cpp +++ b/Amalgam/src/Features/Visuals/ESP/ESP.cpp @@ -199,13 +199,9 @@ void CESP::StorePlayers(CTFPlayer* pLocal) if (Vars::ESP::Player.Value & Vars::ESP::PlayerEnum::Ping && pResource && !bLocal) { - auto pNetChan = I::EngineClient->GetNetChannelInfo(); - if (pNetChan && !pNetChan->IsLoopback()) - { - int iPing = pResource->m_iPing(iIndex); - if (iPing && (iPing >= 200 || iPing <= 5)) - tCache.m_vText.emplace_back(ESPTextEnum::Right, std::format("{}MS", iPing), Vars::Colors::IndicatorTextBad.Value, Vars::Menu::Theme::Background.Value); - } + int iPing = pResource->m_iPing(iIndex); + if (iPing && (iPing >= 200 || iPing <= 5)) + tCache.m_vText.emplace_back(ESPTextEnum::Right, std::format("{}MS", iPing), Vars::Colors::IndicatorTextBad.Value, Vars::Menu::Theme::Background.Value); } if (Vars::ESP::Player.Value & Vars::ESP::PlayerEnum::KDR && pResource && !bLocal) diff --git a/Amalgam/src/Features/Visuals/Visuals.cpp b/Amalgam/src/Features/Visuals/Visuals.cpp index 6feee494..dc3fef50 100644 --- a/Amalgam/src/Features/Visuals/Visuals.cpp +++ b/Amalgam/src/Features/Visuals/Visuals.cpp @@ -570,9 +570,7 @@ void CVisuals::DrawHitboxes(int iStore) { vHitboxes.clear(); - auto pNetChan = I::EngineClient->GetNetChannelInfo(); - bool bLocalhost = pNetChan && pNetChan->IsLoopback(); - + bool bLocalhost = SDK::IsLoopback(); for (auto& pEntity : H::Entities.GetGroup(EGroupType::PLAYERS_ALL)) { auto pPlayer = pEntity->As(); diff --git a/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp b/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp index 7431460d..cee80ad6 100644 --- a/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp +++ b/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp @@ -57,10 +57,14 @@ MAKE_HOOK(CClientModeShared_CreateMove, U::Memory.GetVirtual(I::ClientModeShared I::Prediction->Update(I::ClientState->m_nDeltaTick, I::ClientState->m_nDeltaTick > 0, I::ClientState->last_command_ack, I::ClientState->lastoutgoingcommand + I::ClientState->chokedcommands); - // correct tick_count for fakeinterp / nointerp - pCmd->tick_count += TICKS_TO_TIME(F::Backtrack.GetFakeInterp()) - (Vars::Visuals::Removals::Interpolation.Value ? 0 : TICKS_TO_TIME(G::Lerp)); - if (G::OriginalMove.m_iButtons & IN_DUCK) // lol - pCmd->buttons |= IN_DUCK; + if (!Vars::Misc::Game::AntiCheatCompatibility.Value) + { // correct tick_count for fakeinterp / nointerp + pCmd->tick_count += TIME_TO_TICKS(F::Backtrack.GetFakeInterp()); + if (!Vars::Visuals::Removals::Interpolation.Value && Vars::Visuals::Removals::NoLerp.Value) + pCmd->tick_count -= TIME_TO_TICKS(G::Lerp); + } + if (G::OriginalMove.m_iButtons & IN_DUCK) + pCmd->buttons |= IN_DUCK; // lol auto pLocal = H::Entities.GetLocal(); auto pWeapon = H::Entities.GetWeapon(); diff --git a/Amalgam/src/Hooks/CL_Move.cpp b/Amalgam/src/Hooks/CL_Move.cpp index 0a9a0f96..95ac8e5a 100644 --- a/Amalgam/src/Hooks/CL_Move.cpp +++ b/Amalgam/src/Hooks/CL_Move.cpp @@ -21,12 +21,8 @@ MAKE_HOOK(CL_Move, S::CL_Move(), void, return CALL_ORIGINAL(accumulated_extra_samples, bFinalTick); F::Backtrack.m_iTickCount = I::GlobalVars->tickcount + 1; - if (!Vars::Misc::Game::NetworkFix.Value) - { - auto pNetChan = I::EngineClient->GetNetChannelInfo(); - if (pNetChan && !pNetChan->IsLoopback()) - F::Backtrack.m_iTickCount++; - } + if (!Vars::Misc::Game::NetworkFix.Value && !SDK::IsLoopback()) + F::Backtrack.m_iTickCount--; auto pLocal = H::Entities.GetLocal(); auto pWeapon = H::Entities.GetWeapon(); diff --git a/Amalgam/src/Hooks/GetClientInterpAmount.cpp b/Amalgam/src/Hooks/GetClientInterpAmount.cpp index aa7f944f..9c19ba3a 100644 --- a/Amalgam/src/Hooks/GetClientInterpAmount.cpp +++ b/Amalgam/src/Hooks/GetClientInterpAmount.cpp @@ -12,7 +12,7 @@ MAKE_HOOK(GetClientInterpAmount, S::GetClientInterpAmount(), float, return CALL_ORIGINAL(); #endif - if (Vars::Visuals::Removals::NoLerp.Value) + if (Vars::Visuals::Removals::NoLerp.Value && !Vars::Visuals::Removals::Interpolation.Value) return CALL_ORIGINAL(); static const auto dwDesired1 = S::CNetGraphPanel_DrawTextFields_GetClientInterpAmount_Call1(); diff --git a/Amalgam/src/SDK/SDK.cpp b/Amalgam/src/SDK/SDK.cpp index a1c58343..fa82fe1b 100644 --- a/Amalgam/src/SDK/SDK.cpp +++ b/Amalgam/src/SDK/SDK.cpp @@ -389,6 +389,12 @@ bool SDK::PredictOrigin(Vec3& vOut, Vec3& vOrigin, Vec3 vVelocity, float flLaten return !trace.DidHit(); } +bool SDK::IsLoopback() +{ + auto pNetChan = I::EngineClient->GetNetChannelInfo(); + return pNetChan && pNetChan->IsLoopback(); +} + int SDK::GetRoundState() { if (auto pGameRules = I::TFGameRules()) diff --git a/Amalgam/src/SDK/SDK.h b/Amalgam/src/SDK/SDK.h index c3a7bdf8..27bda20f 100644 --- a/Amalgam/src/SDK/SDK.h +++ b/Amalgam/src/SDK/SDK.h @@ -88,7 +88,7 @@ namespace SDK void RandomSeed(int iSeed); int RandomInt(int iMinVal = 0, int iMaxVal = 0x7FFF); float RandomFloat(float flMinVal = 0.f, float flMaxVal = 1.f); - + bool W2S(const Vec3& vOrigin, Vec3& vScreen, bool bAlways = false); bool IsOnScreen(CBaseEntity* pEntity, const matrix3x4& mTransform, float* pLeft = nullptr, float* pRight = nullptr, float* pTop = nullptr, float* pBottom = nullptr); bool IsOnScreen(CBaseEntity* pEntity, Vec3 vOrigin); @@ -104,6 +104,7 @@ namespace SDK Vec3 PredictOrigin(Vec3& vOrigin, Vec3 vVelocity, float flLatency, bool bTrace = true, Vec3 vMins = {}, Vec3 vMaxs = {}, unsigned int nMask = MASK_SOLID, float flNormal = 0.f); bool PredictOrigin(Vec3& vOut, Vec3& vOrigin, Vec3 vVelocity, float flLatency, bool bTrace = true, Vec3 vMins = {}, Vec3 vMaxs = {}, unsigned int nMask = MASK_SOLID, float flNormal = 0.f); + bool IsLoopback(); int GetRoundState(); int GetWinningTeam(); EWeaponType GetWeaponType(CTFWeaponBase* pWeapon, EWeaponType* pSecondaryType = nullptr); diff --git a/Amalgam/src/Utils/CrashLog/CrashLog.cpp b/Amalgam/src/Utils/CrashLog/CrashLog.cpp index 7932d7f9..fa4059fc 100644 --- a/Amalgam/src/Utils/CrashLog/CrashLog.cpp +++ b/Amalgam/src/Utils/CrashLog/CrashLog.cpp @@ -20,7 +20,7 @@ struct Frame std::string m_sName = ""; }; -static std::deque StackTrace(PCONTEXT context) +static std::deque StackTrace(PCONTEXT pContext) { HANDLE hProcess = GetCurrentProcess(); HANDLE hThread = GetCurrentThread(); @@ -30,22 +30,21 @@ static std::deque StackTrace(PCONTEXT context) SymSetOptions(SYMOPT_LOAD_LINES); - STACKFRAME64 frame = {}; - frame.AddrPC.Offset = context->Rip; - frame.AddrFrame.Offset = context->Rbp; - frame.AddrStack.Offset = context->Rsp; - frame.AddrPC.Mode = AddrModeFlat; - frame.AddrFrame.Mode = AddrModeFlat; - frame.AddrStack.Mode = AddrModeFlat; + STACKFRAME64 tStackFrame = {}; + tStackFrame.AddrPC.Offset = pContext->Rip; + tStackFrame.AddrFrame.Offset = pContext->Rbp; + tStackFrame.AddrStack.Offset = pContext->Rsp; + tStackFrame.AddrPC.Mode = AddrModeFlat; + tStackFrame.AddrFrame.Mode = AddrModeFlat; + tStackFrame.AddrStack.Mode = AddrModeFlat; std::deque vTrace = {}; - while (StackWalk64(IMAGE_FILE_MACHINE_AMD64, hProcess, hThread, &frame, context, nullptr, SymFunctionTableAccess64, SymGetModuleBase64, nullptr)) + while (StackWalk64(IMAGE_FILE_MACHINE_AMD64, hProcess, hThread, &tStackFrame, pContext, nullptr, SymFunctionTableAccess64, SymGetModuleBase64, nullptr)) { Frame tFrame = {}; + tFrame.m_uAddress = tStackFrame.AddrPC.Offset; - tFrame.m_uAddress = frame.AddrPC.Offset; - - if (auto hBase = HINSTANCE(SymGetModuleBase64(hProcess, frame.AddrPC.Offset))) + if (auto hBase = HINSTANCE(SymGetModuleBase64(hProcess, tStackFrame.AddrPC.Offset))) { tFrame.m_uBase = uintptr_t(hBase); @@ -60,13 +59,13 @@ static std::deque StackTrace(PCONTEXT context) DWORD dwOffset = 0; IMAGEHLP_LINE64 line = {}; line.SizeOfStruct = sizeof(IMAGEHLP_LINE64); - if (SymGetLineFromAddr64(hProcess, frame.AddrPC.Offset, &dwOffset, &line)) + if (SymGetLineFromAddr64(hProcess, tStackFrame.AddrPC.Offset, &dwOffset, &line)) { tFrame.m_sFile = line.FileName; tFrame.m_uLine = line.LineNumber; - auto find = tFrame.m_sFile.rfind("\\"); - if (find != std::string::npos) - tFrame.m_sFile.replace(0, find + 1, ""); + auto iFind = tFrame.m_sFile.rfind("\\"); + if (iFind != std::string::npos) + tFrame.m_sFile.replace(0, iFind + 1, ""); } } @@ -76,7 +75,7 @@ static std::deque StackTrace(PCONTEXT context) auto symbol = PIMAGEHLP_SYMBOL64(buf); symbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64) + 255; symbol->MaxNameLength = 254; - if (SymGetSymFromAddr64(hProcess, frame.AddrPC.Offset, &dwOffset, symbol)) + if (SymGetSymFromAddr64(hProcess, tStackFrame.AddrPC.Offset, &dwOffset, symbol)) tFrame.m_sName = symbol->Name; } @@ -104,8 +103,8 @@ static LONG APIENTRY ExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo) mAddresses[ExceptionInfo->ExceptionRecord->ExceptionAddress] = true; std::stringstream ssErrorStream; - ssErrorStream << std::format("Error: {:#X}\n", ExceptionInfo->ExceptionRecord->ExceptionCode); - ssErrorStream << std::format("Address: {:#X}\n\n", uintptr_t(ExceptionInfo->ExceptionRecord->ExceptionAddress)); + ssErrorStream << std::format("Error: {:#x}\n\n", ExceptionInfo->ExceptionRecord->ExceptionCode); + ssErrorStream << std::format("RIP: {:#x}\n", ExceptionInfo->ContextRecord->Rip); ssErrorStream << std::format("RAX: {:#x}\n", ExceptionInfo->ContextRecord->Rax); ssErrorStream << std::format("RCX: {:#x}\n", ExceptionInfo->ContextRecord->Rcx); diff --git a/README.md b/README.md index 9ef91435..5ebf4950 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@

###### AVX2 may be faster than SSE2 though not all CPUs support it (`Steam > Help > System Information > Processor Information > AVX2`). Freetype uses freetype as the text rasterizer and includes some custom fonts, which results in better looking text but larger DLL sizes. PDBs are for developer use. -###### If nightly.link is down, you can still download through [github](https://github.com/rei-2/Amalgam/actions) with an account. +###### If nightly.link is down or can't be accessed, you can still download through [GitHub](https://github.com/rei-2/Amalgam/actions) with an account. # Amalgam @@ -36,4 +36,4 @@ [![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/rei-2/Amalgam/msbuild.yml?branch=master)](/../../actions) [![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/rei-2/Amalgam)](/../../commits/) -[VAC bypass](https://github.com/danielkrupinski/VAC-Bypass-Loader) and [Xenos](https://github.com/DarthTon/Xenos/releases) recommended \ No newline at end of file +[VAC bypass](https://github.com/danielkrupinski/VAC-Bypass-Loader) and [Xenos](https://github.com/DarthTon/Xenos/releases) recommended. \ No newline at end of file