fix: Fixes Freeshard Protocol (UOGateway) support. (#2183)

This commit is contained in:
Kamron Batman 2025-05-12 12:24:24 -07:00 committed by GitHub
parent 0f3d984efc
commit f2526c82f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -14,6 +14,7 @@
*************************************************************************/ *************************************************************************/
using System; using System;
using System.Buffers.Binary;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
@ -173,9 +174,15 @@ public static class TcpServer
var isValid = var isValid =
// Sometimes when newer clients are connecting to the game server the first 4 bytes are sent separately // Sometimes when newer clients are connecting to the game server the first 4 bytes are sent separately
bytesRead == 4 || bytesRead == 4 ||
// Support Freeshard Protocol (UOGateway)
bytesRead == 8 &&
BinaryPrimitives.ReadUInt32BigEndian(_firstBytes.AsSpan(4)) is 0xF10004FF or 0xF10004FE ||
// Older clients only send the 4 byte seed first then 0x80 // Older clients only send the 4 byte seed first then 0x80
(UOClient.MinRequired == null || UOClient.MinRequired < ClientVersion.Version6050) && (UOClient.MinRequired == null || UOClient.MinRequired < ClientVersion.Version6050) &&
bytesRead >= 66 && _firstBytes[4] == 0x80 || bytesRead >= 66 && _firstBytes[4] == 0x80 ||
// Newer clients // Newer clients
(UOClient.MaxRequired == null || UOClient.MaxRequired >= ClientVersion.Version6050) && ( (UOClient.MaxRequired == null || UOClient.MaxRequired >= ClientVersion.Version6050) && (
// Account Login - 0xEF + 0x80 (83 bytes) // Account Login - 0xEF + 0x80 (83 bytes)