UWP: Fix loading the default theme.

Hopefully takes care of #15496

See also #15464
This commit is contained in:
Henrik Rydgård 2022-04-24 14:12:15 +02:00
parent 13fcff328c
commit 2178567ba0
4 changed files with 26 additions and 4 deletions

View File

@ -36,6 +36,7 @@ void UIContext::Init(Draw::DrawContext *thin3d, Draw::Pipeline *uipipe, Draw::Pi
}
void UIContext::setUIAtlas(const std::string &name) {
_dbg_assert_(!name.empty());
UIAtlas_ = name;
}

View File

@ -73,6 +73,7 @@ static void LoadThemeInfo(const std::vector<Path> &directories) {
themeInfos.clear();
ThemeInfo def{};
def.name = "Default";
def.UIAtlas = "ui_atlas";
themeInfos.push_back(def);
// This will update the theme if already present, as such default in assets/theme will get priority if exist
@ -228,14 +229,14 @@ void UpdateTheme(UIContext *ctx) {
ui_theme.backgroundColor = themeInfos[i].uBackgroundColor;
// Load any missing atlas metadata (the images are loaded from UIContext).
LoadAtlasMetadata(ui_atlas, (themeInfos[i].UIAtlas+".meta").c_str(), true);
LoadAtlasMetadata(ui_atlas, (themeInfos[i].UIAtlas + ".meta").c_str(), 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(themeInfos[i].UIAtlas+".zim");
ctx->setUIAtlas(themeInfos[i].UIAtlas + ".zim");
}
UI::Theme *GetTheme() {
@ -263,4 +264,4 @@ std::vector<std::string> GetThemeInfoNames() {
names.push_back(i.name);
return names;
}
}

View File

@ -599,6 +599,20 @@
<None Include="..\assets\ppge_atlas.meta">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="..\assets\themes\defaultthemes.ini">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='UWP Gold|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='UWP Gold|ARM64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='UWP Gold|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='UWP Gold|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="..\assets\ui_atlas.meta">
<DeploymentContent>true</DeploymentContent>
</None>
@ -1758,4 +1772,4 @@
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\MeshContentTask.targets" />
<Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ShaderGraphContentTask.targets" />
</ImportGroup>
</Project>
</Project>

View File

@ -50,6 +50,9 @@
<Filter Include="Content\flash0\font">
<UniqueIdentifier>{d2294c79-82bd-470f-b984-f838f0fbcd25}</UniqueIdentifier>
</Filter>
<Filter Include="Content\themes">
<UniqueIdentifier>{da2113a6-e616-4fc9-8be3-ff75b963664b}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="App.cpp" />
@ -359,6 +362,9 @@
<None Include="..\assets\ui_atlas.meta">
<Filter>Content</Filter>
</None>
<None Include="..\assets\themes\defaultthemes.ini">
<Filter>Content\themes</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Text Include="Content\gamecontrollerdb.txt">