diff --git a/include/screens/mainScreen.hpp b/include/screens/mainScreen.hpp index 2a0a88b..3a5710d 100644 --- a/include/screens/mainScreen.hpp +++ b/include/screens/mainScreen.hpp @@ -51,7 +51,7 @@ public: void Draw(void) const override; void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; private: - std::vector dwnldList, dwnldSizes; + std::vector dwnldList, dwnldSizes, dwnldTypes; bool initialized = false, fetchDown = false, showMarks = false, showSettings = false, ascending = false, updateFilter = false, screenshotFetch = false, canDisplay = false, isAND = true; diff --git a/include/store/store.hpp b/include/store/store.hpp index 1f87c4c..9ca8088 100644 --- a/include/store/store.hpp +++ b/include/store/store.hpp @@ -55,6 +55,7 @@ public: std::string GetLicenseEntry(int index) const; C2D_Image GetIconEntry(int index) const; std::string GetFileSizes(int index, const std::string &entry) const; + std::string GetFileTypes(int index, const std::string &entry) const; std::vector GetScreenshotList(int index) const; std::vector GetScreenshotNames(int index) const; std::string GetReleaseNotes(int index) const; diff --git a/include/store/storeEntry.hpp b/include/store/storeEntry.hpp index 4adf84e..1ca757b 100644 --- a/include/store/storeEntry.hpp +++ b/include/store/storeEntry.hpp @@ -53,6 +53,7 @@ public: std::vector GetCategoryFull() const { return this->FullCategory; }; std::vector GetConsoleFull() const { return this->FullConsole; }; std::vector GetSizes() const { return this->Sizes; }; + std::vector GetTypes() const { return this->Types; }; std::vector GetScreenshots() const { return this->Screenshots; }; std::vector GetScreenshotNames() const { return this->ScreenshotNames; }; std::string GetReleaseNotes() const { return this->ReleaseNotes; }; @@ -69,7 +70,7 @@ private: std::string Title, Author, Description, Category, Version, Console, LastUpdated, License, MarkString, ReleaseNotes; C2D_Image Icon; int SheetIndex, EntryIndex, Marks; - std::vector FullCategory, FullConsole, Sizes, Screenshots, ScreenshotNames; + std::vector FullCategory, FullConsole, Sizes, Types, Screenshots, ScreenshotNames; bool UpdateAvailable; }; diff --git a/include/store/storeUtils.hpp b/include/store/storeUtils.hpp index 07e9253..f22f949 100644 --- a/include/store/storeUtils.hpp +++ b/include/store/storeUtils.hpp @@ -61,7 +61,7 @@ namespace StoreUtils { /* Download entries. */ void DrawDownList(const std::vector &entries, bool fetch, const std::unique_ptr &entry, const std::vector &sizes, const std::vector &installs); - void DownloadHandle(const std::unique_ptr &entry, const std::vector &entries, int ¤tMenu, const int &lastMode, int &smallDelay, std::vector &installs); + void DownloadHandle(const std::unique_ptr &entry, const std::vector &entries, int ¤tMenu, const int &lastMode, int &smallDelay, std::vector &installs, const std::vector &types); /* Queue System. */ void DrawQueueMenu(const int queueIndex); diff --git a/romfs/lang/en/app.json b/romfs/lang/en/app.json index 91b0a74..1bc175f 100644 --- a/romfs/lang/en/app.json +++ b/romfs/lang/en/app.json @@ -66,6 +66,8 @@ "ENTRIES": "Entries", "EXECUTE_ENTRY": "Would you like to execute this entry?", "EXIT_APP": "Exit DarkStore", + "NOTE_NIGHTLY": "Note: \"Nightly\" versions are intended for testing\nupcoming features and may be unstable.\n\nIf you simply want to install,\nplease cancel and install the normal version.", + "NOTE_PRERELEASE": "Note: This is a prerelease build and may be unstable.\n\nIf you simply want to install, you may\nwant to install the normal version if one exists.", "EXTRACTING": "Extracting... %s / %s (%.2f%%)", "EXTRACT_ERROR": "Extract error!", "FEATURE_SIDE_EFFECTS": "This Feature may have side effects while the Queue is running.\nAre you sure you want to continue?", @@ -142,4 +144,4 @@ "UPDATING_SPRITE_SHEET2": "Updating Spritesheet %i of %i...", "UPDATING_STORE": "Updating Store...", "VERSION": "Version" -} \ No newline at end of file +} diff --git a/source/menu/downList.cpp b/source/menu/downList.cpp index ccc8ef8..fed345b 100644 --- a/source/menu/downList.cpp +++ b/source/menu/downList.cpp @@ -169,7 +169,7 @@ void StoreUtils::DrawDownList(const std::vector &entries, bool fetc int &smallDelay: Reference to the small delay. This helps to not directly press A. std::vector &installs: Reference to the installed states. */ -void StoreUtils::DownloadHandle(const std::unique_ptr &entry, const std::vector &entries, int ¤tMenu, const int &lastMode, int &smallDelay, std::vector &installs) { +void StoreUtils::DownloadHandle(const std::unique_ptr &entry, const std::vector &entries, int ¤tMenu, const int &lastMode, int &smallDelay, std::vector &installs, const std::vector &types) { if (StoreUtils::store && entry) { // Ensure, store & entry is not a nullptr. if (smallDelay > 0) { smallDelay--; @@ -212,7 +212,10 @@ void StoreUtils::DownloadHandle(const std::unique_ptr &entry, const for (int i = 0; i < DOWNLOAD_ENTRIES; i++) { if (touching(touch, downloadBoxes[i])) { if (i + StoreUtils::store->GetDownloadSIndex() < (int)entries.size()) { - if (Msg::promptMsg(Lang::get("EXECUTE_ENTRY") + "\n\n" + entries[i + StoreUtils::store->GetDownloadSIndex()])) { + std::string Msg = Lang::get("EXECUTE_ENTRY") + "\n\n" + entries[i + StoreUtils::store->GetDownloadSIndex()]; + if (types[i + StoreUtils::store->GetDownloadSIndex()] == "nightly") Msg += "\n\n" + Lang::get("NOTE_NIGHTLY"); + else if (types[i + StoreUtils::store->GetDownloadSIndex()] == "prerelease") Msg += "\n\n" + Lang::get("NOTE_PRERELEASE"); + if (Msg::promptMsg(Msg)) { StoreUtils::AddToQueue(entry->GetEntryIndex(), entries[i + StoreUtils::store->GetDownloadSIndex()], entry->GetTitle(), entry->GetLastUpdated()); } } @@ -234,7 +237,10 @@ void StoreUtils::DownloadHandle(const std::unique_ptr &entry, const } if (smallDelay == 0 && hDown & KEY_A && !entries.empty()) { - if (Msg::promptMsg(Lang::get("EXECUTE_ENTRY") + "\n\n" + entries[StoreUtils::store->GetDownloadIndex()])) { + std::string Msg = Lang::get("EXECUTE_ENTRY") + "\n\n" + entries[StoreUtils::store->GetDownloadIndex()]; + if (types[StoreUtils::store->GetDownloadIndex()] == "nightly") Msg += "\n\n" + Lang::get("NOTE_NIGHTLY"); + else if (types[StoreUtils::store->GetDownloadIndex()] == "prerelease") Msg += "\n\n" + Lang::get("NOTE_PRERELEASE"); + if (Msg::promptMsg(Msg)) { StoreUtils::AddToQueue(entry->GetEntryIndex(), entries[StoreUtils::store->GetDownloadIndex()], entry->GetTitle(), entry->GetLastUpdated()); } } diff --git a/source/screens/mainScreen.cpp b/source/screens/mainScreen.cpp index ea6cf15..43b289c 100644 --- a/source/screens/mainScreen.cpp +++ b/source/screens/mainScreen.cpp @@ -235,6 +235,7 @@ void MainScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) { this->installs.clear(); this->dwnldList.clear(); this->dwnldSizes.clear(); + this->dwnldTypes.clear(); if (StoreUtils::store && StoreUtils::store->GetValid()) { const std::vector installedNames = StoreUtils::meta->GetInstalled(StoreUtils::store->GetStoreTitle(), StoreUtils::entries[StoreUtils::store->GetEntry()]->GetTitle()); @@ -244,6 +245,7 @@ void MainScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) { if ((int)StoreUtils::entries.size() > StoreUtils::store->GetEntry()) { this->dwnldList = StoreUtils::store->GetDownloadList(StoreUtils::entries[StoreUtils::store->GetEntry()]->GetEntryIndex()); this->dwnldSizes = StoreUtils::entries[StoreUtils::store->GetEntry()]->GetSizes(); + this->dwnldTypes = StoreUtils::entries[StoreUtils::store->GetEntry()]->GetTypes(); for (int i = 0; i < (int)this->dwnldList.size(); i++) { bool good = false; @@ -269,7 +271,7 @@ void MainScreen::Logic(u32 hDown, u32 hHeld, touchPosition touch) { break; case 1: - if (StoreUtils::store && StoreUtils::store->GetValid() && StoreUtils::entries.size() > 0) StoreUtils::DownloadHandle(StoreUtils::entries[StoreUtils::store->GetEntry()], this->dwnldList, storeMode, this->lastMode, this->smallDelay, this->installs); + if (StoreUtils::store && StoreUtils::store->GetValid() && StoreUtils::entries.size() > 0) StoreUtils::DownloadHandle(StoreUtils::entries[StoreUtils::store->GetEntry()], this->dwnldList, storeMode, this->lastMode, this->smallDelay, this->installs, this->dwnldTypes); break; case 2: diff --git a/source/store/store.cpp b/source/store/store.cpp index c6b3e8f..86df4a8 100644 --- a/source/store/store.cpp +++ b/source/store/store.cpp @@ -506,6 +506,26 @@ std::string Store::GetFileSizes(int index, const std::string &entry) const { return ""; } +/* + Get file script type for each download entry. + + int index: The index. + const std::string &entry: The entry name. +*/ +std::string Store::GetFileTypes(int index, const std::string &entry) const { + if (!this->valid) return ""; + + if (index > (int)this->storeJson["storeContent"].size() - 1) return ""; + + if (this->storeJson["storeContent"][index].contains(entry) && this->storeJson["storeContent"][index][entry].type() == nlohmann::json::value_t::object) { + if (this->storeJson["storeContent"][index][entry].contains("type") && this->storeJson["storeContent"][index][entry]["type"].is_string()) { + return this->storeJson["storeContent"][index][entry]["type"]; + } + } + + return ""; +} + /* Get Screenshot URL list. diff --git a/source/store/storeEntry.cpp b/source/store/storeEntry.cpp index 6b87954..40f796c 100644 --- a/source/store/storeEntry.cpp +++ b/source/store/storeEntry.cpp @@ -61,6 +61,7 @@ StoreEntry::StoreEntry(const std::unique_ptr &store, const std::unique_pt if (!entries.empty()) { for (int i = 0; i < (int)entries.size(); i++) { this->Sizes.push_back( store->GetFileSizes(index, entries[i]) ); + this->Types.push_back( store->GetFileTypes(index, entries[i]) ); } }