diff options
| author | Lioncash <mathew1800@gmail.com> | 2015-12-19 17:52:10 -0500 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2015-12-19 18:00:44 -0500 |
| commit | cbeb7034eb68a5285535b263ea661fa0e4362590 (patch) | |
| tree | b2d3fe6fe285f79fa35f46fbdc408da8a146680c /Source/Core/DiscIO | |
| parent | e638775bc79b1e5da24dce7892bc1c22db400174 (diff) | |
Volume: Make GetTMD return a vector
Diffstat (limited to 'Source/Core/DiscIO')
| -rw-r--r-- | Source/Core/DiscIO/Volume.h | 7 | ||||
| -rw-r--r-- | Source/Core/DiscIO/VolumeWiiCrypted.cpp | 11 | ||||
| -rw-r--r-- | Source/Core/DiscIO/VolumeWiiCrypted.h | 3 |
3 files changed, 8 insertions, 13 deletions
diff --git a/Source/Core/DiscIO/Volume.h b/Source/Core/DiscIO/Volume.h index 16ef5fddd3..0b7edf61fb 100644 --- a/Source/Core/DiscIO/Volume.h +++ b/Source/Core/DiscIO/Volume.h @@ -6,7 +6,6 @@ #include <cstring> #include <map> -#include <memory> #include <string> #include <vector> @@ -82,11 +81,7 @@ public: } virtual bool GetTitleID(u64*) const { return false; } - virtual std::unique_ptr<u8[]> GetTMD(u32 *_sz) const - { - *_sz = 0; - return std::unique_ptr<u8[]>(); - } + virtual std::vector<u8> GetTMD() const { return {}; } virtual std::string GetUniqueID() const = 0; virtual std::string GetMakerID() const = 0; virtual u16 GetRevision() const = 0; diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.cpp b/Source/Core/DiscIO/VolumeWiiCrypted.cpp index 660dfb1e1e..16747f8782 100644 --- a/Source/Core/DiscIO/VolumeWiiCrypted.cpp +++ b/Source/Core/DiscIO/VolumeWiiCrypted.cpp @@ -115,9 +115,8 @@ bool CVolumeWiiCrypted::GetTitleID(u64* buffer) const return true; } -std::unique_ptr<u8[]> CVolumeWiiCrypted::GetTMD(u32 *size) const +std::vector<u8> CVolumeWiiCrypted::GetTMD() const { - *size = 0; u32 tmd_size; u32 tmd_address; @@ -136,10 +135,10 @@ std::unique_ptr<u8[]> CVolumeWiiCrypted::GetTMD(u32 *size) const tmd_size = 1024 * 1024 * 4; } - std::unique_ptr<u8[]> buf{ new u8[tmd_size] }; - Read(m_VolumeOffset + tmd_address, tmd_size, buf.get(), false); - *size = tmd_size; - return buf; + std::vector<u8> buffer(tmd_size); + Read(m_VolumeOffset + tmd_address, tmd_size, buffer.data(), false); + + return buffer; } std::string CVolumeWiiCrypted::GetUniqueID() const diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.h b/Source/Core/DiscIO/VolumeWiiCrypted.h index 84420baf5a..8e0b2d88f8 100644 --- a/Source/Core/DiscIO/VolumeWiiCrypted.h +++ b/Source/Core/DiscIO/VolumeWiiCrypted.h @@ -7,6 +7,7 @@ #include <map> #include <memory> #include <string> +#include <vector> #include <mbedtls/aes.h> #include "Common/CommonTypes.h" @@ -25,7 +26,7 @@ public: ~CVolumeWiiCrypted(); bool Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) const override; bool GetTitleID(u64* buffer) const override; - std::unique_ptr<u8[]> GetTMD(u32 *_sz) const override; + std::vector<u8> GetTMD() const override; std::string GetUniqueID() const override; std::string GetMakerID() const override; u16 GetRevision() const override; |
