Last active
February 4, 2021 18:48
-
-
Save FigmentBoy/d4731fb1509c052d2ab4f202ed23ffcb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void install(string location) { | |
| } | |
| void findLocation(string steamLocation) { | |
| string configText; | |
| ifstream ConfigFile(steamLocation + string("\\config\\config.vdf")); | |
| int location = 1; | |
| struct stat info; | |
| while (getline(ConfigFile, configText)) { | |
| configText.erase(std::remove(configText.begin(), configText.end(), '\t'), configText.end()); | |
| configText.erase(std::remove(configText.begin(), configText.end(), '"'), configText.end()); | |
| replace(configText, "\\\\", "\\"); | |
| string folderName = "BaseInstallFolder_" + std::to_string(location); | |
| if (configText.find(folderName) != string::npos) { | |
| configText.erase(0, folderName.length()); | |
| configText += "\\steamapps\\common\\Geometry Dash"; | |
| if (stat(configText.c_str(), &info) == 0) { | |
| if (info.st_mode & S_IFDIR) { | |
| ConfigFile.close(); | |
| install(configText); | |
| return; | |
| } | |
| } | |
| location += 1; | |
| } | |
| } | |
| ConfigFile.close(); | |
| } | |
| int main() | |
| { | |
| SetConsoleTitle(TEXT("Installer")); | |
| struct stat info; | |
| char value[255]; | |
| DWORD BufferSize = BUFFER; | |
| if (RegGetValue(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Valve\\Steam"), TEXT("InstallPath"), RRF_RT_ANY, NULL, (PVOID)&value, &BufferSize) == ERROR_SUCCESS) { | |
| string steamPath = value + string("\\steamapps\\common\\Geometry Dash"); | |
| if (stat(steamPath.c_str(), &info) != 0) { | |
| findLocation(value); | |
| } | |
| else if (info.st_mode & S_IFDIR) { | |
| install(steamPath); | |
| } | |
| else { | |
| findLocation(value); | |
| } | |
| } | |
| else { | |
| cout << "Failed to find Steam Installation" << endl; | |
| }; | |
| system("PAUSE"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment