From 970bd7c2a366dd758e9db5dd627b902999fd14f1 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 24 Oct 2026 14:39:49 +0000 Subject: [PATCH] Decompile fn_20421 (ConnectionBuffer::Available) Batch #93 by ragnarok-clanker: 1 byte-identical, 0 confirmed by peer review. - fn_20421 ConnectionBuffer::Available: byte-identical Merged automatically: every function is byte-identical to the original. --- Source/Network/ConnectionBuffer.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Source/Network/ConnectionBuffer.cpp b/Source/Network/ConnectionBuffer.cpp index 8dd555c..e6c939f 100644 --- a/Source/Network/ConnectionBuffer.cpp +++ b/Source/Network/ConnectionBuffer.cpp @@ -8,9 +8,6 @@ namespace { int Add(int left, int right) { return std::bit_cast(static_cast(left) + static_cast(right)); } - int Subtract(int left, int right) { - return std::bit_cast(static_cast(left) - static_cast(right)); - } } // OFFSET: 0x00C7EF60 @@ -33,7 +30,7 @@ void ConnectionBuffer::Reset(unsigned bytes) { // OFFSET: 0x00C7F050 // FUNCTION: fn_20421 int ConnectionBuffer::Available() const { - return Subtract(this->m_write, this->m_read); + return this->m_write - this->m_read; } // OFFSET: 0x00C7F0E0 @@ -85,7 +82,7 @@ bool ConnectionBuffer::Read(int bytes, void* destination) { // OFFSET: 0x00C7F2B0 // FUNCTION: fn_20425 bool ConnectionBuffer::Peek(int bytes, void* destination) const { - if (this->Available() < bytes) { + if (this->m_write - this->m_read < bytes) { return false; } std::memcpy(destination, this->m_data + this->m_read, bytes); @@ -95,9 +92,9 @@ bool ConnectionBuffer::Peek(int bytes, void* destination) const { // OFFSET: 0x00C7F2E0 // FUNCTION: fn_20426 bool ConnectionBuffer::Consume(int bytes) { - if (this->Available() < bytes) { + if (this->m_write - this->m_read < bytes) { return false; } - this->m_read = Add(this->m_read, bytes); + this->m_read += bytes; return true; }