From 33754f40aa0ebc5de2663b79a9ecf1a2350112b7 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Thu, 22 Dec 2016 02:00:09 +0100 Subject: [PATCH] [Stream] Reimplement the correct stream writing (thx @TheApadayo) --- src/Utils/Stream.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Utils/Stream.cpp b/src/Utils/Stream.cpp index 9f8bd08b..64edd840 100644 --- a/src/Utils/Stream.cpp +++ b/src/Utils/Stream.cpp @@ -96,9 +96,15 @@ namespace Utils char* Stream::save(Game::XFILE_BLOCK_TYPES stream, const void * _str, size_t size, size_t count) { - //if (stream == XFILE_BLOCK_TEMP || stream == XFILE_BLOCK_VIRTUAL || stream == XFILE_BLOCK_PHYSICAL) // Only those seem to actually write data. - // As I'm not sure though, I'll still write the data - // Use IncreaseBlockSize to fill virtual streams + // Only those seem to actually write data. + // As I'm not sure though, I'll still write the data + // Use IncreaseBlockSize to fill virtual streams + if (stream != Game::XFILE_BLOCK_TEMP && stream != Game::XFILE_BLOCK_VIRTUAL && stream != Game::XFILE_BLOCK_PHYSICAL) + { + this->increaseBlockSize(stream, size * count); + return this->at(); + } + auto data = this->data(); if (this->isCriticalSection() && this->length() + (size * count) > this->capacity())