From 31ccfffd386cdf7bfafdccda240a179431ecc98c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sun, 27 Nov 2016 11:56:22 +0100 Subject: Common: Add alignment header Gets rid of duplicated alignment code. --- Source/Core/DiscIO/VolumeWad.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Source/Core/DiscIO/VolumeWad.cpp') 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 #include +#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 reader) @@ -35,9 +33,13 @@ CVolumeWAD::CVolumeWAD(std::unique_ptr 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() -- cgit v1.2.3