diff --git a/Makefile b/Makefile index 326c265..1a15913 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.4.9 +APP_VERSION := 2.5.0 TARGET := $(notdir $(CURDIR)) ROMFS := resources diff --git a/README.md b/README.md index 430d46c..c372cfd 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,9 @@ Copy the `aio-switch-updater/` directory to `/switch/` on your sdcard. ## Description of the features ### ⬦ Update CFW -- Download the most popular Switch CFWs. After downloading the CFW archive, the program will ask you whether you want to override your existing .ini files. If you would like to preserve additional files or directories, write their path (one line each) in `/config/aio-switch-updater/preserve.txt` and they won't be overwritten when updating. +- Download the most popular Switch CFWs. After downloading the CFW archive, the program will ask you whether you want to override your existing .ini files. + - If you would like to preserve additional files or directories, write their path (one line each) in `/config/aio-switch-updater/preserve.txt` and they won't be overwritten when updating. + - Place [this file](https://github.com/HamletDuFromage/aio-switch-updater/blob/master/copy_files.json) in `/config/aio-switch-updater/copy_files.json` in order to have specific copy operations performed after each download. This is mainly meant for users with trinkets who want payloads automatically copied to a directory. ### ⬦ Update Sigpatches - For Atmosphère. Downloads sigpatches, which are patches required for launching unofficial .NSPs. Both AMS and Hekate+AMS sigpatches are available. After downloading the sigpatches archive, the program will ask you whether you want to override your existing .ini files. diff --git a/aiosu-rcm b/aiosu-rcm index 01efdbf..71b9c33 160000 --- a/aiosu-rcm +++ b/aiosu-rcm @@ -1 +1 @@ -Subproject commit 01efdbf864c2597df018bb12895bc5c7650e58f4 +Subproject commit 71b9c33fcb75754712941599837bbcddbd4525e4 diff --git a/include/ams_tab.hpp b/include/ams_tab.hpp index f16c47c..0fe598a 100644 --- a/include/ams_tab.hpp +++ b/include/ams_tab.hpp @@ -10,6 +10,6 @@ class AmsTab : public brls::List brls::Label *description; int size; public: - AmsTab(); + AmsTab(const bool erista); brls::View* getDefaultFocus() override; }; \ No newline at end of file diff --git a/include/confirm_page.hpp b/include/confirm_page.hpp index ef7dbe7..46a083e 100644 --- a/include/confirm_page.hpp +++ b/include/confirm_page.hpp @@ -11,9 +11,10 @@ class ConfirmPage : public brls::View std::chrono::system_clock::time_point start = std::chrono::high_resolution_clock::now(); bool done = false; bool reboot = false; + bool erista = true; public: - ConfirmPage(brls::StagedAppletFrame* frame, std::string text, bool done = false, bool reboot= false); + ConfirmPage(brls::StagedAppletFrame* frame, std::string text, bool done = false, bool reboot = false, bool erista = true); ~ConfirmPage(); void draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) override; diff --git a/include/constants.hpp b/include/constants.hpp index f08d9b9..42c116e 100644 --- a/include/constants.hpp +++ b/include/constants.hpp @@ -8,6 +8,8 @@ constexpr const char CONFIG_PATH[] = "/config/aio-switch-updater/"; constexpr const char CONFIG_PATH_UNZIP[] = "config\\aio-switch-updater"; constexpr const char RCM_PAYLOAD_PATH[] = "romfs:/aio_rcm.bin"; +constexpr const char MARIKO_PAYLOAD_PATH[] = "/payload.bin"; +constexpr const char MARIKO_PAYLOAD_PATH_TEMP[] = "/payload.bin.aio"; constexpr const char APP_URL[] = "https://github.com/HamletDuFromage/aio-switch-updater/releases/latest/download/aio-switch-updater.zip"; constexpr const char TAGS_INFO[] = "https://api.github.com/repos/HamletDuFromage/aio-switch-updater/releases/latest"; diff --git a/include/dialogue_page.hpp b/include/dialogue_page.hpp index 4fa75ff..348d13b 100644 --- a/include/dialogue_page.hpp +++ b/include/dialogue_page.hpp @@ -9,9 +9,10 @@ class DialoguePage : public brls::View brls::Button* button2 = nullptr; brls::Label* label = nullptr; brls::NavigationMap navigationMap; + bool erista = true; public: - DialoguePage(brls::StagedAppletFrame* frame, std::string text); + DialoguePage(brls::StagedAppletFrame* frame, std::string text, bool erista = true); void draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) override; void layout(NVGcontext* vg, brls::Style* style, brls::FontStash* stash) override; diff --git a/resources/i18n/en-US/menus.json b/resources/i18n/en-US/menus.json index ac1a201..12d1adc 100644 --- a/resources/i18n/en-US/menus.json +++ b/resources/i18n/en-US/menus.json @@ -126,6 +126,7 @@ "pro_cons": "Change the Pro Controller color", "dl_payloads": "Download payloads to ", "inject_payloads": "Inject payload", + "getting_payload": "Getting payload", "update_app": "Update the app (v", "dl_app": "Downloading:\nAIO-switch-updater\n\nFrom:\n", "changelog": "Changelog", @@ -151,7 +152,9 @@ "install_hekate": "Do you want to also download Hekate?\nIf not, the Switch will now reboot to a special payload in order to finalise the install.", "delete_contents": "Would you like to remove the existing '/atmosphere/contents/' directory? This will prevent crashes if you have sysmodules that do not support the latest Atmosph\u00e8re. Please note that it will delete all your existing sysmodules, mods and cheats.", "delete_sysmodules_flags": "Would you like to delete all the custom sysmodules startup flags? This will turn off all your sysmodules and prevent crashes if you have sysmodules that do not support the latest Atmosphère.", - "current_ams": "\ue016 Current Atmosphère: " + "current_ams": "\ue016 Current Atmosphère: ", + "erista_rev": "\ue016 Erista revision", + "mariko_rev": "\ue016 Mariko revision" }, "net": { "title": "Internet settings" diff --git a/source/ams_tab.cpp b/source/ams_tab.cpp index c0d9650..bc5102d 100644 --- a/source/ams_tab.cpp +++ b/source/ams_tab.cpp @@ -11,12 +11,12 @@ namespace i18n = brls::i18n; using namespace i18n::literals; -AmsTab::AmsTab() : +AmsTab::AmsTab(const bool erista) : brls::List() { std::vector> links; std::string operation("menus/main/getting"_i18n); - this->description = new brls::Label(brls::LabelStyle::DESCRIPTION, "menus/main/ams_text"_i18n + (CurrentCfw::running_cfw == CFW::ams ? "\n" + "menus/ams_update/current_ams"_i18n + CurrentCfw::getAmsInfo() : ""), true); + this->description = new brls::Label(brls::LabelStyle::DESCRIPTION, "menus/main/ams_text"_i18n + (CurrentCfw::running_cfw == CFW::ams ? "\n" + "menus/ams_update/current_ams"_i18n + CurrentCfw::getAmsInfo() : "") + (erista ? "\n" + "menus/ams_update/ersita_rev"_i18n : "\n" + "menus/ams_update/mariko_rev"_i18n), true); this->addView(description); operation += "menus/main/ams"_i18n; links = download::getLinks(AMS_URL); @@ -56,7 +56,7 @@ AmsTab::AmsTab() : ); } stagedFrame->addStage( - new ConfirmPage(stagedFrame, "menus/ams_update/reboot_rcm"_i18n, false, true) + new ConfirmPage(stagedFrame, "menus/ams_update/reboot_rcm"_i18n, false, true, erista) ); brls::Application::pushView(stagedFrame); }); diff --git a/source/changelog_page.cpp b/source/changelog_page.cpp index 7fbfd1f..92a25b1 100644 --- a/source/changelog_page.cpp +++ b/source/changelog_page.cpp @@ -145,6 +145,9 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true) verTitles.push_back("v2.4.9"); changes.push_back("\uE016 Fixed some read-only files not being properly extracted thus preventing updating."); + verTitles.push_back("v2.5.0"); + changes.push_back("\uE016 Added ability to update Atmosphère for Mariko (ie patched) switches."); + for(int i = verTitles.size() -1 ; i >= 0; i--){ listItem = new brls::ListItem(verTitles[i]); change = changes[i]; diff --git a/source/confirm_page.cpp b/source/confirm_page.cpp index 7b6c966..ff148ab 100644 --- a/source/confirm_page.cpp +++ b/source/confirm_page.cpp @@ -1,12 +1,15 @@ #include "confirm_page.hpp" #include "utils.hpp" #include "main_frame.hpp" +#include "fs.hpp" #include "reboot_payload.h" #include - +#include +#include + namespace i18n = brls::i18n; using namespace i18n::literals; -ConfirmPage::ConfirmPage(brls::StagedAppletFrame* frame, std::string text, bool done, bool reboot): done(done), reboot(reboot) +ConfirmPage::ConfirmPage(brls::StagedAppletFrame* frame, std::string text, bool done, bool reboot, bool erista): done(done), reboot(reboot), erista(erista) { this->button = (new brls::Button(brls::ButtonStyle::REGULAR))->setLabel(done ? "menus/common/back"_i18n : "menus/common/continue"_i18n); this->button->setParent(this); @@ -17,8 +20,19 @@ ConfirmPage::ConfirmPage(brls::StagedAppletFrame* frame, std::string text, bool else if (this->done) { brls::Application::pushView(new MainFrame()); } - else if (this->reboot){ - reboot_to_payload(RCM_PAYLOAD_PATH); + else if (this->reboot) { + if(this->erista) + reboot_to_payload(RCM_PAYLOAD_PATH); + else { + if(std::filesystem::exists(UPDATE_BIN_PATH)) { + fs::copyFile(UPDATE_BIN_PATH, MARIKO_PAYLOAD_PATH_TEMP); + } + else { + fs::copyFile(REBOOT_PAYLOAD_PATH, MARIKO_PAYLOAD_PATH_TEMP); + } + fs::copyFile(RCM_PAYLOAD_PATH, MARIKO_PAYLOAD_PATH); + util::shutDown(true); + } } }); diff --git a/source/dialogue_page.cpp b/source/dialogue_page.cpp index 32de4e3..70ddf51 100644 --- a/source/dialogue_page.cpp +++ b/source/dialogue_page.cpp @@ -2,11 +2,14 @@ #include "utils.hpp" #include "reboot_payload.h" #include "main_frame.hpp" +#include "fs.hpp" +#include + namespace i18n = brls::i18n; using namespace i18n::literals; -DialoguePage::DialoguePage(brls::StagedAppletFrame* frame, std::string text) +DialoguePage::DialoguePage(brls::StagedAppletFrame* frame, std::string text, bool ersita) : erista(erista) { this->button1 = (new brls::Button(brls::ButtonStyle::REGULAR))->setLabel("menus/common/yes"_i18n); this->button1->setParent(this); @@ -21,7 +24,18 @@ DialoguePage::DialoguePage(brls::StagedAppletFrame* frame, std::string text) }); this->button2->getClickEvent()->subscribe([frame, this](View* view) { - reboot_to_payload(RCM_PAYLOAD_PATH); + if(this->erista) + reboot_to_payload(RCM_PAYLOAD_PATH); + else { + if(std::filesystem::exists(UPDATE_BIN_PATH)) { + fs::copyFile(UPDATE_BIN_PATH, MARIKO_PAYLOAD_PATH_TEMP); + } + else { + fs::copyFile(REBOOT_PAYLOAD_PATH, MARIKO_PAYLOAD_PATH_TEMP); + } + fs::copyFile(RCM_PAYLOAD_PATH, MARIKO_PAYLOAD_PATH); + util::shutDown(true); + } brls::Application::popView(); }); diff --git a/source/download_payload_page.cpp b/source/download_payload_page.cpp index ddf2504..5b5b304 100644 --- a/source/download_payload_page.cpp +++ b/source/download_payload_page.cpp @@ -28,7 +28,7 @@ DownloadPayloadPage::DownloadPayloadPage() : AppletFrame(true, true) listItem->getClickEvent()->subscribe([&, text, url, path](brls::View* view) { fs::createTree(BOOTLOADER_PL_PATH); brls::StagedAppletFrame* stagedFrame = new brls::StagedAppletFrame(); - stagedFrame->setTitle("menus/getting_paylaod"_i18n); + stagedFrame->setTitle("menus/tools/getting_payload"_i18n); stagedFrame->addStage( new ConfirmPage(stagedFrame, text) ); @@ -36,7 +36,7 @@ DownloadPayloadPage::DownloadPayloadPage() : AppletFrame(true, true) new WorkerPage(stagedFrame, "menus/common/downloading"_i18n, [url, path](){download::downloadFile(url.c_str(), path.c_str(), OFF);}) ); stagedFrame->addStage( - new ConfirmPage(stagedFrame, "menus/common/downloadingload_all_done"_i18n, true) + new ConfirmPage(stagedFrame, "menus/common/all_done"_i18n, true) ); brls::Application::pushView(stagedFrame); }); diff --git a/source/main_frame.cpp b/source/main_frame.cpp index c62ba6f..a511c8d 100644 --- a/source/main_frame.cpp +++ b/source/main_frame.cpp @@ -25,13 +25,14 @@ MainFrame::MainFrame() : TabFrame() json hideStatus = fs::parseJsonFile(HIDE_TABS_JSON); - bool erista = util::isErista(); + //bool erista = util::isErista(); + bool erista = false; if(hideStatus.find("about") == hideStatus.end() || !hideStatus["about"]) this->addTab("menus/main/about"_i18n, new AboutTab()); - if(erista && (hideStatus.find("atmosphere") == hideStatus.end() || !hideStatus["atmosphere"])) - this->addTab("menus/main/update_ams"_i18n, new AmsTab()); + if(hideStatus.find("atmosphere") == hideStatus.end() || !hideStatus["atmosphere"]) + this->addTab("menus/main/update_ams"_i18n, new AmsTab(erista)); if(hideStatus.find("cfw") == hideStatus.end() || !hideStatus["cfw"]) this->addTab("menus/main/update_cfw"_i18n, new ListDownloadTab(archiveType::cfw)); diff --git a/source/payload_page.cpp b/source/payload_page.cpp index ff9446e..1194519 100644 --- a/source/payload_page.cpp +++ b/source/payload_page.cpp @@ -74,7 +74,7 @@ PayloadPage::PayloadPage() : AppletFrame(true, true) }); list->addView(shutDown); - reboot = new brls::ListItem("menus/payloads/reboot"_i18n); + reboot = new brls::ListItem("menus/common/reboot"_i18n); reboot->getClickEvent()->subscribe([](brls::View* view) { util::shutDown(true); brls::Application::popView();