DiscIO: Pass parameters by constant reference
This commit is contained in:
parent
f8bf35e6f0
commit
2ab8d2f054
|
@ -196,12 +196,12 @@ using CompressCB = std::function<bool(const std::string& text, float percent)>;
|
|||
|
||||
bool ConvertToGCZ(BlobReader* infile, const std::string& infile_path,
|
||||
const std::string& outfile_path, u32 sub_type, int sector_size,
|
||||
CompressCB callback);
|
||||
const CompressCB& callback);
|
||||
bool ConvertToPlain(BlobReader* infile, const std::string& infile_path,
|
||||
const std::string& outfile_path, CompressCB callback);
|
||||
const std::string& outfile_path, const CompressCB& callback);
|
||||
bool ConvertToWIAOrRVZ(BlobReader* infile, const std::string& infile_path,
|
||||
const std::string& outfile_path, bool rvz,
|
||||
WIARVZCompressionType compression_type, int compression_level,
|
||||
int chunk_size, CompressCB callback);
|
||||
int chunk_size, const CompressCB& callback);
|
||||
|
||||
} // namespace DiscIO
|
||||
|
|
|
@ -245,7 +245,7 @@ static ConversionResult<OutputParameters> Compress(CompressThreadState* state,
|
|||
|
||||
static ConversionResultCode Output(OutputParameters parameters, File::IOFile* outfile,
|
||||
u64* position, std::vector<u64>* offsets, int progress_monitor,
|
||||
u32 num_blocks, CompressCB callback)
|
||||
u32 num_blocks, const CompressCB& callback)
|
||||
{
|
||||
u64 offset = *position;
|
||||
if (!parameters.compressed)
|
||||
|
@ -276,7 +276,7 @@ static ConversionResultCode Output(OutputParameters parameters, File::IOFile* ou
|
|||
|
||||
bool ConvertToGCZ(BlobReader* infile, const std::string& infile_path,
|
||||
const std::string& outfile_path, u32 sub_type, int block_size,
|
||||
CompressCB callback)
|
||||
const CompressCB& callback)
|
||||
{
|
||||
ASSERT(infile->GetDataSizeType() == DataSizeType::Accurate);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ bool PlainFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
|
|||
}
|
||||
|
||||
bool ConvertToPlain(BlobReader* infile, const std::string& infile_path,
|
||||
const std::string& outfile_path, CompressCB callback)
|
||||
const std::string& outfile_path, const CompressCB& callback)
|
||||
{
|
||||
ASSERT(infile->GetDataSizeType() == DataSizeType::Accurate);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ NANDImporter::~NANDImporter() = default;
|
|||
|
||||
void NANDImporter::ImportNANDBin(const std::string& path_to_bin,
|
||||
std::function<void()> update_callback,
|
||||
std::function<std::string()> get_otp_dump_path)
|
||||
const std::function<std::string()>& get_otp_dump_path)
|
||||
{
|
||||
m_update_callback = std::move(update_callback);
|
||||
|
||||
|
@ -40,7 +40,7 @@ void NANDImporter::ImportNANDBin(const std::string& path_to_bin,
|
|||
}
|
||||
|
||||
bool NANDImporter::ReadNANDBin(const std::string& path_to_bin,
|
||||
std::function<std::string()> get_otp_dump_path)
|
||||
const std::function<std::string()>& get_otp_dump_path)
|
||||
{
|
||||
constexpr size_t NAND_TOTAL_BLOCKS = 0x40000;
|
||||
constexpr size_t NAND_BLOCK_SIZE = 0x800;
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
// If the associated OTP/SEEPROM dump (keys.bin) is not included in the image,
|
||||
// get_otp_dump_path will be called to get a path to it.
|
||||
void ImportNANDBin(const std::string& path_to_bin, std::function<void()> update_callback,
|
||||
std::function<std::string()> get_otp_dump_path);
|
||||
const std::function<std::string()>& get_otp_dump_path);
|
||||
bool ExtractCertificates();
|
||||
|
||||
enum class Type
|
||||
|
@ -64,7 +64,8 @@ public:
|
|||
#pragma pack(pop)
|
||||
|
||||
private:
|
||||
bool ReadNANDBin(const std::string& path_to_bin, std::function<std::string()> get_otp_dump_path);
|
||||
bool ReadNANDBin(const std::string& path_to_bin,
|
||||
const std::function<std::string()>& get_otp_dump_path);
|
||||
bool FindSuperblock();
|
||||
std::string GetPath(const NANDFSTEntry& entry, const std::string& parent_path);
|
||||
std::string FormatDebugString(const NANDFSTEntry& entry);
|
||||
|
|
|
@ -385,7 +385,7 @@ std::vector<Patch> GenerateRiivolutionPatchesFromGameModDescriptor(
|
|||
return result;
|
||||
}
|
||||
|
||||
std::vector<Patch> GenerateRiivolutionPatchesFromConfig(const std::string root_directory,
|
||||
std::vector<Patch> GenerateRiivolutionPatchesFromConfig(const std::string& root_directory,
|
||||
const std::string& game_id,
|
||||
std::optional<u16> revision,
|
||||
std::optional<u8> disc_number)
|
||||
|
|
|
@ -224,7 +224,7 @@ std::optional<Disc> ParseString(std::string_view xml, std::string xml_path);
|
|||
std::vector<Patch> GenerateRiivolutionPatchesFromGameModDescriptor(
|
||||
const GameModDescriptorRiivolution& descriptor, const std::string& game_id,
|
||||
std::optional<u16> revision, std::optional<u8> disc_number);
|
||||
std::vector<Patch> GenerateRiivolutionPatchesFromConfig(const std::string root_directory,
|
||||
std::vector<Patch> GenerateRiivolutionPatchesFromConfig(const std::string& root_directory,
|
||||
const std::string& game_id,
|
||||
std::optional<u16> revision,
|
||||
std::optional<u8> disc_number);
|
||||
|
|
|
@ -1700,7 +1700,7 @@ ConversionResultCode WIARVZFileReader<RVZ>::Output(std::vector<OutputParametersE
|
|||
template <bool RVZ>
|
||||
ConversionResultCode WIARVZFileReader<RVZ>::RunCallback(size_t groups_written, u64 bytes_read,
|
||||
u64 bytes_written, u32 total_groups,
|
||||
u64 iso_size, CompressCB callback)
|
||||
u64 iso_size, const CompressCB& callback)
|
||||
{
|
||||
int ratio = 0;
|
||||
if (bytes_read != 0)
|
||||
|
@ -2040,7 +2040,7 @@ WIARVZFileReader<RVZ>::Convert(BlobReader* infile, const VolumeDisc* infile_volu
|
|||
bool ConvertToWIAOrRVZ(BlobReader* infile, const std::string& infile_path,
|
||||
const std::string& outfile_path, bool rvz,
|
||||
WIARVZCompressionType compression_type, int compression_level,
|
||||
int chunk_size, CompressCB callback)
|
||||
int chunk_size, const CompressCB& callback)
|
||||
{
|
||||
File::IOFile outfile(outfile_path, "wb");
|
||||
if (!outfile)
|
||||
|
|
|
@ -359,7 +359,7 @@ private:
|
|||
std::mutex* reusable_groups_mutex, GroupEntry* group_entry,
|
||||
u64* bytes_written);
|
||||
static ConversionResultCode RunCallback(size_t groups_written, u64 bytes_read, u64 bytes_written,
|
||||
u32 total_groups, u64 iso_size, CompressCB callback);
|
||||
u32 total_groups, u64 iso_size, const CompressCB& callback);
|
||||
|
||||
bool m_valid;
|
||||
WIARVZCompressionType m_compression_type;
|
||||
|
|
Loading…
Reference in New Issue