Skip to content

Commit

Permalink
Fox font issues, change album icons again
Browse files Browse the repository at this point in the history
  • Loading branch information
XorTroll committed Jul 4, 2024
1 parent a90ddf2 commit 0404505
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 67 deletions.
Binary file modified assets/default-theme/Main/EntryIcon/Album.xcf
Binary file not shown.
Binary file modified assets/default-theme/Main/QuickIcon/Album.xcf
Binary file not shown.
Binary file added assets/orig/Album.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 22 additions & 2 deletions libs/uCommon/include/ul/ul_Include.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,28 @@ namespace ul {
constexpr const char ApplicationCachePath[] = "sdmc:/ulaunch/cache/app";
constexpr const char HomebrewCachePath[] = "sdmc:/ulaunch/cache/hb";
constexpr const char AccountCachePath[] = "sdmc:/ulaunch/cache/acc";
constexpr const char ActiveThemeCachePath[] = "sdmc:/ulaunch/cache/theme";
constexpr const char ThemePreviewCachePath[] = "sdmc:/ulaunch/cache/themepreview";
constexpr const char ThemePreviewCachePath[] = "sdmc:/ulaunch/cache/preview";
constexpr const char ActiveThemeCachePath[] = "sdmc:/ulaunch/cache/active";
constexpr const char *ActiveThemeCacheSubfolderPaths[] = {
"sdmc:/ulaunch/cache/active/theme",
"sdmc:/ulaunch/cache/active/ui",
"sdmc:/ulaunch/cache/active/ui/Main",
"sdmc:/ulaunch/cache/active/ui/Main/EntryIcon",
"sdmc:/ulaunch/cache/active/ui/Main/OverIcon",
"sdmc:/ulaunch/cache/active/ui/Main/QuickIcon",
"sdmc:/ulaunch/cache/active/ui/Main/TopIcon",
"sdmc:/ulaunch/cache/active/ui/Main/TopIcon/Battery",
"sdmc:/ulaunch/cache/active/ui/Main/TopIcon/Connection",
"sdmc:/ulaunch/cache/active/ui/Main/TopMenuBackground",
"sdmc:/ulaunch/cache/active/ui/Startup"
"sdmc:/ulaunch/cache/active/ui/Themes",
"sdmc:/ulaunch/cache/active/ui/Settings",
"sdmc:/ulaunch/cache/active/sound",
"sdmc:/ulaunch/cache/active/sound/Main",
"sdmc:/ulaunch/cache/active/sound/Startup"
"sdmc:/ulaunch/cache/active/sound/Themes",
"sdmc:/ulaunch/cache/active/sound/Settings",
};

constexpr const char ManagerLanguagesPath[] = "sdmc:/ulaunch/lang/uManager";

Expand Down
3 changes: 3 additions & 0 deletions libs/uCommon/source/ul/cfg/cfg_Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ namespace ul::cfg {

void RemoveActiveThemeCache() {
fs::CleanDirectory(ActiveThemeCachePath);
for(u32 i = 0; i < std::size(ActiveThemeCacheSubfolderPaths); i++) {
fs::CreateDirectory(ActiveThemeCacheSubfolderPaths[i]);
}
}

void LoadLanguageJsons(const std::string &lang_base, util::JSON &lang, util::JSON &def) {
Expand Down
4 changes: 2 additions & 2 deletions projects/uManager/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ int main() {

auto renderer_opts = pu::ui::render::RendererInitOptions(SDL_INIT_EVERYTHING, pu::ui::render::RendererHardwareFlags);
renderer_opts.UseImage(pu::ui::render::IMGAllFlags);
renderer_opts.UseTTF();
renderer_opts.SetExtraDefaultFontSize(35);
renderer_opts.AddDefaultAllSharedFonts();
renderer_opts.AddExtraDefaultFontSize(35);
renderer_opts.UseRomfs();
auto renderer = pu::ui::render::Renderer::New(renderer_opts);

Expand Down
22 changes: 0 additions & 22 deletions projects/uMenu/romfs/default/sound/BGM.json

This file was deleted.

Binary file modified projects/uMenu/romfs/default/ui/Main/EntryIcon/Album.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified projects/uMenu/romfs/default/ui/Main/QuickIcon/Album.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 15 additions & 3 deletions projects/uMenu/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,25 @@ namespace {
// Get the text sizes to initialize default fonts
auto ui_json = ul::util::JSON::object();
UL_RC_ASSERT(ul::util::LoadJSONFromFile(ui_json, ul::menu::ui::TryGetActiveThemeResource("ui/UI.json")));
const auto default_font_path = ul::menu::ui::TryGetActiveThemeResource("ui/Font.ttf");

auto renderer_opts = pu::ui::render::RendererInitOptions(SDL_INIT_EVERYTHING, pu::ui::render::RendererHardwareFlags);
renderer_opts.UseTTF(default_font_path);

const auto default_font_path = ul::menu::ui::TryGetActiveThemeResource("ui/Font.ttf");
if(!default_font_path.empty()) {
renderer_opts.AddDefaultFontPath(default_font_path);
}
else {
renderer_opts.AddDefaultSharedFont(PlSharedFontType_Standard);
renderer_opts.AddDefaultSharedFont(PlSharedFontType_ChineseSimplified);
renderer_opts.AddDefaultSharedFont(PlSharedFontType_ExtChineseSimplified);
renderer_opts.AddDefaultSharedFont(PlSharedFontType_ChineseTraditional);
renderer_opts.AddDefaultSharedFont(PlSharedFontType_KO);
}
renderer_opts.AddDefaultSharedFont(PlSharedFontType_NintendoExt);

renderer_opts.UseImage(pu::ui::render::IMGAllFlags);
renderer_opts.UseAudio(pu::ui::render::MixerAllFlags);
// renderer_opts.SetExtraDefaultFontSize(menu_folder_text_size);

auto renderer = pu::ui::render::Renderer::New(renderer_opts);
g_MenuApplication = ul::menu::ui::MenuApplication::New(renderer);

Expand Down
1 change: 0 additions & 1 deletion projects/uMenu/source/ul/menu/ui/ui_EntryMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ namespace ul::menu::ui {
}

bool EntryMenu::LoadEntry(const u32 idx) {
UL_LOG_WARN("Loading entry %d", idx);
if(idx < this->cur_entries.size()) {
const auto &entry = this->cur_entries.at(idx);
if(!entry.Is<EntryType::Invalid>()) {
Expand Down
76 changes: 40 additions & 36 deletions projects/uMenu/source/ul/menu/ui/ui_MenuApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,43 +38,47 @@ namespace ul::menu::ui {
}

this->bgm_json = ul::util::JSON::object();
ul::util::LoadJSONFromFile(this->bgm_json, TryGetActiveThemeResource("sound/BGM.json"));

#define _LOAD_MENU_BGM(menu, bgm_name) { \
if(this->bgm_json.count(#menu)) { \
const auto menu_json = this->bgm_json[#menu]; \
this->menu##_bgm.bgm_loop = menu_json.value("bgm_loop", DefaultBgmLoop); \
this->menu##_bgm.bgm_fade_in_ms = menu_json.value("bgm_fade_in_ms", DefaultBgmFadeInMs); \
this->menu##_bgm.bgm_fade_in_ms = menu_json.value("bgm_fade_out_ms", DefaultBgmFadeOutMs); \
this->menu##_bgm.bgm = nullptr; \
this->menu##_bgm.bgm = pu::audio::OpenMusic(TryGetActiveThemeResource("sound/" bgm_name "/Bgm.mp3")); \
} \
}
_LOAD_MENU_BGM(main_menu, "Main")
_LOAD_MENU_BGM(startup_menu, "Startup")
_LOAD_MENU_BGM(themes_menu, "Themes")
_LOAD_MENU_BGM(settings_menu, "Settings")

if(this->bgm_json.count("bgm_loop")) {
const auto global_loop = this->bgm_json.value("bgm_loop", DefaultBgmLoop);
this->main_menu_bgm.bgm_loop = global_loop;
this->startup_menu_bgm.bgm_loop = global_loop;
this->themes_menu_bgm.bgm_loop = global_loop;
this->settings_menu_bgm.bgm_loop = global_loop;
}
if(this->bgm_json.count("bgm_fade_in_ms")) {
const auto global_fade_in_ms = this->bgm_json.value("bgm_fade_in_ms", DefaultBgmFadeInMs);
this->main_menu_bgm.bgm_fade_in_ms = global_fade_in_ms;
this->startup_menu_bgm.bgm_fade_in_ms = global_fade_in_ms;
this->themes_menu_bgm.bgm_fade_in_ms = global_fade_in_ms;
this->settings_menu_bgm.bgm_fade_in_ms = global_fade_in_ms;
const auto rc = ul::util::LoadJSONFromFile(this->bgm_json, TryGetActiveThemeResource("sound/BGM.json"));
if(R_SUCCEEDED(rc)) {
#define _LOAD_MENU_BGM(menu, bgm_name) { \
if(this->bgm_json.count(#menu)) { \
const auto menu_json = this->bgm_json[#menu]; \
this->menu##_bgm.bgm_loop = menu_json.value("bgm_loop", DefaultBgmLoop); \
this->menu##_bgm.bgm_fade_in_ms = menu_json.value("bgm_fade_in_ms", DefaultBgmFadeInMs); \
this->menu##_bgm.bgm_fade_in_ms = menu_json.value("bgm_fade_out_ms", DefaultBgmFadeOutMs); \
this->menu##_bgm.bgm = nullptr; \
this->menu##_bgm.bgm = pu::audio::OpenMusic(TryGetActiveThemeResource("sound/" bgm_name "/Bgm.mp3")); \
} \
}
_LOAD_MENU_BGM(main_menu, "Main")
_LOAD_MENU_BGM(startup_menu, "Startup")
_LOAD_MENU_BGM(themes_menu, "Themes")
_LOAD_MENU_BGM(settings_menu, "Settings")

if(this->bgm_json.count("bgm_loop")) {
const auto global_loop = this->bgm_json.value("bgm_loop", DefaultBgmLoop);
this->main_menu_bgm.bgm_loop = global_loop;
this->startup_menu_bgm.bgm_loop = global_loop;
this->themes_menu_bgm.bgm_loop = global_loop;
this->settings_menu_bgm.bgm_loop = global_loop;
}
if(this->bgm_json.count("bgm_fade_in_ms")) {
const auto global_fade_in_ms = this->bgm_json.value("bgm_fade_in_ms", DefaultBgmFadeInMs);
this->main_menu_bgm.bgm_fade_in_ms = global_fade_in_ms;
this->startup_menu_bgm.bgm_fade_in_ms = global_fade_in_ms;
this->themes_menu_bgm.bgm_fade_in_ms = global_fade_in_ms;
this->settings_menu_bgm.bgm_fade_in_ms = global_fade_in_ms;
}
if(this->bgm_json.count("bgm_fade_out_ms")) {
const auto global_fade_out_ms = this->bgm_json.value("bgm_fade_out_ms", DefaultBgmFadeOutMs);
this->main_menu_bgm.bgm_fade_out_ms = global_fade_out_ms;
this->startup_menu_bgm.bgm_fade_out_ms = global_fade_out_ms;
this->themes_menu_bgm.bgm_fade_out_ms = global_fade_out_ms;
this->settings_menu_bgm.bgm_fade_out_ms = global_fade_out_ms;
}
}
if(this->bgm_json.count("bgm_fade_out_ms")) {
const auto global_fade_out_ms = this->bgm_json.value("bgm_fade_out_ms", DefaultBgmFadeOutMs);
this->main_menu_bgm.bgm_fade_out_ms = global_fade_out_ms;
this->startup_menu_bgm.bgm_fade_out_ms = global_fade_out_ms;
this->themes_menu_bgm.bgm_fade_out_ms = global_fade_out_ms;
this->settings_menu_bgm.bgm_fade_out_ms = global_fade_out_ms;
else {
UL_LOG_WARN("Unable to load active theme sound settings (%s), theme might have no sound features", util::FormatResultDisplay(rc).c_str());
}

// These UI values are required, we will assert otherwise (thus the error will be visible on our logs)
Expand Down

0 comments on commit 0404505

Please sign in to comment.