mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-24 14:24:54 +00:00
DiscIO: Pass parameters by constant reference
This commit is contained in:
parent
1ae0b23265
commit
07ad189b4f
9 changed files with 17 additions and 15 deletions
|
@ -196,12 +196,12 @@ using CompressCB = std::function<bool(const std::string& text, float percent)>;
|
||||||
|
|
||||||
bool ConvertToGCZ(BlobReader* infile, const std::string& infile_path,
|
bool ConvertToGCZ(BlobReader* infile, const std::string& infile_path,
|
||||||
const std::string& outfile_path, u32 sub_type, int sector_size,
|
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,
|
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,
|
bool ConvertToWIAOrRVZ(BlobReader* infile, const std::string& infile_path,
|
||||||
const std::string& outfile_path, bool rvz,
|
const std::string& outfile_path, bool rvz,
|
||||||
WIARVZCompressionType compression_type, int compression_level,
|
WIARVZCompressionType compression_type, int compression_level,
|
||||||
int chunk_size, CompressCB callback);
|
int chunk_size, const CompressCB& callback);
|
||||||
|
|
||||||
} // namespace DiscIO
|
} // namespace DiscIO
|
||||||
|
|
|
@ -245,7 +245,7 @@ static ConversionResult<OutputParameters> Compress(CompressThreadState* state,
|
||||||
|
|
||||||
static ConversionResultCode Output(OutputParameters parameters, File::IOFile* outfile,
|
static ConversionResultCode Output(OutputParameters parameters, File::IOFile* outfile,
|
||||||
u64* position, std::vector<u64>* offsets, int progress_monitor,
|
u64* position, std::vector<u64>* offsets, int progress_monitor,
|
||||||
u32 num_blocks, CompressCB callback)
|
u32 num_blocks, const CompressCB& callback)
|
||||||
{
|
{
|
||||||
u64 offset = *position;
|
u64 offset = *position;
|
||||||
if (!parameters.compressed)
|
if (!parameters.compressed)
|
||||||
|
@ -276,7 +276,7 @@ static ConversionResultCode Output(OutputParameters parameters, File::IOFile* ou
|
||||||
|
|
||||||
bool ConvertToGCZ(BlobReader* infile, const std::string& infile_path,
|
bool ConvertToGCZ(BlobReader* infile, const std::string& infile_path,
|
||||||
const std::string& outfile_path, u32 sub_type, int block_size,
|
const std::string& outfile_path, u32 sub_type, int block_size,
|
||||||
CompressCB callback)
|
const CompressCB& callback)
|
||||||
{
|
{
|
||||||
ASSERT(infile->GetDataSizeType() == DataSizeType::Accurate);
|
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,
|
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);
|
ASSERT(infile->GetDataSizeType() == DataSizeType::Accurate);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ NANDImporter::~NANDImporter() = default;
|
||||||
|
|
||||||
void NANDImporter::ImportNANDBin(const std::string& path_to_bin,
|
void NANDImporter::ImportNANDBin(const std::string& path_to_bin,
|
||||||
std::function<void()> update_callback,
|
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);
|
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,
|
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_TOTAL_BLOCKS = 0x40000;
|
||||||
constexpr size_t NAND_BLOCK_SIZE = 0x800;
|
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,
|
// 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.
|
// 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,
|
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();
|
bool ExtractCertificates();
|
||||||
|
|
||||||
enum class Type
|
enum class Type
|
||||||
|
@ -64,7 +64,8 @@ public:
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
private:
|
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();
|
bool FindSuperblock();
|
||||||
std::string GetPath(const NANDFSTEntry& entry, const std::string& parent_path);
|
std::string GetPath(const NANDFSTEntry& entry, const std::string& parent_path);
|
||||||
std::string FormatDebugString(const NANDFSTEntry& entry);
|
std::string FormatDebugString(const NANDFSTEntry& entry);
|
||||||
|
|
|
@ -385,7 +385,7 @@ std::vector<Patch> GenerateRiivolutionPatchesFromGameModDescriptor(
|
||||||
return result;
|
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,
|
const std::string& game_id,
|
||||||
std::optional<u16> revision,
|
std::optional<u16> revision,
|
||||||
std::optional<u8> disc_number)
|
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(
|
std::vector<Patch> GenerateRiivolutionPatchesFromGameModDescriptor(
|
||||||
const GameModDescriptorRiivolution& descriptor, const std::string& game_id,
|
const GameModDescriptorRiivolution& descriptor, const std::string& game_id,
|
||||||
std::optional<u16> revision, std::optional<u8> disc_number);
|
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,
|
const std::string& game_id,
|
||||||
std::optional<u16> revision,
|
std::optional<u16> revision,
|
||||||
std::optional<u8> disc_number);
|
std::optional<u8> disc_number);
|
||||||
|
|
|
@ -1700,7 +1700,7 @@ ConversionResultCode WIARVZFileReader<RVZ>::Output(std::vector<OutputParametersE
|
||||||
template <bool RVZ>
|
template <bool RVZ>
|
||||||
ConversionResultCode WIARVZFileReader<RVZ>::RunCallback(size_t groups_written, u64 bytes_read,
|
ConversionResultCode WIARVZFileReader<RVZ>::RunCallback(size_t groups_written, u64 bytes_read,
|
||||||
u64 bytes_written, u32 total_groups,
|
u64 bytes_written, u32 total_groups,
|
||||||
u64 iso_size, CompressCB callback)
|
u64 iso_size, const CompressCB& callback)
|
||||||
{
|
{
|
||||||
int ratio = 0;
|
int ratio = 0;
|
||||||
if (bytes_read != 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,
|
bool ConvertToWIAOrRVZ(BlobReader* infile, const std::string& infile_path,
|
||||||
const std::string& outfile_path, bool rvz,
|
const std::string& outfile_path, bool rvz,
|
||||||
WIARVZCompressionType compression_type, int compression_level,
|
WIARVZCompressionType compression_type, int compression_level,
|
||||||
int chunk_size, CompressCB callback)
|
int chunk_size, const CompressCB& callback)
|
||||||
{
|
{
|
||||||
File::IOFile outfile(outfile_path, "wb");
|
File::IOFile outfile(outfile_path, "wb");
|
||||||
if (!outfile)
|
if (!outfile)
|
||||||
|
|
|
@ -359,7 +359,8 @@ private:
|
||||||
std::mutex* reusable_groups_mutex, GroupEntry* group_entry,
|
std::mutex* reusable_groups_mutex, GroupEntry* group_entry,
|
||||||
u64* bytes_written);
|
u64* bytes_written);
|
||||||
static ConversionResultCode RunCallback(size_t groups_written, u64 bytes_read, 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;
|
bool m_valid;
|
||||||
WIARVZCompressionType m_compression_type;
|
WIARVZCompressionType m_compression_type;
|
||||||
|
|
Loading…
Add table
Reference in a new issue