Remove the ability of themes to control the UI atlas (temporary)

This commit is contained in:
Henrik Rydgård
2025-09-13 19:58:07 -06:00
parent c7aa2bcd01
commit e39c78dab2
5 changed files with 9 additions and 38 deletions
+3 -9
View File
@@ -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);
-3
View File
@@ -137,7 +137,4 @@ private:
std::vector<Bounds> scissorStack_;
std::vector<UITransform> transformStack_;
std::string lastUIAtlas_;
std::string UIAtlas_ = "ui_atlas.zim";
};
+2 -22
View File
@@ -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<ThemeInfo> 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<Path> &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() {
+1 -1
View File
@@ -29,4 +29,4 @@ std::vector<std::string> GetThemeInfoNames();
void UpdateTheme(UIContext *ctx);
Atlas *GetFontAtlas();
Atlas *GetUIAtlas();
UI::Theme *GetTheme();
UI::Theme *GetTheme();
+3 -3
View File
@@ -19,7 +19,7 @@
<ClCompile Include="MiscScreens.cpp">
<Filter>Screens</Filter>
</ClCompile>
<ClCompile Include="IAPScreen.cpp">
<ClCompile Include="IAPScreen.cpp">
<Filter>Screens</Filter>
</ClCompile>
<ClCompile Include="ControlMappingScreen.cpp">
@@ -141,7 +141,7 @@
<ClInclude Include="MiscScreens.h">
<Filter>Screens</Filter>
</ClInclude>
<ClInclude Include="IAPScreen.h">
<ClInclude Include="IAPScreen.h">
<Filter>Screens</Filter>
</ClInclude>
<ClInclude Include="ControlMappingScreen.h">
@@ -256,4 +256,4 @@
<UniqueIdentifier>{fda6bc55-1386-4650-a274-44fac9605ea3}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
</Project>