Change to TUI
This commit is contained in:
parent
88925a84d0
commit
79928d3342
46
Main.cpp
46
Main.cpp
@ -9,40 +9,56 @@
|
|||||||
const std::string gdLocalFolder = getenv("HOME") + std::string("/.local/share/Steam/steamapps/compatdata/322170/pfx/drive_c/users/steamuser/Local Settings/Application Data/GeometryDash/");
|
const std::string gdLocalFolder = getenv("HOME") + std::string("/.local/share/Steam/steamapps/compatdata/322170/pfx/drive_c/users/steamuser/Local Settings/Application Data/GeometryDash/");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const std::string usage = R"(Usage:
|
|
||||||
-d: decrypt
|
|
||||||
-e: encrypt
|
|
||||||
-es: encrypt and save to GD folder)";
|
|
||||||
|
|
||||||
const std::string saves[2] = {
|
const std::string saves[2] = {
|
||||||
"CCGameManager.dat",
|
"CCGameManager.dat",
|
||||||
"CCLocalLevels.dat",
|
"CCLocalLevels.dat",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const std::string commands = R"(Commands:
|
||||||
|
1: Decrypt
|
||||||
|
2: Encrypt
|
||||||
|
3: Encrypt and save to GD folder
|
||||||
|
0: Quit)";
|
||||||
|
|
||||||
int main(int argc, const char** argv) {
|
int main(int argc, const char** argv) {
|
||||||
std::vector<std::string> args;
|
std::vector<std::string> args;
|
||||||
for(int i = 0; i < argc; i++)
|
for(int i = 0; i < argc; i++)
|
||||||
args.push_back(argv[i]);
|
args.push_back(argv[i]);
|
||||||
|
|
||||||
if(argc < 2)
|
bool quit = false;
|
||||||
{
|
std::string cmd;
|
||||||
std::cout << usage << std::endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[1] == "-d")
|
while(!quit)
|
||||||
{
|
{
|
||||||
|
std::cout << commands << std::endl;
|
||||||
|
std::cout << ">> ";
|
||||||
|
std::cin >> cmd;
|
||||||
|
if(cmd == "1")
|
||||||
|
{
|
||||||
|
std::cout << "Decrypting..." << std::endl;
|
||||||
const std::string decrypted = Decrypt(gdLocalFolder + saves[0]);
|
const std::string decrypted = Decrypt(gdLocalFolder + saves[0]);
|
||||||
StrToFile(saves[0] + ".xml", decrypted);
|
StrToFile(saves[0] + ".xml", decrypted);
|
||||||
}
|
}
|
||||||
else if(args[1] == "-e" || args[1] == "-es")
|
else if(cmd == "2")
|
||||||
{
|
{
|
||||||
|
std::cout << "Encrypting..." << std::endl;
|
||||||
const std::string encrypted = Encrypt(saves[0] + ".xml");
|
const std::string encrypted = Encrypt(saves[0] + ".xml");
|
||||||
if(args[1] == "-e")
|
|
||||||
StrToFile(saves[0], encrypted);
|
StrToFile(saves[0], encrypted);
|
||||||
else
|
}
|
||||||
|
else if(cmd == "3")
|
||||||
|
{
|
||||||
|
std::cout << "Encrypting and saving to GD folder..." << std::endl;
|
||||||
|
const std::string encrypted = Encrypt(saves[0] + ".xml");
|
||||||
StrToFile(gdLocalFolder + saves[0], encrypted);
|
StrToFile(gdLocalFolder + saves[0], encrypted);
|
||||||
}
|
}
|
||||||
|
else if(cmd == "0")
|
||||||
|
{
|
||||||
|
std::cout << "Quitting" << std::endl;
|
||||||
|
quit = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
std::cerr << "Invalid command" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
exit(0);
|
return(0);
|
||||||
}
|
}
|
6
Makefile
6
Makefile
@ -5,11 +5,11 @@ CXXFLAGS=-lz -O2 -static
|
|||||||
# Output file extension (for example .exe for Windows)
|
# Output file extension (for example .exe for Windows)
|
||||||
O_EXT=
|
O_EXT=
|
||||||
|
|
||||||
gd_crypt: Main.cpp Base64.hpp GDGameSave.hpp
|
gd_crypt$(O_EXT): Main.cpp Base64.hpp GDGameSave.hpp
|
||||||
$(CXX) -o $@$(O_EXT) $^ $(CXXFLAGS)
|
$(CXX) -o $@ $^ $(CXXFLAGS)
|
||||||
|
|
||||||
xcomp_linux_win:
|
xcomp_linux_win:
|
||||||
make CXX=x86_64-w64-mingw32-g++ O_EXT=.exe
|
make CXX=x86_64-w64-mingw32-g++ O_EXT=.exe
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm ./gd_decr
|
rm ./gd_crypt
|
||||||
|
Loading…
Reference in New Issue
Block a user