Debian Codegraph @

netcon/mtclient/mtpilottracker.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
19 /*
20 * $Logfile: /DescentIII/Main/mtclient/mtpilottracker.cpp $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003-08-26 03:58:40 $
23 * $Author: kevinb $
24 *
25 * Pilot tracker client code
26 *
27 * $Log: not supported by cvs2svn $
28 *
29 * 15 10/28/99 3:13p Kevin
30 * fixed major badness with byte ordering 'fix'
31 *
32 * 14 9/02/99 3:16p Kevin
33 * Macintosh byte ordering fixes
34 *
35 * 13 9/01/99 5:24p Kevin
36 * Macintosh byte ordering problems
37 *
38 * 12 7/21/99 9:11a Kevin
39 * bandwidth reduction act #1
40 *
41 * 11 4/21/99 11:15a Kevin
42 * sectret code to tell the differences between oem, demo and retail
43 * builds on the tracker
44 *
45 * 10 4/19/99 8:36p Jeff
46 * Compile under Linux
47 *
48 * 9 3/02/99 5:50p Kevin
49 * Ouch. Duplicate structures existed and were conflicting.
50 *
51 * 8 1/11/99 6:02p Kevin
52 * Fixed warning
53 *
54 * 7 12/23/98 6:38p Kevin
55 * All UDP data (except gamespy) now uses one (registered) port number
56 *
57 * 6 11/03/98 9:27a Kevin
58 * Added PXO message of the day
59 *
60 * 5 10/30/98 11:25a Kevin
61 * Message of the day for PXO
62 *
63 * 4 8/31/98 10:14a Kevin
64 * Misc. multi-UI fixes
65 *
66 * 3 8/25/98 6:33p Kevin
67 * PXO screens
68 *
69 * 2 6/01/98 10:10a Kevin
70 * Added DLL connection interface and auto update DLL
71 *
72 * 1 5/25/98 4:12p Kevin
73 *
74 * 10 5/14/98 6:08p Kevin
75 * fixed encryption bug
76 *
77 * 9 5/14/98 5:19p Kevin
78 * Encrypted pilot data
79 *
80 * 8 5/07/98 9:47a Kevin
81 * Made pilot reading more robust
82 *
83 * 7 5/04/98 1:22p Kevin
84 * Mastertracker
85 *
86 * 6 5/04/98 12:53p Kevin
87 * Fixed mastertracker resend stuff
88 *
89 * 5 5/01/98 12:28p Kevin
90 * Added new user registration button for MT
91 *
92 * 4 4/30/98 3:50p Kevin
93 * Mastertracker pilot stats
94 *
95 * 3 4/28/98 12:51p Kevin
96 * Master tracker login
97 *
98 * 2 4/27/98 7:12p Kevin
99 * Mastertracker pilot tracker
100 *
101 * 1 4/27/98 5:29p Kevin
102 * Initial Version
103 *
104 * $NoKeywords: $
105 */
106
107 #ifdef WIN32
108 #include <windows.h>
109 #endif
110
111 #include <cstdlib>
112 #include <cstring>
113
114 #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/
115 #include "networking.h"cxx . . $ `<file>/lib/networking.h`/
116 #include "mt_net.h"cxx . . $ `<file>/netcon/mtclient/mt_net.h`/
117 #include "byteswap.h"cxx . . $ `<file>/lib/byteswap.h`/
118
119 #define LOGIN_LENcxx . . $ `netcon/mtclient/mtpilottracker.cpp:119:9`! 33
120 #define REAL_NAME_LENcxx . . $ `netcon/mtclient/mtpilottracker.cpp:120:9`! 66
121 #define PASSWORD_LENcxx . . $ `netcon/mtclient/mtpilottracker.cpp:121:9`! 17
122 #define EMAIL_LENcxx . . $ `netcon/mtclient/mtpilottracker.cpp:122:9`! 100
123 #define TRACKER_ID_LENcxx . . $ `netcon/mtclient/mtpilottracker.cpp:123:9`! 10
124 #define PILOT_NAME_LENcxx . . $ `netcon/mtclient/mtpilottracker.cpp:124:9`! 20
125
126 #ifdef WIN32
127 #pragma pack(push, pxo)
128 #endif
129 #pragma pack(1)
130 struct vmt_descent3_structcxx . . $ vmt_descent3_struct# {
131 char tracker_idcxx . . $ vmt_descent3_struct#tracker_id.[TRACKER_ID_LENcxx . . $ `netcon/mtclient/mtpilottracker.cpp:123:9`!];
132 char pilot_namecxx . . $ vmt_descent3_struct#pilot_name.[PILOT_NAME_LENcxx . . $ `netcon/mtclient/mtpilottracker.cpp:124:9`!];
133 int rankcxx . . $ vmt_descent3_struct#rank.;
134
135 int killscxx . . $ vmt_descent3_struct#kills.;
136 int deathscxx . . $ vmt_descent3_struct#deaths.;
137 int suicidescxx . . $ vmt_descent3_struct#suicides.;
138 int online_timecxx . . $ vmt_descent3_struct#online_time.;
139 int games_playedcxx . . $ vmt_descent3_struct#games_played.;
140 uint32_tcxx . . $ uint32_t# securitycxx . . $ vmt_descent3_struct#security.;
141 uint8_tcxx . . $ uint8_t# virgin_pilotcxx . . $ vmt_descent3_struct#virgin_pilot.; // This pilot was just created if TRUE
142 uint32_tcxx . . $ uint32_t# lateral_thrustcxx . . $ vmt_descent3_struct#lateral_thrust.;
143 uint32_tcxx . . $ uint32_t# rotational_thrustcxx . . $ vmt_descent3_struct#rotational_thrust.;
144 uint32_tcxx . . $ uint32_t# sliding_pctcxx . . $ vmt_descent3_struct#sliding_pct.; // Percentage of the time you were sliding
145 uint32_tcxx . . $ uint32_t# checksumcxx . . $ vmt_descent3_struct#checksum.; // This value needs to be equal to whatever the checksum is once the packet is decoded
146 uint32_tcxx . . $ uint32_t# padcxx . . $ vmt_descent3_struct#pad.; // just to provide room for out 4 byte encryption boundry only needed on the client side for now
147 };
148 #define DESCENT3_BLOCK_SIZEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:148:9`! (sizeof(vmt_descent3_struct) - 4)
149 #ifdef WIN32
150 #pragma pack(pop, pxo)
151 #else
152 #pragma pack()
153 #endif
154
155 #include "mtpilottrack.h"cxx . . $ `<file>/netcon/mtclient/mtpilottrack.h`/
156
157 #define DLLmprintfcxx . . $ `netcon/mtclient/mtpilottracker.cpp:157:9`!(...) DLLDebug_ConsolePrintf(__VA_ARGS__)
158
159 typedef void (*Debug_ConsolePrintf_fpcxx . . $ Debug_ConsolePrintf_fp#)(int n, const char *format, ...);
160
161 extern Debug_ConsolePrintf_fpcxx . . $ Debug_ConsolePrintf_fp# DLLDebug_ConsolePrintfcxx . . $ DLLDebug_ConsolePrintf.;
162
163 typedef float (*timer_GetTime_fpcxx . . $ timer_GetTime_fp#)();
164 extern timer_GetTime_fpcxx . . $ timer_GetTime_fp# DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.;
165
166 typedef void (*HandlePilotData_fpcxx . . $ HandlePilotData_fp#)(uint8_tcxx . . $ uint8_t# *data, int len, network_addresscxx . . $ network_address# *from);
167
168 typedef int (*nw_RegisterCallback_fpcxx . . $ nw_RegisterCallback_fp#)(HandlePilotData_fpcxx . . $ HandlePilotData_fp#, uint8_tcxx . . $ uint8_t# id);
169 extern nw_RegisterCallback_fpcxx . . $ nw_RegisterCallback_fp# DLLnw_RegisterCallbackcxx . . $ DLLnw_RegisterCallback.;
170
171 typedef int (*nw_DoReceiveCallbacks_fpcxx . . $ nw_DoReceiveCallbacks_fp#)();
172 extern nw_DoReceiveCallbacks_fpcxx . . $ nw_DoReceiveCallbacks_fp# DLLnw_DoReceiveCallbackscxx . . $ DLLnw_DoReceiveCallbacks.;
173
174 #define VALID_STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:174:9`! 1
175 #define VALID_STATE_WAITINGcxx . . $ `netcon/mtclient/mtpilottracker.cpp:175:9`! 2
176 #define VALID_STATE_VALIDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:176:9`! 3
177 #define VALID_STATE_INVALIDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:177:9`! 4
178 #define VALID_STATE_TIMEOUTcxx . . $ `netcon/mtclient/mtpilottracker.cpp:178:9`! 5
179
180 #define VERSION_STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:180:9`! 1
181 #define VERSION_STATE_WAITINGcxx . . $ `netcon/mtclient/mtpilottracker.cpp:181:9`! 2
182 #define VERSION_STATE_RECEIVEDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:182:9`! 3
183 #define VERSION_STATE_TIMEOUTcxx . . $ `netcon/mtclient/mtpilottracker.cpp:183:9`! 5
184
185 #define STATE_WAITING_MOTDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:185:9`! 8
186 #define STATE_HAVE_MOTDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:186:9`! 9
187
188 #define MAX_MOTDLENcxx . . $ `netcon/mtclient/mtpilottracker.cpp:188:9`! 1000
189 // Variables
190
191 int D3WriteStatecxx . . $ D3WriteState.;
192 int D3ReadStatecxx . . $ D3ReadState.;
193 float D3LastSentcxx . . $ D3LastSent.;
194 float D3FirstSentcxx . . $ D3FirstSent.;
195
196 float D3LastSentWritecxx . . $ D3LastSentWrite.;
197 float D3FirstSentWritecxx . . $ D3FirstSentWrite.;
198
199 udp_packet_headercxx . . $ udp_packet_header# d3_pilot_reqcxx . . $ d3_pilot_req., d3_pilot_writecxx . . $ d3_pilot_write., motd_reqcxx . . $ motd_req.;
200 pilot_requestcxx . . $ pilot_request# *d3_prcxx . . $ d3_pr.;
201 vmt_descent3_structcxx . . $ vmt_descent3_struct# *ReadD3Pilotcxx . . $ ReadD3Pilot.;
202 vmt_descent3_structcxx . . $ vmt_descent3_struct# WriteD3Pilotcxx . . $ WriteD3Pilot.;
203
204 udp_packet_headercxx . . $ udp_packet_header# PacketHeadercxx . . $ PacketHeader., VersionPacketHeadercxx . . $ VersionPacketHeader.;
205 validate_id_requestcxx . . $ validate_id_request# *ValidIDReqcxx . . $ ValidIDReq.;
206
207 int MOTDStatecxx . . $ MOTDState.;
208
209 float MOTDFirstSentcxx . . $ MOTDFirstSent.;
210 float MOTDLastSentcxx . . $ MOTDLastSent.;
211
212 char *Motdptrcxx . . $ Motdptr.;
213 uint32_tcxx . . $ uint32_t# Motd_maxlencxx . . $ Motd_maxlen.;
214
215 int ValidStatecxx . . $ ValidState.;
216
217 float ValidFirstSentcxx . . $ ValidFirstSent.;
218 float ValidLastSentcxx . . $ ValidLastSent.;
219
220 int VersionStatecxx . . $ VersionState.;
221
222 float VersionFirstSentcxx . . $ VersionFirstSent.;
223 float VersionLastSentcxx . . $ VersionLastSent.;
224 char *VersionURLcxx . . $ VersionURL.;
225
226 uint32_tcxx . . $ uint32_t# ValidSecuritycxx . . $ ValidSecurity.;
227
228 char *Psztracker_idcxx . . $ Psztracker_id.;
229
230 char ProccesingPilotcxx . . $ ProccesingPilot.[PILOT_NAME_LENcxx . . $ `netcon/mtclient/mtpilottracker.cpp:124:9`!];
231
232 typedef int (*PollUI_fpcxx . . $ PollUI_fp#)();
233 extern PollUI_fpcxx . . $ PollUI_fp# DLLPollUIcxx . . $ DLLPollUI.;
234
235 int InitPilotTrackerClientcxx . . $ InitPilotTrackerClient(b126dc7c1de90089).() {
236
237 D3WriteStatecxx . . $ D3WriteState. = STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!;
238 D3ReadStatecxx . . $ D3ReadState. = STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!;
239
240 ReadD3Pilotcxx . . $ ReadD3Pilot. = nullptr;
241 ValidStatecxx . . $ ValidState. = VALID_STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:174:9`!;
242
243 VersionStatecxx . . $ VersionState. = VERSION_STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:180:9`!;
244
245 srand(DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.());
246 ValidSecuritycxx . . $ ValidSecurity. = (uint32_tcxx . . $ uint32_t#)rand();
247 // Build the request packet
248 PacketHeadercxx . . $ PacketHeader..typecxx . . $ udp_packet_header#type. = UNT_LOGIN_AUTH_REQUESTcxx . . $ `netcon/mtclient/mtpilottrack.h:145:9`!; // UNT_VALIDAT_ID_REQUEST;
249 PacketHeadercxx . . $ PacketHeader..lencxx . . $ udp_packet_header#len. = INTEL_SHORTcxx . . $ `lib/byteswap.h:108:9`!(PACKED_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtpilottrack.h:179:9`! + sizeof(validate_id_request));
250 ValidIDReqcxx . . $ ValidIDReq. = (validate_id_requestcxx . . $ validate_id_request# *)&PacketHeadercxx . . $ PacketHeader..datacxx . . $ udp_packet_header#data.;
251
252 d3_prcxx . . $ d3_pr. = (pilot_requestcxx . . $ pilot_request# *)&d3_pilot_reqcxx . . $ d3_pilot_req..datacxx . . $ udp_packet_header#data.;
253
254 DLLnw_RegisterCallbackcxx . . $ DLLnw_RegisterCallback.(HandlePilotDatacxx . . $ HandlePilotData(c3263a6d42f31e8c)., PXO_NETID_USER_TRACKERcxx . . $ `netcon/mtclient/mt_net.h:53:9`!);
255 return 1;
256 }
257
258 // Returns:
259 //-3 Error -- Called with NULL, but no request is waiting
260 //-2 Error -- Already sending data (hasn't timed out yet)
261 //-1 Timeout trying to send pilot data
262 // 0 Sending
263 // 1 Data successfully sent
264
265 // Call with NULL to poll
266 // Call with valid pointer to a vmt_descent3_struct to initiate send
267 int SendD3PilotDatacxx . . $ SendD3PilotData(1eb61746e1114d84).(vmt_descent3_structcxx . . $ vmt_descent3_struct# *d3_pilot) {
268 // First check the network
269 PollPTrackNetcxx . . $ PollPTrackNet(49f6e7a06ebc5aa8).();
270
271 if (d3_pilot == nullptr) {
272 if (D3WriteStatecxx . . $ D3WriteState. == STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!) {
273 return -3;
274 }
275 if (D3WriteStatecxx . . $ D3WriteState. == STATE_SENDING_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:114:9`!) {
276 return 0;
277 }
278 if (D3WriteStatecxx . . $ D3WriteState. == STATE_WROTE_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:117:9`!) {
279 // We wrote this pilot, and now we are about to inform the app, so back to idle
280 D3WriteStatecxx . . $ D3WriteState. = STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!;
281 return 1;
282 }
283 if (D3WriteStatecxx . . $ D3WriteState. == STATE_TIMED_OUTcxx . . $ `netcon/mtclient/mtpilottrack.h:118:9`!) {
284 // We gave up on sending this pilot, and now we are about to inform the app, so back to idle
285 D3WriteStatecxx . . $ D3WriteState. = STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!;
286
287 return -1;
288 }
289 if (D3WriteStatecxx . . $ D3WriteState. == STATE_WRITE_PILOT_FAILEDcxx . . $ `netcon/mtclient/mtpilottrack.h:120:9`!) {
290 // The tracker said this dude couldn't be written
291 D3WriteStatecxx . . $ D3WriteState. = STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!;
292
293 return 3;
294 }
295 } else if (D3WriteStatecxx . . $ D3WriteState. == STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!) {
296 // New request, send out the req, and go for it.
297
298 D3WriteStatecxx . . $ D3WriteState. = STATE_SENDING_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:114:9`!;
299
300 D3LastSentWritecxx . . $ D3LastSentWrite. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
301 D3FirstSentWritecxx . . $ D3FirstSentWrite. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
302
303 d3_pilot_writecxx . . $ d3_pilot_write..lencxx . . $ udp_packet_header#len. = INTEL_SHORTcxx . . $ `lib/byteswap.h:108:9`!(PACKED_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtpilottrack.h:179:9`! + DESCENT3_BLOCK_SIZEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:148:9`!);
304 d3_pilot_writecxx . . $ d3_pilot_write..typecxx . . $ udp_packet_header#type. = UNT_PILOT_DATA_WRITEcxx . . $ `netcon/mtclient/mtpilottrack.h:141:9`!;
305 d3_pilot_writecxx . . $ d3_pilot_write..codecxx . . $ udp_packet_header#code. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(CMD_GAME_DESCENT3cxx . . $ `netcon/mtclient/mtpilottrack.h:165:9`!);
306 d3_pilot_writecxx . . $ d3_pilot_write..securitycxx . . $ udp_packet_header#security. = d3_pilot->securitycxx . . $ vmt_descent3_struct#security.;
307
308 d3_pilot->deathscxx . . $ vmt_descent3_struct#deaths. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(d3_pilot->deaths);
309 d3_pilot->killscxx . . $ vmt_descent3_struct#kills. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(d3_pilot->kills);
310 d3_pilot->online_timecxx . . $ vmt_descent3_struct#online_time. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(d3_pilot->online_time);
311 d3_pilot->games_playedcxx . . $ vmt_descent3_struct#games_played. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(d3_pilot->games_played);
312 d3_pilot->lateral_thrustcxx . . $ vmt_descent3_struct#lateral_thrust. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(d3_pilot->lateral_thrust);
313 d3_pilot->rankcxx . . $ vmt_descent3_struct#rank. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(d3_pilot->rank);
314 d3_pilot->rotational_thrustcxx . . $ vmt_descent3_struct#rotational_thrust. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(d3_pilot->rotational_thrust);
315 d3_pilot->sliding_pctcxx . . $ vmt_descent3_struct#sliding_pct. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(d3_pilot->sliding_pct);
316 d3_pilot->suicidescxx . . $ vmt_descent3_struct#suicides. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(d3_pilot->suicides);
317
318 #if (!(defined(OEM) || defined(DEMO)))
319 // This is the secret number we will use to determine if it's
320 // a game where we want to update the player's rank or not.
321 d3_pilot->lateral_thrustcxx . . $ vmt_descent3_struct#lateral_thrust. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(0x142);
322 #endif
323 memcpy(&d3_pilot_writecxx . . $ d3_pilot_write..datacxx . . $ udp_packet_header#data., d3_pilot, DESCENT3_BLOCK_SIZEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:148:9`!);
324
325 return 0;
326 }
327 return -2;
328 }
329
330 // Returns:
331 //-3 Error -- Called with NULL, but no request is waiting
332 //-2 Error -- Already waiting on data (hasn't timed out yet)
333 //-1 Timeout waiting for pilot data
334 // 0 Waiting for data
335 // 1 Data received
336 // 2 Get Cancelled
337
338 // Call with NULL to poll
339 // Call with -1 to cancel wait
340 // Call with valid pointer to a vmt_descent3_struct to get a response
341 int GetD3PilotDatacxx . . $ GetD3PilotData(dd34ac9befeb2967).(vmt_descent3_structcxx . . $ vmt_descent3_struct# *d3_pilot, char *pilot_name, char *tracker_id) {
342 // First check the network
343 PollPTrackNetcxx . . $ PollPTrackNet(49f6e7a06ebc5aa8).();
344
345 if (d3_pilot == nullptr) {
346 if (D3ReadStatecxx . . $ D3ReadState. == STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!) {
347 return -3;
348 }
349 if (D3ReadStatecxx . . $ D3ReadState. == STATE_READING_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:115:9`!) {
350 return 0;
351 }
352 if (D3ReadStatecxx . . $ D3ReadState. == STATE_RECEIVED_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:116:9`!) {
353 // We got this pilot, and now we are about to inform the app, so back to idle
354 D3ReadStatecxx . . $ D3ReadState. = STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!;
355 ReadD3Pilotcxx . . $ ReadD3Pilot. = nullptr;
356
357 return 1;
358 }
359 if (D3ReadStatecxx . . $ D3ReadState. == STATE_TIMED_OUTcxx . . $ `netcon/mtclient/mtpilottrack.h:118:9`!) {
360 // We gave up on this pilot, and now we are about to inform the app, so back to idle
361 D3ReadStatecxx . . $ D3ReadState. = STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!;
362 ReadD3Pilotcxx . . $ ReadD3Pilot. = nullptr;
363 return -1;
364 }
365 if (D3ReadStatecxx . . $ D3ReadState. == STATE_PILOT_NOT_FOUNDcxx . . $ `netcon/mtclient/mtpilottrack.h:119:9`!) {
366 // The tracker said this dude is not found.
367 D3ReadStatecxx . . $ D3ReadState. = STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!;
368 ReadD3Pilotcxx . . $ ReadD3Pilot. = nullptr;
369 return 3;
370 }
371
372 } else if (D3ReadStatecxx . . $ D3ReadState. == STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!) {
373 // New request, send out the req, and go for it.
374
375 D3ReadStatecxx . . $ D3ReadState. = STATE_READING_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:115:9`!;
376 ReadD3Pilotcxx . . $ ReadD3Pilot. = d3_pilot;
377 D3LastSentcxx . . $ D3LastSent. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
378 D3FirstSentcxx . . $ D3FirstSent. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.(); // DLLtimer_GetTime();
379
380 d3_pilot_reqcxx . . $ d3_pilot_req..lencxx . . $ udp_packet_header#len. = INTEL_SHORTcxx . . $ `lib/byteswap.h:108:9`!(PACKED_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtpilottrack.h:179:9`! + sizeof(pilot_request));
381 d3_pilot_reqcxx . . $ d3_pilot_req..typecxx . . $ udp_packet_header#type. = UNT_PILOT_DATA_READcxx . . $ `netcon/mtclient/mtpilottrack.h:139:9`!;
382 d3_pilot_reqcxx . . $ d3_pilot_req..codecxx . . $ udp_packet_header#code. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(CMD_GAME_DESCENT3cxx . . $ `netcon/mtclient/mtpilottrack.h:165:9`!);
383 strcpy(d3_prcxx . . $ d3_pr.->pilot_namecxx . . $ pilot_request#pilot_name., pilot_name);
384 strcpy(d3_prcxx . . $ d3_pr.->tracker_idcxx . . $ pilot_request#tracker_id., tracker_id);
385 strcpy(ProccesingPilotcxx . . $ ProccesingPilot., pilot_name);
386 return 0;
387 }
388 return -2;
389 }
390
391 int GetD3PilotDataCancelcxx . . $ GetD3PilotDataCancel(b126dc7c1de90089).() {
392 // First check the network
393 PollPTrackNetcxx . . $ PollPTrackNet(49f6e7a06ebc5aa8).();
394
395 if (D3ReadStatecxx . . $ D3ReadState. == STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!) {
396 return -3;
397 } else {
398 // Cancel this baby
399 D3ReadStatecxx . . $ D3ReadState. = STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!;
400 ReadD3Pilotcxx . . $ ReadD3Pilot. = nullptr;
401 return 2;
402 }
403 }
404
405 // Send an ACK to the server
406 void AckServercxx . . $ AckServer(cb2f890c2fdad230).(uint32_tcxx . . $ uint32_t# sig) {
407 udp_packet_headercxx . . $ udp_packet_header# ack_pack;
408
409 ack_pack.typecxx . . $ udp_packet_header#type. = UNT_CONTROLcxx . . $ `netcon/mtclient/mtpilottrack.h:132:9`!;
410 ack_pack.sigcxx . . $ udp_packet_header#sig. = sig;
411 ack_pack.codecxx . . $ udp_packet_header#code. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(CMD_CLIENT_RECEIVEDcxx . . $ `netcon/mtclient/mtpilottrack.h:158:9`!);
412 ack_pack.lencxx . . $ udp_packet_header#len. = INTEL_SHORTcxx . . $ `lib/byteswap.h:108:9`!(PACKED_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtpilottrack.h:179:9`!);
413
414 SendPilotTrackerPacketcxx . . $ SendPilotTrackerPacket(dedf1e9b1c614a07).(&ack_pack);
415 // sendto(pilotsock,(char *)&ack_pack,PACKED_HEADER_ONLY_SIZE,0,(SOCKADDR *)&ptrackaddr,sizeof(SOCKADDR_IN));
416 }
417
418 void IdlePTrackcxx . . $ IdlePTrack(49f6e7a06ebc5aa8).() {
419 // socket
420 if (D3ReadStatecxx . . $ D3ReadState. == STATE_READING_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:115:9`!) {
421 if ((DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.() - D3FirstSentcxx . . $ D3FirstSent.) >= PILOT_REQ_TIMEOUTcxx . . $ `netcon/mtclient/mtpilottrack.h:125:9`!) {
422 D3ReadStatecxx . . $ D3ReadState. = STATE_TIMED_OUTcxx . . $ `netcon/mtclient/mtpilottrack.h:118:9`!;
423
424 } else if ((DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.() - D3LastSentcxx . . $ D3LastSent.) >= PILOT_REQ_RESEND_TIMEcxx . . $ `netcon/mtclient/mtpilottrack.h:126:9`!) {
425 // Send 'da packet
426 // sendto(pilotsock,(char *)&d3_pilot_req,d3_pilot_req.len,0,(SOCKADDR *)&ptrackaddr,sizeof(SOCKADDR_IN));
427 SendPilotTrackerPacketcxx . . $ SendPilotTrackerPacket(dedf1e9b1c614a07).(&d3_pilot_reqcxx . . $ d3_pilot_req.);
428 D3LastSentcxx . . $ D3LastSent. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
429 }
430 }
431
432 if (D3WriteStatecxx . . $ D3WriteState. == STATE_SENDING_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:114:9`!) {
433 if ((DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.() - D3FirstSentWritecxx . . $ D3FirstSentWrite.) >= PILOT_REQ_TIMEOUTcxx . . $ `netcon/mtclient/mtpilottrack.h:125:9`!) {
434 D3WriteStatecxx . . $ D3WriteState. = STATE_TIMED_OUTcxx . . $ `netcon/mtclient/mtpilottrack.h:118:9`!;
435
436 } else if ((DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.() - D3LastSentWritecxx . . $ D3LastSentWrite.) >= PILOT_REQ_RESEND_TIMEcxx . . $ `netcon/mtclient/mtpilottrack.h:126:9`!) {
437 // Send 'da packet
438 SendPilotTrackerPacketcxx . . $ SendPilotTrackerPacket(dedf1e9b1c614a07).(&d3_pilot_writecxx . . $ d3_pilot_write.);
439 // sendto(pilotsock,(char *)&d3_pilot_write,d3_pilot_write.len,0,(SOCKADDR *)&ptrackaddr,sizeof(SOCKADDR_IN));
440 D3LastSentWritecxx . . $ D3LastSentWrite. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
441 }
442 }
443 if (MOTDStatecxx . . $ MOTDState. == STATE_WAITING_MOTDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:185:9`!) {
444 if ((DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.() - MOTDFirstSentcxx . . $ MOTDFirstSent.) >= PILOT_REQ_TIMEOUTcxx . . $ `netcon/mtclient/mtpilottrack.h:125:9`!) {
445 MOTDStatecxx . . $ MOTDState. = STATE_TIMED_OUTcxx . . $ `netcon/mtclient/mtpilottrack.h:118:9`!;
446
447 } else if ((DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.() - MOTDLastSentcxx . . $ MOTDLastSent.) >= PILOT_REQ_RESEND_TIMEcxx . . $ `netcon/mtclient/mtpilottrack.h:126:9`!) {
448 // Send 'da packet
449 SendPilotTrackerPacketcxx . . $ SendPilotTrackerPacket(dedf1e9b1c614a07).(&motd_reqcxx . . $ motd_req.);
450 MOTDLastSentcxx . . $ MOTDLastSent. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
451 }
452 }
453 }
454
455 void PollPTrackNetcxx . . $ PollPTrackNet(49f6e7a06ebc5aa8).() {
456 IdlePTrackcxx . . $ IdlePTrack(49f6e7a06ebc5aa8).();
457 DLLnw_DoReceiveCallbackscxx . . $ DLLnw_DoReceiveCallbacks.();
458 }
459
460 int Motd_versioncxx . . $ Motd_version. = 0;
461
462 void HandlePilotDatacxx . . $ HandlePilotData(c3263a6d42f31e8c).(uint8_tcxx . . $ uint8_t# *data, int len, network_addresscxx . . $ network_address# *from) {
463 udp_packet_headercxx . . $ udp_packet_header# inpacket;
464 vmt_descent3_structcxx . . $ vmt_descent3_struct# *d3_pilot;
465 memcpy(&inpacket, data, sizeof(inpacket));
466 inpacket.lencxx . . $ udp_packet_header#len. = INTEL_SHORTcxx . . $ `lib/byteswap.h:108:9`!(inpacket.len) - 1;
467 if (len) {
468 switch (inpacket.typecxx . . $ udp_packet_header#type.) {
469 case UNT_MOTD_RESPONSEcxx . . $ `netcon/mtclient/mtpilottrack.h:138:9`!:
470 if (MOTDStatecxx . . $ MOTDState. == STATE_WAITING_MOTDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:185:9`!) {
471 if (Motdptrcxx . . $ Motdptr.) {
472 if ((inpacket.lencxx . . $ udp_packet_header#len. - PACKED_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtpilottrack.h:179:9`!) > Motd_maxlencxx . . $ Motd_maxlen.)
473 inpacket.lencxx . . $ udp_packet_header#len. = PACKED_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtpilottrack.h:179:9`! + Motd_maxlencxx . . $ Motd_maxlen. - 1;
474 strncpy(Motdptrcxx . . $ Motdptr., (char *)inpacket.datacxx . . $ udp_packet_header#data., inpacket.lencxx . . $ udp_packet_header#len. - PACKED_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtpilottrack.h:179:9`!);
475 Motdptrcxx . . $ Motdptr.[inpacket.lencxx . . $ udp_packet_header#len. - PACKED_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtpilottrack.h:179:9`!] = '\0';
476 }
477 MOTDStatecxx . . $ MOTDState. = STATE_HAVE_MOTDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:186:9`!;
478 }
479 break;
480 case UNT_PILOT_DATA_RESPONSEcxx . . $ `netcon/mtclient/mtpilottrack.h:140:9`!:
481 if (inpacket.codecxx . . $ udp_packet_header#code. == CMD_GAME_DESCENT3cxx . . $ `netcon/mtclient/mtpilottrack.h:165:9`!) {
482 if (D3ReadStatecxx . . $ D3ReadState. == STATE_READING_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:115:9`!) {
483 d3_pilot = (vmt_descent3_structcxx . . $ vmt_descent3_struct# *)&inpacket.datacxx . . $ udp_packet_header#data.;
484 xorcodecxx . . $ xorcode(c68aebd18e69fbb8).(d3_pilot, DESCENT3_BLOCK_SIZEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:148:9`!, inpacket.securitycxx . . $ udp_packet_header#security.);
485 if (stricmpcxx . . $ `linux/linux_fix.h:43:9`!(ProccesingPilot, d3_pilot->pilot_name) == 0) {
486 // Copy the data
487 memcpy(ReadD3Pilotcxx . . $ ReadD3Pilot., &inpacket.datacxx . . $ udp_packet_header#data., DESCENT3_BLOCK_SIZEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:148:9`!);
488 // Set the state
489 D3ReadStatecxx . . $ D3ReadState. = STATE_RECEIVED_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:116:9`!;
490 }
491 }
492 }
493 break;
494 case UNT_PILOT_READ_FAILEDcxx . . $ `netcon/mtclient/mtpilottrack.h:144:9`!:
495 if (inpacket.codecxx . . $ udp_packet_header#code. == CMD_GAME_DESCENT3cxx . . $ `netcon/mtclient/mtpilottrack.h:165:9`!) {
496 if (D3ReadStatecxx . . $ D3ReadState. == STATE_READING_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:115:9`!) {
497 D3ReadStatecxx . . $ D3ReadState. = STATE_PILOT_NOT_FOUNDcxx . . $ `netcon/mtclient/mtpilottrack.h:119:9`!;
498 }
499 }
500 break;
501 case UNT_PILOT_WRITE_SUCCESScxx . . $ `netcon/mtclient/mtpilottrack.h:143:9`!:
502 if (inpacket.codecxx . . $ udp_packet_header#code. == CMD_GAME_DESCENT3cxx . . $ `netcon/mtclient/mtpilottrack.h:165:9`!) {
503 if (D3WriteStatecxx . . $ D3WriteState. == STATE_SENDING_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:114:9`!) {
504 D3WriteStatecxx . . $ D3WriteState. = STATE_WROTE_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:117:9`!;
505 }
506 }
507 break;
508 case UNT_PILOT_WRITE_FAILEDcxx . . $ `netcon/mtclient/mtpilottrack.h:142:9`!:
509 if (inpacket.codecxx . . $ udp_packet_header#code. == CMD_GAME_DESCENT3cxx . . $ `netcon/mtclient/mtpilottrack.h:165:9`!) {
510 if (D3WriteStatecxx . . $ D3WriteState. == STATE_SENDING_PILOTcxx . . $ `netcon/mtclient/mtpilottrack.h:114:9`!) {
511 D3WriteStatecxx . . $ D3WriteState. = STATE_WRITE_PILOT_FAILEDcxx . . $ `netcon/mtclient/mtpilottrack.h:120:9`!;
512 }
513 }
514 break;
515 case UNT_CONTROLcxx . . $ `netcon/mtclient/mtpilottrack.h:132:9`!:
516 switch (INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(inpacket.code)) {
517 case CMD_VALIDATED_USER_ACKcxx . . $ `netcon/mtclient/mtpilottrack.h:156:9`!:
518 if (ValidStatecxx . . $ ValidState. == VALID_STATE_WAITINGcxx . . $ `netcon/mtclient/mtpilottracker.cpp:175:9`!) {
519 ValidStatecxx . . $ ValidState. = VALID_STATE_VALIDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:176:9`!;
520 }
521 break;
522 case CMD_VALIDATED_USER_NAKcxx . . $ `netcon/mtclient/mtpilottrack.h:162:9`!:
523 if (ValidStatecxx . . $ ValidState. == VALID_STATE_WAITINGcxx . . $ `netcon/mtclient/mtpilottracker.cpp:175:9`!) {
524 ValidStatecxx . . $ ValidState. = VALID_STATE_INVALIDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:177:9`!;
525 }
526 break;
527 }
528 case UNT_LOGIN_NO_AUTHcxx . . $ `netcon/mtclient/mtpilottrack.h:146:9`!:
529 if (ValidStatecxx . . $ ValidState. == VALID_STATE_WAITINGcxx . . $ `netcon/mtclient/mtpilottracker.cpp:175:9`!) {
530 ValidStatecxx . . $ ValidState. = VALID_STATE_INVALIDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:177:9`!;
531 }
532 break;
533 case UNT_LOGIN_AUTHENTICATEDcxx . . $ `netcon/mtclient/mtpilottrack.h:147:9`!:
534 if (ValidStatecxx . . $ ValidState. == VALID_STATE_WAITINGcxx . . $ `netcon/mtclient/mtpilottracker.cpp:175:9`!) {
535 ValidStatecxx . . $ ValidState. = VALID_STATE_VALIDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:176:9`!;
536 strcpy(Psztracker_idcxx . . $ Psztracker_id., (const char *)&inpacket.datacxx . . $ udp_packet_header#data.);
537 // memcpy(&Motd_version,inpacket.data[strlen(Psztracker_id)+1],sizeof(int));
538 Motd_versioncxx . . $ Motd_version. = inpacket.xcodecxx . . $ udp_packet_header#xcode.;
539 }
540 break;
541 case UNT_TRACKER_VERSION_RSPcxx . . $ `netcon/mtclient/mtpilottrack.h:149:9`!:
542 if (VersionStatecxx . . $ VersionState. == VERSION_STATE_WAITINGcxx . . $ `netcon/mtclient/mtpilottracker.cpp:181:9`!) {
543 // This is a version response possibly with the URL to download a file at the end.
544 strcpy(VersionURLcxx . . $ VersionURL., (const char *)&inpacket.datacxx . . $ udp_packet_header#data.);
545 VersionStatecxx . . $ VersionState. = VERSION_STATE_RECEIVEDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:182:9`!;
546 }
547 break;
548 default:
549 break;
550 }
551 }
552 AckServercxx . . $ AckServer(cb2f890c2fdad230).(inpacket.sigcxx . . $ udp_packet_header#sig.);
553 }
554
555 // Call with a valid struct to validate a user
556 // Call with NULL to poll
557
558 // Return codes:
559 // -3 Still waiting (returned if we were waiting for a tracker response and ValidateUser was called with a non-NULL
560 // value -2 Timeout waiting for tracker to respond -1 User invalid
561 // 0 Still waiting for response from tracker/Idle
562 // 1 User valid
563 int ValidateUsercxx . . $ ValidateUser(1b54b1e9ed0f18f2).(validate_id_requestcxx . . $ validate_id_request# *valid_id, char *trackerid) {
564 ValidIdlecxx . . $ ValidIdle(49f6e7a06ebc5aa8).();
565 if (valid_id == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) {
566 switch (ValidStatecxx . . $ ValidState.) {
567 case VALID_STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:174:9`!:
568 return 0;
569 break;
570 case VALID_STATE_WAITINGcxx . . $ `netcon/mtclient/mtpilottracker.cpp:175:9`!:
571 return 0;
572 break;
573 case VALID_STATE_VALIDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:176:9`!:
574 ValidStatecxx . . $ ValidState. = VALID_STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:174:9`!;
575 return 1;
576 break;
577 case VALID_STATE_INVALIDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:177:9`!:
578 ValidStatecxx . . $ ValidState. = VALID_STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:174:9`!;
579 return -1;
580 case VALID_STATE_TIMEOUTcxx . . $ `netcon/mtclient/mtpilottracker.cpp:178:9`!:
581 ValidStatecxx . . $ ValidState. = VALID_STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:174:9`!;
582 return -2;
583 }
584 return 0;
585 } else {
586 // if(ValidState==VALID_STATE_IDLE)
587 {
588 /*
589 //First, flush the input buffer for the socket
590 uint32_t bytesin;
591 udp_packet_header inpacket;
592 do
593 {
594 bytesin = ReceivePilotTracker(&inpacket);
595 }while(bytesin && (bytesin!=-1));
596 */
597 Psztracker_idcxx . . $ Psztracker_id. = trackerid;
598 ValidSecuritycxx . . $ ValidSecurity. = (uint32_tcxx . . $ uint32_t#)rand();
599 PacketHeadercxx . . $ PacketHeader..securitycxx . . $ udp_packet_header#security. = ValidSecuritycxx . . $ ValidSecurity.;
600 // strcpy(ValidIDReq->tracker_id,valid_id->tracker_id);
601 strcpy(ValidIDReqcxx . . $ ValidIDReq.->logincxx . . $ validate_id_request#login., valid_id->logincxx . . $ validate_id_request#login.);
602 strcpy(ValidIDReqcxx . . $ ValidIDReq.->passwordcxx . . $ validate_id_request#password., valid_id->passwordcxx . . $ validate_id_request#password.);
603 SendPilotTrackerPacketcxx . . $ SendPilotTrackerPacket(dedf1e9b1c614a07).(&PacketHeadercxx . . $ PacketHeader.);
604 ValidStatecxx . . $ ValidState. = VALID_STATE_WAITINGcxx . . $ `netcon/mtclient/mtpilottracker.cpp:175:9`!;
605 ValidFirstSentcxx . . $ ValidFirstSent. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
606 ValidLastSentcxx . . $ ValidLastSent. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
607 return 0;
608 }
609 // else
610 // {
611 // return -3;
612 // }
613 }
614 }
615
616 void ValidIdlecxx . . $ ValidIdle(49f6e7a06ebc5aa8).() {
617 PollPTrackNetcxx . . $ PollPTrackNet(49f6e7a06ebc5aa8).();
618 if (ValidStatecxx . . $ ValidState. == VALID_STATE_WAITINGcxx . . $ `netcon/mtclient/mtpilottracker.cpp:175:9`!) {
619 if ((DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.() - ValidFirstSentcxx . . $ ValidFirstSent.) >= PILOT_REQ_TIMEOUTcxx . . $ `netcon/mtclient/mtpilottrack.h:125:9`!) {
620 ValidStatecxx . . $ ValidState. = VALID_STATE_TIMEOUTcxx . . $ `netcon/mtclient/mtpilottracker.cpp:178:9`!;
621
622 } else if ((DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.() - ValidLastSentcxx . . $ ValidLastSent.) >= PILOT_REQ_RESEND_TIMEcxx . . $ `netcon/mtclient/mtpilottrack.h:126:9`!) {
623 // Send 'da packet
624 SendPilotTrackerPacketcxx . . $ SendPilotTrackerPacket(dedf1e9b1c614a07).(&PacketHeadercxx . . $ PacketHeader.);
625 ValidLastSentcxx . . $ ValidLastSent. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
626 }
627 }
628 }
629 // This code will modify 4 bytes at a time, so make sure to pad it!!!
630 void xorcodecxx . . $ xorcode(c68aebd18e69fbb8).(void *data, uint32_tcxx . . $ uint32_t# len, uint32_tcxx . . $ uint32_t# hash) {
631 return;
632 uint32_tcxx . . $ uint32_t# i = 0;
633 uint32_tcxx . . $ uint32_t# *src = (uint32_tcxx . . $ uint32_t# *)&data;
634
635 while (i < len) {
636 *src = *src ^ hash;
637 src++;
638 i += sizeof(uint32_tcxx . . $ uint32_t#);
639 }
640 }
641
642 void VersionIdlecxx . . $ VersionIdle(49f6e7a06ebc5aa8).() {
643 PollPTrackNetcxx . . $ PollPTrackNet(49f6e7a06ebc5aa8).();
644 if (VersionStatecxx . . $ VersionState. == VERSION_STATE_WAITINGcxx . . $ `netcon/mtclient/mtpilottracker.cpp:181:9`!) {
645 if ((DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.() - VersionFirstSentcxx . . $ VersionFirstSent.) >= PILOT_REQ_TIMEOUTcxx . . $ `netcon/mtclient/mtpilottrack.h:125:9`!) {
646 VersionStatecxx . . $ VersionState. = VERSION_STATE_TIMEOUTcxx . . $ `netcon/mtclient/mtpilottracker.cpp:183:9`!;
647
648 } else if ((DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.() - VersionLastSentcxx . . $ VersionLastSent.) >= PILOT_REQ_RESEND_TIMEcxx . . $ `netcon/mtclient/mtpilottrack.h:126:9`!) {
649 // Send 'da packet
650 SendPilotTrackerPacketcxx . . $ SendPilotTrackerPacket(dedf1e9b1c614a07).(&VersionPacketHeadercxx . . $ VersionPacketHeader.);
651 VersionLastSentcxx . . $ VersionLastSent. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
652 }
653 }
654 }
655
656 // Return codes:
657 // -3 Still waiting (returned if we were waiting for a tracker response and VersionCheck was called with a non-NULL
658 // value -2 Timeout waiting for tracker to respond
659 // 0 Still waiting for response from tracker/Idle
660 // 1 Version received (URL[0] will not be NULL if we have the URL which means we need a newer version)
661 // Call once with the real version, then poll with the version set to 0 URL is a pointer to a char buff(max size == 200)
662 // that will be filled if/when we get a URL response
663 int MTAVersionCheckcxx . . $ MTAVersionCheck(fa84e865f2d62ca9).(uint32_tcxx . . $ uint32_t# oldver, char *URL) {
664
665 int res = DLLPollUIcxx . . $ DLLPollUI.();
666 if (res == 99) {
667 VersionStatecxx . . $ VersionState. = VERSION_STATE_TIMEOUTcxx . . $ `netcon/mtclient/mtpilottracker.cpp:183:9`!;
668 }
669 VersionIdlecxx . . $ VersionIdle(49f6e7a06ebc5aa8).();
670 if (oldver == 0) {
671 switch (VersionStatecxx . . $ VersionState.) {
672 case VERSION_STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:180:9`!:
673 return 0;
674 break;
675 case VERSION_STATE_WAITINGcxx . . $ `netcon/mtclient/mtpilottracker.cpp:181:9`!:
676 return 0;
677 break;
678 case VERSION_STATE_RECEIVEDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:182:9`!:
679 VersionStatecxx . . $ VersionState. = VERSION_STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:180:9`!;
680 return 1;
681 case VERSION_STATE_TIMEOUTcxx . . $ `netcon/mtclient/mtpilottracker.cpp:183:9`!:
682 VersionStatecxx . . $ VersionState. = VERSION_STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:180:9`!;
683 return -2;
684 }
685 return 0;
686 } else {
687 if (VersionStatecxx . . $ VersionState. == VERSION_STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottracker.cpp:180:9`!) {
688 /*
689 //First, flush the input buffer for the socket
690 uint32_t bytesin;
691 udp_packet_header inpacket;
692 do
693 {
694 bytesin = ReceivePilotTracker(&inpacket);
695 }while(bytesin && (bytesin!=-1));
696 */
697 VersionURLcxx . . $ VersionURL. = URL;
698 VersionPacketHeadercxx . . $ VersionPacketHeader..lencxx . . $ udp_packet_header#len. = INTEL_SHORTcxx . . $ `lib/byteswap.h:108:9`!(PACKED_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtpilottrack.h:179:9`!);
699 VersionPacketHeadercxx . . $ VersionPacketHeader..typecxx . . $ udp_packet_header#type. = UNT_TRACKER_VERSION_REQcxx . . $ `netcon/mtclient/mtpilottrack.h:148:9`!;
700 VersionPacketHeadercxx . . $ VersionPacketHeader..xcodecxx . . $ udp_packet_header#xcode. = INTEL_SHORTcxx . . $ `lib/byteswap.h:108:9`!(CMD_GAME_DESCENT3cxx . . $ `netcon/mtclient/mtpilottrack.h:165:9`!);
701 VersionPacketHeadercxx . . $ VersionPacketHeader..codecxx . . $ udp_packet_header#code. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(oldver);
702
703 SendPilotTrackerPacketcxx . . $ SendPilotTrackerPacket(dedf1e9b1c614a07).(&VersionPacketHeadercxx . . $ VersionPacketHeader.);
704 VersionStatecxx . . $ VersionState. = VERSION_STATE_WAITINGcxx . . $ `netcon/mtclient/mtpilottracker.cpp:181:9`!;
705 VersionFirstSentcxx . . $ VersionFirstSent. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
706 VersionLastSentcxx . . $ VersionLastSent. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
707 return 0;
708 } else {
709 return -3;
710 }
711 }
712 }
713
714 int GetD3MOTDcxx . . $ GetD3MOTD(6abd07ddb1a912f0).(char *szmotd, int maxlen) {
715 // First check the network
716 PollPTrackNetcxx . . $ PollPTrackNet(49f6e7a06ebc5aa8).();
717
718 if (szmotd == nullptr) {
719 if (MOTDStatecxx . . $ MOTDState. == STATE_WAITING_MOTDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:185:9`!) {
720 return 0;
721 }
722 if (MOTDStatecxx . . $ MOTDState. == STATE_TIMED_OUTcxx . . $ `netcon/mtclient/mtpilottrack.h:118:9`!) {
723 MOTDStatecxx . . $ MOTDState. = STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!;
724 return -1;
725 }
726 if (MOTDStatecxx . . $ MOTDState. == STATE_HAVE_MOTDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:186:9`!) {
727 MOTDStatecxx . . $ MOTDState. = STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!;
728 return 1;
729 }
730 return -3;
731 } else if (MOTDStatecxx . . $ MOTDState. == STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!) {
732 // New request, send out the req, and go for it.
733
734 MOTDStatecxx . . $ MOTDState. = STATE_WAITING_MOTDcxx . . $ `netcon/mtclient/mtpilottracker.cpp:185:9`!;
735 Motdptrcxx . . $ Motdptr. = szmotd;
736 Motd_maxlencxx . . $ Motd_maxlen. = maxlen;
737 MOTDFirstSentcxx . . $ MOTDFirstSent. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
738 MOTDLastSentcxx . . $ MOTDLastSent. = DLLtimer_GetTimecxx . . $ DLLtimer_GetTime.();
739
740 motd_reqcxx . . $ motd_req..lencxx . . $ udp_packet_header#len. = INTEL_SHORTcxx . . $ `lib/byteswap.h:108:9`!(PACKED_HEADER_ONLY_SIZEcxx . . $ `netcon/mtclient/mtpilottrack.h:179:9`!);
741 motd_reqcxx . . $ motd_req..typecxx . . $ udp_packet_header#type. = UNT_MOTD_REQUESTcxx . . $ `netcon/mtclient/mtpilottrack.h:137:9`!;
742 motd_reqcxx . . $ motd_req..codecxx . . $ udp_packet_header#code. = INTEL_INTcxx . . $ `lib/byteswap.h:107:9`!(CMD_GAME_DESCENT3cxx . . $ `netcon/mtclient/mtpilottrack.h:165:9`!);
743 return 0;
744 }
745 return -2;
746 }
747
748 int GetD3MOTDCancelcxx . . $ GetD3MOTDCancel(b126dc7c1de90089).() {
749 // First check the network
750 PollPTrackNetcxx . . $ PollPTrackNet(49f6e7a06ebc5aa8).();
751
752 if (MOTDStatecxx . . $ MOTDState. == STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!) {
753 return -3;
754 } else {
755 // Cancel this baby
756 MOTDStatecxx . . $ MOTDState. = STATE_IDLEcxx . . $ `netcon/mtclient/mtpilottrack.h:113:9`!;
757 Motdptrcxx . . $ Motdptr. = nullptr;
758 ReadD3Pilotcxx . . $ ReadD3Pilot. = nullptr;
759 return 2;
760 }
761 }