WIP: Add Glossary and some cleanup.

This commit is contained in:
StackZ
2020-03-08 17:03:21 +01:00
parent 9998748baa
commit 1a20cc50f3
12 changed files with 1346 additions and 1039 deletions
+38
View File
@@ -0,0 +1,38 @@
/*
* This file is part of Universal-Updater
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
* * Requiring preservation of specified reasonable legal notices or
* author attributions in that material or in the Appropriate Legal
* Notices displayed by works containing it.
* * Prohibiting misrepresentation of the origin of that material,
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/
#ifndef ANIMATION_HPP
#define ANIMATION_HPP
#include <3ds.h>
#include <string>
namespace Animation {
// Draw Progressbar.
void DrawProgressBar(float currentProgress, float totalProgress, int mode);
}
#endif
+15 -3
View File
@@ -39,14 +39,26 @@ public:
void Draw(void) const override; void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
ScriptBrowse(); ScriptBrowse();
private: private:
std::vector<DirEntry> dirContents; // Selection.
mutable int screenPos = 0; mutable int screenPos = 0;
mutable int screenPosList = 0; mutable int screenPosList = 0;
mutable int selection = 0; mutable int Selection = 0;
int mode = 0;
// Draws.
void DrawBrowse(void) const;
void DrawGlossary(void) const;
nlohmann::json infoJson;
int maxScripts;
// Browse stuff.
int keyRepeatDelay = 0; int keyRepeatDelay = 0;
int fastMode = false; int fastMode = false;
std::vector<DirEntry> dirContents;
// Button | Icon struct.
std::vector<Structs::ButtonPos> arrowPos = { std::vector<Structs::ButtonPos> arrowPos = {
{295, 0, 25, 25}, // Arrow Up. {295, 0, 25, 25}, // Arrow Up.
{295, 215, 25, 25}, // Arrow Down. {295, 215, 25, 25}, // Arrow Down.
+32 -9
View File
@@ -29,6 +29,7 @@
#include "common.hpp" #include "common.hpp"
#include "fileBrowse.hpp" #include "fileBrowse.hpp"
#include "scriptHelper.hpp"
#include "structs.hpp" #include "structs.hpp"
#include <vector> #include <vector>
@@ -38,32 +39,55 @@ class ScriptList : public Screen
public: public:
void Draw(void) const override; void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override; void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
ScriptList(); ScriptList(); // In case of "Autoboot", have a Constructor which handles stuff.
private: private:
// Screen Mode.
int mode = 0;
int lastMode = 1;
// Helper functions.
void deleteScript(int selectedScript); void deleteScript(int selectedScript);
void refreshList(); void refreshList();
nlohmann::json openScriptFile();
void checkForValidate(void);
void loadDesc(void);
void runFunctions(nlohmann::json &json);
// Draw Functions.
void DrawSubMenu(void) const; void DrawSubMenu(void) const;
void DrawList(void) const; void DrawList(void) const;
void DrawSingleObject(void) const; void DrawSingleObject(void) const;
void DrawGlossary(void) const;
// Logic Functions.
void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch); void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch);
void ListSelection(u32 hDown, u32 hHeld, touchPosition touch); void ListSelection(u32 hDown, u32 hHeld, touchPosition touch);
void SelectFunction(u32 hDown, u32 hHeld, touchPosition touch); void SelectFunction(u32 hDown, u32 hHeld, touchPosition touch);
int mode = 0; // This is for the Script Creator, so no one can access it for now, until it is stable or so.
int SubSelection = 0; bool isTesting = false;
std::vector<DirEntry> dirContents;
// Other includes which get destructed automatically.
std::string choice;
std::string currentFile;
std::string selectedTitle;
std::string Desc = "";
nlohmann::json jsonFile;
std::vector<ScriptInfo> fileInfo;
std::vector<std::string> fileInfo2;
std::vector<std::string> lines;
mutable int screenPos = 0; mutable int screenPos = 0;
mutable int screenPosList = 0; mutable int screenPosList = 0;
mutable int selection = 0; mutable int Selection = 0;
mutable int screenPos2 = 0;
mutable int screenPosList2 = 0;
mutable int selection2 = 0;
// Browse stuff.
int keyRepeatDelay = 0; int keyRepeatDelay = 0;
std::vector<DirEntry> dirContents;
int fastMode = false; int fastMode = false;
// Button | Icon structs.
std::vector<Structs::ButtonPos> arrowPos = { std::vector<Structs::ButtonPos> arrowPos = {
{295, 0, 25, 25}, // Arrow Up. {295, 0, 25, 25}, // Arrow Up.
{295, 215, 25, 25}, // Arrow Down. {295, 215, 25, 25}, // Arrow Down.
@@ -71,7 +95,6 @@ private:
{5, 0, 25, 25}, // viewMode Change {5, 0, 25, 25}, // viewMode Change
{45, 0, 25, 25}, // Search. {45, 0, 25, 25}, // Search.
}; };
std::vector<Structs::ButtonPos> subPos = { std::vector<Structs::ButtonPos> subPos = {
{10, 70, 140, 40}, // Script list. {10, 70, 140, 40}, // Script list.
{170, 70, 140, 40}, // Get Scripts. {170, 70, 140, 40}, // Get Scripts.
+18 -11
View File
@@ -29,6 +29,7 @@
#include "common.hpp" #include "common.hpp"
#include "fileBrowse.hpp" #include "fileBrowse.hpp"
#include "scriptHelper.hpp"
#include "structs.hpp" #include "structs.hpp"
#include <vector> #include <vector>
@@ -41,6 +42,9 @@ public:
UniStore(); UniStore();
private: private:
void refreshList(); void refreshList();
nlohmann::json openStoreFile();
void loadStoreDesc(void);
void loadStoreSheet(int pos);
void DrawSubMenu(void) const; void DrawSubMenu(void) const;
void DrawStoreList(void) const; void DrawStoreList(void) const;
@@ -48,6 +52,7 @@ private:
void DrawSearch(void) const; void DrawSearch(void) const;
void DrawFullURLScreen(void) const; void DrawFullURLScreen(void) const;
void DrawGitHubScreen(void) const; void DrawGitHubScreen(void) const;
void DrawGlossary(void) const;
void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch); void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch);
void StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch); void StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch);
@@ -63,7 +68,7 @@ private:
void deleteStore(int selectedStore); void deleteStore(int selectedStore);
bool handleIfDisplayText(); bool handleIfDisplayText();
int mode = 0; int mode = 0;
int selectedOptionAppStore = 0; int lastMode = 1;
mutable bool displayInformations = true; mutable bool displayInformations = true;
// Stuff for the GitHub Store Search function and Full URL. // Stuff for the GitHub Store Search function and Full URL.
@@ -71,20 +76,25 @@ private:
std::string fileName = ""; std::string fileName = "";
std::string FullURL = ""; std::string FullURL = "";
mutable int selection = 0; // Selections.
mutable int selection2 = 0; mutable int Selection = 0;
int screenPos = 0; int screenPos = 0;
int screenPos2 = 0;
mutable int screenPosList = 0; mutable int screenPosList = 0;
mutable int screenPosList2 = 0;
int searchSelection = 0;
int subSelection = 0;
// Browse stuff.
int keyRepeatDelay = 0; int keyRepeatDelay = 0;
int fastMode = false; int fastMode = false;
std::vector<DirEntry> dirContents; std::vector<DirEntry> dirContents;
// Other stuff.
std::vector<StoreInfo> storeInfo; // Store Selection.
std::vector<std::string> appStoreList; // Actual store. ;P
std::vector<std::string> descLines;
std::string storeDesc = "";
nlohmann::json appStoreJson;
std::string currentStoreFile;
// Icon | Button Structs.
std::vector<Structs::ButtonPos> arrowPos = { std::vector<Structs::ButtonPos> arrowPos = {
{295, 0, 25, 25}, // Arrow Up. {295, 0, 25, 25}, // Arrow Up.
{295, 215, 25, 25}, // Arrow Down. {295, 215, 25, 25}, // Arrow Down.
@@ -93,20 +103,17 @@ private:
{45, 0, 25, 25}, // Search. {45, 0, 25, 25}, // Search.
{85, 0, 25, 25}, // Update. {85, 0, 25, 25}, // Update.
}; };
std::vector<Structs::ButtonPos> URLBtn = { std::vector<Structs::ButtonPos> URLBtn = {
{10, 70, 140, 40}, // FULL URL. {10, 70, 140, 40}, // FULL URL.
{170, 70, 140, 40}, // Github. {170, 70, 140, 40}, // Github.
{10, 145, 140, 40}, // TinyDB. {10, 145, 140, 40}, // TinyDB.
{170, 145, 140, 40}, // QR Code? {170, 145, 140, 40}, // QR Code?
}; };
std::vector<Structs::ButtonPos> GitHubPos = { std::vector<Structs::ButtonPos> GitHubPos = {
{30, 50, 260, 30}, // Owner & Repo. {30, 50, 260, 30}, // Owner & Repo.
{30, 130, 260, 30}, // Filename. {30, 130, 260, 30}, // Filename.
{135, 180, 50, 30}, // OK. {135, 180, 50, 30}, // OK.
}; };
std::vector<Structs::ButtonPos> subPos = { std::vector<Structs::ButtonPos> subPos = {
{90, 40, 140, 35}, // StoreList. {90, 40, 140, 35}, // StoreList.
{90, 100, 140, 35}, // storeSearch. {90, 100, 140, 35}, // storeSearch.
+2
View File
@@ -42,6 +42,7 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#include "animation.hpp"
#include "config.hpp" #include "config.hpp"
#include "gfx.hpp" #include "gfx.hpp"
#include "gui.hpp" #include "gui.hpp"
@@ -71,3 +72,4 @@ extern char * arg0;
#define STORE_PATH "sdmc:/3ds/Universal-Updater/stores/" // Default Store path. #define STORE_PATH "sdmc:/3ds/Universal-Updater/stores/" // Default Store path.
#define ENTRIES_PER_SCREEN 3 #define ENTRIES_PER_SCREEN 3
#define ENTRIES_PER_LIST 7 #define ENTRIES_PER_LIST 7
#define metaFile "sdmc:/3ds/Universal-Updater/ScriptInfo.json"
+18
View File
@@ -29,6 +29,24 @@
#include <string> #include <string>
// Information like Title and Author.
struct ScriptInfo {
std::string title;
std::string author;
std::string shortDesc;
};
// Store Information.
struct StoreInfo {
std::string title;
std::string author;
std::string description;
std::string url;
std::string file;
std::string storeSheet;
std::string sheetURL;
};
namespace ScriptHelper { namespace ScriptHelper {
// Get stuff from a JSON. // Get stuff from a JSON.
std::string getString(nlohmann::json json, const std::string &key, const std::string &key2); std::string getString(nlohmann::json json, const std::string &key, const std::string &key2);
+14 -1
View File
@@ -131,5 +131,18 @@
"REFRESHING_LIST": "Refreshing List...", "REFRESHING_LIST": "Refreshing List...",
"AUTOBOOT_SCRIPT": "Would you like to autoboot this Script?\n\nThis will autoboot this Script on startup!", "AUTOBOOT_SCRIPT": "Would you like to autoboot this Script?\n\nThis will autoboot this Script on startup!",
"STARTING_UNIVERSAL_UPDATER": "Starting Universal-Updater..." "STARTING_UNIVERSAL_UPDATER": "Starting Universal-Updater...",
"EXECUTE_SCRIPT": "Would you like to execute this script?",
"EXECUTE_STORE": "Would you like to execute this entry?",
"GLOSSARY": "Glossary",
"DOWNLOAD_ALL": "Download all Scripts at once.",
"CHANGE_VIEW_MODE": "Change the viewMode.",
"ENTRY_UP": "Go one Entry up.",
"ENTRY_DOWN": "Go one Entry down.",
"GO_BACK": "Go back.",
"ENTRY": "Current Entry | Last Entry",
"REVISION": "Current Revision | Latest Revision",
"UPDATE_STORE": "Update selected UniStore."
} }
+38
View File
@@ -0,0 +1,38 @@
/*
* This file is part of Universal-Updater
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
* * Requiring preservation of specified reasonable legal notices or
* author attributions in that material or in the Appropriate Legal
* Notices displayed by works containing it.
* * Prohibiting misrepresentation of the origin of that material,
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/
#include "common.hpp"
extern u32 progressBar;
// Draws a Rectangle as the progressbar.
void Animation::DrawProgressBar(float currentProgress, float totalProgress, int mode) {
if (mode == 1) {
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress/(float)totalProgress) * 338.0f), 28, progressBar);
} else {
Gui::Draw_Rect(31, 121, (int)(((float)currentProgress/(float)totalProgress) * 338.0f), 28, Config::progressbarColor);
}
}
+2 -2
View File
@@ -666,9 +666,9 @@ void displayProgressBar() {
Gui::DrawStringCentered(0, 80, 0.6f, Config::TxtColor, str, 400); Gui::DrawStringCentered(0, 80, 0.6f, Config::TxtColor, str, 400);
Gui::Draw_Rect(30, 120, 340, 30, BLACK); Gui::Draw_Rect(30, 120, 340, 30, BLACK);
if (isScriptSelected == true) { if (isScriptSelected == true) {
Gui::Draw_Rect(31, 121, (int)(((float)downloadNow/(float)downloadTotal) * 338.0f), 28, progressBar); Animation::DrawProgressBar(downloadNow, downloadTotal, 1);
} else { } else {
Gui::Draw_Rect(31, 121, (int)(((float)downloadNow/(float)downloadTotal) * 338.0f), 28, Config::progressbarColor); Animation::DrawProgressBar(downloadNow, downloadTotal, 2);
} }
} }
GFX::DrawBottom(); GFX::DrawBottom();
+208 -142
View File
@@ -33,12 +33,6 @@
extern bool touching(touchPosition touch, Structs::ButtonPos button); extern bool touching(touchPosition touch, Structs::ButtonPos button);
nlohmann::json infoJson;
#define metaFile "sdmc:/3ds/Universal-Updater/ScriptInfo.json"
std::string maxScripts;
void fixInfo(nlohmann::json &json) { void fixInfo(nlohmann::json &json) {
for(uint i=0;i<json.size();i++) { for(uint i=0;i<json.size();i++) {
if(!json[i].contains("title")) json[i]["title"] = "TITLE"; if(!json[i].contains("title")) json[i]["title"] = "TITLE";
@@ -95,37 +89,45 @@ ScriptBrowse::ScriptBrowse() {
Msg::DisplayMsg(Lang::get("GETTING_SCRIPT_LIST")); Msg::DisplayMsg(Lang::get("GETTING_SCRIPT_LIST"));
// Get repo info // Get repo info
downloadToFile("https://github.com/Universal-Team/Universal-Updater-Scripts/raw/master/info/scriptInfo.json", metaFile); // downloadToFile("https://github.com/Universal-Team/Universal-Updater-Scripts/raw/master/info/scriptInfo.json", metaFile);
FILE* file = fopen(metaFile, "r"); FILE* file = fopen(metaFile, "r");
if(file) infoJson = nlohmann::json::parse(file, nullptr, false); if(file) infoJson = nlohmann::json::parse(file, nullptr, false);
fclose(file); fclose(file);
fixInfo(infoJson); fixInfo(infoJson);
findExistingFiles(infoJson); findExistingFiles(infoJson);
maxScripts = std::to_string(infoJson.size()); maxScripts = infoJson.size();
} }
void ScriptBrowse::Draw(void) const { void ScriptBrowse::Draw(void) const {
if (mode == 0) {
DrawBrowse();
} else {
DrawGlossary();
}
}
void ScriptBrowse::DrawBrowse(void) const {
GFX::DrawTop(); GFX::DrawTop();
std::string revision = std::to_string(int64_t(infoJson[selection]["curRevision"])); std::string revision = std::to_string(int64_t(infoJson[Selection]["curRevision"]));
revision += " / "; revision += " | ";
revision += std::to_string(int64_t(infoJson[selection]["revision"])); revision += std::to_string(int64_t(infoJson[Selection]["revision"]));
if (Config::UseBars == true) { if (Config::UseBars == true) {
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 239-Gui::GetStringHeight(0.6f, revision), 0.6f, Config::TxtColor, revision); Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 239-Gui::GetStringHeight(0.6f, revision), 0.6f, Config::TxtColor, revision);
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, std::string(infoJson[selection]["title"]), 400); Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, std::string(infoJson[Selection]["title"]), 400);
} else { } else {
Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 237-Gui::GetStringHeight(0.6f, revision), 0.6f, Config::TxtColor, revision); Gui::DrawString(397-Gui::GetStringWidth(0.6f, revision), 237-Gui::GetStringHeight(0.6f, revision), 0.6f, Config::TxtColor, revision);
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, std::string(infoJson[selection]["title"]), 400); Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, std::string(infoJson[Selection]["title"]), 400);
} }
Gui::DrawStringCentered(0, 120, 0.6f, Config::TxtColor, std::string(infoJson[selection]["shortDesc"]), 400); Gui::DrawStringCentered(0, 120, 0.6f, Config::TxtColor, std::string(infoJson[Selection]["shortDesc"]), 400);
if (infoJson[selection]["curRevision"] == -1) { if (infoJson[Selection]["curRevision"] == -1) {
Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("SCRIPT_NOT_FOUND"), 370); Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("SCRIPT_NOT_FOUND"), 370);
} else if(infoJson[selection]["curRevision"] < infoJson[selection]["revision"]) { } else if(infoJson[Selection]["curRevision"] < infoJson[Selection]["revision"]) {
Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("OUTDATED_SCRIPT"), 370); Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("OUTDATED_SCRIPT"), 370);
} else if(infoJson[selection]["curRevision"] == infoJson[selection]["revision"]) { } else if(infoJson[Selection]["curRevision"] == infoJson[Selection]["revision"]) {
Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("UP-TO-DATE"), 370); Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("UP-TO-DATE"), 370);
} else if(infoJson[selection]["curRevision"] > infoJson[selection]["revision"]) { } else if(infoJson[Selection]["curRevision"] > infoJson[Selection]["revision"]) {
Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("FUTURE_SCRIPT"), 370); Gui::DrawStringCentered(0, 219, 0.7f, Config::TxtColor, Lang::get("FUTURE_SCRIPT"), 370);
} }
GFX::DrawBottom(); GFX::DrawBottom();
@@ -137,40 +139,96 @@ void ScriptBrowse::Draw(void) const {
GFX::DrawSpriteBlend(sprites_view_idx, arrowPos[4].x, arrowPos[4].y); GFX::DrawSpriteBlend(sprites_view_idx, arrowPos[4].x, arrowPos[4].y);
//Gui::spriteBlend(sprites_search_idx, arrowPos[5].x, arrowPos[5].y); //Gui::spriteBlend(sprites_search_idx, arrowPos[5].x, arrowPos[5].y);
Gui::DrawStringCentered(-23, 1, 0.6f, Config::TxtColor, std::to_string(selection + 1) + " / " + maxScripts); Gui::DrawStringCentered(0, 1, 0.6f, Config::TxtColor, std::to_string(Selection + 1) + " | " + std::to_string(maxScripts));
if (Config::viewMode == 0) { if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)infoJson.size();i++) { for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)infoJson.size();i++) {
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor); Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
if(screenPos + i == selection) { if(screenPos + i == Selection) {
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor); Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
} }
if (infoJson[screenPos+i]["curRevision"] == -1) {
if(infoJson[screenPos+i]["curRevision"] < infoJson[screenPos+i]["revision"]) { Gui::Draw_Rect(295, 45+(i*59), 20, 20, C2D_Color32(255, 128, 0, 255));
Gui::Draw_Rect(300, 45+(i*59), 20, 20, C2D_Color32(0xfb, 0x5b, 0x5b, 255)); } else if(infoJson[screenPos+i]["curRevision"] < infoJson[screenPos+i]["revision"]) {
} else { Gui::Draw_Rect(295, 45+(i*59), 20, 20, C2D_Color32(0xfb, 0x5b, 0x5b, 255));
Gui::Draw_Rect(300, 45+(i*59), 20, 20, C2D_Color32(0xa5, 0xdd, 0x81, 255)); } else if(infoJson[screenPos+i]["curRevision"] == infoJson[screenPos+i]["revision"]) {
Gui::Draw_Rect(295, 45+(i*59), 20, 20, C2D_Color32(0xa5, 0xdd, 0x81, 255));
} else if(infoJson[screenPos+i]["curRevision"] > infoJson[screenPos+i]["revision"]) {
Gui::Draw_Rect(295, 45+(i*59), 20, 20, C2D_Color32(255, 255, 0, 255));
} }
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, infoJson[screenPos+i]["title"], 320);
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, infoJson[screenPos+i]["author"], 320); Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, infoJson[screenPos+i]["title"], 317);
Gui::DrawStringCentered(0, 62+(i*57), 0.7f, Config::TxtColor, infoJson[screenPos+i]["author"], 317);
} }
} else if (Config::viewMode == 1) { } else if (Config::viewMode == 1) {
for(int i=0;i<ENTRIES_PER_LIST && i<(int)infoJson.size();i++) { for(int i=0;i<ENTRIES_PER_LIST && i<(int)infoJson.size();i++) {
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor); Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
if(screenPosList + i == selection) { if(screenPosList + i == Selection) {
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor); Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
} }
if(infoJson[screenPosList+i]["curRevision"] < infoJson[screenPosList+i]["revision"]) {
// Script not found.
if (infoJson[screenPosList+i]["curRevision"] == -1) {
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, C2D_Color32(255, 128, 0, 255));
// Script outdaed.
} else if(infoJson[screenPosList+i]["curRevision"] < infoJson[screenPosList+i]["revision"]) {
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, C2D_Color32(0xfb, 0x5b, 0x5b, 255)); Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, C2D_Color32(0xfb, 0x5b, 0x5b, 255));
} else { // Script up-to-date.
} else if(infoJson[screenPosList+i]["curRevision"] == infoJson[screenPosList+i]["revision"]) {
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, C2D_Color32(0xa5, 0xdd, 0x81, 255)); Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, C2D_Color32(0xa5, 0xdd, 0x81, 255));
// Future script.
} else if(infoJson[screenPosList+i]["curRevision"] > infoJson[screenPosList+i]["revision"]) {
Gui::Draw_Rect(302, ((i+1)*27)+7, 11, 11, C2D_Color32(255, 255, 0, 255));
} }
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, infoJson[screenPosList+i]["title"], 320);
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, infoJson[screenPosList+i]["title"], 317);
} }
} }
} }
void ScriptBrowse::DrawGlossary(void) const {
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("GLOSSARY"), 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("GLOSSARY"), 400);
}
Gui::Draw_Rect(20, 30, 30, 30, C2D_Color32(255, 128, 0, 255));
Gui::DrawString(65, 35, 0.7f, Config::TxtColor, Lang::get("SCRIPT_NOT_FOUND"), 300);
Gui::Draw_Rect(20, 70, 30, 30, C2D_Color32(0xfb, 0x5b, 0x5b, 255));
Gui::DrawString(65, 75, 0.7f, Config::TxtColor, Lang::get("OUTDATED_SCRIPT"), 300);
Gui::Draw_Rect(20, 110, 30, 30, C2D_Color32(0xa5, 0xdd, 0x81, 255));
Gui::DrawString(65, 115, 0.7f, Config::TxtColor, Lang::get("UP-TO-DATE"), 300);
Gui::Draw_Rect(20, 150, 30, 30, C2D_Color32(255, 255, 0, 255));
Gui::DrawString(65, 155, 0.7f, Config::TxtColor, Lang::get("FUTURE_SCRIPT"), 300);
Gui::DrawString(15, 185, 0.7f, Config::TxtColor, std::to_string(int64_t(infoJson[Selection]["curRevision"])) + " | " + std::to_string(int64_t(infoJson[Selection]["revision"])), 40);
Gui::DrawString(65, 185, 0.7f, Config::TxtColor, Lang::get("REVISION"), 300);
GFX::DrawBottom();
GFX::DrawSpriteBlend(sprites_download_all_idx, 20, 40);
Gui::DrawString(50, 42, 0.6f, Config::TxtColor, Lang::get("DOWNLOAD_ALL"), 260);
GFX::DrawSpriteBlend(sprites_view_idx, 20, 70);
Gui::DrawString(50, 72, 0.6f, Config::TxtColor, Lang::get("CHANGE_VIEW_MODE"), 260);
GFX::DrawArrow(20, 100);
Gui::DrawString(50, 102, 0.6f, Config::TxtColor, Lang::get("ENTRY_UP"), 260);
GFX::DrawArrow(42, 155, 180.0);
Gui::DrawString(50, 132, 0.6f, Config::TxtColor, Lang::get("ENTRY_DOWN"), 260);
GFX::DrawArrow(20, 160, 0, 1);
Gui::DrawString(50, 162, 0.6f, Config::TxtColor, Lang::get("GO_BACK"), 260);
Gui::DrawString(10, 192, 0.6f, Config::TxtColor, std::to_string(Selection + 1) + " | " + std::to_string(maxScripts), 35);
Gui::DrawString(50, 192, 0.6f, Config::TxtColor, Lang::get("ENTRY"), 260);
GFX::DrawArrow(0, 218, 0, 1);
}
void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) { void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
if (keyRepeatDelay) keyRepeatDelay--; if (keyRepeatDelay) keyRepeatDelay--;
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) { if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
@@ -179,133 +237,141 @@ void ScriptBrowse::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
return; return;
} }
if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) { if (mode == 0) {
if (selection < (int)infoJson.size()-1) { if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
selection++; if (Selection < (int)infoJson.size()-1) {
} else { Selection++;
selection = 0; } else {
Selection = 0;
}
if (fastMode == true) {
keyRepeatDelay = 3;
} else if (fastMode == false){
keyRepeatDelay = 6;
}
} }
if (fastMode == true) {
keyRepeatDelay = 3;
} else if (fastMode == false){
keyRepeatDelay = 6;
}
}
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) { if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
if (selection > 0) { if (Selection > 0) {
selection--; Selection--;
} else { } else {
selection = (int)infoJson.size()-1; Selection = (int)infoJson.size()-1;
}
if (fastMode == true) {
keyRepeatDelay = 3;
} else if (fastMode == false){
keyRepeatDelay = 6;
}
} }
if (fastMode == true) {
keyRepeatDelay = 3;
} else if (fastMode == false){
keyRepeatDelay = 6;
}
}
if (hDown & KEY_TOUCH) { if (hDown & KEY_TOUCH) {
if (Config::viewMode == 0) { if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)infoJson.size();i++) { for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)infoJson.size();i++) {
if(touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) { if(touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) {
if (infoJson.size() != 0) { if (infoJson.size() != 0) {
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[screenPos + i]["title"]); std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[screenPos + i]["title"]);
std::string titleFix = infoJson[screenPos + i]["title"]; std::string titleFix = infoJson[screenPos + i]["title"];
for (int l = 0; l < (int)titleFix.size(); l++) { for (int l = 0; l < (int)titleFix.size(); l++) {
if (titleFix[l] == '/') { if (titleFix[l] == '/') {
titleFix[l] = '-'; titleFix[l] = '-';
}
} }
Msg::DisplayMsg(fileName);
downloadToFile(infoJson[screenPos + i]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[screenPos + i]["curRevision"] = infoJson[screenPos + i]["revision"];
} }
Msg::DisplayMsg(fileName);
downloadToFile(infoJson[screenPos + i]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[screenPos + i]["curRevision"] = infoJson[screenPos + i]["revision"];
} }
} }
} else if (Config::viewMode == 1) {
for(int i=0;i<ENTRIES_PER_LIST && i<(int)infoJson.size();i++) {
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
if (infoJson.size() != 0) {
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[screenPosList + i]["title"]);
std::string titleFix = infoJson[screenPosList + i]["title"];
for (int l = 0; l < (int)titleFix.size(); l++) {
if (titleFix[l] == '/') {
titleFix[l] = '-';
}
}
Msg::DisplayMsg(fileName);
downloadToFile(infoJson[screenPosList + i]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[screenPosList + i]["curRevision"] = infoJson[screenPosList + i]["revision"];
}
}
}
}
}
if (hDown & KEY_A) {
if (infoJson.size() != 0) {
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[Selection]["title"]);
std::string titleFix = infoJson[Selection]["title"];
for (int i = 0; i < (int)titleFix.size(); i++) {
if (titleFix[i] == '/') {
titleFix[i] = '-';
}
}
Msg::DisplayMsg(fileName);
downloadToFile(infoJson[Selection]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[Selection]["curRevision"] = infoJson[Selection]["revision"];
}
}
if (hDown & KEY_R) {
fastMode = true;
}
if (hDown & KEY_L) {
fastMode = false;
}
if ((hDown & KEY_X) || (hDown & KEY_TOUCH && touching(touch, arrowPos[4]))) {
if (Config::viewMode == 0) {
Config::viewMode = 1;
} else {
Config::viewMode = 0;
}
}
if (Config::viewMode == 0) {
if(Selection < screenPos) {
screenPos = Selection;
} else if (Selection > screenPos + ENTRIES_PER_SCREEN - 1) {
screenPos = Selection - ENTRIES_PER_SCREEN + 1;
} }
} else if (Config::viewMode == 1) { } else if (Config::viewMode == 1) {
for(int i=0;i<ENTRIES_PER_LIST && i<(int)infoJson.size();i++) { if(Selection < screenPosList) {
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) { screenPosList = Selection;
if (infoJson.size() != 0) { } else if (Selection > screenPosList + ENTRIES_PER_LIST - 1) {
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[screenPosList + i]["title"]); screenPosList = Selection - ENTRIES_PER_LIST + 1;
std::string titleFix = infoJson[screenPosList + i]["title"]; }
for (int l = 0; l < (int)titleFix.size(); l++) { }
if (titleFix[l] == '/') {
titleFix[l] = '-'; if ((hDown & KEY_Y) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
} if (infoJson.size() != 0) {
for (int i = 0; i < (int)infoJson.size(); i++) {
int current = i+1;
int total = infoJson.size();
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[i]["title"]);
std::string titleFix = infoJson[i]["title"];
for (int l = 0; l < (int)titleFix.size(); l++) {
if (titleFix[l] == '/') {
titleFix[l] = '-';
} }
Msg::DisplayMsg(fileName);
downloadToFile(infoJson[screenPosList + i]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[screenPosList + i]["curRevision"] = infoJson[screenPosList + i]["revision"];
} }
Msg::DisplayMsg(fileName + " " + std::to_string(current) + " / " + std::to_string(total));
downloadToFile(infoJson[i]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[i]["curRevision"] = infoJson[i]["revision"];
} }
} }
} }
} }
if (hDown & KEY_A) { // Switch to Glossary and back.
if (infoJson.size() != 0) { if (hDown & KEY_RIGHT || hDown & KEY_LEFT) {
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[selection]["title"]); if (mode == 0) mode = 1;
else mode = 0;
std::string titleFix = infoJson[selection]["title"];
for (int i = 0; i < (int)titleFix.size(); i++) {
if (titleFix[i] == '/') {
titleFix[i] = '-';
}
}
Msg::DisplayMsg(fileName);
downloadToFile(infoJson[selection]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[selection]["curRevision"] = infoJson[selection]["revision"];
}
}
if (hDown & KEY_R) {
fastMode = true;
}
if (hDown & KEY_L) {
fastMode = false;
}
if ((hDown & KEY_X) || (hDown & KEY_TOUCH && touching(touch, arrowPos[4]))) {
if (Config::viewMode == 0) {
Config::viewMode = 1;
} else {
Config::viewMode = 0;
}
}
if (Config::viewMode == 0) {
if(selection < screenPos) {
screenPos = selection;
} else if (selection > screenPos + ENTRIES_PER_SCREEN - 1) {
screenPos = selection - ENTRIES_PER_SCREEN + 1;
}
} else if (Config::viewMode == 1) {
if(selection < screenPosList) {
screenPosList = selection;
} else if (selection > screenPosList + ENTRIES_PER_LIST - 1) {
screenPosList = selection - ENTRIES_PER_LIST + 1;
}
}
if ((hDown & KEY_Y) || (hDown & KEY_TOUCH && touching(touch, arrowPos[3]))) {
if (infoJson.size() != 0) {
for (int i = 0; i < (int)infoJson.size(); i++) {
int current = i+1;
int total = infoJson.size();
std::string fileName = Lang::get("DOWNLOADING") + std::string(infoJson[i]["title"]);
std::string titleFix = infoJson[i]["title"];
for (int l = 0; l < (int)titleFix.size(); l++) {
if (titleFix[l] == '/') {
titleFix[l] = '-';
}
}
Msg::DisplayMsg(fileName + " " + std::to_string(current) + " / " + std::to_string(total));
downloadToFile(infoJson[i]["url"], Config::ScriptPath + titleFix + ".json");
infoJson[i]["curRevision"] = infoJson[i]["revision"];
}
}
} }
} }
File diff suppressed because it is too large Load Diff
+285 -233
View File
@@ -30,7 +30,6 @@
#include "json.hpp" #include "json.hpp"
#include "keyboard.hpp" #include "keyboard.hpp"
#include "mainMenu.hpp" #include "mainMenu.hpp"
#include "scriptHelper.hpp"
#include "unistore.hpp" #include "unistore.hpp"
#include <algorithm> #include <algorithm>
@@ -39,8 +38,6 @@
extern bool touching(touchPosition touch, Structs::ButtonPos button); extern bool touching(touchPosition touch, Structs::ButtonPos button);
extern u32 getColor(std::string colorString); extern u32 getColor(std::string colorString);
nlohmann::json appStoreJson;
std::string currentStoreFile;
extern bool isScriptSelected; extern bool isScriptSelected;
extern u32 barColor; extern u32 barColor;
@@ -55,20 +52,8 @@ bool changeBackState = false;
C2D_SpriteSheet appStoreSheet; C2D_SpriteSheet appStoreSheet;
struct storeInfo2 {
std::string title;
std::string author;
std::string description;
std::string url;
std::string file;
std::string storeSheet;
std::string sheetURL;
};
storeInfo2 SI;
// Parse informations like URL, Title, Author, Description. // Parse informations like URL, Title, Author, Description.
storeInfo2 parseStoreInfo(std::string fileName) { StoreInfo parseStoreInfo(std::string fileName) {
FILE* file = fopen(fileName.c_str(), "rt"); FILE* file = fopen(fileName.c_str(), "rt");
if(!file) { if(!file) {
printf("File not found\n"); printf("File not found\n");
@@ -77,7 +62,7 @@ storeInfo2 parseStoreInfo(std::string fileName) {
nlohmann::json json = nlohmann::json::parse(file, nullptr, false); nlohmann::json json = nlohmann::json::parse(file, nullptr, false);
fclose(file); fclose(file);
storeInfo2 info; StoreInfo info;
info.title = ScriptHelper::getString(json, "storeInfo", "title"); info.title = ScriptHelper::getString(json, "storeInfo", "title");
info.author = ScriptHelper::getString(json, "storeInfo", "author"); info.author = ScriptHelper::getString(json, "storeInfo", "author");
info.description = ScriptHelper::getString(json, "storeInfo", "description"); info.description = ScriptHelper::getString(json, "storeInfo", "description");
@@ -88,7 +73,7 @@ storeInfo2 parseStoreInfo(std::string fileName) {
return info; return info;
} }
nlohmann::json openStoreFile() { nlohmann::json UniStore::openStoreFile() {
FILE* file = fopen(currentStoreFile.c_str(), "rt"); FILE* file = fopen(currentStoreFile.c_str(), "rt");
nlohmann::json jsonFile; nlohmann::json jsonFile;
if(file) jsonFile = nlohmann::json::parse(file, nullptr, false); if(file) jsonFile = nlohmann::json::parse(file, nullptr, false);
@@ -96,11 +81,6 @@ nlohmann::json openStoreFile() {
return jsonFile; return jsonFile;
} }
std::vector<storeInfo2> storeInfo; // Store selection.
std::vector<std::string> appStoreList; // Actual store. ;P
std::vector<std::string> descLines;
std::string storeDesc = "";
// Parse the Objects. // Parse the Objects.
std::vector<std::string> parseStoreObjects(std::string storeName) { std::vector<std::string> parseStoreObjects(std::string storeName) {
FILE* file = fopen(storeName.c_str(), "rt"); FILE* file = fopen(storeName.c_str(), "rt");
@@ -122,7 +102,7 @@ std::vector<std::string> parseStoreObjects(std::string storeName) {
bool sheetHasLoaded = false; bool sheetHasLoaded = false;
// Sheet / Icon stuff. // Sheet / Icon stuff.
void loadStoreSheet(int pos) { void UniStore::loadStoreSheet(int pos) {
if (sheetHasLoaded == false) { if (sheetHasLoaded == false) {
appStoreSheet = C2D_SpriteSheetLoad(storeInfo[pos].storeSheet.c_str()); appStoreSheet = C2D_SpriteSheetLoad(storeInfo[pos].storeSheet.c_str());
sheetHasLoaded = true; sheetHasLoaded = true;
@@ -157,12 +137,12 @@ void drawNormal(int key, int x, int y) {
} }
void UniStore::descript() { void UniStore::descript() {
if (storeInfo[selection].description != "" || storeInfo[selection].description != "MISSING: storeInfo.description") { if (storeInfo[Selection].description != "" || storeInfo[Selection].description != "MISSING: storeInfo.description") {
storeDesc = storeInfo[selection].description; storeDesc = storeInfo[Selection].description;
} else storeDesc = ""; } else storeDesc = "";
} }
void loadStoreDesc(void) { void UniStore::loadStoreDesc(void) {
descLines.clear(); descLines.clear();
while(storeDesc.find('\n') != storeDesc.npos) { while(storeDesc.find('\n') != storeDesc.npos) {
descLines.push_back(storeDesc.substr(0, storeDesc.find('\n'))); descLines.push_back(storeDesc.substr(0, storeDesc.find('\n')));
@@ -206,6 +186,7 @@ UniStore::UniStore() {
Gui::setScreen(std::make_unique<MainMenu>()); Gui::setScreen(std::make_unique<MainMenu>());
} }
StoreInfo SI;
// If WiFi enabled & File exist, update store. // If WiFi enabled & File exist, update store.
if (ScriptHelper::checkIfValid(Config::AutobootFile, 1) == true) { if (ScriptHelper::checkIfValid(Config::AutobootFile, 1) == true) {
SI = parseStoreInfo(Config::AutobootFile); SI = parseStoreInfo(Config::AutobootFile);
@@ -236,7 +217,7 @@ UniStore::UniStore() {
appStoreJson = openStoreFile(); appStoreJson = openStoreFile();
appStoreList = parseStoreObjects(currentStoreFile); appStoreList = parseStoreObjects(currentStoreFile);
loadStoreColors(appStoreJson); loadStoreColors(appStoreJson);
selectedOptionAppStore = 0; Selection = 0;
displayInformations = handleIfDisplayText(); displayInformations = handleIfDisplayText();
isScriptSelected = true; isScriptSelected = true;
mode = 2; mode = 2;
@@ -266,7 +247,7 @@ void UniStore::DrawSubMenu(void) const {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
Gui::Draw_Rect(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, Config::UnselectedColor); Gui::Draw_Rect(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, Config::UnselectedColor);
if (subSelection == i) { if (Selection == i) {
Gui::drawAnimatedSelector(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, .060, TRANSPARENT, Config::SelectedColor); Gui::drawAnimatedSelector(subPos[i].x, subPos[i].y, subPos[i].w, subPos[i].h, .060, TRANSPARENT, Config::SelectedColor);
} }
} }
@@ -281,13 +262,13 @@ void UniStore::DrawSubMenu(void) const {
void UniStore::DrawStoreList(void) const { void UniStore::DrawStoreList(void) const {
std::string line1; std::string line1;
std::string line2; std::string line2;
std::string storeAmount = std::to_string(selection +1) + " / " + std::to_string(storeInfo.size()); std::string storeAmount = std::to_string(Selection +1) + " / " + std::to_string(storeInfo.size());
GFX::DrawTop(); GFX::DrawTop();
if (Config::UseBars == true) { if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, storeInfo[selection].title, 400); Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, storeInfo[Selection].title, 400);
Gui::DrawString(397-Gui::GetStringWidth(0.6f, storeAmount), 239-Gui::GetStringHeight(0.6f, storeAmount), 0.6f, Config::TxtColor, storeAmount); Gui::DrawString(397-Gui::GetStringWidth(0.6f, storeAmount), 239-Gui::GetStringHeight(0.6f, storeAmount), 0.6f, Config::TxtColor, storeAmount);
} else { } else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, storeInfo[selection].title, 400); Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, storeInfo[Selection].title, 400);
Gui::DrawString(397-Gui::GetStringWidth(0.6f, storeAmount), 237-Gui::GetStringHeight(0.6f, storeAmount), 0.6f, Config::TxtColor, storeAmount); Gui::DrawString(397-Gui::GetStringWidth(0.6f, storeAmount), 237-Gui::GetStringHeight(0.6f, storeAmount), 0.6f, Config::TxtColor, storeAmount);
} }
for(uint i=0;i<descLines.size();i++) { for(uint i=0;i<descLines.size();i++) {
@@ -307,7 +288,7 @@ void UniStore::DrawStoreList(void) const {
Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor); Gui::Draw_Rect(0, 40+(i*57), 320, 45, Config::UnselectedColor);
line1 = storeInfo[screenPos + i].title; line1 = storeInfo[screenPos + i].title;
line2 = storeInfo[screenPos + i].author; line2 = storeInfo[screenPos + i].author;
if(screenPos + i == selection) { if(screenPos + i == Selection) {
Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor); Gui::drawAnimatedSelector(0, 40+(i*57), 320, 45, .060, TRANSPARENT, Config::SelectedColor);
} }
Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, line1, 320); Gui::DrawStringCentered(0, 38+(i*57), 0.7f, Config::TxtColor, line1, 320);
@@ -317,7 +298,7 @@ void UniStore::DrawStoreList(void) const {
for(int i=0;i<ENTRIES_PER_LIST && i<(int)storeInfo.size();i++) { for(int i=0;i<ENTRIES_PER_LIST && i<(int)storeInfo.size();i++) {
Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor); Gui::Draw_Rect(0, (i+1)*27, 320, 25, Config::UnselectedColor);
line1 = storeInfo[screenPosList + i].title; line1 = storeInfo[screenPosList + i].title;
if(screenPosList + i == selection) { if(screenPosList + i == Selection) {
Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor); Gui::drawAnimatedSelector(0, (i+1)*27, 320, 25, .060, TRANSPARENT, Config::SelectedColor);
} }
Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, line1, 320); Gui::DrawStringCentered(0, ((i+1)*27)+1, 0.7f, Config::TxtColor, line1, 320);
@@ -326,7 +307,7 @@ void UniStore::DrawStoreList(void) const {
} }
void UniStore::DrawStore(void) const { void UniStore::DrawStore(void) const {
std::string entryAmount = std::to_string(selectedOptionAppStore+1) + " / " + std::to_string((int)appStoreJson.at("storeContent").size()); std::string entryAmount = std::to_string(Selection+1) + " / " + std::to_string((int)appStoreJson.at("storeContent").size());
std::string info; std::string info;
GFX::DrawTop(); GFX::DrawTop();
// Top Background. // Top Background.
@@ -335,11 +316,11 @@ void UniStore::DrawStore(void) const {
} }
// Icon. // Icon.
if (appStoreJson.at("storeContent").at(selectedOptionAppStore).at("info").contains("iconIndex") && sheetHasLoaded == true) { if (appStoreJson.at("storeContent").at(Selection).at("info").contains("iconIndex") && sheetHasLoaded == true) {
if (appStoreJson.at("storeContent").at(selectedOptionAppStore).at("info").contains("posX") && appStoreJson.at("storeContent").at(selectedOptionAppStore).at("info").contains("posY")) { if (appStoreJson.at("storeContent").at(Selection).at("info").contains("posX") && appStoreJson.at("storeContent").at(Selection).at("info").contains("posY")) {
drawNormal(appStoreJson["storeContent"][selectedOptionAppStore]["info"]["iconIndex"], appStoreJson["storeContent"][selectedOptionAppStore]["info"]["posX"], appStoreJson["storeContent"][selectedOptionAppStore]["info"]["posY"]); drawNormal(appStoreJson["storeContent"][Selection]["info"]["iconIndex"], appStoreJson["storeContent"][Selection]["info"]["posX"], appStoreJson["storeContent"][Selection]["info"]["posY"]);
} else { } else {
drawNormal(appStoreJson["storeContent"][selectedOptionAppStore]["info"]["iconIndex"], 175, 155); drawNormal(appStoreJson["storeContent"][Selection]["info"]["iconIndex"], 175, 155);
} }
} }
@@ -352,18 +333,18 @@ void UniStore::DrawStore(void) const {
Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 237-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, TextColor, entryAmount); Gui::DrawString(397-Gui::GetStringWidth(0.6f, entryAmount), 237-Gui::GetStringHeight(0.6f, entryAmount), 0.6f, TextColor, entryAmount);
} }
Gui::DrawStringCentered(0, 32, 0.6f, TextColor, Lang::get("TITLE") + std::string(appStoreJson["storeContent"][selectedOptionAppStore]["info"]["title"]), 400); Gui::DrawStringCentered(0, 32, 0.6f, TextColor, Lang::get("TITLE") + std::string(appStoreJson["storeContent"][Selection]["info"]["title"]), 400);
Gui::DrawStringCentered(0, 57, 0.6f, TextColor, Lang::get("AUTHOR") + std::string(appStoreJson["storeContent"][selectedOptionAppStore]["info"]["author"]), 400); Gui::DrawStringCentered(0, 57, 0.6f, TextColor, Lang::get("AUTHOR") + std::string(appStoreJson["storeContent"][Selection]["info"]["author"]), 400);
Gui::DrawStringCentered(0, 82, 0.6f, TextColor, Lang::get("DESC") + std::string(appStoreJson["storeContent"][selectedOptionAppStore]["info"]["description"]), 400); Gui::DrawStringCentered(0, 82, 0.6f, TextColor, Lang::get("DESC") + std::string(appStoreJson["storeContent"][Selection]["info"]["description"]), 400);
if (appStoreJson["storeContent"][selectedOptionAppStore]["info"]["version"] != "") { if (appStoreJson["storeContent"][Selection]["info"]["version"] != "") {
Gui::DrawStringCentered(0, 107, 0.6f, TextColor, Lang::get("VERSION") + std::string(appStoreJson["storeContent"][selectedOptionAppStore]["info"]["version"]), 400); Gui::DrawStringCentered(0, 107, 0.6f, TextColor, Lang::get("VERSION") + std::string(appStoreJson["storeContent"][Selection]["info"]["version"]), 400);
} else { } else {
Gui::DrawStringCentered(0, 107, 0.6f, TextColor, Lang::get("VERSION") + Lang::get("UNKNOWN"), 400); Gui::DrawStringCentered(0, 107, 0.6f, TextColor, Lang::get("VERSION") + Lang::get("UNKNOWN"), 400);
} }
if (appStoreJson["storeContent"][selectedOptionAppStore]["info"]["fileSize"] != 0) { if (appStoreJson["storeContent"][Selection]["info"]["fileSize"] != 0) {
Gui::DrawStringCentered(0, 132, 0.6f, TextColor, Lang::get("FILE_SIZE") + formatBytes(int64_t(appStoreJson["storeContent"][selectedOptionAppStore]["info"]["fileSize"])), 400); Gui::DrawStringCentered(0, 132, 0.6f, TextColor, Lang::get("FILE_SIZE") + formatBytes(int64_t(appStoreJson["storeContent"][Selection]["info"]["fileSize"])), 400);
} else { } else {
Gui::DrawStringCentered(0, 132, 0.6f, TextColor, Lang::get("FILE_SIZE") + Lang::get("UNKNOWN"), 400); Gui::DrawStringCentered(0, 132, 0.6f, TextColor, Lang::get("FILE_SIZE") + Lang::get("UNKNOWN"), 400);
} }
@@ -382,8 +363,8 @@ void UniStore::DrawStore(void) const {
if (Config::viewMode == 0) { if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)appStoreJson.at("storeContent").size();i++) { for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)appStoreJson.at("storeContent").size();i++) {
info = appStoreJson["storeContent"][screenPos2 + i]["info"]["title"]; info = appStoreJson["storeContent"][screenPos + i]["info"]["title"];
if(screenPos2 + i == selectedOptionAppStore) { if(screenPos + i == Selection) {
if (appStoreJson.at("storeInfo").contains("buttonLarge") && sheetHasLoaded == true) { if (appStoreJson.at("storeInfo").contains("buttonLarge") && sheetHasLoaded == true) {
drawNormal(appStoreJson["storeInfo"]["buttonLarge"], 0, 40+(i*57)); drawNormal(appStoreJson["storeInfo"]["buttonLarge"], 0, 40+(i*57));
} else { } else {
@@ -400,8 +381,8 @@ void UniStore::DrawStore(void) const {
} }
} else if (Config::viewMode == 1) { } else if (Config::viewMode == 1) {
for(int i=0;i<ENTRIES_PER_LIST && i<(int)appStoreJson.at("storeContent").size();i++) { for(int i=0;i<ENTRIES_PER_LIST && i<(int)appStoreJson.at("storeContent").size();i++) {
info = appStoreJson["storeContent"][screenPosList2 + i]["info"]["title"]; info = appStoreJson["storeContent"][screenPosList + i]["info"]["title"];
if(screenPosList2 + i == selectedOptionAppStore) { if(screenPosList + i == Selection) {
if (appStoreJson.at("storeInfo").contains("buttonSmall") && sheetHasLoaded == true) { if (appStoreJson.at("storeInfo").contains("buttonSmall") && sheetHasLoaded == true) {
drawNormal(appStoreJson["storeInfo"]["buttonSmall"], 0, (i+1)*27); drawNormal(appStoreJson["storeInfo"]["buttonSmall"], 0, (i+1)*27);
} else { } else {
@@ -432,6 +413,8 @@ void UniStore::Draw(void) const {
DrawFullURLScreen(); DrawFullURLScreen();
} else if (mode == 5) { } else if (mode == 5) {
DrawGitHubScreen(); DrawGitHubScreen();
} else if (mode == 6) {
DrawGlossary();
} }
} }
@@ -475,9 +458,11 @@ void UniStore::refreshList() {
descript(); descript();
loadStoreDesc(); loadStoreDesc();
} }
Selection = 0;
mode = 1; mode = 1;
} else { } else {
Msg::DisplayWarnMsg(Lang::get("GET_STORES_FIRST")); Msg::DisplayWarnMsg(Lang::get("GET_STORES_FIRST"));
Selection = 0;
mode = 0; mode = 0;
} }
} }
@@ -492,14 +477,14 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
} }
if (hDown & KEY_UP) { if (hDown & KEY_UP) {
if(subSelection > 0) subSelection--; if(Selection > 0) Selection--;
} }
if (hDown & KEY_DOWN) { if (hDown & KEY_DOWN) {
if(subSelection < 2) subSelection++; if(Selection < 2) Selection++;
} }
if (hDown & KEY_A) { if (hDown & KEY_A) {
switch(subSelection) { switch(Selection) {
case 0: case 0:
if (returnIfExist(Config::StorePath, {"unistore"}) == true) { if (returnIfExist(Config::StorePath, {"unistore"}) == true) {
Msg::DisplayMsg(Lang::get("REFRESHING_LIST")); Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
@@ -512,6 +497,7 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
descript(); descript();
loadStoreDesc(); loadStoreDesc();
} }
Selection = 0;
mode = 1; mode = 1;
} else { } else {
Msg::DisplayWarnMsg(Lang::get("GET_STORES_FIRST")); Msg::DisplayWarnMsg(Lang::get("GET_STORES_FIRST"));
@@ -519,6 +505,7 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
break; break;
case 1: case 1:
if (checkWifiStatus()) { if (checkWifiStatus()) {
Selection = 0;
mode = 3; mode = 3;
} else { } else {
notConnectedMsg(); notConnectedMsg();
@@ -546,12 +533,14 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
descript(); descript();
loadStoreDesc(); loadStoreDesc();
} }
Selection = 0;
mode = 1; mode = 1;
} else { } else {
Msg::DisplayWarnMsg(Lang::get("GET_STORES_FIRST")); Msg::DisplayWarnMsg(Lang::get("GET_STORES_FIRST"));
} }
} else if (touching(touch, subPos[1])) { } else if (touching(touch, subPos[1])) {
if (checkWifiStatus() == true) { if (checkWifiStatus() == true) {
Selection = 0;
mode = 3; mode = 3;
} else { } else {
notConnectedMsg(); notConnectedMsg();
@@ -571,6 +560,7 @@ void UniStore::deleteStore(int selectedStore) {
deleteFile(path.c_str()); deleteFile(path.c_str());
// Refresh the list. // Refresh the list.
Msg::DisplayMsg(Lang::get("REFRESHING_LIST")); Msg::DisplayMsg(Lang::get("REFRESHING_LIST"));
Selection = 0;
dirContents.clear(); dirContents.clear();
storeInfo.clear(); storeInfo.clear();
chdir(Config::StorePath.c_str()); chdir(Config::StorePath.c_str());
@@ -583,6 +573,7 @@ void UniStore::deleteStore(int selectedStore) {
if (dirContents.size() == 0) { if (dirContents.size() == 0) {
dirContents.clear(); dirContents.clear();
storeInfo.clear(); storeInfo.clear();
Selection = 0;
mode = 0; mode = 0;
} }
} }
@@ -606,16 +597,17 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) { if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
storeInfo.clear(); storeInfo.clear();
Selection = 0;
mode = 0; mode = 0;
} }
if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) { if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
if (selection < (int)storeInfo.size()-1) { if (Selection < (int)storeInfo.size()-1) {
selection++; Selection++;
descript(); descript();
loadStoreDesc(); loadStoreDesc();
} else { } else {
selection = 0; Selection = 0;
descript(); descript();
loadStoreDesc(); loadStoreDesc();
} }
@@ -626,12 +618,12 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
} }
} }
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) { if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
if (selection > 0) { if (Selection > 0) {
selection--; Selection--;
descript(); descript();
loadStoreDesc(); loadStoreDesc();
} else { } else {
selection = (int)storeInfo.size()-1; Selection = (int)storeInfo.size()-1;
descript(); descript();
loadStoreDesc(); loadStoreDesc();
} }
@@ -643,27 +635,28 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
} }
if ((hDown & KEY_Y) || (hDown & KEY_TOUCH && touching(touch, arrowPos[5]))) { if ((hDown & KEY_Y) || (hDown & KEY_TOUCH && touching(touch, arrowPos[5]))) {
updateStore(selection); updateStore(Selection);
} }
if (hDown & KEY_A) { if (hDown & KEY_A) {
if (dirContents[selection].isDirectory) { if (dirContents[Selection].isDirectory) {
} else if (storeInfo.size() != 0) { } else if (storeInfo.size() != 0) {
if (ScriptHelper::checkIfValid(dirContents[selection].name, 1) == true) { if (ScriptHelper::checkIfValid(dirContents[Selection].name, 1) == true) {
updateStore(selection); updateStore(Selection);
currentStoreFile = dirContents[selection].name; currentStoreFile = dirContents[Selection].name;
Msg::DisplayMsg(Lang::get("PREPARE_STORE")); Msg::DisplayMsg(Lang::get("PREPARE_STORE"));
if (storeInfo[selection].storeSheet != "" || storeInfo[selection].storeSheet != "MISSING: storeInfo.sheet") { if (storeInfo[Selection].storeSheet != "" || storeInfo[Selection].storeSheet != "MISSING: storeInfo.sheet") {
if(access(storeInfo[selection].storeSheet.c_str(), F_OK) != -1 ) { if(access(storeInfo[Selection].storeSheet.c_str(), F_OK) != -1 ) {
loadStoreSheet(selection); loadStoreSheet(Selection);
} }
} }
appStoreJson = openStoreFile(); appStoreJson = openStoreFile();
appStoreList = parseStoreObjects(currentStoreFile); appStoreList = parseStoreObjects(currentStoreFile);
loadStoreColors(appStoreJson); loadStoreColors(appStoreJson);
selectedOptionAppStore = 0; Selection = 0;
displayInformations = handleIfDisplayText(); displayInformations = handleIfDisplayText();
isScriptSelected = true; isScriptSelected = true;
Selection = 0;
mode = 2; mode = 2;
} }
} }
@@ -678,22 +671,22 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
} }
if (Config::viewMode == 0) { if (Config::viewMode == 0) {
if(selection < screenPos) { if(Selection < screenPos) {
screenPos = selection; screenPos = Selection;
} else if (selection > screenPos + ENTRIES_PER_SCREEN - 1) { } else if (Selection > screenPos + ENTRIES_PER_SCREEN - 1) {
screenPos = selection - ENTRIES_PER_SCREEN + 1; screenPos = Selection - ENTRIES_PER_SCREEN + 1;
} }
} else if (Config::viewMode == 1) { } else if (Config::viewMode == 1) {
if(selection < screenPosList) { if(Selection < screenPosList) {
screenPosList = selection; screenPosList = Selection;
} else if (selection > screenPosList + ENTRIES_PER_LIST - 1) { } else if (Selection > screenPosList + ENTRIES_PER_LIST - 1) {
screenPosList = selection - ENTRIES_PER_LIST + 1; screenPosList = Selection - ENTRIES_PER_LIST + 1;
} }
} }
if (hDown & KEY_SELECT) { if (hDown & KEY_SELECT) {
if (Msg::promptMsg(Lang::get("DELETE_STORE"))) { if (Msg::promptMsg(Lang::get("DELETE_STORE"))) {
deleteStore(selection); deleteStore(Selection);
} }
} }
@@ -713,7 +706,7 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
appStoreJson = openStoreFile(); appStoreJson = openStoreFile();
appStoreList = parseStoreObjects(currentStoreFile); appStoreList = parseStoreObjects(currentStoreFile);
loadStoreColors(appStoreJson); loadStoreColors(appStoreJson);
selectedOptionAppStore = 0; Selection = 0;
displayInformations = handleIfDisplayText(); displayInformations = handleIfDisplayText();
isScriptSelected = true; isScriptSelected = true;
mode = 2; mode = 2;
@@ -735,7 +728,7 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
appStoreJson = openStoreFile(); appStoreJson = openStoreFile();
appStoreList = parseStoreObjects(currentStoreFile); appStoreList = parseStoreObjects(currentStoreFile);
loadStoreColors(appStoreJson); loadStoreColors(appStoreJson);
selectedOptionAppStore = 0; Selection = 0;
displayInformations = handleIfDisplayText(); displayInformations = handleIfDisplayText();
isScriptSelected = true; isScriptSelected = true;
mode = 2; mode = 2;
@@ -752,11 +745,11 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
Config::AutobootFile = ""; Config::AutobootFile = "";
} }
} else { } else {
if (dirContents[selection].isDirectory) { if (dirContents[Selection].isDirectory) {
} else if (storeInfo.size() != 0) { } else if (storeInfo.size() != 0) {
if (ScriptHelper::checkIfValid(dirContents[selection].name, 1) == true) { if (ScriptHelper::checkIfValid(dirContents[Selection].name, 1) == true) {
if (Msg::promptMsg(Lang::get("AUTOBOOT_STORE"))) { if (Msg::promptMsg(Lang::get("AUTOBOOT_STORE"))) {
Config::AutobootFile = Config::StorePath + dirContents[selection].name; Config::AutobootFile = Config::StorePath + dirContents[Selection].name;
Config::autoboot = 1; Config::autoboot = 1;
} }
} }
@@ -770,12 +763,11 @@ void UniStore::StoreLogic(u32 hDown, u32 hHeld, touchPosition touch) {
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) { if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
refreshList(); refreshList();
Selection = 0;
mode = 1;
appStoreList.clear(); appStoreList.clear();
isScriptSelected = false; isScriptSelected = false;
selection2 = 0; freeSheet();
if (sheetHasLoaded == true) {
freeSheet();
}
} }
if (hDown & KEY_R) { if (hDown & KEY_R) {
@@ -788,10 +780,10 @@ void UniStore::StoreLogic(u32 hDown, u32 hHeld, touchPosition touch) {
// Go one entry up. // Go one entry up.
if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) { if ((hHeld & KEY_UP && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[0]))) {
if (selectedOptionAppStore > 0) { if (Selection > 0) {
selectedOptionAppStore--; Selection--;
} else { } else {
selectedOptionAppStore = (int)appStoreJson.at("storeContent").size()-1; Selection = (int)appStoreJson.at("storeContent").size()-1;
} }
if (fastMode == true) { if (fastMode == true) {
keyRepeatDelay = 3; keyRepeatDelay = 3;
@@ -802,10 +794,10 @@ void UniStore::StoreLogic(u32 hDown, u32 hHeld, touchPosition touch) {
// Go one entry down. // Go one entry down.
if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) { if ((hHeld & KEY_DOWN && !keyRepeatDelay) || (hDown & KEY_TOUCH && touching(touch, arrowPos[1]))) {
if (selectedOptionAppStore < (int)appStoreJson.at("storeContent").size()-1) { if (Selection < (int)appStoreJson.at("storeContent").size()-1) {
selectedOptionAppStore++; Selection++;
} else { } else {
selectedOptionAppStore = 0; Selection = 0;
} }
if (fastMode == true) { if (fastMode == true) {
keyRepeatDelay = 3; keyRepeatDelay = 3;
@@ -819,35 +811,44 @@ void UniStore::StoreLogic(u32 hDown, u32 hHeld, touchPosition touch) {
if (Config::viewMode == 0) { if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)appStoreJson.at("storeContent").size();i++) { for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)appStoreJson.at("storeContent").size();i++) {
if(touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) { if(touch.py > 40+(i*57) && touch.py < 40+(i*57)+45) {
selectedOptionAppStore = screenPos2 + i; Selection = screenPos + i;
execute(); std::string info = appStoreJson["storeContent"][Selection]["info"]["title"];
if (Msg::promptMsg(Lang::get("EXECUTE_STORE") + "\n\n" + info)) {
execute();
}
} }
} }
} else if (Config::viewMode == 1) { } else if (Config::viewMode == 1) {
for(int i=0;i<ENTRIES_PER_LIST && i<(int)appStoreJson.at("storeContent").size();i++) { for(int i=0;i<ENTRIES_PER_LIST && i<(int)appStoreJson.at("storeContent").size();i++) {
if(touch.py > (i+1)*27 && touch.py < (i+2)*27) { if(touch.py > (i+1)*27 && touch.py < (i+2)*27) {
selectedOptionAppStore = screenPosList2 + i; Selection = screenPosList + i;
execute(); std::string info = appStoreJson["storeContent"][Selection]["info"]["title"];
if (Msg::promptMsg(Lang::get("EXECUTE_STORE") + "\n\n" + info)) {
execute();
}
} }
} }
} }
} }
// Execute that Entry. // Execute that Entry.
if (hDown & KEY_A) { if (hDown & KEY_A) {
execute(); std::string info = appStoreJson["storeContent"][Selection]["info"]["title"];
if (Msg::promptMsg(Lang::get("EXECUTE_STORE") + "\n\n" + info)) {
execute();
}
} }
if (Config::viewMode == 0) { if (Config::viewMode == 0) {
if(selectedOptionAppStore < screenPos2) { if(Selection < screenPos) {
screenPos2 = selectedOptionAppStore; screenPos = Selection;
} else if (selectedOptionAppStore > screenPos2 + ENTRIES_PER_SCREEN - 1) { } else if (Selection > screenPos + ENTRIES_PER_SCREEN - 1) {
screenPos2 = selectedOptionAppStore - ENTRIES_PER_SCREEN + 1; screenPos = Selection - ENTRIES_PER_SCREEN + 1;
} }
} else if (Config::viewMode == 1) { } else if (Config::viewMode == 1) {
if(selectedOptionAppStore < screenPosList2) { if(Selection < screenPosList) {
screenPosList2 = selectedOptionAppStore; screenPosList = Selection;
} else if (selectedOptionAppStore > screenPosList2 + ENTRIES_PER_LIST - 1) { } else if (Selection > screenPosList + ENTRIES_PER_LIST - 1) {
screenPosList2 = selectedOptionAppStore - ENTRIES_PER_LIST + 1; screenPosList = Selection - ENTRIES_PER_LIST + 1;
} }
} }
} }
@@ -875,129 +876,18 @@ void UniStore::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
Config::viewMode = 0; Config::viewMode = 0;
} }
} }
}
// Execute Entry. if (hDown & KEY_LEFT || hDown & KEY_RIGHT) {
void UniStore::execute() { if (mode == 6) {
for(int i=0;i<(int)appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").size();i++) { mode = lastMode;
std::string type = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("type"); } else if (mode == 1) {
if(type == "deleteFile") { lastMode = 1;
bool missing = false; mode = 6;
std::string file, message; } else if (mode == 2) {
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("file")) file = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("file"); lastMode = 2;
else missing = true; mode = 6;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("message");
if(!missing) ScriptHelper::removeFile(file, message);
} else if(type == "downloadFile") {
bool missing = false;
std::string file, output, message;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("file")) file = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("file");
else missing = true;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("output")) output = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("output");
else missing = true;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("message");
if(!missing) ScriptHelper::downloadFile(file, output, message);
} else if(type == "downloadRelease") {
bool missing = false, includePrereleases = false;
std::string repo, file, output, message;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("repo")) repo = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("repo");
else missing = true;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("file")) file = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("file");
else missing = true;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("output")) output = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("output");
else missing = true;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("includePrereleases") && appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("includePrereleases").is_boolean())
includePrereleases = appStoreJson.at(selectedOptionAppStore).at("script").at(i).at("includePrereleases");
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("message");
if(!missing) ScriptHelper::downloadRelease(repo, file, output, includePrereleases, message);
} else if(type == "extractFile") {
bool missing = false;
std::string file, input, output, message;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("file")) file = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("file");
else missing = true;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("input")) input = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("input");
else missing = true;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("output")) output = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("output");
else missing = true;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("message");
if(!missing) ScriptHelper::extractFile(file, input, output, message);
} else if(type == "installCia") {
bool missing = false;
std::string file, message;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("file")) file = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("file");
else missing = true;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("message");
if(!missing) ScriptHelper::installFile(file, message);
} else if (type == "mkdir") {
bool missing = false;
std::string directory, message;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("directory")) directory = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("directory");
else missing = true;
if(!missing) makeDirs(directory.c_str());
} else if (type == "rmdir") {
bool missing = false;
std::string directory, message, promptmsg;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("directory")) directory = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("directory");
else missing = true;
promptmsg = Lang::get("DELETE_PROMPT") + "\n" + directory;
if(!missing) {
if (Msg::promptMsg(promptmsg)) {
removeDirRecursive(directory.c_str());
}
}
} else if (type == "mkfile") {
bool missing = false;
std::string file;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("file")) file = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("file");
else missing = true;
if(!missing) ScriptHelper::createFile(file.c_str());
} else if (type == "timeMsg") {
bool missing = false;
std::string message;
int seconds;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("message");
else missing = true;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("seconds") && appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("seconds").is_number())
seconds = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("seconds");
else missing = true;
if(!missing) ScriptHelper::displayTimeMsg(message, seconds);
} else if (type == "saveConfig") {
Config::save();
} else if (type == "notImplemented") {
notImplemented();
} else if (type == "deleteTitle") {
std::string TitleID = "";
std::string message = "";
bool isNAND = false, missing = false;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("TitleID")) TitleID = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("TitleID");
else missing = true;
if (appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("NAND") && appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("NAND").is_boolean()) isNAND = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("NAND");
else missing = true;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("message");
else missing = true;
if(!missing) ScriptHelper::deleteTitle(TitleID, isNAND, message);
} else if (type == "bootTitle") {
std::string TitleID = "";
std::string message = "";
bool isNAND = false, missing = false;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("TitleID")) TitleID = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("TitleID");
else missing = true;
if (appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("NAND") && appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("NAND").is_boolean()) isNAND = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("NAND");
else missing = true;
if(appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(selectedOptionAppStore).at("script").at(i).at("message");
else missing = true;
if(!missing) ScriptHelper::bootTitle(TitleID, isNAND, message);
} }
} }
doneMsg();
} }
void UniStore::DrawSearch(void) const { void UniStore::DrawSearch(void) const {
@@ -1014,7 +904,7 @@ void UniStore::DrawSearch(void) const {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
Gui::Draw_Rect(URLBtn[i].x, URLBtn[i].y, URLBtn[i].w, URLBtn[i].h, Config::UnselectedColor); Gui::Draw_Rect(URLBtn[i].x, URLBtn[i].y, URLBtn[i].w, URLBtn[i].h, Config::UnselectedColor);
if (searchSelection == i) { if (Selection == i) {
Gui::drawAnimatedSelector(URLBtn[i].x, URLBtn[i].y, URLBtn[i].w, URLBtn[i].h, .060, TRANSPARENT, Config::SelectedColor); Gui::drawAnimatedSelector(URLBtn[i].x, URLBtn[i].y, URLBtn[i].w, URLBtn[i].h, .060, TRANSPARENT, Config::SelectedColor);
} }
} }
@@ -1026,37 +916,42 @@ void UniStore::DrawSearch(void) const {
void UniStore::SearchLogic(u32 hDown, u32 hHeld, touchPosition touch) { void UniStore::SearchLogic(u32 hDown, u32 hHeld, touchPosition touch) {
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) { if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
Selection = 0;
mode = 0; mode = 0;
} }
if (hDown & KEY_RIGHT || hDown & KEY_R) { if (hDown & KEY_RIGHT || hDown & KEY_R) {
if (searchSelection == 0) searchSelection = 1; if (Selection == 0) Selection = 1;
} }
if (hDown & KEY_LEFT || hDown & KEY_L) { if (hDown & KEY_LEFT || hDown & KEY_L) {
if (searchSelection == 1) searchSelection = 0; if (Selection == 1) Selection = 0;
} }
if (hDown & KEY_DOWN) { if (hDown & KEY_DOWN) {
if (searchSelection == 0) searchSelection = 2; if (Selection == 0) Selection = 2;
} }
if (hDown & KEY_UP) { if (hDown & KEY_UP) {
if (searchSelection == 2) searchSelection = 0; if (Selection == 2) Selection = 0;
} }
if (hDown & KEY_A) { if (hDown & KEY_A) {
if (searchSelection == 0) { if (Selection == 0) {
Selection = 0;
mode = 4; mode = 4;
} else if (searchSelection == 1) { } else if (Selection == 1) {
Selection = 0;
mode = 5; mode = 5;
} else if (searchSelection == 2) { } else if (Selection == 2) {
ScriptHelper::downloadFile("https://tinydb.eiphax.tech/api/tinydb.unistore", Config::StorePath + "TinyDB.unistore", Lang::get("DOWNLOADING") + "TinyDB"); ScriptHelper::downloadFile("https://tinydb.eiphax.tech/api/tinydb.unistore", Config::StorePath + "TinyDB.unistore", Lang::get("DOWNLOADING") + "TinyDB");
} }
} }
if (hDown & KEY_TOUCH && touching(touch, URLBtn[0])) { if (hDown & KEY_TOUCH && touching(touch, URLBtn[0])) {
Selection = 0;
mode = 4; mode = 4;
} else if (hDown & KEY_TOUCH && touching(touch, URLBtn[1])) { } else if (hDown & KEY_TOUCH && touching(touch, URLBtn[1])) {
Selection = 0;
mode = 5; mode = 5;
} else if (hDown & KEY_TOUCH && touching(touch, URLBtn[2])) { } else if (hDown & KEY_TOUCH && touching(touch, URLBtn[2])) {
ScriptHelper::downloadFile("https://tinydb.eiphax.tech/api/tinydb.unistore", Config::StorePath + "TinyDB.unistore", Lang::get("DOWNLOADING") + "TinyDB"); ScriptHelper::downloadFile("https://tinydb.eiphax.tech/api/tinydb.unistore", Config::StorePath + "TinyDB.unistore", Lang::get("DOWNLOADING") + "TinyDB");
@@ -1113,6 +1008,7 @@ void UniStore::GitHubLogic(u32 hDown, u32 hHeld, touchPosition touch) {
// Reset everything. // Reset everything.
OwnerAndRepo = ""; OwnerAndRepo = "";
fileName = ""; fileName = "";
Selection = 0;
mode = 3; mode = 3;
} }
} }
@@ -1163,6 +1059,162 @@ void UniStore::FullURLLogic(u32 hDown, u32 hHeld, touchPosition touch) {
// Reset everything. // Reset everything.
FullURL = ""; FullURL = "";
fileName = ""; fileName = "";
Selection = 0;
mode = 3; mode = 3;
} }
} }
void UniStore::DrawGlossary(void) const {
GFX::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("GLOSSARY"), 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("GLOSSARY"), 400);
}
if (lastMode == 1) {
Gui::DrawString(15, 35, 0.7f, Config::TxtColor, std::to_string(Selection +1) + " / " + std::to_string(storeInfo.size()), 40);
Gui::DrawString(65, 35, 0.7f, Config::TxtColor, Lang::get("ENTRY"), 300);
} else if (lastMode == 2) {
Gui::DrawString(15, 35, 0.7f, Config::TxtColor, std::to_string(Selection+1) + " / " + std::to_string((int)appStoreJson.at("storeContent").size()), 40);
Gui::DrawString(65, 35, 0.7f, Config::TxtColor, Lang::get("ENTRY"), 300);
}
GFX::DrawBottom();
GFX::DrawSpriteBlend(sprites_view_idx, 20, 40);
Gui::DrawString(50, 42, 0.6f, Config::TxtColor, Lang::get("CHANGE_VIEW_MODE"), 260);
GFX::DrawArrow(20, 70);
Gui::DrawString(50, 72, 0.6f, Config::TxtColor, Lang::get("ENTRY_UP"), 260);
GFX::DrawArrow(42, 125, 180.0);
Gui::DrawString(50, 102, 0.6f, Config::TxtColor, Lang::get("ENTRY_DOWN"), 260);
GFX::DrawArrow(20, 130, 0, 1);
Gui::DrawString(50, 132, 0.6f, Config::TxtColor, Lang::get("GO_BACK"), 260);
if (lastMode == 1) {
GFX::DrawSpriteBlend(sprites_update_idx, 20, 160);
Gui::DrawString(50, 162, 0.6f, Config::TxtColor, Lang::get("UPDATE_STORE"), 260);
}
}
// Execute Entry.
void UniStore::execute() {
for(int i=0;i<(int)appStoreJson.at("storeContent").at(Selection).at("script").size();i++) {
std::string type = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("type");
if(type == "deleteFile") {
bool missing = false;
std::string file, message;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("file");
else missing = true;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("message");
if(!missing) ScriptHelper::removeFile(file, message);
} else if(type == "downloadFile") {
bool missing = false;
std::string file, output, message;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("file");
else missing = true;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("output")) output = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("output");
else missing = true;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("message");
if(!missing) ScriptHelper::downloadFile(file, output, message);
} else if(type == "downloadRelease") {
bool missing = false, includePrereleases = false;
std::string repo, file, output, message;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("repo")) repo = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("repo");
else missing = true;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("file");
else missing = true;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("output")) output = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("output");
else missing = true;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("includePrereleases") && appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("includePrereleases").is_boolean())
includePrereleases = appStoreJson.at(Selection).at("script").at(i).at("includePrereleases");
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("message");
if(!missing) ScriptHelper::downloadRelease(repo, file, output, includePrereleases, message);
} else if(type == "extractFile") {
bool missing = false;
std::string file, input, output, message;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("file");
else missing = true;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("input")) input = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("input");
else missing = true;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("output")) output = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("output");
else missing = true;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("message");
if(!missing) ScriptHelper::extractFile(file, input, output, message);
} else if(type == "installCia") {
bool missing = false;
std::string file, message;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("file");
else missing = true;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("message");
if(!missing) ScriptHelper::installFile(file, message);
} else if (type == "mkdir") {
bool missing = false;
std::string directory, message;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("directory")) directory = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("directory");
else missing = true;
if(!missing) makeDirs(directory.c_str());
} else if (type == "rmdir") {
bool missing = false;
std::string directory, message, promptmsg;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("directory")) directory = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("directory");
else missing = true;
promptmsg = Lang::get("DELETE_PROMPT") + "\n" + directory;
if(!missing) {
if (Msg::promptMsg(promptmsg)) {
removeDirRecursive(directory.c_str());
}
}
} else if (type == "mkfile") {
bool missing = false;
std::string file;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("file")) file = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("file");
else missing = true;
if(!missing) ScriptHelper::createFile(file.c_str());
} else if (type == "timeMsg") {
bool missing = false;
std::string message;
int seconds;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("message");
else missing = true;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("seconds") && appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("seconds").is_number())
seconds = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("seconds");
else missing = true;
if(!missing) ScriptHelper::displayTimeMsg(message, seconds);
} else if (type == "saveConfig") {
Config::save();
} else if (type == "notImplemented") {
notImplemented();
} else if (type == "deleteTitle") {
std::string TitleID = "";
std::string message = "";
bool isNAND = false, missing = false;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("TitleID")) TitleID = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("TitleID");
else missing = true;
if (appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("NAND") && appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("NAND").is_boolean()) isNAND = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("NAND");
else missing = true;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("message");
else missing = true;
if(!missing) ScriptHelper::deleteTitle(TitleID, isNAND, message);
} else if (type == "bootTitle") {
std::string TitleID = "";
std::string message = "";
bool isNAND = false, missing = false;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("TitleID")) TitleID = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("TitleID");
else missing = true;
if (appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("NAND") && appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("NAND").is_boolean()) isNAND = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("NAND");
else missing = true;
if(appStoreJson.at("storeContent").at(Selection).at("script").at(i).contains("message")) message = appStoreJson.at("storeContent").at(Selection).at("script").at(i).at("message");
else missing = true;
if(!missing) ScriptHelper::bootTitle(TitleID, isNAND, message);
}
}
doneMsg();
}