VolumeWii: Check SupportsReadWiiDecrypted before m_encrypted

Fixes using DirectoryBlob on extracted games that were unencrypted
prior to being extracted.

(One day I'll make DirectoryBlob actually support raw reads and then
the order of these two won't matter...)
This commit is contained in:
JosJuice 2019-11-26 18:57:44 +01:00
parent 70ee5234ba
commit 23fc5f9e35
1 changed files with 3 additions and 3 deletions

View File

@ -162,6 +162,9 @@ 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;
@ -173,9 +176,6 @@ bool VolumeWii::Read(u64 offset, u64 length, u8* buffer, const Partition& partit
buffer); buffer);
} }
if (m_reader->SupportsReadWiiDecrypted())
return m_reader->ReadWiiDecrypted(offset, length, buffer, partition.offset);
mbedtls_aes_context* aes_context = partition_details.key->get(); mbedtls_aes_context* aes_context = partition_details.key->get();
if (!aes_context) if (!aes_context)
return false; return false;