Skip to content

Commit

Permalink
Bugged config system (dont install)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fr0go1 committed Oct 25, 2023
1 parent 8517014 commit e00487b
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 138 deletions.
2 changes: 2 additions & 0 deletions CS2_External/MenuConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace MenuConfig
{
inline std::string path = "";

inline bool ShowBoneESP = true;
inline bool ShowBoxESP = true;
inline bool ShowHealthBar = true;
Expand Down
17 changes: 3 additions & 14 deletions CS2_External/Utils/ConfigMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,11 @@ namespace ConfigMenu {

static int selectedConfig = -1;

TCHAR documentsPath[MAX_PATH];
if (SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, 0, documentsPath) != S_OK) {
return;
}

char narrowPath[MAX_PATH];
if (WideCharToMultiByte(CP_UTF8, 0, documentsPath, -1, narrowPath, sizeof(narrowPath), NULL, NULL) == 0) {
return;
}

std::string documentsDir(narrowPath);
std::string configFilePath = documentsDir + "\\.Aeonix\\";
const std::string configFilePath = MenuConfig::path;
static std::vector<std::string> configFiles;

configFiles.clear();
for (const auto& entry : std::filesystem::directory_iterator(configFilePath))
for (const auto& entry : std::filesystem::directory_iterator(MenuConfig::path))
{
if (entry.is_regular_file() && entry.path().extension() == ".config")
{
Expand Down Expand Up @@ -102,7 +91,7 @@ namespace ConfigMenu {
if (ImGui::Button("Yes", { 45.0f, 0.0f }))
{
std::string selectedConfigFile = configFiles[selectedConfig];
std::string fullPath = configFilePath + "/" + selectedConfigFile;
std::string fullPath = MenuConfig::path + "\\" + selectedConfigFile;
if (std::remove(fullPath.c_str()) == 0)
{
configFiles.erase(configFiles.begin() + selectedConfig);
Expand Down
1 change: 0 additions & 1 deletion CS2_External/Utils/ConfigMenu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
namespace ConfigMenu {
void RenderConfigMenu();
void ResetToDefault();
// Define other configuration-related functions and variables here.
}
189 changes: 81 additions & 108 deletions CS2_External/Utils/ConfigSaver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,11 @@

namespace MyConfigSaver {

// Function to save the configuration to a file
void SaveConfig(const std::string& filename) {
TCHAR documentsPath[MAX_PATH];
if (SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, 0, documentsPath) != S_OK) {
std::cerr << "Error: Could not retrieve the Documents directory path." << std::endl;
return;
}

char narrowPath[MAX_PATH];
if (WideCharToMultiByte(CP_UTF8, 0, documentsPath, -1, narrowPath, sizeof(narrowPath), NULL, NULL) == 0) {
std::cerr << "Error: Could not convert wide character path to narrow character path." << std::endl;
return;
}

std::string documentsDir(narrowPath);
std::string configFilePath = documentsDir + "\\.Aeonix\\" + filename;

std::ofstream configFile(configFilePath);
std::ofstream configFile(MenuConfig::path + '\\' + filename);
if (!configFile.is_open()) {
std::cerr << "Error: Could not open the configuration file." << std::endl;
std::cerr << "[Error] Could not open the configuration file." << std::endl;
return;
}

Expand Down Expand Up @@ -105,28 +91,13 @@ namespace MyConfigSaver {
configFile << "watermarkuser " << MenuConfig::watermarkuser << std::endl;
configFile << "CheatList" << MenuConfig::CheatList << std::endl;
configFile.close();
std::cout << "Configuration saved to " << filename << std::endl;
std::cout << "[Success] Configuration saved to " << MenuConfig::path + '\\' + filename << std::endl;
}

void LoadConfig(const std::string& filename) {
TCHAR documentsPath[MAX_PATH];
if (SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, 0, documentsPath) != S_OK) {
std::cerr << "Error: Could not retrieve the Documents directory path." << std::endl;
return;
}

char narrowPath[MAX_PATH];
if (WideCharToMultiByte(CP_UTF8, 0, documentsPath, -1, narrowPath, sizeof(narrowPath), NULL, NULL) == 0) {
std::cerr << "Error: Could not convert wide character path to narrow character path." << std::endl;
return;
}

std::string documentsDir(narrowPath);
std::string configFilePath = documentsDir + "\\.Aeonix\\" + filename;

std::ifstream configFile(configFilePath);
std::ifstream configFile(MenuConfig::path + '\\' + filename);
if (!configFile.is_open()) {
std::cerr << "Error: Could not open the configuration file." << std::endl;
std::cerr << "[Error] Could not open the configuration file." << std::endl;
return;
}

Expand All @@ -135,79 +106,81 @@ namespace MyConfigSaver {
std::istringstream iss(line);
std::string key;
if (iss >> key) {
if (key == "ShowBoneESP") iss >> MenuConfig::ShowBoneESP;
else if (key == "VisibleEsp") iss >> MenuConfig::VisibleEsp;
else if (key == "HealthText") iss >> MenuConfig::HealthText;
else if (key == "SpectateEsp") iss >> MenuConfig::SpectateEsp;
else if (key == "MinTriggerDelay") iss >> TriggerBot::MinDelay;
else if (key == "MaxTriggerDelay") iss >> TriggerBot::MaxDelay;
else if (key == "ShowBoxESP") iss >> MenuConfig::ShowBoxESP;
else if (key == "TriggerHotKey") { iss >> MenuConfig::TriggerHotKey; TriggerBot::SetHotKey(MenuConfig::TriggerHotKey); }
else if (key == "RCSBullet") iss >> AimControl::RCSBullet;
else if (key == "ShowHealthBar") iss >> MenuConfig::ShowHealthBar;
else if (key == "AimFov") iss >> AimControl::AimFov;
else if (key == "FovLineSize") iss >> MenuConfig::FovLineSize;
else if (key == "AimBotHotKey") { iss >> MenuConfig::AimBotHotKey; AimControl::SetHotKey(MenuConfig::AimBotHotKey); }
else if (key == "ShowLineToEnemy") iss >> MenuConfig::ShowLineToEnemy;
else if (key == "SnapLinePos") iss >> MenuConfig::SnapLinePos;
else if (key == "RCSScale.x") iss >> AimControl::RCSScale.x;
else if (key == "RCSScale.y") iss >> AimControl::RCSScale.y;
else if (key == "ShowWeaponESP") iss >> MenuConfig::ShowWeaponESP;
else if (key == "Smooth") iss >> AimControl::Smooth;
else if (key == "ShowFovLine") iss >> MenuConfig::ShowFovLine;
else if (key == "ShowEyeRay") iss >> MenuConfig::ShowEyeRay;
else if (key == "ShowPlayerName") iss >> MenuConfig::ShowPlayerName;
else if (key == "AimBot") iss >> MenuConfig::AimBot;
else if (key == "AimPosition") iss >> MenuConfig::AimPosition;
else if (key == "AimPositionIndex") iss >> MenuConfig::AimPositionIndex;
else if (key == "HealthBarType") iss >> MenuConfig::HealthBarType;
else if (key == "BoneColor") iss >> MenuConfig::BoneColor.Value.x >> MenuConfig::BoneColor.Value.y >> MenuConfig::BoneColor.Value.z >> MenuConfig::BoneColor.Value.w;
else if (key == "BoneVisColor") iss >> MenuConfig::BoneVisColor.Value.x >> MenuConfig::BoneVisColor.Value.y >> MenuConfig::BoneVisColor.Value.z >> MenuConfig::BoneVisColor.Value.w;
else if (key == "FovLineColor") iss >> MenuConfig::FovLineColor.Value.x >> MenuConfig::FovLineColor.Value.y >> MenuConfig::FovLineColor.Value.z >> MenuConfig::FovLineColor.Value.w;
else if (key == "LineToEnemyColor") iss >> MenuConfig::LineToEnemyColor.Value.x >> MenuConfig::LineToEnemyColor.Value.y >> MenuConfig::LineToEnemyColor.Value.z >> MenuConfig::LineToEnemyColor.Value.w;
else if (key == "BoxColor") iss >> MenuConfig::BoxColor.Value.x >> MenuConfig::BoxColor.Value.y >> MenuConfig::BoxColor.Value.z >> MenuConfig::BoxColor.Value.w;
else if (key == "EyeRayColor") iss >> MenuConfig::EyeRayColor.Value.x >> MenuConfig::EyeRayColor.Value.y >> MenuConfig::EyeRayColor.Value.z >> MenuConfig::EyeRayColor.Value.w;
else if (key == "RadarCrossLineColor") iss >> MenuConfig::RadarCrossLineColor.Value.x >> MenuConfig::RadarCrossLineColor.Value.y >> MenuConfig::RadarCrossLineColor.Value.z >> MenuConfig::RadarCrossLineColor.Value.w;
else if (key == "HeadShootLineColor") iss >> MenuConfig::HeadShootLineColor.Value.x >> MenuConfig::HeadShootLineColor.Value.y >> MenuConfig::HeadShootLineColor.Value.z >> MenuConfig::HeadShootLineColor.Value.w;
else if (key == "ShowMenu") iss >> MenuConfig::ShowMenu;
else if (key == "ShowRadar") iss >> MenuConfig::ShowRadar;
else if (key == "RadarRange") iss >> MenuConfig::RadarRange;
else if (key == "RadarPointSizeProportion") iss >> MenuConfig::RadarPointSizeProportion;
else if (key == "ShowCrossLine") iss >> MenuConfig::ShowRadarCrossLine;
else if (key == "RadarType") iss >> MenuConfig::RadarType;
else if (key == "Proportion") iss >> MenuConfig::Proportion;
else if (key == "BoxType") iss >> MenuConfig::BoxType;
else if (key == "TriggerBot") iss >> MenuConfig::TriggerBot;
else if (key == "TeamCheck") iss >> MenuConfig::TeamCheck;
else if (key == "VisibleCheck") iss >> MenuConfig::VisibleCheck;
else if (key == "ShowHeadShootLine") iss >> MenuConfig::ShowHeadShootLine;
else if (key == "ShowCrossHair") iss >> MenuConfig::ShowCrossHair;
else if (key == "CrossHairColor") iss >> CrosshairConfig::CrossHairColor.Value.x >> CrosshairConfig::CrossHairColor.Value.y >> CrosshairConfig::CrossHairColor.Value.z >> CrosshairConfig::CrossHairColor.Value.w;
else if (key == "CrossHairSize") iss >> CrosshairConfig::CrossHairSize;
else if (key == "drawDot") iss >> CrosshairConfig::drawDot;
else if (key == "tStyle") iss >> CrosshairConfig::tStyle;
else if (key == "HorizontalLength") iss >> CrosshairConfig::HorizontalLength;
else if (key == "VerticalLength") iss >> CrosshairConfig::VerticalLength;
else if (key == "drawOutLine") iss >> CrosshairConfig::drawOutLine;
else if (key == "Gap") iss >> CrosshairConfig::Gap;
else if (key == "ShowAimFovRange") iss >> MenuConfig::ShowAimFovRange;
else if (key == "AimFovRangeColor") iss >> MenuConfig::AimFovRangeColor.Value.x >> MenuConfig::AimFovRangeColor.Value.y >> MenuConfig::AimFovRangeColor.Value.z >> MenuConfig::AimFovRangeColor.Value.w;
else if (key == "VisibleColor") iss >> MenuConfig::VisibleColor.Value.x >> MenuConfig::VisibleColor.Value.y >> MenuConfig::VisibleColor.Value.z >> MenuConfig::VisibleColor.Value.w;
else if (key == "OBSBypass") iss >> MenuConfig::OBSBypass;
else if (key == "ShowDistance") iss >> MenuConfig::ShowDistance;
else if (key == "RadarBgAlpha") iss >> MenuConfig::RadarBgAlpha;
else if (key == "StyleIndex") iss >> MenuConfig::selectedStyleIndex;
else if (key == "EspVisCheck") iss >> MenuConfig::EspVisCheck;
else if (key == "WaterMark") iss >> MenuConfig::WaterMark;
else if (key == "watermarkcheat") iss >> MenuConfig::watermarkcheat;
else if (key == "watermarkfps") iss >> MenuConfig::watermarkfps;
else if (key == "watermarktime") iss >> MenuConfig::watermarktime;
else if (key == "watermarkuser") iss >> MenuConfig::watermarkuser;
else if (key == "CheatList") iss >> MenuConfig::CheatList;
if (iss >> key) {
if (key == "ShowBoneESP") iss >> MenuConfig::ShowBoneESP;
else if (key == "VisibleEsp") iss >> MenuConfig::VisibleEsp;
else if (key == "HealthText") iss >> MenuConfig::HealthText;
else if (key == "SpectateEsp") iss >> MenuConfig::SpectateEsp;
else if (key == "MinTriggerDelay") iss >> TriggerBot::MinDelay;
else if (key == "MaxTriggerDelay") iss >> TriggerBot::MaxDelay;
else if (key == "ShowBoxESP") iss >> MenuConfig::ShowBoxESP;
else if (key == "TriggerHotKey") { iss >> MenuConfig::TriggerHotKey; TriggerBot::SetHotKey(MenuConfig::TriggerHotKey); }
else if (key == "RCSBullet") iss >> AimControl::RCSBullet;
else if (key == "ShowHealthBar") iss >> MenuConfig::ShowHealthBar;
else if (key == "AimFov") iss >> AimControl::AimFov;
else if (key == "FovLineSize") iss >> MenuConfig::FovLineSize;
else if (key == "AimBotHotKey") { iss >> MenuConfig::AimBotHotKey; AimControl::SetHotKey(MenuConfig::AimBotHotKey); }
else if (key == "ShowLineToEnemy") iss >> MenuConfig::ShowLineToEnemy;
else if (key == "SnapLinePos") iss >> MenuConfig::SnapLinePos;
else if (key == "RCSScale.x") iss >> AimControl::RCSScale.x;
else if (key == "RCSScale.y") iss >> AimControl::RCSScale.y;
else if (key == "ShowWeaponESP") iss >> MenuConfig::ShowWeaponESP;
else if (key == "Smooth") iss >> AimControl::Smooth;
else if (key == "ShowFovLine") iss >> MenuConfig::ShowFovLine;
else if (key == "ShowEyeRay") iss >> MenuConfig::ShowEyeRay;
else if (key == "ShowPlayerName") iss >> MenuConfig::ShowPlayerName;
else if (key == "AimBot") iss >> MenuConfig::AimBot;
else if (key == "AimPosition") iss >> MenuConfig::AimPosition;
else if (key == "AimPositionIndex") iss >> MenuConfig::AimPositionIndex;
else if (key == "HealthBarType") iss >> MenuConfig::HealthBarType;
else if (key == "BoneColor") iss >> MenuConfig::BoneColor.Value.x >> MenuConfig::BoneColor.Value.y >> MenuConfig::BoneColor.Value.z >> MenuConfig::BoneColor.Value.w;
else if (key == "BoneVisColor") iss >> MenuConfig::BoneVisColor.Value.x >> MenuConfig::BoneVisColor.Value.y >> MenuConfig::BoneVisColor.Value.z >> MenuConfig::BoneVisColor.Value.w;
else if (key == "FovLineColor") iss >> MenuConfig::FovLineColor.Value.x >> MenuConfig::FovLineColor.Value.y >> MenuConfig::FovLineColor.Value.z >> MenuConfig::FovLineColor.Value.w;
else if (key == "LineToEnemyColor") iss >> MenuConfig::LineToEnemyColor.Value.x >> MenuConfig::LineToEnemyColor.Value.y >> MenuConfig::LineToEnemyColor.Value.z >> MenuConfig::LineToEnemyColor.Value.w;
else if (key == "BoxColor") iss >> MenuConfig::BoxColor.Value.x >> MenuConfig::BoxColor.Value.y >> MenuConfig::BoxColor.Value.z >> MenuConfig::BoxColor.Value.w;
else if (key == "EyeRayColor") iss >> MenuConfig::EyeRayColor.Value.x >> MenuConfig::EyeRayColor.Value.y >> MenuConfig::EyeRayColor.Value.z >> MenuConfig::EyeRayColor.Value.w;
else if (key == "RadarCrossLineColor") iss >> MenuConfig::RadarCrossLineColor.Value.x >> MenuConfig::RadarCrossLineColor.Value.y >> MenuConfig::RadarCrossLineColor.Value.z >> MenuConfig::RadarCrossLineColor.Value.w;
else if (key == "HeadShootLineColor") iss >> MenuConfig::HeadShootLineColor.Value.x >> MenuConfig::HeadShootLineColor.Value.y >> MenuConfig::HeadShootLineColor.Value.z >> MenuConfig::HeadShootLineColor.Value.w;
else if (key == "ShowMenu") iss >> MenuConfig::ShowMenu;
else if (key == "ShowRadar") iss >> MenuConfig::ShowRadar;
else if (key == "RadarRange") iss >> MenuConfig::RadarRange;
else if (key == "RadarPointSizeProportion") iss >> MenuConfig::RadarPointSizeProportion;
else if (key == "ShowCrossLine") iss >> MenuConfig::ShowRadarCrossLine;
else if (key == "RadarType") iss >> MenuConfig::RadarType;
else if (key == "Proportion") iss >> MenuConfig::Proportion;
else if (key == "BoxType") iss >> MenuConfig::BoxType;
else if (key == "TriggerBot") iss >> MenuConfig::TriggerBot;
else if (key == "TeamCheck") iss >> MenuConfig::TeamCheck;
else if (key == "VisibleCheck") iss >> MenuConfig::VisibleCheck;
else if (key == "ShowHeadShootLine") iss >> MenuConfig::ShowHeadShootLine;
else if (key == "ShowCrossHair") iss >> MenuConfig::ShowCrossHair;
else if (key == "CrossHairColor") iss >> CrosshairConfig::CrossHairColor.Value.x >> CrosshairConfig::CrossHairColor.Value.y >> CrosshairConfig::CrossHairColor.Value.z >> CrosshairConfig::CrossHairColor.Value.w;
else if (key == "CrossHairSize") iss >> CrosshairConfig::CrossHairSize;
else if (key == "drawDot") iss >> CrosshairConfig::drawDot;
else if (key == "tStyle") iss >> CrosshairConfig::tStyle;
else if (key == "HorizontalLength") iss >> CrosshairConfig::HorizontalLength;
else if (key == "VerticalLength") iss >> CrosshairConfig::VerticalLength;
else if (key == "drawOutLine") iss >> CrosshairConfig::drawOutLine;
else if (key == "Gap") iss >> CrosshairConfig::Gap;
else if (key == "ShowAimFovRange") iss >> MenuConfig::ShowAimFovRange;
else if (key == "AimFovRangeColor") iss >> MenuConfig::AimFovRangeColor.Value.x >> MenuConfig::AimFovRangeColor.Value.y >> MenuConfig::AimFovRangeColor.Value.z >> MenuConfig::AimFovRangeColor.Value.w;
else if (key == "VisibleColor") iss >> MenuConfig::VisibleColor.Value.x >> MenuConfig::VisibleColor.Value.y >> MenuConfig::VisibleColor.Value.z >> MenuConfig::VisibleColor.Value.w;
else if (key == "OBSBypass") iss >> MenuConfig::OBSBypass;
else if (key == "ShowDistance") iss >> MenuConfig::ShowDistance;
else if (key == "RadarBgAlpha") iss >> MenuConfig::RadarBgAlpha;
else if (key == "StyleIndex") iss >> MenuConfig::selectedStyleIndex;
else if (key == "EspVisCheck") iss >> MenuConfig::EspVisCheck;
else if (key == "WaterMark") iss >> MenuConfig::WaterMark;
else if (key == "watermarkcheat") iss >> MenuConfig::watermarkcheat;
else if (key == "watermarkfps") iss >> MenuConfig::watermarkfps;
else if (key == "watermarktime") iss >> MenuConfig::watermarktime;
else if (key == "watermarkuser") iss >> MenuConfig::watermarkuser;
else if (key == "CheatList") iss >> MenuConfig::CheatList;
}
}
}

configFile.close();
std::cout << "Configuration loaded from " << filename << std::endl;
configFile.close();
std::cout << "[Success] Configuration loaded from " << MenuConfig::path + '\\' + filename << std::endl;
}
}
} // namespace ConfigSaver
}// namespace ConfigSaver
Loading

0 comments on commit e00487b

Please sign in to comment.