-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhack_apex.cpp
54 lines (44 loc) · 1.51 KB
/
hack_apex.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
#include <BlackBone/DriverControl/DriverControl.h>
#include <optional>
using namespace blackbone;
void showMessageBox(const char* title, const char* text);
#include "hack_apex.hpp"
#include <thread>
#include <mutex>
#include <cassert>
int main_apexbot(DriverControl* driverctl, void* shared_ptr_overlay);
std::optional<DriverControl> driverctl;
std::atomic<bool> apexbot_running;
std::thread apexbot_thread;
uint32_t config_refresh_rate;
float config_overlay_propsurvival_radius;
bool config_unload_driver, config_aimbot, config_aimbot_teammates, config_highlight, config_highlight_teammates, config_display_overlay;
bool hack_apex(void* shared_ptr_overlay) {
if (!driverctl)
driverctl.emplace();
if (!NT_SUCCESS(driverctl->EnsureLoaded(L""))) {
showMessageBox("Error", "Failed to load driver!");
}
apexbot_running = true;
if (!apexbot_thread.joinable())
apexbot_thread = std::move(std::thread(main_apexbot, &*driverctl, shared_ptr_overlay));
else
showMessageBox("Info", "Already running");
return true;
}
bool deinit_hack_apex() {
// Stop apexbot background worker
apexbot_running = false;
if (apexbot_thread.joinable())
apexbot_thread.join();
// Unload kernel module
if (driverctl && config_unload_driver) {
if (!NT_SUCCESS(driverctl->Unload())) {
showMessageBox("Error", "Failed to unload driver!");
} else {
showMessageBox("Ok", "Driver unloaded!");
}
driverctl.reset();
}
return true;
}