diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2016-11-27 11:56:22 +0100 |
|---|---|---|
| committer | Léo Lam <leo@innovatetechnologi.es> | 2016-12-06 20:33:53 +0100 |
| commit | 31ccfffd386cdf7bfafdccda240a179431ecc98c (patch) | |
| tree | 820bdb640091e5726e4c52d42f819956f82bfd28 /Source/Core/DiscIO/VolumeWad.cpp | |
| parent | 7192789c1162e2deb5923151d05158f459448ab9 (diff) | |
Common: Add alignment header
Gets rid of duplicated alignment code.
Diffstat (limited to 'Source/Core/DiscIO/VolumeWad.cpp')
| -rw-r--r-- | Source/Core/DiscIO/VolumeWad.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp index 158be3dbca..3254190be9 100644 --- a/Source/Core/DiscIO/VolumeWad.cpp +++ b/Source/Core/DiscIO/VolumeWad.cpp @@ -10,9 +10,9 @@ #include <utility> #include <vector> +#include "Common/Align.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" -#include "Common/MathUtil.h" #include "Common/MsgHandler.h" #include "Common/StringUtil.h" #include "DiscIO/Blob.h" @@ -20,8 +20,6 @@ #include "DiscIO/Volume.h" #include "DiscIO/VolumeWad.h" -#define ALIGN_40(x) ROUND_UP(Common::swap32(x), 0x40) - namespace DiscIO { CVolumeWAD::CVolumeWAD(std::unique_ptr<IBlobReader> reader) @@ -35,9 +33,13 @@ CVolumeWAD::CVolumeWAD(std::unique_ptr<IBlobReader> reader) Read(0x14, 4, (u8*)&m_tmd_size); Read(0x18, 4, (u8*)&m_data_size); - m_offset = ALIGN_40(m_hdr_size) + ALIGN_40(m_cert_size); - m_tmd_offset = ALIGN_40(m_hdr_size) + ALIGN_40(m_cert_size) + ALIGN_40(m_tick_size); - m_opening_bnr_offset = m_tmd_offset + ALIGN_40(m_tmd_size) + ALIGN_40(m_data_size); + m_offset = Common::AlignUp(Common::swap32(m_hdr_size), 0x40) + + Common::AlignUp(Common::swap32(m_cert_size), 0x40); + m_tmd_offset = Common::AlignUp(Common::swap32(m_hdr_size), 0x40) + + Common::AlignUp(Common::swap32(m_cert_size), 0x40) + + Common::AlignUp(Common::swap32(m_tick_size), 0x40); + m_opening_bnr_offset = m_tmd_offset + Common::AlignUp(Common::swap32(m_tmd_size), 0x40) + + Common::AlignUp(Common::swap32(m_data_size), 0x40); } CVolumeWAD::~CVolumeWAD() |
