forked from Giteob/Apple-Lite-Fortnite-Cheat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
keybind.h
177 lines (168 loc) · 2.45 KB
/
keybind.h
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
#include <WinUser.h>
#include <string>
#include <string.h>
#include <processthreadsapi.h>
#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR)))
namespace hotkeys
{
int aimkey;
int airstuckey;
}
static int keystatus = 0;
static int realkey = 0;
bool GetKey(int key)
{
realkey = key;
return true;
}
void ChangeKey(void* blank)
{
keystatus = 1;
while (true)
{
for (int i = 0; i < 0x87; i++)
{
if (GetKeyState(i) & 0x8000)
{
hotkeys::aimkey = i;
keystatus = 0;
return;
}
}
}
}
static const char* keyNames[] =
{
"No Key Selected",
"Left Mouse",
"Right Mouse",
"Cancel",
"Middle Mouse",
"Mouse 5",
"Mouse 4",
"No Key Selected",
"Backspace",
"Tab",
"No Key Selected",
"Clear",
"Enter",
"No Key Selected",
"Shift",
"Control",
"Alt",
"Pause",
"Caps",
"No Key Selected",
"Escape",
"No Key Selected",
"Space",
"Page Up",
"Page Down",
"End",
"Home",
"Left",
"Up",
"Right",
"Down",
"No Key Selected",
"Print",
"Insert",
"Delete",
"No Key Selected",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"No Key Selected",
"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",
"No Key Selected",
"No Key Selected",
"Numpad 0",
"Numpad 1",
"Numpad 2",
"Numpad 3",
"Numpad 4",
"Numpad 5",
"Numpad 6",
"Numpad 7",
"Numpad 8",
"Numpad 9",
"Multiply",
"Add",
"No Key Selected",
"Subtract",
"Decimal",
"Divide",
"F1",
"F2",
"F3",
"F4",
"F5",
"F6",
"F7",
"F8",
"F9",
"F10",
"F11",
"F12",
};
static bool Items_ArrayGetter(void* data, int idx, const char** out_text)
{
const char* const* items = (const char* const*)data;
if (out_text)
*out_text = items[idx];
return true;
}
void HotkeyButton(int aimkey, void* changekey, int status)
{
const char* preview_value = NULL;
if (aimkey >= 0 && aimkey < IM_ARRAYSIZE(keyNames))
Items_ArrayGetter(keyNames, aimkey, &preview_value);
std::string aimkeys;
if (preview_value == NULL)
aimkeys = "Select Key";
else
aimkeys = preview_value;
if (status == 1)
{
aimkeys = "Press the key";
}
if (ImGui::Button(aimkeys.c_str(), ImVec2(125, 20)))
{
if (status == 0)
{
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)changekey, nullptr, 0, nullptr);
}
}
}