You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
staticconstexprconst Int MAX_SLOTS = MAX_PLAYER+1;
52
52
53
+
// TheSuperHackers @info As we are not detecting for network fragmentation and dynamically adjusting payload sizes, we set an 1100 bytes UDP payload as a safe upper limit for various networks
54
+
// We chose 1100 bytes as when taking mobile networks into account, maximum transmission unit sizes can vary from 1340 - 1500 bytes
55
+
// and when the packet headers for PPPOE, IPV6 and other virtual network encapsulation are considered, we need a lower safe UDP payload to prevent fragmentation.
56
+
staticconstexprconst Int MAX_UDP_PAYLOAD_SIZE = 1100;
53
57
// UDP (8 bytes) + IP header (28 bytes) = 36 bytes total. We want a total packet size of 512, so 512 - 36 = 476
54
-
staticconst Int MAX_PACKET_SIZE = 476;
58
+
staticconstexprconst Int RETAIL_GAME_PACKET_SIZE = 476;
59
+
60
+
// TheSuperHackers @info The legacy lanapi cannot use a larger packet size without breaking the gameinfo command
61
+
staticconstexprconst Int MAX_LANAPI_PACKET_SIZE = RETAIL_GAME_PACKET_SIZE;
62
+
63
+
// TheSuperHackers @bugfix Mauller 08/02/2026 Allow larger ethernet UDP payload to be used for game messages, this fixes connection issues and eliminates disconnection bugs
64
+
#if RETAIL_COMPATIBLE_NETWORKING
65
+
staticconstexprconst Int MAX_PACKET_SIZE = RETAIL_GAME_PACKET_SIZE;
66
+
staticconstexprconst Int MAX_NETWORK_MESSAGE_LEN = 1024;
67
+
#else
68
+
staticconstexprconst Int MAX_PACKET_SIZE = MAX_UDP_PAYLOAD_SIZE - sizeof(TransportMessageHeader);
69
+
staticconstexprconst Int MAX_NETWORK_MESSAGE_LEN = MAX_UDP_PAYLOAD_SIZE;
70
+
#endif
71
+
72
+
// TheSuperHackers @bugfix Mauller 08/02/2026 Double send and receive buffer sizes to alleviate the occurance of disconnection issues in retail and non retail code.
73
+
staticconstexprconst Int MAX_MESSAGES = 256;
55
74
56
75
/**
57
76
* Command packet - contains frame #, total # of commands, and each command. This is what gets sent
58
77
* to each player every frame
59
78
*/
60
-
#defineMAX_MESSAGE_LEN1024
61
-
#defineMAX_MESSAGES128
62
-
staticconst Int numCommandsPerCommandPacket = (MAX_MESSAGE_LEN - sizeof(UnsignedInt) - sizeof(UnsignedShort))/sizeof(GameMessage);
79
+
staticconst Int numCommandsPerCommandPacket = (MAX_NETWORK_MESSAGE_LEN - sizeof(UnsignedInt) - sizeof(UnsignedShort))/sizeof(GameMessage);
63
80
#pragma pack(push, 1)
64
81
structCommandPacket
65
82
{
@@ -89,7 +106,14 @@ struct TransportMessageHeader
89
106
structTransportMessage
90
107
{
91
108
TransportMessageHeader header;
92
-
UnsignedByte data[MAX_MESSAGE_LEN];
109
+
#if RETAIL_COMPATIBLE_NETWORKING
110
+
// TheSuperHackers @info This value is not the correct one that should be used here, it should have been max packet size
111
+
// The non retail max network message len takes the extra bytes of the network message header into account when handling UDP payload data
112
+
// In retail this only works since no data larger than the retail game packet size is put into a network message
0 commit comments