Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:

- name: Building project
run: |
msbuild CS2-External-Base.sln -t:Rebuild -p:Configuration=Release -p:Platform=x64
msbuild TempleWare-External.sln -t:Rebuild -p:Configuration=Release -p:Platform=x64

- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: Compiled-Binaries
path: |
D:\a\CS2-External-Base\x64\Release\CS2-External-Base.exe
D:\a\TempleWare-External\x64\Release\TempleWare-External.exe
8 changes: 1 addition & 7 deletions TempleWare-External/source/features/bhop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ namespace features
return;

HWND hwnd_cs2 = FindWindowA(NULL, "Counter-Strike 2");
if (hwnd_cs2 == NULL) {
if (hwnd_cs2 == NULL)
hwnd_cs2 = FindWindowA(NULL, "Counter-Strike 2");
}

bool spacePressed = GetAsyncKeyState(VK_SPACE);
int flags = memory.Read<std::uintptr_t>(localPlayer + offsets::m_fFlags);
Expand All @@ -27,14 +26,9 @@ namespace features
SendMessage(hwnd_cs2, WM_KEYUP, VK_SPACE, 0);
SendMessage(hwnd_cs2, WM_KEYDOWN, VK_SPACE, 0);
}

else if (spacePressed && !isInAir)
{
SendMessage(hwnd_cs2, WM_KEYUP, VK_SPACE, 0);
}
else if (!spacePressed)
{
SendMessage(hwnd_cs2, WM_KEYUP, VK_SPACE, 0);
}
}
}
1 change: 1 addition & 0 deletions TempleWare-External/source/features/bhop.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ namespace features
{
public:
static void Run(const Memory& memory) noexcept;

};
}
7 changes: 5 additions & 2 deletions TempleWare-External/source/features/fov.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

#include "../memory/Memory.h"

namespace features {
class FOVManager {
namespace features
{
class FOVManager
{
public:
static void AdjustFOV(const Memory& memory) noexcept;

};
}
7 changes: 5 additions & 2 deletions TempleWare-External/source/features/glow.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

#include "../memory/memory.h"

namespace features {
class Glow {
namespace features
{
class Glow
{
public:
static void Run(const Memory& memory) noexcept;

};
}
18 changes: 12 additions & 6 deletions TempleWare-External/source/features/noflash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@
#include "../globals/globals.h"
#include "../offsets/offsets.h"

namespace features {
void NoFlash::Run(const Memory& memory) noexcept {
if (globals::NoFlashEnabled) {
namespace features
{

void NoFlash::Run(const Memory& memory) noexcept
{
if (globals::NoFlashEnabled)
{
std::uintptr_t localPlayer = memory.Read<std::uintptr_t>(globals::client + offsets::dwLocalPlayerPawn);
if (localPlayer) {

if (localPlayer)
{
float flashDuration = memory.Read<float>(localPlayer + offsets::flFlashDuration);
if (flashDuration > 0.0f) {
if (flashDuration > 0.0f)
memory.Write<float>(localPlayer + offsets::flFlashDuration, 0.0f);
}
}
}
}

}
7 changes: 5 additions & 2 deletions TempleWare-External/source/features/noflash.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

#include "../memory/Memory.h"

namespace features {
class NoFlash {
namespace features
{
class NoFlash
{
public:
static void Run(const Memory& memory) noexcept;

};
}
55 changes: 28 additions & 27 deletions TempleWare-External/source/features/triggerbot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,36 @@
#include <thread>
#include <Windows.h>

namespace features {
namespace features
{
void TriggerBot::Run(const Memory& memory) noexcept {
while (globals::isRunning) {
if (!globals::TriggerBot) {
while (globals::isRunning)
{
if (!globals::TriggerBot)
{
std::this_thread::sleep_for(std::chrono::milliseconds(20));
continue;
}

bool keyState = GetAsyncKeyState(globals::TriggerBotKey) & 0x8000;

if (globals::TriggerBotMode == 0) {
if (!keyState) {
bool keyDown = (GetAsyncKeyState(globals::TriggerBotKey) & 0x8000) != 0;
if (globals::TriggerBotMode == 0)
{
if (!keyDown)
{
std::this_thread::sleep_for(std::chrono::milliseconds(10));
continue;
}
}
else if (globals::TriggerBotMode == 1) {
if (keyState) {
else if (globals::TriggerBotMode == 1)
{
if (keyDown)
{
globals::TriggerBotToggled = !globals::TriggerBotToggled;
std::this_thread::sleep_for(std::chrono::milliseconds(200));
}

if (!globals::TriggerBotToggled) {
if (!globals::TriggerBotToggled)
{
std::this_thread::sleep_for(std::chrono::milliseconds(10));
continue;
}
Expand All @@ -35,7 +42,8 @@ namespace features {
std::uintptr_t localPlayer = memory.Read<std::uintptr_t>(globals::client + offsets::dwLocalPlayerPawn);
BYTE team = memory.Read<BYTE>(localPlayer + offsets::m_iTeamNum);

if (!globals::TriggerBotIgnoreFlash) {
if (!globals::TriggerBotIgnoreFlash)
{
float flashDuration = memory.Read<float>(localPlayer + offsets::flFlashDuration);
if (flashDuration > 0.0f) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
Expand All @@ -44,32 +52,25 @@ namespace features {
}

int crosshairEntityIndex = memory.Read<int>(localPlayer + offsets::m_iIDEntIndex);
if (crosshairEntityIndex == 0) {
if (crosshairEntityIndex == 0)
continue;
}

std::uintptr_t entityList = memory.Read<std::uintptr_t>(globals::client + offsets::dwEntityList);
std::uintptr_t listEntry = memory.Read<std::uintptr_t>(entityList + 0x8 * (crosshairEntityIndex >> 9) + 0x10);
std::uintptr_t entity = memory.Read<std::uintptr_t>(listEntry + 120 * (crosshairEntityIndex & 0x1ff));

if (!entity) {
std::uintptr_t entity = memory.Read<std::uintptr_t>(memory.Read<std::uintptr_t>(entityList + 0x8 * (crosshairEntityIndex >> 9) + 0x10) + 120 * (crosshairEntityIndex & 0x1ff));
if (!entity)
continue;
}

if (globals::TriggerBotTeamCheck && team == memory.Read<BYTE>(entity + offsets::m_iTeamNum)) {
// Skip teammate or dead target (optional)
if (globals::TriggerBotTeamCheck && team == memory.Read<BYTE>(entity + offsets::m_iTeamNum))
continue;
}

if (memory.Read<int>(entity + offsets::m_iHealth) <= 0) {
if (memory.Read<int>(entity + offsets::m_iHealth) <= 0)
continue;
}

memory.Write<int>(globals::client + offsets::attack, 65537);

// Simulate shooting
memory.Write<int>(globals::client + offsets::attack, 65537); // Set attack command
std::this_thread::sleep_for(std::chrono::milliseconds(globals::TriggerBotDelay));

memory.Write<int>(globals::client + offsets::attack, 256);

memory.Write<int>(globals::client + offsets::attack, 256); // Clear attack command
std::this_thread::sleep_for(std::chrono::milliseconds(globals::TriggerBotDelay));
}
}
Expand Down
7 changes: 5 additions & 2 deletions TempleWare-External/source/features/triggerbot.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

#include "../memory/Memory.h"

namespace features {
class TriggerBot {
namespace features
{
class TriggerBot
{
public:
static void Run(const Memory& memory) noexcept;

};
}
3 changes: 2 additions & 1 deletion TempleWare-External/source/globals/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

#include "../../external/imgui/imgui.h"

namespace globals {
namespace globals
{

// TriggerBot
inline bool TriggerBot = false;
Expand Down
69 changes: 30 additions & 39 deletions TempleWare-External/source/memory/memory.h
Original file line number Diff line number Diff line change
@@ -1,81 +1,72 @@
#pragma once
#define WIN32_LEAN_AND_MEAN
#pragma once

#include <Windows.h>
#include <TlHelp32.h>

#include <cstdint>
#include <string_view>
#include <string>

class Memory
{
class Memory {
private:
std::uintptr_t processId = 0;
void* processHandle = nullptr;
std::uintptr_t processId_;
HANDLE processHandle_;

public:

Memory(const std::string_view processName) noexcept
Memory(const std::string& processName) noexcept
{
::PROCESSENTRY32 entry = { };
entry.dwSize = sizeof(::PROCESSENTRY32);

const auto snapShot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PROCESSENTRY32 entry = { sizeof(PROCESSENTRY32) };
auto snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);

while (::Process32Next(snapShot, &entry))
while (Process32Next(snapshot, &entry))
{
if (!processName.compare(entry.szExeFile))
if (entry.szExeFile == processName)
{
processId = entry.th32ProcessID;
processHandle = ::OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
processId_ = entry.th32ProcessID;
processHandle_ = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId_);
break;
}
}

if (snapShot)
::CloseHandle(snapShot);
CloseHandle(snapshot);
}

~Memory()
~Memory() noexcept
{
if (processHandle)
::CloseHandle(processHandle);
if (processHandle_)
CloseHandle(processHandle_);
}

const std::uintptr_t GetModuleAddress(const std::string_view moduleName) const noexcept
std::uintptr_t GetModuleAddress(const std::string& moduleName) const noexcept
{
::MODULEENTRY32 entry = { };
entry.dwSize = sizeof(::MODULEENTRY32);

const auto snapShot = ::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, processId);

MODULEENTRY32 entry = { sizeof(MODULEENTRY32) };
auto snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, processId_);
std::uintptr_t result = 0;

while (::Module32Next(snapShot, &entry))
while (Module32Next(snapshot, &entry))
{
if (!moduleName.compare(entry.szModule))
if (entry.szModule == moduleName)
{
result = reinterpret_cast<std::uintptr_t>(entry.modBaseAddr);
break;
}
}

if (snapShot)
::CloseHandle(snapShot);

CloseHandle(snapshot);
return result;
}

template <typename T>
constexpr const T Read(const std::uintptr_t& address) const noexcept
T Read(const std::uintptr_t& address) const noexcept
{
T value = { };
::ReadProcessMemory(processHandle, reinterpret_cast<const void*>(address), &value, sizeof(T), NULL);
T value;
SIZE_T bytesRead;
ReadProcessMemory(processHandle_, reinterpret_cast<LPCVOID>(address), &value, sizeof(T), &bytesRead);
return value;
}

template <typename T>
constexpr void Write(const std::uintptr_t& address, const T& value) const noexcept
void Write(const std::uintptr_t& address, const T& value) const noexcept
{
::WriteProcessMemory(processHandle, reinterpret_cast<void*>(address), &value, sizeof(T), NULL);
SIZE_T bytesWritten;
WriteProcessMemory(processHandle_, reinterpret_cast<LPVOID>(address), &value, sizeof(T), &bytesWritten);
}
};
10 changes: 2 additions & 8 deletions TempleWare-External/source/menu/menu.h
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
#pragma once

#include <d3d9.h>

namespace gui
{

constexpr int WIDTH = 500;
constexpr int HEIGHT = 300;

inline bool isRunning = true;

inline HWND window = nullptr;
inline WNDCLASSEX windowClass = { };

inline WNDCLASSEX windowClass = {};
inline POINTS position = { };

inline PDIRECT3D9 d3d = nullptr;
inline LPDIRECT3DDEVICE9 device = nullptr;
inline D3DPRESENT_PARAMETERS presentParameters = { };
inline D3DPRESENT_PARAMETERS presentParameters = {};

void CreateHWindow(const char* windowName) noexcept;
void DestroyHWindow() noexcept;

bool CreateDevice() noexcept;
void ResetDevice() noexcept;
void DestroyDevice() noexcept;

void CreateImGui() noexcept;
void DestroyImGui() noexcept;

void SetupImGuiStyle() noexcept;
void SetupImGuiFonts() noexcept;

Expand Down
Loading
Loading