Add option to disable asking to delete nsps after install
This commit is contained in:
parent
1c4c7e6694
commit
b36ca2e91c
@ -1,4 +1,5 @@
|
||||
[settings]
|
||||
ignoreReqVers=1
|
||||
deletePrompt=1
|
||||
gayMode=0
|
||||
sigPatchesUrl=https://github.com/Huntereb/Awoo-Installer/releases/download/SignaturePatches/patches.zip
|
||||
|
@ -5,6 +5,7 @@ namespace inst::config {
|
||||
extern const std::string configPath;
|
||||
extern std::string sigPatchesUrl;
|
||||
extern bool ignoreReqVers;
|
||||
extern bool deletePrompt;
|
||||
extern bool gayMode;
|
||||
|
||||
void parseConfig();
|
||||
|
@ -140,13 +140,17 @@ namespace nspInstStuff {
|
||||
inst::ui::setInstInfoText("Install complete");
|
||||
inst::ui::setInstBarPerc(100);
|
||||
if (ourNspList.size() > 1) {
|
||||
if(inst::ui::mainApp->CreateShowDialog("Selected files installed! Delete them from the SD card?", nspInstStuff::finishedMessage(), {"No","Yes"}, false) == 1) {
|
||||
for (long unsigned int i = 0; i < ourNspList.size(); i++) {
|
||||
std::filesystem::remove(ourNspList[i]);
|
||||
if (inst::config::deletePrompt) {
|
||||
if(inst::ui::mainApp->CreateShowDialog("Selected files installed! Delete them from the SD card?", "NSP/NSZ files are not required after installation to launch titles", {"No","Yes"}, false) == 1) {
|
||||
for (long unsigned int i = 0; i < ourNspList.size(); i++) {
|
||||
if (std::filesystem::exists(ourNspList[i])) std::filesystem::remove(ourNspList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else inst::ui::mainApp->CreateShowDialog("Selected files installed!", nspInstStuff::finishedMessage(), {"OK"}, true);
|
||||
} else {
|
||||
if(inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourNspList[0].string().erase(0, 6), 64, true) + " installed! Delete it from the SD card?", nspInstStuff::finishedMessage(), {"No","Yes"}, false) == 1) std::filesystem::remove(ourNspList[0]);
|
||||
if (inst::config::deletePrompt) {
|
||||
if(inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourNspList[0].string().erase(0, 6), 64, true) + " installed! Delete it from the SD card?", "NSP/NSZ files are not required after installation to launch titles", {"No","Yes"}, false) == 1) if (std::filesystem::exists(ourNspList[0])) std::filesystem::remove(ourNspList[0]);
|
||||
} else inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourNspList[0].string().erase(0, 6), 64, true) + " installed!", nspInstStuff::finishedMessage(), {"OK"}, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
namespace inst::ui {
|
||||
extern MainApplication *mainApp;
|
||||
|
||||
std::vector<std::string> ourMenuEntries = {"Ignore Required Firmware Version", "Remove Anime", "Signature Patches Source URL: "};
|
||||
std::vector<std::string> ourMenuEntries = {"Ignore minimum firmware version required by NSP files", "Ask to delete NSP files after installation", "Remove anime", "Signature patches source URL: "};
|
||||
|
||||
optionsPage::optionsPage() : Layout::Layout() {
|
||||
this->SetBackgroundColor(COLOR("#670000FF"));
|
||||
@ -49,11 +49,15 @@ namespace inst::ui {
|
||||
ignoreFirmOption->SetColor(COLOR("#FFFFFFFF"));
|
||||
ignoreFirmOption->SetIcon(optionsPage::getMenuOptionIcon(inst::config::ignoreReqVers));
|
||||
this->menu->AddItem(ignoreFirmOption);
|
||||
auto gayModeOption = pu::ui::elm::MenuItem::New(ourMenuEntries[1]);
|
||||
auto deletePromptOption = pu::ui::elm::MenuItem::New(ourMenuEntries[1]);
|
||||
deletePromptOption->SetColor(COLOR("#FFFFFFFF"));
|
||||
deletePromptOption->SetIcon(optionsPage::getMenuOptionIcon(inst::config::deletePrompt));
|
||||
this->menu->AddItem(deletePromptOption);
|
||||
auto gayModeOption = pu::ui::elm::MenuItem::New(ourMenuEntries[2]);
|
||||
gayModeOption->SetColor(COLOR("#FFFFFFFF"));
|
||||
gayModeOption->SetIcon(optionsPage::getMenuOptionIcon(inst::config::gayMode));
|
||||
this->menu->AddItem(gayModeOption);
|
||||
auto sigPatchesUrlOption = pu::ui::elm::MenuItem::New(ourMenuEntries[2] + inst::util::shortenString(inst::config::sigPatchesUrl, 42, false));
|
||||
auto sigPatchesUrlOption = pu::ui::elm::MenuItem::New(ourMenuEntries[3] + inst::util::shortenString(inst::config::sigPatchesUrl, 42, false));
|
||||
sigPatchesUrlOption->SetColor(COLOR("#FFFFFFFF"));
|
||||
this->menu->AddItem(sigPatchesUrlOption);
|
||||
auto creditsOption = pu::ui::elm::MenuItem::New("Credits");
|
||||
@ -79,6 +83,12 @@ namespace inst::ui {
|
||||
optionsPage::setMenuText();
|
||||
break;
|
||||
case 1:
|
||||
if (inst::config::deletePrompt) inst::config::deletePrompt = false;
|
||||
else inst::config::deletePrompt = true;
|
||||
inst::config::setConfig();
|
||||
optionsPage::setMenuText();
|
||||
break;
|
||||
case 2:
|
||||
if (inst::config::gayMode) {
|
||||
inst::config::gayMode = false;
|
||||
mainApp->mainPage->awooImage->SetVisible(true);
|
||||
@ -92,7 +102,7 @@ namespace inst::ui {
|
||||
inst::config::setConfig();
|
||||
optionsPage::setMenuText();
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
SwkbdConfig kbd;
|
||||
rc = swkbdCreate(&kbd, 0);
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
@ -108,10 +118,10 @@ namespace inst::ui {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
inst::ui::mainApp->CreateShowDialog("Thanks to the following people!", "- HookedBehemoth for screen-nx and his Plutonium fork\n- Adubbz and other contributors for Tinfoil\n- XorTroll for Plutonium and Goldleaf\n- blawar (wife beater) and nicoboss for NSZ support\n- The kind folks at the AtlasNX Discuck\n- The also kind folks at the RetroNX Discuck\n- namako8982 for the Momiji art\n- TheXzoron for being a baka", {"Close"}, true);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
inst::ui::mainApp->CreateShowDialog("Third Party Licenses", "Licenses to the libraries and software used in Awoo Installer are packaged with each release\nwithin the source code, or are distributed upon compilation of the software.\nPlease see the releases page for a copy of the source code and license information.", {"Close"}, true);
|
||||
break;
|
||||
default:
|
||||
|
@ -8,11 +8,13 @@ namespace inst::config {
|
||||
const std::string configPath = appDir + "/config.ini";
|
||||
std::string sigPatchesUrl = "https://github.com/Huntereb/Awoo-Installer/releases/download/SignaturePatches/patches.zip";
|
||||
bool ignoreReqVers = true;
|
||||
bool deletePrompt = true;
|
||||
bool gayMode = false;
|
||||
|
||||
void parseConfig() {
|
||||
INIReader reader(inst::config::configPath);
|
||||
inst::config::ignoreReqVers = reader.GetBoolean("settings", "ignoreReqVers", inst::config::ignoreReqVers);
|
||||
inst::config::deletePrompt = reader.GetBoolean("settings", "deletePrompt", inst::config::deletePrompt);
|
||||
inst::config::gayMode = reader.GetBoolean("settings", "gayMode", inst::config::gayMode);
|
||||
inst::config::sigPatchesUrl = reader.GetString("settings", "sigPatchesUrl", inst::config::sigPatchesUrl);
|
||||
return;
|
||||
@ -20,7 +22,7 @@ namespace inst::config {
|
||||
|
||||
void setConfig() {
|
||||
std::filesystem::remove(inst::config::configPath);
|
||||
std::string data("[settings]\nignoreReqVers=" + std::to_string(inst::config::ignoreReqVers) + "\ngayMode=" + std::to_string(inst::config::gayMode) + "\nsigPatchesUrl=" + inst::config::sigPatchesUrl + "\n");
|
||||
std::string data("[settings]\nignoreReqVers=" + std::to_string(inst::config::ignoreReqVers) + "\ndeletePrompt=" + std::to_string(inst::config::deletePrompt) + "\ngayMode=" + std::to_string(inst::config::gayMode) + "\nsigPatchesUrl=" + inst::config::sigPatchesUrl + "\n");
|
||||
FILE * configFile = fopen(inst::config::configPath.c_str(), "w");
|
||||
fwrite(data.c_str(), sizeof(char), data.size(), configFile);
|
||||
fflush(configFile);
|
||||
|
Reference in New Issue
Block a user