Skip to content

Commit

Permalink
feat: new offsets and slight adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
stdNullPtr committed Dec 17, 2024
1 parent b4d819a commit 8f9e70b
Show file tree
Hide file tree
Showing 29 changed files with 63 additions and 43 deletions.
2 changes: 1 addition & 1 deletion um-client/src/controller/Cs2CheatController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ namespace cheat
const auto entity_pawn{driver.read<uintptr_t>(list_entity + 0x78 * (entity_controller_pawn & 0x1FF))};
if (!entity_pawn)
{
std::wcerr << XORW(L"entityPawn is null\n");
std::wcerr << XORW(L"Cant grab player pawn, maybe the player disconnected?\n");
return std::nullopt;
}

Expand Down
15 changes: 13 additions & 2 deletions um-client/src/controller/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ namespace cheat::entity
bool Entity::is_spotted(const driver::Driver& driver) const
{
const auto p_entity_spotted_state{entity_pawn_ + client_dll::C_CSPlayerPawn::m_entitySpottedState};

const auto entity_spotted_address{p_entity_spotted_state + client_dll::EntitySpottedState_t::m_bSpotted};

return driver.read<bool>(entity_spotted_address);
}

Expand All @@ -89,6 +87,19 @@ namespace cheat::entity
return driver.read<float>(entity_pawn_ + client_dll::C_CSPlayerPawnBase::m_flFlashDuration) > 0.0f;
}

bool Entity::is_spotted_by_local_player(const driver::Driver& driver, const int& local_player_index) const
{
if (local_player_index < 0)
{
return false;
}

const auto p_entity_spotted_state{ entity_pawn_ + client_dll::C_CSPlayerPawn::m_entitySpottedState };
const auto entity_spotted_by_mask{ driver.read<uint64_t>(p_entity_spotted_state + client_dll::EntitySpottedState_t::m_bSpottedByMask )};

return entity_spotted_by_mask & (DWORD64(1) << (local_player_index));
}

util::Vec3 Entity::get_forward_vector(const driver::Driver& driver) const
{
const auto movement_services{get_movement_services(driver)};
Expand Down
1 change: 1 addition & 0 deletions um-client/src/controller/Entity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace cheat::entity
[[nodiscard]] bool is_glowing(const driver::Driver& driver) const;
[[nodiscard]] bool is_scoped(const driver::Driver& driver) const;
[[nodiscard]] bool is_flashed(const driver::Driver& driver) const;
[[nodiscard]] bool is_spotted_by_local_player(const driver::Driver& driver, const int& local_player_index) const;
[[nodiscard]] util::Vec3 get_forward_vector(const driver::Driver& driver) const;
[[nodiscard]] util::Vec3 get_vec_origin(const driver::Driver& driver) const;
[[nodiscard]] util::Vec3 get_eye_pos(const driver::Driver& driver) const;
Expand Down
1 change: 1 addition & 0 deletions um-client/src/global.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace g
static const ImVec2 screen_center{screen_width / 2.0f, screen_height / 2.0f};

static ImVec4 esp_color{255.0f, 0.0f, 0.0f, 255.0f};
static ImVec4 esp_color_enemy_visible{ 0.0f, 0.0f, 255.0f, 255.0f };
static float esp_box_thickness{1.0f};
static ImVec4 esp_health_color{0.0f, 255.0f, 0.0f, 255.0f};
static ImVec4 text_color{0.0f, 255.0f, 0.0f, 255.0f};
Expand Down
6 changes: 3 additions & 3 deletions um-client/src/imgui/ImGuiFrame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace cheat::imgui
static inline WNDCLASSEXW wc;
static inline HWND hOverlay;
constexpr auto overlay_window_name{L"zzxzz"};
constexpr auto font_size{22.0f};
constexpr auto font_size{20.0f};
}

LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
Expand Down Expand Up @@ -102,15 +102,15 @@ namespace cheat::imgui
cfg.FontBuilderFlags |= ImGuiFreeTypeBuilderFlags_LoadColor;
//cfg.FontBuilderFlags |= ImGuiFreeTypeBuilderFlags_Bold;
//cfg.RasterizerMultiply = 1.5f;
io.Fonts->AddFontFromFileTTF(XOR(R"(D:\Repos\lmao-driver\um-client\src\imgui\lib\misc\font\NotoSans-Regular.ttf)"), baseFontSize, &cfg, ranges);
io.Fonts->AddFontFromFileTTF(XOR("NotoSans-Regular.ttf"), baseFontSize, &cfg, ranges);

static constexpr ImWchar icons_ranges[]{ICON_MIN_FA, ICON_MAX_16_FA, 0};
static ImFontConfig icons_config;
icons_config.MergeMode = true;
icons_config.PixelSnapH = true;
icons_config.GlyphMinAdvanceX = iconFontSize;
// icons_config.OversampleH = icons_config.OversampleV = 3;
io.Fonts->AddFontFromFileTTF(XOR(R"(D:\Repos\lmao-driver\um-client\src\imgui\lib\misc\font\)" FONT_ICON_FILE_NAME_FAS), iconFontSize, &icons_config, icons_ranges);
io.Fonts->AddFontFromFileTTF(XOR(FONT_ICON_FILE_NAME_FAS), iconFontSize, &icons_config, icons_ranges);
}

namespace frame
Expand Down
28 changes: 17 additions & 11 deletions um-client/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "window.hpp"
#include "controller/Cs2CheatController.hpp"
#include "controller/Entity.hpp"
#include <io.h>
#include <fcntl.h>

#include "controller/Aim.hpp"
Expand All @@ -27,11 +26,6 @@ using render::DrawCache;

int main()
{
_setmode(_fileno(stdout), _O_WTEXT);
_setmode(_fileno(stdin), _O_WTEXT);

(void)std::setlocale(LC_ALL, "en_US.utf8");

setCursorVisibility(false);

const driver::Driver driver{};
Expand Down Expand Up @@ -152,6 +146,7 @@ int main()
#endif

std::vector<Vec2> aim_targets;
static int local_player_index{-1};
for (int i{1}; i < 64; i++)
{
const std::optional entity{cheat.get_entity_from_list(driver, i)};
Expand All @@ -161,15 +156,22 @@ int main()
continue;
}

if (entity->is_local_player(driver))
{
local_player_index = i - 1;
}

const auto player_health{entity->get_health(driver)};
const auto player_team{entity->get_team(driver)};
const auto is_valid_enemy{my_team != player_team && player_health > 0};

if (!is_valid_enemy)
{
continue;
}

const auto entity_spotted{entity->is_spotted(driver)};
const auto entity_spotted_by_local_player{entity->is_spotted_by_local_player(driver, local_player_index)};
const auto entity_name{entity->get_name(driver)};
const auto is_scoped{entity->is_scoped(driver)};
auto weapon_name{entity->get_weapon_name(driver)};
Expand All @@ -183,16 +185,18 @@ int main()

#ifndef NDEBUG
std::wcout << XORW(L"Ent: ") << i << '\n'
<< XORW(L"Is this me: ") << (is_local_player ? "yes" : "no") << '\n'
<< XORW(L"Enemy: ") << (my_team != player_team ? "yes" : "no") << '\n'
<< XORW(L"HP: ") << std::dec << player_health << '\n'
<< XORW(L"Visible on Radar: ") << (entity_spotted ? "yes" : "no") << '\n';
#endif

const auto head_bone_pos_world{entity->get_head_bone_pos(driver)};
const auto head_bone_pos_screen{render::utils::world_to_screen(view_matrix, head_bone_pos_world)};
const auto aim_position{head_bone_pos_screen};
aim_targets.emplace_back(aim_position);
if (entity_spotted_by_local_player)
{
const auto aim_position{head_bone_pos_screen};
aim_targets.emplace_back(aim_position);
}

if (glow_hack)
{
Expand All @@ -207,9 +211,11 @@ int main()

if (esp_hack && (render::utils::is_in_screen(entity_eyes_pos_screen) || render::utils::is_in_screen(entity_feet_pos_screen)))
{
const auto esp_player{util::esp::build_player_esp(entity_eyes_pos_screen, entity_feet_pos_screen)};
const auto esp_box_color{entity_spotted_by_local_player ? g::esp_color_enemy_visible : g::esp_color};

const auto esp_player{util::esp::build_player_esp(entity_eyes_pos_screen, entity_feet_pos_screen, esp_box_color)};
const auto esp_bones{util::esp::build_bone_esp(head_bone_pos_screen)};
const auto esp_health{util::esp::build_health_esp(esp_player.get_top_left(), esp_player.get_bottom_right(), player_health)};
const auto esp_health{util::esp::build_health_esp(esp_player.get_top_left(), esp_player.get_bottom_right(), player_health, esp_box_color)};
const auto esp_player_bottom{util::esp::build_player_bottom_esp(entity_name, entity_eyes_pos_screen, esp_player.get_bottom_right(), weapon_name)};
const auto esp_player_top{util::esp::build_player_top_esp(is_scoped, entity_eyes_pos_screen, esp_player.get_top_left())};

Expand Down
3 changes: 2 additions & 1 deletion um-client/src/render/Render.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ namespace render
ImGui::TextUnformatted(ICON_FA_EYE);
ImGui::PopStyleColor();

ImGui::Checkbox(XOR("[F6] AIM "), &aim_hack);
ImGui::Checkbox(XOR("[F6] AIM (hold middle mouse)"), &aim_hack);
ImGui::SameLine();
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
ImGui::TextUnformatted(ICON_FA_CROSSHAIRS);
Expand Down Expand Up @@ -223,6 +223,7 @@ namespace render
ImGui::PopStyleColor();

ImGui::ColorEdit3(XOR("Box"), reinterpret_cast<float*>(&g::esp_color));
ImGui::ColorEdit3(XOR("Box when enemy visible"), reinterpret_cast<float*>(&g::esp_color_enemy_visible));
ImGui::ColorEdit3(XOR("Health"), reinterpret_cast<float*>(&g::esp_health_color));
ImGui::ColorEdit3(XOR("Text"), reinterpret_cast<float*>(&g::text_color));
ImGui::ColorEdit3(XOR("Carrying AWP text"), reinterpret_cast<float*>(&g::weapon_awp_text_color));
Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/animationsystem_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/buttons.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/client_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/engine2_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/host_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/info.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"build_number": 14055,
"timestamp": "2024-12-15T21:31:09.733383900+00:00"
"timestamp": "2024-12-17T19:49:06.424924500+00:00"
}
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/interfaces.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/materialsystem2_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/networksystem_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/offsets.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/panorama_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/particles_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/pulse_system_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/rendersystemdx11_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/resourcesystem_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/scenesystem_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/schemasystem_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/server_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/soundsystem_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/vphysics2_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion um-client/src/sdk/dumper/worldrenderer_dll.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated using https://github.com/a2x/cs2-dumper
// 2024-12-15 21:31:09.733383900 UTC
// 2024-12-17 19:49:06.424924500 UTC

#pragma once

Expand Down
8 changes: 4 additions & 4 deletions um-client/src/util/Esp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace util::esp
return head_bone_circle;
}

inline DrawCache build_player_esp(const Vec2& entity_eyes_pos_screen, const Vec2& entity_feet_pos_screen)
inline DrawCache build_player_esp(const Vec2& entity_eyes_pos_screen, const Vec2& entity_feet_pos_screen, const ImVec4& esp_box_color)
{
constexpr float width_shrink_coefficient{0.35f};
constexpr float height_shrink_coefficient{0.15f};
Expand All @@ -25,19 +25,19 @@ namespace util::esp
const auto main_esp_top_left{ImVec2{entity_eyes_pos_screen.x - width_relative_to_player_distance, entity_eyes_pos_screen.y - height_relative_to_player_distance}};
const auto main_esp_bot_right{ImVec2{entity_feet_pos_screen.x + width_relative_to_player_distance, entity_feet_pos_screen.y + height_relative_to_player_distance}};

const DrawCache main_esp_box{DrawCache::build_rect(main_esp_top_left, main_esp_bot_right, false, g::esp_color, g::esp_box_thickness)};
const DrawCache main_esp_box{DrawCache::build_rect(main_esp_top_left, main_esp_bot_right, false, esp_box_color, g::esp_box_thickness)};

return main_esp_box;
}

inline std::vector<DrawCache> build_health_esp(const ImVec2& player_esp_top_left, const ImVec2& player_esp_bot_right, const int& health)
inline std::vector<DrawCache> build_health_esp(const ImVec2& player_esp_top_left, const ImVec2& player_esp_bot_right, const int& health, const ImVec4& esp_box_color)
{
const DrawCache esp_health_border{
DrawCache::build_rect(
ImVec2{player_esp_top_left.x - 10.0f, player_esp_top_left.y},
ImVec2{player_esp_top_left.x, player_esp_bot_right.y},
false,
g::esp_color,
esp_box_color,
g::esp_box_thickness
)
};
Expand Down

0 comments on commit 8f9e70b

Please sign in to comment.