diff options
| author | Tilka <tilkax@gmail.com> | 2020-06-21 11:40:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-21 11:40:58 +0100 |
| commit | 99822518994d62def4e336f6746d6a2e2d108fb2 (patch) | |
| tree | 3c3ba54bb6df32a32fa72de0b9e46e09b36b14ff /Source/Core/DiscIO/WiiEncryptionCache.cpp | |
| parent | 03e0d2c820a8aed809799e86321024244aa6791a (diff) | |
| parent | 660d81a10b4a8ff9a61631e69fb93e9010bccbc0 (diff) | |
Merge pull request #8538 from JosJuice/wia
Add support for the WIA and RVZ disc image formats
Diffstat (limited to 'Source/Core/DiscIO/WiiEncryptionCache.cpp')
| -rw-r--r-- | Source/Core/DiscIO/WiiEncryptionCache.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/Source/Core/DiscIO/WiiEncryptionCache.cpp b/Source/Core/DiscIO/WiiEncryptionCache.cpp index c5a2111daa..0bb892da71 100644 --- a/Source/Core/DiscIO/WiiEncryptionCache.cpp +++ b/Source/Core/DiscIO/WiiEncryptionCache.cpp @@ -24,7 +24,8 @@ WiiEncryptionCache::~WiiEncryptionCache() = default; const std::array<u8, VolumeWii::GROUP_TOTAL_SIZE>* WiiEncryptionCache::EncryptGroup(u64 offset, u64 partition_data_offset, - u64 partition_data_decrypted_size, const Key& key) + u64 partition_data_decrypted_size, const Key& key, + const HashExceptionCallback& hash_exception_callback) { // Only allocate memory if this function actually ends up getting called if (!m_cache) @@ -40,8 +41,20 @@ WiiEncryptionCache::EncryptGroup(u64 offset, u64 partition_data_offset, if (m_cached_offset != group_offset_on_disc) { + std::function<void(VolumeWii::HashBlock * hash_blocks)> hash_exception_callback_2; + + if (hash_exception_callback) + { + hash_exception_callback_2 = + [offset, &hash_exception_callback]( + VolumeWii::HashBlock hash_blocks[VolumeWii::BLOCKS_PER_GROUP]) { + return hash_exception_callback(hash_blocks, offset); + }; + } + if (!VolumeWii::EncryptGroup(group_offset_in_partition, partition_data_offset, - partition_data_decrypted_size, key, m_blob, m_cache.get())) + partition_data_decrypted_size, key, m_blob, m_cache.get(), + hash_exception_callback_2)) { m_cached_offset = std::numeric_limits<u64>::max(); // Invalidate the cache return nullptr; @@ -54,13 +67,14 @@ WiiEncryptionCache::EncryptGroup(u64 offset, u64 partition_data_offset, } bool WiiEncryptionCache::EncryptGroups(u64 offset, u64 size, u8* out_ptr, u64 partition_data_offset, - u64 partition_data_decrypted_size, const Key& key) + u64 partition_data_decrypted_size, const Key& key, + const HashExceptionCallback& hash_exception_callback) { while (size > 0) { const std::array<u8, VolumeWii::GROUP_TOTAL_SIZE>* group = EncryptGroup(Common::AlignDown(offset, VolumeWii::GROUP_TOTAL_SIZE), partition_data_offset, - partition_data_decrypted_size, key); + partition_data_decrypted_size, key, hash_exception_callback); if (!group) return false; |
