See desc for more.

- Added option, to have a 400x214px custom Image as the Background on a UniStore.

- Added a header bar on almost all menus.

- Added GUI Settings.
This commit is contained in:
StackZ
2020-11-01 04:31:04 +01:00
parent c5282a5767
commit a2f3efc640
20 changed files with 317 additions and 88 deletions
+2 -1
View File
@@ -27,10 +27,11 @@
#ifndef _UNIVERSAL_UPDATER_KEYBOARD_HPP #ifndef _UNIVERSAL_UPDATER_KEYBOARD_HPP
#define _UNIVERSAL_UPDATER_KEYBOARD_HPP #define _UNIVERSAL_UPDATER_KEYBOARD_HPP
#include "storeEntry.hpp"
#include <string> #include <string>
namespace Input { namespace Input {
std::string setkbdString(const uint &maxLength, const std::string &Text); std::string setkbdString(uint maxLength, const std::string &Text, const std::vector<std::unique_ptr<StoreEntry>> &entries);
}; };
#endif #endif
+2 -2
View File
@@ -34,9 +34,9 @@
namespace Overlays { namespace Overlays {
void SelectStore(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::unique_ptr<Meta> &meta); void SelectStore(std::unique_ptr<Store> &store, std::vector<std::unique_ptr<StoreEntry>> &entries, std::unique_ptr<Meta> &meta);
void SelectLanguage(); void SelectLanguage(const std::unique_ptr<Store> &store);
void ShowCredits(); void ShowCredits();
std::string SelectDir(const std::string &oldDir, const std::string &msg); std::string SelectDir(const std::string &oldDir, const std::string &msg, const std::unique_ptr<Store> &store);
}; };
#endif #endif
+7 -1
View File
@@ -76,10 +76,16 @@ public:
nlohmann::json &GetJson() { return this->storeJson; }; nlohmann::json &GetJson() { return this->storeJson; };
bool GetValid() const { return this->valid; }; bool GetValid() const { return this->valid; };
/* Both of these things are used for custom BG support. */
C2D_Image GetStoreImg() const { return this->storeBG; };
bool customBG() const { return this->hasCustomBG; };
private: private:
void SetC2DBGImage();
nlohmann::json storeJson = nullptr; nlohmann::json storeJson = nullptr;
std::vector<C2D_SpriteSheet> sheets; std::vector<C2D_SpriteSheet> sheets;
bool valid = false; C2D_Image storeBG = { nullptr };
bool valid = false, hasSheet = false, hasCustomBG = false;
int screenIndex = 0, entry = 0, box = 0, downEntry = 0, downIndex = 0; int screenIndex = 0, entry = 0, box = 0, downEntry = 0, downIndex = 0;
}; };
+5 -1
View File
@@ -71,6 +71,10 @@ public:
/* U-U Update check on startup. */ /* U-U Update check on startup. */
bool updatecheck() const { return this->v_updateCheck; }; bool updatecheck() const { return this->v_updateCheck; };
void updatecheck(bool v) { this->v_updateCheck = v; if (!this->changesMade) this->changesMade = true; }; void updatecheck(bool v) { this->v_updateCheck = v; if (!this->changesMade) this->changesMade = true; };
/* U-U Update check on startup. */
bool usebg() const { return this->v_showBg; };
void usebg(bool v) { this->v_showBg = v; if (!this->changesMade) this->changesMade = true; };
private: private:
/* Mainly helper. */ /* Mainly helper. */
bool getBool(const std::string &key); bool getBool(const std::string &key);
@@ -85,7 +89,7 @@ private:
std::string v_language = "en", v_lastStore = "universal-db-beta.unistore", std::string v_language = "en", v_lastStore = "universal-db-beta.unistore",
v_3dsxPath = "sdmc:/3ds", v_ndsPath = "sdmc:", v_archivePath = "sdmc:"; v_3dsxPath = "sdmc:/3ds", v_ndsPath = "sdmc:", v_archivePath = "sdmc:";
bool v_list = false, v_autoUpdate = true, v_metadata = true, v_updateCheck = true; bool v_list = false, v_autoUpdate = true, v_metadata = true, v_updateCheck = true, v_showBg = false;
}; };
#endif #endif
+11 -2
View File
@@ -1,17 +1,17 @@
{ {
"ASCENDING": "Ascending", "ASCENDING": "Ascending",
"AUTHOR": "Author", "AUTHOR": "Author",
"AUTO_UPDATE_SETTINGS": "Auto-update Settings", "AUTO_UPDATE_SETTINGS": "Auto-Update Settings",
"AUTO_UPDATE_SETTINGS_BTN": "Auto-update settings...", "AUTO_UPDATE_SETTINGS_BTN": "Auto-update settings...",
"AUTO_UPDATE_UNISTORE": "Auto-update UniStores", "AUTO_UPDATE_UNISTORE": "Auto-update UniStores",
"AUTO_UPDATE_UNISTORE_DESC": "With this, the last used UniStore will be updated automatically when launching Universal-Updater.", "AUTO_UPDATE_UNISTORE_DESC": "With this, the last used UniStore will be updated automatically when launching Universal-Updater.",
"AUTO_UPDATE_UU": "Auto-update Universal-Updater", "AUTO_UPDATE_UU": "Auto-update Universal-Updater",
"AUTO_UPDATE_UU_DESC": "When enabled, Universal-Updater will check for updates every time it's opened.", "AUTO_UPDATE_UU_DESC": "When enabled, Universal-Updater will check for updates every time it's opened.",
"AVAILABLE_DOWNLOADS": "Available Downloads",
"BOOT_TITLE": "Would you like to boot this title?", "BOOT_TITLE": "Would you like to boot this title?",
"CATEGORY": "Category", "CATEGORY": "Category",
"CHANGE_3DSX_PATH": "Change 3DSX path", "CHANGE_3DSX_PATH": "Change 3DSX path",
"CHANGE_ARCHIVE_PATH": "Change archive path", "CHANGE_ARCHIVE_PATH": "Change archive path",
"CHANGE_DIRECTORIES": "Change directories...",
"CHANGE_NDS_PATH": "Change NDS path", "CHANGE_NDS_PATH": "Change NDS path",
"CHECK_UNISTORE_UPDATES": "Checking for UniStore updates...", "CHECK_UNISTORE_UPDATES": "Checking for UniStore updates...",
"CHECK_UU_UPDATES": "Checking for Universal-Updater updates...", "CHECK_UU_UPDATES": "Checking for Universal-Updater updates...",
@@ -28,6 +28,8 @@
"DELETE_UNNEEDED_FILE": "Deleting unneeded file...", "DELETE_UNNEEDED_FILE": "Deleting unneeded file...",
"DESCENDING": "Descending", "DESCENDING": "Descending",
"DIRECTION": "Direction", "DIRECTION": "Direction",
"DIRECTORY_SETTINGS": "Directory Settings",
"DIRECTORY_SETTINGS_BTN": "Directory settings...",
"DISABLE_AUTOUPDATE_UNISTORE": "Disable auto-update UniStore on boot", "DISABLE_AUTOUPDATE_UNISTORE": "Disable auto-update UniStore on boot",
"DISABLE_UPDATE_CHECK": "Disable self-updating", "DISABLE_UPDATE_CHECK": "Disable self-updating",
"DONE": "Done!", "DONE": "Done!",
@@ -52,6 +54,8 @@
"FILTER_TO": "Filter to:", "FILTER_TO": "Filter to:",
"GITHUB": "Full credits can be found on GitHub", "GITHUB": "Full credits can be found on GitHub",
"GRID": "Grid", "GRID": "Grid",
"GUI_SETTINGS": "GUI Settings",
"GUI_SETTINGS_BTN": "GUI settings...",
"INCLUDE_IN_RESULTS": "Include in results:", "INCLUDE_IN_RESULTS": "Include in results:",
"INSTALL_UNIVERSAL_UPDATER": "Installing Universal-Updater...", "INSTALL_UNIVERSAL_UPDATER": "Installing Universal-Updater...",
"INVALID_UNISTORE": "Invalid UniStore", "INVALID_UNISTORE": "Invalid UniStore",
@@ -69,16 +73,21 @@
"NO_LICENSE": "No License", "NO_LICENSE": "No License",
"NOT_IMPLEMENTED": "Not Implemented Yet", "NOT_IMPLEMENTED": "Not Implemented Yet",
"REVISION": "Revision", "REVISION": "Revision",
"SEARCH_FILTERS": "Search and Filters",
"SELECT_DIR": "Select a directory", "SELECT_DIR": "Select a directory",
"SELECT_LANG": "Choose the language", "SELECT_LANG": "Choose the language",
"SELECT_UNISTORE": "Select UniStore", "SELECT_UNISTORE": "Select UniStore",
"SELECT_UNISTORE_2": "Select a UniStore", "SELECT_UNISTORE_2": "Select a UniStore",
"SETTINGS": "Settings",
"SHEET_SLASH": "Seems like a '/' is included, which is not supported.\nPlease change 'sheet' to filename only.", "SHEET_SLASH": "Seems like a '/' is included, which is not supported.\nPlease change 'sheet' to filename only.",
"SORT_BY": "Sort By", "SORT_BY": "Sort By",
"SORTING": "Sorting",
"START_SELECT": "Press START to select the current folder", "START_SELECT": "Press START to select the current folder",
"SYNTAX_ERROR": "Syntax Error!", "SYNTAX_ERROR": "Syntax Error!",
"TITLE": "Title", "TITLE": "Title",
"TOP_STYLE": "Top Style", "TOP_STYLE": "Top Style",
"UNISTORE_BG": "Use UniStore BG",
"UNISTORE_BG_DESC": "When enabled, the UniStore's provided BG will be shown instead of the solid BG color for the top screen.",
"UNISTORE_INVALID_ERROR": "This UniStore is invalid and cannot be\nloaded with Universal-Updater.\nMaybe check if there are any Syntax errors?", "UNISTORE_INVALID_ERROR": "This UniStore is invalid and cannot be\nloaded with Universal-Updater.\nMaybe check if there are any Syntax errors?",
"UNISTORE_TOO_NEW": "Your version of Universal-Updater is\ntoo old to use this UniStore.\nPlease update to the latest version.", "UNISTORE_TOO_NEW": "Your version of Universal-Updater is\ntoo old to use this UniStore.\nPlease update to the latest version.",
"UNISTORE_TOO_OLD": "This UniStore is outdated and cannot be used\nwith this version of Universal-Updater.\nPlease ask the creator to update it.", "UNISTORE_TOO_OLD": "This UniStore is outdated and cannot be used\nwith this version of Universal-Updater.\nPlease ask the creator to update it.",
+1 -1
View File
@@ -33,7 +33,7 @@
void GFX::DrawTop(void) { void GFX::DrawTop(void) {
Gui::ScreenDraw(Top); Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 25, BAR_COLOR); Gui::Draw_Rect(0, 0, 400, 25, BAR_COLOR);
Gui::Draw_Rect(0, 25, 400, 215, BG_COLOR); Gui::Draw_Rect(0, 26, 400, 214, BG_COLOR);
Gui::Draw_Rect(0, 25, 400, 1, BAR_OUTL_COLOR); Gui::Draw_Rect(0, 25, 400, 1, BAR_OUTL_COLOR);
} }
+24 -4
View File
@@ -28,22 +28,42 @@
#include "keyboard.hpp" #include "keyboard.hpp"
#include "screenCommon.hpp" #include "screenCommon.hpp"
static std::vector<SwkbdDictWord> words;
/* /*
Return a string of the keyboard. Return a string of the keyboard.
const uint &maxLength: Const Reference to the max length. uint maxLength: The max length.
const std::string &Text: Const Reference to the Text. const std::string &Text: Const Reference to the Text.
const std::vector<std::unique_ptr<StoreEntry>> &entries: Const Reference of all entries for the words to suggest.
*/ */
std::string Input::setkbdString(const uint &maxLength, const std::string &Text) { std::string Input::setkbdString(uint maxLength, const std::string &Text, const std::vector<std::unique_ptr<StoreEntry>> &entries) {
C3D_FrameEnd(0); // Needed, so the system will not freeze. C3D_FrameEnd(0); // Needed, so the system will not freeze.
SwkbdState state; SwkbdState state;
swkbdInit(&state, SWKBD_TYPE_NORMAL, 2, maxLength); swkbdInit(&state, SWKBD_TYPE_NORMAL, 2, maxLength);
char temp[maxLength] = { 0 }; char temp[maxLength + 1] = { 0 };
swkbdSetHintText(&state, Text.c_str()); swkbdSetHintText(&state, Text.c_str());
swkbdSetValidation(&state, SWKBD_NOTBLANK_NOTEMPTY, SWKBD_FILTER_PROFANITY, 0); swkbdSetValidation(&state, SWKBD_NOTBLANK_NOTEMPTY, SWKBD_FILTER_PROFANITY, 0);
if (entries.size()) {
words.clear();
words.resize(entries.size());
for (uint i = 0; i < entries.size(); i++) {
/* Checking for not nullptr. */
if (entries[i]) swkbdSetDictWord(&words[i], StringUtils::lower_case(entries[i]->GetTitle()).c_str(), entries[i]->GetTitle().c_str());
else swkbdSetDictWord(&words[i], "", "");
}
if (words.size() > 0) {
swkbdSetDictionary(&state, words.data(), entries.size());
swkbdSetFeatures(&state, SWKBD_PREDICTIVE_INPUT);
}
}
SwkbdButton ret = swkbdInputText(&state, temp, maxLength); SwkbdButton ret = swkbdInputText(&state, temp, maxLength);
temp[maxLength - 1] = '\0'; temp[maxLength] = '\0';
return (ret == SWKBD_BUTTON_CONFIRM ? temp : ""); return (ret == SWKBD_BUTTON_CONFIRM ? temp : "");
} }
+1 -1
View File
@@ -53,7 +53,7 @@ void Overlays::ShowCredits() {
Gui::Draw_Rect(0, 215, 400, 25, BAR_COLOR); Gui::Draw_Rect(0, 215, 400, 25, BAR_COLOR);
Gui::Draw_Rect(0, 214, 400, 1, BAR_OUTL_COLOR); Gui::Draw_Rect(0, 214, 400, 1, BAR_OUTL_COLOR);
Gui::DrawStringCentered(0, 217, 0.6f, TEXT_COLOR, Lang::get("CURRENT_VERSION") + std::string(V_STRING), 390); Gui::DrawStringCentered(0, 218, 0.6f, TEXT_COLOR, Lang::get("CURRENT_VERSION") + std::string(V_STRING), 390);
GFX::DrawBottom(); GFX::DrawBottom();
GFX::DrawSprite(sprites_universal_core_idx, 0, 26); GFX::DrawSprite(sprites_universal_core_idx, 0, 26);
+12 -3
View File
@@ -42,7 +42,7 @@ static const std::vector<Structs::ButtonPos> mainButtons = {
/* /*
Select a Directory. Select a Directory.
*/ */
std::string Overlays::SelectDir(const std::string &oldDir, const std::string &msg) { std::string Overlays::SelectDir(const std::string &oldDir, const std::string &msg, const std::unique_ptr<Store> &store) {
std::string currentPath = oldDir; std::string currentPath = oldDir;
bool dirChanged = true; bool dirChanged = true;
int selection = 0, sPos = 0; int selection = 0, sPos = 0;
@@ -68,7 +68,16 @@ std::string Overlays::SelectDir(const std::string &oldDir, const std::string &ms
C2D_TargetClear(Top, TRANSPARENT); C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT); C2D_TargetClear(Bottom, TRANSPARENT);
GFX::DrawTop(); if (store && config->usebg() && store->customBG()) {
Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 25, BAR_COLOR);
Gui::Draw_Rect(0, 25, 400, 1, BAR_OUTL_COLOR);
C2D_DrawImageAt(store->GetStoreImg(), 0, 26, 0.5f, nullptr);
} else {
GFX::DrawTop();
}
Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, msg, 380); Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, msg, 380);
Gui::Draw_Rect(0, 215, 400, 25, BAR_COLOR); Gui::Draw_Rect(0, 215, 400, 25, BAR_COLOR);
@@ -142,7 +151,7 @@ std::string Overlays::SelectDir(const std::string &oldDir, const std::string &ms
} }
if (hidKeysDown() & KEY_TOUCH) { if (hidKeysDown() & KEY_TOUCH) {
for (int i = 0; i < 6; i++) { for (int i = 0; i < 7; i++) {
if (touching(touch, mainButtons[i])) { if (touching(touch, mainButtons[i])) {
if (i + sPos < (int)dirContents.size()) { if (i + sPos < (int)dirContents.size()) {
if (dirContents[i + sPos].isDirectory) { if (dirContents[i + sPos].isDirectory) {
+11 -2
View File
@@ -51,7 +51,7 @@ static const std::vector<Structs::ButtonPos> mainButtons = {
Can be skipped with `B`. Can be skipped with `B`.
*/ */
void Overlays::SelectLanguage() { void Overlays::SelectLanguage(const std::unique_ptr<Store> &store) {
bool doOut = false; bool doOut = false;
int selection = 0, sPos = 0; int selection = 0, sPos = 0;
@@ -61,7 +61,16 @@ void Overlays::SelectLanguage() {
C2D_TargetClear(Top, TRANSPARENT); C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT); C2D_TargetClear(Bottom, TRANSPARENT);
GFX::DrawTop(); if (store && config->usebg() && store->customBG()) {
Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 25, BAR_COLOR);
Gui::Draw_Rect(0, 25, 400, 1, BAR_OUTL_COLOR);
C2D_DrawImageAt(store->GetStoreImg(), 0, 26, 0.5f, nullptr);
} else {
GFX::DrawTop();
}
Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, Lang::get("SELECT_LANG")); Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, Lang::get("SELECT_LANG"));
GFX::DrawBottom(); GFX::DrawBottom();
+11 -2
View File
@@ -104,7 +104,7 @@ static bool DownloadStore(bool Cam = true) {
bool doSheet = false; bool doSheet = false;
std::string file = ""; std::string file = "";
const std::string URL = Cam ? QR_Scanner::GetQRURL() : Input::setkbdString(150, Lang::get("ENTER_URL")); const std::string URL = Cam ? QR_Scanner::GetQRURL() : Input::setkbdString(150, Lang::get("ENTER_URL"), { });
if (URL != "") doSheet = DownloadUniStore(URL, -1, file, true); if (URL != "") doSheet = DownloadUniStore(URL, -1, file, true);
if (doSheet) { if (doSheet) {
@@ -178,7 +178,16 @@ void Overlays::SelectStore(std::unique_ptr<Store> &store, std::vector<std::uniqu
C2D_TargetClear(Top, TRANSPARENT); C2D_TargetClear(Top, TRANSPARENT);
C2D_TargetClear(Bottom, TRANSPARENT); C2D_TargetClear(Bottom, TRANSPARENT);
GFX::DrawTop(); if (store && config->usebg() && store->customBG()) {
Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 25, BAR_COLOR);
Gui::Draw_Rect(0, 25, 400, 1, BAR_OUTL_COLOR);
C2D_DrawImageAt(store->GetStoreImg(), 0, 26, 0.5f, nullptr);
} else {
GFX::DrawTop();
}
Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, Lang::get("SELECT_UNISTORE_2"), 390); Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, Lang::get("SELECT_UNISTORE_2"), 390);
if (info.size() > 0) { if (info.size() > 0) {
+4 -1
View File
@@ -84,7 +84,10 @@ MainScreen::MainScreen() {
MainScreen Main Draw. MainScreen Main Draw.
*/ */
void MainScreen::Draw(void) const { void MainScreen::Draw(void) const {
GFX::DrawTop(); Gui::ScreenDraw(Top);
Gui::Draw_Rect(0, 0, 400, 25, BAR_COLOR);
Gui::Draw_Rect(0, 25, 400, 1, BAR_OUTL_COLOR);
if (this->store && this->store->GetValid()) Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, this->store->GetUniStoreTitle(), 370); if (this->store && this->store->GetValid()) Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, this->store->GetUniStoreTitle(), 370);
else Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, Lang::get("INVALID_UNISTORE"), 370); else Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, Lang::get("INVALID_UNISTORE"), 370);
config->list() ? StoreUtils::DrawList(this->store, this->entries) : StoreUtils::DrawGrid(this->store, this->entries); config->list() ? StoreUtils::DrawList(this->store, this->entries) : StoreUtils::DrawGrid(this->store, this->entries);
+13 -10
View File
@@ -28,17 +28,16 @@
#include "storeUtils.hpp" #include "storeUtils.hpp"
#include "structs.hpp" #include "structs.hpp"
#define DOWNLOAD_ENTRIES 8 #define DOWNLOAD_ENTRIES 7
extern bool touching(touchPosition touch, Structs::ButtonPos button); extern bool touching(touchPosition touch, Structs::ButtonPos button);
static const std::vector<Structs::ButtonPos> downloadBoxes = { static const std::vector<Structs::ButtonPos> downloadBoxes = {
{ 54, 4, 262, 22 }, { 54, 32, 262, 22 },
{ 54, 34, 262, 22 }, { 54, 62, 262, 22 },
{ 54, 64, 262, 22 }, { 54, 92, 262, 22 },
{ 54, 94, 262, 22 }, { 54, 122, 262, 22 },
{ 54, 124, 262, 22 }, { 54, 152, 262, 22 },
{ 54, 154, 262, 22 }, { 54, 182, 262, 22 },
{ 54, 184, 262, 22 }, { 54, 212, 262, 22 }
{ 54, 214, 262, 22 }
}; };
/* /*
@@ -50,6 +49,10 @@ static const std::vector<Structs::ButtonPos> downloadBoxes = {
*/ */
void StoreUtils::DrawDownList(const std::unique_ptr<Store> &store, const std::vector<std::string> &entries, const bool &fetch) { void StoreUtils::DrawDownList(const std::unique_ptr<Store> &store, const std::vector<std::string> &entries, const bool &fetch) {
if (store && !fetch) { if (store && !fetch) {
Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR);
Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR);
Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("AVAILABLE_DOWNLOADS"), 265);
if (entries.size() > 0) { if (entries.size() > 0) {
for (int i = 0; i < DOWNLOAD_ENTRIES && i < (int)entries.size(); i++) { for (int i = 0; i < DOWNLOAD_ENTRIES && i < (int)entries.size(); i++) {
if (store->GetDownloadIndex() == i + store->GetDownloadSIndex()) GFX::DrawBox(downloadBoxes[i].x, downloadBoxes[i].y, downloadBoxes[i].w, downloadBoxes[i].h, false); if (store->GetDownloadIndex() == i + store->GetDownloadSIndex()) GFX::DrawBox(downloadBoxes[i].x, downloadBoxes[i].y, downloadBoxes[i].w, downloadBoxes[i].h, false);
@@ -57,7 +60,7 @@ void StoreUtils::DrawDownList(const std::unique_ptr<Store> &store, const std::ve
} }
} else { // If no downloads available.. } else { // If no downloads available..
Gui::DrawStringCentered(25, downloadBoxes[0].y + 4, 0.5f, TEXT_COLOR, Lang::get("NO_DOWNLOADS_AVAILABLE"), 255); Gui::DrawStringCentered(54 - 160 + (262 / 2), downloadBoxes[0].y + 4, 0.5f, TEXT_COLOR, Lang::get("NO_DOWNLOADS_AVAILABLE"), 255);
} }
} }
} }
+8
View File
@@ -55,6 +55,14 @@ static const std::vector<Structs::ButtonPos> GridBoxes = {
*/ */
void StoreUtils::DrawGrid(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries) { void StoreUtils::DrawGrid(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries) {
if (store) { // Ensure, store is not a nullptr. if (store) { // Ensure, store is not a nullptr.
if (config->usebg() && store->customBG()) {
C2D_DrawImageAt(store->GetStoreImg(), 0, 26, 0.5f, nullptr);
} else {
Gui::Draw_Rect(0, 26, 400, 214, BG_COLOR);
}
for (int i = 0, i2 = 0 + (store->GetScreenIndx() * 5); i2 < 15 + (store->GetScreenIndx() * 5) && i2 < (int)entries.size(); i2++, i++) { for (int i = 0, i2 = 0 + (store->GetScreenIndx() * 5); i2 < 15 + (store->GetScreenIndx() * 5) && i2 < (int)entries.size(); i2++, i++) {
/* Boxes. */ /* Boxes. */
+8
View File
@@ -41,6 +41,14 @@ static const std::vector<Structs::ButtonPos> StoreBoxesList = {
*/ */
void StoreUtils::DrawList(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries) { void StoreUtils::DrawList(const std::unique_ptr<Store> &store, const std::vector<std::unique_ptr<StoreEntry>> &entries) {
if (store) { // Ensure, store is not a nullptr. if (store) { // Ensure, store is not a nullptr.
if (config->usebg() && store->customBG()) {
C2D_DrawImageAt(store->GetStoreImg(), 0, 26, 0.5f, nullptr);
} else {
Gui::Draw_Rect(0, 26, 400, 214, BG_COLOR);
}
if (entries.size() > 0) { if (entries.size() > 0) {
for (int i = 0; i < 3 && i < (int)entries.size(); i++) { for (int i = 0; i < 3 && i < (int)entries.size(); i++) {
+27 -17
View File
@@ -30,21 +30,21 @@
extern bool touching(touchPosition touch, Structs::ButtonPos button); extern bool touching(touchPosition touch, Structs::ButtonPos button);
static const std::vector<Structs::ButtonPos> SearchMenu = { static const std::vector<Structs::ButtonPos> SearchMenu = {
{ 55, 5, 258, 30 }, // Search bar. { 55, 45, 258, 30 }, // Search bar.
/* Includes. */ /* Includes. */
{ 85, 84, 10, 10 }, { 85, 109, 50, 10 },
{ 85, 100, 10, 10 }, { 85, 125, 50, 10 },
{ 167, 84, 10, 10 }, { 167, 109, 50, 10 },
{ 167, 100, 10, 10 }, { 167, 125, 50, 10 },
/* Filters. */ /* Filters. */
{ 82, 170, 30, 30 }, { 82, 195, 30, 30 },
{ 117, 170, 30, 30 }, { 117, 195, 30, 30 },
{ 152, 170, 30, 30 }, { 152, 195, 30, 30 },
{ 187, 170, 30, 30 }, { 187, 195, 30, 30 },
{ 222, 170, 30, 30 }, { 222, 195, 30, 30 },
{ 257, 170, 30, 30 } { 257, 195, 30, 30 }
}; };
/* /*
@@ -56,17 +56,21 @@ static const std::vector<Structs::ButtonPos> SearchMenu = {
const bool &updateFilter: Const Reference to the update filter. const bool &updateFilter: Const Reference to the update filter.
*/ */
void StoreUtils::DrawSearchMenu(const std::vector<bool> &searchIncludes, const std::string &searchResult, const int &marks, const bool &updateFilter) { void StoreUtils::DrawSearchMenu(const std::vector<bool> &searchIncludes, const std::string &searchResult, const int &marks, const bool &updateFilter) {
Gui::Draw_Rect(54, 4, 260, SearchMenu[0].h + 2, SEARCH_BAR_OUTL_COLOR); Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR);
Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR);
Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("SEARCH_FILTERS"), 265);
Gui::Draw_Rect(54, 44, 260, SearchMenu[0].h + 2, SEARCH_BAR_OUTL_COLOR);
Gui::Draw_Rect(SearchMenu[0].x, SearchMenu[0].y, SearchMenu[0].w, SearchMenu[0].h, SEARCH_BAR_COLOR); Gui::Draw_Rect(SearchMenu[0].x, SearchMenu[0].y, SearchMenu[0].w, SearchMenu[0].h, SEARCH_BAR_COLOR);
Gui::DrawStringCentered(28, 10, 0.6, TEXT_COLOR, searchResult, 265); Gui::DrawStringCentered(28, 50, 0.6, TEXT_COLOR, searchResult, 265);
/* Checkboxes. */ /* Checkboxes. */
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
GFX::DrawCheckbox(SearchMenu[i + 1].x, SearchMenu[i + 1].y, searchIncludes[i]); GFX::DrawCheckbox(SearchMenu[i + 1].x, SearchMenu[i + 1].y, searchIncludes[i]);
} }
Gui::DrawString(84, 60, 0.5, TEXT_COLOR, Lang::get("INCLUDE_IN_RESULTS"), 265); Gui::DrawString(84, 85, 0.5, TEXT_COLOR, Lang::get("INCLUDE_IN_RESULTS"), 265);
Gui::DrawString(SearchMenu[1].x + 18, SearchMenu[1].y + 1, 0.4, TEXT_COLOR, Lang::get("TITLE"), 90); Gui::DrawString(SearchMenu[1].x + 18, SearchMenu[1].y + 1, 0.4, TEXT_COLOR, Lang::get("TITLE"), 90);
Gui::DrawString(SearchMenu[2].x + 18, SearchMenu[2].y + 1, 0.4, TEXT_COLOR, Lang::get("AUTHOR"), 90); Gui::DrawString(SearchMenu[2].x + 18, SearchMenu[2].y + 1, 0.4, TEXT_COLOR, Lang::get("AUTHOR"), 90);
@@ -75,7 +79,7 @@ void StoreUtils::DrawSearchMenu(const std::vector<bool> &searchIncludes, const s
Gui::DrawString(SearchMenu[4].x + 18, SearchMenu[4].y + 1, 0.4, TEXT_COLOR, Lang::get("CONSOLE"), 90); Gui::DrawString(SearchMenu[4].x + 18, SearchMenu[4].y + 1, 0.4, TEXT_COLOR, Lang::get("CONSOLE"), 90);
/* Filters. */ /* Filters. */
Gui::DrawString(84, 150, 0.5f, TEXT_COLOR, Lang::get("FILTER_TO"), 265); Gui::DrawString(84, 175, 0.5f, TEXT_COLOR, Lang::get("FILTER_TO"), 265);
Gui::Draw_Rect(SearchMenu[5].x, SearchMenu[5].y, SearchMenu[5].w, SearchMenu[5].h, (marks & favoriteMarks::STAR ? Gui::Draw_Rect(SearchMenu[5].x, SearchMenu[5].y, SearchMenu[5].w, SearchMenu[5].h, (marks & favoriteMarks::STAR ?
SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR)); SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR));
@@ -139,8 +143,14 @@ void StoreUtils::SearchHandle(u32 hDown, u32 hHeld, touchPosition touch, std::un
/* Search bar. */ /* Search bar. */
if (!didTouch) { if (!didTouch) {
if (touching(touch, SearchMenu[0])) { if (touching(touch, SearchMenu[0])) {
searchResult = Input::setkbdString(20, Lang::get("ENTER_SEARCH")); if (store) {
didTouch = true; searchResult = Input::setkbdString(20, Lang::get("ENTER_SEARCH"), {});
didTouch = true;
} else {
searchResult = Input::setkbdString(20, Lang::get("ENTER_SEARCH"), {});
didTouch = true;
}
} }
} }
+122 -32
View File
@@ -30,13 +30,13 @@
extern bool exiting; extern bool exiting;
extern bool touching(touchPosition touch, Structs::ButtonPos button); extern bool touching(touchPosition touch, Structs::ButtonPos button);
static const std::vector<Structs::ButtonPos> mainButtons = { static const std::vector<Structs::ButtonPos> mainButtons = {
{ 54, 4, 262, 22 }, { 54, 32, 262, 22 },
{ 54, 34, 262, 22 }, { 54, 62, 262, 22 },
{ 54, 64, 262, 22 }, { 54, 92, 262, 22 },
{ 54, 94, 262, 22 }, { 54, 122, 262, 22 },
{ 54, 124, 262, 22 }, { 54, 152, 262, 22 },
{ 54, 154, 262, 22 }, { 54, 182, 262, 22 },
{ 54, 184, 262, 22 } { 54, 212, 262, 22 }
}; };
static const std::vector<Structs::ButtonPos> toggleAbles = { static const std::vector<Structs::ButtonPos> toggleAbles = {
@@ -45,8 +45,10 @@ static const std::vector<Structs::ButtonPos> toggleAbles = {
{ 288, 140, 24, 24 } { 288, 140, 24, 24 }
}; };
static const Structs::ButtonPos back = { 52, 0, 24, 24 }; // Back arrow for directory.
static const std::vector<std::string> mainStrings = { "LANGUAGE", "SELECT_UNISTORE", "AUTO_UPDATE_SETTINGS_BTN", "CHANGE_DIRECTORIES", "CREDITS", "EXIT_APP" };
static const std::vector<std::string> mainStrings = { "LANGUAGE", "SELECT_UNISTORE", "AUTO_UPDATE_SETTINGS_BTN", "GUI_SETTINGS_BTN", "DIRECTORY_SETTINGS_BTN", "CREDITS", "EXIT_APP" };
static const std::vector<std::string> dirStrings = { "CHANGE_3DSX_PATH", "CHANGE_NDS_PATH", "CHANGE_ARCHIVE_PATH" }; static const std::vector<std::string> dirStrings = { "CHANGE_3DSX_PATH", "CHANGE_NDS_PATH", "CHANGE_ARCHIVE_PATH" };
/* /*
@@ -55,7 +57,11 @@ static const std::vector<std::string> dirStrings = { "CHANGE_3DSX_PATH", "CHANGE
const int &selection: Const Reference to the Settings Selection. const int &selection: Const Reference to the Settings Selection.
*/ */
static void DrawSettingsMain(const int &selection) { static void DrawSettingsMain(const int &selection) {
for (int i = 0; i < 6; i++) { Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR);
Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR);
Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("SETTINGS"), 265);
for (int i = 0; i < 7; i++) {
if (i == selection) GFX::DrawBox(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, false); if (i == selection) GFX::DrawBox(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, false);
Gui::DrawStringCentered(30, mainButtons[i].y + 4, 0.45f, TEXT_COLOR, Lang::get(mainStrings[i]), 255); Gui::DrawStringCentered(30, mainButtons[i].y + 4, 0.45f, TEXT_COLOR, Lang::get(mainStrings[i]), 255);
} }
@@ -67,6 +73,11 @@ static void DrawSettingsMain(const int &selection) {
const int &selection: Const Reference to the Settings Selection. const int &selection: Const Reference to the Settings Selection.
*/ */
static void DrawSettingsDir(const int &selection) { static void DrawSettingsDir(const int &selection) {
Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR);
Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR);
GFX::DrawSprite(sprites_arrow_idx, back.x, back.y);
Gui::DrawStringCentered(32, 2, 0.6, TEXT_COLOR, Lang::get("DIRECTORY_SETTINGS"), 240);
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
if (i == selection) GFX::DrawBox(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, false); if (i == selection) GFX::DrawBox(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, false);
Gui::DrawStringCentered(30, mainButtons[i].y + 4, 0.45f, TEXT_COLOR, Lang::get(dirStrings[i]), 255); Gui::DrawStringCentered(30, mainButtons[i].y + 4, 0.45f, TEXT_COLOR, Lang::get(dirStrings[i]), 255);
@@ -76,7 +87,7 @@ static void DrawSettingsDir(const int &selection) {
/* /*
Draw Auto-Update Settings page. Draw Auto-Update Settings page.
*/ */
static void DrawAutoUpdate() { static void DrawAutoUpdate(const int &selection) {
Gui::Draw_Rect(48, 0, 272, 36, ENTRY_BAR_COLOR); Gui::Draw_Rect(48, 0, 272, 36, ENTRY_BAR_COLOR);
Gui::Draw_Rect(48, 36, 272, 1, ENTRY_BAR_OUTL_COLOR); Gui::Draw_Rect(48, 36, 272, 1, ENTRY_BAR_OUTL_COLOR);
GFX::DrawSprite(sprites_arrow_idx, 52, 6); GFX::DrawSprite(sprites_arrow_idx, 52, 6);
@@ -84,17 +95,30 @@ static void DrawAutoUpdate() {
Gui::DrawStringCentered(32, 7, 0.6, TEXT_COLOR, Lang::get("AUTO_UPDATE_SETTINGS"), 240); Gui::DrawStringCentered(32, 7, 0.6, TEXT_COLOR, Lang::get("AUTO_UPDATE_SETTINGS"), 240);
/* Toggle Boxes. */ /* Toggle Boxes. */
GFX::DrawBox(48, 64, 273, 24, false); Gui::Draw_Rect(48, 64, 273, 24, (selection == 0 ? SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR));
Gui::DrawString(55, 68, 0.5f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UNISTORE"), 210); Gui::DrawString(55, 68, 0.5f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UNISTORE"), 210);
GFX::DrawToggle(288, 64, config->autoupdate()); GFX::DrawToggle(288, 64, config->autoupdate());
Gui::DrawString(55, 95, 0.4f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UNISTORE_DESC"), 265, 0, nullptr, C2D_WordWrap); Gui::DrawString(55, 95, 0.4f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UNISTORE_DESC"), 265, 0, nullptr, C2D_WordWrap);
GFX::DrawBox(48, 140, 273, 24, false); Gui::Draw_Rect(48, 140, 273, 24, (selection == 1 ? SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR));
Gui::DrawString(55, 144, 0.5f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UU"), 210); Gui::DrawString(55, 144, 0.5f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UU"), 210);
GFX::DrawToggle(288, 140, config->updatecheck()); GFX::DrawToggle(288, 140, config->updatecheck());
Gui::DrawString(55, 171, 0.4f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UU_DESC"), 265, 0, nullptr, C2D_WordWrap); Gui::DrawString(55, 171, 0.4f, TEXT_COLOR, Lang::get("AUTO_UPDATE_UU_DESC"), 265, 0, nullptr, C2D_WordWrap);
} }
static void DrawGUISettings(const int &selection) {
Gui::Draw_Rect(48, 0, 272, 36, ENTRY_BAR_COLOR);
Gui::Draw_Rect(48, 36, 272, 1, ENTRY_BAR_OUTL_COLOR);
GFX::DrawSprite(sprites_arrow_idx, 52, 6);
Gui::DrawStringCentered(32, 7, 0.6, TEXT_COLOR, Lang::get("GUI_SETTINGS"), 240);
Gui::Draw_Rect(48, 64, 273, 24, (selection == 0 ? SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR));
Gui::DrawString(55, 68, 0.5f, TEXT_COLOR, Lang::get("UNISTORE_BG"), 210);
GFX::DrawToggle(288, 64, config->usebg());
Gui::DrawString(55, 95, 0.4f, TEXT_COLOR, Lang::get("UNISTORE_BG_DESC"), 265, 0, nullptr, C2D_WordWrap);
}
/* /*
Settings Main Handle. Settings Main Handle.
@@ -124,7 +148,7 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
} }
if (hRepeat & KEY_DOWN) { if (hRepeat & KEY_DOWN) {
if (selection < 5) selection++; if (selection < 6) selection++;
else selection = 0; else selection = 0;
} }
@@ -145,7 +169,7 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
if (hDown & KEY_TOUCH) { if (hDown & KEY_TOUCH) {
if (touching(touch, mainButtons[0])) { if (touching(touch, mainButtons[0])) {
Overlays::SelectLanguage(); Overlays::SelectLanguage(store);
} else if (touching(touch, mainButtons[1])) { } else if (touching(touch, mainButtons[1])) {
Overlays::SelectStore(store, entries, meta); Overlays::SelectStore(store, entries, meta);
@@ -155,13 +179,17 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
page = 2; page = 2;
} else if (touching(touch, mainButtons[3])) { } else if (touching(touch, mainButtons[3])) {
selection = 0;
page = 3;
} else if (touching(touch, mainButtons[4])) {
selection = 0; selection = 0;
page = 1; page = 1;
} else if (touching(touch, mainButtons[4])) { } else if (touching(touch, mainButtons[5])) {
Overlays::ShowCredits(); Overlays::ShowCredits();
} else if (touching(touch, mainButtons[5])) { } else if (touching(touch, mainButtons[6])) {
exiting = true; exiting = true;
} }
} }
@@ -169,7 +197,7 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
if (hDown & KEY_A) { if (hDown & KEY_A) {
switch(selection) { switch(selection) {
case 0: case 0:
Overlays::SelectLanguage(); Overlays::SelectLanguage(store);
break; break;
case 1: case 1:
@@ -183,14 +211,19 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
case 3: case 3:
selection = 0; selection = 0;
page = 1; page = 3;
break; break;
case 4: case 4:
Overlays::ShowCredits(); selection = 0;
page = 1;
break; break;
case 5: case 5:
Overlays::ShowCredits();
break;
case 6:
exiting = true; exiting = true;
break; break;
} }
@@ -210,10 +243,10 @@ static void SettingsHandleMain(u32 hDown, u32 hHeld, touchPosition touch, int &p
int &page: Reference to the page. int &page: Reference to the page.
int &selection: Reference to the Selection. int &selection: Reference to the Selection.
*/ */
static void SettingsHandleDir(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection) { static void SettingsHandleDir(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection, const std::unique_ptr<Store> &store) {
if (hDown & KEY_B) { if (hDown & KEY_B) {
page = 0; page = 0;
selection = 3; selection = 4;
} }
if (hRepeat & KEY_DOWN) { if (hRepeat & KEY_DOWN) {
@@ -237,16 +270,20 @@ static void SettingsHandleDir(u32 hDown, u32 hHeld, touchPosition touch, int &pa
} }
if (hDown & KEY_TOUCH) { if (hDown & KEY_TOUCH) {
if (touching(touch, mainButtons[0])) { if (touching(touch, back)) {
const std::string path = Overlays::SelectDir(config->_3dsxPath(), Lang::get("SELECT_DIR")); page = 0;
selection = 4;
} else if (touching(touch, mainButtons[0])) {
const std::string path = Overlays::SelectDir(config->_3dsxPath(), Lang::get("SELECT_DIR"), store);
if (path != "") config->_3dsxPath(path); if (path != "") config->_3dsxPath(path);
} else if (touching(touch, mainButtons[1])) { } else if (touching(touch, mainButtons[1])) {
const std::string path = Overlays::SelectDir(config->ndsPath(), Lang::get("SELECT_DIR")); const std::string path = Overlays::SelectDir(config->ndsPath(), Lang::get("SELECT_DIR"), store);
if (path != "") config->ndsPath(path); if (path != "") config->ndsPath(path);
} else if (touching(touch, mainButtons[2])) { } else if (touching(touch, mainButtons[2])) {
const std::string path = Overlays::SelectDir(config->archPath(), Lang::get("SELECT_DIR")); const std::string path = Overlays::SelectDir(config->archPath(), Lang::get("SELECT_DIR"), store);
if (path != "") config->archPath(path); if (path != "") config->archPath(path);
} }
} }
@@ -256,29 +293,37 @@ static void SettingsHandleDir(u32 hDown, u32 hHeld, touchPosition touch, int &pa
switch(selection) { switch(selection) {
case 0: case 0:
path = Overlays::SelectDir(config->_3dsxPath(), Lang::get("SELECT_DIR")); path = Overlays::SelectDir(config->_3dsxPath(), Lang::get("SELECT_DIR"), store);
if (path != "") config->_3dsxPath(path); if (path != "") config->_3dsxPath(path);
break; break;
case 1: case 1:
path = Overlays::SelectDir(config->ndsPath(), Lang::get("SELECT_DIR")); path = Overlays::SelectDir(config->ndsPath(), Lang::get("SELECT_DIR"), store);
if (path != "") config->ndsPath(path); if (path != "") config->ndsPath(path);
break; break;
case 2: case 2:
path = Overlays::SelectDir(config->archPath(), Lang::get("SELECT_DIR")); path = Overlays::SelectDir(config->archPath(), Lang::get("SELECT_DIR"), store);
if (path != "") config->archPath(path); if (path != "") config->archPath(path);
break; break;
} }
} }
} }
static void SettingsToggleLogic(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection) { static void AutoUpdateLogic(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection) {
if (hDown & KEY_B) { if (hDown & KEY_B) {
page = 0; page = 0;
selection = 2; selection = 2;
} }
if (hRepeat & KEY_DOWN) {
if (selection < 1) selection++;
}
if (hRepeat & KEY_UP) {
if (selection > 0) selection--;
}
if (hDown & KEY_TOUCH) { if (hDown & KEY_TOUCH) {
if (touching(touch, toggleAbles[0])) { if (touching(touch, toggleAbles[0])) {
page = 0; page = 0;
@@ -291,6 +336,43 @@ static void SettingsToggleLogic(u32 hDown, u32 hHeld, touchPosition touch, int &
config->updatecheck(!config->updatecheck()); config->updatecheck(!config->updatecheck());
} }
} }
if (hDown & KEY_A) {
switch(selection) {
case 0:
config->autoupdate(!config->autoupdate());
break;
case 1:
config->updatecheck(!config->updatecheck());
break;
}
}
}
static void GUISettingsLogic(u32 hDown, u32 hHeld, touchPosition touch, int &page, int &selection, const std::unique_ptr<Store> &store) {
if (hDown & KEY_B) {
page = 0;
selection = 3;
}
if (hDown & KEY_TOUCH) {
if (touching(touch, toggleAbles[0])) {
page = 0;
selection = 3;
} else if (touching(touch, toggleAbles[1])) {
config->usebg(!config->usebg());
}
}
if (hDown & KEY_A) {
switch(selection) {
case 0:
config->usebg(!config->usebg());
break;
}
}
} }
/* /*
@@ -310,7 +392,11 @@ void StoreUtils::DrawSettings(const int &page, const int &selection) {
break; break;
case 2: case 2:
DrawAutoUpdate(); DrawAutoUpdate(selection);
break;
case 3:
DrawGUISettings(selection);
break; break;
} }
} }
@@ -336,11 +422,15 @@ void StoreUtils::SettingsHandle(u32 hDown, u32 hHeld, touchPosition touch, int &
break; break;
case 1: case 1:
SettingsHandleDir(hDown, hHeld, touch, page, selection); SettingsHandleDir(hDown, hHeld, touch, page, selection, store);
break; break;
case 2: case 2:
SettingsToggleLogic(hDown, hHeld, touch, page, selection); AutoUpdateLogic(hDown, hHeld, touch, page, selection);
break;
case 3:
GUISettingsLogic(hDown, hHeld, touch, page, selection, store);
break; break;
} }
} }
+11 -7
View File
@@ -31,15 +31,15 @@
extern bool touching(touchPosition touch, Structs::ButtonPos button); extern bool touching(touchPosition touch, Structs::ButtonPos button);
static const std::vector<Structs::ButtonPos> buttons = { static const std::vector<Structs::ButtonPos> buttons = {
{ 75, 50, 100, 16 }, { 75, 60, 100, 16 },
{ 75, 70, 100, 16 }, { 75, 80, 100, 16 },
{ 75, 90, 100, 16 }, { 75, 100, 100, 16 },
{ 205, 50, 100, 16 }, { 205, 60, 100, 16 },
{ 205, 70, 100, 16 }, { 205, 80, 100, 16 },
{ 75, 160, 100, 16 }, { 75, 170, 100, 16 },
{ 75, 180, 100, 16 } { 75, 190, 100, 16 }
}; };
static void DrawCheck(int pos, bool v) { static void DrawCheck(int pos, bool v) {
@@ -73,6 +73,10 @@ static const uint8_t GetType(const SortType &st) {
const SortType &st: Const Reference to the SortType variable. const SortType &st: Const Reference to the SortType variable.
*/ */
void StoreUtils::DrawSorting(const bool &asc, const SortType &st) { void StoreUtils::DrawSorting(const bool &asc, const SortType &st) {
Gui::Draw_Rect(48, 0, 272, 25, ENTRY_BAR_COLOR);
Gui::Draw_Rect(48, 25, 272, 1, ENTRY_BAR_OUTL_COLOR);
Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("SORTING"), 265);
/* Sort By. */ /* Sort By. */
Gui::DrawString(buttons[0].x + 5, buttons[0].y - 20, 0.6f, TEXT_COLOR, Lang::get("SORT_BY"), 90); Gui::DrawString(buttons[0].x + 5, buttons[0].y - 20, 0.6f, TEXT_COLOR, Lang::get("SORT_BY"), 90);
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
+35 -1
View File
@@ -40,7 +40,10 @@ static bool firstStart = true;
const std::string &file: The UniStore file. const std::string &file: The UniStore file.
*/ */
Store::Store(const std::string &file) { this->update(file); }; Store::Store(const std::string &file) {
this->update(file);
this->SetC2DBGImage();
};
/* /*
Update an UniStore,, including SpriteSheet, if revision increased. Update an UniStore,, including SpriteSheet, if revision increased.
@@ -409,6 +412,37 @@ C2D_Image Store::GetIconEntry(const int &index) const {
return C2D_SpriteSheetGetImage(sprites, sprites_noIcon_idx); return C2D_SpriteSheetGetImage(sprites, sprites_noIcon_idx);
} }
/*
Set's the custom BG to the storeBG variable.
*/
void Store::SetC2DBGImage() {
if (!this->valid) return;
if (this->sheets.empty()) return;
int index = -1, sheetIndex = -1;
if (this->storeJson["storeInfo"].contains("bg_index") && this->storeJson["storeInfo"]["bg_index"].is_number()) {
index = this->storeJson["storeInfo"]["bg_index"];
}
if (this->storeJson["storeInfo"].contains("bg_sheet") && this->storeJson["storeInfo"]["bg_sheet"].is_number()) {
sheetIndex = this->storeJson["storeInfo"]["bg_sheet"];
}
if (index == -1 || sheetIndex == -1) return;
if (sheetIndex > (int)this->sheets.size()) return;
if (!this->sheets[sheetIndex]) return;
if (index > (int)C2D_SpriteSheetCount(this->sheets[sheetIndex])-1) return;
C2D_Image temp = C2D_SpriteSheetGetImage(this->sheets[sheetIndex], index);
if (temp.subtex->width == 400 && temp.subtex->height == 214) {
this->hasCustomBG = true;
this->storeBG = temp; // Must be 400x214.
}
}
/* /*
Return the download list of an entry. Return the download list of an entry.
+2
View File
@@ -122,6 +122,7 @@ Config::Config() {
if (this->json.contains("Archive_Path")) this->archPath(this->getString("Archive_Path")); if (this->json.contains("Archive_Path")) this->archPath(this->getString("Archive_Path"));
if (this->json.contains("MetaData")) this->metadata(this->getBool("MetaData")); if (this->json.contains("MetaData")) this->metadata(this->getBool("MetaData"));
if (this->json.contains("UpdateCheck")) this->updatecheck(this->getBool("UpdateCheck")); if (this->json.contains("UpdateCheck")) this->updatecheck(this->getBool("UpdateCheck"));
if (this->json.contains("UseBG")) this->usebg(this->getBool("UseBG"));
this->changesMade = false; // No changes made yet. this->changesMade = false; // No changes made yet.
} }
@@ -142,6 +143,7 @@ void Config::save() {
this->setString("Archive_Path", this->archPath()); this->setString("Archive_Path", this->archPath());
this->setBool("MetaData", this->metadata()); this->setBool("MetaData", this->metadata());
this->setBool("UpdateCheck", this->updatecheck()); this->setBool("UpdateCheck", this->updatecheck());
this->setBool("UseBG", this->usebg());
/* Write changes to file. */ /* Write changes to file. */
const std::string dump = this->json.dump(1, '\t'); const std::string dump = this->json.dump(1, '\t');