WIP: Display if update is available on UniStore v2!

Use `updates.json` for it in `sd:/3ds/Universal-Updater/`.
This commit is contained in:
StackZ
2020-06-20 23:17:28 +02:00
parent 4004cb9e25
commit 34ade17556
8 changed files with 121 additions and 21 deletions
+3 -3
View File
@@ -39,13 +39,13 @@ class UniStoreV2 : public Screen {
public:
void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
UniStoreV2(nlohmann::json &JSON, const std::string sheetPath);
UniStoreV2(nlohmann::json &JSON, const std::string sheetPath, const std::string fileName);
~UniStoreV2();
private:
std::unique_ptr<Store> sortedStore;
bool darkMode = true, sheetLoaded = false, canDisplay = false, hasLoaded = false, isDropDown = false;
int selectedBox = 0, lastViewMode = 0, dropSelection = 0, searchSelection = 0, iconAmount = 0, categorySelection = 0, selectedBoxList = 0, selection = -1, storePage = 0, downloadPage = 0, storePageList = 0, mode = 0, subSelection = 0, categoryPage = 0;
int selectedObject = 0, selectedBox = 0, lastViewMode = 0, dropSelection = 0, searchSelection = 0, iconAmount = 0, categorySelection = 0, selectedBoxList = 0, selection = -1, storePage = 0, downloadPage = 0, storePageList = 0, mode = 0, subSelection = 0, categoryPage = 0;
nlohmann::json storeJson;
C2D_SpriteSheet sheet;
std::vector<std::string> objects;
@@ -64,7 +64,7 @@ private:
void parseObjects(int selection);
Result runFunctions(std::string entry);
void DrawList(void) const;
void displaySelectedEntry(int selection) const;
void displaySelectedEntry(int selection, int storeIndex) const;
void DropLogic(u32 hDown, u32 hHeld, touchPosition touch);
void DropDownMenu(void) const;
+7 -3
View File
@@ -41,6 +41,7 @@ struct UniStoreV2Struct {
std::string last_updated;
int icon_index;
int JSONIndex;
bool updateAvailable;
};
enum class SortType {
@@ -51,8 +52,9 @@ enum class SortType {
class Store {
public:
Store(nlohmann::json &JS);
Store(nlohmann::json &JS, std::string updateJSON = "NOT_FOUND");
void writeToFile(int index);
void sorting(bool Ascending, SortType sorttype);
std::string returnTitle(const int index);
@@ -61,13 +63,14 @@ public:
int returnJSONIndex(const int index);
int getSize();
bool getAscending() { return this->ascending; }
bool isUpdateAvailable(int index) { return this->sortedStore[index].updateAvailable; }
// Searching stuff.
int searchForEntries(const std::string searchResult);
int searchForAuthor(const std::string searchResult);
int searchForCategory(const std::string searchResult);
int searchForConsole(const std::string searchResult);
bool updateAvailable(int index);
void reset() { this->sortedStore = this->unsortedStore; }
const int getSortType() {
@@ -82,8 +85,9 @@ public:
private:
std::vector<UniStoreV2Struct> sortedStore, unsortedStore;
std::vector<std::string> availableCategories;
std::string updateFile;
bool ascending = false;
nlohmann::json storeJson;
nlohmann::json storeJson, updateJSON;
SortType sorttype = SortType::TITLE;
UniStoreV2Struct getData(const int index);