diff options
| author | liamwhite <liamwhite@users.noreply.github.com> | 2023-07-06 18:57:25 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-06 18:57:25 -0400 |
| commit | 8c93a54ef720407c95b2fc69e2ad4a8e783e2dbc (patch) | |
| tree | aa12e026be8395575a2f21745866b30fcef5aef2 /src | |
| parent | 97b2171a8867d30a1d4f3ea4ed8e17877f5a769a (diff) | |
| parent | 8fa64dd1c50d5cc3a3c1ee0e7e30ed3bdf2beb47 (diff) | |
Merge pull request #10999 from Morph1984/fix-install-progress
main: Fix install progress calculation
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 20532416c2..6cd557c294 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 @@ -2929,10 +2931,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<int>(QFile(file).size() / 0x1000); + total_size += static_cast<int>(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<u8> buffer(1_MiB); + std::vector<u8> 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::array<u8, 0x1000> buffer{}; + std::vector<u8> buffer(CopyBufferSize); for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) { if (install_progress->wasCanceled()) { |
