From 0b7f2dc6242730a5a195774d131d440811620ce5 Mon Sep 17 00:00:00 2001 From: mrdude2478 Date: Sat, 7 Oct 2023 10:25:37 +0100 Subject: [PATCH] show percentage & refresh freespace during install --- source/install/http_nsp.cpp | 6 +++++- source/install/http_xci.cpp | 6 +++++- source/install/install_nsp.cpp | 2 +- source/install/install_xci.cpp | 2 +- source/install/sdmc_nsp.cpp | 7 ++++++- source/install/sdmc_xci.cpp | 6 +++++- source/install/usb_nsp.cpp | 6 +++++- source/install/usb_xci.cpp | 6 +++++- 8 files changed, 33 insertions(+), 8 deletions(-) diff --git a/source/install/http_nsp.cpp b/source/install/http_nsp.cpp index 5581e45..9fa0914 100644 --- a/source/install/http_nsp.cpp +++ b/source/install/http_nsp.cpp @@ -132,13 +132,17 @@ namespace tin::install::nsp } inst::ui::instPage::setInstBarPerc(100); - inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + "..."); + //inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + "..."); inst::ui::instPage::setInstBarPerc(0); while (!bufferedPlaceholderWriter.IsPlaceholderComplete() && !stopThreadsHttpNsp) { int installProgress = (int)(((double)bufferedPlaceholderWriter.GetSizeWrittenToPlaceholder() / (double)bufferedPlaceholderWriter.GetTotalDataSize()) * 100.0); inst::ui::instPage::setInstBarPerc((double)installProgress); + // + std::stringstream x; + x << (int)(installProgress); + inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + " " + x.str() + "%"); } inst::ui::instPage::setInstBarPerc(100); diff --git a/source/install/http_xci.cpp b/source/install/http_xci.cpp index 7567851..423d912 100644 --- a/source/install/http_xci.cpp +++ b/source/install/http_xci.cpp @@ -137,7 +137,7 @@ namespace tin::install::xci u64 totalSizeMB = bufferedPlaceholderWriter.GetTotalDataSize() / 1000000; #endif - inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + "..."); + //inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + "..."); inst::ui::instPage::setInstBarPerc(0); while (!bufferedPlaceholderWriter.IsPlaceholderComplete() && !stopThreadsHttpXci) { @@ -147,6 +147,10 @@ namespace tin::install::xci LOG_DEBUG("> Install Progress: %lu/%lu MB (%i%s)\r", installSizeMB, totalSizeMB, installProgress, "%"); #endif inst::ui::instPage::setInstBarPerc((double)installProgress); + // + std::stringstream x; + x << (int)(installProgress); + inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + " " + x.str() + "%"); } inst::ui::instPage::setInstBarPerc(100); diff --git a/source/install/install_nsp.cpp b/source/install/install_nsp.cpp index c8705f0..49f0122 100644 --- a/source/install/install_nsp.cpp +++ b/source/install/install_nsp.cpp @@ -127,7 +127,7 @@ namespace tin::install::nsp std::thread audioThread(inst::util::playAudio, audioPath); std::string information = "romfs:/images/icons/information.png"; if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.information"_theme)) { - information = inst::config::appDir + "icons_others.good"_theme; + information = inst::config::appDir + "icons_others.information"_theme; } int rc = inst::ui::mainApp->CreateShowDialog("inst.nca_verify.title"_lang, "inst.nca_verify.desc"_lang, { "common.cancel"_lang, "inst.nca_verify.opt1"_lang }, false, information); audioThread.join(); diff --git a/source/install/install_xci.cpp b/source/install/install_xci.cpp index 9c359b0..c064a5e 100644 --- a/source/install/install_xci.cpp +++ b/source/install/install_xci.cpp @@ -120,7 +120,7 @@ namespace tin::install::xci std::thread audioThread(inst::util::playAudio, audioPath); std::string information = "romfs:/images/icons/information.png"; if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.information"_theme)) { - information = inst::config::appDir + "icons_others.good"_theme; + information = inst::config::appDir + "icons_others.information"_theme; } int rc = inst::ui::mainApp->CreateShowDialog("inst.nca_verify.title"_lang, "inst.nca_verify.desc"_lang, { "common.cancel"_lang, "inst.nca_verify.opt1"_lang }, false, information); audioThread.join(); diff --git a/source/install/sdmc_nsp.cpp b/source/install/sdmc_nsp.cpp index 71465c8..7cdf126 100644 --- a/source/install/sdmc_nsp.cpp +++ b/source/install/sdmc_nsp.cpp @@ -4,6 +4,7 @@ #include "nx/nca_writer.h" #include "ui/instPage.hpp" #include "util/lang.hpp" +#include namespace tin::install::nsp { @@ -38,7 +39,7 @@ namespace tin::install::nsp try { - inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + "..."); + //inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + "..."); inst::ui::instPage::setInstBarPerc(0); while (fileOff < ncaSize) { @@ -47,6 +48,10 @@ namespace tin::install::nsp if (fileOff % (0x400000 * 3) == 0) { LOG_DEBUG("> Progress: %lu/%lu MB (%d%s)\r", (fileOff / 1000000), (ncaSize / 1000000), (int)(progress * 100.0), "%"); inst::ui::instPage::setInstBarPerc((double)(progress * 100.0)); + // + std::stringstream x; + x << (int)(progress * 100.0); + inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + " " + x.str() + "%"); } if (fileOff + readSize >= ncaSize) readSize = ncaSize - fileOff; diff --git a/source/install/sdmc_xci.cpp b/source/install/sdmc_xci.cpp index 6c56f36..6c1702f 100644 --- a/source/install/sdmc_xci.cpp +++ b/source/install/sdmc_xci.cpp @@ -38,7 +38,7 @@ namespace tin::install::xci try { - inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + "..."); + //inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + "..."); inst::ui::instPage::setInstBarPerc(0); while (fileOff < ncaSize) { @@ -47,6 +47,10 @@ namespace tin::install::xci if (fileOff % (0x400000 * 3) == 0) { LOG_DEBUG("> Progress: %lu/%lu MB (%d%s)\r", (fileOff / 1000000), (ncaSize / 1000000), (int)(progress * 100.0), "%"); inst::ui::instPage::setInstBarPerc((double)(progress * 100.0)); + // + std::stringstream x; + x << (int)(progress * 100.0); + inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + " " + x.str() + "%"); } if (fileOff + readSize >= ncaSize) readSize = ncaSize - fileOff; diff --git a/source/install/usb_nsp.cpp b/source/install/usb_nsp.cpp index 67e2d1b..7b2d845 100644 --- a/source/install/usb_nsp.cpp +++ b/source/install/usb_nsp.cpp @@ -163,7 +163,7 @@ namespace tin::install::nsp u64 totalSizeMB = bufferedPlaceholderWriter.GetTotalDataSize() / 1000000; #endif - inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + "..."); + //inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + "..."); inst::ui::instPage::setInstBarPerc(0); while (!bufferedPlaceholderWriter.IsPlaceholderComplete() && !stopThreadsUsbNsp) { @@ -173,6 +173,10 @@ namespace tin::install::nsp LOG_DEBUG("> Install Progress: %lu/%lu MB (%i%s)\r", installSizeMB, totalSizeMB, installProgress, "%"); #endif inst::ui::instPage::setInstBarPerc((double)installProgress); + // + std::stringstream x; + x << (int)(installProgress); + inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + " " + x.str() + "%"); } inst::ui::instPage::setInstBarPerc(100); diff --git a/source/install/usb_xci.cpp b/source/install/usb_xci.cpp index 19166d5..6f76e53 100644 --- a/source/install/usb_xci.cpp +++ b/source/install/usb_xci.cpp @@ -162,7 +162,7 @@ namespace tin::install::xci u64 totalSizeMB = bufferedPlaceholderWriter.GetTotalDataSize() / 1000000; #endif - inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + "..."); + //inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + "..."); inst::ui::instPage::setInstBarPerc(0); while (!bufferedPlaceholderWriter.IsPlaceholderComplete() && !stopThreadsUsbXci) { @@ -172,6 +172,10 @@ namespace tin::install::xci LOG_DEBUG("> Install Progress: %lu/%lu MB (%i%s)\r", installSizeMB, totalSizeMB, installProgress, "%"); #endif inst::ui::instPage::setInstBarPerc((double)installProgress); + // + std::stringstream x; + x << (int)(installProgress); + inst::ui::instPage::setInstInfoText("inst.info_page.top_info0"_lang + ncaFileName + " " + x.str() + "%"); } inst::ui::instPage::setInstBarPerc(100);