diff --git a/Include/Aurora/Memory/ByteBuffer.hpp b/Include/Aurora/Memory/ByteBuffer.hpp index 9e95ae37..56b36378 100644 --- a/Include/Aurora/Memory/ByteBuffer.hpp +++ b/Include/Aurora/Memory/ByteBuffer.hpp @@ -125,6 +125,8 @@ namespace Aurora::Memory inline ByteBuffer(const MemoryViewRead &readView, bool circular = false, bool expandable = false); + inline ByteBuffer(const MemoryViewRead &readView, AuUInt uAlignment, bool circular = false, bool expandable = false); + inline ByteBuffer(const AuList &vector, bool circular = false, bool expandable = false); inline ByteBuffer(AuUInt length, bool circular = false, bool expandable = false); diff --git a/Include/Aurora/Memory/ByteBuffer_Memory.inl b/Include/Aurora/Memory/ByteBuffer_Memory.inl index 15fad3e0..0462e7b0 100644 --- a/Include/Aurora/Memory/ByteBuffer_Memory.inl +++ b/Include/Aurora/Memory/ByteBuffer_Memory.inl @@ -297,13 +297,12 @@ namespace Aurora::Memory } } - ByteBuffer replacement(length, (bool)this->flagCircular, (bool)this->flagExpandable); + ByteBuffer replacement(length, this->alignment, (bool)this->flagCircular, (bool)this->flagExpandable); if (!replacement) { return false; } replacement.flagAlwaysExpandable = this->flagAlwaysExpandable; - replacement.alignment = this->alignment; AuUInt uBytesRem {}; if (!this->flagCircular && length < (uBytesRem = this->RemainingBytes())) diff --git a/Include/Aurora/Memory/ByteBuffer_Utils.inl b/Include/Aurora/Memory/ByteBuffer_Utils.inl index 6ed47b28..ad70be0d 100644 --- a/Include/Aurora/Memory/ByteBuffer_Utils.inl +++ b/Include/Aurora/Memory/ByteBuffer_Utils.inl @@ -312,7 +312,30 @@ namespace Aurora::Memory this->writePtr = this->readPtr + this->length; AuMemcpy(this->base, vector.data(), this->length); } - + + ByteBuffer::ByteBuffer(const MemoryViewRead &readView, AuUInt uAlignment, bool circular, bool expandable) : + flagCircular(circular), flagExpandable(expandable), flagReadError(0), flagWriteError(0) + { + this->scaleSize = kBufferInitialPower; + if (!length) + { + Reset(); + return; + } + this->base = ZAlloc(length, alignment); + this->alignment = uAlignment; + if (!this->base) + { + Reset(); + return; + } + this->length = length; + this->allocSize = length; + this->readPtr = this->base; + this->writePtr = this->readPtr + this->length; + AuMemcpy(this->base, readView.Begin(), length); + } + ByteBuffer::ByteBuffer(AuUInt length, bool circular, bool expandable) : flagCircular(circular), flagExpandable(expandable), flagReadError(0), flagWriteError(0) {