From 04615c41b0f77839e414a95cfb1430ed0a97d4a3 Mon Sep 17 00:00:00 2001 From: ALittlePatate Date: Thu, 4 Jan 2024 16:38:29 +0100 Subject: [PATCH] add: valve-bsp-parser, vis check --- .gitignore | 3 +- .gitmodules | 3 ++ ImGuiExternal.sln | 14 ++++++-- ImGuiExternal/ImGuiExternal.vcxproj | 12 ++++--- ImGuiExternal/Memory.h | 2 ++ ImGuiExternal/Source.cpp | 56 ++++++++++++++++++++++++----- ImGuiExternal/valve-bsp-parser | 1 + 7 files changed, 75 insertions(+), 16 deletions(-) create mode 100644 .gitmodules create mode 160000 ImGuiExternal/valve-bsp-parser diff --git a/.gitignore b/.gitignore index 61c1e23..b94f731 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vs x64/ ImGuiExternal/x64 -ImGuiExternal/imgui.ini \ No newline at end of file +ImGuiExternal/imgui.ini +build \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..126cdc8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ImGuiExternal/valve-bsp-parser"] + path = ImGuiExternal/valve-bsp-parser + url = https://github.com/ReactiioN1337/valve-bsp-parser diff --git a/ImGuiExternal.sln b/ImGuiExternal.sln index fd83e22..b262a34 100644 --- a/ImGuiExternal.sln +++ b/ImGuiExternal.sln @@ -1,10 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30717.126 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32407.343 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImGuiExternal", "ImGuiExternal\ImGuiExternal.vcxproj", "{7D1BDD05-83F1-4D14-90B2-FFF94447B2F0}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "valve-bsp-parser", "ImGuiExternal\valve-bsp-parser\valve-bsp-parser.vcxproj", "{39750587-C53C-44E3-8542-80112A0E8AB3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -21,6 +23,14 @@ Global {7D1BDD05-83F1-4D14-90B2-FFF94447B2F0}.Release|x64.Build.0 = Release|x64 {7D1BDD05-83F1-4D14-90B2-FFF94447B2F0}.Release|x86.ActiveCfg = Release|Win32 {7D1BDD05-83F1-4D14-90B2-FFF94447B2F0}.Release|x86.Build.0 = Release|Win32 + {39750587-C53C-44E3-8542-80112A0E8AB3}.Debug|x64.ActiveCfg = Debug|x64 + {39750587-C53C-44E3-8542-80112A0E8AB3}.Debug|x64.Build.0 = Debug|x64 + {39750587-C53C-44E3-8542-80112A0E8AB3}.Debug|x86.ActiveCfg = Debug|Win32 + {39750587-C53C-44E3-8542-80112A0E8AB3}.Debug|x86.Build.0 = Debug|Win32 + {39750587-C53C-44E3-8542-80112A0E8AB3}.Release|x64.ActiveCfg = Release|x64 + {39750587-C53C-44E3-8542-80112A0E8AB3}.Release|x64.Build.0 = Release|x64 + {39750587-C53C-44E3-8542-80112A0E8AB3}.Release|x86.ActiveCfg = Release|Win32 + {39750587-C53C-44E3-8542-80112A0E8AB3}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ImGuiExternal/ImGuiExternal.vcxproj b/ImGuiExternal/ImGuiExternal.vcxproj index b4960fe..26b097c 100644 --- a/ImGuiExternal/ImGuiExternal.vcxproj +++ b/ImGuiExternal/ImGuiExternal.vcxproj @@ -82,13 +82,13 @@ true - $(ProjectDir)\Directories\Microsoft DirectX SDK\Include;$(IncludePath) - $(ProjectDir)\Directories\Microsoft DirectX SDK\Lib\x64;$(LibraryPath) + $(ProjectDir)valve-bsp-parser\include;$(ProjectDir)\Directories\Microsoft DirectX SDK\Include;$(ProjectDir)valve-bsp-parser\thirdparty\liblzma\include;$(IncludePath) + $(SolutionDir)build\$(Configuration)-x64\;$(ProjectDir)\Directories\Microsoft DirectX SDK\Lib\x64;$(LibraryPath) false - $(ProjectDir)\Directories\Microsoft DirectX SDK\Include;$(IncludePath) - $(ProjectDir)\Directories\Microsoft DirectX SDK\Lib\x64;$(LibraryPath) + $(ProjectDir)valve-bsp-parser\include;$(ProjectDir)\Directories\Microsoft DirectX SDK\Include;$(ProjectDir)valve-bsp-parser\thirdparty\liblzma\include;$(IncludePath) + $(SolutionDir)build\$(Configuration)-x64\;$(ProjectDir)\Directories\Microsoft DirectX SDK\Lib\x64;$(LibraryPath) @@ -134,12 +134,14 @@ true stdcpp17 stdc17 + MultiThreadedDebug Console true false /ignore:4099 %(AdditionalOptions) + valve-bsp-parser.lib;%(AdditionalDependencies) @@ -152,6 +154,7 @@ true stdcpp17 stdc17 + MultiThreaded Console @@ -160,6 +163,7 @@ true false /ignore:4099 %(AdditionalOptions) + valve-bsp-parser.lib;%(AdditionalDependencies) diff --git a/ImGuiExternal/Memory.h b/ImGuiExternal/Memory.h index 2e30095..4487623 100644 --- a/ImGuiExternal/Memory.h +++ b/ImGuiExternal/Memory.h @@ -14,6 +14,7 @@ #define LIFESTATE 0x93 //player #define BONEMATRIX 0x578 //player https://youtu.be/elKUMiqitxY #define VIEW_MATRIX 0x5B0D68 //engine +#define MAP_NAME 0x47796D //engine class Vector3 { public: @@ -45,6 +46,7 @@ namespace Game { HANDLE handle = NULL; uintptr_t client = NULL; uintptr_t engine = NULL; + char path[MAX_PATH]; DWORD PID = 0; } diff --git a/ImGuiExternal/Source.cpp b/ImGuiExternal/Source.cpp index 27176eb..d6eb9b1 100644 --- a/ImGuiExternal/Source.cpp +++ b/ImGuiExternal/Source.cpp @@ -1,3 +1,4 @@ +#include #include "xorstr.hpp" #include "Functions.h" #include "Memory.h" @@ -16,14 +17,19 @@ bool ally_esp_health_bar = false; bool enemy_esp_health_bar = true; bool ally_name = false; bool enemy_name = true; +bool enemy_esp_visible = false; +bool ally_esp_visible = false; bool crosshair = true; bool ImGui_Initialised = false; bool CreateConsole = false; bool aimbot = true; bool show_fov = true; float aim_fov = 10.f; +bool aim_visible = true; float smooth = 75.f; +using namespace rn; + namespace OverlayWindow { WNDCLASSEX WindowClass; HWND Hwnd; @@ -38,13 +44,13 @@ namespace DirectX9Interface { MSG Message = { NULL }; } -void DoAimbot(Vector3 headpos, float factor, bool show_fov) { - if (factor > 16.f) +bsp_parser _bsp_parser; +void DoAimbot(Vector3 headpos, float factor, bool show_fov, bool is_visible) { + if (factor > 16.f || (!is_visible && aim_visible)) return; float fov = (factor / ((30 - aim_fov) - factor)) * 100; float aimX = headpos.x - Process::WindowWidth / 2; float aimY = headpos.y - Process::WindowHeight / 2; - if (show_fov) { RGBA White = { 255, 255, 255, 255 }; DrawCircle((int)headpos.x, (int)headpos.y, fov, &White); @@ -69,6 +75,23 @@ void Draw() { RGBA Cyan = { 0, 231, 255, 255 }; if (crosshair) DrawCircleFilled(Process::WindowWidth/2, Process::WindowHeight/2, 3, &Cyan); + char map_name[256]; + static bool parsed_map = false; + static std::string map_name_old = ""; + for (int j = 0; j < 256; j++) { + char c = RPM(Game::engine + MAP_NAME + j*sizeof(char)); + if (c == '\0') { + map_name[j] = '\0'; + break; + } + map_name[j] = c; + } + + if (std::string(map_name) != map_name_old || !parsed_map) { + parsed_map = _bsp_parser.load_map(std::string(Game::path) + std::string("cstrike\\maps"), map_name); + map_name_old = std::string(map_name); + } + if (!ally_esp && !enemy_esp && !aimbot && !show_fov) { return; } @@ -80,6 +103,7 @@ void Draw() { uintptr_t entity_list = Game::client + ENTITY_LIST; uintptr_t localplayer = RPM(Game::client + LOCALPLAYER); + Vector3 pos = RPM(localplayer + XYZ); int localplayer_team = RPM(localplayer + TEAM); int ent_idx = 0; @@ -110,6 +134,7 @@ void Draw() { continue; } + bool is_visible = _bsp_parser.is_visible(vector3{ pos.x, pos.y, pos.z + 66 }, vector3{ absOrigin.x, absOrigin.y, absOrigin.z + 66 }); //getting name DWORD list = RPM(Game::client + NAME_LIST) + 0x38; @@ -144,30 +169,35 @@ void Draw() { if (!WorldToScreen(neckpos, w2s_neckpos)) { continue; } - DoAimbot(w2s_neckpos, sqrt(abs(w2s_headpos.y - w2s_neckpos.y)), show_fov); + + DoAimbot(w2s_neckpos, sqrt(abs(w2s_headpos.y - w2s_neckpos.y)), show_fov, is_visible); #ifdef _DEBUG char ent_text[256]; - sprintf(ent_text, xorstr_("%s --> %d %f %f %f"), name, health, headpos.x, headpos.y, headpos.z); + sprintf(ent_text, xorstr_("%s --> %d"), name, health); DrawStrokeText(30, 100 + 16*ent_idx, &White, ent_text); ent_idx++; #endif // _DEBUG RGBA color = { 255, 255, 255, 255 }; - if ((ent_team == localplayer_team && ally_box && ally_esp) || (ent_team != localplayer_team && enemy_box && enemy_esp)) { + if ((ent_team == localplayer_team && ally_box && ally_esp && ((ally_esp_visible && is_visible) || !ally_esp_visible)) + || (ent_team != localplayer_team && enemy_box && enemy_esp && ((enemy_esp_visible && is_visible) || !enemy_esp_visible))) { DrawEspBox2D(w2s_absOrigin, w2s_headpos, &color, 1); } - if ((ent_team == localplayer_team && ally_name && ally_esp) || (ent_team != localplayer_team && enemy_name && enemy_esp)) { + if ((ent_team == localplayer_team && ally_name && ally_esp && ((ally_esp_visible && is_visible) || !ally_esp_visible)) + || (ent_team != localplayer_team && enemy_name && enemy_esp && ((enemy_esp_visible && is_visible) || !enemy_esp_visible))) { DrawNameTag(w2s_absOrigin, w2s_headpos, name); } - if ((ent_team == localplayer_team && ally_esp_health_bar && ally_esp) || (ent_team != localplayer_team && enemy_esp_health_bar && enemy_esp)) { + if ((ent_team == localplayer_team && ally_esp_health_bar && ally_esp && ((ally_esp_visible && is_visible) || !ally_esp_visible)) + || (ent_team != localplayer_team && enemy_esp_health_bar && enemy_esp && ((enemy_esp_visible && is_visible) || !enemy_esp_visible))) { DrawHealthBar(w2s_absOrigin, w2s_headpos, health); } - if ((ent_team == localplayer_team && ally_skeleton && ally_esp) || (ent_team != localplayer_team && enemy_skeleton && enemy_esp)) { + if ((ent_team == localplayer_team && ally_skeleton && ally_esp && ((ally_esp_visible && is_visible) || !ally_esp_visible)) + || (ent_team != localplayer_team && enemy_skeleton && enemy_esp && ((enemy_esp_visible && is_visible) || !enemy_esp_visible))) { DrawBones(bonematrix_addr, &color, 1); } } @@ -181,6 +211,8 @@ void DrawMenu() { ImGui::Separator(); ImGui::Checkbox("Ally ESP", &ally_esp); + ImGui::SameLine(); + ImGui::Checkbox("Visible only##ally", &ally_esp_visible); ImGui::Checkbox("Box##ally", &ally_box); ImGui::Checkbox("Skeleton##ally", &ally_skeleton); ImGui::Checkbox("Healthbar##ally", &ally_esp_health_bar); @@ -188,6 +220,8 @@ void DrawMenu() { ImGui::Separator(); ImGui::Checkbox("Enemy ESP", &enemy_esp); + ImGui::SameLine(); + ImGui::Checkbox("Visible only##enemy", &enemy_esp_visible); ImGui::Checkbox("Box##enemy", &enemy_box); ImGui::Checkbox("Skeleton##enemy", &enemy_skeleton); ImGui::Checkbox("Healthbar##enemy", &enemy_esp_health_bar); @@ -197,6 +231,7 @@ void DrawMenu() { ImGui::Checkbox("Aimbot", &aimbot); ImGui::SameLine(); ImGui::Checkbox("Show FOV", &show_fov); + ImGui::Checkbox("Visible only##aimbot", &aim_visible); ImGui::SliderFloat("FOV", &aim_fov, 1.f, 30.f, "%1.f", 1.f); ImGui::SliderFloat("Smoothing", &smooth, 0.f, 100.f, "%1.f", 1.f); @@ -465,6 +500,9 @@ int main() { } Game::handle = OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, false, Game::PID); + DWORD size = MAX_PATH; + QueryFullProcessImageNameA(Game::handle, 0, Game::path, &size); + Game::path[strlen(Game::path) - 7] = '\0'; std::string s = RandomString(10); OverlayWindow::Name = s.c_str(); diff --git a/ImGuiExternal/valve-bsp-parser b/ImGuiExternal/valve-bsp-parser new file mode 160000 index 0000000..0d1d441 --- /dev/null +++ b/ImGuiExternal/valve-bsp-parser @@ -0,0 +1 @@ +Subproject commit 0d1d441eaabfa1f6ba10ee52eb8ed2d5eaaae27f