├── Release └── svchost.tlog │ ├── CL.read.1.tlog │ ├── CL.write.1.tlog │ ├── CL.command.1.tlog │ ├── link.read.1.tlog │ ├── link.write.1.tlog │ ├── link.write.2u.tlog │ ├── link.command.1.tlog │ └── svchost.lastbuildstate ├── README.md ├── vExample.vcxproj.user ├── Sdk ├── Classes │ ├── Players.hpp │ ├── ItemContainer.hpp │ ├── PlayerInventory.hpp │ ├── PlayerEyes.hpp │ ├── Camera.hpp │ ├── PlayerInput.hpp │ ├── ModelState.hpp │ ├── PlayerModel.hpp │ ├── BasePlayer.hpp │ ├── World.hpp │ └── BaseMovement.hpp ├── Unity │ ├── Utils.hpp │ └── Unity.hpp └── Features │ ├── Movement.hpp │ ├── Weapon.hpp │ └── Enviorment.hpp ├── Overlay ├── Misc.hpp ├── ImGui │ ├── imgui_impl_dx11.h │ ├── imgui_impl_win32.h │ ├── imconfig.h │ └── imstb_rectpack.h ├── Esp.hpp └── Menu.hpp ├── Threads ├── Update.cpp ├── Main.cpp ├── Aimbot.cpp ├── Overlay.cpp └── Misc.cpp ├── vExample.sln ├── Header Files ├── Includes.hpp ├── Global.hpp ├── Math.hpp └── XorStr.hpp ├── vExample.vcxproj.filters └── vExample.vcxproj /Release/svchost.tlog/CL.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Visual1337/rust-external-base/HEAD/Release/svchost.tlog/CL.read.1.tlog -------------------------------------------------------------------------------- /Release/svchost.tlog/CL.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Visual1337/rust-external-base/HEAD/Release/svchost.tlog/CL.write.1.tlog -------------------------------------------------------------------------------- /Release/svchost.tlog/CL.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Visual1337/rust-external-base/HEAD/Release/svchost.tlog/CL.command.1.tlog -------------------------------------------------------------------------------- /Release/svchost.tlog/link.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Visual1337/rust-external-base/HEAD/Release/svchost.tlog/link.read.1.tlog -------------------------------------------------------------------------------- /Release/svchost.tlog/link.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Visual1337/rust-external-base/HEAD/Release/svchost.tlog/link.write.1.tlog -------------------------------------------------------------------------------- /Release/svchost.tlog/link.write.2u.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Visual1337/rust-external-base/HEAD/Release/svchost.tlog/link.write.2u.tlog -------------------------------------------------------------------------------- /Release/svchost.tlog/link.command.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Visual1337/rust-external-base/HEAD/Release/svchost.tlog/link.command.1.tlog -------------------------------------------------------------------------------- /Release/svchost.tlog/svchost.lastbuildstate: -------------------------------------------------------------------------------- 1 | PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.35.32215:TargetPlatformVersion=10.0.22621.0: 2 | Release|x64|C:\Users\iboot\Desktop\DissolutionV2\| 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rust-external-base 2 | 3 | 4 | decent external rust base should be updated just add your own driver and should work 5 | 6 | if you would like to buy a source or a driver/injector for any eac&be game dm visual#1336 7 | -------------------------------------------------------------------------------- /vExample.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | -------------------------------------------------------------------------------- /Sdk/Classes/Players.hpp: -------------------------------------------------------------------------------- 1 | class players 2 | { 3 | public: 4 | BasePlayer* local{}; 5 | uintptr_t local_position_ptr; 6 | Vector3 local_position; 7 | 8 | BasePlayer* aim_target{}; 9 | uintptr_t aim_target_cached_bones; 10 | uintptr_t aim_position_ptr; 11 | } players; -------------------------------------------------------------------------------- /Overlay/Misc.hpp: -------------------------------------------------------------------------------- 1 | int MiscDrawing() 2 | { 3 | auto draw = ImGui::GetBackgroundDrawList(); 4 | 5 | if (global.draw_fov) 6 | { 7 | draw->AddCircle(ImVec2(global.screen_width / 2, global.screen_height / 2), global.aimbot_fov, ImColor(255, 255, 255, 255), 64, 1.f); 8 | } 9 | 10 | return -1; 11 | } -------------------------------------------------------------------------------- /Sdk/Classes/ItemContainer.hpp: -------------------------------------------------------------------------------- 1 | class ItemContainer 2 | { 3 | public: 4 | 5 | uintptr_t GetItemList() 6 | { 7 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 8 | 9 | return driver.read(reinterpret_cast(this) + Offsets::ItemContainer.ItemList); 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /Sdk/Classes/PlayerInventory.hpp: -------------------------------------------------------------------------------- 1 | class PlayerInventory 2 | { 3 | public: 4 | ItemContainer* GetContainerMain() 5 | { 6 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 7 | 8 | return driver.read(reinterpret_cast(this) + Offsets::PlayerInventory.ContainerMain); 9 | } 10 | 11 | ItemContainer* GetContainerBelt() 12 | { 13 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 14 | 15 | return driver.read(reinterpret_cast(this) + Offsets::PlayerInventory.ContainerBelt); 16 | } 17 | 18 | ItemContainer* GetContainerWear() 19 | { 20 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 21 | 22 | return driver.read(reinterpret_cast(this) + Offsets::PlayerInventory.ContainerWear); 23 | } 24 | }; -------------------------------------------------------------------------------- /Sdk/Classes/PlayerEyes.hpp: -------------------------------------------------------------------------------- 1 | class PlayerEyes 2 | { 3 | public: 4 | Vector3 GetViewOffset() 5 | { 6 | if (!Utils::ValidPointer(reinterpret_cast(this))) return Vector3(0,0,0); 7 | 8 | return driver.read(reinterpret_cast(this) + Offsets::PlayerEyes.ViewOffset); 9 | } 10 | 11 | void SetViewOffset(Vector3 value) 12 | { 13 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 14 | 15 | driver.write(reinterpret_cast(this) + Offsets::PlayerEyes.ViewOffset, value); 16 | } 17 | 18 | Vector4 GetBodyRotation() 19 | { 20 | if (!Utils::ValidPointer(reinterpret_cast(this))) return Vector4(0,0,0,0); 21 | 22 | return driver.read(reinterpret_cast(this) + Offsets::PlayerEyes.BodyRotation); 23 | } 24 | 25 | void SetBodyRotation(Vector4 angle) 26 | { 27 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 28 | 29 | driver.write(reinterpret_cast(this) + Offsets::PlayerEyes.BodyRotation, angle); 30 | } 31 | }; -------------------------------------------------------------------------------- /Sdk/Classes/Camera.hpp: -------------------------------------------------------------------------------- 1 | class Camera 2 | { 3 | public: 4 | 5 | bool WorldToScreen(const Vector3& entity_position, Vector2& screen_position, matrix4x4 view_matrix) 6 | { 7 | Vector3 trans_vec{ view_matrix._14, view_matrix._24, view_matrix._34 }; 8 | Vector3 right_vec{ view_matrix._11, view_matrix._21, view_matrix._31 }; 9 | Vector3 up_vec{ view_matrix._12, view_matrix._22, view_matrix._32 }; 10 | 11 | float w = trans_vec.Dot(entity_position) + view_matrix._44; 12 | 13 | if (w < 0.00f) return false; 14 | 15 | float y = up_vec.Dot(entity_position) + view_matrix._42; 16 | float x = right_vec.Dot(entity_position) + view_matrix._41; 17 | 18 | screen_position = Vector2((global.screen_width / 2) * (1.f + x / w) + 4, (global.screen_height / 2) * (1.f - y / w) + 4); 19 | return true; 20 | } 21 | 22 | matrix4x4 GetMatrix() 23 | { 24 | if (!Utils::ValidPointer(reinterpret_cast(this))) return {}; 25 | return driver.read(reinterpret_cast(this) + Offsets::Camera.ViewMatrix2); 26 | } 27 | 28 | uintptr_t GetMainCamera() 29 | { 30 | return Unity->GetCameraFromName("Main Camera"); 31 | } 32 | }camera; -------------------------------------------------------------------------------- /Sdk/Classes/PlayerInput.hpp: -------------------------------------------------------------------------------- 1 | class PlayerInput 2 | { 3 | public: 4 | Vector3 GetBodyAngles() 5 | { 6 | if (!Utils::ValidPointer(reinterpret_cast(this))) return Vector3(0, 0, 0); 7 | 8 | return driver.read(reinterpret_cast(this) + Offsets::PlayerInput.BodyAngles); 9 | } 10 | 11 | void SetBodyAngles(Vector3 angles) 12 | { 13 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 14 | 15 | driver.write(reinterpret_cast(this) + Offsets::PlayerInput.BodyAngles, angles); 16 | } 17 | 18 | Vector3 GetRecoilAngles() 19 | { 20 | if (!Utils::ValidPointer(reinterpret_cast(this))) return Vector3(0,0,0); 21 | 22 | return driver.read(reinterpret_cast(this) + Offsets::PlayerInput.RecoilAngles); 23 | } 24 | 25 | bool GetAutoRun() 26 | { 27 | if (!Utils::ValidPointer(reinterpret_cast(this))) return false; 28 | 29 | return driver.read(reinterpret_cast(this) + Offsets::PlayerInput.AutoRun); 30 | } 31 | 32 | void SetAutoRun(bool value) 33 | { 34 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 35 | 36 | driver.write(reinterpret_cast(this) + Offsets::PlayerInput.AutoRun, value); 37 | } 38 | }; -------------------------------------------------------------------------------- /Threads/Update.cpp: -------------------------------------------------------------------------------- 1 | #include "Includes.hpp" 2 | 3 | int UpdateLists() 4 | { 5 | std::mutex thread_lock; 6 | thread_lock.lock(); 7 | 8 | printf("[+] Thread 1 Started\n"); 9 | while (true) 10 | { 11 | World* world = driver.read(global.game_assembly + Offsets::GameAssembly.BaseGameMode); 12 | 13 | global.camera = camera.GetMainCamera(); 14 | 15 | AllList full_list = world->GetFullList(); 16 | 17 | global.player_list = full_list.player; 18 | global.resource_list = full_list.resource; 19 | global.world_list = full_list.world; 20 | global.item_list = full_list.item; 21 | 22 | global.chams_materials = world->GetChamsMaterials(); 23 | 24 | std::this_thread::sleep_for(std::chrono::milliseconds(1000)); 25 | } 26 | thread_lock.unlock(); 27 | return -1; 28 | } 29 | 30 | int UpdatePositions() 31 | { 32 | std::mutex thread_lock; 33 | thread_lock.lock(); 34 | printf("[+] Thread 2 Started\n"); 35 | 36 | while (true) 37 | { 38 | //global.view_matrix = driver.read(global.camera + Offsets::Camera.ViewMatrix2); 39 | players.local_position = driver.read(players.local_position_ptr + 0x90); 40 | 41 | if (GetAsyncKeyState(global.auto_farm_key) & 1) 42 | { 43 | global.auto_farm = !global.auto_farm; 44 | } 45 | 46 | std::this_thread::sleep_for(std::chrono::milliseconds(10)); 47 | } 48 | thread_lock.unlock(); 49 | return -1; 50 | } -------------------------------------------------------------------------------- /Overlay/ImGui/imgui_impl_dx11.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer Backend for DirectX11 2 | // This needs to be used along with a Platform Backend (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 7 | 8 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 9 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 10 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 11 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 12 | 13 | #pragma once 14 | #include "imgui.h" // IMGUI_IMPL_API 15 | 16 | struct ID3D11Device; 17 | struct ID3D11DeviceContext; 18 | 19 | IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context); 20 | IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown(); 21 | IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame(); 22 | IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data); 23 | 24 | // Use if you want to reset your rendering device without losing Dear ImGui state. 25 | IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects(); 26 | IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects(); 27 | -------------------------------------------------------------------------------- /Sdk/Classes/ModelState.hpp: -------------------------------------------------------------------------------- 1 | class ModelState 2 | { 3 | public: 4 | float GetWaterLevel() 5 | { 6 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 7 | 8 | return driver.read(reinterpret_cast(this) + Offsets::ModelState.WaterLevel); 9 | } 10 | 11 | void SetWaterLevel(float value) 12 | { 13 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 14 | 15 | driver.write(reinterpret_cast(this) + Offsets::ModelState.WaterLevel, value); 16 | } 17 | 18 | int GetModelStateFlags() 19 | { 20 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 21 | 22 | return driver.read(reinterpret_cast(this) + Offsets::ModelState.Flags); 23 | } 24 | 25 | void SetModelStateFlags(ModelStateFlags modelFlags) 26 | { 27 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 28 | 29 | int flags = driver.read(reinterpret_cast(this) + Offsets::ModelState.Flags); 30 | driver.write(reinterpret_cast(this) + Offsets::ModelState.Flags, (flags |= flags)); 31 | } 32 | 33 | void SetRemoveModelStateFlags(ModelStateFlags modelFlags) 34 | { 35 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 36 | 37 | int flags = driver.read(reinterpret_cast(this) + Offsets::ModelState.Flags); 38 | driver.write(reinterpret_cast(this) + Offsets::ModelState.Flags, (flags &= ~flags)); 39 | } 40 | }; -------------------------------------------------------------------------------- /vExample.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.3.32929.385 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HV-Rust", "vExample.vcxproj", "{49B3D1C7-1E28-45F4-99DD-95B175CFABBA}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {49B3D1C7-1E28-45F4-99DD-95B175CFABBA}.Debug|x64.ActiveCfg = Debug|x64 17 | {49B3D1C7-1E28-45F4-99DD-95B175CFABBA}.Debug|x64.Build.0 = Debug|x64 18 | {49B3D1C7-1E28-45F4-99DD-95B175CFABBA}.Debug|x86.ActiveCfg = Debug|Win32 19 | {49B3D1C7-1E28-45F4-99DD-95B175CFABBA}.Debug|x86.Build.0 = Debug|Win32 20 | {49B3D1C7-1E28-45F4-99DD-95B175CFABBA}.Release|x64.ActiveCfg = Release|x64 21 | {49B3D1C7-1E28-45F4-99DD-95B175CFABBA}.Release|x64.Build.0 = Release|x64 22 | {49B3D1C7-1E28-45F4-99DD-95B175CFABBA}.Release|x86.ActiveCfg = Release|Win32 23 | {49B3D1C7-1E28-45F4-99DD-95B175CFABBA}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {886213AE-1623-4808-A7D5-6FBFE1702A8D} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /Sdk/Unity/Utils.hpp: -------------------------------------------------------------------------------- 1 | namespace Utils 2 | { 3 | inline auto ValidPointer(uintptr_t pointer) -> bool 4 | { 5 | return (pointer && pointer > 0xFFFFFF && pointer < 0x7FFFFFFFFFFF); 6 | } 7 | 8 | unsigned HashString(const std::string& str) 9 | { 10 | unsigned int hash = 1315423911; 11 | 12 | for (std::size_t i = 0; i < str.length(); i++) 13 | { 14 | hash ^= ((hash << 5) + str[i] + (hash >> 2)); 15 | } 16 | 17 | return (hash & 0x7FFFFFFF); 18 | } 19 | 20 | std::string GetBasePath(std::string const& path) 21 | { 22 | std::string removed_path = path.substr(path.find_last_of(_("/\\")) + 1); 23 | return removed_path.substr(0, removed_path.find_last_of(_(".\\"))); 24 | } 25 | 26 | int StringToInt(std::string text) 27 | { 28 | int result = 0; 29 | 30 | for (const auto& item : text) 31 | { 32 | result += int(item); 33 | } 34 | return result; 35 | } 36 | 37 | std::string ToLower(std::string s) 38 | { 39 | std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) { return std::tolower(c); }); 40 | return s; 41 | } 42 | 43 | void CheckFileSystem() 44 | { 45 | std::filesystem::path config_path = std::string(getenv(_("APPDATA")) + std::string(_("\\Amplitude-Rust\\Configs"))); 46 | 47 | if (!std::filesystem::exists(config_path)) 48 | { 49 | std::filesystem::create_directories(config_path); 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /Sdk/Classes/PlayerModel.hpp: -------------------------------------------------------------------------------- 1 | class PlayerModel 2 | { 3 | public: 4 | uintptr_t GetMaleSkin() 5 | { 6 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 7 | 8 | return driver.read(reinterpret_cast(this) + Offsets::PlayerModel.MaleSkin); 9 | } 10 | 11 | int GetSkinType() 12 | { 13 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1; 14 | 15 | return driver.read(reinterpret_cast(this) + Offsets::PlayerModel.SkinType); 16 | } 17 | 18 | Vector3 GetVelocity() 19 | { 20 | if (!Utils::ValidPointer(reinterpret_cast(this))) return Vector3(0, 0, 0); 21 | 22 | return driver.read(reinterpret_cast(this) + Offsets::PlayerModel.Velocity); 23 | } 24 | 25 | Vector3 GetNewVelocity() 26 | { 27 | if (!Utils::ValidPointer(reinterpret_cast(this))) return Vector3(0,0,0); 28 | 29 | return driver.read(reinterpret_cast(this) + Offsets::PlayerModel.NewVelocity); 30 | } 31 | 32 | bool GetIsIncapacitated() 33 | { 34 | if (!Utils::ValidPointer(reinterpret_cast(this))) return false; 35 | 36 | return driver.read(reinterpret_cast(this) + Offsets::PlayerModel.IsIncapacitated); 37 | } 38 | 39 | bool GetIsNpc() 40 | { 41 | if (!Utils::ValidPointer(reinterpret_cast(this))) return false; 42 | 43 | return driver.read(reinterpret_cast(this) + Offsets::PlayerModel.IsNpc); 44 | } 45 | 46 | void SetDucked(bool toggle) 47 | { 48 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 49 | 50 | driver.write(reinterpret_cast(this) + Offsets::PlayerModel.Ducked, (int)toggle); 51 | } 52 | }; -------------------------------------------------------------------------------- /Threads/Main.cpp: -------------------------------------------------------------------------------- 1 | #include "Includes.hpp" 2 | 3 | 4 | int main() 5 | { 6 | 7 | 8 | while (!FindWindowA(_("UnityWndClass"), _("Rust"))) 9 | { 10 | std::this_thread::sleep_for(std::chrono::milliseconds(200)); 11 | } 12 | std::this_thread::sleep_for(std::chrono::milliseconds(2000)); 13 | system(_("cls")); 14 | 15 | Utils::CheckFileSystem(); 16 | printf(_("[+] Found Rust!\n")); 17 | printf(_("[+] Checked File System\n")); 18 | 19 | #if HV == true 20 | 21 | if (!driver.initialize()) { 22 | printf(_("[!] hypervisor is not loaded\n")); 23 | return 1; 24 | } 25 | 26 | if (!driver.attach(_("RustClient.exe"))) 27 | { 28 | printf(_("[!] failed to attach to RustClient.exe\n")); 29 | return 1; 30 | } 31 | 32 | global.unity_player = driver.mod(_(L"UnityPlayer.dll")); 33 | 34 | global.game_assembly = driver.mod(_(L"GameAssembly.dll")); 35 | 36 | printf("[+] Found UnityPlayer.dll -> %p\n", global.unity_player); 37 | printf("[+] Found GameAssembly.dll -> %p\n", global.game_assembly); 38 | 39 | #elif HV == false 40 | if (!driver.driver_init()) { 41 | printf(_("[!] hypervisor is not loaded\n")); 42 | return 1; 43 | } 44 | 45 | if (!driver.GetProcessID(_(L"RustClient.exe"))) 46 | { 47 | printf(_("[!] failed to attach to RustClient.exe\n")); 48 | return 1; 49 | } 50 | 51 | driver.pid = driver.GetProcessID(_(L"RustClient.exe")); 52 | 53 | global.unity_player = driver.GetBaseAddress(_("UnityPlayer.dll")); 54 | 55 | global.game_assembly = driver.GetBaseAddress(_("GameAssembly.dll")); 56 | 57 | printf("[+] Found UnityPlayer.dll -> %p\n", global.unity_player); 58 | printf("[+] Found GameAssembly.dll -> %p\n", global.game_assembly); 59 | #endif // HV == true 60 | 61 | reinterpret_cast(0)->BlockCommands(); 62 | 63 | std::thread([&]() {UpdateLists();}).detach(); 64 | std::thread([&]() {UpdatePositions();}).detach(); 65 | std::thread([&]() {Aimbot();}).detach(); 66 | std::thread([&]() {Misc();}).detach(); 67 | 68 | printf("[+] Thread 5 Started\n"); 69 | Overlay(); 70 | 71 | return -1; 72 | } 73 | 74 | -------------------------------------------------------------------------------- /Header Files/Includes.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #define WIN32_LEAN_AND_MEAN 3 | 4 | /*-------Windows-------*/ 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | /*-------Hypervisor-------*/ 27 | //#include 28 | //#include 29 | //using namespace vManager::driver.noPool; 30 | #define HV false 31 | 32 | #if HV == true 33 | #include "memory.hpp" 34 | #elif HV == false 35 | #include "..//Driver.hpp" 36 | #endif 37 | 38 | /*-------DirectX-11-------*/ 39 | #include "imgui.h" 40 | #include "imgui_impl_win32.h" 41 | #include "imgui_impl_dx11.h" 42 | #include 43 | #include 44 | #include 45 | #pragma comment(lib, "d3dx11.lib") 46 | 47 | /*-------Json-------*/ 48 | #include "Json.hpp" 49 | 50 | /*-------Xor-String-------*/ 51 | #include "XorStr.hpp" 52 | 53 | /*-------Resources-------*/ 54 | #include "image.hpp" 55 | #include "font.hpp" 56 | 57 | #include "Math.hpp" 58 | #include "Structs.hpp" 59 | #include "Global.hpp" 60 | #include "Offsets.hpp" 61 | #include "Utils.hpp" 62 | #include "Unity.hpp" 63 | 64 | /*Game Classes And Structs*/ 65 | #include "ItemContainer.hpp" 66 | #include "PlayerModel.hpp" 67 | #include "PlayerInput.hpp" 68 | #include "BaseMovement.hpp" 69 | #include "ModelState.hpp" 70 | #include "PlayerEyes.hpp" 71 | #include "PlayerInventory.hpp" 72 | #include "BasePlayer.hpp" 73 | #include "Players.hpp" 74 | #include "World.hpp" 75 | #include "Camera.hpp" 76 | #include "Movement.hpp" 77 | #include "Weapon.hpp" 78 | #include "Enviorment.hpp" 79 | 80 | /*-------Esp-------*/ 81 | #include "Esp.hpp" 82 | #include "Menu.hpp" 83 | #include "Misc.hpp" 84 | 85 | /*Threads*/ 86 | int Overlay(); 87 | int UpdateLists(); 88 | int UpdatePositions(); 89 | int Misc(); 90 | int Aimbot(); 91 | 92 | -------------------------------------------------------------------------------- /Overlay/ImGui/imgui_impl_win32.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Backend for Windows (standard windows API for 32 and 64 bits applications) 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | 4 | // Implemented features: 5 | // [X] Platform: Clipboard support (for Win32 this is actually part of core dear imgui) 6 | // [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy VK_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set] 7 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 8 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 9 | 10 | // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this. 11 | // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need. 12 | // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. 13 | // Read online: https://github.com/ocornut/imgui/tree/master/docs 14 | 15 | #pragma once 16 | #include "imgui.h" // IMGUI_IMPL_API 17 | 18 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); 19 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); 20 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); 21 | 22 | // Win32 message handler your application need to call. 23 | // - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on from this helper. 24 | // - You should COPY the line below into your .cpp code to forward declare the function and then you can call it. 25 | // - Call from your application's message handler. Keep calling your message handler unless this function returns TRUE. 26 | 27 | #if 0 28 | extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 29 | #endif 30 | 31 | // DPI-related helpers (optional) 32 | // - Use to enable DPI awareness without having to create an application manifest. 33 | // - Your own app may already do this via a manifest or explicit calls. This is mostly useful for our examples/ apps. 34 | // - In theory we could call simple functions from Windows SDK such as SetProcessDPIAware(), SetProcessDpiAwareness(), etc. 35 | // but most of the functions provided by Microsoft require Windows 8.1/10+ SDK at compile time and Windows 8/10+ at runtime, 36 | // neither we want to require the user to have. So we dynamically select and load those functions to avoid dependencies. 37 | IMGUI_IMPL_API void ImGui_ImplWin32_EnableDpiAwareness(); 38 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd); // HWND hwnd 39 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor); // HMONITOR monitor 40 | 41 | // Transparency related helpers (optional) [experimental] 42 | // - Use to enable alpha compositing transparency with the desktop. 43 | // - Use together with e.g. clearing your framebuffer with zero-alpha. 44 | IMGUI_IMPL_API void ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd); // HWND hwnd 45 | -------------------------------------------------------------------------------- /Sdk/Features/Movement.hpp: -------------------------------------------------------------------------------- 1 | class Movement 2 | { 3 | public: 4 | void FakeDuck() 5 | { 6 | if (global.fake_duck) 7 | { 8 | if (GetAsyncKeyState(VK_XBUTTON1)) 9 | { 10 | players.local->GetPlayerEyes()->SetViewOffset(Vector3(0.f, 0.75f, 0.f)); 11 | } 12 | } 13 | } 14 | 15 | void ShootWhileMounted() 16 | { 17 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 18 | 19 | uintptr_t base_mounted = driver.read(reinterpret_cast(players.local) + 0x608); 20 | if (base_mounted) 21 | { 22 | driver.write(base_mounted + 0x2b8, true); 23 | } 24 | } 25 | 26 | void FakeAdmin() 27 | { 28 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 29 | 30 | if (global.fake_admin) 31 | { 32 | reinterpret_cast(this)->SetPlayerFlags(PlayerFlags::IsAdmin); 33 | } 34 | } 35 | 36 | void SpiderMan() 37 | { 38 | if(!Utils::ValidPointer(reinterpret_cast(this))) return; 39 | 40 | if (global.spider_man) 41 | { 42 | BaseMovement* movement = reinterpret_cast(this)->GetBaseMovement(); 43 | 44 | movement->SetGroundAngle(0.0f); 45 | movement->SetGroundAngleNew(0.0f); 46 | } 47 | } 48 | 49 | void InfiniteJump() 50 | { 51 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 52 | 53 | if (global.infinite_jump) 54 | { 55 | BaseMovement* movement = reinterpret_cast(this)->GetBaseMovement(); 56 | 57 | movement->SetJumpTime(0.0f); 58 | movement->SetLandTime(0.0f); 59 | } 60 | } 61 | 62 | void NoSway() 63 | { 64 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 65 | 66 | if (global.no_sway) 67 | { 68 | reinterpret_cast(this)->SetClothingAccuracyBonus(1.f); 69 | } 70 | } 71 | 72 | void UnlockAngles() 73 | { 74 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 75 | 76 | if (global.unlock_angles) 77 | { 78 | reinterpret_cast(this)->SetClothingBlocksAiming(false); 79 | } 80 | } 81 | 82 | void FlyHack() 83 | { 84 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 85 | 86 | if (global.fly_hack) 87 | { 88 | Vector3 target_movement = Vector3(0, 0, 0); 89 | Vector4 rotation = reinterpret_cast(this)->GetPlayerEyes()->GetBodyRotation(); 90 | 91 | if (GetAsyncKeyState(0x57) & 1) 92 | { 93 | target_movement += Transform(Vector3(0, 0, 1), rotation); 94 | } 95 | if (GetAsyncKeyState(0x53) & 1) 96 | { 97 | target_movement -= Transform(Vector3(0, 0, 1), rotation); 98 | } 99 | if (GetAsyncKeyState(0x41) & 1) 100 | { 101 | target_movement -= Transform(Vector3(1, 0, 0), rotation); 102 | } 103 | if (GetAsyncKeyState(0x44) & 1) 104 | { 105 | target_movement += Transform(Vector3(1, 0, 0), rotation); 106 | } 107 | 108 | if (GetAsyncKeyState(VK_SPACE) & 1) 109 | { 110 | target_movement.y += 1.f; 111 | } 112 | 113 | float d = 5.f; 114 | if (GetAsyncKeyState(VK_CONTROL) & 1) 115 | { 116 | d = 2.5f; 117 | } 118 | if (GetAsyncKeyState(VK_SHIFT) & 1) 119 | { 120 | d = 10.f; 121 | } 122 | if (!(target_movement == Vector3{ 0.f, 0.f, 0.f })) 123 | { 124 | players.local->GetBaseMovement()->SetTargetMovement(target_movement * d); 125 | } 126 | } 127 | } 128 | 129 | void BlockCommands() 130 | { 131 | uint64_t list = driver.ReadChain(global.game_assembly, { Offsets::GameAssembly.ConsoleSystem, 0xB8, 0x30 }); 132 | 133 | uint32_t size = driver.read(list + 0x18); 134 | for (int i = 0; i < size; i++) 135 | { 136 | uint64_t command = driver.read(list + (0x20 + (0x8 * i))); 137 | std::string name = driver.GetUnicodeString(driver.read(command + 0x10), 128); 138 | if (name == "noclip" || name == "camspeed" || name == "debugcamera") 139 | { 140 | //printf("%s\n", name.c_str()); 141 | driver.write(command + 0x58, false); 142 | } 143 | } 144 | } 145 | }; 146 | -------------------------------------------------------------------------------- /Threads/Aimbot.cpp: -------------------------------------------------------------------------------- 1 | #include "Includes.hpp" 2 | 3 | Vector2 CalculateAngle(const Vector3& player, const Vector3& target) 4 | { 5 | Vector3 direction = Vector3(player.x - target.x, player.y - target.y, player.z - target.z); 6 | return Vector2(RAD2DEG(asin(direction.y / direction.Length())), RAD2DEG(-atan2(direction.x, -direction.z))); 7 | } 8 | 9 | std::map GetSelectedBone = 10 | { 11 | {0, BoneList::head}, 12 | {1, BoneList::spine3 }, 13 | {2, BoneList::spine1}, 14 | {3, BoneList::pelvis}, 15 | {4, BoneList::l_forearm}, 16 | 17 | {5, BoneList::l_knee}, 18 | {6, BoneList::r_forearm}, 19 | {7, BoneList::r_knee}, 20 | }; 21 | 22 | Vector3 Prediction(Vector3 local_position, Vector3 target_position) 23 | { 24 | Vector3 result = target_position; 25 | 26 | float distance = local_position.Distance(target_position); 27 | 28 | if (distance > 0.001f && distance < 500.f) 29 | { 30 | uintptr_t ammo_defination = driver.ReadChain(global.held_item, { 0xa0, 0x2c0, 0x20, 0x10, 0x30 }); 31 | 32 | uintptr_t item_mod_projectile = Unity->GetComponentFromGameObject(ammo_defination, "ItemModProjectile"); 33 | if (!item_mod_projectile) return result; 34 | 35 | uintptr_t projectile = Unity->GetComponentFromGameObject(driver.ReadChain(item_mod_projectile, { 0x18, 0x18, 0x10 }), "Projectile"); 36 | if (!projectile) return result; 37 | 38 | float bullet_speed = driver.read(item_mod_projectile + 0x34); 39 | float bullet_drag = driver.read(projectile + 0x24); 40 | float bullet_gravity = driver.read(projectile + 0x28); 41 | 42 | bullet_speed *= 1 - 0.03125f * bullet_drag; 43 | 44 | float travel_time = distance / bullet_speed; 45 | 46 | Vector3 target_velocity = players.aim_target->GetPlayerModel()->GetNewVelocity(); 47 | 48 | target_velocity = Vector3(target_velocity.x * travel_time, target_velocity.y * travel_time, target_velocity.z * travel_time); 49 | 50 | result += target_velocity; 51 | 52 | result.y += (0.5f * fabsf(bullet_gravity) * travel_time * travel_time) * 10; 53 | } 54 | return result; 55 | } 56 | 57 | void Target() 58 | { 59 | int closest = 9999.0f; 60 | players.aim_target = NULL; 61 | 62 | std::vector cachedList = global.player_list; 63 | 64 | for (int i = 0; i < cachedList.size(); i++) 65 | { 66 | RUSTPLAYER player = cachedList[i]; 67 | 68 | if ((player.is_npc && global.aimbot_ignore_npc) || (player.is_sleeping && global.aimbot_ingore_sleepers)) continue; 69 | 70 | Vector2 screen_position; 71 | Vector3 position = Unity->GetTransformPosition(reinterpret_cast(player.instance)->GetBoneTransform(GetSelectedBone[global.selected_aimbot_bone])); 72 | //printf("%f %f %f\n", position.x, position.y, position.z); 73 | if (position == Vector3{ 0,0,0 }) continue; 74 | 75 | if (camera.WorldToScreen(position, screen_position, global.view_matrix)) 76 | { 77 | float distance = screen_position.Distance(Vector2(global.screen_width / 2, global.screen_height / 2)); 78 | if (distance < global.aimbot_fov) 79 | { 80 | if (distance < closest) 81 | { 82 | closest = distance; 83 | players.aim_target = reinterpret_cast(player.instance); 84 | } 85 | } 86 | } 87 | } 88 | } 89 | 90 | int Aimbot() 91 | { 92 | std::mutex thread_lock; 93 | thread_lock.lock(); 94 | 95 | printf("[+] Thread 3 Started\n"); 96 | while (true) 97 | { 98 | if (GetAsyncKeyState(global.aimbot_key) && global.aimbot_enabled) 99 | { 100 | Target(); 101 | 102 | Vector3 local_position = driver.read(global.camera + 0x42c); 103 | Vector3 target_position = Unity->GetTransformPosition(players.aim_target->GetBoneTransform(GetSelectedBone[global.selected_aimbot_bone])); 104 | 105 | if ((players.aim_target->GetHealthInformation().first <= 0) || (local_position.Distance(target_position) >= global.max_aimbot_distance)) continue; 106 | 107 | target_position = Prediction(local_position, target_position); 108 | 109 | Vector2 angle = CalculateAngle(local_position, target_position); 110 | 111 | players.local->GetPlayerEyes()->SetBodyRotation(Vector3(angle.x, angle.y, 0.0f).Quaternion()); 112 | //players.local->GetPlayerInput()->SetBodyAngles(Vector3(angle.x, angle.y, 0)); 113 | } 114 | else 115 | { 116 | std::this_thread::sleep_for(std::chrono::milliseconds(100)); 117 | } 118 | } 119 | thread_lock.unlock(); 120 | return -1; 121 | } -------------------------------------------------------------------------------- /Header Files/Global.hpp: -------------------------------------------------------------------------------- 1 | class Global 2 | { 3 | public: 4 | int screen_width = 1920; 5 | int screen_height = 1080; 6 | 7 | bool is_focused_window = false; 8 | bool menu = false; 9 | int current_tab = 1; 10 | 11 | ID3D11ShaderResourceView* Image = nullptr; 12 | 13 | uintptr_t unity_player = NULL; 14 | uintptr_t game_assembly = NULL; 15 | 16 | uintptr_t all_cameras = NULL; 17 | uintptr_t camera = NULL; 18 | matrix4x4 view_matrix; 19 | 20 | /*------Fonts------*/ 21 | ImFont* icons = NULL; 22 | ImFont* title = NULL; 23 | ImFont* radar = NULL; 24 | ImFont* medium = NULL; 25 | ImFont* large = NULL; 26 | 27 | /*------Cached-Lists------*/ 28 | std::vector player_list = {}; 29 | std::vector resource_list = {}; 30 | std::vector world_list = {}; 31 | std::vector item_list = {}; 32 | std::vector> chams_materials = {}; 33 | 34 | uintptr_t held_item; 35 | 36 | /*------Aimbot------*/ 37 | bool aimbot_enabled = false; 38 | bool aimbot_find_key = false; 39 | int aimbot_key = 0; 40 | int selected_aimbot_bone = 0; 41 | BoneList aimbot_bone; 42 | bool aimbot_ingore_sleepers = false; 43 | bool aimbot_ignore_npc = false; 44 | bool draw_fov = false; 45 | float aimbot_fov = 90.f; 46 | float max_aimbot_distance = 150.f; 47 | 48 | /*------Weapon------*/ 49 | bool no_recoil = false; 50 | bool no_spread = false; 51 | bool force_automatic = false; 52 | bool instant_eoka = false; 53 | bool instant_compound = false; 54 | 55 | /*------Misc------*/ 56 | bool spider_man = false; 57 | bool infinite_jump = false; 58 | bool no_sway = false; 59 | bool unlock_angles = false; 60 | bool fly_hack = false; 61 | bool fake_admin = false; 62 | bool fov_changer = false; 63 | float fov = 90.f; 64 | bool time_changer = false; 65 | float current_time = 12.f; 66 | bool clear_water = false; 67 | bool bright_night = false; 68 | bool walk_on_water = false; 69 | bool fake_duck = false; 70 | 71 | /*------Player-Esp------*/ 72 | bool show_player = true; 73 | bool show_player_name = false; 74 | bool show_player_distance = false; 75 | bool show_player_box = false; 76 | ImColor player_box_color = ImColor(255, 255, 0, 255); 77 | ImColor player_name_color = ImColor(255, 255, 255, 255); 78 | bool player_ignore_npc = false; 79 | bool player_ignore_sleeping = false; 80 | float max_player_distance = 500.f; 81 | bool apply_chams = true; 82 | int selected_chams_tab = 0; 83 | uintptr_t selected_chams_material; 84 | 85 | 86 | /*------Resource-Esp------*/ 87 | bool show_resource = false; 88 | bool show_resource_name = false; 89 | bool show_resource_distance = false; 90 | float max_resource_distance = 250.f; 91 | bool show_stone = false; 92 | bool show_metal = false; 93 | bool show_sulfur = false; 94 | bool show_hemp = false; 95 | ImColor stone_color = ImColor(255, 255, 255, 255); 96 | ImColor metal_color = ImColor(255, 255, 255, 255); 97 | ImColor sulfur_color = ImColor(255, 255, 255, 255); 98 | ImColor hemp_color = ImColor(255, 255, 255, 255); 99 | 100 | /*------World_Esp------*/ 101 | bool show_world = false; 102 | bool show_world_name = false; 103 | bool show_world_distance = false; 104 | float max_world_distance = 100.f; 105 | bool show_stash = false; 106 | bool show_crate_elite = false; 107 | bool show_create_military = false; 108 | bool show_crate = false; 109 | bool show_airdrop = false; 110 | bool show_locked_crate = false; 111 | bool show_auto_turret = false; 112 | bool show_flame_turret = false; 113 | bool show_shotgun_trap = false; 114 | bool show_corpse = false; 115 | ImColor stash_color = ImColor(255, 255, 255, 255); 116 | ImColor crate_elite_color = ImColor(255, 255, 255, 255); 117 | ImColor crate_military_color = ImColor(255, 255, 255, 255); 118 | ImColor crate_color = ImColor(255, 255, 255, 255); 119 | ImColor airdrop_color = ImColor(255, 255, 255, 255); 120 | ImColor locked_crate_color = ImColor(255, 255, 255, 255); 121 | ImColor auto_turret_color = ImColor(255, 255, 255, 255); 122 | ImColor flame_turret_color = ImColor(255, 255, 255, 255); 123 | ImColor shotgun_trap_color = ImColor(255, 255, 255, 255); 124 | ImColor corpse_color = ImColor(255, 255, 255, 255); 125 | 126 | 127 | /*------Item_Esp------*/ 128 | bool show_item = false; 129 | bool show_item_name = false; 130 | bool show_item_distance = false; 131 | ImColor item_color = ImColor(255, 255, 255, 255); 132 | float max_item_distance = 50.f; 133 | 134 | /*------Auto-Farm------*/ 135 | bool auto_farm = false; 136 | bool find_target = true; 137 | int ticks = 0; 138 | RUSTRESOURCE target_resource = {}; 139 | int auto_farm_key = 0; 140 | bool auto_farm_find_key = false; 141 | bool auto_farm_stone = false; 142 | bool auto_farm_metal = false; 143 | bool auto_farm_sulfur = false; 144 | bool auto_farm_hemp = false; 145 | 146 | /*------Config------*/ 147 | std::string selected_config = ""; 148 | char config_buffer[128]; 149 | bool save_config = false; 150 | bool load_config = false; 151 | 152 | /*------Drawing-Settings------*/ 153 | bool limit_fps = false; 154 | bool vsync = false; 155 | float target_fps = 120.f; 156 | bool show_debug_text = false; 157 | }global; 158 | -------------------------------------------------------------------------------- /Sdk/Classes/BasePlayer.hpp: -------------------------------------------------------------------------------- 1 | class BasePlayer 2 | { 3 | public: 4 | uintptr_t GetPositionPointer() 5 | { 6 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 7 | 8 | return driver.ReadChain(reinterpret_cast(this), { 0x10, 0x30, 0x30, 0x8, 0x38 }); 9 | } 10 | 11 | uintptr_t GetBoneTransform(BoneList bone) 12 | { 13 | uintptr_t player_model = driver.read(reinterpret_cast(this) + 0x130); 14 | uintptr_t bone_transforms = driver.read(player_model + 0x48); 15 | return driver.read((bone_transforms + (0x20 + (bone * 0x8)))); 16 | } 17 | 18 | bool GetVisible() 19 | { 20 | if (!Utils::ValidPointer(reinterpret_cast(this))) return false; 21 | 22 | return driver.read(reinterpret_cast(this) + Offsets::BaseEntity.isVisible); 23 | } 24 | 25 | std::pair GetHealthInformation() 26 | { 27 | if (!Utils::ValidPointer(reinterpret_cast(this))) return std::make_pair(-1.f, -1.f); 28 | 29 | float health = driver.read(reinterpret_cast(this) + Offsets::BaseCombatEntity.Health); 30 | float max_health = driver.read(reinterpret_cast(this) + Offsets::BaseCombatEntity.MaxHealth); 31 | 32 | return std::make_pair(health, max_health); 33 | } 34 | 35 | PlayerModel* GetPlayerModel() 36 | { 37 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 38 | 39 | return driver.read(reinterpret_cast(this) + Offsets::BasePlayer.PlayerModel); 40 | } 41 | 42 | PlayerInput* GetPlayerInput() 43 | { 44 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 45 | 46 | return driver.read(reinterpret_cast(this) + Offsets::BasePlayer.PlayerInput); 47 | } 48 | 49 | BaseMovement* GetBaseMovement() 50 | { 51 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 52 | 53 | return driver.read(reinterpret_cast(this) + Offsets::BasePlayer.BaseMovement); 54 | } 55 | 56 | uintptr_t GetCurrentTeam() 57 | { 58 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 59 | 60 | return driver.read(reinterpret_cast(this) + Offsets::BasePlayer.CurrentTeam); 61 | } 62 | 63 | uintptr_t GetActiveItem() 64 | { 65 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 66 | 67 | return driver.read(reinterpret_cast(this) + Offsets::BasePlayer.ClActiveItem); 68 | } 69 | 70 | ModelState* GetModelState() 71 | { 72 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 73 | 74 | return driver.read(reinterpret_cast(this) + Offsets::BasePlayer.ModelState); 75 | } 76 | 77 | PlayerEyes* GetPlayerEyes() 78 | { 79 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 80 | 81 | return driver.read(reinterpret_cast(this) + Offsets::BasePlayer.PlayerEyes); 82 | } 83 | 84 | PlayerInventory* GetPlayerInventory() 85 | { 86 | if (!Utils::ValidPointer(reinterpret_cast(this))) return NULL; 87 | 88 | return driver.read(reinterpret_cast(this) + Offsets::BasePlayer.PlayerInventory); 89 | } 90 | 91 | std::string GetName() 92 | { 93 | if (!Utils::ValidPointer(reinterpret_cast(this))) return ""; 94 | 95 | uintptr_t name_ptr = driver.read(reinterpret_cast(this) + Offsets::BasePlayer.DisplayName); 96 | 97 | return driver.GetUnicodeString(name_ptr + Offsets::String.Name, 128); 98 | } 99 | 100 | void SetPlayerFlags(PlayerFlags player_flags) 101 | { 102 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 103 | 104 | int Flags = driver.read(reinterpret_cast(this) + Offsets::BasePlayer.PlayerFlags); 105 | driver.write(reinterpret_cast(this) + Offsets::BasePlayer.PlayerFlags, (Flags |= player_flags)); 106 | } 107 | 108 | bool GetClothingBlocksAiming() 109 | { 110 | if (!Utils::ValidPointer(reinterpret_cast(this))) return false; 111 | 112 | return driver.read(reinterpret_cast(this) + Offsets::BasePlayer.ClothingBlocksAiming); 113 | } 114 | 115 | void SetClothingBlocksAiming(bool value) 116 | { 117 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 118 | 119 | driver.write(reinterpret_cast(this) + Offsets::BasePlayer.ClothingBlocksAiming, value); 120 | } 121 | 122 | float GetClothingMoveSpeedReduction() 123 | { 124 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 125 | 126 | return driver.read(reinterpret_cast(this) + Offsets::BasePlayer.ClothingMoveSpeedReduction); 127 | } 128 | 129 | void SetClothingMoveSpeedReduction(float value) 130 | { 131 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 132 | 133 | driver.write(reinterpret_cast(this) + Offsets::BasePlayer.ClothingMoveSpeedReduction, value); 134 | } 135 | 136 | float GetClothingAccuracyBonus() 137 | { 138 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 139 | 140 | return driver.read(reinterpret_cast(this) + Offsets::BasePlayer.ClothingAccuracyBonus); 141 | } 142 | 143 | void SetClothingAccuracyBonus(float value) 144 | { 145 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 146 | 147 | driver.write(reinterpret_cast(this) + Offsets::BasePlayer.ClothingAccuracyBonus, value); 148 | } 149 | }; 150 | -------------------------------------------------------------------------------- /Header Files/Math.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #define M_PI 3.14159265358979323846f 5 | #define M_RADPI 57.295779513082f 6 | #define M_PI_F ((float)(M_PI)) 7 | #define RAD2DEG(x) ((float)(x) * (float)(180.f / M_PI_F)) 8 | #define DEG2RAD(x) ((float)(x) * (float)(M_PI_F / 180.f)) 9 | #define atan2(a, b) ((float)atan2((double)(a), (double)(b))) 10 | 11 | struct matrix4x4 12 | { 13 | union 14 | { 15 | struct 16 | { 17 | float _11, _12, _13, _14; 18 | float _21, _22, _23, _24; 19 | float _31, _32, _33, _34; 20 | float _41, _42, _43, _44; 21 | 22 | }; float m[4][4]; 23 | }; 24 | }; 25 | 26 | struct matrix3x4 27 | { 28 | float _11, _12, _13, _14; 29 | float _21, _22, _23, _24; 30 | float _31, _32, _33, _34; 31 | }; 32 | 33 | class Vector4 34 | { 35 | public: 36 | Vector4() : x(0.f), y(0.f), z(0.f), w(0.f) 37 | { 38 | 39 | } 40 | 41 | Vector4(float _x, float _y, float _z, float _w) : x(_x), y(_y), z(_z), w(_w) 42 | { 43 | 44 | } 45 | ~Vector4() 46 | { 47 | 48 | } 49 | 50 | float x, y, z, w; 51 | }; 52 | 53 | class Vector3 54 | { 55 | public: 56 | Vector3() : x(0.f), y(0.f), z(0.f) 57 | { 58 | 59 | } 60 | 61 | Vector3(float _x, float _y, float _z) : x(_x), y(_y), z(_z) 62 | { 63 | 64 | } 65 | ~Vector3() 66 | { 67 | 68 | } 69 | 70 | inline float Dot(Vector3 v) 71 | { 72 | return x * v.x + y * v.y + z * v.z; 73 | } 74 | 75 | inline float Distance(Vector3 v) 76 | { 77 | return float(sqrtf(powf(v.x - x, 2.0) + powf(v.y - y, 2.0) + powf(v.z - z, 2.0))); 78 | } 79 | 80 | Vector3 abs() 81 | { 82 | return Vector3(std::abs(x), std::abs(y), std::abs(z)); 83 | } 84 | 85 | inline float Length() 86 | { 87 | float ls = x * x + y * y + z * z; 88 | return sqrt(ls); 89 | } 90 | 91 | void clamp() 92 | { 93 | if (x > 75.f) 94 | { 95 | x = 75.f; 96 | } 97 | else if (x < -75.f) 98 | { 99 | x = -75.f; 100 | } 101 | if (z < -180) 102 | { 103 | z += 360.0f; 104 | } 105 | else if (z > 180) 106 | { 107 | z -= 360.0f; 108 | } 109 | y = 0.f; 110 | } 111 | 112 | Vector4 Quaternion() 113 | { 114 | double heading = DEG2RAD(x); 115 | double attitude = DEG2RAD(y); 116 | double bank = DEG2RAD(z); 117 | 118 | double c1 = cos(heading / 2); 119 | double s1 = sin(heading / 2); 120 | double c2 = cos(attitude / 2); 121 | double s2 = sin(attitude / 2); 122 | double c3 = cos(bank / 2); 123 | double s3 = sin(bank / 2); 124 | double c1c2 = c1 * c2; 125 | double s1s2 = s1 * s2; 126 | Vector4 Quat; 127 | Quat.w = c1c2 * c3 - s1s2 * s3; 128 | Quat.x = c1c2 * s3 + s1s2 * c3; 129 | Quat.y = s1 * c2 * c3 + c1 * s2 * s3; 130 | Quat.z = c1 * s2 * c3 - s1 * c2 * s3; 131 | Vector4 Quat2; 132 | Quat2 = { Quat.y, Quat.z, (Quat.x * -1), Quat.w }; 133 | return Quat2; 134 | } 135 | 136 | bool operator==(const Vector3& in) const 137 | { 138 | return (x == in.x && y == in.y && z == in.z); 139 | } 140 | 141 | bool operator!=(const Vector3& in) const 142 | { 143 | return (x != in.x || y != in.y || z != in.z); 144 | } 145 | 146 | Vector3 operator+(Vector3 v) 147 | { 148 | return Vector3(x + v.x, y + v.y, z + v.z); 149 | } 150 | 151 | Vector3 operator-(Vector3 v) 152 | { 153 | return Vector3(x - v.x, y - v.y, z - v.z); 154 | } 155 | 156 | Vector3 operator*(float number) const 157 | { 158 | return Vector3(x * number, y * number, z * number); 159 | } 160 | 161 | Vector3& operator/(float fl) 162 | { 163 | x / fl; 164 | y / fl; 165 | z / fl; 166 | return *this; 167 | } 168 | 169 | Vector3& operator/=(float fl) 170 | { 171 | x /= fl; 172 | y /= fl; 173 | z /= fl; 174 | return *this; 175 | } 176 | 177 | Vector3& operator+=(const Vector3& v) 178 | { 179 | x += v.x; 180 | y += v.y; 181 | z += v.z; 182 | return *this; 183 | } 184 | 185 | Vector3& operator-=(const Vector3& v) 186 | { 187 | x -= v.x; 188 | y -= v.y; 189 | z -= v.z; 190 | return *this; 191 | } 192 | 193 | //bool operator<(const Vector3& v) const 194 | //{ 195 | // if (x < v.x && y < v.y && z < v.z) 196 | // { 197 | // return false; 198 | // } 199 | // else 200 | // { 201 | // return true; 202 | // } 203 | 204 | // //return (x < v.x && y < v.y && z < v.z) ? true : false; 205 | //} 206 | 207 | float x, y, z; 208 | }; 209 | 210 | class Vector2 211 | { 212 | public: 213 | Vector2() : x(0.f), y(0.f) 214 | { 215 | 216 | } 217 | 218 | Vector2(float _x, float _y) : x(_x), y(_y) 219 | { 220 | 221 | } 222 | ~Vector2() 223 | { 224 | 225 | } 226 | 227 | inline float Distance(Vector2 v) 228 | { 229 | return float(sqrtf(powf(v.x - x, 2.0) + powf(v.y - y, 2.0))); 230 | } 231 | 232 | bool operator==(Vector2& in) 233 | { 234 | return (this->x == in.x && this->y == in.y); 235 | } 236 | 237 | Vector2 operator+(Vector2 v) 238 | { 239 | return Vector2(x + v.x, y + v.y); 240 | } 241 | 242 | Vector2 operator-(Vector2 v) 243 | { 244 | return Vector2(x - v.x, y - v.y); 245 | } 246 | 247 | Vector2 operator+=(Vector2 v) 248 | { 249 | return Vector2(x += v.x, y += v.y); 250 | } 251 | 252 | Vector2 operator/=(Vector2 v) 253 | { 254 | return Vector2(x /= v.x, y /= v.y); 255 | } 256 | 257 | Vector2& operator/(float fl) 258 | { 259 | x / fl; 260 | y / fl; 261 | return *this; 262 | } 263 | 264 | float x, y; 265 | }; 266 | 267 | Vector3 Transform(Vector3 value, Vector4 rotation) 268 | { 269 | Vector3 vector; 270 | float num12 = rotation.x + rotation.x; 271 | float num2 = rotation.y + rotation.y; 272 | float num = rotation.z + rotation.z; 273 | float num11 = rotation.w * num12; 274 | float num10 = rotation.w * num2; 275 | float num9 = rotation.w * num; 276 | float num8 = rotation.x * num12; 277 | float num7 = rotation.x * num2; 278 | float num6 = rotation.x * num; 279 | float num5 = rotation.y * num2; 280 | float num4 = rotation.y * num; 281 | float num3 = rotation.z * num; 282 | float num15 = ((value.x * ((1.f - num5) - num3)) + (value.y * (num7 - num9))) + (value.z * (num6 + num10)); 283 | float num14 = ((value.x * (num7 + num9)) + (value.y * ((1.f - num8) - num3))) + (value.z * (num4 - num11)); 284 | float num13 = ((value.x * (num6 - num10)) + (value.y * (num4 + num11))) + (value.z * ((1.f - num8) - num5)); 285 | vector.x = num15; 286 | vector.y = num14; 287 | vector.z = num13; 288 | return vector; 289 | } -------------------------------------------------------------------------------- /Sdk/Features/Weapon.hpp: -------------------------------------------------------------------------------- 1 | class Weapon 2 | { 3 | public: 4 | 5 | void SuperBow() 6 | { 7 | if (true) 8 | { 9 | driver.write(reinterpret_cast(this) + Offsets::BowWeapon.AttackReady, true); 10 | driver.write(reinterpret_cast(this) + Offsets::BowWeapon.ArrowBack, 1.f); 11 | } 12 | } 13 | 14 | void NoRecoil() 15 | { 16 | if (global.no_recoil) 17 | { 18 | std::default_random_engine generator; 19 | std::uniform_real_distribution distribution(-0.20f, -0.20f); 20 | float random_number = distribution(generator); 21 | 22 | uintptr_t recoil_properties = driver.read(reinterpret_cast(this) + Offsets::BaseProjectile.RecoilProperties); 23 | driver.write(recoil_properties + Offsets::RecoilProperties.recoilYawMin, random_number); 24 | driver.write(recoil_properties + Offsets::RecoilProperties.recoilYawMax, random_number); 25 | driver.write(recoil_properties + Offsets::RecoilProperties.recoilPitchMin, random_number); 26 | driver.write(recoil_properties + Offsets::RecoilProperties.recoilPitchMax, random_number); 27 | 28 | uintptr_t new_recoil_override = driver.read(recoil_properties + 0x78); 29 | driver.write(new_recoil_override + Offsets::RecoilProperties.recoilYawMin, random_number); 30 | driver.write(new_recoil_override + Offsets::RecoilProperties.recoilYawMax, random_number); 31 | driver.write(new_recoil_override + Offsets::RecoilProperties.recoilPitchMin, random_number); 32 | driver.write(new_recoil_override + Offsets::RecoilProperties.recoilPitchMax, random_number); 33 | } 34 | } 35 | 36 | void NoSpread() 37 | { 38 | if (global.no_spread) 39 | { 40 | std::default_random_engine generator; 41 | std::uniform_real_distribution distribution(-0.5f, 0.5f); 42 | float random_number = distribution(generator); 43 | 44 | driver.write(reinterpret_cast(this) + Offsets::BaseProjectile.SightAimConeScale, random_number); 45 | driver.write(reinterpret_cast(this) + Offsets::BaseProjectile.HipAimConeScale, random_number); 46 | } 47 | } 48 | 49 | void ForceAutomatic() 50 | { 51 | if (global.force_automatic) 52 | { 53 | driver.write(reinterpret_cast(this) + Offsets::BaseProjectile.Automatic, true); 54 | } 55 | } 56 | 57 | void InstaEoka() 58 | { 59 | if (global.instant_eoka) 60 | { 61 | driver.write(reinterpret_cast(this) + Offsets::FlintStrikeWeapon.SuccessFraction, 1.0f); 62 | } 63 | } 64 | 65 | void InstantCompound() 66 | { 67 | if (global.instant_compound) 68 | { 69 | driver.write(reinterpret_cast(this) + Offsets::CompoundBowWeapon.StringHoldDurationMax, 0.f); 70 | driver.write(reinterpret_cast(this) + Offsets::CompoundBowWeapon.MovementPenaltyRampUpTime, 0.f); 71 | } 72 | } 73 | 74 | void ExtendMelee() 75 | { 76 | if (true) 77 | { 78 | driver.write(reinterpret_cast(this) + Offsets::BaseMelee.MaxDistance, 5.f); 79 | } 80 | } 81 | 82 | void WeaponHandler() 83 | { 84 | uintptr_t item_list = players.local->GetPlayerInventory()->GetContainerBelt()->GetItemList(); 85 | uintptr_t active_item = players.local->GetActiveItem(); 86 | 87 | int size = driver.read(item_list + Offsets::List.Size); 88 | uintptr_t base = driver.read(item_list + Offsets::List.Base); 89 | 90 | for (int i = 0; i < size; i++) 91 | { 92 | uintptr_t item = driver.read(base + (0x20 + (i * 0x8))); 93 | 94 | uintptr_t uid = driver.read(item + Offsets::Item.Uid); 95 | Weapon* weapon = driver.read(item + Offsets::Item.HeldEntity); 96 | 97 | if (uid == active_item) 98 | { 99 | 100 | uintptr_t info = driver.read(item + Offsets::Item.Info); 101 | int item_id = driver.read(info + Offsets::ItemDefinition.Itemid); 102 | 103 | switch (item_id) 104 | { 105 | case WeaponType::AssultRifle: 106 | case WeaponType::IceAssultRifle: 107 | case WeaponType::Lr300: 108 | case WeaponType::M249: 109 | case WeaponType::M39: 110 | case WeaponType::Sar: 111 | case WeaponType::HMLMG: 112 | case WeaponType::L96: 113 | case WeaponType::BoltAction: 114 | case WeaponType::CustomSmg: 115 | case WeaponType::Mp5: 116 | case WeaponType::Thompson: 117 | case WeaponType::Python: 118 | case WeaponType::SemiPistol: 119 | case WeaponType::Revolver: 120 | case WeaponType::M92: 121 | case WeaponType::Nailgun: 122 | global.held_item = item; 123 | weapon->NoRecoil(); 124 | weapon->NoSpread(); 125 | weapon->ForceAutomatic(); 126 | break; 127 | case WeaponType::Eoka: 128 | global.held_item = item; 129 | weapon->InstaEoka(); 130 | weapon->NoSpread(); 131 | break; 132 | case WeaponType::Spas12: 133 | case WeaponType::PumpShotgun: 134 | case WeaponType::WaterPipe: 135 | case WeaponType::DoubleBarrel: 136 | global.held_item = item; 137 | weapon->NoRecoil(); 138 | weapon->NoSpread(); 139 | break; 140 | case WeaponType::GrenadeLauncher: 141 | case WeaponType::RocketLauncher: 142 | case WeaponType::SnowBallGun: 143 | case WeaponType::FlameThrower: 144 | global.held_item = item; 145 | weapon->NoSpread(); 146 | break; 147 | case WeaponType::Bow: 148 | global.held_item = item; 149 | weapon->SuperBow(); 150 | weapon->NoSpread(); 151 | break; 152 | case WeaponType::CompoundBow: 153 | global.held_item = item; 154 | weapon->NoRecoil(); 155 | weapon->NoSpread(); 156 | weapon->InstantCompound(); 157 | break; 158 | case WeaponType::CrossBow: 159 | global.held_item = item; 160 | weapon->NoSpread(); 161 | break; 162 | case::WeaponType::JackHammer: 163 | case::WeaponType::IcePickaxe: 164 | case::WeaponType::MetalPickaxe: 165 | case::WeaponType::StonePickaxe: 166 | weapon->ExtendMelee(); 167 | break; 168 | default: 169 | global.held_item = NULL; 170 | break; 171 | } 172 | } 173 | } 174 | } 175 | }*weapon; 176 | -------------------------------------------------------------------------------- /Sdk/Features/Enviorment.hpp: -------------------------------------------------------------------------------- 1 | class Enviorment 2 | { 3 | public: 4 | 5 | void TimeChanger() 6 | { 7 | if (global.time_changer) 8 | { 9 | uintptr_t admin_convar = driver.ReadChain(global.game_assembly, { Offsets::GameAssembly.AdminConvar, 0xb8 }); 10 | driver.write(admin_convar + 0x0, global.current_time); 11 | } 12 | } 13 | 14 | void ClearWater() 15 | { 16 | if (global.clear_water) 17 | { 18 | uintptr_t admin_convar = driver.ReadChain(global.game_assembly, { Offsets::GameAssembly.AdminConvar, 0xb8 }); 19 | driver.write(admin_convar + 0x11, false); 20 | } 21 | } 22 | 23 | void FovChanger() 24 | { 25 | if (global.fov_changer) 26 | { 27 | uintptr_t graphics_convar = driver.ReadChain(global.game_assembly, { Offsets::GameAssembly.GraphicsConvar, 0xb8}); 28 | driver.write(graphics_convar + 0x18, global.fov); 29 | } 30 | } 31 | 32 | void BrightNight() 33 | { 34 | if (global.bright_night) 35 | { 36 | uintptr_t TOD_Sky = driver.ReadChain(global.game_assembly, { Offsets::GameAssembly.TODSky , 0xB8, 0x0, 0x10, 0x20 }); 37 | uintptr_t TOD_NightParameters = driver.read(TOD_Sky + 0x58); 38 | uintptr_t TOD_AmbientParameters = driver.read(TOD_Sky + 0x90); 39 | uintptr_t TOD_StarParameters = driver.read(TOD_Sky + 0x70); 40 | 41 | bool is_day = driver.read(TOD_Sky + 0xB8); 42 | if (is_day) 43 | { 44 | driver.write(TOD_Sky + 0x230, 0.f); 45 | driver.write(TOD_Sky + 0x234, 0.f); 46 | driver.write(TOD_NightParameters + 0x48, 30.f); 47 | driver.write(TOD_NightParameters + 0x50, 30.f); 48 | driver.write(TOD_StarParameters + 0x14, 500.f); 49 | driver.write(TOD_AmbientParameters + 0x18, 1000000); 50 | } 51 | } 52 | 53 | global.bright_night = false; 54 | } 55 | 56 | void HandleAutoFarm() 57 | { 58 | uintptr_t input_convar = driver.ReadChain(global.game_assembly, { Offsets::GameAssembly.ConVarInput, 0xb8 }); 59 | 60 | if (!global.auto_farm) 61 | { 62 | driver.write(input_convar + 0x12, false); 63 | return; 64 | } 65 | 66 | std::vector white_listed_items = {}; 67 | 68 | if (global.auto_farm_stone) white_listed_items.push_back(1696469454); 69 | if (global.auto_farm_metal) white_listed_items.push_back(1622519874); 70 | if (global.auto_farm_sulfur) white_listed_items.push_back(1554069420); 71 | if (global.auto_farm_hemp) white_listed_items.push_back(1082534429); 72 | 73 | global.target_resource = {}; 74 | 75 | if (global.find_target == true || global.target_resource.instance == NULL) 76 | { 77 | std::vector cached_list = global.resource_list; 78 | 79 | float closest = 9999.0f; 80 | RUSTRESOURCE target = {}; 81 | 82 | for (int i = 0; i < cached_list.size(); i++) 83 | { 84 | RUSTRESOURCE resource = cached_list[i]; 85 | 86 | for (int j = 0; j < white_listed_items.size(); j++) 87 | { 88 | if (resource.name_hash == white_listed_items[j]) 89 | { 90 | float current_distance = players.local_position.Distance(resource.position); 91 | if (current_distance < closest) 92 | { 93 | closest = current_distance; 94 | target = resource; 95 | } 96 | } 97 | } 98 | } 99 | global.find_target = false; 100 | global.target_resource = target; 101 | } 102 | 103 | if (global.find_target == false) 104 | { 105 | players.local->GetPlayerInput()->SetAutoRun(true); 106 | driver.write(input_convar + 0x12, true);//always sprint 107 | 108 | Vector3 direction = Vector3(players.local_position.x - global.target_resource.position.x, players.local_position.y - global.target_resource.position.y + 1.f, players.local_position.z - global.target_resource.position.z); 109 | Vector2 angle = Vector2(RAD2DEG(asin(direction.y / direction.Length())), RAD2DEG(-atan2(direction.x, -direction.z))); 110 | players.local->GetPlayerInput()->SetBodyAngles(Vector3(angle.x, angle.y, 0)); 111 | 112 | Vector3 velocity = players.local->GetPlayerModel()->GetNewVelocity(); 113 | velocity = velocity.abs(); 114 | 115 | float distance = players.local_position.Distance(global.target_resource.position); 116 | if (distance <= 3.5f && global.is_focused_window) 117 | { 118 | if (distance < 2.0f) 119 | { 120 | players.local->GetPlayerInput()->SetAutoRun(false); 121 | } 122 | 123 | Unity->SetKeyState(KeyCode::Mouse0, true); 124 | //Sleep(200); 125 | 126 | global.ticks++; 127 | if (global.ticks >= 100) 128 | { 129 | global.find_target = true; 130 | } 131 | } 132 | else if (velocity.x < 1 && velocity.y < 1 && velocity.z < 1 && distance > 3.0f) 133 | { 134 | printf("[!] Stuck... Applying Force Jump!\n"); 135 | 136 | Unity->SetKeyState(KeyCode::Space, true); 137 | //Sleep(200); 138 | } 139 | } 140 | } 141 | 142 | void ChamsHandler() 143 | { 144 | if (global.apply_chams) 145 | { 146 | std::vector cached_player_list = global.player_list; 147 | 148 | for (int i = 0; i < cached_player_list.size(); i++) 149 | { 150 | RUSTPLAYER player = cached_player_list[i]; 151 | if (player.instance == reinterpret_cast(players.local)) continue; 152 | 153 | auto player_model = driver.read(player.instance + Offsets::BasePlayer.PlayerModel); 154 | auto player_skin_type = driver.read(player_model + Offsets::PlayerModel.SkinType); 155 | auto player_skin_component = driver.read(player_model + Offsets::PlayerModel.MaleSkin + ((int)player_skin_type * 0x8)); 156 | auto skin = driver.read(player_skin_component + 0x18); 157 | 158 | auto skin_sz = driver.read(skin + 0x18); 159 | for (int i = 0; i <= (int)skin_sz; i++) 160 | { 161 | auto current_skin = driver.read(skin + 0x20 + (i * 0x8)); 162 | 163 | driver.write(current_skin + 0x68, global.selected_chams_material); 164 | driver.write(current_skin + 0x70, global.selected_chams_material); 165 | driver.write(current_skin + 0x78, global.selected_chams_material); 166 | } 167 | driver.write(player.instance + 0x530, true); 168 | } 169 | 170 | auto skinnable_array = driver.ReadChain(global.game_assembly, { Offsets::GameAssembly.Skinnable, 0xb8, 0x0 }); 171 | auto size = driver.read(skinnable_array + 0x18); 172 | 173 | for (int i = 0; i < size; i++) 174 | { 175 | auto instance = driver.read(skinnable_array + 0x20 + (i * 0x8)); if (!instance) continue; 176 | auto catagory = driver.read(instance + 0x58); 177 | 178 | auto list_ptr = driver.read(instance + 0x60); 179 | auto skinnable_group_size = driver.read(list_ptr + 0x18); 180 | 181 | if (catagory != 6 && catagory != 7 && catagory != 9) 182 | { 183 | for (int j = 0; j < skinnable_group_size; j++) 184 | { 185 | auto skinnable_group = driver.read(list_ptr + 0x20 + (j * 0x8)); 186 | if (!skinnable_group) continue; 187 | 188 | if (global.selected_chams_material) 189 | { 190 | driver.write(driver.read(skinnable_group + 0x18) + 0x10, driver.read(global.selected_chams_material + 0x10)); 191 | } 192 | } 193 | } 194 | } 195 | global.apply_chams = false; 196 | } 197 | } 198 | }; -------------------------------------------------------------------------------- /vExample.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 6 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 7 | 8 | 9 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 10 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 11 | 12 | 13 | {f0163f04-3b84-49dd-9170-be9bc8822535} 14 | 15 | 16 | {7f5da9e8-3c3b-4c4e-8838-89731086f013} 17 | 18 | 19 | {0bfe9e72-3608-4789-bcc0-0fcef82645ef} 20 | 21 | 22 | {51849254-34d4-4956-8c64-63899cba3d6d} 23 | 24 | 25 | {dc38da33-c53e-4458-bbf2-c57d46696e4c} 26 | 27 | 28 | {9245932a-d288-4fdb-a019-671719a5bc78} 29 | 30 | 31 | {31971d3f-ea16-4886-86dd-2005bf03a0f8} 32 | 33 | 34 | {2458f35d-ea64-4957-a207-18b5d2b10134} 35 | 36 | 37 | 38 | 39 | Threads 40 | 41 | 42 | Threads 43 | 44 | 45 | Threads 46 | 47 | 48 | Threads 49 | 50 | 51 | Threads 52 | 53 | 54 | Overlay\ImGui 55 | 56 | 57 | Overlay\ImGui 58 | 59 | 60 | Overlay\ImGui 61 | 62 | 63 | Overlay\ImGui 64 | 65 | 66 | Overlay\ImGui 67 | 68 | 69 | Overlay\ImGui 70 | 71 | 72 | Overlay\ImGui 73 | 74 | 75 | 76 | 77 | Header Files 78 | 79 | 80 | Header Files 81 | 82 | 83 | Header Files 84 | 85 | 86 | Overlay 87 | 88 | 89 | Overlay 90 | 91 | 92 | Overlay 93 | 94 | 95 | Overlay\Resources 96 | 97 | 98 | Overlay\Resources 99 | 100 | 101 | Overlay\ImGui 102 | 103 | 104 | Overlay\ImGui 105 | 106 | 107 | Overlay\ImGui 108 | 109 | 110 | Overlay\ImGui 111 | 112 | 113 | Overlay\ImGui 114 | 115 | 116 | Overlay\ImGui 117 | 118 | 119 | Overlay\ImGui 120 | 121 | 122 | Overlay\ImGui 123 | 124 | 125 | Sdk\Unity 126 | 127 | 128 | Sdk\Unity 129 | 130 | 131 | Sdk\Unity 132 | 133 | 134 | Header Files 135 | 136 | 137 | Sdk\Features 138 | 139 | 140 | Sdk\Features 141 | 142 | 143 | Sdk\Features 144 | 145 | 146 | Sdk\Classes 147 | 148 | 149 | Sdk\Classes 150 | 151 | 152 | Sdk\Classes 153 | 154 | 155 | Sdk\Classes 156 | 157 | 158 | Sdk\Classes 159 | 160 | 161 | Sdk\Classes 162 | 163 | 164 | Sdk\Classes 165 | 166 | 167 | Sdk\Classes 168 | 169 | 170 | Sdk\Classes 171 | 172 | 173 | Sdk\Classes 174 | 175 | 176 | Sdk\Classes 177 | 178 | 179 | Header Files 180 | 181 | 182 | Header Files 183 | 184 | 185 | Memory 186 | 187 | 188 | -------------------------------------------------------------------------------- /Sdk/Classes/World.hpp: -------------------------------------------------------------------------------- 1 | enum class ListType : int 2 | { 3 | Player, 4 | Resource, 5 | World, 6 | Item 7 | }; 8 | 9 | std::vector>> name_list = 10 | { 11 | {"player.prefab", std::make_pair("Player", ListType::Player)}, 12 | {"patrolhelicopter", std::make_pair("Scientist", ListType::Player)}, 13 | {"ch47scientist.entity", std::make_pair("Scientist", ListType::Player)}, 14 | {"scientistnpc_cargo", std::make_pair("Scientist", ListType::Player)}, 15 | {"scientistnpc_cargo_turret_any", std::make_pair("Scientist", ListType::Player)}, 16 | {"scientistnpc_cargo_turret_lr300", std::make_pair("Scientist", ListType::Player)}, 17 | {"scientistnpc_ch47_gunner", std::make_pair("Scientist", ListType::Player)}, 18 | {"scientistnpc_excavator", std::make_pair("Scientist", ListType::Player)}, 19 | {"scientistnpc_full_any", std::make_pair("Scientist", ListType::Player)}, 20 | {"scientistnpc_full_lr300", std::make_pair("Scientist", ListType::Player)}, 21 | {"scientistnpc_full_mp5", std::make_pair("Scientist", ListType::Player)}, 22 | {"scientistnpc_full_pistol", std::make_pair("Scientist", ListType::Player)}, 23 | {"scientistnpc_full_shotgun", std::make_pair("Scientist", ListType::Player)}, 24 | {"scientistnpc_heavy", std::make_pair("Scientist", ListType::Player)}, 25 | {"scientistnpc_junkpile_pistol", std::make_pair("Scientist", ListType::Player)}, 26 | {"scientistnpc_oilrig", std::make_pair("Scientist", ListType::Player)}, 27 | {"scientistnpc_patrol", std::make_pair("Scientist", ListType::Player)}, 28 | {"scientistnpc_roam", std::make_pair("Scientist", ListType::Player)}, 29 | {"scientistnpc_roamthered", std::make_pair("Scientist", ListType::Player)}, 30 | {"npc_tunneldweller", std::make_pair("Dweller", ListType::Player)}, 31 | {"npc_underwaterdweller", std::make_pair("Dweller", ListType::Player)}, 32 | {"stone-ore", std::make_pair("Stone", ListType::Resource)}, 33 | {"sulfur-ore", std::make_pair("Sulfur", ListType::Resource)}, 34 | {"metal-ore", std::make_pair("Metal", ListType::Resource)}, 35 | {"hemp", std::make_pair("Hemp", ListType::Resource)}, 36 | {"small_stash_deployed.prefab", std::make_pair("Stash", ListType::World)}, 37 | {"crate_elite.prefab", std::make_pair("Elite Crate", ListType::World)}, 38 | {"crate_normal.prefab", std::make_pair("Military Crate", ListType::World)}, 39 | {"crate_normal_2.prefab", std::make_pair("Crate", ListType::World)}, 40 | {"supply_drop", std::make_pair("AirDrop", ListType::World)}, 41 | {"codelockedhackablecrate", std::make_pair("Locked Crate", ListType::World)}, 42 | {"autoturret_deployed.prefab", std::make_pair("Autoturret", ListType::World)}, 43 | {"flameturret.deployed.prefab", std::make_pair("Flameturret", ListType::World)}, 44 | {"guntrap.deployed.prefab", std::make_pair("Shotgun Trap", ListType::World)}, 45 | {"player_corpse.prefab", std::make_pair("Corpse", ListType::World)}, 46 | {"item_drop_backpack.prefab", std::make_pair("Corpse", ListType::World)}, 47 | {"(world)", std::make_pair("Droped Item", ListType::Item)} 48 | }; 49 | 50 | struct AllList 51 | { 52 | std::vector player; 53 | std::vector resource; 54 | std::vector world; 55 | std::vector item; 56 | }; 57 | 58 | class World 59 | { 60 | public: 61 | AllList GetFullList() 62 | { 63 | if (!Utils::ValidPointer(reinterpret_cast(this))) return {}; 64 | 65 | AllList list; 66 | 67 | //auto main_offsets = driver.read(global.game_assembly + 0x2F921F8); // System_Collections_Generic_List_BaseGameMode__c 68 | //uintptr_t list_ptr = driver.ReadChain(main_offsets, { 0xB8, 0x8, 0x28 }); 69 | // 70 | //int size = driver.read(list_ptr + 0x10); 71 | //uintptr_t base = driver.read(list_ptr + 0x18); 72 | 73 | auto BaseGameMode__c = driver.read(driver.read(global.game_assembly + 0x2F921F8) + 0xB8); //System_Collections_Generic_List_BaseGameMode__c 74 | auto entity_realm_client = driver.read(BaseGameMode__c + 0x10); 75 | auto client_entities = driver.read(driver.read(entity_realm_client + 0x10) + 0x28); 76 | auto EntityCount = driver.read(client_entities + 0x10); 77 | auto EntityBuffer = driver.read(client_entities + 0x18); 78 | 79 | char buffer[256]; 80 | 81 | for (int i = 0; i < EntityCount; i++) 82 | { 83 | uintptr_t instance = driver.read(EntityBuffer + 0x20 + (i * 0x8)); 84 | uintptr_t name_ptr = driver.ReadChain(instance, { 0x10, 0x30, 0x60 }); 85 | driver.readEx(name_ptr, (ULONG64)buffer, 128); 86 | 87 | //printf("name | %i it | total %i| %s\n", i, size, buffer); 88 | 89 | for (int j = 0; j < name_list.size(); j++) 90 | { 91 | if (strstr(buffer, "LocalPlayer")) 92 | { 93 | //printf("local player %p\n", instance); 94 | players.local = reinterpret_cast(instance); 95 | players.local_position_ptr = players.local->GetPositionPointer(); 96 | } 97 | if (strstr(buffer, name_list[j].first.c_str())) 98 | { 99 | switch (name_list[j].second.second) 100 | { 101 | case ListType::Player: 102 | { 103 | BasePlayer* base_player = reinterpret_cast(instance); 104 | 105 | RUSTPLAYER player; 106 | player.instance = instance; 107 | player.name = base_player->GetName(); 108 | player.name_hash = Utils::HashString(player.name); 109 | player.orgin_ptr = base_player->GetPositionPointer(); 110 | player.is_npc = base_player->GetPlayerModel()->GetIsNpc(); 111 | 112 | int flags = base_player->GetModelState()->GetModelStateFlags(); 113 | if ((flags & 8) == static_cast(8)/* || (flags == 8)*/) 114 | { 115 | player.is_sleeping = true; 116 | } 117 | 118 | player.health_info = base_player->GetHealthInformation(); 119 | 120 | list.player.push_back(player); 121 | break; 122 | } 123 | case ListType::Resource: 124 | { 125 | RUSTRESOURCE resource; 126 | 127 | //Finds the pointer to the instance of the resource 128 | resource.instance = instance; 129 | //Gets cleaned name from name list 130 | resource.name = name_list[j].second.first; 131 | //Hashes the name for comparision later 132 | resource.name_hash = Utils::HashString(resource.name); 133 | //Saves the pointer to the position sp you can read 0x90 into it later to get updated position 134 | resource.position_ptr = driver.ReadChain(resource.instance, { { 0x10, 0x30, 0x30, 0x8, 0x38 } }); 135 | //Cached position to save on reads 136 | resource.position = driver.read(resource.position_ptr + 0x90); 137 | list.resource.push_back(resource); 138 | break; 139 | } 140 | case ListType::World: 141 | { 142 | RUSTWORLD world; 143 | world.instance = instance; 144 | world.name = name_list[j].second.first; 145 | world.name_hash = Utils::HashString(world.name); 146 | //world.position = driver.read(world.instance, { { 0x10, 0x30, 0x30, 0x8, 0x38, 0x90 } }); 147 | 148 | uintptr_t position_ptr = driver.ReadChain(world.instance, { { 0x10, 0x30, 0x30, 0x8, 0x38 } }); 149 | //Cached position to save on reads 150 | world.position = driver.read(position_ptr + 0x90); 151 | 152 | 153 | 154 | list.world.push_back(world); 155 | break; 156 | } 157 | case ListType::Item: 158 | { 159 | RUSTITEM item; 160 | item.instance = instance; 161 | item.name = name_list[j].second.first; 162 | item.name_hash = Utils::HashString(item.name); 163 | //item.position = driver.read(item.instance, { { 0x10, 0x30, 0x30, 0x8, 0x38, 0x90 } }); 164 | 165 | uintptr_t position_ptr = driver.ReadChain(item.instance, { { 0x10, 0x30, 0x30, 0x8, 0x38 } }); 166 | //Cached position to save on reads 167 | item.position = driver.read(position_ptr + 0x90); 168 | 169 | 170 | list.item.push_back(item); 171 | break; 172 | } 173 | default: 174 | break; 175 | } 176 | } 177 | } 178 | //std::this_thread::sleep_for(std::chrono::nanoseconds(1)); 179 | } 180 | return list; 181 | } 182 | 183 | std::vector> GetChamsMaterials() 184 | { 185 | std::vector> result; 186 | 187 | result.push_back(std::make_pair(NULL, "NULL"));//Null cham material 188 | 189 | uintptr_t tod_scattering = driver.ReadChain(global.game_assembly, { Offsets::GameAssembly.TODSky, 0xB8, 0x0, 0x10, 0x20, 0xa8, 0x1a0 }); 190 | 191 | //Other Materials Located At 0x78, 0x80, 0x88 192 | result.push_back(std::make_pair(driver.read(tod_scattering + 0x78), "White ZTest"));//White Wall Material 193 | 194 | result.push_back(std::make_pair(driver.read(tod_scattering + 0x88), "Black ZTest"));//Black Wall Material 195 | 196 | result.push_back(std::make_pair(driver.ReadChain(global.game_assembly, { 0x35D6568, 0xb8, 0x0}), "Reflective"));//OutlineManager_c /* reflective (invisible) */ 197 | 198 | result.push_back(std::make_pair(driver.ReadChain(global.game_assembly, { 0x3622188, 0xb8, 0x0 }), "White"));//UnityEngine_UI_Graphic_c White Material 199 | 200 | return result; 201 | } 202 | }; 203 | -------------------------------------------------------------------------------- /Overlay/Esp.hpp: -------------------------------------------------------------------------------- 1 | /*---------Drawing Functions---------*/ 2 | void DrawCorneredBox(int X, int Y, int W, int H, const ImU32& color, int thickness); 3 | void Outline_Text(Vector2 screen, std::string txt, ImColor color); 4 | 5 | /*---------Esp Functions---------*/ 6 | void DrawPlayers(ImDrawList* draw); 7 | void DrawResources(ImDrawList* draw); 8 | void DrawWorld(ImDrawList* draw); 9 | void DrawItems(ImDrawList* draw); 10 | 11 | /*---------Esp---------*/ 12 | void Esp() 13 | { 14 | global.view_matrix = driver.read(global.camera + Offsets::Camera.ViewMatrix2); 15 | 16 | ImDrawList* draw = ImGui::GetBackgroundDrawList(); 17 | 18 | DrawPlayers(draw); 19 | DrawResources(draw); 20 | DrawWorld(draw); 21 | DrawItems(draw); 22 | } 23 | 24 | void DrawPlayers(ImDrawList* draw) 25 | { 26 | if (global.show_player) 27 | { 28 | std::vector cached_players = global.player_list; 29 | 30 | Vector2 screen_position; 31 | for (int i = 0; i < cached_players.size(); i++) 32 | { 33 | RUSTPLAYER player = cached_players[i]; 34 | 35 | if ((global.player_ignore_npc && player.is_npc) || (global.player_ignore_sleeping && player.is_sleeping)) continue; 36 | 37 | Vector3 orgin = driver.read(player.orgin_ptr + 0x90); 38 | 39 | if (orgin == Vector3(0, 0, 0)) continue; 40 | 41 | //printf("%f %f %f\n", orgin.x, orgin.y, orgin.z); 42 | 43 | Vector3 head_position = Vector3(orgin.x, orgin.y + 1.8f, orgin.z); 44 | Vector3 hand_position = Vector3(orgin.x, orgin.y, orgin.z + 1.0f); 45 | Vector2 screen_head; 46 | 47 | float distance = players.local_position.Distance(orgin); 48 | if (camera.WorldToScreen(orgin, screen_position, global.view_matrix) && camera.WorldToScreen(head_position, screen_head, global.view_matrix) && distance < global.max_player_distance && distance > 1.0f) 49 | { 50 | float height = screen_head.y - screen_position.y; 51 | float width = height / 2.0f; 52 | 53 | std::string player_esp_string = ""; 54 | if (global.show_player_name) 55 | { 56 | player_esp_string.append(std::string(player.name)); 57 | } 58 | if (global.show_player_distance) 59 | { 60 | player_esp_string.append(std::string(" [" + std::to_string((int)players.local_position.Distance(orgin)) + " m]")); 61 | } 62 | Outline_Text(Vector2(screen_position.x, screen_position.y + 10), player_esp_string, global.player_name_color); 63 | 64 | if (global.show_player_box) 65 | { 66 | DrawCorneredBox(screen_position.x - (width / 2), screen_position.y, width, height, global.player_box_color, 1.0f); 67 | } 68 | } 69 | } 70 | } 71 | } 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | void DrawResources(ImDrawList* draw) 80 | { 81 | if (global.show_resource) 82 | { 83 | std::vector cached_resources = global.resource_list; 84 | Vector2 screen_position; 85 | 86 | for (int i = 0; i < cached_resources.size(); i++) 87 | { 88 | RUSTRESOURCE resource = cached_resources[i]; 89 | 90 | ImColor color; 91 | bool skip = false; 92 | /* 93 | Stone Hash 1696469454 94 | Metal Hash 1622519874 95 | Sulfur Hash 1554069420 96 | Hemp Hash 1082534429 97 | */ 98 | 99 | //Find The Resources Color And Determine Weather You Need To Skip Or Not 100 | switch (resource.name_hash) 101 | { 102 | case 1696469454: 103 | skip = !global.show_stone; 104 | color = global.stone_color; 105 | break; 106 | case 1622519874: 107 | skip = !global.show_metal; 108 | color = global.metal_color; 109 | break; 110 | case 1554069420: 111 | skip = !global.show_sulfur; 112 | color = global.sulfur_color; 113 | break; 114 | case 1082534429: 115 | skip = !global.show_hemp; 116 | color = global.hemp_color; 117 | break; 118 | default: 119 | skip = true; 120 | break; 121 | } 122 | 123 | float distance = players.local_position.Distance(resource.position); 124 | 125 | if (skip || distance > global.max_resource_distance) continue; 126 | 127 | if (camera.WorldToScreen(resource.position, screen_position, global.view_matrix)) 128 | { 129 | std::string resource_esp_string = ""; 130 | if (global.show_resource_name) 131 | { 132 | resource_esp_string.append(std::string(resource.name)); 133 | } 134 | if (global.show_resource_distance) 135 | { 136 | resource_esp_string.append(" [" + std::to_string((int)distance) + " m]"); 137 | } 138 | 139 | Outline_Text(Vector2(screen_position.x, screen_position.y + 10), resource_esp_string, color); 140 | } 141 | } 142 | } 143 | } 144 | 145 | void DrawWorld(ImDrawList* draw) 146 | { 147 | if (global.show_world) 148 | { 149 | std::vector cached_resources = global.world_list; 150 | Vector2 screen_position; 151 | 152 | for (int i = 0; i < cached_resources.size(); i++) 153 | { 154 | RUSTWORLD world = cached_resources[i]; 155 | 156 | ImColor color; 157 | bool skip = false; 158 | /* 159 | Stash Hash 1696490862 160 | Elite Crate Hash 697501462 161 | Military Crate Hash 1907420021 162 | Crate Hash 1611742587 163 | AirDrop Hash 1383014174 164 | Locked Crate Hash 217888051 165 | Autoturret Hash 155487790 166 | Flameturret Hash 1730120291 167 | Shotgun Trap Hash 1562176836 168 | Corpse Hash 2062577317 169 | */ 170 | 171 | //Find The World Entities Color And Determine Weather You Need To Skip Or Not 172 | switch (world.name_hash) 173 | { 174 | case 1696490862: 175 | skip = !global.show_stash; 176 | color = global.stash_color; 177 | break; 178 | case 697501462: 179 | skip = !global.show_crate_elite; 180 | color = global.crate_elite_color; 181 | break; 182 | case 1907420021: 183 | skip = !global.show_create_military; 184 | color = global.crate_military_color; 185 | break; 186 | case 1383014174: 187 | skip = !global.show_airdrop; 188 | color = global.airdrop_color; 189 | break; 190 | case 217888051: 191 | skip = !global.show_locked_crate; 192 | color = global.locked_crate_color; 193 | break; 194 | case 1611742587: 195 | skip = !global.show_crate; 196 | color = global.crate_color; 197 | break; 198 | case 155487790: 199 | skip = !global.show_auto_turret; 200 | color = global.auto_turret_color; 201 | break; 202 | case 1730120291: 203 | skip = !global.show_flame_turret; 204 | color = global.flame_turret_color; 205 | break; 206 | case 1562176836: 207 | skip = !global.show_shotgun_trap; 208 | color = global.shotgun_trap_color; 209 | break; 210 | case 2062577317: 211 | skip = !global.show_corpse; 212 | color = global.corpse_color; 213 | break; 214 | default: 215 | skip = true; 216 | break; 217 | } 218 | 219 | float distance = players.local_position.Distance(world.position); 220 | 221 | if (skip || distance > global.max_world_distance) continue; 222 | 223 | if (camera.WorldToScreen(world.position, screen_position, global.view_matrix)) 224 | { 225 | 226 | std::string world_esp_string = ""; 227 | if (global.show_world_name) 228 | { 229 | world_esp_string.append(world.name); 230 | } 231 | if (global.show_world_distance) 232 | { 233 | world_esp_string.append(" [" + std::to_string((int)distance) + " m]"); 234 | } 235 | 236 | Outline_Text(Vector2(screen_position.x, screen_position.y + 10), world_esp_string, color); 237 | } 238 | } 239 | } 240 | } 241 | 242 | void DrawItems(ImDrawList* draw) 243 | { 244 | 245 | } 246 | 247 | void DrawCorneredBox(int X, int Y, int W, int H, const ImU32& color, int thickness) 248 | { 249 | float lineW = (W / 3); 250 | float lineH = (H / 3); 251 | 252 | auto draw = ImGui::GetBackgroundDrawList(); 253 | 254 | draw->AddLine(ImVec2(X, Y), ImVec2(X, Y + lineH), ImGui::GetColorU32(color), thickness); 255 | draw->AddLine(ImVec2(X, Y), ImVec2(X + lineW, Y), ImGui::GetColorU32(color), thickness); 256 | draw->AddLine(ImVec2(X + W - lineW, Y), ImVec2(X + W, Y), ImGui::GetColorU32(color), thickness); 257 | draw->AddLine(ImVec2(X + W, Y), ImVec2(X + W, Y + lineH), ImGui::GetColorU32(color), thickness); 258 | draw->AddLine(ImVec2(X, Y + H - lineH), ImVec2(X, Y + H), ImGui::GetColorU32(color), thickness); 259 | draw->AddLine(ImVec2(X, Y + H), ImVec2(X + lineW, Y + H), ImGui::GetColorU32(color), thickness); 260 | draw->AddLine(ImVec2(X + W - lineW, Y + H), ImVec2(X + W, Y + H), ImGui::GetColorU32(color), thickness); 261 | draw->AddLine(ImVec2(X + W, Y + H - lineH), ImVec2(X + W, Y + H), ImGui::GetColorU32(color), thickness); 262 | } 263 | 264 | void Outline_Text(Vector2 screen, std::string txt, ImColor color = IM_COL32(255, 255, 255, 255)) 265 | { 266 | auto draw = ImGui::GetBackgroundDrawList(); 267 | 268 | ImVec2 fontSize = ImGui::CalcTextSize(txt.c_str(), 0, false, -1.0f); 269 | draw->AddText(ImVec2(screen.x + 1 - (fontSize.x / 2), screen.y - (fontSize.y / 2)), IM_COL32(0, 0, 0, color.Value.w * 255), txt.c_str()); 270 | draw->AddText(ImVec2(screen.x - 1 - (fontSize.x / 2), screen.y - (fontSize.y / 2)), IM_COL32(0, 0, 0, color.Value.w * 255), txt.c_str()); 271 | draw->AddText(ImVec2(screen.x - (fontSize.x / 2), screen.y + 1 - (fontSize.y / 2)), IM_COL32(0, 0, 0, color.Value.w * 255), txt.c_str()); 272 | draw->AddText(ImVec2(screen.x - (fontSize.x / 2), screen.y - 1 - (fontSize.y / 2)), IM_COL32(0, 0, 0, color.Value.w * 255), txt.c_str()); 273 | draw->AddText(ImVec2(screen.x - (fontSize.x / 2), screen.y - (fontSize.y / 2)), color, txt.c_str()); 274 | } -------------------------------------------------------------------------------- /Overlay/ImGui/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI 3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure. 4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions. 5 | //----------------------------------------------------------------------------- 6 | // A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/rebased branch with your modifications to it) 7 | // B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template. 8 | //----------------------------------------------------------------------------- 9 | // You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp 10 | // files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures. 11 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts. 12 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using. 13 | //----------------------------------------------------------------------------- 14 | 15 | #pragma once 16 | 17 | //---- Define assertion handler. Defaults to calling assert(). 18 | // If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement. 19 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 20 | //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts 21 | 22 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows 23 | // Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility. 24 | // DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions() 25 | // for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details. 26 | //#define IMGUI_API __declspec( dllexport ) 27 | //#define IMGUI_API __declspec( dllimport ) 28 | 29 | //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names. 30 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 31 | //#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87: disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This will be folded into IMGUI_DISABLE_OBSOLETE_FUNCTIONS in a few versions. 32 | 33 | //---- Disable all of Dear ImGui or don't implement standard windows. 34 | // It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp. 35 | //#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty. 36 | //#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended. 37 | //#define IMGUI_DISABLE_METRICS_WINDOW // Disable metrics/debugger and other debug tools: ShowMetricsWindow() and ShowStackToolWindow() will be empty. 38 | 39 | //---- Don't implement some functions to reduce linkage requirements. 40 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a) 41 | //#define IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with Visual Studio] Implement default IME handler (require imm32.lib/.a, auto-link for Visual Studio, -limm32 on command-line for MinGW) 42 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a) 43 | //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime). 44 | //#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default). 45 | //#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf) 46 | //#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself. 47 | //#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies) 48 | //#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function. 49 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions(). 50 | //#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available 51 | 52 | //---- Include imgui_user.h at the end of imgui.h as a convenience 53 | //#define IMGUI_INCLUDE_IMGUI_USER_H 54 | 55 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another) 56 | //#define IMGUI_USE_BGRA_PACKED_COLOR 57 | 58 | //---- Use 32-bit for ImWchar (default is 16-bit) to support unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...) 59 | //#define IMGUI_USE_WCHAR32 60 | 61 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version 62 | // By default the embedded implementations are declared static and not available outside of Dear ImGui sources files. 63 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" 64 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" 65 | //#define IMGUI_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if enabled 66 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION 67 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION 68 | 69 | //---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined) 70 | // Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h. 71 | //#define IMGUI_USE_STB_SPRINTF 72 | 73 | //---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui) 74 | // Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided). 75 | // On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'. 76 | //#define IMGUI_ENABLE_FREETYPE 77 | 78 | //---- Use stb_truetype to build and rasterize the font atlas (default) 79 | // The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend. 80 | //#define IMGUI_ENABLE_STB_TRUETYPE 81 | 82 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. 83 | // This will be inlined as part of ImVec2 and ImVec4 class declarations. 84 | /* 85 | #define IM_VEC2_CLASS_EXTRA \ 86 | constexpr ImVec2(const MyVec2& f) : x(f.x), y(f.y) {} \ 87 | operator MyVec2() const { return MyVec2(x,y); } 88 | 89 | #define IM_VEC4_CLASS_EXTRA \ 90 | constexpr ImVec4(const MyVec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {} \ 91 | operator MyVec4() const { return MyVec4(x,y,z,w); } 92 | */ 93 | 94 | //---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices. 95 | // Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices). 96 | // Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer. 97 | // Read about ImGuiBackendFlags_RendererHasVtxOffset for details. 98 | //#define ImDrawIdx unsigned int 99 | 100 | //---- Override ImDrawCallback signature (will need to modify renderer backends accordingly) 101 | //struct ImDrawList; 102 | //struct ImDrawCmd; 103 | //typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data); 104 | //#define ImDrawCallback MyImDrawCallback 105 | 106 | //---- Debug Tools: Macro to break in Debugger 107 | // (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.) 108 | //#define IM_DEBUG_BREAK IM_ASSERT(0) 109 | //#define IM_DEBUG_BREAK __debugbreak() 110 | 111 | //---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(), 112 | // (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.) 113 | // This adds a small runtime cost which is why it is not enabled by default. 114 | //#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX 115 | 116 | //---- Debug Tools: Enable slower asserts 117 | //#define IMGUI_DEBUG_PARANOID 118 | 119 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 120 | /* 121 | namespace ImGui 122 | { 123 | void MyFunction(const char* name, const MyMatrix44& v); 124 | } 125 | */ 126 | -------------------------------------------------------------------------------- /Threads/Overlay.cpp: -------------------------------------------------------------------------------- 1 | #include "includes.hpp" 2 | 3 | static ID3D11Device* g_pd3dDevice = NULL; 4 | static ID3D11DeviceContext* g_pd3dDeviceContext = NULL; 5 | static IDXGISwapChain* g_pSwapChain = NULL; 6 | static ID3D11RenderTargetView* g_mainRenderTargetView = NULL; 7 | 8 | HWND GameWnd = 0, MyWnd = 0; 9 | RECT GameRect = {}; 10 | 11 | void Update(); 12 | 13 | LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 14 | int Overlay() 15 | { 16 | 17 | WNDCLASSEX wc = { sizeof(WNDCLASSEX), 0, WndProc, 0, 0, nullptr, LoadIcon(nullptr, IDI_APPLICATION), LoadCursor(nullptr, IDC_ARROW), nullptr, nullptr, _("CEF-OSC-WIDGET"), LoadIcon(nullptr, IDI_APPLICATION) }; 18 | RegisterClassEx(&wc); 19 | 20 | GameWnd = FindWindowA(_("UnityWndClass"), _("Rust"));//UnityWndClass, 0x10734, Rust, RustClient.exe (16204): 10560 21 | 22 | ShowWindow(GameWnd, SW_SHOWDEFAULT); 23 | 24 | ZeroMemory(&GameRect, sizeof(GameRect)); 25 | GetWindowRect(GameWnd, &GameRect); 26 | 27 | global.screen_width = GameRect.right - GameRect.left; 28 | global.screen_height = GameRect.bottom - GameRect.top; 29 | 30 | MyWnd = CreateWindowEx(NULL, _("CEF-OSC-WIDGET"), _("NVIDIA GeForce Overlay DT"), WS_POPUP | WS_VISIBLE, GameRect.left - 4.f, GameRect.top - 4.f, global.screen_width + 4.f, global.screen_height + 4.f, NULL, NULL, wc.hInstance, NULL); 31 | MARGINS Margin = { GameRect.left - 4.f, GameRect.top - 4.f, global.screen_width + 4.f, global.screen_height + 4.f }; 32 | DwmExtendFrameIntoClientArea(MyWnd, &Margin); 33 | 34 | SetWindowLong(MyWnd, GWL_EXSTYLE, WS_EX_LAYERED | WS_EX_TRANSPARENT); 35 | 36 | bool create_device = false; 37 | 38 | DXGI_SWAP_CHAIN_DESC sd; 39 | ZeroMemory(&sd, sizeof(sd)); 40 | sd.BufferCount = 2; 41 | sd.BufferDesc.Width = 0; 42 | sd.BufferDesc.Height = 0; 43 | sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; 44 | sd.BufferDesc.RefreshRate.Numerator = 60; 45 | sd.BufferDesc.RefreshRate.Denominator = 1; 46 | sd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; 47 | sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; 48 | sd.OutputWindow = MyWnd; 49 | sd.SampleDesc.Count = 1; 50 | sd.SampleDesc.Quality = 0; 51 | sd.Windowed = TRUE; 52 | sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; 53 | 54 | UINT create_device_flags = 0; 55 | D3D_FEATURE_LEVEL feature_level; 56 | const D3D_FEATURE_LEVEL feature_level_array[2] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_0, }; 57 | if (D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, create_device_flags, feature_level_array, 2, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &feature_level, &g_pd3dDeviceContext) != S_OK) 58 | { 59 | create_device = false; 60 | } 61 | else 62 | { 63 | create_device = true; 64 | } 65 | 66 | ID3D11Texture2D* pBackBuffer; 67 | g_pSwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer)); 68 | g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &g_mainRenderTargetView); 69 | pBackBuffer->Release(); 70 | 71 | if (!create_device) 72 | { 73 | if (g_mainRenderTargetView) 74 | { 75 | g_mainRenderTargetView->Release(); 76 | g_mainRenderTargetView = NULL; 77 | } 78 | 79 | if (g_pSwapChain) 80 | { 81 | g_pSwapChain->Release(); 82 | g_pSwapChain = NULL; 83 | } 84 | 85 | if (g_pd3dDeviceContext) 86 | { 87 | g_pd3dDeviceContext->Release(); 88 | g_pd3dDeviceContext = NULL; 89 | } 90 | 91 | if (g_pd3dDevice) 92 | { 93 | g_pd3dDevice->Release(); 94 | g_pd3dDevice = NULL; 95 | } 96 | UnregisterClass(wc.lpszClassName, wc.hInstance); 97 | return 1; 98 | } 99 | 100 | ShowWindow(MyWnd, SW_SHOWDEFAULT); 101 | UpdateWindow(MyWnd); 102 | 103 | IMGUI_CHECKVERSION(); 104 | ImGui::CreateContext(); 105 | ImGuiIO& io = ImGui::GetIO(); (void)io; 106 | io.IniFilename = NULL; 107 | ImGui::AmplitudeStyle(); 108 | ImGui_ImplWin32_Init(MyWnd); 109 | ImGui_ImplDX11_Init(g_pd3dDevice, g_pd3dDeviceContext); 110 | 111 | io.Fonts->AddFontFromFileTTF(_("C:\\Windows\\Fonts\\courbd.ttf"), 15.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 112 | 113 | ImFontConfig font_cfg; 114 | font_cfg.FontDataOwnedByAtlas = false; 115 | 116 | global.icons = io.Fonts->AddFontFromMemoryTTF(icon, sizeof(icon), 25.f, &font_cfg); 117 | global.title = io.Fonts->AddFontFromMemoryTTF(verdana_bold, sizeof(verdana_bold), 35.0f, &font_cfg); 118 | global.radar = io.Fonts->AddFontFromMemoryTTF(verdana_bold, sizeof(verdana_bold), 10.0f, &font_cfg); 119 | //global.tiny = io.Fonts->AddFontFromFileTTF(_("C:\\Windows\\Fonts\\courbd.ttf"), 12.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 120 | global.medium = io.Fonts->AddFontFromMemoryTTF(verdana_bold, sizeof(verdana_bold), 20.0f, &font_cfg); 121 | global.large = io.Fonts->AddFontFromFileTTF(_("C:\\Windows\\Fonts\\courbd.ttf"), 35.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 122 | 123 | IM_ASSERT(font != NULL); 124 | 125 | D3DX11_IMAGE_LOAD_INFO info; 126 | ID3DX11ThreadPump* pump{ nullptr }; 127 | D3DX11CreateShaderResourceViewFromMemory(g_pd3dDevice, background_image, sizeof(background_image), &info, pump, &global.Image, 0); 128 | 129 | bool done = false; 130 | 131 | std::mutex thread_lock; 132 | thread_lock.lock(); 133 | 134 | auto target_tp = std::chrono::steady_clock::now(); 135 | 136 | while (!done) 137 | { 138 | if (global.limit_fps) 139 | { 140 | auto time_between_frames = std::chrono::microseconds(std::chrono::seconds(1)) / (int)global.target_fps; 141 | target_tp += time_between_frames; 142 | std::this_thread::sleep_until(target_tp); 143 | } 144 | 145 | 146 | HWND hwnd_active = GetForegroundWindow(); 147 | if (hwnd_active == GameWnd) 148 | { 149 | HWND hwndtest = GetWindow(hwnd_active, GW_HWNDPREV); 150 | SetWindowPos(MyWnd, hwndtest, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); 151 | global.is_focused_window = true; 152 | } 153 | else 154 | { 155 | global.is_focused_window = false; 156 | } 157 | MSG msg; 158 | while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) 159 | { 160 | TranslateMessage(&msg); 161 | DispatchMessage(&msg); 162 | if (msg.message == WM_QUIT) done = true; 163 | } 164 | 165 | if (done) break; 166 | 167 | ImGui_ImplDX11_NewFrame(); 168 | ImGui_ImplWin32_NewFrame(); 169 | ImGui::NewFrame(); 170 | 171 | Update(); 172 | Esp(); 173 | MiscDrawing(); 174 | Menu(); 175 | 176 | ImGui::Render(); 177 | 178 | const float clear_color_with_alpha[4] = { 0,0,0,0 }; 179 | g_pd3dDeviceContext->OMSetRenderTargets(1, &g_mainRenderTargetView, NULL); 180 | g_pd3dDeviceContext->ClearRenderTargetView(g_mainRenderTargetView, clear_color_with_alpha); 181 | ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData()); 182 | g_pSwapChain->Present((int)global.vsync, 0); 183 | } 184 | thread_lock.unlock(); 185 | 186 | ImGui_ImplDX11_Shutdown(); 187 | ImGui_ImplWin32_Shutdown(); 188 | ImGui::DestroyContext(); 189 | 190 | if (g_mainRenderTargetView) 191 | { 192 | g_mainRenderTargetView->Release(); 193 | g_mainRenderTargetView = NULL; 194 | } 195 | 196 | if (g_pSwapChain) 197 | { 198 | g_pSwapChain->Release(); 199 | g_pSwapChain = NULL; 200 | } 201 | 202 | if (g_pd3dDeviceContext) 203 | { 204 | g_pd3dDeviceContext->Release(); 205 | g_pd3dDeviceContext = NULL; 206 | } 207 | 208 | if (g_pd3dDevice) 209 | { 210 | g_pd3dDevice->Release(); 211 | g_pd3dDevice = NULL; 212 | } 213 | 214 | DestroyWindow(MyWnd); 215 | UnregisterClass(wc.lpszClassName, wc.hInstance); 216 | 217 | return 0; 218 | } 219 | 220 | void Update() 221 | { 222 | HWND activeWnd = GetForegroundWindow(); 223 | if (activeWnd == MyWnd) 224 | { 225 | HWND hwndtest = GetWindow(activeWnd, GW_HWNDPREV); 226 | SetWindowPos(MyWnd, hwndtest, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); 227 | } 228 | 229 | ZeroMemory(&GameRect, sizeof(GameRect)); 230 | GetWindowRect(GameWnd, &GameRect); 231 | 232 | global.screen_width = GameRect.right - GameRect.left; 233 | global.screen_height = GameRect.bottom - GameRect.top; 234 | 235 | DWORD dwStyle = GetWindowLong(GameWnd, GWL_STYLE); 236 | if (dwStyle & WS_BORDER) 237 | { 238 | GameRect.top += 32; 239 | global.screen_height -= 39; 240 | } 241 | 242 | MoveWindow(MyWnd, GameRect.left - 4.f, GameRect.top - 4.f, global.screen_width + 4.f, global.screen_height + 4.f, true); 243 | 244 | if (GetAsyncKeyState(VK_INSERT) & 1) 245 | { 246 | global.menu = !global.menu; 247 | if (global.menu) 248 | { 249 | SetWindowLongA(MyWnd, GWL_EXSTYLE, WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW); 250 | SetForegroundWindow(MyWnd); 251 | } 252 | else 253 | { 254 | SetWindowLongA(MyWnd, GWL_EXSTYLE, WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW); 255 | } 256 | } 257 | } 258 | 259 | extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 260 | LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) 261 | { 262 | if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam)) 263 | return true; 264 | 265 | switch (msg) 266 | { 267 | case WM_SIZE: 268 | if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED) 269 | { 270 | if (g_mainRenderTargetView) 271 | { 272 | g_mainRenderTargetView->Release(); g_mainRenderTargetView = NULL; 273 | } 274 | 275 | g_pSwapChain->ResizeBuffers(0, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam), DXGI_FORMAT_UNKNOWN, 0); 276 | 277 | ID3D11Texture2D* pBackBuffer; 278 | g_pSwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer)); 279 | g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &g_mainRenderTargetView); 280 | pBackBuffer->Release(); 281 | 282 | } 283 | return 0; 284 | case WM_SYSCOMMAND: 285 | if ((wParam & 0xfff0) == SC_KEYMENU) 286 | return 0; 287 | break; 288 | case WM_DESTROY: 289 | PostQuitMessage(0); 290 | return 0; 291 | } 292 | return DefWindowProc(hWnd, msg, wParam, lParam); 293 | } -------------------------------------------------------------------------------- /Sdk/Unity/Unity.hpp: -------------------------------------------------------------------------------- 1 | class Unity 2 | { 3 | private: 4 | struct matrices 5 | { 6 | uint64_t matrices; 7 | int index; 8 | }; 9 | 10 | struct matrix_list 11 | { 12 | uint64_t matrixListBase = 0; 13 | uint64_t dependencyIndexTableBase = 0; 14 | }; 15 | public: 16 | 17 | uintptr_t GetComponentFromGameObject(uint64_t game_object, const char* component_name) 18 | { 19 | char buffer[128] = {}; 20 | 21 | uintptr_t game_object_class = driver.read(game_object + 0x30); 22 | for (int i = 0; i < 20; i++) 23 | { 24 | uintptr_t component = driver.read(game_object_class + (0x10 * i + 0x8)); 25 | if (!component) continue; 26 | 27 | uintptr_t fields = driver.read(component + 0x28); 28 | if (!fields) continue; 29 | 30 | uintptr_t name_ptr = driver.read(fields); 31 | name_ptr = driver.read(name_ptr + 0x10); 32 | if (!name_ptr) continue; 33 | 34 | driver.readEx((name_ptr), (ULONG64)buffer, 128); 35 | //printf("%s\n", buffer); 36 | 37 | if (strcmp(buffer, component_name) == 0) 38 | { 39 | return fields; 40 | } 41 | } 42 | 43 | return -1; 44 | } 45 | 46 | uintptr_t GetCameraFromName(const char* camera_name, bool get_object = false) { 47 | char buffer[128] = {}; 48 | 49 | uintptr_t camera_manager_offset = driver.read(global.unity_player + Offsets::Unity.AllCameras); // 0x1A74500 50 | uintptr_t camera_manager = driver.read(camera_manager_offset + 0x0); 51 | 52 | int size = driver.read(camera_manager_offset + 0x10); 53 | 54 | for (int i = 0; i < size; i++) 55 | { 56 | uintptr_t camera = driver.read(camera_manager + (i * 0x8)); 57 | 58 | if (!camera)continue; 59 | 60 | uintptr_t camera_object = driver.read(camera + 0x30); 61 | uintptr_t name_ptr = driver.read(camera_object + 0x60); 62 | driver.readEx((name_ptr + 0x0), (ULONG64)buffer, 128); 63 | 64 | //printf("%s\n", buffer); 65 | 66 | if (strcmp(buffer, camera_name) == 0) 67 | { 68 | if (get_object) 69 | { 70 | return camera_object; 71 | } 72 | else 73 | { 74 | return camera; 75 | } 76 | } 77 | } 78 | return NULL; 79 | } 80 | 81 | struct UnityEngine_TransformAccessReadOnly 82 | { 83 | uintptr_t TransformData; /* 0x0 */ 84 | uint32_t Index; /* 0x8 */ 85 | }; 86 | 87 | struct UnityEngine_TransformData 88 | { 89 | uintptr_t TransformArray; /* 0x0 */ 90 | uintptr_t TransformIndices; /* 0x8 */ 91 | }; 92 | 93 | Vector3 GetTransformPosition(_In_ uintptr_t transform) 94 | { 95 | uintptr_t transform_internal = driver.read(transform + 0x10); 96 | 97 | if (!transform_internal) 98 | return Vector3(); 99 | try 100 | { 101 | __m128 result; 102 | 103 | const __m128 mulVec0 = { -2.000, 2.000, -2.000, 0.000 }; 104 | const __m128 mulVec1 = { 2.000, -2.000, -2.000, 0.000 }; 105 | const __m128 mulVec2 = { -2.000, -2.000, 2.000, 0.000 }; 106 | 107 | UnityEngine_TransformAccessReadOnly pTransformAccessReadOnly = driver.read(transform_internal + 0x38); 108 | UnityEngine_TransformData transformData = driver.read(pTransformAccessReadOnly.TransformData + 0x18); 109 | 110 | if (!transformData.TransformArray) 111 | return Vector3(); 112 | 113 | if (!transformData.TransformIndices) 114 | return Vector3(); 115 | 116 | size_t sizeMatriciesBuf = sizeof(matrix3x4) * pTransformAccessReadOnly.Index + sizeof(matrix3x4); 117 | size_t sizeIndicesBuf = sizeof(int) * pTransformAccessReadOnly.Index + sizeof(int); 118 | 119 | void* pMatriciesBuf = malloc(sizeMatriciesBuf); 120 | void* pIndicesBuf = malloc(sizeIndicesBuf); 121 | 122 | if (pMatriciesBuf && pIndicesBuf) 123 | { 124 | if (transformData.TransformArray == 0 || transformData.TransformIndices == 0) 125 | return Vector3(); 126 | 127 | // Read Matricies array into the buffer 128 | driver.readEx(transformData.TransformArray, (ULONG64)pMatriciesBuf, sizeMatriciesBuf); 129 | // Read Indices array into the buffer 130 | driver.readEx(transformData.TransformIndices, (ULONG64)pIndicesBuf, sizeIndicesBuf); 131 | 132 | __m128 Result = *reinterpret_cast<__m128*>(reinterpret_cast(pMatriciesBuf) + (0x30 * pTransformAccessReadOnly.Index)); 133 | int TransformIndex = *reinterpret_cast((reinterpret_cast(pIndicesBuf) + (0x4 * pTransformAccessReadOnly.Index))); 134 | 135 | while (TransformIndex >= 0 && TransformIndex < (sizeMatriciesBuf / 0x30)) 136 | { 137 | if (!pMatriciesBuf || !pIndicesBuf || !&result || !&TransformIndex) 138 | return Vector3(); 139 | 140 | matrix3x4 Matrix = *reinterpret_cast(reinterpret_cast(pMatriciesBuf) + (0x30 * TransformIndex)); 141 | 142 | if (!&Matrix) 143 | return Vector3(); 144 | 145 | __m128 xxxx = _mm_castsi128_ps(_mm_shuffle_epi32(*reinterpret_cast<__m128i*>(&Matrix._21), 0x00)); // xxxx 146 | __m128 yyyy = _mm_castsi128_ps(_mm_shuffle_epi32(*reinterpret_cast<__m128i*>(&Matrix._21), 0x55)); // yyyy 147 | __m128 zwxy = _mm_castsi128_ps(_mm_shuffle_epi32(*reinterpret_cast<__m128i*>(&Matrix._21), 0x8E)); // zwxy 148 | __m128 wzyw = _mm_castsi128_ps(_mm_shuffle_epi32(*reinterpret_cast<__m128i*>(&Matrix._21), 0xDB)); // wzyw 149 | __m128 zzzz = _mm_castsi128_ps(_mm_shuffle_epi32(*reinterpret_cast<__m128i*>(&Matrix._21), 0xAA)); // zzzz 150 | __m128 yxwy = _mm_castsi128_ps(_mm_shuffle_epi32(*reinterpret_cast<__m128i*>(&Matrix._21), 0x71)); // yxwy 151 | __m128 tmp7 = _mm_mul_ps(*reinterpret_cast<__m128*>(&Matrix._31), Result); 152 | 153 | Result = _mm_add_ps( 154 | _mm_add_ps( 155 | _mm_add_ps( 156 | _mm_mul_ps( 157 | _mm_sub_ps( 158 | _mm_mul_ps(_mm_mul_ps(xxxx, mulVec1), zwxy), 159 | _mm_mul_ps(_mm_mul_ps(yyyy, mulVec2), wzyw)), 160 | _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(tmp7), 0xAA))), 161 | _mm_mul_ps( 162 | _mm_sub_ps( 163 | _mm_mul_ps(_mm_mul_ps(zzzz, mulVec2), wzyw), 164 | _mm_mul_ps(_mm_mul_ps(xxxx, mulVec0), yxwy)), 165 | _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(tmp7), 0x55)))), 166 | _mm_add_ps( 167 | _mm_mul_ps( 168 | _mm_sub_ps( 169 | _mm_mul_ps(_mm_mul_ps(yyyy, mulVec0), yxwy), 170 | _mm_mul_ps(_mm_mul_ps(zzzz, mulVec1), zwxy)), 171 | _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(tmp7), 0x00))), 172 | tmp7)), *(__m128*)(&Matrix._11)); 173 | 174 | TransformIndex = *reinterpret_cast(reinterpret_cast(pIndicesBuf) + (0x4 * TransformIndex)); 175 | } 176 | 177 | free(pMatriciesBuf); 178 | free(pIndicesBuf); 179 | 180 | return Vector3{ Result.m128_f32[0], Result.m128_f32[1], Result.m128_f32[2] }; 181 | } 182 | 183 | return {}; 184 | } 185 | catch (...) 186 | { 187 | return Vector3(); 188 | } 189 | } 190 | 191 | double GetRealTimeSinceStartup() 192 | { 193 | double v0; // xmm0_8 194 | LARGE_INTEGER PerformanceCount; // [rsp+30h] [rbp+8h] BYREF 195 | 196 | if (driver.read(global.unity_player + 0x181B020) == -1) 197 | { 198 | PerformanceCount.QuadPart = 0; 199 | QueryPerformanceCounter(&PerformanceCount); 200 | driver.write(global.unity_player + 0x181B018, PerformanceCount.QuadPart); 201 | } 202 | 203 | PerformanceCount.QuadPart = 0; 204 | QueryPerformanceCounter(&PerformanceCount); 205 | 206 | uint64_t qword_181B018 = driver.read(global.unity_player + 0x181B018); 207 | 208 | v0 = (double)(PerformanceCount.LowPart - (int)qword_181B018); 209 | 210 | if (PerformanceCount.QuadPart - qword_181B018 < 0) { 211 | v0 = v0 + 1.844674407370955e19; 212 | } 213 | 214 | v0 = v0 * driver.read(global.unity_player + 0x181AE58) / 1000000000.0; 215 | v0 = v0 - driver.read(global.unity_player + 0x1769F40); 216 | 217 | uint64_t time_manager_ptr = driver.read(global.unity_player + (0x17C1CD0 + (7 * 0x8))); 218 | 219 | return v0 - driver.read(time_manager_ptr + 0xE8); 220 | } 221 | 222 | void IgnoreLayer(int main_layer, int layer_to_ignore, bool should_ignore = 0) 223 | { 224 | /* 225 | a1 = physics_manager 226 | a2 = main_layer 227 | a3 = layer_to_ignore 228 | a4 = should_ignore 229 | */ 230 | uintptr_t physics_manager = driver.read(global.unity_player + (0x17C1CD0 + (9 * 0x8))); 231 | 232 | uint64_t v7 = driver.read(physics_manager + 0x70); 233 | uint32_t v8 = driver.read(v7 + (0x4 * main_layer)); 234 | 235 | int v11 = 1 << layer_to_ignore; 236 | 237 | //if (((v8 & (1 << layer_to_ignore)) == 0) != should_ignore) 238 | { 239 | int v12 = 0x4 * layer_to_ignore; 240 | int v13 = 0x1 << main_layer; 241 | 242 | int flags = driver.read(v12 + v7); 243 | if (!should_ignore) 244 | { 245 | driver.write(v8, v8 & ~v11); 246 | driver.write(v12 + v7, flags &= ~v13); 247 | } 248 | else 249 | { 250 | driver.write(v8, v11 | v8); 251 | driver.write(v12 + v7, flags |= v13); 252 | } 253 | } 254 | } 255 | 256 | void SetTimeScale(float time_scale) 257 | { 258 | uintptr_t time_manager = driver.read(global.unity_player + (0x17C1CD0 + (7 * 0x8))); 259 | 260 | if (time_scale >= 0.0) 261 | { 262 | driver.write(time_manager + 0xFC, time_scale); 263 | } 264 | } 265 | 266 | void SetKeyState(KeyCode a2, bool a3) 267 | { 268 | uint64_t input_manager = driver.read(global.unity_player + (0x17C1CD0 + (1 * 0x8))); 269 | 270 | unsigned __int64 v3; // r9 271 | __int64 v5; // rdx 272 | unsigned __int64 v6; // r10 273 | unsigned int v7; // ecx 274 | LONG v8; // eax 275 | __int64 v9; // rax 276 | __int64 v10; // rcx 277 | char v11; // r9 278 | int v12; // eax 279 | int result; // eax 280 | int flags; 281 | 282 | v3 = a2; 283 | v5 = driver.read(input_manager + (11 * 0x8)); 284 | v6 = v3 >> 5; 285 | v7 = v3 & 0x1F; 286 | v8 = driver.read(v5 + 4 * (v3 >> 5)); 287 | if (a3) 288 | { 289 | if (_bittest(&v8, v7)) 290 | goto LABEL_7; 291 | v9 = driver.read(input_manager + (15 * 0x8)); 292 | } 293 | else 294 | { 295 | if (!_bittest(&v8, v7)) 296 | goto LABEL_7; 297 | v9 = driver.read(input_manager + (19 * 0x8)); 298 | } 299 | flags = driver.read(v9 + 4 * v6); 300 | driver.write(v9 + 4 * v6, flags |= 1 << (v3 & 0x1F)); 301 | LABEL_7: 302 | v10 = driver.read(input_manager + (11 * 0x8)); 303 | v11 = v3 & 0x1F; 304 | v12 = driver.read(v10 + 4 * v6); 305 | if (a3) 306 | { 307 | result = v12 | (1 << v11); 308 | } 309 | else 310 | { 311 | result = v12 & ~(1 << v11); 312 | driver.write(v10 + 4 * v6, result); 313 | } 314 | } 315 | 316 | }*Unity; -------------------------------------------------------------------------------- /Header Files/XorStr.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 - 2021 Justas Masiulis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JM_XORSTR_HPP 18 | #define JM_XORSTR_HPP 19 | 20 | #if defined(_M_ARM64) || defined(__aarch64__) || defined(_M_ARM) || defined(__arm__) 21 | #include 22 | #elif defined(_M_X64) || defined(__amd64__) || defined(_M_IX86) || defined(__i386__) 23 | #include 24 | #else 25 | #error Unsupported platform 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #define xorstr(str) ::jm::xor_string([]() { return str; }, std::integral_constant{}, std::make_index_sequence<::jm::detail::_buffer_size()>{}) 34 | #define _(str) xorstr(str).crypt_get() 35 | 36 | #ifdef _MSC_VER 37 | #define XORSTR_FORCEINLINE __forceinline 38 | #else 39 | #define XORSTR_FORCEINLINE __attribute__((always_inline)) inline 40 | #endif 41 | 42 | namespace jm { 43 | 44 | namespace detail { 45 | 46 | template 47 | XORSTR_FORCEINLINE constexpr std::size_t _buffer_size() 48 | { 49 | return ((Size / 16) + (Size % 16 != 0)) * 2; 50 | } 51 | 52 | template 53 | XORSTR_FORCEINLINE constexpr std::uint32_t key4() noexcept 54 | { 55 | std::uint32_t value = Seed; 56 | for(char c : __TIME__) 57 | value = static_cast((value ^ c) * 86745805ull); 58 | return value; 59 | } 60 | 61 | template 62 | XORSTR_FORCEINLINE constexpr std::uint64_t key8() 63 | { 64 | constexpr auto first_part = key4<907864976496 + S>(); 65 | constexpr auto second_part = key4(); 66 | return (static_cast(first_part) << 32) | second_part; 67 | } 68 | 69 | // loads up to 8 characters of string into uint64 and xors it with the key 70 | template 71 | XORSTR_FORCEINLINE constexpr std::uint64_t 72 | load_xored_str8(std::uint64_t key, std::size_t idx, const CharT* str) noexcept 73 | { 74 | using cast_type = typename std::make_unsigned::type; 75 | constexpr auto value_size = sizeof(CharT); 76 | constexpr auto idx_offset = 8 / value_size; 77 | 78 | std::uint64_t value = key; 79 | for(std::size_t i = 0; i < idx_offset && i + idx * idx_offset < N; ++i) 80 | value ^= 81 | (std::uint64_t{ static_cast(str[i + idx * idx_offset]) } 82 | << ((i % idx_offset) * 8 * value_size)); 83 | 84 | return value; 85 | } 86 | 87 | // forces compiler to use registers instead of stuffing constants in rdata 88 | XORSTR_FORCEINLINE std::uint64_t load_from_reg(std::uint64_t value) noexcept 89 | { 90 | #if defined(__clang__) || defined(__GNUC__) 91 | asm("" : "=r"(value) : "0"(value) :); 92 | return value; 93 | #else 94 | volatile std::uint64_t reg = value; 95 | return reg; 96 | #endif 97 | } 98 | 99 | } // namespace detail 100 | 101 | template 102 | class xor_string; 103 | 104 | template 105 | class xor_string, std::index_sequence> { 106 | #ifndef JM_XORSTR_DISABLE_AVX_INTRINSICS 107 | constexpr static inline std::uint64_t alignment = ((Size > 16) ? 32 : 16); 108 | #else 109 | constexpr static inline std::uint64_t alignment = 16; 110 | #endif 111 | 112 | alignas(alignment) std::uint64_t _storage[sizeof...(Keys)]; 113 | 114 | public: 115 | using value_type = CharT; 116 | using size_type = std::size_t; 117 | using pointer = CharT*; 118 | using const_pointer = const CharT*; 119 | 120 | template 121 | XORSTR_FORCEINLINE xor_string(L l, std::integral_constant, std::index_sequence) noexcept 122 | : _storage{ ::jm::detail::load_from_reg((std::integral_constant(Keys, Indices, l())>::value))... } 123 | {} 124 | 125 | XORSTR_FORCEINLINE constexpr size_type size() const noexcept 126 | { 127 | return Size - 1; 128 | } 129 | 130 | XORSTR_FORCEINLINE void crypt() noexcept 131 | { 132 | // everything is inlined by hand because a certain compiler with a certain linker is _very_ slow 133 | #if defined(__clang__) 134 | alignas(alignment) 135 | std::uint64_t arr[]{ ::jm::detail::load_from_reg(Keys)... }; 136 | std::uint64_t* keys = 137 | (std::uint64_t*)::jm::detail::load_from_reg((std::uint64_t)arr); 138 | #else 139 | alignas(alignment) std::uint64_t keys[]{ ::jm::detail::load_from_reg(Keys)... }; 140 | #endif 141 | 142 | #if defined(_M_ARM64) || defined(__aarch64__) || defined(_M_ARM) || defined(__arm__) 143 | #if defined(__clang__) 144 | ((Indices >= sizeof(_storage) / 16 ? static_cast(0) : __builtin_neon_vst1q_v( 145 | reinterpret_cast(_storage) + Indices * 2, 146 | veorq_u64(__builtin_neon_vld1q_v(reinterpret_cast(_storage) + Indices * 2, 51), 147 | __builtin_neon_vld1q_v(reinterpret_cast(keys) + Indices * 2, 51)), 148 | 51)), ...); 149 | #else // GCC, MSVC 150 | ((Indices >= sizeof(_storage) / 16 ? static_cast(0) : vst1q_u64( 151 | reinterpret_cast(_storage) + Indices * 2, 152 | veorq_u64(vld1q_u64(reinterpret_cast(_storage) + Indices * 2), 153 | vld1q_u64(reinterpret_cast(keys) + Indices * 2)))), ...); 154 | #endif 155 | #elif !defined(JM_XORSTR_DISABLE_AVX_INTRINSICS) 156 | ((Indices >= sizeof(_storage) / 32 ? static_cast(0) : _mm256_store_si256( 157 | reinterpret_cast<__m256i*>(_storage) + Indices, 158 | _mm256_xor_si256( 159 | _mm256_load_si256(reinterpret_cast(_storage) + Indices), 160 | _mm256_load_si256(reinterpret_cast(keys) + Indices)))), ...); 161 | 162 | if constexpr(sizeof(_storage) % 32 != 0) 163 | _mm_store_si128( 164 | reinterpret_cast<__m128i*>(_storage + sizeof...(Keys) - 2), 165 | _mm_xor_si128(_mm_load_si128(reinterpret_cast(_storage + sizeof...(Keys) - 2)), 166 | _mm_load_si128(reinterpret_cast(keys + sizeof...(Keys) - 2)))); 167 | #else 168 | ((Indices >= sizeof(_storage) / 16 ? static_cast(0) : _mm_store_si128( 169 | reinterpret_cast<__m128i*>(_storage) + Indices, 170 | _mm_xor_si128(_mm_load_si128(reinterpret_cast(_storage) + Indices), 171 | _mm_load_si128(reinterpret_cast(keys) + Indices)))), ...); 172 | #endif 173 | } 174 | 175 | XORSTR_FORCEINLINE const_pointer get() const noexcept 176 | { 177 | return reinterpret_cast(_storage); 178 | } 179 | 180 | XORSTR_FORCEINLINE pointer get() noexcept 181 | { 182 | return reinterpret_cast(_storage); 183 | } 184 | 185 | XORSTR_FORCEINLINE pointer crypt_get() noexcept 186 | { 187 | // crypt() is inlined by hand because a certain compiler with a certain linker is _very_ slow 188 | #if defined(__clang__) 189 | alignas(alignment) 190 | std::uint64_t arr[]{ ::jm::detail::load_from_reg(Keys)... }; 191 | std::uint64_t* keys = 192 | (std::uint64_t*)::jm::detail::load_from_reg((std::uint64_t)arr); 193 | #else 194 | alignas(alignment) std::uint64_t keys[]{ ::jm::detail::load_from_reg(Keys)... }; 195 | #endif 196 | 197 | #if defined(_M_ARM64) || defined(__aarch64__) || defined(_M_ARM) || defined(__arm__) 198 | #if defined(__clang__) 199 | ((Indices >= sizeof(_storage) / 16 ? static_cast(0) : __builtin_neon_vst1q_v( 200 | reinterpret_cast(_storage) + Indices * 2, 201 | veorq_u64(__builtin_neon_vld1q_v(reinterpret_cast(_storage) + Indices * 2, 51), 202 | __builtin_neon_vld1q_v(reinterpret_cast(keys) + Indices * 2, 51)), 203 | 51)), ...); 204 | #else // GCC, MSVC 205 | ((Indices >= sizeof(_storage) / 16 ? static_cast(0) : vst1q_u64( 206 | reinterpret_cast(_storage) + Indices * 2, 207 | veorq_u64(vld1q_u64(reinterpret_cast(_storage) + Indices * 2), 208 | vld1q_u64(reinterpret_cast(keys) + Indices * 2)))), ...); 209 | #endif 210 | #elif !defined(JM_XORSTR_DISABLE_AVX_INTRINSICS) 211 | ((Indices >= sizeof(_storage) / 32 ? static_cast(0) : _mm256_store_si256( 212 | reinterpret_cast<__m256i*>(_storage) + Indices, 213 | _mm256_xor_si256( 214 | _mm256_load_si256(reinterpret_cast(_storage) + Indices), 215 | _mm256_load_si256(reinterpret_cast(keys) + Indices)))), ...); 216 | 217 | if constexpr(sizeof(_storage) % 32 != 0) 218 | _mm_store_si128( 219 | reinterpret_cast<__m128i*>(_storage + sizeof...(Keys) - 2), 220 | _mm_xor_si128(_mm_load_si128(reinterpret_cast(_storage + sizeof...(Keys) - 2)), 221 | _mm_load_si128(reinterpret_cast(keys + sizeof...(Keys) - 2)))); 222 | #else 223 | ((Indices >= sizeof(_storage) / 16 ? static_cast(0) : _mm_store_si128( 224 | reinterpret_cast<__m128i*>(_storage) + Indices, 225 | _mm_xor_si128(_mm_load_si128(reinterpret_cast(_storage) + Indices), 226 | _mm_load_si128(reinterpret_cast(keys) + Indices)))), ...); 227 | #endif 228 | 229 | return (pointer)(_storage); 230 | } 231 | }; 232 | 233 | template 234 | xor_string(L l, std::integral_constant, std::index_sequence) -> xor_string< 235 | std::remove_const_t>, 236 | Size, 237 | std::integer_sequence()...>, 238 | std::index_sequence>; 239 | 240 | } // namespace jm 241 | 242 | #endif // include guard 243 | -------------------------------------------------------------------------------- /vExample.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {49b3d1c7-1e28-45f4-99dd-95b175cfabba} 25 | vExample 26 | 10.0 27 | svchost 28 | 29 | 30 | 31 | Application 32 | true 33 | v143 34 | MultiByte 35 | 36 | 37 | Application 38 | false 39 | v143 40 | true 41 | MultiByte 42 | 43 | 44 | Application 45 | true 46 | v143 47 | MultiByte 48 | true 49 | 50 | 51 | Application 52 | false 53 | v143 54 | true 55 | MultiByte 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | true 77 | $(VLIB_PATH)includes;$(IncludePath) 78 | 79 | 80 | false 81 | $(VLIB_PATH)includes;$(IncludePath) 82 | 83 | 84 | true 85 | $(DXSDK_DIR)Include;$(IncludePath) 86 | $(VLIB_PATH)libs;$(DXSDK_DIR)Lib\x64;$(LibraryPath) 87 | 88 | 89 | false 90 | $(DXSDK_DIR)Include;$(IncludePath) 91 | $(VLIB_PATH)libs;$(DXSDK_DIR)Lib\x64;$(LibraryPath) 92 | 93 | 94 | 95 | Level3 96 | true 97 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 98 | true 99 | stdcpp17 100 | stdc17 101 | true 102 | MultiThreadedDebug 103 | 104 | 105 | Console 106 | true 107 | CheatManager.lib;ImGui.lib;Input.lib;libvoyager.lib;Log.lib;MemoryPool.lib;Overlay.lib;spdlog.lib;VDM.lib;vManager.lib;%(AdditionalDependencies) 108 | 109 | 110 | 111 | 112 | Level3 113 | true 114 | true 115 | true 116 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 117 | true 118 | stdcpp17 119 | stdc17 120 | true 121 | MultiThreaded 122 | 123 | 124 | Console 125 | true 126 | true 127 | true 128 | CheatManager.lib;ImGui.lib;Input.lib;libvoyager.lib;Log.lib;MemoryPool.lib;Overlay.lib;spdlog.lib;VDM.lib;vManager.lib;%(AdditionalDependencies) 129 | 130 | 131 | 132 | 133 | Level3 134 | true 135 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 136 | true 137 | stdcpp17 138 | stdc17 139 | true 140 | MultiThreadedDebug 141 | 142 | 143 | Console 144 | true 145 | CheatManager.lib;ImGui.lib;Input.lib;libvoyager.lib;Log.lib;MemoryPool.lib;Overlay.lib;spdlog.lib;VDM.lib;vManager.lib;%(AdditionalDependencies) 146 | 147 | 148 | 149 | 150 | Level3 151 | true 152 | true 153 | false 154 | NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) 155 | true 156 | stdcpp17 157 | stdc17 158 | true 159 | MultiThreaded 160 | MaxSpeed 161 | C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\km;$(ProjectDir)/Header Files;$(ProjectDir)/Overlay;$(ProjectDir)/Overlay/ImGui;$(ProjectDir)/Overlay/Resources;$(ProjectDir)/Sdk/Classes;$(ProjectDir)/Sdk/Features;$(ProjectDir)/Sdk/Unity;$(ProjectDir)/Threads;$(ProjectDir)/Memory;%(AdditionalIncludeDirectories) 162 | 163 | 164 | Console 165 | true 166 | true 167 | true 168 | Normaliz.lib;Ws2_32.lib;Wldap32.lib;Crypt32.lib;advapi32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;d3d11.lib;%(AdditionalDependencies) 169 | /FORCE:MULTIPLE /ignore:4006 /ignore:4099 /ignore:4088 %(AdditionalOptions) 170 | RequireAdministrator 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | -------------------------------------------------------------------------------- /Sdk/Classes/BaseMovement.hpp: -------------------------------------------------------------------------------- 1 | class BaseMovement 2 | { 3 | public: 4 | bool GetFlying() 5 | { 6 | if (!Utils::ValidPointer(reinterpret_cast(this))) return false; 7 | 8 | bool grounded = driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Grounded); 9 | bool climbing = ((driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Ladder) == 0) ? false : true); 10 | bool swimming = driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Swimming); 11 | 12 | printf("result %i grounded? %i climbing? %i swimming?\n", grounded, climbing, swimming); 13 | 14 | return (!grounded && !climbing && !swimming); 15 | } 16 | 17 | Vector3 GetTargetMovement() 18 | { 19 | if (!Utils::ValidPointer(reinterpret_cast(this))) return Vector3(0,0,0); 20 | 21 | return driver.read(reinterpret_cast(this) + Offsets::BaseMovement.TargetMovement); 22 | } 23 | 24 | void SetTargetMovement(Vector3 value) 25 | { 26 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 27 | 28 | driver.write(reinterpret_cast(this) + Offsets::BaseMovement.TargetMovement, value); 29 | } 30 | 31 | float GetRunning() 32 | { 33 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 34 | 35 | return driver.read(reinterpret_cast(this) + Offsets::BaseMovement.Running); 36 | } 37 | 38 | void SetRunning(float value) 39 | { 40 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 41 | 42 | driver.write(reinterpret_cast(this) + Offsets::BaseMovement.Running, value); 43 | } 44 | 45 | float GetDucking() 46 | { 47 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 48 | 49 | return driver.read(reinterpret_cast(this) + Offsets::BaseMovement.Ducking); 50 | } 51 | 52 | void SetDucking(bool toggle, float value) 53 | { 54 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 55 | 56 | driver.write(reinterpret_cast(this) + Offsets::BaseMovement.Ducking, value); 57 | } 58 | 59 | float GetCrawling() 60 | { 61 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 62 | 63 | return driver.read(reinterpret_cast(this) + Offsets::BaseMovement.Crawling); 64 | } 65 | 66 | //PlayerWalkMovement 67 | 68 | float GetCapsuleHeight() 69 | { 70 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 71 | 72 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.CapsuleHeight); 73 | } 74 | 75 | void SetCapsuleHeight(float value) 76 | { 77 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 78 | 79 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.CapsuleHeight, value); 80 | } 81 | 82 | float GetCapsuleCenter() 83 | { 84 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 85 | 86 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.CapsuleCenter); 87 | } 88 | 89 | void SetCapsuleCenter(float value) 90 | { 91 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 92 | 93 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.CapsuleCenter, value); 94 | } 95 | 96 | float GetGravityMultiplier() 97 | { 98 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 99 | 100 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.GravityMultiplier); 101 | } 102 | 103 | void SetGravityMultiplier(float value) 104 | { 105 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 106 | 107 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.GravityMultiplier, value); 108 | } 109 | 110 | float GetGravityMultiplierSwimming() 111 | { 112 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 113 | 114 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.GravityMultiplierSwimming); 115 | } 116 | 117 | void SetGravityMultiplierSwimming(float value) 118 | { 119 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 120 | 121 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.GravityMultiplierSwimming, value); 122 | } 123 | 124 | float GetMaxAngleWalking() 125 | { 126 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 127 | 128 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.MaxAngleWalking); 129 | } 130 | 131 | void SetMaxAngleWalking(float value) 132 | { 133 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 134 | 135 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.MaxAngleWalking, value); 136 | } 137 | 138 | float GetMaxAngleClimbing() 139 | { 140 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 141 | 142 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.MaxAngleClimbing); 143 | } 144 | 145 | void SetMaxAngleClimbing(float value) 146 | { 147 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 148 | 149 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.MaxAngleClimbing, value); 150 | } 151 | 152 | float GetMaxAngleSliding() 153 | { 154 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 155 | 156 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.MaxAngleSliding); 157 | } 158 | 159 | void SetMaxAngleSliding(float value) 160 | { 161 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 162 | 163 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.MaxAngleSliding, value); 164 | } 165 | 166 | float GetMaxStepHeight() 167 | { 168 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 169 | 170 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.MaxStepHeight); 171 | } 172 | 173 | void SetMaxStepHeight(float value) 174 | { 175 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 176 | 177 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.MaxStepHeight, value); 178 | } 179 | 180 | float GetMaxVelocity() 181 | { 182 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 183 | 184 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.MaxVelocity); 185 | } 186 | 187 | void SetMaxVelocity(float value) 188 | { 189 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 190 | 191 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.MaxVelocity, value); 192 | } 193 | 194 | float GetGroundAngle() 195 | { 196 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 197 | 198 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.GroundAngle); 199 | } 200 | 201 | void SetGroundAngle(float value) 202 | { 203 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 204 | 205 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.GroundAngle, value); 206 | } 207 | 208 | float GetGroundAngleNew() 209 | { 210 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 211 | 212 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.GroundAngleNew); 213 | } 214 | 215 | void SetGroundAngleNew(float value) 216 | { 217 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 218 | 219 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.GroundAngleNew, value); 220 | } 221 | 222 | float GetGroundTime() 223 | { 224 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 225 | 226 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.GroundTime); 227 | } 228 | 229 | void SetGroundTime(float value) 230 | { 231 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 232 | 233 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.GroundTime, value); 234 | } 235 | 236 | float GetJumpTime() 237 | { 238 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 239 | 240 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.JumpTime); 241 | } 242 | 243 | void SetJumpTime(float value) 244 | { 245 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 246 | 247 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.JumpTime, value); 248 | } 249 | 250 | float GetLandTime() 251 | { 252 | if (!Utils::ValidPointer(reinterpret_cast(this))) return -1.f; 253 | 254 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.LandTime); 255 | } 256 | 257 | void SetLandTime(float value) 258 | { 259 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 260 | 261 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.LandTime, value); 262 | } 263 | 264 | Vector3 GetPreviousPosition() 265 | { 266 | if (!Utils::ValidPointer(reinterpret_cast(this))) return Vector3(0,0,0); 267 | 268 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.PreviousPosition); 269 | } 270 | 271 | bool GetSprintForced() 272 | { 273 | if (!Utils::ValidPointer(reinterpret_cast(this))) return false; 274 | 275 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.SprintForced); 276 | } 277 | //0x14C 278 | void SetSprintForced(bool value) 279 | { 280 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 281 | 282 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.SprintForced, value); 283 | } 284 | 285 | void SetDuckedDelta(float value) 286 | { 287 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 288 | 289 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.ForcedDuckDelta, value); 290 | } 291 | 292 | bool GetGrounded() 293 | { 294 | if (!Utils::ValidPointer(reinterpret_cast(this))) return false; 295 | 296 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Grounded); 297 | } 298 | 299 | void SetGrounded(bool value) 300 | { 301 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 302 | 303 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Grounded, value); 304 | } 305 | 306 | bool GetClimbing() 307 | { 308 | if (!Utils::ValidPointer(reinterpret_cast(this))) return false; 309 | 310 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Climbing); 311 | } 312 | 313 | void SetClimbing(bool value) 314 | { 315 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 316 | 317 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Climbing, value); 318 | } 319 | 320 | bool GetSliding() 321 | { 322 | if (!Utils::ValidPointer(reinterpret_cast(this))) return false; 323 | 324 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Sliding); 325 | } 326 | 327 | void SetSliding(bool value) 328 | { 329 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 330 | 331 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Sliding, value); 332 | } 333 | 334 | bool GetSwimming() 335 | { 336 | if (!Utils::ValidPointer(reinterpret_cast(this))) return false; 337 | 338 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Swimming); 339 | } 340 | 341 | void SetSwimming(bool value) 342 | { 343 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 344 | 345 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Swimming, value); 346 | } 347 | 348 | bool GetJumping() 349 | { 350 | if (!Utils::ValidPointer(reinterpret_cast(this))) return false; 351 | 352 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Jumping); 353 | } 354 | 355 | void SetJumping(bool value) 356 | { 357 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 358 | 359 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Jumping, value); 360 | } 361 | 362 | bool GetFalling() 363 | { 364 | if (!Utils::ValidPointer(reinterpret_cast(this))) return false; 365 | 366 | return driver.read(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Falling); 367 | } 368 | 369 | void SetFalling(bool value) 370 | { 371 | if (!Utils::ValidPointer(reinterpret_cast(this))) return; 372 | 373 | driver.write(reinterpret_cast(this) + Offsets::PlayerWalkMovement.Falling, value); 374 | } 375 | }; -------------------------------------------------------------------------------- /Threads/Misc.cpp: -------------------------------------------------------------------------------- 1 | #include "Includes.hpp" 2 | 3 | int Misc() 4 | { 5 | std::mutex thread_lock; 6 | thread_lock.lock(); 7 | 8 | printf("[+] Thread 4 Started\n"); 9 | while (true) 10 | { 11 | Movement* movement = reinterpret_cast(players.local); 12 | Enviorment* enviorment = reinterpret_cast(players.local); 13 | 14 | weapon->WeaponHandler(); 15 | 16 | movement->SpiderMan(); 17 | movement->InfiniteJump(); 18 | movement->NoSway(); 19 | movement->UnlockAngles(); 20 | movement->FakeAdmin(); 21 | movement->FakeDuck(); 22 | movement->ShootWhileMounted(); 23 | Unity->IgnoreLayer(Layer::PlayerMovement, Layer::Water, global.walk_on_water); 24 | 25 | 26 | enviorment->ClearWater(); 27 | enviorment->TimeChanger(); 28 | enviorment->FovChanger(); 29 | enviorment->BrightNight(); 30 | enviorment->HandleAutoFarm(); 31 | enviorment->ChamsHandler(); 32 | 33 | try 34 | { 35 | if (global.save_config) 36 | { 37 | nlohmann::json json; 38 | 39 | /*------Aimbot------*/ 40 | json[_("AimbotEnabled")] = global.aimbot_enabled; 41 | json[_("AimbotKey")] = global.aimbot_key; 42 | json[_("SelectedAimbotBone")] = global.selected_aimbot_bone; 43 | json[_("AimbotBone")] = global.aimbot_bone; 44 | json[_("AimbotIngoreSleepers")] = global.aimbot_ingore_sleepers; 45 | json[_("AimbotIgnoreNpc")] = global.aimbot_ignore_npc; 46 | json[_("DrawFov")] = global.draw_fov; 47 | json[_("AimbotFov")] = global.aimbot_fov; 48 | json[_("MaxAimbotDistance")] = global.max_aimbot_distance; 49 | 50 | /*------Weapon------*/ 51 | json[_("NoRecoil")] = global.no_recoil; 52 | json[_("NoSpread")] = global.no_spread; 53 | json[_("ForceAutomatic")] = global.force_automatic; 54 | json[_("InstantEoka")] = global.instant_eoka; 55 | json[_("InstantCompound")] = global.instant_compound; 56 | 57 | /*------Movement------*/ 58 | json[_("SpiderMan")] = global.spider_man; 59 | json[_("InfiniteJump")] = global.infinite_jump; 60 | json[_("NoSway")] = global.no_sway; 61 | json[_("UnlockAngles")] = global.unlock_angles; 62 | json[_("FlyHack")] = global.fly_hack; 63 | json[_("FakeAdmin")] = global.fake_admin; 64 | json[_("FovChanger")] = global.fov_changer; 65 | json[_("Fov")] = global.fov; 66 | json[_("TimeChanger")] = global.time_changer; 67 | json[_("Current_time")] = global.current_time; 68 | json[_("ClearWater")] = global.clear_water; 69 | json[_("BrightNight")] = global.bright_night; 70 | 71 | /*------Player-Esp------*/ 72 | json[_("ShowPlayer")] = global.show_player; 73 | json[_("ShowPlayerName")] = global.show_player_name; 74 | json[_("ShowPlayerDistance")] = global.show_player_distance; 75 | json[_("ShowPlayerBox")] = global.show_player_box; 76 | json[_("PlayerBoxColor")] = (uintptr_t)global.player_box_color; 77 | json[_("PlayerNameColor")] = (uintptr_t)global.player_name_color; 78 | json[_("PlayerIgnoreNpc")] = global.player_ignore_npc; 79 | json[_("PlayerIgnoreSleeping")] = global.player_ignore_sleeping; 80 | json[_("MaxPlayerDistance")] = global.max_player_distance; 81 | 82 | /*------Resource-Esp------*/ 83 | json[_("ShowResource")] = global.show_resource; 84 | json[_("ShowResourceName")] = global.show_resource_name; 85 | json[_("ShowResourceDistance")] = global.show_resource_distance; 86 | json[_("MaxResourceDistance")] = global.max_resource_distance; 87 | json[_("ShowStone")] = global.show_stone; 88 | json[_("ShowMetal")] = global.show_metal; 89 | json[_("ShowSulfur")] = global.show_sulfur; 90 | json[_("ShowHemp")] = global.show_hemp; 91 | json[_("StoneColor")] = (uintptr_t)global.stone_color; 92 | json[_("MetalColor")] = (uintptr_t)global.metal_color; 93 | json[_("SulfurColor")] = (uintptr_t)global.sulfur_color; 94 | json[_("HempColor")] = (uintptr_t)global.hemp_color; 95 | 96 | /*------World_Esp------*/ 97 | json[_("show_world")] = global.show_world; 98 | json[_("show_world_name")] = global.show_world_name; 99 | json[_("show_world_distance")] = global.show_world_distance; 100 | json[_("max_world_distance")] = global.max_world_distance; 101 | json[_("show_stash")] = global.show_stash; 102 | json[_("show_crate_elite")] = global.show_crate_elite; 103 | json[_("show_create_military")] = global.show_create_military; 104 | json[_("show_crate")] = global.show_crate; 105 | json[_("show_airdrop")] = global.show_airdrop; 106 | json[_("show_locked_crate")] = global.show_locked_crate; 107 | json[_("show_auto_turret")] = global.show_auto_turret; 108 | json[_("show_flame_turret")] = global.show_flame_turret; 109 | json[_("show_shotgun_trap")] = global.show_shotgun_trap; 110 | json[_("show_corpse")] = global.show_corpse; 111 | json[_("stash_color")] = (uintptr_t)global.stash_color; 112 | json[_("crate_elite_color")] = (uintptr_t)global.crate_elite_color; 113 | json[_("crate_military_color")] = (uintptr_t)global.crate_military_color; 114 | json[_("crate_color")] = (uintptr_t)global.crate_color; 115 | json[_("airdrop_color")] = (uintptr_t)global.airdrop_color; 116 | json[_("locked_crate_color")] = (uintptr_t)global.locked_crate_color; 117 | json[_("auto_turret_color")] = (uintptr_t)global.auto_turret_color; 118 | json[_("flame_turret_color")] = (uintptr_t)global.flame_turret_color; 119 | json[_("shotgun_trap_color")] = (uintptr_t)global.shotgun_trap_color; 120 | json[_("corpse_color")] = (uintptr_t)global.corpse_color; 121 | 122 | /*------Item_Esp------*/ 123 | json[_("show_item")] = global.show_item; 124 | json[_("show_item_name")] = global.show_item_name; 125 | json[_("show_item_distance")] = global.show_item_distance; 126 | json[_("item_color")] = (uintptr_t)global.item_color; 127 | json[_("max_item_distance")] = global.max_item_distance; 128 | 129 | /*------Auto-Farm------*/ 130 | json[_("auto_farm")] = global.auto_farm; 131 | json[_("auto_farm_key")] = global.auto_farm_key; 132 | json[_("auto_farm_stone")] = global.auto_farm_stone; 133 | json[_("auto_farm_metal")] = global.auto_farm_metal; 134 | json[_("auto_farm_sulfur")] = global.auto_farm_sulfur; 135 | json[_("auto_farm_hemp")] = global.auto_farm_hemp; 136 | 137 | /*-----Settings-----*/ 138 | json[_("Vsync")] = global.vsync; 139 | json[_("LimitFps")] = global.limit_fps; 140 | json[_("TargetFps")] = global.target_fps; 141 | 142 | std::ofstream out(global.selected_config); 143 | out << std::setw(4) << json << std::endl; 144 | out.close(); 145 | 146 | global.save_config = false; 147 | } 148 | 149 | if (global.load_config) 150 | { 151 | if (global.selected_config == "") 152 | { 153 | printf("Failed\n"); 154 | global.load_config = false; 155 | continue; 156 | } 157 | 158 | std::ifstream ifstreammm(global.selected_config); 159 | nlohmann::json json_data = nlohmann::json::parse(ifstreammm); 160 | 161 | uintptr_t color; 162 | 163 | /*------Aimbot------*/ 164 | json_data[_("AimbotEnabled")].get_to(global.aimbot_enabled); 165 | json_data[_("AimbotKey")].get_to(global.aimbot_key); 166 | json_data[_("SelectedAimbotBone")].get_to(global.selected_aimbot_bone); 167 | json_data[_("AimbotBone")].get_to(global.aimbot_bone); 168 | json_data[_("AimbotIngoreSleepers")].get_to(global.aimbot_ingore_sleepers); 169 | json_data[_("AimbotIgnoreNpc")].get_to(global.aimbot_ignore_npc); 170 | json_data[_("DrawFov")].get_to(global.draw_fov); 171 | json_data[_("AimbotFov")].get_to(global.aimbot_fov); 172 | json_data[_("MaxAimbotDistance")].get_to(global.max_aimbot_distance); 173 | 174 | /*------Weapon------*/ 175 | json_data[_("NoRecoil")].get_to(global.no_recoil); 176 | json_data[_("NoSpread")].get_to(global.no_spread); 177 | json_data[_("ForceAutomatic")].get_to(global.force_automatic); 178 | json_data[_("InstantEoka")].get_to(global.instant_eoka); 179 | json_data[_("InstantCompound")].get_to(global.instant_compound); 180 | 181 | /*------Misc------*/ 182 | json_data[_("SpiderMan")].get_to(global.spider_man); 183 | json_data[_("InfiniteJump")].get_to(global.infinite_jump); 184 | json_data[_("NoSway")].get_to(global.no_sway); 185 | json_data[_("UnlockAngles")].get_to(global.unlock_angles); 186 | json_data[_("FlyHack")].get_to(global.fly_hack); 187 | json_data[_("FakeAdmin")].get_to(global.fake_admin); 188 | json_data[_("FovChanger")].get_to(global.fov_changer); 189 | json_data[_("Fov")].get_to(global.fov); 190 | json_data[_("TimeChanger")].get_to(global.time_changer); 191 | json_data[_("Current_time")].get_to(global.current_time); 192 | json_data[_("ClearWater")].get_to(global.clear_water); 193 | json_data[_("BrightNight")].get_to(global.bright_night); 194 | 195 | /*------Player-Esp------*/ 196 | json_data[_("ShowPlayer")].get_to(global.show_player); 197 | json_data[_("ShowPlayerName")].get_to(global.show_player_name); 198 | json_data[_("ShowPlayerDistance")].get_to(global.show_player_distance); 199 | json_data[_("ShowPlayerBox")].get_to(global.show_player_box); 200 | json_data[_("PlayerBoxColor")].get_to(color); global.player_box_color = (ImColor)color; 201 | json_data[_("PlayerNameColor")].get_to(color); global.player_name_color = (ImColor)color; 202 | json_data[_("PlayerIgnoreNpc")].get_to(global.player_ignore_npc); 203 | json_data[_("PlayerIgnoreSleeping")].get_to(global.player_ignore_sleeping); 204 | json_data[_("MaxPlayerDistance")].get_to(global.max_player_distance); 205 | 206 | /*------Resource-Esp------*/ 207 | json_data[_("ShowResource")].get_to(global.show_resource); 208 | json_data[_("ShowResourceName")].get_to(global.show_resource_name); 209 | json_data[_("ShowResourceDistance")].get_to(global.show_resource_distance); 210 | json_data[_("MaxResourceDistance")].get_to(global.max_resource_distance); 211 | json_data[_("ShowStone")].get_to(global.show_stone); 212 | json_data[_("ShowMetal")].get_to(global.show_metal); 213 | json_data[_("ShowSulfur")].get_to(global.show_sulfur); 214 | json_data[_("ShowHemp")].get_to(global.show_hemp); 215 | json_data[_("StoneColor")].get_to(color); global.stone_color = (ImColor)color; 216 | json_data[_("MetalColor")].get_to(color); global.metal_color = (ImColor)color; 217 | json_data[_("SulfurColor")].get_to(color); global.sulfur_color = (ImColor)color; 218 | json_data[_("HempColor")].get_to(color); global.hemp_color = (ImColor)color; 219 | 220 | /*------World_Esp------*/ 221 | json_data[_("show_world")].get_to(global.show_world); 222 | json_data[_("show_world_name")].get_to(global.show_world_name); 223 | json_data[_("show_world_distance")].get_to(global.show_world_distance); 224 | json_data[_("max_world_distance")].get_to(global.max_world_distance); 225 | json_data[_("show_stash")].get_to(global.show_stash); 226 | json_data[_("show_crate_elite")].get_to(global.show_crate_elite); 227 | json_data[_("show_create_military")].get_to(global.show_create_military); 228 | json_data[_("show_crate")].get_to(global.show_crate); 229 | json_data[_("show_airdrop")].get_to(global.show_airdrop); 230 | json_data[_("show_locked_crate")].get_to(global.show_locked_crate); 231 | json_data[_("show_auto_turret")].get_to(global.show_auto_turret); 232 | json_data[_("show_flame_turret")].get_to(global.show_flame_turret); 233 | json_data[_("show_shotgun_trap")].get_to(global.show_shotgun_trap); 234 | json_data[_("show_corpse")].get_to(global.show_corpse); 235 | json_data[_("stash_color")].get_to(color); global.stash_color = (ImColor)color; 236 | json_data[_("crate_elite_color")].get_to(color); global.crate_elite_color = (ImColor)color; 237 | json_data[_("crate_military_color")].get_to(color); global.crate_military_color = (ImColor)color; 238 | json_data[_("crate_color")].get_to(color); global.crate_color = (ImColor)color; 239 | json_data[_("airdrop_color")].get_to(color); global.airdrop_color = (ImColor)color; 240 | json_data[_("locked_crate_color")].get_to(color); global.locked_crate_color = (ImColor)color; 241 | json_data[_("auto_turret_color")].get_to(color); global.auto_turret_color = (ImColor)color; 242 | json_data[_("flame_turret_color")].get_to(color); global.flame_turret_color = (ImColor)color; 243 | json_data[_("shotgun_trap_color")].get_to(color); global.shotgun_trap_color = (ImColor)color; 244 | json_data[_("corpse_color")].get_to(color); global.corpse_color = (ImColor)color; 245 | 246 | /*------Item_Esp------*/ 247 | json_data[_("show_item")].get_to(global.show_item); 248 | json_data[_("show_item_name")].get_to(global.show_item_name); 249 | json_data[_("show_item_distance")].get_to(global.show_item_distance); 250 | json_data[_("item_color")].get_to(color); global.item_color = (ImColor)color; 251 | json_data[_("max_item_distance")].get_to(global.max_item_distance); 252 | 253 | /*------Auto-Farm------*/ 254 | json_data[_("auto_farm")].get_to(global.auto_farm); 255 | json_data[_("auto_farm_key")].get_to(global.auto_farm_key); 256 | json_data[_("auto_farm_stone")].get_to(global.auto_farm_stone); 257 | json_data[_("auto_farm_metal")].get_to(global.auto_farm_metal); 258 | json_data[_("auto_farm_sulfur")].get_to(global.auto_farm_sulfur); 259 | json_data[_("auto_farm_hemp")].get_to(global.auto_farm_hemp); 260 | 261 | /*-----Settings-----*/ 262 | json_data[_("Vsync")].get_to(global.vsync); 263 | json_data[_("LimitFps")].get_to(global.limit_fps); 264 | json_data[_("TargetFps")].get_to(global.target_fps); 265 | 266 | global.load_config = false; 267 | } 268 | } 269 | catch (...) 270 | { 271 | 272 | } 273 | 274 | std::this_thread::sleep_for(std::chrono::milliseconds(10)); 275 | } 276 | thread_lock.unlock(); 277 | return -1; 278 | } -------------------------------------------------------------------------------- /Overlay/Menu.hpp: -------------------------------------------------------------------------------- 1 | #define SPACING 25 2 | 3 | static const char* aimbot_bones[]{ (" Head"),(" Neck"),(" Chest"),(" Stomach"),(" Left Arm"),(" Left Leg"),(" Right Arm"),(" Right Leg") }; 4 | 5 | 6 | void Menu() 7 | { 8 | if (global.menu) 9 | { 10 | ImGui::SetNextWindowSize(ImVec2(800, 500), NULL); 11 | ImGui::Begin(_("Rust"), NULL, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoBackground); 12 | 13 | ImVec2 window_position = ImGui::GetWindowPos(); 14 | ImDrawList* draw = ImGui::GetBackgroundDrawList(); 15 | 16 | draw->AddImage((PVOID)global.Image, ImVec2(window_position.x, window_position.y), ImVec2(window_position.x + 800, window_position.y + 500)); 17 | 18 | ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(ImColor(200, 255, 0, 255))); 19 | ImGui::PushFont(global.title); 20 | ImGui::TextColored(ImColor(200, 255, 0, 255), _("Rust")); 21 | ImGui::PopFont(); 22 | 23 | ImGui::Dummy(ImVec2(0, SPACING)); 24 | ImGui::TextColored(ImColor(72, 72, 78, 255), _("Weapon")); 25 | ImGui::PushFont(global.medium); 26 | //if (ImGui::TabButton(_("Wepons"), ImVec2(160, 30), 1, global.current_tab, global.icons, AIMBOT_ICON)) global.current_tab = 1; 27 | if (ImGui::TabButton(_("Weapon"), ImVec2(160, 30), 2, global.current_tab, global.icons, AK_ICON)) global.current_tab = 2; 28 | ImGui::PopFont(); 29 | 30 | ImGui::Dummy(ImVec2(0, SPACING)); 31 | ImGui::TextColored(ImColor(72, 72, 78, 255), _("Visuals")); 32 | ImGui::PushFont(global.medium); 33 | if (ImGui::TabButton(_("Player"), ImVec2(160, 30), 3, global.current_tab, global.icons, PLAYER_ICON)) global.current_tab = 3; 34 | if (ImGui::TabButton(_("Resource"), ImVec2(160, 30), 4, global.current_tab, global.icons, LOOT_ICON)) global.current_tab = 4; 35 | if (ImGui::TabButton(_("Item"), ImVec2(160, 30), 5, global.current_tab, global.icons, EXIT_ICON)) global.current_tab = 5; 36 | ImGui::PopFont(); 37 | 38 | ImGui::Dummy(ImVec2(0, SPACING)); 39 | ImGui::TextColored(ImColor(72, 72, 78, 255), _("World")); 40 | ImGui::PushFont(global.medium); 41 | if (ImGui::TabButton(_("Misc"), ImVec2(160, 30), 6, global.current_tab, global.icons, MOVEMENT_ICON)) global.current_tab = 6; 42 | ImGui::PopFont(); 43 | 44 | ImGui::Dummy(ImVec2(0, SPACING)); 45 | ImGui::TextColored(ImColor(72, 72, 78, 255), _("Misc")); 46 | ImGui::PushFont(global.medium); 47 | if (ImGui::TabButton(_("Config"), ImVec2(160, 30), 7, global.current_tab, global.icons, SETTINGS_ICON)) global.current_tab = 7; 48 | ImGui::PopFont(); 49 | 50 | ImGui::Dummy(ImVec2(0, SPACING)); 51 | 52 | //draw->AddCircleFilled(ImVec2(window_position.x + 25, window_position.y + 465), 20, ImColor(0, 168, 243), 64); 53 | ImGui::Dummy(ImVec2(40, 0)); 54 | ImGui::SameLine(); 55 | //ImGui::TextColored(ImColor(72, 72, 78, 255), "Error"); 56 | ImGui::Dummy(ImVec2(40, 0)); 57 | ImGui::SameLine(); 58 | // ImGui::TextColored(ImColor(72, 72, 78, 255), "Error"); 59 | ImGui::PopStyleColor(); 60 | 61 | switch (global.current_tab) 62 | { 63 | case 1: 64 | ImGui::SetNextWindowPos(ImVec2(window_position.x + 190, window_position.y + 60), NULL); 65 | ImGui::BeginChild(_("##Aimbot_Tab"), ImVec2(250, 370), false, ImGuiWindowFlags_AlwaysUseWindowPadding); 66 | { 67 | ImGui::Checkbox2(_("Enabled"), &global.aimbot_enabled); 68 | ImGui::KeyBind(_("Aimbot Key "), ImVec2(250, 30), global.aimbot_key, global.aimbot_find_key); 69 | ImGui::Combo(_("Bone"), &global.selected_aimbot_bone, aimbot_bones, IM_ARRAYSIZE(aimbot_bones)); 70 | ImGui::Checkbox2(_("Ignore Npc"), &global.aimbot_ignore_npc); 71 | ImGui::Checkbox2(_("Ignore Sleeper"), &global.aimbot_ingore_sleepers); 72 | ImGui::Checkbox2(_("Draw Fov"), &global.draw_fov); 73 | if (global.draw_fov) 74 | { 75 | ImGui::SliderFloatCustom(_("Fov"), &global.aimbot_fov, 0.f, 1000.f); 76 | } 77 | ImGui::SliderFloatCustom(_("Max Distance"), &global.max_aimbot_distance, 0.f, 500.f); 78 | } 79 | ImGui::EndChild(); 80 | break; 81 | case 2: 82 | ImGui::SetNextWindowPos(ImVec2(window_position.x + 190, window_position.y + 60), NULL); 83 | ImGui::BeginChild(_("##Weapon_Tab"), ImVec2(250, 370), false, ImGuiWindowFlags_AlwaysUseWindowPadding); 84 | { 85 | ImGui::Checkbox2(_("No Recoil"), &global.no_recoil); 86 | ImGui::Checkbox2(_("No Spread"), &global.no_spread); 87 | // ImGui::Checkbox2(_("Force Automatic"), &global.force_automatic); 88 | //ImGui::Checkbox2(_("Instant Eoka"), &global.instant_eoka); 89 | //ImGui::Checkbox2(_("Instant Compound"), &global.instant_compound); 90 | } 91 | ImGui::EndChild(); 92 | break; 93 | case 3: 94 | ImGui::SetNextWindowPos(ImVec2(window_position.x + 190, window_position.y + 60), NULL); 95 | ImGui::BeginChild(_("##Player_Tab"), ImVec2(250, 370), false, ImGuiWindowFlags_AlwaysUseWindowPadding); 96 | { 97 | ImGui::Checkbox2(_("Enabled"), &global.show_player); 98 | ImGui::Checkbox2(_("Name"), &global.show_player_name); 99 | ImGui::Checkbox2(_("Distance"), &global.show_player_distance); 100 | ImGui::Checkbox2(_("Box"), &global.show_player_box); 101 | ImGui::Checkbox2(_("Hide Npc"), &global.player_ignore_npc); 102 | ImGui::Checkbox2(_("Hide Sleeping"), &global.player_ignore_sleeping); 103 | ImGui::ColorPicker(_("Box Color"), &global.player_box_color); 104 | ImGui::ColorPicker(_("Name Color"), &global.player_name_color); 105 | ImGui::SliderFloatCustom(_("Max Distance"), &global.max_player_distance, 0.f, 1000.f); 106 | } 107 | ImGui::EndChild(); 108 | ImGui::SetNextWindowPos(ImVec2(window_position.x + 500, window_position.y + 60), NULL); 109 | ImGui::BeginChild(_("##Chams_Tab"), ImVec2(250, 370), false, ImGuiWindowFlags_AlwaysUseWindowPadding); 110 | { 111 | if (ImGui::Button(_("Apply Chams"), ImVec2(230, 30))) 112 | { 113 | global.apply_chams = true; 114 | } 115 | ImGui::Dummy(ImVec2(0, 5)); 116 | ImGui::BeginChild(_("##Chams_Selection"), ImVec2(230, 300), true, NULL); 117 | { 118 | for (int i = 0; i < global.chams_materials.size(); i++) 119 | { 120 | if (ImGui::TabButton(global.chams_materials[i].second.c_str(), ImVec2(200, 30), i, global.selected_chams_tab, global.icons, PAPER_ICON)) 121 | { 122 | global.selected_chams_tab = i; 123 | global.selected_chams_material = global.chams_materials[i].first; 124 | } 125 | } 126 | } 127 | ImGui::EndChild(); 128 | } 129 | ImGui::EndChild(); 130 | break; 131 | case 4: 132 | ImGui::SetNextWindowPos(ImVec2(window_position.x + 190, window_position.y + 60), NULL); 133 | ImGui::BeginChild(_("##Resource_Tab"), ImVec2(250, 370), false, ImGuiWindowFlags_AlwaysUseWindowPadding); 134 | { 135 | ImGui::Checkbox2(_("Enabled"), &global.show_resource); 136 | ImGui::Checkbox2(_("Name"), &global.show_resource_name); 137 | ImGui::Checkbox2(_("Distance"), &global.show_resource_distance); 138 | ImGui::Checkbox2(_("Show Stone"), &global.show_stone); 139 | ImGui::Checkbox2(_("Show Metal"), &global.show_metal); 140 | ImGui::Checkbox2(_("Show Sulur"), &global.show_sulfur); 141 | ImGui::Checkbox2(_("Show Hemp"), &global.show_hemp); 142 | ImGui::ColorPicker(_("Stone Color"), &global.stone_color); 143 | ImGui::ColorPicker(_("Metal Color"), &global.metal_color); 144 | ImGui::ColorPicker(_("Sulfur Color"), &global.sulfur_color); 145 | ImGui::ColorPicker(_("Hemp Color"), &global.hemp_color); 146 | ImGui::SliderFloatCustom(_("Max Distance"), &global.max_resource_distance, 0.f, 500.f); 147 | } 148 | ImGui::EndChild(); 149 | ImGui::SetNextWindowPos(ImVec2(window_position.x + 500, window_position.y + 60), NULL); 150 | ImGui::BeginChild(_("##Item_Esp"), ImVec2(250, 370), false, ImGuiWindowFlags_AlwaysUseWindowPadding); 151 | { 152 | ImGui::Checkbox2(_("Enabled"), &global.show_item); 153 | ImGui::Checkbox2(_("Name"), &global.show_item_name); 154 | ImGui::Checkbox2(_("Distance"), &global.show_item_distance); 155 | ImGui::ColorPicker(_("Item Color"), &global.item_color); 156 | ImGui::SliderFloatCustom(_("Max Distance"), &global.max_item_distance, 0.f, 250.f); 157 | } 158 | ImGui::EndChild(); 159 | break; 160 | case 5: 161 | ImGui::SetNextWindowPos(ImVec2(window_position.x + 190, window_position.y + 60), NULL); 162 | ImGui::BeginChild(_("##World_Esp"), ImVec2(250, 370), false, ImGuiWindowFlags_AlwaysUseWindowPadding); 163 | { 164 | ImGui::Checkbox2(_("Enabled"), &global.show_world); 165 | ImGui::Checkbox2(_("Name"), &global.show_world_name); 166 | ImGui::Checkbox2(_("Distance"), &global.show_world_distance); 167 | ImGui::SliderFloatCustom(_("Max Distance"), &global.max_world_distance, 0.f, 250.f); 168 | 169 | ImGui::Checkbox2(_("Show Stash"), &global.show_stash); 170 | ImGui::Checkbox2(_("Show Elite Crate"), &global.show_crate_elite); 171 | ImGui::Checkbox2(_("Show Military Crate"), &global.show_create_military); 172 | ImGui::Checkbox2(_("Show Crate"), &global.show_crate); 173 | ImGui::Checkbox2(_("Show Airdrop"), &global.show_airdrop); 174 | ImGui::Checkbox2(_("Show Locked Crate"), &global.show_locked_crate); 175 | ImGui::Checkbox2(_("Show Auto-Turret"), &global.show_auto_turret); 176 | ImGui::Checkbox2(_("Show Flame-Turret"), &global.show_flame_turret); 177 | ImGui::Checkbox2(_("Show Shotgun-Trap"), &global.show_shotgun_trap); 178 | ImGui::Checkbox2(_("Show Corpse"), &global.show_corpse); 179 | } 180 | ImGui::EndChild(); 181 | ImGui::SetNextWindowPos(ImVec2(window_position.x + 500, window_position.y + 60), NULL); 182 | ImGui::BeginChild(_("##World_Color_Tab"), ImVec2(250, 370), false, ImGuiWindowFlags_AlwaysUseWindowPadding); 183 | { 184 | ImGui::ColorPicker(_("Stash Color"), &global.stash_color); 185 | ImGui::ColorPicker(_("Elite Crate Color"), &global.crate_elite_color); 186 | ImGui::ColorPicker(_("Military Crate Color"), &global.crate_military_color); 187 | ImGui::ColorPicker(_("Crate Color"), &global.crate_color); 188 | ImGui::ColorPicker(_("Airdrop Color"), &global.airdrop_color); 189 | ImGui::ColorPicker(_("Locked Crate Color"), &global.locked_crate_color); 190 | ImGui::ColorPicker(_("Auto-Turret Color"), &global.auto_turret_color); 191 | ImGui::ColorPicker(_("Flame-Turret Color"), &global.flame_turret_color); 192 | ImGui::ColorPicker(_("Shotgun-Trap Color"), &global.shotgun_trap_color); 193 | ImGui::ColorPicker(_("Corpse Color"), &global.corpse_color); 194 | } 195 | ImGui::EndChild(); 196 | break; 197 | case 6: 198 | ImGui::SetNextWindowPos(ImVec2(window_position.x + 190, window_position.y + 60), NULL); 199 | ImGui::BeginChild(_("##Movement_Tab"), ImVec2(250, 370), false, ImGuiWindowFlags_AlwaysUseWindowPadding); 200 | { 201 | ImGui::Checkbox2(_("SpiderMan"), &global.spider_man); 202 | //ImGui::Checkbox2(_("Infinite Jump"), &global.infinite_jump); 203 | // ImGui::Checkbox2(_("No Sway"), &global.no_sway); 204 | // ImGui::Checkbox2(_("Unlock Angles"), &global.unlock_angles); 205 | ImGui::Checkbox2(_("Fake Admin"), &global.fake_admin); 206 | //ImGui::Checkbox2(_("Clear Water"), &global.clear_water); 207 | //ImGui::Checkbox2(_("Walk On Water"), &global.walk_on_water); 208 | //ImGui::Checkbox2(_("Fake Duck"), &global.fake_duck); 209 | ImGui::Checkbox2(_("Fov Changer"), &global.fov_changer); 210 | if (global.fov_changer) 211 | { 212 | ImGui::SliderFloatCustom(_("Fov"), &global.fov, 0, 180);//fix 213 | } 214 | 215 | ImGui::Checkbox2(_("Time Changer"), &global.time_changer); 216 | if (global.time_changer) 217 | { 218 | ImGui::SliderFloatCustom(_("Time"), &global.current_time, -1, 24); 219 | } 220 | ImGui::Dummy(ImVec2(5, 5)); 221 | if (ImGui::Button("Bright Night", ImVec2(150, 30))) 222 | { 223 | global.bright_night = true; 224 | } 225 | } 226 | ImGui::EndChild(); 227 | ImGui::SetNextWindowPos(ImVec2(window_position.x + 500, window_position.y + 60), NULL); 228 | ImGui::BeginChild(_("##Auto_Farm"), ImVec2(250, 370), false, ImGuiWindowFlags_AlwaysUseWindowPadding); 229 | { 230 | ImGui::Checkbox2(_("AutoFarm"), &global.auto_farm); 231 | ImGui::KeyBind(_("Farm Keybind "), ImVec2(250, 30), global.auto_farm_key, global.auto_farm_find_key); 232 | 233 | ImGui::Checkbox2(_("Stone"), &global.auto_farm_stone); 234 | ImGui::Checkbox2(_("Metal"), &global.auto_farm_metal); 235 | ImGui::Checkbox2(_("Sulfur"), &global.auto_farm_sulfur); 236 | ImGui::Checkbox2(_("Hemp"), &global.auto_farm_hemp); 237 | } 238 | ImGui::EndChild(); 239 | break; 240 | case 7: 241 | ImGui::SetNextWindowPos(ImVec2(window_position.x + 190, window_position.y + 60), NULL); 242 | ImGui::BeginChild(_("##Config_Tab"), ImVec2(250, 370), false, ImGuiWindowFlags_AlwaysUseWindowPadding); 243 | { 244 | if (ImGui::Button(_("Load"), ImVec2(54, 25))) 245 | { 246 | global.load_config = true; 247 | } 248 | ImGui::SameLine(); 249 | if (ImGui::Button(_("Save"), ImVec2(54, 25))) 250 | { 251 | global.save_config = true; 252 | } 253 | ImGui::SameLine(); 254 | if (ImGui::Button(_("Create"), ImVec2(54, 25))) 255 | { 256 | std::ofstream file; 257 | std::string name = std::string(std::string(getenv(_("APPDATA")) + std::string(_("\\Amplitude-Rust\\Configs\\")) + std::string(global.config_buffer) + std::string(_(".json")))); 258 | file.open(name); 259 | } 260 | ImGui::SameLine(); 261 | if (ImGui::Button(_("Remove"), ImVec2(54, 25))) 262 | { 263 | remove(global.selected_config.c_str()); 264 | } 265 | ImGui::SetNextItemWidth(230); 266 | ImGui::InputText(_(" "), global.config_buffer, 255); 267 | ImGui::Dummy(ImVec2(0, 5)); 268 | ImGui::BeginChild(_("##Config2_Tab"), ImVec2(230, 300), true, NULL); 269 | { 270 | int i = 0; 271 | for (const auto& entry : std::filesystem::directory_iterator(std::string(getenv(_("APPDATA")) + std::string(_("\\Amplitude-Rust\\Configs"))))) 272 | { 273 | if (ImGui::TabButton(Utils::GetBasePath(entry.path().string()).c_str(), ImVec2(200, 30), Utils::StringToInt(entry.path().string()), Utils::StringToInt(global.selected_config), global.icons, PAPER_ICON)) 274 | { 275 | global.selected_config = entry.path().string(); 276 | } 277 | i++; 278 | } 279 | } 280 | ImGui::EndChild(); 281 | } 282 | ImGui::EndChild(); 283 | ImGui::SetNextWindowPos(ImVec2(window_position.x + 500, window_position.y + 60), NULL); 284 | ImGui::BeginChild(_("##Player2_Tab"), ImVec2(250, 370), false, ImGuiWindowFlags_AlwaysUseWindowPadding); 285 | { 286 | ImGui::Checkbox2(_("Vsync"), &global.vsync); 287 | ImGui::Checkbox2(_("Limit Fps"), &global.limit_fps); 288 | ImGui::SliderFloatCustom(_("Target Fps"), &global.target_fps, 0, 250); 289 | ImGui::Checkbox2(_("Debug Fps"), &global.show_debug_text); 290 | } 291 | ImGui::EndChild(); 292 | break; 293 | } 294 | 295 | ImGui::End(); 296 | } 297 | } -------------------------------------------------------------------------------- /Overlay/ImGui/imstb_rectpack.h: -------------------------------------------------------------------------------- 1 | // [DEAR IMGUI] 2 | // This is a slightly modified version of stb_rect_pack.h 1.01. 3 | // Grep for [DEAR IMGUI] to find the changes. 4 | // 5 | // stb_rect_pack.h - v1.01 - public domain - rectangle packing 6 | // Sean Barrett 2014 7 | // 8 | // Useful for e.g. packing rectangular textures into an atlas. 9 | // Does not do rotation. 10 | // 11 | // Before #including, 12 | // 13 | // #define STB_RECT_PACK_IMPLEMENTATION 14 | // 15 | // in the file that you want to have the implementation. 16 | // 17 | // Not necessarily the awesomest packing method, but better than 18 | // the totally naive one in stb_truetype (which is primarily what 19 | // this is meant to replace). 20 | // 21 | // Has only had a few tests run, may have issues. 22 | // 23 | // More docs to come. 24 | // 25 | // No memory allocations; uses qsort() and assert() from stdlib. 26 | // Can override those by defining STBRP_SORT and STBRP_ASSERT. 27 | // 28 | // This library currently uses the Skyline Bottom-Left algorithm. 29 | // 30 | // Please note: better rectangle packers are welcome! Please 31 | // implement them to the same API, but with a different init 32 | // function. 33 | // 34 | // Credits 35 | // 36 | // Library 37 | // Sean Barrett 38 | // Minor features 39 | // Martins Mozeiko 40 | // github:IntellectualKitty 41 | // 42 | // Bugfixes / warning fixes 43 | // Jeremy Jaussaud 44 | // Fabian Giesen 45 | // 46 | // Version history: 47 | // 48 | // 1.01 (2021-07-11) always use large rect mode, expose STBRP__MAXVAL in public section 49 | // 1.00 (2019-02-25) avoid small space waste; gracefully fail too-wide rectangles 50 | // 0.99 (2019-02-07) warning fixes 51 | // 0.11 (2017-03-03) return packing success/fail result 52 | // 0.10 (2016-10-25) remove cast-away-const to avoid warnings 53 | // 0.09 (2016-08-27) fix compiler warnings 54 | // 0.08 (2015-09-13) really fix bug with empty rects (w=0 or h=0) 55 | // 0.07 (2015-09-13) fix bug with empty rects (w=0 or h=0) 56 | // 0.06 (2015-04-15) added STBRP_SORT to allow replacing qsort 57 | // 0.05: added STBRP_ASSERT to allow replacing assert 58 | // 0.04: fixed minor bug in STBRP_LARGE_RECTS support 59 | // 0.01: initial release 60 | // 61 | // LICENSE 62 | // 63 | // See end of file for license information. 64 | 65 | ////////////////////////////////////////////////////////////////////////////// 66 | // 67 | // INCLUDE SECTION 68 | // 69 | 70 | #ifndef STB_INCLUDE_STB_RECT_PACK_H 71 | #define STB_INCLUDE_STB_RECT_PACK_H 72 | 73 | #define STB_RECT_PACK_VERSION 1 74 | 75 | #ifdef STBRP_STATIC 76 | #define STBRP_DEF static 77 | #else 78 | #define STBRP_DEF extern 79 | #endif 80 | 81 | #ifdef __cplusplus 82 | extern "C" { 83 | #endif 84 | 85 | typedef struct stbrp_context stbrp_context; 86 | typedef struct stbrp_node stbrp_node; 87 | typedef struct stbrp_rect stbrp_rect; 88 | 89 | typedef int stbrp_coord; 90 | 91 | #define STBRP__MAXVAL 0x7fffffff 92 | // Mostly for internal use, but this is the maximum supported coordinate value. 93 | 94 | STBRP_DEF int stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects); 95 | // Assign packed locations to rectangles. The rectangles are of type 96 | // 'stbrp_rect' defined below, stored in the array 'rects', and there 97 | // are 'num_rects' many of them. 98 | // 99 | // Rectangles which are successfully packed have the 'was_packed' flag 100 | // set to a non-zero value and 'x' and 'y' store the minimum location 101 | // on each axis (i.e. bottom-left in cartesian coordinates, top-left 102 | // if you imagine y increasing downwards). Rectangles which do not fit 103 | // have the 'was_packed' flag set to 0. 104 | // 105 | // You should not try to access the 'rects' array from another thread 106 | // while this function is running, as the function temporarily reorders 107 | // the array while it executes. 108 | // 109 | // To pack into another rectangle, you need to call stbrp_init_target 110 | // again. To continue packing into the same rectangle, you can call 111 | // this function again. Calling this multiple times with multiple rect 112 | // arrays will probably produce worse packing results than calling it 113 | // a single time with the full rectangle array, but the option is 114 | // available. 115 | // 116 | // The function returns 1 if all of the rectangles were successfully 117 | // packed and 0 otherwise. 118 | 119 | struct stbrp_rect 120 | { 121 | // reserved for your use: 122 | int id; 123 | 124 | // input: 125 | stbrp_coord w, h; 126 | 127 | // output: 128 | stbrp_coord x, y; 129 | int was_packed; // non-zero if valid packing 130 | 131 | }; // 16 bytes, nominally 132 | 133 | 134 | STBRP_DEF void stbrp_init_target (stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes); 135 | // Initialize a rectangle packer to: 136 | // pack a rectangle that is 'width' by 'height' in dimensions 137 | // using temporary storage provided by the array 'nodes', which is 'num_nodes' long 138 | // 139 | // You must call this function every time you start packing into a new target. 140 | // 141 | // There is no "shutdown" function. The 'nodes' memory must stay valid for 142 | // the following stbrp_pack_rects() call (or calls), but can be freed after 143 | // the call (or calls) finish. 144 | // 145 | // Note: to guarantee best results, either: 146 | // 1. make sure 'num_nodes' >= 'width' 147 | // or 2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1' 148 | // 149 | // If you don't do either of the above things, widths will be quantized to multiples 150 | // of small integers to guarantee the algorithm doesn't run out of temporary storage. 151 | // 152 | // If you do #2, then the non-quantized algorithm will be used, but the algorithm 153 | // may run out of temporary storage and be unable to pack some rectangles. 154 | 155 | STBRP_DEF void stbrp_setup_allow_out_of_mem (stbrp_context *context, int allow_out_of_mem); 156 | // Optionally call this function after init but before doing any packing to 157 | // change the handling of the out-of-temp-memory scenario, described above. 158 | // If you call init again, this will be reset to the default (false). 159 | 160 | 161 | STBRP_DEF void stbrp_setup_heuristic (stbrp_context *context, int heuristic); 162 | // Optionally select which packing heuristic the library should use. Different 163 | // heuristics will produce better/worse results for different data sets. 164 | // If you call init again, this will be reset to the default. 165 | 166 | enum 167 | { 168 | STBRP_HEURISTIC_Skyline_default=0, 169 | STBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default, 170 | STBRP_HEURISTIC_Skyline_BF_sortHeight 171 | }; 172 | 173 | 174 | ////////////////////////////////////////////////////////////////////////////// 175 | // 176 | // the details of the following structures don't matter to you, but they must 177 | // be visible so you can handle the memory allocations for them 178 | 179 | struct stbrp_node 180 | { 181 | stbrp_coord x,y; 182 | stbrp_node *next; 183 | }; 184 | 185 | struct stbrp_context 186 | { 187 | int width; 188 | int height; 189 | int align; 190 | int init_mode; 191 | int heuristic; 192 | int num_nodes; 193 | stbrp_node *active_head; 194 | stbrp_node *free_head; 195 | stbrp_node extra[2]; // we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2' 196 | }; 197 | 198 | #ifdef __cplusplus 199 | } 200 | #endif 201 | 202 | #endif 203 | 204 | ////////////////////////////////////////////////////////////////////////////// 205 | // 206 | // IMPLEMENTATION SECTION 207 | // 208 | 209 | #ifdef STB_RECT_PACK_IMPLEMENTATION 210 | #ifndef STBRP_SORT 211 | #include 212 | #define STBRP_SORT qsort 213 | #endif 214 | 215 | #ifndef STBRP_ASSERT 216 | #include 217 | #define STBRP_ASSERT assert 218 | #endif 219 | 220 | #ifdef _MSC_VER 221 | #define STBRP__NOTUSED(v) (void)(v) 222 | #define STBRP__CDECL __cdecl 223 | #else 224 | #define STBRP__NOTUSED(v) (void)sizeof(v) 225 | #define STBRP__CDECL 226 | #endif 227 | 228 | enum 229 | { 230 | STBRP__INIT_skyline = 1 231 | }; 232 | 233 | STBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic) 234 | { 235 | switch (context->init_mode) { 236 | case STBRP__INIT_skyline: 237 | STBRP_ASSERT(heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight || heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight); 238 | context->heuristic = heuristic; 239 | break; 240 | default: 241 | STBRP_ASSERT(0); 242 | } 243 | } 244 | 245 | STBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int allow_out_of_mem) 246 | { 247 | if (allow_out_of_mem) 248 | // if it's ok to run out of memory, then don't bother aligning them; 249 | // this gives better packing, but may fail due to OOM (even though 250 | // the rectangles easily fit). @TODO a smarter approach would be to only 251 | // quantize once we've hit OOM, then we could get rid of this parameter. 252 | context->align = 1; 253 | else { 254 | // if it's not ok to run out of memory, then quantize the widths 255 | // so that num_nodes is always enough nodes. 256 | // 257 | // I.e. num_nodes * align >= width 258 | // align >= width / num_nodes 259 | // align = ceil(width/num_nodes) 260 | 261 | context->align = (context->width + context->num_nodes-1) / context->num_nodes; 262 | } 263 | } 264 | 265 | STBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes) 266 | { 267 | int i; 268 | 269 | for (i=0; i < num_nodes-1; ++i) 270 | nodes[i].next = &nodes[i+1]; 271 | nodes[i].next = NULL; 272 | context->init_mode = STBRP__INIT_skyline; 273 | context->heuristic = STBRP_HEURISTIC_Skyline_default; 274 | context->free_head = &nodes[0]; 275 | context->active_head = &context->extra[0]; 276 | context->width = width; 277 | context->height = height; 278 | context->num_nodes = num_nodes; 279 | stbrp_setup_allow_out_of_mem(context, 0); 280 | 281 | // node 0 is the full width, node 1 is the sentinel (lets us not store width explicitly) 282 | context->extra[0].x = 0; 283 | context->extra[0].y = 0; 284 | context->extra[0].next = &context->extra[1]; 285 | context->extra[1].x = (stbrp_coord) width; 286 | context->extra[1].y = (1<<30); 287 | context->extra[1].next = NULL; 288 | } 289 | 290 | // find minimum y position if it starts at x1 291 | static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, int x0, int width, int *pwaste) 292 | { 293 | stbrp_node *node = first; 294 | int x1 = x0 + width; 295 | int min_y, visited_width, waste_area; 296 | 297 | STBRP__NOTUSED(c); 298 | 299 | STBRP_ASSERT(first->x <= x0); 300 | 301 | #if 0 302 | // skip in case we're past the node 303 | while (node->next->x <= x0) 304 | ++node; 305 | #else 306 | STBRP_ASSERT(node->next->x > x0); // we ended up handling this in the caller for efficiency 307 | #endif 308 | 309 | STBRP_ASSERT(node->x <= x0); 310 | 311 | min_y = 0; 312 | waste_area = 0; 313 | visited_width = 0; 314 | while (node->x < x1) { 315 | if (node->y > min_y) { 316 | // raise min_y higher. 317 | // we've accounted for all waste up to min_y, 318 | // but we'll now add more waste for everything we've visted 319 | waste_area += visited_width * (node->y - min_y); 320 | min_y = node->y; 321 | // the first time through, visited_width might be reduced 322 | if (node->x < x0) 323 | visited_width += node->next->x - x0; 324 | else 325 | visited_width += node->next->x - node->x; 326 | } else { 327 | // add waste area 328 | int under_width = node->next->x - node->x; 329 | if (under_width + visited_width > width) 330 | under_width = width - visited_width; 331 | waste_area += under_width * (min_y - node->y); 332 | visited_width += under_width; 333 | } 334 | node = node->next; 335 | } 336 | 337 | *pwaste = waste_area; 338 | return min_y; 339 | } 340 | 341 | typedef struct 342 | { 343 | int x,y; 344 | stbrp_node **prev_link; 345 | } stbrp__findresult; 346 | 347 | static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int width, int height) 348 | { 349 | int best_waste = (1<<30), best_x, best_y = (1 << 30); 350 | stbrp__findresult fr; 351 | stbrp_node **prev, *node, *tail, **best = NULL; 352 | 353 | // align to multiple of c->align 354 | width = (width + c->align - 1); 355 | width -= width % c->align; 356 | STBRP_ASSERT(width % c->align == 0); 357 | 358 | // if it can't possibly fit, bail immediately 359 | if (width > c->width || height > c->height) { 360 | fr.prev_link = NULL; 361 | fr.x = fr.y = 0; 362 | return fr; 363 | } 364 | 365 | node = c->active_head; 366 | prev = &c->active_head; 367 | while (node->x + width <= c->width) { 368 | int y,waste; 369 | y = stbrp__skyline_find_min_y(c, node, node->x, width, &waste); 370 | if (c->heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight) { // actually just want to test BL 371 | // bottom left 372 | if (y < best_y) { 373 | best_y = y; 374 | best = prev; 375 | } 376 | } else { 377 | // best-fit 378 | if (y + height <= c->height) { 379 | // can only use it if it first vertically 380 | if (y < best_y || (y == best_y && waste < best_waste)) { 381 | best_y = y; 382 | best_waste = waste; 383 | best = prev; 384 | } 385 | } 386 | } 387 | prev = &node->next; 388 | node = node->next; 389 | } 390 | 391 | best_x = (best == NULL) ? 0 : (*best)->x; 392 | 393 | // if doing best-fit (BF), we also have to try aligning right edge to each node position 394 | // 395 | // e.g, if fitting 396 | // 397 | // ____________________ 398 | // |____________________| 399 | // 400 | // into 401 | // 402 | // | | 403 | // | ____________| 404 | // |____________| 405 | // 406 | // then right-aligned reduces waste, but bottom-left BL is always chooses left-aligned 407 | // 408 | // This makes BF take about 2x the time 409 | 410 | if (c->heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight) { 411 | tail = c->active_head; 412 | node = c->active_head; 413 | prev = &c->active_head; 414 | // find first node that's admissible 415 | while (tail->x < width) 416 | tail = tail->next; 417 | while (tail) { 418 | int xpos = tail->x - width; 419 | int y,waste; 420 | STBRP_ASSERT(xpos >= 0); 421 | // find the left position that matches this 422 | while (node->next->x <= xpos) { 423 | prev = &node->next; 424 | node = node->next; 425 | } 426 | STBRP_ASSERT(node->next->x > xpos && node->x <= xpos); 427 | y = stbrp__skyline_find_min_y(c, node, xpos, width, &waste); 428 | if (y + height <= c->height) { 429 | if (y <= best_y) { 430 | if (y < best_y || waste < best_waste || (waste==best_waste && xpos < best_x)) { 431 | best_x = xpos; 432 | //STBRP_ASSERT(y <= best_y); [DEAR IMGUI] 433 | best_y = y; 434 | best_waste = waste; 435 | best = prev; 436 | } 437 | } 438 | } 439 | tail = tail->next; 440 | } 441 | } 442 | 443 | fr.prev_link = best; 444 | fr.x = best_x; 445 | fr.y = best_y; 446 | return fr; 447 | } 448 | 449 | static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, int width, int height) 450 | { 451 | // find best position according to heuristic 452 | stbrp__findresult res = stbrp__skyline_find_best_pos(context, width, height); 453 | stbrp_node *node, *cur; 454 | 455 | // bail if: 456 | // 1. it failed 457 | // 2. the best node doesn't fit (we don't always check this) 458 | // 3. we're out of memory 459 | if (res.prev_link == NULL || res.y + height > context->height || context->free_head == NULL) { 460 | res.prev_link = NULL; 461 | return res; 462 | } 463 | 464 | // on success, create new node 465 | node = context->free_head; 466 | node->x = (stbrp_coord) res.x; 467 | node->y = (stbrp_coord) (res.y + height); 468 | 469 | context->free_head = node->next; 470 | 471 | // insert the new node into the right starting point, and 472 | // let 'cur' point to the remaining nodes needing to be 473 | // stiched back in 474 | 475 | cur = *res.prev_link; 476 | if (cur->x < res.x) { 477 | // preserve the existing one, so start testing with the next one 478 | stbrp_node *next = cur->next; 479 | cur->next = node; 480 | cur = next; 481 | } else { 482 | *res.prev_link = node; 483 | } 484 | 485 | // from here, traverse cur and free the nodes, until we get to one 486 | // that shouldn't be freed 487 | while (cur->next && cur->next->x <= res.x + width) { 488 | stbrp_node *next = cur->next; 489 | // move the current node to the free list 490 | cur->next = context->free_head; 491 | context->free_head = cur; 492 | cur = next; 493 | } 494 | 495 | // stitch the list back in 496 | node->next = cur; 497 | 498 | if (cur->x < res.x + width) 499 | cur->x = (stbrp_coord) (res.x + width); 500 | 501 | #ifdef _DEBUG 502 | cur = context->active_head; 503 | while (cur->x < context->width) { 504 | STBRP_ASSERT(cur->x < cur->next->x); 505 | cur = cur->next; 506 | } 507 | STBRP_ASSERT(cur->next == NULL); 508 | 509 | { 510 | int count=0; 511 | cur = context->active_head; 512 | while (cur) { 513 | cur = cur->next; 514 | ++count; 515 | } 516 | cur = context->free_head; 517 | while (cur) { 518 | cur = cur->next; 519 | ++count; 520 | } 521 | STBRP_ASSERT(count == context->num_nodes+2); 522 | } 523 | #endif 524 | 525 | return res; 526 | } 527 | 528 | static int STBRP__CDECL rect_height_compare(const void *a, const void *b) 529 | { 530 | const stbrp_rect *p = (const stbrp_rect *) a; 531 | const stbrp_rect *q = (const stbrp_rect *) b; 532 | if (p->h > q->h) 533 | return -1; 534 | if (p->h < q->h) 535 | return 1; 536 | return (p->w > q->w) ? -1 : (p->w < q->w); 537 | } 538 | 539 | static int STBRP__CDECL rect_original_order(const void *a, const void *b) 540 | { 541 | const stbrp_rect *p = (const stbrp_rect *) a; 542 | const stbrp_rect *q = (const stbrp_rect *) b; 543 | return (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed); 544 | } 545 | 546 | STBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects) 547 | { 548 | int i, all_rects_packed = 1; 549 | 550 | // we use the 'was_packed' field internally to allow sorting/unsorting 551 | for (i=0; i < num_rects; ++i) { 552 | rects[i].was_packed = i; 553 | } 554 | 555 | // sort according to heuristic 556 | STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare); 557 | 558 | for (i=0; i < num_rects; ++i) { 559 | if (rects[i].w == 0 || rects[i].h == 0) { 560 | rects[i].x = rects[i].y = 0; // empty rect needs no space 561 | } else { 562 | stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h); 563 | if (fr.prev_link) { 564 | rects[i].x = (stbrp_coord) fr.x; 565 | rects[i].y = (stbrp_coord) fr.y; 566 | } else { 567 | rects[i].x = rects[i].y = STBRP__MAXVAL; 568 | } 569 | } 570 | } 571 | 572 | // unsort 573 | STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order); 574 | 575 | // set was_packed flags and all_rects_packed status 576 | for (i=0; i < num_rects; ++i) { 577 | rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL); 578 | if (!rects[i].was_packed) 579 | all_rects_packed = 0; 580 | } 581 | 582 | // return the all_rects_packed status 583 | return all_rects_packed; 584 | } 585 | #endif 586 | 587 | /* 588 | ------------------------------------------------------------------------------ 589 | This software is available under 2 licenses -- choose whichever you prefer. 590 | ------------------------------------------------------------------------------ 591 | ALTERNATIVE A - MIT License 592 | Copyright (c) 2017 Sean Barrett 593 | Permission is hereby granted, free of charge, to any person obtaining a copy of 594 | this software and associated documentation files (the "Software"), to deal in 595 | the Software without restriction, including without limitation the rights to 596 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 597 | of the Software, and to permit persons to whom the Software is furnished to do 598 | so, subject to the following conditions: 599 | The above copyright notice and this permission notice shall be included in all 600 | copies or substantial portions of the Software. 601 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 602 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 603 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 604 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 605 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 606 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 607 | SOFTWARE. 608 | ------------------------------------------------------------------------------ 609 | ALTERNATIVE B - Public Domain (www.unlicense.org) 610 | This is free and unencumbered software released into the public domain. 611 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute this 612 | software, either in source code form or as a compiled binary, for any purpose, 613 | commercial or non-commercial, and by any means. 614 | In jurisdictions that recognize copyright laws, the author or authors of this 615 | software dedicate any and all copyright interest in the software to the public 616 | domain. We make this dedication for the benefit of the public at large and to 617 | the detriment of our heirs and successors. We intend this dedication to be an 618 | overt act of relinquishment in perpetuity of all present and future rights to 619 | this software under copyright law. 620 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 621 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 622 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 623 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 624 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 625 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 626 | ------------------------------------------------------------------------------ 627 | */ 628 | --------------------------------------------------------------------------------