diff --git a/Makefile b/Makefile index 96c4a6d..20b7dfc 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DATA := data INCLUDES := include lib/zipper/include /lib/borealis/library/include/borealis/extern/nlohmann APP_TITLE := All-in-One Switch Updater APP_AUTHOR := HamletDuFromage -APP_VERSION := 2.10.2 +APP_VERSION := 2.11.0 TARGET := $(notdir $(CURDIR)) ROMFS := resources diff --git a/include/extract.hpp b/include/extract.hpp index c967e5d..db4db2e 100644 --- a/include/extract.hpp +++ b/include/extract.hpp @@ -29,7 +29,7 @@ namespace extract { void writeTitlesToFile(const std::set& titles, const std::string& path); void extractCheats(const std::string& zipPath, std::vector titles, CFW cfw, bool credits = false); void extractAllCheats(const std::string& zipPath, CFW cfw); - void removeCheats(CFW cfw); + void removeCheats(); bool isBID(std::string bid); } \ No newline at end of file diff --git a/include/utils.hpp b/include/utils.hpp index 9397c1d..94d16c8 100644 --- a/include/utils.hpp +++ b/include/utils.hpp @@ -41,4 +41,5 @@ namespace util { std::string upperCase(const std::string& str); std::string getErrorMessage(long status_code); bool isApplet(); + std::string getContentsPath(); } \ No newline at end of file diff --git a/lib/borealis b/lib/borealis index 909b3ba..b310da0 160000 --- a/lib/borealis +++ b/lib/borealis @@ -1 +1 @@ -Subproject commit 909b3baef58ca594dfe4ab691d9be14b28c17417 +Subproject commit b310da0108893bd7dc25aabb71e11951db30bbf9 diff --git a/resources/i18n/en-US/menus.json b/resources/i18n/en-US/menus.json index fc0424a..57bc5b7 100644 --- a/resources/i18n/en-US/menus.json +++ b/resources/i18n/en-US/menus.json @@ -129,7 +129,8 @@ "download_cheats": "Download cheats", "tools": "Tools", "launch_warning": "Please pay attention to the following points before using the app:\n\n\ue016 Read up on how to manually update your Switch first. This will help you understand the app better and you'll know what to do in case something goes wrong.\n\ue016 Please note that using this app on a exFAT SD card is STRONGLY discouraged, as those are likely to corrupt.\n\n\ue016 Some new features and/or changes regarding current features may have been introduced. Please check them out via the Tools->Changelog menu.\n\nThis screen won't show again.", - "footer_text" : "v{} | {:.1f}GB available" + "footer_text" : "v{} | {:.1f}GB available", + "theme_warning": "It seems like you have a custom theme installed, this may cause your system to fail to boot after upgrading your firmware.\nPlease consider deleting it before upgrading." }, "hide": { "title": "Hide tabs", @@ -187,7 +188,8 @@ }, "errors": { "insufficient_storage": "There isn't enough space available on your SD card to perform this operation.", - "error_message": "{}\nPlease try again in a little while. If the problem persists, open an issue on Github" + "error_message": "{}\nPlease try again in a little while. If the problem persists, open an issue on Github", + "mariko_payload_missing": "In order to update Atmosphère on patched Switches, your payload needs to be named \"payload.bin\" and should be at the root of your SD card." }, "language": { "system_default": "System default", diff --git a/source/ams_tab.cpp b/source/ams_tab.cpp index f7a5fec..5d4e419 100644 --- a/source/ams_tab.cpp +++ b/source/ams_tab.cpp @@ -8,6 +8,7 @@ #include "current_cfw.hpp" #include "fs.hpp" #include +#include namespace i18n = brls::i18n; using namespace i18n::literals; @@ -72,7 +73,12 @@ void AmsTab::CreateDownloadItems(const nlohmann::ordered_json& cfw_links, bool h listItem = new brls::ListItem(link.first); listItem->setHeight(LISTITEM_HEIGHT); listItem->getClickEvent()->subscribe([&, this, text, text_hekate, url, hekate_url, operation, hekate](brls::View* view) { - CreateStagedFrames(text, url, operation, erista, hekate, text_hekate, hekate_url); + if(!erista && !std::filesystem::exists(MARIKO_PAYLOAD_PATH)) { + brls::Application::crash("menus/errors/mariko_payload_missing"_i18n); + } + else { + CreateStagedFrames(text, url, operation, erista, hekate, text_hekate, hekate_url); + } }); this->addView(listItem); } diff --git a/source/app_page.cpp b/source/app_page.cpp index 99ccc96..0789111 100644 --- a/source/app_page.cpp +++ b/source/app_page.cpp @@ -283,18 +283,7 @@ void AppPage_DownloadedCheats::DeclareGameListItem(const std::string& name, u64 } void AppPage_DownloadedCheats::GetExistingCheatsTids() { - std::string path; - switch(CurrentCfw::running_cfw){ - case CFW::ams: - path = std::string(AMS_PATH) + std::string(CONTENTS_PATH); - break; - case CFW::rnx: - path = std::string(REINX_PATH) + std::string(CONTENTS_PATH); - break; - case CFW::sxos: - path = std::string(SXOS_PATH) + std::string(TITLES_PATH); - break; - } + std::string path = util::getContentsPath(); for(const auto& entry : std::filesystem::directory_iterator(path)) { std::string cheatsPath = entry.path().string() + "/cheats"; if(std::filesystem::exists(cheatsPath) && !std::filesystem::is_empty(cheatsPath)) { @@ -309,18 +298,7 @@ void AppPage_DownloadedCheats::GetExistingCheatsTids() { } void AppPage_DownloadedCheats::ShowCheatFiles(u64 tid, const std::string& name) { - std::string path; - switch(CurrentCfw::running_cfw){ - case CFW::ams: - path = std::string(AMS_PATH) + std::string(CONTENTS_PATH); - break; - case CFW::rnx: - path = std::string(REINX_PATH) + std::string(CONTENTS_PATH); - break; - case CFW::sxos: - path = std::string(SXOS_PATH) + std::string(TITLES_PATH); - break; - } + std::string path = util::getContentsPath(); path += util::formatApplicationId(tid) + "/cheats/"; brls::TabFrame* appView = new brls::TabFrame(); @@ -365,7 +343,7 @@ bool AppPage_DownloadedCheats::CreateCheatList(const std::filesystem::path& path } } if(res) { - (*appView)->addTab(path.filename().stem(), cheatsList); + (*appView)->addTab(util::upperCase(path.filename().stem()), cheatsList); } return res; } \ No newline at end of file diff --git a/source/changelog_page.cpp b/source/changelog_page.cpp index 45e0a9a..9bca656 100644 --- a/source/changelog_page.cpp +++ b/source/changelog_page.cpp @@ -178,8 +178,8 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true) verTitles.push_back("v2.10.1"); changes.push_back("\uE016 Fixed crashes in airplane mode introduced in 2.10.0"); - verTitles.push_back("v2.10.2"); - changes.push_back("\uE016 Borealis changes for visual tweaks (tickering labels, scroll bar etc)."); + verTitles.push_back("v2.11.0"); + changes.push_back("\uE016 Borealis changes for visual tweaks (tickering labels, scroll bar etc).\n\uE016 When needed, issue a warning about custom themes after downloading a new firmware.\n\uE016 Abort AMS update process for Mariko Switches when payload.bin cannot be found."); for(int i = verTitles.size() -1 ; i >= 0; i--){ listItem = new brls::ListItem(verTitles[i]); diff --git a/source/cheats_page.cpp b/source/cheats_page.cpp index bfe4982..8758da0 100644 --- a/source/cheats_page.cpp +++ b/source/cheats_page.cpp @@ -34,7 +34,7 @@ CheatsPage::CheatsPage() : AppletFrame(true, true) stagedFrame = new brls::StagedAppletFrame(); stagedFrame->setTitle("menus/cheats/delete_all"_i18n); stagedFrame->addStage( - new WorkerPage(stagedFrame, "menus/cheats/deleting"_i18n, [](){extract::removeCheats(CurrentCfw::running_cfw);}) + new WorkerPage(stagedFrame, "menus/cheats/deleting"_i18n, [](){extract::removeCheats();}) ); stagedFrame->addStage( new ConfirmPage(stagedFrame, "menus/common/all_done"_i18n, true) diff --git a/source/download_cheats_page.cpp b/source/download_cheats_page.cpp index 68c4f68..63681f2 100644 --- a/source/download_cheats_page.cpp +++ b/source/download_cheats_page.cpp @@ -71,19 +71,8 @@ void DownloadCheatsPage::GetBuildIDFromFile() { } void DownloadCheatsPage::WriteCheats(std::string cheatContent) { - std::string path; + std::string path = util::getContentsPath(); std::string tidstr = util::formatApplicationId(this->tid); - switch(CurrentCfw::running_cfw){ - case CFW::ams: - path = std::string(AMS_PATH) + std::string(CONTENTS_PATH); - break; - case CFW::rnx: - path = std::string(REINX_PATH) + std::string(CONTENTS_PATH); - break; - case CFW::sxos: - path = std::string(SXOS_PATH) + std::string(TITLES_PATH); - break; - } path += tidstr + "/cheats/"; fs::createTree(path); path += this->bid + ".txt"; @@ -96,19 +85,7 @@ void DownloadCheatsPage::WriteCheats(std::string cheatContent) { } void DownloadCheatsPage::DeleteCheats() { - std::string path; - switch(CurrentCfw::running_cfw){ - case CFW::ams: - path = std::string(AMS_PATH) + std::string(CONTENTS_PATH); - break; - case CFW::rnx: - path = std::string(REINX_PATH) + std::string(CONTENTS_PATH); - break; - case CFW::sxos: - path = std::string(SXOS_PATH) + std::string(TITLES_PATH); - break; - } - std::filesystem::remove(path + util::formatApplicationId(this->tid) + "/cheats/" + this->bid + ".txt"); + std::filesystem::remove(util::getContentsPath() + util::formatApplicationId(this->tid) + "/cheats/" + this->bid + ".txt"); } DownloadCheatsPage_CheatSlips::DownloadCheatsPage_CheatSlips(uint64_t tid, const std::string& name) : DownloadCheatsPage(tid, name) diff --git a/source/extract.cpp b/source/extract.cpp index 9829f27..39bbcc2 100644 --- a/source/extract.cpp +++ b/source/extract.cpp @@ -297,7 +297,7 @@ bool isBID(std::string bid) { return true; } -void writeTitlesToFile(const std::set& titles, const std::string& path){ +void writeTitlesToFile(const std::set& titles, const std::string& path) { std::ofstream updatedTitlesFile; std::set::iterator it = titles.begin(); updatedTitlesFile.open(path, std::ofstream::out | std::ofstream::trunc); @@ -310,19 +310,8 @@ void writeTitlesToFile(const std::set& titles, const std::string& p } } -void removeCheats(CFW cfw){ - std::string path; - switch(cfw){ - case CFW::ams: - path = std::string(AMS_PATH) + std::string(CONTENTS_PATH); - break; - case CFW::rnx: - path = std::string(REINX_PATH) + std::string(CONTENTS_PATH); - break; - case CFW::sxos: - path = std::string(SXOS_PATH) + std::string(TITLES_PATH); - break; - } +void removeCheats() { + std::string path = util::getContentsPath(); ProgressEvent::instance().reset(); ProgressEvent::instance().setTotalSteps(std::distance(std::filesystem::directory_iterator(path), std::filesystem::directory_iterator())); for (const auto& entry : std::filesystem::directory_iterator(path)){ diff --git a/source/list_download_tab.cpp b/source/list_download_tab.cpp index e56f5c3..1b6d6a2 100644 --- a/source/list_download_tab.cpp +++ b/source/list_download_tab.cpp @@ -98,12 +98,25 @@ ListDownloadTab::ListDownloadTab(const archiveType type) : stagedFrame->addStage( new WorkerPage(stagedFrame, "menus/common/extracting"_i18n, [type](){util::extractArchive(type);}) ); + std::string doneMsg = "menus/common/all_done"_i18n; + std::string themePath; + switch(type){ + case archiveType::ams_cfw: + case archiveType::app: + case archiveType::cfw: + case archiveType::cheats: + case archiveType::fw: + themePath = util::getContentsPath() + "0100000000010000"; + if(std::filesystem::exists(themePath) && !std::filesystem::is_empty(themePath)) { + doneMsg += "\n" + "menus/main/theme_warning"_i18n; + } + break; + case archiveType::sigpatches: + doneMsg += "\n" + "menus/sigpatches/reboot"_i18n; + break; + } stagedFrame->addStage( - new ConfirmPage(stagedFrame, - (type == archiveType::sigpatches) ? - "menus/common/all_done"_i18n + "\n" + "menus/sigpatches/reboot"_i18n : - "menus/common/all_done"_i18n, - true) + new ConfirmPage(stagedFrame, doneMsg, true) ); brls::Application::pushView(stagedFrame); }); diff --git a/source/utils.cpp b/source/utils.cpp index 2bc7882..64f7bcd 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -303,8 +303,19 @@ bool isApplet() { } std::set getExistingCheatsTids() { - std::string path; + std::string path = getContentsPath(); std::set res; + for(const auto& entry : std::filesystem::directory_iterator(path)) { + std::string cheatsPath = entry.path().string() + "/cheats"; + if(std::filesystem::exists(cheatsPath)){ + res.insert(util::upperCase(cheatsPath.substr(cheatsPath.length() - 7 - 16, 16))); + } + } + return res; +} + +std::string getContentsPath() { + std::string path; switch(CurrentCfw::running_cfw){ case CFW::ams: path = std::string(AMS_PATH) + std::string(CONTENTS_PATH); @@ -316,13 +327,7 @@ std::set getExistingCheatsTids() { path = std::string(SXOS_PATH) + std::string(TITLES_PATH); break; } - for(const auto& entry : std::filesystem::directory_iterator(path)) { - std::string cheatsPath = entry.path().string() + "/cheats"; - if(std::filesystem::exists(cheatsPath)){ - res.insert(util::upperCase(cheatsPath.substr(cheatsPath.length() - 7 - 16, 16))); - } - } - return res; + return path; } } \ No newline at end of file