This repository has been archived by the owner on Nov 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathpch.h
79 lines (66 loc) · 1.68 KB
/
pch.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
#ifndef PCH_H
#define PCH_H
// add headers that you want to pre-compile here
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <filesystem>
#include <unistd.h>
#include <cstring>
#include <string.h>
#include <thread>
#include <vector>
#include <mutex>
#include <chrono>
#include <algorithm>
#include <math.h>
#include <stdlib.h>
#include "../includes/json.hpp"
#include "../includes/vmmdll.h"
#include "../includes/easywsclient.hpp"
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/ioctl.h>
// credits tni & learn_more (www.unknowncheats.me/forum/3868338-post34.html)
#define INRANGE(x,a,b) (x >= a && x <= b)
#define getBits( x ) (INRANGE(x,'0','9') ? (x - '0') : ((x&(~0x20)) - 'A' + 0xa))
#define get_byte( x ) (getBits(x[0]) << 4 | getBits(x[1]))
template <typename Ty>
std::vector<Ty> bytes_to_vec(const std::string& bytes)
{
const auto num_bytes = bytes.size() / 3;
const auto num_elements = num_bytes / sizeof(Ty);
std::vector<Ty> vec;
vec.resize(num_elements + 1);
const char* p1 = bytes.c_str();
uint8_t* p2 = reinterpret_cast<uint8_t*>(vec.data());
while (*p1 != '\0')
{
if (*p1 == ' ')
{
++p1;
}
else
{
*p2++ = get_byte(p1);
p1 += 2;
}
}
return vec;
}
#define DEBUG_INFO
#ifdef DEBUG_INFO
#define LOG(fmt, ...) std::printf(fmt, ##__VA_ARGS__)
#define LOGW(fmt, ...) std::wprintf(fmt, ##__VA_ARGS__)
#else
#define LOG
#define LOGW
#endif
#define THROW_EXCEPTION
#ifdef THROW_EXCEPTION
#define THROW(fmt, ...) throw std::runtime_error(fmt, ##__VA_ARGS__)
#endif
#endif //PCH_H