Change LUBitstream to make more sense and only read what it needs from the bitstream at each level

This commit is contained in:
Aaron Kimbrell
2025-09-12 22:25:55 -05:00
parent b36b440eba
commit 500a72dc11
16 changed files with 217 additions and 101 deletions

View File

@@ -6,18 +6,12 @@
void LUBitStream::WriteHeader(RakNet::BitStream& bitStream) const {
bitStream.Write<MessageID>(ID_USER_PACKET_ENUM);
bitStream.Write(this->connectionType);
bitStream.Write(this->internalPacketID);
bitStream.Write<uint8_t>(0); // padding
bitStream.Write(this->serviceType);
}
bool LUBitStream::ReadHeader(RakNet::BitStream& bitStream) {
MessageID messageID;
bitStream.Read(messageID);
if (messageID != ID_USER_PACKET_ENUM) return false;
VALIDATE_READ(bitStream.Read(this->connectionType));
VALIDATE_READ(bitStream.Read(this->internalPacketID));
bitStream.IgnoreBytes(1);
VALIDATE_READ(bitStream.Read(this->rakNetID));
VALIDATE_READ(bitStream.Read(this->serviceType));
return true;
}