Common: Add alignment header

Gets rid of duplicated alignment code.
This commit is contained in:
Léo Lam
2016-11-27 11:56:22 +01:00
parent 7192789c11
commit 31ccfffd38
32 changed files with 146 additions and 119 deletions

View File

@ -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()