From b8cc509cbe0d4a51db7856d558ccbc4956bfe8d8 Mon Sep 17 00:00:00 2001 From: Kp Date: Mon, 7 Nov 2022 01:59:34 +0000 Subject: [PATCH] Fix tracker upid values Commit 0512ea8d651f changed the value of the tracker_ upid codes when they were converted from `#define` statements with explicit values to `enum` members with implicit values. The tracker program is maintained separately, and continues to use the old values, so games with this commit use the wrong numbers when requesting service from the tracker. Switch the upid codes back to their previous values, and add a warning comment about the special compatibility concerns for tracker upid codes, relative to game-to-game codes. Fixes: 0512ea8d651fde3cc61e6a99fff963f5a3075c36 ("Use enum class for upid") --- similar/main/net_udp.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/similar/main/net_udp.cpp b/similar/main/net_udp.cpp index 775468f6b..55a57319f 100644 --- a/similar/main/net_udp.cpp +++ b/similar/main/net_udp.cpp @@ -76,6 +76,9 @@ namespace { enum class upid : uint8_t { + /* upid codes are part of the network ABI, and must be compatible with the + * game running on the peer system. + */ version_deny = 1, // Netgame join or info has been denied due to version difference. game_info_req, // Requesting all info about a netgame. game_info, // Packet containing all info about a netgame. @@ -96,9 +99,18 @@ enum class upid : uint8_t mdata_pneedack, // Packet containing multi buffer from a player. Priority 2 - ACK needed. Also contains pkt_num mdata_ack, // ACK packet for UPID_MDATA_P1. #if DXX_USE_TRACKER - tracker_gameinfo, // Packet containing info about a game - tracker_ack, // An ACK packet from the tracker - tracker_holepunch, // Hole punching process. Sent from client to tracker to request hole punching from game host and received by host from tracker to initiate hole punching to requesting client + /* Tracker upid codes are special. They must be compatible with the + * tracker, which is a separate program maintained in a different + * repository[1], with its own private copy of these numbers[2]. Changing + * the value of tracker codes will break communications with the tracker + * program. + * + * [1]: https://github.com/Mako88/dxx-tracker/ + * [2]: https://github.com/Mako88/dxx-tracker/blob/master/RebirthTracker/RebirthTracker/PacketHandlers/ - see `[Opcode(NN)]` in the *.cs files + */ + tracker_gameinfo = 24, // Packet containing info about a game + tracker_ack = 25, // An ACK packet from the tracker + tracker_holepunch = 26, // Hole punching process. Sent from client to tracker to request hole punching from game host and received by host from tracker to initiate hole punching to requesting client #endif };