diff --git a/assets/gfx/sprites.t3s b/assets/gfx/sprites.t3s index 145e747..0c691ac 100644 --- a/assets/gfx/sprites.t3s +++ b/assets/gfx/sprites.t3s @@ -1,6 +1,7 @@ --atlas -f rgba -z auto sprites/add.png +sprites/add_font.png sprites/arrow.png sprites/checked.png sprites/delete.png diff --git a/assets/gfx/sprites/add_font.png b/assets/gfx/sprites/add_font.png new file mode 100644 index 0000000..a056b84 Binary files /dev/null and b/assets/gfx/sprites/add_font.png differ diff --git a/include/common.hpp b/include/common.hpp index 94361c9..8a4f01c 100644 --- a/include/common.hpp +++ b/include/common.hpp @@ -34,12 +34,13 @@ #include "msg.hpp" #include "screenCommon.hpp" -inline std::unique_ptr config; - #define _STORE_PATH "sdmc:/3ds/Universal-Updater/stores/" #define _META_PATH "sdmc:/3ds/Universal-Updater/MetaData.json" #define _UNISTORE_VERSION 3 + +inline std::unique_ptr config; inline uint32_t hRepeat, hDown, hHeld; inline touchPosition touch; +inline C2D_Font font; #endif \ No newline at end of file diff --git a/include/init.hpp b/include/init.hpp index 7860e65..9cd8c64 100644 --- a/include/init.hpp +++ b/include/init.hpp @@ -33,6 +33,9 @@ namespace Init { Result Initialize(); Result MainLoop(); Result Exit(); + + void LoadFont(); + void UnloadFont(); }; #endif \ No newline at end of file diff --git a/include/utils/config.hpp b/include/utils/config.hpp index 3d10aa1..51d9ff8 100644 --- a/include/utils/config.hpp +++ b/include/utils/config.hpp @@ -75,6 +75,10 @@ public: /* 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; }; + + /* If using custom Font. */ + bool customfont() const { return this->v_customFont; }; + void customfont(bool v) { this->v_customFont = v; if (!this->changesMade) this->changesMade = true; }; private: /* Mainly helper. */ bool getBool(const std::string &key); @@ -89,7 +93,7 @@ private: std::string v_language = "en", v_lastStore = "universal-db.unistore", v_3dsxPath = "sdmc:/3ds", v_ndsPath = "sdmc:", v_archivePath = "sdmc:"; - bool v_list = false, v_autoUpdate = true, v_metadata = true, v_updateCheck = true, v_showBg = false; + bool v_list = false, v_autoUpdate = true, v_metadata = true, v_updateCheck = true, v_showBg = false, v_customFont = false; }; #endif diff --git a/include/utils/scriptUtils.hpp b/include/utils/scriptUtils.hpp index de792a8..5f566d2 100644 --- a/include/utils/scriptUtils.hpp +++ b/include/utils/scriptUtils.hpp @@ -51,7 +51,7 @@ namespace ScriptUtils { Result renameFile(const std::string &oldName, const std::string &newName, const std::string &message); Result downloadRelease(const std::string &repo, const std::string &file, const std::string &output, bool includePrereleases, const std::string &message); Result downloadFile(const std::string &file, const std::string &output, const std::string &message); - void installFile(const std::string &file, bool pdatingSelf, const std::string &message); + void installFile(const std::string &file, bool updatingSelf, const std::string &message); void extractFile(const std::string &file, const std::string &input, const std::string &output, const std::string &message); Result runFunctions(nlohmann::json storeJson, int selection, const std::string &entry); diff --git a/romfs/lang/en/app.json b/romfs/lang/en/app.json index c9eb87e..d212528 100644 --- a/romfs/lang/en/app.json +++ b/romfs/lang/en/app.json @@ -23,6 +23,8 @@ "CREDITS": "Credits", "CURRENT_VERSION": "Current version: ", "CURRENTLY_EXTRACTING": "Currently extracting:\n", + "CUSTOM_FONT": "Use Custom Font", + "CUSTOM_FONT_DESC": "If enabled, 'sdmc:/3ds/Universal-Updater/font.bcfnt' will be used instead of the system font, if found.", "DELETE_ERROR": "Delete Error!", "DELETE_PROMPT": "Are you sure you want to delete this Directory?", "DELETE_UNNEEDED_FILE": "Deleting unneeded file...", @@ -35,6 +37,7 @@ "DONE": "Done!", "DOWNLOAD_ERROR": "Download Error!", "DOWNLOAD_FAILED": "Download Failed!", + "DOWNLOADING_COMPATIBLE_FONT": "Downloading compatible font...", "DOWNLOADING_SPRITE_SHEET": "Downloading Spritesheet...", "DOWNLOADING_SPRITE_SHEET2": "Downloading Spritesheet %i of %i...", "DOWNLOADING_UNIVERSAL_DB": "Downloading Universal-DB...", diff --git a/source/gui/msg.cpp b/source/gui/msg.cpp index f5db9f4..d3fcc4a 100644 --- a/source/gui/msg.cpp +++ b/source/gui/msg.cpp @@ -39,7 +39,7 @@ void Msg::DisplayMsg(const std::string &Text) { C2D_TargetClear(Bottom, TRANSPARENT); GFX::DrawTop(); - Gui::DrawStringCentered(0, (240 - Gui::GetStringHeight(0.6f, Text)) / 2, 0.6f, TEXT_COLOR, Text, 395); + Gui::DrawStringCentered(0, (240 - Gui::GetStringHeight(0.6f, Text)) / 2, 0.6f, TEXT_COLOR, Text, 395, 0, font); GFX::DrawBottom(); C3D_FrameEnd(0); } @@ -56,7 +56,7 @@ void Msg::DisplayWarnMsg(const std::string &Text) { C2D_TargetClear(Bottom, TRANSPARENT); GFX::DrawTop(); - Gui::DrawStringCentered(0, 1, 0.6f, TEXT_COLOR, Text, 390); + Gui::DrawStringCentered(0, 1, 0.6f, TEXT_COLOR, Text, 390, 0, font); GFX::DrawBottom(); C3D_FrameEnd(0); @@ -79,9 +79,9 @@ bool Msg::promptMsg(const std::string &promptMsg) { GFX::DrawTop(); Gui::Draw_Rect(0, 215, 400, 25, BAR_COLOR); Gui::Draw_Rect(0, 214, 400, 1, BAR_OUTL_COLOR); - Gui::DrawStringCentered(0, (240 - Gui::GetStringHeight(0.6f, promptMsg)) / 2, 0.6f, TEXT_COLOR, promptMsg, 395); + Gui::DrawStringCentered(0, (240 - Gui::GetStringHeight(0.6f, promptMsg)) / 2, 0.6f, TEXT_COLOR, promptMsg, 395, 0, font); - Gui::DrawStringCentered(0, 218, 0.6f, TEXT_COLOR, Lang::get("CONFIRM_OR_CANCEL"), 390); + Gui::DrawStringCentered(0, 218, 0.6f, TEXT_COLOR, Lang::get("CONFIRM_OR_CANCEL"), 390, 0, font); C3D_FrameEnd(0); for (int i = 0; i < 3; i++) gspWaitForVBlank(); @@ -108,10 +108,10 @@ void Msg::waitMsg(const std::string &msg) { C2D_TargetClear(Bottom, TRANSPARENT); GFX::DrawTop(); - Gui::DrawStringCentered(0, (240 - Gui::GetStringHeight(0.6f, msg)) / 2, 0.6f, TEXT_COLOR, msg, 395); + Gui::DrawStringCentered(0, (240 - Gui::GetStringHeight(0.6f, msg)) / 2, 0.6f, TEXT_COLOR, msg, 395, 0, font); Gui::Draw_Rect(0, 215, 400, 25, BAR_COLOR); Gui::Draw_Rect(0, 214, 400, 1, BAR_OUTL_COLOR); - Gui::DrawStringCentered(0, 218, 0.6f, TEXT_COLOR, Lang::get("KEY_CONTINUE"), 390); + Gui::DrawStringCentered(0, 218, 0.6f, TEXT_COLOR, Lang::get("KEY_CONTINUE"), 390, 0, font); GFX::DrawBottom(); C3D_FrameEnd(0); diff --git a/source/init.cpp b/source/init.cpp index 4883bc6..295ad6b 100644 --- a/source/init.cpp +++ b/source/init.cpp @@ -32,7 +32,7 @@ #include #include -bool exiting = false, is3DSX = false; +bool exiting = false, is3DSX = false, needUnloadFont = false; C2D_SpriteSheet sprites; int fadeAlpha = 0; u32 old_time_limit; @@ -57,6 +57,31 @@ bool touching(touchPosition touch, Structs::ButtonPos button) { return false; } +/* + Load the custom font and use it instead of SysFont, if found. +*/ +void Init::LoadFont() { + if (config->customfont()) { + if (!needUnloadFont) { + if (access("sdmc:/3ds/Universal-Updater/font.bcfnt", F_OK) == 0) { + Gui::loadFont(font, "sdmc:/3ds/Universal-Updater/font.bcfnt"); + needUnloadFont = true; + } + } + } +} + +/* + Unload the custom font and switch back to SysFont. +*/ +void Init::UnloadFont() { + if (needUnloadFont) { + Gui::unloadFont(font); + font = nullptr; + needUnloadFont = false; + } +} + /* Initialize Universal-Updater. */ @@ -83,7 +108,7 @@ Result Init::Initialize() { Lang::load(config->language()); Gui::loadSheet("romfs:/gfx/sprites.t3x", sprites); - + LoadFont(); osSetSpeedupEnable(true); // Enable speed-up for New 3DS users. @@ -129,9 +154,7 @@ Result Init::MainLoop() { if (fadeAlpha < 255) { fadeAlpha += 4; - if (fadeAlpha >= 255) { - fullExit = true; - } + if (fadeAlpha >= 255) fullExit = true; } } } @@ -147,7 +170,7 @@ Result Init::MainLoop() { Result Init::Exit() { Gui::exit(); Gui::unloadSheet(sprites); - + UnloadFont(); gfxExit(); cfguExit(); config->save(); diff --git a/source/overlays/credits.cpp b/source/overlays/credits.cpp index 691fda7..5265625 100644 --- a/source/overlays/credits.cpp +++ b/source/overlays/credits.cpp @@ -40,20 +40,20 @@ void Overlays::ShowCredits() { GFX::DrawTop(); GFX::DrawSprite(sprites_universal_updater_idx, 220, 30); - Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, "Universal-Updater - " + Lang::get("CREDITS")); + Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, "Universal-Updater - " + Lang::get("CREDITS"), 395, 0, font); - Gui::DrawString(10, 30, 0.5f, TEXT_COLOR, "- Universal-Team"); - Gui::DrawString(10, 50, 0.5f, TEXT_COLOR, "- devkitPro"); - Gui::DrawString(10, 70, 0.5f, TEXT_COLOR, "- dlbeer"); - Gui::DrawString(10, 90, 0.5f, TEXT_COLOR, "- FlagBrew"); - Gui::DrawString(10, 110, 0.5f, TEXT_COLOR, "- https://icons8.com/"); - Gui::DrawString(10, 130, 0.5f, TEXT_COLOR, "- PabloMK7"); - Gui::DrawString(10, 150, 0.5f, TEXT_COLOR, Lang::get("CONTRIBUTOR_TRANSLATORS"), 210); - Gui::DrawString(10, 197, 0.5f, TEXT_COLOR, Lang::get("GITHUB"), 390); + Gui::DrawString(10, 30, 0.5f, TEXT_COLOR, "- Universal-Team", 0, 0, font); + Gui::DrawString(10, 50, 0.5f, TEXT_COLOR, "- devkitPro", 0, 0, font); + Gui::DrawString(10, 70, 0.5f, TEXT_COLOR, "- dlbeer", 0, 0, font); + Gui::DrawString(10, 90, 0.5f, TEXT_COLOR, "- FlagBrew", 0, 0, font); + Gui::DrawString(10, 110, 0.5f, TEXT_COLOR, "- https://icons8.com/", 0, 0, font); + Gui::DrawString(10, 130, 0.5f, TEXT_COLOR, "- PabloMK7", 0, 0, font); + Gui::DrawString(10, 150, 0.5f, TEXT_COLOR, Lang::get("CONTRIBUTOR_TRANSLATORS"), 210, 0, font); + Gui::DrawString(10, 197, 0.5f, TEXT_COLOR, Lang::get("GITHUB"), 390, 0, font); Gui::Draw_Rect(0, 215, 400, 25, BAR_COLOR); Gui::Draw_Rect(0, 214, 400, 1, BAR_OUTL_COLOR); - Gui::DrawStringCentered(0, 218, 0.6f, TEXT_COLOR, Lang::get("CURRENT_VERSION") + std::string(V_STRING), 390); + Gui::DrawStringCentered(0, 218, 0.6f, TEXT_COLOR, Lang::get("CURRENT_VERSION") + std::string(V_STRING), 390, 0, font); GFX::DrawBottom(); GFX::DrawSprite(sprites_universal_core_idx, 0, 26); diff --git a/source/overlays/dirSelect.cpp b/source/overlays/dirSelect.cpp index fb27742..e5f55bb 100644 --- a/source/overlays/dirSelect.cpp +++ b/source/overlays/dirSelect.cpp @@ -82,22 +82,22 @@ std::string Overlays::SelectDir(const std::string &oldDir, const std::string &ms GFX::DrawTop(); } - Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, msg, 380); + Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, msg, 380, 0, font); Gui::Draw_Rect(0, 215, 400, 25, BAR_COLOR); Gui::Draw_Rect(0, 214, 400, 1, BAR_OUTL_COLOR); - Gui::DrawStringCentered(0, 217, 0.6f, TEXT_COLOR, currentPath, 390); + Gui::DrawStringCentered(0, 217, 0.6f, TEXT_COLOR, currentPath, 390, 0, font); GFX::DrawBottom(); Gui::Draw_Rect(0, 215, 320, 25, BAR_COLOR); Gui::Draw_Rect(0, 214, 320, 1, BAR_OUTL_COLOR); - Gui::DrawStringCentered(0, 220, 0.5f, TEXT_COLOR, Lang::get("START_SELECT"), 310); + Gui::DrawStringCentered(0, 220, 0.5f, TEXT_COLOR, Lang::get("START_SELECT"), 310, 0, font); if (dirContents.size() > 0) { for(int i = 0; i < 7 && i < (int)dirContents.size(); i++) { if (sPos + i == selection) GFX::DrawBox(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, false); - Gui::DrawStringCentered(10 - 160 + (300 / 2), mainButtons[i].y + 4, 0.45f, TEXT_COLOR, dirContents[sPos + i].name, 295); + Gui::DrawStringCentered(10 - 160 + (300 / 2), mainButtons[i].y + 4, 0.45f, TEXT_COLOR, dirContents[sPos + i].name, 295, 0, font); } } diff --git a/source/overlays/storeSelect.cpp b/source/overlays/storeSelect.cpp index 6c905f5..3df971a 100644 --- a/source/overlays/storeSelect.cpp +++ b/source/overlays/storeSelect.cpp @@ -241,38 +241,38 @@ void Overlays::SelectStore(std::unique_ptr &store, std::vector 0) { if (info[selection].StoreSize != -1) { - Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, info[selection].Title, 390); - Gui::DrawStringCentered(0, 30, 0.6f, TEXT_COLOR, info[selection].Author, 380); + Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, info[selection].Title, 390, 0, font); + Gui::DrawStringCentered(0, 30, 0.6f, TEXT_COLOR, info[selection].Author, 380, 0, font); if (info[selection].Description != "") { /* "\n\n" breaks C2D_WordWrap, so check here. */ if (!(info[selection].Description.find("\n\n") != std::string::npos)) { - Gui::DrawStringCentered(0, 70, 0.5f, TEXT_COLOR, info[selection].Description, 380, 130, nullptr, C2D_WordWrap); + Gui::DrawStringCentered(0, 70, 0.5f, TEXT_COLOR, info[selection].Description, 380, 130, font, C2D_WordWrap); } else { - Gui::DrawStringCentered(0, 70, 0.5f, TEXT_COLOR, info[selection].Description, 380, 130); + Gui::DrawStringCentered(0, 70, 0.5f, TEXT_COLOR, info[selection].Description, 380, 130, font); } } } else { - Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, Lang::get("INVALID_UNISTORE"), 390); + Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, Lang::get("INVALID_UNISTORE"), 390, 0, font); } - Gui::DrawString(10, 200, 0.4, TEXT_COLOR, "- " + Lang::get("ENTRIES") + ": " + std::to_string(info[selection].StoreSize), 150); - Gui::DrawString(10, 210, 0.4, TEXT_COLOR, "- " + Lang::get("VERSION") + ": " + std::to_string(info[selection].Version), 150); - Gui::DrawString(10, 220, 0.4, TEXT_COLOR, "- " + Lang::get("REVISION") + ": " + std::to_string(info[selection].Revision), 150); + Gui::DrawString(10, 200, 0.4, TEXT_COLOR, "- " + Lang::get("ENTRIES") + ": " + std::to_string(info[selection].StoreSize), 150, 0, font); + Gui::DrawString(10, 210, 0.4, TEXT_COLOR, "- " + Lang::get("VERSION") + ": " + std::to_string(info[selection].Version), 150, 0, font); + Gui::DrawString(10, 220, 0.4, TEXT_COLOR, "- " + Lang::get("REVISION") + ": " + std::to_string(info[selection].Revision), 150, 0, font); GFX::DrawBottom(); Gui::Draw_Rect(0, 0, 320, 25, ENTRY_BAR_COLOR); Gui::Draw_Rect(0, 25, 320, 1, ENTRY_BAR_OUTL_COLOR); GFX::DrawSprite(sprites_arrow_idx, mainButtons[10].x, mainButtons[10].y); - Gui::DrawStringCentered(0, 2, 0.6, TEXT_COLOR, Lang::get("SELECT_UNISTORE_2"), 310); + Gui::DrawStringCentered(0, 2, 0.6, TEXT_COLOR, Lang::get("SELECT_UNISTORE_2"), 310, 0, font); for(int i = 0; i < 6 && i < (int)info.size(); i++) { if (sPos + i == selection) GFX::DrawBox(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, false); - Gui::DrawStringCentered(10 - 160 + (300 / 2), mainButtons[i].y + 4, 0.45f, TEXT_COLOR, info[sPos + i].FileName, 295); + Gui::DrawStringCentered(10 - 160 + (300 / 2), mainButtons[i].y + 4, 0.45f, TEXT_COLOR, info[sPos + i].FileName, 295, 0, font); } } diff --git a/source/screens/mainScreen.cpp b/source/screens/mainScreen.cpp index c6978fb..355c79d 100644 --- a/source/screens/mainScreen.cpp +++ b/source/screens/mainScreen.cpp @@ -107,8 +107,8 @@ void MainScreen::Draw(void) const { 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); - else Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, Lang::get("INVALID_UNISTORE"), 370); + if (this->store && this->store->GetValid()) Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, this->store->GetUniStoreTitle(), 370, 0, font); + else Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, Lang::get("INVALID_UNISTORE"), 370, 0, font); config->list() ? StoreUtils::DrawList(this->store, this->entries) : StoreUtils::DrawGrid(this->store, this->entries); if (fadeAlpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(0, 0, 0, fadeAlpha)); diff --git a/source/store/downList.cpp b/source/store/downList.cpp index f908b67..081a14a 100644 --- a/source/store/downList.cpp +++ b/source/store/downList.cpp @@ -51,16 +51,16 @@ void StoreUtils::DrawDownList(const std::unique_ptr &store, const std::ve 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); + Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("AVAILABLE_DOWNLOADS"), 265, 0, font); if (entries.size() > 0) { 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); - Gui::DrawStringCentered(54 - 160 + (262 / 2), downloadBoxes[i].y + 4, 0.45f, TEXT_COLOR, entries[(i + store->GetDownloadSIndex())], 260); + Gui::DrawStringCentered(54 - 160 + (262 / 2), downloadBoxes[i].y + 4, 0.45f, TEXT_COLOR, entries[(i + store->GetDownloadSIndex())], 260, 0, font); } } else { // If no downloads available.. - Gui::DrawStringCentered(54 - 160 + (262 / 2), 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, 0, font); } } } diff --git a/source/store/entryInfo.cpp b/source/store/entryInfo.cpp index 78c16b6..5d9a04f 100644 --- a/source/store/entryInfo.cpp +++ b/source/store/entryInfo.cpp @@ -41,27 +41,27 @@ void StoreUtils::DrawEntryInfo(const std::unique_ptr &store, const std::u Gui::Draw_Rect(48, 0, 272, 36, ENTRY_BAR_COLOR); Gui::Draw_Rect(48, 36, 272, 1, ENTRY_BAR_OUTL_COLOR); - Gui::DrawStringCentered(25, 0, 0.6, TEXT_COLOR, entry->GetTitle(), 265); - Gui::DrawStringCentered(25, 20, 0.4, TEXT_COLOR, entry->GetAuthor(), 265); + Gui::DrawStringCentered(25, 0, 0.6, TEXT_COLOR, entry->GetTitle(), 265, 0, font); + Gui::DrawStringCentered(25, 20, 0.4, TEXT_COLOR, entry->GetAuthor(), 265, 0, font); if (entry->GetDescription() != "") { /* "\n\n" breaks C2D_WordWrap, so check here. */ if (!(entry->GetDescription().find("\n\n") != std::string::npos)) { - Gui::DrawStringCentered(25, 50, 0.4, TEXT_COLOR, entry->GetDescription(), 240, 0, nullptr, C2D_WordWrap); + Gui::DrawStringCentered(25, 50, 0.4, TEXT_COLOR, entry->GetDescription(), 240, 0, font, C2D_WordWrap); } else { - Gui::DrawStringCentered(25, 50, 0.4, TEXT_COLOR, entry->GetDescription(), 240, 0); + Gui::DrawStringCentered(25, 50, 0.4, TEXT_COLOR, entry->GetDescription(), 240, 0, font); } } - Gui::DrawString(61, 130, 0.45, TEXT_COLOR, Lang::get("VERSION") + ": " + entry->GetVersion(), 240); - Gui::DrawString(61, 145, 0.45, TEXT_COLOR, Lang::get("CATEGORY") + ": " + entry->GetCategory(), 240); - Gui::DrawString(61, 160, 0.45, TEXT_COLOR, Lang::get("CONSOLE") + ": " + entry->GetConsole(), 240); - Gui::DrawString(61, 175, 0.45, TEXT_COLOR, Lang::get("LAST_UPDATED") + ": " + entry->GetLastUpdated(), 240); - Gui::DrawString(61, 190, 0.45, TEXT_COLOR, Lang::get("LICENSE") + ": " + entry->GetLicense(), 240); + Gui::DrawString(61, 130, 0.45, TEXT_COLOR, Lang::get("VERSION") + ": " + entry->GetVersion(), 240, 0, font); + Gui::DrawString(61, 145, 0.45, TEXT_COLOR, Lang::get("CATEGORY") + ": " + entry->GetCategory(), 240, 0, font); + Gui::DrawString(61, 160, 0.45, TEXT_COLOR, Lang::get("CONSOLE") + ": " + entry->GetConsole(), 240, 0, font); + Gui::DrawString(61, 175, 0.45, TEXT_COLOR, Lang::get("LAST_UPDATED") + ": " + entry->GetLastUpdated(), 240, 0, font); + Gui::DrawString(61, 190, 0.45, TEXT_COLOR, Lang::get("LICENSE") + ": " + entry->GetLicense(), 240, 0, font); GFX::DrawBox(btn.x, btn.y, btn.w, btn.h, false); - Gui::DrawString(btn.x + 3, btn.y, 0.6f, TEXT_COLOR, "★"); + Gui::DrawString(btn.x + 3, btn.y, 0.6f, TEXT_COLOR, "★", 0, 0, font); } } diff --git a/source/store/list.cpp b/source/store/list.cpp index 0b31f02..7d27a1f 100644 --- a/source/store/list.cpp +++ b/source/store/list.cpp @@ -67,8 +67,8 @@ void StoreUtils::DrawList(const std::unique_ptr &store, const std::vector } if (entries[i + store->GetScreenIndx()]->GetUpdateAvl()) GFX::DrawSprite(sprites_update_app_idx, StoreBoxesList[i].x + 32, StoreBoxesList[i].y + 32); - Gui::DrawStringCentered(29, StoreBoxesList[i].y + 5, 0.6f, TEXT_COLOR, entries[i + store->GetScreenIndx()]->GetTitle(), 300); - Gui::DrawStringCentered(29, StoreBoxesList[i].y + 24, 0.6f, TEXT_COLOR, entries[i + store->GetScreenIndx()]->GetAuthor(), 300); + Gui::DrawStringCentered(29, StoreBoxesList[i].y + 5, 0.6f, TEXT_COLOR, entries[i + store->GetScreenIndx()]->GetTitle(), 300, 0, font); + Gui::DrawStringCentered(29, StoreBoxesList[i].y + 24, 0.6f, TEXT_COLOR, entries[i + store->GetScreenIndx()]->GetAuthor(), 300, 0, font); } } } diff --git a/source/store/markMenu.cpp b/source/store/markMenu.cpp index 05c7820..6b5f8f4 100644 --- a/source/store/markMenu.cpp +++ b/source/store/markMenu.cpp @@ -61,14 +61,14 @@ void StoreUtils::DisplayMarkBox(int marks) { Gui::Draw_Rect(markBox[4].x, markBox[4].y, markBox[4].w, markBox[4].h, (marks & favoriteMarks::SPADE ? SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR)); - Gui::DrawString(markBox[0].x + 15, markBox[0].y + 11, 0.9, TEXT_COLOR, "★"); - Gui::DrawString(markBox[1].x + 15, markBox[1].y + 11, 0.9, TEXT_COLOR, "♥"); - Gui::DrawString(markBox[2].x + 15, markBox[2].y + 11, 0.9, TEXT_COLOR, "♦"); - Gui::DrawString(markBox[3].x + 15, markBox[3].y + 11, 0.9, TEXT_COLOR, "♣"); - Gui::DrawString(markBox[4].x + 15, markBox[4].y + 11, 0.9, TEXT_COLOR, "♠"); + Gui::DrawString(markBox[0].x + 15, markBox[0].y + 11, 0.9, TEXT_COLOR, "★", 0, 0, font); + Gui::DrawString(markBox[1].x + 15, markBox[1].y + 11, 0.9, TEXT_COLOR, "♥", 0, 0, font); + Gui::DrawString(markBox[2].x + 15, markBox[2].y + 11, 0.9, TEXT_COLOR, "♦", 0, 0, font); + Gui::DrawString(markBox[3].x + 15, markBox[3].y + 11, 0.9, TEXT_COLOR, "♣", 0, 0, font); + Gui::DrawString(markBox[4].x + 15, markBox[4].y + 11, 0.9, TEXT_COLOR, "♠", 0, 0, font); GFX::DrawBox(markBox[5].x, markBox[5].y, markBox[5].w, markBox[5].h, false); - Gui::DrawString(markBox[5].x + 3, markBox[5].y, 0.6f, TEXT_COLOR, "★"); + Gui::DrawString(markBox[5].x + 3, markBox[5].y, 0.6f, TEXT_COLOR, "★", 0, 0, font); } /* diff --git a/source/store/searchMenu.cpp b/source/store/searchMenu.cpp index 554a673..5e2f056 100644 --- a/source/store/searchMenu.cpp +++ b/source/store/searchMenu.cpp @@ -58,28 +58,28 @@ static const std::vector SearchMenu = { void StoreUtils::DrawSearchMenu(const std::vector &searchIncludes, const std::string &searchResult, int marks, bool updateFilter) { 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::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("SEARCH_FILTERS"), 265, 0, font); 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::DrawStringCentered(28, 50, 0.6, TEXT_COLOR, searchResult, 265); + Gui::DrawStringCentered(28, 50, 0.6, TEXT_COLOR, searchResult, 265, 0, font); /* Checkboxes. */ for (int i = 0; i < 4; i++) { GFX::DrawCheckbox(SearchMenu[i + 1].x, SearchMenu[i + 1].y, searchIncludes[i]); } - Gui::DrawString(84, 85, 0.5, TEXT_COLOR, Lang::get("INCLUDE_IN_RESULTS"), 265); + Gui::DrawString(84, 85, 0.5, TEXT_COLOR, Lang::get("INCLUDE_IN_RESULTS"), 265, 0, font); - 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[1].x + 18, SearchMenu[1].y + 1, 0.4, TEXT_COLOR, Lang::get("TITLE"), 90, 0, font); + Gui::DrawString(SearchMenu[2].x + 18, SearchMenu[2].y + 1, 0.4, TEXT_COLOR, Lang::get("AUTHOR"), 90, 0, font); - Gui::DrawString(SearchMenu[3].x + 18, SearchMenu[3].y + 1, 0.4, TEXT_COLOR, Lang::get("CATEGORY"), 90); - Gui::DrawString(SearchMenu[4].x + 18, SearchMenu[4].y + 1, 0.4, TEXT_COLOR, Lang::get("CONSOLE"), 90); + Gui::DrawString(SearchMenu[3].x + 18, SearchMenu[3].y + 1, 0.4, TEXT_COLOR, Lang::get("CATEGORY"), 90, 0, font); + Gui::DrawString(SearchMenu[4].x + 18, SearchMenu[4].y + 1, 0.4, TEXT_COLOR, Lang::get("CONSOLE"), 90, 0, font); /* Filters. */ - Gui::DrawString(84, 175, 0.5f, TEXT_COLOR, Lang::get("FILTER_TO"), 265); + Gui::DrawString(84, 175, 0.5f, TEXT_COLOR, Lang::get("FILTER_TO"), 265, 0, font); Gui::Draw_Rect(SearchMenu[5].x, SearchMenu[5].y, SearchMenu[5].w, SearchMenu[5].h, (marks & favoriteMarks::STAR ? SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR)); @@ -99,11 +99,11 @@ void StoreUtils::DrawSearchMenu(const std::vector &searchIncludes, const s Gui::Draw_Rect(SearchMenu[10].x, SearchMenu[10].y, SearchMenu[10].w, SearchMenu[10].h, (updateFilter ? SIDEBAR_UNSELECTED_COLOR : BOX_INSIDE_COLOR)); - Gui::DrawString(SearchMenu[5].x + 9, SearchMenu[5].y + 7, 0.5f, TEXT_COLOR, "★"); - Gui::DrawString(SearchMenu[6].x + 9, SearchMenu[6].y + 7, 0.5f, TEXT_COLOR, "♥"); - Gui::DrawString(SearchMenu[7].x + 9, SearchMenu[7].y + 7, 0.5f, TEXT_COLOR, "♦"); - Gui::DrawString(SearchMenu[8].x + 9, SearchMenu[8].y + 7, 0.5f, TEXT_COLOR, "♣"); - Gui::DrawString(SearchMenu[9].x + 9, SearchMenu[9].y + 7, 0.5f, TEXT_COLOR, "♠"); + Gui::DrawString(SearchMenu[5].x + 9, SearchMenu[5].y + 7, 0.5f, TEXT_COLOR, "★", 0, 0, font); + Gui::DrawString(SearchMenu[6].x + 9, SearchMenu[6].y + 7, 0.5f, TEXT_COLOR, "♥", 0, 0, font); + Gui::DrawString(SearchMenu[7].x + 9, SearchMenu[7].y + 7, 0.5f, TEXT_COLOR, "♦", 0, 0, font); + Gui::DrawString(SearchMenu[8].x + 9, SearchMenu[8].y + 7, 0.5f, TEXT_COLOR, "♣", 0, 0, font); + Gui::DrawString(SearchMenu[9].x + 9, SearchMenu[9].y + 7, 0.5f, TEXT_COLOR, "♠", 0, 0, font); GFX::DrawSprite(sprites_update_filter_idx, SearchMenu[10].x + 8, SearchMenu[10].y + 8); } diff --git a/source/store/settings.cpp b/source/store/settings.cpp index bf0d8d7..ceb1563 100644 --- a/source/store/settings.cpp +++ b/source/store/settings.cpp @@ -24,8 +24,11 @@ * reasonable ways as different from the original version. */ +#include "init.hpp" #include "overlay.hpp" +#include "scriptUtils.hpp" #include "storeUtils.hpp" +#include extern bool exiting; extern bool touching(touchPosition touch, Structs::ButtonPos button); @@ -46,9 +49,8 @@ static const std::vector langButtons = { { 10, 124, 300, 22 }, { 10, 154, 300, 22 }, { 10, 184, 300, 22 }, - { 10, 214, 300, 22 }, - { 52, 6, 24, 24 } // Back arrow. + { 52, 220, 16, 16 } // Add Font. }; static const std::vector toggleAbles = { @@ -63,8 +65,8 @@ static const Structs::ButtonPos back = { 52, 0, 24, 24 }; // Back arrow for dire static const std::vector mainStrings = { "LANGUAGE", "SELECT_UNISTORE", "AUTO_UPDATE_SETTINGS_BTN", "GUI_SETTINGS_BTN", "DIRECTORY_SETTINGS_BTN", "CREDITS", "EXIT_APP" }; static const std::vector dirStrings = { "CHANGE_3DSX_PATH", "CHANGE_NDS_PATH", "CHANGE_ARCHIVE_PATH" }; -static const std::vector languages = { "Bruh", "Dansk", "Deutsch", "English", "Español", "Français", "Italiano", "Lietuvių", "Magyar", "Polski", "Português", "Português (Brasil)", "Русский", "日本語" }; -static const std::string langsTemp[] = { "br", "da", "de", "en", "es", "fr", "it", "lt", "hu", "pl", "pt", "pt-BR", "ru", "jp"}; +static const std::vector languages = { "Bruh", "Dansk", "Deutsch", "English", "Español", "Français", "Italiano", "Lietuvių", "Magyar", "Polski", "Português", "Português (Brasil)", "Русский", "Українська", "日本語" }; +static const std::string langsTemp[] = { "br", "da", "de", "en", "es", "fr", "it", "lt", "hu", "pl", "pt", "pt-BR", "ru", "uk", "jp"}; /* Main Settings. @@ -74,11 +76,11 @@ static const std::string langsTemp[] = { "br", "da", "de", "en", "es", "fr", "it static void DrawSettingsMain(int selection) { 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); + Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("SETTINGS"), 265, 0, font); 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); - 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, 0, font); } } @@ -92,11 +94,12 @@ static void DrawLanguageSettings(int selection, int sPos) { 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("SELECT_LANG"), 240); + GFX::DrawSprite(sprites_add_font_idx, langButtons[6].x, langButtons[6].y); + Gui::DrawStringCentered(32, 2, 0.6, TEXT_COLOR, Lang::get("SELECT_LANG"), 240, 0, font); - for(int i = 0; i < 7 && i < (int)languages.size(); i++) { + for(int i = 0; i < 6 && i < (int)languages.size(); i++) { if (sPos + 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, languages[sPos + i], 280); + Gui::DrawStringCentered(30, mainButtons[i].y + 4, 0.45f, TEXT_COLOR, languages[sPos + i], 280, 0, font); } } @@ -109,11 +112,11 @@ static void DrawSettingsDir(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); + Gui::DrawStringCentered(32, 2, 0.6, TEXT_COLOR, Lang::get("DIRECTORY_SETTINGS"), 240, 0, font); 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); - 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, 0, font); } } @@ -125,18 +128,18 @@ static void DrawAutoUpdate(int selection) { 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("AUTO_UPDATE_SETTINGS"), 240); + Gui::DrawStringCentered(32, 7, 0.6, TEXT_COLOR, Lang::get("AUTO_UPDATE_SETTINGS"), 240, 0, font); /* Toggle Boxes. */ 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, 0, font); 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, font, C2D_WordWrap); 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, 0, font); 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, font, C2D_WordWrap); } /* @@ -149,12 +152,17 @@ static void DrawGUISettings(int selection) { 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::DrawStringCentered(32, 7, 0.6, TEXT_COLOR, Lang::get("GUI_SETTINGS"), 240, 0, font); 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); + Gui::DrawString(55, 68, 0.5f, TEXT_COLOR, Lang::get("UNISTORE_BG"), 210, 0, font); GFX::DrawToggle(288, 64, config->usebg()); - Gui::DrawString(55, 95, 0.4f, TEXT_COLOR, Lang::get("UNISTORE_BG_DESC"), 265, 0, nullptr, C2D_WordWrap); + Gui::DrawString(55, 95, 0.4f, TEXT_COLOR, Lang::get("UNISTORE_BG_DESC"), 265, 0, font, C2D_WordWrap); + + 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("CUSTOM_FONT"), 210, 0, font); + GFX::DrawToggle(288, 140, config->customfont()); + Gui::DrawString(55, 171, 0.4f, TEXT_COLOR, Lang::get("CUSTOM_FONT_DESC"), 265, 0, font, C2D_WordWrap); } @@ -411,6 +419,14 @@ static void GUISettingsLogic(int &page, int &selection) { selection = 3; } + if (hRepeat & KEY_DOWN) { + if (selection < 1) selection++; + } + + if (hRepeat & KEY_UP) { + if (selection > 0) selection--; + } + if (hDown & KEY_TOUCH) { if (touching(touch, toggleAbles[0])) { page = 0; @@ -418,6 +434,11 @@ static void GUISettingsLogic(int &page, int &selection) { } else if (touching(touch, toggleAbles[1])) { config->usebg(!config->usebg()); + + } else if (touching(touch, toggleAbles[2])) { + config->customfont(!config->customfont()); + + (config->customfont() ? Init::LoadFont() : Init::UnloadFont()); } } @@ -426,6 +447,12 @@ static void GUISettingsLogic(int &page, int &selection) { case 0: config->usebg(!config->usebg()); break; + + case 1: + config->customfont(!config->customfont()); + + (config->customfont() ? Init::LoadFont() : Init::UnloadFont()); + break; } } } @@ -453,16 +480,16 @@ static void LanguageLogic(int &page, int &selection, int &sPos) { } if (hRepeat & KEY_RIGHT) { - if (selection + 7 < (int)languages.size()-1) selection += 7; - else selection = languages.size()-1; + if (selection + 6 < (int)languages.size() - 1) selection += 6; + else selection = languages.size() - 1; } if (hRepeat & KEY_LEFT) { - if (selection - 7 > 0) selection -= 7; + if (selection - 6 > 0) selection -= 6; else selection = 0; } - if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, langButtons[7]))) { + if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, back))) { selection = 0; sPos = 0; page = 0; @@ -470,6 +497,17 @@ static void LanguageLogic(int &page, int &selection, int &sPos) { if (hDown & KEY_A) { const std::string l = langsTemp[selection]; + + /* Check if is "uk". */ + if (l == "uk") { + if (access("sdmc:/3ds/Universal-Updater/font.bcfnt", F_OK) != 0) { + ScriptUtils::downloadFile("https://github.com/Universal-Team/extras/raw/master/files/universal-updater.bcfnt", "sdmc:/3ds/Universal-Updater/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT")); + } + + config->customfont(true); + Init::LoadFont(); + } + config->language(l); Lang::load(config->language()); selection = 0; @@ -478,10 +516,21 @@ static void LanguageLogic(int &page, int &selection, int &sPos) { } if (hDown & KEY_TOUCH) { - for (int i = 0; i < 7; i++) { + for (int i = 0; i < 6; i++) { if (touching(touch, mainButtons[i])) { if (i + sPos < (int)languages.size()) { const std::string l = langsTemp[i + sPos]; + + /* Check if is "uk". */ + if (l == "uk") { + if (access("sdmc:/3ds/Universal-Updater/font.bcfnt", F_OK) != 0) { + ScriptUtils::downloadFile("https://github.com/Universal-Team/extras/raw/master/files/universal-updater.bcfnt", "sdmc:/3ds/Universal-Updater/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT")); + } + + config->customfont(true); + Init::LoadFont(); + } + config->language(l); Lang::load(config->language()); selection = 0; @@ -492,8 +541,17 @@ static void LanguageLogic(int &page, int &selection, int &sPos) { } } + if (hDown & KEY_TOUCH) { + if (touching(touch, langButtons[6])) { + /* Download Font. */ + ScriptUtils::downloadFile("https://github.com/Universal-Team/extras/raw/master/files/universal-updater.bcfnt", "sdmc:/3ds/Universal-Updater/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT")); + config->customfont(true); + Init::LoadFont(); + } + } + if (selection < sPos) sPos = selection; - else if (selection > sPos + 7 - 1) sPos = selection - 7 + 1; + else if (selection > sPos + 6 - 1) sPos = selection - 6 + 1; } /* diff --git a/source/store/sortMenu.cpp b/source/store/sortMenu.cpp index 70ed358..9afd539 100644 --- a/source/store/sortMenu.cpp +++ b/source/store/sortMenu.cpp @@ -75,31 +75,31 @@ static const uint8_t GetType(SortType st) { void StoreUtils::DrawSorting(bool asc, 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); + Gui::DrawStringCentered(25, 2, 0.6, TEXT_COLOR, Lang::get("SORTING"), 265, 0, font); /* 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, 0, font); for (int i = 0; i < 3; i++) { DrawCheck(i, i == GetType(st)); } - Gui::DrawString(buttons[0].x + 25, buttons[0].y + 2, 0.4f, TEXT_COLOR, Lang::get("TITLE"), 80); - Gui::DrawString(buttons[1].x + 25, buttons[1].y + 2, 0.4f, TEXT_COLOR, Lang::get("AUTHOR"), 80); - Gui::DrawString(buttons[2].x + 25, buttons[2].y + 2, 0.4f, TEXT_COLOR, Lang::get("LAST_UPDATED"), 80); + Gui::DrawString(buttons[0].x + 25, buttons[0].y + 2, 0.4f, TEXT_COLOR, Lang::get("TITLE"), 80, 0, font); + Gui::DrawString(buttons[1].x + 25, buttons[1].y + 2, 0.4f, TEXT_COLOR, Lang::get("AUTHOR"), 80, 0, font); + Gui::DrawString(buttons[2].x + 25, buttons[2].y + 2, 0.4f, TEXT_COLOR, Lang::get("LAST_UPDATED"), 80, 0, font); /* Direction. */ - Gui::DrawString(buttons[3].x + 5, buttons[3].y - 20, 0.6f, TEXT_COLOR, Lang::get("DIRECTION"), 80); + Gui::DrawString(buttons[3].x + 5, buttons[3].y - 20, 0.6f, TEXT_COLOR, Lang::get("DIRECTION"), 80, 0, font); DrawCheck(3, asc); DrawCheck(4, !asc); - Gui::DrawString(buttons[3].x + 25, buttons[3].y + 2, 0.4f, TEXT_COLOR, Lang::get("ASCENDING"), 80); - Gui::DrawString(buttons[4].x + 25, buttons[4].y + 2, 0.4f, TEXT_COLOR, Lang::get("DESCENDING"), 80); + Gui::DrawString(buttons[3].x + 25, buttons[3].y + 2, 0.4f, TEXT_COLOR, Lang::get("ASCENDING"), 80, 0, font); + Gui::DrawString(buttons[4].x + 25, buttons[4].y + 2, 0.4f, TEXT_COLOR, Lang::get("DESCENDING"), 80, 0, font); /* Top Style. */ - Gui::DrawString(buttons[5].x + 5, buttons[5].y - 20, 0.6f, TEXT_COLOR, Lang::get("TOP_STYLE"), 90); + Gui::DrawString(buttons[5].x + 5, buttons[5].y - 20, 0.6f, TEXT_COLOR, Lang::get("TOP_STYLE"), 90, 0, font); DrawCheck(5, config->list()); DrawCheck(6, !config->list()); - Gui::DrawString(buttons[5].x + 25, buttons[5].y + 2, 0.4f, TEXT_COLOR, Lang::get("LIST"), 90); - Gui::DrawString(buttons[6].x + 25, buttons[6].y + 2, 0.4f, TEXT_COLOR, Lang::get("GRID"), 90); + Gui::DrawString(buttons[5].x + 25, buttons[5].y + 2, 0.4f, TEXT_COLOR, Lang::get("LIST"), 90, 0, font); + Gui::DrawString(buttons[6].x + 25, buttons[6].y + 2, 0.4f, TEXT_COLOR, Lang::get("GRID"), 90, 0, font); } /* diff --git a/source/utils/animation.cpp b/source/utils/animation.cpp index 1504a4d..c02e0ac 100644 --- a/source/utils/animation.cpp +++ b/source/utils/animation.cpp @@ -98,28 +98,28 @@ void Animation::displayProgressBar() { C2D_TargetClear(Top, TRANSPARENT); C2D_TargetClear(Bottom, TRANSPARENT); GFX::DrawTop(); - Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, progressBarMsg, 390); + Gui::DrawStringCentered(0, 1, 0.7f, TEXT_COLOR, progressBarMsg, 390, 0, font); switch(progressbarType) { case ProgressBar::Downloading: - Gui::DrawStringCentered(0, 80, 0.6f, TEXT_COLOR, str, 390); + Gui::DrawStringCentered(0, 80, 0.6f, TEXT_COLOR, str, 390, 0, font); Animation::DrawProgressBar(downloadNow, downloadTotal); break; case ProgressBar::Extracting: - Gui::DrawStringCentered(0, 180, 0.6f, TEXT_COLOR, str, 390); - Gui::DrawStringCentered(0, 100, 0.6f, TEXT_COLOR, std::to_string(filesExtracted) + " / " + std::to_string(extractFilesCount) + " " + (filesExtracted == 1 ? (Lang::get("FILE_EXTRACTED")).c_str() :(Lang::get("FILES_EXTRACTED"))), 390); - Gui::DrawStringCentered(0, 40, 0.6f, TEXT_COLOR, Lang::get("CURRENTLY_EXTRACTING") + "\n" + extractingFile, 390); + Gui::DrawStringCentered(0, 180, 0.6f, TEXT_COLOR, str, 390, 0, font); + Gui::DrawStringCentered(0, 100, 0.6f, TEXT_COLOR, std::to_string(filesExtracted) + " / " + std::to_string(extractFilesCount) + " " + (filesExtracted == 1 ? (Lang::get("FILE_EXTRACTED")).c_str() :(Lang::get("FILES_EXTRACTED"))), 390, 0, font); + Gui::DrawStringCentered(0, 40, 0.6f, TEXT_COLOR, Lang::get("CURRENTLY_EXTRACTING") + "\n" + extractingFile, 390, 0, font); Animation::DrawProgressBar(writeOffset, extractSize); break; case ProgressBar::Installing: - Gui::DrawStringCentered(0, 80, 0.6f, TEXT_COLOR, str, 390); + Gui::DrawStringCentered(0, 80, 0.6f, TEXT_COLOR, str, 390, 0, font); Animation::DrawProgressBar(installOffset, installSize); break; case ProgressBar::Copying: - Gui::DrawStringCentered(0, 80, 0.6f, TEXT_COLOR, str, 390); + Gui::DrawStringCentered(0, 80, 0.6f, TEXT_COLOR, str, 390, 0, font); Animation::DrawProgressBar(copyOffset, copySize); break; } diff --git a/source/utils/config.cpp b/source/utils/config.cpp index e41dcf9..6e3a7e1 100644 --- a/source/utils/config.cpp +++ b/source/utils/config.cpp @@ -34,7 +34,7 @@ Detects system language and is used later to set app language to system language. */ void Config::sysLang() { - u8 language = 0; + u8 language = 1; CFGU_GetSystemLanguage(&language); switch(language) { @@ -123,6 +123,7 @@ Config::Config() { if (this->json.contains("MetaData")) this->metadata(this->getBool("MetaData")); if (this->json.contains("UpdateCheck")) this->updatecheck(this->getBool("UpdateCheck")); if (this->json.contains("UseBG")) this->usebg(this->getBool("UseBG")); + if (this->json.contains("CustomFont")) this->customfont(this->getBool("CustomFont")); this->changesMade = false; // No changes made yet. } @@ -144,6 +145,7 @@ void Config::save() { this->setBool("MetaData", this->metadata()); this->setBool("UpdateCheck", this->updatecheck()); this->setBool("UseBG", this->usebg()); + this->setBool("CustomFont", this->customfont()); /* Write changes to file. */ const std::string dump = this->json.dump(1, '\t');