Merge pull request #9166 from JosJuice/encryption-cache-move
DiscIO: Make WiiEncryptionCache moveable
This commit is contained in:
commit
b2709b81a0
|
@ -29,7 +29,10 @@ WiiEncryptionCache::EncryptGroup(u64 offset, u64 partition_data_offset,
|
||||||
{
|
{
|
||||||
// Only allocate memory if this function actually ends up getting called
|
// Only allocate memory if this function actually ends up getting called
|
||||||
if (!m_cache)
|
if (!m_cache)
|
||||||
|
{
|
||||||
m_cache = std::make_unique<std::array<u8, VolumeWii::GROUP_TOTAL_SIZE>>();
|
m_cache = std::make_unique<std::array<u8, VolumeWii::GROUP_TOTAL_SIZE>>();
|
||||||
|
m_cached_offset = std::numeric_limits<u64>::max();
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT(offset % VolumeWii::GROUP_TOTAL_SIZE == 0);
|
ASSERT(offset % VolumeWii::GROUP_TOTAL_SIZE == 0);
|
||||||
const u64 group_offset_in_partition =
|
const u64 group_offset_in_partition =
|
||||||
|
|
|
@ -26,6 +26,14 @@ public:
|
||||||
explicit WiiEncryptionCache(BlobReader* blob);
|
explicit WiiEncryptionCache(BlobReader* blob);
|
||||||
~WiiEncryptionCache();
|
~WiiEncryptionCache();
|
||||||
|
|
||||||
|
WiiEncryptionCache(WiiEncryptionCache&&) = default;
|
||||||
|
WiiEncryptionCache& operator=(WiiEncryptionCache&&) = default;
|
||||||
|
|
||||||
|
// It would be possible to write a custom copy constructor and assignment operator
|
||||||
|
// for this class, but there has been no reason to do so.
|
||||||
|
WiiEncryptionCache(const WiiEncryptionCache&) = delete;
|
||||||
|
WiiEncryptionCache& operator=(const WiiEncryptionCache&) = delete;
|
||||||
|
|
||||||
// Encrypts exactly one group.
|
// Encrypts exactly one group.
|
||||||
// If the returned pointer is nullptr, reading from the blob failed.
|
// 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
|
// If the returned pointer is not nullptr, it is guaranteed to be valid until
|
||||||
|
@ -43,7 +51,7 @@ public:
|
||||||
private:
|
private:
|
||||||
BlobReader* m_blob;
|
BlobReader* m_blob;
|
||||||
std::unique_ptr<std::array<u8, VolumeWii::GROUP_TOTAL_SIZE>> m_cache;
|
std::unique_ptr<std::array<u8, VolumeWii::GROUP_TOTAL_SIZE>> m_cache;
|
||||||
u64 m_cached_offset = std::numeric_limits<u64>::max();
|
u64 m_cached_offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace DiscIO
|
} // namespace DiscIO
|
||||||
|
|
Loading…
Reference in New Issue