├── .gitignore ├── README.md ├── Thrift.sln └── Thrift ├── Client ├── Client.cpp ├── Client.h ├── Kiero │ ├── Kiero.cpp │ └── Kiero.h ├── Manager │ ├── Category │ │ ├── Category.cpp │ │ ├── Category.h │ │ └── Module │ │ │ ├── Module.cpp │ │ │ ├── Module.h │ │ │ └── Modules │ │ │ ├── Movement │ │ │ ├── AirJump.cpp │ │ │ └── AirJump.h │ │ │ ├── Other │ │ │ ├── TestModule.cpp │ │ │ └── TestModule.h │ │ │ └── Visual │ │ │ ├── RainbowText.cpp │ │ │ ├── RainbowText.h │ │ │ ├── TabGui.cpp │ │ │ └── TabGui.h │ ├── Hook │ │ ├── Hook.cpp │ │ ├── Hook.h │ │ └── Hooks │ │ │ ├── ClientInstance │ │ │ ├── HookClientInstance.cpp │ │ │ └── HookClientInstance.h │ │ │ ├── Key │ │ │ ├── HookKey.cpp │ │ │ └── HookKey.h │ │ │ ├── LoopbackPacketSender │ │ │ ├── HookLoopbackPacketSender.cpp │ │ │ └── HookLoopbackPacketSender.h │ │ │ └── SwapChain │ │ │ ├── HookSwapChain.h │ │ │ └── Hook_SwapChain.cpp │ ├── Manager.cpp │ └── Manager.h ├── SDK │ ├── Classes │ │ ├── Actor.h │ │ ├── ClientInstance.h │ │ ├── DirectPlayerMovementProxy.h │ │ ├── LoopbackPacketSender.h │ │ ├── MinecraftGame.h │ │ ├── MinecraftUIRenderContext.cpp │ │ ├── MinecraftUIRenderContext.h │ │ ├── Packet.cpp │ │ ├── Packet.h │ │ └── Player.h │ ├── Minecraft.cpp │ └── Minecraft.h └── Utils │ ├── Utils.cpp │ └── Utils.h ├── Thrift.cpp ├── Thrift.vcxproj ├── Thrift.vcxproj.filters └── packages.config /.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/main/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 | [Ll]og/ 33 | [Ll]ogs/ 34 | 35 | # Visual Studio 2015/2017 cache/options directory 36 | .vs/ 37 | # Uncomment if you have tasks that create the project's static files in wwwroot 38 | #wwwroot/ 39 | 40 | # Visual Studio 2017 auto generated files 41 | Generated\ Files/ 42 | 43 | # MSTest test Results 44 | [Tt]est[Rr]esult*/ 45 | [Bb]uild[Ll]og.* 46 | 47 | # NUnit 48 | *.VisualState.xml 49 | TestResult.xml 50 | nunit-*.xml 51 | 52 | # Build Results of an ATL Project 53 | [Dd]ebugPS/ 54 | [Rr]eleasePS/ 55 | dlldata.c 56 | 57 | # Benchmark Results 58 | BenchmarkDotNet.Artifacts/ 59 | 60 | # .NET Core 61 | project.lock.json 62 | project.fragment.lock.json 63 | artifacts/ 64 | 65 | # ASP.NET Scaffolding 66 | ScaffoldingReadMe.txt 67 | 68 | # StyleCop 69 | StyleCopReport.xml 70 | 71 | # Files built by Visual Studio 72 | *_i.c 73 | *_p.c 74 | *_h.h 75 | *.ilk 76 | *.meta 77 | *.obj 78 | *.iobj 79 | *.pch 80 | *.pdb 81 | *.ipdb 82 | *.pgc 83 | *.pgd 84 | *.rsp 85 | *.sbr 86 | *.tlb 87 | *.tli 88 | *.tlh 89 | *.tmp 90 | *.tmp_proj 91 | *_wpftmp.csproj 92 | *.log 93 | *.tlog 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 6 auto-generated project file (contains which files were open etc.) 298 | *.vbp 299 | 300 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 301 | *.dsw 302 | *.dsp 303 | 304 | # Visual Studio 6 technical files 305 | *.ncb 306 | *.aps 307 | 308 | # Visual Studio LightSwitch build output 309 | **/*.HTMLClient/GeneratedArtifacts 310 | **/*.DesktopClient/GeneratedArtifacts 311 | **/*.DesktopClient/ModelManifest.xml 312 | **/*.Server/GeneratedArtifacts 313 | **/*.Server/ModelManifest.xml 314 | _Pvt_Extensions 315 | 316 | # Paket dependency manager 317 | .paket/paket.exe 318 | paket-files/ 319 | 320 | # FAKE - F# Make 321 | .fake/ 322 | 323 | # CodeRush personal settings 324 | .cr/personal 325 | 326 | # Python Tools for Visual Studio (PTVS) 327 | __pycache__/ 328 | *.pyc 329 | 330 | # Cake - Uncomment if you are using it 331 | # tools/** 332 | # !tools/packages.config 333 | 334 | # Tabs Studio 335 | *.tss 336 | 337 | # Telerik's JustMock configuration file 338 | *.jmconfig 339 | 340 | # BizTalk build output 341 | *.btp.cs 342 | *.btm.cs 343 | *.odx.cs 344 | *.xsd.cs 345 | 346 | # OpenCover UI analysis results 347 | OpenCover/ 348 | 349 | # Azure Stream Analytics local run output 350 | ASALocalRun/ 351 | 352 | # MSBuild Binary and Structured Log 353 | *.binlog 354 | 355 | # NVidia Nsight GPU debugger configuration file 356 | *.nvuser 357 | 358 | # MFractors (Xamarin productivity tool) working folder 359 | .mfractor/ 360 | 361 | # Local History for Visual Studio 362 | .localhistory/ 363 | 364 | # Visual Studio History (VSHistory) files 365 | .vshistory/ 366 | 367 | # BeatPulse healthcheck temp database 368 | healthchecksdb 369 | 370 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 371 | MigrationBackup/ 372 | 373 | # Ionide (cross platform F# VS Code tools) working folder 374 | .ionide/ 375 | 376 | # Fody - auto-generated XML schema 377 | FodyWeavers.xsd 378 | 379 | # VS Code files for those working on multiple tools 380 | .vscode/* 381 | !.vscode/settings.json 382 | !.vscode/tasks.json 383 | !.vscode/launch.json 384 | !.vscode/extensions.json 385 | *.code-workspace 386 | 387 | # Local History for Visual Studio Code 388 | .history/ 389 | 390 | # Windows Installer files from build outputs 391 | *.cab 392 | *.msi 393 | *.msix 394 | *.msm 395 | *.msp 396 | 397 | # JetBrains Rider 398 | *.sln.iml 399 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Thrift 2 | C++ Client for Minecraft Bedrock Edition 3 | -------------------------------------------------------------------------------- /Thrift.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.32630.194 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Thrift", "Thrift\Thrift.vcxproj", "{DD746E5C-05ED-4C12-B425-2B601B6D4AB6}" 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 | {DD746E5C-05ED-4C12-B425-2B601B6D4AB6}.Debug|x64.ActiveCfg = Debug|x64 17 | {DD746E5C-05ED-4C12-B425-2B601B6D4AB6}.Debug|x64.Build.0 = Debug|x64 18 | {DD746E5C-05ED-4C12-B425-2B601B6D4AB6}.Debug|x86.ActiveCfg = Debug|Win32 19 | {DD746E5C-05ED-4C12-B425-2B601B6D4AB6}.Debug|x86.Build.0 = Debug|Win32 20 | {DD746E5C-05ED-4C12-B425-2B601B6D4AB6}.Release|x64.ActiveCfg = Release|x64 21 | {DD746E5C-05ED-4C12-B425-2B601B6D4AB6}.Release|x64.Build.0 = Release|x64 22 | {DD746E5C-05ED-4C12-B425-2B601B6D4AB6}.Release|x86.ActiveCfg = Release|Win32 23 | {DD746E5C-05ED-4C12-B425-2B601B6D4AB6}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {F2E377A3-A32C-41F6-A32B-D54F150BD02F} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /Thrift/Client/Client.cpp: -------------------------------------------------------------------------------- 1 | #include "Client.h" 2 | 3 | Client::Client(std::string name) { 4 | 5 | this->setName(name); 6 | Utils::debugOutput("Client has been Initialized!"); 7 | 8 | this->mgr = new Manager(this); 9 | 10 | }; 11 | 12 | auto Client::setName(std::string n) -> void { 13 | 14 | this->name = n; 15 | Utils::setDebugPath(this->name); 16 | 17 | }; 18 | 19 | auto Client::getName(void) -> std::string { 20 | 21 | return this->name; 22 | 23 | }; -------------------------------------------------------------------------------- /Thrift/Client/Client.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Manager/Manager.h" 4 | 5 | class Client { 6 | public: 7 | std::string name; 8 | Manager* mgr; 9 | public: 10 | Client(std::string); 11 | public: 12 | auto setName(std::string)->void; 13 | auto getName(void)->std::string; 14 | }; -------------------------------------------------------------------------------- /Thrift/Client/Kiero/Kiero.cpp: -------------------------------------------------------------------------------- 1 | #include "kiero.h" 2 | #include 3 | #include 4 | 5 | #if KIERO_INCLUDE_D3D9 6 | # include 7 | #endif 8 | 9 | #if KIERO_INCLUDE_D3D10 10 | # include 11 | # include 12 | # include 13 | #endif 14 | 15 | #if KIERO_INCLUDE_D3D11 16 | # include 17 | # include 18 | #endif 19 | 20 | #if KIERO_INCLUDE_D3D12 21 | # include 22 | # include 23 | #endif 24 | 25 | #if KIERO_INCLUDE_OPENGL 26 | # include 27 | #endif 28 | 29 | #if KIERO_INCLUDE_VULKAN 30 | # include 31 | #endif 32 | 33 | #if KIERO_USE_MINHOOK 34 | # include 35 | #endif 36 | 37 | #ifdef _UNICODE 38 | # define KIERO_TEXT(text) L##text 39 | #else 40 | # define KIERO_TEXT(text) text 41 | #endif 42 | 43 | #define KIERO_ARRAY_SIZE(arr) ((size_t)(sizeof(arr)/sizeof(arr[0]))) 44 | 45 | static kiero::RenderType::Enum g_renderType = kiero::RenderType::None; 46 | static uint150_t* g_methodsTable = NULL; 47 | 48 | kiero::Status::Enum kiero::init(RenderType::Enum _renderType) 49 | { 50 | if (g_renderType != RenderType::None) 51 | { 52 | return Status::AlreadyInitializedError; 53 | } 54 | 55 | if (_renderType != RenderType::None) 56 | { 57 | if (_renderType >= RenderType::D3D9 && _renderType <= RenderType::D3D12) 58 | { 59 | WNDCLASSEX windowClass; 60 | windowClass.cbSize = sizeof(WNDCLASSEX); 61 | windowClass.style = CS_HREDRAW | CS_VREDRAW; 62 | windowClass.lpfnWndProc = DefWindowProc; 63 | windowClass.cbClsExtra = 0; 64 | windowClass.cbWndExtra = 0; 65 | windowClass.hInstance = GetModuleHandle(NULL); 66 | windowClass.hIcon = NULL; 67 | windowClass.hCursor = NULL; 68 | windowClass.hbrBackground = NULL; 69 | windowClass.lpszMenuName = NULL; 70 | windowClass.lpszClassName = KIERO_TEXT("Kiero"); 71 | windowClass.hIconSm = NULL; 72 | 73 | ::RegisterClassEx(&windowClass); 74 | 75 | HWND window = ::CreateWindow(windowClass.lpszClassName, KIERO_TEXT("Kiero DirectX Window"), WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, NULL, NULL, windowClass.hInstance, NULL); 76 | 77 | if (_renderType == RenderType::D3D9) 78 | { 79 | #if KIERO_INCLUDE_D3D9 80 | HMODULE libD3D9; 81 | if ((libD3D9 = ::GetModuleHandle(KIERO_TEXT("d3d9.dll"))) == NULL) 82 | { 83 | ::DestroyWindow(window); 84 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 85 | return Status::ModuleNotFoundError; 86 | } 87 | 88 | void* Direct3DCreate9; 89 | if ((Direct3DCreate9 = ::GetProcAddress(libD3D9, "Direct3DCreate9")) == NULL) 90 | { 91 | ::DestroyWindow(window); 92 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 93 | return Status::UnknownError; 94 | } 95 | 96 | LPDIRECT3D9 direct3D9; 97 | if ((direct3D9 = ((LPDIRECT3D9(__stdcall*)(uint32_t))(Direct3DCreate9))(D3D_SDK_VERSION)) == NULL) 98 | { 99 | ::DestroyWindow(window); 100 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 101 | return Status::UnknownError; 102 | } 103 | 104 | D3DPRESENT_PARAMETERS params; 105 | params.BackBufferWidth = 0; 106 | params.BackBufferHeight = 0; 107 | params.BackBufferFormat = D3DFMT_UNKNOWN; 108 | params.BackBufferCount = 0; 109 | params.MultiSampleType = D3DMULTISAMPLE_NONE; 110 | params.MultiSampleQuality = NULL; 111 | params.SwapEffect = D3DSWAPEFFECT_DISCARD; 112 | params.hDeviceWindow = window; 113 | params.Windowed = 1; 114 | params.EnableAutoDepthStencil = 0; 115 | params.AutoDepthStencilFormat = D3DFMT_UNKNOWN; 116 | params.Flags = NULL; 117 | params.FullScreen_RefreshRateInHz = 0; 118 | params.PresentationInterval = 0; 119 | 120 | LPDIRECT3DDEVICE9 device; 121 | if (direct3D9->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_NULLREF, window, D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_DISABLE_DRIVER_MANAGEMENT, ¶ms, &device) < 0) 122 | { 123 | direct3D9->Release(); 124 | ::DestroyWindow(window); 125 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 126 | return Status::UnknownError; 127 | } 128 | 129 | g_methodsTable = (uint150_t*)::calloc(119, sizeof(uint150_t)); 130 | ::memcpy(g_methodsTable, *(uint150_t**)device, 119 * sizeof(uint150_t)); 131 | 132 | #if KIERO_USE_MINHOOK 133 | MH_Initialize(); 134 | #endif 135 | 136 | device->Release(); 137 | device = NULL; 138 | 139 | direct3D9->Release(); 140 | direct3D9 = NULL; 141 | 142 | g_renderType = RenderType::D3D9; 143 | 144 | ::DestroyWindow(window); 145 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 146 | 147 | return Status::Success; 148 | #endif 149 | } 150 | else if (_renderType == RenderType::D3D10) 151 | { 152 | #if KIERO_INCLUDE_D3D10 153 | HMODULE libDXGI; 154 | HMODULE libD3D10; 155 | if ((libDXGI = ::GetModuleHandle(KIERO_TEXT("dxgi.dll"))) == NULL || (libD3D10 = ::GetModuleHandle(KIERO_TEXT("d3d10.dll"))) == NULL) 156 | { 157 | ::DestroyWindow(window); 158 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 159 | return Status::ModuleNotFoundError; 160 | } 161 | 162 | void* CreateDXGIFactory; 163 | if ((CreateDXGIFactory = ::GetProcAddress(libDXGI, "CreateDXGIFactory")) == NULL) 164 | { 165 | ::DestroyWindow(window); 166 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 167 | return Status::UnknownError; 168 | } 169 | 170 | IDXGIFactory* factory; 171 | if (((long(__stdcall*)(const IID&, void**))(CreateDXGIFactory))(__uuidof(IDXGIFactory), (void**)&factory) < 0) 172 | { 173 | ::DestroyWindow(window); 174 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 175 | return Status::UnknownError; 176 | } 177 | 178 | IDXGIAdapter* adapter; 179 | if (factory->EnumAdapters(0, &adapter) == DXGI_ERROR_NOT_FOUND) 180 | { 181 | ::DestroyWindow(window); 182 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 183 | return Status::UnknownError; 184 | } 185 | 186 | void* D3D10CreateDeviceAndSwapChain; 187 | if ((D3D10CreateDeviceAndSwapChain = ::GetProcAddress(libD3D10, "D3D10CreateDeviceAndSwapChain")) == NULL) 188 | { 189 | ::DestroyWindow(window); 190 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 191 | return Status::UnknownError; 192 | } 193 | 194 | DXGI_RATIONAL refreshRate; 195 | refreshRate.Numerator = 60; 196 | refreshRate.Denominator = 1; 197 | 198 | DXGI_MODE_DESC bufferDesc; 199 | bufferDesc.Width = 100; 200 | bufferDesc.Height = 100; 201 | bufferDesc.RefreshRate = refreshRate; 202 | bufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; 203 | bufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; 204 | bufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED; 205 | 206 | DXGI_SAMPLE_DESC sampleDesc; 207 | sampleDesc.Count = 1; 208 | sampleDesc.Quality = 0; 209 | 210 | DXGI_SWAP_CHAIN_DESC swapChainDesc; 211 | swapChainDesc.BufferDesc = bufferDesc; 212 | swapChainDesc.SampleDesc = sampleDesc; 213 | swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; 214 | swapChainDesc.BufferCount = 1; 215 | swapChainDesc.OutputWindow = window; 216 | swapChainDesc.Windowed = 1; 217 | swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; 218 | swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; 219 | 220 | IDXGISwapChain* swapChain; 221 | ID3D10Device* device; 222 | 223 | if (((long(__stdcall*)( 224 | IDXGIAdapter*, 225 | D3D10_DRIVER_TYPE, 226 | HMODULE, 227 | UINT, 228 | UINT, 229 | DXGI_SWAP_CHAIN_DESC*, 230 | IDXGISwapChain**, 231 | ID3D10Device**))(D3D10CreateDeviceAndSwapChain))(adapter, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &swapChainDesc, &swapChain, &device) < 0) 232 | { 233 | ::DestroyWindow(window); 234 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 235 | return Status::UnknownError; 236 | } 237 | 238 | g_methodsTable = (uint150_t*)::calloc(116, sizeof(uint150_t)); 239 | ::memcpy(g_methodsTable, *(uint150_t**)swapChain, 18 * sizeof(uint150_t)); 240 | ::memcpy(g_methodsTable + 18, *(uint150_t**)device, 98 * sizeof(uint150_t)); 241 | 242 | #if KIERO_USE_MINHOOK 243 | MH_Initialize(); 244 | #endif 245 | 246 | swapChain->Release(); 247 | swapChain = NULL; 248 | 249 | device->Release(); 250 | device = NULL; 251 | 252 | ::DestroyWindow(window); 253 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 254 | 255 | g_renderType = RenderType::D3D10; 256 | 257 | return Status::Success; 258 | #endif 259 | } 260 | else if (_renderType == RenderType::D3D11) 261 | { 262 | #if KIERO_INCLUDE_D3D11 263 | HMODULE libD3D11; 264 | if ((libD3D11 = ::GetModuleHandle(KIERO_TEXT("d3d11.dll"))) == NULL) 265 | { 266 | ::DestroyWindow(window); 267 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 268 | return Status::ModuleNotFoundError; 269 | } 270 | 271 | void* D3D11CreateDeviceAndSwapChain; 272 | if ((D3D11CreateDeviceAndSwapChain = ::GetProcAddress(libD3D11, "D3D11CreateDeviceAndSwapChain")) == NULL) 273 | { 274 | ::DestroyWindow(window); 275 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 276 | return Status::UnknownError; 277 | } 278 | 279 | D3D_FEATURE_LEVEL featureLevel; 280 | const D3D_FEATURE_LEVEL featureLevels[] = { D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_11_0 }; 281 | 282 | DXGI_RATIONAL refreshRate; 283 | refreshRate.Numerator = 60; 284 | refreshRate.Denominator = 1; 285 | 286 | DXGI_MODE_DESC bufferDesc; 287 | bufferDesc.Width = 100; 288 | bufferDesc.Height = 100; 289 | bufferDesc.RefreshRate = refreshRate; 290 | bufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; 291 | bufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; 292 | bufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED; 293 | 294 | DXGI_SAMPLE_DESC sampleDesc; 295 | sampleDesc.Count = 1; 296 | sampleDesc.Quality = 0; 297 | 298 | DXGI_SWAP_CHAIN_DESC swapChainDesc; 299 | swapChainDesc.BufferDesc = bufferDesc; 300 | swapChainDesc.SampleDesc = sampleDesc; 301 | swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; 302 | swapChainDesc.BufferCount = 1; 303 | swapChainDesc.OutputWindow = window; 304 | swapChainDesc.Windowed = 1; 305 | swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; 306 | swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; 307 | 308 | IDXGISwapChain* swapChain; 309 | ID3D11Device* device; 310 | ID3D11DeviceContext* context; 311 | 312 | if (((long(__stdcall*)( 313 | IDXGIAdapter*, 314 | D3D_DRIVER_TYPE, 315 | HMODULE, 316 | UINT, 317 | const D3D_FEATURE_LEVEL*, 318 | UINT, 319 | UINT, 320 | const DXGI_SWAP_CHAIN_DESC*, 321 | IDXGISwapChain**, 322 | ID3D11Device**, 323 | D3D_FEATURE_LEVEL*, 324 | ID3D11DeviceContext**))(D3D11CreateDeviceAndSwapChain))(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, featureLevels, 2, D3D11_SDK_VERSION, &swapChainDesc, &swapChain, &device, &featureLevel, &context) < 0) 325 | { 326 | ::DestroyWindow(window); 327 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 328 | return Status::UnknownError; 329 | } 330 | 331 | g_methodsTable = (uint150_t*)::calloc(205, sizeof(uint150_t)); 332 | ::memcpy(g_methodsTable, *(uint150_t**)swapChain, 18 * sizeof(uint150_t)); 333 | ::memcpy(g_methodsTable + 18, *(uint150_t**)device, 43 * sizeof(uint150_t)); 334 | ::memcpy(g_methodsTable + 18 + 43, *(uint150_t**)context, 144 * sizeof(uint150_t)); 335 | 336 | #if KIERO_USE_MINHOOK 337 | MH_Initialize(); 338 | #endif 339 | 340 | swapChain->Release(); 341 | swapChain = NULL; 342 | 343 | device->Release(); 344 | device = NULL; 345 | 346 | context->Release(); 347 | context = NULL; 348 | 349 | ::DestroyWindow(window); 350 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 351 | 352 | g_renderType = RenderType::D3D11; 353 | 354 | return Status::Success; 355 | #endif 356 | } 357 | else if (_renderType == RenderType::D3D12) 358 | { 359 | #if KIERO_INCLUDE_D3D12 360 | HMODULE libDXGI; 361 | HMODULE libD3D12; 362 | if ((libDXGI = ::GetModuleHandle(KIERO_TEXT("dxgi.dll"))) == NULL || (libD3D12 = ::GetModuleHandle(KIERO_TEXT("d3d12.dll"))) == NULL) 363 | { 364 | ::DestroyWindow(window); 365 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 366 | return Status::ModuleNotFoundError; 367 | } 368 | 369 | void* CreateDXGIFactory; 370 | if ((CreateDXGIFactory = ::GetProcAddress(libDXGI, "CreateDXGIFactory")) == NULL) 371 | { 372 | ::DestroyWindow(window); 373 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 374 | return Status::UnknownError; 375 | } 376 | 377 | IDXGIFactory* factory; 378 | if (((long(__stdcall*)(const IID&, void**))(CreateDXGIFactory))(__uuidof(IDXGIFactory), (void**)&factory) < 0) 379 | { 380 | ::DestroyWindow(window); 381 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 382 | return Status::UnknownError; 383 | } 384 | 385 | IDXGIAdapter* adapter; 386 | if (factory->EnumAdapters(0, &adapter) == DXGI_ERROR_NOT_FOUND) 387 | { 388 | ::DestroyWindow(window); 389 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 390 | return Status::UnknownError; 391 | } 392 | 393 | void* D3D12CreateDevice; 394 | if ((D3D12CreateDevice = ::GetProcAddress(libD3D12, "D3D12CreateDevice")) == NULL) 395 | { 396 | ::DestroyWindow(window); 397 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 398 | return Status::UnknownError; 399 | } 400 | 401 | ID3D12Device* device; 402 | if (((long(__stdcall*)(IUnknown*, D3D_FEATURE_LEVEL, const IID&, void**))(D3D12CreateDevice))(adapter, D3D_FEATURE_LEVEL_11_0, __uuidof(ID3D12Device), (void**)&device) < 0) 403 | { 404 | ::DestroyWindow(window); 405 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 406 | return Status::UnknownError; 407 | } 408 | 409 | D3D12_COMMAND_QUEUE_DESC queueDesc; 410 | queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT; 411 | queueDesc.Priority = 0; 412 | queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE; 413 | queueDesc.NodeMask = 0; 414 | 415 | ID3D12CommandQueue* commandQueue; 416 | if (device->CreateCommandQueue(&queueDesc, __uuidof(ID3D12CommandQueue), (void**)&commandQueue) < 0) 417 | { 418 | ::DestroyWindow(window); 419 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 420 | return Status::UnknownError; 421 | } 422 | 423 | ID3D12CommandAllocator* commandAllocator; 424 | if (device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, __uuidof(ID3D12CommandAllocator), (void**)&commandAllocator) < 0) 425 | { 426 | ::DestroyWindow(window); 427 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 428 | return Status::UnknownError; 429 | } 430 | 431 | ID3D12GraphicsCommandList* commandList; 432 | if (device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, commandAllocator, NULL, __uuidof(ID3D12GraphicsCommandList), (void**)&commandList) < 0) 433 | { 434 | ::DestroyWindow(window); 435 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 436 | return Status::UnknownError; 437 | } 438 | 439 | DXGI_RATIONAL refreshRate; 440 | refreshRate.Numerator = 60; 441 | refreshRate.Denominator = 1; 442 | 443 | DXGI_MODE_DESC bufferDesc; 444 | bufferDesc.Width = 100; 445 | bufferDesc.Height = 100; 446 | bufferDesc.RefreshRate = refreshRate; 447 | bufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; 448 | bufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; 449 | bufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED; 450 | 451 | DXGI_SAMPLE_DESC sampleDesc; 452 | sampleDesc.Count = 1; 453 | sampleDesc.Quality = 0; 454 | 455 | DXGI_SWAP_CHAIN_DESC swapChainDesc = {}; 456 | swapChainDesc.BufferDesc = bufferDesc; 457 | swapChainDesc.SampleDesc = sampleDesc; 458 | swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; 459 | swapChainDesc.BufferCount = 2; 460 | swapChainDesc.OutputWindow = window; 461 | swapChainDesc.Windowed = 1; 462 | swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; 463 | swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; 464 | 465 | IDXGISwapChain* swapChain; 466 | if (factory->CreateSwapChain(commandQueue, &swapChainDesc, &swapChain) < 0) 467 | { 468 | ::DestroyWindow(window); 469 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 470 | return Status::UnknownError; 471 | } 472 | 473 | g_methodsTable = (uint150_t*)::calloc(150, sizeof(uint150_t)); 474 | ::memcpy(g_methodsTable, *(uint150_t**)device, 44 * sizeof(uint150_t)); 475 | ::memcpy(g_methodsTable + 44, *(uint150_t**)commandQueue, 19 * sizeof(uint150_t)); 476 | ::memcpy(g_methodsTable + 44 + 19, *(uint150_t**)commandAllocator, 9 * sizeof(uint150_t)); 477 | ::memcpy(g_methodsTable + 44 + 19 + 9, *(uint150_t**)commandList, 60 * sizeof(uint150_t)); 478 | ::memcpy(g_methodsTable + 44 + 19 + 9 + 60, *(uint150_t**)swapChain, 18 * sizeof(uint150_t)); 479 | 480 | #if KIERO_USE_MINHOOK 481 | MH_Initialize(); 482 | #endif 483 | 484 | device->Release(); 485 | device = NULL; 486 | 487 | commandQueue->Release(); 488 | commandQueue = NULL; 489 | 490 | commandAllocator->Release(); 491 | commandAllocator = NULL; 492 | 493 | commandList->Release(); 494 | commandList = NULL; 495 | 496 | swapChain->Release(); 497 | swapChain = NULL; 498 | 499 | ::DestroyWindow(window); 500 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 501 | 502 | g_renderType = RenderType::D3D12; 503 | 504 | return Status::Success; 505 | #endif 506 | } 507 | 508 | ::DestroyWindow(window); 509 | ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance); 510 | 511 | return Status::NotSupportedError; 512 | } 513 | else if (_renderType != RenderType::Auto) 514 | { 515 | if (_renderType == RenderType::OpenGL) 516 | { 517 | #if KIERO_INCLUDE_OPENGL 518 | HMODULE libOpenGL32; 519 | if ((libOpenGL32 = ::GetModuleHandle(KIERO_TEXT("opengl32.dll"))) == NULL) 520 | { 521 | return Status::ModuleNotFoundError; 522 | } 523 | 524 | const char* const methodsNames[] = { 525 | "glAccum", "glAlphaFunc", "glAreTexturesResident", "glArrayElement", "glBegin", "glBindTexture", "glBitmap", "glBlendFunc", "glCallList", "glCallLists", "glClear", "glClearAccum", 526 | "glClearColor", "glClearDepth", "glClearIndex", "glClearStencil", "glClipPlane", "glColor3b", "glColor3bv", "glColor3d", "glColor3dv", "glColor3f", "glColor3fv", "glColor3i", "glColor3iv", 527 | "glColor3s", "glColor3sv", "glColor3ub", "glColor3ubv", "glColor3ui", "glColor3uiv", "glColor3us", "glColor3usv", "glColor4b", "glColor4bv", "glColor4d", "glColor4dv", "glColor4f", 528 | "glColor4fv", "glColor4i", "glColor4iv", "glColor4s", "glColor4sv", "glColor4ub", "glColor4ubv", "glColor4ui", "glColor4uiv", "glColor4us", "glColor4usv", "glColorMask", "glColorMaterial", 529 | "glColorPointer", "glCopyPixels", "glCopyTexImage1D", "glCopyTexImage2D", "glCopyTexSubImage1D", "glCopyTexSubImage2D", "glCullFaceglCullFace", "glDeleteLists", "glDeleteTextures", 530 | "glDepthFunc", "glDepthMask", "glDepthRange", "glDisable", "glDisableClientState", "glDrawArrays", "glDrawBuffer", "glDrawElements", "glDrawPixels", "glEdgeFlag", "glEdgeFlagPointer", 531 | "glEdgeFlagv", "glEnable", "glEnableClientState", "glEnd", "glEndList", "glEvalCoord1d", "glEvalCoord1dv", "glEvalCoord1f", "glEvalCoord1fv", "glEvalCoord2d", "glEvalCoord2dv", 532 | "glEvalCoord2f", "glEvalCoord2fv", "glEvalMesh1", "glEvalMesh2", "glEvalPoint1", "glEvalPoint2", "glFeedbackBuffer", "glFinish", "glFlush", "glFogf", "glFogfv", "glFogi", "glFogiv", 533 | "glFrontFace", "glFrustum", "glGenLists", "glGenTextures", "glGetBooleanv", "glGetClipPlane", "glGetDoublev", "glGetError", "glGetFloatv", "glGetIntegerv", "glGetLightfv", "glGetLightiv", 534 | "glGetMapdv", "glGetMapfv", "glGetMapiv", "glGetMaterialfv", "glGetMaterialiv", "glGetPixelMapfv", "glGetPixelMapuiv", "glGetPixelMapusv", "glGetPointerv", "glGetPolygonStipple", 535 | "glGetString", "glGetTexEnvfv", "glGetTexEnviv", "glGetTexGendv", "glGetTexGenfv", "glGetTexGeniv", "glGetTexImage", "glGetTexLevelParameterfv", "glGetTexLevelParameteriv", 536 | "glGetTexParameterfv", "glGetTexParameteriv", "glHint", "glIndexMask", "glIndexPointer", "glIndexd", "glIndexdv", "glIndexf", "glIndexfv", "glIndexi", "glIndexiv", "glIndexs", "glIndexsv", 537 | "glIndexub", "glIndexubv", "glInitNames", "glInterleavedArrays", "glIsEnabled", "glIsList", "glIsTexture", "glLightModelf", "glLightModelfv", "glLightModeli", "glLightModeliv", "glLightf", 538 | "glLightfv", "glLighti", "glLightiv", "glLineStipple", "glLineWidth", "glListBase", "glLoadIdentity", "glLoadMatrixd", "glLoadMatrixf", "glLoadName", "glLogicOp", "glMap1d", "glMap1f", 539 | "glMap2d", "glMap2f", "glMapGrid1d", "glMapGrid1f", "glMapGrid2d", "glMapGrid2f", "glMaterialf", "glMaterialfv", "glMateriali", "glMaterialiv", "glMatrixMode", "glMultMatrixd", 540 | "glMultMatrixf", "glNewList", "glNormal3b", "glNormal3bv", "glNormal3d", "glNormal3dv", "glNormal3f", "glNormal3fv", "glNormal3i", "glNormal3iv", "glNormal3s", "glNormal3sv", 541 | "glNormalPointer", "glOrtho", "glPassThrough", "glPixelMapfv", "glPixelMapuiv", "glPixelMapusv", "glPixelStoref", "glPixelStorei", "glPixelTransferf", "glPixelTransferi", "glPixelZoom", 542 | "glPointSize", "glPolygonMode", "glPolygonOffset", "glPolygonStipple", "glPopAttrib", "glPopClientAttrib", "glPopMatrix", "glPopName", "glPrioritizeTextures", "glPushAttrib", 543 | "glPushClientAttrib", "glPushMatrix", "glPushName", "glRasterPos2d", "glRasterPos2dv", "glRasterPos2f", "glRasterPos2fv", "glRasterPos2i", "glRasterPos2iv", "glRasterPos2s", 544 | "glRasterPos2sv", "glRasterPos3d", "glRasterPos3dv", "glRasterPos3f", "glRasterPos3fv", "glRasterPos3i", "glRasterPos3iv", "glRasterPos3s", "glRasterPos3sv", "glRasterPos4d", 545 | "glRasterPos4dv", "glRasterPos4f", "glRasterPos4fv", "glRasterPos4i", "glRasterPos4iv", "glRasterPos4s", "glRasterPos4sv", "glReadBuffer", "glReadPixels", "glRectd", "glRectdv", "glRectf", 546 | "glRectfv", "glRecti", "glRectiv", "glRects", "glRectsv", "glRenderMode", "glRotated", "glRotatef", "glScaled", "glScalef", "glScissor", "glSelectBuffer", "glShadeModel", "glStencilFunc", 547 | "glStencilMask", "glStencilOp", "glTexCoord1d", "glTexCoord1dv", "glTexCoord1f", "glTexCoord1fv", "glTexCoord1i", "glTexCoord1iv", "glTexCoord1s", "glTexCoord1sv", "glTexCoord2d", 548 | "glTexCoord2dv", "glTexCoord2f", "glTexCoord2fv", "glTexCoord2i", "glTexCoord2iv", "glTexCoord2s", "glTexCoord2sv", "glTexCoord3d", "glTexCoord3dv", "glTexCoord3f", "glTexCoord3fv", 549 | "glTexCoord3i", "glTexCoord3iv", "glTexCoord3s", "glTexCoord3sv", "glTexCoord4d", "glTexCoord4dv", "glTexCoord4f", "glTexCoord4fv", "glTexCoord4i", "glTexCoord4iv", "glTexCoord4s", 550 | "glTexCoord4sv", "glTexCoordPointer", "glTexEnvf", "glTexEnvfv", "glTexEnvi", "glTexEnviv", "glTexGend", "glTexGendv", "glTexGenf", "glTexGenfv", "glTexGeni", "glTexGeniv", "glTexImage1D", 551 | "glTexImage2D", "glTexParameterf", "glTexParameterfv", "glTexParameteri", "glTexParameteriv", "glTexSubImage1D", "glTexSubImage2D", "glTranslated", "glTranslatef", "glVertex2d", 552 | "glVertex2dv", "glVertex2f", "glVertex2fv", "glVertex2i", "glVertex2iv", "glVertex2s", "glVertex2sv", "glVertex3d", "glVertex3dv", "glVertex3f", "glVertex3fv", "glVertex3i", "glVertex3iv", 553 | "glVertex3s", "glVertex3sv", "glVertex4d", "glVertex4dv", "glVertex4f", "glVertex4fv", "glVertex4i", "glVertex4iv", "glVertex4s", "glVertex4sv", "glVertexPointer", "glViewport" 554 | }; 555 | 556 | size_t size = KIERO_ARRAY_SIZE(methodsNames); 557 | 558 | g_methodsTable = (uint150_t*)::calloc(size, sizeof(uint150_t)); 559 | 560 | for (int i = 0; i < size; i++) 561 | { 562 | g_methodsTable[i] = (uint150_t)::GetProcAddress(libOpenGL32, methodsNames[i]); 563 | } 564 | 565 | #if KIERO_USE_MINHOOK 566 | MH_Initialize(); 567 | #endif 568 | 569 | g_renderType = RenderType::OpenGL; 570 | 571 | return Status::Success; 572 | #endif 573 | } 574 | else if (_renderType == RenderType::Vulkan) 575 | { 576 | #if KIERO_INCLUDE_VULKAN 577 | HMODULE libVulkan; 578 | if ((libVulkan = GetModuleHandle(KIERO_TEXT("vulkan-1.dll"))) == NULL) 579 | { 580 | return Status::ModuleNotFoundError; 581 | } 582 | 583 | const char* const methodsNames[] = { 584 | "vkCreateInstance", "vkDestroyInstance", "vkEnumeratePhysicalDevices", "vkGetPhysicalDeviceFeatures", "vkGetPhysicalDeviceFormatProperties", "vkGetPhysicalDeviceImageFormatProperties", 585 | "vkGetPhysicalDeviceProperties", "vkGetPhysicalDeviceQueueFamilyProperties", "vkGetPhysicalDeviceMemoryProperties", "vkGetInstanceProcAddr", "vkGetDeviceProcAddr", "vkCreateDevice", 586 | "vkDestroyDevice", "vkEnumerateInstanceExtensionProperties", "vkEnumerateDeviceExtensionProperties", "vkEnumerateDeviceLayerProperties", "vkGetDeviceQueue", "vkQueueSubmit", "vkQueueWaitIdle", 587 | "vkDeviceWaitIdle", "vkAllocateMemory", "vkFreeMemory", "vkMapMemory", "vkUnmapMemory", "vkFlushMappedMemoryRanges", "vkInvalidateMappedMemoryRanges", "vkGetDeviceMemoryCommitment", 588 | "vkBindBufferMemory", "vkBindImageMemory", "vkGetBufferMemoryRequirements", "vkGetImageMemoryRequirements", "vkGetImageSparseMemoryRequirements", "vkGetPhysicalDeviceSparseImageFormatProperties", 589 | "vkQueueBindSparse", "vkCreateFence", "vkDestroyFence", "vkResetFences", "vkGetFenceStatus", "vkWaitForFences", "vkCreateSemaphore", "vkDestroySemaphore", "vkCreateEvent", "vkDestroyEvent", 590 | "vkGetEventStatus", "vkSetEvent", "vkResetEvent", "vkCreateQueryPool", "vkDestroyQueryPool", "vkGetQueryPoolResults", "vkCreateBuffer", "vkDestroyBuffer", "vkCreateBufferView", "vkDestroyBufferView", 591 | "vkCreateImage", "vkDestroyImage", "vkGetImageSubresourceLayout", "vkCreateImageView", "vkDestroyImageView", "vkCreateShaderModule", "vkDestroyShaderModule", "vkCreatePipelineCache", 592 | "vkDestroyPipelineCache", "vkGetPipelineCacheData", "vkMergePipelineCaches", "vkCreateGraphicsPipelines", "vkCreateComputePipelines", "vkDestroyPipeline", "vkCreatePipelineLayout", 593 | "vkDestroyPipelineLayout", "vkCreateSampler", "vkDestroySampler", "vkCreateDescriptorSetLayout", "vkDestroyDescriptorSetLayout", "vkCreateDescriptorPool", "vkDestroyDescriptorPool", 594 | "vkResetDescriptorPool", "vkAllocateDescriptorSets", "vkFreeDescriptorSets", "vkUpdateDescriptorSets", "vkCreateFramebuffer", "vkDestroyFramebuffer", "vkCreateRenderPass", "vkDestroyRenderPass", 595 | "vkGetRenderAreaGranularity", "vkCreateCommandPool", "vkDestroyCommandPool", "vkResetCommandPool", "vkAllocateCommandBuffers", "vkFreeCommandBuffers", "vkBeginCommandBuffer", "vkEndCommandBuffer", 596 | "vkResetCommandBuffer", "vkCmdBindPipeline", "vkCmdSetViewport", "vkCmdSetScissor", "vkCmdSetLineWidth", "vkCmdSetDepthBias", "vkCmdSetBlendConstants", "vkCmdSetDepthBounds", 597 | "vkCmdSetStencilCompareMask", "vkCmdSetStencilWriteMask", "vkCmdSetStencilReference", "vkCmdBindDescriptorSets", "vkCmdBindIndexBuffer", "vkCmdBindVertexBuffers", "vkCmdDraw", "vkCmdDrawIndexed", 598 | "vkCmdDrawIndirect", "vkCmdDrawIndexedIndirect", "vkCmdDispatch", "vkCmdDispatchIndirect", "vkCmdCopyBuffer", "vkCmdCopyImage", "vkCmdBlitImage", "vkCmdCopyBufferToImage", "vkCmdCopyImageToBuffer", 599 | "vkCmdUpdateBuffer", "vkCmdFillBuffer", "vkCmdClearColorImage", "vkCmdClearDepthStencilImage", "vkCmdClearAttachments", "vkCmdResolveImage", "vkCmdSetEvent", "vkCmdResetEvent", "vkCmdWaitEvents", 600 | "vkCmdPipelineBarrier", "vkCmdBeginQuery", "vkCmdEndQuery", "vkCmdResetQueryPool", "vkCmdWriteTimestamp", "vkCmdCopyQueryPoolResults", "vkCmdPushConstants", "vkCmdBeginRenderPass", "vkCmdNextSubpass", 601 | "vkCmdEndRenderPass", "vkCmdExecuteCommands" 602 | }; 603 | 604 | size_t size = KIERO_ARRAY_SIZE(methodsNames); 605 | 606 | g_methodsTable = (uint150_t*)::calloc(size, sizeof(uint150_t)); 607 | 608 | for (int i = 0; i < size; i++) 609 | { 610 | g_methodsTable[i] = (uint150_t)::GetProcAddress(libVulkan, methodsNames[i]); 611 | } 612 | 613 | #if KIERO_USE_MINHOOK 614 | MH_Initialize(); 615 | #endif 616 | 617 | g_renderType = RenderType::Vulkan; 618 | 619 | return Status::Success; 620 | #endif 621 | } 622 | 623 | return Status::NotSupportedError; 624 | } 625 | else 626 | { 627 | RenderType::Enum type = RenderType::None; 628 | 629 | if (::GetModuleHandle(KIERO_TEXT("d3d9.dll")) != NULL) 630 | { 631 | type = RenderType::D3D9; 632 | } 633 | else if (::GetModuleHandle(KIERO_TEXT("d3d10.dll")) != NULL) 634 | { 635 | type = RenderType::D3D10; 636 | } 637 | else if (::GetModuleHandle(KIERO_TEXT("d3d11.dll")) != NULL) 638 | { 639 | type = RenderType::D3D11; 640 | } 641 | else if (::GetModuleHandle(KIERO_TEXT("d3d12.dll")) != NULL) 642 | { 643 | type = RenderType::D3D12; 644 | } 645 | else if (::GetModuleHandle(KIERO_TEXT("opengl32.dll")) != NULL) 646 | { 647 | type = RenderType::OpenGL; 648 | } 649 | else if (::GetModuleHandle(KIERO_TEXT("vulkan-1.dll")) != NULL) 650 | { 651 | type = RenderType::Vulkan; 652 | } 653 | else 654 | { 655 | return Status::NotSupportedError; 656 | } 657 | 658 | return init(type); 659 | } 660 | } 661 | 662 | return Status::Success; 663 | } 664 | 665 | void kiero::shutdown() 666 | { 667 | if (g_renderType != RenderType::None) 668 | { 669 | #if KIERO_USE_MINHOOK 670 | MH_DisableHook(MH_ALL_HOOKS); 671 | #endif 672 | 673 | ::free(g_methodsTable); 674 | g_methodsTable = NULL; 675 | g_renderType = RenderType::None; 676 | } 677 | } 678 | 679 | kiero::Status::Enum kiero::bind(uint16_t _index, void** _original, void* _function) 680 | { 681 | // TODO: Need own detour function 682 | 683 | assert(_original != NULL && _function != NULL); 684 | 685 | if (g_renderType != RenderType::None) 686 | { 687 | #if KIERO_USE_MINHOOK 688 | void* target = (void*)g_methodsTable[_index]; 689 | if (MH_CreateHook(target, _function, _original) != MH_OK || MH_EnableHook(target) != MH_OK) 690 | { 691 | return Status::UnknownError; 692 | } 693 | #endif 694 | 695 | return Status::Success; 696 | } 697 | 698 | return Status::NotInitializedError; 699 | } 700 | 701 | void kiero::unbind(uint16_t _index) 702 | { 703 | if (g_renderType != RenderType::None) 704 | { 705 | #if KIERO_USE_MINHOOK 706 | MH_DisableHook((void*)g_methodsTable[_index]); 707 | #endif 708 | } 709 | } 710 | 711 | kiero::RenderType::Enum kiero::getRenderType() 712 | { 713 | return g_renderType; 714 | } 715 | 716 | uint150_t* kiero::getMethodsTable() 717 | { 718 | return g_methodsTable; 719 | } -------------------------------------------------------------------------------- /Thrift/Client/Kiero/Kiero.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define KIERO_VERSION "1.2.12" 6 | 7 | #define KIERO_INCLUDE_D3D9 0 // 1 if you need D3D9 hook 8 | #define KIERO_INCLUDE_D3D10 0 // 1 if you need D3D10 hook 9 | #define KIERO_INCLUDE_D3D11 0 // 1 if you need D3D11 hook 10 | #define KIERO_INCLUDE_D3D12 1 // 1 if you need D3D12 hook 11 | #define KIERO_INCLUDE_OPENGL 0 // 1 if you need OpenGL hook 12 | #define KIERO_INCLUDE_VULKAN 0 // 1 if you need Vulkan hook 13 | #define KIERO_USE_MINHOOK 1 // 1 if you will use kiero::bind function 14 | 15 | #define KIERO_ARCH_X64 0 16 | #define KIERO_ARCH_X86 0 17 | 18 | #if defined(_M_X64) 19 | # undef KIERO_ARCH_X64 20 | # define KIERO_ARCH_X64 1 21 | #else 22 | # undef KIERO_ARCH_X86 23 | # define KIERO_ARCH_X86 1 24 | #endif 25 | 26 | #if KIERO_ARCH_X64 27 | typedef uint64_t uint150_t; 28 | #else 29 | typedef uint32_t uint150_t; 30 | #endif 31 | 32 | namespace kiero 33 | { 34 | struct Status 35 | { 36 | enum Enum 37 | { 38 | UnknownError = -1, 39 | NotSupportedError = -2, 40 | ModuleNotFoundError = -3, 41 | 42 | AlreadyInitializedError = -4, 43 | NotInitializedError = -5, 44 | 45 | Success = 0, 46 | }; 47 | }; 48 | 49 | struct RenderType 50 | { 51 | enum Enum 52 | { 53 | None, 54 | 55 | D3D9, 56 | D3D10, 57 | D3D11, 58 | D3D12, 59 | 60 | OpenGL, 61 | Vulkan, 62 | 63 | Auto 64 | }; 65 | }; 66 | 67 | Status::Enum init(RenderType::Enum renderType); 68 | void shutdown(); 69 | 70 | Status::Enum bind(uint16_t index, void** original, void* function); 71 | void unbind(uint16_t index); 72 | 73 | RenderType::Enum getRenderType(); 74 | uint150_t* getMethodsTable(); 75 | } -------------------------------------------------------------------------------- /Thrift/Client/Manager/Category/Category.cpp: -------------------------------------------------------------------------------- 1 | #include "Category.h" 2 | #include "../Manager.h" 3 | #include "Module/Module.h" 4 | 5 | Category::Category(Manager* m, std::string n) { 6 | 7 | this->mgr = m; 8 | this->name = n; 9 | 10 | this->mgr->categories.push_back(this); 11 | 12 | }; 13 | 14 | auto Category::baseTick(void) -> void { 15 | 16 | for (auto mod : this->modules) { 17 | 18 | mod->baseTick(); 19 | 20 | }; 21 | } -------------------------------------------------------------------------------- /Thrift/Client/Manager/Category/Category.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | class Manager; 7 | class Module; 8 | 9 | class Category { 10 | public: 11 | Manager* mgr; 12 | std::string name; 13 | std::vector modules; 14 | public: 15 | Category(Manager*, std::string); 16 | public: 17 | auto baseTick(void)->void; 18 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Category/Module/Module.cpp: -------------------------------------------------------------------------------- 1 | #include "Module.h" 2 | #include "../Category.h" 3 | 4 | Module::Module(Category* c, std::string n) { 5 | 6 | this->category = c; 7 | this->name = n; 8 | 9 | this->category->modules.push_back(this); 10 | 11 | }; 12 | 13 | auto Module::baseTick(void) -> void { 14 | 15 | if (this->wasEnabled != this->isEnabled) { 16 | 17 | this->wasEnabled = this->isEnabled; 18 | 19 | if (this->debugState) 20 | Utils::debugOutput("[ " + this->category->name + " : " + this->name + " ] " + (this->isEnabled ? "Enabled" : "Disabled")); 21 | 22 | if (this->isEnabled) 23 | this->onEnable(); 24 | else 25 | this->onDisable(); 26 | 27 | }; 28 | 29 | if (this->isEnabled) 30 | this->onTick(); 31 | 32 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Category/Module/Module.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../../Utils/Utils.h" 4 | #include "../../../SDK/Minecraft.h" 5 | 6 | class Category; 7 | 8 | class Module { 9 | public: 10 | std::string name; 11 | Category* category; 12 | public: 13 | Module(Category*, std::string); 14 | public: 15 | bool isEnabled = false, wasEnabled = false; 16 | uint64_t key = NULL; 17 | public: 18 | bool debugState = false; 19 | public: 20 | auto baseTick(void) -> void; 21 | public: 22 | virtual auto onTick(void) -> void {}; 23 | virtual auto onEnable(void) -> void {}; 24 | virtual auto onDisable(void) -> void {}; 25 | public: 26 | virtual auto onRender(MinecraftUIRenderContext*) -> void {}; 27 | virtual auto onDrawText(MinecraftUIRenderContext*, Font*, float*, std::string*, float*, float, unsigned int, const TextMeasureData*, const CaretMeasureData*) -> void {}; 28 | public: 29 | virtual auto onKey(uint64_t, bool, bool*) -> void {}; 30 | public: 31 | virtual auto onPacket(LoopbackPacketSender*, Packet*, bool*) -> void {}; 32 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Category/Module/Modules/Movement/AirJump.cpp: -------------------------------------------------------------------------------- 1 | #include "AirJump.h" 2 | 3 | auto AirJump::onTick(void) -> void { 4 | 5 | auto instance = Minecraft::getClientInstance(); 6 | auto player = (instance != nullptr ? instance->LocalPlayer : nullptr); 7 | 8 | if (player != nullptr) 9 | player->getMovementProxy()->setOnGround(true); 10 | } -------------------------------------------------------------------------------- /Thrift/Client/Manager/Category/Module/Modules/Movement/AirJump.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Module.h" 4 | 5 | class AirJump : public Module { 6 | public: 7 | AirJump(Category* c) : Module(c, "AirJump") { 8 | 9 | // 10 | 11 | }; 12 | public: 13 | auto onTick(void) -> void override; 14 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Category/Module/Modules/Other/TestModule.cpp: -------------------------------------------------------------------------------- 1 | #include "TestModule.h" 2 | #include "../../../../Manager.h" 3 | #include "../../../../../Client.h" 4 | 5 | auto TestModule::onTick(void) -> void { 6 | 7 | /* Execute Every Thread Tick */ 8 | 9 | }; 10 | 11 | auto TestModule::onEnable(void) -> void { 12 | 13 | /* Execute Upon Enable */ 14 | 15 | }; 16 | 17 | auto TestModule::onDisable(void) -> void { 18 | 19 | /* Execute Upon Disable */ 20 | 21 | }; 22 | 23 | 24 | auto TestModule::onRender(MinecraftUIRenderContext* ctx) -> void { 25 | 26 | /* Execute Every MinecraftUIRenderContext Tick */ 27 | 28 | }; 29 | 30 | auto TestModule::onKey(uint64_t key, bool isDown, bool* cancelSend) -> void { 31 | 32 | /* Execute Upon Keyboard Press */ 33 | 34 | }; 35 | 36 | auto TestModule::onPacket(LoopbackPacketSender* _this, Packet* packet, bool* cancel) -> void { 37 | 38 | /*std::ostringstream o; 39 | o << std::hex << (uintptr_t)packet->VTable - (uintptr_t)(GetModuleHandleA("Minecraft.Windows.exe")); 40 | 41 | Utils::debugOutput("Minecraft.Windows.exe+" + o.str());*/ 42 | 43 | if (packet->VTable == TextPacket().VTable) 44 | Utils::debugOutput("Text Packet!"); 45 | 46 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Category/Module/Modules/Other/TestModule.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Module.h" 4 | 5 | class TestModule : public Module { 6 | public: 7 | TestModule(Category* c) : Module(c, "Test Module") { 8 | 9 | this->isEnabled = true; 10 | this->debugState = true; 11 | this->key = 0x47; /* G */ 12 | 13 | }; 14 | public: 15 | auto onTick(void) -> void override; 16 | auto onEnable(void) -> void override; 17 | auto onDisable(void) -> void override; 18 | public: 19 | auto onRender(MinecraftUIRenderContext*) -> void override; 20 | auto onKey(uint64_t, bool, bool*) -> void override; 21 | public: 22 | auto onPacket(LoopbackPacketSender*, Packet*, bool*) -> void override; 23 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Category/Module/Modules/Visual/RainbowText.cpp: -------------------------------------------------------------------------------- 1 | #include "RainbowText.h" 2 | 3 | auto RainbowText::onDrawText(MinecraftUIRenderContext* ctx, Font* font, float* pos, std::string* text, float* color, float alpha, unsigned int textAlignment, const TextMeasureData* textMeasureData, const CaretMeasureData* caretMeasureData) -> void { 4 | 5 | if (rcolors[3] < 1) { 6 | 7 | rcolors[0] = 0.2f; 8 | rcolors[1] = 0.2f; 9 | rcolors[2] = 1.f; 10 | rcolors[3] = 1; 11 | 12 | }; 13 | 14 | Utils::ApplyRainbow(rcolors, 0.00015f); 15 | 16 | for (auto I = 0; I < 4; I++) 17 | color[I] = rcolors[I]; 18 | 19 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Category/Module/Modules/Visual/RainbowText.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Module.h" 4 | 5 | class RainbowText : public Module { 6 | public: 7 | RainbowText(Category* c) : Module(c, "RainbowText") { 8 | 9 | this->isEnabled = true; 10 | 11 | }; 12 | public: 13 | auto onDrawText(MinecraftUIRenderContext*, Font*, float*, std::string*, float*, float, unsigned int, const TextMeasureData*, const CaretMeasureData*) -> void override; 14 | public: 15 | float rcolors[4]; 16 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Category/Module/Modules/Visual/TabGui.cpp: -------------------------------------------------------------------------------- 1 | #include "TabGui.h" 2 | #include "../../../../Manager.h" 3 | #include "../../../../../Client.h" 4 | 5 | auto TabGui::onRender(MinecraftUIRenderContext* ctx) -> void { 6 | 7 | auto logoTextColor = Color(52.f, 152.f, 235.f, this->alpha); 8 | auto logoBgColor = Color(69.f, 119.f, 204.f, (this->alpha > 0.2 > this->alpha ? this->alpha - .2 : this->alpha)); 9 | 10 | auto textColor = Color(5.f, 97.f, 163.f, this->alpha); 11 | auto bgColor = Color(21.f, 21.f, 21.f, (this->alpha > 0.2 > this->alpha ? this->alpha - .2 : this->alpha)); 12 | 13 | auto mgr = this->category->mgr; 14 | auto client = mgr->client; 15 | 16 | Module* rainbowText = nullptr; 17 | 18 | if (!this->rainbowText) { 19 | 20 | for (auto category : mgr->categories) 21 | for (auto mod : category->modules) 22 | if ((mod->name.rfind("RainbowText") != std::string::npos) && mod->isEnabled) 23 | rainbowText = mod; 24 | 25 | if (rainbowText != nullptr) 26 | rainbowText->isEnabled = false; 27 | 28 | }; 29 | 30 | auto logoText = client->name; 31 | auto fontSize = 1.f; 32 | 33 | auto xStretch = ctx->getTextLen(nullptr, logoText, fontSize); 34 | 35 | for (auto category : mgr->categories) { 36 | 37 | auto name = category->name; 38 | auto currLen = ctx->getTextLen(nullptr, name, fontSize); 39 | 40 | if (currLen > xStretch) 41 | xStretch = currLen; 42 | 43 | }; 44 | 45 | auto startPos = Vec2(4.f, 4.f); 46 | auto logoRect = Rect(startPos.x - 2.f, startPos.y - 2.f, (startPos.x + 2.f) + xStretch, startPos.y + (fontSize * 10)); 47 | 48 | ctx->drawText(nullptr, startPos, logoText, logoTextColor, fontSize); 49 | ctx->fillRectangle(logoRect, logoBgColor); 50 | ctx->flushText(0.f); 51 | 52 | 53 | auto I = 0; 54 | for (auto category : mgr->categories) { 55 | 56 | ctx->drawText(nullptr, Vec2(startPos.x, startPos.y + (I * 10) + 10.f), category->name, textColor, fontSize); 57 | I++; 58 | 59 | }; 60 | 61 | auto bgRect = Rect(logoRect.x, logoRect.w, logoRect.z, logoRect.w + (mgr->categories.size() * 10)); 62 | 63 | ctx->fillRectangle(bgRect, bgColor); 64 | ctx->flushText(0.f); 65 | 66 | if (selectedCat) { 67 | 68 | if (this->catAnimOff <= 0.f) 69 | this->catAnimOff = bgRect.x + 2.f; 70 | 71 | this->reachOff(&this->catAnimOff, (bgRect.z - 2.f), this->animModifier); 72 | ctx->fillRectangle(Rect(bgRect.x + 2.f, bgRect.y + (indexCat * 10) + 9.f, this->catAnimOff, bgRect.y + (indexCat * 10) + 10.f), logoBgColor); 73 | 74 | auto category = mgr->categories.at(this->indexCat); 75 | auto modules = category->modules; 76 | 77 | auto modsXStretch = 0.f; 78 | 79 | for (auto mod : modules) { 80 | 81 | auto currLen = ctx->getTextLen(nullptr, mod->name, fontSize); 82 | 83 | if (currLen > modsXStretch) 84 | modsXStretch = currLen; 85 | 86 | }; 87 | 88 | auto startY = bgRect.y + (indexCat * 10); 89 | auto modsRect = Rect(bgRect.z, startY, (bgRect.z + modsXStretch) + 4.f, startY + (modules.size() * 10)); 90 | 91 | I = 0; 92 | for (auto mod : modules) { 93 | 94 | ctx->drawText(nullptr, Vec2(modsRect.x + 2.f, modsRect.y + (I * 10)), mod->name, ((mod->isEnabled || rainbowText != nullptr && rainbowText == mod) ? Color(30.f, 230.f, 120.f, this->alpha) : textColor), fontSize); 95 | I++; 96 | 97 | }; 98 | 99 | ctx->fillRectangle(modsRect, bgColor); 100 | ctx->flushText(0.f); 101 | 102 | if (this->selectedMod) { 103 | 104 | if (this->modAnimOff <= 0.f) 105 | this->modAnimOff = modsRect.x + 2.f; 106 | 107 | this->reachOff(&this->modAnimOff, (modsRect.z - 2.f), this->animModifier); 108 | ctx->fillRectangle(Rect(modsRect.x + 2.f, modsRect.y + (indexMod * 10) + 9.f, this->modAnimOff, modsRect.y + (indexMod * 10) + 10.f), logoBgColor); 109 | 110 | }; 111 | 112 | }; 113 | 114 | if (rainbowText != nullptr) 115 | rainbowText->isEnabled = true; 116 | 117 | }; 118 | 119 | auto TabGui::onKey(uint64_t key, bool isDown, bool* cancelSend) -> void { 120 | 121 | if (!isDown) 122 | return; 123 | 124 | if (key != VK_LEFT && key != VK_RIGHT && key != VK_UP && key != VK_DOWN) 125 | return; 126 | 127 | *cancelSend = true; 128 | 129 | auto mgr = this->category->mgr; 130 | auto category = mgr->categories.at(this->indexCat); 131 | auto mod = (category->modules.size() > 0 ? category->modules.at(this->indexMod) : nullptr); 132 | 133 | switch (key) { 134 | 135 | case VK_RIGHT: 136 | 137 | if (!this->selectedCat && !this->selectedMod) 138 | this->selectedCat = true; 139 | else 140 | if (!this->selectedMod) 141 | this->selectedMod = true; 142 | else { 143 | if (mod != nullptr) 144 | mod->isEnabled = !mod->isEnabled; 145 | }; 146 | 147 | break; 148 | 149 | case VK_LEFT: 150 | 151 | if (this->selectedMod) { 152 | 153 | this->selectedMod = false; 154 | this->modAnimOff = 0.f; 155 | this->indexMod = 0; 156 | 157 | } 158 | 159 | else 160 | if (this->selectedCat) { 161 | 162 | this->selectedCat = false; 163 | this->catAnimOff = 0.f; 164 | 165 | }; 166 | 167 | break; 168 | 169 | case VK_DOWN: 170 | 171 | if (this->selectedCat && !this->selectedMod) { 172 | 173 | this->indexCat++; 174 | this->catAnimOff = 0.f; 175 | 176 | if (this->indexCat >= mgr->categories.size()) 177 | this->indexCat = 0; 178 | 179 | } 180 | else if (this->selectedMod) { 181 | 182 | this->indexMod++; 183 | this->modAnimOff = 0.f; 184 | 185 | if (this->indexMod >= category->modules.size()) 186 | this->indexMod = 0; 187 | 188 | }; 189 | 190 | break; 191 | 192 | case VK_UP: 193 | 194 | if (this->selectedMod && this->selectedCat) { 195 | 196 | if (this->indexMod <= 0) 197 | this->indexMod = category->modules.size(); 198 | 199 | this->indexMod--; 200 | this->modAnimOff = 0.f; 201 | 202 | } 203 | else if (this->selectedCat) { 204 | 205 | if (this->indexCat <= 0) 206 | this->indexCat = mgr->categories.size(); 207 | 208 | this->indexCat--; 209 | this->catAnimOff = 0.f; 210 | 211 | }; 212 | 213 | break; 214 | 215 | }; 216 | 217 | }; 218 | 219 | auto TabGui::reachOff(float* x, float xOff, float modifier) -> void { 220 | 221 | if (*x < xOff) { 222 | 223 | if (*x < (xOff - modifier)) 224 | *x += modifier; 225 | else 226 | *x = xOff; 227 | 228 | } 229 | else if (*x > xOff) { 230 | 231 | if (*x > (xOff + modifier)) 232 | *x -= modifier; 233 | else 234 | *x = xOff; 235 | 236 | }; 237 | 238 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Category/Module/Modules/Visual/TabGui.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Module.h" 4 | 5 | class TabGui : public Module { 6 | public: 7 | TabGui(Category* c) : Module(c, "TabGui") { 8 | 9 | this->isEnabled = true; 10 | this->key = VK_TAB; 11 | 12 | }; 13 | public: 14 | auto onRender(MinecraftUIRenderContext*) -> void override; 15 | auto onKey(uint64_t, bool, bool*) -> void override; 16 | private: 17 | float alpha = 1.f; 18 | private: 19 | int indexCat = 0, indexMod = 0; 20 | bool selectedCat = false, selectedMod = false; 21 | private: 22 | auto reachOff(float*, float, float) -> void; 23 | private: 24 | float catAnimOff = 0.f, modAnimOff = 0.f; 25 | float animModifier = 0.2f; 26 | public: 27 | bool rainbowText = false; 28 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Hook/Hook.cpp: -------------------------------------------------------------------------------- 1 | #include "Hook.h" 2 | #include "../Manager.h" 3 | 4 | Hook::Hook(Manager* m) { 5 | 6 | this->mgr = m; 7 | this->mgr->hooks.push_back(this); 8 | 9 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Hook/Hook.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Utils/Utils.h" 4 | #include "../../SDK/Minecraft.h" 5 | 6 | class Manager; 7 | 8 | class Hook { 9 | public: 10 | Manager* mgr; 11 | public: 12 | Hook(Manager*); 13 | public: 14 | virtual auto init(void) -> StatusData { return StatusData(MethodStatus::Error, "No override!"); }; 15 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Hook/Hooks/ClientInstance/HookClientInstance.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EchoHackCmd/Thrift/e5ef454a17bfc112adeac93d1c2edc12ffe1a73f/Thrift/Client/Manager/Hook/Hooks/ClientInstance/HookClientInstance.cpp -------------------------------------------------------------------------------- /Thrift/Client/Manager/Hook/Hooks/ClientInstance/HookClientInstance.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Hook.h" 4 | 5 | class Hook_ClientInstance : public Hook { 6 | public: 7 | Hook_ClientInstance(Manager* mgr) : Hook(mgr) {}; 8 | public: 9 | auto init(void)->StatusData override; 10 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Hook/Hooks/Key/HookKey.cpp: -------------------------------------------------------------------------------- 1 | #include "HookKey.h" 2 | 3 | #include "../../../Category/Module/Module.h" 4 | #include "../../../Manager.h" 5 | 6 | Manager* kMgr = nullptr; 7 | 8 | typedef void(__thiscall* Key) (uint64_t, bool); 9 | Key _Key; 10 | 11 | auto KeyHookCallback(uint64_t key, bool isDown) -> void { 12 | 13 | bool cancel = false; 14 | 15 | if (kMgr != nullptr) { 16 | 17 | auto instance = Minecraft::getClientInstance(); 18 | auto mcgame = (instance != nullptr ? instance->MinecraftGame : nullptr); 19 | 20 | for (auto category : kMgr->categories) { 21 | 22 | for (auto mod : category->modules) { 23 | 24 | if (isDown && mcgame != nullptr && mcgame->canUseKeys) 25 | if (mod->key == key) 26 | mod->isEnabled = !mod->isEnabled; 27 | 28 | if (mod->isEnabled) 29 | mod->onKey(key, isDown, &cancel); 30 | 31 | }; 32 | 33 | }; 34 | 35 | }; 36 | 37 | if(!cancel) 38 | _Key(key, isDown); 39 | 40 | }; 41 | 42 | auto Hook_Key::init(void) -> StatusData { 43 | 44 | kMgr = this->mgr; 45 | auto sig = Utils::findSig("48 ? ? 48 ? ? ? 4C 8D 05 ? ? ? ? 89"); 46 | 47 | if (!sig) 48 | return StatusData(MethodStatus::Error, "[Key Hook] Failed to find Signature!"); 49 | 50 | if(MH_CreateHook((void*)sig, &KeyHookCallback, reinterpret_cast(&_Key)) != MH_OK) 51 | return StatusData(MethodStatus::Error, "[Key Hook] Failed to create hook!"); 52 | 53 | if (MH_EnableHook((void*)sig) != MH_OK) 54 | return StatusData(MethodStatus::Error, "[Key Hook] Failed to enable hook!"); 55 | 56 | return StatusData(MethodStatus::Success, "[Key Hook] Successfully hooked Key Hook!"); 57 | 58 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Hook/Hooks/Key/HookKey.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Hook.h" 4 | 5 | class Hook_Key : public Hook { 6 | public: 7 | Hook_Key(Manager* mgr) : Hook(mgr) {}; 8 | public: 9 | auto init(void)->StatusData override; 10 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Hook/Hooks/LoopbackPacketSender/HookLoopbackPacketSender.cpp: -------------------------------------------------------------------------------- 1 | #include "HookLoopbackPacketSender.h" 2 | 3 | #include "../../../Category/Module/Module.h" 4 | 5 | #include "../../../Manager.h" 6 | #include "../../../../Client.h" 7 | 8 | Manager* lpMgr = nullptr; 9 | 10 | typedef void(__thiscall* Send)(LoopbackPacketSender*, Packet*); 11 | Send _Send; 12 | 13 | auto SendCallback(LoopbackPacketSender* _this, Packet* packet) -> void { 14 | 15 | bool cancel = false; 16 | 17 | if (lpMgr != nullptr) { 18 | 19 | for (auto category : lpMgr->categories) { 20 | 21 | for (auto mod : category->modules) { 22 | 23 | if (mod->isEnabled) 24 | mod->onPacket(_this, packet, &cancel); 25 | 26 | }; 27 | 28 | }; 29 | 30 | }; 31 | 32 | if(!cancel) 33 | _Send(_this, packet); 34 | 35 | }; 36 | 37 | auto Hook_LoopbackPacketSender::init(void) -> StatusData { 38 | 39 | lpMgr = this->mgr; 40 | auto sig = Utils::findSig("48 8D 05 ? ? ? ? 48 89 01 48 8B C3 48 89 79"); 41 | 42 | if(!sig) 43 | return StatusData(MethodStatus::Error, "[LoopbackPacketSender::send Hook] Failed to find Signature!"); 44 | 45 | auto offset = *(int*)(sig + 3); 46 | auto VTable = reinterpret_cast(sig + offset + 7); 47 | 48 | if(MH_CreateHook((void*)VTable[1], &SendCallback, reinterpret_cast(&_Send)) != MH_OK) 49 | return StatusData(MethodStatus::Error, "[LoopbackPacketSender::send Hook] Failed to create hook!"); 50 | 51 | if (MH_EnableHook((void*)VTable[1]) != MH_OK) 52 | return StatusData(MethodStatus::Error, "[LoopbackPacketSender::send Hook] Failed to enable hook!"); 53 | 54 | return StatusData(MethodStatus::Success, "[LoopbackPacketSender::send Hook] Successfully hooked!"); 55 | 56 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Hook/Hooks/LoopbackPacketSender/HookLoopbackPacketSender.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Hook.h" 4 | 5 | class Hook_LoopbackPacketSender : public Hook { 6 | public: 7 | Hook_LoopbackPacketSender(Manager* mgr) : Hook(mgr) {}; 8 | public: 9 | auto init(void)->StatusData override; 10 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Hook/Hooks/SwapChain/HookSwapChain.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Hook.h" 4 | 5 | class Hook_SwapChain : public Hook { 6 | public: 7 | Hook_SwapChain(Manager* mgr) : Hook(mgr) {}; 8 | public: 9 | auto init(void)->StatusData override; 10 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Hook/Hooks/SwapChain/Hook_SwapChain.cpp: -------------------------------------------------------------------------------- 1 | #include "HookSwapChain.h" 2 | 3 | #include "../../../Category/Module/Module.h" 4 | 5 | #include "../../../Manager.h" 6 | #include "../../../../Client.h" 7 | 8 | Manager* scMgr = nullptr; 9 | 10 | 11 | enum DirectXDeviceType { 12 | UnknownVersion = 0, 13 | Dx11 = 1, 14 | Dx12 = 2, 15 | }; 16 | 17 | using Microsoft::WRL::ComPtr; 18 | 19 | ComPtr d3d12CommandQueue; 20 | 21 | typedef HRESULT(__thiscall* PresentD3D12)(IDXGISwapChain3*, UINT, UINT); 22 | PresentD3D12 oPresentD3D12; 23 | 24 | auto hookPresentD3D12(IDXGISwapChain3* ppSwapChain, UINT syncInterval, UINT flags) -> HRESULT { 25 | 26 | auto window = (HWND)FindWindowA(nullptr, (LPCSTR)"Minecraft"); 27 | 28 | ComPtr d3d12Device; 29 | ComPtr d3d11Device; 30 | 31 | if (SUCCEEDED(ppSwapChain->GetDevice(IID_PPV_ARGS(&d3d12Device)))) { 32 | 33 | ComPtr ppContext; 34 | ComPtr d2dFactory; 35 | ComPtr d3d11On12Device; 36 | 37 | if (d3d12CommandQueue != nullptr) { 38 | 39 | HRESULT hr; 40 | 41 | hr = D3D11On12CreateDevice(d3d12Device.Get(), flags, nullptr, 0, (IUnknown**)(d3d12CommandQueue.GetAddressOf()), 1, 0, &d3d11Device, &ppContext, nullptr); 42 | 43 | if (FAILED(hr)) { 44 | 45 | Utils::debugOutput("Failed to create D3D11 on D3D12 Device!"); 46 | goto end; 47 | 48 | }; 49 | 50 | hr = d3d11Device.As(&d3d11On12Device); 51 | 52 | if (FAILED(hr)) { 53 | 54 | Utils::debugOutput("Failed to query ID3D11On12Device"); 55 | goto end; 56 | 57 | }; 58 | 59 | D2D1_FACTORY_OPTIONS options; 60 | options.debugLevel = D2D1_DEBUG_LEVEL_INFORMATION; 61 | 62 | hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, __uuidof(ID2D1Factory3), &options, &d2dFactory); 63 | 64 | if (FAILED(hr)) { 65 | 66 | Utils::debugOutput("Failed to create ID2D1Factory3"); 67 | goto end; 68 | 69 | }; 70 | 71 | ComPtr dxgiDevice; 72 | hr = d3d11On12Device.As(&dxgiDevice); 73 | 74 | if (FAILED(hr)) { 75 | 76 | Utils::debugOutput("Failed to query IDXGIDevice"); 77 | goto end; 78 | 79 | }; 80 | 81 | ComPtr D2DDevice; 82 | hr = d2dFactory->CreateDevice(dxgiDevice.Get(), &D2DDevice); 83 | 84 | if (FAILED(hr)) { 85 | 86 | Utils::debugOutput("Failed to create ID2D1Device2"); 87 | goto end; 88 | 89 | }; 90 | 91 | Utils::debugOutput("!!"); 92 | 93 | }; 94 | 95 | }; 96 | 97 | end: 98 | oPresentD3D12(ppSwapChain, syncInterval, flags); 99 | 100 | }; 101 | 102 | typedef void(__thiscall* ExecuteCommandListsD3D12)(ID3D12CommandQueue*, UINT, ID3D12CommandList*); 103 | ExecuteCommandListsD3D12 oExecuteCommandListsD3D12; 104 | 105 | auto hookExecuteCommandListsD3D12(ID3D12CommandQueue* queue, UINT NumCommandLists, ID3D12CommandList* ppCommandLists) -> void { 106 | if (!d3d12CommandQueue) 107 | d3d12CommandQueue = queue; 108 | 109 | oExecuteCommandListsD3D12(queue, NumCommandLists, ppCommandLists); 110 | }; 111 | 112 | auto Hook_SwapChain::init(void) -> StatusData { 113 | 114 | scMgr = this->mgr; 115 | 116 | if (kiero::init(kiero::RenderType::D3D12) != kiero::Status::Success) 117 | return StatusData(MethodStatus::Error, "[Kiero] Failed to initialize!"); 118 | 119 | if (kiero::bind(140, (void**)&oPresentD3D12, hookPresentD3D12) != kiero::Status::Success) 120 | return StatusData(MethodStatus::Error, "[Kiero Present D3D12 Hook] Failed to hook!"); 121 | 122 | if (kiero::bind(54, (void**)&oExecuteCommandListsD3D12, hookExecuteCommandListsD3D12) != kiero::Status::Success) 123 | return StatusData(MethodStatus::Error, "[Kiero ExecuteCommandLists D3D12 Hook] Failed to hook!"); 124 | 125 | return StatusData(MethodStatus::Error, "[Kiero] Successfully hooked methods!"); 126 | 127 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Manager.cpp: -------------------------------------------------------------------------------- 1 | #include "Manager.h" 2 | #include "../Client.h" 3 | 4 | Manager::Manager(Client* c) { 5 | 6 | this->client = c; 7 | this->isRunning = true; 8 | 9 | auto hooksData = this->initHooks(); 10 | 11 | switch (hooksData.first) { 12 | 13 | case MethodStatus::Success: 14 | 15 | this->initCategories(); 16 | 17 | break; 18 | 19 | case MethodStatus::Error: 20 | 21 | Utils::debugOutput(hooksData.second); 22 | this->isRunning = false; 23 | 24 | break; 25 | 26 | case MethodStatus::Failed: 27 | 28 | this->isRunning = false; 29 | this->uninjectDLL(); 30 | 31 | break; 32 | } 33 | 34 | while (this->isRunning) { 35 | 36 | for (auto category : this->categories) { 37 | 38 | category->baseTick(); 39 | 40 | }; 41 | 42 | }; 43 | 44 | this->uninjectDLL(); 45 | 46 | }; 47 | 48 | #include "Hook/Hooks/LoopbackPacketSender/HookLoopbackPacketSender.h" 49 | #include "Hook/Hooks/ClientInstance/HookClientInstance.h" 50 | #include "Hook/Hooks/SwapChain/HookSwapChain.h" 51 | #include "Hook/Hooks/Key/HookKey.h" 52 | 53 | auto Manager::initHooks(void) -> StatusData { 54 | 55 | if (MH_Initialize() != MH_OK) 56 | return StatusData(MethodStatus::Error, "Failed to Initialize MinHook"); 57 | 58 | new Hook_LoopbackPacketSender(this); 59 | new Hook_ClientInstance(this); 60 | //new Hook_SwapChain(this); 61 | new Hook_Key(this); 62 | 63 | for (auto hook : this->hooks) { 64 | 65 | auto data = hook->init(); 66 | Utils::debugOutput(data.second); 67 | 68 | }; 69 | 70 | return StatusData(MethodStatus::Success, "Finished initializing hooks!"); 71 | 72 | }; 73 | 74 | #include "Category/Module/Modules/Movement/AirJump.h" 75 | 76 | #include "Category/Module/Modules/Visual/TabGui.h" 77 | #include "Category/Module/Modules/Visual/RainbowText.h" 78 | 79 | #include "Category/Module/Modules/Other/TestModule.h" 80 | 81 | auto Manager::initCategories(void) -> void { 82 | 83 | auto combat = new Category(this, "Combat"); 84 | 85 | auto player = new Category(this, "Player"); 86 | 87 | auto move = new Category(this, "Move"); 88 | 89 | auto visuals = new Category(this, "Visuals"); 90 | 91 | auto world = new Category(this, "World"); 92 | 93 | auto other = new Category(this, "Misc"); 94 | 95 | 96 | /* Combat */ 97 | 98 | 99 | // WIP 100 | 101 | 102 | /* Movement */ 103 | 104 | 105 | new AirJump(move); 106 | 107 | 108 | // WIP 109 | 110 | 111 | /* Player */ 112 | 113 | 114 | // WIP 115 | 116 | 117 | /* Visuals */ 118 | 119 | 120 | new TabGui(visuals); 121 | new RainbowText(visuals); 122 | 123 | 124 | /* World */ 125 | 126 | 127 | // WIP 128 | 129 | 130 | /* Other */ 131 | 132 | 133 | new TestModule(other); 134 | 135 | }; 136 | 137 | auto Manager::uninjectDLL(void) -> void { 138 | 139 | MH_Uninitialize(); 140 | Sleep(1000); 141 | 142 | MH_DisableHook(MH_ALL_HOOKS); 143 | FreeLibraryAndExitThread(Utils::getDll(), 1); 144 | 145 | }; -------------------------------------------------------------------------------- /Thrift/Client/Manager/Manager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../Utils/Utils.h" 4 | #include "Category/Category.h" 5 | 6 | class Client; 7 | class Hook; 8 | 9 | class Manager { 10 | public: 11 | Client* client; 12 | bool isRunning = false; 13 | public: 14 | std::vector hooks; 15 | std::vector categories; 16 | public: 17 | Manager(Client*); 18 | public: 19 | auto initHooks(void)->StatusData; 20 | auto initCategories(void)->void; 21 | public: 22 | auto uninjectDLL(void) -> void; 23 | }; -------------------------------------------------------------------------------- /Thrift/Client/SDK/Classes/Actor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Utils/Utils.h" 4 | #include "DirectPlayerMovementProxy.h" 5 | 6 | // Classes/ Structs 7 | class DirectPlayerMovementProxy; 8 | 9 | class Actor { 10 | public: 11 | DirectPlayerMovementProxy* getMovementProxy() { 12 | using MovementProxyFunction = void(__fastcall*)(Actor*, std::shared_ptr*); 13 | static MovementProxyFunction originalFunction = (MovementProxyFunction)Utils::findSig("40 53 48 83 ec ? 8b 41 ? 48 8b da 48 8b 49 ? 48 8d 54 24 ? 89 44 24 ? 48 8b 09 e8 ? ? ? ? 45 33 c9"); 14 | std::shared_ptr movementProxyPointer; 15 | originalFunction(this, &movementProxyPointer); 16 | return (DirectPlayerMovementProxy*)movementProxyPointer.get(); 17 | } 18 | 19 | auto setSprinting(bool doIt) -> void { 20 | return Utils::CallVFunc<278, void, bool>(this, doIt); 21 | }; 22 | }; -------------------------------------------------------------------------------- /Thrift/Client/SDK/Classes/ClientInstance.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Utils/Utils.h" 4 | 5 | #include "LoopbackPacketSender.h" 6 | #include "MinecraftGame.h" 7 | #include "Player.h" 8 | 9 | class ClientInstance { 10 | private: 11 | uintptr_t** VTable; 12 | public: 13 | auto getLocalPlayer(void) -> class Player* { 14 | using GetLocalPlayer = Player * (__thiscall*)(ClientInstance*); 15 | GetLocalPlayer _GetLocalPlayer = (GetLocalPlayer)(this->VTable[25]); 16 | return _GetLocalPlayer(this); 17 | }; 18 | public: 19 | BUILD_ACCESS(class LoopbackPacketSender*, LoopbackPacketSender, 0xD0);//Not sure but should be it (I hope) 20 | BUILD_ACCESS(class MinecraftGame*, MinecraftGame, 0xB0); 21 | BUILD_ACCESS(class MoveInputHandler*, MoveInputHandler, 0x108); 22 | public: 23 | AS_FIELD(class Player*, LocalPlayer, getLocalPlayer); 24 | }; -------------------------------------------------------------------------------- /Thrift/Client/SDK/Classes/DirectPlayerMovementProxy.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Utils/Utils.h" 3 | 4 | class DirectPlayerMovementProxy { 5 | public: 6 | bool isOnGround() { 7 | return Utils::CallVFunc<43, bool>(this); 8 | } 9 | 10 | auto setOnGround(bool onGround) -> void { 11 | return Utils::CallVFunc<44, void, bool>(this, onGround); 12 | }; 13 | }; -------------------------------------------------------------------------------- /Thrift/Client/SDK/Classes/LoopbackPacketSender.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Packet.h" 4 | 5 | class LoopbackPacketSender { 6 | public: 7 | // 8 | }; -------------------------------------------------------------------------------- /Thrift/Client/SDK/Classes/MinecraftGame.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Utils/Utils.h" 4 | 5 | class Font; 6 | 7 | class MinecraftGame { 8 | public: 9 | BUILD_ACCESS(bool, canUseKeys, 0xB0); 10 | BUILD_ACCESS(Font*, mcfont, 0xE48); 11 | }; -------------------------------------------------------------------------------- /Thrift/Client/SDK/Classes/MinecraftUIRenderContext.cpp: -------------------------------------------------------------------------------- 1 | #include "MinecraftUIRenderContext.h" 2 | 3 | auto MinecraftUIRenderContext::drawText(Font* font, Vec2 textPos, std::string text, Color color, float fontSize) -> void { 4 | 5 | if (font == nullptr) { 6 | 7 | auto instance = this->clientInstance; 8 | auto mcgame = (instance != nullptr ? instance->MinecraftGame : nullptr); 9 | font = (mcgame != nullptr ? mcgame->mcfont : nullptr); 10 | 11 | }; 12 | 13 | if (font == nullptr) 14 | return; 15 | 16 | TextMeasureData textMeasureData = TextMeasureData(fontSize); 17 | CaretMeasureData caretMeasureData = CaretMeasureData(); 18 | 19 | auto textRect = Rect(textPos.x, textPos.x + (textPos.x * fontSize), textPos.y, textPos.y + (textPos.y * fontSize / 2)); 20 | this->drawText(font, textRect.get(), &text, color.get(), color.a, 0, &textMeasureData, &caretMeasureData); 21 | 22 | }; 23 | 24 | auto MinecraftUIRenderContext::getTextLen(Font* font, std::string text, float fontSize) -> float { 25 | 26 | if (font == nullptr) { 27 | 28 | auto instance = this->clientInstance; 29 | auto mcgame = (instance != nullptr ? instance->MinecraftGame : nullptr); 30 | font = (mcgame != nullptr ? mcgame->mcfont : nullptr); 31 | 32 | }; 33 | 34 | if (font == nullptr) 35 | return 0.f; 36 | 37 | return this->getLineLength(font, &text, fontSize, false); 38 | 39 | }; 40 | 41 | auto MinecraftUIRenderContext::drawRectangle(Rect rect, Color color, int lineWidth) -> void { 42 | 43 | rect = Rect(rect.x, rect.z, rect.y, rect.w); 44 | this->drawRectangle(rect.get(), color.get(), color.a, lineWidth); 45 | 46 | }; 47 | 48 | auto MinecraftUIRenderContext::fillRectangle(Rect rect, Color color) -> void { 49 | 50 | rect = Rect(rect.x, rect.z, rect.y, rect.w); 51 | this->fillRectangle(rect.get(), color.get(), color.a); 52 | 53 | }; -------------------------------------------------------------------------------- /Thrift/Client/SDK/Classes/MinecraftUIRenderContext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ClientInstance.h" 4 | #include "../../Utils/Utils.h" 5 | 6 | class TextMeasureData { 7 | public: 8 | float scale; 9 | public: 10 | TextMeasureData(float scale = 1.f) { 11 | this->scale = scale; 12 | }; 13 | }; 14 | 15 | class CaretMeasureData { 16 | public: 17 | int a; 18 | int b; 19 | public: 20 | CaretMeasureData(int paramA = 0xFFFFFFFF, bool paramB = false) { 21 | this->a = paramA; 22 | this->b = paramB; 23 | }; 24 | }; 25 | 26 | class Rect : public Vec4 { 27 | public: 28 | float x = 0.f; 29 | float y = 0.f; 30 | float z = 0.f; 31 | float w = 0.f; 32 | public: 33 | Rect(float top = 0.f, float left = 0.f, float right = 0.f, float bottom = 0.f) { 34 | this->x = top; 35 | this->y = left; 36 | this->z = right; 37 | this->w = bottom; 38 | }; 39 | public: 40 | auto get(void) -> float* { 41 | float v[] = { this->x, this->y, this->z, this->w }; 42 | return v; 43 | }; 44 | }; 45 | 46 | class Color { 47 | public: 48 | float r = 255.f; 49 | float g = 255.f; 50 | float b = 255.f; 51 | float a = 1.f; 52 | public: 53 | Color(float r = 255.f, float g = 255.f, float b = 255.f, float a = 1.f) { 54 | this->r = r / 255.f; 55 | this->g = g / 255.f; 56 | this->b = b / 255.f; 57 | this->a = a; 58 | }; 59 | public: 60 | auto get(void) -> float* { 61 | float v[] = { this->r, this->g, this->b, this->a }; 62 | return v; 63 | }; 64 | }; 65 | 66 | class MinecraftUIRenderContext { 67 | public: 68 | ClientInstance* clientInstance; 69 | private: 70 | virtual ~MinecraftUIRenderContext(); 71 | public: 72 | virtual auto getLineLength(Font*, std::string*, float, bool) -> float; 73 | virtual auto getTextAlpha(void) -> float; 74 | virtual auto setTextAlpa(float) -> void; 75 | virtual auto drawDebugText(const float*, std::string*, const float*, float, unsigned int, float*, void*) -> __int64; 76 | virtual auto drawText(Font*, const float*, std::string*, const float*, float, unsigned int, const TextMeasureData*, const CaretMeasureData*) -> __int64; 77 | virtual auto flushText(float) -> void; 78 | virtual auto drawImage(std::string*, Vec2*, Vec2*, Vec2*, Vec2*, bool, const float*, float) -> __int64; 79 | private: 80 | //virtual auto Function7(void) -> void; 81 | virtual auto Function8(void) -> void; 82 | virtual auto Function9(void) -> void; 83 | virtual auto Function10(void) -> void; 84 | virtual auto Function11(void) -> void; 85 | public: 86 | virtual auto drawRectangle(const float*, const float*, float, int) -> void; 87 | virtual auto fillRectangle(const float*, const float*, float) -> void; 88 | public: 89 | auto drawText(Font*, Vec2, std::string, Color, float) -> void; 90 | auto getTextLen(Font*, std::string, float) -> float; 91 | public: 92 | auto drawRectangle(Rect, Color, int) -> void; 93 | auto fillRectangle(Rect, Color) -> void; 94 | }; -------------------------------------------------------------------------------- /Thrift/Client/SDK/Classes/Packet.cpp: -------------------------------------------------------------------------------- 1 | #include "Packet.h" 2 | 3 | template 4 | auto Packet::setVTable(uintptr_t sig) -> void { 5 | 6 | if (sig == NULL) 7 | return; 8 | 9 | memset(this, 0, sizeof(P)); 10 | int offset = *(int*)(sig + 3); 11 | this->VTable = (uintptr_t**)(sig + offset + 7); 12 | 13 | }; 14 | 15 | TextPacket::TextPacket(void) { 16 | 17 | static auto sig = (uintptr_t)NULL; 18 | 19 | if (!sig) 20 | sig = Utils::findSig("48 8D 05 ? ? ? ? 48 89 45 ? C6 45 ? ? 48 89 7D ? 48 89 7D"); 21 | 22 | this->setVTable(sig); 23 | 24 | }; -------------------------------------------------------------------------------- /Thrift/Client/SDK/Classes/Packet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../Utils/Utils.h" 4 | 5 | class Packet { 6 | public: 7 | uintptr_t** VTable; 8 | public: 9 | template 10 | auto setVTable(unsigned long long) -> void; 11 | }; 12 | 13 | class TextPacket : public Packet { 14 | public: 15 | TextPacket(void); 16 | }; -------------------------------------------------------------------------------- /Thrift/Client/SDK/Classes/Player.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Actor.h" 4 | 5 | class Player : public Actor { 6 | public: 7 | // 8 | }; -------------------------------------------------------------------------------- /Thrift/Client/SDK/Minecraft.cpp: -------------------------------------------------------------------------------- 1 | #include "Minecraft.h" 2 | 3 | ClientInstance* Minecraft::ci = nullptr; 4 | 5 | auto Minecraft::getClientInstance(void) -> ClientInstance* { 6 | 7 | return Minecraft::ci; 8 | 9 | }; 10 | 11 | auto Minecraft::setClientInstance(ClientInstance* ptr) -> void { 12 | 13 | if (ptr == nullptr) 14 | return; 15 | 16 | Minecraft::ci = ptr; 17 | 18 | }; -------------------------------------------------------------------------------- /Thrift/Client/SDK/Minecraft.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Classes/MinecraftUIRenderContext.h" 4 | 5 | class Minecraft { 6 | private: 7 | static ClientInstance* ci; 8 | public: 9 | static auto getClientInstance(void)->ClientInstance*; 10 | static auto setClientInstance(ClientInstance*)->void; 11 | }; -------------------------------------------------------------------------------- /Thrift/Client/Utils/Utils.cpp: -------------------------------------------------------------------------------- 1 | #include "Utils.h" 2 | 3 | std::string Utils::debugPath = Utils::getRoamPath(); 4 | 5 | auto Utils::getDll(void) -> HMODULE { 6 | 7 | MEMORY_BASIC_INFORMATION info; 8 | size_t len = VirtualQueryEx(GetCurrentProcess(), (void*)getDll, &info, sizeof(info)); 9 | assert(len == sizeof(info)); 10 | return len ? (HMODULE)info.AllocationBase : NULL; 11 | 12 | }; 13 | 14 | auto Utils::findSig(const char* szSignature) -> unsigned long long { 15 | const char* pattern = szSignature; 16 | unsigned long long firstMatch = 0; 17 | 18 | static const unsigned long long rangeStart = (unsigned long long)GetModuleHandleA("Minecraft.Windows.exe"); 19 | 20 | MODULEINFO miModInfo; 21 | static bool init = false; 22 | 23 | if (!init) { 24 | init = true; 25 | GetModuleInformation(GetCurrentProcess(), (HMODULE)rangeStart, &miModInfo, sizeof(MODULEINFO)); 26 | }; 27 | 28 | static const unsigned long long rangeEnd = rangeStart + miModInfo.SizeOfImage; 29 | 30 | BYTE patByte = GET_BYTE(pattern); 31 | const char* oldPat = pattern; 32 | 33 | for (unsigned long long pCur = rangeStart; pCur < rangeEnd; pCur++) { 34 | 35 | if (!*pattern) 36 | return firstMatch; 37 | 38 | while (*(PBYTE)pattern == ' ') 39 | pattern++; 40 | 41 | if (!*pattern) 42 | return firstMatch; 43 | 44 | if (oldPat != pattern) { 45 | oldPat = pattern; 46 | if (*(PBYTE)pattern != '\?') 47 | patByte = GET_BYTE(pattern); 48 | }; 49 | 50 | if (*(PBYTE)pattern == '\?' || *(BYTE*)pCur == patByte) { 51 | 52 | if (!firstMatch) 53 | firstMatch = pCur; 54 | 55 | if (!pattern[2]) 56 | return firstMatch; 57 | 58 | pattern += 2; 59 | 60 | } 61 | 62 | else { 63 | 64 | pattern = szSignature; 65 | firstMatch = 0; 66 | 67 | }; 68 | }; 69 | 70 | return NULL; 71 | 72 | }; 73 | 74 | auto Utils::findMultiLvlPtr(uintptr_t baseAddr, std::vector offsets) -> uintptr_t* { 75 | 76 | auto hwnd = GetModuleHandle(L"Minecraft.Windows.exe"); 77 | 78 | auto ptr = (uintptr_t)(hwnd)+baseAddr; 79 | auto i = 0; 80 | 81 | do { 82 | 83 | if (*(uintptr_t*)ptr + offsets[i] == offsets[i] || *(uintptr_t*)ptr + offsets[i] > 0xFFFFFFFFFFFF) 84 | break; 85 | 86 | ptr = *(uintptr_t*)ptr + offsets[i]; 87 | 88 | if (ptr == NULL) 89 | break; 90 | 91 | i++; 92 | 93 | } while (i < offsets.size()); 94 | 95 | return (i == offsets.size() ? (uintptr_t*)ptr : nullptr); 96 | 97 | }; 98 | 99 | auto Utils::getRoamPath(void) -> std::string { 100 | 101 | char* path = NULL; 102 | size_t length; 103 | 104 | _dupenv_s(&path, &length, "appdata"); 105 | 106 | return std::string(path) + "\\..\\Local\\Packages\\Microsoft.MinecraftUWP_8wekyb3d8bbwe\\RoamingState"; 107 | 108 | }; 109 | 110 | auto Utils::getDebugPath(void) -> std::string { 111 | 112 | auto f = std::filesystem::path(Utils::debugPath); 113 | 114 | if (!std::filesystem::exists(f)) 115 | std::filesystem::create_directories(f); 116 | 117 | return Utils::debugPath; 118 | 119 | }; 120 | 121 | auto Utils::setDebugPath(std::string path) -> void { 122 | 123 | Utils::debugPath = std::string(Utils::getRoamPath() + "\\" + path); 124 | 125 | }; 126 | 127 | auto Utils::debugOutput(std::string output) -> void { 128 | 129 | static bool init = false; 130 | static auto path = Utils::getDebugPath(); 131 | 132 | auto file = std::string(path + "\\Output.txt"); 133 | 134 | if (!init) { 135 | auto f = std::filesystem::path(file); 136 | 137 | if (std::filesystem::exists(f)) 138 | std::filesystem::remove(f); 139 | 140 | init = true; 141 | }; 142 | 143 | CloseHandle(CreateFileA(file.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)); 144 | 145 | std::ofstream fStream; 146 | fStream.open(file.c_str(), std::ios::app); 147 | 148 | if (fStream.is_open()) 149 | fStream << output << "\n" << std::endl; 150 | 151 | return fStream.close(); 152 | 153 | }; 154 | 155 | auto Utils::ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v) -> void { 156 | 157 | float K = 0.f; 158 | if (g < b) { 159 | auto tmp = g; 160 | g = b; 161 | b = tmp; 162 | 163 | K = -1.f; 164 | } 165 | if (r < g) { 166 | auto tmp = r; 167 | r = g; 168 | g = tmp; 169 | 170 | K = -2.f / 6.f - K; 171 | } 172 | 173 | const float chroma = r - (g < b ? g : b); 174 | out_h = fabsf(K + (g - b) / (6.f * chroma + 1e-20f)); 175 | out_s = chroma / (r + 1e-20f); 176 | out_v = r; 177 | 178 | }; 179 | 180 | auto Utils::ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b) -> void { 181 | 182 | if (s == 0.0f) { 183 | // gray 184 | out_r = out_g = out_b = v; 185 | return; 186 | } 187 | 188 | h = fmodf(h, 1.0f) / (60.0f / 360.0f); 189 | int i = (int)h; 190 | float f = h - (float)i; 191 | float p = v * (1.0f - s); 192 | float q = v * (1.0f - s * f); 193 | float t = v * (1.0f - s * (1.0f - f)); 194 | 195 | switch (i) { 196 | 197 | case 0: 198 | 199 | out_r = v; 200 | out_g = t; 201 | out_b = p; 202 | 203 | break; 204 | 205 | case 1: 206 | 207 | out_r = q; 208 | out_g = v; 209 | out_b = p; 210 | 211 | break; 212 | 213 | case 2: 214 | 215 | out_r = p; 216 | out_g = v; 217 | out_b = t; 218 | 219 | break; 220 | 221 | case 3: 222 | 223 | out_r = p; 224 | out_g = q; 225 | out_b = v; 226 | 227 | break; 228 | 229 | case 4: 230 | 231 | out_r = t; 232 | out_g = p; 233 | out_b = v; 234 | 235 | break; 236 | 237 | case 5: 238 | 239 | default: 240 | 241 | out_r = v; 242 | out_g = p; 243 | out_b = q; 244 | 245 | break; 246 | } 247 | 248 | }; 249 | 250 | auto Utils::ApplyRainbow(float* rcolors, float modifier = 0.003f) -> void { 251 | 252 | if (rcolors[3] < 1) { 253 | 254 | rcolors[0] = 1; 255 | rcolors[1] = 0.6f; 256 | rcolors[2] = 0.6f; 257 | rcolors[3] = 1; 258 | 259 | }; 260 | 261 | Utils::ColorConvertRGBtoHSV(rcolors[0], rcolors[1], rcolors[2], rcolors[0], rcolors[1], rcolors[2]); 262 | 263 | rcolors[0] += modifier; 264 | 265 | if (rcolors[0] >= 1) 266 | rcolors[0] = 0; 267 | 268 | Utils::ColorConvertHSVtoRGB(rcolors[0], rcolors[1], rcolors[2], rcolors[0], rcolors[1], rcolors[2]); 269 | 270 | }; -------------------------------------------------------------------------------- /Thrift/Client/Utils/Utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | template auto IIFE(F f) { return f(); } 17 | 18 | template struct remove_cvref { typedef std::remove_cv_t> type; }; 19 | 20 | template using remove_cvref_t = typename remove_cvref::type; 21 | 22 | template Ret& direct_access(Type* type, size_t offset) { 23 | union { 24 | size_t raw; 25 | Type* source; 26 | Ret* target; 27 | } u; 28 | u.source = type; 29 | u.raw += offset; 30 | return *u.target; 31 | } 32 | 33 | #define AS_FIELD(type, name, fn) __declspec(property(get = fn, put = set##name)) type name 34 | #define DEF_FIELD_RW(type, name) __declspec(property(get = get##name, put = set##name)) type name 35 | 36 | #define FAKE_FIELD(type, name) \ 37 | AS_FIELD(type, name, get##name); \ 38 | type get##name() 39 | 40 | #define BUILD_ACCESS(type, name, offset) \ 41 | AS_FIELD(type, name, get##name); \ 42 | type get##name() const { return direct_access(this, offset); } \ 43 | void set##name(type v) const { direct_access(this, offset) = v; } 44 | 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | #pragma comment(lib, "d2d1.lib") 56 | #pragma comment(lib, "d3d11.lib") 57 | #pragma comment(lib, "d3d12.lib") 58 | #pragma comment(lib, "dwrite.lib") 59 | 60 | #include "../Kiero/Kiero.h" 61 | 62 | #define INRANGE(x,a,b) (x >= a && x <= b) 63 | #define GET_BYTE( x ) (GET_BITS(x[0]) << 4 | GET_BITS(x[1])) 64 | #define GET_BITS( x ) (INRANGE((x&(~0x20)),'A','F') ? ((x&(~0x20)) - 'A' + 0xa) : (INRANGE(x,'0','9') ? x - '0' : 0)) 65 | 66 | #define StatusData std::pair 67 | 68 | enum MethodStatus { 69 | Success = 0, 70 | Failed = 1, 71 | Error = 2 72 | }; 73 | 74 | class Utils { 75 | private: 76 | static std::string debugPath; 77 | public: 78 | static auto getDll(void)->HMODULE; 79 | static auto findSig(const char* szSignature)->unsigned long long; 80 | static auto findMultiLvlPtr(uintptr_t, std::vector)->uintptr_t*; 81 | public: 82 | static auto getRoamPath(void)->std::string; 83 | public: 84 | static auto getDebugPath(void)->std::string; 85 | static auto setDebugPath(std::string)->void; 86 | public: 87 | static auto debugOutput(std::string)->void; 88 | public: 89 | template 90 | static auto genRndNum(T min = 0, T max = 1)->T { 91 | std::random_device rd; 92 | std::mt19937 gen(rd()); 93 | std::uniform_real_distribution<>dis(min, max); 94 | return dis(gen); 95 | }; 96 | public: 97 | static auto ColorConvertRGBtoHSV(float, float, float, float&, float&, float&) -> void; 98 | static auto ColorConvertHSVtoRGB(float, float, float, float&, float&, float&) -> void; 99 | static auto ApplyRainbow(float*, float) -> void; 100 | template 101 | static auto CallVFunc(void* thisptr, TArgs... argList) -> TRet { 102 | using Fn = TRet(__thiscall*)(void*, decltype(argList)...); 103 | return (*static_cast(thisptr))[IIdx](thisptr, argList...); 104 | } 105 | }; 106 | 107 | template 108 | class Vec2 { 109 | public: 110 | T x = 0; 111 | T y = 0; 112 | public: 113 | Vec2(T x = 0, T y = 0) { 114 | this->x = x; 115 | this->y = y; 116 | }; 117 | public: 118 | Vec2& operator = (const Vec2& v) { 119 | x = v.x; 120 | y = v.y; 121 | return *this; 122 | }; 123 | public: 124 | bool operator == (const Vec2& v) { 125 | return ( 126 | this->x == v.x && 127 | this->y == v.y 128 | ); 129 | }; 130 | bool operator != (const Vec2& v) { 131 | return ( 132 | this->x != v.x || 133 | this->y != v.y 134 | ); 135 | }; 136 | public: 137 | Vec2 div(T v) { 138 | return Vec2(x / v, y / v); 139 | }; 140 | Vec2 div(T vX, T vY) { 141 | return Vec2(x / vX, y / vY); 142 | }; 143 | Vec2 div(Vec2& v) { 144 | return Vec2(x / v.x, y / v.y); 145 | }; 146 | public: 147 | Vec2 mul(T v) { 148 | return Vec2(x * v, y * v); 149 | }; 150 | Vec2 mul(T vX, T vY) { 151 | return Vec2(x * vX, y * vY); 152 | }; 153 | Vec2 mul(Vec2& v) { 154 | return Vec2(x * v.x, y * v.y); 155 | }; 156 | public: 157 | Vec2 add(T v) { 158 | return Vec2(x + v, y + v); 159 | }; 160 | Vec2 add(T vX, T vY) { 161 | return Vec2(x + vX, y + vY); 162 | }; 163 | Vec2 add(Vec2& v) { 164 | return Vec2(x + v.x, y + v.y); 165 | }; 166 | public: 167 | Vec2 sub(T v) { 168 | return Vec2(x - v, y - v); 169 | }; 170 | Vec2 sub(T vX, T vY) { 171 | return Vec2(x - vX, y - vY); 172 | }; 173 | Vec2 sub(Vec2& v) { 174 | return Vec2(x - v.x, y - v.y); 175 | }; 176 | }; 177 | 178 | template 179 | class Vec3 : public Vec2 { 180 | public: 181 | T x = 0; 182 | T y = 0; 183 | T z = 0; 184 | public: 185 | Vec3(T x = 0, T y = 0, T z = 0) { 186 | this->x = x; 187 | this->y = y; 188 | this->z = z; 189 | }; 190 | public: 191 | Vec3& operator = (const Vec3& v) { 192 | x = v.x; 193 | y = v.y; 194 | z = v.z; 195 | return *this; 196 | }; 197 | public: 198 | bool operator == (const Vec3& v) { 199 | return ( 200 | this->x == v.x && 201 | this->y == v.y && 202 | this->z == v.z 203 | ); 204 | }; 205 | bool operator != (const Vec3& v) { 206 | return ( 207 | this->x != v.x || 208 | this->y != v.y || 209 | this->z != v.z 210 | ); 211 | }; 212 | public: 213 | Vec3 div(T v) { 214 | return Vec3(x / v, y / v, z / v); 215 | }; 216 | Vec3 div(T vX, T vY, T vZ) { 217 | return Vec3(x / vX, y / vY, z / vZ); 218 | }; 219 | Vec3 div(Vec3& v) { 220 | return Vec3(x / v.x, y / v.y, z / v.z); 221 | }; 222 | public: 223 | Vec3 mul(T v) { 224 | return Vec3(x * v, y * v, z * v); 225 | }; 226 | Vec3 mul(T vX, T vY, T vZ) { 227 | return Vec3(x * vX, y * vY, z * vZ); 228 | }; 229 | Vec3 mul(Vec3& v) { 230 | return Vec3(x * v.x, y * v.y, z * v.z); 231 | }; 232 | public: 233 | Vec3 add(T v) { 234 | return Vec3(x + v, y + v, z + v); 235 | }; 236 | Vec3 add(T vX, T vY, T vZ) { 237 | return Vec3(x + vX, y + vY, z + vZ); 238 | }; 239 | Vec3 add(Vec3& v) { 240 | return Vec3(x + v.x, y + v.y, z + v.z); 241 | }; 242 | public: 243 | Vec3 sub(T v) { 244 | return Vec3(x - v, y - v, z - v); 245 | }; 246 | Vec3 sub(T vX, T vY, T vZ) { 247 | return Vec3(x - vX, y - vY, z - vZ); 248 | }; 249 | Vec3 sub(Vec3& v) { 250 | return Vec3(x - v.x, y - v.y, z - v.z); 251 | }; 252 | }; 253 | 254 | template 255 | class Vec4 : public Vec3 { 256 | public: 257 | T x = 0; 258 | T y = 0; 259 | T z = 0; 260 | T w = 0; 261 | public: 262 | Vec4(T x = 0, T y = 0, T z = 0, T w = 0) { 263 | this->x = x; 264 | this->y = y; 265 | this->z = z; 266 | this->w = w; 267 | }; 268 | public: 269 | Vec4& operator = (const Vec4& v) { 270 | x = v.x; 271 | y = v.y; 272 | z = v.z; 273 | w = v.w; 274 | return *this; 275 | }; 276 | public: 277 | bool operator == (const Vec4& v) { 278 | return ( 279 | this->x == v.x && 280 | this->y == v.y && 281 | this->z == v.z && 282 | this->w == v.w 283 | ); 284 | }; 285 | bool operator != (const Vec4& v) { 286 | return ( 287 | this->x != v.x || 288 | this->y != v.y || 289 | this->z != v.z || 290 | this->w != v.w 291 | ); 292 | }; 293 | public: 294 | Vec4 div(T v) { 295 | return Vec4(x / v, y / v, z / v, w / v); 296 | }; 297 | Vec4 div(T vX, T vY, T vZ, T vW) { 298 | return Vec4(x / vX, y / vY, z / vZ, w / vW); 299 | }; 300 | Vec4 div(Vec4& v) { 301 | return Vec4(x / v.x, y / v.y, z / v.z, w / v.w); 302 | }; 303 | public: 304 | Vec4 mul(T v) { 305 | return Vec4(x * v, y * v, z * v, w * v); 306 | }; 307 | Vec4 mul(T vX, T vY, T vZ, T vW) { 308 | return Vec4(x * vX, y * vY, z * vZ, w * vW); 309 | }; 310 | Vec4 mul(Vec4& v) { 311 | return Vec4(x * v.x, y * v.y, z * v.z, w * v.w); 312 | }; 313 | public: 314 | Vec4 add(T v) { 315 | return Vec4(x + v, y + v, z + v, w + v); 316 | }; 317 | Vec4 add(T vX, T vY, T vZ, T vW) { 318 | return Vec4(x + vX, y + vY, z + vZ, w + vW); 319 | }; 320 | Vec4 add(Vec4& v) { 321 | return Vec4(x + v.x, y + v.y, z + v.z, w + v.w); 322 | }; 323 | public: 324 | Vec4 sub(T v) { 325 | return Vec4(x - v, y - v, z - v, w - v); 326 | }; 327 | Vec4 sub(T vX, T vY, T vZ, T vW) { 328 | return Vec4(x - vX, y - vY, z - vZ, w - vW); 329 | }; 330 | Vec4 sub(Vec4& v) { 331 | return Vec4(x - v.x, y - v.y, z - v.z, w - v.z); 332 | }; 333 | }; -------------------------------------------------------------------------------- /Thrift/Thrift.cpp: -------------------------------------------------------------------------------- 1 | #include "Client/Client.h" 2 | 3 | auto init(HINSTANCE hInstance) -> void { 4 | 5 | auto client = new Client("Thrift"); 6 | 7 | }; 8 | 9 | auto WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID lpRes) -> BOOL { 10 | 11 | switch (fdwReason) { 12 | 13 | case DLL_PROCESS_ATTACH: 14 | 15 | CreateThread(0, 0, (LPTHREAD_START_ROUTINE)init, hInstance, 0, 0); 16 | 17 | break; 18 | 19 | }; 20 | 21 | return TRUE; 22 | 23 | }; -------------------------------------------------------------------------------- /Thrift/Thrift.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {dd746e5c-05ed-4c12-b425-2b601b6d4ab6} 25 | Thrift 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | DynamicLibrary 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | 76 | 77 | false 78 | 79 | 80 | true 81 | 82 | 83 | false 84 | 85 | 86 | 87 | Level3 88 | true 89 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 90 | true 91 | 92 | 93 | Console 94 | true 95 | 96 | 97 | 98 | 99 | Level3 100 | true 101 | true 102 | true 103 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 104 | true 105 | 106 | 107 | Console 108 | true 109 | true 110 | true 111 | 112 | 113 | 114 | 115 | Level3 116 | true 117 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 118 | true 119 | 120 | 121 | Console 122 | true 123 | 124 | 125 | 126 | 127 | Level3 128 | true 129 | true 130 | true 131 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 132 | true 133 | stdcpp20 134 | 135 | 136 | Console 137 | true 138 | true 139 | true 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 199 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /Thrift/Thrift.vcxproj.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 | 77 | 78 | Header Files 79 | 80 | 81 | Header Files 82 | 83 | 84 | Header Files 85 | 86 | 87 | Header Files 88 | 89 | 90 | Header Files 91 | 92 | 93 | Header Files 94 | 95 | 96 | Header Files 97 | 98 | 99 | Header Files 100 | 101 | 102 | Header Files 103 | 104 | 105 | Header Files 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 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /Thrift/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | --------------------------------------------------------------------------------