Merge pull request #10970 from AdmiralCurtiss/directoryblob-encrypted

DirectoryBlob: Fix partition size mixup for encrypted Wii discs.
This commit is contained in:
Admiral H. Curtiss 2022-08-12 22:35:40 +02:00 committed by GitHub
commit 92c6407c45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -663,10 +663,14 @@ void DirectoryBlobReader::SetPartitions(std::vector<PartitionWithType>&& partiti
SetPartitionHeader(&partitions[i].partition, partition_address);
const u64 data_size = partitions[i].partition.GetDataSize();
const u64 data_size =
Common::AlignUp(partitions[i].partition.GetDataSize(), VolumeWii::BLOCK_DATA_SIZE);
partitions[i].partition.SetDataSize(data_size);
const u64 encrypted_data_size =
(data_size / VolumeWii::BLOCK_DATA_SIZE) * VolumeWii::BLOCK_TOTAL_SIZE;
const u64 partition_data_offset = partition_address + PARTITION_DATA_OFFSET;
m_partitions.emplace(partition_data_offset, std::move(partitions[i].partition));
m_nonpartition_contents.Add(partition_data_offset, data_size,
m_nonpartition_contents.Add(partition_data_offset, encrypted_data_size,
ContentPartition{this, 0, partition_data_offset});
const u64 unaligned_next_partition_address = VolumeWii::OffsetInHashedPartitionToRawOffset(
data_size, Partition(partition_address), PARTITION_DATA_OFFSET);

View File

@ -204,6 +204,7 @@ public:
bool IsWii() const { return m_is_wii; }
u64 GetDataSize() const { return m_data_size; }
void SetDataSize(u64 size) { m_data_size = size; }
const std::string& GetRootDirectory() const { return m_root_directory; }
const std::vector<u8>& GetHeader() const { return m_disc_header; }
const DiscContentContainer& GetContents() const { return m_contents; }