mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-03 00:38:58 +00:00
Fixed progress bar
This commit is contained in:
@@ -12,6 +12,8 @@ namespace Common {
|
|||||||
// (current_size, total_size)
|
// (current_size, total_size)
|
||||||
using ProgressCallback = std::function<void(u64, u64)>;
|
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 {
|
class ProgressCallbackWrapper {
|
||||||
public:
|
public:
|
||||||
// (total imported size, total size)
|
// (total imported size, total size)
|
||||||
|
|||||||
@@ -171,6 +171,9 @@ void FileDecryptor::DataWriteLoop() {
|
|||||||
current_buffer = (current_buffer + 1) % buffers.size();
|
current_buffer = (current_buffer + 1) % buffers.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (imported_size == total_size) { // Completed
|
||||||
|
callback(total_size, total_size);
|
||||||
|
}
|
||||||
completion_event.Set();
|
completion_event.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ bool SDMCImporter::ImportContent(const ContentSpecifier& specifier,
|
|||||||
DeleteContent(specifier);
|
DeleteContent(specifier);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
callback(specifier.maximum_size, specifier.maximum_size);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user