Skip to content

Commit

Permalink
UWP: Fix loading the default theme.
Browse files Browse the repository at this point in the history
Hopefully takes care of #15496

See also #15464
  • Loading branch information
hrydgard committed Apr 24, 2022
1 parent 13fcff3 commit 2178567
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions Common/UI/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
7 changes: 4 additions & 3 deletions UI/Theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -263,4 +264,4 @@ std::vector<std::string> GetThemeInfoNames() {
names.push_back(i.name);

return names;
}
}
16 changes: 15 additions & 1 deletion UWP/UWP.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
6 changes: 6 additions & 0 deletions UWP/UWP.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down Expand Up @@ -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">
Expand Down

0 comments on commit 2178567

Please sign in to comment.