├── .gitattributes ├── .gitignore ├── Hunt DMA.sln ├── HuntDMA ├── Aimbot │ ├── Aimbot.cpp │ └── Aimbot.h ├── Config │ ├── AimbotConfig.h │ ├── BloodBondsConfig.h │ ├── BossesConfig.h │ ├── ConfigInstance.h │ ├── ConfigUtilities.cpp │ ├── ConfigUtilities.h │ ├── OverlayConfig.h │ ├── POIConfig.h │ ├── PlayerConfig.h │ ├── SupplyConfig.h │ └── TrapConfig.h ├── Esp │ ├── OtherEsp.cpp │ ├── OtherEsp.h │ ├── PlayerEsp.cpp │ └── PlayerEsp.h ├── Globals.h ├── Graphics │ ├── Drawing.cpp │ ├── Drawing.h │ ├── Entities │ │ ├── Button.cpp │ │ ├── Button.h │ │ ├── ColourPicker.cpp │ │ ├── ColourPicker.h │ │ ├── ComboBox.cpp │ │ ├── ComboBox.h │ │ ├── DropDown.cpp │ │ ├── DropDown.h │ │ ├── Entity.cpp │ │ ├── Entity.h │ │ ├── Form.cpp │ │ ├── Form.h │ │ ├── KeyBind.cpp │ │ ├── KeyBind.h │ │ ├── Label.cpp │ │ ├── Label.h │ │ ├── Slider.h │ │ ├── Tab.cpp │ │ ├── Tab.h │ │ ├── TabController.cpp │ │ ├── TabController.h │ │ ├── TabListBox.cpp │ │ ├── TabListBox.h │ │ ├── TabListBoxController.cpp │ │ ├── TabListBoxController.h │ │ ├── TextBox.cpp │ │ ├── TextBox.h │ │ ├── Toggle.cpp │ │ └── Toggle.h │ ├── Graphics.h │ ├── Start Up │ │ ├── GUI.cpp │ │ ├── GUI.h │ │ ├── Init.cpp │ │ └── Init.h │ └── Utility │ │ ├── Animation.cpp │ │ ├── Animation.h │ │ ├── Colour.cpp │ │ ├── Colour.h │ │ ├── Font.cpp │ │ ├── Font.h │ │ ├── Kmbox.cpp │ │ └── Kmbox.h ├── HuntDMA.filters ├── HuntDMA.vcxproj ├── Main.cpp ├── Memory │ ├── InputManager.cpp │ ├── InputManager.h │ ├── Memory.cpp │ ├── Memory.h │ ├── Registry.cpp │ └── Registry.h ├── Misc │ ├── CheatFunction.cpp │ ├── CheatFunction.h │ ├── FPS.cpp │ ├── FPS.h │ ├── Input.cpp │ ├── Input.h │ ├── Pch │ │ ├── Pch.cpp │ │ └── Pch.h │ ├── SpectatorAlarm.cpp │ ├── SpectatorAlarm.h │ ├── Vector.cpp │ └── Vector.h ├── SDK │ ├── Camera.cpp │ ├── Camera.h │ ├── Environment.cpp │ ├── Environment.h │ ├── WorldEntity.cpp │ └── WorldEntity.h └── Security │ └── XorStr.h ├── Images ├── 2.png ├── 4.png ├── 5.png └── 6.png ├── Include ├── json.hpp ├── leechcore.h └── vmmdll.h ├── Instructions.md ├── LICENSE ├── Lib ├── FTD3XX.lib ├── leechcore.lib └── vmm.lib └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /Hunt DMA.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}") = "HuntDMA", "HuntDMA\HuntDMA.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 | -------------------------------------------------------------------------------- /HuntDMA/Aimbot/Aimbot.cpp: -------------------------------------------------------------------------------- 1 | #include "Pch.h" 2 | #include "aimbot.h" 3 | #include "PlayerEsp.h" 4 | #include "globals.h" 5 | #include "CheatFunction.h" 6 | #include "Drawing.h" 7 | #include "ConfigInstance.h" 8 | #include 9 | #include "ConfigUtilities.h" 10 | #include "Kmbox.h" 11 | #include "InputManager.h" 12 | 13 | int ConditionalSwapPlayer(std::vector>& entities, int low, int high) 14 | { 15 | std::shared_ptr pivot = entities[high]; 16 | int i = low - 1; 17 | Vector2 centreofscreen = Vector2(Configs.Overlay.OverrideResolution ? Configs.Overlay.Width / 2 : GetSystemMetrics(SM_CXSCREEN) / 2, Configs.Overlay.OverrideResolution ? Configs.Overlay.Height *0.6f : GetSystemMetrics(SM_CYSCREEN) *0.6f); 18 | for (int j = low; j < high; ++j) 19 | { 20 | if (Configs.Aimbot.Priority == 2) 21 | { 22 | if (Vector2::Distance(centreofscreen, CameraInstance->WorldToScreen(entities[j]->GetPosition())) < Vector2::Distance(centreofscreen, CameraInstance->WorldToScreen(pivot->GetPosition()))) 23 | { 24 | ++i; 25 | std::swap(entities[i], entities[j]); 26 | continue; 27 | } 28 | if (Vector3::Distance(CameraInstance->GetPosition(), entities[j]->GetPosition()) < Vector3::Distance(CameraInstance->GetPosition(), pivot->GetPosition())) 29 | { 30 | ++i; 31 | std::swap(entities[i], entities[j]); 32 | } 33 | } 34 | if (Configs.Aimbot.Priority == 0) 35 | { 36 | if (Vector3::Distance(CameraInstance->GetPosition(), entities[j]->GetPosition()) < Vector3::Distance(CameraInstance->GetPosition(), pivot->GetPosition())) 37 | { 38 | ++i; 39 | std::swap(entities[i], entities[j]); 40 | } 41 | } 42 | if (Configs.Aimbot.Priority == 1) 43 | { 44 | if (Vector2::Distance(centreofscreen, CameraInstance->WorldToScreen(entities[j]->GetPosition())) < Vector2::Distance(centreofscreen, CameraInstance->WorldToScreen(pivot->GetPosition()))) 45 | { 46 | ++i; 47 | std::swap(entities[i], entities[j]); 48 | } 49 | } 50 | } 51 | std::swap(entities[i + 1], entities[high]); 52 | return i + 1; 53 | } 54 | 55 | void QuickSortPlayers(std::vector>& entities, int low, int high) 56 | { 57 | if (low < high) 58 | { 59 | int pi = ConditionalSwapPlayer(entities, low, high); 60 | QuickSortPlayers(entities, low, pi - 1); 61 | QuickSortPlayers(entities, pi + 1, high); 62 | } 63 | } 64 | std::shared_ptr AimbotTarget; 65 | bool StickTarget() 66 | { 67 | Vector2 centreofscreen = Vector2(Configs.Overlay.OverrideResolution ? Configs.Overlay.Width / 2 : GetSystemMetrics(SM_CXSCREEN) / 2, Configs.Overlay.OverrideResolution ? Configs.Overlay.Height * 0.6f : GetSystemMetrics(SM_CYSCREEN) * 0.6f); 68 | if (CameraInstance == nullptr) 69 | return false; 70 | if (EnvironmentInstance == nullptr) 71 | return false; 72 | if (AimbotTarget== nullptr) 73 | return false; 74 | if (!AimbotTarget->GetValid()) 75 | return false; 76 | if (Vector3::Distance(CameraInstance->GetPosition(), AimbotTarget->GetPosition()) > Configs.Aimbot.MaxDistance) 77 | return false; 78 | if (CameraInstance->WorldToScreen(AimbotTarget->GetPosition()) == Vector2::Zero()) 79 | return false; 80 | if (AimbotTarget->GetType() == EntityType::EnemyPlayer && !Configs.Aimbot.TargetPlayers) 81 | return false; 82 | if (Vector2::Distance(CameraInstance->WorldToScreen(AimbotTarget->GetPosition()), centreofscreen) > Configs.Aimbot.FOV) 83 | return false; 84 | return true; 85 | } 86 | 87 | void GetAimbotTarget() 88 | { 89 | if (CameraInstance == nullptr) 90 | return; 91 | if (EnvironmentInstance == nullptr) 92 | return; 93 | if (!Configs.Aimbot.Enable) 94 | return; 95 | if(StickTarget()) 96 | return; 97 | Vector2 centreofscreen = Vector2(Configs.Overlay.OverrideResolution ? Configs.Overlay.Width / 2 : GetSystemMetrics(SM_CXSCREEN) / 2, Configs.Overlay.OverrideResolution ? Configs.Overlay.Height * 0.6f : GetSystemMetrics(SM_CYSCREEN) * 0.6f); 98 | 99 | std::vector> templist; 100 | Vector3 localpos = CameraInstance->GetPosition(); 101 | std::lock_guard lock(EnvironmentInstance->PlayerListMutex); 102 | { 103 | templist = EnvironmentInstance->GetPlayerList(); 104 | } 105 | if (templist.size() == 0) 106 | { 107 | return; 108 | } 109 | 110 | QuickSortPlayers(templist, 0, templist.size() - 1); 111 | 112 | for (std::shared_ptr player : templist) 113 | { 114 | if(player == nullptr) 115 | continue; 116 | if (!Configs.Aimbot.TargetPlayers) 117 | continue; 118 | if (!player->GetValid()) 119 | continue; 120 | if (player->GetType() == EntityType::FriendlyPlayer) 121 | continue; 122 | if (Vector3::Distance(CameraInstance->GetPosition(), player->GetPosition()) <= 2.0f) // local player 123 | continue; 124 | if (Vector3::Distance(CameraInstance->GetPosition(), player->GetPosition()) > Configs.Aimbot.MaxDistance) 125 | continue; 126 | if (CameraInstance->WorldToScreen(player->GetPosition()) == Vector2::Zero()) 127 | continue; 128 | if (Vector2::Distance(CameraInstance->WorldToScreen(player->GetPosition()), centreofscreen) >Configs.Aimbot.FOV) 129 | continue; 130 | AimbotTarget = player; 131 | // printf("Targeting: %s\n", AimbotTarget->GetName().c_str()); 132 | return; 133 | } 134 | AimbotTarget = nullptr; 135 | } 136 | bool AimKeyDown = false; 137 | std::shared_ptr UpdateAimKey = std::make_shared(50, [] { 138 | if (EnvironmentInstance == nullptr) 139 | return; 140 | if (EnvironmentInstance->GetObjectCount() == 0) 141 | return; 142 | if (Keyboard::IsKeyDown(Configs.Aimbot.Aimkey)) 143 | { 144 | AimKeyDown = true; 145 | } 146 | else 147 | { 148 | AimKeyDown = false; 149 | } 150 | }); 151 | std::chrono::system_clock::time_point KmboxStart; 152 | void Aimbot() 153 | { 154 | UpdateAimKey->Execute(); 155 | if (!kmbox::connected || !AimKeyDown) 156 | { 157 | AimbotTarget = nullptr; 158 | return; 159 | } 160 | GetAimbotTarget(); 161 | if (AimbotTarget == nullptr) 162 | return; 163 | 164 | if (AimbotTarget->GetPosition() == Vector3::Zero()) 165 | { 166 | AimbotTarget = nullptr; 167 | return; 168 | } 169 | Vector2 screenpos = CameraInstance->WorldToScreen(AimbotTarget->GetPosition()); 170 | Vector2 centreofscreen = Vector2(Configs.Overlay.OverrideResolution ? Configs.Overlay.Width / 2 : GetSystemMetrics(SM_CXSCREEN) / 2, Configs.Overlay.OverrideResolution ? Configs.Overlay.Height * 0.6f : GetSystemMetrics(SM_CYSCREEN) * 0.6f); 171 | if (Vector2::Distance(screenpos, centreofscreen) > Configs.Aimbot.FOV) 172 | return; 173 | if (screenpos == Vector2::Zero()) 174 | { 175 | AimbotTarget = nullptr; 176 | return; 177 | } 178 | 179 | float x = screenpos.x - centreofscreen.x; 180 | 181 | if (KmboxStart + std::chrono::milliseconds(55) < std::chrono::system_clock::now()) 182 | { 183 | kmbox::move(x,0); 184 | KmboxStart = std::chrono::system_clock::now(); 185 | } 186 | 187 | } -------------------------------------------------------------------------------- /HuntDMA/Aimbot/Aimbot.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | void Aimbot(); -------------------------------------------------------------------------------- /HuntDMA/Config/AimbotConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | class AimbotConfig 4 | { 5 | std::string ConfigName; 6 | 7 | public: 8 | AimbotConfig(const std::string& name) 9 | { 10 | ConfigName = name; 11 | } 12 | bool Enable = false; 13 | int MaxDistance = 250; 14 | bool TargetPlayers = false; 15 | int Priority = 0; 16 | int FOV = 200; 17 | int Aimkey = 5; 18 | bool DrawFOV = false; 19 | D2D1::ColorF FOVColour = D2D1::ColorF::White; 20 | void ToJsonColour(json* j, const std::string& name, D2D1::ColorF* colour) 21 | { 22 | (*j)[ConfigName][name][LIT("r")] = colour->r; 23 | (*j)[ConfigName][name][LIT("g")] = colour->g; 24 | (*j)[ConfigName][name][LIT("b")] = colour->b; 25 | (*j)[ConfigName][name][LIT("a")] = colour->a; 26 | 27 | } 28 | void FromJsonColour(json j, const std::string& name, D2D1::ColorF* colour) 29 | { 30 | if (j[ConfigName].contains(name)) 31 | { 32 | colour->r = j[ConfigName][name][LIT("r")]; 33 | colour->g = j[ConfigName][name][LIT("g")]; 34 | colour->b = j[ConfigName][name][LIT("b")]; 35 | colour->a = j[ConfigName][name][LIT("a")]; 36 | } 37 | } 38 | 39 | json ToJson() 40 | { 41 | json j; 42 | j[ConfigName][LIT("Enable")] = Enable; 43 | j[ConfigName][LIT("MaxDistance")] = MaxDistance; 44 | j[ConfigName][LIT("TargetPlayers")] = TargetPlayers; 45 | j[ConfigName][LIT("Priority")] = Priority; 46 | j[ConfigName][LIT("FOV")] = FOV; 47 | j[ConfigName][LIT("Aimkey")] = Aimkey; 48 | j[ConfigName][LIT("DrawFOV")] = DrawFOV; 49 | ToJsonColour(&j, LIT("FOVColour"), &FOVColour); 50 | 51 | 52 | 53 | return j; 54 | } 55 | void FromJson(const json& j) 56 | { 57 | if (!j.contains(ConfigName)) 58 | return; 59 | if (j[ConfigName].contains(LIT("Enable"))) 60 | Enable = j[ConfigName][LIT("Enable")]; 61 | if (j[ConfigName].contains(LIT("MaxDistance"))) 62 | MaxDistance = j[ConfigName][LIT("MaxDistance")]; 63 | if (j[ConfigName].contains(LIT("TargetPlayers"))) 64 | TargetPlayers = j[ConfigName][LIT("TargetPlayers")]; 65 | if (j[ConfigName].contains(LIT("Priority"))) 66 | Priority = j[ConfigName][LIT("Priority")]; 67 | if (j[ConfigName].contains(LIT("FOV"))) 68 | FOV = j[ConfigName][LIT("FOV")]; 69 | if (j[ConfigName].contains(LIT("Aimkey"))) 70 | Aimkey = j[ConfigName][LIT("Aimkey")]; 71 | if (j[ConfigName].contains(LIT("DrawFOV"))) 72 | DrawFOV = j[ConfigName][LIT("DrawFOV")]; 73 | FromJsonColour(j, LIT("FOVColour"), &FOVColour); 74 | } 75 | }; 76 | 77 | -------------------------------------------------------------------------------- /HuntDMA/Config/BloodBondsConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | class BloodBondsConfig 4 | { 5 | std::string ConfigName; 6 | 7 | public: 8 | BloodBondsConfig(const std::string& name) 9 | { 10 | ConfigName = name; 11 | } 12 | bool Enable = true; 13 | bool Name = true; 14 | bool Distance = true; 15 | int MaxDistance = 1500; 16 | D2D1::ColorF TextColour = Colour(255, 165, 0); 17 | int FontSize = 13; 18 | void ToJsonColour(json* j, const std::string& name, D2D1::ColorF* colour) 19 | { 20 | (*j)[ConfigName][name][LIT("r")] = colour->r; 21 | (*j)[ConfigName][name][LIT("g")] = colour->g; 22 | (*j)[ConfigName][name][LIT("b")] = colour->b; 23 | (*j)[ConfigName][name][LIT("a")] = colour->a; 24 | 25 | } 26 | void FromJsonColour(json j, const std::string& name, D2D1::ColorF* colour) 27 | { 28 | if (j[ConfigName].contains(name)) 29 | { 30 | colour->r = j[ConfigName][name][LIT("r")]; 31 | colour->g = j[ConfigName][name][LIT("g")]; 32 | colour->b = j[ConfigName][name][LIT("b")]; 33 | colour->a = j[ConfigName][name][LIT("a")]; 34 | } 35 | } 36 | 37 | json ToJson() 38 | { 39 | json j; 40 | j[ConfigName][LIT("Enable")] = Enable; 41 | j[ConfigName][LIT("Name")] = Name; 42 | j[ConfigName][LIT("Distance")] = Distance; 43 | j[ConfigName][LIT("MaxDistance")] = MaxDistance; 44 | j[ConfigName][LIT("FontSize")] = FontSize; 45 | ToJsonColour(&j, LIT("TextColour"), &TextColour); 46 | 47 | return j; 48 | } 49 | void FromJson(const json& j) 50 | { 51 | if (!j.contains(ConfigName)) 52 | return; 53 | if (j[ConfigName].contains(LIT("Enable"))) 54 | Enable = j[ConfigName][LIT("Enable")]; 55 | if (j[ConfigName].contains(LIT("Name"))) 56 | Name = j[ConfigName][LIT("Name")]; 57 | if (j[ConfigName].contains(LIT("Distance"))) 58 | Distance = j[ConfigName][LIT("Distance")]; 59 | if (j[ConfigName].contains(LIT("FontSize"))) 60 | FontSize = j[ConfigName][LIT("FontSize")]; 61 | if (j[ConfigName].contains(LIT("MaxDistance"))) 62 | MaxDistance = j[ConfigName][LIT("MaxDistance")]; 63 | FromJsonColour(j, LIT("TextColour"), &TextColour); 64 | } 65 | }; 66 | 67 | -------------------------------------------------------------------------------- /HuntDMA/Config/BossesConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | class BossesConfig 4 | { 5 | std::string ConfigName; 6 | 7 | public: 8 | BossesConfig(const std::string& name) 9 | { 10 | ConfigName = name; 11 | } 12 | bool Enable = true; 13 | bool Name = true; 14 | bool Distance = true; 15 | int MaxDistance = 1500; 16 | D2D1::ColorF TextColour = Colour(255, 255, 0); 17 | int FontSize = 11; 18 | void ToJsonColour(json* j, const std::string& name, D2D1::ColorF* colour) 19 | { 20 | (*j)[ConfigName][name][LIT("r")] = colour->r; 21 | (*j)[ConfigName][name][LIT("g")] = colour->g; 22 | (*j)[ConfigName][name][LIT("b")] = colour->b; 23 | (*j)[ConfigName][name][LIT("a")] = colour->a; 24 | 25 | } 26 | void FromJsonColour(json j, const std::string& name, D2D1::ColorF* colour) 27 | { 28 | if (j[ConfigName].contains(name)) 29 | { 30 | colour->r = j[ConfigName][name][LIT("r")]; 31 | colour->g = j[ConfigName][name][LIT("g")]; 32 | colour->b = j[ConfigName][name][LIT("b")]; 33 | colour->a = j[ConfigName][name][LIT("a")]; 34 | } 35 | } 36 | 37 | json ToJson() 38 | { 39 | json j; 40 | j[ConfigName][LIT("Enable")] = Enable; 41 | j[ConfigName][LIT("Name")] = Name; 42 | j[ConfigName][LIT("Distance")] = Distance; 43 | j[ConfigName][LIT("MaxDistance")] = MaxDistance; 44 | j[ConfigName][LIT("FontSize")] = FontSize; 45 | ToJsonColour(&j, LIT("TextColour"), &TextColour); 46 | 47 | return j; 48 | } 49 | void FromJson(const json& j) 50 | { 51 | if (!j.contains(ConfigName)) 52 | return; 53 | if (j[ConfigName].contains(LIT("Enable"))) 54 | Enable = j[ConfigName][LIT("Enable")]; 55 | if (j[ConfigName].contains(LIT("Name"))) 56 | Name = j[ConfigName][LIT("Name")]; 57 | if (j[ConfigName].contains(LIT("Distance"))) 58 | Distance = j[ConfigName][LIT("Distance")]; 59 | if (j[ConfigName].contains(LIT("FontSize"))) 60 | FontSize = j[ConfigName][LIT("FontSize")]; 61 | if (j[ConfigName].contains(LIT("MaxDistance"))) 62 | MaxDistance = j[ConfigName][LIT("MaxDistance")]; 63 | FromJsonColour(j, LIT("TextColour"), &TextColour); 64 | } 65 | }; 66 | 67 | -------------------------------------------------------------------------------- /HuntDMA/Config/ConfigInstance.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Pch.h" 3 | #include "PlayerConfig.h" 4 | #include "BossesConfig.h" 5 | #include "SupplyConfig.h" 6 | #include "BloodBondsConfig.h" 7 | #include "TrapConfig.h" 8 | #include "POIConfig.h" 9 | #include "OverlayConfig.h" 10 | #include "AimbotConfig.h" 11 | class ConfigInstances 12 | { 13 | public: 14 | PlayerConfig Player = PlayerConfig(LIT("Player")); 15 | BossesConfig Bosses = BossesConfig(LIT("Bosses")); 16 | SupplyConfig Supply = SupplyConfig(LIT("Supply")); 17 | BloodBondsConfig BloodBonds = BloodBondsConfig(LIT("BloodBouds")); 18 | TrapConfig Trap = TrapConfig(LIT("Trap")); 19 | POIConfig POI = POIConfig(LIT("POI")); 20 | OverlayConfig Overlay = OverlayConfig(LIT("Overlay")); 21 | AimbotConfig Aimbot = AimbotConfig(LIT("Aimbot")); 22 | 23 | 24 | json ToJson() 25 | { 26 | json jsoned; 27 | jsoned.merge_patch(Player.ToJson()); 28 | jsoned.merge_patch(Bosses.ToJson()); 29 | jsoned.merge_patch(Supply.ToJson()); 30 | jsoned.merge_patch(BloodBonds.ToJson()); 31 | jsoned.merge_patch(Trap.ToJson()); 32 | jsoned.merge_patch(POI.ToJson()); 33 | 34 | jsoned.merge_patch(Overlay.ToJson()); 35 | jsoned.merge_patch(Aimbot.ToJson()); 36 | return jsoned; 37 | } 38 | 39 | void FromJson(json jsoned) 40 | { 41 | Player.FromJson(jsoned); 42 | Bosses.FromJson(jsoned); 43 | Supply.FromJson(jsoned); 44 | BloodBonds.FromJson(jsoned); 45 | Trap.FromJson(jsoned); 46 | POI.FromJson(jsoned); 47 | Overlay.FromJson(jsoned); 48 | Aimbot.FromJson(jsoned); 49 | } 50 | }; -------------------------------------------------------------------------------- /HuntDMA/Config/ConfigUtilities.cpp: -------------------------------------------------------------------------------- 1 | #include "Pch.h" 2 | #include "ConfigUtilities.h" 3 | #include "ConfigInstance.h" 4 | 5 | json Config; 6 | ConfigInstances Configs; 7 | std::filesystem::path DefaultConfigPath = std::filesystem::path(LIT("DefaultConfig.json")); 8 | std::filesystem::path ConfigPath = std::filesystem::path(LIT("Config.json")); 9 | 10 | void SetUpConfig() 11 | { 12 | SaveConfig(DefaultConfigPath); 13 | std::filesystem::exists(ConfigPath) ? LoadConfig(ConfigPath) : SaveConfig(ConfigPath); 14 | } 15 | void SaveConfig(const std::filesystem::path& filePath) 16 | { 17 | Config = json::array(); 18 | Config = Configs.ToJson(); 19 | std::string jsonstring = Config.dump() + "\n"; 20 | 21 | std::ofstream file(filePath); 22 | if (file.is_open()) { 23 | file << jsonstring; 24 | file.close(); 25 | } 26 | 27 | } 28 | 29 | void LoadConfig(const std::filesystem::path& filePath) 30 | { 31 | if (!std::filesystem::exists(filePath)) { 32 | return; 33 | } 34 | 35 | std::ifstream file(filePath); 36 | if (file.is_open()) { 37 | std::stringstream buffer; 38 | buffer << file.rdbuf(); 39 | std::string jsonstring = buffer.str(); 40 | 41 | if (json::accept(jsonstring)) { 42 | Config = json::parse(jsonstring); 43 | Configs.FromJson(Config); 44 | 45 | } 46 | file.close(); 47 | } 48 | } -------------------------------------------------------------------------------- /HuntDMA/Config/ConfigUtilities.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ConfigInstance.h" 3 | 4 | extern std::filesystem::path DefaultConfigPath; 5 | extern std::filesystem::path ConfigPath; 6 | extern ConfigInstances Configs; 7 | extern void SetUpConfig(); 8 | 9 | void SaveConfig(const std::filesystem::path& filePath); 10 | void LoadConfig(const std::filesystem::path& filePath); -------------------------------------------------------------------------------- /HuntDMA/Config/OverlayConfig.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 | bool ShowFPS = true; 16 | int FpsFontSize = 15; 17 | int CrosshairType = 0; 18 | int CrosshairSize = 3; 19 | D2D1::ColorF CrosshairColour = Colour(0, 150, 255); 20 | void ToJsonColour(json* j, const std::string& name, D2D1::ColorF* colour) 21 | { 22 | (*j)[ConfigName][name][LIT("r")] = colour->r; 23 | (*j)[ConfigName][name][LIT("g")] = colour->g; 24 | (*j)[ConfigName][name][LIT("b")] = colour->b; 25 | (*j)[ConfigName][name][LIT("a")] = colour->a; 26 | 27 | } 28 | void FromJsonColour(json j, const std::string& name, D2D1::ColorF* colour) 29 | { 30 | if (j[ConfigName].contains(name)) 31 | { 32 | colour->r = j[ConfigName][name][LIT("r")]; 33 | colour->g = j[ConfigName][name][LIT("g")]; 34 | colour->b = j[ConfigName][name][LIT("b")]; 35 | colour->a = j[ConfigName][name][LIT("a")]; 36 | } 37 | } 38 | 39 | json ToJson() 40 | { 41 | json j; 42 | j[ConfigName][LIT("OverrideResolution")] = OverrideResolution; 43 | j[ConfigName][LIT("Width")] = Width; 44 | j[ConfigName][LIT("Height")] = Height; 45 | j[ConfigName][LIT("ShowFPS")] = ShowFPS; 46 | j[ConfigName][LIT("FpsFontSize")] = FpsFontSize; 47 | j[ConfigName][LIT("CrosshairType")] = CrosshairType; 48 | j[ConfigName][LIT("CrosshairSize")] = CrosshairSize; 49 | ToJsonColour(&j, LIT("CrosshairColour"), &CrosshairColour); 50 | 51 | return j; 52 | } 53 | void FromJson(const json& j) 54 | { 55 | if (!j.contains(ConfigName)) 56 | return; 57 | if (j[ConfigName].contains(LIT("OverrideResolution"))) 58 | OverrideResolution = j[ConfigName][LIT("OverrideResolution")]; 59 | if (j[ConfigName].contains(LIT("Width"))) 60 | Width = j[ConfigName][LIT("Width")]; 61 | if (j[ConfigName].contains(LIT("Height"))) 62 | Height = j[ConfigName][LIT("Height")]; 63 | if (j[ConfigName].contains(LIT("ShowFPS"))) 64 | ShowFPS = j[ConfigName][LIT("ShowFPS")]; 65 | if (j[ConfigName].contains(LIT("FpsFontSize"))) 66 | FpsFontSize = j[ConfigName][LIT("FpsFontSize")]; 67 | if (j[ConfigName].contains(LIT("CrosshairType"))) 68 | CrosshairType = j[ConfigName][LIT("CrosshairType")]; 69 | if (j[ConfigName].contains(LIT("CrosshairSize"))) 70 | CrosshairSize = j[ConfigName][LIT("CrosshairSize")]; 71 | FromJsonColour(j, LIT("CrosshairColour"), &CrosshairColour); 72 | } 73 | }; 74 | 75 | -------------------------------------------------------------------------------- /HuntDMA/Config/POIConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | class POIConfig 4 | { 5 | std::string ConfigName; 6 | 7 | public: 8 | POIConfig(const std::string& name) 9 | { 10 | ConfigName = name; 11 | } 12 | bool Enable = true; 13 | bool Name = true; 14 | bool Distance = true; 15 | int MaxDistance = 1500; 16 | D2D1::ColorF TextColour = Colour(221, 255, 0); 17 | int FontSize = 13; 18 | void ToJsonColour(json* j, const std::string& name, D2D1::ColorF* colour) 19 | { 20 | (*j)[ConfigName][name][LIT("r")] = colour->r; 21 | (*j)[ConfigName][name][LIT("g")] = colour->g; 22 | (*j)[ConfigName][name][LIT("b")] = colour->b; 23 | (*j)[ConfigName][name][LIT("a")] = colour->a; 24 | 25 | } 26 | void FromJsonColour(json j, const std::string& name, D2D1::ColorF* colour) 27 | { 28 | if (j[ConfigName].contains(name)) 29 | { 30 | colour->r = j[ConfigName][name][LIT("r")]; 31 | colour->g = j[ConfigName][name][LIT("g")]; 32 | colour->b = j[ConfigName][name][LIT("b")]; 33 | colour->a = j[ConfigName][name][LIT("a")]; 34 | } 35 | } 36 | 37 | json ToJson() 38 | { 39 | json j; 40 | j[ConfigName][LIT("Enable")] = Enable; 41 | j[ConfigName][LIT("Name")] = Name; 42 | j[ConfigName][LIT("Distance")] = Distance; 43 | j[ConfigName][LIT("MaxDistance")] = MaxDistance; 44 | j[ConfigName][LIT("FontSize")] = FontSize; 45 | ToJsonColour(&j, LIT("TextColour"), &TextColour); 46 | 47 | return j; 48 | } 49 | void FromJson(const json& j) 50 | { 51 | if (!j.contains(ConfigName)) 52 | return; 53 | if (j[ConfigName].contains(LIT("Enable"))) 54 | Enable = j[ConfigName][LIT("Enable")]; 55 | if (j[ConfigName].contains(LIT("Name"))) 56 | Name = j[ConfigName][LIT("Name")]; 57 | if (j[ConfigName].contains(LIT("Distance"))) 58 | Distance = j[ConfigName][LIT("Distance")]; 59 | if (j[ConfigName].contains(LIT("FontSize"))) 60 | FontSize = j[ConfigName][LIT("FontSize")]; 61 | if (j[ConfigName].contains(LIT("MaxDistance"))) 62 | MaxDistance = j[ConfigName][LIT("MaxDistance")]; 63 | FromJsonColour(j, LIT("TextColour"), &TextColour); 64 | } 65 | }; 66 | 67 | -------------------------------------------------------------------------------- /HuntDMA/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 Enable = true; 13 | bool Name = true; 14 | bool Distance = true; 15 | int MaxDistance = 1500; 16 | D2D1::ColorF TextColour = Colour(255, 255, 255); 17 | int FontSize = 12; 18 | bool Chams = false; 19 | int ChamMode = 0; 20 | bool DrawFriends = false; 21 | D2D1::ColorF FriendColour = Colour(0, 255, 0); 22 | void ToJsonColour(json* j, const std::string& name, D2D1::ColorF* colour) 23 | { 24 | (*j)[ConfigName][name][LIT("r")] = colour->r; 25 | (*j)[ConfigName][name][LIT("g")] = colour->g; 26 | (*j)[ConfigName][name][LIT("b")] = colour->b; 27 | (*j)[ConfigName][name][LIT("a")] = colour->a; 28 | 29 | } 30 | void FromJsonColour(json j, const std::string& name, D2D1::ColorF* colour) 31 | { 32 | if (j[ConfigName].contains(name)) 33 | { 34 | colour->r = j[ConfigName][name][LIT("r")]; 35 | colour->g = j[ConfigName][name][LIT("g")]; 36 | colour->b = j[ConfigName][name][LIT("b")]; 37 | colour->a = j[ConfigName][name][LIT("a")]; 38 | } 39 | } 40 | 41 | json ToJson() 42 | { 43 | json j; 44 | j[ConfigName][LIT("Enable")] = Enable; 45 | j[ConfigName][LIT("Name")] = Name; 46 | j[ConfigName][LIT("Distance")] = Distance; 47 | j[ConfigName][LIT("MaxDistance")] = MaxDistance; 48 | j[ConfigName][LIT("FontSize")] = FontSize; 49 | j[ConfigName][LIT("Chams")] = Chams; 50 | j[ConfigName][LIT("ChamMode")] = ChamMode; 51 | j[ConfigName][LIT("DrawFriends")] = DrawFriends; 52 | ToJsonColour(&j, LIT("TextColour"), &TextColour); 53 | ToJsonColour(&j, LIT("FriendColour"), &FriendColour); 54 | 55 | return j; 56 | } 57 | void FromJson(const json& j) 58 | { 59 | if (!j.contains(ConfigName)) 60 | return; 61 | if (j[ConfigName].contains(LIT("Enable"))) 62 | Enable = j[ConfigName][LIT("Enable")]; 63 | if (j[ConfigName].contains(LIT("Name"))) 64 | Name = j[ConfigName][LIT("Name")]; 65 | if (j[ConfigName].contains(LIT("Distance"))) 66 | Distance = j[ConfigName][LIT("Distance")]; 67 | if (j[ConfigName].contains(LIT("FontSize"))) 68 | FontSize = j[ConfigName][LIT("FontSize")]; 69 | if (j[ConfigName].contains(LIT("MaxDistance"))) 70 | MaxDistance = j[ConfigName][LIT("MaxDistance")]; 71 | if (j[ConfigName].contains(LIT("Chams"))) 72 | Chams = j[ConfigName][LIT("Chams")]; 73 | if (j[ConfigName].contains(LIT("ChamMode"))) 74 | ChamMode = j[ConfigName][LIT("ChamMode")]; 75 | if (j[ConfigName].contains(LIT("DrawFriends"))) 76 | DrawFriends = j[ConfigName][LIT("DrawFriends")]; 77 | FromJsonColour(j, LIT("FriendColour"), &FriendColour); 78 | FromJsonColour(j, LIT("TextColour"), &TextColour); 79 | } 80 | }; 81 | 82 | -------------------------------------------------------------------------------- /HuntDMA/Config/SupplyConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | class SupplyConfig 4 | { 5 | std::string ConfigName; 6 | 7 | public: 8 | SupplyConfig(const std::string& name) 9 | { 10 | ConfigName = name; 11 | } 12 | bool Enable = true; 13 | bool Name = true; 14 | bool Distance = true; 15 | bool ShowAmmoSwapBox = false; 16 | bool ShowCompactAmmo = false; 17 | bool ShowMediumAmmo = false; 18 | bool ShowLongAmmo = false; 19 | bool ShowShortgunAmmo = false; 20 | bool ShowSpecialAmmo = false; 21 | bool ShowMedkit = false; 22 | bool ShowSupplyBox = false; 23 | int MaxDistance = 100; 24 | D2D1::ColorF TextColour = Colour(0, 255, 0); 25 | int FontSize = 11; 26 | void ToJsonColour(json* j, const std::string& name, D2D1::ColorF* colour) 27 | { 28 | (*j)[ConfigName][name][LIT("r")] = colour->r; 29 | (*j)[ConfigName][name][LIT("g")] = colour->g; 30 | (*j)[ConfigName][name][LIT("b")] = colour->b; 31 | (*j)[ConfigName][name][LIT("a")] = colour->a; 32 | 33 | } 34 | void FromJsonColour(json j, const std::string& name, D2D1::ColorF* colour) 35 | { 36 | if (j[ConfigName].contains(name)) 37 | { 38 | colour->r = j[ConfigName][name][LIT("r")]; 39 | colour->g = j[ConfigName][name][LIT("g")]; 40 | colour->b = j[ConfigName][name][LIT("b")]; 41 | colour->a = j[ConfigName][name][LIT("a")]; 42 | } 43 | } 44 | 45 | json ToJson() 46 | { 47 | json j; 48 | j[ConfigName][LIT("Enable")] = Enable; 49 | j[ConfigName][LIT("Name")] = Name; 50 | j[ConfigName][LIT("Distance")] = Distance; 51 | j[ConfigName][LIT("ShowAmmoSwapBox")] = ShowAmmoSwapBox; 52 | j[ConfigName][LIT("ShowCompactAmmo")] = ShowCompactAmmo; 53 | j[ConfigName][LIT("ShowMediumAmmo")] = ShowMediumAmmo; 54 | j[ConfigName][LIT("ShowLongAmmo")] = ShowLongAmmo; 55 | j[ConfigName][LIT("ShowShortgunAmmo")] = ShowShortgunAmmo; 56 | j[ConfigName][LIT("ShowSpecialAmmo")] = ShowSpecialAmmo; 57 | j[ConfigName][LIT("ShowMedkit")] = ShowMedkit; 58 | j[ConfigName][LIT("ShowSupplyBox")] = ShowSupplyBox; 59 | j[ConfigName][LIT("MaxDistance")] = MaxDistance; 60 | j[ConfigName][LIT("FontSize")] = FontSize; 61 | ToJsonColour(&j, LIT("TextColour"), &TextColour); 62 | 63 | return j; 64 | } 65 | void FromJson(const json& j) 66 | { 67 | if (!j.contains(ConfigName)) 68 | return; 69 | if (j[ConfigName].contains(LIT("Enable"))) 70 | Enable = j[ConfigName][LIT("Enable")]; 71 | if (j[ConfigName].contains(LIT("Name"))) 72 | Name = j[ConfigName][LIT("Name")]; 73 | if (j[ConfigName].contains(LIT("Distance"))) 74 | Distance = j[ConfigName][LIT("Distance")]; 75 | if (j[ConfigName].contains(LIT("ShowAmmoSwapBox"))) 76 | ShowAmmoSwapBox = j[ConfigName][LIT("ShowAmmoSwapBox")]; 77 | if (j[ConfigName].contains(LIT("ShowCompactAmmo"))) 78 | ShowCompactAmmo = j[ConfigName][LIT("ShowCompactAmmo")]; 79 | if (j[ConfigName].contains(LIT("ShowMediumAmmo"))) 80 | ShowMediumAmmo = j[ConfigName][LIT("ShowMediumAmmo")]; 81 | if (j[ConfigName].contains(LIT("ShowLongAmmo"))) 82 | ShowLongAmmo = j[ConfigName][LIT("ShowLongAmmo")]; 83 | if (j[ConfigName].contains(LIT("ShowShortgunAmmo"))) 84 | ShowShortgunAmmo = j[ConfigName][LIT("ShowShortgunAmmo")]; 85 | if (j[ConfigName].contains(LIT("ShowSpecialAmmo"))) 86 | ShowSpecialAmmo = j[ConfigName][LIT("ShowSpecialAmmo")]; 87 | if (j[ConfigName].contains(LIT("ShowMedkit"))) 88 | ShowMedkit = j[ConfigName][LIT("ShowMedkit")]; 89 | if (j[ConfigName].contains(LIT("ShowSupplyBox"))) 90 | ShowSupplyBox = j[ConfigName][LIT("ShowSupplyBox")]; 91 | if (j[ConfigName].contains(LIT("FontSize"))) 92 | FontSize = j[ConfigName][LIT("FontSize")]; 93 | if (j[ConfigName].contains(LIT("MaxDistance"))) 94 | MaxDistance = j[ConfigName][LIT("MaxDistance")]; 95 | FromJsonColour(j, LIT("TextColour"), &TextColour); 96 | } 97 | }; 98 | 99 | -------------------------------------------------------------------------------- /HuntDMA/Config/TrapConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | class TrapConfig 4 | { 5 | std::string ConfigName; 6 | 7 | public: 8 | TrapConfig(const std::string& name) 9 | { 10 | ConfigName = name; 11 | } 12 | bool Enable = true; 13 | bool Name = true; 14 | bool Distance = true; 15 | int MaxDistance = 75; 16 | D2D1::ColorF TextColour = Colour(255, 0, 0); 17 | int FontSize = 13; 18 | void ToJsonColour(json* j, const std::string& name, D2D1::ColorF* colour) 19 | { 20 | (*j)[ConfigName][name][LIT("r")] = colour->r; 21 | (*j)[ConfigName][name][LIT("g")] = colour->g; 22 | (*j)[ConfigName][name][LIT("b")] = colour->b; 23 | (*j)[ConfigName][name][LIT("a")] = colour->a; 24 | 25 | } 26 | void FromJsonColour(json j, const std::string& name, D2D1::ColorF* colour) 27 | { 28 | if (j[ConfigName].contains(name)) 29 | { 30 | colour->r = j[ConfigName][name][LIT("r")]; 31 | colour->g = j[ConfigName][name][LIT("g")]; 32 | colour->b = j[ConfigName][name][LIT("b")]; 33 | colour->a = j[ConfigName][name][LIT("a")]; 34 | } 35 | } 36 | 37 | json ToJson() 38 | { 39 | json j; 40 | j[ConfigName][LIT("Enable")] = Enable; 41 | j[ConfigName][LIT("Name")] = Name; 42 | j[ConfigName][LIT("Distance")] = Distance; 43 | j[ConfigName][LIT("MaxDistance")] = MaxDistance; 44 | j[ConfigName][LIT("FontSize")] = FontSize; 45 | ToJsonColour(&j, LIT("TextColour"), &TextColour); 46 | 47 | return j; 48 | } 49 | void FromJson(const json& j) 50 | { 51 | if (!j.contains(ConfigName)) 52 | return; 53 | if (j[ConfigName].contains(LIT("Enable"))) 54 | Enable = j[ConfigName][LIT("Enable")]; 55 | if (j[ConfigName].contains(LIT("Name"))) 56 | Name = j[ConfigName][LIT("Name")]; 57 | if (j[ConfigName].contains(LIT("Distance"))) 58 | Distance = j[ConfigName][LIT("Distance")]; 59 | if (j[ConfigName].contains(LIT("FontSize"))) 60 | FontSize = j[ConfigName][LIT("FontSize")]; 61 | if (j[ConfigName].contains(LIT("MaxDistance"))) 62 | MaxDistance = j[ConfigName][LIT("MaxDistance")]; 63 | FromJsonColour(j, LIT("TextColour"), &TextColour); 64 | } 65 | }; 66 | 67 | -------------------------------------------------------------------------------- /HuntDMA/Esp/OtherEsp.cpp: -------------------------------------------------------------------------------- 1 | #include "Pch.h" 2 | #include "PlayerEsp.h" 3 | #include "globals.h" 4 | #include "CheatFunction.h" 5 | #include "Drawing.h" 6 | #include "ConfigInstance.h" 7 | #include 8 | #include "ConfigUtilities.h" 9 | 10 | void DrawSupply() 11 | { 12 | EnvironmentInstance->SupplyListMutex.lock(); 13 | std::vector> templist = EnvironmentInstance->GetSupplyList(); 14 | EnvironmentInstance->SupplyListMutex.unlock(); 15 | 16 | if (templist.size() == 0) 17 | return; 18 | 19 | for (std::shared_ptr ent : templist) 20 | { 21 | if (ent == nullptr) 22 | continue; 23 | 24 | auto type = ent->GetType(); 25 | if (!Configs.Supply.ShowAmmoSwapBox && 26 | (type == EntityType::AmmoSwapBox || 27 | type == EntityType::SpitzerBullets || 28 | type == EntityType::PoisonBullets || 29 | type == EntityType::HighVelocityBullets || 30 | type == EntityType::IncendiaryBullets || 31 | type == EntityType::DumDumBullets || 32 | type == EntityType::ExplosiveBullets || 33 | type == EntityType::FMJBullets || 34 | type == EntityType::PoisonBolts || 35 | type == EntityType::ExplosiveBolts || 36 | type == EntityType::IncendiaryShells || 37 | type == EntityType::PennyShotShells || 38 | type == EntityType::FlechetteShells || 39 | type == EntityType::SlugShells)) 40 | continue; 41 | if (!Configs.Supply.ShowCompactAmmo && (type == EntityType::CompactAmmoPackage)) 42 | continue; 43 | if (!Configs.Supply.ShowMediumAmmo && (type == EntityType::MediumAmmoPackage)) 44 | continue; 45 | if (!Configs.Supply.ShowLongAmmo && (type == EntityType::LongAmmoPackage)) 46 | continue; 47 | if (!Configs.Supply.ShowShortgunAmmo && (type == EntityType::ShotgunAmmoPackage)) 48 | continue; 49 | if (!Configs.Supply.ShowSpecialAmmo && (type == EntityType::SpecialAmmoCrate)) 50 | continue; 51 | if ((!Configs.Supply.ShowCompactAmmo && 52 | !Configs.Supply.ShowMediumAmmo && 53 | !Configs.Supply.ShowLongAmmo && 54 | !Configs.Supply.ShowShortgunAmmo) && (type == EntityType::AmmoCrate)) 55 | continue; 56 | if (!Configs.Supply.ShowMedkit && (type == EntityType::Medkit)) 57 | continue; 58 | if (!Configs.Supply.ShowSupplyBox && (type == EntityType::SupplyBox)) 59 | continue; 60 | 61 | int distance = (int)Vector3::Distance(ent->GetPosition(), CameraInstance->GetPosition()); 62 | if (distance <= 0) 63 | continue; 64 | if (distance > Configs.Supply.MaxDistance) 65 | continue; 66 | if (!ent->GetValid()) 67 | continue; 68 | Vector2 pos = CameraInstance->WorldToScreen(ent->GetPosition()); 69 | if (pos.x == 0 || pos.y == 0) 70 | continue; 71 | 72 | std::wstring wname = Configs.Supply.Name ? ent->GetName() : L""; 73 | std::wstring wdistance = Configs.Supply.Distance ? L"[" + std::to_wstring(distance) + L"m]" : L""; 74 | DrawText(pos.x, pos.y, wname + wdistance, "Verdana", Configs.Supply.FontSize, Configs.Supply.TextColour, Centre); 75 | } 76 | } 77 | 78 | void DrawBloodBonds() 79 | { 80 | EnvironmentInstance->BloodBondsListMutex.lock(); 81 | std::vector> templist = EnvironmentInstance->GetBloodBondsList(); 82 | EnvironmentInstance->BloodBondsListMutex.unlock(); 83 | 84 | if (templist.size() == 0) 85 | return; 86 | 87 | for (std::shared_ptr ent : templist) 88 | { 89 | if (ent == nullptr) 90 | continue; 91 | 92 | int distance = (int)Vector3::Distance(ent->GetPosition(), CameraInstance->GetPosition()); 93 | if (distance <= 0) 94 | continue; 95 | if (distance > Configs.BloodBonds.MaxDistance) 96 | continue; 97 | if (!ent->GetValid()) 98 | continue; 99 | Vector2 pos = CameraInstance->WorldToScreen(ent->GetPosition()); 100 | if (pos.x == 0 || pos.y == 0) 101 | continue; 102 | 103 | std::wstring wname = Configs.BloodBonds.Name ? ent->GetName() : L""; 104 | std::wstring wdistance = Configs.BloodBonds.Distance ? L"[" + std::to_wstring(distance) + L"m]" : L""; 105 | DrawText(pos.x, pos.y, wname + wdistance, "Verdana", Configs.BloodBonds.FontSize, Configs.BloodBonds.TextColour, Centre); 106 | } 107 | } 108 | 109 | void DrawTraps() 110 | { 111 | EnvironmentInstance->TrapListMutex.lock(); 112 | std::vector> templist = EnvironmentInstance->GetTrapList(); 113 | EnvironmentInstance->TrapListMutex.unlock(); 114 | 115 | if (templist.size() == 0) 116 | return; 117 | 118 | for (std::shared_ptr ent : templist) 119 | { 120 | if (ent == nullptr) 121 | continue; 122 | 123 | int distance = (int)Vector3::Distance(ent->GetPosition(), CameraInstance->GetPosition()); 124 | if (distance <= 0) 125 | continue; 126 | if (distance > Configs.Trap.MaxDistance) 127 | continue; 128 | if (!ent->GetValid()) 129 | continue; 130 | Vector2 pos = CameraInstance->WorldToScreen(ent->GetPosition()); 131 | if (pos.x == 0 || pos.y == 0) 132 | continue; 133 | 134 | std::wstring wname = Configs.Trap.Name ? ent->GetName() : L""; 135 | std::wstring wdistance = Configs.Trap.Distance ? L"[" + std::to_wstring(distance) + L"m]" : L""; 136 | DrawText(pos.x, pos.y, wname + wdistance, "Verdana", Configs.Trap.FontSize, Configs.Trap.TextColour, Centre); 137 | } 138 | } 139 | 140 | void DrawPOI() 141 | { 142 | EnvironmentInstance->POIListMutex.lock(); 143 | std::vector> templist = EnvironmentInstance->GetPOIList(); 144 | EnvironmentInstance->POIListMutex.unlock(); 145 | 146 | if (templist.size() == 0) 147 | return; 148 | 149 | for (std::shared_ptr ent : templist) 150 | { 151 | if (ent == nullptr) 152 | continue; 153 | 154 | int distance = (int)Vector3::Distance(ent->GetPosition(), CameraInstance->GetPosition()); 155 | if (distance <= 0) 156 | continue; 157 | if (distance > Configs.POI.MaxDistance) 158 | continue; 159 | if (!ent->GetValid()) 160 | continue; 161 | 162 | Vector2 pos = CameraInstance->WorldToScreen(ent->GetPosition()); 163 | if (pos.x == 0 || pos.y == 0) 164 | continue; 165 | 166 | std::wstring wname = Configs.POI.Name ? ent->GetName() : L""; 167 | std::wstring wdistance = Configs.POI.Distance ? L"[" + std::to_wstring(distance) + L"m]" : L""; 168 | DrawText(pos.x, pos.y, wname + wdistance, "Verdana", Configs.POI.FontSize, Configs.POI.TextColour, Centre); 169 | } 170 | } 171 | 172 | void DrawOtherEsp() 173 | { 174 | if (EnvironmentInstance == nullptr) 175 | return; 176 | 177 | if (EnvironmentInstance->GetObjectCount() == 0) 178 | return; 179 | 180 | if (Configs.Supply.Enable) 181 | DrawSupply(); 182 | 183 | if (Configs.BloodBonds.Enable) 184 | DrawBloodBonds(); 185 | 186 | if (Configs.Trap.Enable) 187 | DrawTraps(); 188 | 189 | if (Configs.POI.Enable) 190 | DrawPOI(); 191 | } -------------------------------------------------------------------------------- /HuntDMA/Esp/OtherEsp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | extern void DrawOtherEsp(); -------------------------------------------------------------------------------- /HuntDMA/Esp/PlayerEsp.cpp: -------------------------------------------------------------------------------- 1 | #include "Pch.h" 2 | #include "PlayerEsp.h" 3 | #include "globals.h" 4 | #include "CheatFunction.h" 5 | #include "Drawing.h" 6 | #include "ConfigInstance.h" 7 | #include 8 | #include "ConfigUtilities.h" 9 | 10 | std::shared_ptr UpdatePlayers = std::make_shared(10, [] { 11 | 12 | EnvironmentInstance->UpdatePlayerList(); 13 | }); 14 | std::shared_ptr UpdateBosses = std::make_shared(20, [] { 15 | EnvironmentInstance->UpdateBossesList(); 16 | }); 17 | 18 | void DrawBosses() 19 | { 20 | if (EnvironmentInstance == nullptr) 21 | return; 22 | 23 | if (EnvironmentInstance->GetObjectCount() == 0) 24 | return; 25 | 26 | if (Configs.Bosses.Enable) 27 | { 28 | EnvironmentInstance->BossesListMutex.lock(); 29 | std::vector> templist = EnvironmentInstance->GetBossesList(); 30 | EnvironmentInstance->BossesListMutex.unlock(); 31 | if (templist.size() != 0) 32 | { 33 | for (std::shared_ptr ent : templist) 34 | { 35 | 36 | if (ent == nullptr) 37 | continue; 38 | int distance = (int)Vector3::Distance(ent->GetPosition(), CameraInstance->GetPosition()); 39 | if (distance <= 0) 40 | continue; 41 | if (distance > Configs.Bosses.MaxDistance) 42 | continue; 43 | if (!ent->GetValid()) 44 | continue; 45 | Vector2 pos = CameraInstance->WorldToScreen(ent->GetPosition()); 46 | if (pos.x == 0 || pos.y == 0) 47 | continue; 48 | std::wstring wname = Configs.Bosses.Name ? ent->GetName() : L""; 49 | std::wstring wdistance = Configs.Bosses.Distance ? L"[" + std::to_wstring(distance) + L"m]" : L""; 50 | DrawText(pos.x, pos.y, wname + wdistance, "Verdana", Configs.Bosses.FontSize, Configs.Bosses.TextColour, Centre); 51 | } 52 | } 53 | } 54 | } 55 | void DrawPlayers() 56 | { 57 | if (EnvironmentInstance == nullptr) 58 | return; 59 | 60 | if (EnvironmentInstance->GetObjectCount() == 0) 61 | return; 62 | 63 | if (Configs.Player.Enable) 64 | { 65 | EnvironmentInstance->PlayerListMutex.lock(); 66 | std::vector> templist = EnvironmentInstance->GetPlayerList(); 67 | EnvironmentInstance->PlayerListMutex.unlock(); 68 | if (templist.size() == 0) 69 | return; 70 | for (std::shared_ptr ent : templist) 71 | { 72 | if (ent == nullptr) 73 | continue; 74 | if (!Configs.Player.DrawFriends && ent->GetType() == EntityType::FriendlyPlayer) 75 | continue; 76 | int distance = (int)Vector3::Distance(ent->GetPosition(), CameraInstance->GetPosition()); 77 | if (distance <= 0) 78 | continue; 79 | if (Vector3::Distance(CameraInstance->GetPosition(), ent->GetPosition()) <= 2.0f) 80 | continue; 81 | if (distance > Configs.Player.MaxDistance) 82 | continue; 83 | if (!ent->GetValid()) 84 | continue; 85 | if (!IsValidHP(ent->GetHealth().current_hp) || 86 | !IsValidHP(ent->GetHealth().current_max_hp) || 87 | !IsValidHP(ent->GetHealth().regenerable_max_hp)) 88 | continue; 89 | Vector2 pos = CameraInstance->WorldToScreen(ent->GetPosition()); 90 | if (pos.x == 0 || pos.y == 0) 91 | continue; 92 | std::wstring wname = Configs.Player.Name ? ent->GetName() : L""; 93 | std::wstring wdistance = Configs.Player.Distance ? L"[" + std::to_wstring(distance) + L"m]" : L""; 94 | std::wstring whealth = std::to_wstring(ent->GetHealth().current_hp) + L"/" + std::to_wstring(ent->GetHealth().current_max_hp) + L"[" + std::to_wstring(ent->GetHealth().regenerable_max_hp) + L"]"; 95 | //DrawText(pos.x, pos.y, L".", "Verdana", Configs.Player.FontSize, Colour(255, 0, 0), Centre); // dot 96 | DrawText(pos.x, pos.y, wname + wdistance + L"\n" + whealth, "Verdana", Configs.Player.FontSize, ent->GetType() == EntityType::FriendlyPlayer ? Configs.Player.FriendColour : Configs.Player.TextColour, Centre); 97 | } 98 | } 99 | } 100 | 101 | bool IsValidHP(int hp) 102 | { 103 | return hp > 0 && hp <= 150; 104 | } -------------------------------------------------------------------------------- /HuntDMA/Esp/PlayerEsp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | extern std::shared_ptr UpdatePlayers; 3 | extern std::shared_ptr UpdateBosses; 4 | extern void DrawPlayers(); 5 | extern void DrawBosses(); 6 | 7 | bool IsValidHP(int hp); -------------------------------------------------------------------------------- /HuntDMA/Globals.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Environment.h" 3 | #include "Camera.h" 4 | extern std::shared_ptr EnvironmentInstance; 5 | extern std::shared_ptr CameraInstance; -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/Graphics/Entities/ColourPicker.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "ColourPicker.h" 3 | #include "Input.h" 4 | #include "Drawing.h" 5 | #include "GUI.h" 6 | 7 | ColourPicker::ColourPicker(float x, float y, D2D1::ColorF* colour) 8 | { 9 | ColourPicker::MainColour = colour; 10 | ColourPicker::Size = { 20, 10 }; 11 | ColourPicker::Pos = { x, y }; 12 | ColourPicker::Open = false; 13 | ColourPicker::Hue = RGBToHue(ColourPicker::MainColour->r, ColourPicker::MainColour->g, ColourPicker::MainColour->b); 14 | ColourPicker::Alpha = MainColour->a; 15 | ColourPicker::Saturation = RgbToHsv(ColourPicker::MainColour->r, ColourPicker::MainColour->g, ColourPicker::MainColour->b).V; 16 | ColourPicker::Brightness = RgbToHsv(ColourPicker::MainColour->r, ColourPicker::MainColour->g, ColourPicker::MainColour->b).S; 17 | ColourPicker::ContextSize = { 80.0f, 20.0f * (int)ColourPicker::ContextNames.size() }; 18 | SetVisible(true); 19 | } 20 | 21 | float ColourPicker::HueToSliderValue(float hue) 22 | { 23 | return hue / 360.0f; 24 | } 25 | 26 | float ColourPicker::SliderValueToHue(float slidervalue) 27 | { 28 | return slidervalue * 360.0f; 29 | } 30 | 31 | float ColourPicker::SaturationToSliderValue(float saturation) 32 | { 33 | return saturation / 255.0f; 34 | } 35 | 36 | void ColourPicker::Copy() 37 | { 38 | ColourPickerClipBoard = *ColourPicker::MainColour; 39 | } 40 | 41 | void ColourPicker::Paste() 42 | { 43 | *ColourPicker::MainColour = ColourPickerClipBoard; 44 | ColourPicker::Alpha = ColourPickerClipBoard.a; 45 | ColourPicker::Saturation = RgbToHsv(ColourPicker::MainColour->r, ColourPicker::MainColour->g, ColourPicker::MainColour->b).S; 46 | ColourPicker::Brightness = RgbToHsv(ColourPicker::MainColour->r, ColourPicker::MainColour->g, ColourPicker::MainColour->b).V; 47 | ColourPicker::Hue = RGBToHue(ColourPicker::MainColour->r, ColourPicker::MainColour->g, ColourPicker::MainColour->b); 48 | ColourPicker::ValueChangeEvent(); 49 | } 50 | 51 | void ColourPicker::ContextMenu() 52 | { 53 | if (IsMouseInRectangle(ColourPicker::Pos + ColourPicker::ParentPos, ColourPicker::Size) && IsKeyClicked(VK_RBUTTON) && !ColourPicker::Blocked && !ColourPicker::Open) 54 | { 55 | ColourPicker::ContextActive = true; 56 | ColourPicker::Open = false; 57 | ColourPicker::ContextPos = MousePos; 58 | SetBlockedSiblings(true); 59 | } 60 | 61 | if (!IsMouseInRectangle(ColourPicker::ContextPos, ColourPicker::ContextSize) && IsKeyClicked(VK_LBUTTON)) 62 | { 63 | if (ColourPicker::ContextActive) 64 | SetBlockedSiblings(false); 65 | ColourPicker::ContextActive = false; 66 | } 67 | if (!ColourPicker::ContextActive) 68 | return; 69 | int i = 0; 70 | for (auto& pair : ColourPicker::ContextNames) 71 | { 72 | if (IsMouseInRectangle(ColourPicker::ContextPos.x, ColourPicker::ContextPos.y + (i * 20), ColourPicker::ContextSize.x, 20) && IsKeyClicked(VK_LBUTTON) && ColourPicker::LastClick < (clock() * 0.00001f)) 73 | { 74 | pair.second(); 75 | ColourPicker::LastClick = (clock() * 0.00001f) + 0.002f; 76 | } 77 | i++; 78 | } 79 | } 80 | 81 | void ColourPicker::Update() 82 | { 83 | if (!ColourPicker::Parent) 84 | ColourPicker::SetVisible(false); 85 | if (!ColourPicker::IsVisible()) 86 | return; 87 | 88 | ColourPicker::ParentPos = ColourPicker::Parent->GetParentPos(); 89 | ColourPicker::ContextMenu(); 90 | if (!(IsMouseInRectangle(ColourPicker::ParentPos.x + ColourPicker::Pos.x, ColourPicker::ParentPos.y + ColourPicker::Pos.y, ColourPicker::Size.x, ColourPicker::Size.y) || IsMouseInRectangle(ClickedPos.x - 5, ClickedPos.y - 5, 175, 175)) && IsKeyClicked(VK_LBUTTON) && ColourPicker::Open) 91 | { 92 | ColourPicker::Open = false; 93 | 94 | SetBlockedSiblings(false); 95 | } 96 | 97 | if (ColourPicker::Blocked) 98 | return; 99 | 100 | if (IsMouseInRectangle(ColourPicker::ParentPos.x + ColourPicker::Pos.x, ColourPicker::ParentPos.y + ColourPicker::Pos.y, ColourPicker::Size.x, ColourPicker::Size.y) && IsKeyClicked(VK_LBUTTON) && ColourPicker::LastClick < (clock() * 0.00001f) && !(IsMouseInRectangle(ClickedPos.x - 5, ClickedPos.y - 5, 185, 175) && ColourPicker::Open)) 101 | { 102 | ClickedPos = MousePos; 103 | ColourPicker::Open = !ColourPicker::Open; 104 | ColourPicker::LastClick = (clock() * 0.00001f) + 0.002f; 105 | ColourPicker::ContextActive = false; 106 | if (ColourPicker::Open) 107 | SetBlockedSiblings(true); 108 | if (!ColourPicker::Open) 109 | SetBlockedSiblings(false); 110 | } 111 | 112 | if (!IsKeyDown(VK_LBUTTON) && !ColourPicker::ContextActive) 113 | { 114 | if (ColourPicker::HeldHue || ColourPicker::Alpha || ColourPicker::HeldSaturation) 115 | ColourPicker::ValueChangeEvent(); 116 | ColourPicker::HeldHue = false; 117 | ColourPicker::HeldAlpha = false; 118 | ColourPicker::HeldSaturation = false; 119 | int alpha = static_cast(ColourPicker::Alpha * 255); 120 | *ColourPicker::MainColour = HsvToRgb(ColourPicker::Hue, ColourPicker::Brightness, ColourPicker::Saturation, alpha); 121 | ColourPicker::MainColour->a = ColourPicker::Alpha; 122 | } 123 | 124 | if (!ColourPicker::Open) 125 | return; 126 | if (IsMouseInRectangle(ClickedPos.x, ClickedPos.y, 150, 150) && IsKeyClicked(VK_LBUTTON) && ColourPicker::LastClick < (clock() * 0.00001f)) 127 | { 128 | ColourPicker::HeldSaturation = true; 129 | ColourPicker::LastClick = (clock() * 0.00001f) + 0.002f; 130 | } 131 | 132 | if (IsMouseInRectangle(ClickedPos.x, ClickedPos.y + 155, 150, 10) && IsKeyClicked(VK_LBUTTON) && ColourPicker::LastClick < (clock() * 0.00001f)) 133 | { 134 | ColourPicker::HeldHue = true; 135 | ColourPicker::LastClick = (clock() * 0.00001f) + 0.002f; 136 | } 137 | 138 | if (IsMouseInRectangle(ClickedPos.x + 155, ClickedPos.y, 20, 165) && IsKeyClicked(VK_LBUTTON) && ColourPicker::LastClick < (clock() * 0.00001f)) 139 | { 140 | ColourPicker::HeldAlpha = true; 141 | ColourPicker::LastClick = (clock() * 0.00001f) + 0.002f; 142 | } 143 | 144 | if (HeldHue) 145 | { 146 | // Calculate the slider value from the mouse position 147 | const float clamp = std::clamp((float)MousePos.x - (float)(ClickedPos.x), 0.00f, (float)150); 148 | const float ratio = clamp / 150; 149 | ColourPicker::Hue = 0.0f + (360.0f - 0.0f) * ratio; 150 | // second var creates brigthness/ fullcolour - white, second one does black to full colour 151 | *ColourPicker::MainColour = HsvToRgb(ColourPicker::Hue, ColourPicker::Brightness, ColourPicker::Saturation, ColourPicker::Alpha); 152 | } 153 | 154 | if (HeldAlpha) 155 | { 156 | // Calculate the slider value from the mouse position 157 | const float clamp = std::clamp((float)MousePos.y - (float)(ClickedPos.y), 0.00f, (float)165); 158 | const float ratio = clamp / 165; 159 | ColourPicker::Alpha = (1.0f - ratio); 160 | ColourPicker::Alpha = std::min(ColourPicker::Alpha, 1.0f); 161 | ColourPicker::MainColour->a = ColourPicker::Alpha; 162 | } 163 | 164 | if (HeldSaturation) 165 | { 166 | // Calculate the saturation values from the mouse position 167 | const float xclamp = std::clamp((float)MousePos.x - (float)(ClickedPos.x), 0.00f, (float)150); 168 | const float yclamp = std::clamp((float)MousePos.y - (float)(ClickedPos.y), 0.00f, (float)150); 169 | 170 | const float xratio = xclamp / 150.0f; 171 | const float yratio = (150.0f - yclamp) / 150.0f; 172 | ColourPicker::Saturation = yratio; 173 | ColourPicker::Brightness = xratio; 174 | ColourPicker::Saturation = std::min(ColourPicker::Saturation, 255.0f); 175 | ColourPicker::Brightness = std::min(ColourPicker::Brightness, 255.0f); 176 | } 177 | } 178 | 179 | void ColourPicker::Draw() 180 | { 181 | if (!ColourPicker::Parent) 182 | ColourPicker::SetVisible(false); 183 | if (!ColourPicker::IsVisible()) 184 | return; 185 | FilledRectangle(ColourPicker::ParentPos.x + ColourPicker::Pos.x, ColourPicker::ParentPos.y + ColourPicker::Pos.y, ColourPicker::Size.x, ColourPicker::Size.y, *ColourPicker::MainColour); 186 | OutlineRectangle(ColourPicker::ParentPos.x + ColourPicker::Pos.x, ColourPicker::ParentPos.y + ColourPicker::Pos.y, ColourPicker::Size.x, ColourPicker::Size.y, 1, Colour(85, 85, 85, 255)); 187 | 188 | if (ColourPicker::Open) 189 | { 190 | FilledRectangle(ClickedPos.x - 5, ClickedPos.y - 5, 185, 175, Colour(85, 85, 85, 255)); 191 | OutlineRectangle(ClickedPos.x - 5, ClickedPos.y - 5, 185, 175, 1, Colour(180, 180, 180, 255)); 192 | int alpha = static_cast(ColourPicker::Alpha * 255); 193 | SaturationSlider(ClickedPos.x, ClickedPos.y, 150, 150, HsvToRgb(ColourPicker::Hue, 255.0f, 255.0f, alpha)); 194 | 195 | // alpha 196 | OutlineRectangle(ClickedPos.x + 155, ClickedPos.y, 20, 165, 1, Colour(180, 180, 180, 255)); 197 | AlphaSlider(ClickedPos.x + 155, ClickedPos.y, 20, 165, *MainColour); 198 | float alphavalue = ColourPicker::Alpha; 199 | FilledRectangle(ClickedPos.x + 155, ClickedPos.y + ((int)165 * (1.0f - alphavalue)), 20, 2, Colour(255, 255, 255, 255)); 200 | 201 | // hue 202 | HueSlider(ClickedPos.x, ClickedPos.y + 155, 150, 10); 203 | float huevalue = ColourPicker::HueToSliderValue(ColourPicker::Hue); 204 | FilledRectangle(ClickedPos.x + ((int)150 * huevalue), ClickedPos.y + 155, 2, 10, Colour(255, 255, 255, 255)); 205 | } 206 | 207 | if (ColourPicker::ContextActive) 208 | { 209 | OutlineRectangle(ColourPicker::ContextPos.x, ColourPicker::ContextPos.y, ColourPicker::ContextSize.x, ColourPicker::ContextSize.y, 1, Colour(255, 255, 255, 255)); 210 | FilledRectangle(ColourPicker::ContextPos.x, ColourPicker::ContextPos.y, ColourPicker::ContextSize.x, ColourPicker::ContextSize.y, Colour(80, 80, 80, 255)); 211 | int i = 0; 212 | for (auto pair : ColourPicker::ContextNames) 213 | { 214 | if (i != 0) 215 | FilledLine(ColourPicker::ContextPos.x, ColourPicker::ContextPos.y + i * 20, ColourPicker::ContextPos.x + ColourPicker::ContextSize.x, ColourPicker::ContextPos.y + i * 20, 1.0f, Colour(255, 255, 255, 255)); 216 | 217 | if (IsMouseInRectangle(ColourPicker::ContextPos.x, ColourPicker::ContextPos.y + (i * 20), ColourPicker::ContextSize.x, 20)) 218 | FilledRectangle(ColourPicker::ContextPos.x, ColourPicker::ContextPos.y + (i * 20), ColourPicker::ContextSize.x, 20, Colour(120, 120, 120, 255)); 219 | DrawText(ColourPicker::ContextPos.x + (ColourPicker::ContextSize.x / 2), ColourPicker::ContextPos.y + (i * 20) + 10, pair.first, LIT("Verdana"), 11, Colour(255, 255, 255, 255), CentreCentre); 220 | 221 | i++; 222 | } 223 | } 224 | } 225 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 = 15; 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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | }; -------------------------------------------------------------------------------- /HuntDMA/Graphics/Entities/KeyBind.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "KeyBind.h" 3 | #include "Drawing.h" 4 | #include "Input.h" 5 | #include "GUI.h" 6 | 7 | KeyBind::KeyBind(float x, float y, std::wstring text, int* key) 8 | { 9 | KeyBind::Pos = {x, y}; 10 | KeyBind::Name = text; 11 | KeyBind::Key = key; 12 | KeyBind::Size = {80, 20}; 13 | KeyBind::ConvertKeyToName(); 14 | KeyBind::ContextSize = {80.0f, 20.0f * (int)KeyBind::ContextNames.size()}; 15 | SetVisible(true); 16 | } 17 | 18 | void KeyBind::ConvertKeyToName() 19 | { 20 | if (KeyBind::Active) 21 | { 22 | KeyBind::KeyName = LIT(L"[Click A Key]"); 23 | return; 24 | } 25 | 26 | if (*KeyBind::Key == NULL && !KeyBind::Active) 27 | { 28 | KeyBind::KeyName = LIT(L"[Unbound]"); 29 | return; 30 | } 31 | 32 | int keycode = *KeyBind::Key; 33 | int scancode = MapVirtualKey(keycode, MAPVK_VK_TO_VSC); 34 | WCHAR keyname[256] = {0}; 35 | if (SymbolKeys[keycode] != L"") 36 | { 37 | KeyBind::KeyName = SymbolKeys[keycode]; 38 | return; 39 | } 40 | 41 | if (GetKeyNameTextW((scancode << 16), keyname, sizeof(keyname) / sizeof(keyname[0])) == 0 && KeyBind::Key != NULL) 42 | { 43 | KeyBind::KeyName = LIT(L"[Unknown Key]"); 44 | } 45 | else 46 | { 47 | KeyBind::KeyName = keyname; 48 | } 49 | } 50 | 51 | void KeyBind::Update() 52 | { 53 | if (!KeyBind::Parent) 54 | KeyBind::SetVisible(false); 55 | if (!KeyBind::IsVisible()) 56 | return; 57 | 58 | KeyBind::ContextMenu(); 59 | KeyBind::ParentPos = KeyBind::Parent->GetParentPos(); 60 | if (!KeyBind::Blocked) 61 | { 62 | if (IsMouseInRectangle(KeyBind::Pos + ParentPos, KeyBind::Size) && IsKeyClicked(VK_LBUTTON) && KeyBind::LastClick < (clock() * 0.00001f) && !KeyBind::Blocked && !KeyBind::Active) 63 | { 64 | // KeyBind::SetBlockedSiblings(true); 65 | KeyBind::Blocked = true; 66 | KeyBind::LastClick = (clock() * 0.00001f) + 0.002f; 67 | KeyBind::Active = true; 68 | KeyBind::Blocked = false; 69 | } 70 | } 71 | if (Active && !ContextActive) 72 | { 73 | *KeyBind::Key = 0; 74 | KeyBind::KeyName = LIT(L"[Click A Key]"); 75 | KeyBind::CollectInput(); 76 | KeyBind::ConvertKeyToName(); 77 | } 78 | } 79 | 80 | void KeyBind::ContextMenu() 81 | { 82 | if (IsMouseInRectangle(KeyBind::Pos + KeyBind::ParentPos, KeyBind::Size) && IsKeyClicked(VK_RBUTTON) && !KeyBind::Blocked && !KeyBind::Active && KeyBind::LastClick < (clock() * 0.00001f)) 83 | { 84 | KeyBind::ContextActive = true; 85 | KeyBind::Active = false; 86 | KeyBind::ContextPos = MousePos; 87 | SetBlockedSiblings(true); 88 | } 89 | 90 | if (!IsMouseInRectangle(KeyBind::ContextPos, KeyBind::ContextSize) && IsKeyClicked(VK_LBUTTON)) 91 | { 92 | if (KeyBind::ContextActive) 93 | SetBlockedSiblings(false); 94 | KeyBind::ContextActive = false; 95 | } 96 | 97 | if (!KeyBind::ContextActive) 98 | return; 99 | 100 | int i = 0; 101 | for (auto& pair : KeyBind::ContextNames) 102 | { 103 | if (IsMouseInRectangle(KeyBind::ContextPos.x, KeyBind::ContextPos.y + (i * 20), KeyBind::ContextSize.x, 20) && IsKeyClicked(VK_LBUTTON) && KeyBind::LastClick < (clock() * 0.00001f)) 104 | { 105 | pair.second(); 106 | KeyBind::LastClick = (clock() * 0.00001f) + 0.002f; 107 | } 108 | i++; 109 | } 110 | } 111 | 112 | void KeyBind::Copy() 113 | { 114 | KeyBindClipBoard = *KeyBind::Key; 115 | } 116 | 117 | void KeyBind::Paste() 118 | { 119 | *KeyBind::Key = KeyBindClipBoard; 120 | KeyBind::ConvertKeyToName(); 121 | KeyBind::ValueChangeEvent(); 122 | } 123 | 124 | void KeyBind::CollectInput() 125 | { 126 | for (int i = 0; i <= 255; i++) 127 | { 128 | if (IsKeyClicked(VK_RETURN) || IsKeyClicked(VK_ESCAPE)) 129 | { 130 | KeyBind::Active = false; 131 | return; 132 | } 133 | if (IsKeyClicked(i) && KeyBind::LastClick < (clock() * 0.00001f)) 134 | { 135 | *KeyBind::Key = i; 136 | KeyBind::Active = false; 137 | KeyBind::LastClick = (clock() * 0.00001f) + 0.002f; 138 | KeyBind::ValueChangeEvent(); 139 | return; 140 | } 141 | 142 | } 143 | } 144 | 145 | void KeyBind::Draw() 146 | { 147 | if (!KeyBind::Parent) 148 | KeyBind::SetVisible(false); 149 | if (!KeyBind::IsVisible()) 150 | return; 151 | 152 | MyColour rectColour = MenuColours[LIT("Keybind")]; 153 | MyColour rectHoverColour = MenuColours[LIT("KeybindHover")]; 154 | MyColour rectOutlineColour = MenuColours[LIT("KeybindOutline")]; 155 | MyColour textColour = MenuColours[LIT("Text")]; 156 | MyColour textselected = MenuColours[LIT("TextSelected")]; 157 | 158 | OutlineRectangle(ParentPos.x + Pos.x, ParentPos.y + Pos.y, Size.x + 1, Size.y + 1, 1, rectOutlineColour); 159 | FilledRectangle(ParentPos.x + KeyBind::Pos.x, ParentPos.y + KeyBind::Pos.y, KeyBind::Size.x, KeyBind::Size.y, rectColour); 160 | DrawText(ParentPos.x + KeyBind::Pos.x, ParentPos.y + KeyBind::Pos.y - KeyBind::Size.y, KeyBind::Name, LIT("Verdana"), 12, textColour, None); 161 | DrawText(ParentPos.x + KeyBind::Pos.x + (KeyBind::Size.x / 2), ParentPos.y + KeyBind::Pos.y + (KeyBind::Size.y / 2), KeyName, LIT("Verdana"), 10, Active ? textselected : textColour, CentreCentre); 162 | if (KeyBind::ContextActive) 163 | { 164 | OutlineRectangle(KeyBind::ContextPos.x, KeyBind::ContextPos.y, KeyBind::ContextSize.x, KeyBind::ContextSize.y, 1, textColour); 165 | FilledRectangle(KeyBind::ContextPos.x, KeyBind::ContextPos.y, KeyBind::ContextSize.x, KeyBind::ContextSize.y, rectColour); 166 | int i = 0; 167 | for (auto pair : KeyBind::ContextNames) 168 | { 169 | if (i != 0) 170 | FilledLine(KeyBind::ContextPos.x, KeyBind::ContextPos.y + i * 20, KeyBind::ContextPos.x + KeyBind::ContextSize.x, KeyBind::ContextPos.y + i * 20, 1.0f, textColour); 171 | 172 | if (IsMouseInRectangle(KeyBind::ContextPos.x, KeyBind::ContextPos.y + (i * 20), KeyBind::ContextSize.x, 20)) 173 | FilledRectangle(KeyBind::ContextPos.x, KeyBind::ContextPos.y + (i * 20), KeyBind::ContextSize.x, 20, rectHoverColour); 174 | DrawText(KeyBind::ContextPos.x + (KeyBind::ContextSize.x / 2), KeyBind::ContextPos.y + (i * 20) + 10, pair.first, LIT("Verdana"), 11, textColour, CentreCentre); 175 | 176 | i++; 177 | } 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /HuntDMA/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"Mouse 5"} 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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 "PlayerEsp.h" 7 | #include "OtherEsp.h" 8 | #include "ConfigUtilities.h" 9 | #include "Aimbot.h" 10 | #include "InputManager.h" 11 | #include "Kmbox.h" 12 | #include "FPS.h" 13 | #include 14 | #include "SpectatorAlarm.h" 15 | 16 | ID2D1Factory* Factory; 17 | IDWriteFactory* FontFactory; 18 | ID2D1HwndRenderTarget* RenderTarget; 19 | ID2D1SolidColorBrush* Brush; 20 | 21 | 22 | std::shared_ptr EnvironmentInstance; 23 | std::shared_ptr CameraInstance; 24 | 25 | 26 | void CleanD2D() 27 | { 28 | // ensure pointer is valid 29 | // then release memory 30 | if (Factory) 31 | Factory->Release(); 32 | if (RenderTarget) 33 | RenderTarget->Release(); 34 | if (Brush) 35 | Brush->Release(); 36 | for (std::pair dict : Fonts) 37 | { 38 | const FontInformation& fontInfo = dict.second; 39 | if (fontInfo.font) 40 | fontInfo.font->Release(); 41 | } 42 | //Clean all cached text layours 43 | for (std::pair dict : TextLayouts) 44 | { 45 | IDWriteTextLayout* layout = dict.second; 46 | if (layout) 47 | layout->Release(); 48 | } 49 | 50 | for (std::pair dict : TextCache) 51 | { 52 | IDWriteTextLayout* layout = dict.second; 53 | if (layout) 54 | layout->Release(); 55 | } 56 | } 57 | 58 | int FrameRate() 59 | { 60 | static int fps = 0; 61 | static int lastfps = 0; 62 | static auto lasttime = std::chrono::steady_clock::now(); 63 | 64 | auto currenttime = std::chrono::steady_clock::now(); 65 | std::chrono::duration elapsed = currenttime - lasttime; 66 | fps++; 67 | 68 | if (elapsed.count() >= 1.0f) 69 | { 70 | lasttime = currenttime; 71 | lastfps = fps; 72 | fps = 0; 73 | } 74 | 75 | return lastfps; 76 | } 77 | 78 | void InitialiseClasses() 79 | { 80 | EnvironmentInstance = std::make_shared(); 81 | CameraInstance = std::make_shared(); 82 | 83 | } 84 | 85 | std::shared_ptr Cache = std::make_shared(8000, [] { 86 | if (EnvironmentInstance == nullptr) 87 | return; 88 | if (EnvironmentInstance->GetObjectCount() == 0) 89 | return; 90 | EnvironmentInstance->GetEntityList(); 91 | EnvironmentInstance->CacheEntities(); 92 | }); 93 | 94 | std::shared_ptr UpdateCam = std::make_shared(5, [] { 95 | if (EnvironmentInstance == nullptr) 96 | return; 97 | if (EnvironmentInstance->GetObjectCount() == 0) 98 | return; 99 | auto handle = TargetProcess.CreateScatterHandle(); 100 | CameraInstance->UpdateCamera(handle); 101 | TargetProcess.ExecuteReadScatter(handle); 102 | TargetProcess.CloseScatterHandle(handle); 103 | }); 104 | 105 | void DrawCrosshair() 106 | { 107 | Vector2 centre = Vector2(Configs.Overlay.OverrideResolution ? Configs.Overlay.Width / 2 : GetSystemMetrics(SM_CXSCREEN) / 2, Configs.Overlay.OverrideResolution ? Configs.Overlay.Height * 0.6f : GetSystemMetrics(SM_CYSCREEN) * 0.6f); 108 | // drawing aimbot fov here because fuck it 109 | if (Configs.Aimbot.DrawFOV) 110 | { 111 | OutlineCircle(centre.x, centre.y, Configs.Aimbot.FOV, 2,Configs.Aimbot.FOVColour); 112 | } 113 | if (Configs.Overlay.CrosshairType == 0) 114 | return; 115 | 116 | if (Configs.Overlay.CrosshairType == 1) 117 | { 118 | FilledCircle(centre.x, centre.y, Configs.Overlay.CrosshairSize, Configs.Overlay.CrosshairColour); 119 | 120 | } 121 | if (Configs.Overlay.CrosshairType == 2) 122 | { 123 | OutlineCircle(centre.x, centre.y, Configs.Overlay.CrosshairSize,2, Configs.Overlay.CrosshairColour); 124 | 125 | } 126 | if (Configs.Overlay.CrosshairType == 3) 127 | { 128 | FilledRectangle(centre.x - (Configs.Overlay.CrosshairSize / 2), centre.y - (Configs.Overlay.CrosshairSize / 2), Configs.Overlay.CrosshairSize, Configs.Overlay.CrosshairSize, Configs.Overlay.CrosshairColour); 129 | 130 | } 131 | if (Configs.Overlay.CrosshairType == 4) 132 | { 133 | OutlineRectangle(centre.x - (Configs.Overlay.CrosshairSize/2), centre.y - (Configs.Overlay.CrosshairSize/2), Configs.Overlay.CrosshairSize , Configs.Overlay.CrosshairSize, 1, Configs.Overlay.CrosshairColour); 134 | 135 | } 136 | } 137 | 138 | void CacheThread() 139 | { 140 | while (true) 141 | { 142 | if (EnvironmentInstance == nullptr) 143 | continue; 144 | if (EnvironmentInstance->GetObjectCount() == 0) 145 | continue; 146 | Cache->Execute(); 147 | } 148 | } 149 | 150 | void InitD2D(HWND hWnd) 151 | { 152 | HRESULT result = D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED, &Factory); 153 | RECT rect; 154 | GetClientRect(hWnd, &rect); 155 | 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); 156 | if (!SUCCEEDED(result)) 157 | return; 158 | 159 | result = DWriteCreateFactory(DWRITE_FACTORY_TYPE_ISOLATED, __uuidof(IDWriteFactory), reinterpret_cast(&FontFactory)); 160 | if (!SUCCEEDED(result)) 161 | return; 162 | 163 | CreateFonts(LIT("Verdana"), LIT(L"Verdana"), 10, DWRITE_FONT_WEIGHT_NORMAL); 164 | CreateFonts("VerdanaBold", LIT(L"Verdana"), 10, DWRITE_FONT_WEIGHT_SEMI_BOLD); 165 | RenderTarget->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0, 0), &Brush); // create global brush 166 | RenderTarget->SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE); // set aa mode 167 | std::thread(CacheThread).detach(); 168 | Keyboard::InitKeyboard(); 169 | kmbox::KmboxInitialize(""); 170 | } 171 | 172 | void RenderFrame() 173 | { 174 | if (EnvironmentInstance == nullptr) 175 | { 176 | InitialiseClasses(); 177 | Sleep(1000); 178 | } 179 | if (EnvironmentInstance->GetObjectCount() == 0) 180 | { 181 | InitialiseClasses(); 182 | EnvironmentInstance->GetEntityList(); 183 | auto handle = TargetProcess.CreateScatterHandle(); 184 | CameraInstance->UpdateCamera(handle); 185 | TargetProcess.ExecuteReadScatter(handle); 186 | TargetProcess.CloseScatterHandle(handle); 187 | EnvironmentInstance->CacheEntities(); 188 | Sleep(1000); 189 | } 190 | 191 | UpdateCam->Execute(); 192 | UpdatePlayers->Execute(); 193 | UpdateBosses->Execute(); 194 | //Aimbot(); 195 | RenderTarget->BeginDraw(); 196 | RenderTarget->Clear(Colour(0, 0, 0, 255)); // clear over the last buffer 197 | RenderTarget->SetTransform(D2D1::Matrix3x2F::Identity()); // set new transform 198 | DrawSpectators(); 199 | DrawPlayers(); 200 | DrawBosses(); 201 | DrawOtherEsp(); 202 | //DrawCrosshair(); 203 | DrawFPS(); 204 | Render(); 205 | RenderTarget->EndDraw(); 206 | } 207 | -------------------------------------------------------------------------------- /HuntDMA/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 | 10 | extern int FrameRate(); -------------------------------------------------------------------------------- /HuntDMA/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 | } -------------------------------------------------------------------------------- /HuntDMA/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); -------------------------------------------------------------------------------- /HuntDMA/Graphics/Utility/Colour.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Colour.h" 3 | 4 | std::map MenuColours = 5 | { 6 | /*Main Form colors*/ 7 | {"Background", MyColour(20, 20, 20, 255)}, 8 | {"Outline", MyColour(140, 140, 140, 255)}, 9 | {"Header", MyColour(30, 30, 30, 255)}, 10 | {"HeaderSeperator", MyColour(0, 150, 255, 255)}, 11 | {"Text", MyColour(240, 240, 240, 255)}, 12 | {"TextSelected", MyColour(0, 150, 255, 255)}, 13 | {"TextHover", MyColour(0, 150, 255, 255)}, 14 | 15 | {"Button", MyColour(80, 80, 80, 255)}, 16 | {"ButtonHover", MyColour(100, 100, 100, 255)}, 17 | {"ButtonActive", MyColour(120, 120, 120, 255)}, 18 | {"ButtonOutline", MyColour(130, 130, 130, 255)}, 19 | 20 | {"ComboBox", MyColour(80, 80, 80, 255)}, 21 | {"ComboBoxHover", MyColour(150, 150, 150, 120)}, 22 | {"ComboBoxOutline", MyColour(130, 130, 130, 255)}, 23 | {"ComboBoxSelectedText", MyColour(0, 255, 150, 255)}, 24 | {"ComboBoxDropDown", MyColour(150, 150, 150, 120)}, 25 | {"ComboBoxSlider", MyColour(0, 255, 150, 255)}, 26 | 27 | {"DropDown", MyColour(80, 80, 80, 255)}, 28 | {"DropDownOutline", MyColour(130, 130, 130, 255)}, 29 | {"DropDownSelectedText", MyColour(0, 150, 255, 255)}, 30 | {"DropDownArrow", MyColour(0, 150, 255, 255)}, 31 | {"DropDownActiveArrow", MyColour(150, 150, 150, 120)}, 32 | {"DropDownSlider", MyColour(0, 150, 255, 255)}, 33 | 34 | {"Keybind", MyColour(80, 80, 80, 255)}, 35 | {"KeybindHover", MyColour(120, 120, 120, 255)}, 36 | {"KeybindOutline", MyColour(130, 130, 130, 255)}, 37 | 38 | {"Slider", MyColour(80, 80, 80, 255)}, 39 | {"SliderInside", MyColour(0, 150, 255, 255)}, 40 | {"SliderOutline", MyColour(20, 20, 20, 255)}, 41 | {"SliderWidget", MyColour(255, 255, 255, 255)}, 42 | 43 | {"Tab", MyColour(80, 80, 80, 255)}, 44 | {"TabHover", MyColour(100, 100, 100, 255)}, 45 | {"TabActive", MyColour(120, 120, 120, 255)}, 46 | 47 | {"TextBox", MyColour(80, 80, 80, 255)}, 48 | {"TextBoxOutline", MyColour(200, 200, 200, 255)}, 49 | {"TextBoxHighlight", MyColour(0, 150, 255, 100)}, 50 | {"TextBoxCurrent", MyColour(255, 255, 255, 255)}, // The current location of your cursor in the input box. 51 | {"TextBoxContextOutline", MyColour(120, 120, 120, 255)}, 52 | {"TextBoxContextFirstLine", MyColour(255, 255, 255, 255)}, // First line that happens of the context menu 53 | 54 | {"Toggle", MyColour(80, 80, 80, 255)}, 55 | {"ToggleOutline", MyColour(130, 130, 130, 255)}, 56 | {"ToggleInside", MyColour(0, 150, 255, 255)}, 57 | 58 | //{"CheckboxHover", MyColour(100, 100, 100, 255)}, 59 | //{"CheckboxActive", MyColour(120, 120, 120, 255)}, 60 | 61 | }; 62 | 63 | D2D1::ColorF Colour(UINT8 R, UINT8 G, UINT8 B, UINT8 A) 64 | { 65 | return D2D1::ColorF(static_cast(R) / 255.0f, static_cast(G) / 255.0f, static_cast(B) / 255.0f, static_cast(A) / 255.0f); 66 | } 67 | 68 | 69 | D2D1::ColorF HueToRGB(float hue) 70 | { 71 | hue = fmod(hue, 360.0f); 72 | if (hue < 0) 73 | hue += 360.0f; 74 | 75 | int sector = static_cast(hue / 60.0f); 76 | 77 | float fraction = (hue / 60.0f) - sector; 78 | 79 | float c = 1.0f; 80 | float x = 1.0f - std::abs(2 * fraction - 1); 81 | float m = 0.0f; 82 | D2D1::ColorF col = D2D1::ColorF(0.0f, 0.0f, 0.0f, 0.0f); 83 | 84 | switch (sector) 85 | { 86 | case 0: 87 | col.r = (c + m); 88 | col.g = (x + m); 89 | col.b = (m); 90 | break; 91 | case 1: 92 | col.r = (x + m); 93 | col.g = (c + m); 94 | col.b = (m); 95 | break; 96 | case 2: 97 | col.r = (m); 98 | col.g = (c + m); 99 | col.b = (x + m); 100 | break; 101 | case 3: 102 | col.r = (m); 103 | col.g = (x + m); 104 | col.b = (c + m); 105 | break; 106 | case 4: 107 | col.r = (x + m); 108 | col.g = (m); 109 | col.b = (c + m); 110 | break; 111 | case 5: 112 | col.r = (c + m); 113 | col.g = (m); 114 | col.b = (x + m); 115 | break; 116 | default: 117 | col.r = 0; 118 | col.g = 0; 119 | col.b = 0; 120 | break; 121 | } 122 | col.a = 1.0f; 123 | return col; 124 | } 125 | 126 | float RGBToHue(float r, float g, float b) 127 | { 128 | float hue = 0.0f; 129 | float rnorm = r; 130 | float gnorm = g; 131 | float bnorm = b; 132 | 133 | float maxcolour = std::max({ rnorm, gnorm, bnorm }); 134 | float mincolour = std::min({ rnorm, gnorm, bnorm }); 135 | 136 | if (maxcolour == mincolour) 137 | { 138 | hue = 0.0f; 139 | } 140 | else 141 | { 142 | float delta = maxcolour - mincolour; 143 | if (maxcolour == rnorm) 144 | hue = 60.0f * fmod(((gnorm - bnorm) / delta), 6.0f); 145 | else if (maxcolour == gnorm) 146 | hue = 60.0f * (((bnorm - rnorm) / delta) + 2.0f); 147 | else if (maxcolour == bnorm) 148 | hue = 60.0f * (((rnorm - gnorm) / delta) + 4.0f); 149 | } 150 | 151 | if (hue < 0.0f) 152 | hue += 360.0f; 153 | 154 | return hue; 155 | } 156 | 157 | D2D1::ColorF HsvToRgb(float hue, float saturation, float value, float alpha) 158 | { 159 | // Ensure hue is in the range [0, 360) 160 | hue = fmodf(hue, 360.0f); 161 | if (hue < 0.0f) 162 | hue += 360.0f; 163 | 164 | // Normalize saturation and value to [0, 1] 165 | saturation = std::clamp(saturation, 0.0f, 1.0f); 166 | value = std::clamp(value, 0.0f, 1.0f); 167 | 168 | // Algorithm to convert HSV to RGB 169 | float chroma = value * saturation; 170 | float hueprime = hue / 60.0f; 171 | float x = chroma * (1.0f - fabsf(fmodf(hueprime, 2.0f) - 1.0f)); 172 | 173 | float r, g, b; 174 | if (0.0f <= hueprime && hueprime < 1.0f) { 175 | r = chroma; 176 | g = x; 177 | b = 0.0f; 178 | } 179 | else if (1.0f <= hueprime && hueprime < 2.0f) { 180 | r = x; 181 | g = chroma; 182 | b = 0.0f; 183 | } 184 | else if (2.0f <= hueprime && hueprime < 3.0f) { 185 | r = 0.0f; 186 | g = chroma; 187 | b = x; 188 | } 189 | else if (3.0f <= hueprime && hueprime < 4.0f) { 190 | r = 0.0f; 191 | g = x; 192 | b = chroma; 193 | } 194 | else if (4.0f <= hueprime && hueprime < 5.0f) { 195 | r = x; 196 | g = 0.0f; 197 | b = chroma; 198 | } 199 | else { 200 | r = chroma; 201 | g = 0.0f; 202 | b = x; 203 | } 204 | 205 | float m = value - chroma; 206 | r += m; 207 | g += m; 208 | b += m; 209 | 210 | return D2D1::ColorF(r, g, b, alpha); 211 | } 212 | 213 | HsvColour RgbToHsv(float r, float g, float b) 214 | { 215 | float rnorm = r; 216 | float gnorm = g; 217 | float bnorm = b; 218 | // printf("R: %f, G: %f, B: %f\n", rnorm, gnorm, bnorm); 219 | 220 | float maxcolor = std::max({ rnorm, gnorm, bnorm }); 221 | float mincolor = std::min({ rnorm, gnorm, bnorm }); 222 | 223 | float delta = maxcolor - mincolor; 224 | //printf("Delta: %f\n", delta); 225 | HsvColour hsv; 226 | 227 | // Value calculation 228 | hsv.V = maxcolor; 229 | if (maxcolor == 0 || delta == 0) { 230 | hsv.S = 0; 231 | hsv.H = 0; // undefined, set hue to 0 232 | 233 | return hsv; 234 | } 235 | else { 236 | hsv.S = delta / maxcolor; 237 | } 238 | 239 | 240 | // Hue calculation 241 | if (delta == 0) 242 | hsv.H = 0; 243 | else if (maxcolor == r) 244 | hsv.H = 60 * ((g - b) / delta); 245 | else if (maxcolor == g) 246 | hsv.H = 60 * ((b - r) / delta + 2); 247 | else 248 | hsv.H = 60 * ((r - g) / delta + 4); 249 | 250 | if (hsv.H < 0) 251 | hsv.H += 360; 252 | return hsv; 253 | } 254 | 255 | void SetColour(std::string name, D2D1::ColorF col) 256 | { 257 | MenuColours[name] = MyColour(col); 258 | } 259 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/Graphics/Utility/Kmbox.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "kmbox.h" 3 | #include 4 | 5 | namespace kmbox 6 | { 7 | HANDLE serial_handle = nullptr; 8 | 9 | bool connected = false; 10 | 11 | int clamp(int i) 12 | { 13 | if (i > 127) 14 | i = 127; 15 | if (i < -128) 16 | i = -128; 17 | 18 | return i; 19 | } 20 | 21 | std::string find_port(const std::string& targetDescription) 22 | { 23 | HDEVINFO hDevInfo = SetupDiGetClassDevsA(&GUID_DEVCLASS_PORTS, 0, 0, DIGCF_PRESENT); 24 | if (hDevInfo == INVALID_HANDLE_VALUE) return ""; 25 | 26 | SP_DEVINFO_DATA deviceInfoData; 27 | deviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); 28 | 29 | for (DWORD i = 0; SetupDiEnumDeviceInfo(hDevInfo, i, &deviceInfoData); ++i) 30 | { 31 | char buf[512]; 32 | DWORD nSize = 0; 33 | 34 | if (SetupDiGetDeviceRegistryPropertyA(hDevInfo, &deviceInfoData, SPDRP_FRIENDLYNAME, NULL, (PBYTE)buf, sizeof(buf), &nSize) && nSize > 0) 35 | { 36 | buf[nSize] = '\0'; 37 | std::string deviceDescription = buf; 38 | 39 | size_t comPos = deviceDescription.find("COM"); 40 | size_t endPos = deviceDescription.find(")", comPos); 41 | 42 | if (comPos != std::string::npos && endPos != std::string::npos && deviceDescription.find(targetDescription) != std::string::npos) 43 | { 44 | SetupDiDestroyDeviceInfoList(hDevInfo); 45 | return deviceDescription.substr(comPos, endPos - comPos); 46 | } 47 | } 48 | } 49 | SetupDiDestroyDeviceInfoList(hDevInfo); 50 | return ""; 51 | } 52 | 53 | void KmboxInitialize(std::string port) 54 | { 55 | 56 | connected = false; 57 | if (serial_handle) 58 | { 59 | CloseHandle(serial_handle); 60 | serial_handle = NULL; 61 | } 62 | // wprintf(L"Connecting to KMBOX on port %ls\n",port.c_str()); 63 | //std::string str = std::string(port.begin(), port.end()); 64 | port = "\\\\.\\" + find_port("USB-SERIAL CH340"); 65 | printf("Connecting to KMBOX on port %s\n", port.c_str()); 66 | 67 | serial_handle = CreateFileA(port.c_str(), GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); 68 | 69 | if (serial_handle == INVALID_HANDLE_VALUE) 70 | { 71 | // print the serialhandle 72 | printf("Serial handle: %d\n", serial_handle); 73 | printf("Failed to open serial port!\n"); 74 | return; 75 | 76 | } 77 | 78 | if (!SetupComm(serial_handle, 8192, 8192)) 79 | { 80 | printf("Failed to setup serial port!\n"); 81 | CloseHandle(serial_handle); 82 | return; 83 | } 84 | 85 | COMMTIMEOUTS timeouts = { 0 }; 86 | if (!GetCommTimeouts(serial_handle, &timeouts)) 87 | { 88 | CloseHandle(serial_handle); 89 | return; 90 | } 91 | timeouts.ReadIntervalTimeout = 0xFFFFFFFF; 92 | timeouts.ReadTotalTimeoutMultiplier = 0; 93 | timeouts.ReadTotalTimeoutConstant = 0; 94 | timeouts.WriteTotalTimeoutMultiplier = 0; 95 | timeouts.WriteTotalTimeoutConstant = 2000; 96 | 97 | if (!SetCommTimeouts(serial_handle, &timeouts)) 98 | { 99 | 100 | CloseHandle(serial_handle); 101 | return; 102 | } 103 | 104 | PurgeComm(serial_handle, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR); 105 | 106 | DCB dcbSerialParams = { 0 }; 107 | dcbSerialParams.DCBlength = sizeof(dcbSerialParams); 108 | 109 | if (!GetCommState(serial_handle, &dcbSerialParams)) 110 | { 111 | printf("Failed to get serial state!\n"); 112 | CloseHandle(serial_handle); 113 | return; 114 | } 115 | 116 | int baud = 115200; 117 | dcbSerialParams.BaudRate = baud; 118 | dcbSerialParams.ByteSize = 8; 119 | dcbSerialParams.StopBits = ONESTOPBIT; 120 | dcbSerialParams.Parity = NOPARITY; 121 | 122 | if (!SetCommState(serial_handle, &dcbSerialParams)) 123 | { 124 | printf("Failed to set serial parameters!\n"); 125 | CloseHandle(serial_handle); 126 | return; 127 | } 128 | 129 | //printf("Connected to KMBOX on port %s\n", std::string(port).c_str()); 130 | connected = true; 131 | } 132 | 133 | void SendCommand(const std::string& command) 134 | { 135 | DWORD bytesWritten; 136 | if (!WriteFile(serial_handle, command.c_str(), command.length(), &bytesWritten, NULL)) 137 | { 138 | // printf("Failed to write to serial port!\n"); 139 | } 140 | } 141 | 142 | void move(int x, int y) 143 | { 144 | if (!connected) 145 | { 146 | // printf("not connected?\n"); 147 | return; 148 | } 149 | x = clamp(x); 150 | y = clamp(y); 151 | std::string command = "km.move(" + std::to_string(x) + "," + std::to_string(y) + ")\r\n"; 152 | SendCommand(command.c_str()); 153 | } 154 | 155 | void left_click() 156 | { 157 | if (!connected) 158 | { 159 | // printf("not connected?\n"); 160 | return; 161 | } 162 | std::string command = "km.left(1)\r\n"; 163 | SendCommand(command.c_str()); 164 | } 165 | 166 | void left_click_release() 167 | { 168 | if (!connected) 169 | { 170 | // printf("not connected?\n"); 171 | return; 172 | } 173 | std::string command = "km.left(0)\r\n"; 174 | SendCommand(command.c_str()); 175 | } 176 | 177 | bool IsDown(int virtual_key) 178 | { 179 | if (!connected) 180 | return false; 181 | return false; 182 | std::string command = virtual_key == 3 ? "km.middle()\r\n" : "km.side" + std::to_string(virtual_key) + std::string("()\r\n"); 183 | SendCommand(command); 184 | char readBuffer[256]; 185 | DWORD bytesRead; 186 | if (!ReadFile(serial_handle, readBuffer, sizeof(readBuffer) - 1, &bytesRead, NULL)) 187 | { 188 | std::cerr << "Failed to read from serial port!" << std::endl; 189 | return false; 190 | } 191 | 192 | if (bytesRead > 0) 193 | { 194 | readBuffer[bytesRead] = '\0'; 195 | std::string command2 = virtual_key == 3 ? "km.middle()\r\n1" : "km.side" + std::to_string(virtual_key) + std::string("()\r\n1"); 196 | if (strstr(readBuffer, command2.c_str())) 197 | return true; 198 | } 199 | return false; 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /HuntDMA/Graphics/Utility/Kmbox.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #pragma comment(lib, "setupapi.lib") 10 | namespace kmbox 11 | { 12 | extern bool connected; 13 | extern std::string find_port(const std::string& targetDescription); 14 | extern void KmboxInitialize(std::string port); 15 | 16 | extern void move(int x, int y); 17 | extern void left_click(); 18 | extern void left_click_release(); 19 | extern bool IsDown(int virtual_key); 20 | } 21 | -------------------------------------------------------------------------------- /HuntDMA/HuntDMA.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | Source Files 56 | 57 | 58 | Source Files 59 | 60 | 61 | Source Files 62 | 63 | 64 | Source Files 65 | 66 | 67 | Source Files 68 | 69 | 70 | Source Files 71 | 72 | 73 | Source Files 74 | 75 | 76 | Source Files 77 | 78 | 79 | Source Files 80 | 81 | 82 | Source Files 83 | 84 | 85 | Source Files 86 | 87 | 88 | Source Files 89 | 90 | 91 | Source Files 92 | 93 | 94 | Source Files 95 | 96 | 97 | Source Files 98 | 99 | 100 | Source Files 101 | 102 | 103 | Source Files 104 | 105 | 106 | 107 | 108 | Header Files 109 | 110 | 111 | Header Files 112 | 113 | 114 | Header Files 115 | 116 | 117 | Header Files 118 | 119 | 120 | Header Files 121 | 122 | 123 | Header Files 124 | 125 | 126 | Header Files 127 | 128 | 129 | Header Files 130 | 131 | 132 | Header Files 133 | 134 | 135 | Header Files 136 | 137 | 138 | Header Files 139 | 140 | 141 | Header Files 142 | 143 | 144 | Header Files 145 | 146 | 147 | Header Files 148 | 149 | 150 | Header Files 151 | 152 | 153 | Header Files 154 | 155 | 156 | Header Files 157 | 158 | 159 | Header Files 160 | 161 | 162 | Header Files 163 | 164 | 165 | Header Files 166 | 167 | 168 | Header Files 169 | 170 | 171 | Header Files 172 | 173 | 174 | Header Files 175 | 176 | 177 | Header Files 178 | 179 | 180 | Header Files 181 | 182 | 183 | Header Files 184 | 185 | 186 | Header Files 187 | 188 | 189 | Header Files 190 | 191 | 192 | Header Files 193 | 194 | 195 | Header Files 196 | 197 | 198 | Header Files 199 | 200 | 201 | Header Files 202 | 203 | 204 | -------------------------------------------------------------------------------- /HuntDMA/Main.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Memory.h" 3 | #include "CheatFunction.h" 4 | #include "Environment.h" 5 | #include "Globals.h" 6 | #include "Camera.h" 7 | #include "Init.h" 8 | #include "GUI.h" 9 | #include "ConfigUtilities.h" 10 | 11 | 12 | void main() 13 | { 14 | while (!TargetProcess.Init("HuntGame.exe", true, true)) 15 | { 16 | std::printf("Cant Attach To Game\n"); 17 | Sleep(2000); 18 | continue; 19 | } 20 | TargetProcess.FixCr3(); 21 | std::printf("HuntGame: 0x%X\n", TargetProcess.GetBaseAddress("HuntGame.exe")); 22 | std::printf("GameHunt: 0x%X\n", TargetProcess.GetBaseAddress("GameHunt.dll")); 23 | } 24 | LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 25 | { 26 | InputWndProc(hWnd, message, wParam, lParam); 27 | switch (message) 28 | { 29 | case WM_DESTROY: 30 | PostQuitMessage(0); 31 | return 0; 32 | break; 33 | } 34 | 35 | return DefWindowProc(hWnd, message, wParam, lParam); 36 | } 37 | 38 | 39 | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 40 | { 41 | HWND hWnd; 42 | WNDCLASSEX wc; 43 | AllocConsole(); 44 | FILE* fDummy; 45 | freopen_s(&fDummy, LIT("CONIN$"), LIT("r"), stdin); 46 | freopen_s(&fDummy, LIT("CONOUT$"), LIT("w"), stderr); 47 | freopen_s(&fDummy, LIT("CONOUT$"), LIT("w"), stdout); 48 | printf(LIT("Debugging Window:\n")); 49 | 50 | main(); 51 | ZeroMemory(&wc, sizeof(WNDCLASSEX)); 52 | wc.cbSize = sizeof(WNDCLASSEX); 53 | wc.style = CS_HREDRAW | CS_VREDRAW; 54 | wc.lpfnWndProc = WindowProc; 55 | wc.hInstance = hInstance; 56 | wc.hCursor = LoadCursor(NULL, IDC_ARROW); 57 | wc.hbrBackground = (HBRUSH)COLOR_WINDOW; 58 | wc.lpszClassName = L"GUI Framework"; 59 | RegisterClassEx(&wc); 60 | //SetProcessDPIAware(); 61 | hWnd = CreateWindowEx(WS_EX_APPWINDOW, wc.lpszClassName, L"GUI Framework", 62 | WS_POPUP, 63 | 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), NULL, NULL, hInstance, NULL); 64 | 65 | if (!hWnd) 66 | return -1; 67 | 68 | 69 | SetLayeredWindowAttributes(hWnd, RGB(0, 0, 0), 255, LWA_ALPHA); 70 | 71 | ShowWindow(hWnd, nCmdShow); 72 | SetUpConfig(); 73 | LoadConfig(ConfigPath); 74 | InitD2D(hWnd); 75 | CreateGUI(); 76 | MSG msg; 77 | SetInput(); 78 | while (TRUE) 79 | { 80 | if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) 81 | { 82 | TranslateMessage(&msg); 83 | DispatchMessage(&msg); 84 | 85 | if (msg.message == WM_QUIT) 86 | break; 87 | } 88 | RenderFrame(); 89 | } 90 | CleanD2D(); 91 | return msg.wParam; 92 | } 93 | -------------------------------------------------------------------------------- /HuntDMA/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(uint32_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 | -------------------------------------------------------------------------------- /HuntDMA/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(uint32_t virtual_key_code); 11 | }; 12 | -------------------------------------------------------------------------------- /HuntDMA/Memory/Memory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.h" 3 | #include "InputManager.h" 4 | class Memory 5 | { 6 | private: 7 | struct LibModules 8 | { 9 | HMODULE VMM = nullptr; 10 | HMODULE FTD3XX = nullptr; 11 | HMODULE LEECHCORE = nullptr; 12 | }; 13 | 14 | static inline LibModules modules{ }; 15 | 16 | struct CurrentProcessInformation 17 | { 18 | int PID = 0; 19 | size_t base_address = 0; 20 | size_t base_size = 0; 21 | std::string process_name = ""; 22 | }; 23 | std::unordered_map Modules; 24 | 25 | 26 | static inline BOOLEAN DMA_INITIALIZED = FALSE; 27 | static inline BOOLEAN PROCESS_INITIALIZED = FALSE; 28 | /** 29 | *Dumps the systems Current physical memory pages 30 | *To a file so we can use it in our DMA (: 31 | *This file it created to %temp% folder 32 | *@return true if successful, false if not. 33 | */ 34 | bool DumpMemoryMap(bool debug = false); 35 | 36 | /** 37 | * brief Removes basic information related to the FPGA device 38 | * This is required before any DMA operations can be done. 39 | * To ensure the optimal safety in game cheating. 40 | * @return true if successful, false if not. 41 | */ 42 | bool SetFPGA(); 43 | 44 | /*this->registry_ptr = std::make_shared(*this); 45 | this->key_ptr = std::make_shared(*this);*/ 46 | 47 | public: 48 | static inline CurrentProcessInformation current_process{ }; 49 | 50 | /** 51 | * brief Constructor takes a wide string of the process. 52 | * Expects that all the libraries are in the root dir 53 | */ 54 | Memory(); 55 | ~Memory(); 56 | 57 | /** 58 | * brief Initializes the DMA 59 | * This is required before any DMA operations can be done. 60 | * @param process_name the name of the process 61 | * @param memMap if true, will dump the memory map to a file & make the DMA use it. 62 | * @return true if successful, false if not. 63 | */ 64 | bool Init(std::string process_name, bool memMap = true, bool debug = false); 65 | 66 | /*This part here is things related to the process information such as Base daddy, Size ect.*/ 67 | 68 | /** 69 | * brief Gets the process id of the process 70 | * @param process_name the name of the process 71 | * @return the process id of the process 72 | */ 73 | DWORD GetPidFromName(std::string process_name); 74 | 75 | /** 76 | * brief Gets all the processes id(s) of the process 77 | * @param process_name the name of the process 78 | * @returns all the processes id(s) of the process 79 | */ 80 | std::vector GetPidListFromName(std::string process_name); 81 | 82 | /** 83 | * \brief Gets the module list of the process 84 | * \param process_name the name of the process 85 | * \return all the module names of the process 86 | */ 87 | std::vector GetModuleList(std::string process_name); 88 | 89 | /** 90 | * \brief Gets the process information 91 | * \return the process information 92 | */ 93 | VMMDLL_PROCESS_INFORMATION GetProcessInformation(); 94 | 95 | 96 | /** 97 | * brief Gets the base address of the process 98 | * @param module_name the name of the module 99 | * @return the base address of the process 100 | */ 101 | size_t GetBaseAddress(std::string module_name); 102 | 103 | /** 104 | * brief Gets the base size of the process 105 | * @param module_name the name of the module 106 | * @return the base size of the process 107 | */ 108 | size_t GetBaseSize(std::string module_name); 109 | 110 | /** 111 | * brief Gets the export table address of the process 112 | * @param import the name of the export 113 | * @param process the name of the process 114 | * @param module the name of the module that you wanna find the export in 115 | * @return the export table address of the export 116 | */ 117 | uintptr_t GetExportTableAddress(std::string import, std::string process, std::string module); 118 | 119 | /** 120 | * brief Gets the import table address of the process 121 | * @param import the name of the import 122 | * @param process the name of the process 123 | * @param module the name of the module that you wanna find the import in 124 | * @return the import table address of the import 125 | */ 126 | uintptr_t GetImportTableAddress(std::string import, std::string process, std::string module); 127 | 128 | /** 129 | * \brief This fixes the CR3 fuckery that EAC does. 130 | * It fixes it by iterating over all DTB's that exist within your system and looks for specific ones 131 | * that nolonger have a PID assigned to them, aka their pid is 0 132 | * it then puts it in a vector to later try each possible DTB to find the DTB of the process. 133 | * NOTE: Using FixCR3 requires you to have symsrv.dll, dbghelp.dll and info.db 134 | */ 135 | bool FixCr3(); 136 | 137 | /** 138 | * \brief Dumps the process memory at address (requires to be a valid PE Header) to the path 139 | * \param address the address to the PE Header(BaseAddress) 140 | * \param path the path where you wanna save dump to 141 | */ 142 | bool DumpMemory(uintptr_t address, std::string path); 143 | 144 | /*This part is where all memory operations are done, such as read, write.*/ 145 | 146 | /** 147 | * \brief Scans the process for the signature. 148 | * \param signature the signature example "48 ? ? ?" 149 | * \param range_start Region to start scan from 150 | * \param range_end Region up to where it should scan 151 | * \param PID (OPTIONAL) where to read to? 152 | * \return address of signature 153 | */ 154 | uint64_t FindSignature(const char* signature, uint64_t range_start, uint64_t range_end, int PID = 0); 155 | 156 | /** 157 | * \brief Writes memory to the process 158 | * \param address The address to write to 159 | * \param buffer The buffer to writeze of the buffer 160 | * \return 161 | * \param size The si 162 | */ 163 | bool Write(uintptr_t address, void* buffer, size_t size) const; 164 | bool Write(uintptr_t address, void* buffer, size_t size, int pid) const; 165 | 166 | /** 167 | * \brief Writes memory to the process using a template 168 | * \param address to write to 169 | * \param value the value you'll write to the address 170 | */ 171 | template 172 | bool Write(void* address, T value) 173 | { 174 | return Write(address, &value, sizeof(T)); 175 | } 176 | 177 | template 178 | bool Write(uintptr_t address, T value) 179 | { 180 | return Write(address, &value, sizeof(T)); 181 | } 182 | 183 | /** 184 | * brief Reads memory from the process 185 | * @param address The address to read from 186 | * @param buffer The buffer to read to 187 | * @param size The size of the buffer 188 | * @return true if successful, false if not. 189 | */ 190 | bool Read(uintptr_t address, void* buffer, size_t size) const; 191 | bool Read(uintptr_t address, void* buffer, size_t size, int pid) const; 192 | 193 | /** 194 | * brief Reads memory from the process using a template 195 | * @param address The address to read from 196 | * @return the value read from the process 197 | */ 198 | template 199 | T Read(void* address) 200 | { 201 | T buffer{ }; 202 | memset(&buffer, 0, sizeof(T)); 203 | Read(reinterpret_cast(address), reinterpret_cast(&buffer), sizeof(T)); 204 | 205 | return buffer; 206 | } 207 | 208 | template 209 | T Read(uint64_t address) 210 | { 211 | return Read(reinterpret_cast(address)); 212 | } 213 | 214 | /** 215 | * brief Reads memory from the process using a template and pid 216 | * @param address The address to read from 217 | * @param pid The process id of the process 218 | * @return the value read from the process 219 | */ 220 | template 221 | T Read(void* address, int pid) 222 | { 223 | T buffer{ }; 224 | memset(&buffer, 0, sizeof(T)); 225 | Read(reinterpret_cast(address), reinterpret_cast(&buffer), sizeof(T), pid); 226 | 227 | return buffer; 228 | } 229 | 230 | template 231 | T Read(uint64_t address, int pid) 232 | { 233 | return Read(reinterpret_cast(address), pid); 234 | } 235 | 236 | /** 237 | * \brief Create a scatter handle, this is used for scatter read/write requests 238 | * \return Scatter handle 239 | */ 240 | VMMDLL_SCATTER_HANDLE CreateScatterHandle(); 241 | VMMDLL_SCATTER_HANDLE CreateScatterHandle(int pid); 242 | 243 | /** 244 | * \brief Closes the scatter handle 245 | * \param handle 246 | */ 247 | void CloseScatterHandle(VMMDLL_SCATTER_HANDLE handle); 248 | 249 | /** 250 | * \brief Adds a scatter read/write request to the handle 251 | * \param handle the handle 252 | * \param address the address to read/write to 253 | * \param buffer the buffer to read/write to 254 | * \param size the size of buffer 255 | */ 256 | bool AddScatterReadRequest(VMMDLL_SCATTER_HANDLE handle, uint64_t address, void* buffer, size_t size); 257 | void AddScatterWriteRequest(VMMDLL_SCATTER_HANDLE handle, uint64_t address, void* buffer, size_t size); 258 | template 259 | bool AddScatterWriteRequest(VMMDLL_SCATTER_HANDLE handle, uint64_t addr, T value) const 260 | { 261 | if (!(addr > 0x2000000 && addr < 0x7FFFFFFFFFFF)) 262 | return false; 263 | bool ret = !VMMDLL_Scatter_PrepareWrite(handle, addr, reinterpret_cast(&value), sizeof(value)); 264 | if (!ret) 265 | { 266 | LOG("failed to prepare scatter write at 0x%p\n", addr); 267 | } 268 | return ret; 269 | } 270 | 271 | /** 272 | * \brief Executes all prepared scatter requests, note if you created a scatter handle with a pid 273 | * you'll need to specify the pid in the execute function. so we can clear the scatters from the handle. 274 | * \param handle 275 | * \param pid 276 | */ 277 | void ExecuteReadScatter(VMMDLL_SCATTER_HANDLE handle, int pid = 0); 278 | void ExecuteWriteScatter(VMMDLL_SCATTER_HANDLE handle, int pid = 0); 279 | 280 | 281 | /*the FPGA handle*/ 282 | VMM_HANDLE vHandle; 283 | }; 284 | 285 | inline Memory TargetProcess; 286 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/Misc/CheatFunction.cpp: -------------------------------------------------------------------------------- 1 | #include "Pch.h" 2 | #include "CheatFunction.h" 3 | #include 4 | 5 | CheatFunction::CheatFunction(int msTimer, std::function func) 6 | { 7 | MsSleep = msTimer; 8 | Function = func; 9 | } 10 | 11 | void CheatFunction::Execute() 12 | { 13 | auto now = std::chrono::high_resolution_clock::now(); 14 | if (std::chrono::duration_cast(now - LastExecution).count() > MsSleep) 15 | { 16 | Function(); 17 | LastExecution = now; 18 | } 19 | } -------------------------------------------------------------------------------- /HuntDMA/Misc/CheatFunction.h: -------------------------------------------------------------------------------- 1 | #include 2 | #pragma once 3 | class CheatFunction 4 | { 5 | int MsSleep = 0; 6 | std::function Function; 7 | std::chrono::time_point LastExecution; 8 | public: 9 | CheatFunction(int time, std::functionfunc); 10 | void Execute(); 11 | }; -------------------------------------------------------------------------------- /HuntDMA/Misc/FPS.cpp: -------------------------------------------------------------------------------- 1 | #include "Pch.h" 2 | #include "globals.h" 3 | #include "Drawing.h" 4 | #include "ConfigInstance.h" 5 | #include "ConfigUtilities.h" 6 | #include "Init.h" 7 | 8 | void DrawFPS() 9 | { 10 | if (Configs.Overlay.ShowFPS) 11 | { 12 | DrawText(25, 25, L"DMA FPS: " + std::to_wstring(FrameRate()), "Verdana", Configs.Overlay.FpsFontSize, Colour(128, 128, 128), None); 13 | } 14 | } -------------------------------------------------------------------------------- /HuntDMA/Misc/FPS.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | extern void DrawFPS(); -------------------------------------------------------------------------------- /HuntDMA/Misc/Input.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "Input.h" 3 | #include "Init.h" 4 | 5 | // local scope enum 6 | enum class KeyState 7 | { 8 | KeyDormant = 0, 9 | KeyInvoked = 1, 10 | KeyActive = 2 11 | }; 12 | 13 | // could do dictionaries but we only want to handle ascii 14 | std::map KeyHeld; 15 | std::map KeyStates; 16 | std::map KeyTimes; 17 | 18 | Vector2 MousePos; 19 | WPARAM Char = NULL; 20 | HCURSOR CurrentCursor; 21 | std::map Cursors; 22 | 23 | void CreateCursor(std::string name, HCURSOR cursor) 24 | { 25 | Cursors[name] = cursor; 26 | } 27 | 28 | void SetCurrentCursor(std::string name) 29 | { 30 | CurrentCursor = Cursors[name]; 31 | } 32 | 33 | HCURSOR GetCurrentCursor() 34 | { 35 | return CurrentCursor; 36 | } 37 | 38 | void UpdateKeyState(int key, bool down) 39 | { 40 | if (key < 0 || key > 255) // assuming you are only dealing with ASCII values 41 | return; 42 | KeyTimes[key] = clock() * 0.001f; 43 | if (KeyHeld[key] && !down) 44 | KeyStates[key] = KeyState::KeyDormant; 45 | 46 | if (KeyHeld[key] && down) 47 | KeyStates[key] = KeyState::KeyActive; 48 | 49 | if (!KeyHeld[key] && down) 50 | KeyStates[key] = KeyState::KeyInvoked; 51 | 52 | KeyHeld[key] = down; 53 | } 54 | 55 | LRESULT CALLBACK InputWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 56 | { 57 | switch (message) 58 | { 59 | case WM_MOVE: 60 | SetWindowPos(hWnd, NULL, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_NOZORDER | SWP_NOACTIVATE); 61 | InitD2D(hWnd); 62 | break; 63 | case WM_CHAR: 64 | Char = wParam; 65 | break; // Added missing break statement 66 | case WM_KEYUP: 67 | case WM_SYSKEYUP: 68 | UpdateKeyState(wParam & 0xFF, false); 69 | break; 70 | case WM_KEYDOWN: 71 | case WM_SYSKEYDOWN: 72 | UpdateKeyState(wParam & 0xFF, true); 73 | break; 74 | case WM_LBUTTONUP: 75 | UpdateKeyState(VK_LBUTTON, false); 76 | break; 77 | case WM_MBUTTONUP: 78 | UpdateKeyState(VK_MBUTTON, false); 79 | break; 80 | case WM_RBUTTONUP: 81 | UpdateKeyState(VK_RBUTTON, false); 82 | break; 83 | case WM_MOUSEMOVE: 84 | MousePos.x = static_cast(GET_X_LPARAM(lParam)); 85 | MousePos.y = static_cast(GET_Y_LPARAM(lParam)); 86 | break; 87 | case WM_XBUTTONUP: 88 | { 89 | const auto releasedkey = (wParam >> 16) & 0xFFFF; 90 | if (releasedkey == XBUTTON1) 91 | UpdateKeyState(VK_XBUTTON1, false); 92 | else if (releasedkey == XBUTTON2) 93 | UpdateKeyState(VK_XBUTTON2, false); 94 | break; 95 | } 96 | case WM_XBUTTONDOWN: 97 | { 98 | const auto releasedkey = (wParam >> 16) & 0xFFFF; 99 | if (releasedkey == XBUTTON1) 100 | UpdateKeyState(VK_XBUTTON1, true); 101 | else if (releasedkey == XBUTTON2) 102 | UpdateKeyState(VK_XBUTTON2, true); 103 | break; 104 | } 105 | case WM_LBUTTONDOWN: 106 | UpdateKeyState(VK_LBUTTON, true); 107 | break; 108 | case WM_MBUTTONDOWN: 109 | UpdateKeyState(VK_MBUTTON, true); 110 | break; 111 | case WM_RBUTTONDOWN: 112 | UpdateKeyState(VK_RBUTTON, true); 113 | break; 114 | default: 115 | return DefWindowProc(hWnd, message, wParam, lParam); 116 | } 117 | return 0; 118 | } 119 | 120 | // check for a held key 121 | bool IsKeyDown(int key) 122 | { 123 | if (key < 0 || key > 255) // assuming you are only dealing with ASCII values 124 | return false; 125 | return KeyHeld[key]; 126 | } 127 | 128 | // check for a clicked key 129 | bool IsKeyClicked(int key) 130 | { 131 | if (key < 0 || key > 255) // assuming you are only dealing with ASCII values 132 | return false; 133 | if (KeyStates[key] == KeyState::KeyInvoked && (KeyTimes[key]) >= (clock() * 0.001f) - 0.05f) 134 | return true; 135 | return false; 136 | } 137 | 138 | // just fill the dictionaries 139 | void SetInput() 140 | { 141 | for (int i = 0; i <= 255; i++) // 255 is for the ASCII character set, expand it for UTF8 Unicode 142 | { 143 | KeyStates[i] = KeyState::KeyDormant; 144 | KeyHeld[i] = false; 145 | KeyTimes[i] = 0.0f; 146 | } 147 | } 148 | 149 | bool IsMouseInRectangle(int x, int y, int width, int height) 150 | { 151 | return ( 152 | MousePos.x > x && 153 | MousePos.y > y && 154 | MousePos.x < x + width && 155 | MousePos.y < y + height 156 | ); 157 | } 158 | 159 | bool IsMouseInRectangle(Vector2 pos, Vector2 Dimensions) 160 | { 161 | return ( 162 | MousePos.x > pos.x && 163 | MousePos.y > pos.y && 164 | MousePos.x < pos.x + Dimensions.x && 165 | MousePos.y < pos.y + Dimensions.y 166 | ); 167 | } 168 | 169 | float TriangleArea(Vector2 point1, Vector2 point2, Vector2 point3) 170 | { 171 | return (point1.x - point3.x) * (point2.y - point3.y) - (point2.x - point3.x) * (point1.y - point3.y); 172 | } 173 | 174 | bool IsMouseInTriangle(Vector2 point1, Vector2 point2, Vector2 point3) 175 | { 176 | float d1; 177 | float d2; 178 | float d3; 179 | bool neg; 180 | bool pos; 181 | 182 | d1 = TriangleArea(MousePos, point1, point2); 183 | d2 = TriangleArea(MousePos, point2, point3); 184 | d3 = TriangleArea(MousePos, point3, point1); 185 | 186 | neg = (d1 < 0) || (d2 < 0) || (d3 < 0); 187 | pos = (d1 > 0) || (d2 > 0) || (d3 > 0); 188 | 189 | return !(neg && pos); 190 | } 191 | -------------------------------------------------------------------------------- /HuntDMA/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 | -------------------------------------------------------------------------------- /HuntDMA/Misc/Pch/Pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" -------------------------------------------------------------------------------- /HuntDMA/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" -------------------------------------------------------------------------------- /HuntDMA/Misc/SpectatorAlarm.cpp: -------------------------------------------------------------------------------- 1 | #include "Pch.h" 2 | #include "globals.h" 3 | #include "Drawing.h" 4 | #include "ConfigInstance.h" 5 | #include "ConfigUtilities.h" 6 | #include "Init.h" 7 | 8 | void DrawSpectators() 9 | { 10 | EnvironmentInstance->SpectatorCountMutex.lock(); 11 | int spectatorCount = EnvironmentInstance->GetSpectatorCount(); 12 | EnvironmentInstance->SpectatorCountMutex.unlock(); 13 | if (spectatorCount == 0) return; 14 | 15 | int pViewport[4] = { 0, 0, Configs.Overlay.OverrideResolution ? Configs.Overlay.Width : GetSystemMetrics(SM_CXSCREEN), Configs.Overlay.OverrideResolution ? Configs.Overlay.Height : GetSystemMetrics(SM_CYSCREEN) }; 16 | int lineWidth = 50; 17 | OutlineRectangle(pViewport[0], pViewport[1], pViewport[2], pViewport[3], lineWidth, MyColour(255, 0, 0, 255)); 18 | DrawText(0, 55, std::to_wstring(spectatorCount), "Verdana", 40, Colour(0, 255, 0), None); 19 | } -------------------------------------------------------------------------------- /HuntDMA/Misc/SpectatorAlarm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | extern void DrawSpectators(); -------------------------------------------------------------------------------- /HuntDMA/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 | } 199 | 200 | Vector4::Vector4() : x(0), y(0), z(0), w(0) 201 | { 202 | } 203 | 204 | Vector4::Vector4(float _x, float _y, float _z, float _w) : x(_x), y(_y), z(_z), w(_w) 205 | { 206 | } 207 | 208 | Vector4::~Vector4() 209 | { 210 | } 211 | 212 | Vector4 Vector4::operator*(const Vector4& a) const 213 | { 214 | return Vector4(x * a.x, y * a.y, z * a.z, w * a.w); 215 | } 216 | 217 | Vector3 Vector4::Mult(const Vector4& rotation, const Vector3& point) 218 | { 219 | float num = rotation.x * 2.0f; 220 | float num2 = rotation.y * 2.f; 221 | float num3 = rotation.z * 2.f; 222 | float num4 = rotation.x * num; 223 | float num5 = rotation.y * num2; 224 | float num6 = rotation.z * num3; 225 | float num7 = rotation.x * num2; 226 | float num8 = rotation.x * num3; 227 | float num9 = rotation.y * num3; 228 | float num10 = rotation.w * num; 229 | float num11 = rotation.w * num2; 230 | float num12 = rotation.w * num3; 231 | Vector3 result; 232 | result.x = (1.f - (num5 + num6)) * point.x + (num7 - num12) * point.y + (num8 + num11) * point.z; 233 | result.y = (num7 + num12) * point.x + (1.0f - (num4 + num6)) * point.y + (num9 - num10) * point.z; 234 | result.z = (num8 - num11) * point.x + (num9 + num10) * point.y + (1.f - (num4 + num5)) * point.z; 235 | return result; 236 | 237 | } 238 | 239 | 240 | Vector4 Vector4::operator*(float f) const 241 | { 242 | return Vector4(x * f, y * f, z * f, w * f); 243 | } 244 | 245 | Vector4 Vector4::operator/(const Vector4& a) const 246 | { 247 | return Vector4(x / a.x, y / a.y, z / a.z, w / a.w); 248 | } 249 | 250 | Vector4 Vector4::operator/(float f) const 251 | { 252 | return Vector4(x / f, y / f, z / f, w / f); 253 | } 254 | 255 | Vector4 Vector4::operator+(const Vector4& a) const 256 | { 257 | return Vector4(x + a.x, y + a.y, z + a.z, w + a.w); 258 | } 259 | 260 | Vector4 Vector4::operator-(const Vector4& a) const 261 | { 262 | return Vector4(x - a.x, y - a.y, z - a.z, w - a.w); 263 | } 264 | 265 | bool Vector4::operator==(const Vector4& a) const 266 | { 267 | return x == a.x && y == a.y && z == a.z && w == a.w; 268 | } 269 | 270 | bool Vector4::operator!=(const Vector4& a) const 271 | { 272 | return x != a.x || y != a.y || z != a.z || w != a.w; 273 | } 274 | 275 | bool Vector4::IsZero() const 276 | { 277 | return !x && !y && !z && !w; 278 | } 279 | 280 | float Vector4::Dot(const Vector4& left, const Vector4& right) 281 | { 282 | return (left.x * right.x) + (left.y * right.y) + (left.z * right.z) + (left.w * right.w); 283 | } 284 | 285 | float Vector4::Distance(const Vector4& a, const Vector4& b) 286 | { 287 | const Vector4 difference = Vector4( 288 | a.x - b.x, 289 | a.y - b.y, 290 | a.z - b.z, 291 | a.w - b.w); 292 | 293 | return sqrtf( 294 | powf(difference.x, 2.0f) + 295 | powf(difference.y, 2.0f) + 296 | powf(difference.z, 2.0f) + 297 | powf(difference.w, 2.0f) 298 | ); 299 | } 300 | 301 | int Vector4::FormattedDistance(const Vector4& a, const Vector4& b) 302 | { 303 | const auto difference = Vector4( 304 | a.x - b.x, 305 | a.y - b.y, 306 | a.z - b.z, 307 | a.w - b.w); 308 | 309 | int distance = sqrt( 310 | powf(difference.x, 2.0f) + 311 | powf(difference.y, 2.0f) + 312 | powf(difference.z, 2.0f) + 313 | powf(difference.w, 2.0f) 314 | ); 315 | return (int)(5 * round(distance / 5.0)); 316 | } 317 | 318 | Vector4 Vector4::Zero() 319 | { 320 | return Vector4(); 321 | } 322 | 323 | float Vector4::Length() const 324 | { 325 | return sqrt((x * x) + (y * y) + (z * z) + (w * w)); 326 | } 327 | 328 | float Vector4::LengthSqr() const 329 | { 330 | return (x * x) + (y * y) + (z * z) + (w * w); 331 | } 332 | 333 | Vector4 Vector4::Clamp() const 334 | { 335 | Vector4 angles = *this; 336 | 337 | if (angles.x > 89.f) 338 | angles.x -= 360.f; 339 | else if (angles.x < -89.f) 340 | angles.x += 360.f; 341 | 342 | if (angles.y > 180.f) 343 | angles.y -= 360.f; 344 | else if (angles.y < -180.f) 345 | angles.y += 360.f; 346 | 347 | angles.z = 0.f; 348 | angles.w = 0.f; 349 | return angles; 350 | } 351 | 352 | Vector4 Vector4::ToQuaternion(const Vector2& euler) 353 | { 354 | const auto to_radians = [](float degree) -> float 355 | { 356 | constexpr float pi = 3.14159265358979323846f; 357 | return degree * (pi / 180.f); 358 | }; 359 | 360 | float heading = to_radians(euler.x); 361 | float attitude = to_radians(euler.y); 362 | float bank = to_radians(0); 363 | 364 | float c1 = cos(heading * 0.5f); 365 | float s1 = sin(heading * 0.5f); 366 | float c2 = cos(attitude * 0.5f); 367 | float s2 = sin(attitude * 0.5f); 368 | float c3 = cos(bank * 0.5f); 369 | float s3 = sin(bank * 0.5f); 370 | 371 | float c1c2 = c1 * c2; 372 | float s1s2 = s1 * s2; 373 | 374 | Vector4 quat{ 375 | c1c2 * s3 + s1s2 * c3, 376 | s1 * c2 * c3 + c1 * s2 * s3, 377 | c1 * s2 * c3 - s1 * c2 * s3, 378 | c1c2 * c3 - s1s2 * s3 379 | }; 380 | 381 | return { quat.y, quat.z, (quat.x * -1.f), quat.w }; 382 | } 383 | -------------------------------------------------------------------------------- /HuntDMA/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 | 65 | class Vector4 66 | { 67 | public: 68 | Vector4(); 69 | Vector4(float _x, float _y, float _z, float _w); 70 | ~Vector4(); 71 | 72 | float x, y, z, w; 73 | 74 | Vector4 operator*(const Vector4& a) const; 75 | Vector4 operator*(float f) const; 76 | 77 | Vector4 operator/(const Vector4& a) const; 78 | Vector4 operator/(float f) const; 79 | Vector4 operator+(const Vector4& a) const; 80 | Vector4 operator-(const Vector4& a) const; 81 | 82 | bool operator==(const Vector4& a) const; 83 | bool operator!=(const Vector4& a) const; 84 | 85 | bool IsZero() const; 86 | static Vector4 ToQuaternion(const Vector2& euler); 87 | static float Dot(const Vector4& left, const Vector4& right); 88 | static float Distance(const Vector4& a, const Vector4& b); 89 | static int FormattedDistance(const Vector4& a, const Vector4& b); 90 | static Vector4 Zero(); 91 | static Vector4 Lerp(const Vector4& a, const Vector4& b, float t); 92 | static Vector3 Mult(const Vector4& rotation, const Vector3& point); 93 | float Length() const; 94 | float LengthSqr() const; 95 | 96 | Vector4 Clamp() const; 97 | }; 98 | -------------------------------------------------------------------------------- /HuntDMA/SDK/Camera.cpp: -------------------------------------------------------------------------------- 1 | #include "Pch.h" 2 | #include "Camera.h" 3 | #include "Globals.h" 4 | #include "ConfigUtilities.h" 5 | void Camera::UpdateCamera(VMMDLL_SCATTER_HANDLE handle) 6 | { 7 | TargetProcess.AddScatterReadRequest(handle, EnvironmentInstance->GetpSystem() + CameraBase + CameraPosOffset,&Position,sizeof(Vector3)); 8 | TargetProcess.AddScatterReadRequest(handle, EnvironmentInstance->GetpSystem() + CameraBase + ViewMatrixOffset, &RenderMatrix, sizeof(ViewMatrix)); 9 | TargetProcess.AddScatterReadRequest(handle, EnvironmentInstance->GetpSystem() + CameraBase + ProjectionMatrixOffset, &ProjectionMatrix, sizeof(ViewMatrix)); 10 | } 11 | 12 | Vector2 Camera::WorldToScreen(Vector3 pos) 13 | { 14 | if(Position == Vector3::Zero()) 15 | return Vector2::Zero(); 16 | Vector3 vAxisX, vAxisY, vAxisZ; 17 | Vector2 ScreenLocation; 18 | Vector4 transformed, projected; 19 | int pViewport[4] = { 0, 0, Configs.Overlay.OverrideResolution ? Configs.Overlay.Width : GetSystemMetrics(SM_CXSCREEN), Configs.Overlay.OverrideResolution ? Configs.Overlay.Height : GetSystemMetrics(SM_CYSCREEN) }; 20 | 21 | transformed.x = (float)(pos.x * RenderMatrix.matrix[0][0]) + (float)(pos.y * RenderMatrix.matrix[1][0]) + (float)(pos.z * RenderMatrix.matrix[2][0]) + RenderMatrix.matrix[3][0]; 22 | transformed.y = (float)(pos.x * RenderMatrix.matrix[0][1]) + (float)(pos.y * RenderMatrix.matrix[1][1]) + (float)(pos.z * RenderMatrix.matrix[2][1]) + RenderMatrix.matrix[3][1]; 23 | transformed.z = (float)(pos.x * RenderMatrix.matrix[0][2]) + (float)(pos.y * RenderMatrix.matrix[1][2]) + (float)(pos.z * RenderMatrix.matrix[2][2]) + RenderMatrix.matrix[3][2]; 24 | transformed.w = (float)(pos.x * RenderMatrix.matrix[0][3]) + (float)(pos.y * RenderMatrix.matrix[1][3]) + (float)(pos.z * RenderMatrix.matrix[2][3]) + RenderMatrix.matrix[3][3]; 25 | 26 | bool visible = transformed.z < 0.0f; 27 | 28 | projected.x = (float)(transformed.x * ProjectionMatrix.matrix[0][0]) + (float)(transformed.y * ProjectionMatrix.matrix[1][0]) + (float)(transformed.z * ProjectionMatrix.matrix[2][0]) + (float)(transformed.w * ProjectionMatrix.matrix[3][0]); 29 | projected.y = (float)(transformed.x * ProjectionMatrix.matrix[0][1]) + (float)(transformed.y * ProjectionMatrix.matrix[1][1]) + (float)(transformed.z * ProjectionMatrix.matrix[2][1]) + (float)(transformed.w * ProjectionMatrix.matrix[3][1]); 30 | projected.z = (float)(transformed.x * ProjectionMatrix.matrix[0][2]) + (float)(transformed.y * ProjectionMatrix.matrix[1][2]) + (float)(transformed.z * ProjectionMatrix.matrix[2][2]) + (float)(transformed.w * ProjectionMatrix.matrix[3][2]); 31 | projected.w = (float)(transformed.x * ProjectionMatrix.matrix[0][3]) + (float)(transformed.y * ProjectionMatrix.matrix[1][3]) + (float)(transformed.z * ProjectionMatrix.matrix[2][3]) + (float)(transformed.w * ProjectionMatrix.matrix[3][3]); 32 | 33 | if (projected.z == 0.0f) 34 | { 35 | ScreenLocation.x = 0; 36 | ScreenLocation.y = 0; 37 | // ScreenLocation.z = 0; 38 | return ScreenLocation; 39 | } 40 | 41 | projected.x /= projected.w; 42 | projected.y /= projected.w; 43 | projected.z /= projected.w; 44 | 45 | visible = visible && (abs(projected.x) <= 1.0f) && (abs(projected.y) <= 1.0f); 46 | 47 | if (!visible) { 48 | ScreenLocation.x = 0; 49 | ScreenLocation.y = 0; 50 | // ScreenLocation.z = 0; 51 | return ScreenLocation; 52 | } 53 | 54 | //output coords 55 | ScreenLocation.x = pViewport[0] + (1 + projected.x) * pViewport[2] / 2; 56 | ScreenLocation.y = pViewport[1] + (1 - projected.y) * pViewport[3] / 2; //flip coords for y axis 57 | // ScreenLocation.z = projected.z; 58 | return ScreenLocation; 59 | } 60 | -------------------------------------------------------------------------------- /HuntDMA/SDK/Camera.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | class Camera 3 | { 4 | private: 5 | uint64_t CameraBase = 0x928; 6 | uint64_t ViewMatrixOffset = 0x230; 7 | uint64_t CameraPosOffset = 0x2F0; 8 | uint64_t ProjectionMatrixOffset = 0x270; 9 | 10 | Vector3 Position; 11 | ViewMatrix RenderMatrix; 12 | ViewMatrix ProjectionMatrix; 13 | 14 | public: 15 | void UpdateCamera(VMMDLL_SCATTER_HANDLE handle); 16 | Vector3 GetPosition() { return Position;} 17 | Vector2 WorldToScreen(Vector3 pos); 18 | 19 | }; -------------------------------------------------------------------------------- /HuntDMA/SDK/Environment.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "WorldEntity.h" 3 | class Environment 4 | { 5 | private: 6 | uint64_t SystemGlobalEnvironment = 0x23462F8; // This is the only thing that should need updating // https://www.unknowncheats.me/forum/other-fps-games/350352-hunt-showdown-27.html Someone would post it here 7 | uint64_t EntitySystem = 0xC0; 8 | uint64_t pSystem = 0x90; 9 | uint16_t ObjectCount = 0x0; 10 | uint64_t EntityList = 0xC0; 11 | uint16_t ObjectCountOffset = 0x40092; 12 | uint64_t EntityListOffset = 0x40098; 13 | int SpectatorCount = 0; 14 | std::vector> PlayerList; 15 | std::vector> BossesList; 16 | std::vector> SupplyList; 17 | std::vector> BloodBondsList; 18 | std::vector> TrapList; 19 | std::vector> POIList; 20 | public: 21 | uint64_t GetSystemGlobalEnvironment() { return SystemGlobalEnvironment; } 22 | uint64_t GetEntitySystem() { return EntitySystem; } 23 | uint64_t GetpSystem() { return pSystem; } 24 | uint16_t GetObjectCount() { return ObjectCount; } 25 | uint64_t GetEntityList() { return EntityList; } 26 | void GetEntitys(); 27 | void UpdatePlayerList(); 28 | void UpdateBossesList(); 29 | void CacheEntities(); 30 | Environment(); 31 | void ClearConsole(); 32 | std::mutex PlayerListMutex; 33 | std::mutex BossesListMutex; 34 | std::mutex SupplyListMutex; 35 | std::mutex BloodBondsListMutex; 36 | std::mutex TrapListMutex; 37 | std::mutex POIListMutex; 38 | std::mutex SpectatorCountMutex; 39 | std::vector> GetPlayerList() { return PlayerList; } 40 | std::vector> GetBossesList() { return BossesList; } 41 | std::vector> GetSupplyList() { return SupplyList; } 42 | std::vector> GetBloodBondsList() { return BloodBondsList; } 43 | std::vector> GetTrapList() { return TrapList; } 44 | std::vector> GetPOIList() { return POIList; } 45 | int GetSpectatorCount() { return SpectatorCount; } 46 | }; -------------------------------------------------------------------------------- /HuntDMA/SDK/WorldEntity.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "WorldEntity.h" 3 | 4 | WorldEntity::WorldEntity( uint64_t entity) 5 | { 6 | this->Class = entity; 7 | this->ClassAddress = entity; 8 | 9 | } 10 | void WorldEntity::SetUp(VMMDLL_SCATTER_HANDLE handle) 11 | { 12 | TargetProcess.AddScatterReadRequest(handle, this->Class + SpecCountOffset1, &SpecCountPointer1, sizeof(uint64_t)); 13 | TargetProcess.AddScatterReadRequest(handle, this->Class + HpOffset1, &HpPointer1, sizeof(uint64_t)); 14 | TargetProcess.AddScatterReadRequest(handle, this->Class + PosOffset, &Position, sizeof(Vector3)); 15 | TargetProcess.AddScatterReadRequest(handle, this->Class + StringBufferOffset, &EntityNamePointer, sizeof(uint64_t)); 16 | TargetProcess.AddScatterReadRequest(handle, this->Class + ClassPointerOffset,&ClassPointer, sizeof(uint64_t)); 17 | if (Class != 0) 18 | TargetProcess.AddScatterReadRequest(handle, this->Class + SlotsPointerOffset, &SlotsPointer, sizeof(uint64_t)); 19 | else 20 | SlotsPointer = 0; 21 | } 22 | void WorldEntity::SetUp1(VMMDLL_SCATTER_HANDLE handle) 23 | { 24 | TargetProcess.AddScatterReadRequest(handle, this->SpecCountPointer1 + SpecCountOffset2, &SpecCountPointer2, sizeof(uint64_t)); 25 | TargetProcess.AddScatterReadRequest(handle, this->HpPointer1 + HpOffset2, &HpPointer2, sizeof(uint64_t)); 26 | TargetProcess.AddScatterReadRequest(handle,this->EntityNamePointer, &EntityName, sizeof(EntityNameStruct)); 27 | TargetProcess.AddScatterReadRequest(handle, this->ClassPointer + StringBufferOffset,&ClassNamePointer, sizeof(uint64_t)); 28 | if (SlotsPointer != 0) 29 | TargetProcess.AddScatterReadRequest(handle, this->SlotsPointer, &Slot, sizeof(uint64_t)); 30 | else 31 | Slot = 0; 32 | } 33 | void WorldEntity::SetUp2(VMMDLL_SCATTER_HANDLE handle) 34 | { 35 | TargetProcess.AddScatterReadRequest(handle, this->SpecCountPointer2 + SpecCountOffset3, &SpecCountPointer3, sizeof(uint64_t)); 36 | TargetProcess.AddScatterReadRequest(handle, this->HpPointer2 + HpOffset3, &HpPointer3, sizeof(uint64_t)); 37 | if (Slot != 0) 38 | TargetProcess.AddScatterReadRequest(handle, this->Slot + RenderNodePointerOffset, &RenderNodePointer, sizeof(uint64_t)); 39 | else 40 | RenderNodePointer = 0; 41 | TargetProcess.AddScatterReadRequest( handle, this->ClassNamePointer,&ClassName, sizeof(EntityNameStruct)); 42 | 43 | } 44 | void WorldEntity::SetUp3(VMMDLL_SCATTER_HANDLE handle) 45 | { 46 | TargetProcess.AddScatterReadRequest(handle, this->SpecCountPointer3 + SpecCountOffset4, &SpecCountPointer4, sizeof(uint64_t)); 47 | TargetProcess.AddScatterReadRequest(handle, this->HpPointer3 + HpOffset4, &HpPointer4, sizeof(uint64_t)); 48 | ClassName.name[99] = '\0'; 49 | EntityName.name[99] = '\0'; 50 | TargetProcess.AddScatterReadRequest(handle, RenderNodePointer, &Node, sizeof(RenderNode)); 51 | } 52 | void WorldEntity::SetUp4(VMMDLL_SCATTER_HANDLE handle) 53 | { 54 | TargetProcess.AddScatterReadRequest(handle, this->HpPointer4 + HpOffset5, &HpPointer5, sizeof(uint64_t)); 55 | } 56 | 57 | void WorldEntity::WriteNode(VMMDLL_SCATTER_HANDLE handle, int colour, bool show) 58 | { 59 | uint32_t convertedcolour = 0; 60 | /* std::vector{LIT(L"Outline Red"), LIT(L"Outline Blue"), LIT(L"Outline Yellow"), LIT(L"Outline Orange"), LIT(L"Outline Cyan"), LIT(L"Outline White"), 61 | LIT(L"Filled Red"), LIT(L"Filled Blue"), LIT(L"Filled Yellow"), LIT(L"Filled Orange"), LIT(L"Filled Cyan"), LIT(L"Filled White")});*/ 62 | if(colour == 0) 63 | convertedcolour = 0xFF0000FF; // Outline Red 64 | else if (colour == 1) 65 | convertedcolour = 0x0000FFFF; // Outline Blue 66 | else if (colour == 2) 67 | convertedcolour = 0xFFFF00FF; // Outline Yellow 68 | else if (colour == 3) 69 | convertedcolour = 0xFFA500FF; // Outline Orange 70 | else if (colour == 4) 71 | convertedcolour = 0x00FFFFFF; // Outline Cyan 72 | else if (colour == 5) 73 | convertedcolour = 0xFF00FFFF; // Outline Magenta 74 | else if (colour == 6) 75 | convertedcolour = 0xFFFFFFFF; // Outline White 76 | else if (colour == 7) 77 | convertedcolour = 0xFF000000; // Filled Red 78 | else if (colour == 8) 79 | convertedcolour = 0x0000FF00; // Filled Blue 80 | else if (colour == 9) 81 | convertedcolour = 0xFFFF0000; // Filled Yellow 82 | else if (colour == 10) 83 | convertedcolour = 0xFFA50000; // Filled Orange 84 | else if (colour == 11) 85 | convertedcolour = 0x00FFFF00; // Filled Cyan 86 | else if (colour == 12) 87 | convertedcolour = 0xFF00FF00; // Filled Magenta 88 | else if (colour == 13) 89 | convertedcolour = 0xFFFFFF00; // Filled White 90 | if (RenderNodePointer != 0) 91 | { 92 | // if(Node.rnd_flags == 284558360584 || Node.rnd_flags == 9680453640) 93 | uint64_t none = 0x200000008; 94 | uint64_t allmap = 0x80018; 95 | uint64_t limit_distance = 0x80008; 96 | float maxdistance = 5000; 97 | if (!show) 98 | { 99 | TargetProcess.AddScatterWriteRequest(handle, RenderNodePointer + 0x10, &none, sizeof(uint64_t)); 100 | return; 101 | } 102 | TargetProcess.AddScatterWriteRequest(handle, RenderNodePointer + 0x10, &allmap, sizeof(uint64_t)); // change render flag to max distance, allows us to use chams at further distances as long as the model isn't culled. 103 | TargetProcess.AddScatterWriteRequest(handle, RenderNodePointer + 0x2C, &convertedcolour, sizeof(uint32_t)); 104 | TargetProcess.AddScatterWriteRequest(handle, RenderNodePointer + 0x38, &maxdistance, sizeof(float)); 105 | } 106 | } 107 | 108 | void WorldEntity::UpdatePosition(VMMDLL_SCATTER_HANDLE handle) 109 | { 110 | TargetProcess.AddScatterReadRequest(handle, this->Class + PosOffset, &Position, sizeof(Vector3)); 111 | } 112 | 113 | void WorldEntity::UpdateNode(VMMDLL_SCATTER_HANDLE handle) 114 | { 115 | TargetProcess.AddScatterReadRequest(handle, RenderNodePointer, &Node, sizeof(RenderNode)); 116 | } 117 | 118 | void WorldEntity::UpdateHealth(VMMDLL_SCATTER_HANDLE handle) 119 | { 120 | TargetProcess.AddScatterReadRequest(handle, HpPointer5, &Health, sizeof(HealthBar)); 121 | } 122 | 123 | void WorldEntity::UpdateClass(VMMDLL_SCATTER_HANDLE handle) 124 | { 125 | TargetProcess.AddScatterReadRequest(handle, this->Class, &ClassAddress, sizeof(uint64_t)); 126 | } -------------------------------------------------------------------------------- /HuntDMA/SDK/WorldEntity.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Memory.h" 3 | struct RenderNode { 4 | char pad_01[0x10]; // 0x00(0x10) 5 | unsigned __int64 rnd_flags; // 0x10(0x08) 6 | char pad_02[0x14]; // 0x18(0x14) 7 | unsigned int silhouettes_param; // 0x2C(0x04) 8 | char pad_03[0x8]; // 0x30(0x8) 9 | float m_fWSMaxViewDist; //0x38(0x4) 10 | }; 11 | struct HealthBar { 12 | char pad_01[0x10]; // 0x00(0x10) 13 | unsigned int current_hp; // 0x10(0x04) 14 | unsigned int regenerable_max_hp; // 0x14(0x04) 15 | unsigned int current_max_hp; // 0x18(0x04) 16 | }; 17 | struct EntityNameStruct { 18 | char name[100]; 19 | }; 20 | enum class EntityType : int 21 | { 22 | EnemyPlayer, 23 | FriendlyPlayer, 24 | 25 | Butcher, 26 | Spider, 27 | Assassin, 28 | Scrapbeak, 29 | Rotjaw, 30 | Hellborn, 31 | 32 | CurrencyCollection, 33 | CashRegister, 34 | GoldCashRegister, 35 | 36 | ExtractionPoint, 37 | 38 | BearTrap, 39 | TripMine, 40 | 41 | Barrel, 42 | BioBarrel, 43 | 44 | AmmoSwapBox, 45 | SpitzerBullets, 46 | PoisonBullets, 47 | HighVelocityBullets, 48 | IncendiaryBullets, 49 | DumDumBullets, 50 | ExplosiveBullets, 51 | FMJBullets, 52 | PoisonBolts, 53 | ExplosiveBolts, 54 | IncendiaryShells, 55 | PennyShotShells, 56 | FlechetteShells, 57 | SlugShells, 58 | 59 | SupplyBox, 60 | AmmoCrate, 61 | SpecialAmmoCrate, 62 | CompactAmmoPackage, 63 | MediumAmmoPackage, 64 | LongAmmoPackage, 65 | ShotgunAmmoPackage, 66 | Medkit, 67 | }; 68 | 69 | class WorldEntity 70 | { 71 | private: 72 | uint64_t Class = 0x0; 73 | uint64_t ClassAddress = 0x0; 74 | uint64_t PosOffset = 0x134; 75 | uint64_t StringBufferOffset = 0x10; 76 | uint64_t ClassPointerOffset = 0x18; 77 | uint64_t SlotsPointerOffset = 0xA8; 78 | uint64_t SlotOffset = 0x0; 79 | uint64_t RenderNodePointerOffset = 0xA0; 80 | RenderNode Node; 81 | EntityNameStruct EntityName; 82 | EntityNameStruct ClassName; 83 | 84 | uint64_t EntityNamePointer = 0x0; 85 | uint64_t ClassNamePointer = 0x0; 86 | uint64_t ClassPointer = 0x0; 87 | uint64_t SlotsPointer = 0x0; 88 | uint64_t Slot = 0x0; 89 | uint64_t RenderNodePointer = 0x0; 90 | Vector3 Position; 91 | EntityType Type; 92 | 93 | uint64_t HpOffset1 = 0x198; 94 | uint64_t HpOffset2 = 0x20; 95 | uint64_t HpOffset3 = 0xB0; 96 | uint64_t HpOffset4 = 0x78; 97 | uint64_t HpOffset5 = 0x58; 98 | uint64_t HpPointer1 = 0x0; 99 | uint64_t HpPointer2 = 0x0; 100 | uint64_t HpPointer3 = 0x0; 101 | uint64_t HpPointer4 = 0x0; 102 | uint64_t HpPointer5 = 0x0; 103 | HealthBar Health; 104 | 105 | bool Valid = true; 106 | std::unordered_map Names = { 107 | {EntityType::EnemyPlayer, L"Enemy Player"}, 108 | {EntityType::FriendlyPlayer, L"Teammate"}, 109 | 110 | {EntityType::Butcher, L"Butcher"}, 111 | {EntityType::Assassin, L"Assassin"}, 112 | {EntityType::Scrapbeak, L"Screapbeak"}, 113 | {EntityType::Spider, L"Spider"}, 114 | {EntityType::Rotjaw, L"Rotjaw"}, 115 | {EntityType::Hellborn, L"Hellborn"}, 116 | 117 | {EntityType::CurrencyCollection, L"BB"}, 118 | {EntityType::CashRegister, L"Cash Register"}, 119 | {EntityType::GoldCashRegister, L"GOLD Cash Register"}, 120 | 121 | {EntityType::ExtractionPoint, L"Extraction"}, 122 | 123 | {EntityType::BearTrap, L"Bear Trap"}, 124 | {EntityType::TripMine, L"Trip Mine"}, 125 | 126 | {EntityType::Barrel, L"Barrel"}, 127 | {EntityType::BioBarrel, L"Bio Barrel"}, 128 | 129 | {EntityType::AmmoSwapBox, L"AmmoSwap Box"}, 130 | {EntityType::SpitzerBullets, L"Spitzer Bullets"}, 131 | {EntityType::PoisonBullets, L"Poison Bullets"}, 132 | {EntityType::HighVelocityBullets, L"High Velocity Bullets"}, 133 | {EntityType::IncendiaryBullets, L"Incendiary Bullets"}, 134 | {EntityType::DumDumBullets, L"Dum Dum Bullets"}, 135 | {EntityType::ExplosiveBullets, L"Explosive Bullets"}, 136 | {EntityType::FMJBullets, L"FMJ Bullets"}, 137 | {EntityType::PoisonBolts, L"Poison Bolts"}, 138 | {EntityType::ExplosiveBolts, L"Explosive Bolts"}, 139 | {EntityType::IncendiaryShells, L"Incendiary Shells"}, 140 | {EntityType::PennyShotShells, L"Penny Shot Shells"}, 141 | {EntityType::FlechetteShells, L"Flechette Shells"}, 142 | {EntityType::SlugShells, L"Slug Shells"}, 143 | 144 | {EntityType::SupplyBox, L"Supply Box"}, 145 | {EntityType::AmmoCrate, L"Ammo Crate"}, 146 | {EntityType::SpecialAmmoCrate, L"Special Ammo Crate"}, 147 | {EntityType::CompactAmmoPackage, L"Compact Ammo Package"}, 148 | {EntityType::MediumAmmoPackage, L"Medium Ammo Package"}, 149 | {EntityType::LongAmmoPackage, L"Long Ammo Package"}, 150 | {EntityType::ShotgunAmmoPackage, L"Shotgun Ammo Package"}, 151 | {EntityType::Medkit, L"Medkit"}, 152 | }; 153 | public: 154 | WorldEntity( uint64_t classptr); 155 | void SetUp(VMMDLL_SCATTER_HANDLE handle); 156 | void SetUp1(VMMDLL_SCATTER_HANDLE handle); 157 | void SetUp2(VMMDLL_SCATTER_HANDLE handle); 158 | void SetUp3(VMMDLL_SCATTER_HANDLE handle); 159 | void SetUp4(VMMDLL_SCATTER_HANDLE handle); 160 | EntityNameStruct GetEntityName() { return EntityName; } 161 | EntityNameStruct GetEntityClassName() { return ClassName; } 162 | Vector3 GetPosition() { return Position; } 163 | RenderNode GetRenderNode() { return Node; } 164 | HealthBar GetHealth() { return Health; } 165 | void SetType(EntityType type) { Type = type; } 166 | EntityType GetType() { return Type; } 167 | void WriteNode(VMMDLL_SCATTER_HANDLE handle, int colour, bool show); 168 | void UpdatePosition(VMMDLL_SCATTER_HANDLE handle); 169 | void UpdateNode(VMMDLL_SCATTER_HANDLE handle); 170 | void UpdateHealth(VMMDLL_SCATTER_HANDLE handle); 171 | void UpdateClass(VMMDLL_SCATTER_HANDLE handle); 172 | uint64_t GetClass() { return ClassAddress; } 173 | bool GetValid() { return Valid; } 174 | void SetValid(bool valid) { Valid = valid; } 175 | std::wstring GetName() { return Names[Type]; }; 176 | 177 | uint64_t SpecCountOffset1 = 0x198; 178 | uint64_t SpecCountOffset2 = 0x28; 179 | uint64_t SpecCountOffset3 = 0xc8; 180 | uint64_t SpecCountOffset4 = 0x108; 181 | uint64_t SpecCountOffset5 = 0x10; 182 | uint64_t SpecCountPointer1 = 0x0; 183 | uint64_t SpecCountPointer2 = 0x0; 184 | uint64_t SpecCountPointer3 = 0x0; 185 | uint64_t SpecCountPointer4 = 0x0; 186 | int SpecCount = 0; 187 | }; 188 | -------------------------------------------------------------------------------- /HuntDMA/Security/XorStr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 - 2018 Justas Masiulis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef JM_LITHPP 18 | #define JM_LITHPP 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #define MAKE_STRING(str) \ 26 | ::jm::make_xorstr( \ 27 | []() { return str; }, \ 28 | std::make_index_sequence{}, \ 29 | std::make_index_sequence<::jm::detail::_buffer_size()>{}) 30 | 31 | #define LIT(str) MAKE_STRING(str).crypt_get() 32 | 33 | #ifdef _MSC_VER 34 | #define LITFORCEINLINE __forceinline 35 | #else 36 | #define LITFORCEINLINE __attribute__((always_inline)) 37 | #endif 38 | 39 | // you can define this macro to get possibly faster code on gcc/clang 40 | // at the expense of constants being put into data section. 41 | #if !defined(LITALLOW_DATA) 42 | // MSVC - no volatile 43 | // GCC and clang - volatile everywhere 44 | #if defined(__clang__) || defined(__GNUC__) 45 | #define LITVOLATILE volatile 46 | #endif 47 | 48 | #endif 49 | #ifndef LITVOLATILE 50 | #define LITVOLATILE 51 | #endif 52 | 53 | namespace jm 54 | { 55 | 56 | namespace detail 57 | { 58 | 59 | template 60 | struct unsigned_; 61 | 62 | template<> 63 | struct unsigned_<1> 64 | { 65 | using type = std::uint8_t; 66 | }; 67 | template<> 68 | struct unsigned_<2> 69 | { 70 | using type = std::uint16_t; 71 | }; 72 | template<> 73 | struct unsigned_<4> 74 | { 75 | using type = std::uint32_t; 76 | }; 77 | 78 | template 79 | struct pack_value_type 80 | { 81 | using type = decltype(C); 82 | }; 83 | 84 | template 85 | constexpr std::size_t _buffer_size() 86 | { 87 | return ((Size / 16) + (Size % 16 != 0)) * 2; 88 | } 89 | 90 | template 91 | struct tstring_ 92 | { 93 | using value_type = typename pack_value_type::type; 94 | constexpr static std::size_t size = sizeof...(Cs); 95 | constexpr static value_type str[size] = { Cs... }; 96 | 97 | constexpr static std::size_t buffer_size = _buffer_size(); 98 | constexpr static std::size_t buffer_align = 99 | #ifndef JM_LITDISABLE_AVX_INTRINSICS 100 | ((sizeof(str) > 16) ? 32 : 16); 101 | #else 102 | 16; 103 | #endif 104 | }; 105 | 106 | template 107 | struct _ki 108 | { 109 | constexpr static std::size_t idx = I; 110 | constexpr static std::uint64_t key = K; 111 | }; 112 | 113 | template 114 | constexpr std::uint32_t key4() noexcept 115 | { 116 | std::uint32_t value = Seed; 117 | for (char c : __TIME__) 118 | value = static_cast((value ^ c) * 16777619ull); 119 | return value; 120 | } 121 | 122 | template 123 | constexpr std::uint64_t key8() 124 | { 125 | constexpr auto first_part = key4<2166136261 + S>(); 126 | constexpr auto second_part = key4(); 127 | return (static_cast(first_part) << 32) | second_part; 128 | } 129 | 130 | // clang and gcc try really hard to place the constants in data 131 | // sections. to counter that there was a need to create an intermediate 132 | // constexpr string and then copy it into a non constexpr container with 133 | // volatile storage so that the constants would be placed directly into 134 | // code. 135 | template 136 | struct string_storage 137 | { 138 | std::uint64_t storage[T::buffer_size]; 139 | 140 | LITFORCEINLINE constexpr string_storage() noexcept : storage{ Keys... } 141 | { 142 | using cast_type = 143 | typename unsigned_::type; 144 | constexpr auto value_size = sizeof(typename T::value_type); 145 | // puts the string into 64 bit integer blocks in a constexpr 146 | // fashion 147 | for (std::size_t i = 0; i < T::size; ++i) 148 | storage[i / (8 / value_size)] ^= 149 | (std::uint64_t{ static_cast(T::str[i]) } 150 | << ((i % (8 / value_size)) * 8 * value_size)); 151 | } 152 | }; 153 | 154 | } // namespace detail 155 | 156 | template 157 | class xor_string 158 | { 159 | alignas(T::buffer_align) std::uint64_t _storage[T::buffer_size]; 160 | 161 | // _single functions needed because MSVC crashes without them 162 | LITFORCEINLINE void _crypt_256_single(const std::uint64_t* keys, 163 | std::uint64_t* storage) noexcept 164 | 165 | { 166 | _mm256_store_si256( 167 | reinterpret_cast<__m256i*>(storage), 168 | _mm256_xor_si256( 169 | _mm256_load_si256(reinterpret_cast(storage)), 170 | _mm256_load_si256(reinterpret_cast(keys)))); 171 | } 172 | 173 | template 174 | LITFORCEINLINE void _crypt_256(const std::uint64_t* keys, 175 | std::index_sequence) noexcept 176 | { 177 | (_crypt_256_single(keys + Idxs * 4, _storage + Idxs * 4), ...); 178 | } 179 | 180 | LITFORCEINLINE void _crypt_128_single(const std::uint64_t* keys, 181 | std::uint64_t* storage) noexcept 182 | { 183 | _mm_store_si128( 184 | reinterpret_cast<__m128i*>(storage), 185 | _mm_xor_si128(_mm_load_si128(reinterpret_cast(storage)), 186 | _mm_load_si128(reinterpret_cast(keys)))); 187 | } 188 | 189 | template 190 | LITFORCEINLINE void _crypt_128(const std::uint64_t* keys, 191 | std::index_sequence) noexcept 192 | { 193 | (_crypt_128_single(keys + Idxs * 2, _storage + Idxs * 2), ...); 194 | } 195 | 196 | // loop generates vectorized code which places constants in data dir 197 | LITFORCEINLINE constexpr void _copy() noexcept 198 | { 199 | constexpr detail::string_storage storage; 200 | static_cast(std::initializer_list{ 201 | (const_cast(_storage))[Keys::idx] = 202 | storage.storage[Keys::idx]... }); 203 | } 204 | 205 | public: 206 | using value_type = typename T::value_type; 207 | using size_type = std::size_t; 208 | using pointer = value_type*; 209 | using const_pointer = const pointer; 210 | 211 | LITFORCEINLINE xor_string() noexcept { _copy(); } 212 | 213 | LITFORCEINLINE constexpr size_type size() const noexcept 214 | { 215 | return T::size - 1; 216 | } 217 | 218 | LITFORCEINLINE void crypt() noexcept 219 | { 220 | alignas(T::buffer_align) std::uint64_t keys[T::buffer_size]; 221 | static_cast(std::initializer_list{ 222 | (const_cast(keys))[Keys::idx] = 223 | Keys::key... }); 224 | 225 | _copy(); 226 | 227 | #define JM_LITDISABLE_AVX_INTRINSICS 228 | #ifndef JM_LITDISABLE_AVX_INTRINSICS 229 | _crypt_256(keys, std::make_index_sequence{}); 230 | if constexpr (T::buffer_size % 4 != 0) 231 | _crypt_128(keys, std::index_sequence{}); 232 | #else 233 | _crypt_128(keys, std::make_index_sequence{}); 234 | #endif 235 | } 236 | 237 | LITFORCEINLINE const_pointer get() const noexcept 238 | { 239 | return reinterpret_cast(_storage); 240 | } 241 | 242 | LITFORCEINLINE const_pointer crypt_get() noexcept 243 | { 244 | crypt(); 245 | return reinterpret_cast(_storage); 246 | } 247 | }; 248 | 249 | template 250 | LITFORCEINLINE constexpr auto 251 | make_xorstr(Tstr str_lambda, 252 | std::index_sequence, 253 | std::index_sequence) noexcept 254 | { 255 | return xor_string, 256 | detail::_ki()>...>{}; 257 | } 258 | 259 | } // namespace jm 260 | 261 | #endif // include guard -------------------------------------------------------------------------------- /Images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelSDM/HuntDMA/2e5ac4006fb59b4feb8537155534fb81ae8f4763/Images/2.png -------------------------------------------------------------------------------- /Images/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelSDM/HuntDMA/2e5ac4006fb59b4feb8537155534fb81ae8f4763/Images/4.png -------------------------------------------------------------------------------- /Images/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelSDM/HuntDMA/2e5ac4006fb59b4feb8537155534fb81ae8f4763/Images/5.png -------------------------------------------------------------------------------- /Images/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelSDM/HuntDMA/2e5ac4006fb59b4feb8537155534fb81ae8f4763/Images/6.png -------------------------------------------------------------------------------- /Instructions.md: -------------------------------------------------------------------------------- 1 | # Install Guide 2 | [Simple Video Guide](https://youtu.be/1Ug1PUPSozg)
3 | 4 | ## Installing Dependencies 5 | 6 | Download The Latest [MemProcFS Release](https://github.com/ufrisk/MemProcFS/releases). Install The win_x64 File.
7 |

8 | 10 |

11 | Drag And Drop The Contents Into The Build Directory.
12 | 13 | 14 | [Download the FTD3xx Dlls](https://ftdichip.com/wp-content/uploads/2024/01/FTD3XXLibrary_v1.3.0.9.zip) 15 | In the .rar file navigate to FTD3XXLibrary->x64->DLL 16 | 17 |

18 | 20 |

21 | Drop them into the build directory.
22 | 23 | 24 | Before: 25 |

26 | 28 |

29 | After: 30 |

31 | 33 |

34 | 35 | ## Environment Variables 36 | 37 | Now Python Must Be Set Up.
38 | [Install Python 3.8](https://www.python.org/ftp/python/3.8.0/python-3.8.0-amd64.exe)
39 | Find your install directory, This should be: 40 | ``` 41 | AppData\Local\Programs\Python\Python38 42 | ``` 43 | Open Environment Variables: 44 |

45 | 47 |

48 |

49 | 51 |

52 |

53 | 55 |

56 |

57 | 59 |

60 | In The Variable Value Add The Python Path And Python Script Path. Like This(the \dev\ should be your windows username): 61 | 62 | ``` 63 | C:\Users\dev\AppData\Local\Programs\Python\Python38 64 | C:\Users\dev\AppData\Local\Programs\Python\Python38\Scripts 65 | ``` 66 | Then Add A Semi Colon Inbetween Them As Such: 67 | 68 | ``` 69 | C:\Users\dev\AppData\Local\Programs\Python\Python38;C:\Users\dev\AppData\Local\Programs\Python\Python38\Scripts 70 | ``` 71 | 72 |

73 | 75 |

76 | Apply These Changes And You Will Be Ready To Go. 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 SDM 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Lib/FTD3XX.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelSDM/HuntDMA/2e5ac4006fb59b4feb8537155534fb81ae8f4763/Lib/FTD3XX.lib -------------------------------------------------------------------------------- /Lib/leechcore.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelSDM/HuntDMA/2e5ac4006fb59b4feb8537155534fb81ae8f4763/Lib/leechcore.lib -------------------------------------------------------------------------------- /Lib/vmm.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelSDM/HuntDMA/2e5ac4006fb59b4feb8537155534fb81ae8f4763/Lib/vmm.lib -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hunt DMA Cheat 2 | Fully Featured Hunt DMA Cheat With Chams, Fuser ESP 3 | 4 | 5 | ## Showcase 6 | 7 | Play Video 8 | 9 | 10 | Play Video 11 | 12 |

13 | 15 |

16 | 17 |

18 | 20 |

21 | 22 | ## Instructions 23 | * [Installation Guide](./Instructions.md) 24 |
25 | 26 | To Update: Change the SystemGlobalEnvironment Offset in SDK/Environment.h https://github.com/IntelSDM/HuntDMA/blob/67f7d5836460807b2686d123deeada08e5c76618/HuntDMA/SDK/Environment.h#L6 27 | [This will likely be on Unknowncheats a day after any updates](https://www.unknowncheats.me/forum/other-fps-games/350352-hunt-showdown.html). Just go to the last page and someone will have posted it after an update. 28 | 29 | ## Fixed and Supported Features 30 | * Player ESP 31 | * Name 32 | * Distance 33 | * Health 34 | * Chams 35 | * Friendly Color 36 | * Cham Color 37 | * Boss ESP 38 | * Name 39 | * Distance 40 | * Supply ESP 41 | * Name 42 | * Distance 43 | * Toggalable types 44 | * BloodBound ESP (WIP) 45 | * Name 46 | * Distance 47 | * Trap ESP 48 | * Name 49 | * Distance 50 | * Points of Interest ESP 51 | * Name 52 | * Distance 53 | * Config 54 | * Load 55 | * Save 56 | * Spectating alarm 57 | * FPS 58 | 59 | ### Player ESP 60 | It's recommended to turn on after teammates are no longer tagged as enemy players or after raid starts. Then turn it off. 61 | 62 | ### Supply ESP 63 | You can choose only your type of ammo, esp will show only nessesary items 64 | 65 | ### Trap ESP 66 | Also barrels 67 | 68 | ### Points of Interest ESP 69 | For now only Extraction Point 70 | 71 | ### Spectating alarm 72 | Can't be turned off for now. Shows you red frame and in big green number how many players are spectating you. Your teammates counts. 73 | 74 | ## Credits 75 | * [PCILeech](https://github.com/ufrisk/pcileech) 76 | * [MemProcFS](https://github.com/ufrisk/MemProcFS) 77 | * [insanefury](https://www.unknowncheats.me/forum/3809820-post343.html) 78 | * [DMALibrary](https://github.com/Metick/DMALibrary/tree/Master) 79 | * [WhiteBrim](https://github.com/Whitebrim) 80 | --------------------------------------------------------------------------------