diff options
author | Lioncash <mathew1800@gmail.com> | 2018-08-16 16:28:03 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-08-16 16:28:06 +0200 |
commit | aac807fd3a79432480f46520f228dd38ac97b54d (patch) | |
tree | d61ec09673910fc7c86cd328229d315ad75f3f59 | |
parent | Merge pull request #1005 from DarkLordZach/registered-fmt (diff) | |
download | yuzu-aac807fd3a79432480f46520f228dd38ac97b54d.tar yuzu-aac807fd3a79432480f46520f228dd38ac97b54d.tar.gz yuzu-aac807fd3a79432480f46520f228dd38ac97b54d.tar.bz2 yuzu-aac807fd3a79432480f46520f228dd38ac97b54d.tar.lz yuzu-aac807fd3a79432480f46520f228dd38ac97b54d.tar.xz yuzu-aac807fd3a79432480f46520f228dd38ac97b54d.tar.zst yuzu-aac807fd3a79432480f46520f228dd38ac97b54d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/yuzu/main.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f7eee7769..2e62135f4 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -634,18 +634,22 @@ void GMainWindow::OnMenuInstallToNAND() { if (!dest->Resize(src->GetSize())) return false; + std::array<u8, 0x1000> buffer{}; + const int progress_maximum = static_cast<int>(src->GetSize() / buffer.size()); + QProgressDialog progress(fmt::format("Installing file \"{}\"...", src->GetName()).c_str(), - "Cancel", 0, src->GetSize() / 0x1000, this); + "Cancel", 0, progress_maximum, this); progress.setWindowModality(Qt::WindowModal); - std::array<u8, 0x1000> buffer{}; - for (size_t i = 0; i < src->GetSize(); i += 0x1000) { + for (size_t i = 0; i < src->GetSize(); i += buffer.size()) { if (progress.wasCanceled()) { dest->Resize(0); return false; } - progress.setValue(i / 0x1000); + const int progress_value = static_cast<int>(i / buffer.size()); + progress.setValue(progress_value); + const auto read = src->Read(buffer.data(), buffer.size(), i); dest->Write(buffer.data(), read, i); } |