diff --git a/lib/libimhex/include/hex/api/theme_manager.hpp b/lib/libimhex/include/hex/api/theme_manager.hpp index 1f674d34f..e0c93f8bc 100644 --- a/lib/libimhex/include/hex/api/theme_manager.hpp +++ b/lib/libimhex/include/hex/api/theme_manager.hpp @@ -58,7 +58,7 @@ namespace hex { static std::vector getThemeNames(); - static const std::string &getThemeImagePostfix(); + static const std::string &getImageTheme(); static std::optional parseColorString(const std::string &colorString); @@ -88,7 +88,7 @@ namespace hex { static std::map s_themes; static std::map s_themeHandlers; static std::map s_styleHandlers; - static std::string s_imagePostfix; + static std::string s_imageTheme; static std::string s_currTheme; }; diff --git a/lib/libimhex/source/api/theme_manager.cpp b/lib/libimhex/source/api/theme_manager.cpp index 4a360d3e5..c72e598d1 100644 --- a/lib/libimhex/source/api/theme_manager.cpp +++ b/lib/libimhex/source/api/theme_manager.cpp @@ -12,7 +12,7 @@ namespace hex { std::map ThemeManager::s_themes; std::map ThemeManager::s_themeHandlers; std::map ThemeManager::s_styleHandlers; - std::string ThemeManager::s_imagePostfix; + std::string ThemeManager::s_imageTheme; std::string ThemeManager::s_currTheme; void ThemeManager::addThemeHandler(const std::string &name, const ColorMap &colorMap, const std::function &getFunction, const std::function &setFunction) { @@ -62,7 +62,7 @@ namespace hex { nlohmann::json ThemeManager::exportCurrentTheme(const std::string &name) { nlohmann::json theme = { { "name", name }, - { "image_postfix", s_imagePostfix }, + { "image_theme", s_imageTheme }, { "colors", {} }, { "styles", {} }, { "base", s_currTheme } @@ -174,11 +174,12 @@ namespace hex { } } - if (theme.contains("image_postfix")) { - if (theme["image_postfix"].is_string()) { - s_imagePostfix = theme["image_postfix"].get(); + if (theme.contains("image_theme")) { + if (theme["image_theme"].is_string()) { + s_imageTheme = theme["image_theme"].get(); } else { - hex::log::error("Theme '{}' has invalid image postfix!", name); + hex::log::error("Theme '{}' has invalid image theme!", name); + s_imageTheme = "dark"; } } @@ -187,8 +188,8 @@ namespace hex { EventManager::post(); } - const std::string &ThemeManager::getThemeImagePostfix() { - return s_imagePostfix; + const std::string &ThemeManager::getImageTheme() { + return s_imageTheme; } std::vector ThemeManager::getThemeNames() { @@ -203,7 +204,7 @@ namespace hex { ThemeManager::s_themes.clear(); ThemeManager::s_styleHandlers.clear(); ThemeManager::s_themeHandlers.clear(); - ThemeManager::s_imagePostfix.clear(); + ThemeManager::s_imageTheme.clear(); ThemeManager::s_currTheme.clear(); } diff --git a/plugins/builtin/romfs/logo.png b/plugins/builtin/romfs/assets/common/logo.png similarity index 100% rename from plugins/builtin/romfs/logo.png rename to plugins/builtin/romfs/assets/common/logo.png diff --git a/plugins/builtin/romfs/backdrop_dark.png b/plugins/builtin/romfs/assets/dark/backdrop.png similarity index 100% rename from plugins/builtin/romfs/backdrop_dark.png rename to plugins/builtin/romfs/assets/dark/backdrop.png diff --git a/plugins/builtin/romfs/banner_dark.png b/plugins/builtin/romfs/assets/dark/banner.png similarity index 100% rename from plugins/builtin/romfs/banner_dark.png rename to plugins/builtin/romfs/assets/dark/banner.png diff --git a/plugins/builtin/romfs/backdrop_light.png b/plugins/builtin/romfs/assets/light/backdrop.png similarity index 100% rename from plugins/builtin/romfs/backdrop_light.png rename to plugins/builtin/romfs/assets/light/backdrop.png diff --git a/plugins/builtin/romfs/banner_light.png b/plugins/builtin/romfs/assets/light/banner.png similarity index 100% rename from plugins/builtin/romfs/banner_light.png rename to plugins/builtin/romfs/assets/light/banner.png diff --git a/plugins/builtin/romfs/LICENSE b/plugins/builtin/romfs/licenses/LICENSE similarity index 100% rename from plugins/builtin/romfs/LICENSE rename to plugins/builtin/romfs/licenses/LICENSE diff --git a/plugins/builtin/romfs/themes/classic.json b/plugins/builtin/romfs/themes/classic.json index 6bdbb5c92..a5c124063 100644 --- a/plugins/builtin/romfs/themes/classic.json +++ b/plugins/builtin/romfs/themes/classic.json @@ -153,7 +153,7 @@ "string": "#008080FF" } }, - "image_postfix": "_dark", + "image_theme": "dark", "name": "Classic", "styles": { "imgui": { diff --git a/plugins/builtin/romfs/themes/dark.json b/plugins/builtin/romfs/themes/dark.json index 28a8be954..8e07110b9 100644 --- a/plugins/builtin/romfs/themes/dark.json +++ b/plugins/builtin/romfs/themes/dark.json @@ -153,7 +153,7 @@ "string": "#E07070FF" } }, - "image_postfix": "_dark", + "image_theme": "dark", "name": "Dark", "styles": { "imgui": { diff --git a/plugins/builtin/romfs/themes/light.json b/plugins/builtin/romfs/themes/light.json index deb4fc5fc..b6badcd02 100644 --- a/plugins/builtin/romfs/themes/light.json +++ b/plugins/builtin/romfs/themes/light.json @@ -153,7 +153,7 @@ "string": "#A02020FF" } }, - "image_postfix": "_light", + "image_theme": "light", "name": "Light", "styles": { "imgui": { diff --git a/plugins/builtin/source/content/views/view_about.cpp b/plugins/builtin/source/content/views/view_about.cpp index 274128eb2..897e9dd90 100644 --- a/plugins/builtin/source/content/views/view_about.cpp +++ b/plugins/builtin/source/content/views/view_about.cpp @@ -53,7 +53,7 @@ namespace hex::plugin::builtin { ImGui::TableNextColumn(); if (!this->m_logoTexture.isValid()) { - auto logo = romfs::get("logo.png"); + auto logo = romfs::get("assets/common/logo.png"); this->m_logoTexture = ImGui::Texture(reinterpret_cast(logo.data()), logo.size()); } @@ -190,7 +190,7 @@ namespace hex::plugin::builtin { } void ViewAbout::drawLicensePage() { - ImGui::TextFormattedWrapped("{}", romfs::get("LICENSE").string()); + ImGui::TextFormattedWrapped("{}", romfs::get("licenses/LICENSE").string()); } void ViewAbout::drawAboutPopup() { diff --git a/plugins/builtin/source/content/welcome_screen.cpp b/plugins/builtin/source/content/welcome_screen.cpp index d86a4328b..ae9564a87 100644 --- a/plugins/builtin/source/content/welcome_screen.cpp +++ b/plugins/builtin/source/content/welcome_screen.cpp @@ -421,8 +421,8 @@ namespace hex::plugin::builtin { }; ThemeManager::changeTheme(theme); - s_bannerTexture = changeTexture(hex::format("banner{}.png", ThemeManager::getThemeImagePostfix())); - s_backdropTexture = changeTexture(hex::format("backdrop{}.png", ThemeManager::getThemeImagePostfix())); + s_bannerTexture = changeTexture(hex::format("assets/{}/banner.png", ThemeManager::getImageTheme())); + s_backdropTexture = changeTexture(hex::format("assets/{}/backdrop.png", ThemeManager::getImageTheme())); if (!s_bannerTexture.isValid()) { log::error("Failed to load banner texture!");