reformat code

This commit is contained in:
nyyu 2021-09-05 21:47:36 +02:00
parent ba57710eb1
commit 48015449c2
87 changed files with 25223 additions and 25179 deletions

View File

@ -6960,8 +6960,7 @@ class binary_reader
do
{
get();
}
while (current == 'N');
} while (current == 'N');
return current;
}
@ -8550,8 +8549,7 @@ scan_number_done:
do
{
get();
}
while (current == ' ' or current == '\t' or current == '\n' or current == '\r');
} while (current == ' ' or current == '\t' or current == '\n' or current == '\r');
switch (current)
{
@ -10930,7 +10928,8 @@ class json_pointer
pos != std::string::npos; // make sure f was found
s.replace(pos, f.size(), t), // replace with t, and
pos = s.find(f, pos + t.size())) // find next occurrence of f
{}
{
}
}
/// escape "~" to "~0" and "/" to "~1"

View File

@ -74,7 +74,8 @@ namespace nspInstStuff_B {
if (ourTitleList[titleItr].extension() == ".xci" || ourTitleList[titleItr].extension() == ".xcz") {
auto sdmcXCI = std::make_shared<tin::install::xci::SDMCXCI>(ourTitleList[titleItr]);
installTask = std::make_unique<tin::install::xci::XCIInstallTask>(m_destStorageId, inst::config::ignoreReqVers, sdmcXCI);
} else {
}
else {
auto sdmcNSP = std::make_shared<tin::install::nsp::SDMCNSP>(ourTitleList[titleItr]);
installTask = std::make_unique<tin::install::nsp::NSPInstall>(m_destStorageId, inst::config::ignoreReqVers, sdmcNSP);
}
@ -132,11 +133,14 @@ namespace nspInstStuff_B {
if (std::filesystem::exists(ourTitleList[i])) std::filesystem::remove(ourTitleList[i]);
}
}
} else inst::ui::mainApp->CreateShowDialog(std::to_string(ourTitleList.size()) + "inst.info_page.desc0"_lang, Language::GetRandomMsg(), {"common.ok"_lang}, true);
} else {
}
else inst::ui::mainApp->CreateShowDialog(std::to_string(ourTitleList.size()) + "inst.info_page.desc0"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true);
}
else {
if (inst::config::deletePrompt) {
if (inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourTitleList[0].filename().string(), 32, true) + "inst.hd.delete_info"_lang, "inst.hd.delete_desc"_lang, { "common.no"_lang,"common.yes"_lang }, false) == 1) if (std::filesystem::exists(ourTitleList[0])) std::filesystem::remove(ourTitleList[0]);
} else inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourTitleList[0].filename().string(), 42, true) + "inst.info_page.desc1"_lang, Language::GetRandomMsg(), {"common.ok"_lang}, true);
}
else inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourTitleList[0].filename().string(), 42, true) + "inst.info_page.desc1"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true);
}
audioThread.join();

View File

@ -17,7 +17,8 @@ int main(int argc, char* argv[])
main->Prepare();
main->ShowWithFadeIn();
updateThread.join();
} catch (std::exception& e) {
}
catch (std::exception& e) {
LOG_DEBUG("An error occurred:\n%s", e.what());
}
inst::util::deinitApp();

View File

@ -133,7 +133,8 @@ namespace netInstStuff{
for (long unsigned int i = 0; i < urlListAltNames.size(); i++) {
urlNames.push_back(inst::util::shortenString(urlListAltNames[i], 38, true));
}
} else {
}
else {
for (long unsigned int i = 0; i < ourUrlList.size(); i++) {
urlNames.push_back(inst::util::shortenString(inst::util::formatUrlString(ourUrlList[i]), 38, true));
}
@ -155,7 +156,8 @@ namespace netInstStuff{
if (inst::curl::downloadToBuffer(ourUrlList[urlItr], 0x100, 0x103) == "HEAD") {
auto httpXCI = std::make_shared<tin::install::xci::HTTPXCI>(ourUrlList[urlItr]);
installTask = std::make_unique<tin::install::xci::XCIInstallTask>(m_destStorageId, inst::config::ignoreReqVers, httpXCI);
} else {
}
else {
auto httpNSP = std::make_shared<tin::install::nsp::HTTPNSP>(ourUrlList[urlItr]);
installTask = std::make_unique<tin::install::nsp::NSPInstall>(m_destStorageId, inst::config::ignoreReqVers, httpNSP);
}

View File

@ -32,7 +32,8 @@ Result nsextInitialize(void) {
if (R_SUCCEEDED(rc)) {
if (hosversionBefore(3, 0, 0)) {
g_nsAppManSrv = *nsGetServiceSession_ApplicationManagerInterface();
} else {
}
else {
rc = nsGetApplicationManagerInterface(&g_nsAppManSrv);
}
}

View File

@ -73,7 +73,8 @@ namespace nspInstStuff {
if (ourTitleList[titleItr].extension() == ".xci" || ourTitleList[titleItr].extension() == ".xcz") {
auto sdmcXCI = std::make_shared<tin::install::xci::SDMCXCI>(ourTitleList[titleItr]);
installTask = std::make_unique<tin::install::xci::XCIInstallTask>(m_destStorageId, inst::config::ignoreReqVers, sdmcXCI);
} else {
}
else {
auto sdmcNSP = std::make_shared<tin::install::nsp::SDMCNSP>(ourTitleList[titleItr]);
installTask = std::make_unique<tin::install::nsp::NSPInstall>(m_destStorageId, inst::config::ignoreReqVers, sdmcNSP);
}
@ -121,21 +122,26 @@ namespace nspInstStuff {
if (std::filesystem::exists(ourTitleList[i])) {
try {
std::filesystem::remove(ourTitleList[i]);
} catch (...){ };
}
catch (...) {};
}
}
}
} else inst::ui::mainApp->CreateShowDialog(std::to_string(ourTitleList.size()) + "inst.info_page.desc0"_lang, Language::GetRandomMsg(), {"common.ok"_lang}, true);
} else {
}
else inst::ui::mainApp->CreateShowDialog(std::to_string(ourTitleList.size()) + "inst.info_page.desc0"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true);
}
else {
if (inst::config::deletePrompt) {
if (inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourTitleList[0].filename().string(), 32, true) + "inst.sd.delete_info"_lang, "inst.sd.delete_desc"_lang, { "common.no"_lang,"common.yes"_lang }, false) == 1) {
if (std::filesystem::exists(ourTitleList[0])) {
try {
std::filesystem::remove(ourTitleList[0]);
} catch (...){ };
}
catch (...) {};
}
}
} else inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourTitleList[0].filename().string(), 42, true) + "inst.info_page.desc1"_lang, Language::GetRandomMsg(), {"common.ok"_lang}, true);
}
else inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourTitleList[0].filename().string(), 42, true) + "inst.info_page.desc1"_lang, Language::GetRandomMsg(), { "common.ok"_lang }, true);
}
audioThread.join();
}

View File

@ -51,15 +51,18 @@ namespace sig {
return;
}
return;
} else if (ourResult == 1) {
}
else if (ourResult == 1) {
if (!inst::util::copyFile(inst::config::appDir + "/patches.ini.old", "sdmc:/bootloader/patches.ini")) {
if (inst::ui::mainApp->CreateShowDialog("sig.restore_failed"_lang, "", { "common.yes"_lang, "common.no"_lang }, false)) return;
} else std::filesystem::remove(inst::config::appDir + "/patches.ini.old");
}
else std::filesystem::remove(inst::config::appDir + "/patches.ini.old");
if (inst::util::removeDirectory("sdmc:/atmosphere/exefs_patches/es_patches")) {
if (inst::ui::mainApp->CreateShowDialog("sig.uninstall_complete"_lang, "sig.complete_desc"_lang, { "sig.restart"_lang, "sig.later"_lang }, false) == 0) bpcRebootSystem();
}
else inst::ui::mainApp->CreateShowDialog("sig.remove_failed"_lang, "sig.remove_failed_desc"_lang, { "common.ok"_lang }, true);
} else return;
}
else return;
}
catch (std::exception& e)
{

View File

@ -55,7 +55,8 @@ namespace inst::ui {
try {
this->ourDirectories = util::getDirsAtPath(this->currentDir);
this->ourFiles = util::getDirectoryFiles(this->currentDir, { ".nsp", ".nsz", ".xci", ".xcz" });
} catch (std::exception& e) {
}
catch (std::exception& e) {
this->drawMenuItems(false, this->currentDir.parent_path());
return;
}
@ -98,7 +99,8 @@ namespace inst::ui {
if (selectedIndex < dirListSize) {
if (this->menu->GetItems()[this->menu->GetSelectedIndex()]->GetName() == ".." && this->menu->GetSelectedIndex() == 0) {
this->drawMenuItems(true, this->currentDir.parent_path());
} else {
}
else {
this->drawMenuItems(true, this->ourDirectories[selectedIndex]);
}
this->menu->SetSelectedIndex(0);
@ -113,7 +115,8 @@ namespace inst::ui {
for (long unsigned int i = 0; i < this->selectedTitles.size(); i++) {
if (this->selectedTitles[i] == this->ourFiles[selectedIndex - dirListSize]) this->selectedTitles.erase(this->selectedTitles.begin() + i);
}
} else if (this->menu->GetItems()[selectedIndex]->GetIcon() == "romfs:/images/icons/checkbox-blank-outline.png") this->selectedTitles.push_back(this->ourFiles[selectedIndex - dirListSize]);
}
else if (this->menu->GetItems()[selectedIndex]->GetIcon() == "romfs:/images/icons/checkbox-blank-outline.png") this->selectedTitles.push_back(this->ourFiles[selectedIndex - dirListSize]);
else {
this->followDirectory();
return;
@ -125,7 +128,8 @@ namespace inst::ui {
int dialogResult = -1;
if (this->selectedTitles.size() == 1) {
dialogResult = mainApp->CreateShowDialog("inst.target.desc0"_lang + inst::util::shortenString(std::filesystem::path(this->selectedTitles[0]).filename().string(), 32, true) + "inst.target.desc1"_lang, "common.cancel_desc"_lang, { "inst.target.opt0"_lang, "inst.target.opt1"_lang }, false);
} else dialogResult = mainApp->CreateShowDialog("inst.target.desc00"_lang + std::to_string(this->selectedTitles.size()) + "inst.target.desc01"_lang, "common.cancel_desc"_lang, {"inst.target.opt0"_lang, "inst.target.opt1"_lang}, false);
}
else dialogResult = mainApp->CreateShowDialog("inst.target.desc00"_lang + std::to_string(this->selectedTitles.size()) + "inst.target.desc01"_lang, "common.cancel_desc"_lang, { "inst.target.opt0"_lang, "inst.target.opt1"_lang }, false);
if (dialogResult == -1) return;
nspInstStuff_B::installNspFromFile(this->selectedTitles, dialogResult);
}

View File

@ -26,7 +26,8 @@ namespace inst::ui {
inst::ui::appletFinished = true;
mainApp->CreateShowDialog("main.applet.title"_lang, "main.applet.desc"_lang, { "common.ok"_lang }, true);
}
} else if (!appletFinished) {
}
else if (!appletFinished) {
inst::ui::appletFinished = true;
tin::data::NUM_BUFFER_SEGMENTS = 128;
}
@ -125,7 +126,8 @@ namespace inst::ui {
mainApp->HDinstPage->drawMenuItems(true, nx::hdd::rootPath());
mainApp->HDinstPage->menu->SetSelectedIndex(0);
mainApp->LoadLayout(mainApp->HDinstPage);
} else {
}
else {
inst::ui::mainApp->CreateShowDialog("main.hdd.title"_lang, "main.hdd.notfound"_lang, { "common.ok"_lang }, true);
}
}

View File

@ -69,7 +69,8 @@ namespace inst::ui {
for (long unsigned int i = 0; i < this->selectedUrls.size(); i++) {
if (this->selectedUrls[i] == this->ourUrls[selectedIndex]) this->selectedUrls.erase(this->selectedUrls.begin() + i);
}
} else this->selectedUrls.push_back(this->ourUrls[selectedIndex]);
}
else this->selectedUrls.push_back(this->ourUrls[selectedIndex]);
this->drawMenuItems(false);
}
@ -83,7 +84,8 @@ namespace inst::ui {
if (!this->ourUrls.size()) {
mainApp->LoadLayout(mainApp->mainPage);
return;
} else if (this->ourUrls[0] == "supplyUrl") {
}
else if (this->ourUrls[0] == "supplyUrl") {
std::string keyboardResult;
switch (mainApp->CreateShowDialog("inst.net.src.title"_lang, "common.cancel_desc"_lang, { "inst.net.src.opt0"_lang, "inst.net.src.opt1"_lang }, false)) {
case 0:
@ -117,7 +119,8 @@ namespace inst::ui {
}
this->startNetwork();
return;
} else {
}
else {
mainApp->CallForRender(); // If we re-render a few times during this process the main screen won't flicker
sourceString = "inst.net.source_string"_lang;
this->pageInfoText->SetText("inst.net.top_info"_lang);
@ -138,7 +141,8 @@ namespace inst::ui {
if (this->alternativeNames.size() > 0) ourUrlString = inst::util::shortenString(this->alternativeNames[0], 32, true);
else ourUrlString = inst::util::shortenString(inst::util::formatUrlString(this->selectedUrls[0]), 32, true);
dialogResult = mainApp->CreateShowDialog("inst.target.desc0"_lang + ourUrlString + "inst.target.desc1"_lang, "common.cancel_desc"_lang, { "inst.target.opt0"_lang, "inst.target.opt1"_lang }, false);
} else dialogResult = mainApp->CreateShowDialog("inst.target.desc00"_lang + std::to_string(this->selectedUrls.size()) + "inst.target.desc01"_lang, "common.cancel_desc"_lang, {"inst.target.opt0"_lang, "inst.target.opt1"_lang}, false);
}
else dialogResult = mainApp->CreateShowDialog("inst.target.desc00"_lang + std::to_string(this->selectedUrls.size()) + "inst.target.desc01"_lang, "common.cancel_desc"_lang, { "inst.target.opt0"_lang, "inst.target.opt1"_lang }, false);
if (dialogResult == -1 && !urlMode) return;
else if (dialogResult == -1 && urlMode) {
this->startNetwork();

View File

@ -66,7 +66,8 @@ namespace inst::ui {
inst::zip::extractFile(downloadName, "sdmc:/");
std::filesystem::remove(downloadName);
mainApp->CreateShowDialog("options.update.complete"_lang, "options.update.end_desc"_lang, { "common.ok"_lang }, false);
} catch (...) {
}
catch (...) {
mainApp->CreateShowDialog("options.update.failed"_lang, "options.update.end_desc"_lang, { "common.ok"_lang }, false);
}
mainApp->FadeOut();
@ -167,7 +168,8 @@ namespace inst::ui {
case 1:
if (inst::config::validateNCAs) {
if (inst::ui::mainApp->CreateShowDialog("options.nca_warn.title"_lang, "options.nca_warn.desc"_lang, { "common.cancel"_lang, "options.nca_warn.opt1"_lang }, false) == 1) inst::config::validateNCAs = false;
} else inst::config::validateNCAs = true;
}
else inst::config::validateNCAs = true;
inst::config::setConfig();
this->setMenuText();
break;

View File

@ -47,7 +47,8 @@ namespace inst::ui {
try {
this->ourDirectories = util::getDirsAtPath(this->currentDir);
this->ourFiles = util::getDirectoryFiles(this->currentDir, { ".nsp", ".nsz", ".xci", ".xcz" });
} catch (std::exception& e) {
}
catch (std::exception& e) {
this->drawMenuItems(false, this->currentDir.parent_path());
return;
}
@ -90,7 +91,8 @@ namespace inst::ui {
if (selectedIndex < dirListSize) {
if (this->menu->GetItems()[this->menu->GetSelectedIndex()]->GetName() == ".." && this->menu->GetSelectedIndex() == 0) {
this->drawMenuItems(true, this->currentDir.parent_path());
} else {
}
else {
this->drawMenuItems(true, this->ourDirectories[selectedIndex]);
}
this->menu->SetSelectedIndex(0);
@ -104,7 +106,8 @@ namespace inst::ui {
for (long unsigned int i = 0; i < this->selectedTitles.size(); i++) {
if (this->selectedTitles[i] == this->ourFiles[selectedIndex - dirListSize]) this->selectedTitles.erase(this->selectedTitles.begin() + i);
}
} else if (this->menu->GetItems()[selectedIndex]->GetIcon() == "romfs:/images/icons/checkbox-blank-outline.png") this->selectedTitles.push_back(this->ourFiles[selectedIndex - dirListSize]);
}
else if (this->menu->GetItems()[selectedIndex]->GetIcon() == "romfs:/images/icons/checkbox-blank-outline.png") this->selectedTitles.push_back(this->ourFiles[selectedIndex - dirListSize]);
else {
this->followDirectory();
return;
@ -116,7 +119,8 @@ namespace inst::ui {
int dialogResult = -1;
if (this->selectedTitles.size() == 1) {
dialogResult = mainApp->CreateShowDialog("inst.target.desc0"_lang + inst::util::shortenString(std::filesystem::path(this->selectedTitles[0]).filename().string(), 32, true) + "inst.target.desc1"_lang, "common.cancel_desc"_lang, { "inst.target.opt0"_lang, "inst.target.opt1"_lang }, false);
} else dialogResult = mainApp->CreateShowDialog("inst.target.desc00"_lang + std::to_string(this->selectedTitles.size()) + "inst.target.desc01"_lang, "common.cancel_desc"_lang, {"inst.target.opt0"_lang, "inst.target.opt1"_lang}, false);
}
else dialogResult = mainApp->CreateShowDialog("inst.target.desc00"_lang + std::to_string(this->selectedTitles.size()) + "inst.target.desc01"_lang, "common.cancel_desc"_lang, { "inst.target.opt0"_lang, "inst.target.opt1"_lang }, false);
if (dialogResult == -1) return;
nspInstStuff::installNspFromFile(this->selectedTitles, dialogResult);
}

View File

@ -63,7 +63,8 @@ namespace inst::ui {
for (long unsigned int i = 0; i < this->selectedTitles.size(); i++) {
if (this->selectedTitles[i] == this->ourTitles[selectedIndex]) this->selectedTitles.erase(this->selectedTitles.begin() + i);
}
} else this->selectedTitles.push_back(this->ourTitles[selectedIndex]);
}
else this->selectedTitles.push_back(this->ourTitles[selectedIndex]);
this->drawMenuItems(false);
}
@ -79,7 +80,8 @@ namespace inst::ui {
if (!this->ourTitles.size()) {
mainApp->LoadLayout(mainApp->mainPage);
return;
} else {
}
else {
mainApp->CallForRender(); // If we re-render a few times during this process the main screen won't flicker
this->pageInfoText->SetText("inst.usb.top_info2"_lang);
this->butText->SetText("inst.usb.buttons2"_lang);

View File

@ -125,7 +125,8 @@ namespace usbInstStuff {
if (ourTitleList[fileItr].compare(ourTitleList[fileItr].size() - 3, 2, "xc") == 0) {
auto usbXCI = std::make_shared<tin::install::xci::USBXCI>(ourTitleList[fileItr]);
installTask = std::make_unique<tin::install::xci::XCIInstallTask>(m_destStorageId, inst::config::ignoreReqVers, usbXCI);
} else {
}
else {
auto usbNSP = std::make_shared<tin::install::nsp::USBNSP>(ourTitleList[fileItr]);
installTask = std::make_unique<tin::install::nsp::NSPInstall>(m_destStorageId, inst::config::ignoreReqVers, usbNSP);
}

View File

@ -23,7 +23,8 @@ int progress_callback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_
if (ultotal) {
int uploadProgress = (int)(((double)ulnow / (double)ultotal) * 100.0);
inst::ui::instPage::setInstBarPerc(uploadProgress);
} else if (dltotal) {
}
else if (dltotal) {
int downloadProgress = (int)(((double)dlnow / (double)dltotal) * 100.0);
inst::ui::instPage::setInstBarPerc(downloadProgress);
}

View File

@ -119,14 +119,16 @@ namespace inst::zip {
int code;
if (i == 0) {
code = unzGoToFirstFile(unz);
} else {
}
else {
code = unzGoToNextFile(unz);
}
i++;
if (code == UNZ_END_OF_LIST_OF_FILE) {
break;
} else {
}
else {
unz_file_pos pos;
unzGetFilePos(unz, &pos);
}

View File

@ -50,9 +50,11 @@ Result awoo_usbCommsInitializeEx(u32 num_interfaces, const awoo_UsbCommsInterfac
if (g_usbCommsInitialized) {
rc = MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized);
} else if (num_interfaces > TOTAL_INTERFACES) {
}
else if (num_interfaces > TOTAL_INTERFACES) {
rc = MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
} else {
}
else {
rc = usbDsInitialize();
if (R_SUCCEEDED(rc)) {
@ -211,7 +213,8 @@ static Result _usbCommsInterfaceInit(u32 intf_ind, const awoo_UsbCommsInterfaceI
{
if (hosversionAtLeast(5, 0, 0)) {
return _usbCommsInterfaceInit5x(intf_ind, info);
} else {
}
else {
return _usbCommsInterfaceInit1x(intf_ind, info);
}
}

View File

@ -152,7 +152,8 @@ namespace inst::util {
if (ourString.size() - ourExtension.size() > (unsigned long)ourLength) {
if (isFile) return (std::string)ourString.substr(0, ourLength) + "(...)" + ourExtension;
else return (std::string)ourString.substr(0, ourLength) + "...";
} else return ourString;
}
else return ourString;
}
std::string readTextFromFile(std::string ourFile) {
@ -233,7 +234,8 @@ namespace inst::util {
clkrstExit();
return { previousHz, hz };
} else {
}
else {
PcvModule pcvModule;
pcvInitialize();
@ -311,7 +313,8 @@ namespace inst::util {
inst::config::updateInfo = ourUpdateInfo;
return ourUpdateInfo;
}
} catch (...) {}
}
catch (...) {}
return {};
}