From db232952e0167e8fb1a69a2c370f8864846d21c4 Mon Sep 17 00:00:00 2001 From: mrdude2478 Date: Fri, 6 Oct 2023 02:34:49 +0100 Subject: [PATCH] finish up theme mod code --- Makefile | 2 +- include/util/config.hpp | 2 +- source/main.cpp | 12 ++++++++++-- source/ui/HDInstPage.cpp | 8 ++++---- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 7edca85..2377370 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ DATA := data INCLUDES := include include/ui include/data include/install include/nx include/nx/ipc include/util $(CURDIR)/include/Plutonium/Plutonium/include APP_TITLE := TinWoo Installer APP_AUTHOR := MrDude -APP_VERSION := 1.0.20 +APP_VERSION := 1.0.21 ROMFS := romfs APP_ICON := icon.jpg diff --git a/include/util/config.hpp b/include/util/config.hpp index 81d8c25..755d10b 100644 --- a/include/util/config.hpp +++ b/include/util/config.hpp @@ -5,7 +5,7 @@ namespace inst::config { static const std::string appDir = "sdmc:/switch/tinwoo"; static const std::string configPath = appDir + "/config.json"; - static const std::string appVersion = "1.0.20"; + static const std::string appVersion = "1.0.21"; extern std::string gAuthKey; extern std::string sigPatchesUrl; diff --git a/source/main.cpp b/source/main.cpp index 96f2689..a0663bf 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,5 +1,6 @@ #include #include +//#include #include #include "util/error.hpp" #include "ui/MainApplication.hpp" @@ -14,8 +15,15 @@ int main(int argc, char* argv[]) try { Theme::Load(); int x = 0; - if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "fonts.default"_theme)) { - x = 1; + int langInt = inst::config::languageSetting; + //Don't use custom fonts if Taiwanese or Japanese language is selected. + //but still use custom fonts if the system language is selected. + if (langInt != 2) { + if (langInt != 8) { + if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "fonts.default"_theme)) { + x = 1; + } + } } auto renderer_opts = pu::ui::render::RendererInitOptions(SDL_INIT_EVERYTHING, pu::ui::render::RendererHardwareFlags); renderer_opts.UseImage(pu::ui::render::IMGAllFlags); diff --git a/source/ui/HDInstPage.cpp b/source/ui/HDInstPage.cpp index e90fa9d..758302b 100644 --- a/source/ui/HDInstPage.cpp +++ b/source/ui/HDInstPage.cpp @@ -132,11 +132,11 @@ namespace inst::ui { if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour)); else ourEntry->SetColor(COLOR("#FFFFFFFF")); - std::string folder_up = "romfs:/images/icons/folder-upload.png"; - if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.folder_up"_theme)) { - folder_up = inst::config::appDir + "icons_others.folder_up"_theme; + std::string folder = "romfs:/images/icons/folder.png"; + if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.folder"_theme)) { + folder = inst::config::appDir + "icons_others.folder"_theme; } - ourEntry->SetIcon(folder_up); + ourEntry->SetIcon(folder); this->menu->AddItem(ourEntry); } for (auto& file : this->ourFiles) {