From db84e3a61539e0284adfb9265bde4d20230abd3c Mon Sep 17 00:00:00 2001 From: ByteCorum <164874887+ByteCorum@users.noreply.github.com> Date: Thu, 23 Jan 2025 16:51:44 +0200 Subject: [PATCH 1/3] fixed bugs --- TempleWare-External/source/features/glow.cpp | 82 ++++++++------------ TempleWare-External/source/main.cpp | 30 +++---- TempleWare-External/source/menu/menu.cpp | 14 +++- 3 files changed, 58 insertions(+), 68 deletions(-) diff --git a/TempleWare-External/source/features/glow.cpp b/TempleWare-External/source/features/glow.cpp index 26a53db..fe488f4 100644 --- a/TempleWare-External/source/features/glow.cpp +++ b/TempleWare-External/source/features/glow.cpp @@ -3,66 +3,50 @@ #include "../offsets/offsets.h" #include -namespace features -{ - - uintptr_t GetEntityInListOffset(int index) - { - return 0x8 * (index & 0x7FFF) >> 9 + 16; - } - - DWORD PackColor(const ImVec4& color) - { - return ((DWORD)(color.w * 255) << 24) | - ((DWORD)(color.z * 255) << 16) | - ((DWORD)(color.y * 255) << 8) | - (DWORD)(color.x * 255); - } - - void Glow::Run(const Memory& memory) noexcept - { - if (!globals::Glow) - return; +namespace features { + void Glow::Run(const Memory& memory) noexcept { + if (!globals::Glow) return; const uintptr_t localPlayerController = memory.Read(globals::client + offsets::dwLocalPlayerController); - if (!localPlayerController) - return; - - int localTeam = memory.Read(localPlayerController + offsets::m_iTeamNum); + if (!localPlayerController) return; + const int localTeam = memory.Read(localPlayerController + offsets::m_iTeamNum); + const uintptr_t entityList = memory.Read(globals::client + offsets::dwEntityList); + if (!entityList) return; - for (int i = 1; i < 64; ++i) - { - uintptr_t entityList = memory.Read(globals::client + offsets::dwEntityList); - if (!entityList) - continue; + for (int i = 1; i < 64; ++i) { + const uintptr_t listEntry = memory.Read(entityList + ((8 * (i & 0x7FFF)) >> 9) + 16); + if (!listEntry) continue; - uintptr_t entity = memory.Read(entityList + GetEntityInListOffset(i)); - if (!entity) - continue; + const uintptr_t player = memory.Read(listEntry + 120 * (i & 0x1FF)); + if (!player) continue; - int entityTeam = memory.Read(entity + offsets::m_iTeamNum); - if (entityTeam == localTeam) - continue; + const int playerTeam = memory.Read(player + offsets::m_iTeamNum); + if (playerTeam == localTeam) continue; - uint32_t playerPawn = memory.Read(entity + offsets::m_hPlayerPawn); - if (!playerPawn) - continue; + const uint32_t playerPawn = memory.Read(player + offsets::m_hPlayerPawn); + if (!playerPawn) continue; - uintptr_t playerCsPawn = memory.Read(entityList + GetEntityInListOffset(playerPawn)); - if (!playerCsPawn) - continue; + const uintptr_t listEntry2 = memory.Read(entityList + ((8 * (playerPawn & 0x7FFF)) >> 9) + 16); + if (!listEntry2) continue; - int health = memory.Read(playerCsPawn + offsets::m_iHealth); - if (health < 1) - continue; + const uintptr_t playerCsPawn = memory.Read(listEntry2 + 120 * (playerPawn & 0x1FF)); + if (!playerCsPawn) continue; + const int health = memory.Read(playerCsPawn + offsets::m_iHealth); + if (health < 1) continue; + const ImVec4& color = globals::GlowColor; + const DWORD colorArgb = ( + (static_cast(color.w * 255) << 24) | + (static_cast(color.z * 255) << 16) | + (static_cast(color.y * 255) << 8) | + static_cast(color.x * 255) + ); - ImVec4 color = globals::GlowColor; - DWORD colorArgb = PackColor(color); - memory.Write(playerCsPawn + offsets::m_Glow + offsets::m_glowColorOverride, colorArgb); - memory.Write(playerCsPawn + offsets::m_Glow + offsets::m_bGlowing, 1); + const uintptr_t glowOffset = playerCsPawn + offsets::m_Glow; + memory.Write(glowOffset + offsets::m_glowColorOverride, colorArgb); + memory.Write(glowOffset + offsets::m_bGlowing, 1); } } -} \ No newline at end of file +} diff --git a/TempleWare-External/source/main.cpp b/TempleWare-External/source/main.cpp index 0725781..c1544dc 100644 --- a/TempleWare-External/source/main.cpp +++ b/TempleWare-External/source/main.cpp @@ -13,39 +13,39 @@ int __stdcall wWinMain(HINSTANCE instance, HINSTANCE previousInstance, PWSTR arguments, int commandShow) { - if (!offsets::UpdateOffset()) return EXIT_FAILURE; const auto memory = Memory("cs2.exe"); + globals::client = memory.GetModuleAddress("client.dll"); + std::thread(threads::RunMiscThread, std::ref(memory)).detach(); + std::thread(threads::RunVisualThread, std::ref(memory)).detach(); + std::thread(threads::RunAimThread, std::ref(memory)).detach(); + gui::CreateHWindow("templecheats.xyz"); gui::CreateDevice(); gui::CreateImGui(); - std::thread miscThread(threads::RunMiscThread, std::ref(memory)); - miscThread.detach(); - - std::thread visualThread(threads::RunVisualThread, std::ref(memory)); - visualThread.detach(); - - std::thread aimThread(threads::RunAimThread, std::ref(memory)); - aimThread.detach(); - bool windowVisible = true; - while (globals::isRunning) + + while (globals::isRunning) { - if (GetAsyncKeyState(VK_END) & 0x8000) + if (GetAsyncKeyState(VK_END) & 0x8000) { windowVisible = !windowVisible; ShowWindow(gui::window, windowVisible ? SW_SHOW : SW_HIDE); std::this_thread::sleep_for(std::chrono::milliseconds(200)); } - if (windowVisible) + if (windowVisible) + { + gui::BeginRender(); gui::Render(); - else + gui::EndRender(); + } + else std::this_thread::sleep_for(std::chrono::milliseconds(50)); } @@ -54,4 +54,4 @@ int __stdcall wWinMain(HINSTANCE instance, HINSTANCE previousInstance, PWSTR arg gui::DestroyHWindow(); return EXIT_SUCCESS; -} +} \ No newline at end of file diff --git a/TempleWare-External/source/menu/menu.cpp b/TempleWare-External/source/menu/menu.cpp index 4159bf0..b39a400 100644 --- a/TempleWare-External/source/menu/menu.cpp +++ b/TempleWare-External/source/menu/menu.cpp @@ -169,13 +169,19 @@ namespace gui IMGUI_CHECKVERSION(); ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); - io.IniFilename = NULL; - ImGui::StyleColorsDark(); + io.Fonts->AddFontDefault(); + (void)io; + + ImFontAtlas* fontAtlas = new ImFontAtlas(); + ImFontConfig arialConfig; + arialConfig.FontDataOwnedByAtlas = false; const char* fontPath = "C:\\Windows\\Fonts\\segoeui.ttf"; float fontSize = 18.0f; - if (!io.Fonts->AddFontFromFileTTF(fontPath, fontSize)) - io.Fonts->AddFontDefault(); + ImFont* arialFont = fontAtlas->AddFontFromFileTTF(fontPath,fontSize, &arialConfig); + io.Fonts = fontAtlas; + + ImGui::StyleColorsDark(); ImGui_ImplWin32_Init(window); ImGui_ImplDX9_Init(device); From 6672fe2107532b4361f7b7d3e490c3abf064d8f0 Mon Sep 17 00:00:00 2001 From: ByteCorum <164874887+ByteCorum@users.noreply.github.com> Date: Thu, 23 Jan 2025 16:56:44 +0200 Subject: [PATCH 2/3] situation with fov now much better --- TempleWare-External/source/features/fov.cpp | 10 +++++++++- TempleWare-External/source/globals/globals.h | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/TempleWare-External/source/features/fov.cpp b/TempleWare-External/source/features/fov.cpp index b0a76dd..12fbc53 100644 --- a/TempleWare-External/source/features/fov.cpp +++ b/TempleWare-External/source/features/fov.cpp @@ -1,11 +1,19 @@ #include "fov.h" #include "../globals/globals.h" #include "../offsets/offsets.h" +#include namespace features { void FOVManager::AdjustFOV(const Memory& memory) noexcept { + if (globals::lastFOV != globals::FOV) + { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + + globals::lastFOV = globals::FOV; + std::uintptr_t localPlayer = memory.Read(globals::client + offsets::dwLocalPlayerPawn); if (!localPlayer) return; @@ -16,7 +24,7 @@ namespace features std::uint16_t currentFov = memory.Read(cameraServices + offsets::m_iFOV); bool isScoped = memory.Read(localPlayer + offsets::m_bIsScoped); - std::uint16_t desiredFov = static_cast(globals::FOV); + std::uint16_t desiredFov = static_cast(globals::lastFOV); if (!isScoped && currentFov != desiredFov) memory.Write(cameraServices + offsets::m_iFOV, desiredFov); diff --git a/TempleWare-External/source/globals/globals.h b/TempleWare-External/source/globals/globals.h index b3d6d78..beaa1f4 100644 --- a/TempleWare-External/source/globals/globals.h +++ b/TempleWare-External/source/globals/globals.h @@ -20,7 +20,8 @@ namespace globals inline bool TriggerBotIgnoreFlash = false; // Fov - inline int FOV = 90; + inline int FOV = 90; + inline int lastFOV = 90; // Glow inline bool Glow = false; From 781672b63cd6d50cd854371f6b90fe4d7995ceda Mon Sep 17 00:00:00 2001 From: ByteCorum <164874887+ByteCorum@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:01:14 +0200 Subject: [PATCH 3/3] Update glow.cpp --- TempleWare-External/source/features/glow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TempleWare-External/source/features/glow.cpp b/TempleWare-External/source/features/glow.cpp index fe488f4..8092262 100644 --- a/TempleWare-External/source/features/glow.cpp +++ b/TempleWare-External/source/features/glow.cpp @@ -4,7 +4,8 @@ #include namespace features { - void Glow::Run(const Memory& memory) noexcept { + void Glow::Run(const Memory& memory) noexcept + { if (!globals::Glow) return; const uintptr_t localPlayerController = memory.Read(globals::client + offsets::dwLocalPlayerController);