forked from MadrisAkb/Valorant-External
/
machair.cpp
1956 lines (1668 loc) · 53.5 KB
/
machair.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <iostream>
#include "GL/glew.h"
#include "imgui/imgui.h"
#include "imgui/imgui_impl_glfw.h"
#include "imgui/imgui_impl_opengl3.h"
#include <GLFW/glfw3.h>
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h>
#include <Windows.h>
#include <TlHelp32.h>
#include <vector>
#include "offsets.h"
#include "vector3.h"
#include "defs.h"
#include <tchar.h>
#include <intrin.h>
#include "auth.hpp"
#include "comm.h"
#include "xorstr.hpp"
#include <ProcessSnapshot.h>
#include "xor.hpp"
#include <Windows.h>
#include "fontSF.h"
#include <iostream>
#include <fstream>
#include <cstdint>
#include <filesystem>
uintptr_t unique_id;
std::string tm_to_readable_time(tm ctx);
static std::time_t string_to_timet(std::string timestamp);
static std::tm timet_to_tm(time_t timestamp);
using namespace KeyAuth;
std::string name = "Emre"; // application name. right above the blurred text aka the secret on the licenses tab among other tabs
std::string ownerid = "e1HCo5FQWL"; // ownerid, found in account settings. click your profile picture on top right of dashboard and then account settings.
std::string secret = "e6b0156fab99d029b26b329b4a4f8996540a0dd62199bc19879e62e3b312cb52"; // app secret, the blurred text on licenses tab and other tabs
std::string version = "1.0"; // leave alone unless you've changed version on website
std::string url = "https://keyauth.win/api/1.1/"; // change if you're self-hosting
std::string sslPin = "ssl pin key (optional)"; // don't change unless you intend to pin public certificate key. you can get here in the "Pin SHA256" field https://www.ssllabs.com/ssltest/analyze.html?d=keyauth.win&latest. If you do this you need to be aware of when SSL key expires so you can update i
api KeyAuthApp(name, ownerid, secret, version, url, sslPin);
struct State {
uintptr_t keys[7];
};
UINT profetrol;
typedef struct {
uintptr_t actor_ptr;
uintptr_t damage_handler_ptr;
uintptr_t player_state_ptr;
uintptr_t root_component_ptr;
uintptr_t mesh_ptr;
uintptr_t bone_array_ptr;
int bone_count;
bool is_visible;
} Enemy;
// Window / Process values
HWND valorant_window;
GLFWwindow* g_window;
int g_width;
int g_height;
int g_pid;
uintptr_t g_base_address;
ImU32 g_esp_color = ImGui::ColorConvertFloat4ToU32(ImVec4(0, 136, 255, 200));
ImU32 g_color_white = ImGui::ColorConvertFloat4ToU32(ImVec4(255, 0, 255, 200));
// Cheat toggle values
bool g_overlay_visible{ false };
bool g_esp_enabled{ true };
bool g_esp_dormantcheck{ false };
bool g_aimbot{ false };
bool g_aimbottest{ false };
bool g_lines{ false };
bool g_health{ false };
bool g_distanceesp{ false };
bool g_headesp{ true };
bool g_boneesp{ true };
bool g_agentname{ false };
bool g_boxesp{ true };
bool test1{ false };
bool test2{ false };
bool test3{ false };
bool test4{ false };
ImVec2 head_at_screen;
ImVec2 boted_vex_screen;
Vector3 camera_position;
Vector3 camera_rotation;
// Pointers
uintptr_t local_player_pawn;
uintptr_t g_local_player_controller;
uintptr_t g_local_player_pawn;
uintptr_t g_local_damage_handler;
uintptr_t g_camera_manager;
int g_local_team_id;
// Enemy list
std::vector<Enemy> enemy_collection{};
int Depth;
static int bonepos = 1;
static const char* bones[]
{
"Head",
"Neck",
"Chest",
"Pelvis",
"Stomach",
"Random"
};
static int bonekey;
static int aimkeypos = 2;
static const char* aimkeys[]
{
"Left Mouse Button",
"Right Mouse Button",
"Middle Mouse Button",
"Mouse Side 1",
"Mouse Side 2",
"Control-Break Processing",
"Backspace",
"Tab",
"Clear",
"Enter",
"SHIFT",
"CTRL",
"ALT",
"Caps Lock",
"Esc",
"Space",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"Numpad 0",
"Numpad 1",
"Numpad 2",
"Numpad 3",
"Numpad 4",
"Numpad 5",
"Numpad 6",
"Numpad 7",
"Numpad 8",
"Numpad 9",
"Multiply"
};
static int aimkey;
/*std::uintptr_t find_signature(const char* sig, const char* mask)
{
auto buffer = std::make_unique<std::array<std::uint8_t, 0x100000>>();
auto data = buffer.get()->data();
for (std::uintptr_t i = 0u; i < (2u << 25u); ++i)
{
driver->ReadProcessMemory(g_base_address + i * 0x100000, data, 0x100000);
if (!data)
return 0;
for (std::uintptr_t j = 0; j < 0x100000u; ++j)
{
if ([](std::uint8_t const* data, std::uint8_t const* sig, char const* mask)
{
for (; *mask; ++mask, ++data, ++sig)
{
if (*mask == 'x' && *data != *sig) return false;
}
return (*mask) == 0;
}(data + j, (std::uint8_t*)sig, mask))
{
std::uintptr_t result = g_base_address + i * 0x100000 + j;
std::uint32_t rel = 0;
driver->ReadProcessMemory(result + 3, &rel, sizeof(std::uint32_t));
if (!rel)
return 0;
return result + rel + 7;
}
}
}
return 0;
}*/
void AimLock(Vector3 Target) {
Vector3 ControlRotation = read<Vector3>(g_local_player_controller + offsets::control_rotation);
Vector3 Delta = Vector3((camera_position.x - Target.x), (camera_position.y - Target.y), (camera_position.z - Target.z));
float hyp = sqrtf(Delta.x * Delta.x + Delta.y * Delta.y + Delta.z * Delta.z);
Vector3 Rotation{};
Rotation.x = acosf(Delta.z / hyp) * (float)(RadianToURotation);
Rotation.y = atanf(Delta.y / Delta.x) * (float)(RadianToURotation);
Rotation.z = 0;
Rotation.x += 270.f;
if (Rotation.x > 360.f) {
Rotation.x -= 360.f;
}
if (Delta.x >= 0.0f) {
Rotation.y += 180.0f;
}
if (Rotation.y < 0.f) {
Rotation.y += 360.f;
}
boted_vex_screen.x = Rotation.x;
boted_vex_screen.y = Rotation.y;
}
inline Vector3 SmoothAim(Vector3 Camera_rotation, Vector3 Target, float SmoothFactor)
{
Vector3 diff = Target - Camera_rotation;
diff.normalize();
return Camera_rotation + diff / SmoothFactor;
}
void RCS(float SmoothFactor) {
Vector3 DeltaRotation = Vector3(0, 0, 0);
Vector3 ConvertRotation = Vector3(0, 0, 0);
Vector3 ControlRotation = read<Vector3>(g_local_player_controller + offsets::control_rotation);
// Camera 2 Control space
if (camera_rotation.x < 0.f) {
ConvertRotation.x = 360.f + camera_rotation.x;
}
else {
ConvertRotation.x = camera_rotation.x;
}
if (camera_rotation.y < 0.f) {
ConvertRotation.y = 360.f + camera_rotation.y;
}
else {
ConvertRotation.y = camera_rotation.y;
}
// Calculate recoil/aimpunch
DeltaRotation.x = ConvertRotation.x - ControlRotation.x;
DeltaRotation.y = ConvertRotation.y - ControlRotation.y;
// (-360, 360)
DeltaRotation.x = fmodf(DeltaRotation.x, 360.f);
DeltaRotation.y = fmodf(DeltaRotation.y, 360.f);
// Remove 2x aimpunch from CameraRotationD
ConvertRotation.x = boted_vex_screen.x - DeltaRotation.x - DeltaRotation.x;
ConvertRotation.y = boted_vex_screen.y - DeltaRotation.y - DeltaRotation.y;
// (-360, 360)
ConvertRotation.x = fmodf(ConvertRotation.x, 360.f);
ConvertRotation.y = fmodf(ConvertRotation.y, 360.f);
// [0, 360)
if (ConvertRotation.x < 0.f) {
ConvertRotation.x = 360.f + ConvertRotation.x;
}
if (ConvertRotation.y < 0.f) {
ConvertRotation.y = 360.f + ConvertRotation.y;
}
if (local_player_pawn != 0) {
write<Vector3>(g_local_player_controller + offsets::control_rotation, ConvertRotation);
}
}
inline void gg(Vector3 Target, Vector3 Camera_rotation, float SmoothFactor) {
// Camera 2 Control space
Vector3 ConvertRotation = Camera_rotation;
ConvertRotation.normalize();
// Calculate recoil/aimpunch
auto ControlRotation = read<Vector3>(g_local_player_controller + offsets::control_rotation);
Vector3 DeltaRotation = ConvertRotation - ControlRotation;
DeltaRotation.normalize();
// Remove aimpunch from CameraRotation
ConvertRotation = Target - (DeltaRotation * SmoothFactor);
ConvertRotation.normalize();
//Smooth the whole thing
Vector3 Smoothed = SmoothAim(Camera_rotation, ConvertRotation, SmoothFactor);
Smoothed -= (DeltaRotation / SmoothFactor);
write(g_local_player_controller + offsets::control_rotation, Smoothed);
}
typedef struct
{
DWORD R;
DWORD G;
DWORD B;
DWORD A;
}RGBA;
class Color
{
public:
RGBA red = { 255,0,0,255 };
RGBA Magenta = { 255,0,255,255 };
RGBA yellow = { 255,255,0,255 };
RGBA grayblue = { 128,128,255,255 };
RGBA green = { 128,224,0,255 };
RGBA darkgreen = { 0,224,128,255 };
RGBA brown = { 192,96,0,255 };
RGBA pink = { 255,168,255,255 };
RGBA DarkYellow = { 216,216,0,255 };
RGBA SilverWhite = { 236,236,236,255 };
RGBA purple = { 144,0,255,255 };
RGBA Navy = { 88,48,224,255 };
RGBA skyblue = { 0,136,255,255 };
RGBA graygreen = { 128,160,128,255 };
RGBA blue = { 0,96,192,255 };
RGBA orange = { 255,128,0,255 };
RGBA peachred = { 255,80,128,255 };
RGBA reds = { 255,128,192,255 };
RGBA darkgray = { 96,96,96,255 };
RGBA Navys = { 0,0,128,255 };
RGBA darkgreens = { 0,128,0,255 };
RGBA darkblue = { 0,128,128,255 };
RGBA redbrown = { 128,0,0,255 };
RGBA purplered = { 128,0,128,255 };
RGBA greens = { 0,255,0,255 };
RGBA envy = { 0,255,255,255 };
RGBA black = { 0,0,0,255 };
RGBA gray = { 128,128,128,255 };
RGBA white = { 255,255,255,255 };
RGBA blues = { 30,144,255,255 };
RGBA lightblue = { 135,206,250,160 };
RGBA Scarlet = { 220, 20, 60, 160 };
RGBA white_ = { 255,255,255,200 };
RGBA gray_ = { 128,128,128,200 };
RGBA black_ = { 0,0,0,200 };
RGBA red_ = { 255,0,0,200 };
RGBA Magenta_ = { 255,0,255,200 };
RGBA yellow_ = { 255,255,0,200 };
RGBA grayblue_ = { 128,128,255,200 };
RGBA green_ = { 128,224,0,200 };
RGBA darkgreen_ = { 0,224,128,200 };
RGBA brown_ = { 192,96,0,200 };
RGBA pink_ = { 255,168,255,200 };
RGBA darkyellow_ = { 216,216,0,200 };
RGBA silverwhite_ = { 236,236,236,200 };
RGBA purple_ = { 144,0,255,200 };
RGBA Blue_ = { 88,48,224,200 };
RGBA skyblue_ = { 0,136,255,200 };
RGBA graygreen_ = { 128,160,128,200 };
RGBA blue_ = { 0,96,192,200 };
RGBA orange_ = { 255,128,0,200 };
RGBA pinks_ = { 255,80,128,200 };
RGBA Fuhong_ = { 255,128,192,200 };
RGBA darkgray_ = { 96,96,96,200 };
RGBA Navy_ = { 0,0,128,200 };
RGBA darkgreens_ = { 0,128,0,200 };
RGBA darkblue_ = { 0,128,128,200 };
RGBA redbrown_ = { 128,0,0,200 };
RGBA purplered_ = { 128,0,128,200 };
RGBA greens_ = { 0,255,0,200 };
RGBA envy_ = { 0,255,255,200 };
RGBA glassblack = { 0, 0, 0, 160 };
RGBA GlassBlue = { 65,105,225,80 };
RGBA glassyellow = { 255,255,0,160 };
RGBA glass = { 200,200,200,60 };
RGBA Plum = { 221,160,221,160 };
};
Color Col;
ImU32 green = ImGui::ColorConvertFloat4ToU32(ImVec4(0, 224, 128, 200));
ImU32 half = ImGui::ColorConvertFloat4ToU32(ImVec4(255, 128, 0, 255));
ImU32 end = ImGui::ColorConvertFloat4ToU32(ImVec4(255, 0, 0, 255));
struct
{
bool ShowMenu = false;
bool FirstUse = false;
int MenuTab = 0;
float Width;
float Height;
struct
{
bool Enable = true;
bool DrawFOV = true;
bool prediction = true;
bool autofiretrigger = false;
bool ClosestByCrosshair = true;
bool ClosestByDistance = false;
bool AimPos_Head = true;
bool AimPos_Body = false;
float AimbotFOV = 100.0f;
float maxdist = 60.0f;
float smooth = 20;
float AimbotSmooth = 20.0f;
float AimbotMaximalDistance = 100.0f;
bool AimKey_RMB = true;
bool AimKey_SHIFT = false;
bool AimKey_DOWN = false;
int AimKey;
} Aimbot;
struct {
bool Boxes = true;
bool Corner = true;
bool filledboxes = false;
bool Skeletons = false;
bool Snaplines = true;
bool Distance = true;
bool HeadDot = false;
bool debug = false;
bool bone = false;
bool chest = false;
bool guntest1 = false;
bool guntest2 = false;
bool guntest3 = false;
bool guntest4 = false;
bool guntest5 = false;
bool guntest6 = false;
bool guntest7 = false;
bool guntest8 = false;
bool Nickname;
bool ActiveItemOrWeapon;
bool esppreview = true;
float EspMaximalDistance = 100.0f;
bool PlayerESP = true;
bool enabled = true;
} Visuals;
struct
{
bool FakeKeyboardSounds = false;
bool Crosshair = false;
bool WhiteCross = false;
float CrosshairX = 10.0f;
float CrosshairY = 10.0f;
float CrosshairThickness = 1.0f;
} Misc;
} Options;
namespace Settings {
namespace Selection {
bool Weapon_esp_player = false;
bool ps4controllermode = false;
bool bMouseAimbotEnabled = false, showhead = false, Crosshair = false, LineESP = true, DistanceESP = false, DrawFOV = false, AutoFire = false, Prediction = true, VisualName = false, Box = true;
int BoxMode = 2, distance, outline = false, hitbox = false, EspDistance = 200, AimbotDistance = 200;
float AimbotFOVValue = 127.0f, AimbotSmoothingValue = 1.989f;
}
float EspCircle;
namespace MajorValues {
uintptr_t LocalPlayer = 0, LocalPawn = 0, LocalPawnRootComponent = 0;
int LocalPlayerID = 0, CorrectbSpotted = 0;
bool menuIsOpen = false;
Vector3 LocalPlayerRelativeLocation = Vector3(0.0f, 0.0f, 0.0f);
float Width = GetSystemMetrics(SM_CXSCREEN), Height = GetSystemMetrics(SM_CYSCREEN), ScreenCenterX = 0.0f, ScreenCenterY = 0.0f;
}
}
std::string GetCharacterName(int id)
{
switch (id)
{
case 12831861: return "ASTRA";
break;
case 12839233: return "JETT";
break;
case 12821164: return "CHAMBER";
break;
case 12828461: return "KILLJOY";
break;
case 12819166: return "RAZE";
break;
case 12837583: return "REYNA";
break;
case 12836716: return "SAGE";
break;
case 12824834: return "SKYE";
break;
case 12834049: return "NEON";
break;
case 12829776: return "VIPER";
break;
case 12818573: return "BREACH";
break;
case 12833178: return "BRIMSTONE";
break;
case 12826043: return "CYPHER";
break;
case 12838374: return "OMEN";
break;
case 12830864: return "PHOENIX";
break;
case 12827255: return "SOVA";
break;
case 12835854: return "YORU";
break;
case 12823740: return "KAY/O";
break;
case 12837536: return "BOT";
break;
default:
return std::to_string(id);
break;
}
}
std::wstring s2ws(const std::string& str) {
int size_needed = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0);
std::wstring wstrTo(size_needed, 0);
MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &wstrTo[0], size_needed);
return wstrTo;
}
std::wstring MBytesToWString(const char* lpcszString)
{
int len = strlen(lpcszString);
int unicodeLen = ::MultiByteToWideChar(CP_ACP, 0, lpcszString, -1, NULL, 0);
wchar_t* pUnicode = new wchar_t[unicodeLen + 1];
memset(pUnicode, 0, (unicodeLen + 1) * sizeof(wchar_t));
::MultiByteToWideChar(CP_ACP, 0, lpcszString, -1, (LPWSTR)pUnicode, unicodeLen);
std::wstring wString = (wchar_t*)pUnicode;
delete[] pUnicode;
return wString;
}
std::string WStringToUTF8(const wchar_t* lpwcszWString)
{
char* pElementText;
int iTextLen = ::WideCharToMultiByte(CP_UTF8, 0, (LPWSTR)lpwcszWString, -1, NULL, 0, NULL, NULL);
pElementText = new char[iTextLen + 1];
memset((void*)pElementText, 0, (iTextLen + 1) * sizeof(char));
::WideCharToMultiByte(CP_UTF8, 0, (LPWSTR)lpwcszWString, -1, pElementText, iTextLen, NULL, NULL);
std::string strReturn(pElementText);
delete[] pElementText;
return strReturn;
}
void DrawString(float fontSize, int x, int y, RGBA* color, bool bCenter, bool stroke, const char* pText, ...)
{
va_list va_alist;
char buf[1024] = { 0 };
va_start(va_alist, pText);
_vsnprintf_s(buf, sizeof(buf), pText, va_alist);
va_end(va_alist);
std::string text = WStringToUTF8(MBytesToWString(buf).c_str());
if (bCenter)
{
ImVec2 textSize = ImGui::CalcTextSize(text.c_str());
x = x - textSize.x / 2;
y = y - textSize.y;
}
if (stroke)
{
ImGui::GetOverlayDrawList()->AddText(ImGui::GetFont(), fontSize, ImVec2(x + 1, y + 1), ImGui::ColorConvertFloat4ToU32(ImVec4(0, 0, 0, 1)), text.c_str());
ImGui::GetOverlayDrawList()->AddText(ImGui::GetFont(), fontSize, ImVec2(x - 1, y - 1), ImGui::ColorConvertFloat4ToU32(ImVec4(0, 0, 0, 1)), text.c_str());
ImGui::GetOverlayDrawList()->AddText(ImGui::GetFont(), fontSize, ImVec2(x + 1, y - 1), ImGui::ColorConvertFloat4ToU32(ImVec4(0, 0, 0, 1)), text.c_str());
ImGui::GetOverlayDrawList()->AddText(ImGui::GetFont(), fontSize, ImVec2(x - 1, y + 1), ImGui::ColorConvertFloat4ToU32(ImVec4(0, 0, 0, 1)), text.c_str());
}
ImGui::GetOverlayDrawList()->AddText(ImGui::GetFont(), fontSize, ImVec2(x, y), ImGui::ColorConvertFloat4ToU32(ImVec4(color->R / 255.0, color->G / 255.0, color->B / 255.0, color->A / 255.0)), text.c_str());
}
int noteypad() {
BYTE target_name[] = { 'n','o','t','e','p','a','d','.','e','x','e', 0};
std::wstring process_name = s2ws(std::string((char*)target_name));
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); // 0 to get all processes
PROCESSENTRY32W entry;
entry.dwSize = sizeof(entry);
if (!Process32First(snapshot, &entry)) {
return 0;
}
while (Process32Next(snapshot, &entry)) {
if (std::wstring(entry.szExeFile) == process_name) {
return entry.th32ProcessID;
}
}
return 0;
}
int retreiveValProcessId() {
BYTE target_name[] = { 'V','A','L','O','R','A','N','T','-','W','i','n','6','4','-','S','h','i','p','p','i','n','g','.','e','x','e', 0 };
std::wstring process_name = s2ws(std::string((char*)target_name));
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); // 0 to get all processes
PROCESSENTRY32W entry;
entry.dwSize = sizeof(entry);
if (!Process32First(snapshot, &entry)) {
return 0;
}
while (Process32Next(snapshot, &entry)) {
if (std::wstring(entry.szExeFile) == process_name) {
return entry.th32ProcessID;
}
}
return 0;
}
static void glfwErrorCallback(int error, const char* description)
{
}
void setupWindow() {
glfwSetErrorCallback(glfwErrorCallback);
if (!glfwInit()) {
return;
}
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
if (!monitor) {
fprintf(stderr, E("Error 7! Contact To Support\n"));
return;
}
g_width = glfwGetVideoMode(monitor)->width + 1;
g_height = glfwGetVideoMode(monitor)->height + 1;
glfwWindowHint(GLFW_FLOATING, true);
glfwWindowHint(GLFW_RESIZABLE, false);
glfwWindowHint(GLFW_MAXIMIZED, true);
glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, true);
g_window = glfwCreateWindow(g_width, g_height, E("Firefox"), NULL, NULL);
if (g_window == NULL) {
std::cout << E("Error 6! Contact To Support\n");
return;
}
glfwSetWindowAttrib(g_window, GLFW_DECORATED, false);
glfwSetWindowAttrib(g_window, GLFW_MOUSE_PASSTHROUGH, true);
glfwSetWindowMonitor(g_window, NULL, 0, 0, g_width, g_height, 0);
glfwMakeContextCurrent(g_window);
glfwSwapInterval(1); // Enable vsync
if (glewInit() != GLEW_OK)
{
fprintf(stderr, E("Error 5! Contacnt To Support\n"));
return;
}
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
ImGui::StyleColorsLight();
// Setup Platform/Renderer backends
ImGui_ImplGlfw_InitForOpenGL(g_window, true);
ImGui_ImplOpenGL3_Init(E("#version 130"));
ImFont* font = io.Fonts->AddFontFromFileTTF(E("Roboto-Light.ttf"), 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
IM_ASSERT(font != NULL);
}
void cleanupWindow() {
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
glfwDestroyWindow(g_window);
glfwTerminate();
}
BOOL CALLBACK retreiveValorantWindow(HWND hwnd, LPARAM lparam) {
DWORD process_id;
GetWindowThreadProcessId(hwnd, &process_id);
if (process_id == profetrol) {
valorant_window = hwnd;
}
return TRUE;
}
void activateValorantWindow() {
SetForegroundWindow(valorant_window);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
void handleKeyPresses() {
// Toggle overlay
if (GetAsyncKeyState(VK_INSERT) & 1) {
g_overlay_visible = !g_overlay_visible;
glfwSetWindowAttrib(g_window, GLFW_MOUSE_PASSTHROUGH, !g_overlay_visible);
if (g_overlay_visible) {
HWND overlay_window = glfwGetWin32Window(g_window);
SetForegroundWindow(overlay_window);
}
else {
activateValorantWindow();
}
}
}
uintptr_t decryptWorld(uintptr_t base_address) {
const auto key = read<uintptr_t>(base_address + offsets::uworld_key);
const auto state = read<State>(base_address + offsets::uworld_state);
const auto uworld_ptr = decrypt_uworld(key, (uintptr_t*)&state);
return read<uintptr_t>(uworld_ptr);
}
struct FText
{
char _padding_[0x28];
PWCHAR Name;
DWORD Length;
};
uintptr_t player_state;
/*inline Vector3 SmoothAim(Vector3 Camera_rotation, Vector3 Target, float SmoothFactor)
{
Vector3 diff = Target - Camera_rotation;
diff.Normalize();
return Camera_rotation + diff / SmoothFactor;
}*/
float matWorldView[4][4];
float matProj[4][4];
std::vector<Enemy> retreiveValidEnemies(uintptr_t actor_array, int actor_count) {
std::vector<Enemy> temp_enemy_collection{};
size_t size = sizeof(uintptr_t);
for (int i = 0; i < actor_count; i++) {
uintptr_t actor = read<uintptr_t>(actor_array + (i * size));
if (actor == 0x00) {
continue;
}
unique_id = read<uintptr_t>(actor + offsets::unique_id);
if (unique_id != 18743553) {
continue;
}
uintptr_t mesh = read<uintptr_t>(actor + offsets::mesh_component);
if (!mesh) {
continue;
}
player_state = read<uintptr_t>(actor + offsets::player_state);
uintptr_t team_component = read<uintptr_t>(player_state + offsets::team_component);
int team_id = read<int>(team_component + offsets::team_id);
int bone_count = read<int>(mesh + offsets::bone_count);
bool is_bot = bone_count == 103;
if (team_id == g_local_team_id && !is_bot) {
continue;
}
uintptr_t damage_handler = read<uintptr_t>(actor + offsets::damage_handler);
uintptr_t root_component = read<uintptr_t>(actor + offsets::root_component);
uintptr_t bone_array = read<uintptr_t>(mesh + offsets::bone_array);
Enemy enemy{
actor,
damage_handler,
player_state,
root_component,
mesh,
bone_array,
bone_count,
true
};
temp_enemy_collection.push_back(enemy);
}
return temp_enemy_collection;
}
void retreiveData() {
while (true) {
uintptr_t world = decryptWorld(g_base_address);
uintptr_t game_instance = read<uintptr_t>(world + offsets::game_instance);
uintptr_t persistent_level = read<uintptr_t>(world + offsets::persistent_level);
uintptr_t local_player_array = read<uintptr_t>(game_instance + offsets::local_player_array);
uintptr_t local_player = read<uintptr_t>(local_player_array);
uintptr_t local_player_controller = read<uintptr_t>(local_player + offsets::local_player_controller);
local_player_pawn = read<uintptr_t>(local_player_controller + offsets::local_player_pawn);
uintptr_t local_damage_handler = read<uintptr_t>(local_player_pawn + offsets::damage_handler);
uintptr_t local_player_state = read<uintptr_t>(local_player_pawn + offsets::player_state);
uintptr_t local_team_component = read<uintptr_t>(local_player_state + offsets::team_component);
int local_team_id = read<int>(local_team_component + offsets::team_id);
uintptr_t camera_manager = read<uintptr_t>(local_player_controller + offsets::camera_manager);
uintptr_t actor_array = read<uintptr_t>(persistent_level + offsets::actor_array);
int actor_count = read<int>(persistent_level + offsets::actor_count);
g_local_player_controller = local_player_controller;
g_local_player_pawn = local_player_pawn;
g_local_damage_handler = local_damage_handler;
g_camera_manager = camera_manager;
g_local_team_id = local_team_id;
enemy_collection = retreiveValidEnemies(actor_array, actor_count);
Sleep(2500);
}
}
Vector3 getBonePosition(Enemy enemy, int index) {
size_t size = sizeof(FTransform);
FTransform firstBone = read<FTransform>(enemy.bone_array_ptr + (size * index));
FTransform componentToWorld = read<FTransform>(enemy.mesh_ptr + offsets::component_to_world);
D3DMATRIX matrix = MatrixMultiplication(firstBone.ToMatrixWithScale(), componentToWorld.ToMatrixWithScale());
return Vector3(matrix._41, matrix._42, matrix._43);
}
Vector3 getBonePoswition(Enemy enemy, int index) {
size_t size = sizeof(FTransform);
FTransform firstBone = read<FTransform>(enemy.bone_array_ptr + (size * index));
FTransform componentToWorld = read<FTransform>(enemy.mesh_ptr + offsets::component_to_world);
D3DMATRIX matrix = MatrixMultiplication(firstBone.ToMatrixWithScale(), componentToWorld.ToMatrixWithScale());
return Vector3(matrix._41, matrix._42, matrix._43);
}
void renderBoneLine(Vector3 first_bone_position, Vector3 second_bone_position, Vector3 position, Vector3 rotation, float fov) {
Vector3 first_bone_screen_position = worldToScreen(first_bone_position, position, rotation, fov);
ImVec2 fist_screen_position = ImVec2(first_bone_screen_position.x, first_bone_screen_position.y);
Vector3 second_bone_screen_position = worldToScreen(second_bone_position, position, rotation, fov);
ImVec2 second_screen_position = ImVec2(second_bone_screen_position.x, second_bone_screen_position.y);
ImGui::GetOverlayDrawList()->AddLine(fist_screen_position, second_screen_position, g_color_white, 0.8f);
}
void DrawFilledRect(int x, int y, int w, int h, RGBA* color)
{
ImGui::GetOverlayDrawList()->AddRectFilled(ImVec2(x, y), ImVec2(x + w, y + h), ImGui::ColorConvertFloat4ToU32(ImVec4(color->R / 255.0, color->G / 255.0, color->B / 255.0, color->A / 255.0)), 0, 0);
}
void renderBones(Enemy enemy, Vector3 position, Vector3 rotation, float fov) {
Vector3 head_position = getBonePosition(enemy, 8);
Vector3 neck_position;
Vector3 chest_position = getBonePosition(enemy, 6);
Vector3 l_upper_arm_position;
Vector3 l_fore_arm_position;
Vector3 l_hand_position;
Vector3 r_upper_arm_position;
Vector3 r_fore_arm_position;
Vector3 r_hand_position;
Vector3 stomach_position = getBonePosition(enemy, 4);
Vector3 pelvis_position = getBonePosition(enemy, 3);
Vector3 l_thigh_position;
Vector3 l_knee_position;
Vector3 l_foot_position;
Vector3 r_thigh_position;
Vector3 r_knee_position;
Vector3 r_foot_position;
if (enemy.bone_count == 102) { // MALE
neck_position = getBonePosition(enemy, 19);
l_upper_arm_position = getBonePosition(enemy, 21);
l_fore_arm_position = getBonePosition(enemy, 22);
l_hand_position = getBonePosition(enemy, 23);
r_upper_arm_position = getBonePosition(enemy, 47);
r_fore_arm_position = getBonePosition(enemy, 48);
r_hand_position = getBonePosition(enemy, 49);
l_thigh_position = getBonePosition(enemy, 75);
l_knee_position = getBonePosition(enemy, 76);
l_foot_position = getBonePosition(enemy, 78);
r_thigh_position = getBonePosition(enemy, 82);
r_knee_position = getBonePosition(enemy, 83);
r_foot_position = getBonePosition(enemy, 85);
}
else if (enemy.bone_count == 99) { // FEMALE
neck_position = getBonePosition(enemy, 19);
l_upper_arm_position = getBonePosition(enemy, 21);
l_fore_arm_position = getBonePosition(enemy, 40);
l_hand_position = getBonePosition(enemy, 42);
r_upper_arm_position = getBonePosition(enemy, 46);
r_fore_arm_position = getBonePosition(enemy, 65);
r_hand_position = getBonePosition(enemy, 67);
l_thigh_position = getBonePosition(enemy, 78);
l_knee_position = getBonePosition(enemy, 75);
l_foot_position = getBonePosition(enemy, 77);
r_thigh_position = getBonePosition(enemy, 80);
r_knee_position = getBonePosition(enemy, 82);
r_foot_position = getBonePosition(enemy, 84);
}
else if (enemy.bone_count == 103) { // BOT
neck_position = getBonePosition(enemy, 9);
l_upper_arm_position = getBonePosition(enemy, 33);
l_fore_arm_position = getBonePosition(enemy, 30);
l_hand_position = getBonePosition(enemy, 32);
r_upper_arm_position = getBonePosition(enemy, 58);
r_fore_arm_position = getBonePosition(enemy, 55);
r_hand_position = getBonePosition(enemy, 57);
l_thigh_position = getBonePosition(enemy, 63);
l_knee_position = getBonePosition(enemy, 65);
l_foot_position = getBonePosition(enemy, 69);
r_thigh_position = getBonePosition(enemy, 77);
r_knee_position = getBonePosition(enemy, 79);
r_foot_position = getBonePosition(enemy, 83);
}
else {
return;
}
renderBoneLine(head_position, neck_position, position, rotation, fov);
renderBoneLine(neck_position, chest_position, position, rotation, fov);
renderBoneLine(neck_position, l_upper_arm_position, position, rotation, fov);
renderBoneLine(l_upper_arm_position, l_fore_arm_position, position, rotation, fov);
renderBoneLine(l_fore_arm_position, l_hand_position, position, rotation, fov);
renderBoneLine(neck_position, r_upper_arm_position, position, rotation, fov);
renderBoneLine(r_upper_arm_position, r_fore_arm_position, position, rotation, fov);
renderBoneLine(r_fore_arm_position, r_hand_position, position, rotation, fov);
renderBoneLine(chest_position, stomach_position, position, rotation, fov);
renderBoneLine(stomach_position, pelvis_position, position, rotation, fov);
renderBoneLine(pelvis_position, l_thigh_position, position, rotation, fov);
renderBoneLine(l_thigh_position, l_knee_position, position, rotation, fov);
renderBoneLine(l_knee_position, l_foot_position, position, rotation, fov);
renderBoneLine(pelvis_position, r_thigh_position, position, rotation, fov);
renderBoneLine(r_thigh_position, r_knee_position, position, rotation, fov);
renderBoneLine(r_knee_position, r_foot_position, position, rotation, fov);
}
boolean isInRectangle(double centerX, double centerY, double radius, double x, double y)
{
return x >= centerX - radius && x <= centerX + radius &&
y >= centerY - radius && y <= centerY + radius;
}
constexpr float SPEED_FREQ = 255 / 1.0f;
void renderBox(Vector3 head_at_screen, float distance_modifier) {
int head_x = head_at_screen.x;
int head_y = head_at_screen.y;
int start_x = head_x - 35 / distance_modifier;
int start_y = head_y - 15 / distance_modifier;
int end_x = head_x + 35 / distance_modifier;
int end_y = head_y + 155 / distance_modifier;
ImGui::GetOverlayDrawList()->AddRect(ImVec2(start_x, start_y), ImVec2(end_x, end_y), g_esp_color);
}