misc changes and fixes

This commit is contained in:
rei-2
2026-02-22 03:56:24 -05:00
parent ed04dd5816
commit 89d7816a15
20 changed files with 67 additions and 69 deletions
+2 -2
View File
@@ -112,7 +112,7 @@ void CCore::Load()
if (m_bUnload = m_bFailed2 = !U::Hooks.Initialize() || !U::BytePatches.Initialize() || !H::Events.Initialize())
return;
F::Materials.LoadMaterials();
H::Fonts.Reload(Vars::Menu::Scale[DEFAULT_BIND]);
F::Configs.LoadConfig(F::Configs.m_sCurrentConfig, false);
SDK::Output("Amalgam", "Loaded", DEFAULT_COLOR, OUTPUT_CONSOLE | OUTPUT_TOAST | OUTPUT_MENU | OUTPUT_DEBUG);
@@ -145,7 +145,6 @@ void CCore::Unload()
if (F::Menu.m_bIsOpen)
I::MatSystemSurface->SetCursorAlwaysVisible(false);
F::Visuals.RestoreWorldModulation();
if (I::Input->CAM_IsThirdPerson())
{
if (auto pLocal = H::Entities.GetLocal())
@@ -154,6 +153,7 @@ void CCore::Unload()
pLocal->ThirdPersonSwitch();
}
}
F::Visuals.RestoreWorldModulation();
H::ConVars.FindVar("cl_wpn_sway_interp")->SetValue(0.f);
H::ConVars.FindVar("cl_wpn_sway_scale")->SetValue(0.f);
@@ -685,7 +685,7 @@ bool CAimbotMelee::RunSapper(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd
else
bShouldAim = pCmd->buttons & IN_ATTACK;
if (Vars::Aimbot::General::AimType.Value == Vars::Aimbot::General::AimTypeEnum::Silent)
bShouldAim = bShouldAim && !I::ClientState->chokedcommands && F::Ticks.CanChoke(true);
bShouldAim &= !I::ClientState->chokedcommands && F::Ticks.CanChoke(true);
if (bShouldAim)
{
+1 -1
View File
@@ -67,7 +67,7 @@ static inline void GetBinds(int iParent, CTFPlayer* pLocal, CTFWeaponBase* pWeap
case BindEnum::KeyEnum::Toggle: bKey = U::KeyHandler.Pressed(tBind.m_iKey, false, &tBind.m_tKeyStorage); break;
case BindEnum::KeyEnum::DoubleClick: bKey = U::KeyHandler.Double(tBind.m_iKey, false, &tBind.m_tKeyStorage); break;
}
bKey = bKey && (!s_bUI || s_bMenu && (!F::Menu.m_bWindowHovered || tBind.m_iKey != VK_LBUTTON && tBind.m_iKey != VK_RBUTTON)); // allow in menu
bKey &= !s_bUI || s_bMenu && (!F::Menu.m_bWindowHovered || tBind.m_iKey != VK_LBUTTON && tBind.m_iKey != VK_RBUTTON); // allow in menu
switch (tBind.m_iInfo)
{
+7 -7
View File
@@ -2536,17 +2536,17 @@ namespace ImGui
if (IconButton(tBind.m_iVisibility == BindVisibilityEnum::Always ? ICON_MD_VISIBILITY : ICON_MD_VISIBILITY_OFF, H::Draw.Scale(24), { 1, 1, 1, -1 }, &bHovered))
tBind.m_iVisibility = (tBind.m_iVisibility + 1) % 3;
PopTransparent(1, 1);
bLastHovered = bLastHovered || bHovered;
bLastHovered |= bHovered;
SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), H::Draw.Scale(36) });
if (IconButton(!tBind.m_bNot ? ICON_MD_CODE : ICON_MD_CODE_OFF, H::Draw.Scale(24), { 1, 1, 1, -1 }, &bHovered))
tBind.m_bNot = !tBind.m_bNot;
bLastHovered = bLastHovered || bHovered;
bLastHovered |= bHovered;
SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), H::Draw.Scale(36) });
if (IconButton(!tBind.m_bEnabled ? ICON_MD_TOGGLE_OFF : ICON_MD_TOGGLE_ON, H::Draw.Scale(24), { 1, 1, 1, -1 }, &bHovered))
tBind.m_bEnabled = !tBind.m_bEnabled;
bLastHovered = bLastHovered || bHovered;
bLastHovered |= bHovered;
PopTransparent(1, 1);
@@ -2554,7 +2554,7 @@ namespace ImGui
}
FDropdown("Type", &tBind.m_iType, { "Key", "Class", "Weapon type", "Item slot", "Misc" }, {}, FDropdownEnum::Left, 0, "None", &bHovered);
bLastHovered = bLastHovered || bHovered;
bLastHovered |= bHovered;
switch (tBind.m_iType)
{
case BindEnum::Key: FDropdown("Behavior", &tBind.m_iInfo, { "Hold", "Toggle", "Double click" }, {}, FDropdownEnum::Right, 0, "None", &bHovered); break;
@@ -2563,12 +2563,12 @@ namespace ImGui
case BindEnum::ItemSlot: FDropdown("Item slot", &tBind.m_iInfo, { "1", "2", "3", "4", "5", "6", "7", "8", "9" }, {}, FDropdownEnum::Right, 0, "None", &bHovered); break;
case BindEnum::Misc: FDropdown("Misc", &tBind.m_iInfo, { "Spectated", "Spectated 1st", "Spectated 3rd", "##Divider", "Zoomed", "Aiming" }, {}, FDropdownEnum::Right); break;
}
bLastHovered = bLastHovered || bHovered;
bLastHovered |= bHovered;
if (tBind.m_iType == BindEnum::Key)
{
FKeybind("Key", tBind.m_iKey, FKeybindEnum::None, { Vars::Menu::PrimaryKey[DEFAULT_BIND], Vars::Menu::SecondaryKey[DEFAULT_BIND] }, { 0, 30 }, 0, &bHovered);
bLastHovered = bLastHovered || bHovered;
bLastHovered |= bHovered;
}
if (!Disabled && iBind != DEFAULT_BIND && iBind < F::Binds.m_vBinds.size())
@@ -2623,7 +2623,7 @@ namespace ImGui
DrawBindInfo(var, staticVal, StripDoubleHash(sBind.c_str()), bNewPopup, bLastHovered); \
val = staticVal; \
function(std::format("{}## Bind", var.m_vNames.front()).c_str(), arguments, &bHovered); \
bLastHovered = bLastHovered || bHovered; \
bLastHovered |= bHovered; \
staticVal = val; \
PopTransparent(2); \
EndPopup(); \
+4 -5
View File
@@ -1395,7 +1395,7 @@ void CMenu::MenuLogs(int iTab)
}
SetCursorPos(vOriginalPos);
Button(std::format("##{}", tPlayer.m_iUserID).c_str(), { flWidth, flHeight });
bPopup = bPopup || IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right);
bPopup |= IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right);
// popups
if (bPopup)
@@ -2112,12 +2112,12 @@ void CMenu::MenuLogs(int iTab)
try
{
int iBackupCount = 0;
for (auto& entry : std::filesystem::directory_iterator(F::Configs.m_sCorePath))
for (auto& tEntry : std::filesystem::directory_iterator(F::Configs.m_sCorePath))
{
if (!entry.is_regular_file() || entry.path().extension() != F::Configs.m_sConfigExtension)
if (!tEntry.is_regular_file() || tEntry.path().extension() != F::Configs.m_sConfigExtension)
continue;
std::string sConfigName = entry.path().filename().string();
std::string sConfigName = tEntry.path().filename().string();
sConfigName.erase(sConfigName.end() - F::Configs.m_sConfigExtension.size(), sConfigName.end());
if (sConfigName.find("Backup") != std::string::npos)
iBackupCount++;
@@ -3138,7 +3138,6 @@ void CMenu::MenuSettings(int iTab)
EndPopup();
}
}
} EndSection();
if (Vars::Debug::Options.Value && I::EngineClient->IsConnected())
{
@@ -86,14 +86,14 @@ bool CNoSpreadHitscan::ParsePlayerPerf(const std::string& sMsg)
if (!Vars::Aimbot::General::NoSpread.Value)
return false;
std::smatch match; std::regex_match(sMsg, match, std::regex(R"((\d+.\d+)\s\d+\s\d+\s\d+.\d+\s\d+.\d+\svel\s\d+.\d+)"));
std::smatch tMatch; std::regex_match(sMsg, tMatch, std::regex(R"((\d+.\d+)\s\d+\s\d+\s\d+.\d+\s\d+.\d+\svel\s\d+.\d+)"));
if (match.size() == 2)
if (tMatch.size() == 2)
{
m_bWaitingForPlayerPerf = false;
// credits to kgb for idea
float flNewServerTime = std::stof(match[1].str());
float flNewServerTime = std::stof(tMatch[1].str());
if (flNewServerTime < m_flServerTime)
return true;
+1 -1
View File
@@ -82,7 +82,7 @@ void CResolver::FrameStageNotify()
}
}
void CResolver::CreateMove(CTFPlayer* pLocal)
void CResolver::CreateMove()
{
if (m_iWaitingForTarget != -1 && m_flWaitingForDamage < I::GlobalVars->curtime)
{
+1 -1
View File
@@ -38,7 +38,7 @@ private:
public:
void FrameStageNotify();
void CreateMove(CTFPlayer* pLocal);
void CreateMove();
void HitscanRan(CTFPlayer* pLocal, CTFPlayer* pTarget, CTFWeaponBase* pWeapon, int nHitbox = HITBOX_MAX);
void PlayerHurt(IGameEvent* pEvent);
void SetYaw(int iUserID, float flValue, bool bAuto = false);
+1 -1
View File
@@ -189,7 +189,7 @@ void CTicks::Move(float accumulated_extra_samples, bool bFinalTick)
while (m_iShiftedTicks > m_iShiftedGoal)
{
m_bShifting = m_bShifted = m_bShifted || m_iShiftedTicks - 1 != m_iShiftedGoal;
m_bShifting = m_bShifted |= m_iShiftedTicks - 1 != m_iShiftedGoal;
MoveFunc(accumulated_extra_samples, m_iShiftedTicks - 1 == m_iShiftedGoal);
}
@@ -158,17 +158,17 @@ void CMaterials::LoadMaterials()
"\n}",
true);
// user materials
for (auto& entry : std::filesystem::directory_iterator(F::Configs.m_sMaterialsPath))
for (auto& tEntry : std::filesystem::directory_iterator(F::Configs.m_sMaterialsPath))
{
// Ignore all non-material files
if (!entry.is_regular_file() || entry.path().extension() != std::string(".vmt"))
if (!tEntry.is_regular_file() || tEntry.path().extension() != std::string(".vmt"))
continue;
std::ifstream fStream(entry.path());
std::ifstream fStream(tEntry.path());
if (!fStream.good())
continue;
std::string sName = entry.path().filename().string();
std::string sName = tEntry.path().filename().string();
sName.erase(sName.end() - 4, sName.end());
std::string sVMT((std::istreambuf_iterator(fStream)), std::istreambuf_iterator<char>());
@@ -17,8 +17,7 @@ MAKE_HOOK(CBaseViewModel_CalcViewModelView, S::CBaseViewModel_CalcViewModelView(
if (Vars::Visuals::Viewmodel::ViewmodelAim.Value)
{
auto pLocal = H::Entities.GetLocal();
if (pLocal && pLocal->IsAlive() && G::AimPoint.m_iTickCount)
if (auto pLocal = H::Entities.GetLocal(); pLocal && pLocal->IsAlive() && G::AimPoint.m_iTickCount)
{
Vec3 vDiff = I::EngineClient->GetViewAngles() - Math::CalcAngle(eyePosition, G::AimPoint.m_vOrigin);
if (bFlip)
@@ -9,8 +9,7 @@ MAKE_HOOK(CClientModeShared_OverrideView, U::Memory.GetVirtual(I::ClientModeShar
CALL_ORIGINAL(rcx, pView);
auto pLocal = H::Entities.GetLocal();
if (pLocal && pView)
if (auto pLocal = H::Entities.GetLocal(); pLocal && pView)
{
F::Visuals.FOV(pLocal, pView);
F::Visuals.ThirdPerson(pLocal, pView);
+1 -1
View File
@@ -254,7 +254,7 @@ MAKE_HOOK(CHLClient_CreateMove, U::Memory.GetVirtual(I::Client, 21), void,
F::Ticks.End(pLocal, pCmd);
F::CritHack.Run(pLocal, pWeapon, pCmd);
F::NoSpread.Run(pLocal, pWeapon, pCmd);
F::Resolver.CreateMove(pLocal);
F::Resolver.CreateMove();
F::Misc.RunPost(pLocal, pCmd);
F::PacketManip.Run(pLocal, pWeapon, pCmd, pSendPacket);
F::Visuals.CreateMove(pLocal, pWeapon);
@@ -17,7 +17,7 @@ MAKE_HOOK(CL_ProcessPacketEntities, S::CL_ProcessPacketEntities(), bool,
if (entmsg->m_bIsDelta) // we won't need to restore
return CALL_ORIGINAL(entmsg);
CTFPlayer* pLocal = H::Entities.GetLocal();
auto pLocal = H::Entities.GetLocal();
if (!pLocal || !pLocal->m_hMyWeapons())
{
SDK::Output("ProcessPacketEntities", "Failed to restore weapon crit data! (1)", { 255, 100, 100 });
+31 -31
View File
@@ -121,16 +121,16 @@ static std::vector<std::function<void()>> s_vDynamic = {
while (true)
{
std::smatch match; std::regex_search(s_sCmdString, match, std::regex(sRegex));
if (match.size() != 4)
std::smatch tMatch; std::regex_search(s_sCmdString, tMatch, std::regex(sRegex));
if (tMatch.size() != 4)
break;
int r = !match[1].str().empty() ? std::stoi(match[1]) : 255;
int g = !match[2].str().empty() ? std::stoi(match[2]) : 255;
int b = !match[3].str().empty() ? std::stoi(match[3]) : 255;
int r = !tMatch[1].str().empty() ? std::stoi(tMatch[1]) : 255;
int g = !tMatch[2].str().empty() ? std::stoi(tMatch[2]) : 255;
int b = !tMatch[3].str().empty() ? std::stoi(tMatch[3]) : 255;
Color_t tColor; tColor.SetRGB(r, g, b);
s_sCmdString = s_sCmdString.replace(match.position(), match.length(), std::format(PRE_STR"{}", tColor.ToHex()));
s_sCmdString = s_sCmdString.replace(tMatch.position(), tMatch.length(), std::format(PRE_STR"{}", tColor.ToHex()));
}
},
[&]()
@@ -139,17 +139,17 @@ static std::vector<std::function<void()>> s_vDynamic = {
while (true)
{
std::smatch match; std::regex_search(s_sCmdString, match, std::regex(sRegex));
if (match.size() != 5)
std::smatch tMatch; std::regex_search(s_sCmdString, tMatch, std::regex(sRegex));
if (tMatch.size() != 5)
break;
int r = !match[1].str().empty() ? std::stoi(match[1]) : 255;
int g = !match[2].str().empty() ? std::stoi(match[2]) : 255;
int b = !match[3].str().empty() ? std::stoi(match[3]) : 255;
int a = !match[4].str().empty() ? std::stoi(match[4]) : 255;
int r = !tMatch[1].str().empty() ? std::stoi(tMatch[1]) : 255;
int g = !tMatch[2].str().empty() ? std::stoi(tMatch[2]) : 255;
int b = !tMatch[3].str().empty() ? std::stoi(tMatch[3]) : 255;
int a = !tMatch[4].str().empty() ? std::stoi(tMatch[4]) : 255;
Color_t tColor; tColor.SetRGB(r, g, b, a);
s_sCmdString = s_sCmdString.replace(match.position(), match.length(), std::format(PRE_STR"{}", tColor.ToHexA()));
s_sCmdString = s_sCmdString.replace(tMatch.position(), tMatch.length(), std::format(PRE_STR"{}", tColor.ToHexA()));
}
},
[&]()
@@ -158,16 +158,16 @@ static std::vector<std::function<void()>> s_vDynamic = {
while (true)
{
std::smatch match; std::regex_search(s_sCmdString, match, std::regex(sRegex));
if (match.size() != 4)
std::smatch tMatch; std::regex_search(s_sCmdString, tMatch, std::regex(sRegex));
if (tMatch.size() != 4)
break;
int h = !match[1].str().empty() ? std::stoi(match[1]) : 0;
int s = !match[2].str().empty() ? std::stoi(match[2]) : 100;
int v = !match[3].str().empty() ? std::stoi(match[3]) : 100;
int h = !tMatch[1].str().empty() ? std::stoi(tMatch[1]) : 0;
int s = !tMatch[2].str().empty() ? std::stoi(tMatch[2]) : 100;
int v = !tMatch[3].str().empty() ? std::stoi(tMatch[3]) : 100;
Color_t tColor; tColor.SetHSV(h, s, v);
s_sCmdString = s_sCmdString.replace(match.position(), match.length(), std::format(PRE_STR"{}", tColor.ToHex()));
s_sCmdString = s_sCmdString.replace(tMatch.position(), tMatch.length(), std::format(PRE_STR"{}", tColor.ToHex()));
}
},
[&]()
@@ -176,17 +176,17 @@ static std::vector<std::function<void()>> s_vDynamic = {
while (true)
{
std::smatch match; std::regex_search(s_sCmdString, match, std::regex(sRegex));
if (match.size() != 5)
std::smatch tMatch; std::regex_search(s_sCmdString, tMatch, std::regex(sRegex));
if (tMatch.size() != 5)
break;
int h = !match[1].str().empty() ? std::stoi(match[1]) : 0;
int s = !match[2].str().empty() ? std::stoi(match[2]) : 100;
int v = !match[3].str().empty() ? std::stoi(match[3]) : 100;
int a = !match[4].str().empty() ? std::stoi(match[4]) : 255;
int h = !tMatch[1].str().empty() ? std::stoi(tMatch[1]) : 0;
int s = !tMatch[2].str().empty() ? std::stoi(tMatch[2]) : 100;
int v = !tMatch[3].str().empty() ? std::stoi(tMatch[3]) : 100;
int a = !tMatch[4].str().empty() ? std::stoi(tMatch[4]) : 255;
Color_t tColor; tColor.SetHSV(h, s, v, a);
s_sCmdString = s_sCmdString.replace(match.position(), match.length(), std::format(PRE_STR"{}", tColor.ToHexA()));
s_sCmdString = s_sCmdString.replace(tMatch.position(), tMatch.length(), std::format(PRE_STR"{}", tColor.ToHexA()));
}
},
[&]()
@@ -195,18 +195,18 @@ static std::vector<std::function<void()>> s_vDynamic = {
while (true)
{
std::smatch match; std::regex_search(s_sCmdString, match, std::regex(sRegex));
if (match.size() != 3)
std::smatch tMatch; std::regex_search(s_sCmdString, tMatch, std::regex(sRegex));
if (tMatch.size() != 3)
break;
int n = std::stoi(match[1]);
auto str = match[2].str();
int n = std::stoi(tMatch[1]);
auto str = tMatch[2].str();
std::stringstream ssStream;
for (int i = 0; i < n; i++)
ssStream << str;
s_sCmdString = s_sCmdString.replace(match.position(), match.length(), ssStream.str());
s_sCmdString = s_sCmdString.replace(tMatch.position(), tMatch.length(), ssStream.str());
}
},
};
@@ -26,5 +26,6 @@ public:
VIRTUAL(CanBeSelected, bool, 233, this);
VIRTUAL(CheckReload, void, 278, this);
VIRTUAL(GetMaxClip1, int, 322, this);
VIRTUAL(GetMaxClip2, int, 323, this);
VIRTUAL(GetName, const char*, 334, this);
};
+3 -1
View File
@@ -6,6 +6,7 @@
MAKE_SIGNATURE(CTFPlayer_IsPlayerOnSteamFriendsList, "client.dll", "40 57 48 81 EC ? ? ? ? 48 8B FA E8", 0x0);
MAKE_SIGNATURE(TeamFortress_CalculateMaxSpeed, "client.dll", "88 54 24 ? 53 55", 0x0);
MAKE_SIGNATURE(CTFPlayer_GetMaxAmmo, "client.dll", "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 48 63 FA 48 8B F1", 0x0);
MAKE_SIGNATURE(CTFPlayer_UpdateClientSideAnimation, "client.dll", "48 89 5C 24 ? 57 48 83 EC ? 48 8B D9 E8 ? ? ? ? 48 8B F8 48 85 C0 74 ? 48 8B 00 48 8B CF FF 90 ? ? ? ? 84 C0 75 ? 33 FF 48 3B DF", 0x0);
MAKE_SIGNATURE(CTFPlayer_GetEffectiveInvisibilityLevel, "client.dll", "40 57 48 83 EC ? 0F 29 7C 24", 0x0);
MAKE_SIGNATURE(CTFPlayer_UpdateWearables, "client.dll", "40 53 48 83 EC ? 48 8B D9 E8 ? ? ? ? 48 8B 03 48 8B CB FF 90 ? ? ? ? 4C 8D 0D ? ? ? ? C7 44 24 ? ? ? ? ? 48 8B C8 4C 8D 05 ? ? ? ? 33 D2 E8 ? ? ? ? 48 85 C0", 0x0);
@@ -198,8 +199,9 @@ public:
VIRTUAL(GetMaxHealth, int, 107, this);
VIRTUAL(ThirdPersonSwitch, void, 256, this);
SIGNATURE_ARGS(CalculateMaxSpeed, float, TeamFortress, (bool bIgnoreSpecialAbility = false), this, bIgnoreSpecialAbility);
SIGNATURE(IsPlayerOnSteamFriendsList, bool, CTFPlayer, this, this);
SIGNATURE_ARGS(CalculateMaxSpeed, float, TeamFortress, (bool bIgnoreSpecialAbility = false), this, bIgnoreSpecialAbility);
SIGNATURE_ARGS(GetMaxAmmo, int, CTFPlayer, (int iAmmoIndex, int iClassIndex = -1), this, iAmmoIndex, iClassIndex);
SIGNATURE(UpdateClientSideAnimation, void, CTFPlayer, this);
SIGNATURE(GetEffectiveInvisibilityLevel, float, CTFPlayer, this);
SIGNATURE(UpdateWearables, void, CTFPlayer, this);
@@ -26,9 +26,9 @@ static int UTF8ToUnicode(const char* ansi, wchar_t* unicode, int unicodeBufferSi
bool KeyValues::LoadFromBuffer(char const* resource_name, const char* buffer, void* file_system, const char* path_id)
bool KeyValues::LoadFromBuffer(char const* resourceName, const char* pBuffer, void* pFileSystem, const char* pPathID)
{
return S::KeyValues_LoadFromBuffer.Call<bool>(this, resource_name, buffer, file_system, path_id);
return S::KeyValues_LoadFromBuffer.Call<bool>(this, resourceName, pBuffer, pFileSystem, pPathID);
}
void KeyValues::Initialize(const char* name)
+1 -1
View File
@@ -55,7 +55,7 @@ public:
KeyValues* m_pKeyValues;
};
bool LoadFromBuffer(char const* resource_name, const char* buffer, void* file_system = 0, const char* path_id = 0);
bool LoadFromBuffer(char const* resourceName, const char* pBuffer, void* pFileSystem = 0, const char* pPathID = 0);
void Initialize(const char* name);
KeyValues(const char* name);
@@ -89,8 +89,6 @@ static inline std::deque<Frame_t> StackTrace(PCONTEXT pContext)
tFrame.m_sName = symbol->Name;
}
}
//if (!vTrace.empty())
// vTrace.pop_front();
SymCleanup(hProcess);