From 5d0a051abb17a7ece07786849c736051969a039b Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sun, 2 Jul 2023 15:42:29 -0400 Subject: main: Fix install progress calculation The increased buffer size means that that progress bar size has to be adjusted --- src/yuzu/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 20532416c..83f502351 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2929,10 +2929,10 @@ void GMainWindow::OnMenuInstallToNAND() { int remaining = filenames.size(); - // This would only overflow above 2^43 bytes (8.796 TB) + // This would only overflow above 2^51 bytes (2.252 PB) int total_size = 0; for (const QString& file : files) { - total_size += static_cast(QFile(file).size() / 0x1000); + total_size += static_cast(QFile(file).size() / 1_MiB); } if (total_size < 0) { LOG_CRITICAL(Frontend, "Attempting to install too many files, aborting."); @@ -3088,7 +3088,7 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) { return false; } - std::array buffer{}; + std::vector buffer(1_MiB); for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) { if (install_progress->wasCanceled()) { -- cgit v1.2.3 From 9d7671ec3be87730d7faa70c9e11a3b1e36491cd Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Thu, 6 Jul 2023 13:04:27 -0400 Subject: main: Use 1_MiB as a constant for copy buffer size --- src/yuzu/main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 83f502351..6cd557c29 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -178,6 +178,8 @@ constexpr int default_mouse_hide_timeout = 2500; constexpr int default_mouse_center_timeout = 10; constexpr int default_input_update_timeout = 1; +constexpr size_t CopyBufferSize = 1_MiB; + /** * "Callouts" are one-time instructional messages shown to the user. In the config settings, there * is a bitfield "callout_flags" options, used to track if a message has already been shown to the @@ -2932,7 +2934,7 @@ void GMainWindow::OnMenuInstallToNAND() { // This would only overflow above 2^51 bytes (2.252 PB) int total_size = 0; for (const QString& file : files) { - total_size += static_cast(QFile(file).size() / 1_MiB); + total_size += static_cast(QFile(file).size() / CopyBufferSize); } if (total_size < 0) { LOG_CRITICAL(Frontend, "Attempting to install too many files, aborting."); @@ -3032,7 +3034,7 @@ InstallResult GMainWindow::InstallNSPXCI(const QString& filename) { return false; } - std::vector buffer(1_MiB); + std::vector buffer(CopyBufferSize); for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) { if (install_progress->wasCanceled()) { @@ -3088,7 +3090,7 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) { return false; } - std::vector buffer(1_MiB); + std::vector buffer(CopyBufferSize); for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) { if (install_progress->wasCanceled()) { -- cgit v1.2.3