diff --git a/lib/libimhex/include/hex/ui/imgui_imhex_extensions.h b/lib/libimhex/include/hex/ui/imgui_imhex_extensions.h index 7c052021f..dfd773e5b 100644 --- a/lib/libimhex/include/hex/ui/imgui_imhex_extensions.h +++ b/lib/libimhex/include/hex/ui/imgui_imhex_extensions.h @@ -2,8 +2,10 @@ #include +#include #include #include +#include #include #include diff --git a/main/source/init/splash_window.cpp b/main/source/init/splash_window.cpp index a060c1203..43db8ea55 100644 --- a/main/source/init/splash_window.cpp +++ b/main/source/init/splash_window.cpp @@ -113,10 +113,8 @@ namespace hex::init { bool WindowSplash::loop() { // Load splash screen image from romfs - auto splashBackground = romfs::get("splash_background.png"); - auto splashText = romfs::get("splash_text.png"); - ImGui::Texture splashBackgroundTexture = ImGui::Texture(reinterpret_cast(splashBackground.data()), splashBackground.size()); - ImGui::Texture splashTextTexture = ImGui::Texture(reinterpret_cast(splashText.data()), splashText.size()); + ImGui::Texture splashBackgroundTexture = ImGui::Texture(romfs::get("splash_background.png").span()); + ImGui::Texture splashTextTexture = ImGui::Texture(romfs::get("splash_text.png").span()); // If the image couldn't be loaded correctly, something went wrong during the build process // Close the application since this would lead to errors later on anyway. diff --git a/main/source/window/window.cpp b/main/source/window/window.cpp index 0d6bdeccc..6b92fe75f 100644 --- a/main/source/window/window.cpp +++ b/main/source/window/window.cpp @@ -85,8 +85,7 @@ namespace hex { this->setupNativeWindow(); this->registerEventHandlers(); - auto logoData = romfs::get("logo.png"); - this->m_logoTexture = ImGui::Texture(reinterpret_cast(logoData.data()), logoData.size()); + this->m_logoTexture = ImGui::Texture(romfs::get("logo.png").span()); ContentRegistry::Settings::impl::store(); EventManager::post(); diff --git a/plugins/builtin/source/content/pl_visualizers.cpp b/plugins/builtin/source/content/pl_visualizers.cpp index e34d5e2eb..6bc3f855a 100644 --- a/plugins/builtin/source/content/pl_visualizers.cpp +++ b/plugins/builtin/source/content/pl_visualizers.cpp @@ -527,10 +527,7 @@ namespace hex::plugin::builtin { static std::mutex addressMutex; static TaskHolder addressTask; - static auto mapTexture = [] { - auto image = romfs::get("assets/common/map.jpg"); - return ImGui::Texture(reinterpret_cast(image.data()), image.size()); - }(); + static auto mapTexture = ImGui::Texture(romfs::get("assets/common/map.jpg").span()); static ImVec2 mapSize = scaled(ImVec2(500, 500 / mapTexture.getAspectRatio())); if (shouldReset) { diff --git a/plugins/builtin/source/content/views/view_about.cpp b/plugins/builtin/source/content/views/view_about.cpp index 59a919935..c4d086cca 100644 --- a/plugins/builtin/source/content/views/view_about.cpp +++ b/plugins/builtin/source/content/views/view_about.cpp @@ -33,8 +33,6 @@ namespace hex::plugin::builtin { ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.help", "hex.builtin.menu.help.ask_for_help" }, 4000, CTRLCMD + SHIFT + Keys::D, [] { PopupDocsQuestion::open(); }); - - this->m_logoTexture = ImGui::Texture(romfs::get("assets/common/logo.png").span()); } static void link(const std::string &name, const std::string &author, const std::string &url) { @@ -63,6 +61,9 @@ namespace hex::plugin::builtin { ImGui::TableNextColumn(); // Draw the ImHex icon + if (!this->m_logoTexture.isValid()) + this->m_logoTexture = ImGui::Texture(romfs::get("assets/common/logo.png").span()); + ImGui::Image(this->m_logoTexture, scaled({ 64, 64 })); ImGui::TableNextColumn(); diff --git a/plugins/builtin/source/content/welcome_screen.cpp b/plugins/builtin/source/content/welcome_screen.cpp index e8ffda2a1..dd46eccd2 100644 --- a/plugins/builtin/source/content/welcome_screen.cpp +++ b/plugins/builtin/source/content/welcome_screen.cpp @@ -422,9 +422,7 @@ namespace hex::plugin::builtin { (void)EventManager::subscribe([](const std::string &theme) { auto changeTexture = [&](const std::string &path) { - auto textureData = romfs::get(path); - - return ImGui::Texture(reinterpret_cast(textureData.data()), textureData.size()); + return ImGui::Texture(romfs::get(path).span()); }; ThemeManager::changeTheme(theme);