1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2025-03-03 12:45:43 +00:00

Support for AMS updates on patched switches

This commit is contained in:
flb 2021-05-21 18:12:58 +02:00
parent 07c6c24b0e
commit 2323974302
15 changed files with 63 additions and 22 deletions

View file

@ -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

View file

@ -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.

@ -1 +1 @@
Subproject commit 01efdbf864c2597df018bb12895bc5c7650e58f4
Subproject commit 71b9c33fcb75754712941599837bbcddbd4525e4

View file

@ -10,6 +10,6 @@ class AmsTab : public brls::List
brls::Label *description;
int size;
public:
AmsTab();
AmsTab(const bool erista);
brls::View* getDefaultFocus() override;
};

View file

@ -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;

View file

@ -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";

View file

@ -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;

View file

@ -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"

View file

@ -11,12 +11,12 @@
namespace i18n = brls::i18n;
using namespace i18n::literals;
AmsTab::AmsTab() :
AmsTab::AmsTab(const bool erista) :
brls::List()
{
std::vector<std::pair<std::string, std::string>> 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);
});

View file

@ -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];

View file

@ -1,12 +1,15 @@
#include "confirm_page.hpp"
#include "utils.hpp"
#include "main_frame.hpp"
#include "fs.hpp"
#include "reboot_payload.h"
#include <algorithm>
#include <filesystem>
#include <string>
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);
}
}
});

View file

@ -2,11 +2,14 @@
#include "utils.hpp"
#include "reboot_payload.h"
#include "main_frame.hpp"
#include "fs.hpp"
#include <filesystem>
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();
});

View file

@ -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);
});

View file

@ -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));

View file

@ -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();