refactor(Minecraft.World): Implement LCEMP changes.

This commit is contained in:
2026-07-13 00:14:53 +03:00
parent 3fce0538c5
commit 21e2add09a
64 changed files with 655 additions and 372 deletions
+21 -12
View File
@@ -49,18 +49,27 @@ void ByteArrayOutputStream::write(byteArray b)
//b - the data.
//off - the start offset in the data.
//len - the number of bytes to write.
void ByteArrayOutputStream::write(byteArray b, unsigned int offset, unsigned int length)
{
assert( b.length >= offset + length );
// If we will fill the buffer we need to make it bigger
if( count + length >= buf.length )
buf.resize( max( count + length + 1, buf.length * 2 ) );
XMemCpy( &buf[count], &b[offset], length );
//std::copy( b->data+offset, b->data+offset+length, buf->data + count ); // Or this instead?
count += length;
void ByteArrayOutputStream::write(byteArray b, unsigned int offset, unsigned int length)
{
if (offset > b.length || length > b.length - offset)
return;
if (length > 0xFFFFFFFF - count)
return;
// If we will fill the buffer we need to make it bigger
if( count + length >= buf.length )
{
unsigned int newSize = (std::max)( count + length + 1, buf.length * 2 );
if( newSize <= buf.length )
return;
buf.resize( newSize );
}
XMemCpy( &buf[count], &b[offset], length );
count += length;
}
//Closing a ByteArrayOutputStream has no effect.