Unify ProgressCallbacks to a Common::ProgressCallback

This commit is contained in:
Pengfei
2021-06-28 22:50:16 +08:00
parent 5a4bf7daff
commit 2575e7fdde
15 changed files with 69 additions and 46 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ CIABuilder::~CIABuilder() = default;
bool CIABuilder::Init(const std::string& destination, TitleMetadata tmd_,
const std::string& certs_db_path, std::size_t total_size_,
const ProgressCallback& callback_) {
const Common::ProgressCallback& callback_) {
header = {};
meta = {};
+3 -2
View File
@@ -8,6 +8,7 @@
#include <mutex>
#include <string>
#include "common/file_util.h"
#include "common/progress_callback.h"
#include "common/swap.h"
#include "core/ncch/ncch_container.h"
#include "core/ncch/title_metadata.h"
@@ -33,7 +34,7 @@ public:
* @return true on success, false otherwise
*/
bool Init(const std::string& destination, TitleMetadata tmd, const std::string& certs_db_path,
std::size_t total_size, const ProgressCallback& callback);
std::size_t total_size, const Common::ProgressCallback& callback);
/**
* Adds an NCCH content to the CIA.
@@ -103,7 +104,7 @@ private:
std::shared_ptr<HashedFile> file;
std::size_t written{}; // size written (with alignment)
std::size_t total_size{};
ProgressCallback callback;
Common::ProgressCallback callback;
// The NCCH to abort on
std::mutex abort_ncch_mutex;
+1 -1
View File
@@ -423,7 +423,7 @@ ResultStatus NCCHContainer::ReadSeedCrypto(bool& used) {
}
ResultStatus NCCHContainer::DecryptToFile(std::shared_ptr<FileUtil::IOFile> dest_file,
const ProgressCallback& callback) {
const Common::ProgressCallback& callback) {
ResultStatus result = Load();
if (result != ResultStatus::Success)
return result;
+2 -1
View File
@@ -11,6 +11,7 @@
#include "common/bit_field.h"
#include "common/common_types.h"
#include "common/file_util.h"
#include "common/progress_callback.h"
#include "common/swap.h"
#include "core/decryptor.h"
#include "core/result_status.h"
@@ -274,7 +275,7 @@ public:
*/
ResultStatus DecryptToFile(
std::shared_ptr<FileUtil::IOFile> dest_file,
const ProgressCallback& callback = [](std::size_t, std::size_t) {});
const Common::ProgressCallback& callback = [](std::size_t, std::size_t) {});
/**
* Aborts DecryptToFile. Simply aborts the decryptor.