diff --git a/Include/Aurora/Memory/ByteBuffer.hpp b/Include/Aurora/Memory/ByteBuffer.hpp index 56b36378..56c04248 100644 --- a/Include/Aurora/Memory/ByteBuffer.hpp +++ b/Include/Aurora/Memory/ByteBuffer.hpp @@ -397,7 +397,7 @@ namespace Aurora::Memory // Utilities inline bool Trim(AuUInt tail); - inline bool Pad(AuUInt16 aPowOf2, AuUInt8 magicCharacter = '\x00'); + inline bool Pad(AuUInt16 aPowOf2, AuUInt8 magicCharacter = '\x00', bool bUpdateWriteHead = true); inline bool Fill(AuUInt length, AuUInt8 magicCharacter = '\x00'); // Templated read/write for **PODs** diff --git a/Include/Aurora/Memory/ByteBuffer_Utility.inl b/Include/Aurora/Memory/ByteBuffer_Utility.inl index a14cc0f6..abf0d1c8 100644 --- a/Include/Aurora/Memory/ByteBuffer_Utility.inl +++ b/Include/Aurora/Memory/ByteBuffer_Utility.inl @@ -67,7 +67,7 @@ namespace Aurora::Memory return true; } - bool ByteBuffer::Pad(AuUInt16 aPowOf2, AuUInt8 magicCharacter) + bool ByteBuffer::Pad(AuUInt16 aPowOf2, AuUInt8 magicCharacter, bool bUpdateWriteHead) { ByteBufferPushWriteState a(*this); @@ -85,7 +85,14 @@ namespace Aurora::Memory return false; } - this->writePtr = this->base + length; + if (bUpdateWriteHead) + { + this->writePtr = this->base + newLen; + } + else + { + this->writePtr = this->base + length; + } return true; } } \ No newline at end of file