-
Notifications
You must be signed in to change notification settings - Fork 0
/
GalaxLighting.cpp
51 lines (40 loc) · 1.26 KB
/
GalaxLighting.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
/*
* GalaxLighting.cpp
* -------------------------
* Stavros Avramidis 1/17/2019
*/
#include "GalaxLighting.hpp"
/*
* TODO: manually start the XT+ service if not present
*/
GalaxLighting::GalaxLighting() : Window(NULL), procID(0) {
Window = FindWindow(NULL, "XtremeTuner Plus");
if (!Window) {
throw ("Window not found");
} else {
if (!GetWindowThreadProcessId(Window, &procID)) {
throw ("Get window process ID error: %i", GetLastError());
}
}
if (procID!=0)
hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procID);
if (!hProc) {
throw ("Can't open process: %i", GetLastError());
} else {
printf("Ready override XT+ values\n");
}
}
GalaxLighting::~GalaxLighting() = default;
void GalaxLighting::Apply() {
WriteProcessMemory(hProc, (BYTE*) RED_ADDRESS, (LPDWORD) &red, sizeof(DWORD), NULL);
WriteProcessMemory(hProc, (BYTE*) GREEN_ADDRESS, (LPDWORD) &green, sizeof(DWORD), NULL);
WriteProcessMemory(hProc, (BYTE*) BLUE_ADDRESS, (LPDWORD) &blue, sizeof(DWORD), NULL);
}
void GalaxLighting::SetColor(uint32_t r, uint32_t g, uint32_t b) {
red = r;
green = g;
blue = b;
}
uint32_t* GalaxLighting::Red() { return &red; }
uint32_t* GalaxLighting::Green() { return &green; }
uint32_t* GalaxLighting::Blue() { return &blue; }