-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
84 lines (62 loc) · 1.87 KB
/
main.cpp
File metadata and controls
84 lines (62 loc) · 1.87 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
#include "wallhack.h"
#include <iostream>
#include <string>
#include <utility>
#define KEY_PRESSED 0x8000
#define MAIN_LOOP_DELAY 70
#define FLASHING_WH_TOGGLING_DELAY 30
using namespace std;
class KeyboardKey {
private:
string name;
DWORD value;
public:
KeyboardKey(const string name, const DWORD value)
: name(name), value(value) { }
string getName() const {
return name;
}
DWORD getValue() const {
return value;
}
};
const string NAME = "WallCSS";
const string GAME_WINDOW_NAME = "Counter-Strike Source";
const KeyboardKey TOGGLE_WH_KEY("Insert", VK_INSERT);
const KeyboardKey TOGGLE_FLASHING_WH_KEY("Home", VK_HOME);
Wallhack wallhack(GAME_WINDOW_NAME);
bool isKeyPressed(DWORD key) {
return GetKeyState(key) & KEY_PRESSED;
}
void loop() {
while (wallhack.isAvailable()) {
try {
if (isKeyPressed(TOGGLE_WH_KEY.getValue())) {
wallhack.toggle();
}
if (isKeyPressed(TOGGLE_FLASHING_WH_KEY.getValue())) {
wallhack.toggleFlashing();
}
if (wallhack.isFlashing()) {
wallhack.toggle();
Sleep(FLASHING_WH_TOGGLING_DELAY);
}
} catch (const MemAccessException& e) {
cout << e.what();
} catch (const exception& e) {
cout << e.what();
break;
}
Sleep(MAIN_LOOP_DELAY);
}
}
int main() {
SetConsoleTitle(NAME.c_str());
cout << "Waiting for \"" << GAME_WINDOW_NAME << "\" ..." << "\n";
while (!wallhack.isAvailable()) wallhack.init();
cout << "Detected!" << "\n\n";
cout << "To toggle wallhack go to game and press \"" << TOGGLE_WH_KEY.getName() << "\"" << "\n";
cout << "To toggle flashing wallhack go to game and press \"" << TOGGLE_FLASHING_WH_KEY.getName() << "\"" << "\n";
loop();
return 0;
}