mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-12-29 10:56:01 +00:00
Fixed bugs previously caused by tickering labels. (close https://github.com/HamletDuFromage/aio-switch-updater/issues/91)
When needed, issue a warning about custom themes after downloading a new firmware. (closes https://github.com/HamletDuFromage/aio-switch-updater/issues/109 and https://github.com/HamletDuFromage/aio-switch-updater/issues/84) Abort AMS update process for Mariko Switches when payload.bin cannot be found. (closes https://github.com/HamletDuFromage/aio-switch-updater/issues/110)
This commit is contained in:
parent
5d37786067
commit
4688d62541
13 changed files with 57 additions and 86 deletions
2
Makefile
2
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
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace extract {
|
|||
void writeTitlesToFile(const std::set<std::string>& titles, const std::string& path);
|
||||
void extractCheats(const std::string& zipPath, std::vector<std::string> 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);
|
||||
|
||||
}
|
|
@ -41,4 +41,5 @@ namespace util {
|
|||
std::string upperCase(const std::string& str);
|
||||
std::string getErrorMessage(long status_code);
|
||||
bool isApplet();
|
||||
std::string getContentsPath();
|
||||
}
|
|
@ -1 +1 @@
|
|||
Subproject commit 909b3baef58ca594dfe4ab691d9be14b28c17417
|
||||
Subproject commit b310da0108893bd7dc25aabb71e11951db30bbf9
|
|
@ -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",
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "current_cfw.hpp"
|
||||
#include "fs.hpp"
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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]);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -297,7 +297,7 @@ bool isBID(std::string bid) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void writeTitlesToFile(const std::set<std::string>& titles, const std::string& path){
|
||||
void writeTitlesToFile(const std::set<std::string>& titles, const std::string& path) {
|
||||
std::ofstream updatedTitlesFile;
|
||||
std::set<std::string>::iterator it = titles.begin();
|
||||
updatedTitlesFile.open(path, std::ofstream::out | std::ofstream::trunc);
|
||||
|
@ -310,19 +310,8 @@ void writeTitlesToFile(const std::set<std::string>& 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)){
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -303,8 +303,19 @@ bool isApplet() {
|
|||
}
|
||||
|
||||
std::set<std::string> getExistingCheatsTids() {
|
||||
std::string path;
|
||||
std::string path = getContentsPath();
|
||||
std::set<std::string> 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<std::string> 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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue