Debian Codegraph @

netcon/mtclient/mtgametrack.cpp

raw symbols SCIP
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.cpp $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003-08-26 03:58:40 $
23 * $Author: kevinb $
24 *
25 * Game Tracker client code
26 *
27 * $Log: not supported by cvs2svn $
28 *
29 * 17 10/03/01 12:44a Kevin
30 * Smaller version of pxo packets
31 *
32 * 16 9/02/99 3:16p Kevin
33 * Macintosh byte ordering fixes
34 *
35 * 15 8/25/99 2:38p Samir
36 * added byteswap.h for INTEL_INT.
37 *
38 * 14 8/24/99 5:47p Kevin
39 * Macintosh crap
40 *
41 * 13 7/06/99 5:52p Kevin
42 * PXO & multiplayer fixes for the patch
43 *
44 * 12 5/05/99 5:23p Kevin
45 * fixed some bugs on the gamelist
46 *
47 * 11 5/04/99 7:29p Kevin
48 * Fixed bug that caused the server to send his game info twice whenever
49 * the level starts.
50 *
51 * 10 5/04/99 5:39p Kevin
52 * connection dll & pxo game tracking improvements (added server type to
53 * list)
54 *
55 * 9 4/19/99 8:35p Jeff
56 * Compile under Linux
57 *
58 * 8 3/25/99 3:26p Kevin
59 * Made PXO games be based on your chat channel
60 *
61 * 7 1/07/99 11:51a Kevin
62 * Added support for joining servers on alternate ports and hosting behind
63 * a proxy/firewall
64 *
65 * 6 12/30/98 12:16p Kevin
66 * Auto Mission Download system
67 *
68 * 5 12/23/98 6:38p Kevin
69 * All UDP data (except gamespy) now uses one (registered) port number
70 *
71 * 4 10/19/98 9:50a Kevin
72 * Added nettest application
73 *
74 * 3 7/27/98 5:31p Kevin
75 * Sound/Bitmap exchange system
76 *
77 * 2 6/01/98 10:10a Kevin
78 * Added DLL connection interface and auto update DLL
79 *
80 * 1 5/21/98 11:08a Kevin
81 *
82 * 6 5/14/98 11:07a Kevin
83 * Made gameover packet to the tracker reliable
84 *
85 * 5 5/04/98 12:53p Kevin
86 * Fixed mastertracker resend stuff
87 *
88 * 4 4/30/98 3:49p Kevin
89 * Mastertracker pilot stats
90 *
91 * 3 4/24/98 3:50p Kevin
92 * Added mastertracker game tracking support
93 *
94 * 2 4/23/98 4:49p Kevin
95 * Added Master tracker Game tracker support
96 *
97 * 1 4/23/98 3:26p Kevin
98 * Initial version
99 *
100 * $NoKeywords: $
101 */
102
103 /*
104 InitGameTracker(int game_type); //D3 or Freespace
105 //Call periodically so we can send our update, and make sure it is received
106 IdleGameTracker();
107 StartTrackerGame(void *buffer) //Call with a freespace_net_game_data or d3_net_game_data structure
108 //Call with a freespace_net_game_data or d3_net_game_data structure
109 //Updates our memory so when it is time, we send the latest game data
110 UpdateGameData(gamedata);
111 //Call to signify end of game
112 RequestGameList();//Sends a GNT_GAMELIST_REQ packet to the server.
113 game_list * GetGameList();//returns a pointer to a game_list struct
114
115 */
116 #ifdef WIN32
117 #include <windows.h>
118 #endif
119
120 #include <cstring>
121 #include <ctime>
122
123 #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/
124 #include "networking.h"cxx . . $ `<file>/lib/networking.h`/
125 #include "mtgametrack.h"cxx . . $ `<file>/netcon/mtclient/mtgametrack.h`/
126 #include "byteswap.h"cxx . . $ `<file>/lib/byteswap.h`/
127 #include "mt_net.h"cxx . . $ `<file>/netcon/mtclient/mt_net.h`/
128
129 // extern float DLLtimer_GetTime(void);
130 typedef float (*timer_GetTime_fpcxx . . $ timer_GetTime_fp#)();
131
132 extern timer_GetTime_fpcxx . . $ timer_GetTime_fp# DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.;
133
134 typedef void (*HandleGamePacket_fpcxx . . $ HandleGamePacket_fp#)(uint8_tcxx . . $ uint8_t# *data, int len, network_addresscxx . . $ network_address# *from);
135
136 typedef int (*nw_RegisterCallback_fpcxx . . $ nw_RegisterCallback_fp#)(HandleGamePacket_fpcxx . . $ HandleGamePacket_fp#, uint8_tcxx . . $ uint8_t# id);
137 extern nw_RegisterCallback_fpcxx . . $ nw_RegisterCallback_fp# DLLnw_RegisterCallbackcxx . . $ DLLnw_RegisterCallback.;
138
139 typedef int (*nw_DoReceiveCallbacks_fpcxx . . $ nw_DoReceiveCallbacks_fp#)();
140 extern nw_DoReceiveCallbacks_fpcxx . . $ nw_DoReceiveCallbacks_fp# DLLnw_DoReceiveCallbackscxx . . $ DLLnw_DoReceiveCallbacks.;
141
142 #if (defined(LOGGER) && (!defined(RELEASE)))
143 #define DLLmprintf(...) DLLDebug_ConsolePrintf(__VA_ARGS__)
144 #else
145 #define DLLmprintfcxx . . $ `netcon/mtclient/mtgametrack.cpp:145:9`!(...)
146 #endif
147
148 typedef void (*Debug_ConsolePrintf_fpcxx . . $ Debug_ConsolePrintf_fp#)(int n, const char *format, ...);
149
150 extern Debug_ConsolePrintf_fpcxx . . $ Debug_ConsolePrintf_fp# DLLDebug_ConsolePrintfcxx . . $ DLLDebug_ConsolePrintf.;
151
152 // Variables
153
154 game_listcxx . . $ game_list# GameBuffercxx . . $ GameBuffer.[MAX_GAME_BUFFERScxx . . $ `netcon/mtclient/mtgametrack.h:102:9`!];
155 int GameTypecxx . . $ GameType.; // d3 or fs
156
157 float LastTrackerUpdatecxx . . $ LastTrackerUpdate.;
158 float LastSentToTrackercxx . . $ LastSentToTracker.;
159
160 float LastGameOverPacketcxx . . $ LastGameOverPacket.;
161 float FirstGameOverPacketcxx . . $ FirstGameOverPacket.;
162
163 int SendingGameOvercxx . . $ SendingGameOver.;
164
165 uint32_tcxx . . $ uint32_t# TrackerAckdUscxx . . $ TrackerAckdUs.;
166 uint32_tcxx . . $ uint32_t# TrackerGameIsRunningcxx . . $ TrackerGameIsRunning.;
167
168 game_packet_headercxx . . $ game_packet_header# TrackerGameDatacxx . . $ TrackerGameData.;
169 game_packet_headercxx . . $ game_packet_header# GameListReqcxx . . $ GameListReq.;
170 game_packet_headercxx . . $ game_packet_header# TrackAckPacketcxx . . $ TrackAckPacket.;
171 game_packet_headercxx . . $ game_packet_header# GameOverPacketcxx . . $ GameOverPacket.;
172
173 game_packet_headercxx . . $ game_packet_header# inpacketcxx . . $ inpacket.;
174
175 d3_net_game_data_tinycxx . . $ d3_net_game_data_tiny# *D3TrackerGameDatacxx . . $ D3TrackerGameData.;
176
177 extern int DLLnw_ListenPortcxx . . $ DLLnw_ListenPort.;
178 extern uint16_tcxx . . $ uint16_t# DLLPXOPortcxx . . $ DLLPXOPort.;
179 extern char *DLLPXO_hosted_lobby_namecxx . . $ DLLPXO_hosted_lobby_name.;
180
181 int InitGameTrackerClientcxx . . $ InitGameTrackerClient(7864480464b09eea).(int gametype) {
182 GameTypecxx . . $ GameType. = gametype;
183 LastTrackerUpdatecxx . . $ LastTrackerUpdate. = 0;
184 switch (gametype) {
185 case GT_FREESPACEcxx . . $ `netcon/mtclient/mtgametrack.h:137:9`!:
186 // TrackerGameData.len = GAME_HEADER_ONLY_SIZE+sizeof(freespace_net_game_data);
187 break;
188 case GT_DESCENT3cxx . . $ `netcon/mtclient/mtgametrack.h:138:9`!:
189 TrackerGameDatacxx . . $ TrackerGameData..lencxx . . $ game_packet_header#len. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(GAME_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtgametrack.h:142:9`! + sizeof(d3_net_game_data_short));
190 break;
191 case GT_D3TNGcxx . . $ `netcon/mtclient/mtgametrack.h:141:9`!:
192 TrackerGameDatacxx . . $ TrackerGameData..lencxx . . $ game_packet_header#len. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(GAME_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtgametrack.h:142:9`! + sizeof(d3_net_game_data_tiny));
193 break;
194 }
195 TrackerGameDatacxx . . $ TrackerGameData..game_typecxx . . $ game_packet_header#game_type. = gametype; // 1==freespace (GT_FREESPACE), 2==D3, 3==tuberacer, etc.
196 TrackerGameDatacxx . . $ TrackerGameData..typecxx . . $ game_packet_header#type. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(GNT_GAMEUPDATE_TINYcxx . . $ `netcon/mtclient/mtgametrack.h:133:9`!); // Used to specify what to do ie. Add a new net game
197 // (GNT_GAMESTARTED), remove a net game (game over), etc.
198
199 D3TrackerGameDatacxx . . $ D3TrackerGameData. = (d3_net_game_data_tinycxx . . $ d3_net_game_data_tiny# *)&TrackerGameDatacxx . . $ TrackerGameData..datacxx . . $ game_packet_header#data.;
200 if (DLLPXOPortcxx . . $ DLLPXOPort.) {
201 D3TrackerGameDatacxx . . $ D3TrackerGameData.->optionscxx . . $ d3_net_game_data_tiny#options. = 1;
202 D3TrackerGameDatacxx . . $ D3TrackerGameData.->arg1cxx . . $ d3_net_game_data_tiny#arg1. = DLLPXOPortcxx . . $ DLLPXOPort.;
203 }
204 GameListReqcxx . . $ GameListReq..game_typecxx . . $ game_packet_header#game_type. = gametype;
205 GameListReqcxx . . $ GameListReq..typecxx . . $ game_packet_header#type. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(GNT_GAMELIST_LITE_FILTER_REQcxx . . $ `netcon/mtclient/mtgametrack.h:135:9`!);
206 GameListReqcxx . . $ GameListReq..lencxx . . $ game_packet_header#len. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(GAME_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtgametrack.h:142:9`!);
207
208 TrackAckPacketcxx . . $ TrackAckPacket..game_typecxx . . $ game_packet_header#game_type. = gametype;
209 TrackAckPacketcxx . . $ TrackAckPacket..lencxx . . $ game_packet_header#len. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(GAME_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtgametrack.h:142:9`!);
210 TrackAckPacketcxx . . $ TrackAckPacket..typecxx . . $ game_packet_header#type. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(GNT_CLIENT_ACKcxx . . $ `netcon/mtclient/mtgametrack.h:125:9`!);
211
212 GameOverPacketcxx . . $ GameOverPacket..game_typecxx . . $ game_packet_header#game_type. = gametype;
213 GameOverPacketcxx . . $ GameOverPacket..lencxx . . $ game_packet_header#len. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(GAME_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtgametrack.h:142:9`!);
214 GameOverPacketcxx . . $ GameOverPacket..typecxx . . $ game_packet_header#type. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(GNT_GAMEOVERcxx . . $ `netcon/mtclient/mtgametrack.h:127:9`!);
215
216 SendingGameOvercxx . . $ SendingGameOver. = 0;
217
218 DLLnw_RegisterCallbackcxx . . $ DLLnw_RegisterCallback.(HandleGamePacketcxx . . $ HandleGamePacket(c3263a6d42f31e8c)., PXO_NETID_GAME_TRACKERcxx . . $ `netcon/mtclient/mt_net.h:52:9`!);
219 return 1;
220 }
221
222 void IdleGameTrackercxx . . $ IdleGameTracker(49f6e7a06ebc5aa8).() {
223 DLLnw_DoReceiveCallbackscxx . . $ DLLnw_DoReceiveCallbacks.();
224 // uint32_t bytesin;
225 // mprintf(0,"IdleGameTracker() entered.\n");
226 if ((TrackerGameIsRunningcxx . . $ TrackerGameIsRunning.) && ((DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.() - LastTrackerUpdatecxx . . $ LastTrackerUpdate.) > TRACKER_UPDATE_INTERVALcxx . . $ `netcon/mtclient/mtgametrack.h:104:9`!)) {
227
228 struct tmcxx . . $ tm# *newtime;
229 time_tcxx . . $ time_t# aclock;
230 time(&aclock); /* Get time in seconds */
231 newtime = localtime(&aclock);
232 // Time to update the tracker again
233 DLLmprintfcxx . . $ `netcon/mtclient/mtgametrack.cpp:145:9`!(0, "[%.24s] Updating the PXO game tracker!\n", asctime(newtime));
234 SendGameTrackerPackercxx . . $ SendGameTrackerPacker(dedf1e9b1c614a07).(&TrackerGameDatacxx . . $ TrackerGameData.);
235 // sendto(gamesock,(const char *)&TrackerGameData,TrackerGameData.len,0,(SOCKADDR
236 //*)&gtrackaddr,sizeof(SOCKADDR_IN));
237 TrackerAckdUscxx . . $ TrackerAckdUs. = 0;
238 LastTrackerUpdatecxx . . $ LastTrackerUpdate. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
239 LastSentToTrackercxx . . $ LastSentToTracker. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
240 } else if ((TrackerGameIsRunningcxx . . $ TrackerGameIsRunning.) && (!TrackerAckdUscxx . . $ TrackerAckdUs.) &&
241 ((DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.() - LastSentToTrackercxx . . $ LastSentToTracker.) > TRACKER_RESEND_TIMEcxx . . $ `netcon/mtclient/mtgametrack.h:105:9`!)) {
242 // We still haven't been acked by the last packet and it's time to resend.
243
244 struct tmcxx . . $ tm# *newtime;
245 time_tcxx . . $ time_t# aclock;
246 time(&aclock); /* Get time in seconds */
247 newtime = localtime(&aclock);
248 // Time to update the tracker again
249 DLLmprintfcxx . . $ `netcon/mtclient/mtgametrack.cpp:145:9`!(0, "[%.24s] (Resending) Updating the PXO game tracker!\n", asctime(newtime));
250
251 SendGameTrackerPackercxx . . $ SendGameTrackerPacker(dedf1e9b1c614a07).(&TrackerGameDatacxx . . $ TrackerGameData.);
252 TrackerAckdUscxx . . $ TrackerAckdUs. = 0;
253 LastTrackerUpdatecxx . . $ LastTrackerUpdate. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
254 LastSentToTrackercxx . . $ LastSentToTracker. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
255 }
256
257 if (SendingGameOvercxx . . $ SendingGameOver.) {
258 if ((DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.() - LastGameOverPacketcxx . . $ LastGameOverPacket.) > TRACKER_RESEND_TIMEcxx . . $ `netcon/mtclient/mtgametrack.h:105:9`!) {
259 // resend
260 LastGameOverPacketcxx . . $ LastGameOverPacket. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
261 SendGameTrackerPackercxx . . $ SendGameTrackerPacker(dedf1e9b1c614a07).(&GameOverPacketcxx . . $ GameOverPacket.);
262 } else if ((DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.() - FirstGameOverPacketcxx . . $ FirstGameOverPacket.) > TRACKER_TIMEOUTcxx . . $ `netcon/mtclient/mtgametrack.h:106:9`!) {
263 // Giving up, it timed out.
264 SendingGameOvercxx . . $ SendingGameOver. = 3;
265 }
266 }
267 }
268
269 void HandleGamePacketcxx . . $ HandleGamePacket(c3263a6d42f31e8c).(uint8_tcxx . . $ uint8_t# *data, int len, network_addresscxx . . $ network_address# *from) {
270
271 memcpy(&inpacketcxx . . $ inpacket., data, sizeof(inpacketcxx . . $ inpacket.));
272
273 // Check to make sure the packets ok
274 if (len) {
275 switch (INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(inpacket.type)) {
276 case GNT_SERVER_ACKcxx . . $ `netcon/mtclient/mtgametrack.h:124:9`!:
277 // The server got our packet so we can stop sending now
278 TrackerAckdUscxx . . $ TrackerAckdUs. = 1;
279 if (SendingGameOvercxx . . $ SendingGameOver.) {
280 SendingGameOvercxx . . $ SendingGameOver. = 2;
281 }
282 break;
283 case GNT_GAMELIST_LITE_DATAcxx . . $ `netcon/mtclient/mtgametrack.h:134:9`!:
284 if (len < (GAME_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtgametrack.h:142:9`! + sizeof(game_listcxx . . $ game_list#))) {
285 DLLmprintfcxx . . $ `netcon/mtclient/mtgametrack.cpp:145:9`!(0, "(%d) packet is too small!\n", len);
286 }
287 // Woohoo! Game data! put it in the buffer (if one's free)
288 // DLLmprintf(0,"GNT_GAMELIST_LITE_DATA received.\n");
289 for (int i = 0; i < MAX_GAME_BUFFERScxx . . $ `netcon/mtclient/mtgametrack.h:102:9`!; i++) {
290 if (GameBuffercxx . . $ GameBuffer.[i].game_typecxx . . $ game_list#game_type. == GT_UNUSEDcxx . . $ `netcon/mtclient/mtgametrack.h:140:9`!) {
291 memset(&GameBuffercxx . . $ GameBuffer.[i], 0, sizeof(game_listcxx . . $ game_list#));
292 memcpy(&GameBuffercxx . . $ GameBuffer.[i], inpacketcxx . . $ inpacket..datacxx . . $ game_packet_header#data., len - GAME_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtgametrack.h:142:9`!);
293 i = MAX_GAME_BUFFERScxx . . $ `netcon/mtclient/mtgametrack.h:102:9`! + 1;
294 }
295 }
296 break;
297 }
298 // mprintf(0,"Sending ACK.\n");
299 AckPacketcxx . . $ AckPacket(d4f767463ce0a6b3).(inpacketcxx . . $ inpacket..sigcxx . . $ game_packet_header#sig.);
300 }
301 }
302
303 void UpdateGameDatacxx . . $ UpdateGameData(5d22bdacc48458e8).(void *buffer) {
304 if (GameTypecxx . . $ GameType. == GT_FREESPACEcxx . . $ `netcon/mtclient/mtgametrack.h:137:9`!) {
305 // memcpy(FreeSpaceTrackerGameData,buffer,sizeof(freespace_net_game_data));
306 } else if (GameTypecxx . . $ GameType. == GT_DESCENT3cxx . . $ `netcon/mtclient/mtgametrack.h:138:9`!) {
307 memcpy(D3TrackerGameDatacxx . . $ D3TrackerGameData., buffer, sizeof(d3_net_game_data_shortcxx . . $ d3_net_game_data_short#));
308 } else if (GameTypecxx . . $ GameType. == GT_D3TNGcxx . . $ `netcon/mtclient/mtgametrack.h:141:9`!) {
309 memcpy(D3TrackerGameDatacxx . . $ D3TrackerGameData., buffer, sizeof(d3_net_game_data_tinycxx . . $ d3_net_game_data_tiny#));
310 }
311 }
312
313 game_listcxx . . $ game_list# glcxx . . $ gl.;
314
315 game_listcxx . . $ game_list# *GetGameListcxx . . $ GetGameList(ba3d2dc53e6909a7).() {
316 memset(&glcxx . . $ gl., 0, sizeof(glcxx . . $ gl.));
317 for (auto & i : GameBuffercxx . . $ GameBuffer.) {
318 if (i.game_typecxx . . $ game_list#game_type. != GT_UNUSEDcxx . . $ `netcon/mtclient/mtgametrack.h:140:9`!) {
319 memcpy(&glcxx . . $ gl., &i, sizeof(glcxx . . $ gl.));
320 i.game_typecxx . . $ game_list#game_type. = GT_UNUSEDcxx . . $ `netcon/mtclient/mtgametrack.h:140:9`!;
321 return &glcxx . . $ gl.;
322 }
323 }
324 return nullptr;
325 }
326
327 void RequestGameListcxx . . $ RequestGameList(49f6e7a06ebc5aa8).() {
328 // Zero out all games
329 for (auto & i : GameBuffercxx . . $ GameBuffer.) {
330 memset(&i, 0, sizeof(game_listcxx . . $ game_list#));
331 }
332
333 int len = strlen(DLLPXO_hosted_lobby_namecxx . . $ DLLPXO_hosted_lobby_name.) + 1;
334 memcpy(GameListReqcxx . . $ GameListReq..datacxx . . $ game_packet_header#data., DLLPXO_hosted_lobby_namecxx . . $ DLLPXO_hosted_lobby_name., len);
335 GameListReqcxx . . $ GameListReq..lencxx . . $ game_packet_header#len. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!((uint32_t)(GAME_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtgametrack.h:142:9`! + len));
336 SendGameTrackerPackercxx . . $ SendGameTrackerPacker(dedf1e9b1c614a07).(&GameListReqcxx . . $ GameListReq.);
337 }
338
339 int SendGameOvercxx . . $ SendGameOver(b126dc7c1de90089).() {
340 IdleGameTrackercxx . . $ IdleGameTracker(49f6e7a06ebc5aa8).();
341
342 if (SendingGameOvercxx . . $ SendingGameOver. == 3) {
343 // Request timed out.
344 return 2;
345 }
346 if (SendingGameOvercxx . . $ SendingGameOver. == 2) {
347 SendingGameOvercxx . . $ SendingGameOver. = 0;
348 return 1;
349 }
350 if (SendingGameOvercxx . . $ SendingGameOver. == 1) {
351 // Wait until it's sent.
352 return 0;
353 }
354 if (SendingGameOvercxx . . $ SendingGameOver. == 0) {
355 LastGameOverPacketcxx . . $ LastGameOverPacket. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
356 FirstGameOverPacketcxx . . $ FirstGameOverPacket. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
357 SendingGameOvercxx . . $ SendingGameOver. = 1;
358 TrackerGameIsRunningcxx . . $ TrackerGameIsRunning. = 0;
359 SendGameTrackerPackercxx . . $ SendGameTrackerPacker(dedf1e9b1c614a07).(&GameOverPacketcxx . . $ GameOverPacket.);
360 return 0;
361 }
362 return 0;
363 }
364
365 void AckPacketcxx . . $ AckPacket(d4f767463ce0a6b3).(int sig) {
366 TrackAckPacketcxx . . $ TrackAckPacket..sigcxx . . $ game_packet_header#sig. = sig;
367 SendGameTrackerPackercxx . . $ SendGameTrackerPacker(dedf1e9b1c614a07).(&TrackAckPacketcxx . . $ TrackAckPacket.);
368 }
369
370 void StartTrackerGamecxx . . $ StartTrackerGame(5d22bdacc48458e8).(void *buffer) {
371
372 struct tmcxx . . $ tm# *newtime;
373 time_tcxx . . $ time_t# aclock;
374 time(&aclock); /* Get time in seconds */
375 newtime = localtime(&aclock);
376 // Time to update the tracker again
377 DLLmprintfcxx . . $ `netcon/mtclient/mtgametrack.cpp:145:9`!(0, "[%.24s] Updating the PXO game tracker with a new game!\n", asctime(newtime));
378
379 if (GameTypecxx . . $ GameType. == GT_FREESPACEcxx . . $ `netcon/mtclient/mtgametrack.h:137:9`!) {
380 // memcpy(FreeSpaceTrackerGameData,buffer,sizeof(freespace_net_game_data));
381 } else if (GameTypecxx . . $ GameType. == GT_DESCENT3cxx . . $ `netcon/mtclient/mtgametrack.h:138:9`!) {
382 memcpy(D3TrackerGameDatacxx . . $ D3TrackerGameData., buffer, sizeof(d3_net_game_data_shortcxx . . $ d3_net_game_data_short#));
383 SendGameTrackerPackercxx . . $ SendGameTrackerPacker(dedf1e9b1c614a07).(&TrackerGameDatacxx . . $ TrackerGameData.);
384 TrackerAckdUscxx . . $ TrackerAckdUs. = 0;
385 LastTrackerUpdatecxx . . $ LastTrackerUpdate. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
386 LastSentToTrackercxx . . $ LastSentToTracker. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
387
388 } else if (GameTypecxx . . $ GameType. == GT_D3TNGcxx . . $ `netcon/mtclient/mtgametrack.h:141:9`!) {
389 memcpy(D3TrackerGameDatacxx . . $ D3TrackerGameData., buffer, sizeof(d3_net_game_data_tinycxx . . $ d3_net_game_data_tiny#));
390 SendGameTrackerPackercxx . . $ SendGameTrackerPacker(dedf1e9b1c614a07).(&TrackerGameDatacxx . . $ TrackerGameData.);
391 TrackerAckdUscxx . . $ TrackerAckdUs. = 0;
392 LastTrackerUpdatecxx . . $ LastTrackerUpdate. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
393 LastSentToTrackercxx . . $ LastSentToTracker. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
394 }
395 TrackerGameIsRunningcxx . . $ TrackerGameIsRunning. = 1;
396 // LastTrackerUpdate = 0;
397 }