summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DiscIO/Blob.h2
-rw-r--r--Source/Core/DiscIO/DirectoryBlob.cpp8
-rw-r--r--Source/Core/DiscIO/DirectoryBlob.h2
-rw-r--r--Source/Core/DiscIO/VolumeWii.cpp9
4 files changed, 13 insertions, 8 deletions
diff --git a/Source/Core/DiscIO/Blob.h b/Source/Core/DiscIO/Blob.h
index 3c4ea03307..52b083ab63 100644
--- a/Source/Core/DiscIO/Blob.h
+++ b/Source/Core/DiscIO/Blob.h
@@ -58,7 +58,7 @@ public:
}
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;
}
diff --git a/Source/Core/DiscIO/DirectoryBlob.cpp b/Source/Core/DiscIO/DirectoryBlob.cpp
index 3df7b44256..64d4497925 100644
--- a/Source/Core/DiscIO/DirectoryBlob.cpp
+++ b/Source/Core/DiscIO/DirectoryBlob.cpp
@@ -387,12 +387,13 @@ bool DirectoryBlobReader::SupportsReadWiiDecrypted() const
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)
return false;
- auto it = m_partitions.find(partition_offset);
+ auto it = m_partitions.find(partition_data_offset);
if (it == m_partitions.end())
return false;
@@ -514,7 +515,8 @@ void DirectoryBlobReader::SetPartitions(std::vector<PartitionWithType>&& partiti
SetPartitionHeader(partitions[i].partition, partition_address);
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(
partition_data_size, Partition(partition_address), PARTITION_DATA_OFFSET);
partition_address = Common::AlignUp(unaligned_next_partition_address, 0x10000ull);
diff --git a/Source/Core/DiscIO/DirectoryBlob.h b/Source/Core/DiscIO/DirectoryBlob.h
index 0b15c3f807..47e0a6e0c8 100644
--- a/Source/Core/DiscIO/DirectoryBlob.h
+++ b/Source/Core/DiscIO/DirectoryBlob.h
@@ -141,7 +141,7 @@ public:
bool Read(u64 offset, u64 length, u8* buffer) 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;
u64 GetRawSize() const override;
diff --git a/Source/Core/DiscIO/VolumeWii.cpp b/Source/Core/DiscIO/VolumeWii.cpp
index d2a1fba3db..970f3ad7e5 100644
--- a/Source/Core/DiscIO/VolumeWii.cpp
+++ b/Source/Core/DiscIO/VolumeWii.cpp
@@ -162,14 +162,17 @@ bool VolumeWii::Read(u64 offset, u64 length, u8* buffer, const Partition& partit
if (partition == PARTITION_NONE)
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);
if (it == m_partitions.end())
return false;
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)
{
return m_reader->Read(partition.offset + *partition_details.data_offset + offset, length,