| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/mtclient/mtgametrack.h $ |
| 21 | * $Revision: 1.1.1.1 $ |
| 22 | * $Date: 2003-08-26 03:58:40 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * Game Tracker client code header |
| 26 | * |
| 27 | * $Log: not supported by cvs2svn $ |
| 28 | * |
| 29 | * 14 10/03/01 12:44a Kevin |
| 30 | * Smaller version of pxo packets |
| 31 | * |
| 32 | * 13 4/29/99 10:13a Kevin |
| 33 | * reduced time between game updates |
| 34 | * |
| 35 | * 12 4/19/99 8:35p Jeff |
| 36 | * compile under Linux |
| 37 | * |
| 38 | * 11 4/17/99 3:44p Kevin |
| 39 | * Demo2 changes & fixes |
| 40 | * |
| 41 | * 10 4/07/99 9:15a Kevin |
| 42 | * Changed PXO server addresses for release builds |
| 43 | * |
| 44 | * 9 3/25/99 3:26p Kevin |
| 45 | * Made PXO games be based on your chat channel |
| 46 | * |
| 47 | * 8 2/16/99 12:36a Kevin |
| 48 | * Fixes for release builds of OEM V3 and KAtmai |
| 49 | * |
| 50 | * 7 2/03/99 6:14p Kevin |
| 51 | * OEM changes |
| 52 | * |
| 53 | * 6 1/07/99 11:51a Kevin |
| 54 | * Added support for joining servers on alternate ports and hosting behind |
| 55 | * a proxy/firewall |
| 56 | * |
| 57 | * 5 12/23/98 6:38p Kevin |
| 58 | * All UDP data (except gamespy) now uses one (registered) port number |
| 59 | * |
| 60 | * 4 10/09/98 2:56p Kevin |
| 61 | * Changed IP addresses for PXO demo |
| 62 | * |
| 63 | * 3 10/01/98 11:37a Kevin |
| 64 | * UI fixes and stuff |
| 65 | * |
| 66 | * 2 6/01/98 10:10a Kevin |
| 67 | * Added DLL connection interface and auto update DLL |
| 68 | * |
| 69 | * 1 5/21/98 11:08a Kevin |
| 70 | * |
| 71 | * 5 5/14/98 11:07a Kevin |
| 72 | * Made gameover packet to the tracker reliable |
| 73 | * |
| 74 | * 4 4/30/98 3:49p Kevin |
| 75 | * Mastertracker pilot stats |
| 76 | * |
| 77 | * 3 4/24/98 3:50p Kevin |
| 78 | * Added mastertracker game tracking support |
| 79 | * |
| 80 | * 2 4/23/98 4:49p Kevin |
| 81 | * Added Master tracker Game tracker support |
| 82 | * |
| 83 | * 1 4/23/98 3:28p Kevin |
| 84 | * |
| 85 | * $NoKeywords: $ |
| 86 | */ |
| 87 | |
| 88 | #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/ |
| 89 | |
| 90 | #ifndef _GAMETRACK_HEADER_DEFINED |
| 91 | #define _GAMETRACK_HEADER_DEFINEDcxx . . $ `netcon/mtclient/mtgametrack.h:91:9`! |
| 92 | |
| 93 | #ifdef WIN32 |
| 94 | #pragma pack(push, r_udp) |
| 95 | #endif |
| 96 | #pragma pack(1) |
| 97 | |
| 98 | // Definitions |
| 99 | #define GAMETRACKERNAMEcxx . . $ `netcon/mtclient/mtgametrack.h:99:9`! "tracker.pxo.nottheeye.com" |
| 100 | #define GAMEPORTcxx . . $ `netcon/mtclient/mtgametrack.h:100:9`! 3445 |
| 101 | |
| 102 | #define MAX_GAME_BUFFERScxx . . $ `netcon/mtclient/mtgametrack.h:102:9`! 20 // Thats a lot considering 20 games per game_list struct |
| 103 | |
| 104 | #define TRACKER_UPDATE_INTERVALcxx . . $ `netcon/mtclient/mtgametrack.h:104:9`! 60.0 // 300 seconds |
| 105 | #define TRACKER_RESEND_TIMEcxx . . $ `netcon/mtclient/mtgametrack.h:105:9`! 2.0 // 2 seconds |
| 106 | #define TRACKER_TIMEOUTcxx . . $ `netcon/mtclient/mtgametrack.h:106:9`! 20 // 20 seconds |
| 107 | |
| 108 | #define MAX_NET_RETRIEScxx . . $ `netcon/mtclient/mtgametrack.h:108:9`! 30 |
| 109 | #define NET_ACK_TIMEOUTcxx . . $ `netcon/mtclient/mtgametrack.h:109:9`! 1.5 |
| 110 | #define NET_GAME_TIMEOUTcxx . . $ `netcon/mtclient/mtgametrack.h:110:9`! 300.0 // time in seconds |
| 111 | |
| 112 | #define MAX_GT_GAME_DATA_SIZEcxx . . $ `netcon/mtclient/mtgametrack.h:112:9`! 1500 |
| 113 | |
| 114 | #define MAX_GENERIC_GAME_NAME_LENcxx . . $ `netcon/mtclient/mtgametrack.h:114:9`! 32 |
| 115 | |
| 116 | #define MAX_GAME_LISTS_PER_PACKETcxx . . $ `netcon/mtclient/mtgametrack.h:116:9`! 20 |
| 117 | |
| 118 | #define MAX_D3_PLAYERScxx . . $ `netcon/mtclient/mtgametrack.h:118:9`! 32 |
| 119 | #define MAX_D3_MISSION_NAME_LENcxx . . $ `netcon/mtclient/mtgametrack.h:119:9`! 32 |
| 120 | #define MAX_D3_PLAYER_NAME_LENcxx . . $ `netcon/mtclient/mtgametrack.h:120:9`! 20 |
| 121 | #define MAX_D3_MISSION_FILE_LENcxx . . $ `netcon/mtclient/mtgametrack.h:121:9`! 32 |
| 122 | #define MAX_D3_MISSION_URL_LENcxx . . $ `netcon/mtclient/mtgametrack.h:122:9`! 100 |
| 123 | |
| 124 | #define GNT_SERVER_ACKcxx . . $ `netcon/mtclient/mtgametrack.h:124:9`! 0 |
| 125 | #define GNT_CLIENT_ACKcxx . . $ `netcon/mtclient/mtgametrack.h:125:9`! 1 |
| 126 | #define GNT_GAMESTARTEDcxx . . $ `netcon/mtclient/mtgametrack.h:126:9`! 2 |
| 127 | #define GNT_GAMEOVERcxx . . $ `netcon/mtclient/mtgametrack.h:127:9`! 3 |
| 128 | #define GNT_GAMEUPDATEcxx . . $ `netcon/mtclient/mtgametrack.h:128:9`! 4 |
| 129 | #define GNT_GAMELIST_REQcxx . . $ `netcon/mtclient/mtgametrack.h:129:9`! 5 |
| 130 | #define GNT_GAMELIST_DATAcxx . . $ `netcon/mtclient/mtgametrack.h:130:9`! 6 |
| 131 | #define GNT_GAMELIST_FILTER_REQcxx . . $ `netcon/mtclient/mtgametrack.h:131:9`! 7 |
| 132 | #define GNT_GAMEUPDATE_SHORTcxx . . $ `netcon/mtclient/mtgametrack.h:132:9`! 8 |
| 133 | #define GNT_GAMEUPDATE_TINYcxx . . $ `netcon/mtclient/mtgametrack.h:133:9`! 9 |
| 134 | #define GNT_GAMELIST_LITE_DATAcxx . . $ `netcon/mtclient/mtgametrack.h:134:9`! 10 |
| 135 | #define GNT_GAMELIST_LITE_FILTER_REQcxx . . $ `netcon/mtclient/mtgametrack.h:135:9`! 11 |
| 136 | |
| 137 | #define GT_FREESPACEcxx . . $ `netcon/mtclient/mtgametrack.h:137:9`! 1 |
| 138 | #define GT_DESCENT3cxx . . $ `netcon/mtclient/mtgametrack.h:138:9`! 2 |
| 139 | #define GT_TUBERACERcxx . . $ `netcon/mtclient/mtgametrack.h:139:9`! 3 |
| 140 | #define GT_UNUSEDcxx . . $ `netcon/mtclient/mtgametrack.h:140:9`! 0 |
| 141 | #define GT_D3TNGcxx . . $ `netcon/mtclient/mtgametrack.h:141:9`! 42 |
| 142 | #define GAME_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtgametrack.h:142:9`! (sizeof(game_packet_header) - MAX_GT_GAME_DATA_SIZE) |
| 143 | |
| 144 | struct game_packet_headercxx . . $ game_packet_header# { |
| 145 | uint32_tcxx . . $ uint32_t# lencxx . . $ game_packet_header#len.; // Length of entire packet; |
| 146 | uint8_tcxx . . $ uint8_t# game_typecxx . . $ game_packet_header#game_type.; // 1==freespace (GT_FREESPACE), 2==D3, 3==tuberacer, etc. |
| 147 | SOCKADDR_INcxx . . $ `lib/networking.h:219:9`! addrcxx . . $ game_packet_header#addr.; |
| 148 | int typecxx . . $ game_packet_header#type.; // Used to specify what to do ie. Add a new net game (GNT_GAMESTARTED), remove a net game (game over), etc. |
| 149 | uint32_tcxx . . $ uint32_t# sigcxx . . $ game_packet_header#sig.; // Unique identifier for client ACKs (The server always fills this in, the client responds) |
| 150 | |
| 151 | char datacxx . . $ game_packet_header#data.[MAX_GT_GAME_DATA_SIZEcxx . . $ `netcon/mtclient/mtgametrack.h:112:9`!]; |
| 152 | }; |
| 153 | |
| 154 | struct d3_net_game_datacxx . . $ d3_net_game_data# { |
| 155 | char game_namecxx . . $ d3_net_game_data#game_name.[MAX_GENERIC_GAME_NAME_LENcxx . . $ `netcon/mtclient/mtgametrack.h:114:9`!]; |
| 156 | int difficultycxx . . $ d3_net_game_data#difficulty.; |
| 157 | int typecxx . . $ d3_net_game_data#type.; // game type; |
| 158 | int statecxx . . $ d3_net_game_data#state.; |
| 159 | int max_playerscxx . . $ d3_net_game_data#max_players.; |
| 160 | int current_num_playerscxx . . $ d3_net_game_data#current_num_players.; |
| 161 | char mission_namecxx . . $ d3_net_game_data#mission_name.[MAX_D3_MISSION_NAME_LENcxx . . $ `netcon/mtclient/mtgametrack.h:119:9`!]; |
| 162 | char mission_filecxx . . $ d3_net_game_data#mission_file.[MAX_D3_MISSION_FILE_LENcxx . . $ `netcon/mtclient/mtgametrack.h:121:9`!]; |
| 163 | char mission_urlcxx . . $ d3_net_game_data#mission_url.[MAX_D3_MISSION_URL_LENcxx . . $ `netcon/mtclient/mtgametrack.h:122:9`!]; |
| 164 | char playerscxx . . $ d3_net_game_data#players.[MAX_D3_PLAYERScxx . . $ `netcon/mtclient/mtgametrack.h:118:9`!][MAX_D3_PLAYER_NAME_LENcxx . . $ `netcon/mtclient/mtgametrack.h:120:9`!]; |
| 165 | int player_rankcxx . . $ d3_net_game_data#player_rank.[MAX_D3_PLAYERScxx . . $ `netcon/mtclient/mtgametrack.h:118:9`!]; |
| 166 | }; |
| 167 | |
| 168 | struct d3_net_game_data_shortcxx . . $ d3_net_game_data_short# { |
| 169 | char game_namecxx . . $ d3_net_game_data_short#game_name.[MAX_GENERIC_GAME_NAME_LENcxx . . $ `netcon/mtclient/mtgametrack.h:114:9`!]; |
| 170 | int typecxx . . $ d3_net_game_data_short#type.; // game type; |
| 171 | int statecxx . . $ d3_net_game_data_short#state.; |
| 172 | int max_playerscxx . . $ d3_net_game_data_short#max_players.; |
| 173 | int current_num_playerscxx . . $ d3_net_game_data_short#current_num_players.; |
| 174 | char mission_namecxx . . $ d3_net_game_data_short#mission_name.[MAX_D3_MISSION_NAME_LENcxx . . $ `netcon/mtclient/mtgametrack.h:119:9`!]; |
| 175 | char lobbycxx . . $ d3_net_game_data_short#lobby.[MAX_GENERIC_GAME_NAME_LENcxx . . $ `netcon/mtclient/mtgametrack.h:114:9`! * 2]; |
| 176 | }; |
| 177 | |
| 178 | struct d3_net_game_data_tinycxx . . $ d3_net_game_data_tiny# { |
| 179 | int optionscxx . . $ d3_net_game_data_tiny#options.; // 1==force port to arg1 |
| 180 | int arg1cxx . . $ d3_net_game_data_tiny#arg1.; |
| 181 | char lobbycxx . . $ d3_net_game_data_tiny#lobby.[MAX_GENERIC_GAME_NAME_LENcxx . . $ `netcon/mtclient/mtgametrack.h:114:9`! * 2]; |
| 182 | }; |
| 183 | |
| 184 | /* |
| 185 | struct filter_game_list_struct { |
| 186 | int rank; |
| 187 | char preferred_players[][]; |
| 188 | |
| 189 | }; |
| 190 | */ |
| 191 | |
| 192 | struct active_gamescxx . . $ active_games# { |
| 193 | int game_typecxx . . $ active_games#game_type.; // ie. GT_FREESPACE GT_DESCENT3, etc. |
| 194 | SOCKADDRcxx . . $ `lib/networking.h:220:9`! addrcxx . . $ active_games#addr.; |
| 195 | uint32_tcxx . . $ uint32_t# last_updatecxx . . $ active_games#last_update.; // Time we last got an update from this game |
| 196 | char datacxx . . $ active_games#data.[MAX_GT_GAME_DATA_SIZEcxx . . $ `netcon/mtclient/mtgametrack.h:112:9`!]; // memory to hold the game specific data |
| 197 | active_gamescxx . . $ active_games# *nextcxx . . $ active_games#next.; |
| 198 | }; |
| 199 | /* |
| 200 | struct game_list { |
| 201 | uint8_t game_type; |
| 202 | char game_name[MAX_GAME_LISTS_PER_PACKET][MAX_GENERIC_GAME_NAME_LEN]; |
| 203 | uint32_t game_server[MAX_GAME_LISTS_PER_PACKET]; |
| 204 | uint16_t game_port[MAX_GAME_LISTS_PER_PACKET]; |
| 205 | }; |
| 206 | */ |
| 207 | |
| 208 | struct game_listcxx . . $ game_list# { |
| 209 | uint8_tcxx . . $ uint8_t# game_typecxx . . $ game_list#game_type.; |
| 210 | uint32_tcxx . . $ uint32_t# game_servercxx . . $ game_list#game_server.[MAX_GAME_LISTS_PER_PACKETcxx . . $ `netcon/mtclient/mtgametrack.h:116:9`! * 4]; |
| 211 | uint16_tcxx . . $ uint16_t# game_portcxx . . $ game_list#game_port.[MAX_GAME_LISTS_PER_PACKETcxx . . $ `netcon/mtclient/mtgametrack.h:116:9`! * 4]; |
| 212 | }; |
| 213 | |
| 214 | // Function prototypes |
| 215 | |
| 216 | int InitGameTrackerClientcxx . . $ InitGameTrackerClient(7864480464b09eea).(int gametype); |
| 217 | void IdleGameTrackercxx . . $ IdleGameTracker(49f6e7a06ebc5aa8).(); |
| 218 | void UpdateGameDatacxx . . $ UpdateGameData(5d22bdacc48458e8).(void *buffer); |
| 219 | game_listcxx . . $ game_list# *GetGameListcxx . . $ GetGameList(ba3d2dc53e6909a7).(); |
| 220 | void RequestGameListcxx . . $ RequestGameList(49f6e7a06ebc5aa8).(); |
| 221 | int SendGameOvercxx . . $ SendGameOver(b126dc7c1de90089).(); |
| 222 | void StartTrackerGamecxx . . $ StartTrackerGame(5d22bdacc48458e8).(void *buffer); |
| 223 | void HandleGamePacketcxx . . $ HandleGamePacket(c3263a6d42f31e8c).(uint8_tcxx . . $ uint8_t# *data, int len, network_addresscxx . . $ network_address# *from); |
| 224 | void AckPacketcxx . . $ AckPacket(d4f767463ce0a6b3).(int sig); |
| 225 | |
| 226 | #ifdef WIN32 |
| 227 | #pragma pack(pop, r_udp) |
| 228 | #else |
| 229 | #pragma pack() |
| 230 | #endif |
| 231 | #endif |