Fixed progress bar

This commit is contained in:
Pengfei
2021-08-31 22:01:21 +08:00
parent 78e88b7a6e
commit b2fdd1839f
3 changed files with 6 additions and 0 deletions
+2
View File
@@ -12,6 +12,8 @@ namespace Common {
// (current_size, total_size)
using ProgressCallback = std::function<void(u64, u64)>;
// Note on using this: it is important to ensure that the progress callback is at least
// invoked once. Typically a `callback(total, total)` at the end will work fine.
class ProgressCallbackWrapper {
public:
// (total imported size, total size)
+3
View File
@@ -171,6 +171,9 @@ void FileDecryptor::DataWriteLoop() {
current_buffer = (current_buffer + 1) % buffers.size();
}
if (imported_size == total_size) { // Completed
callback(total_size, total_size);
}
completion_event.Set();
}
+1
View File
@@ -109,6 +109,7 @@ bool SDMCImporter::ImportContent(const ContentSpecifier& specifier,
DeleteContent(specifier);
return false;
}
callback(specifier.maximum_size, specifier.maximum_size);
return true;
}