-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.cpp
More file actions
410 lines (324 loc) · 13 KB
/
menu.cpp
File metadata and controls
410 lines (324 loc) · 13 KB
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
#include "menu.h"
#include "imguipp_v2.h"
#include "globals.h"
#include <shellapi.h>
#include <thread>
void getUserInfoAsync() {
std::this_thread::sleep_for(std::chrono::minutes(2));
if (!globals::api.getUserInfo()) {
//create message box
MessageBoxA(NULL, "Failed to get user info", "Error", MB_OK);
//close program
globals::active = false;
globals::loggedIn = false;
ExitProcess(0);
}
if (!globals::api.checkLoaderVersion("loader")) {
//create message box
MessageBoxA(NULL, "Please update your loader", "Error", MB_OK);
//close program
globals::active = false;
globals::loggedIn = false;
ExitProcess(0);
}
}
void Menu::Render()
{
static ImVec4 active = ImGuiPP::ToVec4(219, 190, 0, 255);
static ImVec4 inactive = ImGuiPP::ToVec4(255, 255,255, 255);
if (globals::loggedIn) {
//login page
ImGui::BeginChild("##LeftSide", ImVec2(200, ImGui::GetContentRegionAvail().y), TRUE);
{
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 75);
ImGui::PushStyleColor(ImGuiCol_Text, globals::menuTab == 0 ? active : inactive);
ImGuiPP::CenterTextEx(ICON_FA_STAR, 205, 0, 0);
if (ImGui::IsItemClicked()) globals::menuTab = 0;
ImGui::NewLine();
ImGui::PushStyleColor(ImGuiCol_Text, globals::menuTab == 1 ? active : inactive);
ImGuiPP::CenterTextEx(ICON_FA_DATABASE, 205, 0, 0);
if (ImGui::IsItemClicked()) globals::menuTab = 1;
/*ImGui::NewLine();
ImGui::PushStyleColor(ImGuiCol_Text, globals::menuTab == 2 ? active : inactive);
ImGuiPP::CenterTextEx(ICON_FA_COGS, 205, 0, 0);
if (ImGui::IsItemClicked()) globals::menuTab = 2;*/
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 255, 255));
ImGui::NewLine();
ImGuiPP::CenterTextEx(ICON_FA_TIMES_CIRCLE, 205, 0, 0);
if (ImGui::IsItemClicked()) ExitProcess(0);
ImGui::PopStyleColor(3);
}
ImGui::EndChild();
ImGuiPP::Linevertical();
{
ImGui::PushStyleColor(ImGuiCol_ChildBg, IM_COL32(0, 0, 0, 0));
ImGui::BeginChild("##RightSide", ImVec2(ImGuiPP::GetX(), ImGuiPP::GetY()), TRUE);
ImGui::PopStyleColor();
{
switch (globals::menuTab)
{
case 0:
ImGuiPP::CenterText("G0 K3RN3L", 1, TRUE);
ImGui::NewLine();
ImGui::TextColored(ImColor(220, 190, 0, 255), ("Version: " + globals::version).c_str());
ImGui::Text("Contact: discord.gg/bY265FD7wK");
ImGui::NewLine();
ImGui::Separator();
{
ImGui::Text("Activate License:");
ImGui::PushItemWidth(ImGuiPP::GetX());
ImGui::InputText("##License", globals::inputkey, sizeof(globals::inputkey));
}
ImGui::NewLine();
if (ImGui::Button("Activate", ImVec2(ImGuiPP::GetX(), 33)))
{
if (globals::api.redeemKey(globals::inputkey)) {
MessageBoxA(NULL, "Activation successful", "Success", MB_OK);
globals::api.getUserInfo();
memset(globals::inputkey, 0, sizeof(globals::inputkey));
}
else
MessageBoxA(NULL, "Activation failed", "Error", MB_OK);
}
ImGui::NewLine();
break;
case 1:
if (globals::products.size() > 0) {
ImGui::ListBoxHeader("##GamesChoice", ImVec2(ImGuiPP::GetX(), ImGuiPP::GetY() - 36.5));
ImGui::Columns(1, NULL, false);
for (int i = 0; i < globals::products.size(); i++)
{
//create 2x2 grid
if (i % 2 == 0) {
ImGui::Separator();
}
//display name
ImGui::Text(("Product: " + globals::products[globals::gameIndex].getName()).c_str());
//display status
ImGui::Text(("Status: " + globals::products[globals::gameIndex].getStatus()).c_str());
ImGui::Text(("Valid Until: " + globals::products[globals::gameIndex].getExpirationDate()).c_str());
//display button
if (!globals::downloadInProgress) {
if (ImGui::Button(("INJECT TO " + globals::products[globals::gameIndex].getName()).c_str(), ImVec2(ImGuiPP::GetX(), 33)))
{
if (globals::api.validateProduct(globals::products[globals::gameIndex].getId())) {
globals::downloadInProgress = true;
std::thread downloadThread([&]() {
while (globals::downloadProgress < 1.0f) {
globals::downloadProgress = globals::downloadProgress + 0.01f;
Sleep(1250);
}
if (!globals::api.downloadFile(globals::products[globals::gameIndex].getId(), 0)) {
MessageBoxA(NULL, "Download failed.", "Error", MB_OK);
}
globals::downloadInProgress = false;
globals::downloadProgress = 0.0f;
});
downloadThread.detach();
}
else {
//create message box
MessageBoxA(NULL, "Failed to validate product.", "Error", MB_OK);
//close program
ExitProcess(0);
}
}
}
if (globals::downloadInProgress) {
ImGui::NewLine();
ImGui::Text("Creating custom build before downloading.");
ImGui::Text("This may take a while.");
ImGui::ProgressBar(globals::downloadProgress, ImVec2(ImGuiPP::GetX(), 33));
// Add your animation code here
}
ImGui::NextColumn();
}
ImGui::Columns(1);
ImGui::Separator();
ImGui::ListBoxFooter();
ImGui::Button("Refresh Licenses", ImVec2(ImGuiPP::GetX(), 33));
if (ImGui::IsItemClicked()) {
if (!globals::api.getUserInfo()) {
MessageBoxA(NULL, "Failed to get user info.", "Error", MB_OK);
ExitProcess(0);
}
}
}
else{
ImGui::Text("No Active License Found");
}
break;
case 2:
/*ImGui::PushStyleVar(ImGuiStyleVar_Frameglobals::padding, ImVec2(5, 5));
ImGui::Checkbox("Safe Injection", &G->SafeInjection);
HELPMARKER("Safe Injection Will Make Sure Everything injected is timed correctly.");
ImGui::Checkbox("Block reports", &G->Blockreports);
HELPMARKER("Block reports will block any reports of your game crashing to the developers.");
ImGui::Checkbox("Automatic Injection", &G->AutoInject);
HELPMARKER("Automatic Injection will automatically wait for your game to load then inject.");
ImGui::PopStyleVar();*/
break;
}
}
ImGui::EndChild();
}
}
else{
ImGui::BeginChild("##LeftSide", ImVec2(200, ImGui::GetContentRegionAvail().y), TRUE);
{
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 75);
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 255, 255));
ImGui::NewLine();
ImGuiPP::CenterTextEx(ICON_FA_QUESTION_CIRCLE, 205, 0, 0);
if (ImGui::IsItemClicked()) ShellExecute(0, 0, L"https://discord.gg/bY265FD7wK", 0, 0, SW_SHOW);
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 255, 255));
ImGui::NewLine();
ImGuiPP::CenterTextEx(ICON_FA_TIMES_CIRCLE, 205, 0, 0);
if (ImGui::IsItemClicked()) ExitProcess(0);
ImGui::PopStyleColor(2);
}
ImGui::EndChild();
ImGuiPP::Linevertical();
{
ImGui::PushStyleColor(ImGuiCol_ChildBg, IM_COL32(0, 0, 0, 0));
ImGui::BeginChild("##RightSide", ImVec2(ImGuiPP::GetX(), ImGuiPP::GetY()), TRUE);
ImGui::PopStyleColor();
{
switch (globals::menuTab) {
case 3:
{
ImGui::SetCursorPosX((ImGui::GetWindowWidth() - ImGui::CalcTextSize("Welcome Back").x) / 2);
ImGui::TextDisabled("Welcome Back");
ImGui::SetCursorPosX((ImGui::GetWindowWidth() - ImGui::CalcTextSize("Log into your account").x) / 2);
ImGui::Text("Log into your account");
ImGui::PushItemWidth(globals::window_size.x / 2);
{
ImGui::SetCursorPos(ImVec2(globals::padding * 2, globals::padding * 9));
ImGui::Text("Username");
ImGui::SetCursorPos(ImVec2(globals::padding * 2, globals::padding * 11));
ImGui::InputText("##Username", globals::inputusername, sizeof(globals::inputusername));
}
ImGui::PushItemWidth(globals::window_size.x / 2);
{
ImGui::SetCursorPos(ImVec2(globals::padding * 2, globals::padding * 15));
ImGui::Text("Password");
ImGui::SetCursorPos(ImVec2(globals::padding * 2, globals::padding * 17));
ImGui::InputText("##Password", globals::inputpassword, sizeof(globals::inputpassword), ImGuiInputTextFlags_Password);
}
ImGui::SetCursorPos(ImVec2(globals::padding * 2, globals::padding * 21));
if (ImGui::Button("Login", ImVec2(globals::window_size.x / 2, 30.f)))
{
if (strlen(globals::inputusername) < 3 || strlen(globals::inputpassword) < 3) {
MessageBoxA(NULL, "Please enter a valid username and password.", "Error", MB_OK | MB_ICONERROR);
}
else {
if (globals::api.login(globals::inputusername, globals::inputpassword, globals::hwid)==0) {
if (globals::api.getUserInfo()) {
//clear inputs
memset(globals::inputusername, 0, sizeof(globals::inputusername));
memset(globals::inputpassword, 0, sizeof(globals::inputpassword));
//create thread for updating user info
std::thread(getUserInfoAsync).detach();
globals::menuTab = 0;
globals::loggedIn = true;
globals::active = false;
}
else {
MessageBoxA(NULL, "Failed to get user info.", "Error", MB_OK | MB_ICONERROR);
}
}
else {
MessageBoxA(NULL, "Invalid credentials or HWID.", "Error", MB_OK | MB_ICONERROR);
}
}
}
ImGui::SetCursorPos(ImVec2(globals::padding * 2, globals::padding * 25));
if (ImGui::Button("Register", ImVec2(globals::window_size.x / 2, 30.f)))
{
globals::menuTab = 4;
}
break;
}
case 4:
{
ImGui::Spacing();
ImGui::SetCursorPosX((ImGui::GetWindowWidth() - ImGui::CalcTextSize("Register For An Account").x) / 2);
ImGui::Text("Register For An Account");
ImGui::Spacing();
ImGui::PushItemWidth(globals::window_size.x / 2);
{
ImGui::SetCursorPos(ImVec2(globals::padding * 2, globals::padding * 9));
ImGui::Text("Username");
ImGui::SetCursorPos(ImVec2(globals::padding * 2, globals::padding * 11));
ImGui::InputText("##Username", globals::inputusername, sizeof(globals::inputusername));
}
{
ImGui::SetCursorPos(ImVec2(globals::padding * 2, globals::padding * 15));
ImGui::Text("Email");
ImGui::SetCursorPos(ImVec2(globals::padding * 2, globals::padding * 17));
ImGui::InputText("##Email", globals::inputmail, sizeof(globals::inputmail));
}
{
ImGui::SetCursorPos(ImVec2(globals::padding * 2, globals::padding * 21));
ImGui::Text("Password");
ImGui::SetCursorPos(ImVec2(globals::padding * 2, globals::padding * 23));
ImGui::InputText("##Password", globals::inputpassword, sizeof(globals::inputpassword), ImGuiInputTextFlags_Password);
}
ImGui::PopItemWidth();
ImGui::SetCursorPos(ImVec2(globals::padding * 2, globals::padding * 27));
if (ImGui::Button("Register", ImVec2(globals::window_size.x / 2, 30.f)))
{
if (globals::api.signup(globals::inputusername, globals::inputpassword, globals::inputmail, globals::hwid)) {
MessageBoxA(NULL, "Account created successfully.", "Success", MB_OK | MB_ICONINFORMATION);
globals::menuTab = 3;
}
else {
MessageBoxA(NULL, "Account creation failed.", "Error", MB_OK | MB_ICONERROR);
}
}
ImGui::Spacing();
ImGui::SetCursorPos(ImVec2(globals::padding * 2, globals::padding * 31));
if (ImGui::Selectable("Already have an account? Login.", false, ImGuiSelectableFlags_None)) {
globals::menuTab = 3;
}
}
}
}
ImGui::EndChild();
}
}
}
void Menu::Theme()
{
ImGuiStyle& Style = ImGui::GetStyle();
auto Color = Style.Colors;
Style.WindowMinSize = ImVec2(600, 600);
Style.WindowBorderSize = 0;
Style.ChildRounding = 0;
Style.FrameRounding = 0;
Style.ScrollbarRounding = 0;
Style.GrabRounding = 0;
Style.PopupRounding = 0;
Style.WindowRounding = 3;
Color[ImGuiCol_WindowBg] = ImColor(18, 18, 18, 255);
Color[ImGuiCol_FrameBg] = ImColor(31, 31, 31, 255);
Color[ImGuiCol_FrameBgActive] = ImColor(41, 41, 41, 255);
Color[ImGuiCol_FrameBgHovered] = ImColor(41, 41, 41, 255);
Color[ImGuiCol_Button] = ImColor(168, 50, 133);
Color[ImGuiCol_ButtonActive] = ImColor(168, 50, 133);
Color[ImGuiCol_ButtonHovered] = ImColor(168, 50, 133);
Color[ImGuiCol_Border] = ImColor(0, 0, 0, 0);
Color[ImGuiCol_Separator] = ImColor(36, 36, 36, 255);
Color[ImGuiCol_ResizeGrip] = ImColor(30, 30, 30, 255);
Color[ImGuiCol_ResizeGripActive] = ImColor(30, 30, 30, 255);
Color[ImGuiCol_ResizeGripHovered] = ImColor(30, 30, 30, 255);
Color[ImGuiCol_ChildBg] = ImColor(26, 26, 26, 255);
Color[ImGuiCol_ScrollbarBg] = ImColor(24, 24, 24, 255);
Color[ImGuiCol_ScrollbarGrab] = ImColor(24, 24, 24, 255);
Color[ImGuiCol_ScrollbarGrabActive] = ImColor(24, 24, 24, 255);
Color[ImGuiCol_ScrollbarGrabActive] = ImColor(24, 24, 24, 255);
Color[ImGuiCol_Header] = ImColor(39, 39, 39, 255);
Color[ImGuiCol_HeaderActive] = ImColor(39, 39, 39, 255);
Color[ImGuiCol_HeaderHovered] = ImColor(39, 39, 39, 255);
Color[ImGuiCol_CheckMark] = ImColor(255, 255, 255, 255);
}