From 62d686e626ec959456d1d59a0c850794cac4b8e0 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 14:50:54 +0000 Subject: [PATCH] Decompile fn_20424 (CPacketQueue::Prepend) Batch #12265 by cremane: 0 byte-identical, 1 confirmed by peer review. - fn_20424 CPacketQueue::Prepend: logic confirmed by peer review Peer-reviewed-by: Yommy, Tanke, dori Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Network/Connection/PacketQueue.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Network/Connection/PacketQueue.cpp b/Source/Network/Connection/PacketQueue.cpp index 4206d4474..c0c48f538 100644 --- a/Source/Network/Connection/PacketQueue.cpp +++ b/Source/Network/Connection/PacketQueue.cpp @@ -50,13 +50,13 @@ void CPacketQueue::InsertData(int bytes, const void* source) { // OFFSET: 0x00C7F160 // FUNCTION: fn_20424 void CPacketQueue::Prepend(int bytes, const void* source) { - const int available = this->GetSize(); - const int required = (bytes + available); - std::vector storage(static_cast(std::max(required, static_cast(this->m_storage.size())))); + std::vector storage; + storage.resize(std::max(static_cast(this->m_storage.size()), this->GetSize() + bytes)); std::memcpy(storage.data(), source, bytes); - std::memcpy(storage.data() + bytes, this->m_data + this->m_read, available); - this->m_write = required; + std::memcpy(storage.data() + bytes, this->m_data + this->m_read, this->GetSize()); + this->m_write = this->GetSize() + bytes; this->m_read = 0; + this->m_storage.swap(storage); this->m_data = this->m_storage.data(); }