diff --git a/lib/libimhex/source/helpers/net.cpp b/lib/libimhex/source/helpers/net.cpp index 61e869d30..bdc5bef27 100644 --- a/lib/libimhex/source/helpers/net.cpp +++ b/lib/libimhex/source/helpers/net.cpp @@ -120,8 +120,11 @@ namespace hex { std::optional Net::execute() { CURLcode result = curl_easy_perform(this->m_ctx); - if (result != CURLE_OK) - log::error("Net request failed with error {0}: '{1}'", u32(result), curl_easy_strerror(result)); + if (result != CURLE_OK){ + char *url = nullptr; + curl_easy_getinfo(this->m_ctx, CURLINFO_EFFECTIVE_URL, &url); + log::error("Net request '{0}' failed with error {1}: '{2}'", url, u32(result), curl_easy_strerror(result)); + } long responseCode = 0; curl_easy_getinfo(this->m_ctx, CURLINFO_RESPONSE_CODE, &responseCode); diff --git a/main/source/init/splash_window.cpp b/main/source/init/splash_window.cpp index 12fe01312..24184e667 100644 --- a/main/source/init/splash_window.cpp +++ b/main/source/init/splash_window.cpp @@ -51,8 +51,12 @@ namespace hex::init { this->m_currTaskName = name; } + auto startTime = std::chrono::high_resolution_clock::now(); if (!task()) status = false; + auto endTime = std::chrono::high_resolution_clock::now(); + + log::info("Task '{}' finished in {} ms", name, std::chrono::duration_cast(endTime-startTime).count()); tasksCompleted++; @@ -119,7 +123,7 @@ namespace hex::init { #endif drawList->AddRectFilled(ImVec2(0, splashTexture.getSize().y - 5) * scale, ImVec2(splashTexture.getSize().x * this->m_progress, splashTexture.getSize().y) * scale, 0xFFFFFFFF); - drawList->AddText(ImVec2(15, splashTexture.getSize().y - 25) * scale, ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("[{}] {}", "|/-\\"[ImU32(ImGui::GetTime() * 15) % 4], this->m_currTaskName).c_str()); + drawList->AddText(ImVec2(15, splashTexture.getSize().y - 25) * scale, ImColor(0xFF, 0xFF, 0xFF, 0xFF), hex::format("[{}] {}...", "|/-\\"[ImU32(ImGui::GetTime() * 15) % 4], this->m_currTaskName).c_str()); } ImGui::Render(); diff --git a/main/source/init/tasks.cpp b/main/source/init/tasks.cpp index 93257fa1a..6c0d3c579 100644 --- a/main/source/init/tasks.cpp +++ b/main/source/init/tasks.cpp @@ -312,12 +312,12 @@ namespace hex::init { std::vector getInitTasks() { return { - { "Creating directories...", createDirectories, false }, - { "Loading settings...", loadSettings, false }, - { "Loading plugins...", loadPlugins, false }, - { "Checking for updates...", checkForUpdates, true }, - { "Downloading information...", downloadInformation, true }, - { "Loading fonts...", loadFonts, true }, + { "Creating directories", createDirectories, false }, + { "Loading settings", loadSettings, false }, + { "Loading plugins", loadPlugins, false }, + { "Checking for updates", checkForUpdates, true }, + { "Downloading information", downloadInformation, true }, + { "Loading fonts", loadFonts, true }, }; } diff --git a/main/source/window/window.cpp b/main/source/window/window.cpp index 60e046319..b56165423 100644 --- a/main/source/window/window.cpp +++ b/main/source/window/window.cpp @@ -69,8 +69,8 @@ namespace hex { buf->append("\n"); } - static void signalHandler(int signalNumber) { - log::fatal("Terminating with signal {}", signalNumber); + static void signalHandler(int signalNumber, std::string signalName) { + log::fatal("Terminating with signal '{}' ({})", signalName, signalNumber); EventManager::post(signalNumber); @@ -155,11 +155,16 @@ namespace hex { this->m_popupsToOpen.push_back(name); }); - std::signal(SIGSEGV, signalHandler); - std::signal(SIGILL, signalHandler); - std::signal(SIGABRT, signalHandler); - std::signal(SIGFPE, signalHandler); - std::set_terminate([]{ signalHandler(SIGABRT); }); + #define HANDLE_SIGNAL(name) \ + std::signal(name, [](int signalNumber){ \ + signalHandler(signalNumber, #name); \ + }); + HANDLE_SIGNAL(SIGSEGV) + HANDLE_SIGNAL(SIGILL) + HANDLE_SIGNAL(SIGABRT) + HANDLE_SIGNAL(SIGFPE) + #undef HANDLE_SIGNAL + std::set_terminate([]{ signalHandler(SIGABRT, "Unhandled C++ exception"); }); auto logoData = romfs::get("logo.png"); this->m_logoTexture = ImGui::Texture(reinterpret_cast(logoData.data()), logoData.size());