//driver.hpp #pragma once class _driver { private: typedef INT64(*Nt_UserGetPointerProprietaryId)(uintptr_t); Nt_UserGetPointerProprietaryId NtUserGetPointerProprietaryId = nullptr; #define DRIVER_READVM 0x80000001 #define DRIVER_GETPOOL 0x80000002 #define DRIVER_MOUSE 0x80000003 int _processid; uint64_t _guardedregion; struct _requests { //rw uint32_t src_pid; uint64_t src_addr; uint64_t dst_addr; size_t size; //function requests int request_key; //guarded regions uintptr_t allocation; //mouse long x; long y; unsigned short button_flags; }; auto readvm(uint32_t src_pid, uint64_t src_addr, uint64_t dst_addr, size_t size) -> void { if (src_pid == 0 || src_addr == 0) return; _requests out = { src_pid, src_addr, dst_addr, size, DRIVER_READVM }; NtUserGetPointerProprietaryId(reinterpret_cast(&out)); } public: auto initdriver(int processid) -> void { NtUserGetPointerProprietaryId = (Nt_UserGetPointerProprietaryId)GetProcAddress(LoadLibraryA("win32u.dll"), "NtUserGetPointerProprietaryId"); if (NtUserGetPointerProprietaryId != 0) { printf("NtUserGetPointerProprietaryId: %p\n", NtUserGetPointerProprietaryId); _processid = processid; } } auto guarded_region() -> uintptr_t { _requests out = { 0 }; out.request_key = DRIVER_GETPOOL; NtUserGetPointerProprietaryId(reinterpret_cast(&out)); _guardedregion = out.allocation; return out.allocation; } template T readguarded(uintptr_t src, size_t size = sizeof(T)) { T buffer; readvm(_processid, src, (uintptr_t)&buffer, size); uintptr_t val = _guardedregion + (*(uintptr_t*)&buffer & 0xFFFFFF); return *(T*)&val; } template T readv(uintptr_t src, size_t size = sizeof(T)) { T buffer; readvm(_processid, src, (uintptr_t)&buffer, size); return buffer; } template void readarray(uint64_t address, T* array, size_t len) { readvm(_processid, address, (uintptr_t)&array, sizeof(T) * len); } //bluefire1337 inline static bool isguarded(uintptr_t pointer) noexcept { static constexpr uintptr_t filter = 0xFFFFFFF000000000; uintptr_t result = pointer & filter; return result == 0x8000000000 || result == 0x10000000000; } template T read(T src) { T buffer = readv< uintptr_t >(src); if (isguarded((uintptr_t)buffer)) { return readguarded< uintptr_t >(src); } return buffer; } auto move_mouse(long x, long y) -> void { _requests out = { 0 }; out.x = x; out.y = y; out.request_key = DRIVER_MOUSE; NtUserGetPointerProprietaryId(reinterpret_cast(&out)); } auto send_input(unsigned short button) -> void { _requests out = { 0 }; out.button_flags = button; out.request_key = DRIVER_MOUSE; NtUserGetPointerProprietaryId(reinterpret_cast(&out)); } }; _driver driver; //blixt.hpp #pragma once #include "sdk.hpp" #include using namespace Globals; using namespace Camera; using namespace UE4; GWorld* UWorld; GGameInstance* UGameInstance; GLocalPlayer* ULocalPlayer; GPlayerController* APlayerController; GPawn* APawn; GPrivatePawn* APrivatePawn; GULevel* ULevel; GUSkeletalMeshComponent* USkeletalMeshComponent; bool cached = false; uintptr_t WorldPtr; auto CacheGame() -> void { auto guardedregion = driver.guarded_region(); while (true) { std::vector CachedList; WorldPtr = GetWorld(guardedregion); auto ULevelPtr = UWorld->ULevel(WorldPtr); auto UGameInstancePtr = UWorld->GameInstance(WorldPtr); auto ULocalPlayerPtr = UGameInstance->ULocalPlayer(UGameInstancePtr); auto APlayerControllerPtr = ULocalPlayer->APlayerController(ULocalPlayerPtr); PlayerCameraManager = APlayerController->APlayerCameraManager(APlayerControllerPtr); auto MyHUD = APlayerController->AHUD(APlayerControllerPtr); auto APawnPtr = APlayerController->APawn(APlayerControllerPtr); if (APawnPtr != 0) { MyUniqueID = APawn->UniqueID(APawnPtr); MyRelativeLocation = APawn->RelativeLocation(APawnPtr); } if (MyHUD != 0) { auto PlayerArray = ULevel->AActorArray(ULevelPtr); for (uint32_t i = 0; i < PlayerArray.Count; ++i) { auto Pawns = PlayerArray[i]; if (Pawns != APawnPtr) { if (MyUniqueID == APawn->UniqueID(Pawns)) { ValEntity Entities{ Pawns }; CachedList.push_back(Entities); } } } ValList.clear(); ValList = CachedList; Sleep(1000); } } } auto CheatLoop() -> void { for (ValEntity ValEntityList : ValList) { auto SkeletalMesh = APrivatePawn->USkeletalMeshComponent(ValEntityList.Actor); auto RelativeLocation = APawn->RelativeLocation(ValEntityList.Actor); auto RelativeLocationProjected = UE4::SDK::ProjectWorldToScreen(RelativeLocation); auto RelativePosition = RelativeLocation - CameraLocation; auto RelativeDistance = RelativePosition.Length() / 10000 * 2; auto HeadBone = UE4::SDK::GetEntityBone(SkeletalMesh, 8); auto HeadBoneProjected = UE4::SDK::ProjectWorldToScreen(HeadBone); auto RootBone = UE4::SDK::GetEntityBone(SkeletalMesh, 0); auto RootBoneProjected = UE4::SDK::ProjectWorldToScreen(RootBone); auto RootBoneProjected2 = UE4::SDK::ProjectWorldToScreen(FVector(RootBone.x, RootBone.y, RootBone.z - 15)); auto Distance = MyRelativeLocation.Distance(RelativeLocation); float BoxHeight = abs(HeadBoneProjected.y - RootBoneProjected.y); float BoxWidth = BoxHeight * 0.40; auto ESPColor = ImColor(255, 255, 255); auto Health = APawn->Health(ValEntityList.Actor); if (Health <= 0) continue; if (APawn->bIsDormant(ValEntityList.Actor)) { if (Settings::Visuals::bSnaplines) DrawTracers(RootBoneProjected, ESPColor); if (Settings::Visuals::bBox) Draw2DBox(RelativeLocationProjected, BoxWidth, BoxHeight, ESPColor); if (Settings::Visuals::bBoxOutlined) DrawOutlinedBox(RelativeLocationProjected, BoxWidth, BoxHeight, ESPColor); if (Settings::Visuals::bHealth) DrawHealthBar(RelativeLocationProjected, BoxWidth, BoxHeight, Health, RelativeDistance); if (Settings::Visuals::bDistance) DrawDistance(RootBoneProjected2, Distance); } } } //globals.hpp #pragma once #include HWND Entryhwnd = NULL; int processid = 0; namespace offsets { DWORD Gameinstance = 0x1a0, Ulevel = 0x38, LocalPlayers = 0x40, PlayerController = 0x38, PlayerCameraManager = 0x478, MyHUD = 0x470, AcknowledgedPawn = 0x460, PlayerState = 0x3f0, TeamComponent = 0x628, TeamID = 0xf8, UniqueID = 0x38, FNameID = 0x18, AActorArray = 0xa0, RootComponent = 0x230, RelativeLocation = 0x164, MeshComponent = 0x430, DamageHandler = 0x9a8, bIsDormant = 0x100, Health = 0x1b0, ComponentToWorld = 0x250, BoneArray = 0x5C0, BoneArrayCache = BoneArray + 0x10, BoneCount = 0x5C8; } namespace Settings { inline bool bMenu = true; namespace Visuals { inline bool bSnaplines = true; inline bool bDistance = false; inline bool bBox = true; inline bool bBoxOutlined = false; inline bool bHealth = false; inline float BoxWidth = 1.0f; } } //sdk.hpp #pragma once #include #include #include #include "../Overlay/render.hpp" #include "../Driver/driver.hpp" #include "structs.hpp" #include using namespace UE4Structs; namespace Globals { DWORD_PTR LocalPlayer, PlayerController, PlayerCameraManager; int MyUniqueID, MyTeamID, BoneCount; FVector MyRelativeLocation, closestPawn; namespace Camera { FVector CameraLocation, CameraRotation; float FovAngle; } } using namespace Globals; using namespace Camera; namespace UE4 { struct GWorld { uintptr_t GameInstance(uintptr_t GameWorld) { return driver.readv(GameWorld + offsets::Gameinstance); }; uintptr_t ULevel(uintptr_t World) { return driver.read(World + offsets::Ulevel); }; }; struct GGameInstance { uintptr_t ULocalPlayer(uintptr_t UGameInstance) { auto ULocalPlayerArray = driver.readv(UGameInstance + offsets::LocalPlayers); return driver.readv(ULocalPlayerArray); }; }; struct GULevel { TArrayDrink AActorArray(uintptr_t ULevel) { return driver.readv>(ULevel + offsets::AActorArray); }; }; struct GPrivatePawn { uintptr_t USkeletalMeshComponent(uintptr_t Pawn) { return driver.read(Pawn + offsets::MeshComponent); }; }; struct GUSkeletalMeshComponent { int BoneCount(uintptr_t Mesh) { return driver.read(Mesh + offsets::BoneCount); }; }; struct GLocalPlayer { uintptr_t APlayerController(uintptr_t ULocalPlayer) { return driver.read(ULocalPlayer + offsets::PlayerController); }; }; struct GPlayerController { uintptr_t APlayerCameraManager(uintptr_t APlayerController) { return driver.read(APlayerController + offsets::PlayerCameraManager); }; uintptr_t AHUD(uintptr_t APlayerController) { return driver.read(APlayerController + offsets::MyHUD); }; uintptr_t APawn(uintptr_t APlayerController) { return driver.read(APlayerController + offsets::AcknowledgedPawn); }; }; struct GPawn { auto TeamID(uintptr_t APawn) -> int { auto PlayerState = driver.readv(APawn + offsets::PlayerState); auto TeamComponent = driver.readv(PlayerState + offsets::TeamComponent); return driver.readv(TeamComponent + offsets::TeamID); }; auto UniqueID(uintptr_t APawn) -> int { return driver.readv(APawn + offsets::UniqueID); }; auto FNameID(uintptr_t APawn) -> int { return driver.readv(APawn + offsets::FNameID); }; auto RelativeLocation(uintptr_t APawn) -> FVector { auto RootComponent = driver.readv(APawn + offsets::RootComponent); return driver.readv(RootComponent + offsets::RelativeLocation); }; auto bIsDormant(uintptr_t APawn) -> bool { return driver.readv(APawn + offsets::bIsDormant); }; auto Health(uintptr_t APawn) -> float { auto DamageHandler = driver.read(APawn + offsets::DamageHandler); return driver.readv(DamageHandler + offsets::Health); }; }; auto GetWorld(uintptr_t Pointer) -> uintptr_t { std::uintptr_t uworld_addr = driver.readv(Pointer + 0x60); unsigned long long uworld_offset; if (uworld_addr > 0x10000000000) { uworld_offset = uworld_addr - 0x10000000000; } else { uworld_offset = uworld_addr - 0x8000000000; } return Pointer + uworld_offset; } auto VectorToRotation(FVector relativeLocation) -> FVector { constexpr auto radToUnrRot = 57.2957795f; return FVector( atan2(relativeLocation.z, sqrt((relativeLocation.x * relativeLocation.x) + (relativeLocation.y * relativeLocation.y))) * radToUnrRot, atan2(relativeLocation.y, relativeLocation.x) * radToUnrRot, 0.f); } auto AimAtVector(FVector targetLocation, FVector cameraLocation) -> FVector { return VectorToRotation(targetLocation - cameraLocation); } namespace SDK { auto GetEntityBone(DWORD_PTR mesh, int id) -> FVector { DWORD_PTR array = driver.readv(mesh + offsets::BoneArray); if (array == NULL) array = driver.readv(mesh + offsets::BoneArrayCache); FTransform bone = driver.readv(array + (id * 0x30)); FTransform ComponentToWorld = driver.readv(mesh + offsets::ComponentToWorld); D3DMATRIX Matrix; Matrix = MatrixMultiplication(bone.ToMatrixWithScale(), ComponentToWorld.ToMatrixWithScale()); return FVector(Matrix._41, Matrix._42, Matrix._43); } auto ProjectWorldToScreen(FVector WorldLocation) -> FVector { FVector Screenlocation = FVector(0, 0, 0); auto ViewInfo = driver.readv(PlayerCameraManager + 0x1fe0 + 0x10); CameraLocation = ViewInfo.Location; CameraRotation = ViewInfo.Rotation; D3DMATRIX tempMatrix = Matrix(CameraRotation, FVector(0, 0, 0)); FVector vAxisX = FVector(tempMatrix.m[0][0], tempMatrix.m[0][1], tempMatrix.m[0][2]), vAxisY = FVector(tempMatrix.m[1][0], tempMatrix.m[1][1], tempMatrix.m[1][2]), vAxisZ = FVector(tempMatrix.m[2][0], tempMatrix.m[2][1], tempMatrix.m[2][2]); FVector vDelta = WorldLocation - CameraLocation; FVector vTransformed = FVector(vDelta.Dot(vAxisY), vDelta.Dot(vAxisZ), vDelta.Dot(vAxisX)); if (vTransformed.z < 1.f) vTransformed.z = 1.f; FovAngle = ViewInfo.FOV; float ScreenCenterX = Width / 2.0f; float ScreenCenterY = Height / 2.0f; Screenlocation.x = ScreenCenterX + vTransformed.x * (ScreenCenterX / tanf(FovAngle * (float)M_PI / 360.f)) / vTransformed.z; Screenlocation.y = ScreenCenterY - vTransformed.y * (ScreenCenterX / tanf(FovAngle * (float)M_PI / 360.f)) / vTransformed.z; return Screenlocation; } bool IsVec3Valid(FVector vec3) { return !(vec3.x == 0 && vec3.y == 0 && vec3.z == 0); } } } //structs.hpp #pragma once #include #include #include #include #include "../Driver/driver.hpp" #define M_PI 3.14159265358979323846264338327950288419716939937510 namespace UE4Structs { typedef struct _ValEntity { uint64_t Actor; }ValEntity; std::vector ValList; class FVector { public: FVector() : x(0.f), y(0.f), z(0.f) { } FVector(float _x, float _y, float _z) : x(_x), y(_y), z(_z) { } ~FVector() { } float x; float y; float z; inline float Dot(FVector v) { return x * v.x + y * v.y + z * v.z; } inline float Distance(FVector v) { float x = this->x - v.x; float y = this->y - v.y; float z = this->z - v.z; return sqrtf((x * x) + (y * y) + (z * z)) * 0.03048f; } FVector operator+(FVector v) { return FVector(x + v.x, y + v.y, z + v.z); } FVector operator-(FVector v) { return FVector(x - v.x, y - v.y, z - v.z); } FVector operator*(float number) const { return FVector(x * number, y * number, z * number); } __forceinline float Magnitude() const { return sqrtf(x * x + y * y + z * z); } inline float Length() { return sqrtf((x * x) + (y * y) + (z * z)); } __forceinline FVector Normalize() { FVector vector; float length = this->Magnitude(); if (length != 0) { vector.x = x / length; vector.y = y / length; vector.z = z / length; } else { vector.x = vector.y = 0.0f; vector.z = 1.0f; } return vector; } __forceinline FVector& operator+=(const FVector& v) { x += v.x; y += v.y; z += v.z; return *this; } }; D3DXMATRIX Matrix(FVector rot, FVector origin) { float radPitch = (rot.x * float(M_PI) / 180.f); float radYaw = (rot.y * float(M_PI) / 180.f); float radRoll = (rot.z * float(M_PI) / 180.f); float SP = sinf(radPitch); float CP = cosf(radPitch); float SY = sinf(radYaw); float CY = cosf(radYaw); float SR = sinf(radRoll); float CR = cosf(radRoll); D3DMATRIX matrix; matrix.m[0][0] = CP * CY; matrix.m[0][1] = CP * SY; matrix.m[0][2] = SP; matrix.m[0][3] = 0.f; matrix.m[1][0] = SR * SP * CY - CR * SY; matrix.m[1][1] = SR * SP * SY + CR * CY; matrix.m[1][2] = -SR * CP; matrix.m[1][3] = 0.f; matrix.m[2][0] = -(CR * SP * CY + SR * SY); matrix.m[2][1] = CY * SR - CR * SP * SY; matrix.m[2][2] = CR * CP; matrix.m[2][3] = 0.f; matrix.m[3][0] = origin.x; matrix.m[3][1] = origin.y; matrix.m[3][2] = origin.z; matrix.m[3][3] = 1.f; return matrix; } struct FQuat { float x; float y; float z; float w; }; struct FTransform { FQuat rot; FVector translation; char pad[4]; FVector scale; char pad1[4]; D3DMATRIX ToMatrixWithScale() { D3DMATRIX m; m._41 = translation.x; m._42 = translation.y; m._43 = translation.z; float x2 = rot.x + rot.x; float y2 = rot.y + rot.y; float z2 = rot.z + rot.z; float xx2 = rot.x * x2; float yy2 = rot.y * y2; float zz2 = rot.z * z2; m._11 = (1.0f - (yy2 + zz2)) * scale.x; m._22 = (1.0f - (xx2 + zz2)) * scale.y; m._33 = (1.0f - (xx2 + yy2)) * scale.z; float yz2 = rot.y * z2; float wx2 = rot.w * x2; m._32 = (yz2 - wx2) * scale.z; m._23 = (yz2 + wx2) * scale.y; float xy2 = rot.x * y2; float wz2 = rot.w * z2; m._21 = (xy2 - wz2) * scale.y; m._12 = (xy2 + wz2) * scale.x; float xz2 = rot.x * z2; float wy2 = rot.w * y2; m._31 = (xz2 + wy2) * scale.z; m._13 = (xz2 - wy2) * scale.x; m._14 = 0.0f; m._24 = 0.0f; m._34 = 0.0f; m._44 = 1.0f; return m; } }; D3DMATRIX MatrixMultiplication(D3DMATRIX pM1, D3DMATRIX pM2) { D3DMATRIX pOut; pOut._11 = pM1._11 * pM2._11 + pM1._12 * pM2._21 + pM1._13 * pM2._31 + pM1._14 * pM2._41; pOut._12 = pM1._11 * pM2._12 + pM1._12 * pM2._22 + pM1._13 * pM2._32 + pM1._14 * pM2._42; pOut._13 = pM1._11 * pM2._13 + pM1._12 * pM2._23 + pM1._13 * pM2._33 + pM1._14 * pM2._43; pOut._14 = pM1._11 * pM2._14 + pM1._12 * pM2._24 + pM1._13 * pM2._34 + pM1._14 * pM2._44; pOut._21 = pM1._21 * pM2._11 + pM1._22 * pM2._21 + pM1._23 * pM2._31 + pM1._24 * pM2._41; pOut._22 = pM1._21 * pM2._12 + pM1._22 * pM2._22 + pM1._23 * pM2._32 + pM1._24 * pM2._42; pOut._23 = pM1._21 * pM2._13 + pM1._22 * pM2._23 + pM1._23 * pM2._33 + pM1._24 * pM2._43; pOut._24 = pM1._21 * pM2._14 + pM1._22 * pM2._24 + pM1._23 * pM2._34 + pM1._24 * pM2._44; pOut._31 = pM1._31 * pM2._11 + pM1._32 * pM2._21 + pM1._33 * pM2._31 + pM1._34 * pM2._41; pOut._32 = pM1._31 * pM2._12 + pM1._32 * pM2._22 + pM1._33 * pM2._32 + pM1._34 * pM2._42; pOut._33 = pM1._31 * pM2._13 + pM1._32 * pM2._23 + pM1._33 * pM2._33 + pM1._34 * pM2._43; pOut._34 = pM1._31 * pM2._14 + pM1._32 * pM2._24 + pM1._33 * pM2._34 + pM1._34 * pM2._44; pOut._41 = pM1._41 * pM2._11 + pM1._42 * pM2._21 + pM1._43 * pM2._31 + pM1._44 * pM2._41; pOut._42 = pM1._41 * pM2._12 + pM1._42 * pM2._22 + pM1._43 * pM2._32 + pM1._44 * pM2._42; pOut._43 = pM1._41 * pM2._13 + pM1._42 * pM2._23 + pM1._43 * pM2._33 + pM1._44 * pM2._43; pOut._44 = pM1._41 * pM2._14 + pM1._42 * pM2._24 + pM1._43 * pM2._34 + pM1._44 * pM2._44; return pOut; } struct FMinimalViewInfo { FVector Location; // 0x00(0x0c) FVector Rotation; // 0x0c(0x0c) float FOV; // 0x18(0x04) }; template class TArrayDrink { public: TArrayDrink() { Data = NULL; Count = 0; Max = 0; }; T operator[](uint64_t i) const { return driver.read(((uintptr_t)Data) + i * sizeof(T)); }; T* Data; unsigned int Count; unsigned int Max; }; template class TArray { public: int Length() const { return m_nCount; } bool IsValid() const { if (m_nCount > m_nMax) return false; if (!m_Data) return false; return true; } uint64_t GetAddress() const { return m_Data; } T GetById(int i) { return driver.readv(m_Data + i * 8); } [[nodiscard]] std::vector GetIter(int maxCount = 1000) { if (m_nCount > maxCount) return {}; std::vector buffer(m_nCount); driver.readarray(m_Data, buffer.data(), m_nCount); return buffer; } protected: uint64_t m_Data; uint32_t m_nCount; uint32_t m_nMax; }; } namespace ColorStructs { typedef struct { DWORD R; DWORD G; DWORD B; DWORD A; }RGBA; class Color { public: RGBA red = { 255,0,0,255 }; RGBA Magenta = { 255,0,255,255 }; RGBA yellow = { 255,255,0,255 }; RGBA grayblue = { 128,128,255,255 }; RGBA green = { 128,224,0,255 }; RGBA darkgreen = { 0,224,128,255 }; RGBA brown = { 192,96,0,255 }; RGBA pink = { 255,168,255,255 }; RGBA DarkYellow = { 216,216,0,255 }; RGBA SilverWhite = { 236,236,236,255 }; RGBA purple = { 144,0,255,255 }; RGBA Navy = { 88,48,224,255 }; RGBA skyblue = { 0,136,255,255 }; RGBA graygreen = { 128,160,128,255 }; RGBA blue = { 0,96,192,255 }; RGBA orange = { 255,128,0,255 }; RGBA peachred = { 255,80,128,255 }; RGBA reds = { 255,128,192,255 }; RGBA darkgray = { 96,96,96,255 }; RGBA Navys = { 0,0,128,255 }; RGBA darkgreens = { 0,128,0,255 }; RGBA darkblue = { 0,128,128,255 }; RGBA redbrown = { 128,0,0,255 }; RGBA purplered = { 128,0,128,255 }; RGBA greens = { 25,255,25,140 }; RGBA envy = { 0,255,255,255 }; RGBA black = { 0,0,0,255 }; RGBA neger = { 215, 240, 180, 255 }; RGBA negernot = { 222, 180, 200, 255 }; RGBA gray = { 128,128,128,255 }; RGBA white = { 255,255,255,255 }; RGBA blues = { 30,144,255,255 }; RGBA lightblue = { 135,206,250,255 }; RGBA Scarlet = { 220, 20, 60, 160 }; RGBA white_ = { 255,255,255,200 }; RGBA gray_ = { 128,128,128,200 }; RGBA black_ = { 0,0,0,200 }; RGBA red_ = { 255,0,0,200 }; RGBA Magenta_ = { 255,0,255,200 }; RGBA yellow_ = { 255,255,0,200 }; RGBA grayblue_ = { 128,128,255,200 }; RGBA green_ = { 128,224,0,200 }; RGBA darkgreen_ = { 0,224,128,200 }; RGBA brown_ = { 192,96,0,200 }; RGBA pink_ = { 255,168,255,200 }; RGBA darkyellow_ = { 216,216,0,200 }; RGBA silverwhite_ = { 236,236,236,200 }; RGBA purple_ = { 144,0,255,200 }; RGBA Blue_ = { 88,48,224,200 }; RGBA skyblue_ = { 0,136,255,200 }; RGBA graygreen_ = { 128,160,128,200 }; RGBA blue_ = { 0,96,192,200 }; RGBA orange_ = { 255,128,0,200 }; RGBA pinks_ = { 255,80,128,200 }; RGBA Fuhong_ = { 255,128,192,200 }; RGBA darkgray_ = { 96,96,96,200 }; RGBA Navy_ = { 0,0,128,200 }; RGBA darkgreens_ = { 0,128,0,200 }; RGBA darkblue_ = { 0,128,128,200 }; RGBA redbrown_ = { 128,0,0,200 }; RGBA purplered_ = { 128,0,128,200 }; RGBA greens_ = { 0,255,0,200 }; RGBA envy_ = { 0,255,255,200 }; RGBA glassblack = { 0, 0, 0, 160 }; RGBA GlassBlue = { 65,105,225,80 }; RGBA glassyellow = { 255,255,0,160 }; RGBA glass = { 200,200,200,60 }; RGBA filled = { 0, 0, 0, 150 }; RGBA Plum = { 221,160,221,160 }; }; Color Col; } //menu.hpp #pragma once auto drawmenu() -> void { if (GetAsyncKeyState(VK_INSERT) & 1) { Settings::bMenu = !Settings::bMenu; } if (Settings::bMenu) { ImGui::Begin("Valorant", NULL, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse); ImGui::SetWindowSize("Valorant", ImVec2(300, 450)); ImGui::Spacing(); ImGui::Checkbox("Enable 2D Box", &Settings::Visuals::bBox); if (Settings::Visuals::bBox) Settings::Visuals::bBoxOutlined = false; ImGui::Checkbox("Enable Cornered Box", &Settings::Visuals::bBoxOutlined); if (Settings::Visuals::bBoxOutlined) Settings::Visuals::bBox = false; ImGui::Checkbox("Enable Snaplines", &Settings::Visuals::bSnaplines); ImGui::Checkbox("Enable Distance", &Settings::Visuals::bDistance); ImGui::Checkbox("Enable HealthBar", &Settings::Visuals::bHealth); ImGui::End(); } } //render.hpp #pragma once #include #include #include #include #include #include "../../Includes/Imgui/imgui_internal.h" #include "../../Includes/Imgui/imgui.h" #include "../../Includes/Imgui/imgui_impl_win32.h" #include "../../Includes/Imgui/imgui_impl_dx9.h" #include "../game/globals.hpp" #include "../Game/structs.hpp" #pragma comment(lib, "d3dx9.lib") #pragma comment(lib, "d3d9.lib") #pragma comment(lib, "Dwmapi.lib") IDirect3D9Ex* p_Object = NULL; IDirect3DDevice9Ex* p_Device = NULL; D3DPRESENT_PARAMETERS p_Params = { NULL }; HWND MyWnd = NULL; HWND GameWnd = NULL; MSG Message = { NULL }; RECT GameRect = { NULL }; D3DPRESENT_PARAMETERS d3dpp; DWORD ScreenCenterX; DWORD ScreenCenterY; static ULONG Width = GetSystemMetrics(SM_CXSCREEN); static ULONG Height = GetSystemMetrics(SM_CYSCREEN); WPARAM main_loop(); void render(); void DefaultTheme() { //thanks https://www.unknowncheats.me/forum/members/4566270.html ImGuiStyle& s = ImGui::GetStyle(); const ImColor accentCol = ImColor(255, 0, 0, 255); const ImColor bgSecondary = ImColor(255, 0, 0, 255); s.Colors[ImGuiCol_WindowBg] = ImColor(32, 32, 32, 255); s.Colors[ImGuiCol_ChildBg] = bgSecondary; s.Colors[ImGuiCol_FrameBg] = ImColor(65, 64, 64, 255); s.Colors[ImGuiCol_FrameBgActive] = ImColor(35, 37, 39, 255); s.Colors[ImGuiCol_Border] = ImColor(1, 1, 1, 255); s.Colors[ImGuiCol_CheckMark] = ImColor(255, 0, 0, 255); s.Colors[ImGuiCol_SliderGrab] = ImColor(255, 0, 0, 255); s.Colors[ImGuiCol_SliderGrab] = ImColor(255, 0, 0, 255); s.Colors[ImGuiCol_SliderGrabActive] = ImColor(255, 0, 0, 255); s.Colors[ImGuiCol_ResizeGrip] = ImColor(24, 24, 24, 255); s.Colors[ImGuiCol_Header] = ImColor(0, 0, 0, 255); s.Colors[ImGuiCol_HeaderHovered] = ImColor(0, 0, 0, 255); s.Colors[ImGuiCol_HeaderActive] = ImColor(0, 0, 0, 255); s.Colors[ImGuiCol_TitleBg] = ImColor(0, 0, 0, 255); s.Colors[ImGuiCol_TitleBgCollapsed] = ImColor(0, 0, 0, 255); s.Colors[ImGuiCol_TitleBgActive] = ImColor(0, 0, 0, 255); s.Colors[ImGuiCol_FrameBgHovered] = ImColor(65, 64, 64, 255); s.Colors[ImGuiCol_ScrollbarBg] = ImColor(0, 0, 0, 255); s.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f); s.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f); s.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f); s.Colors[ImGuiCol_Header] = ImColor(42, 42, 42, 255); s.Colors[ImGuiCol_HeaderHovered] = ImColor(50, 50, 50, 255); s.Colors[ImGuiCol_HeaderActive] = ImColor(50, 50, 50, 255); s.Colors[ImGuiCol_PopupBg] = ImColor(15, 15, 15, 255); s.Colors[ImGuiCol_Button] = ImColor(30, 30, 30, 255); s.Colors[ImGuiCol_ButtonHovered] = ImColor(30, 30, 30, 255); s.Colors[ImGuiCol_ButtonActive] = ImColor(30, 30, 30, 255); s.Colors[ImGuiCol_Text] = ImColor(255, 255, 255, 255); s.AntiAliasedFill = true; s.AntiAliasedLines = true; s.ChildRounding = 0.0f; s.FrameBorderSize = 1.0f; s.FrameRounding = 0.0f; s.PopupRounding = 0.0f; s.ScrollbarRounding = 0.0f; s.ScrollbarSize = 0.0f; s.TabRounding = 0.0f; s.WindowRounding = 0.0f; } auto init_wndparams(HWND hWnd) -> HRESULT { if (FAILED(Direct3DCreate9Ex(D3D_SDK_VERSION, &p_Object))) exit(3); ZeroMemory(&p_Params, sizeof(p_Params)); p_Params.Windowed = TRUE; p_Params.SwapEffect = D3DSWAPEFFECT_DISCARD; p_Params.hDeviceWindow = hWnd; p_Params.MultiSampleQuality = D3DMULTISAMPLE_NONE; p_Params.BackBufferFormat = D3DFMT_A8R8G8B8; p_Params.BackBufferWidth = Width; p_Params.BackBufferHeight = Height; p_Params.EnableAutoDepthStencil = TRUE; p_Params.AutoDepthStencilFormat = D3DFMT_D16; p_Params.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; if (FAILED(p_Object->CreateDeviceEx(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &p_Params, 0, &p_Device))) { p_Object->Release(); exit(4); } IMGUI_CHECKVERSION(); ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); (void)io; ImGuiStyle& s = ImGui::GetStyle(); io.IniFilename = NULL; DefaultTheme(); ImGui_ImplWin32_Init(hWnd); ImGui_ImplDX9_Init(p_Device); return S_OK; } auto get_process_wnd(uint32_t pid) -> HWND { std::pair params = { 0, pid }; BOOL bResult = EnumWindows([](HWND hwnd, LPARAM lParam) -> BOOL { auto pParams = (std::pair*)(lParam); uint32_t processId = 0; if (GetWindowThreadProcessId(hwnd, reinterpret_cast(&processId)) && processId == pParams->second) { SetLastError((uint32_t)-1); pParams->first = hwnd; return FALSE; } return TRUE; }, (LPARAM)¶ms); if (!bResult && GetLastError() == -1 && params.first) return params.first; return NULL; } auto cleanup_d3d() -> void { if (p_Device != NULL) { p_Device->EndScene(); p_Device->Release(); } if (p_Object != NULL) { p_Object->Release(); } } auto set_window_target() -> void { while (true) { GameWnd = get_process_wnd(processid); if (GameWnd) { ZeroMemory(&GameRect, sizeof(GameRect)); GetWindowRect(GameWnd, &GameRect); DWORD dwStyle = GetWindowLong(GameWnd, GWL_STYLE); if (dwStyle & WS_BORDER) { GameRect.top += 32; Height -= 39; } ScreenCenterX = Width / 2; ScreenCenterY = Height / 2; MoveWindow(MyWnd, GameRect.left, GameRect.top, Width, Height, true); } } } auto setup_window() -> void { HANDLE Windowthread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)set_window_target, 0, 0, 0); CloseHandle(Windowthread); WNDCLASSEXA wcex = { sizeof(WNDCLASSEXA), 0, DefWindowProcA, 0, 0, nullptr, LoadIcon(nullptr, IDI_APPLICATION), LoadCursor(nullptr, IDC_ARROW), nullptr, nullptr, ("MirakaKindaCuteNgl"), LoadIcon(nullptr, IDI_APPLICATION) }; RECT Rect; GetWindowRect(GetDesktopWindow(), &Rect); RegisterClassExA(&wcex); MyWnd = CreateWindowExA(NULL, ("MirakaKindaCuteNgl"), ("MirakaKindaCuteNgl"), WS_POPUP, Rect.left, Rect.top, Rect.right, Rect.bottom, NULL, NULL, wcex.hInstance, NULL); SetWindowLong(MyWnd, GWL_EXSTYLE, WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW); SetLayeredWindowAttributes(MyWnd, RGB(0, 0, 0), 255, LWA_ALPHA); MARGINS margin = { -1 }; DwmExtendFrameIntoClientArea(MyWnd, &margin); ShowWindow(MyWnd, SW_SHOW); UpdateWindow(MyWnd); } using namespace ColorStructs; void DrawFilledRect(int x, int y, int w, int h, RGBA* color) { ImGui::GetForegroundDrawList()->AddRectFilled(ImVec2(x, y), ImVec2(x + w, y + h), ImGui::ColorConvertFloat4ToU32(ImVec4(color->R / 255.0, color->G / 153.0, color->B / 51.0, color->A / 255.0)), 0, 0); } void DrawFilledRect2(int x, int y, int w, int h, ImColor color) { ImGui::GetForegroundDrawList()->AddRectFilled(ImVec2(x, y), ImVec2(x + w, y + h), color, 0, 0); } void DrawCornerBox(float x, float y, float w, float h, const ImColor& color) { ImGui::GetForegroundDrawList()->AddLine(ImVec2(x, y), ImVec2(x + w / 4.f, y), color); ImGui::GetForegroundDrawList()->AddLine(ImVec2(x, y), ImVec2(x, y + h / 4.f), color); ImGui::GetForegroundDrawList()->AddLine(ImVec2(x + w, y), ImVec2(x + w - w / 4.f, y), color); ImGui::GetForegroundDrawList()->AddLine(ImVec2(x + w, y), ImVec2(x + w, y + h / 4.f), color); ImGui::GetForegroundDrawList()->AddLine(ImVec2(x, y + h), ImVec2(x + w / 4.f, y + h), color); ImGui::GetForegroundDrawList()->AddLine(ImVec2(x, y + h), ImVec2(x, y + h - h / 4.f), color); ImGui::GetForegroundDrawList()->AddLine(ImVec2(x + w, y + h), ImVec2(x + w, y + h - h / 4.f), color); ImGui::GetForegroundDrawList()->AddLine(ImVec2(x + w, y + h), ImVec2(x + w - w / 4.f, y + h), color); } void DrawNormalBox(int x, int y, int w, int h, int borderPx, ImColor color) { DrawFilledRect2(x + borderPx, y, w, borderPx, color); DrawFilledRect2(x + w - w + borderPx, y, w, borderPx, color); DrawFilledRect2(x, y, borderPx, h, color); DrawFilledRect2(x, y + h - h + borderPx * 2, borderPx, h, color); DrawFilledRect2(x + borderPx, y + h + borderPx, w, borderPx, color); DrawFilledRect2(x + w - w + borderPx, y + h + borderPx, w, borderPx, color); DrawFilledRect2(x + w + borderPx, y, borderPx, h, color); DrawFilledRect2(x + w + borderPx, y + h - h + borderPx * 2, borderPx, h, color); } using namespace UE4Structs; auto Draw2DBox(FVector RootPosition, float Width, float Height, ImColor Color) -> void { DrawNormalBox(RootPosition.x - Width / 2, RootPosition.y - Height / 2, Width, Height, Settings::Visuals::BoxWidth, Color); } void DrawRect(int x, int y, int w, int h, RGBA* color, int thickness) { ImGui::GetForegroundDrawList()->AddRect(ImVec2(x, y), ImVec2(x + w, y + h), ImGui::ColorConvertFloat4ToU32(ImVec4(color->R / 255.0, color->G / 255.0, color->B / 255.0, color->A / 255.0)), 0, 0, thickness); } auto DrawOutlinedBox(FVector RootPosition, float Width, float Height, ImColor Color) -> void { DrawCornerBox(RootPosition.x - Width / 2, RootPosition.y - Height / 2, Width, Height, Color); DrawCornerBox(RootPosition.x - Width / 2 - 1, RootPosition.y - Height / 2 - 1, Width, Height, ImColor(0, 0, 0)); DrawCornerBox(RootPosition.x - Width / 2 + 1, RootPosition.y - Height / 2 + 1, Width, Height, ImColor(0, 0, 0)); } auto DrawDistance(FVector Location, float Distance) -> void { char dist[64]; sprintf_s(dist, "%.fm", Distance); ImVec2 TextSize = ImGui::CalcTextSize(dist); ImGui::GetForegroundDrawList()->AddText(ImVec2(Location.x - TextSize.x / 2, Location.y - TextSize.y / 2), ImGui::GetColorU32({ 255, 255, 255, 255 }), dist); } auto DrawTracers(FVector Target, ImColor Color) -> void { ImGui::GetForegroundDrawList()->AddLine( ImVec2(ScreenCenterX, Height), ImVec2(Target.x, Target.y), Color, 0.1f ); } auto DrawHealthBar(FVector RootPosition, float Width, float Height, float Health, float RelativeDistance)-> void { auto HPBoxWidth = 1 / RelativeDistance; auto HPBox_X = RootPosition.x - Width / 2 - 5 - HPBoxWidth; auto HPBox_Y = RootPosition.y - Height / 2 + (Height - Height * (Health / 100)); int HPBoxHeight = Height * (Health / 100); DrawFilledRect(HPBox_X, HPBox_Y, HPBoxWidth, HPBoxHeight, &ColorStructs::Col.green); DrawRect(HPBox_X - 1, HPBox_Y - 1, HPBoxWidth + 2, HPBoxHeight + 2, &ColorStructs::Col.black, 1); } //main.cpp #include #include #include #include #include #include "overlay/render.hpp" #include "overlay/menu.hpp" #include "game/cheat.hpp" #include #include #include "driver/driver.hpp" DWORD GetProcessID(const std::wstring processName) { PROCESSENTRY32 processInfo; processInfo.dwSize = sizeof(processInfo); HANDLE processesSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL); if (processesSnapshot == INVALID_HANDLE_VALUE) { return 0; } Process32First(processesSnapshot, &processInfo); if (!processName.compare(processInfo.szExeFile)) { CloseHandle(processesSnapshot); return processInfo.th32ProcessID; } while (Process32Next(processesSnapshot, &processInfo)) { if (!processName.compare(processInfo.szExeFile)) { CloseHandle(processesSnapshot); return processInfo.th32ProcessID; } } CloseHandle(processesSnapshot); return 0; } int main() { while (Entryhwnd == NULL) { printf("Waiting for Valorant...\r"); Sleep(1); processid = GetProcessID(L"VALORANT-Win64-Shipping.exe"); Entryhwnd = get_process_wnd(processid); Sleep(1); } driver.initdriver(processid); setup_window(); init_wndparams(MyWnd); std::thread(CacheGame).detach(); main_loop(); exit(0); } auto render() -> void { ImGui_ImplDX9_NewFrame(); ImGui_ImplWin32_NewFrame(); ImGui::NewFrame(); CheatLoop(); drawmenu(); ImGui::EndFrame(); p_Device->SetRenderState(D3DRS_ZENABLE, false); p_Device->SetRenderState(D3DRS_ALPHABLENDENABLE, false); p_Device->SetRenderState(D3DRS_SCISSORTESTENABLE, false); p_Device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0, 0, 0, 0), 1.0f, 0); if (p_Device->BeginScene() >= 0) { ImGui::Render(); ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData()); p_Device->EndScene(); } HRESULT result = p_Device->Present(NULL, NULL, NULL, NULL); if (result == D3DERR_DEVICELOST && p_Device->TestCooperativeLevel() == D3DERR_DEVICENOTRESET) { ImGui_ImplDX9_InvalidateDeviceObjects(); p_Device->Reset(&d3dpp); ImGui_ImplDX9_CreateDeviceObjects(); } } auto main_loop() -> WPARAM { static RECT old_rc; ZeroMemory(&Message, sizeof(MSG)); while (Message.message != WM_QUIT) { if (PeekMessage(&Message, MyWnd, 0, 0, PM_REMOVE)) { TranslateMessage(&Message); DispatchMessage(&Message); } HWND hwnd_active = GetForegroundWindow(); if (GetAsyncKeyState(0x23) & 1) exit(8); if (hwnd_active == GameWnd) { HWND hwndtest = GetWindow(hwnd_active, GW_HWNDPREV); SetWindowPos(MyWnd, hwndtest, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } RECT rc; POINT xy; ZeroMemory(&rc, sizeof(RECT)); ZeroMemory(&xy, sizeof(POINT)); GetClientRect(GameWnd, &rc); ClientToScreen(GameWnd, &xy); rc.left = xy.x; rc.top = xy.y; ImGuiIO& io = ImGui::GetIO(); io.ImeWindowHandle = GameWnd; io.DeltaTime = 1.0f / 60.0f; POINT p; GetCursorPos(&p); io.MousePos.x = p.x - xy.x; io.MousePos.y = p.y - xy.y; if (GetAsyncKeyState(0x1)) { io.MouseDown[0] = true; io.MouseClicked[0] = true; io.MouseClickedPos[0].x = io.MousePos.x; io.MouseClickedPos[0].x = io.MousePos.y; } else io.MouseDown[0] = false; if (rc.left != old_rc.left || rc.right != old_rc.right || rc.top != old_rc.top || rc.bottom != old_rc.bottom) { old_rc = rc; Width = rc.right; Height = rc.bottom; p_Params.BackBufferWidth = Width; p_Params.BackBufferHeight = Height; SetWindowPos(MyWnd, (HWND)0, xy.x, xy.y, Width, Height, SWP_NOREDRAW); p_Device->Reset(&p_Params); } render(); } ImGui_ImplDX9_Shutdown(); ImGui_ImplWin32_Shutdown(); ImGui::DestroyContext(); cleanup_d3d(); DestroyWindow(MyWnd); return Message.wParam; }