Add warning for USB installs

This commit is contained in:
Huntereb 2019-12-01 01:02:31 -05:00
parent 7ad0dcc7bf
commit 787f945d9e
4 changed files with 14 additions and 5 deletions

View file

@ -12,6 +12,7 @@ namespace inst::config {
extern bool overClock;
extern bool deletePrompt;
extern bool gayMode;
extern bool usbAck;
void parseConfig();
void setConfig();

View file

@ -78,6 +78,12 @@ namespace inst::ui {
}
void MainPage::usbInstallMenuItem_Click() {
if (!inst::config::usbAck) {
if (mainApp->CreateShowDialog("Warning!", "Due to the nature of libnx's USB comms implementation, USB installations\nmay not \"just werk\" on some devices and setups. If you experience issues\nwith USB installations, please don't pull your hair out! It's advised to\nuse LAN/Internet installations instead for remote installation, especially\nwhen paired with an ethernet adapter! It is not recomended, but disabling\nNCA verification in Awoo Installer's settings may help if you plan to use\nUSB installations a lot.\n\nThis is not Awoo Installer's fault, I promise. You have been warned...", {"OK", "Don't tell me again"}, false) == 1) {
inst::config::usbAck = true;
inst::config::setConfig();
}
}
if (inst::util::getUsbState() == 5) mainApp->usbinstPage->startUsb();
else {
if (mainApp->CreateShowDialog("No USB connection detected", "Plug in to a compatible device to install over USB", {"OK", "Help"}, false) == 1)

View file

@ -5,13 +5,14 @@
#include "util/config.hpp"
namespace inst::config {
static const char* configBase = "[settings]\nignoreReqVers=%d\nvalidateNCAs=%d\noverClock=%d\ndeletePrompt=%d\ngayMode=%d\nsigPatchesUrl=%s\n";
static const char* configBase = "[settings]\nignoreReqVers=%d\nvalidateNCAs=%d\noverClock=%d\ndeletePrompt=%d\ngayMode=%d\nsigPatchesUrl=%s\nusbAck=%d";
std::string sigPatchesUrl;
bool ignoreReqVers;
bool validateNCAs;
bool overClock;
bool deletePrompt;
bool gayMode;
bool usbAck;
void parseConfig() {
INIReader reader(configPath);
@ -21,13 +22,14 @@ namespace inst::config {
deletePrompt = reader.GetBoolean("settings", "deletePrompt", true);
gayMode = reader.GetBoolean("settings", "gayMode", false);
sigPatchesUrl = reader.GetString("settings", "sigPatchesUrl", "https://github.com/Huntereb/Awoo-Installer/releases/download/SignaturePatches/patches.zip");
usbAck = reader.GetBoolean("settings", "usbAck", false);
return;
}
void setConfig() {
std::filesystem::remove(inst::config::configPath);
char data[82 + sigPatchesUrl.size()];
sprintf(data, configBase, ignoreReqVers, validateNCAs, overClock, deletePrompt, gayMode, sigPatchesUrl.c_str());
char data[96 + sigPatchesUrl.size()];
sprintf(data, configBase, ignoreReqVers, validateNCAs, overClock, deletePrompt, gayMode, sigPatchesUrl.c_str(), usbAck);
FILE * configFile = fopen(inst::config::configPath.c_str(), "w");
fwrite(data, sizeof(char), strlen(data), configFile);
fflush(configFile);

View file

@ -21,8 +21,8 @@ namespace inst::util {
if (!pu::IsReiNX()) pu::IsAtmosphere();
if (!std::filesystem::exists("sdmc:/switch")) std::filesystem::create_directory("sdmc:/switch");
if (!std::filesystem::exists(inst::config::appDir)) std::filesystem::create_directory(inst::config::appDir);
if (std::filesystem::exists(inst::config::configPath)) inst::config::parseConfig();
else inst::config::setConfig();
inst::config::parseConfig();
if (!std::filesystem::exists(inst::config::configPath)) inst::config::setConfig();
socketInitializeDefault();
#ifdef __DEBUG__