diff --git a/README.md b/README.md index 4a53ca3..48882ae 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # AIO-switch-updater ![releases](https://img.shields.io/github/downloads/HamletDuFromage/AIO-switch-updater/total) -![hbappstore](https://img.shields.io/endpoint?url=https://runkit.io/homlet/hbappstore-shieldsio/branches/master?url=https://api.brewtools.dev/store/Switch/?package=aioswitchupdater) +![hbappstore](https://img.shields.io/endpoint?url=https://runkit.io/homlet/hbappstore-shieldsio/branches/master?url=https://switchbru.com/appstore/repo.json&name=aioswitchupdater) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/HamletDuFromage/AIO-switch-updater/Build%20AIO-switch-updater) ![tag](https://img.shields.io/github/v/release/HamletDuFromage/AIO-switch-updater) ![GitHub](https://img.shields.io/github/license/HamletDuFromage/aio-switch-updater) diff --git a/include/ams_tab.hpp b/include/ams_tab.hpp index 8337eec..a04490a 100644 --- a/include/ams_tab.hpp +++ b/include/ams_tab.hpp @@ -21,7 +21,6 @@ private: public: AmsTab(const nlohmann::json& nxlinks, const bool erista = true, const bool hideStandardEntries = false); - brls::View* getDefaultFocus() override; }; class UnTogglableListItem : public brls::ToggleListItem diff --git a/include/download_cheats_page.hpp b/include/download_cheats_page.hpp index 710743c..d210711 100644 --- a/include/download_cheats_page.hpp +++ b/include/download_cheats_page.hpp @@ -12,6 +12,7 @@ namespace show_cheats { void ShowCheatSheet(u64 tid, const std::string& bid, const std::string& name); bool CreateCheatList(const std::filesystem::path& path, brls::List** cheatsList); void NoCheatsFoundPopup(); + void DeleteCheats(u64 tid, const std::string& bid); } // namespace show_cheats @@ -31,7 +32,6 @@ protected: void GetVersion(); void GetBuildIDFromFile(); void WriteCheats(const std::string& cheatContent); - void DeleteCheats(); typedef struct { diff --git a/include/list_download_tab.hpp b/include/list_download_tab.hpp index bbb3c69..8cb43f5 100644 --- a/include/list_download_tab.hpp +++ b/include/list_download_tab.hpp @@ -24,5 +24,4 @@ private: public: ListDownloadTab(const contentType type, const nlohmann::ordered_json& nxlinks = nlohmann::ordered_json::object()); - brls::View* getDefaultFocus() override; }; \ No newline at end of file diff --git a/lib/borealis b/lib/borealis index 5bbadc9..7c6ed9f 160000 --- a/lib/borealis +++ b/lib/borealis @@ -1 +1 @@ -Subproject commit 5bbadc951734876bc74490302de561c1bb0231ad +Subproject commit 7c6ed9fae4f14f3bf5b31e53d57e2c230bd5fccc diff --git a/source/ams_tab.cpp b/source/ams_tab.cpp index c2f124e..c90e4ba 100644 --- a/source/ams_tab.cpp +++ b/source/ams_tab.cpp @@ -81,7 +81,6 @@ void AmsTab::CreateDownloadItems(const nlohmann::ordered_json& cfw_links, bool h }); this->addView(listItem); } - this->size += 1; } else { description = new brls::Label( @@ -214,9 +213,9 @@ void AmsTab::ShowCustomDeepseaBuilder(nlohmann::ordered_json& modules) request_url += e + ";"; this->CreateStagedFrames("menus/common/download"_i18n + "Custom DeepSea package" + "menus/common/from"_i18n + request_url, - request_url, - "menus/ams_update/get_custom_deepsea"_i18n, - this->erista); + request_url, + "menus/ams_update/get_custom_deepsea"_i18n, + this->erista); return true; }); appView->registerAction("", brls::Key::PLUS, [this] { return true; }); @@ -224,14 +223,6 @@ void AmsTab::ShowCustomDeepseaBuilder(nlohmann::ordered_json& modules) brls::PopupFrame::open("menus/ams_update/deepsea_builder"_i18n, appView, modules.empty() ? "menus/ams_update/cant_fetch_deepsea"_i18n : "menus/ams_update/build_your_deepsea"_i18n, ""); } -brls::View* AmsTab::getDefaultFocus() -{ - if (this->size) - return this->brls::List::getDefaultFocus(); - else - return nullptr; -} - bool UnTogglableListItem::onClick() { return true; diff --git a/source/app_page.cpp b/source/app_page.cpp index 11a3749..1257f31 100644 --- a/source/app_page.cpp +++ b/source/app_page.cpp @@ -62,8 +62,6 @@ void AppPage::PopulatePage() } delete[] records; - this->CreateDownloadAllButton(); - this->setContentView(list); } @@ -255,8 +253,6 @@ void AppPage_Exclude::PopulatePage() return true; }); - this->CreateDownloadAllButton(); - this->setContentView(list); } @@ -278,7 +274,7 @@ void AppPage_DownloadedCheats::DeclareGameListItem(const std::string& name, u64 auto tid_str = util::formatApplicationId(tid); if (titles.find(tid_str) != titles.end()) { listItem->getClickEvent()->subscribe([tid, name](brls::View* view) { show_cheats::ShowCheatFiles(tid, name); }); - listItem->registerAction("menus/cheats/delete_cheats"_i18n, brls::Key::Y, [&tid_str] { + listItem->registerAction("menus/cheats/delete_cheats"_i18n, brls::Key::Y, [tid_str] { brls::Dialog* dialog = new brls::Dialog(extract::removeCheatsDirectory(fmt::format("{}{}", util::getContentsPath(), tid_str)) ? "menus/common/all_done"_i18n : fmt::format("menus/cheats/deletion_error"_i18n, tid_str)); brls::GenericEvent::Callback callback = [dialog](brls::View* view) { dialog->close(); diff --git a/source/download_cheats_page.cpp b/source/download_cheats_page.cpp index ca5f807..8726618 100644 --- a/source/download_cheats_page.cpp +++ b/source/download_cheats_page.cpp @@ -23,6 +23,17 @@ namespace show_cheats { brls::List* cheatsList = new brls::List(); if (std::filesystem::exists(path) && CreateCheatList(path, &cheatsList)) { appView->setContentView(cheatsList); + appView->registerAction("menus/cheats/delete_file"_i18n, brls::Key::X, [tid, bid] { + DeleteCheats(tid, bid); + brls::Dialog* dialog = new brls::Dialog("menus/common/all_done"_i18n); + brls::GenericEvent::Callback callback = [dialog](brls::View* view) { + dialog->close(); + }; + dialog->addButton("menus/common/ok"_i18n, callback); + dialog->setCancelable(true); + dialog->open(); + return true; + }); brls::PopupFrame::open(name, appView, ""); } else { @@ -87,27 +98,33 @@ namespace show_cheats { } return res; } + + void DeleteCheats(u64 tid, const std::string& bid) + { + std::filesystem::remove(fmt::format("{}{:016X}/cheats/{}.txt", util::getContentsPath(), tid, bid)); + } } // namespace show_cheats DownloadCheatsPage::DownloadCheatsPage(uint64_t tid, const std::string& name) : AppletFrame(true, true), tid(tid) { - list = new brls::List(); - GetVersion(); - GetBuildID(); + this->list = new brls::List(); + this->GetVersion(); + this->GetBuildID(); this->setTitle(name); this->setFooterText("v" + std::to_string(this->version / 0x10000)); - this->registerAction("menus/cheats/show_existing"_i18n, brls::Key::X, [this, name] { + this->registerAction("menus/cheats/show_existing"_i18n, brls::Key::X, [this, name] { // TODO: figure out why that doesn't show up for empty lists show_cheats::ShowCheatSheet(this->tid, this->bid, name); return true; }); + this->rebuildHints(); } void DownloadCheatsPage::GetBuildID() { if (CurrentCfw::running_cfw == CFW::ams) - GetBuildIDFromDmnt(); + this->GetBuildIDFromDmnt(); if (this->bid == "") - GetBuildIDFromFile(); + this->GetBuildIDFromFile(); } void DownloadCheatsPage::GetBuildIDFromDmnt() @@ -162,11 +179,6 @@ void DownloadCheatsPage::WriteCheats(const std::string& cheatContent) << cheatContent; } -void DownloadCheatsPage::DeleteCheats() -{ - 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) { label = new brls::Label( @@ -287,18 +299,6 @@ DownloadCheatsPage_CheatSlips::DownloadCheatsPage_CheatSlips(uint64_t tid, const return true; }); - del = new brls::ListItem("menus/cheats/delete_file"_i18n); - del->getClickEvent()->subscribe([this](brls::View* view) { - DeleteCheats(); - brls::Dialog* dialog = new brls::Dialog("menus/common/all_done"_i18n); - brls::GenericEvent::Callback callback = [dialog](brls::View* view) { - dialog->close(); - }; - dialog->addButton("menus/common/ok"_i18n, callback); - dialog->setCancelable(true); - dialog->open(); - }); - list->addView(del); this->setContentView(list); } @@ -369,17 +369,5 @@ DownloadCheatsPage_GbaTemp::DownloadCheatsPage_GbaTemp(uint64_t tid, const std:: list->addView(label); } - del = new brls::ListItem("menus/cheats/delete_file"_i18n); - del->getClickEvent()->subscribe([this](brls::View* view) { - DeleteCheats(); - brls::Dialog* dialog = new brls::Dialog("menus/common/all_done"_i18n); - brls::GenericEvent::Callback callback = [dialog](brls::View* view) { - dialog->close(); - }; - dialog->addButton("menus/common/ok"_i18n, callback); - dialog->setCancelable(true); - dialog->open(); - }); - list->addView(del); this->setContentView(list); } diff --git a/source/list_download_tab.cpp b/source/list_download_tab.cpp index 33a62b6..889b91d 100644 --- a/source/list_download_tab.cpp +++ b/source/list_download_tab.cpp @@ -51,8 +51,7 @@ void ListDownloadTab::createList(contentType type) else links = download::getLinksFromJson(util::getValueFromKey(this->nxlinks, contentTypeNames[(int)type].data())); - this->size = links.size(); - if (this->size) { + if (links.size()) { for (const auto& link : links) { const std::string title = link.first; const std::string url = link.second; @@ -154,7 +153,6 @@ void ListDownloadTab::setDescription() void ListDownloadTab::createCheatSlipItem() { - this->size += 1; cheatslipsItem = new brls::ListItem("menus/cheats/get_cheatslips"_i18n); cheatslipsItem->setHeight(LISTITEM_HEIGHT); cheatslipsItem->getClickEvent()->subscribe([](brls::View* view) { @@ -198,7 +196,6 @@ void ListDownloadTab::createCheatSlipItem() void ListDownloadTab::creategbatempItem() { - this->size += 1; gbatempItem = new brls::ListItem("menus/cheats/get_gbatemp"_i18n); gbatempItem->setHeight(LISTITEM_HEIGHT); gbatempItem->getClickEvent()->subscribe([](brls::View* view) { @@ -206,12 +203,4 @@ void ListDownloadTab::creategbatempItem() return true; }); this->addView(gbatempItem); -} - -brls::View* ListDownloadTab::getDefaultFocus() -{ - if (this->size) - return this->brls::List::getDefaultFocus(); - else - return nullptr; } \ No newline at end of file