From e39c78dab2d6d1eb7dcb9013319eacdf5276ea31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 13 Sep 2025 19:58:07 -0600 Subject: [PATCH] Remove the ability of themes to control the UI atlas (temporary) --- Common/UI/Context.cpp | 12 +++--------- Common/UI/Context.h | 3 --- UI/Theme.cpp | 24 ++---------------------- UI/Theme.h | 2 +- UI/UI.vcxproj.filters | 6 +++--- 5 files changed, 9 insertions(+), 38 deletions(-) diff --git a/Common/UI/Context.cpp b/Common/UI/Context.cpp index ab996ba331..8139441d6a 100644 --- a/Common/UI/Context.cpp +++ b/Common/UI/Context.cpp @@ -39,18 +39,12 @@ void UIContext::Init(Draw::DrawContext *thin3d, Draw::Pipeline *uipipe, Draw::Pi textDrawer_ = TextDrawer::Create(thin3d); // May return nullptr if no implementation is available for this platform. } -void UIContext::setUIAtlas(const std::string &name) { - _dbg_assert_(!name.empty()); - UIAtlas_ = name; -} - void UIContext::BeginFrame() { frameStartTime_ = time_now_d(); - if (!uitexture_ || UIAtlas_ != lastUIAtlas_) { - uitexture_ = CreateTextureFromFile(draw_, UIAtlas_.c_str(), ImageFileType::ZIM, false); - lastUIAtlas_ = UIAtlas_; + if (!uitexture_) { + uitexture_ = CreateTextureFromFile(draw_, "ui_atlas.zim", ImageFileType::ZIM, false); if (!fontTexture_) { -#if PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(ANDROID) +#if PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(MAC) || PPSSPP_PLATFORM(IOS) // Don't bother with loading font_atlas.zim #else fontTexture_ = CreateTextureFromFile(draw_, "font_atlas.zim", ImageFileType::ZIM, false); diff --git a/Common/UI/Context.h b/Common/UI/Context.h index bf0a912c85..be27844bf2 100644 --- a/Common/UI/Context.h +++ b/Common/UI/Context.h @@ -137,7 +137,4 @@ private: std::vector scissorStack_; std::vector transformStack_; - - std::string lastUIAtlas_; - std::string UIAtlas_ = "ui_atlas.zim"; }; diff --git a/UI/Theme.cpp b/UI/Theme.cpp index 44b43eddbc..a9421b9554 100644 --- a/UI/Theme.cpp +++ b/UI/Theme.cpp @@ -62,8 +62,6 @@ struct ThemeInfo { uint32_t uPopupSliderColor = 0xFFFFFFFF; uint32_t uPopupSliderFocusedColor = 0xFFEDC24C; - std::string sUIAtlas = "ui_atlas"; - bool operator == (const std::string &other) { return name == other; } @@ -75,6 +73,7 @@ struct ThemeInfo { static UI::Theme ui_theme; static std::vector themeInfos; +// TODO: Don't really belong here. static Atlas ui_atlas; static Atlas font_atlas; @@ -159,23 +158,6 @@ static void LoadThemeInfo(const std::vector &directories) { section.Get("PopupSliderColor", &info.uPopupSliderColor, info.uPopupSliderColor); section.Get("PopupSliderFocusedColor", &info.uPopupSliderFocusedColor, info.uPopupSliderFocusedColor); - std::string tmpPath; - section.Get("UIAtlas", &tmpPath, ""); - if (!tmpPath.empty()) { - if (tmpPath == "../ui_atlas") { - // Do nothing. - } else { - // WARNING: Note that the below appears to be entirely broken. ..-navigation doesn't work on zip VFS. - INFO_LOG(Log::System, "Checking %s", tmpPath.c_str()); - tmpPath = (path / tmpPath).ToString(); - if (g_VFS.Exists((tmpPath + ".meta").c_str()) && g_VFS.Exists((tmpPath + ".zim").c_str())) { - // INFO_LOG(Log::System, "%s exists", tmpPath.c_str()); - info.sUIAtlas = tmpPath; - } else { - INFO_LOG(Log::System, "%s.meta/zim doesn't exist, not overriding atlas", tmpPath.c_str()); - } - } - } appendTheme(info); } } @@ -271,14 +253,12 @@ void UpdateTheme(UIContext *ctx) { ui_theme.popupSliderFocusedColor = themeInfo.uPopupSliderFocusedColor; // Load any missing atlas metadata (the images are loaded from UIContext). - LoadAtlasMetadata(ui_atlas, (themeInfo.sUIAtlas + ".meta").c_str(), true); + LoadAtlasMetadata(ui_atlas, "ui_atlas.meta", true); #if !(PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(ANDROID)) LoadAtlasMetadata(font_atlas, "font_atlas.meta", ui_atlas.num_fonts == 0); #else LoadAtlasMetadata(font_atlas, "asciifont_atlas.meta", ui_atlas.num_fonts == 0); #endif - - ctx->setUIAtlas(themeInfo.sUIAtlas + ".zim"); } UI::Theme *GetTheme() { diff --git a/UI/Theme.h b/UI/Theme.h index d34d79cbe3..213dc2d07a 100644 --- a/UI/Theme.h +++ b/UI/Theme.h @@ -29,4 +29,4 @@ std::vector GetThemeInfoNames(); void UpdateTheme(UIContext *ctx); Atlas *GetFontAtlas(); Atlas *GetUIAtlas(); -UI::Theme *GetTheme(); \ No newline at end of file +UI::Theme *GetTheme(); diff --git a/UI/UI.vcxproj.filters b/UI/UI.vcxproj.filters index 32cee47d56..fb3178b7f7 100644 --- a/UI/UI.vcxproj.filters +++ b/UI/UI.vcxproj.filters @@ -19,7 +19,7 @@ Screens - + Screens @@ -141,7 +141,7 @@ Screens - + Screens @@ -256,4 +256,4 @@ {fda6bc55-1386-4650-a274-44fac9605ea3} - + \ No newline at end of file