From e4f54c554d71fd1ce05abbb170c5fd7da8378a11 Mon Sep 17 00:00:00 2001 From: Collecting Date: Fri, 26 Dec 2025 05:04:41 +0000 Subject: [PATCH] Adjust CLI Updater Signed-off-by: Collecting --- src/citron/main.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/citron/main.cpp b/src/citron/main.cpp index 464e76990..a87b093c6 100644 --- a/src/citron/main.cpp +++ b/src/citron/main.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "core/hle/service/am/applet_manager.h" #include "core/loader/nca.h" @@ -6186,14 +6187,23 @@ int main(int argc, char* argv[]) { QObject::connect(service, &Updater::UpdaterService::UpdateDownloadProgress, [](int percentage, qint64 received, qint64 total) { double received_mb = static_cast(received) / 1024.0 / 1024.0; - double total_mb = static_cast(total) / 1024.0 / 1024.0; fmt::print("\rDownloading: ["); - int pos = percentage / 5; - for (int j = 0; j < 20; ++j) { - if (j < pos) fmt::print("="); else if (j == pos) fmt::print(">"); else fmt::print(" "); + if (total > 0) { + // We know the size, show a proper bar + int pos = percentage / 5; + for (int j = 0; j < 20; ++j) { + if (j < pos) fmt::print("="); else if (j == pos) fmt::print(">"); else fmt::print(" "); + } + double total_mb = static_cast(total) / 1024.0 / 1024.0; + fmt::print("] {}% ({:.2f} MB / {:.2f} MB)", percentage, received_mb, total_mb); + } else { + // Size is unknown, show a "spinner" or just bytes + static int spinner = 0; + const char* chars = "|/-\\"; + fmt::print(" {} ", chars[spinner++ % 4]); + fmt::print(" ] (Size unknown) {:.2f} MB received", received_mb); } - fmt::print("] {}% ({:.2f} MB / {:.2f} MB)", percentage, received_mb, total_mb); fflush(stdout); });