diff options
| author | Sepalani <sepalani@hotmail.fr> | 2016-01-02 00:33:14 +0400 |
|---|---|---|
| committer | Sepalani <sepalani@hotmail.fr> | 2016-01-03 13:17:26 +0100 |
| commit | ba794272f5f6b5a07537ecfacb414c71fdc46b0e (patch) | |
| tree | edd68fb00045b638625d5fe494a02713cdce7778 /Source/Core/DiscIO/NANDContentLoader.cpp | |
| parent | b4e9bbb5516070fbed6fe49b90b00136f8e6f7e8 (diff) | |
Debug Builds: Fixed vector assertion
Diffstat (limited to 'Source/Core/DiscIO/NANDContentLoader.cpp')
| -rw-r--r-- | Source/Core/DiscIO/NANDContentLoader.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/Core/DiscIO/NANDContentLoader.cpp b/Source/Core/DiscIO/NANDContentLoader.cpp index 870cd957fb..e2bfe425c7 100644 --- a/Source/Core/DiscIO/NANDContentLoader.cpp +++ b/Source/Core/DiscIO/NANDContentLoader.cpp @@ -14,6 +14,7 @@ #include <vector> #include <mbedtls/aes.h> +#include "Common/CommonFuncs.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/MathUtil.h" @@ -190,8 +191,14 @@ void CNANDContentLoader::InitializeContentEntries(const std::vector<u8>& tmd, co content.m_Index = Common::swap16(&tmd[entry_offset + 0x01E8]); content.m_Type = Common::swap16(&tmd[entry_offset + 0x01EA]); content.m_Size = static_cast<u32>(Common::swap64(&tmd[entry_offset + 0x01EC])); - std::copy(&tmd[entry_offset + 0x01E4], &tmd[entry_offset + 0x01E4 + 36], content.m_Header); - std::copy(&tmd[entry_offset + 0x01F4], &tmd[entry_offset + 0x01F4 + 20], content.m_SHA1Hash); + + const auto header_begin = std::next(tmd.begin(), entry_offset + 0x01E4); + const auto header_end = std::next(header_begin, ArraySize(content.m_Header)); + std::copy(header_begin, header_end, content.m_Header); + + const auto hash_begin = std::next(tmd.begin(), entry_offset + 0x01F4); + const auto hash_end = std::next(hash_begin, ArraySize(content.m_SHA1Hash)); + std::copy(hash_begin, hash_end, content.m_SHA1Hash); if (m_isWAD) { |
