diff --git a/include/store/storeUtils.hpp b/include/store/storeUtils.hpp index a2f8b2e..f53a108 100644 --- a/include/store/storeUtils.hpp +++ b/include/store/storeUtils.hpp @@ -53,7 +53,7 @@ namespace StoreUtils { /* Side Menu. */ void DrawSideMenu(int currentMenu); - void SideMenuHandle(int ¤tMenu, bool &fetch); + void SideMenuHandle(int ¤tMenu, bool &fetch, int &lastMenu); /* Download Entries. */ void DrawDownList(const std::unique_ptr &store, const std::vector &entries, bool fetch); diff --git a/source/gui/msg.cpp b/source/gui/msg.cpp index 30ce211..f5db9f4 100644 --- a/source/gui/msg.cpp +++ b/source/gui/msg.cpp @@ -105,13 +105,14 @@ void Msg::waitMsg(const std::string &msg) { Gui::clearTextBufs(); C3D_FrameBegin(C3D_FRAME_SYNCDRAW); C2D_TargetClear(Top, TRANSPARENT); + C2D_TargetClear(Bottom, TRANSPARENT); GFX::DrawTop(); Gui::DrawStringCentered(0, (240 - Gui::GetStringHeight(0.6f, msg)) / 2, 0.6f, TEXT_COLOR, msg, 395); - Gui::Draw_Rect(0, 215, 400, 25, BAR_COLOR); Gui::Draw_Rect(0, 214, 400, 1, BAR_OUTL_COLOR); Gui::DrawStringCentered(0, 218, 0.6f, TEXT_COLOR, Lang::get("KEY_CONTINUE"), 390); + GFX::DrawBottom(); C3D_FrameEnd(0); for (int i = 0; i < 3; i++) gspWaitForVBlank(); diff --git a/source/overlays/storeSelect.cpp b/source/overlays/storeSelect.cpp index 9c1ac91..6c905f5 100644 --- a/source/overlays/storeSelect.cpp +++ b/source/overlays/storeSelect.cpp @@ -35,6 +35,7 @@ #include extern bool checkWifiStatus(); +extern void notConnectedMsg(); extern bool touching(touchPosition touch, Structs::ButtonPos button); static const std::vector mainButtons = { { 10, 34, 300, 22 }, @@ -371,6 +372,9 @@ void Overlays::SelectStore(std::unique_ptr &store, std::vector &store, std::vector &store, std::vector Get! */ if (config->lastStore() == "universal-db.unistore" || config->lastStore() == "") { if (access("sdmc:/3ds/Universal-Updater/stores/universal-db.unistore", F_OK) != 0) { - std::string tmp = ""; // Just a temp. - DownloadUniStore("https://db.universal-team.net/unistore/universal-db.unistore", -1, tmp, true, true); - DownloadSpriteSheet("https://db.universal-team.net/unistore/universal-db.t3x", "universal-db.t3x"); + if (checkWifiStatus()) { + std::string tmp = ""; // Just a temp. + DownloadUniStore("https://db.universal-team.net/unistore/universal-db.unistore", -1, tmp, true, true); + DownloadSpriteSheet("https://db.universal-team.net/unistore/universal-db.t3x", "universal-db.t3x"); + + } else { + notConnectedMsg(); + } } } @@ -137,7 +143,7 @@ void MainScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) { config->list() ? StoreUtils::ListLogic(this->store, this->entries, this->storeMode, this->lastMode, this->fetchDown, this->smallDelay) : StoreUtils::GridLogic(this->store, this->entries, this->storeMode, this->lastMode, this->fetchDown, this->smallDelay); } - StoreUtils::SideMenuHandle(this->storeMode, this->fetchDown); + StoreUtils::SideMenuHandle(this->storeMode, this->fetchDown, this->lastMode); /* Fetch Download list. */ if (this->fetchDown) { diff --git a/source/store/sideMenu.cpp b/source/store/sideMenu.cpp index e995ac3..72a0742 100644 --- a/source/store/sideMenu.cpp +++ b/source/store/sideMenu.cpp @@ -68,11 +68,13 @@ void StoreUtils::DrawSideMenu(int currentMenu) { int ¤tMenu: Reference to the Store Mode / Menu. bool &fetch: Reference of the download fetch variable.. so we know, if we need to fetch the download entries. + int &lastMenu: Reference to the last menu. */ -void StoreUtils::SideMenuHandle(int ¤tMenu, bool &fetch) { +void StoreUtils::SideMenuHandle(int ¤tMenu, bool &fetch, int &lastMenu) { if (hDown & KEY_TOUCH) { for (int i = 0; i < 5; i++) { if (touching(touch, sidePos[i])) { + lastMenu = currentMenu; if (i == 1) fetch = true; // Fetch download list, if 1. currentMenu = i; break; @@ -82,6 +84,7 @@ void StoreUtils::SideMenuHandle(int ¤tMenu, bool &fetch) { if (hRepeat & KEY_R) { if (currentMenu < 4) { + lastMenu = currentMenu; if (currentMenu + 1 == 1) fetch = true; // Fetch download list, if 1. currentMenu++; } @@ -89,6 +92,7 @@ void StoreUtils::SideMenuHandle(int ¤tMenu, bool &fetch) { if (hRepeat & KEY_L) { if (currentMenu > 0) { + lastMenu = currentMenu; if (currentMenu - 1 == 1) fetch = true; // Fetch download list, if 1. currentMenu--; } diff --git a/source/store/store.cpp b/source/store/store.cpp index 86b231f..80169ce 100644 --- a/source/store/store.cpp +++ b/source/store/store.cpp @@ -208,6 +208,11 @@ void Store::loadSheets() { */ void Store::LoadFromFile(const std::string &file) { FILE *in = fopen(file.c_str(), "rt"); + if (!in) { + this->valid = false; + return; + } + this->storeJson = nlohmann::json::parse(in, nullptr, false); fclose(in);