diff --git a/include/ams_tab.hpp b/include/ams_tab.hpp index a85b9c6..f16c47c 100644 --- a/include/ams_tab.hpp +++ b/include/ams_tab.hpp @@ -8,6 +8,8 @@ class AmsTab : public brls::List brls::ListItem* listItem; brls::Label *notFound; brls::Label *description; + int size; public: AmsTab(); + brls::View* getDefaultFocus() override; }; \ No newline at end of file diff --git a/include/choice_page.hpp b/include/choice_page.hpp index d137022..1f0281e 100644 --- a/include/choice_page.hpp +++ b/include/choice_page.hpp @@ -13,5 +13,5 @@ class ChoicePage: public brls::View ChoicePage(brls::StagedAppletFrame* frame, std::string text); 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; - brls::View* getDefaultFocus() override; + brls::View* getDefaultFocus() override; }; \ No newline at end of file diff --git a/include/list_download_tab.hpp b/include/list_download_tab.hpp index 2034f6a..b3f3b07 100644 --- a/include/list_download_tab.hpp +++ b/include/list_download_tab.hpp @@ -11,7 +11,9 @@ class ListDownloadTab : public brls::List brls::Label *notFound; brls::Label *description; brls::Label *cheatSlipLabel; + int size; public: ListDownloadTab(const archiveType type); + brls::View* getDefaultFocus() override; }; \ No newline at end of file diff --git a/source/ams_tab.cpp b/source/ams_tab.cpp index 29dce43..c0d9650 100644 --- a/source/ams_tab.cpp +++ b/source/ams_tab.cpp @@ -1,5 +1,4 @@ #include "ams_tab.hpp" -#include #include "download.hpp" #include "extract.hpp" #include "confirm_page.hpp" @@ -7,6 +6,7 @@ #include "worker_page.hpp" #include "utils.hpp" #include "current_cfw.hpp" +#include namespace i18n = brls::i18n; using namespace i18n::literals; @@ -21,7 +21,8 @@ AmsTab::AmsTab() : operation += "menus/main/ams"_i18n; links = download::getLinks(AMS_URL); - if(links.size()){ + this->size = links.size(); + if(this->size){ auto hekate_link = download::getLinks(HEKATE_URL); std::string hekate_url = hekate_link[0].second; std::string text_hekate = "menus/common/download"_i18n + hekate_link[0].first; @@ -71,4 +72,12 @@ AmsTab::AmsTab() : notFound->setHorizontalAlign(NVG_ALIGN_CENTER); this->addView(notFound); } +} + +brls::View* AmsTab::getDefaultFocus() +{ + if(this->size) + return this->brls::List::getDefaultFocus(); + else + return nullptr; } \ No newline at end of file diff --git a/source/list_download_tab.cpp b/source/list_download_tab.cpp index 47b8149..6d0c17f 100644 --- a/source/list_download_tab.cpp +++ b/source/list_download_tab.cpp @@ -78,7 +78,8 @@ ListDownloadTab::ListDownloadTab(const archiveType type) : this->addView(description); - if(links.size()){ + this->size = links.size(); + if(this->size){ for (const auto& link : links){ std::string url = link.second; std::string text("menus/common/download"_i18n + link.first + "menus/common/from"_i18n + url); @@ -126,6 +127,7 @@ ListDownloadTab::ListDownloadTab(const archiveType type) : true ); this->addView(cheatSlipLabel); + this->size += 1; cheatslipsItem = new brls::ListItem("menus/cheats/get_cheatslips"_i18n); cheatslipsItem->setHeight(LISTITEM_HEIGHT); cheatslipsItem->getClickEvent()->subscribe([&](brls::View* view) { @@ -181,4 +183,12 @@ ListDownloadTab::ListDownloadTab(const archiveType type) : }); this->addView(cheatslipsItem); } +} + +brls::View* ListDownloadTab::getDefaultFocus() +{ + if(this->size) + return this->brls::List::getDefaultFocus(); + else + return nullptr; } \ No newline at end of file