DiscIO: Improve comments in WIARVZFileReader::Convert

Just some clarifications and typo fixes.
This commit is contained in:
JosJuice 2023-05-16 18:58:07 +02:00
parent dadbeb4bae
commit 192081d2f1

View File

@ -1771,16 +1771,17 @@ WIARVZFileReader<RVZ>::Convert(BlobReader* infile, const VolumeDisc* infile_volu
// An estimate for how much space will be taken up by headers. // An estimate for how much space will be taken up by headers.
// We will reserve this much space at the beginning of the file, and if the headers don't // We will reserve this much space at the beginning of the file, and if the headers don't
// fit on that space, we will need to write them at the end of the file instead. // fit in that space, we will need to write them at the end of the file instead.
const u64 headers_size_upper_bound = [&] { const u64 headers_size_upper_bound = [&] {
// 0x100 is added to account for compression overhead (in particular for Purge). // 0x100 is added to account for compression overhead (in particular for Purge).
u64 upper_bound = sizeof(WIAHeader1) + sizeof(WIAHeader2) + partition_entries_size + u64 upper_bound = sizeof(WIAHeader1) + sizeof(WIAHeader2) + partition_entries_size +
raw_data_entries_size + 0x100; raw_data_entries_size + 0x100;
// RVZ's added data in GroupEntry usually compresses well, so we'll assume the compression ratio // Compared to WIA, RVZ adds an extra member to the GroupEntry struct. This added data usually
// for RVZ GroupEntries is 9 / 16 or better. This constant is somehwat arbitrarily chosen, but // compresses well, so we'll assume the compression ratio for RVZ GroupEntries is 9 / 16 or
// no games were found that get a worse compression ratio than that. There are some games that // better. This constant is somehwat arbitrarily chosen, but no games were found that get a
// get a worse ratio than 1 / 2, such as Metroid: Other M (PAL) with the default settings. // worse compression ratio than that. There are some games that get a worse ratio than 1 / 2,
// such as Metroid: Other M (PAL) with the default settings.
if (RVZ && compression_type > WIARVZCompressionType::Purge) if (RVZ && compression_type > WIARVZCompressionType::Purge)
upper_bound += static_cast<u64>(group_entries_size) * 9 / 16; upper_bound += static_cast<u64>(group_entries_size) * 9 / 16;
else else
@ -1798,7 +1799,7 @@ WIARVZFileReader<RVZ>::Convert(BlobReader* infile, const VolumeDisc* infile_volu
if (!infile->Read(0, header_2.disc_header.size(), header_2.disc_header.data())) if (!infile->Read(0, header_2.disc_header.size(), header_2.disc_header.data()))
return ConversionResultCode::ReadFailed; return ConversionResultCode::ReadFailed;
// We intentially do not increment bytes_read here, since these bytes will be read again // We intentionally do not increment bytes_read here, since these bytes will be read again
std::map<ReuseID, GroupEntry> reusable_groups; std::map<ReuseID, GroupEntry> reusable_groups;
std::mutex reusable_groups_mutex; std::mutex reusable_groups_mutex;