feat(net): VERSION_CONFIRM carries the server's build identifier

After serviceType the reply now sends major, minor, patch, a flags byte
(build kind in bits 0-1, dirty in bit 2), the first 32 bits of the commit
hash and a u16 length-prefixed build string, instead of the stale fixed
ASCII "0.1.3". unknown stays "DLU3". The 1.10.64 client reads only
netVersion and serviceType and never checks the length, so the extra
bytes are ignored. The build string is optional on read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 16:28:40 -05:00
parent 97a6e27d56
commit 05d18f56e4
3 changed files with 161 additions and 14 deletions

View File

@@ -52,15 +52,32 @@ namespace CommonPackets {
bitStream.Write(netVersion);
bitStream.Write(unknown);
bitStream.Write(serviceType);
bitStream.Write(trailing);
bitStream.Write(versionMajor);
bitStream.Write(versionMinor);
bitStream.Write(versionPatch);
bitStream.Write(buildFlags);
for (int shift = 24; shift >= 0; shift -= 8) bitStream.Write<uint8_t>(commitPrefix >> shift);
BitStreamUtils::WriteLengthPrefixed<uint16_t>(bitStream, buildString);
}
bool ServerVersionConfirm::Deserialize(RakNet::BitStream& bitStream) {
VALIDATE_READ(bitStream.Read(netVersion));
VALIDATE_READ(bitStream.Read(unknown));
VALIDATE_READ(bitStream.Read(serviceType));
VALIDATE_READ(bitStream.Read(trailing));
return true;
VALIDATE_READ(bitStream.Read(versionMajor));
VALIDATE_READ(bitStream.Read(versionMinor));
VALIDATE_READ(bitStream.Read(versionPatch));
VALIDATE_READ(bitStream.Read(buildFlags));
commitPrefix = 0;
for (int i = 0; i < 4; i++) {
uint8_t byte{};
VALIDATE_READ(bitStream.Read(byte));
commitPrefix = (commitPrefix << 8) | byte;
}
// Older DLU servers stop after the 12 fixed bytes.
buildString.clear();
if (bitStream.GetNumberOfUnreadBits() == 0) return true;
return BitStreamUtils::ReadLengthPrefixed<uint16_t>(bitStream, buildString, MAX_BUILD_STRING_LENGTH);
}
void DisconnectNotify::Serialize(RakNet::BitStream& bitStream) const {