Write null memory at end of t6 fastfiles like the original linker does because the game's reader needs it for some reason

This commit is contained in:
Jan
2021-03-22 09:49:42 +01:00
parent d99eb0ab24
commit 1058ee7881
8 changed files with 91 additions and 10 deletions

View File

@ -0,0 +1,17 @@
#include "StepAlign.h"
StepAlign::StepAlign(const size_t alignTo, const uint8_t alignValue)
: m_align_to(alignTo),
m_align_value(alignValue)
{
}
void StepAlign::PerformStep(ZoneWriter* zoneWriter, IWritingStream* stream)
{
const auto pos = stream->Pos();
const auto targetPos = (pos + m_align_to - 1) / m_align_to * m_align_to;
const auto valueCount = static_cast<size_t>(targetPos - pos);
for(auto i = 0u; i < valueCount; i++)
stream->Write(&m_align_value, sizeof(m_align_value));
}