mirror of
https://github.com/Retropex/dolphin.git
synced 2025-05-29 21:42:31 +02:00
DiscIO: Use partition data offset for ReadWiiDecrypted parameter
Instead of the partition offset (which is usually 0x20000 less).
This commit is contained in:
parent
7e94d6ed37
commit
a4c7100bcc
@ -58,7 +58,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual bool SupportsReadWiiDecrypted() const { return false; }
|
virtual bool SupportsReadWiiDecrypted() const { return false; }
|
||||||
virtual bool ReadWiiDecrypted(u64 offset, u64 size, u8* out_ptr, u64 partition_offset)
|
virtual bool ReadWiiDecrypted(u64 offset, u64 size, u8* out_ptr, u64 partition_data_offset)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -387,12 +387,13 @@ bool DirectoryBlobReader::SupportsReadWiiDecrypted() const
|
|||||||
return m_is_wii;
|
return m_is_wii;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DirectoryBlobReader::ReadWiiDecrypted(u64 offset, u64 size, u8* buffer, u64 partition_offset)
|
bool DirectoryBlobReader::ReadWiiDecrypted(u64 offset, u64 size, u8* buffer,
|
||||||
|
u64 partition_data_offset)
|
||||||
{
|
{
|
||||||
if (!m_is_wii)
|
if (!m_is_wii)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto it = m_partitions.find(partition_offset);
|
auto it = m_partitions.find(partition_data_offset);
|
||||||
if (it == m_partitions.end())
|
if (it == m_partitions.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -514,7 +515,8 @@ void DirectoryBlobReader::SetPartitions(std::vector<PartitionWithType>&& partiti
|
|||||||
SetPartitionHeader(partitions[i].partition, partition_address);
|
SetPartitionHeader(partitions[i].partition, partition_address);
|
||||||
|
|
||||||
const u64 partition_data_size = partitions[i].partition.GetDataSize();
|
const u64 partition_data_size = partitions[i].partition.GetDataSize();
|
||||||
m_partitions.emplace(partition_address, std::move(partitions[i].partition));
|
m_partitions.emplace(partition_address + PARTITION_DATA_OFFSET,
|
||||||
|
std::move(partitions[i].partition));
|
||||||
const u64 unaligned_next_partition_address = VolumeWii::EncryptedPartitionOffsetToRawOffset(
|
const u64 unaligned_next_partition_address = VolumeWii::EncryptedPartitionOffsetToRawOffset(
|
||||||
partition_data_size, Partition(partition_address), PARTITION_DATA_OFFSET);
|
partition_data_size, Partition(partition_address), PARTITION_DATA_OFFSET);
|
||||||
partition_address = Common::AlignUp(unaligned_next_partition_address, 0x10000ull);
|
partition_address = Common::AlignUp(unaligned_next_partition_address, 0x10000ull);
|
||||||
|
@ -141,7 +141,7 @@ public:
|
|||||||
|
|
||||||
bool Read(u64 offset, u64 length, u8* buffer) override;
|
bool Read(u64 offset, u64 length, u8* buffer) override;
|
||||||
bool SupportsReadWiiDecrypted() const override;
|
bool SupportsReadWiiDecrypted() const override;
|
||||||
bool ReadWiiDecrypted(u64 offset, u64 size, u8* buffer, u64 partition_offset) override;
|
bool ReadWiiDecrypted(u64 offset, u64 size, u8* buffer, u64 partition_data_offset) override;
|
||||||
|
|
||||||
BlobType GetBlobType() const override;
|
BlobType GetBlobType() const override;
|
||||||
u64 GetRawSize() const override;
|
u64 GetRawSize() const override;
|
||||||
|
@ -162,14 +162,17 @@ bool VolumeWii::Read(u64 offset, u64 length, u8* buffer, const Partition& partit
|
|||||||
if (partition == PARTITION_NONE)
|
if (partition == PARTITION_NONE)
|
||||||
return m_reader->Read(offset, length, buffer);
|
return m_reader->Read(offset, length, buffer);
|
||||||
|
|
||||||
if (m_reader->SupportsReadWiiDecrypted())
|
|
||||||
return m_reader->ReadWiiDecrypted(offset, length, buffer, partition.offset);
|
|
||||||
|
|
||||||
auto it = m_partitions.find(partition);
|
auto it = m_partitions.find(partition);
|
||||||
if (it == m_partitions.end())
|
if (it == m_partitions.end())
|
||||||
return false;
|
return false;
|
||||||
const PartitionDetails& partition_details = it->second;
|
const PartitionDetails& partition_details = it->second;
|
||||||
|
|
||||||
|
if (m_reader->SupportsReadWiiDecrypted())
|
||||||
|
{
|
||||||
|
return m_reader->ReadWiiDecrypted(offset, length, buffer,
|
||||||
|
partition.offset + *partition_details.data_offset);
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_encrypted)
|
if (!m_encrypted)
|
||||||
{
|
{
|
||||||
return m_reader->Read(partition.offset + *partition_details.data_offset + offset, length,
|
return m_reader->Read(partition.offset + *partition_details.data_offset + offset, length,
|
||||||
|
Loading…
Reference in New Issue
Block a user