Untitled

 avatar
unknown
plain_text
a month ago
1.6 kB
13
Indexable
bool CheckFortniteFolders(const std::string& folderPath) {
	std::filesystem::path fortnitePath(folderPath);
	std::filesystem::path fortniteGamePath = fortnitePath / "FortniteGame";
	std::filesystem::path enginePath = fortnitePath / "Engine";

	return std::filesystem::exists(fortniteGamePath) && std::filesystem::exists(enginePath);
}
bool CheckEasyAntiCheatFolder(const std::string& folderPath) {
	std::filesystem::path fortnitePath(folderPath);
	std::filesystem::path easyAntiCheatPath = fortnitePath / "EasyAntiCheat" / "Settings.json";

	return std::filesystem::exists(easyAntiCheatPath);
}

bool CheckAndModifyIDs(const std::string& folderPath) {
	std::filesystem::path settingsPath = std::filesystem::path(folderPath) / "EasyAntiCheat" / "Settings.json";

	if (!std::filesystem::exists(settingsPath)) {
		return false;
	}

	std::ifstream settingsFile(settingsPath);
	if (!settingsFile.is_open()) {
		return false;
	}

	nlohmann::json settingsJson;
	settingsFile >> settingsJson;
	settingsFile.close();

	auto updateID = [](std::string& id) {
		if (id.size() >= 3 && id.substr(id.size() - 3) != "zzz") {
			id.replace(id.size() - 3, 3, "zzz");
		}
		};

	std::string keys[] = { "productid", "sandboxid", "deploymentid" };
	for (const auto& key : keys) {
		if (settingsJson.contains(key) && settingsJson[key].is_string()) {
			std::string id = settingsJson[key];
			updateID(id);
			settingsJson[key] = id;
		}
	}

	std::ofstream outFile(settingsPath);
	if (!outFile.is_open()) {
		return false;
	}
	outFile << settingsJson.dump(4);
	outFile.close();

	return true;
}
Leave a Comment