gkey can be set in config

This commit is contained in:
Huntereb 2019-12-12 12:36:10 -05:00
parent b5e4b0f75b
commit 4f4f4b294f
2 changed files with 6 additions and 4 deletions

View file

@ -4,9 +4,9 @@ namespace inst::config {
static const std::string appDir = "sdmc:/switch/Awoo-Installer"; static const std::string appDir = "sdmc:/switch/Awoo-Installer";
static const std::string configPath = appDir + "/config.ini"; static const std::string configPath = appDir + "/config.ini";
static const std::string appVersion = "1.2.2"; static const std::string appVersion = "1.2.2";
static const std::string gAuthKey = {0x41,0x49,0x7a,0x61,0x53,0x79,0x42,0x4d,0x71,0x76,0x34,0x64,0x58,0x6e,0x54,0x4a,0x4f,0x47,0x51,0x74,0x5a,0x5a,0x53,0x33,0x43,0x42,0x6a,0x76,0x66,0x37,0x34,0x38,0x51,0x76,0x78,0x53,0x7a,0x46,0x30};
extern std::string sigPatchesUrl; extern std::string sigPatchesUrl;
extern std::string gAuthKey;
extern bool ignoreReqVers; extern bool ignoreReqVers;
extern bool validateNCAs; extern bool validateNCAs;
extern bool overClock; extern bool overClock;

View file

@ -5,8 +5,9 @@
#include "util/config.hpp" #include "util/config.hpp"
namespace inst::config { namespace inst::config {
static const char* configBase = "[settings]\nignoreReqVers=%d\nvalidateNCAs=%d\noverClock=%d\ndeletePrompt=%d\ngayMode=%d\nsigPatchesUrl=%s\nusbAck=%d"; static const char* configBase = "[settings]\nignoreReqVers=%d\nvalidateNCAs=%d\noverClock=%d\ndeletePrompt=%d\ngayMode=%d\nsigPatchesUrl=%s\ngAuthKey=%s\nusbAck=%d";
std::string sigPatchesUrl; std::string sigPatchesUrl;
std::string gAuthKey;
bool ignoreReqVers; bool ignoreReqVers;
bool validateNCAs; bool validateNCAs;
bool overClock; bool overClock;
@ -22,14 +23,15 @@ namespace inst::config {
deletePrompt = reader.GetBoolean("settings", "deletePrompt", true); deletePrompt = reader.GetBoolean("settings", "deletePrompt", true);
gayMode = reader.GetBoolean("settings", "gayMode", false); gayMode = reader.GetBoolean("settings", "gayMode", false);
sigPatchesUrl = reader.GetString("settings", "sigPatchesUrl", "https://github.com/Huntereb/Awoo-Installer/releases/download/SignaturePatches/patches.zip"); sigPatchesUrl = reader.GetString("settings", "sigPatchesUrl", "https://github.com/Huntereb/Awoo-Installer/releases/download/SignaturePatches/patches.zip");
gAuthKey = reader.GetString("settings", "gAuthKey", {0x41,0x49,0x7a,0x61,0x53,0x79,0x42,0x4d,0x71,0x76,0x34,0x64,0x58,0x6e,0x54,0x4a,0x4f,0x47,0x51,0x74,0x5a,0x5a,0x53,0x33,0x43,0x42,0x6a,0x76,0x66,0x37,0x34,0x38,0x51,0x76,0x78,0x53,0x7a,0x46,0x30});
usbAck = reader.GetBoolean("settings", "usbAck", false); usbAck = reader.GetBoolean("settings", "usbAck", false);
return; return;
} }
void setConfig() { void setConfig() {
std::filesystem::remove(inst::config::configPath); std::filesystem::remove(inst::config::configPath);
char data[96 + sigPatchesUrl.size()]; char data[106 + sigPatchesUrl.size() + gAuthKey.size()];
sprintf(data, configBase, ignoreReqVers, validateNCAs, overClock, deletePrompt, gayMode, sigPatchesUrl.c_str(), usbAck); sprintf(data, configBase, ignoreReqVers, validateNCAs, overClock, deletePrompt, gayMode, sigPatchesUrl.c_str(), gAuthKey.c_str(), usbAck);
FILE * configFile = fopen(inst::config::configPath.c_str(), "w"); FILE * configFile = fopen(inst::config::configPath.c_str(), "w");
fwrite(data, sizeof(char), strlen(data), configFile); fwrite(data, sizeof(char), strlen(data), configFile);
fflush(configFile); fflush(configFile);