diff --git a/build/bin/vortex b/build/bin/vortex index f5ecdb8..93c8e6c 100755 Binary files a/build/bin/vortex and b/build/bin/vortex differ diff --git a/main/src/templates/load.cpp b/main/src/templates/load.cpp index 5c1d9d6..a40fc9e 100644 --- a/main/src/templates/load.cpp +++ b/main/src/templates/load.cpp @@ -17,6 +17,9 @@ namespace VortexMaker fs::create_directories(path); } + // Clear actual templates array + sys_templates.clear(); + // Search for module files recursively in the directory auto module_files = VortexMaker::SearchSystemFiles(path, "template.json"); diff --git a/tools/launcher/app/core/ProjectManager.cpp b/tools/launcher/app/core/ProjectManager.cpp index 49ed5cc..162ea3a 100644 --- a/tools/launcher/app/core/ProjectManager.cpp +++ b/tools/launcher/app/core/ProjectManager.cpp @@ -39,25 +39,48 @@ static std::vector syslabels; static void logo(const std::string &path, int index, int total) { - uint32_t w, h; + sleep(0.1); + uint32_t w = 0, h = 0; + // Vérifier si le chemin du fichier est valide + if (path.empty()) + { + std::cerr << "Chemin de fichier invalide." << std::endl; + return; + } + // Chargez le contenu hexadécimal du fichier .png std::vector hexTable = loadPngHex(path); const uint8_t *hexData = hexTable.data(); - if (total > logos.size()) + if (total > logos.size() && !hexTable.empty()) { void *data = UIKit::Image::Decode(hexData, hexTable.size(), w, h); - std::shared_ptr _icon = std::make_shared(w, h, UIKit::ImageFormat::RGBA, data); - logos.push_back(_icon); - VX_FREE(data); - ImTextureID addIcon = logos[index]->GetImGuiTextureID(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); - textures.push_back(addIcon); + if (data) + { + std::shared_ptr _icon = std::make_shared(w, h, UIKit::ImageFormat::RGBA, data); + logos.push_back(_icon); + VX_FREE(data); + ImTextureID addIcon = _icon->GetImGuiTextureID(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); + textures.push_back(addIcon); + } + else + { + // Gérer l'échec de décodage de l'image + std::cerr << "Échec du décodage de l'image." << std::endl; + // Vous pouvez logger une erreur ou effectuer une autre action appropriée + } } - if (index <= textures.size()) + if (index >= 0 && index < textures.size()) { ImGui::Image(textures[index], ImVec2(50, 50)); } + else + { + // Gérer l'index hors limites + std::cerr << "Index hors limites." << std::endl; + // Vous pouvez logger une erreur ou effectuer une autre action appropriée + } } ProjectManager::ProjectManager(VxContext *_ctx) @@ -214,16 +237,11 @@ void ProjectManager::OnImGuiRender() ImGui::BeginChild("LOGO_", ImVec2(70, 70), true); try { - - if (!project_templates[i]->m_logo_path.empty()) - { logo(project_templates[i]->m_logo_path, i, project_templates.size()); - } + } catch (std::exception e) { - std::cout << e.what() << std::endl; - sleep(5); } ImGui::EndChild(); ImGui::SameLine();