├── PubgDMA ├── PubgDMA │ ├── Misc │ │ ├── Pch │ │ │ ├── Pch.cpp │ │ │ └── Pch.h │ │ ├── CheatFunction.h │ │ ├── CheatFunction.cpp │ │ ├── Input.h │ │ ├── Vector.h │ │ ├── Vector.cpp │ │ └── Input.cpp │ ├── ESP │ │ ├── PlayerEsp.cpp │ │ └── PlayerEsp.h │ ├── SDK │ │ ├── ActorEntity.cpp │ │ ├── Camera.h │ │ ├── EngineStructs.h │ │ ├── Engine.h │ │ ├── ActorEntity.h │ │ ├── Camera.cpp │ │ └── Engine.cpp │ ├── PubgDMA.user │ ├── Graphics │ │ ├── Start Up │ │ │ ├── GUI.h │ │ │ ├── Init.h │ │ │ ├── Init.cpp │ │ │ └── GUI.cpp │ │ ├── Entities │ │ │ ├── TabController.h │ │ │ ├── Label.h │ │ │ ├── TabListBox.h │ │ │ ├── Tab.h │ │ │ ├── Button.h │ │ │ ├── TabListBox.cpp │ │ │ ├── Form.h │ │ │ ├── Label.cpp │ │ │ ├── TabController.cpp │ │ │ ├── ComboBox.h │ │ │ ├── DropDown.h │ │ │ ├── Toggle.h │ │ │ ├── TabListBoxController.h │ │ │ ├── ColourPicker.h │ │ │ ├── KeyBind.h │ │ │ ├── TextBox.h │ │ │ ├── Button.cpp │ │ │ ├── Entity.cpp │ │ │ ├── Entity.h │ │ │ ├── Tab.cpp │ │ │ ├── Slider.h │ │ │ ├── Toggle.cpp │ │ │ ├── Form.cpp │ │ │ ├── KeyBind.cpp │ │ │ ├── ColourPicker.cpp │ │ │ ├── DropDown.cpp │ │ │ ├── TabListBoxController.cpp │ │ │ └── ComboBox.cpp │ │ ├── Utility │ │ │ ├── Animation.h │ │ │ ├── Font.h │ │ │ ├── Animation.cpp │ │ │ ├── Colour.h │ │ │ ├── Font.cpp │ │ │ └── Colour.cpp │ │ ├── Graphics.h │ │ ├── Drawing.h │ │ └── Drawing.cpp │ ├── Memory │ │ ├── InputManager.h │ │ ├── Registry.cpp │ │ ├── Registry.h │ │ ├── InputManager.cpp │ │ └── Memory.h │ ├── PubgDMA.vcxproj.user │ ├── Config │ │ ├── ConfigUtilities.h │ │ ├── ConfigInstance.h │ │ ├── Overlay.h │ │ ├── PlayerConfig.h │ │ └── ConfigUtilities.cpp │ ├── Main.cpp │ ├── Globals.h │ ├── BattleBitDMA.vcxproj.filters │ ├── Security │ │ └── XorStr.h │ └── PubgDMA.vcxproj ├── Lib │ ├── vmm.lib │ ├── FTD3XX.lib │ └── leechcore.lib └── PubgDMA.sln └── README.md /PubgDMA/PubgDMA/Misc/Pch/Pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" -------------------------------------------------------------------------------- /PubgDMA/Lib/vmm.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TTLH20220429/PUBG_DMA/HEAD/PubgDMA/Lib/vmm.lib -------------------------------------------------------------------------------- /PubgDMA/Lib/FTD3XX.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TTLH20220429/PUBG_DMA/HEAD/PubgDMA/Lib/FTD3XX.lib -------------------------------------------------------------------------------- /PubgDMA/Lib/leechcore.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TTLH20220429/PUBG_DMA/HEAD/PubgDMA/Lib/leechcore.lib -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/ESP/PlayerEsp.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TTLH20220429/PUBG_DMA/HEAD/PubgDMA/PubgDMA/ESP/PlayerEsp.cpp -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/SDK/ActorEntity.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TTLH20220429/PUBG_DMA/HEAD/PubgDMA/PubgDMA/SDK/ActorEntity.cpp -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/ESP/PlayerEsp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | extern std::shared_ptr UpdatePlayers; 3 | extern void DrawPlayerEsp(); -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/SDK/Camera.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Engine.h" 3 | 4 | class Camera 5 | { 6 | public: 7 | static Vector2 WorldToScreen(MinimalViewInfo viewinfo, Vector3 world); 8 | }; -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/PubgDMA.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Start Up/GUI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | void CreateGUI(); 3 | void Render(); 4 | extern bool MenuOpen; 5 | extern int TabCount; 6 | extern D2D1::ColorF ColourPickerClipBoard; 7 | extern int KeyBindClipBoard; 8 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/TabController.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Entity.h" 3 | 4 | class TabController : public Container 5 | { 6 | public: 7 | TabController(); 8 | void Update(); 9 | void Draw(); 10 | }; 11 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Start Up/Init.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #pragma comment(lib, "d2d1.lib") 3 | #pragma comment(lib, "Dwrite") 4 | #pragma comment(lib, "windowscodecs.lib") 5 | 6 | void CleanD2D(); 7 | void InitD2D(HWND hWnd); 8 | void RenderFrame(); 9 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Memory/InputManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | #include "Registry.h" 4 | 5 | namespace Keyboard 6 | { 7 | bool InitKeyboard(); 8 | 9 | void UpdateKeys(); 10 | bool IsKeyDown(uint64_t virtual_key_code); 11 | }; 12 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Misc/CheatFunction.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | class CheatFunction 3 | { 4 | int MsSleep = 0; 5 | std::function Function; 6 | int LastExecution; 7 | public: 8 | CheatFunction(int time, std::functionfunc); 9 | void Execute(); 10 | }; -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/PubgDMA.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Config/ConfigUtilities.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ConfigInstance.h" 3 | void SaveConfig(const std::wstring& config); 4 | void LoadConfig(const std::wstring& config); 5 | std::vector GetAllConfigs(); 6 | extern ConfigInstances Configs; 7 | extern void SetUpConfig(); -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/Label.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Entity.h" 3 | 4 | class Label : public Entity 5 | { 6 | protected: 7 | bool Tabbed; 8 | public: 9 | Label(std::wstring name, float x, float y); 10 | void Update(); 11 | void Draw(); 12 | }; 13 | 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PUBG_DMA 2 | PUBG DMA esp cheat source code 3 | 4 | **HOW TO USE** 5 | 6 | You need a DMA device. 7 | 8 | HOME Hide Menu 9 | 10 | Just having fun 11 | 12 | [Link]:https://www.unknowncheats.me/forum/playerunknown-s-battlegrounds/667961-pubg-dma-cheat-source-code.html 13 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/TabListBox.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Entity.h" 3 | 4 | class TabListBox : public Container 5 | { 6 | protected: 7 | int* Selected; 8 | 9 | public: 10 | TabListBox(std::wstring name); 11 | int Index; 12 | void Update(); 13 | void Draw(); 14 | }; 15 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/Tab.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Entity.h" 3 | 4 | class Tab : public Container 5 | { 6 | protected: 7 | int Index; 8 | int* Selected; 9 | 10 | public: 11 | Tab(std::wstring name, float x, float y, int* selectedtab, float width = 0, float height = 0); 12 | void Update(); 13 | void Draw(); 14 | }; 15 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Utility/Animation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | float InOutSine(float t); 3 | 4 | template 5 | T Lerp(const T& start, const T& end, float t) 6 | { 7 | if (t < 0.0f) t = 0.0f; 8 | else if (t > 1.0f) t = 1.0f; 9 | 10 | return start + t * (end - start); 11 | } 12 | 13 | MyColour InterpolateColour(const MyColour& colour1, const MyColour& colour2, float progress); -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/Button.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Entity.h" 3 | 4 | class Button : public Entity 5 | { 6 | protected: 7 | std::function Action; 8 | void SetWidth(); 9 | 10 | public: 11 | Button(float x, float y, std::wstring text, std::function click); 12 | void SetSize(Vector2 size) { Button::Size = size; } 13 | void Update(); 14 | void Draw(); 15 | }; 16 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Misc/CheatFunction.cpp: -------------------------------------------------------------------------------- 1 | #include "Pch.h" 2 | #include "CheatFunction.h" 3 | 4 | CheatFunction::CheatFunction(int time, std::function func) 5 | { 6 | MsSleep = time; 7 | Function = func; 8 | } 9 | 10 | void CheatFunction::Execute() 11 | { 12 | 13 | if (GetTickCount64() - LastExecution > MsSleep) 14 | { 15 | Function(); 16 | LastExecution = GetTickCount64(); 17 | } 18 | } -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Graphics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef struct FontInformation 4 | { 5 | size_t size; 6 | IDWriteTextFormat* font; 7 | }; 8 | 9 | extern ID2D1Factory* Factory; 10 | extern ID2D1HwndRenderTarget* RenderTarget; 11 | extern IDWriteFactory* FontFactory; 12 | extern ID2D1SolidColorBrush* Brush; 13 | extern std::map Fonts; 14 | extern std::unordered_map TextLayouts; 15 | extern std::map TextCache; 16 | extern HWND Hwnd; 17 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Utility/Font.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Vector.h" 3 | 4 | enum FontAlignment 5 | { 6 | Left = 0, 7 | Centre = 1, 8 | Right = 2, 9 | CentreLeft = 3, 10 | CentreRight = 4, 11 | CentreCentre = 5, 12 | None = 6 13 | }; 14 | 15 | extern void CreateFonts(std::string customfontname, std::wstring_view fontname, float size, DWRITE_FONT_WEIGHT weight); 16 | extern Vector2 GetTextSize(std::wstring text, std::string font, size_t font_size = 0); 17 | extern size_t GetFontSize(std::string fontname); 18 | extern IDWriteTextFormat* GetFont(std::string fontname); 19 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Memory/Registry.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Registry.h" 3 | #include "Memory.h" 4 | 5 | std::string c_registry::QueryValue(const char* path, e_registry_type type) 6 | { 7 | BYTE buffer[0x128]; 8 | DWORD _type = (DWORD)type; 9 | DWORD size = sizeof(buffer); 10 | bool result = VMMDLL_WinReg_QueryValueExU(TargetProcess.vHandle, CC_TO_LPSTR(path), &_type, buffer, &size); 11 | if (!result) 12 | { 13 | LOG("[!] failed QueryValueExU call\n"); 14 | return ""; 15 | } 16 | std::wstring wstr = std::wstring((wchar_t*)buffer); 17 | return std::string(wstr.begin(), wstr.end()); 18 | } 19 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Utility/Animation.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Animation.h" 3 | 4 | float InOutSine(float t) 5 | { 6 | return -0.5f * (std::cos(3.14f * t) - 1.0f); 7 | } 8 | 9 | MyColour InterpolateColour(const MyColour& colour1, const MyColour& colour2, float progress) 10 | { 11 | float r = colour1.r + (colour2.r - colour1.r) * progress; 12 | float g = colour1.g + (colour2.g - colour1.g) * progress; 13 | float b = colour1.b + (colour2.b - colour1.b) * progress; 14 | 15 | return Colour(static_cast(r), static_cast(g), static_cast(b), static_cast(255)); 16 | } -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/TabListBox.cpp: -------------------------------------------------------------------------------- 1 | #include "Pch.h" 2 | #include "TabListBox.h" 3 | #include "GUI.h" 4 | #include "Input.h" 5 | #include "Drawing.h" 6 | #include "Font.h" 7 | #include "Graphics.h" 8 | 9 | TabListBox::TabListBox(std::wstring name) 10 | { 11 | TabListBox::Name = name; 12 | TabListBox::Index = TabCount; 13 | TabCount++; 14 | SetVisible(true); 15 | } 16 | 17 | void TabListBox::Update() 18 | { 19 | TabListBox::ParentPos = TabListBox::Parent->GetParentPos(); 20 | TabListBox::Pos = TabListBox::Parent->GetParentPos(); 21 | Container::Update(); 22 | } 23 | 24 | void TabListBox::Draw() 25 | { 26 | Container::Draw(); 27 | } 28 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Misc/Input.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | extern Vector2 MousePos; 4 | extern std::map Cursors; 5 | extern WPARAM Char; 6 | LRESULT CALLBACK InputWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 7 | 8 | bool IsKeyDown(int key); 9 | bool IsKeyClicked(int key); 10 | void SetInput(); 11 | bool IsMouseInRectangle(int x, int y, int width, int height); 12 | bool IsMouseInRectangle(Vector2 pos, Vector2 Dimensions); 13 | bool IsMouseInTriangle(Vector2 point1, Vector2 point2, Vector2 point3); 14 | 15 | void SetCurrentCursor(std::string name); 16 | void CreateCursor(std::string name, HCURSOR cursor); 17 | HCURSOR GetCurrentCursor(); 18 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/SDK/EngineStructs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // ScriptStruct CoreUObject.Vector 3 | struct UEVector { 4 | float X; // 0x0(0x8) 5 | float Y; // 0x8(0x8) 6 | float Z; // 0x10(0x8) 7 | }; 8 | // ScriptStruct CoreUObject.Rotator 9 | struct UERotator { 10 | float Pitch; // 0x0(0x8) 11 | float Yaw; // 0x8(0x8) 12 | float Roll; // 0x10(0x8) 13 | }; 14 | struct MinimalViewInfo 15 | { 16 | struct UEVector Location; // 0x0(0x18) 17 | struct UERotator Rotation; // 0x18(0x18) 18 | float FOV; // 0x30(0x4) 19 | }; 20 | struct CameraCacheEntry 21 | { 22 | float Timestamp; // 0x00(0x04) 23 | char pad_4[0xc]; // 0x04(0x0c) 24 | MinimalViewInfo POV; // 0x10(0x5e0) 25 | }; -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Config/ConfigInstance.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Pch.h" 3 | #include "PlayerConfig.h" 4 | #include "Overlay.h" 5 | class ConfigInstances 6 | { 7 | public: 8 | PlayerConfig Survivor = PlayerConfig(LIT("Survivor")); 9 | PlayerConfig Killer = PlayerConfig(LIT("Killer")); 10 | OverlayConfig Overlay = OverlayConfig(LIT("Overlay")); 11 | json ToJson() 12 | { 13 | json jsoned; 14 | jsoned.merge_patch(Survivor.ToJson()); 15 | jsoned.merge_patch(Overlay.ToJson()); 16 | jsoned.merge_patch(Killer.ToJson()); 17 | return jsoned; 18 | } 19 | 20 | void FromJson(json jsoned) 21 | { 22 | Survivor.FromJson(jsoned); 23 | Overlay.FromJson(jsoned); 24 | Killer.FromJson(jsoned); 25 | } 26 | }; -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/Form.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Entity.h" 3 | class Form : public Container 4 | { 5 | protected: 6 | bool Dragging; 7 | bool Stretching; 8 | bool CanStretch; 9 | bool CanMinimize; 10 | bool CanClose; 11 | 12 | float InitTime; 13 | 14 | Vector2 Drag; 15 | Vector2 Stretch; 16 | Vector2 Border; 17 | Vector2 TitleBar; 18 | 19 | Vector2 Cursor; 20 | 21 | Vector2 StretchPoint1; 22 | Vector2 StretchPoint2; 23 | Vector2 StretchPoint3; 24 | 25 | void DragAction(); 26 | void StretchAction(); 27 | 28 | public: 29 | Form(float x, float y, float w, float h, float borderwidth, float borderheight, std::wstring text, bool drag); 30 | void Draw(); 31 | void Update(); 32 | }; -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/Label.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Drawing.h" 3 | #include "label.h" 4 | 5 | Label::Label(std::wstring text, float posx, float posy) 6 | { 7 | Label::Pos = {posx, posy}; 8 | Label::Name = text; 9 | SetVisible(true); 10 | } 11 | 12 | void Label::Update() 13 | { 14 | if (!Label::Parent) 15 | Label::SetVisible(false); 16 | if (!Label::IsVisible()) 17 | return; 18 | Label::ParentPos = Label::Parent->GetParentPos(); 19 | } 20 | 21 | void Label::Draw() 22 | { 23 | if (!Label::Parent) 24 | Label::SetVisible(false); 25 | if (!Label::IsVisible()) 26 | return; 27 | 28 | MyColour textColour = MenuColours[LIT("Text")]; 29 | 30 | DrawText(Label::ParentPos.x + Label::Pos.x, Label::ParentPos.y + Label::Pos.y, Label::Name, LIT("Verdana"), 12, textColour, None); 31 | } 32 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/TabController.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "TabController.h" 3 | #include "Drawing.h" 4 | TabController::TabController() 5 | { 6 | TabController::SetVisible(true); 7 | } 8 | 9 | void TabController::Update() 10 | { 11 | if (!TabController::Parent) 12 | TabController::SetVisible(false); 13 | 14 | if (!TabController::IsVisible()) 15 | return; 16 | TabController::ParentPos = TabController::Parent->GetParentPos(); 17 | TabController::Pos.x = 0; 18 | TabController::Pos.y = 0; 19 | TabController::Size = {100, TabController::Parent->GetSize().y-30}; 20 | TabController::Container::Update(); 21 | } 22 | 23 | void TabController::Draw() 24 | { 25 | if (!TabController::IsVisible()) 26 | return; 27 | int size = TabController::Size.x / 12; 28 | 29 | TabController::Container::Draw(); 30 | } 31 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/ComboBox.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Entity.h" 3 | 4 | class ComboBox : public Entity 5 | { 6 | protected: 7 | float DropWidth; 8 | std::list Names; 9 | std::list Items; 10 | bool Active = false; 11 | std::wstring SelectedName; 12 | float TextWidth = 0; 13 | float CutOffBuffer = 0; 14 | float SizeDifference; 15 | 16 | int MaxVisibleItems = 5; 17 | 18 | int PointerStart = 0; 19 | int PointerEnd = MaxVisibleItems; 20 | 21 | void ConvertSelectedName(); 22 | void CalculateBuffer(); 23 | void SetComboBoxWidth(); 24 | void ArrowNavigation(); 25 | void UpdateScrollBar(); 26 | 27 | bool ScrollBarHeld = false; 28 | 29 | public: 30 | ComboBox(float x, float y, std::wstring text, std::list items, std::list names); 31 | void Update(); 32 | void Draw(); 33 | }; 34 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/DropDown.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Entity.h" 3 | class DropDown : public Entity 4 | { 5 | protected: 6 | float DropWidth; 7 | std::vectorNames; 8 | int* Index; 9 | bool Active = false; 10 | std::wstring SelectedName; 11 | float TextWidth = 0; 12 | float CutOffBuffer = 0; 13 | float SizeDifference; 14 | 15 | int MaxVisibleItems = 5; 16 | 17 | int PointerStart = 0; 18 | int PointerEnd = MaxVisibleItems; 19 | 20 | void ConvertSelectedName(); 21 | void CalculateBuffer(); 22 | void SetDropDownWidth(); 23 | void ArrowNavigation(); 24 | void UpdateScrollBar(); 25 | 26 | bool ScrollBar = false; 27 | 28 | 29 | public: 30 | DropDown(float x, float y, std::wstring text, int* items, std::vectornames); 31 | void Update(); 32 | void Draw(); 33 | }; 34 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/Toggle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Entity.h" 3 | 4 | class Toggle : public Entity 5 | { 6 | protected: 7 | bool* Data; 8 | bool Tabbed = false; 9 | std::chrono::time_point LastUpdateTime; 10 | Vector2 TextSize = Vector2(0, 0); 11 | MyColour RectangleColour; 12 | const float ClickedAnimationDuration = 0.09; // Duration of the size change animation in seconds 13 | float ClickedAnimationProgress = 0.0; 14 | const float FadeAnimationDuration = 1.8; // Duration of the color alpha change animation in seconds 15 | float FadeAnimationProgress = 0.0; 16 | float ClickedSize = 0; 17 | const float HoverAnimationDuration = 0.3; // Duration of the color change animation in seconds 18 | float HoverAnimationProgress = 0.0; 19 | 20 | 21 | public: 22 | Toggle(float x, float y, std::wstring text, bool* data); 23 | void Update(); 24 | void Draw(); 25 | }; 26 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/TabListBoxController.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Entity.h" 3 | #include "TabListBox.h" 4 | 5 | class TabListBoxController : public Container 6 | { 7 | protected: 8 | std::list> Tabs; 9 | std::list Names; 10 | std::list CulledNames; 11 | int ScrollWidth = 5; 12 | int Selected; 13 | bool ScrollBarHeld = false; 14 | bool Active = false; 15 | 16 | void UpdateCulledNames(); 17 | void ArrowKeyNavigation(); 18 | void ScrollBarAction(); 19 | void SetActiveIndex(); 20 | void SetActive(); 21 | int PointerStart = 2; 22 | int PointerEnd; 23 | int MaxVisibleItems = TabListBoxController::Size.y / 20; 24 | int ActiveIndex = 0; 25 | int CachedHeight; 26 | 27 | bool FirstItem = false; 28 | 29 | public: 30 | TabListBoxController(float x, float y, float width, float height); 31 | void Update(); 32 | void Draw(); 33 | void PushBack(std::shared_ptr tab); 34 | int GetActiveIndex(); 35 | }; 36 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/SDK/Engine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ActorEntity.h" 3 | #include "EngineStructs.h" 4 | // For these offsets just 7 dumper the game and open Engine_Classes 5 | class Engine 6 | { 7 | 8 | private: 9 | uint64_t OwningActor; 10 | int MaxPacket; 11 | int localTempId; 12 | CameraCacheEntry CameraEntry; // ScriptStruct Engine.CameraCacheEntry 13 | MinimalViewInfo CameraViewInfo; // ScriptStruct Engine.MinimalViewInfo 14 | std::vector> Actors; 15 | 16 | uint64_t UWorld, CurrentLevel, GameInstance, LocalPlayers, PlayerController, AcknowledgedPawn, PlayerCameraManager, GNames; 17 | 18 | public: 19 | Engine(); 20 | inline bool InitDecrypt(uint64_t offset); 21 | void Cache(); 22 | void UpdatePlayers(); 23 | std::vector> GetActors(); 24 | CameraCacheEntry GetCameraCache(); 25 | void RefreshViewMatrix(VMMDLL_SCATTER_HANDLE handle); 26 | uint64_t GetActorSize(); 27 | uintptr_t xe_decrypt(const uintptr_t encrypted); 28 | DWORD DecryptCIndex(DWORD Encrypted); 29 | void GetGNames(); 30 | std::string GetNames(DWORD ID); 31 | }; -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Memory/Registry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | 4 | enum class e_registry_type 5 | { 6 | none = REG_NONE, 7 | sz = REG_SZ, 8 | expand_sz = REG_EXPAND_SZ, 9 | binary = REG_BINARY, 10 | dword = REG_DWORD, 11 | dword_little_endian = REG_DWORD_LITTLE_ENDIAN, 12 | dword_big_endian = REG_DWORD_BIG_ENDIAN, 13 | link = REG_LINK, 14 | multi_sz = REG_MULTI_SZ, 15 | resource_list = REG_RESOURCE_LIST, 16 | full_resource_descriptor = REG_FULL_RESOURCE_DESCRIPTOR, 17 | resource_requirements_list = REG_RESOURCE_REQUIREMENTS_LIST, 18 | qword = REG_QWORD, 19 | qword_little_endian = REG_QWORD_LITTLE_ENDIAN 20 | }; 21 | 22 | inline const char* LPWSTR_TO_CC(LPWSTR in) 23 | { 24 | char buffer[500]; 25 | wcstombs(buffer, in, 500); 26 | 27 | return buffer; 28 | } 29 | 30 | inline LPSTR CC_TO_LPSTR(const char* in) 31 | { 32 | LPSTR out = new char[strlen(in) + 1]; 33 | strcpy_s(out, strlen(in) + 1, in); 34 | 35 | return out; 36 | } 37 | 38 | class c_registry 39 | { 40 | private: 41 | public: 42 | c_registry() 43 | { 44 | } 45 | 46 | ~c_registry() 47 | { 48 | } 49 | 50 | std::string QueryValue(const char* path, e_registry_type type); 51 | }; 52 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/ColourPicker.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Entity.h" 3 | 4 | class ColourPicker : public Entity 5 | { 6 | protected: 7 | Vector2 ClickedPos; 8 | D2D1::ColorF BaseColour = Colour(0, 0, 0, 0); 9 | D2D1::ColorF* MainColour = &BaseColour; 10 | D2D1::ColorF* RangeColour = &BaseColour; 11 | D2D1::ColorF* SelectedColour = &BaseColour; 12 | Vector2 SelectedPos; 13 | 14 | float Saturation = 255; 15 | float Brightness = 255; 16 | bool HeldSaturation = false; 17 | 18 | float Hue = 360; 19 | bool HeldHue = false; 20 | 21 | bool HeldAlpha = false; 22 | float Alpha = 255; 23 | 24 | bool ContextActive = false; 25 | Vector2 ContextPos; 26 | Vector2 ContextSize; 27 | void ContextMenu(); 28 | void Copy(); 29 | void Paste(); 30 | std::map> ContextNames = { 31 | {L"Copy", [this]() { Copy(); }}, 32 | {L"Paste", [this]() { Paste(); }} 33 | }; 34 | 35 | bool Open = false; 36 | static float HueToSliderValue(float hue); 37 | static float SliderValueToHue(float slidervalue); 38 | static float AlphaToSliderValue(float alpha); 39 | static float SaturationToSliderValue(float saturation); 40 | 41 | public: 42 | ColourPicker(float x, float y, D2D1::ColorF* colour); 43 | void Update(); 44 | void Draw(); 45 | }; 46 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/KeyBind.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Entity.h" 3 | class KeyBind : public Entity 4 | { 5 | protected: 6 | int* Key; 7 | void CollectInput(); 8 | std::wstring KeyName; 9 | bool Active = false; 10 | void ConvertKeyToName(); 11 | 12 | bool ContextActive = false; 13 | Vector2 ContextPos; 14 | Vector2 ContextSize; 15 | void ContextMenu(); 16 | void Copy(); 17 | void Paste(); 18 | std::map> ContextNames = { 19 | { L"Copy", [this]() { Copy(); } }, 20 | { L"Paste", [this]() { Paste(); } } 21 | }; 22 | 23 | std::map SymbolKeys = { {VK_LEFT,L"Left"},{VK_RIGHT,L"Right"},{VK_UP,L"Up"},{VK_DOWN,L"Down"},{VK_LWIN,L"Win"},{VK_RWIN,L"Win"} 24 | ,{VK_RWIN,L"Win"} ,{VK_DELETE,L"Delete"} ,{VK_INSERT,L"Insert"},{VK_END,L"End"},{VK_HOME,L"Home"},{VK_NEXT,L"Pg Up"},{VK_DOWN,L"Pg Down"} 25 | ,{VK_NUMLOCK,L"Num Lock"} ,{VK_DIVIDE,L"Num /"},{VK_LBUTTON,L"Mouse 1"},{VK_RBUTTON,L"Mouse 2"},{VK_MBUTTON,L"Mid Mouse"},{VK_XBUTTON1,L"Mouse 4"},{VK_XBUTTON2,L"Mouse5"} 26 | ,{VK_MENU,L"Alt"},{VK_RMENU,L"Right Alt"} ,{VK_LMENU,L"Left Alt"} }; 27 | public: 28 | KeyBind(float x, float y, std::wstring text, int* key); 29 | void Update(); 30 | void Draw(); 31 | }; 32 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Drawing.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | void DrawText(int x, int y, std::wstring text, std::string font, int fontsize, MyColour colour, FontAlignment alignment); 3 | void OutlineCircle(int x, int y, float radius, float linewidth, MyColour colour); 4 | void FilledCircle(int x, int y, float radius, MyColour colour); 5 | void OutlineRectangle(int x, int y, int width, int height, int linewidth, MyColour colour); 6 | void FilledRectangle(int x, int y, int width, int height, MyColour colour); 7 | void OutlineRoundedRectangle(int x, int y, int width, int height, int linewidth, int rounding, MyColour colour); 8 | void FilledRoundedRectangle(int x, int y, int width, int height, int rounding, MyColour colour); 9 | void FilledLine(int xstart, int ystart, int xend, int yend, int width, MyColour colour); 10 | void FilledLineAliased(int xstart, int ystart, int xend, int yend, int width, MyColour colour); 11 | void DrawBitmap(ID2D1Bitmap* bmp, int x, int y, int width, int height); 12 | void DrawBitmap(ID2D1Bitmap* bmp, int x, int y); 13 | void SaturationSlider(int x, int y, int width, int height, MyColour colour); 14 | void AlphaSlider(int x, int y, int width, int height, MyColour col); 15 | void HueSlider(int x, int y, int width, int height); 16 | void FilledTriangle(int x1, int y1, int x2, int y2, int x3, int y3, MyColour colour); 17 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Utility/Colour.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | D2D1::ColorF Colour(UINT8 R, UINT8 G, UINT8 B, UINT8 A = 255); 3 | 4 | //Fuck you Microsoft for not having a default constructor that will work for mappy map :( 5 | //should by default work even if you just passthrough D2D1 Color to it (: 6 | struct MyColour 7 | { 8 | float r, g, b, a; 9 | MyColour() = default; 10 | 11 | MyColour(float r, float g, float b, float a = 1.f) : r(r), g(g), b(b), a(a) 12 | { 13 | } 14 | 15 | MyColour(int r, int g, int b, int a = 255) : r(static_cast(r) / 255.0f), g(static_cast(g) / 255.0f), b(static_cast(b) / 255.0f), a(static_cast(a) / 255.0f) 16 | { 17 | } 18 | 19 | MyColour(D2D1::ColorF col) : r(col.r), g(col.g), b(col.b), a(col.a) 20 | { 21 | } 22 | 23 | MyColour Modify(float r, float g, float b, float a) 24 | { 25 | return MyColour(r, g, b, a); 26 | } 27 | 28 | /*Convert to d2d*/ 29 | D2D1::ColorF Get() { return D2D1::ColorF(r, g, b, a); } 30 | }; 31 | 32 | struct HsvColour 33 | { 34 | float H; 35 | float S; 36 | float V; 37 | }; 38 | 39 | extern std::map MenuColours; 40 | 41 | D2D1::ColorF HueToRGB(float hue); 42 | float RGBToHue(float r, float g, float b); 43 | D2D1::ColorF HsvToRgb(float hue, float saturation, float value, float alpha); 44 | HsvColour RgbToHsv(float r, float g, float b); 45 | void SetColour(std::string name, D2D1::ColorF col); 46 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Misc/Vector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | class Vector2 3 | { 4 | public: 5 | Vector2(); 6 | Vector2(float _x, float _y); 7 | ~Vector2(); 8 | 9 | float x, y; 10 | 11 | Vector2 operator *(Vector2 a); 12 | Vector2 operator /(Vector2 a); 13 | Vector2 operator +(Vector2 a); 14 | Vector2 operator -(Vector2 a); 15 | bool operator ==(Vector2 a); 16 | bool operator !=(Vector2 a); 17 | 18 | bool IsZero() const; 19 | 20 | static Vector2 Zero(); 21 | 22 | static float Distance(Vector2 a, Vector2 b); 23 | }; 24 | 25 | class Vector3 26 | { 27 | public: 28 | Vector3(); 29 | Vector3(float _x, float _y, float _z); 30 | ~Vector3(); 31 | 32 | float x, y, z; 33 | 34 | Vector3 operator *(Vector3 a); 35 | Vector3 operator *(float f); 36 | Vector3 operator /(Vector3 a); 37 | Vector3 operator /(float f); 38 | Vector3 operator +(Vector3 a); 39 | Vector3 operator -(Vector3 a); 40 | bool operator ==(Vector3 a); 41 | bool operator !=(Vector3 a); 42 | 43 | bool IsZero() const; 44 | 45 | static float Dot(Vector3 left, Vector3 right); 46 | static float Distance(Vector3 a, Vector3 b); 47 | static int FormattedDistance(Vector3 a, Vector3 b); 48 | static Vector3 Zero(); 49 | static Vector3 Lerp(Vector3 a, Vector3 b, float t); 50 | 51 | float Length() const; 52 | float LengthSqr() const; 53 | 54 | Vector3 Clamp() const; 55 | }; 56 | 57 | struct ViewMatrix 58 | { 59 | public: 60 | float matrix[4][4]; 61 | 62 | Vector3 Transform(const Vector3 vector) const; 63 | }; 64 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.7.34003.232 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PubgDMA", "PubgDMA\PubgDMA.vcxproj", "{8CBA9E6C-73A9-49D7-AAFD-AD74FF639CAD}" 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 | {8CBA9E6C-73A9-49D7-AAFD-AD74FF639CAD}.Debug|x64.ActiveCfg = Debug|x64 17 | {8CBA9E6C-73A9-49D7-AAFD-AD74FF639CAD}.Debug|x64.Build.0 = Debug|x64 18 | {8CBA9E6C-73A9-49D7-AAFD-AD74FF639CAD}.Debug|x86.ActiveCfg = Debug|Win32 19 | {8CBA9E6C-73A9-49D7-AAFD-AD74FF639CAD}.Debug|x86.Build.0 = Debug|Win32 20 | {8CBA9E6C-73A9-49D7-AAFD-AD74FF639CAD}.Release|x64.ActiveCfg = Release|x64 21 | {8CBA9E6C-73A9-49D7-AAFD-AD74FF639CAD}.Release|x64.Build.0 = Release|x64 22 | {8CBA9E6C-73A9-49D7-AAFD-AD74FF639CAD}.Release|x86.ActiveCfg = Release|Win32 23 | {8CBA9E6C-73A9-49D7-AAFD-AD74FF639CAD}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {1DB9EA1C-37A1-43E7-970A-B78020A9EE4C} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/TextBox.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Entity.h" 3 | 4 | class TextBox : public Entity 5 | { 6 | protected: 7 | std::chrono::time_point AnimationStart; 8 | float AnimationInterval = 1.0f; 9 | 10 | std::chrono::time_point SelectingAnimationStart; 11 | float SelectingAnimationInterval = 0.005f; 12 | 13 | int SelectedPoint; 14 | float SelectedPosition; 15 | 16 | int SelectionStart; 17 | int SelectionEnd; 18 | float SelectingStartPosition = 0; 19 | float SelectingEndPosition = 0; 20 | 21 | int VisiblePointerStart; 22 | int VisiblePointerEnd; 23 | void SetStartIndex(); 24 | 25 | bool hide_text = false; 26 | 27 | std::wstring* MainString; 28 | std::wstring VisibleString; 29 | 30 | float TextWidth = 0; 31 | 32 | bool ContextActive = false; 33 | Vector2 ContextPos; 34 | Vector2 ContextSize; 35 | void ContextCopyText(); 36 | void ContextSelectAll(); 37 | void ContextPasteText(); 38 | std::map> ContextNames = { 39 | {L"Select All", [this]() { ContextSelectAll(); }}, 40 | {L"Copy", [this]() { ContextCopyText(); }}, 41 | {L"Paste", [this]() { ContextPasteText(); }} 42 | }; 43 | 44 | bool Active = false; 45 | bool Selecting = false; 46 | bool Held = false; 47 | 48 | bool IsKeyAcceptable(); 49 | 50 | void SetState(); 51 | void ArrowKeyNavition(); 52 | void InputText(); 53 | void DeleteText(); 54 | void SetSelectionPoint(); 55 | void SelectionDragging(); 56 | void CopyText(); 57 | void PasteText(); 58 | void ContextMenu(); 59 | void SetSelection(); 60 | 61 | public: 62 | TextBox(float x, float y, std::wstring text, std::wstring* data, bool hide = false); 63 | void Update(); 64 | void Draw(); 65 | bool IsTabbed; 66 | }; 67 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Config/Overlay.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | class OverlayConfig 4 | { 5 | std::string ConfigName; 6 | 7 | public: 8 | OverlayConfig(const std::string& name) 9 | { 10 | ConfigName = name; 11 | } 12 | bool OverrideResolution = false; 13 | int Width = 1920; 14 | int Height = 1080; 15 | void ToJsonColour(json* j, const std::string& name, D2D1::ColorF* colour) 16 | { 17 | (*j)[ConfigName][name][LIT("r")] = colour->r; 18 | (*j)[ConfigName][name][LIT("g")] = colour->g; 19 | (*j)[ConfigName][name][LIT("b")] = colour->b; 20 | (*j)[ConfigName][name][LIT("a")] = colour->a; 21 | 22 | } 23 | void FromJsonColour(json j, const std::string& name, D2D1::ColorF* colour) 24 | { 25 | if (j[ConfigName].contains(name)) 26 | { 27 | colour->r = j[ConfigName][name][LIT("r")]; 28 | colour->g = j[ConfigName][name][LIT("g")]; 29 | colour->b = j[ConfigName][name][LIT("b")]; 30 | colour->a = j[ConfigName][name][LIT("a")]; 31 | } 32 | } 33 | 34 | json ToJson() 35 | { 36 | json j; 37 | j[ConfigName][LIT("OverrideResolution")] = OverrideResolution; 38 | j[ConfigName][LIT("Width")] = Width; 39 | j[ConfigName][LIT("Height")] = Height; 40 | 41 | return j; 42 | } 43 | void FromJson(const json& j) 44 | { 45 | if (!j.contains(ConfigName)) 46 | return; 47 | if (j[ConfigName].contains(LIT("OverrideResolution"))) 48 | OverrideResolution = j[ConfigName][LIT("OverrideResolution")]; 49 | if (j[ConfigName].contains(LIT("Width"))) 50 | Width = j[ConfigName][LIT("Width")]; 51 | if (j[ConfigName].contains(LIT("Height"))) 52 | Height = j[ConfigName][LIT("Height")]; 53 | } 54 | }; 55 | 56 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Misc/Pch/Pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #define _CRT_SECURE_NO_WARNINGS 3 | #define NOMINMAX 4 | #define _WINSOCK_DEPRECATED_NO_WARNINGS 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 | #include 26 | #include 27 | #include 28 | 29 | #ifdef DrawText 30 | #undef DrawText 31 | #endif 32 | #ifdef GetCurrentTime 33 | #undef GetCurrentTime 34 | #endif 35 | #ifdef GetObject 36 | #undef GetObject 37 | #endif 38 | #ifdef SendMessage 39 | #undef SendMessage 40 | #endif 41 | #ifdef GetUserName 42 | #undef GetUserName 43 | #endif 44 | #ifdef CreateFont 45 | #undef CreateFont 46 | #endif 47 | #ifdef Button 48 | #undef Button 49 | #endif 50 | #ifdef max 51 | #undef max 52 | #endif 53 | #ifdef min 54 | #undef min 55 | #endif 56 | #include 57 | #define DEBUG_INFO 58 | #ifdef DEBUG_INFO 59 | #define LOG(fmt, ...) std::printf(fmt, ##__VA_ARGS__) 60 | #define LOGW(fmt, ...) std::wprintf(fmt, ##__VA_ARGS__) 61 | #else 62 | #define LOG 63 | #define LOGW 64 | #endif 65 | #include "json.hpp" 66 | using json = nlohmann::json; 67 | #pragma comment(lib, "ws2_32.lib") 68 | #pragma comment(lib, "vmm.lib") 69 | #pragma comment(lib, "leechcore.lib") 70 | #pragma comment(lib, "FTD3XX.lib") 71 | #pragma comment(lib, "d2d1.lib") 72 | #pragma comment(lib, "Dwrite") 73 | #pragma comment(lib, "windowscodecs.lib") 74 | #include "Vector.h" 75 | #include "Input.h" 76 | #include "Colour.h" 77 | #include "Graphics.h" 78 | #include "font.h" 79 | #include "XorStr.h" 80 | #include "Memory.h" 81 | #include "CheatFunction.h" -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Config/PlayerConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | class PlayerConfig 4 | { 5 | std::string ConfigName; 6 | 7 | public: 8 | PlayerConfig(const std::string& name) 9 | { 10 | ConfigName = name; 11 | } 12 | bool Name = true; 13 | bool Distance = true; 14 | int MaxDistance = 1000; 15 | D2D1::ColorF TextColour = Colour(255, 255, 255); 16 | int FontSize = 11; 17 | void ToJsonColour(json* j, const std::string& name, D2D1::ColorF* colour) 18 | { 19 | (*j)[ConfigName][name][LIT("r")] = colour->r; 20 | (*j)[ConfigName][name][LIT("g")] = colour->g; 21 | (*j)[ConfigName][name][LIT("b")] = colour->b; 22 | (*j)[ConfigName][name][LIT("a")] = colour->a; 23 | 24 | } 25 | void FromJsonColour(json j, const std::string& name, D2D1::ColorF* colour) 26 | { 27 | if (j[ConfigName].contains(name)) 28 | { 29 | colour->r = j[ConfigName][name][LIT("r")]; 30 | colour->g = j[ConfigName][name][LIT("g")]; 31 | colour->b = j[ConfigName][name][LIT("b")]; 32 | colour->a = j[ConfigName][name][LIT("a")]; 33 | } 34 | } 35 | 36 | json ToJson() 37 | { 38 | json j; 39 | j[ConfigName][LIT("Name")] = Name; 40 | j[ConfigName][LIT("FontSize")] = FontSize; 41 | j[ConfigName][LIT("MaxDistance")] = MaxDistance; 42 | ToJsonColour(&j, LIT("TextColour"), &TextColour); 43 | 44 | return j; 45 | } 46 | void FromJson(const json& j) 47 | { 48 | if (!j.contains(ConfigName)) 49 | return; 50 | if (j[ConfigName].contains(LIT("Name"))) 51 | Name = j[ConfigName][LIT("Name")]; 52 | if (j[ConfigName].contains(LIT("Distance"))) 53 | Distance = j[ConfigName][LIT("Distance")]; 54 | if (j[ConfigName].contains(LIT("FontSize"))) 55 | FontSize = j[ConfigName][LIT("FontSize")]; 56 | if (j[ConfigName].contains(LIT("MaxDistance"))) 57 | MaxDistance = j[ConfigName][LIT("MaxDistance")]; 58 | FromJsonColour(j, LIT("TextColour"), &TextColour); 59 | } 60 | }; 61 | 62 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/Button.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Input.h" 3 | #include "Drawing.h" 4 | #include "Button.h" 5 | #include "Font.h"; 6 | #include "Graphics.h" 7 | 8 | Button::Button(float x, float y, std::wstring text, std::function click) 9 | { 10 | Button::Name = text; 11 | Button::Pos = {x, y}; 12 | Button::Size = {70, 20}; 13 | Button::Action = click; 14 | Button::SetWidth(); 15 | SetVisible(true); 16 | } 17 | 18 | void Button::SetWidth() 19 | { 20 | Button::Size.x = GetTextSize(Button::Name, LIT("Verdana"), 11).x + 20; 21 | } 22 | 23 | void Button::Update() 24 | { 25 | if (!Button::Parent) 26 | Button::SetVisible(false); 27 | if (!Button::IsVisible()) 28 | return; 29 | 30 | Button::ParentPos = Button::Parent->GetParentPos(); 31 | if (!Button::Blocked) 32 | { 33 | if (IsMouseInRectangle(Button::Pos + ParentPos, Button::Size) && IsKeyClicked(VK_LBUTTON) && Button::LastClick < (clock() * 0.00001f)) 34 | { 35 | Button::Action(); 36 | Button::LastClick = (clock() * 0.00001f) + 0.002f; 37 | } 38 | } 39 | } 40 | 41 | void Button::Draw() 42 | { 43 | if (!Button::Parent) 44 | Button::SetVisible(false); 45 | if (!Button::IsVisible()) 46 | return; 47 | 48 | MyColour rectColour = MenuColours[LIT("Button")]; 49 | MyColour rectOutlineColour = MenuColours[LIT("ButtonOutline")]; 50 | MyColour textColour = MenuColours[LIT("Text")]; 51 | 52 | //if is hovering color 53 | if (IsMouseInRectangle(Button::Pos + ParentPos, Button::Size)) 54 | { 55 | rectColour = MenuColours[LIT("ButtonHover")]; 56 | textColour = MenuColours[LIT("TextHover")]; 57 | if (IsKeyDown(VK_LBUTTON)) 58 | { 59 | rectColour = MenuColours[LIT("ButtonActive")]; 60 | } 61 | } 62 | 63 | OutlineRectangle(ParentPos.x + Pos.x, ParentPos.y + Pos.y, Size.x + 1, Size.y + 1, 1, rectColour); 64 | FilledRectangle(ParentPos.x + Button::Pos.x, ParentPos.y + Button::Pos.y, Button::Size.x, Button::Size.y, rectOutlineColour); 65 | DrawText(ParentPos.x + Button::Pos.x + (Button::Size.x / 2), ParentPos.y + Button::Pos.y + (Button::Size.y / 2), Button::Name, LIT("Verdana"), 12, textColour, CentreCentre); 66 | } 67 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Utility/Font.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Font.h" 3 | 4 | std::map Fonts; 5 | std::unordered_map TextLayouts; 6 | 7 | void CreateFonts(std::string customfontname, std::wstring_view fontname, float size, DWRITE_FONT_WEIGHT weight) 8 | { 9 | IDWriteTextFormat* text_format; 10 | 11 | std::string fontnamestr(fontname.begin(), fontname.end()); 12 | if (Fonts.find(fontnamestr) == Fonts.end()) 13 | { 14 | HRESULT result = FontFactory->CreateTextFormat( 15 | fontname.data(), 16 | nullptr, 17 | weight, 18 | DWRITE_FONT_STYLE_NORMAL, 19 | DWRITE_FONT_STRETCH_NORMAL, 20 | size, 21 | L"", 22 | &text_format 23 | ); 24 | 25 | if (SUCCEEDED(result)) 26 | { 27 | Fonts[customfontname].size = size; 28 | Fonts[customfontname].font = text_format; 29 | } 30 | } 31 | } 32 | 33 | Vector2 GetTextSize(std::wstring text, std::string font, size_t font_size) 34 | { 35 | IDWriteTextLayout* layout; 36 | 37 | if (text.empty()) 38 | return Vector2(0, 0); 39 | //If font size is 0, use default font size 40 | if (font_size == 0) 41 | font_size = Fonts[font].size; 42 | //Caching text layouts for performance improvements 43 | if (TextLayouts.find(text) == TextLayouts.end()) 44 | { 45 | HRESULT hr = FontFactory->CreateTextLayout( 46 | text.data(), 47 | static_cast(text.length()), 48 | Fonts[font].font, 49 | 4096, 50 | 4096, 51 | &layout 52 | ); 53 | 54 | if (SUCCEEDED(hr)) 55 | TextLayouts[text] = layout; 56 | else 57 | return Vector2(0, 0); 58 | } 59 | else 60 | layout = TextLayouts[text]; 61 | 62 | DWRITE_TEXT_RANGE range = DWRITE_TEXT_RANGE(); 63 | range.length = text.length(); 64 | range.startPosition = 0; 65 | layout->SetFontSize(font_size, range); 66 | DWRITE_TEXT_METRICS metrics; 67 | if (SUCCEEDED(layout->GetMetrics(&metrics))) 68 | return Vector2(metrics.widthIncludingTrailingWhitespace, metrics.height); 69 | return Vector2(0, 0); 70 | } 71 | 72 | IDWriteTextFormat* GetFont(std::string fontname) 73 | { 74 | return Fonts[fontname].font; 75 | } 76 | 77 | size_t GetFontSize(std::string fontname) 78 | { 79 | return Fonts[fontname].size; 80 | } 81 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/SDK/ActorEntity.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "EngineStructs.h" 3 | enum class EPlayerRole: uint8_t 4 | { 5 | EPlayerRole__VE_None = 0, 6 | EPlayerRole__VE_Slasher = 1, 7 | EPlayerRole__VE_Camper = 2, 8 | EPlayerRole__VE_Observer = 3, 9 | EPlayerRole__Max = 4, 10 | EPlayerRole__EPlayerRole_MAX = 5 11 | }; 12 | 13 | struct Index 14 | { 15 | int Head, 16 | neck, 17 | pelvis, 18 | Lshoulder, 19 | Lelbow, 20 | Lhand, 21 | Rshoulder, 22 | Relbow, 23 | Rhand; 24 | int Lbuttock, 25 | Lknee, 26 | Lfoot, 27 | Rbuttock, 28 | Rknee, 29 | Rfoot; 30 | }; 31 | 32 | class FMatrix 33 | { 34 | public: 35 | float _11, _12, _13, _14; 36 | float _21, _22, _23, _24; 37 | float _31, _32, _33, _34; 38 | float _41, _42, _43, _44; 39 | float m[4][4]; 40 | FMatrix MatrixMultiplication(const FMatrix& other); 41 | }; 42 | struct FQuat 43 | { 44 | float X; 45 | float Y; 46 | float Z; 47 | float W; 48 | }; 49 | struct FTransform 50 | { 51 | FQuat Rotation; 52 | FQuat Translation; 53 | FQuat Scale3D; 54 | 55 | FMatrix ToMatrixWithScale(); 56 | }; 57 | 58 | 59 | class ActorEntity 60 | { 61 | public: 62 | 63 | FTransform Head, neck, pelvis, Lshoulder, Lelbow, Lhand, Rshoulder, Relbow, Rhand, 64 | Lbuttock, Lknee, Lfoot, Rbuttock, Rknee, Rfoot; 65 | UEVector Head3D, neck3D, pelvis3D, Lshoulder3D, Lelbow3D, Lhand3D, Rshoulder3D, Relbow3D, Rhand3D, 66 | Lbuttock3D, Lknee3D, Lfoot3D, Rbuttock3D, Rknee3D, Rfoot3D; 67 | 68 | 69 | uint64_t Class = 0; 70 | int PlayerRole; 71 | bool isDie = true; 72 | int TempId; 73 | Index index{}; 74 | uint64_t PlayerState, RootComponent, MeshLastTeamNum, Mesh, LastTeamNum, BoneArray, AcknowledgedPawn, RelativeLocation; 75 | FTransform ToWorld; 76 | bool isCheck = FALSE; 77 | std::wstring Name = LIT(L"Entity"); 78 | UEVector UEPosition; 79 | Vector3 Position; 80 | ActorEntity(uint64_t address, VMMDLL_SCATTER_HANDLE handle); 81 | void SetUp1(VMMDLL_SCATTER_HANDLE handle); 82 | void SetUp2(VMMDLL_SCATTER_HANDLE handle); 83 | void SetUp3(); 84 | uint64_t GetClass(); 85 | int GetPlayerRole(); 86 | std::wstring GetName(); 87 | Vector3 GetPosition(); 88 | void UpdatePosition(VMMDLL_SCATTER_HANDLE handle); 89 | UEVector GetBoneMatrix(FTransform bone); 90 | void UpdateBone(VMMDLL_SCATTER_HANDLE handle); 91 | }; -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/Entity.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Entity.h" 3 | #include "drawing.h" 4 | #pragma region Entity 5 | 6 | bool Entity::IsVisible() 7 | { 8 | if (Entity::Condition) 9 | return Entity::Condition(); 10 | 11 | return Entity::Visible; 12 | } 13 | 14 | void Entity::SetCondition(condition condition) 15 | { 16 | Entity::Condition = condition; 17 | } 18 | 19 | void Entity::SetVisible(bool visible) 20 | { 21 | Entity::Visible = visible; 22 | } 23 | 24 | void Entity::SetBlocked(bool block) 25 | { 26 | Entity::Blocked = block; 27 | } 28 | 29 | child Entity::GetParent() 30 | { 31 | return Entity::Parent; 32 | } 33 | 34 | child Entity::GetChildRelativeParent() 35 | { 36 | return Entity::ChildRelativeParent; 37 | } 38 | 39 | void Entity::SetBlockedSiblings(bool block) 40 | { 41 | for (auto& it : Entity::Parent->GetContainer()) 42 | { 43 | if (it == shared_from_this()) 44 | continue; 45 | 46 | it->SetBlocked(block); 47 | } 48 | } 49 | 50 | Entity* Entity::GetInstance() 51 | { 52 | return Entity::Instance; 53 | } 54 | 55 | float Entity::GetLastClick() 56 | { 57 | return Entity::LastClick; 58 | } 59 | 60 | void Entity::SetLastClick(float value) 61 | { 62 | Entity::LastClick = value; 63 | } 64 | 65 | void Entity::SetParent(child parent) 66 | { 67 | Entity::Parent = parent; 68 | } 69 | 70 | void Entity::SetRelativeParent(child parent) 71 | { 72 | Entity::ChildRelativeParent = parent; 73 | } 74 | #pragma endregion 75 | 76 | #pragma region Events 77 | 78 | void Entity::SetValueChangedEvent(std::function evnt) 79 | { 80 | Entity::ValueChangeEvent = evnt; 81 | } 82 | 83 | std::function Entity::GetValueChangedEvent() 84 | { 85 | return Entity::ValueChangeEvent; 86 | } 87 | #pragma endregion 88 | 89 | #pragma region Container 90 | void Container::Draw() 91 | { 92 | // Reverse iterat 93 | for (auto it = ContainerInstance.crbegin(); it != ContainerInstance.crend(); it++) 94 | { 95 | (*it)->Draw(); 96 | } 97 | } 98 | 99 | void Container::Update() 100 | { 101 | for (auto it = ContainerInstance.crbegin(); it != ContainerInstance.crend(); it++) 102 | { 103 | (*it)->Update(); 104 | } 105 | } 106 | 107 | /*childcontainer& Container::Container() 108 | { 109 | return Container::ContainerInstance; 110 | }*/ 111 | 112 | /*size_t Container::GetChildren() 113 | { 114 | return Container::ContainerInstance.size(); 115 | }*/ 116 | #pragma endregion 117 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Config/ConfigUtilities.cpp: -------------------------------------------------------------------------------- 1 | #include "Pch.h" 2 | #include "ConfigUtilities.h" 3 | #include "ConfigInstance.h" 4 | 5 | json Config; 6 | std::string Path; 7 | ConfigInstances Configs; 8 | 9 | void SetUpConfig() 10 | { 11 | std::filesystem::path filePath = std::filesystem::path(getenv(LIT("USERPROFILE"))) / LIT("Documents") / LIT("Hunt") / (LIT("Default.json")); 12 | std::filesystem::create_directories(filePath.parent_path()); 13 | std::filesystem::exists(filePath) ? LoadConfig(LIT(L"Default")) : SaveConfig(LIT(L"Default")); 14 | } 15 | void SaveConfig(const std::wstring& config) 16 | { 17 | std::string cfg(config.begin(), config.end()); 18 | Config = json::array(); 19 | Config = Configs.ToJson(); 20 | std::string jsonstring = Config.dump() + "\n"; 21 | 22 | std::filesystem::path filePath = std::filesystem::path(getenv(LIT("USERPROFILE"))) / LIT("Documents") / LIT("Hunt") / (cfg + LIT(".json")); 23 | 24 | std::filesystem::create_directories(filePath.parent_path()); 25 | 26 | std::ofstream file(filePath); 27 | if (file.is_open()) { 28 | file << jsonstring; 29 | file.close(); 30 | } 31 | 32 | } 33 | 34 | void LoadConfig(const std::wstring& config) 35 | { 36 | std::string cfg(config.begin(), config.end()); 37 | 38 | std::filesystem::path filePath = std::filesystem::path(getenv(LIT("USERPROFILE"))) / LIT("Documents") / LIT("Hunt") / (cfg + LIT(".json")); 39 | 40 | if (!std::filesystem::exists(filePath)) { 41 | return; 42 | } 43 | 44 | std::ifstream file(filePath); 45 | if (file.is_open()) { 46 | std::stringstream buffer; 47 | buffer << file.rdbuf(); 48 | std::string jsonstring = buffer.str(); 49 | 50 | if (json::accept(jsonstring)) { 51 | Config = json::parse(jsonstring); 52 | Configs.FromJson(Config); 53 | 54 | } 55 | else { 56 | 57 | } 58 | file.close(); 59 | } 60 | else { 61 | 62 | } 63 | } 64 | 65 | std::vector GetAllConfigs() 66 | { 67 | std::vector confignames; 68 | 69 | std::filesystem::path directory = std::filesystem::path(getenv(LIT("USERPROFILE"))) / LIT("Documents") / LIT("Hunt"); 70 | 71 | for (const auto& entry : std::filesystem::directory_iterator(directory)) { 72 | if (entry.is_regular_file()) { 73 | std::wstring configname = entry.path().filename().stem(); 74 | confignames.push_back(configname); 75 | } 76 | } 77 | 78 | return confignames; 79 | } -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/Entity.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | class Entity; 3 | using condition = std::function; 4 | using child = std::shared_ptr; 5 | using childcontainer = std::vector; 6 | 7 | class Entity : public std::enable_shared_from_this 8 | { 9 | protected: 10 | bool Visible; 11 | bool Blocked = false; 12 | 13 | condition Condition; 14 | 15 | child Parent; 16 | child ChildRelativeParent; 17 | 18 | Vector2 Pos; 19 | Vector2 Size; 20 | Vector2 OriginalSize; 21 | Vector2 Scale; 22 | Vector2 TextSize; 23 | Vector2 ParentPos; 24 | Vector2 ParentSize; 25 | 26 | std::wstring Name; 27 | 28 | Entity* Instance = this; 29 | 30 | float LastClick = 0; 31 | 32 | // event handlers. 33 | std::function ValueChangeEvent = []() 34 | { 35 | }; // blank event 36 | public: 37 | // This can be overriden by the parent. 38 | virtual void Draw() 39 | { 40 | }; 41 | 42 | virtual void Update() 43 | { 44 | }; 45 | 46 | virtual childcontainer& GetContainer() 47 | { 48 | static childcontainer bad { }; 49 | return bad; 50 | } 51 | 52 | virtual size_t Children() { return 0; } 53 | 54 | virtual Vector2 GetPos() { return Pos; } 55 | virtual Vector2 GetSize() { return Size; } 56 | virtual Vector2 GetScale() { return Scale; } 57 | virtual Vector2 GetParentPos() { return ParentPos; } 58 | virtual Vector2 GetParentSize() { return ParentSize; } 59 | virtual std::wstring GetName() { return Name; } 60 | 61 | child GetChildRelativeParent(); 62 | child GetParent(); 63 | Entity* GetInstance(); 64 | 65 | bool IsVisible(); 66 | 67 | float GetLastClick(); 68 | 69 | void SetLastClick(float value); 70 | void SetCondition(condition condition); 71 | void SetVisible(bool visible); 72 | void SetBlocked(bool block); 73 | void SetBlockedSiblings(bool block); 74 | void SetParent(child parent); 75 | void SetRelativeParent(child parent); 76 | 77 | // event handlers 78 | void SetValueChangedEvent(std::function evnt); 79 | std::function GetValueChangedEvent(); 80 | 81 | friend class Container; 82 | friend class Tab; 83 | friend class ListBoxTab; 84 | friend class GroupBox; 85 | }; 86 | 87 | class Container : public Entity 88 | { 89 | protected: 90 | childcontainer ContainerInstance; 91 | 92 | public: 93 | virtual child Push(child child) 94 | { 95 | child.get()->Parent = shared_from_this(); 96 | ContainerInstance.emplace_back(child); 97 | return child; 98 | } 99 | 100 | void Draw(); 101 | void Update(); 102 | virtual childcontainer& GetContainer() override { return ContainerInstance; } 103 | virtual size_t Children() override { return ContainerInstance.size(); } 104 | }; 105 | 106 | using EntityVector = std::shared_ptr; 107 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/SDK/Camera.cpp: -------------------------------------------------------------------------------- 1 | #include "Pch.h" 2 | #include "ConfigUtilities.h" 3 | #include "Camera.h" 4 | 5 | static ViewMatrix CreateMatrix(Vector3 rot, Vector3 origin) { 6 | const float DEG_TO_RAD = static_cast(3.14159265358979323846) / 180.f; 7 | const float radPitch = rot.x * DEG_TO_RAD; 8 | const float radYaw = rot.y * DEG_TO_RAD; 9 | const float radRoll = rot.z * DEG_TO_RAD; 10 | 11 | const float SP = sinf(radPitch); 12 | const float CP = cosf(radPitch); 13 | const float SY = sinf(radYaw); 14 | const float CY = cosf(radYaw); 15 | const float SR = sinf(radRoll); 16 | const float CR = cosf(radRoll); 17 | 18 | ViewMatrix matrix; 19 | matrix.matrix[0][0] = CP * CY; 20 | matrix.matrix[0][1] = CP * SY; 21 | matrix.matrix[0][2] = SP; 22 | matrix.matrix[0][3] = 0.f; 23 | 24 | matrix.matrix[1][0] = SR * SP * CY - CR * SY; 25 | matrix.matrix[1][1] = SR * SP * SY + CR * CY; 26 | matrix.matrix[1][2] = -SR * CP; 27 | matrix.matrix[1][3] = 0.f; 28 | 29 | matrix.matrix[2][0] = -(CR * SP * CY + SR * SY); 30 | matrix.matrix[2][1] = CY * SR - CR * SP * SY; 31 | matrix.matrix[2][2] = CR * CP; 32 | matrix.matrix[2][3] = 0.f; 33 | 34 | matrix.matrix[3][0] = origin.x; 35 | matrix.matrix[3][1] = origin.y; 36 | matrix.matrix[3][2] = origin.z; 37 | matrix.matrix[3][3] = 1.f; 38 | 39 | return matrix; 40 | } 41 | 42 | Vector2 Camera::WorldToScreen(MinimalViewInfo viewinfo, Vector3 world) 43 | { 44 | Vector3 Screenlocation(0, 0, 0); 45 | Vector3 rot = Vector3(viewinfo.Rotation.Pitch, viewinfo.Rotation.Yaw, viewinfo.Rotation.Roll); 46 | Vector3 campos = Vector3(viewinfo.Location.X, viewinfo.Location.Y, viewinfo.Location.Z); 47 | const ViewMatrix tempMatrix = CreateMatrix(rot, Vector3(0, 0, 0)); 48 | 49 | Vector3 vAxisX(tempMatrix.matrix[0][0], tempMatrix.matrix[0][1], tempMatrix.matrix[0][2]); 50 | Vector3 vAxisY(tempMatrix.matrix[1][0], tempMatrix.matrix[1][1], tempMatrix.matrix[1][2]); 51 | Vector3 vAxisZ(tempMatrix.matrix[2][0], tempMatrix.matrix[2][1], tempMatrix.matrix[2][2]); 52 | 53 | Vector3 vDelta = world - campos; 54 | Vector3 vTransformed = Vector3(Vector3::Dot(vDelta,vAxisY), Vector3::Dot(vDelta,vAxisZ), Vector3::Dot(vDelta,vAxisX)); 55 | 56 | if (vTransformed.z < 1.f) 57 | vTransformed.z = 1.f; 58 | 59 | const float FOV_DEG_TO_RAD = static_cast(3.14159265358979323846) / 360.f; 60 | int centrex = Configs.Overlay.OverrideResolution ? Configs.Overlay.Width /2 : GetSystemMetrics(SM_CXSCREEN) / 2; 61 | int centrey = Configs.Overlay.OverrideResolution ? Configs.Overlay.Height / 2 : GetSystemMetrics(SM_CYSCREEN) / 2; 62 | Screenlocation.x = centrex + vTransformed.x * (centrex / tanf( 63 | viewinfo.FOV * FOV_DEG_TO_RAD)) / vTransformed.z; 64 | Screenlocation.y = centrey - vTransformed.y * (centrex / tanf( 65 | viewinfo.FOV * FOV_DEG_TO_RAD)) / vTransformed.z; 66 | 67 | return Vector2(Screenlocation.x, Screenlocation.y); 68 | } -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Main.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Memory.h" 3 | #include "CheatFunction.h" 4 | #include "Globals.h" 5 | #include "Init.h" 6 | #include "GUI.h" 7 | #include "Engine.h" 8 | std::shared_ptr EngineInstance; 9 | std::string ProcessName; 10 | 11 | void main() 12 | { 13 | bool gamefound = true; 14 | ProcessName = "TslGame.exe"; 15 | if (TargetProcess.Init("TslGame.exe", true, false)) 16 | { 17 | ProcessName = "TslGame.exe"; 18 | } 19 | else if (TargetProcess.Init("TslGame.exe", true, false)) 20 | { 21 | ProcessName = "TslGame.exe"; 22 | 23 | } 24 | else 25 | { 26 | printf("Failed to find game\n"); 27 | return; 28 | } 29 | TargetProcess.FixCr3(); 30 | 31 | uint64_t base = TargetProcess.GetBaseAddress(ProcessName); 32 | uint64_t size = TargetProcess.GetBaseSize(ProcessName); 33 | EngineInstance = std::make_shared(); 34 | EngineInstance->Cache(); 35 | 36 | 37 | 38 | //uint64_t persistentlevel = 0x190; 39 | //persistentlevel = TargetProcess.Read(gobjects + gameinstance); 40 | } 41 | LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 42 | { 43 | InputWndProc(hWnd, message, wParam, lParam); 44 | switch (message) 45 | { 46 | case WM_DESTROY: 47 | PostQuitMessage(0); 48 | return 0; 49 | break; 50 | } 51 | 52 | return DefWindowProc(hWnd, message, wParam, lParam); 53 | } 54 | 55 | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 56 | { 57 | HWND hWnd; 58 | WNDCLASSEX wc; 59 | AllocConsole(); 60 | FILE* fDummy; 61 | freopen_s(&fDummy, LIT("CONIN$"), LIT("r"), stdin); 62 | freopen_s(&fDummy, LIT("CONOUT$"), LIT("w"), stderr); 63 | freopen_s(&fDummy, LIT("CONOUT$"), LIT("w"), stdout); 64 | printf(LIT("Debugging Window:\n")); 65 | 66 | main(); 67 | ZeroMemory(&wc, sizeof(WNDCLASSEX)); 68 | wc.cbSize = sizeof(WNDCLASSEX); 69 | wc.style = CS_HREDRAW | CS_VREDRAW; 70 | wc.lpfnWndProc = WindowProc; 71 | wc.hInstance = hInstance; 72 | wc.hCursor = LoadCursor(NULL, IDC_ARROW); 73 | wc.hbrBackground = (HBRUSH)COLOR_WINDOW; 74 | wc.lpszClassName = L"GUI Framework"; 75 | RegisterClassEx(&wc); 76 | 77 | hWnd = CreateWindowEx(WS_EX_APPWINDOW, wc.lpszClassName, L"GUI Framework", 78 | WS_POPUP, 79 | 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), NULL, NULL, hInstance, NULL); 80 | 81 | if (!hWnd) 82 | return -1; 83 | 84 | 85 | SetLayeredWindowAttributes(hWnd, RGB(0, 0, 0), 255, LWA_ALPHA); 86 | 87 | ShowWindow(hWnd, nCmdShow); 88 | 89 | InitD2D(hWnd); 90 | CreateGUI(); 91 | MSG msg; 92 | SetProcessDPIAware(); 93 | SetInput(); 94 | while (TRUE) 95 | { 96 | if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) 97 | { 98 | TranslateMessage(&msg); 99 | DispatchMessage(&msg); 100 | 101 | if (msg.message == WM_QUIT) 102 | break; 103 | } 104 | RenderFrame(); 105 | } 106 | CleanD2D(); 107 | return msg.wParam; 108 | } 109 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/Tab.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Tab.h" 3 | #include "Input.h" 4 | #include "Gui.h" 5 | #include "Drawing.h" 6 | 7 | Tab::Tab(std::wstring name, float x, float y, int* selectedtab, float width, float height) 8 | { 9 | //Calc Size based off the name size 10 | Vector2 txtSize = GetTextSize(name, LIT("Verdana"), 12); 11 | if (width == 0 && height == 0) 12 | Tab::Size = txtSize; 13 | else 14 | { 15 | //Let's make it impossible to make it smaller than the actual font size.. otherwise it looks so weird lol 16 | if (width < txtSize.x) 17 | width = txtSize.x; 18 | if (height < txtSize.y) 19 | height = txtSize.y; 20 | Tab::Size = {width, height}; 21 | } 22 | Size.x += 10; 23 | Tab::SetVisible(true); 24 | Tab::Index = TabCount; // this doesn't need to be changed for a different set of tabs or whatever, you dont need to import a value here you just need a nonce value so you never get a repeated one 25 | Tab::Pos = {x, y}; 26 | Tab::Selected = selectedtab; 27 | Tab::Name = name; 28 | TabCount++; 29 | SetVisible(true); 30 | } 31 | 32 | void Tab::Update() 33 | { 34 | if (!Tab::Parent) 35 | Tab::SetVisible(false); 36 | 37 | if (!Tab::IsVisible()) 38 | return; 39 | Tab::ParentPos = Tab::GetParent()->GetParentPos(); 40 | Tab::ParentSize = Tab::GetParent()->GetSize(); 41 | 42 | size_t ignorecount = 0; 43 | 44 | for (child& it : Tab::Parent->GetContainer()) 45 | { 46 | if (it == shared_from_this()) 47 | break; 48 | 49 | if (!it->IsVisible()) 50 | ++ignorecount; 51 | } 52 | bool selected = Index == *Selected; 53 | if (!selected && !Tab::Blocked) 54 | { 55 | if (IsMouseInRectangle(Tab::ParentPos.x + Tab::Pos.x, Tab::ParentPos.y + Tab::Pos.y, Tab::Size.x, Tab::Size.y) && IsKeyClicked(VK_LBUTTON) && !selected && Tab::LastClick < (clock() * 0.00001f)) 56 | { 57 | *Selected = Index; 58 | // ideally you just want to make a timer and use that but since this is just poc we do this 59 | Tab::LastClick = (clock() * 0.00001f) + 0.002f; 60 | Tab::ValueChangeEvent(); 61 | } 62 | } 63 | } 64 | 65 | void Tab::Draw() 66 | { 67 | if (!Tab::IsVisible()) 68 | return; 69 | 70 | MyColour rectColour = MenuColours[LIT("Tab")]; 71 | MyColour textColour = MenuColours[LIT("Text")]; 72 | bool selected = Index == *Selected; 73 | 74 | //if is hovering color 75 | if (IsMouseInRectangle(Tab::ParentPos.x + Tab::Pos.x, Tab::ParentPos.y + Tab::Pos.y, Tab::Size.x, Tab::Size.y)) 76 | { 77 | rectColour = MenuColours[LIT("TabHover")]; 78 | if (IsKeyDown(VK_LBUTTON)) 79 | { 80 | rectColour = MenuColours[LIT("TabActive")]; 81 | } 82 | } 83 | 84 | //If is selected 85 | if (selected) 86 | { 87 | rectColour = MenuColours[LIT("TabActive")]; 88 | textColour = MenuColours[LIT("TextSelected")]; 89 | } 90 | FilledRectangle(Tab::ParentPos.x + Tab::Pos.x, Tab::ParentPos.y + Tab::Pos.y, Tab::Size.x, Tab::Size.y, rectColour); 91 | DrawText(Tab::ParentPos.x + Tab::Pos.x + (Tab::Size.x / 2), Tab::ParentPos.y + Tab::Pos.y + (Tab::Size.y / 2), Tab::Name, LIT("Verdana"), 12, textColour, CentreCentre); 92 | 93 | if (selected) 94 | { 95 | Container::Draw(); 96 | Container::Update(); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Globals.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Engine.h" 3 | extern std::shared_ptr EngineInstance; 4 | extern std::string ProcessName; 5 | struct _Local 6 | { 7 | int Teamid; 8 | int SpectatedCount; 9 | 10 | }inline Local; 11 | 12 | struct OFFSET { 13 | uint64_t GNames_offset = 0x0; 14 | // 2024-11-16 15 | uint64_t UWorld = 0xFF9BDE8; 16 | uint64_t Decrypt = 0xE612A28; 17 | uint64_t GNames = 0x101FAE98; 18 | uint32_t ElementsPerChunk = 0x40E0; 19 | 20 | uint32_t Offset = 0x18; 21 | uint64_t NameIndexXor1 = 0xAF29A017; 22 | uint32_t NameIndexOne = 0xF; 23 | uint32_t NameIndexTwo = 0x10; 24 | uint64_t NameIndexXor2 = 0x4ABD1BAB; 25 | uint32_t NameIsROR = 0x1; 26 | 27 | uint32_t CurrentLevel = 0x30; 28 | uint32_t GameInstance = 0x160; 29 | uint32_t LocalPlayers = 0x30; 30 | uint32_t Actors = 0x198; 31 | uint32_t ObjectID = 0x8; 32 | uint32_t PlayerController = 0x30; 33 | uint32_t AcknowledgedPawn = 0x4A8; 34 | uint32_t PlayerCameraManager = 0x4D0; 35 | uint32_t RootComponent = 0xF0; 36 | uint32_t PlayerState = 0x428; 37 | uint32_t PlayerStatistics = 0x4B4; 38 | uint32_t Mesh = 0x5A8; 39 | uint32_t AnimScriptInstance = 0xDC8; 40 | uint32_t StaticMesh = 0xAB0; 41 | 42 | uint32_t Health = 0x940; 43 | uint32_t HeaFlag = 0x38; 44 | uint32_t Health1 = 0x970; 45 | uint32_t Health2 = 0x988; 46 | uint32_t Health3 = 0x954; 47 | uint32_t Health4 = 0x940; 48 | uint32_t Health5 = 0x955; 49 | uint32_t Health6 = 0x950; 50 | uint64_t HealthXorKey0 = 0xCEC7A59F; 51 | uint64_t HealthXorKey1 = 0x9B63B23E; 52 | uint64_t HealthXorKey2 = 0xCAF75ABD; 53 | uint64_t HealthXorKey3 = 0x3E38486F; 54 | uint64_t HealthXorKey4 = 0xE8911D0A; 55 | uint64_t HealthXorKey5 = 0x23DDAD1C; 56 | uint64_t HealthXorKey6 = 0x9456FC8; 57 | uint64_t HealthXorKey7 = 0xBD39B621; 58 | uint64_t HealthXorKey8 = 0xBAD7A58; 59 | uint64_t HealthXorKey9 = 0xA8EF3E87; 60 | uint64_t HealthXorKey10 = 0xE2752BB6; 61 | uint64_t HealthXorKey11 = 0x9F8ADBF4; 62 | uint64_t HealthXorKey12 = 0xBDE8FBD5; 63 | uint64_t HealthXorKey13 = 0x3E936F07; 64 | uint64_t HealthXorKey14 = 0x6F099E38; 65 | uint64_t HealthXorKey15 = 0xE2D72AE4; 66 | 67 | uint32_t GroggyHealth = 0x10F0; 68 | uint32_t LastTeamNum = 0x1558; 69 | uint32_t CharacterName = 0x1218; 70 | uint32_t SpectatedCount = 0x1498; 71 | uint32_t Eyes = 0x73C; 72 | 73 | uint32_t WorldToMap = 0x9B4; 74 | uint32_t ComponentToWorld = 0x220; 75 | uint32_t ComponentLocation = 0x230; 76 | uint32_t ComponentVelocity = 0x358; 77 | uint32_t CameraFov = 0x9F8; 78 | uint32_t CameraRot = 0x470; 79 | uint32_t CameraPos = 0x464; 80 | 81 | uint32_t ItemID = 0x268; 82 | uint32_t ItemTable = 0xA8; 83 | uint32_t DroppedItemGroup = 0x260; 84 | uint32_t DroppedItemGroup_UItem = 0x840; 85 | 86 | uint32_t WeaponProcessor = 0x968; 87 | uint32_t EquippedWeapons = 0x1F8; 88 | uint32_t CurrentWeaponIndex = 0x301; 89 | uint32_t WeaponTrajectoryData = 0x10C8; 90 | uint32_t TrajectoryConfig = 0x100; 91 | uint32_t ControlRotation_CP = 0xC90; 92 | uint32_t RecoilADSRotation_CP = 0x90C; 93 | uint32_t LeanLeftAlpha_CP = 0xCE4; 94 | uint32_t LeanRightAlpha_CP = 0xCE8; 95 | 96 | // uint32_t TrainingMapGrid = 0x0; 97 | uint32_t AimOffsets = 0x1A98; 98 | uint32_t ReplicatedMovement = 0x60; 99 | uint32_t VehicleRiderComponent = 0x2030; 100 | uint32_t LastVehiclePawn = 0x260; 101 | }inline SDK; -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Memory/InputManager.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "InputManager.h" 3 | #include "Registry.h" 4 | #include "Memory/Memory.h" 5 | 6 | namespace Keyboard 7 | { 8 | uint64_t gafAsyncKeyStateExport = 0; 9 | uint8_t state_bitmap[64]{ }; 10 | uint8_t previous_state_bitmap[256 / 8]{ }; 11 | uint64_t win32kbase = 0; 12 | int win_logon_pid = 0; 13 | } 14 | 15 | bool Keyboard::InitKeyboard() 16 | { 17 | c_registry registry; 18 | std::string win = registry.QueryValue("HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\CurrentBuild", e_registry_type::sz); 19 | if (win == "") 20 | return false; 21 | int Winver = 0; 22 | if (!win.empty()) 23 | Winver = std::stoi(win); 24 | else 25 | return false; 26 | 27 | win_logon_pid = TargetProcess.GetPidFromName("winlogon.exe"); 28 | if (Winver > 22000) 29 | { 30 | auto pids = TargetProcess.GetPidListFromName("csrss.exe"); 31 | for (size_t i = 0; i < pids.size(); i++) 32 | { 33 | auto pid = pids[i]; 34 | uintptr_t tmp = VMMDLL_ProcessGetModuleBaseU(TargetProcess.vHandle, pid, (LPSTR)"win32ksgd.sys"); 35 | uintptr_t g_session_global_slots = tmp + 0x3110; 36 | uintptr_t user_session_state = TargetProcess.Read(TargetProcess.Read(TargetProcess.Read(g_session_global_slots, pid), pid), pid); 37 | gafAsyncKeyStateExport = user_session_state + 0x3690; 38 | if (gafAsyncKeyStateExport > 0x7FFFFFFFFFFF) 39 | break; 40 | } 41 | if (gafAsyncKeyStateExport > 0x7FFFFFFFFFFF) 42 | return true; 43 | return false; 44 | } 45 | else 46 | { 47 | printf("win10\n"); 48 | PVMMDLL_MAP_EAT eat_map = NULL; 49 | PVMMDLL_MAP_EATENTRY eat_map_entry; 50 | bool result = VMMDLL_Map_GetEATU(TargetProcess.vHandle, TargetProcess.GetPidFromName("winlogon.exe") | VMMDLL_PID_PROCESS_WITH_KERNELMEMORY, (LPSTR)"win32kbase.sys", &eat_map); 51 | if (!result) 52 | return false; 53 | 54 | if (eat_map->dwVersion != VMMDLL_MAP_EAT_VERSION) 55 | { 56 | VMMDLL_MemFree(eat_map); 57 | eat_map_entry = NULL; 58 | return false; 59 | } 60 | printf("eat_map->cMap: %d\n", eat_map->cMap); 61 | for (int i = 0; i < eat_map->cMap; i++) 62 | { 63 | eat_map_entry = eat_map->pMap + i; 64 | if (strcmp(eat_map_entry->uszFunction, "gafAsyncKeyState") == 0) 65 | { 66 | gafAsyncKeyStateExport = eat_map_entry->vaFunction; 67 | 68 | break; 69 | } 70 | } 71 | 72 | VMMDLL_MemFree(eat_map); 73 | eat_map = NULL; 74 | if (gafAsyncKeyStateExport > 0x7FFFFFFFFFFF) 75 | return true; 76 | return false; 77 | } 78 | } 79 | 80 | void Keyboard::UpdateKeys() 81 | { 82 | uint8_t previous_key_state_bitmap[64] = { 0 }; 83 | memcpy(previous_key_state_bitmap, state_bitmap, 64); 84 | 85 | VMMDLL_MemReadEx(TargetProcess.vHandle, win_logon_pid | VMMDLL_PID_PROCESS_WITH_KERNELMEMORY, gafAsyncKeyStateExport, (PBYTE)&state_bitmap, 64, NULL, VMMDLL_FLAG_NOCACHE); 86 | for (int vk = 0; vk < 256; ++vk) 87 | if ((state_bitmap[(vk * 2 / 8)] & 1 << vk % 4 * 2) && !(previous_key_state_bitmap[(vk * 2 / 8)] & 1 << vk % 4 * 2)) 88 | previous_state_bitmap[vk / 8] |= 1 << vk % 8; 89 | } 90 | 91 | auto start = std::chrono::system_clock::now(); 92 | 93 | bool Keyboard::IsKeyDown(uint64_t virtual_key_code) 94 | { 95 | if (gafAsyncKeyStateExport < 0x7FFFFFFFFFFF) 96 | return false; 97 | if (std::chrono::system_clock::now() - start > std::chrono::milliseconds(1)) 98 | { 99 | UpdateKeys(); 100 | start = std::chrono::system_clock::now(); 101 | } 102 | return state_bitmap[(virtual_key_code * 2 / 8)] & 1 << virtual_key_code % 4 * 2; 103 | } 104 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/Slider.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Entity.h" 3 | #include "Drawing.h" 4 | #include "Input.h" 5 | 6 | // due to using templates in c++ classes it is illegal to use a c++ file so this will look rather odd to the other code. 7 | template 8 | class Slider : public Entity 9 | { 10 | protected: 11 | T MinValue; 12 | T MaxValue; 13 | T* Value; 14 | T OutputValue; 15 | 16 | bool Held = false; 17 | 18 | std::wstring Measurement; 19 | std::wstring OutputString; 20 | 21 | void ConvertValueToString() 22 | { 23 | OutputString = std::to_wstring(OutputValue); 24 | size_t dotpos = OutputString.find(L"."); 25 | if (dotpos != std::string::npos) 26 | { 27 | if (OutputString.length() > dotpos + 2) 28 | { 29 | OutputString.resize(dotpos + 3); // Truncate to two places after the decimal place 30 | } 31 | } 32 | } 33 | 34 | public: 35 | void Update() 36 | { 37 | if (!Parent) 38 | SetVisible(false); 39 | if (!IsVisible()) 40 | return; 41 | 42 | ParentPos = Parent->GetParentPos(); 43 | 44 | if (!IsKeyDown(VK_LBUTTON)) 45 | { 46 | if (Held == true) 47 | ValueChangeEvent(); 48 | Held = false; 49 | } 50 | float ratio = (float)(*Value - (float)MinValue) / float(MaxValue - MinValue); 51 | if ((IsMouseInRectangle(ParentPos.x + Pos.x - 2, ParentPos.y + (Pos.y + 15) - 2, Size.x + 3, Size.y + 3) || IsMouseInRectangle(ParentPos.x + Pos.x + (Size.x * ratio), ParentPos.y + (Pos.y + 15) - (Size.y / 2.2), 5, Size.y * 2.2)) && IsKeyClicked(VK_LBUTTON) && !Blocked) 52 | { 53 | Held = true; 54 | } 55 | if (Held) 56 | { 57 | // make sure no clicks go through when holding. 58 | const float clamp = std::clamp((float)MousePos.x - (float)(Pos.x + ParentPos.x), 0.00f, (float)Size.x); 59 | const float ratio = clamp / Size.x; 60 | *Value = MinValue + (MaxValue - MinValue) * ratio; 61 | OutputValue = *Value; 62 | ConvertValueToString(); 63 | } 64 | } 65 | 66 | void Draw() 67 | { 68 | if (!IsVisible()) 69 | return; 70 | if (!Parent) 71 | SetVisible(false); 72 | 73 | MyColour rectColour = MenuColours[LIT("Slider")]; 74 | MyColour textColour = MenuColours[LIT("Text")]; 75 | MyColour insideColour = MenuColours[LIT("SliderInside")]; 76 | MyColour outline = MenuColours[LIT("SliderOutline")]; 77 | MyColour widget = MenuColours[LIT("SliderWidget")]; 78 | DrawText(ParentPos.x + Pos.x + Size.x, (ParentPos.y + Pos.y) - 3, OutputString + Measurement, LIT("Verdana"), 11, textColour, Left); 79 | DrawText(ParentPos.x + Pos.x, (ParentPos.y + Pos.y) - 3, Name + LIT(L": "), LIT("Verdana"), 11, textColour, None); 80 | OutlineRectangle(ParentPos.x + Pos.x, ParentPos.y + (Pos.y + 15), Size.x, Size.y, 1, outline); 81 | FilledRectangle(ParentPos.x + Pos.x, ParentPos.y + (Pos.y + 15), Size.x, Size.y, Colour(80, 80, 80, 255)); 82 | float ratio = (float)(*Value - (float)MinValue) / float(MaxValue - MinValue); 83 | FilledRectangle(ParentPos.x + Pos.x, ParentPos.y + (Pos.y + 15), (int)Size.x * ratio, Size.y, insideColour); 84 | 85 | OutlineRoundedRectangle(ParentPos.x + Pos.x + (Size.x * ratio), ParentPos.y + (Pos.y + 15) - (Size.y / 2.2), 5, Size.y * 2.2, 2, 2, outline); 86 | FilledRoundedRectangle(ParentPos.x + Pos.x + (Size.x * ratio), ParentPos.y + (Pos.y + 15) - (Size.y / 2.2), 5, Size.y * 2.2, 2, widget); 87 | } 88 | 89 | Slider(int x, int y,int width, std::wstring name, std::wstring measurement, T minvalue, T maxvalue, T* value) : Measurement(measurement), MaxValue(maxvalue), MinValue(minvalue), Value(value) 90 | { 91 | Pos = {(float)x, (float)y}; 92 | Name = name; 93 | Size = { (float)width,5 }; 94 | OutputValue = *Value; 95 | ConvertValueToString(); 96 | SetVisible(true); 97 | } 98 | }; 99 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/Toggle.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Toggle.h" 3 | #include "Input.h" 4 | #include "Drawing.h" 5 | #include "Font.h" 6 | 7 | Toggle::Toggle(float x, float y, std::wstring text, bool* data = nullptr) 8 | { 9 | Toggle::Pos = {x, y}; 10 | Toggle::Size = {11, 11}; 11 | Toggle::Name = text; 12 | Toggle::TextSize = GetTextSize(text, LIT("Verdana"), 12); 13 | Data = data; 14 | SetVisible(true); 15 | } 16 | 17 | void Toggle::Update() 18 | { 19 | if (!Toggle::Parent) 20 | Toggle::SetVisible(false); 21 | if (!Toggle::IsVisible()) 22 | return; 23 | auto currenttime = std::chrono::high_resolution_clock::now(); 24 | std::chrono::duration deltatime = currenttime - Toggle::LastUpdateTime; 25 | Toggle::LastUpdateTime = currenttime; 26 | double deltaseconds = deltatime.count(); 27 | Toggle::ParentPos = Toggle::Parent->GetParentPos(); 28 | if (!Toggle::Blocked) 29 | { 30 | // square click check 31 | if (IsMouseInRectangle(Toggle::Pos + Toggle::ParentPos, Toggle::Size) && IsKeyClicked(VK_LBUTTON) && Toggle::LastClick < (clock() * 0.00001f)) 32 | { 33 | *Toggle::Data = !(*Toggle::Data); 34 | Toggle::LastClick = (clock() * 0.00001f) + 0.002f; 35 | Toggle::ValueChangeEvent(); 36 | } 37 | // text click check 38 | Vector2 textdimensions = {Toggle::TextSize.x + 4, Toggle::TextSize.y}; 39 | if (IsMouseInRectangle(Toggle::ParentPos.x + Toggle::Pos.x + (Toggle::Size.x), Toggle::ParentPos.y + Toggle::Pos.y - 1, Toggle::TextSize.x, Toggle::TextSize.y) && IsKeyClicked(VK_LBUTTON) && Toggle::LastClick < (clock() * 0.00001f)) 40 | { 41 | *Toggle::Data = !(*Toggle::Data); 42 | Toggle::LastClick = (clock() * 0.00001f) + 0.002f; 43 | Toggle::ValueChangeEvent(); 44 | } 45 | } 46 | 47 | if (*Data) 48 | { 49 | Toggle::ClickedAnimationProgress += (1.0f / Toggle::ClickedAnimationDuration) * deltaseconds; 50 | Toggle::ClickedAnimationProgress = std::min(Toggle::ClickedAnimationProgress, 1.0f); 51 | Toggle::FadeAnimationProgress += (1.0f / Toggle::FadeAnimationDuration) * deltaseconds; 52 | Toggle::FadeAnimationProgress = std::min(Toggle::FadeAnimationProgress, 1.0f); 53 | } 54 | else { 55 | Toggle::ClickedAnimationProgress -= (1.0f / Toggle::ClickedAnimationDuration) * deltaseconds; 56 | Toggle::ClickedAnimationProgress = std::max(Toggle::ClickedAnimationProgress, 0.0f); 57 | Toggle::FadeAnimationProgress -= (1.0f / Toggle::FadeAnimationDuration) * deltaseconds; 58 | Toggle::FadeAnimationProgress = std::max(Toggle::FadeAnimationProgress, 0.0f); 59 | } 60 | MenuColours[LIT("ToggleInside")].a = static_cast(1 + (255 - 1) * Toggle::FadeAnimationProgress); 61 | int size = static_cast(1 + (Size.x - 2 - 1) * Toggle::ClickedAnimationProgress); 62 | Toggle::RectangleColour = MenuColours[LIT("ToggleInside")]; 63 | Toggle::ClickedSize = size; 64 | } 65 | 66 | void Toggle::Draw() 67 | { 68 | if (!Toggle::Parent) 69 | Toggle::SetVisible(false); 70 | if (!Toggle::IsVisible()) 71 | return; 72 | 73 | MyColour rectColour = MenuColours[LIT("Toggle")]; 74 | MyColour rectOutlineColour = MenuColours[LIT("ToggleOutline")]; 75 | MyColour activeColour = MenuColours[LIT("ToggleInside")]; 76 | MyColour textColour = MenuColours[LIT("Text")]; 77 | 78 | OutlineRectangle(ParentPos.x + Pos.x, ParentPos.y + Pos.y, Size.x + 1, Size.y + 1, 1, rectOutlineColour); 79 | FilledRectangle(ParentPos.x + Pos.x, ParentPos.y + Pos.y, Size.x, Size.y, rectColour); 80 | if (*Toggle::Data == true) 81 | FilledRectangle(ParentPos.x + Pos.x + 1, ParentPos.y + Pos.y + 1, Toggle::ClickedSize, Toggle::ClickedSize, RectangleColour); 82 | 83 | DrawText(Toggle::ParentPos.x + Toggle::Pos.x + (Toggle::Size.x) + 3, Toggle::ParentPos.y + Toggle::Pos.y - (Toggle::Size.y / 8), Toggle::Name, LIT("Verdana"), 12, textColour, None); 84 | } 85 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Start Up/Init.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Init.h" 3 | #include "drawing.h" 4 | #include "GUI.h" 5 | #include "Globals.h" 6 | #include "Camera.h" 7 | #include "PlayerEsp.h" 8 | ID2D1Factory* Factory; 9 | IDWriteFactory* FontFactory; 10 | ID2D1HwndRenderTarget* RenderTarget; 11 | ID2D1SolidColorBrush* Brush; 12 | 13 | 14 | void InitD2D(HWND hWnd) 15 | { 16 | HRESULT result = D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED, &Factory); 17 | RECT rect; 18 | GetClientRect(hWnd, &rect); 19 | result = Factory->CreateHwndRenderTarget(D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT, D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED)), D2D1::HwndRenderTargetProperties(hWnd, D2D1::SizeU(rect.right, rect.bottom), D2D1_PRESENT_OPTIONS_IMMEDIATELY), &RenderTarget); 20 | if (!SUCCEEDED(result)) 21 | return; 22 | 23 | result = DWriteCreateFactory(DWRITE_FACTORY_TYPE_ISOLATED, __uuidof(IDWriteFactory), reinterpret_cast(&FontFactory)); 24 | if (!SUCCEEDED(result)) 25 | return; 26 | 27 | CreateFonts(LIT("Verdana"), LIT(L"Verdana"), 10, DWRITE_FONT_WEIGHT_NORMAL); 28 | CreateFonts("VerdanaBold", LIT(L"Verdana"), 10, DWRITE_FONT_WEIGHT_SEMI_BOLD); 29 | RenderTarget->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0, 0), &Brush); // create global brush 30 | RenderTarget->SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE); // set aa mode 31 | } 32 | 33 | void CleanD2D() 34 | { 35 | // ensure pointer is valid 36 | // then release memory 37 | if (Factory) 38 | Factory->Release(); 39 | if (RenderTarget) 40 | RenderTarget->Release(); 41 | if (Brush) 42 | Brush->Release(); 43 | for (std::pair dict : Fonts) 44 | { 45 | const FontInformation& fontInfo = dict.second; 46 | if (fontInfo.font) 47 | fontInfo.font->Release(); 48 | } 49 | //Clean all cached text layours 50 | for (std::pair dict : TextLayouts) 51 | { 52 | IDWriteTextLayout* layout = dict.second; 53 | if (layout) 54 | layout->Release(); 55 | } 56 | 57 | for (std::pair dict : TextCache) 58 | { 59 | IDWriteTextLayout* layout = dict.second; 60 | if (layout) 61 | layout->Release(); 62 | } 63 | } 64 | 65 | int FrameRate() 66 | { 67 | static int fps; 68 | static int lastfps; 69 | static float lasttime; 70 | static float time; 71 | 72 | time = clock() * 0.001f; 73 | fps++; 74 | float DeltaTime = time - lasttime; 75 | if ((DeltaTime) >= 1.0f) 76 | { 77 | lasttime = time; 78 | lastfps = fps; 79 | fps = 0; 80 | } 81 | return lastfps; 82 | } 83 | 84 | void InitialiseClasses() 85 | { 86 | 87 | } 88 | 89 | std::shared_ptr Cache = std::make_shared(1000, [] { 90 | if (!EngineInstance) 91 | { 92 | EngineInstance = std::make_shared(); 93 | return; 94 | } 95 | if (EngineInstance->GetActorSize() <= 0 || EngineInstance->GetActorSize() >= 3000) 96 | { 97 | EngineInstance = std::make_shared(); 98 | } 99 | EngineInstance->Cache(); 100 | }); 101 | std::shared_ptr UpdateViewMatrix = std::make_shared(5, [] { 102 | if (!EngineInstance) 103 | return; 104 | auto handle = TargetProcess.CreateScatterHandle(); 105 | EngineInstance->RefreshViewMatrix(handle); 106 | TargetProcess.ExecuteReadScatter(handle); 107 | TargetProcess.CloseScatterHandle(handle); 108 | 109 | }); 110 | 111 | void RenderFrame() 112 | { 113 | Cache->Execute(); 114 | UpdateViewMatrix->Execute(); 115 | UpdatePlayers->Execute(); 116 | RenderTarget->BeginDraw(); 117 | RenderTarget->Clear(Colour(0, 0, 0, 255)); // clear over the last buffer 118 | RenderTarget->SetTransform(D2D1::Matrix3x2F::Identity()); // set new transform 119 | DrawPlayerEsp(); 120 | Render(); 121 | RenderTarget->EndDraw(); 122 | } 123 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Misc/Vector.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "vector.h" 3 | 4 | #include 5 | #include 6 | 7 | Vector2::Vector2() : x(0), y(0) { } 8 | 9 | Vector2::Vector2(float _x, float _y) : x(_x), y(_y) { } 10 | 11 | Vector2::~Vector2() { } 12 | 13 | Vector2 Vector2::operator*(Vector2 a) 14 | { 15 | return Vector2(x * a.x, y * a.y); 16 | } 17 | 18 | Vector2 Vector2::operator/(Vector2 a) 19 | { 20 | return Vector2(x / a.x, y / a.y); 21 | } 22 | 23 | Vector2 Vector2::operator+(Vector2 a) 24 | { 25 | return Vector2(x + a.x, y + a.y); 26 | } 27 | 28 | Vector2 Vector2::operator-(Vector2 a) 29 | { 30 | return Vector2(x - a.x, y - a.y); 31 | } 32 | 33 | bool Vector2::operator==(Vector2 a) 34 | { 35 | return x == a.x && y == a.y; 36 | } 37 | 38 | bool Vector2::operator!=(Vector2 a) 39 | { 40 | return x != a.x || y != a.y; 41 | } 42 | 43 | bool Vector2::IsZero() const 44 | { 45 | return !x && !y; 46 | } 47 | 48 | Vector2 Vector2::Zero() 49 | { 50 | return Vector2(); 51 | } 52 | 53 | float Vector2::Distance(Vector2 a, Vector2 b) 54 | { 55 | const auto difference = Vector2( 56 | a.x - b.x, 57 | a.y - b.y); 58 | 59 | return sqrt( 60 | powf(difference.x, 2.0f) + 61 | powf(difference.y, 2.0f)); 62 | } 63 | 64 | Vector3::Vector3() : x(0), y(0), z(0) { } 65 | 66 | Vector3::Vector3(float _x, float _y, float _z) : x(_x), y(_y), z(_z) { } 67 | 68 | Vector3::~Vector3() { } 69 | 70 | Vector3 Vector3::operator*(Vector3 a) 71 | { 72 | return Vector3(x * a.x, y * a.y, z * a.z); 73 | } 74 | 75 | Vector3 Vector3::operator*(float f) 76 | { 77 | return Vector3(x * f, y * f, z * f); 78 | } 79 | 80 | Vector3 Vector3::operator/(Vector3 a) 81 | { 82 | return Vector3(x / a.x, y / a.y, z / a.z); 83 | } 84 | 85 | Vector3 Vector3::operator/(float f) 86 | { 87 | return Vector3(x / f, y / f, z / f); 88 | } 89 | 90 | Vector3 Vector3::operator+(Vector3 a) 91 | { 92 | return Vector3(x + a.x, y + a.y, z + a.z); 93 | } 94 | 95 | Vector3 Vector3::operator-(Vector3 a) 96 | { 97 | return Vector3(x - a.x, y - a.y, z - a.z); 98 | } 99 | 100 | bool Vector3::operator==(Vector3 a) 101 | { 102 | return x == a.x && y == a.y && z == a.z; 103 | } 104 | 105 | bool Vector3::operator!=(Vector3 a) 106 | { 107 | return x != a.x || y != a.y || z != a.z; 108 | } 109 | 110 | bool Vector3::IsZero() const 111 | { 112 | return !x && !y && !z; 113 | } 114 | 115 | float Vector3::Dot(Vector3 left, Vector3 right) 116 | { 117 | return (left.x * right.x) + (left.y * right.y) + (left.z * right.z); 118 | } 119 | 120 | float Vector3::Distance(Vector3 a, Vector3 b) 121 | { 122 | const auto difference = Vector3( 123 | a.x - b.x, 124 | a.y - b.y, 125 | a.z - b.z); 126 | 127 | return sqrt( 128 | powf(difference.x, 2.0f) + 129 | powf(difference.y, 2.0f) + 130 | powf(difference.z, 2.0f) 131 | ); 132 | 133 | } 134 | 135 | int Vector3::FormattedDistance(Vector3 a, Vector3 b) 136 | { 137 | const auto difference = Vector3( 138 | a.x - b.x, 139 | a.y - b.y, 140 | a.z - b.z); 141 | 142 | int distance = sqrt( 143 | powf(difference.x, 2.0f) + 144 | powf(difference.y, 2.0f) + 145 | powf(difference.z, 2.0f) 146 | ); 147 | return (int)(5 * round(distance / 5.0)); 148 | } 149 | 150 | Vector3 Vector3::Zero() 151 | { 152 | return Vector3(); 153 | } 154 | 155 | float Vector3::Length() const 156 | { 157 | return sqrt((x * x) + (y * y) + (z * z)); 158 | } 159 | 160 | float Vector3::LengthSqr() const 161 | { 162 | return (x * x) + (y * y) + (z * z); 163 | } 164 | 165 | Vector3 Vector3::Clamp() const 166 | { 167 | Vector3 angles = *this; 168 | 169 | if (angles.x > 89.f) 170 | angles.x -= 360.f; 171 | else if (angles.x < -89.f) 172 | angles.x += 360.f; 173 | 174 | if (angles.y > 180.f) 175 | angles.y -= 360.f; 176 | else if (angles.y < -180.f) 177 | angles.y += 360.f; 178 | 179 | angles.z = 0.f; 180 | return angles; 181 | } 182 | 183 | Vector3 Vector3::Lerp(Vector3 a, Vector3 b, float t) 184 | { 185 | return a * (1.f - t) + b * t; 186 | } 187 | 188 | 189 | Vector3 ViewMatrix::Transform(const Vector3 vector) const 190 | { 191 | Vector3 transformed; 192 | 193 | transformed.x = vector.y * matrix[0][1] + vector.x * matrix[0][0] + vector.z * matrix[0][2] + matrix[0][3]; 194 | transformed.y = vector.y * matrix[1][1] + vector.x * matrix[1][0] + vector.z * matrix[1][2] + matrix[1][3]; 195 | transformed.z = vector.y * matrix[3][1] + vector.x * matrix[3][0] + vector.z * matrix[3][2] + matrix[3][3]; 196 | 197 | return transformed; 198 | } -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Entities/Form.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Form.h" 3 | #include "pch.h" 4 | #include "Form.h" 5 | #include "Drawing.h" 6 | #include "input.h" 7 | #include "Entity.h" 8 | #include "GUI.h" 9 | #include "Graphics.h" 10 | Form::Form(float x, float y, float w, float h, float borderwidth, float borderheight, std::wstring text, bool stretch) 11 | { 12 | Form::Name = text; 13 | Form::Pos = {x, y}; 14 | Form::Size = {w, h}; 15 | Form::OriginalSize = Form::Size; 16 | Form::Stretching = false; 17 | Form::Dragging = false; 18 | Form::Drag = {0, 0}; 19 | Form::Scale.x = (Form::Size.x / Form::OriginalSize.x); 20 | Form::Scale.y = (Form::Size.y / Form::OriginalSize.y); 21 | Form::Border.x = borderwidth; 22 | Form::Border.y = borderheight; 23 | Form::CanStretch = stretch; 24 | Form::CanClose = true; 25 | Form::CanMinimize = true; 26 | SetVisible(true); 27 | } 28 | 29 | void Form::DragAction() 30 | { 31 | if (Form::Dragging && !IsKeyDown(VK_LBUTTON)) 32 | Form::Dragging = false; 33 | 34 | if (Form::Dragging) 35 | { 36 | Form::Pos.x = Form::Cursor.x - Form::Drag.x; 37 | Form::Pos.y = Form::Cursor.y - Form::Drag.y; 38 | } 39 | if (IsMouseInRectangle(Form::Pos, Form::TitleBar)) 40 | { 41 | if (IsKeyClicked(VK_LBUTTON)) // This prevents a user holding down and hovering over the title bar to drag it. You need to actually click down. 42 | Form::Dragging = true; 43 | 44 | Form::Drag.x = Form::Cursor.x - Form::Pos.x; 45 | Form::Drag.y = Form::Cursor.y - Form::Pos.y; 46 | } 47 | } 48 | 49 | void Form::StretchAction() 50 | { 51 | if (Form::Blocked) 52 | return; 53 | // If the user clicks in the rectangle we go through all forms and then set this one as the highest priority to draw 54 | StretchPoint1 = Vector2 {Form::Pos.x + Form::Size.x, Form::Pos.y + Form::Size.y}; 55 | StretchPoint2 = Vector2 {Form::Pos.x + Form::Size.x - (25 * Form::Scale.x), Form::Pos.y + Form::Size.y}; 56 | StretchPoint3 = Vector2 {Form::Pos.x + Form::Size.x, Form::Pos.y + Form::Size.y - (25 * Form::Scale.y)}; 57 | 58 | if (Form::Stretching && !IsKeyDown(VK_LBUTTON)) 59 | { 60 | Form::Stretching = false; 61 | } 62 | 63 | if (Form::Stretching) 64 | { 65 | float stretchx = Form::Cursor.x - Form::Stretch.x; 66 | float stretchy = Form::Cursor.y - Form::Stretch.y; 67 | Vector2 Stretched {stretchx, stretchy}; 68 | // Prevent the gui going below the original scale 69 | if (stretchx > Form::OriginalSize.x && stretchy > Form::OriginalSize.y) 70 | { 71 | Form::Scale.x = (Form::Size.x / Form::OriginalSize.x); 72 | Form::Scale.y = (Form::Size.y / Form::OriginalSize.y); 73 | Form::Size.x = stretchx; 74 | Form::Size.y = stretchy; 75 | } 76 | } 77 | 78 | if (IsMouseInTriangle(StretchPoint1, StretchPoint2, StretchPoint3) && Form::CanStretch) 79 | { 80 | if (IsKeyClicked(VK_LBUTTON)) 81 | Form::Stretching = true; 82 | 83 | Form::Stretch.x = Form::Cursor.x - (Form::Size.x); 84 | Form::Stretch.y = Form::Cursor.y - (Form::Size.y); 85 | } 86 | } 87 | 88 | void Form::Update() 89 | { 90 | if (!Form::Parent) 91 | Form::SetVisible(false); 92 | if (!Form::IsVisible()) 93 | return; 94 | 95 | if (!MenuOpen) 96 | return; 97 | 98 | Form::TitleBar = {Form::Size.x, Form::Border.y}; 99 | Form::Cursor = MousePos; 100 | Form::ParentPos = {Form::Pos.x + Form::Border.x, Form::Pos.y + Form::Border.y}; 101 | if (Form::Blocked) 102 | return; 103 | Form::DragAction(); 104 | Form::StretchAction(); 105 | 106 | Container::Update(); 107 | } 108 | 109 | void Form::Draw() 110 | { 111 | if (!Form::IsVisible()) 112 | return; 113 | if (!MenuOpen) 114 | return; 115 | 116 | MyColour textColour = MenuColours[LIT("Text")]; 117 | MyColour rectColour = MenuColours[LIT("Background")]; 118 | MyColour rectOutlineColour = MenuColours[LIT("Outline")]; 119 | MyColour rectHeaderColour = MenuColours[LIT("Header")]; 120 | 121 | // when someone clicks into a form it will prioritize the drawing of the form. 122 | if (IsMouseInRectangle(Form::Pos, Form::Size) && IsKeyClicked(VK_LBUTTON)) 123 | { 124 | Form::SetLastClick(clock() * 0.00001f); // we multiple it for accuracy purposes to turn it into a float 125 | } 126 | 127 | OutlineRectangle((Form::Pos.x - Form::Border.x / 2) + 1, (Form::Pos.y - Form::Border.x / 2) + 1, Form::Size.x + Form::Border.x - 1, Form::Size.y + Form::Border.x - 1, 1, rectOutlineColour); // Draw Border 128 | FilledRectangle(Form::Pos.x, Form::Pos.y, Form::Size.x, Form::Size.y, rectColour); 129 | FilledRectangle(Form::Pos.x, Form::Pos.y, Form::Size.x, Form::Border.y, rectHeaderColour); // header 130 | FilledRectangle(Form::Pos.x, Form::Pos.y + Form::Border.y, Form::Size.x, 1, MenuColours[LIT("HeaderSeperator")]); 131 | DrawText(Form::Pos.x + 5, Form::Pos.y + 5, Form::Name, LIT("Verdana"), 12, textColour, None); 132 | 133 | Container::Draw(); 134 | } 135 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Misc/Input.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Input.h" 3 | #include "Init.h" 4 | // local scope enum 5 | enum class KeyState 6 | { 7 | KeyDormant = 0, 8 | KeyInvoked = 1, 9 | KeyActive = 2 10 | }; 11 | 12 | // could do dictionaries but we only want to handle ascii 13 | std::map KeyHeld; 14 | std::map KeyStates; 15 | std::map KeyTimes; 16 | 17 | Vector2 MousePos; 18 | WPARAM Char = NULL; 19 | HCURSOR CurrentCursor; 20 | std::map Cursors; 21 | 22 | void CreateCursor(std::string name, HCURSOR cursor) 23 | { 24 | Cursors[name] = cursor; 25 | } 26 | 27 | void SetCurrentCursor(std::string name) 28 | { 29 | CurrentCursor = Cursors[name]; 30 | } 31 | 32 | HCURSOR GetCurrentCursor() 33 | { 34 | return CurrentCursor; 35 | } 36 | 37 | void UpdateKeyState(int key, bool down) 38 | { 39 | if (key < 0 || key >= KeyStates.size()) 40 | return; 41 | KeyTimes[key] = clock() * 0.001f; 42 | if (KeyHeld[key] && !down) 43 | KeyStates[key] = KeyState::KeyDormant; 44 | 45 | if (KeyHeld[key] && down) 46 | KeyStates[key] = KeyState::KeyActive; 47 | 48 | if (!KeyHeld[key] && down) 49 | KeyStates[key] = KeyState::KeyInvoked; 50 | 51 | KeyHeld[key] = down; 52 | } 53 | 54 | LRESULT CALLBACK InputWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 55 | { 56 | switch (message) 57 | { 58 | case WM_MOVE: 59 | SetWindowPos(hWnd, NULL, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_NOZORDER | SWP_NOACTIVATE); 60 | InitD2D(hWnd); 61 | break; 62 | case WM_CHAR: 63 | Char = wParam; 64 | case WM_KEYUP: 65 | case WM_SYSKEYUP: 66 | { 67 | UpdateKeyState(wParam & 0xFF, false); 68 | } 69 | break; 70 | case WM_KEYDOWN: 71 | case WM_SYSKEYDOWN: 72 | { 73 | UpdateKeyState(wParam & 0xFF, true); 74 | } 75 | break; 76 | case WM_LBUTTONUP: 77 | { 78 | UpdateKeyState(VK_LBUTTON, false); 79 | } 80 | break; 81 | 82 | case WM_MBUTTONUP: 83 | { 84 | UpdateKeyState(VK_MBUTTON, false); 85 | } 86 | break; 87 | 88 | case WM_RBUTTONUP: 89 | { 90 | UpdateKeyState(VK_RBUTTON, false); 91 | } 92 | break; 93 | case WM_MOUSEMOVE: 94 | { 95 | //https://stackoverflow.com/questions/21129721/how-does-this-bitmask-apply-to-lparam-wm-hotkey 96 | // prevents calling getcursorpos 97 | MousePos.x = static_cast(lParam & 0xFFFF); 98 | MousePos.y = static_cast((lParam >> 16) & 0xFFFF); 99 | } 100 | break; 101 | case WM_XBUTTONUP: 102 | { 103 | const auto releasedkey = (wParam >> 16) & 0xFFFF; 104 | 105 | if (releasedkey == XBUTTON1) 106 | UpdateKeyState(VK_XBUTTON1, false); 107 | else if (releasedkey == XBUTTON2) 108 | UpdateKeyState(VK_XBUTTON2, false); 109 | } 110 | break; 111 | case WM_XBUTTONDOWN: 112 | { 113 | const auto releasedkey = (wParam >> 16) & 0xFFFF; 114 | 115 | if (releasedkey == XBUTTON1) 116 | UpdateKeyState(VK_XBUTTON1, true); 117 | else if (releasedkey == XBUTTON2) 118 | UpdateKeyState(VK_XBUTTON2, true); 119 | } 120 | break; 121 | case WM_LBUTTONDOWN: 122 | { 123 | UpdateKeyState(VK_LBUTTON, true); 124 | } 125 | break; 126 | case WM_MBUTTONDOWN: 127 | { 128 | UpdateKeyState(VK_MBUTTON, true); 129 | } 130 | break; 131 | case WM_RBUTTONDOWN: 132 | { 133 | UpdateKeyState(VK_RBUTTON, true); 134 | } 135 | break; 136 | 137 | return 0; 138 | } 139 | } 140 | 141 | // check for a held key 142 | bool IsKeyDown(int key) 143 | { 144 | if (key < 0 || key >= KeyStates.size()) 145 | return false; 146 | if (KeyHeld[key] == true) 147 | { 148 | return true; 149 | } 150 | else 151 | return false; 152 | } 153 | 154 | // check for a clicked key 155 | bool IsKeyClicked(int key) 156 | { 157 | if (key < 0 || key >= KeyStates.size()) 158 | return false; 159 | // Check if the click time is below the current time by 0.05 seconds and is invoked, Kinda messy but works well. 160 | if (KeyStates[key] == KeyState::KeyInvoked && (KeyTimes[key]) >= (clock() * 0.001f) - 0.05f) 161 | return true; 162 | else 163 | return false; 164 | } 165 | 166 | // just fill the dictionaries 167 | void SetInput() 168 | { 169 | for (int i = 0; i <= 255; i++) // 255 is for the ascii character set, expand it for utf8 unicode 170 | { 171 | KeyStates[i] = KeyState::KeyDormant; 172 | KeyHeld[i] = false; 173 | } 174 | } 175 | 176 | bool IsMouseInRectangle(int x, int y, int width, int height) 177 | { 178 | return ( 179 | MousePos.x > x && 180 | MousePos.y > y && 181 | MousePos.x < x + width && 182 | MousePos.y < y + height 183 | ); 184 | } 185 | 186 | bool IsMouseInRectangle(Vector2 pos, Vector2 Dimensions) 187 | { 188 | return ( 189 | MousePos.x > pos.x && 190 | MousePos.y > pos.y && 191 | MousePos.x < pos.x + Dimensions.x && 192 | MousePos.y < pos.y + Dimensions.y 193 | ); 194 | } 195 | 196 | float TriangleArea(Vector2 point1, Vector2 point2, Vector2 point3) 197 | { 198 | return (point1.x - point3.x) * (point2.y - point3.y) - (point2.x - point3.x) * (point1.y - point3.y); 199 | } 200 | 201 | bool IsMouseInTriangle(Vector2 point1, Vector2 point2, Vector2 point3) 202 | { 203 | float d1; 204 | float d2; 205 | float d3; 206 | 207 | bool neg; 208 | bool pos; 209 | 210 | d1 = TriangleArea(MousePos, point1, point2); 211 | d2 = TriangleArea(MousePos, point2, point3); 212 | d3 = TriangleArea(MousePos, point3, point1); 213 | 214 | neg = (d1 < 0) || (d2 < 0) || (d3 < 0); 215 | pos = (d1 > 0) || (d2 > 0) || (d3 > 0); 216 | 217 | return !(neg && pos); 218 | } 219 | -------------------------------------------------------------------------------- /PubgDMA/PubgDMA/Graphics/Start Up/GUI.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "GUI.h" 3 | #include "entity.h" 4 | #include "Form.h" 5 | #include "Button.h" 6 | #include "ColourPicker.h" 7 | #include "Label.h" 8 | #include "tab.h" 9 | #include "TabController.h" 10 | #include "Toggle.h" 11 | #include "Slider.h" 12 | #include "DropDown.h" 13 | #include "ComboBox.h" 14 | #include "KeyBind.h" 15 | #include "TabListBox.h" 16 | #include "TabListBoxController.h" 17 | #include "TextBox.h" 18 | #include "ConfigUtilities.h" 19 | int SelectedTab = 1; 20 | int SelectedSubTab = 0; 21 | int TabCount = 0; 22 | int KeyBindClipBoard = 0; 23 | EntityVector MenuEntity; 24 | bool MenuOpen = true; 25 | D2D1::ColorF ColourPickerClipBoard = Colour(255,255,255); 26 | D2D1::ColorF ColourPick = Colour(0, 150, 255, 255); 27 | std::wstring ScreenWidth = std::to_wstring(Configs.Overlay.Width); 28 | std::wstring ScreenHeight = std::to_wstring(Configs.Overlay.Height); 29 | void CreateGUI() 30 | { 31 | MenuEntity = std::make_shared(); 32 | auto form = std::make_shared
(100, 100.0f, 300, 200, 2, 30, LIT(L"PUBG Cheat By ISTAR"), false); 33 | { 34 | auto tabcontroller = std::make_shared(); 35 | form->Push(tabcontroller); 36 | 37 | auto playeresptab = std::make_shared(LIT(L"Player ESP"), 5, 5, &SelectedTab, 0, 20); 38 | { 39 | auto name = std::make_shared(100, 5, LIT(L"Name"), &Configs.Survivor.Name); 40 | playeresptab->Push(name); 41 | auto textcolour = std::make_shared(160, 6, &Configs.Survivor.TextColour); 42 | playeresptab->Push(textcolour); 43 | auto distance = std::make_shared(100, 25, LIT(L"Distance"), &Configs.Survivor.Distance); 44 | playeresptab->Push(distance); 45 | auto maxdistance = std::make_shared>(100, 45, 150, LIT(L"Max Distance"), LIT(L"m"), 0, 1000, &Configs.Survivor.MaxDistance); 46 | playeresptab->Push(maxdistance); 47 | auto textsize = std::make_shared>(100, 70, 150, LIT(L"Text Size"), LIT(L"px"), 4, 16, &Configs.Survivor.FontSize); 48 | playeresptab->Push(textsize); 49 | } 50 | tabcontroller->Push(playeresptab); 51 | //auto killeresptab = std::make_shared(LIT(L"Killer ESP"), 5, 30, &SelectedTab, 0, 20); 52 | //{ 53 | // auto name = std::make_shared(100, 5, LIT(L"Name"), &Configs.Killer.Name); 54 | // killeresptab->Push(name); 55 | // auto textcolour = std::make_shared(160, 6, &Configs.Killer.TextColour); 56 | // killeresptab->Push(textcolour); 57 | // auto distance = std::make_shared(100, 25, LIT(L"Distance"), &Configs.Killer.Distance); 58 | // killeresptab->Push(distance); 59 | // auto maxdistance = std::make_shared>(100, 45, 150, LIT(L"Max Distance"), LIT(L"m"), 0, 1000, &Configs.Killer.MaxDistance); 60 | // killeresptab->Push(maxdistance); 61 | // auto textsize = std::make_shared>(100, 70, 150, LIT(L"Text Size"), LIT(L"px"), 4, 16, &Configs.Killer.FontSize); 62 | // killeresptab->Push(textsize); 63 | //} 64 | //tabcontroller->Push(killeresptab); 65 | auto overlaytab = std::make_shared(LIT(L"Overlay"), 5, 30, &SelectedTab, 0, 20); 66 | { 67 | auto overrideresolution = std::make_shared(100, 5, LIT(L"Override W2S Resolution"), &Configs.Overlay.OverrideResolution); 68 | overlaytab->Push(overrideresolution); 69 | auto screenwidth = std::make_shared(100, 35, LIT(L"Screen Width"), &ScreenWidth); 70 | screenwidth->SetValueChangedEvent([]() 71 | { 72 | try 73 | { 74 | Configs.Overlay.Width = std::stoi(ScreenWidth); 75 | } 76 | catch (std::exception ex) 77 | { 78 | } 79 | }); 80 | overlaytab->Push(screenwidth); 81 | auto screenheight = std::make_shared(100, 55, LIT(L"Screen Height"), &ScreenHeight); 82 | screenheight->SetValueChangedEvent([]() 83 | { 84 | try 85 | { 86 | Configs.Overlay.Height = std::stoi(ScreenHeight); 87 | } 88 | catch (std::exception ex) 89 | { 90 | } 91 | }); 92 | overlaytab->Push(screenheight); 93 | 94 | 95 | } 96 | tabcontroller->Push(overlaytab); 97 | auto configtab = std::make_shared(LIT(L"Config"), 5, 55, &SelectedTab, 0, 20); 98 | { 99 | auto saveconfig = std::make_shared