mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-02 16:49:04 +00:00
Fixed progress bar
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -109,6 +109,7 @@ bool SDMCImporter::ImportContent(const ContentSpecifier& specifier,
|
||||
DeleteContent(specifier);
|
||||
return false;
|
||||
}
|
||||
callback(specifier.maximum_size, specifier.maximum_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user