WIA: Make use of the exception lists

This commit is contained in:
JosJuice
2020-01-27 16:12:56 +01:00
parent 47067f661a
commit 791e363c9a
6 changed files with 93 additions and 15 deletions

View File

@ -19,6 +19,8 @@ class WiiEncryptionCache
{
public:
using Key = std::array<u8, VolumeWii::AES_KEY_SIZE>;
using HashExceptionCallback = std::function<void(
VolumeWii::HashBlock hash_blocks[VolumeWii::BLOCKS_PER_GROUP], u64 offset)>;
// The blob pointer is kept around for the lifetime of this object.
explicit WiiEncryptionCache(BlobReader* blob);
@ -28,15 +30,15 @@ public:
// If the returned pointer is nullptr, reading from the blob failed.
// If the returned pointer is not nullptr, it is guaranteed to be valid until
// the next call of this function or the destruction of this object.
const std::array<u8, VolumeWii::GROUP_TOTAL_SIZE>* EncryptGroup(u64 offset,
u64 partition_data_offset,
u64 partition_data_decrypted_size,
const Key& key);
const std::array<u8, VolumeWii::GROUP_TOTAL_SIZE>*
EncryptGroup(u64 offset, u64 partition_data_offset, u64 partition_data_decrypted_size,
const Key& key, const HashExceptionCallback& hash_exception_callback = {});
// Encrypts a variable number of groups, as determined by the offset and size parameters.
// Supports reading groups partially.
bool 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 = {});
private:
BlobReader* m_blob;