-
Notifications
You must be signed in to change notification settings - Fork 3
/
Config.h
178 lines (152 loc) · 5.07 KB
/
Config.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
178
#include <Windows.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <fstream>
#include <shlobj.h>
#include "Settings.h"
using namespace g_Settings;
void Keys();
class Config
{
public:
Config(std::string name)
{
TCHAR path[MAX_PATH];
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_DOCUMENTS, NULL, 0, path)))
{
std::string PathToFile = std::string(path) + "\\" + name;
this->path = PathToFile; //Set path to cfg file
this->input = std::ifstream(this->path); //open input
}
}
void open()
{
this->outputstream = std::ofstream(this->path); //open output for config writing
}
void close()
{
this->outputstream.close(); //close output after writing config
}
template <typename tp>
tp set(std::string name, tp value) {
outputstream << name << " " << value << std::endl; //Write to config
return true;
}
template <class tg>
tg get(std::string name) {
this->input.close(); //Close Input
this->input = std::ifstream(this->path); //Jump back to idx 0 of txt file
std::vector<std::string>stack;
std::string buffer;
while (this->input >> buffer) {
stack.push_back(buffer); //push all options into vector
}
for (int i = 0; i < stack.size(); i++) {
if (stack.at(i) == name) {
return atof(stack.at(i + 1).c_str()); //if option found get value from idx + 1
}
}
}
private:
std::string path;
std::ifstream input;
std::ofstream outputstream;
};
void static SetConfig(Config* config)
{
config->open();
config->set<bool>("bOutline", bOutline);
config->set<bool>("bTeam", bTeam);
config->set<bool>("bChams", bChams);
config->set<bool>("bCavEsp", bCavEsp);
config->set<bool>("bOutline", bOutline);
config->set<bool>("bTeam", bTeam);
config->set<bool>("bChams", bChams);
config->set<bool>("bCavEsp", bCavEsp);
config->set<int>("iAimSelection", iAimSelection);
config->set<int>("iAimBone", iAimBone);
config->set<int>("iAimKey2", iAimKey2);
config->set<int>("iAimKey", iAimKey);
config->set<int>("iSilentKey", iSilentKey);
config->set<bool>("bAimbot", bAimbot);
config->set<int>("iAimFov", iAimFov);
config->set<bool>("bSmoothing", bSmoothing);
config->set<bool>("bSilent", bSilent);
config->set<float>("iSmoothing", iSmoothing);
config->set<bool>("bRunShoot", bRunShoot);
config->set<bool>("bDamage", bDamage);
config->set<bool>("bNoRecoil", bNoRecoil);
config->set<bool>("bSpread", bSpread);
config->set<bool>("bUnlockAll", bUnlockAll);
config->set<bool>("bColor", bColor);
config->set<int>("iNoClip", iNoClip);
config->set<bool>("bNoClip", bNoClip);
config->set<bool>("bWepFov", bWepFov);
config->set<bool>("bPlayerFov", bPlayerFov);
config->set<bool>("bSpeed", bSpeed);
config->set<bool>("bNoFlash", bNoFlash);
config->set<float>("fSpread", fSpread);
config->set<float>("fWepFov", fWepFov);
config->set<float>("fPlayerFov", fPlayerFov);
config->set<float>("fValue", fValue);
config->set<int>("iSpeed", iSpeed);
config->set<int>("iBullet", iBullet);
config->set<float>("fBullet", fBullet);
config->set<float>("fChamsR", fChamsR);
config->set<float>("fChamsG", fChamsG);
config->set<float>("fChamsB", fChamsB);
config->set<float>("fChamsOpp", fChamsOpp);
config->set<float>("fOpp", fOpp);
config->close();
}
void static ReadConfig(Config* config)
{
bOutline = config->get<bool>("bOutline");
bTeam = config->get<bool>("bTeam");
bChams = config->get<bool>("bChams");
bCavEsp = config->get<bool>("bCavEsp");
bOutline = config->get<bool>("bOutline");
bTeam = config->get<bool>("bTeam");
bChams = config->get<bool>("bChams");
bCavEsp = config->get<bool>("bCavEsp");
iAimSelection = config->get<int>("iAimSelection");
iAimBone = config->get<int>("iAimBone");
iAimKey2 = config->get<int>("iAimKey2");
iAimKey = config->get<int>("iAimKey");
iSilentKey = config->get<int>("iSilentKey");
bAimbot = config->get<bool>("bAimbot");
iAimFov = config->get<int>("iAimFov");
bSmoothing = config->get<bool>("bSmoothing");
bSilent = config->get<bool>("bSilent");
iSmoothing = config->get<float>("iSmoothing");
bRunShoot = config->get<bool>("bRunShoot");
bDamage = config->get<bool>("bDamage");
bNoRecoil = config->get<bool>("bNoRecoil");
bSpread = config->get<bool>("bSpread");
bUnlockAll = config->get<bool>("bUnlockAll");
bColor = config->get<bool>("bColor");
iNoClip = config->get<int>("iNoClip");
bNoClip = config->get<bool>("bNoClip");
bWepFov = config->get<bool>("bWepFov");
bPlayerFov = config->get<bool>("bPlayerFov");
bSpeed = config->get<bool>("bSpeed");
bNoFlash = config->get<bool>("bNoFlash");
fSpread = config->get<float>("fSpread");
fWepFov = config->get<float>("fWepFov");
fPlayerFov = config->get<float>("fPlayerFov");
fValue = config->get<int>("fValue");
iSpeed = config->get<int>("iSpeed");
iBullet = config->get<int>("iBullet");
fBullet = config->get<float>("fBullet");
fChamsR = config->get<float>("fChamsR");
fChamsG = config->get<float>("fChamsG");
fChamsB = config->get<float>("fChamsB");
fChamsOpp = config->get<float>("fChamsOpp");
fOpp = config->get<float>("fOpp");
g_Settings::bUpdateSettings = true;
}
extern Config* DefualtCfg;
extern Config* LegitCfg;
extern Config* RageCfg;